@capybara-hq/kernel 0.1.0-rc.40 → 0.1.0-rc.42

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 (326) hide show
  1. package/bootstrap.json +10 -1
  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 +1 -1
  38. package/dist/config/schema.js +11 -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 +304 -4
  47. package/dist/conversations/events.js +279 -29
  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/db/kernel-schema.d.ts +238 -3
  59. package/dist/devices/access.js +1 -1
  60. package/dist/devices/access.module.d.ts +2 -0
  61. package/dist/devices/access.module.js +19 -0
  62. package/dist/devices/conversation-devices.d.ts +8 -29
  63. package/dist/devices/conversation-devices.js +37 -73
  64. package/dist/devices/device-projects.service.d.ts +26 -28
  65. package/dist/devices/device-projects.service.js +123 -127
  66. package/dist/devices/devices.controller.js +3 -1
  67. package/dist/devices/devices.module.js +11 -9
  68. package/dist/devices/devices.service.d.ts +116 -8
  69. package/dist/devices/devices.service.js +252 -20
  70. package/dist/devices/dto.d.ts +16 -0
  71. package/dist/devices/dto.js +34 -6
  72. package/dist/devices/errors.d.ts +8 -0
  73. package/dist/devices/errors.js +10 -0
  74. package/dist/devices/project-rules.d.ts +44 -0
  75. package/dist/devices/project-rules.js +27 -0
  76. package/dist/devices/working-root.d.ts +6 -0
  77. package/dist/devices/working-root.js +12 -1
  78. package/dist/errors.d.ts +31 -0
  79. package/dist/errors.js +31 -0
  80. package/dist/evals/reconstruct.d.ts +19 -2
  81. package/dist/evals/reconstruct.js +40 -2
  82. package/dist/evals/recorded-permission-context.d.ts +77 -0
  83. package/dist/evals/recorded-permission-context.js +151 -0
  84. package/dist/evals/recorded-tools.d.ts +10 -1
  85. package/dist/evals/recorded-tools.js +27 -3
  86. package/dist/evals/run-replay.d.ts +8 -2
  87. package/dist/evals/run-replay.js +18 -2
  88. package/dist/evals/trajectory.d.ts +1 -1
  89. package/dist/evals/worker.d.ts +10 -1
  90. package/dist/evals/worker.js +23 -14
  91. package/dist/http/api.module.js +2 -0
  92. package/dist/identity/accounts.d.ts +14 -1
  93. package/dist/identity/accounts.js +61 -5
  94. package/dist/identity/identity.module.js +2 -0
  95. package/dist/identity/settings.d.ts +28 -12
  96. package/dist/identity/settings.js +89 -33
  97. package/dist/index.d.ts +6 -0
  98. package/dist/index.js +5 -0
  99. package/dist/infra/cli/kernel-cli.module.d.ts +2 -2
  100. package/dist/infra/cli/kernel-cli.module.js +5 -2
  101. package/dist/infra/cli/permission-cutover.d.ts +59 -0
  102. package/dist/infra/cli/permission-cutover.js +107 -0
  103. package/dist/infra/config/kernel-config.service.d.ts +2 -2
  104. package/dist/infra/config/kernel-config.service.js +31 -11
  105. package/dist/infra/database/startup-activation-transaction.d.ts +36 -0
  106. package/dist/infra/database/startup-activation-transaction.js +242 -0
  107. package/dist/infra/database/transaction-host.d.ts +47 -0
  108. package/dist/infra/database/transaction-host.js +119 -0
  109. package/dist/infra/database/xact-lock.d.ts +1 -0
  110. package/dist/infra/database/xact-lock.js +6 -0
  111. package/dist/infra/outbox/registry.d.ts +39 -0
  112. package/dist/infra/outbox/registry.js +18 -0
  113. package/dist/kernel.module.js +2 -0
  114. package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
  115. package/dist/lifecycle/kernel-lifecycle.js +55 -28
  116. package/dist/local-devices/device-auth.js +1 -1
  117. package/dist/local-devices/device-policy.service.d.ts +35 -5
  118. package/dist/local-devices/device-policy.service.js +188 -13
  119. package/dist/local-devices/instance-bindings.d.ts +82 -0
  120. package/dist/local-devices/instance-bindings.js +304 -0
  121. package/dist/local-devices/keys.d.ts +5 -0
  122. package/dist/local-devices/keys.js +5 -0
  123. package/dist/local-devices/local-device-gateway.d.ts +19 -4
  124. package/dist/local-devices/local-device-gateway.js +185 -17
  125. package/dist/local-devices/local-device-provider.d.ts +42 -7
  126. package/dist/local-devices/local-device-provider.js +185 -10
  127. package/dist/local-devices/local-devices.module.d.ts +17 -2
  128. package/dist/local-devices/local-devices.module.js +49 -8
  129. package/dist/local-devices/machines.d.ts +35 -12
  130. package/dist/local-devices/machines.js +203 -8
  131. package/dist/local-devices/network-grants.js +3 -3
  132. package/dist/local-devices/network-grants.module.d.ts +2 -0
  133. package/dist/local-devices/network-grants.module.js +14 -0
  134. package/dist/local-devices/owner-report.d.ts +79 -0
  135. package/dist/local-devices/owner-report.js +155 -0
  136. package/dist/local-devices/owner-reports.d.ts +48 -0
  137. package/dist/local-devices/owner-reports.js +190 -0
  138. package/dist/local-devices/policy-summary.d.ts +24 -1
  139. package/dist/local-devices/policy-summary.js +48 -0
  140. package/dist/local-devices/relay.d.ts +82 -6
  141. package/dist/local-devices/relay.js +187 -16
  142. package/dist/local-devices/targets.d.ts +16 -1
  143. package/dist/local-devices/targets.js +35 -2
  144. package/dist/orgs/cloud-network-setting.d.ts +33 -0
  145. package/dist/orgs/cloud-network-setting.js +47 -0
  146. package/dist/orgs/offboarding.d.ts +3 -1
  147. package/dist/orgs/offboarding.js +8 -2
  148. package/dist/orgs/org-lock.d.ts +10 -4
  149. package/dist/orgs/org-lock.js +10 -4
  150. package/dist/orgs/orgs.service.d.ts +3 -1
  151. package/dist/orgs/orgs.service.js +8 -2
  152. package/dist/orgs/settings.controller.d.ts +4 -1
  153. package/dist/orgs/settings.controller.js +3 -3
  154. package/dist/orgs/settings.service.d.ts +48 -56
  155. package/dist/orgs/settings.service.js +144 -101
  156. package/dist/overrides.d.ts +6 -1
  157. package/dist/overrides.js +2 -0
  158. package/dist/platform/exclusions.js +20 -0
  159. package/dist/platform/ops/admin.ops.js +14 -11
  160. package/dist/platform/ops/agent-skills.ops.js +2 -0
  161. package/dist/platform/ops/devices.ops.js +10 -2
  162. package/dist/platform/ops/org-settings.ops.js +6 -6
  163. package/dist/platform/ops/orgs.ops.js +1 -0
  164. package/dist/roles/worker.module.js +4 -0
  165. package/dist/runtime/context/build.d.ts +3 -1
  166. package/dist/runtime/context/build.js +19 -3
  167. package/dist/runtime/context/compaction.js +5 -0
  168. package/dist/runtime/context/device-paths.d.ts +9 -2
  169. package/dist/runtime/context/device-paths.js +20 -0
  170. package/dist/runtime/context/permission-profile.d.ts +46 -0
  171. package/dist/runtime/context/permission-profile.js +194 -0
  172. package/dist/runtime/maintenance.d.ts +7 -1
  173. package/dist/runtime/maintenance.js +43 -15
  174. package/dist/runtime/model-call.d.ts +32 -0
  175. package/dist/runtime/model-call.js +67 -0
  176. package/dist/runtime/permission-context-errors.d.ts +39 -0
  177. package/dist/runtime/permission-context-errors.js +67 -0
  178. package/dist/runtime/permission-context.service.d.ts +60 -0
  179. package/dist/runtime/permission-context.service.js +286 -0
  180. package/dist/runtime/project/knowledge.d.ts +7 -2
  181. package/dist/runtime/project/knowledge.js +5 -2
  182. package/dist/runtime/project/knowledge.service.d.ts +17 -2
  183. package/dist/runtime/project/knowledge.service.js +76 -12
  184. package/dist/runtime/run-execution.d.ts +4 -1
  185. package/dist/runtime/run-execution.js +14 -5
  186. package/dist/runtime/run-steps.d.ts +11 -3
  187. package/dist/runtime/run-steps.js +27 -4
  188. package/dist/runtime/runtime.module.js +11 -0
  189. package/dist/sandbox/attachments-path.d.ts +15 -0
  190. package/dist/sandbox/attachments-path.js +15 -0
  191. package/dist/sandbox/cloud-permission-snapshot.d.ts +159 -0
  192. package/dist/sandbox/cloud-permission-snapshot.js +407 -0
  193. package/dist/sandbox/cloud-permission-snapshot.module.d.ts +8 -0
  194. package/dist/sandbox/cloud-permission-snapshot.module.js +34 -0
  195. package/dist/sandbox/held-operations.d.ts +39 -0
  196. package/dist/sandbox/held-operations.js +119 -0
  197. package/dist/sandbox/jobs.d.ts +14 -3
  198. package/dist/sandbox/jobs.js +20 -2
  199. package/dist/sandbox/kernel-read.d.ts +55 -0
  200. package/dist/sandbox/kernel-read.js +57 -0
  201. package/dist/sandbox/legacy-retirement.d.ts +336 -0
  202. package/dist/sandbox/legacy-retirement.js +1063 -0
  203. package/dist/sandbox/legacy-retirement.module.d.ts +8 -0
  204. package/dist/sandbox/legacy-retirement.module.js +25 -0
  205. package/dist/sandbox/managed-device-context.d.ts +94 -0
  206. package/dist/sandbox/managed-device-context.js +308 -0
  207. package/dist/sandbox/managed-device-context.module.d.ts +6 -0
  208. package/dist/sandbox/managed-device-context.module.js +33 -0
  209. package/dist/sandbox/modes.d.ts +56 -8
  210. package/dist/sandbox/modes.js +92 -8
  211. package/dist/sandbox/operation-authority-types.d.ts +8 -0
  212. package/dist/sandbox/operation-authority-types.js +32 -0
  213. package/dist/sandbox/operation-authority.d.ts +145 -0
  214. package/dist/sandbox/operation-authority.js +783 -0
  215. package/dist/sandbox/operation-authority.module.d.ts +2 -0
  216. package/dist/sandbox/operation-authority.module.js +29 -0
  217. package/dist/sandbox/operation-intents.d.ts +206 -0
  218. package/dist/sandbox/operation-intents.js +1252 -0
  219. package/dist/sandbox/operation-intents.module.d.ts +2 -0
  220. package/dist/sandbox/operation-intents.module.js +21 -0
  221. package/dist/sandbox/operation-payloads.d.ts +33 -0
  222. package/dist/sandbox/operation-payloads.js +332 -0
  223. package/dist/sandbox/operation-reconcile.job.d.ts +49 -0
  224. package/dist/sandbox/operation-reconcile.job.js +247 -0
  225. package/dist/sandbox/permission-authority-epochs.d.ts +18 -0
  226. package/dist/sandbox/permission-authority-epochs.js +83 -0
  227. package/dist/sandbox/permission-authority-lock.d.ts +38 -0
  228. package/dist/sandbox/permission-authority-lock.js +147 -0
  229. package/dist/sandbox/permission-authority.module.d.ts +9 -0
  230. package/dist/sandbox/permission-authority.module.js +55 -0
  231. package/dist/sandbox/permission-availability.d.ts +18 -0
  232. package/dist/sandbox/permission-availability.js +19 -0
  233. package/dist/sandbox/permission-call-grants.d.ts +34 -0
  234. package/dist/sandbox/permission-call-grants.js +349 -0
  235. package/dist/sandbox/permission-call-grants.module.d.ts +2 -0
  236. package/dist/sandbox/permission-call-grants.module.js +21 -0
  237. package/dist/sandbox/permission-call-types.d.ts +82 -0
  238. package/dist/sandbox/permission-call-types.js +1 -0
  239. package/dist/sandbox/permission-ceiling-writes.d.ts +47 -0
  240. package/dist/sandbox/permission-ceiling-writes.js +223 -0
  241. package/dist/sandbox/permission-config-publication.d.ts +76 -0
  242. package/dist/sandbox/permission-config-publication.js +339 -0
  243. package/dist/sandbox/permission-context-types.d.ts +64 -0
  244. package/dist/sandbox/permission-context-types.js +24 -0
  245. package/dist/sandbox/permission-facts.d.ts +206 -0
  246. package/dist/sandbox/permission-facts.js +627 -0
  247. package/dist/sandbox/permission-facts.module.d.ts +2 -0
  248. package/dist/sandbox/permission-facts.module.js +20 -0
  249. package/dist/sandbox/permission-instance-writes.d.ts +90 -0
  250. package/dist/sandbox/permission-instance-writes.js +305 -0
  251. package/dist/sandbox/permission-runtime-reports.d.ts +83 -0
  252. package/dist/sandbox/permission-runtime-reports.js +354 -0
  253. package/dist/sandbox/permission-transitions.d.ts +31 -0
  254. package/dist/sandbox/permission-transitions.js +155 -0
  255. package/dist/sandbox/platform-full-access.d.ts +128 -0
  256. package/dist/sandbox/platform-full-access.js +210 -0
  257. package/dist/sandbox/providers.d.ts +22 -0
  258. package/dist/sandbox/providers.js +10 -2
  259. package/dist/sandbox/providers.module.d.ts +2 -0
  260. package/dist/sandbox/providers.module.js +19 -0
  261. package/dist/sandbox/request-not-sent.d.ts +13 -0
  262. package/dist/sandbox/request-not-sent.js +13 -0
  263. package/dist/sandbox/review/classifier.d.ts +2 -0
  264. package/dist/sandbox/review/classifier.js +8 -0
  265. package/dist/sandbox/review/permission-candidate.d.ts +12 -0
  266. package/dist/sandbox/review/permission-candidate.js +129 -0
  267. package/dist/sandbox/review/review.service.d.ts +4 -1
  268. package/dist/sandbox/review/review.service.js +19 -5
  269. package/dist/sandbox/sandbox-file-reader.d.ts +18 -1
  270. package/dist/sandbox/sandbox-file-reader.js +51 -7
  271. package/dist/sandbox/sandbox.module.js +26 -6
  272. package/dist/sandbox/sandbox.service.d.ts +230 -34
  273. package/dist/sandbox/sandbox.service.js +1368 -199
  274. package/dist/sandbox/unreachable.js +17 -3
  275. package/dist/sandbox/use-context.d.ts +17 -0
  276. package/dist/sandbox/use-context.js +1 -0
  277. package/dist/skills/invoke.d.ts +27 -4
  278. package/dist/skills/invoke.js +72 -7
  279. package/dist/tools/approvals.controller.d.ts +1 -0
  280. package/dist/tools/approvals.schemas.d.ts +1 -0
  281. package/dist/tools/approvals.schemas.js +3 -1
  282. package/dist/tools/approvals.service.d.ts +23 -10
  283. package/dist/tools/approvals.service.js +104 -26
  284. package/dist/tools/builtins/builtin-tools.d.ts +16 -2
  285. package/dist/tools/builtins/builtin-tools.js +38 -10
  286. package/dist/tools/builtins/sandbox/bash.d.ts +25 -1
  287. package/dist/tools/builtins/sandbox/bash.js +201 -5
  288. package/dist/tools/builtins/sandbox/common.d.ts +92 -20
  289. package/dist/tools/builtins/sandbox/common.js +201 -17
  290. package/dist/tools/builtins/sandbox/deliver.js +2 -2
  291. package/dist/tools/builtins/sandbox/edit.js +2 -2
  292. package/dist/tools/builtins/sandbox/fetch-attachment.js +11 -4
  293. package/dist/tools/builtins/sandbox/glob.js +2 -2
  294. package/dist/tools/builtins/sandbox/grep.js +2 -2
  295. package/dist/tools/builtins/sandbox/read.js +2 -2
  296. package/dist/tools/builtins/sandbox/task-list.js +7 -1
  297. package/dist/tools/builtins/sandbox/task-output.d.ts +1 -1
  298. package/dist/tools/builtins/sandbox/task-output.js +172 -0
  299. package/dist/tools/builtins/sandbox/task-stop.js +25 -3
  300. package/dist/tools/builtins/sandbox/write.js +2 -2
  301. package/dist/tools/builtins/skill-load.js +9 -6
  302. package/dist/tools/device-op-resolver.d.ts +1 -1
  303. package/dist/tools/device-op-resolver.js +13 -3
  304. package/dist/tools/permission-approval-jobs.d.ts +18 -0
  305. package/dist/tools/permission-approval-jobs.js +92 -0
  306. package/dist/tools/pipeline.d.ts +17 -2
  307. package/dist/tools/pipeline.js +300 -19
  308. package/dist/tools/registry.d.ts +9 -0
  309. package/dist/tools/tools.module.js +12 -0
  310. package/package.json +4 -3
  311. package/src/migrations/0146_permission_authority_epochs.sql +6 -0
  312. package/src/migrations/0147_conversation_permission_profiles.sql +4 -0
  313. package/src/migrations/0148_first_message_request_hash.sql +2 -0
  314. package/src/migrations/0149_sandbox_operation_intents.sql +66 -0
  315. package/src/migrations/0150_permission_call_grants_and_approvals.sql +36 -0
  316. package/src/migrations/0151_starting_execution_grants.sql +8 -0
  317. package/src/migrations/0152_background_launch_identity.sql +66 -0
  318. package/src/migrations/0153_background_cancel_requester.sql +13 -0
  319. package/src/migrations/0154_cloud_owner_ceiling.sql +14 -0
  320. package/src/migrations/0155_device_instance_generations.sql +30 -0
  321. package/src/migrations/0156_device_owner_report.sql +7 -0
  322. package/src/migrations/0157_legacy_retirement.sql +116 -0
  323. package/src/migrations/0158_legacy_freeze_enumerated.sql +5 -0
  324. package/src/migrations/0159_retirement_exact_cancel.sql +9 -0
  325. package/dist/sandbox/platform-auto-mode.d.ts +0 -63
  326. package/dist/sandbox/platform-auto-mode.js +0 -63
package/bootstrap.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schemaVersion": 1,
4
4
  "marketplace": {
5
5
  "url": "https://github.com/capybara-hq/plugins.git",
6
- "commit": "662be35cf449fe5b24bf54d532f9dc8f1ad847d5"
6
+ "commit": "c9f2fc779775871b3092a82860965929ed2a16ed"
7
7
  },
8
8
  "plugins": [
9
9
  {
@@ -110,6 +110,15 @@
110
110
  "integrity": "sha512-eIad/YOTGMAjOQPEVrN6jfq/WHhpJUn5FifbELnFmRij1yo+mI4b/5/72DZ0cjsRXFWhUODen2IPmhYH/YZqWQ==",
111
111
  "required": false,
112
112
  "builtin": true
113
+ },
114
+ {
115
+ "name": "file-preview",
116
+ "source": "npm",
117
+ "npm": "@capybara-hq/plugin-file-preview",
118
+ "version": "0.1.0-rc.1",
119
+ "integrity": "sha512-kDbkk0G7uCM/Id9HNfJpUXf4zu4w0mMmaenw6bmUiqLEMUVgQf2VOB3i2jj2HVhaqsfc3qElTEYupTq+zpLVpQ==",
120
+ "required": false,
121
+ "builtin": true
113
122
  }
114
123
  ]
115
124
  }
@@ -58,6 +58,12 @@ export declare const DeploymentSettingsBody: z.ZodObject<{
58
58
  enabled: z.ZodOptional<z.ZodBoolean>;
59
59
  disabled: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
60
  }, z.core.$strict>>;
61
+ devicesFullAccess: z.ZodOptional<z.ZodObject<{
62
+ permission: z.ZodNullable<z.ZodEnum<{
63
+ allowed: "allowed";
64
+ off: "off";
65
+ }>>;
66
+ }, z.core.$strict>>;
61
67
  devicesAutoMode: z.ZodOptional<z.ZodObject<{
62
68
  mode: z.ZodNullable<z.ZodEnum<{
63
69
  allowed: "allowed";
@@ -2,6 +2,7 @@ import { SuperAdminLock } from "../identity/super-admin.js";
2
2
  import type { WriteActor } from "../identity/write-actor.js";
3
3
  import { TransactionHost } from "../infra/database/transaction-host.js";
4
4
  import { type OrgNetworkAllowance, OrgNetworkAllowances } from "../orgs/network-allowances.service.js";
5
+ import { OrgLock } from "../orgs/org-lock.js";
5
6
  import { OrgsService } from "../orgs/orgs.service.js";
6
7
  /**
7
8
  * The super admin's side of the org network allowances (plugin safe fetch spec): the admin routes
@@ -15,8 +16,9 @@ export declare class OrgNetworkAdmin {
15
16
  private readonly allowances;
16
17
  private readonly orgs;
17
18
  private readonly adminLock;
19
+ private readonly orgLock;
18
20
  readonly txHost: TransactionHost;
19
- constructor(allowances: OrgNetworkAllowances, orgs: OrgsService, adminLock: SuperAdminLock, txHost: TransactionHost);
21
+ constructor(allowances: OrgNetworkAllowances, orgs: OrgsService, adminLock: SuperAdminLock, orgLock: OrgLock, txHost: TransactionHost);
20
22
  /** The org's entries, oldest first; a missing or deleted org is `org.not_found`. */
21
23
  list(orgId: string): Promise<OrgNetworkAllowance[]>;
22
24
  /**
@@ -13,6 +13,7 @@ import { SuperAdminLock } from "../identity/super-admin.js";
13
13
  import { TransactionHost } from "../infra/database/transaction-host.js";
14
14
  import { Transactional } from "../infra/database/transactional.decorator.js";
15
15
  import { allowanceEntryProblem, OrgNetworkAllowances, } from "../orgs/network-allowances.service.js";
16
+ import { OrgLock } from "../orgs/org-lock.js";
16
17
  import { OrgsService } from "../orgs/orgs.service.js";
17
18
  /**
18
19
  * The super admin's side of the org network allowances (plugin safe fetch spec): the admin routes
@@ -26,11 +27,13 @@ let OrgNetworkAdmin = class OrgNetworkAdmin {
26
27
  allowances;
27
28
  orgs;
28
29
  adminLock;
30
+ orgLock;
29
31
  txHost;
30
- constructor(allowances, orgs, adminLock, txHost) {
32
+ constructor(allowances, orgs, adminLock, orgLock, txHost) {
31
33
  this.allowances = allowances;
32
34
  this.orgs = orgs;
33
35
  this.adminLock = adminLock;
36
+ this.orgLock = orgLock;
34
37
  this.txHost = txHost;
35
38
  }
36
39
  /** The org's entries, oldest first; a missing or deleted org is `org.not_found`. */
@@ -58,6 +61,10 @@ let OrgNetworkAdmin = class OrgNetworkAdmin {
58
61
  */
59
62
  async add(orgId, entry, actor, onlyNarrows, auditDetail = {}) {
60
63
  assertWidenAllowed(onlyNarrows);
64
+ // the target org's row before the super admin lock (the global order: a fenced super admin
65
+ // write in that org holds its org row when it takes the super admin lock); a missing org locks
66
+ // nothing here and is refused by the store after the actor check, as before
67
+ await this.orgLock.tryLock(orgId);
61
68
  await this.adminLock.lockAndAuthorize(actor.accountId);
62
69
  return this.allowances.add(orgId, entry, actor, auditDetail);
63
70
  }
@@ -90,7 +97,8 @@ OrgNetworkAdmin = __decorate([
90
97
  __param(0, Inject(OrgNetworkAllowances)),
91
98
  __param(1, Inject(OrgsService)),
92
99
  __param(2, Inject(SuperAdminLock)),
93
- __param(3, Inject(TransactionHost))
100
+ __param(3, Inject(OrgLock)),
101
+ __param(4, Inject(TransactionHost))
94
102
  ], OrgNetworkAdmin);
95
103
  export { OrgNetworkAdmin };
96
104
  /** Only a person in a web session widens what an org's extension requests may reach. */
package/dist/app.d.ts CHANGED
@@ -11,6 +11,10 @@ import type { KernelLogger } from "./log.js";
11
11
  import type { KernelOverride } from "./overrides.js";
12
12
  /** What {@link createKernelApp} takes besides the config. */
13
13
  export interface KernelAppOptions {
14
+ /** Explicit startup CAS intent; never a reloadable configuration value. */
15
+ permissionConfigActivation?: Readonly<{
16
+ expectedActiveHash: string;
17
+ }>;
14
18
  /** 配置来源;提供 `watch` 时启用热更新。 */
15
19
  source?: ConfigSource;
16
20
  /** 解析插件裸包名的目录,默认 `process.cwd()`;相对路径按当前 cwd 解析。 */
package/dist/app.js CHANGED
@@ -10,6 +10,7 @@ import { setupSwagger } from "./infra/swagger/swagger.js";
10
10
  import { KernelModule } from "./kernel.module.js";
11
11
  import { KernelLifecycle } from "./lifecycle/kernel-lifecycle.js";
12
12
  import { createConfiguredLogger } from "./log-config.js";
13
+ import { validatePermissionConfigActivation } from "./sandbox/permission-config-publication.js";
13
14
  /**
14
15
  * Builds the kernel application (one Nest application, root module {@link KernelModule}) and sets
15
16
  * up its HTTP side, without initializing it: nothing connects and nothing starts. A failure
@@ -18,6 +19,7 @@ import { createConfiguredLogger } from "./log-config.js";
18
19
  * application before its start; everything else uses {@link createKernelApp}.
19
20
  */
20
21
  export async function buildKernelApp(config, options = {}) {
22
+ validatePermissionConfigActivation(options.permissionConfigActivation);
21
23
  const logger = options.logger ?? createConfiguredLogger(config);
22
24
  const app = await NestFactory.create(KernelModule.forRoot(config, { ...options, logger }), createKernelAdapter(config.http.trustProxy), { logger: new NestLogAdapter(logger), abortOnError: false });
23
25
  const lifecycle = app.get(KernelLifecycle);
@@ -1,4 +1,5 @@
1
1
  import { EventLog } from "../conversations/event-log.js";
2
+ import { KernelDb } from "../infra/database/kernel-db.js";
2
3
  import { TransactionHost } from "../infra/database/transaction-host.js";
3
4
  import { KernelEvents } from "../infra/events/kernel-events.js";
4
5
  import { OutboxService } from "../infra/outbox/outbox.service.js";
@@ -31,7 +32,8 @@ export declare class BackgroundTaskFinisher {
31
32
  private readonly events;
32
33
  readonly txHost: TransactionHost;
33
34
  private readonly outbox;
34
- constructor(store: Pick<BackgroundTaskStore, "finish">, eventLog: EventLog, events: KernelEvents, txHost: TransactionHost, outbox: Pick<OutboxService, "add">);
35
+ private readonly db;
36
+ constructor(store: Pick<BackgroundTaskStore, "finish">, eventLog: EventLog, events: KernelEvents, txHost: TransactionHost, outbox: Pick<OutboxService, "add">, db: KernelDb);
35
37
  /**
36
38
  * Finishes `task` as `to` with its last output lines (cut to their last 4 000 characters);
37
39
  * `reported` when a tool call already told the model in its run. False (nothing written) when the
@@ -39,6 +41,12 @@ export declare class BackgroundTaskFinisher {
39
41
  * the stop's finish is then the only one. `opts.stoppedBy` marks a stop that must never wake the
40
42
  * conversation: `"person"` (a person stopped it) or `"deletion"` (its conversation is being
41
43
  * deleted).
44
+ *
45
+ * A managed task (permission runtime cutover phase 8.3) settles its durable launch state in the
46
+ * same transaction: a verified end (an exit, a stop) is `terminal` and retires its start intent's
47
+ * running authority (`background-running` to `completed`, so no revocation selects it again); a
48
+ * lost one keeps `cancel-pending` and its intent, an obligation that outlives the finish. The
49
+ * intent row is locked before the task row, the order every authority writer takes.
42
50
  */
43
51
  finish(task: BackgroundTaskRow, to: BackgroundFinish, lastLines: string, reported: boolean, opts?: {
44
52
  unclaimed?: boolean;
@@ -10,14 +10,16 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { Inject, Injectable } from "@nestjs/common";
11
11
  import { EventLog } from "../conversations/event-log.js";
12
12
  import { afterCommit } from "../infra/database/after-commit.js";
13
+ import { KernelDb } from "../infra/database/kernel-db.js";
13
14
  import { TransactionHost } from "../infra/database/transaction-host.js";
14
15
  import { Transactional } from "../infra/database/transactional.decorator.js";
15
16
  import { KernelEvents } from "../infra/events/kernel-events.js";
16
17
  import { OutboxService } from "../infra/outbox/outbox.service.js";
17
18
  import { oweEnsureRun } from "../runtime/run-jobs.js";
19
+ import { OPERATION_REVOKE } from "../sandbox/operation-intents.js";
18
20
  import { taskOutputFile } from "./launch.js";
19
21
  import { LAST_LINES_MAX_CHARS } from "./session.js";
20
- import { BackgroundTaskStore } from "./store.js";
22
+ import { BackgroundTaskStore, isManagedTask } from "./store.js";
21
23
  /** The idempotency key of a task's `background_task_finished` event. */
22
24
  export const finishedEventKey = (taskId) => `background_task_finished:${taskId}`;
23
25
  /**
@@ -38,12 +40,14 @@ let BackgroundTaskFinisher = class BackgroundTaskFinisher {
38
40
  events;
39
41
  txHost;
40
42
  outbox;
41
- constructor(store, eventLog, events, txHost, outbox) {
43
+ db;
44
+ constructor(store, eventLog, events, txHost, outbox, db) {
42
45
  this.store = store;
43
46
  this.eventLog = eventLog;
44
47
  this.events = events;
45
48
  this.txHost = txHost;
46
49
  this.outbox = outbox;
50
+ this.db = db;
47
51
  }
48
52
  /**
49
53
  * Finishes `task` as `to` with its last output lines (cut to their last 4 000 characters);
@@ -52,10 +56,58 @@ let BackgroundTaskFinisher = class BackgroundTaskFinisher {
52
56
  * the stop's finish is then the only one. `opts.stoppedBy` marks a stop that must never wake the
53
57
  * conversation: `"person"` (a person stopped it) or `"deletion"` (its conversation is being
54
58
  * deleted).
59
+ *
60
+ * A managed task (permission runtime cutover phase 8.3) settles its durable launch state in the
61
+ * same transaction: a verified end (an exit, a stop) is `terminal` and retires its start intent's
62
+ * running authority (`background-running` to `completed`, so no revocation selects it again); a
63
+ * lost one keeps `cancel-pending` and its intent, an obligation that outlives the finish. The
64
+ * intent row is locked before the task row, the order every authority writer takes.
55
65
  */
56
66
  async finish(task, to, lastLines, reported, opts = {}) {
57
- if (!(await this.store.finish(task.id, to, opts)))
67
+ const managed = isManagedTask(task)
68
+ ? to.status === "lost"
69
+ ? "cancel-pending"
70
+ : "terminal"
71
+ : undefined;
72
+ if (managed !== undefined && task.operationId !== null)
73
+ await this.db
74
+ .selectFrom("sandbox_operation_intents")
75
+ .select("operation_id")
76
+ .where("operation_id", "=", task.operationId)
77
+ .forUpdate()
78
+ .executeTakeFirst();
79
+ if (!(await this.store.finish(task.id, to, {
80
+ ...(opts.unclaimed !== undefined && { unclaimed: opts.unclaimed }),
81
+ ...(managed !== undefined && { managed }),
82
+ })))
58
83
  return false;
84
+ if (managed === "terminal" && task.operationId !== null)
85
+ await this.db
86
+ .updateTable("sandbox_operation_intents")
87
+ .set({ state: "completed", updated_at: new Date() })
88
+ .where("operation_id", "=", task.operationId)
89
+ .where("state", "=", "background-running")
90
+ .execute();
91
+ // A lost end (supervision lost, instance gone or replaced) is no proof the process is gone:
92
+ // its running authority is retired and the exact cancellation is owed to the revoke worker,
93
+ // which acknowledges it only on a verified stop (an unresolvable one waits for retirement).
94
+ if (managed === "cancel-pending" && task.operationId !== null) {
95
+ const retired = await this.db
96
+ .updateTable("sandbox_operation_intents")
97
+ .set({ state: "revoked", outcome_unknown: true, updated_at: new Date() })
98
+ .where("operation_id", "=", task.operationId)
99
+ .where("state", "=", "background-running")
100
+ .returning("operation_id")
101
+ .executeTakeFirst();
102
+ if (retired)
103
+ await this.outbox.add({
104
+ queue: "cap-kernel-maintenance",
105
+ name: OPERATION_REVOKE,
106
+ jobId: `${OPERATION_REVOKE}-${retired.operation_id}`,
107
+ data: { operationId: retired.operation_id },
108
+ orgId: task.orgId,
109
+ });
110
+ }
59
111
  const [event] = await this.eventLog.appendIn(task.conversationId, [
60
112
  {
61
113
  type: "background_task_finished",
@@ -101,6 +153,7 @@ BackgroundTaskFinisher = __decorate([
101
153
  __param(1, Inject(EventLog)),
102
154
  __param(2, Inject(KernelEvents)),
103
155
  __param(3, Inject(TransactionHost)),
104
- __param(4, Inject(OutboxService))
156
+ __param(4, Inject(OutboxService)),
157
+ __param(5, Inject(KernelDb))
105
158
  ], BackgroundTaskFinisher);
106
159
  export { BackgroundTaskFinisher };
@@ -1,3 +1,4 @@
1
+ import { type SandboxOperationScope } from "@capybara-hq/plugin-sdk";
1
2
  import type { KernelConfig } from "../config/schema.js";
2
3
  /**
3
4
  * Launching a background Bash task (spec 2026-11-05-background-bash-design §4.2): the task id, the
@@ -79,3 +80,25 @@ export declare const GROUP_LAUNCHER: string;
79
80
  export declare function launchScript(id: string, command: string, seconds: number): string;
80
81
  /** The model-visible result of a launch (spec §2.1); `workspace`: the instance's workspace root. */
81
82
  export declare function startedText(id: string, description: string, workspace?: string): string;
83
+ /**
84
+ * The artifact of a managed task (permission runtime cutover §"Artifact location decision"):
85
+ * `${workingRoot}/.capybara/tasks/${taskId}.out`, where the working root is the trusted root the
86
+ * command executes in (the selected project's root, else the device workspace). Never a
87
+ * caller-selected path, never roots.tmp or the default workspace as a fallback.
88
+ */
89
+ export declare function managedTaskArtifactPath(workingRoot: string, taskId: string): string;
90
+ /**
91
+ * Checks, before any effect, that a managed start's artifact is the deterministic placement under
92
+ * its working root and is covered by the admitted starting write roots and the implicit write
93
+ * protections (no `.git` component: devices deny Git configuration and hooks). Full access
94
+ * (`device` filesystem scope) uses the same placement. Throws {@link SandboxScopeDeniedError}:
95
+ * no fallback location, no added root or grant.
96
+ */
97
+ export declare function assertManagedArtifactAdmitted(scope: Pick<SandboxOperationScope, "filesystem">, args: {
98
+ cwd: string;
99
+ taskId: string;
100
+ outputPath: string;
101
+ retainUntilMs: number;
102
+ }): void;
103
+ /** The model-visible result of an acknowledged managed launch; `outputPath` is its artifact. */
104
+ export declare function managedStartedText(id: string, description: string, outputPath: string): string;
@@ -1,5 +1,5 @@
1
1
  import { randomBytes } from "node:crypto";
2
- import { BACKGROUND_LAUNCH_LINE, DEFAULT_SANDBOX_ROOTS } from "@capybara-hq/plugin-sdk";
2
+ import { BACKGROUND_LAUNCH_LINE, DEFAULT_SANDBOX_ROOTS, SandboxScopeDeniedError, } from "@capybara-hq/plugin-sdk";
3
3
  /**
4
4
  * Launching a background Bash task (spec 2026-11-05-background-bash-design §4.2): the task id, the
5
5
  * one short exec that starts the command detached from the exec, and the model-visible result.
@@ -158,3 +158,57 @@ export function startedText(id, description, workspace = DEFAULT_SANDBOX_ROOTS.w
158
158
  "Read it with TaskOutput (or Read), stop it with TaskStop. You will be told when it finishes.",
159
159
  ].join("\n");
160
160
  }
161
+ /**
162
+ * The artifact of a managed task (permission runtime cutover §"Artifact location decision"):
163
+ * `${workingRoot}/.capybara/tasks/${taskId}.out`, where the working root is the trusted root the
164
+ * command executes in (the selected project's root, else the device workspace). Never a
165
+ * caller-selected path, never roots.tmp or the default workspace as a fallback.
166
+ */
167
+ export function managedTaskArtifactPath(workingRoot, taskId) {
168
+ if (!TASK_ID_RE.test(taskId))
169
+ throw new Error(`invalid background task id: ${taskId}`);
170
+ return `${workingRoot === "/" ? "" : workingRoot}/${taskOutputPath(taskId)}`;
171
+ }
172
+ /** An absolute path without empty, `.` or `..` components or a trailing slash. */
173
+ const isNormalAbsolute = (p) => p === "/" ||
174
+ (p.startsWith("/") &&
175
+ p
176
+ .split("/")
177
+ .slice(1)
178
+ .every((c) => c !== "" && c !== "." && c !== ".."));
179
+ /** Whether `path` is `root` or inside it (both normalized absolute paths). */
180
+ const within = (path, root) => root === "/" || path === root || path.startsWith(`${root}/`);
181
+ /**
182
+ * Checks, before any effect, that a managed start's artifact is the deterministic placement under
183
+ * its working root and is covered by the admitted starting write roots and the implicit write
184
+ * protections (no `.git` component: devices deny Git configuration and hooks). Full access
185
+ * (`device` filesystem scope) uses the same placement. Throws {@link SandboxScopeDeniedError}:
186
+ * no fallback location, no added root or grant.
187
+ */
188
+ export function assertManagedArtifactAdmitted(scope, args) {
189
+ const deny = (why) => {
190
+ throw new SandboxScopeDeniedError(`The background task output cannot be created: ${why}. Choose a working directory this conversation may write to, then retry.`);
191
+ };
192
+ if (!TASK_ID_RE.test(args.taskId))
193
+ deny("the task id is invalid");
194
+ if (!isNormalAbsolute(args.cwd))
195
+ deny("the working root is not a normalized absolute path");
196
+ if (args.outputPath !== managedTaskArtifactPath(args.cwd, args.taskId))
197
+ deny("the output path is not the task's placement under its working root");
198
+ if (!Number.isSafeInteger(args.retainUntilMs) || args.retainUntilMs <= 0)
199
+ deny("the retention deadline is invalid");
200
+ // case-insensitive: a case-insensitive file system resolves `.GIT` to `.git`
201
+ if (args.outputPath.split("/").some((c) => c.toLowerCase() === ".git"))
202
+ deny("the working root is inside protected Git metadata");
203
+ const fs = scope.filesystem;
204
+ if (fs.kind === "scoped" && !fs.writeRoots.some((root) => within(args.outputPath, root)))
205
+ deny(`${args.outputPath} is outside the admitted write roots`);
206
+ }
207
+ /** The model-visible result of an acknowledged managed launch; `outputPath` is its artifact. */
208
+ export function managedStartedText(id, description, outputPath) {
209
+ return [
210
+ `Started background task ${id} ("${description}").`,
211
+ `Output: ${outputPath}`,
212
+ "Read it with TaskOutput (or Read), stop it with TaskStop. You will be told when it finishes.",
213
+ ].join("\n");
214
+ }
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Bounded assembly of a managed background task's retained output (permission runtime cutover
3
+ * phase 8.3, design §B5). Pure: it only calls the {@link OutputReader} it is given, which reads
4
+ * by the task's exact execution ref (`SandboxBackground.readOutput`: no path, no exec, no
5
+ * resume). Every range is read as adjacent bounded requests at the next unassembled offset, so a
6
+ * transport capacity below 4,096 bytes (even one byte) still progresses; a capacity of zero with
7
+ * unread bytes is a deterministic error, never EOF. Memory stays bounded: at most the 4,096-byte
8
+ * parser history plus one fresh window (and the caller's own result budget), never the full
9
+ * retained output.
10
+ */
11
+ /** One successful `SandboxBackground.readOutput` answer. */
12
+ export interface OutputSlice {
13
+ data: Uint8Array;
14
+ offset: number;
15
+ nextOffset: number;
16
+ totalBytes: number;
17
+ }
18
+ /** Reads `maxBytes` retained bytes at `offset` by the task's exact ref (no path, no exec). */
19
+ export type OutputReader = (offset: number, maxBytes: number) => Promise<OutputSlice | {
20
+ unavailable: "lost" | "expired";
21
+ }>;
22
+ /**
23
+ * The retained output cannot be read: `lost` (missing or untrustworthy storage, or a snapshot
24
+ * that regressed), `expired` (its retention ended), `mismatch` (the kernel's cursor is past the
25
+ * retained snapshot). The cursor never moves on any of them.
26
+ */
27
+ export declare class ManagedOutputUnavailableError extends Error {
28
+ readonly reason: "lost" | "expired" | "mismatch";
29
+ constructor(reason: "lost" | "expired" | "mismatch", message: string);
30
+ }
31
+ /** Unread bytes cannot fit the negotiated transport capacity (the reads return nothing). */
32
+ export declare class ManagedOutputCapacityError extends Error {
33
+ constructor();
34
+ }
35
+ /** The provider's semantic read bound (decoded bytes per read). */
36
+ export declare const MANAGED_READ_MAX_BYTES = 65536;
37
+ /** Already-delivered bytes the login-prompt parser sees again before the new ones. */
38
+ export declare const OUTPUT_HISTORY_BYTES = 4096;
39
+ /** The most new bytes one assembly window covers (history plus window fit 65,536 bytes). */
40
+ export declare const FRESH_WINDOW_MAX_BYTES = 61440;
41
+ /** The fewest: any one UTF-8 character fits. */
42
+ export declare const FRESH_WINDOW_MIN_BYTES = 4;
43
+ /** The finish and stop summaries keep at most this many lines. */
44
+ export declare const LAST_LINES_MAX_LINES = 20;
45
+ /**
46
+ * The committed total of the retained output (a zero-budget metadata probe). Throws
47
+ * {@link ManagedOutputUnavailableError} when the record is lost or expired.
48
+ */
49
+ export declare function probeOutput(read: OutputReader, signal?: AbortSignal): Promise<number>;
50
+ /**
51
+ * Every byte of `[start, end)` of the snapshot whose total was `snapshot` (`end <= snapshot`),
52
+ * read as adjacent requests of at most min(65,536, end - position) bytes each, at the next
53
+ * unassembled offset. A later read may report a larger total (the output grew): its bytes past
54
+ * `end` are never requested. A total below `snapshot` is a lost record, not EOF; a read that
55
+ * returns nothing while bytes remain is a capacity error.
56
+ */
57
+ export declare function readOutputRange(read: OutputReader, start: number, end: number, snapshot: number, signal?: AbortSignal): Promise<Uint8Array>;
58
+ /**
59
+ * The bytes still missing to complete the character `buf` ends inside, 0 when it ends on a
60
+ * character boundary (or on bytes that can never form one: those decode as replacements).
61
+ */
62
+ export declare function missingUtf8Bytes(buf: Uint8Array): number;
63
+ /** What one `TaskOutput` assembly delivered. */
64
+ export interface TaskOutputAssembly {
65
+ /** The committed total N the probe captured; growth after it is left for the next read. */
66
+ snapshot: number;
67
+ /** The up to 4,096 already-delivered bytes before the cursor (parser history only). */
68
+ history: Uint8Array;
69
+ /** The raw bytes delivered as text now (the cursor advances by exactly their length). */
70
+ delivered: Uint8Array;
71
+ /** `delivered` decoded (replacement characters only for invalid or terminal-incomplete bytes). */
72
+ text: string;
73
+ /** History plus delivered, decoded: what the login-prompt parser reads. */
74
+ parserText: string;
75
+ /** The cursor after this answer: the old cursor plus `delivered.length`. */
76
+ nextOffset: number;
77
+ /** Bytes of the snapshot still unread: max(snapshot - nextOffset, 0). */
78
+ remaining: number;
79
+ /** True when a live incomplete trailing character was left for a later read. */
80
+ withheld: boolean;
81
+ }
82
+ /**
83
+ * `TaskOutput`'s read (design §B5): probe N; re-read the parser history `[max(0, R - 4096), R)`;
84
+ * then assemble fresh windows of min(max(budget, 4), 61,440) bytes from the cursor R up to N or
85
+ * `budget` bytes, fetching up to three adjacent bytes to complete a character a window cut. On a
86
+ * live stream (or before the snapshot's end) only whole characters are delivered; at a verified
87
+ * terminal end (`terminal`, established before the probe) every remaining byte is delivered with
88
+ * replacement decoding. A cursor past N is unavailable (`mismatch`), never moved back.
89
+ */
90
+ export declare function assembleTaskOutput(read: OutputReader, opts: {
91
+ offset: number;
92
+ budget: number;
93
+ terminal: boolean;
94
+ signal?: AbortSignal;
95
+ }): Promise<TaskOutputAssembly>;
96
+ /**
97
+ * The HTTP output suffix (design §B5): probe N, then every byte of `[max(0, N - tailBytes), N)`
98
+ * through adjacent bounded reads. N stays the end even when later reads report a larger total.
99
+ * A cut suffix drops only its leading partial character; no line limit applies.
100
+ */
101
+ export declare function assembleOutputSuffix(read: OutputReader, tailBytes: number, signal?: AbortSignal): Promise<{
102
+ text: string;
103
+ truncated: boolean;
104
+ end: number;
105
+ }>;
106
+ /**
107
+ * A finish or stop summary from a tail: the last 20 lines (a final newline does not count as a
108
+ * line), at most the last 4,000 characters, decoded with replacement characters.
109
+ */
110
+ export declare function lastLinesOf(bytes: Uint8Array): string;