@alpacakit/agents 0.1.0-beta.19

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 (249) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +224 -0
  3. package/dist/agents/builtin.d.ts +19 -0
  4. package/dist/agents/builtin.d.ts.map +1 -0
  5. package/dist/agents/builtin.js +14 -0
  6. package/dist/agents/claude.d.ts +20 -0
  7. package/dist/agents/claude.d.ts.map +1 -0
  8. package/dist/agents/claude.js +480 -0
  9. package/dist/agents/codex.d.ts +19 -0
  10. package/dist/agents/codex.d.ts.map +1 -0
  11. package/dist/agents/codex.js +355 -0
  12. package/dist/agents/openai-compatible/config.d.ts +16 -0
  13. package/dist/agents/openai-compatible/config.d.ts.map +1 -0
  14. package/dist/agents/openai-compatible/config.js +160 -0
  15. package/dist/agents/openai-compatible/engine.d.ts +18 -0
  16. package/dist/agents/openai-compatible/engine.d.ts.map +1 -0
  17. package/dist/agents/openai-compatible/engine.js +10 -0
  18. package/dist/agents/openai-compatible/fetch-engine.d.ts +38 -0
  19. package/dist/agents/openai-compatible/fetch-engine.d.ts.map +1 -0
  20. package/dist/agents/openai-compatible/fetch-engine.js +216 -0
  21. package/dist/agents/openai-compatible/pi/engine.d.ts +32 -0
  22. package/dist/agents/openai-compatible/pi/engine.d.ts.map +1 -0
  23. package/dist/agents/openai-compatible/pi/engine.js +98 -0
  24. package/dist/agents/openai-compatible/pi/module.d.ts +87 -0
  25. package/dist/agents/openai-compatible/pi/module.d.ts.map +1 -0
  26. package/dist/agents/openai-compatible/pi/module.js +43 -0
  27. package/dist/agents/openai-compatible/pi/sandbox.d.ts +25 -0
  28. package/dist/agents/openai-compatible/pi/sandbox.d.ts.map +1 -0
  29. package/dist/agents/openai-compatible/pi/sandbox.js +69 -0
  30. package/dist/agents/openai-compatible/pi/session.d.ts +17 -0
  31. package/dist/agents/openai-compatible/pi/session.d.ts.map +1 -0
  32. package/dist/agents/openai-compatible/pi/session.js +354 -0
  33. package/dist/agents/openai-compatible/response.d.ts +19 -0
  34. package/dist/agents/openai-compatible/response.d.ts.map +1 -0
  35. package/dist/agents/openai-compatible/response.js +203 -0
  36. package/dist/agents/openai-compatible/types.d.ts +34 -0
  37. package/dist/agents/openai-compatible/types.d.ts.map +1 -0
  38. package/dist/agents/openai-compatible/types.js +1 -0
  39. package/dist/agents/openai-compatible.d.ts +12 -0
  40. package/dist/agents/openai-compatible.d.ts.map +1 -0
  41. package/dist/agents/openai-compatible.js +45 -0
  42. package/dist/auth/login-probe.d.ts +21 -0
  43. package/dist/auth/login-probe.d.ts.map +1 -0
  44. package/dist/auth/login-probe.js +47 -0
  45. package/dist/auth/login.d.ts +79 -0
  46. package/dist/auth/login.d.ts.map +1 -0
  47. package/dist/auth/login.js +9 -0
  48. package/dist/auth/material.d.ts +87 -0
  49. package/dist/auth/material.d.ts.map +1 -0
  50. package/dist/auth/material.js +59 -0
  51. package/dist/auth/profile-store.d.ts +14 -0
  52. package/dist/auth/profile-store.d.ts.map +1 -0
  53. package/dist/auth/profile-store.js +101 -0
  54. package/dist/auth/secrets.d.ts +14 -0
  55. package/dist/auth/secrets.d.ts.map +1 -0
  56. package/dist/auth/secrets.js +40 -0
  57. package/dist/codex/app-server.d.ts +30 -0
  58. package/dist/codex/app-server.d.ts.map +1 -0
  59. package/dist/codex/app-server.js +322 -0
  60. package/dist/codex/index.d.ts +3 -0
  61. package/dist/codex/index.d.ts.map +1 -0
  62. package/dist/codex/index.js +1 -0
  63. package/dist/codex/protocol.d.ts +124 -0
  64. package/dist/codex/protocol.d.ts.map +1 -0
  65. package/dist/codex/protocol.js +283 -0
  66. package/dist/config/agent-config-validation.d.ts +22 -0
  67. package/dist/config/agent-config-validation.d.ts.map +1 -0
  68. package/dist/config/agent-config-validation.js +31 -0
  69. package/dist/config/agent-configs.d.ts +37 -0
  70. package/dist/config/agent-configs.d.ts.map +1 -0
  71. package/dist/config/agent-configs.js +214 -0
  72. package/dist/config/compose.d.ts +10 -0
  73. package/dist/config/compose.d.ts.map +1 -0
  74. package/dist/config/compose.js +89 -0
  75. package/dist/config/config.d.ts +21 -0
  76. package/dist/config/config.d.ts.map +1 -0
  77. package/dist/config/config.js +33 -0
  78. package/dist/config/errors.d.ts +45 -0
  79. package/dist/config/errors.d.ts.map +1 -0
  80. package/dist/config/errors.js +37 -0
  81. package/dist/config/extension.d.ts +3 -0
  82. package/dist/config/extension.d.ts.map +1 -0
  83. package/dist/config/extension.js +1 -0
  84. package/dist/config/ids.d.ts +8 -0
  85. package/dist/config/ids.d.ts.map +1 -0
  86. package/dist/config/ids.js +4 -0
  87. package/dist/config/index.d.ts +12 -0
  88. package/dist/config/index.d.ts.map +1 -0
  89. package/dist/config/index.js +6 -0
  90. package/dist/config/model.d.ts +105 -0
  91. package/dist/config/model.d.ts.map +1 -0
  92. package/dist/config/model.js +1 -0
  93. package/dist/config/paths.d.ts +7 -0
  94. package/dist/config/paths.d.ts.map +1 -0
  95. package/dist/config/paths.js +10 -0
  96. package/dist/config/schema.d.ts +59 -0
  97. package/dist/config/schema.d.ts.map +1 -0
  98. package/dist/config/schema.js +83 -0
  99. package/dist/config/store.d.ts +34 -0
  100. package/dist/config/store.d.ts.map +1 -0
  101. package/dist/config/store.js +420 -0
  102. package/dist/config/support.d.ts +14 -0
  103. package/dist/config/support.d.ts.map +1 -0
  104. package/dist/config/support.js +32 -0
  105. package/dist/config/values.d.ts +21 -0
  106. package/dist/config/values.d.ts.map +1 -0
  107. package/dist/config/values.js +22 -0
  108. package/dist/config/xdg.d.ts +20 -0
  109. package/dist/config/xdg.d.ts.map +1 -0
  110. package/dist/config/xdg.js +23 -0
  111. package/dist/core/async-queue.d.ts +14 -0
  112. package/dist/core/async-queue.d.ts.map +1 -0
  113. package/dist/core/async-queue.js +46 -0
  114. package/dist/core/env.d.ts +19 -0
  115. package/dist/core/env.d.ts.map +1 -0
  116. package/dist/core/env.js +39 -0
  117. package/dist/core/error.d.ts +121 -0
  118. package/dist/core/error.d.ts.map +1 -0
  119. package/dist/core/error.js +88 -0
  120. package/dist/core/fs.d.ts +16 -0
  121. package/dist/core/fs.d.ts.map +1 -0
  122. package/dist/core/fs.js +30 -0
  123. package/dist/core/json.d.ts +20 -0
  124. package/dist/core/json.d.ts.map +1 -0
  125. package/dist/core/json.js +42 -0
  126. package/dist/core/node-ports.d.ts +9 -0
  127. package/dist/core/node-ports.d.ts.map +1 -0
  128. package/dist/core/node-ports.js +135 -0
  129. package/dist/core/ports.d.ts +71 -0
  130. package/dist/core/ports.d.ts.map +1 -0
  131. package/dist/core/ports.js +19 -0
  132. package/dist/core/redact.d.ts +8 -0
  133. package/dist/core/redact.d.ts.map +1 -0
  134. package/dist/core/redact.js +66 -0
  135. package/dist/core/run.d.ts +125 -0
  136. package/dist/core/run.d.ts.map +1 -0
  137. package/dist/core/run.js +27 -0
  138. package/dist/core/values.d.ts +12 -0
  139. package/dist/core/values.d.ts.map +1 -0
  140. package/dist/core/values.js +9 -0
  141. package/dist/corpus/failure-corpus.d.ts +21 -0
  142. package/dist/corpus/failure-corpus.d.ts.map +1 -0
  143. package/dist/corpus/failure-corpus.js +89 -0
  144. package/dist/fleet/fleet.d.ts +120 -0
  145. package/dist/fleet/fleet.d.ts.map +1 -0
  146. package/dist/fleet/fleet.js +409 -0
  147. package/dist/fleet/policy.d.ts +45 -0
  148. package/dist/fleet/policy.d.ts.map +1 -0
  149. package/dist/fleet/policy.js +50 -0
  150. package/dist/fleet/store.d.ts +28 -0
  151. package/dist/fleet/store.d.ts.map +1 -0
  152. package/dist/fleet/store.js +225 -0
  153. package/dist/host/capabilities.d.ts +146 -0
  154. package/dist/host/capabilities.d.ts.map +1 -0
  155. package/dist/host/capabilities.js +59 -0
  156. package/dist/host/context.d.ts +29 -0
  157. package/dist/host/context.d.ts.map +1 -0
  158. package/dist/host/context.js +11 -0
  159. package/dist/host/github-dir.d.ts +16 -0
  160. package/dist/host/github-dir.d.ts.map +1 -0
  161. package/dist/host/github-dir.js +164 -0
  162. package/dist/host/mcp-list.d.ts +12 -0
  163. package/dist/host/mcp-list.d.ts.map +1 -0
  164. package/dist/host/mcp-list.js +122 -0
  165. package/dist/host/requirement-ref.d.ts +12 -0
  166. package/dist/host/requirement-ref.d.ts.map +1 -0
  167. package/dist/host/requirement-ref.js +40 -0
  168. package/dist/host/run-command.d.ts +27 -0
  169. package/dist/host/run-command.d.ts.map +1 -0
  170. package/dist/host/run-command.js +66 -0
  171. package/dist/host/validate-spec.d.ts +10 -0
  172. package/dist/host/validate-spec.d.ts.map +1 -0
  173. package/dist/host/validate-spec.js +69 -0
  174. package/dist/index.d.ts +69 -0
  175. package/dist/index.d.ts.map +1 -0
  176. package/dist/index.js +41 -0
  177. package/dist/kernel/classify.d.ts +44 -0
  178. package/dist/kernel/classify.d.ts.map +1 -0
  179. package/dist/kernel/classify.js +136 -0
  180. package/dist/kernel/cli-agent.d.ts +62 -0
  181. package/dist/kernel/cli-agent.d.ts.map +1 -0
  182. package/dist/kernel/cli-agent.js +281 -0
  183. package/dist/kernel/cli-login.d.ts +13 -0
  184. package/dist/kernel/cli-login.d.ts.map +1 -0
  185. package/dist/kernel/cli-login.js +199 -0
  186. package/dist/kernel/definition.d.ts +41 -0
  187. package/dist/kernel/definition.d.ts.map +1 -0
  188. package/dist/kernel/definition.js +13 -0
  189. package/dist/kernel/env-template.d.ts +17 -0
  190. package/dist/kernel/env-template.d.ts.map +1 -0
  191. package/dist/kernel/env-template.js +78 -0
  192. package/dist/kernel/facets.d.ts +58 -0
  193. package/dist/kernel/facets.d.ts.map +1 -0
  194. package/dist/kernel/facets.js +102 -0
  195. package/dist/kernel/guard.d.ts +24 -0
  196. package/dist/kernel/guard.d.ts.map +1 -0
  197. package/dist/kernel/guard.js +69 -0
  198. package/dist/kernel/handle.d.ts +29 -0
  199. package/dist/kernel/handle.d.ts.map +1 -0
  200. package/dist/kernel/handle.js +97 -0
  201. package/dist/kernel/keyed.d.ts +19 -0
  202. package/dist/kernel/keyed.d.ts.map +1 -0
  203. package/dist/kernel/keyed.js +35 -0
  204. package/dist/kernel/login.d.ts +20 -0
  205. package/dist/kernel/login.d.ts.map +1 -0
  206. package/dist/kernel/login.js +74 -0
  207. package/dist/kernel/options.d.ts +73 -0
  208. package/dist/kernel/options.d.ts.map +1 -0
  209. package/dist/kernel/options.js +41 -0
  210. package/dist/kernel/run.d.ts +20 -0
  211. package/dist/kernel/run.d.ts.map +1 -0
  212. package/dist/kernel/run.js +245 -0
  213. package/dist/kernel/runtime.d.ts +48 -0
  214. package/dist/kernel/runtime.d.ts.map +1 -0
  215. package/dist/kernel/runtime.js +108 -0
  216. package/dist/keyring/index.d.ts +2 -0
  217. package/dist/keyring/index.d.ts.map +1 -0
  218. package/dist/keyring/index.js +1 -0
  219. package/dist/keyring/resolver.d.ts +9 -0
  220. package/dist/keyring/resolver.d.ts.map +1 -0
  221. package/dist/keyring/resolver.js +62 -0
  222. package/dist/run-agent.d.ts +19 -0
  223. package/dist/run-agent.d.ts.map +1 -0
  224. package/dist/run-agent.js +25 -0
  225. package/dist/structured/extract.d.ts +27 -0
  226. package/dist/structured/extract.d.ts.map +1 -0
  227. package/dist/structured/extract.js +188 -0
  228. package/dist/structured/run-structured.d.ts +83 -0
  229. package/dist/structured/run-structured.d.ts.map +1 -0
  230. package/dist/structured/run-structured.js +202 -0
  231. package/dist/structured/standard-schema.d.ts +34 -0
  232. package/dist/structured/standard-schema.d.ts.map +1 -0
  233. package/dist/structured/standard-schema.js +6 -0
  234. package/dist/testing/fake-agent.d.ts +32 -0
  235. package/dist/testing/fake-agent.d.ts.map +1 -0
  236. package/dist/testing/fake-agent.js +43 -0
  237. package/dist/testing/fake-clock.d.ts +8 -0
  238. package/dist/testing/fake-clock.d.ts.map +1 -0
  239. package/dist/testing/fake-clock.js +44 -0
  240. package/dist/testing/fake-exec.d.ts +26 -0
  241. package/dist/testing/fake-exec.d.ts.map +1 -0
  242. package/dist/testing/fake-exec.js +69 -0
  243. package/dist/testing/fake-secrets.d.ts +3 -0
  244. package/dist/testing/fake-secrets.d.ts.map +1 -0
  245. package/dist/testing/fake-secrets.js +5 -0
  246. package/dist/testing/index.d.ts +10 -0
  247. package/dist/testing/index.d.ts.map +1 -0
  248. package/dist/testing/index.js +9 -0
  249. package/package.json +75 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The runtime (design "Kernel"): a registry of agent definitions plus
3
+ * resolved ports and an explicit base environment — NEVER an implicit
4
+ * `process.env`. Binding a definition yields an `Agent`; the facet
5
+ * mirror turns absent capabilities (rule 1 `?`) into `null` (rule 2).
6
+ */
7
+ import { type Ports } from "../core/ports.js";
8
+ import type { RunHandle } from "../core/run.js";
9
+ import { type StructuredHandle, type StructuredRunOptions } from "../structured/run-structured.js";
10
+ import type { AgentDefinition } from "./definition.js";
11
+ import { type AgentAuth, type AgentDoctor, type AgentLogin, type AgentMcp, type AgentSkills } from "./facets.js";
12
+ import { type RunOptions } from "./options.js";
13
+ export interface Agent<Id extends string = string> {
14
+ readonly id: Id;
15
+ run<T>(options: StructuredRunOptions<T>): StructuredHandle<T>;
16
+ run(options: RunOptions): RunHandle;
17
+ run<T>(options: RunOptions | StructuredRunOptions<T>): RunHandle | StructuredHandle<T>;
18
+ auth: AgentAuth | null;
19
+ login: AgentLogin | null;
20
+ skills: AgentSkills | null;
21
+ mcp: AgentMcp | null;
22
+ doctor: AgentDoctor | null;
23
+ }
24
+ export interface AgentRuntime<Id extends string = string> {
25
+ agent<I extends Id>(id: I): Agent<I>;
26
+ agents(): Agent<Id>[];
27
+ /** The resolved ports — composition layers (fleet) reuse these. */
28
+ readonly ports: Ports;
29
+ }
30
+ export type AgentRuntimeOptions<Defs extends readonly AgentDefinition[]> = {
31
+ agents: Defs;
32
+ ports?: Partial<Ports>;
33
+ /**
34
+ * The base environment every run starts from. Required and explicit —
35
+ * the runtime never falls back to `process.env`, so omitting it can no
36
+ * longer silently yield an empty env that fails auth at run time. Pass
37
+ * `processEnv()` for the ambient environment, or `{}` for a hermetic run.
38
+ */
39
+ baseEnv: Record<string, string>;
40
+ };
41
+ /**
42
+ * Shallow per-port merge — except `secrets`, which is a registry, not an
43
+ * implementation: entries merge additively over the built-in "env"
44
+ * resolver, so registering "keychain" never silently drops "env".
45
+ */
46
+ export declare function resolvePorts(ports?: Partial<Ports>): Ports;
47
+ export declare function createAgentRuntime<const Defs extends readonly AgentDefinition[]>(options: AgentRuntimeOptions<Defs>): AgentRuntime<Defs[number]["id"]>;
48
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/kernel/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAA6B,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAE1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,WAAW,EAOjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,cAAc,CAAC;AAGlE,MAAM,WAAW,KAAK,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM;IAC/C,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC9D,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,GAAG,CAAC,CAAC,EACH,OAAO,EAAE,UAAU,GAAG,oBAAoB,CAAC,CAAC,CAAC,GAC5C,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM;IACtD,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,MAAM,mBAAmB,CAAC,IAAI,SAAS,SAAS,eAAe,EAAE,IAAI;IACzE,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACvB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAS1D;AAqED,wBAAgB,kBAAkB,CAChC,KAAK,CAAC,IAAI,SAAS,SAAS,eAAe,EAAE,EAC7C,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CA8BtE"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The runtime (design "Kernel"): a registry of agent definitions plus
3
+ * resolved ports and an explicit base environment — NEVER an implicit
4
+ * `process.env`. Binding a definition yields an `Agent`; the facet
5
+ * mirror turns absent capabilities (rule 1 `?`) into `null` (rule 2).
6
+ */
7
+ import { envResolver } from "../auth/secrets.js";
8
+ import { applyEnvPatch } from "../core/env.js";
9
+ import { AGENT_ERROR_CODE, AgentError } from "../core/error.js";
10
+ import { fetchHttp, nodeExec, systemClock } from "../core/node-ports.js";
11
+ import { noopLogger, noopTelemetry } from "../core/ports.js";
12
+ import { isStructuredRunOptions, resolveStructuredRunOptions, startStructuredRun, } from "../structured/run-structured.js";
13
+ import { bindAuth, bindDoctor, bindLogin, bindMcp, bindSkills, } from "./facets.js";
14
+ import { resolveRunOptions } from "./options.js";
15
+ import { startRun } from "./run.js";
16
+ /**
17
+ * Shallow per-port merge — except `secrets`, which is a registry, not an
18
+ * implementation: entries merge additively over the built-in "env"
19
+ * resolver, so registering "keychain" never silently drops "env".
20
+ */
21
+ export function resolvePorts(ports) {
22
+ return {
23
+ exec: ports?.exec ?? nodeExec,
24
+ clock: ports?.clock ?? systemClock,
25
+ secrets: { env: envResolver(), ...ports?.secrets },
26
+ http: ports?.http ?? fetchHttp,
27
+ telemetry: ports?.telemetry ?? noopTelemetry,
28
+ logger: ports?.logger ?? noopLogger,
29
+ };
30
+ }
31
+ function bindAgent(definition, ports, baseEnv) {
32
+ const binding = {
33
+ agentId: definition.id,
34
+ env: baseEnv,
35
+ exec: ports.exec,
36
+ http: ports.http,
37
+ clock: ports.clock,
38
+ logger: ports.logger,
39
+ secrets: ports.secrets,
40
+ };
41
+ function runRaw(options) {
42
+ const resolved = resolveRunOptions(options);
43
+ return startRun({
44
+ definition,
45
+ options: resolved,
46
+ callerSignal: options.signal ?? null,
47
+ env: applyEnvPatch(baseEnv, resolved.env),
48
+ ports,
49
+ });
50
+ }
51
+ function run(options) {
52
+ if (isStructuredRunOptions(options)) {
53
+ const { runOptions, contract } = resolveStructuredRunOptions(options);
54
+ return startStructuredRun({
55
+ agentId: definition.id,
56
+ options: runOptions,
57
+ contract,
58
+ runAttempt: runRaw,
59
+ });
60
+ }
61
+ return runRaw(options);
62
+ }
63
+ return {
64
+ id: definition.id,
65
+ run,
66
+ auth: definition.auth === undefined ? null : bindAuth(definition.auth, binding),
67
+ login: definition.login === undefined
68
+ ? null
69
+ : bindLogin(definition.login, binding),
70
+ skills: definition.skills === undefined
71
+ ? null
72
+ : bindSkills(definition.skills, binding),
73
+ mcp: definition.mcp === undefined ? null : bindMcp(definition.mcp, binding),
74
+ doctor: definition.doctor === undefined
75
+ ? null
76
+ : bindDoctor(definition.doctor, binding),
77
+ };
78
+ }
79
+ export function createAgentRuntime(options) {
80
+ const ports = resolvePorts(options.ports);
81
+ const baseEnv = options.baseEnv;
82
+ const bound = new Map();
83
+ for (const definition of options.agents) {
84
+ if (bound.has(definition.id)) {
85
+ throw new AgentError({
86
+ code: AGENT_ERROR_CODE.invalidInput,
87
+ message: `Duplicate agent id "${definition.id}"`,
88
+ data: { reason: `agent id "${definition.id}" registered twice` },
89
+ });
90
+ }
91
+ bound.set(definition.id, bindAgent(definition, ports, baseEnv));
92
+ }
93
+ return {
94
+ ports,
95
+ agent: (id) => {
96
+ const agent = bound.get(id);
97
+ if (agent === undefined) {
98
+ throw new AgentError({
99
+ code: AGENT_ERROR_CODE.invalidInput,
100
+ message: `Unknown agent id "${id}"`,
101
+ data: { reason: `no agent registered with id "${id}"` },
102
+ });
103
+ }
104
+ return agent;
105
+ },
106
+ agents: () => [...bound.values()],
107
+ };
108
+ }
@@ -0,0 +1,2 @@
1
+ export { keyringResolver, type KeyringResolverOptions, } from "./resolver.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ export { keyringResolver, } from "./resolver.js";
@@ -0,0 +1,9 @@
1
+ import type { SecretResolver } from "../core/ports.js";
2
+ export type KeyringResolverOptions = {
3
+ readonly service: string;
4
+ };
5
+ type KeyringModuleLoader = () => Promise<unknown>;
6
+ export declare function keyringResolver(options: KeyringResolverOptions): SecretResolver;
7
+ export declare function createKeyringResolver(options: KeyringResolverOptions, loader: KeyringModuleLoader): SecretResolver;
8
+ export {};
9
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/keyring/resolver.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,KAAK,mBAAmB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAiBlD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,cAAc,CAEhB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,EAC/B,MAAM,EAAE,mBAAmB,GAC1B,cAAc,CA0BhB"}
@@ -0,0 +1,62 @@
1
+ // biome-ignore-all lint/style/useNamingConvention: Keyring peer exports mirror upstream PascalCase names.
2
+ import { AGENT_ERROR_CODE, AgentError, NOT_AVAILABLE_CAUSE, } from "../core/error.js";
3
+ const KEYRING_PEER_PACKAGE = "@napi-rs/keyring";
4
+ const KEYRING_ENTRY_EXPORT = "Entry";
5
+ const EMPTY_SECRET_VALUE = "";
6
+ const defaultKeyringModuleLoader = () => import(KEYRING_PEER_PACKAGE);
7
+ export function keyringResolver(options) {
8
+ return createKeyringResolver(options, defaultKeyringModuleLoader);
9
+ }
10
+ export function createKeyringResolver(options, loader) {
11
+ const service = options.service;
12
+ let modulePromise = null;
13
+ const load = () => {
14
+ modulePromise ??= loadKeyringModule(loader);
15
+ return modulePromise;
16
+ };
17
+ return {
18
+ resolve: async (id) => {
19
+ const module = await load();
20
+ try {
21
+ // Absent entries are the `null` return (`Entry.getPassword():
22
+ // string | null` in @napi-rs/keyring); anything thrown is a real
23
+ // keychain failure, never "missing secret".
24
+ const value = await new module.Entry(service, id).getPassword();
25
+ return value === EMPTY_SECRET_VALUE ? null : value;
26
+ }
27
+ catch (error) {
28
+ throw new AgentError({
29
+ code: AGENT_ERROR_CODE.failed,
30
+ message: `Keyring secret "${id}" could not be read`,
31
+ data: { exitCode: null, stdoutTail: null, stderrTail: null },
32
+ cause: error,
33
+ });
34
+ }
35
+ },
36
+ };
37
+ }
38
+ async function loadKeyringModule(loader) {
39
+ let loaded;
40
+ try {
41
+ loaded = await loader();
42
+ }
43
+ catch (error) {
44
+ throw keyringNotInstalledError(error);
45
+ }
46
+ if (typeof loaded !== "object" || loaded === null) {
47
+ throw keyringNotInstalledError(null);
48
+ }
49
+ const entry = Reflect.get(loaded, KEYRING_ENTRY_EXPORT);
50
+ if (typeof entry !== "function") {
51
+ throw keyringNotInstalledError(null);
52
+ }
53
+ return { Entry: entry };
54
+ }
55
+ function keyringNotInstalledError(cause) {
56
+ return new AgentError({
57
+ code: AGENT_ERROR_CODE.notAvailable,
58
+ message: "Keyring peer is not installed",
59
+ data: { cause: NOT_AVAILABLE_CAUSE.notInstalled },
60
+ cause,
61
+ });
62
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `runAgent` — the zero-config sugar for the minimal persona. This is
3
+ * the ONLY place `process.env` is a documented default, and v1's 1-hour
4
+ * total timeout lives here as a documented default rather than kernel
5
+ * magic.
6
+ */
7
+ import { type BuiltinAgentId } from "./agents/builtin.js";
8
+ import type { Ports } from "./core/ports.js";
9
+ import type { RunHandle } from "./core/run.js";
10
+ import type { AgentDefinition } from "./kernel/definition.js";
11
+ import type { RunOptions } from "./kernel/options.js";
12
+ export type RunAgentOptions = RunOptions & {
13
+ agent: BuiltinAgentId | AgentDefinition;
14
+ ports?: Partial<Ports>;
15
+ /** Defaults to the current process env; pass explicitly to override. */
16
+ baseEnv?: Record<string, string>;
17
+ };
18
+ export declare function runAgent(options: RunAgentOptions): RunHandle;
19
+ //# sourceMappingURL=run-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-agent.d.ts","sourceRoot":"","sources":["../src/run-agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKtD,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG;IACzC,KAAK,EAAE,cAAc,GAAG,eAAe,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACvB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,CAe5D"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `runAgent` — the zero-config sugar for the minimal persona. This is
3
+ * the ONLY place `process.env` is a documented default, and v1's 1-hour
4
+ * total timeout lives here as a documented default rather than kernel
5
+ * magic.
6
+ */
7
+ import { builtinAgentFactories, } from "./agents/builtin.js";
8
+ import { processEnv } from "./core/env.js";
9
+ import { createAgentRuntime } from "./kernel/runtime.js";
10
+ const DEFAULT_TOTAL_TIMEOUT_MS = 3_600_000;
11
+ export function runAgent(options) {
12
+ const { agent, ports, baseEnv, ...runOptions } = options;
13
+ const definition = typeof agent === "string" ? builtinAgentFactories[agent]() : agent;
14
+ const runtime = createAgentRuntime({
15
+ agents: [definition],
16
+ ...(ports === undefined ? {} : { ports }),
17
+ baseEnv: baseEnv ?? processEnv(),
18
+ });
19
+ return runtime.agent(definition.id).run({
20
+ ...runOptions,
21
+ // The documented default applies per field (rule 1): supplying
22
+ // `limits.idleMs` must not silently drop the 1h total cap.
23
+ limits: { totalMs: DEFAULT_TOTAL_TIMEOUT_MS, ...runOptions.limits },
24
+ });
25
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Extraction strategy chain (S1) and resilient JSON parsing (S2): kept
3
+ * from v1 because it is hard-won robustness against truncated streams,
4
+ * generalized to neutral configurable markers.
5
+ */
6
+ export type Markers = {
7
+ start: string;
8
+ end: string;
9
+ };
10
+ export declare const DEFAULT_MARKERS: Markers;
11
+ /** A strategy returns the candidate block text, or null to pass. */
12
+ export type ExtractionStrategy = (text: string, markers: Markers) => string | null;
13
+ export declare const defaultExtractionStrategies: readonly ExtractionStrategy[];
14
+ export declare function extractBlock(text: string, markers: Markers, strategies?: readonly ExtractionStrategy[]): string | null;
15
+ export type JsonParseOutcome = {
16
+ ok: true;
17
+ value: unknown;
18
+ } | {
19
+ ok: false;
20
+ error: string;
21
+ };
22
+ /**
23
+ * Parse with the v1 resilience chain: direct → control-char escaping →
24
+ * truncation repair (both fixes composed for the last attempt).
25
+ */
26
+ export declare function parseJsonResilient(text: string): JsonParseOutcome;
27
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/structured/extract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,OAAO,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,eAAO,MAAM,eAAe,EAAE,OAG7B,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,kBAAkB,GAAG,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,KACb,MAAM,GAAG,IAAI,CAAC;AAoCnB,eAAO,MAAM,2BAA2B,EAAE,SAAS,kBAAkB,EAIpE,CAAC;AA2CF,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,GAAE,SAAS,kBAAkB,EAAgC,GACtE,MAAM,GAAG,IAAI,CAQf;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC5B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA+EjC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAYjE"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Extraction strategy chain (S1) and resilient JSON parsing (S2): kept
3
+ * from v1 because it is hard-won robustness against truncated streams,
4
+ * generalized to neutral configurable markers.
5
+ */
6
+ export const DEFAULT_MARKERS = {
7
+ start: "<<<AGENT_OUTPUT_START>>>",
8
+ end: "<<<AGENT_OUTPUT_END>>>",
9
+ };
10
+ const markedBlock = (text, markers) => {
11
+ const start = text.lastIndexOf(markers.start);
12
+ const end = text.lastIndexOf(markers.end);
13
+ if (start === -1 || end === -1 || end <= start) {
14
+ return null;
15
+ }
16
+ return text.slice(start + markers.start.length, end).trim();
17
+ };
18
+ const unclosedMarkedBlock = (text, markers) => {
19
+ const start = text.lastIndexOf(markers.start);
20
+ if (start === -1) {
21
+ return null;
22
+ }
23
+ return text.slice(start + markers.start.length).trim();
24
+ };
25
+ const firstJsonValue = (text) => {
26
+ for (let index = 0; index < text.length; index += 1) {
27
+ const char = text[index];
28
+ if (char !== "{" && char !== "[") {
29
+ continue;
30
+ }
31
+ const candidate = balancedJsonCandidate(text, index);
32
+ if (candidate === null) {
33
+ return text.slice(index).trim();
34
+ }
35
+ if (tryParse(candidate).ok) {
36
+ return candidate.trim();
37
+ }
38
+ }
39
+ return null;
40
+ };
41
+ export const defaultExtractionStrategies = [
42
+ markedBlock,
43
+ unclosedMarkedBlock,
44
+ firstJsonValue,
45
+ ];
46
+ function balancedJsonCandidate(text, start) {
47
+ const stack = [];
48
+ let inString = false;
49
+ let escaped = false;
50
+ for (let index = start; index < text.length; index += 1) {
51
+ const char = text[index];
52
+ if (escaped) {
53
+ escaped = false;
54
+ continue;
55
+ }
56
+ if (char === "\\" && inString) {
57
+ escaped = true;
58
+ continue;
59
+ }
60
+ if (char === '"') {
61
+ inString = !inString;
62
+ continue;
63
+ }
64
+ if (inString) {
65
+ continue;
66
+ }
67
+ if (char === "{") {
68
+ stack.push("}");
69
+ continue;
70
+ }
71
+ if (char === "[") {
72
+ stack.push("]");
73
+ continue;
74
+ }
75
+ if (char === "}" || char === "]") {
76
+ if (stack.pop() !== char) {
77
+ return text.slice(start, index + 1);
78
+ }
79
+ if (stack.length === 0) {
80
+ return text.slice(start, index + 1);
81
+ }
82
+ }
83
+ }
84
+ return null;
85
+ }
86
+ export function extractBlock(text, markers, strategies = defaultExtractionStrategies) {
87
+ for (const strategy of strategies) {
88
+ const block = strategy(text, markers);
89
+ if (block !== null && block !== "") {
90
+ return block;
91
+ }
92
+ }
93
+ return null;
94
+ }
95
+ function tryParse(text) {
96
+ try {
97
+ return { ok: true, value: JSON.parse(text) };
98
+ }
99
+ catch (error) {
100
+ return {
101
+ ok: false,
102
+ error: error instanceof Error ? error.message : String(error),
103
+ };
104
+ }
105
+ }
106
+ const CONTROL_CHAR_ESCAPES = {
107
+ "\n": "\\n",
108
+ "\r": "\\r",
109
+ "\t": "\\t",
110
+ };
111
+ /** Escape raw control characters that appear inside string literals. */
112
+ function escapeControlCharsInStrings(text) {
113
+ let result = "";
114
+ let inString = false;
115
+ let escaped = false;
116
+ for (const char of text) {
117
+ if (inString && !escaped && char in CONTROL_CHAR_ESCAPES) {
118
+ result += CONTROL_CHAR_ESCAPES[char];
119
+ continue;
120
+ }
121
+ result += char;
122
+ if (escaped) {
123
+ escaped = false;
124
+ }
125
+ else if (char === "\\" && inString) {
126
+ escaped = true;
127
+ }
128
+ else if (char === '"') {
129
+ inString = !inString;
130
+ }
131
+ }
132
+ return result;
133
+ }
134
+ /** Close whatever a truncated stream left open: strings, arrays, objects. */
135
+ function repairTruncation(text) {
136
+ const stack = [];
137
+ let inString = false;
138
+ let escaped = false;
139
+ for (const char of text) {
140
+ if (escaped) {
141
+ escaped = false;
142
+ continue;
143
+ }
144
+ if (char === "\\" && inString) {
145
+ escaped = true;
146
+ continue;
147
+ }
148
+ if (char === '"') {
149
+ inString = !inString;
150
+ continue;
151
+ }
152
+ if (inString) {
153
+ continue;
154
+ }
155
+ if (char === "{" || char === "[") {
156
+ stack.push(char);
157
+ }
158
+ else if (char === "}" || char === "]") {
159
+ stack.pop();
160
+ }
161
+ }
162
+ let repaired = text.trimEnd();
163
+ if (inString) {
164
+ repaired += '"';
165
+ }
166
+ repaired = repaired.replace(/,\s*$/, "");
167
+ for (const open of stack.reverse()) {
168
+ repaired += open === "{" ? "}" : "]";
169
+ }
170
+ return repaired;
171
+ }
172
+ /**
173
+ * Parse with the v1 resilience chain: direct → control-char escaping →
174
+ * truncation repair (both fixes composed for the last attempt).
175
+ */
176
+ export function parseJsonResilient(text) {
177
+ const direct = tryParse(text);
178
+ if (direct.ok) {
179
+ return direct;
180
+ }
181
+ const escapedText = escapeControlCharsInStrings(text);
182
+ const escapedParse = tryParse(escapedText);
183
+ if (escapedParse.ok) {
184
+ return escapedParse;
185
+ }
186
+ const repaired = tryParse(repairTruncation(escapedText));
187
+ return repaired.ok ? repaired : direct;
188
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Structured output (design "Structured output"): a decorator over
3
+ * kernel runs. Repair happens WITHIN one candidate — it composes below
4
+ * the fleet, never inside it. Exhausted repairs fail with
5
+ * `output_rejected` carrying the issue list.
6
+ */
7
+ import { type Issue } from "../core/error.js";
8
+ import type { RunEvent, RunHandle, RunResult } from "../core/run.js";
9
+ import type { RunOptions } from "../kernel/options.js";
10
+ import { type ExtractionStrategy, type Markers } from "./extract.js";
11
+ import type { StandardSchemaV1 } from "./standard-schema.js";
12
+ export declare const CONTRACT_PROMPT_PLACEMENT: {
13
+ readonly append: "append";
14
+ readonly embedded: "embedded";
15
+ };
16
+ export type ContractPromptPlacement = (typeof CONTRACT_PROMPT_PLACEMENT)[keyof typeof CONTRACT_PROMPT_PLACEMENT];
17
+ export type ParseOutcome<T> = {
18
+ ok: true;
19
+ value: T;
20
+ } | {
21
+ ok: false;
22
+ issues: Issue[];
23
+ };
24
+ export type RepairContext = {
25
+ basePrompt: string;
26
+ contractInstruction: string;
27
+ attempt: number;
28
+ issues: Issue[];
29
+ previousBlock: string | null;
30
+ markers: Markers;
31
+ };
32
+ export type OutputContract<T> = {
33
+ readonly schema: StandardSchemaV1<unknown, T> | ((blockText: string) => ParseOutcome<T>);
34
+ readonly markers?: Markers;
35
+ readonly extractionStrategies?: readonly ExtractionStrategy[];
36
+ readonly renderContract?: (markers: Markers) => string;
37
+ /** Whether the driver appends the rendered contract to the base prompt. */
38
+ readonly promptPlacement: ContractPromptPlacement;
39
+ readonly repair?: {
40
+ readonly maxAttempts?: number;
41
+ readonly shouldRetry?: (issues: Issue[], attempt: number) => boolean;
42
+ readonly renderRepairPrompt?: (ctx: RepairContext) => string;
43
+ };
44
+ /** Semantic validation hook (S3); empty list = valid (rule 3). */
45
+ validate?(value: T): Issue[] | Promise<Issue[]>;
46
+ };
47
+ export type StructuredRunOptions<T> = Omit<RunOptions, "contract"> & {
48
+ contract: OutputContract<T>;
49
+ };
50
+ export type StructuredAttempt = {
51
+ runId: string;
52
+ issues: Issue[];
53
+ block: string | null;
54
+ };
55
+ export type StructuredResult<T> = {
56
+ output: T;
57
+ result: RunResult;
58
+ attempts: StructuredAttempt[];
59
+ };
60
+ /**
61
+ * Awaitable handle mirroring `RunHandle`: `await agent.run({ ..., contract })`
62
+ * yields the `StructuredResult`, and `.events` streams every repair
63
+ * attempt's run events in order, so a caller can watch progress across the
64
+ * whole extract/validate/repair loop — not just the final run.
65
+ */
66
+ export type StructuredHandle<T> = Promise<StructuredResult<T>> & {
67
+ readonly events: AsyncIterable<RunEvent>;
68
+ readonly result: Promise<StructuredResult<T>>;
69
+ };
70
+ export type StructuredRunDriverInput<T> = {
71
+ readonly agentId: string;
72
+ readonly options: RunOptions;
73
+ readonly contract: OutputContract<T>;
74
+ readonly runAttempt: (options: RunOptions) => RunHandle;
75
+ };
76
+ export type ResolvedStructuredRunOptions<T> = {
77
+ readonly runOptions: RunOptions;
78
+ readonly contract: OutputContract<T>;
79
+ };
80
+ export declare function isStructuredRunOptions<T = unknown>(options: RunOptions | StructuredRunOptions<T>): options is StructuredRunOptions<T>;
81
+ export declare function resolveStructuredRunOptions<T>(options: StructuredRunOptions<T>): ResolvedStructuredRunOptions<T>;
82
+ export declare function startStructuredRun<T>(input: StructuredRunDriverInput<T>): StructuredHandle<T>;
83
+ //# sourceMappingURL=run-structured.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-structured.d.ts","sourceRoot":"","sources":["../../src/structured/run-structured.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,KAAK,KAAK,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,OAAO,EAEb,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAM9B,eAAO,MAAM,yBAAyB;;;CAG5B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,OAAO,yBAAyB,CAAC,CAAC;AAE7E,MAAM,MAAM,YAAY,CAAC,CAAC,IACtB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACtB;I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