@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
72 lines (71 loc) • 2.82 kB
TypeScript
/**
* Research worker — orchestrates the full experiment loop.
*
* Wires tools, state, policy, and NeuroLink generate() into a
* single experiment cycle. Can run standalone or via TaskManager.
*
* Emits autoresearch:* lifecycle events through an injected emitter
* and wraps key operations in OpenTelemetry spans for observability.
*/
import type { AutoresearchEmitter, ExperimentPhase, ExperimentRecord, PhaseToolPolicy, ResearchConfig, ResearchState } from "../types/index.js";
export declare class ResearchWorker {
private config;
private stateStore;
private repoPolicy;
private runner;
private recorder;
private promptCompiler;
private initialized;
/** Event emitter injected by NeuroLink/TaskManager for lifecycle events. */
private emitter?;
constructor(configInput: Partial<ResearchConfig> & {
repoPath: string;
mutablePaths: string[];
runCommand: string;
metric: ResearchConfig["metric"];
});
/** Set the event emitter (called by NeuroLink/TaskManager during integration). */
setEmitter(emitter: AutoresearchEmitter): void;
/** Emit a lifecycle event. Safe to call when no emitter is set. */
private emit;
/** Initialize: validate config, ensure branch, create state */
initialize(tag: string): Promise<ResearchState>;
/** Load existing state (for resuming) */
resume(): Promise<ResearchState>;
/** Run one full experiment cycle without AI — just the deterministic parts */
runExperimentCycle(description: string): Promise<ExperimentRecord>;
/** Get the tools record for use with NeuroLink.generate() */
getTools(): Record<string, unknown>;
/** Build system prompt */
getSystemPrompt(): Promise<string>;
/** Build cycle prompt */
getCyclePrompt(): Promise<string>;
/** Get current state */
getState(): Promise<ResearchState | null>;
/** Get results stats */
getStats(): Promise<import("../index.js").ExperimentStats>;
/** Get config */
getConfig(): ResearchConfig;
/**
* Single authority for phase transitions.
* Persists the new phase to the state store and emits phase-changed event.
*/
advancePhase(phase: ExperimentPhase): Promise<void>;
/**
* Returns the phase tool policy for the current phase.
* Reads the phase from persisted state.
*/
getPhaseToolPolicy(): Promise<PhaseToolPolicy>;
/**
* Returns a tool filter object for the current phase, compatible
* with NeuroLink generate()'s toolFilter option.
*
* Returns { include: string[] } listing only the tools allowed
* in the current phase.
*/
getToolFilterForCurrentPhase(): Promise<{
include: string[];
}>;
/** Emit an autoresearch:error event. */
private emitError;
}