@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.
Files changed (134) hide show
  1. package/dist/index.d.ts +11 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +7 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/smart-agent/agent.d.ts +18 -1
  6. package/dist/smart-agent/agent.d.ts.map +1 -1
  7. package/dist/smart-agent/agent.js +176 -21
  8. package/dist/smart-agent/agent.js.map +1 -1
  9. package/dist/smart-agent/builder.d.ts +114 -51
  10. package/dist/smart-agent/builder.d.ts.map +1 -1
  11. package/dist/smart-agent/builder.js +234 -110
  12. package/dist/smart-agent/builder.js.map +1 -1
  13. package/dist/smart-agent/cli.d.ts +1 -0
  14. package/dist/smart-agent/cli.d.ts.map +1 -1
  15. package/dist/smart-agent/cli.js +2 -0
  16. package/dist/smart-agent/cli.js.map +1 -1
  17. package/dist/smart-agent/config/config-watcher.d.ts +4 -0
  18. package/dist/smart-agent/config/config-watcher.d.ts.map +1 -1
  19. package/dist/smart-agent/config/config-watcher.js +8 -0
  20. package/dist/smart-agent/config/config-watcher.js.map +1 -1
  21. package/dist/smart-agent/config.d.ts +2 -1
  22. package/dist/smart-agent/config.d.ts.map +1 -1
  23. package/dist/smart-agent/config.js +46 -4
  24. package/dist/smart-agent/config.js.map +1 -1
  25. package/dist/smart-agent/interfaces/index.d.ts +1 -1
  26. package/dist/smart-agent/interfaces/index.d.ts.map +1 -1
  27. package/dist/smart-agent/interfaces/index.js.map +1 -1
  28. package/dist/smart-agent/interfaces/rag.d.ts +16 -0
  29. package/dist/smart-agent/interfaces/rag.d.ts.map +1 -1
  30. package/dist/smart-agent/pipeline/condition-evaluator.d.ts +35 -0
  31. package/dist/smart-agent/pipeline/condition-evaluator.d.ts.map +1 -0
  32. package/dist/smart-agent/pipeline/condition-evaluator.js +143 -0
  33. package/dist/smart-agent/pipeline/condition-evaluator.js.map +1 -0
  34. package/dist/smart-agent/pipeline/context.d.ts +104 -0
  35. package/dist/smart-agent/pipeline/context.d.ts.map +1 -0
  36. package/dist/smart-agent/pipeline/context.js +19 -0
  37. package/dist/smart-agent/pipeline/context.js.map +1 -0
  38. package/dist/smart-agent/pipeline/default-pipeline.d.ts +45 -0
  39. package/dist/smart-agent/pipeline/default-pipeline.d.ts.map +1 -0
  40. package/dist/smart-agent/pipeline/default-pipeline.js +118 -0
  41. package/dist/smart-agent/pipeline/default-pipeline.js.map +1 -0
  42. package/dist/smart-agent/pipeline/executor.d.ts +54 -0
  43. package/dist/smart-agent/pipeline/executor.d.ts.map +1 -0
  44. package/dist/smart-agent/pipeline/executor.js +133 -0
  45. package/dist/smart-agent/pipeline/executor.js.map +1 -0
  46. package/dist/smart-agent/pipeline/handlers/assemble.d.ts +16 -0
  47. package/dist/smart-agent/pipeline/handlers/assemble.d.ts.map +1 -0
  48. package/dist/smart-agent/pipeline/handlers/assemble.js +57 -0
  49. package/dist/smart-agent/pipeline/handlers/assemble.js.map +1 -0
  50. package/dist/smart-agent/pipeline/handlers/classify.d.ts +21 -0
  51. package/dist/smart-agent/pipeline/handlers/classify.d.ts.map +1 -0
  52. package/dist/smart-agent/pipeline/handlers/classify.js +53 -0
  53. package/dist/smart-agent/pipeline/handlers/classify.js.map +1 -0
  54. package/dist/smart-agent/pipeline/handlers/expand.d.ts +16 -0
  55. package/dist/smart-agent/pipeline/handlers/expand.d.ts.map +1 -0
  56. package/dist/smart-agent/pipeline/handlers/expand.js +24 -0
  57. package/dist/smart-agent/pipeline/handlers/expand.js.map +1 -0
  58. package/dist/smart-agent/pipeline/handlers/index.d.ts +28 -0
  59. package/dist/smart-agent/pipeline/handlers/index.d.ts.map +1 -0
  60. package/dist/smart-agent/pipeline/handlers/index.js +39 -0
  61. package/dist/smart-agent/pipeline/handlers/index.js.map +1 -0
  62. package/dist/smart-agent/pipeline/handlers/rag-query.d.ts +25 -0
  63. package/dist/smart-agent/pipeline/handlers/rag-query.d.ts.map +1 -0
  64. package/dist/smart-agent/pipeline/handlers/rag-query.js +53 -0
  65. package/dist/smart-agent/pipeline/handlers/rag-query.js.map +1 -0
  66. package/dist/smart-agent/pipeline/handlers/rag-upsert.d.ts +17 -0
  67. package/dist/smart-agent/pipeline/handlers/rag-upsert.d.ts.map +1 -0
  68. package/dist/smart-agent/pipeline/handlers/rag-upsert.js +47 -0
  69. package/dist/smart-agent/pipeline/handlers/rag-upsert.js.map +1 -0
  70. package/dist/smart-agent/pipeline/handlers/rerank.d.ts +16 -0
  71. package/dist/smart-agent/pipeline/handlers/rerank.d.ts.map +1 -0
  72. package/dist/smart-agent/pipeline/handlers/rerank.js +38 -0
  73. package/dist/smart-agent/pipeline/handlers/rerank.js.map +1 -0
  74. package/dist/smart-agent/pipeline/handlers/summarize.d.ts +17 -0
  75. package/dist/smart-agent/pipeline/handlers/summarize.d.ts.map +1 -0
  76. package/dist/smart-agent/pipeline/handlers/summarize.js +47 -0
  77. package/dist/smart-agent/pipeline/handlers/summarize.js.map +1 -0
  78. package/dist/smart-agent/pipeline/handlers/tool-loop.d.ts +32 -0
  79. package/dist/smart-agent/pipeline/handlers/tool-loop.d.ts.map +1 -0
  80. package/dist/smart-agent/pipeline/handlers/tool-loop.js +416 -0
  81. package/dist/smart-agent/pipeline/handlers/tool-loop.js.map +1 -0
  82. package/dist/smart-agent/pipeline/handlers/tool-select.d.ts +21 -0
  83. package/dist/smart-agent/pipeline/handlers/tool-select.d.ts.map +1 -0
  84. package/dist/smart-agent/pipeline/handlers/tool-select.js +95 -0
  85. package/dist/smart-agent/pipeline/handlers/tool-select.js.map +1 -0
  86. package/dist/smart-agent/pipeline/handlers/translate.d.ts +18 -0
  87. package/dist/smart-agent/pipeline/handlers/translate.d.ts.map +1 -0
  88. package/dist/smart-agent/pipeline/handlers/translate.js +39 -0
  89. package/dist/smart-agent/pipeline/handlers/translate.js.map +1 -0
  90. package/dist/smart-agent/pipeline/index.d.ts +14 -0
  91. package/dist/smart-agent/pipeline/index.d.ts.map +1 -0
  92. package/dist/smart-agent/pipeline/index.js +16 -0
  93. package/dist/smart-agent/pipeline/index.js.map +1 -0
  94. package/dist/smart-agent/pipeline/stage-handler.d.ts +36 -0
  95. package/dist/smart-agent/pipeline/stage-handler.d.ts.map +1 -0
  96. package/dist/smart-agent/pipeline/stage-handler.js +24 -0
  97. package/dist/smart-agent/pipeline/stage-handler.js.map +1 -0
  98. package/dist/smart-agent/pipeline/types.d.ts +129 -0
  99. package/dist/smart-agent/pipeline/types.d.ts.map +1 -0
  100. package/dist/smart-agent/pipeline/types.js +54 -0
  101. package/dist/smart-agent/pipeline/types.js.map +1 -0
  102. package/dist/smart-agent/pipeline.d.ts +22 -6
  103. package/dist/smart-agent/pipeline.d.ts.map +1 -1
  104. package/dist/smart-agent/pipeline.js +5 -142
  105. package/dist/smart-agent/pipeline.js.map +1 -1
  106. package/dist/smart-agent/plugins/index.d.ts +4 -0
  107. package/dist/smart-agent/plugins/index.d.ts.map +1 -0
  108. package/dist/smart-agent/plugins/index.js +3 -0
  109. package/dist/smart-agent/plugins/index.js.map +1 -0
  110. package/dist/smart-agent/plugins/loader.d.ts +67 -0
  111. package/dist/smart-agent/plugins/loader.d.ts.map +1 -0
  112. package/dist/smart-agent/plugins/loader.js +114 -0
  113. package/dist/smart-agent/plugins/loader.js.map +1 -0
  114. package/dist/smart-agent/plugins/types.d.ts +149 -0
  115. package/dist/smart-agent/plugins/types.d.ts.map +1 -0
  116. package/dist/smart-agent/plugins/types.js +111 -0
  117. package/dist/smart-agent/plugins/types.js.map +1 -0
  118. package/dist/smart-agent/providers.d.ts +76 -0
  119. package/dist/smart-agent/providers.d.ts.map +1 -0
  120. package/dist/smart-agent/providers.js +173 -0
  121. package/dist/smart-agent/providers.js.map +1 -0
  122. package/dist/smart-agent/rag/embedder-factories.d.ts +9 -0
  123. package/dist/smart-agent/rag/embedder-factories.d.ts.map +1 -0
  124. package/dist/smart-agent/rag/embedder-factories.js +27 -0
  125. package/dist/smart-agent/rag/embedder-factories.js.map +1 -0
  126. package/dist/smart-agent/rag/index.d.ts +7 -0
  127. package/dist/smart-agent/rag/index.d.ts.map +1 -1
  128. package/dist/smart-agent/rag/index.js +4 -0
  129. package/dist/smart-agent/rag/index.js.map +1 -1
  130. package/dist/smart-agent/smart-server.d.ts +25 -1
  131. package/dist/smart-agent/smart-server.d.ts.map +1 -1
  132. package/dist/smart-agent/smart-server.js +122 -27
  133. package/dist/smart-agent/smart-server.js.map +1 -1
  134. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,SAAS,EACT,4BAA4B,GAC7B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Structured pipeline — public API.
3
+ *
4
+ * Exports the pipeline DSL types, executor, context, condition evaluator,
5
+ * default pipeline definition, and all built-in stage handlers.
6
+ */
7
+ // Condition evaluator
8
+ export { evaluateCondition } from './condition-evaluator.js';
9
+ // Default pipeline
10
+ export { getDefaultPipelineDefinition, getDefaultStages, } from './default-pipeline.js';
11
+ // Executor
12
+ export { PipelineExecutor } from './executor.js';
13
+ // Handler registry
14
+ // Individual handlers (for subclassing or direct use)
15
+ export { AssembleHandler, buildDefaultHandlerRegistry, ClassifyHandler, ExpandHandler, RagQueryHandler, RagUpsertHandler, RerankHandler, SummarizeHandler, ToolLoopHandler, ToolSelectHandler, TranslateHandler, } from './handlers/index.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,sBAAsB;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI7D,mBAAmB;AACnB,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,WAAW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,mBAAmB;AACnB,sDAAsD;AACtD,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,aAAa,EAEb,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * IStageHandler — interface for pipeline stage handlers.
3
+ *
4
+ * Each built-in stage type (classify, summarize, rag-query, etc.) has a
5
+ * corresponding handler implementation. Handlers are stateless — all mutable
6
+ * state lives in the {@link PipelineContext}.
7
+ *
8
+ * ## Contract
9
+ *
10
+ * - `execute()` reads inputs from `ctx`, performs its operation, and writes
11
+ * outputs back to `ctx`.
12
+ * - Returns `true` to continue the pipeline, `false` to abort.
13
+ * - On failure, the handler sets `ctx.error` before returning `false`.
14
+ * - The `config` parameter comes from the stage's `config` field in YAML.
15
+ * - The `span` parameter is a tracing span scoped to this stage execution.
16
+ *
17
+ * ## Custom handlers
18
+ *
19
+ * Consumers can register custom stage handlers via
20
+ * `SmartAgentBuilder.withStageHandler(type, handler)` to extend the pipeline
21
+ * with domain-specific operations.
22
+ */
23
+ import type { ISpan } from '../tracer/types.js';
24
+ import type { PipelineContext } from './context.js';
25
+ export interface IStageHandler {
26
+ /**
27
+ * Execute the stage.
28
+ *
29
+ * @param ctx - Mutable pipeline context (read inputs, write outputs).
30
+ * @param config - Stage-specific config from the YAML `config` field.
31
+ * @param span - Tracing span for this stage (call `span.end()` is handled by executor).
32
+ * @returns `true` to continue pipeline, `false` to abort.
33
+ */
34
+ execute(ctx: PipelineContext, config: Record<string, unknown>, span: ISpan): Promise<boolean>;
35
+ }
36
+ //# sourceMappingURL=stage-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage-handler.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/stage-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B;;;;;;;OAOG;IACH,OAAO,CACL,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * IStageHandler — interface for pipeline stage handlers.
3
+ *
4
+ * Each built-in stage type (classify, summarize, rag-query, etc.) has a
5
+ * corresponding handler implementation. Handlers are stateless — all mutable
6
+ * state lives in the {@link PipelineContext}.
7
+ *
8
+ * ## Contract
9
+ *
10
+ * - `execute()` reads inputs from `ctx`, performs its operation, and writes
11
+ * outputs back to `ctx`.
12
+ * - Returns `true` to continue the pipeline, `false` to abort.
13
+ * - On failure, the handler sets `ctx.error` before returning `false`.
14
+ * - The `config` parameter comes from the stage's `config` field in YAML.
15
+ * - The `span` parameter is a tracing span scoped to this stage execution.
16
+ *
17
+ * ## Custom handlers
18
+ *
19
+ * Consumers can register custom stage handlers via
20
+ * `SmartAgentBuilder.withStageHandler(type, handler)` to extend the pipeline
21
+ * with domain-specific operations.
22
+ */
23
+ export {};
24
+ //# sourceMappingURL=stage-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage-handler.js","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/stage-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Pipeline DSL types — structured YAML pipeline definition.
3
+ *
4
+ * A structured pipeline describes the execution topology of the SmartAgent
5
+ * as a tree of stages. Each stage has a type (built-in operation or control
6
+ * flow construct), optional config, and optional condition (`when`).
7
+ *
8
+ * ## Stage types
9
+ *
10
+ * **Built-in operations** — correspond to pipeline phases:
11
+ * - `classify` — decompose user input into typed subprompts
12
+ * - `summarize` — condense conversation history (uses helper LLM)
13
+ * - `rag-upsert` — upsert classified subprompts to RAG stores
14
+ * - `translate` — translate non-ASCII RAG query to English
15
+ * - `expand` — expand query with synonyms (query expander)
16
+ * - `rag-query` — query a RAG store (config: { store: 'facts' | 'feedback' | 'state' })
17
+ * - `rerank` — re-score RAG results
18
+ * - `tool-select` — select MCP tools based on RAG results
19
+ * - `assemble` — build final LLM context
20
+ * - `tool-loop` — streaming LLM call + tool execution loop
21
+ *
22
+ * **Control flow** — orchestrate child stages:
23
+ * - `parallel` — run child stages concurrently, wait for all
24
+ * - `repeat` — repeat child stages until condition or max iterations
25
+ *
26
+ * ## Conditions
27
+ *
28
+ * The `when` field is a dot-path property lookup evaluated against the
29
+ * pipeline context. Examples:
30
+ * - `"shouldRetrieve"` — truthy check on `ctx.shouldRetrieve`
31
+ * - `"config.classificationEnabled"` — truthy check on `ctx.config.classificationEnabled`
32
+ *
33
+ * ## Example
34
+ *
35
+ * ```yaml
36
+ * pipeline:
37
+ * version: "1"
38
+ * stages:
39
+ * - id: classify
40
+ * type: classify
41
+ * - id: rag-retrieval
42
+ * type: parallel
43
+ * when: "shouldRetrieve"
44
+ * stages:
45
+ * - { id: query-facts, type: rag-query, config: { store: facts, k: 10 } }
46
+ * - { id: query-state, type: rag-query, config: { store: state, k: 10 } }
47
+ * - id: assemble
48
+ * type: assemble
49
+ * - id: tool-loop
50
+ * type: tool-loop
51
+ * ```
52
+ */
53
+ /**
54
+ * Built-in stage types — each maps to an {@link IStageHandler} implementation
55
+ * that reads from and writes to the {@link PipelineContext}.
56
+ */
57
+ export type BuiltInStageType = 'classify' | 'summarize' | 'rag-upsert' | 'translate' | 'expand' | 'rag-query' | 'rerank' | 'tool-select' | 'assemble' | 'tool-loop';
58
+ /**
59
+ * Control flow stage types — orchestrate child stages without
60
+ * performing domain logic themselves.
61
+ */
62
+ export type ControlFlowType = 'parallel' | 'repeat';
63
+ /** Union of all recognized stage types. */
64
+ export type StageType = BuiltInStageType | ControlFlowType;
65
+ /**
66
+ * A single pipeline stage as parsed from structured YAML.
67
+ *
68
+ * Stages form a tree: control flow types (`parallel`, `repeat`) contain
69
+ * child stages in their `stages` array. Leaf stages are built-in operations.
70
+ */
71
+ export interface StageDefinition {
72
+ /** Unique ID within the pipeline. Used for logging, tracing, and timing entries. */
73
+ id: string;
74
+ /** Stage type — either a built-in operation or a control flow construct. */
75
+ type: StageType;
76
+ /**
77
+ * Arbitrary config passed to the stage handler.
78
+ * Each handler defines its own expected config shape.
79
+ *
80
+ * Examples:
81
+ * - rag-query: `{ store: 'facts', k: 10 }`
82
+ * - tool-loop: `{ maxIterations: 10, maxToolCalls: 30 }`
83
+ */
84
+ config?: Record<string, unknown>;
85
+ /**
86
+ * Condition expression. When present, the stage is skipped if the
87
+ * expression evaluates to falsy.
88
+ *
89
+ * The expression is a dot-path property lookup on the pipeline context.
90
+ * Supports negation with `!` prefix.
91
+ *
92
+ * Examples: `"shouldRetrieve"`, `"!isAscii"`, `"config.queryExpansionEnabled"`
93
+ */
94
+ when?: string;
95
+ /**
96
+ * Child stages — used by `parallel` and `repeat` control flow types.
97
+ * For `parallel`: all children run concurrently.
98
+ * For `repeat`: children run sequentially in each iteration.
99
+ */
100
+ stages?: StageDefinition[];
101
+ /**
102
+ * Sequential follow-up stages — used by `parallel` type only.
103
+ * These run sequentially after all parallel children complete.
104
+ *
105
+ * Example: run three RAG queries in parallel, then rerank sequentially.
106
+ */
107
+ after?: StageDefinition[];
108
+ /** Maximum iterations — used by `repeat` type. Default: 10. */
109
+ maxIterations?: number;
110
+ /**
111
+ * Stop condition — used by `repeat` type.
112
+ * The loop stops when this expression evaluates to truthy.
113
+ */
114
+ until?: string;
115
+ }
116
+ /**
117
+ * Top-level structured pipeline definition.
118
+ *
119
+ * When present in the YAML config (`pipeline.stages`), the structured
120
+ * pipeline replaces the default hardcoded execution flow in SmartAgent.
121
+ * When absent, the default flow runs unchanged (full backwards compatibility).
122
+ */
123
+ export interface StructuredPipelineDefinition {
124
+ /** Schema version for forward compatibility. Currently only `'1'`. */
125
+ version: '1';
126
+ /** Ordered list of top-level stages. */
127
+ stages: StageDefinition[];
128
+ }
129
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAMH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,WAAW,GACX,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,aAAa,GACb,UAAU,GACV,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEpD,2CAA2C;AAC3C,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAM3D;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAC;IAEX,4EAA4E;IAC5E,IAAI,EAAE,SAAS,CAAC;IAEhB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAE3B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAE1B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAC3C,sEAAsE;IACtE,OAAO,EAAE,GAAG,CAAC;IAEb,wCAAwC;IACxC,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Pipeline DSL types — structured YAML pipeline definition.
3
+ *
4
+ * A structured pipeline describes the execution topology of the SmartAgent
5
+ * as a tree of stages. Each stage has a type (built-in operation or control
6
+ * flow construct), optional config, and optional condition (`when`).
7
+ *
8
+ * ## Stage types
9
+ *
10
+ * **Built-in operations** — correspond to pipeline phases:
11
+ * - `classify` — decompose user input into typed subprompts
12
+ * - `summarize` — condense conversation history (uses helper LLM)
13
+ * - `rag-upsert` — upsert classified subprompts to RAG stores
14
+ * - `translate` — translate non-ASCII RAG query to English
15
+ * - `expand` — expand query with synonyms (query expander)
16
+ * - `rag-query` — query a RAG store (config: { store: 'facts' | 'feedback' | 'state' })
17
+ * - `rerank` — re-score RAG results
18
+ * - `tool-select` — select MCP tools based on RAG results
19
+ * - `assemble` — build final LLM context
20
+ * - `tool-loop` — streaming LLM call + tool execution loop
21
+ *
22
+ * **Control flow** — orchestrate child stages:
23
+ * - `parallel` — run child stages concurrently, wait for all
24
+ * - `repeat` — repeat child stages until condition or max iterations
25
+ *
26
+ * ## Conditions
27
+ *
28
+ * The `when` field is a dot-path property lookup evaluated against the
29
+ * pipeline context. Examples:
30
+ * - `"shouldRetrieve"` — truthy check on `ctx.shouldRetrieve`
31
+ * - `"config.classificationEnabled"` — truthy check on `ctx.config.classificationEnabled`
32
+ *
33
+ * ## Example
34
+ *
35
+ * ```yaml
36
+ * pipeline:
37
+ * version: "1"
38
+ * stages:
39
+ * - id: classify
40
+ * type: classify
41
+ * - id: rag-retrieval
42
+ * type: parallel
43
+ * when: "shouldRetrieve"
44
+ * stages:
45
+ * - { id: query-facts, type: rag-query, config: { store: facts, k: 10 } }
46
+ * - { id: query-state, type: rag-query, config: { store: state, k: 10 } }
47
+ * - id: assemble
48
+ * type: assemble
49
+ * - id: tool-loop
50
+ * type: tool-loop
51
+ * ```
52
+ */
53
+ export {};
54
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/smart-agent/pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG"}
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Pipeline configuration types and factory helpers for SmartServer.
2
+ * Pipeline configuration types for SmartServer.
3
+ *
4
+ * This module defines the YAML-driven pipeline config types.
5
+ * Provider resolution is delegated to `providers.ts`.
3
6
  */
4
- import { type SapAICoreCredentials } from '../llm-providers/sap-core-ai.js';
5
- import type { IRag } from './interfaces/rag.js';
6
- import { TokenCountingLlm } from './llm/token-counting-llm.js';
7
+ import type { SapAICoreCredentials } from '../llm-providers/sap-core-ai.js';
7
8
  export interface PipelineLlmProviderConfig {
8
9
  provider: 'deepseek' | 'openai' | 'anthropic' | 'sap-ai-sdk';
9
10
  /** API key. Required for openai/anthropic/deepseek; optional for sap-ai-sdk. */
@@ -20,6 +21,12 @@ export interface PipelineLlmProviderConfig {
20
21
  export interface PipelineRagStoreConfig {
21
22
  /** 'ollama' | 'openai' | 'in-memory' | 'qdrant'. Default: 'ollama' */
22
23
  type?: 'ollama' | 'openai' | 'in-memory' | 'qdrant';
24
+ /**
25
+ * Embedder name — resolved from the embedder factory registry.
26
+ * Built-in: 'ollama', 'openai'. Consumers can register custom factories.
27
+ * When omitted, defaults to 'ollama'.
28
+ */
29
+ embedder?: string;
23
30
  /** Base URL for embedding service or Qdrant server */
24
31
  url?: string;
25
32
  /** API key (for openai type or Qdrant auth) */
@@ -61,7 +68,16 @@ export interface PipelineConfig {
61
68
  command?: string;
62
69
  args?: string[];
63
70
  }>;
71
+ /**
72
+ * Schema version for forward compatibility. Currently only `'1'`.
73
+ * When present alongside `stages`, enables the structured pipeline executor.
74
+ */
75
+ version?: '1';
76
+ /**
77
+ * Structured pipeline stage definitions.
78
+ * When present, the pipeline executor replaces the default hardcoded flow.
79
+ * See `docs/ARCHITECTURE.md` for stage types and YAML examples.
80
+ */
81
+ stages?: import('./pipeline/types.js').StageDefinition[];
64
82
  }
65
- export declare function makeLlmFromProvider(cfg: PipelineLlmProviderConfig, temperature: number): TokenCountingLlm;
66
- export declare function makeRagFromStoreConfig(cfg: PipelineRagStoreConfig): IRag;
67
83
  //# sourceMappingURL=pipeline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/smart-agent/pipeline.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAW/D,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,GAA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,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE;QACJ,0CAA0C;QAC1C,IAAI,EAAE,yBAAyB,CAAC;QAChC,6DAA6D;QAC7D,MAAM,CAAC,EAAE,yBAAyB,CAAC;QACnC,uFAAuF;QACvF,UAAU,CAAC,EAAE,yBAAyB,CAAC;KACxC,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,wDAAwD;QACxD,KAAK,CAAC,EAAE,sBAAsB,CAAC;QAC/B,kDAAkD;QAClD,QAAQ,CAAC,EAAE,sBAAsB,CAAC;QAClC,mCAAmC;QACnC,KAAK,CAAC,EAAE,sBAAsB,CAAC;KAChC,CAAC;IACF,4DAA4D;IAC5D,GAAG,CAAC,EAAE,KAAK,CAAC;QACV,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC,CAAC;IAIH;;;OAGG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,qBAAqB,EAAE,eAAe,EAAE,CAAC;CAC1D"}
@@ -1,145 +1,8 @@
1
1
  /**
2
- * Pipeline configuration types and factory helpers for SmartServer.
2
+ * Pipeline configuration types for SmartServer.
3
+ *
4
+ * This module defines the YAML-driven pipeline config types.
5
+ * Provider resolution is delegated to `providers.ts`.
3
6
  */
4
- import { AnthropicAgent } from '../agents/anthropic-agent.js';
5
- import { DeepSeekAgent } from '../agents/deepseek-agent.js';
6
- import { OpenAIAgent } from '../agents/openai-agent.js';
7
- import { SapCoreAIAgent } from '../agents/sap-core-ai-agent.js';
8
- import { AnthropicProvider } from '../llm-providers/anthropic.js';
9
- import { DeepSeekProvider } from '../llm-providers/deepseek.js';
10
- import { OpenAIProvider } from '../llm-providers/openai.js';
11
- import { SapCoreAIProvider, } from '../llm-providers/sap-core-ai.js';
12
- import { MCPClientWrapper } from '../mcp/client.js';
13
- import { LlmAdapter } from './adapters/llm-adapter.js';
14
- import { TokenCountingLlm } from './llm/token-counting-llm.js';
15
- import { InMemoryRag } from './rag/in-memory-rag.js';
16
- import { OllamaEmbedder } from './rag/ollama-rag.js';
17
- import { OpenAiEmbedder } from './rag/openai-embedder.js';
18
- import { QdrantRag } from './rag/qdrant-rag.js';
19
- import { VectorRag } from './rag/vector-rag.js';
20
- // ---------------------------------------------------------------------------
21
- // Factories
22
- // ---------------------------------------------------------------------------
23
- export function makeLlmFromProvider(cfg, temperature) {
24
- const dummyMcp = new MCPClientWrapper({
25
- transport: 'embedded',
26
- listToolsHandler: async () => [],
27
- });
28
- switch (cfg.provider) {
29
- case 'deepseek': {
30
- const provider = new DeepSeekProvider({
31
- apiKey: cfg.apiKey,
32
- model: cfg.model,
33
- temperature,
34
- maxTokens: cfg.maxTokens,
35
- });
36
- const agent = new DeepSeekAgent({
37
- llmProvider: provider,
38
- mcpClient: dummyMcp,
39
- });
40
- return new TokenCountingLlm(new LlmAdapter(agent));
41
- }
42
- case 'openai': {
43
- const provider = new OpenAIProvider({
44
- apiKey: cfg.apiKey,
45
- model: cfg.model,
46
- temperature,
47
- maxTokens: cfg.maxTokens,
48
- });
49
- const agent = new OpenAIAgent({
50
- llmProvider: provider,
51
- mcpClient: dummyMcp,
52
- });
53
- return new TokenCountingLlm(new LlmAdapter(agent));
54
- }
55
- case 'anthropic': {
56
- const provider = new AnthropicProvider({
57
- apiKey: cfg.apiKey,
58
- model: cfg.model,
59
- temperature,
60
- maxTokens: cfg.maxTokens,
61
- });
62
- const agent = new AnthropicAgent({
63
- llmProvider: provider,
64
- mcpClient: dummyMcp,
65
- });
66
- return new TokenCountingLlm(new LlmAdapter(agent));
67
- }
68
- case 'sap-ai-sdk': {
69
- const provider = new SapCoreAIProvider({
70
- apiKey: cfg.apiKey,
71
- model: cfg.model,
72
- temperature,
73
- maxTokens: cfg.maxTokens,
74
- resourceGroup: cfg.resourceGroup,
75
- credentials: cfg.credentials,
76
- });
77
- const agent = new SapCoreAIAgent({
78
- llmProvider: provider,
79
- mcpClient: dummyMcp,
80
- });
81
- return new TokenCountingLlm(new LlmAdapter(agent));
82
- }
83
- default: {
84
- const _exhaustive = cfg.provider;
85
- throw new Error(`Unknown LLM provider: ${_exhaustive}`);
86
- }
87
- }
88
- }
89
- export function makeRagFromStoreConfig(cfg) {
90
- if (cfg.type === 'in-memory') {
91
- return new InMemoryRag({ dedupThreshold: cfg.dedupThreshold });
92
- }
93
- if (cfg.type === 'qdrant') {
94
- if (!cfg.url) {
95
- throw new Error('Qdrant URL is required for qdrant RAG type');
96
- }
97
- // Qdrant needs an embedder — default to Ollama
98
- const embedder = cfg.apiKey
99
- ? new OpenAiEmbedder({
100
- apiKey: cfg.apiKey,
101
- baseURL: undefined,
102
- model: cfg.model,
103
- timeoutMs: cfg.timeoutMs,
104
- })
105
- : new OllamaEmbedder({
106
- ollamaUrl: undefined,
107
- model: cfg.model,
108
- timeoutMs: cfg.timeoutMs,
109
- });
110
- return new QdrantRag({
111
- url: cfg.url,
112
- collectionName: cfg.collectionName ?? 'llm-agent',
113
- embedder,
114
- apiKey: cfg.apiKey,
115
- timeoutMs: cfg.timeoutMs,
116
- });
117
- }
118
- if (cfg.type === 'openai') {
119
- if (!cfg.apiKey) {
120
- throw new Error('OpenAI API key is required for openai RAG type');
121
- }
122
- const embedder = new OpenAiEmbedder({
123
- apiKey: cfg.apiKey,
124
- baseURL: cfg.url,
125
- model: cfg.model,
126
- timeoutMs: cfg.timeoutMs,
127
- });
128
- return new VectorRag(embedder, {
129
- dedupThreshold: cfg.dedupThreshold,
130
- vectorWeight: cfg.vectorWeight,
131
- keywordWeight: cfg.keywordWeight,
132
- });
133
- }
134
- const embedder = new OllamaEmbedder({
135
- ollamaUrl: cfg.url,
136
- model: cfg.model,
137
- timeoutMs: cfg.timeoutMs,
138
- });
139
- return new VectorRag(embedder, {
140
- dedupThreshold: cfg.dedupThreshold,
141
- vectorWeight: cfg.vectorWeight,
142
- keywordWeight: cfg.keywordWeight,
143
- });
144
- }
7
+ export {};
145
8
  //# sourceMappingURL=pipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/smart-agent/pipeline.ts"],"names":[],"mappings":"AAAA;;GAEG;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,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAEL,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC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AQ,EAAE;YAC7B,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,IAAI,cAAc,CAAC;QAClC,SAAS,EAAE,GAAG,CAAC,GAAG;QAClB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,SAAS,EAAE,GAAG,CAAC,SAAS;KACzB,CAAC,CAAC;IACH,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"}
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/smart-agent/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,4 @@
1
+ export { FileSystemPluginLoader, type FileSystemPluginLoaderConfig, getDefaultPluginDirs, loadPlugins, } from './loader.js';
2
+ export type { IPluginLoader, LoadedPlugins, PluginExports, } from './types.js';
3
+ export { emptyLoadedPlugins, mergePluginExports } from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,4BAA4B,EACjC,oBAAoB,EACpB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { FileSystemPluginLoader, getDefaultPluginDirs, loadPlugins, } from './loader.js';
2
+ export { emptyLoadedPlugins, mergePluginExports } from './types.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/smart-agent/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEtB,oBAAoB,EACpB,WAAW,GACZ,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,67 @@
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 type { IPluginLoader, LoadedPlugins } from './types.js';
19
+ export interface FileSystemPluginLoaderConfig {
20
+ /** Directories to scan for plugin files (in order, later wins). */
21
+ dirs: string[];
22
+ /** Optional logger for diagnostic messages. */
23
+ log?: (msg: string) => void;
24
+ }
25
+ /**
26
+ * Filesystem-based plugin loader.
27
+ *
28
+ * Scans one or more directories for plugin files and dynamically imports them.
29
+ * This is the default implementation shipped with the library.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const loader = new FileSystemPluginLoader({
34
+ * dirs: getDefaultPluginDirs(),
35
+ * });
36
+ * const plugins = await loader.load();
37
+ * ```
38
+ *
39
+ * @example Inject into builder
40
+ * ```ts
41
+ * builder.withPluginLoader(new FileSystemPluginLoader({
42
+ * dirs: [...getDefaultPluginDirs(), './my-extra-plugins'],
43
+ * }));
44
+ * ```
45
+ */
46
+ export declare class FileSystemPluginLoader implements IPluginLoader {
47
+ private readonly dirs;
48
+ private readonly log?;
49
+ constructor(config: FileSystemPluginLoaderConfig);
50
+ load(): Promise<LoadedPlugins>;
51
+ }
52
+ /**
53
+ * Returns the default plugin directories (in load order).
54
+ *
55
+ * 1. `~/.config/llm-agent/plugins/` (user-level)
56
+ * 2. `./plugins/` (project-level, relative to cwd)
57
+ */
58
+ export declare function getDefaultPluginDirs(): string[];
59
+ /**
60
+ * Convenience function — creates a {@link FileSystemPluginLoader} and loads.
61
+ *
62
+ * @param dirs - Directories to scan (in order, later wins).
63
+ * @param log - Optional logger.
64
+ * @returns Merged plugin registrations.
65
+ */
66
+ export declare function loadPlugins(dirs: string[], log?: (msg: string) => void): Promise<LoadedPlugins>;
67
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/smart-agent/plugins/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAC;AAK9E,MAAM,WAAW,4BAA4B;IAC3C,mEAAmE;IACnE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,+CAA+C;IAC/C,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,sBAAuB,YAAW,aAAa;IAC1D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAW;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAwB;gBAEjC,MAAM,EAAE,4BAA4B;IAK1C,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;CAuCrC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAQ/C;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC1B,OAAO,CAAC,aAAa,CAAC,CAExB"}