@mcp-abap-adt/llm-agent 2.9.2 → 2.10.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/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/smart-agent/agent.d.ts +18 -1
- package/dist/smart-agent/agent.d.ts.map +1 -1
- package/dist/smart-agent/agent.js +176 -21
- package/dist/smart-agent/agent.js.map +1 -1
- package/dist/smart-agent/builder.d.ts +114 -51
- package/dist/smart-agent/builder.d.ts.map +1 -1
- package/dist/smart-agent/builder.js +234 -110
- package/dist/smart-agent/builder.js.map +1 -1
- package/dist/smart-agent/cli.d.ts +1 -0
- package/dist/smart-agent/cli.d.ts.map +1 -1
- package/dist/smart-agent/cli.js +2 -0
- package/dist/smart-agent/cli.js.map +1 -1
- package/dist/smart-agent/config/config-watcher.d.ts +4 -0
- package/dist/smart-agent/config/config-watcher.d.ts.map +1 -1
- package/dist/smart-agent/config/config-watcher.js +8 -0
- package/dist/smart-agent/config/config-watcher.js.map +1 -1
- package/dist/smart-agent/config.d.ts +2 -1
- package/dist/smart-agent/config.d.ts.map +1 -1
- package/dist/smart-agent/config.js +46 -4
- package/dist/smart-agent/config.js.map +1 -1
- package/dist/smart-agent/interfaces/index.d.ts +1 -1
- package/dist/smart-agent/interfaces/index.d.ts.map +1 -1
- package/dist/smart-agent/interfaces/index.js.map +1 -1
- package/dist/smart-agent/interfaces/rag.d.ts +16 -0
- package/dist/smart-agent/interfaces/rag.d.ts.map +1 -1
- package/dist/smart-agent/pipeline/condition-evaluator.d.ts +35 -0
- package/dist/smart-agent/pipeline/condition-evaluator.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/condition-evaluator.js +143 -0
- package/dist/smart-agent/pipeline/condition-evaluator.js.map +1 -0
- package/dist/smart-agent/pipeline/context.d.ts +104 -0
- package/dist/smart-agent/pipeline/context.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/context.js +19 -0
- package/dist/smart-agent/pipeline/context.js.map +1 -0
- package/dist/smart-agent/pipeline/default-pipeline.d.ts +45 -0
- package/dist/smart-agent/pipeline/default-pipeline.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/default-pipeline.js +118 -0
- package/dist/smart-agent/pipeline/default-pipeline.js.map +1 -0
- package/dist/smart-agent/pipeline/executor.d.ts +54 -0
- package/dist/smart-agent/pipeline/executor.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/executor.js +133 -0
- package/dist/smart-agent/pipeline/executor.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/assemble.d.ts +16 -0
- package/dist/smart-agent/pipeline/handlers/assemble.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/assemble.js +57 -0
- package/dist/smart-agent/pipeline/handlers/assemble.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/classify.d.ts +21 -0
- package/dist/smart-agent/pipeline/handlers/classify.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/classify.js +53 -0
- package/dist/smart-agent/pipeline/handlers/classify.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/expand.d.ts +16 -0
- package/dist/smart-agent/pipeline/handlers/expand.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/expand.js +24 -0
- package/dist/smart-agent/pipeline/handlers/expand.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/index.d.ts +28 -0
- package/dist/smart-agent/pipeline/handlers/index.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/index.js +39 -0
- package/dist/smart-agent/pipeline/handlers/index.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/rag-query.d.ts +25 -0
- package/dist/smart-agent/pipeline/handlers/rag-query.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/rag-query.js +53 -0
- package/dist/smart-agent/pipeline/handlers/rag-query.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/rag-upsert.d.ts +17 -0
- package/dist/smart-agent/pipeline/handlers/rag-upsert.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/rag-upsert.js +47 -0
- package/dist/smart-agent/pipeline/handlers/rag-upsert.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/rerank.d.ts +16 -0
- package/dist/smart-agent/pipeline/handlers/rerank.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/rerank.js +38 -0
- package/dist/smart-agent/pipeline/handlers/rerank.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/summarize.d.ts +17 -0
- package/dist/smart-agent/pipeline/handlers/summarize.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/summarize.js +47 -0
- package/dist/smart-agent/pipeline/handlers/summarize.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/tool-loop.d.ts +32 -0
- package/dist/smart-agent/pipeline/handlers/tool-loop.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/tool-loop.js +416 -0
- package/dist/smart-agent/pipeline/handlers/tool-loop.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/tool-select.d.ts +21 -0
- package/dist/smart-agent/pipeline/handlers/tool-select.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/tool-select.js +95 -0
- package/dist/smart-agent/pipeline/handlers/tool-select.js.map +1 -0
- package/dist/smart-agent/pipeline/handlers/translate.d.ts +18 -0
- package/dist/smart-agent/pipeline/handlers/translate.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/handlers/translate.js +39 -0
- package/dist/smart-agent/pipeline/handlers/translate.js.map +1 -0
- package/dist/smart-agent/pipeline/index.d.ts +14 -0
- package/dist/smart-agent/pipeline/index.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/index.js +16 -0
- package/dist/smart-agent/pipeline/index.js.map +1 -0
- package/dist/smart-agent/pipeline/stage-handler.d.ts +36 -0
- package/dist/smart-agent/pipeline/stage-handler.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/stage-handler.js +24 -0
- package/dist/smart-agent/pipeline/stage-handler.js.map +1 -0
- package/dist/smart-agent/pipeline/types.d.ts +129 -0
- package/dist/smart-agent/pipeline/types.d.ts.map +1 -0
- package/dist/smart-agent/pipeline/types.js +54 -0
- package/dist/smart-agent/pipeline/types.js.map +1 -0
- package/dist/smart-agent/pipeline.d.ts +22 -6
- package/dist/smart-agent/pipeline.d.ts.map +1 -1
- package/dist/smart-agent/pipeline.js +5 -142
- package/dist/smart-agent/pipeline.js.map +1 -1
- package/dist/smart-agent/plugins/index.d.ts +4 -0
- package/dist/smart-agent/plugins/index.d.ts.map +1 -0
- package/dist/smart-agent/plugins/index.js +3 -0
- package/dist/smart-agent/plugins/index.js.map +1 -0
- package/dist/smart-agent/plugins/loader.d.ts +67 -0
- package/dist/smart-agent/plugins/loader.d.ts.map +1 -0
- package/dist/smart-agent/plugins/loader.js +114 -0
- package/dist/smart-agent/plugins/loader.js.map +1 -0
- package/dist/smart-agent/plugins/types.d.ts +149 -0
- package/dist/smart-agent/plugins/types.d.ts.map +1 -0
- package/dist/smart-agent/plugins/types.js +111 -0
- package/dist/smart-agent/plugins/types.js.map +1 -0
- package/dist/smart-agent/providers.d.ts +76 -0
- package/dist/smart-agent/providers.d.ts.map +1 -0
- package/dist/smart-agent/providers.js +173 -0
- package/dist/smart-agent/providers.js.map +1 -0
- package/dist/smart-agent/rag/embedder-factories.d.ts +9 -0
- package/dist/smart-agent/rag/embedder-factories.d.ts.map +1 -0
- package/dist/smart-agent/rag/embedder-factories.js +27 -0
- package/dist/smart-agent/rag/embedder-factories.js.map +1 -0
- package/dist/smart-agent/rag/index.d.ts +7 -0
- package/dist/smart-agent/rag/index.d.ts.map +1 -1
- package/dist/smart-agent/rag/index.js +4 -0
- package/dist/smart-agent/rag/index.js.map +1 -1
- package/dist/smart-agent/smart-server.d.ts +25 -1
- package/dist/smart-agent/smart-server.d.ts.map +1 -1
- package/dist/smart-agent/smart-server.js +122 -27
- package/dist/smart-agent/smart-server.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileSystemPluginLoader — default {@link IPluginLoader} implementation.
|
|
3
|
+
*
|
|
4
|
+
* Scans directories and dynamically imports `.js`, `.mjs`, and `.ts` files.
|
|
5
|
+
* Each file is expected to export named registrations matching {@link PluginExports}.
|
|
6
|
+
* Invalid exports are silently ignored; import errors are collected in `errors`.
|
|
7
|
+
*
|
|
8
|
+
* ## Load order
|
|
9
|
+
*
|
|
10
|
+
* Directories are processed in order. Within a directory, files are sorted
|
|
11
|
+
* alphabetically. Later registrations override earlier ones (last wins).
|
|
12
|
+
*
|
|
13
|
+
* ## Security
|
|
14
|
+
*
|
|
15
|
+
* Plugin files are executed via dynamic `import()`. Only load plugins from
|
|
16
|
+
* trusted directories. The loader does NOT sandbox plugin code.
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
19
|
+
import { extname, resolve } from 'node:path';
|
|
20
|
+
import { pathToFileURL } from 'node:url';
|
|
21
|
+
import { emptyLoadedPlugins, mergePluginExports } from './types.js';
|
|
22
|
+
const PLUGIN_EXTENSIONS = new Set(['.js', '.mjs', '.ts']);
|
|
23
|
+
/**
|
|
24
|
+
* Filesystem-based plugin loader.
|
|
25
|
+
*
|
|
26
|
+
* Scans one or more directories for plugin files and dynamically imports them.
|
|
27
|
+
* This is the default implementation shipped with the library.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const loader = new FileSystemPluginLoader({
|
|
32
|
+
* dirs: getDefaultPluginDirs(),
|
|
33
|
+
* });
|
|
34
|
+
* const plugins = await loader.load();
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example Inject into builder
|
|
38
|
+
* ```ts
|
|
39
|
+
* builder.withPluginLoader(new FileSystemPluginLoader({
|
|
40
|
+
* dirs: [...getDefaultPluginDirs(), './my-extra-plugins'],
|
|
41
|
+
* }));
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export class FileSystemPluginLoader {
|
|
45
|
+
dirs;
|
|
46
|
+
log;
|
|
47
|
+
constructor(config) {
|
|
48
|
+
this.dirs = config.dirs;
|
|
49
|
+
this.log = config.log;
|
|
50
|
+
}
|
|
51
|
+
async load() {
|
|
52
|
+
const result = emptyLoadedPlugins();
|
|
53
|
+
for (const dir of this.dirs) {
|
|
54
|
+
const resolved = resolve(dir);
|
|
55
|
+
if (!existsSync(resolved)) {
|
|
56
|
+
this.log?.(`[plugins] Directory not found, skipping: ${resolved}`);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
let files;
|
|
60
|
+
try {
|
|
61
|
+
files = readdirSync(resolved)
|
|
62
|
+
.filter((f) => PLUGIN_EXTENSIONS.has(extname(f)))
|
|
63
|
+
.sort();
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
this.log?.(`[plugins] Cannot read directory: ${resolved}`);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
for (const file of files) {
|
|
70
|
+
const filePath = resolve(resolved, file);
|
|
71
|
+
try {
|
|
72
|
+
const fileUrl = pathToFileURL(filePath).href;
|
|
73
|
+
const mod = (await import(fileUrl));
|
|
74
|
+
const registered = mergePluginExports(result, mod, filePath);
|
|
75
|
+
if (registered) {
|
|
76
|
+
this.log?.(`[plugins] Loaded: ${filePath}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
81
|
+
result.errors.push({ file: filePath, error: message });
|
|
82
|
+
this.log?.(`[plugins] Failed to load ${filePath}: ${message}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns the default plugin directories (in load order).
|
|
91
|
+
*
|
|
92
|
+
* 1. `~/.config/llm-agent/plugins/` (user-level)
|
|
93
|
+
* 2. `./plugins/` (project-level, relative to cwd)
|
|
94
|
+
*/
|
|
95
|
+
export function getDefaultPluginDirs() {
|
|
96
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
97
|
+
const dirs = [];
|
|
98
|
+
if (home) {
|
|
99
|
+
dirs.push(resolve(home, '.config', 'llm-agent', 'plugins'));
|
|
100
|
+
}
|
|
101
|
+
dirs.push(resolve(process.cwd(), 'plugins'));
|
|
102
|
+
return dirs;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Convenience function — creates a {@link FileSystemPluginLoader} and loads.
|
|
106
|
+
*
|
|
107
|
+
* @param dirs - Directories to scan (in order, later wins).
|
|
108
|
+
* @param log - Optional logger.
|
|
109
|
+
* @returns Merged plugin registrations.
|
|
110
|
+
*/
|
|
111
|
+
export async function loadPlugins(dirs, log) {
|
|
112
|
+
return new FileSystemPluginLoader({ dirs, log }).load();
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/smart-agent/plugins/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEpE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAS1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,sBAAsB;IAChB,IAAI,CAAW;IACf,GAAG,CAAyB;IAE7C,YAAY,MAAoC;QAC9C,IAA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that exports named registrations matching
|
|
5
|
+
* {@link PluginExports}. The plugin loader discovers and imports
|
|
6
|
+
* plugins, returning merged registrations as {@link LoadedPlugins}.
|
|
7
|
+
*
|
|
8
|
+
* ## Extension model
|
|
9
|
+
*
|
|
10
|
+
* The library provides {@link IPluginLoader} — an interface for plugin
|
|
11
|
+
* discovery — and a default filesystem-based implementation
|
|
12
|
+
* ({@link FileSystemPluginLoader}). Consumers can:
|
|
13
|
+
*
|
|
14
|
+
* - Use the default loader (filesystem scan) as-is
|
|
15
|
+
* - Provide a custom loader (npm packages, remote registry, DB, etc.)
|
|
16
|
+
* - Skip loaders entirely and wire via `SmartAgentBuilder` directly
|
|
17
|
+
*
|
|
18
|
+
* ## Supported exports
|
|
19
|
+
*
|
|
20
|
+
* | Export name | Type | Registers as |
|
|
21
|
+
* |----------------------|-------------------------------------------|------------------------|
|
|
22
|
+
* | `stageHandlers` | `Record<string, IStageHandler>` | Pipeline stage handlers |
|
|
23
|
+
* | `embedderFactories` | `Record<string, EmbedderFactory>` | Embedder factories |
|
|
24
|
+
* | `reranker` | `IReranker` | RAG reranker |
|
|
25
|
+
* | `queryExpander` | `IQueryExpander` | Query expander |
|
|
26
|
+
* | `outputValidator` | `IOutputValidator` | Output validator |
|
|
27
|
+
*
|
|
28
|
+
* ## Example plugin file (filesystem loader)
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* // ~/.config/llm-agent/plugins/my-plugin.js
|
|
32
|
+
* import type { PluginExports } from '@mcp-abap-adt/llm-agent';
|
|
33
|
+
*
|
|
34
|
+
* class AuditLogHandler {
|
|
35
|
+
* async execute(ctx, config, span) {
|
|
36
|
+
* console.log(`[audit] ${ctx.inputText.slice(0, 100)}`);
|
|
37
|
+
* return true;
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* export const stageHandlers = {
|
|
42
|
+
* 'audit-log': new AuditLogHandler(),
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* ## Plugin directories (filesystem loader)
|
|
47
|
+
*
|
|
48
|
+
* Plugins are loaded from (in order, later wins):
|
|
49
|
+
* 1. `~/.config/llm-agent/plugins/` (user-level)
|
|
50
|
+
* 2. `./plugins/` (project-level)
|
|
51
|
+
* 3. Path specified via `--plugin-dir` CLI flag or `pluginDir` in YAML
|
|
52
|
+
*
|
|
53
|
+
* Only `.js`, `.mjs`, and `.ts` files are loaded. Subdirectories are ignored.
|
|
54
|
+
*/
|
|
55
|
+
import type { EmbedderFactory } from '../interfaces/rag.js';
|
|
56
|
+
import type { IStageHandler } from '../pipeline/stage-handler.js';
|
|
57
|
+
import type { IQueryExpander } from '../rag/query-expander.js';
|
|
58
|
+
import type { IReranker } from '../reranker/types.js';
|
|
59
|
+
import type { IOutputValidator } from '../validator/types.js';
|
|
60
|
+
/**
|
|
61
|
+
* Shape of a plugin module's named exports.
|
|
62
|
+
* All fields are optional — a plugin can register any subset.
|
|
63
|
+
*/
|
|
64
|
+
export interface PluginExports {
|
|
65
|
+
/** Custom pipeline stage handlers, keyed by stage type name. */
|
|
66
|
+
stageHandlers?: Record<string, IStageHandler>;
|
|
67
|
+
/** Custom embedder factories, keyed by embedder name. */
|
|
68
|
+
embedderFactories?: Record<string, EmbedderFactory>;
|
|
69
|
+
/** Custom RAG reranker (replaces the default). */
|
|
70
|
+
reranker?: IReranker;
|
|
71
|
+
/** Custom query expander (replaces the default). */
|
|
72
|
+
queryExpander?: IQueryExpander;
|
|
73
|
+
/** Custom output validator (replaces the default). */
|
|
74
|
+
outputValidator?: IOutputValidator;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Result of loading all plugins.
|
|
78
|
+
* Merged registrations from all discovered plugin sources.
|
|
79
|
+
*/
|
|
80
|
+
export interface LoadedPlugins {
|
|
81
|
+
stageHandlers: Map<string, IStageHandler>;
|
|
82
|
+
embedderFactories: Record<string, EmbedderFactory>;
|
|
83
|
+
reranker?: IReranker;
|
|
84
|
+
queryExpander?: IQueryExpander;
|
|
85
|
+
outputValidator?: IOutputValidator;
|
|
86
|
+
/** Source identifiers for successfully loaded plugins. */
|
|
87
|
+
loadedFiles: string[];
|
|
88
|
+
/** Plugins that failed to load, with error messages. */
|
|
89
|
+
errors: Array<{
|
|
90
|
+
file: string;
|
|
91
|
+
error: string;
|
|
92
|
+
}>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Plugin loader interface.
|
|
96
|
+
*
|
|
97
|
+
* Abstracts how plugins are discovered and loaded. The library ships
|
|
98
|
+
* a default filesystem-based implementation ({@link FileSystemPluginLoader}).
|
|
99
|
+
* Consumers can provide their own implementation to load plugins from
|
|
100
|
+
* npm packages, remote registries, databases, or any other source.
|
|
101
|
+
*
|
|
102
|
+
* @example Default filesystem loader
|
|
103
|
+
* ```ts
|
|
104
|
+
* const loader = new FileSystemPluginLoader({
|
|
105
|
+
* dirs: ['~/.config/llm-agent/plugins/', './plugins/'],
|
|
106
|
+
* });
|
|
107
|
+
* builder.withPluginLoader(loader);
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @example Custom npm-based loader
|
|
111
|
+
* ```ts
|
|
112
|
+
* class NpmPluginLoader implements IPluginLoader {
|
|
113
|
+
* constructor(private packages: string[]) {}
|
|
114
|
+
* async load() {
|
|
115
|
+
* const result = emptyLoadedPlugins();
|
|
116
|
+
* for (const pkg of this.packages) {
|
|
117
|
+
* const mod = await import(pkg);
|
|
118
|
+
* mergePluginExports(result, mod, pkg);
|
|
119
|
+
* }
|
|
120
|
+
* return result;
|
|
121
|
+
* }
|
|
122
|
+
* }
|
|
123
|
+
* builder.withPluginLoader(new NpmPluginLoader(['my-plugin-a', 'my-plugin-b']));
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export interface IPluginLoader {
|
|
127
|
+
/**
|
|
128
|
+
* Discover and load plugins.
|
|
129
|
+
*
|
|
130
|
+
* @returns Merged plugin registrations from all discovered sources.
|
|
131
|
+
*/
|
|
132
|
+
load(): Promise<LoadedPlugins>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Creates an empty {@link LoadedPlugins} object.
|
|
136
|
+
* Useful for custom `IPluginLoader` implementations.
|
|
137
|
+
*/
|
|
138
|
+
export declare function emptyLoadedPlugins(): LoadedPlugins;
|
|
139
|
+
/**
|
|
140
|
+
* Merges a single plugin module's exports into a {@link LoadedPlugins} result.
|
|
141
|
+
* Useful for custom `IPluginLoader` implementations.
|
|
142
|
+
*
|
|
143
|
+
* @param result - Target to merge into (mutated in place).
|
|
144
|
+
* @param mod - Plugin module exports to merge.
|
|
145
|
+
* @param source - Source identifier (file path, package name, etc.).
|
|
146
|
+
* @returns `true` if any registrations were found.
|
|
147
|
+
*/
|
|
148
|
+
export declare function mergePluginExports(result: LoadedPlugins, mod: PluginExports, source: string): boolean;
|
|
149
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/plugins/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE9C,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAEpD,kDAAkD;IAClD,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,oDAAoD;IACpD,aAAa,CAAC,EAAE,cAAc,CAAC;IAE/B,sDAAsD;IACtD,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,eAAe,CAAC,EAAE,gBAAgB,CAAC;IACnC,0DAA0D;IAC1D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,wDAAwD;IACxD,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,aAAa,CAOlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAyCT"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin contract types.
|
|
3
|
+
*
|
|
4
|
+
* A plugin is a module that exports named registrations matching
|
|
5
|
+
* {@link PluginExports}. The plugin loader discovers and imports
|
|
6
|
+
* plugins, returning merged registrations as {@link LoadedPlugins}.
|
|
7
|
+
*
|
|
8
|
+
* ## Extension model
|
|
9
|
+
*
|
|
10
|
+
* The library provides {@link IPluginLoader} — an interface for plugin
|
|
11
|
+
* discovery — and a default filesystem-based implementation
|
|
12
|
+
* ({@link FileSystemPluginLoader}). Consumers can:
|
|
13
|
+
*
|
|
14
|
+
* - Use the default loader (filesystem scan) as-is
|
|
15
|
+
* - Provide a custom loader (npm packages, remote registry, DB, etc.)
|
|
16
|
+
* - Skip loaders entirely and wire via `SmartAgentBuilder` directly
|
|
17
|
+
*
|
|
18
|
+
* ## Supported exports
|
|
19
|
+
*
|
|
20
|
+
* | Export name | Type | Registers as |
|
|
21
|
+
* |----------------------|-------------------------------------------|------------------------|
|
|
22
|
+
* | `stageHandlers` | `Record<string, IStageHandler>` | Pipeline stage handlers |
|
|
23
|
+
* | `embedderFactories` | `Record<string, EmbedderFactory>` | Embedder factories |
|
|
24
|
+
* | `reranker` | `IReranker` | RAG reranker |
|
|
25
|
+
* | `queryExpander` | `IQueryExpander` | Query expander |
|
|
26
|
+
* | `outputValidator` | `IOutputValidator` | Output validator |
|
|
27
|
+
*
|
|
28
|
+
* ## Example plugin file (filesystem loader)
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* // ~/.config/llm-agent/plugins/my-plugin.js
|
|
32
|
+
* import type { PluginExports } from '@mcp-abap-adt/llm-agent';
|
|
33
|
+
*
|
|
34
|
+
* class AuditLogHandler {
|
|
35
|
+
* async execute(ctx, config, span) {
|
|
36
|
+
* console.log(`[audit] ${ctx.inputText.slice(0, 100)}`);
|
|
37
|
+
* return true;
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* export const stageHandlers = {
|
|
42
|
+
* 'audit-log': new AuditLogHandler(),
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* ## Plugin directories (filesystem loader)
|
|
47
|
+
*
|
|
48
|
+
* Plugins are loaded from (in order, later wins):
|
|
49
|
+
* 1. `~/.config/llm-agent/plugins/` (user-level)
|
|
50
|
+
* 2. `./plugins/` (project-level)
|
|
51
|
+
* 3. Path specified via `--plugin-dir` CLI flag or `pluginDir` in YAML
|
|
52
|
+
*
|
|
53
|
+
* Only `.js`, `.mjs`, and `.ts` files are loaded. Subdirectories are ignored.
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Creates an empty {@link LoadedPlugins} object.
|
|
57
|
+
* Useful for custom `IPluginLoader` implementations.
|
|
58
|
+
*/
|
|
59
|
+
export function emptyLoadedPlugins() {
|
|
60
|
+
return {
|
|
61
|
+
stageHandlers: new Map(),
|
|
62
|
+
embedderFactories: {},
|
|
63
|
+
loadedFiles: [],
|
|
64
|
+
errors: [],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Merges a single plugin module's exports into a {@link LoadedPlugins} result.
|
|
69
|
+
* Useful for custom `IPluginLoader` implementations.
|
|
70
|
+
*
|
|
71
|
+
* @param result - Target to merge into (mutated in place).
|
|
72
|
+
* @param mod - Plugin module exports to merge.
|
|
73
|
+
* @param source - Source identifier (file path, package name, etc.).
|
|
74
|
+
* @returns `true` if any registrations were found.
|
|
75
|
+
*/
|
|
76
|
+
export function mergePluginExports(result, mod, source) {
|
|
77
|
+
let registered = false;
|
|
78
|
+
if (mod.stageHandlers && typeof mod.stageHandlers === 'object') {
|
|
79
|
+
for (const [type, handler] of Object.entries(mod.stageHandlers)) {
|
|
80
|
+
if (handler && typeof handler.execute === 'function') {
|
|
81
|
+
result.stageHandlers.set(type, handler);
|
|
82
|
+
registered = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (mod.embedderFactories && typeof mod.embedderFactories === 'object') {
|
|
87
|
+
for (const [name, factory] of Object.entries(mod.embedderFactories)) {
|
|
88
|
+
if (typeof factory === 'function') {
|
|
89
|
+
result.embedderFactories[name] = factory;
|
|
90
|
+
registered = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (mod.reranker && typeof mod.reranker === 'object') {
|
|
95
|
+
result.reranker = mod.reranker;
|
|
96
|
+
registered = true;
|
|
97
|
+
}
|
|
98
|
+
if (mod.queryExpander && typeof mod.queryExpander === 'object') {
|
|
99
|
+
result.queryExpander = mod.queryExpander;
|
|
100
|
+
registered = true;
|
|
101
|
+
}
|
|
102
|
+
if (mod.outputValidator && typeof mod.outputValidator === 'object') {
|
|
103
|
+
result.outputValidator = mod.outputValidator;
|
|
104
|
+
registered = true;
|
|
105
|
+
}
|
|
106
|
+
if (registered) {
|
|
107
|
+
result.loadedFiles.push(source);
|
|
108
|
+
}
|
|
109
|
+
return registered;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/smart-agent/plugins/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAsFH;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,aAAa,EAAE,IAAI,GAAG,EAAE;QACxB,iBAAiB,EAAE,EAAE;QACrB,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,EAAE;KACX,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAqB,EACrB,GAAkB,EAClB,MAAc;IAEd,IAAI,UAAU,GAAG,KAAK,CAAC;IAEvB,IAAI,GAAG,CAAC,aAAa,IAAI,OAAO,GAAG,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;QAC/D,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;YAChE,IAAI,OAAO,IAAI,OAAQ,OAAyB,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;gBACxE,MAAM,CAAC,aAAa,CAAC,GAAG,CA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— the composition root for concrete implementations.
|
|
3
|
+
*
|
|
4
|
+
* This module is the ONLY place that knows about concrete LLM providers,
|
|
5
|
+
* embedders, and RAG implementations. All factories (Builder, SmartServer,
|
|
6
|
+
* pipeline YAML) delegate here to resolve config into interface instances.
|
|
7
|
+
*/
|
|
8
|
+
import { type SapAICoreCredentials } from '../llm-providers/sap-core-ai.js';
|
|
9
|
+
import type { EmbedderFactory, IEmbedder, IRag } from './interfaces/rag.js';
|
|
10
|
+
import { TokenCountingLlm } from './llm/token-counting-llm.js';
|
|
11
|
+
export interface LlmProviderConfig {
|
|
12
|
+
provider: 'deepseek' | 'openai' | 'anthropic' | 'sap-ai-sdk';
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
model?: string;
|
|
15
|
+
temperature?: number;
|
|
16
|
+
maxTokens?: number;
|
|
17
|
+
resourceGroup?: string;
|
|
18
|
+
credentials?: SapAICoreCredentials;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create an ILlm from a declarative provider config.
|
|
22
|
+
* This is the only function that knows about concrete LLM implementations.
|
|
23
|
+
*/
|
|
24
|
+
export declare function makeLlm(cfg: LlmProviderConfig, temperature: number): TokenCountingLlm;
|
|
25
|
+
/**
|
|
26
|
+
* Create a default DeepSeek-based ILlm from simple config (apiKey + model).
|
|
27
|
+
* Used by the flat YAML / CLI path.
|
|
28
|
+
*/
|
|
29
|
+
export declare function makeDefaultLlm(apiKey: string, model: string, temperature: number): TokenCountingLlm;
|
|
30
|
+
export interface EmbedderResolutionConfig {
|
|
31
|
+
/** Embedder name — looked up in the factory registry. Default: 'ollama' */
|
|
32
|
+
embedder?: string;
|
|
33
|
+
url?: string;
|
|
34
|
+
apiKey?: string;
|
|
35
|
+
model?: string;
|
|
36
|
+
timeoutMs?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface EmbedderResolutionOptions {
|
|
39
|
+
/** Pre-built embedder injected by the consumer (takes precedence). */
|
|
40
|
+
injectedEmbedder?: IEmbedder;
|
|
41
|
+
/** Additional embedder factories (merged with built-ins). */
|
|
42
|
+
extraFactories?: Record<string, EmbedderFactory>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolve an IEmbedder from config.
|
|
46
|
+
*
|
|
47
|
+
* Priority:
|
|
48
|
+
* 1. Injected embedder instance (DI)
|
|
49
|
+
* 2. Named factory from registry (YAML `embedder: <name>`)
|
|
50
|
+
* 3. Default: 'ollama'
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveEmbedder(cfg: EmbedderResolutionConfig, options?: EmbedderResolutionOptions): IEmbedder;
|
|
53
|
+
export interface RagResolutionConfig {
|
|
54
|
+
type?: 'ollama' | 'openai' | 'in-memory' | 'qdrant';
|
|
55
|
+
embedder?: string;
|
|
56
|
+
url?: string;
|
|
57
|
+
apiKey?: string;
|
|
58
|
+
model?: string;
|
|
59
|
+
collectionName?: string;
|
|
60
|
+
dedupThreshold?: number;
|
|
61
|
+
vectorWeight?: number;
|
|
62
|
+
keywordWeight?: number;
|
|
63
|
+
timeoutMs?: number;
|
|
64
|
+
}
|
|
65
|
+
export interface RagResolutionOptions {
|
|
66
|
+
/** Pre-built embedder injected by the consumer. */
|
|
67
|
+
injectedEmbedder?: IEmbedder;
|
|
68
|
+
/** Additional embedder factories (merged with built-ins). */
|
|
69
|
+
extraFactories?: Record<string, EmbedderFactory>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create an IRag from a declarative store config.
|
|
73
|
+
* This is the only function that knows about concrete RAG implementations.
|
|
74
|
+
*/
|
|
75
|
+
export declare function makeRag(cfg: RagResolutionConfig, options?: RagResolutionOptions): IRag;
|
|
76
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/smart-agent/providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,iCAAiC,C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ClC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAClD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CACrB,GAAG,EAAE,mBAAmB,EACxB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,IAAI,CAqDN"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider resolution — the composition root for concrete implementations.
|
|
3
|
+
*
|
|
4
|
+
* This module is the ONLY place that knows about concrete LLM providers,
|
|
5
|
+
* embedders, and RAG implementations. All factories (Builder, SmartServer,
|
|
6
|
+
* pipeline YAML) delegate here to resolve config into interface instances.
|
|
7
|
+
*/
|
|
8
|
+
import { AnthropicAgent } from '../agents/anthropic-agent.js';
|
|
9
|
+
import { DeepSeekAgent } from '../agents/deepseek-agent.js';
|
|
10
|
+
import { OpenAIAgent } from '../agents/openai-agent.js';
|
|
11
|
+
import { SapCoreAIAgent } from '../agents/sap-core-ai-agent.js';
|
|
12
|
+
import { AnthropicProvider } from '../llm-providers/anthropic.js';
|
|
13
|
+
import { DeepSeekProvider } from '../llm-providers/deepseek.js';
|
|
14
|
+
import { OpenAIProvider } from '../llm-providers/openai.js';
|
|
15
|
+
import { SapCoreAIProvider, } from '../llm-providers/sap-core-ai.js';
|
|
16
|
+
import { MCPClientWrapper } from '../mcp/client.js';
|
|
17
|
+
import { LlmAdapter } from './adapters/llm-adapter.js';
|
|
18
|
+
import { TokenCountingLlm } from './llm/token-counting-llm.js';
|
|
19
|
+
import { builtInEmbedderFactories } from './rag/embedder-factories.js';
|
|
20
|
+
import { InMemoryRag } from './rag/in-memory-rag.js';
|
|
21
|
+
import { OllamaRag } from './rag/ollama-rag.js';
|
|
22
|
+
import { QdrantRag } from './rag/qdrant-rag.js';
|
|
23
|
+
import { VectorRag } from './rag/vector-rag.js';
|
|
24
|
+
/**
|
|
25
|
+
* Create an ILlm from a declarative provider config.
|
|
26
|
+
* This is the only function that knows about concrete LLM implementations.
|
|
27
|
+
*/
|
|
28
|
+
export function makeLlm(cfg, temperature) {
|
|
29
|
+
const dummyMcp = new MCPClientWrapper({
|
|
30
|
+
transport: 'embedded',
|
|
31
|
+
listToolsHandler: async () => [],
|
|
32
|
+
});
|
|
33
|
+
switch (cfg.provider) {
|
|
34
|
+
case 'deepseek': {
|
|
35
|
+
const provider = new DeepSeekProvider({
|
|
36
|
+
apiKey: cfg.apiKey,
|
|
37
|
+
model: cfg.model,
|
|
38
|
+
temperature,
|
|
39
|
+
maxTokens: cfg.maxTokens,
|
|
40
|
+
});
|
|
41
|
+
const agent = new DeepSeekAgent({
|
|
42
|
+
llmProvider: provider,
|
|
43
|
+
mcpClient: dummyMcp,
|
|
44
|
+
});
|
|
45
|
+
return new TokenCountingLlm(new LlmAdapter(agent));
|
|
46
|
+
}
|
|
47
|
+
case 'openai': {
|
|
48
|
+
const provider = new OpenAIProvider({
|
|
49
|
+
apiKey: cfg.apiKey,
|
|
50
|
+
model: cfg.model,
|
|
51
|
+
temperature,
|
|
52
|
+
maxTokens: cfg.maxTokens,
|
|
53
|
+
});
|
|
54
|
+
const agent = new OpenAIAgent({
|
|
55
|
+
llmProvider: provider,
|
|
56
|
+
mcpClient: dummyMcp,
|
|
57
|
+
});
|
|
58
|
+
return new TokenCountingLlm(new LlmAdapter(agent));
|
|
59
|
+
}
|
|
60
|
+
case 'anthropic': {
|
|
61
|
+
const provider = new AnthropicProvider({
|
|
62
|
+
apiKey: cfg.apiKey,
|
|
63
|
+
model: cfg.model,
|
|
64
|
+
temperature,
|
|
65
|
+
maxTokens: cfg.maxTokens,
|
|
66
|
+
});
|
|
67
|
+
const agent = new AnthropicAgent({
|
|
68
|
+
llmProvider: provider,
|
|
69
|
+
mcpClient: dummyMcp,
|
|
70
|
+
});
|
|
71
|
+
return new TokenCountingLlm(new LlmAdapter(agent));
|
|
72
|
+
}
|
|
73
|
+
case 'sap-ai-sdk': {
|
|
74
|
+
const provider = new SapCoreAIProvider({
|
|
75
|
+
apiKey: cfg.apiKey,
|
|
76
|
+
model: cfg.model,
|
|
77
|
+
temperature,
|
|
78
|
+
maxTokens: cfg.maxTokens,
|
|
79
|
+
resourceGroup: cfg.resourceGroup,
|
|
80
|
+
credentials: cfg.credentials,
|
|
81
|
+
});
|
|
82
|
+
const agent = new SapCoreAIAgent({
|
|
83
|
+
llmProvider: provider,
|
|
84
|
+
mcpClient: dummyMcp,
|
|
85
|
+
});
|
|
86
|
+
return new TokenCountingLlm(new LlmAdapter(agent));
|
|
87
|
+
}
|
|
88
|
+
default: {
|
|
89
|
+
const _exhaustive = cfg.provider;
|
|
90
|
+
throw new Error(`Unknown LLM provider: ${_exhaustive}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a default DeepSeek-based ILlm from simple config (apiKey + model).
|
|
96
|
+
* Used by the flat YAML / CLI path.
|
|
97
|
+
*/
|
|
98
|
+
export function makeDefaultLlm(apiKey, model, temperature) {
|
|
99
|
+
return makeLlm({ provider: 'deepseek', apiKey, model }, temperature);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Resolve an IEmbedder from config.
|
|
103
|
+
*
|
|
104
|
+
* Priority:
|
|
105
|
+
* 1. Injected embedder instance (DI)
|
|
106
|
+
* 2. Named factory from registry (YAML `embedder: <name>`)
|
|
107
|
+
* 3. Default: 'ollama'
|
|
108
|
+
*/
|
|
109
|
+
export function resolveEmbedder(cfg, options) {
|
|
110
|
+
if (options?.injectedEmbedder)
|
|
111
|
+
return options.injectedEmbedder;
|
|
112
|
+
const name = cfg.embedder ?? 'ollama';
|
|
113
|
+
const factories = { ...builtInEmbedderFactories, ...options?.extraFactories };
|
|
114
|
+
const factory = factories[name];
|
|
115
|
+
if (!factory) {
|
|
116
|
+
throw new Error(`Unknown embedder "${name}". Register a factory or use: ${Object.keys(factories).join(', ')}`);
|
|
117
|
+
}
|
|
118
|
+
return factory({
|
|
119
|
+
url: cfg.url,
|
|
120
|
+
apiKey: cfg.apiKey,
|
|
121
|
+
model: cfg.model,
|
|
122
|
+
timeoutMs: cfg.timeoutMs,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create an IRag from a declarative store config.
|
|
127
|
+
* This is the only function that knows about concrete RAG implementations.
|
|
128
|
+
*/
|
|
129
|
+
export function makeRag(cfg, options) {
|
|
130
|
+
if (cfg.type === 'in-memory') {
|
|
131
|
+
return new InMemoryRag({ dedupThreshold: cfg.dedupThreshold });
|
|
132
|
+
}
|
|
133
|
+
if (cfg.type === 'qdrant') {
|
|
134
|
+
if (!cfg.url) {
|
|
135
|
+
throw new Error('Qdrant URL is required for qdrant RAG type');
|
|
136
|
+
}
|
|
137
|
+
const embedder = resolveEmbedder(cfg, options);
|
|
138
|
+
return new QdrantRag({
|
|
139
|
+
url: cfg.url,
|
|
140
|
+
collectionName: cfg.collectionName ?? 'llm-agent',
|
|
141
|
+
embedder,
|
|
142
|
+
apiKey: cfg.apiKey,
|
|
143
|
+
timeoutMs: cfg.timeoutMs,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (cfg.type === 'openai') {
|
|
147
|
+
const embedder = resolveEmbedder({ ...cfg, embedder: cfg.embedder ?? 'openai' }, options);
|
|
148
|
+
return new VectorRag(embedder, {
|
|
149
|
+
dedupThreshold: cfg.dedupThreshold,
|
|
150
|
+
vectorWeight: cfg.vectorWeight,
|
|
151
|
+
keywordWeight: cfg.keywordWeight,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// Default: 'ollama'
|
|
155
|
+
// Use convenience OllamaRag when no custom embedder is involved
|
|
156
|
+
if (!options?.injectedEmbedder && !cfg.embedder) {
|
|
157
|
+
return new OllamaRag({
|
|
158
|
+
ollamaUrl: cfg.url,
|
|
159
|
+
model: cfg.model,
|
|
160
|
+
timeoutMs: cfg.timeoutMs,
|
|
161
|
+
dedupThreshold: cfg.dedupThreshold,
|
|
162
|
+
vectorWeight: cfg.vectorWeight,
|
|
163
|
+
keywordWeight: cfg.keywordWeight,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const embedder = resolveEmbedder({ ...cfg, embedder: cfg.embedder ?? 'ollama' }, options);
|
|
167
|
+
return new VectorRag(embedder, {
|
|
168
|
+
dedupThreshold: cfg.dedupThreshold,
|
|
169
|
+
vectorWeight: cfg.vectorWeight,
|
|
170
|
+
keywordWeight: cfg.keywordWeight,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/smart-agent/providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO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AChB,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,aAAa,EAAE,GAAG,CAAC,aAAa;SACjC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,QAAQ,GAAG,eAAe,CAC9B,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,QAAQ,EAAE,EAC9C,OAAO,CACR,CAAC;IACF,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE;QAC7B,cAAc,EAAE,GAAG,CAAC,cAAc;QAClC,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,aAAa,EAAE,GAAG,CAAC,aAAa;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in embedder factories for declarative (YAML) embedder selection.
|
|
3
|
+
*
|
|
4
|
+
* Consumers can extend this map with custom factories via
|
|
5
|
+
* `SmartAgentBuilder.withEmbedderFactory()` or `SmartServerConfig.embedderFactories`.
|
|
6
|
+
*/
|
|
7
|
+
import type { EmbedderFactory } from '../interfaces/rag.js';
|
|
8
|
+
export declare const builtInEmbedderFactories: Record<string, EmbedderFactory>;
|
|
9
|
+
//# sourceMappingURL=embedder-factories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedder-factories.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/rag/embedder-factories.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAkBpE,CAAC"}
|