@nexum-hub/agent 0.0.0-stage → 0.0.2

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 (343) hide show
  1. package/README.md +133 -2
  2. package/contracts/v2/common.schema.json +262 -0
  3. package/contracts/v2/fixtures/inputs.json +244 -0
  4. package/contracts/v2/fixtures/wire.json +6493 -0
  5. package/contracts/v2/model/agent.close.input.schema.json +14 -0
  6. package/contracts/v2/model/agent.close.output.schema.json +101 -0
  7. package/contracts/v2/model/agent.list.input.schema.json +57 -0
  8. package/contracts/v2/model/agent.list.output.schema.json +220 -0
  9. package/contracts/v2/model/agent.open.input.schema.json +35 -0
  10. package/contracts/v2/model/agent.open.output.schema.json +41 -0
  11. package/contracts/v2/model/agent.run.cancel.input.schema.json +18 -0
  12. package/contracts/v2/model/agent.run.cancel.output.schema.json +100 -0
  13. package/contracts/v2/model/agent.run.get.input.schema.json +41 -0
  14. package/contracts/v2/model/agent.run.get.output.schema.json +100 -0
  15. package/contracts/v2/model/agent.run.input.input.schema.json +30 -0
  16. package/contracts/v2/model/agent.run.input.output.schema.json +100 -0
  17. package/contracts/v2/model/agent.run.list.input.schema.json +47 -0
  18. package/contracts/v2/model/agent.run.list.output.schema.json +41 -0
  19. package/contracts/v2/model/agent.run.start.input.schema.json +73 -0
  20. package/contracts/v2/model/agent.run.start.output.schema.json +100 -0
  21. package/contracts/v2/wire/bodies.schema.json +383 -0
  22. package/contracts/v2/wire/envelope.schema.json +2280 -0
  23. package/contracts/v2/wire/events.schema.json +242 -0
  24. package/contracts/v2/wire/maintenance.schema.json +308 -0
  25. package/contracts/v2/wire/operations.schema.json +1791 -0
  26. package/contracts/v2/wire/stream.schema.json +74 -0
  27. package/contracts/v2/wire/types.schema.json +2616 -0
  28. package/dist/adapters/mcp-http.d.ts +22 -0
  29. package/dist/adapters/mcp-http.js +472 -0
  30. package/dist/adapters/mcp-http.js.map +1 -0
  31. package/dist/adapters/mcp-oauth.d.ts +29 -0
  32. package/dist/adapters/mcp-oauth.js +653 -0
  33. package/dist/adapters/mcp-oauth.js.map +1 -0
  34. package/dist/adapters/mcp-wire.d.ts +21 -0
  35. package/dist/adapters/mcp-wire.js +307 -0
  36. package/dist/adapters/mcp-wire.js.map +1 -0
  37. package/dist/adapters/mcp.d.ts +56 -0
  38. package/dist/adapters/mcp.js +1989 -0
  39. package/dist/adapters/mcp.js.map +1 -0
  40. package/dist/adapters/openapi-http.d.ts +29 -0
  41. package/dist/adapters/openapi-http.js +504 -0
  42. package/dist/adapters/openapi-http.js.map +1 -0
  43. package/dist/adapters/openapi-request.d.ts +26 -0
  44. package/dist/adapters/openapi-request.js +597 -0
  45. package/dist/adapters/openapi-request.js.map +1 -0
  46. package/dist/adapters/openapi-schema.d.ts +22 -0
  47. package/dist/adapters/openapi-schema.js +471 -0
  48. package/dist/adapters/openapi-schema.js.map +1 -0
  49. package/dist/adapters/openapi-typegen.d.ts +11 -0
  50. package/dist/adapters/openapi-typegen.js +185 -0
  51. package/dist/adapters/openapi-typegen.js.map +1 -0
  52. package/dist/adapters/openapi-types.d.ts +99 -0
  53. package/dist/adapters/openapi-types.js +2 -0
  54. package/dist/adapters/openapi-types.js.map +1 -0
  55. package/dist/adapters/openapi.d.ts +7 -0
  56. package/dist/adapters/openapi.js +768 -0
  57. package/dist/adapters/openapi.js.map +1 -0
  58. package/dist/application/activation.d.ts +28 -0
  59. package/dist/application/activation.js +289 -0
  60. package/dist/application/activation.js.map +1 -0
  61. package/dist/application/attachments.d.ts +24 -0
  62. package/dist/application/attachments.js +87 -0
  63. package/dist/application/attachments.js.map +1 -0
  64. package/dist/application/authority.d.ts +32 -0
  65. package/dist/application/authority.js +213 -0
  66. package/dist/application/authority.js.map +1 -0
  67. package/dist/application/catalog.d.ts +11 -0
  68. package/dist/application/catalog.js +177 -0
  69. package/dist/application/catalog.js.map +1 -0
  70. package/dist/application/config.d.ts +24 -0
  71. package/dist/application/config.js +140 -0
  72. package/dist/application/config.js.map +1 -0
  73. package/dist/application/connection.d.ts +35 -0
  74. package/dist/application/connection.js +465 -0
  75. package/dist/application/connection.js.map +1 -0
  76. package/dist/application/data-plane.d.ts +35 -0
  77. package/dist/application/data-plane.js +437 -0
  78. package/dist/application/data-plane.js.map +1 -0
  79. package/dist/application/diagnostics.d.ts +4 -0
  80. package/dist/application/diagnostics.js +65 -0
  81. package/dist/application/diagnostics.js.map +1 -0
  82. package/dist/application/dispatcher.d.ts +4 -0
  83. package/dist/application/dispatcher.js +16 -0
  84. package/dist/application/dispatcher.js.map +1 -0
  85. package/dist/application/main.d.ts +12 -0
  86. package/dist/application/main.js +167 -0
  87. package/dist/application/main.js.map +1 -0
  88. package/dist/application/maintenance.d.ts +27 -0
  89. package/dist/application/maintenance.js +244 -0
  90. package/dist/application/maintenance.js.map +1 -0
  91. package/dist/application/packages.d.ts +25 -0
  92. package/dist/application/packages.js +208 -0
  93. package/dist/application/packages.js.map +1 -0
  94. package/dist/application/processes.d.ts +49 -0
  95. package/dist/application/processes.js +180 -0
  96. package/dist/application/processes.js.map +1 -0
  97. package/dist/application/run-view.d.ts +17 -0
  98. package/dist/application/run-view.js +286 -0
  99. package/dist/application/run-view.js.map +1 -0
  100. package/dist/application/runtime.d.ts +78 -0
  101. package/dist/application/runtime.js +1747 -0
  102. package/dist/application/runtime.js.map +1 -0
  103. package/dist/application/tasks.d.ts +38 -0
  104. package/dist/application/tasks.js +23 -0
  105. package/dist/application/tasks.js.map +1 -0
  106. package/dist/application/user-state.d.ts +20 -0
  107. package/dist/application/user-state.js +52 -0
  108. package/dist/application/user-state.js.map +1 -0
  109. package/dist/application/work-git.d.ts +14 -0
  110. package/dist/application/work-git.js +67 -0
  111. package/dist/application/work-git.js.map +1 -0
  112. package/dist/cli.d.ts +2 -0
  113. package/dist/cli.js +40 -0
  114. package/dist/cli.js.map +1 -0
  115. package/dist/contracts/caller.d.ts +51 -0
  116. package/dist/contracts/caller.js +95 -0
  117. package/dist/contracts/caller.js.map +1 -0
  118. package/dist/contracts/error-data.d.ts +6 -0
  119. package/dist/contracts/error-data.js +51 -0
  120. package/dist/contracts/error-data.js.map +1 -0
  121. package/dist/contracts/errors.d.ts +10 -0
  122. package/dist/contracts/errors.js +28 -0
  123. package/dist/contracts/errors.js.map +1 -0
  124. package/dist/contracts/json.d.ts +9 -0
  125. package/dist/contracts/json.js +104 -0
  126. package/dist/contracts/json.js.map +1 -0
  127. package/dist/contracts/types.d.ts +122 -0
  128. package/dist/contracts/types.js +19 -0
  129. package/dist/contracts/types.js.map +1 -0
  130. package/dist/contracts/validation.d.ts +4 -0
  131. package/dist/contracts/validation.js +157 -0
  132. package/dist/contracts/validation.js.map +1 -0
  133. package/dist/contracts/wire-validation.d.ts +9 -0
  134. package/dist/contracts/wire-validation.js +399 -0
  135. package/dist/contracts/wire-validation.js.map +1 -0
  136. package/dist/contracts/wire.d.ts +1083 -0
  137. package/dist/contracts/wire.js +62 -0
  138. package/dist/contracts/wire.js.map +1 -0
  139. package/dist/extension-api.d.ts +12 -0
  140. package/dist/extension-api.js +2 -0
  141. package/dist/extension-api.js.map +1 -0
  142. package/dist/extensions/api.d.ts +72 -0
  143. package/dist/extensions/api.js +2 -0
  144. package/dist/extensions/api.js.map +1 -0
  145. package/dist/extensions/host-requests.d.ts +23 -0
  146. package/dist/extensions/host-requests.js +60 -0
  147. package/dist/extensions/host-requests.js.map +1 -0
  148. package/dist/extensions/materials.d.ts +37 -0
  149. package/dist/extensions/materials.js +691 -0
  150. package/dist/extensions/materials.js.map +1 -0
  151. package/dist/extensions/package-loader.d.ts +28 -0
  152. package/dist/extensions/package-loader.js +177 -0
  153. package/dist/extensions/package-loader.js.map +1 -0
  154. package/dist/extensions/packages.d.ts +73 -0
  155. package/dist/extensions/packages.js +441 -0
  156. package/dist/extensions/packages.js.map +1 -0
  157. package/dist/extensions/registry.d.ts +92 -0
  158. package/dist/extensions/registry.js +1540 -0
  159. package/dist/extensions/registry.js.map +1 -0
  160. package/dist/extensions/resources.d.ts +105 -0
  161. package/dist/extensions/resources.js +595 -0
  162. package/dist/extensions/resources.js.map +1 -0
  163. package/dist/extensions/state.d.ts +25 -0
  164. package/dist/extensions/state.js +10 -0
  165. package/dist/extensions/state.js.map +1 -0
  166. package/dist/extensions/transfer.d.ts +81 -0
  167. package/dist/extensions/transfer.js +16 -0
  168. package/dist/extensions/transfer.js.map +1 -0
  169. package/dist/index.d.ts +7 -0
  170. package/dist/index.js +25 -0
  171. package/dist/index.js.map +1 -0
  172. package/dist/maintenance/configuration.d.ts +79 -0
  173. package/dist/maintenance/configuration.js +1503 -0
  174. package/dist/maintenance/configuration.js.map +1 -0
  175. package/dist/maintenance/credentials.d.ts +23 -0
  176. package/dist/maintenance/credentials.js +177 -0
  177. package/dist/maintenance/credentials.js.map +1 -0
  178. package/dist/maintenance/files.d.ts +2 -0
  179. package/dist/maintenance/files.js +40 -0
  180. package/dist/maintenance/files.js.map +1 -0
  181. package/dist/maintenance/npm.d.ts +71 -0
  182. package/dist/maintenance/npm.js +1013 -0
  183. package/dist/maintenance/npm.js.map +1 -0
  184. package/dist/maintenance/oauth.d.ts +45 -0
  185. package/dist/maintenance/oauth.js +686 -0
  186. package/dist/maintenance/oauth.js.map +1 -0
  187. package/dist/maintenance/requests.d.ts +347 -0
  188. package/dist/maintenance/requests.js +959 -0
  189. package/dist/maintenance/requests.js.map +1 -0
  190. package/dist/maintenance/work-git.d.ts +29 -0
  191. package/dist/maintenance/work-git.js +776 -0
  192. package/dist/maintenance/work-git.js.map +1 -0
  193. package/dist/process/backend.d.ts +54 -0
  194. package/dist/process/backend.js +39 -0
  195. package/dist/process/backend.js.map +1 -0
  196. package/dist/process/environment-windows.d.ts +15 -0
  197. package/dist/process/environment-windows.js +151 -0
  198. package/dist/process/environment-windows.js.map +1 -0
  199. package/dist/process/environment.d.ts +28 -0
  200. package/dist/process/environment.js +410 -0
  201. package/dist/process/environment.js.map +1 -0
  202. package/dist/process/launch.d.ts +31 -0
  203. package/dist/process/launch.js +281 -0
  204. package/dist/process/launch.js.map +1 -0
  205. package/dist/process/managed.d.ts +36 -0
  206. package/dist/process/managed.js +459 -0
  207. package/dist/process/managed.js.map +1 -0
  208. package/dist/process/output-log.d.ts +50 -0
  209. package/dist/process/output-log.js +552 -0
  210. package/dist/process/output-log.js.map +1 -0
  211. package/dist/process/pipes.d.ts +16 -0
  212. package/dist/process/pipes.js +588 -0
  213. package/dist/process/pipes.js.map +1 -0
  214. package/dist/process/pty.d.ts +22 -0
  215. package/dist/process/pty.js +512 -0
  216. package/dist/process/pty.js.map +1 -0
  217. package/dist/process/windows-conout-worker.d.ts +1 -0
  218. package/dist/process/windows-conout-worker.js +90 -0
  219. package/dist/process/windows-conout-worker.js.map +1 -0
  220. package/dist/process/windows-conout.d.ts +46 -0
  221. package/dist/process/windows-conout.js +140 -0
  222. package/dist/process/windows-conout.js.map +1 -0
  223. package/dist/process/windows-helper.d.ts +43 -0
  224. package/dist/process/windows-helper.js +255 -0
  225. package/dist/process/windows-helper.js.map +1 -0
  226. package/dist/process/windows-job.d.ts +39 -0
  227. package/dist/process/windows-job.js +224 -0
  228. package/dist/process/windows-job.js.map +1 -0
  229. package/dist/process/windows-pipes.d.ts +16 -0
  230. package/dist/process/windows-pipes.js +475 -0
  231. package/dist/process/windows-pipes.js.map +1 -0
  232. package/dist/results/artifacts.d.ts +118 -0
  233. package/dist/results/artifacts.js +873 -0
  234. package/dist/results/artifacts.js.map +1 -0
  235. package/dist/results/encoder.d.ts +57 -0
  236. package/dist/results/encoder.js +1179 -0
  237. package/dist/results/encoder.js.map +1 -0
  238. package/dist/results/mcp.d.ts +95 -0
  239. package/dist/results/mcp.js +656 -0
  240. package/dist/results/mcp.js.map +1 -0
  241. package/dist/results/media.d.ts +19 -0
  242. package/dist/results/media.js +301 -0
  243. package/dist/results/media.js.map +1 -0
  244. package/dist/results/normalize.d.ts +29 -0
  245. package/dist/results/normalize.js +464 -0
  246. package/dist/results/normalize.js.map +1 -0
  247. package/dist/runtime/control-scripts.d.ts +23 -0
  248. package/dist/runtime/control-scripts.js +242 -0
  249. package/dist/runtime/control-scripts.js.map +1 -0
  250. package/dist/runtime/engine.d.ts +177 -0
  251. package/dist/runtime/engine.js +1159 -0
  252. package/dist/runtime/engine.js.map +1 -0
  253. package/dist/runtime/globals.d.ts +1 -0
  254. package/dist/runtime/globals.js +31 -0
  255. package/dist/runtime/globals.js.map +1 -0
  256. package/dist/runtime/material-retention.d.ts +34 -0
  257. package/dist/runtime/material-retention.js +671 -0
  258. package/dist/runtime/material-retention.js.map +1 -0
  259. package/dist/runtime/modules.d.ts +50 -0
  260. package/dist/runtime/modules.js +320 -0
  261. package/dist/runtime/modules.js.map +1 -0
  262. package/dist/runtime/names.d.ts +2 -0
  263. package/dist/runtime/names.js +22 -0
  264. package/dist/runtime/names.js.map +1 -0
  265. package/dist/runtime/operations.d.ts +20 -0
  266. package/dist/runtime/operations.js +137 -0
  267. package/dist/runtime/operations.js.map +1 -0
  268. package/dist/runtime/paths.d.ts +3 -0
  269. package/dist/runtime/paths.js +38 -0
  270. package/dist/runtime/paths.js.map +1 -0
  271. package/dist/runtime/promises.d.ts +9 -0
  272. package/dist/runtime/promises.js +78 -0
  273. package/dist/runtime/promises.js.map +1 -0
  274. package/dist/runtime/retention.d.ts +88 -0
  275. package/dist/runtime/retention.js +735 -0
  276. package/dist/runtime/retention.js.map +1 -0
  277. package/dist/runtime/run-log.d.ts +30 -0
  278. package/dist/runtime/run-log.js +207 -0
  279. package/dist/runtime/run-log.js.map +1 -0
  280. package/dist/runtime/scripts.d.ts +84 -0
  281. package/dist/runtime/scripts.js +387 -0
  282. package/dist/runtime/scripts.js.map +1 -0
  283. package/dist/runtime/tasks.d.ts +54 -0
  284. package/dist/runtime/tasks.js +290 -0
  285. package/dist/runtime/tasks.js.map +1 -0
  286. package/dist/sdk/maintenance.d.ts +3 -0
  287. package/dist/sdk/maintenance.js +80 -0
  288. package/dist/sdk/maintenance.js.map +1 -0
  289. package/dist/sdk/output-extension.d.ts +3 -0
  290. package/dist/sdk/output-extension.js +44 -0
  291. package/dist/sdk/output-extension.js.map +1 -0
  292. package/dist/sdk/output.d.ts +52 -0
  293. package/dist/sdk/output.js +350 -0
  294. package/dist/sdk/output.js.map +1 -0
  295. package/dist/sdk/runtime.d.ts +3 -0
  296. package/dist/sdk/runtime.js +26 -0
  297. package/dist/sdk/runtime.js.map +1 -0
  298. package/dist/sdk/sh.d.ts +3 -0
  299. package/dist/sdk/sh.js +384 -0
  300. package/dist/sdk/sh.js.map +1 -0
  301. package/dist/sdk/state.d.ts +2 -0
  302. package/dist/sdk/state.js +69 -0
  303. package/dist/sdk/state.js.map +1 -0
  304. package/dist/sdk/transfer.d.ts +3 -0
  305. package/dist/sdk/transfer.js +141 -0
  306. package/dist/sdk/transfer.js.map +1 -0
  307. package/dist/services/extensions.d.ts +19 -0
  308. package/dist/services/extensions.js +183 -0
  309. package/dist/services/extensions.js.map +1 -0
  310. package/dist/services/state.d.ts +37 -0
  311. package/dist/services/state.js +125 -0
  312. package/dist/services/state.js.map +1 -0
  313. package/dist/services/transfer.d.ts +86 -0
  314. package/dist/services/transfer.js +948 -0
  315. package/dist/services/transfer.js.map +1 -0
  316. package/dist/storage/schema.d.ts +8 -0
  317. package/dist/storage/schema.js +241 -0
  318. package/dist/storage/schema.js.map +1 -0
  319. package/dist/storage/sqlite.d.ts +241 -0
  320. package/dist/storage/sqlite.js +1855 -0
  321. package/dist/storage/sqlite.js.map +1 -0
  322. package/dist/storage/transfers.d.ts +90 -0
  323. package/dist/storage/transfers.js +2 -0
  324. package/dist/storage/transfers.js.map +1 -0
  325. package/dist/transfer/io.d.ts +74 -0
  326. package/dist/transfer/io.js +425 -0
  327. package/dist/transfer/io.js.map +1 -0
  328. package/dist/transfer/offers.d.ts +72 -0
  329. package/dist/transfer/offers.js +380 -0
  330. package/dist/transfer/offers.js.map +1 -0
  331. package/dist/transfer/stream-slots.d.ts +12 -0
  332. package/dist/transfer/stream-slots.js +28 -0
  333. package/dist/transfer/stream-slots.js.map +1 -0
  334. package/dist/work/catalog.d.ts +43 -0
  335. package/dist/work/catalog.js +198 -0
  336. package/dist/work/catalog.js.map +1 -0
  337. package/dist/work/discovery.d.ts +70 -0
  338. package/dist/work/discovery.js +465 -0
  339. package/dist/work/discovery.js.map +1 -0
  340. package/dist/work/service.d.ts +83 -0
  341. package/dist/work/service.js +703 -0
  342. package/dist/work/service.js.map +1 -0
  343. package/package.json +66 -4
@@ -0,0 +1,595 @@
1
+ import { once, EventEmitter } from "node:events";
2
+ import { types } from "node:util";
3
+ import { AgentError, requireCondition } from "../contracts/errors.js";
4
+ import { canonicalJson, isPlainRecord, newId } from "../contracts/json.js";
5
+ import { authorizeCall } from "../contracts/caller.js";
6
+ const readDenials = new Set([
7
+ "forbidden",
8
+ "permission_denied",
9
+ "access_denied",
10
+ "resource_forbidden",
11
+ "path_not_allowed",
12
+ "unauthorized",
13
+ ]);
14
+ function permissionDenied(cause) {
15
+ if (!cause || typeof cause !== "object" || types.isProxy(cause))
16
+ return false;
17
+ // A source/policy configuration failure must remain actionable even if it
18
+ // happens to carry an otherwise familiar access-denied code.
19
+ let prototype = cause;
20
+ for (let depth = 0; prototype && depth < 16; depth++) {
21
+ if (types.isProxy(prototype))
22
+ return false;
23
+ const name = Object.getOwnPropertyDescriptor(prototype, "name");
24
+ const constructor = Object.getOwnPropertyDescriptor(prototype, "constructor");
25
+ const className = constructor &&
26
+ "value" in constructor &&
27
+ typeof constructor.value === "function" &&
28
+ !types.isProxy(constructor.value)
29
+ ? Object.getOwnPropertyDescriptor(constructor.value, "name")
30
+ : undefined;
31
+ if ((name && "value" in name && name.value === "SourceConfigError") ||
32
+ (className &&
33
+ "value" in className &&
34
+ className.value === "SourceConfigError"))
35
+ return false;
36
+ prototype = Object.getPrototypeOf(prototype);
37
+ }
38
+ const code = Object.getOwnPropertyDescriptor(cause, "code");
39
+ return !!code && "value" in code && readDenials.has(code.value);
40
+ }
41
+ /** Core list projections share the resource reader's exact denial classification. */
42
+ export const resourceReadDenied = permissionDenied;
43
+ function resourceId(value) {
44
+ requireCondition(typeof value === "string" && /^res_[0-9a-f]{32}$/.test(value), "invalid_resource_id", "A resource history identity must be an actual resource id.");
45
+ }
46
+ /** One manager per live Agent/profile, backed by that profile's existing resource rows. */
47
+ export class ResourceManager extends EventEmitter {
48
+ store;
49
+ #entries = new Map();
50
+ #identities = new WeakMap();
51
+ #references = new WeakMap();
52
+ #owners = new Set();
53
+ #timeout;
54
+ #capacity;
55
+ #stopping = false;
56
+ #shutdownAttempt;
57
+ constructor(store, options = {}) {
58
+ super();
59
+ this.setMaxListeners(0);
60
+ this.store = store;
61
+ this.#timeout = options.cleanupTimeoutMs ?? 5000;
62
+ this.#capacity = options.capacity ?? 4096;
63
+ requireCondition(Number.isSafeInteger(this.#timeout) &&
64
+ this.#timeout > 0 &&
65
+ this.#timeout <= 30000 &&
66
+ Number.isSafeInteger(this.#capacity) &&
67
+ this.#capacity > 0, "invalid_resource_options", "Resource capacity and cleanup observation must be positive and bounded.");
68
+ }
69
+ instance(origin, binding) {
70
+ requireCondition(!this.#stopping, "agent_stopping", "The Agent is no longer admitting resource instances.");
71
+ authorizeCall(() => binding.assertActive());
72
+ binding.signal.throwIfAborted();
73
+ const owner = {
74
+ id: newId("instance"),
75
+ origin: JSON.parse(canonicalJson(origin)),
76
+ signal: binding.signal,
77
+ stopping: false,
78
+ authorize: binding.authorize,
79
+ };
80
+ requireCondition(owner.origin.owner &&
81
+ owner.origin.version &&
82
+ owner.origin.namespace &&
83
+ owner.origin.revision, "invalid_resource_owner", "A resource instance needs its trusted source and effective version.");
84
+ this.#owners.add(owner);
85
+ const host = this.#facade(owner, binding);
86
+ return Object.freeze({
87
+ id: owner.id,
88
+ resources: host,
89
+ bind: (call) => {
90
+ this.#active(owner, call, "get");
91
+ requireCondition(call.runId, "invalid_resource_binding", "A call facade needs a current run identity.");
92
+ return this.#facade(owner, call);
93
+ },
94
+ busy: () => [...this.#entries.values()].some((entry) => entry.owner === owner &&
95
+ this.store.getResource(entry.ref.id).lifetime !== "instance"),
96
+ stop: async (reason) => {
97
+ requireCondition(![...this.#entries.values()].some((entry) => entry.owner === owner &&
98
+ this.store.getResource(entry.ref.id).lifetime !== "instance"), "extension_busy", "Run-owned or independent business resources still use this extension instance.");
99
+ owner.stopping = true;
100
+ const entries = [...this.#entries.values()].filter((entry) => entry.owner === owner);
101
+ await Promise.all(entries.map((entry) => this.#dispose(entry, reason)));
102
+ const report = this.#report(entries.map((entry) => entry.ref.id));
103
+ if (!report.unconfirmed.length)
104
+ this.#owners.delete(owner);
105
+ return report;
106
+ },
107
+ });
108
+ }
109
+ #active(owner, binding, action, id) {
110
+ requireCondition(!this.#stopping || action !== "register", "agent_stopping", "The Agent is no longer admitting new managed resources.");
111
+ requireCondition(this.#owners.has(owner) && !owner.stopping, "extension_unavailable", "The originating extension instance is no longer admitting calls.");
112
+ owner.signal.throwIfAborted();
113
+ binding.signal.throwIfAborted();
114
+ authorizeCall(() => binding.assertActive());
115
+ authorizeCall(() => owner.authorize(action, id));
116
+ authorizeCall(() => binding.authorize(action, id));
117
+ if (binding.runId) {
118
+ const run = this.store.getRun(binding.runId);
119
+ requireCondition(run.bootId === this.store.bootId &&
120
+ run.endedAt === null &&
121
+ run.stop === null, "run_stopping", "This call no longer belongs to a live run.");
122
+ }
123
+ }
124
+ #record(owner, id) {
125
+ const row = this.store.getResource(id);
126
+ requireCondition(row.bootId === this.store.bootId && row.source.instanceId === owner.id, "resource_owner_mismatch", "The resource belongs to another Agent boot or extension instance.");
127
+ return row;
128
+ }
129
+ #historyCaller(binding) {
130
+ requireCondition(binding.runId, "resource_history_requires_call", "Resource history must be read through a current call with a verified caller.");
131
+ return this.store.getRun(binding.runId).callerKey;
132
+ }
133
+ #snapshot(owner, row) {
134
+ requireCondition(!owner ||
135
+ (row.source.owner === owner.origin.owner &&
136
+ row.source.namespace === owner.origin.namespace &&
137
+ row.source.type === owner.origin.type), "resource_owner_mismatch", "The retained resource belongs to another source namespace.");
138
+ const source = row.source;
139
+ requireCondition(["local", "platform", "extension"].includes(source.type) &&
140
+ typeof source.owner === "string" &&
141
+ typeof source.namespace === "string" &&
142
+ (source.version === null || typeof source.version === "string") &&
143
+ typeof source.revision === "string", "invalid_resource_history", "The resource source metadata is invalid.");
144
+ const details = row.diagnostic.details ?? {};
145
+ requireCondition(isPlainRecord(details), "invalid_resource_history", "The retained resource facts must be an ordinary data object.");
146
+ const entry = this.#entries.get(row.resourceId);
147
+ return JSON.parse(canonicalJson({
148
+ id: row.resourceId,
149
+ kind: row.kind,
150
+ status: row.status,
151
+ lifetime: row.lifetime,
152
+ originRunId: row.originRunId,
153
+ contextId: row.contextId,
154
+ origin: {
155
+ type: source.type,
156
+ owner: source.owner,
157
+ namespace: source.namespace,
158
+ version: source.version,
159
+ revision: source.revision,
160
+ },
161
+ createdAt: row.createdAt,
162
+ closedAt: row.closedAt,
163
+ handedOffAt: row.handedOffAt,
164
+ details,
165
+ controlAvailable: row.closedAt === null &&
166
+ row.bootId === this.store.bootId &&
167
+ !!entry &&
168
+ row.source.instanceId === entry.owner.id &&
169
+ (!owner || entry.owner === owner) &&
170
+ !entry.persistenceError,
171
+ }, 32768));
172
+ }
173
+ /** Trusted application port, deliberately absent from the public ResourceService. */
174
+ inspectResource(id, authorize) {
175
+ resourceId(id);
176
+ const record = this.store.resourceHistory(id);
177
+ requireCondition(record.bootId === this.store.bootId, "resource_unavailable", "Only resource facts from this actual Agent boot are available here.");
178
+ authorizeCall(() => authorize(record));
179
+ return this.#snapshot(null, this.store.resourceHistory(id));
180
+ }
181
+ /** A fresh Core authority may stop a registered resource after its original call ended. */
182
+ async disposeResource(id, authorize, reason) {
183
+ resourceId(id);
184
+ let record = this.store.resourceHistory(id);
185
+ requireCondition(record.bootId === this.store.bootId, "resource_unavailable", "A resource from another Agent boot cannot be controlled.");
186
+ authorizeCall(() => authorize(record));
187
+ if (record.closedAt !== null)
188
+ return { accepted: false, snapshot: this.#snapshot(null, record) };
189
+ const entry = this.#entries.get(id);
190
+ requireCondition(entry &&
191
+ entry.ref.kind === record.kind &&
192
+ record.source.instanceId === entry.owner.id, "resource_unavailable", "This process has no actual registered resource controller.");
193
+ await this.#dispose(entry, reason);
194
+ record = this.store.resourceHistory(id);
195
+ authorizeCall(() => authorize(record));
196
+ return { accepted: true, snapshot: this.#snapshot(null, record) };
197
+ }
198
+ #facade(owner, binding) {
199
+ return Object.freeze({
200
+ describe: async (id) => {
201
+ this.#active(owner, binding, "describe");
202
+ this.#historyCaller(binding);
203
+ resourceId(id);
204
+ this.#active(owner, binding, "describe", id);
205
+ return this.#snapshot(owner, this.store.resourceHistory(id));
206
+ },
207
+ list: async (query = {}) => {
208
+ this.#active(owner, binding, "list");
209
+ const caller = this.#historyCaller(binding);
210
+ const input = JSON.parse(canonicalJson(query, 8192));
211
+ requireCondition(isPlainRecord(input) &&
212
+ Object.keys(input).every((key) => [
213
+ "kind",
214
+ "status",
215
+ "state",
216
+ "runId",
217
+ "contextId",
218
+ "limit",
219
+ "cursor",
220
+ ].includes(key)), "invalid_resource_query", "Resource history accepts only the documented equality filters and pagination fields.");
221
+ for (const field of [
222
+ "kind",
223
+ "status",
224
+ "state",
225
+ "runId",
226
+ "contextId",
227
+ ])
228
+ requireCondition(input[field] === undefined ||
229
+ (typeof input[field] === "string" &&
230
+ input[field].length > 0 &&
231
+ Buffer.byteLength(input[field]) <= 1024 &&
232
+ !/[\0\r\n]/.test(input[field])), "invalid_resource_query", "Resource history filters must be bounded text.");
233
+ const limit = input.limit ?? 20;
234
+ requireCondition(typeof limit === "number" &&
235
+ Number.isSafeInteger(limit) &&
236
+ limit > 0 &&
237
+ limit <= 100, "invalid_limit", "Resource history page size must be between 1 and 100.");
238
+ requireCondition(input.cursor === undefined ||
239
+ (typeof input.cursor === "string" &&
240
+ input.cursor.length > 0 &&
241
+ input.cursor.length <= 4096), "invalid_cursor", "The resource history cursor is invalid.");
242
+ const { limit: _limit, cursor: _cursor, ...filters } = input;
243
+ const filter = {
244
+ ...filters,
245
+ owner: owner.origin.owner,
246
+ namespace: owner.origin.namespace,
247
+ type: owner.origin.type,
248
+ };
249
+ const items = [];
250
+ let cursor = input.cursor, scanned = 0, pageBytes = 0;
251
+ while (scanned < 1000) {
252
+ this.#active(owner, binding, "list");
253
+ const page = this.store.scanResourceHistory(filter, caller, Math.min(100, 1000 - scanned), cursor);
254
+ for (let index = 0; index < page.items.length; index++) {
255
+ const item = page.items[index];
256
+ const previous = cursor;
257
+ scanned++;
258
+ cursor = item.cursor;
259
+ try {
260
+ this.#active(owner, binding, "list", item.record.resourceId);
261
+ }
262
+ catch (cause) {
263
+ if (permissionDenied(cause))
264
+ continue;
265
+ throw cause;
266
+ }
267
+ const result = this.#snapshot(owner, item.record);
268
+ const bytes = Buffer.byteLength(canonicalJson(result));
269
+ // Leave space for cursor/envelope. The candidate remains unread in
270
+ // the returned position when it would exceed this page's budget.
271
+ if (pageBytes + bytes > 60 * 1024) {
272
+ this.#active(owner, binding, "list");
273
+ return { items, nextCursor: previous ?? null };
274
+ }
275
+ pageBytes += bytes;
276
+ items.push(result);
277
+ if (items.length === limit) {
278
+ this.#active(owner, binding, "list");
279
+ return {
280
+ items,
281
+ nextCursor: index < page.items.length - 1 || page.more ? cursor : null,
282
+ };
283
+ }
284
+ }
285
+ if (!page.more) {
286
+ this.#active(owner, binding, "list");
287
+ return { items, nextCursor: null };
288
+ }
289
+ }
290
+ this.#active(owner, binding, "list");
291
+ return { items, nextCursor: cursor ?? null };
292
+ },
293
+ register: async ({ kind, value, }) => {
294
+ this.#active(owner, binding, "register");
295
+ requireCondition(typeof kind === "string" &&
296
+ /^[a-z][a-z0-9_.-]{0,63}$/.test(kind) &&
297
+ value &&
298
+ (typeof value === "object" || typeof value === "function") &&
299
+ typeof value.dispose === "function", "invalid_resource", "A managed resource needs a bounded kind and a control object with dispose().");
300
+ const previous = this.#identities.get(value);
301
+ if (previous) {
302
+ const row = this.#record(owner, previous.ref.id);
303
+ requireCondition(previous.ref.kind === kind &&
304
+ previous.binding.runId === binding.runId &&
305
+ row.originRunId === (binding.runId ?? null), "resource_owner_mismatch", "A control object cannot be re-registered with another kind or origin.");
306
+ return previous.ref;
307
+ }
308
+ requireCondition(this.#entries.size < this.#capacity, "resource_busy", "The Agent has no managed resource slot available.");
309
+ const closed = value.closed;
310
+ requireCondition(types.isPromise(closed), "invalid_resource", "closed must be the actual native Promise confirming physical closure and required cleanup.");
311
+ const row = this.store.registerResource({
312
+ callerKey: binding.runId
313
+ ? this.store.getRun(binding.runId).callerKey
314
+ : "instance:" + owner.id,
315
+ kind,
316
+ source: { ...owner.origin, instanceId: owner.id },
317
+ ...(binding.runId ? { runId: binding.runId } : {}),
318
+ status: "registered",
319
+ });
320
+ const controller = new AbortController();
321
+ const confirmation = Promise.withResolvers();
322
+ void confirmation.promise.catch(() => { });
323
+ const ref = Object.freeze({
324
+ id: row.resourceId,
325
+ kind,
326
+ signal: controller.signal,
327
+ value,
328
+ report: (details) => {
329
+ const data = JSON.parse(canonicalJson(details, 16384));
330
+ requireCondition(data && typeof data === "object" && !Array.isArray(data), "invalid_resource_report", "Resource facts must be a bounded data object.");
331
+ const current = this.#record(owner, row.resourceId);
332
+ requireCondition(this.#owners.has(owner) &&
333
+ this.#entries.get(row.resourceId)?.ref === ref &&
334
+ current.closedAt === null, "resource_unavailable", "The original live resource cannot publish new facts.");
335
+ try {
336
+ this.store.resourceDiagnostic(row.resourceId, current.status, {
337
+ ...current.diagnostic,
338
+ details: data,
339
+ });
340
+ this.emit("change", row.resourceId);
341
+ }
342
+ catch (cause) {
343
+ const entry = this.#entries.get(row.resourceId);
344
+ if (entry)
345
+ this.#persistenceFailure(entry, cause);
346
+ throw new AgentError("resource_persistence_failed", "The resource facts could not be saved; actual work may still be active.");
347
+ }
348
+ },
349
+ });
350
+ // Observe closed before returning identity to the extension. No start is allowed before this point.
351
+ const entry = {
352
+ ref,
353
+ owner,
354
+ binding,
355
+ controller,
356
+ closure: new AbortController(),
357
+ confirmation: confirmation.promise,
358
+ confirm: confirmation.resolve,
359
+ rejectConfirmation: confirmation.reject,
360
+ detachOwner: () => { },
361
+ };
362
+ const observed = Promise.prototype.then.call(closed, () => this.#closed(entry), () => {
363
+ entry.closedError = true;
364
+ this.#diagnostic(entry, "closed_rejected");
365
+ void this.#dispose(entry, new AgentError("resource_unconfirmed", "The resource could not confirm closure.")).catch((error) => {
366
+ this.#persistenceFailure(entry, error);
367
+ });
368
+ });
369
+ void observed.catch((error) => {
370
+ this.#persistenceFailure(entry, error);
371
+ });
372
+ this.#entries.set(row.resourceId, entry);
373
+ this.#identities.set(value, entry);
374
+ this.#references.set(ref, entry);
375
+ const forward = (signal) => {
376
+ const stop = () => {
377
+ void this.#dispose(entry, signal.reason).catch((error) => {
378
+ this.#persistenceFailure(entry, error);
379
+ });
380
+ };
381
+ signal.addEventListener("abort", stop, { once: true });
382
+ if (signal.aborted)
383
+ stop();
384
+ return () => signal.removeEventListener("abort", stop);
385
+ };
386
+ entry.detachOwner = forward(owner.signal);
387
+ if (binding.runId)
388
+ entry.detachRun = forward(binding.signal);
389
+ this.emit("change", row.resourceId);
390
+ return ref;
391
+ },
392
+ get: async (id) => {
393
+ this.#active(owner, binding, "get", id);
394
+ const row = this.#record(owner, id), entry = this.#entries.get(id);
395
+ requireCondition(row.closedAt === null && entry && !entry.persistenceError, "resource_unavailable", "The resource is closed or its live control is unavailable; its retained history is unchanged.");
396
+ return entry.ref;
397
+ },
398
+ handoff: async (id) => {
399
+ return this.#handoff(owner, binding, id, (row) => this.store.handoff(id, binding.runId, row.revision));
400
+ },
401
+ });
402
+ }
403
+ #handoff(owner, binding, id, commit) {
404
+ this.#active(owner, binding, "handoff", id);
405
+ const row = this.#record(owner, id);
406
+ requireCondition(binding.runId && row.originRunId === binding.runId, "resource_owner_mismatch", "Only the originating live call may hand off this resource.");
407
+ const entry = this.#entries.get(id);
408
+ if (row.handedOffAt !== null) {
409
+ // Current authority is checked even for a repeat. Do not rerun a commit.
410
+ entry?.detachRun?.();
411
+ if (entry)
412
+ entry.detachRun = undefined;
413
+ return row;
414
+ }
415
+ requireCondition(entry &&
416
+ row.closedAt === null &&
417
+ !entry.closedError &&
418
+ !entry.persistenceError &&
419
+ !entry.controller.signal.aborted, "resource_unavailable", "A stopped or unconfirmed resource cannot become an independent background resource.");
420
+ const result = commit(Object.freeze(row));
421
+ const returned = canonicalJson(result, 32768);
422
+ const actual = this.#record(owner, id);
423
+ requireCondition(actual.resourceId === row.resourceId &&
424
+ actual.originRunId === binding.runId &&
425
+ actual.bootId === row.bootId &&
426
+ actual.lifetime === "background" &&
427
+ actual.ownerRunId === null &&
428
+ actual.handedOffAt !== null &&
429
+ actual.closedAt === null &&
430
+ actual.revision > row.revision &&
431
+ canonicalJson(actual, 32768) === returned, "resource_commit_unconfirmed", "The handoff callback did not return the actual committed resource fact.");
432
+ // Only the independently read committed fact permits signal detachment.
433
+ entry.detachRun?.();
434
+ entry.detachRun = undefined;
435
+ this.emit("change", id);
436
+ return actual;
437
+ }
438
+ /** Core-only synchronous collaboration; never exposed through ResourceService or Invocation. */
439
+ commitHandoff(ref, commit) {
440
+ // Do not inspect fields/getters on an unrecognised caller-supplied object.
441
+ const entry = this.#references.get(ref);
442
+ requireCondition(entry &&
443
+ entry.ref === ref &&
444
+ typeof commit === "function" &&
445
+ !types.isAsyncFunction(commit), "invalid_resource_commit", "A Core handoff needs the actual reference and a synchronous fixed domain commit.");
446
+ return this.#handoff(entry.owner, entry.binding, entry.ref.id, commit);
447
+ }
448
+ #persistenceFailure(entry, cause) {
449
+ entry.persistenceError = cause;
450
+ entry.rejectConfirmation(new AgentError("resource_persistence_failed", "The resource could not persist its actual cleanup evidence.", undefined, { cause }));
451
+ }
452
+ #diagnostic(entry, code) {
453
+ const row = this.store.getResource(entry.ref.id);
454
+ this.store.resourceDiagnostic(entry.ref.id, "unconfirmed", {
455
+ ...row.diagnostic,
456
+ code,
457
+ ...(code === "dispose_failed" ? { disposeError: code } : {}),
458
+ ...(code === "closed_rejected" ? { closedError: code } : {}),
459
+ });
460
+ this.emit("change", entry.ref.id);
461
+ }
462
+ #closed(entry) {
463
+ const row = this.store.getResource(entry.ref.id);
464
+ this.store.closeResource(row.resourceId, row.revision, {
465
+ ...row.diagnostic,
466
+ closedConfirmed: true,
467
+ });
468
+ entry.detachRun?.();
469
+ entry.detachOwner();
470
+ entry.controller.abort(new AgentError("resource_closed", "The actual resource has closed."));
471
+ this.#entries.delete(entry.ref.id);
472
+ entry.confirm();
473
+ entry.closure.abort();
474
+ this.emit("change", entry.ref.id);
475
+ }
476
+ async #dispose(entry, reason) {
477
+ if (this.store.getResource(entry.ref.id).closedAt !== null)
478
+ return;
479
+ if (entry.cleanupAttempt)
480
+ return await entry.cleanupAttempt;
481
+ const cleanup = this.#attemptCleanup(entry, reason);
482
+ entry.cleanupAttempt = cleanup;
483
+ try {
484
+ await cleanup;
485
+ }
486
+ finally {
487
+ if (entry.cleanupAttempt === cleanup)
488
+ entry.cleanupAttempt = undefined;
489
+ }
490
+ }
491
+ async #attemptCleanup(entry, reason) {
492
+ entry.controller.abort(reason ??
493
+ new AgentError("resource_stopping", "Resource cleanup was requested."));
494
+ if (!entry.attempt) {
495
+ this.store.resourceDiagnostic(entry.ref.id, "stopping", this.store.getResource(entry.ref.id).diagnostic);
496
+ const attempt = Promise.resolve().then(() => entry.ref.value.dispose(reason));
497
+ entry.attempt = attempt;
498
+ void attempt
499
+ .then(() => { }, () => {
500
+ if (entry.attempt === attempt)
501
+ entry.attempt = undefined;
502
+ this.#diagnostic(entry, "dispose_failed");
503
+ })
504
+ .catch((error) => {
505
+ this.#persistenceFailure(entry, error);
506
+ });
507
+ }
508
+ const observation = new AbortController();
509
+ const timeout = new AbortController();
510
+ const timer = setTimeout(() => timeout.abort(), this.#timeout);
511
+ const timedOut = once(timeout.signal, "abort", {
512
+ signal: observation.signal,
513
+ }).then(() => false);
514
+ const closed = once(entry.closure.signal, "abort", {
515
+ signal: observation.signal,
516
+ }).then(() => true);
517
+ // Disposal completion is only a request fact. Confirmation is exclusively closed.
518
+ try {
519
+ const confirmed = entry.closure.signal.aborted ||
520
+ (await Promise.race([closed, timedOut]));
521
+ if (!confirmed)
522
+ this.#diagnostic(entry, entry.closedError ? "closed_rejected" : "cleanup_unconfirmed");
523
+ }
524
+ finally {
525
+ clearTimeout(timer);
526
+ observation.abort();
527
+ }
528
+ }
529
+ #report(ids) {
530
+ const rows = ids.map((id) => this.store.getResource(id));
531
+ return {
532
+ closed: rows.filter((row) => row.closedAt !== null).length,
533
+ unconfirmed: rows
534
+ .filter((row) => row.closedAt === null)
535
+ .map((row) => ({
536
+ id: row.resourceId,
537
+ status: row.status,
538
+ diagnostic: row.diagnostic,
539
+ })),
540
+ };
541
+ }
542
+ async cleanupRun(runId, reason) {
543
+ const ids = this.store
544
+ .resourcesForRun(runId)
545
+ .filter((row) => row.ownerRunId === runId)
546
+ .map((row) => row.resourceId);
547
+ await Promise.all(ids.map(async (id) => {
548
+ const entry = this.#entries.get(id);
549
+ if (entry)
550
+ await this.#dispose(entry, reason);
551
+ }));
552
+ return this.#report(ids);
553
+ }
554
+ /** Core-only Agent shutdown; only actual controllers registered on this boot are stopped. */
555
+ shutdown(reason) {
556
+ if (this.#shutdownAttempt)
557
+ return this.#shutdownAttempt;
558
+ this.#stopping = true;
559
+ const entries = [...this.#entries.values()];
560
+ const attempt = (async () => {
561
+ const outcomes = await Promise.allSettled(entries.map((entry) => this.#dispose(entry, reason)));
562
+ const failure = outcomes.find((outcome) => outcome.status === "rejected");
563
+ if (failure?.status === "rejected")
564
+ throw failure.reason;
565
+ return this.#report(entries.map((entry) => entry.ref.id));
566
+ })();
567
+ this.#shutdownAttempt = attempt;
568
+ void attempt
569
+ .finally(() => {
570
+ if (this.#shutdownAttempt === attempt)
571
+ this.#shutdownAttempt = undefined;
572
+ })
573
+ .catch(() => { });
574
+ return attempt;
575
+ }
576
+ async waitForRunClosure(runId) {
577
+ const rows = this.store
578
+ .resourcesForRun(runId)
579
+ .filter((row) => row.ownerRunId === runId && row.closedAt === null);
580
+ const entries = rows.map((row) => {
581
+ const entry = this.#entries.get(row.resourceId);
582
+ requireCondition(entry && !entry.persistenceError, "resource_unavailable", "Resource closure could not be confirmed in this Agent boot.");
583
+ return entry;
584
+ });
585
+ await Promise.all(entries.map((entry) => entry.confirmation));
586
+ }
587
+ /** Control adapters use this after their current call has authorized get(id). */
588
+ async dispose(ref, reason) {
589
+ const entry = this.#entries.get(ref.id);
590
+ requireCondition(entry && entry.ref === ref, "resource_unavailable", "This is not a live control reference from this runtime.");
591
+ await this.#dispose(entry, reason);
592
+ return this.store.getResource(ref.id);
593
+ }
594
+ }
595
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/extensions/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA0GvD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,WAAW;IACX,mBAAmB;IACnB,eAAe;IACf,oBAAoB;IACpB,kBAAkB;IAClB,cAAc;CACf,CAAC,CAAC;AACH,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9E,0EAA0E;IAC1E,6DAA6D;IAC7D,IAAI,SAAS,GAAkB,KAAK,CAAC;IACrC,KAAK,IAAI,KAAK,GAAG,CAA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