@probelabs/probe 0.6.0-rc222 → 0.6.0-rc224

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.
@@ -287,6 +287,18 @@ export class ACPToolManager {
287
287
  allow_tests: {
288
288
  type: 'boolean',
289
289
  description: 'Include test files in results (default: true)'
290
+ },
291
+ exact: {
292
+ type: 'boolean',
293
+ description: 'Default (false) enables stemming and keyword splitting for exploratory search. Set true for precise symbol lookup where the query matches only the exact term. Use true when you know the exact symbol name.'
294
+ },
295
+ session: {
296
+ type: 'string',
297
+ description: 'Session ID for result caching and pagination. Pass the session ID from a previous search to get additional results (next page). Results already shown in a session are automatically excluded.'
298
+ },
299
+ nextPage: {
300
+ type: 'boolean',
301
+ description: 'Set to true when requesting the next page of results. Requires passing the same session ID from the previous search output.'
290
302
  }
291
303
  },
292
304
  required: ['query']
@@ -3776,6 +3776,19 @@ async function delegate({
3776
3776
  if (!task || typeof task !== "string") {
3777
3777
  throw new Error("Task parameter is required and must be a string");
3778
3778
  }
3779
+ const hasExplicitTimeout = Object.prototype.hasOwnProperty.call(arguments?.[0] ?? {}, "timeout");
3780
+ if (!hasExplicitTimeout) {
3781
+ const envTimeoutMs = parseInt(process.env.DELEGATION_TIMEOUT_MS || "", 10);
3782
+ const envTimeoutSeconds = parseInt(
3783
+ process.env.DELEGATION_TIMEOUT_SECONDS || process.env.DELEGATION_TIMEOUT || "",
3784
+ 10
3785
+ );
3786
+ if (!Number.isNaN(envTimeoutMs) && envTimeoutMs > 0) {
3787
+ timeout = Math.max(1, Math.ceil(envTimeoutMs / 1e3));
3788
+ } else if (!Number.isNaN(envTimeoutSeconds) && envTimeoutSeconds > 0) {
3789
+ timeout = Math.max(1, envTimeoutSeconds);
3790
+ }
3791
+ }
3779
3792
  const manager = delegationManager || defaultDelegationManager;
3780
3793
  const sessionId = randomUUID();
3781
3794
  const startTime = Date.now();
@@ -9729,7 +9742,10 @@ var init_common = __esm({
9729
9742
  init_taskTool();
9730
9743
  searchSchema = external_exports.object({
9731
9744
  query: external_exports.string().describe("Search query with Elasticsearch syntax. Use quotes for exact matches, AND/OR for boolean logic, - for negation."),
9732
- path: external_exports.string().optional().default(".").describe('Path to search in. For dependencies use "go:github.com/owner/repo", "js:package_name", or "rust:cargo_name" etc.')
9745
+ path: external_exports.string().optional().default(".").describe('Path to search in. For dependencies use "go:github.com/owner/repo", "js:package_name", or "rust:cargo_name" etc.'),
9746
+ exact: external_exports.boolean().optional().default(false).describe('Default (false) enables stemming and keyword splitting for exploratory search - "getUserData" matches "get", "user", "data", etc. Set true for precise symbol lookup where "getUserData" matches only "getUserData". Use true when you know the exact symbol name.'),
9747
+ session: external_exports.string().optional().describe("Session ID for result caching and pagination. Pass the session ID from a previous search to get additional results (next page). Results already shown in a session are automatically excluded. Omit for a fresh search."),
9748
+ nextPage: external_exports.boolean().optional().default(false).describe("Set to true when requesting the next page of results. Requires passing the same session ID from the previous search output.")
9733
9749
  });
9734
9750
  querySchema = external_exports.object({
9735
9751
  pattern: external_exports.string().describe("AST pattern to search for. Use $NAME for variable names, $$$PARAMS for parameter lists, etc."),
@@ -9828,6 +9844,9 @@ You need to focus on main keywords when constructing the query, and always use e
9828
9844
  Parameters:
9829
9845
  - query: (required) Search query. Free-form questions are accepted, but for best results prefer Elasticsearch-style syntax with quotes for exact matches ("functionName"), AND/OR for boolean logic, - for negation, + for important terms.
9830
9846
  - path: (optional, default: '.') Path to search in. All dependencies located in /dep folder, under language sub folders, like this: "/dep/go/github.com/owner/repo", "/dep/js/package_name", or "/dep/rust/cargo_name" etc.
9847
+ - exact: (optional, default: false) Set to true for precise symbol lookup without stemming/tokenization. Use when you know the exact symbol name (e.g., "getUserData" matches only "getUserData", not "get", "user", "data").
9848
+ - session: (optional) Session ID for pagination. Pass the session ID returned from a previous search to get the next page of results. Results already shown are automatically excluded.
9849
+ - nextPage: (optional, default: false) Set to true when requesting the next page of results. Requires passing the same session ID from the previous search.
9831
9850
 
9832
9851
  **Workflow:** Always start with search, then use extract for detailed context when needed.
9833
9852
 
@@ -10234,7 +10253,7 @@ var init_vercel = __esm({
10234
10253
  name: "search",
10235
10254
  description: searchDelegate ? `${searchDescription} (delegates code search to a subagent and returns extracted code blocks)` : searchDescription,
10236
10255
  inputSchema: searchSchema,
10237
- execute: async ({ query: searchQuery, path: path9, allow_tests, exact, maxTokens: paramMaxTokens, language }) => {
10256
+ execute: async ({ query: searchQuery, path: path9, allow_tests, exact, maxTokens: paramMaxTokens, language, session, nextPage }) => {
10238
10257
  const effectiveMaxTokens = paramMaxTokens || maxTokens;
10239
10258
  let searchPaths;
10240
10259
  if (path9) {
@@ -10253,8 +10272,10 @@ var init_vercel = __esm({
10253
10272
  exact,
10254
10273
  json: false,
10255
10274
  maxTokens: effectiveMaxTokens,
10256
- session: sessionId,
10257
- // Pass session ID if provided
10275
+ session: session || sessionId,
10276
+ // Use explicit session param, or fall back to options sessionId
10277
+ nextPage,
10278
+ // Pass nextPage parameter for pagination
10258
10279
  language
10259
10280
  // Pass language parameter if provided
10260
10281
  };
package/build/delegate.js CHANGED
@@ -385,6 +385,23 @@ export async function delegate({
385
385
  throw new Error('Task parameter is required and must be a string');
386
386
  }
387
387
 
388
+ // Support runtime timeout override via environment variables when timeout not explicitly passed
389
+ // This allows operators to configure delegation timeouts without code changes
390
+ // Priority: DELEGATION_TIMEOUT_MS (milliseconds) > DELEGATION_TIMEOUT_SECONDS > DELEGATION_TIMEOUT (seconds)
391
+ const hasExplicitTimeout = Object.prototype.hasOwnProperty.call(arguments?.[0] ?? {}, 'timeout');
392
+ if (!hasExplicitTimeout) {
393
+ const envTimeoutMs = parseInt(process.env.DELEGATION_TIMEOUT_MS || '', 10);
394
+ const envTimeoutSeconds = parseInt(
395
+ process.env.DELEGATION_TIMEOUT_SECONDS || process.env.DELEGATION_TIMEOUT || '',
396
+ 10
397
+ );
398
+ if (!Number.isNaN(envTimeoutMs) && envTimeoutMs > 0) {
399
+ timeout = Math.max(1, Math.ceil(envTimeoutMs / 1000));
400
+ } else if (!Number.isNaN(envTimeoutSeconds) && envTimeoutSeconds > 0) {
401
+ timeout = Math.max(1, envTimeoutSeconds);
402
+ }
403
+ }
404
+
388
405
  // Use provided manager or fall back to default singleton
389
406
  const manager = delegationManager || defaultDelegationManager;
390
407
 
@@ -11,7 +11,10 @@ import { taskSchema } from '../agent/tasks/taskTool.js';
11
11
  // Common schemas for tool parameters (used for internal execution after XML parsing)
12
12
  export const searchSchema = z.object({
13
13
  query: z.string().describe('Search query with Elasticsearch syntax. Use quotes for exact matches, AND/OR for boolean logic, - for negation.'),
14
- path: z.string().optional().default('.').describe('Path to search in. For dependencies use "go:github.com/owner/repo", "js:package_name", or "rust:cargo_name" etc.')
14
+ path: z.string().optional().default('.').describe('Path to search in. For dependencies use "go:github.com/owner/repo", "js:package_name", or "rust:cargo_name" etc.'),
15
+ exact: z.boolean().optional().default(false).describe('Default (false) enables stemming and keyword splitting for exploratory search - "getUserData" matches "get", "user", "data", etc. Set true for precise symbol lookup where "getUserData" matches only "getUserData". Use true when you know the exact symbol name.'),
16
+ session: z.string().optional().describe('Session ID for result caching and pagination. Pass the session ID from a previous search to get additional results (next page). Results already shown in a session are automatically excluded. Omit for a fresh search.'),
17
+ nextPage: z.boolean().optional().default(false).describe('Set to true when requesting the next page of results. Requires passing the same session ID from the previous search output.')
15
18
  });
16
19
 
17
20
  export const querySchema = z.object({
@@ -130,6 +133,9 @@ You need to focus on main keywords when constructing the query, and always use e
130
133
  Parameters:
131
134
  - query: (required) Search query. Free-form questions are accepted, but for best results prefer Elasticsearch-style syntax with quotes for exact matches ("functionName"), AND/OR for boolean logic, - for negation, + for important terms.
132
135
  - path: (optional, default: '.') Path to search in. All dependencies located in /dep folder, under language sub folders, like this: "/dep/go/github.com/owner/repo", "/dep/js/package_name", or "/dep/rust/cargo_name" etc.
136
+ - exact: (optional, default: false) Set to true for precise symbol lookup without stemming/tokenization. Use when you know the exact symbol name (e.g., "getUserData" matches only "getUserData", not "get", "user", "data").
137
+ - session: (optional) Session ID for pagination. Pass the session ID returned from a previous search to get the next page of results. Results already shown are automatically excluded.
138
+ - nextPage: (optional, default: false) Set to true when requesting the next page of results. Requires passing the same session ID from the previous search.
133
139
 
134
140
  **Workflow:** Always start with search, then use extract for detailed context when needed.
135
141
 
@@ -16,7 +16,7 @@ export function createSearchTool(options = {}) {
16
16
  name: 'search',
17
17
  description: searchDescription,
18
18
  schema: searchSchema,
19
- func: async ({ query: searchQuery, path, allow_tests, exact, maxResults, maxTokens = 20000, language }) => {
19
+ func: async ({ query: searchQuery, path, allow_tests, exact, maxResults, maxTokens = 20000, language, session, nextPage }) => {
20
20
  try {
21
21
  const results = await search({
22
22
  query: searchQuery,
@@ -27,7 +27,9 @@ export function createSearchTool(options = {}) {
27
27
  json: false,
28
28
  maxResults,
29
29
  maxTokens,
30
- language
30
+ language,
31
+ session,
32
+ nextPage
31
33
  });
32
34
 
33
35
  return results;
@@ -169,7 +169,7 @@ export const searchTool = (options = {}) => {
169
169
  ? `${searchDescription} (delegates code search to a subagent and returns extracted code blocks)`
170
170
  : searchDescription,
171
171
  inputSchema: searchSchema,
172
- execute: async ({ query: searchQuery, path, allow_tests, exact, maxTokens: paramMaxTokens, language }) => {
172
+ execute: async ({ query: searchQuery, path, allow_tests, exact, maxTokens: paramMaxTokens, language, session, nextPage }) => {
173
173
  // Use parameter maxTokens if provided, otherwise use the default
174
174
  const effectiveMaxTokens = paramMaxTokens || maxTokens;
175
175
 
@@ -195,7 +195,8 @@ export const searchTool = (options = {}) => {
195
195
  exact,
196
196
  json: false,
197
197
  maxTokens: effectiveMaxTokens,
198
- session: sessionId, // Pass session ID if provided
198
+ session: session || sessionId, // Use explicit session param, or fall back to options sessionId
199
+ nextPage, // Pass nextPage parameter for pagination
199
200
  language // Pass language parameter if provided
200
201
  };
201
202