@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.
Files changed (115) hide show
  1. package/README.md +583 -0
  2. package/bin/.gitkeep +0 -0
  3. package/bin/probe +158 -0
  4. package/bin/probe-binary +0 -0
  5. package/build/agent/ProbeAgent.d.ts +199 -0
  6. package/build/agent/ProbeAgent.js +1486 -0
  7. package/build/agent/acp/README.md +347 -0
  8. package/build/agent/acp/connection.js +237 -0
  9. package/build/agent/acp/connection.test.js +311 -0
  10. package/build/agent/acp/examples/simple-client.js +212 -0
  11. package/build/agent/acp/examples/tool-lifecycle.js +230 -0
  12. package/build/agent/acp/final-test.js +173 -0
  13. package/build/agent/acp/index.js +5 -0
  14. package/build/agent/acp/integration.test.js +385 -0
  15. package/build/agent/acp/manual-test.js +410 -0
  16. package/build/agent/acp/protocol-test.js +190 -0
  17. package/build/agent/acp/server.js +448 -0
  18. package/build/agent/acp/server.test.js +371 -0
  19. package/build/agent/acp/test-runner.js +216 -0
  20. package/build/agent/acp/test-utils/README.md +315 -0
  21. package/build/agent/acp/test-utils/acp-tester.js +484 -0
  22. package/build/agent/acp/test-utils/mock-acp-client.js +434 -0
  23. package/build/agent/acp/tools.js +368 -0
  24. package/build/agent/acp/tools.test.js +334 -0
  25. package/build/agent/acp/types.js +218 -0
  26. package/build/agent/acp/types.test.js +327 -0
  27. package/build/agent/appTracer.js +360 -0
  28. package/build/agent/fileSpanExporter.js +169 -0
  29. package/build/agent/index.js +7426 -0
  30. package/build/agent/mcp/client.js +338 -0
  31. package/build/agent/mcp/config.js +313 -0
  32. package/build/agent/mcp/index.js +64 -0
  33. package/build/agent/mcp/xmlBridge.js +371 -0
  34. package/build/agent/mockProvider.js +53 -0
  35. package/build/agent/probeTool.js +257 -0
  36. package/build/agent/schemaUtils.js +1726 -0
  37. package/build/agent/simpleTelemetry.js +267 -0
  38. package/build/agent/telemetry.js +225 -0
  39. package/build/agent/tokenCounter.js +395 -0
  40. package/build/agent/tools.js +163 -0
  41. package/build/cli.js +49 -0
  42. package/build/delegate.js +267 -0
  43. package/build/directory-resolver.js +237 -0
  44. package/build/downloader.js +750 -0
  45. package/build/extract.js +149 -0
  46. package/build/index.js +70 -0
  47. package/build/mcp/index.js +514 -0
  48. package/build/mcp/index.ts +608 -0
  49. package/build/query.js +116 -0
  50. package/build/search.js +247 -0
  51. package/build/tools/common.js +410 -0
  52. package/build/tools/index.js +40 -0
  53. package/build/tools/langchain.js +88 -0
  54. package/build/tools/system-message.js +121 -0
  55. package/build/tools/vercel.js +271 -0
  56. package/build/utils/file-lister.js +193 -0
  57. package/build/utils.js +128 -0
  58. package/cjs/agent/ProbeAgent.cjs +5829 -0
  59. package/cjs/index.cjs +6217 -0
  60. package/cjs/package.json +3 -0
  61. package/index.d.ts +401 -0
  62. package/package.json +114 -0
  63. package/scripts/postinstall.js +172 -0
  64. package/src/agent/ProbeAgent.d.ts +199 -0
  65. package/src/agent/ProbeAgent.js +1486 -0
  66. package/src/agent/acp/README.md +347 -0
  67. package/src/agent/acp/connection.js +237 -0
  68. package/src/agent/acp/connection.test.js +311 -0
  69. package/src/agent/acp/examples/simple-client.js +212 -0
  70. package/src/agent/acp/examples/tool-lifecycle.js +230 -0
  71. package/src/agent/acp/final-test.js +173 -0
  72. package/src/agent/acp/index.js +5 -0
  73. package/src/agent/acp/integration.test.js +385 -0
  74. package/src/agent/acp/manual-test.js +410 -0
  75. package/src/agent/acp/protocol-test.js +190 -0
  76. package/src/agent/acp/server.js +448 -0
  77. package/src/agent/acp/server.test.js +371 -0
  78. package/src/agent/acp/test-runner.js +216 -0
  79. package/src/agent/acp/test-utils/README.md +315 -0
  80. package/src/agent/acp/test-utils/acp-tester.js +484 -0
  81. package/src/agent/acp/test-utils/mock-acp-client.js +434 -0
  82. package/src/agent/acp/tools.js +368 -0
  83. package/src/agent/acp/tools.test.js +334 -0
  84. package/src/agent/acp/types.js +218 -0
  85. package/src/agent/acp/types.test.js +327 -0
  86. package/src/agent/appTracer.js +360 -0
  87. package/src/agent/fileSpanExporter.js +169 -0
  88. package/src/agent/index.js +813 -0
  89. package/src/agent/mcp/client.js +338 -0
  90. package/src/agent/mcp/config.js +313 -0
  91. package/src/agent/mcp/index.js +64 -0
  92. package/src/agent/mcp/xmlBridge.js +371 -0
  93. package/src/agent/mockProvider.js +53 -0
  94. package/src/agent/probeTool.js +257 -0
  95. package/src/agent/schemaUtils.js +1726 -0
  96. package/src/agent/simpleTelemetry.js +267 -0
  97. package/src/agent/telemetry.js +225 -0
  98. package/src/agent/tokenCounter.js +395 -0
  99. package/src/agent/tools.js +163 -0
  100. package/src/cli.js +49 -0
  101. package/src/delegate.js +267 -0
  102. package/src/directory-resolver.js +237 -0
  103. package/src/downloader.js +750 -0
  104. package/src/extract.js +149 -0
  105. package/src/index.js +70 -0
  106. package/src/mcp/index.ts +608 -0
  107. package/src/query.js +116 -0
  108. package/src/search.js +247 -0
  109. package/src/tools/common.js +410 -0
  110. package/src/tools/index.js +40 -0
  111. package/src/tools/langchain.js +88 -0
  112. package/src/tools/system-message.js +121 -0
  113. package/src/tools/vercel.js +271 -0
  114. package/src/utils/file-lister.js +193 -0
  115. package/src/utils.js +128 -0
@@ -0,0 +1,315 @@
1
+ # ACP Test Utilities
2
+
3
+ This directory contains comprehensive testing tools for Agent Client Protocol (ACP) implementations. Since the official ACP specification doesn't provide dedicated test tooling, we've created our own utilities to ensure protocol compliance and facilitate development.
4
+
5
+ ## 🧪 Test Tools Overview
6
+
7
+ ### 1. ACP Tester (`acp-tester.js`)
8
+ **Protocol compliance testing tool**
9
+
10
+ A comprehensive test suite that validates ACP implementations against the protocol specification.
11
+
12
+ **Features:**
13
+ - Protocol initialization and capability testing
14
+ - Session management verification
15
+ - Error handling validation
16
+ - Performance benchmarking
17
+ - JSON-RPC 2.0 compliance checking
18
+
19
+ **Usage:**
20
+ ```bash
21
+ node acp-tester.js --agent-command "node my-agent.js --acp"
22
+ node acp-tester.js --agent-command "python agent.py" --timeout 60 --verbose
23
+ ```
24
+
25
+ ### 2. Mock ACP Client (`mock-acp-client.js`)
26
+ **Interactive client simulator**
27
+
28
+ Simulates a code editor or IDE communicating with ACP agents, useful for manual testing and development.
29
+
30
+ **Features:**
31
+ - Interactive chat sessions
32
+ - Session mode management
33
+ - Tool call progress monitoring
34
+ - Notification handling
35
+ - Demo conversation flows
36
+
37
+ **Usage:**
38
+ ```bash
39
+ node mock-acp-client.js --agent "node agent.js --acp"
40
+ node mock-acp-client.js --agent "my-agent-binary" --interactive
41
+ ```
42
+
43
+ ## 🔧 Test Suite Details
44
+
45
+ ### ACP Tester Test Cases
46
+
47
+ #### 1. Protocol Initialize
48
+ - Validates JSON-RPC 2.0 format
49
+ - Checks protocol version negotiation
50
+ - Verifies server information structure
51
+ - Confirms capability advertisement
52
+
53
+ #### 2. Session Management
54
+ - Tests session creation with unique IDs
55
+ - Validates session loading and persistence
56
+ - Checks session metadata (timestamps, history)
57
+
58
+ #### 3. Error Handling
59
+ - Unknown method rejection (-32601)
60
+ - Invalid parameter handling (-32602)
61
+ - Session not found errors
62
+ - Timeout behavior
63
+
64
+ #### 4. Performance Benchmark
65
+ - Measures response times
66
+ - Tests concurrent requests
67
+ - Evaluates throughput
68
+ - Reports performance metrics
69
+
70
+ ### Mock Client Features
71
+
72
+ #### Interactive Mode
73
+ ```bash
74
+ > hello agent
75
+ > mode planning
76
+ > find all functions in this project
77
+ > status
78
+ > quit
79
+ ```
80
+
81
+ #### Demo Mode
82
+ Runs predefined conversation flow:
83
+ 1. Agent introduction
84
+ 2. File listing request
85
+ 3. Code search queries
86
+ 4. Entry point analysis
87
+
88
+ ## 📊 Example Test Output
89
+
90
+ ### ACP Tester Results
91
+ ```
92
+ 📋 ACP Protocol Compliance Test Suite
93
+ 📋 ========================================
94
+ ✅ Protocol Initialize (9ms)
95
+ ✅ Session Management (4ms)
96
+ ✅ Error Handling (1ms)
97
+ ✅ Performance Benchmark (2ms)
98
+
99
+ 📋 Test Results Summary
100
+ 📋 ====================
101
+ 📋 Total time: 1024ms
102
+ 📋 Passed: 4
103
+ 📋 Failed: 0
104
+ 📋 Total: 4
105
+ ✅ Agent is ACP compliant! 🎉
106
+ ```
107
+
108
+ ### Mock Client Session
109
+ ```
110
+ [14:30:15] 🚀 Starting agent: node agent.js --acp
111
+ [14:30:16] ✅ Connected to my-agent v1.0.0
112
+ [14:30:16] 🛠️ Available tools: search, query, extract
113
+ [14:30:16] 📝 Creating new session...
114
+ [14:30:16] ✅ Session created: abc-123-def
115
+ [14:30:17] 💬 Sending: "Hello! Can you tell me about yourself?"
116
+ [14:30:18] 🤖 Agent response:
117
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
118
+ I'm an AI agent that helps with code analysis and search...
119
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
120
+ ```
121
+
122
+ ## 🎯 Testing Your ACP Implementation
123
+
124
+ ### Step 1: Basic Compliance
125
+ ```bash
126
+ node acp-tester.js --agent-command "your-agent-command"
127
+ ```
128
+
129
+ This will run the core compliance tests and report any issues.
130
+
131
+ ### Step 2: Interactive Testing
132
+ ```bash
133
+ node mock-acp-client.js --agent "your-agent-command" --interactive
134
+ ```
135
+
136
+ Test your agent manually with realistic interactions.
137
+
138
+ ### Step 3: Performance Testing
139
+ ```bash
140
+ node acp-tester.js --agent-command "your-agent-command" --verbose
141
+ ```
142
+
143
+ Get detailed performance metrics and timing information.
144
+
145
+ ## 🏗️ Test Development
146
+
147
+ ### Adding New Tests to ACP Tester
148
+
149
+ ```javascript
150
+ async testCustomFeature() {
151
+ return this.runTest('Custom Feature Test', async () => {
152
+ // Your test logic here
153
+ const result = await this.sendRequest('customMethod', { param: 'value' });
154
+
155
+ // Validate result
156
+ if (!result.expected) {
157
+ throw new Error('Custom feature not working');
158
+ }
159
+
160
+ return { customMetric: result.value };
161
+ });
162
+ }
163
+ ```
164
+
165
+ ### Extending Mock Client
166
+
167
+ ```javascript
168
+ handleCustomNotification(notification) {
169
+ if (notification.method === 'customEvent') {
170
+ this.log(`🎯 Custom event: ${notification.params.data}`);
171
+ }
172
+ }
173
+ ```
174
+
175
+ ## 🛠️ Utilities API
176
+
177
+ ### ACPTester Class
178
+
179
+ **Methods:**
180
+ - `runAllTests()` - Execute complete test suite
181
+ - `runTest(name, testFn)` - Run individual test
182
+ - `sendRequest(method, params)` - Send JSON-RPC request
183
+ - `validateInitializeResponse(result)` - Validate init response
184
+
185
+ **Options:**
186
+ - `agentCommand` - Command to start agent
187
+ - `timeout` - Request timeout (ms)
188
+ - `verbose` - Enable detailed output
189
+
190
+ ### MockACPClient Class
191
+
192
+ **Methods:**
193
+ - `initialize()` - Initialize ACP connection
194
+ - `createSession()` - Create new session
195
+ - `sendPrompt(message)` - Send user message
196
+ - `setSessionMode(mode)` - Change session mode
197
+ - `runInteractiveSession()` - Start interactive mode
198
+
199
+ **Options:**
200
+ - `agentCommand` - Command to start agent
201
+ - `interactive` - Enable interactive mode
202
+ - `debug` - Show debug information
203
+ - `timeout` - Request timeout (ms)
204
+
205
+ ## 🎨 Customization
206
+
207
+ ### Custom Test Configuration
208
+
209
+ ```javascript
210
+ const tester = new ACPTester({
211
+ agentCommand: 'python my_agent.py',
212
+ timeout: 60000, // 60 seconds
213
+ verbose: true
214
+ });
215
+
216
+ // Add custom validation
217
+ tester.validateCustomResponse = (result) => {
218
+ // Your custom validation logic
219
+ };
220
+
221
+ await tester.runAllTests();
222
+ ```
223
+
224
+ ### Client Behavior Customization
225
+
226
+ ```javascript
227
+ const client = new MockACPClient({
228
+ agentCommand: './my-agent-binary',
229
+ interactive: false,
230
+ debug: true
231
+ });
232
+
233
+ // Custom prompt handling
234
+ client.handleCustomPrompt = async (prompt) => {
235
+ // Your custom logic
236
+ };
237
+
238
+ await client.run();
239
+ ```
240
+
241
+ ## 🚀 Integration with CI/CD
242
+
243
+ ### GitHub Actions Example
244
+
245
+ ```yaml
246
+ name: ACP Compliance Test
247
+ on: [push, pull_request]
248
+
249
+ jobs:
250
+ test-acp:
251
+ runs-on: ubuntu-latest
252
+ steps:
253
+ - uses: actions/checkout@v3
254
+ - uses: actions/setup-node@v3
255
+ with:
256
+ node-version: '18'
257
+
258
+ - name: Build agent
259
+ run: npm install && npm run build
260
+
261
+ - name: Test ACP compliance
262
+ run: |
263
+ node test-utils/acp-tester.js \
264
+ --agent-command "node dist/agent.js --acp" \
265
+ --timeout 30
266
+ ```
267
+
268
+ ### Docker Testing
269
+
270
+ ```dockerfile
271
+ FROM node:18-alpine
272
+
273
+ COPY . /app
274
+ WORKDIR /app
275
+
276
+ RUN npm install
277
+ RUN npm run build
278
+
279
+ # Test ACP compliance
280
+ RUN node test-utils/acp-tester.js \
281
+ --agent-command "node dist/agent.js --acp"
282
+ ```
283
+
284
+ ## 📚 Reference Implementations
285
+
286
+ The test utilities work with these ACP implementations:
287
+
288
+ **Official Examples:**
289
+ - Zed Industries TypeScript agent/client examples
290
+ - Reference Rust implementations
291
+
292
+ **Tested Implementations:**
293
+ - Probe Agent (this repository)
294
+ - Custom Python agents
295
+ - Go-based agents
296
+
297
+ ## 🤝 Contributing Test Tools
298
+
299
+ To add new test utilities:
300
+
301
+ 1. Create new test file in this directory
302
+ 2. Follow the established patterns (ACPTester/MockACPClient)
303
+ 3. Add comprehensive documentation
304
+ 4. Include usage examples
305
+ 5. Test against multiple implementations
306
+
307
+ ### Test Tool Guidelines
308
+
309
+ - **Comprehensive**: Cover all protocol aspects
310
+ - **Robust**: Handle edge cases and errors gracefully
311
+ - **Informative**: Provide clear success/failure messages
312
+ - **Configurable**: Allow customization for different needs
313
+ - **Well-documented**: Include usage examples and API docs
314
+
315
+ These test utilities ensure ACP implementations are reliable, compliant, and ready for production use with code editors and development tools.