@capybara-hq/kernel 0.1.0-rc.53 → 0.1.0-rc.55

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 (190) hide show
  1. package/dist/admin/admin.schemas.d.ts +11 -1
  2. package/dist/catalog/catalog.module.js +1 -1
  3. package/dist/catalog/marketplaces.service.d.ts +1 -1
  4. package/dist/catalog/requests.service.d.ts +5 -5
  5. package/dist/catalog/requests.service.js +9 -9
  6. package/dist/channels/cards.d.ts +4 -3
  7. package/dist/channels/cards.js +25 -16
  8. package/dist/channels/phrases.d.ts +15 -4
  9. package/dist/channels/phrases.js +15 -1
  10. package/dist/config/load.d.ts +26 -7
  11. package/dist/config/load.js +60 -9
  12. package/dist/config/permission-migration.d.ts +17 -9
  13. package/dist/config/permission-migration.js +60 -9
  14. package/dist/config/schema.d.ts +15 -1
  15. package/dist/config/schema.js +66 -11
  16. package/dist/conversations/events.d.ts +247 -5
  17. package/dist/conversations/events.js +127 -16
  18. package/dist/conversations/permission-profiles.controller.d.ts +12 -2
  19. package/dist/conversations/permission-profiles.service.d.ts +12 -2
  20. package/dist/conversations/permission-profiles.service.js +11 -4
  21. package/dist/db/kernel-schema.d.ts +18 -2
  22. package/dist/devices/device-projects.service.d.ts +1 -1
  23. package/dist/devices/device-projects.service.js +6 -6
  24. package/dist/devices/devices.controller.d.ts +10 -8
  25. package/dist/devices/devices.controller.js +14 -18
  26. package/dist/devices/devices.schemas.d.ts +5 -5
  27. package/dist/devices/devices.schemas.js +5 -5
  28. package/dist/devices/devices.service.d.ts +188 -175
  29. package/dist/devices/devices.service.js +284 -292
  30. package/dist/devices/dto.d.ts +43 -23
  31. package/dist/devices/dto.js +45 -49
  32. package/dist/devices/project-rules.d.ts +0 -10
  33. package/dist/devices/project-rules.js +0 -5
  34. package/dist/errors.d.ts +43 -19
  35. package/dist/errors.js +43 -19
  36. package/dist/evals/reconstruct.d.ts +12 -3
  37. package/dist/evals/reconstruct.js +10 -6
  38. package/dist/evals/recorded-permission-context.d.ts +6 -4
  39. package/dist/evals/recorded-permission-context.js +15 -9
  40. package/dist/evals/run-replay.d.ts +6 -1
  41. package/dist/evals/run-replay.js +7 -2
  42. package/dist/evals/worker.js +3 -1
  43. package/dist/http/api.module.js +8 -0
  44. package/dist/http/app.js +9 -0
  45. package/dist/http/meta.controller.d.ts +33 -0
  46. package/dist/http/meta.controller.js +72 -0
  47. package/dist/identity/app-auth.controller.d.ts +25 -0
  48. package/dist/identity/app-auth.controller.js +64 -0
  49. package/dist/identity/app-auth.d.ts +66 -0
  50. package/dist/identity/app-auth.js +203 -0
  51. package/dist/identity/app-auth.schemas.d.ts +47 -0
  52. package/dist/identity/app-auth.schemas.js +43 -0
  53. package/dist/identity/identity.module.d.ts +1 -1
  54. package/dist/identity/identity.module.js +4 -1
  55. package/dist/identity/settings.d.ts +45 -18
  56. package/dist/identity/settings.js +151 -51
  57. package/dist/infra/config/kernel-config.service.d.ts +1 -1
  58. package/dist/infra/config/kernel-config.service.js +19 -5
  59. package/dist/infra/outbox/registry.d.ts +14 -0
  60. package/dist/infra/outbox/registry.js +15 -0
  61. package/dist/infra/throttler/named-throttlers.d.ts +3 -2
  62. package/dist/infra/throttler/named-throttlers.js +14 -2
  63. package/dist/local-devices/device-auth.controller.d.ts +1 -1
  64. package/dist/local-devices/device-auth.controller.js +1 -1
  65. package/dist/local-devices/device-auth.d.ts +4 -4
  66. package/dist/local-devices/device-auth.js +1 -1
  67. package/dist/local-devices/device-policy.service.d.ts +18 -9
  68. package/dist/local-devices/device-policy.service.js +21 -61
  69. package/dist/local-devices/device-routes.d.ts +3 -1
  70. package/dist/local-devices/device-routes.js +15 -4
  71. package/dist/local-devices/instance-bindings.js +5 -2
  72. package/dist/local-devices/local-device-gateway.d.ts +2 -2
  73. package/dist/local-devices/local-device-gateway.js +3 -3
  74. package/dist/local-devices/local-device-provider.d.ts +4 -4
  75. package/dist/local-devices/local-device-provider.js +23 -9
  76. package/dist/local-devices/local-devices.module.d.ts +1 -1
  77. package/dist/local-devices/local-devices.module.js +1 -1
  78. package/dist/local-devices/machines.d.ts +40 -16
  79. package/dist/local-devices/machines.js +89 -61
  80. package/dist/local-devices/owner-report.d.ts +16 -14
  81. package/dist/local-devices/owner-report.js +24 -30
  82. package/dist/local-devices/owner-reports.js +26 -8
  83. package/dist/local-devices/policy-summary.d.ts +25 -44
  84. package/dist/local-devices/policy-summary.js +26 -71
  85. package/dist/local-devices/relay.d.ts +6 -6
  86. package/dist/local-devices/relay.js +10 -8
  87. package/dist/net/public-address.d.ts +1 -1
  88. package/dist/net/public-address.js +5 -2
  89. package/dist/orgs/device-network-setting.d.ts +82 -0
  90. package/dist/orgs/device-network-setting.js +142 -0
  91. package/dist/orgs/settings.service.d.ts +103 -66
  92. package/dist/orgs/settings.service.js +201 -137
  93. package/dist/overrides.d.ts +5 -1
  94. package/dist/overrides.js +2 -0
  95. package/dist/platform/exclusions.js +24 -1
  96. package/dist/platform/operation.js +2 -2
  97. package/dist/platform/ops/admin.ops.js +20 -11
  98. package/dist/platform/ops/devices.ops.js +70 -5
  99. package/dist/platform/ops/org-settings.ops.js +10 -6
  100. package/dist/platform/ops/orgs.ops.js +2 -1
  101. package/dist/platform/ops/platform-icons.ops.d.ts +14 -0
  102. package/dist/platform/ops/platform-icons.ops.js +117 -0
  103. package/dist/platform/platform-ops.module.d.ts +2 -1
  104. package/dist/platform/platform-ops.module.js +3 -0
  105. package/dist/platform/route-schemas.js +3 -0
  106. package/dist/runtime/context/permission-profile.d.ts +17 -8
  107. package/dist/runtime/context/permission-profile.js +126 -45
  108. package/dist/runtime/maintenance.d.ts +5 -2
  109. package/dist/runtime/maintenance.js +15 -4
  110. package/dist/runtime/permission-context.service.d.ts +1 -1
  111. package/dist/runtime/permission-context.service.js +5 -3
  112. package/dist/runtime/project/knowledge.d.ts +5 -4
  113. package/dist/runtime/project/knowledge.js +2 -1
  114. package/dist/runtime/project/knowledge.service.js +16 -13
  115. package/dist/sandbox/cloud-permission-snapshot.js +22 -3
  116. package/dist/sandbox/device-sandbox-settings.d.ts +230 -0
  117. package/dist/sandbox/device-sandbox-settings.js +470 -0
  118. package/dist/sandbox/device-sandbox.d.ts +187 -0
  119. package/dist/sandbox/device-sandbox.js +236 -0
  120. package/dist/sandbox/held-operations.js +15 -7
  121. package/dist/sandbox/modes.d.ts +49 -24
  122. package/dist/sandbox/modes.js +27 -19
  123. package/dist/sandbox/operation-authority-types.d.ts +6 -5
  124. package/dist/sandbox/operation-authority-types.js +7 -8
  125. package/dist/sandbox/operation-authority.d.ts +23 -9
  126. package/dist/sandbox/operation-authority.js +179 -97
  127. package/dist/sandbox/permission-auto-grants.d.ts +42 -0
  128. package/dist/sandbox/permission-auto-grants.js +145 -0
  129. package/dist/sandbox/permission-call-grants.d.ts +12 -4
  130. package/dist/sandbox/permission-call-grants.js +84 -35
  131. package/dist/sandbox/permission-call-grants.module.js +10 -3
  132. package/dist/sandbox/permission-call-types.d.ts +39 -5
  133. package/dist/sandbox/permission-ceiling-writes.d.ts +29 -3
  134. package/dist/sandbox/permission-ceiling-writes.js +38 -4
  135. package/dist/sandbox/permission-config-publication.d.ts +44 -2
  136. package/dist/sandbox/permission-config-publication.js +230 -59
  137. package/dist/sandbox/permission-context-types.d.ts +2 -2
  138. package/dist/sandbox/permission-facts.d.ts +144 -15
  139. package/dist/sandbox/permission-facts.js +258 -70
  140. package/dist/sandbox/permission-runtime-reports.d.ts +5 -4
  141. package/dist/sandbox/permission-runtime-reports.js +19 -29
  142. package/dist/sandbox/review/classifier.d.ts +8 -0
  143. package/dist/sandbox/review/classifier.js +10 -0
  144. package/dist/sandbox/review/permission-candidate.d.ts +69 -5
  145. package/dist/sandbox/review/permission-candidate.js +153 -30
  146. package/dist/sandbox/review/review.service.d.ts +19 -3
  147. package/dist/sandbox/review/review.service.js +59 -11
  148. package/dist/sandbox/review/rules.js +23 -3
  149. package/dist/sandbox/sandbox.service.d.ts +29 -11
  150. package/dist/sandbox/sandbox.service.js +51 -26
  151. package/dist/skills/invoke.js +3 -2
  152. package/dist/themes/platform-icon-objects.d.ts +51 -0
  153. package/dist/themes/platform-icon-objects.js +113 -0
  154. package/dist/themes/platform-icon-public.controller.d.ts +17 -0
  155. package/dist/themes/platform-icon-public.controller.js +58 -0
  156. package/dist/themes/platform-icon.controller.d.ts +22 -0
  157. package/dist/themes/platform-icon.controller.js +65 -0
  158. package/dist/themes/platform-icon.schemas.d.ts +48 -0
  159. package/dist/themes/platform-icon.schemas.js +53 -0
  160. package/dist/themes/platform-icon.service.d.ts +83 -0
  161. package/dist/themes/platform-icon.service.js +301 -0
  162. package/dist/themes/themes.module.d.ts +4 -1
  163. package/dist/themes/themes.module.js +9 -4
  164. package/dist/tools/approvals.service.d.ts +26 -116
  165. package/dist/tools/approvals.service.js +42 -346
  166. package/dist/tools/builtins/sandbox/bash.d.ts +16 -3
  167. package/dist/tools/builtins/sandbox/bash.js +80 -28
  168. package/dist/tools/builtins/sandbox/common.d.ts +39 -14
  169. package/dist/tools/builtins/sandbox/common.js +47 -24
  170. package/dist/tools/builtins/sandbox/deliver.js +7 -4
  171. package/dist/tools/builtins/skill-load.d.ts +2 -2
  172. package/dist/tools/builtins/skill-load.js +4 -3
  173. package/dist/tools/device-op-resolver.d.ts +4 -10
  174. package/dist/tools/device-op-resolver.js +8 -19
  175. package/dist/tools/network-asks.d.ts +52 -15
  176. package/dist/tools/network-asks.js +55 -25
  177. package/dist/tools/pipeline.d.ts +26 -14
  178. package/dist/tools/pipeline.js +144 -61
  179. package/dist/tools/registry.d.ts +6 -0
  180. package/dist/tools/tools.module.js +1 -1
  181. package/package.json +4 -4
  182. package/src/migrations/0164_platform_icons.sql +10 -0
  183. package/src/migrations/0165_device_network_columns.sql +50 -0
  184. package/src/migrations/0166_permission_grant_full_access.sql +17 -0
  185. package/src/migrations/0167_device_network_backfill.sql +32 -0
  186. package/src/migrations/0168_binding_installed_connection.sql +6 -0
  187. package/dist/orgs/cloud-network-setting.d.ts +0 -33
  188. package/dist/orgs/cloud-network-setting.js +0 -47
  189. package/dist/sandbox/platform-full-access.d.ts +0 -110
  190. package/dist/sandbox/platform-full-access.js +0 -198
@@ -0,0 +1,43 @@
1
+ import { z } from "zod";
2
+ import { createZodDto } from "../infra/validation/create-zod-dto.js";
3
+ /** Text without control, format or unassigned characters (it lands in a user agent and the audit). */
4
+ const PRINTABLE_RE = /^[^\p{C}]+$/u;
5
+ const printable = (max) => z
6
+ .string()
7
+ .min(1)
8
+ .max(max)
9
+ .regex(PRINTABLE_RE, { message: "Must contain only printable characters" });
10
+ /**
11
+ * `POST /api/v1/app-auth/authorize` (desktop client spec §6.5): the person consents on the web to
12
+ * sign a native app in. `codeChallenge` is BASE64URL(SHA-256(verifier)), always 43 characters;
13
+ * only the `S256` method exists. `deny` answers the `error=access_denied` redirect instead.
14
+ */
15
+ export const AppAuthorizeBodySchema = z
16
+ .object({
17
+ client: z.literal("desktop"),
18
+ redirectUri: z.string().min(1).max(2048),
19
+ codeChallenge: z.string().regex(/^[A-Za-z0-9_-]{43}$/, {
20
+ message: "Must be the base64url SHA-256 of the code verifier (43 characters)",
21
+ }),
22
+ codeChallengeMethod: z.literal("S256"),
23
+ state: printable(512),
24
+ name: printable(64),
25
+ appVersion: printable(32),
26
+ deny: z.boolean().optional(),
27
+ })
28
+ .strict();
29
+ export class AppAuthorizeBodyDto extends createZodDto(AppAuthorizeBodySchema, "AppAuthorizeBody") {
30
+ }
31
+ /**
32
+ * `POST /api/v1/app-auth/token`: the app exchanges the one-time code with its PKCE verifier. Only
33
+ * the shape is checked here; every content failure answers `app_auth.code_invalid` (the service).
34
+ */
35
+ export const AppTokenBodySchema = z
36
+ .object({
37
+ code: z.string().max(256),
38
+ codeVerifier: z.string().max(256),
39
+ redirectUri: z.string().max(2048),
40
+ })
41
+ .strict();
42
+ export class AppTokenBodyDto extends createZodDto(AppTokenBodySchema, "AppTokenBody") {
43
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Identity: accounts, sessions, API tokens, deployment settings and the super admin lock,
3
- * external identities with IM binding and third-party sign-in.
3
+ * external identities with IM binding and third-party sign-in, native-app sign-in.
4
4
  */
5
5
  export declare class IdentityModule {
6
6
  }
@@ -11,6 +11,7 @@ import { OrgLockModule } from "../orgs/org-lock.js";
11
11
  import { PermissionAuthorityModule } from "../sandbox/permission-authority.module.js";
12
12
  import { AccountsModule } from "./accounts.js";
13
13
  import { ApiTokenService } from "./api-tokens.js";
14
+ import { AppAuthService } from "./app-auth.js";
14
15
  import { IdentityBinding } from "./binding.js";
15
16
  import { ExternalIdentities } from "./external.js";
16
17
  import { ExternalIdentityLock } from "./external-identity-lock.js";
@@ -21,7 +22,7 @@ import { SsoFlow } from "./sso.js";
21
22
  import { SuperAdminLockModule } from "./super-admin.js";
22
23
  /**
23
24
  * Identity: accounts, sessions, API tokens, deployment settings and the super admin lock,
24
- * external identities with IM binding and third-party sign-in.
25
+ * external identities with IM binding and third-party sign-in, native-app sign-in.
25
26
  */
26
27
  let IdentityModule = class IdentityModule {
27
28
  };
@@ -44,6 +45,7 @@ IdentityModule = __decorate([
44
45
  IdentityBinding,
45
46
  SsoFlow,
46
47
  InitialPasswords,
48
+ AppAuthService,
47
49
  ],
48
50
  exports: [
49
51
  AccountsModule,
@@ -55,6 +57,7 @@ IdentityModule = __decorate([
55
57
  IdentityBinding,
56
58
  SsoFlow,
57
59
  InitialPasswords,
60
+ AppAuthService,
58
61
  ],
59
62
  })
60
63
  ], IdentityModule);
@@ -5,8 +5,8 @@ import { KernelConfigService } from "../infra/config/kernel-config.service.js";
5
5
  import { KernelDb } from "../infra/database/kernel-db.js";
6
6
  import { TransactionHost } from "../infra/database/transaction-host.js";
7
7
  import type { KernelLogger } from "../log.js";
8
+ import { type DeviceSandboxSettingsView, type DevicesNetworkPatch, type DevicesNetworkStored, type DevicesNetworkView, type DevicesOutsideSandboxPatch, type DevicesOutsideSandboxStored, type DevicesOutsideSandboxView } from "../sandbox/device-sandbox-settings.js";
8
9
  import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
9
- import { type DevicesFullAccessPatch, type DevicesFullAccessStored, type DevicesFullAccessView } from "../sandbox/platform-full-access.js";
10
10
  import { type ExternalSharingView, type ShareMaxExpiryView } from "../shares/settings.js";
11
11
  import { type UiArrangement } from "../ui/arrangement.js";
12
12
  import { SuperAdminLock } from "./super-admin.js";
@@ -163,13 +163,16 @@ export declare const DEPLOYMENT_SETTINGS: z.ZodObject<{
163
163
  }, z.core.$strip>;
164
164
  export type DeploymentSettings = z.infer<typeof DEPLOYMENT_SETTINGS>;
165
165
  /**
166
- * What `GET /api/v1/admin/settings` answers: the stored settings, the platform's Full permission
167
- * switch as it is in effect with where it comes from (`env` / `file` / `nacos`: the startup config,
168
- * read-only here; `db`: chosen in the admin console; `default`), and the platform's effective
169
- * attribution defaults with their sources the same way.
166
+ * What `GET /api/v1/admin/settings` answers: the stored settings, the platform's device sandbox
167
+ * settings as they are in effect with where each comes from (`env` / `file` / `nacos`: the startup
168
+ * config, read-only here; `db`: chosen in the admin console; `default`), and the platform's
169
+ * effective attribution defaults with their sources the same way.
170
170
  */
171
171
  export type DeploymentSettingsView = DeploymentSettings & {
172
- devicesFullAccess: DevicesFullAccessView;
172
+ /** Whether a device may be granted running a call outside its sandbox. */
173
+ devicesOutsideSandbox: DevicesOutsideSandboxView;
174
+ /** The sandbox network's default and ceiling (the default never above the ceiling). */
175
+ devicesNetwork: DevicesNetworkView;
173
176
  attribution: PlatformAttributionView;
174
177
  /** The platform's external sharing switch in effect and where it comes from. */
175
178
  externalSharing: ExternalSharingView;
@@ -227,12 +230,22 @@ export declare const DEPLOYMENT_SETTINGS_PATCH: z.ZodObject<{
227
230
  enabled: z.ZodOptional<z.ZodBoolean>;
228
231
  disabled: z.ZodOptional<z.ZodArray<z.ZodString>>;
229
232
  }, z.core.$strict>>;
230
- devicesFullAccess: z.ZodOptional<z.ZodObject<{
233
+ devicesOutsideSandbox: z.ZodOptional<z.ZodObject<{
231
234
  permission: z.ZodNullable<z.ZodEnum<{
232
235
  allowed: "allowed";
233
236
  off: "off";
234
237
  }>>;
235
238
  }, z.core.$strict>>;
239
+ devicesNetwork: z.ZodOptional<z.ZodObject<{
240
+ default: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
241
+ allowlist: "allowlist";
242
+ open: "open";
243
+ }>>>;
244
+ ceiling: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
245
+ allowlist: "allowlist";
246
+ open: "open";
247
+ }>>>;
248
+ }, z.core.$strict>>;
236
249
  attribution: z.ZodOptional<z.ZodObject<{
237
250
  commit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
238
251
  pr: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -312,26 +325,39 @@ export declare class SettingsService {
312
325
  readonly txHost: TransactionHost;
313
326
  private readonly adminLock;
314
327
  private readonly log;
315
- /** The startup config's `devices.fullAccess`, which wins over the stored choice. */
328
+ /** The startup config's `devices.outsideSandbox` / `devices.network.*`, which win over the stored choice. */
316
329
  private readonly config;
317
330
  private readonly ceilings;
318
331
  constructor(db: KernelDb, txHost: TransactionHost, adminLock: SuperAdminLock, log: Pick<KernelLogger, "warn">,
319
- /** The startup config's `devices.fullAccess`, which wins over the stored choice. */
332
+ /** The startup config's `devices.outsideSandbox` / `devices.network.*`, which win over the stored choice. */
320
333
  config: Pick<KernelConfigService, "get" | "fieldSource">, ceilings: PermissionCeilingWrites);
321
- /** The settings with the platform's Full switch and attribution defaults in effect. */
334
+ /** The settings with the platform's device sandbox settings and attribution defaults in effect. */
322
335
  view(): Promise<DeploymentSettingsView>;
323
336
  private attributionView;
337
+ /** The cloud devices following the platform's network default (their org sets none). */
338
+ private devicesFollowingPlatformDefault;
324
339
  /**
325
- * The refusals of a `devicesFullAccess` change: a value set in the startup config
326
- * (`deployment.setting_readonly`) and, with `onlyNarrows` (an API token, the Platform tool),
327
- * allowing Full where it is off (`deployment.full_access_not_allowed`). Returns the next stored
328
- * choice and the effective switch before it.
340
+ * The refusals of a `devicesOutsideSandbox` / `devicesNetwork` change against the stored choice
341
+ * and the startup config: a field set in the startup config (`deployment.setting_readonly`); a
342
+ * network default above the effective ceiling (`deployment.network_not_allowed`); and, with
343
+ * `onlyNarrows` (an API token, the Platform tool), any widening: allowing outside-sandbox runs
344
+ * where it is off (`deployment.outside_sandbox_not_allowed`; clearing it goes back to the default
345
+ * allowed, a widening too) or a network default or ceiling opened where it is the allowlist
346
+ * (`deployment.network_not_allowed`). Returns the next stored choices and the effective view
347
+ * before and after.
329
348
  */
330
- checkDevicesFullAccess(patch: DevicesFullAccessPatch, opts?: {
349
+ checkDeviceSandbox(patch: {
350
+ devicesOutsideSandbox?: DevicesOutsideSandboxPatch | undefined;
351
+ devicesNetwork?: DevicesNetworkPatch | undefined;
352
+ }, opts?: {
331
353
  onlyNarrows?: boolean;
332
354
  }): Promise<{
333
- next: DevicesFullAccessStored;
334
- before: DevicesFullAccessView;
355
+ next: {
356
+ outsideSandbox: DevicesOutsideSandboxStored;
357
+ network: DevicesNetworkStored;
358
+ };
359
+ before: DeviceSandboxSettingsView;
360
+ after: DeviceSandboxSettingsView;
335
361
  }>;
336
362
  /**
337
363
  * The refusals of an `externalSharing` / `shareMaxExpiryDays` / `htmlRenderCdnAllowlist` change:
@@ -358,7 +384,8 @@ export declare class SettingsService {
358
384
  get(): Promise<DeploymentSettings>;
359
385
  /**
360
386
  * Updates settings under the super admin lock, re-checking the actor (else `forbidden`).
361
- * `onlyNarrows` (an API token, the Platform tool): `devicesFullAccess` may only turn Full off,
387
+ * `onlyNarrows` (an API token, the Platform tool): `devicesOutsideSandbox` may only turn it off,
388
+ * `devicesNetwork` may only narrow to the allowlist,
362
389
  * `externalSharing` may only turn external sharing off, `shareMaxExpiryDays` may only decrease and
363
390
  * `htmlRenderCdnAllowlist` may only shrink.
364
391
  */
@@ -17,8 +17,8 @@ import { KernelDb } from "../infra/database/kernel-db.js";
17
17
  import { TransactionHost, withOrderedLocks } from "../infra/database/transaction-host.js";
18
18
  import { Transactional } from "../infra/database/transactional.decorator.js";
19
19
  import { KERNEL_LOGGER } from "../infra/tokens.js";
20
- import { localMachineRoots, needsWiderDeviceCeiling, PermissionCeilingWrites, } from "../sandbox/permission-ceiling-writes.js";
21
- import { applyDevicesFullAccessPatch, DEVICES_FULL_ACCESS_DEFAULT, DEVICES_FULL_ACCESS_PATCH, DEVICES_FULL_ACCESS_SETTING, LEGACY_DEVICES_AUTO_MODE_SETTING, legacyDevicesAutoModeStored, readDevicesFullAccess, readStoredDevicesFullAccess, } from "../sandbox/platform-full-access.js";
20
+ import { applyDevicesNetworkPatch, applyDevicesOutsideSandboxPatch, configuredDeviceSandbox, DEVICES_NETWORK_PATCH, DEVICES_NETWORK_SETTING, DEVICES_OUTSIDE_SANDBOX_PATCH, DEVICES_OUTSIDE_SANDBOX_SETTING, legacyPermissionFor, legacyPlatformKeysStored, legacyPlatformValue, orgDeviceSandboxOf, readDeviceSandboxSettingsView, readStoredDeviceSandbox, resolveDeviceSandboxSettings, } from "../sandbox/device-sandbox-settings.js";
21
+ import { cloudDevicesFollowingDefault, localMachineRoots, needsOpenNetwork, needsWiderDeviceCeiling, PermissionCeilingWrites, } from "../sandbox/permission-ceiling-writes.js";
22
22
  import { EXTERNAL_SHARING_SETTING, ExternalSharingValue, HTML_CDN_ALLOWLIST_DEFAULT, HtmlCdnAllowlistSchema, readExternalSharing, readHtmlCdnAllowlist, readShareMaxExpiry, SHARE_MAX_EXPIRY_DEFAULT, SHARE_MAX_EXPIRY_SETTING, ShareMaxExpiryDays, } from "../shares/settings.js";
23
23
  import { assertPlatformDefaultEligible, lockThemeShared } from "../themes/theme-state.js";
24
24
  import { mergeArrangement, UiArrangementPatchSchema, UiArrangementSchema, } from "../ui/arrangement.js";
@@ -218,7 +218,8 @@ export const DEPLOYMENT_SETTINGS = z.object({
218
218
  htmlRenderCdnAllowlist: HtmlCdnAllowlistSchema.default(() => [...HTML_CDN_ALLOWLIST_DEFAULT]),
219
219
  });
220
220
  const DEFAULTS = DEPLOYMENT_SETTINGS.parse({});
221
- const fullAccessWidenRefused = () => new ApiError("deployment.full_access_not_allowed", "Allowing Full permission at the platform level (devicesFullAccess) needs a super admin in the admin console; an API token or the Platform tool may only turn it off.");
221
+ const outsideSandboxWidenRefused = () => new ApiError("deployment.outside_sandbox_not_allowed", "Allowing devices to run outside the sandbox at the platform level (devicesOutsideSandbox) needs a super admin in the admin console; an API token or the Platform tool may only turn it off.");
222
+ const networkNotAllowed = (message, field) => new ApiError("deployment.network_not_allowed", message, [{ path: `devicesNetwork.${field}` }]);
222
223
  /** The `deployment_settings` key of the platform's prompt suggestions switch (`"on" | "off"`). */
223
224
  export const PROMPT_SUGGESTIONS_SETTING = "promptSuggestions";
224
225
  const PromptSuggestionsValue = z.enum(["on", "off"]);
@@ -290,12 +291,19 @@ export const DEPLOYMENT_SETTINGS_PATCH = z
290
291
  })
291
292
  .optional(),
292
293
  /**
293
- * The platform's Full permission switch (B1): `permission` replaced, null clears it (back to
294
- * the default, allowed). A value set in the startup config is read-only (409
294
+ * The platform's outside-sandbox ceiling: `permission` replaced, null clears it (back to the
295
+ * default, allowed). A value set in the startup config is read-only (409
295
296
  * `deployment.setting_readonly`); an API token or the Platform tool may only turn it off (400
296
- * `deployment.full_access_not_allowed`).
297
+ * `deployment.outside_sandbox_not_allowed`).
297
298
  */
298
- devicesFullAccess: DEVICES_FULL_ACCESS_PATCH.optional(),
299
+ devicesOutsideSandbox: DEVICES_OUTSIDE_SANDBOX_PATCH.optional(),
300
+ /**
301
+ * The platform's sandbox network: each given field replaces the stored one, null clears it
302
+ * (back to the default, open). A default above the ceiling, or (an API token or the Platform
303
+ * tool) any widening is refused (400 `deployment.network_not_allowed`); a field set in the
304
+ * startup config is read-only (409 `deployment.setting_readonly`).
305
+ */
306
+ devicesNetwork: DEVICES_NETWORK_PATCH.optional(),
299
307
  /**
300
308
  * The platform's attribution defaults for agent-created git commits and pull requests (spec
301
309
  * 2026-11-14-agent-attribution): each given field replaces the stored one, null clears it
@@ -496,7 +504,7 @@ let SettingsService = class SettingsService {
496
504
  config;
497
505
  ceilings;
498
506
  constructor(db, txHost, adminLock, log,
499
- /** The startup config's `devices.fullAccess`, which wins over the stored choice. */
507
+ /** The startup config's `devices.outsideSandbox` / `devices.network.*`, which win over the stored choice. */
500
508
  config, ceilings) {
501
509
  this.db = db;
502
510
  this.txHost = txHost;
@@ -505,11 +513,11 @@ let SettingsService = class SettingsService {
505
513
  this.config = config;
506
514
  this.ceilings = ceilings;
507
515
  }
508
- /** The settings with the platform's Full switch and attribution defaults in effect. */
516
+ /** The settings with the platform's device sandbox settings and attribution defaults in effect. */
509
517
  async view() {
510
- const [settings, devicesFullAccess, attribution, externalSharing, shareMaxExpiryDays, promptSuggestions,] = await Promise.all([
518
+ const [settings, deviceSandbox, attribution, externalSharing, shareMaxExpiryDays, promptSuggestions,] = await Promise.all([
511
519
  this.get(),
512
- readDevicesFullAccess(this.db.db, this.config, this.log),
520
+ readDeviceSandboxSettingsView(this.db.db, this.config, this.log),
513
521
  readStoredPlatformAttribution(this.db.db, this.log),
514
522
  readExternalSharing(this.db.db, this.config, this.log),
515
523
  readShareMaxExpiry(this.db.db, this.config, this.log),
@@ -517,7 +525,8 @@ let SettingsService = class SettingsService {
517
525
  ]);
518
526
  return {
519
527
  ...settings,
520
- devicesFullAccess,
528
+ devicesOutsideSandbox: deviceSandbox.outsideSandbox,
529
+ devicesNetwork: deviceSandbox.network,
521
530
  attribution: this.attributionView(attribution),
522
531
  externalSharing,
523
532
  shareMaxExpiryDays,
@@ -532,24 +541,82 @@ let SettingsService = class SettingsService {
532
541
  ]));
533
542
  return { ...resolvePlatformAttribution(config, stored), sources };
534
543
  }
544
+ /** The cloud devices following the platform's network default (their org sets none). */
545
+ async devicesFollowingPlatformDefault() {
546
+ const devices = await cloudDevicesFollowingDefault(this.db.db);
547
+ const orgs = await this.db.selectFrom("orgs").select(["id", "settings"]).execute();
548
+ const ownDefault = new Set(orgs
549
+ .filter((o) => orgDeviceSandboxOf(o.settings).deviceNetwork?.default !== undefined)
550
+ .map((o) => o.id));
551
+ return new Set([...devices].filter(([, org]) => !ownDefault.has(org)).map(([id]) => id));
552
+ }
535
553
  /**
536
- * The refusals of a `devicesFullAccess` change: a value set in the startup config
537
- * (`deployment.setting_readonly`) and, with `onlyNarrows` (an API token, the Platform tool),
538
- * allowing Full where it is off (`deployment.full_access_not_allowed`). Returns the next stored
539
- * choice and the effective switch before it.
554
+ * The refusals of a `devicesOutsideSandbox` / `devicesNetwork` change against the stored choice
555
+ * and the startup config: a field set in the startup config (`deployment.setting_readonly`); a
556
+ * network default above the effective ceiling (`deployment.network_not_allowed`); and, with
557
+ * `onlyNarrows` (an API token, the Platform tool), any widening: allowing outside-sandbox runs
558
+ * where it is off (`deployment.outside_sandbox_not_allowed`; clearing it goes back to the default
559
+ * allowed, a widening too) or a network default or ceiling opened where it is the allowlist
560
+ * (`deployment.network_not_allowed`). Returns the next stored choices and the effective view
561
+ * before and after.
540
562
  */
541
- async checkDevicesFullAccess(patch, opts = {}) {
542
- const source = this.config.fieldSource("devices.fullAccess");
543
- if (source !== undefined) {
544
- throw new ApiError("deployment.setting_readonly", "The platform's Full permission switch is set in the startup config (file, Nacos or environment) and is read-only here", [{ path: "devicesFullAccess.permission", source }]);
563
+ async checkDeviceSandbox(patch, opts = {}) {
564
+ const configured = configuredDeviceSandbox(this.config);
565
+ const readonly = [
566
+ [
567
+ "devicesOutsideSandbox.permission",
568
+ patch.devicesOutsideSandbox !== undefined,
569
+ configured.sources.outsideSandbox,
570
+ ],
571
+ [
572
+ "devicesNetwork.default",
573
+ patch.devicesNetwork?.default !== undefined,
574
+ configured.sources.networkDefault,
575
+ ],
576
+ [
577
+ "devicesNetwork.ceiling",
578
+ patch.devicesNetwork?.ceiling !== undefined,
579
+ configured.sources.networkCeiling,
580
+ ],
581
+ ];
582
+ const fixed = readonly.filter(([, given, source]) => given && source !== undefined);
583
+ if (fixed.length > 0) {
584
+ throw new ApiError("deployment.setting_readonly", `These device sandbox settings are set in the startup config (file, Nacos or environment) and are read-only here: ${fixed.map(([path]) => path).join(", ")}`, fixed.map(([path, , source]) => ({ path, source })));
545
585
  }
546
- const before = await readDevicesFullAccess(this.db.db, this.config, this.log);
547
- const next = applyDevicesFullAccessPatch(await readStoredDevicesFullAccess(this.db.db, this.log), patch);
548
- const after = next.permission ?? DEVICES_FULL_ACCESS_DEFAULT;
549
- if (opts.onlyNarrows && before.permission === "off" && after === DEVICES_FULL_ACCESS_DEFAULT) {
550
- throw fullAccessWidenRefused();
586
+ const configuredCeiling = configured.sources.networkCeiling !== undefined ? configured.networkCeiling : undefined;
587
+ const stored = await readStoredDeviceSandbox(this.db.db, this.log, configuredCeiling);
588
+ const next = {
589
+ outsideSandbox: patch.devicesOutsideSandbox === undefined
590
+ ? stored.outsideSandbox
591
+ : applyDevicesOutsideSandboxPatch(stored.outsideSandbox, patch.devicesOutsideSandbox),
592
+ network: patch.devicesNetwork === undefined
593
+ ? stored.network
594
+ : applyDevicesNetworkPatch(stored.network, patch.devicesNetwork),
595
+ };
596
+ const before = resolveDeviceSandboxSettings(configured, stored);
597
+ const after = resolveDeviceSandboxSettings(configured, next);
598
+ // opening the stored default above the stored ceiling (one source) is refused; across
599
+ // sources, and for a change that only narrows, the reader clamps the default to the ceiling
600
+ if (patch.devicesNetwork?.default === "open" && next.network.ceiling === "allowlist")
601
+ throw networkNotAllowed("The network default open is above the ceiling allowlist; set the default to allowlist too, or open the ceiling", "default");
602
+ if (opts.onlyNarrows) {
603
+ if (patch.devicesOutsideSandbox !== undefined &&
604
+ before.outsideSandbox.permission === "off" &&
605
+ after.outsideSandbox.permission === "allowed")
606
+ throw outsideSandboxWidenRefused();
607
+ for (const field of ["default", "ceiling"]) {
608
+ if (patch.devicesNetwork?.[field] === undefined)
609
+ continue;
610
+ // both the stored choice (it takes effect when the startup config lets it) and the
611
+ // effective value (it may follow the default) must not open
612
+ const storedWidens = (stored.network[field] ?? "open") === "allowlist" &&
613
+ (next.network[field] ?? "open") === "open";
614
+ const effectiveWidens = before.network[field] === "allowlist" && after.network[field] === "open";
615
+ if (storedWidens || effectiveWidens)
616
+ throw networkNotAllowed(`Opening the platform's network ${field} needs a super admin in the admin console; an API token or the Platform tool may only narrow it to the allowlist.`, field);
617
+ }
551
618
  }
552
- return { next, before };
619
+ return { next, before, after };
553
620
  }
554
621
  /**
555
622
  * The refusals of an `externalSharing` / `shareMaxExpiryDays` / `htmlRenderCdnAllowlist` change:
@@ -630,7 +697,8 @@ let SettingsService = class SettingsService {
630
697
  }
631
698
  /**
632
699
  * Updates settings under the super admin lock, re-checking the actor (else `forbidden`).
633
- * `onlyNarrows` (an API token, the Platform tool): `devicesFullAccess` may only turn Full off,
700
+ * `onlyNarrows` (an API token, the Platform tool): `devicesOutsideSandbox` may only turn it off,
701
+ * `devicesNetwork` may only narrow to the allowlist,
634
702
  * `externalSharing` may only turn external sharing off, `shareMaxExpiryDays` may only decrease and
635
703
  * `htmlRenderCdnAllowlist` may only shrink.
636
704
  */
@@ -642,7 +710,7 @@ let SettingsService = class SettingsService {
642
710
  throw new ApiError("validation_failed", "Invalid deployment settings", check.error.issues.map((i) => ({ path: i.path.join("."), message: i.message })));
643
711
  }
644
712
  const valid = check.data;
645
- // the super admin lock, then (for a Full switch change) the platform permission authority
713
+ // the super admin lock, then (for a device sandbox change) the platform permission authority
646
714
  // lock: the ordered prelude, so inside a run's fence (the Platform tool's
647
715
  // `admin.update-settings`) they precede the conversation rows; the patch decides the lock
648
716
  await withOrderedLocks(() => this.lockFor(valid, actorAccountId), () => this.write(valid, actorAccountId, actorTokenId, auditDetail, opts));
@@ -650,7 +718,7 @@ let SettingsService = class SettingsService {
650
718
  }
651
719
  async lockFor(patch, actorAccountId) {
652
720
  await this.adminLock.lockAndAuthorize(actorAccountId);
653
- if (patch.devicesFullAccess !== undefined)
721
+ if (patch.devicesOutsideSandbox !== undefined || patch.devicesNetwork !== undefined)
654
722
  await this.ceilings.lock({}, "platform");
655
723
  }
656
724
  async write(patch, actorAccountId, actorTokenId, auditDetail, opts) {
@@ -726,29 +794,61 @@ let SettingsService = class SettingsService {
726
794
  next.subagentLimitOverrides = mergeByOrg(current.subagentLimitOverrides, subagentPatch);
727
795
  }
728
796
  }
729
- // the platform's Full switch: checked against the stored choice under the lock; the stored
730
- // shape keeps `permission` optional, so clearing it (null) writes `{}` back to the default
731
- let fullAccessChange;
797
+ // the platform's device sandbox settings: checked against the stored choices under the lock;
798
+ // the stored shapes keep every field optional, so clearing one (null) writes it out
799
+ let deviceSandboxChange;
732
800
  const writes = Object.entries(next);
733
- if (patch.devicesFullAccess !== undefined) {
734
- const r = await this.checkDevicesFullAccess(patch.devicesFullAccess, opts);
735
- fullAccessChange = {
736
- before: r.before,
737
- after: r.next.permission ?? DEVICES_FULL_ACCESS_DEFAULT,
738
- };
739
- writes.push([DEVICES_FULL_ACCESS_SETTING, r.next]);
740
- // an old key the publication conversion has not reached yet (a mismatch window before
741
- // activation) is kept in step, so the narrowed read shows the value the super admin chose
742
- if (await legacyDevicesAutoModeStored(this.db.db))
743
- writes.push([
744
- LEGACY_DEVICES_AUTO_MODE_SETTING,
745
- r.next.permission === undefined ? {} : { mode: r.next.permission },
746
- ]);
747
- if (fullAccessChange.before.permission !== fullAccessChange.after) {
748
- const machineRoots = fullAccessChange.after === "off" ? await localMachineRoots(this.db.db) : null;
749
- await this.ceilings.publishLocked({}, "platform", machineRoots === null
801
+ if (patch.devicesOutsideSandbox !== undefined || patch.devicesNetwork !== undefined) {
802
+ const r = await this.checkDeviceSandbox(patch, opts);
803
+ deviceSandboxChange = { before: r.before, after: r.after };
804
+ const legacy = await legacyPlatformKeysStored(this.db.db);
805
+ // old keys the publication conversion has not reached yet (a mismatch window before
806
+ // activation): the new keys are stored as every reader sees them, and each old key is
807
+ // rewritten in step for replicas of the previous version (Full allowed only when running
808
+ // outside the sandbox is allowed and the effective network ceiling is open)
809
+ if (patch.devicesOutsideSandbox !== undefined || legacy.length > 0)
810
+ writes.push([DEVICES_OUTSIDE_SANDBOX_SETTING, r.next.outsideSandbox]);
811
+ if (patch.devicesNetwork !== undefined || legacy.length > 0) {
812
+ if (legacy.length > 0 && Object.keys(r.next.network).length === 0)
813
+ await this.db
814
+ .deleteFrom("deployment_settings")
815
+ .where("key", "=", DEVICES_NETWORK_SETTING)
816
+ .execute();
817
+ else
818
+ writes.push([DEVICES_NETWORK_SETTING, r.next.network]);
819
+ }
820
+ const inStep = legacyPermissionFor(r.next.outsideSandbox.permission, r.after.network.ceiling);
821
+ for (const key of legacy)
822
+ writes.push([key, legacyPlatformValue(key, inStep)]);
823
+ const outsideOff = r.before.outsideSandbox.permission === "allowed" &&
824
+ r.after.outsideSandbox.permission === "off";
825
+ const outsideChanged = r.before.outsideSandbox.permission !== r.after.outsideSandbox.permission;
826
+ const widened = (a, b) => (a.ceiling === "allowlist" && b.ceiling === "open") ||
827
+ (a.default === "allowlist" && b.default === "open");
828
+ const networkChanged = r.before.network.default !== r.after.network.default ||
829
+ r.before.network.ceiling !== r.after.network.ceiling;
830
+ if (outsideChanged || networkChanged) {
831
+ const machineRoots = outsideOff ? await localMachineRoots(this.db.db) : null;
832
+ // a network ceiling narrowed to the allowlist takes running open-network work
833
+ const networkNarrowed = r.before.network.ceiling === "open" && r.after.network.ceiling === "allowlist";
834
+ // a default narrowed to the allowlist takes it from the cloud devices that follow it
835
+ // (their org sets no default of its own)
836
+ const following = !networkNarrowed &&
837
+ r.before.network.default === "open" &&
838
+ r.after.network.default === "allowlist"
839
+ ? await this.devicesFollowingPlatformDefault()
840
+ : null;
841
+ const narrows = machineRoots !== null || networkNarrowed || following !== null;
842
+ await this.ceilings.publishLocked({}, "platform", !narrows
750
843
  ? false
751
- : (scope, row) => needsWiderDeviceCeiling(scope, machineRoots.get(row.device_id)), true);
844
+ : (scope, row) => (needsOpenNetwork(scope) &&
845
+ (networkNarrowed || following?.has(row.device_id) === true)) ||
846
+ (machineRoots !== null &&
847
+ needsWiderDeviceCeiling(scope, machineRoots.get(row.device_id))),
848
+ // only a widening resets Full consent: a narrowing keeps what it covered
849
+ (r.before.outsideSandbox.permission === "off" &&
850
+ r.after.outsideSandbox.permission === "allowed") ||
851
+ widened(r.before.network, r.after.network));
752
852
  }
753
853
  }
754
854
  // the platform's attribution defaults: a field set in the startup config is read-only
@@ -797,7 +897,7 @@ let SettingsService = class SettingsService {
797
897
  action: "deployment.settings.updated",
798
898
  detail: {
799
899
  ...patch,
800
- ...(fullAccessChange !== undefined && { devicesFullAccessEffective: fullAccessChange }),
900
+ ...(deviceSandboxChange !== undefined && { deviceSandboxEffective: deviceSandboxChange }),
801
901
  ...auditDetail,
802
902
  },
803
903
  });
@@ -19,7 +19,7 @@ export declare class KernelConfigService {
19
19
  * Where the current value of a field without a schema default comes from: `env` when an
20
20
  * environment variable sets it, else the config source (`file` / `nacos`) when it is set at all;
21
21
  * undefined when nothing sets it (a layer below the startup config decides, e.g. the deployment
22
- * settings for `devices.fullAccess`). Such fields are read-only in the admin console.
22
+ * settings for `devices.outsideSandbox`). Such fields are read-only in the admin console.
23
23
  */
24
24
  fieldSource(path: string): "env" | "file" | "nacos" | undefined;
25
25
  /** Subscribes to applied changes (hot fields only); returns the unsubscribe function. */
@@ -20,6 +20,8 @@ import { KERNEL_CONFIG_INPUT, KERNEL_LOGGER } from "../tokens.js";
20
20
  * takes effect" cannot happen.
21
21
  */
22
22
  const HOT_APPLIERS = {
23
+ // GET /api/v1/meta reads the platform name on every request.
24
+ "platform.name": () => { },
23
25
  "log.level": (k, v) => k.log.setLevel(String(v)),
24
26
  // The runtime reads the concurrency cap through the config service on every quota request.
25
27
  "runtime.orgConcurrency": () => { },
@@ -52,8 +54,11 @@ const HOT_APPLIERS = {
52
54
  // The command-review service reads the classifier's bounds at every classifier call.
53
55
  "sandbox.review.timeoutMs": () => { },
54
56
  "sandbox.review.messageTokens": () => { },
55
- // The devices service reads the platform's Full switch at every device use and settings read.
56
- "devices.fullAccess": () => { },
57
+ // The device sandbox settings reader reads these at every device use and settings read; a
58
+ // change is published first (`PERMISSION_CONFIG_PATHS`).
59
+ "devices.outsideSandbox": () => { },
60
+ "devices.network.default": () => { },
61
+ "devices.network.ceiling": () => { },
57
62
  // The devices service reads the personal limit at every create.
58
63
  "devices.maxPersonal": () => { },
59
64
  // The local device relay reads the reconnect grace at every disconnect and token response.
@@ -84,6 +89,15 @@ const HOT_APPLIERS = {
84
89
  "sharing.external": () => { },
85
90
  "sharing.maxExpiryDays": () => { },
86
91
  };
92
+ /**
93
+ * The hot fields the permission configuration publication covers: a change to any of them is
94
+ * published (fingerprint compare-and-set) before this replica applies it.
95
+ */
96
+ const PERMISSION_CONFIG_PATHS = [
97
+ "devices.outsideSandbox",
98
+ "devices.network.default",
99
+ "devices.network.ceiling",
100
+ ];
87
101
  const HOT_PATHS = configFields(KernelConfigSchema)
88
102
  .filter((f) => f.meta?.hot)
89
103
  .map((f) => f.path);
@@ -112,7 +126,7 @@ let KernelConfigService = class KernelConfigService {
112
126
  * Where the current value of a field without a schema default comes from: `env` when an
113
127
  * environment variable sets it, else the config source (`file` / `nacos`) when it is set at all;
114
128
  * undefined when nothing sets it (a layer below the startup config decides, e.g. the deployment
115
- * settings for `devices.fullAccess`). Such fields are read-only in the admin console.
129
+ * settings for `devices.outsideSandbox`). Such fields are read-only in the admin console.
116
130
  */
117
131
  fieldSource(path) {
118
132
  if (getPath(this.current, path) === undefined)
@@ -135,7 +149,7 @@ let KernelConfigService = class KernelConfigService {
135
149
  const log = this.log;
136
150
  let next;
137
151
  try {
138
- next = resolveConfig(raw, this.env);
152
+ next = resolveConfig(raw, this.env, this.current);
139
153
  }
140
154
  catch (e) {
141
155
  log.error("config reload rejected; keeping current config", { error: errMsg(e) });
@@ -153,7 +167,7 @@ let KernelConfigService = class KernelConfigService {
153
167
  setPath(updated, p, getPath(next, p));
154
168
  applied.push(p);
155
169
  }
156
- if (applied.includes("devices.fullAccess")) {
170
+ if (applied.some((p) => PERMISSION_CONFIG_PATHS.includes(p))) {
157
171
  if (!publish) {
158
172
  log.error("permission config reload rejected: durable publication is required");
159
173
  return;
@@ -32,6 +32,20 @@ export declare const OUTBOX_JOBS: {
32
32
  readonly removeOnComplete: true;
33
33
  };
34
34
  };
35
+ readonly "platform-icon-delete": {
36
+ readonly queue: "cap-kernel-maintenance";
37
+ readonly idempotent: "Deletes one icon object only when the purpose's row does not name it, under the purpose's lock; deleting a missing object is a no-op";
38
+ readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
39
+ readonly opts: {
40
+ readonly attempts: 10;
41
+ readonly backoff: {
42
+ readonly type: "exponential";
43
+ readonly delay: 5000;
44
+ };
45
+ readonly removeOnComplete: true;
46
+ readonly removeOnFail: true;
47
+ };
48
+ };
35
49
  readonly "permission-approval-recheck": {
36
50
  readonly queue: "cap-kernel-maintenance";
37
51
  readonly idempotent: "Reads the current revision and resumes only waiting runs without another pending wait; queued runs are unchanged.";
@@ -29,6 +29,21 @@ export const OUTBOX_JOBS = {
29
29
  processedIn: "packages/kernel/src/runtime/maintenance.ts",
30
30
  opts: { attempts: 10, backoff: { type: "exponential", delay: 5000 }, removeOnComplete: true },
31
31
  },
32
+ // `themes/platform-icon-objects.ts` PLATFORM_ICON_DELETE_JOB: owed by an icon upload (its own
33
+ // object's delayed orphan check), a replace and a clear (the object the row stopped naming)
34
+ "platform-icon-delete": {
35
+ queue: "cap-kernel-maintenance",
36
+ idempotent: "Deletes one icon object only when the purpose's row does not name it, under the purpose's lock; deleting a missing object is a no-op",
37
+ processedIn: "packages/kernel/src/runtime/maintenance.ts",
38
+ // removed on failure too: the ids are content addressed, so a kept failed job would swallow a
39
+ // later owing of the same deletion
40
+ opts: {
41
+ attempts: 10,
42
+ backoff: { type: "exponential", delay: 5000 },
43
+ removeOnComplete: true,
44
+ removeOnFail: true,
45
+ },
46
+ },
32
47
  "permission-approval-recheck": {
33
48
  queue: "cap-kernel-maintenance",
34
49
  idempotent: "Reads the current revision and resumes only waiting runs without another pending wait; queued runs are unchanged.",
@@ -36,8 +36,9 @@ export interface NamedThrottler {
36
36
  *
37
37
  * `POST /api/v1/device/authorize` and `POST /api/v1/device/token` opt in to `device-authorize-ip`
38
38
  * and `device-token-ip` with `@Throttled` (every request counts; neither checks a guessable
39
- * credential: the device code is 32 random bytes). `POST …/guides/:guideId/checks/:checkId/run`
40
- * opts in to `setup-check` (setup guides v2 §10.3: each run may call a third party).
39
+ * credential: the device code is 32 random bytes). `POST /api/v1/app-auth/token` opts in to
40
+ * `app-auth-token-ip` the same way (the one-time code is 32 random bytes).
41
+ * `POST …/guides/:guideId/checks/:checkId/run` opts in to `setup-check` (setup guides v2 §10.3: each run may call a third party).
41
42
  *
42
43
  * `plugin-public-write` is not a Nest route limit: the plugin dispatch counts it for unsafe
43
44
  * methods on `public` extension routes (`PluginRouteAccess`).