@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.
Files changed (35) hide show
  1. package/dist/generated/version.d.ts +1 -1
  2. package/dist/generated/version.js +1 -1
  3. package/dist/smart-agent/build-dag-coordinator-deps.d.ts +34 -0
  4. package/dist/smart-agent/build-dag-coordinator-deps.d.ts.map +1 -0
  5. package/dist/smart-agent/build-dag-coordinator-deps.js +107 -0
  6. package/dist/smart-agent/build-dag-coordinator-deps.js.map +1 -0
  7. package/dist/smart-agent/build-stepper-root.d.ts +97 -0
  8. package/dist/smart-agent/build-stepper-root.d.ts.map +1 -0
  9. package/dist/smart-agent/build-stepper-root.js +242 -0
  10. package/dist/smart-agent/build-stepper-root.js.map +1 -0
  11. package/dist/smart-agent/config.d.ts +207 -3
  12. package/dist/smart-agent/config.d.ts.map +1 -1
  13. package/dist/smart-agent/config.js +465 -39
  14. package/dist/smart-agent/config.js.map +1 -1
  15. package/dist/smart-agent/jsonl-knowledge-backend.d.ts +19 -0
  16. package/dist/smart-agent/jsonl-knowledge-backend.d.ts.map +1 -0
  17. package/dist/smart-agent/jsonl-knowledge-backend.js +46 -0
  18. package/dist/smart-agent/jsonl-knowledge-backend.js.map +1 -0
  19. package/dist/smart-agent/session-identity-resolver.d.ts +17 -0
  20. package/dist/smart-agent/session-identity-resolver.d.ts.map +1 -0
  21. package/dist/smart-agent/session-identity-resolver.js +37 -0
  22. package/dist/smart-agent/session-identity-resolver.js.map +1 -0
  23. package/dist/smart-agent/session-meta-store.d.ts +53 -0
  24. package/dist/smart-agent/session-meta-store.d.ts.map +1 -0
  25. package/dist/smart-agent/session-meta-store.js +36 -0
  26. package/dist/smart-agent/session-meta-store.js.map +1 -0
  27. package/dist/smart-agent/smart-server.d.ts +288 -4
  28. package/dist/smart-agent/smart-server.d.ts.map +1 -1
  29. package/dist/smart-agent/smart-server.js +1325 -111
  30. package/dist/smart-agent/smart-server.js.map +1 -1
  31. package/dist/smart-agent/stepper-coordinator-handler.d.ts +36 -0
  32. package/dist/smart-agent/stepper-coordinator-handler.d.ts.map +1 -0
  33. package/dist/smart-agent/stepper-coordinator-handler.js +214 -0
  34. package/dist/smart-agent/stepper-coordinator-handler.js.map +1 -0
  35. package/package.json +26 -26
@@ -1,2 +1,2 @@
1
- export declare const PACKAGE_VERSION = "16.2.0";
1
+ export declare const PACKAGE_VERSION = "18.0.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.js — do not edit
2
- export const PACKAGE_VERSION = '16.2.0';
2
+ export const PACKAGE_VERSION = '18.0.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,34 @@
1
+ import type { ILlm, ISubAgent } from '@mcp-abap-adt/llm-agent';
2
+ import type { DagCoordinatorHandlerDeps } from '@mcp-abap-adt/llm-agent-libs';
3
+ import { type NormalizedLlmMap } from './config.js';
4
+ import type { SmartServerLlmConfig } from './smart-server.js';
5
+ export interface BuildDagCoordinatorDepsInput {
6
+ coordCfg: Record<string, unknown> | undefined;
7
+ llmMap: NormalizedLlmMap | undefined;
8
+ /** Adapted from `pipeline.llm.main` (already shape-normalized to
9
+ * SmartServerLlmConfig: `{ provider, apiKey, url: baseURL, model,
10
+ * temperature }`). When set, used as the final fallback in the
11
+ * role-resolution chain map[name] → map.main → pipelineFallback. */
12
+ pipelineFallback: SmartServerLlmConfig | undefined;
13
+ mainLlm: ILlm;
14
+ helperLlm: ILlm | undefined;
15
+ mainTemp: number;
16
+ registry: ReadonlyMap<string, ISubAgent>;
17
+ makeLlm: (config: SmartServerLlmConfig) => Promise<ILlm>;
18
+ warn: (msg: string) => void;
19
+ }
20
+ export type BuiltDagCoordinatorDeps = Omit<DagCoordinatorHandlerDeps, 'workers'> & {
21
+ workers: Map<string, ISubAgent>;
22
+ oracleName?: string;
23
+ };
24
+ /**
25
+ * Assemble the full deps record for `withDagCoordinator`. Returns
26
+ * `undefined` when the YAML does not declare a DAG coordinator (no
27
+ * `planner` block), so the caller can branch.
28
+ *
29
+ * Roles resolve their LLM via the chain:
30
+ * resolveLlmConfig(llmMap, name, pipelineFallback)
31
+ * → top-level llm.<name> → llm.main → pipelineFallback (pipeline.llm.main)
32
+ */
33
+ export declare function buildDagCoordinatorDeps(input: BuildDagCoordinatorDepsInput): Promise<BuiltDagCoordinatorDeps | undefined>;
34
+ //# sourceMappingURL=build-dag-coordinator-deps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-dag-coordinator-deps.d.ts","sourceRoot":"","sources":["../../src/smart-agent/build-dag-coordinator-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEJ,SAAS,EACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAS9E,OAAO,EAEL,KAAK,gBAAgB,EAKtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9C,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACrC;;;yEAGqE;IACrE,gBAAgB,EAAE,oBAAoB,GAAG,SAAS,CAAC;IACnD,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACzC,OAAO,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,yBAAyB,EACzB,SAAS,CACV,GAAG;IACF,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CA0I9C"}
@@ -0,0 +1,107 @@
1
+ import { AbortErrorStrategy, DagPlanInterpreter, LlmDagPlanner, LlmReviewStrategy, ReplanErrorStrategy, SubAgentStateOracle, } from '@mcp-abap-adt/llm-agent-libs';
2
+ import { buildFinalizer, resolveCoordinatorActivation, resolveLlmConfig, resolveLlmConfigStrict, resolveReviewerLlmName, } from './config.js';
3
+ /**
4
+ * Assemble the full deps record for `withDagCoordinator`. Returns
5
+ * `undefined` when the YAML does not declare a DAG coordinator (no
6
+ * `planner` block), so the caller can branch.
7
+ *
8
+ * Roles resolve their LLM via the chain:
9
+ * resolveLlmConfig(llmMap, name, pipelineFallback)
10
+ * → top-level llm.<name> → llm.main → pipelineFallback (pipeline.llm.main)
11
+ */
12
+ export async function buildDagCoordinatorDeps(input) {
13
+ const { coordCfg, llmMap, pipelineFallback, mainLlm, helperLlm, mainTemp, registry, makeLlm, warn, } = input;
14
+ if (!coordCfg || coordCfg.planner === undefined)
15
+ return undefined;
16
+ // ---- Role LLM resolver -----------------------------------------------
17
+ // Priority chain:
18
+ // 1. map[name] — explicit named entry in the top-level llm: block
19
+ // 2. 'helper' | 'planner' alias — route to the prebuilt helperLlm
20
+ // 3. pipelineFallback (pipeline.llm.main) — last resort
21
+ // 4. fallbackPrebuilt (mainLlm) — when nothing else resolves
22
+ const resolveRoleLlm = async (name, fallbackPrebuilt = mainLlm) => {
23
+ // 1. Explicit map[name] — use it (strict: no main fallback here).
24
+ const strict = resolveLlmConfigStrict(llmMap, name);
25
+ if (strict) {
26
+ return makeLlm({
27
+ ...strict,
28
+ temperature: Number(strict.temperature ?? mainTemp),
29
+ });
30
+ }
31
+ // 2. 'helper' | 'planner' alias → reuse prebuilt helperLlm.
32
+ if (name === 'helper' || name === 'planner') {
33
+ return helperLlm ?? fallbackPrebuilt;
34
+ }
35
+ // 3. Unknown name → final fallback chain via resolveLlmConfig (map.main → pipelineFallback).
36
+ if (name) {
37
+ const fb = resolveLlmConfig(llmMap, name, pipelineFallback);
38
+ if (fb) {
39
+ return makeLlm({
40
+ ...fb,
41
+ temperature: Number(fb.temperature ?? mainTemp),
42
+ });
43
+ }
44
+ }
45
+ // 4. No name at all → fallbackPrebuilt (mainLlm by default).
46
+ return fallbackPrebuilt;
47
+ };
48
+ // ---- Planner ----------------------------------------------------------
49
+ const plannerBlock = coordCfg.planner;
50
+ const plannerLlm = await resolveRoleLlm(plannerBlock?.plannerLlm);
51
+ const planner = new LlmDagPlanner(plannerLlm);
52
+ // ---- Reviewer (optional) ---------------------------------------------
53
+ let reviewer;
54
+ if (coordCfg.reviewer !== undefined) {
55
+ const reviewerBlock = coordCfg.reviewer;
56
+ const reviewerName = resolveReviewerLlmName(reviewerBlock, warn);
57
+ const reviewerLlm = await resolveRoleLlm(reviewerName);
58
+ reviewer = new LlmReviewStrategy(reviewerLlm);
59
+ }
60
+ // ---- Interpreter, workers, oracle, activation, error strategy --------
61
+ const interpreter = new DagPlanInterpreter();
62
+ const oracleName = coordCfg.stateOracle;
63
+ let rawOracle;
64
+ if (oracleName) {
65
+ rawOracle = registry.get(oracleName);
66
+ if (!rawOracle) {
67
+ throw new Error(`coordinator.stateOracle '${oracleName}' is not a declared subagent`);
68
+ }
69
+ }
70
+ const workers = new Map([...registry].filter(([name]) => name !== oracleName));
71
+ if (workers.size === 0) {
72
+ throw new Error('coordinator.planner is set (DAG mode) but no workers are configured. ' +
73
+ 'Add at least one entry under the top-level `subagents:` block.');
74
+ }
75
+ const activation = resolveCoordinatorActivation((coordCfg.activation ?? 'explicit'));
76
+ let errorStrategy;
77
+ const esCfg = coordCfg.errorStrategy;
78
+ if (esCfg?.type === 'replan') {
79
+ errorStrategy = new ReplanErrorStrategy(planner, esCfg.maxReplans);
80
+ }
81
+ else if (esCfg?.type === 'abort') {
82
+ errorStrategy = new AbortErrorStrategy();
83
+ }
84
+ // ---- Finalizer --------------------------------------------------------
85
+ const finalizer = await buildFinalizer(coordCfg.finalizer, llmMap, pipelineFallback, async (lc) => makeLlm({
86
+ ...lc,
87
+ temperature: Number(lc.temperature ?? mainTemp),
88
+ }));
89
+ // ---- Oracle wrap ------------------------------------------------------
90
+ const stateOracle = rawOracle
91
+ ? new SubAgentStateOracle(rawOracle)
92
+ : undefined;
93
+ void mainLlm;
94
+ return {
95
+ planner,
96
+ interpreter,
97
+ workers,
98
+ activation,
99
+ reviewer,
100
+ errorStrategy,
101
+ stateOracle,
102
+ finalizer,
103
+ maxRoundTrips: coordCfg.maxRoundTrips,
104
+ oracleName,
105
+ };
106
+ }
107
+ //# sourceMappingURL=build-dag-coordinator-deps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-dag-coordinator-deps.js","sourceRoot":"","sources":["../../src/smart-agent/build-dag-coordinator-deps.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,cAAc,EAEd,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AA2BrB;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,KAAmC;IAEnC,MAAM,EACJ,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,IAAI,GACL,GAAG,KAAK,CAAC;IAEV,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,O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AAC;SAAM,IAAI,KAAK,EAAE,IAAI,KAAK,OAAO,EAAE,CAAC;QACnC,aAAa,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAC3C,CAAC;IAED,0EAA0E;IAC1E,MAAM,SAAS,GAAG,MAAM,cAAc,CACpC,QAAQ,CAAC,SAAkB,EAC3B,MAAM,EACN,gBAAgB,EAChB,KAAK,EAAE,EAAE,EAAE,EAAE,CACX,OAAO,CAAC;QACN,GAAG,EAAE;QACL,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,WAAW,IAAI,QAAQ,CAAC;KAChD,CAAC,CACL,CAAC;IAEF,0EAA0E;IAC1E,MAAM,WAAW,GAAG,SAAS;QAC3B,CAAC,CAAC,IAAI,mBAAmB,CAAC,SAAS,CAAC;QACpC,CAAC,CAAC,SAAS,CAAC;IAEd,KAAK,OAAO,CAAC;IAEb,OAAO;QACL,OAAO;QACP,WAAW;QACX,OAAO;QACP,UAAU;QACV,QAAQ;QACR,aAAa;QACb,WAAW;QACX,SAAS;QACT,aAAa,EAAE,QAAQ,CAAC,aAAmC;QAC3D,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { type IKnowledgeRagHandle, type ILlm, type IStepper, type ITaskFormalizer, type LlmCallEntry, TokenLedger } from '@mcp-abap-adt/llm-agent';
2
+ import { RootFinalizer, Stepper } from '@mcp-abap-adt/llm-agent-libs';
3
+ import { type NormalizedLlmMap, type StepperCompositionSpec, type StepperCoordinatorConfig } from './config.js';
4
+ import type { SmartServerLlmConfig } from './smart-server.js';
5
+ export interface BuildStepperRootInput {
6
+ /** Raw coordinator config object (e.g. the `coordinator:` YAML block). */
7
+ coordCfg: Record<string, unknown>;
8
+ /**
9
+ * Pre-built named registry of subagent Steppers — DI/test override for
10
+ * deep-stepper mode. When non-empty it is used as childSteppers verbatim;
11
+ * when empty, child Steppers are built from `subagents` (the normal path).
12
+ */
13
+ registry: ReadonlyMap<string, IStepper>;
14
+ /**
15
+ * Declared subagents (name + description) from the `subagents:` YAML block.
16
+ * In deep-stepper mode each becomes a recursive child Stepper sharing this
17
+ * run's planner/executor/reviewer/ledger, and is advertised to the planner so
18
+ * it can delegate sub-goals via a node's `agent`. Ignored in other modes.
19
+ */
20
+ subagents?: ReadonlyArray<{
21
+ name: string;
22
+ description?: string;
23
+ }>;
24
+ /** Factory to build an ILlm from a config; used for all roles. */
25
+ makeLlm: (config: SmartServerLlmConfig) => Promise<ILlm>;
26
+ /** Per-sessionId knowledge RAG factory. */
27
+ knowledgeRagFor: (sessionId: string) => IKnowledgeRagHandle;
28
+ /** Shared tools RAG handle. */
29
+ toolsRag: import('@mcp-abap-adt/llm-agent').IToolsRagHandle;
30
+ /** MCP tool invoker. */
31
+ callMcp: (name: string, args: unknown, signal?: AbortSignal) => Promise<string>;
32
+ /** Monotonically-unique stepper-ID minter. */
33
+ mintStepperId: () => string;
34
+ /**
35
+ * Normalized per-role LLM map (top-level `llm:` block after normalization).
36
+ * Roles resolve via: llmMap[role] → llmMap.main → pipelineFallback.
37
+ * When both are undefined, roles fall back to a stub (test path).
38
+ */
39
+ llmMap?: NormalizedLlmMap;
40
+ /**
41
+ * Pipeline fallback config (`pipeline.llm.main`). Used as last resort when
42
+ * a role is absent from llmMap.
43
+ */
44
+ pipelineFallback?: SmartServerLlmConfig;
45
+ /**
46
+ * Optional usage logger. When supplied, every per-role LLM call is logged
47
+ * via a LoggingLlm decorator so byComponent is populated in requestLogger.
48
+ * Matches IRequestLogger.logLlmCall(entry) — pass a bound wrapper that
49
+ * injects the traceId as requestId.
50
+ */
51
+ logLlmCall?: (entry: LlmCallEntry) => void;
52
+ }
53
+ export interface BuiltStepperRoot {
54
+ rootStepper: Stepper;
55
+ finalizer: RootFinalizer;
56
+ budget: {
57
+ depthRemaining: number;
58
+ tokens: TokenLedger;
59
+ };
60
+ maxParallelSteps: number;
61
+ /**
62
+ * Present only when `coordinator.formalizeTask` is enabled. The handler calls
63
+ * it ONCE on the raw prompt and threads the resulting TaskSpec into
64
+ * rootStepper.run. Absent → no formalization (behaves as before).
65
+ */
66
+ taskFormalizer?: ITaskFormalizer;
67
+ }
68
+ export type { CompositionNode, StepperCompositionSpec } from './config.js';
69
+ /** Build-time dependencies (everything not part of the composition itself). */
70
+ export interface BuildFromCompositionDeps {
71
+ makeLlm: (config: SmartServerLlmConfig) => Promise<ILlm>;
72
+ callMcp: (name: string, args: unknown, signal?: AbortSignal) => Promise<string>;
73
+ mintStepperId: () => string;
74
+ llmMap?: NormalizedLlmMap;
75
+ pipelineFallback?: SmartServerLlmConfig;
76
+ logLlmCall?: (entry: LlmCallEntry) => void;
77
+ subagents?: ReadonlyArray<{
78
+ name: string;
79
+ description?: string;
80
+ }>;
81
+ registry: ReadonlyMap<string, IStepper>;
82
+ }
83
+ /** Map a parsed coordinator config to the front-end-agnostic composition spec. */
84
+ export declare function toCompositionSpec(config: StepperCoordinatorConfig): StepperCompositionSpec;
85
+ /**
86
+ * yaml front-end: parse the raw coordinator config block → composition spec →
87
+ * build. Thin wrapper over {@link buildFromComposition}; a code builder can call
88
+ * buildFromComposition directly with a spec it constructs itself (parity).
89
+ */
90
+ export declare function buildStepperRoot(input: BuildStepperRootInput): Promise<BuiltStepperRoot>;
91
+ /**
92
+ * Build the root Stepper + finalizer from a front-end-agnostic composition spec.
93
+ * The yaml path reaches here via buildStepperRoot; a code builder can call this
94
+ * directly. Each role LLM resolves via llmMap[role] → llmMap.main → fallback.
95
+ */
96
+ export declare function buildFromComposition(spec: StepperCompositionSpec, deps: BuildFromCompositionDeps): Promise<BuiltStepperRoot>;
97
+ //# sourceMappingURL=build-stepper-root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-stepper-root.d.ts","sourceRoot":"","sources":["../../src/smart-agent/build-stepper-root.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,IAAI,EAET,KAAK,QAAQ,EAEb,KAAK,eAAe,EACpB,KAAK,YAAY,EAEjB,WA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BAAgB,CAAC,CAmO3B"}
@@ -0,0 +1,242 @@
1
+ import { TokenLedger, } from '@mcp-abap-adt/llm-agent';
2
+ import { CyclicReActExecutor, LlmNeedResolver, LlmReviewStrategy, LlmStepperPlanner, LlmTaskFormalizer, LoggingLlm, RootFinalizer, StaticPlanner, Stepper, StepperInterpreter, } from '@mcp-abap-adt/llm-agent-libs';
3
+ import { parseStepperCoordinatorConfig, resolveLlmConfig, } from './config.js';
4
+ const STUB_LLM_CFG = {
5
+ provider: 'openai',
6
+ apiKey: '',
7
+ model: 'stub',
8
+ };
9
+ /** Map a parsed coordinator config to the front-end-agnostic composition spec. */
10
+ export function toCompositionSpec(config) {
11
+ return {
12
+ planner: config.flow.planner,
13
+ granularity: config.flow.granularity,
14
+ ...(config.flow.plan ? { plan: config.flow.plan } : {}),
15
+ ...(config.flow.nodes ? { nodes: config.flow.nodes } : {}),
16
+ executor: config.flow.executor,
17
+ finalizer: config.flow.finalizer,
18
+ ...(config.flow.plannerSystemPrompt
19
+ ? { plannerSystemPrompt: config.flow.plannerSystemPrompt }
20
+ : {}),
21
+ ...(config.flow.executorSystemPrompt
22
+ ? { executorSystemPrompt: config.flow.executorSystemPrompt }
23
+ : {}),
24
+ reviewerAtDepths: config.reviewerAtDepths,
25
+ maxParallelSteps: config.maxParallelSteps,
26
+ maxDepth: config.maxDepth,
27
+ tokenBudget: config.tokenBudget,
28
+ formalizeTask: config.formalizeTask,
29
+ };
30
+ }
31
+ /**
32
+ * yaml front-end: parse the raw coordinator config block → composition spec →
33
+ * build. Thin wrapper over {@link buildFromComposition}; a code builder can call
34
+ * buildFromComposition directly with a spec it constructs itself (parity).
35
+ */
36
+ export async function buildStepperRoot(input) {
37
+ const config = parseStepperCoordinatorConfig(input.coordCfg);
38
+ return buildFromComposition(toCompositionSpec(config), {
39
+ makeLlm: input.makeLlm,
40
+ callMcp: input.callMcp,
41
+ mintStepperId: input.mintStepperId,
42
+ llmMap: input.llmMap,
43
+ pipelineFallback: input.pipelineFallback,
44
+ logLlmCall: input.logLlmCall,
45
+ subagents: input.subagents,
46
+ registry: input.registry,
47
+ });
48
+ }
49
+ /**
50
+ * Build the root Stepper + finalizer from a front-end-agnostic composition spec.
51
+ * The yaml path reaches here via buildStepperRoot; a code builder can call this
52
+ * directly. Each role LLM resolves via llmMap[role] → llmMap.main → fallback.
53
+ */
54
+ export async function buildFromComposition(spec, deps) {
55
+ const { registry, makeLlm, callMcp, mintStepperId, llmMap, pipelineFallback, logLlmCall, } = deps;
56
+ // Shared token ledger — ONE instance per run (review R2-F1). Created up-front
57
+ // so every role's LLM decorator can spend on it (see resolveRoleLlm).
58
+ const tokens = new TokenLedger(spec.tokenBudget);
59
+ // ---- Per-role LLM resolver -----------------------------------------------
60
+ // Priority chain: llmMap[role] → llmMap.main → pipelineFallback → STUB_LLM_CFG.
61
+ // Mirrors the resolution chain used in buildDagCoordinatorDeps.
62
+ //
63
+ // `spendOnLedger` makes the role's LLM decrement the SHARED token ledger after
64
+ // each call, so coordinator.stepper.tokenBudget bounds ALL stepper work — not
65
+ // just the executor (review Finding 2). The executor passes `false`: it spends
66
+ // on the same ledger itself (see CyclicReActExecutor) and double-counting must
67
+ // be avoided. The decorator is now installed whenever EITHER logging or ledger
68
+ // accounting is needed (previously it was skipped entirely without a logger).
69
+ const resolveRoleLlm = async (role, component, spendOnLedger) => {
70
+ const cfg = resolveLlmConfig(llmMap, role, pipelineFallback) ?? STUB_LLM_CFG;
71
+ const inner = await makeLlm(cfg);
72
+ if (!logLlmCall && !spendOnLedger)
73
+ return inner;
74
+ // Wrap with LoggingLlm so every call to this role's LLM is (a) logged to
75
+ // byComponent and (b) charged to the shared ledger. Fires once per call
76
+ // (chat or streamChat) after usage is known.
77
+ return new LoggingLlm(inner, (usage, durationMs) => {
78
+ if (logLlmCall) {
79
+ logLlmCall({
80
+ component,
81
+ model: inner.model ?? cfg.model ?? 'unknown',
82
+ promptTokens: usage.promptTokens,
83
+ completionTokens: usage.completionTokens,
84
+ totalTokens: usage.totalTokens,
85
+ durationMs,
86
+ });
87
+ }
88
+ if (spendOnLedger)
89
+ tokens.spend(usage);
90
+ });
91
+ };
92
+ // ---- Build per-role LLMs --------------------------------------------------
93
+ // Every non-executor role charges the shared ledger; the executor self-spends.
94
+ const plannerLlm = await resolveRoleLlm('planner', 'planner', true);
95
+ const executorLlm = await resolveRoleLlm('executor', 'tool-loop', false);
96
+ const finalizerLlm = await resolveRoleLlm('finalizer', 'finalizer', true);
97
+ const reviewerLlm = await resolveRoleLlm('reviewer', 'reviewer', true);
98
+ // Tool-definer LLM: detects an unmet-tool-need ("I can't … no tool") in a
99
+ // candidate final answer and yields the phrase to search toolsRag with before
100
+ // the retry. Logged under its OWN component 'tool-definer' — NOT 'classifier'
101
+ // — so its cost is distinct from the (skipped-in-stepper) request classifier
102
+ // and the name reflects its actual job. Resolves via role 'classifier' (falls
103
+ // back to main); point it at a small model via `llm.classifier` in YAML.
104
+ const toolDefinerLlm = await resolveRoleLlm('classifier', 'tool-definer', true);
105
+ // ---- Reviewer (always built; Stepper only invokes at configured depths) ---
106
+ const reviewer = new LlmReviewStrategy(reviewerLlm);
107
+ // One shared interpreter + need-resolver across the whole tree.
108
+ const interpreter = new StepperInterpreter();
109
+ const needResolver = new LlmNeedResolver(toolDefinerLlm);
110
+ // Leaf executor per spec.executor profile (reuses the shared executor LLM +
111
+ // need-resolver): 'simple' = single pass (maxIter 2); cyclic-react/recursive
112
+ // run the full ReAct loop (maxIter 10).
113
+ const makeExecutor = (s) => new CyclicReActExecutor({
114
+ llm: executorLlm,
115
+ callMcp,
116
+ component: 'tool-loop',
117
+ maxIterations: s.executor === 'simple' ? 2 : 10,
118
+ needResolver,
119
+ ...(s.executorSystemPrompt
120
+ ? { systemPrompt: s.executorSystemPrompt }
121
+ : {}),
122
+ });
123
+ const trivialPlanner = {
124
+ name: 'trivial',
125
+ async plan(inp) {
126
+ return {
127
+ objective: inp.prompt,
128
+ nodes: [{ id: 'root', goal: inp.prompt }],
129
+ createdAt: 0,
130
+ };
131
+ },
132
+ };
133
+ // Recursive composition builder. LLMs, token ledger, reviewer, interpreter are
134
+ // SHARED across the whole tree (shared-ledger invariant); only the planner, the
135
+ // executor profile and the childSteppers vary per (nested) spec.
136
+ const buildNode = (s, depth) => {
137
+ const ex = makeExecutor(s);
138
+ const childMap = new Map();
139
+ const nodes = s.nodes ?? [];
140
+ // Planner selection. Declared `nodes` ⇒ static plan over them (nested nodes
141
+ // carry agent=id so the interpreter routes them into their child Stepper).
142
+ let planner;
143
+ if (nodes.length > 0) {
144
+ const planNodes = nodes.map((n) => ({
145
+ id: n.id,
146
+ goal: n.goal,
147
+ ...(n.dependsOn ? { dependsOn: n.dependsOn } : {}),
148
+ ...(n.flow ? { agent: n.id } : {}),
149
+ }));
150
+ planner = new StaticPlanner(planNodes);
151
+ }
152
+ else if (s.planner === 'none') {
153
+ planner = trivialPlanner;
154
+ }
155
+ else if (s.planner === 'static') {
156
+ planner = new StaticPlanner(s.plan ?? []);
157
+ }
158
+ else {
159
+ planner = new LlmStepperPlanner(plannerLlm, s.granularity, s.plannerSystemPrompt);
160
+ }
161
+ // (a) Structural recursion: declared nested-flow nodes → child Steppers.
162
+ for (const n of nodes) {
163
+ if (n.flow)
164
+ childMap.set(n.id, buildNode(n.flow, depth + 1));
165
+ }
166
+ // (b) Runtime subagent recursion (executor: recursive) — only when NO nested
167
+ // nodes were declared; preserves the existing deep-stepper behaviour. Children
168
+ // share this run's planner/executor/reviewer + role LLMs (shared ledger), and
169
+ // point childSteppers back to the SAME map so recursion continues.
170
+ let catalog = [];
171
+ if (s.executor === 'recursive' && nodes.length === 0) {
172
+ catalog = (deps.subagents ?? []).map((sa) => ({
173
+ name: sa.name,
174
+ description: sa.description,
175
+ }));
176
+ if (registry.size > 0) {
177
+ for (const [k, v] of registry)
178
+ childMap.set(k, v);
179
+ }
180
+ else {
181
+ for (const sa of catalog) {
182
+ childMap.set(sa.name, new Stepper({
183
+ name: sa.name,
184
+ planner,
185
+ interpreter,
186
+ executor: ex,
187
+ childSteppers: childMap,
188
+ reviewer,
189
+ reviewerAtDepths: s.reviewerAtDepths,
190
+ depth: depth + 1,
191
+ maxParallelSteps: s.maxParallelSteps,
192
+ mintStepperId,
193
+ childAgentCatalog: catalog,
194
+ }));
195
+ }
196
+ }
197
+ }
198
+ return new Stepper({
199
+ name: depth === 0 ? 'root' : `node-d${depth}`,
200
+ planner,
201
+ interpreter,
202
+ executor: ex,
203
+ childSteppers: childMap,
204
+ reviewer,
205
+ reviewerAtDepths: s.reviewerAtDepths,
206
+ depth,
207
+ maxParallelSteps: s.maxParallelSteps,
208
+ mintStepperId,
209
+ childAgentCatalog: catalog,
210
+ });
211
+ };
212
+ const rootStepper = buildNode(spec, 0);
213
+ // Depth budget covers BOTH declared nesting and runtime recursion.
214
+ const nestingDepth = (s) => {
215
+ const ds = (s.nodes ?? [])
216
+ .filter((n) => n.flow)
217
+ .map((n) => 1 + nestingDepth(n.flow));
218
+ return ds.length ? Math.max(...ds) : 0;
219
+ };
220
+ const anyRecursive = (s) => s.executor === 'recursive' ||
221
+ (s.nodes ?? []).some((n) => !!n.flow && anyRecursive(n.flow));
222
+ const baseDepth = spec.executor === 'recursive'
223
+ ? spec.maxDepth
224
+ : spec.planner === 'none' && (spec.nodes?.length ?? 0) === 0
225
+ ? 0
226
+ : 1;
227
+ const depthRemaining = Math.max(baseDepth, nestingDepth(spec), anyRecursive(spec) ? spec.maxDepth : 0);
228
+ const finalizer = new RootFinalizer(finalizerLlm);
229
+ // Task formalizer (opt-in): uses the strong planner-tier LLM to produce a
230
+ // compact TaskSpec once at the root. Built only when configured.
231
+ const taskFormalizer = spec.formalizeTask
232
+ ? new LlmTaskFormalizer(plannerLlm)
233
+ : undefined;
234
+ return {
235
+ rootStepper,
236
+ finalizer,
237
+ budget: { depthRemaining, tokens },
238
+ maxParallelSteps: spec.maxParallelSteps,
239
+ ...(taskFormalizer ? { taskFormalizer } : {}),
240
+ };
241
+ }
242
+ //# sourceMappingURL=build-stepper-root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-stepper-root.js","sourceRoot":"","sources":["../../src/smart-agent/build-stepper-root.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,aAAa,EACb,OAAO,EACP,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,6BAA6B,EAC7B,gBAAgB,GAGjB,MAAM,aAAa,CAAC;AAkErB,MAAM,YAAY,GAAyB;IACzC,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,MAAM;CACL,CAAC;AAuBX,kFAAkF;AAClF,MAAM,UAAU,iBAAiB,CAC/B,MAAgC;IAEhC,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO;QAC5B,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW;QACpC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ;QAC9B,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS;QAChC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB;YACjC,CAAC,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC1D,CAAC,CAAC,EAAE,C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