@juspay/neurolink 9.52.0 → 9.54.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/README.md +19 -0
- package/dist/adapters/tts/cartesiaHandler.d.ts +12 -0
- package/dist/adapters/tts/cartesiaHandler.js +130 -0
- package/dist/agent/directTools.d.ts +2 -2
- package/dist/auth/errors.d.ts +1 -1
- package/dist/auth/middleware/AuthMiddleware.d.ts +1 -1
- package/dist/auth/providers/BaseAuthProvider.d.ts +1 -1
- package/dist/autoresearch/config.d.ts +11 -0
- package/dist/autoresearch/config.js +108 -0
- package/dist/autoresearch/errors.d.ts +40 -0
- package/dist/autoresearch/errors.js +20 -0
- package/dist/autoresearch/index.d.ts +23 -0
- package/dist/autoresearch/index.js +34 -0
- package/dist/autoresearch/phasePolicy.d.ts +9 -0
- package/dist/autoresearch/phasePolicy.js +69 -0
- package/dist/autoresearch/promptCompiler.d.ts +15 -0
- package/dist/autoresearch/promptCompiler.js +120 -0
- package/dist/autoresearch/repoPolicy.d.ts +32 -0
- package/dist/autoresearch/repoPolicy.js +128 -0
- package/dist/autoresearch/resultRecorder.d.ts +20 -0
- package/dist/autoresearch/resultRecorder.js +130 -0
- package/dist/autoresearch/runner.d.ts +10 -0
- package/dist/autoresearch/runner.js +102 -0
- package/dist/autoresearch/stateStore.d.ts +12 -0
- package/dist/autoresearch/stateStore.js +163 -0
- package/dist/autoresearch/summaryParser.d.ts +16 -0
- package/dist/autoresearch/summaryParser.js +94 -0
- package/dist/autoresearch/tools.d.ts +257 -0
- package/dist/autoresearch/tools.js +617 -0
- package/dist/autoresearch/worker.d.ts +71 -0
- package/dist/autoresearch/worker.js +417 -0
- package/dist/browser/neurolink.min.js +340 -326
- package/dist/cli/commands/autoresearch.d.ts +41 -0
- package/dist/cli/commands/autoresearch.js +487 -0
- package/dist/cli/commands/config.d.ts +1 -1
- package/dist/cli/commands/task.d.ts +2 -0
- package/dist/cli/commands/task.js +32 -3
- package/dist/cli/commands/voiceServer.d.ts +6 -0
- package/dist/cli/commands/voiceServer.js +17 -0
- package/dist/cli/parser.js +7 -1
- package/dist/core/baseProvider.js +18 -0
- package/dist/evaluation/errors/EvaluationError.d.ts +1 -1
- package/dist/lib/adapters/tts/cartesiaHandler.d.ts +12 -0
- package/dist/lib/adapters/tts/cartesiaHandler.js +131 -0
- package/dist/lib/agent/directTools.d.ts +2 -2
- package/dist/lib/auth/errors.d.ts +1 -1
- package/dist/lib/auth/middleware/AuthMiddleware.d.ts +1 -1
- package/dist/lib/auth/providers/BaseAuthProvider.d.ts +1 -1
- package/dist/lib/autoresearch/config.d.ts +11 -0
- package/dist/lib/autoresearch/config.js +109 -0
- package/dist/lib/autoresearch/errors.d.ts +40 -0
- package/dist/lib/autoresearch/errors.js +21 -0
- package/dist/lib/autoresearch/index.d.ts +23 -0
- package/dist/lib/autoresearch/index.js +35 -0
- package/dist/lib/autoresearch/phasePolicy.d.ts +9 -0
- package/dist/lib/autoresearch/phasePolicy.js +70 -0
- package/dist/lib/autoresearch/promptCompiler.d.ts +15 -0
- package/dist/lib/autoresearch/promptCompiler.js +121 -0
- package/dist/lib/autoresearch/repoPolicy.d.ts +32 -0
- package/dist/lib/autoresearch/repoPolicy.js +129 -0
- package/dist/lib/autoresearch/resultRecorder.d.ts +20 -0
- package/dist/lib/autoresearch/resultRecorder.js +131 -0
- package/dist/lib/autoresearch/runner.d.ts +10 -0
- package/dist/lib/autoresearch/runner.js +103 -0
- package/dist/lib/autoresearch/stateStore.d.ts +12 -0
- package/dist/lib/autoresearch/stateStore.js +164 -0
- package/dist/lib/autoresearch/summaryParser.d.ts +16 -0
- package/dist/lib/autoresearch/summaryParser.js +95 -0
- package/dist/lib/autoresearch/tools.d.ts +257 -0
- package/dist/lib/autoresearch/tools.js +618 -0
- package/dist/lib/autoresearch/worker.d.ts +71 -0
- package/dist/lib/autoresearch/worker.js +418 -0
- package/dist/lib/core/baseProvider.js +18 -0
- package/dist/lib/evaluation/errors/EvaluationError.d.ts +1 -1
- package/dist/lib/files/fileTools.d.ts +1 -1
- package/dist/lib/neurolink.js +22 -2
- package/dist/lib/providers/azureOpenai.d.ts +4 -1
- package/dist/lib/providers/azureOpenai.js +9 -3
- package/dist/lib/providers/litellm.js +2 -2
- package/dist/lib/providers/openRouter.js +2 -2
- package/dist/lib/providers/openaiCompatible.js +3 -1
- package/dist/lib/server/voice/frameBus.d.ts +8 -0
- package/dist/lib/server/voice/frameBus.js +25 -0
- package/dist/lib/server/voice/turnManager.d.ts +15 -0
- package/dist/lib/server/voice/turnManager.js +36 -0
- package/dist/lib/server/voice/types.d.ts +20 -0
- package/dist/lib/server/voice/types.js +2 -0
- package/dist/lib/server/voice/voiceServerApp.d.ts +1 -0
- package/dist/lib/server/voice/voiceServerApp.js +118 -0
- package/dist/lib/server/voice/voiceWebSocketHandler.d.ts +11 -0
- package/dist/lib/server/voice/voiceWebSocketHandler.js +536 -0
- package/dist/lib/tasks/autoresearchTaskExecutor.d.ts +32 -0
- package/dist/lib/tasks/autoresearchTaskExecutor.js +303 -0
- package/dist/lib/tasks/errors.d.ts +3 -1
- package/dist/lib/tasks/errors.js +1 -0
- package/dist/lib/tasks/taskExecutor.d.ts +4 -2
- package/dist/lib/tasks/taskExecutor.js +8 -1
- package/dist/lib/tasks/taskManager.js +27 -3
- package/dist/lib/tasks/tools/taskTools.d.ts +1 -1
- package/dist/lib/telemetry/attributes.d.ts +15 -0
- package/dist/lib/telemetry/attributes.js +16 -0
- package/dist/lib/telemetry/tracers.d.ts +1 -0
- package/dist/lib/telemetry/tracers.js +1 -0
- package/dist/lib/types/autoresearchTypes.d.ts +194 -0
- package/dist/lib/types/autoresearchTypes.js +18 -0
- package/dist/lib/types/common.d.ts +11 -0
- package/dist/lib/types/index.d.ts +16 -14
- package/dist/lib/types/index.js +21 -17
- package/dist/lib/types/taskTypes.d.ts +38 -0
- package/dist/lib/workflow/config.d.ts +3 -3
- package/dist/neurolink.js +22 -2
- package/dist/providers/azureOpenai.d.ts +4 -1
- package/dist/providers/azureOpenai.js +9 -3
- package/dist/providers/litellm.js +2 -2
- package/dist/providers/openRouter.js +2 -2
- package/dist/providers/openaiCompatible.js +3 -1
- package/dist/rag/errors/RAGError.d.ts +1 -1
- package/dist/server/voice/frameBus.d.ts +8 -0
- package/dist/server/voice/frameBus.js +24 -0
- package/dist/server/voice/public/app.js +275 -0
- package/dist/server/voice/public/index.html +18 -0
- package/dist/server/voice/public/pcm-worklet.js +67 -0
- package/dist/server/voice/public/styles.css +102 -0
- package/dist/server/voice/turnManager.d.ts +15 -0
- package/dist/server/voice/turnManager.js +35 -0
- package/dist/server/voice/types.d.ts +20 -0
- package/dist/server/voice/types.js +1 -0
- package/dist/server/voice/voiceServerApp.d.ts +1 -0
- package/dist/server/voice/voiceServerApp.js +117 -0
- package/dist/server/voice/voiceWebSocketHandler.d.ts +11 -0
- package/dist/server/voice/voiceWebSocketHandler.js +535 -0
- package/dist/tasks/autoresearchTaskExecutor.d.ts +32 -0
- package/dist/tasks/autoresearchTaskExecutor.js +302 -0
- package/dist/tasks/errors.d.ts +3 -1
- package/dist/tasks/errors.js +1 -0
- package/dist/tasks/taskExecutor.d.ts +4 -2
- package/dist/tasks/taskExecutor.js +8 -1
- package/dist/tasks/taskManager.js +27 -3
- package/dist/tasks/tools/taskTools.d.ts +1 -1
- package/dist/telemetry/attributes.d.ts +15 -0
- package/dist/telemetry/attributes.js +16 -0
- package/dist/telemetry/tracers.d.ts +1 -0
- package/dist/telemetry/tracers.js +1 -0
- package/dist/types/autoresearchTypes.d.ts +194 -0
- package/dist/types/autoresearchTypes.js +17 -0
- package/dist/types/common.d.ts +11 -0
- package/dist/types/index.d.ts +16 -14
- package/dist/types/index.js +21 -17
- package/dist/types/taskTypes.d.ts +38 -0
- package/package.json +2 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the NeuroLink AutoResearch system.
|
|
3
|
+
*
|
|
4
|
+
* An autonomous experiment loop that proposes code changes, executes
|
|
5
|
+
* experiments, evaluates results against a deterministic metric, and
|
|
6
|
+
* keeps or discards each change — running unattended for hours.
|
|
7
|
+
*/
|
|
8
|
+
import type { ThinkingLevel } from "./configTypes.js";
|
|
9
|
+
export type MetricDirection = "lower" | "higher";
|
|
10
|
+
export type MetricConfig = {
|
|
11
|
+
name: string;
|
|
12
|
+
direction: MetricDirection;
|
|
13
|
+
pattern: string;
|
|
14
|
+
};
|
|
15
|
+
export type MemoryMetricConfig = {
|
|
16
|
+
name: string;
|
|
17
|
+
pattern: string;
|
|
18
|
+
};
|
|
19
|
+
export type ResearchConfig = {
|
|
20
|
+
repoPath: string;
|
|
21
|
+
programPath: string;
|
|
22
|
+
mutablePaths: string[];
|
|
23
|
+
immutablePaths: string[];
|
|
24
|
+
resultsPath: string;
|
|
25
|
+
statePath: string;
|
|
26
|
+
runCommand: string;
|
|
27
|
+
logPath: string;
|
|
28
|
+
metric: MetricConfig;
|
|
29
|
+
memoryMetric?: MemoryMetricConfig;
|
|
30
|
+
timeoutMs: number;
|
|
31
|
+
branchPrefix: string;
|
|
32
|
+
provider?: string;
|
|
33
|
+
model?: string;
|
|
34
|
+
maxExperiments?: number;
|
|
35
|
+
thinkingLevel?: ThinkingLevel;
|
|
36
|
+
};
|
|
37
|
+
export type ExperimentStatus = "keep" | "discard" | "crash" | "timeout";
|
|
38
|
+
export type ExperimentPhase = "bootstrap" | "baseline" | "propose" | "edit" | "commit" | "run" | "evaluate" | "record" | "accept_or_revert";
|
|
39
|
+
export type ResearchState = {
|
|
40
|
+
branch: string;
|
|
41
|
+
acceptedCommit: string | null;
|
|
42
|
+
baselineMetric: number | null;
|
|
43
|
+
bestMetric: number | null;
|
|
44
|
+
candidateCommit: string | null;
|
|
45
|
+
runCount: number;
|
|
46
|
+
keepCount: number;
|
|
47
|
+
lastStatus: ExperimentStatus | null;
|
|
48
|
+
currentPhase: ExperimentPhase;
|
|
49
|
+
tag: string;
|
|
50
|
+
startedAt: string;
|
|
51
|
+
updatedAt: string;
|
|
52
|
+
lastSummary?: ExperimentSummary | null;
|
|
53
|
+
};
|
|
54
|
+
export type ExperimentSummary = {
|
|
55
|
+
crashed: boolean;
|
|
56
|
+
timedOut: boolean;
|
|
57
|
+
metric: number | null;
|
|
58
|
+
memoryValue: number | null;
|
|
59
|
+
trainingSeconds: number | null;
|
|
60
|
+
rawTail: string;
|
|
61
|
+
};
|
|
62
|
+
export type ExperimentRecord = {
|
|
63
|
+
commit: string;
|
|
64
|
+
metric: number | null;
|
|
65
|
+
memoryGb: number | null;
|
|
66
|
+
status: ExperimentStatus;
|
|
67
|
+
description: string;
|
|
68
|
+
timestamp: string;
|
|
69
|
+
};
|
|
70
|
+
export type ExperimentStats = {
|
|
71
|
+
total: number;
|
|
72
|
+
keepCount: number;
|
|
73
|
+
discardCount: number;
|
|
74
|
+
crashCount: number;
|
|
75
|
+
timeoutCount: number;
|
|
76
|
+
keepRate: number;
|
|
77
|
+
bestMetric: number | null;
|
|
78
|
+
bestCommit: string | null;
|
|
79
|
+
};
|
|
80
|
+
export type ResearchWorkerConfig = Omit<Partial<ResearchConfig>, "repoPath" | "mutablePaths" | "runCommand" | "metric"> & {
|
|
81
|
+
repoPath: string;
|
|
82
|
+
mutablePaths: string[];
|
|
83
|
+
runCommand: string;
|
|
84
|
+
metric: MetricConfig;
|
|
85
|
+
};
|
|
86
|
+
export type PhaseToolPolicy = {
|
|
87
|
+
activeTools: string[];
|
|
88
|
+
forcedTool?: string;
|
|
89
|
+
};
|
|
90
|
+
export type AutoresearchInitializedEvent = {
|
|
91
|
+
tag: string;
|
|
92
|
+
branch: string;
|
|
93
|
+
config: {
|
|
94
|
+
repoPath: string;
|
|
95
|
+
runCommand: string;
|
|
96
|
+
metric: MetricConfig;
|
|
97
|
+
timeoutMs: number;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export type AutoresearchResumedEvent = {
|
|
101
|
+
tag: string;
|
|
102
|
+
branch: string;
|
|
103
|
+
runCount: number;
|
|
104
|
+
currentPhase: ExperimentPhase;
|
|
105
|
+
};
|
|
106
|
+
export type AutoresearchPhaseChangedEvent = {
|
|
107
|
+
from: ExperimentPhase;
|
|
108
|
+
to: ExperimentPhase;
|
|
109
|
+
runCount: number;
|
|
110
|
+
tag: string;
|
|
111
|
+
};
|
|
112
|
+
export type AutoresearchExperimentStartedEvent = {
|
|
113
|
+
tag: string;
|
|
114
|
+
runCount: number;
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
export type AutoresearchExperimentCompletedEvent = {
|
|
118
|
+
tag: string;
|
|
119
|
+
runCount: number;
|
|
120
|
+
status: ExperimentStatus;
|
|
121
|
+
metric: number | null;
|
|
122
|
+
commit: string;
|
|
123
|
+
description: string;
|
|
124
|
+
durationMs: number;
|
|
125
|
+
};
|
|
126
|
+
export type AutoresearchMetricImprovedEvent = {
|
|
127
|
+
tag: string;
|
|
128
|
+
previousBest: number | null;
|
|
129
|
+
newBest: number;
|
|
130
|
+
commit: string;
|
|
131
|
+
direction: MetricDirection;
|
|
132
|
+
runCount: number;
|
|
133
|
+
};
|
|
134
|
+
export type AutoresearchRevertEvent = {
|
|
135
|
+
tag: string;
|
|
136
|
+
targetCommit: string;
|
|
137
|
+
reason: ExperimentStatus;
|
|
138
|
+
runCount: number;
|
|
139
|
+
};
|
|
140
|
+
export type AutoresearchRevertFailedEvent = {
|
|
141
|
+
tag: string;
|
|
142
|
+
targetCommit: string;
|
|
143
|
+
error: string;
|
|
144
|
+
runCount: number;
|
|
145
|
+
};
|
|
146
|
+
export type AutoresearchStateUpdatedEvent = {
|
|
147
|
+
tag: string;
|
|
148
|
+
phase: ExperimentPhase;
|
|
149
|
+
runCount: number;
|
|
150
|
+
keepCount: number;
|
|
151
|
+
bestMetric: number | null;
|
|
152
|
+
};
|
|
153
|
+
export type AutoresearchErrorEvent = {
|
|
154
|
+
tag: string;
|
|
155
|
+
error: string;
|
|
156
|
+
code?: string;
|
|
157
|
+
phase?: ExperimentPhase;
|
|
158
|
+
runCount?: number;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Union map of all autoresearch event names to their payload types.
|
|
162
|
+
* Used by TypedEventEmitter consumers for documentation;
|
|
163
|
+
* NeuroLinkEvents uses `unknown` payloads for flexibility.
|
|
164
|
+
*/
|
|
165
|
+
export type AutoresearchEventMap = {
|
|
166
|
+
"autoresearch:initialized": AutoresearchInitializedEvent;
|
|
167
|
+
"autoresearch:resumed": AutoresearchResumedEvent;
|
|
168
|
+
"autoresearch:phase-changed": AutoresearchPhaseChangedEvent;
|
|
169
|
+
"autoresearch:experiment-started": AutoresearchExperimentStartedEvent;
|
|
170
|
+
"autoresearch:experiment-completed": AutoresearchExperimentCompletedEvent;
|
|
171
|
+
"autoresearch:metric-improved": AutoresearchMetricImprovedEvent;
|
|
172
|
+
"autoresearch:revert": AutoresearchRevertEvent;
|
|
173
|
+
"autoresearch:revert-failed": AutoresearchRevertFailedEvent;
|
|
174
|
+
"autoresearch:state-updated": AutoresearchStateUpdatedEvent;
|
|
175
|
+
"autoresearch:error": AutoresearchErrorEvent;
|
|
176
|
+
};
|
|
177
|
+
/** All known autoresearch event names. */
|
|
178
|
+
export type AutoresearchEventName = keyof AutoresearchEventMap;
|
|
179
|
+
/**
|
|
180
|
+
* Minimal emitter interface accepted by autoresearch subsystems.
|
|
181
|
+
* Matches the shape injected by NeuroLink via setEmitter().
|
|
182
|
+
*/
|
|
183
|
+
export type AutoresearchEmitter = {
|
|
184
|
+
emit(event: string, ...args: unknown[]): boolean;
|
|
185
|
+
};
|
|
186
|
+
export declare const AUTORESEARCH_DEFAULTS: {
|
|
187
|
+
readonly programPath: "program.md";
|
|
188
|
+
readonly resultsPath: "results.tsv";
|
|
189
|
+
readonly statePath: ".autoresearch/state.json";
|
|
190
|
+
readonly logPath: "run.log";
|
|
191
|
+
readonly timeoutMs: 600000;
|
|
192
|
+
readonly branchPrefix: "autoresearch/";
|
|
193
|
+
readonly thinkingLevel: ThinkingLevel;
|
|
194
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the NeuroLink AutoResearch system.
|
|
3
|
+
*
|
|
4
|
+
* An autonomous experiment loop that proposes code changes, executes
|
|
5
|
+
* experiments, evaluates results against a deterministic metric, and
|
|
6
|
+
* keeps or discards each change — running unattended for hours.
|
|
7
|
+
*/
|
|
8
|
+
// ── Defaults ─────────────────────────────────────────────
|
|
9
|
+
export const AUTORESEARCH_DEFAULTS = {
|
|
10
|
+
programPath: "program.md",
|
|
11
|
+
resultsPath: "results.tsv",
|
|
12
|
+
statePath: ".autoresearch/state.json",
|
|
13
|
+
logPath: "run.log",
|
|
14
|
+
timeoutMs: 600_000,
|
|
15
|
+
branchPrefix: "autoresearch/",
|
|
16
|
+
thinkingLevel: "medium",
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=autoresearchTypes.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Common utility types for NeuroLink
|
|
3
3
|
*/
|
|
4
|
+
import type { AutoresearchErrorEvent, AutoresearchExperimentCompletedEvent, AutoresearchExperimentStartedEvent, AutoresearchInitializedEvent, AutoresearchMetricImprovedEvent, AutoresearchPhaseChangedEvent, AutoresearchResumedEvent, AutoresearchRevertEvent, AutoresearchRevertFailedEvent, AutoresearchStateUpdatedEvent } from "./autoresearchTypes.js";
|
|
4
5
|
/**
|
|
5
6
|
* Type-safe unknown value - use when type is truly unknown
|
|
6
7
|
*/
|
|
@@ -115,6 +116,16 @@ export type NeuroLinkEvents = {
|
|
|
115
116
|
error: unknown;
|
|
116
117
|
log: unknown;
|
|
117
118
|
"log-event": unknown;
|
|
119
|
+
"autoresearch:initialized": AutoresearchInitializedEvent;
|
|
120
|
+
"autoresearch:resumed": AutoresearchResumedEvent;
|
|
121
|
+
"autoresearch:phase-changed": AutoresearchPhaseChangedEvent;
|
|
122
|
+
"autoresearch:experiment-started": AutoresearchExperimentStartedEvent;
|
|
123
|
+
"autoresearch:experiment-completed": AutoresearchExperimentCompletedEvent;
|
|
124
|
+
"autoresearch:metric-improved": AutoresearchMetricImprovedEvent;
|
|
125
|
+
"autoresearch:revert": AutoresearchRevertEvent;
|
|
126
|
+
"autoresearch:revert-failed": AutoresearchRevertFailedEvent;
|
|
127
|
+
"autoresearch:state-updated": AutoresearchStateUpdatedEvent;
|
|
128
|
+
"autoresearch:error": AutoresearchErrorEvent;
|
|
118
129
|
[key: string]: unknown;
|
|
119
130
|
};
|
|
120
131
|
/**
|
|
@@ -19,35 +19,37 @@ export { PROCESSOR_PRIORITIES } from "../processors/base/types.js";
|
|
|
19
19
|
export type { ActionAWSConfig, ActionCommentResult, ActionEvaluation, ActionExecutionResult, ActionGoogleCloudConfig, ActionInputs, ActionInputValidation, ActionMultimodalInputs, ActionOutput, ActionProviderKeys, ActionThinkingConfig, ActionTokenUsage, CliAnalytics, CliEvaluation, CliResponse, CliTokenUsage, ProviderKeyMapping, } from "./actionTypes.js";
|
|
20
20
|
export type { AnalyticsData, AnalyticsErrorInfo, PerformanceMetrics, StreamAnalyticsData, TokenUsage, } from "./analytics.js";
|
|
21
21
|
export * from "./multimodal.js";
|
|
22
|
+
export type { Auth0Config, AuthCacheConfig, AuthErrorCode, AuthErrorInfo, AuthErrorInfo as AuthErrorType, AuthEventData, AuthEventHandler, AuthEvents, AuthEventType, AuthenticatedContext, AuthHealthCheck, AuthLifecycle, AuthMiddlewareConfig, AuthMiddlewareOptions, AuthorizationResult, AuthProviderConfig, AuthProviderFactoryFn, AuthProviderHealthCheck, AuthProviderHealthStatus, AuthProviderMetadata, AuthProviderRegistration, AuthProviderType, AuthRequestContext, AuthRequestHandler, AuthSession, AuthSessionManager, AuthTokenValidator, AuthUser, AuthUserAuthorizer, AuthUserManager, BaseAuthProviderConfig, BetterAuthConfig, ClerkConfig, CognitoConfig, CustomAuthConfig, FirebaseConfig, JWK, JWKS, JWTConfig, KeycloakConfig, MastraAuthProvider, OAuth2Config, PermissionDefinition, RBACConfig, RBACMiddlewareConfig, SessionConfig, SessionStorage, SessionStorageType, SessionValidationResult, SupabaseConfig, TokenClaims, TokenExtractionConfig, TokenExtractionStrategy, TokenRefreshResult, TokenType, TokenValidationConfig, TokenValidationResult as AuthTokenValidationResult, WorkOSConfig, } from "./authTypes.js";
|
|
23
|
+
export type { AutoresearchEmitter, AutoresearchErrorEvent, AutoresearchEventMap, AutoresearchEventName, AutoresearchExperimentCompletedEvent, AutoresearchExperimentStartedEvent, AutoresearchInitializedEvent, AutoresearchMetricImprovedEvent, AutoresearchPhaseChangedEvent, AutoresearchResumedEvent, AutoresearchRevertEvent, AutoresearchRevertFailedEvent, AutoresearchStateUpdatedEvent, ExperimentPhase, ExperimentRecord, ExperimentStats, ExperimentStatus, ExperimentSummary, MemoryMetricConfig, MetricConfig, MetricDirection, PhaseToolPolicy, ResearchConfig, ResearchState, ResearchWorkerConfig, } from "./autoresearchTypes.js";
|
|
24
|
+
export { AUTORESEARCH_DEFAULTS } from "./autoresearchTypes.js";
|
|
25
|
+
export type { AgentExecuteOptions as ClientAgentExecuteOptions, AgentExecuteResult as ClientAgentExecuteResult, AgentInfo as ClientAgentInfo, ApiError as ClientApiError, AuthConfig as ClientAuthConfig, ClientApiResponse, ClientChatMessage, ClientConfig, ClientMiddlewareContext, ClientOAuth2Config, ClientProviderStatus, ClientRetryConfig, ClientStreamEvent, ClientStreamResult, ClientTokenRefreshResult, GenerateRequestOptions as ClientGenerateRequestOptions, GenerateResponse as ClientGenerateResponse, LanguageModel as ClientLanguageModel, LanguageModelCallOptions as ClientLanguageModelCallOptions, LanguageModelResponse as ClientLanguageModelResponse, LanguageModelStreamResponse as ClientLanguageModelStreamResponse, Middleware as ClientMiddleware, MiddlewareRequest as ClientMiddlewareRequest, MiddlewareResponse as ClientMiddlewareResponse, ModelOptions as ClientModelOptions, NeuroLinkProviderOptions, RequestOptions as ClientRequestOptions, SpeechRecognitionResult as ClientSpeechRecognitionResult, SpeechSynthesisOptions as ClientSpeechSynthesisOptions, StreamCallbacks as ClientStreamCallbacks, StreamEventType as ClientStreamEventType, StreamRequestOptions as ClientStreamRequestOptions, ToolInfo as ClientToolInfo, UseAgentOptions, UseAgentReturn, UseChatOptions, UseChatReturn, UseStreamOptions, UseStreamReturn, UseToolsOptions, UseToolsReturn, UseVoiceOptions, UseVoiceReturn, UseWorkflowOptions, UseWorkflowReturn, WebSocketMessageHandler as ClientWebSocketMessageHandler, WebSocketOptions as ClientWebSocketOptions, WebSocketState as ClientWebSocketState, WorkflowExecuteOptions as ClientWorkflowExecuteOptions, WorkflowExecuteResult as ClientWorkflowExecuteResult, WorkflowInfo as ClientWorkflowInfo, WSClientConfig, WSClientEventHandlers, WSClientMessage, WSClientState, } from "./clientTypes.js";
|
|
26
|
+
export * from "./contextTypes.js";
|
|
27
|
+
export type { ConversationData, ConversationSummary, NeurolinkOptions, StorageConfig, } from "./conversation.js";
|
|
28
|
+
export * from "./conversationMemoryInterface.js";
|
|
22
29
|
export type { DomainConfig, DomainConfigOptions, DomainEvaluationCriteria, DomainTemplate, DomainType, DomainValidationRule, } from "./domainTypes.js";
|
|
30
|
+
export { AuthenticationError, AuthorizationError, NetworkError, RateLimitError, } from "./errors.js";
|
|
23
31
|
export * from "./evaluation.js";
|
|
24
32
|
export * from "./evaluationProviders.js";
|
|
33
|
+
export * from "./fileReferenceTypes.js";
|
|
25
34
|
export * from "./fileTypes.js";
|
|
26
35
|
export type { AdditionalMemoryUser, EnhancedGenerateResult, EnhancedProvider, FactoryEnhancedProvider, GenerateOptions, GenerateResult as GenerateApiResult, // Renamed to avoid conflict with cli.js GenerateResult
|
|
27
36
|
TextGenerationOptions, TextGenerationResult, UnifiedGenerationOptions, } from "./generateTypes.js";
|
|
28
37
|
export * from "./hitlTypes.js";
|
|
29
38
|
export * from "./middlewareTypes.js";
|
|
30
39
|
export * from "./modelTypes.js";
|
|
40
|
+
export * from "./proxyTypes.js";
|
|
41
|
+
export * from "./ragTypes.js";
|
|
31
42
|
export * from "./scorerTypes.js";
|
|
32
43
|
export * from "./sdkTypes.js";
|
|
44
|
+
export type { AgentExecuteRequest, AgentExecuteResponse, AuthConfig as ServerAuthConfig, AuthenticatedUser, AuthStrategy, BodyParserConfig, CORSConfig, DataStreamWriter, EmbedManyRequest, EmbedManyResponse, EmbedRequest, EmbedResponse, ErrorCategory, ErrorCategoryType, ErrorSeverity, ErrorSeverityType, HealthResponse, HttpMethod, LoggingConfig, MCPServerStatusResponse, MiddlewareDefinition, MiddlewareHandler, RateLimitConfig as ServerRateLimitConfig, ReadyResponse, RedactionConfig, RequiredBodyParserConfig, RequiredCORSConfig, RequiredLoggingConfig, RequiredRateLimitConfig, RequiredRedactionConfig, RequiredServerAdapterConfig, RequiredShutdownConfig, RouteDefinition, RouteDeprecation, RouteGroup, RouteHandler, ServerAdapterConfig, ServerAdapterErrorCode, ServerAdapterErrorCodeType, ServerAdapterErrorContext, ServerAdapterEvents, ServerAdapterFactoryOptions, ServerContext, ServerFramework, ServerLifecycleState, ServerResponse, ServerStatus, ShutdownConfig, SSEWriteOptions, StreamingConfig, ToolExecuteRequest, ToolExecuteResponse, TrackedConnection, WebSocketConfig, WebSocketConnection, WebSocketHandler, WebSocketMessage, WebSocketMessageType, } from "./serverTypes.js";
|
|
33
45
|
export * from "./serviceTypes.js";
|
|
34
46
|
export type { EnhancedStreamProvider, ProgressCallback, StreamingMetadata, StreamingOptions, StreamingProgressData, StreamOptions, StreamResult, ToolCall as StreamToolCall, // Renamed to avoid conflict with tools.js ToolCall
|
|
35
47
|
ToolCallResults, ToolCalls, ToolResult as StreamToolResult, } from "./streamTypes.js";
|
|
48
|
+
export type { TokenRefresher } from "./subscriptionTypes.js";
|
|
49
|
+
export * from "./subscriptionTypes.js";
|
|
50
|
+
export type { AutoresearchTaskConfig, ConversationEntry as TaskConversationEntry, CronSchedule, IntervalSchedule, OnceSchedule, ScheduledTaskType, Task, TaskBackend, TaskBackendName, TaskDefinition, TaskExecutionMode, TaskManagerConfig, TaskRetentionConfig, TaskRunError, TaskRunResult, TaskSchedule, TaskScheduleType, TaskStatus, TaskStore, WorkerState, } from "./taskTypes.js";
|
|
51
|
+
export { TASK_DEFAULTS } from "./taskTypes.js";
|
|
36
52
|
export * from "./ttsTypes.js";
|
|
37
53
|
export * from "./utilities.js";
|
|
38
54
|
export type { AggregatedUsage, ConditioningConfig, ConditionOptions, ConditionResult, EnsembleExecutionResult, EnsembleResponse, ExecuteEnsembleOptions, ExecuteLayerOptions, ExecuteModelOptions, ExecutionConfig, ExecutionStrategy, JudgeConfig, JudgeOutputFormat, JudgeScores, LayerExecutionResult, ListOptions, ModelGroup, MultiJudgeScores, ParsedJudgeResponse, RegisterOptions, RegisterResult, RegistryEntry, RegistryStats, ScoreOptions, ScoreResult as WorkflowScoreResult, SummaryStats, ToneAdjustment, ValidationIssues, WorkflowAnalytics, WorkflowComparison, WorkflowConfig, WorkflowErrorDetails, WorkflowEvaluationData, WorkflowExecutionMetrics, WorkflowGenerateOptions, WorkflowInput, WorkflowMetadata, WorkflowModelConfig, WorkflowResult, WorkflowType, WorkflowValidationError, WorkflowValidationResult, WorkflowValidationWarning, } from "./workflowTypes.js";
|
|
39
55
|
export { WorkflowError } from "./workflowTypes.js";
|
|
40
|
-
export * from "./contextTypes.js";
|
|
41
|
-
export * from "./fileReferenceTypes.js";
|
|
42
|
-
export * from "./ragTypes.js";
|
|
43
|
-
export type { AgentExecuteRequest, AgentExecuteResponse, AuthConfig as ServerAuthConfig, AuthenticatedUser, AuthStrategy, BodyParserConfig, CORSConfig, DataStreamWriter, EmbedManyRequest, EmbedManyResponse, EmbedRequest, EmbedResponse, ErrorCategory, ErrorCategoryType, ErrorSeverity, ErrorSeverityType, HealthResponse, HttpMethod, LoggingConfig, MCPServerStatusResponse, MiddlewareDefinition, MiddlewareHandler, RateLimitConfig as ServerRateLimitConfig, ReadyResponse, RedactionConfig, RequiredBodyParserConfig, RequiredCORSConfig, RequiredLoggingConfig, RequiredRateLimitConfig, RequiredRedactionConfig, RequiredServerAdapterConfig, RequiredShutdownConfig, RouteDefinition, RouteDeprecation, RouteGroup, RouteHandler, ServerAdapterConfig, ServerAdapterErrorCode, ServerAdapterErrorCodeType, ServerAdapterErrorContext, ServerAdapterEvents, ServerAdapterFactoryOptions, ServerContext, ServerFramework, ServerLifecycleState, ServerResponse, ServerStatus, ShutdownConfig, SSEWriteOptions, StreamingConfig, ToolExecuteRequest, ToolExecuteResponse, TrackedConnection, WebSocketConfig, WebSocketConnection, WebSocketHandler, WebSocketMessage, WebSocketMessageType, } from "./serverTypes.js";
|
|
44
|
-
export * from "./conversationMemoryInterface.js";
|
|
45
|
-
export type { StorageConfig, ConversationData, ConversationSummary, NeurolinkOptions, } from "./conversation.js";
|
|
46
|
-
export { AuthenticationError, AuthorizationError, NetworkError, RateLimitError, } from "./errors.js";
|
|
47
|
-
export * from "./subscriptionTypes.js";
|
|
48
|
-
export type { ClientConfig, RequestOptions as ClientRequestOptions, ClientRetryConfig, ClientApiResponse, ApiError as ClientApiError, ClientProviderStatus, StreamEventType as ClientStreamEventType, ClientStreamEvent, StreamCallbacks as ClientStreamCallbacks, ClientStreamResult, GenerateRequestOptions as ClientGenerateRequestOptions, GenerateResponse as ClientGenerateResponse, StreamRequestOptions as ClientStreamRequestOptions, AgentExecuteOptions as ClientAgentExecuteOptions, AgentExecuteResult as ClientAgentExecuteResult, AgentInfo as ClientAgentInfo, WorkflowExecuteOptions as ClientWorkflowExecuteOptions, WorkflowExecuteResult as ClientWorkflowExecuteResult, WorkflowInfo as ClientWorkflowInfo, ToolInfo as ClientToolInfo, Middleware as ClientMiddleware, MiddlewareRequest as ClientMiddlewareRequest, MiddlewareResponse as ClientMiddlewareResponse, ClientMiddlewareContext, ClientChatMessage, UseChatOptions, UseChatReturn, UseAgentOptions, UseAgentReturn, UseWorkflowOptions, UseWorkflowReturn, UseVoiceOptions, UseVoiceReturn, UseStreamOptions, UseStreamReturn, UseToolsOptions, UseToolsReturn, LanguageModel as ClientLanguageModel, LanguageModelCallOptions as ClientLanguageModelCallOptions, LanguageModelResponse as ClientLanguageModelResponse, LanguageModelStreamResponse as ClientLanguageModelStreamResponse, NeuroLinkProviderOptions, ModelOptions as ClientModelOptions, WebSocketOptions as ClientWebSocketOptions, WebSocketState as ClientWebSocketState, WebSocketMessageHandler as ClientWebSocketMessageHandler, WSClientState, WSClientConfig, WSClientMessage, WSClientEventHandlers, SpeechRecognitionResult as ClientSpeechRecognitionResult, SpeechSynthesisOptions as ClientSpeechSynthesisOptions, AuthConfig as ClientAuthConfig, ClientOAuth2Config, ClientTokenRefreshResult, } from "./clientTypes.js";
|
|
49
|
-
export type { TokenRefresher } from "./subscriptionTypes.js";
|
|
50
|
-
export * from "./proxyTypes.js";
|
|
51
|
-
export type { AuthProviderType, AuthProviderConfig, MastraAuthProvider, BetterAuthConfig, Auth0Config, ClerkConfig, FirebaseConfig, SupabaseConfig, WorkOSConfig, JWTConfig, OAuth2Config, CognitoConfig, KeycloakConfig, CustomAuthConfig, BaseAuthProviderConfig, AuthUser, AuthSession, TokenType, TokenValidationResult as AuthTokenValidationResult, TokenClaims, JWK, JWKS, TokenRefreshResult, TokenValidationConfig, TokenExtractionConfig, SessionValidationResult, SessionStorage, AuthorizationResult, AuthRequestContext, AuthenticatedContext, TokenExtractionStrategy, SessionConfig, SessionStorageType, RBACConfig, PermissionDefinition, AuthCacheConfig, AuthMiddlewareOptions, AuthMiddlewareConfig, RBACMiddlewareConfig, AuthErrorCode, AuthErrorInfo, AuthErrorInfo as AuthErrorType, AuthEventType, AuthEventData, AuthEventHandler, AuthProviderFactoryFn, AuthProviderRegistration, AuthHealthCheck, AuthProviderHealthCheck, AuthEvents, AuthProviderMetadata, AuthProviderHealthStatus, AuthTokenValidator, AuthUserAuthorizer, AuthSessionManager, AuthRequestHandler, AuthUserManager, AuthLifecycle, } from "./authTypes.js";
|
|
52
|
-
export type { Task, TaskDefinition, TaskSchedule, TaskScheduleType, CronSchedule, IntervalSchedule, OnceSchedule, TaskExecutionMode, TaskStatus, TaskRunResult, TaskRunError, TaskStore, TaskBackend, TaskBackendName, TaskManagerConfig, TaskRetentionConfig, WorkerState, ConversationEntry as TaskConversationEntry, } from "./taskTypes.js";
|
|
53
|
-
export { TASK_DEFAULTS } from "./taskTypes.js";
|
package/dist/lib/types/index.js
CHANGED
|
@@ -16,10 +16,22 @@ export * from "./tools.js";
|
|
|
16
16
|
export { PROCESSOR_PRIORITIES } from "../processors/base/types.js";
|
|
17
17
|
// Content types for multimodal support (direct export from canonical source)
|
|
18
18
|
export * from "./multimodal.js";
|
|
19
|
+
export { AUTORESEARCH_DEFAULTS } from "./autoresearchTypes.js";
|
|
20
|
+
// Content types: canonical source is ./multimodal.js (already exported above).
|
|
21
|
+
// ./content.js re-exports from multimodal for backward compat but is NOT
|
|
22
|
+
// re-exported here to avoid duplicate symbol collisions.
|
|
23
|
+
// Context compaction types
|
|
24
|
+
export * from "./contextTypes.js";
|
|
25
|
+
// Conversation memory manager type
|
|
26
|
+
export * from "./conversationMemoryInterface.js";
|
|
27
|
+
// Error classes
|
|
28
|
+
export { AuthenticationError, AuthorizationError, NetworkError, RateLimitError, } from "./errors.js";
|
|
19
29
|
// Evaluation types - NEW
|
|
20
30
|
export * from "./evaluation.js";
|
|
21
31
|
// Evaluation provider types - NEW
|
|
22
32
|
export * from "./evaluationProviders.js";
|
|
33
|
+
// File reference types
|
|
34
|
+
export * from "./fileReferenceTypes.js";
|
|
23
35
|
// File detection and processing types
|
|
24
36
|
export * from "./fileTypes.js";
|
|
25
37
|
// HITL (Human-in-the-Loop) types
|
|
@@ -28,6 +40,10 @@ export * from "./hitlTypes.js";
|
|
|
28
40
|
export * from "./middlewareTypes.js";
|
|
29
41
|
// Model types - NEW
|
|
30
42
|
export * from "./modelTypes.js";
|
|
43
|
+
// Proxy types (Claude API format, cloaking, routing, config, stats, server adapters)
|
|
44
|
+
export * from "./proxyTypes.js";
|
|
45
|
+
// RAG types
|
|
46
|
+
export * from "./ragTypes.js";
|
|
31
47
|
// Scorer types for evaluation system
|
|
32
48
|
export * from "./scorerTypes.js";
|
|
33
49
|
// SDK Types - Core types for external developers
|
|
@@ -36,27 +52,15 @@ export * from "./scorerTypes.js";
|
|
|
36
52
|
export * from "./sdkTypes.js";
|
|
37
53
|
// Service types - NEW
|
|
38
54
|
export * from "./serviceTypes.js";
|
|
39
|
-
// TTS (Text-to-Speech) types
|
|
40
|
-
export * from "./ttsTypes.js";
|
|
41
|
-
// Utilities Types - Utility module types (selective export to avoid conflicts)
|
|
42
|
-
export * from "./utilities.js";
|
|
43
|
-
export { WorkflowError } from "./workflowTypes.js";
|
|
44
|
-
// Context compaction types
|
|
45
|
-
export * from "./contextTypes.js";
|
|
46
|
-
// File reference types
|
|
47
|
-
export * from "./fileReferenceTypes.js";
|
|
48
|
-
// RAG types
|
|
49
|
-
export * from "./ragTypes.js";
|
|
50
|
-
// Conversation memory manager type
|
|
51
|
-
export * from "./conversationMemoryInterface.js";
|
|
52
|
-
// Error classes
|
|
53
|
-
export { AuthenticationError, AuthorizationError, NetworkError, RateLimitError, } from "./errors.js";
|
|
54
55
|
// Subscription types (Claude subscription tiers, authentication, usage tracking)
|
|
55
56
|
// NOTE: subscriptionTypes.ts re-exports auth types from ./authTypes.ts for
|
|
56
57
|
// backward compatibility. Import StoredOAuthTokens, TokenRefresher, etc.
|
|
57
58
|
// from authTypes.ts for new code.
|
|
58
59
|
export * from "./subscriptionTypes.js";
|
|
59
|
-
// Proxy types (Claude API format, cloaking, routing, config, stats, server adapters)
|
|
60
|
-
export * from "./proxyTypes.js";
|
|
61
60
|
export { TASK_DEFAULTS } from "./taskTypes.js";
|
|
61
|
+
// TTS (Text-to-Speech) types
|
|
62
|
+
export * from "./ttsTypes.js";
|
|
63
|
+
// Utilities Types - Utility module types (selective export to avoid conflicts)
|
|
64
|
+
export * from "./utilities.js";
|
|
65
|
+
export { WorkflowError } from "./workflowTypes.js";
|
|
62
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,7 +6,37 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Cron } from "croner";
|
|
8
8
|
import type { createClient } from "redis";
|
|
9
|
+
import type { MemoryMetricConfig, MetricConfig } from "./autoresearchTypes.js";
|
|
9
10
|
import type { ThinkingLevel } from "./configTypes.js";
|
|
11
|
+
/**
|
|
12
|
+
* Discriminator for standard vs autoresearch tasks.
|
|
13
|
+
* - "standard": Normal prompt-based task (default)
|
|
14
|
+
* - "autoresearch": Autonomous experiment loop task
|
|
15
|
+
*/
|
|
16
|
+
export type ScheduledTaskType = "standard" | "autoresearch";
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for autoresearch tasks.
|
|
19
|
+
* Embedded in TaskDefinition/Task when type === "autoresearch".
|
|
20
|
+
*/
|
|
21
|
+
export type AutoresearchTaskConfig = {
|
|
22
|
+
repoPath: string;
|
|
23
|
+
mutablePaths: string[];
|
|
24
|
+
runCommand: string;
|
|
25
|
+
metric: MetricConfig;
|
|
26
|
+
immutablePaths?: string[];
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
maxExperiments?: number;
|
|
29
|
+
provider?: string;
|
|
30
|
+
model?: string;
|
|
31
|
+
thinkingLevel?: ThinkingLevel;
|
|
32
|
+
maxBudgetUsd?: number;
|
|
33
|
+
programPath?: string;
|
|
34
|
+
resultsPath?: string;
|
|
35
|
+
statePath?: string;
|
|
36
|
+
logPath?: string;
|
|
37
|
+
branchPrefix?: string;
|
|
38
|
+
memoryMetric?: MemoryMetricConfig;
|
|
39
|
+
};
|
|
10
40
|
export type TaskScheduleType = "cron" | "interval" | "once";
|
|
11
41
|
export type CronSchedule = {
|
|
12
42
|
type: "cron";
|
|
@@ -37,6 +67,10 @@ export type TaskDefinition = {
|
|
|
37
67
|
prompt: string;
|
|
38
68
|
schedule: TaskSchedule;
|
|
39
69
|
mode?: TaskExecutionMode;
|
|
70
|
+
/** Task type discriminator. Default: "standard" */
|
|
71
|
+
type?: ScheduledTaskType;
|
|
72
|
+
/** Autoresearch config (required when type === "autoresearch") */
|
|
73
|
+
autoresearch?: AutoresearchTaskConfig;
|
|
40
74
|
provider?: string;
|
|
41
75
|
model?: string;
|
|
42
76
|
thinkingLevel?: ThinkingLevel;
|
|
@@ -67,7 +101,11 @@ export type Task = {
|
|
|
67
101
|
prompt: string;
|
|
68
102
|
schedule: TaskSchedule;
|
|
69
103
|
mode: TaskExecutionMode;
|
|
104
|
+
/** Task type discriminator. Default: "standard" */
|
|
105
|
+
type: ScheduledTaskType;
|
|
70
106
|
status: TaskStatus;
|
|
107
|
+
/** Autoresearch config (present when type === "autoresearch") */
|
|
108
|
+
autoresearch?: AutoresearchTaskConfig;
|
|
71
109
|
provider?: string;
|
|
72
110
|
model?: string;
|
|
73
111
|
thinkingLevel?: ThinkingLevel;
|
|
@@ -41,8 +41,8 @@ export declare const JudgeConfigSchema: z.ZodObject<{
|
|
|
41
41
|
model: z.ZodString;
|
|
42
42
|
criteria: z.ZodArray<z.ZodString>;
|
|
43
43
|
outputFormat: z.ZodEnum<{
|
|
44
|
-
detailed: "detailed";
|
|
45
44
|
scores: "scores";
|
|
45
|
+
detailed: "detailed";
|
|
46
46
|
ranking: "ranking";
|
|
47
47
|
best: "best";
|
|
48
48
|
}>;
|
|
@@ -195,8 +195,8 @@ export declare const WorkflowConfigSchema: z.ZodObject<{
|
|
|
195
195
|
model: z.ZodString;
|
|
196
196
|
criteria: z.ZodArray<z.ZodString>;
|
|
197
197
|
outputFormat: z.ZodEnum<{
|
|
198
|
-
detailed: "detailed";
|
|
199
198
|
scores: "scores";
|
|
199
|
+
detailed: "detailed";
|
|
200
200
|
ranking: "ranking";
|
|
201
201
|
best: "best";
|
|
202
202
|
}>;
|
|
@@ -219,8 +219,8 @@ export declare const WorkflowConfigSchema: z.ZodObject<{
|
|
|
219
219
|
model: z.ZodString;
|
|
220
220
|
criteria: z.ZodArray<z.ZodString>;
|
|
221
221
|
outputFormat: z.ZodEnum<{
|
|
222
|
-
detailed: "detailed";
|
|
223
222
|
scores: "scores";
|
|
223
|
+
detailed: "detailed";
|
|
224
224
|
ranking: "ranking";
|
|
225
225
|
best: "best";
|
|
226
226
|
}>;
|
package/dist/neurolink.js
CHANGED
|
@@ -28,9 +28,9 @@ import { getContextOverflowProvider, isContextOverflowError, parseProviderOverfl
|
|
|
28
28
|
import { ContextBudgetExceededError } from "./context/errors.js";
|
|
29
29
|
import { repairToolPairs } from "./context/toolPairRepair.js";
|
|
30
30
|
import { SYSTEM_LIMITS } from "./core/constants.js";
|
|
31
|
-
import { createToolEventPayload } from "./core/toolEvents.js";
|
|
32
31
|
import { ConversationMemoryManager } from "./core/conversationMemoryManager.js";
|
|
33
32
|
import { AIProviderFactory } from "./core/factory.js";
|
|
33
|
+
import { createToolEventPayload } from "./core/toolEvents.js";
|
|
34
34
|
import { ProviderRegistry } from "./factories/providerRegistry.js";
|
|
35
35
|
import { FileReferenceRegistry } from "./files/fileReferenceRegistry.js";
|
|
36
36
|
import { createFileTools } from "./files/fileTools.js";
|
|
@@ -2705,6 +2705,7 @@ Current user's request: ${currentInput}`;
|
|
|
2705
2705
|
region: options.region,
|
|
2706
2706
|
tts: options.tts,
|
|
2707
2707
|
fileRegistry: this.fileRegistry,
|
|
2708
|
+
timeout: options.timeout,
|
|
2708
2709
|
abortSignal: options.abortSignal,
|
|
2709
2710
|
skipToolPromptInjection: options.skipToolPromptInjection,
|
|
2710
2711
|
middleware: options.middleware,
|
|
@@ -4108,7 +4109,26 @@ Current user's request: ${currentInput}`;
|
|
|
4108
4109
|
responseTime,
|
|
4109
4110
|
finishReason: result.finishReason,
|
|
4110
4111
|
toolsUsed: result.toolsUsed || [],
|
|
4111
|
-
|
|
4112
|
+
// Map toolExecutions from EnhancedGenerateResult shape ({name,input,output})
|
|
4113
|
+
// to TextGenerationResult shape ({toolName,executionTime,success}).
|
|
4114
|
+
// Preserve original timing/status when present, fall back to safe defaults.
|
|
4115
|
+
toolExecutions: result.toolExecutions?.map((te) => {
|
|
4116
|
+
const t = te;
|
|
4117
|
+
return {
|
|
4118
|
+
// Spread original fields first so normalized fields take precedence
|
|
4119
|
+
...te,
|
|
4120
|
+
toolName: te.name,
|
|
4121
|
+
executionTime: typeof t.executionTime === "number"
|
|
4122
|
+
? t.executionTime
|
|
4123
|
+
: typeof t.duration === "number"
|
|
4124
|
+
? t.duration
|
|
4125
|
+
: 0,
|
|
4126
|
+
success: typeof t.success === "boolean"
|
|
4127
|
+
? t.success
|
|
4128
|
+
: t.status === "success",
|
|
4129
|
+
};
|
|
4130
|
+
}),
|
|
4131
|
+
enhancedWithTools: !!result.toolExecutions?.length,
|
|
4112
4132
|
analytics: result.analytics,
|
|
4113
4133
|
evaluation: result.evaluation,
|
|
4114
4134
|
audio: result.audio,
|
|
@@ -13,7 +13,10 @@ export declare class AzureOpenAIProvider extends BaseProvider {
|
|
|
13
13
|
getProviderName(): AIProviderName;
|
|
14
14
|
getDefaultModel(): string;
|
|
15
15
|
/**
|
|
16
|
-
* Returns the Vercel AI SDK model instance for Azure OpenAI
|
|
16
|
+
* Returns the Vercel AI SDK model instance for Azure OpenAI.
|
|
17
|
+
* Uses .chat() explicitly because @ai-sdk/azure v3+ defaults the bare
|
|
18
|
+
* provider() call to the Responses API, which many Azure deployments
|
|
19
|
+
* do not support yet.
|
|
17
20
|
*/
|
|
18
21
|
getAISDKModel(): LanguageModel;
|
|
19
22
|
protected formatProviderError(error: unknown): Error;
|
|
@@ -43,11 +43,14 @@ export class AzureOpenAIProvider extends BaseProvider {
|
|
|
43
43
|
validateApiKey(createAzureEndpointConfig());
|
|
44
44
|
}
|
|
45
45
|
// Create the Azure provider instance with proxy support
|
|
46
|
-
//
|
|
46
|
+
// useDeploymentBasedUrls is required because @ai-sdk/azure v3+ defaults to
|
|
47
|
+
// the /v1/ URL format, but most Azure deployments still require the legacy
|
|
48
|
+
// /deployments/{deployment}/ URL pattern.
|
|
47
49
|
this.azureProvider = createAzure({
|
|
48
50
|
resourceName: this.resourceName,
|
|
49
51
|
apiKey: this.apiKey,
|
|
50
52
|
apiVersion: this.apiVersion,
|
|
53
|
+
useDeploymentBasedUrls: true,
|
|
51
54
|
fetch: createProxyFetch(),
|
|
52
55
|
});
|
|
53
56
|
logger.debug("Azure Vercel Provider initialized", {
|
|
@@ -63,10 +66,13 @@ export class AzureOpenAIProvider extends BaseProvider {
|
|
|
63
66
|
return this.deployment;
|
|
64
67
|
}
|
|
65
68
|
/**
|
|
66
|
-
* Returns the Vercel AI SDK model instance for Azure OpenAI
|
|
69
|
+
* Returns the Vercel AI SDK model instance for Azure OpenAI.
|
|
70
|
+
* Uses .chat() explicitly because @ai-sdk/azure v3+ defaults the bare
|
|
71
|
+
* provider() call to the Responses API, which many Azure deployments
|
|
72
|
+
* do not support yet.
|
|
67
73
|
*/
|
|
68
74
|
getAISDKModel() {
|
|
69
|
-
return this.azureProvider(this.deployment);
|
|
75
|
+
return this.azureProvider.chat(this.deployment);
|
|
70
76
|
}
|
|
71
77
|
formatProviderError(error) {
|
|
72
78
|
if (error instanceof TimeoutError) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
2
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
3
|
-
import { NoOutputGeneratedError, Output, streamText, } from "ai";
|
|
3
|
+
import { NoOutputGeneratedError, Output, stepCountIs, streamText, } from "ai";
|
|
4
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
5
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
6
6
|
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
@@ -165,7 +165,7 @@ export class LiteLLMProvider extends BaseProvider {
|
|
|
165
165
|
Object.keys(tools).length > 0 && {
|
|
166
166
|
tools,
|
|
167
167
|
toolChoice: resolveToolChoice(options, tools, shouldUseTools),
|
|
168
|
-
|
|
168
|
+
stopWhen: stepCountIs(options.maxSteps || DEFAULT_MAX_STEPS),
|
|
169
169
|
}),
|
|
170
170
|
abortSignal: composeAbortSignals(options.abortSignal, timeoutController?.controller.signal),
|
|
171
171
|
experimental_telemetry: this.telemetryHandler.getTelemetryConfig(options),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
2
|
-
import { NoOutputGeneratedError, Output, streamText, } from "ai";
|
|
2
|
+
import { NoOutputGeneratedError, Output, stepCountIs, streamText, } from "ai";
|
|
3
3
|
import { AIProviderName } from "../constants/enums.js";
|
|
4
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
5
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
@@ -248,7 +248,7 @@ export class OpenRouterProvider extends BaseProvider {
|
|
|
248
248
|
Object.keys(tools).length > 0 && {
|
|
249
249
|
tools,
|
|
250
250
|
toolChoice: resolveToolChoice(options, tools, shouldUseTools),
|
|
251
|
-
|
|
251
|
+
stopWhen: stepCountIs(options.maxSteps || DEFAULT_MAX_STEPS),
|
|
252
252
|
}),
|
|
253
253
|
abortSignal: composeAbortSignals(options.abortSignal, timeoutController?.controller.signal),
|
|
254
254
|
experimental_telemetry: this.telemetryHandler.getTelemetryConfig(options),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { NoOutputGeneratedError, streamText, } from "ai";
|
|
2
|
+
import { NoOutputGeneratedError, stepCountIs, streamText, } from "ai";
|
|
3
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
|
+
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
4
5
|
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
5
6
|
import { createProxyFetch } from "../proxy/proxyFetch.js";
|
|
6
7
|
import { logger } from "../utils/logger.js";
|
|
@@ -191,6 +192,7 @@ export class OpenAICompatibleProvider extends BaseProvider {
|
|
|
191
192
|
: {}),
|
|
192
193
|
tools,
|
|
193
194
|
toolChoice: resolveToolChoice(options, tools, shouldUseTools),
|
|
195
|
+
stopWhen: stepCountIs(options.maxSteps || DEFAULT_MAX_STEPS),
|
|
194
196
|
abortSignal: composeAbortSignals(options.abortSignal, timeoutController?.controller.signal),
|
|
195
197
|
experimental_telemetry: this.telemetryHandler.getTelemetryConfig(options),
|
|
196
198
|
onStepFinish: (event) => {
|
|
@@ -82,7 +82,7 @@ export declare const RAGErrorFactory: {
|
|
|
82
82
|
readonly RETRY_EXHAUSTED: "RAG_RETRY_EXHAUSTED";
|
|
83
83
|
readonly INVALID_CONFIGURATION: "RAG_INVALID_CONFIGURATION";
|
|
84
84
|
};
|
|
85
|
-
create: (code: "CHUNKING_ERROR" | "CHUNKING_INVALID_CONFIG" | "CHUNKING_STRATEGY_NOT_FOUND" | "CHUNKING_EMPTY_CONTENT" | "CHUNKING_SIZE_EXCEEDED" | "METADATA_EXTRACTION_ERROR" | "METADATA_EXTRACTION_TIMEOUT" | "METADATA_SCHEMA_INVALID" | "METADATA_EXTRACTOR_NOT_FOUND" | "EMBEDDING_ERROR" | "EMBEDDING_DIMENSION_MISMATCH" | "EMBEDDING_RATE_LIMIT" | "EMBEDDING_PROVIDER_ERROR" | "VECTOR_QUERY_ERROR" | "VECTOR_QUERY_TIMEOUT" | "VECTOR_STORE_UNAVAILABLE" | "VECTOR_STORE_CONNECTION_ERROR" | "VECTOR_INDEX_NOT_FOUND" | "RERANKER_ERROR" | "RERANKER_NOT_FOUND" | "RERANKER_API_ERROR" | "GRAPH_RAG_ERROR" | "GRAPH_TRAVERSAL_ERROR" | "GRAPH_NODE_NOT_FOUND" | "PIPELINE_ERROR" | "PIPELINE_STAGE_FAILED" | "PIPELINE_PARTIAL_FAILURE" | "CIRCUIT_BREAKER_OPEN" | "CIRCUIT_BREAKER_HALF_OPEN_LIMIT" | "OPERATION_TIMEOUT" | "RETRY_EXHAUSTED"
|
|
85
|
+
create: (code: "INVALID_CONFIGURATION" | "CHUNKING_ERROR" | "CHUNKING_INVALID_CONFIG" | "CHUNKING_STRATEGY_NOT_FOUND" | "CHUNKING_EMPTY_CONTENT" | "CHUNKING_SIZE_EXCEEDED" | "METADATA_EXTRACTION_ERROR" | "METADATA_EXTRACTION_TIMEOUT" | "METADATA_SCHEMA_INVALID" | "METADATA_EXTRACTOR_NOT_FOUND" | "EMBEDDING_ERROR" | "EMBEDDING_DIMENSION_MISMATCH" | "EMBEDDING_RATE_LIMIT" | "EMBEDDING_PROVIDER_ERROR" | "VECTOR_QUERY_ERROR" | "VECTOR_QUERY_TIMEOUT" | "VECTOR_STORE_UNAVAILABLE" | "VECTOR_STORE_CONNECTION_ERROR" | "VECTOR_INDEX_NOT_FOUND" | "RERANKER_ERROR" | "RERANKER_NOT_FOUND" | "RERANKER_API_ERROR" | "GRAPH_RAG_ERROR" | "GRAPH_TRAVERSAL_ERROR" | "GRAPH_NODE_NOT_FOUND" | "PIPELINE_ERROR" | "PIPELINE_STAGE_FAILED" | "PIPELINE_PARTIAL_FAILURE" | "CIRCUIT_BREAKER_OPEN" | "CIRCUIT_BREAKER_HALF_OPEN_LIMIT" | "OPERATION_TIMEOUT" | "RETRY_EXHAUSTED", message: string, options?: {
|
|
86
86
|
retryable?: boolean;
|
|
87
87
|
details?: Record<string, unknown>;
|
|
88
88
|
cause?: Error;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { logger } from "../../utils/logger.js";
|
|
2
|
+
export class FrameBus {
|
|
3
|
+
handlers = {};
|
|
4
|
+
subscribe(type, fn) {
|
|
5
|
+
if (!this.handlers[type]) {
|
|
6
|
+
this.handlers[type] = [];
|
|
7
|
+
}
|
|
8
|
+
this.handlers[type].push(fn);
|
|
9
|
+
}
|
|
10
|
+
publish(frame) {
|
|
11
|
+
const subs = this.handlers[frame.type];
|
|
12
|
+
if (!subs) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
for (const fn of subs) {
|
|
16
|
+
try {
|
|
17
|
+
fn(frame);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
logger.error(`[FrameBus] Subscriber threw on ${frame.type}:`, err);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|