@juspay/neurolink 9.65.0 → 9.65.2
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 +8 -0
- package/dist/adapters/video/videoAnalyzer.d.ts +1 -1
- package/dist/agent/directTools.d.ts +9 -17
- package/dist/agent/directTools.js +12 -8
- package/dist/autoresearch/tools.d.ts +2 -214
- package/dist/autoresearch/tools.js +1 -1
- package/dist/browser/neurolink.min.js +362 -368
- package/dist/client/reactHooks.js +16 -8
- package/dist/client/reactHooks.tsx +24 -9
- package/dist/core/baseProvider.d.ts +1 -6
- package/dist/core/baseProvider.js +1 -1
- package/dist/core/constants.d.ts +1 -0
- package/dist/core/constants.js +3 -0
- package/dist/core/modules/GenerationHandler.d.ts +2 -2
- package/dist/core/modules/GenerationHandler.js +3 -1
- package/dist/core/modules/MessageBuilder.d.ts +1 -15
- package/dist/core/modules/MessageBuilder.js +0 -14
- package/dist/core/modules/StreamHandler.js +1 -1
- package/dist/core/modules/ToolsManager.d.ts +1 -17
- package/dist/core/modules/ToolsManager.js +1 -17
- package/dist/core/redisConversationMemoryManager.js +0 -6
- package/dist/core/streamAnalytics.js +1 -1
- package/dist/evaluation/contextBuilder.d.ts +1 -4
- package/dist/evaluation/contextBuilder.js +0 -3
- package/dist/evaluation/index.d.ts +1 -4
- package/dist/evaluation/index.js +0 -3
- package/dist/files/fileTools.d.ts +2 -18
- package/dist/files/fileTools.js +3 -19
- package/dist/lib/adapters/video/videoAnalyzer.d.ts +1 -1
- package/dist/lib/agent/directTools.d.ts +9 -17
- package/dist/lib/agent/directTools.js +12 -8
- package/dist/lib/autoresearch/tools.d.ts +2 -214
- package/dist/lib/autoresearch/tools.js +1 -1
- package/dist/lib/client/reactHooks.js +16 -8
- package/dist/lib/core/baseProvider.d.ts +1 -6
- package/dist/lib/core/baseProvider.js +1 -1
- package/dist/lib/core/constants.d.ts +1 -0
- package/dist/lib/core/constants.js +3 -0
- package/dist/lib/core/modules/GenerationHandler.d.ts +2 -2
- package/dist/lib/core/modules/GenerationHandler.js +3 -1
- package/dist/lib/core/modules/MessageBuilder.d.ts +1 -15
- package/dist/lib/core/modules/MessageBuilder.js +0 -14
- package/dist/lib/core/modules/StreamHandler.js +1 -1
- package/dist/lib/core/modules/ToolsManager.d.ts +1 -17
- package/dist/lib/core/modules/ToolsManager.js +1 -17
- package/dist/lib/core/redisConversationMemoryManager.js +0 -6
- package/dist/lib/core/streamAnalytics.js +1 -1
- package/dist/lib/evaluation/contextBuilder.d.ts +1 -4
- package/dist/lib/evaluation/contextBuilder.js +0 -3
- package/dist/lib/evaluation/index.d.ts +1 -4
- package/dist/lib/evaluation/index.js +0 -3
- package/dist/lib/files/fileTools.d.ts +2 -18
- package/dist/lib/files/fileTools.js +3 -19
- package/dist/lib/memory/memoryRetrievalTools.d.ts +2 -126
- package/dist/lib/memory/memoryRetrievalTools.js +1 -9
- package/dist/lib/middleware/builtin/autoEvaluation.d.ts +0 -3
- package/dist/lib/middleware/builtin/autoEvaluation.js +0 -3
- package/dist/lib/middleware/builtin/guardrails.js +1 -1
- package/dist/lib/middleware/builtin/lifecycle.d.ts +0 -9
- package/dist/lib/middleware/builtin/lifecycle.js +0 -9
- package/dist/lib/middleware/factory.d.ts +1 -1
- package/dist/lib/middleware/factory.js +1 -1
- package/dist/lib/middleware/registry.d.ts +1 -1
- package/dist/lib/neurolink.d.ts +14 -2
- package/dist/lib/neurolink.js +46 -18
- package/dist/lib/processors/media/AudioProcessor.js +8 -3
- package/dist/lib/providers/amazonBedrock.js +1 -2
- package/dist/lib/providers/amazonSagemaker.d.ts +1 -7
- package/dist/lib/providers/amazonSagemaker.js +0 -6
- package/dist/lib/providers/anthropic.d.ts +1 -1
- package/dist/lib/providers/anthropic.js +2 -1
- package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/lib/providers/anthropicBaseProvider.js +2 -1
- package/dist/lib/providers/azureOpenai.d.ts +1 -1
- package/dist/lib/providers/azureOpenai.js +2 -1
- package/dist/lib/providers/cloudflare.d.ts +1 -1
- package/dist/lib/providers/cloudflare.js +2 -1
- package/dist/lib/providers/cohere.d.ts +1 -1
- package/dist/lib/providers/cohere.js +2 -1
- package/dist/lib/providers/deepseek.d.ts +1 -1
- package/dist/lib/providers/deepseek.js +2 -1
- package/dist/lib/providers/fireworks.d.ts +1 -1
- package/dist/lib/providers/fireworks.js +2 -1
- package/dist/lib/providers/googleAiStudio.d.ts +1 -1
- package/dist/lib/providers/googleAiStudio.js +82 -6
- package/dist/lib/providers/googleNativeGemini3.d.ts +3 -6
- package/dist/lib/providers/googleNativeGemini3.js +104 -9
- package/dist/lib/providers/googleVertex.d.ts +1 -1
- package/dist/lib/providers/googleVertex.js +466 -165
- package/dist/lib/providers/groq.d.ts +1 -1
- package/dist/lib/providers/groq.js +2 -1
- package/dist/lib/providers/huggingFace.d.ts +1 -1
- package/dist/lib/providers/huggingFace.js +3 -1
- package/dist/lib/providers/ideogram.d.ts +1 -1
- package/dist/lib/providers/jina.d.ts +1 -1
- package/dist/lib/providers/litellm.d.ts +1 -1
- package/dist/lib/providers/litellm.js +12 -6
- package/dist/lib/providers/llamaCpp.d.ts +1 -1
- package/dist/lib/providers/llamaCpp.js +2 -1
- package/dist/lib/providers/lmStudio.d.ts +1 -1
- package/dist/lib/providers/lmStudio.js +2 -1
- package/dist/lib/providers/mistral.d.ts +1 -1
- package/dist/lib/providers/mistral.js +2 -1
- package/dist/lib/providers/nvidiaNim.d.ts +1 -1
- package/dist/lib/providers/nvidiaNim.js +2 -1
- package/dist/lib/providers/ollama.d.ts +1 -1
- package/dist/lib/providers/ollama.js +1 -2
- package/dist/lib/providers/openAI.d.ts +1 -1
- package/dist/lib/providers/openAI.js +3 -1
- package/dist/lib/providers/openRouter.d.ts +1 -1
- package/dist/lib/providers/openRouter.js +3 -1
- package/dist/lib/providers/openaiCompatible.d.ts +1 -1
- package/dist/lib/providers/openaiCompatible.js +3 -1
- package/dist/lib/providers/perplexity.d.ts +1 -1
- package/dist/lib/providers/perplexity.js +2 -1
- package/dist/lib/providers/providerTypeUtils.d.ts +2 -7
- package/dist/lib/providers/providerTypeUtils.js +0 -6
- package/dist/lib/providers/recraft.d.ts +1 -1
- package/dist/lib/providers/replicate.d.ts +1 -1
- package/dist/lib/providers/stability.d.ts +1 -1
- package/dist/lib/providers/togetherAi.d.ts +1 -1
- package/dist/lib/providers/togetherAi.js +2 -1
- package/dist/lib/providers/voyage.d.ts +1 -1
- package/dist/lib/providers/xai.d.ts +1 -1
- package/dist/lib/providers/xai.js +2 -1
- package/dist/lib/proxy/claudeFormat.d.ts +0 -15
- package/dist/lib/proxy/claudeFormat.js +1 -11
- package/dist/lib/rag/ragIntegration.d.ts +1 -12
- package/dist/lib/rag/ragIntegration.js +0 -8
- package/dist/lib/tasks/tools/taskTools.d.ts +2 -117
- package/dist/lib/tasks/tools/taskTools.js +1 -10
- package/dist/lib/types/aliases.d.ts +1 -1
- package/dist/lib/types/conversation.d.ts +17 -0
- package/dist/lib/types/evaluation.d.ts +1 -5
- package/dist/lib/types/evaluation.js +0 -4
- package/dist/lib/types/generate.d.ts +2 -22
- package/dist/lib/types/guardrails.d.ts +1 -1
- package/dist/lib/types/middleware.d.ts +8 -3
- package/dist/lib/types/providers.d.ts +2 -1
- package/dist/lib/types/rag.d.ts +1 -1
- package/dist/lib/types/rag.js +0 -6
- package/dist/lib/types/stream.d.ts +2 -11
- package/dist/lib/types/tools.d.ts +2 -1
- package/dist/lib/utils/generation.d.ts +8 -0
- package/dist/lib/utils/generation.js +9 -0
- package/dist/lib/utils/generationErrors.d.ts +10 -0
- package/dist/lib/utils/generationErrors.js +11 -0
- package/dist/lib/utils/messageBuilder.d.ts +1 -6
- package/dist/lib/utils/messageBuilder.js +0 -5
- package/dist/lib/utils/noOutputSentinel.d.ts +0 -13
- package/dist/lib/utils/noOutputSentinel.js +1 -14
- package/dist/lib/utils/providerRetry.js +1 -1
- package/dist/lib/utils/tool.d.ts +8 -0
- package/dist/lib/utils/tool.js +9 -0
- package/dist/lib/utils/toolCallRepair.d.ts +1 -16
- package/dist/lib/utils/toolCallRepair.js +1 -16
- package/dist/lib/utils/toolChoice.d.ts +1 -1
- package/dist/lib/utils/videoAnalysisProcessor.d.ts +1 -8
- package/dist/lib/utils/videoAnalysisProcessor.js +0 -7
- package/dist/memory/memoryRetrievalTools.d.ts +2 -126
- package/dist/memory/memoryRetrievalTools.js +1 -9
- package/dist/middleware/builtin/autoEvaluation.d.ts +0 -3
- package/dist/middleware/builtin/autoEvaluation.js +0 -3
- package/dist/middleware/builtin/guardrails.js +1 -1
- package/dist/middleware/builtin/lifecycle.d.ts +0 -9
- package/dist/middleware/builtin/lifecycle.js +0 -9
- package/dist/middleware/factory.d.ts +1 -1
- package/dist/middleware/factory.js +1 -1
- package/dist/middleware/registry.d.ts +1 -1
- package/dist/neurolink.d.ts +14 -2
- package/dist/neurolink.js +46 -18
- package/dist/processors/media/AudioProcessor.js +8 -3
- package/dist/providers/amazonBedrock.js +1 -2
- package/dist/providers/amazonSagemaker.d.ts +1 -7
- package/dist/providers/amazonSagemaker.js +0 -6
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +2 -1
- package/dist/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/providers/anthropicBaseProvider.js +2 -1
- package/dist/providers/azureOpenai.d.ts +1 -1
- package/dist/providers/azureOpenai.js +2 -1
- package/dist/providers/cloudflare.d.ts +1 -1
- package/dist/providers/cloudflare.js +2 -1
- package/dist/providers/cohere.d.ts +1 -1
- package/dist/providers/cohere.js +2 -1
- package/dist/providers/deepseek.d.ts +1 -1
- package/dist/providers/deepseek.js +2 -1
- package/dist/providers/fireworks.d.ts +1 -1
- package/dist/providers/fireworks.js +2 -1
- package/dist/providers/googleAiStudio.d.ts +1 -1
- package/dist/providers/googleAiStudio.js +82 -5
- package/dist/providers/googleNativeGemini3.d.ts +3 -6
- package/dist/providers/googleNativeGemini3.js +104 -9
- package/dist/providers/googleVertex.d.ts +1 -1
- package/dist/providers/googleVertex.js +466 -164
- package/dist/providers/groq.d.ts +1 -1
- package/dist/providers/groq.js +2 -1
- package/dist/providers/huggingFace.d.ts +1 -1
- package/dist/providers/huggingFace.js +3 -1
- package/dist/providers/ideogram.d.ts +1 -1
- package/dist/providers/jina.d.ts +1 -1
- package/dist/providers/litellm.d.ts +1 -1
- package/dist/providers/litellm.js +12 -6
- package/dist/providers/llamaCpp.d.ts +1 -1
- package/dist/providers/llamaCpp.js +2 -1
- package/dist/providers/lmStudio.d.ts +1 -1
- package/dist/providers/lmStudio.js +2 -1
- package/dist/providers/mistral.d.ts +1 -1
- package/dist/providers/mistral.js +2 -1
- package/dist/providers/nvidiaNim.d.ts +1 -1
- package/dist/providers/nvidiaNim.js +2 -1
- package/dist/providers/ollama.d.ts +1 -1
- package/dist/providers/ollama.js +1 -2
- package/dist/providers/openAI.d.ts +1 -1
- package/dist/providers/openAI.js +3 -1
- package/dist/providers/openRouter.d.ts +1 -1
- package/dist/providers/openRouter.js +3 -1
- package/dist/providers/openaiCompatible.d.ts +1 -1
- package/dist/providers/openaiCompatible.js +3 -1
- package/dist/providers/perplexity.d.ts +1 -1
- package/dist/providers/perplexity.js +2 -1
- package/dist/providers/providerTypeUtils.d.ts +2 -7
- package/dist/providers/providerTypeUtils.js +0 -6
- package/dist/providers/recraft.d.ts +1 -1
- package/dist/providers/replicate.d.ts +1 -1
- package/dist/providers/stability.d.ts +1 -1
- package/dist/providers/togetherAi.d.ts +1 -1
- package/dist/providers/togetherAi.js +2 -1
- package/dist/providers/voyage.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +2 -1
- package/dist/proxy/claudeFormat.d.ts +0 -15
- package/dist/proxy/claudeFormat.js +1 -11
- package/dist/rag/ragIntegration.d.ts +1 -12
- package/dist/rag/ragIntegration.js +0 -8
- package/dist/tasks/tools/taskTools.d.ts +2 -117
- package/dist/tasks/tools/taskTools.js +1 -10
- package/dist/types/aliases.d.ts +1 -1
- package/dist/types/conversation.d.ts +17 -0
- package/dist/types/evaluation.d.ts +1 -5
- package/dist/types/evaluation.js +0 -4
- package/dist/types/generate.d.ts +2 -22
- package/dist/types/guardrails.d.ts +1 -1
- package/dist/types/middleware.d.ts +8 -3
- package/dist/types/providers.d.ts +2 -1
- package/dist/types/rag.d.ts +1 -1
- package/dist/types/rag.js +0 -6
- package/dist/types/stream.d.ts +2 -11
- package/dist/types/tools.d.ts +2 -1
- package/dist/utils/generation.d.ts +8 -0
- package/dist/utils/generation.js +8 -0
- package/dist/utils/generationErrors.d.ts +10 -0
- package/dist/utils/generationErrors.js +10 -0
- package/dist/utils/messageBuilder.d.ts +1 -6
- package/dist/utils/messageBuilder.js +0 -5
- package/dist/utils/noOutputSentinel.d.ts +0 -13
- package/dist/utils/noOutputSentinel.js +1 -14
- package/dist/utils/providerRetry.js +1 -1
- package/dist/utils/tool.d.ts +8 -0
- package/dist/utils/tool.js +8 -0
- package/dist/utils/toolCallRepair.d.ts +1 -16
- package/dist/utils/toolCallRepair.js +1 -16
- package/dist/utils/toolChoice.d.ts +1 -1
- package/dist/utils/videoAnalysisProcessor.d.ts +1 -8
- package/dist/utils/videoAnalysisProcessor.js +0 -7
- package/package.json +2 -3
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module autoresearch/tools
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { ResearchToolsDeps, Tool } from "../types/index.js";
|
|
11
11
|
/**
|
|
12
12
|
* Create research management tools bound to a research session.
|
|
13
13
|
*
|
|
@@ -24,216 +24,4 @@ import type { ExperimentRecord, ResearchToolsDeps } from "../types/index.js";
|
|
|
24
24
|
* // tools.research_get_context, tools.research_read_file, etc.
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export declare function createResearchTools(deps: ResearchToolsDeps):
|
|
28
|
-
/**
|
|
29
|
-
* Get current research context including state, config, and recent results.
|
|
30
|
-
*/
|
|
31
|
-
research_get_context: import("ai").Tool<Record<string, never>, {
|
|
32
|
-
success: boolean;
|
|
33
|
-
error: string;
|
|
34
|
-
branch?: undefined;
|
|
35
|
-
acceptedCommit?: undefined;
|
|
36
|
-
bestMetric?: undefined;
|
|
37
|
-
recentResults?: undefined;
|
|
38
|
-
mutablePaths?: undefined;
|
|
39
|
-
immutablePaths?: undefined;
|
|
40
|
-
currentPhase?: undefined;
|
|
41
|
-
runCount?: undefined;
|
|
42
|
-
tag?: undefined;
|
|
43
|
-
keepCount?: undefined;
|
|
44
|
-
} | {
|
|
45
|
-
success: boolean;
|
|
46
|
-
branch: string;
|
|
47
|
-
acceptedCommit: string | null;
|
|
48
|
-
bestMetric: number | null;
|
|
49
|
-
recentResults: ExperimentRecord[];
|
|
50
|
-
mutablePaths: string[];
|
|
51
|
-
immutablePaths: string[];
|
|
52
|
-
currentPhase: import("../types/autoresearch.js").ExperimentPhase;
|
|
53
|
-
runCount: number;
|
|
54
|
-
tag: string;
|
|
55
|
-
keepCount: number;
|
|
56
|
-
error?: undefined;
|
|
57
|
-
}>;
|
|
58
|
-
/**
|
|
59
|
-
* Read a file from the repository if allowed by policy.
|
|
60
|
-
*/
|
|
61
|
-
research_read_file: import("ai").Tool<{
|
|
62
|
-
path: string;
|
|
63
|
-
}, {
|
|
64
|
-
success: boolean;
|
|
65
|
-
error: string;
|
|
66
|
-
path?: undefined;
|
|
67
|
-
content?: undefined;
|
|
68
|
-
} | {
|
|
69
|
-
success: boolean;
|
|
70
|
-
path: string;
|
|
71
|
-
content: string;
|
|
72
|
-
error?: undefined;
|
|
73
|
-
} | {
|
|
74
|
-
success: boolean;
|
|
75
|
-
error: string;
|
|
76
|
-
path: string;
|
|
77
|
-
content?: undefined;
|
|
78
|
-
}>;
|
|
79
|
-
/**
|
|
80
|
-
* Write a candidate file to the repository if allowed by policy.
|
|
81
|
-
*/
|
|
82
|
-
research_write_candidate: import("ai").Tool<{
|
|
83
|
-
path: string;
|
|
84
|
-
content: string;
|
|
85
|
-
}, {
|
|
86
|
-
success: boolean;
|
|
87
|
-
error: string;
|
|
88
|
-
path?: undefined;
|
|
89
|
-
bytesWritten?: undefined;
|
|
90
|
-
} | {
|
|
91
|
-
success: boolean;
|
|
92
|
-
path: string;
|
|
93
|
-
bytesWritten: number;
|
|
94
|
-
error?: undefined;
|
|
95
|
-
} | {
|
|
96
|
-
success: boolean;
|
|
97
|
-
error: string;
|
|
98
|
-
path: string;
|
|
99
|
-
bytesWritten?: undefined;
|
|
100
|
-
}>;
|
|
101
|
-
/**
|
|
102
|
-
* Get git diff of mutable paths only.
|
|
103
|
-
*/
|
|
104
|
-
research_diff: import("ai").Tool<Record<string, never>, {
|
|
105
|
-
success: boolean;
|
|
106
|
-
diff: string;
|
|
107
|
-
hasChanges: boolean;
|
|
108
|
-
error?: undefined;
|
|
109
|
-
} | {
|
|
110
|
-
success: boolean;
|
|
111
|
-
error: string;
|
|
112
|
-
diff?: undefined;
|
|
113
|
-
hasChanges?: undefined;
|
|
114
|
-
}>;
|
|
115
|
-
/**
|
|
116
|
-
* Commit staged changes as a candidate.
|
|
117
|
-
*/
|
|
118
|
-
research_commit_candidate: import("ai").Tool<{
|
|
119
|
-
message: string;
|
|
120
|
-
}, {
|
|
121
|
-
success: boolean;
|
|
122
|
-
error: string;
|
|
123
|
-
violations?: undefined;
|
|
124
|
-
candidateCommit?: undefined;
|
|
125
|
-
message?: undefined;
|
|
126
|
-
} | {
|
|
127
|
-
success: boolean;
|
|
128
|
-
error: string;
|
|
129
|
-
violations: string[];
|
|
130
|
-
candidateCommit?: undefined;
|
|
131
|
-
message?: undefined;
|
|
132
|
-
} | {
|
|
133
|
-
success: boolean;
|
|
134
|
-
candidateCommit: string;
|
|
135
|
-
message: string;
|
|
136
|
-
error?: undefined;
|
|
137
|
-
violations?: undefined;
|
|
138
|
-
}>;
|
|
139
|
-
/**
|
|
140
|
-
* Run the experiment.
|
|
141
|
-
*/
|
|
142
|
-
research_run_experiment: import("ai").Tool<{
|
|
143
|
-
description: string;
|
|
144
|
-
}, {
|
|
145
|
-
success: boolean;
|
|
146
|
-
description: string;
|
|
147
|
-
summary: import("../types/autoresearch.js").ExperimentSummary;
|
|
148
|
-
error?: undefined;
|
|
149
|
-
} | {
|
|
150
|
-
success: boolean;
|
|
151
|
-
error: string;
|
|
152
|
-
description?: undefined;
|
|
153
|
-
summary?: undefined;
|
|
154
|
-
}>;
|
|
155
|
-
/**
|
|
156
|
-
* Parse the experiment log file.
|
|
157
|
-
*/
|
|
158
|
-
research_parse_log: import("ai").Tool<Record<string, never>, {
|
|
159
|
-
success: boolean;
|
|
160
|
-
summary: import("../types/autoresearch.js").ExperimentSummary;
|
|
161
|
-
error?: undefined;
|
|
162
|
-
} | {
|
|
163
|
-
success: boolean;
|
|
164
|
-
error: string;
|
|
165
|
-
summary?: undefined;
|
|
166
|
-
}>;
|
|
167
|
-
/**
|
|
168
|
-
* Record an experiment result.
|
|
169
|
-
*/
|
|
170
|
-
research_record: import("ai").Tool<{
|
|
171
|
-
description: string;
|
|
172
|
-
}, {
|
|
173
|
-
success: boolean;
|
|
174
|
-
error: string;
|
|
175
|
-
record?: undefined;
|
|
176
|
-
} | {
|
|
177
|
-
success: boolean;
|
|
178
|
-
record: ExperimentRecord;
|
|
179
|
-
error?: undefined;
|
|
180
|
-
}>;
|
|
181
|
-
/**
|
|
182
|
-
* Accept the candidate commit as the new baseline.
|
|
183
|
-
*/
|
|
184
|
-
research_accept: import("ai").Tool<Record<string, never>, {
|
|
185
|
-
success: boolean;
|
|
186
|
-
error: string;
|
|
187
|
-
acceptedCommit?: undefined;
|
|
188
|
-
bestMetric?: undefined;
|
|
189
|
-
keepCount?: undefined;
|
|
190
|
-
} | {
|
|
191
|
-
success: boolean;
|
|
192
|
-
acceptedCommit: string;
|
|
193
|
-
bestMetric: number;
|
|
194
|
-
keepCount: number;
|
|
195
|
-
error?: undefined;
|
|
196
|
-
}>;
|
|
197
|
-
/**
|
|
198
|
-
* Revert to the accepted commit.
|
|
199
|
-
*/
|
|
200
|
-
research_revert: import("ai").Tool<Record<string, never>, {
|
|
201
|
-
success: boolean;
|
|
202
|
-
error: string;
|
|
203
|
-
revertedTo?: undefined;
|
|
204
|
-
} | {
|
|
205
|
-
success: boolean;
|
|
206
|
-
revertedTo: string;
|
|
207
|
-
error?: undefined;
|
|
208
|
-
}>;
|
|
209
|
-
/**
|
|
210
|
-
* Inspect the last 50 lines of the run log for debugging.
|
|
211
|
-
*/
|
|
212
|
-
research_inspect_failure: import("ai").Tool<Record<string, never>, {
|
|
213
|
-
success: boolean;
|
|
214
|
-
tail: string;
|
|
215
|
-
totalLines: number;
|
|
216
|
-
error?: undefined;
|
|
217
|
-
} | {
|
|
218
|
-
success: boolean;
|
|
219
|
-
error: string;
|
|
220
|
-
tail?: undefined;
|
|
221
|
-
totalLines?: undefined;
|
|
222
|
-
}>;
|
|
223
|
-
/**
|
|
224
|
-
* Save the current state to disk.
|
|
225
|
-
*/
|
|
226
|
-
research_checkpoint: import("ai").Tool<Record<string, never>, {
|
|
227
|
-
success: boolean;
|
|
228
|
-
error: string;
|
|
229
|
-
checkpointedAt?: undefined;
|
|
230
|
-
phase?: undefined;
|
|
231
|
-
runCount?: undefined;
|
|
232
|
-
} | {
|
|
233
|
-
success: boolean;
|
|
234
|
-
checkpointedAt: string;
|
|
235
|
-
phase: import("../types/autoresearch.js").ExperimentPhase;
|
|
236
|
-
runCount: number;
|
|
237
|
-
error?: undefined;
|
|
238
|
-
}>;
|
|
239
|
-
};
|
|
27
|
+
export declare function createResearchTools(deps: ResearchToolsDeps): Record<string, Tool>;
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
import { execFileSync } from "node:child_process";
|
|
11
11
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
13
|
-
import { tool } from "ai";
|
|
14
13
|
import { z } from "zod";
|
|
15
14
|
import { withTimeout } from "../utils/errorHandling.js";
|
|
16
15
|
import { logger } from "../utils/logger.js";
|
|
17
16
|
import { parseExperimentSummary } from "./summaryParser.js";
|
|
17
|
+
import { tool } from "../utils/tool.js";
|
|
18
18
|
/**
|
|
19
19
|
* Create research management tools bound to a research session.
|
|
20
20
|
*
|
|
@@ -254,8 +254,9 @@ export function useChat(options = {}) {
|
|
|
254
254
|
*/
|
|
255
255
|
const handleSubmit = useCallback((e, submitOptions) => {
|
|
256
256
|
e?.preventDefault?.();
|
|
257
|
-
if (!input.trim())
|
|
257
|
+
if (!input.trim()) {
|
|
258
258
|
return;
|
|
259
|
+
}
|
|
259
260
|
const message = {
|
|
260
261
|
role: "user",
|
|
261
262
|
content: input,
|
|
@@ -271,8 +272,9 @@ export function useChat(options = {}) {
|
|
|
271
272
|
// Read from the ref so we always have the latest messages
|
|
272
273
|
const currentMessages = messagesRef.current;
|
|
273
274
|
const lastUserMessageIndex = currentMessages.findLastIndex((m) => m.role === "user");
|
|
274
|
-
if (lastUserMessageIndex === -1)
|
|
275
|
+
if (lastUserMessageIndex === -1) {
|
|
275
276
|
return null;
|
|
277
|
+
}
|
|
276
278
|
const lastUserMessage = currentMessages[lastUserMessageIndex];
|
|
277
279
|
// Remove messages after the last user message
|
|
278
280
|
setMessages((prev) => prev.slice(0, lastUserMessageIndex));
|
|
@@ -742,8 +744,9 @@ export function useVoice(options = {}) {
|
|
|
742
744
|
const synthesisRef = useRef(null);
|
|
743
745
|
// Check browser support
|
|
744
746
|
const isSupported = useMemo(() => {
|
|
745
|
-
if (typeof window === "undefined")
|
|
747
|
+
if (typeof window === "undefined") {
|
|
746
748
|
return false;
|
|
749
|
+
}
|
|
747
750
|
const hasSpeechRecognition = "SpeechRecognition" in window || "webkitSpeechRecognition" in window;
|
|
748
751
|
const hasSpeechSynthesis = "speechSynthesis" in window;
|
|
749
752
|
return hasSpeechRecognition || hasSpeechSynthesis;
|
|
@@ -752,12 +755,14 @@ export function useVoice(options = {}) {
|
|
|
752
755
|
* Initialize speech recognition
|
|
753
756
|
*/
|
|
754
757
|
const initRecognition = useCallback(() => {
|
|
755
|
-
if (typeof window === "undefined")
|
|
758
|
+
if (typeof window === "undefined") {
|
|
756
759
|
return null;
|
|
760
|
+
}
|
|
757
761
|
const SpeechRecognitionCtor = window.SpeechRecognition ||
|
|
758
762
|
window.webkitSpeechRecognition;
|
|
759
|
-
if (!SpeechRecognitionCtor)
|
|
763
|
+
if (!SpeechRecognitionCtor) {
|
|
760
764
|
return null;
|
|
765
|
+
}
|
|
761
766
|
const recognition = new SpeechRecognitionCtor();
|
|
762
767
|
recognition.continuous = true;
|
|
763
768
|
recognition.interimResults = true;
|
|
@@ -795,8 +800,9 @@ export function useVoice(options = {}) {
|
|
|
795
800
|
* Start listening for voice input
|
|
796
801
|
*/
|
|
797
802
|
const startListening = useCallback(() => {
|
|
798
|
-
if (!enableSpeechRecognition)
|
|
803
|
+
if (!enableSpeechRecognition) {
|
|
799
804
|
return;
|
|
805
|
+
}
|
|
800
806
|
if (!recognitionRef.current) {
|
|
801
807
|
recognitionRef.current = initRecognition();
|
|
802
808
|
}
|
|
@@ -820,8 +826,9 @@ export function useVoice(options = {}) {
|
|
|
820
826
|
* Speak text using TTS
|
|
821
827
|
*/
|
|
822
828
|
const speak = useCallback(async (text) => {
|
|
823
|
-
if (typeof window === "undefined")
|
|
829
|
+
if (typeof window === "undefined") {
|
|
824
830
|
return;
|
|
831
|
+
}
|
|
825
832
|
setIsSpeaking(true);
|
|
826
833
|
onSpeechStart?.();
|
|
827
834
|
try {
|
|
@@ -1002,8 +1009,9 @@ export function useStream(options = {}) {
|
|
|
1002
1009
|
let fullText = "";
|
|
1003
1010
|
while (true) {
|
|
1004
1011
|
const { done, value } = await reader.read();
|
|
1005
|
-
if (done)
|
|
1012
|
+
if (done) {
|
|
1006
1013
|
break;
|
|
1014
|
+
}
|
|
1007
1015
|
buffer += decoder.decode(value, { stream: true });
|
|
1008
1016
|
const lines = buffer.split("\n");
|
|
1009
1017
|
buffer = lines.pop() ?? "";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { LanguageModel, ModelMessage, Tool, ToolCallRepairFunction, ToolSet } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import type { EvaluationData } from "../index.js";
|
|
4
3
|
import type { NeuroLink } from "../neurolink.js";
|
|
5
4
|
import type { UnknownRecord, MiddlewareFactoryOptions, StreamOptions, StreamResult, AIProvider, AnalyticsData, EnhancedGenerateResult, TextGenerationOptions, TextGenerationResult, ValidationSchema } from "../types/index.js";
|
|
6
5
|
import { TelemetryHandler } from "./modules/TelemetryHandler.js";
|
|
6
|
+
import type { LanguageModel, ModelMessage, Tool, ToolCallRepairFunction, ToolSet } from "../types/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* Abstract base class for all AI providers
|
|
9
9
|
* Tools are integrated as first-class citizens - always available by default
|
|
@@ -20,11 +20,6 @@ export declare abstract class BaseProvider implements AIProvider {
|
|
|
20
20
|
protected sessionId?: string;
|
|
21
21
|
protected userId?: string;
|
|
22
22
|
protected neurolink?: NeuroLink;
|
|
23
|
-
/** @internal Trace context propagated from NeuroLink SDK for span hierarchy */
|
|
24
|
-
protected _traceContext: {
|
|
25
|
-
traceId: string;
|
|
26
|
-
parentSpanId: string;
|
|
27
|
-
} | null;
|
|
28
23
|
setTraceContext(ctx: {
|
|
29
24
|
traceId: string;
|
|
30
25
|
parentSpanId: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { context, SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
2
|
-
import { generateText } from "ai";
|
|
3
2
|
import { directAgentTools } from "../agent/directTools.js";
|
|
4
3
|
import { IMAGE_GENERATION_MODELS } from "../core/constants.js";
|
|
5
4
|
import { MiddlewareFactory } from "../middleware/factory.js";
|
|
@@ -21,6 +20,7 @@ import { StreamHandler } from "./modules/StreamHandler.js";
|
|
|
21
20
|
import { TelemetryHandler } from "./modules/TelemetryHandler.js";
|
|
22
21
|
import { ToolsManager } from "./modules/ToolsManager.js";
|
|
23
22
|
import { Utilities } from "./modules/Utilities.js";
|
|
23
|
+
import { generateText } from "../utils/generation.js";
|
|
24
24
|
/**
|
|
25
25
|
* Abstract base class for all AI providers
|
|
26
26
|
* Tools are integrated as first-class citizens - always available by default
|
|
@@ -21,6 +21,7 @@ export declare const DEFAULT_TEMPERATURE = 0.7;
|
|
|
21
21
|
export declare const DEFAULT_TIMEOUT = 60000;
|
|
22
22
|
export declare const DEFAULT_MAX_STEPS = 200;
|
|
23
23
|
export declare const DEFAULT_TOOL_MAX_RETRIES = 2;
|
|
24
|
+
export declare const TOOL_STORAGE_TIMEOUT_MS = 5000;
|
|
24
25
|
export declare const STEP_LIMITS: {
|
|
25
26
|
min: number;
|
|
26
27
|
max: number;
|
|
@@ -107,6 +107,9 @@ export const DEFAULT_TEMPERATURE = 0.7;
|
|
|
107
107
|
export const DEFAULT_TIMEOUT = 60000;
|
|
108
108
|
export const DEFAULT_MAX_STEPS = 200;
|
|
109
109
|
export const DEFAULT_TOOL_MAX_RETRIES = 2; // Maximum retries per tool before permanently failing
|
|
110
|
+
// Fire-and-forget tool storage writes (Redis). 5s is generous for a single
|
|
111
|
+
// Redis write; if breached, the .catch logs a warning.
|
|
112
|
+
export const TOOL_STORAGE_TIMEOUT_MS = 5000;
|
|
110
113
|
// Step execution limits
|
|
111
114
|
export const STEP_LIMITS = {
|
|
112
115
|
min: 1,
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @module core/modules/GenerationHandler
|
|
14
14
|
*/
|
|
15
|
-
import type { LanguageModel, ModelMessage, Tool } from "ai";
|
|
16
|
-
import { generateText } from "ai";
|
|
17
15
|
import type { AIProviderName, EnhancedGenerateResult, NeuroLinkEvents, StandardRecord, TextGenerationOptions, TypedEventEmitter } from "../../types/index.js";
|
|
16
|
+
import type { LanguageModel, ModelMessage, Tool } from "../../types/index.js";
|
|
17
|
+
import { generateText } from "../../utils/generation.js";
|
|
18
18
|
/**
|
|
19
19
|
* GenerationHandler class - Handles text generation operations for AI providers
|
|
20
20
|
*/
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* @module core/modules/GenerationHandler
|
|
14
14
|
*/
|
|
15
15
|
import { SpanKind, SpanStatusCode } from "@opentelemetry/api";
|
|
16
|
-
import { generateText, NoObjectGeneratedError, Output, stepCountIs } from "ai";
|
|
17
16
|
import { getModelId } from "../../providers/providerTypeUtils.js";
|
|
18
17
|
import { tracers } from "../../telemetry/tracers.js";
|
|
19
18
|
import { logger } from "../../utils/logger.js";
|
|
@@ -22,6 +21,9 @@ import { calculateCost } from "../../utils/pricing.js";
|
|
|
22
21
|
import { withProviderRetry } from "../../utils/providerRetry.js";
|
|
23
22
|
import { calculateCacheSavingsPercent, extractCacheCreationTokens, extractCacheReadTokens, extractTokenUsage, } from "../../utils/tokenUtils.js";
|
|
24
23
|
import { DEFAULT_MAX_STEPS } from "../constants.js";
|
|
24
|
+
import { NoObjectGeneratedError } from "../../utils/generationErrors.js";
|
|
25
|
+
import { Output, stepCountIs } from "../../utils/tool.js";
|
|
26
|
+
import { generateText } from "../../utils/generation.js";
|
|
25
27
|
const genTracer = tracers.generation;
|
|
26
28
|
/**
|
|
27
29
|
* Safely preview-serialize a value for debug logging.
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message Builder Module
|
|
3
|
-
*
|
|
4
|
-
* Handles all message construction logic for AI providers.
|
|
5
|
-
* Extracted from BaseProvider to follow Single Responsibility Principle.
|
|
6
|
-
*
|
|
7
|
-
* Responsibilities:
|
|
8
|
-
* - Building messages from text generation options
|
|
9
|
-
* - Building messages from stream options
|
|
10
|
-
* - Multimodal input detection
|
|
11
|
-
* - Message format conversion (to ModelMessage[])
|
|
12
|
-
*
|
|
13
|
-
* @module core/modules/MessageBuilder
|
|
14
|
-
*/
|
|
15
|
-
import type { ModelMessage } from "ai";
|
|
16
1
|
import type { AIProviderName, TextGenerationOptions, StreamOptions } from "../../types/index.js";
|
|
2
|
+
import type { ModelMessage } from "../../types/index.js";
|
|
17
3
|
/**
|
|
18
4
|
* MessageBuilder class - Handles message construction for AI providers
|
|
19
5
|
*/
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message Builder Module
|
|
3
|
-
*
|
|
4
|
-
* Handles all message construction logic for AI providers.
|
|
5
|
-
* Extracted from BaseProvider to follow Single Responsibility Principle.
|
|
6
|
-
*
|
|
7
|
-
* Responsibilities:
|
|
8
|
-
* - Building messages from text generation options
|
|
9
|
-
* - Building messages from stream options
|
|
10
|
-
* - Multimodal input detection
|
|
11
|
-
* - Message format conversion (to ModelMessage[])
|
|
12
|
-
*
|
|
13
|
-
* @module core/modules/MessageBuilder
|
|
14
|
-
*/
|
|
15
1
|
import { tracers, ATTR, withSpan } from "../../telemetry/index.js";
|
|
16
2
|
import { logger } from "../../utils/logger.js";
|
|
17
3
|
import { buildMessagesArray, buildMultimodalMessagesArray, } from "../../utils/messageBuilder.js";
|
|
@@ -20,7 +20,7 @@ import { buildNoOutputSentinel, detectPostStreamNoOutput, stampNoOutputSpan, } f
|
|
|
20
20
|
import { STEP_LIMITS } from "../constants.js";
|
|
21
21
|
import { createAnalytics } from "../analytics.js";
|
|
22
22
|
import { nanoid } from "nanoid";
|
|
23
|
-
import { NoOutputGeneratedError } from "
|
|
23
|
+
import { NoOutputGeneratedError } from "../../utils/generationErrors.js";
|
|
24
24
|
/**
|
|
25
25
|
* StreamHandler class - Handles streaming operations for AI providers
|
|
26
26
|
*/
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tools Manager Module
|
|
3
|
-
*
|
|
4
|
-
* Handles all tool registration, discovery, and execution for AI providers.
|
|
5
|
-
* Extracted from BaseProvider to follow Single Responsibility Principle.
|
|
6
|
-
*
|
|
7
|
-
* Responsibilities:
|
|
8
|
-
* - Tool registration (direct, custom, MCP, external MCP)
|
|
9
|
-
* - Tool discovery and aggregation
|
|
10
|
-
* - Tool creation from definitions and schemas
|
|
11
|
-
* - Tool executor setup
|
|
12
|
-
* - Session context management for MCP tools
|
|
13
|
-
* - Event emission wrapping for tool execution
|
|
14
|
-
*
|
|
15
|
-
* @module core/modules/ToolsManager
|
|
16
|
-
*/
|
|
17
|
-
import type { Tool } from "ai";
|
|
18
1
|
import type { AIProviderName, ToolUtilities } from "../../types/index.js";
|
|
19
2
|
import type { NeuroLink } from "../../neurolink.js";
|
|
3
|
+
import type { Tool } from "../../types/index.js";
|
|
20
4
|
/**
|
|
21
5
|
* ToolsManager class - Handles all tool management operations
|
|
22
6
|
*/
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tools Manager Module
|
|
3
|
-
*
|
|
4
|
-
* Handles all tool registration, discovery, and execution for AI providers.
|
|
5
|
-
* Extracted from BaseProvider to follow Single Responsibility Principle.
|
|
6
|
-
*
|
|
7
|
-
* Responsibilities:
|
|
8
|
-
* - Tool registration (direct, custom, MCP, external MCP)
|
|
9
|
-
* - Tool discovery and aggregation
|
|
10
|
-
* - Tool creation from definitions and schemas
|
|
11
|
-
* - Tool executor setup
|
|
12
|
-
* - Session context management for MCP tools
|
|
13
|
-
* - Event emission wrapping for tool execution
|
|
14
|
-
*
|
|
15
|
-
* @module core/modules/ToolsManager
|
|
16
|
-
*/
|
|
17
|
-
import { tool as createAISDKTool, jsonSchema } from "ai";
|
|
18
1
|
import { z } from "zod";
|
|
19
2
|
import { createToolEventPayload } from "../toolEvents.js";
|
|
20
3
|
import { tracers, ATTR, withSpan } from "../../telemetry/index.js";
|
|
@@ -23,6 +6,7 @@ import { logger } from "../../utils/logger.js";
|
|
|
23
6
|
import { getKeyCount } from "../../utils/transformationUtils.js";
|
|
24
7
|
import { convertJsonSchemaToZod } from "../../utils/schemaConversion.js";
|
|
25
8
|
import { generateToolOutputPreview } from "../../context/toolOutputLimits.js";
|
|
9
|
+
import { tool as createAISDKTool, jsonSchema } from "../../utils/tool.js";
|
|
26
10
|
/**
|
|
27
11
|
* ToolsManager class - Handles all tool management operations
|
|
28
12
|
*/
|
|
@@ -951,12 +951,6 @@ User message: "${userMessage}"`;
|
|
|
951
951
|
provider: this.config.summarizationProvider || "vertex",
|
|
952
952
|
model: this.config.summarizationModel || "gemini-2.5-flash",
|
|
953
953
|
disableTools: true, // Title generation doesn't need tools — saves ~600 tokens of tool descriptions
|
|
954
|
-
// A 20-25 letter title is well under 64 tokens; capping prevents
|
|
955
|
-
// Vertex 400 INVALID_ARGUMENT — Gemini 2.5 Flash on the native
|
|
956
|
-
// @google/genai SDK rejects requests with no maxOutputTokens cap
|
|
957
|
-
// when the prompt is short, which silently broke every
|
|
958
|
-
// `conversationMemory.enabled + context` test path.
|
|
959
|
-
maxTokens: 64,
|
|
960
954
|
});
|
|
961
955
|
// Clean up the generated title
|
|
962
956
|
let title = result.content?.trim() || "New Conversation";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createAnalytics } from "./analytics.js";
|
|
2
2
|
import { logger } from "../utils/logger.js";
|
|
3
3
|
import { extractTokenUsage, createEmptyTokenUsage, } from "../utils/tokenUtils.js";
|
|
4
|
-
import { NoOutputGeneratedError } from "
|
|
4
|
+
import { NoOutputGeneratedError } from "../utils/generationErrors.js";
|
|
5
5
|
/**
|
|
6
6
|
* Base implementation for collecting analytics from Vercel AI SDK stream results
|
|
7
7
|
*/
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Implements the ContextBuilder class for creating rich evaluation context.
|
|
3
|
-
*/
|
|
4
|
-
import type { LanguageModelV3CallOptions } from "@ai-sdk/provider";
|
|
5
1
|
import type { EnhancedEvaluationContext, EvaluationResult, GenerateResult } from "../types/index.js";
|
|
2
|
+
import type { LanguageModelV3CallOptions } from "../types/index.js";
|
|
6
3
|
/**
|
|
7
4
|
* Builds the enhanced context required for a RAGAS-style evaluation.
|
|
8
5
|
* This class gathers data from the generation options and results to create a
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file This file exports the main Evaluator class, which serves as the central entry point for the evaluation system.
|
|
3
|
-
*/
|
|
4
|
-
import type { LanguageModelV3CallOptions } from "@ai-sdk/provider";
|
|
5
1
|
import type { EvaluationData, GenerateResult, AutoEvaluationConfig, EvaluationConfig } from "../types/index.js";
|
|
2
|
+
import type { LanguageModelV3CallOptions } from "../types/index.js";
|
|
6
3
|
export * from "./errors/index.js";
|
|
7
4
|
export * from "./hooks/index.js";
|
|
8
5
|
export * from "./pipeline/index.js";
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file This file exports the main Evaluator class, which serves as the central entry point for the evaluation system.
|
|
3
|
-
*/
|
|
4
1
|
import { ContextBuilder } from "./contextBuilder.js";
|
|
5
2
|
import { RAGASEvaluator } from "./ragasEvaluator.js";
|
|
6
3
|
import { mapToEvaluationData } from "./scoring.js";
|
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* On-Demand File Access Tools
|
|
3
|
-
*
|
|
4
|
-
* Exposes file operations as LLM tools via the Vercel AI SDK `tool()` pattern.
|
|
5
|
-
* These tools allow the LLM to access file content lazily — only reading
|
|
6
|
-
* the specific sections, lines, or search results it needs.
|
|
7
|
-
*
|
|
8
|
-
* Tools:
|
|
9
|
-
* - list_attached_files: List all registered files with metadata
|
|
10
|
-
* - read_file_section: Read specific line range with token budget
|
|
11
|
-
* - search_in_file: Search for patterns within a file
|
|
12
|
-
* - get_file_preview: Get the preview/summary of a file
|
|
13
|
-
* - extract_file_content: Targeted extraction for any file type (video frames,
|
|
14
|
-
* PDF pages, spreadsheet ranges, archive entries, PPTX slides)
|
|
15
|
-
*
|
|
16
|
-
* @module files/fileTools
|
|
17
|
-
*/
|
|
18
1
|
import type { FileReferenceRegistry } from "./fileReferenceRegistry.js";
|
|
19
2
|
/**
|
|
20
3
|
* Create file access tools bound to a FileReferenceRegistry instance.
|
|
21
4
|
*
|
|
22
5
|
* These tools follow the same pattern as the existing directAgentTools
|
|
23
6
|
* (getCurrentTime, readFile, etc.) in src/lib/agent/directTools.ts.
|
|
24
|
-
* They use `tool()` from
|
|
7
|
+
* They use NeuroLink's `tool()` helper from `../utils/tool.js` with Zod
|
|
8
|
+
* parameter schemas.
|
|
25
9
|
*
|
|
26
10
|
* @param registry - The FileReferenceRegistry instance to bind to
|
|
27
11
|
* @returns Record of tool name to tool definition
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* On-Demand File Access Tools
|
|
3
|
-
*
|
|
4
|
-
* Exposes file operations as LLM tools via the Vercel AI SDK `tool()` pattern.
|
|
5
|
-
* These tools allow the LLM to access file content lazily — only reading
|
|
6
|
-
* the specific sections, lines, or search results it needs.
|
|
7
|
-
*
|
|
8
|
-
* Tools:
|
|
9
|
-
* - list_attached_files: List all registered files with metadata
|
|
10
|
-
* - read_file_section: Read specific line range with token budget
|
|
11
|
-
* - search_in_file: Search for patterns within a file
|
|
12
|
-
* - get_file_preview: Get the preview/summary of a file
|
|
13
|
-
* - extract_file_content: Targeted extraction for any file type (video frames,
|
|
14
|
-
* PDF pages, spreadsheet ranges, archive entries, PPTX slides)
|
|
15
|
-
*
|
|
16
|
-
* @module files/fileTools
|
|
17
|
-
*/
|
|
18
|
-
import { tool } from "ai";
|
|
19
1
|
import { z } from "zod";
|
|
2
|
+
import { tool } from "../utils/tool.js";
|
|
20
3
|
/**
|
|
21
4
|
* Create file access tools bound to a FileReferenceRegistry instance.
|
|
22
5
|
*
|
|
23
6
|
* These tools follow the same pattern as the existing directAgentTools
|
|
24
7
|
* (getCurrentTime, readFile, etc.) in src/lib/agent/directTools.ts.
|
|
25
|
-
* They use `tool()` from
|
|
8
|
+
* They use NeuroLink's `tool()` helper from `../utils/tool.js` with Zod
|
|
9
|
+
* parameter schemas.
|
|
26
10
|
*
|
|
27
11
|
* @param registry - The FileReferenceRegistry instance to bind to
|
|
28
12
|
* @returns Record of tool name to tool definition
|