@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,118 @@
|
|
|
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
|
+
/**
|
|
32
|
+
* Returns the default pipeline stage definitions.
|
|
33
|
+
*
|
|
34
|
+
* This matches the behavior of `SmartAgent.streamProcess()` when no
|
|
35
|
+
* structured pipeline is configured.
|
|
36
|
+
*/
|
|
37
|
+
export function getDefaultPipelineDefinition() {
|
|
38
|
+
return {
|
|
39
|
+
version: '1',
|
|
40
|
+
stages: getDefaultStages(),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns the default stage list.
|
|
45
|
+
* Exported separately for composition — consumers can use this as a base
|
|
46
|
+
* and add/remove/reorder stages.
|
|
47
|
+
*/
|
|
48
|
+
export function getDefaultStages() {
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
id: 'classify',
|
|
52
|
+
type: 'classify',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'summarize',
|
|
56
|
+
type: 'summarize',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'rag-upsert',
|
|
60
|
+
type: 'rag-upsert',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'rag-retrieval',
|
|
64
|
+
type: 'parallel',
|
|
65
|
+
when: 'shouldRetrieve',
|
|
66
|
+
stages: [
|
|
67
|
+
{
|
|
68
|
+
id: 'translate',
|
|
69
|
+
type: 'translate',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'expand',
|
|
73
|
+
type: 'expand',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
after: [
|
|
77
|
+
{
|
|
78
|
+
id: 'rag-query',
|
|
79
|
+
type: 'parallel',
|
|
80
|
+
stages: [
|
|
81
|
+
{
|
|
82
|
+
id: 'rag-facts',
|
|
83
|
+
type: 'rag-query',
|
|
84
|
+
config: { store: 'facts' },
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'rag-feedback',
|
|
88
|
+
type: 'rag-query',
|
|
89
|
+
config: { store: 'feedback' },
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'rag-state',
|
|
93
|
+
type: 'rag-query',
|
|
94
|
+
config: { store: 'state' },
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'rerank',
|
|
100
|
+
type: 'rerank',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'tool-select',
|
|
106
|
+
type: 'tool-select',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'assemble',
|
|
110
|
+
type: 'assemble',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'tool-loop',
|
|
114
|
+
type: 'tool-loop',
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=default-pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-pipeline.js","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/default-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B;IAC1C,OAAO;QACL,OAAO,EAAE,GAAG;QACZ,MAAM,EAAE,gBAAgB,EAAE;KAC3B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL;YACE,EAAE,EAAE,UAAU;YACd,IAAI,EAAE,UAAU;SACjB;QACD;YACE,EAAE,EAAE,WAAW;YACf,IAAI,EAAE,WAAW;SAClB;QACD;YACE,EAAE,EAAE,YAAY;YAChB,IAAI,EAAE,YAAY;SACnB;QACD;YACE,EAAE,EAAE,eAAe;YACnB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE;gBACN;oBACE,EAAE,EAAE,WAAW;oBACf,IAAI,EAAE,WAAW;iBAClB;gBACD;oBACE,EAAE,EAAE,QAAQ;oBACZ,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,KAAK,EAAE;gBACL;oBACE,EAAE,EAAE,WAAW;oBACf,IAAI,EAAE,UAAU;oBAChB,MAAM,EAAE;wBACN;4BACE,EAAE,EAAE,WAAW;4BACf,IAAI,EAAE,WAAW;4BACjB,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;yBAC3B;wBACD;4BACE,EAAE,EAAE,cAAc;4BAClB,IAAI,EAAE,WAAW;4BACjB,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE;yBAC9B;wBACD;4BACE,EAAE,EAAE,WAAW;4BACf,IAAI,EAAE,WAAW;4BACjB,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;yBAC3B;qBACF;iBACF;gBACD;oBACE,EAAE,EAAE,QAAQ;oBACZ,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD;YACE,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,aAAa;SACpB;QACD;YACE,EAAE,EAAE,UAAU;YACd,IAAI,EAAE,UAAU;SACjB;QACD;YACE,EAAE,EAAE,WAAW;YACf,IAAI,EAAE,WAAW;SAClB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PipelineExecutor — walks a stage definition tree and dispatches to handlers.
|
|
3
|
+
*
|
|
4
|
+
* The executor is the engine that interprets the structured pipeline YAML.
|
|
5
|
+
* It handles three execution modes:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Sequential** (default) — stages in a list run one after another.
|
|
8
|
+
* 2. **Parallel** — child stages run concurrently via `Promise.all`.
|
|
9
|
+
* Optional `after` stages run sequentially after all children complete.
|
|
10
|
+
* 3. **Repeat** — child stages run in a loop until a condition or max iterations.
|
|
11
|
+
*
|
|
12
|
+
* ## Condition evaluation
|
|
13
|
+
*
|
|
14
|
+
* Each stage can have a `when` field — a condition expression evaluated
|
|
15
|
+
* against the {@link PipelineContext}. If the condition is falsy, the stage
|
|
16
|
+
* is skipped. See {@link evaluateCondition} for supported expression syntax.
|
|
17
|
+
*
|
|
18
|
+
* ## Error handling
|
|
19
|
+
*
|
|
20
|
+
* If a handler returns `false` or sets `ctx.error`, the executor stops
|
|
21
|
+
* processing and propagates the error back to the caller.
|
|
22
|
+
*
|
|
23
|
+
* ## Tracing
|
|
24
|
+
*
|
|
25
|
+
* Each stage execution is wrapped in a tracer span named `pipeline.<stage.id>`.
|
|
26
|
+
* The span is passed to the handler for sub-span creation.
|
|
27
|
+
*/
|
|
28
|
+
import type { ISpan, ITracer } from '../tracer/types.js';
|
|
29
|
+
import type { PipelineContext } from './context.js';
|
|
30
|
+
import type { StageHandlerRegistry } from './handlers/index.js';
|
|
31
|
+
import type { StageDefinition } from './types.js';
|
|
32
|
+
export declare class PipelineExecutor {
|
|
33
|
+
private readonly handlers;
|
|
34
|
+
private readonly tracer;
|
|
35
|
+
constructor(handlers: StageHandlerRegistry, tracer: ITracer);
|
|
36
|
+
/**
|
|
37
|
+
* Execute a list of stages sequentially.
|
|
38
|
+
*
|
|
39
|
+
* @param stages - Stage definitions to execute in order.
|
|
40
|
+
* @param ctx - Mutable pipeline context.
|
|
41
|
+
* @param parentSpan - Parent tracing span.
|
|
42
|
+
* @returns `true` if all stages completed successfully, `false` if aborted.
|
|
43
|
+
*/
|
|
44
|
+
executeStages(stages: StageDefinition[], ctx: PipelineContext, parentSpan: ISpan): Promise<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* Execute child stages in parallel, then run `after` stages sequentially.
|
|
47
|
+
*/
|
|
48
|
+
private _executeParallel;
|
|
49
|
+
/**
|
|
50
|
+
* Execute child stages in a loop until condition or max iterations.
|
|
51
|
+
*/
|
|
52
|
+
private _executeRepeat;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,OAAO;IAGlC;;;;;;;OAOG;IACG,aAAa,CACjB,MAAM,EAAE,eAAe,EAAE,EACzB,GAAG,EAAE,eAAe,EACpB,UAAU,EAAE,KAAK,GAChB,OAAO,CAAC,OAAO,CAAC;IAyDnB;;OAEG;YACW,gBAAgB;IAoB9B;;OAEG;YACW,cAAc;CAkB7B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PipelineExecutor — walks a stage definition tree and dispatches to handlers.
|
|
3
|
+
*
|
|
4
|
+
* The executor is the engine that interprets the structured pipeline YAML.
|
|
5
|
+
* It handles three execution modes:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Sequential** (default) — stages in a list run one after another.
|
|
8
|
+
* 2. **Parallel** — child stages run concurrently via `Promise.all`.
|
|
9
|
+
* Optional `after` stages run sequentially after all children complete.
|
|
10
|
+
* 3. **Repeat** — child stages run in a loop until a condition or max iterations.
|
|
11
|
+
*
|
|
12
|
+
* ## Condition evaluation
|
|
13
|
+
*
|
|
14
|
+
* Each stage can have a `when` field — a condition expression evaluated
|
|
15
|
+
* against the {@link PipelineContext}. If the condition is falsy, the stage
|
|
16
|
+
* is skipped. See {@link evaluateCondition} for supported expression syntax.
|
|
17
|
+
*
|
|
18
|
+
* ## Error handling
|
|
19
|
+
*
|
|
20
|
+
* If a handler returns `false` or sets `ctx.error`, the executor stops
|
|
21
|
+
* processing and propagates the error back to the caller.
|
|
22
|
+
*
|
|
23
|
+
* ## Tracing
|
|
24
|
+
*
|
|
25
|
+
* Each stage execution is wrapped in a tracer span named `pipeline.<stage.id>`.
|
|
26
|
+
* The span is passed to the handler for sub-span creation.
|
|
27
|
+
*/
|
|
28
|
+
import { evaluateCondition } from './condition-evaluator.js';
|
|
29
|
+
export class PipelineExecutor {
|
|
30
|
+
handlers;
|
|
31
|
+
tracer;
|
|
32
|
+
constructor(handlers, tracer) {
|
|
33
|
+
this.handlers = handlers;
|
|
34
|
+
this.tracer = tracer;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Execute a list of stages sequentially.
|
|
38
|
+
*
|
|
39
|
+
* @param stages - Stage definitions to execute in order.
|
|
40
|
+
* @param ctx - Mutable pipeline context.
|
|
41
|
+
* @param parentSpan - Parent tracing span.
|
|
42
|
+
* @returns `true` if all stages completed successfully, `false` if aborted.
|
|
43
|
+
*/
|
|
44
|
+
async executeStages(stages, ctx, parentSpan) {
|
|
45
|
+
for (const stage of stages) {
|
|
46
|
+
if (ctx.error)
|
|
47
|
+
return false;
|
|
48
|
+
if (ctx.options?.signal?.aborted)
|
|
49
|
+
return false;
|
|
50
|
+
// Evaluate `when` condition
|
|
51
|
+
const shouldRun = evaluateCondition(stage.when, ctx);
|
|
52
|
+
if (!shouldRun) {
|
|
53
|
+
ctx.options?.sessionLogger?.logStep(`stage_skipped_${stage.id}`, {
|
|
54
|
+
reason: stage.when,
|
|
55
|
+
});
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const span = this.tracer.startSpan(`pipeline.${stage.id}`, {
|
|
59
|
+
parent: parentSpan,
|
|
60
|
+
attributes: { 'stage.type': stage.type },
|
|
61
|
+
});
|
|
62
|
+
const stageStart = Date.now();
|
|
63
|
+
let ok;
|
|
64
|
+
try {
|
|
65
|
+
if (stage.type === 'parallel') {
|
|
66
|
+
ok = await this._executeParallel(stage, ctx, span);
|
|
67
|
+
}
|
|
68
|
+
else if (stage.type === 'repeat') {
|
|
69
|
+
ok = await this._executeRepeat(stage, ctx, span);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const handler = this.handlers.get(stage.type);
|
|
73
|
+
if (!handler) {
|
|
74
|
+
throw new Error(`Unknown stage type "${stage.type}" in stage "${stage.id}". ` +
|
|
75
|
+
`Available types: ${[...this.handlers.keys()].join(', ')}, parallel, repeat`);
|
|
76
|
+
}
|
|
77
|
+
ok = await handler.execute(ctx, stage.config ?? {}, span);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
span.setStatus('error', String(err));
|
|
82
|
+
span.end();
|
|
83
|
+
ctx.options?.sessionLogger?.logStep(`stage_error_${stage.id}`, {
|
|
84
|
+
error: String(err),
|
|
85
|
+
});
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
ctx.timing.push({
|
|
89
|
+
phase: stage.id,
|
|
90
|
+
duration: Date.now() - stageStart,
|
|
91
|
+
});
|
|
92
|
+
span.setStatus(ok ? 'ok' : 'error');
|
|
93
|
+
span.end();
|
|
94
|
+
if (!ok)
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Execute child stages in parallel, then run `after` stages sequentially.
|
|
101
|
+
*/
|
|
102
|
+
async _executeParallel(stage, ctx, parentSpan) {
|
|
103
|
+
if (!stage.stages?.length)
|
|
104
|
+
return true;
|
|
105
|
+
const results = await Promise.all(stage.stages.map((child) => this.executeStages([child], ctx, parentSpan)));
|
|
106
|
+
if (results.some((r) => !r))
|
|
107
|
+
return false;
|
|
108
|
+
// Run sequential `after` stages after all parallel children complete
|
|
109
|
+
if (stage.after?.length) {
|
|
110
|
+
return this.executeStages(stage.after, ctx, parentSpan);
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Execute child stages in a loop until condition or max iterations.
|
|
116
|
+
*/
|
|
117
|
+
async _executeRepeat(stage, ctx, parentSpan) {
|
|
118
|
+
const max = stage.maxIterations ?? 10;
|
|
119
|
+
for (let i = 0; i < max; i++) {
|
|
120
|
+
// Check `until` stop condition
|
|
121
|
+
if (stage.until && evaluateCondition(stage.until, ctx)) {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
if (stage.stages) {
|
|
125
|
+
const ok = await this.executeStages(stage.stages, ctx, parentSpan);
|
|
126
|
+
if (!ok)
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAK7D,MAAM,OAAO,gBAAgB;IAER;IACA;IAFnB,YACmB,QAA8B,EAC9B,MAAe;QADf,aAAQ,GAAR,QAAQ,CAAsB;QAC9B,WAAM,GAAN,MAAM,CAAS;IAC/B,CAAC;IAEJ;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa,CACjB,MAAyB,EACzB,GAAoB,EACpB,UAAiB;QAEjB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,GAAG,CAAC,KAAK;gBAAE,OAAO,KAAK,CAAC;YAC5B,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO;gBAAE,OAAO,KAAK,CAAC;YAE/C,4BAA4B;YAC5B,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YACrD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,iBAAiB,KAAK,CAAC,EAAE,EAAE,EAAE;oBAC/D,MAAM,EAAE,KAAK,CAAC,IAAI;iBACnB,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,KAAK,CAAC,EAAE,EAAE,EAAE;gBACzD,MAAM,EAA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oB,EACpB,UAAiB;QAEjB,MAAM,GAAG,GAAG,KAAK,CAAC,aAAa,IAAI,EAAE,CAAC;QACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7B,+BAA+B;YAC/B,IAAI,KAAK,CAAC,KAAK,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;gBACvD,MAAM;YACR,CAAC;YACD,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACjB,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;gBACnE,IAAI,CAAC,EAAE;oBAAE,OAAO,KAAK,CAAC;YACxB,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AssembleHandler — builds the final LLM context from action + retrieved + history.
|
|
3
|
+
*
|
|
4
|
+
* Reads: `ctx.subprompts`, `ctx.ragResults`, `ctx.mcpTools` (selected), `ctx.history`
|
|
5
|
+
* Writes: `ctx.assembledMessages`
|
|
6
|
+
*
|
|
7
|
+
* Merges multiple action subprompts into a single action, then delegates
|
|
8
|
+
* to the injected IContextAssembler.
|
|
9
|
+
*/
|
|
10
|
+
import type { ISpan } from '../../tracer/types.js';
|
|
11
|
+
import type { PipelineContext } from '../context.js';
|
|
12
|
+
import type { IStageHandler } from '../stage-handler.js';
|
|
13
|
+
export declare class AssembleHandler implements IStageHandler {
|
|
14
|
+
execute(ctx: PipelineContext, _config: Record<string, unknown>, span: ISpan): Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=assemble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/smart-agent/pipeline/handlers/assemble.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,qBAAa,eAAgB,YAAW,aAAa;IAC7C,OAAO,CACX,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,OAAO,CAAC;CAgEpB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AssembleHandler — builds the final LLM context from action + retrieved + history.
|
|
3
|
+
*
|
|
4
|
+
* Reads: `ctx.subprompts`, `ctx.ragResults`, `ctx.mcpTools` (selected), `ctx.history`
|
|
5
|
+
* Writes: `ctx.assembledMessages`
|
|
6
|
+
*
|
|
7
|
+
* Merges multiple action subprompts into a single action, then delegates
|
|
8
|
+
* to the injected IContextAssembler.
|
|
9
|
+
*/
|
|
10
|
+
import { OrchestratorError } from '../../agent.js';
|
|
11
|
+
export class AssembleHandler {
|
|
12
|
+
async execute(ctx, _config, span) {
|
|
13
|
+
const actions = ctx.subprompts.filter((sp) => sp.type === 'action');
|
|
14
|
+
// Merge multiple actions into one
|
|
15
|
+
const mainAction = actions.length > 1
|
|
16
|
+
? {
|
|
17
|
+
type: 'action',
|
|
18
|
+
text: actions.map((a) => a.text).join('\n'),
|
|
19
|
+
context: actions.find((a) => a.context)?.context,
|
|
20
|
+
dependency: 'independent',
|
|
21
|
+
}
|
|
22
|
+
: actions.length === 1
|
|
23
|
+
? actions[0]
|
|
24
|
+
: (ctx.subprompts.find((sp) => sp.type === 'chat') ??
|
|
25
|
+
ctx.subprompts[0]);
|
|
26
|
+
if (actions.length > 1) {
|
|
27
|
+
ctx.options?.sessionLogger?.logStep('actions_merged', {
|
|
28
|
+
count: actions.length,
|
|
29
|
+
actions: actions.map((a) => ({
|
|
30
|
+
text: a.text,
|
|
31
|
+
dependency: a.dependency,
|
|
32
|
+
})),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// Build retrieved context — select tools that were chosen
|
|
36
|
+
const selectedMcpTools = ctx.mcpTools.filter((t) => ctx.activeTools.some((at) => at.name === t.name));
|
|
37
|
+
const retrieved = {
|
|
38
|
+
facts: ctx.ragResults.facts,
|
|
39
|
+
feedback: ctx.ragResults.feedback,
|
|
40
|
+
state: ctx.ragResults.state,
|
|
41
|
+
tools: selectedMcpTools,
|
|
42
|
+
};
|
|
43
|
+
const result = await ctx.assembler.assemble(mainAction, retrieved, ctx.history, ctx.options);
|
|
44
|
+
if (!result.ok) {
|
|
45
|
+
ctx.error = new OrchestratorError(result.error.message, 'ASSEMBLER_ERROR');
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
ctx.assembledMessages = result.value;
|
|
49
|
+
ctx.options?.sessionLogger?.logStep('final_context_assembled', {
|
|
50
|
+
messages: result.value,
|
|
51
|
+
tools: ctx.activeTools.map((t) => t.name),
|
|
52
|
+
});
|
|
53
|
+
span.setAttribute('message_count', result.value.length);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=assemble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/smart-agent/pipeline/handlers/assemble.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAMnD,MAAM,OAAO,eAAe;IAC1B,KAAK,CAAC,OAAO,CACX,GAAoB,EACpB,OAAgC,EAChC,IAAW;QAEX,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAA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|
7
|
+
* When classification is disabled (`config.classificationEnabled === false`),
|
|
8
|
+
* the input is treated as a single action subprompt.
|
|
9
|
+
*/
|
|
10
|
+
import type { ISpan } from '../../tracer/types.js';
|
|
11
|
+
import type { PipelineContext } from '../context.js';
|
|
12
|
+
import type { IStageHandler } from '../stage-handler.js';
|
|
13
|
+
export declare class ClassifyHandler implements IStageHandler {
|
|
14
|
+
execute(ctx: PipelineContext, _config: Record<string, unknown>, span: ISpan): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Update control flags based on classified subprompts.
|
|
17
|
+
* These flags are used by `when` conditions on downstream stages.
|
|
18
|
+
*/
|
|
19
|
+
private _updateControlFlags;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../../../src/smart-agent/pipeline/handlers/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,qBAAa,eAAgB,YAAW,aAAa;IAC7C,OAAO,CACX,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,OAAO,CAAC;IAmCnB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAU5B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClassifyHandler — decomposes user input into typed subprompts.
|
|
3
|
+
*
|
|
4
|
+
* Reads: `ctx.inputText`
|
|
5
|
+
* Writes: `ctx.subprompts`, `ctx.isSapRequired`, `ctx.shouldRetrieve`
|
|
6
|
+
*
|
|
7
|
+
* When classification is disabled (`config.classificationEnabled === false`),
|
|
8
|
+
* the input is treated as a single action subprompt.
|
|
9
|
+
*/
|
|
10
|
+
import { OrchestratorError } from '../../agent.js';
|
|
11
|
+
export class ClassifyHandler {
|
|
12
|
+
async execute(ctx, _config, span) {
|
|
13
|
+
if (ctx.config.classificationEnabled === false) {
|
|
14
|
+
ctx.subprompts = [
|
|
15
|
+
{ type: 'action', text: ctx.inputText, dependency: 'independent' },
|
|
16
|
+
];
|
|
17
|
+
ctx.options?.sessionLogger?.logStep('classification_skipped', {
|
|
18
|
+
text: ctx.inputText,
|
|
19
|
+
});
|
|
20
|
+
span.setAttribute('skipped', true);
|
|
21
|
+
this._updateControlFlags(ctx);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
const result = await ctx.classifier.classify(ctx.inputText, ctx.options);
|
|
25
|
+
if (!result.ok) {
|
|
26
|
+
ctx.error = new OrchestratorError(result.error.message, 'CLASSIFIER_ERROR');
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
ctx.subprompts = result.value;
|
|
30
|
+
ctx.options?.sessionLogger?.logStep('classifier_response', {
|
|
31
|
+
subprompts: result.value,
|
|
32
|
+
});
|
|
33
|
+
for (const sp of ctx.subprompts) {
|
|
34
|
+
ctx.metrics.classifierIntentCount.add(1, { intent: sp.type });
|
|
35
|
+
}
|
|
36
|
+
this._updateControlFlags(ctx);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Update control flags based on classified subprompts.
|
|
41
|
+
* These flags are used by `when` conditions on downstream stages.
|
|
42
|
+
*/
|
|
43
|
+
_updateControlFlags(ctx) {
|
|
44
|
+
const actions = ctx.subprompts.filter((sp) => sp.type === 'action');
|
|
45
|
+
const mode = ctx.config.mode || 'smart';
|
|
46
|
+
ctx.isSapRequired =
|
|
47
|
+
actions.some((a) => a.context === 'sap-abap') || mode === 'hard';
|
|
48
|
+
const ragMode = ctx.config.ragRetrievalMode ?? 'auto';
|
|
49
|
+
ctx.shouldRetrieve =
|
|
50
|
+
ragMode === 'always' || (ragMode === 'auto' && ctx.isSapRequired);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=classify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../../../src/smart-agent/pipeline/handlers/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKnD,MAAM,OAAO,eAAe;IAC1B,KAAK,CAAC,OAAO,CACX,GAAoB,EACpB,OAAgC,EAChC,IAAW;QAEX,IAAI,GAAG,CAAC,MAAM,CAAC,qBAAqB,KAAK,KAAK,EAAE,CAAC;YAC/C,GAAG,CAAC,UAAU,GAAG;gBACf,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE;aACnE,CAAC;YACF,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,wBAAwB,EAAE;gBAC5D,IAAI,EAAE,GAAG,CAAC,SAAS;aACpB,CAAC,CAAC;YACH,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,GAAG,IAAI,iBAAiB,CAC/B,MAAM,CAAC,KAAK,CAAC,OAAO,EACpB,kBAAkB,CACnB,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;QAED,GAAG,CAAC,UA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
|
|
7
|
+
* Uses the injected IQueryExpander to broaden RAG queries.
|
|
8
|
+
* Skipped when `queryExpansionEnabled` is false.
|
|
9
|
+
*/
|
|
10
|
+
import type { ISpan } from '../../tracer/types.js';
|
|
11
|
+
import type { PipelineContext } from '../context.js';
|
|
12
|
+
import type { IStageHandler } from '../stage-handler.js';
|
|
13
|
+
export declare class ExpandHandler implements IStageHandler {
|
|
14
|
+
execute(ctx: PipelineContext, _config: Record<string, unknown>, span: ISpan): Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=expand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../../src/smart-agent/pipeline/handlers/expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,qBAAa,aAAc,YAAW,aAAa;IAC3C,OAAO,CACX,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,OAAO,CAAC;CAcpB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExpandHandler — expands RAG query with synonyms and related terms.
|
|
3
|
+
*
|
|
4
|
+
* Reads: `ctx.ragText`, `ctx.queryExpander`
|
|
5
|
+
* Writes: `ctx.ragText`
|
|
6
|
+
*
|
|
7
|
+
* Uses the injected IQueryExpander to broaden RAG queries.
|
|
8
|
+
* Skipped when `queryExpansionEnabled` is false.
|
|
9
|
+
*/
|
|
10
|
+
export class ExpandHandler {
|
|
11
|
+
async execute(ctx, _config, span) {
|
|
12
|
+
if (!ctx.config.queryExpansionEnabled) {
|
|
13
|
+
span.setAttribute('skipped', true);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
const result = await ctx.queryExpander.expand(ctx.ragText, ctx.options);
|
|
17
|
+
if (result.ok) {
|
|
18
|
+
ctx.ragText = result.value;
|
|
19
|
+
span.setAttribute('expanded', true);
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../../src/smart-agent/pipeline/handlers/expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,OAAO,aAAa;IACxB,KAAK,CAAC,OAAO,CACX,GAAoB,EACpB,OAAgC,EAChC,IAAW;QAEX,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;YACtC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QACxE,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;YAC3B,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default stage handler registry.
|
|
3
|
+
*
|
|
4
|
+
* Maps built-in stage type names to their handler implementations.
|
|
5
|
+
* Custom handlers can be added via `SmartAgentBuilder.withStageHandler()`.
|
|
6
|
+
*/
|
|
7
|
+
import type { IStageHandler } from '../stage-handler.js';
|
|
8
|
+
import { AssembleHandler } from './assemble.js';
|
|
9
|
+
import { ClassifyHandler } from './classify.js';
|
|
10
|
+
import { ExpandHandler } from './expand.js';
|
|
11
|
+
import { RagQueryHandler } from './rag-query.js';
|
|
12
|
+
import { RagUpsertHandler } from './rag-upsert.js';
|
|
13
|
+
import { RerankHandler } from './rerank.js';
|
|
14
|
+
import { SummarizeHandler } from './summarize.js';
|
|
15
|
+
import { ToolLoopHandler } from './tool-loop.js';
|
|
16
|
+
import { ToolSelectHandler } from './tool-select.js';
|
|
17
|
+
import { TranslateHandler } from './translate.js';
|
|
18
|
+
export type StageHandlerRegistry = Map<string, IStageHandler>;
|
|
19
|
+
/**
|
|
20
|
+
* Build the default handler registry with all built-in stage handlers.
|
|
21
|
+
*
|
|
22
|
+
* The registry maps stage type names (as used in YAML) to their handler
|
|
23
|
+
* instances. All handlers are stateless — they read/write through the
|
|
24
|
+
* {@link PipelineContext}.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildDefaultHandlerRegistry(): StageHandlerRegistry;
|
|
27
|
+
export { AssembleHandler, ClassifyHandler, ExpandHandler, RagQueryHandler, RagUpsertHandler, RerankHandler, SummarizeHandler, ToolLoopHandler, ToolSelectHandler, TranslateHandler, };
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/smart-agent/pipeline/handlers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,2BAA2B,IAAI,oBAAoB,CAalE;AAED,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default stage handler registry.
|
|
3
|
+
*
|
|
4
|
+
* Maps built-in stage type names to their handler implementations.
|
|
5
|
+
* Custom handlers can be added via `SmartAgentBuilder.withStageHandler()`.
|
|
6
|
+
*/
|
|
7
|
+
import { AssembleHandler } from './assemble.js';
|
|
8
|
+
import { ClassifyHandler } from './classify.js';
|
|
9
|
+
import { ExpandHandler } from './expand.js';
|
|
10
|
+
import { RagQueryHandler } from './rag-query.js';
|
|
11
|
+
import { RagUpsertHandler } from './rag-upsert.js';
|
|
12
|
+
import { RerankHandler } from './rerank.js';
|
|
13
|
+
import { SummarizeHandler } from './summarize.js';
|
|
14
|
+
import { ToolLoopHandler } from './tool-loop.js';
|
|
15
|
+
import { ToolSelectHandler } from './tool-select.js';
|
|
16
|
+
import { TranslateHandler } from './translate.js';
|
|
17
|
+
/**
|
|
18
|
+
* Build the default handler registry with all built-in stage handlers.
|
|
19
|
+
*
|
|
20
|
+
* The registry maps stage type names (as used in YAML) to their handler
|
|
21
|
+
* instances. All handlers are stateless — they read/write through the
|
|
22
|
+
* {@link PipelineContext}.
|
|
23
|
+
*/
|
|
24
|
+
export function buildDefaultHandlerRegistry() {
|
|
25
|
+
return new Map([
|
|
26
|
+
['classify', new ClassifyHandler()],
|
|
27
|
+
['summarize', new SummarizeHandler()],
|
|
28
|
+
['rag-upsert', new RagUpsertHandler()],
|
|
29
|
+
['translate', new TranslateHandler()],
|
|
30
|
+
['expand', new ExpandHandler()],
|
|
31
|
+
['rag-query', new RagQueryHandler()],
|
|
32
|
+
['rerank', new RerankHandler()],
|
|
33
|
+
['tool-select', new ToolSelectHandler()],
|
|
34
|
+
['assemble', new AssembleHandler()],
|
|
35
|
+
['tool-loop', new ToolLoopHandler()],
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
export { AssembleHandler, ClassifyHandler, ExpandHandler, RagQueryHandler, RagUpsertHandler, RerankHandler, SummarizeHandler, ToolLoopHandler, ToolSelectHandler, TranslateHandler, };
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/smart-agent/pipeline/handlers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,IAAI,GAAG,CAAwB;QACpC,CAAC,UAAU,EAAE,IAAI,eAAe,EAAE,CAAC;QACnC,CAAC,WAAW,EAAE,IAAI,gBAAgB,EAAE,CAAC;QACrC,CAAC,YAAY,EAAE,IAAI,gBAAgB,EAAE,CAAC;QACtC,CAAC,WAAW,EAAE,IAAI,gBAAgB,EAAE,CAAC;QACrC,CAAC,QAAQ,EAAE,IAAI,aAAa,EAAE,CAAC;QAC/B,CAAC,WAAW,EAAE,IAAI,eAAe,EAAE,CAAC;QACpC,CAAC,QAAQ,EAAE,IAAI,aAAa,EAAE,CAAC;QAC/B,CAAC,aAAa,EAAE,IAAI,iBAAiB,EAAE,CAAC;QACxC,CAAC,UAAU,EAAE,IAAI,eAAe,EAAE,CAAC;QACnC,CAAC,WAAW,EAAE,IAAI,eAAe,EAAE,CAAC;KACrC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RagQueryHandler — queries a single RAG store.
|
|
3
|
+
*
|
|
4
|
+
* Reads: `ctx.ragText`, `ctx.ragStores`
|
|
5
|
+
* Writes: `ctx.ragResults[store]` where `store` is from config
|
|
6
|
+
*
|
|
7
|
+
* ## Config
|
|
8
|
+
*
|
|
9
|
+
* | Field | Type | Default | Description |
|
|
10
|
+
* |---------|--------|----------|--------------------------------------|
|
|
11
|
+
* | `store` | string | required | Which store: `'facts'`, `'feedback'`, `'state'` |
|
|
12
|
+
* | `k` | number | from ctx | Number of results to retrieve |
|
|
13
|
+
*
|
|
14
|
+
* ## Parallel safety
|
|
15
|
+
*
|
|
16
|
+
* Each instance writes to a different slot in `ctx.ragResults`, so
|
|
17
|
+
* multiple rag-query stages can safely run in parallel.
|
|
18
|
+
*/
|
|
19
|
+
import type { ISpan } from '../../tracer/types.js';
|
|
20
|
+
import type { PipelineContext } from '../context.js';
|
|
21
|
+
import type { IStageHandler } from '../stage-handler.js';
|
|
22
|
+
export declare class RagQueryHandler implements IStageHandler {
|
|
23
|
+
execute(ctx: PipelineContext, config: Record<string, unknown>, span: ISpan): Promise<boolean>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=rag-query.d.ts.map
|