@capybara-hq/kernel 0.1.0-rc.67 → 0.1.0-rc.69

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 (226) hide show
  1. package/bootstrap.json +9 -1
  2. package/dist/admin/admin.module.js +2 -0
  3. package/dist/admin/health.service.d.ts +11 -4
  4. package/dist/admin/health.service.js +33 -17
  5. package/dist/background/poll.job.js +2 -2
  6. package/dist/background/tasks.service.d.ts +5 -5
  7. package/dist/background/tasks.service.js +9 -8
  8. package/dist/catalog/credential-key.d.ts +10 -0
  9. package/dist/catalog/credential-key.js +28 -0
  10. package/dist/catalog/marketplaces.service.d.ts +1 -1
  11. package/dist/catalog/plugin-upgrade.js +1 -19
  12. package/dist/catalog/requests.service.js +1 -1
  13. package/dist/config/schema.d.ts +1 -1
  14. package/dist/config/schema.js +9 -9
  15. package/dist/conversations/conversations.controller.d.ts +8 -3
  16. package/dist/conversations/conversations.controller.js +8 -3
  17. package/dist/conversations/conversations.service.d.ts +33 -15
  18. package/dist/conversations/conversations.service.js +60 -10
  19. package/dist/conversations/events.d.ts +21 -41
  20. package/dist/conversations/events.js +57 -31
  21. package/dist/conversations/permission-profiles.controller.d.ts +6 -4
  22. package/dist/conversations/permission-profiles.service.d.ts +6 -4
  23. package/dist/ctx/create-ctx.d.ts +20 -1
  24. package/dist/ctx/create-ctx.js +77 -6
  25. package/dist/ctx/device-provider-check.d.ts +6 -2
  26. package/dist/ctx/device-provider-check.js +17 -2
  27. package/dist/db/kernel-schema.d.ts +10 -48
  28. package/dist/devices/access.d.ts +3 -4
  29. package/dist/devices/access.js +3 -4
  30. package/dist/devices/conversation-devices.d.ts +1 -3
  31. package/dist/devices/conversation-devices.js +2 -7
  32. package/dist/devices/device-projects.service.js +24 -29
  33. package/dist/devices/device-provider-selection.d.ts +5 -6
  34. package/dist/devices/device-provider-selection.js +8 -9
  35. package/dist/devices/devices.controller.d.ts +8 -21
  36. package/dist/devices/devices.controller.js +9 -34
  37. package/dist/devices/devices.module.js +6 -4
  38. package/dist/devices/devices.schemas.d.ts +1 -5
  39. package/dist/devices/devices.schemas.js +1 -5
  40. package/dist/devices/devices.service.d.ts +84 -147
  41. package/dist/devices/devices.service.js +134 -229
  42. package/dist/devices/dto.d.ts +5 -32
  43. package/dist/devices/dto.js +5 -37
  44. package/dist/devices/errors.d.ts +6 -5
  45. package/dist/devices/errors.js +7 -8
  46. package/dist/devices/project-rules.d.ts +9 -11
  47. package/dist/devices/project-rules.js +7 -7
  48. package/dist/devices/working-root.d.ts +3 -6
  49. package/dist/devices/working-root.js +3 -8
  50. package/dist/dial-in/access.d.ts +23 -0
  51. package/dist/dial-in/access.js +64 -0
  52. package/dist/{local-devices/device-auth.controller.d.ts → dial-in/auth.controller.d.ts} +12 -6
  53. package/dist/{local-devices/device-auth.controller.js → dial-in/auth.controller.js} +30 -15
  54. package/dist/dial-in/auth.module.d.ts +7 -0
  55. package/dist/dial-in/auth.module.js +27 -0
  56. package/dist/{local-devices/device-auth.d.ts → dial-in/auth.service.d.ts} +42 -13
  57. package/dist/{local-devices/device-auth.js → dial-in/auth.service.js} +83 -32
  58. package/dist/dial-in/dial-in.module.d.ts +9 -0
  59. package/dist/dial-in/dial-in.module.js +37 -0
  60. package/dist/{local-devices → dial-in}/dto.d.ts +17 -2
  61. package/dist/{local-devices → dial-in}/dto.js +14 -2
  62. package/dist/dial-in/envelope.d.ts +95 -0
  63. package/dist/dial-in/envelope.js +89 -0
  64. package/dist/dial-in/gateway.d.ts +214 -0
  65. package/dist/{local-devices/local-device-gateway.js → dial-in/gateway.js} +337 -181
  66. package/dist/dial-in/handlers.d.ts +47 -0
  67. package/dist/dial-in/handlers.js +84 -0
  68. package/dist/dial-in/machines.d.ts +155 -0
  69. package/dist/dial-in/machines.js +383 -0
  70. package/dist/dial-in/relay.d.ts +135 -0
  71. package/dist/dial-in/relay.js +444 -0
  72. package/dist/dial-in/relay.module.d.ts +7 -0
  73. package/dist/dial-in/relay.module.js +24 -0
  74. package/dist/{local-devices/device-routes.d.ts → dial-in/routes.d.ts} +19 -11
  75. package/dist/{local-devices/device-routes.js → dial-in/routes.js} +45 -25
  76. package/dist/{local-devices → dial-in}/targets.d.ts +3 -18
  77. package/dist/{local-devices → dial-in}/targets.js +3 -48
  78. package/dist/errors.d.ts +8 -27
  79. package/dist/errors.js +8 -27
  80. package/dist/extensions/bootstrap.d.ts +5 -0
  81. package/dist/extensions/bootstrap.js +10 -1
  82. package/dist/extensions/extensions.module.js +6 -0
  83. package/dist/extensions/host.d.ts +6 -0
  84. package/dist/extensions/host.js +12 -2
  85. package/dist/extensions/permission-set.d.ts +15 -1
  86. package/dist/extensions/permission-set.js +11 -1
  87. package/dist/extensions/permission-view.d.ts +1 -1
  88. package/dist/extensions/permission-view.js +4 -1
  89. package/dist/http/api.module.js +4 -4
  90. package/dist/http/gateway-routes.d.ts +1 -1
  91. package/dist/http/gateway-routes.js +1 -1
  92. package/dist/http/meta.controller.js +1 -1
  93. package/dist/identity/settings.d.ts +1 -1
  94. package/dist/identity/settings.js +6 -8
  95. package/dist/infra/config/kernel-config.service.js +2 -2
  96. package/dist/infra/outbox/registry.d.ts +0 -14
  97. package/dist/infra/outbox/registry.js +0 -15
  98. package/dist/infra/throttler/named-throttlers.d.ts +1 -1
  99. package/dist/infra/throttler/named-throttlers.js +1 -1
  100. package/dist/kernel.module.js +0 -3
  101. package/dist/orgs/settings.service.js +5 -10
  102. package/dist/overrides.d.ts +0 -4
  103. package/dist/overrides.js +0 -2
  104. package/dist/platform/exclusions.js +5 -5
  105. package/dist/platform/ops/admin.ops.js +1 -1
  106. package/dist/platform/ops/conversations.ops.js +5 -2
  107. package/dist/platform/ops/devices.ops.js +11 -24
  108. package/dist/platform/ops/inbox.ops.js +1 -1
  109. package/dist/roles/gateway-role.d.ts +3 -3
  110. package/dist/roles/gateway-role.js +4 -4
  111. package/dist/roles/gateway.module.d.ts +1 -1
  112. package/dist/roles/gateway.module.js +5 -5
  113. package/dist/runtime/context/device-paths.d.ts +4 -1
  114. package/dist/runtime/context/permission-profile.js +5 -5
  115. package/dist/runtime/maintenance.d.ts +2 -5
  116. package/dist/runtime/maintenance.js +9 -19
  117. package/dist/runtime/project/knowledge.js +4 -5
  118. package/dist/runtime/project/knowledge.service.js +2 -1
  119. package/dist/sandbox/cloud-permission-snapshot.d.ts +1 -1
  120. package/dist/sandbox/cloud-permission-snapshot.js +1 -3
  121. package/dist/sandbox/device-reports.d.ts +74 -14
  122. package/dist/sandbox/device-reports.js +190 -33
  123. package/dist/sandbox/device-reports.module.d.ts +7 -0
  124. package/dist/sandbox/device-reports.module.js +25 -0
  125. package/dist/sandbox/device-sandbox.d.ts +39 -41
  126. package/dist/sandbox/device-sandbox.js +44 -83
  127. package/dist/sandbox/kernel-read.d.ts +2 -2
  128. package/dist/sandbox/legacy-retirement.d.ts +11 -59
  129. package/dist/sandbox/legacy-retirement.js +34 -186
  130. package/dist/sandbox/legacy-retirement.module.d.ts +2 -2
  131. package/dist/sandbox/legacy-retirement.module.js +2 -2
  132. package/dist/sandbox/managed-device-context.d.ts +16 -4
  133. package/dist/sandbox/managed-device-context.js +25 -8
  134. package/dist/sandbox/managed-device-context.module.js +4 -0
  135. package/dist/sandbox/modes.d.ts +3 -12
  136. package/dist/sandbox/modes.js +2 -14
  137. package/dist/{local-devices → sandbox}/network-grants.d.ts +2 -21
  138. package/dist/{local-devices → sandbox}/network-grants.js +4 -49
  139. package/dist/sandbox/operation-authority-types.d.ts +2 -1
  140. package/dist/sandbox/operation-authority.d.ts +6 -20
  141. package/dist/sandbox/operation-authority.js +43 -104
  142. package/dist/sandbox/operation-authority.module.js +1 -1
  143. package/dist/sandbox/operation-intents.d.ts +4 -1
  144. package/dist/sandbox/operation-intents.js +11 -2
  145. package/dist/sandbox/operation-reconcile.job.js +2 -4
  146. package/dist/sandbox/permission-availability.d.ts +6 -7
  147. package/dist/sandbox/permission-availability.js +7 -10
  148. package/dist/sandbox/permission-call-grants.d.ts +2 -1
  149. package/dist/sandbox/permission-call-grants.js +1 -7
  150. package/dist/sandbox/permission-call-types.d.ts +4 -4
  151. package/dist/sandbox/permission-ceiling-writes.d.ts +7 -23
  152. package/dist/sandbox/permission-ceiling-writes.js +8 -35
  153. package/dist/sandbox/permission-config-publication.d.ts +9 -1
  154. package/dist/sandbox/permission-config-publication.js +29 -21
  155. package/dist/sandbox/permission-context-types.d.ts +17 -10
  156. package/dist/sandbox/permission-facts.d.ts +98 -95
  157. package/dist/sandbox/permission-facts.js +160 -314
  158. package/dist/sandbox/permission-instance-writes.d.ts +23 -37
  159. package/dist/sandbox/permission-instance-writes.js +44 -121
  160. package/dist/sandbox/permission-runtime-reports.d.ts +38 -30
  161. package/dist/sandbox/permission-runtime-reports.js +105 -122
  162. package/dist/sandbox/providers.d.ts +26 -38
  163. package/dist/sandbox/providers.js +36 -18
  164. package/dist/sandbox/request-not-sent.d.ts +2 -13
  165. package/dist/sandbox/request-not-sent.js +2 -13
  166. package/dist/sandbox/review/permission-candidate.d.ts +13 -8
  167. package/dist/sandbox/review/permission-candidate.js +38 -48
  168. package/dist/sandbox/sandbox.module.js +7 -3
  169. package/dist/sandbox/sandbox.service.d.ts +49 -59
  170. package/dist/sandbox/sandbox.service.js +139 -259
  171. package/dist/schedules/fire.d.ts +15 -6
  172. package/dist/schedules/fire.js +27 -13
  173. package/dist/schedules/grant-rules.js +1 -1
  174. package/dist/schedules/scheduled-tasks.service.d.ts +0 -7
  175. package/dist/schedules/scheduled-tasks.service.js +1 -4
  176. package/dist/schedules/schedules.module.js +5 -3
  177. package/dist/skills/invoke.d.ts +1 -1
  178. package/dist/skills/invoke.js +2 -3
  179. package/dist/tools/approvals.service.d.ts +8 -5
  180. package/dist/tools/approvals.service.js +5 -5
  181. package/dist/tools/builtins/sandbox/bash.js +1 -2
  182. package/dist/tools/builtins/sandbox/common.d.ts +15 -9
  183. package/dist/tools/builtins/sandbox/common.js +37 -38
  184. package/dist/tools/connectors.controller.d.ts +2 -0
  185. package/dist/tools/connectors.schemas.d.ts +2 -0
  186. package/dist/tools/credentials.d.ts +2 -0
  187. package/dist/tools/network-asks.d.ts +19 -22
  188. package/dist/tools/network-asks.js +15 -21
  189. package/dist/tools/oauth/authorization-params.d.ts +7 -0
  190. package/dist/tools/oauth/authorization-params.js +19 -0
  191. package/dist/tools/oauth/flow.js +7 -0
  192. package/dist/tools/oauth/tokens.js +2 -1
  193. package/dist/tools/pipeline.d.ts +6 -7
  194. package/dist/tools/pipeline.js +17 -21
  195. package/dist/tools/tools.module.js +3 -7
  196. package/package.json +3 -4
  197. package/src/migrations/0177_dial_in_contract.sql +32 -0
  198. package/dist/local-devices/device-auth.module.d.ts +0 -7
  199. package/dist/local-devices/device-auth.module.js +0 -25
  200. package/dist/local-devices/device-policy.service.d.ts +0 -213
  201. package/dist/local-devices/device-policy.service.js +0 -605
  202. package/dist/local-devices/instance-bindings.d.ts +0 -82
  203. package/dist/local-devices/instance-bindings.js +0 -307
  204. package/dist/local-devices/local-device-gateway.d.ts +0 -153
  205. package/dist/local-devices/local-device-provider.d.ts +0 -122
  206. package/dist/local-devices/local-device-provider.js +0 -326
  207. package/dist/local-devices/local-devices.module.d.ts +0 -31
  208. package/dist/local-devices/local-devices.module.js +0 -100
  209. package/dist/local-devices/machines.d.ts +0 -211
  210. package/dist/local-devices/machines.js +0 -766
  211. package/dist/local-devices/owner-report.d.ts +0 -81
  212. package/dist/local-devices/owner-report.js +0 -150
  213. package/dist/local-devices/owner-reports.d.ts +0 -48
  214. package/dist/local-devices/owner-reports.js +0 -208
  215. package/dist/local-devices/policy-op-jobs.d.ts +0 -15
  216. package/dist/local-devices/policy-op-jobs.js +0 -12
  217. package/dist/local-devices/policy-summary.d.ts +0 -102
  218. package/dist/local-devices/policy-summary.js +0 -155
  219. package/dist/local-devices/relay.d.ts +0 -166
  220. package/dist/local-devices/relay.js +0 -559
  221. package/dist/tools/device-op-resolver.d.ts +0 -34
  222. package/dist/tools/device-op-resolver.js +0 -120
  223. /package/dist/{local-devices → dial-in}/keys.d.ts +0 -0
  224. /package/dist/{local-devices → dial-in}/keys.js +0 -0
  225. /package/dist/{local-devices → sandbox}/network-grants.module.d.ts +0 -0
  226. /package/dist/{local-devices → sandbox}/network-grants.module.js +0 -0
@@ -7,14 +7,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
- import { isDeviceBootId } from "@capybara-hq/plugin-sdk";
11
10
  import { Inject, Injectable } from "@nestjs/common";
12
11
  import { sql } from "kysely";
13
12
  import { KernelDb } from "../infra/database/kernel-db.js";
14
13
  import { TransactionHost } from "../infra/database/transaction-host.js";
15
14
  import { Transactional } from "../infra/database/transactional.decorator.js";
16
15
  import { PermissionAuthorityLock } from "./permission-authority-lock.js";
17
- import { isInternalProvider, LOCAL_PROVIDER } from "./providers.js";
18
16
  /**
19
17
  * Legacy retirement (permission runtime cutover phase 8.5): the durable legacy-launch freeze and
20
18
  * the physical no-reuse obligations of old instance incarnations (migration 0157).
@@ -35,11 +33,10 @@ import { isInternalProvider, LOCAL_PROVIDER } from "./providers.js";
35
33
  * names the row. Obligations live apart from the task rows, so output retention never removes
36
34
  * them, and task finish and event semantics stay with the task's own finisher.
37
35
  * - **Resolution** is the sandbox service's, under the device's exclusive lifecycle lease
38
- * (`SandboxService` gate): a cloud incarnation is destroyed whole by its provider (confirmed
39
- * destruction, the file system kept) or found destroyed by a recorded confirmed destruction; a
40
- * local one, a replaced cloud one without recorded destruction and an unknown one are
41
- * quarantined. Nothing here resolves on a new generation, a restart, a local (no-op) destroy, a
42
- * timeout or a process scan.
36
+ * (`SandboxService` gate), the same for every provider: an incarnation is destroyed whole by its
37
+ * provider (confirmed destruction, the file system kept) or found destroyed by a recorded
38
+ * confirmed destruction; a replaced one without recorded destruction and an unknown one are
39
+ * quarantined. Nothing here resolves on a new generation, a timeout or a process scan.
43
40
  */
44
41
  /** The freeze's single row id. */
45
42
  const FREEZE_ID = "platform";
@@ -85,25 +82,27 @@ const MAY_HAVE_DISPATCHED = sql `(
85
82
  OR t.kill_pending
86
83
  OR (t.sid IS NULL AND t.legacy_dispatch <> 'reserved')
87
84
  )`;
88
- /** Whether `provider` is a cloud provider (one whose whole-instance destroy is confirmed). */
89
- export const isCloudProvider = (provider) => provider !== "unknown" && !isInternalProvider(provider);
85
+ /**
86
+ * Whether `provider` names a provider (one whose whole-instance destroy is confirmed): any
87
+ * recorded provider, the same for every one, never the `unknown` of an incarnation the kernel
88
+ * cannot name.
89
+ */
90
+ export const isKnownProvider = (provider) => provider !== "unknown";
90
91
  /** The epoch millisecond of `d` as recorded generation text. */
91
92
  const generationOf = (d) => String(d.getTime());
92
93
  /**
93
94
  * The incarnation a legacy row's obligation is keyed by: the one it started in, else the one its
94
95
  * dispatch was admitted for; a historical reservation without either is `unknown`, never the
95
- * instance current now (I2). Its own provider: local `@local`, else the admitted one, else the
96
- * instance row's only when it is that incarnation, else `unknown` (M6).
96
+ * instance current now (I2). Its own provider: the admitted one, else the instance row's only
97
+ * when it is that incarnation, else `unknown` (M6).
97
98
  */
98
99
  function legacyKey(r) {
99
100
  const generation = r.sandbox_created_at !== null
100
101
  ? generationOf(new Date(r.sandbox_created_at))
101
102
  : (r.legacy_dispatch_generation ?? "unknown");
102
103
  const current = r.instance_created_at !== null && generationOf(r.instance_created_at) === generation;
103
- const provider = r.source === "local"
104
- ? LOCAL_PROVIDER
105
- : (r.legacy_dispatch_provider ??
106
- (current && r.instance_provider ? r.instance_provider : "unknown"));
104
+ const provider = r.legacy_dispatch_provider ??
105
+ (current && r.instance_provider ? r.instance_provider : "unknown");
107
106
  return { provider, generation };
108
107
  }
109
108
  const toObligation = (r) => ({
@@ -115,7 +114,6 @@ const toObligation = (r) => ({
115
114
  state: r.state,
116
115
  reason: r.reason,
117
116
  attempts: r.attempts,
118
- bootId: r.boot_id,
119
117
  createdAt: r.created_at,
120
118
  });
121
119
  let LegacyRetirementStore = class LegacyRetirementStore {
@@ -204,11 +202,11 @@ let LegacyRetirementStore = class LegacyRetirementStore {
204
202
  /**
205
203
  * The worker's sweep of obligations whose device is gone (its row missing, `deleted_at` set, or
206
204
  * its org soft-deleted), at most `limit` per call:
207
- * - a cloud one (any provider not kernel-internal) waits while the device's instance row exists:
205
+ * - one waits while the device's instance row exists:
208
206
  * its destroy is still owed (the destroy job or the destruction sweep deletes the row when it
209
207
  * is done) and records the destruction then;
210
208
  * - one whose exact incarnation has a recorded confirmed destruction resolves
211
- * `provider-destroyed`, an already `abandoned` cloud one too (provider evidence, not a
209
+ * `provider-destroyed`, an already `abandoned` one too (provider evidence, not a
212
210
  * reopen);
213
211
  * - every other one becomes `abandoned`. Device ids are never reused, so no device can acquire
214
212
  * that incarnation again, but abandonment is no evidence that its processes ended (they may
@@ -217,7 +215,7 @@ let LegacyRetirementStore = class LegacyRetirementStore {
217
215
  */
218
216
  async abandonDeleted(limit) {
219
217
  let resolved = 0, abandoned = 0;
220
- // abandoned cloud obligations that gained a matching recorded destruction
218
+ // abandoned obligations that gained a matching recorded destruction
221
219
  const evidenced = await this.db
222
220
  .selectFrom("device_retirement_obligations as o")
223
221
  .innerJoin("device_instance_destructions as x", (j) => j
@@ -254,14 +252,11 @@ let LegacyRetirementStore = class LegacyRetirementStore {
254
252
  eb("d.deleted_at", "is not", null),
255
253
  eb("g.deleted_at", "is not", null),
256
254
  ]))
257
- // a cloud destroy still owed keeps its instance row (R2-I2)
258
- .where((eb) => eb.or([
259
- eb("o.provider", "like", "@%"),
260
- eb.not(eb.exists(eb
261
- .selectFrom("device_instances as i")
262
- .select("i.device_id")
263
- .whereRef("i.device_id", "=", "o.device_id"))),
264
- ]))
255
+ // a destroy still owed keeps its instance row (R2-I2)
256
+ .where((eb) => eb.not(eb.exists(eb
257
+ .selectFrom("device_instances as i")
258
+ .select("i.device_id")
259
+ .whereRef("i.device_id", "=", "o.device_id"))))
265
260
  .orderBy("o.created_at")
266
261
  .limit(limit)
267
262
  .execute();
@@ -330,7 +325,6 @@ let LegacyRetirementStore = class LegacyRetirementStore {
330
325
  "t.sandbox_created_at",
331
326
  "t.legacy_dispatch_generation",
332
327
  "t.legacy_dispatch_provider",
333
- "d.source",
334
328
  "i.provider as instance_provider",
335
329
  "i.created_at as instance_created_at",
336
330
  ])
@@ -399,9 +393,6 @@ let LegacyRetirementStore = class LegacyRetirementStore {
399
393
  }
400
394
  /** The obligation of the incarnation (created when missing), with the member added. */
401
395
  async addMember(deviceId, orgId, provider, generation, kind, refId) {
402
- // a local incarnation keeps the boot its machine reported last: only a later boot of that
403
- // machine proves its processes gone (none reported: never by itself)
404
- const boot = isCloudProvider(provider) ? null : await this.currentBoot(deviceId);
405
396
  await this.db
406
397
  .insertInto("device_retirement_obligations")
407
398
  .values({
@@ -409,8 +400,6 @@ let LegacyRetirementStore = class LegacyRetirementStore {
409
400
  org_id: orgId,
410
401
  provider,
411
402
  instance_generation: generation,
412
- boot_machine_id: boot?.machineId ?? null,
413
- boot_id: boot?.bootId ?? null,
414
403
  })
415
404
  .onConflict((oc) => oc.columns(["device_id", "provider", "instance_generation"]).doNothing())
416
405
  .execute();
@@ -428,138 +417,20 @@ let LegacyRetirementStore = class LegacyRetirementStore {
428
417
  .onConflict((oc) => oc.columns(["kind", "ref_id", "obligation_id"]).doNothing())
429
418
  .returning("ref_id")
430
419
  .executeTakeFirst();
431
- // a restart covers only what ran before it: a member found later (a row of an old replica) on
432
- // the same local incarnation reopens the obligation against the current boot; an exact
433
- // cancel covers only the refs it stopped, and the incarnation lives on (B-22)
420
+ // an exact cancel covers only the refs it stopped, and the incarnation lives on (B-22): a
421
+ // member found later (a row of an old replica) reopens the obligation; so does one found on
422
+ // an incarnation an old replica resolved by a restart of its computer
434
423
  if (r !== undefined &&
435
424
  obligation.state === "resolved" &&
436
425
  (obligation.resolution === "host-rebooted" || obligation.resolution === "exact-cancelled")) {
437
- // read under the obligation's lock: a hello that resolved it meanwhile is seen (M1); a
438
- // cloud incarnation has no boot
439
- const now = isCloudProvider(provider) ? null : await this.currentBoot(deviceId);
440
426
  await this.db
441
427
  .updateTable("device_retirement_obligations")
442
- .set({
443
- state: "open",
444
- resolution: null,
445
- resolved_at: null,
446
- boot_machine_id: now?.machineId ?? null,
447
- boot_id: now?.bootId ?? null,
448
- })
428
+ .set({ state: "open", resolution: null, resolved_at: null })
449
429
  .where("id", "=", obligation.id)
450
430
  .execute();
451
431
  }
452
432
  return r !== undefined;
453
433
  }
454
- /** The device's active machine and the boot it reported last (null: no machine). */
455
- async currentBoot(deviceId) {
456
- const m = await this.db
457
- .selectFrom("device_machines")
458
- .select(["id", "boot_id"])
459
- .where("device_id", "=", deviceId)
460
- .where("revoked_at", "is", null)
461
- .orderBy("created_at", "desc")
462
- .orderBy("id", "desc")
463
- .limit(1)
464
- .executeTakeFirst();
465
- return m ? { machineId: m.id, bootId: m.boot_id } : null;
466
- }
467
- /**
468
- * Records the OS boot identity an authenticated hello of `machineId` reported. The caller is the
469
- * gateway's hello record, after the connection authenticated with the machine's credential and
470
- * claimed the device, inside its transaction with the machine row locked. A boot first seen for
471
- * the machine becomes its current one; the current one again is a reconnect; one seen before a
472
- * later one (stale, replayed) changes nothing. A new or current boot then settles the device's
473
- * local obligations recorded under another boot of the computer ({@link settleRebooted}).
474
- */
475
- async recordBoot(machineId, bootId) {
476
- if (!isDeviceBootId(bootId))
477
- return "ignored";
478
- const machine = await this.db
479
- .selectFrom("device_machines")
480
- .select(["device_id", "boot_id"])
481
- .where("id", "=", machineId)
482
- .where("revoked_at", "is", null)
483
- .executeTakeFirst();
484
- if (!machine)
485
- return "ignored";
486
- const inserted = await this.db
487
- .insertInto("device_machine_boots")
488
- .values({ machine_id: machineId, boot_id: bootId })
489
- .onConflict((oc) => oc.columns(["machine_id", "boot_id"]).doNothing())
490
- .returning("seq")
491
- .executeTakeFirst();
492
- let report;
493
- if (inserted !== undefined) {
494
- await this.db
495
- .updateTable("device_machines")
496
- .set({ boot_id: bootId })
497
- .where("id", "=", machineId)
498
- .execute();
499
- report = "new";
500
- }
501
- else if (machine.boot_id === bootId)
502
- report = "current";
503
- else
504
- return "stale";
505
- await this.settleRebooted(machine.device_id);
506
- return report;
507
- }
508
- /**
509
- * A hello without a boot identity: the machine has no current boot any more, so a boot it
510
- * reported earlier is never taken as the one its later work ran under (M2).
511
- */
512
- async clearBoot(machineId) {
513
- await this.db
514
- .updateTable("device_machines")
515
- .set({ boot_id: null })
516
- .where("id", "=", machineId)
517
- .execute();
518
- }
519
- /**
520
- * Resolves (`host-rebooted`) every unresolved local obligation of the device for which a current
521
- * (non-revoked) machine of the device has recorded a boot other than the obligation's: the
522
- * evidence is the OS instance, not the credential, so a re-login on the same computer reporting
523
- * the same boot changes nothing, and one after a restart (or any later boot) resolves it. A boot
524
- * that some machine of the device had already reported when the obligation's boot was first
525
- * seen is an older boot, never evidence (a replay through another credential). An obligation
526
- * without a recorded boot never resolves here. Returns how many resolved.
527
- */
528
- async settleRebooted(deviceId) {
529
- const r = await this.db
530
- .updateTable("device_retirement_obligations as o")
531
- .set({
532
- state: "resolved",
533
- resolution: "host-rebooted",
534
- resolved_at: sql `now()`,
535
- last_error: null,
536
- })
537
- .where("o.device_id", "=", deviceId)
538
- .where("o.state", "in", ["open", "quarantined"])
539
- .where("o.provider", "like", "@%")
540
- .where("o.boot_id", "is not", null)
541
- .where(({ exists, selectFrom }) => exists(selectFrom("device_machines as m")
542
- .select("m.id")
543
- .whereRef("m.device_id", "=", "o.device_id")
544
- .where("m.revoked_at", "is", null)
545
- .where("m.boot_id", "is not", null)
546
- .whereRef("m.boot_id", "<>", "o.boot_id")
547
- // not a boot the device's machines had already reported by the obligation's boot
548
- .where((inner) => inner.not(inner.exists(inner
549
- .selectFrom("device_machine_boots as seen")
550
- .innerJoin("device_machines as sm", "sm.id", "seen.machine_id")
551
- .select("seen.boot_id")
552
- .whereRef("sm.device_id", "=", "o.device_id")
553
- .whereRef("seen.boot_id", "=", "m.boot_id")
554
- .where((e) => e("seen.seq", "<=", e
555
- .selectFrom("device_machine_boots as ob")
556
- .innerJoin("device_machines as om", "om.id", "ob.machine_id")
557
- .select((f) => f.fn.min("ob.seq").as("first"))
558
- .whereRef("om.device_id", "=", "o.device_id")
559
- .whereRef("ob.boot_id", "=", "o.boot_id"))))))))
560
- .executeTakeFirst();
561
- return Number(r.numUpdatedRows);
562
- }
563
434
  /** The device's unresolved obligations (open and quarantined), oldest first. */
564
435
  async unresolved(deviceId) {
565
436
  const rows = await this.db
@@ -573,7 +444,6 @@ let LegacyRetirementStore = class LegacyRetirementStore {
573
444
  "state",
574
445
  "reason",
575
446
  "attempts",
576
- "boot_id",
577
447
  "created_at",
578
448
  ])
579
449
  .where("device_id", "=", deviceId)
@@ -755,11 +625,11 @@ let LegacyRetirementStore = class LegacyRetirementStore {
755
625
  return rows.map((r) => ({ obligationId: r.obligation_id, kind: r.kind, refId: r.ref_id }));
756
626
  }
757
627
  /**
758
- * Records the provider-confirmed destruction of a cloud incarnation. A kernel-internal
759
- * provider's destroy (a local machine: a no-op) is never evidence and is refused.
628
+ * Records the provider-confirmed destruction of an incarnation, the same for every provider (a
629
+ * provider is trusted like every extension). An `unknown` provider names nothing and is refused.
760
630
  */
761
631
  async recordDestruction(deviceId, provider, generation) {
762
- if (!isCloudProvider(provider))
632
+ if (!isKnownProvider(provider))
763
633
  throw new Error(`A ${provider} destroy is not evidence of destruction`);
764
634
  if (!GENERATION_RE.test(generation))
765
635
  throw new Error(`invalid generation ${generation}`);
@@ -769,9 +639,9 @@ let LegacyRetirementStore = class LegacyRetirementStore {
769
639
  .onConflict((oc) => oc.columns(["device_id", "provider", "instance_generation"]).doNothing())
770
640
  .execute();
771
641
  }
772
- /** Whether a confirmed destruction of exactly that cloud incarnation was recorded. */
642
+ /** Whether a confirmed destruction of exactly that incarnation was recorded. */
773
643
  async destructionRecorded(deviceId, provider, generation) {
774
- if (!isCloudProvider(provider) || !GENERATION_RE.test(generation))
644
+ if (!isKnownProvider(provider) || !GENERATION_RE.test(generation))
775
645
  return false;
776
646
  const row = await this.db
777
647
  .selectFrom("device_instance_destructions")
@@ -897,27 +767,13 @@ let LegacyRetirementStore = class LegacyRetirementStore {
897
767
  .executeTakeFirstOrThrow();
898
768
  const unresolved = await this.db
899
769
  .selectFrom("device_retirement_obligations")
900
- .select(["device_id", "provider", "instance_generation", "state", "reason", "boot_id"])
770
+ .select(["device_id", "provider", "instance_generation", "state", "reason"])
901
771
  .where("state", "in", ["open", "quarantined"])
902
772
  .orderBy("created_at", "asc")
903
773
  .execute();
904
- const withoutBoot = await this.db
905
- .selectFrom("background_tasks as t")
906
- .innerJoin("devices as d", "d.id", "t.device_id")
907
- .leftJoin("device_machines as m", (j) => j.onRef("m.device_id", "=", "d.id").on("m.revoked_at", "is", null))
908
- .select(["t.device_id", "m.id as machine_id"])
909
- .distinct()
910
- .where("d.source", "=", "local")
911
- .where("d.deleted_at", "is", null)
912
- .where("t.launch_state", "=", "legacy")
913
- .where(MAY_STILL_RUN)
914
- .where(MAY_HAVE_DISPATCHED)
915
- .where((eb) => eb.or([eb("m.id", "is", null), eb("m.boot_id", "is", null)]))
916
- .orderBy("t.device_id")
917
- .execute();
918
774
  const abandonedRows = await this.db
919
775
  .selectFrom("device_retirement_obligations")
920
- .select(["device_id", "provider", "instance_generation", "boot_id", "abandoned_at"])
776
+ .select(["device_id", "provider", "instance_generation", "abandoned_at"])
921
777
  .where("state", "=", "abandoned")
922
778
  .orderBy("abandoned_at", "asc")
923
779
  .execute();
@@ -943,7 +799,6 @@ let LegacyRetirementStore = class LegacyRetirementStore {
943
799
  "i.handle as instance_handle",
944
800
  "i.had_instance",
945
801
  ])
946
- .where("d.source", "=", "cloud")
947
802
  .where("d.deleted_at", "is", null)
948
803
  .where("t.launch_state", "=", "legacy")
949
804
  .where(MAY_STILL_RUN)
@@ -952,7 +807,7 @@ let LegacyRetirementStore = class LegacyRetirementStore {
952
807
  .execute();
953
808
  const cloudUnknown = new Map();
954
809
  for (const r of cloudCandidates) {
955
- const key = legacyKey({ ...r, source: "cloud" });
810
+ const key = legacyKey(r);
956
811
  if (key.generation !== "unknown" && key.provider !== "unknown")
957
812
  continue;
958
813
  if (cloudUnknown.has(r.device_id))
@@ -994,22 +849,15 @@ let LegacyRetirementStore = class LegacyRetirementStore {
994
849
  deviceId: r.device_id,
995
850
  provider: r.provider,
996
851
  instanceGeneration: r.instance_generation,
997
- local: isInternalProvider(r.provider),
998
- bootKnown: r.boot_id !== null,
999
852
  abandonedAt: r.abandoned_at,
1000
853
  })),
1001
854
  cloudUnknown: [...cloudUnknown].map(([deviceId, flags]) => ({ deviceId, ...flags })),
1002
- localWithoutBoot: withoutBoot.map((r) => ({
1003
- deviceId: r.device_id,
1004
- machineId: r.machine_id,
1005
- })),
1006
855
  unresolved: unresolved.map((r) => ({
1007
856
  deviceId: r.device_id,
1008
857
  provider: r.provider,
1009
858
  instanceGeneration: r.instance_generation,
1010
859
  state: r.state,
1011
860
  reason: r.reason,
1012
- bootKnown: r.boot_id !== null,
1013
861
  })),
1014
862
  };
1015
863
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The legacy-launch freeze and the retirement obligations (permission runtime cutover 8.5), with
3
3
  * only the authority lock they publish and check under: the sandbox service gates every
4
- * lifecycle acquisition on it, the legacy launch checks the freeze, the local binder refuses to
5
- * bind over an obligation and the worker's retirement job drives it.
4
+ * lifecycle acquisition on it (the same for every provider), the legacy launch checks the freeze
5
+ * and the worker's retirement job drives it.
6
6
  */
7
7
  export declare class LegacyRetirementModule {
8
8
  }
@@ -10,8 +10,8 @@ import { PermissionCeilingWritesModule } from "./permission-authority.module.js"
10
10
  /**
11
11
  * The legacy-launch freeze and the retirement obligations (permission runtime cutover 8.5), with
12
12
  * only the authority lock they publish and check under: the sandbox service gates every
13
- * lifecycle acquisition on it, the legacy launch checks the freeze, the local binder refuses to
14
- * bind over an obligation and the worker's retirement job drives it.
13
+ * lifecycle acquisition on it (the same for every provider), the legacy launch checks the freeze
14
+ * and the worker's retirement job drives it.
15
15
  */
16
16
  let LegacyRetirementModule = class LegacyRetirementModule {
17
17
  };
@@ -1,5 +1,7 @@
1
1
  import { EventLog } from "../conversations/event-log.js";
2
2
  import { PermissionProfileStore } from "../conversations/permission-profile-store.js";
3
+ import { DialInMachines } from "../dial-in/machines.js";
4
+ import { ApiError } from "../errors.js";
3
5
  import { KernelDb } from "../infra/database/kernel-db.js";
4
6
  import { TransactionHost } from "../infra/database/transaction-host.js";
5
7
  import type { KernelLogger } from "../log.js";
@@ -9,6 +11,7 @@ import { PermissionAuthorityLock } from "./permission-authority-lock.js";
9
11
  import { PermissionConfigPublication } from "./permission-config-publication.js";
10
12
  import { type HeldDeviceContextEvidence, type PermissionContextSubject } from "./permission-context-types.js";
11
13
  import { PermissionFacts } from "./permission-facts.js";
14
+ import { DeviceProviders } from "./providers.js";
12
15
  /** The tool error text of a managed operation whose held device context went stale (spec B3). */
13
16
  export declare const MANAGED_DEVICE_CONTEXT_STALE_TEXT = "Device context changed before this operation. Retry the tool call.";
14
17
  /**
@@ -47,7 +50,7 @@ export declare class ManagedDeviceContextUnavailable extends Error {
47
50
  constructor();
48
51
  }
49
52
  /** The managed dependency `common.ts` requires on an activated managed route (spec B3). */
50
- export type ManagedDeviceContextPort = Pick<ManagedDeviceContextRecorder, "record">;
53
+ export type ManagedDeviceContextPort = Pick<ManagedDeviceContextRecorder, "record"> & Partial<Pick<ManagedDeviceContextRecorder, "goneFor">>;
51
54
  /**
52
55
  * The writer of a managed operation's model-facing device paths (permission context replay spec,
53
56
  * "Task 8 exact common.ts handoff"): after a managed tool entered its held instance and before any
@@ -76,13 +79,21 @@ export declare class ManagedDeviceContextRecorder {
76
79
  private readonly facts;
77
80
  private readonly authority;
78
81
  private readonly log;
79
- constructor(db: KernelDb, txHost: TransactionHost, events: Pick<EventLog, "appendIn" | "notify">, profiles: Pick<PermissionProfileStore, "readRoot">, locks: Pick<PermissionAuthorityLock, "acquire">, publication: Pick<PermissionConfigPublication, "assertCurrent">, facts: Pick<PermissionFacts, "readAppliedEnvironmentLocked">, authority: Pick<SandboxOperationAuthority, "workingRootFor" | "isActiveMember">, log: Pick<KernelLogger, "warn">);
82
+ private readonly providers;
83
+ private readonly machines;
84
+ constructor(db: KernelDb, txHost: TransactionHost, events: Pick<EventLog, "appendIn" | "notify">, profiles: Pick<PermissionProfileStore, "readRoot">, locks: Pick<PermissionAuthorityLock, "acquire">, publication: Pick<PermissionConfigPublication, "assertCurrent">, facts: Pick<PermissionFacts, "readAppliedEnvironmentLocked">, authority: Pick<SandboxOperationAuthority, "workingRootFor" | "isActiveMember">, log: Pick<KernelLogger, "warn">, providers: Pick<DeviceProviders, "forDevice">, machines: Pick<DialInMachines, "activeFor">);
80
85
  /**
81
86
  * Records the managed device paths of `held` into the calling conversation's log, or nothing
82
87
  * when unchanged. Requires the run's real execution claim (`RunExecution.withClaim`) and no open
83
88
  * transaction. A revoked execution keeps its identical `ExecutionRevoked`, an abort its reason.
84
89
  */
85
90
  record(input: PermissionContextSubject, held: Readonly<HeldDeviceContextEvidence>, signal: AbortSignal): Promise<void>;
91
+ /**
92
+ * The gone error of a held instance whose evidence is missing (its device deleted, its machine
93
+ * revoked): what never comes back says so instead of the unavailable answer. Undefined while the
94
+ * device is live (or the conversation moved to another device).
95
+ */
96
+ goneFor(input: PermissionContextSubject, deviceId: string): Promise<ApiError | undefined>;
86
97
  /**
87
98
  * The gone error to answer instead of a stale context: only while the conversation's root still
88
99
  * works on the held device (a conversation moved to another device keeps the stale "retry", the
@@ -91,8 +102,9 @@ export declare class ManagedDeviceContextRecorder {
91
102
  private goneInstead;
92
103
  /**
93
104
  * The error of a device state that never comes back: the device (or its org) deleted, or a
94
- * local device without an active machine (revoked, signed out). Undefined while it is live; a
95
- * cloud device has no machine.
105
+ * device of a dial-in provider without an active machine (revoked, signed out:
106
+ * {@link DialInMachines.activeFor}). Undefined while it is live; a provider that is not loaded
107
+ * here is not asked.
96
108
  */
97
109
  private goneError;
98
110
  private mapped;
@@ -13,6 +13,7 @@ import { EventLog } from "../conversations/event-log.js";
13
13
  import { ManagedDevicePathsV1Schema, } from "../conversations/events.js";
14
14
  import { PermissionProfileStore } from "../conversations/permission-profile-store.js";
15
15
  import { deviceNotFound, machineRevoked } from "../devices/errors.js";
16
+ import { DialInMachines } from "../dial-in/machines.js";
16
17
  import { ApiError } from "../errors.js";
17
18
  import { afterCommit } from "../infra/database/after-commit.js";
18
19
  import { KernelDb } from "../infra/database/kernel-db.js";
@@ -27,6 +28,7 @@ import { PermissionAuthorityLock } from "./permission-authority-lock.js";
27
28
  import { PermissionConfigPublication } from "./permission-config-publication.js";
28
29
  import { PermissionContextSubjectChanged, } from "./permission-context-types.js";
29
30
  import { PermissionFacts } from "./permission-facts.js";
31
+ import { DeviceProviders, servesDialIn } from "./providers.js";
30
32
  /** The tool error text of a managed operation whose held device context went stale (spec B3). */
31
33
  export const MANAGED_DEVICE_CONTEXT_STALE_TEXT = "Device context changed before this operation. Retry the tool call.";
32
34
  /**
@@ -103,7 +105,9 @@ let ManagedDeviceContextRecorder = class ManagedDeviceContextRecorder {
103
105
  facts;
104
106
  authority;
105
107
  log;
106
- constructor(db, txHost, events, profiles, locks, publication, facts, authority, log) {
108
+ providers;
109
+ machines;
110
+ constructor(db, txHost, events, profiles, locks, publication, facts, authority, log, providers, machines) {
107
111
  this.db = db;
108
112
  this.txHost = txHost;
109
113
  this.events = events;
@@ -113,6 +117,8 @@ let ManagedDeviceContextRecorder = class ManagedDeviceContextRecorder {
113
117
  this.facts = facts;
114
118
  this.authority = authority;
115
119
  this.log = log;
120
+ this.providers = providers;
121
+ this.machines = machines;
116
122
  }
117
123
  /**
118
124
  * Records the managed device paths of `held` into the calling conversation's log, or nothing
@@ -146,6 +152,14 @@ let ManagedDeviceContextRecorder = class ManagedDeviceContextRecorder {
146
152
  throw mapped;
147
153
  }
148
154
  }
155
+ /**
156
+ * The gone error of a held instance whose evidence is missing (its device deleted, its machine
157
+ * revoked): what never comes back says so instead of the unavailable answer. Undefined while the
158
+ * device is live (or the conversation moved to another device).
159
+ */
160
+ async goneFor(input, deviceId) {
161
+ return this.goneInstead(input, deviceId);
162
+ }
149
163
  /**
150
164
  * The gone error to answer instead of a stale context: only while the conversation's root still
151
165
  * works on the held device (a conversation moved to another device keeps the stale "retry", the
@@ -168,15 +182,15 @@ let ManagedDeviceContextRecorder = class ManagedDeviceContextRecorder {
168
182
  }
169
183
  /**
170
184
  * The error of a device state that never comes back: the device (or its org) deleted, or a
171
- * local device without an active machine (revoked, signed out). Undefined while it is live; a
172
- * cloud device has no machine.
185
+ * device of a dial-in provider without an active machine (revoked, signed out:
186
+ * {@link DialInMachines.activeFor}). Undefined while it is live; a provider that is not loaded
187
+ * here is not asked.
173
188
  */
174
189
  async goneError(orgId, deviceId) {
175
190
  const row = await this.db
176
191
  .selectFrom("devices as e")
177
192
  .innerJoin("orgs as o", "o.id", "e.org_id")
178
- .leftJoin("device_machines as m", (j) => j.onRef("m.device_id", "=", "e.id").on("m.revoked_at", "is", null))
179
- .select(["e.source", "m.id as machine_id"])
193
+ .select(["e.provider"])
180
194
  .where("e.id", "=", deviceId)
181
195
  .where("e.org_id", "=", orgId)
182
196
  .where("e.deleted_at", "is", null)
@@ -184,7 +198,8 @@ let ManagedDeviceContextRecorder = class ManagedDeviceContextRecorder {
184
198
  .executeTakeFirst();
185
199
  if (row === undefined)
186
200
  return deviceNotFound();
187
- if (row.source === "local" && row.machine_id === null)
201
+ const p = this.providers.forDevice(row.provider);
202
+ if (p !== undefined && servesDialIn(p) && (await this.machines.activeFor(deviceId)) === null)
188
203
  return machineRevoked();
189
204
  return undefined;
190
205
  }
@@ -298,7 +313,7 @@ let ManagedDeviceContextRecorder = class ManagedDeviceContextRecorder {
298
313
  applied.provider !== held.provider ||
299
314
  applied.instanceId !== held.instanceId ||
300
315
  applied.instanceGeneration !== held.instanceGeneration ||
301
- applied.bindingId !== held.bindingId ||
316
+ applied.revision !== held.revision ||
302
317
  !sameRoots(applied.roots, held.roots))
303
318
  throw new ManagedDeviceContextStale();
304
319
  const workingRoot = await this.authority.workingRootFor({
@@ -351,6 +366,8 @@ ManagedDeviceContextRecorder = __decorate([
351
366
  __param(5, Inject(PermissionConfigPublication)),
352
367
  __param(6, Inject(PermissionFacts)),
353
368
  __param(7, Inject(SandboxOperationAuthority)),
354
- __param(8, Inject(KERNEL_LOGGER))
369
+ __param(8, Inject(KERNEL_LOGGER)),
370
+ __param(9, Inject(DeviceProviders)),
371
+ __param(10, Inject(DialInMachines))
355
372
  ], ManagedDeviceContextRecorder);
356
373
  export { ManagedDeviceContextRecorder };
@@ -7,10 +7,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Module } from "@nestjs/common";
8
8
  import { EventLogModule } from "../conversations/event-log.js";
9
9
  import { PermissionProfileStoreModule } from "../conversations/permission-profile-store.module.js";
10
+ import { DialInModule } from "../dial-in/dial-in.module.js";
10
11
  import { ManagedDeviceContextRecorder } from "./managed-device-context.js";
11
12
  import { OperationAuthorityModule } from "./operation-authority.module.js";
12
13
  import { PermissionAuthorityModule } from "./permission-authority.module.js";
13
14
  import { PermissionFactsModule } from "./permission-facts.module.js";
15
+ import { SandboxProviderRegistryModule } from "./providers.module.js";
14
16
  /**
15
17
  * The managed device context writer (a leaf: no runtime or tools import), which `ToolsModule`
16
18
  * imports so `BuiltinTools` can hand it to the managed sandbox route.
@@ -25,6 +27,8 @@ ManagedDeviceContextModule = __decorate([
25
27
  PermissionAuthorityModule,
26
28
  OperationAuthorityModule,
27
29
  PermissionFactsModule,
30
+ SandboxProviderRegistryModule,
31
+ DialInModule,
28
32
  ],
29
33
  providers: [ManagedDeviceContextRecorder],
30
34
  exports: [ManagedDeviceContextRecorder],
@@ -8,8 +8,7 @@ import { type OutsideSandboxPermission as FullAccessPermission } from "./device-
8
8
  * Device modes (auto mode spec §4.1–§4.3): who may choose auto mode, and the network each mode
9
9
  * gets. One pure function, {@link effectiveDevicePolicy}, combines the platform's switch
10
10
  * (`devices.outsideSandbox`), the org's (`outsideSandbox`, `deviceNetwork`) and the device's owner
11
- * ceiling (a local machine's owner report, a cloud device's B1 snapshot; null follows the platform
12
- * and the org).
11
+ * ceiling (its B1 snapshot; null follows the platform and the org).
13
12
  * It is a ceiling only: no device-chosen default mode selects how an operation runs (permission
14
13
  * runtime cutover 8.6); the conversation's permission profile does, within this ceiling.
15
14
  */
@@ -78,13 +77,6 @@ export interface EffectiveDevicePolicy {
78
77
  /** The cloud network (auto mode's open network, the org's allowlist, or the kill switch). */
79
78
  network: DeviceNetwork;
80
79
  }
81
- /**
82
- * How far restricted work may root outside the workspace now (B2), the one rule the command
83
- * review (`DevicesService.projectReach`) and admission's working root both read: a local device
84
- * follows its owner's reported reach within a device ceiling that allows auto; a cloud device
85
- * reaches beyond its workspace only in auto mode.
86
- */
87
- export declare function projectReachOf(source: string, policy: Pick<EffectiveDevicePolicy, "mode" | "allowedMode">, ownerReach: string | null | undefined): "workspace" | "os-user";
88
80
  /** The mode the platform and the org allow: `auto` only when neither turns it off. */
89
81
  export declare function allowedDeviceMode(platform: FullAccessPermission, org: OrgDeviceSettings["outsideSandbox"]): SandboxMode;
90
82
  /** The org's allowlist (the hosts a local device in sandbox mode may reach): {@link orgEffectiveHosts}. */
@@ -96,9 +88,8 @@ export declare function orgAllowedDomains(deployment: DeploymentDevicePolicy, or
96
88
  */
97
89
  export declare function deviceNetwork(deployment: DeploymentDevicePolicy, org: OrgDeviceSettings, mode: SandboxMode): DeviceNetwork;
98
90
  /**
99
- * The effective device policy. `deviceMode` is the device's owner ceiling (a local machine's owner
100
- * report, a cloud device's B1 snapshot or narrowing switch; null = follow the platform and the
101
- * org). A stored mode the platform or org forbids is cut, never honoured; the network follows the
91
+ * The effective device policy. `deviceMode` is the device's owner ceiling (its B1 snapshot or
92
+ * narrowing switch; null = follow the platform and the org). A stored mode the platform or org forbids is cut, never honoured; the network follows the
102
93
  * resulting mode.
103
94
  */
104
95
  export declare function effectiveDevicePolicy(deployment: DeploymentDevicePolicy, org: OrgDeviceSettings, deviceMode: SandboxMode | null,