@humanlayer/agentlayer-justbash 0.0.7

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 (61) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +630 -0
  4. package/dist/index.js.map +22 -0
  5. package/dist/prompts/index.d.ts +29 -0
  6. package/dist/prompts/index.d.ts.map +1 -0
  7. package/dist/prompts/index.js +123 -0
  8. package/dist/prompts/index.js.map +10 -0
  9. package/dist/tools/apply-patch.d.ts +9 -0
  10. package/dist/tools/apply-patch.d.ts.map +1 -0
  11. package/dist/tools/bash.d.ts +8 -0
  12. package/dist/tools/bash.d.ts.map +1 -0
  13. package/dist/tools/code-search.d.ts +12 -0
  14. package/dist/tools/code-search.d.ts.map +1 -0
  15. package/dist/tools/edit.d.ts +12 -0
  16. package/dist/tools/edit.d.ts.map +1 -0
  17. package/dist/tools/glob.d.ts +6 -0
  18. package/dist/tools/glob.d.ts.map +1 -0
  19. package/dist/tools/grep.d.ts +8 -0
  20. package/dist/tools/grep.d.ts.map +1 -0
  21. package/dist/tools/index.d.ts +13 -0
  22. package/dist/tools/index.d.ts.map +1 -0
  23. package/dist/tools/index.js +510 -0
  24. package/dist/tools/index.js.map +21 -0
  25. package/dist/tools/list.d.ts +7 -0
  26. package/dist/tools/list.d.ts.map +1 -0
  27. package/dist/tools/read.d.ts +7 -0
  28. package/dist/tools/read.d.ts.map +1 -0
  29. package/dist/tools/skill.d.ts +10 -0
  30. package/dist/tools/skill.d.ts.map +1 -0
  31. package/dist/tools/web-fetch.d.ts +7 -0
  32. package/dist/tools/web-fetch.d.ts.map +1 -0
  33. package/dist/tools/web-search.d.ts +16 -0
  34. package/dist/tools/web-search.d.ts.map +1 -0
  35. package/dist/tools/write.d.ts +6 -0
  36. package/dist/tools/write.d.ts.map +1 -0
  37. package/package.json +59 -0
  38. package/src/index.ts +2 -0
  39. package/src/prompts/index.ts +161 -0
  40. package/src/tools/apply-patch.ts +121 -0
  41. package/src/tools/apply-patch.txt +35 -0
  42. package/src/tools/bash.ts +20 -0
  43. package/src/tools/bash.txt +114 -0
  44. package/src/tools/code-search.ts +119 -0
  45. package/src/tools/edit.ts +58 -0
  46. package/src/tools/edit.txt +10 -0
  47. package/src/tools/glob.ts +33 -0
  48. package/src/tools/glob.txt +6 -0
  49. package/src/tools/grep.ts +53 -0
  50. package/src/tools/grep.txt +8 -0
  51. package/src/tools/index.ts +12 -0
  52. package/src/tools/list.ts +41 -0
  53. package/src/tools/list.txt +5 -0
  54. package/src/tools/read.ts +16 -0
  55. package/src/tools/read.txt +14 -0
  56. package/src/tools/skill.ts +49 -0
  57. package/src/tools/web-fetch.ts +97 -0
  58. package/src/tools/web-fetch.txt +10 -0
  59. package/src/tools/web-search.ts +59 -0
  60. package/src/tools/write.ts +26 -0
  61. package/src/tools/write.txt +8 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/prompts/index.ts", "../src/tools/apply-patch.ts", "../src/tools/bash.ts", "../src/tools/code-search.ts", "../src/tools/edit.ts", "../src/tools/glob.ts", "../src/tools/grep.ts", "../src/tools/list.ts", "../src/tools/read.ts", "../src/tools/skill.ts", "../src/tools/web-fetch.ts", "../src/tools/web-search.ts", "../src/tools/write.ts"],
4
+ "sourcesContent": [
5
+ "import { resolve } from 'node:path'\nimport {\n\ttype CodingPromptKey,\n\ttype EnvironmentPromptOptions as CoreEnvironmentPromptOptions,\n\tcreateAgentSystemPrompt as createCoreAgentSystemPrompt,\n\tenvironmentPrompt as createEnvironmentPrompt,\n\trepoInstructionsPrompt as createRepoInstructionsPrompt,\n} from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nexport {\n\tbuildCodingProviderOptions,\n\ttype CodingModelFamily,\n\ttype CodingPromptKey,\n\tdetectModelFamily,\n\tgetSystemPromptForModel,\n\tresolveCodingModelPrompt,\n\tsystemPrompts,\n\ttarsPersona,\n} from '@humanlayer/agentlayer-core/prompts'\n\nconst DEFAULT_REPO_INSTRUCTION_CANDIDATES = ['CLAUDE.md', 'AGENTS.md', 'CONTEXT.md']\n\nasync function getRepoRoot(bash: Bash, cwd: string): Promise<string | undefined> {\n\tconst result = await bash.exec(`git -C \"${cwd}\" rev-parse --show-toplevel 2>/dev/null`)\n\tif (result.exitCode !== 0) return undefined\n\tconst root = result.stdout.trim()\n\treturn root.length > 0 ? root : undefined\n}\n\nasync function readFileIfExists(bash: Bash, filePath: string): Promise<string | undefined> {\n\tconst result = await bash.exec(`cat \"${filePath}\" 2>/dev/null`)\n\tif (result.exitCode !== 0) return undefined\n\treturn result.stdout\n}\n\nasync function firstExistingCandidate(bash: Bash, cwd: string, candidates: string[]): Promise<string | undefined> {\n\tfor (const candidate of candidates) {\n\t\tconst filePath = `${cwd}/${candidate}`\n\t\tconst contents = await readFileIfExists(bash, filePath)\n\t\tif (contents !== undefined) return filePath\n\t}\n\n\treturn undefined\n}\n\nasync function findRepoInstructions(\n\tbash: Bash,\n\tstartCwd: string,\n\tcandidates: string[],\n\tskipRepoRootFallback: boolean,\n): Promise<{ path: string; contents: string } | undefined> {\n\tconst cwdPath = await firstExistingCandidate(bash, startCwd, candidates)\n\tif (cwdPath) {\n\t\tconst contents = await readFileIfExists(bash, cwdPath)\n\t\tif (contents?.trim()) {\n\t\t\treturn { path: cwdPath, contents }\n\t\t}\n\t}\n\n\tif (!skipRepoRootFallback) {\n\t\tconst repoRoot = await getRepoRoot(bash, startCwd)\n\t\tif (repoRoot && repoRoot !== startCwd) {\n\t\t\tconst rootPath = await firstExistingCandidate(bash, repoRoot, candidates)\n\t\t\tif (rootPath) {\n\t\t\t\tconst contents = await readFileIfExists(bash, rootPath)\n\t\t\t\tif (contents?.trim()) {\n\t\t\t\t\treturn { path: rootPath, contents }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nexport interface EnvironmentPromptOptions extends Omit<CoreEnvironmentPromptOptions, 'isGitRepo'> {\n\tisGitRepo?: boolean\n}\n\nexport async function environmentPrompt(bash: Bash, opts: EnvironmentPromptOptions): Promise<string> {\n\tconst isGitRepo = opts.isGitRepo ?? (await getRepoRoot(bash, opts.cwd)) !== undefined\n\treturn createEnvironmentPrompt({\n\t\tcwd: opts.cwd,\n\t\tisGitRepo,\n\t\tplatform: opts.platform,\n\t\tdate: opts.date,\n\t})\n}\n\nexport interface RepoInstructionsPromptOptions {\n\tcwd: string\n\tfilePath?: string\n\tcandidates?: string[]\n\tallowMissing?: boolean\n\t_skipRepoRootFallback?: boolean\n}\n\nexport async function repoInstructionsPrompt(\n\tbash: Bash,\n\topts: RepoInstructionsPromptOptions,\n): Promise<string | undefined> {\n\tif (opts.filePath) {\n\t\tconst filePath = opts.filePath.startsWith('/') ? opts.filePath : resolve(opts.cwd, opts.filePath)\n\t\tconst contents = await readFileIfExists(bash, filePath)\n\t\tif (!contents?.trim()) {\n\t\t\tif (opts.allowMissing) return undefined\n\t\t\tthrow new Error(`Repo instructions file is empty: ${filePath}`)\n\t\t}\n\t\treturn createRepoInstructionsPrompt({ path: filePath, contents })\n\t}\n\n\tconst candidates = opts.candidates ?? DEFAULT_REPO_INSTRUCTION_CANDIDATES\n\tconst found = await findRepoInstructions(bash, opts.cwd, candidates, opts._skipRepoRootFallback ?? false)\n\n\tif (!found) {\n\t\tif (opts.allowMissing) return undefined\n\t\tconst repoRoot = await getRepoRoot(bash, opts.cwd)\n\t\tconst searched = repoRoot ? [`${opts.cwd} (cwd)`, `${repoRoot} (repo root)`] : [opts.cwd]\n\t\tthrow new Error(`No repo instructions found. Searched for ${candidates.join(', ')} in: ${searched.join(', ')}`)\n\t}\n\n\treturn createRepoInstructionsPrompt(found)\n}\n\nexport interface CreateAgentSystemPromptOptions {\n\tbash: Bash\n\tcwd: string\n\tmodel: CodingPromptKey | string\n\tfilePath?: string\n\tcandidates?: string[]\n\tallowMissingRepoInstructions?: boolean\n\tincludeEnvironment?: boolean\n\tplatform?: string\n\tdate?: Date\n\tsystemPromptAdditions?: string[]\n}\n\nexport async function createAgentSystemPrompt(opts: CreateAgentSystemPromptOptions): Promise<string[]> {\n\tconst repoInstructions = await repoInstructionsPrompt(opts.bash, {\n\t\tcwd: opts.cwd,\n\t\tfilePath: opts.filePath,\n\t\tcandidates: opts.candidates,\n\t\tallowMissing: opts.allowMissingRepoInstructions ?? true,\n\t})\n\tconst environment =\n\t\topts.includeEnvironment === false\n\t\t\t? undefined\n\t\t\t: await environmentPrompt(opts.bash, {\n\t\t\t\t\tcwd: opts.cwd,\n\t\t\t\t\tplatform: opts.platform,\n\t\t\t\t\tdate: opts.date,\n\t\t\t\t})\n\n\treturn createCoreAgentSystemPrompt({\n\t\tmodel: opts.model,\n\t\trepoInstructions,\n\t\tenvironment,\n\t\tsystemPromptAdditions: opts.systemPromptAdditions,\n\t})\n}\n",
6
+ "import { isAbsolute, resolve } from 'node:path'\nimport { ApplyPatchTool } from '@humanlayer/agentlayer-core/interfaces'\nimport { APPLY_PATCH_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport { applyUpdateChunks, type PatchOperation, parsePatch, validateHunks } from '@humanlayer/agentlayer-core/utils'\nimport type { Bash } from 'just-bash'\n\nexport interface ApplyPatchOptions {\n\t/** Working directory for resolving relative paths. If not provided, paths are resolved by bash's cwd. */\n\tcwd?: string\n}\n\nexport function createApplyPatchTool(bash: Bash, opts: ApplyPatchOptions = {}) {\n\tconst { cwd } = opts\n\n\t/**\n\t * Resolve a file path to absolute if cwd is provided and path is relative.\n\t * Note: bash.exec already uses bash's cwd, but this ensures consistency\n\t * when passing paths to commands.\n\t */\n\tconst _resolvePath = (filePath: string): string => {\n\t\tif (!cwd || isAbsolute(filePath)) {\n\t\t\treturn filePath\n\t\t}\n\t\treturn resolve(cwd, filePath)\n\t}\n\treturn ApplyPatchTool.define(\n\t\tasync (input) => {\n\t\t\tconst { patch_text } = input\n\n\t\t\tif (!patch_text || !patch_text.trim()) {\n\t\t\t\tthrow new Error('patch_text is required')\n\t\t\t}\n\n\t\t\tlet ops: PatchOperation[]\n\t\t\ttry {\n\t\t\t\tops = parsePatch(patch_text)\n\t\t\t} catch (err) {\n\t\t\t\tthrow new Error(`apply_patch verification failed: ${err}`)\n\t\t\t}\n\n\t\t\tif (ops.length === 0) {\n\t\t\t\tthrow new Error('patch rejected: empty patch')\n\t\t\t}\n\n\t\t\tconst hasHunks = ops.some((op) => op.type === 'add' || op.chunks.length > 0 || op.type === 'delete')\n\t\t\tif (!hasHunks) {\n\t\t\t\tthrow new Error('apply_patch verification failed: no hunks found')\n\t\t\t}\n\n\t\t\t// Read helper via bash\n\t\t\tconst readFile = async (filePath: string): Promise<string> => {\n\t\t\t\tconst result = await bash.exec(`cat \"${filePath}\"`)\n\t\t\t\tif (result.exitCode !== 0) {\n\t\t\t\t\tthrow new Error(`File not found: ${filePath}`)\n\t\t\t\t}\n\t\t\t\treturn result.stdout\n\t\t\t}\n\n\t\t\t// Validation phase — reads only, no writes\n\t\t\tawait validateHunks(ops, readFile)\n\n\t\t\t// Apply phase\n\t\t\tconst results: string[] = []\n\n\t\t\tfor (const op of ops) {\n\t\t\t\tif (op.type === 'add') {\n\t\t\t\t\tconst filePath = op.filePath\n\t\t\t\t\t// Ensure parent directory exists\n\t\t\t\t\tconst mkdirResult = await bash.exec(`mkdir -p \"$(dirname \"${filePath}\")\"`)\n\t\t\t\t\tif (mkdirResult.exitCode !== 0) {\n\t\t\t\t\t\tthrow new Error(`Failed to create parent directory for ${filePath}: ${mkdirResult.stderr}`)\n\t\t\t\t\t}\n\t\t\t\t\t// Write content using a heredoc\n\t\t\t\t\tconst DELIM = 'PATCHEOF_8f3a2b1c'\n\t\t\t\t\tconst content = op.addContent ?? ''\n\t\t\t\t\tconst writeResult = await bash.exec(`cat > \"${filePath}\" <<'${DELIM}'\\n${content}\\n${DELIM}`)\n\t\t\t\t\tif (writeResult.exitCode !== 0) {\n\t\t\t\t\t\tthrow new Error(`Failed to write file ${filePath}: ${writeResult.stderr}`)\n\t\t\t\t\t}\n\t\t\t\t\tresults.push(`Added ${filePath}`)\n\t\t\t\t} else if (op.type === 'update') {\n\t\t\t\t\tconst content = await readFile(op.filePath)\n\t\t\t\t\tconst updated = applyUpdateChunks(content, op.chunks)\n\t\t\t\t\tconst DELIM = 'PATCHEOF_8f3a2b1c'\n\t\t\t\t\tconst writeResult = await bash.exec(`cat > \"${op.filePath}\" <<'${DELIM}'\\n${updated}\\n${DELIM}`)\n\t\t\t\t\tif (writeResult.exitCode !== 0) {\n\t\t\t\t\t\tthrow new Error(`Failed to write file ${op.filePath}: ${writeResult.stderr}`)\n\t\t\t\t\t}\n\t\t\t\t\tresults.push(`Updated ${op.filePath}`)\n\t\t\t\t} else if (op.type === 'move') {\n\t\t\t\t\tconst content = await readFile(op.filePath)\n\t\t\t\t\tconst updated = applyUpdateChunks(content, op.chunks)\n\t\t\t\t\tconst targetPath = op.targetPath!\n\t\t\t\t\tconst mkdirResult = await bash.exec(`mkdir -p \"$(dirname \"${targetPath}\")\"`)\n\t\t\t\t\tif (mkdirResult.exitCode !== 0) {\n\t\t\t\t\t\tthrow new Error(`Failed to create parent directory for ${targetPath}: ${mkdirResult.stderr}`)\n\t\t\t\t\t}\n\t\t\t\t\tconst DELIM = 'PATCHEOF_8f3a2b1c'\n\t\t\t\t\tconst writeResult = await bash.exec(`cat > \"${targetPath}\" <<'${DELIM}'\\n${updated}\\n${DELIM}`)\n\t\t\t\t\tif (writeResult.exitCode !== 0) {\n\t\t\t\t\t\tthrow new Error(`Failed to write file ${targetPath}: ${writeResult.stderr}`)\n\t\t\t\t\t}\n\t\t\t\t\tconst rmResult = await bash.exec(`rm \"${op.filePath}\"`)\n\t\t\t\t\tif (rmResult.exitCode !== 0) {\n\t\t\t\t\t\tthrow new Error(`Failed to remove original file ${op.filePath}: ${rmResult.stderr}`)\n\t\t\t\t\t}\n\t\t\t\t\tresults.push(`Moved ${op.filePath} → ${targetPath}`)\n\t\t\t\t} else if (op.type === 'delete') {\n\t\t\t\t\tconst rmResult = await bash.exec(`rm \"${op.filePath}\"`)\n\t\t\t\t\tif (rmResult.exitCode !== 0) {\n\t\t\t\t\t\tthrow new Error(`Failed to delete file ${op.filePath}: ${rmResult.stderr}`)\n\t\t\t\t\t}\n\t\t\t\t\tresults.push(`Deleted ${op.filePath}`)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn results.join('\\n')\n\t\t},\n\t\t{ description: APPLY_PATCH_DESCRIPTION },\n\t)\n}\n",
7
+ "import { BashTool } from '@humanlayer/agentlayer-core/interfaces'\nimport { BASH_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport { truncateOutput } from '@humanlayer/agentlayer-core/utils'\nimport type { Bash } from 'just-bash'\n\nexport function createJustBashTool(bash: Bash) {\n\treturn BashTool.define(\n\t\tasync (input) => {\n\t\t\tconst result = await bash.exec(input.command, {\n\t\t\t\t...(input.workdir ? { cwd: input.workdir } : {}),\n\t\t\t})\n\t\t\tlet output = result.stdout\n\t\t\tif (result.stderr) {\n\t\t\t\toutput += `\\nSTDERR: ${result.stderr}`\n\t\t\t}\n\t\t\treturn truncateOutput(`Exit code: ${result.exitCode}\\n${output}`)\n\t\t},\n\t\t{ description: BASH_DESCRIPTION },\n\t)\n}\n",
8
+ "import type { CodeSearchInput } from '@humanlayer/agentlayer-core/interfaces'\nimport { CodeSearchTool } from '@humanlayer/agentlayer-core/interfaces'\nimport { CODE_SEARCH_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nconst DEFAULT_TIMEOUT_SEC = 30\nconst CONTEXT7_BASE_URL = 'https://context7.com'\n\nexport interface JustBashCodeSearchOptions {\n\texaApiKey?: string\n\tcontext7ApiKey?: string\n\ttimeoutSec?: number\n}\n\nasync function fetchExaViaBash(\n\tbash: Bash,\n\tinput: CodeSearchInput,\n\tapiKey: string,\n\ttimeoutSec: number,\n): Promise<string | null> {\n\ttry {\n\t\tconst query = `${input.query} -- for ${input.packageName} in ${input.language}`\n\t\tconst payload = JSON.stringify({ query, tokensNum: 5000 })\n\t\tconst escapedPayload = payload.replace(/'/g, \"'\\\\''\")\n\n\t\tconst result = await bash.exec(\n\t\t\t`curl -s --max-time ${timeoutSec} ` +\n\t\t\t\t`-H \"Content-Type: application/json\" ` +\n\t\t\t\t`-H \"x-api-key: ${apiKey}\" ` +\n\t\t\t\t`-d '${escapedPayload}' ` +\n\t\t\t\t`https://api.exa.ai/context`,\n\t\t)\n\n\t\tif (result.exitCode !== 0) return null\n\n\t\tconst data = JSON.parse(result.stdout) as { response?: string }\n\t\treturn data.response ?? null\n\t} catch {\n\t\treturn null\n\t}\n}\n\nasync function fetchContext7ViaBash(\n\tbash: Bash,\n\tinput: CodeSearchInput,\n\tapiKey: string,\n\ttimeoutSec: number,\n): Promise<string | null> {\n\ttry {\n\t\t// Step 1: search for the library\n\t\tconst searchQuery = encodeURIComponent(input.query)\n\t\tconst libName = encodeURIComponent(input.packageName)\n\n\t\tconst searchResult = await bash.exec(\n\t\t\t`curl -s --max-time ${timeoutSec} ` +\n\t\t\t\t`-H \"Authorization: Bearer ${apiKey}\" ` +\n\t\t\t\t`\"${CONTEXT7_BASE_URL}/api/v2/libs/search?query=${searchQuery}&libraryName=${libName}\"`,\n\t\t)\n\n\t\tif (searchResult.exitCode !== 0) return null\n\n\t\tconst searchData = JSON.parse(searchResult.stdout) as {\n\t\t\tresults?: Array<{ id: string; title: string; trustScore?: number }>\n\t\t}\n\t\tconst libraries = searchData.results ?? []\n\t\tif (libraries.length === 0) return null\n\n\t\tconst best = libraries.reduce((a, b) => ((b.trustScore ?? 0) > (a.trustScore ?? 0) ? b : a))\n\n\t\t// Step 2: fetch context for the selected library\n\t\tconst contextQuery = encodeURIComponent(input.query)\n\t\tconst libId = encodeURIComponent(best.id)\n\n\t\tconst contextResult = await bash.exec(\n\t\t\t`curl -s --max-time ${timeoutSec} ` +\n\t\t\t\t`-H \"Authorization: Bearer ${apiKey}\" ` +\n\t\t\t\t`\"${CONTEXT7_BASE_URL}/api/v2/context?query=${contextQuery}&libraryId=${libId}\"`,\n\t\t)\n\n\t\tif (contextResult.exitCode !== 0) return null\n\t\treturn contextResult.stdout\n\t} catch {\n\t\treturn null\n\t}\n}\n\nexport function createCodeSearchTool(bash: Bash, opts: JustBashCodeSearchOptions) {\n\tif (!opts.exaApiKey && !opts.context7ApiKey) {\n\t\tthrow new Error('At least one API key (exaApiKey or context7ApiKey) is required')\n\t}\n\n\tconst timeoutSec = opts.timeoutSec ?? DEFAULT_TIMEOUT_SEC\n\n\treturn CodeSearchTool.define(\n\t\tasync (input: CodeSearchInput): Promise<string> => {\n\t\t\tconst [exaResult, c7Result] = await Promise.all([\n\t\t\t\topts.exaApiKey ? fetchExaViaBash(bash, input, opts.exaApiKey, timeoutSec) : Promise.resolve(null),\n\t\t\t\topts.context7ApiKey\n\t\t\t\t\t? fetchContext7ViaBash(bash, input, opts.context7ApiKey, timeoutSec)\n\t\t\t\t\t: Promise.resolve(null),\n\t\t\t])\n\n\t\t\tconst parts: string[] = []\n\t\t\tif (c7Result) {\n\t\t\t\tparts.push(`## Context7 Documentation\\n\\n${c7Result}`)\n\t\t\t}\n\t\t\tif (exaResult) {\n\t\t\t\tparts.push(`## Exa Search Results\\n\\n${exaResult}`)\n\t\t\t}\n\n\t\t\tif (parts.length === 0) {\n\t\t\t\treturn `No documentation found for \"${input.packageName}\" with query: ${input.query}`\n\t\t\t}\n\n\t\t\treturn parts.join('\\n\\n---\\n\\n')\n\t\t},\n\t\t{ description: CODE_SEARCH_DESCRIPTION },\n\t)\n}\n",
9
+ "import { EditTool } from '@humanlayer/agentlayer-core/interfaces'\nimport { EDIT_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nexport function createEditTool(bash: Bash) {\n\treturn EditTool.define(\n\t\tasync (input) => {\n\t\t\t// Read the file content\n\t\t\tconst catResult = await bash.exec(`cat \"${input.file_path}\"`)\n\t\t\tif (catResult.exitCode !== 0) {\n\t\t\t\tthrow new Error(`File ${input.file_path} not found`)\n\t\t\t}\n\n\t\t\tconst content = catResult.stdout\n\n\t\t\tif (!content.includes(input.old_string)) {\n\t\t\t\treturn { content, matchCount: 0 }\n\t\t\t}\n\n\t\t\tlet updated: string\n\t\t\tlet matchCount: number\n\n\t\t\tif (input.replace_all) {\n\t\t\t\tlet count = 0\n\t\t\t\tlet pos = 0\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst idx = content.indexOf(input.old_string, pos)\n\t\t\t\t\tif (idx === -1) break\n\t\t\t\t\tcount++\n\t\t\t\t\tpos = idx + input.old_string.length\n\t\t\t\t}\n\t\t\t\tupdated = content.split(input.old_string).join(input.new_string)\n\t\t\t\tmatchCount = count\n\t\t\t} else {\n\t\t\t\t// Single replacement — check for multiple matches\n\t\t\t\tconst firstIdx = content.indexOf(input.old_string)\n\t\t\t\tconst lastIdx = content.lastIndexOf(input.old_string)\n\t\t\t\tif (firstIdx !== lastIdx) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Found multiple matches for old_string. Provide more surrounding context to make the match unique.',\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tupdated = content.replace(input.old_string, input.new_string)\n\t\t\t\tmatchCount = 1\n\t\t\t}\n\n\t\t\t// Write the updated content back using a heredoc\n\t\t\tconst DELIM = 'EDITEOF_8f3a2b1c'\n\t\t\tconst writeResult = await bash.exec(`cat > \"${input.file_path}\" <<'${DELIM}'\\n${updated}\\n${DELIM}`)\n\t\t\tif (writeResult.exitCode !== 0) {\n\t\t\t\tthrow new Error(`Failed to write file ${input.file_path}: ${writeResult.stderr}`)\n\t\t\t}\n\n\t\t\treturn { content: updated, matchCount }\n\t\t},\n\t\t{ description: EDIT_DESCRIPTION },\n\t)\n}\n",
10
+ "import { GlobTool } from '@humanlayer/agentlayer-core/interfaces'\nimport { GLOB_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nexport function createGlobTool(bash: Bash) {\n\treturn GlobTool.define(\n\t\tasync (input) => {\n\t\t\tconst searchPath = input.path ?? '.'\n\t\t\t// Use rg --files with glob filter — rg is typically available in just-bash environments\n\t\t\tconst result = await bash.exec(`rg --files -g \"${input.pattern}\" \"${searchPath}\" 2>/dev/null`)\n\n\t\t\tif (result.exitCode !== 0 && result.exitCode !== 1) {\n\t\t\t\t// Non-zero / non-empty exit may mean rg not available — fall back to find\n\t\t\t\tconst findResult = await bash.exec(\n\t\t\t\t\t`find \"${searchPath}\" -type f -name \"${input.pattern}\" 2>/dev/null | head -100`,\n\t\t\t\t)\n\t\t\t\tif (findResult.exitCode !== 0) {\n\t\t\t\t\treturn []\n\t\t\t\t}\n\t\t\t\treturn findResult.stdout\n\t\t\t\t\t.split('\\n')\n\t\t\t\t\t.map((l) => l.trim())\n\t\t\t\t\t.filter(Boolean)\n\t\t\t}\n\n\t\t\treturn result.stdout\n\t\t\t\t.split('\\n')\n\t\t\t\t.map((l) => l.trim())\n\t\t\t\t.filter(Boolean)\n\t\t},\n\t\t{ description: GLOB_DESCRIPTION },\n\t)\n}\n",
11
+ "import type { GrepMatch } from '@humanlayer/agentlayer-core/interfaces'\nimport { GrepTool } from '@humanlayer/agentlayer-core/interfaces'\nimport { GREP_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nconst MAX_MATCHES = 100\n\nexport function createGrepTool(bash: Bash) {\n\treturn GrepTool.define(\n\t\tasync (input) => {\n\t\t\tconst searchPath = input.path ?? '.'\n\t\t\tlet cmd = `rg -nH --hidden --no-messages --regexp \"${input.pattern}\"`\n\t\t\tif (input.include) {\n\t\t\t\tcmd += ` --glob \"${input.include}\"`\n\t\t\t}\n\t\t\tcmd += ` \"${searchPath}\"`\n\n\t\t\tconst result = await bash.exec(cmd)\n\n\t\t\t// Exit code 1 = no matches\n\t\t\tif (result.exitCode === 1) {\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tif (result.exitCode !== 0) {\n\t\t\t\tthrow new Error(`grep failed with exit code ${result.exitCode}: ${result.stderr}`)\n\t\t\t}\n\n\t\t\t// Parse `file:line:content` output lines\n\t\t\tconst matches: GrepMatch[] = []\n\t\t\tfor (const line of result.stdout.split('\\n')) {\n\t\t\t\tif (!line) continue\n\t\t\t\tconst colonIdx = line.indexOf(':')\n\t\t\t\tif (colonIdx === -1) continue\n\t\t\t\tconst afterFile = line.indexOf(':', colonIdx + 1)\n\t\t\t\tif (afterFile === -1) continue\n\n\t\t\t\tconst file = line.slice(0, colonIdx)\n\t\t\t\tconst lineNum = Number.parseInt(line.slice(colonIdx + 1, afterFile), 10)\n\t\t\t\tconst content = line.slice(afterFile + 1)\n\n\t\t\t\tif (!Number.isNaN(lineNum)) {\n\t\t\t\t\tmatches.push({ file, line: lineNum, content })\n\t\t\t\t}\n\n\t\t\t\tif (matches.length >= MAX_MATCHES) break\n\t\t\t}\n\n\t\t\treturn matches\n\t\t},\n\t\t{ description: GREP_DESCRIPTION },\n\t)\n}\n",
12
+ "import type { ListEntry } from '@humanlayer/agentlayer-core/interfaces'\nimport { ListTool } from '@humanlayer/agentlayer-core/interfaces'\nimport { LIST_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\nexport function createListTool(bash: Bash) {\n\treturn ListTool.define(\n\t\tasync (input) => {\n\t\t\tconst dirPath = input.path ?? '.'\n\n\t\t\t// Use ls -1F: appends '/' to directories, nothing to files\n\t\t\tconst result = await bash.exec(`ls -1F \"${dirPath}\" 2>/dev/null`)\n\n\t\t\tif (result.exitCode !== 0) {\n\t\t\t\tthrow new Error(`Failed to list directory ${dirPath}: ${result.stderr}`)\n\t\t\t}\n\n\t\t\tconst ignorePatterns = new Set<string>(['node_modules', '.git', 'dist', 'build', ...(input.ignore ?? [])])\n\n\t\t\tconst entries: ListEntry[] = []\n\t\t\tfor (const raw of result.stdout.split('\\n')) {\n\t\t\t\tconst line = raw.trim()\n\t\t\t\tif (!line) continue\n\n\t\t\t\tif (line.endsWith('/')) {\n\t\t\t\t\t// Directory\n\t\t\t\t\tconst name = line.slice(0, -1)\n\t\t\t\t\tif (ignorePatterns.has(name)) continue\n\t\t\t\t\tentries.push({ name, type: 'directory' })\n\t\t\t\t} else {\n\t\t\t\t\t// File (strip any trailing decorator: *, @, |, =, >)\n\t\t\t\t\tconst name = line.replace(/[*@|=>]$/, '')\n\t\t\t\t\tif (ignorePatterns.has(name)) continue\n\t\t\t\t\tentries.push({ name, type: 'file' })\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn entries\n\t\t},\n\t\t{ description: LIST_DESCRIPTION },\n\t)\n}\n",
13
+ "import { ReadTool } from '@humanlayer/agentlayer-core/interfaces'\nimport { READ_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nexport function createJustBashReadTool(bash: Bash) {\n\treturn ReadTool.define(\n\t\tasync (input) => {\n\t\t\tconst result = await bash.exec(`cat \"${input.file_path}\"`)\n\t\t\tif (result.exitCode !== 0) {\n\t\t\t\tthrow new Error(`File not found: ${input.file_path}`)\n\t\t\t}\n\t\t\treturn result.stdout\n\t\t},\n\t\t{ description: READ_DESCRIPTION },\n\t)\n}\n",
14
+ "import { createSkillTool } from '@humanlayer/agentlayer-core'\nimport type { Skill } from '@humanlayer/agentlayer-core/interfaces'\nimport type { Bash } from 'just-bash'\n\nfunction parseFrontmatterDescription(content: string): string | null {\n\tconst match = content.match(/^---\\n([\\s\\S]*?)\\n---/)\n\tif (!match) return null\n\tconst fmMatch = match[1]?.match(/description:\\s*(.+)/)\n\treturn fmMatch?.[1]?.trim() ?? null\n}\n\nfunction parseFirstHeading(content: string): string | null {\n\tconst match = content.match(/^#\\s+(.+)/m)\n\treturn match?.[1]?.trim() ?? null\n}\n\nexport async function createSkillToolFromVFS(bash: Bash, opts: { dirs: string | string[]; skills?: Skill[] }) {\n\tconst directories = Array.isArray(opts.dirs) ? opts.dirs : [opts.dirs]\n\tconst resolved: Skill[] = []\n\n\tfor (const dir of directories) {\n\t\tlet lsResult: { stdout: string; exitCode: number }\n\t\ttry {\n\t\t\tlsResult = await bash.exec(`ls \"${dir}\"/*.md 2>/dev/null`)\n\t\t} catch {\n\t\t\tcontinue\n\t\t}\n\t\tif (lsResult.exitCode !== 0) continue\n\n\t\tconst files = lsResult.stdout.trim().split('\\n').filter(Boolean)\n\t\tfor (const filePath of files) {\n\t\t\tconst catResult = await bash.exec(`cat \"${filePath}\"`)\n\t\t\tif (catResult.exitCode !== 0) continue\n\n\t\t\tconst content = catResult.stdout\n\t\t\tconst name = filePath.split('/').pop()?.replace('.md', '') ?? filePath\n\t\t\tconst description = parseFrontmatterDescription(content) ?? parseFirstHeading(content) ?? name\n\n\t\t\tresolved.push({ name, description, content })\n\t\t}\n\t}\n\n\tconst mergedMap = new Map(resolved.map((s) => [s.name, s]))\n\tfor (const skill of opts.skills ?? []) {\n\t\tmergedMap.set(skill.name, skill)\n\t}\n\n\treturn createSkillTool({ skills: [...mergedMap.values()] })\n}\n",
15
+ "import { WebFetchTool } from '@humanlayer/agentlayer-core'\nimport { WEB_FETCH_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\nimport TurndownService from 'turndown'\n\nconst MAX_RESPONSE_SIZE = 5 * 1024 * 1024 // 5MB in bytes\nconst MAX_TIMEOUT_MS = 120_000\n\n/**\n * Strip HTML tags from a string to produce plain text.\n */\nfunction stripHtmlTags(html: string): string {\n\treturn html\n\t\t.replace(/<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi, '')\n\t\t.replace(/<style\\b[^<]*(?:(?!<\\/style>)<[^<]*)*<\\/style>/gi, '')\n\t\t.replace(/<[^>]+>/g, '')\n\t\t.replace(/&amp;/g, '&')\n\t\t.replace(/&lt;/g, '<')\n\t\t.replace(/&gt;/g, '>')\n\t\t.replace(/&quot;/g, '\"')\n\t\t.replace(/&#39;/g, \"'\")\n\t\t.replace(/&nbsp;/g, ' ')\n\t\t.replace(/\\n{3,}/g, '\\n\\n')\n\t\t.trim()\n}\n\nexport function createWebFetchTool(bash: Bash) {\n\tconst turndown = new TurndownService({\n\t\theadingStyle: 'atx',\n\t\tcodeBlockStyle: 'fenced',\n\t})\n\tturndown.remove(['script', 'style', 'meta', 'link', 'noscript', 'iframe'])\n\n\treturn WebFetchTool.define(\n\t\tasync (input) => {\n\t\t\tif (!input.url.startsWith('http://') && !input.url.startsWith('https://')) {\n\t\t\t\tthrow new Error('URL must start with http:// or https://')\n\t\t\t}\n\n\t\t\tconst timeoutSec = Math.min(input.timeout, MAX_TIMEOUT_MS) / 1000\n\t\t\tconst maxSizeBytes = MAX_RESPONSE_SIZE\n\n\t\t\t// curl flags:\n\t\t\t// -s: silent, -L: follow redirects\n\t\t\t// --max-filesize: reject oversized responses\n\t\t\t// --max-time: timeout\n\t\t\t// -A: User-Agent\n\t\t\t// -w '\\n%{http_code}': append status code on last line\n\t\t\tconst result = await bash.exec(\n\t\t\t\t`curl -sL --max-filesize ${maxSizeBytes} --max-time ${timeoutSec} ` +\n\t\t\t\t\t`-A \"Mozilla/5.0 (compatible; agent/1.0)\" ` +\n\t\t\t\t\t`-w '\\\\n%{http_code}' \"${input.url}\"`,\n\t\t\t)\n\n\t\t\tif (result.exitCode !== 0) {\n\t\t\t\t// curl exit code 28 = timeout, 63 = file too large\n\t\t\t\tif (result.exitCode === 28) {\n\t\t\t\t\tthrow new Error(`Request timed out after ${input.timeout}ms`)\n\t\t\t\t}\n\t\t\t\tif (result.exitCode === 63) {\n\t\t\t\t\tthrow new Error('Response too large (exceeds 5MB limit)')\n\t\t\t\t}\n\t\t\t\tthrow new Error(`curl failed (exit ${result.exitCode}): ${result.stderr}`)\n\t\t\t}\n\n\t\t\t// Split off the status code appended by -w\n\t\t\tconst lines = result.stdout.split('\\n')\n\t\t\tconst statusLine = lines[lines.length - 1]?.trim() ?? ''\n\t\t\tconst statusCode = Number.parseInt(statusLine, 10)\n\t\t\tconst body = lines.slice(0, -1).join('\\n')\n\n\t\t\tif (!Number.isNaN(statusCode) && statusCode >= 400) {\n\t\t\t\tthrow new Error(`Request failed with status code: ${statusCode}`)\n\t\t\t}\n\n\t\t\tif (input.format === 'html') {\n\t\t\t\treturn body\n\t\t\t}\n\n\t\t\tconst isHtml = body.trimStart().startsWith('<!') || body.trimStart().toLowerCase().startsWith('<html')\n\n\t\t\tif (input.format === 'text') {\n\t\t\t\tif (isHtml) {\n\t\t\t\t\treturn stripHtmlTags(body)\n\t\t\t\t}\n\t\t\t\treturn body\n\t\t\t}\n\n\t\t\t// format === 'markdown' (default)\n\t\t\tif (isHtml) {\n\t\t\t\treturn turndown.turndown(body)\n\t\t\t}\n\t\t\treturn body\n\t\t},\n\t\t{ description: WEB_FETCH_DESCRIPTION },\n\t)\n}\n",
16
+ "import type { WebSearchInput, WebSearchResult } from '@humanlayer/agentlayer-core'\nimport { WebSearchTool } from '@humanlayer/agentlayer-core'\nimport { WEB_SEARCH_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nconst DEFAULT_TIMEOUT_SEC = 25\n\nexport interface JustBashWebSearchOptions {\n\texaApiKey: string\n\ttimeoutSec?: number\n}\n\nexport function createWebSearchTool(bash: Bash, opts: JustBashWebSearchOptions) {\n\tconst timeoutSec = opts.timeoutSec ?? DEFAULT_TIMEOUT_SEC\n\n\treturn WebSearchTool.define(\n\t\tasync (input: WebSearchInput): Promise<WebSearchResult> => {\n\t\t\tconst payload = JSON.stringify({\n\t\t\t\tquery: input.query,\n\t\t\t\tnumResults: input.numResults,\n\t\t\t\tcontents: { text: { maxCharacters: 500 } },\n\t\t\t})\n\n\t\t\t// Escape single quotes in payload for shell safety\n\t\t\tconst escapedPayload = payload.replace(/'/g, \"'\\\\''\")\n\n\t\t\tconst result = await bash.exec(\n\t\t\t\t`curl -s --max-time ${timeoutSec} ` +\n\t\t\t\t\t`-H \"Content-Type: application/json\" ` +\n\t\t\t\t\t`-H \"x-api-key: ${opts.exaApiKey}\" ` +\n\t\t\t\t\t`-d '${escapedPayload}' ` +\n\t\t\t\t\t`https://api.exa.ai/search`,\n\t\t\t)\n\n\t\t\tif (result.exitCode !== 0) {\n\t\t\t\tif (result.exitCode === 28) {\n\t\t\t\t\tthrow new Error('Search request timed out')\n\t\t\t\t}\n\t\t\t\tthrow new Error(`curl failed (exit ${result.exitCode}): ${result.stderr}`)\n\t\t\t}\n\n\t\t\tlet data: { results?: Array<{ title?: string; url?: string; text?: string; snippet?: string }> }\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse(result.stdout)\n\t\t\t} catch {\n\t\t\t\tthrow new Error(`Failed to parse search response: ${result.stdout.slice(0, 200)}`)\n\t\t\t}\n\n\t\t\tconst results = (data.results ?? []).map((r) => ({\n\t\t\t\ttitle: r.title ?? '',\n\t\t\t\turl: r.url ?? '',\n\t\t\t\tsnippet: r.text ?? r.snippet ?? '',\n\t\t\t}))\n\n\t\t\treturn { results }\n\t\t},\n\t\t{ description: WEB_SEARCH_DESCRIPTION },\n\t)\n}\n",
17
+ "import { WriteTool } from '@humanlayer/agentlayer-core'\nimport { WRITE_DESCRIPTION } from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nexport function createWriteTool(bash: Bash) {\n\treturn WriteTool.define(\n\t\tasync (input) => {\n\t\t\t// Ensure parent directory exists\n\t\t\tconst dirResult = await bash.exec(`mkdir -p \"$(dirname \"${input.file_path}\")\"`)\n\t\t\tif (dirResult.exitCode !== 0) {\n\t\t\t\tthrow new Error(`Failed to create parent directory for ${input.file_path}: ${dirResult.stderr}`)\n\t\t\t}\n\n\t\t\t// Write content using a heredoc to handle special characters safely\n\t\t\t// We use a unique delimiter to avoid conflicts with content\n\t\t\tconst DELIM = 'WRITEOF_8f3a2b1c'\n\t\t\tconst writeResult = await bash.exec(`cat > \"${input.file_path}\" <<'${DELIM}'\\n${input.content}\\n${DELIM}`)\n\t\t\tif (writeResult.exitCode !== 0) {\n\t\t\t\tthrow new Error(`Failed to write file ${input.file_path}: ${writeResult.stderr}`)\n\t\t\t}\n\n\t\t\treturn `Successfully wrote to ${input.file_path}`\n\t\t},\n\t\t{ description: WRITE_DESCRIPTION },\n\t)\n}\n"
18
+ ],
19
+ "mappings": ";AAAA;AACA;AAAA,6BAGC;AAAA,uBACA;AAAA,4BACA;AAAA;AAID;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,IAAM,sCAAsC,CAAC,aAAa,aAAa,YAAY;AAEnF,eAAe,WAAW,CAAC,MAAY,KAA0C;AAAA,EAChF,MAAM,SAAS,MAAM,KAAK,KAAK,WAAW,4CAA4C;AAAA,EACtF,IAAI,OAAO,aAAa;AAAA,IAAG;AAAA,EAC3B,MAAM,OAAO,OAAO,OAAO,KAAK;AAAA,EAChC,OAAO,KAAK,SAAS,IAAI,OAAO;AAAA;AAGjC,eAAe,gBAAgB,CAAC,MAAY,UAA+C;AAAA,EAC1F,MAAM,SAAS,MAAM,KAAK,KAAK,QAAQ,uBAAuB;AAAA,EAC9D,IAAI,OAAO,aAAa;AAAA,IAAG;AAAA,EAC3B,OAAO,OAAO;AAAA;AAGf,eAAe,sBAAsB,CAAC,MAAY,KAAa,YAAmD;AAAA,EACjH,WAAW,aAAa,YAAY;AAAA,IACnC,MAAM,WAAW,GAAG,OAAO;AAAA,IAC3B,MAAM,WAAW,MAAM,iBAAiB,MAAM,QAAQ;AAAA,IACtD,IAAI,aAAa;AAAA,MAAW,OAAO;AAAA,EACpC;AAAA,EAEA;AAAA;AAGD,eAAe,oBAAoB,CAClC,MACA,UACA,YACA,sBAC0D;AAAA,EAC1D,MAAM,UAAU,MAAM,uBAAuB,MAAM,UAAU,UAAU;AAAA,EACvE,IAAI,SAAS;AAAA,IACZ,MAAM,WAAW,MAAM,iBAAiB,MAAM,OAAO;AAAA,IACrD,IAAI,UAAU,KAAK,GAAG;AAAA,MACrB,OAAO,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AAE,QAAQ,EAAE,WAAW;AAAA,IACjC,EAAE;AAAA,IAEF,OAAO,EAAE,QAAQ;AAAA,KAElB,EAAE,aAAa,uBAAuB,CACvC;AAAA;;ACzDD;AACA;AAGO,SAAS,eAAe,CAAC,MAAY;AAAA,EAC3C,OAAO,UAAU,OAChB,OAAO,UAAU;AAAA,IAEhB,MAAM,YAAY,MAAM,KAAK,KAAK,wBAAwB,MAAM,cAAc;AAAA,IAC9E,IAAI,UAAU,aAAa,GAAG;AAAA,MAC7B,MAAM,IAAI,MAAM,yCAAyC,MAAM,cAAc,UAAU,QAAQ;AAAA,IAChG;AAAA,IAIA,MAAM,QAAQ;AAAA,IACd,MAAM,cAAc,MAAM,KAAK,KAAK,UAAU,MAAM,iBAAiB;AAAA,EAAW,MAAM;AAAA,EAAY,OAAO;AAAA,IACzG,IAAI,YAAY,aAAa,GAAG;AAAA,MAC/B,MAAM,IAAI,MAAM,wBAAwB,MAAM,cAAc,YAAY,QAAQ;AAAA,IACjF;AAAA,IAEA,OAAO,yBAAyB,MAAM;AAAA,KAEvC,EAAE,aAAa,kBAAkB,CAClC;AAAA;",
20
+ "debugId": "28E820D43B2BB25564756E2164756E21",
21
+ "names": []
22
+ }
@@ -0,0 +1,29 @@
1
+ import { type CodingPromptKey, type EnvironmentPromptOptions as CoreEnvironmentPromptOptions } from '@humanlayer/agentlayer-core/prompts';
2
+ import type { Bash } from 'just-bash';
3
+ export { buildCodingProviderOptions, type CodingModelFamily, type CodingPromptKey, detectModelFamily, getSystemPromptForModel, resolveCodingModelPrompt, systemPrompts, tarsPersona, } from '@humanlayer/agentlayer-core/prompts';
4
+ export interface EnvironmentPromptOptions extends Omit<CoreEnvironmentPromptOptions, 'isGitRepo'> {
5
+ isGitRepo?: boolean;
6
+ }
7
+ export declare function environmentPrompt(bash: Bash, opts: EnvironmentPromptOptions): Promise<string>;
8
+ export interface RepoInstructionsPromptOptions {
9
+ cwd: string;
10
+ filePath?: string;
11
+ candidates?: string[];
12
+ allowMissing?: boolean;
13
+ _skipRepoRootFallback?: boolean;
14
+ }
15
+ export declare function repoInstructionsPrompt(bash: Bash, opts: RepoInstructionsPromptOptions): Promise<string | undefined>;
16
+ export interface CreateAgentSystemPromptOptions {
17
+ bash: Bash;
18
+ cwd: string;
19
+ model: CodingPromptKey | string;
20
+ filePath?: string;
21
+ candidates?: string[];
22
+ allowMissingRepoInstructions?: boolean;
23
+ includeEnvironment?: boolean;
24
+ platform?: string;
25
+ date?: Date;
26
+ systemPromptAdditions?: string[];
27
+ }
28
+ export declare function createAgentSystemPrompt(opts: CreateAgentSystemPromptOptions): Promise<string[]>;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,wBAAwB,IAAI,4BAA4B,EAI7D,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EACN,0BAA0B,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,aAAa,EACb,WAAW,GACX,MAAM,qCAAqC,CAAA;AAyD5C,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,4BAA4B,EAAE,WAAW,CAAC;IAChG,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAQnG;AAED,MAAM,WAAW,6BAA6B;IAC7C,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,6BAA6B,GACjC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B;AAED,MAAM,WAAW,8BAA8B;IAC9C,IAAI,EAAE,IAAI,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,eAAe,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;CAChC;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,8BAA8B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBrG"}
@@ -0,0 +1,123 @@
1
+ // src/prompts/index.ts
2
+ import { resolve } from "node:path";
3
+ import {
4
+ createAgentSystemPrompt as createCoreAgentSystemPrompt,
5
+ environmentPrompt as createEnvironmentPrompt,
6
+ repoInstructionsPrompt as createRepoInstructionsPrompt
7
+ } from "@humanlayer/agentlayer-core/prompts";
8
+ import {
9
+ buildCodingProviderOptions,
10
+ detectModelFamily,
11
+ getSystemPromptForModel,
12
+ resolveCodingModelPrompt,
13
+ systemPrompts,
14
+ tarsPersona
15
+ } from "@humanlayer/agentlayer-core/prompts";
16
+ var DEFAULT_REPO_INSTRUCTION_CANDIDATES = ["CLAUDE.md", "AGENTS.md", "CONTEXT.md"];
17
+ async function getRepoRoot(bash, cwd) {
18
+ const result = await bash.exec(`git -C "${cwd}" rev-parse --show-toplevel 2>/dev/null`);
19
+ if (result.exitCode !== 0)
20
+ return;
21
+ const root = result.stdout.trim();
22
+ return root.length > 0 ? root : undefined;
23
+ }
24
+ async function readFileIfExists(bash, filePath) {
25
+ const result = await bash.exec(`cat "${filePath}" 2>/dev/null`);
26
+ if (result.exitCode !== 0)
27
+ return;
28
+ return result.stdout;
29
+ }
30
+ async function firstExistingCandidate(bash, cwd, candidates) {
31
+ for (const candidate of candidates) {
32
+ const filePath = `${cwd}/${candidate}`;
33
+ const contents = await readFileIfExists(bash, filePath);
34
+ if (contents !== undefined)
35
+ return filePath;
36
+ }
37
+ return;
38
+ }
39
+ async function findRepoInstructions(bash, startCwd, candidates, skipRepoRootFallback) {
40
+ const cwdPath = await firstExistingCandidate(bash, startCwd, candidates);
41
+ if (cwdPath) {
42
+ const contents = await readFileIfExists(bash, cwdPath);
43
+ if (contents?.trim()) {
44
+ return { path: cwdPath, contents };
45
+ }
46
+ }
47
+ if (!skipRepoRootFallback) {
48
+ const repoRoot = await getRepoRoot(bash, startCwd);
49
+ if (repoRoot && repoRoot !== startCwd) {
50
+ const rootPath = await firstExistingCandidate(bash, repoRoot, candidates);
51
+ if (rootPath) {
52
+ const contents = await readFileIfExists(bash, rootPath);
53
+ if (contents?.trim()) {
54
+ return { path: rootPath, contents };
55
+ }
56
+ }
57
+ }
58
+ }
59
+ return;
60
+ }
61
+ async function environmentPrompt(bash, opts) {
62
+ const isGitRepo = opts.isGitRepo ?? await getRepoRoot(bash, opts.cwd) !== undefined;
63
+ return createEnvironmentPrompt({
64
+ cwd: opts.cwd,
65
+ isGitRepo,
66
+ platform: opts.platform,
67
+ date: opts.date
68
+ });
69
+ }
70
+ async function repoInstructionsPrompt(bash, opts) {
71
+ if (opts.filePath) {
72
+ const filePath = opts.filePath.startsWith("/") ? opts.filePath : resolve(opts.cwd, opts.filePath);
73
+ const contents = await readFileIfExists(bash, filePath);
74
+ if (!contents?.trim()) {
75
+ if (opts.allowMissing)
76
+ return;
77
+ throw new Error(`Repo instructions file is empty: ${filePath}`);
78
+ }
79
+ return createRepoInstructionsPrompt({ path: filePath, contents });
80
+ }
81
+ const candidates = opts.candidates ?? DEFAULT_REPO_INSTRUCTION_CANDIDATES;
82
+ const found = await findRepoInstructions(bash, opts.cwd, candidates, opts._skipRepoRootFallback ?? false);
83
+ if (!found) {
84
+ if (opts.allowMissing)
85
+ return;
86
+ const repoRoot = await getRepoRoot(bash, opts.cwd);
87
+ const searched = repoRoot ? [`${opts.cwd} (cwd)`, `${repoRoot} (repo root)`] : [opts.cwd];
88
+ throw new Error(`No repo instructions found. Searched for ${candidates.join(", ")} in: ${searched.join(", ")}`);
89
+ }
90
+ return createRepoInstructionsPrompt(found);
91
+ }
92
+ async function createAgentSystemPrompt(opts) {
93
+ const repoInstructions = await repoInstructionsPrompt(opts.bash, {
94
+ cwd: opts.cwd,
95
+ filePath: opts.filePath,
96
+ candidates: opts.candidates,
97
+ allowMissing: opts.allowMissingRepoInstructions ?? true
98
+ });
99
+ const environment = opts.includeEnvironment === false ? undefined : await environmentPrompt(opts.bash, {
100
+ cwd: opts.cwd,
101
+ platform: opts.platform,
102
+ date: opts.date
103
+ });
104
+ return createCoreAgentSystemPrompt({
105
+ model: opts.model,
106
+ repoInstructions,
107
+ environment,
108
+ systemPromptAdditions: opts.systemPromptAdditions
109
+ });
110
+ }
111
+ export {
112
+ tarsPersona,
113
+ systemPrompts,
114
+ resolveCodingModelPrompt,
115
+ repoInstructionsPrompt,
116
+ getSystemPromptForModel,
117
+ environmentPrompt,
118
+ detectModelFamily,
119
+ createAgentSystemPrompt,
120
+ buildCodingProviderOptions
121
+ };
122
+
123
+ //# debugId=AFC2FD44FE1FC0D864756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/prompts/index.ts"],
4
+ "sourcesContent": [
5
+ "import { resolve } from 'node:path'\nimport {\n\ttype CodingPromptKey,\n\ttype EnvironmentPromptOptions as CoreEnvironmentPromptOptions,\n\tcreateAgentSystemPrompt as createCoreAgentSystemPrompt,\n\tenvironmentPrompt as createEnvironmentPrompt,\n\trepoInstructionsPrompt as createRepoInstructionsPrompt,\n} from '@humanlayer/agentlayer-core/prompts'\nimport type { Bash } from 'just-bash'\n\nexport {\n\tbuildCodingProviderOptions,\n\ttype CodingModelFamily,\n\ttype CodingPromptKey,\n\tdetectModelFamily,\n\tgetSystemPromptForModel,\n\tresolveCodingModelPrompt,\n\tsystemPrompts,\n\ttarsPersona,\n} from '@humanlayer/agentlayer-core/prompts'\n\nconst DEFAULT_REPO_INSTRUCTION_CANDIDATES = ['CLAUDE.md', 'AGENTS.md', 'CONTEXT.md']\n\nasync function getRepoRoot(bash: Bash, cwd: string): Promise<string | undefined> {\n\tconst result = await bash.exec(`git -C \"${cwd}\" rev-parse --show-toplevel 2>/dev/null`)\n\tif (result.exitCode !== 0) return undefined\n\tconst root = result.stdout.trim()\n\treturn root.length > 0 ? root : undefined\n}\n\nasync function readFileIfExists(bash: Bash, filePath: string): Promise<string | undefined> {\n\tconst result = await bash.exec(`cat \"${filePath}\" 2>/dev/null`)\n\tif (result.exitCode !== 0) return undefined\n\treturn result.stdout\n}\n\nasync function firstExistingCandidate(bash: Bash, cwd: string, candidates: string[]): Promise<string | undefined> {\n\tfor (const candidate of candidates) {\n\t\tconst filePath = `${cwd}/${candidate}`\n\t\tconst contents = await readFileIfExists(bash, filePath)\n\t\tif (contents !== undefined) return filePath\n\t}\n\n\treturn undefined\n}\n\nasync function findRepoInstructions(\n\tbash: Bash,\n\tstartCwd: string,\n\tcandidates: string[],\n\tskipRepoRootFallback: boolean,\n): Promise<{ path: string; contents: string } | undefined> {\n\tconst cwdPath = await firstExistingCandidate(bash, startCwd, candidates)\n\tif (cwdPath) {\n\t\tconst contents = await readFileIfExists(bash, cwdPath)\n\t\tif (contents?.trim()) {\n\t\t\treturn { path: cwdPath, contents }\n\t\t}\n\t}\n\n\tif (!skipRepoRootFallback) {\n\t\tconst repoRoot = await getRepoRoot(bash, startCwd)\n\t\tif (repoRoot && repoRoot !== startCwd) {\n\t\t\tconst rootPath = await firstExistingCandidate(bash, repoRoot, candidates)\n\t\t\tif (rootPath) {\n\t\t\t\tconst contents = await readFileIfExists(bash, rootPath)\n\t\t\t\tif (contents?.trim()) {\n\t\t\t\t\treturn { path: rootPath, contents }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nexport interface EnvironmentPromptOptions extends Omit<CoreEnvironmentPromptOptions, 'isGitRepo'> {\n\tisGitRepo?: boolean\n}\n\nexport async function environmentPrompt(bash: Bash, opts: EnvironmentPromptOptions): Promise<string> {\n\tconst isGitRepo = opts.isGitRepo ?? (await getRepoRoot(bash, opts.cwd)) !== undefined\n\treturn createEnvironmentPrompt({\n\t\tcwd: opts.cwd,\n\t\tisGitRepo,\n\t\tplatform: opts.platform,\n\t\tdate: opts.date,\n\t})\n}\n\nexport interface RepoInstructionsPromptOptions {\n\tcwd: string\n\tfilePath?: string\n\tcandidates?: string[]\n\tallowMissing?: boolean\n\t_skipRepoRootFallback?: boolean\n}\n\nexport async function repoInstructionsPrompt(\n\tbash: Bash,\n\topts: RepoInstructionsPromptOptions,\n): Promise<string | undefined> {\n\tif (opts.filePath) {\n\t\tconst filePath = opts.filePath.startsWith('/') ? opts.filePath : resolve(opts.cwd, opts.filePath)\n\t\tconst contents = await readFileIfExists(bash, filePath)\n\t\tif (!contents?.trim()) {\n\t\t\tif (opts.allowMissing) return undefined\n\t\t\tthrow new Error(`Repo instructions file is empty: ${filePath}`)\n\t\t}\n\t\treturn createRepoInstructionsPrompt({ path: filePath, contents })\n\t}\n\n\tconst candidates = opts.candidates ?? DEFAULT_REPO_INSTRUCTION_CANDIDATES\n\tconst found = await findRepoInstructions(bash, opts.cwd, candidates, opts._skipRepoRootFallback ?? false)\n\n\tif (!found) {\n\t\tif (opts.allowMissing) return undefined\n\t\tconst repoRoot = await getRepoRoot(bash, opts.cwd)\n\t\tconst searched = repoRoot ? [`${opts.cwd} (cwd)`, `${repoRoot} (repo root)`] : [opts.cwd]\n\t\tthrow new Error(`No repo instructions found. Searched for ${candidates.join(', ')} in: ${searched.join(', ')}`)\n\t}\n\n\treturn createRepoInstructionsPrompt(found)\n}\n\nexport interface CreateAgentSystemPromptOptions {\n\tbash: Bash\n\tcwd: string\n\tmodel: CodingPromptKey | string\n\tfilePath?: string\n\tcandidates?: string[]\n\tallowMissingRepoInstructions?: boolean\n\tincludeEnvironment?: boolean\n\tplatform?: string\n\tdate?: Date\n\tsystemPromptAdditions?: string[]\n}\n\nexport async function createAgentSystemPrompt(opts: CreateAgentSystemPromptOptions): Promise<string[]> {\n\tconst repoInstructions = await repoInstructionsPrompt(opts.bash, {\n\t\tcwd: opts.cwd,\n\t\tfilePath: opts.filePath,\n\t\tcandidates: opts.candidates,\n\t\tallowMissing: opts.allowMissingRepoInstructions ?? true,\n\t})\n\tconst environment =\n\t\topts.includeEnvironment === false\n\t\t\t? undefined\n\t\t\t: await environmentPrompt(opts.bash, {\n\t\t\t\t\tcwd: opts.cwd,\n\t\t\t\t\tplatform: opts.platform,\n\t\t\t\t\tdate: opts.date,\n\t\t\t\t})\n\n\treturn createCoreAgentSystemPrompt({\n\t\tmodel: opts.model,\n\t\trepoInstructions,\n\t\tenvironment,\n\t\tsystemPromptAdditions: opts.systemPromptAdditions,\n\t})\n}\n"
6
+ ],
7
+ "mappings": ";AAAA;AACA;AAAA,6BAGC;AAAA,uBACA;AAAA,4BACA;AAAA;AAID;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,IAAM,sCAAsC,CAAC,aAAa,aAAa,YAAY;AAEnF,eAAe,WAAW,CAAC,MAAY,KAA0C;AAAA,EAChF,MAAM,SAAS,MAAM,KAAK,KAAK,WAAW,4CAA4C;AAAA,EACtF,IAAI,OAAO,aAAa;AAAA,IAAG;AAAA,EAC3B,MAAM,OAAO,OAAO,OAAO,KAAK;AAAA,EAChC,OAAO,KAAK,SAAS,IAAI,OAAO;AAAA;AAGjC,eAAe,gBAAgB,CAAC,MAAY,UAA+C;AAAA,EAC1F,MAAM,SAAS,MAAM,KAAK,KAA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,UAAU,KAAK;AAAA,IACf,MAAM,KAAK;AAAA,EACZ,CAAC;AAAA,EAEJ,OAAO,4BAA4B;AAAA,IAClC,OAAO,KAAK;AAAA,IACZ;AAAA,IACA;AAAA,IACA,uBAAuB,KAAK;AAAA,EAC7B,CAAC;AAAA;",
8
+ "debugId": "AFC2FD44FE1FC0D864756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,9 @@
1
+ import type { Bash } from 'just-bash';
2
+ export interface ApplyPatchOptions {
3
+ /** Working directory for resolving relative paths. If not provided, paths are resolved by bash's cwd. */
4
+ cwd?: string;
5
+ }
6
+ export declare function createApplyPatchTool(bash: Bash, opts?: ApplyPatchOptions): import("@humanlayer/agentlayer-core").Tool<{
7
+ patch_text: string;
8
+ }, string>;
9
+ //# sourceMappingURL=apply-patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-patch.d.ts","sourceRoot":"","sources":["../../src/tools/apply-patch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,WAAW,iBAAiB;IACjC,yGAAyG;IACzG,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,GAAE,iBAAsB;;WA6G5E"}
@@ -0,0 +1,8 @@
1
+ import type { Bash } from 'just-bash';
2
+ export declare function createJustBashTool(bash: Bash): import("@humanlayer/agentlayer-core").Tool<{
3
+ command: string;
4
+ timeout: number;
5
+ workdir?: string | undefined;
6
+ description?: string | undefined;
7
+ }, string>;
8
+ //# sourceMappingURL=bash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI;;;;;WAc5C"}
@@ -0,0 +1,12 @@
1
+ import type { Bash } from 'just-bash';
2
+ export interface JustBashCodeSearchOptions {
3
+ exaApiKey?: string;
4
+ context7ApiKey?: string;
5
+ timeoutSec?: number;
6
+ }
7
+ export declare function createCodeSearchTool(bash: Bash, opts: JustBashCodeSearchOptions): import("@humanlayer/agentlayer-core").Tool<{
8
+ query: string;
9
+ packageName: string;
10
+ language: string;
11
+ }, string>;
12
+ //# sourceMappingURL=code-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-search.d.ts","sourceRoot":"","sources":["../../src/tools/code-search.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAKrC,MAAM,WAAW,yBAAyB;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AA0ED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAyB;;;;WAgC/E"}
@@ -0,0 +1,12 @@
1
+ import type { Bash } from 'just-bash';
2
+ export declare function createEditTool(bash: Bash): import("@humanlayer/agentlayer-core").Tool<{
3
+ file_path: string;
4
+ old_string: string;
5
+ new_string: string;
6
+ replace_all: boolean;
7
+ }, {
8
+ content: string;
9
+ matchCount: number;
10
+ editResult?: unknown;
11
+ }>;
12
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/tools/edit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI;;;;;;;;;GAqDxC"}
@@ -0,0 +1,6 @@
1
+ import type { Bash } from 'just-bash';
2
+ export declare function createGlobTool(bash: Bash): import("@humanlayer/agentlayer-core").Tool<{
3
+ pattern: string;
4
+ path?: string | undefined;
5
+ }, string[]>;
6
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/tools/glob.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI;;;aA4BxC"}
@@ -0,0 +1,8 @@
1
+ import type { GrepMatch } from '@humanlayer/agentlayer-core/interfaces';
2
+ import type { Bash } from 'just-bash';
3
+ export declare function createGrepTool(bash: Bash): import("@humanlayer/agentlayer-core").Tool<{
4
+ pattern: string;
5
+ path?: string | undefined;
6
+ include?: string | undefined;
7
+ }, GrepMatch[]>;
8
+ //# sourceMappingURL=grep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/tools/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAGvE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAIrC,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI;;;;gBA6CxC"}
@@ -0,0 +1,13 @@
1
+ export { createApplyPatchTool } from './apply-patch';
2
+ export { createJustBashTool } from './bash';
3
+ export { createCodeSearchTool, type JustBashCodeSearchOptions } from './code-search';
4
+ export { createEditTool } from './edit';
5
+ export { createGlobTool } from './glob';
6
+ export { createGrepTool } from './grep';
7
+ export { createListTool } from './list';
8
+ export { createJustBashReadTool } from './read';
9
+ export { createSkillToolFromVFS } from './skill';
10
+ export { createWebFetchTool } from './web-fetch';
11
+ export { createWebSearchTool, type JustBashWebSearchOptions } from './web-search';
12
+ export { createWriteTool } from './write';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,eAAe,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAA;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}