@probelabs/probe 0.6.0-rc100
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 +583 -0
- package/bin/.gitkeep +0 -0
- package/bin/probe +158 -0
- package/bin/probe-binary +0 -0
- package/build/agent/ProbeAgent.d.ts +199 -0
- package/build/agent/ProbeAgent.js +1486 -0
- package/build/agent/acp/README.md +347 -0
- package/build/agent/acp/connection.js +237 -0
- package/build/agent/acp/connection.test.js +311 -0
- package/build/agent/acp/examples/simple-client.js +212 -0
- package/build/agent/acp/examples/tool-lifecycle.js +230 -0
- package/build/agent/acp/final-test.js +173 -0
- package/build/agent/acp/index.js +5 -0
- package/build/agent/acp/integration.test.js +385 -0
- package/build/agent/acp/manual-test.js +410 -0
- package/build/agent/acp/protocol-test.js +190 -0
- package/build/agent/acp/server.js +448 -0
- package/build/agent/acp/server.test.js +371 -0
- package/build/agent/acp/test-runner.js +216 -0
- package/build/agent/acp/test-utils/README.md +315 -0
- package/build/agent/acp/test-utils/acp-tester.js +484 -0
- package/build/agent/acp/test-utils/mock-acp-client.js +434 -0
- package/build/agent/acp/tools.js +368 -0
- package/build/agent/acp/tools.test.js +334 -0
- package/build/agent/acp/types.js +218 -0
- package/build/agent/acp/types.test.js +327 -0
- package/build/agent/appTracer.js +360 -0
- package/build/agent/fileSpanExporter.js +169 -0
- package/build/agent/index.js +7426 -0
- package/build/agent/mcp/client.js +338 -0
- package/build/agent/mcp/config.js +313 -0
- package/build/agent/mcp/index.js +64 -0
- package/build/agent/mcp/xmlBridge.js +371 -0
- package/build/agent/mockProvider.js +53 -0
- package/build/agent/probeTool.js +257 -0
- package/build/agent/schemaUtils.js +1726 -0
- package/build/agent/simpleTelemetry.js +267 -0
- package/build/agent/telemetry.js +225 -0
- package/build/agent/tokenCounter.js +395 -0
- package/build/agent/tools.js +163 -0
- package/build/cli.js +49 -0
- package/build/delegate.js +267 -0
- package/build/directory-resolver.js +237 -0
- package/build/downloader.js +750 -0
- package/build/extract.js +149 -0
- package/build/index.js +70 -0
- package/build/mcp/index.js +514 -0
- package/build/mcp/index.ts +608 -0
- package/build/query.js +116 -0
- package/build/search.js +247 -0
- package/build/tools/common.js +410 -0
- package/build/tools/index.js +40 -0
- package/build/tools/langchain.js +88 -0
- package/build/tools/system-message.js +121 -0
- package/build/tools/vercel.js +271 -0
- package/build/utils/file-lister.js +193 -0
- package/build/utils.js +128 -0
- package/cjs/agent/ProbeAgent.cjs +5829 -0
- package/cjs/index.cjs +6217 -0
- package/cjs/package.json +3 -0
- package/index.d.ts +401 -0
- package/package.json +114 -0
- package/scripts/postinstall.js +172 -0
- package/src/agent/ProbeAgent.d.ts +199 -0
- package/src/agent/ProbeAgent.js +1486 -0
- package/src/agent/acp/README.md +347 -0
- package/src/agent/acp/connection.js +237 -0
- package/src/agent/acp/connection.test.js +311 -0
- package/src/agent/acp/examples/simple-client.js +212 -0
- package/src/agent/acp/examples/tool-lifecycle.js +230 -0
- package/src/agent/acp/final-test.js +173 -0
- package/src/agent/acp/index.js +5 -0
- package/src/agent/acp/integration.test.js +385 -0
- package/src/agent/acp/manual-test.js +410 -0
- package/src/agent/acp/protocol-test.js +190 -0
- package/src/agent/acp/server.js +448 -0
- package/src/agent/acp/server.test.js +371 -0
- package/src/agent/acp/test-runner.js +216 -0
- package/src/agent/acp/test-utils/README.md +315 -0
- package/src/agent/acp/test-utils/acp-tester.js +484 -0
- package/src/agent/acp/test-utils/mock-acp-client.js +434 -0
- package/src/agent/acp/tools.js +368 -0
- package/src/agent/acp/tools.test.js +334 -0
- package/src/agent/acp/types.js +218 -0
- package/src/agent/acp/types.test.js +327 -0
- package/src/agent/appTracer.js +360 -0
- package/src/agent/fileSpanExporter.js +169 -0
- package/src/agent/index.js +813 -0
- package/src/agent/mcp/client.js +338 -0
- package/src/agent/mcp/config.js +313 -0
- package/src/agent/mcp/index.js +64 -0
- package/src/agent/mcp/xmlBridge.js +371 -0
- package/src/agent/mockProvider.js +53 -0
- package/src/agent/probeTool.js +257 -0
- package/src/agent/schemaUtils.js +1726 -0
- package/src/agent/simpleTelemetry.js +267 -0
- package/src/agent/telemetry.js +225 -0
- package/src/agent/tokenCounter.js +395 -0
- package/src/agent/tools.js +163 -0
- package/src/cli.js +49 -0
- package/src/delegate.js +267 -0
- package/src/directory-resolver.js +237 -0
- package/src/downloader.js +750 -0
- package/src/extract.js +149 -0
- package/src/index.js +70 -0
- package/src/mcp/index.ts +608 -0
- package/src/query.js +116 -0
- package/src/search.js +247 -0
- package/src/tools/common.js +410 -0
- package/src/tools/index.js +40 -0
- package/src/tools/langchain.js +88 -0
- package/src/tools/system-message.js +121 -0
- package/src/tools/vercel.js +271 -0
- package/src/utils/file-lister.js +193 -0
- package/src/utils.js +128 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// TypeScript definitions for ProbeAgent class
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for creating a ProbeAgent instance
|
|
6
|
+
*/
|
|
7
|
+
export interface ProbeAgentOptions {
|
|
8
|
+
/** Optional session ID for the agent */
|
|
9
|
+
sessionId?: string;
|
|
10
|
+
/** Custom system prompt to replace the default system message */
|
|
11
|
+
customPrompt?: string;
|
|
12
|
+
/** Predefined prompt type (persona) */
|
|
13
|
+
promptType?: 'code-explorer' | 'engineer' | 'code-review' | 'support' | 'architect';
|
|
14
|
+
/** Allow the use of the 'implement' tool for code editing */
|
|
15
|
+
allowEdit?: boolean;
|
|
16
|
+
/** Search directory path */
|
|
17
|
+
path?: string;
|
|
18
|
+
/** Force specific AI provider */
|
|
19
|
+
provider?: 'anthropic' | 'openai' | 'google';
|
|
20
|
+
/** Override model name */
|
|
21
|
+
model?: string;
|
|
22
|
+
/** Enable debug mode */
|
|
23
|
+
debug?: boolean;
|
|
24
|
+
/** Optional telemetry tracer instance */
|
|
25
|
+
tracer?: any;
|
|
26
|
+
/** Enable MCP (Model Context Protocol) tool integration */
|
|
27
|
+
enableMcp?: boolean;
|
|
28
|
+
/** Path to MCP configuration file */
|
|
29
|
+
mcpConfigPath?: string;
|
|
30
|
+
/** MCP configuration object (overrides mcpConfigPath) */
|
|
31
|
+
mcpConfig?: any;
|
|
32
|
+
/** @deprecated Use mcpConfig instead */
|
|
33
|
+
mcpServers?: any[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Tool execution event data
|
|
38
|
+
*/
|
|
39
|
+
export interface ToolCallEvent {
|
|
40
|
+
/** Unique tool call identifier */
|
|
41
|
+
id: string;
|
|
42
|
+
/** Name of the tool being called */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Current execution status */
|
|
45
|
+
status: 'pending' | 'in_progress' | 'completed' | 'failed';
|
|
46
|
+
/** Tool parameters */
|
|
47
|
+
params?: any;
|
|
48
|
+
/** Tool execution result (when completed) */
|
|
49
|
+
result?: any;
|
|
50
|
+
/** Error information (when failed) */
|
|
51
|
+
error?: string;
|
|
52
|
+
/** Session ID */
|
|
53
|
+
sessionId?: string;
|
|
54
|
+
/** Execution start time */
|
|
55
|
+
startTime?: number;
|
|
56
|
+
/** Execution end time */
|
|
57
|
+
endTime?: number;
|
|
58
|
+
/** Execution duration in milliseconds */
|
|
59
|
+
duration?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Token usage statistics
|
|
64
|
+
*/
|
|
65
|
+
export interface TokenUsage {
|
|
66
|
+
/** Size of the context window */
|
|
67
|
+
contextWindow?: number;
|
|
68
|
+
/** Request tokens used */
|
|
69
|
+
request?: number;
|
|
70
|
+
/** Response tokens generated */
|
|
71
|
+
response?: number;
|
|
72
|
+
/** Total tokens (request + response) */
|
|
73
|
+
total?: number;
|
|
74
|
+
/** Cache read tokens */
|
|
75
|
+
cacheRead?: number;
|
|
76
|
+
/** Cache write tokens */
|
|
77
|
+
cacheWrite?: number;
|
|
78
|
+
/** Total request tokens across all calls */
|
|
79
|
+
totalRequest?: number;
|
|
80
|
+
/** Total response tokens across all calls */
|
|
81
|
+
totalResponse?: number;
|
|
82
|
+
/** Total tokens across all calls */
|
|
83
|
+
totalTokens?: number;
|
|
84
|
+
/** Total cache read tokens across all calls */
|
|
85
|
+
totalCacheRead?: number;
|
|
86
|
+
/** Total cache write tokens across all calls */
|
|
87
|
+
totalCacheWrite?: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Chat message structure
|
|
92
|
+
*/
|
|
93
|
+
export interface ChatMessage {
|
|
94
|
+
/** Message role */
|
|
95
|
+
role: 'user' | 'assistant' | 'system';
|
|
96
|
+
/** Message content */
|
|
97
|
+
content: string;
|
|
98
|
+
/** Optional message metadata */
|
|
99
|
+
metadata?: any;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Answer options
|
|
104
|
+
*/
|
|
105
|
+
export interface AnswerOptions {
|
|
106
|
+
/** Response schema for structured output */
|
|
107
|
+
schema?: string;
|
|
108
|
+
/** Additional context or constraints */
|
|
109
|
+
context?: string;
|
|
110
|
+
/** Maximum number of tool iterations */
|
|
111
|
+
maxIterations?: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* ProbeAgent class - AI-powered code exploration and interaction
|
|
116
|
+
*/
|
|
117
|
+
export declare class ProbeAgent {
|
|
118
|
+
/** Unique session identifier */
|
|
119
|
+
readonly sessionId: string;
|
|
120
|
+
|
|
121
|
+
/** Current chat history */
|
|
122
|
+
history: ChatMessage[];
|
|
123
|
+
|
|
124
|
+
/** Event emitter for tool execution updates */
|
|
125
|
+
readonly events: EventEmitter & ProbeAgentEvents;
|
|
126
|
+
|
|
127
|
+
/** Whether the agent allows code editing */
|
|
128
|
+
readonly allowEdit: boolean;
|
|
129
|
+
|
|
130
|
+
/** Allowed search folders */
|
|
131
|
+
readonly allowedFolders: string[];
|
|
132
|
+
|
|
133
|
+
/** Debug mode status */
|
|
134
|
+
readonly debug: boolean;
|
|
135
|
+
|
|
136
|
+
/** Whether operations have been cancelled */
|
|
137
|
+
cancelled: boolean;
|
|
138
|
+
|
|
139
|
+
/** AI provider being used */
|
|
140
|
+
readonly clientApiProvider?: string;
|
|
141
|
+
|
|
142
|
+
/** Current AI model */
|
|
143
|
+
readonly model?: string;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Create a new ProbeAgent instance
|
|
147
|
+
*/
|
|
148
|
+
constructor(options?: ProbeAgentOptions);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Answer a question with optional image attachments
|
|
152
|
+
* @param message - The question or prompt
|
|
153
|
+
* @param images - Optional array of image data or paths
|
|
154
|
+
* @param options - Additional options for the response
|
|
155
|
+
* @returns Promise resolving to the AI response
|
|
156
|
+
*/
|
|
157
|
+
answer(message: string, images?: any[], options?: AnswerOptions): Promise<string>;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Get token usage statistics
|
|
161
|
+
* @returns Current token usage information
|
|
162
|
+
*/
|
|
163
|
+
getTokenUsage(): TokenUsage;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Cancel any ongoing operations
|
|
167
|
+
*/
|
|
168
|
+
cancel(): void;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Clear the conversation history
|
|
172
|
+
*/
|
|
173
|
+
clearHistory(): void;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Add a message to the conversation history
|
|
177
|
+
* @param message - Message to add
|
|
178
|
+
*/
|
|
179
|
+
addMessage(message: ChatMessage): void;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Set the conversation history
|
|
183
|
+
* @param messages - Array of chat messages
|
|
184
|
+
*/
|
|
185
|
+
setHistory(messages: ChatMessage[]): void;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* ProbeAgent Events interface
|
|
190
|
+
*/
|
|
191
|
+
export interface ProbeAgentEvents {
|
|
192
|
+
on(event: 'toolCall', listener: (event: ToolCallEvent) => void): this;
|
|
193
|
+
emit(event: 'toolCall', event: ToolCallEvent): boolean;
|
|
194
|
+
removeListener(event: 'toolCall', listener: (event: ToolCallEvent) => void): this;
|
|
195
|
+
removeAllListeners(event?: 'toolCall'): this;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Default export
|
|
199
|
+
export { ProbeAgent as default };
|