@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
|
@@ -105,6 +105,14 @@ export declare class CLICommandFactory {
|
|
|
105
105
|
* Create discover command
|
|
106
106
|
*/
|
|
107
107
|
static createDiscoverCommand(): CommandModule;
|
|
108
|
+
/**
|
|
109
|
+
* Create agent commands for multi-agent orchestration
|
|
110
|
+
*/
|
|
111
|
+
static createAgentCommands(): CommandModule;
|
|
112
|
+
/**
|
|
113
|
+
* Create network commands for agent network orchestration
|
|
114
|
+
*/
|
|
115
|
+
static createNetworkCommands(): CommandModule;
|
|
108
116
|
/**
|
|
109
117
|
* Create memory commands
|
|
110
118
|
*/
|
|
@@ -27,6 +27,7 @@ import { createStreamAbortHandler } from "../utils/abortHandler.js";
|
|
|
27
27
|
import { formatVideoFileSize, getVideoMetadataSummary, saveVideoToFile, } from "../utils/videoFileUtils.js";
|
|
28
28
|
import { OllamaCommandFactory } from "./ollamaCommandFactory.js";
|
|
29
29
|
import { SageMakerCommandFactory } from "./sagemakerCommandFactory.js";
|
|
30
|
+
import { AgentCommandFactory } from "../commands/agent.js";
|
|
30
31
|
/**
|
|
31
32
|
* CLI Command Factory for generate commands
|
|
32
33
|
*/
|
|
@@ -663,6 +664,53 @@ export class CLICommandFactory {
|
|
|
663
664
|
alias: "rag-top-k",
|
|
664
665
|
default: 5,
|
|
665
666
|
},
|
|
667
|
+
// Safety — PII detection
|
|
668
|
+
piiRedact: {
|
|
669
|
+
type: "boolean",
|
|
670
|
+
description: "Enable PII detection and redaction on input before sending to LLM",
|
|
671
|
+
alias: "pii-redact",
|
|
672
|
+
default: false,
|
|
673
|
+
},
|
|
674
|
+
piiTypes: {
|
|
675
|
+
type: "string",
|
|
676
|
+
description: "Comma-separated PII types to detect (email,phone,ssn,creditCard,ipAddress,address,name,dateOfBirth,passport,driversLicense)",
|
|
677
|
+
alias: "pii-types",
|
|
678
|
+
},
|
|
679
|
+
piiAction: {
|
|
680
|
+
type: "string",
|
|
681
|
+
description: "Action when PII is found: redact, abort, or warn",
|
|
682
|
+
alias: "pii-action",
|
|
683
|
+
default: "redact",
|
|
684
|
+
},
|
|
685
|
+
// Safety — Input validation
|
|
686
|
+
inputMaxLength: {
|
|
687
|
+
type: "number",
|
|
688
|
+
description: "Maximum input text length (characters)",
|
|
689
|
+
alias: "input-max-length",
|
|
690
|
+
},
|
|
691
|
+
trimWhitespace: {
|
|
692
|
+
type: "boolean",
|
|
693
|
+
description: "Trim whitespace from input text",
|
|
694
|
+
alias: "trim-whitespace",
|
|
695
|
+
default: false,
|
|
696
|
+
},
|
|
697
|
+
requireContent: {
|
|
698
|
+
type: "boolean",
|
|
699
|
+
description: "Abort if input text is empty or whitespace",
|
|
700
|
+
alias: "require-content",
|
|
701
|
+
default: false,
|
|
702
|
+
},
|
|
703
|
+
// Safety — Response validation
|
|
704
|
+
outputMaxLength: {
|
|
705
|
+
type: "number",
|
|
706
|
+
description: "Maximum response length (characters). Truncates if exceeded",
|
|
707
|
+
alias: "output-max-length",
|
|
708
|
+
},
|
|
709
|
+
outputMinLength: {
|
|
710
|
+
type: "number",
|
|
711
|
+
description: "Minimum response length (characters)",
|
|
712
|
+
alias: "output-min-length",
|
|
713
|
+
},
|
|
666
714
|
};
|
|
667
715
|
// Helper method to build options for commands
|
|
668
716
|
static buildOptions(yargs, additionalOptions = {}) {
|
|
@@ -1558,6 +1606,18 @@ export class CLICommandFactory {
|
|
|
1558
1606
|
static createDiscoverCommand() {
|
|
1559
1607
|
return MCPCommandFactory.createDiscoverCommand();
|
|
1560
1608
|
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Create agent commands for multi-agent orchestration
|
|
1611
|
+
*/
|
|
1612
|
+
static createAgentCommands() {
|
|
1613
|
+
return AgentCommandFactory.createAgentCommands();
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Create network commands for agent network orchestration
|
|
1617
|
+
*/
|
|
1618
|
+
static createNetworkCommands() {
|
|
1619
|
+
return AgentCommandFactory.createNetworkCommands();
|
|
1620
|
+
}
|
|
1561
1621
|
/**
|
|
1562
1622
|
* Create memory commands
|
|
1563
1623
|
*/
|
|
@@ -2427,6 +2487,34 @@ export class CLICommandFactory {
|
|
|
2427
2487
|
topK: argv.ragTopK,
|
|
2428
2488
|
}
|
|
2429
2489
|
: undefined,
|
|
2490
|
+
// PII detection
|
|
2491
|
+
piiDetection: argv.piiRedact
|
|
2492
|
+
? {
|
|
2493
|
+
enabled: true,
|
|
2494
|
+
action: argv.piiAction ?? "redact",
|
|
2495
|
+
detectTypes: argv.piiTypes
|
|
2496
|
+
? argv.piiTypes
|
|
2497
|
+
.split(",")
|
|
2498
|
+
.map((t) => t.trim())
|
|
2499
|
+
: undefined,
|
|
2500
|
+
}
|
|
2501
|
+
: undefined,
|
|
2502
|
+
// Input validation
|
|
2503
|
+
inputValidation: argv.inputMaxLength || argv.trimWhitespace || argv.requireContent
|
|
2504
|
+
? {
|
|
2505
|
+
maxLength: argv.inputMaxLength,
|
|
2506
|
+
trimWhitespace: argv.trimWhitespace,
|
|
2507
|
+
requireContent: argv.requireContent,
|
|
2508
|
+
}
|
|
2509
|
+
: undefined,
|
|
2510
|
+
// Response validation
|
|
2511
|
+
responseValidation: argv.outputMaxLength || argv.outputMinLength
|
|
2512
|
+
? {
|
|
2513
|
+
maxLength: argv.outputMaxLength,
|
|
2514
|
+
minLength: argv.outputMinLength,
|
|
2515
|
+
truncationAction: "truncate",
|
|
2516
|
+
}
|
|
2517
|
+
: undefined,
|
|
2430
2518
|
// TTS configuration
|
|
2431
2519
|
tts: enhancedOptions.tts
|
|
2432
2520
|
? {
|
|
@@ -2648,6 +2736,34 @@ export class CLICommandFactory {
|
|
|
2648
2736
|
topK: argv.ragTopK,
|
|
2649
2737
|
}
|
|
2650
2738
|
: undefined,
|
|
2739
|
+
// PII detection
|
|
2740
|
+
piiDetection: argv.piiRedact
|
|
2741
|
+
? {
|
|
2742
|
+
enabled: true,
|
|
2743
|
+
action: argv.piiAction ?? "redact",
|
|
2744
|
+
detectTypes: argv.piiTypes
|
|
2745
|
+
? argv.piiTypes
|
|
2746
|
+
.split(",")
|
|
2747
|
+
.map((t) => t.trim())
|
|
2748
|
+
: undefined,
|
|
2749
|
+
}
|
|
2750
|
+
: undefined,
|
|
2751
|
+
// Input validation
|
|
2752
|
+
inputValidation: argv.inputMaxLength || argv.trimWhitespace || argv.requireContent
|
|
2753
|
+
? {
|
|
2754
|
+
maxLength: argv.inputMaxLength,
|
|
2755
|
+
trimWhitespace: argv.trimWhitespace,
|
|
2756
|
+
requireContent: argv.requireContent,
|
|
2757
|
+
}
|
|
2758
|
+
: undefined,
|
|
2759
|
+
// Response validation
|
|
2760
|
+
responseValidation: argv.outputMaxLength || argv.outputMinLength
|
|
2761
|
+
? {
|
|
2762
|
+
maxLength: argv.outputMaxLength,
|
|
2763
|
+
minLength: argv.outputMinLength,
|
|
2764
|
+
truncationAction: "truncate",
|
|
2765
|
+
}
|
|
2766
|
+
: undefined,
|
|
2651
2767
|
// TTS configuration
|
|
2652
2768
|
tts: enhancedOptions.tts
|
|
2653
2769
|
? {
|
|
@@ -4,4 +4,4 @@ import type { OptionSchema, TextGenerationOptions } from "../../lib/types/index.
|
|
|
4
4
|
* This object provides metadata for validation and help text in the CLI loop.
|
|
5
5
|
* It is derived from the main TextGenerationOptions interface to ensure consistency.
|
|
6
6
|
*/
|
|
7
|
-
export declare const textGenerationOptionsSchema: Record<keyof Omit<TextGenerationOptions, "prompt" | "input" | "schema" | "tools" | "context" | "conversationHistory" | "conversationMessages" | "conversationMemoryConfig" | "originalPrompt" | "middleware" | "expectedOutcome" | "evaluationCriteria" | "region" | "csvOptions" | "tts" | "stt" | "thinkingConfig" | "requestId" | "fileRegistry" | "abortSignal" | "toolFilter" | "excludeTools" | "toolChoice" | "prepareStep" | "credentials" | "onFinish" | "onError">, OptionSchema>;
|
|
7
|
+
export declare const textGenerationOptionsSchema: Record<keyof Omit<TextGenerationOptions, "prompt" | "input" | "schema" | "tools" | "context" | "conversationHistory" | "conversationMessages" | "conversationMemoryConfig" | "originalPrompt" | "middleware" | "expectedOutcome" | "evaluationCriteria" | "region" | "csvOptions" | "tts" | "stt" | "thinkingConfig" | "requestId" | "fileRegistry" | "abortSignal" | "toolFilter" | "excludeTools" | "toolChoice" | "prepareStep" | "credentials" | "onFinish" | "onError" | "processors" | "piiDetection" | "responseValidation" | "inputValidation">, OptionSchema>;
|
package/dist/cli/parser.js
CHANGED
|
@@ -173,6 +173,10 @@ export function initializeCliParser() {
|
|
|
173
173
|
.command(CLICommandFactory.createSageMakerCommands())
|
|
174
174
|
// Loop Command - Using CLICommandFactory
|
|
175
175
|
.command(CLICommandFactory.createLoopCommand())
|
|
176
|
+
// Agent Commands - Using CLICommandFactory (Multi-Agent Orchestration)
|
|
177
|
+
.command(CLICommandFactory.createAgentCommands())
|
|
178
|
+
// Network Commands - Using CLICommandFactory (Agent Network Orchestration)
|
|
179
|
+
.command(CLICommandFactory.createNetworkCommands())
|
|
176
180
|
// Setup Commands - Using SetupCommandFactory
|
|
177
181
|
.command(SetupCommandFactory.createSetupCommands())
|
|
178
182
|
// Server Command Group - Using ServerCommandFactory
|
package/dist/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/index.js
CHANGED
|
@@ -707,3 +707,22 @@ 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";
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent - Core agent implementation for NeuroLink
|
|
3
|
+
*
|
|
4
|
+
* An Agent wraps a NeuroLink instance with specialized behavior, instructions,
|
|
5
|
+
* and tool restrictions. Agents can be composed into networks for multi-agent
|
|
6
|
+
* orchestration using the agents-as-tools pattern.
|
|
7
|
+
*/
|
|
8
|
+
import type { z } from "zod";
|
|
9
|
+
import type { NeuroLink } from "../neurolink.js";
|
|
10
|
+
import type { AgentDefinition, AgentExecutionOptions, AgentInput, AgentInstance, AgentResult, AgentStatus, AgentStreamChunk } from "../types/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Agent - Wraps a NeuroLink instance with specialized behavior
|
|
13
|
+
*
|
|
14
|
+
* Features:
|
|
15
|
+
* - Custom instructions and persona
|
|
16
|
+
* - Tool restrictions per agent (via toolFilter on generate/stream)
|
|
17
|
+
* - Input/output schema validation
|
|
18
|
+
* - Streaming support
|
|
19
|
+
* - Execution metrics tracking
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const agent = new Agent({
|
|
24
|
+
* id: 'researcher',
|
|
25
|
+
* name: 'Research Agent',
|
|
26
|
+
* description: 'Searches and analyzes information',
|
|
27
|
+
* instructions: 'You are a research assistant...',
|
|
28
|
+
* tools: ['websearchGrounding', 'readFile'],
|
|
29
|
+
* }, neurolink);
|
|
30
|
+
*
|
|
31
|
+
* const result = await agent.execute('Find information about quantum computing');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class Agent implements AgentInstance {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly description: string;
|
|
38
|
+
readonly instructions: string;
|
|
39
|
+
readonly provider?: string;
|
|
40
|
+
readonly model?: string;
|
|
41
|
+
readonly tools?: string[];
|
|
42
|
+
readonly inputSchema?: z.ZodSchema;
|
|
43
|
+
readonly outputSchema?: z.ZodSchema;
|
|
44
|
+
readonly maxSteps: number;
|
|
45
|
+
readonly temperature: number;
|
|
46
|
+
readonly canDelegate: boolean;
|
|
47
|
+
readonly metadata?: Record<string, unknown>;
|
|
48
|
+
private neurolink;
|
|
49
|
+
private emitter;
|
|
50
|
+
private executionCount;
|
|
51
|
+
private lastExecutionTime?;
|
|
52
|
+
private totalExecutionTime;
|
|
53
|
+
constructor(definition: AgentDefinition, neurolink: NeuroLink);
|
|
54
|
+
/**
|
|
55
|
+
* Execute the agent with given input
|
|
56
|
+
*
|
|
57
|
+
* @param input - Text input or structured data
|
|
58
|
+
* @param options - Execution options
|
|
59
|
+
* @returns Agent result with content and metadata
|
|
60
|
+
*/
|
|
61
|
+
execute(input: AgentInput, options?: AgentExecutionOptions): Promise<AgentResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Stream execution results
|
|
64
|
+
*
|
|
65
|
+
* @param input - Text input or structured data
|
|
66
|
+
* @param options - Execution options
|
|
67
|
+
* @yields Agent stream chunks
|
|
68
|
+
*/
|
|
69
|
+
stream(input: AgentInput, options?: AgentExecutionOptions): AsyncIterable<AgentStreamChunk>;
|
|
70
|
+
/**
|
|
71
|
+
* Get agent status
|
|
72
|
+
*/
|
|
73
|
+
getStatus(): AgentStatus;
|
|
74
|
+
/**
|
|
75
|
+
* Get average execution time
|
|
76
|
+
*/
|
|
77
|
+
getAverageExecutionTime(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Subscribe to agent events
|
|
80
|
+
*/
|
|
81
|
+
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
82
|
+
/**
|
|
83
|
+
* Unsubscribe from agent events
|
|
84
|
+
*/
|
|
85
|
+
off(event: string, handler: (...args: unknown[]) => void): void;
|
|
86
|
+
/**
|
|
87
|
+
* Build prompt from input and context
|
|
88
|
+
*/
|
|
89
|
+
private buildPrompt;
|
|
90
|
+
/**
|
|
91
|
+
* Build generation options for NeuroLink.generate()
|
|
92
|
+
*
|
|
93
|
+
* Uses toolFilter to delegate tool restriction to BaseProvider.applyToolFiltering()
|
|
94
|
+
* rather than pre-filtering tools manually.
|
|
95
|
+
*/
|
|
96
|
+
private buildGenerateOptions;
|
|
97
|
+
/**
|
|
98
|
+
* Build stream options for NeuroLink.stream()
|
|
99
|
+
*
|
|
100
|
+
* Uses toolFilter to delegate tool restriction to BaseProvider.applyToolFiltering()
|
|
101
|
+
* rather than pre-filtering tools manually.
|
|
102
|
+
*/
|
|
103
|
+
private buildStreamOptions;
|
|
104
|
+
}
|