@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
@@ -1,22 +1,23 @@
1
- import type { DeviceLocalPolicySummary, DeviceReport, LocalizedName, SandboxBrowseScope, SandboxLimits, SandboxOperationScope } from "@capybara-hq/plugin-sdk";
1
+ import type { DeviceReport, LocalizedName, SandboxBrowseScope, SandboxLimits, SandboxOperationScope } from "@capybara-hq/plugin-sdk";
2
2
  import { type Selectable } from "kysely";
3
3
  import type { SandboxOperationIntentsTable } from "../db/kernel-schema.js";
4
+ import { DialInHandlers } from "../dial-in/handlers.js";
5
+ import { DialInMachines } from "../dial-in/machines.js";
6
+ import { DialInRelay } from "../dial-in/relay.js";
7
+ import { ApiError } from "../errors.js";
4
8
  import { ExtensionDisplayNames } from "../extensions/display-name.js";
5
9
  import { type PersonRef } from "../identity/account-avatar.js";
6
10
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
7
11
  import { KernelDb } from "../infra/database/kernel-db.js";
8
12
  import { TransactionHost } from "../infra/database/transaction-host.js";
9
- import { LockService } from "../infra/lock/lock.service.js";
10
13
  import { OutboxService } from "../infra/outbox/outbox.service.js";
11
- import { DevicePolicyService } from "../local-devices/device-policy.service.js";
12
- import { MachinesService } from "../local-devices/machines.js";
13
- import { type OwnerFacts } from "../local-devices/owner-report.js";
14
14
  import type { DeviceModeLevel } from "../runtime/context/device-paths.js";
15
15
  import { DeviceReports } from "../sandbox/device-reports.js";
16
16
  import type { DeviceSandbox, DeviceSandboxLayer, HostGrantCeiling } from "../sandbox/device-sandbox.js";
17
17
  import { SandboxJobs } from "../sandbox/jobs.js";
18
18
  import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
19
19
  import { PermissionFacts } from "../sandbox/permission-facts.js";
20
+ import { DeviceProviders } from "../sandbox/providers.js";
20
21
  import { SandboxService } from "../sandbox/sandbox.service.js";
21
22
  import { DeviceAccess } from "./access.js";
22
23
  import { DeviceProviderSelection } from "./device-provider-selection.js";
@@ -27,57 +28,39 @@ export interface DeviceView {
27
28
  name: string | null;
28
29
  isDefault: boolean;
29
30
  ownerKind: "personal";
30
- /** `local`: a machine connected with capybara-device (provider `@local`). */
31
- source: "cloud" | "local";
32
31
  /** The provider it is bound to for life (`devices.provider`). */
33
32
  provider: string | null;
34
- /** Its provider serves the org now (on in the org; `@local`: registered). */
33
+ /**
34
+ * Its provider serves its devices over the dial-in channel (a machine signs in to the device);
35
+ * false while the provider is not loaded here.
36
+ */
37
+ dialIn: boolean;
38
+ /** Its provider serves the org now (on in the org). */
35
39
  available: boolean;
36
40
  /**
37
41
  * What its provider last reported about it (`devices.report`, the stored copy: never asked on
38
42
  * the request path); null until a first report is stored. Kept while the provider is off.
39
43
  */
40
44
  report: DeviceReport | null;
41
- /** A local device: some replica holds its machine's connection now; null for cloud. */
45
+ /** A dial-in device: some replica holds its machine's connection now; null for any other. */
42
46
  online: boolean | null;
43
- /** A local device's connected machine (its unrevoked one); null for cloud or none. */
47
+ /** The machine signed in to a dial-in device (its unrevoked one); null for any other or none. */
44
48
  machine: DeviceMachineView | null;
45
- /**
46
- * A local device's network facts as its connected machine last reported them (network
47
- * ask-to-allow spec §5.4): the program's features and its local policy summary (null when
48
- * unknown). null for a cloud device or a local one without a connected machine.
49
- */
50
- network: {
51
- features: string[];
52
- policy: DeviceLocalPolicySummary | null;
53
- } | null;
54
49
  /** Its effective device sandbox, the same under every permission profile. */
55
50
  sandbox: DeviceSandboxView;
56
51
  /**
57
- * A local device's owner ceiling as its machine last reported it (read only): an authenticated
58
- * report (`state: "report"`), a stale or conflicting one (`blocked`) or nothing readable
59
- * (`missing`). `stale` is true while the machine is offline or the report is not current:
60
- * last-known facts, never authority. null for a cloud device (it has no machine) and for a local
61
- * one without a connected machine.
62
- */
63
- ownerCeiling: DeviceOwnerCeilingView | null;
64
- /**
65
- * A cloud device whose B1 snapshot found applied limits it could not establish exactly: nothing
66
- * runs on it until a file reset establishes them (`device.permission_reconcile_required` at
67
- * admission). Always false for a local device.
52
+ * A device whose B1 snapshot found applied limits it could not establish exactly: nothing runs
53
+ * on it until a file reset establishes them (`device.permission_reconcile_required` at
54
+ * admission).
68
55
  */
69
56
  reconcileRequired: boolean;
70
- sessionIsolation: boolean;
71
57
  /** Its file system is gone at the provider; reset the files to use it again. */
72
58
  filesLost: boolean;
73
59
  instance: {
74
60
  status: "running" | "suspended";
75
61
  lastUsedAt: string;
76
62
  } | null;
77
- /**
78
- * Its sandbox limits: the resources and network a cloud instance is created with; for a local
79
- * device the network its commands carry (the machine intersects it with its owner's ceiling).
80
- */
63
+ /** Its sandbox limits: the resources and network its instance is created with. */
81
64
  limits: SandboxLimits;
82
65
  createdAt: string;
83
66
  }
@@ -93,29 +76,23 @@ export interface DeviceSandboxView {
93
76
  networkCeiling: "open" | "allowlist" | "none";
94
77
  /** The allowlist hosts in effect (empty unless {@link network} is `allowlist`). */
95
78
  hosts: string[];
96
- /**
97
- * The device's own network setting: a cloud device's stored choice (null follows its org), a
98
- * local owner's reported network (null without a readable report).
99
- */
79
+ /** The device's own network setting, its stored choice (null follows its org). */
100
80
  ownNetwork: "open" | "allowlist" | "none" | null;
101
81
  /**
102
- * The device's own host list, which only narrows the org's hosts: a local owner's
103
- * `allowedDomains` (its machine's ceiling while its network is the allowlist), a cloud device's
104
- * stored hosts (empty: it follows its org's hosts).
82
+ * The device's own host list, which only narrows the org's hosts: its stored hosts (empty: it
83
+ * follows its org's hosts).
105
84
  */
106
85
  allowedDomains: string[];
107
- /** Whether a call may be granted escalation outside the sandbox (never on a cloud device). */
86
+ /** Whether a call may be granted escalation outside the sandbox (its provider decides it). */
108
87
  outsideSandbox: boolean;
109
- /** How far restricted work may root outside the workspace. */
110
- restrictedProjectReach: "workspace" | "os-user";
111
88
  /** The layer that set each ceiling (a disabled option names it), or null when nothing did. */
112
89
  layer: {
113
90
  network: DeviceSandboxLayer | null;
114
91
  outsideSandbox: DeviceSandboxLayer | null;
115
92
  };
116
93
  /**
117
- * A cloud device's instance runs another network: its next use updates or recreates it, files
118
- * kept (the page says it applies on next use).
94
+ * The device's instance runs another network: its next use updates or recreates it, files kept
95
+ * (the page says it applies on next use).
119
96
  */
120
97
  pendingNextUse: boolean;
121
98
  /**
@@ -126,21 +103,6 @@ export interface DeviceSandboxView {
126
103
  /** Its last {@link RECENT_POLICY_CHANGES} setting changes, newest first. */
127
104
  recent: DeviceSettingChangeView[];
128
105
  }
129
- /** {@link DeviceView.ownerCeiling}: a local machine's owner ceiling as reported. */
130
- export interface DeviceOwnerCeilingView {
131
- state: "report" | "blocked" | "missing";
132
- revision: string | null;
133
- sequence: number | null;
134
- /** The owner allows running outside the sandbox (fail closed: false). */
135
- outsideSandbox: boolean;
136
- /** The owner's sandbox network (fail closed: `allowlist`). */
137
- network: "open" | "allowlist";
138
- /** The owner's sandbox allowlist: the machine's host ceiling while its network is `allowlist`. */
139
- allowedDomains: string[];
140
- restrictedProjectReach: "workspace" | "os-user";
141
- observedAt: string | null;
142
- stale: boolean;
143
- }
144
106
  /** How many recent setting changes a device view lists. */
145
107
  export declare const RECENT_POLICY_CHANGES = 10;
146
108
  /**
@@ -190,39 +152,25 @@ export interface DeviceCeilingFacts {
190
152
  restrictedProjectReach?: "workspace" | "os-user";
191
153
  network?: "open" | "allowlist";
192
154
  }
193
- /** A cloud device's stored network setting: `mode` null follows its org. */
155
+ /** A device's stored network setting: `mode` null follows its org. */
194
156
  export interface DeviceNetworkSetting {
195
157
  mode: "open" | "allowlist" | "none" | null;
196
158
  hosts: string[];
197
159
  }
198
- /** A narrowing of a local device's policy by its owner (`POST /devices/:id/policy`). */
199
- export interface DevicePolicyChange {
200
- remove?: string[] | undefined;
201
- /** Narrow the owner ceiling (never widen; the schema refuses anything wider). */
202
- ownerCeiling?: {
203
- outsideSandbox?: false | undefined;
204
- network?: "allowlist" | undefined;
205
- restrictedProjectReach?: "workspace" | undefined;
206
- } | undefined;
207
- }
208
160
  /** What `PATCH /devices/:id` changes. */
209
161
  export interface DevicePatch {
210
162
  name?: string;
211
- /**
212
- * A cloud device's sandbox network, within its org's and the platform's ceilings. A local
213
- * device refuses it here (`device.ceiling_on_machine`).
214
- */
163
+ /** The device's sandbox network, within its org's and the platform's ceilings. */
215
164
  network?: {
216
165
  mode: "open" | "allowlist" | "none" | null;
217
166
  hosts?: string[] | undefined;
218
167
  };
219
168
  }
220
- /** The machine connected to a local device, as its owner sees it. */
169
+ /** The machine signed in to a dial-in device, as its owner sees it. */
221
170
  export interface DeviceMachineView {
222
171
  id: string;
223
172
  name: string;
224
173
  os: string;
225
- mode: "os" | "docker" | null;
226
174
  programVersion: string | null;
227
175
  lastSeenAt: string | null;
228
176
  }
@@ -247,11 +195,13 @@ export interface DeviceProviderOption {
247
195
  /** The extension's display name; null when it has none. */
248
196
  displayName: LocalizedName | null;
249
197
  }
198
+ /** A device sign-in names a provider that is no dial-in provider on in the org (403). */
199
+ export declare const dialInProviderUnavailable: (provider: string) => ApiError;
250
200
  /**
251
- * Personal devices (spec 2026-11-07-environments-design §4.2 items 7, 12, 13; §6; §9):
252
- * cloud ones, each bound for life to the device provider it was created on (device-provider spec
253
- * §6.1), and `local` ones on a connected machine; a
254
- * person's devices in an org, visible and usable only by their owner (anyone else gets
201
+ * Personal devices (spec 2026-11-07-environments-design §4.2 items 7, 12, 13; §6; §9), each
202
+ * bound for life to the device provider it was created on (device-provider spec §6.1) and handled
203
+ * the same way whatever that provider is (a dial-in provider's device is signed in from its
204
+ * machine); a person's devices in an org, visible and usable only by their owner (anyone else gets
255
205
  * `device.not_found`). Deleting one soft-deletes it and owes the destruction of its instance and
256
206
  * files (a `sandbox-destroy-for` job) in the same transaction.
257
207
  */
@@ -265,22 +215,29 @@ export declare class DevicesService {
265
215
  /** Owes a deleted device's destruction in the delete's transaction. */
266
216
  private readonly outbox;
267
217
  private readonly access;
268
- /** Reads the device relay's lease (`online`). */
269
- private readonly locks;
218
+ /** Whether a dial-in device's machine is connected now. */
219
+ private readonly relay;
220
+ /** Each device's provider (whether it serves its devices over the dial-in channel). */
221
+ private readonly providers;
270
222
  private readonly machines;
271
- private readonly policies;
272
223
  private readonly ceilings;
273
224
  private readonly facts;
274
225
  private readonly displayNames;
275
226
  /** Each device's stored provider report (read only; never asks the provider). */
276
227
  private readonly reports;
228
+ /** The dial-in providers on in an org (a device signed in from a machine). */
229
+ private readonly dialIn;
277
230
  constructor(db: KernelDb, txHost: TransactionHost, config: Pick<KernelConfigService, "get" | "fieldSource">, selection: Pick<DeviceProviderSelection, "onInOrg" | "isOnInOrg" | "defaultFor">, sandbox: Pick<SandboxService, "devicePolicy" | "deviceLimits" | "limitsState">, sandboxJobs: Pick<SandboxJobs, "resetFiles">,
278
231
  /** Owes a deleted device's destruction in the delete's transaction. */
279
232
  outbox: Pick<OutboxService, "add">, access: Pick<DeviceAccess, "usable">,
280
- /** Reads the device relay's lease (`online`). */
281
- locks: Pick<LockService, "holderOf">, machines: Pick<MachinesService, "revoke" | "revokeActive">, policies: Pick<DevicePolicyService, "apply" | "summary">, ceilings: PermissionCeilingWrites, facts: Pick<PermissionFacts, "deviceSandbox" | "deviceSandboxFacts">, displayNames: Pick<ExtensionDisplayNames, "many">,
233
+ /** Whether a dial-in device's machine is connected now. */
234
+ relay: Pick<DialInRelay, "online">,
235
+ /** Each device's provider (whether it serves its devices over the dial-in channel). */
236
+ providers: Pick<DeviceProviders, "forDevice">, machines: Pick<DialInMachines, "revoke" | "revokeActive">, ceilings: PermissionCeilingWrites, facts: Pick<PermissionFacts, "deviceSandbox" | "deviceSandboxFacts">, displayNames: Pick<ExtensionDisplayNames, "many">,
282
237
  /** Each device's stored provider report (read only; never asks the provider). */
283
- reports: Pick<DeviceReports, "read">);
238
+ reports: Pick<DeviceReports, "read">,
239
+ /** The dial-in providers on in an org (a device signed in from a machine). */
240
+ dialIn: Pick<DialInHandlers, "onInOrg">);
284
241
  /**
285
242
  * The person's live devices in the org, the default first, then by creation, with the device
286
243
  * providers on in the org and its default one. With a default provider serving the org the
@@ -291,7 +248,7 @@ export declare class DevicesService {
291
248
  /** One of the person's live devices; anyone else's (or a missing one) → `not_found`. */
292
249
  get(orgId: string, accountId: string, id: string): Promise<DeviceView>;
293
250
  /**
294
- * A new personal cloud device, ready at once (its instance and files are made on first use),
251
+ * A new personal device, ready at once (its instance and files are made on first use),
295
252
  * bound for life to `input.provider` or, without one, the org's default provider: a provider not
296
253
  * on in the org (unknown, not loaded, off, kernel-internal) → `validation_failed` at `provider`;
297
254
  * none named and no default serving the org → `device.provider_required`. A live name of the
@@ -304,19 +261,21 @@ export declare class DevicesService {
304
261
  provider?: string;
305
262
  }, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<DeviceView>;
306
263
  /**
307
- * The provider a new cloud device of `orgId` is bound to: `named` when it serves the org now
264
+ * The provider a new device of `orgId` is bound to: `named` when it serves the org now
308
265
  * (one of {@link DeviceProviderSelection.onInOrg}), else the org's default
309
266
  * ({@link DeviceProviderSelection.defaultFor}) when none is named; never another one.
310
267
  */
311
268
  private providerFor;
312
269
  private insert;
313
270
  /**
314
- * A new personal local device for a machine being connected (provider `@local`; the
315
- * machine row is the caller's). Joins the caller's transaction (the device authorization's).
271
+ * A new personal device for a machine being signed in (the device sign-in; the machine row is
272
+ * the caller's), bound for life to the dial-in provider `provider`: one that serves the org now
273
+ * and declares `permissions.dialIn` ({@link DialInHandlers.onInOrg}), else
274
+ * `device.provider_unavailable`. Joins the caller's transaction (the device authorization's).
316
275
  * Counted against `devices.maxPersonal` (`device.limit_reached`); a live name of the
317
- * person's → `device.name_taken`. Needs no device provider on in the org.
276
+ * person's → `device.name_taken`.
318
277
  */
319
- createLocal(orgId: string, accountId: string, name: string): Promise<{
278
+ createDialIn(orgId: string, accountId: string, provider: string, name: string): Promise<{
320
279
  id: string;
321
280
  }>;
322
281
  /**
@@ -335,8 +294,8 @@ export declare class DevicesService {
335
294
  /** How many of the person's conversations work in the device (read only). */
336
295
  boundConversations(orgId: string, accountId: string, id: string): Promise<number>;
337
296
  /**
338
- * The refusals {@link resetFiles} would raise (not found, its provider not current, a connected
339
- * device), read only.
297
+ * The refusals {@link resetFiles} would raise (not found, its provider not on, a provider that
298
+ * offers no reset), read only.
340
299
  */
341
300
  checkReset(orgId: string, accountId: string, id: string): Promise<void>;
342
301
  /** The refusals {@link rename} would raise, read without locks (see {@link checkCreate}). */
@@ -349,13 +308,12 @@ export declare class DevicesService {
349
308
  rename(orgId: string, accountId: string, id: string, name: string, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<DeviceView>;
350
309
  private renameIn;
351
310
  /**
352
- * `PATCH /devices/:id`: renames one of the person's live devices ({@link rename}) and sets a
353
- * cloud device's sandbox network ({@link networkLocked}), in one transaction. A network change
354
- * takes the membership, the device row and the device's permission write lock as the ordered
355
- * prelude (`withOrderedLocks`): inside a run's fence (`devices.set-network`) they follow the org
356
- * row and precede the conversation rows. A local device's network lives on its machine
357
- * (`device.ceiling_on_machine`). `narrowOnly` (an API token, the Platform tool): the network may
358
- * only narrow, stored and effective.
311
+ * `PATCH /devices/:id`: renames one of the person's live devices ({@link rename}) and sets its
312
+ * sandbox network ({@link networkLocked}), in one transaction, the same for every provider. A
313
+ * network change takes the membership, the device row and the device's permission write lock as
314
+ * the ordered prelude (`withOrderedLocks`): inside a run's fence (`devices.set-network`) they
315
+ * follow the org row and precede the conversation rows. `narrowOnly` (an API token, the Platform
316
+ * tool): the network may only narrow, stored and effective.
359
317
  */
360
318
  update(orgId: string, accountId: string, id: string, patch: DevicePatch, actorTokenId?: string, opts?: {
361
319
  narrowOnly?: boolean;
@@ -365,23 +323,22 @@ export declare class DevicesService {
365
323
  private lockNetworkSubject;
366
324
  private updateIn;
367
325
  /**
368
- * Checks a cloud network change without writing anything and without locks (the Platform
369
- * tool's precheck): the device is the person's live cloud device, and the change stays within
326
+ * Checks a network change without writing anything and without locks (the Platform tool's
327
+ * precheck): the device is the person's live device, and the change stays within
370
328
  * the ceilings and, with `narrowOnly`, only narrows. Throws what {@link update} would; the
371
329
  * write re-checks under its locks.
372
330
  */
373
331
  checkNetwork(orgId: string, accountId: string, id: string, network: NonNullable<DevicePatch["network"]>, narrowOnly: boolean): Promise<void>;
374
332
  /**
375
- * Decides a cloud network change (read only): the stored setting before and after, the
376
- * effective device sandbox before and after (computed in memory from the patched setting), and
377
- * whether it widens. Refuses, without writing: a local device (`device.ceiling_on_machine`),
378
- * the open network above the ceilings or a host outside the org's list
379
- * (`device.network_not_allowed`), and with `narrowOnly` a widening of the stored setting or of
380
- * the effective network (`device.network_not_allowed`). Null when nothing changes.
333
+ * Decides a network change (read only): the stored setting before and after, the effective
334
+ * device sandbox before and after (computed in memory from the patched setting), and whether it
335
+ * widens. Refuses, without writing: the open network above the ceilings or a host outside the
336
+ * org's list (`device.network_not_allowed`), and with `narrowOnly` a widening of the stored
337
+ * setting or of the effective network (`device.network_not_allowed`). Null when nothing changes.
381
338
  */
382
339
  private planNetwork;
383
340
  /**
384
- * A cloud device's sandbox network (approval-only profiles design, "Settings model"), under the
341
+ * A device's sandbox network (approval-only profiles design, "Settings model"), under the
385
342
  * device authority writer held since the prelude: its owner chooses `open`, `allowlist` (its
386
343
  * org's hosts, narrowed by its own list: a device list never adds a host; an empty one follows
387
344
  * the org's hosts), `none` (closed) or null (follow the org), in both directions within the
@@ -392,18 +349,12 @@ export declare class DevicesService {
392
349
  * Audited `device.network_changed` (`via`: `web`, `token` for an API token, or the agent's).
393
350
  */
394
351
  private networkLocked;
395
- /**
396
- * How far restricted work may root outside the device's workspace now (B2): a local machine's
397
- * owner reach within a platform and org that allow the wider device ceiling; a cloud device
398
- * keeps its previous rule (its effective mode). Never the owner's Full permission alone.
399
- */
400
- projectReach(orgId: string, deviceId: string): Promise<"workspace" | "os-user">;
401
352
  /**
402
353
  * The level a sandbox call in the device runs at now, for the model (legacy `device_paths`, auto
403
- * mode spec §4.2): the kernel-internal tier (`SandboxMode`: a local machine's owner permission to
404
- * run outside the sandbox, failing closed) with its device sandbox network, and a cloud device's
405
- * pending file-reset state (the tier and network its instance still runs with). Null when the
406
- * device is not a live device of the org.
354
+ * mode spec §4.2), the same for every provider: the kernel-internal tier (`SandboxMode`) with
355
+ * its device sandbox network, a pending file-reset state (the tier and network its instance
356
+ * still runs with), and whether its provider runs each operation on its host machine (an
357
+ * operation boundary). Null when the device is not a live device of the org.
407
358
  */
408
359
  modeLevel(orgId: string, deviceId: string): Promise<DeviceModeLevel | null>;
409
360
  /** Renames the device locked by {@link lockOwn} (`before`); see {@link rename}. */
@@ -412,7 +363,7 @@ export declare class DevicesService {
412
363
  * Deletes one of the person's live devices: soft delete, its IM default row cleared, and a
413
364
  * `sandbox-destroy-for` job owed in the same transaction (`device-destroy-<deviceId>`; the
414
365
  * worker waits for running commands, then destroys the instance and the files). Conversations bound to it keep pointing at it; their
415
- * sandbox tools then fail with `device.not_found`. A local device's machine is
366
+ * sandbox tools then fail with `device.not_found`. A dial-in device's machine is
416
367
  * revoked in the same transaction; after the commit it is told `stop { reason: "deleted" }`
417
368
  * (while connected) and its connection is closed.
418
369
  *
@@ -425,32 +376,17 @@ export declare class DevicesService {
425
376
  private lockRemovalSubject;
426
377
  private removeIn;
427
378
  /**
428
- * Disconnects the machine of one of the person's own local devices (it must sign in
429
- * again); see {@link MachinesService.revoke}.
379
+ * Disconnects the machine of one of the person's own dial-in devices (it must sign in
380
+ * again); see {@link DialInMachines.revoke}.
430
381
  */
431
382
  revokeMachine(orgId: string, accountId: string, id: string, actorTokenId?: string): Promise<void>;
432
- /**
433
- * The owner narrows one of their own local devices' sandbox from the web (approval-only
434
- * profiles design, "Settings model"): sent to the machine with the `policy` op, which is the
435
- * authority and answers with the policy as written. Anyone but the owner gets
436
- * `device.not_found`. The owner may remove hosts from the machine's allowlist and narrow its
437
- * owner ceiling (no running outside the sandbox, the allowlist network, the workspace reach);
438
- * widening happens on the machine only. The machine offline → `device.offline`; a cloud device
439
- * or a program without the `policyOpId` feature → `device.policy_unsupported`; the machine's
440
- * refusal → `device.policy_refused` with its message. Callers are human sessions only (no
441
- * personal access token, no service token, no Platform op).
442
- */
443
- changePolicy(orgId: string, account: {
444
- id: string;
445
- displayName: string;
446
- }, id: string, change: DevicePolicyChange): Promise<DeviceLocalPolicySummary>;
447
383
  /**
448
384
  * Starts one of the person's devices over with empty files (after
449
385
  * `device.files_lost`): records the request (audit), then, after the commit, enqueues the
450
386
  * `sandbox-reset-files` job (deterministic id per device), whose worker waits for running
451
387
  * commands and destroys any instance and the file system; the next use creates new ones. Its
452
- * provider must be the current one (`device.unavailable`); a local device's files
453
- * are its machine owner's (`device.files_on_device`). An enqueue failure is thrown
388
+ * provider must be on (`device.unavailable`) and offer a reset (its report's `reset`, else
389
+ * `device.files_on_device`). An enqueue failure is thrown
454
390
  * (the request can be repeated: the reset is idempotent).
455
391
  */
456
392
  resetFiles(orgId: string, accountId: string, id: string, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<void>;
@@ -488,6 +424,8 @@ export declare class DevicesService {
488
424
  private defaultOf;
489
425
  /** The person's live devices (or the one `id`) as views. */
490
426
  private views;
427
+ /** Whether `provider` (a device's `devices.provider`) serves its devices over dial-in. */
428
+ private isDialIn;
491
429
  /**
492
430
  * The last {@link RECENT_POLICY_CHANGES} setting changes of each device in the org (audit rows
493
431
  * {@link SETTING_CHANGE_ACTIONS}), newest first, with the deciding account's display name.
@@ -522,11 +460,10 @@ export declare function networkNarrowingRevokes(next: {
522
460
  hostCeiling: HostGrantCeiling;
523
461
  }, scope: SandboxOperationScope | SandboxBrowseScope, intent: Pick<Selectable<SandboxOperationIntentsTable>, "method" | "granted_hosts">): boolean;
524
462
  /**
525
- * The sandbox view of one device: its effective {@link DeviceSandbox} with its own network setting
526
- * (`own`: a local machine's owner facts, a cloud device's stored choice) and the instance's pending
527
- * change with the recent changes.
463
+ * The sandbox view of one device: its effective {@link DeviceSandbox} with its own stored network
464
+ * setting (`own`) and the instance's pending change with the recent changes.
528
465
  */
529
- export declare function sandboxViewOf(box: DeviceSandbox, own: Pick<OwnerFacts, "state" | "network" | "allowedDomains"> | {
466
+ export declare function sandboxViewOf(box: DeviceSandbox, own: {
530
467
  networkMode: "open" | "allowlist" | "none" | null;
531
468
  networkHosts: readonly string[];
532
469
  }, extra: Pick<DeviceSandboxView, "pendingNextUse" | "pendingFilesReset" | "recent">): DeviceSandboxView;