@mcp-abap-adt/llm-agent-server-libs 19.2.0 → 20.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.
- package/dist/builders/controller-skill-pipeline-builder.d.ts +57 -0
- package/dist/builders/controller-skill-pipeline-builder.d.ts.map +1 -0
- package/dist/builders/controller-skill-pipeline-builder.js +175 -0
- package/dist/builders/controller-skill-pipeline-builder.js.map +1 -0
- package/dist/factories/controller-factory.d.ts +2 -2
- package/dist/factories/controller-factory.d.ts.map +1 -1
- package/dist/factories/controller-factory.js +2 -1
- package/dist/factories/controller-factory.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/pipelines/controller.d.ts +4 -2
- package/dist/pipelines/controller.d.ts.map +1 -1
- package/dist/pipelines/controller.js +33 -8
- package/dist/pipelines/controller.js.map +1 -1
- package/dist/pipelines/coordinator-resolvers.d.ts +68 -0
- package/dist/pipelines/coordinator-resolvers.d.ts.map +1 -0
- package/dist/pipelines/coordinator-resolvers.js +97 -0
- package/dist/pipelines/coordinator-resolvers.js.map +1 -0
- package/dist/pipelines/dag.d.ts +2 -2
- package/dist/pipelines/dag.js +2 -2
- package/dist/pipelines/parsers.d.ts +1 -1
- package/dist/pipelines/parsers.d.ts.map +1 -1
- package/dist/pipelines/parsers.js +5 -4
- package/dist/pipelines/parsers.js.map +1 -1
- package/dist/pipelines/register-skill-sources.d.ts.map +1 -1
- package/dist/pipelines/register-skill-sources.js +5 -0
- package/dist/pipelines/register-skill-sources.js.map +1 -1
- package/dist/pipelines/stepper.d.ts +2 -2
- package/dist/pipelines/stepper.js +2 -2
- package/dist/smart-agent/build-stepper-root.d.ts +3 -2
- package/dist/smart-agent/build-stepper-root.d.ts.map +1 -1
- package/dist/smart-agent/build-stepper-root.js +2 -1
- package/dist/smart-agent/build-stepper-root.js.map +1 -1
- package/dist/smart-agent/config-reload-watcher.d.ts +30 -0
- package/dist/smart-agent/config-reload-watcher.d.ts.map +1 -0
- package/dist/smart-agent/config-reload-watcher.js +101 -0
- package/dist/smart-agent/config-reload-watcher.js.map +1 -0
- package/dist/smart-agent/config-validator.d.ts +21 -0
- package/dist/smart-agent/config-validator.d.ts.map +1 -0
- package/dist/smart-agent/config-validator.js +196 -0
- package/dist/smart-agent/config-validator.js.map +1 -0
- package/dist/smart-agent/config.d.ts +16 -254
- package/dist/smart-agent/config.d.ts.map +1 -1
- package/dist/smart-agent/config.js +17 -904
- package/dist/smart-agent/config.js.map +1 -1
- package/dist/smart-agent/controller/board.d.ts +6 -3
- package/dist/smart-agent/controller/board.d.ts.map +1 -1
- package/dist/smart-agent/controller/board.js +21 -0
- package/dist/smart-agent/controller/board.js.map +1 -1
- package/dist/smart-agent/controller/controller-coordinator-handler.d.ts +16 -50
- package/dist/smart-agent/controller/controller-coordinator-handler.d.ts.map +1 -1
- package/dist/smart-agent/controller/controller-coordinator-handler.js +83 -371
- package/dist/smart-agent/controller/controller-coordinator-handler.js.map +1 -1
- package/dist/smart-agent/controller/finalizer.d.ts +5 -0
- package/dist/smart-agent/controller/finalizer.d.ts.map +1 -1
- package/dist/smart-agent/controller/finalizer.js +12 -5
- package/dist/smart-agent/controller/finalizer.js.map +1 -1
- package/dist/smart-agent/controller/parser.d.ts +11 -0
- package/dist/smart-agent/controller/parser.d.ts.map +1 -0
- package/dist/smart-agent/controller/parser.js +77 -0
- package/dist/smart-agent/controller/parser.js.map +1 -0
- package/dist/smart-agent/controller/planner.d.ts +20 -16
- package/dist/smart-agent/controller/planner.d.ts.map +1 -1
- package/dist/smart-agent/controller/planner.js +58 -64
- package/dist/smart-agent/controller/planner.js.map +1 -1
- package/dist/smart-agent/controller/recall.d.ts +48 -0
- package/dist/smart-agent/controller/recall.d.ts.map +1 -0
- package/dist/smart-agent/controller/recall.js +196 -0
- package/dist/smart-agent/controller/recall.js.map +1 -0
- package/dist/smart-agent/controller/reviewer.d.ts.map +1 -1
- package/dist/smart-agent/controller/reviewer.js +1 -1
- package/dist/smart-agent/controller/reviewer.js.map +1 -1
- package/dist/smart-agent/controller/types.d.ts +8 -9
- package/dist/smart-agent/controller/types.d.ts.map +1 -1
- package/dist/smart-agent/controller/usage-logging.d.ts +16 -0
- package/dist/smart-agent/controller/usage-logging.d.ts.map +1 -0
- package/dist/smart-agent/controller/usage-logging.js +39 -0
- package/dist/smart-agent/controller/usage-logging.js.map +1 -0
- package/dist/smart-agent/http/adapter-route-handler.d.ts +13 -0
- package/dist/smart-agent/http/adapter-route-handler.d.ts.map +1 -0
- package/dist/smart-agent/http/adapter-route-handler.js +76 -0
- package/dist/smart-agent/http/adapter-route-handler.js.map +1 -0
- package/dist/smart-agent/http/chat-route-handler.d.ts +15 -0
- package/dist/smart-agent/http/chat-route-handler.d.ts.map +1 -0
- package/dist/smart-agent/http/chat-route-handler.js +327 -0
- package/dist/smart-agent/http/chat-route-handler.js.map +1 -0
- package/dist/smart-agent/http/config-route-handler.d.ts +21 -0
- package/dist/smart-agent/http/config-route-handler.d.ts.map +1 -0
- package/dist/smart-agent/http/config-route-handler.js +149 -0
- package/dist/smart-agent/http/config-route-handler.js.map +1 -0
- package/dist/smart-agent/http/health-route-handler.d.ts +12 -0
- package/dist/smart-agent/http/health-route-handler.d.ts.map +1 -0
- package/dist/smart-agent/http/health-route-handler.js +19 -0
- package/dist/smart-agent/http/health-route-handler.js.map +1 -0
- package/dist/smart-agent/http/models-route-handler.d.ts +17 -0
- package/dist/smart-agent/http/models-route-handler.d.ts.map +1 -0
- package/dist/smart-agent/http/models-route-handler.js +65 -0
- package/dist/smart-agent/http/models-route-handler.js.map +1 -0
- package/dist/smart-agent/http/response-helpers.d.ts +31 -0
- package/dist/smart-agent/http/response-helpers.d.ts.map +1 -0
- package/dist/smart-agent/http/response-helpers.js +59 -0
- package/dist/smart-agent/http/response-helpers.js.map +1 -0
- package/dist/smart-agent/http/route-table.d.ts +44 -0
- package/dist/smart-agent/http/route-table.d.ts.map +1 -0
- package/dist/smart-agent/http/route-table.js +35 -0
- package/dist/smart-agent/http/route-table.js.map +1 -0
- package/dist/smart-agent/http/session-cookie.d.ts +10 -0
- package/dist/smart-agent/http/session-cookie.d.ts.map +1 -0
- package/dist/smart-agent/http/session-cookie.js +16 -0
- package/dist/smart-agent/http/session-cookie.js.map +1 -0
- package/dist/smart-agent/http/sessions-route-handler.d.ts +8 -0
- package/dist/smart-agent/http/sessions-route-handler.d.ts.map +1 -0
- package/dist/smart-agent/http/sessions-route-handler.js +54 -0
- package/dist/smart-agent/http/sessions-route-handler.js.map +1 -0
- package/dist/smart-agent/http/usage-route-handler.d.ts +12 -0
- package/dist/smart-agent/http/usage-route-handler.d.ts.map +1 -0
- package/dist/smart-agent/http/usage-route-handler.js +28 -0
- package/dist/smart-agent/http/usage-route-handler.js.map +1 -0
- package/dist/smart-agent/knowledge/make-knowledge-backend.d.ts +13 -0
- package/dist/smart-agent/knowledge/make-knowledge-backend.d.ts.map +1 -0
- package/dist/smart-agent/knowledge/make-knowledge-backend.js +18 -0
- package/dist/smart-agent/knowledge/make-knowledge-backend.js.map +1 -0
- package/dist/smart-agent/llm/role-llm-resolver.d.ts +30 -0
- package/dist/smart-agent/llm/role-llm-resolver.d.ts.map +1 -0
- package/dist/smart-agent/llm/role-llm-resolver.js +44 -0
- package/dist/smart-agent/llm/role-llm-resolver.js.map +1 -0
- package/dist/smart-agent/llm-config-map.d.ts +38 -0
- package/dist/smart-agent/llm-config-map.d.ts.map +1 -0
- package/dist/smart-agent/llm-config-map.js +75 -0
- package/dist/smart-agent/llm-config-map.js.map +1 -0
- package/dist/smart-agent/mcp-readiness-monitor.d.ts +38 -0
- package/dist/smart-agent/mcp-readiness-monitor.d.ts.map +1 -0
- package/dist/smart-agent/mcp-readiness-monitor.js +81 -0
- package/dist/smart-agent/mcp-readiness-monitor.js.map +1 -0
- package/dist/smart-agent/mcp-readiness-registry.d.ts +37 -0
- package/dist/smart-agent/mcp-readiness-registry.d.ts.map +1 -0
- package/dist/smart-agent/mcp-readiness-registry.js +55 -0
- package/dist/smart-agent/mcp-readiness-registry.js.map +1 -0
- package/dist/smart-agent/resolve-config-sections.d.ts +15 -0
- package/dist/smart-agent/resolve-config-sections.d.ts.map +1 -0
- package/dist/smart-agent/resolve-config-sections.js +212 -0
- package/dist/smart-agent/resolve-config-sections.js.map +1 -0
- package/dist/smart-agent/session-lifecycle/index.d.ts +117 -0
- package/dist/smart-agent/session-lifecycle/index.d.ts.map +1 -0
- package/dist/smart-agent/session-lifecycle/index.js +152 -0
- package/dist/smart-agent/session-lifecycle/index.js.map +1 -0
- package/dist/smart-agent/skill-plugins-config.d.ts +9 -1
- package/dist/smart-agent/skill-plugins-config.d.ts.map +1 -1
- package/dist/smart-agent/skill-plugins-config.js +27 -1
- package/dist/smart-agent/skill-plugins-config.js.map +1 -1
- package/dist/smart-agent/skill-plugins-host-factory.d.ts +14 -2
- package/dist/smart-agent/skill-plugins-host-factory.d.ts.map +1 -1
- package/dist/smart-agent/skill-plugins-host-factory.js +16 -4
- package/dist/smart-agent/skill-plugins-host-factory.js.map +1 -1
- package/dist/smart-agent/smart-server.d.ts +151 -222
- package/dist/smart-agent/smart-server.d.ts.map +1 -1
- package/dist/smart-agent/smart-server.js +529 -1385
- package/dist/smart-agent/smart-server.js.map +1 -1
- package/dist/smart-agent/stepper-config.d.ts +138 -0
- package/dist/smart-agent/stepper-config.d.ts.map +1 -0
- package/dist/smart-agent/stepper-config.js +216 -0
- package/dist/smart-agent/stepper-config.js.map +1 -0
- package/dist/smart-agent/tools-rag-handle.d.ts +10 -0
- package/dist/smart-agent/tools-rag-handle.d.ts.map +1 -0
- package/dist/smart-agent/tools-rag-handle.js +76 -0
- package/dist/smart-agent/tools-rag-handle.js.map +1 -0
- package/dist/smart-agent/workers/worker-registry.d.ts +159 -0
- package/dist/smart-agent/workers/worker-registry.d.ts.map +1 -0
- package/dist/smart-agent/workers/worker-registry.js +203 -0
- package/dist/smart-agent/workers/worker-registry.js.map +1 -0
- package/dist/smart-agent/yaml-loader.d.ts +7 -0
- package/dist/smart-agent/yaml-loader.d.ts.map +1 -0
- package/dist/smart-agent/yaml-loader.js +146 -0
- package/dist/smart-agent/yaml-loader.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkerRegistry — owns the per-worker LLM/embedder/MCP cache and the
|
|
3
|
+
* per-session worker-registry build loop (relocated from SmartServer R6).
|
|
4
|
+
*
|
|
5
|
+
* The cache map, the three free functions (`WorkerLlmSet`, `resolveWorkerLlmSet`,
|
|
6
|
+
* `drainWorkerCache`, `backfillWorkerCacheFromHandle`), and the `buildWorkerRegistry`
|
|
7
|
+
* loop live here. `buildSubAgent` (200-line, deeply coupled to SmartServer) stays
|
|
8
|
+
* in SmartServer and is called through the injected `buildSubAgent` callback.
|
|
9
|
+
*/
|
|
10
|
+
import { SmartAgentSubAgent, } from '@mcp-abap-adt/llm-agent-libs';
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Free functions — relocated verbatim from smart-server.ts.
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
/**
|
|
15
|
+
* Drain every cached worker's `close` (if any), then clear the cache map.
|
|
16
|
+
* Used by config-reload (PUT /v1/config + hot-reload — Fix #14/18/21) and by
|
|
17
|
+
* server `close()` to release per-worker MCP connections that were attached
|
|
18
|
+
* to the discarded `SmartAgentHandle`s.
|
|
19
|
+
*
|
|
20
|
+
* IMPORTANT — in-flight caveat: this aborts any request that is mid-call on
|
|
21
|
+
* a worker's MCP client. That is acceptable for an admin action (config
|
|
22
|
+
* reload, server shutdown) where the alternative is leaking connections.
|
|
23
|
+
* Server `close()` calls this AFTER `lifecycle.disposeAll()` so per-session
|
|
24
|
+
* graphs that reference worker clients are torn down first.
|
|
25
|
+
*
|
|
26
|
+
* Uses `Promise.allSettled` so one failing close cannot block the others.
|
|
27
|
+
*/
|
|
28
|
+
export async function drainWorkerCache(cache) {
|
|
29
|
+
const closers = [];
|
|
30
|
+
for (const entry of cache.values()) {
|
|
31
|
+
if (entry.close) {
|
|
32
|
+
try {
|
|
33
|
+
closers.push(entry.close());
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// sync throw (defensive — close is async by contract)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
cache.clear();
|
|
41
|
+
if (closers.length > 0) {
|
|
42
|
+
await Promise.allSettled(closers);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Build-once-per-worker resolver. The first time a worker name is seen, it
|
|
47
|
+
* constructs the worker's main/classifier/(optional helper) LLM + embedder and
|
|
48
|
+
* caches the set; every later call (e.g. each per-session worker re-wire)
|
|
49
|
+
* returns the SAME set by reference — never reconstructing LLM clients
|
|
50
|
+
* (locked invariant: LLM/embedder clients are global, built once).
|
|
51
|
+
*
|
|
52
|
+
* Accepts optional `makeToolsRag`/`makeHistoryRag`/`makeMcpClients` factories;
|
|
53
|
+
* when provided, the resolver builds them ONCE on the first miss and caches
|
|
54
|
+
* them on the returned set. Subsequent calls return the cached resources by
|
|
55
|
+
* reference — never re-vectorizing or re-connecting MCP.
|
|
56
|
+
*/
|
|
57
|
+
export async function resolveWorkerLlmSet(input) {
|
|
58
|
+
const hit = input.cache.get(input.name);
|
|
59
|
+
if (hit)
|
|
60
|
+
return hit;
|
|
61
|
+
const mainLlm = await input.makeMain();
|
|
62
|
+
const classifierLlm = await input.makeClassifier();
|
|
63
|
+
const helperLlm = input.makeHelper ? await input.makeHelper() : undefined;
|
|
64
|
+
const embedder = input.makeEmbedder ? await input.makeEmbedder() : undefined;
|
|
65
|
+
const toolsRag = input.makeToolsRag ? await input.makeToolsRag() : undefined;
|
|
66
|
+
const historyRag = input.makeHistoryRag
|
|
67
|
+
? await input.makeHistoryRag()
|
|
68
|
+
: undefined;
|
|
69
|
+
const mcpClients = input.makeMcpClients
|
|
70
|
+
? await input.makeMcpClients()
|
|
71
|
+
: undefined;
|
|
72
|
+
const set = {
|
|
73
|
+
mainLlm,
|
|
74
|
+
classifierLlm,
|
|
75
|
+
helperLlm,
|
|
76
|
+
embedder,
|
|
77
|
+
toolsRag,
|
|
78
|
+
historyRag,
|
|
79
|
+
mcpClients,
|
|
80
|
+
};
|
|
81
|
+
input.cache.set(input.name, set);
|
|
82
|
+
return set;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Backfill the per-worker cache entry from the BUILT handle (review HIGH #7).
|
|
86
|
+
*
|
|
87
|
+
* The primary `buildSubAgent` populates `cached.mcpClients`/`toolsRag`/
|
|
88
|
+
* `historyRag` only when the worker config provided DI factories. Workers
|
|
89
|
+
* configured with `subCfg.mcp: ...` (regular config that triggers the
|
|
90
|
+
* builder's own auto-connect) or with `subCfg.rag: ...` whose RAG is owned
|
|
91
|
+
* by the builder leave those slots empty — so per-session re-wires would
|
|
92
|
+
* fall back to the PARENT's MCP/RAG, losing the worker's own connection.
|
|
93
|
+
*
|
|
94
|
+
* After the builder finishes, this helper captures what the handle actually
|
|
95
|
+
* holds and stores it BY REFERENCE on the cache entry. Subsequent per-session
|
|
96
|
+
* re-wires read the same slots and find the worker's own resources.
|
|
97
|
+
*
|
|
98
|
+
* Pure helper, mutates `entry` in place. No-op when the corresponding slot
|
|
99
|
+
* is already populated (DI path wins) or when the handle has no resource for
|
|
100
|
+
* that slot (worker simply didn't declare one).
|
|
101
|
+
*/
|
|
102
|
+
export async function backfillWorkerCacheFromHandle(entry, handle) {
|
|
103
|
+
if ((!entry.mcpClients || entry.mcpClients.length === 0) &&
|
|
104
|
+
handle.mcpClients &&
|
|
105
|
+
handle.mcpClients.length > 0) {
|
|
106
|
+
entry.mcpClients = handle.mcpClients;
|
|
107
|
+
}
|
|
108
|
+
if (!entry.toolsRag) {
|
|
109
|
+
const t = handle.ragRegistry.get('tools');
|
|
110
|
+
if (t)
|
|
111
|
+
entry.toolsRag = t;
|
|
112
|
+
}
|
|
113
|
+
if (!entry.historyRag) {
|
|
114
|
+
const h = handle.ragRegistry.get('history');
|
|
115
|
+
if (h)
|
|
116
|
+
entry.historyRag = h;
|
|
117
|
+
}
|
|
118
|
+
// Capture the per-worker shutdown function (Fix #21). If the entry already
|
|
119
|
+
// had a close from a previous build (e.g. the same worker name was rebuilt
|
|
120
|
+
// WITHOUT going through `drainWorkerCache` first — defence in depth), await
|
|
121
|
+
// the prior close before overwriting so its MCP connections do not leak.
|
|
122
|
+
if (handle.close) {
|
|
123
|
+
if (entry.close) {
|
|
124
|
+
try {
|
|
125
|
+
await entry.close();
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Best-effort; never block the new build on a stale close failure.
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
entry.close = handle.close;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export class WorkerRegistry {
|
|
135
|
+
deps;
|
|
136
|
+
cache = new Map();
|
|
137
|
+
constructor(deps) {
|
|
138
|
+
this.deps = deps;
|
|
139
|
+
}
|
|
140
|
+
async drain() {
|
|
141
|
+
await drainWorkerCache(this.cache);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Build the FRESH per-session worker (sub-agent) registry from the SAME
|
|
145
|
+
* `subagents:` configs the primary build() used, injecting globals + this
|
|
146
|
+
* session's logger + the CACHED per-worker LLM/embedder (this.cache).
|
|
147
|
+
* NEVER reconstructs LLM clients; NEVER reuses the global registry.
|
|
148
|
+
*/
|
|
149
|
+
async build(parts) {
|
|
150
|
+
const registry = new Map();
|
|
151
|
+
const subAgentConfigs = this.deps.subAgentConfigs;
|
|
152
|
+
if (!subAgentConfigs || subAgentConfigs.length === 0) {
|
|
153
|
+
return registry;
|
|
154
|
+
}
|
|
155
|
+
const fileLogger = this.deps.getFileLogger();
|
|
156
|
+
if (!fileLogger) {
|
|
157
|
+
throw new Error('buildWorkerRegistry invoked before primary build() captured globals');
|
|
158
|
+
}
|
|
159
|
+
const embedderFactories = this.deps.getEmbedderFactories();
|
|
160
|
+
for (const sub of subAgentConfigs) {
|
|
161
|
+
// Lazy build-on-miss (Fix #18). After PUT /v1/config or hot-reload
|
|
162
|
+
// clears the cache, the next session build used to throw
|
|
163
|
+
// "worker LLM set not cached" because the cache was assumed
|
|
164
|
+
// pre-populated by the primary build(). buildSubAgent itself routes
|
|
165
|
+
// through `resolveWorkerLlmSet` which is build-on-miss, so calling
|
|
166
|
+
// it without an `injected` arg rebuilds the cache entry. We then
|
|
167
|
+
// re-read the entry to honour the per-worker slot priority below.
|
|
168
|
+
if (!this.cache.has(sub.name)) {
|
|
169
|
+
await this.deps.buildSubAgent(sub.name, sub.config, fileLogger, embedderFactories);
|
|
170
|
+
}
|
|
171
|
+
const cached = this.cache.get(sub.name);
|
|
172
|
+
if (!cached) {
|
|
173
|
+
// Defence in depth — should be impossible after the lazy build
|
|
174
|
+
// above unless buildSubAgent's contract changes.
|
|
175
|
+
throw new Error(`worker LLM set not cached for '${sub.name}'`);
|
|
176
|
+
}
|
|
177
|
+
// Per-worker injected slot priority (review HIGH #7):
|
|
178
|
+
// worker-cached (from the primary build, includes backfilled
|
|
179
|
+
// subCfg.mcp / subCfg.rag results) → parent's session-scoped
|
|
180
|
+
// fallback. Encoded HERE so buildSubAgent does not need to know
|
|
181
|
+
// the difference; it just consumes injected.mcpClients/toolsRag.
|
|
182
|
+
const injectedMcpClients = cached.mcpClients && cached.mcpClients.length > 0
|
|
183
|
+
? cached.mcpClients
|
|
184
|
+
: parts.mcpClients;
|
|
185
|
+
const injectedToolsRag = cached.toolsRag ?? parts.toolsRag;
|
|
186
|
+
const subAgent = await this.deps.buildSubAgent(sub.name, sub.config, fileLogger, embedderFactories, {
|
|
187
|
+
ragRegistry: parts.ragRegistry,
|
|
188
|
+
toolsRag: injectedToolsRag,
|
|
189
|
+
mcpClients: injectedMcpClients,
|
|
190
|
+
requestLogger: parts.logger,
|
|
191
|
+
mainLlm: cached.mainLlm,
|
|
192
|
+
classifierLlm: cached.classifierLlm,
|
|
193
|
+
helperLlm: cached.helperLlm,
|
|
194
|
+
embedder: cached.embedder,
|
|
195
|
+
});
|
|
196
|
+
registry.set(sub.name, new SmartAgentSubAgent(sub.name, subAgent, {
|
|
197
|
+
description: sub.description,
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
return registry;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=worker-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-registry.js","sourceRoot":"","sources":["../../../src/smart-agent/workers/worker-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,EAGL,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AA0CtC,8EAA8E;AAC9E,4DAA4D;AAC5D,8EAA8E;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAgC;IAEhC,MAAM,OAAO,GAAyB,EAAE,CAAC;IACzC,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACnC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;YAC9B,CAAC;YAAC,MAAM,CAAC;gBACP,sDAAsD;YACxD,CAAC;QACH,CAAC;IACH,CAAC;IACD,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAUzC;IACC,MAAM,GAAG,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,CAAC;gBAC/C,CAAC,CAAC,MAAM,CAAC,UAAU;gBACnB,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;YACvB,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC;YAC3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAC5C,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,MAAM,EACV,UAAU,EACV,iBAAiB,EACjB;gBACE,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,QAAQ,EAAE,gBAAgB;gBAC1B,UAAU,EAAE,kBAAkB;gBAC9B,aAAa,EAAE,KAAK,CAAC,MAAM;gBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CACF,CAAC;YACF,QAAQ,CAAC,GAAG,CACV,GAAG,CAAC,IAAI,EACR,IAAI,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE;gBACzC,WAAW,EAAE,GAAG,CAAC,WAAW;aAC7B,CAAC,CACH,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type YamlConfig = Record<string, unknown>;
|
|
2
|
+
export declare const YAML_TEMPLATE = "port: 4004\nhost: 0.0.0.0\n\n# Request routing mode:\n# hard \u2014 Fully managed context. Ignores client history/system prompt. Uses RAG + internal MCP tools only.\n# pass \u2014 Transparent proxy. Logs everything but modifies nothing.\n# smart \u2014 Hybrid. Preserves client history but enriches it with RAG context and MCP tools based on analysis. (default)\nmode: smart\n\nllm:\n provider: deepseek # deepseek | openai | anthropic | sap-ai-sdk | ollama\n apiKey: ${DEEPSEEK_API_KEY} # not required for ollama / sap-ai-sdk\n model: deepseek-chat\n temperature: 0.7\n classifierTemperature: 0.1\n\nrag:\n type: in-memory # in-memory | qdrant | hana-vector | pg-vector\n embedder: ollama # Embedder to use: ollama | openai | sap-ai-core | <custom>\n url: http://localhost:11434\n model: bge-m3\n # resourceGroup: default # SAP AI Core resource group (sap-ai-core embedder)\n # scenario: orchestration # SAP AI Core scenario: orchestration (default) | foundation-models\n # collectionName: llm-agent # Collection/table name (qdrant | hana-vector | pg-vector)\n dedupThreshold: 0.92\n vectorWeight: 0.7 # Semantic similarity weight (0..1)\n keywordWeight: 0.3 # Lexical matching weight (0..1)\n\nmcp:\n # type: none | http | stdio\n # To disable MCP, set type to 'none'\n type: http\n url: http://localhost:3001/mcp/stream/http\n\nagent:\n externalToolsValidationMode: permissive # permissive | strict\n maxIterations: 10\n maxToolCalls: 30\n toolUnavailableTtlMs: 600000 # Temporary tool blacklist TTL (ms)\n ragQueryK: 10\n # contextBudgetTokens: 4000 # Max tokens for RAG context in system prompt (0 = no limit)\n # semanticHistoryEnabled: false # Enable semantic history via RAG\n # historyRecencyWindow: 4 # Last N messages from client history in LLM context\n # historyTurnSummaryPrompt: \"...\" # LLM prompt for turn summarization\n showReasoning: false # Explain strategy at start of response\n historyAutoSummarizeLimit: 10 # History length to trigger compression\n queryExpansionEnabled: false # Expand RAG queries with LLM-generated synonyms\n toolResultCacheTtlMs: 300000 # Tool result cache TTL (ms); 0 to disable\n sessionTokenBudget: 0 # Multi-turn token budget; 0 to disable\n # ragTranslateEnabled: true # Translate non-ASCII RAG queries to English (default: true)\n # classificationEnabled: false # Enable for custom pipelines with multi-store routing\n # toolReselectPerIteration: false # Re-select tools via RAG on each tool-loop iteration\n # llmCallStrategy: streaming # streaming | non-streaming | fallback\n # streamMode: full # full | final \u2014 streaming behavior for tool loops\n # heartbeatIntervalMs: 5000 # SSE heartbeat interval during tool execution (ms)\n # healthTimeoutMs: 5000 # Health check probe timeout (ms); increase for slow providers (SAP AI Core: 15000)\n # retry: # LLM retry config for 429/5xx errors\n # maxAttempts: 3\n # backoffMs: 1000\n # retryOn: [429, 500, 502, 503]\n # retryOnMidStream: ['SSE stream'] # Substrings triggering mid-stream retry\n\n# --- Advanced Multi-Model LLM (optional) ------------------------------------\n# Assign different models for different internal roles via a top-level llm: map.\n# (The legacy pipeline.llm override was removed \u2014 use the top-level llm: map now.)\n# llm:\n# main:\n# provider: deepseek # deepseek | openai | anthropic | sap-ai-sdk\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.7\n# classifier: # optional; if absent, main config is reused\n# provider: deepseek\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.1\n# helper: # optional; if absent, main config is reused\n# provider: deepseek\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.1\n\n# prompts:\n# system: \"You are a helpful assistant specialized in SAP ABAP development.\"\n# classifier: |\n# You are an intent classifier... (see source for full default prompt)\n# reasoning: |\n# IMPORTANT: Always start your response with a brief <reasoning> block...\n# ragTranslate: |\n# Translate the user request to English for search purposes...\n# historySummary: |\n# Summarize the conversation so far...\n\nlog: smart-server.log # path to log file; omit for stdout\n# logDir: sessions # Directory for detailed session debug logs\n# pluginDir: ./my-plugins # Additional plugin directory (loaded after defaults)\n# plugins: # Explicit plugin module specifiers (npm packages or paths)\n# - \"@scope/my-pipeline-plugin\" # bare specifier resolved from cwd\n# - ./local-plugin.mjs # relative path resolved against cwd\n\n# subagents: # Optional: nested agents callable from pipeline\n# - name: code-reviewer # Used as stage config: { agent: code-reviewer }\n# description: | # Optional. Shown to the Coordinator planner LLM\n# Reviews code and returns # so it can pick this agent for the right step.\n# structured JSON.\n# config: ./agents/code-reviewer.yaml\n\n# pipeline: # Optional: select the request pipeline.\n# name: flat # flat (default) | linear | dag | stepper | controller | controller-weak | <plugin>\n# config: # Opaque per-pipeline dialect (validated by the plugin)\n# mode: planned-react # e.g. stepper: cyclic-react | planned-react | deep-stepper\n# knowledgeSeed: [] # stepper: deployment-supplied tool guidance\n#\n# NOTE: the legacy 'coordinator:' block and the old 'pipeline:' shape\n# (mcp/rag/stages/llm overrides) were REMOVED in this major. A config that\n# still uses them fails loud at startup. Top-level 'llm:', 'mcp:', 'rag:' now\n# own those concerns; pipeline behavior moves under 'pipeline.config'.\n";
|
|
3
|
+
export declare const get: (obj: unknown, ...keys: string[]) => unknown;
|
|
4
|
+
export declare function resolveEnvVars(value: unknown, env?: NodeJS.ProcessEnv): unknown;
|
|
5
|
+
export declare function loadYamlConfig(filePath: string, env?: NodeJS.ProcessEnv): YamlConfig;
|
|
6
|
+
export declare function generateConfigTemplate(outputPath: string): void;
|
|
7
|
+
//# sourceMappingURL=yaml-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-loader.d.ts","sourceRoot":"","sources":["../../src/smart-agent/yaml-loader.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,eAAO,MAAM,aAAa,8tMAqHzB,CAAC;AAEF,eAAO,MAAM,GAAG,GAAI,KAAK,OAAO,EAAE,GAAG,MAAM,MAAM,EAAE,KAAG,OAM7C,CAAC;AAEV,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAeT;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,UAAU,CAGZ;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAE/D"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { parse as parseYaml } from 'yaml';
|
|
3
|
+
export const YAML_TEMPLATE = `port: 4004
|
|
4
|
+
host: 0.0.0.0
|
|
5
|
+
|
|
6
|
+
# Request routing mode:
|
|
7
|
+
# hard — Fully managed context. Ignores client history/system prompt. Uses RAG + internal MCP tools only.
|
|
8
|
+
# pass — Transparent proxy. Logs everything but modifies nothing.
|
|
9
|
+
# smart — Hybrid. Preserves client history but enriches it with RAG context and MCP tools based on analysis. (default)
|
|
10
|
+
mode: smart
|
|
11
|
+
|
|
12
|
+
llm:
|
|
13
|
+
provider: deepseek # deepseek | openai | anthropic | sap-ai-sdk | ollama
|
|
14
|
+
apiKey: \${DEEPSEEK_API_KEY} # not required for ollama / sap-ai-sdk
|
|
15
|
+
model: deepseek-chat
|
|
16
|
+
temperature: 0.7
|
|
17
|
+
classifierTemperature: 0.1
|
|
18
|
+
|
|
19
|
+
rag:
|
|
20
|
+
type: in-memory # in-memory | qdrant | hana-vector | pg-vector
|
|
21
|
+
embedder: ollama # Embedder to use: ollama | openai | sap-ai-core | <custom>
|
|
22
|
+
url: http://localhost:11434
|
|
23
|
+
model: bge-m3
|
|
24
|
+
# resourceGroup: default # SAP AI Core resource group (sap-ai-core embedder)
|
|
25
|
+
# scenario: orchestration # SAP AI Core scenario: orchestration (default) | foundation-models
|
|
26
|
+
# collectionName: llm-agent # Collection/table name (qdrant | hana-vector | pg-vector)
|
|
27
|
+
dedupThreshold: 0.92
|
|
28
|
+
vectorWeight: 0.7 # Semantic similarity weight (0..1)
|
|
29
|
+
keywordWeight: 0.3 # Lexical matching weight (0..1)
|
|
30
|
+
|
|
31
|
+
mcp:
|
|
32
|
+
# type: none | http | stdio
|
|
33
|
+
# To disable MCP, set type to 'none'
|
|
34
|
+
type: http
|
|
35
|
+
url: http://localhost:3001/mcp/stream/http
|
|
36
|
+
|
|
37
|
+
agent:
|
|
38
|
+
externalToolsValidationMode: permissive # permissive | strict
|
|
39
|
+
maxIterations: 10
|
|
40
|
+
maxToolCalls: 30
|
|
41
|
+
toolUnavailableTtlMs: 600000 # Temporary tool blacklist TTL (ms)
|
|
42
|
+
ragQueryK: 10
|
|
43
|
+
# contextBudgetTokens: 4000 # Max tokens for RAG context in system prompt (0 = no limit)
|
|
44
|
+
# semanticHistoryEnabled: false # Enable semantic history via RAG
|
|
45
|
+
# historyRecencyWindow: 4 # Last N messages from client history in LLM context
|
|
46
|
+
# historyTurnSummaryPrompt: "..." # LLM prompt for turn summarization
|
|
47
|
+
showReasoning: false # Explain strategy at start of response
|
|
48
|
+
historyAutoSummarizeLimit: 10 # History length to trigger compression
|
|
49
|
+
queryExpansionEnabled: false # Expand RAG queries with LLM-generated synonyms
|
|
50
|
+
toolResultCacheTtlMs: 300000 # Tool result cache TTL (ms); 0 to disable
|
|
51
|
+
sessionTokenBudget: 0 # Multi-turn token budget; 0 to disable
|
|
52
|
+
# ragTranslateEnabled: true # Translate non-ASCII RAG queries to English (default: true)
|
|
53
|
+
# classificationEnabled: false # Enable for custom pipelines with multi-store routing
|
|
54
|
+
# toolReselectPerIteration: false # Re-select tools via RAG on each tool-loop iteration
|
|
55
|
+
# llmCallStrategy: streaming # streaming | non-streaming | fallback
|
|
56
|
+
# streamMode: full # full | final — streaming behavior for tool loops
|
|
57
|
+
# heartbeatIntervalMs: 5000 # SSE heartbeat interval during tool execution (ms)
|
|
58
|
+
# healthTimeoutMs: 5000 # Health check probe timeout (ms); increase for slow providers (SAP AI Core: 15000)
|
|
59
|
+
# retry: # LLM retry config for 429/5xx errors
|
|
60
|
+
# maxAttempts: 3
|
|
61
|
+
# backoffMs: 1000
|
|
62
|
+
# retryOn: [429, 500, 502, 503]
|
|
63
|
+
# retryOnMidStream: ['SSE stream'] # Substrings triggering mid-stream retry
|
|
64
|
+
|
|
65
|
+
# --- Advanced Multi-Model LLM (optional) ------------------------------------
|
|
66
|
+
# Assign different models for different internal roles via a top-level llm: map.
|
|
67
|
+
# (The legacy pipeline.llm override was removed — use the top-level llm: map now.)
|
|
68
|
+
# llm:
|
|
69
|
+
# main:
|
|
70
|
+
# provider: deepseek # deepseek | openai | anthropic | sap-ai-sdk
|
|
71
|
+
# apiKey: \${DEEPSEEK_API_KEY}
|
|
72
|
+
# model: deepseek-chat
|
|
73
|
+
# temperature: 0.7
|
|
74
|
+
# classifier: # optional; if absent, main config is reused
|
|
75
|
+
# provider: deepseek
|
|
76
|
+
# apiKey: \${DEEPSEEK_API_KEY}
|
|
77
|
+
# model: deepseek-chat
|
|
78
|
+
# temperature: 0.1
|
|
79
|
+
# helper: # optional; if absent, main config is reused
|
|
80
|
+
# provider: deepseek
|
|
81
|
+
# apiKey: \${DEEPSEEK_API_KEY}
|
|
82
|
+
# model: deepseek-chat
|
|
83
|
+
# temperature: 0.1
|
|
84
|
+
|
|
85
|
+
# prompts:
|
|
86
|
+
# system: "You are a helpful assistant specialized in SAP ABAP development."
|
|
87
|
+
# classifier: |
|
|
88
|
+
# You are an intent classifier... (see source for full default prompt)
|
|
89
|
+
# reasoning: |
|
|
90
|
+
# IMPORTANT: Always start your response with a brief <reasoning> block...
|
|
91
|
+
# ragTranslate: |
|
|
92
|
+
# Translate the user request to English for search purposes...
|
|
93
|
+
# historySummary: |
|
|
94
|
+
# Summarize the conversation so far...
|
|
95
|
+
|
|
96
|
+
log: smart-server.log # path to log file; omit for stdout
|
|
97
|
+
# logDir: sessions # Directory for detailed session debug logs
|
|
98
|
+
# pluginDir: ./my-plugins # Additional plugin directory (loaded after defaults)
|
|
99
|
+
# plugins: # Explicit plugin module specifiers (npm packages or paths)
|
|
100
|
+
# - "@scope/my-pipeline-plugin" # bare specifier resolved from cwd
|
|
101
|
+
# - ./local-plugin.mjs # relative path resolved against cwd
|
|
102
|
+
|
|
103
|
+
# subagents: # Optional: nested agents callable from pipeline
|
|
104
|
+
# - name: code-reviewer # Used as stage config: { agent: code-reviewer }
|
|
105
|
+
# description: | # Optional. Shown to the Coordinator planner LLM
|
|
106
|
+
# Reviews code and returns # so it can pick this agent for the right step.
|
|
107
|
+
# structured JSON.
|
|
108
|
+
# config: ./agents/code-reviewer.yaml
|
|
109
|
+
|
|
110
|
+
# pipeline: # Optional: select the request pipeline.
|
|
111
|
+
# name: flat # flat (default) | linear | dag | stepper | controller | controller-weak | <plugin>
|
|
112
|
+
# config: # Opaque per-pipeline dialect (validated by the plugin)
|
|
113
|
+
# mode: planned-react # e.g. stepper: cyclic-react | planned-react | deep-stepper
|
|
114
|
+
# knowledgeSeed: [] # stepper: deployment-supplied tool guidance
|
|
115
|
+
#
|
|
116
|
+
# NOTE: the legacy 'coordinator:' block and the old 'pipeline:' shape
|
|
117
|
+
# (mcp/rag/stages/llm overrides) were REMOVED in this major. A config that
|
|
118
|
+
# still uses them fails loud at startup. Top-level 'llm:', 'mcp:', 'rag:' now
|
|
119
|
+
# own those concerns; pipeline behavior moves under 'pipeline.config'.
|
|
120
|
+
`;
|
|
121
|
+
export const get = (obj, ...keys) => keys.reduce((o, k) => {
|
|
122
|
+
if (o !== null && typeof o === 'object' && k in o) {
|
|
123
|
+
return o[k];
|
|
124
|
+
}
|
|
125
|
+
return undefined;
|
|
126
|
+
}, obj);
|
|
127
|
+
export function resolveEnvVars(value, env = process.env) {
|
|
128
|
+
if (typeof value === 'string')
|
|
129
|
+
return value.replace(/\$\{([^}:]+)(?::-(.*?))?\}/g, (_, name, fallback) => env[name] || fallback || '');
|
|
130
|
+
if (Array.isArray(value))
|
|
131
|
+
return value.map((v) => resolveEnvVars(v, env));
|
|
132
|
+
if (value !== null && typeof value === 'object')
|
|
133
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [
|
|
134
|
+
k,
|
|
135
|
+
resolveEnvVars(v, env),
|
|
136
|
+
]));
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
export function loadYamlConfig(filePath, env = process.env) {
|
|
140
|
+
const raw = fs.readFileSync(filePath, 'utf8');
|
|
141
|
+
return resolveEnvVars(parseYaml(raw), env);
|
|
142
|
+
}
|
|
143
|
+
export function generateConfigTemplate(outputPath) {
|
|
144
|
+
fs.writeFileSync(outputPath, YAML_TEMPLATE, 'utf8');
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=yaml-loader.js.map
|
|
@@ -0,0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AK,KAAK,QAAQ;QAC7C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;YAC/D,CAAC;YACD,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC;SACvB,CAAC,CACH,CAAC;IACJ,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,CAAe,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-abap-adt/llm-agent-server-libs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"test": "node --import tsx/esm --test --test-reporter=spec 'src/**/*.test.ts'"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@mcp-abap-adt/llm-agent": "^
|
|
60
|
-
"@mcp-abap-adt/llm-agent-libs": "^
|
|
61
|
-
"@mcp-abap-adt/llm-agent-mcp": "^
|
|
62
|
-
"@mcp-abap-adt/llm-agent-rag": "^
|
|
59
|
+
"@mcp-abap-adt/llm-agent": "^20.4.0",
|
|
60
|
+
"@mcp-abap-adt/llm-agent-libs": "^20.4.0",
|
|
61
|
+
"@mcp-abap-adt/llm-agent-mcp": "^20.4.0",
|
|
62
|
+
"@mcp-abap-adt/llm-agent-rag": "^20.4.0",
|
|
63
63
|
"pg": "^8.21.0",
|
|
64
64
|
"yaml": "^2.9.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@mcp-abap-adt/sap-aicore-llm": "^
|
|
67
|
+
"@mcp-abap-adt/sap-aicore-llm": "^20.4.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|
|
70
70
|
"@mcp-abap-adt/sap-aicore-llm": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@mcp-abap-adt/sap-aicore-llm": "^
|
|
75
|
+
"@mcp-abap-adt/sap-aicore-llm": "^20.4.0",
|
|
76
76
|
"@types/pg": "^8.11.0"
|
|
77
77
|
},
|
|
78
78
|
"publishConfig": {
|