@juspay/neurolink 9.83.0 → 9.84.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/CHANGELOG.md +12 -0
- package/dist/agent/agent.d.ts +104 -0
- package/dist/agent/agent.js +401 -0
- package/dist/agent/agentNetwork.d.ts +87 -0
- package/dist/agent/agentNetwork.js +458 -0
- package/dist/agent/communication/index.d.ts +9 -0
- package/dist/agent/communication/index.js +9 -0
- package/dist/agent/communication/message-bus.d.ts +113 -0
- package/dist/agent/communication/message-bus.js +406 -0
- package/dist/agent/coordination/coordinator.d.ts +83 -0
- package/dist/agent/coordination/coordinator.js +598 -0
- package/dist/agent/coordination/index.d.ts +10 -0
- package/dist/agent/coordination/index.js +10 -0
- package/dist/agent/coordination/task-distributor.d.ts +113 -0
- package/dist/agent/coordination/task-distributor.js +585 -0
- package/dist/agent/index.d.ts +38 -0
- package/dist/agent/index.js +44 -0
- package/dist/agent/orchestration/index.d.ts +10 -0
- package/dist/agent/orchestration/index.js +10 -0
- package/dist/agent/orchestration/orchestrator.d.ts +114 -0
- package/dist/agent/orchestration/orchestrator.js +476 -0
- package/dist/agent/orchestration/topology.d.ts +164 -0
- package/dist/agent/orchestration/topology.js +520 -0
- package/dist/agent/prompts/routingPrompts.d.ts +63 -0
- package/dist/agent/prompts/routingPrompts.js +201 -0
- package/dist/browser/neurolink.min.js +377 -358
- package/dist/cli/commands/agent.d.ts +37 -0
- package/dist/cli/commands/agent.js +718 -0
- package/dist/cli/factories/commandFactory.d.ts +8 -0
- package/dist/cli/factories/commandFactory.js +116 -0
- package/dist/cli/loop/optionsSchema.d.ts +1 -1
- package/dist/cli/parser.js +4 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +19 -0
- package/dist/lib/agent/agent.d.ts +104 -0
- package/dist/lib/agent/agent.js +402 -0
- package/dist/lib/agent/agentNetwork.d.ts +87 -0
- package/dist/lib/agent/agentNetwork.js +459 -0
- package/dist/lib/agent/communication/index.d.ts +9 -0
- package/dist/lib/agent/communication/index.js +10 -0
- package/dist/lib/agent/communication/message-bus.d.ts +113 -0
- package/dist/lib/agent/communication/message-bus.js +407 -0
- package/dist/lib/agent/coordination/coordinator.d.ts +83 -0
- package/dist/lib/agent/coordination/coordinator.js +599 -0
- package/dist/lib/agent/coordination/index.d.ts +10 -0
- package/dist/lib/agent/coordination/index.js +11 -0
- package/dist/lib/agent/coordination/task-distributor.d.ts +113 -0
- package/dist/lib/agent/coordination/task-distributor.js +586 -0
- package/dist/lib/agent/index.d.ts +38 -0
- package/dist/lib/agent/index.js +45 -0
- package/dist/lib/agent/orchestration/index.d.ts +10 -0
- package/dist/lib/agent/orchestration/index.js +11 -0
- package/dist/lib/agent/orchestration/orchestrator.d.ts +114 -0
- package/dist/lib/agent/orchestration/orchestrator.js +477 -0
- package/dist/lib/agent/orchestration/topology.d.ts +164 -0
- package/dist/lib/agent/orchestration/topology.js +521 -0
- package/dist/lib/agent/prompts/routingPrompts.d.ts +63 -0
- package/dist/lib/agent/prompts/routingPrompts.js +202 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.js +19 -0
- package/dist/lib/neurolink.d.ts +129 -0
- package/dist/lib/neurolink.js +276 -0
- package/dist/lib/processors/config/{fileTypes.js → fileExtensions.js} +1 -1
- package/dist/lib/processors/config/index.d.ts +2 -2
- package/dist/lib/processors/config/index.js +2 -2
- package/dist/lib/processors/config/{mimeTypes.js → mimeConstants.js} +1 -1
- package/dist/lib/processors/index.js +8 -0
- package/dist/lib/providers/googleAiStudio.js +3 -3
- package/dist/lib/providers/googleNativeGemini3.d.ts +18 -0
- package/dist/lib/providers/googleNativeGemini3.js +47 -1
- package/dist/lib/providers/googleVertex.js +5 -5
- package/dist/lib/types/agentNetwork.d.ts +1184 -0
- package/dist/lib/types/agentNetwork.js +8 -0
- package/dist/lib/types/cli.d.ts +66 -0
- package/dist/lib/types/generate.d.ts +53 -0
- package/dist/lib/types/index.d.ts +2 -0
- package/dist/lib/types/index.js +3 -0
- package/dist/lib/types/ioProcessor.d.ts +119 -0
- package/dist/lib/types/ioProcessor.js +10 -0
- package/dist/lib/types/stream.d.ts +36 -0
- package/dist/lib/utils/piiDetector.d.ts +24 -0
- package/dist/lib/utils/piiDetector.js +221 -0
- package/dist/lib/utils/responseValidator.d.ts +21 -0
- package/dist/lib/utils/responseValidator.js +354 -0
- package/dist/lib/utils/tripwireEvaluator.d.ts +73 -0
- package/dist/lib/utils/tripwireEvaluator.js +285 -0
- package/dist/neurolink.d.ts +129 -0
- package/dist/neurolink.js +276 -0
- package/dist/processors/config/index.d.ts +2 -2
- package/dist/processors/config/index.js +2 -2
- package/dist/processors/index.js +8 -0
- package/dist/providers/googleAiStudio.js +3 -3
- package/dist/providers/googleNativeGemini3.d.ts +18 -0
- package/dist/providers/googleNativeGemini3.js +47 -1
- package/dist/providers/googleVertex.js +5 -5
- package/dist/types/agentNetwork.d.ts +1184 -0
- package/dist/types/agentNetwork.js +7 -0
- package/dist/types/cli.d.ts +66 -0
- package/dist/types/generate.d.ts +53 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +3 -0
- package/dist/types/ioProcessor.d.ts +119 -0
- package/dist/types/ioProcessor.js +9 -0
- package/dist/types/stream.d.ts +36 -0
- package/dist/utils/piiDetector.d.ts +24 -0
- package/dist/utils/piiDetector.js +220 -0
- package/dist/utils/responseValidator.d.ts +21 -0
- package/dist/utils/responseValidator.js +353 -0
- package/dist/utils/tripwireEvaluator.d.ts +73 -0
- package/dist/utils/tripwireEvaluator.js +284 -0
- package/package.json +1 -1
- /package/dist/lib/processors/config/{fileTypes.d.ts → fileExtensions.d.ts} +0 -0
- /package/dist/lib/processors/config/{mimeTypes.d.ts → mimeConstants.d.ts} +0 -0
- /package/dist/processors/config/{fileTypes.d.ts → fileExtensions.d.ts} +0 -0
- /package/dist/processors/config/{fileTypes.js → fileExtensions.js} +0 -0
- /package/dist/processors/config/{mimeTypes.d.ts → mimeConstants.d.ts} +0 -0
- /package/dist/processors/config/{mimeTypes.js → mimeConstants.js} +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing Prompts for Agent Network
|
|
3
|
+
*
|
|
4
|
+
* These prompts guide the routing agent in selecting the appropriate
|
|
5
|
+
* primitive (agent, workflow, or tool) for a given task.
|
|
6
|
+
*/
|
|
7
|
+
import type { Primitive, AgentRoutingDecision } from "../../types/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* Prompt templates for routing decisions
|
|
10
|
+
*/
|
|
11
|
+
export declare const ROUTING_PROMPTS: {
|
|
12
|
+
/**
|
|
13
|
+
* System instructions for the routing agent
|
|
14
|
+
*/
|
|
15
|
+
SYSTEM_INSTRUCTIONS: string;
|
|
16
|
+
/**
|
|
17
|
+
* Template for task analysis and routing
|
|
18
|
+
*/
|
|
19
|
+
TASK_ROUTING: string;
|
|
20
|
+
/**
|
|
21
|
+
* Template for confidence evaluation
|
|
22
|
+
*/
|
|
23
|
+
CONFIDENCE_EVALUATION: string;
|
|
24
|
+
/**
|
|
25
|
+
* Template for multi-step planning
|
|
26
|
+
*/
|
|
27
|
+
MULTI_STEP_PLANNING: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Build a routing prompt with primitives and task
|
|
31
|
+
*
|
|
32
|
+
* @param task - The task to route
|
|
33
|
+
* @param primitives - Available primitives
|
|
34
|
+
* @param options - Additional options
|
|
35
|
+
* @returns The formatted prompt
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildRoutingPrompt(task: string, primitives: Primitive[], options?: {
|
|
38
|
+
includeAlternatives?: boolean;
|
|
39
|
+
maxPrimitivesToShow?: number;
|
|
40
|
+
}): string;
|
|
41
|
+
/**
|
|
42
|
+
* Parse routing response from LLM
|
|
43
|
+
*
|
|
44
|
+
* @param response - The raw LLM response
|
|
45
|
+
* @returns Parsed routing decision or null if parsing fails
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseRoutingResponse(response: string): Partial<AgentRoutingDecision> | null;
|
|
48
|
+
/**
|
|
49
|
+
* Build confidence evaluation prompt
|
|
50
|
+
*
|
|
51
|
+
* @param primitive - The selected primitive
|
|
52
|
+
* @param task - The task being evaluated
|
|
53
|
+
* @returns The formatted prompt
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildConfidencePrompt(primitive: Primitive, task: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Build multi-step planning prompt
|
|
58
|
+
*
|
|
59
|
+
* @param task - The task to plan
|
|
60
|
+
* @param primitives - Available primitives
|
|
61
|
+
* @returns The formatted prompt
|
|
62
|
+
*/
|
|
63
|
+
export declare function buildMultiStepPlanningPrompt(task: string, primitives: Primitive[]): string;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing Prompts for Agent Network
|
|
3
|
+
*
|
|
4
|
+
* These prompts guide the routing agent in selecting the appropriate
|
|
5
|
+
* primitive (agent, workflow, or tool) for a given task.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Prompt templates for routing decisions
|
|
9
|
+
*/
|
|
10
|
+
export const ROUTING_PROMPTS = {
|
|
11
|
+
/**
|
|
12
|
+
* System instructions for the routing agent
|
|
13
|
+
*/
|
|
14
|
+
SYSTEM_INSTRUCTIONS: `You are a task routing agent responsible for analyzing tasks and selecting the best primitive to handle them.
|
|
15
|
+
|
|
16
|
+
Your role is to:
|
|
17
|
+
1. Analyze the incoming task to understand what needs to be done
|
|
18
|
+
2. Review the available primitives (agents, workflows, tools)
|
|
19
|
+
3. Select the most appropriate primitive based on capabilities
|
|
20
|
+
4. Format the input appropriately for the selected primitive
|
|
21
|
+
5. Provide your reasoning and confidence level
|
|
22
|
+
|
|
23
|
+
Always respond in valid JSON format.`,
|
|
24
|
+
/**
|
|
25
|
+
* Template for task analysis and routing
|
|
26
|
+
*/
|
|
27
|
+
TASK_ROUTING: `Analyze the following task and select the most appropriate primitive to handle it.
|
|
28
|
+
|
|
29
|
+
Available Primitives:
|
|
30
|
+
{{PRIMITIVES}}
|
|
31
|
+
|
|
32
|
+
Task to route:
|
|
33
|
+
{{TASK}}
|
|
34
|
+
|
|
35
|
+
Consider:
|
|
36
|
+
1. The primitive's description and capabilities
|
|
37
|
+
2. The complexity of the task
|
|
38
|
+
3. Required tools or skills
|
|
39
|
+
4. Expected output format
|
|
40
|
+
|
|
41
|
+
Respond in JSON format:
|
|
42
|
+
{
|
|
43
|
+
"selectedPrimitive": {
|
|
44
|
+
"type": "agent" | "workflow" | "tool",
|
|
45
|
+
"id": "<primitive_id>",
|
|
46
|
+
"name": "<primitive_name>"
|
|
47
|
+
},
|
|
48
|
+
"confidence": <0.0-1.0>,
|
|
49
|
+
"reasoning": "<explanation of why this primitive was chosen>",
|
|
50
|
+
"formattedInput": "<the input formatted for the selected primitive>",
|
|
51
|
+
"alternatives": [
|
|
52
|
+
{
|
|
53
|
+
"type": "agent" | "workflow" | "tool",
|
|
54
|
+
"id": "<alternative_id>",
|
|
55
|
+
"confidence": <0.0-1.0>
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}`,
|
|
59
|
+
/**
|
|
60
|
+
* Template for confidence evaluation
|
|
61
|
+
*/
|
|
62
|
+
CONFIDENCE_EVALUATION: `Evaluate the confidence that the selected primitive can successfully complete the task.
|
|
63
|
+
|
|
64
|
+
Selected Primitive:
|
|
65
|
+
- Type: {{PRIMITIVE_TYPE}}
|
|
66
|
+
- Name: {{PRIMITIVE_NAME}}
|
|
67
|
+
- Description: {{PRIMITIVE_DESCRIPTION}}
|
|
68
|
+
|
|
69
|
+
Task: {{TASK}}
|
|
70
|
+
|
|
71
|
+
Rate the confidence from 0.0 to 1.0 based on:
|
|
72
|
+
- How well the primitive's capabilities match the task
|
|
73
|
+
- The specificity of the primitive's description
|
|
74
|
+
- The complexity of the task vs primitive's scope
|
|
75
|
+
- Potential edge cases or limitations`,
|
|
76
|
+
/**
|
|
77
|
+
* Template for multi-step planning
|
|
78
|
+
*/
|
|
79
|
+
MULTI_STEP_PLANNING: `Plan the execution of this complex task that may require multiple primitives.
|
|
80
|
+
|
|
81
|
+
Task: {{TASK}}
|
|
82
|
+
|
|
83
|
+
Available Primitives:
|
|
84
|
+
{{PRIMITIVES}}
|
|
85
|
+
|
|
86
|
+
Create an execution plan with the following structure:
|
|
87
|
+
{
|
|
88
|
+
"isMultiStep": true/false,
|
|
89
|
+
"steps": [
|
|
90
|
+
{
|
|
91
|
+
"stepNumber": 1,
|
|
92
|
+
"primitiveId": "<primitive_id>",
|
|
93
|
+
"description": "<what this step accomplishes>",
|
|
94
|
+
"dependsOn": [<step numbers this depends on>]
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"expectedOutcome": "<description of final result>"
|
|
98
|
+
}`,
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Build a routing prompt with primitives and task
|
|
102
|
+
*
|
|
103
|
+
* @param task - The task to route
|
|
104
|
+
* @param primitives - Available primitives
|
|
105
|
+
* @param options - Additional options
|
|
106
|
+
* @returns The formatted prompt
|
|
107
|
+
*/
|
|
108
|
+
export function buildRoutingPrompt(task, primitives, options) {
|
|
109
|
+
const { includeAlternatives = true, maxPrimitivesToShow = 20 } = options ?? {};
|
|
110
|
+
// Format primitives list
|
|
111
|
+
const primitivesDescription = primitives
|
|
112
|
+
.slice(0, maxPrimitivesToShow)
|
|
113
|
+
.map((p) => {
|
|
114
|
+
const tools = p.type === "agent" && "agent" in p
|
|
115
|
+
? p.agent.tools
|
|
116
|
+
: undefined;
|
|
117
|
+
const toolsInfo = tools && tools.length > 0 ? `\n Tools: ${tools.join(", ")}` : "";
|
|
118
|
+
return `- [${p.type.toUpperCase()}] ${p.id}: ${p.name}\n Description: ${p.description}${toolsInfo}`;
|
|
119
|
+
})
|
|
120
|
+
.join("\n");
|
|
121
|
+
let prompt = ROUTING_PROMPTS.TASK_ROUTING.replace("{{PRIMITIVES}}", primitivesDescription).replace("{{TASK}}", task);
|
|
122
|
+
if (!includeAlternatives) {
|
|
123
|
+
// Remove alternatives section from expected output
|
|
124
|
+
prompt = prompt.replace(`"alternatives": [
|
|
125
|
+
{
|
|
126
|
+
"type": "agent" | "workflow" | "tool",
|
|
127
|
+
"id": "<alternative_id>",
|
|
128
|
+
"confidence": <0.0-1.0>
|
|
129
|
+
}
|
|
130
|
+
]`, "");
|
|
131
|
+
}
|
|
132
|
+
return prompt;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Parse routing response from LLM
|
|
136
|
+
*
|
|
137
|
+
* @param response - The raw LLM response
|
|
138
|
+
* @returns Parsed routing decision or null if parsing fails
|
|
139
|
+
*/
|
|
140
|
+
export function parseRoutingResponse(response) {
|
|
141
|
+
try {
|
|
142
|
+
// Try to extract JSON from the response
|
|
143
|
+
const jsonMatch = response.match(/\{[\s\S]*\}/);
|
|
144
|
+
if (!jsonMatch) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
148
|
+
// Validate required fields
|
|
149
|
+
if (!parsed.selectedPrimitive ||
|
|
150
|
+
!parsed.selectedPrimitive.id ||
|
|
151
|
+
!parsed.selectedPrimitive.type) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
selectedPrimitive: {
|
|
156
|
+
type: parsed.selectedPrimitive.type,
|
|
157
|
+
id: parsed.selectedPrimitive.id,
|
|
158
|
+
name: parsed.selectedPrimitive.name || parsed.selectedPrimitive.id,
|
|
159
|
+
},
|
|
160
|
+
confidence: typeof parsed.confidence === "number" ? parsed.confidence : 0.8,
|
|
161
|
+
reasoning: parsed.reasoning || "No reasoning provided",
|
|
162
|
+
formattedInput: parsed.formattedInput,
|
|
163
|
+
alternatives: Array.isArray(parsed.alternatives)
|
|
164
|
+
? parsed.alternatives.map((alt) => ({
|
|
165
|
+
type: alt.type,
|
|
166
|
+
id: alt.id,
|
|
167
|
+
confidence: typeof alt.confidence === "number" ? alt.confidence : 0.5,
|
|
168
|
+
}))
|
|
169
|
+
: undefined,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Build confidence evaluation prompt
|
|
178
|
+
*
|
|
179
|
+
* @param primitive - The selected primitive
|
|
180
|
+
* @param task - The task being evaluated
|
|
181
|
+
* @returns The formatted prompt
|
|
182
|
+
*/
|
|
183
|
+
export function buildConfidencePrompt(primitive, task) {
|
|
184
|
+
return ROUTING_PROMPTS.CONFIDENCE_EVALUATION.replace("{{PRIMITIVE_TYPE}}", primitive.type)
|
|
185
|
+
.replace("{{PRIMITIVE_NAME}}", primitive.name)
|
|
186
|
+
.replace("{{PRIMITIVE_DESCRIPTION}}", primitive.description)
|
|
187
|
+
.replace("{{TASK}}", task);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Build multi-step planning prompt
|
|
191
|
+
*
|
|
192
|
+
* @param task - The task to plan
|
|
193
|
+
* @param primitives - Available primitives
|
|
194
|
+
* @returns The formatted prompt
|
|
195
|
+
*/
|
|
196
|
+
export function buildMultiStepPlanningPrompt(task, primitives) {
|
|
197
|
+
const primitivesDescription = primitives
|
|
198
|
+
.map((p) => `- [${p.type.toUpperCase()}] ${p.id}: ${p.name} - ${p.description}`)
|
|
199
|
+
.join("\n");
|
|
200
|
+
return ROUTING_PROMPTS.MULTI_STEP_PLANNING.replace("{{TASK}}", task).replace("{{PRIMITIVES}}", primitivesDescription);
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=routingPrompts.js.map
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -424,3 +424,9 @@ export { AgentExecuteRequestSchema, AlreadyRunningError, AuthenticationError, Au
|
|
|
424
424
|
export { assembleContext, batchRerank, CharacterChunker, ChunkerRegistry, CohereRelevanceScorer, CrossEncoderReranker, CSVLoader, chunkText, createChunker, createContextWindow, createHybridSearch, createRAGPipeline, createVectorQueryTool, executeWithCircuitBreaker, extractMetadata, formatContextWithCitations, GraphRAG, getAvailableStrategies, getCircuitBreaker, getDefaultChunkerConfig, getRecommendedStrategy, HTMLChunker, HTMLLoader, InMemoryBM25Index, InMemoryVectorStore, JSONChunker as RAGJSONChunker, JSONLoader, LaTeXChunker, LLMMetadataExtractor, linearCombination, loadDocument, loadDocuments, MarkdownChunker, MarkdownLoader, MDocument, PDFLoader, prepareRAGTool, processDocument, RAGCircuitBreaker, RAGCircuitBreakerManager, RAGPipeline, RAGRetryHandler, RecursiveChunker, ragCircuitBreakerManager, reciprocalRankFusion, rerank, SemanticChunker, SentenceChunker, simpleRerank, summarizeContext, TextLoader, TokenChunker, WebLoader, } from "./rag/index.js";
|
|
425
425
|
export { ContextBuilder } from "./evaluation/contextBuilder.js";
|
|
426
426
|
export { AuthProviderFactory, createAuthProvider, AuthProviderRegistry, AuthError as AuthErrorFactory, AuthErrorCodes, BaseAuthProvider, InMemorySessionStorage, AuthProviderError, createAuthMiddleware as createAuthProviderMiddleware, createRBACMiddleware, createProtectedMiddleware, createExpressAuthMiddleware, createRequestContext, extractToken, AuthMiddlewareError, AuthMiddlewareErrorCodes, UserRateLimiter, MemoryRateLimitStorage, RedisRateLimitStorage, createRateLimitByUserMiddleware, createAuthenticatedRateLimitMiddleware, createRateLimitStorage, SessionManager, MemorySessionStorage, RedisSessionStorage, createSessionStorage, AuthContextHolder, globalAuthContext, getAuthContext, getCurrentUser, getCurrentSession, isAuthenticated, hasRole, hasAnyRole, hasPermission, hasAllPermissions, requireAuth, requireRole, requirePermission, requireUser, runWithAuthContext, createAuthenticatedContext, RequestContext, NEUROLINK_RESOURCE_ID_KEY, NEUROLINK_THREAD_ID_KEY, createAuthValidatorFromProvider, } from "./auth/index.js";
|
|
427
|
+
export { detectAndRedactPII } from "./utils/piiDetector.js";
|
|
428
|
+
export { validateResponse } from "./utils/responseValidator.js";
|
|
429
|
+
export { TripwireEvaluator, createDefaultTripwireEvaluator, commonTripwires, } from "./utils/tripwireEvaluator.js";
|
|
430
|
+
export { Agent } from "./agent/agent.js";
|
|
431
|
+
export { AgentNetwork } from "./agent/agentNetwork.js";
|
|
432
|
+
export { AgentCoordinator, TaskDistributor, MessageBus, NetworkOrchestrator, NetworkTopology, TopologyBuilder, } from "./agent/index.js";
|
package/dist/lib/index.js
CHANGED
|
@@ -707,4 +707,23 @@ AuthContextHolder, globalAuthContext, getAuthContext, getCurrentUser, getCurrent
|
|
|
707
707
|
RequestContext, NEUROLINK_RESOURCE_ID_KEY, NEUROLINK_THREAD_ID_KEY,
|
|
708
708
|
// Server Bridge
|
|
709
709
|
createAuthValidatorFromProvider, } from "./auth/index.js";
|
|
710
|
+
// ============================================================================
|
|
711
|
+
// SAFETY UTILITIES — PII Detection, Response Validation, Tripwires
|
|
712
|
+
// ============================================================================
|
|
713
|
+
export { detectAndRedactPII } from "./utils/piiDetector.js";
|
|
714
|
+
export { validateResponse } from "./utils/responseValidator.js";
|
|
715
|
+
export { TripwireEvaluator, createDefaultTripwireEvaluator, commonTripwires, } from "./utils/tripwireEvaluator.js";
|
|
716
|
+
// ============================================================================
|
|
717
|
+
// Multi-Agent Orchestration exports
|
|
718
|
+
// ============================================================================
|
|
719
|
+
export { Agent } from "./agent/agent.js";
|
|
720
|
+
export { AgentNetwork } from "./agent/agentNetwork.js";
|
|
721
|
+
// Advanced agent orchestration exports
|
|
722
|
+
export {
|
|
723
|
+
// Coordination
|
|
724
|
+
AgentCoordinator, TaskDistributor,
|
|
725
|
+
// Communication
|
|
726
|
+
MessageBus,
|
|
727
|
+
// Orchestration
|
|
728
|
+
NetworkOrchestrator, NetworkTopology, TopologyBuilder, } from "./agent/index.js";
|
|
710
729
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/neurolink.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Enhanced AI provider system with natural MCP tool access.
|
|
6
6
|
* Uses real MCP infrastructure for tool discovery and execution.
|
|
7
7
|
*/
|
|
8
|
+
import type { AgentDefinition, AgentNetworkConfig, NetworkExecutionInput, NetworkExecutionOptions, NetworkExecutionResult, NetworkStreamChunk } from "./types/index.js";
|
|
8
9
|
import type { CompactionConfig, CompactionResult, SpanData, ObservabilityConfig, MetricsSummary, MCPToolAnnotations, TraceView, AuthenticatedContext, AuthProvider, JsonObject, NeuroLinkEvents, TypedEventEmitter, MCPEnhancementsConfig, NeuroLinkAuthConfig, NeurolinkConstructorConfig, ChatMessage, ExternalMCPOperationResult, ExternalMCPServerInstance, ExternalMCPToolInfo, GenerateOptions, GenerateResult, ProviderStatus, TextGenerationOptions, TextGenerationResult, MCPExecutableTool, MCPServerInfo, MCPStatus, StreamOptions, StreamResult, ToolExecutionContext, ToolExecutionSummary, ToolInfo, ToolRegistrationOptions, BatchOperationResult, StreamGenerationEndContext, ToolRoutingServerDescriptor, ToolDedupConfig } from "./types/index.js";
|
|
9
10
|
import { ConversationMemoryManager } from "./core/conversationMemoryManager.js";
|
|
10
11
|
import type { RedisConversationMemoryManager } from "./core/redisConversationMemoryManager.js";
|
|
@@ -2162,6 +2163,134 @@ export declare class NeuroLink {
|
|
|
2162
2163
|
* ```
|
|
2163
2164
|
*/
|
|
2164
2165
|
getEvaluationPreset(presetName: "safety" | "rag" | "quality" | "comprehensive" | "minimal" | "summarization" | "customerSupport" | "codeGeneration"): Promise<import("./types/index.js").PipelineConfig>;
|
|
2166
|
+
/**
|
|
2167
|
+
* Create an Agent instance for multi-agent orchestration.
|
|
2168
|
+
*
|
|
2169
|
+
* Agents are specialized AI entities with defined instructions, tools, and behavior.
|
|
2170
|
+
* They can be composed into networks for complex task orchestration.
|
|
2171
|
+
*
|
|
2172
|
+
* @param definition - Agent definition specifying behavior and capabilities
|
|
2173
|
+
* @returns A new Agent instance
|
|
2174
|
+
*
|
|
2175
|
+
* @example
|
|
2176
|
+
* ```typescript
|
|
2177
|
+
* const researcher = neurolink.createAgent({
|
|
2178
|
+
* id: 'researcher',
|
|
2179
|
+
* name: 'Research Agent',
|
|
2180
|
+
* description: 'Searches and analyzes information from various sources',
|
|
2181
|
+
* instructions: 'You are a research assistant. Search thoroughly and cite sources.',
|
|
2182
|
+
* tools: ['websearchGrounding', 'readFile'],
|
|
2183
|
+
* model: 'gpt-4o'
|
|
2184
|
+
* });
|
|
2185
|
+
*
|
|
2186
|
+
* const result = await researcher.execute('Find recent AI breakthroughs');
|
|
2187
|
+
* ```
|
|
2188
|
+
*
|
|
2189
|
+
* @see {@link AgentDefinition} for definition options
|
|
2190
|
+
* @see {@link Agent} for agent methods
|
|
2191
|
+
* @since 8.38.0
|
|
2192
|
+
*/
|
|
2193
|
+
createAgent(definition: AgentDefinition): Promise<import("./agent/agent.js").Agent>;
|
|
2194
|
+
/**
|
|
2195
|
+
* Create an AgentNetwork for multi-agent orchestration.
|
|
2196
|
+
*
|
|
2197
|
+
* Networks coordinate multiple agents, workflows, and tools with intelligent
|
|
2198
|
+
* LLM-powered routing. The router agent analyzes tasks and delegates to
|
|
2199
|
+
* the most appropriate primitive.
|
|
2200
|
+
*
|
|
2201
|
+
* @param config - Network configuration with agents, workflows, and routing settings
|
|
2202
|
+
* @returns A new AgentNetwork instance
|
|
2203
|
+
*
|
|
2204
|
+
* @example
|
|
2205
|
+
* ```typescript
|
|
2206
|
+
* const network = neurolink.createNetwork({
|
|
2207
|
+
* name: 'Content Team',
|
|
2208
|
+
* description: 'Collaborative content creation pipeline',
|
|
2209
|
+
* agents: [
|
|
2210
|
+
* {
|
|
2211
|
+
* id: 'researcher',
|
|
2212
|
+
* name: 'Researcher',
|
|
2213
|
+
* description: 'Finds and verifies information',
|
|
2214
|
+
* instructions: 'Research topics thoroughly...',
|
|
2215
|
+
* },
|
|
2216
|
+
* {
|
|
2217
|
+
* id: 'writer',
|
|
2218
|
+
* name: 'Writer',
|
|
2219
|
+
* description: 'Creates engaging content',
|
|
2220
|
+
* instructions: 'Write clear, engaging content...',
|
|
2221
|
+
* },
|
|
2222
|
+
* {
|
|
2223
|
+
* id: 'editor',
|
|
2224
|
+
* name: 'Editor',
|
|
2225
|
+
* description: 'Reviews and improves content',
|
|
2226
|
+
* instructions: 'Review for clarity and accuracy...',
|
|
2227
|
+
* }
|
|
2228
|
+
* ],
|
|
2229
|
+
* router: {
|
|
2230
|
+
* model: 'gpt-4o',
|
|
2231
|
+
* confidenceThreshold: 0.7
|
|
2232
|
+
* }
|
|
2233
|
+
* });
|
|
2234
|
+
*
|
|
2235
|
+
* const result = await network.execute({
|
|
2236
|
+
* message: 'Write an article about quantum computing'
|
|
2237
|
+
* });
|
|
2238
|
+
* ```
|
|
2239
|
+
*
|
|
2240
|
+
* @see {@link AgentNetworkConfig} for configuration options
|
|
2241
|
+
* @see {@link AgentNetwork} for network methods
|
|
2242
|
+
* @since 8.38.0
|
|
2243
|
+
*/
|
|
2244
|
+
createNetwork(config: AgentNetworkConfig): Promise<import("./agent/agentNetwork.js").AgentNetwork>;
|
|
2245
|
+
/**
|
|
2246
|
+
* Execute an agent network with the given input.
|
|
2247
|
+
*
|
|
2248
|
+
* @param network - The agent network to execute
|
|
2249
|
+
* @param input - Execution input (message and context)
|
|
2250
|
+
* @param options - Optional execution options
|
|
2251
|
+
* @returns Network execution result with content, trace, and usage
|
|
2252
|
+
*
|
|
2253
|
+
* @see {@link NetworkExecutionInput} for input options
|
|
2254
|
+
* @see {@link NetworkExecutionResult} for result structure
|
|
2255
|
+
* @since 8.38.0
|
|
2256
|
+
*/
|
|
2257
|
+
executeNetwork(network: import("./agent/agentNetwork.js").AgentNetwork, input: NetworkExecutionInput, options?: NetworkExecutionOptions): Promise<NetworkExecutionResult>;
|
|
2258
|
+
/**
|
|
2259
|
+
* Stream agent network execution with real-time events.
|
|
2260
|
+
*
|
|
2261
|
+
* @param network - The agent network to stream
|
|
2262
|
+
* @param input - Execution input (message and context)
|
|
2263
|
+
* @param options - Optional execution options
|
|
2264
|
+
* @returns Async iterable of network stream chunks
|
|
2265
|
+
*
|
|
2266
|
+
* @see {@link NetworkStreamChunk} for chunk types
|
|
2267
|
+
* @since 8.38.0
|
|
2268
|
+
*/
|
|
2269
|
+
streamNetwork(network: import("./agent/agentNetwork.js").AgentNetwork, input: NetworkExecutionInput, options?: NetworkExecutionOptions): AsyncIterable<NetworkStreamChunk>;
|
|
2270
|
+
/**
|
|
2271
|
+
* Create a NetworkOrchestrator for managing multiple agent networks.
|
|
2272
|
+
*
|
|
2273
|
+
* @param config - Orchestrator configuration options
|
|
2274
|
+
* @returns A new NetworkOrchestrator instance
|
|
2275
|
+
* @since 8.38.0
|
|
2276
|
+
*/
|
|
2277
|
+
createOrchestrator(config?: import("./types/index.js").OrchestratorConfig): Promise<import("./agent/orchestration/index.js").NetworkOrchestrator>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Create an AgentCoordinator for managing agent coordination strategies.
|
|
2280
|
+
*
|
|
2281
|
+
* @param config - Coordinator configuration options
|
|
2282
|
+
* @returns A new AgentCoordinator instance
|
|
2283
|
+
* @since 8.38.0
|
|
2284
|
+
*/
|
|
2285
|
+
createCoordinator(config?: import("./types/index.js").CoordinatorConfig): Promise<import("./agent/coordination/index.js").AgentCoordinator>;
|
|
2286
|
+
/**
|
|
2287
|
+
* Create a MessageBus for inter-agent communication.
|
|
2288
|
+
*
|
|
2289
|
+
* @param config - Message bus configuration options
|
|
2290
|
+
* @returns A new MessageBus instance
|
|
2291
|
+
* @since 8.38.0
|
|
2292
|
+
*/
|
|
2293
|
+
createMessageBus(config?: import("./types/index.js").MessageBusConfig): Promise<import("./agent/communication/index.js").MessageBus>;
|
|
2165
2294
|
/**
|
|
2166
2295
|
* Dispose of all resources and cleanup connections
|
|
2167
2296
|
* Call this method when done using the NeuroLink instance to prevent resource leaks
|