@fllf/agent-sdk 0.1.2 → 0.1.3

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 (266) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/README.md +824 -198
  3. package/dist/agent/Agent.d.ts +16 -5
  4. package/dist/agent/Agent.d.ts.map +1 -1
  5. package/dist/agent/Agent.js +283 -2
  6. package/dist/agent/Agent.js.map +1 -1
  7. package/dist/agent/index.d.ts +1 -1
  8. package/dist/agent/index.d.ts.map +1 -1
  9. package/dist/agent/types.d.ts +27 -3
  10. package/dist/agent/types.d.ts.map +1 -1
  11. package/dist/config/config.d.ts +22 -3
  12. package/dist/config/config.d.ts.map +1 -1
  13. package/dist/config/config.js +194 -47
  14. package/dist/config/config.js.map +1 -1
  15. package/dist/config/index.d.ts +1 -1
  16. package/dist/config/index.d.ts.map +1 -1
  17. package/dist/errors.d.ts +74 -0
  18. package/dist/errors.d.ts.map +1 -0
  19. package/dist/errors.js +186 -0
  20. package/dist/errors.js.map +1 -0
  21. package/dist/executors/base-executor.d.ts +14 -0
  22. package/dist/executors/base-executor.d.ts.map +1 -0
  23. package/dist/executors/base-executor.js +31 -0
  24. package/dist/executors/base-executor.js.map +1 -0
  25. package/dist/executors/base.d.ts +36 -5
  26. package/dist/executors/base.d.ts.map +1 -1
  27. package/dist/executors/chat-request-builder.d.ts +10 -0
  28. package/dist/executors/chat-request-builder.d.ts.map +1 -0
  29. package/dist/executors/chat-request-builder.js +96 -0
  30. package/dist/executors/chat-request-builder.js.map +1 -0
  31. package/dist/executors/index.d.ts +4 -1
  32. package/dist/executors/index.d.ts.map +1 -1
  33. package/dist/executors/index.js +6 -1
  34. package/dist/executors/index.js.map +1 -1
  35. package/dist/executors/rag-executor.js +1 -1
  36. package/dist/executors/rag-executor.js.map +1 -1
  37. package/dist/executors/simple-chat-executor.d.ts +4 -2
  38. package/dist/executors/simple-chat-executor.d.ts.map +1 -1
  39. package/dist/executors/simple-chat-executor.js +59 -57
  40. package/dist/executors/simple-chat-executor.js.map +1 -1
  41. package/dist/executors/tool-calling-executor.d.ts +20 -2
  42. package/dist/executors/tool-calling-executor.d.ts.map +1 -1
  43. package/dist/executors/tool-calling-executor.js +189 -91
  44. package/dist/executors/tool-calling-executor.js.map +1 -1
  45. package/dist/history/base.d.ts +55 -2
  46. package/dist/history/base.d.ts.map +1 -1
  47. package/dist/history/base.js +49 -0
  48. package/dist/history/base.js.map +1 -1
  49. package/dist/history/compression.d.ts +49 -0
  50. package/dist/history/compression.d.ts.map +1 -0
  51. package/dist/history/compression.js +53 -0
  52. package/dist/history/compression.js.map +1 -0
  53. package/dist/history/context-window.d.ts +33 -0
  54. package/dist/history/context-window.d.ts.map +1 -0
  55. package/dist/history/context-window.js +68 -0
  56. package/dist/history/context-window.js.map +1 -0
  57. package/dist/history/in-memory.d.ts +6 -4
  58. package/dist/history/in-memory.d.ts.map +1 -1
  59. package/dist/history/in-memory.js +25 -39
  60. package/dist/history/in-memory.js.map +1 -1
  61. package/dist/history/index.d.ts +9 -2
  62. package/dist/history/index.d.ts.map +1 -1
  63. package/dist/history/index.js +18 -1
  64. package/dist/history/index.js.map +1 -1
  65. package/dist/history/postgres/index.d.ts +4 -0
  66. package/dist/history/postgres/index.d.ts.map +1 -0
  67. package/dist/history/postgres/index.js +20 -0
  68. package/dist/history/postgres/index.js.map +1 -0
  69. package/dist/history/postgres/postgres-message-history-store.d.ts +35 -0
  70. package/dist/history/postgres/postgres-message-history-store.d.ts.map +1 -0
  71. package/dist/history/postgres/postgres-message-history-store.js +195 -0
  72. package/dist/history/postgres/postgres-message-history-store.js.map +1 -0
  73. package/dist/history/postgres/schema.d.ts +18 -0
  74. package/dist/history/postgres/schema.d.ts.map +1 -0
  75. package/dist/history/postgres/schema.js +46 -0
  76. package/dist/history/postgres/schema.js.map +1 -0
  77. package/dist/history/postgres/sql.d.ts +29 -0
  78. package/dist/history/postgres/sql.d.ts.map +1 -0
  79. package/dist/history/postgres/sql.js +102 -0
  80. package/dist/history/postgres/sql.js.map +1 -0
  81. package/dist/history/postgres/types.d.ts +20 -0
  82. package/dist/history/postgres/types.d.ts.map +1 -0
  83. package/dist/history/postgres/types.js +3 -0
  84. package/dist/history/postgres/types.js.map +1 -0
  85. package/dist/history/tool-pairing.d.ts +11 -0
  86. package/dist/history/tool-pairing.d.ts.map +1 -0
  87. package/dist/history/tool-pairing.js +52 -0
  88. package/dist/history/tool-pairing.js.map +1 -0
  89. package/dist/index.d.ts +2 -0
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +2 -0
  92. package/dist/index.js.map +1 -1
  93. package/dist/llm/LLM.d.ts +1 -0
  94. package/dist/llm/LLM.d.ts.map +1 -1
  95. package/dist/llm/LLM.js +136 -26
  96. package/dist/llm/LLM.js.map +1 -1
  97. package/dist/llm/errors.d.ts +11 -1
  98. package/dist/llm/errors.d.ts.map +1 -1
  99. package/dist/llm/errors.js +50 -1
  100. package/dist/llm/errors.js.map +1 -1
  101. package/dist/llm/factory.d.ts +14 -2
  102. package/dist/llm/factory.d.ts.map +1 -1
  103. package/dist/llm/factory.js +48 -9
  104. package/dist/llm/factory.js.map +1 -1
  105. package/dist/llm/index.d.ts +8 -3
  106. package/dist/llm/index.d.ts.map +1 -1
  107. package/dist/llm/index.js +10 -1
  108. package/dist/llm/index.js.map +1 -1
  109. package/dist/llm/providers/anthropic.d.ts +14 -0
  110. package/dist/llm/providers/anthropic.d.ts.map +1 -0
  111. package/dist/llm/providers/anthropic.js +336 -0
  112. package/dist/llm/providers/anthropic.js.map +1 -0
  113. package/dist/llm/providers/openai-compatible.d.ts +7 -0
  114. package/dist/llm/providers/openai-compatible.d.ts.map +1 -1
  115. package/dist/llm/providers/openai-compatible.js +151 -47
  116. package/dist/llm/providers/openai-compatible.js.map +1 -1
  117. package/dist/llm/stream-accumulator.d.ts +17 -0
  118. package/dist/llm/stream-accumulator.d.ts.map +1 -0
  119. package/dist/llm/stream-accumulator.js +83 -0
  120. package/dist/llm/stream-accumulator.js.map +1 -0
  121. package/dist/llm/tool-arguments.d.ts +6 -0
  122. package/dist/llm/tool-arguments.d.ts.map +1 -0
  123. package/dist/llm/tool-arguments.js +20 -0
  124. package/dist/llm/tool-arguments.js.map +1 -0
  125. package/dist/llm/types.d.ts +76 -4
  126. package/dist/llm/types.d.ts.map +1 -1
  127. package/dist/messages/content.d.ts +36 -0
  128. package/dist/messages/content.d.ts.map +1 -0
  129. package/dist/messages/content.js +70 -0
  130. package/dist/messages/content.js.map +1 -0
  131. package/dist/messages/index.d.ts +4 -2
  132. package/dist/messages/index.d.ts.map +1 -1
  133. package/dist/messages/index.js +10 -1
  134. package/dist/messages/index.js.map +1 -1
  135. package/dist/messages/message.d.ts +11 -9
  136. package/dist/messages/message.d.ts.map +1 -1
  137. package/dist/messages/message.js +69 -4
  138. package/dist/messages/message.js.map +1 -1
  139. package/dist/messages/types.d.ts +12 -0
  140. package/dist/messages/types.d.ts.map +1 -1
  141. package/dist/observability/collecting-observer.d.ts +8 -0
  142. package/dist/observability/collecting-observer.d.ts.map +1 -0
  143. package/dist/observability/collecting-observer.js +15 -0
  144. package/dist/observability/collecting-observer.js.map +1 -0
  145. package/dist/observability/index.d.ts +1 -0
  146. package/dist/observability/index.d.ts.map +1 -1
  147. package/dist/observability/index.js +3 -1
  148. package/dist/observability/index.js.map +1 -1
  149. package/dist/observability/observer.d.ts.map +1 -1
  150. package/dist/observability/observer.js +14 -1
  151. package/dist/observability/observer.js.map +1 -1
  152. package/dist/observability/types.d.ts +16 -1
  153. package/dist/observability/types.d.ts.map +1 -1
  154. package/dist/rag/chunking/auto-chunker.d.ts +7 -0
  155. package/dist/rag/chunking/auto-chunker.d.ts.map +1 -1
  156. package/dist/rag/chunking/auto-chunker.js +13 -0
  157. package/dist/rag/chunking/auto-chunker.js.map +1 -1
  158. package/dist/rag/chunking/chunker.d.ts.map +1 -1
  159. package/dist/rag/chunking/chunker.js +29 -5
  160. package/dist/rag/chunking/chunker.js.map +1 -1
  161. package/dist/rag/chunking/index.d.ts +2 -0
  162. package/dist/rag/chunking/index.d.ts.map +1 -1
  163. package/dist/rag/chunking/index.js +2 -0
  164. package/dist/rag/chunking/index.js.map +1 -1
  165. package/dist/rag/chunking/markdown-chunker.d.ts.map +1 -1
  166. package/dist/rag/chunking/markdown-chunker.js.map +1 -1
  167. package/dist/rag/chunking/qa-pair-chunker.d.ts +23 -0
  168. package/dist/rag/chunking/qa-pair-chunker.d.ts.map +1 -0
  169. package/dist/rag/chunking/qa-pair-chunker.js +162 -0
  170. package/dist/rag/chunking/qa-pair-chunker.js.map +1 -0
  171. package/dist/rag/chunking/semantic-chunker.d.ts +19 -0
  172. package/dist/rag/chunking/semantic-chunker.d.ts.map +1 -0
  173. package/dist/rag/chunking/semantic-chunker.js +291 -0
  174. package/dist/rag/chunking/semantic-chunker.js.map +1 -0
  175. package/dist/rag/embeddings/embedder.d.ts.map +1 -1
  176. package/dist/rag/embeddings/embedder.js +6 -0
  177. package/dist/rag/embeddings/embedder.js.map +1 -1
  178. package/dist/rag/generation/context-builder.d.ts +7 -0
  179. package/dist/rag/generation/context-builder.d.ts.map +1 -1
  180. package/dist/rag/generation/context-builder.js +4 -1
  181. package/dist/rag/generation/context-builder.js.map +1 -1
  182. package/dist/rag/ingestion/metadata.d.ts +6 -1
  183. package/dist/rag/ingestion/metadata.d.ts.map +1 -1
  184. package/dist/rag/ingestion/metadata.js +6 -2
  185. package/dist/rag/ingestion/metadata.js.map +1 -1
  186. package/dist/rag/pipeline.d.ts.map +1 -1
  187. package/dist/rag/pipeline.js +34 -11
  188. package/dist/rag/pipeline.js.map +1 -1
  189. package/dist/rag/retrieval/index.d.ts +1 -0
  190. package/dist/rag/retrieval/index.d.ts.map +1 -1
  191. package/dist/rag/retrieval/index.js +1 -0
  192. package/dist/rag/retrieval/index.js.map +1 -1
  193. package/dist/rag/retrieval/parent-child-expanding-retriever.d.ts +31 -0
  194. package/dist/rag/retrieval/parent-child-expanding-retriever.d.ts.map +1 -0
  195. package/dist/rag/retrieval/parent-child-expanding-retriever.js +194 -0
  196. package/dist/rag/retrieval/parent-child-expanding-retriever.js.map +1 -0
  197. package/dist/rag/stores/in-memory-keyword-store.d.ts.map +1 -1
  198. package/dist/rag/stores/in-memory-keyword-store.js +3 -8
  199. package/dist/rag/stores/in-memory-keyword-store.js.map +1 -1
  200. package/dist/rag/stores/keyword-tokenizer.d.ts +4 -0
  201. package/dist/rag/stores/keyword-tokenizer.d.ts.map +1 -0
  202. package/dist/rag/stores/keyword-tokenizer.js +113 -0
  203. package/dist/rag/stores/keyword-tokenizer.js.map +1 -0
  204. package/dist/rag/stores/postgres/pg-vector-store.d.ts.map +1 -1
  205. package/dist/rag/stores/postgres/pg-vector-store.js +21 -8
  206. package/dist/rag/stores/postgres/pg-vector-store.js.map +1 -1
  207. package/dist/rag/stores/postgres/postgres-document-store.d.ts.map +1 -1
  208. package/dist/rag/stores/postgres/postgres-document-store.js +26 -13
  209. package/dist/rag/stores/postgres/postgres-document-store.js.map +1 -1
  210. package/dist/rag/stores/postgres/postgres-keyword-store.d.ts.map +1 -1
  211. package/dist/rag/stores/postgres/postgres-keyword-store.js +43 -43
  212. package/dist/rag/stores/postgres/postgres-keyword-store.js.map +1 -1
  213. package/dist/rag/stores/postgres/sql.d.ts +22 -0
  214. package/dist/rag/stores/postgres/sql.d.ts.map +1 -1
  215. package/dist/rag/stores/postgres/sql.js +42 -0
  216. package/dist/rag/stores/postgres/sql.js.map +1 -1
  217. package/dist/rag/stores/types.d.ts +5 -0
  218. package/dist/rag/stores/types.d.ts.map +1 -1
  219. package/dist/rag/types.d.ts +6 -0
  220. package/dist/rag/types.d.ts.map +1 -1
  221. package/dist/testing/agent.d.ts +11 -0
  222. package/dist/testing/agent.d.ts.map +1 -0
  223. package/dist/testing/agent.js +45 -0
  224. package/dist/testing/agent.js.map +1 -0
  225. package/dist/testing/history-contract.d.ts +12 -0
  226. package/dist/testing/history-contract.d.ts.map +1 -0
  227. package/dist/testing/history-contract.js +111 -0
  228. package/dist/testing/history-contract.js.map +1 -0
  229. package/dist/testing/index.d.ts +11 -0
  230. package/dist/testing/index.d.ts.map +1 -0
  231. package/dist/testing/index.js +16 -0
  232. package/dist/testing/index.js.map +1 -0
  233. package/dist/testing/models.d.ts +34 -0
  234. package/dist/testing/models.d.ts.map +1 -0
  235. package/dist/testing/models.js +74 -0
  236. package/dist/testing/models.js.map +1 -0
  237. package/dist/testing/tool-schema.d.ts +6 -0
  238. package/dist/testing/tool-schema.d.ts.map +1 -0
  239. package/dist/testing/tool-schema.js +29 -0
  240. package/dist/testing/tool-schema.js.map +1 -0
  241. package/dist/testing/tools.d.ts +21 -0
  242. package/dist/testing/tools.d.ts.map +1 -0
  243. package/dist/testing/tools.js +43 -0
  244. package/dist/testing/tools.js.map +1 -0
  245. package/dist/tools/base.d.ts +38 -7
  246. package/dist/tools/base.d.ts.map +1 -1
  247. package/dist/tools/base.js +238 -11
  248. package/dist/tools/base.js.map +1 -1
  249. package/dist/tools/builtin/advancedSearchTool.d.ts.map +1 -1
  250. package/dist/tools/builtin/advancedSearchTool.js +30 -4
  251. package/dist/tools/builtin/advancedSearchTool.js.map +1 -1
  252. package/dist/tools/builtin/ragSearchTool.d.ts +6 -3
  253. package/dist/tools/builtin/ragSearchTool.d.ts.map +1 -1
  254. package/dist/tools/builtin/ragSearchTool.js +8 -6
  255. package/dist/tools/builtin/ragSearchTool.js.map +1 -1
  256. package/dist/tools/executor.d.ts +30 -2
  257. package/dist/tools/executor.d.ts.map +1 -1
  258. package/dist/tools/executor.js +83 -15
  259. package/dist/tools/executor.js.map +1 -1
  260. package/dist/tools/index.d.ts +3 -1
  261. package/dist/tools/index.d.ts.map +1 -1
  262. package/dist/tools/registry.d.ts +15 -3
  263. package/dist/tools/registry.d.ts.map +1 -1
  264. package/dist/tools/registry.js +21 -2
  265. package/dist/tools/registry.js.map +1 -1
  266. package/package.json +58 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,169 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package should be recorded here.
4
+
5
+ This project follows semver. While the package is below `1.0.0`, stable
6
+ integration APIs should remain compatible whenever practical. Experimental and
7
+ low-level extension points may change in minor versions when the change is
8
+ documented here.
9
+
10
+ ## Unreleased
11
+
12
+ ## 0.1.3 - 2026-07-05
13
+
14
+ ### Breaking changes
15
+
16
+ - `Message.content` / `ChatMessage.content` widened from `string` to
17
+ `MessageContent` (`string | ContentBlock[]`, text/image blocks). Plain string
18
+ content keeps working; code that assumed `content` is always a string should
19
+ use `Message.text` or `contentToText()`.
20
+ - `ToolExecutor.execute()` now returns a structured `ToolCallOutcome`
21
+ (`{ toolCallId, toolName, content, isError }`) instead of a plain string.
22
+ - `ChatStreamChunk.toolCallDelta: unknown` replaced with typed
23
+ `toolCallDeltas: ToolCallDelta[]`; chunks can now carry `finishReason` and
24
+ final `usage`.
25
+ - `ToolCallingExecutor` defaults to `onMaxIterations: 'finalize'`: when the
26
+ iteration budget runs out it issues one final no-tools request instead of
27
+ throwing. Pass `{ onMaxIterations: 'throw' }` for the previous behavior; in
28
+ both modes the executed trajectory is persisted to history.
29
+ - `Config.temperature` no longer defaults to `0.7`. When unset, no temperature
30
+ is sent and the provider/model default applies.
31
+ - Default tool result serialization now uses `JSON.stringify` for non-string
32
+ results instead of `String(result)`.
33
+ - The official `openai` provider sends `max_completion_tokens` instead of the
34
+ deprecated `max_tokens` (other OpenAI-compatible providers keep
35
+ `max_tokens`), and streaming requests set
36
+ `stream_options: { include_usage: true }`.
37
+ - RAG: `RagSearchTool` no longer exposes `tenantId` / `knowledgeBaseId` / `acl`
38
+ as model-fillable parameters; they must come from server-side
39
+ `defaultRetrieveOptions`. RAG document ids no longer include the content
40
+ checksum, and `answer()` no longer forwards retrieval `minScore` to the
41
+ context builder (use the new `minFusedScore`).
42
+
43
+ ### Added
44
+
45
+ - Anthropic provider (`provider: 'anthropic'`, env: `ANTHROPIC_API_KEY` /
46
+ `ANTHROPIC_MODEL` / `ANTHROPIC_BASE_URL`, default model `claude-opus-4-8`):
47
+ Messages API mapping incl. multimodal content, tool_use/tool_result with
48
+ `is_error`, streaming SSE → typed chunks, structured output via
49
+ `output_config.format`, prompt-cache usage fields. `autoDetect` falls back
50
+ to Anthropic when only `ANTHROPIC_API_KEY` is set.
51
+ - Provider-neutral tool schema: `ToolDefinition` replaces the OpenAI-shaped
52
+ `ChatToolSchema` in `ChatRequest.tools` (`Tool.toToolSchema()` /
53
+ `ToolRegistry.toToolSchemas()`; the OpenAI-shaped methods remain as
54
+ deprecated wrappers). `toolChoice` supports forcing a specific tool
55
+ (`{ type: 'tool', name }`); `ChatRequest.reasoning.effort` maps to
56
+ Anthropic `output_config.effort` / OpenAI `reasoning_effort`;
57
+ `ChatMessage.cacheControl: 'ephemeral'` marks prompt-cache breakpoints;
58
+ responses and stream chunks expose `reasoning` / `reasoningDelta` and
59
+ `cacheCreationPromptTokens`.
60
+ - Optimistic concurrency for message history: `getVersion()` +
61
+ `addMany(messages, { expectedVersion })` with
62
+ `HistoryVersionConflictError` (CAS retry pattern for multi-instance
63
+ deployments), plus a reference `PostgresMessageHistoryStore` working with
64
+ any `query()` client, including schema SQL and windowed reads.
65
+ - Multimodal message content: `ContentBlock` (`textBlock()`, `imageUrlBlock()`,
66
+ `imageBase64Block()`), `contentToText()`, and user-message image mapping in
67
+ OpenAI-compatible providers. `Agent.run()` / `Agent.stream()` accept
68
+ `MessageContent` input.
69
+ - Streaming tool calling: `ToolCallingExecutor` implements
70
+ `StreamingAgentExecutor`, emitting `agent:text_delta`, typed
71
+ `agent:tool_call` / `agent:tool_result` events, and falling back to
72
+ non-streaming models transparently. `ChatStreamAccumulator` aggregates
73
+ chunks into a full `ChatResponse`.
74
+ - Parallel tool execution: multiple tool calls in one model turn run
75
+ concurrently via `ToolExecutor.executeMany()`, with result order preserved.
76
+ - Context window management: `Config.maxInputTokens` (env: `MAX_INPUT_TOKENS`)
77
+ enables token-aware history truncation with a pluggable `TokenEstimator`;
78
+ `truncateToTokenBudget()` and `repairLeadingToolContext()` are exported.
79
+ `MessageHistory.get({ limit })` now repairs orphan tool messages the same
80
+ way `addMany()` overflow does.
81
+ - Reliability: transport errors without an HTTP status (`ECONNRESET`,
82
+ `fetch failed`, undici timeouts, …) normalize as retryable provider errors;
83
+ `llm:retry` observability events expose retry attempts.
84
+ - Cost observability: `llm:end` and `agent:end` events carry token `usage`
85
+ (including `cachedPromptTokens` when reported); `ChatResponse` and stream
86
+ chunks expose `finishReason`.
87
+ - Tool errors returned to the model are flagged with `isError` on the tool
88
+ message metadata, and unknown-tool feedback lists the registered tools.
89
+ - RAG: `replaceExisting` re-ingestion now cleans up prior versions by stable
90
+ document id and skips unchanged documents (`skippedDocumentIds`); pgvector
91
+ search restores HNSW-index-friendly `ORDER BY`; Postgres stores upsert in
92
+ multi-row batches (≤500 rows).
93
+
94
+ ### Added (previous)
95
+
96
+ - Documented stable integration APIs, lower-level extension points, API
97
+ compatibility expectations, and the release checklist.
98
+ - Added `npm run pack:dry-run` for pre-publish package inspection.
99
+ - Added stable SDK error classes for Agent, Tool, History, and Config layers,
100
+ including code/retryability metadata.
101
+ - Added Tool runtime controls for execution context, timeout, abort propagation,
102
+ error mode, and result serialization.
103
+ - Added observability event levels, optional span fields, observer redaction
104
+ hooks, and `CollectingObserver`.
105
+ - Added `MessageJSON`, `Message.fromJSON()`, and `reviveMessage()` as the
106
+ documented message persistence contract.
107
+ - Added custom provider, history store, executor, observer, and production
108
+ factory examples.
109
+ - Added `ModelProviderRegistry` and `LLM` provider registry injection for scoped
110
+ provider registration.
111
+ - Added shared `buildChatMessages()` and `buildChatRequest()` helpers for custom
112
+ executor implementations.
113
+ - Added `MessageHistory.get({ limit, before })` window reads and the
114
+ `applyMessageHistoryWindow()` helper.
115
+ - Added `BaseExecutor` and type-level streaming executor contracts through
116
+ `StreamingAgentExecutor` and `AgentStreamEvent`.
117
+ - Added downstream testing helpers: `ScriptedChatModel`, `FakeChatModel`,
118
+ `FakeTool`, `createTestAgent()`, and
119
+ `assertMessageHistoryStoreContract()`.
120
+ - Added tool schema snapshot helpers for downstream tests.
121
+ - Added Tool permission policies through `canExecute()` and
122
+ `ToolPermissionError`.
123
+ - Added `Agent` run option validation and injectable `runIdFactory`.
124
+ - Added runtime provider capability checks for tool calling, structured output,
125
+ and streaming through `LLMUnsupportedCapabilityError`.
126
+ - Added `Config.fromEnv()` diagnostics through `envWarnings`, `onWarning`, and
127
+ strict `ConfigError` rejection.
128
+ - Added stable package subpath exports for agent, config, executors, history,
129
+ llm, messages, observability, rag, testing, and tools modules.
130
+ - Added a stable `errors` subpath export for typed SDK error handling.
131
+ - Added `AgentLifecycleHooks` for `beforeRun`, `afterRun`, and `onRunError`
132
+ integration around `Agent.run()`.
133
+ - Added constructor validation for `Config` and `LLM` runtime options.
134
+ - Added `npm run test:exports` to verify root and subpath package exports after
135
+ build.
136
+ - Added simple-chat `Agent.stream()` runtime support through
137
+ `StreamingAgentExecutor`, with default support in `SimpleChatExecutor`.
138
+ - Added `ToolConfigurationError` and constructor-time validation for tool
139
+ names, descriptions, schemas, timeout, error mode, permission checker, and
140
+ result serializer.
141
+ - Added offline `streaming-chat` and `tool-error-policy` examples.
142
+ - Added explicit `ToolRegistry` duplicate-name handling with fail-fast defaults
143
+ and opt-in replacement for compatibility adapters.
144
+ - Added RAG chunking improvements for Chinese and mixed-language boundary
145
+ handling, including stable overlap behavior when text has no whitespace.
146
+ - Added shared sparse keyword tokenization for in-memory and Postgres keyword
147
+ stores, including technical identifier splitting, Chinese n-grams, and
148
+ `title` / `headingPath` indexing.
149
+ - Added `ParentChildExpandingRetriever` for expanding child chunk hits into
150
+ parent or neighboring context chunks.
151
+ - Added `QaPairChunker` for FAQ-style question/answer documents.
152
+ - Added experimental `SemanticChunker` for optional embedding-based semantic
153
+ chunking.
154
+
155
+ ### Changed
156
+
157
+ - Replaced non-RAG source-level bare runtime `Error` throws with typed SDK/LLM
158
+ errors where they are part of public execution flow.
159
+ - Sparse RAG keyword indexes now use expanded token terms. Existing persistent
160
+ keyword indexes should be rebuilt or documents should be re-ingested after
161
+ upgrading.
162
+
163
+ ### Compatibility notes
164
+
165
+ - Breaking changes must include migration notes in this file before release.
166
+ - Experimental API changes should name the affected exports and expected
167
+ replacement path.
168
+ - `SemanticChunker` is experimental and must be selected explicitly; it is not
169
+ used by `AutoChunker` by default.