@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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AC;IACvC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,aAAa,w/JAkIzB,CAAC;AAEF,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAYT;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;AAUD,wBAAgB,wBAAwB,CACtC,IAAI,GAAE,iBAAsB,EAC5B,IAAI,GAAE,UAAe,EACrB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CA0JhC"}
|
|
@@ -20,6 +20,7 @@ llm:
|
|
|
20
20
|
|
|
21
21
|
rag:
|
|
22
22
|
type: ollama # ollama | in-memory | qdrant
|
|
23
|
+
# embedder: ollama # Embedder to use: ollama | openai | <custom>
|
|
23
24
|
url: http://localhost:11434
|
|
24
25
|
model: nomic-embed-text
|
|
25
26
|
# collectionName: llm-agent # Qdrant collection name (qdrant type only)
|
|
@@ -44,6 +45,10 @@ agent:
|
|
|
44
45
|
queryExpansionEnabled: false # Expand RAG queries with LLM-generated synonyms
|
|
45
46
|
toolResultCacheTtlMs: 300000 # Tool result cache TTL (ms); 0 to disable
|
|
46
47
|
sessionTokenBudget: 0 # Multi-turn token budget; 0 to disable
|
|
48
|
+
# classificationEnabled: true # Enable/disable intent classification stage
|
|
49
|
+
# ragRetrievalMode: auto # auto | always | never — controls RAG retrieval
|
|
50
|
+
# ragTranslationEnabled: true # Translate non-ASCII RAG queries to English
|
|
51
|
+
# ragUpsertEnabled: true # Upsert classified subprompts to RAG stores
|
|
47
52
|
|
|
48
53
|
# --- Advanced Multi-Model Pipeline (optional) -------------------------------
|
|
49
54
|
# Use this section to assign different models for different internal tasks.
|
|
@@ -67,10 +72,11 @@ agent:
|
|
|
67
72
|
#
|
|
68
73
|
# rag:
|
|
69
74
|
# facts:
|
|
70
|
-
# type:
|
|
71
|
-
# url: http://
|
|
72
|
-
#
|
|
73
|
-
#
|
|
75
|
+
# type: qdrant
|
|
76
|
+
# url: http://qdrant:6333
|
|
77
|
+
# embedder: openai # ollama | openai | <custom registered name>
|
|
78
|
+
# model: text-embedding-3-small
|
|
79
|
+
# apiKey: \${OPENAI_API_KEY}
|
|
74
80
|
# feedback:
|
|
75
81
|
# type: in-memory
|
|
76
82
|
# state:
|
|
@@ -80,6 +86,39 @@ agent:
|
|
|
80
86
|
# - type: http
|
|
81
87
|
# url: http://localhost:3001/mcp/stream/http
|
|
82
88
|
|
|
89
|
+
# --- Structured Pipeline (optional) -------------------------------------------
|
|
90
|
+
# Replaces the hardcoded orchestration flow with a YAML-defined stage tree.
|
|
91
|
+
# When absent, the default flow runs unchanged (full backwards compatibility).
|
|
92
|
+
#
|
|
93
|
+
# pipeline:
|
|
94
|
+
# version: "1"
|
|
95
|
+
# stages:
|
|
96
|
+
# - id: classify
|
|
97
|
+
# type: classify
|
|
98
|
+
# - id: summarize
|
|
99
|
+
# type: summarize
|
|
100
|
+
# - id: rag-upsert
|
|
101
|
+
# type: rag-upsert
|
|
102
|
+
# - id: rag-retrieval
|
|
103
|
+
# type: parallel
|
|
104
|
+
# when: "shouldRetrieve"
|
|
105
|
+
# stages:
|
|
106
|
+
# - { id: translate, type: translate }
|
|
107
|
+
# - { id: expand, type: expand }
|
|
108
|
+
# after:
|
|
109
|
+
# - id: rag-queries
|
|
110
|
+
# type: parallel
|
|
111
|
+
# stages:
|
|
112
|
+
# - { id: facts, type: rag-query, config: { store: facts, k: 10 } }
|
|
113
|
+
# - { id: feedback, type: rag-query, config: { store: feedback, k: 5 } }
|
|
114
|
+
# - { id: state, type: rag-query, config: { store: state, k: 5 } }
|
|
115
|
+
# - { id: rerank, type: rerank }
|
|
116
|
+
# - { id: tool-select, type: tool-select }
|
|
117
|
+
# - id: assemble
|
|
118
|
+
# type: assemble
|
|
119
|
+
# - id: tool-loop
|
|
120
|
+
# type: tool-loop
|
|
121
|
+
|
|
83
122
|
# prompts:
|
|
84
123
|
# system: "You are a helpful assistant specialized in SAP ABAP development."
|
|
85
124
|
# classifier: |
|
|
@@ -93,6 +132,7 @@ agent:
|
|
|
93
132
|
|
|
94
133
|
log: smart-server.log # path to log file; omit for stdout
|
|
95
134
|
# logDir: sessions # Directory for detailed session debug logs
|
|
135
|
+
# pluginDir: ./my-plugins # Additional plugin directory (loaded after defaults)
|
|
96
136
|
`;
|
|
97
137
|
export function resolveEnvVars(value, env = process.env) {
|
|
98
138
|
if (typeof value === 'string')
|
|
@@ -165,6 +205,7 @@ export function resolveSmartServerConfig(args = {}, yaml = {}, env = process.env
|
|
|
165
205
|
type: (args['rag-type'] ??
|
|
166
206
|
get(yaml, 'rag', 'type') ??
|
|
167
207
|
'ollama'),
|
|
208
|
+
embedder: get(yaml, 'rag', 'embedder') ?? undefined,
|
|
168
209
|
url: args['rag-url'] ??
|
|
169
210
|
get(yaml, 'rag', 'url') ??
|
|
170
211
|
env.OLLAMA_URL ??
|
|
@@ -226,6 +267,7 @@ export function resolveSmartServerConfig(args = {}, yaml = {}, env = process.env
|
|
|
226
267
|
env.SMART_AGENT_MODE ??
|
|
227
268
|
'hybrid'),
|
|
228
269
|
logDir: args['log-dir'] ?? get(yaml, 'logDir') ?? null,
|
|
270
|
+
pluginDir: args['plugin-dir'] ?? get(yaml, 'pluginDir') ?? undefined,
|
|
229
271
|
...(yaml.pipeline ? { pipeline: yaml.pipeline } : {}),
|
|
230
272
|
};
|
|
231
273
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../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YACjB,GAAG,CAAC,gBAAgB;YACpB,QAAQ,CAAoB;QAC9B,MAAM,EAAG,IAAI,CAAC,SAAS,CAAY,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI;QAClE,SAAS,EACN,IAAI,CAAC,YAAY,CAAY,IAAI,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,SAAS;QACvE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -9,7 +9,7 @@ export type { IContextAssembler } from './assembler.js';
|
|
|
9
9
|
export type { ISubpromptClassifier } from './classifier.js';
|
|
10
10
|
export type { ILlm } from './llm.js';
|
|
11
11
|
export type { IMcpClient } from './mcp-client.js';
|
|
12
|
-
export type { IRag } from './rag.js';
|
|
12
|
+
export type { EmbedderFactory, EmbedderFactoryConfig, IEmbedder, IRag, } from './rag.js';
|
|
13
13
|
export type { AgentConfig, CallOptions, ContextFrame, LlmFinishReason, LlmResponse, LlmStreamChunk, LlmTool, LlmToolCall, McpTool, McpToolResult, RagMetadata, RagResult, Result, Subprompt, SubpromptType, TimingEntry, ToolCallRecord, ToolHeartbeat, TraceContext, } from './types.js';
|
|
14
14
|
export { AssemblerError, ClassifierError, LlmError, McpError, RagError, SmartAgentError, } from './types.js';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/interfaces/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1E,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/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B,SAAS,EACT,IAAI,GACL,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,WAAW,EACX,cAAc,EACd,OAAO,EACP,WAAW,EACX,OAAO,EACP,aAAa,EACb,WAAW,EACX,SAAS,EACT,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/smart-agent/interfaces/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/smart-agent/interfaces/index.ts"],"names":[],"mappings":"AA8CA,OAAO,EACL,cAAc,EACd,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
|
@@ -2,6 +2,22 @@ import type { CallOptions, RagError, RagMetadata, RagResult, Result } from './ty
|
|
|
2
2
|
export interface IEmbedder {
|
|
3
3
|
embed(text: string, options?: CallOptions): Promise<number[]>;
|
|
4
4
|
}
|
|
5
|
+
/** Config subset passed to EmbedderFactory so it can configure the embedder. */
|
|
6
|
+
export interface EmbedderFactoryConfig {
|
|
7
|
+
/** Base URL for the embedding service (Ollama URL, OpenAI base, etc.) */
|
|
8
|
+
url?: string;
|
|
9
|
+
/** API key when required by the embedding provider */
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Embedding model name */
|
|
12
|
+
model?: string;
|
|
13
|
+
/** Per-request timeout in milliseconds */
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Factory function that creates an IEmbedder from declarative config.
|
|
18
|
+
* Consumers register custom factories to support YAML-driven embedder selection.
|
|
19
|
+
*/
|
|
20
|
+
export type EmbedderFactory = (cfg: EmbedderFactoryConfig) => IEmbedder;
|
|
5
21
|
export interface IRag {
|
|
6
22
|
upsert(text: string, metadata: RagMetadata, options?: CallOptions): Promise<Result<void, RagError>>;
|
|
7
23
|
query(text: string, k: number, options?: CallOptions): Promise<Result<RagResult[], RagError>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rag.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/interfaces/rag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACP,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,IAAI;IACnB,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEnC,KAAK,CACH,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,MAAM,EACT,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE1C,WAAW,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;CACrE"}
|
|
1
|
+
{"version":3,"file":"rag.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/interfaces/rag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACP,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC/D;AAED,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,qBAAqB,KAAK,SAAS,CAAC;AAExE,MAAM,WAAW,IAAI;IACnB,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEnC,KAAK,CACH,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,MAAM,EACT,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE1C,WAAW,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;CACrE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe condition evaluator for pipeline `when` expressions.
|
|
3
|
+
*
|
|
4
|
+
* Evaluates simple dot-path property lookups against the pipeline context.
|
|
5
|
+
* Does NOT use `eval()` — only supports a restricted expression language.
|
|
6
|
+
*
|
|
7
|
+
* ## Supported expressions
|
|
8
|
+
*
|
|
9
|
+
* | Expression | Meaning |
|
|
10
|
+
* |---------------------------------|-----------------------------------------------|
|
|
11
|
+
* | `"shouldRetrieve"` | Truthy check on `ctx.shouldRetrieve` |
|
|
12
|
+
* | `"config.classificationEnabled"`| Truthy check on `ctx.config.classificationEnabled` |
|
|
13
|
+
* | `"!isAscii"` | Negated truthy check on `ctx.isAscii` |
|
|
14
|
+
* | `"ragResults.facts.length > 0"` | Comparison (>, <, >=, <=, ==, !=) |
|
|
15
|
+
* | `"a && b"` | Logical AND of two expressions |
|
|
16
|
+
* | `"a || b"` | Logical OR of two expressions |
|
|
17
|
+
*
|
|
18
|
+
* ## Security
|
|
19
|
+
*
|
|
20
|
+
* - No arbitrary code execution.
|
|
21
|
+
* - No function calls.
|
|
22
|
+
* - Only reads properties from the provided context object.
|
|
23
|
+
* - Unknown paths resolve to `undefined` (falsy).
|
|
24
|
+
*/
|
|
25
|
+
import type { PipelineContext } from './context.js';
|
|
26
|
+
/**
|
|
27
|
+
* Evaluate a condition expression against the pipeline context.
|
|
28
|
+
*
|
|
29
|
+
* @param expr - Condition string from the YAML `when` field.
|
|
30
|
+
* @param ctx - Pipeline context providing the evaluation namespace.
|
|
31
|
+
* @returns `true` if the condition is met, `false` otherwise.
|
|
32
|
+
* Returns `true` for `undefined` or empty expressions (no condition = always run).
|
|
33
|
+
*/
|
|
34
|
+
export declare function evaluateCondition(expr: string | undefined, ctx: PipelineContext): boolean;
|
|
35
|
+
//# sourceMappingURL=condition-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"condition-evaluator.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/condition-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAMpD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,GAAG,EAAE,eAAe,GACnB,OAAO,CAGT"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe condition evaluator for pipeline `when` expressions.
|
|
3
|
+
*
|
|
4
|
+
* Evaluates simple dot-path property lookups against the pipeline context.
|
|
5
|
+
* Does NOT use `eval()` — only supports a restricted expression language.
|
|
6
|
+
*
|
|
7
|
+
* ## Supported expressions
|
|
8
|
+
*
|
|
9
|
+
* | Expression | Meaning |
|
|
10
|
+
* |---------------------------------|-----------------------------------------------|
|
|
11
|
+
* | `"shouldRetrieve"` | Truthy check on `ctx.shouldRetrieve` |
|
|
12
|
+
* | `"config.classificationEnabled"`| Truthy check on `ctx.config.classificationEnabled` |
|
|
13
|
+
* | `"!isAscii"` | Negated truthy check on `ctx.isAscii` |
|
|
14
|
+
* | `"ragResults.facts.length > 0"` | Comparison (>, <, >=, <=, ==, !=) |
|
|
15
|
+
* | `"a && b"` | Logical AND of two expressions |
|
|
16
|
+
* | `"a || b"` | Logical OR of two expressions |
|
|
17
|
+
*
|
|
18
|
+
* ## Security
|
|
19
|
+
*
|
|
20
|
+
* - No arbitrary code execution.
|
|
21
|
+
* - No function calls.
|
|
22
|
+
* - Only reads properties from the provided context object.
|
|
23
|
+
* - Unknown paths resolve to `undefined` (falsy).
|
|
24
|
+
*/
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Public API
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
/**
|
|
29
|
+
* Evaluate a condition expression against the pipeline context.
|
|
30
|
+
*
|
|
31
|
+
* @param expr - Condition string from the YAML `when` field.
|
|
32
|
+
* @param ctx - Pipeline context providing the evaluation namespace.
|
|
33
|
+
* @returns `true` if the condition is met, `false` otherwise.
|
|
34
|
+
* Returns `true` for `undefined` or empty expressions (no condition = always run).
|
|
35
|
+
*/
|
|
36
|
+
export function evaluateCondition(expr, ctx) {
|
|
37
|
+
if (!expr || expr.trim() === '')
|
|
38
|
+
return true;
|
|
39
|
+
return evaluateExpression(expr.trim(), ctx);
|
|
40
|
+
}
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
// Expression evaluator
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
function evaluateExpression(expr, ctx) {
|
|
45
|
+
// Handle logical OR (lowest precedence)
|
|
46
|
+
if (expr.includes('||')) {
|
|
47
|
+
return expr
|
|
48
|
+
.split('||')
|
|
49
|
+
.some((part) => evaluateExpression(part.trim(), ctx));
|
|
50
|
+
}
|
|
51
|
+
// Handle logical AND
|
|
52
|
+
if (expr.includes('&&')) {
|
|
53
|
+
return expr
|
|
54
|
+
.split('&&')
|
|
55
|
+
.every((part) => evaluateExpression(part.trim(), ctx));
|
|
56
|
+
}
|
|
57
|
+
// Handle negation
|
|
58
|
+
if (expr.startsWith('!')) {
|
|
59
|
+
return !evaluateExpression(expr.slice(1).trim(), ctx);
|
|
60
|
+
}
|
|
61
|
+
// Handle comparison operators
|
|
62
|
+
const compMatch = expr.match(/^(.+?)\s*(>=|<=|!=|==|>|<)\s*(.+)$/);
|
|
63
|
+
if (compMatch) {
|
|
64
|
+
const left = resolveValue(compMatch[1].trim(), ctx);
|
|
65
|
+
const op = compMatch[2];
|
|
66
|
+
const right = resolveValue(compMatch[3].trim(), ctx);
|
|
67
|
+
return compare(left, op, right);
|
|
68
|
+
}
|
|
69
|
+
// Simple truthy check on a dot-path
|
|
70
|
+
return Boolean(resolveValue(expr, ctx));
|
|
71
|
+
}
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// Value resolution
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
/**
|
|
76
|
+
* Resolve a value from the pipeline context or parse as a literal.
|
|
77
|
+
*
|
|
78
|
+
* Supported values:
|
|
79
|
+
* - Dot-path: `"shouldRetrieve"`, `"config.ragQueryK"`, `"ragResults.facts.length"`
|
|
80
|
+
* - Numeric literal: `"10"`, `"0.5"`
|
|
81
|
+
* - String literal: `"'hard'"`, `"'smart'"`
|
|
82
|
+
* - Boolean literal: `"true"`, `"false"`
|
|
83
|
+
*/
|
|
84
|
+
function resolveValue(token, ctx) {
|
|
85
|
+
// Boolean literals
|
|
86
|
+
if (token === 'true')
|
|
87
|
+
return true;
|
|
88
|
+
if (token === 'false')
|
|
89
|
+
return false;
|
|
90
|
+
// Numeric literals
|
|
91
|
+
if (/^-?\d+(\.\d+)?$/.test(token))
|
|
92
|
+
return Number(token);
|
|
93
|
+
// String literals (single or double quoted)
|
|
94
|
+
const strMatch = token.match(/^['"](.*)['"]$/);
|
|
95
|
+
if (strMatch)
|
|
96
|
+
return strMatch[1];
|
|
97
|
+
// Dot-path lookup on context
|
|
98
|
+
return resolvePath(token, ctx);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolve a dot-separated path against the pipeline context.
|
|
102
|
+
*
|
|
103
|
+
* The lookup namespace is flat — the path starts from the PipelineContext root.
|
|
104
|
+
* Examples: `"shouldRetrieve"` → `ctx.shouldRetrieve`,
|
|
105
|
+
* `"config.mode"` → `ctx.config.mode`,
|
|
106
|
+
* `"ragResults.facts.length"` → `ctx.ragResults.facts.length`
|
|
107
|
+
*/
|
|
108
|
+
function resolvePath(path, ctx) {
|
|
109
|
+
const parts = path.split('.');
|
|
110
|
+
let current = ctx;
|
|
111
|
+
for (const part of parts) {
|
|
112
|
+
if (current === null || current === undefined)
|
|
113
|
+
return undefined;
|
|
114
|
+
if (typeof current !== 'object')
|
|
115
|
+
return undefined;
|
|
116
|
+
current = current[part];
|
|
117
|
+
}
|
|
118
|
+
return current;
|
|
119
|
+
}
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
// Comparison
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
function compare(left, op, right) {
|
|
124
|
+
const l = typeof left === 'string' ? left : Number(left);
|
|
125
|
+
const r = typeof right === 'string' ? right : Number(right);
|
|
126
|
+
switch (op) {
|
|
127
|
+
case '==':
|
|
128
|
+
return l === r;
|
|
129
|
+
case '!=':
|
|
130
|
+
return l !== r;
|
|
131
|
+
case '>':
|
|
132
|
+
return l > r;
|
|
133
|
+
case '<':
|
|
134
|
+
return l < r;
|
|
135
|
+
case '>=':
|
|
136
|
+
return l >= r;
|
|
137
|
+
case '<=':
|
|
138
|
+
return l <= r;
|
|
139
|
+
default:
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=condition-evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"condition-evaluator.js","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/condition-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAwB,EACxB,GAAoB;IAEpB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC7C,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E,SAAS,kBAAkB,CAAC,IAAY,EAAE,GAAoB;IAC5D,wCAAwC;IACxC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI;aACR,KAAK,CAAC,IAAI,CAAC;aACX,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,qBAAqB;IACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI;aACR,KAAK,CAAC,IAAI,CAAC;aACX,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kB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AC,CAAC;QAChB,KAAK,IAAI;YACP,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PipelineContext — mutable state bag threaded through all pipeline stages.
|
|
3
|
+
*
|
|
4
|
+
* Each stage reads its inputs from the context and writes its outputs back.
|
|
5
|
+
* The context is created fresh per request and is never shared across requests.
|
|
6
|
+
*
|
|
7
|
+
* ## Data ownership
|
|
8
|
+
*
|
|
9
|
+
* Stages must write to non-overlapping fields. For parallel execution, this
|
|
10
|
+
* means each `rag-query` handler writes to its own store slot
|
|
11
|
+
* (`ragResults.facts`, `.feedback`, `.state`), avoiding data races.
|
|
12
|
+
*
|
|
13
|
+
* ## Streaming
|
|
14
|
+
*
|
|
15
|
+
* Only the `tool-loop` stage streams. It uses `ctx.yield()` to push SSE
|
|
16
|
+
* chunks back to the caller. All other stages are batch operations.
|
|
17
|
+
*/
|
|
18
|
+
import type { Message } from '../../types.js';
|
|
19
|
+
import type { OrchestratorError, SmartAgentConfig, SmartAgentRagStores } from '../agent.js';
|
|
20
|
+
import type { IToolCache } from '../cache/types.js';
|
|
21
|
+
import type { IContextAssembler } from '../interfaces/assembler.js';
|
|
22
|
+
import type { ISubpromptClassifier } from '../interfaces/classifier.js';
|
|
23
|
+
import type { ILlm } from '../interfaces/llm.js';
|
|
24
|
+
import type { IMcpClient } from '../interfaces/mcp-client.js';
|
|
25
|
+
import type { CallOptions, LlmStreamChunk, LlmTool, McpTool, RagResult, Result, Subprompt, TimingEntry } from '../interfaces/types.js';
|
|
26
|
+
import type { ILogger } from '../logger/types.js';
|
|
27
|
+
import type { IMetrics } from '../metrics/types.js';
|
|
28
|
+
import type { ToolAvailabilityRegistry } from '../policy/tool-availability-registry.js';
|
|
29
|
+
import type { IPromptInjectionDetector, IToolPolicy } from '../policy/types.js';
|
|
30
|
+
import type { IQueryExpander } from '../rag/query-expander.js';
|
|
31
|
+
import type { IReranker } from '../reranker/types.js';
|
|
32
|
+
import type { ISessionManager } from '../session/types.js';
|
|
33
|
+
import type { ITracer } from '../tracer/types.js';
|
|
34
|
+
import type { IOutputValidator } from '../validator/types.js';
|
|
35
|
+
export interface PipelineContext {
|
|
36
|
+
/** Original user input (string or message array). */
|
|
37
|
+
readonly textOrMessages: string | Message[];
|
|
38
|
+
/** Call options including signal, sessionId, logger, trace. */
|
|
39
|
+
readonly options: CallOptions | undefined;
|
|
40
|
+
/** SmartAgent config snapshot for this request. */
|
|
41
|
+
readonly config: SmartAgentConfig;
|
|
42
|
+
/** Session ID (from options or 'default'). */
|
|
43
|
+
readonly sessionId: string;
|
|
44
|
+
readonly mainLlm: ILlm;
|
|
45
|
+
readonly helperLlm: ILlm | undefined;
|
|
46
|
+
readonly classifierLlm: ILlm;
|
|
47
|
+
readonly classifier: ISubpromptClassifier;
|
|
48
|
+
readonly assembler: IContextAssembler;
|
|
49
|
+
readonly ragStores: SmartAgentRagStores;
|
|
50
|
+
readonly mcpClients: IMcpClient[];
|
|
51
|
+
readonly reranker: IReranker;
|
|
52
|
+
readonly queryExpander: IQueryExpander;
|
|
53
|
+
readonly toolCache: IToolCache;
|
|
54
|
+
readonly outputValidator: IOutputValidator;
|
|
55
|
+
readonly sessionManager: ISessionManager;
|
|
56
|
+
readonly tracer: ITracer;
|
|
57
|
+
readonly metrics: IMetrics;
|
|
58
|
+
readonly logger: ILogger | undefined;
|
|
59
|
+
readonly toolPolicy: IToolPolicy | undefined;
|
|
60
|
+
readonly injectionDetector: IPromptInjectionDetector | undefined;
|
|
61
|
+
readonly toolAvailabilityRegistry: ToolAvailabilityRegistry;
|
|
62
|
+
/** Extracted user text from the last user message. */
|
|
63
|
+
inputText: string;
|
|
64
|
+
/** Conversation history (may be summarized). */
|
|
65
|
+
history: Message[];
|
|
66
|
+
/** Classified subprompts (set by classify stage). */
|
|
67
|
+
subprompts: Subprompt[];
|
|
68
|
+
/** Map of tool name → owning MCP client. */
|
|
69
|
+
toolClientMap: Map<string, IMcpClient>;
|
|
70
|
+
/** Text used for RAG queries (may be translated/expanded). */
|
|
71
|
+
ragText: string;
|
|
72
|
+
/** RAG query results per store. */
|
|
73
|
+
ragResults: {
|
|
74
|
+
facts: RagResult[];
|
|
75
|
+
feedback: RagResult[];
|
|
76
|
+
state: RagResult[];
|
|
77
|
+
};
|
|
78
|
+
/** All MCP tools from all connected servers. */
|
|
79
|
+
mcpTools: McpTool[];
|
|
80
|
+
/** Tools selected for the current request (MCP + external). */
|
|
81
|
+
selectedTools: LlmTool[];
|
|
82
|
+
/** External tools provided by the client. */
|
|
83
|
+
externalTools: LlmTool[];
|
|
84
|
+
/** Final assembled messages for LLM input. */
|
|
85
|
+
assembledMessages: Message[];
|
|
86
|
+
/** Currently active tools (after availability filtering). */
|
|
87
|
+
activeTools: LlmTool[];
|
|
88
|
+
/** Whether RAG retrieval should run (set by classify or condition logic). */
|
|
89
|
+
shouldRetrieve: boolean;
|
|
90
|
+
/** Whether input text is ASCII-only (affects translation decision). */
|
|
91
|
+
isAscii: boolean;
|
|
92
|
+
/** Whether SAP/ABAP context was detected. */
|
|
93
|
+
isSapRequired: boolean;
|
|
94
|
+
/** Timing entries collected from all stages. */
|
|
95
|
+
timing: TimingEntry[];
|
|
96
|
+
/** Error set by a stage to abort the pipeline. */
|
|
97
|
+
error?: OrchestratorError;
|
|
98
|
+
/**
|
|
99
|
+
* Yield a chunk to the consumer. Used by the tool-loop stage to push
|
|
100
|
+
* streaming content and heartbeats back through the SSE connection.
|
|
101
|
+
*/
|
|
102
|
+
yield(chunk: Result<LlmStreamChunk, OrchestratorError>): void;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAE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C,CAAC;IACvC,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,UAAU,EAAE;QACV,KAAK,EAAE,SAAS,EAAE,CAAC;QACnB,QAAQ,EAAE,SAAS,EAAE,CAAC;QACtB,KAAK,EAAE,SAAS,EAAE,CAAC;KACpB,CAAC;IACF,gDAAgD;IAChD,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,+DAA+D;IAC/D,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,6CAA6C;IAC7C,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,8CAA8C;IAC9C,iBAAiB,EAAE,OAAO,EAAE,CAAC;IAC7B,6DAA6D;IAC7D,WAAW,EAAE,OAAO,EAAE,CAAC;IAIvB,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC;IACxB,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,aAAa,EAAE,OAAO,CAAC;IAIvB,gDAAgD;IAChD,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,kDAAkD;IAClD,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAI1B;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAI,CAAC;CAC/D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PipelineContext — mutable state bag threaded through all pipeline stages.
|
|
3
|
+
*
|
|
4
|
+
* Each stage reads its inputs from the context and writes its outputs back.
|
|
5
|
+
* The context is created fresh per request and is never shared across requests.
|
|
6
|
+
*
|
|
7
|
+
* ## Data ownership
|
|
8
|
+
*
|
|
9
|
+
* Stages must write to non-overlapping fields. For parallel execution, this
|
|
10
|
+
* means each `rag-query` handler writes to its own store slot
|
|
11
|
+
* (`ragResults.facts`, `.feedback`, `.state`), avoiding data races.
|
|
12
|
+
*
|
|
13
|
+
* ## Streaming
|
|
14
|
+
*
|
|
15
|
+
* Only the `tool-loop` stage streams. It uses `ctx.yield()` to push SSE
|
|
16
|
+
* chunks back to the caller. All other stages are batch operations.
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default pipeline definition — matches the current hardcoded SmartAgent flow.
|
|
3
|
+
*
|
|
4
|
+
* This serves two purposes:
|
|
5
|
+
* 1. **Documentation** — shows exactly what stages the default pipeline runs.
|
|
6
|
+
* 2. **Fallback** — used when no custom pipeline is defined.
|
|
7
|
+
*
|
|
8
|
+
* ## Default pipeline stages
|
|
9
|
+
*
|
|
10
|
+
* ```text
|
|
11
|
+
* classify — decompose user input into typed subprompts
|
|
12
|
+
* ↓
|
|
13
|
+
* summarize — condense history if too long (conditional)
|
|
14
|
+
* ↓
|
|
15
|
+
* rag-upsert — upsert fact/state/feedback to RAG (conditional)
|
|
16
|
+
* ↓
|
|
17
|
+
* rag-retrieval — parallel block (conditional on shouldRetrieve):
|
|
18
|
+
* ├─ translate — translate non-ASCII to English
|
|
19
|
+
* └─ expand — expand query with synonyms
|
|
20
|
+
* after:
|
|
21
|
+
* ├─ rag-query ×3 — query facts/feedback/state in parallel
|
|
22
|
+
* └─ rerank — re-score RAG results
|
|
23
|
+
* ↓
|
|
24
|
+
* tool-select — ALWAYS runs (queries facts RAG if retrieval was skipped)
|
|
25
|
+
* ↓
|
|
26
|
+
* assemble — build final LLM context
|
|
27
|
+
* ↓
|
|
28
|
+
* tool-loop — streaming LLM + tool execution loop
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
import type { StageDefinition, StructuredPipelineDefinition } from './types.js';
|
|
32
|
+
/**
|
|
33
|
+
* Returns the default pipeline stage definitions.
|
|
34
|
+
*
|
|
35
|
+
* This matches the behavior of `SmartAgent.streamProcess()` when no
|
|
36
|
+
* structured pipeline is configured.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getDefaultPipelineDefinition(): StructuredPipelineDefinition;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the default stage list.
|
|
41
|
+
* Exported separately for composition — consumers can use this as a base
|
|
42
|
+
* and add/remove/reorder stages.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getDefaultStages(): StageDefinition[];
|
|
45
|
+
//# sourceMappingURL=default-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-pipeline.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/default-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,4BAA4B,CAK3E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,EAAE,CAqEpD"}
|