@capybara-hq/kernel 0.1.0-rc.41 → 0.1.0-rc.43

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 (359) hide show
  1. package/bootstrap.json +3 -3
  2. package/dist/admin/admin.schemas.d.ts +6 -0
  3. package/dist/admin/org-network.service.d.ts +3 -1
  4. package/dist/admin/org-network.service.js +10 -2
  5. package/dist/app.d.ts +4 -0
  6. package/dist/app.js +2 -0
  7. package/dist/background/finish.d.ts +9 -1
  8. package/dist/background/finish.js +57 -4
  9. package/dist/background/launch.d.ts +23 -0
  10. package/dist/background/launch.js +55 -1
  11. package/dist/background/managed-output.d.ts +110 -0
  12. package/dist/background/managed-output.js +219 -0
  13. package/dist/background/managed.d.ts +52 -0
  14. package/dist/background/managed.js +128 -0
  15. package/dist/background/poll.job.d.ts +35 -1
  16. package/dist/background/poll.job.js +174 -9
  17. package/dist/background/render.js +1 -0
  18. package/dist/background/retire-legacy-tasks.job.d.ts +57 -0
  19. package/dist/background/retire-legacy-tasks.job.js +149 -0
  20. package/dist/background/session.d.ts +15 -5
  21. package/dist/background/session.js +22 -6
  22. package/dist/background/stop.d.ts +35 -5
  23. package/dist/background/stop.js +94 -8
  24. package/dist/background/store.d.ts +110 -3
  25. package/dist/background/store.js +205 -3
  26. package/dist/background/tasks.service.d.ts +18 -1
  27. package/dist/background/tasks.service.js +99 -9
  28. package/dist/catalog/marketplaces.service.d.ts +1 -1
  29. package/dist/channels/cards.js +1 -1
  30. package/dist/channels/inbound.js +2 -0
  31. package/dist/channels/phrases.d.ts +4 -0
  32. package/dist/channels/phrases.js +4 -0
  33. package/dist/config/load.d.ts +18 -0
  34. package/dist/config/load.js +39 -1
  35. package/dist/config/permission-migration.d.ts +26 -0
  36. package/dist/config/permission-migration.js +64 -0
  37. package/dist/config/schema.d.ts +4 -1
  38. package/dist/config/schema.js +41 -10
  39. package/dist/conversations/conversations.controller.d.ts +1 -1
  40. package/dist/conversations/conversations.controller.js +1 -1
  41. package/dist/conversations/conversations.module.js +12 -0
  42. package/dist/conversations/conversations.service.d.ts +11 -2
  43. package/dist/conversations/conversations.service.js +97 -27
  44. package/dist/conversations/event-log.d.ts +1 -1
  45. package/dist/conversations/event-log.js +10 -2
  46. package/dist/conversations/events.d.ts +307 -4
  47. package/dist/conversations/events.js +286 -32
  48. package/dist/conversations/permission-profile-store.d.ts +50 -0
  49. package/dist/conversations/permission-profile-store.js +67 -0
  50. package/dist/conversations/permission-profile-store.module.d.ts +2 -0
  51. package/dist/conversations/permission-profile-store.module.js +19 -0
  52. package/dist/conversations/permission-profiles.controller.d.ts +84 -0
  53. package/dist/conversations/permission-profiles.controller.js +105 -0
  54. package/dist/conversations/permission-profiles.schemas.d.ts +31 -0
  55. package/dist/conversations/permission-profiles.schemas.js +23 -0
  56. package/dist/conversations/permission-profiles.service.d.ts +56 -0
  57. package/dist/conversations/permission-profiles.service.js +179 -0
  58. package/dist/ctx/create-ctx.d.ts +12 -5
  59. package/dist/ctx/create-ctx.js +21 -5
  60. package/dist/db/kernel-schema.d.ts +248 -3
  61. package/dist/devices/access.js +1 -1
  62. package/dist/devices/access.module.d.ts +2 -0
  63. package/dist/devices/access.module.js +19 -0
  64. package/dist/devices/conversation-devices.d.ts +8 -29
  65. package/dist/devices/conversation-devices.js +37 -73
  66. package/dist/devices/device-projects.service.d.ts +26 -28
  67. package/dist/devices/device-projects.service.js +123 -127
  68. package/dist/devices/devices.controller.js +3 -1
  69. package/dist/devices/devices.module.js +11 -9
  70. package/dist/devices/devices.service.d.ts +116 -8
  71. package/dist/devices/devices.service.js +252 -20
  72. package/dist/devices/dto.d.ts +16 -0
  73. package/dist/devices/dto.js +34 -6
  74. package/dist/devices/errors.d.ts +8 -0
  75. package/dist/devices/errors.js +10 -0
  76. package/dist/devices/project-rules.d.ts +44 -0
  77. package/dist/devices/project-rules.js +27 -0
  78. package/dist/devices/working-root.d.ts +6 -0
  79. package/dist/devices/working-root.js +12 -1
  80. package/dist/errors.d.ts +31 -0
  81. package/dist/errors.js +31 -0
  82. package/dist/evals/reconstruct.d.ts +19 -2
  83. package/dist/evals/reconstruct.js +40 -2
  84. package/dist/evals/recorded-permission-context.d.ts +77 -0
  85. package/dist/evals/recorded-permission-context.js +151 -0
  86. package/dist/evals/recorded-tools.d.ts +10 -1
  87. package/dist/evals/recorded-tools.js +27 -3
  88. package/dist/evals/run-replay.d.ts +8 -2
  89. package/dist/evals/run-replay.js +18 -2
  90. package/dist/evals/trajectory.d.ts +1 -1
  91. package/dist/evals/worker.d.ts +10 -1
  92. package/dist/evals/worker.js +23 -14
  93. package/dist/extensions/host.d.ts +4 -1
  94. package/dist/extensions/host.js +10 -6
  95. package/dist/http/api.module.js +2 -0
  96. package/dist/identity/accounts.d.ts +14 -1
  97. package/dist/identity/accounts.js +61 -5
  98. package/dist/identity/identity.module.js +2 -0
  99. package/dist/identity/settings.d.ts +28 -12
  100. package/dist/identity/settings.js +89 -33
  101. package/dist/index.d.ts +6 -0
  102. package/dist/index.js +5 -0
  103. package/dist/infra/cli/kernel-cli.module.d.ts +2 -2
  104. package/dist/infra/cli/kernel-cli.module.js +5 -2
  105. package/dist/infra/cli/permission-cutover.d.ts +59 -0
  106. package/dist/infra/cli/permission-cutover.js +107 -0
  107. package/dist/infra/config/kernel-config.service.d.ts +2 -2
  108. package/dist/infra/config/kernel-config.service.js +35 -11
  109. package/dist/infra/database/startup-activation-transaction.d.ts +36 -0
  110. package/dist/infra/database/startup-activation-transaction.js +242 -0
  111. package/dist/infra/database/transaction-host.d.ts +47 -0
  112. package/dist/infra/database/transaction-host.js +119 -0
  113. package/dist/infra/database/xact-lock.d.ts +1 -0
  114. package/dist/infra/database/xact-lock.js +6 -0
  115. package/dist/infra/outbox/registry.d.ts +39 -0
  116. package/dist/infra/outbox/registry.js +18 -0
  117. package/dist/kernel.module.js +2 -0
  118. package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
  119. package/dist/lifecycle/kernel-lifecycle.js +55 -28
  120. package/dist/local-devices/device-auth.js +1 -1
  121. package/dist/local-devices/device-policy.service.d.ts +35 -5
  122. package/dist/local-devices/device-policy.service.js +188 -13
  123. package/dist/local-devices/instance-bindings.d.ts +82 -0
  124. package/dist/local-devices/instance-bindings.js +304 -0
  125. package/dist/local-devices/keys.d.ts +5 -0
  126. package/dist/local-devices/keys.js +5 -0
  127. package/dist/local-devices/local-device-gateway.d.ts +19 -4
  128. package/dist/local-devices/local-device-gateway.js +185 -17
  129. package/dist/local-devices/local-device-provider.d.ts +42 -7
  130. package/dist/local-devices/local-device-provider.js +185 -10
  131. package/dist/local-devices/local-devices.module.d.ts +17 -2
  132. package/dist/local-devices/local-devices.module.js +49 -8
  133. package/dist/local-devices/machines.d.ts +35 -12
  134. package/dist/local-devices/machines.js +203 -8
  135. package/dist/local-devices/network-grants.js +3 -3
  136. package/dist/local-devices/network-grants.module.d.ts +2 -0
  137. package/dist/local-devices/network-grants.module.js +14 -0
  138. package/dist/local-devices/owner-report.d.ts +79 -0
  139. package/dist/local-devices/owner-report.js +155 -0
  140. package/dist/local-devices/owner-reports.d.ts +48 -0
  141. package/dist/local-devices/owner-reports.js +190 -0
  142. package/dist/local-devices/policy-summary.d.ts +24 -1
  143. package/dist/local-devices/policy-summary.js +48 -0
  144. package/dist/local-devices/relay.d.ts +82 -6
  145. package/dist/local-devices/relay.js +187 -16
  146. package/dist/local-devices/targets.d.ts +16 -1
  147. package/dist/local-devices/targets.js +35 -2
  148. package/dist/models/image-usable.d.ts +22 -0
  149. package/dist/models/image-usable.js +29 -0
  150. package/dist/models/images.d.ts +125 -0
  151. package/dist/models/images.js +440 -0
  152. package/dist/models/models.module.d.ts +3 -2
  153. package/dist/models/models.module.js +16 -5
  154. package/dist/models/org-models.schemas.js +1 -0
  155. package/dist/models/purposes.controller.d.ts +7 -0
  156. package/dist/models/purposes.controller.js +9 -0
  157. package/dist/models/purposes.d.ts +28 -3
  158. package/dist/models/purposes.js +40 -13
  159. package/dist/orgs/cloud-network-setting.d.ts +33 -0
  160. package/dist/orgs/cloud-network-setting.js +47 -0
  161. package/dist/orgs/offboarding.d.ts +3 -1
  162. package/dist/orgs/offboarding.js +8 -2
  163. package/dist/orgs/org-lock.d.ts +10 -4
  164. package/dist/orgs/org-lock.js +10 -4
  165. package/dist/orgs/orgs.service.d.ts +3 -1
  166. package/dist/orgs/orgs.service.js +8 -2
  167. package/dist/orgs/settings.controller.d.ts +4 -1
  168. package/dist/orgs/settings.controller.js +3 -3
  169. package/dist/orgs/settings.service.d.ts +48 -56
  170. package/dist/orgs/settings.service.js +144 -101
  171. package/dist/overrides.d.ts +6 -1
  172. package/dist/overrides.js +2 -0
  173. package/dist/platform/exclusions.js +20 -0
  174. package/dist/platform/ops/admin.ops.js +14 -11
  175. package/dist/platform/ops/agent-skills.ops.js +2 -0
  176. package/dist/platform/ops/devices.ops.js +10 -2
  177. package/dist/platform/ops/models.ops.js +10 -0
  178. package/dist/platform/ops/org-settings.ops.js +6 -6
  179. package/dist/platform/ops/orgs.ops.js +1 -0
  180. package/dist/roles/worker.module.js +4 -0
  181. package/dist/runtime/context/build.d.ts +3 -1
  182. package/dist/runtime/context/build.js +19 -3
  183. package/dist/runtime/context/compaction.js +5 -0
  184. package/dist/runtime/context/device-paths.d.ts +9 -2
  185. package/dist/runtime/context/device-paths.js +20 -0
  186. package/dist/runtime/context/permission-profile.d.ts +46 -0
  187. package/dist/runtime/context/permission-profile.js +194 -0
  188. package/dist/runtime/hook-calls.d.ts +11 -1
  189. package/dist/runtime/hook-calls.js +24 -1
  190. package/dist/runtime/maintenance.d.ts +7 -1
  191. package/dist/runtime/maintenance.js +43 -15
  192. package/dist/runtime/model-call.d.ts +32 -0
  193. package/dist/runtime/model-call.js +67 -0
  194. package/dist/runtime/permission-context-errors.d.ts +39 -0
  195. package/dist/runtime/permission-context-errors.js +67 -0
  196. package/dist/runtime/permission-context.service.d.ts +60 -0
  197. package/dist/runtime/permission-context.service.js +286 -0
  198. package/dist/runtime/project/knowledge.d.ts +7 -2
  199. package/dist/runtime/project/knowledge.js +5 -2
  200. package/dist/runtime/project/knowledge.service.d.ts +17 -2
  201. package/dist/runtime/project/knowledge.service.js +76 -12
  202. package/dist/runtime/providers.d.ts +9 -5
  203. package/dist/runtime/providers.js +22 -3
  204. package/dist/runtime/run-execution.d.ts +4 -1
  205. package/dist/runtime/run-execution.js +14 -5
  206. package/dist/runtime/run-steps.d.ts +11 -3
  207. package/dist/runtime/run-steps.js +27 -4
  208. package/dist/runtime/runtime.module.js +11 -0
  209. package/dist/runtime/usage-report.d.ts +10 -6
  210. package/dist/runtime/usage-report.js +31 -11
  211. package/dist/sandbox/attachments-path.d.ts +15 -0
  212. package/dist/sandbox/attachments-path.js +15 -0
  213. package/dist/sandbox/cloud-permission-snapshot.d.ts +159 -0
  214. package/dist/sandbox/cloud-permission-snapshot.js +407 -0
  215. package/dist/sandbox/cloud-permission-snapshot.module.d.ts +8 -0
  216. package/dist/sandbox/cloud-permission-snapshot.module.js +34 -0
  217. package/dist/sandbox/held-operations.d.ts +39 -0
  218. package/dist/sandbox/held-operations.js +119 -0
  219. package/dist/sandbox/jobs.d.ts +14 -3
  220. package/dist/sandbox/jobs.js +20 -2
  221. package/dist/sandbox/kernel-read.d.ts +55 -0
  222. package/dist/sandbox/kernel-read.js +57 -0
  223. package/dist/sandbox/legacy-retirement.d.ts +336 -0
  224. package/dist/sandbox/legacy-retirement.js +1063 -0
  225. package/dist/sandbox/legacy-retirement.module.d.ts +8 -0
  226. package/dist/sandbox/legacy-retirement.module.js +25 -0
  227. package/dist/sandbox/managed-device-context.d.ts +94 -0
  228. package/dist/sandbox/managed-device-context.js +308 -0
  229. package/dist/sandbox/managed-device-context.module.d.ts +6 -0
  230. package/dist/sandbox/managed-device-context.module.js +33 -0
  231. package/dist/sandbox/modes.d.ts +56 -8
  232. package/dist/sandbox/modes.js +92 -8
  233. package/dist/sandbox/operation-authority-types.d.ts +8 -0
  234. package/dist/sandbox/operation-authority-types.js +32 -0
  235. package/dist/sandbox/operation-authority.d.ts +145 -0
  236. package/dist/sandbox/operation-authority.js +783 -0
  237. package/dist/sandbox/operation-authority.module.d.ts +2 -0
  238. package/dist/sandbox/operation-authority.module.js +29 -0
  239. package/dist/sandbox/operation-intents.d.ts +206 -0
  240. package/dist/sandbox/operation-intents.js +1252 -0
  241. package/dist/sandbox/operation-intents.module.d.ts +2 -0
  242. package/dist/sandbox/operation-intents.module.js +21 -0
  243. package/dist/sandbox/operation-payloads.d.ts +33 -0
  244. package/dist/sandbox/operation-payloads.js +332 -0
  245. package/dist/sandbox/operation-reconcile.job.d.ts +49 -0
  246. package/dist/sandbox/operation-reconcile.job.js +247 -0
  247. package/dist/sandbox/permission-authority-epochs.d.ts +18 -0
  248. package/dist/sandbox/permission-authority-epochs.js +83 -0
  249. package/dist/sandbox/permission-authority-lock.d.ts +38 -0
  250. package/dist/sandbox/permission-authority-lock.js +147 -0
  251. package/dist/sandbox/permission-authority.module.d.ts +9 -0
  252. package/dist/sandbox/permission-authority.module.js +55 -0
  253. package/dist/sandbox/permission-availability.d.ts +18 -0
  254. package/dist/sandbox/permission-availability.js +19 -0
  255. package/dist/sandbox/permission-call-grants.d.ts +34 -0
  256. package/dist/sandbox/permission-call-grants.js +349 -0
  257. package/dist/sandbox/permission-call-grants.module.d.ts +2 -0
  258. package/dist/sandbox/permission-call-grants.module.js +21 -0
  259. package/dist/sandbox/permission-call-types.d.ts +82 -0
  260. package/dist/sandbox/permission-call-types.js +1 -0
  261. package/dist/sandbox/permission-ceiling-writes.d.ts +47 -0
  262. package/dist/sandbox/permission-ceiling-writes.js +223 -0
  263. package/dist/sandbox/permission-config-publication.d.ts +76 -0
  264. package/dist/sandbox/permission-config-publication.js +339 -0
  265. package/dist/sandbox/permission-context-types.d.ts +64 -0
  266. package/dist/sandbox/permission-context-types.js +24 -0
  267. package/dist/sandbox/permission-facts.d.ts +206 -0
  268. package/dist/sandbox/permission-facts.js +627 -0
  269. package/dist/sandbox/permission-facts.module.d.ts +2 -0
  270. package/dist/sandbox/permission-facts.module.js +20 -0
  271. package/dist/sandbox/permission-instance-writes.d.ts +90 -0
  272. package/dist/sandbox/permission-instance-writes.js +305 -0
  273. package/dist/sandbox/permission-runtime-reports.d.ts +83 -0
  274. package/dist/sandbox/permission-runtime-reports.js +354 -0
  275. package/dist/sandbox/permission-transitions.d.ts +31 -0
  276. package/dist/sandbox/permission-transitions.js +155 -0
  277. package/dist/sandbox/platform-full-access.d.ts +128 -0
  278. package/dist/sandbox/platform-full-access.js +210 -0
  279. package/dist/sandbox/providers.d.ts +22 -0
  280. package/dist/sandbox/providers.js +10 -2
  281. package/dist/sandbox/providers.module.d.ts +2 -0
  282. package/dist/sandbox/providers.module.js +19 -0
  283. package/dist/sandbox/request-not-sent.d.ts +13 -0
  284. package/dist/sandbox/request-not-sent.js +13 -0
  285. package/dist/sandbox/review/classifier.d.ts +2 -0
  286. package/dist/sandbox/review/classifier.js +8 -0
  287. package/dist/sandbox/review/permission-candidate.d.ts +12 -0
  288. package/dist/sandbox/review/permission-candidate.js +145 -0
  289. package/dist/sandbox/review/review.service.d.ts +5 -2
  290. package/dist/sandbox/review/review.service.js +60 -15
  291. package/dist/sandbox/sandbox-file-reader.d.ts +18 -1
  292. package/dist/sandbox/sandbox-file-reader.js +51 -7
  293. package/dist/sandbox/sandbox.module.js +26 -6
  294. package/dist/sandbox/sandbox.service.d.ts +230 -34
  295. package/dist/sandbox/sandbox.service.js +1368 -199
  296. package/dist/sandbox/unreachable.js +17 -3
  297. package/dist/sandbox/use-context.d.ts +17 -0
  298. package/dist/sandbox/use-context.js +1 -0
  299. package/dist/skills/invoke.d.ts +27 -4
  300. package/dist/skills/invoke.js +72 -7
  301. package/dist/tools/approvals.controller.d.ts +1 -0
  302. package/dist/tools/approvals.schemas.d.ts +1 -0
  303. package/dist/tools/approvals.schemas.js +3 -1
  304. package/dist/tools/approvals.service.d.ts +23 -10
  305. package/dist/tools/approvals.service.js +104 -26
  306. package/dist/tools/builtin-names.d.ts +3 -1
  307. package/dist/tools/builtin-names.js +5 -1
  308. package/dist/tools/builtins/artifacts.d.ts +43 -0
  309. package/dist/tools/builtins/artifacts.js +67 -0
  310. package/dist/tools/builtins/builtin-tools.d.ts +20 -2
  311. package/dist/tools/builtins/builtin-tools.js +61 -10
  312. package/dist/tools/builtins/image/generate.d.ts +59 -0
  313. package/dist/tools/builtins/image/generate.js +535 -0
  314. package/dist/tools/builtins/image/index.d.ts +2 -0
  315. package/dist/tools/builtins/image/index.js +2 -0
  316. package/dist/tools/builtins/image/paths.d.ts +12 -0
  317. package/dist/tools/builtins/image/paths.js +26 -0
  318. package/dist/tools/builtins/sandbox/bash.d.ts +25 -1
  319. package/dist/tools/builtins/sandbox/bash.js +201 -5
  320. package/dist/tools/builtins/sandbox/common.d.ts +92 -20
  321. package/dist/tools/builtins/sandbox/common.js +201 -17
  322. package/dist/tools/builtins/sandbox/deliver.js +9 -51
  323. package/dist/tools/builtins/sandbox/edit.js +2 -2
  324. package/dist/tools/builtins/sandbox/fetch-attachment.js +11 -4
  325. package/dist/tools/builtins/sandbox/glob.js +2 -2
  326. package/dist/tools/builtins/sandbox/grep.js +2 -2
  327. package/dist/tools/builtins/sandbox/read.js +2 -2
  328. package/dist/tools/builtins/sandbox/task-list.js +7 -1
  329. package/dist/tools/builtins/sandbox/task-output.d.ts +1 -1
  330. package/dist/tools/builtins/sandbox/task-output.js +172 -0
  331. package/dist/tools/builtins/sandbox/task-stop.js +25 -3
  332. package/dist/tools/builtins/sandbox/write.js +2 -2
  333. package/dist/tools/builtins/skill-load.js +9 -6
  334. package/dist/tools/device-op-resolver.d.ts +1 -1
  335. package/dist/tools/device-op-resolver.js +13 -3
  336. package/dist/tools/permission-approval-jobs.d.ts +18 -0
  337. package/dist/tools/permission-approval-jobs.js +92 -0
  338. package/dist/tools/pipeline.d.ts +17 -2
  339. package/dist/tools/pipeline.js +315 -26
  340. package/dist/tools/registry.d.ts +9 -0
  341. package/dist/tools/tools.module.js +15 -0
  342. package/package.json +4 -3
  343. package/src/migrations/0146_permission_authority_epochs.sql +6 -0
  344. package/src/migrations/0147_conversation_permission_profiles.sql +4 -0
  345. package/src/migrations/0148_first_message_request_hash.sql +2 -0
  346. package/src/migrations/0149_sandbox_operation_intents.sql +66 -0
  347. package/src/migrations/0150_permission_call_grants_and_approvals.sql +36 -0
  348. package/src/migrations/0151_starting_execution_grants.sql +8 -0
  349. package/src/migrations/0152_background_launch_identity.sql +66 -0
  350. package/src/migrations/0153_background_cancel_requester.sql +13 -0
  351. package/src/migrations/0154_cloud_owner_ceiling.sql +14 -0
  352. package/src/migrations/0155_device_instance_generations.sql +30 -0
  353. package/src/migrations/0156_device_owner_report.sql +7 -0
  354. package/src/migrations/0157_legacy_retirement.sql +116 -0
  355. package/src/migrations/0158_legacy_freeze_enumerated.sql +5 -0
  356. package/src/migrations/0159_retirement_exact_cancel.sql +9 -0
  357. package/src/migrations/0160_model_usage_image_kind.sql +10 -0
  358. package/dist/sandbox/platform-auto-mode.d.ts +0 -63
  359. package/dist/sandbox/platform-auto-mode.js +0 -63
@@ -7,10 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
- import { Inject, Injectable } from "@nestjs/common";
10
+ import { parseDeviceFrameV3, parseOperationResultV3, parseSandboxBrowseScope, parseSandboxOperationScope, parseSandboxPreparationScope, SandboxPermissionUnsupportedError, } from "@capybara-hq/plugin-sdk";
11
+ import { Inject, Injectable, Optional } from "@nestjs/common";
12
+ import { projectsUnsupported } from "../devices/errors.js";
11
13
  import { ApiError } from "../errors.js";
12
14
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
13
15
  import { KERNEL_LOGGER } from "../infra/tokens.js";
16
+ import { PermissionCallGrants } from "../sandbox/permission-call-grants.js";
14
17
  import { deviceNotFound, SandboxService } from "../sandbox/sandbox.service.js";
15
18
  import { grantsWithin, NetworkGrants, relayer } from "./network-grants.js";
16
19
  import { deviceOffline, LocalDeviceRelay } from "./relay.js";
@@ -25,22 +28,23 @@ export const OP_DEADLINE_MS = 30_000;
25
28
  * (ruling R26).
26
29
  */
27
30
  export const FRAME_ENVELOPE_BYTES = 64 * 1024;
31
+ export { projectsUnsupported } from "../devices/errors.js";
28
32
  /** The most raw bytes whose base64 plus {@link FRAME_ENVELOPE_BYTES} fit in `maxFrameBytes`. */
29
33
  export const maxReadBytes = (maxFrameBytes) => Math.max(0, Math.floor((maxFrameBytes - FRAME_ENVELOPE_BYTES) / 4) * 3);
30
34
  const NAME_PREFIX = "cap-device-";
31
- /**
32
- * The device offers no projects (project root §4.1): a local machine whose `capybara-device`
33
- * does not announce `projects`, or a cloud provider without `list` / `scan`.
34
- */
35
- export const projectsUnsupported = (local) => new ApiError("device.projects_unsupported", local
36
- ? "This device's capybara-device does not support projects; update capybara-device on that machine and reconnect it."
37
- : "This device's sandbox provider does not support projects; its conversations work without one.");
38
35
  /**
39
36
  * The refusal of a command on a machine whose local policy is auto mode while the organization (or
40
37
  * the platform) allows only sandbox mode (auto mode spec §4.3): re-checked at every exec, so a
41
38
  * machine switched locally is refused at the next command.
42
39
  */
43
40
  export const AUTO_MODE_NOT_ALLOWED_TEXT = "This device's machine runs in auto mode, which your organization does not allow. Run `capybara-device mode sandbox` on that machine to switch it to sandbox mode.";
41
+ /**
42
+ * A raw protocol 2 method on the staged provider: refused before anything is queued (a v3
43
+ * machine runs work only under an admitted operation scope; there is no raw fallback).
44
+ */
45
+ const refuseRaw = (method) => async (..._args) => {
46
+ throw new SandboxPermissionUnsupportedError(`${method} without an operation scope is not available on a protocol 3 device; run it through an admitted operation scope`);
47
+ };
44
48
  /** The device id of a `cap-device-<deviceId>` name; undefined for any other name. */
45
49
  export const deviceIdOfName = (name) => name.startsWith(NAME_PREFIX) && name.length > NAME_PREFIX.length
46
50
  ? name.slice(NAME_PREFIX.length)
@@ -64,15 +68,184 @@ let LocalDeviceProvider = class LocalDeviceProvider {
64
68
  config;
65
69
  grants;
66
70
  log;
71
+ callGrants;
67
72
  concurrentExec = true;
68
73
  sessionIsolation = false;
69
- constructor(relay, targets, sandbox, config, grants, log) {
74
+ constructor(relay, targets, sandbox, config, grants, log, callGrants) {
70
75
  this.relay = relay;
71
76
  this.targets = targets;
72
77
  this.sandbox = sandbox;
73
78
  this.config = config;
74
79
  this.grants = grants;
75
80
  this.log = log;
81
+ this.callGrants = callGrants;
82
+ }
83
+ /**
84
+ * The `@local` provider as the staged (protocol 3) registration hands it out
85
+ * (`LocalDevicesModule`): the protocol 2 lifecycle methods that send no frame (file system,
86
+ * resume, suspend, destroy), the v3 operation adapter ({@link stagedOperations}), `create` as a
87
+ * protocol 3 request, no raw protocol 2 call and no broad kill. Dormant until the protocol gate
88
+ * selects it.
89
+ *
90
+ * The raw methods (`exec`, `readFile`, `writeFile`, `stat`, `list`, `scan`) refuse before
91
+ * anything is queued: a v3 machine runs work only under an admitted operation scope, and
92
+ * missing operation support never falls back to them.
93
+ *
94
+ * A v3 machine has no `killAll` / `killTagged` (permission runtime cutover B-1), so both are
95
+ * no-ops that queue nothing. What reaches the machine instead is only what the kernel revokes
96
+ * exactly (`revokeOperation` per intent): `SandboxService` calls `OperationIntents.revokeHolders`
97
+ * with the crashed holders' tokens before `killTagged` and before `killLeftovers`' `killAll`, and
98
+ * that revokes those holders' admitted, dispatching and started-or-unknown intents only. Not
99
+ * covered today: the `killAll` after a failed limits change on a resumed instance and the one
100
+ * in `quarantine` (unreachable for `@local`) revoke nothing first; `killLeftovers` revokes only
101
+ * the dead tokens, not the started-or-unknown intents of live holders of the instance; and
102
+ * tokens `claimDeadHolders` already deleted are lost when `revokeHolders` then throws. Revoking
103
+ * every started-or-unknown intent of the generation on a v3 resume is W5-P3a's kernel change.
104
+ */
105
+ staged(transport) {
106
+ const ops = this.stagedOperations(transport);
107
+ const overrides = {
108
+ ...ops,
109
+ create: async (args) => {
110
+ const id = args.fileSystem.id;
111
+ const r = parseOperationResultV3("create", await transport.call(id, "create", { limits: args.limits }, { deadlineMs: OP_DEADLINE_MS, signal: args.signal }));
112
+ return { id, roots: r.roots, limits: args.limits };
113
+ },
114
+ exec: refuseRaw("exec"),
115
+ readFile: refuseRaw("readFile"),
116
+ writeFile: refuseRaw("writeFile"),
117
+ stat: refuseRaw("stat"),
118
+ list: refuseRaw("list"),
119
+ scan: refuseRaw("scan"),
120
+ killAll: async (_h, signal) => {
121
+ signal.throwIfAborted();
122
+ },
123
+ killTagged: async (_h, _tags, signal) => {
124
+ signal.throwIfAborted();
125
+ },
126
+ };
127
+ // the shared lifecycle methods keep this provider as their receiver (relay, targets, config)
128
+ return Object.assign(Object.create(this), overrides);
129
+ }
130
+ /** Dormant v3 adapter. It is not installed on the active v2 registered provider. */
131
+ stagedOperations(transport) {
132
+ const native = (h, scope, prefix, factorySignal) => {
133
+ const send = async (op, args, signal) => {
134
+ const name = (prefix ? prefix + op.charAt(0).toUpperCase() + op.slice(1) : op);
135
+ const result = await transport.call(h.id, name, { scope, ...args }, { deadlineMs: OP_DEADLINE_MS, signal: AbortSignal.any([factorySignal, signal]) });
136
+ return parseOperationResultV3(name, result);
137
+ };
138
+ return {
139
+ exec: async () => {
140
+ throw new Error("Execution requires its request-bound authority adapter");
141
+ },
142
+ readFile: async (path, opts) => {
143
+ const r = (await send("readFile", {
144
+ path,
145
+ maxBytes: Math.min(opts.maxBytes, maxReadBytes(this.config.get().devices.local.maxFrameBytes)),
146
+ }, opts.signal));
147
+ return r === null ? null : { data: bytesOf(r.dataB64), truncated: r.truncated };
148
+ },
149
+ writeFile: async (path, data, signal) => {
150
+ await send("writeFile", { path, dataB64: Buffer.from(data).toString("base64") }, signal);
151
+ },
152
+ stat: async (path, signal) => (await send("stat", { path }, signal)),
153
+ list: async (path, opts) => (await send("list", { path, limit: opts.limit }, opts.signal)),
154
+ scan: async (base, opts) => (await send("scan", { base }, opts.signal)),
155
+ };
156
+ };
157
+ const execArgs = async (deviceId, scope, method, input) => {
158
+ const orgId = await this.targets.orgOf(deviceId);
159
+ if (orgId === null)
160
+ throw deviceNotFound();
161
+ const policy = await this.sandbox.devicePolicy({ orgId, deviceId });
162
+ const limits = await this.sandbox.deviceLimits({ orgId, deviceId }, { policy, source: "local" });
163
+ if (!this.callGrants)
164
+ throw new Error("Admitted execution authority is unavailable; check the device operation configuration");
165
+ const original = await this.callGrants.forExecution(scope.operationId, deviceId, method, scope, input);
166
+ const grants = grantsWithin(original, limits);
167
+ if (original?.hosts.some((host) => !grants?.hosts.includes(host)))
168
+ throw new Error("Current organization limits refuse the admitted explicit hosts; review the operation again");
169
+ return { limits, ...(grants === undefined ? {} : { grants }) };
170
+ };
171
+ const background = {
172
+ start: async (h, input, args) => {
173
+ const scope = parseSandboxOperationScope(input);
174
+ const { signal, ...rest } = args;
175
+ const authority = await execArgs(h.id, scope, "backgroundStart", rest);
176
+ signal.throwIfAborted();
177
+ return parseOperationResultV3("backgroundStart", await transport.call(h.id, "backgroundStart", { scope, ...rest, ...authority }, { deadlineMs: args.timeoutMs + EXEC_DEADLINE_MARGIN_MS, signal }));
178
+ },
179
+ status: async (h, ref, signal) => parseOperationResultV3("backgroundStatus", await transport.call(h.id, "backgroundStatus", { ref }, { deadlineMs: OP_DEADLINE_MS, signal })),
180
+ readOutput: async (h, ref, opts) => {
181
+ opts.signal.throwIfAborted();
182
+ parseDeviceFrameV3(JSON.stringify({
183
+ type: "req",
184
+ id: "validate",
185
+ op: "backgroundReadOutput",
186
+ args: { ref, offset: opts.offset, maxBytes: opts.maxBytes },
187
+ deadlineMs: OP_DEADLINE_MS,
188
+ }), "kernel");
189
+ // liveness first (R27): a deleted or revoked device keeps its typed error
190
+ const connection = await this.relay.connection(h.id);
191
+ const capacity = Math.min(65536, maxReadBytes(connection.maxFrameBytes));
192
+ const request = { ref, offset: opts.offset, maxBytes: Math.min(opts.maxBytes, capacity) };
193
+ const result = parseOperationResultV3("backgroundReadOutput", await transport.call(h.id, "backgroundReadOutput", request, {
194
+ deadlineMs: OP_DEADLINE_MS,
195
+ signal: opts.signal,
196
+ connection,
197
+ }), request);
198
+ if ("unavailable" in result)
199
+ return result;
200
+ // A zero-capacity probe can establish EOF, but never reports unread bytes as EOF.
201
+ if (opts.maxBytes > 0 && capacity === 0 && result.totalBytes > opts.offset)
202
+ throw new Error("Managed output cannot fit the negotiated transport capacity; increase device and deployment frame limits and retry the same offset");
203
+ return {
204
+ data: bytesOf(result.dataB64),
205
+ offset: result.offset,
206
+ nextOffset: result.nextOffset,
207
+ totalBytes: result.totalBytes,
208
+ };
209
+ },
210
+ tail: async (h, ref, opts) => {
211
+ const r = parseOperationResultV3("backgroundTail", await transport.call(h.id, "backgroundTail", { ref, maxBytes: opts.maxBytes }, { deadlineMs: OP_DEADLINE_MS, signal: opts.signal }));
212
+ return "unavailable" in r ? r : { data: bytesOf(r.dataB64), truncated: r.truncated };
213
+ },
214
+ stop: async (h, ref, opts) => parseOperationResultV3("backgroundStop", await transport.call(h.id, "backgroundStop", { ref, graceMs: opts.graceMs }, { deadlineMs: OP_DEADLINE_MS, signal: opts.signal })),
215
+ };
216
+ return {
217
+ permissionSupport: (h, signal) => transport.permissionSupport(h.id, signal),
218
+ operation: async (h, input, signal) => {
219
+ const scope = parseSandboxOperationScope(input);
220
+ const methods = native(h, scope, "", signal);
221
+ return {
222
+ ...methods,
223
+ exec: async (args) => {
224
+ const { signal: callSignal, ...rest } = args;
225
+ const authority = await execArgs(h.id, scope, "exec", rest);
226
+ const combined = AbortSignal.any([signal, callSignal]);
227
+ combined.throwIfAborted();
228
+ return parseOperationResultV3("exec", await transport.call(h.id, "exec", { scope, ...rest, ...authority }, { deadlineMs: args.timeoutMs + EXEC_DEADLINE_MARGIN_MS, signal: combined }));
229
+ },
230
+ };
231
+ },
232
+ prepare: async (h, input, signal) => {
233
+ const n = native(h, parseSandboxPreparationScope(input), "prepare", signal);
234
+ return {
235
+ readFile: n.readFile,
236
+ writeFile: n.writeFile,
237
+ stat: n.stat,
238
+ };
239
+ },
240
+ browse: async (h, input, signal) => {
241
+ const n = native(h, parseSandboxBrowseScope(input), "browse", signal);
242
+ return { stat: n.stat, list: n.list, scan: n.scan };
243
+ },
244
+ revokeOperation: async (h, ref, signal) => {
245
+ await transport.call(h.id, "revokeOperation", { ref }, { deadlineMs: OP_DEADLINE_MS, signal });
246
+ },
247
+ background,
248
+ };
76
249
  }
77
250
  async createFileSystem(args) {
78
251
  args.signal.throwIfAborted();
@@ -233,6 +406,8 @@ LocalDeviceProvider = __decorate([
233
406
  __param(2, Inject(SandboxService)),
234
407
  __param(3, Inject(KernelConfigService)),
235
408
  __param(4, Inject(NetworkGrants)),
236
- __param(5, Inject(KERNEL_LOGGER))
409
+ __param(5, Inject(KERNEL_LOGGER)),
410
+ __param(6, Optional()),
411
+ __param(6, Inject(PermissionCallGrants))
237
412
  ], LocalDeviceProvider);
238
413
  export { LocalDeviceProvider };
@@ -1,6 +1,9 @@
1
1
  import { type OnModuleInit } from "@nestjs/common";
2
- import { SandboxProviders } from "../sandbox/providers.js";
2
+ import { type SandboxProviderEntry, SandboxProviders } from "../sandbox/providers.js";
3
+ import { LocalInstanceBindings } from "./instance-bindings.js";
3
4
  import { LocalDeviceProvider } from "./local-device-provider.js";
5
+ import { LocalDeviceRelay } from "./relay.js";
6
+ export { stagedDeviceProtocolActive } from "./relay.js";
4
7
  /**
5
8
  * Connected machines (environments spec §6, §13): the caller side of the device relay and the
6
9
  * kernel-internal `@local` sandbox provider, registered with {@link SandboxProviders} on init, and
@@ -12,6 +15,18 @@ import { LocalDeviceProvider } from "./local-device-provider.js";
12
15
  export declare class LocalDevicesModule implements OnModuleInit {
13
16
  private readonly providers;
14
17
  private readonly provider;
15
- constructor(providers: SandboxProviders, provider: LocalDeviceProvider);
18
+ private readonly relay;
19
+ private readonly bindings;
20
+ constructor(providers: SandboxProviders, provider: LocalDeviceProvider, relay: LocalDeviceRelay, bindings: LocalInstanceBindings);
16
21
  onModuleInit(): void;
17
22
  }
23
+ /**
24
+ * The `@local` registration: protocol 2's provider as it is, or the staged (protocol 3) provider
25
+ * ({@link LocalDeviceProvider.staged}: v3 operations, no broad kill) with its instance binder,
26
+ * which binds every committed generation before shared use (B-8).
27
+ */
28
+ export declare function localProviderEntry(staged: boolean, deps: {
29
+ provider: LocalDeviceProvider;
30
+ relay: LocalDeviceRelay;
31
+ bindings: LocalInstanceBindings;
32
+ }): SandboxProviderEntry;
@@ -8,14 +8,20 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
10
  import { Inject, Module } from "@nestjs/common";
11
- import { LOCAL_PROVIDER, SandboxProviders } from "../sandbox/providers.js";
11
+ import { PermissionCallGrantsModule } from "../sandbox/permission-call-grants.module.js";
12
+ import { LOCAL_PROVIDER, SandboxProviders, } from "../sandbox/providers.js";
13
+ import { SandboxProviderRegistryModule } from "../sandbox/providers.module.js";
12
14
  import { SandboxModule } from "../sandbox/sandbox.module.js";
13
15
  import { DevicePolicyService } from "./device-policy.service.js";
16
+ import { LocalInstanceBindings } from "./instance-bindings.js";
14
17
  import { LocalDeviceProvider } from "./local-device-provider.js";
15
18
  import { MachinesService } from "./machines.js";
16
19
  import { NetworkGrants } from "./network-grants.js";
17
- import { LocalDeviceRelay } from "./relay.js";
20
+ import { NetworkGrantsModule } from "./network-grants.module.js";
21
+ import { OwnerReports } from "./owner-reports.js";
22
+ import { LocalDeviceRelay, stagedDeviceProtocolActive } from "./relay.js";
18
23
  import { DeviceTargets } from "./targets.js";
24
+ export { stagedDeviceProtocolActive } from "./relay.js";
19
25
  /**
20
26
  * Connected machines (environments spec §6, §13): the caller side of the device relay and the
21
27
  * kernel-internal `@local` sandbox provider, registered with {@link SandboxProviders} on init, and
@@ -27,34 +33,69 @@ import { DeviceTargets } from "./targets.js";
27
33
  let LocalDevicesModule = class LocalDevicesModule {
28
34
  providers;
29
35
  provider;
30
- constructor(providers, provider) {
36
+ relay;
37
+ bindings;
38
+ constructor(providers, provider, relay, bindings) {
31
39
  this.providers = providers;
32
40
  this.provider = provider;
41
+ this.relay = relay;
42
+ this.bindings = bindings;
33
43
  }
34
44
  onModuleInit() {
35
- this.providers.register({ plugin: LOCAL_PROVIDER, impl: this.provider });
45
+ this.providers.register(localProviderEntry(stagedDeviceProtocolActive(), {
46
+ provider: this.provider,
47
+ relay: this.relay,
48
+ bindings: this.bindings,
49
+ }));
36
50
  }
37
51
  };
38
52
  LocalDevicesModule = __decorate([
39
53
  Module({
40
- imports: [SandboxModule],
54
+ imports: [
55
+ PermissionCallGrantsModule,
56
+ SandboxModule,
57
+ SandboxProviderRegistryModule,
58
+ NetworkGrantsModule,
59
+ ],
41
60
  providers: [
42
61
  DeviceTargets,
43
62
  LocalDeviceRelay,
44
63
  LocalDeviceProvider,
45
64
  MachinesService,
46
65
  DevicePolicyService,
47
- NetworkGrants,
66
+ LocalInstanceBindings,
67
+ OwnerReports,
48
68
  ],
49
69
  exports: [
70
+ NetworkGrantsModule,
50
71
  LocalDeviceRelay,
51
72
  LocalDeviceProvider,
52
73
  MachinesService,
53
74
  DevicePolicyService,
54
- NetworkGrants,
75
+ LocalInstanceBindings,
76
+ OwnerReports,
55
77
  ],
56
78
  }),
57
79
  __param(0, Inject(SandboxProviders)),
58
- __param(1, Inject(LocalDeviceProvider))
80
+ __param(1, Inject(LocalDeviceProvider)),
81
+ __param(2, Inject(LocalDeviceRelay)),
82
+ __param(3, Inject(LocalInstanceBindings))
59
83
  ], LocalDevicesModule);
60
84
  export { LocalDevicesModule };
85
+ /**
86
+ * The `@local` registration: protocol 2's provider as it is, or the staged (protocol 3) provider
87
+ * ({@link LocalDeviceProvider.staged}: v3 operations, no broad kill) with its instance binder,
88
+ * which binds every committed generation before shared use (B-8).
89
+ */
90
+ export function localProviderEntry(staged, deps) {
91
+ if (!staged)
92
+ return { plugin: LOCAL_PROVIDER, impl: deps.provider };
93
+ return {
94
+ plugin: LOCAL_PROVIDER,
95
+ impl: deps.provider.staged({
96
+ call: deps.relay.callV3.bind(deps.relay),
97
+ permissionSupport: (deviceId) => deps.bindings.permissionSupport(deviceId),
98
+ }),
99
+ binder: deps.bindings,
100
+ };
101
+ }
@@ -1,8 +1,13 @@
1
1
  import type { DeviceFeature, DeviceHello, DeviceLocalPolicySummary, DeviceStopArgs, ExtensionContext } from "@capybara-hq/plugin-sdk";
2
+ import { type DeviceHelloV3, type DeviceOwnerCeilingV3 } from "@capybara-hq/plugin-sdk";
2
3
  import { KernelDb } from "../infra/database/kernel-db.js";
3
4
  import { TransactionHost } from "../infra/database/transaction-host.js";
4
5
  import { OutboxService } from "../infra/outbox/outbox.service.js";
5
6
  import type { KernelLogger } from "../log.js";
7
+ import { LegacyRetirementStore } from "../sandbox/legacy-retirement.js";
8
+ import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
9
+ import { PermissionRuntimeReports } from "../sandbox/permission-runtime-reports.js";
10
+ import { OwnerReports } from "./owner-reports.js";
6
11
  import { LocalDeviceRelay } from "./relay.js";
7
12
  /** The machine credential's prefix (`cap_dev_` plus 32 random bytes, base64url). */
8
13
  export declare const MACHINE_CREDENTIAL_PREFIX = "cap_dev_";
@@ -29,16 +34,6 @@ export interface ActiveMachine {
29
34
  /** Its local network policy as last reported (hello or `policy` op); null when unknown. */
30
35
  localPolicy: DeviceLocalPolicySummary | null;
31
36
  }
32
- /**
33
- * Connected machines and their credentials (environments spec §13.2). One active machine per
34
- * local device: issuing a credential revokes the device's previous machine. A
35
- * credential is `cap_dev_` plus 32 random bytes; only its sha256 is stored. It is accepted only
36
- * by the device connection route ({@link authenticate}), never by `/api`: it is no `Principal`.
37
- *
38
- * A revoked machine is told so after the commit: `stop { reason }` relayed while a replica holds
39
- * its connection (fire-and-forget, ruling R14) and `device.revoked.<deviceId>` published with
40
- * `{ machineId }`, so the holder closes that machine's connection.
41
- */
42
37
  export declare class MachinesService {
43
38
  private readonly db;
44
39
  readonly txHost: TransactionHost;
@@ -46,7 +41,14 @@ export declare class MachinesService {
46
41
  private readonly bus;
47
42
  private readonly outbox;
48
43
  private readonly log;
49
- constructor(db: KernelDb, txHost: TransactionHost, relay: Pick<LocalDeviceRelay, "holderLive" | "send">, bus: ExtensionContext["bus"], outbox: Pick<OutboxService, "add">, log: Pick<KernelLogger, "warn">);
44
+ private readonly ceilings;
45
+ private readonly reports;
46
+ private readonly owners;
47
+ /** The host's boot identity: restart evidence for local legacy obligations (8.5). */
48
+ private readonly retirement;
49
+ constructor(db: KernelDb, txHost: TransactionHost, relay: Pick<LocalDeviceRelay, "holderLive" | "send">, bus: ExtensionContext["bus"], outbox: Pick<OutboxService, "add">, log: Pick<KernelLogger, "warn">, ceilings: PermissionCeilingWrites, reports: PermissionRuntimeReports, owners: OwnerReports,
50
+ /** The host's boot identity: restart evidence for local legacy obligations (8.5). */
51
+ retirement: Pick<LegacyRetirementStore, "recordBoot" | "clearBoot">);
50
52
  /**
51
53
  * A new machine for the device and its credential (returned once). Revokes the
52
54
  * device's active machine first. Joins the caller's transaction (the device confirmation),
@@ -98,7 +100,12 @@ export declare class MachinesService {
98
100
  * platform's ops still pending on the row ({@link backfillOps}). The owner's home directory
99
101
  * (`home`) replaces the stored one too (null when the hello has none).
100
102
  */
101
- recordHello(machineId: string, hello: DeviceHello, rawPolicy?: unknown): Promise<void>;
103
+ recordHello(machineId: string, hello: DeviceHello, rawPolicy?: unknown,
104
+ /** A v3 hello's authenticated owner report (B2): it, not the summary, decides publication. */
105
+ owner?: {
106
+ report: DeviceOwnerCeilingV3;
107
+ connectionId: string | null;
108
+ }): Promise<void>;
102
109
  /**
103
110
  * Hello backfill (transactional outbox spec §7): a pending op of the platform's whose outcome
104
111
  * the hello reports (`applied`, `refused`), or that it does not list although the op can no
@@ -111,6 +118,17 @@ export declare class MachinesService {
111
118
  * transaction, with the machine's row locked; an op already reported is not owed again.
112
119
  */
113
120
  private backfillOps;
121
+ /** Dormant authenticated hello adapter; the active gateway still accepts only protocol 2. */
122
+ recordHelloV3(machineId: string, hello: DeviceHelloV3, connectionId?: string | null): Promise<void>;
123
+ /**
124
+ * The runtime identity a v3 hello may attest (B4): only a bound hello re-reporting exactly the
125
+ * identity of the current instance generation's installed binding. An unbound hello, another
126
+ * generation or a binding still awaiting the device attests nothing (unprobed; it never finishes
127
+ * an installation, which only the bindInstance answer does). A changed identity under the same
128
+ * binding (helper, interpreter or environment bytes) invalidates the report and advances the
129
+ * device's admission epoch; a changed environment fingerprint also resets Full consent.
130
+ */
131
+ private boundIdentityLocked;
114
132
  /**
115
133
  * Stores the local policy summary a connected program pushed after its hello (a `policy` frame:
116
134
  * its policy file changed on the machine: its mode or its sandbox-mode allowlist), read and
@@ -120,6 +138,11 @@ export declare class MachinesService {
120
138
  * alone.
121
139
  */
122
140
  recordPolicy(machineId: string, summary: DeviceLocalPolicySummary | undefined, rawPolicy?: unknown): Promise<void>;
141
+ /**
142
+ * A staged (v3) `policy` frame (B2): the summary is kept for the device page like protocol 2's,
143
+ * while the authenticated owner report alone decides what changed ({@link OwnerReports}).
144
+ */
145
+ recordPolicyV3(machineId: string, frame: unknown, connectionId?: string | null): Promise<void>;
123
146
  /**
124
147
  * The summary to store for one a program reported (hello or `policy` frame): the parsed one, else
125
148
  * null. When both the stored and the reported summary are readable and what the owner sets