@amodalai/core 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 (463) hide show
  1. package/LICENSE +21 -0
  2. package/dist/.last_build +0 -0
  3. package/dist/src/amodal-config.d.ts +194 -0
  4. package/dist/src/amodal-config.js +326 -0
  5. package/dist/src/amodal-config.js.map +1 -0
  6. package/dist/src/audit/audit-logger.d.ts +52 -0
  7. package/dist/src/audit/audit-logger.js +137 -0
  8. package/dist/src/audit/audit-logger.js.map +1 -0
  9. package/dist/src/audit/audit-outputs.d.ts +34 -0
  10. package/dist/src/audit/audit-outputs.js +73 -0
  11. package/dist/src/audit/audit-outputs.js.map +1 -0
  12. package/dist/src/audit/audit-redact.d.ts +14 -0
  13. package/dist/src/audit/audit-redact.js +55 -0
  14. package/dist/src/audit/audit-redact.js.map +1 -0
  15. package/dist/src/audit/audit-types.d.ts +122 -0
  16. package/dist/src/audit/audit-types.js +64 -0
  17. package/dist/src/audit/audit-types.js.map +1 -0
  18. package/dist/src/audit/index.d.ts +10 -0
  19. package/dist/src/audit/index.js +10 -0
  20. package/dist/src/audit/index.js.map +1 -0
  21. package/dist/src/eval/eval-cost.d.ts +33 -0
  22. package/dist/src/eval/eval-cost.js +73 -0
  23. package/dist/src/eval/eval-cost.js.map +1 -0
  24. package/dist/src/eval/eval-diff.d.ts +11 -0
  25. package/dist/src/eval/eval-diff.js +97 -0
  26. package/dist/src/eval/eval-diff.js.map +1 -0
  27. package/dist/src/eval/eval-formatter.d.ts +23 -0
  28. package/dist/src/eval/eval-formatter.js +221 -0
  29. package/dist/src/eval/eval-formatter.js.map +1 -0
  30. package/dist/src/eval/eval-judge.d.ts +26 -0
  31. package/dist/src/eval/eval-judge.js +76 -0
  32. package/dist/src/eval/eval-judge.js.map +1 -0
  33. package/dist/src/eval/eval-run-builder.d.ts +25 -0
  34. package/dist/src/eval/eval-run-builder.js +78 -0
  35. package/dist/src/eval/eval-run-builder.js.map +1 -0
  36. package/dist/src/eval/eval-runner.d.ts +36 -0
  37. package/dist/src/eval/eval-runner.js +92 -0
  38. package/dist/src/eval/eval-runner.js.map +1 -0
  39. package/dist/src/eval/eval-session-provider.d.ts +40 -0
  40. package/dist/src/eval/eval-session-provider.js +46 -0
  41. package/dist/src/eval/eval-session-provider.js.map +1 -0
  42. package/dist/src/eval/eval-types.d.ts +146 -0
  43. package/dist/src/eval/eval-types.js +7 -0
  44. package/dist/src/eval/eval-types.js.map +1 -0
  45. package/dist/src/eval/experiment-runner.d.ts +16 -0
  46. package/dist/src/eval/experiment-runner.js +73 -0
  47. package/dist/src/eval/experiment-runner.js.map +1 -0
  48. package/dist/src/eval/experiment-types.d.ts +56 -0
  49. package/dist/src/eval/experiment-types.js +7 -0
  50. package/dist/src/eval/experiment-types.js.map +1 -0
  51. package/dist/src/eval/index.d.ts +22 -0
  52. package/dist/src/eval/index.js +18 -0
  53. package/dist/src/eval/index.js.map +1 -0
  54. package/dist/src/eval/multi-model-runner.d.ts +42 -0
  55. package/dist/src/eval/multi-model-runner.js +70 -0
  56. package/dist/src/eval/multi-model-runner.js.map +1 -0
  57. package/dist/src/eval/platform-eval-client.d.ts +105 -0
  58. package/dist/src/eval/platform-eval-client.js +155 -0
  59. package/dist/src/eval/platform-eval-client.js.map +1 -0
  60. package/dist/src/index.d.ts +41 -0
  61. package/dist/src/index.js +68 -0
  62. package/dist/src/index.js.map +1 -0
  63. package/dist/src/knowledge/index.d.ts +11 -0
  64. package/dist/src/knowledge/index.js +12 -0
  65. package/dist/src/knowledge/index.js.map +1 -0
  66. package/dist/src/knowledge/kb-formatter.d.ts +15 -0
  67. package/dist/src/knowledge/kb-formatter.js +78 -0
  68. package/dist/src/knowledge/kb-formatter.js.map +1 -0
  69. package/dist/src/knowledge/kb-index.d.ts +27 -0
  70. package/dist/src/knowledge/kb-index.js +66 -0
  71. package/dist/src/knowledge/kb-index.js.map +1 -0
  72. package/dist/src/knowledge/kb-types.d.ts +54 -0
  73. package/dist/src/knowledge/kb-types.js +7 -0
  74. package/dist/src/knowledge/kb-types.js.map +1 -0
  75. package/dist/src/knowledge/knowledge-store.d.ts +56 -0
  76. package/dist/src/knowledge/knowledge-store.js +141 -0
  77. package/dist/src/knowledge/knowledge-store.js.map +1 -0
  78. package/dist/src/knowledge/load-knowledge.d.ts +30 -0
  79. package/dist/src/knowledge/load-knowledge.js +161 -0
  80. package/dist/src/knowledge/load-knowledge.js.map +1 -0
  81. package/dist/src/knowledge/propose-kb-update.d.ts +32 -0
  82. package/dist/src/knowledge/propose-kb-update.js +148 -0
  83. package/dist/src/knowledge/propose-kb-update.js.map +1 -0
  84. package/dist/src/knowledge/propose-knowledge.d.ts +34 -0
  85. package/dist/src/knowledge/propose-knowledge.js +163 -0
  86. package/dist/src/knowledge/propose-knowledge.js.map +1 -0
  87. package/dist/src/mcp/index.d.ts +7 -0
  88. package/dist/src/mcp/index.js +7 -0
  89. package/dist/src/mcp/index.js.map +1 -0
  90. package/dist/src/mcp/mcp-manager.d.ts +96 -0
  91. package/dist/src/mcp/mcp-manager.js +192 -0
  92. package/dist/src/mcp/mcp-manager.js.map +1 -0
  93. package/dist/src/packages/config-deps.d.ts +20 -0
  94. package/dist/src/packages/config-deps.js +77 -0
  95. package/dist/src/packages/config-deps.js.map +1 -0
  96. package/dist/src/packages/env-file.d.ts +28 -0
  97. package/dist/src/packages/env-file.js +143 -0
  98. package/dist/src/packages/env-file.js.map +1 -0
  99. package/dist/src/packages/frontmatter.d.ts +28 -0
  100. package/dist/src/packages/frontmatter.js +77 -0
  101. package/dist/src/packages/frontmatter.js.map +1 -0
  102. package/dist/src/packages/index.d.ts +16 -0
  103. package/dist/src/packages/index.js +17 -0
  104. package/dist/src/packages/index.js.map +1 -0
  105. package/dist/src/packages/lock-file.d.ts +35 -0
  106. package/dist/src/packages/lock-file.js +117 -0
  107. package/dist/src/packages/lock-file.js.map +1 -0
  108. package/dist/src/packages/manifest-reader.d.ts +19 -0
  109. package/dist/src/packages/manifest-reader.js +91 -0
  110. package/dist/src/packages/manifest-reader.js.map +1 -0
  111. package/dist/src/packages/merge-engine.d.ts +63 -0
  112. package/dist/src/packages/merge-engine.js +357 -0
  113. package/dist/src/packages/merge-engine.js.map +1 -0
  114. package/dist/src/packages/npm-context.d.ts +56 -0
  115. package/dist/src/packages/npm-context.js +235 -0
  116. package/dist/src/packages/npm-context.js.map +1 -0
  117. package/dist/src/packages/npm-registry.d.ts +35 -0
  118. package/dist/src/packages/npm-registry.js +107 -0
  119. package/dist/src/packages/npm-registry.js.map +1 -0
  120. package/dist/src/packages/package-error.d.ts +16 -0
  121. package/dist/src/packages/package-error.js +17 -0
  122. package/dist/src/packages/package-error.js.map +1 -0
  123. package/dist/src/packages/package-types.d.ts +477 -0
  124. package/dist/src/packages/package-types.js +156 -0
  125. package/dist/src/packages/package-types.js.map +1 -0
  126. package/dist/src/packages/resolver.d.ts +41 -0
  127. package/dist/src/packages/resolver.js +353 -0
  128. package/dist/src/packages/resolver.js.map +1 -0
  129. package/dist/src/platform/config-builder.d.ts +24 -0
  130. package/dist/src/platform/config-builder.js +70 -0
  131. package/dist/src/platform/config-builder.js.map +1 -0
  132. package/dist/src/platform/index.d.ts +8 -0
  133. package/dist/src/platform/index.js +9 -0
  134. package/dist/src/platform/index.js.map +1 -0
  135. package/dist/src/platform/platform-client.d.ts +160 -0
  136. package/dist/src/platform/platform-client.js +486 -0
  137. package/dist/src/platform/platform-client.js.map +1 -0
  138. package/dist/src/platform/platform-types.d.ts +81 -0
  139. package/dist/src/platform/platform-types.js +18 -0
  140. package/dist/src/platform/platform-types.js.map +1 -0
  141. package/dist/src/providers/content-generator/google-to-llm.d.ts +87 -0
  142. package/dist/src/providers/content-generator/google-to-llm.js +226 -0
  143. package/dist/src/providers/content-generator/google-to-llm.js.map +1 -0
  144. package/dist/src/providers/content-generator/index.d.ts +10 -0
  145. package/dist/src/providers/content-generator/index.js +9 -0
  146. package/dist/src/providers/content-generator/index.js.map +1 -0
  147. package/dist/src/providers/content-generator/llm-to-google.d.ts +59 -0
  148. package/dist/src/providers/content-generator/llm-to-google.js +178 -0
  149. package/dist/src/providers/content-generator/llm-to-google.js.map +1 -0
  150. package/dist/src/providers/content-generator/multi-provider-content-generator.d.ts +61 -0
  151. package/dist/src/providers/content-generator/multi-provider-content-generator.js +144 -0
  152. package/dist/src/providers/content-generator/multi-provider-content-generator.js.map +1 -0
  153. package/dist/src/providers/runtime/anthropic-provider.d.ts +18 -0
  154. package/dist/src/providers/runtime/anthropic-provider.js +253 -0
  155. package/dist/src/providers/runtime/anthropic-provider.js.map +1 -0
  156. package/dist/src/providers/runtime/azure-provider.d.ts +25 -0
  157. package/dist/src/providers/runtime/azure-provider.js +206 -0
  158. package/dist/src/providers/runtime/azure-provider.js.map +1 -0
  159. package/dist/src/providers/runtime/bedrock-provider.d.ts +22 -0
  160. package/dist/src/providers/runtime/bedrock-provider.js +276 -0
  161. package/dist/src/providers/runtime/bedrock-provider.js.map +1 -0
  162. package/dist/src/providers/runtime/failover-provider.d.ts +30 -0
  163. package/dist/src/providers/runtime/failover-provider.js +124 -0
  164. package/dist/src/providers/runtime/failover-provider.js.map +1 -0
  165. package/dist/src/providers/runtime/google-provider.d.ts +17 -0
  166. package/dist/src/providers/runtime/google-provider.js +239 -0
  167. package/dist/src/providers/runtime/google-provider.js.map +1 -0
  168. package/dist/src/providers/runtime/index.d.ts +16 -0
  169. package/dist/src/providers/runtime/index.js +16 -0
  170. package/dist/src/providers/runtime/index.js.map +1 -0
  171. package/dist/src/providers/runtime/openai-provider.d.ts +21 -0
  172. package/dist/src/providers/runtime/openai-provider.js +266 -0
  173. package/dist/src/providers/runtime/openai-provider.js.map +1 -0
  174. package/dist/src/providers/runtime/provider-errors.d.ts +39 -0
  175. package/dist/src/providers/runtime/provider-errors.js +50 -0
  176. package/dist/src/providers/runtime/provider-errors.js.map +1 -0
  177. package/dist/src/providers/runtime/provider-factory.d.ts +19 -0
  178. package/dist/src/providers/runtime/provider-factory.js +45 -0
  179. package/dist/src/providers/runtime/provider-factory.js.map +1 -0
  180. package/dist/src/providers/runtime/runtime-provider-types.d.ts +63 -0
  181. package/dist/src/providers/runtime/runtime-provider-types.js +7 -0
  182. package/dist/src/providers/runtime/runtime-provider-types.js.map +1 -0
  183. package/dist/src/providers/runtime/streaming-types.d.ts +40 -0
  184. package/dist/src/providers/runtime/streaming-types.js +7 -0
  185. package/dist/src/providers/runtime/streaming-types.js.map +1 -0
  186. package/dist/src/repo/config-schema.d.ts +238 -0
  187. package/dist/src/repo/config-schema.js +155 -0
  188. package/dist/src/repo/config-schema.js.map +1 -0
  189. package/dist/src/repo/connection-schemas.d.ts +449 -0
  190. package/dist/src/repo/connection-schemas.js +109 -0
  191. package/dist/src/repo/connection-schemas.js.map +1 -0
  192. package/dist/src/repo/connection-types.d.ts +29 -0
  193. package/dist/src/repo/connection-types.js +7 -0
  194. package/dist/src/repo/connection-types.js.map +1 -0
  195. package/dist/src/repo/drift-detector.d.ts +26 -0
  196. package/dist/src/repo/drift-detector.js +66 -0
  197. package/dist/src/repo/drift-detector.js.map +1 -0
  198. package/dist/src/repo/graphql-drift-detector.d.ts +27 -0
  199. package/dist/src/repo/graphql-drift-detector.js +66 -0
  200. package/dist/src/repo/graphql-drift-detector.js.map +1 -0
  201. package/dist/src/repo/graphql-parser.d.ts +30 -0
  202. package/dist/src/repo/graphql-parser.js +125 -0
  203. package/dist/src/repo/graphql-parser.js.map +1 -0
  204. package/dist/src/repo/graphql-surface-parser.d.ts +20 -0
  205. package/dist/src/repo/graphql-surface-parser.js +74 -0
  206. package/dist/src/repo/graphql-surface-parser.js.map +1 -0
  207. package/dist/src/repo/index.d.ts +30 -0
  208. package/dist/src/repo/index.js +29 -0
  209. package/dist/src/repo/index.js.map +1 -0
  210. package/dist/src/repo/local-reader.d.ts +10 -0
  211. package/dist/src/repo/local-reader.js +299 -0
  212. package/dist/src/repo/local-reader.js.map +1 -0
  213. package/dist/src/repo/openapi-parser.d.ts +35 -0
  214. package/dist/src/repo/openapi-parser.js +93 -0
  215. package/dist/src/repo/openapi-parser.js.map +1 -0
  216. package/dist/src/repo/parsers.d.ts +91 -0
  217. package/dist/src/repo/parsers.js +454 -0
  218. package/dist/src/repo/parsers.js.map +1 -0
  219. package/dist/src/repo/platform-reader.d.ts +10 -0
  220. package/dist/src/repo/platform-reader.js +206 -0
  221. package/dist/src/repo/platform-reader.js.map +1 -0
  222. package/dist/src/repo/repo-loader.d.ts +14 -0
  223. package/dist/src/repo/repo-loader.js +25 -0
  224. package/dist/src/repo/repo-loader.js.map +1 -0
  225. package/dist/src/repo/repo-types.d.ts +159 -0
  226. package/dist/src/repo/repo-types.js +17 -0
  227. package/dist/src/repo/repo-types.js.map +1 -0
  228. package/dist/src/repo/spec-syncer.d.ts +30 -0
  229. package/dist/src/repo/spec-syncer.js +85 -0
  230. package/dist/src/repo/spec-syncer.js.map +1 -0
  231. package/dist/src/repo/store-loader.d.ts +19 -0
  232. package/dist/src/repo/store-loader.js +94 -0
  233. package/dist/src/repo/store-loader.js.map +1 -0
  234. package/dist/src/repo/store-schemas.d.ts +313 -0
  235. package/dist/src/repo/store-schemas.js +103 -0
  236. package/dist/src/repo/store-schemas.js.map +1 -0
  237. package/dist/src/repo/store-tool-schema.d.ts +29 -0
  238. package/dist/src/repo/store-tool-schema.js +103 -0
  239. package/dist/src/repo/store-tool-schema.js.map +1 -0
  240. package/dist/src/repo/store-types.d.ts +91 -0
  241. package/dist/src/repo/store-types.js +7 -0
  242. package/dist/src/repo/store-types.js.map +1 -0
  243. package/dist/src/repo/surface-parser.d.ts +17 -0
  244. package/dist/src/repo/surface-parser.js +75 -0
  245. package/dist/src/repo/surface-parser.js.map +1 -0
  246. package/dist/src/repo/tool-loader.d.ts +33 -0
  247. package/dist/src/repo/tool-loader.js +240 -0
  248. package/dist/src/repo/tool-loader.js.map +1 -0
  249. package/dist/src/repo/tool-types.d.ts +205 -0
  250. package/dist/src/repo/tool-types.js +61 -0
  251. package/dist/src/repo/tool-types.js.map +1 -0
  252. package/dist/src/roles/index.d.ts +7 -0
  253. package/dist/src/roles/index.js +8 -0
  254. package/dist/src/roles/index.js.map +1 -0
  255. package/dist/src/roles/role-filter.d.ts +33 -0
  256. package/dist/src/roles/role-filter.js +55 -0
  257. package/dist/src/roles/role-filter.js.map +1 -0
  258. package/dist/src/roles/role-types.d.ts +76 -0
  259. package/dist/src/roles/role-types.js +38 -0
  260. package/dist/src/roles/role-types.js.map +1 -0
  261. package/dist/src/runtime/connection-bridge.d.ts +19 -0
  262. package/dist/src/runtime/connection-bridge.js +103 -0
  263. package/dist/src/runtime/connection-bridge.js.map +1 -0
  264. package/dist/src/runtime/context-compiler.d.ts +35 -0
  265. package/dist/src/runtime/context-compiler.js +183 -0
  266. package/dist/src/runtime/context-compiler.js.map +1 -0
  267. package/dist/src/runtime/default-prompt.d.ts +28 -0
  268. package/dist/src/runtime/default-prompt.js +71 -0
  269. package/dist/src/runtime/default-prompt.js.map +1 -0
  270. package/dist/src/runtime/explore-tool.d.ts +96 -0
  271. package/dist/src/runtime/explore-tool.js +111 -0
  272. package/dist/src/runtime/explore-tool.js.map +1 -0
  273. package/dist/src/runtime/index.d.ts +26 -0
  274. package/dist/src/runtime/index.js +19 -0
  275. package/dist/src/runtime/index.js.map +1 -0
  276. package/dist/src/runtime/output-pipeline.d.ts +62 -0
  277. package/dist/src/runtime/output-pipeline.js +69 -0
  278. package/dist/src/runtime/output-pipeline.js.map +1 -0
  279. package/dist/src/runtime/plan-mode.d.ts +39 -0
  280. package/dist/src/runtime/plan-mode.js +81 -0
  281. package/dist/src/runtime/plan-mode.js.map +1 -0
  282. package/dist/src/runtime/preference-client.d.ts +39 -0
  283. package/dist/src/runtime/preference-client.js +70 -0
  284. package/dist/src/runtime/preference-client.js.map +1 -0
  285. package/dist/src/runtime/preference-detector.d.ts +22 -0
  286. package/dist/src/runtime/preference-detector.js +95 -0
  287. package/dist/src/runtime/preference-detector.js.map +1 -0
  288. package/dist/src/runtime/request-integration.d.ts +18 -0
  289. package/dist/src/runtime/request-integration.js +36 -0
  290. package/dist/src/runtime/request-integration.js.map +1 -0
  291. package/dist/src/runtime/runtime-types.d.ts +48 -0
  292. package/dist/src/runtime/runtime-types.js +7 -0
  293. package/dist/src/runtime/runtime-types.js.map +1 -0
  294. package/dist/src/runtime/session-setup.d.ts +53 -0
  295. package/dist/src/runtime/session-setup.js +90 -0
  296. package/dist/src/runtime/session-setup.js.map +1 -0
  297. package/dist/src/runtime/telemetry-client.d.ts +39 -0
  298. package/dist/src/runtime/telemetry-client.js +87 -0
  299. package/dist/src/runtime/telemetry-client.js.map +1 -0
  300. package/dist/src/runtime/telemetry-hooks.d.ts +47 -0
  301. package/dist/src/runtime/telemetry-hooks.js +115 -0
  302. package/dist/src/runtime/telemetry-hooks.js.map +1 -0
  303. package/dist/src/runtime/token-allocator.d.ts +34 -0
  304. package/dist/src/runtime/token-allocator.js +86 -0
  305. package/dist/src/runtime/token-allocator.js.map +1 -0
  306. package/dist/src/runtime/user-context.d.ts +49 -0
  307. package/dist/src/runtime/user-context.js +135 -0
  308. package/dist/src/runtime/user-context.js.map +1 -0
  309. package/dist/src/sdk.d.ts +57 -0
  310. package/dist/src/sdk.js +377 -0
  311. package/dist/src/sdk.js.map +1 -0
  312. package/dist/src/security/action-gate.d.ts +23 -0
  313. package/dist/src/security/action-gate.js +78 -0
  314. package/dist/src/security/action-gate.js.map +1 -0
  315. package/dist/src/security/field-scrubber.d.ts +27 -0
  316. package/dist/src/security/field-scrubber.js +152 -0
  317. package/dist/src/security/field-scrubber.js.map +1 -0
  318. package/dist/src/security/index.d.ts +14 -0
  319. package/dist/src/security/index.js +15 -0
  320. package/dist/src/security/index.js.map +1 -0
  321. package/dist/src/security/leak-detector.d.ts +23 -0
  322. package/dist/src/security/leak-detector.js +51 -0
  323. package/dist/src/security/leak-detector.js.map +1 -0
  324. package/dist/src/security/output-guard.d.ts +33 -0
  325. package/dist/src/security/output-guard.js +118 -0
  326. package/dist/src/security/output-guard.js.map +1 -0
  327. package/dist/src/security/pattern-scanner.d.ts +19 -0
  328. package/dist/src/security/pattern-scanner.js +66 -0
  329. package/dist/src/security/pattern-scanner.js.map +1 -0
  330. package/dist/src/security/scope-checker.d.ts +27 -0
  331. package/dist/src/security/scope-checker.js +52 -0
  332. package/dist/src/security/scope-checker.js.map +1 -0
  333. package/dist/src/security/scrub-tracker.d.ts +21 -0
  334. package/dist/src/security/scrub-tracker.js +39 -0
  335. package/dist/src/security/scrub-tracker.js.map +1 -0
  336. package/dist/src/security/security-types.d.ts +69 -0
  337. package/dist/src/security/security-types.js +17 -0
  338. package/dist/src/security/security-types.js.map +1 -0
  339. package/dist/src/security/threshold-evaluator.d.ts +13 -0
  340. package/dist/src/security/threshold-evaluator.js +44 -0
  341. package/dist/src/security/threshold-evaluator.js.map +1 -0
  342. package/dist/src/snapshot/index.d.ts +8 -0
  343. package/dist/src/snapshot/index.js +9 -0
  344. package/dist/src/snapshot/index.js.map +1 -0
  345. package/dist/src/snapshot/snapshot-builder.d.ts +37 -0
  346. package/dist/src/snapshot/snapshot-builder.js +152 -0
  347. package/dist/src/snapshot/snapshot-builder.js.map +1 -0
  348. package/dist/src/snapshot/snapshot-loader.d.ts +29 -0
  349. package/dist/src/snapshot/snapshot-loader.js +188 -0
  350. package/dist/src/snapshot/snapshot-loader.js.map +1 -0
  351. package/dist/src/snapshot/snapshot-types.d.ts +1940 -0
  352. package/dist/src/snapshot/snapshot-types.js +145 -0
  353. package/dist/src/snapshot/snapshot-types.js.map +1 -0
  354. package/dist/src/stores/index.d.ts +6 -0
  355. package/dist/src/stores/index.js +7 -0
  356. package/dist/src/stores/index.js.map +1 -0
  357. package/dist/src/stores/store-backend.d.ts +135 -0
  358. package/dist/src/stores/store-backend.js +7 -0
  359. package/dist/src/stores/store-backend.js.map +1 -0
  360. package/dist/src/templates/connections.d.ts +14 -0
  361. package/dist/src/templates/connections.js +7 -0
  362. package/dist/src/templates/connections.js.map +1 -0
  363. package/dist/src/templates/index.d.ts +7 -0
  364. package/dist/src/templates/index.js +8 -0
  365. package/dist/src/templates/index.js.map +1 -0
  366. package/dist/src/templates/template-resolver.d.ts +45 -0
  367. package/dist/src/templates/template-resolver.js +121 -0
  368. package/dist/src/templates/template-resolver.js.map +1 -0
  369. package/dist/src/tool-context.d.ts +33 -0
  370. package/dist/src/tool-context.js +7 -0
  371. package/dist/src/tool-context.js.map +1 -0
  372. package/dist/src/tool-registration.d.ts +14 -0
  373. package/dist/src/tool-registration.js +51 -0
  374. package/dist/src/tool-registration.js.map +1 -0
  375. package/dist/src/tools/amodal-tool-errors.d.ts +24 -0
  376. package/dist/src/tools/amodal-tool-errors.js +28 -0
  377. package/dist/src/tools/amodal-tool-errors.js.map +1 -0
  378. package/dist/src/tools/amodal-tool-names.d.ts +14 -0
  379. package/dist/src/tools/amodal-tool-names.js +15 -0
  380. package/dist/src/tools/amodal-tool-names.js.map +1 -0
  381. package/dist/src/tools/chain-tool-registry.d.ts +20 -0
  382. package/dist/src/tools/chain-tool-registry.js +49 -0
  383. package/dist/src/tools/chain-tool-registry.js.map +1 -0
  384. package/dist/src/tools/chain-tool-types.d.ts +190 -0
  385. package/dist/src/tools/chain-tool-types.js +50 -0
  386. package/dist/src/tools/chain-tool-types.js.map +1 -0
  387. package/dist/src/tools/chain-tool.d.ts +34 -0
  388. package/dist/src/tools/chain-tool.js +294 -0
  389. package/dist/src/tools/chain-tool.js.map +1 -0
  390. package/dist/src/tools/custom-tool-registrar.d.ts +8 -0
  391. package/dist/src/tools/custom-tool-registrar.js +10 -0
  392. package/dist/src/tools/custom-tool-registrar.js.map +1 -0
  393. package/dist/src/tools/definitions/amodal-tools.d.ts +9 -0
  394. package/dist/src/tools/definitions/amodal-tools.js +192 -0
  395. package/dist/src/tools/definitions/amodal-tools.js.map +1 -0
  396. package/dist/src/tools/function-tool-registry.d.ts +22 -0
  397. package/dist/src/tools/function-tool-registry.js +45 -0
  398. package/dist/src/tools/function-tool-registry.js.map +1 -0
  399. package/dist/src/tools/function-tool-types.d.ts +76 -0
  400. package/dist/src/tools/function-tool-types.js +27 -0
  401. package/dist/src/tools/function-tool-types.js.map +1 -0
  402. package/dist/src/tools/function-tool.d.ts +34 -0
  403. package/dist/src/tools/function-tool.js +97 -0
  404. package/dist/src/tools/function-tool.js.map +1 -0
  405. package/dist/src/tools/http-tool-registry.d.ts +20 -0
  406. package/dist/src/tools/http-tool-registry.js +34 -0
  407. package/dist/src/tools/http-tool-registry.js.map +1 -0
  408. package/dist/src/tools/http-tool-types.d.ts +92 -0
  409. package/dist/src/tools/http-tool-types.js +44 -0
  410. package/dist/src/tools/http-tool-types.js.map +1 -0
  411. package/dist/src/tools/http-tool.d.ts +32 -0
  412. package/dist/src/tools/http-tool.js +176 -0
  413. package/dist/src/tools/http-tool.js.map +1 -0
  414. package/dist/src/tools/merge-template.d.ts +33 -0
  415. package/dist/src/tools/merge-template.js +65 -0
  416. package/dist/src/tools/merge-template.js.map +1 -0
  417. package/dist/src/tools/request-tool-types.d.ts +46 -0
  418. package/dist/src/tools/request-tool-types.js +20 -0
  419. package/dist/src/tools/request-tool-types.js.map +1 -0
  420. package/dist/src/tools/request-tool.d.ts +29 -0
  421. package/dist/src/tools/request-tool.js +268 -0
  422. package/dist/src/tools/request-tool.js.map +1 -0
  423. package/dist/src/tools/store-query-tool.d.ts +29 -0
  424. package/dist/src/tools/store-query-tool.js +82 -0
  425. package/dist/src/tools/store-query-tool.js.map +1 -0
  426. package/dist/src/tools/store-write-tool.d.ts +26 -0
  427. package/dist/src/tools/store-write-tool.js +84 -0
  428. package/dist/src/tools/store-write-tool.js.map +1 -0
  429. package/dist/src/tools/tool-definition-types.d.ts +21 -0
  430. package/dist/src/tools/tool-definition-types.js +7 -0
  431. package/dist/src/tools/tool-definition-types.js.map +1 -0
  432. package/dist/src/tools/tool-utils.d.ts +29 -0
  433. package/dist/src/tools/tool-utils.js +66 -0
  434. package/dist/src/tools/tool-utils.js.map +1 -0
  435. package/dist/src/versions/bundle-loader.d.ts +37 -0
  436. package/dist/src/versions/bundle-loader.js +99 -0
  437. package/dist/src/versions/bundle-loader.js.map +1 -0
  438. package/dist/src/versions/dependency-manager.d.ts +54 -0
  439. package/dist/src/versions/dependency-manager.js +132 -0
  440. package/dist/src/versions/dependency-manager.js.map +1 -0
  441. package/dist/src/versions/handler-loader.d.ts +27 -0
  442. package/dist/src/versions/handler-loader.js +62 -0
  443. package/dist/src/versions/handler-loader.js.map +1 -0
  444. package/dist/src/versions/index.d.ts +10 -0
  445. package/dist/src/versions/index.js +11 -0
  446. package/dist/src/versions/index.js.map +1 -0
  447. package/dist/src/versions/version-bundle-types.d.ts +1278 -0
  448. package/dist/src/versions/version-bundle-types.js +207 -0
  449. package/dist/src/versions/version-bundle-types.js.map +1 -0
  450. package/dist/src/versions/version-manager.d.ts +89 -0
  451. package/dist/src/versions/version-manager.js +124 -0
  452. package/dist/src/versions/version-manager.js.map +1 -0
  453. package/dist/src/widgets/index.d.ts +8 -0
  454. package/dist/src/widgets/index.js +8 -0
  455. package/dist/src/widgets/index.js.map +1 -0
  456. package/dist/src/widgets/present-tool.d.ts +21 -0
  457. package/dist/src/widgets/present-tool.js +107 -0
  458. package/dist/src/widgets/present-tool.js.map +1 -0
  459. package/dist/src/widgets/widget-types.d.ts +78 -0
  460. package/dist/src/widgets/widget-types.js +28 -0
  461. package/dist/src/widgets/widget-types.js.map +1 -0
  462. package/dist/tsconfig.tsbuildinfo +1 -0
  463. package/package.json +50 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Wraps OutputGuard in a pipeline suitable for both synchronous
8
+ * and streaming use. Provides telemetry hooks and buffered stream
9
+ * processing.
10
+ */
11
+ export class OutputPipeline {
12
+ outputGuard;
13
+ onGuardDecision;
14
+ constructor(config) {
15
+ this.outputGuard = config.outputGuard;
16
+ this.onGuardDecision = config['onGuardDecision'];
17
+ }
18
+ /**
19
+ * Process a complete agent response text through the guard.
20
+ */
21
+ process(text) {
22
+ const guardResult = this.outputGuard.guard(text);
23
+ if (this.onGuardDecision) {
24
+ this.onGuardDecision(guardResult);
25
+ }
26
+ return {
27
+ output: guardResult['output'],
28
+ modified: guardResult['modified'],
29
+ blocked: guardResult['blocked'],
30
+ findings: guardResult['findings'],
31
+ };
32
+ }
33
+ /**
34
+ * Create a streaming processor that buffers tokens and guards on finalize.
35
+ */
36
+ createStreamProcessor() {
37
+ return new StreamGuardProcessor(this);
38
+ }
39
+ }
40
+ /**
41
+ * Buffers streaming tokens and runs the output guard on finalize.
42
+ */
43
+ export class StreamGuardProcessor {
44
+ pipeline;
45
+ buffer = '';
46
+ constructor(pipeline) {
47
+ this.pipeline = pipeline;
48
+ }
49
+ /**
50
+ * Feed a token into the buffer. Tokens are accumulated
51
+ * for guard processing on finalize.
52
+ */
53
+ feed(token) {
54
+ this.buffer += token;
55
+ }
56
+ /**
57
+ * Get the current buffered text for intermediate streaming display.
58
+ */
59
+ getBuffer() {
60
+ return this.buffer;
61
+ }
62
+ /**
63
+ * Run the output guard on the full buffered text and return the result.
64
+ */
65
+ finalize() {
66
+ return this.pipeline.process(this.buffer);
67
+ }
68
+ }
69
+ //# sourceMappingURL=output-pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-pipeline.js","sourceRoot":"","sources":["../../../src/runtime/output-pipeline.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuBH;;;;GAIG;AACH,MAAM,OAAO,cAAc;IACR,WAAW,CAAc;IACzB,eAAe,CAAiC;IAEjE,YAAY,MAA4B;QACtC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAY;QAClB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEjD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QACpC,CAAC;QAED,OAAO;YACL,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC;YAC7B,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC;YACjC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC;YAC/B,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC;SAClC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,QAAQ,CAAiB;IAClC,MAAM,GAAG,EAAE,CAAC;IAEpB,YAAY,QAAwB;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,KAAa;QAChB,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Manages plan mode state for a session.
8
+ *
9
+ * When active, write operations are blocked via the request tool's
10
+ * planModeActive callback. Once the user approves a plan, it's stored
11
+ * and injected into the context for execution.
12
+ */
13
+ export declare class PlanModeManager {
14
+ private active;
15
+ private approvedPlan;
16
+ private reason;
17
+ /** Whether plan mode is currently active (writes blocked). */
18
+ isActive(): boolean;
19
+ /** The approved plan text, if any. */
20
+ getApprovedPlan(): string | null;
21
+ /** The reason plan mode was entered, if any. */
22
+ getReason(): string | null;
23
+ /** Enter plan mode. Writes are blocked until a plan is approved. */
24
+ enter(reason?: string): void;
25
+ /** Approve a plan. Stores the plan text and exits plan mode (writes re-enabled). */
26
+ approve(planText: string): void;
27
+ /** Exit plan mode without approving a plan. */
28
+ exit(): void;
29
+ /**
30
+ * Get the planning reminder text for injection into the system prompt.
31
+ * Returns null if plan mode is not active.
32
+ */
33
+ getPlanningReminder(): string | null;
34
+ /**
35
+ * Get the approved plan context for injection into the system prompt.
36
+ * Returns null if no plan has been approved.
37
+ */
38
+ getApprovedPlanContext(): string | null;
39
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Manages plan mode state for a session.
8
+ *
9
+ * When active, write operations are blocked via the request tool's
10
+ * planModeActive callback. Once the user approves a plan, it's stored
11
+ * and injected into the context for execution.
12
+ */
13
+ export class PlanModeManager {
14
+ active = false;
15
+ approvedPlan = null;
16
+ reason = null;
17
+ /** Whether plan mode is currently active (writes blocked). */
18
+ isActive() {
19
+ return this.active;
20
+ }
21
+ /** The approved plan text, if any. */
22
+ getApprovedPlan() {
23
+ return this.approvedPlan;
24
+ }
25
+ /** The reason plan mode was entered, if any. */
26
+ getReason() {
27
+ return this.reason;
28
+ }
29
+ /** Enter plan mode. Writes are blocked until a plan is approved. */
30
+ enter(reason) {
31
+ this.active = true;
32
+ this.reason = reason ?? null;
33
+ this.approvedPlan = null;
34
+ }
35
+ /** Approve a plan. Stores the plan text and exits plan mode (writes re-enabled). */
36
+ approve(planText) {
37
+ this.active = false;
38
+ this.approvedPlan = planText;
39
+ }
40
+ /** Exit plan mode without approving a plan. */
41
+ exit() {
42
+ if (!this.active) {
43
+ return;
44
+ }
45
+ this.active = false;
46
+ }
47
+ /**
48
+ * Get the planning reminder text for injection into the system prompt.
49
+ * Returns null if plan mode is not active.
50
+ */
51
+ getPlanningReminder() {
52
+ if (!this.active) {
53
+ return null;
54
+ }
55
+ const lines = [
56
+ '## Planning Mode Active',
57
+ 'You are currently in planning mode. Present your plan to the user for approval before executing write operations.',
58
+ 'Read operations and the explore tool are allowed freely.',
59
+ ];
60
+ if (this.reason) {
61
+ lines.push(`Reason: ${this.reason}`);
62
+ }
63
+ return lines.join('\n');
64
+ }
65
+ /**
66
+ * Get the approved plan context for injection into the system prompt.
67
+ * Returns null if no plan has been approved.
68
+ */
69
+ getApprovedPlanContext() {
70
+ if (this.approvedPlan === null) {
71
+ return null;
72
+ }
73
+ return [
74
+ '## Approved Plan',
75
+ 'The following plan has been approved by the user. Execute it step by step.',
76
+ '',
77
+ this.approvedPlan,
78
+ ].join('\n');
79
+ }
80
+ }
81
+ //# sourceMappingURL=plan-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-mode.js","sourceRoot":"","sources":["../../../src/runtime/plan-mode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IAClB,MAAM,GAAG,KAAK,CAAC;IACf,YAAY,GAAkB,IAAI,CAAC;IACnC,MAAM,GAAkB,IAAI,CAAC;IAErC,8DAA8D;IAC9D,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,sCAAsC;IACtC,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,gDAAgD;IAChD,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,oEAAoE;IACpE,KAAK,CAAC,MAAe;QACnB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,oFAAoF;IACpF,OAAO,CAAC,QAAgB;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC/B,CAAC;IAED,+CAA+C;IAC/C,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,mBAAmB;QACjB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,KAAK,GAAG;YACZ,yBAAyB;YACzB,mHAAmH;YACnH,0DAA0D;SAC3D,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,sBAAsB;QACpB,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,kBAAkB;YAClB,4EAA4E;YAC5E,EAAE;YACF,IAAI,CAAC,YAAY;SAClB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * A user preference learned across sessions.
8
+ */
9
+ export interface UserPreference {
10
+ id: string;
11
+ category: 'style' | 'content' | 'behavior' | 'domain';
12
+ preference: string;
13
+ confidence: number;
14
+ source: 'correction' | 'explicit' | 'inferred';
15
+ }
16
+ /**
17
+ * Client for fetching and reporting user preferences via the platform API.
18
+ */
19
+ export declare class PreferenceClient {
20
+ private readonly url;
21
+ private readonly apiKey;
22
+ constructor(platformUrl: string, apiKey: string);
23
+ /**
24
+ * Fetch approved preferences for a user.
25
+ */
26
+ fetchPreferences(userId: string, orgId: string): Promise<UserPreference[]>;
27
+ /**
28
+ * Report a newly detected preference.
29
+ */
30
+ reportPreference(userId: string, orgId: string, preference: {
31
+ category: string;
32
+ preference: string;
33
+ source: string;
34
+ }, sessionId?: string): Promise<void>;
35
+ }
36
+ /**
37
+ * Format preferences as a system prompt section.
38
+ */
39
+ export declare function formatPreferencesPrompt(preferences: UserPreference[]): string;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Client for fetching and reporting user preferences via the platform API.
8
+ */
9
+ export class PreferenceClient {
10
+ url;
11
+ apiKey;
12
+ constructor(platformUrl, apiKey) {
13
+ this.url = platformUrl.replace(/\/$/, '');
14
+ this.apiKey = apiKey;
15
+ }
16
+ /**
17
+ * Fetch approved preferences for a user.
18
+ */
19
+ async fetchPreferences(userId, orgId) {
20
+ try {
21
+ const response = await fetch(`${this.url}/api/learning/preferences?userId=${encodeURIComponent(userId)}&orgId=${encodeURIComponent(orgId)}`, { headers: { 'Authorization': `Bearer ${this.apiKey}` } });
22
+ if (!response.ok)
23
+ return [];
24
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- platform response
25
+ const data = await response.json();
26
+ return data.preferences;
27
+ }
28
+ catch {
29
+ return []; // Graceful degradation
30
+ }
31
+ }
32
+ /**
33
+ * Report a newly detected preference.
34
+ */
35
+ async reportPreference(userId, orgId, preference, sessionId) {
36
+ try {
37
+ await fetch(`${this.url}/api/learning/preferences`, {
38
+ method: 'POST',
39
+ headers: {
40
+ 'Content-Type': 'application/json',
41
+ 'Authorization': `Bearer ${this.apiKey}`,
42
+ },
43
+ body: JSON.stringify({
44
+ userId,
45
+ orgId,
46
+ ...preference,
47
+ sessionId,
48
+ }),
49
+ });
50
+ }
51
+ catch {
52
+ // Swallow — preference reporting must not break the session
53
+ }
54
+ }
55
+ }
56
+ /**
57
+ * Format preferences as a system prompt section.
58
+ */
59
+ export function formatPreferencesPrompt(preferences) {
60
+ if (preferences.length === 0)
61
+ return '';
62
+ const lines = ['## Known User Preferences', ''];
63
+ for (const pref of preferences) {
64
+ lines.push(`- [${pref.category}] ${pref.preference} (confidence: ${(pref.confidence * 100).toFixed(0)}%)`);
65
+ }
66
+ lines.push('');
67
+ lines.push('Apply these preferences when generating responses. They were learned from previous interactions.');
68
+ return lines.join('\n');
69
+ }
70
+ //# sourceMappingURL=preference-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preference-client.js","sourceRoot":"","sources":["../../../src/runtime/preference-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH;;GAEG;AACH,MAAM,OAAO,gBAAgB;IACV,GAAG,CAAS;IACZ,MAAM,CAAS;IAEhC,YAAY,WAAmB,EAAE,MAAc;QAC7C,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAAc,EAAE,KAAa;QAClD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,GAAG,oCAAoC,kBAAkB,CAAC,MAAM,CAAC,UAAU,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAC9G,EAAC,OAAO,EAAE,EAAC,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,EAAC,EAAC,CACtD,CAAC;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,OAAO,EAAE,CAAC;YAE5B,4FAA4F;YAC5F,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAqC,CAAC;YACtE,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC,CAAC,uBAAuB;QACpC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CACpB,MAAc,EACd,KAAa,EACb,UAAkE,EAClE,SAAkB;QAElB,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,2BAA2B,EAAE;gBAClD,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;iBACzC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,MAAM;oBACN,KAAK;oBACL,GAAG,UAAU;oBACb,SAAS;iBACV,CAAC;aACH,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,4DAA4D;QAC9D,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAA6B;IACnE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAExC,MAAM,KAAK,GAAG,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;IAEhD,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,UAAU,iBAAiB,CAAC,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7G,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,kGAAkG,CAAC,CAAC;IAE/G,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import type { JudgeProvider } from '../eval/eval-judge.js';
7
+ /**
8
+ * A detected preference from a conversation.
9
+ */
10
+ export interface DetectedPreference {
11
+ category: 'style' | 'content' | 'behavior' | 'domain';
12
+ preference: string;
13
+ confidence: number;
14
+ source: 'correction' | 'explicit' | 'inferred';
15
+ }
16
+ /**
17
+ * Detect corrections and preferences in a conversation using an LLM.
18
+ */
19
+ export declare function detectPreferences(conversation: Array<{
20
+ role: 'user' | 'assistant';
21
+ content: string;
22
+ }>, provider: JudgeProvider): Promise<DetectedPreference[]>;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Detect corrections and preferences in a conversation using an LLM.
8
+ */
9
+ export async function detectPreferences(conversation, provider) {
10
+ if (conversation.length < 2)
11
+ return [];
12
+ // Only look at user messages for corrections
13
+ const userMessages = conversation
14
+ .filter((m) => m.role === 'user')
15
+ .map((m) => m.content);
16
+ // Simple heuristic detection for common correction patterns
17
+ const preferences = [];
18
+ for (const message of userMessages) {
19
+ const lower = message.toLowerCase();
20
+ // Check for explicit corrections
21
+ if (hasCorrection(lower)) {
22
+ const detected = await extractPreferenceWithLLM(message, provider);
23
+ if (detected) {
24
+ preferences.push(detected);
25
+ }
26
+ }
27
+ }
28
+ return preferences;
29
+ }
30
+ /**
31
+ * Check if a message contains a correction pattern.
32
+ */
33
+ function hasCorrection(message) {
34
+ const patterns = [
35
+ 'no, ',
36
+ 'not that',
37
+ 'instead ',
38
+ "don't ",
39
+ "let's not",
40
+ 'actually ',
41
+ 'i prefer',
42
+ 'i want',
43
+ 'make it ',
44
+ 'can you ',
45
+ 'please use',
46
+ 'shorter',
47
+ 'longer',
48
+ 'more concise',
49
+ 'more detailed',
50
+ 'in table form',
51
+ 'as a list',
52
+ ];
53
+ return patterns.some((p) => message.includes(p));
54
+ }
55
+ /**
56
+ * Use an LLM to extract a structured preference from a correction message.
57
+ */
58
+ async function extractPreferenceWithLLM(message, provider) {
59
+ const prompt = [
60
+ 'Extract a user preference from this message. If it expresses a preference for how responses should be formatted or what they should contain, extract it.',
61
+ '',
62
+ `Message: "${message}"`,
63
+ '',
64
+ 'Reply with exactly one line in the format:',
65
+ 'PREF: category=<style|content|behavior|domain> preference=<the preference> source=<correction|explicit>',
66
+ 'or',
67
+ 'NONE: no clear preference detected',
68
+ '',
69
+ 'Nothing else.',
70
+ ].join('\n');
71
+ try {
72
+ const response = await provider.judge(prompt);
73
+ const line = response.trim().split('\n')[0];
74
+ const prefMatch = /^PREF:\s*category=(\w+)\s+preference=(.+?)\s+source=(\w+)$/i.exec(line);
75
+ if (prefMatch) {
76
+ const rawCategory = prefMatch[1];
77
+ const validCategories = new Set(['style', 'content', 'behavior', 'domain']);
78
+ if (!validCategories.has(rawCategory))
79
+ return null;
80
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- validated above
81
+ const category = rawCategory;
82
+ return {
83
+ category,
84
+ preference: prefMatch[2].trim(),
85
+ confidence: 0.7,
86
+ source: prefMatch[3] === 'explicit' ? 'explicit' : 'correction',
87
+ };
88
+ }
89
+ return null;
90
+ }
91
+ catch {
92
+ return null;
93
+ }
94
+ }
95
+ //# sourceMappingURL=preference-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preference-detector.js","sourceRoot":"","sources":["../../../src/runtime/preference-detector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,YAAkE,EAClE,QAAuB;IAEvB,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvC,6CAA6C;IAC7C,MAAM,YAAY,GAAG,YAAY;SAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;SAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAEzB,4DAA4D;IAC5D,MAAM,WAAW,GAAyB,EAAE,CAAC;IAE7C,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QAEpC,iCAAiC;QACjC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACnE,IAAI,QAAQ,EAAE,CAAC;gBACb,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,QAAQ,GAAG;QACf,MAAM;QACN,UAAU;QACV,UAAU;QACV,QAAQ;QACR,WAAW;QACX,WAAW;QACX,UAAU;QACV,QAAQ;QACR,UAAU;QACV,UAAU;QACV,YAAY;QACZ,SAAS;QACT,QAAQ;QACR,cAAc;QACd,eAAe;QACf,eAAe;QACf,WAAW;KACZ,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,wBAAwB,CACrC,OAAe,EACf,QAAuB;IAEvB,MAAM,MAAM,GAAG;QACb,0JAA0J;QAC1J,EAAE;QACF,aAAa,OAAO,GAAG;QACvB,EAAE;QACF,4CAA4C;QAC5C,yGAAyG;QACzG,IAAI;QACJ,oCAAoC;QACpC,EAAE;QACF,eAAe;KAChB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAE5C,MAAM,SAAS,GAAG,6DAA6D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3F,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAS,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;YACpF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,CAAC;gBAAE,OAAO,IAAI,CAAC;YACnD,0FAA0F;YAC1F,MAAM,QAAQ,GAAG,WAA6C,CAAC;YAE/D,OAAO;gBACL,QAAQ;gBACR,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;gBAC/B,UAAU,EAAE,GAAG;gBACf,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;aAChE,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import type { MessageBus } from '@google/gemini-cli-core';
7
+ import { RequestTool } from '../tools/request-tool.js';
8
+ import type { SessionRuntime } from './session-setup.js';
9
+ /**
10
+ * Creates a RequestTool with security integration (field scrubbing +
11
+ * action gating) wired from the session runtime.
12
+ */
13
+ export declare function createSecuredRequestTool(runtime: SessionRuntime, messageBus: MessageBus): RequestTool;
14
+ /**
15
+ * Creates a read-only RequestTool with security integration.
16
+ * Used for task agents that should not perform writes.
17
+ */
18
+ export declare function createSecuredReadOnlyRequestTool(runtime: SessionRuntime, messageBus: MessageBus): RequestTool;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import { RequestTool } from '../tools/request-tool.js';
7
+ /**
8
+ * Builds a {@link RequestSecurityConfig} from a session runtime.
9
+ */
10
+ function buildSecurityConfig(runtime) {
11
+ return {
12
+ fieldScrubber: runtime.fieldScrubber,
13
+ actionGate: runtime.actionGate,
14
+ };
15
+ }
16
+ /**
17
+ * Creates a RequestTool with security integration (field scrubbing +
18
+ * action gating) wired from the session runtime.
19
+ */
20
+ export function createSecuredRequestTool(runtime, messageBus) {
21
+ const security = buildSecurityConfig(runtime);
22
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- _secrets is stored as Record<string, string>
23
+ const sessionEnv = (runtime.connectionsMap['_secrets'] ?? {});
24
+ return new RequestTool(runtime.connectionsMap, messageBus, false, sessionEnv, security);
25
+ }
26
+ /**
27
+ * Creates a read-only RequestTool with security integration.
28
+ * Used for task agents that should not perform writes.
29
+ */
30
+ export function createSecuredReadOnlyRequestTool(runtime, messageBus) {
31
+ const security = buildSecurityConfig(runtime);
32
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- _secrets is stored as Record<string, string>
33
+ const sessionEnv = (runtime.connectionsMap['_secrets'] ?? {});
34
+ return new RequestTool(runtime.connectionsMap, messageBus, true, sessionEnv, security);
35
+ }
36
+ //# sourceMappingURL=request-integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-integration.js","sourceRoot":"","sources":["../../../src/runtime/request-integration.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAIrD;;GAEG;AACH,SAAS,mBAAmB,CAAC,OAAuB;IAClD,OAAO;QACL,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAuB,EACvB,UAAsB;IAEtB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC9C,uHAAuH;IACvH,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,EAAE,CAAsC,CAAC;IACnG,OAAO,IAAI,WAAW,CACpB,OAAO,CAAC,cAAc,EACtB,UAAU,EACV,KAAK,EACL,UAAU,EACV,QAAQ,CACT,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,OAAuB,EACvB,UAAsB;IAEtB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC9C,uHAAuH;IACvH,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,EAAE,CAAsC,CAAC;IACnG,OAAO,IAAI,WAAW,CACpB,OAAO,CAAC,cAAc,EACtB,UAAU,EACV,IAAI,EACJ,UAAU,EACV,QAAQ,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import type { AmodalRepo } from '../repo/repo-types.js';
7
+ /**
8
+ * Configuration for a single chat or task session.
9
+ */
10
+ export interface SessionConfig {
11
+ repo: AmodalRepo;
12
+ userRoles: string[];
13
+ scopeLabels: Record<string, string>;
14
+ fieldGuidance: string;
15
+ alternativeLookupGuidance: string;
16
+ planMode: boolean;
17
+ approvedPlan?: string;
18
+ isDelegated: boolean;
19
+ sessionId: string;
20
+ }
21
+ /**
22
+ * The fully compiled context ready for the LLM.
23
+ */
24
+ export interface CompiledContext {
25
+ systemPrompt: string;
26
+ tokenUsage: TokenBudget;
27
+ sections: ContextSection[];
28
+ }
29
+ /**
30
+ * A single section of the compiled prompt.
31
+ */
32
+ export interface ContextSection {
33
+ name: string;
34
+ content: string;
35
+ tokens: number;
36
+ /** Higher priority = more important, trimmed last. */
37
+ priority: number;
38
+ trimmed: boolean;
39
+ }
40
+ /**
41
+ * Token budget tracking for the compiled context.
42
+ */
43
+ export interface TokenBudget {
44
+ total: number;
45
+ used: number;
46
+ remaining: number;
47
+ sectionBreakdown: Record<string, number>;
48
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=runtime-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-types.js","sourceRoot":"","sources":["../../../src/runtime/runtime-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import type { AmodalRepo } from '../repo/repo-types.js';
7
+ import type { CompiledContext } from './runtime-types.js';
8
+ import type { ConnectionsMap } from '../templates/connections.js';
9
+ import type { RuntimeTelemetryEvent } from './telemetry-hooks.js';
10
+ import { ScrubTracker } from '../security/scrub-tracker.js';
11
+ import { FieldScrubber } from '../security/field-scrubber.js';
12
+ import { OutputGuard } from '../security/output-guard.js';
13
+ import { ActionGate } from '../security/action-gate.js';
14
+ import { ContextCompiler } from './context-compiler.js';
15
+ import { OutputPipeline } from './output-pipeline.js';
16
+ import { RuntimeTelemetry } from './telemetry-hooks.js';
17
+ /**
18
+ * Options for setting up a new session.
19
+ */
20
+ export interface SessionSetupOptions {
21
+ repo: AmodalRepo;
22
+ userId?: string;
23
+ userRoles?: string[];
24
+ isDelegated?: boolean;
25
+ telemetrySink?: (event: RuntimeTelemetryEvent) => void;
26
+ }
27
+ /**
28
+ * The fully initialized session runtime — all components ready.
29
+ */
30
+ export interface SessionRuntime {
31
+ repo: AmodalRepo;
32
+ scrubTracker: ScrubTracker;
33
+ fieldScrubber: FieldScrubber;
34
+ outputGuard: OutputGuard;
35
+ actionGate: ActionGate;
36
+ contextCompiler: ContextCompiler;
37
+ compiledContext: CompiledContext;
38
+ exploreContext: CompiledContext;
39
+ outputPipeline: OutputPipeline;
40
+ telemetry: RuntimeTelemetry;
41
+ connectionsMap: ConnectionsMap;
42
+ userRoles: string[];
43
+ sessionId: string;
44
+ isDelegated: boolean;
45
+ }
46
+ /**
47
+ * Sets up a complete session runtime from a loaded repo.
48
+ *
49
+ * This is synchronous — the repo must already be loaded and no HTTP calls
50
+ * are made. All security components, context compilation, and telemetry
51
+ * are initialized and ready for use.
52
+ */
53
+ export declare function setupSession(options: SessionSetupOptions): SessionRuntime;