iosm-cli 0.2.6 → 0.2.8
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.
- package/CHANGELOG.md +54 -1
- package/README.md +7 -7
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +9 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-profiles.d.ts.map +1 -1
- package/dist/core/agent-profiles.js +12 -1
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +40 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +39 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +168 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/shadow-guard.js +1 -1
- package/dist/core/shadow-guard.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +91 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/fetch.d.ts +56 -0
- package/dist/core/tools/fetch.d.ts.map +1 -0
- package/dist/core/tools/fetch.js +272 -0
- package/dist/core/tools/fetch.js.map +1 -0
- package/dist/core/tools/fs-ops.d.ts +54 -0
- package/dist/core/tools/fs-ops.d.ts.map +1 -0
- package/dist/core/tools/fs-ops.js +206 -0
- package/dist/core/tools/fs-ops.js.map +1 -0
- package/dist/core/tools/git-common.d.ts +45 -0
- package/dist/core/tools/git-common.d.ts.map +1 -0
- package/dist/core/tools/git-common.js +185 -0
- package/dist/core/tools/git-common.js.map +1 -0
- package/dist/core/tools/git-read.d.ts +62 -0
- package/dist/core/tools/git-read.d.ts.map +1 -0
- package/dist/core/tools/git-read.js +215 -0
- package/dist/core/tools/git-read.js.map +1 -0
- package/dist/core/tools/git-write.d.ts +75 -0
- package/dist/core/tools/git-write.d.ts.map +1 -0
- package/dist/core/tools/git-write.js +298 -0
- package/dist/core/tools/git-write.js.map +1 -0
- package/dist/core/tools/index.d.ts +90 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +32 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/task.js +1 -1
- package/dist/core/tools/task.js.map +1 -1
- package/dist/core/tools/web-search.d.ts +72 -0
- package/dist/core/tools/web-search.d.ts.map +1 -0
- package/dist/core/tools/web-search.js +702 -0
- package/dist/core/tools/web-search.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +7 -2
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.js +3 -1
- package/dist/modes/interactive/components/mcp-selector.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +12 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +11 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +16 -5
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +4 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +25 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +182 -2
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +7 -2
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +7 -2
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +7 -2
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +18 -3
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +8 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +184 -24
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/cli-reference.md +19 -1
- package/docs/configuration.md +11 -2
- package/docs/development-and-testing.md +1 -1
- package/docs/interactive-mode.md +2 -2
- package/docs/rpc-json-sdk.md +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-write.js","sourceRoot":"","sources":["../../../src/core/tools/git-write.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACN,2BAA2B,EAC3B,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,wBAAwB,EACxB,qBAAqB,GAErB,MAAM,iBAAiB,CAA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,EAAE,WAAW;oBACrB,GAAG;oBACH,KAAK,EAAE;wBACN,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;wBAChB,OAAO;wBACP,IAAI;wBACJ,cAAc;wBACd,aAAa;qBACb;oBACD,OAAO,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;iBAChC,CAAC,CAAC;gBACH,IAAI,CAAC,OAAO,EAAE,CAAC;oBACd,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;gBAC/D,CAAC;YACF,CAAC;YAEF,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC;gBAC1C,QAAQ,EAAE,WAAW;gBACrB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,IAAI;gBACJ,GAAG,EAAE,OAAO;gBACZ,cAAc;gBACd,UAAU;gBACV,MAAM;gBACN,GAAG;aACH,CAAC,CAAC;YAEH,MAAM,OAAO,GAAwB;gBACpC,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,OAAO,EAAE,KAAK;gBACd,IAAI;gBACJ,GAAG,EAAE,OAAO;gBACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,SAAS;gBACtD,UAAU,EAAE,MAAM,CAAC,UAAU;aAC7B,CAAC;YAEF,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;gBAChD,OAAO;aACP,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { resolveToCwd } from \"./path-utils.js\";\nimport {\n\tDEFAULT_GIT_TIMEOUT_SECONDS,\n\tnormalizeFiles,\n\tnormalizePositiveInt,\n\tnormalizeRefLike,\n\tnormalizeRequiredString,\n\trequireRefLike,\n\tresolveGitCommandOptions,\n\trunGitAndFormatOutput,\n\ttype GitCommandOptions,\n} from \"./git-common.js\";\nimport type { ToolPermissionGuard } from \"./permissions.js\";\nimport type { TruncationResult } from \"./truncate.js\";\n\nconst gitWriteSchema = Type.Object({\n\taction: Type.Union(\n\t\t[\n\t\t\tType.Literal(\"add\"),\n\t\t\tType.Literal(\"restore\"),\n\t\t\tType.Literal(\"reset_index\"),\n\t\t\tType.Literal(\"commit\"),\n\t\t\tType.Literal(\"switch\"),\n\t\t\tType.Literal(\"branch_create\"),\n\t\t\tType.Literal(\"fetch\"),\n\t\t\tType.Literal(\"pull\"),\n\t\t\tType.Literal(\"push\"),\n\t\t\tType.Literal(\"stash_push\"),\n\t\t\tType.Literal(\"stash_pop\"),\n\t\t\tType.Literal(\"stash_apply\"),\n\t\t\tType.Literal(\"stash_drop\"),\n\t\t\tType.Literal(\"stash_list\"),\n\t\t],\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Git write action: add | restore | reset_index | commit | switch | branch_create | fetch | pull | push | stash_push | stash_pop | stash_apply | stash_drop | stash_list.\",\n\t\t},\n\t),\n\tpath: Type.Optional(Type.String({ description: \"Repository working directory (default: current directory).\" })),\n\tall: Type.Optional(Type.Boolean({ description: \"For add action: stage all tracked and untracked changes.\" })),\n\tupdate: Type.Optional(Type.Boolean({ description: \"For add action: stage modified/deleted tracked files.\" })),\n\tfiles: Type.Optional(Type.Array(Type.String(), { description: \"For add/restore/reset_index action: file paths.\" })),\n\tstaged: Type.Optional(Type.Boolean({ description: \"For restore action: restore index instead of working tree.\" })),\n\tsource: Type.Optional(Type.String({ description: \"For restore action: source ref (e.g., HEAD).\" })),\n\tref: Type.Optional(Type.String({ description: \"For reset_index action: reference commit (default: HEAD).\" })),\n\tmessage: Type.Optional(Type.String({ description: \"For commit/stash_push action: message.\" })),\n\tallow_empty: Type.Optional(Type.Boolean({ description: \"For commit action: allow empty commit.\" })),\n\tbranch: Type.Optional(Type.String({ description: \"For switch/branch_create action: branch name.\" })),\n\tstart_point: Type.Optional(Type.String({ description: \"For branch_create action: start point (default: HEAD).\" })),\n\tremote: Type.Optional(Type.String({ description: \"For fetch/pull/push action: remote name (default: origin).\" })),\n\tff_only: Type.Optional(Type.Boolean({ description: \"For pull action: require fast-forward merge (default: true).\" })),\n\tprune: Type.Optional(Type.Boolean({ description: \"For fetch action: prune deleted remote refs.\" })),\n\tset_upstream: Type.Optional(Type.Boolean({ description: \"For push action: set upstream for branch.\" })),\n\ttags: Type.Optional(Type.Boolean({ description: \"For fetch/push action: include tags.\" })),\n\tinclude_untracked: Type.Optional(\n\t\tType.Boolean({ description: \"For stash_push action: include untracked files.\" }),\n\t),\n\tkeep_index: Type.Optional(Type.Boolean({ description: \"For stash_push action: keep index unchanged.\" })),\n\tstash_ref: Type.Optional(\n\t\tType.String({ description: \"For stash_pop/stash_apply/stash_drop action: stash ref (default: stash@{0}).\" }),\n\t),\n\tlimit: Type.Optional(Type.Number({ description: \"For stash_list action: max entries (default: 20, max: 200).\" })),\n\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds (default: 30).\" })),\n});\n\nexport type GitWriteToolInput = Static<typeof gitWriteSchema>;\n\nconst DEFAULT_STASH_LIST_LIMIT = 20;\nconst MAX_STASH_LIST_LIMIT = 200;\nconst DEFAULT_REMOTE = \"origin\";\nconst DEFAULT_GIT_WRITE_NETWORK_ENABLED = false;\n\ntype GitWriteAction = GitWriteToolInput[\"action\"];\n\nexport interface GitWriteToolDetails {\n\taction: GitWriteAction;\n\tcommand: string;\n\targs: string[];\n\tcwd: string;\n\texitCode: number;\n\tcaptureTruncated?: boolean;\n\ttruncation?: TruncationResult;\n}\n\nexport interface GitWriteRuntimeConfig {\n\tnetworkEnabled: boolean;\n}\n\nexport interface GitWriteToolOptions extends GitCommandOptions {\n\tpermissionGuard?: ToolPermissionGuard;\n\tresolveRuntimeConfig?: () => Partial<GitWriteRuntimeConfig> | GitWriteRuntimeConfig;\n\tresolveGithubToken?: () => string | undefined;\n}\n\nfunction normalizeGitWriteRuntimeConfig(\n\tconfig: Partial<GitWriteRuntimeConfig> | GitWriteRuntimeConfig | undefined,\n): GitWriteRuntimeConfig {\n\treturn {\n\t\tnetworkEnabled:\n\t\t\ttypeof config?.networkEnabled === \"boolean\"\n\t\t\t\t? config.networkEnabled\n\t\t\t\t: DEFAULT_GIT_WRITE_NETWORK_ENABLED,\n\t};\n}\n\nfunction buildAddArgs(input: GitWriteToolInput): string[] {\n\tconst useAll = input.all === true;\n\tconst useUpdate = input.update === true;\n\tconst hasFiles = (input.files?.length ?? 0) > 0;\n\tconst modeCount = (useAll ? 1 : 0) + (useUpdate ? 1 : 0) + (hasFiles ? 1 : 0);\n\tif (modeCount !== 1) {\n\t\tthrow new Error(\"git_write add requires exactly one mode: all=true, update=true, or files[].\");\n\t}\n\tconst args = [\"add\"];\n\tif (useAll) {\n\t\targs.push(\"--all\");\n\t\treturn args;\n\t}\n\tif (useUpdate) {\n\t\targs.push(\"--update\");\n\t\treturn args;\n\t}\n\tconst files = normalizeFiles(input.files, \"files\");\n\targs.push(\"--\", ...files);\n\treturn args;\n}\n\nfunction buildRestoreArgs(input: GitWriteToolInput): string[] {\n\tconst files = normalizeFiles(input.files, \"files\");\n\tconst args = [\"restore\"];\n\tif (input.staged) {\n\t\targs.push(\"--staged\");\n\t}\n\tconst source = normalizeRefLike(input.source, \"source\");\n\tif (source) {\n\t\targs.push(`--source=${source}`);\n\t}\n\targs.push(\"--\", ...files);\n\treturn args;\n}\n\nfunction buildResetIndexArgs(input: GitWriteToolInput): string[] {\n\tconst files = normalizeFiles(input.files, \"files\");\n\tconst ref = requireRefLike(input.ref ?? \"HEAD\", \"ref\");\n\treturn [\"reset\", ref, \"--\", ...files];\n}\n\nfunction buildCommitArgs(input: GitWriteToolInput): string[] {\n\tconst message = normalizeRequiredString(input.message, \"message\");\n\tconst args = [\"commit\", \"-m\", message];\n\tif (input.allow_empty) {\n\t\targs.push(\"--allow-empty\");\n\t}\n\treturn args;\n}\n\nfunction buildSwitchArgs(input: GitWriteToolInput): string[] {\n\tconst branch = requireRefLike(input.branch, \"branch\");\n\treturn [\"switch\", branch];\n}\n\nfunction buildBranchCreateArgs(input: GitWriteToolInput): string[] {\n\tconst branch = requireRefLike(input.branch, \"branch\");\n\tconst startPoint = requireRefLike(input.start_point ?? \"HEAD\", \"start_point\");\n\treturn [\"branch\", branch, startPoint];\n}\n\nfunction buildFetchArgs(input: GitWriteToolInput): string[] {\n\tconst remote = requireRefLike(input.remote ?? DEFAULT_REMOTE, \"remote\");\n\tconst args = [\"fetch\"];\n\tif (input.prune) {\n\t\targs.push(\"--prune\");\n\t}\n\tif (input.tags) {\n\t\targs.push(\"--tags\");\n\t}\n\targs.push(remote);\n\treturn args;\n}\n\nfunction buildPullArgs(input: GitWriteToolInput): string[] {\n\tconst remote = requireRefLike(input.remote ?? DEFAULT_REMOTE, \"remote\");\n\tconst args = [\"pull\"];\n\tif (input.ff_only ?? true) {\n\t\targs.push(\"--ff-only\");\n\t}\n\targs.push(remote);\n\tconst branch = normalizeRefLike(input.branch, \"branch\");\n\tif (branch) {\n\t\targs.push(branch);\n\t}\n\treturn args;\n}\n\nfunction buildPushArgs(input: GitWriteToolInput): string[] {\n\tconst remote = requireRefLike(input.remote ?? DEFAULT_REMOTE, \"remote\");\n\tconst args = [\"push\"];\n\tif (input.set_upstream) {\n\t\targs.push(\"--set-upstream\");\n\t}\n\tif (input.tags) {\n\t\targs.push(\"--tags\");\n\t}\n\targs.push(remote);\n\tconst branch = normalizeRefLike(input.branch, \"branch\");\n\tif (branch) {\n\t\targs.push(branch);\n\t}\n\treturn args;\n}\n\nfunction buildStashPushArgs(input: GitWriteToolInput): string[] {\n\tconst args = [\"stash\", \"push\"];\n\tif (input.include_untracked) {\n\t\targs.push(\"--include-untracked\");\n\t}\n\tif (input.keep_index) {\n\t\targs.push(\"--keep-index\");\n\t}\n\tif (input.message !== undefined) {\n\t\tconst message = normalizeRequiredString(input.message, \"message\");\n\t\targs.push(\"-m\", message);\n\t}\n\treturn args;\n}\n\nfunction buildStashEntryActionArgs(input: GitWriteToolInput, action: \"pop\" | \"apply\" | \"drop\"): string[] {\n\tconst stashRef = requireRefLike(input.stash_ref ?? \"stash@{0}\", \"stash_ref\");\n\treturn [\"stash\", action, stashRef];\n}\n\nfunction buildStashListArgs(input: GitWriteToolInput): string[] {\n\tconst limit = Math.min(MAX_STASH_LIST_LIMIT, normalizePositiveInt(input.limit, DEFAULT_STASH_LIST_LIMIT, \"limit\"));\n\treturn [\"stash\", \"list\", `--max-count=${limit}`, \"--date=iso\", \"--pretty=format:%gd%x09%H%x09%ad%x09%s\"];\n}\n\nfunction buildGitWriteArgs(input: GitWriteToolInput): string[] {\n\tswitch (input.action) {\n\t\tcase \"add\":\n\t\t\treturn buildAddArgs(input);\n\t\tcase \"restore\":\n\t\t\treturn buildRestoreArgs(input);\n\t\tcase \"reset_index\":\n\t\t\treturn buildResetIndexArgs(input);\n\t\tcase \"commit\":\n\t\t\treturn buildCommitArgs(input);\n\t\tcase \"switch\":\n\t\t\treturn buildSwitchArgs(input);\n\t\tcase \"branch_create\":\n\t\t\treturn buildBranchCreateArgs(input);\n\t\tcase \"fetch\":\n\t\t\treturn buildFetchArgs(input);\n\t\tcase \"pull\":\n\t\t\treturn buildPullArgs(input);\n\t\tcase \"push\":\n\t\t\treturn buildPushArgs(input);\n\t\tcase \"stash_push\":\n\t\t\treturn buildStashPushArgs(input);\n\t\tcase \"stash_pop\":\n\t\t\treturn buildStashEntryActionArgs(input, \"pop\");\n\t\tcase \"stash_apply\":\n\t\t\treturn buildStashEntryActionArgs(input, \"apply\");\n\t\tcase \"stash_drop\":\n\t\t\treturn buildStashEntryActionArgs(input, \"drop\");\n\t\tcase \"stash_list\":\n\t\t\treturn buildStashListArgs(input);\n\t\tdefault:\n\t\t\tthrow new Error(`Unsupported git_write action: ${(input as { action: string }).action}`);\n\t}\n}\n\nfunction isNetworkAction(action: GitWriteAction): boolean {\n\treturn action === \"fetch\" || action === \"pull\" || action === \"push\";\n}\n\nfunction buildGitNetworkEnv(githubToken: string | undefined): NodeJS.ProcessEnv {\n\tconst env: NodeJS.ProcessEnv = {\n\t\tGIT_TERMINAL_PROMPT: \"0\",\n\t};\n\n\tconst token = githubToken?.trim();\n\tif (!token) {\n\t\treturn env;\n\t}\n\n\tconst basic = Buffer.from(`x-access-token:${token}`, \"utf-8\").toString(\"base64\");\n\tconst existingCountRaw = process.env.GIT_CONFIG_COUNT;\n\tconst existingCountParsed = existingCountRaw ? Number.parseInt(existingCountRaw, 10) : Number.NaN;\n\tconst existingCount = Number.isFinite(existingCountParsed) && existingCountParsed >= 0 ? existingCountParsed : 0;\n\tconst keyIndex = existingCount;\n\n\tenv.GIT_CONFIG_COUNT = String(existingCount + 1);\n\tenv[`GIT_CONFIG_KEY_${keyIndex}`] = \"http.https://github.com/.extraheader\";\n\tenv[`GIT_CONFIG_VALUE_${keyIndex}`] = `AUTHORIZATION: basic ${basic}`;\n\treturn env;\n}\n\nexport function createGitWriteTool(cwd: string, options?: GitWriteToolOptions): AgentTool<typeof gitWriteSchema> {\n\tconst { hasCommand, runCommand } = resolveGitCommandOptions(options);\n\tconst permissionGuard = options?.permissionGuard;\n\tconst resolveRuntimeConfig = options?.resolveRuntimeConfig;\n\tconst resolveGithubToken = options?.resolveGithubToken;\n\n\treturn {\n\t\tname: \"git_write\",\n\t\tlabel: \"git_write\",\n\t\tdescription:\n\t\t\t\"Structured git mutation tool. Actions: add, restore, reset_index, commit, switch, branch_create, fetch, pull, push, stash_push, stash_pop, stash_apply, stash_drop, stash_list. Network actions are disabled by default and require explicit runtime enablement.\",\n\t\tparameters: gitWriteSchema,\n\t\texecute: async (_toolCallId: string, input: GitWriteToolInput, signal?: AbortSignal) => {\n\t\t\tif (!hasCommand(\"git\")) {\n\t\t\t\tthrow new Error(\"git command is not available.\");\n\t\t\t}\n\n\t\t\tconst runtimeConfig = normalizeGitWriteRuntimeConfig(resolveRuntimeConfig?.());\n\t\t\tconst networkAction = isNetworkAction(input.action);\n\t\t\tif (networkAction && !runtimeConfig.networkEnabled) {\n\t\t\t\tthrow new Error(\"git_write network actions are disabled. Enable Github tools network access in settings.\");\n\t\t\t}\n\n\t\t\tconst repoCwd = resolveToCwd(input.path || \".\", cwd);\n\t\t\tconst args = buildGitWriteArgs(input);\n\t\t\tconst timeoutSeconds = normalizePositiveInt(input.timeout, DEFAULT_GIT_TIMEOUT_SECONDS, \"timeout\");\n\t\t\tconst env = networkAction ? buildGitNetworkEnv(resolveGithubToken?.()) : undefined;\n\n\t\t\t\tif (permissionGuard) {\n\t\t\t\t\tconst allowed = await permissionGuard({\n\t\t\t\t\t\ttoolName: \"git_write\",\n\t\t\t\t\t\tcwd,\n\t\t\t\t\t\tinput: {\n\t\t\t\t\t\t\taction: input.action,\n\t\t\t\t\t\t\tpath: input.path,\n\t\t\t\t\t\t\trepoCwd,\n\t\t\t\t\t\t\targs,\n\t\t\t\t\t\t\ttimeoutSeconds,\n\t\t\t\t\t\t\tnetworkAction,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsummary: `git ${args.join(\" \")}`,\n\t\t\t\t\t});\n\t\t\t\t\tif (!allowed) {\n\t\t\t\t\t\tthrow new Error(\"Permission denied for git_write operation.\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tconst result = await runGitAndFormatOutput({\n\t\t\t\ttoolName: \"git_write\",\n\t\t\t\taction: input.action,\n\t\t\t\targs,\n\t\t\t\tcwd: repoCwd,\n\t\t\t\ttimeoutSeconds,\n\t\t\t\trunCommand,\n\t\t\t\tsignal,\n\t\t\t\tenv,\n\t\t\t});\n\n\t\t\tconst details: GitWriteToolDetails = {\n\t\t\t\taction: input.action,\n\t\t\t\tcommand: \"git\",\n\t\t\t\targs,\n\t\t\t\tcwd: repoCwd,\n\t\t\t\texitCode: result.exitCode,\n\t\t\t\tcaptureTruncated: result.captureTruncated || undefined,\n\t\t\t\ttruncation: result.truncation,\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: result.output }],\n\t\t\t\tdetails,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport const gitWriteTool = createGitWriteTool(process.cwd());\n"]}
|
|
@@ -2,10 +2,15 @@ export { createAstGrepTool, type AstGrepToolInput, astGrepTool, } from "./ast-gr
|
|
|
2
2
|
export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, bashTool, createBashTool, } from "./bash.js";
|
|
3
3
|
export { type CombyToolInput, combyTool, createCombyTool, } from "./comby.js";
|
|
4
4
|
export { createEditTool, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, editTool, } from "./edit.js";
|
|
5
|
+
export { createFetchTool, type FetchToolDetails, type FetchToolInput, type FetchToolOptions, type FetchMethod, type FetchResponseFormat, DEFAULT_FETCH_TIMEOUT_SECONDS, DEFAULT_FETCH_MAX_BYTES, DEFAULT_FETCH_MAX_REDIRECTS, getAllowedFetchMethodsForProfile, fetchTool, } from "./fetch.js";
|
|
6
|
+
export { createWebSearchTool, type WebSearchAttemptDetail, type WebSearchAttemptStatus, type WebSearchFallbackMode, type WebSearchProvider, type WebSearchProviderMode, type WebSearchRuntimeConfig, type WebSearchSafeSearch, type WebSearchSearchDepth, type WebSearchToolDetails, type WebSearchToolInput, type WebSearchToolOptions, DEFAULT_WEB_SEARCH_MAX_RESULTS, DEFAULT_WEB_SEARCH_TIMEOUT_SECONDS, webSearchTool, } from "./web-search.js";
|
|
5
7
|
export { type ExternalCliToolDetails, type ExternalCliToolInput, type ExternalCliToolOptions, createExternalCliTool, } from "./external-cli.js";
|
|
6
8
|
export { createFdTool, type FdToolInput, fdTool, } from "./fd.js";
|
|
7
9
|
export { createFindTool, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, findTool, } from "./find.js";
|
|
10
|
+
export { createFsOpsTool, type FsOpsToolDetails, type FsOpsToolInput, type FsOpsToolOptions, fsOpsTool, } from "./fs-ops.js";
|
|
8
11
|
export { createGrepTool, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, grepTool, } from "./grep.js";
|
|
12
|
+
export { createGitReadTool, type GitReadToolDetails, type GitReadToolInput, type GitReadToolOptions, gitReadTool, } from "./git-read.js";
|
|
13
|
+
export { createGitWriteTool, type GitWriteToolDetails, type GitWriteToolInput, type GitWriteToolOptions, gitWriteTool, } from "./git-write.js";
|
|
9
14
|
export { createJqTool, type JqToolInput, jqTool, } from "./jq.js";
|
|
10
15
|
export { createLsTool, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, lsTool, } from "./ls.js";
|
|
11
16
|
export { createReadTool, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, readTool, } from "./read.js";
|
|
@@ -22,6 +27,10 @@ export { createTaskTool, type SubagentRunner, type TaskToolProgress, type TaskTo
|
|
|
22
27
|
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
|
23
28
|
import { type BashToolOptions } from "./bash.js";
|
|
24
29
|
import { type EditToolOptions } from "./edit.js";
|
|
30
|
+
import { type FetchToolOptions } from "./fetch.js";
|
|
31
|
+
import { type WebSearchToolOptions } from "./web-search.js";
|
|
32
|
+
import { type FsOpsToolOptions } from "./fs-ops.js";
|
|
33
|
+
import { type GitWriteToolOptions } from "./git-write.js";
|
|
25
34
|
import { type ReadToolOptions } from "./read.js";
|
|
26
35
|
import { type SemanticSearchToolOptions } from "./semantic-search.js";
|
|
27
36
|
import { type WriteToolOptions } from "./write.js";
|
|
@@ -121,6 +130,79 @@ export declare const allTools: {
|
|
|
121
130
|
query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
122
131
|
top_k: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
123
132
|
}>, any>;
|
|
133
|
+
fetch: AgentTool<import("@sinclair/typebox").TObject<{
|
|
134
|
+
url: import("@sinclair/typebox").TString;
|
|
135
|
+
method: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"GET">, import("@sinclair/typebox").TLiteral<"POST">, import("@sinclair/typebox").TLiteral<"PUT">, import("@sinclair/typebox").TLiteral<"PATCH">, import("@sinclair/typebox").TLiteral<"DELETE">, import("@sinclair/typebox").TLiteral<"HEAD">, import("@sinclair/typebox").TLiteral<"OPTIONS">]>>;
|
|
136
|
+
headers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>>;
|
|
137
|
+
body: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
138
|
+
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
139
|
+
max_bytes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
140
|
+
response_format: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"json">, import("@sinclair/typebox").TLiteral<"text">]>>;
|
|
141
|
+
max_redirects: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
142
|
+
}>, any>;
|
|
143
|
+
web_search: AgentTool<import("@sinclair/typebox").TObject<{
|
|
144
|
+
query: import("@sinclair/typebox").TString;
|
|
145
|
+
max_results: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
146
|
+
include_domains: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
147
|
+
exclude_domains: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
148
|
+
topic: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
149
|
+
days: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
150
|
+
search_depth: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"basic">, import("@sinclair/typebox").TLiteral<"advanced">]>>;
|
|
151
|
+
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
152
|
+
}>, any>;
|
|
153
|
+
git_read: AgentTool<import("@sinclair/typebox").TObject<{
|
|
154
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"status">, import("@sinclair/typebox").TLiteral<"diff">, import("@sinclair/typebox").TLiteral<"log">, import("@sinclair/typebox").TLiteral<"blame">, import("@sinclair/typebox").TLiteral<"show">, import("@sinclair/typebox").TLiteral<"branch_list">, import("@sinclair/typebox").TLiteral<"remote_list">, import("@sinclair/typebox").TLiteral<"rev_parse">]>;
|
|
155
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
156
|
+
file: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
157
|
+
base: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
158
|
+
head: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
159
|
+
staged: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
160
|
+
context: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
161
|
+
porcelain: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
162
|
+
untracked: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
163
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
164
|
+
since: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
165
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
166
|
+
line_start: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
167
|
+
line_end: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
168
|
+
all: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
169
|
+
verbose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
170
|
+
target: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
171
|
+
short: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
172
|
+
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
173
|
+
}>, any>;
|
|
174
|
+
git_write: AgentTool<import("@sinclair/typebox").TObject<{
|
|
175
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"restore">, import("@sinclair/typebox").TLiteral<"reset_index">, import("@sinclair/typebox").TLiteral<"commit">, import("@sinclair/typebox").TLiteral<"switch">, import("@sinclair/typebox").TLiteral<"branch_create">, import("@sinclair/typebox").TLiteral<"fetch">, import("@sinclair/typebox").TLiteral<"pull">, import("@sinclair/typebox").TLiteral<"push">, import("@sinclair/typebox").TLiteral<"stash_push">, import("@sinclair/typebox").TLiteral<"stash_pop">, import("@sinclair/typebox").TLiteral<"stash_apply">, import("@sinclair/typebox").TLiteral<"stash_drop">, import("@sinclair/typebox").TLiteral<"stash_list">]>;
|
|
176
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
177
|
+
all: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
178
|
+
update: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
179
|
+
files: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
180
|
+
staged: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
181
|
+
source: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
182
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
183
|
+
message: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
184
|
+
allow_empty: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
185
|
+
branch: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
186
|
+
start_point: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
187
|
+
remote: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
188
|
+
ff_only: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
189
|
+
prune: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
190
|
+
set_upstream: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
191
|
+
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
192
|
+
include_untracked: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
193
|
+
keep_index: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
194
|
+
stash_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
195
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
196
|
+
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
197
|
+
}>, any>;
|
|
198
|
+
fs_ops: AgentTool<import("@sinclair/typebox").TObject<{
|
|
199
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"mkdir">, import("@sinclair/typebox").TLiteral<"move">, import("@sinclair/typebox").TLiteral<"copy">, import("@sinclair/typebox").TLiteral<"delete">]>;
|
|
200
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
201
|
+
from: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
202
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
203
|
+
recursive: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
204
|
+
force: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
205
|
+
}>, any>;
|
|
124
206
|
todo_write: AgentTool<import("@sinclair/typebox").TObject<{
|
|
125
207
|
tasks: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
126
208
|
id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -144,6 +226,14 @@ export interface ToolsOptions {
|
|
|
144
226
|
write?: WriteToolOptions;
|
|
145
227
|
/** Options for the semantic_search tool */
|
|
146
228
|
semantic?: SemanticSearchToolOptions;
|
|
229
|
+
/** Options for the fetch tool */
|
|
230
|
+
fetch?: FetchToolOptions;
|
|
231
|
+
/** Options for the web_search tool */
|
|
232
|
+
webSearch?: WebSearchToolOptions;
|
|
233
|
+
/** Options for the git_write tool */
|
|
234
|
+
gitWrite?: GitWriteToolOptions;
|
|
235
|
+
/** Options for the fs_ops tool */
|
|
236
|
+
fsOps?: FsOpsToolOptions;
|
|
147
237
|
}
|
|
148
238
|
/**
|
|
149
239
|
* Create coding tools configured for a specific working directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,EACR,cAAc,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,KAAK,cAAc,EACnB,SAAS,EACT,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AAK,yBAAyB,EAC9B,kBAAkB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,YAAY,EACZ,YAAY,EACZ,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,SAAS,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,KAAK,WAAW,EAChB,MAAM,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,KAAK,eAAe,EAA4B,MAAM,WAAW,CAAC;AAE3E,OAAO,EAAkB,KAAK,eAAe,EAAY,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,K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CAAC,QAAQ,EAAE,IAAI,CAAC,CA0B1F;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAKjG"}
|
package/dist/core/tools/index.js
CHANGED
|
@@ -2,10 +2,15 @@ export { createAstGrepTool, astGrepTool, } from "./ast-grep.js";
|
|
|
2
2
|
export { bashTool, createBashTool, } from "./bash.js";
|
|
3
3
|
export { combyTool, createCombyTool, } from "./comby.js";
|
|
4
4
|
export { createEditTool, editTool, } from "./edit.js";
|
|
5
|
+
export { createFetchTool, DEFAULT_FETCH_TIMEOUT_SECONDS, DEFAULT_FETCH_MAX_BYTES, DEFAULT_FETCH_MAX_REDIRECTS, getAllowedFetchMethodsForProfile, fetchTool, } from "./fetch.js";
|
|
6
|
+
export { createWebSearchTool, DEFAULT_WEB_SEARCH_MAX_RESULTS, DEFAULT_WEB_SEARCH_TIMEOUT_SECONDS, webSearchTool, } from "./web-search.js";
|
|
5
7
|
export { createExternalCliTool, } from "./external-cli.js";
|
|
6
8
|
export { createFdTool, fdTool, } from "./fd.js";
|
|
7
9
|
export { createFindTool, findTool, } from "./find.js";
|
|
10
|
+
export { createFsOpsTool, fsOpsTool, } from "./fs-ops.js";
|
|
8
11
|
export { createGrepTool, grepTool, } from "./grep.js";
|
|
12
|
+
export { createGitReadTool, gitReadTool, } from "./git-read.js";
|
|
13
|
+
export { createGitWriteTool, gitWriteTool, } from "./git-write.js";
|
|
9
14
|
export { createJqTool, jqTool, } from "./jq.js";
|
|
10
15
|
export { createLsTool, lsTool, } from "./ls.js";
|
|
11
16
|
export { createReadTool, readTool, } from "./read.js";
|
|
@@ -22,9 +27,14 @@ import { astGrepTool, createAstGrepTool } from "./ast-grep.js";
|
|
|
22
27
|
import { bashTool, createBashTool } from "./bash.js";
|
|
23
28
|
import { combyTool, createCombyTool } from "./comby.js";
|
|
24
29
|
import { createEditTool, editTool } from "./edit.js";
|
|
30
|
+
import { createFetchTool, fetchTool, getAllowedFetchMethodsForProfile, } from "./fetch.js";
|
|
31
|
+
import { createWebSearchTool, webSearchTool } from "./web-search.js";
|
|
25
32
|
import { createFdTool, fdTool } from "./fd.js";
|
|
26
33
|
import { createFindTool, findTool } from "./find.js";
|
|
34
|
+
import { createFsOpsTool, fsOpsTool } from "./fs-ops.js";
|
|
27
35
|
import { createGrepTool, grepTool } from "./grep.js";
|
|
36
|
+
import { createGitReadTool, gitReadTool } from "./git-read.js";
|
|
37
|
+
import { createGitWriteTool, gitWriteTool } from "./git-write.js";
|
|
28
38
|
import { createJqTool, jqTool } from "./jq.js";
|
|
29
39
|
import { createLsTool, lsTool } from "./ls.js";
|
|
30
40
|
import { createReadTool, readTool } from "./read.js";
|
|
@@ -52,6 +62,11 @@ export const readOnlyTools = [
|
|
|
52
62
|
semgrepTool,
|
|
53
63
|
sedTool,
|
|
54
64
|
semanticSearchTool,
|
|
65
|
+
createFetchTool(process.cwd(), {
|
|
66
|
+
resolveAllowedMethods: () => getAllowedFetchMethodsForProfile("plan"),
|
|
67
|
+
}),
|
|
68
|
+
webSearchTool,
|
|
69
|
+
gitReadTool,
|
|
55
70
|
];
|
|
56
71
|
// All available tools (using process.cwd())
|
|
57
72
|
export const allTools = {
|
|
@@ -71,6 +86,11 @@ export const allTools = {
|
|
|
71
86
|
semgrep: semgrepTool,
|
|
72
87
|
sed: sedTool,
|
|
73
88
|
semantic_search: semanticSearchTool,
|
|
89
|
+
fetch: fetchTool,
|
|
90
|
+
web_search: webSearchTool,
|
|
91
|
+
git_read: gitReadTool,
|
|
92
|
+
git_write: gitWriteTool,
|
|
93
|
+
fs_ops: fsOpsTool,
|
|
74
94
|
todo_write: todoWriteTool,
|
|
75
95
|
todo_read: todoReadTool,
|
|
76
96
|
};
|
|
@@ -89,6 +109,10 @@ export function createCodingTools(cwd, options) {
|
|
|
89
109
|
* Create read-only tools configured for a specific working directory.
|
|
90
110
|
*/
|
|
91
111
|
export function createReadOnlyTools(cwd, options) {
|
|
112
|
+
const fetchOptions = {
|
|
113
|
+
...(options?.fetch ?? {}),
|
|
114
|
+
resolveAllowedMethods: options?.fetch?.resolveAllowedMethods ?? (() => getAllowedFetchMethodsForProfile("plan")),
|
|
115
|
+
};
|
|
92
116
|
return [
|
|
93
117
|
createReadTool(cwd, options?.read),
|
|
94
118
|
createGrepTool(cwd),
|
|
@@ -103,6 +127,9 @@ export function createReadOnlyTools(cwd, options) {
|
|
|
103
127
|
createSemgrepTool(cwd),
|
|
104
128
|
createSedTool(cwd),
|
|
105
129
|
createSemanticSearchTool(cwd, options?.semantic),
|
|
130
|
+
createFetchTool(cwd, fetchOptions),
|
|
131
|
+
createWebSearchTool(cwd, options?.webSearch),
|
|
132
|
+
createGitReadTool(cwd),
|
|
106
133
|
];
|
|
107
134
|
}
|
|
108
135
|
/**
|
|
@@ -126,6 +153,11 @@ export function createAllTools(cwd, options) {
|
|
|
126
153
|
semgrep: createSemgrepTool(cwd),
|
|
127
154
|
sed: createSedTool(cwd),
|
|
128
155
|
semantic_search: createSemanticSearchTool(cwd, options?.semantic),
|
|
156
|
+
fetch: createFetchTool(cwd, options?.fetch),
|
|
157
|
+
web_search: createWebSearchTool(cwd, options?.webSearch),
|
|
158
|
+
git_read: createGitReadTool(cwd),
|
|
159
|
+
git_write: createGitWriteTool(cwd, options?.gitWrite),
|
|
160
|
+
fs_ops: createFsOpsTool(cwd, options?.fsOps),
|
|
129
161
|
todo_write: todoWriteTool,
|
|
130
162
|
todo_read: todoReadTool,
|
|
131
163
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EAEjB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAON,QAAQ,EACR,cAAc,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAEN,SAAS,E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AAG,EAAE,OAAO,CAAC,CAAC;IACzC,OAAO,KAAK;SACV,MAAM,CAAC,CAAC,CAAC,EAAiB,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;SACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC","sourcesContent":["export {\n\tcreateAstGrepTool,\n\ttype AstGrepToolInput,\n\tastGrepTool,\n} from \"./ast-grep.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} from \"./bash.js\";\nexport {\n\ttype CombyToolInput,\n\tcombyTool,\n\tcreateCombyTool,\n} from \"./comby.js\";\nexport {\n\tcreateEditTool,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n} from \"./edit.js\";\nexport {\n\ttype ExternalCliToolDetails,\n\ttype ExternalCliToolInput,\n\ttype ExternalCliToolOptions,\n\tcreateExternalCliTool,\n} from \"./external-cli.js\";\nexport {\n\tcreateFdTool,\n\ttype FdToolInput,\n\tfdTool,\n} from \"./fd.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\tcreateJqTool,\n\ttype JqToolInput,\n\tjqTool,\n} from \"./jq.js\";\nexport {\n\tcreateLsTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n} from \"./read.js\";\nexport {\n\tcreateRgTool,\n\ttype RgToolInput,\n\trgTool,\n} from \"./rg.js\";\nexport {\n\tcreateSedTool,\n\ttype SedToolInput,\n\tsedTool,\n} from \"./sed.js\";\nexport {\n\tcreateSemgrepTool,\n\ttype SemgrepToolInput,\n\tsemgrepTool,\n} from \"./semgrep.js\";\nexport {\n\tcreateSemanticSearchTool,\n\ttype SemanticSearchToolInput,\n\ttype SemanticSearchToolOptions,\n\tsemanticSearchTool,\n} from \"./semantic-search.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\tcreateWriteTool,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./write.js\";\nexport { type ToolPermissionGuard, type ToolPermissionRequest } from \"./permissions.js\";\nexport {\n\tcreateTodoWriteTool,\n\tcreateTodoReadTool,\n\ttodoWriteTool,\n\ttodoReadTool,\n\tgetTaskFilePath,\n\ttype TodoTask,\n\ttype TodoTaskStatus,\n\ttype TodoWriteInput,\n\ttype TodoReadInput,\n} from \"./todo.js\";\nexport {\n\tcreateYqTool,\n\ttype YqToolInput,\n\tyqTool,\n} from \"./yq.js\";\nexport {\n\tcreateTaskTool,\n\ttype SubagentRunner,\n\ttype TaskToolProgress,\n\ttype TaskToolProgressPhase,\n\ttype TaskToolInput,\n\ttype TaskToolDetails,\n} from \"./task.js\";\n\nimport type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport { astGrepTool, createAstGrepTool } from \"./ast-grep.js\";\nimport { type BashToolOptions, bashTool, createBashTool } from \"./bash.js\";\nimport { combyTool, createCombyTool } from \"./comby.js\";\nimport { createEditTool, type EditToolOptions, editTool } from \"./edit.js\";\nimport { createFdTool, fdTool } from \"./fd.js\";\nimport { createFindTool, findTool } from \"./find.js\";\nimport { createGrepTool, grepTool } from \"./grep.js\";\nimport { createJqTool, jqTool } from \"./jq.js\";\nimport { createLsTool, lsTool } from \"./ls.js\";\nimport { createReadTool, type ReadToolOptions, readTool } from \"./read.js\";\nimport { createRgTool, rgTool } from \"./rg.js\";\nimport { createSedTool, sedTool } from \"./sed.js\";\nimport { createSemgrepTool, semgrepTool } from \"./semgrep.js\";\nimport {\n\tcreateSemanticSearchTool,\n\ttype SemanticSearchToolOptions,\n\tsemanticSearchTool,\n} from \"./semantic-search.js\";\nimport { createWriteTool, type WriteToolOptions, writeTool } from \"./write.js\";\nimport { createYqTool, yqTool } from \"./yq.js\";\nimport { todoWriteTool, todoReadTool } from \"./todo.js\";\n\n/** Tool type (AgentTool from pi-ai) */\nexport type Tool = AgentTool<any>;\n\n// Default tools for full access mode (using process.cwd())\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\n\n// Read-only tools for exploration without modification (using process.cwd())\nexport const readOnlyTools: Tool[] = [\n\treadTool,\n\tgrepTool,\n\tfindTool,\n\tlsTool,\n\trgTool,\n\tfdTool,\n\tastGrepTool,\n\tcombyTool,\n\tjqTool,\n\tyqTool,\n\tsemgrepTool,\n\tsedTool,\n\tsemanticSearchTool,\n];\n\n// All available tools (using process.cwd())\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\trg: rgTool,\n\tfd: fdTool,\n\tast_grep: astGrepTool,\n\tcomby: combyTool,\n\tjq: jqTool,\n\tyq: yqTool,\n\tsemgrep: semgrepTool,\n\tsed: sedTool,\n\tsemantic_search: semanticSearchTool,\n\ttodo_write: todoWriteTool,\n\ttodo_read: todoReadTool,\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 edit tool */\n\tedit?: EditToolOptions;\n\t/** Options for the write tool */\n\twrite?: WriteToolOptions;\n\t/** Options for the semantic_search tool */\n\tsemantic?: SemanticSearchToolOptions;\n}\n\n/**\n * Create coding tools configured for a specific working directory.\n */\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\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 [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd),\n\t\tcreateFindTool(cwd),\n\t\tcreateLsTool(cwd),\n\t\tcreateRgTool(cwd),\n\t\tcreateFdTool(cwd),\n\t\tcreateAstGrepTool(cwd),\n\t\tcreateCombyTool(cwd),\n\t\tcreateJqTool(cwd),\n\t\tcreateYqTool(cwd),\n\t\tcreateSemgrepTool(cwd),\n\t\tcreateSedTool(cwd),\n\t\tcreateSemanticSearchTool(cwd, options?.semantic),\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 {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\trg: createRgTool(cwd),\n\t\tfd: createFdTool(cwd),\n\t\tast_grep: createAstGrepTool(cwd),\n\t\tcomby: createCombyTool(cwd),\n\t\tjq: createJqTool(cwd),\n\t\tyq: createYqTool(cwd),\n\t\tsemgrep: createSemgrepTool(cwd),\n\t\tsed: createSedTool(cwd),\n\t\tsemantic_search: createSemanticSearchTool(cwd, options?.semantic),\n\t\ttodo_write: todoWriteTool,\n\t\ttodo_read: todoReadTool,\n\t};\n}\n\n/**\n * Create a filtered set of tools from a list of tool names.\n * Used by agent profiles and the Task tool to configure subagent capabilities.\n */\nexport function createToolsFromNames(cwd: string, names: string[], options?: ToolsOptions): Tool[] {\n\tconst all = createAllTools(cwd, options);\n\treturn names\n\t\t.filter((n): n is ToolName => n in all)\n\t\t.map((n) => all[n]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EAEjB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAON,QAAQ,EACR,cAAc,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAEN,SAAS,EACT,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,cAAc,EAKd,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,eAAe,EAMf,6BAA6B,EAC7B,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,SAAS,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,mBAAmB,EAYnB,8BAA8B,EAC9B,kCAAkC,EAClC,aAAa,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIN,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,YAAY,EAEZ,MAAM,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EAKd,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,eAAe,EAIf,SAAS,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,cAAc,EAKd,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,iBAAiB,EAIjB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,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\ttype AstGrepToolInput,\n\tastGrepTool,\n} from \"./ast-grep.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} from \"./bash.js\";\nexport {\n\ttype CombyToolInput,\n\tcombyTool,\n\tcreateCombyTool,\n} from \"./comby.js\";\nexport {\n\tcreateEditTool,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n} from \"./edit.js\";\nexport {\n\tcreateFetchTool,\n\ttype FetchToolDetails,\n\ttype FetchToolInput,\n\ttype FetchToolOptions,\n\ttype FetchMethod,\n\ttype FetchResponseFormat,\n\tDEFAULT_FETCH_TIMEOUT_SECONDS,\n\tDEFAULT_FETCH_MAX_BYTES,\n\tDEFAULT_FETCH_MAX_REDIRECTS,\n\tgetAllowedFetchMethodsForProfile,\n\tfetchTool,\n} from \"./fetch.js\";\nexport {\n\tcreateWebSearchTool,\n\ttype WebSearchAttemptDetail,\n\ttype WebSearchAttemptStatus,\n\ttype WebSearchFallbackMode,\n\ttype WebSearchProvider,\n\ttype WebSearchProviderMode,\n\ttype WebSearchRuntimeConfig,\n\ttype WebSearchSafeSearch,\n\ttype WebSearchSearchDepth,\n\ttype WebSearchToolDetails,\n\ttype WebSearchToolInput,\n\ttype WebSearchToolOptions,\n\tDEFAULT_WEB_SEARCH_MAX_RESULTS,\n\tDEFAULT_WEB_SEARCH_TIMEOUT_SECONDS,\n\twebSearchTool,\n} from \"./web-search.js\";\nexport {\n\ttype ExternalCliToolDetails,\n\ttype ExternalCliToolInput,\n\ttype ExternalCliToolOptions,\n\tcreateExternalCliTool,\n} from \"./external-cli.js\";\nexport {\n\tcreateFdTool,\n\ttype FdToolInput,\n\tfdTool,\n} from \"./fd.js\";\nexport {\n\tcreateFindTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n} from \"./find.js\";\nexport {\n\tcreateFsOpsTool,\n\ttype FsOpsToolDetails,\n\ttype FsOpsToolInput,\n\ttype FsOpsToolOptions,\n\tfsOpsTool,\n} from \"./fs-ops.js\";\nexport {\n\tcreateGrepTool,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n} from \"./grep.js\";\nexport {\n\tcreateGitReadTool,\n\ttype GitReadToolDetails,\n\ttype GitReadToolInput,\n\ttype GitReadToolOptions,\n\tgitReadTool,\n} from \"./git-read.js\";\nexport {\n\tcreateGitWriteTool,\n\ttype GitWriteToolDetails,\n\ttype GitWriteToolInput,\n\ttype GitWriteToolOptions,\n\tgitWriteTool,\n} from \"./git-write.js\";\nexport {\n\tcreateJqTool,\n\ttype JqToolInput,\n\tjqTool,\n} from \"./jq.js\";\nexport {\n\tcreateLsTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n} from \"./read.js\";\nexport {\n\tcreateRgTool,\n\ttype RgToolInput,\n\trgTool,\n} from \"./rg.js\";\nexport {\n\tcreateSedTool,\n\ttype SedToolInput,\n\tsedTool,\n} from \"./sed.js\";\nexport {\n\tcreateSemgrepTool,\n\ttype SemgrepToolInput,\n\tsemgrepTool,\n} from \"./semgrep.js\";\nexport {\n\tcreateSemanticSearchTool,\n\ttype SemanticSearchToolInput,\n\ttype SemanticSearchToolOptions,\n\tsemanticSearchTool,\n} from \"./semantic-search.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\tcreateWriteTool,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./write.js\";\nexport { type ToolPermissionGuard, type ToolPermissionRequest } from \"./permissions.js\";\nexport {\n\tcreateTodoWriteTool,\n\tcreateTodoReadTool,\n\ttodoWriteTool,\n\ttodoReadTool,\n\tgetTaskFilePath,\n\ttype TodoTask,\n\ttype TodoTaskStatus,\n\ttype TodoWriteInput,\n\ttype TodoReadInput,\n} from \"./todo.js\";\nexport {\n\tcreateYqTool,\n\ttype YqToolInput,\n\tyqTool,\n} from \"./yq.js\";\nexport {\n\tcreateTaskTool,\n\ttype SubagentRunner,\n\ttype TaskToolProgress,\n\ttype TaskToolProgressPhase,\n\ttype TaskToolInput,\n\ttype TaskToolDetails,\n} from \"./task.js\";\n\nimport type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport { astGrepTool, createAstGrepTool } from \"./ast-grep.js\";\nimport { type BashToolOptions, bashTool, createBashTool } from \"./bash.js\";\nimport { combyTool, createCombyTool } from \"./comby.js\";\nimport { createEditTool, type EditToolOptions, editTool } from \"./edit.js\";\nimport {\n\tcreateFetchTool,\n\ttype FetchToolOptions,\n\tfetchTool,\n\tgetAllowedFetchMethodsForProfile,\n} from \"./fetch.js\";\nimport { createWebSearchTool, type WebSearchToolOptions, webSearchTool } from \"./web-search.js\";\nimport { createFdTool, fdTool } from \"./fd.js\";\nimport { createFindTool, findTool } from \"./find.js\";\nimport { createFsOpsTool, type FsOpsToolOptions, fsOpsTool } from \"./fs-ops.js\";\nimport { createGrepTool, grepTool } from \"./grep.js\";\nimport { createGitReadTool, gitReadTool } from \"./git-read.js\";\nimport { createGitWriteTool, type GitWriteToolOptions, gitWriteTool } from \"./git-write.js\";\nimport { createJqTool, jqTool } from \"./jq.js\";\nimport { createLsTool, lsTool } from \"./ls.js\";\nimport { createReadTool, type ReadToolOptions, readTool } from \"./read.js\";\nimport { createRgTool, rgTool } from \"./rg.js\";\nimport { createSedTool, sedTool } from \"./sed.js\";\nimport { createSemgrepTool, semgrepTool } from \"./semgrep.js\";\nimport {\n\tcreateSemanticSearchTool,\n\ttype SemanticSearchToolOptions,\n\tsemanticSearchTool,\n} from \"./semantic-search.js\";\nimport { createWriteTool, type WriteToolOptions, writeTool } from \"./write.js\";\nimport { createYqTool, yqTool } from \"./yq.js\";\nimport { todoWriteTool, todoReadTool } from \"./todo.js\";\n\n/** Tool type (AgentTool from pi-ai) */\nexport type Tool = AgentTool<any>;\n\n// Default tools for full access mode (using process.cwd())\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\n\n// Read-only tools for exploration without modification (using process.cwd())\nexport const readOnlyTools: Tool[] = [\n\treadTool,\n\tgrepTool,\n\tfindTool,\n\tlsTool,\n\trgTool,\n\tfdTool,\n\tastGrepTool,\n\tcombyTool,\n\tjqTool,\n\tyqTool,\n\tsemgrepTool,\n\tsedTool,\n\tsemanticSearchTool,\n\tcreateFetchTool(process.cwd(), {\n\t\tresolveAllowedMethods: () => getAllowedFetchMethodsForProfile(\"plan\"),\n\t}),\n\twebSearchTool,\n\tgitReadTool,\n];\n\n// All available tools (using process.cwd())\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\trg: rgTool,\n\tfd: fdTool,\n\tast_grep: astGrepTool,\n\tcomby: combyTool,\n\tjq: jqTool,\n\tyq: yqTool,\n\tsemgrep: semgrepTool,\n\tsed: sedTool,\n\tsemantic_search: semanticSearchTool,\n\tfetch: fetchTool,\n\tweb_search: webSearchTool,\n\tgit_read: gitReadTool,\n\tgit_write: gitWriteTool,\n\tfs_ops: fsOpsTool,\n\ttodo_write: todoWriteTool,\n\ttodo_read: todoReadTool,\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 edit tool */\n\tedit?: EditToolOptions;\n\t/** Options for the write tool */\n\twrite?: WriteToolOptions;\n\t/** Options for the semantic_search tool */\n\tsemantic?: SemanticSearchToolOptions;\n\t/** Options for the fetch tool */\n\tfetch?: FetchToolOptions;\n\t/** Options for the web_search tool */\n\twebSearch?: WebSearchToolOptions;\n\t/** Options for the git_write tool */\n\tgitWrite?: GitWriteToolOptions;\n\t/** Options for the fs_ops tool */\n\tfsOps?: FsOpsToolOptions;\n}\n\n/**\n * Create coding tools configured for a specific working directory.\n */\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\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\tconst fetchOptions: FetchToolOptions = {\n\t\t...(options?.fetch ?? {}),\n\t\tresolveAllowedMethods:\n\t\t\toptions?.fetch?.resolveAllowedMethods ?? (() => getAllowedFetchMethodsForProfile(\"plan\")),\n\t};\n\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd),\n\t\tcreateFindTool(cwd),\n\t\tcreateLsTool(cwd),\n\t\tcreateRgTool(cwd),\n\t\tcreateFdTool(cwd),\n\t\tcreateAstGrepTool(cwd),\n\t\tcreateCombyTool(cwd),\n\t\tcreateJqTool(cwd),\n\t\tcreateYqTool(cwd),\n\t\tcreateSemgrepTool(cwd),\n\t\tcreateSedTool(cwd),\n\t\tcreateSemanticSearchTool(cwd, options?.semantic),\n\t\tcreateFetchTool(cwd, fetchOptions),\n\t\tcreateWebSearchTool(cwd, options?.webSearch),\n\t\tcreateGitReadTool(cwd),\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 {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\trg: createRgTool(cwd),\n\t\tfd: createFdTool(cwd),\n\t\tast_grep: createAstGrepTool(cwd),\n\t\tcomby: createCombyTool(cwd),\n\t\tjq: createJqTool(cwd),\n\t\tyq: createYqTool(cwd),\n\t\tsemgrep: createSemgrepTool(cwd),\n\t\tsed: createSedTool(cwd),\n\t\tsemantic_search: createSemanticSearchTool(cwd, options?.semantic),\n\t\tfetch: createFetchTool(cwd, options?.fetch),\n\t\tweb_search: createWebSearchTool(cwd, options?.webSearch),\n\t\tgit_read: createGitReadTool(cwd),\n\t\tgit_write: createGitWriteTool(cwd, options?.gitWrite),\n\t\tfs_ops: createFsOpsTool(cwd, options?.fsOps),\n\t\ttodo_write: todoWriteTool,\n\t\ttodo_read: todoReadTool,\n\t};\n}\n\n/**\n * Create a filtered set of tools from a list of tool names.\n * Used by agent profiles and the Task tool to configure subagent capabilities.\n */\nexport function createToolsFromNames(cwd: string, names: string[], options?: ToolsOptions): Tool[] {\n\tconst all = createAllTools(cwd, options);\n\treturn names\n\t\t.filter((n): n is ToolName => n in all)\n\t\t.map((n) => all[n]);\n}\n"]}
|
package/dist/core/tools/task.js
CHANGED
|
@@ -69,7 +69,7 @@ const systemPromptByProfile = {
|
|
|
69
69
|
cycle_planner: "You are an IOSM cycle planner. Propose and align cycle goals with measurable outcomes and concrete risks.",
|
|
70
70
|
full: "You are a software engineering agent. Execute the task end-to-end.",
|
|
71
71
|
};
|
|
72
|
-
const writeCapableTools = new Set(["bash", "edit", "write"]);
|
|
72
|
+
const writeCapableTools = new Set(["bash", "edit", "write", "git_write", "fs_ops"]);
|
|
73
73
|
const backgroundUnsafeTools = new Set(writeCapableTools);
|
|
74
74
|
const writeCapableProfiles = new Set(Object.keys(toolsByProfile).filter((profileName) => toolsByProfile[profileName].some((tool) => writeCapableTools.has(tool))));
|
|
75
75
|
const backgroundSafeProfiles = Object.keys(toolsByProfile).filter((profileName) => toolsByProfile[profileName].every((tool) => !backgroundUnsafeTools.has(tool)));
|