@assemblyline-agents/runtime 0.1.0

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 (331) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/dist/agent-harness.d.ts +108 -0
  4. package/dist/agent-harness.d.ts.map +1 -0
  5. package/dist/agent-harness.js +2 -0
  6. package/dist/agent-harness.js.map +1 -0
  7. package/dist/attachments-legacy.d.ts +17 -0
  8. package/dist/attachments-legacy.d.ts.map +1 -0
  9. package/dist/attachments-legacy.js +273 -0
  10. package/dist/attachments-legacy.js.map +1 -0
  11. package/dist/attachments.d.ts +49 -0
  12. package/dist/attachments.d.ts.map +1 -0
  13. package/dist/attachments.js +832 -0
  14. package/dist/attachments.js.map +1 -0
  15. package/dist/builtin-tool-executors.d.ts +96 -0
  16. package/dist/builtin-tool-executors.d.ts.map +1 -0
  17. package/dist/builtin-tool-executors.js +501 -0
  18. package/dist/builtin-tool-executors.js.map +1 -0
  19. package/dist/builtin-tools.d.ts +30 -0
  20. package/dist/builtin-tools.d.ts.map +1 -0
  21. package/dist/builtin-tools.js +690 -0
  22. package/dist/builtin-tools.js.map +1 -0
  23. package/dist/capability-catalog.d.ts +27 -0
  24. package/dist/capability-catalog.d.ts.map +1 -0
  25. package/dist/capability-catalog.js +193 -0
  26. package/dist/capability-catalog.js.map +1 -0
  27. package/dist/channel-http-util.d.ts +34 -0
  28. package/dist/channel-http-util.d.ts.map +1 -0
  29. package/dist/channel-http-util.js +93 -0
  30. package/dist/channel-http-util.js.map +1 -0
  31. package/dist/channel-ingress.d.ts +56 -0
  32. package/dist/channel-ingress.d.ts.map +1 -0
  33. package/dist/channel-ingress.js +273 -0
  34. package/dist/channel-ingress.js.map +1 -0
  35. package/dist/channel.d.ts +146 -0
  36. package/dist/channel.d.ts.map +1 -0
  37. package/dist/channel.js +2 -0
  38. package/dist/channel.js.map +1 -0
  39. package/dist/checkpoints.d.ts +34 -0
  40. package/dist/checkpoints.d.ts.map +1 -0
  41. package/dist/checkpoints.js +86 -0
  42. package/dist/checkpoints.js.map +1 -0
  43. package/dist/code-mode.d.ts +20 -0
  44. package/dist/code-mode.d.ts.map +1 -0
  45. package/dist/code-mode.js +658 -0
  46. package/dist/code-mode.js.map +1 -0
  47. package/dist/computer-relay-protocol.d.ts +36 -0
  48. package/dist/computer-relay-protocol.d.ts.map +1 -0
  49. package/dist/computer-relay-protocol.js +127 -0
  50. package/dist/computer-relay-protocol.js.map +1 -0
  51. package/dist/concurrency.d.ts +68 -0
  52. package/dist/concurrency.d.ts.map +1 -0
  53. package/dist/concurrency.js +193 -0
  54. package/dist/concurrency.js.map +1 -0
  55. package/dist/connection-auth-util.d.ts +56 -0
  56. package/dist/connection-auth-util.d.ts.map +1 -0
  57. package/dist/connection-auth-util.js +154 -0
  58. package/dist/connection-auth-util.js.map +1 -0
  59. package/dist/connection-clients.d.ts +50 -0
  60. package/dist/connection-clients.d.ts.map +1 -0
  61. package/dist/connection-clients.js +402 -0
  62. package/dist/connection-clients.js.map +1 -0
  63. package/dist/connection-stores.d.ts +108 -0
  64. package/dist/connection-stores.d.ts.map +1 -0
  65. package/dist/connection-stores.js +127 -0
  66. package/dist/connection-stores.js.map +1 -0
  67. package/dist/connection-util.d.ts +27 -0
  68. package/dist/connection-util.d.ts.map +1 -0
  69. package/dist/connection-util.js +118 -0
  70. package/dist/connection-util.js.map +1 -0
  71. package/dist/connections.d.ts +152 -0
  72. package/dist/connections.d.ts.map +1 -0
  73. package/dist/connections.js +838 -0
  74. package/dist/connections.js.map +1 -0
  75. package/dist/content-capture.d.ts +32 -0
  76. package/dist/content-capture.d.ts.map +1 -0
  77. package/dist/content-capture.js +77 -0
  78. package/dist/content-capture.js.map +1 -0
  79. package/dist/context-policy-util.d.ts +45 -0
  80. package/dist/context-policy-util.d.ts.map +1 -0
  81. package/dist/context-policy-util.js +120 -0
  82. package/dist/context-policy-util.js.map +1 -0
  83. package/dist/conversation-context.d.ts +55 -0
  84. package/dist/conversation-context.d.ts.map +1 -0
  85. package/dist/conversation-context.js +179 -0
  86. package/dist/conversation-context.js.map +1 -0
  87. package/dist/conversation-transcript.d.ts +49 -0
  88. package/dist/conversation-transcript.d.ts.map +1 -0
  89. package/dist/conversation-transcript.js +77 -0
  90. package/dist/conversation-transcript.js.map +1 -0
  91. package/dist/conversation-turn-dispatch.d.ts +46 -0
  92. package/dist/conversation-turn-dispatch.d.ts.map +1 -0
  93. package/dist/conversation-turn-dispatch.js +201 -0
  94. package/dist/conversation-turn-dispatch.js.map +1 -0
  95. package/dist/delivery-queue.d.ts +89 -0
  96. package/dist/delivery-queue.d.ts.map +1 -0
  97. package/dist/delivery-queue.js +244 -0
  98. package/dist/delivery-queue.js.map +1 -0
  99. package/dist/delivery-send.d.ts +44 -0
  100. package/dist/delivery-send.d.ts.map +1 -0
  101. package/dist/delivery-send.js +494 -0
  102. package/dist/delivery-send.js.map +1 -0
  103. package/dist/env-config.d.ts +6 -0
  104. package/dist/env-config.d.ts.map +1 -0
  105. package/dist/env-config.js +27 -0
  106. package/dist/env-config.js.map +1 -0
  107. package/dist/eval-run-options.d.ts +37 -0
  108. package/dist/eval-run-options.d.ts.map +1 -0
  109. package/dist/eval-run-options.js +106 -0
  110. package/dist/eval-run-options.js.map +1 -0
  111. package/dist/harness-continuation.d.ts +54 -0
  112. package/dist/harness-continuation.d.ts.map +1 -0
  113. package/dist/harness-continuation.js +58 -0
  114. package/dist/harness-continuation.js.map +1 -0
  115. package/dist/harness-loop.d.ts +110 -0
  116. package/dist/harness-loop.d.ts.map +1 -0
  117. package/dist/harness-loop.js +575 -0
  118. package/dist/harness-loop.js.map +1 -0
  119. package/dist/hook-dispatch.d.ts +19 -0
  120. package/dist/hook-dispatch.d.ts.map +1 -0
  121. package/dist/hook-dispatch.js +37 -0
  122. package/dist/hook-dispatch.js.map +1 -0
  123. package/dist/http.d.ts +26 -0
  124. package/dist/http.d.ts.map +1 -0
  125. package/dist/http.js +114 -0
  126. package/dist/http.js.map +1 -0
  127. package/dist/in-memory-conversation-turn-store.d.ts +29 -0
  128. package/dist/in-memory-conversation-turn-store.d.ts.map +1 -0
  129. package/dist/in-memory-conversation-turn-store.js +166 -0
  130. package/dist/in-memory-conversation-turn-store.js.map +1 -0
  131. package/dist/in-memory-run-store.d.ts +39 -0
  132. package/dist/in-memory-run-store.d.ts.map +1 -0
  133. package/dist/in-memory-run-store.js +332 -0
  134. package/dist/in-memory-run-store.js.map +1 -0
  135. package/dist/in-memory-sandbox-session-store.d.ts +33 -0
  136. package/dist/in-memory-sandbox-session-store.d.ts.map +1 -0
  137. package/dist/in-memory-sandbox-session-store.js +186 -0
  138. package/dist/in-memory-sandbox-session-store.js.map +1 -0
  139. package/dist/in-memory-small-stores.d.ts +117 -0
  140. package/dist/in-memory-small-stores.d.ts.map +1 -0
  141. package/dist/in-memory-small-stores.js +340 -0
  142. package/dist/in-memory-small-stores.js.map +1 -0
  143. package/dist/in-memory-usage-store.d.ts +15 -0
  144. package/dist/in-memory-usage-store.d.ts.map +1 -0
  145. package/dist/in-memory-usage-store.js +49 -0
  146. package/dist/in-memory-usage-store.js.map +1 -0
  147. package/dist/index.d.ts +467 -0
  148. package/dist/index.d.ts.map +1 -0
  149. package/dist/index.js +2046 -0
  150. package/dist/index.js.map +1 -0
  151. package/dist/json-util.d.ts +19 -0
  152. package/dist/json-util.d.ts.map +1 -0
  153. package/dist/json-util.js +59 -0
  154. package/dist/json-util.js.map +1 -0
  155. package/dist/local-sandbox.d.ts +16 -0
  156. package/dist/local-sandbox.d.ts.map +1 -0
  157. package/dist/local-sandbox.js +327 -0
  158. package/dist/local-sandbox.js.map +1 -0
  159. package/dist/logging.d.ts +16 -0
  160. package/dist/logging.d.ts.map +1 -0
  161. package/dist/logging.js +41 -0
  162. package/dist/logging.js.map +1 -0
  163. package/dist/mcp-client.d.ts +27 -0
  164. package/dist/mcp-client.d.ts.map +1 -0
  165. package/dist/mcp-client.js +169 -0
  166. package/dist/mcp-client.js.map +1 -0
  167. package/dist/model-harnesses.d.ts +4 -0
  168. package/dist/model-harnesses.d.ts.map +1 -0
  169. package/dist/model-harnesses.js +6 -0
  170. package/dist/model-harnesses.js.map +1 -0
  171. package/dist/model-media.d.ts +36 -0
  172. package/dist/model-media.d.ts.map +1 -0
  173. package/dist/model-media.js +234 -0
  174. package/dist/model-media.js.map +1 -0
  175. package/dist/operator-controls.d.ts +31 -0
  176. package/dist/operator-controls.d.ts.map +1 -0
  177. package/dist/operator-controls.js +71 -0
  178. package/dist/operator-controls.js.map +1 -0
  179. package/dist/pi-agent-harness.d.ts +40 -0
  180. package/dist/pi-agent-harness.d.ts.map +1 -0
  181. package/dist/pi-agent-harness.js +222 -0
  182. package/dist/pi-agent-harness.js.map +1 -0
  183. package/dist/pi-harness.d.ts +42 -0
  184. package/dist/pi-harness.d.ts.map +1 -0
  185. package/dist/pi-harness.js +142 -0
  186. package/dist/pi-harness.js.map +1 -0
  187. package/dist/relay-mcp-client.d.ts +17 -0
  188. package/dist/relay-mcp-client.d.ts.map +1 -0
  189. package/dist/relay-mcp-client.js +119 -0
  190. package/dist/relay-mcp-client.js.map +1 -0
  191. package/dist/replay-resume.d.ts +107 -0
  192. package/dist/replay-resume.d.ts.map +1 -0
  193. package/dist/replay-resume.js +495 -0
  194. package/dist/replay-resume.js.map +1 -0
  195. package/dist/resource-projection-util.d.ts +58 -0
  196. package/dist/resource-projection-util.d.ts.map +1 -0
  197. package/dist/resource-projection-util.js +298 -0
  198. package/dist/resource-projection-util.js.map +1 -0
  199. package/dist/resource-projection.d.ts +45 -0
  200. package/dist/resource-projection.d.ts.map +1 -0
  201. package/dist/resource-projection.js +481 -0
  202. package/dist/resource-projection.js.map +1 -0
  203. package/dist/run-heartbeat.d.ts +34 -0
  204. package/dist/run-heartbeat.d.ts.map +1 -0
  205. package/dist/run-heartbeat.js +62 -0
  206. package/dist/run-heartbeat.js.map +1 -0
  207. package/dist/run-outcome.d.ts +47 -0
  208. package/dist/run-outcome.d.ts.map +1 -0
  209. package/dist/run-outcome.js +92 -0
  210. package/dist/run-outcome.js.map +1 -0
  211. package/dist/run-recovery.d.ts +117 -0
  212. package/dist/run-recovery.d.ts.map +1 -0
  213. package/dist/run-recovery.js +466 -0
  214. package/dist/run-recovery.js.map +1 -0
  215. package/dist/run-resolver.d.ts +35 -0
  216. package/dist/run-resolver.d.ts.map +1 -0
  217. package/dist/run-resolver.js +84 -0
  218. package/dist/run-resolver.js.map +1 -0
  219. package/dist/run-stream.d.ts +37 -0
  220. package/dist/run-stream.d.ts.map +1 -0
  221. package/dist/run-stream.js +78 -0
  222. package/dist/run-stream.js.map +1 -0
  223. package/dist/runs-query.d.ts +29 -0
  224. package/dist/runs-query.d.ts.map +1 -0
  225. package/dist/runs-query.js +142 -0
  226. package/dist/runs-query.js.map +1 -0
  227. package/dist/runtime-bundle.d.ts +3 -0
  228. package/dist/runtime-bundle.d.ts.map +1 -0
  229. package/dist/runtime-bundle.js +18 -0
  230. package/dist/runtime-bundle.js.map +1 -0
  231. package/dist/runtime-types.d.ts +397 -0
  232. package/dist/runtime-types.d.ts.map +1 -0
  233. package/dist/runtime-types.js +2 -0
  234. package/dist/runtime-types.js.map +1 -0
  235. package/dist/runtime-util.d.ts +45 -0
  236. package/dist/runtime-util.d.ts.map +1 -0
  237. package/dist/runtime-util.js +116 -0
  238. package/dist/runtime-util.js.map +1 -0
  239. package/dist/sandbox-cli-client.d.ts +20 -0
  240. package/dist/sandbox-cli-client.d.ts.map +1 -0
  241. package/dist/sandbox-cli-client.js +97 -0
  242. package/dist/sandbox-cli-client.js.map +1 -0
  243. package/dist/sandbox-fs.d.ts +56 -0
  244. package/dist/sandbox-fs.d.ts.map +1 -0
  245. package/dist/sandbox-fs.js +276 -0
  246. package/dist/sandbox-fs.js.map +1 -0
  247. package/dist/sandbox-session-key.d.ts +8 -0
  248. package/dist/sandbox-session-key.d.ts.map +1 -0
  249. package/dist/sandbox-session-key.js +32 -0
  250. package/dist/sandbox-session-key.js.map +1 -0
  251. package/dist/sandbox-snapshot-policy.d.ts +27 -0
  252. package/dist/sandbox-snapshot-policy.d.ts.map +1 -0
  253. package/dist/sandbox-snapshot-policy.js +94 -0
  254. package/dist/sandbox-snapshot-policy.js.map +1 -0
  255. package/dist/sandbox-sync-worker.d.ts +63 -0
  256. package/dist/sandbox-sync-worker.d.ts.map +1 -0
  257. package/dist/sandbox-sync-worker.js +448 -0
  258. package/dist/sandbox-sync-worker.js.map +1 -0
  259. package/dist/schedule-execution.d.ts +59 -0
  260. package/dist/schedule-execution.d.ts.map +1 -0
  261. package/dist/schedule-execution.js +951 -0
  262. package/dist/schedule-execution.js.map +1 -0
  263. package/dist/scheduler.d.ts +19 -0
  264. package/dist/scheduler.d.ts.map +1 -0
  265. package/dist/scheduler.js +38 -0
  266. package/dist/scheduler.js.map +1 -0
  267. package/dist/security.d.ts +20 -0
  268. package/dist/security.d.ts.map +1 -0
  269. package/dist/security.js +145 -0
  270. package/dist/security.js.map +1 -0
  271. package/dist/self-improvement.d.ts +245 -0
  272. package/dist/self-improvement.d.ts.map +1 -0
  273. package/dist/self-improvement.js +554 -0
  274. package/dist/self-improvement.js.map +1 -0
  275. package/dist/source-loader.d.ts +19 -0
  276. package/dist/source-loader.d.ts.map +1 -0
  277. package/dist/source-loader.js +160 -0
  278. package/dist/source-loader.js.map +1 -0
  279. package/dist/state-store-helpers.d.ts +28 -0
  280. package/dist/state-store-helpers.d.ts.map +1 -0
  281. package/dist/state-store-helpers.js +164 -0
  282. package/dist/state-store-helpers.js.map +1 -0
  283. package/dist/state-stores.d.ts +25 -0
  284. package/dist/state-stores.d.ts.map +1 -0
  285. package/dist/state-stores.js +157 -0
  286. package/dist/state-stores.js.map +1 -0
  287. package/dist/state.d.ts +736 -0
  288. package/dist/state.d.ts.map +1 -0
  289. package/dist/state.js +46 -0
  290. package/dist/state.js.map +1 -0
  291. package/dist/storage.d.ts +188 -0
  292. package/dist/storage.d.ts.map +1 -0
  293. package/dist/storage.js +752 -0
  294. package/dist/storage.js.map +1 -0
  295. package/dist/subagent-execution.d.ts +80 -0
  296. package/dist/subagent-execution.d.ts.map +1 -0
  297. package/dist/subagent-execution.js +135 -0
  298. package/dist/subagent-execution.js.map +1 -0
  299. package/dist/telemetry.d.ts +49 -0
  300. package/dist/telemetry.d.ts.map +1 -0
  301. package/dist/telemetry.js +60 -0
  302. package/dist/telemetry.js.map +1 -0
  303. package/dist/tool-apis.d.ts +22 -0
  304. package/dist/tool-apis.d.ts.map +1 -0
  305. package/dist/tool-apis.js +344 -0
  306. package/dist/tool-apis.js.map +1 -0
  307. package/dist/tool-execution.d.ts +143 -0
  308. package/dist/tool-execution.d.ts.map +1 -0
  309. package/dist/tool-execution.js +573 -0
  310. package/dist/tool-execution.js.map +1 -0
  311. package/dist/trusted-attachments.d.ts +20 -0
  312. package/dist/trusted-attachments.d.ts.map +1 -0
  313. package/dist/trusted-attachments.js +276 -0
  314. package/dist/trusted-attachments.js.map +1 -0
  315. package/dist/usage-accounting.d.ts +37 -0
  316. package/dist/usage-accounting.d.ts.map +1 -0
  317. package/dist/usage-accounting.js +181 -0
  318. package/dist/usage-accounting.js.map +1 -0
  319. package/dist/usage-budget.d.ts +29 -0
  320. package/dist/usage-budget.d.ts.map +1 -0
  321. package/dist/usage-budget.js +145 -0
  322. package/dist/usage-budget.js.map +1 -0
  323. package/dist/usage-reconciliation.d.ts +76 -0
  324. package/dist/usage-reconciliation.d.ts.map +1 -0
  325. package/dist/usage-reconciliation.js +463 -0
  326. package/dist/usage-reconciliation.js.map +1 -0
  327. package/dist/usage-records.d.ts +24 -0
  328. package/dist/usage-records.d.ts.map +1 -0
  329. package/dist/usage-records.js +445 -0
  330. package/dist/usage-records.js.map +1 -0
  331. package/package.json +51 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OpenEve contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @assemblyline-agents/runtime
2
+
3
+ The Assembly Line runtime: the durable engine that executes compiled agents.
4
+
5
+ It orchestrates agent runs and turns, channel ingress and delivery, connections (MCP clients, OpenAPI clients, connection auth and stores), builtin tools and tool execution, checkpoints, scheduling, concurrency control, attachments, sandbox integration, and telemetry. Its usage subsystem records idempotent provider receipts, keeps unavailable values explicit instead of estimating them, exposes arbitrary-period aggregates, and reconciles provider control totals. Accounting is behavior-neutral: observation failures are warned but never gate a model request or response. State, blob, and sandbox behavior are pluggable through adapter interfaces implemented by packages such as `@assemblyline-agents/postgres`, `@assemblyline-agents/s3`, and `@assemblyline-agents/docker`. Hosts like `@assemblyline-agents/node` embed this runtime to serve agents.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @assemblyline-agents/runtime
11
+ ```
12
+
13
+ ## Part of Assembly Line
14
+
15
+ This package is part of [Assembly Line](https://github.com/jasonbadeaux/openeve), a vendor-neutral, filesystem-first framework for durable AI agents. See the developer documentation in [docs/developers/](https://github.com/jasonbadeaux/openeve/tree/main/docs/developers) for setup, agent authoring, and deployment guides.
16
+
17
+ ## License
18
+
19
+ MIT
@@ -0,0 +1,108 @@
1
+ import type { JsonObject, JsonSchema, ReasoningLevel } from "@openeve/core";
2
+ /**
3
+ * Engine-neutral contract between the OpenEve runtime and a primary agent
4
+ * engine ("harness"). Nothing in this module may reference a specific engine:
5
+ * continuation state is an opaque JSON object owned by the harness, and all
6
+ * durability (tool records, pauses, checkpoints, events, usage, spans) stays
7
+ * in the runtime.
8
+ */
9
+ /** A tool exposed to the model, described in engine-neutral terms. */
10
+ export interface HarnessToolDescriptor {
11
+ name: string;
12
+ description: string;
13
+ inputSchema: JsonSchema;
14
+ }
15
+ /**
16
+ * Outcome of a runtime tool execution as seen by the harness.
17
+ *
18
+ * - `result`: the tool produced `output`, which the harness returns to the
19
+ * model verbatim (the runtime already bounded/redacted it).
20
+ * - `pause`: the runtime paused the run (approval, human input, connection
21
+ * authorization). The harness must stop the loop after returning `output`
22
+ * as the tool result. `toolCallId` is an opaque correlation id the runtime
23
+ * will echo conceptually when the paused tool later resolves; harnesses
24
+ * that splice resumed tool results into their transcript should persist it
25
+ * in their continuation state.
26
+ */
27
+ export type HarnessToolOutcome = {
28
+ kind: "result";
29
+ output: unknown;
30
+ } | {
31
+ kind: "pause";
32
+ output: unknown;
33
+ toolCallId?: string;
34
+ };
35
+ /** Model-loop lifecycle events the harness reports back to the runtime. */
36
+ export type AgentHarnessEvent = {
37
+ type: "request_started";
38
+ iteration: number;
39
+ toolNames: string[];
40
+ } | {
41
+ type: "response_completed";
42
+ iteration: number;
43
+ finishReason?: string;
44
+ toolCallCount: number;
45
+ usage?: {
46
+ inputTokens?: number;
47
+ outputTokens?: number;
48
+ cachedTokens?: number;
49
+ costUsd?: number;
50
+ };
51
+ provider?: string;
52
+ responseModel?: string;
53
+ };
54
+ /**
55
+ * Versioned, opaque harness continuation. The runtime persists this as-is and
56
+ * hands it back on resume. `state` must be JSON-serializable and is only
57
+ * interpreted by the harness that produced it (matched by `harness` + `version`).
58
+ */
59
+ export interface HarnessContinuation {
60
+ harness: string;
61
+ version: number;
62
+ state: JsonObject;
63
+ }
64
+ /** Input for one harness turn: a fresh message or a resume of a paused turn. */
65
+ export type AgentTurnInput = {
66
+ kind: "message";
67
+ message: string;
68
+ recentHistory: string[];
69
+ } | {
70
+ kind: "resume";
71
+ continuation: HarnessContinuation;
72
+ toolResult?: {
73
+ toolName: string;
74
+ output: unknown;
75
+ };
76
+ };
77
+ /** Runtime-provided context for one harness turn. */
78
+ export interface AgentHarnessContext {
79
+ runId: string;
80
+ sessionId: string;
81
+ modelSpec: string;
82
+ reasoning?: ReasoningLevel | undefined;
83
+ systemPrompt: string;
84
+ env: Record<string, string | undefined>;
85
+ /** Current tool set. Re-invoked before each model request so mid-turn discovery is visible. */
86
+ tools(): Promise<HarnessToolDescriptor[]>;
87
+ /** Execute a model-requested tool through runtime durability. */
88
+ executeTool(call: {
89
+ toolCallId: string;
90
+ name: string;
91
+ input: unknown;
92
+ }): Promise<HarnessToolOutcome>;
93
+ /** Report a model-loop lifecycle event (events, usage, spans stay runtime-side). */
94
+ emit(event: AgentHarnessEvent): void | Promise<void>;
95
+ /** When provided, called with a fresh continuation snapshot after every model response. */
96
+ onIterationCheckpoint?(continuation: HarnessContinuation): Promise<void>;
97
+ }
98
+ export interface AgentTurnResult {
99
+ response: string;
100
+ paused?: boolean;
101
+ continuation?: HarnessContinuation;
102
+ }
103
+ export interface AgentHarness {
104
+ readonly id: string;
105
+ readonly continuationVersion: number;
106
+ runTurn(input: AgentTurnInput, ctx: AgentHarnessContext): Promise<AgentTurnResult>;
107
+ }
108
+ //# sourceMappingURL=agent-harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-harness.d.ts","sourceRoot":"","sources":["../src/agent-harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,E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AG,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACpF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-harness.js","sourceRoot":"","sources":["../src/agent-harness.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import type { JsonObject } from "@openeve/core";
2
+ import { type AttachmentDownloadRequest } from "./attachments.js";
3
+ /**
4
+ * Legacy in-runtime provider download builders (Slack files.info, Telegram
5
+ * getFile, Teams token flow, Photon bridge headers).
6
+ *
7
+ * Channels now own attachment resolution through `ChannelModule.resolveAttachment`;
8
+ * this module only backs turns whose channel module does not implement it —
9
+ * i.e. manifests/channel packages compiled before the split, plus direct
10
+ * `run({ trustedAttachmentProvider })` callers. Remove after one release.
11
+ */
12
+ export declare function legacyAttachmentDownloadRequest(attachment: JsonObject, input: {
13
+ trustedProvider?: string;
14
+ env: Record<string, string | undefined>;
15
+ fetch: typeof fetch;
16
+ }): Promise<AttachmentDownloadRequest | undefined>;
17
+ //# sourceMappingURL=attachments-legacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments-legacy.d.ts","sourceRoot":"","sources":["../src/attachments-legacy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAKL,KAAK,yBAAyB,EAC/B,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;GAQG;AACH,wBAAsB,+BAA+B,CACnD,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE;IACL,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,GACA,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,CAgBhD"}
@@ -0,0 +1,273 @@
1
+ import { attachmentFetchTimeoutMs, firstDownloadableUrl, normalizeAttachmentProvider, trustedProviderForAttachment } from "./attachments.js";
2
+ /**
3
+ * Legacy in-runtime provider download builders (Slack files.info, Telegram
4
+ * getFile, Teams token flow, Photon bridge headers).
5
+ *
6
+ * Channels now own attachment resolution through `ChannelModule.resolveAttachment`;
7
+ * this module only backs turns whose channel module does not implement it —
8
+ * i.e. manifests/channel packages compiled before the split, plus direct
9
+ * `run({ trustedAttachmentProvider })` callers. Remove after one release.
10
+ */
11
+ export async function legacyAttachmentDownloadRequest(attachment, input) {
12
+ const telegram = telegramFileIdFromAttachment(attachment, input);
13
+ if (telegram)
14
+ return telegramAttachmentDownload(telegram, input);
15
+ const slack = await slackAttachmentDownload(attachment, input);
16
+ if (slack)
17
+ return slack;
18
+ const url = attachmentDownloadUrl(attachment);
19
+ if (!url)
20
+ return undefined;
21
+ const headers = await attachmentDownloadHeaders(attachment, url, input);
22
+ return {
23
+ url,
24
+ headers,
25
+ provider: stringValue(attachment.provider),
26
+ filename: stringValue(attachment.filename) || stringValue(attachment.name)
27
+ };
28
+ }
29
+ async function telegramAttachmentDownload(fileId, input) {
30
+ const token = input.env.TELEGRAM_BOT_TOKEN;
31
+ if (!token)
32
+ return undefined;
33
+ const infoUrl = `https://api.telegram.org/bot${encodeURIComponent(token)}/getFile?file_id=${encodeURIComponent(fileId)}`;
34
+ const response = await input.fetch(infoUrl, { signal: timeoutSignal(attachmentFetchTimeoutMs(input.env)) });
35
+ const payload = recordValue(await parseJsonResponse(response));
36
+ if (!response.ok || payload?.ok !== true) {
37
+ throw new Error(`Telegram file lookup failed: ${response.status}`);
38
+ }
39
+ const filePath = stringValue(recordValue(payload.result)?.file_path);
40
+ if (!filePath)
41
+ throw new Error("Telegram file lookup did not return file_path.");
42
+ return {
43
+ url: `https://api.telegram.org/file/bot${encodeURIComponent(token)}/${filePath}`,
44
+ headers: {}
45
+ };
46
+ }
47
+ async function slackAttachmentDownload(attachment, input) {
48
+ if (!isSlackAttachment(attachment, input))
49
+ return undefined;
50
+ const token = slackToken(input.env);
51
+ const headers = token ? { authorization: `Bearer ${token}` } : {};
52
+ const directUrl = firstDownloadableUrl([
53
+ attachment.url_private_download,
54
+ recordValue(attachment.remote)?.url_private_download,
55
+ recordValue(attachment.download)?.url_private_download,
56
+ attachment.downloadUrl,
57
+ recordValue(attachment.remote)?.downloadUrl,
58
+ recordValue(attachment.download)?.downloadUrl,
59
+ attachment.url_private,
60
+ recordValue(attachment.remote)?.url_private,
61
+ recordValue(attachment.download)?.url_private
62
+ ]);
63
+ const filename = stringValue(attachment.filename) || stringValue(attachment.name);
64
+ if (directUrl) {
65
+ if (!isSlackUrl(directUrl))
66
+ throw new Error("Slack attachment download URL host is not allowed.");
67
+ return { url: directUrl, headers, provider: "slack", filename };
68
+ }
69
+ const fileId = slackFileIdFromAttachment(attachment);
70
+ if (!fileId || !token)
71
+ return undefined;
72
+ const response = await input.fetch(`https://slack.com/api/files.info?file=${encodeURIComponent(fileId)}`, {
73
+ headers,
74
+ signal: timeoutSignal(attachmentFetchTimeoutMs(input.env))
75
+ });
76
+ const payload = recordValue(await parseJsonResponse(response));
77
+ if (!response.ok || payload?.ok !== true) {
78
+ throw new Error(`Slack file lookup failed: ${response.status}`);
79
+ }
80
+ const file = recordValue(payload.file);
81
+ const url = firstDownloadableUrl([
82
+ file?.url_private_download,
83
+ file?.url_private
84
+ ]);
85
+ if (!url)
86
+ throw new Error("Slack file lookup did not return a private download URL.");
87
+ if (!isSlackUrl(url))
88
+ throw new Error("Slack file lookup returned an untrusted download URL host.");
89
+ return {
90
+ url,
91
+ headers,
92
+ provider: "slack",
93
+ filename: stringValue(file?.name) || stringValue(file?.title) || filename
94
+ };
95
+ }
96
+ async function attachmentDownloadHeaders(attachment, url, input) {
97
+ const trustedProvider = trustedProviderForAttachment(attachment, input.trustedProvider);
98
+ if (trustedProvider === "photon") {
99
+ if (!isPhotonBridgeUrl(url, input.env))
100
+ throw new Error("Photon attachment download URL host is not allowed.");
101
+ const token = input.env.PHOTON_BRIDGE_TOKEN;
102
+ return token ? { authorization: `Bearer ${token}` } : {};
103
+ }
104
+ if (trustedProvider === "teams") {
105
+ if (!isTeamsAttachmentUrl(attachment, url))
106
+ throw new Error("Teams attachment download URL host is not allowed.");
107
+ const token = await teamsBotTokenForAttachment(input);
108
+ return token ? { authorization: `Bearer ${token}` } : {};
109
+ }
110
+ if (trustedProvider === "slack") {
111
+ if (!isSlackUrl(url))
112
+ throw new Error("Slack attachment download URL host is not allowed.");
113
+ const token = input.env.SLACK_BOT_TOKEN ?? input.env.SLACK_USER_TOKEN;
114
+ return token ? { authorization: `Bearer ${token}` } : {};
115
+ }
116
+ return {};
117
+ }
118
+ async function teamsBotTokenForAttachment(input) {
119
+ const appId = input.env.MICROSOFT_APP_ID;
120
+ const password = input.env.MICROSOFT_APP_PASSWORD;
121
+ if (!appId || !password)
122
+ return undefined;
123
+ const body = new URLSearchParams({
124
+ grant_type: "client_credentials",
125
+ client_id: appId,
126
+ client_secret: password,
127
+ scope: "https://api.botframework.com/.default"
128
+ });
129
+ const response = await input.fetch("https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token", {
130
+ method: "POST",
131
+ headers: { "content-type": "application/x-www-form-urlencoded" },
132
+ body,
133
+ signal: timeoutSignal(attachmentFetchTimeoutMs(input.env))
134
+ });
135
+ const parsed = recordValue(await parseJsonResponse(response));
136
+ if (!response.ok)
137
+ throw new Error(`Teams attachment token request failed: ${response.status}`);
138
+ return stringValue(parsed?.access_token);
139
+ }
140
+ function attachmentDownloadUrl(attachment) {
141
+ const remote = recordValue(attachment.remote) ?? recordValue(attachment.download);
142
+ const candidates = [
143
+ remote?.downloadUrl,
144
+ remote?.contentUrl,
145
+ attachment.downloadUrl,
146
+ attachment.url_private_download,
147
+ remote?.url_private_download,
148
+ attachment.url_private,
149
+ remote?.url_private,
150
+ attachment.contentUrl,
151
+ attachment.mediaUrl,
152
+ attachment.fileUrl,
153
+ attachment.url,
154
+ remote?.url,
155
+ attachment.href
156
+ ];
157
+ return firstDownloadableUrl(candidates);
158
+ }
159
+ function isSlackAttachment(attachment, input) {
160
+ if (trustedProviderForAttachment(attachment, input.trustedProvider) !== "slack")
161
+ return false;
162
+ const provider = normalizeAttachmentProvider(stringValue(attachment.provider) || stringValue(attachment.remoteProvider));
163
+ const remote = recordValue(attachment.remote) ?? recordValue(attachment.download);
164
+ const auth = normalizeAttachmentProvider(stringValue(remote?.auth) || stringValue(remote?.authProvider) || stringValue(attachment.authProvider));
165
+ return provider === "slack" ||
166
+ auth === "slack" ||
167
+ Boolean(stringValue(attachment.slackFileId) || stringValue(remote?.slackFileId)) ||
168
+ Boolean(firstDownloadableUrl([
169
+ attachment.url_private_download,
170
+ attachment.url_private,
171
+ remote?.url_private_download,
172
+ remote?.url_private
173
+ ])) ||
174
+ isSlackUrl(firstDownloadableUrl([attachment.url, attachment.href, remote?.url]));
175
+ }
176
+ function slackFileIdFromAttachment(attachment) {
177
+ const provider = normalizeAttachmentProvider(stringValue(attachment.provider) || stringValue(attachment.remoteProvider));
178
+ const remote = recordValue(attachment.remote) ?? recordValue(attachment.download);
179
+ const direct = stringValue(attachment.slackFileId) || stringValue(attachment.fileId);
180
+ if (direct)
181
+ return direct;
182
+ const remoteFileId = stringValue(remote?.fileId) || stringValue(remote?.slackFileId);
183
+ if (remoteFileId)
184
+ return remoteFileId;
185
+ const id = stringValue(attachment.id);
186
+ if (id && (provider === "slack" || isSlackUrl(firstDownloadableUrl([attachment.url, attachment.href, remote?.url]))))
187
+ return id;
188
+ return undefined;
189
+ }
190
+ function slackToken(env) {
191
+ return env.SLACK_BOT_TOKEN ?? env.SLACK_USER_TOKEN;
192
+ }
193
+ function isSlackUrl(value) {
194
+ if (!value)
195
+ return false;
196
+ try {
197
+ const hostname = new URL(value).hostname.toLowerCase();
198
+ return hostname === "slack.com" || hostname.endsWith(".slack.com") || hostname === "files.slack.com";
199
+ }
200
+ catch {
201
+ return false;
202
+ }
203
+ }
204
+ function telegramFileIdFromAttachment(attachment, input) {
205
+ if (trustedProviderForAttachment(attachment, input.trustedProvider) !== "telegram")
206
+ return undefined;
207
+ const direct = stringValue(attachment.telegramFileId) || stringValue(attachment.fileId);
208
+ if (direct && (normalizeAttachmentProvider(stringValue(attachment.provider)) === "telegram" || normalizeAttachmentProvider(stringValue(attachment.remoteProvider)) === "telegram"))
209
+ return direct;
210
+ const remote = recordValue(attachment.remote) ?? recordValue(attachment.download);
211
+ const remoteFileId = stringValue(remote?.fileId);
212
+ if (remoteFileId && (normalizeAttachmentProvider(stringValue(remote?.provider)) === "telegram" || normalizeAttachmentProvider(stringValue(remote?.auth)) === "telegram"))
213
+ return remoteFileId;
214
+ const metadata = attachment.metadata;
215
+ if (Array.isArray(metadata)) {
216
+ const record = metadata.map(recordValue).filter((value) => Boolean(value)).at(-1);
217
+ return stringValue(record?.file_id);
218
+ }
219
+ return stringValue(recordValue(metadata)?.file_id);
220
+ }
221
+ function isPhotonBridgeUrl(url, env) {
222
+ const base = env.PHOTON_TRANSPORT_URL;
223
+ if (!base)
224
+ return false;
225
+ try {
226
+ return new URL(url).origin === new URL(base).origin;
227
+ }
228
+ catch {
229
+ return false;
230
+ }
231
+ }
232
+ function isTeamsAttachmentUrl(attachment, url) {
233
+ const remote = recordValue(attachment.remote) ?? recordValue(attachment.download);
234
+ const serviceUrl = stringValue(remote?.serviceUrl) || stringValue(attachment.serviceUrl);
235
+ try {
236
+ const target = new URL(url);
237
+ if (target.protocol !== "https:")
238
+ return false;
239
+ if (target.hostname.endsWith(".botframework.com"))
240
+ return true;
241
+ if (target.hostname.endsWith(".skype.com"))
242
+ return true;
243
+ if (!serviceUrl)
244
+ return false;
245
+ return target.origin === new URL(serviceUrl).origin;
246
+ }
247
+ catch {
248
+ return false;
249
+ }
250
+ }
251
+ function timeoutSignal(timeoutMs) {
252
+ return AbortSignal.timeout(timeoutMs);
253
+ }
254
+ async function parseJsonResponse(response) {
255
+ const text = await response.text();
256
+ if (!text)
257
+ return {};
258
+ try {
259
+ return JSON.parse(text);
260
+ }
261
+ catch {
262
+ return { text };
263
+ }
264
+ }
265
+ function stringValue(value) {
266
+ if (typeof value === "number" && Number.isFinite(value))
267
+ return String(value);
268
+ return typeof value === "string" ? value.trim() : "";
269
+ }
270
+ function recordValue(value) {
271
+ return Boolean(value && typeof value === "object" && !Array.isArray(value)) ? value : undefined;
272
+ }
273
+ //# sourceMappingURL=attachments-legacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments-legacy.js","sourceRoot":"","sources":["../src/attachments-legacy.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,4BAA4B,EAE7B,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,UAAsB,EACtB,KAIC;IAED,MAAM,QAAQ,GAAG,4BAA4B,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACjE,IAAI,QAAQ;QAAE,OAAO,0BAA0B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEjE,MAAM,KAAK,GAAG,MAAM,uBAAuB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC/D,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC9C,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,MAAM,OAAO,GAAG,MAAM,yBAAyB,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACxE,OAAO;QACL,GAAG;QACH,OAAO;QACP,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC1C,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED,KAAK,UA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AC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9E,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;AAChH,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { JsonObject } from "@assemblyline-agents/core";
2
+ import type { ChannelAttachmentRequest } from "./channel.js";
3
+ import type { BlobAdapter, RunRecord, StateAdapter } from "./index.js";
4
+ export interface AttachmentDownloadRequest {
5
+ url: string;
6
+ headers?: Record<string, string>;
7
+ provider?: string;
8
+ filename?: string;
9
+ }
10
+ export declare function materializeTurnAttachments(input: {
11
+ run: RunRecord;
12
+ channel: string;
13
+ attachments: JsonObject[];
14
+ trustedProvider?: string;
15
+ /**
16
+ * Attachment resolver bound to the channel module that produced the turn.
17
+ * When present it replaces the legacy in-runtime provider builders; the
18
+ * caller enforces the trust boundary (only the turn's own channel module).
19
+ */
20
+ resolveAttachment?: (attachment: JsonObject) => Promise<ChannelAttachmentRequest | undefined> | ChannelAttachmentRequest | undefined;
21
+ env: Record<string, string | undefined>;
22
+ fetch: typeof fetch;
23
+ blob: BlobAdapter;
24
+ state: Pick<StateAdapter, "appendEvent" | "recordFileIndex">;
25
+ }): Promise<JsonObject[]>;
26
+ export declare function fileManifestEntries(attachments: JsonObject[]): JsonObject[];
27
+ export declare function attachmentContentsFromRecord(attachment: JsonObject, blob?: BlobAdapter): Promise<string | Uint8Array | undefined>;
28
+ export declare function attachmentResourcePath(attachment: JsonObject): string;
29
+ export declare function attachmentContentType(attachment: JsonObject): string;
30
+ export declare function isTextualContentType(contentType: string): boolean;
31
+ /**
32
+ * Extract the first downloadable http(s) URL a channel attachment advertises.
33
+ * Exported for channel modules implementing `resolveAttachment`.
34
+ */
35
+ export declare function attachmentRemoteUrl(attachment: JsonObject): string | undefined;
36
+ /**
37
+ * True when the attachment's own trust markers (`remote.trusted` plus a
38
+ * matching provider/auth hint) claim the given provider. Channel modules use
39
+ * this in `resolveAttachment` before attaching credentials, so forged
40
+ * attachments never receive another provider's tokens.
41
+ */
42
+ export declare function attachmentTrustedForProvider(attachment: JsonObject, provider: string): boolean;
43
+ /** Exported for channel modules and the transitional legacy resolver module. */
44
+ export declare function firstDownloadableUrl(candidates: unknown[]): string | undefined;
45
+ export declare function trustedProviderForAttachment(attachment: JsonObject, trustedProvider: string | undefined): string | undefined;
46
+ export declare function normalizeAttachmentProvider(value: string | undefined): string | undefined;
47
+ /** Attachment download timeout (`OPENEVE_ATTACHMENT_FETCH_TIMEOUT_MS`). Exported for channel `resolveAttachment` lookups. */
48
+ export declare function attachmentFetchTimeoutMs(env: Record<string, string | undefined>): number;
49
+ //# sourceMappingURL=attachments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../src/attachments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAc,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AASnF,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB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