@mcp-abap-adt/llm-agent-server-libs 18.1.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 (74) hide show
  1. package/README.md +42 -0
  2. package/dist/factories/cyclic-factory.d.ts +48 -0
  3. package/dist/factories/cyclic-factory.d.ts.map +1 -0
  4. package/dist/factories/cyclic-factory.js +35 -0
  5. package/dist/factories/cyclic-factory.js.map +1 -0
  6. package/dist/factories/dag-factory.d.ts +13 -0
  7. package/dist/factories/dag-factory.d.ts.map +1 -0
  8. package/dist/factories/dag-factory.js +14 -0
  9. package/dist/factories/dag-factory.js.map +1 -0
  10. package/dist/factories/deep-stepper-factory.d.ts +12 -0
  11. package/dist/factories/deep-stepper-factory.d.ts.map +1 -0
  12. package/dist/factories/deep-stepper-factory.js +13 -0
  13. package/dist/factories/deep-stepper-factory.js.map +1 -0
  14. package/dist/factories/index.d.ts +7 -0
  15. package/dist/factories/index.d.ts.map +1 -0
  16. package/dist/factories/index.js +6 -0
  17. package/dist/factories/index.js.map +1 -0
  18. package/dist/factories/linear-factory.d.ts +13 -0
  19. package/dist/factories/linear-factory.d.ts.map +1 -0
  20. package/dist/factories/linear-factory.js +14 -0
  21. package/dist/factories/linear-factory.js.map +1 -0
  22. package/dist/factories/planned-factory.d.ts +12 -0
  23. package/dist/factories/planned-factory.d.ts.map +1 -0
  24. package/dist/factories/planned-factory.js +13 -0
  25. package/dist/factories/planned-factory.js.map +1 -0
  26. package/dist/generated/version.d.ts +2 -0
  27. package/dist/generated/version.d.ts.map +1 -0
  28. package/dist/generated/version.js +3 -0
  29. package/dist/generated/version.js.map +1 -0
  30. package/dist/index.d.ts +12 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +12 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/smart-agent/build-dag-coordinator-deps.d.ts +34 -0
  35. package/dist/smart-agent/build-dag-coordinator-deps.d.ts.map +1 -0
  36. package/dist/smart-agent/build-dag-coordinator-deps.js +107 -0
  37. package/dist/smart-agent/build-dag-coordinator-deps.js.map +1 -0
  38. package/dist/smart-agent/build-stepper-root.d.ts +110 -0
  39. package/dist/smart-agent/build-stepper-root.d.ts.map +1 -0
  40. package/dist/smart-agent/build-stepper-root.js +270 -0
  41. package/dist/smart-agent/build-stepper-root.js.map +1 -0
  42. package/dist/smart-agent/config.d.ts +282 -0
  43. package/dist/smart-agent/config.d.ts.map +1 -0
  44. package/dist/smart-agent/config.js +1109 -0
  45. package/dist/smart-agent/config.js.map +1 -0
  46. package/dist/smart-agent/jsonl-knowledge-backend.d.ts +19 -0
  47. package/dist/smart-agent/jsonl-knowledge-backend.d.ts.map +1 -0
  48. package/dist/smart-agent/jsonl-knowledge-backend.js +46 -0
  49. package/dist/smart-agent/jsonl-knowledge-backend.js.map +1 -0
  50. package/dist/smart-agent/pipeline.d.ts +89 -0
  51. package/dist/smart-agent/pipeline.d.ts.map +1 -0
  52. package/dist/smart-agent/pipeline.js +8 -0
  53. package/dist/smart-agent/pipeline.js.map +1 -0
  54. package/dist/smart-agent/resolve-agent-embedder.d.ts +34 -0
  55. package/dist/smart-agent/resolve-agent-embedder.d.ts.map +1 -0
  56. package/dist/smart-agent/resolve-agent-embedder.js +48 -0
  57. package/dist/smart-agent/resolve-agent-embedder.js.map +1 -0
  58. package/dist/smart-agent/session-identity-resolver.d.ts +17 -0
  59. package/dist/smart-agent/session-identity-resolver.d.ts.map +1 -0
  60. package/dist/smart-agent/session-identity-resolver.js +37 -0
  61. package/dist/smart-agent/session-identity-resolver.js.map +1 -0
  62. package/dist/smart-agent/session-meta-store.d.ts +53 -0
  63. package/dist/smart-agent/session-meta-store.d.ts.map +1 -0
  64. package/dist/smart-agent/session-meta-store.js +36 -0
  65. package/dist/smart-agent/session-meta-store.js.map +1 -0
  66. package/dist/smart-agent/smart-server.d.ts +525 -0
  67. package/dist/smart-agent/smart-server.d.ts.map +1 -0
  68. package/dist/smart-agent/smart-server.js +2309 -0
  69. package/dist/smart-agent/smart-server.js.map +1 -0
  70. package/dist/smart-agent/stepper-coordinator-handler.d.ts +36 -0
  71. package/dist/smart-agent/stepper-coordinator-handler.d.ts.map +1 -0
  72. package/dist/smart-agent/stepper-coordinator-handler.js +230 -0
  73. package/dist/smart-agent/stepper-coordinator-handler.js.map +1 -0
  74. package/package.json +48 -0
@@ -0,0 +1,525 @@
1
+ /**
2
+ * SmartServer — embeddable OpenAI-compatible HTTP server backed by SmartAgent.
3
+ */
4
+ import type { EmbedderFactory, IClientAdapter, IEmbedder, IKnowledgeRagHandle, ILlm, ILlmApiAdapter, ILogger, IMcpClient, IModelResolver, IRagRegistry, IRequestLogger, ISkillManager } from '@mcp-abap-adt/llm-agent';
5
+ import { type IRag } from '@mcp-abap-adt/llm-agent';
6
+ import type { IPluginLoader, SessionAgentParts, SessionGraph, SmartAgent } from '@mcp-abap-adt/llm-agent-libs';
7
+ import { SessionRegistry } from '@mcp-abap-adt/llm-agent-libs';
8
+ import type { PipelineConfig } from './pipeline.js';
9
+ import { resolveSessionIdentity } from './session-identity-resolver.js';
10
+ export interface SmartServerLlmConfig {
11
+ /** Provider id for the flat schema. Required when no pipeline.llm.main is set. */
12
+ provider?: 'deepseek' | 'openai' | 'anthropic' | 'sap-ai-sdk' | 'ollama';
13
+ apiKey: string;
14
+ /** Custom base URL (OpenAI-compatible endpoints: Ollama, Azure, vLLM). */
15
+ url?: string;
16
+ model?: string;
17
+ temperature?: number;
18
+ maxTokens?: number;
19
+ classifierTemperature?: number;
20
+ }
21
+ export interface SmartServerRagConfig {
22
+ type?: 'in-memory' | 'qdrant' | 'hana-vector' | 'pg-vector';
23
+ /**
24
+ * Embedder name — resolved from the embedder factory registry.
25
+ * Built-in: 'ollama', 'openai', 'sap-ai-core'. Consumers can register custom factories.
26
+ * When omitted, defaults to 'ollama' for stores that require one.
27
+ */
28
+ embedder?: string;
29
+ url?: string;
30
+ model?: string;
31
+ collectionName?: string;
32
+ dedupThreshold?: number;
33
+ vectorWeight?: number;
34
+ keywordWeight?: number;
35
+ connectionString?: string;
36
+ host?: string;
37
+ port?: number;
38
+ user?: string;
39
+ password?: string;
40
+ database?: string;
41
+ schema?: string;
42
+ dimension?: number;
43
+ autoCreateSchema?: boolean;
44
+ poolMax?: number;
45
+ connectTimeout?: number;
46
+ /** SAP AI Core resource group (used when embedder is 'sap-ai-core' / 'sap-aicore'). */
47
+ resourceGroup?: string;
48
+ /**
49
+ * SAP AI Core scenario for the embedding model deployment.
50
+ * `'orchestration'` (default) uses the SAP SDK; `'foundation-models'` calls the REST inference API.
51
+ */
52
+ scenario?: 'orchestration' | 'foundation-models';
53
+ }
54
+ export interface SmartServerMcpConfig {
55
+ type: 'http' | 'stdio';
56
+ url?: string;
57
+ command?: string;
58
+ args?: string[];
59
+ headers?: Record<string, string>;
60
+ }
61
+ export interface SmartServerAgentConfig {
62
+ externalToolsValidationMode?: 'permissive' | 'strict';
63
+ maxIterations?: number;
64
+ maxToolCalls?: number;
65
+ toolUnavailableTtlMs?: number;
66
+ ragQueryK?: number;
67
+ contextBudgetTokens?: number;
68
+ semanticHistoryEnabled?: boolean;
69
+ historyRecencyWindow?: number;
70
+ historyTurnSummaryPrompt?: string;
71
+ showReasoning?: boolean;
72
+ historyAutoSummarizeLimit?: number;
73
+ queryExpansionEnabled?: boolean;
74
+ toolResultCacheTtlMs?: number;
75
+ sessionTokenBudget?: number;
76
+ /** Whether classification stage runs. Default: true. */
77
+ classificationEnabled?: boolean;
78
+ /** LLM call strategy for tool-loop. 'streaming' (default) | 'non-streaming' | 'fallback'. */
79
+ llmCallStrategy?: 'streaming' | 'non-streaming' | 'fallback';
80
+ /** Tool-selection strategy over RAG results. Default: top-k. */
81
+ toolSelection?: {
82
+ strategy: string;
83
+ minScore?: number;
84
+ };
85
+ }
86
+ export interface SmartServerPromptsConfig {
87
+ system?: string;
88
+ classifier?: string;
89
+ reasoning?: string;
90
+ ragTranslate?: string;
91
+ historySummary?: string;
92
+ }
93
+ export interface SmartServerSkillsConfig {
94
+ /** Manager type: 'claude' | 'codex' | 'filesystem'. Default: 'claude'. */
95
+ type?: 'claude' | 'codex' | 'filesystem';
96
+ /** Custom directories (filesystem type only). */
97
+ dirs?: string[];
98
+ /** Project root for relative skill dirs (claude/codex types). Defaults to cwd. */
99
+ projectRoot?: string;
100
+ }
101
+ export type SmartServerMode = 'hard' | 'pass' | 'smart';
102
+ export interface SmartServerCircuitBreakerConfig {
103
+ /** Number of consecutive failures before opening. Default: 5 */
104
+ failureThreshold?: number;
105
+ /** Time (ms) to wait before probing again. Default: 30 000 */
106
+ recoveryWindowMs?: number;
107
+ }
108
+ export interface SmartServerConfig {
109
+ port?: number;
110
+ host?: string;
111
+ llm?: SmartServerLlmConfig | Record<string, SmartServerLlmConfig>;
112
+ rag?: SmartServerRagConfig;
113
+ mcp?: SmartServerMcpConfig | SmartServerMcpConfig[];
114
+ agent?: SmartServerAgentConfig;
115
+ prompts?: SmartServerPromptsConfig;
116
+ mode?: SmartServerMode;
117
+ pipeline?: PipelineConfig;
118
+ log?: (event: Record<string, unknown>) => void;
119
+ logDir?: string;
120
+ circuitBreaker?: SmartServerCircuitBreakerConfig;
121
+ version?: string;
122
+ /** Path to YAML config file for hot-reload. */
123
+ configFile?: string;
124
+ /** Additional plugin directory (merged with defaults). Used by the default FileSystemPluginLoader. */
125
+ pluginDir?: string;
126
+ /** Custom plugin loader. When set, replaces the default FileSystemPluginLoader. */
127
+ pluginLoader?: IPluginLoader;
128
+ /** Pre-built embedder injected via DI. Takes precedence over config-driven selection. */
129
+ embedder?: IEmbedder;
130
+ /** Named embedder factories for YAML-driven selection (merged with built-ins). */
131
+ embedderFactories?: Record<string, EmbedderFactory>;
132
+ /**
133
+ * Skill discovery configuration from YAML.
134
+ *
135
+ * `type`: Manager variant — `'claude'` | `'codex'` | `'filesystem'`.
136
+ * `dirs`: Custom directories (filesystem type only).
137
+ * `projectRoot`: Project root for relative skill dirs (claude/codex types).
138
+ *
139
+ * When omitted and no `skillManager` is injected, skills are disabled.
140
+ */
141
+ skills?: SmartServerSkillsConfig;
142
+ /** Pre-built skill manager injected via DI. Takes precedence over `skills` config. */
143
+ skillManager?: ISkillManager;
144
+ /** Pre-built MCP clients injected via DI. Takes precedence over `mcp` config. */
145
+ mcpClients?: IMcpClient[];
146
+ /** Client adapters for auto-detecting prompt-based clients (e.g. Cline). */
147
+ clientAdapters?: IClientAdapter[];
148
+ /** Whether to include usage stats in SSE stream. Default: true. */
149
+ reportUsage?: boolean;
150
+ /** API protocol adapters injected via DI. Merged with built-in adapters (openai, anthropic). */
151
+ apiAdapters?: ILlmApiAdapter[];
152
+ /** Disable built-in adapter auto-registration. Default: false. */
153
+ disableBuiltInAdapters?: boolean;
154
+ /** Skip startup model validation (useful for testing). Default: false. */
155
+ skipModelValidation?: boolean;
156
+ /** Model resolver for PUT /v1/config model changes. When not set, model updates are rejected with 400. */
157
+ modelResolver?: IModelResolver;
158
+ /**
159
+ * Nested sub-agents loaded from a top-level `subagents:` YAML block.
160
+ * Each entry is built into a `SmartAgentSubAgent` and registered via
161
+ * `SmartAgentBuilder.withSubAgents(...)`.
162
+ */
163
+ subAgentConfigs?: SmartServerSubAgentConfig[];
164
+ /**
165
+ * Raw coordinator YAML block. Translated to concrete strategy instances by
166
+ * `SmartServer.start()` once the parent LLMs are built.
167
+ */
168
+ coordinatorYaml?: import('./config.js').YamlCoordinator;
169
+ /**
170
+ * Per-session lifecycle tuning. Defaults: idleTtlMs=7_200_000 (2h),
171
+ * maxSessions=1000, cookieName='sid'.
172
+ */
173
+ session?: {
174
+ idleTtlMs?: number;
175
+ maxSessions?: number;
176
+ cookieName?: string;
177
+ };
178
+ }
179
+ /**
180
+ * A nested sub-agent declared via the top-level `subagents:` YAML block.
181
+ * The `config` field is the resolved `SmartServerConfig` for the sub-agent
182
+ * (without `subagents:` of its own — nested orchestration is not supported).
183
+ */
184
+ export interface SmartServerSubAgentConfig {
185
+ name: string;
186
+ /**
187
+ * Human-readable capability description. Surfaced to the Coordinator's
188
+ * planner LLM so it can pick the right subagent per step. Optional, but
189
+ * highly recommended — without it the planner sees `(no description)` and
190
+ * routes by name alone.
191
+ */
192
+ description?: string;
193
+ config: Omit<SmartServerConfig, 'log'>;
194
+ }
195
+ export interface SmartServerHandle {
196
+ port: number;
197
+ close(): Promise<void>;
198
+ requestLogger: IRequestLogger;
199
+ }
200
+ import type { ISessionMetaStore, SessionMetaRow } from './session-meta-store.js';
201
+ export { generateConfigTemplate, loadYamlConfig, type ResolveConfigArgs, resolveCoordinatorActivation, resolveCoordinatorDispatch, resolveCoordinatorPlanning, resolveEnvVars, resolveSmartServerConfig, resolveToolSelectionStrategy, YAML_TEMPLATE, type YamlConfig, } from './config.js';
202
+ /**
203
+ * GLOBAL per-worker heavy clients — built once, injected by reference per
204
+ * session. In addition to LLM/embedder clients, the worker's OWN declared
205
+ * `toolsRag`/`historyRag`/`mcpClients` (if any) are cached here too — the
206
+ * per-session re-wire MUST prefer the worker's own resources over the
207
+ * parent's injected ones, so we build them once and reuse by reference.
208
+ */
209
+ export interface WorkerLlmSet {
210
+ mainLlm: ILlm;
211
+ classifierLlm: ILlm;
212
+ helperLlm?: ILlm;
213
+ embedder?: IEmbedder;
214
+ /** Worker's OWN tools RAG, built from `subCfg.rag` if declared. */
215
+ toolsRag?: IRag;
216
+ /** Worker's OWN history RAG (mirrors flat-rag block, separate instance). */
217
+ historyRag?: IRag;
218
+ /**
219
+ * Worker's OWN MCP clients (from `subCfg.mcpClients` DI or built once from
220
+ * `subCfg.mcp`). Undefined means the worker did not declare any — caller
221
+ * may fall back to the parent's injected clients.
222
+ */
223
+ mcpClients?: IMcpClient[];
224
+ /**
225
+ * Shutdown function returned by the builder's `SmartAgentHandle.close()`
226
+ * for this worker (Fix #21). Disconnects MCP clients (and any other
227
+ * builder-owned resources) registered to this worker. Captured by
228
+ * `backfillWorkerCacheFromHandle` so `_drainWorkerCache()` can call it on
229
+ * config-reload (PUT /v1/config + hot-reload) and on server shutdown —
230
+ * without this, the per-worker handle is discarded by `buildSubAgent` and
231
+ * lazy rebuilds (Fix #18) accumulate MCP connections with no close path.
232
+ */
233
+ close?: () => Promise<void>;
234
+ }
235
+ /**
236
+ * Drain every cached worker's `close` (if any), then clear the cache map.
237
+ * Used by config-reload (PUT /v1/config + hot-reload — Fix #14/18/21) and by
238
+ * server `close()` to release per-worker MCP connections that were attached
239
+ * to the discarded `SmartAgentHandle`s.
240
+ *
241
+ * IMPORTANT — in-flight caveat: this aborts any request that is mid-call on
242
+ * a worker's MCP client. That is acceptable for an admin action (config
243
+ * reload, server shutdown) where the alternative is leaking connections.
244
+ * Server `close()` calls this AFTER `lifecycle.disposeAll()` so per-session
245
+ * graphs that reference worker clients are torn down first.
246
+ *
247
+ * Uses `Promise.allSettled` so one failing close cannot block the others.
248
+ */
249
+ export declare function drainWorkerCache(cache: Map<string, WorkerLlmSet>): Promise<void>;
250
+ /**
251
+ * Build-once-per-worker resolver. The first time a worker name is seen, it
252
+ * constructs the worker's main/classifier/(optional helper) LLM + embedder and
253
+ * caches the set; every later call (e.g. each per-session worker re-wire)
254
+ * returns the SAME set by reference — never reconstructing LLM clients
255
+ * (locked invariant: LLM/embedder clients are global, built once).
256
+ *
257
+ * Accepts optional `makeToolsRag`/`makeHistoryRag`/`makeMcpClients` factories;
258
+ * when provided, the resolver builds them ONCE on the first miss and caches
259
+ * them on the returned set. Subsequent calls return the cached resources by
260
+ * reference — never re-vectorizing or re-connecting MCP.
261
+ */
262
+ export declare function resolveWorkerLlmSet(input: {
263
+ name: string;
264
+ cache: Map<string, WorkerLlmSet>;
265
+ makeMain: () => Promise<ILlm>;
266
+ makeClassifier: () => Promise<ILlm>;
267
+ makeHelper?: () => Promise<ILlm>;
268
+ makeEmbedder?: () => Promise<IEmbedder>;
269
+ makeToolsRag?: () => Promise<IRag>;
270
+ makeHistoryRag?: () => Promise<IRag>;
271
+ makeMcpClients?: () => Promise<IMcpClient[]>;
272
+ }): Promise<WorkerLlmSet>;
273
+ /**
274
+ * Backfill the per-worker cache entry from the BUILT handle (review HIGH #7).
275
+ *
276
+ * The primary `buildSubAgent` populates `cached.mcpClients`/`toolsRag`/
277
+ * `historyRag` only when the worker config provided DI factories. Workers
278
+ * configured with `subCfg.mcp: ...` (regular config that triggers the
279
+ * builder's own auto-connect) or with `subCfg.rag: ...` whose RAG is owned
280
+ * by the builder leave those slots empty — so per-session re-wires would
281
+ * fall back to the PARENT's MCP/RAG, losing the worker's own connection.
282
+ *
283
+ * After the builder finishes, this helper captures what the handle actually
284
+ * holds and stores it BY REFERENCE on the cache entry. Subsequent per-session
285
+ * re-wires read the same slots and find the worker's own resources.
286
+ *
287
+ * Pure helper, mutates `entry` in place. No-op when the corresponding slot
288
+ * is already populated (DI path wins) or when the handle has no resource for
289
+ * that slot (worker simply didn't declare one).
290
+ */
291
+ export declare function backfillWorkerCacheFromHandle(entry: WorkerLlmSet, handle: {
292
+ mcpClients?: IMcpClient[];
293
+ ragRegistry: {
294
+ get(name: string): IRag | undefined;
295
+ };
296
+ close?: () => Promise<void>;
297
+ }): Promise<void>;
298
+ /**
299
+ * Share the parent RAG registry with subagents (per-session worker re-wire).
300
+ * Session/user/global collections written at the top level become visible to
301
+ * workers; the per-call scope filter (`rag-query.ts`) isolates by
302
+ * `ctx.sessionId` / `ctx.options.userId`. A worker's own declared store is
303
+ * registered INTO this same registry under its namespace. When the parent
304
+ * registry is undefined (no top-level registry yet — e.g. unit test seam),
305
+ * return undefined so the builder allocates its own SimpleRagRegistry.
306
+ */
307
+ export declare function resolveSubAgentRagRegistry(input: {
308
+ parentRagRegistry: IRagRegistry | undefined;
309
+ }): IRagRegistry | undefined;
310
+ /**
311
+ * Options for `buildSessionLifecycle`. Composes the SessionGraphFactory + the
312
+ * SessionRegistry; exposes a thin facade so `_handle` stays unit-testable.
313
+ */
314
+ export interface SessionLifecycleOptions {
315
+ idleTtlMs: number;
316
+ maxSessions: number;
317
+ cookieName: string;
318
+ mcpClients: IMcpClient[];
319
+ toolsRag: IRag | undefined;
320
+ ragRegistry: IRagRegistry;
321
+ buildAgent: (parts: SessionAgentParts) => Promise<SmartAgent | undefined>;
322
+ /** Optional logger forwarded to SessionGraphFactory for cleanup-failure surfacing. */
323
+ logger?: ILogger;
324
+ }
325
+ /**
326
+ * Composes the cookie identity resolver + SessionGraphFactory + SessionRegistry
327
+ * into one lifecycle object the server's `_handle` consumes. The default MCP
328
+ * factory returns the shared GLOBAL clients by reference (one upstream
329
+ * connection); a creds-aware build swaps it out (out of scope here).
330
+ */
331
+ export declare function buildSessionLifecycle(opts: SessionLifecycleOptions): {
332
+ resolve: (cookieHeader: string | undefined, isHttps: boolean) => ReturnType<typeof resolveSessionIdentity>;
333
+ acquire: (sessionId: string) => Promise<ReturnType<SessionRegistry['acquire']> extends Promise<infer G> ? G : never>;
334
+ release: (sessionId: string, graph?: SessionGraph) => void;
335
+ evictIdle: () => Promise<void>;
336
+ disposeAll: () => Promise<void>;
337
+ invalidateAll: () => Promise<void>;
338
+ registry: SessionRegistry;
339
+ };
340
+ export type SessionLifecycle = ReturnType<typeof buildSessionLifecycle>;
341
+ /** Response shape for GET /v1/sessions */
342
+ export interface SessionListBody {
343
+ sessions: SessionMetaRow[];
344
+ }
345
+ /** Response shape for POST /v1/sessions/:id/resume */
346
+ export interface SessionResumeBody {
347
+ ok: boolean;
348
+ session?: SessionMetaRow;
349
+ error?: string;
350
+ }
351
+ /**
352
+ * Seed session-scope guidance entries into a BRAND-NEW session's knowledge-RAG
353
+ * (deployment-supplied tool-usage guidance the planner/executor read in "Known
354
+ * facts"). Idempotent: rehydrates via init() and writes ONLY when the session is
355
+ * empty (`fingerprint() === 'n=0'`), so resumes never duplicate. Entries are
356
+ * config DATA — the runtime stays MCP-agnostic (no tool knowledge in agent code).
357
+ */
358
+ export declare function seedSessionKnowledge(kr: IKnowledgeRagHandle & {
359
+ init?(): Promise<void>;
360
+ fingerprint?(): string;
361
+ }, seeds: ReadonlyArray<{
362
+ content: string;
363
+ artifactType: string;
364
+ }>, nowIso: string): Promise<void>;
365
+ /**
366
+ * Record that a request for `sessionId` STARTED — create the meta row on first
367
+ * sight, else touch it and mark in-progress. Called from the live request path
368
+ * (`_withSession`) so GET /v1/sessions, resume and delete actually see sessions
369
+ * produced by normal chat/stream traffic (review Finding 3). `userIdentity` is
370
+ * the sessionId itself in the default no-auth build — matching how the
371
+ * /v1/sessions endpoints resolve identity (`resolved.identity.sessionId`).
372
+ */
373
+ export declare function recordSessionStart(store: ISessionMetaStore, sessionId: string, nowIso: string): Promise<void>;
374
+ /**
375
+ * Record that a request for `sessionId` FINISHED — touch + mark idle (so it can
376
+ * be resumed). No-op if the row was deleted mid-flight.
377
+ */
378
+ export declare function recordSessionEnd(store: ISessionMetaStore, sessionId: string, nowIso: string): Promise<void>;
379
+ /**
380
+ * List all sessions for a given user identity.
381
+ * Extracted for unit-testability (mirrors the /v1/usage handler pattern).
382
+ */
383
+ export declare function handleListSessions(store: ISessionMetaStore, identity: string): Promise<SessionListBody>;
384
+ /**
385
+ * Resume (claim) a session by ID for a user identity.
386
+ * Sets the session status to 'idle' so it can be re-entered.
387
+ */
388
+ export declare function handleResumeSession(store: ISessionMetaStore, identity: string, id: string): Promise<SessionResumeBody>;
389
+ /**
390
+ * Delete a session by ID for a user identity, and evict its RAG state.
391
+ */
392
+ export declare function handleDeleteSession(store: ISessionMetaStore, identity: string, id: string, evictFn: (sessionId: string) => Promise<void>): Promise<{
393
+ ok: boolean;
394
+ error?: string;
395
+ }>;
396
+ /**
397
+ * Build a `callMcp(name, args, signal?)` bridge over a list of `IMcpClient`s.
398
+ *
399
+ * Dispatch strategy (mirrors the 17.0 tool-loop):
400
+ * - Iterate the clients; the first client whose `listTools()` contains `name` wins.
401
+ * - On success: return the textual content (stringify structured payloads).
402
+ * - On error: return the error message as a string so the LLM executor can
403
+ * feed the failure back to the model as a tool result (no throw).
404
+ * - If no client owns the tool: return an informative "Tool not found" string.
405
+ *
406
+ * Exported for testability — tests can call this with a fake IMcpClient list.
407
+ */
408
+ /**
409
+ * Connect MCP clients from a YAML `mcp:` config block (single or array).
410
+ *
411
+ * Mirrors the builder's connection logic (builder.ts ~lines 897-920) so the
412
+ * Stepper path gets the same clients that the builder would have connected
413
+ * internally. Exported for testability.
414
+ *
415
+ * @param mcpCfg - single `SmartServerMcpConfig` or array thereof (from
416
+ * `pipeline.mcp` or `this.cfg.mcp`). Accepts the union so callers can pass
417
+ * either directly without pre-normalising.
418
+ */
419
+ export declare function connectMcpClientsFromConfig(mcpCfg: SmartServerMcpConfig | SmartServerMcpConfig[] | undefined | null): Promise<IMcpClient[]>;
420
+ export declare function buildMcpBridge(clients: IMcpClient[]): (name: string, args: unknown, signal?: AbortSignal) => Promise<string>;
421
+ /**
422
+ * Returns `true` ONLY when the raw coordinator config has an explicit `mode`
423
+ * string — the opt-in gate for the 18.0 Stepper runtime.
424
+ *
425
+ * IMPORTANT: Do NOT call `parseStepperCoordinatorConfig` to decide — that
426
+ * function defaults `mode` to `'planned-react'`, which would silently route
427
+ * every 17.0 legacy config onto the Stepper path. Gate on the RAW field
428
+ * presence only; parse is done INSIDE the Stepper branch after this check.
429
+ */
430
+ export declare function usesStepper(coordCfg: Record<string, unknown> | undefined): boolean;
431
+ export declare class SmartServer {
432
+ private readonly cfg;
433
+ private readonly noop;
434
+ /**
435
+ * GLOBAL per-worker LLM/embedder cache. Populated lazily by `buildSubAgent`
436
+ * the first time each worker name is seen; subsequent per-session re-wires
437
+ * pull from this cache by reference (never reconstructing LLM clients).
438
+ */
439
+ private readonly _workerLlmCache;
440
+ /** Lifecycle handle wired in `start()`; consumed by `_handle`. */
441
+ private _lifecycle?;
442
+ /** Hoisted globals used by `buildSessionAgent` to re-wire fresh per-session workers. */
443
+ private _mainLlm?;
444
+ private _classifierLlm?;
445
+ private _helperLlm?;
446
+ private _fileLogger?;
447
+ private _mergedEmbedderFactories?;
448
+ /**
449
+ * Captured DAG coordinator template — `deps` are stateless or LLM-bound and
450
+ * are reused across sessions; only `workers` + `stateOracle` are re-wired per
451
+ * session (review HIGH #1).
452
+ */
453
+ private _dagCoordinatorTemplate?;
454
+ /**
455
+ * 18.0 Stepper coordinator handler — stateless, session context comes through
456
+ * `ctx.sessionId` at execute time. Built once in `start()` when
457
+ * `coordinator.mode` is present in the raw config; reused across sessions.
458
+ */
459
+ private _stepperCoordinatorHandler?;
460
+ /**
461
+ * MCP clients connected for the Stepper path from the YAML `mcp:` config
462
+ * block. These are connected ONCE in `start()` (lazily resolved by
463
+ * `connectMcpClientsFromConfig`) and reused across every Stepper request.
464
+ *
465
+ * Populated only when `this.cfg.mcp` / `pipeline.mcp` is set AND no
466
+ * DI/plugin clients exist (DI precedence: `this.cfg.mcpClients` > plugin >
467
+ * yaml). Disposed via the server's `closeFns` on shutdown.
468
+ */
469
+ private _stepperMcpClients?;
470
+ /**
471
+ * The ONE shared knowledge backend for the Stepper path (set during build).
472
+ * Held so DELETE /v1/sessions/:id can evict a session's entries from it —
473
+ * critical for the long-lived in-memory backend, which would otherwise retain
474
+ * knowledge after a delete and rehydrate it on a same-id re-entry.
475
+ */
476
+ private _stepperKnowledgeBackend?;
477
+ /**
478
+ * Session meta-store for /v1/sessions endpoints (Task 17).
479
+ * Defaults to InMemorySessionMetaStore; a durable store can be injected via
480
+ * `cfg.sessionMetaStore` in a future extension.
481
+ */
482
+ private readonly _sessionMetaStore;
483
+ constructor(config: SmartServerConfig);
484
+ start(): Promise<SmartServerHandle>;
485
+ /**
486
+ * Build a `SmartAgent` instance from a nested sub-agent config.
487
+ *
488
+ * Mirrors the parent's composition flow but intentionally narrower:
489
+ * - reuses the parent's merged embedder factories so plugin-provided
490
+ * embedders stay available without a second `pluginLoader.load()`;
491
+ * - shares the parent's file logger to keep one log stream;
492
+ * - skips features that don't make sense for a nested agent (HTTP
493
+ * surface, plugin reranker/queryExpander/outputValidator, MCP
494
+ * client DI, custom client adapters, structured pipeline rag.*
495
+ * stores). Only the flat `rag:` block is honoured.
496
+ *
497
+ * Sub-agents do not recurse — `subagents:` inside a sub-YAML is
498
+ * rejected at config-parse time, so `subCfg.subAgentConfigs` is
499
+ * always undefined here.
500
+ */
501
+ private buildSubAgent;
502
+ /**
503
+ * Builds a per-session SmartAgent from injected globals (review HIGH #1 +
504
+ * MEDIUM #3). Re-wires the SubAgent registry + DAG coordinator deps FRESH per
505
+ * session, sharing this session's logger + the global ragRegistry/toolsRag/
506
+ * mcpClients + the CACHED per-worker LLM/embedder (this._workerLlmCache). It
507
+ * NEVER reuses the primary build()'s global `registry`/DAG-deps and NEVER
508
+ * constructs new LLM clients.
509
+ */
510
+ private buildSessionAgent;
511
+ /**
512
+ * Resolve identity (mint cookie when needed), acquire the per-session graph,
513
+ * run `fn` pinned, and release in `finally`. Order in `finally`:
514
+ * 1. drop the per-traceId logger delta (server-owned free, review HIGH #2)
515
+ * 2. release the refcount pin
516
+ */
517
+ private _withSession;
518
+ private _handle;
519
+ private _handleAdapterRequest;
520
+ private _handleChat;
521
+ /** Whitelisted agent config fields allowed via PUT /v1/config. */
522
+ private static readonly AGENT_CONFIG_FIELDS;
523
+ private _handleConfigUpdate;
524
+ }
525
+ //# sourceMappingURL=smart-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-server.d.ts","sourceRoot":"","sources":["../../src/smart-agent/smart-server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,SAAS,EACT,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACd,OAAO,EACP,UAAU,EAEV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EAQd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAIL,KAAK,IAAI,EAIV,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAEV,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,UAAU,EAEX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAgBL,eAAe,EAMhB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,KAAK,EA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