@mcp-abap-adt/llm-agent-server 16.2.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/smart-agent/build-dag-coordinator-deps.d.ts +34 -0
- package/dist/smart-agent/build-dag-coordinator-deps.d.ts.map +1 -0
- package/dist/smart-agent/build-dag-coordinator-deps.js +107 -0
- package/dist/smart-agent/build-dag-coordinator-deps.js.map +1 -0
- package/dist/smart-agent/build-stepper-root.d.ts +97 -0
- package/dist/smart-agent/build-stepper-root.d.ts.map +1 -0
- package/dist/smart-agent/build-stepper-root.js +242 -0
- package/dist/smart-agent/build-stepper-root.js.map +1 -0
- package/dist/smart-agent/config.d.ts +207 -3
- package/dist/smart-agent/config.d.ts.map +1 -1
- package/dist/smart-agent/config.js +465 -39
- package/dist/smart-agent/config.js.map +1 -1
- package/dist/smart-agent/jsonl-knowledge-backend.d.ts +19 -0
- package/dist/smart-agent/jsonl-knowledge-backend.d.ts.map +1 -0
- package/dist/smart-agent/jsonl-knowledge-backend.js +46 -0
- package/dist/smart-agent/jsonl-knowledge-backend.js.map +1 -0
- package/dist/smart-agent/session-identity-resolver.d.ts +17 -0
- package/dist/smart-agent/session-identity-resolver.d.ts.map +1 -0
- package/dist/smart-agent/session-identity-resolver.js +37 -0
- package/dist/smart-agent/session-identity-resolver.js.map +1 -0
- package/dist/smart-agent/session-meta-store.d.ts +53 -0
- package/dist/smart-agent/session-meta-store.d.ts.map +1 -0
- package/dist/smart-agent/session-meta-store.js +36 -0
- package/dist/smart-agent/session-meta-store.js.map +1 -0
- package/dist/smart-agent/smart-server.d.ts +288 -4
- package/dist/smart-agent/smart-server.d.ts.map +1 -1
- package/dist/smart-agent/smart-server.js +1325 -111
- package/dist/smart-agent/smart-server.js.map +1 -1
- package/dist/smart-agent/stepper-coordinator-handler.d.ts +36 -0
- package/dist/smart-agent/stepper-coordinator-handler.d.ts.map +1 -0
- package/dist/smart-agent/stepper-coordinator-handler.js +214 -0
- package/dist/smart-agent/stepper-coordinator-handler.js.map +1 -0
- package/package.json +26 -26
|
@@ -1,9 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared config utilities for SmartServer.
|
|
3
3
|
*/
|
|
4
|
-
import type { ILlm, ISubAgentContextBuilder, IToolSelectionStrategy } from '@mcp-abap-adt/llm-agent';
|
|
4
|
+
import type { IFinalizer, ILlm, ISubAgentContextBuilder, IToolSelectionStrategy, PlanNode } from '@mcp-abap-adt/llm-agent';
|
|
5
5
|
import { AutoActivation, ExplicitActivation, HybridDispatch, OneShotPlanning, ReplanOnErrorPlanning, SelfDispatch, SkillStepsPlanning, SubAgentDispatch } from '@mcp-abap-adt/llm-agent-libs';
|
|
6
|
-
import type { SmartServerConfig } from './smart-server.js';
|
|
6
|
+
import type { SmartServerConfig, SmartServerLlmConfig } from './smart-server.js';
|
|
7
|
+
export type LlmConfigMap = Record<string, SmartServerLlmConfig>;
|
|
8
|
+
export type NormalizedLlmMap = {
|
|
9
|
+
main: SmartServerLlmConfig;
|
|
10
|
+
} & LlmConfigMap;
|
|
11
|
+
/**
|
|
12
|
+
* Normalize the optional top-level `llm:` block.
|
|
13
|
+
* - undefined → undefined (pipeline-only configs stay valid)
|
|
14
|
+
* - flat shape (has `provider` | `apiKey` | `model` | `url`) → { main: flat } (backward compat)
|
|
15
|
+
* - map shape → must include `main`; returned as NormalizedLlmMap
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeLlmConfig(input?: SmartServerLlmConfig | LlmConfigMap): NormalizedLlmMap | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Strict lookup: returns map[name] if explicitly present, else undefined.
|
|
20
|
+
* Does NOT fall through to map.main. Use when the caller needs to
|
|
21
|
+
* detect explicit-presence (e.g. to decide between an alias and the
|
|
22
|
+
* named map entry).
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveLlmConfigStrict(map: NormalizedLlmMap | undefined, name: string | undefined): SmartServerLlmConfig | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a per-role LLM config by name from a normalized map.
|
|
27
|
+
* Lookup chain: map[name] → map.main → pipelineFallback.
|
|
28
|
+
* When map is undefined, falls back to pipelineFallback (so pipeline-only
|
|
29
|
+
* configs keep working with no top-level llm: block).
|
|
30
|
+
*
|
|
31
|
+
* The caller decides whether `undefined` is an error.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveLlmConfig(map: NormalizedLlmMap | undefined, name?: string, pipelineFallback?: SmartServerLlmConfig): SmartServerLlmConfig | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Read the reviewer block's LLM-name selector, accepting both the
|
|
36
|
+
* preferred `reviewerLlm` field and the deprecated `plannerLlm` alias.
|
|
37
|
+
* When the alias is used, calls `warn(message)`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveReviewerLlmName(block: {
|
|
40
|
+
reviewerLlm?: string;
|
|
41
|
+
plannerLlm?: string;
|
|
42
|
+
} | undefined, warn: (msg: string) => void): string | undefined;
|
|
7
43
|
export interface YamlCoordinator {
|
|
8
44
|
planning?: 'one-shot' | 'replan-on-error' | 'skill-steps';
|
|
9
45
|
dispatch?: 'subagent' | 'self' | 'hybrid';
|
|
@@ -13,8 +49,41 @@ export interface YamlCoordinator {
|
|
|
13
49
|
maxRetriesPerStep?: number;
|
|
14
50
|
failPolicy?: 'abort' | 'continue';
|
|
15
51
|
maxLayer?: number;
|
|
52
|
+
planner?: {
|
|
53
|
+
type?: string;
|
|
54
|
+
plannerLlm?: 'main' | 'planner' | 'helper';
|
|
55
|
+
} | Record<string, unknown>;
|
|
56
|
+
interpreter?: {
|
|
57
|
+
type?: string;
|
|
58
|
+
} | Record<string, unknown>;
|
|
59
|
+
reviewer?: {
|
|
60
|
+
type?: string;
|
|
61
|
+
reviewerLlm?: string;
|
|
62
|
+
plannerLlm?: 'main' | 'planner' | 'helper';
|
|
63
|
+
};
|
|
64
|
+
finalizer?: {
|
|
65
|
+
type?: 'passthrough' | 'llm' | 'template';
|
|
66
|
+
finalizerLlm?: string;
|
|
67
|
+
systemPrompt?: string;
|
|
68
|
+
};
|
|
69
|
+
errorStrategy?: {
|
|
70
|
+
type?: string;
|
|
71
|
+
maxReplans?: number;
|
|
72
|
+
};
|
|
73
|
+
stateOracle?: string;
|
|
74
|
+
maxRoundTrips?: number;
|
|
16
75
|
}
|
|
76
|
+
/** Fail-loud guard: a coordinator block is either DAG (has `planner`) or linear,
|
|
77
|
+
* never mixed. `activation` is shared and always allowed. */
|
|
78
|
+
export declare function assertCoordinatorConfigShape(coord: Record<string, unknown>): void;
|
|
17
79
|
export declare function resolveCoordinatorPlanning(name: string, plannerLlm: ILlm): OneShotPlanning | ReplanOnErrorPlanning | SkillStepsPlanning;
|
|
80
|
+
/**
|
|
81
|
+
* Default coordinator dispatch kind. Omitted → 'hybrid' for ALL planning kinds:
|
|
82
|
+
* agentless steps — the synthesized answer-directly step (#155) and skill steps
|
|
83
|
+
* without an explicit `agent:` — need a self-LLM fallback. Pin 'subagent'
|
|
84
|
+
* explicitly for strict subagent-only routing.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveCoordinatorDispatchKind(explicit?: 'subagent' | 'self' | 'hybrid'): 'subagent' | 'self' | 'hybrid';
|
|
18
87
|
export declare function resolveCoordinatorDispatch(name: string, fallbackLlm?: ILlm, contextBuilder?: ISubAgentContextBuilder): SubAgentDispatch | SelfDispatch | HybridDispatch;
|
|
19
88
|
export declare function resolveCoordinatorActivation(name: string): AutoActivation | ExplicitActivation;
|
|
20
89
|
export declare function resolveToolSelectionStrategy(name: string, params?: {
|
|
@@ -48,10 +117,27 @@ export interface ResolveConfigArgs {
|
|
|
48
117
|
'plugin-dir'?: string;
|
|
49
118
|
mode?: string | boolean;
|
|
50
119
|
}
|
|
51
|
-
export declare const YAML_TEMPLATE = "port: 4004\nhost: 0.0.0.0\n\n# Request routing mode:\n# hard \u2014 Fully managed context. Ignores client history/system prompt. Uses RAG + internal MCP tools only.\n# pass \u2014 Transparent proxy. Logs everything but modifies nothing.\n# smart \u2014 Hybrid. Preserves client history but enriches it with RAG context and MCP tools based on analysis. (default)\nmode: smart\n\nllm:\n provider: deepseek # deepseek | openai | anthropic | sap-ai-sdk | ollama\n apiKey: ${DEEPSEEK_API_KEY} # not required for ollama / sap-ai-sdk\n model: deepseek-chat\n temperature: 0.7\n classifierTemperature: 0.1\n\nrag:\n type: in-memory # in-memory | qdrant | hana-vector | pg-vector\n embedder: ollama # Embedder to use: ollama | openai | sap-ai-core | <custom>\n url: http://localhost:11434\n model: bge-m3\n # resourceGroup: default # SAP AI Core resource group (sap-ai-core embedder)\n # scenario: orchestration # SAP AI Core scenario: orchestration (default) | foundation-models\n # collectionName: llm-agent # Collection/table name (qdrant | hana-vector | pg-vector)\n dedupThreshold: 0.92\n vectorWeight: 0.7 # Semantic similarity weight (0..1)\n keywordWeight: 0.3 # Lexical matching weight (0..1)\n\nmcp:\n # type: none | http | stdio\n # To disable MCP, set type to 'none'\n type: http\n url: http://localhost:3001/mcp/stream/http\n\nagent:\n externalToolsValidationMode: permissive # permissive | strict\n maxIterations: 10\n maxToolCalls: 30\n toolUnavailableTtlMs: 600000 # Temporary tool blacklist TTL (ms)\n ragQueryK: 10\n # contextBudgetTokens: 4000 # Max tokens for RAG context in system prompt (0 = no limit)\n # semanticHistoryEnabled: false # Enable semantic history via RAG\n # historyRecencyWindow: 4 # Last N messages from client history in LLM context\n # historyTurnSummaryPrompt: \"...\" # LLM prompt for turn summarization\n showReasoning: false # Explain strategy at start of response\n historyAutoSummarizeLimit: 10 # History length to trigger compression\n queryExpansionEnabled: false # Expand RAG queries with LLM-generated synonyms\n toolResultCacheTtlMs: 300000 # Tool result cache TTL (ms); 0 to disable\n sessionTokenBudget: 0 # Multi-turn token budget; 0 to disable\n # ragTranslateEnabled: true # Translate non-ASCII RAG queries to English (default: true)\n # classificationEnabled: false # Enable for custom pipelines with multi-store routing\n # toolReselectPerIteration: false # Re-select tools via RAG on each tool-loop iteration\n # llmCallStrategy: streaming # streaming | non-streaming | fallback\n # streamMode: full # full | final \u2014 streaming behavior for tool loops\n # heartbeatIntervalMs: 5000 # SSE heartbeat interval during tool execution (ms)\n # healthTimeoutMs: 5000 # Health check probe timeout (ms); increase for slow providers (SAP AI Core: 15000)\n # retry: # LLM retry config for 429/5xx errors\n # maxAttempts: 3\n # backoffMs: 1000\n # retryOn: [429, 500, 502, 503]\n # retryOnMidStream: ['SSE stream'] # Substrings triggering mid-stream retry\n\n# --- Advanced Multi-Model Pipeline (optional) -------------------------------\n# Use this section to assign different models for different internal tasks.\n# pipeline:\n# llm:\n# main:\n# provider: deepseek # deepseek | openai | anthropic | sap-ai-sdk\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.7\n# streaming: true # false to disable streaming for this provider\n# classifier: # optional; if absent, main config is reused\n# provider: deepseek\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.1\n# helper: # optional; if absent, main config is reused\n# provider: deepseek\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.1\n#\n# rag:\n# tools:\n# type: qdrant\n# url: http://qdrant:6333\n# embedder: openai # ollama | openai | <custom registered name>\n# model: text-embedding-3-small\n# apiKey: ${OPENAI_API_KEY}\n# history:\n# type: in-memory\n#\n# mcp:\n# - type: http\n# url: http://localhost:3001/mcp/stream/http\n\n# --- Structured Pipeline (optional) -------------------------------------------\n# Replaces the hardcoded orchestration flow with a YAML-defined stage tree.\n# When absent, the default flow runs unchanged (full backwards compatibility).\n#\n# pipeline:\n# version: \"1\"\n# stages:\n# - id: classify\n# type: classify\n# - id: summarize\n# type: summarize\n# - id: rag-retrieval\n# type: parallel\n# when: \"shouldRetrieve\"\n# stages:\n# - { id: translate, type: translate }\n# - { id: expand, type: expand }\n# after:\n# - id: rag-queries\n# type: parallel\n# stages:\n# - { id: tools, type: rag-query, config: { store: tools, k: 10 } }\n# - { id: history, type: rag-query, config: { store: history, k: 5 } }\n# - { id: rerank, type: rerank }\n# - { id: tool-select, type: tool-select }\n# - id: assemble\n# type: assemble\n# - id: tool-loop\n# type: tool-loop\n\n# prompts:\n# system: \"You are a helpful assistant specialized in SAP ABAP development.\"\n# classifier: |\n# You are an intent classifier... (see source for full default prompt)\n# reasoning: |\n# IMPORTANT: Always start your response with a brief <reasoning> block...\n# ragTranslate: |\n# Translate the user request to English for search purposes...\n# historySummary: |\n# Summarize the conversation so far...\n\nlog: smart-server.log # path to log file; omit for stdout\n# logDir: sessions # Directory for detailed session debug logs\n# pluginDir: ./my-plugins # Additional plugin directory (loaded after defaults)\n\n# subagents: # Optional: nested agents callable from pipeline\n# - name: code-reviewer # Used as stage config: { agent: code-reviewer }\n# description: | # Optional. Shown to the Coordinator planner LLM\n# Reviews code and returns # so it can pick this agent for the right step.\n# structured JSON.\n# config: ./agents/code-reviewer.yaml\n\n# coordinator: # Optional: enable autonomous plan-execute loop\n# planning: one-shot # one-shot | replan-on-error | skill-steps\n# dispatch: subagent # subagent | self | hybrid\n# activation: explicit # explicit (default) | auto\n# plannerLlm: main # main | planner | helper (unused by skill-steps)\n# maxSteps: 12\n# maxRetriesPerStep: 1\n# failPolicy: abort # abort | continue\n# maxLayer: 1 #
|
|
120
|
+
export declare const YAML_TEMPLATE = "port: 4004\nhost: 0.0.0.0\n\n# Request routing mode:\n# hard \u2014 Fully managed context. Ignores client history/system prompt. Uses RAG + internal MCP tools only.\n# pass \u2014 Transparent proxy. Logs everything but modifies nothing.\n# smart \u2014 Hybrid. Preserves client history but enriches it with RAG context and MCP tools based on analysis. (default)\nmode: smart\n\nllm:\n provider: deepseek # deepseek | openai | anthropic | sap-ai-sdk | ollama\n apiKey: ${DEEPSEEK_API_KEY} # not required for ollama / sap-ai-sdk\n model: deepseek-chat\n temperature: 0.7\n classifierTemperature: 0.1\n\nrag:\n type: in-memory # in-memory | qdrant | hana-vector | pg-vector\n embedder: ollama # Embedder to use: ollama | openai | sap-ai-core | <custom>\n url: http://localhost:11434\n model: bge-m3\n # resourceGroup: default # SAP AI Core resource group (sap-ai-core embedder)\n # scenario: orchestration # SAP AI Core scenario: orchestration (default) | foundation-models\n # collectionName: llm-agent # Collection/table name (qdrant | hana-vector | pg-vector)\n dedupThreshold: 0.92\n vectorWeight: 0.7 # Semantic similarity weight (0..1)\n keywordWeight: 0.3 # Lexical matching weight (0..1)\n\nmcp:\n # type: none | http | stdio\n # To disable MCP, set type to 'none'\n type: http\n url: http://localhost:3001/mcp/stream/http\n\nagent:\n externalToolsValidationMode: permissive # permissive | strict\n maxIterations: 10\n maxToolCalls: 30\n toolUnavailableTtlMs: 600000 # Temporary tool blacklist TTL (ms)\n ragQueryK: 10\n # contextBudgetTokens: 4000 # Max tokens for RAG context in system prompt (0 = no limit)\n # semanticHistoryEnabled: false # Enable semantic history via RAG\n # historyRecencyWindow: 4 # Last N messages from client history in LLM context\n # historyTurnSummaryPrompt: \"...\" # LLM prompt for turn summarization\n showReasoning: false # Explain strategy at start of response\n historyAutoSummarizeLimit: 10 # History length to trigger compression\n queryExpansionEnabled: false # Expand RAG queries with LLM-generated synonyms\n toolResultCacheTtlMs: 300000 # Tool result cache TTL (ms); 0 to disable\n sessionTokenBudget: 0 # Multi-turn token budget; 0 to disable\n # ragTranslateEnabled: true # Translate non-ASCII RAG queries to English (default: true)\n # classificationEnabled: false # Enable for custom pipelines with multi-store routing\n # toolReselectPerIteration: false # Re-select tools via RAG on each tool-loop iteration\n # llmCallStrategy: streaming # streaming | non-streaming | fallback\n # streamMode: full # full | final \u2014 streaming behavior for tool loops\n # heartbeatIntervalMs: 5000 # SSE heartbeat interval during tool execution (ms)\n # healthTimeoutMs: 5000 # Health check probe timeout (ms); increase for slow providers (SAP AI Core: 15000)\n # retry: # LLM retry config for 429/5xx errors\n # maxAttempts: 3\n # backoffMs: 1000\n # retryOn: [429, 500, 502, 503]\n # retryOnMidStream: ['SSE stream'] # Substrings triggering mid-stream retry\n\n# --- Advanced Multi-Model Pipeline (optional) -------------------------------\n# Use this section to assign different models for different internal tasks.\n# pipeline:\n# llm:\n# main:\n# provider: deepseek # deepseek | openai | anthropic | sap-ai-sdk\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.7\n# streaming: true # false to disable streaming for this provider\n# classifier: # optional; if absent, main config is reused\n# provider: deepseek\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.1\n# helper: # optional; if absent, main config is reused\n# provider: deepseek\n# apiKey: ${DEEPSEEK_API_KEY}\n# model: deepseek-chat\n# temperature: 0.1\n#\n# rag:\n# tools:\n# type: qdrant\n# url: http://qdrant:6333\n# embedder: openai # ollama | openai | <custom registered name>\n# model: text-embedding-3-small\n# apiKey: ${OPENAI_API_KEY}\n# history:\n# type: in-memory\n#\n# mcp:\n# - type: http\n# url: http://localhost:3001/mcp/stream/http\n\n# --- Structured Pipeline (optional) -------------------------------------------\n# Replaces the hardcoded orchestration flow with a YAML-defined stage tree.\n# When absent, the default flow runs unchanged (full backwards compatibility).\n#\n# pipeline:\n# version: \"1\"\n# stages:\n# - id: classify\n# type: classify\n# - id: summarize\n# type: summarize\n# - id: rag-retrieval\n# type: parallel\n# when: \"shouldRetrieve\"\n# stages:\n# - { id: translate, type: translate }\n# - { id: expand, type: expand }\n# after:\n# - id: rag-queries\n# type: parallel\n# stages:\n# - { id: tools, type: rag-query, config: { store: tools, k: 10 } }\n# - { id: history, type: rag-query, config: { store: history, k: 5 } }\n# - { id: rerank, type: rerank }\n# - { id: tool-select, type: tool-select }\n# - id: assemble\n# type: assemble\n# - id: tool-loop\n# type: tool-loop\n\n# prompts:\n# system: \"You are a helpful assistant specialized in SAP ABAP development.\"\n# classifier: |\n# You are an intent classifier... (see source for full default prompt)\n# reasoning: |\n# IMPORTANT: Always start your response with a brief <reasoning> block...\n# ragTranslate: |\n# Translate the user request to English for search purposes...\n# historySummary: |\n# Summarize the conversation so far...\n\nlog: smart-server.log # path to log file; omit for stdout\n# logDir: sessions # Directory for detailed session debug logs\n# pluginDir: ./my-plugins # Additional plugin directory (loaded after defaults)\n\n# subagents: # Optional: nested agents callable from pipeline\n# - name: code-reviewer # Used as stage config: { agent: code-reviewer }\n# description: | # Optional. Shown to the Coordinator planner LLM\n# Reviews code and returns # so it can pick this agent for the right step.\n# structured JSON.\n# config: ./agents/code-reviewer.yaml\n\n# coordinator: # Optional: enable autonomous plan-execute loop\n# planning: one-shot # one-shot | replan-on-error | skill-steps\n# dispatch: subagent # subagent | self | hybrid\n# activation: explicit # explicit (default) | auto\n# plannerLlm: main # main | planner | helper (unused by skill-steps)\n# maxSteps: 12\n# maxRetriesPerStep: 1\n# failPolicy: abort # abort | continue\n# maxLayer: 1 # DEPRECATED \u2014 accepted but ignored (nested\n# # dispatch removed; subagents are leaves)\n";
|
|
52
121
|
export declare function resolveEnvVars(value: unknown, env?: NodeJS.ProcessEnv): unknown;
|
|
53
122
|
export declare function loadYamlConfig(filePath: string, env?: NodeJS.ProcessEnv): YamlConfig;
|
|
54
123
|
export declare function generateConfigTemplate(outputPath: string): void;
|
|
124
|
+
export type FinalizerYaml = {
|
|
125
|
+
type?: 'passthrough' | 'llm' | 'template';
|
|
126
|
+
finalizerLlm?: string;
|
|
127
|
+
systemPrompt?: string;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Build the IFinalizer impl from `coordinator.finalizer:` YAML.
|
|
131
|
+
*
|
|
132
|
+
* Lookup chain for `type: llm`:
|
|
133
|
+
* resolveLlmConfig(llmMap, cfg.finalizerLlm, pipelineFallback)
|
|
134
|
+
* → top-level llm.<name> → llm.main → pipelineFallback (pipeline.llm.main)
|
|
135
|
+
* → ConfigError if all three are missing.
|
|
136
|
+
*
|
|
137
|
+
* Absent block / `type: passthrough` → PassthroughFinalizer.
|
|
138
|
+
* `type: template` → TemplateFinalizer.
|
|
139
|
+
*/
|
|
140
|
+
export declare function buildFinalizer(cfg: FinalizerYaml | undefined, llmMap: NormalizedLlmMap | undefined, pipelineFallback: SmartServerLlmConfig | undefined, makeLlm: (config: SmartServerLlmConfig) => Promise<ILlm>): Promise<IFinalizer>;
|
|
55
141
|
export interface ResolveSmartServerConfigOptions {
|
|
56
142
|
/**
|
|
57
143
|
* Filesystem path of the YAML config that produced `yaml`. Required for
|
|
@@ -61,4 +147,122 @@ export interface ResolveSmartServerConfigOptions {
|
|
|
61
147
|
configPath?: string;
|
|
62
148
|
}
|
|
63
149
|
export declare function resolveSmartServerConfig(args?: ResolveConfigArgs, yaml?: YamlConfig, env?: NodeJS.ProcessEnv, options?: ResolveSmartServerConfigOptions): Omit<SmartServerConfig, 'log'>;
|
|
150
|
+
/**
|
|
151
|
+
* Stepper coordinator modes.
|
|
152
|
+
*/
|
|
153
|
+
export type StepperMode = 'cyclic-react' | 'planned-react';
|
|
154
|
+
/**
|
|
155
|
+
* Configuration for the recursive Stepper coordinator.
|
|
156
|
+
*/
|
|
157
|
+
/**
|
|
158
|
+
* A node of a declared composition tree. A leaf executes via the executor; a
|
|
159
|
+
* node with a nested `flow` runs as a child Stepper (structural recursion —
|
|
160
|
+
* the sub-cycle is declared and visible).
|
|
161
|
+
*/
|
|
162
|
+
export interface CompositionNode {
|
|
163
|
+
id: string;
|
|
164
|
+
goal: string;
|
|
165
|
+
dependsOn?: string[];
|
|
166
|
+
flow?: StepperCompositionSpec;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Front-end-agnostic description of a Stepper composition. Produced by BOTH the
|
|
170
|
+
* yaml parser (`toCompositionSpec`) and a code builder; consumed by the runtime
|
|
171
|
+
* (`buildFromComposition`). Recursive via `nodes[].flow`.
|
|
172
|
+
*/
|
|
173
|
+
export interface StepperCompositionSpec {
|
|
174
|
+
planner: 'none' | 'llm' | 'static';
|
|
175
|
+
granularity: 'shallow' | 'detailed';
|
|
176
|
+
plan?: PlanNode[];
|
|
177
|
+
/** Declared composition nodes; a node with a nested `flow` is a sub-Stepper. */
|
|
178
|
+
nodes?: CompositionNode[];
|
|
179
|
+
executor: 'simple' | 'cyclic-react' | 'recursive';
|
|
180
|
+
finalizer: 'llm';
|
|
181
|
+
/** Optional system-prompt overrides (consumer-supplied via yaml/builder).
|
|
182
|
+
* Undefined → the built-in STEPPER_PLANNER_SYSTEM / EXECUTOR_SYSTEM. */
|
|
183
|
+
plannerSystemPrompt?: string;
|
|
184
|
+
executorSystemPrompt?: string;
|
|
185
|
+
reviewerAtDepths: {
|
|
186
|
+
has(depth: number): boolean;
|
|
187
|
+
};
|
|
188
|
+
maxParallelSteps: number;
|
|
189
|
+
maxDepth: number;
|
|
190
|
+
tokenBudget: number;
|
|
191
|
+
formalizeTask: boolean;
|
|
192
|
+
}
|
|
193
|
+
export interface StepperCoordinatorConfig {
|
|
194
|
+
mode: StepperMode;
|
|
195
|
+
reviewerAtDepths: {
|
|
196
|
+
has(depth: number): boolean;
|
|
197
|
+
};
|
|
198
|
+
maxParallelSteps: number;
|
|
199
|
+
maxDepth: number;
|
|
200
|
+
tokenBudget: number;
|
|
201
|
+
/**
|
|
202
|
+
* Session-scope knowledge entries written into a NEW session's knowledge-RAG
|
|
203
|
+
* before planning. A deployment/config PARAMETER (not agent code) — the
|
|
204
|
+
* operator fills it with guidance for THEIR actual MCP tools (e.g. which read
|
|
205
|
+
* tool reads what). Surfaced to the planner/executor as "Known facts", and the
|
|
206
|
+
* executor enriches its tool-search query with these facts, so a tool named in
|
|
207
|
+
* a seed takes priority over tools the bare-prompt MCP search would surface.
|
|
208
|
+
* The runtime stays MCP-agnostic: tool knowledge lives here as data.
|
|
209
|
+
*/
|
|
210
|
+
knowledgeSeed: ReadonlyArray<{
|
|
211
|
+
content: string;
|
|
212
|
+
artifactType: string;
|
|
213
|
+
}>;
|
|
214
|
+
/**
|
|
215
|
+
* Opt-in (default false): formalize the raw prompt into a compact TaskSpec
|
|
216
|
+
* (objective + scope + constraints + deliverable) ONCE at the root, then
|
|
217
|
+
* thread it down to every planner and executor as a persistent anchor and as
|
|
218
|
+
* the overall-intent prefix for tool search. Off → behaves exactly as before.
|
|
219
|
+
*/
|
|
220
|
+
formalizeTask: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Resolved program flow (the composition the coordinator runs). Always
|
|
223
|
+
* present: parsed from an explicit `coordinator.flow` block when given, else
|
|
224
|
+
* derived from `mode` as a preset (so `mode` is now just a preset alias).
|
|
225
|
+
*
|
|
226
|
+
* - planner 'none' → trivial single-node plan (node goal = prompt)
|
|
227
|
+
* 'llm' → LlmStepperPlanner (LLM decomposition)
|
|
228
|
+
* 'static' → StaticPlanner (declarative `flow.plan`, no LLM)
|
|
229
|
+
* - executor 'cyclic-react' → leaf ReAct loop, no recursion
|
|
230
|
+
* 'recursive' → may spawn child Steppers up to maxDepth
|
|
231
|
+
* - finalizer 'llm' (RootFinalizer). 'passthrough' is reserved (not yet built).
|
|
232
|
+
*/
|
|
233
|
+
flow: {
|
|
234
|
+
planner: 'none' | 'llm' | 'static';
|
|
235
|
+
/** How much the LLM planner decomposes up front (eager): 'shallow' (few
|
|
236
|
+
* high-level steps) | 'detailed' (full concrete-leaf decomposition).
|
|
237
|
+
* Ignored by 'none'/'static'. Default 'shallow'. */
|
|
238
|
+
granularity: 'shallow' | 'detailed';
|
|
239
|
+
/** Leaf executor profile: 'simple' (single pass) | 'cyclic-react' (ReAct
|
|
240
|
+
* loop) | 'recursive' (spawns child Steppers — lazy decomposition). */
|
|
241
|
+
executor: 'simple' | 'cyclic-react' | 'recursive';
|
|
242
|
+
finalizer: 'llm';
|
|
243
|
+
/** Optional per-role system-prompt overrides:
|
|
244
|
+
* `flow.planner.systemPrompt` / `flow.executor.systemPrompt`. */
|
|
245
|
+
plannerSystemPrompt?: string;
|
|
246
|
+
executorSystemPrompt?: string;
|
|
247
|
+
/** Declarative plan nodes, required when planner === 'static'. */
|
|
248
|
+
plan?: PlanNode[];
|
|
249
|
+
/**
|
|
250
|
+
* Declared composition nodes (the "yaml is a tree" shape). A node with a
|
|
251
|
+
* nested `flow` is a sub-Stepper. When present at the root, the planner is
|
|
252
|
+
* effectively static over these nodes.
|
|
253
|
+
*/
|
|
254
|
+
nodes?: CompositionNode[];
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Parse stepper coordinator configuration from a raw config object.
|
|
259
|
+
*
|
|
260
|
+
* Supports:
|
|
261
|
+
* - `mode` (string) — default 'planned-react'; one of cyclic-react | planned-react
|
|
262
|
+
* - `stepper.maxParallelSteps` (number) — default 4
|
|
263
|
+
* - `stepper.maxDepth` (number) — default 4
|
|
264
|
+
* - `stepper.tokenBudget` (number) — default 1,000,000
|
|
265
|
+
* - `stepper.reviewer.atDepths` (number[] | 'all') — default [0,1]; 'all' means accept any depth
|
|
266
|
+
*/
|
|
267
|
+
export declare function parseStepperCoordinatorConfig(coord: Record<string, unknown>): StepperCoordinatorConfig;
|
|
64
268
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/smart-agent/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EACV,IAAI,EACJ,uBAAuB,EACvB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/smart-agent/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EACV,UAAU,EACV,IAAI,EACJ,uBAAuB,EACvB,sBAAsB,EACtB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,cAAc,EAEd,eAAe,EAEf,qBAAqB,EAErB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EAGrB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,YAAY,GAAG,M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