{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,SAAS,EACT,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,EACR,cAAc,EACd,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,sBAAsB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,MAAM,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,qBAAqB,EAAE,KAAK,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EACN,KAAK,sCAAsC,E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ED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAqB1F","sourcesContent":["export type {\n\tTodoEvent,\n\tTodoEventType,\n\tTodoFailureFingerprint,\n\tTodoMutationError,\n\tTodoPatchOp,\n\tTodoRebaseResult,\n\tTodoRecoveryAction,\n\tTodoStatus,\n} from \"../todo/index.js\";\nexport {\n\tallowedTransitions,\n\tcomputeStateHash,\n\tTodoEngine,\n\tvalidateTransition,\n} from \"../todo/index.js\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcreateBashTool,\n\tcreateLocalBashOperations,\n} from \"./bash.js\";\nexport {\n\tcreateDeepResearchTool,\n\ttype DeepResearchToolDetails,\n\ttype DeepResearchToolInput,\n\tdeepResearchTool,\n} from \"./deep-research.js\";\nexport {\n\tcreateEditTool,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n} from \"./edit.js\";\nexport {\n\tcreateFindTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n} from \"./ls.js\";\nexport { createMemoryWriteTool, type MemoryWriteInput, memoryWriteTool } from \"./memory-write.js\";\nexport {\n\ttype CreateLocalPowerShellOperationsOptions,\n\tcreateLocalPowerShellOperations,\n\tcreatePowerShellTool,\n\ttype PowerShellOperations,\n\ttype PowerShellToolDetails,\n\ttype PowerShellToolInput,\n\ttype PowerShellToolOptions,\n\ttype PowerShellValidateResult,\n\tpowershellTool,\n\tresetPowerShellHealthCheck,\n} from \"./powershell.js\";\nexport {\n\tcreateProcessManagerTool,\n\ttype ProcessManagerInput,\n\ttype ProcessManagerOperations,\n\ttype ProcessManagerToolOptions,\n\ttype ProcessRecord,\n\tprocessManagerTool,\n} from \"./process-manager.js\";\nexport {\n\tcreateReadTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n} from \"./read.js\";\nexport {\n\tcreateRetrieveEvidenceTool,\n\ttype RetrieveEvidenceInput,\n} from \"./retrieve-evidence.js\";\nexport { TodoLoopGuard } from \"./todo-loop-guard.js\";\nexport { createTodoReadTool, type TodoReadInput, todoReadTool } from \"./todo-read.js\";\nexport { createTodoUpdateTool, type TodoUpdateInput, todoUpdateTool } from \"./todo-update.js\";\nexport { createTodoWriteTool, type TodoItem, todoWriteTool } from \"./todo-write.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWebFetchTool,\n\ttype WebFetchToolDetails,\n\ttype WebFetchToolInput,\n\twebFetchTool,\n} from \"./web-fetch.js\";\nexport { createWebResearchStatusTool, webResearchStatusTool } from \"./web-research-status.js\";\nexport {\n\tcreateWebSearchTool,\n\ttype WebSearchResult,\n\ttype WebSearchToolDetails,\n\ttype WebSearchToolInput,\n\ttype WebSearchToolOptions,\n\twebSearchTool,\n} from \"./web-search.js\";\nexport {\n\tcreateWriteTool,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@apholdings/jensen-agent-core\";\nimport { PRODUCTION_TOOL_EFFECTS } from \"../safety/effects.js\";\nimport { type BashToolOptions, bashTool, createBashTool } from \"./bash.js\";\nimport { createDeepResearchTool, deepResearchTool } from \"./deep-research.js\";\nimport { createEditTool, editTool } from \"./edit.js\";\nimport { createFindTool, findTool } from \"./find.js\";\nimport { createGrepTool, grepTool } from \"./grep.js\";\nimport { createLsTool, lsTool } from \"./ls.js\";\nimport { memoryWriteTool } from \"./memory-write.js\";\nimport { createPowerShellTool, type PowerShellToolOptions, powershellTool } from \"./powershell.js\";\nimport { createProcessManagerTool, type ProcessManagerToolOptions, processManagerTool } from \"./process-manager.js\";\nimport { createReadTool, type ReadToolOptions, readTool } from \"./read.js\";\nimport { retrieveEvidenceTool } from \"./retrieve-evidence.js\";\nimport { todoReadTool } from \"./todo-read.js\";\nimport { todoUpdateTool } from \"./todo-update.js\";\nimport { todoWriteTool } from \"./todo-write.js\";\nimport { createWebFetchTool, webFetchTool } from \"./web-fetch.js\";\nimport { createWebResearchStatusTool, webResearchStatusTool } from \"./web-research-status.js\";\nimport { createWebSearchTool, webSearchTool } from \"./web-search.js\";\nimport { createWorkspaceSearchTools } from \"./workspace-search.js\";\nimport { createWriteTool, writeTool } from \"./write.js\";\n\n/** Tool type (AgentTool from pi-ai) */\nexport type Tool = AgentTool<any>;\n\n/** Attach canonical declared effects to a tool from the production registry. */\nfunction attachEffects(tool: AgentTool<any>): AgentTool<any> {\n\tconst effects = PRODUCTION_TOOL_EFFECTS[tool.name];\n\tif (effects) {\n\t\treturn Object.assign(tool, { effects });\n\t}\n\treturn tool;\n}\n\nfunction withEffectsList(tools: unknown[]): Tool[] {\n\treturn (tools as AgentTool<any>[]).map((t) => attachEffects(t));\n}\n\nfunction withEffectsRecord(record: Record<string, AgentTool<any>>): Record<string, AgentTool<any>> {\n\tfor (const key of Object.keys(record)) {\n\t\trecord[key] = attachEffects(record[key]);\n\t}\n\treturn record;\n}\n\n// Default tools for full access mode (using process.cwd())\nexport const codingTools: Tool[] = withEffectsList([\n\treadTool,\n\tbashTool,\n\tpowershellTool,\n\teditTool,\n\twriteTool,\n\ttodoWriteTool,\n\ttodoReadTool,\n\ttodoUpdateTool,\n\tmemoryWriteTool,\n\tprocessManagerTool,\n\t...Object.values(createWorkspaceSearchTools(process.cwd())),\n]);\n\n// Read-only tools for exploration without modification (using process.cwd())\nexport const readOnlyTools: Tool[] = withEffectsList([\n\treadTool,\n\tgrepTool,\n\tfindTool,\n\tlsTool,\n\ttodoReadTool,\n\tcreateWorkspaceSearchTools(process.cwd()).workspace_search,\n\tcreateWorkspaceSearchTools(process.cwd()).workspace_search_lexical,\n\tcreateWorkspaceSearchTools(process.cwd()).workspace_search_semantic,\n\tcreateWorkspaceSearchTools(process.cwd()).workspace_search_symbols,\n\tcreateWorkspaceSearchTools(process.cwd()).workspace_retrieval_status,\n]);\n\n// All available tools (using process.cwd())\nexport const allTools = withEffectsRecord({\n\tread: readTool,\n\tbash: bashTool,\n\tpowershell: powershellTool,\n\tedit: editTool,\n\twrite: writeTool,\n\ttodo_write: todoWriteTool,\n\ttodo_read: todoReadTool,\n\ttodo_update: todoUpdateTool,\n\tmemory_write: memoryWriteTool,\n\tretrieve_evidence: retrieveEvidenceTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\tweb_search: webSearchTool,\n\tweb_fetch: webFetchTool,\n\tdeep_research: deepResearchTool,\n\tweb_research_status: webResearchStatusTool,\n\tprocess_manager: processManagerTool,\n\t...createWorkspaceSearchTools(process.cwd()),\n});\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\t/** Options for the read tool */\n\tread?: ReadToolOptions;\n\t/** Options for the bash tool */\n\tbash?: BashToolOptions;\n\t/** Options for the PowerShell tool */\n\tpowershell?: PowerShellToolOptions;\n\t/** Options for the process manager tool */\n\tprocess_manager?: ProcessManagerToolOptions;\n}\n\n/**\n * Create coding tools configured for a specific working directory.\n */\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn withEffectsList([\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreatePowerShellTool(cwd, options?.powershell),\n\t\tcreateEditTool(cwd),\n\t\tcreateWriteTool(cwd),\n\t\ttodoWriteTool,\n\t\ttodoReadTool,\n\t\ttodoUpdateTool,\n\t\tmemoryWriteTool,\n\t\tcreateProcessManagerTool(cwd, options?.process_manager),\n\t]);\n}\n\n/**\n * Create read-only tools configured for a specific working directory.\n */\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn withEffectsList([\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd),\n\t\tcreateFindTool(cwd),\n\t\tcreateLsTool(cwd),\n\t\ttodoReadTool,\n\t]);\n}\n\n/**\n * Create all tools configured for a specific working directory.\n */\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn withEffectsRecord({\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tpowershell: createPowerShellTool(cwd, options?.powershell),\n\t\tedit: createEditTool(cwd),\n\t\twrite: createWriteTool(cwd),\n\t\ttodo_write: todoWriteTool,\n\t\ttodo_read: todoReadTool,\n\t\ttodo_update: todoUpdateTool,\n\t\tmemory_write: memoryWriteTool,\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\tweb_search: createWebSearchTool(),\n\t\tweb_fetch: createWebFetchTool(),\n\t\tdeep_research: createDeepResearchTool(),\n\t\tweb_research_status: createWebResearchStatusTool(),\n\t\tprocess_manager: createProcessManagerTool(cwd, options?.process_manager),\n\t\t...createWorkspaceSearchTools(cwd),\n\t});\n}\n"]}