@infinityi/engine-lib 1.0.0 → 1.4.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 (405) hide show
  1. package/README.md +81 -445
  2. package/dist/agent/index.js +14 -8
  3. package/dist/context/index.d.ts +1 -1
  4. package/dist/context/index.js +8 -5
  5. package/dist/context/providers.d.ts +3 -3
  6. package/dist/context/types.d.ts +16 -1
  7. package/dist/errors.d.ts +18 -0
  8. package/dist/errors.js +6 -1
  9. package/dist/events/index.js +2 -1
  10. package/dist/execution/index.js +9 -4
  11. package/dist/execution/types.d.ts +14 -0
  12. package/dist/index-37x76zdn.js +4 -0
  13. package/dist/index-4c15ysa8.js +84 -0
  14. package/dist/{index-pwr8179t.js → index-7nb9qwa1.js} +23 -14
  15. package/dist/{index-jxgj4z08.js → index-9egrqxkf.js} +4 -0
  16. package/dist/index-9rr5dkzh.js +0 -0
  17. package/dist/{index-w34cbktd.js → index-a67ej96j.js} +1 -0
  18. package/dist/{index-64tt9696.js → index-aed6fe4z.js} +3 -3
  19. package/dist/{index-7690reng.js → index-ajr3nk10.js} +15 -1
  20. package/dist/index-c6kgts41.js +0 -0
  21. package/dist/{index-xsv43c5j.js → index-e14g2e48.js} +2 -2
  22. package/dist/index-k0q7x4mz.js +54 -0
  23. package/dist/index-mnx5mqbs.js +102 -0
  24. package/dist/index-mr1hs98z.js +661 -0
  25. package/dist/{index-yrqrxwjt.js → index-nvdsr51v.js} +4 -38
  26. package/dist/{index-jp2b31xs.js → index-vwcyawfk.js} +4 -4
  27. package/dist/index-ycjsqfpq.js +39 -0
  28. package/dist/{index-bqg01r42.js → index-zdggff0y.js} +183 -180
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +49 -38
  31. package/dist/lifecycle/index.js +2 -0
  32. package/dist/messages/index.js +1 -0
  33. package/dist/providers/index.js +5 -4
  34. package/dist/retrieval/chunking.d.ts +8 -0
  35. package/dist/retrieval/context.d.ts +4 -0
  36. package/dist/retrieval/index.d.ts +19 -0
  37. package/dist/retrieval/index.js +747 -0
  38. package/dist/retrieval/loaders.d.ts +8 -0
  39. package/dist/retrieval/memory.d.ts +29 -0
  40. package/dist/retrieval/retriever.d.ts +8 -0
  41. package/dist/retrieval/types.d.ts +253 -0
  42. package/dist/retrieval/utils.d.ts +11 -0
  43. package/dist/retrieval/vector-store.d.ts +13 -0
  44. package/dist/runtime/index.js +2 -1
  45. package/dist/schema/index.js +10 -4
  46. package/dist/session/index.js +1 -0
  47. package/dist/session-stores/codec.d.ts +8 -0
  48. package/dist/session-stores/forge-data.d.ts +43 -0
  49. package/dist/session-stores/hooks.d.ts +4 -0
  50. package/dist/session-stores/ids.d.ts +3 -0
  51. package/dist/session-stores/index.d.ts +20 -0
  52. package/dist/session-stores/index.js +1382 -0
  53. package/dist/session-stores/jsonl.d.ts +26 -0
  54. package/dist/session-stores/redis.d.ts +45 -0
  55. package/dist/session-stores/types.d.ts +45 -0
  56. package/dist/session-stores/versioning.d.ts +6 -0
  57. package/dist/testing/conformance.js +5 -4
  58. package/dist/testing/index.js +1 -0
  59. package/dist/tools/index.js +5 -3
  60. package/dist/tools-fs/define.d.ts +2 -0
  61. package/dist/tools-fs/files.d.ts +40 -0
  62. package/dist/tools-fs/git.d.ts +14 -0
  63. package/dist/tools-fs/index.d.ts +19 -0
  64. package/dist/tools-fs/index.js +1695 -0
  65. package/dist/tools-fs/policy.d.ts +32 -0
  66. package/dist/tools-fs/schemas.d.ts +31 -0
  67. package/dist/tools-fs/search.d.ts +45 -0
  68. package/dist/tools-fs/symbols.d.ts +12 -0
  69. package/dist/tools-fs/types.d.ts +151 -0
  70. package/dist/tools-http/client.d.ts +12 -0
  71. package/dist/tools-http/define.d.ts +12 -0
  72. package/dist/tools-http/events.d.ts +22 -0
  73. package/dist/tools-http/index.d.ts +24 -0
  74. package/dist/tools-http/index.js +18 -0
  75. package/dist/tools-http/policy.d.ts +52 -0
  76. package/dist/tools-http/types.d.ts +116 -0
  77. package/dist/tools-shell/define.d.ts +23 -0
  78. package/dist/tools-shell/events.d.ts +38 -0
  79. package/dist/tools-shell/exec.d.ts +37 -0
  80. package/dist/tools-shell/index.d.ts +30 -0
  81. package/dist/tools-shell/index.js +327 -0
  82. package/dist/tools-shell/policy.d.ts +42 -0
  83. package/dist/tools-shell/types.d.ts +121 -0
  84. package/dist/tools-web/define.d.ts +11 -0
  85. package/dist/tools-web/html.d.ts +22 -0
  86. package/dist/tools-web/index.d.ts +21 -0
  87. package/dist/tools-web/index.js +472 -0
  88. package/dist/tools-web/types.d.ts +81 -0
  89. package/docs/README.md +58 -10
  90. package/docs/api/.nojekyll +1 -0
  91. package/docs/api/assets/hierarchy.js +1 -0
  92. package/docs/api/assets/highlight.css +99 -0
  93. package/docs/api/assets/icons.js +18 -0
  94. package/docs/api/assets/icons.svg +1 -0
  95. package/docs/api/assets/main.js +60 -0
  96. package/docs/api/assets/navigation.js +1 -0
  97. package/docs/api/assets/search.js +1 -0
  98. package/docs/api/assets/style.css +1633 -0
  99. package/docs/api/classes/errors.AgentError.html +47 -0
  100. package/docs/api/classes/errors.CancelledError.html +46 -0
  101. package/docs/api/classes/errors.ContextWindowError.html +48 -0
  102. package/docs/api/classes/errors.ExecutionError.html +46 -0
  103. package/docs/api/classes/errors.FilesystemPolicyError.html +48 -0
  104. package/docs/api/classes/errors.MaxHandoffsExceededError.html +47 -0
  105. package/docs/api/classes/errors.MaxStepsExceededError.html +47 -0
  106. package/docs/api/classes/errors.ProviderError.html +47 -0
  107. package/docs/api/classes/errors.SchemaValidationError.html +47 -0
  108. package/docs/api/classes/errors.ShellPolicyError.html +50 -0
  109. package/docs/api/classes/errors.ToolError.html +47 -0
  110. package/docs/api/classes/errors.ToolValidationError.html +48 -0
  111. package/docs/api/classes/index.InMemorySessionStore.html +11 -0
  112. package/docs/api/classes/index.Secret.html +20 -0
  113. package/docs/api/classes/providers.StreamAccumulator.html +8 -0
  114. package/docs/api/classes/session-stores.FilesystemJsonlSessionStore.html +13 -0
  115. package/docs/api/classes/session-stores.ForgeDataSessionStore.html +14 -0
  116. package/docs/api/classes/session-stores.RedisSessionStore.html +12 -0
  117. package/docs/api/classes/tools-http.HttpPolicyError.html +41 -0
  118. package/docs/api/functions/agent.createToolRegistry.html +3 -0
  119. package/docs/api/functions/agent.handoffProviderTools.html +3 -0
  120. package/docs/api/functions/agent.handoffToolName.html +2 -0
  121. package/docs/api/functions/agent.resolveHandoffTargets.html +8 -0
  122. package/docs/api/functions/context.applyContextWindow.html +5 -0
  123. package/docs/api/functions/context.estimateTokens.html +3 -0
  124. package/docs/api/functions/context.resolveContext.html +5 -0
  125. package/docs/api/functions/events.createRunTelemetry.html +3 -0
  126. package/docs/api/functions/events.eventFields.html +4 -0
  127. package/docs/api/functions/events.eventPayload.html +5 -0
  128. package/docs/api/functions/execution.addUsage.html +2 -0
  129. package/docs/api/functions/execution.emptyUsage.html +2 -0
  130. package/docs/api/functions/index.asSchema.html +4 -0
  131. package/docs/api/functions/index.asTool.html +8 -0
  132. package/docs/api/functions/index.assistant.html +2 -0
  133. package/docs/api/functions/index.createAgentRegistry.html +5 -0
  134. package/docs/api/functions/index.createAnthropic.html +5 -0
  135. package/docs/api/functions/index.createEventHub.html +2 -0
  136. package/docs/api/functions/index.createGoogle.html +5 -0
  137. package/docs/api/functions/index.createOpenAI.html +5 -0
  138. package/docs/api/functions/index.createOpenAICompatible.html +7 -0
  139. package/docs/api/functions/index.createSession.html +3 -0
  140. package/docs/api/functions/index.defineAgent.html +7 -0
  141. package/docs/api/functions/index.defineTool.html +7 -0
  142. package/docs/api/functions/index.dynamicContext.html +2 -0
  143. package/docs/api/functions/index.fromJsonSchema.html +3 -0
  144. package/docs/api/functions/index.isSecret.html +4 -0
  145. package/docs/api/functions/index.loggingSubscriber.html +4 -0
  146. package/docs/api/functions/index.messageBusSubscriber.html +6 -0
  147. package/docs/api/functions/index.normalizeContent.html +2 -0
  148. package/docs/api/functions/index.resolveSecret.html +4 -0
  149. package/docs/api/functions/index.runAgent.html +19 -0
  150. package/docs/api/functions/index.staticContext.html +3 -0
  151. package/docs/api/functions/index.summarizeOldest.html +4 -0
  152. package/docs/api/functions/index.system.html +2 -0
  153. package/docs/api/functions/index.text.html +2 -0
  154. package/docs/api/functions/index.toJsonSchema.html +2 -0
  155. package/docs/api/functions/index.toolResult.html +2 -0
  156. package/docs/api/functions/index.truncateOldest.html +5 -0
  157. package/docs/api/functions/index.user.html +2 -0
  158. package/docs/api/functions/index.validateJsonSchema.html +3 -0
  159. package/docs/api/functions/lifecycle.agentRuntimeComponent.html +5 -0
  160. package/docs/api/functions/providers.collectStream.html +2 -0
  161. package/docs/api/functions/providers.createProvider.html +4 -0
  162. package/docs/api/functions/providers.createProviderHttp.html +3 -0
  163. package/docs/api/functions/providers.defaultProviderResilience.html +3 -0
  164. package/docs/api/functions/providers.openSseStream.html +6 -0
  165. package/docs/api/functions/providers.parseSse.html +2 -0
  166. package/docs/api/functions/providers.toProviderError.html +2 -0
  167. package/docs/api/functions/session-stores.createPostgresSessionStore.html +1 -0
  168. package/docs/api/functions/session-stores.createSqliteSessionStore.html +1 -0
  169. package/docs/api/functions/session-stores.isCloseableSessionStore.html +1 -0
  170. package/docs/api/functions/session-stores.isVersionedSessionStore.html +1 -0
  171. package/docs/api/functions/session-stores.migrateSessionStore.html +1 -0
  172. package/docs/api/functions/session-stores.withSessionStoreHooks.html +2 -0
  173. package/docs/api/functions/testing.byteStreamOf.html +2 -0
  174. package/docs/api/functions/testing.collectProviderStream.html +2 -0
  175. package/docs/api/functions/testing.conversation.html +2 -0
  176. package/docs/api/functions/testing.expectValid.html +3 -0
  177. package/docs/api/functions/testing.inMemorySessionStore.html +2 -0
  178. package/docs/api/functions/testing.jsonFetch.html +3 -0
  179. package/docs/api/functions/testing.mockProvider.html +3 -0
  180. package/docs/api/functions/testing.scriptedProvider.html +4 -0
  181. package/docs/api/functions/testing.sseFetch.html +3 -0
  182. package/docs/api/functions/testing.textResult.html +3 -0
  183. package/docs/api/functions/testing.toolCallResult.html +3 -0
  184. package/docs/api/functions/testing_conformance.runProviderConformance.html +3 -0
  185. package/docs/api/functions/tools-fs.filesystemTools.html +1 -0
  186. package/docs/api/functions/tools-http.createHttpToolClient.html +2 -0
  187. package/docs/api/functions/tools-http.httpTools.html +2 -0
  188. package/docs/api/functions/tools-shell.shellTools.html +4 -0
  189. package/docs/api/functions/tools-web.webTools.html +2 -0
  190. package/docs/api/functions/tools.renderToolContent.html +6 -0
  191. package/docs/api/functions/tools.toProviderTool.html +3 -0
  192. package/docs/api/functions/tools.toToolResultMessage.html +4 -0
  193. package/docs/api/hierarchy.html +1 -0
  194. package/docs/api/index.html +1 -0
  195. package/docs/api/interfaces/agent.ToolRegistry.html +8 -0
  196. package/docs/api/interfaces/errors.SchemaIssue.html +4 -0
  197. package/docs/api/interfaces/events.RunTelemetry.html +10 -0
  198. package/docs/api/interfaces/events.SpanHandle.html +6 -0
  199. package/docs/api/interfaces/index.AgentDefinition.html +16 -0
  200. package/docs/api/interfaces/index.AgentHooks.html +21 -0
  201. package/docs/api/interfaces/index.AgentRegistry.html +16 -0
  202. package/docs/api/interfaces/index.AnthropicOptions.html +13 -0
  203. package/docs/api/interfaces/index.AsToolOptions.html +13 -0
  204. package/docs/api/interfaces/index.CompletionRequest.html +30 -0
  205. package/docs/api/interfaces/index.CompletionResult.html +14 -0
  206. package/docs/api/interfaces/index.ContextItem.html +6 -0
  207. package/docs/api/interfaces/index.ContextProvider.html +5 -0
  208. package/docs/api/interfaces/index.ContextStrategy.html +8 -0
  209. package/docs/api/interfaces/index.ContextStrategyContext.html +8 -0
  210. package/docs/api/interfaces/index.ContextWindowOptions.html +8 -0
  211. package/docs/api/interfaces/index.CreateSessionOptions.html +10 -0
  212. package/docs/api/interfaces/index.EngineContext.html +10 -0
  213. package/docs/api/interfaces/index.EventHub.html +4 -0
  214. package/docs/api/interfaces/index.EventHubOptions.html +8 -0
  215. package/docs/api/interfaces/index.GenerationSettings.html +12 -0
  216. package/docs/api/interfaces/index.GoogleOptions.html +11 -0
  217. package/docs/api/interfaces/index.ImagePart.html +5 -0
  218. package/docs/api/interfaces/index.InstructionContext.html +9 -0
  219. package/docs/api/interfaces/index.JsonSchema.html +18 -0
  220. package/docs/api/interfaces/index.LoggingSubscriberOptions.html +4 -0
  221. package/docs/api/interfaces/index.Message.html +8 -0
  222. package/docs/api/interfaces/index.MessageBusSubscriberOptions.html +4 -0
  223. package/docs/api/interfaces/index.OpenAICompatibleOptions.html +16 -0
  224. package/docs/api/interfaces/index.OpenAIOptions.html +16 -0
  225. package/docs/api/interfaces/index.Provider.html +11 -0
  226. package/docs/api/interfaces/index.ProviderCapabilities.html +9 -0
  227. package/docs/api/interfaces/index.ProviderTool.html +6 -0
  228. package/docs/api/interfaces/index.ResponseSchema.html +6 -0
  229. package/docs/api/interfaces/index.RunBridge.html +10 -0
  230. package/docs/api/interfaces/index.RunOptions.html +39 -0
  231. package/docs/api/interfaces/index.RunResult.html +20 -0
  232. package/docs/api/interfaces/index.Schema.html +13 -0
  233. package/docs/api/interfaces/index.Session.html +13 -0
  234. package/docs/api/interfaces/index.SessionState.html +5 -0
  235. package/docs/api/interfaces/index.SessionStore.html +15 -0
  236. package/docs/api/interfaces/index.TextPart.html +4 -0
  237. package/docs/api/interfaces/index.ToolCall.html +9 -0
  238. package/docs/api/interfaces/index.ToolCallPart.html +6 -0
  239. package/docs/api/interfaces/index.ToolContext.html +21 -0
  240. package/docs/api/interfaces/index.ToolDefinition.html +14 -0
  241. package/docs/api/interfaces/index.ToolFailure.html +9 -0
  242. package/docs/api/interfaces/index.ToolResultPart.html +8 -0
  243. package/docs/api/interfaces/index.ToolSpec.html +6 -0
  244. package/docs/api/interfaces/index.ToolSuccess.html +6 -0
  245. package/docs/api/interfaces/index.Usage.html +9 -0
  246. package/docs/api/interfaces/lifecycle.AgentRuntimeOptions.html +17 -0
  247. package/docs/api/interfaces/providers.AdapterSpec.html +17 -0
  248. package/docs/api/interfaces/providers.ProviderHttpOptions.html +14 -0
  249. package/docs/api/interfaces/providers.SseMessage.html +6 -0
  250. package/docs/api/interfaces/providers.SseRequest.html +8 -0
  251. package/docs/api/interfaces/runtime.Logger.html +22 -0
  252. package/docs/api/interfaces/runtime.Telemetry.html +9 -0
  253. package/docs/api/interfaces/schema.OptionalSchema.html +13 -0
  254. package/docs/api/interfaces/session-stores.CloseableSessionStore.html +11 -0
  255. package/docs/api/interfaces/session-stores.CreatePostgresSessionStoreOptions.html +6 -0
  256. package/docs/api/interfaces/session-stores.CreateSqliteSessionStoreOptions.html +7 -0
  257. package/docs/api/interfaces/session-stores.FilesystemJsonlSessionStoreOptions.html +3 -0
  258. package/docs/api/interfaces/session-stores.ForgeDataSessionStoreOptions.html +5 -0
  259. package/docs/api/interfaces/session-stores.RedisSessionStoreClient.html +9 -0
  260. package/docs/api/interfaces/session-stores.RedisSessionStoreOptions.html +4 -0
  261. package/docs/api/interfaces/session-stores.RedisSessionStoreTransaction.html +6 -0
  262. package/docs/api/interfaces/session-stores.SessionArchiveRecord.html +7 -0
  263. package/docs/api/interfaces/session-stores.SessionArchiver.html +2 -0
  264. package/docs/api/interfaces/session-stores.SessionCompactionResult.html +3 -0
  265. package/docs/api/interfaces/session-stores.SessionCompactor.html +3 -0
  266. package/docs/api/interfaces/session-stores.SessionStoreCodec.html +6 -0
  267. package/docs/api/interfaces/session-stores.SessionStoreHookContext.html +3 -0
  268. package/docs/api/interfaces/session-stores.SessionStoreHooks.html +3 -0
  269. package/docs/api/interfaces/session-stores.VersionedSessionStore.html +11 -0
  270. package/docs/api/interfaces/testing.MockProviderOptions.html +12 -0
  271. package/docs/api/interfaces/testing.RecordedCall.html +4 -0
  272. package/docs/api/interfaces/testing.RecordingFetch.html +4 -0
  273. package/docs/api/interfaces/testing_conformance.ConformanceFixtures.html +12 -0
  274. package/docs/api/interfaces/testing_conformance.ConformanceOptions.html +10 -0
  275. package/docs/api/interfaces/testing_conformance.ConformanceTestApi.html +4 -0
  276. package/docs/api/interfaces/testing_conformance.ProviderIO.html +7 -0
  277. package/docs/api/interfaces/tools-fs.ApplyPatchArgs.html +6 -0
  278. package/docs/api/interfaces/tools-fs.DiffStatusArgs.html +5 -0
  279. package/docs/api/interfaces/tools-fs.EditRangeArgs.html +7 -0
  280. package/docs/api/interfaces/tools-fs.EditReplaceArgs.html +7 -0
  281. package/docs/api/interfaces/tools-fs.FilesystemTools.html +13 -0
  282. package/docs/api/interfaces/tools-fs.FilesystemToolsConfig.html +12 -0
  283. package/docs/api/interfaces/tools-fs.FindFilesArgs.html +7 -0
  284. package/docs/api/interfaces/tools-fs.OpenWindowArgs.html +5 -0
  285. package/docs/api/interfaces/tools-fs.ReadArgs.html +9 -0
  286. package/docs/api/interfaces/tools-fs.RepoMapArgs.html +7 -0
  287. package/docs/api/interfaces/tools-fs.SearchSemanticArgs.html +8 -0
  288. package/docs/api/interfaces/tools-fs.SearchTextArgs.html +11 -0
  289. package/docs/api/interfaces/tools-fs.SymbolInfo.html +7 -0
  290. package/docs/api/interfaces/tools-fs.SymbolsArgs.html +5 -0
  291. package/docs/api/interfaces/tools-fs.ValidationCommandRequest.html +4 -0
  292. package/docs/api/interfaces/tools-fs.ValidationCommandResult.html +6 -0
  293. package/docs/api/interfaces/tools-fs.ValidationOptions.html +4 -0
  294. package/docs/api/interfaces/tools-fs.WriteFileArgs.html +6 -0
  295. package/docs/api/interfaces/tools-http.HeaderEntry.html +4 -0
  296. package/docs/api/interfaces/tools-http.HttpClientRequest.html +11 -0
  297. package/docs/api/interfaces/tools-http.HttpPolicy.html +13 -0
  298. package/docs/api/interfaces/tools-http.HttpRequestResult.html +17 -0
  299. package/docs/api/interfaces/tools-http.HttpRetryOptions.html +10 -0
  300. package/docs/api/interfaces/tools-http.HttpToolClient.html +5 -0
  301. package/docs/api/interfaces/tools-http.HttpTools.html +4 -0
  302. package/docs/api/interfaces/tools-http.HttpToolsConfig.html +38 -0
  303. package/docs/api/interfaces/tools-shell.ApprovalDecision.html +5 -0
  304. package/docs/api/interfaces/tools-shell.CommandRequest.html +14 -0
  305. package/docs/api/interfaces/tools-shell.CommandResult.html +21 -0
  306. package/docs/api/interfaces/tools-shell.EnvPolicy.html +9 -0
  307. package/docs/api/interfaces/tools-shell.ShellPolicy.html +7 -0
  308. package/docs/api/interfaces/tools-shell.ShellTools.html +6 -0
  309. package/docs/api/interfaces/tools-shell.ShellToolsConfig.html +26 -0
  310. package/docs/api/interfaces/tools-web.Citation.html +6 -0
  311. package/docs/api/interfaces/tools-web.SearchProvider.html +3 -0
  312. package/docs/api/interfaces/tools-web.SearchRequest.html +4 -0
  313. package/docs/api/interfaces/tools-web.SearchResult.html +7 -0
  314. package/docs/api/interfaces/tools-web.SourceMetadata.html +10 -0
  315. package/docs/api/interfaces/tools-web.WebTools.html +6 -0
  316. package/docs/api/interfaces/tools-web.WebToolsConfig.html +56 -0
  317. package/docs/api/modules/agent.html +5 -0
  318. package/docs/api/modules/context.html +5 -0
  319. package/docs/api/modules/errors.html +8 -0
  320. package/docs/api/modules/events.html +16 -0
  321. package/docs/api/modules/execution.html +4 -0
  322. package/docs/api/modules/index.html +16 -0
  323. package/docs/api/modules/lifecycle.html +6 -0
  324. package/docs/api/modules/messages.html +3 -0
  325. package/docs/api/modules/providers.html +10 -0
  326. package/docs/api/modules/runtime.html +4 -0
  327. package/docs/api/modules/schema.html +5 -0
  328. package/docs/api/modules/session-stores.html +6 -0
  329. package/docs/api/modules/session.html +4 -0
  330. package/docs/api/modules/testing.html +4 -0
  331. package/docs/api/modules/testing_conformance.html +21 -0
  332. package/docs/api/modules/tools-fs.html +9 -0
  333. package/docs/api/modules/tools-http.html +8 -0
  334. package/docs/api/modules/tools-shell.html +12 -0
  335. package/docs/api/modules/tools-web.html +7 -0
  336. package/docs/api/modules/tools.html +4 -0
  337. package/docs/api/types/events.Attrs.html +2 -0
  338. package/docs/api/types/index.AnyRunOptions.html +3 -0
  339. package/docs/api/types/index.BufferedRunOptions.html +2 -0
  340. package/docs/api/types/index.ContentPart.html +2 -0
  341. package/docs/api/types/index.FinishReason.html +2 -0
  342. package/docs/api/types/index.Infer.html +2 -0
  343. package/docs/api/types/index.Instructions.html +5 -0
  344. package/docs/api/types/index.LogLevel.html +2 -0
  345. package/docs/api/types/index.Role.html +2 -0
  346. package/docs/api/types/index.RunEvent.html +30 -0
  347. package/docs/api/types/index.RunHandle.html +7 -0
  348. package/docs/api/types/index.RunInput.html +2 -0
  349. package/docs/api/types/index.RunSubscriber.html +4 -0
  350. package/docs/api/types/index.SafeParseResult.html +2 -0
  351. package/docs/api/types/index.StreamEvent.html +8 -0
  352. package/docs/api/types/index.StreamingRunOptions.html +2 -0
  353. package/docs/api/types/index.TelemetryHandle.html +2 -0
  354. package/docs/api/types/index.TokenCounter.html +2 -0
  355. package/docs/api/types/index.ToolChoice.html +2 -0
  356. package/docs/api/types/index.ToolResult.html +2 -0
  357. package/docs/api/types/lifecycle.ProviderProbe.html +2 -0
  358. package/docs/api/types/session-stores.SessionStoreHookOperation.html +1 -0
  359. package/docs/api/types/testing_conformance.MakeProvider.html +2 -0
  360. package/docs/api/types/tools-fs.SymbolKind.html +1 -0
  361. package/docs/api/types/tools-http.HostPattern.html +2 -0
  362. package/docs/api/types/tools-shell.CommandPattern.html +2 -0
  363. package/docs/api/types/tools-web.RobotsPolicy.html +2 -0
  364. package/docs/api/variables/events.SPAN_PROVIDER.html +2 -0
  365. package/docs/api/variables/events.SPAN_RUN.html +2 -0
  366. package/docs/api/variables/events.SPAN_TOOL.html +2 -0
  367. package/docs/api/variables/execution.DEFAULT_MAX_HANDOFFS.html +2 -0
  368. package/docs/api/variables/execution.DEFAULT_MAX_STEPS.html +2 -0
  369. package/docs/api/variables/index.s.html +11 -0
  370. package/docs/api/variables/providers.DEFAULT_TIMEOUT_MS.html +2 -0
  371. package/docs/api/variables/session-stores.SESSION_STORE_SCHEMA_VERSION.html +1 -0
  372. package/docs/api/variables/session-stores.jsonSessionStoreCodec.html +2 -0
  373. package/docs/api/variables/tools-http.HTTP_EVENT.html +2 -0
  374. package/docs/api/variables/tools-shell.SHELL_EVENT.html +2 -0
  375. package/docs/events-and-telemetry.md +68 -0
  376. package/docs/execution.md +63 -0
  377. package/docs/getting-started.md +73 -0
  378. package/docs/multi-agent.md +52 -0
  379. package/docs/optional-tool-packs.md +93 -0
  380. package/docs/providers.md +68 -0
  381. package/docs/retrieval.md +83 -0
  382. package/docs/sessions-and-context.md +82 -0
  383. package/docs/testing-and-lifecycle.md +60 -0
  384. package/docs/tools.md +69 -0
  385. package/examples/01-minimal-agent.ts +19 -0
  386. package/examples/02-custom-tool.ts +32 -0
  387. package/examples/03-streaming.ts +46 -0
  388. package/examples/04-sessions-context.ts +40 -0
  389. package/examples/05-events-subscribers.ts +35 -0
  390. package/examples/06-multi-agent-handoff.ts +27 -0
  391. package/examples/07-sub-agent-tool.ts +26 -0
  392. package/examples/08-testing-agent.ts +31 -0
  393. package/examples/09-tools-filesystem.ts +49 -0
  394. package/examples/10-tools-http-web.ts +74 -0
  395. package/examples/11-shell-tools.ts +39 -0
  396. package/examples/12-provider-openai.ts +24 -0
  397. package/examples/13-lifecycle.ts +37 -0
  398. package/examples/14-retrieval.ts +65 -0
  399. package/examples/incident-analysis.ts +39 -87
  400. package/package.json +78 -4
  401. package/dist/index-02s1fjxr.js +0 -226
  402. package/examples/README.md +0 -24
  403. package/examples/lifecycle.ts +0 -53
  404. package/examples/multi-agent.ts +0 -93
  405. package/examples/terminal-coder.ts +0 -80
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  createToolRegistry,
3
3
  runAgent
4
- } from "./index-pwr8179t.js";
4
+ } from "./index-7nb9qwa1.js";
5
5
  import {
6
6
  s
7
- } from "./index-02s1fjxr.js";
7
+ } from "./index-mnx5mqbs.js";
8
8
  import {
9
9
  AgentError,
10
10
  ExecutionError
11
- } from "./index-7690reng.js";
11
+ } from "./index-ajr3nk10.js";
12
12
  import {
13
13
  defineTool
14
- } from "./index-w34cbktd.js";
14
+ } from "./index-a67ej96j.js";
15
15
 
16
16
  // src/agent/define.ts
17
17
  function defineAgent(def) {
@@ -0,0 +1,39 @@
1
+ import {
2
+ system
3
+ } from "./index-1p6mb2vz.js";
4
+
5
+ // src/context/providers.ts
6
+ function renderItem(item) {
7
+ const body = typeof item.content === "string" ? item.content : JSON.stringify(item.content, null, 2) ?? "";
8
+ return item.title !== undefined && item.title !== "" ? `## ${item.title}
9
+ ${body}` : body;
10
+ }
11
+ function staticContext(content, title) {
12
+ const item = { content, ...title !== undefined ? { title } : {} };
13
+ return {
14
+ name: "static",
15
+ resolve: () => [item]
16
+ };
17
+ }
18
+ function dynamicContext(name, fn, title) {
19
+ return {
20
+ name,
21
+ resolve: async (ctx, run) => {
22
+ const content = await fn(ctx, run);
23
+ return [{ content, ...title !== undefined ? { title } : {} }];
24
+ }
25
+ };
26
+ }
27
+ async function resolveContext(providers, ctx, run) {
28
+ if (providers === undefined || providers.length === 0)
29
+ return [];
30
+ const resolved = await Promise.all(providers.map((p) => p.resolve(ctx, run)));
31
+ const blocks = resolved.flat().map(renderItem).filter((s) => s !== "");
32
+ if (blocks.length === 0)
33
+ return [];
34
+ return [system(blocks.join(`
35
+
36
+ `))];
37
+ }
38
+
39
+ export { staticContext, dynamicContext, resolveContext };
@@ -1,101 +1,3 @@
1
- // node_modules/@infinityi/forge/dist/index-ft2g12w9.js
2
- var realClock = {
3
- now() {
4
- return Date.now();
5
- },
6
- sleep(ms, signal) {
7
- if (signal?.aborted) {
8
- return Promise.reject(signal.reason);
9
- }
10
- if (ms <= 0) {
11
- return Promise.resolve();
12
- }
13
- return new Promise((resolve, reject) => {
14
- const timer = setTimeout(() => {
15
- signal?.removeEventListener("abort", onAbort);
16
- resolve();
17
- }, ms);
18
- const onAbort = () => {
19
- clearTimeout(timer);
20
- reject(signal.reason);
21
- };
22
- signal?.addEventListener("abort", onAbort, { once: true });
23
- });
24
- }
25
- };
26
-
27
- // node_modules/@infinityi/forge/dist/index-sw7jeh00.js
28
- class ResilienceError extends Error {
29
- constructor(message, options) {
30
- super(message, options);
31
- this.name = "ResilienceError";
32
- }
33
- }
34
-
35
- // node_modules/@infinityi/forge/dist/index-f41wfqnm.js
36
- function buildInstruments(telemetry) {
37
- const meter = telemetry?.meter;
38
- const tracer = telemetry?.tracer;
39
- let attempts;
40
- let retries;
41
- let timeouts;
42
- let circuitState;
43
- let bulkheadQueueSize;
44
- return {
45
- attempts() {
46
- if (!meter)
47
- return;
48
- attempts ??= meter.createCounter("forge_resilience_attempts_total", {
49
- description: "Total execution attempts (including retries).",
50
- unit: "1"
51
- });
52
- return attempts;
53
- },
54
- retries() {
55
- if (!meter)
56
- return;
57
- retries ??= meter.createCounter("forge_resilience_retries_total", {
58
- description: "Total retry attempts triggered.",
59
- unit: "1"
60
- });
61
- return retries;
62
- },
63
- timeouts() {
64
- if (!meter)
65
- return;
66
- timeouts ??= meter.createCounter("forge_resilience_timeout_total", {
67
- description: "Total operations aborted due to timeout.",
68
- unit: "1"
69
- });
70
- return timeouts;
71
- },
72
- circuitState() {
73
- if (!meter)
74
- return;
75
- circuitState ??= meter.createGauge("forge_resilience_circuit_state", {
76
- description: "Current circuit-breaker state (0=Closed, 1=HalfOpen, 2=Open).",
77
- unit: "1"
78
- });
79
- return circuitState;
80
- },
81
- bulkheadQueueSize() {
82
- if (!meter)
83
- return;
84
- bulkheadQueueSize ??= meter.createGauge("forge_resilience_bulkhead_queue_size", {
85
- description: "Current number of tasks waiting in a bulkhead queue.",
86
- unit: "1"
87
- });
88
- return bulkheadQueueSize;
89
- },
90
- addEvent(name, attributes) {
91
- if (!tracer)
92
- return;
93
- const span = tracer.startSpan(name, attributes ? { attributes } : undefined);
94
- span.end();
95
- }
96
- };
97
- }
98
-
99
1
  // node_modules/@infinityi/forge/dist/index-yh6c6ebj.js
100
2
  import { AsyncLocalStorage } from "node:async_hooks";
101
3
  var INVALID_TRACE_ID = "0".repeat(32);
@@ -105,7 +7,7 @@ function currentContext() {
105
7
  return contextStorage.getStore();
106
8
  }
107
9
 
108
- // node_modules/@infinityi/forge/dist/index-0jqvt0fs.js
10
+ // node_modules/@infinityi/forge/dist/index-d0knb21f.js
109
11
  function buildRootContext() {
110
12
  const controller = new AbortController;
111
13
  const telemetry = currentContext();
@@ -124,7 +26,15 @@ function withExecutionContext(base, overrides) {
124
26
  return next;
125
27
  }
126
28
 
127
- // node_modules/@infinityi/forge/dist/index-br4e2rnq.js
29
+ // node_modules/@infinityi/forge/dist/index-sw7jeh00.js
30
+ class ResilienceError extends Error {
31
+ constructor(message, options) {
32
+ super(message, options);
33
+ this.name = "ResilienceError";
34
+ }
35
+ }
36
+
37
+ // node_modules/@infinityi/forge/dist/index-f31jaync.js
128
38
  function ok(value) {
129
39
  return {
130
40
  ok: true,
@@ -178,93 +88,97 @@ function createPipeline(policies) {
178
88
  }
179
89
  return { execute, executeResult };
180
90
  }
181
- function constantBackoff(delayMs) {
182
- const ms = Math.max(0, delayMs);
183
- return { delay: () => ms };
184
- }
185
- function exponentialBackoff(options) {
186
- const initial = Math.max(0, options.initial);
187
- const max = options.max !== undefined ? Math.max(initial, options.max) : Number.POSITIVE_INFINITY;
188
- const factor = options.factor ?? 2;
189
- const jitter = options.jitter ?? true;
91
+ // node_modules/@infinityi/forge/dist/index-f41wfqnm.js
92
+ function buildInstruments(telemetry) {
93
+ const meter = telemetry?.meter;
94
+ const tracer = telemetry?.tracer;
95
+ let attempts;
96
+ let retries;
97
+ let timeouts;
98
+ let circuitState;
99
+ let bulkheadQueueSize;
190
100
  return {
191
- delay(attempt) {
192
- const exponent = Math.max(0, attempt - 1);
193
- const raw = Math.min(max, initial * Math.pow(factor, exponent));
194
- return jitter ? applyFullJitter(raw) : raw;
101
+ attempts() {
102
+ if (!meter)
103
+ return;
104
+ attempts ??= meter.createCounter("forge_resilience_attempts_total", {
105
+ description: "Total execution attempts (including retries).",
106
+ unit: "1"
107
+ });
108
+ return attempts;
109
+ },
110
+ retries() {
111
+ if (!meter)
112
+ return;
113
+ retries ??= meter.createCounter("forge_resilience_retries_total", {
114
+ description: "Total retry attempts triggered.",
115
+ unit: "1"
116
+ });
117
+ return retries;
118
+ },
119
+ timeouts() {
120
+ if (!meter)
121
+ return;
122
+ timeouts ??= meter.createCounter("forge_resilience_timeout_total", {
123
+ description: "Total operations aborted due to timeout.",
124
+ unit: "1"
125
+ });
126
+ return timeouts;
127
+ },
128
+ circuitState() {
129
+ if (!meter)
130
+ return;
131
+ circuitState ??= meter.createGauge("forge_resilience_circuit_state", {
132
+ description: "Current circuit-breaker state (0=Closed, 1=HalfOpen, 2=Open).",
133
+ unit: "1"
134
+ });
135
+ return circuitState;
136
+ },
137
+ bulkheadQueueSize() {
138
+ if (!meter)
139
+ return;
140
+ bulkheadQueueSize ??= meter.createGauge("forge_resilience_bulkhead_queue_size", {
141
+ description: "Current number of tasks waiting in a bulkhead queue.",
142
+ unit: "1"
143
+ });
144
+ return bulkheadQueueSize;
145
+ },
146
+ addEvent(name, attributes) {
147
+ if (!tracer)
148
+ return;
149
+ const span = tracer.startSpan(name, attributes ? { attributes } : undefined);
150
+ span.end();
195
151
  }
196
152
  };
197
153
  }
198
- function applyFullJitter(base) {
199
- if (base <= 0)
200
- return 0;
201
- return Math.random() * base;
202
- }
203
154
 
204
- class RetryExhaustedError extends ResilienceError {
205
- attempts;
206
- constructor(message, options) {
207
- super(message, options);
208
- this.name = "RetryExhaustedError";
209
- this.attempts = options.attempts;
210
- }
211
- }
212
- function retry(options) {
213
- if (!Number.isInteger(options.maxAttempts) || options.maxAttempts < 1) {
214
- throw new RangeError(`retry: maxAttempts must be an integer >= 1, got ${options.maxAttempts}`);
215
- }
216
- const maxAttempts = options.maxAttempts;
217
- const backoff = options.backoff ?? constantBackoff(0);
218
- const shouldRetry = options.shouldRetry ?? (() => true);
219
- const retryOn = options.retryOn;
220
- const clock = options.clock ?? realClock;
221
- const instruments = buildInstruments(options.telemetry);
222
- async function execute(next, ctx) {
223
- let lastError;
224
- for (let attempt = 1;attempt <= maxAttempts; attempt++) {
225
- if (ctx.signal.aborted) {
226
- throw ctx.signal.reason;
227
- }
228
- const attemptCtx = attempt === ctx.attempt ? ctx : withExecutionContext(ctx, { attempt });
229
- instruments.attempts()?.add(1, { policy: "retry" });
230
- try {
231
- const value = await next(attemptCtx);
232
- if (retryOn && retryOn(value, attempt)) {
233
- const synthetic = new Error("operation returned a retryable value");
234
- synthetic.cause = value;
235
- lastError = synthetic;
236
- } else {
237
- return value;
238
- }
239
- } catch (error) {
240
- lastError = error;
241
- if (!shouldRetry(error, attempt))
242
- throw error;
243
- }
244
- if (attempt >= maxAttempts)
245
- break;
246
- const delayMs = Math.max(0, backoff.delay(attempt));
247
- instruments.retries()?.add(1, { policy: "retry" });
248
- instruments.addEvent("resilience.retry.attempt", {
249
- attempt_number: attempt,
250
- delay_ms: delayMs,
251
- error_message: lastError instanceof Error ? lastError.message : String(lastError)
252
- });
253
- if (delayMs > 0) {
254
- await clock.sleep(delayMs, ctx.signal);
255
- } else if (ctx.signal.aborted) {
256
- throw ctx.signal.reason;
257
- }
155
+ // node_modules/@infinityi/forge/dist/index-ft2g12w9.js
156
+ var realClock = {
157
+ now() {
158
+ return Date.now();
159
+ },
160
+ sleep(ms, signal) {
161
+ if (signal?.aborted) {
162
+ return Promise.reject(signal.reason);
258
163
  }
259
- throw new RetryExhaustedError(`retry: exhausted ${maxAttempts} attempt(s)`, { attempts: maxAttempts, cause: lastError });
164
+ if (ms <= 0) {
165
+ return Promise.resolve();
166
+ }
167
+ return new Promise((resolve, reject) => {
168
+ const timer = setTimeout(() => {
169
+ signal?.removeEventListener("abort", onAbort);
170
+ resolve();
171
+ }, ms);
172
+ const onAbort = () => {
173
+ clearTimeout(timer);
174
+ reject(signal.reason);
175
+ };
176
+ signal?.addEventListener("abort", onAbort, { once: true });
177
+ });
260
178
  }
261
- return {
262
- name: "retry",
263
- maxAttempts,
264
- execute
265
- };
266
- }
179
+ };
267
180
 
181
+ // node_modules/@infinityi/forge/dist/index-cfscg5g3.js
268
182
  class TimeoutError extends ResilienceError {
269
183
  timeoutMs;
270
184
  strategy;
@@ -351,4 +265,93 @@ function timeout(options) {
351
265
  execute
352
266
  };
353
267
  }
354
- export { currentContext, combine, exponentialBackoff, retry, timeout };
268
+
269
+ // node_modules/@infinityi/forge/dist/index-1b1bteg1.js
270
+ function constantBackoff(delayMs) {
271
+ const ms = Math.max(0, delayMs);
272
+ return { delay: () => ms };
273
+ }
274
+ function exponentialBackoff(options) {
275
+ const initial = Math.max(0, options.initial);
276
+ const max = options.max !== undefined ? Math.max(initial, options.max) : Number.POSITIVE_INFINITY;
277
+ const factor = options.factor ?? 2;
278
+ const jitter = options.jitter ?? true;
279
+ return {
280
+ delay(attempt) {
281
+ const exponent = Math.max(0, attempt - 1);
282
+ const raw = Math.min(max, initial * Math.pow(factor, exponent));
283
+ return jitter ? applyFullJitter(raw) : raw;
284
+ }
285
+ };
286
+ }
287
+ function applyFullJitter(base) {
288
+ if (base <= 0)
289
+ return 0;
290
+ return Math.random() * base;
291
+ }
292
+
293
+ class RetryExhaustedError extends ResilienceError {
294
+ attempts;
295
+ constructor(message, options) {
296
+ super(message, options);
297
+ this.name = "RetryExhaustedError";
298
+ this.attempts = options.attempts;
299
+ }
300
+ }
301
+ function retry(options) {
302
+ if (!Number.isInteger(options.maxAttempts) || options.maxAttempts < 1) {
303
+ throw new RangeError(`retry: maxAttempts must be an integer >= 1, got ${options.maxAttempts}`);
304
+ }
305
+ const maxAttempts = options.maxAttempts;
306
+ const backoff = options.backoff ?? constantBackoff(0);
307
+ const shouldRetry = options.shouldRetry ?? (() => true);
308
+ const retryOn = options.retryOn;
309
+ const clock = options.clock ?? realClock;
310
+ const instruments = buildInstruments(options.telemetry);
311
+ async function execute(next, ctx) {
312
+ let lastError;
313
+ for (let attempt = 1;attempt <= maxAttempts; attempt++) {
314
+ if (ctx.signal.aborted) {
315
+ throw ctx.signal.reason;
316
+ }
317
+ const attemptCtx = attempt === ctx.attempt ? ctx : withExecutionContext(ctx, { attempt });
318
+ instruments.attempts()?.add(1, { policy: "retry" });
319
+ try {
320
+ const value = await next(attemptCtx);
321
+ if (retryOn && retryOn(value, attempt)) {
322
+ const synthetic = new Error("operation returned a retryable value");
323
+ synthetic.cause = value;
324
+ lastError = synthetic;
325
+ } else {
326
+ return value;
327
+ }
328
+ } catch (error) {
329
+ lastError = error;
330
+ if (!shouldRetry(error, attempt))
331
+ throw error;
332
+ }
333
+ if (attempt >= maxAttempts)
334
+ break;
335
+ const delayMs = Math.max(0, backoff.delay(attempt));
336
+ instruments.retries()?.add(1, { policy: "retry" });
337
+ instruments.addEvent("resilience.retry.attempt", {
338
+ attempt_number: attempt,
339
+ delay_ms: delayMs,
340
+ error_message: lastError instanceof Error ? lastError.message : String(lastError)
341
+ });
342
+ if (delayMs > 0) {
343
+ await clock.sleep(delayMs, ctx.signal);
344
+ } else if (ctx.signal.aborted) {
345
+ throw ctx.signal.reason;
346
+ }
347
+ }
348
+ throw new RetryExhaustedError(`retry: exhausted ${maxAttempts} attempt(s)`, { attempts: maxAttempts, cause: lastError });
349
+ }
350
+ return {
351
+ name: "retry",
352
+ maxAttempts,
353
+ execute
354
+ };
355
+ }
356
+
357
+ export { currentContext, combine, timeout, exponentialBackoff, retry };
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * @module
21
21
  */
22
- export { AgentError, CancelledError, ContextWindowError, ExecutionError, MaxHandoffsExceededError, MaxStepsExceededError, ProviderError, SchemaValidationError, ToolError, ToolValidationError, } from "./errors";
22
+ export { AgentError, CancelledError, ContextWindowError, ExecutionError, FilesystemPolicyError, MaxHandoffsExceededError, MaxStepsExceededError, ProviderError, SchemaValidationError, ToolError, ToolValidationError, } from "./errors";
23
23
  export type { SchemaIssue } from "./errors";
24
24
  export { asSchema, fromJsonSchema, s, toJsonSchema, validateJsonSchema } from "./schema/index";
25
25
  export type { Infer, JsonSchema, SafeParseResult, Schema } from "./schema/index";
@@ -40,6 +40,6 @@ export type { AnyRunOptions, BufferedRunOptions, RunBridge, RunEvent, RunHandle,
40
40
  export { createSession, InMemorySessionStore } from "./session/index";
41
41
  export type { CreateSessionOptions, Session, SessionState, SessionStore, } from "./session/index";
42
42
  export { dynamicContext, staticContext, summarizeOldest, truncateOldest, } from "./context/index";
43
- export type { ContextItem, ContextProvider, ContextStrategy, ContextStrategyContext, ContextWindowOptions, TokenCounter, } from "./context/index";
43
+ export type { ContextItem, ContextProvider, ContextResolveContext, ContextStrategy, ContextStrategyContext, ContextWindowOptions, TokenCounter, } from "./context/index";
44
44
  export { createEventHub, loggingSubscriber, messageBusSubscriber, } from "./events/index";
45
45
  export type { EventHub, EventHubOptions, LoggingSubscriberOptions, LogLevel, MessageBusSubscriberOptions, RunSubscriber, } from "./events/index";
package/dist/index.js CHANGED
@@ -1,13 +1,38 @@
1
- import"./index-kte2h4k2.js";
2
- import"./index-d4xz3abn.js";
3
1
  import {
4
2
  loggingSubscriber,
5
3
  messageBusSubscriber
6
- } from "./index-jxgj4z08.js";
4
+ } from "./index-9egrqxkf.js";
5
+ import {
6
+ asTool,
7
+ createAgentRegistry,
8
+ defineAgent
9
+ } from "./index-vwcyawfk.js";
10
+ import"./index-kte2h4k2.js";
11
+ import {
12
+ runAgent
13
+ } from "./index-7nb9qwa1.js";
14
+ import {
15
+ createEventHub
16
+ } from "./index-fkr3rcq9.js";
7
17
  import {
8
18
  InMemorySessionStore,
9
19
  createSession
10
20
  } from "./index-vnby35rm.js";
21
+ import"./index-d4xz3abn.js";
22
+ import {
23
+ dynamicContext,
24
+ staticContext
25
+ } from "./index-ycjsqfpq.js";
26
+ import {
27
+ summarizeOldest,
28
+ truncateOldest
29
+ } from "./index-nvdsr51v.js";
30
+ import"./index-c6kgts41.js";
31
+ import {
32
+ asSchema,
33
+ fromJsonSchema,
34
+ toJsonSchema
35
+ } from "./index-k0q7x4mz.js";
11
36
  import"./index-19pwq79t.js";
12
37
  import"./index-jg19te9v.js";
13
38
  import {
@@ -15,62 +40,47 @@ import {
15
40
  createGoogle,
16
41
  createOpenAI,
17
42
  createOpenAICompatible
18
- } from "./index-64tt9696.js";
19
- import"./index-bqg01r42.js";
43
+ } from "./index-aed6fe4z.js";
44
+ import"./index-zdggff0y.js";
45
+ import"./index-zfgr4xx3.js";
20
46
  import {
21
47
  Secret,
22
48
  isSecret,
23
49
  resolveSecret
24
- } from "./index-xsv43c5j.js";
25
- import {
26
- asTool,
27
- createAgentRegistry,
28
- defineAgent
29
- } from "./index-jp2b31xs.js";
30
- import {
31
- runAgent
32
- } from "./index-pwr8179t.js";
50
+ } from "./index-e14g2e48.js";
51
+ import"./index-9rr5dkzh.js";
52
+ import"./index-rentvdpp.js";
33
53
  import {
34
- dynamicContext,
35
- staticContext,
36
- summarizeOldest,
37
- truncateOldest
38
- } from "./index-yrqrxwjt.js";
54
+ assistant,
55
+ normalizeContent,
56
+ system,
57
+ text,
58
+ toolResult,
59
+ user
60
+ } from "./index-1p6mb2vz.js";
39
61
  import {
40
- createEventHub
41
- } from "./index-fkr3rcq9.js";
62
+ s
63
+ } from "./index-mnx5mqbs.js";
42
64
  import {
43
- asSchema,
44
- fromJsonSchema,
45
- s,
46
- toJsonSchema,
47
65
  validateJsonSchema
48
- } from "./index-02s1fjxr.js";
49
- import"./index-zfgr4xx3.js";
66
+ } from "./index-4c15ysa8.js";
50
67
  import {
51
68
  AgentError,
52
69
  CancelledError,
53
70
  ContextWindowError,
54
71
  ExecutionError,
72
+ FilesystemPolicyError,
55
73
  MaxHandoffsExceededError,
56
74
  MaxStepsExceededError,
57
75
  ProviderError,
58
76
  SchemaValidationError,
59
77
  ToolError,
60
78
  ToolValidationError
61
- } from "./index-7690reng.js";
79
+ } from "./index-ajr3nk10.js";
62
80
  import {
63
81
  defineTool
64
- } from "./index-w34cbktd.js";
65
- import"./index-rentvdpp.js";
66
- import {
67
- assistant,
68
- normalizeContent,
69
- system,
70
- text,
71
- toolResult,
72
- user
73
- } from "./index-1p6mb2vz.js";
82
+ } from "./index-a67ej96j.js";
83
+ import"./index-37x76zdn.js";
74
84
  export {
75
85
  validateJsonSchema,
76
86
  user,
@@ -110,6 +120,7 @@ export {
110
120
  MaxStepsExceededError,
111
121
  MaxHandoffsExceededError,
112
122
  InMemorySessionStore,
123
+ FilesystemPolicyError,
113
124
  ExecutionError,
114
125
  ContextWindowError,
115
126
  CancelledError,
@@ -1,3 +1,5 @@
1
+ import"../index-37x76zdn.js";
2
+
1
3
  // src/lifecycle/component.ts
2
4
  var DEFAULT_NAME = "agent-runtime";
3
5
  function validateProviders(providers) {
@@ -7,6 +7,7 @@ import {
7
7
  toolResult,
8
8
  user
9
9
  } from "../index-1p6mb2vz.js";
10
+ import"../index-37x76zdn.js";
10
11
  export {
11
12
  user,
12
13
  toolResult,
@@ -10,14 +10,15 @@ import {
10
10
  openSseStream,
11
11
  parseSse,
12
12
  toProviderError
13
- } from "../index-64tt9696.js";
14
- import"../index-bqg01r42.js";
15
- import"../index-xsv43c5j.js";
13
+ } from "../index-aed6fe4z.js";
14
+ import"../index-zdggff0y.js";
16
15
  import {
17
16
  StreamAccumulator,
18
17
  collectStream
19
18
  } from "../index-zfgr4xx3.js";
20
- import"../index-7690reng.js";
19
+ import"../index-e14g2e48.js";
20
+ import"../index-ajr3nk10.js";
21
+ import"../index-37x76zdn.js";
21
22
  export {
22
23
  toProviderError,
23
24
  parseSse,
@@ -0,0 +1,8 @@
1
+ import type { Chunker, TextChunkerOptions } from "./types";
2
+ /**
3
+ * Create a deterministic plain-text chunker that splits by character budget,
4
+ * optional overlap, and separator preference while preserving source locations.
5
+ */
6
+ export declare function createTextChunker(options: TextChunkerOptions): Chunker;
7
+ /** Create a text chunker that recursively splits oversized spans by separator priority. */
8
+ export declare function recursiveTextChunker(options: TextChunkerOptions): Chunker;
@@ -0,0 +1,4 @@
1
+ import type { ContextProvider } from "../context/types";
2
+ import type { RetrieverContextOptions } from "./types";
3
+ /** Convert any retriever into a run-time context provider with citations. */
4
+ export declare function retrieverContext(options: RetrieverContextOptions): ContextProvider;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@infinityi/engine-lib/retrieval` — opt-in RAG primitives for document
3
+ * loading, chunking, embeddings, vector stores, retrievers, and context
4
+ * provider integration.
5
+ *
6
+ * The core run loop remains retrieval-agnostic. This module provides contracts
7
+ * and helpers that hosts can wire into existing `ContextProvider`s.
8
+ *
9
+ * @module
10
+ */
11
+ export { createTextChunker, recursiveTextChunker } from "./chunking";
12
+ export { retrieverContext } from "./context";
13
+ export { createDocumentLoader, loadDocuments, staticDocumentLoader } from "./loaders";
14
+ export { InMemoryVectorStore } from "./memory";
15
+ export type { InMemoryVectorStoreOptions } from "./memory";
16
+ export { createVectorRetriever, indexDocuments, mergeHybridResults } from "./retriever";
17
+ export { assertVector, cosineSimilarity, dotProduct, euclideanSimilarity, scoreVectors, } from "./vector-store";
18
+ export type { VectorSimilarity } from "./vector-store";
19
+ export type { Chunker, ChunkerContext, DocumentLoader, DocumentLoaderOutput, EmbeddingProvider, EmbeddingRequest, EmbeddingResult, EmbeddingUsage, EmbeddingVector, HybridRetrievalOptions, IndexDocumentsOptions, IndexDocumentsResult, KeywordRetrievalResult, KeywordRetriever, LoadDocumentsResult, LoadedDocument, RetrievalChunk, RetrievalQuery, RetrievalResult, RetrievalScores, Retriever, RetrieverContextBudgetOptions, RetrieverContextOptions, RetrieverContextProvider, SourceAttribution, SourceLocation, TextChunkerOptions, VectorQuery, VectorRecord, VectorRecordFilter, VectorRetrieverOptions, VectorSearchResult, VectorStore, VectorStoreStats, } from "./types";