@perstack/base 0.0.19 → 0.0.21

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.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/path.ts","../src/tools/append-text-file.ts","../src/tools/attempt-completion.ts","../src/tools/create-directory.ts","../src/tools/delete-file.ts","../src/tools/edit-text-file.ts","../src/tools/get-file-info.ts","../src/tools/list-directory.ts","../src/tools/move-file.ts","../src/tools/read-image-file.ts","../src/tools/read-pdf-file.ts","../src/tools/read-text-file.ts","../src/tools/test-url.ts","../src/tools/think.ts","../src/tools/todo.ts","../src/tools/write-text-file.ts"],"names":["path","dedent","inputSchema","z","existsSync","statSync","dirname","mkdir","mime","stat","readFile","todo","writeFile"],"mappings":";;;;;;;;;AAKO,IAAM,gBAAgB,YAAA,CAAa,UAAA,CAAW,OAAA,CAAQ,GAAA,EAAK,CAAC,CAAA;AAEnE,SAAS,WAAW,QAAA,EAA0B;AAC5C,EAAA,IAAI,QAAA,CAAS,UAAA,CAAW,IAAI,CAAA,IAAK,aAAa,GAAA,EAAK;AACjD,IAAA,OAAO,IAAA,CAAK,KAAK,EAAA,CAAG,OAAA,IAAW,QAAA,CAAS,KAAA,CAAM,CAAC,CAAC,CAAA;AAAA,EAClD;AACA,EAAA,OAAO,QAAA;AACT;AAEA,eAAsB,aAAa,aAAA,EAAwC;AACzE,EAAA,MAAM,YAAA,GAAe,WAAW,aAAa,CAAA;AAC7C,EAAA,MAAM,QAAA,GAAW,IAAA,CAAK,UAAA,CAAW,YAAY,IACzC,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA,GACzB,IAAA,CAAK,OAAA,CAAQ,OAAA,CAAQ,GAAA,IAAO,YAAY,CAAA;AAC5C,EAAA,IAAI,QAAA,KAAa,CAAA,EAAG,aAAa,CAAA,SAAA,CAAA,EAAa;AAC5C,IAAA,MAAM,IAAI,MAAM,mDAAmD,CAAA;AAAA,EACrE;AACA,EAAA,IA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AAA,CAAM,GAAA,EAAK,EAAE,SAAA,EAAW,MAAM,CAAA;AACpC,EAAA,MAAMK,SAAAA,CAAU,aAAA,EAAe,IAAA,EAAM,OAAO,CAAA;AAC5C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN;AAAA,GACF;AACF","file":"chunk-4N6IWATT.js","sourcesContent":["import { realpathSync } from \"node:fs\"\nimport fs from \"node:fs/promises\"\nimport os from \"node:os\"\nimport path from \"node:path\"\n\nexport const workspacePath = realpathSync(expandHome(process.cwd()))\n\nfunction expandHome(filepath: string): string {\n if (filepath.startsWith(\"~/\") || filepath === \"~\") {\n return path.join(os.homedir(), filepath.slice(1))\n }\n return filepath\n}\n\nexport async function validatePath(requestedPath: string): Promise<string> {\n const expandedPath = expandHome(requestedPath)\n const absolute = path.isAbsolute(expandedPath)\n ? path.resolve(expandedPath)\n : path.resolve(process.cwd(), expandedPath)\n if (absolute === `${workspacePath}/perstack`) {\n throw new Error(\"Access denied - perstack directory is not allowed\")\n }\n try {\n const realAbsolute = await fs.realpath(absolute)\n if (!realAbsolute.startsWith(workspacePath)) {\n throw new Error(\"Access denied - symlink target outside allowed directories\")\n }\n return realAbsolute\n } catch (error) {\n const parentDir = path.dirname(absolute)\n try {\n const realParentPath = await fs.realpath(parentDir)\n if (!realParentPath.startsWith(workspacePath)) {\n throw new Error(\"Access denied - parent directory outside allowed directories\")\n }\n return absolute\n } catch {\n if (!absolute.startsWith(workspacePath)) {\n throw new Error(\n `Access denied - path outside allowed directories: ${absolute} not in ${workspacePath}`,\n )\n }\n throw new Error(`Parent directory does not exist: ${parentDir}`)\n }\n }\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { appendFile } from \"node:fs/promises\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport type { ToolResult } from \"../lib/register-tool.js\"\n\nconst inputSchema = z.object({\n path: z.string().describe(\"Target file path to append to.\"),\n text: z.string().min(1).max(2_000).describe(\"Text to append to the file. Max 2000 characters.\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\nexport function appendTextFileConfig() {\n return {\n title: \"Append text file\",\n description: dedent`\n Adding content to the end of existing files.\n\n Use cases:\n - Adding entries to log files\n - Appending data to CSV or JSON files\n - Adding new sections to documentation\n - Extending configuration files\n - Building files incrementally\n\n How it works:\n - Appends text to the end of an existing file\n - Does not modify existing content\n - Creates a new line before appending if needed\n - Returns the appended file path\n\n Rules:\n - FILE MUST EXIST BEFORE APPENDING\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT APPEND ALL THE CONTENT AT ONCE\n - IF YOU WANT TO APPEND MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES\n `,\n inputSchema: inputSchema.shape,\n }\n}\nexport async function appendTextFile(input: InputSchema): Promise<ToolResult> {\n const { path, text } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await appendFile(validatedPath, text)\n return { path: validatedPath, text }\n}\n","import { dedent } from \"ts-dedent\"\nimport type { ToolResult } from \"../lib/register-tool.js\"\n\nexport function attemptCompletionConfig() {\n return {\n title: \"Attempt completion\",\n description: dedent`\n Task completion signal that triggers immediate final report generation.\n Use cases:\n - Signaling task completion to Perstack runtime\n - Triggering final report generation\n - Ending the current expert's work cycle\n How it works:\n - Sends completion signal to Perstack runtime\n - Runtime immediately proceeds to final report generation\n - No confirmation or approval step required\n - No parameters needed for this signal\n Notes:\n - Triggers immediate transition to final report\n - Should only be used when task is fully complete\n - Cannot be reverted once called\n `,\n inputSchema: {},\n }\n}\n\nexport async function attemptCompletion(): Promise<ToolResult> {\n return {\n message: \"End the agent loop and provide a final report\",\n }\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\nexport function createDirectoryConfig() {\n return {\n title: \"Create directory\",\n description: dedent`\n Directory creator for establishing folder structures in the workspace.\n\n Use cases:\n - Setting up project directory structure\n - Creating output folders for generated content\n - Organizing files into logical groups\n - Preparing directory hierarchies\n\n How it works:\n - Creates directories recursively\n - Handles existing directories gracefully\n - Creates parent directories as needed\n - Returns creation status\n \n Parameters:\n - path: Directory path to create\n `,\n inputSchema: inputSchema.shape,\n }\n}\nexport async function createDirectory(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const exists = existsSync(validatedPath)\n if (exists) {\n throw new Error(`Directory ${path} already exists`)\n }\n const parentDir = dirname(validatedPath)\n if (existsSync(parentDir)) {\n const parentStats = statSync(parentDir)\n if (!(parentStats.mode & 0o200)) {\n throw new Error(`Parent directory ${parentDir} is not writable`)\n }\n }\n await mkdir(validatedPath, { recursive: true })\n return {\n path: validatedPath,\n }\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { unlink } from \"node:fs/promises\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\nexport function deleteFileConfig() {\n return {\n title: \"Delete file\",\n description: dedent`\n File deleter for removing files from the workspace.\n\n Use cases:\n - Removing temporary files\n - Cleaning up generated files\n - Deleting outdated configuration files\n - Removing unwanted artifacts\n\n How it works:\n - Validates file existence and permissions\n - Performs atomic delete operation\n - Returns deletion status\n \n Parameters:\n - path: File path to delete\n `,\n inputSchema: inputSchema.shape,\n }\n}\nexport async function deleteFile(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (stats.isDirectory()) {\n throw new Error(`Path ${path} is a directory. Use delete directory tool instead.`)\n }\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await unlink(validatedPath)\n return {\n path: validatedPath,\n }\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { readFile, writeFile } from \"node:fs/promises\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst inputSchema = z.object({\n path: z.string().describe(\"Target file path to edit.\"),\n newText: z\n .string()\n .min(1)\n .max(2_000)\n .describe(\"Text to append to the file. Max 2000 characters.\"),\n oldText: z\n .string()\n .min(1)\n .max(2_000)\n .describe(\"Exact text to find and replace. Max 2000 characters.\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\nexport function editTextFileConfig() {\n return {\n title: \"Edit text file\",\n description: dedent`\n Text file editor for modifying existing files with precise text replacement.\n\n Use cases:\n - Updating configuration values\n - Modifying code snippets\n - Replacing specific text blocks\n - Making targeted edits to files\n\n How it works:\n - Reads existing file content\n - Performs exact text replacement of oldText with newText\n - Normalizes line endings for consistent behavior\n - Returns summary of changes made\n - For appending text to files, use the appendTextFile tool instead\n \n Rules:\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT WRITE ALL THE CONTENT AT ONCE (IT WILL CAUSE AN ERROR)\n - IF YOU WANT TO EDIT MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES\n - DO NOT USE THIS TOOL FOR APPENDING TEXT TO FILES - USE appendTextFile TOOL INSTEAD\n `,\n inputSchema: inputSchema.shape,\n }\n}\nexport async function editTextFile(input: InputSchema) {\n const { path, newText, oldText } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await applyFileEdit(validatedPath, newText, oldText)\n return {\n path: validatedPath,\n newText,\n oldText,\n }\n}\nfunction normalizeLineEndings(text: string): string {\n return text.replace(/\\r\\n/g, \"\\n\")\n}\nasync function applyFileEdit(filePath: string, newText: string, oldText: string) {\n const content = normalizeLineEndings(await readFile(filePath, \"utf-8\"))\n const normalizedOld = normalizeLineEndings(oldText)\n const normalizedNew = normalizeLineEndings(newText)\n if (!content.includes(normalizedOld)) {\n throw new Error(`Could not find exact match for oldText in file ${filePath}`)\n }\n const modifiedContent = content.replace(normalizedOld, normalizedNew)\n await writeFile(filePath, modifiedContent, \"utf-8\")\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { basename, dirname, extname, resolve } from \"node:path\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\nexport function getFileInfoConfig() {\n return {\n title: \"Get file info\",\n description: dedent`\n File information retriever for detailed metadata about files and directories.\n\n Use cases:\n - Checking file existence and type\n - Getting file size and timestamps\n - Determining MIME types\n - Validating file accessibility\n\n How it works:\n - Retrieves comprehensive file system metadata\n - Detects MIME type from file extension\n - Provides both absolute and relative paths\n - Returns human-readable file sizes\n \n Parameters:\n - path: File or directory path to inspect\n `,\n inputSchema: inputSchema.shape,\n }\n}\nexport async function getFileInfo(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File or directory ${path} does not exist`)\n }\n const stats = statSync(validatedPath)\n const isDirectory = stats.isDirectory()\n const mimeType = isDirectory ? null : mime.lookup(validatedPath) || \"application/octet-stream\"\n const formatSize = (bytes: number): string => {\n if (bytes === 0) return \"0 B\"\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"]\n const i = Math.floor(Math.log(bytes) / Math.log(1024))\n return `${(bytes / 1024 ** i).toFixed(2)} ${units[i]}`\n }\n return {\n exists: true,\n path: validatedPath,\n absolutePath: resolve(validatedPath),\n name: basename(validatedPath),\n directory: dirname(validatedPath),\n extension: isDirectory ? null : extname(validatedPath),\n type: isDirectory ? \"directory\" : \"file\",\n mimeType,\n size: stats.size,\n sizeFormatted: formatSize(stats.size),\n created: stats.birthtime.toISOString(),\n modified: stats.mtime.toISOString(),\n accessed: stats.atime.toISOString(),\n permissions: {\n readable: true,\n writable: Boolean(stats.mode & 0o200),\n executable: Boolean(stats.mode & 0o100),\n },\n }\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { readdir } from \"node:fs/promises\"\nimport { join } from \"node:path\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\ninterface DirectoryItem {\n name: string\n path: string\n type: \"directory\" | \"file\"\n size: number\n modified: string\n}\nexport function listDirectoryConfig() {\n return {\n title: \"List directory\",\n description: dedent`\n Directory content lister with detailed file information.\n\n Use cases:\n - Exploring project structure\n - Finding files in a directory\n - Checking directory contents before operations\n - Understanding file organization\n\n How it works:\n - Lists all files and subdirectories in specified directory only\n - Provides file type, size, and modification time\n - Sorts entries alphabetically\n - Handles empty directories\n \n Parameters:\n - path: Directory path to list (optional, defaults to workspace root)\n `,\n inputSchema: inputSchema.shape,\n }\n}\nexport async function listDirectory(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`Directory ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!stats.isDirectory()) {\n throw new Error(`Path ${path} is not a directory.`)\n }\n const entries = await readdir(validatedPath)\n const items: DirectoryItem[] = []\n for (const entry of entries.sort()) {\n try {\n const fullPath = await validatePath(join(validatedPath, entry))\n const entryStats = statSync(fullPath)\n const item: DirectoryItem = {\n name: entry,\n path: entry,\n type: entryStats.isDirectory() ? \"directory\" : \"file\",\n size: entryStats.size,\n modified: entryStats.mtime.toISOString(),\n }\n items.push(item)\n } catch (e) {\n if (e instanceof Error && e.message.includes(\"perstack directory is not allowed\")) {\n continue\n }\n throw e\n }\n }\n return {\n path: validatedPath,\n items,\n }\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir, rename } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst inputSchema = z.object({\n source: z.string(),\n destination: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\nexport function moveFileConfig() {\n return {\n title: \"Move file\",\n description: dedent`\n File mover for relocating or renaming files within the workspace.\n\n Use cases:\n - Renaming files to follow naming conventions\n - Moving files to different directories\n - Organizing project structure\n - Backing up files before modifications\n\n How it works:\n - Validates source file existence\n - Creates destination directory if needed\n - Performs atomic move operation\n - Preserves file permissions and timestamps\n \n Parameters:\n - source: Current file path\n - destination: Target file path\n `,\n inputSchema: inputSchema.shape,\n }\n}\nexport async function moveFile(input: InputSchema) {\n const { source, destination } = input\n const validatedSource = await validatePath(source)\n const validatedDestination = await validatePath(destination)\n if (!existsSync(validatedSource)) {\n throw new Error(`Source file ${source} does not exist.`)\n }\n const sourceStats = statSync(validatedSource)\n if (!(sourceStats.mode & 0o200)) {\n throw new Error(`Source file ${source} is not writable`)\n }\n if (existsSync(validatedDestination)) {\n throw new Error(`Destination ${destination} already exists.`)\n }\n const destDir = dirname(validatedDestination)\n await mkdir(destDir, { recursive: true })\n await rename(validatedSource, validatedDestination)\n return {\n source: validatedSource,\n destination: validatedDestination,\n }\n}\n","import { existsSync } from \"node:fs\"\nimport { stat } from \"node:fs/promises\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst MAX_IMAGE_SIZE = 15 * 1024 * 1024 // 15MB limit\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport function readImageFileConfig() {\n return {\n title: \"Read image file\",\n description: dedent`\n Image file reader that converts images to base64 encoded strings with MIME type validation.\n\n Use cases:\n - Loading images for LLM to process\n - Retrieving image data for analysis or display\n - Converting workspace image files to base64 format\n\n How it works:\n - Validates file existence and MIME type before reading\n - Encodes file content as base64 string\n - Returns image data with correct MIME type for proper handling\n - Rejects unsupported formats with clear error messages\n\n Supported formats:\n - PNG (image/png)\n - JPEG/JPG (image/jpeg)\n - GIF (image/gif) - static only, animated not supported\n - WebP (image/webp)\n \n Notes:\n - Maximum file size: 15MB (larger files will be rejected)\n `,\n inputSchema: inputSchema.shape,\n }\n}\n\nexport async function readImageFile(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const mimeType = mime.lookup(validatedPath)\n if (!mimeType || ![\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\"].includes(mimeType)) {\n throw new Error(`File ${path} is not supported.`)\n }\n\n const fileStats = await stat(validatedPath)\n const fileSizeMB = fileStats.size / (1024 * 1024)\n if (fileStats.size > MAX_IMAGE_SIZE) {\n throw new Error(\n `Image file too large (${fileSizeMB.toFixed(1)}MB). Maximum supported size is ${MAX_IMAGE_SIZE / (1024 * 1024)}MB. Please use a smaller image file.`,\n )\n }\n return {\n path: validatedPath,\n mimeType,\n size: fileStats.size,\n }\n}\n","import { existsSync } from \"node:fs\"\nimport { stat } from \"node:fs/promises\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst MAX_PDF_SIZE = 30 * 1024 * 1024 // 30MB limit\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport function readPdfFileConfig() {\n return {\n title: \"Read PDF file\",\n description: dedent`\n PDF file reader that converts documents to base64 encoded resources.\n\n Use cases:\n - Extracting content from PDF documents for analysis\n - Loading PDF files for LLM processing\n - Retrieving PDF data for conversion or manipulation\n\n How it works:\n - Validates file existence and MIME type (application/pdf)\n - Encodes PDF content as base64 blob\n - Returns as resource type with proper MIME type and URI\n - Rejects non-PDF files with clear error messages\n\n Notes:\n - Returns entire PDF content, no page range support\n - Maximum file size: 10MB (larger files will be rejected)\n - Text extraction not performed, returns raw PDF data\n `,\n inputSchema: inputSchema.shape,\n }\n}\n\nexport async function readPdfFile(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const mimeType = mime.lookup(validatedPath)\n if (mimeType !== \"application/pdf\") {\n throw new Error(`File ${path} is not a PDF file.`)\n }\n const fileStats = await stat(validatedPath)\n const fileSizeMB = fileStats.size / (1024 * 1024)\n if (fileStats.size > MAX_PDF_SIZE) {\n throw new Error(\n `PDF file too large (${fileSizeMB.toFixed(1)}MB). Maximum supported size is ${MAX_PDF_SIZE / (1024 * 1024)}MB. Please use a smaller PDF file.`,\n )\n }\n return {\n path: validatedPath,\n mimeType,\n size: fileStats.size,\n }\n}\n","import { existsSync } from \"node:fs\"\nimport { readFile } from \"node:fs/promises\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n from: z.number().optional().describe(\"The line number to start reading from.\"),\n to: z.number().optional().describe(\"The line number to stop reading at.\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport function readTextFileConfig() {\n return {\n title: \"Read text file\",\n description: dedent`\n Text file reader with line range support for UTF-8 encoded files.\n\n Use cases:\n - Reading source code files for analysis\n - Extracting specific sections from large text files\n - Loading configuration or documentation files\n - Viewing log files or data files\n\n How it works:\n - Reads files as UTF-8 encoded text without format validation\n - Supports partial file reading via line number ranges\n - Returns content wrapped in JSON with metadata\n - WARNING: Binary files will cause errors or corrupted output\n\n Common file types:\n - Source code: .ts, .js, .py, .java, .cpp, etc.\n - Documentation: .md, .txt, .rst\n - Configuration: .json, .yaml, .toml, .ini\n - Data files: .csv, .log, .sql\n `,\n inputSchema: inputSchema.shape,\n }\n}\n\nexport async function readTextFile(input: InputSchema) {\n const { path, from, to } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const fileContent = await readFile(validatedPath, \"utf-8\")\n const lines = fileContent.split(\"\\n\")\n const fromLine = from ?? 0\n const toLine = to ?? lines.length\n const selectedLines = lines.slice(fromLine, toLine)\n const content = selectedLines.join(\"\\n\")\n return {\n path,\n content,\n from: fromLine,\n to: toLine,\n }\n}\n","import { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\n\nconst inputSchema = z.object({\n urls: z.array(z.string()).min(1).max(10).describe(\"Array of URLs to test (max 10 URLs).\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport function testUrlConfig() {\n return {\n title: \"Test URL\",\n description: dedent`\n URL tester that validates multiple URLs and extracts metadata.\n\n Use cases:\n - Checking if URLs are accessible before web scraping\n - Validating URL collections for RAG processes\n - Extracting page metadata (title, description) for content analysis\n - Batch URL validation for link checking\n\n How it works:\n - Performs HTTP GET requests to each URL\n - Returns status code, title, and description for each URL\n - Handles errors gracefully with timeout protection\n - Processes URLs in parallel for performance\n\n Rules:\n - URLs must be valid HTTP/HTTPS addresses\n - Maximum 10 URLs per request to prevent abuse\n - 10 second timeout per URL request\n - Returns empty title/description if HTML parsing fails\n `,\n inputSchema: inputSchema.shape,\n }\n}\n\ninterface UrlTestResult {\n url: string\n status: number\n title: string\n description: string\n}\n\nexport async function testUrls(input: InputSchema): Promise<{ results: UrlTestResult[] }> {\n const { urls } = input\n const results = await Promise.allSettled(\n urls.map(async (url) => {\n try {\n const controller = new AbortController()\n const timeoutId = setTimeout(() => controller.abort(), 10_000)\n const response = await fetch(url, {\n method: \"GET\",\n signal: controller.signal,\n headers: {\n \"User-Agent\": \"Perstack URL Tester/1.0\",\n },\n })\n clearTimeout(timeoutId)\n let title = \"\"\n let description = \"\"\n if (response.ok && response.headers.get(\"content-type\")?.includes(\"text/html\")) {\n try {\n const html = await response.text()\n title = extractTitle(html)\n description = extractDescription(html)\n } catch {\n // HTML parsing failed, keep empty title/description\n }\n }\n return {\n url,\n status: response.status,\n title,\n description,\n }\n } catch (error) {\n return {\n url,\n status: 0,\n title: \"\",\n description: error instanceof Error ? error.message : \"Unknown error\",\n }\n }\n }),\n )\n\n return {\n results: results.map((result) => {\n if (result.status === \"fulfilled\") {\n return result.value\n }\n return {\n url: \"unknown\",\n status: 0,\n title: \"\",\n description: \"Promise rejected\",\n }\n }),\n }\n}\n\nfunction extractTitle(html: string): string {\n const titleMatch = html.match(/<title[^>]*>([^<]*)/i)\n return titleMatch ? titleMatch[1].trim() : \"\"\n}\n\nfunction extractDescription(html: string): string {\n const metaDescMatch = html.match(\n /<meta[^>]*name=[\"']description[\"'][^>]*content=[\"']([^\"']*)[\"']/i,\n )\n if (metaDescMatch) {\n return metaDescMatch[1].trim()\n }\n\n const ogDescMatch = html.match(\n /<meta[^>]*property=[\"']og:description[\"'][^>]*content=[\"']([^\"']*)[\"']/i,\n )\n if (ogDescMatch) {\n return ogDescMatch[1].trim()\n }\n\n return \"\"\n}\n","import { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\n\nconst inputSchema = z.object({\n thought: z.string().describe(\"Your current thinking step\"),\n nextThoughtNeeded: z\n .boolean()\n .optional()\n .describe(\"true if you need more thinking, even if at what seemed like the end\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport function thinkConfig() {\n return {\n title: \"think\",\n description: dedent`\n Sequential thinking tool for step-by-step problem analysis and solution development.\n\n Use cases:\n - Breaking down complex problems into manageable steps\n - Developing solutions through iterative reasoning\n - Analyzing problems that require multiple perspectives\n - Planning tasks with dependencies and considerations\n\n How it works:\n - Records each thinking step sequentially\n - Maintains thought history for context\n - Continues until solution is reached\n - Returns thought count and continuation status\n\n Parameters:\n - thought: Current reasoning step or analysis\n - nextThoughtNeeded: Whether additional thinking is required (optional)\n\n Best practices:\n - Use multiple calls for sophisticated reasoning chains\n - Progress from high-level overview to detailed analysis (drill-down approach)\n - Capture insights and eureka moments as they emerge\n - Engage in reflective introspection and constructive self-critique\n - Set nextThoughtNeeded to false only when fully satisfied with the solution\n `,\n inputSchema: inputSchema.shape,\n }\n}\n\nclass Thought {\n thoughtHistory: InputSchema[] = []\n branches: Record<string, InputSchema[]> = {}\n\n public processThought(input: InputSchema) {\n const { nextThoughtNeeded } = input\n this.thoughtHistory.push(input)\n return {\n nextThoughtNeeded,\n thoughtHistoryLength: this.thoughtHistory.length,\n }\n }\n}\nconst thought = new Thought()\n\nexport async function think(input: InputSchema) {\n return thought.processThought(input)\n}\n","import { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\n\nclass Todo {\n currentTodoId = 0\n todos: { id: number; title: string; completed: boolean }[] = []\n\n public processTodo(input: TodoInputSchema) {\n const { newTodos, completedTodos } = input\n if (newTodos) {\n this.todos.push(\n ...newTodos.map((title) => ({ id: this.currentTodoId++, title, completed: false })),\n )\n }\n if (completedTodos) {\n this.todos = this.todos.map((todo) => ({\n ...todo,\n completed: todo.completed || completedTodos.includes(todo.id),\n }))\n }\n return {\n todos: this.todos,\n }\n }\n\n public clearTodo() {\n this.todos = []\n this.currentTodoId = 0\n return {\n todos: this.todos,\n }\n }\n}\nconst todoSingleton = new Todo()\n\nconst todoInputSchema = z.object({\n newTodos: z.array(z.string()).describe(\"New todos to add\").optional(),\n completedTodos: z.array(z.number()).describe(\"Todo ids that are completed\").optional(),\n})\ntype TodoInputSchema = z.infer<typeof todoInputSchema>\n\nexport function todoConfig() {\n return {\n title: \"todo\",\n description: dedent`\n Todo list manager that tracks tasks and their completion status.\n\n Use cases:\n - Creating new tasks or action items\n - Marking tasks as completed\n - Viewing current task list and status\n\n How it works:\n - Each todo gets a unique ID when created\n - Returns the full todo list after every operation\n - Maintains state across multiple calls\n\n Parameters:\n - newTodos: Array of task descriptions to add\n - completedTodos: Array of todo IDs to mark as completed\n `,\n inputSchema: todoInputSchema.shape,\n }\n}\n\nexport async function todo(input: TodoInputSchema) {\n return todoSingleton.processTodo(input)\n}\n\nconst clearTodoInputSchema = z.object({})\ntype ClearTodoInputSchema = z.infer<typeof clearTodoInputSchema>\n\nexport function clearTodoConfig() {\n return {\n title: \"clearTodo\",\n description: dedent`\n Clears the todo list.\n\n Use cases:\n - Resetting the todo list to an empty state\n - Starting fresh with a new task list\n - Clearing all tasks for a new day or project\n\n How it works:\n - Resets the todo list to an empty state\n - Returns an empty todo list\n `,\n inputSchema: clearTodoInputSchema.shape,\n }\n}\n\nexport async function clearTodo(input: ClearTodoInputSchema) {\n return todoSingleton.clearTodo()\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir, writeFile } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\n\nconst toolInputSchema = z.object({\n path: z.string().describe(\"Target file path (relative or absolute).\"),\n text: z.string().min(1).max(10_000).describe(\"Text to write to the file. Max 10000 characters.\"),\n})\ntype ToolInputSchema = z.infer<typeof toolInputSchema>\nexport function writeTextFileConfig() {\n return {\n title: \"writeTextFile\",\n description: dedent`\n Text file writer that creates or overwrites files with UTF-8 content.\n\n Use cases:\n - Creating new configuration files\n - Writing generated code or documentation\n - Saving processed data or results\n - Creating log files or reports\n\n How it works:\n - Writes content as UTF-8 encoded text\n - Returns success status with file path\n\n Rules:\n - IF THE FILE ALREADY EXISTS, IT WILL BE OVERWRITTEN\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT WRITE ALL THE CONTENT AT ONCE (IT WILL CAUSE AN ERROR)\n - IF YOU WANT TO WRITE MORE THAN 10,000 CHARACTERS, USE \"appendTextFile\" TOOL AFTER THIS ONE\n `,\n inputSchema: toolInputSchema.shape,\n }\n}\nexport async function writeTextFile(input: ToolInputSchema) {\n const { path, text } = input\n const validatedPath = await validatePath(path)\n if (existsSync(validatedPath)) {\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n }\n const dir = dirname(validatedPath)\n await mkdir(dir, { recursive: true })\n await writeFile(validatedPath, text, \"utf-8\")\n return {\n path: validatedPath,\n text,\n }\n}\n"]}