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

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 (177) hide show
  1. package/bootstrap.json +0 -8
  2. package/dist/admin/admin.schemas.d.ts +3 -0
  3. package/dist/agents/admin-agents.d.ts +2 -2
  4. package/dist/agents/admin-agents.js +2 -1
  5. package/dist/agents/agent-lookup.js +2 -1
  6. package/dist/agents/agent-profile.service.d.ts +5 -2
  7. package/dist/agents/agent-profile.service.js +13 -2
  8. package/dist/agents/agents.controller.d.ts +4 -3
  9. package/dist/agents/agents.controller.js +7 -3
  10. package/dist/agents/agents.module.js +3 -0
  11. package/dist/agents/agents.schemas.d.ts +6 -6
  12. package/dist/agents/agents.service.d.ts +23 -2
  13. package/dist/agents/agents.service.js +61 -6
  14. package/dist/agents/avatar-view.d.ts +8 -0
  15. package/dist/agents/avatar-view.js +12 -0
  16. package/dist/agents/profile.d.ts +38 -13
  17. package/dist/agents/profile.js +31 -20
  18. package/dist/attribution/platform-attribution.d.ts +15 -6
  19. package/dist/attribution/platform-attribution.js +31 -14
  20. package/dist/background/poll.job.d.ts +1 -1
  21. package/dist/background/poll.job.js +8 -6
  22. package/dist/background/tasks.service.js +1 -1
  23. package/dist/catalog/catalog-content.d.ts +6 -3
  24. package/dist/catalog/catalog-content.js +7 -8
  25. package/dist/catalog/claude/translate.js +1 -1
  26. package/dist/catalog/marketplaces.service.d.ts +1 -1
  27. package/dist/catalog/marketplaces.service.js +2 -1
  28. package/dist/catalog/plugin-package.d.ts +3 -2
  29. package/dist/channels/file-delivery.d.ts +2 -0
  30. package/dist/channels/file-delivery.js +1 -1
  31. package/dist/channels/inbound.d.ts +8 -4
  32. package/dist/channels/inbound.js +14 -7
  33. package/dist/channels/outbound.js +11 -5
  34. package/dist/channels/phrases.d.ts +21 -13
  35. package/dist/channels/phrases.js +21 -14
  36. package/dist/client/client-files.js +1 -1
  37. package/dist/config/product-name.d.ts +8 -0
  38. package/dist/config/product-name.js +9 -0
  39. package/dist/config/schema.d.ts +1 -0
  40. package/dist/config/schema.js +17 -4
  41. package/dist/conversations/conversations.service.d.ts +4 -3
  42. package/dist/conversations/conversations.service.js +15 -2
  43. package/dist/ctx/create-ctx.js +5 -2
  44. package/dist/ctx/device-provider-check.d.ts +7 -0
  45. package/dist/ctx/device-provider-check.js +21 -0
  46. package/dist/db/kernel-schema.d.ts +7 -0
  47. package/dist/devices/access.d.ts +16 -46
  48. package/dist/devices/access.js +26 -62
  49. package/dist/devices/access.module.js +2 -2
  50. package/dist/devices/conversation-devices.d.ts +38 -18
  51. package/dist/devices/conversation-devices.js +69 -51
  52. package/dist/devices/default-provider-setting.d.ts +45 -0
  53. package/dist/devices/default-provider-setting.js +59 -0
  54. package/dist/devices/device-projects.service.js +7 -2
  55. package/dist/devices/device-provider-selection.d.ts +37 -0
  56. package/dist/devices/device-provider-selection.js +86 -0
  57. package/dist/devices/device-provider-selection.module.d.ts +3 -0
  58. package/dist/devices/device-provider-selection.module.js +22 -0
  59. package/dist/devices/devices.controller.d.ts +8 -5
  60. package/dist/devices/devices.controller.js +7 -4
  61. package/dist/devices/devices.module.js +3 -1
  62. package/dist/devices/devices.schemas.js +2 -2
  63. package/dist/devices/devices.service.d.ts +72 -83
  64. package/dist/devices/devices.service.js +139 -248
  65. package/dist/devices/dto.d.ts +9 -0
  66. package/dist/devices/dto.js +15 -2
  67. package/dist/devices/label.d.ts +3 -5
  68. package/dist/devices/label.js +3 -14
  69. package/dist/devices/legacy-cleanup.job.d.ts +2 -2
  70. package/dist/devices/legacy-cleanup.job.js +6 -6
  71. package/dist/errors.d.ts +15 -1
  72. package/dist/errors.js +15 -1
  73. package/dist/extensions/guide-places.d.ts +2 -1
  74. package/dist/extensions/guide-places.js +8 -2
  75. package/dist/extensions/locks.d.ts +1 -1
  76. package/dist/extensions/locks.js +1 -1
  77. package/dist/extensions/org-config.d.ts +20 -4
  78. package/dist/extensions/org-config.js +23 -6
  79. package/dist/extensions/permission-view.d.ts +2 -2
  80. package/dist/extensions/permission-view.js +2 -2
  81. package/dist/extensions/plugin-guides.d.ts +1 -1
  82. package/dist/extensions/plugin-guides.js +11 -3
  83. package/dist/extensions/point-defaults.d.ts +14 -0
  84. package/dist/extensions/point-defaults.js +70 -47
  85. package/dist/extensions/resolve.js +7 -2
  86. package/dist/git/gateway.d.ts +9 -0
  87. package/dist/git/gateway.js +36 -17
  88. package/dist/git/gateway.route.d.ts +1 -1
  89. package/dist/git/gateway.route.js +1 -3
  90. package/dist/http/app.d.ts +1 -1
  91. package/dist/identity/app-auth.d.ts +4 -3
  92. package/dist/identity/app-auth.js +7 -8
  93. package/dist/identity/settings.d.ts +8 -0
  94. package/dist/identity/settings.js +30 -3
  95. package/dist/identity/sso.d.ts +13 -7
  96. package/dist/identity/sso.js +21 -7
  97. package/dist/infra/config/kernel-config.service.js +3 -1
  98. package/dist/lifecycle/kernel-lifecycle.js +7 -6
  99. package/dist/local-devices/device-routes.d.ts +1 -1
  100. package/dist/local-devices/device-routes.js +2 -2
  101. package/dist/local-devices/local-device-provider.d.ts +14 -11
  102. package/dist/local-devices/local-device-provider.js +14 -0
  103. package/dist/local-devices/local-devices.module.d.ts +4 -4
  104. package/dist/local-devices/local-devices.module.js +5 -3
  105. package/dist/local-devices/owner-report.js +2 -1
  106. package/dist/local-devices/targets.d.ts +2 -0
  107. package/dist/local-devices/targets.js +10 -0
  108. package/dist/orgs/offboarding.js +9 -0
  109. package/dist/orgs/settings.service.d.ts +26 -1
  110. package/dist/orgs/settings.service.js +44 -3
  111. package/dist/platform/ops/admin.ops.js +8 -3
  112. package/dist/platform/ops/agents.ops.d.ts +6 -1
  113. package/dist/platform/ops/agents.ops.js +38 -11
  114. package/dist/platform/ops/devices.ops.js +25 -20
  115. package/dist/platform/ops/orgs.ops.js +1 -0
  116. package/dist/platform/ops/platform-icons.ops.js +4 -4
  117. package/dist/platform/ops/platform.ops.js +2 -1
  118. package/dist/platform/ops/themes.ops.js +1 -1
  119. package/dist/runtime/plugin-context.service.js +1 -12
  120. package/dist/sandbox/cloud-permission-snapshot.d.ts +2 -2
  121. package/dist/sandbox/cloud-permission-snapshot.js +3 -3
  122. package/dist/sandbox/device-reports.d.ts +50 -0
  123. package/dist/sandbox/device-reports.js +157 -0
  124. package/dist/sandbox/held-operations.d.ts +8 -8
  125. package/dist/sandbox/leases.d.ts +1 -1
  126. package/dist/sandbox/leases.js +1 -1
  127. package/dist/sandbox/operation-authority.d.ts +5 -2
  128. package/dist/sandbox/operation-authority.js +12 -11
  129. package/dist/sandbox/operation-reconcile.job.d.ts +2 -2
  130. package/dist/sandbox/operation-reconcile.job.js +5 -5
  131. package/dist/sandbox/permission-availability.d.ts +2 -2
  132. package/dist/sandbox/permission-call-types.d.ts +5 -0
  133. package/dist/sandbox/permission-facts.d.ts +2 -2
  134. package/dist/sandbox/permission-facts.js +5 -5
  135. package/dist/sandbox/providers.d.ts +23 -24
  136. package/dist/sandbox/providers.js +38 -46
  137. package/dist/sandbox/providers.module.js +3 -3
  138. package/dist/sandbox/review/classifier.d.ts +6 -0
  139. package/dist/sandbox/review/classifier.js +12 -1
  140. package/dist/sandbox/review/index.d.ts +1 -1
  141. package/dist/sandbox/review/index.js +1 -1
  142. package/dist/sandbox/sandbox.module.d.ts +1 -1
  143. package/dist/sandbox/sandbox.module.js +7 -2
  144. package/dist/sandbox/sandbox.service.d.ts +95 -68
  145. package/dist/sandbox/sandbox.service.js +212 -208
  146. package/dist/setup/setup-guides.service.d.ts +4 -1
  147. package/dist/setup/setup-guides.service.js +6 -1
  148. package/dist/themes/avatar-preset-key.d.ts +6 -0
  149. package/dist/themes/avatar-preset-key.js +9 -0
  150. package/dist/themes/platform-icon.service.js +1 -1
  151. package/dist/themes/theme-delivery.service.d.ts +10 -2
  152. package/dist/themes/theme-delivery.service.js +26 -11
  153. package/dist/themes/theme-state.d.ts +43 -2
  154. package/dist/themes/theme-state.js +61 -4
  155. package/dist/themes/themes-public.controller.d.ts +3 -3
  156. package/dist/themes/themes-public.controller.js +3 -3
  157. package/dist/themes/themes.service.d.ts +28 -1
  158. package/dist/themes/themes.service.js +36 -2
  159. package/dist/tools/builtins/image/generate.d.ts +3 -0
  160. package/dist/tools/builtins/image/generate.js +21 -11
  161. package/dist/tools/builtins/image/index.d.ts +1 -1
  162. package/dist/tools/builtins/image/index.js +1 -1
  163. package/dist/tools/builtins/platform.js +25 -17
  164. package/dist/tools/builtins/sandbox/common.d.ts +37 -13
  165. package/dist/tools/builtins/sandbox/common.js +63 -19
  166. package/dist/tools/builtins/sandbox/read.d.ts +5 -2
  167. package/dist/tools/builtins/sandbox/read.js +9 -6
  168. package/dist/tools/builtins/sandbox/task-output.d.ts +2 -2
  169. package/dist/tools/builtins/sandbox/task-output.js +6 -5
  170. package/dist/tools/builtins/skill-load.js +13 -4
  171. package/dist/tools/connectors.service.js +2 -1
  172. package/dist/tools/oauth/discovery.d.ts +2 -0
  173. package/dist/tools/oauth/discovery.js +3 -1
  174. package/dist/until-aborted.d.ts +5 -0
  175. package/dist/until-aborted.js +16 -0
  176. package/package.json +4 -4
  177. package/src/migrations/0176_device_report.sql +6 -0
@@ -17,20 +17,21 @@ import { AgentDefinitionSchema } from "../../agents/definition.js";
17
17
  import { AgentsFromTemplate } from "../../agents/from-template.service.js";
18
18
  import { OrgAgentTemplates } from "../../agents/org-templates.js";
19
19
  import { PendingConnectorsService } from "../../agents/pending-connectors.service.js";
20
- import { PresetAvatarSchema } from "../../agents/profile.js";
20
+ import { isBuiltinPresetId, PresetAvatarSchema } from "../../agents/profile.js";
21
21
  import { ReadinessService } from "../../agents/readiness.service.js";
22
22
  import { CatalogRequestsService } from "../../catalog/requests.service.js";
23
23
  import { AGENT_AVATAR_CONTENT_TYPES, AGENT_AVATAR_MAX_BYTES, AttachmentsService, } from "../../conversations/attachments.service.js";
24
24
  import { KernelDb } from "../../infra/database/kernel-db.js";
25
25
  import { roleAtLeast } from "../../orgs/roles.js";
26
26
  import { rootConversationOf } from "../../runtime/subagents/child.js";
27
+ import { ThemesService } from "../../themes/themes.service.js";
27
28
  import { ConnectorsService } from "../../tools/connectors.service.js";
28
29
  import { FileRefSchema } from "../file-ref.js";
29
30
  import { defineOperation, } from "../operation.js";
30
31
  import { PlatformOperations } from "../registry.js";
31
32
  import { precheckBy, viaAgent } from "./errors.js";
32
33
  import { roleOf } from "./role.js";
33
- import { named, orElse } from "./summary.js";
34
+ import { localized, named, orElse } from "./summary.js";
34
35
  const AgentId = AgentPathParams.shape.agentId.max(100);
35
36
  /** The request's definition (create form): the operations tighten its fields, never redeclare them. */
36
37
  const Def = AgentCreateDefinition.shape;
@@ -74,8 +75,11 @@ const PresetAvatar = PresetAvatarSchema;
74
75
  * route's `upload` kind, the kernel stores the file as an avatar upload and saves that.
75
76
  */
76
77
  const FileAvatar = z.object({ kind: z.literal("file"), file: FileRefSchema }).strict();
77
- /** One change of `agents.update-profile` as the card says it. */
78
- function profileChanges(i, fileName) {
78
+ /**
79
+ * One change of `agents.update-profile` as the card says it. `presetName`: a theme preset's name
80
+ * (the card names it rather than its key); a built-in or unknown preset shows its id.
81
+ */
82
+ function profileChanges(i, fileName, presetName) {
79
83
  const zh = [];
80
84
  const en = [];
81
85
  if (i.avatar === null) {
@@ -89,8 +93,8 @@ function profileChanges(i, fileName) {
89
93
  en.push(`set the avatar to the image "${n}"`);
90
94
  }
91
95
  else if (i.avatar !== undefined) {
92
- zh.push(`头像设为预设「${i.avatar.id}」`);
93
- en.push(`set the avatar to preset "${i.avatar.id}"`);
96
+ zh.push(`头像设为预设「${presetName?.zh ?? i.avatar.id}」`);
97
+ en.push(`set the avatar to preset "${presetName?.en ?? i.avatar.id}"`);
94
98
  }
95
99
  if (i.quickActions !== undefined && i.quickActions.length === 0) {
96
100
  zh.push("清空快捷操作");
@@ -129,7 +133,10 @@ let AgentsOperations = class AgentsOperations {
129
133
  readiness;
130
134
  kdb;
131
135
  attachments;
132
- constructor(registry, agents, profiles, fromTemplate, orgTemplates, pending, requests, connectors, readiness, kdb, attachments) {
136
+ themes;
137
+ constructor(registry, agents, profiles, fromTemplate, orgTemplates, pending, requests, connectors, readiness, kdb, attachments,
138
+ /** The org's theme avatar presets: the card names a theme preset by its name. */
139
+ themes) {
133
140
  this.registry = registry;
134
141
  this.agents = agents;
135
142
  this.profiles = profiles;
@@ -141,6 +148,7 @@ let AgentsOperations = class AgentsOperations {
141
148
  this.readiness = readiness;
142
149
  this.kdb = kdb;
143
150
  this.attachments = attachments;
151
+ this.themes = themes;
144
152
  }
145
153
  /**
146
154
  * The edit rule the service enforces, read before the card: the agent is visible, and the actor
@@ -351,7 +359,7 @@ let AgentsOperations = class AgentsOperations {
351
359
  }),
352
360
  defineOperation({
353
361
  id: "agents.update-profile",
354
- description: 'Change how an agent you may edit looks to people: its avatar (one of the preset animals; an image of this conversation as { kind: "file", file: { fileId } }, e.g. a generated image, an attachment or a delivered file, PNG, JPEG or WebP up to 2 MiB, which the person sees on the card; or null for none) and its quick actions (the prompts offered when a conversation starts; the list you send replaces the current one, [] clears it). Send at least one of the two. The current profile is in agents.get. The description is part of the definition: change it with agents.update. A change to your own private agent may be remembered by the person (never one that takes an image); a change to a shared agent is confirmed every time.',
362
+ description: 'Change how an agent you may edit looks to people: its avatar (a preset: one of the built-in animals by id, or a theme preset by the key that themes.list returns under avatars.presets[].key, offered only while that theme is the default theme of the org; an image of this conversation as { kind: "file", file: { fileId } }, e.g. a generated image, an attachment or a delivered file, PNG, JPEG or WebP up to 2 MiB, which the person sees on the card; or null for none) and its quick actions (the prompts offered when a conversation starts; the list you send replaces the current one, [] clears it). Send at least one of the two. The current profile is in agents.get. The description is part of the definition: change it with agents.update. A change to your own private agent may be remembered by the person (never one that takes an image); a change to a shared agent is confirmed every time.',
355
363
  input: z
356
364
  .object({
357
365
  agentId: AgentId,
@@ -399,6 +407,10 @@ let AgentsOperations = class AgentsOperations {
399
407
  code: "agent.profile_conflict",
400
408
  next: "Someone changed the profile while you were waiting: read it again with agents.get, then call again.",
401
409
  },
410
+ {
411
+ code: "agent.avatar_unavailable",
412
+ next: "Choose one of the presets the picker shows: a built-in animal id, or a key from themes.list avatars.presets[].key of the org's current default theme.",
413
+ },
402
414
  {
403
415
  code: "attachment.too_many_pending",
404
416
  next: "Too many avatar images are stored and not used yet; wait a day for them to expire, or save one of them.",
@@ -410,7 +422,11 @@ let AgentsOperations = class AgentsOperations {
410
422
  ],
411
423
  precheck: async (i, ctx) => {
412
424
  const { agent: _a, ...check } = await this.editCheck(i.agentId, ctx);
413
- return check;
425
+ if (!check.ok || i.avatar?.kind !== "preset")
426
+ return check;
427
+ // a theme preset key the org's default theme does not offer: refused before the card
428
+ const avatar = i.avatar;
429
+ return precheckBy(() => this.agents.resolveAvatarInput(ctx.orgId, avatar));
414
430
  },
415
431
  fileRef: (i) => i.avatar?.kind === "file"
416
432
  ? {
@@ -424,7 +440,17 @@ let AgentsOperations = class AgentsOperations {
424
440
  summary: async (i, ctx) => {
425
441
  const a = await orElse(() => this.agents.get(ctx.orgId, i.agentId, ctx.actorAccountId), null);
426
442
  const n = named(a?.definition.name ?? i.agentId);
427
- const c = profileChanges(i, ctx.file?.name);
443
+ let presetName;
444
+ if (i.avatar?.kind === "preset" && !isBuiltinPresetId(i.avatar.id)) {
445
+ const key = i.avatar.id;
446
+ // a summary never fails on a name: a read failure shows the key
447
+ const offered = await orElse(() => this.themes.avatarPresets(ctx.orgId), null);
448
+ const p = offered?.presets.find((x) => x.key === key);
449
+ // the name in both languages (a missing zh already reads as en), else the key
450
+ if (p !== undefined)
451
+ presetName = localized(p.name, key);
452
+ }
453
+ const c = profileChanges(i, ctx.file?.name, presetName);
428
454
  return a?.visibility === "private"
429
455
  ? {
430
456
  zh: `修改私有智能体「${n}」的资料:${c.zh.join(";")}`,
@@ -776,6 +802,7 @@ AgentsOperations = __decorate([
776
802
  __param(7, Inject(ConnectorsService)),
777
803
  __param(8, Inject(ReadinessService)),
778
804
  __param(9, Inject(KernelDb)),
779
- __param(10, Inject(AttachmentsService))
805
+ __param(10, Inject(AttachmentsService)),
806
+ __param(11, Inject(ThemesService))
780
807
  ], AgentsOperations);
781
808
  export { AgentsOperations };
@@ -11,7 +11,7 @@ import { Inject, Injectable } from "@nestjs/common";
11
11
  import { z } from "zod";
12
12
  import { DeviceProjectsService } from "../../devices/device-projects.service.js";
13
13
  import { DevicesService } from "../../devices/devices.service.js";
14
- import { DeviceNameBody, DeviceNetworkBody, DeviceParams, DeviceProjectAddBody, DeviceProjectParams, } from "../../devices/dto.js";
14
+ import { DeviceCreateBody, DeviceNameBody, DeviceNetworkBody, DeviceParams, DeviceProjectAddBody, DeviceProjectParams, } from "../../devices/dto.js";
15
15
  import { deviceLabel } from "../../devices/label.js";
16
16
  import { KernelDb } from "../../infra/database/kernel-db.js";
17
17
  import { rootConversationOf } from "../../runtime/subagents/child.js";
@@ -20,19 +20,15 @@ import { PlatformOperations } from "../registry.js";
20
20
  import { precheckBy, viaAgent } from "./errors.js";
21
21
  import { named, orElse } from "./summary.js";
22
22
  const DeviceId = z.object({ deviceId: DeviceParams.shape.id }).strict();
23
- const Name = z.object({ name: DeviceNameBody.shape.name }).strict();
24
- /**
25
- * Model-facing names are English: the default is "Personal", a default demoted by a provider
26
- * switch "Personal (Docker sandbox)" (the web shows 「个人设备」 / 「个人设备(Docker 沙箱)」).
27
- */
23
+ /** Model-facing names are English: the default is "Personal" (the web shows its localized label). */
28
24
  const labelOf = (e) => deviceLabel(e, "en");
29
25
  /** A row's state: why it cannot be used now, else whether its instance runs. */
30
26
  function stateOf(e) {
31
27
  if (!e.available) {
32
28
  return {
33
29
  state: "unavailable",
34
- reason: "Its sandbox provider is no longer the deployment's current one.",
35
- next: "Ask an org admin; use another device meanwhile.",
30
+ reason: "Its device provider is off in this org or not installed; its files are kept until it is back.",
31
+ next: "Ask an org admin to switch its provider back on; use another device meanwhile.",
36
32
  };
37
33
  }
38
34
  if (e.filesLost && e.source === "local") {
@@ -123,7 +119,7 @@ let DevicesOperations = class DevicesOperations {
123
119
  this.registry.register([
124
120
  defineOperation({
125
121
  id: "devices.list",
126
- description: "List your own devices in this org: one compact row each (name, state, whether it is the default, source: cloud or local, provider, whether a local one is online and its machine, last use), plus the default and last used ids and whether new cloud devices can be made. The default device is shown as Personal; a former default left behind by a sandbox provider switch is shown as Personal (<provider>) and becomes the default again when that provider is back.",
122
+ description: "List your own devices in this org: one compact row each (name, state, whether it is the default, source: cloud or local, provider, whether a local one is online and its machine, last use), plus the default and last used ids, the device providers on in this org (a new device may name one) and the default provider (null: a new device must name one). The default device is shown as Personal. A device stays on the provider it was created on; while that provider is off it is unavailable.",
127
123
  input: z.object({}).strict(),
128
124
  example: {},
129
125
  authz: { orgAction: "agents.use" },
@@ -135,7 +131,8 @@ let DevicesOperations = class DevicesOperations {
135
131
  items: l.items.map(row),
136
132
  defaultId: l.defaultId,
137
133
  lastUsedId: l.lastUsedId,
138
- cloudAvailable: l.cloudAvailable,
134
+ providers: l.providers,
135
+ defaultProvider: l.defaultProvider,
139
136
  };
140
137
  },
141
138
  }),
@@ -166,8 +163,8 @@ let DevicesOperations = class DevicesOperations {
166
163
  }),
167
164
  defineOperation({
168
165
  id: "devices.create",
169
- description: "Create a personal cloud device with a name (1-64 characters, unique among yours, case-insensitive). It is ready at once; its instance and files are made on first use. It needs a sandbox provider and is limited per person.",
170
- input: Name,
166
+ description: "Create a personal cloud device with a name (1-64 characters, unique among yours, case-insensitive) on a device provider: provider is one of the providers devices.list returns; omit it for the org's default provider. The device stays on that provider for life. It is ready at once; its instance and files are made on first use. Devices are limited per person.",
167
+ input: DeviceCreateBody,
171
168
  example: { name: "Data analysis" },
172
169
  authz: { orgAction: "agents.use" },
173
170
  mirrors: ["POST /api/v1/orgs/:orgId/devices"],
@@ -186,21 +183,25 @@ let DevicesOperations = class DevicesOperations {
186
183
  next: "This conversation works in it: ask the person to wipe it on the web, or wipe a different one.",
187
184
  },
188
185
  {
189
- code: "device.unavailable",
186
+ code: "device.provider_required",
190
187
  next: {
191
- superAdmin: "No sandbox provider is current: set one up in the admin console under extensions, then call again.",
192
- orgAdmin: "No sandbox provider is set up; ask the super admin.",
193
- member: "No sandbox provider is set up in this deployment; ask an org admin.",
188
+ superAdmin: "Call again naming one of the providers in the message as provider, or set a default device provider in the admin console; with none on, install and switch one on under extensions.",
189
+ orgAdmin: "Call again naming one of the providers in the message as provider, or choose the org's default device provider in the org settings.",
190
+ member: "Call again naming one of the providers in the message as provider; with none listed, ask an org admin to switch one on.",
194
191
  },
195
192
  },
193
+ {
194
+ code: "validation_failed",
195
+ next: "Name a provider devices.list returns under providers, or omit provider for the default one.",
196
+ },
196
197
  ],
197
- precheck: (i, ctx) => precheckBy(() => this.devices.checkCreate(ctx.orgId, ctx.actorAccountId, i.name)),
198
+ precheck: (i, ctx) => precheckBy(() => this.devices.checkCreate(ctx.orgId, ctx.actorAccountId, i.name, i.provider)),
198
199
  summary: (i) => ({
199
- zh: `新建个人云端设备「${named(i.name)}」`,
200
- en: `Create personal cloud device "${named(i.name)}"`,
200
+ zh: `新建个人云端设备「${named(i.name)}」${i.provider === undefined ? "" : `(${i.provider})`}`,
201
+ en: `Create personal cloud device "${named(i.name)}"${i.provider === undefined ? "" : ` on ${i.provider}`}`,
201
202
  }),
202
203
  run: async (input, ctx) => {
203
- const e = await this.devices.create(ctx.orgId, ctx.actorAccountId, { name: input.name }, undefined, viaAgent("devices.create", ctx));
204
+ const e = await this.devices.create(ctx.orgId, ctx.actorAccountId, { name: input.name, ...(input.provider !== undefined && { provider: input.provider }) }, undefined, viaAgent("devices.create", ctx));
204
205
  return { device: row(e) };
205
206
  },
206
207
  }),
@@ -462,6 +463,10 @@ let DevicesOperations = class DevicesOperations {
462
463
  code: "device.project_path_unreadable",
463
464
  next: "Pass a directory the device can read (not a file).",
464
465
  },
466
+ {
467
+ code: "device.project_refused",
468
+ next: "The device's provider refused this directory (its reason is in the message): pick another directory.",
469
+ },
465
470
  {
466
471
  code: "device.projects_unsupported",
467
472
  next: "This device offers no projects: work without one, or ask the person to update capybara-device.",
@@ -271,6 +271,7 @@ let OrgsOperations = class OrgsOperations {
271
271
  "clientExtensions",
272
272
  "devicesOutsideSandbox",
273
273
  "devicesNetwork",
274
+ "devicesDefaultProvider",
274
275
  "attribution",
275
276
  "compaction",
276
277
  "externalSharing",
@@ -38,7 +38,7 @@ let PlatformIconsOperations = class PlatformIconsOperations {
38
38
  this.registry.register([
39
39
  defineOperation({
40
40
  id: "admin.icons",
41
- description: "List the platform icons the super admin uploaded: the app icon (app), its maskable variant (maskable) and the SVG favicon (favicon), each with its public URL, SHA-256 and when it was set. The installed web app, the browser tab and the native clients use them; a purpose not listed uses the built-in Capybara icon.",
41
+ description: "List the platform icons the super admin uploaded: the app icon (app), its maskable variant (maskable) and the SVG favicon (favicon), each with its public URL, SHA-256 and when it was set. The installed web app, the browser tab and the native clients use them; a purpose not listed uses the built-in icon.",
42
42
  input: z.object({}).strict(),
43
43
  example: {},
44
44
  authz: { superAdmin: true },
@@ -88,7 +88,7 @@ let PlatformIconsOperations = class PlatformIconsOperations {
88
88
  }),
89
89
  defineOperation({
90
90
  id: "admin.clear-icon",
91
- description: "Restore the built-in Capybara icon for one platform icon purpose (super admin): app, maskable or favicon. The uploaded file is deleted. The platform audit log records it.",
91
+ description: "Restore the built-in icon for one platform icon purpose (super admin): app, maskable or favicon. The uploaded file is deleted. The platform audit log records it.",
92
92
  input: ClearIconInput,
93
93
  example: { purpose: "maskable" },
94
94
  authz: { superAdmin: true },
@@ -97,8 +97,8 @@ let PlatformIconsOperations = class PlatformIconsOperations {
97
97
  summary: async (i) => {
98
98
  const n = NAMES[i.purpose];
99
99
  return {
100
- zh: `把平台的${n.zh}恢复为内置的 Capybara 图标`,
101
- en: `Restore the built-in Capybara ${n.en} for the platform`,
100
+ zh: `把平台的${n.zh}恢复为内置图标`,
101
+ en: `Restore the built-in ${n.en} for the platform`,
102
102
  };
103
103
  },
104
104
  run: async (i, ctx) => {
@@ -10,6 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { Inject, Injectable } from "@nestjs/common";
11
11
  import { z } from "zod";
12
12
  import { AgentsService } from "../../agents/agents.service.js";
13
+ import { productName } from "../../config/product-name.js";
13
14
  import { conversationSourceOf } from "../../conversations/source.js";
14
15
  import { AccountsService } from "../../identity/accounts.js";
15
16
  import { PreferencesSchema } from "../../identity/me.schemas.js";
@@ -134,7 +135,7 @@ let PlatformOperationsProvider = class PlatformOperationsProvider {
134
135
  });
135
136
  const role = facts.role;
136
137
  return {
137
- platform: "Capybara is an enterprise agent platform: orgs of people build and use agents that work with skills, tools and connectors. Everything it can do is offered by extensions and plugins.",
138
+ platform: `${productName(this.config.get())} is an enterprise agent platform: orgs of people build and use agents that work with skills, tools and connectors. Everything it can do is offered by extensions and plugins.`,
138
139
  toolFamilies: FAMILIES,
139
140
  you: {
140
141
  role,
@@ -28,7 +28,7 @@ let ThemesOperations = class ThemesOperations {
28
28
  this.registry.register([
29
29
  defineOperation({
30
30
  id: "themes.list",
31
- description: "List the themes on in this org (id, version, name, schemes, logo and the bg / panel / ink / accent swatches per scheme), the theme in effect for you here (resolved; null is the built-in theme) and the org's setting (its default theme id, null following the platform, and whether personal picks are allowed or locked). Use a theme id with platform.set-preferences to change your own theme, or with org-settings.update to change the org's default.",
31
+ description: "List the themes on in this org (id, version, name, schemes, logo, decoration (the sign-in page background pattern: dither or none), background (the page background color per scheme) and the bg / panel / ink / accent swatches per scheme), the theme in effect for you here (resolved; null is the built-in theme) and the org's setting (its default theme id, null following the platform, and whether personal picks are allowed or locked), and avatars: the agent avatar presets of the org's default theme (hidden: the built-in preset ids it does not offer; presets: its own presets, each with a key, a name and a url). Use a preset key as the avatar id with agents.update-profile. Use a theme id with platform.set-preferences to change your own theme, or with org-settings.update to change the org's default.",
32
32
  input: z.object({}).strict(),
33
33
  example: {},
34
34
  authz: { orgAction: "org.read" },
@@ -17,6 +17,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
17
17
  import { TransactionHost } from "../infra/database/transaction-host.js";
18
18
  import { Transactional } from "../infra/database/transactional.decorator.js";
19
19
  import { KERNEL_LOGGER } from "../infra/tokens.js";
20
+ import { untilAborted } from "../until-aborted.js";
20
21
  import { latestPluginContexts, pluginContextIdemKey } from "./context/plugin-context.js";
21
22
  import { runEndedIn } from "./run-status.js";
22
23
  const sha256 = (text) => createHash("sha256").update(text).digest("hex");
@@ -206,15 +207,3 @@ PluginContextService = __decorate([
206
207
  __param(5, Inject(KERNEL_LOGGER))
207
208
  ], PluginContextService);
208
209
  export { PluginContextService };
209
- /** `p`, or a rejection once `signal` aborts (a provider that ignores its signal never holds a run). */
210
- function untilAborted(p, signal) {
211
- return new Promise((resolve, reject) => {
212
- const onAbort = () => reject(signal.reason);
213
- if (signal.aborted) {
214
- onAbort();
215
- return;
216
- }
217
- signal.addEventListener("abort", onAbort, { once: true });
218
- p.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
219
- });
220
- }
@@ -8,7 +8,7 @@ import { PermissionAuthorityLock } from "./permission-authority-lock.js";
8
8
  import { PermissionCeilingWrites } from "./permission-ceiling-writes.js";
9
9
  import { PermissionConfigPublication } from "./permission-config-publication.js";
10
10
  import { PermissionFacts } from "./permission-facts.js";
11
- import { SandboxProviders } from "./providers.js";
11
+ import { DeviceProviders } from "./providers.js";
12
12
  /**
13
13
  * What a snapshot or reconciliation found: `unprobed` (no instance or file system yet: the next
14
14
  * create applies the desired limits exactly), `bound` (the recorded applied limits are exactly
@@ -91,7 +91,7 @@ export declare class CloudPermissionSnapshots {
91
91
  private readonly providers;
92
92
  constructor(db: KernelDb, txHost: TransactionHost, leases: SandboxLeases, locks: PermissionAuthorityLock, config: Pick<KernelConfigService, "get" | "fieldSource">, facts: PermissionFacts, publication: Pick<PermissionConfigPublication, "assertCurrent">, ceilings: Pick<PermissionCeilingWrites, "publishLocked">, retirement: Pick<LegacyRetirementStore, "assertCutoverBarrier">,
93
93
  /** Whether a device's provider fixes limits at its file system (B-12 intersection). */
94
- providers: Pick<SandboxProviders, "cloud" | "forName">);
94
+ providers: Pick<DeviceProviders, "forDevice">);
95
95
  /**
96
96
  * The production driver (B-10, `capybara permissions cutover snapshot`): snapshots every live
97
97
  * cloud device that has none yet, one device at a time, each under its exclusive lifecycle
@@ -23,7 +23,7 @@ import { PermissionAuthorityLock } from "./permission-authority-lock.js";
23
23
  import { needsFullCeiling, PermissionCeilingWrites } from "./permission-ceiling-writes.js";
24
24
  import { PermissionConfigPublication } from "./permission-config-publication.js";
25
25
  import { PermissionFacts } from "./permission-facts.js";
26
- import { providerForDevice, SandboxProviders } from "./providers.js";
26
+ import { DeviceProviders } from "./providers.js";
27
27
  /** How long the writer waits for the device's exclusive lifecycle lease (running commands). */
28
28
  const LEASE_WAIT_MS = 120_000;
29
29
  /** Devices the driver reads per page. */
@@ -295,7 +295,7 @@ let CloudPermissionSnapshots = class CloudPermissionSnapshots {
295
295
  // the desired limits)
296
296
  const inForce = (instance.handle !== null &&
297
297
  (instance.status === "running" || instance.status === "suspended")) ||
298
- providerForDevice(this.providers, device.provider)?.impl.limitsApplyAt === "fileSystem";
298
+ this.providers.forDevice(device.provider)?.impl.limitsApplyAt === "fileSystem";
299
299
  if (inForce && rec.applied !== null && device.owner_full_access !== null) {
300
300
  const outer = device.outer_network ?? { kind: "open-public", hosts: [] };
301
301
  const narrowed = cloudSnapshotOf({ mode: device.owner_full_access ? "auto" : "sandbox", network: outer }, rec.applied);
@@ -409,7 +409,7 @@ CloudPermissionSnapshots = __decorate([
409
409
  __param(6, Inject(PermissionConfigPublication)),
410
410
  __param(7, Inject(PermissionCeilingWrites)),
411
411
  __param(8, Inject(LegacyRetirementStore)),
412
- __param(9, Inject(SandboxProviders))
412
+ __param(9, Inject(DeviceProviders))
413
413
  ], CloudPermissionSnapshots);
414
414
  export { CloudPermissionSnapshots };
415
415
  /**
@@ -0,0 +1,50 @@
1
+ import { type DeviceRef, type DeviceReport } from "@capybara-hq/plugin-sdk";
2
+ import { KernelDb } from "../infra/database/kernel-db.js";
3
+ import { TransactionHost } from "../infra/database/transaction-host.js";
4
+ import { LockService } from "../infra/lock/lock.service.js";
5
+ import type { KernelLogger } from "../log.js";
6
+ import type { DeviceProviderEntry } from "./providers.js";
7
+ /** How long a provider's `report` may take before the refresh gives up (keeps the stored one). */
8
+ export declare const DEVICE_REPORT_TIMEOUT_MS = 10000;
9
+ /** Overrides {@link DEVICE_REPORT_TIMEOUT_MS} (ms; tests only). */
10
+ export declare const DEVICE_REPORT_TIMEOUT: unique symbol;
11
+ /**
12
+ * The stored device report (`devices.report`, `report_at`; device-provider spec §6.1): what a
13
+ * device's provider last told about it (`device-provider@1` `report()`), shown to people and never
14
+ * used for enforcement. {@link refresh} asks the provider and stores the answer; request paths
15
+ * {@link read} the stored copy from PG and never call the provider.
16
+ */
17
+ export declare class DeviceReports {
18
+ private readonly db;
19
+ readonly txHost: TransactionHost;
20
+ private readonly locks;
21
+ private readonly log;
22
+ private readonly timeoutMs;
23
+ constructor(db: KernelDb, txHost: TransactionHost, locks: Pick<LockService, "lease">, log: Pick<KernelLogger, "warn">, timeoutMs?: number);
24
+ /**
25
+ * Asks `entry` for the report of `ref`'s device (given up after {@link DEVICE_REPORT_TIMEOUT_MS}
26
+ * or on `signal`, even when the provider ignores its signal), checks it ({@link parseDeviceReport}) and stores it with `report_at`, only
27
+ * while the device is live and still bound to `entry` (`devices.provider = entry.plugin`).
28
+ * `changed`: the stored revision differs from the one before (true for a first report). Never
29
+ * throws: a failing or invalid answer leaves the stored report as it was and is logged at most
30
+ * once per device per hour; an abort of `signal` is not logged. Call it outside any transaction
31
+ * (the provider call must not hold one open).
32
+ */
33
+ refresh(entry: DeviceProviderEntry, ref: DeviceRef, signal: AbortSignal): Promise<{
34
+ changed: boolean;
35
+ }>;
36
+ /**
37
+ * The stored report of a live device of `orgId`, checked again ({@link parseDeviceReport});
38
+ * null when none is stored, the stored one no longer passes, or there is no such device.
39
+ * Reads PG only.
40
+ */
41
+ read(orgId: string, deviceId: string): Promise<DeviceReport | null>;
42
+ /**
43
+ * Writes `report` on the device if it is live and bound to `plugin`; whether its revision
44
+ * differs from the stored one. The row is locked first, so two refreshes of one device compare
45
+ * against each other's writes, never against the same old value.
46
+ */
47
+ private store;
48
+ /** Logs a refresh failure, at most once per device per hour (a Redis key with a TTL). */
49
+ private noteFailure;
50
+ }
@@ -0,0 +1,157 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ };
10
+ import { parseDeviceReport } from "@capybara-hq/plugin-sdk";
11
+ import { Inject, Injectable, Optional } from "@nestjs/common";
12
+ import { sql } from "kysely";
13
+ import { KernelDb } from "../infra/database/kernel-db.js";
14
+ import { TransactionHost } from "../infra/database/transaction-host.js";
15
+ import { Transactional } from "../infra/database/transactional.decorator.js";
16
+ import { LockService } from "../infra/lock/lock.service.js";
17
+ import { KERNEL_LOGGER } from "../infra/tokens.js";
18
+ import { untilAborted } from "../until-aborted.js";
19
+ /** How long a provider's `report` may take before the refresh gives up (keeps the stored one). */
20
+ export const DEVICE_REPORT_TIMEOUT_MS = 10_000;
21
+ /** Overrides {@link DEVICE_REPORT_TIMEOUT_MS} (ms; tests only). */
22
+ export const DEVICE_REPORT_TIMEOUT = Symbol("DEVICE_REPORT_TIMEOUT");
23
+ /** A device's report failures are logged at most once per this window. */
24
+ const FAILURE_LOG_WINDOW_MS = 60 * 60_000;
25
+ const failureLogKey = (deviceId) => `capk:device-report-failure:${deviceId}`;
26
+ /** The revision of a stored report, or null when none (or not a readable one) is stored. */
27
+ function storedRevision(stored) {
28
+ if (typeof stored !== "object" || stored === null)
29
+ return null;
30
+ const revision = stored.revision;
31
+ return typeof revision === "string" ? revision : null;
32
+ }
33
+ /**
34
+ * The stored device report (`devices.report`, `report_at`; device-provider spec §6.1): what a
35
+ * device's provider last told about it (`device-provider@1` `report()`), shown to people and never
36
+ * used for enforcement. {@link refresh} asks the provider and stores the answer; request paths
37
+ * {@link read} the stored copy from PG and never call the provider.
38
+ */
39
+ let DeviceReports = class DeviceReports {
40
+ db;
41
+ txHost;
42
+ locks;
43
+ log;
44
+ timeoutMs;
45
+ constructor(db, txHost, locks, log, timeoutMs = DEVICE_REPORT_TIMEOUT_MS) {
46
+ this.db = db;
47
+ this.txHost = txHost;
48
+ this.locks = locks;
49
+ this.log = log;
50
+ this.timeoutMs = timeoutMs;
51
+ }
52
+ /**
53
+ * Asks `entry` for the report of `ref`'s device (given up after {@link DEVICE_REPORT_TIMEOUT_MS}
54
+ * or on `signal`, even when the provider ignores its signal), checks it ({@link parseDeviceReport}) and stores it with `report_at`, only
55
+ * while the device is live and still bound to `entry` (`devices.provider = entry.plugin`).
56
+ * `changed`: the stored revision differs from the one before (true for a first report). Never
57
+ * throws: a failing or invalid answer leaves the stored report as it was and is logged at most
58
+ * once per device per hour; an abort of `signal` is not logged. Call it outside any transaction
59
+ * (the provider call must not hold one open).
60
+ */
61
+ async refresh(entry, ref, signal) {
62
+ let report;
63
+ try {
64
+ const bounded = AbortSignal.any([signal, AbortSignal.timeout(this.timeoutMs)]);
65
+ // raced, not only signalled: a provider that ignores the signal never holds the lease past it
66
+ report = parseDeviceReport(await untilAborted(entry.impl.report(ref, bounded), bounded));
67
+ }
68
+ catch (err) {
69
+ if (!signal.aborted)
70
+ await this.noteFailure(entry, ref.deviceId, err);
71
+ return { changed: false };
72
+ }
73
+ try {
74
+ return { changed: await this.store(entry.plugin, ref, report) };
75
+ }
76
+ catch (err) {
77
+ await this.noteFailure(entry, ref.deviceId, err);
78
+ return { changed: false };
79
+ }
80
+ }
81
+ /**
82
+ * The stored report of a live device of `orgId`, checked again ({@link parseDeviceReport});
83
+ * null when none is stored, the stored one no longer passes, or there is no such device.
84
+ * Reads PG only.
85
+ */
86
+ async read(orgId, deviceId) {
87
+ const row = await this.db
88
+ .selectFrom("devices")
89
+ .select("report")
90
+ .where("id", "=", deviceId)
91
+ .where("org_id", "=", orgId)
92
+ .where("deleted_at", "is", null)
93
+ .executeTakeFirst();
94
+ if (row?.report == null)
95
+ return null;
96
+ try {
97
+ return parseDeviceReport(row.report);
98
+ }
99
+ catch {
100
+ return null;
101
+ }
102
+ }
103
+ /**
104
+ * Writes `report` on the device if it is live and bound to `plugin`; whether its revision
105
+ * differs from the stored one. The row is locked first, so two refreshes of one device compare
106
+ * against each other's writes, never against the same old value.
107
+ */
108
+ async store(plugin, ref, report) {
109
+ const row = await this.db
110
+ .selectFrom("devices")
111
+ .select("report")
112
+ .where("id", "=", ref.deviceId)
113
+ .where("org_id", "=", ref.orgId)
114
+ .where("provider", "=", plugin)
115
+ .where("deleted_at", "is", null)
116
+ .forNoKeyUpdate()
117
+ .executeTakeFirst();
118
+ // deleted, or bound to another provider than the one that answered: nothing is written
119
+ if (!row)
120
+ return false;
121
+ await this.db
122
+ .updateTable("devices")
123
+ .set({ report: JSON.stringify(report), report_at: sql `now()` })
124
+ .where("id", "=", ref.deviceId)
125
+ .execute();
126
+ return storedRevision(row.report) !== report.revision;
127
+ }
128
+ /** Logs a refresh failure, at most once per device per hour (a Redis key with a TTL). */
129
+ async noteFailure(entry, deviceId, err) {
130
+ let first = true;
131
+ try {
132
+ first = await this.locks.lease(failureLogKey(deviceId), "1", FAILURE_LOG_WINDOW_MS);
133
+ }
134
+ catch {
135
+ // Redis unavailable: log anyway rather than hiding it
136
+ }
137
+ if (first)
138
+ this.log.warn("cannot refresh the device report; the stored one is kept", {
139
+ deviceId,
140
+ provider: entry.plugin,
141
+ err,
142
+ });
143
+ }
144
+ };
145
+ __decorate([
146
+ Transactional()
147
+ ], DeviceReports.prototype, "store", null);
148
+ DeviceReports = __decorate([
149
+ Injectable(),
150
+ __param(0, Inject(KernelDb)),
151
+ __param(1, Inject(TransactionHost)),
152
+ __param(2, Inject(LockService)),
153
+ __param(3, Inject(KERNEL_LOGGER)),
154
+ __param(4, Optional()),
155
+ __param(4, Inject(DEVICE_REPORT_TIMEOUT))
156
+ ], DeviceReports);
157
+ export { DeviceReports };
@@ -1,7 +1,7 @@
1
- import { type ExecResult, type SandboxExecOptions, type SandboxExecutionRef, type SandboxHandle, type SandboxOperationScope, type SandboxProvider } from "@capybara-hq/plugin-sdk";
1
+ import { type DeviceProvider, type ExecResult, type SandboxExecOptions, type SandboxExecutionRef, type SandboxHandle, type SandboxOperationScope } from "@capybara-hq/plugin-sdk";
2
2
  /** A callback can use native operations; it cannot obtain a new authority or change lifecycle. */
3
- export type HeldProvider = Pick<SandboxProvider, "readFile" | "writeFile" | "stat" | "list" | "scan"> & {
4
- exec(h: SandboxHandle, args: Omit<Parameters<SandboxProvider["exec"]>[1], "tag" | "actor">): Promise<ExecResult>;
3
+ export type HeldProvider = Pick<DeviceProvider, "readFile" | "writeFile" | "stat" | "list" | "scan"> & {
4
+ exec(h: SandboxHandle, args: Omit<Parameters<DeviceProvider["exec"]>[1], "tag" | "actor">): Promise<ExecResult>;
5
5
  /**
6
6
  * A managed background start (dormant until the paired activation): admitted, persisted and
7
7
  * acknowledged by the service under the same stable operation identity. Present only on the
@@ -27,20 +27,20 @@ export type OperationDispatch = <T>(method: OperationMethod, input: unknown, inv
27
27
  */
28
28
  preflight?: (scope: SandboxOperationScope, signal: AbortSignal) => Promise<void>) => Promise<T>;
29
29
  /** The provider's runtime must enforce the scope's profile (and own background executions). */
30
- export declare function assertPermissionSupport(provider: SandboxProvider, handle: SandboxHandle, scope: SandboxOperationScope, method: OperationMethod, signal: AbortSignal): Promise<void>;
30
+ export declare function assertPermissionSupport(provider: DeviceProvider, handle: SandboxHandle, scope: SandboxOperationScope, method: OperationMethod, signal: AbortSignal): Promise<void>;
31
31
  /**
32
32
  * Every check a managed start needs before it may reach the provider, for the first dispatch and
33
33
  * for a same-identity recovery alike: the artifact is covered by the admitted starting authority,
34
34
  * then the runtime supports the profile and owns background executions.
35
35
  */
36
- export declare function checkManagedStart(provider: SandboxProvider, handle: SandboxHandle, scope: SandboxOperationScope, input: Omit<ManagedStartArgs, "signal">, signal: AbortSignal): Promise<void>;
36
+ export declare function checkManagedStart(provider: DeviceProvider, handle: SandboxHandle, scope: SandboxOperationScope, input: Omit<ManagedStartArgs, "signal">, signal: AbortSignal): Promise<void>;
37
37
  /**
38
38
  * `provider` whose background starts carry `instanceGeneration`, the kernel's generation of the
39
39
  * held instance (its `created_at` milliseconds): a cloud provider cannot know it otherwise (it is
40
40
  * allocated after `create` returns), and the acknowledgement requires the ref to name it. A bound
41
41
  * (local) device knows its generation from its binding and is not given one.
42
42
  */
43
- export declare function withKernelGeneration(provider: SandboxProvider, generation: string): SandboxProvider;
44
- export declare function createHeldOperations(provider: SandboxProvider, handle: SandboxHandle, heldSignal: AbortSignal, dispatch: OperationDispatch): HeldProvider;
43
+ export declare function withKernelGeneration(provider: DeviceProvider, generation: string): DeviceProvider;
44
+ export declare function createHeldOperations(provider: DeviceProvider, handle: SandboxHandle, heldSignal: AbortSignal, dispatch: OperationDispatch): HeldProvider;
45
45
  /** Temporary v2 callback adapter. Removed with the coordinated Task 8 cutover. */
46
- export declare function createLegacyHeldProvider(provider: SandboxProvider, tag: string, actor: Parameters<SandboxProvider["exec"]>[1]["actor"], before: () => Promise<void>): HeldProvider;
46
+ export declare function createLegacyHeldProvider(provider: DeviceProvider, tag: string, actor: Parameters<DeviceProvider["exec"]>[1]["actor"], before: () => Promise<void>): HeldProvider;