@mcp-abap-adt/llm-agent-server-libs 18.1.2 → 19.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.
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/legacy/dag.d.ts +4 -0
- package/dist/legacy/dag.d.ts.map +1 -0
- package/dist/legacy/dag.js +4 -0
- package/dist/legacy/dag.js.map +1 -0
- package/dist/legacy/flat.d.ts +2 -0
- package/dist/legacy/flat.d.ts.map +1 -0
- package/dist/legacy/flat.js +3 -0
- package/dist/legacy/flat.js.map +1 -0
- package/dist/legacy/linear.d.ts +3 -0
- package/dist/legacy/linear.d.ts.map +1 -0
- package/dist/legacy/linear.js +3 -0
- package/dist/legacy/linear.js.map +1 -0
- package/dist/legacy/stepper.d.ts +5 -0
- package/dist/legacy/stepper.d.ts.map +1 -0
- package/dist/legacy/stepper.js +5 -0
- package/dist/legacy/stepper.js.map +1 -0
- package/dist/pipelines/controller.d.ts +19 -0
- package/dist/pipelines/controller.d.ts.map +1 -0
- package/dist/pipelines/controller.js +100 -0
- package/dist/pipelines/controller.js.map +1 -0
- package/dist/pipelines/dag.d.ts +23 -0
- package/dist/pipelines/dag.d.ts.map +1 -0
- package/dist/pipelines/dag.js +46 -0
- package/dist/pipelines/dag.js.map +1 -0
- package/dist/pipelines/flat.d.ts +14 -0
- package/dist/pipelines/flat.d.ts.map +1 -0
- package/dist/pipelines/flat.js +18 -0
- package/dist/pipelines/flat.js.map +1 -0
- package/dist/pipelines/linear.d.ts +17 -0
- package/dist/pipelines/linear.d.ts.map +1 -0
- package/dist/pipelines/linear.js +26 -0
- package/dist/pipelines/linear.js.map +1 -0
- package/dist/pipelines/parsers.d.ts +5 -0
- package/dist/pipelines/parsers.d.ts.map +1 -0
- package/dist/pipelines/parsers.js +20 -0
- package/dist/pipelines/parsers.js.map +1 -0
- package/dist/pipelines/server-context.d.ts +53 -0
- package/dist/pipelines/server-context.d.ts.map +1 -0
- package/dist/pipelines/server-context.js +9 -0
- package/dist/pipelines/server-context.js.map +1 -0
- package/dist/pipelines/stepper.d.ts +23 -0
- package/dist/pipelines/stepper.d.ts.map +1 -0
- package/dist/pipelines/stepper.js +60 -0
- package/dist/pipelines/stepper.js.map +1 -0
- package/dist/smart-agent/config.d.ts +13 -4
- package/dist/smart-agent/config.d.ts.map +1 -1
- package/dist/smart-agent/config.js +137 -228
- package/dist/smart-agent/config.js.map +1 -1
- package/dist/smart-agent/controller/controller-coordinator-handler.d.ts +99 -0
- package/dist/smart-agent/controller/controller-coordinator-handler.d.ts.map +1 -0
- package/dist/smart-agent/controller/controller-coordinator-handler.js +627 -0
- package/dist/smart-agent/controller/controller-coordinator-handler.js.map +1 -0
- package/dist/smart-agent/controller/memorizer.d.ts +6 -0
- package/dist/smart-agent/controller/memorizer.d.ts.map +1 -0
- package/dist/smart-agent/controller/memorizer.js +5 -0
- package/dist/smart-agent/controller/memorizer.js.map +1 -0
- package/dist/smart-agent/controller/need-resolver.d.ts +3 -0
- package/dist/smart-agent/controller/need-resolver.d.ts.map +1 -0
- package/dist/smart-agent/controller/need-resolver.js +4 -0
- package/dist/smart-agent/controller/need-resolver.js.map +1 -0
- package/dist/smart-agent/controller/planner.d.ts +34 -0
- package/dist/smart-agent/controller/planner.d.ts.map +1 -0
- package/dist/smart-agent/controller/planner.js +247 -0
- package/dist/smart-agent/controller/planner.js.map +1 -0
- package/dist/smart-agent/controller/prompts.d.ts +17 -0
- package/dist/smart-agent/controller/prompts.d.ts.map +1 -0
- package/dist/smart-agent/controller/prompts.js +20 -0
- package/dist/smart-agent/controller/prompts.js.map +1 -0
- package/dist/smart-agent/controller/session-bundle.d.ts +15 -0
- package/dist/smart-agent/controller/session-bundle.d.ts.map +1 -0
- package/dist/smart-agent/controller/session-bundle.js +53 -0
- package/dist/smart-agent/controller/session-bundle.js.map +1 -0
- package/dist/smart-agent/controller/subagent-client.d.ts +7 -0
- package/dist/smart-agent/controller/subagent-client.d.ts.map +1 -0
- package/dist/smart-agent/controller/subagent-client.js +18 -0
- package/dist/smart-agent/controller/subagent-client.js.map +1 -0
- package/dist/smart-agent/controller/target-state.d.ts +28 -0
- package/dist/smart-agent/controller/target-state.d.ts.map +1 -0
- package/dist/smart-agent/controller/target-state.js +59 -0
- package/dist/smart-agent/controller/target-state.js.map +1 -0
- package/dist/smart-agent/controller/types.d.ts +121 -0
- package/dist/smart-agent/controller/types.d.ts.map +1 -0
- package/dist/smart-agent/controller/types.js +2 -0
- package/dist/smart-agent/controller/types.js.map +1 -0
- package/dist/smart-agent/resolve-agent-embedder.d.ts.map +1 -1
- package/dist/smart-agent/resolve-agent-embedder.js +8 -2
- package/dist/smart-agent/resolve-agent-embedder.js.map +1 -1
- package/dist/smart-agent/smart-server.d.ts +188 -31
- package/dist/smart-agent/smart-server.d.ts.map +1 -1
- package/dist/smart-agent/smart-server.js +809 -637
- package/dist/smart-agent/smart-server.js.map +1 -1
- package/dist/smart-agent/stepper-coordinator-handler.d.ts.map +1 -1
- package/dist/smart-agent/stepper-coordinator-handler.js +25 -11
- package/dist/smart-agent/stepper-coordinator-handler.js.map +1 -1
- package/package.json +43 -7
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
import { externalToolCallId, } from '@mcp-abap-adt/llm-agent';
|
|
2
|
+
import { summaryToUsage, } from '@mcp-abap-adt/llm-agent-libs';
|
|
3
|
+
import { writeArtifact } from './memorizer.js';
|
|
4
|
+
import { resolveNeed } from './need-resolver.js';
|
|
5
|
+
import { makePlanner } from './planner.js';
|
|
6
|
+
import { appendHint } from './prompts.js';
|
|
7
|
+
import { hydrateBundle, persistBundle } from './session-bundle.js';
|
|
8
|
+
import { establishTargetState } from './target-state.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Debug logging — gated behind DEBUG_CONTROLLER (e.g. DEBUG_CONTROLLER=1).
|
|
11
|
+
// Surfaces the steps the planner delegates and per-role/total token usage to
|
|
12
|
+
// stderr, for tuning step granularity and watching token spend. Off by default.
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
function dlog(msg) {
|
|
15
|
+
if (process.env.DEBUG_CONTROLLER)
|
|
16
|
+
console.error(`[controller] ${msg}`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build a request-time `logUsage(role, usage)` that writes each subagent call
|
|
20
|
+
* into the per-request `IRequestLogger` (the single aggregator), attributing the
|
|
21
|
+
* role's configured model. The role is explicit at the call site, so the shared
|
|
22
|
+
* planner/finalizer client is attributed correctly. `durationMs: 0` — the seam
|
|
23
|
+
* carries no timing (matches the rag-query precedent).
|
|
24
|
+
*/
|
|
25
|
+
export function makeLogUsage(requestLogger, requestId, models) {
|
|
26
|
+
return (role, u) => {
|
|
27
|
+
if (!u)
|
|
28
|
+
return;
|
|
29
|
+
const model = role === 'finalizer'
|
|
30
|
+
? models.planner
|
|
31
|
+
: role === 'embedding'
|
|
32
|
+
? 'embedder'
|
|
33
|
+
: (models[role] ?? 'unknown');
|
|
34
|
+
requestLogger.logLlmCall({
|
|
35
|
+
component: role,
|
|
36
|
+
model,
|
|
37
|
+
promptTokens: u.promptTokens ?? 0,
|
|
38
|
+
completionTokens: u.completionTokens ?? 0,
|
|
39
|
+
totalTokens: u.totalTokens ?? 0,
|
|
40
|
+
durationMs: 0,
|
|
41
|
+
requestId,
|
|
42
|
+
});
|
|
43
|
+
dlog(`tokens ${role}: prompt=${u.promptTokens} completion=${u.completionTokens} total=${u.totalTokens}`);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Handler
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
/**
|
|
50
|
+
* Controller coordinator boundary. Runs a deterministic loop delegating to
|
|
51
|
+
* three opaque subagent roles (evaluator / planner / executor):
|
|
52
|
+
*
|
|
53
|
+
* hydrate bundle → (resume if pending) → establish goal (evaluator) →
|
|
54
|
+
* LOOP[ planner.nextStep →
|
|
55
|
+
* done: finalize | rewind: bump+continue |
|
|
56
|
+
* next: executor.executeStep → route tool calls (internal MCP vs external
|
|
57
|
+
* round-trip) / retry on error / memorize content + advance ] →
|
|
58
|
+
* finalize / escalate.
|
|
59
|
+
*
|
|
60
|
+
* Suspend/resume is stateless: all state lives in the persisted SessionBundle
|
|
61
|
+
* (KnowledgeBackend) + `ctx.externalResults`.
|
|
62
|
+
*
|
|
63
|
+
* Escalation mirrors StepperCoordinatorHandler: a ClarifySignal is NOT thrown
|
|
64
|
+
* upward — it is surfaced to the consumer via `ctx.yield` (a content chunk with
|
|
65
|
+
* the question, then a terminal `finishReason:'stop'` chunk), and `execute`
|
|
66
|
+
* returns true. The pending marker is persisted first so a stateless resume can
|
|
67
|
+
* pick up the human's answer.
|
|
68
|
+
*/
|
|
69
|
+
export class ControllerCoordinatorHandler {
|
|
70
|
+
deps;
|
|
71
|
+
constructor(deps) {
|
|
72
|
+
this.deps = deps;
|
|
73
|
+
}
|
|
74
|
+
async execute(ctx, _config, _span) {
|
|
75
|
+
const deps = this.deps;
|
|
76
|
+
const sessionId = ctx.sessionId;
|
|
77
|
+
const prompt = extractPrompt(ctx.textOrMessages);
|
|
78
|
+
const rag = await deps.knowledgeRagFor(sessionId);
|
|
79
|
+
const bundle = await hydrateBundle(deps.backend, sessionId);
|
|
80
|
+
const meta = synthMeta(ctx, sessionId);
|
|
81
|
+
// Token accounting: every subagent call is logged into the per-request
|
|
82
|
+
// IRequestLogger (the single aggregator). The terminal chunk's usage is read
|
|
83
|
+
// back from getSummary(traceId) — never a private accumulator — so it matches
|
|
84
|
+
// /v1/usage and carries the per-model breakdown.
|
|
85
|
+
const logUsage = makeLogUsage(ctx.requestLogger, meta.traceId, deps.models);
|
|
86
|
+
const usageNow = () => {
|
|
87
|
+
const s = ctx.requestLogger.getSummary(meta.traceId);
|
|
88
|
+
return { ...summaryToUsage(s), models: s.byModel };
|
|
89
|
+
};
|
|
90
|
+
// Route external tools by the PER-REQUEST context (the client-supplied tools
|
|
91
|
+
// for THIS request), OR-combined with the optional test-only override. The
|
|
92
|
+
// build-time server ctx never carries external tools (they arrive per-request
|
|
93
|
+
// via HTTP body.tools → ctx.externalTools), so this is the production truth.
|
|
94
|
+
const externalNames = new Set((ctx.externalTools ?? []).map((t) => t.name));
|
|
95
|
+
const isExternalTool = (name) => externalNames.has(name) || (deps.isExternalTool?.(name) ?? false);
|
|
96
|
+
// True for the first planner.next of a turn that resumed an external-tool
|
|
97
|
+
// result (the result is now in plannerPrivate) → the adaptive planner replans
|
|
98
|
+
// with it rather than blindly re-running the suspended step. Set in the
|
|
99
|
+
// external-tool resume branch below.
|
|
100
|
+
let resumedExternal = false;
|
|
101
|
+
// -- Resume from a persisted pending marker -----------------------------
|
|
102
|
+
if (bundle.pending?.kind === 'external-tool') {
|
|
103
|
+
const { extId, toolName } = bundle.pending;
|
|
104
|
+
const result = ctx.externalResults?.get(extId);
|
|
105
|
+
if (result === undefined) {
|
|
106
|
+
// No result yet → re-surface the same external tool call and suspend.
|
|
107
|
+
this.surfaceToolCall(ctx, {
|
|
108
|
+
id: extId,
|
|
109
|
+
name: toolName,
|
|
110
|
+
arguments: (bundle.pending.args ?? {}),
|
|
111
|
+
}, usageNow());
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
// Tool result arrived — record it and let the loop continue planning.
|
|
115
|
+
await writeArtifact(rag, {
|
|
116
|
+
...meta,
|
|
117
|
+
artifactType: 'mcp-result',
|
|
118
|
+
toolName,
|
|
119
|
+
task: bundle.pending.position,
|
|
120
|
+
content: result,
|
|
121
|
+
});
|
|
122
|
+
bundle.plannerPrivate += `\n[external tool ${toolName} result] ${result}`;
|
|
123
|
+
bundle.pending = undefined;
|
|
124
|
+
resumedExternal = true;
|
|
125
|
+
}
|
|
126
|
+
else if (bundle.pending?.kind === 'clarify') {
|
|
127
|
+
// The incoming prompt is the human's answer to the clarify question.
|
|
128
|
+
// For a goal-confirmation clarify (position 'goal'), commit the goal so we
|
|
129
|
+
// do NOT re-enter the confirm loop (the empty-goal check below would
|
|
130
|
+
// otherwise re-run the evaluator and clarify forever). A plain affirmation
|
|
131
|
+
// ("yes"/"так") confirms the evaluator's PROPOSED target; anything else is
|
|
132
|
+
// treated as a refinement and becomes the goal verbatim.
|
|
133
|
+
if (bundle.pending.position === 'goal') {
|
|
134
|
+
const answer = prompt.trim();
|
|
135
|
+
const proposed = bundle.pending.proposedTarget;
|
|
136
|
+
bundle.goal = proposed && isAffirmation(answer) ? proposed : answer;
|
|
137
|
+
}
|
|
138
|
+
bundle.plannerPrivate += `\n[clarify answer] ${prompt}`;
|
|
139
|
+
bundle.pending = undefined;
|
|
140
|
+
}
|
|
141
|
+
// -- Establish the goal (evaluator) -------------------------------------
|
|
142
|
+
if (!bundle.goal) {
|
|
143
|
+
const outcome = await establishTargetState({ evaluator: deps.evaluator, embedder: deps.embedder }, prompt, deps.config.targetState, ctx.options, deps.config.subagents.evaluator?.hint);
|
|
144
|
+
logUsage('evaluator', outcome.usage);
|
|
145
|
+
if (outcome.kind === 'needs-confirmation') {
|
|
146
|
+
// Persist the proposed target with the pending marker so a confirmation
|
|
147
|
+
// on resume commits IT (not a bare "yes"). See the clarify-resume above.
|
|
148
|
+
bundle.pending = {
|
|
149
|
+
kind: 'clarify',
|
|
150
|
+
question: outcome.question,
|
|
151
|
+
position: 'goal',
|
|
152
|
+
proposedTarget: outcome.proposedTarget,
|
|
153
|
+
};
|
|
154
|
+
await persistBundle(deps.backend, sessionId, bundle);
|
|
155
|
+
this.surfaceClarify(ctx, outcome.question, usageNow());
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
bundle.goal = outcome.goal;
|
|
159
|
+
}
|
|
160
|
+
// -- Main loop ----------------------------------------------------------
|
|
161
|
+
// The planner plans by INTENT — it is NOT shown a tool catalog. A prompt-level
|
|
162
|
+
// catalog (selected once from goal+prompt) was too coarse: it mis-surfaced
|
|
163
|
+
// tools, and the planner baked the wrong tool name into the step instructions,
|
|
164
|
+
// which then poisoned the executor's own per-step selection. Tool relevance is
|
|
165
|
+
// instead resolved PER STEP from the clean step instructions when the step
|
|
166
|
+
// runs (see runStep → selectTools). The agnostic planner prompt already tells
|
|
167
|
+
// it to plan fetch steps ("the executor picks the exact one").
|
|
168
|
+
const cfg = deps.config.budgets;
|
|
169
|
+
let planParseRetries = 0;
|
|
170
|
+
const planner = makePlanner(deps.config.planner ?? 'incremental', deps.planner, deps.config.subagents.planner?.hint);
|
|
171
|
+
// bundle.lastOutcome is the SINGLE source of truth for the last step's
|
|
172
|
+
// outcome — durable, so a resume after a FAILED step replans instead of
|
|
173
|
+
// repeating it. runStep.settle() sets it; the adaptive replan branch clears it
|
|
174
|
+
// once the failure has been consumed into a new plan (so a crash after the
|
|
175
|
+
// replan, or a finalizer retry after an empty replan, does NOT replan again).
|
|
176
|
+
while (bundle.budgets.stepsUsed < cfg.maxSteps) {
|
|
177
|
+
const next = await planner.next({
|
|
178
|
+
bundle,
|
|
179
|
+
prompt,
|
|
180
|
+
lastOutcome: bundle.lastOutcome,
|
|
181
|
+
resumedExternal,
|
|
182
|
+
retrying: planParseRetries > 0,
|
|
183
|
+
logUsage,
|
|
184
|
+
});
|
|
185
|
+
// NB: do NOT reset resumedExternal here — if this replan reply was malformed
|
|
186
|
+
// (next === null), the parse-retry below must keep replanning. It is reset
|
|
187
|
+
// only after a VALID decision (beside planParseRetries = 0;).
|
|
188
|
+
// The adaptive planner mutates bundle.plan/planCursor in next(); persist so
|
|
189
|
+
// a stateless resume continues from the same point. (No-op for incremental.)
|
|
190
|
+
await persistBundle(deps.backend, sessionId, bundle);
|
|
191
|
+
// Format failure (not valid NextStep JSON) → re-ask the planner with a
|
|
192
|
+
// stern reminder, bounded by maxRetries. This does NOT touch rewindsUsed:
|
|
193
|
+
// a malformed reply is a formatting problem, not a decision to backtrack.
|
|
194
|
+
if (next === null) {
|
|
195
|
+
planParseRetries++;
|
|
196
|
+
if (planParseRetries > cfg.maxRetries) {
|
|
197
|
+
return this.escalate(ctx, sessionId, bundle, 'the planner did not return a valid decision — please rephrase or retry', usageNow());
|
|
198
|
+
}
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
planParseRetries = 0;
|
|
202
|
+
resumedExternal = false; // a valid decision consumed any external-resume replan
|
|
203
|
+
if (next.kind === 'done') {
|
|
204
|
+
bundle.pending = undefined;
|
|
205
|
+
await persistBundle(deps.backend, sessionId, bundle);
|
|
206
|
+
this.surfaceFinal(ctx, next.result, usageNow());
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
if (next.kind === 'rewind') {
|
|
210
|
+
bundle.budgets.rewindsUsed++;
|
|
211
|
+
if (bundle.budgets.rewindsUsed > cfg.maxRewinds) {
|
|
212
|
+
return this.escalate(ctx, sessionId, bundle, 'too many rewinds — please confirm how to proceed', usageNow());
|
|
213
|
+
}
|
|
214
|
+
bundle.plannerPrivate += `\n[rewind] ${next.reason}`;
|
|
215
|
+
bundle.lastOutcome = undefined;
|
|
216
|
+
await persistBundle(deps.backend, sessionId, bundle);
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
// next.kind === 'next' → execute the step.
|
|
220
|
+
dlog(`delegate step "${next.step.name}"${next.step.type ? ` (${next.step.type})` : ''}: ${next.step.instructions}`);
|
|
221
|
+
const completed = await this.runStep(ctx, sessionId, bundle, rag, meta, next.step, isExternalTool, logUsage, usageNow, (o) => planner.commit?.(bundle, o));
|
|
222
|
+
if (completed === 'suspended')
|
|
223
|
+
return true;
|
|
224
|
+
// runStep.settle() already persisted the outcome ATOMICALLY (bundle.lastOutcome
|
|
225
|
+
// + cursor advance via onCommit + step result, in one persistBundle). The next
|
|
226
|
+
// planner.next reads the fresh bundle.lastOutcome; a resume continues from the
|
|
227
|
+
// next uncompleted step (or replans, if this step failed).
|
|
228
|
+
}
|
|
229
|
+
// -- Budget exhausted ---------------------------------------------------
|
|
230
|
+
return this.escalate(ctx, sessionId, bundle, 'step budget exhausted — please confirm how to proceed', usageNow());
|
|
231
|
+
}
|
|
232
|
+
// -- Step execution -----------------------------------------------------
|
|
233
|
+
/** Returns 'advanced' (step succeeded — continue loop), 'failed' (retries/
|
|
234
|
+
* tool-call budget exhausted; the failure note is in plannerPrivate so the
|
|
235
|
+
* planner can replan), or 'suspended' (external round-trip surfaced — caller
|
|
236
|
+
* must return true). */
|
|
237
|
+
async runStep(ctx, sessionId, bundle, rag, meta, step, isExternalTool, logUsage, usageNow, onCommit) {
|
|
238
|
+
const deps = this.deps;
|
|
239
|
+
const cfg = deps.config.budgets;
|
|
240
|
+
const maxToolCalls = cfg.maxToolCalls ?? 10;
|
|
241
|
+
let toolCalls = 0;
|
|
242
|
+
// Persist the step outcome ATOMICALLY: record lastOutcome (durable, so a
|
|
243
|
+
// resume after a failed step replans instead of repeating it) AND advance the
|
|
244
|
+
// planner cursor (onCommit) in the SAME persistBundle that records the step
|
|
245
|
+
// result — never in a separate write, so a crash cannot replay a completed step.
|
|
246
|
+
const settle = async (outcome) => {
|
|
247
|
+
bundle.lastOutcome = outcome;
|
|
248
|
+
onCommit?.(outcome);
|
|
249
|
+
await persistBundle(deps.backend, sessionId, bundle);
|
|
250
|
+
return outcome;
|
|
251
|
+
};
|
|
252
|
+
const messages = [
|
|
253
|
+
{
|
|
254
|
+
role: 'system',
|
|
255
|
+
content: appendHint(EXECUTOR_SYSTEM, deps.config.subagents.executor?.hint),
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
role: 'user',
|
|
259
|
+
content: `Goal: ${bundle.goal}\nStep: ${step.name}\nInstructions: ${step.instructions}`,
|
|
260
|
+
},
|
|
261
|
+
];
|
|
262
|
+
// Episodic recall: pull prior artifacts relevant to this step from
|
|
263
|
+
// session-memory and inject them as context. The session-memory rag shares
|
|
264
|
+
// the bundle backend, so restrict to artifact types (excludes the
|
|
265
|
+
// 'controller-bundle' infrastructure record). Bounded by k and length.
|
|
266
|
+
const recallText = step.instructions || step.name;
|
|
267
|
+
const recalled = await resolveNeed(rag, recallText, RECALL_K, {
|
|
268
|
+
artifactType: RECALL_ARTIFACT_TYPES,
|
|
269
|
+
});
|
|
270
|
+
const recallBlock = buildRecallBlock(recalled);
|
|
271
|
+
if (recallBlock) {
|
|
272
|
+
messages.push({ role: 'user', content: recallBlock });
|
|
273
|
+
}
|
|
274
|
+
// Tools offered to the executor = the INTERNAL (MCP) tools semantically
|
|
275
|
+
// relevant to THIS step (top-K from toolsRag) PLUS the per-request external
|
|
276
|
+
// (consumer-supplied) tools. The executor decides which to call; internal
|
|
277
|
+
// calls route through `callMcp`, external calls round-trip via `isExternalTool`.
|
|
278
|
+
const relevant = await deps.selectTools(step.instructions || step.name, TOOL_SELECT_K, ctx.options);
|
|
279
|
+
const offeredTools = [...relevant, ...(ctx.externalTools ?? [])];
|
|
280
|
+
// The executor may ONLY call a tool that was offered to it: an internal tool
|
|
281
|
+
// selected for this step, or a per-request external tool. Any other name
|
|
282
|
+
// (hallucinated / stale / not in the top-K) is rejected — never executed —
|
|
283
|
+
// so the semantic exposure boundary actually bounds what runs.
|
|
284
|
+
const offeredInternalNames = new Set(relevant.map((t) => t.name));
|
|
285
|
+
let retries = 0;
|
|
286
|
+
// Inner loop handles tool routing / error retries until the executor
|
|
287
|
+
// produces content for this step (or the step suspends on an external tool).
|
|
288
|
+
while (true) {
|
|
289
|
+
const res = await deps.executor.send(messages, offeredTools);
|
|
290
|
+
logUsage?.('executor', res.usage);
|
|
291
|
+
if (res.kind === 'content') {
|
|
292
|
+
await writeArtifact(rag, {
|
|
293
|
+
...meta,
|
|
294
|
+
artifactType: 'step-result',
|
|
295
|
+
task: step.name,
|
|
296
|
+
content: res.content,
|
|
297
|
+
});
|
|
298
|
+
bundle.budgets.stepsUsed++;
|
|
299
|
+
bundle.plannerPrivate += `\n[step ${step.name}] ${res.content}`;
|
|
300
|
+
return settle('advanced');
|
|
301
|
+
}
|
|
302
|
+
if (res.kind === 'error') {
|
|
303
|
+
retries++;
|
|
304
|
+
if (retries <= cfg.maxRetries) {
|
|
305
|
+
messages.push({
|
|
306
|
+
role: 'user',
|
|
307
|
+
content: `The previous attempt failed: ${res.error}. Retry the step.`,
|
|
308
|
+
});
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
// Retries exhausted — feed the error back as the step result so the
|
|
312
|
+
// planner can replan on the next iteration.
|
|
313
|
+
bundle.budgets.stepsUsed++;
|
|
314
|
+
bundle.plannerPrivate += `\n[step ${step.name} failed] ${res.error}`;
|
|
315
|
+
return settle('failed');
|
|
316
|
+
}
|
|
317
|
+
// res.kind === 'tool_call' → route the FIRST tool call.
|
|
318
|
+
const firstCall = res.toolCalls[0];
|
|
319
|
+
if (firstCall === undefined) {
|
|
320
|
+
// Empty tool-call array → treat as an executor error (retry/replan).
|
|
321
|
+
retries++;
|
|
322
|
+
if (retries <= cfg.maxRetries) {
|
|
323
|
+
messages.push({
|
|
324
|
+
role: 'user',
|
|
325
|
+
content: 'The previous attempt produced an empty tool call. Retry the step.',
|
|
326
|
+
});
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
bundle.budgets.stepsUsed++;
|
|
330
|
+
bundle.plannerPrivate += `\n[step ${step.name} failed] empty tool call`;
|
|
331
|
+
return settle('failed');
|
|
332
|
+
}
|
|
333
|
+
const call = toLlmToolCall(firstCall);
|
|
334
|
+
const name = call.name;
|
|
335
|
+
const args = call.arguments;
|
|
336
|
+
if (isExternalTool(name)) {
|
|
337
|
+
const extId = externalToolCallId(name, args);
|
|
338
|
+
bundle.pending = {
|
|
339
|
+
kind: 'external-tool',
|
|
340
|
+
extId,
|
|
341
|
+
toolName: name,
|
|
342
|
+
args,
|
|
343
|
+
position: step.name,
|
|
344
|
+
};
|
|
345
|
+
await persistBundle(deps.backend, sessionId, bundle);
|
|
346
|
+
this.surfaceToolCall(ctx, { id: extId, name, arguments: args }, usageNow?.());
|
|
347
|
+
return 'suspended';
|
|
348
|
+
}
|
|
349
|
+
// The executor may only call a tool that was OFFERED to it this step. A
|
|
350
|
+
// name that is neither external nor in the internal top-K (hallucinated /
|
|
351
|
+
// stale / out-of-scope) is rejected — NOT executed — and fed back as a
|
|
352
|
+
// tool-not-available error so the executor retries with an offered tool.
|
|
353
|
+
if (!offeredInternalNames.has(name)) {
|
|
354
|
+
retries++;
|
|
355
|
+
if (retries <= cfg.maxRetries) {
|
|
356
|
+
messages.push({
|
|
357
|
+
role: 'user',
|
|
358
|
+
content: `Tool "${name}" is not available for this step. Use only the tools provided to you.`,
|
|
359
|
+
});
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
bundle.budgets.stepsUsed++;
|
|
363
|
+
bundle.plannerPrivate += `\n[step ${step.name} failed] requested unavailable tool ${name}`;
|
|
364
|
+
return settle('failed');
|
|
365
|
+
}
|
|
366
|
+
// Internal MCP tool — bound the inner loop so a stuck executor cannot
|
|
367
|
+
// spin forever issuing unbounded callMcp iterations.
|
|
368
|
+
toolCalls++;
|
|
369
|
+
if (toolCalls > maxToolCalls) {
|
|
370
|
+
bundle.budgets.stepsUsed++;
|
|
371
|
+
bundle.plannerPrivate += `\n[step ${step.name} aborted] tool-call budget exhausted`;
|
|
372
|
+
return settle('failed');
|
|
373
|
+
}
|
|
374
|
+
// Execute locally, memorize, re-send to the executor.
|
|
375
|
+
const result = await deps.callMcp(name, args);
|
|
376
|
+
await writeArtifact(rag, {
|
|
377
|
+
...meta,
|
|
378
|
+
artifactType: 'mcp-result',
|
|
379
|
+
toolName: name,
|
|
380
|
+
task: step.name,
|
|
381
|
+
content: result,
|
|
382
|
+
});
|
|
383
|
+
// Feed the result back as a coherent assistant→tool turn (OpenAI protocol)
|
|
384
|
+
// so the executor LLM continues from its own tool call rather than seeing a
|
|
385
|
+
// bare user message. The assistant message carries the tool_call it made;
|
|
386
|
+
// the tool message carries the result keyed by the same id.
|
|
387
|
+
messages.push({
|
|
388
|
+
role: 'assistant',
|
|
389
|
+
content: null,
|
|
390
|
+
tool_calls: [
|
|
391
|
+
{
|
|
392
|
+
id: call.id,
|
|
393
|
+
type: 'function',
|
|
394
|
+
function: { name, arguments: JSON.stringify(args) },
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
});
|
|
398
|
+
messages.push({
|
|
399
|
+
role: 'tool',
|
|
400
|
+
tool_call_id: call.id,
|
|
401
|
+
content: result,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
// -- Escalation & surfacing (mirror StepperCoordinatorHandler) ----------
|
|
406
|
+
async escalate(ctx, sessionId, bundle, question, usage) {
|
|
407
|
+
bundle.pending = { kind: 'clarify', question, position: 'loop' };
|
|
408
|
+
await persistBundle(this.deps.backend, sessionId, bundle);
|
|
409
|
+
this.surfaceClarify(ctx, question, usage);
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
surfaceClarify(ctx, question, usage) {
|
|
413
|
+
ctx.yield({
|
|
414
|
+
ok: true,
|
|
415
|
+
value: { content: `To proceed, please provide: ${question}` },
|
|
416
|
+
});
|
|
417
|
+
ctx.yield({
|
|
418
|
+
ok: true,
|
|
419
|
+
value: { content: '', finishReason: 'stop', ...(usage ? { usage } : {}) },
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
surfaceFinal(ctx, content, usage) {
|
|
423
|
+
ctx.yield({
|
|
424
|
+
ok: true,
|
|
425
|
+
value: { content, finishReason: 'stop', ...(usage ? { usage } : {}) },
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
surfaceToolCall(ctx, call, usage) {
|
|
429
|
+
ctx.yield({
|
|
430
|
+
ok: true,
|
|
431
|
+
value: {
|
|
432
|
+
content: '',
|
|
433
|
+
toolCalls: [call],
|
|
434
|
+
finishReason: 'tool_calls',
|
|
435
|
+
...(usage ? { usage } : {}),
|
|
436
|
+
},
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
// ---------------------------------------------------------------------------
|
|
441
|
+
// Episodic recall tuning
|
|
442
|
+
// ---------------------------------------------------------------------------
|
|
443
|
+
/** Bare confirmations that, on a goal clarify, commit the evaluator's proposed
|
|
444
|
+
* target rather than the literal answer. Anything else = a refinement. */
|
|
445
|
+
const AFFIRMATIONS = new Set([
|
|
446
|
+
'yes',
|
|
447
|
+
'y',
|
|
448
|
+
'ok',
|
|
449
|
+
'okay',
|
|
450
|
+
'confirm',
|
|
451
|
+
'confirmed',
|
|
452
|
+
'correct',
|
|
453
|
+
'sure',
|
|
454
|
+
'yep',
|
|
455
|
+
'yeah',
|
|
456
|
+
'так',
|
|
457
|
+
'ок',
|
|
458
|
+
'окей',
|
|
459
|
+
'підтверджую',
|
|
460
|
+
'вірно',
|
|
461
|
+
'да',
|
|
462
|
+
'+',
|
|
463
|
+
]);
|
|
464
|
+
/** True when the answer is a pure confirmation (short affirmative token). */
|
|
465
|
+
function isAffirmation(answer) {
|
|
466
|
+
const t = answer
|
|
467
|
+
.trim()
|
|
468
|
+
.toLowerCase()
|
|
469
|
+
.replace(/[.!]+$/, '');
|
|
470
|
+
return AFFIRMATIONS.has(t);
|
|
471
|
+
}
|
|
472
|
+
/** Top-K tools surfaced from toolsRag per planner/step query. */
|
|
473
|
+
/** Agnostic executor system prompt. Domain specifics (e.g. SAP/ABAP fact kinds)
|
|
474
|
+
* are layered on via `subagents.executor.hint` (see {@link appendHint}). */
|
|
475
|
+
const EXECUTOR_SYSTEM = 'You are the executor. You have tools that read the live target system. ' +
|
|
476
|
+
'You MUST obtain any fact about the system (e.g. its structure, contents, ' +
|
|
477
|
+
'status, or source — any current state) by CALLING the appropriate tool — ' +
|
|
478
|
+
'never answer such facts from prior knowledge or memory. Emit a tool call ' +
|
|
479
|
+
'when you need data; only return the step result as content once you have the ' +
|
|
480
|
+
'tool results. ' +
|
|
481
|
+
'Do EXACTLY what the step asks, at the granularity it asks — do NOT broaden it: ' +
|
|
482
|
+
'if the step asks for a LIST or overview, return the list; do NOT then go and ' +
|
|
483
|
+
'fetch the full details of every listed item unless the step explicitly asks ' +
|
|
484
|
+
'for per-item details.';
|
|
485
|
+
const TOOL_SELECT_K = 20;
|
|
486
|
+
/** Top-k recalled artifacts injected into the executor context per step. */
|
|
487
|
+
const RECALL_K = 5;
|
|
488
|
+
/** Artifact types eligible for recall (excludes the 'controller-bundle' record
|
|
489
|
+
* that shares the same backend). */
|
|
490
|
+
const RECALL_ARTIFACT_TYPES = ['step-result', 'mcp-result'];
|
|
491
|
+
/** Hard cap on the total injected recall length (chars). */
|
|
492
|
+
const RECALL_MAX_CHARS = 4000;
|
|
493
|
+
// ---------------------------------------------------------------------------
|
|
494
|
+
// Pure helpers
|
|
495
|
+
// ---------------------------------------------------------------------------
|
|
496
|
+
/** Build a bounded "Relevant prior context" block from recalled artifacts, or
|
|
497
|
+
* undefined when there is nothing to inject. */
|
|
498
|
+
function buildRecallBlock(hits) {
|
|
499
|
+
if (hits.length === 0)
|
|
500
|
+
return undefined;
|
|
501
|
+
const parts = [];
|
|
502
|
+
let used = 0;
|
|
503
|
+
for (const h of hits) {
|
|
504
|
+
const c = h.content ?? '';
|
|
505
|
+
if (c.length === 0)
|
|
506
|
+
continue;
|
|
507
|
+
if (used + c.length > RECALL_MAX_CHARS) {
|
|
508
|
+
parts.push(c.slice(0, RECALL_MAX_CHARS - used));
|
|
509
|
+
break;
|
|
510
|
+
}
|
|
511
|
+
parts.push(c);
|
|
512
|
+
used += c.length;
|
|
513
|
+
}
|
|
514
|
+
if (parts.length === 0)
|
|
515
|
+
return undefined;
|
|
516
|
+
return `Relevant prior context:\n${parts.join('\n')}`;
|
|
517
|
+
}
|
|
518
|
+
/** Extract the user prompt from the request's textOrMessages. */
|
|
519
|
+
function extractPrompt(textOrMessages) {
|
|
520
|
+
if (typeof textOrMessages === 'string')
|
|
521
|
+
return textOrMessages;
|
|
522
|
+
for (let i = textOrMessages.length - 1; i >= 0; i--) {
|
|
523
|
+
if (textOrMessages[i].role === 'user')
|
|
524
|
+
return textOrMessages[i].content ?? '';
|
|
525
|
+
}
|
|
526
|
+
return '';
|
|
527
|
+
}
|
|
528
|
+
/** Parse a planner content string into a NextStep, defensively. */
|
|
529
|
+
/** Parse the planner's reply into a NextStep, tolerating ```json fences and
|
|
530
|
+
* surrounding prose. Returns null when no valid decision can be extracted — the
|
|
531
|
+
* caller treats that as a FORMAT error (re-ask the planner), NOT a rewind, so a
|
|
532
|
+
* badly-formatted reply never silently burns the rewind budget. */
|
|
533
|
+
export function parseNextStep(content) {
|
|
534
|
+
const json = extractJsonObject(content);
|
|
535
|
+
if (json === null)
|
|
536
|
+
return null;
|
|
537
|
+
try {
|
|
538
|
+
const obj = JSON.parse(json);
|
|
539
|
+
if (obj.kind === 'done' && typeof obj.result === 'string')
|
|
540
|
+
return { kind: 'done', result: obj.result };
|
|
541
|
+
if (obj.kind === 'rewind' && typeof obj.reason === 'string')
|
|
542
|
+
return { kind: 'rewind', reason: obj.reason };
|
|
543
|
+
if (obj.kind === 'next' && obj.step && typeof obj.step.name === 'string')
|
|
544
|
+
return { kind: 'next', step: obj.step };
|
|
545
|
+
}
|
|
546
|
+
catch {
|
|
547
|
+
// fall through
|
|
548
|
+
}
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
/** Extract the first balanced JSON object from a planner reply, ignoring ```json
|
|
552
|
+
* fences and prose around it. String-aware (braces inside strings don't count).
|
|
553
|
+
* Returns null if no balanced object is present. */
|
|
554
|
+
export function extractJsonObject(raw) {
|
|
555
|
+
const fence = raw.match(/```(?:json)?\s*([\s\S]*?)```/i);
|
|
556
|
+
const body = fence ? fence[1] : raw;
|
|
557
|
+
const start = body.indexOf('{');
|
|
558
|
+
if (start < 0)
|
|
559
|
+
return null;
|
|
560
|
+
let depth = 0;
|
|
561
|
+
let inStr = false;
|
|
562
|
+
let esc = false;
|
|
563
|
+
for (let i = start; i < body.length; i++) {
|
|
564
|
+
const ch = body[i];
|
|
565
|
+
if (inStr) {
|
|
566
|
+
if (esc)
|
|
567
|
+
esc = false;
|
|
568
|
+
else if (ch === '\\')
|
|
569
|
+
esc = true;
|
|
570
|
+
else if (ch === '"')
|
|
571
|
+
inStr = false;
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
if (ch === '"')
|
|
575
|
+
inStr = true;
|
|
576
|
+
else if (ch === '{')
|
|
577
|
+
depth++;
|
|
578
|
+
else if (ch === '}') {
|
|
579
|
+
depth--;
|
|
580
|
+
if (depth === 0)
|
|
581
|
+
return body.slice(start, i + 1);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
/** Normalize a StreamToolCall (full or delta) into an LlmToolCall. */
|
|
587
|
+
function toLlmToolCall(c) {
|
|
588
|
+
if ('arguments' in c &&
|
|
589
|
+
typeof c.arguments === 'object' &&
|
|
590
|
+
c.arguments !== null) {
|
|
591
|
+
// Full LlmToolCall: arguments is already a parsed object.
|
|
592
|
+
return {
|
|
593
|
+
id: ('id' in c && c.id) || 'call',
|
|
594
|
+
name: ('name' in c && c.name) || '',
|
|
595
|
+
arguments: c.arguments,
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
// Delta: arguments is a (possibly partial) JSON string.
|
|
599
|
+
let args = {};
|
|
600
|
+
const raw = 'arguments' in c ? c.arguments : undefined;
|
|
601
|
+
if (typeof raw === 'string' && raw.length > 0) {
|
|
602
|
+
try {
|
|
603
|
+
args = JSON.parse(raw);
|
|
604
|
+
}
|
|
605
|
+
catch {
|
|
606
|
+
args = {};
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return {
|
|
610
|
+
id: ('id' in c && c.id) || 'call',
|
|
611
|
+
name: ('name' in c && c.name) || '',
|
|
612
|
+
arguments: args,
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
/** Synthesize the strict KnowledgeEntryMetadata for controller artifacts. */
|
|
616
|
+
function synthMeta(ctx, sessionId) {
|
|
617
|
+
const traceId = ctx.options?.trace?.traceId ?? sessionId;
|
|
618
|
+
return {
|
|
619
|
+
traceId,
|
|
620
|
+
turnId: traceId,
|
|
621
|
+
stepperId: 'controller',
|
|
622
|
+
task: 'controller',
|
|
623
|
+
artifactType: 'step-result',
|
|
624
|
+
createdAt: new Date().toISOString(),
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
//# sourceMappingURL=controller-coordinator-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-coordinator-handler.js","sourceRoot":"","sources":["../../../src/smart-agent/controller/controller-coordinator-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,GAanB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAQzD,8EAA8E;AAC9E,2EAA2E;AAC3E,6EAA6E;AAC7E,gFAAgF;AAChF,8EAA8E;AAE9E,SAAS,IAAI,CAAC,GAAW;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAAE,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;AACzE,CAAC;AAOD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,aAA6B,EAC7B,SAA6B,EAC7B,MAAgE;IAEhE,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACjB,IAAI,CAAC,CAAC;YAAE,OAAO;QACf,MAAM,KAAK,GAC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