@probelabs/probe 0.6.0-rc229 → 0.6.0-rc231

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.
@@ -386,6 +386,30 @@ User: Check system info
386
386
  </examples>
387
387
  `;
388
388
 
389
+ export const googleSearchToolDefinition = `
390
+ ## gemini_google_search (Gemini Built-in)
391
+ Description: Web search powered by Google. This is a built-in Gemini capability that automatically searches the web when the model needs current information. The model decides when to search and integrates results directly into its response with source citations.
392
+
393
+ This tool is invoked automatically by the model — you do NOT need to use XML tool calls for it. Simply ask questions that require up-to-date or real-world information and the model will search the web as needed.
394
+
395
+ Capabilities:
396
+ - Real-time web search with grounded citations
397
+ - Automatic query generation and result synthesis
398
+ - Source attribution with URLs
399
+ `;
400
+
401
+ export const urlContextToolDefinition = `
402
+ ## gemini_url_context (Gemini Built-in)
403
+ Description: URL content reader powered by Google. This is a built-in Gemini capability that automatically fetches and analyzes the content of URLs mentioned in the conversation. When you include URLs in your message, the model can read and understand their content.
404
+
405
+ This tool is invoked automatically by the model — you do NOT need to use XML tool calls for it. Simply include URLs in your message and the model will fetch and analyze their content.
406
+
407
+ Capabilities:
408
+ - Fetch and read web page content from URLs in the prompt
409
+ - Supports up to 20 URLs per request
410
+ - Processes HTML content (does not execute JavaScript)
411
+ `;
412
+
389
413
  export const searchDescription = 'Search code in the repository. Free-form questions are accepted, but Elasticsearch-style keyword queries work best. Use this tool first for any code-related questions.';
390
414
  export const queryDescription = 'Search code using ast-grep structural pattern matching. Use this tool to find specific code structures like functions, classes, or methods.';
391
415
  export const extractDescription = 'Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files.';
@@ -55,9 +55,9 @@ export function safeRealpath(inputPath) {
55
55
  * - Does NOT restrict access to specific directories (that's the responsibility
56
56
  * of higher-level components like ProbeAgent with allowedFolders)
57
57
  *
58
- * @param {string} inputPath - The path to validate
58
+ * @param {string} inputPath - The path to validate (can be a file or directory; file paths are resolved to their parent directory)
59
59
  * @param {string} [defaultPath] - Default path to use if inputPath is not provided
60
- * @returns {Promise<string>} Normalized absolute path
60
+ * @returns {Promise<string>} Normalized absolute directory path. If inputPath is a file, returns its parent directory.
61
61
  * @throws {PathError} If the path is invalid or doesn't exist
62
62
  */
63
63
  export async function validateCwdPath(inputPath, defaultPath = process.cwd()) {
@@ -72,6 +72,32 @@ export async function validateCwdPath(inputPath, defaultPath = process.cwd()) {
72
72
  try {
73
73
  const stats = await fs.stat(normalizedPath);
74
74
  if (!stats.isDirectory()) {
75
+ // If the path is a file, resolve to its parent directory
76
+ // This handles cases where a file path is passed as cwd
77
+ // Use safeRealpath to resolve symlinks before extracting parent directory
78
+ const resolvedPath = safeRealpath(normalizedPath);
79
+ const dirPath = path.dirname(resolvedPath);
80
+ try {
81
+ const dirStats = await fs.stat(dirPath);
82
+ if (dirStats.isDirectory()) {
83
+ return safeRealpath(dirPath);
84
+ }
85
+ } catch (dirError) {
86
+ if (dirError.code === 'ENOENT') {
87
+ throw new PathError(`Parent directory does not exist for file: ${normalizedPath}`, {
88
+ suggestion: 'The specified path is a file whose parent directory does not exist.',
89
+ details: { path: normalizedPath, parentPath: dirPath, type: 'file' }
90
+ });
91
+ }
92
+ if (dirError.code === 'EACCES') {
93
+ throw new PathError(`Permission denied accessing parent directory: ${dirPath}`, {
94
+ recoverable: false,
95
+ suggestion: 'Permission denied accessing the parent directory of the specified file.',
96
+ details: { path: normalizedPath, parentPath: dirPath, type: 'file' }
97
+ });
98
+ }
99
+ throw dirError;
100
+ }
75
101
  throw new PathError(`Path is not a directory: ${normalizedPath}`, {
76
102
  suggestion: 'The specified path is a file, not a directory. Please provide a directory path for searching.',
77
103
  details: { path: normalizedPath, type: 'file' }