@mcp-abap-adt/llm-agent-server-libs 26.0.0 → 28.0.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 (158) hide show
  1. package/dist/builders/controller-skill-pipeline-builder.d.ts +6 -5
  2. package/dist/builders/controller-skill-pipeline-builder.d.ts.map +1 -1
  3. package/dist/builders/controller-skill-pipeline-builder.js +49 -54
  4. package/dist/builders/controller-skill-pipeline-builder.js.map +1 -1
  5. package/dist/factories/controller-factory.d.ts +13 -10
  6. package/dist/factories/controller-factory.d.ts.map +1 -1
  7. package/dist/factories/controller-factory.js +33 -12
  8. package/dist/factories/controller-factory.js.map +1 -1
  9. package/dist/generated/version.d.ts +1 -1
  10. package/dist/generated/version.js +1 -1
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/pipelines/controller-subagents.d.ts +11 -0
  16. package/dist/pipelines/controller-subagents.d.ts.map +1 -0
  17. package/dist/pipelines/controller-subagents.js +77 -0
  18. package/dist/pipelines/controller-subagents.js.map +1 -0
  19. package/dist/pipelines/controller.d.ts +11 -10
  20. package/dist/pipelines/controller.d.ts.map +1 -1
  21. package/dist/pipelines/controller.js +14 -65
  22. package/dist/pipelines/controller.js.map +1 -1
  23. package/dist/pipelines/coordinator-resolvers.d.ts +6 -11
  24. package/dist/pipelines/coordinator-resolvers.d.ts.map +1 -1
  25. package/dist/pipelines/coordinator-resolvers.js +7 -17
  26. package/dist/pipelines/coordinator-resolvers.js.map +1 -1
  27. package/dist/pipelines/dag.d.ts +9 -9
  28. package/dist/pipelines/dag.d.ts.map +1 -1
  29. package/dist/pipelines/dag.js +11 -22
  30. package/dist/pipelines/dag.js.map +1 -1
  31. package/dist/pipelines/flat.d.ts +4 -7
  32. package/dist/pipelines/flat.d.ts.map +1 -1
  33. package/dist/pipelines/flat.js +3 -8
  34. package/dist/pipelines/flat.js.map +1 -1
  35. package/dist/pipelines/linear.d.ts +8 -10
  36. package/dist/pipelines/linear.d.ts.map +1 -1
  37. package/dist/pipelines/linear.js +18 -11
  38. package/dist/pipelines/linear.js.map +1 -1
  39. package/dist/pipelines/parsers.d.ts +0 -3
  40. package/dist/pipelines/parsers.d.ts.map +1 -1
  41. package/dist/pipelines/parsers.js +4 -19
  42. package/dist/pipelines/parsers.js.map +1 -1
  43. package/dist/pipelines/server-context.d.ts +0 -5
  44. package/dist/pipelines/server-context.d.ts.map +1 -1
  45. package/dist/pipelines/server-context.js.map +1 -1
  46. package/dist/pipelines/stepper.d.ts +5 -4
  47. package/dist/pipelines/stepper.d.ts.map +1 -1
  48. package/dist/pipelines/stepper.js +5 -4
  49. package/dist/pipelines/stepper.js.map +1 -1
  50. package/dist/smart-agent/build-dag-coordinator-deps.d.ts +11 -22
  51. package/dist/smart-agent/build-dag-coordinator-deps.d.ts.map +1 -1
  52. package/dist/smart-agent/build-dag-coordinator-deps.js +21 -78
  53. package/dist/smart-agent/build-dag-coordinator-deps.js.map +1 -1
  54. package/dist/smart-agent/build-stepper-root.d.ts.map +1 -1
  55. package/dist/smart-agent/build-stepper-root.js +0 -1
  56. package/dist/smart-agent/build-stepper-root.js.map +1 -1
  57. package/dist/smart-agent/config-validator.d.ts +8 -1
  58. package/dist/smart-agent/config-validator.d.ts.map +1 -1
  59. package/dist/smart-agent/config-validator.js +200 -62
  60. package/dist/smart-agent/config-validator.js.map +1 -1
  61. package/dist/smart-agent/config.d.ts +7 -7
  62. package/dist/smart-agent/config.d.ts.map +1 -1
  63. package/dist/smart-agent/config.js +24 -11
  64. package/dist/smart-agent/config.js.map +1 -1
  65. package/dist/smart-agent/controller/types.d.ts +22 -15
  66. package/dist/smart-agent/controller/types.d.ts.map +1 -1
  67. package/dist/smart-agent/controller/types.js.map +1 -1
  68. package/dist/smart-agent/http/config-route-handler.d.ts +2 -0
  69. package/dist/smart-agent/http/config-route-handler.d.ts.map +1 -1
  70. package/dist/smart-agent/http/config-route-handler.js +20 -0
  71. package/dist/smart-agent/http/config-route-handler.js.map +1 -1
  72. package/dist/smart-agent/llm/role-llm-resolver.d.ts +23 -11
  73. package/dist/smart-agent/llm/role-llm-resolver.d.ts.map +1 -1
  74. package/dist/smart-agent/llm/role-llm-resolver.js +65 -37
  75. package/dist/smart-agent/llm/role-llm-resolver.js.map +1 -1
  76. package/dist/smart-agent/llm-config-map.d.ts +9 -1
  77. package/dist/smart-agent/llm-config-map.d.ts.map +1 -1
  78. package/dist/smart-agent/llm-config-map.js +27 -5
  79. package/dist/smart-agent/llm-config-map.js.map +1 -1
  80. package/dist/smart-agent/pipeline-settings.d.ts +50 -0
  81. package/dist/smart-agent/pipeline-settings.d.ts.map +1 -0
  82. package/dist/smart-agent/pipeline-settings.js +174 -0
  83. package/dist/smart-agent/pipeline-settings.js.map +1 -0
  84. package/dist/smart-agent/pipeline.d.ts +3 -63
  85. package/dist/smart-agent/pipeline.d.ts.map +1 -1
  86. package/dist/smart-agent/pipeline.js +3 -2
  87. package/dist/smart-agent/pipeline.js.map +1 -1
  88. package/dist/smart-agent/rag-config.d.ts +155 -0
  89. package/dist/smart-agent/rag-config.d.ts.map +1 -0
  90. package/dist/smart-agent/rag-config.js +62 -0
  91. package/dist/smart-agent/rag-config.js.map +1 -0
  92. package/dist/smart-agent/resolve-agent-embedder.d.ts +11 -10
  93. package/dist/smart-agent/resolve-agent-embedder.d.ts.map +1 -1
  94. package/dist/smart-agent/resolve-agent-embedder.js +37 -36
  95. package/dist/smart-agent/resolve-agent-embedder.js.map +1 -1
  96. package/dist/smart-agent/resolve-config-sections.d.ts +1 -1
  97. package/dist/smart-agent/resolve-config-sections.d.ts.map +1 -1
  98. package/dist/smart-agent/resolve-config-sections.js +124 -30
  99. package/dist/smart-agent/resolve-config-sections.js.map +1 -1
  100. package/dist/smart-agent/select-pipeline-plugin.d.ts +8 -0
  101. package/dist/smart-agent/select-pipeline-plugin.d.ts.map +1 -0
  102. package/dist/smart-agent/select-pipeline-plugin.js +26 -0
  103. package/dist/smart-agent/select-pipeline-plugin.js.map +1 -0
  104. package/dist/smart-agent/session-lifecycle/index.d.ts +38 -4
  105. package/dist/smart-agent/session-lifecycle/index.d.ts.map +1 -1
  106. package/dist/smart-agent/session-lifecycle/index.js +11 -1
  107. package/dist/smart-agent/session-lifecycle/index.js.map +1 -1
  108. package/dist/smart-agent/session-lifecycle/session-rag-registry.d.ts +39 -0
  109. package/dist/smart-agent/session-lifecycle/session-rag-registry.d.ts.map +1 -0
  110. package/dist/smart-agent/session-lifecycle/session-rag-registry.js +109 -0
  111. package/dist/smart-agent/session-lifecycle/session-rag-registry.js.map +1 -0
  112. package/dist/smart-agent/skill-plugins-config.d.ts +3 -2
  113. package/dist/smart-agent/skill-plugins-config.d.ts.map +1 -1
  114. package/dist/smart-agent/skill-plugins-config.js +12 -1
  115. package/dist/smart-agent/skill-plugins-config.js.map +1 -1
  116. package/dist/smart-agent/skill-plugins-host-factory.d.ts +9 -0
  117. package/dist/smart-agent/skill-plugins-host-factory.d.ts.map +1 -1
  118. package/dist/smart-agent/skill-plugins-host-factory.js +12 -6
  119. package/dist/smart-agent/skill-plugins-host-factory.js.map +1 -1
  120. package/dist/smart-agent/smart-server.d.ts +90 -78
  121. package/dist/smart-agent/smart-server.d.ts.map +1 -1
  122. package/dist/smart-agent/smart-server.js +201 -152
  123. package/dist/smart-agent/smart-server.js.map +1 -1
  124. package/dist/smart-agent/worker-llm.d.ts +18 -0
  125. package/dist/smart-agent/worker-llm.d.ts.map +1 -0
  126. package/dist/smart-agent/worker-llm.js +59 -0
  127. package/dist/smart-agent/worker-llm.js.map +1 -0
  128. package/dist/smart-agent/workers/worker-registry.d.ts +6 -14
  129. package/dist/smart-agent/workers/worker-registry.d.ts.map +1 -1
  130. package/dist/smart-agent/workers/worker-registry.js +2 -11
  131. package/dist/smart-agent/workers/worker-registry.js.map +1 -1
  132. package/dist/smart-agent/yaml-loader.d.ts +1 -1
  133. package/dist/smart-agent/yaml-loader.d.ts.map +1 -1
  134. package/dist/smart-agent/yaml-loader.js +20 -17
  135. package/dist/smart-agent/yaml-loader.js.map +1 -1
  136. package/package.json +9 -8
  137. package/dist/smart-agent/mcp/mcp-content.d.ts +0 -19
  138. package/dist/smart-agent/mcp/mcp-content.d.ts.map +0 -1
  139. package/dist/smart-agent/mcp/mcp-content.js +0 -31
  140. package/dist/smart-agent/mcp/mcp-content.js.map +0 -1
  141. package/dist/smart-agent/mcp/require-mcp-timeout.d.ts +0 -20
  142. package/dist/smart-agent/mcp/require-mcp-timeout.d.ts.map +0 -1
  143. package/dist/smart-agent/mcp/require-mcp-timeout.js +0 -23
  144. package/dist/smart-agent/mcp/require-mcp-timeout.js.map +0 -1
  145. package/dist/smart-agent/mcp-readiness-monitor.d.ts +0 -38
  146. package/dist/smart-agent/mcp-readiness-monitor.d.ts.map +0 -1
  147. package/dist/smart-agent/mcp-readiness-monitor.js +0 -81
  148. package/dist/smart-agent/mcp-readiness-monitor.js.map +0 -1
  149. package/dist/smart-agent/mcp-readiness-registry.d.ts +0 -37
  150. package/dist/smart-agent/mcp-readiness-registry.d.ts.map +0 -1
  151. package/dist/smart-agent/mcp-readiness-registry.js +0 -55
  152. package/dist/smart-agent/mcp-readiness-registry.js.map +0 -1
  153. package/dist/smart-agent/skill-plugins-config.test.d.ts +0 -2
  154. package/dist/smart-agent/skill-plugins-config.test.d.ts.map +0 -1
  155. package/dist/smart-agent/skill-plugins-config.test.js.map +0 -1
  156. package/dist/smart-agent/skill-plugins-host-factory.test.d.ts +0 -2
  157. package/dist/smart-agent/skill-plugins-host-factory.test.d.ts.map +0 -1
  158. package/dist/smart-agent/skill-plugins-host-factory.test.js.map +0 -1
@@ -1,71 +1,11 @@
1
1
  /**
2
2
  * Pipeline configuration types for SmartServer.
3
3
  *
4
- * This module defines the YAML-driven pipeline config types.
5
- * Provider resolution is delegated to `providers.ts`.
4
+ * The legacy `PipelineConfig` shape is refused at load (assertNoLegacyPipelineConfig)
5
+ * and read by nothing; what is left of it here is kept only until its remaining
6
+ * members are retired with it.
6
7
  */
7
- import type { SapAICoreCredentials } from '@mcp-abap-adt/sap-aicore-llm';
8
- export interface PipelineLlmProviderConfig {
9
- provider: 'deepseek' | 'openai' | 'anthropic' | 'sap-ai-sdk' | 'ollama';
10
- /** API key. Required for openai/anthropic/deepseek; optional for sap-ai-sdk. */
11
- apiKey?: string;
12
- /** Custom base URL for OpenAI-compatible endpoints (Azure OpenAI, Ollama, vLLM, etc.). */
13
- baseURL?: string;
14
- model?: string;
15
- temperature?: number;
16
- /** Maximum number of tokens in the LLM response. */
17
- maxTokens?: number;
18
- /** SAP AI Core resource group (used when provider is 'sap-ai-sdk') */
19
- resourceGroup?: string;
20
- /** Programmatic OAuth2 credentials for SAP AI Core (bypasses AICORE_SERVICE_KEY env var) */
21
- credentials?: SapAICoreCredentials;
22
- /** When false, streamChat() is replaced with chat(). Default: true. */
23
- streaming?: boolean;
24
- }
25
- export interface PipelineRagStoreConfig {
26
- /** 'in-memory' | 'qdrant' | 'hana-vector' | 'pg-vector'. */
27
- type?: 'in-memory' | 'qdrant' | 'hana-vector' | 'pg-vector';
28
- /**
29
- * Embedder name — resolved from the embedder factory registry.
30
- * Built-in: 'ollama', 'openai', 'sap-ai-core'. Consumers can register custom factories.
31
- * When omitted, defaults to 'ollama' for stores that require one.
32
- */
33
- embedder?: string;
34
- /** Base URL for embedding service or Qdrant server */
35
- url?: string;
36
- /** API key (for openai type or Qdrant auth) */
37
- apiKey?: string;
38
- /** Embedding model name */
39
- model?: string;
40
- /** Collection / table name (required for qdrant, hana-vector, pg-vector) */
41
- collectionName?: string;
42
- /** Cosine similarity dedup threshold. Default: 0.92 */
43
- dedupThreshold?: number;
44
- /** Weight for vector search (0..1). Default: 0.7 */
45
- vectorWeight?: number;
46
- /** Weight for keyword search (0..1). Default: 0.3 */
47
- keywordWeight?: number;
48
- /** Per-request timeout for embedding calls in milliseconds. Default: 30 000 */
49
- timeoutMs?: number;
50
- /** SAP AI Core resource group (used when embedder is 'sap-ai-core' / 'sap-aicore'). */
51
- resourceGroup?: string;
52
- /**
53
- * SAP AI Core scenario for the embedding model deployment.
54
- * `'orchestration'` (default) uses the SAP SDK; `'foundation-models'` calls the REST inference API.
55
- */
56
- scenario?: 'orchestration' | 'foundation-models';
57
- }
58
8
  export interface PipelineConfig {
59
- llm?: {
60
- /** Primary LLM for the tool-call loop. */
61
- main: PipelineLlmProviderConfig;
62
- /** Optional helper LLM for summarization and translation. */
63
- helper?: PipelineLlmProviderConfig;
64
- /** LLM used by the intent classifier. If absent, main config is reused at 0.1 temp. */
65
- classifier?: PipelineLlmProviderConfig;
66
- };
67
- /** RAG stores keyed by consumer-defined names. */
68
- rag?: Record<string, PipelineRagStoreConfig>;
69
9
  /** One or more MCP servers to connect to simultaneously. */
70
10
  mcp?: Array<{
71
11
  type: 'http' | 'stdio';
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/smart-agent/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAMzE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,CAAC;IACxE,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4FAA4F;IAC5F,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,uEAAuE;IACvE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,s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AM,CAAC,CAAC;KAClC,CAAC,CAAC;IAIH;;;OAGG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,8BAA8B,EAAE,eAAe,EAAE,CAAC;CACnE"}
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/smart-agent/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,GAAG,CAAC,EAAE,KAAK,CAAC;QACV,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC,CAAC;IAIH;;;OAGG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,8BAA8B,EAAE,eAAe,EAAE,CAAC;CACnE"}
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Pipeline configuration types for SmartServer.
3
3
  *
4
- * This module defines the YAML-driven pipeline config types.
5
- * Provider resolution is delegated to `providers.ts`.
4
+ * The legacy `PipelineConfig` shape is refused at load (assertNoLegacyPipelineConfig)
5
+ * and read by nothing; what is left of it here is kept only until its remaining
6
+ * members are retired with it.
6
7
  */
7
8
  export {};
8
9
  //# sourceMappingURL=pipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/smart-agent/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/smart-agent/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * The serializable RAG configuration: a STORE and an EMBEDDER, two independently
3
+ * authenticated targets, each with its own `credentialRef` (spec §4.6.4). The flat
4
+ * shape this replaces held both at once, so `url` meant Qdrant's address or Ollama's
5
+ * depending on its neighbours and no single reference could say which account it
6
+ * named.
7
+ *
8
+ * `credentialRef` is a NAME the composition root resolves — never a value.
9
+ */
10
+ import type { IEmbedder } from '@mcp-abap-adt/llm-agent';
11
+ /**
12
+ * The in-memory store. The search knobs live here because this is the only store
13
+ * that ever read them (VectorRag with an embedder, InMemoryRag without); Qdrant,
14
+ * pgvector and HANA never did. `collectionName` becomes VectorRag's namespace.
15
+ * `credentialRef` authenticates nothing here: it is declared so a composition root
16
+ * can destructure it off any arm and refuse it on this one (§4.6.4's reference
17
+ * `makeRag` does exactly that, and does not compile without the member).
18
+ */
19
+ export interface InMemoryStoreConfig {
20
+ type: 'in-memory';
21
+ collectionName?: string;
22
+ dedupThreshold?: number;
23
+ vectorWeight?: number;
24
+ keywordWeight?: number;
25
+ credentialRef?: string;
26
+ }
27
+ export interface QdrantStoreConfig {
28
+ type: 'qdrant';
29
+ url: string;
30
+ collectionName: string;
31
+ /** Per-request timeout in ms; unset, a request is bounded only by the caller's signal. */
32
+ timeoutMs?: number;
33
+ credentialRef?: string;
34
+ }
35
+ export interface PgVectorStoreConfig {
36
+ type: 'pg-vector';
37
+ collectionName: string;
38
+ /** The address only — a string carrying user:password is refused at construction. */
39
+ connectionString?: string;
40
+ host?: string;
41
+ port?: number;
42
+ database?: string;
43
+ schema?: string;
44
+ poolMax?: number;
45
+ connectTimeout?: number;
46
+ dimension?: number;
47
+ autoCreateSchema?: boolean;
48
+ credentialRef?: string;
49
+ }
50
+ export interface HanaVectorStoreConfig {
51
+ type: 'hana-vector';
52
+ collectionName: string;
53
+ /** The address only — a string carrying user:password is refused at construction. */
54
+ connectionString?: string;
55
+ host?: string;
56
+ port?: number;
57
+ schema?: string;
58
+ poolMax?: number;
59
+ connectTimeout?: number;
60
+ dimension?: number;
61
+ autoCreateSchema?: boolean;
62
+ /** HANA has no anonymous login, so the root must resolve one (its default or this). */
63
+ credentialRef?: string;
64
+ }
65
+ export type SmartServerRagStoreConfig = InMemoryStoreConfig | QdrantStoreConfig | PgVectorStoreConfig | HanaVectorStoreConfig;
66
+ /** The embedders this library's resolver constructs itself (Task B6c's `EmbedderResolution` arms). */
67
+ declare const BUILT_IN_EMBEDDER_PROVIDERS: readonly ["openai", "sap-ai-core", "sap-aicore", "ollama"];
68
+ export type BuiltInEmbedderProvider = (typeof BUILT_IN_EMBEDDER_PROVIDERS)[number];
69
+ export declare function isBuiltInEmbedderProvider(name: string): name is BuiltInEmbedderProvider;
70
+ /**
71
+ * The serializable embedder section: a built-in named by `provider`, or a consumer-registered
72
+ * factory named by `factory` — the same split as the library's `EmbedderResolution`, minus the
73
+ * credential, which the composition root resolves from `credentialRef`.
74
+ *
75
+ * No `apiBaseUrl`: SAP AI Core's address travels with the credential from the same service key
76
+ * (the root's credential entry), so it is never also written here — one source (spec §4.6.2,
77
+ * §8 migration item 4). The YAML boundary refuses one by name.
78
+ */
79
+ export type SmartServerEmbedderConfig = {
80
+ /** Default when a YAML section names neither: 'ollama'. */
81
+ provider: BuiltInEmbedderProvider;
82
+ model?: string;
83
+ /** The embedder's own address (Ollama, an OpenAI-compatible endpoint). */
84
+ url?: string;
85
+ /** SAP AI Core resource group. */
86
+ resourceGroup?: string;
87
+ /** SAP AI Core scenario: 'orchestration' (default) or 'foundation-models'. */
88
+ scenario?: 'orchestration' | 'foundation-models';
89
+ /**
90
+ * Cap on texts per embedBatch call. Precedence: this value → the provider's
91
+ * declared cap → the library default (100).
92
+ */
93
+ maxBatchSize?: number;
94
+ /** The embedder's account; omit for the root's default embedder entry. */
95
+ credentialRef?: string;
96
+ factory?: never;
97
+ } | {
98
+ /** An `extraFactories` key the consumer registered; it receives `EmbedderFactoryConfig`. */
99
+ factory: string;
100
+ model?: string;
101
+ url?: string;
102
+ maxBatchSize?: number;
103
+ provider?: never;
104
+ /** A consumer factory closes over its own credential; the framework carries none for it. */
105
+ credentialRef?: never;
106
+ };
107
+ /**
108
+ * The section for an embedder known only by name — the skill host's
109
+ * `skillPlugins.embedder.provider`: a built-in name becomes `provider`, anything else
110
+ * the `factory` it must have been registered as, and no name means ollama.
111
+ */
112
+ export declare function embedderSectionFor(name: string | undefined, model?: string): SmartServerEmbedderConfig;
113
+ export interface SmartServerRagConfig {
114
+ store: SmartServerRagStoreConfig;
115
+ /** Absent → no embedder: only an in-memory store works without one (keyword-only). */
116
+ embedder?: SmartServerEmbedderConfig;
117
+ }
118
+ /**
119
+ * What `BuildAgentDeps.makeRag` receives: the serializable store section and, where
120
+ * the store needs one, an embedder already built through `resolveEmbedder`. Paired,
121
+ * so the compiler demands an embedder exactly where a store cannot work without one.
122
+ */
123
+ export type MakeRagInput = {
124
+ store: InMemoryStoreConfig;
125
+ embedder?: IEmbedder;
126
+ } | {
127
+ store: QdrantStoreConfig | PgVectorStoreConfig | HanaVectorStoreConfig;
128
+ embedder: IEmbedder;
129
+ };
130
+ /**
131
+ * Narrows a `MakeRagInput` to its in-memory arm — and, in the `false` branch, to the vector
132
+ * arm with `embedder: IEmbedder`. TypeScript does not narrow the pair through
133
+ * `input.store.type` — the discriminant is nested — so without this a `makeRag` body sees
134
+ * `embedder: IEmbedder | undefined` on every arm (§4.6.4's reference `makeRag` uses exactly
135
+ * this guard). The one-line body restates the union's own pairing.
136
+ */
137
+ export declare function isInMemoryInput(input: MakeRagInput): input is Extract<MakeRagInput, {
138
+ store: {
139
+ type: 'in-memory';
140
+ };
141
+ }>;
142
+ /**
143
+ * Pair a store section with the embedder resolved for it. The embedder is a value
144
+ * that exists or does not at runtime; the union makes the requirement visible, and
145
+ * this is where a vector store without one is refused, naming what to configure.
146
+ */
147
+ export declare function toMakeRagInput(store: SmartServerRagStoreConfig, embedder: IEmbedder | undefined, label: string): MakeRagInput;
148
+ /**
149
+ * The boundary for a programmatic config no compiler saw (plain JS, or a cast): a
150
+ * `rag` still in the flat shape is refused at construction with the migration in
151
+ * the message, instead of failing later on `undefined.type`.
152
+ */
153
+ export declare function assertRagConfigShape(rag: unknown, label: string): void;
154
+ export {};
155
+ //# sourceMappingURL=rag-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rag-config.d.ts","sourceRoot":"","sources":["../../src/smart-agent/rag-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,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EMBEDDER_PROVIDERS = [
3
+ 'openai',
4
+ 'sap-ai-core',
5
+ 'sap-aicore',
6
+ 'ollama',
7
+ ];
8
+ export function isBuiltInEmbedderProvider(name) {
9
+ return BUILT_IN_EMBEDDER_PROVIDERS.includes(name);
10
+ }
11
+ /**
12
+ * The section for an embedder known only by name — the skill host's
13
+ * `skillPlugins.embedder.provider`: a built-in name becomes `provider`, anything else
14
+ * the `factory` it must have been registered as, and no name means ollama.
15
+ */
16
+ export function embedderSectionFor(name, model) {
17
+ const m = model !== undefined ? { model } : {};
18
+ if (name === undefined)
19
+ return { provider: 'ollama', ...m };
20
+ return isBuiltInEmbedderProvider(name)
21
+ ? { provider: name, ...m }
22
+ : { factory: name, ...m };
23
+ }
24
+ /**
25
+ * Narrows a `MakeRagInput` to its in-memory arm — and, in the `false` branch, to the vector
26
+ * arm with `embedder: IEmbedder`. TypeScript does not narrow the pair through
27
+ * `input.store.type` — the discriminant is nested — so without this a `makeRag` body sees
28
+ * `embedder: IEmbedder | undefined` on every arm (§4.6.4's reference `makeRag` uses exactly
29
+ * this guard). The one-line body restates the union's own pairing.
30
+ */
31
+ export function isInMemoryInput(input) {
32
+ return input.store.type === 'in-memory';
33
+ }
34
+ /**
35
+ * Pair a store section with the embedder resolved for it. The embedder is a value
36
+ * that exists or does not at runtime; the union makes the requirement visible, and
37
+ * this is where a vector store without one is refused, naming what to configure.
38
+ */
39
+ export function toMakeRagInput(store, embedder, label) {
40
+ if (store.type === 'in-memory') {
41
+ return embedder ? { store, embedder } : { store };
42
+ }
43
+ if (!embedder) {
44
+ throw new Error(`${label}.store.type '${store.type}' needs an embedder: configure ${label}.embedder (provider, model)`);
45
+ }
46
+ return { store, embedder };
47
+ }
48
+ /**
49
+ * The boundary for a programmatic config no compiler saw (plain JS, or a cast): a
50
+ * `rag` still in the flat shape is refused at construction with the migration in
51
+ * the message, instead of failing later on `undefined.type`.
52
+ */
53
+ export function assertRagConfigShape(rag, label) {
54
+ if (rag === undefined || rag === null)
55
+ return;
56
+ const store = rag.store;
57
+ if (store === null || typeof store !== 'object') {
58
+ throw new Error(`${label}.store is required: the flat rag section was split into ${label}.store ` +
59
+ `and ${label}.embedder, each with its own credentialRef (see the migration note)`);
60
+ }
61
+ }
62
+ //# sourceMappingURL=rag-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rag-config.js","sourceRoot":"","sources":["../../src/smart-agent/rag-config.ts"],"names":[],"mappings":"AA2EA,sGAAsG;AACtG,MAAM,2BAA2B,GAAG;IAClC,QAAQ;IACR,aAAa;IACb,YAAY;IACZ,QAAQ;CACA,CAAC;AAIX,MAAM,UAAU,yBAAyB,CACvC,IAAY;IAEZ,OAAQ,2BAAiD,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC;AA0CD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAwB,EACxB,KAAc;IAEd,MAAM,CAAC,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5D,OAAO,yBAAyB,CAAC,IAAI,CAAC;QACpC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE;QAC1B,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;AAC9B,CAAC;AAoBD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAmB;IAEnB,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAgC,EAChC,QAA+B,EAC/B,KAAa;IAEb,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;IACpD,CAAC;IACD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,gBAAgB,KAAK,CAAC,IAAI,kCAAkC,KAAK,6BAA6B,CACvG,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAY,EAAE,KAAa;IAC9D,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO;IAC9C,MAAM,KAAK,GAAI,GAA2B,CAAC,KAAK,CAAC;IACjD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,2DAA2D,KAAK,SAAS;YAC/E,OAAO,KAAK,qEAAqE,CACpF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,27 +1,28 @@
1
1
  /**
2
2
  * Resolve the embedder that the SmartServer agent shares between its RAG
3
- * (`makeRag`) and the subagent context-builder's `toolSource`.
3
+ * (`BuildAgentDeps.makeRag`) and the subagent context-builder's `toolSource`.
4
4
  *
5
5
  * A DI-injected embedder always wins. Otherwise the embedder is built from the
6
- * flat `rag.embedder` config — but ONLY when the RAG actually uses an embedder.
6
+ * `rag.embedder` section — but ONLY when the RAG actually uses an embedder.
7
7
  * A bare in-memory (BM25, no embedder) store needs none, and we must NOT build
8
- * one, since `resolveEmbedder` would otherwise default to `ollama` and falsely
9
- * require it.
8
+ * one, since the seam would otherwise default to `ollama` and falsely require
9
+ * it.
10
10
  *
11
11
  * Fixes #137: YAML-only deployments (embedder via `rag.embedder`, not DI) used
12
12
  * to leave the context-builder's embedder `undefined`, so constrained subagents
13
13
  * failed with empty context.
14
14
  */
15
- import type { EmbedderFactory, IEmbedder, ILogger } from '@mcp-abap-adt/llm-agent';
16
- import type { SmartServerRagConfig } from './smart-server.js';
17
- export declare function resolveAgentEmbedder(rag: SmartServerRagConfig | undefined, diEmbedder: IEmbedder | undefined, extraFactories: Record<string, EmbedderFactory>, logger?: ILogger): Promise<IEmbedder | undefined>;
15
+ import type { AnyLogger, EmbedderFactory, IEmbedder } from '@mcp-abap-adt/llm-agent';
16
+ import type { SmartServerRagConfig } from './rag-config.js';
17
+ import type { BuildAgentDeps } from './smart-server.js';
18
+ export declare function resolveAgentEmbedder(rag: SmartServerRagConfig | undefined, diEmbedder: IEmbedder | undefined, resolve: BuildAgentDeps['resolveEmbedder'], extraFactories: Record<string, EmbedderFactory>, logger?: AnyLogger): Promise<IEmbedder | undefined>;
18
19
  /**
19
20
  * Resolve the embedder for the `pipeline.rag.tools` store, which feeds the
20
21
  * subagent context-builder's `toolSource`.
21
22
  *
22
23
  * If the agent already has an embedder (`current` — DI-injected, or built from
23
- * the flat `rag:` block), reuse it so the tools store and the context-builder
24
- * share one instance. Otherwise (YAML-only multi-store deployments with no flat
24
+ * the `rag:` block), reuse it so the tools store and the context-builder share
25
+ * one instance. Otherwise (YAML-only multi-store deployments with no top-level
25
26
  * `rag:` and no DI) build one from the tools store's own config.
26
27
  *
27
28
  * The returned value is BOTH this store's `injectedEmbedder` AND the new
@@ -30,5 +31,5 @@ export declare function resolveAgentEmbedder(rag: SmartServerRagConfig | undefin
30
31
  *
31
32
  * Fixes #141: the flat-path fix (#137) didn't reach the multi-store path.
32
33
  */
33
- export declare function resolveToolsStoreEmbedder(current: IEmbedder | undefined, toolsStoreCfg: SmartServerRagConfig, diEmbedder: IEmbedder | undefined, extraFactories: Record<string, EmbedderFactory>, logger?: ILogger): Promise<IEmbedder | undefined>;
34
+ export declare function resolveToolsStoreEmbedder(current: IEmbedder | undefined, toolsStoreCfg: SmartServerRagConfig, diEmbedder: IEmbedder | undefined, resolve: BuildAgentDeps['resolveEmbedder'], extraFactories: Record<string, EmbedderFactory>, logger?: AnyLogger): Promise<IEmbedder | undefined>;
34
35
  //# sourceMappingURL=resolve-agent-embedder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-agent-embedder.d.ts","sourceRoot":"","sources":["../../src/smart-agent/resolve-agent-embedder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,SAAS,EACT,OAAO,EACR,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,oBAAoB,GAAG,SAAS,EACrC,UAAU,EAAE,SAAS,GAAG,SAAS,EACjC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAC/C,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAuBhC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,SAAS,GAAG,SAAS,EAC9B,aAAa,EAAE,oBAAoB,EACnC,UAAU,EAAE,SAAS,GAAG,SAAS,EACjC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAC/C,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAoBhC"}
1
+ {"version":3,"file":"resolve-agent-embedder.d.ts","sourceRoot":"","sources":["../../src/smart-agent/resolve-agent-embedder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,SAAS,EACV,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,oBAAoB,GAAG,SAAS,EACrC,UAAU,EAAE,SAAS,GAAG,SAAS,EACjC,OAAO,EAAE,cAAc,CAAC,iBAAiB,CAAC,EAC1C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAC/C,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CA8BhC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,SAAS,GAAG,SAAS,EAC9B,aAAa,EAAE,oBAAoB,EACnC,UAAU,EAAE,SAAS,GAAG,SAAS,EACjC,OAAO,EAAE,cAAc,CAAC,iBAAiB,CAAC,EAC1C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAC/C,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAehC"}
@@ -1,48 +1,55 @@
1
1
  /**
2
2
  * Resolve the embedder that the SmartServer agent shares between its RAG
3
- * (`makeRag`) and the subagent context-builder's `toolSource`.
3
+ * (`BuildAgentDeps.makeRag`) and the subagent context-builder's `toolSource`.
4
4
  *
5
5
  * A DI-injected embedder always wins. Otherwise the embedder is built from the
6
- * flat `rag.embedder` config — but ONLY when the RAG actually uses an embedder.
6
+ * `rag.embedder` section — but ONLY when the RAG actually uses an embedder.
7
7
  * A bare in-memory (BM25, no embedder) store needs none, and we must NOT build
8
- * one, since `resolveEmbedder` would otherwise default to `ollama` and falsely
9
- * require it.
8
+ * one, since the seam would otherwise default to `ollama` and falsely require
9
+ * it.
10
10
  *
11
11
  * Fixes #137: YAML-only deployments (embedder via `rag.embedder`, not DI) used
12
12
  * to leave the context-builder's embedder `undefined`, so constrained subagents
13
13
  * failed with empty context.
14
14
  */
15
15
  import { wrapEmbedder } from '@mcp-abap-adt/llm-agent-libs';
16
- import { prefetchEmbedderFactories, resolveEmbedder, } from '@mcp-abap-adt/llm-agent-rag';
17
- export async function resolveAgentEmbedder(rag, diEmbedder, extraFactories, logger) {
18
- // Canonical owner: every non-undefined embedder is wrapped here so its
19
- // embed() calls log token usage to the per-request logger (carried on
20
- // CallOptions). wrapEmbedder is idempotent, so a later builder.withEmbedder
21
- // wrap is a no-op.
16
+ import { composeEmbedder, prefetchEmbedderFactories, } from '@mcp-abap-adt/llm-agent-rag';
17
+ export async function resolveAgentEmbedder(rag, diEmbedder, resolve, extraFactories, logger) {
18
+ // Canonical owner: every non-undefined embedder is wrapped here so its embed()
19
+ // calls log token usage to the per-request logger. wrapEmbedder is idempotent.
22
20
  //
23
- // The DI'd embedder goes through resolveEmbedder as well, not straight to
24
- // wrapEmbedder: otherwise a consumer-supplied embedder would bypass batch
25
- // chunking and retry entirely.
21
+ // An instance the consumer built is COMPOSED (chunking and retry), not resolved:
22
+ // it constructs nothing, so it needs neither the seam nor a credential.
26
23
  if (diEmbedder) {
27
- return wrapEmbedder(resolveEmbedder(rag ?? {}, { injectedEmbedder: diEmbedder, logger }));
24
+ return wrapEmbedder(composeEmbedder(diEmbedder, {
25
+ maxBatchSize: rag?.embedder?.maxBatchSize,
26
+ logger,
27
+ }));
28
28
  }
29
- // No RAG, or a bare in-memory BM25 store → no embedder is used.
30
- if (!rag || (rag.type === 'in-memory' && rag.embedder == null)) {
29
+ // No RAG, or a keyword-only in-memory store → no embedder is used.
30
+ if (!rag || (rag.store.type === 'in-memory' && rag.embedder === undefined)) {
31
31
  return undefined;
32
32
  }
33
- // Named embedders must be built-in (ollama/openai/sap-ai-core); custom
34
- // embedders are supplied via DI (handled above). Mirrors makeRag's contract.
35
- await prefetchEmbedderFactories([rag.embedder ?? 'ollama']);
36
- const resolved = resolveEmbedder(rag, { extraFactories, logger });
37
- return resolved ? wrapEmbedder(resolved) : undefined;
33
+ // A vector store with no embedder section keeps the default this path always
34
+ // had ('ollama'); the validator already asked for its model unless provider
35
+ // checks were skipped.
36
+ const section = rag.embedder ?? {
37
+ provider: 'ollama',
38
+ };
39
+ // Only a built-in has a peer package to load; a factory is registered, not imported.
40
+ if (section.factory === undefined) {
41
+ await prefetchEmbedderFactories([section.provider]);
42
+ }
43
+ // Construction goes through the app's seam: the library builds no embedder.
44
+ return wrapEmbedder(resolve(section, { extraFactories, logger }));
38
45
  }
39
46
  /**
40
47
  * Resolve the embedder for the `pipeline.rag.tools` store, which feeds the
41
48
  * subagent context-builder's `toolSource`.
42
49
  *
43
50
  * If the agent already has an embedder (`current` — DI-injected, or built from
44
- * the flat `rag:` block), reuse it so the tools store and the context-builder
45
- * share one instance. Otherwise (YAML-only multi-store deployments with no flat
51
+ * the `rag:` block), reuse it so the tools store and the context-builder share
52
+ * one instance. Otherwise (YAML-only multi-store deployments with no top-level
46
53
  * `rag:` and no DI) build one from the tools store's own config.
47
54
  *
48
55
  * The returned value is BOTH this store's `injectedEmbedder` AND the new
@@ -51,21 +58,15 @@ export async function resolveAgentEmbedder(rag, diEmbedder, extraFactories, logg
51
58
  *
52
59
  * Fixes #141: the flat-path fix (#137) didn't reach the multi-store path.
53
60
  */
54
- export async function resolveToolsStoreEmbedder(current, toolsStoreCfg, diEmbedder, extraFactories, logger) {
61
+ export async function resolveToolsStoreEmbedder(current, toolsStoreCfg, diEmbedder, resolve, extraFactories, logger) {
55
62
  if (current) {
56
- // #141's contract is identity: an existing embedder must be reused, never
57
- // rebuilt. So route through the resolver ONLY when this store explicitly
58
- // asks for a cap — the sole input that can conflict. Without that, running
59
- // the resolver would wrap a non-resilient `current` and change identity for
60
- // configs that requested nothing.
61
- if (toolsStoreCfg.maxBatchSize === undefined)
63
+ // #141's contract is identity: reuse, never rebuild — compose only when this
64
+ // store asks for a cap, the sole input that can conflict.
65
+ const cap = toolsStoreCfg.embedder?.maxBatchSize;
66
+ if (cap === undefined)
62
67
  return current;
63
- return resolveEmbedder(toolsStoreCfg, {
64
- injectedEmbedder: current,
65
- extraFactories,
66
- logger,
67
- });
68
+ return composeEmbedder(current, { maxBatchSize: cap, logger });
68
69
  }
69
- return resolveAgentEmbedder(toolsStoreCfg, diEmbedder, extraFactories, logger);
70
+ return resolveAgentEmbedder(toolsStoreCfg, diEmbedder, resolve, extraFactories, logger);
70
71
  }
71
72
  //# sourceMappingURL=resolve-agent-embedder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-agent-embedder.js","sourceRoot":"","sources":["../../src/smart-agent/resolve-agent-embedder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACL,yBAAyB,EACzB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAGrC,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAqC,EACrC,UAAiC,EACjC,cAA+C,EAC/C,MAAgB;IAEhB,uEAAuE;IACvE,sEAAsE;IACtE,4EAA4E;IAC5E,mBAAmB;IACnB,EAAE;IACF,0EAA0E;IAC1E,0EAA0E;IAC1E,+BAA+B;IAC/B,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,YAAY,CACjB,eAAe,CAAC,GAAG,IAAI,EAAE,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CACrE,CAAC;IACJ,CAAC;IACD,gEAAgE;IAChE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,CAAC;QAC/D,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,uEAAuE;IACvE,6EAA6E;IAC7E,MAAM,yBAAyB,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;IAClE,OAAO,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,OAA8B,EAC9B,aAAmC,EACnC,UAAiC,EACjC,cAA+C,EAC/C,MAAgB;IAEhB,IAAI,OAAO,EAAE,CAAC;QACZ,0EAA0E;QAC1E,yEAAyE;QACzE,2EAA2E;QAC3E,4EAA4E;QAC5E,kCAAkC;QAClC,IAAI,aAAa,CAAC,YAAY,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC;QAC7D,OAAO,eAAe,CAAC,aAAa,EAAE;YACpC,gBAAgB,EAAE,OAAO;YACzB,cAAc;YACd,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IACD,OAAO,oBAAoB,CACzB,aAAa,EACb,UAAU,EACV,cAAc,EACd,MAAM,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"resolve-agent-embedder.js","sourceRoot":"","sources":["../../src/smart-agent/resolve-agent-embedder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,yBAAyB,GAC1B,MAAM,6BAA6B,CAAC;AAOrC,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAqC,EACrC,UAAiC,EACjC,OAA0C,EAC1C,cAA+C,EAC/C,MAAkB;IAElB,+EAA+E;IAC/E,+EAA+E;IAC/E,EAAE;IACF,iFAAiF;IACjF,wEAAwE;IACxE,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,YAAY,CACjB,eAAe,CAAC,UAAU,EAAE;YAC1B,YAAY,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY;YACzC,MAAM;SACP,CAAC,CACH,CAAC;IACJ,CAAC;IACD,mEAAmE;IACnE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,EAAE,CAAC;QAC3E,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,6EAA6E;IAC7E,4EAA4E;IAC5E,uBAAuB;IACvB,MAAM,OAAO,GAA8B,GAAG,CAAC,QAAQ,IAAI;QACzD,QAAQ,EAAE,QAAQ;KACnB,CAAC;IACF,qFAAqF;IACrF,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,yBAAyB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,4EAA4E;IAC5E,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,OAA8B,EAC9B,aAAmC,EACnC,UAAiC,EACjC,OAA0C,EAC1C,cAA+C,EAC/C,MAAkB;IAElB,IAAI,OAAO,EAAE,CAAC;QACZ,6EAA6E;QAC7E,0DAA0D;QAC1D,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC;QACjD,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC;QACtC,OAAO,eAAe,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,oBAAoB,CACzB,aAAa,EACb,UAAU,EACV,OAAO,EACP,cAAc,EACd,MAAM,CACP,CAAC;AACJ,CAAC"}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { SmartServerAgentConfig, SmartServerConfig } from './smart-server.js';
6
6
  import type { YamlConfig } from './yaml-loader.js';
7
- export declare function resolveLlmSection(yaml: YamlConfig, apiKey: string): SmartServerConfig['llm'];
7
+ export declare function resolveLlmSection(yaml: YamlConfig): SmartServerConfig['llm'];
8
8
  export declare function resolveRagSection(yaml: YamlConfig, args: Record<string, unknown>): SmartServerConfig['rag'];
9
9
  export declare function resolveMcpSection(yaml: YamlConfig, args: Record<string, unknown>): SmartServerConfig['mcp'];
10
10
  export declare function resolveAgentSection(yaml: YamlConfig, args: Record<string, unknown>): SmartServerAgentConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-config-sections.d.ts","sourceRoot":"","sources":["../../src/smart-agent/resolve-config-sections.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,iBAAiB,CAAC,KAAK,CAAC,CA2B1B;AAiID,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,iBAAiB,CAAC,KAAK,CAAC,CAqC1B;AA8BD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,iBAAiB,CAAC,KAAK,CAAC,CA4C1B;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,sBAAsB,CAyIxB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,UAAU,GACf,iBAAiB,CAAC,SAAS,CAAC,CA2B9B;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,UAAU,GAAG;IAC1D,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAsBA"}
1
+ {"version":3,"file":"resolve-config-sections.d.ts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