@probelabs/probe 0.6.0-rc166 → 0.6.0-rc167
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/README.md +39 -0
- package/build/agent/ProbeAgent.js +291 -3
- package/build/agent/engines/enhanced-claude-code.js +595 -0
- package/build/agent/engines/enhanced-vercel.js +83 -0
- package/build/agent/engines/vercel.js +62 -0
- package/build/agent/index.js +1291 -161
- package/build/agent/mcp/built-in-server.js +464 -0
- package/cjs/agent/ProbeAgent.cjs +8979 -6698
- package/cjs/index.cjs +9030 -6749
- package/package.json +2 -1
- package/src/agent/ProbeAgent.js +291 -3
- package/src/agent/engines/enhanced-claude-code.js +595 -0
- package/src/agent/engines/enhanced-vercel.js +83 -0
- package/src/agent/engines/vercel.js +62 -0
- package/src/agent/mcp/built-in-server.js +464 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel AI SDK Engine - wraps existing ProbeAgent logic
|
|
3
|
+
* This maintains full backward compatibility
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { streamText } from 'ai';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Create a Vercel AI SDK engine
|
|
10
|
+
* @param {Object} agent - The ProbeAgent instance
|
|
11
|
+
* @returns {Object} Engine interface
|
|
12
|
+
*/
|
|
13
|
+
export function createVercelEngine(agent) {
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
* Query the model using existing Vercel AI SDK implementation
|
|
17
|
+
* @param {string} prompt - The prompt to send
|
|
18
|
+
* @param {Object} options - Additional options
|
|
19
|
+
* @returns {AsyncIterable} Response stream
|
|
20
|
+
*/
|
|
21
|
+
async *query(prompt, options = {}) {
|
|
22
|
+
// Build messages array
|
|
23
|
+
const messages = [
|
|
24
|
+
...agent.history,
|
|
25
|
+
{ role: 'user', content: prompt }
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
// Use existing streamText with retry and fallback
|
|
29
|
+
const result = await agent.streamTextWithRetryAndFallback({
|
|
30
|
+
model: agent.provider(agent.model),
|
|
31
|
+
messages,
|
|
32
|
+
maxTokens: options.maxTokens || agent.maxResponseTokens,
|
|
33
|
+
temperature: options.temperature,
|
|
34
|
+
tools: options.tools,
|
|
35
|
+
toolChoice: options.toolChoice,
|
|
36
|
+
experimental_telemetry: options.telemetry
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Stream the response
|
|
40
|
+
for await (const chunk of result.textStream) {
|
|
41
|
+
yield { type: 'text', content: chunk };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Handle tool calls if any
|
|
45
|
+
if (result.toolCalls && result.toolCalls.length > 0) {
|
|
46
|
+
yield { type: 'tool_calls', toolCalls: result.toolCalls };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Handle finish reason
|
|
50
|
+
if (result.finishReason) {
|
|
51
|
+
yield { type: 'finish', reason: result.finishReason };
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Optional cleanup
|
|
57
|
+
*/
|
|
58
|
+
async close() {
|
|
59
|
+
// Nothing to cleanup for Vercel AI
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|