@probelabs/probe 0.6.0-rc159 → 0.6.0-rc161
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 +80 -1
- package/build/agent/FallbackManager.d.ts +176 -0
- package/build/agent/FallbackManager.js +545 -0
- package/build/agent/ProbeAgent.d.ts +7 -1
- package/build/agent/ProbeAgent.js +199 -7
- package/build/agent/RetryManager.d.ts +157 -0
- package/build/agent/RetryManager.js +334 -0
- package/build/agent/acp/tools.js +6 -2
- package/build/agent/index.js +1379 -168
- package/build/agent/probeTool.js +20 -2
- package/build/agent/tools.js +16 -0
- package/build/index.js +13 -0
- package/build/tools/common.js +5 -3
- package/build/tools/edit.js +409 -0
- package/build/tools/index.js +11 -0
- package/cjs/agent/ProbeAgent.cjs +1822 -497
- package/cjs/index.cjs +1784 -454
- package/package.json +2 -2
- package/src/agent/FallbackManager.d.ts +176 -0
- package/src/agent/FallbackManager.js +545 -0
- package/src/agent/ProbeAgent.d.ts +7 -1
- package/src/agent/ProbeAgent.js +199 -7
- package/src/agent/RetryManager.d.ts +157 -0
- package/src/agent/RetryManager.js +334 -0
- package/src/agent/acp/tools.js +6 -2
- package/src/agent/probeTool.js +20 -2
- package/src/agent/tools.js +16 -0
- package/src/index.js +13 -0
- package/src/tools/common.js +5 -3
- package/src/tools/edit.js +409 -0
- package/src/tools/index.js +11 -0
- package/bin/binaries/probe-v0.6.0-rc159-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc159-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc159-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc159-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc159-x86_64-unknown-linux-musl.tar.gz +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@probelabs/probe",
|
|
3
|
-
"version": "0.6.0-
|
|
3
|
+
"version": "0.6.0-rc161",
|
|
4
4
|
"description": "Node.js wrapper for the probe code search tool",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@ai-sdk/google": "^2.0.14",
|
|
79
79
|
"@ai-sdk/openai": "^2.0.10",
|
|
80
80
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
81
|
-
"@probelabs/maid": "^0.0.
|
|
81
|
+
"@probelabs/maid": "^0.0.21",
|
|
82
82
|
"adm-zip": "^0.5.16",
|
|
83
83
|
"ai": "^5.0.0",
|
|
84
84
|
"ajv": "^8.17.1",
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for FallbackManager
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Fallback strategies
|
|
7
|
+
*/
|
|
8
|
+
export const FALLBACK_STRATEGIES: {
|
|
9
|
+
/** Try same model on different providers */
|
|
10
|
+
SAME_MODEL: 'same-model';
|
|
11
|
+
/** Try different models on same provider */
|
|
12
|
+
SAME_PROVIDER: 'same-provider';
|
|
13
|
+
/** Try any available provider/model */
|
|
14
|
+
ANY: 'any';
|
|
15
|
+
/** Use custom provider list */
|
|
16
|
+
CUSTOM: 'custom';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type FallbackStrategy =
|
|
20
|
+
| 'same-model'
|
|
21
|
+
| 'same-provider'
|
|
22
|
+
| 'any'
|
|
23
|
+
| 'custom';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provider configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface ProviderConfig {
|
|
29
|
+
/** Provider name */
|
|
30
|
+
provider: 'anthropic' | 'openai' | 'google' | 'bedrock';
|
|
31
|
+
/** Model name (uses provider default if omitted) */
|
|
32
|
+
model?: string;
|
|
33
|
+
/** API key for the provider */
|
|
34
|
+
apiKey?: string;
|
|
35
|
+
/** Custom API endpoint */
|
|
36
|
+
baseURL?: string;
|
|
37
|
+
/** Max retries for this provider (overrides global) */
|
|
38
|
+
maxRetries?: number;
|
|
39
|
+
|
|
40
|
+
// AWS Bedrock specific
|
|
41
|
+
/** AWS region (for Bedrock) */
|
|
42
|
+
region?: string;
|
|
43
|
+
/** AWS access key ID (for Bedrock) */
|
|
44
|
+
accessKeyId?: string;
|
|
45
|
+
/** AWS secret access key (for Bedrock) */
|
|
46
|
+
secretAccessKey?: string;
|
|
47
|
+
/** AWS session token (for Bedrock) */
|
|
48
|
+
sessionToken?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Fallback configuration options
|
|
53
|
+
*/
|
|
54
|
+
export interface FallbackOptions {
|
|
55
|
+
/** Fallback strategy */
|
|
56
|
+
strategy?: FallbackStrategy;
|
|
57
|
+
/** List of models for same-provider fallback */
|
|
58
|
+
models?: string[];
|
|
59
|
+
/** List of provider configurations for custom fallback */
|
|
60
|
+
providers?: ProviderConfig[];
|
|
61
|
+
/** Stop on first successful response */
|
|
62
|
+
stopOnSuccess?: boolean;
|
|
63
|
+
/** Continue to fallback on non-retryable errors */
|
|
64
|
+
continueOnNonRetryableError?: boolean;
|
|
65
|
+
/** Maximum total attempts across all providers (1-100) */
|
|
66
|
+
maxTotalAttempts?: number;
|
|
67
|
+
/** Enable debug logging */
|
|
68
|
+
debug?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Fallback statistics
|
|
73
|
+
*/
|
|
74
|
+
export interface FallbackStats {
|
|
75
|
+
/** Total number of provider attempts */
|
|
76
|
+
totalAttempts: number;
|
|
77
|
+
/** Number of attempts per provider */
|
|
78
|
+
providerAttempts: Record<string, number>;
|
|
79
|
+
/** Name of the successful provider */
|
|
80
|
+
successfulProvider: string | null;
|
|
81
|
+
/** List of failed providers with error details */
|
|
82
|
+
failedProviders: Array<{
|
|
83
|
+
provider: string;
|
|
84
|
+
error: {
|
|
85
|
+
message: string;
|
|
86
|
+
type: string;
|
|
87
|
+
statusCode?: number;
|
|
88
|
+
};
|
|
89
|
+
}>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Auto-fallback provider build options
|
|
94
|
+
*/
|
|
95
|
+
export interface BuildFallbackOptions {
|
|
96
|
+
/** Primary provider to try first */
|
|
97
|
+
primaryProvider?: string;
|
|
98
|
+
/** Primary model to use */
|
|
99
|
+
primaryModel?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* FallbackManager class for handling provider and model fallback
|
|
104
|
+
*/
|
|
105
|
+
export class FallbackManager {
|
|
106
|
+
/** Fallback strategy */
|
|
107
|
+
strategy: FallbackStrategy;
|
|
108
|
+
/** List of models for same-provider fallback */
|
|
109
|
+
models: string[];
|
|
110
|
+
/** List of provider configurations */
|
|
111
|
+
providers: ProviderConfig[];
|
|
112
|
+
/** Stop on first success */
|
|
113
|
+
stopOnSuccess: boolean;
|
|
114
|
+
/** Continue on non-retryable errors */
|
|
115
|
+
continueOnNonRetryableError: boolean;
|
|
116
|
+
/** Maximum total attempts */
|
|
117
|
+
maxTotalAttempts: number;
|
|
118
|
+
/** Debug logging enabled */
|
|
119
|
+
debug: boolean;
|
|
120
|
+
/** Fallback statistics */
|
|
121
|
+
stats: FallbackStats;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Create a new FallbackManager
|
|
125
|
+
* @param options - Fallback configuration options
|
|
126
|
+
*/
|
|
127
|
+
constructor(options?: FallbackOptions);
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Execute a function with fallback support
|
|
131
|
+
* @param fn - Function that takes (provider, model, config) and returns a Promise
|
|
132
|
+
* @returns Result from the function
|
|
133
|
+
* @throws Error if all fallbacks are exhausted
|
|
134
|
+
*/
|
|
135
|
+
executeWithFallback<T>(
|
|
136
|
+
fn: (
|
|
137
|
+
provider: any,
|
|
138
|
+
model: string,
|
|
139
|
+
config: ProviderConfig
|
|
140
|
+
) => Promise<T>
|
|
141
|
+
): Promise<T>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Get fallback statistics
|
|
145
|
+
* @returns Statistics object (copy)
|
|
146
|
+
*/
|
|
147
|
+
getStats(): FallbackStats;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Reset statistics
|
|
151
|
+
*/
|
|
152
|
+
resetStats(): void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Create a FallbackManager from environment variables
|
|
157
|
+
* @param debug - Enable debug logging
|
|
158
|
+
* @returns Configured FallbackManager instance or null if no config found
|
|
159
|
+
*/
|
|
160
|
+
export function createFallbackManagerFromEnv(
|
|
161
|
+
debug?: boolean
|
|
162
|
+
): FallbackManager | null;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Build a fallback provider list from current environment
|
|
166
|
+
* @param options - Options for building the list
|
|
167
|
+
* @returns List of provider configurations
|
|
168
|
+
*/
|
|
169
|
+
export function buildFallbackProvidersFromEnv(
|
|
170
|
+
options?: BuildFallbackOptions
|
|
171
|
+
): ProviderConfig[];
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Default model mappings for each provider
|
|
175
|
+
*/
|
|
176
|
+
export const DEFAULT_MODELS: Record<string, string>;
|