@capybara-hq/kernel 0.1.0-rc.12 → 0.1.0-rc.13

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 (192) hide show
  1. package/dist/admin/admin.schemas.d.ts +13 -0
  2. package/dist/agents/agent-lookup.d.ts +5 -0
  3. package/dist/agents/agent-lookup.js +15 -0
  4. package/dist/background/background.module.js +2 -2
  5. package/dist/background/launch-lock.d.ts +1 -1
  6. package/dist/background/launch-lock.js +1 -1
  7. package/dist/background/poll.job.d.ts +2 -2
  8. package/dist/background/poll.job.js +10 -10
  9. package/dist/background/stop.d.ts +1 -1
  10. package/dist/background/stop.js +3 -3
  11. package/dist/background/store.d.ts +5 -5
  12. package/dist/background/store.js +5 -5
  13. package/dist/background/tasks.service.d.ts +6 -6
  14. package/dist/background/tasks.service.js +13 -13
  15. package/dist/catalog/marketplaces.service.d.ts +1 -1
  16. package/dist/channels/channels.module.js +2 -2
  17. package/dist/channels/inbound.d.ts +8 -8
  18. package/dist/channels/inbound.js +31 -31
  19. package/dist/channels/phrases.d.ts +27 -27
  20. package/dist/channels/phrases.js +27 -27
  21. package/dist/config/docs.js +1 -1
  22. package/dist/config/schema.d.ts +2 -2
  23. package/dist/config/schema.js +21 -21
  24. package/dist/conversations/conversations.controller.d.ts +11 -11
  25. package/dist/conversations/conversations.controller.js +15 -15
  26. package/dist/conversations/conversations.module.d.ts +1 -1
  27. package/dist/conversations/conversations.module.js +7 -7
  28. package/dist/conversations/conversations.schemas.js +1 -1
  29. package/dist/conversations/conversations.service.d.ts +14 -14
  30. package/dist/conversations/conversations.service.js +19 -19
  31. package/dist/conversations/{environment-status.d.ts → device-status.d.ts} +9 -9
  32. package/dist/conversations/{environment-status.js → device-status.js} +18 -18
  33. package/dist/conversations/event-log.d.ts +1 -1
  34. package/dist/conversations/event-log.js +1 -1
  35. package/dist/conversations/events.d.ts +1 -1
  36. package/dist/conversations/events.js +2 -2
  37. package/dist/ctx/create-ctx.d.ts +10 -1
  38. package/dist/ctx/create-ctx.js +86 -25
  39. package/dist/db/kernel-schema.d.ts +26 -23
  40. package/dist/{environments → devices}/access.d.ts +19 -19
  41. package/dist/{environments → devices}/access.js +28 -28
  42. package/dist/devices/conversation-devices.d.ts +75 -0
  43. package/dist/{environments/conversation-environments.js → devices/conversation-devices.js} +71 -72
  44. package/dist/devices/devices.controller.d.ts +36 -0
  45. package/dist/{environments/environments.controller.js → devices/devices.controller.js} +37 -37
  46. package/dist/devices/devices.module.d.ts +5 -13
  47. package/dist/devices/devices.module.js +16 -29
  48. package/dist/devices/devices.schemas.d.ts +3 -0
  49. package/dist/devices/devices.schemas.js +14 -0
  50. package/dist/{environments/environments.service.d.ts → devices/devices.service.d.ts} +70 -70
  51. package/dist/{environments/environments.service.js → devices/devices.service.js} +122 -122
  52. package/dist/devices/dto.d.ts +13 -54
  53. package/dist/devices/dto.js +7 -39
  54. package/dist/devices/label.d.ts +11 -0
  55. package/dist/{environments → devices}/label.js +7 -7
  56. package/dist/{environments → devices}/legacy-cleanup.job.d.ts +3 -3
  57. package/dist/{environments → devices}/legacy-cleanup.job.js +3 -3
  58. package/dist/errors.d.ts +25 -25
  59. package/dist/errors.js +25 -25
  60. package/dist/evals/recorded-tools.d.ts +2 -2
  61. package/dist/evals/recorded-tools.js +6 -6
  62. package/dist/extensions/admin-ops.js +1 -0
  63. package/dist/extensions/admin-view.js +2 -0
  64. package/dist/extensions/effective-config.d.ts +6 -0
  65. package/dist/extensions/effective-config.js +18 -7
  66. package/dist/extensions/host.d.ts +13 -2
  67. package/dist/extensions/host.js +24 -3
  68. package/dist/extensions/instance.d.ts +12 -1
  69. package/dist/extensions/instance.js +13 -0
  70. package/dist/extensions/permission-view.d.ts +10 -1
  71. package/dist/files/previewers.d.ts +1 -1
  72. package/dist/files/previewers.js +1 -1
  73. package/dist/http/api.module.js +10 -6
  74. package/dist/http/gateway-routes.d.ts +1 -1
  75. package/dist/http/gateway-routes.js +1 -1
  76. package/dist/identity/settings.d.ts +32 -0
  77. package/dist/identity/settings.js +26 -2
  78. package/dist/infra/config/kernel-config.service.js +4 -4
  79. package/dist/kernel.module.js +3 -3
  80. package/dist/{devices → local-devices}/device-auth.controller.d.ts +6 -6
  81. package/dist/{devices → local-devices}/device-auth.controller.js +5 -5
  82. package/dist/{devices → local-devices}/device-auth.d.ts +20 -20
  83. package/dist/{devices → local-devices}/device-auth.js +51 -53
  84. package/dist/local-devices/device-auth.module.d.ts +7 -0
  85. package/dist/{devices → local-devices}/device-auth.module.js +5 -5
  86. package/dist/{devices → local-devices}/device-routes.d.ts +3 -3
  87. package/dist/{devices → local-devices}/device-routes.js +2 -2
  88. package/dist/local-devices/dto.d.ts +66 -0
  89. package/dist/local-devices/dto.js +44 -0
  90. package/dist/{devices → local-devices}/keys.d.ts +11 -11
  91. package/dist/{devices → local-devices}/keys.js +11 -11
  92. package/dist/{devices/device-gateway.d.ts → local-devices/local-device-gateway.d.ts} +14 -14
  93. package/dist/{devices/device-gateway.js → local-devices/local-device-gateway.js} +44 -44
  94. package/dist/{devices/device-provider.d.ts → local-devices/local-device-provider.d.ts} +15 -15
  95. package/dist/{devices/device-provider.js → local-devices/local-device-provider.js} +23 -23
  96. package/dist/local-devices/local-devices.module.d.ts +16 -0
  97. package/dist/local-devices/local-devices.module.js +44 -0
  98. package/dist/{devices → local-devices}/machines.d.ts +26 -26
  99. package/dist/{devices → local-devices}/machines.js +71 -71
  100. package/dist/{devices → local-devices}/relay.d.ts +15 -15
  101. package/dist/{devices → local-devices}/relay.js +55 -55
  102. package/dist/{devices → local-devices}/targets.d.ts +8 -8
  103. package/dist/{devices → local-devices}/targets.js +14 -14
  104. package/dist/orgs/offboarding.d.ts +6 -6
  105. package/dist/orgs/offboarding.js +12 -12
  106. package/dist/orgs/settings.service.d.ts +28 -0
  107. package/dist/orgs/settings.service.js +20 -1
  108. package/dist/platform/exclusions.js +38 -3
  109. package/dist/platform/operation.js +6 -2
  110. package/dist/platform/ops/admin.ops.js +8 -2
  111. package/dist/platform/ops/conversations.ops.d.ts +3 -3
  112. package/dist/platform/ops/conversations.ops.js +9 -9
  113. package/dist/platform/ops/devices.ops.d.ts +26 -0
  114. package/dist/platform/ops/devices.ops.js +311 -0
  115. package/dist/platform/ops/org-settings.ops.js +2 -2
  116. package/dist/platform/ops/orgs.ops.js +1 -0
  117. package/dist/platform/ops/ui.ops.d.ts +8 -0
  118. package/dist/platform/ops/ui.ops.js +41 -0
  119. package/dist/platform/platform-ops.module.d.ts +3 -2
  120. package/dist/platform/platform-ops.module.js +8 -5
  121. package/dist/platform/route-schemas.js +6 -3
  122. package/dist/roles/gateway-role.d.ts +3 -3
  123. package/dist/roles/gateway-role.js +4 -4
  124. package/dist/roles/gateway.module.d.ts +1 -1
  125. package/dist/roles/gateway.module.js +5 -5
  126. package/dist/roles/worker.module.js +1 -1
  127. package/dist/runtime/context/build.d.ts +1 -1
  128. package/dist/runtime/context/build.js +6 -6
  129. package/dist/runtime/context/compaction.js +1 -1
  130. package/dist/runtime/context/{environment-paths.d.ts → device-paths.d.ts} +11 -11
  131. package/dist/runtime/context/{environment-paths.js → device-paths.js} +13 -13
  132. package/dist/runtime/maintenance.d.ts +1 -1
  133. package/dist/sandbox/jobs.d.ts +13 -13
  134. package/dist/sandbox/jobs.js +20 -20
  135. package/dist/sandbox/leases.d.ts +9 -9
  136. package/dist/sandbox/leases.js +14 -14
  137. package/dist/sandbox/providers.d.ts +8 -8
  138. package/dist/sandbox/providers.js +8 -8
  139. package/dist/sandbox/sandbox.module.d.ts +1 -1
  140. package/dist/sandbox/sandbox.module.js +1 -1
  141. package/dist/sandbox/sandbox.service.d.ts +76 -76
  142. package/dist/sandbox/sandbox.service.js +230 -230
  143. package/dist/tools/builtins/builtin-tools.d.ts +2 -2
  144. package/dist/tools/builtins/builtin-tools.js +5 -5
  145. package/dist/tools/builtins/platform.js +1 -1
  146. package/dist/tools/builtins/sandbox/bash.js +6 -6
  147. package/dist/tools/builtins/sandbox/common.d.ts +25 -25
  148. package/dist/tools/builtins/sandbox/common.js +51 -51
  149. package/dist/tools/builtins/sandbox/edit.js +2 -2
  150. package/dist/tools/builtins/sandbox/index.d.ts +1 -1
  151. package/dist/tools/builtins/sandbox/index.js +1 -1
  152. package/dist/tools/builtins/sandbox/task-output.d.ts +6 -6
  153. package/dist/tools/builtins/sandbox/task-output.js +10 -10
  154. package/dist/tools/builtins/sandbox/task-stop.js +2 -2
  155. package/dist/tools/builtins/sandbox/write.js +2 -2
  156. package/dist/tools/builtins/skill-load.d.ts +1 -1
  157. package/dist/tools/builtins/skill-load.js +2 -2
  158. package/dist/tools/pipeline.js +4 -3
  159. package/dist/tools/registry.d.ts +2 -2
  160. package/dist/tools/tools.module.js +3 -3
  161. package/dist/ui/admin-ui.controller.d.ts +56 -0
  162. package/dist/ui/admin-ui.controller.js +192 -0
  163. package/dist/ui/arrangement.d.ts +74 -0
  164. package/dist/ui/arrangement.js +98 -0
  165. package/dist/ui/embed-token.d.ts +2 -2
  166. package/dist/ui/embed-token.js +30 -5
  167. package/dist/ui/registry.d.ts +29 -14
  168. package/dist/ui/registry.js +31 -10
  169. package/dist/ui/slots.controller.d.ts +11 -0
  170. package/dist/ui/slots.controller.js +25 -0
  171. package/dist/ui/ui-stream.d.ts +20 -3
  172. package/dist/ui/ui-stream.js +25 -7
  173. package/dist/ui/ui.schemas.d.ts +66 -0
  174. package/dist/ui/ui.schemas.js +65 -0
  175. package/dist/ui/views.controller.d.ts +35 -49
  176. package/dist/ui/views.controller.js +48 -70
  177. package/dist/ui/views.d.ts +84 -18
  178. package/dist/ui/views.js +201 -38
  179. package/package.json +3 -3
  180. package/src/migrations/0105_devices_rename.sql +136 -0
  181. package/dist/devices/device-auth.module.d.ts +0 -7
  182. package/dist/environments/conversation-environments.d.ts +0 -75
  183. package/dist/environments/dto.d.ts +0 -25
  184. package/dist/environments/dto.js +0 -12
  185. package/dist/environments/environments.controller.d.ts +0 -36
  186. package/dist/environments/environments.module.d.ts +0 -8
  187. package/dist/environments/environments.module.js +0 -31
  188. package/dist/environments/environments.schemas.d.ts +0 -3
  189. package/dist/environments/environments.schemas.js +0 -14
  190. package/dist/environments/label.d.ts +0 -11
  191. package/dist/platform/ops/environments.ops.d.ts +0 -26
  192. package/dist/platform/ops/environments.ops.js +0 -311
@@ -1,21 +1,21 @@
1
1
  import type { LocalizedName, SandboxLimits } from "@capybara-hq/plugin-sdk";
2
- import { MachinesService } from "../devices/machines.js";
3
2
  import { ExtensionDisplayNames } from "../extensions/display-name.js";
4
3
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
5
4
  import { KernelDb } from "../infra/database/kernel-db.js";
6
5
  import { TransactionHost } from "../infra/database/transaction-host.js";
7
6
  import { LockService } from "../infra/lock/lock.service.js";
7
+ import { MachinesService } from "../local-devices/machines.js";
8
8
  import type { KernelLogger } from "../log.js";
9
9
  import { SandboxJobs } from "../sandbox/jobs.js";
10
10
  import { SandboxProviders } from "../sandbox/providers.js";
11
11
  import { SandboxService } from "../sandbox/sandbox.service.js";
12
- import { EnvironmentAccess } from "./access.js";
13
- /** An environment as its owner sees it (`GET /orgs/:orgId/environments`). */
14
- export interface EnvironmentView {
12
+ import { DeviceAccess } from "./access.js";
13
+ /** A device as its owner sees it (`GET /orgs/:orgId/devices`). */
14
+ export interface DeviceView {
15
15
  id: string;
16
16
  /**
17
- * null for the default environment (shown as 「个人环境」 / "Personal") and for a demoted default
18
- * (shown as 「个人环境(Docker 沙箱)」 / "Personal (Docker sandbox)", from {@link demotedFrom}).
17
+ * null for the default device (shown as 「个人设备」 / "Personal") and for a demoted default
18
+ * (shown as 「个人设备(Docker 沙箱)」 / "Personal (Docker sandbox)", from {@link demotedFrom}).
19
19
  */
20
20
  name: string | null;
21
21
  isDefault: boolean;
@@ -24,7 +24,7 @@ export interface EnvironmentView {
24
24
  * demoted from, that extension's display name (null when it has none, e.g. uninstalled: show the
25
25
  * id), and its place among the person's unnamed former defaults of that provider (1, 2, … by
26
26
  * creation; a label shows " 2", " 3", … after the first). Switching back to that provider makes
27
- * it the default again. null for every other environment.
27
+ * it the default again. null for every other device.
28
28
  */
29
29
  demotedFrom: {
30
30
  provider: string;
@@ -32,16 +32,16 @@ export interface EnvironmentView {
32
32
  ordinal: number;
33
33
  } | null;
34
34
  ownerKind: "personal";
35
- /** `device`: a connected machine (provider `@device`). */
36
- source: "cloud" | "device";
35
+ /** `local`: a machine connected with capybara-device (provider `@local`). */
36
+ source: "cloud" | "local";
37
37
  /** The provider keeping its files, or the one its first use will create them with. */
38
38
  provider: string | null;
39
- /** Its provider is there: the deployment's current cloud provider, or `@device` registered. */
39
+ /** Its provider is there: the deployment's current cloud provider, or `@local` registered. */
40
40
  available: boolean;
41
- /** A device environment: some replica holds its machine's connection now; null for cloud. */
41
+ /** A local device: some replica holds its machine's connection now; null for cloud. */
42
42
  online: boolean | null;
43
- /** A device environment's connected machine (its unrevoked one); null for cloud or none. */
44
- machine: EnvironmentMachineView | null;
43
+ /** A local device's connected machine (its unrevoked one); null for cloud or none. */
44
+ machine: DeviceMachineView | null;
45
45
  sessionIsolation: boolean;
46
46
  /** Its file system is gone at the provider; reset the files to use it again. */
47
47
  filesLost: boolean;
@@ -49,12 +49,12 @@ export interface EnvironmentView {
49
49
  status: "running" | "suspended";
50
50
  lastUsedAt: string;
51
51
  } | null;
52
- /** The org's effective sandbox limits (phase 1 environments use them unchanged, spec §8.4). */
52
+ /** The org's effective sandbox limits (phase 1 devices use them unchanged, spec §8.4). */
53
53
  limits: SandboxLimits;
54
54
  createdAt: string;
55
55
  }
56
- /** The machine connected to a device environment, as its owner sees it. */
57
- export interface EnvironmentMachineView {
56
+ /** The machine connected to a local device, as its owner sees it. */
57
+ export interface DeviceMachineView {
58
58
  id: string;
59
59
  name: string;
60
60
  os: string;
@@ -62,24 +62,24 @@ export interface EnvironmentMachineView {
62
62
  programVersion: string | null;
63
63
  lastSeenAt: string | null;
64
64
  }
65
- /** The list response: the person's live environments in the org. */
66
- export interface EnvironmentList {
67
- items: EnvironmentView[];
68
- /** The person's default environment; null when there is none (no sandbox provider to make it). */
65
+ /** The list response: the person's live devices in the org. */
66
+ export interface DeviceList {
67
+ items: DeviceView[];
68
+ /** The person's default device; null when there is none (no sandbox provider to make it). */
69
69
  defaultId: string | null;
70
- /** The environment of the person's most recently updated conversation that has a live one. */
70
+ /** The device of the person's most recently updated conversation that has a live one. */
71
71
  lastUsedId: string | null;
72
- /** There is a current sandbox provider (new cloud environments can be made; ruling R4). */
72
+ /** There is a current sandbox provider (new cloud devices can be made; ruling R4). */
73
73
  cloudAvailable: boolean;
74
74
  }
75
75
  /**
76
- * Personal environments (spec 2026-11-07-environments-design §4.2 items 7, 12, 13; §6; §9):
76
+ * Personal devices (spec 2026-11-07-environments-design §4.2 items 7, 12, 13; §6; §9):
77
77
  * cloud ones on the deployment's sandbox provider and `device` ones on a connected machine; a
78
- * person's environments in an org, visible and usable only by their owner (anyone else gets
79
- * `environment.not_found`). Deleting one soft-deletes it and destroys its instance and files in a
78
+ * person's devices in an org, visible and usable only by their owner (anyone else gets
79
+ * `device.not_found`). Deleting one soft-deletes it and destroys its instance and files in a
80
80
  * `sandbox-destroy-for` job after the commit.
81
81
  */
82
- export declare class EnvironmentsService {
82
+ export declare class DevicesService {
83
83
  private readonly db;
84
84
  readonly txHost: TransactionHost;
85
85
  private readonly config;
@@ -92,39 +92,39 @@ export declare class EnvironmentsService {
92
92
  /** Reads the device relay's lease (`online`). */
93
93
  private readonly locks;
94
94
  private readonly machines;
95
- constructor(db: KernelDb, txHost: TransactionHost, config: Pick<KernelConfigService, "get">, providers: Pick<SandboxProviders, "cloud" | "forName">, sandbox: Pick<SandboxService, "orgLimits">, sandboxJobs: Pick<SandboxJobs, "destroy" | "resetFiles">, access: Pick<EnvironmentAccess, "usable">, displayNames: Pick<ExtensionDisplayNames, "many">, log: Pick<KernelLogger, "warn">,
95
+ constructor(db: KernelDb, txHost: TransactionHost, config: Pick<KernelConfigService, "get">, providers: Pick<SandboxProviders, "cloud" | "forName">, sandbox: Pick<SandboxService, "orgLimits">, sandboxJobs: Pick<SandboxJobs, "destroy" | "resetFiles">, access: Pick<DeviceAccess, "usable">, displayNames: Pick<ExtensionDisplayNames, "many">, log: Pick<KernelLogger, "warn">,
96
96
  /** Reads the device relay's lease (`online`). */
97
97
  locks: Pick<LockService, "holderOf">, machines: Pick<MachinesService, "revoke" | "revokeActive">);
98
98
  /**
99
- * The person's live environments in the org, the default first, then by creation. With a
100
- * current sandbox provider the default environment is created first if missing (its first need,
99
+ * The person's live devices in the org, the default first, then by creation. With a
100
+ * current sandbox provider the default device is created first if missing (its first need,
101
101
  * spec §4.2 item 7; an existing one is only read).
102
102
  */
103
- list(orgId: string, accountId: string): Promise<EnvironmentList>;
104
- /** One of the person's live environments; anyone else's (or a missing one) → `not_found`. */
105
- get(orgId: string, accountId: string, id: string): Promise<EnvironmentView>;
103
+ list(orgId: string, accountId: string): Promise<DeviceList>;
104
+ /** One of the person's live devices; anyone else's (or a missing one) → `not_found`. */
105
+ get(orgId: string, accountId: string, id: string): Promise<DeviceView>;
106
106
  /**
107
- * A new personal cloud environment, ready at once (its instance and files are made on first
108
- * use). Needs a current sandbox provider (`environment.unavailable`); a live name of the person's
109
- * (case-insensitive) → `environment.name_taken`; `environments.maxPersonal` live ones (the
110
- * default counts) → `environment.limit_reached`. Serialized per person by their membership row.
107
+ * A new personal cloud device, ready at once (its instance and files are made on first
108
+ * use). Needs a current sandbox provider (`device.unavailable`); a live name of the person's
109
+ * (case-insensitive) → `device.name_taken`; `devices.maxPersonal` live ones (the
110
+ * default counts) → `device.limit_reached`. Serialized per person by their membership row.
111
111
  */
112
112
  create(orgId: string, accountId: string, input: {
113
113
  name: string;
114
- }, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<EnvironmentView>;
114
+ }, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<DeviceView>;
115
115
  private insert;
116
116
  /**
117
- * A new personal `device` environment for a machine being connected (provider `@device`; the
117
+ * A new personal local device for a machine being connected (provider `@local`; the
118
118
  * machine row is the caller's). Joins the caller's transaction (the device authorization's).
119
- * Counted against `environments.maxPersonal` (`environment.limit_reached`); a live name of the
120
- * person's → `environment.name_taken`. Needs no cloud provider.
119
+ * Counted against `devices.maxPersonal` (`device.limit_reached`); a live name of the
120
+ * person's → `device.name_taken`. Needs no cloud provider.
121
121
  */
122
- createDevice(orgId: string, accountId: string, name: string): Promise<{
122
+ createLocal(orgId: string, accountId: string, name: string): Promise<{
123
123
  id: string;
124
124
  }>;
125
125
  /**
126
- * Inserts a named personal environment under the person's membership lock, after the limit
127
- * and name checks, and audits `environment.created`. Runs in the caller's transaction.
126
+ * Inserts a named personal device under the person's membership lock, after the limit
127
+ * and name checks, and audits `device.created`. Runs in the caller's transaction.
128
128
  */
129
129
  private insertNamed;
130
130
  /**
@@ -133,54 +133,54 @@ export declare class EnvironmentsService {
133
133
  * same {@link ApiError}s; a race still ends in `create`'s own refusal.
134
134
  */
135
135
  checkCreate(orgId: string, accountId: string, name: string): Promise<void>;
136
- /** How many of the person's conversations work in the environment (read only). */
136
+ /** How many of the person's conversations work in the device (read only). */
137
137
  boundConversations(orgId: string, accountId: string, id: string): Promise<number>;
138
138
  /**
139
139
  * The refusals {@link resetFiles} would raise (not found, its provider not current, a connected
140
- * environment), read only.
140
+ * device), read only.
141
141
  */
142
142
  checkReset(orgId: string, accountId: string, id: string): Promise<void>;
143
143
  /** The refusals {@link rename} would raise, read without locks (see {@link checkCreate}). */
144
144
  checkRename(orgId: string, accountId: string, id: string, name: string): Promise<void>;
145
145
  /**
146
- * Renames one of the person's live environments (the default too); see {@link create}. A
146
+ * Renames one of the person's live devices (the default too); see {@link create}. A
147
147
  * renamed former default is the person's own from then on: it loses its demotion mark, so a
148
148
  * switch back to its provider no longer restores it.
149
149
  */
150
- rename(orgId: string, accountId: string, id: string, name: string, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<EnvironmentView>;
150
+ rename(orgId: string, accountId: string, id: string, name: string, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<DeviceView>;
151
151
  private renameIn;
152
152
  /**
153
- * Deletes one of the person's live environments: soft delete, its IM default row cleared, and
153
+ * Deletes one of the person's live devices: soft delete, its IM default row cleared, and
154
154
  * after the commit a `sandbox-destroy-for` job (the worker waits for running commands, then
155
155
  * destroys the instance and the files). Conversations bound to it keep pointing at it; their
156
- * sandbox tools then fail with `environment.not_found`. A device environment's machine is
156
+ * sandbox tools then fail with `device.not_found`. A local device's machine is
157
157
  * revoked in the same transaction; after the commit it is told `stop { reason: "deleted" }`
158
158
  * (while connected) and its connection is closed.
159
159
  */
160
160
  remove(orgId: string, accountId: string, id: string, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<void>;
161
161
  /**
162
- * Disconnects the machine of one of the person's own device environments (it must sign in
162
+ * Disconnects the machine of one of the person's own local devices (it must sign in
163
163
  * again); see {@link MachinesService.revoke}.
164
164
  */
165
165
  revokeMachine(orgId: string, accountId: string, id: string, actorTokenId?: string): Promise<void>;
166
166
  /**
167
- * Starts one of the person's environments over with empty files (after
168
- * `environment.files_lost`): records the request (audit), then, after the commit, enqueues the
169
- * `sandbox-reset-files` job (deterministic id per environment), whose worker waits for running
167
+ * Starts one of the person's devices over with empty files (after
168
+ * `device.files_lost`): records the request (audit), then, after the commit, enqueues the
169
+ * `sandbox-reset-files` job (deterministic id per device), whose worker waits for running
170
170
  * commands and destroys any instance and the file system; the next use creates new ones. Its
171
- * provider must be the current one (`environment.unavailable`); a connected environment's files
172
- * are its machine owner's (`environment.files_on_device`). An enqueue failure is thrown
171
+ * provider must be the current one (`device.unavailable`); a local device's files
172
+ * are its machine owner's (`device.files_on_device`). An enqueue failure is thrown
173
173
  * (the request can be repeated: the reset is idempotent).
174
174
  */
175
175
  resetFiles(orgId: string, accountId: string, id: string, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<void>;
176
176
  /** The check and audit row of {@link resetFiles}, committed before the job is enqueued. */
177
177
  private recordReset;
178
178
  /**
179
- * The person's default environment in the org, created when missing (named by the UI, `name`
179
+ * The person's default device in the org, created when missing (named by the UI, `name`
180
180
  * NULL). An existing usable one is read without locking. A live default whose files or
181
181
  * instance are kept by a provider that is not the current one (a provider switch, spec §4.2
182
182
  * item 13) is stranded: it is demoted (marked with the provider it was demoted from; the UI
183
- * names it 「个人环境(<provider display name>)」) and stays listed as unavailable and deletable.
183
+ * names it 「个人设备(<provider display name>)」) and stays listed as unavailable and deletable.
184
184
  * Its replacement is the person's former default demoted from the current provider when there
185
185
  * is one (switching back restores it, with its files), else a fresh default. A live default
186
186
  * not in use yet (no healthy files, no instance, none being created: {@link inUseForDefault})
@@ -189,7 +189,7 @@ export declare class EnvironmentsService {
189
189
  * belongs to the provider holding its resources once it holds any, else to the one it was
190
190
  * demoted from ({@link demotedProvider}), so one swapped out empty and used afterwards is
191
191
  * labelled and restored by where its files are.
192
- * All of it in one transaction: switching back and forth never adds environments.
192
+ * All of it in one transaction: switching back and forth never adds devices.
193
193
  *
194
194
  * Replacing one first takes the person's membership row (`FOR SHARE`, after the org row), so an
195
195
  * offboarding that removes them cannot leave a live default behind; not a member (any more) →
@@ -197,13 +197,13 @@ export declare class EnvironmentsService {
197
197
  * defaults of the current provider are locked (`FOR NO KEY UPDATE`) and the live default re-read
198
198
  * after them, the partial unique index on the live default makes a racing insert do nothing, and
199
199
  * the select that follows reads the winner. Needs a current sandbox provider
200
- * (`environment.unavailable`). It is the person's baseline, so it is created even at
201
- * `environments.maxPersonal`.
200
+ * (`device.unavailable`). It is the person's baseline, so it is created even at
201
+ * `devices.maxPersonal`.
202
202
  */
203
203
  ensureDefault(orgId: string, accountId: string): Promise<string>;
204
204
  private insertDefault;
205
205
  /**
206
- * Turns the live default into an ordinary environment marked as demoted from `provider`; a name
206
+ * Turns the live default into an ordinary device marked as demoted from `provider`; a name
207
207
  * the person gave it stays. Runs under the person's membership lock and the default row's lock,
208
208
  * before any other row becomes the default (the partial unique index).
209
209
  */
@@ -217,35 +217,35 @@ export declare class EnvironmentsService {
217
217
  */
218
218
  private formerDefaults;
219
219
  /**
220
- * The person's IM default (what `/env` set): the environment their next new IM conversation
220
+ * The person's IM default (what `/device` set): the device their next new IM conversation
221
221
  * uses. Null when none was set, or the chosen one is deleted (the row is cleared with it).
222
222
  */
223
223
  imDefault(orgId: string, accountId: string): Promise<string | null>;
224
224
  /**
225
- * Sets the person's IM default. Only one of their own live environments in the org, usable now
226
- * (`environment.not_found` / `environment.unavailable` otherwise); the row is written by one
227
- * statement that re-checks the environment is live. There is no row lock, so a delete racing
225
+ * Sets the person's IM default. Only one of their own live devices in the org, usable now
226
+ * (`device.not_found` / `device.unavailable` otherwise); the row is written by one
227
+ * statement that re-checks the device is live. There is no row lock, so a delete racing
228
228
  * past that check can leave a stale row; reads ignore it ({@link imDefault} joins on
229
229
  * `deleted_at IS NULL`).
230
230
  */
231
- setImDefault(orgId: string, accountId: string, environmentId: string): Promise<void>;
231
+ setImDefault(orgId: string, accountId: string, deviceId: string): Promise<void>;
232
232
  /**
233
- * The person's live default environment in the org, if any, with what decides its provider;
233
+ * The person's live default device in the org, if any, with what decides its provider;
234
234
  * `lock` takes its row (`FOR NO KEY UPDATE`; a racing demotion makes it read none).
235
235
  */
236
236
  private defaultOf;
237
237
  /** Its files or instance are kept by a provider that is not the current one. */
238
238
  private stranded;
239
- /** The person's live environments (or the one `id`) as views. */
239
+ /** The person's live devices (or the one `id`) as views. */
240
240
  private views;
241
241
  /**
242
- * Serializes the person's environment writes in the org: the org row (`FOR SHARE`), then their
242
+ * Serializes the person's device writes in the org: the org row (`FOR SHARE`), then their
243
243
  * membership row (`FOR NO KEY UPDATE`, or `FOR SHARE` with `mode` share: enough to keep the
244
244
  * membership from being removed meanwhile), the order member removal locks them in. Not a
245
245
  * member (any more) → `org.not_found`, as the org guard answers.
246
246
  */
247
247
  private lockMember;
248
- /** Locks one of the person's live environments (after their membership); else `not_found`. */
248
+ /** Locks one of the person's live devices (after their membership); else `not_found`. */
249
249
  private lockOwn;
250
250
  private assertNameFree;
251
251
  }