@viyrockan/fedlearn-orchestrator
v0.1.1
Published
Guaranteed per-turn orchestration wrapper for FedLearn MCP tool flow
Readme
@viyrockan/fedlearn-orchestrator
Guaranteed per-turn orchestration wrapper for FedLearn MCP flow.
It enforces:
pre_turnget_personalization_context- model response generation
learn_from_turn
Use this package when host clients may skip MCP tools in best-effort mode.
API
runTurn({ userId, conversationId, userInput, modelAdapter, mcp, turnId? })- Adapters:
createCursorAdapter(...)createClaudeDesktopAdapter(...)createAntiGravityAdapter(...)
Reliability guards
- Retries MCP stage calls once by default (
maxRetries=1). - Includes
turnIdidempotency field for retry-safelearn_from_turn. - Emits structured per-stage logs via
onLog:flowStagesuccesslatencyMsretries
Guaranteed local chat (recommended when Cursor skips tools)
createGuaranteedLocalRunner(userId) runs learn + apply every turn using fedlearn-core LocalAdapter only (no MCP). Use the same --user-id and working directory (or FEDLEARN_LOCAL_STORE) as @viyrockan/fedlearn-ui so the terminal panel updates immediately.
After npm run build:
node bin/fedlearn-guaranteed-chat.mjs --user-id check-fiveOne line:
node bin/fedlearn-guaranteed-chat.mjs --user-id check-five --once hello worldProgrammatic:
import { createGuaranteedLocalRunner } from "@viyrockan/fedlearn-orchestrator";
const runner = await createGuaranteedLocalRunner("check-five");
const out = await runner.runTurn({ userInput: "plan my day" });
// out.reply defaults to `[fedlearn-local-echo] plan my day` unless you pass `reply:`