@di-code/coding-agent 0.1.7 → 0.1.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/README.md +104 -46
- package/compositions/base.yml +54 -0
- package/compositions/interactive.yml +14 -0
- package/compositions/json.yml +6 -0
- package/compositions/print.yml +5 -0
- package/compositions/rpc.yml +12 -0
- package/compositions/webui.yml +9 -0
- package/dist/cli.d.ts +22 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +97 -3
- package/dist/cli.js.map +1 -1
- package/dist/composition-loader-entry.d.ts +11 -0
- package/dist/composition-loader-entry.d.ts.map +1 -0
- package/dist/composition-loader-entry.js +12 -0
- package/dist/composition-loader-entry.js.map +1 -0
- package/dist/compositions.d.ts +32 -0
- package/dist/compositions.d.ts.map +1 -0
- package/dist/compositions.js +173 -0
- package/dist/compositions.js.map +1 -0
- package/dist/core/session/session-manager.d.ts +9 -2
- package/dist/core/session/session-manager.d.ts.map +1 -1
- package/dist/core/session/session-manager.js +28 -0
- package/dist/core/session/session-manager.js.map +1 -1
- package/dist/core/session/session-storage.d.ts.map +1 -1
- package/dist/core/session/session-storage.js +20 -3
- package/dist/core/session/session-storage.js.map +1 -1
- package/dist/core/session/types.d.ts +11 -2
- package/dist/core/session/types.d.ts.map +1 -1
- package/dist/core/session/types.js.map +1 -1
- package/dist/core/session-tools.d.ts +5 -0
- package/dist/core/session-tools.d.ts.map +1 -0
- package/dist/core/session-tools.js +17 -0
- package/dist/core/session-tools.js.map +1 -0
- package/dist/core/session.d.ts +19 -7
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +71 -39
- package/dist/core/session.js.map +1 -1
- package/dist/core/tools/bash.d.ts +1 -38
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +1 -207
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +1 -24
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +1 -135
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -26
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +1 -140
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js +1 -23
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/file-search.d.ts +1 -13
- package/dist/core/tools/file-search.d.ts.map +1 -1
- package/dist/core/tools/file-search.js +1 -98
- package/dist/core/tools/file-search.js.map +1 -1
- package/dist/core/tools/glob.d.ts +1 -10
- package/dist/core/tools/glob.d.ts.map +1 -1
- package/dist/core/tools/glob.js +1 -43
- package/dist/core/tools/glob.js.map +1 -1
- package/dist/core/tools/grep.d.ts +1 -12
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -66
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/load-skill.d.ts +1 -9
- package/dist/core/tools/load-skill.d.ts.map +1 -1
- package/dist/core/tools/load-skill.js +1 -21
- package/dist/core/tools/load-skill.js.map +1 -1
- package/dist/core/tools/path-boundary.d.ts +1 -4
- package/dist/core/tools/path-boundary.d.ts.map +1 -1
- package/dist/core/tools/path-boundary.js +1 -65
- package/dist/core/tools/path-boundary.js.map +1 -1
- package/dist/core/tools/read.d.ts +1 -16
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -131
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts +1 -16
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +1 -44
- package/dist/core/tools/write.js.map +1 -1
- package/dist/entry.js +30 -28
- package/dist/entry.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/interactive/builtin.d.ts +17 -0
- package/dist/interactive/builtin.d.ts.map +1 -0
- package/dist/interactive/builtin.js +47 -0
- package/dist/interactive/builtin.js.map +1 -0
- package/dist/interactive/controller.d.ts +85 -0
- package/dist/interactive/controller.d.ts.map +1 -0
- package/dist/interactive/controller.js +211 -0
- package/dist/interactive/controller.js.map +1 -0
- package/dist/interactive/index.d.ts +3 -0
- package/dist/interactive/index.d.ts.map +1 -0
- package/dist/interactive/index.js +3 -0
- package/dist/interactive/index.js.map +1 -0
- package/dist/interactive-host-entry.d.ts +7 -0
- package/dist/interactive-host-entry.d.ts.map +1 -0
- package/dist/interactive-host-entry.js +123 -0
- package/dist/interactive-host-entry.js.map +1 -0
- package/dist/interactive-profile.d.ts +18 -0
- package/dist/interactive-profile.d.ts.map +1 -0
- package/dist/interactive-profile.js +290 -0
- package/dist/interactive-profile.js.map +1 -0
- package/dist/interactive-resources-entry.d.ts +7 -0
- package/dist/interactive-resources-entry.d.ts.map +1 -0
- package/dist/interactive-resources-entry.js +42 -0
- package/dist/interactive-resources-entry.js.map +1 -0
- package/dist/legacy-main.d.ts +39 -0
- package/dist/legacy-main.d.ts.map +1 -0
- package/dist/legacy-main.js +611 -0
- package/dist/legacy-main.js.map +1 -0
- package/dist/main.d.ts +15 -34
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +130 -518
- package/dist/main.js.map +1 -1
- package/dist/mcp/entries.d.ts +42 -0
- package/dist/mcp/entries.d.ts.map +1 -0
- package/dist/mcp/entries.js +98 -0
- package/dist/mcp/entries.js.map +1 -0
- package/dist/mcp-client-entry.d.ts +5 -0
- package/dist/mcp-client-entry.d.ts.map +1 -0
- package/dist/mcp-client-entry.js +6 -0
- package/dist/mcp-client-entry.js.map +1 -0
- package/dist/mcp-config-entry.d.ts +5 -0
- package/dist/mcp-config-entry.d.ts.map +1 -0
- package/dist/mcp-config-entry.js +6 -0
- package/dist/mcp-config-entry.js.map +1 -0
- package/dist/mcp-tools-entry.d.ts +5 -0
- package/dist/mcp-tools-entry.d.ts.map +1 -0
- package/dist/mcp-tools-entry.js +6 -0
- package/dist/mcp-tools-entry.js.map +1 -0
- package/dist/mcp-transport-entry.d.ts +5 -0
- package/dist/mcp-transport-entry.d.ts.map +1 -0
- package/dist/mcp-transport-entry.js +6 -0
- package/dist/mcp-transport-entry.js.map +1 -0
- package/dist/modes/interactive-entry.d.ts +18 -0
- package/dist/modes/interactive-entry.d.ts.map +1 -0
- package/dist/modes/interactive-entry.js +21 -0
- package/dist/modes/interactive-entry.js.map +1 -0
- package/dist/modes/interactive.d.ts +16 -6
- package/dist/modes/interactive.d.ts.map +1 -1
- package/dist/modes/interactive.js +81 -32
- package/dist/modes/interactive.js.map +1 -1
- package/dist/modes/json-entry.d.ts +13 -0
- package/dist/modes/json-entry.d.ts.map +1 -0
- package/dist/modes/json-entry.js +14 -0
- package/dist/modes/json-entry.js.map +1 -0
- package/dist/modes/json.d.ts +4 -1
- package/dist/modes/json.d.ts.map +1 -1
- package/dist/modes/json.js +3 -3
- package/dist/modes/json.js.map +1 -1
- package/dist/modes/print-entry.d.ts +10 -0
- package/dist/modes/print-entry.d.ts.map +1 -0
- package/dist/modes/print-entry.js +11 -0
- package/dist/modes/print-entry.js.map +1 -0
- package/dist/modes/tree-selector.d.ts.map +1 -1
- package/dist/modes/tree-selector.js +4 -0
- package/dist/modes/tree-selector.js.map +1 -1
- package/dist/plugin-dump-composition.d.ts +6 -0
- package/dist/plugin-dump-composition.d.ts.map +1 -0
- package/dist/plugin-dump-composition.js +7 -0
- package/dist/plugin-dump-composition.js.map +1 -0
- package/dist/plugin-inventory.d.ts +7 -0
- package/dist/plugin-inventory.d.ts.map +1 -0
- package/dist/plugin-inventory.js +8 -0
- package/dist/plugin-inventory.js.map +1 -0
- package/dist/plugin-manager.d.ts +6 -0
- package/dist/plugin-manager.d.ts.map +1 -0
- package/dist/plugin-manager.js +7 -0
- package/dist/plugin-manager.js.map +1 -0
- package/dist/plugin-trace.d.ts +6 -0
- package/dist/plugin-trace.d.ts.map +1 -0
- package/dist/plugin-trace.js +7 -0
- package/dist/plugin-trace.js.map +1 -0
- package/dist/plugins/dynamic-broker.d.ts +76 -0
- package/dist/plugins/dynamic-broker.d.ts.map +1 -0
- package/dist/plugins/dynamic-broker.js +852 -0
- package/dist/plugins/dynamic-broker.js.map +1 -0
- package/dist/plugins/profile.d.ts +15 -0
- package/dist/plugins/profile.d.ts.map +1 -0
- package/dist/plugins/profile.js +34 -0
- package/dist/plugins/profile.js.map +1 -0
- package/dist/plugins/runtime-host.d.ts +37 -0
- package/dist/plugins/runtime-host.d.ts.map +1 -0
- package/dist/plugins/runtime-host.js +95 -0
- package/dist/plugins/runtime-host.js.map +1 -0
- package/dist/plugins/trust.d.ts +8 -0
- package/dist/plugins/trust.d.ts.map +1 -0
- package/dist/plugins/trust.js +59 -0
- package/dist/plugins/trust.js.map +1 -0
- package/dist/project-trust-entry.d.ts +15 -0
- package/dist/project-trust-entry.d.ts.map +1 -0
- package/dist/project-trust-entry.js +15 -0
- package/dist/project-trust-entry.js.map +1 -0
- package/dist/rpc/client.d.ts +78 -6
- package/dist/rpc/client.d.ts.map +1 -1
- package/dist/rpc/client.js +172 -4
- package/dist/rpc/client.js.map +1 -1
- package/dist/rpc/dispatcher.d.ts +121 -0
- package/dist/rpc/dispatcher.d.ts.map +1 -0
- package/dist/rpc/dispatcher.js +994 -0
- package/dist/rpc/dispatcher.js.map +1 -0
- package/dist/rpc/index.d.ts +2 -0
- package/dist/rpc/index.d.ts.map +1 -1
- package/dist/rpc/index.js +2 -0
- package/dist/rpc/index.js.map +1 -1
- package/dist/rpc/lifecycle.d.ts +6 -0
- package/dist/rpc/lifecycle.d.ts.map +1 -0
- package/dist/rpc/lifecycle.js +24 -0
- package/dist/rpc/lifecycle.js.map +1 -0
- package/dist/rpc/protocol.d.ts +112 -31
- package/dist/rpc/protocol.d.ts.map +1 -1
- package/dist/rpc/protocol.js +569 -117
- package/dist/rpc/protocol.js.map +1 -1
- package/dist/rpc/server-service.d.ts +7 -0
- package/dist/rpc/server-service.d.ts.map +1 -0
- package/dist/rpc/server-service.js +3 -0
- package/dist/rpc/server-service.js.map +1 -0
- package/dist/rpc/server.d.ts +16 -19
- package/dist/rpc/server.d.ts.map +1 -1
- package/dist/rpc/server.js +59 -115
- package/dist/rpc/server.js.map +1 -1
- package/dist/rpc-client-sdk-entry.d.ts +12 -0
- package/dist/rpc-client-sdk-entry.d.ts.map +1 -0
- package/dist/rpc-client-sdk-entry.js +11 -0
- package/dist/rpc-client-sdk-entry.js.map +1 -0
- package/dist/rpc-entry.js +50 -18
- package/dist/rpc-entry.js.map +1 -1
- package/dist/rpc-server-entry.d.ts +8 -0
- package/dist/rpc-server-entry.d.ts.map +1 -0
- package/dist/rpc-server-entry.js +67 -0
- package/dist/rpc-server-entry.js.map +1 -0
- package/dist/runtime/attachment-store.d.ts +13 -0
- package/dist/runtime/attachment-store.d.ts.map +1 -0
- package/dist/runtime/attachment-store.js +93 -0
- package/dist/runtime/attachment-store.js.map +1 -0
- package/dist/runtime/bootstrap.d.ts +14 -0
- package/dist/runtime/bootstrap.d.ts.map +1 -0
- package/dist/runtime/bootstrap.js +29 -0
- package/dist/runtime/bootstrap.js.map +1 -0
- package/dist/runtime/interactive-host-service.d.ts +22 -0
- package/dist/runtime/interactive-host-service.d.ts.map +1 -0
- package/dist/runtime/interactive-host-service.js +2 -0
- package/dist/runtime/interactive-host-service.js.map +1 -0
- package/dist/runtime/interactive-resource-service.d.ts +11 -0
- package/dist/runtime/interactive-resource-service.d.ts.map +1 -0
- package/dist/runtime/interactive-resource-service.js +3 -0
- package/dist/runtime/interactive-resource-service.js.map +1 -0
- package/dist/runtime/plugin-inventory-entry.d.ts +5 -0
- package/dist/runtime/plugin-inventory-entry.d.ts.map +1 -0
- package/dist/runtime/plugin-inventory-entry.js +18 -0
- package/dist/runtime/plugin-inventory-entry.js.map +1 -0
- package/dist/runtime/plugin-inventory-service.d.ts +8 -0
- package/dist/runtime/plugin-inventory-service.d.ts.map +1 -0
- package/dist/runtime/plugin-inventory-service.js +3 -0
- package/dist/runtime/plugin-inventory-service.js.map +1 -0
- package/dist/runtime/plugin-manager-entry.d.ts +20 -0
- package/dist/runtime/plugin-manager-entry.d.ts.map +1 -0
- package/dist/runtime/plugin-manager-entry.js +96 -0
- package/dist/runtime/plugin-manager-entry.js.map +1 -0
- package/dist/runtime/plugin-observability-entry.d.ts +12 -0
- package/dist/runtime/plugin-observability-entry.d.ts.map +1 -0
- package/dist/runtime/plugin-observability-entry.js +73 -0
- package/dist/runtime/plugin-observability-entry.js.map +1 -0
- package/dist/runtime/product-host.d.ts +91 -0
- package/dist/runtime/product-host.d.ts.map +1 -0
- package/dist/runtime/product-host.js +529 -0
- package/dist/runtime/product-host.js.map +1 -0
- package/dist/runtime/session-factory.d.ts +17 -0
- package/dist/runtime/session-factory.d.ts.map +1 -0
- package/dist/runtime/session-factory.js +75 -0
- package/dist/runtime/session-factory.js.map +1 -0
- package/dist/runtime/session-host.d.ts +152 -0
- package/dist/runtime/session-host.d.ts.map +1 -0
- package/dist/runtime/session-host.js +895 -0
- package/dist/runtime/session-host.js.map +1 -0
- package/dist/runtime-core-entry.d.ts +11 -0
- package/dist/runtime-core-entry.d.ts.map +1 -0
- package/dist/runtime-core-entry.js +9 -0
- package/dist/runtime-core-entry.js.map +1 -0
- package/dist/session-factory-entry.d.ts +7 -0
- package/dist/session-factory-entry.d.ts.map +1 -0
- package/dist/session-factory-entry.js +9 -0
- package/dist/session-factory-entry.js.map +1 -0
- package/dist/session-store-jsonl-entry.d.ts +7 -0
- package/dist/session-store-jsonl-entry.d.ts.map +1 -0
- package/dist/session-store-jsonl-entry.js +33 -0
- package/dist/session-store-jsonl-entry.js.map +1 -0
- package/dist/startup.d.ts +12 -1
- package/dist/startup.d.ts.map +1 -1
- package/dist/startup.js +106 -15
- package/dist/startup.js.map +1 -1
- package/dist/subagents/index.d.ts +2 -0
- package/dist/subagents/index.d.ts.map +1 -0
- package/dist/subagents/index.js +2 -0
- package/dist/subagents/index.js.map +1 -0
- package/dist/subagents/service.d.ts +50 -0
- package/dist/subagents/service.d.ts.map +1 -0
- package/dist/subagents/service.js +521 -0
- package/dist/subagents/service.js.map +1 -0
- package/dist/ui-host.d.ts +125 -0
- package/dist/ui-host.d.ts.map +1 -0
- package/dist/ui-host.js +275 -0
- package/dist/ui-host.js.map +1 -0
- package/dist/web/assets/index-BwfuGMvv.css +1 -0
- package/dist/web/assets/index-DPUaJqFJ.js +41 -0
- package/dist/web/assets/index-DPUaJqFJ.js.map +1 -0
- package/dist/web/index.html +14 -0
- package/dist/web-command.d.ts +11 -0
- package/dist/web-command.d.ts.map +1 -0
- package/dist/web-command.js +114 -0
- package/dist/web-command.js.map +1 -0
- package/dist/web-frontend.d.ts +73 -0
- package/dist/web-frontend.d.ts.map +1 -0
- package/dist/web-frontend.js +249 -0
- package/dist/web-frontend.js.map +1 -0
- package/dist/web.d.ts +254 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +740 -0
- package/dist/web.js.map +1 -0
- package/dist/webui-entry.d.ts +3 -0
- package/dist/webui-entry.d.ts.map +1 -0
- package/dist/webui-entry.js +73 -0
- package/dist/webui-entry.js.map +1 -0
- package/dist/webui.d.ts +91 -0
- package/dist/webui.d.ts.map +1 -0
- package/dist/webui.js +882 -0
- package/dist/webui.js.map +1 -0
- package/package.json +89 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/core/tools/edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpF,OAAO,EAAuC,IAAI,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAa,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,qBAAqB,EAAE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,CAAC,iCAAiC,UAAU,CAAC,IAAI,EAAE;gCACpD,CAAC,CAAC,yBAAyB,eAAe,CAAC,MAAM,gBAAgB,UAAU,CAAC,IAAI,GAAG;yBACpF;qBAC6B;oBAC/B,OAAO,EAAE;wBACR,IAAI,EAAE,OAAO,CAAC,IAAI;wBAClB,KAAK,EAAE,oBAAoB,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC;wBACrE,GAAG,CAAC,OAAO,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC;qBACjG;iBACD,CAAC;YACH,CAAC,CAAC,CAAC;QACJ,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { readFile as fsReadFile, writeFile as fsWriteFile } from \"node:fs/promises\";\nimport type { AgentTool, ToolExecutionResult } from \"@di-code/agent\";\nimport { type Static, type ToolResultContent, Type } from \"@di-code/ai\";\nimport { applyEditsToContent, type Edit, generateDiffString, generateUnifiedPatch } from \"./edit-diff.ts\";\nimport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nimport { resolveAllowedFilePath } from \"./path-boundary.ts\";\n\nconst editItemParameters = Type.Object({\n\toldText: Type.String(),\n\tnewText: Type.String(),\n});\n\nexport const editParameters = Type.Object({\n\tpath: Type.String({ minLength: 1 }),\n\tedits: Type.Optional(Type.Array(editItemParameters, { minItems: 1 })),\n\t// Compatibility with the original di-code single-edit contract.\n\toldText: Type.Optional(Type.String()),\n\tnewText: Type.Optional(Type.String()),\n});\n\nexport type EditParameters = Static<typeof editParameters>;\n\nexport interface EditOperations {\n\treadFile(filePath: string): Promise<Buffer>;\n\twriteFile(filePath: string, content: string): Promise<void>;\n}\n\nexport interface EditToolOptions {\n\treadonly operations?: EditOperations;\n}\n\nexport interface EditToolDetails {\n\treadonly diff: string;\n\treadonly patch: string;\n\treadonly firstChangedLine?: number;\n}\n\nexport type EditTool = AgentTool<typeof editParameters, ToolExecutionResult<EditToolDetails>>;\n\nconst defaultEditOperations: EditOperations = {\n\tasync readFile(filePath) {\n\t\treturn fsReadFile(filePath);\n\t},\n\tasync writeFile(filePath, content) {\n\t\tawait fsWriteFile(filePath, content, \"utf8\");\n\t},\n};\n\nfunction throwIfAborted(signal: AbortSignal | undefined): void {\n\tif (signal?.aborted) throw new Error(\"Operation aborted\");\n}\n\nfunction normalizeLineEndings(text: string): string {\n\treturn text.replaceAll(\"\\r\\n\", \"\\n\").replaceAll(\"\\r\", \"\\n\");\n}\n\nfunction restoreLineEndings(text: string, ending: \"\\n\" | \"\\r\\n\"): string {\n\treturn ending === \"\\n\" ? text : text.replaceAll(\"\\n\", \"\\r\\n\");\n}\n\nfunction detectLineEnding(text: string): \"\\n\" | \"\\r\\n\" {\n\treturn text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n}\n\nfunction hasUtf8Bom(bytes: Buffer): boolean {\n\treturn bytes.length >= 3 && bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf;\n}\n\nfunction containsNulByte(bytes: Buffer): boolean {\n\tconst sampleLength = Math.min(bytes.length, 8 * 1024);\n\tfor (let index = 0; index < sampleLength; index++) {\n\t\tif (bytes[index] === 0) return true;\n\t}\n\treturn false;\n}\n\nfunction decodeUtf8(bytes: Buffer, path: string): string {\n\tconst text = bytes.toString(\"utf8\");\n\tif (!Buffer.from(text, \"utf8\").equals(bytes)) throw new Error(`File is not valid UTF-8: ${path}`);\n\treturn text;\n}\n\nfunction normalizeEdits(parameters: EditParameters, path: string): Edit[] {\n\tif (parameters.edits) {\n\t\treturn parameters.edits.map((edit) => ({ oldText: edit.oldText, newText: edit.newText }));\n\t}\n\tif (typeof parameters.oldText === \"string\" && typeof parameters.newText === \"string\") {\n\t\treturn [{ oldText: parameters.oldText, newText: parameters.newText }];\n\t}\n\tthrow new Error(`edit requires edits[] or oldText/newText in ${path}`);\n}\n\nfunction legacyError(cause: unknown, path: string, legacy: boolean): never {\n\tif (!legacy || !(cause instanceof Error)) throw cause;\n\tif (cause.message.includes(\"oldText must not be empty\")) throw cause;\n\tif (cause.message.includes(\"Could not find edits[0]\")) {\n\t\tthrow new Error(`Text to replace was not found in ${path}`);\n\t}\n\tif (cause.message.includes(\"Found \") && cause.message.includes(\"occurrences of edits[0]\")) {\n\t\tthrow new Error(`Text to replace is ambiguous in ${path}`);\n\t}\n\tthrow cause;\n}\n\nexport function createEditTool(allowedRoot: string, options: EditToolOptions = {}): EditTool {\n\tconst operations = options.operations ?? defaultEditOperations;\n\n\treturn {\n\t\tname: \"edit\",\n\t\tdescription:\n\t\t\t\"Edit one UTF-8 text file using one or more unique exact replacements in edits[]. Legacy oldText/newText is also accepted.\",\n\t\tparameters: editParameters,\n\t\tasync execute(_toolCallId, parameters, signal): Promise<ToolExecutionResult<EditToolDetails>> {\n\t\t\tthrowIfAborted(signal);\n\t\t\tif (parameters.path.length === 0) throw new Error(\"path must not be empty\");\n\t\t\tif (parameters.edits === undefined && parameters.oldText === \"\") throw new Error(\"oldText must not be empty\");\n\t\t\tconst edits = normalizeEdits(parameters, parameters.path);\n\t\t\tconst legacy = parameters.edits === undefined;\n\t\t\tconst absolutePath = await resolveAllowedFilePath(parameters.path, allowedRoot);\n\n\t\t\treturn withFileMutationQueue(absolutePath, async () => {\n\t\t\t\tthrowIfAborted(signal);\n\t\t\t\tconst originalBytes = await operations.readFile(absolutePath);\n\t\t\t\tthrowIfAborted(signal);\n\t\t\t\tif (containsNulByte(originalBytes)) throw new Error(\"Binary files are not supported by edit\");\n\t\t\t\tconst hasBom = hasUtf8Bom(originalBytes);\n\t\t\t\tconst originalText = decodeUtf8(originalBytes, parameters.path).replace(/^\\uFEFF/, \"\");\n\t\t\t\tconst ending = detectLineEnding(originalText);\n\t\t\t\tconst baseContent = normalizeLineEndings(originalText);\n\t\t\t\tconst normalizedEdits = edits.map((edit) => ({\n\t\t\t\t\toldText: normalizeLineEndings(edit.oldText),\n\t\t\t\t\tnewText: normalizeLineEndings(edit.newText),\n\t\t\t\t}));\n\t\t\t\tlet newContent: string;\n\t\t\t\ttry {\n\t\t\t\t\tnewContent = applyEditsToContent(baseContent, normalizedEdits, parameters.path).newContent;\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tlegacyError(cause, parameters.path, legacy);\n\t\t\t\t}\n\t\t\t\tthrowIfAborted(signal);\n\t\t\t\tconst currentBytes = await operations.readFile(absolutePath);\n\t\t\t\tthrowIfAborted(signal);\n\t\t\t\tif (!currentBytes.equals(originalBytes)) {\n\t\t\t\t\tthrow new Error(`File changed during edit: ${parameters.path}`);\n\t\t\t\t}\n\t\t\t\tawait operations.writeFile(absolutePath, `${hasBom ? \"\\uFEFF\" : \"\"}${restoreLineEndings(newContent, ending)}`);\n\t\t\t\tthrowIfAborted(signal);\n\t\t\t\tconst display = generateDiffString(baseContent, newContent);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: legacy\n\t\t\t\t\t\t\t\t? `Successfully replaced text in ${parameters.path}`\n\t\t\t\t\t\t\t\t: `Successfully replaced ${normalizedEdits.length} block(s) in ${parameters.path}.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t] satisfies ToolResultContent[],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tdiff: display.diff,\n\t\t\t\t\t\tpatch: generateUnifiedPatch(parameters.path, baseContent, newContent),\n\t\t\t\t\t\t...(display.firstChangedLine === undefined ? {} : { firstChangedLine: display.firstChangedLine }),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/core/tools/edit.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"@di-code/builtins\";\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "@di-code/builtins";
|
|
2
2
|
//# sourceMappingURL=file-mutation-queue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-mutation-queue.d.ts","sourceRoot":"","sources":["../../../src/core/tools/file-mutation-queue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-mutation-queue.d.ts","sourceRoot":"","sources":["../../../src/core/tools/file-mutation-queue.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const fileMutationQueues = new Map();
|
|
3
|
-
export async function withFileMutationQueue(filePath, operation) {
|
|
4
|
-
const resolvedPath = resolve(filePath);
|
|
5
|
-
const key = process.platform === "win32" ? resolvedPath.toLowerCase() : resolvedPath;
|
|
6
|
-
const currentQueue = fileMutationQueues.get(key) ?? Promise.resolve();
|
|
7
|
-
let releaseNext;
|
|
8
|
-
const nextQueue = new Promise((resolveQueue) => {
|
|
9
|
-
releaseNext = resolveQueue;
|
|
10
|
-
});
|
|
11
|
-
const chainedQueue = currentQueue.then(() => nextQueue);
|
|
12
|
-
fileMutationQueues.set(key, chainedQueue);
|
|
13
|
-
await currentQueue;
|
|
14
|
-
try {
|
|
15
|
-
return await operation();
|
|
16
|
-
}
|
|
17
|
-
finally {
|
|
18
|
-
releaseNext();
|
|
19
|
-
if (fileMutationQueues.get(key) === chainedQueue) {
|
|
20
|
-
fileMutationQueues.delete(key);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
export * from "@di-code/builtins";
|
|
24
2
|
//# sourceMappingURL=file-mutation-queue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-mutation-queue.js","sourceRoot":"","sources":["../../../src/core/tools/file-mutation-queue.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"file-mutation-queue.js","sourceRoot":"","sources":["../../../src/core/tools/file-mutation-queue.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"@di-code/builtins\";\n"]}
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const DEFAULT_SEARCH_MAX_OUTPUT_BYTES: number;
|
|
3
|
-
export declare const MAX_SEARCH_FILE_BYTES: number;
|
|
4
|
-
export interface SearchFile {
|
|
5
|
-
readonly relativePath: string;
|
|
6
|
-
readonly searchPath: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function assertSearchLimit(name: string, value: number): void;
|
|
9
|
-
export declare function normalizeSearchPattern(pattern: string): string;
|
|
10
|
-
export declare function resolveSearchRoot(inputPath: string | undefined, allowedRoot: string): Promise<string>;
|
|
11
|
-
export declare function walkSearchFiles(rootPath: string, signal?: AbortSignal, displayRootPath?: string): AsyncGenerator<SearchFile, void, undefined>;
|
|
12
|
-
export declare function readSearchText(file: SearchFile, allowedRoot: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
13
|
-
export declare function appendBoundedLine(lines: string[], line: string, maxOutputBytes: number): boolean;
|
|
1
|
+
export * from "@di-code/builtins";
|
|
14
2
|
//# sourceMappingURL=file-search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-search.d.ts","sourceRoot":"","sources":["../../../src/core/tools/file-search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-search.d.ts","sourceRoot":"","sources":["../../../src/core/tools/file-search.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,99 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { basename, matchesGlob, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { resolveAllowedExistingPath } from "./path-boundary.js";
|
|
4
|
-
export const DEFAULT_SEARCH_MAX_RESULTS = 200;
|
|
5
|
-
export const DEFAULT_SEARCH_MAX_OUTPUT_BYTES = 50 * 1024;
|
|
6
|
-
export const MAX_SEARCH_FILE_BYTES = 2 * 1024 * 1024;
|
|
7
|
-
export function assertSearchLimit(name, value) {
|
|
8
|
-
if (!Number.isInteger(value) || value < 1)
|
|
9
|
-
throw new Error(`${name} must be a positive integer`);
|
|
10
|
-
}
|
|
11
|
-
export function normalizeSearchPattern(pattern) {
|
|
12
|
-
const normalized = pattern.replaceAll("\\", "/").trim();
|
|
13
|
-
if (normalized.length === 0)
|
|
14
|
-
throw new Error("pattern must not be empty");
|
|
15
|
-
if (normalized.startsWith("/"))
|
|
16
|
-
throw new Error("pattern must be relative to the allowed root");
|
|
17
|
-
try {
|
|
18
|
-
matchesGlob("placeholder", normalized);
|
|
19
|
-
}
|
|
20
|
-
catch (cause) {
|
|
21
|
-
throw new Error(`Invalid glob pattern: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
22
|
-
}
|
|
23
|
-
return normalized;
|
|
24
|
-
}
|
|
25
|
-
export async function resolveSearchRoot(inputPath, allowedRoot) {
|
|
26
|
-
return resolveAllowedExistingPath(inputPath ?? ".", allowedRoot);
|
|
27
|
-
}
|
|
28
|
-
export async function* walkSearchFiles(rootPath, signal, displayRootPath = rootPath) {
|
|
29
|
-
const traversalRoot = await realpath(rootPath);
|
|
30
|
-
const displayRoot = await realpath(displayRootPath);
|
|
31
|
-
const rootMetadata = await stat(traversalRoot);
|
|
32
|
-
if (rootMetadata.isFile()) {
|
|
33
|
-
yield {
|
|
34
|
-
relativePath: relative(displayRoot, traversalRoot).split(sep).join("/"),
|
|
35
|
-
searchPath: basename(traversalRoot),
|
|
36
|
-
};
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (!rootMetadata.isDirectory())
|
|
40
|
-
throw new Error("Search path must be a file or directory");
|
|
41
|
-
const initialEntries = await readDirectoryEntries(traversalRoot);
|
|
42
|
-
const pending = [{ directory: traversalRoot, entries: initialEntries, index: 0 }];
|
|
43
|
-
while (pending.length > 0) {
|
|
44
|
-
if (signal?.aborted)
|
|
45
|
-
throw new Error("Operation aborted");
|
|
46
|
-
const frame = pending[pending.length - 1];
|
|
47
|
-
if (!frame)
|
|
48
|
-
continue;
|
|
49
|
-
const entry = frame.entries[frame.index++];
|
|
50
|
-
if (!entry) {
|
|
51
|
-
pending.pop();
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
if (entry.isSymbolicLink())
|
|
55
|
-
continue;
|
|
56
|
-
const absolutePath = resolve(frame.directory, entry.name);
|
|
57
|
-
if (entry.isDirectory()) {
|
|
58
|
-
pending.push({ directory: absolutePath, entries: await readDirectoryEntries(absolutePath), index: 0 });
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (!entry.isFile())
|
|
62
|
-
continue;
|
|
63
|
-
const relativePath = relative(displayRoot, absolutePath).split(sep).join("/");
|
|
64
|
-
const searchPath = relative(traversalRoot, absolutePath).split(sep).join("/");
|
|
65
|
-
yield { relativePath, searchPath };
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async function readDirectoryEntries(directory) {
|
|
69
|
-
const entries = await readdir(directory, { withFileTypes: true });
|
|
70
|
-
entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
71
|
-
return entries;
|
|
72
|
-
}
|
|
73
|
-
export async function readSearchText(file, allowedRoot, signal) {
|
|
74
|
-
if (signal?.aborted)
|
|
75
|
-
throw new Error("Operation aborted");
|
|
76
|
-
const safePath = await resolveAllowedExistingPath(file.relativePath, allowedRoot);
|
|
77
|
-
const metadata = await stat(safePath);
|
|
78
|
-
if (!metadata.isFile() || metadata.size > MAX_SEARCH_FILE_BYTES)
|
|
79
|
-
return undefined;
|
|
80
|
-
const buffer = await readFile(safePath);
|
|
81
|
-
if (signal?.aborted)
|
|
82
|
-
throw new Error("Operation aborted");
|
|
83
|
-
const sampleLength = Math.min(buffer.length, 8 * 1024);
|
|
84
|
-
for (let index = 0; index < sampleLength; index++) {
|
|
85
|
-
if (buffer[index] === 0)
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
return buffer.toString("utf8");
|
|
89
|
-
}
|
|
90
|
-
export function appendBoundedLine(lines, line, maxOutputBytes) {
|
|
91
|
-
const separatorBytes = lines.length === 0 ? 0 : 1;
|
|
92
|
-
const nextBytes = Buffer.byteLength(line, "utf8") + separatorBytes;
|
|
93
|
-
const currentBytes = lines.reduce((total, item) => total + Buffer.byteLength(item, "utf8"), 0);
|
|
94
|
-
if (currentBytes + nextBytes > maxOutputBytes)
|
|
95
|
-
return false;
|
|
96
|
-
lines.push(line);
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
1
|
+
export * from "@di-code/builtins";
|
|
99
2
|
//# sourceMappingURL=file-search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-search.js","sourceRoot":"","sources":["../../../src/core/tools/file-search.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"file-search.js","sourceRoot":"","sources":["../../../src/core/tools/file-search.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"@di-code/builtins\";\n"]}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type Static, type ToolResultContent, Type } from "@di-code/ai";
|
|
3
|
-
export declare const globParameters: Type.TObject<{
|
|
4
|
-
pattern: Type.TString;
|
|
5
|
-
path: Type.TOptional<Type.TString>;
|
|
6
|
-
maxResults: Type.TOptional<Type.TInteger>;
|
|
7
|
-
}>;
|
|
8
|
-
export type GlobParameters = Static<typeof globParameters>;
|
|
9
|
-
export type GlobTool = AgentTool<typeof globParameters, ToolResultContent[]>;
|
|
10
|
-
export declare function createGlobTool(allowedRoot: string): GlobTool;
|
|
1
|
+
export * from "@di-code/builtins";
|
|
11
2
|
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/core/tools/glob.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/core/tools/glob.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
package/dist/core/tools/glob.js
CHANGED
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { Type } from "@di-code/ai";
|
|
3
|
-
import { appendBoundedLine, assertSearchLimit, DEFAULT_SEARCH_MAX_OUTPUT_BYTES, DEFAULT_SEARCH_MAX_RESULTS, normalizeSearchPattern, resolveSearchRoot, walkSearchFiles, } from "./file-search.js";
|
|
4
|
-
export const globParameters = Type.Object({
|
|
5
|
-
pattern: Type.String({ minLength: 1 }),
|
|
6
|
-
path: Type.Optional(Type.String({ minLength: 1 })),
|
|
7
|
-
maxResults: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
8
|
-
});
|
|
9
|
-
export function createGlobTool(allowedRoot) {
|
|
10
|
-
return {
|
|
11
|
-
name: "glob",
|
|
12
|
-
description: "Find files inside the allowed root using a glob pattern such as **/*.ts. Returns sorted relative paths; symlinks are skipped.",
|
|
13
|
-
parameters: globParameters,
|
|
14
|
-
async execute(_toolCallId, parameters, signal) {
|
|
15
|
-
if (signal?.aborted)
|
|
16
|
-
throw new Error("Operation aborted");
|
|
17
|
-
if (parameters.path !== undefined && parameters.path.length === 0)
|
|
18
|
-
throw new Error("path must not be empty");
|
|
19
|
-
const pattern = normalizeSearchPattern(parameters.pattern);
|
|
20
|
-
const maxResults = parameters.maxResults ?? DEFAULT_SEARCH_MAX_RESULTS;
|
|
21
|
-
assertSearchLimit("maxResults", maxResults);
|
|
22
|
-
const root = await resolveSearchRoot(parameters.path, allowedRoot);
|
|
23
|
-
const displayRoot = await resolveSearchRoot(undefined, allowedRoot);
|
|
24
|
-
const lines = [];
|
|
25
|
-
let matched = 0;
|
|
26
|
-
let truncated = false;
|
|
27
|
-
for await (const file of walkSearchFiles(root, signal, displayRoot)) {
|
|
28
|
-
if (!matchesGlob(file.searchPath, pattern))
|
|
29
|
-
continue;
|
|
30
|
-
matched++;
|
|
31
|
-
if (matched > maxResults || !appendBoundedLine(lines, file.relativePath, DEFAULT_SEARCH_MAX_OUTPUT_BYTES)) {
|
|
32
|
-
truncated = true;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (lines.length === 0)
|
|
37
|
-
return [{ type: "text", text: "No files matched." }];
|
|
38
|
-
if (truncated)
|
|
39
|
-
lines.push(`[Results truncated at ${maxResults} matches or 50 KiB.]`);
|
|
40
|
-
return [{ type: "text", text: lines.join("\n") }];
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
1
|
+
export * from "@di-code/builtins";
|
|
44
2
|
//# sourceMappingURL=glob.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/core/tools/glob.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/core/tools/glob.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"@di-code/builtins\";\n"]}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type Static, type ToolResultContent, Type } from "@di-code/ai";
|
|
3
|
-
export declare const grepParameters: Type.TObject<{
|
|
4
|
-
pattern: Type.TString;
|
|
5
|
-
path: Type.TOptional<Type.TString>;
|
|
6
|
-
include: Type.TOptional<Type.TString>;
|
|
7
|
-
caseSensitive: Type.TOptional<Type.TBoolean>;
|
|
8
|
-
maxResults: Type.TOptional<Type.TInteger>;
|
|
9
|
-
}>;
|
|
10
|
-
export type GrepParameters = Static<typeof grepParameters>;
|
|
11
|
-
export type GrepTool = AgentTool<typeof grepParameters, ToolResultContent[]>;
|
|
12
|
-
export declare function createGrepTool(allowedRoot: string): GrepTool;
|
|
1
|
+
export * from "@di-code/builtins";
|
|
13
2
|
//# sourceMappingURL=grep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../src/core/tools/grep.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../src/core/tools/grep.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
package/dist/core/tools/grep.js
CHANGED
|
@@ -1,67 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { Type } from "@di-code/ai";
|
|
3
|
-
import { appendBoundedLine, assertSearchLimit, DEFAULT_SEARCH_MAX_OUTPUT_BYTES, DEFAULT_SEARCH_MAX_RESULTS, normalizeSearchPattern, readSearchText, resolveSearchRoot, walkSearchFiles, } from "./file-search.js";
|
|
4
|
-
export const grepParameters = Type.Object({
|
|
5
|
-
pattern: Type.String({ minLength: 1, maxLength: 1_000 }),
|
|
6
|
-
path: Type.Optional(Type.String({ minLength: 1 })),
|
|
7
|
-
include: Type.Optional(Type.String({ minLength: 1 })),
|
|
8
|
-
caseSensitive: Type.Optional(Type.Boolean()),
|
|
9
|
-
maxResults: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
10
|
-
});
|
|
11
|
-
export function createGrepTool(allowedRoot) {
|
|
12
|
-
return {
|
|
13
|
-
name: "grep",
|
|
14
|
-
description: "Search UTF-8 text files inside the allowed root for a literal string. Returns sorted path:line matches; binary files and symlinks are skipped.",
|
|
15
|
-
parameters: grepParameters,
|
|
16
|
-
async execute(_toolCallId, parameters, signal) {
|
|
17
|
-
if (signal?.aborted)
|
|
18
|
-
throw new Error("Operation aborted");
|
|
19
|
-
if (parameters.pattern.length === 0)
|
|
20
|
-
throw new Error("pattern must not be empty");
|
|
21
|
-
if (parameters.pattern.length > 1_000)
|
|
22
|
-
throw new Error("pattern must not exceed 1000 characters");
|
|
23
|
-
if (parameters.path !== undefined && parameters.path.length === 0)
|
|
24
|
-
throw new Error("path must not be empty");
|
|
25
|
-
const include = parameters.include === undefined ? undefined : normalizeSearchPattern(parameters.include);
|
|
26
|
-
const maxResults = parameters.maxResults ?? DEFAULT_SEARCH_MAX_RESULTS;
|
|
27
|
-
assertSearchLimit("maxResults", maxResults);
|
|
28
|
-
const root = await resolveSearchRoot(parameters.path, allowedRoot);
|
|
29
|
-
const displayRoot = await resolveSearchRoot(undefined, allowedRoot);
|
|
30
|
-
const needle = parameters.caseSensitive === false ? parameters.pattern.toLocaleLowerCase() : parameters.pattern;
|
|
31
|
-
const lines = [];
|
|
32
|
-
let matched = 0;
|
|
33
|
-
let truncated = false;
|
|
34
|
-
for await (const file of walkSearchFiles(root, signal, displayRoot)) {
|
|
35
|
-
if (include !== undefined && !matchesInclude(file.searchPath, include))
|
|
36
|
-
continue;
|
|
37
|
-
const text = await readSearchText(file, allowedRoot, signal);
|
|
38
|
-
if (text === undefined)
|
|
39
|
-
continue;
|
|
40
|
-
const fileLines = text.split("\n");
|
|
41
|
-
for (let index = 0; index < fileLines.length; index++) {
|
|
42
|
-
const line = fileLines[index] ?? "";
|
|
43
|
-
const haystack = parameters.caseSensitive === false ? line.toLocaleLowerCase() : line;
|
|
44
|
-
if (!haystack.includes(needle))
|
|
45
|
-
continue;
|
|
46
|
-
matched++;
|
|
47
|
-
if (matched > maxResults ||
|
|
48
|
-
!appendBoundedLine(lines, `${file.relativePath}:${index + 1}: ${line}`, DEFAULT_SEARCH_MAX_OUTPUT_BYTES)) {
|
|
49
|
-
truncated = true;
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (truncated)
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
if (lines.length === 0)
|
|
57
|
-
return [{ type: "text", text: "No matches found." }];
|
|
58
|
-
if (truncated)
|
|
59
|
-
lines.push(`[Results truncated at ${maxResults} matches or 50 KiB.]`);
|
|
60
|
-
return [{ type: "text", text: lines.join("\n") }];
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function matchesInclude(relativePath, pattern) {
|
|
65
|
-
return matchesGlob(relativePath, pattern);
|
|
66
|
-
}
|
|
1
|
+
export * from "@di-code/builtins";
|
|
67
2
|
//# sourceMappingURL=grep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../src/core/tools/grep.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../src/core/tools/grep.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"@di-code/builtins\";\n"]}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type Static, type ToolResultContent, Type } from "@di-code/ai";
|
|
3
|
-
import type { SkillCatalog } from "@di-code/skills";
|
|
4
|
-
export declare const loadSkillParameters: Type.TObject<{
|
|
5
|
-
name: Type.TString;
|
|
6
|
-
}>;
|
|
7
|
-
export type LoadSkillParameters = Static<typeof loadSkillParameters>;
|
|
8
|
-
export type LoadSkillTool = AgentTool<typeof loadSkillParameters, ToolResultContent[]>;
|
|
9
|
-
export declare function createLoadSkillTool(catalog: SkillCatalog): LoadSkillTool;
|
|
1
|
+
export * from "@di-code/builtins";
|
|
10
2
|
//# sourceMappingURL=load-skill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-skill.d.ts","sourceRoot":"","sources":["../../../src/core/tools/load-skill.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"load-skill.d.ts","sourceRoot":"","sources":["../../../src/core/tools/load-skill.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { readSkillContent } from "@di-code/skills";
|
|
3
|
-
export const loadSkillParameters = Type.Object({
|
|
4
|
-
name: Type.String({ minLength: 1 }),
|
|
5
|
-
});
|
|
6
|
-
export function createLoadSkillTool(catalog) {
|
|
7
|
-
return {
|
|
8
|
-
name: "load_skill",
|
|
9
|
-
description: "Load the untrusted instructions for a registered skill by name.",
|
|
10
|
-
parameters: loadSkillParameters,
|
|
11
|
-
async execute(_toolCallId, parameters, signal) {
|
|
12
|
-
if (signal?.aborted)
|
|
13
|
-
throw new Error("Operation aborted");
|
|
14
|
-
const skill = catalog.resolve(parameters.name);
|
|
15
|
-
if (!skill || skill.disableModelInvocation)
|
|
16
|
-
throw new Error(`Unknown or unavailable skill "${parameters.name}".`);
|
|
17
|
-
const content = await readSkillContent(skill, signal);
|
|
18
|
-
return [{ type: "text", text: `<skill name="${skill.name}" source="${skill.source}">\n${content}\n</skill>` }];
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|
|
1
|
+
export * from "@di-code/builtins";
|
|
22
2
|
//# sourceMappingURL=load-skill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-skill.js","sourceRoot":"","sources":["../../../src/core/tools/load-skill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load-skill.js","sourceRoot":"","sources":["../../../src/core/tools/load-skill.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"@di-code/builtins\";\n"]}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function resolveAllowedFilePath(inputPath: string, allowedRoot: string): Promise<string>;
|
|
3
|
-
/** Resolve an existing file or directory while enforcing the realpath root boundary. */
|
|
4
|
-
export declare function resolveAllowedExistingPath(inputPath: string, allowedRoot: string): Promise<string>;
|
|
1
|
+
export * from "@di-code/builtins";
|
|
5
2
|
//# sourceMappingURL=path-boundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-boundary.d.ts","sourceRoot":"","sources":["../../../src/core/tools/path-boundary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path-boundary.d.ts","sourceRoot":"","sources":["../../../src/core/tools/path-boundary.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,66 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
|
-
function assertInsideRoot(root, target) {
|
|
4
|
-
const fromRoot = relative(root, target);
|
|
5
|
-
if (fromRoot === "" || (fromRoot !== ".." && !fromRoot.startsWith(`..${sep}`) && !isAbsolute(fromRoot))) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
throw new Error("Path is outside the allowed root");
|
|
9
|
-
}
|
|
10
|
-
function isMissingPathError(error) {
|
|
11
|
-
return (typeof error === "object" &&
|
|
12
|
-
error !== null &&
|
|
13
|
-
"code" in error &&
|
|
14
|
-
(error.code === "ENOENT" || error.code === "ENOTDIR"));
|
|
15
|
-
}
|
|
16
|
-
export async function resolveAllowedMutationPath(inputPath, allowedRoot) {
|
|
17
|
-
const rootReal = await realpath(allowedRoot);
|
|
18
|
-
const candidate = resolve(rootReal, inputPath);
|
|
19
|
-
assertInsideRoot(rootReal, candidate);
|
|
20
|
-
const missingSegments = [];
|
|
21
|
-
let current = candidate;
|
|
22
|
-
while (true) {
|
|
23
|
-
try {
|
|
24
|
-
const currentReal = await realpath(current);
|
|
25
|
-
assertInsideRoot(rootReal, currentReal);
|
|
26
|
-
const target = resolve(currentReal, ...missingSegments.reverse());
|
|
27
|
-
assertInsideRoot(rootReal, target);
|
|
28
|
-
return target;
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
if (!isMissingPathError(error))
|
|
32
|
-
throw error;
|
|
33
|
-
let entryExists = false;
|
|
34
|
-
try {
|
|
35
|
-
const entry = await lstat(current);
|
|
36
|
-
if (entry.isSymbolicLink())
|
|
37
|
-
throw new Error("Path is outside the allowed root");
|
|
38
|
-
entryExists = true;
|
|
39
|
-
}
|
|
40
|
-
catch (entryError) {
|
|
41
|
-
if (!isMissingPathError(entryError))
|
|
42
|
-
throw entryError;
|
|
43
|
-
}
|
|
44
|
-
if (entryExists)
|
|
45
|
-
continue;
|
|
46
|
-
const parent = dirname(current);
|
|
47
|
-
if (parent === current)
|
|
48
|
-
throw error;
|
|
49
|
-
missingSegments.push(basename(current));
|
|
50
|
-
current = parent;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
export async function resolveAllowedFilePath(inputPath, allowedRoot) {
|
|
55
|
-
return resolveAllowedExistingPath(inputPath, allowedRoot);
|
|
56
|
-
}
|
|
57
|
-
/** Resolve an existing file or directory while enforcing the realpath root boundary. */
|
|
58
|
-
export async function resolveAllowedExistingPath(inputPath, allowedRoot) {
|
|
59
|
-
const rootReal = await realpath(allowedRoot);
|
|
60
|
-
const candidate = resolve(rootReal, inputPath);
|
|
61
|
-
assertInsideRoot(rootReal, candidate);
|
|
62
|
-
const targetReal = await realpath(candidate);
|
|
63
|
-
assertInsideRoot(rootReal, targetReal);
|
|
64
|
-
return targetReal;
|
|
65
|
-
}
|
|
1
|
+
export * from "@di-code/builtins";
|
|
66
2
|
//# sourceMappingURL=path-boundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-boundary.js","sourceRoot":"","sources":["../../../src/core/tools/path-boundary.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"path-boundary.js","sourceRoot":"","sources":["../../../src/core/tools/path-boundary.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"@di-code/builtins\";\n"]}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type Static, type ToolResultContent, Type } from "@di-code/ai";
|
|
3
|
-
export declare const DEFAULT_READ_MAX_LINES = 2000;
|
|
4
|
-
export declare const DEFAULT_READ_MAX_BYTES: number;
|
|
5
|
-
export declare const readParameters: Type.TObject<{
|
|
6
|
-
path: Type.TString;
|
|
7
|
-
offset: Type.TOptional<Type.TInteger>;
|
|
8
|
-
limit: Type.TOptional<Type.TInteger>;
|
|
9
|
-
}>;
|
|
10
|
-
export type ReadParameters = Static<typeof readParameters>;
|
|
11
|
-
export interface ReadToolOptions {
|
|
12
|
-
readonly maxLines?: number;
|
|
13
|
-
readonly maxBytes?: number;
|
|
14
|
-
}
|
|
15
|
-
export type ReadTool = AgentTool<typeof readParameters, ToolResultContent[]>;
|
|
16
|
-
export declare function createReadTool(allowedRoot: string, options?: ReadToolOptions): ReadTool;
|
|
1
|
+
export * from "@di-code/builtins";
|
|
17
2
|
//# sourceMappingURL=read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/core/tools/read.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/core/tools/read.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|