@mcp-abap-adt/llm-agent-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.
- package/README.md +11 -14
- package/dist/agent.d.ts +2 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +6 -5
- package/dist/agent.js.map +1 -1
- package/dist/builder.d.ts +36 -14
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +472 -348
- package/dist/builder.js.map +1 -1
- package/dist/config/config-watcher.d.ts.map +1 -1
- package/dist/config/config-watcher.js +9 -5
- package/dist/config/config-watcher.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp/vectorize-mcp-tools.d.ts.map +1 -1
- package/dist/mcp/vectorize-mcp-tools.js +21 -2
- package/dist/mcp/vectorize-mcp-tools.js.map +1 -1
- package/dist/pipeline/handlers/history-upsert.d.ts.map +1 -1
- package/dist/pipeline/handlers/history-upsert.js +8 -1
- package/dist/pipeline/handlers/history-upsert.js.map +1 -1
- package/dist/pipeline/handlers/rag-query.d.ts +1 -1
- package/dist/pipeline/handlers/rag-query.d.ts.map +1 -1
- package/dist/pipeline/handlers/rag-query.js +10 -2
- package/dist/pipeline/handlers/rag-query.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/types.d.ts +7 -0
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +85 -14
- package/dist/plugins/types.js.map +1 -1
- package/dist/session/session-graph-factory.d.ts +49 -16
- package/dist/session/session-graph-factory.d.ts.map +1 -1
- package/dist/session/session-graph-factory.js +140 -62
- package/dist/session/session-graph-factory.js.map +1 -1
- package/dist/skills/plugin-host/qdrant-store.d.ts +6 -1
- package/dist/skills/plugin-host/qdrant-store.d.ts.map +1 -1
- package/dist/skills/plugin-host/qdrant-store.js +7 -7
- package/dist/skills/plugin-host/qdrant-store.js.map +1 -1
- package/dist/util/stop-all.d.ts +19 -0
- package/dist/util/stop-all.d.ts.map +1 -0
- package/dist/util/stop-all.js +30 -0
- package/dist/util/stop-all.js.map +1 -0
- package/package.json +10 -38
- package/dist/coordinator/dag/reviewer-error-strategy.d.ts +0 -15
- package/dist/coordinator/dag/reviewer-error-strategy.d.ts.map +0 -1
- package/dist/coordinator/dag/reviewer-error-strategy.js +0 -38
- package/dist/coordinator/dag/reviewer-error-strategy.js.map +0 -1
- package/dist/providers.d.ts +0 -58
- package/dist/providers.d.ts.map +0 -1
- package/dist/providers.js +0 -225
- package/dist/providers.js.map +0 -1
- package/dist/skills/plugin-host/chunker.test.d.ts +0 -2
- package/dist/skills/plugin-host/chunker.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/chunker.test.js +0 -31
- package/dist/skills/plugin-host/chunker.test.js.map +0 -1
- package/dist/skills/plugin-host/compatible-skills-rag.test.d.ts +0 -2
- package/dist/skills/plugin-host/compatible-skills-rag.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/compatible-skills-rag.test.js +0 -174
- package/dist/skills/plugin-host/compatible-skills-rag.test.js.map +0 -1
- package/dist/skills/plugin-host/http-marketplace-source.test.d.ts +0 -2
- package/dist/skills/plugin-host/http-marketplace-source.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/http-marketplace-source.test.js +0 -71
- package/dist/skills/plugin-host/http-marketplace-source.test.js.map +0 -1
- package/dist/skills/plugin-host/in-memory-store.test.d.ts +0 -2
- package/dist/skills/plugin-host/in-memory-store.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/in-memory-store.test.js +0 -100
- package/dist/skills/plugin-host/in-memory-store.test.js.map +0 -1
- package/dist/skills/plugin-host/marketplace-adapter.test.d.ts +0 -2
- package/dist/skills/plugin-host/marketplace-adapter.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/marketplace-adapter.test.js +0 -46
- package/dist/skills/plugin-host/marketplace-adapter.test.js.map +0 -1
- package/dist/skills/plugin-host/qdrant-store.test.d.ts +0 -2
- package/dist/skills/plugin-host/qdrant-store.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/qdrant-store.test.js +0 -396
- package/dist/skills/plugin-host/qdrant-store.test.js.map +0 -1
- package/dist/skills/plugin-host/skill-plugin-host.ingest.test.d.ts +0 -2
- package/dist/skills/plugin-host/skill-plugin-host.ingest.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/skill-plugin-host.ingest.test.js +0 -520
- package/dist/skills/plugin-host/skill-plugin-host.ingest.test.js.map +0 -1
- package/dist/skills/plugin-host/skill-plugin-host.recall-and-reload.test.d.ts +0 -2
- package/dist/skills/plugin-host/skill-plugin-host.recall-and-reload.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/skill-plugin-host.recall-and-reload.test.js +0 -328
- package/dist/skills/plugin-host/skill-plugin-host.recall-and-reload.test.js.map +0 -1
- package/dist/skills/plugin-host/skills-rag-source.test.d.ts +0 -2
- package/dist/skills/plugin-host/skills-rag-source.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/skills-rag-source.test.js +0 -69
- package/dist/skills/plugin-host/skills-rag-source.test.js.map +0 -1
- package/dist/skills/plugin-host/source-strategies.test.d.ts +0 -2
- package/dist/skills/plugin-host/source-strategies.test.d.ts.map +0 -1
- package/dist/skills/plugin-host/source-strategies.test.js +0 -52
- package/dist/skills/plugin-host/source-strategies.test.js.map +0 -1
package/dist/plugins/types.js
CHANGED
|
@@ -16,11 +16,37 @@ export function emptyLoadedPlugins() {
|
|
|
16
16
|
clientAdapters: [],
|
|
17
17
|
apiAdapters: new Map(),
|
|
18
18
|
pipelinePlugins: new Map(),
|
|
19
|
+
pipelinePluginFactories: new Map(),
|
|
19
20
|
pipelinePluginSources: new Map(),
|
|
20
21
|
loadedFiles: [],
|
|
21
22
|
errors: [],
|
|
22
23
|
};
|
|
23
24
|
}
|
|
25
|
+
const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
26
|
+
const kindOf = (v) => (v === null ? 'null' : typeof v);
|
|
27
|
+
/**
|
|
28
|
+
* What is wrong with a value offered as a pipeline plugin under `key`, or
|
|
29
|
+
* `undefined` when nothing is. An imported module is `unknown` until something
|
|
30
|
+
* inspects it, so this is the check that makes the cast after it honest (§4.6.7).
|
|
31
|
+
* The loader runs it on an instance export; the server runs it on a factory's result.
|
|
32
|
+
*/
|
|
33
|
+
export function describePipelinePluginDefect(value, key) {
|
|
34
|
+
if (typeof value !== 'object' || value === null) {
|
|
35
|
+
return `expected an object with 'name' and 'build', got ${kindOf(value)}`;
|
|
36
|
+
}
|
|
37
|
+
const { name, build } = value;
|
|
38
|
+
const missing = [];
|
|
39
|
+
if (typeof name !== 'string')
|
|
40
|
+
missing.push(`'name' must be a string, got ${kindOf(name)}`);
|
|
41
|
+
if (typeof build !== 'function')
|
|
42
|
+
missing.push(`'build' must be a function, got ${kindOf(build)}`);
|
|
43
|
+
if (missing.length > 0)
|
|
44
|
+
return missing.join('; ');
|
|
45
|
+
if (name !== key) {
|
|
46
|
+
return `its name '${String(name)}' differs from the key '${key}' it is registered under`;
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
24
50
|
/**
|
|
25
51
|
* Merges a single plugin module's exports into a {@link LoadedPlugins} result.
|
|
26
52
|
* Useful for custom `IPluginLoader` implementations.
|
|
@@ -80,21 +106,66 @@ export function mergePluginExports(result, mod, source) {
|
|
|
80
106
|
}
|
|
81
107
|
}
|
|
82
108
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
// One key space for instances and factories; the first source keeps a key.
|
|
110
|
+
const claim = (key) => {
|
|
111
|
+
const prior = result.pipelinePluginSources.get(key);
|
|
112
|
+
if (prior === undefined)
|
|
113
|
+
return true;
|
|
114
|
+
result.errors.push({
|
|
115
|
+
file: source,
|
|
116
|
+
error: `duplicate pipeline name '${key}' from '${source}'; already registered by '${prior}' (keeping the first)`,
|
|
117
|
+
});
|
|
118
|
+
return false;
|
|
119
|
+
};
|
|
120
|
+
if (mod.pipelinePlugins !== undefined) {
|
|
121
|
+
if (!isRecord(mod.pipelinePlugins)) {
|
|
122
|
+
result.errors.push({
|
|
123
|
+
file: source,
|
|
124
|
+
error: `'pipelinePlugins' from '${source}' must be an object keyed by pipeline name`,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
for (const [key, plugin] of Object.entries(mod.pipelinePlugins)) {
|
|
129
|
+
const defect = describePipelinePluginDefect(plugin, key);
|
|
130
|
+
if (defect !== undefined) {
|
|
131
|
+
result.errors.push({
|
|
132
|
+
file: source,
|
|
133
|
+
error: `pipeline plugin '${key}' from '${source}' refused: ${defect}`,
|
|
134
|
+
});
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (!claim(key))
|
|
138
|
+
continue;
|
|
139
|
+
result.pipelinePlugins.set(key, plugin);
|
|
140
|
+
result.pipelinePluginSources.set(key, source);
|
|
141
|
+
registered = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (mod.pipelinePluginFactories !== undefined) {
|
|
146
|
+
if (!isRecord(mod.pipelinePluginFactories)) {
|
|
147
|
+
result.errors.push({
|
|
148
|
+
file: source,
|
|
149
|
+
error: `'pipelinePluginFactories' from '${source}' must be an object keyed by pipeline name`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
result.pipelinePluginFactories ??= new Map();
|
|
154
|
+
const factories = result.pipelinePluginFactories;
|
|
155
|
+
for (const [key, factory] of Object.entries(mod.pipelinePluginFactories)) {
|
|
156
|
+
if (typeof factory !== 'function') {
|
|
157
|
+
result.errors.push({
|
|
158
|
+
file: source,
|
|
159
|
+
error: `pipeline plugin factory '${key}' from '${source}' refused: expected a function, got ${kindOf(factory)}`,
|
|
160
|
+
});
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (!claim(key))
|
|
164
|
+
continue;
|
|
165
|
+
factories.set(key, factory);
|
|
166
|
+
result.pipelinePluginSources.set(key, source);
|
|
167
|
+
registered = true;
|
|
94
168
|
}
|
|
95
|
-
result.pipelinePlugins.set(name, plugin);
|
|
96
|
-
result.pipelinePluginSources.set(name, source);
|
|
97
|
-
registered = true;
|
|
98
169
|
}
|
|
99
170
|
}
|
|
100
171
|
if (registered) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,aAAa,EAAE,IAAI,GAAG,EAAE;QACxB,iBAAiB,EAAE,EAAE;QACrB,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,IAAI,GAAG,EAAE;QACtB,eAAe,EAAE,IAAI,GAAG,EAAE;QAC1B,uBAAuB,EAAE,IAAI,GAAG,EAAE;QAClC,qBAAqB,EAAE,IAAI,GAAG,EAAE;QAChC,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,EAAE;KACX,CAAC;AACJ,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CAC5D,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3D,MAAM,MAAM,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,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C,MAAM,4CAA4C;aAC7F,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,uBAAuB,KAAK,IAAI,GAAG,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,uBAAuB,CAAC;YACjD,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CACzC,GAAG,CAAC,uBAAuB,CAC5B,EAAE,CAAC;gBACF,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;oBAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;wBACjB,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,4BAA4B,GAAG,WAAW,MAAM,uCAAuC,MAAM,CAAC,OAAO,CAAC,EAAE;qBAChH,CAAC,CAAC;oBACH,SAAS;gBACX,CAAC;gBACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;oBAAE,SAAS;gBAC1B,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,OAAgC,CAAC,CAAC;gBACrD,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;gBAC9C,UAAU,GAAG,IAAI,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnyLogger, IMcpClient, IMcpServer, IRag, IRagRegistry, McpClientDescriptor } from '@mcp-abap-adt/llm-agent';
|
|
2
2
|
import type { SmartAgent } from '../agent.js';
|
|
3
3
|
import { SessionRequestLogger } from '../logger/session-request-logger.js';
|
|
4
4
|
import { SessionGraph } from './session-graph.js';
|
|
@@ -29,13 +29,27 @@ export interface SessionAgentParts {
|
|
|
29
29
|
readonly logger: SessionRequestLogger;
|
|
30
30
|
}
|
|
31
31
|
export interface SessionGraphFactoryOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Servers for THIS caller: the factory starts each one before `buildAgent`,
|
|
34
|
+
* hands the clients over, and stops them last on dispose. Takes the identity,
|
|
35
|
+
* which is what per-caller credentials need and what `mcpClientFactory` never
|
|
36
|
+
* had.
|
|
37
|
+
*
|
|
38
|
+
* When set it takes precedence over `mcpClientFactory` and
|
|
39
|
+
* `mcpClientFactoryWithDescriptors`.
|
|
40
|
+
*/
|
|
41
|
+
readonly mcpServerFactory?: (identity: SessionGraphIdentity) => IMcpServer[];
|
|
32
42
|
/**
|
|
33
43
|
* Resolve this session's MCP client(s). Per-session-CAPABLE: the default
|
|
34
44
|
* factory returns the shared GLOBAL client(s) by reference (no re-connect);
|
|
35
45
|
* a creds-aware build (out of scope) returns a fresh per-session client.
|
|
36
46
|
* Either way the tools-catalog RAG is never re-vectorized.
|
|
47
|
+
*
|
|
48
|
+
* @deprecated Use `mcpServerFactory`, which also owns lifetime and receives
|
|
49
|
+
* the identity. Optional since this release: supply exactly one of
|
|
50
|
+
* `mcpServerFactory`, `mcpClientFactoryWithDescriptors` or this.
|
|
37
51
|
*/
|
|
38
|
-
readonly mcpClientFactory
|
|
52
|
+
readonly mcpClientFactory?: (identity: SessionGraphIdentity) => IMcpClient[];
|
|
39
53
|
/**
|
|
40
54
|
* ADDITIVE descriptor-aware seam (#244): when set, takes precedence over
|
|
41
55
|
* `mcpClientFactory` and pairs the resolved clients with the STABLE
|
|
@@ -44,6 +58,10 @@ export interface SessionGraphFactoryOptions {
|
|
|
44
58
|
* active slots `[0,2]` collapse to array indices `[0,1]`). `mcpClientFactory`
|
|
45
59
|
* stays required for back-compat; this field is optional and, when absent,
|
|
46
60
|
* `build()` falls back to `mcpClientFactory` (descriptors stay `undefined`).
|
|
61
|
+
*
|
|
62
|
+
* @deprecated Use `mcpServerFactory`, which also owns lifetime and receives
|
|
63
|
+
* the identity. Optional since this release: supply exactly one of
|
|
64
|
+
* `mcpServerFactory`, this or `mcpClientFactory`.
|
|
47
65
|
*/
|
|
48
66
|
readonly mcpClientFactoryWithDescriptors?: (identity: SessionGraphIdentity) => {
|
|
49
67
|
clients: IMcpClient[];
|
|
@@ -52,8 +70,22 @@ export interface SessionGraphFactoryOptions {
|
|
|
52
70
|
};
|
|
53
71
|
/** GLOBAL vectorized tools-catalog RAG — injected by reference, never re-vectorized. */
|
|
54
72
|
readonly toolsRag: IRag | undefined;
|
|
55
|
-
/**
|
|
56
|
-
|
|
73
|
+
/**
|
|
74
|
+
* One RAG registry shared by every session, when `ragRegistryFactory` is
|
|
75
|
+
* absent. Its collections are addressed by name, so every session sees
|
|
76
|
+
* every collection it holds — the per-call filter is the only isolation.
|
|
77
|
+
* Supply exactly one of this or `ragRegistryFactory`.
|
|
78
|
+
*/
|
|
79
|
+
readonly ragRegistry?: IRagRegistry;
|
|
80
|
+
/**
|
|
81
|
+
* Builds the registry THIS session owns (§6.4): handed to `buildAgent`, and
|
|
82
|
+
* the one `dispose()` closes — the shared `ragRegistry` is then neither used
|
|
83
|
+
* nor closed. Receives the full identity, which a build callback cannot
|
|
84
|
+
* (`SessionAgentParts` has no userId), and is awaited, because hydration is
|
|
85
|
+
* asynchronous (describeCollections, openCollection). Called before any MCP
|
|
86
|
+
* server starts, so a rejection leaves nothing to stop.
|
|
87
|
+
*/
|
|
88
|
+
readonly ragRegistryFactory?: (identity: SessionGraphIdentity) => Promise<IRagRegistry>;
|
|
57
89
|
/**
|
|
58
90
|
* Builds the per-session SmartAgent + FRESH per-session workers from `parts`.
|
|
59
91
|
* Production wiring runs a `SmartAgentBuilder.build()` with the injected globals
|
|
@@ -67,8 +99,10 @@ export interface SessionGraphFactoryOptions {
|
|
|
67
99
|
* (`ragRegistry.closeSession` returning `{ ok: false }`). Without a logger
|
|
68
100
|
* the failure falls back to `console.warn` so it is never silent. The
|
|
69
101
|
* dispose hook never throws — a failed close must not crash session teardown.
|
|
102
|
+
* An ordinary text logger (`ITextLogger`) is also accepted; it is normalised
|
|
103
|
+
* to the event `ILogger` once, at the constructor.
|
|
70
104
|
*/
|
|
71
|
-
readonly logger?:
|
|
105
|
+
readonly logger?: AnyLogger;
|
|
72
106
|
/**
|
|
73
107
|
* Optional per-session teardown hook run during `SessionGraph.dispose()`,
|
|
74
108
|
* AFTER the session-RAG `closeSession`. The host uses this to free per-session
|
|
@@ -78,21 +112,20 @@ export interface SessionGraphFactoryOptions {
|
|
|
78
112
|
* crashes the registry.
|
|
79
113
|
*/
|
|
80
114
|
readonly onDispose?: (sessionId: string) => Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Per-session teardown that must run BEFORE the session's RAG collections are
|
|
117
|
+
* deleted — closing a pipeline still in flight, which must not write into a
|
|
118
|
+
* collection being removed.
|
|
119
|
+
*
|
|
120
|
+
* `onDispose` keeps its documented place after `closeSession`; this hook is
|
|
121
|
+
* the one that runs first.
|
|
122
|
+
*/
|
|
123
|
+
readonly closePipeline?: (sessionId: string) => Promise<void>;
|
|
81
124
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Central per-session composition path (spec A.2). Assembles a SessionGraph by
|
|
84
|
-
* injecting the GLOBAL heavy resources (vectorized toolsRag, RAG registry,
|
|
85
|
-
* cached per-worker LLM/embedder) by reference — never re-vectorizing tools or
|
|
86
|
-
* rebuilding LLM clients — resolving this session's MCP client(s) via
|
|
87
|
-
* `mcpClientFactory(identity)` (default: shared global by reference), and
|
|
88
|
-
* allocating the cheap per-session instances (logger + sessionId-keyed
|
|
89
|
-
* registries + the per-session agent/pipeline/interpreter/coordinator/WORKERS).
|
|
90
|
-
* The per-session worker set is FRESH per session (re-wired via buildAgent
|
|
91
|
-
* with the session logger), never the server's global worker map.
|
|
92
|
-
*/
|
|
93
125
|
export declare class SessionGraphFactory {
|
|
94
126
|
private readonly opts;
|
|
95
127
|
constructor(opts: SessionGraphFactoryOptions);
|
|
128
|
+
private resolveRagRegistry;
|
|
96
129
|
build(identity: SessionGraphIdentity): Promise<SessionGraph>;
|
|
97
130
|
}
|
|
98
131
|
//# sourceMappingURL=session-graph-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-graph-factory.d.ts","sourceRoot":"","sources":["../../src/session/session-graph-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"session-graph-factory.d.ts","sourceRoot":"","sources":["../../src/session/session-graph-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAET,UAAU,EACV,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAI3E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/D,iFAAiF;IACjF,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;CACvC;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,gBAAgB,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CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC;CA0KnE"}
|
|
@@ -1,96 +1,174 @@
|
|
|
1
|
+
import { collectServerDescriptors, normaliseLogger, } from '@mcp-abap-adt/llm-agent';
|
|
1
2
|
import { SessionRequestLogger } from '../logger/session-request-logger.js';
|
|
2
3
|
import { PendingToolResultsRegistry } from '../policy/pending-tool-results-registry.js';
|
|
3
4
|
import { ToolAvailabilityRegistry } from '../policy/tool-availability-registry.js';
|
|
5
|
+
import { stopAll } from '../util/stop-all.js';
|
|
4
6
|
import { SessionGraph } from './session-graph.js';
|
|
5
|
-
/**
|
|
6
|
-
* Central per-session composition path (spec A.2). Assembles a SessionGraph by
|
|
7
|
-
* injecting the GLOBAL heavy resources (vectorized toolsRag, RAG registry,
|
|
8
|
-
* cached per-worker LLM/embedder) by reference — never re-vectorizing tools or
|
|
9
|
-
* rebuilding LLM clients — resolving this session's MCP client(s) via
|
|
10
|
-
* `mcpClientFactory(identity)` (default: shared global by reference), and
|
|
11
|
-
* allocating the cheap per-session instances (logger + sessionId-keyed
|
|
12
|
-
* registries + the per-session agent/pipeline/interpreter/coordinator/WORKERS).
|
|
13
|
-
* The per-session worker set is FRESH per session (re-wired via buildAgent
|
|
14
|
-
* with the session logger), never the server's global worker map.
|
|
15
|
-
*/
|
|
16
7
|
export class SessionGraphFactory {
|
|
17
8
|
opts;
|
|
18
9
|
constructor(opts) {
|
|
19
|
-
this.opts = opts
|
|
10
|
+
this.opts = opts.logger
|
|
11
|
+
? { ...opts, logger: normaliseLogger(opts.logger) }
|
|
12
|
+
: opts;
|
|
13
|
+
}
|
|
14
|
+
async resolveRagRegistry(identity) {
|
|
15
|
+
if (this.opts.ragRegistryFactory) {
|
|
16
|
+
return this.opts.ragRegistryFactory(identity);
|
|
17
|
+
}
|
|
18
|
+
if (this.opts.ragRegistry)
|
|
19
|
+
return this.opts.ragRegistry;
|
|
20
|
+
throw new Error('SessionGraphFactory needs one of ragRegistryFactory or ragRegistry');
|
|
20
21
|
}
|
|
21
22
|
async build(identity) {
|
|
23
|
+
if (!this.opts.mcpServerFactory &&
|
|
24
|
+
!this.opts.mcpClientFactoryWithDescriptors &&
|
|
25
|
+
!this.opts.mcpClientFactory)
|
|
26
|
+
throw new Error('SessionGraphFactory needs one of mcpServerFactory, mcpClientFactoryWithDescriptors or mcpClientFactory');
|
|
27
|
+
// Before any MCP server starts: a factory that rejects leaves nothing to stop.
|
|
28
|
+
const ragRegistry = await this.resolveRagRegistry(identity);
|
|
22
29
|
const logger = new SessionRequestLogger();
|
|
23
30
|
const toolAvailability = new ToolAvailabilityRegistry();
|
|
24
31
|
const pendingToolResults = new PendingToolResultsRegistry();
|
|
25
32
|
let mcpClients;
|
|
26
33
|
let mcpClientDescriptors;
|
|
27
34
|
let configuredSlotCount;
|
|
28
|
-
|
|
35
|
+
const startedServers = [];
|
|
36
|
+
if (this.opts.mcpServerFactory) {
|
|
37
|
+
const servers = this.opts.mcpServerFactory(identity);
|
|
38
|
+
// All or none — see the builder's identical check and why it throws.
|
|
39
|
+
const descriptors = collectServerDescriptors(servers, 'mcpServerFactory');
|
|
40
|
+
const clients = [];
|
|
41
|
+
try {
|
|
42
|
+
for (const server of servers) {
|
|
43
|
+
clients.push(await server.start());
|
|
44
|
+
startedServers.push(server);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
await stopAll(startedServers.splice(0).map((server) => () => server.stop()));
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
mcpClients = clients;
|
|
52
|
+
mcpClientDescriptors = descriptors;
|
|
53
|
+
// Nothing was filtered out of a configured set, so there is no original
|
|
54
|
+
// count to preserve; array position is the pairing.
|
|
55
|
+
configuredSlotCount = undefined;
|
|
56
|
+
}
|
|
57
|
+
else if (this.opts.mcpClientFactoryWithDescriptors) {
|
|
29
58
|
const built = this.opts.mcpClientFactoryWithDescriptors(identity);
|
|
30
59
|
mcpClients = built.clients;
|
|
31
60
|
mcpClientDescriptors = built.clientDescriptors;
|
|
32
61
|
configuredSlotCount = built.configuredSlotCount;
|
|
33
62
|
}
|
|
34
63
|
else {
|
|
35
|
-
|
|
64
|
+
// The guard at the top of build() has already ruled out "none set".
|
|
65
|
+
mcpClients = this.opts.mcpClientFactory?.(identity) ?? [];
|
|
36
66
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
// Host-supplied per-session teardown (e.g. pipeline IPipelineInstance.close).
|
|
73
|
-
// Best-effort: a failure here must not crash session disposal.
|
|
74
|
-
if (this.opts.onDispose) {
|
|
75
|
-
try {
|
|
76
|
-
await this.opts.onDispose(sessionId);
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
67
|
+
// `buildAgent` runs a full `SmartAgentBuilder.build()` — model validation,
|
|
68
|
+
// network work — and can throw. When it does, no `SessionGraph` is
|
|
69
|
+
// constructed, so `dispose()` never runs and `startedServers` becomes
|
|
70
|
+
// unreachable: stop them here, on the ORIGINAL failure, before rethrowing.
|
|
71
|
+
let agent;
|
|
72
|
+
let graph;
|
|
73
|
+
try {
|
|
74
|
+
agent = await this.opts.buildAgent({
|
|
75
|
+
sessionId: identity.sessionId,
|
|
76
|
+
mcpClients,
|
|
77
|
+
mcpClientDescriptors,
|
|
78
|
+
configuredSlotCount,
|
|
79
|
+
toolsRag: this.opts.toolsRag,
|
|
80
|
+
ragRegistry,
|
|
81
|
+
logger,
|
|
82
|
+
});
|
|
83
|
+
graph = new SessionGraph({
|
|
84
|
+
sessionId: identity.sessionId,
|
|
85
|
+
toolAvailability,
|
|
86
|
+
pendingToolResults,
|
|
87
|
+
logger,
|
|
88
|
+
agent,
|
|
89
|
+
// Closes this session's collections in the registry it was built with
|
|
90
|
+
// — its own when `ragRegistryFactory` supplied one, the shared one
|
|
91
|
+
// otherwise; global and user collections survive. The Result<void,
|
|
92
|
+
// RagError> is INSPECTED here — a failed close is surfaced via the
|
|
93
|
+
// optional logger (or console.warn fallback), never silently dropped
|
|
94
|
+
// (review MEDIUM #2).
|
|
95
|
+
dispose: async (sessionId) => {
|
|
96
|
+
// Single sink for every best-effort teardown failure below: routes to
|
|
97
|
+
// the configured logger, or console.warn when there is none. Each call
|
|
98
|
+
// site's two message strings are unchanged from before this helper
|
|
99
|
+
// existed — the teardown tests assert on them.
|
|
100
|
+
const warn = (logMessage, consoleMessage) => {
|
|
80
101
|
if (this.opts.logger) {
|
|
81
102
|
this.opts.logger.log({
|
|
82
103
|
type: 'warning',
|
|
83
104
|
traceId: `session:${sessionId}`,
|
|
84
|
-
message:
|
|
105
|
+
message: logMessage,
|
|
85
106
|
});
|
|
86
107
|
}
|
|
87
108
|
else {
|
|
88
|
-
console.warn(
|
|
109
|
+
console.warn(consoleMessage);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
// Runs first: a pipeline still in flight must not write into a session
|
|
113
|
+
// collection that `closeSession` is about to delete. Best-effort, like
|
|
114
|
+
// every other step here.
|
|
115
|
+
if (this.opts.closePipeline) {
|
|
116
|
+
try {
|
|
117
|
+
await this.opts.closePipeline(sessionId);
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
121
|
+
warn(`session_close_pipeline_failed: ${message}`, `[session] closePipeline(${sessionId}) failed: ${message}`);
|
|
89
122
|
}
|
|
90
123
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
124
|
+
// Best-effort like every other step here: a REJECTING closeSession
|
|
125
|
+
// must not skip onDispose/stop below it, exactly like a resolved
|
|
126
|
+
// `{ ok: false }` result must not (handled right underneath). Both
|
|
127
|
+
// cases route through the same two message strings — unchanged —
|
|
128
|
+
// since the pre-existing teardown tests assert on them.
|
|
129
|
+
try {
|
|
130
|
+
const res = await ragRegistry.closeSession(sessionId);
|
|
131
|
+
if (!res.ok) {
|
|
132
|
+
const message = res.error?.message ?? String(res.error);
|
|
133
|
+
warn(`session_close_failed: ${message}`, `[session] closeSession(${sessionId}) failed: ${message}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
138
|
+
warn(`session_close_failed: ${message}`, `[session] closeSession(${sessionId}) failed: ${message}`);
|
|
139
|
+
}
|
|
140
|
+
// Host-supplied per-session teardown (e.g. pipeline IPipelineInstance.close).
|
|
141
|
+
// Best-effort: a failure here must not crash session disposal.
|
|
142
|
+
if (this.opts.onDispose) {
|
|
143
|
+
try {
|
|
144
|
+
await this.opts.onDispose(sessionId);
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
148
|
+
warn(`session_dispose_hook_failed: ${message}`, `[session] onDispose(${sessionId}) failed: ${message}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Last: the clients outlive the pipeline that was still calling them.
|
|
152
|
+
for (const server of startedServers) {
|
|
153
|
+
try {
|
|
154
|
+
await server.stop();
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
158
|
+
warn(`session_mcp_stop_failed: ${message}`, `[session] mcp stop(${sessionId}) failed: ${message}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
// `buildAgent` (or, in principle, the `SessionGraph` construction above)
|
|
166
|
+
// threw before a `SessionGraph` exists to own teardown — nothing else
|
|
167
|
+
// will ever stop these servers. Stop them here, on the ORIGINAL error.
|
|
168
|
+
await stopAll(startedServers.map((server) => () => server.stop()));
|
|
169
|
+
throw err;
|
|
170
|
+
}
|
|
171
|
+
return graph;
|
|
94
172
|
}
|
|
95
173
|
}
|
|
96
174
|
//# sourceMappingURL=session-graph-factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-graph-factory.js","sourceRoot":"","sources":["../../src/session/session-graph-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-graph-factory.js","sourceRoot":"","sources":["../../src/session/session-graph-factory.ts"],"names":[],"mappings":"AASA,OAAO,EACL,wBAAwB,EACxB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA0JlD,MAAM,OAAO,mBAAmB;IACb,IAAI,CAAuC;IAE5D,YAAY,IAAgC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM;YACrB,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACnD,CAAC,CAAE,IAA6C,CAAC;IACrD,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAC9B,QAA8B;QAE9B,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAA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,CAAC,IAAI,EAAE,CAAC;wBACtB,CAAC;wBAAC,OAAO,GAAG,EAAE,CAAC;4BACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;4BACjE,IAAI,CACF,4BAA4B,OAAO,EAAE,EACrC,sBAAsB,SAAS,aAAa,OAAO,EAAE,CACtD,CAAC;wBACJ,CAAC;oBACH,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,yEAAyE;YACzE,sEAAsE;YACtE,uEAAuE;YACvE,MAAM,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YACnE,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IApiKeyCredential } from '@mcp-abap-adt/interfaces-auth';
|
|
1
2
|
import type { CallOptions, CatalogEntry, CatalogSnapshot, ISkillsRagBackendProvider, ISkillsStoreProvider } from '@mcp-abap-adt/llm-agent';
|
|
2
3
|
export interface QdrantPoint {
|
|
3
4
|
id: string;
|
|
@@ -57,7 +58,11 @@ export declare function makePgCatalogReader(deps: {
|
|
|
57
58
|
}): ICatalogReader;
|
|
58
59
|
interface QdrantRestOptions {
|
|
59
60
|
url: string;
|
|
60
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Asked for on every request — never cached — so a rotating key rotates.
|
|
63
|
+
* Optional: an unauthenticated Qdrant works without one, as before.
|
|
64
|
+
*/
|
|
65
|
+
credential?: IApiKeyCredential;
|
|
61
66
|
collection: string;
|
|
62
67
|
}
|
|
63
68
|
/** Read-only Qdrant reader (search + scroll). Used by recall-only with a read key. */
|
|
@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oF;AACpF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,aAAa,CA+BvE;AAoDD,kFAAkF;AAClF,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,cAAc,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,yBAAyB,CAS5B;AAMD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,aAAa,CAAC;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,uBAAuB,GAC5B,oBAAoB,CAiLtB"}
|
|
@@ -251,10 +251,10 @@ function toQdrantFilter(filter) {
|
|
|
251
251
|
}
|
|
252
252
|
return { must };
|
|
253
253
|
}
|
|
254
|
-
function qdrantHeaders(
|
|
254
|
+
async function qdrantHeaders(credential) {
|
|
255
255
|
const h = { 'content-type': 'application/json' };
|
|
256
|
-
if (
|
|
257
|
-
h['api-key'] =
|
|
256
|
+
if (credential)
|
|
257
|
+
h['api-key'] = await credential.secret();
|
|
258
258
|
return h;
|
|
259
259
|
}
|
|
260
260
|
function makeQdrantReaderImpl(opts) {
|
|
@@ -263,7 +263,7 @@ function makeQdrantReaderImpl(opts) {
|
|
|
263
263
|
async search(filter, vector, k, options) {
|
|
264
264
|
const res = await fetch(`${base}/points/search`, {
|
|
265
265
|
method: 'POST',
|
|
266
|
-
headers: qdrantHeaders(opts.
|
|
266
|
+
headers: await qdrantHeaders(opts.credential),
|
|
267
267
|
body: JSON.stringify({
|
|
268
268
|
vector,
|
|
269
269
|
limit: k,
|
|
@@ -280,7 +280,7 @@ function makeQdrantReaderImpl(opts) {
|
|
|
280
280
|
async scroll(filter, cursor) {
|
|
281
281
|
const res = await fetch(`${base}/points/scroll`, {
|
|
282
282
|
method: 'POST',
|
|
283
|
-
headers: qdrantHeaders(opts.
|
|
283
|
+
headers: await qdrantHeaders(opts.credential),
|
|
284
284
|
body: JSON.stringify({
|
|
285
285
|
limit: 256,
|
|
286
286
|
with_payload: true,
|
|
@@ -317,7 +317,7 @@ export function makeQdrantClient(opts) {
|
|
|
317
317
|
const q = upsertOpts?.wait ? '?wait=true' : '';
|
|
318
318
|
const res = await fetch(`${base}/points${q}`, {
|
|
319
319
|
method: 'PUT',
|
|
320
|
-
headers: qdrantHeaders(opts.
|
|
320
|
+
headers: await qdrantHeaders(opts.credential),
|
|
321
321
|
body: JSON.stringify({
|
|
322
322
|
points: points.map((p) => ({
|
|
323
323
|
id: p.id,
|
|
@@ -332,7 +332,7 @@ export function makeQdrantClient(opts) {
|
|
|
332
332
|
async deleteByFilter(filter) {
|
|
333
333
|
const res = await fetch(`${base}/points/delete`, {
|
|
334
334
|
method: 'POST',
|
|
335
|
-
headers: qdrantHeaders(opts.
|
|
335
|
+
headers: await qdrantHeaders(opts.credential),
|
|
336
336
|
body: JSON.stringify({
|
|
337
337
|
filter: toQdrantFilter(filter),
|
|
338
338
|
}),
|