@morphllm/morphsdk 0.2.199 → 0.2.200
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/dist/{chunk-GTV27THY.js → chunk-3CCWSLQW.js} +2 -2
- package/dist/{chunk-DP2PT36G.js → chunk-7I2A7GGJ.js} +2 -2
- package/dist/{chunk-CEXBKXWU.js → chunk-AKSXZBPT.js} +3 -3
- package/dist/{chunk-GKRPR5PZ.js → chunk-B4X5RWLR.js} +18 -69
- package/dist/chunk-B4X5RWLR.js.map +1 -0
- package/dist/{chunk-PKJ7ODTG.js → chunk-L6YOMTFU.js} +3 -3
- package/dist/{chunk-OPNTDMHH.js → chunk-LN7GNFET.js} +4 -4
- package/dist/{chunk-KXEPBLVD.js → chunk-MLROWLS6.js} +10 -10
- package/dist/{chunk-PW6K6OJL.js → chunk-MPL6BDR6.js} +2 -2
- package/dist/{chunk-ZHB57ORD.js → chunk-PD3EDFQD.js} +6 -6
- package/dist/{chunk-5KQ2WRBU.js → chunk-PJNL35DC.js} +2 -2
- package/dist/{chunk-UT3NQLCF.js → chunk-Q65LL6UM.js} +2 -2
- package/dist/{chunk-W37OFBSG.js → chunk-QTBFL4DG.js} +2 -2
- package/dist/{chunk-BLCCGRKT.js → chunk-SNYHVDE4.js} +4 -4
- package/dist/{chunk-O7LJEVZO.js → chunk-TIMDDHYB.js} +4 -4
- package/dist/{chunk-Q3NH3NPD.js → chunk-UHIANNKC.js} +4 -4
- package/dist/{chunk-7UU4NF4G.js → chunk-UKAAT6KT.js} +4 -4
- package/dist/{chunk-JOC3ZI56.js → chunk-UZ42MHTR.js} +3 -37
- package/dist/chunk-UZ42MHTR.js.map +1 -0
- package/dist/{chunk-YSFEKIYQ.js → chunk-WTENYKJP.js} +2 -2
- package/dist/{chunk-BTMMUG3E.js → chunk-XTLPA7ZP.js} +2 -2
- package/dist/{chunk-ULHHMZRL.js → chunk-Z57GJLCG.js} +3 -3
- package/dist/{chunk-WDBYAXZ5.js → chunk-ZE64EWUV.js} +2 -2
- package/dist/{client-CGW0Cevz.d.ts → client-BWhi-vSj.d.ts} +4 -65
- package/dist/client.cjs +45 -411
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +2 -4
- package/dist/client.js +22 -27
- package/dist/core/client.cjs +2 -36
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.js +4 -4
- package/dist/core/error.cjs +2 -36
- package/dist/core/error.cjs.map +1 -1
- package/dist/core/error.js +3 -3
- package/dist/core/index.cjs +2 -36
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +4 -4
- package/dist/edge.cjs +2 -36
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +7 -7
- package/dist/index.cjs +48 -416
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +26 -34
- package/dist/modelrouter/core.cjs +2 -36
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +5 -5
- package/dist/modelrouter/index.cjs +2 -36
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +5 -5
- package/dist/subagents/anthropic.cjs +2 -36
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.d.ts +1 -1
- package/dist/subagents/anthropic.js +11 -11
- package/dist/subagents/index.d.ts +1 -1
- package/dist/subagents/prompts.d.ts +1 -1
- package/dist/subagents/types.d.ts +1 -1
- package/dist/subagents/vercel.cjs +2 -36
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.d.ts +1 -1
- package/dist/subagents/vercel.js +11 -11
- package/dist/tools/compact/core.cjs +2 -36
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.js +5 -5
- package/dist/tools/compact/index.cjs +2 -36
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.js +6 -6
- package/dist/tools/fastapply/anthropic.cjs +2 -36
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +7 -7
- package/dist/tools/fastapply/apply.cjs +2 -36
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +2 -36
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +6 -6
- package/dist/tools/fastapply/index.cjs +2 -36
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +12 -12
- package/dist/tools/fastapply/openai.cjs +2 -36
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +7 -7
- package/dist/tools/fastapply/vercel.cjs +2 -36
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +7 -7
- package/dist/tools/index.cjs +2 -36
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +12 -12
- package/dist/tools/utils/resilience.cjs +2 -36
- package/dist/tools/utils/resilience.cjs.map +1 -1
- package/dist/tools/utils/resilience.js +2 -2
- package/dist/tools/warp_grep/agent/runner.cjs +2 -36
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +3 -3
- package/dist/tools/warp_grep/anthropic.cjs +2 -36
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +1 -1
- package/dist/tools/warp_grep/anthropic.js +11 -11
- package/dist/tools/warp_grep/client.cjs +2 -36
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.d.ts +1 -1
- package/dist/tools/warp_grep/client.js +10 -10
- package/dist/tools/warp_grep/gemini.cjs +2 -36
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.d.ts +1 -1
- package/dist/tools/warp_grep/gemini.js +10 -10
- package/dist/tools/warp_grep/harness.js +9 -9
- package/dist/tools/warp_grep/index.cjs +2 -36
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +1 -1
- package/dist/tools/warp_grep/index.js +16 -16
- package/dist/tools/warp_grep/openai.cjs +2 -36
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +1 -1
- package/dist/tools/warp_grep/openai.js +11 -11
- package/dist/tools/warp_grep/providers/code_storage_http.d.ts +1 -1
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/providers/remote.d.ts +1 -1
- package/dist/tools/warp_grep/vercel.cjs +2 -36
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +1 -1
- package/dist/tools/warp_grep/vercel.js +11 -11
- package/dist/{types-qwD753FR.d.ts → types-DxZLPogx.d.ts} +1 -1
- package/dist/version.cjs +2 -36
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -36
- package/dist/chunk-EMURAU6J.js +0 -148
- package/dist/chunk-EMURAU6J.js.map +0 -1
- package/dist/chunk-GKRPR5PZ.js.map +0 -1
- package/dist/chunk-IDMKQWQG.js +0 -214
- package/dist/chunk-IDMKQWQG.js.map +0 -1
- package/dist/chunk-JOC3ZI56.js.map +0 -1
- package/dist/chunk-K2JR2NFQ.js +0 -128
- package/dist/chunk-K2JR2NFQ.js.map +0 -1
- package/dist/chunk-MEZTHMB2.js +0 -83
- package/dist/chunk-MEZTHMB2.js.map +0 -1
- package/dist/chunk-RL3ZTXT3.js +0 -58
- package/dist/chunk-RL3ZTXT3.js.map +0 -1
- package/dist/chunk-TLXVGE4R.js +0 -42
- package/dist/chunk-TLXVGE4R.js.map +0 -1
- package/dist/chunk-VS5F2ORN.js +0 -97
- package/dist/chunk-VS5F2ORN.js.map +0 -1
- package/dist/chunk-YQMPVJ2L.js +0 -32
- package/dist/chunk-YQMPVJ2L.js.map +0 -1
- package/dist/otel-CG0uqXjp.d.ts +0 -42
- package/dist/tools/codebase_search/anthropic.cjs +0 -664
- package/dist/tools/codebase_search/anthropic.cjs.map +0 -1
- package/dist/tools/codebase_search/anthropic.d.ts +0 -40
- package/dist/tools/codebase_search/anthropic.js +0 -16
- package/dist/tools/codebase_search/anthropic.js.map +0 -1
- package/dist/tools/codebase_search/core.cjs +0 -606
- package/dist/tools/codebase_search/core.cjs.map +0 -1
- package/dist/tools/codebase_search/core.d.ts +0 -51
- package/dist/tools/codebase_search/core.js +0 -16
- package/dist/tools/codebase_search/core.js.map +0 -1
- package/dist/tools/codebase_search/index.cjs +0 -789
- package/dist/tools/codebase_search/index.cjs.map +0 -1
- package/dist/tools/codebase_search/index.d.ts +0 -12
- package/dist/tools/codebase_search/index.js +0 -32
- package/dist/tools/codebase_search/index.js.map +0 -1
- package/dist/tools/codebase_search/openai.cjs +0 -713
- package/dist/tools/codebase_search/openai.cjs.map +0 -1
- package/dist/tools/codebase_search/openai.d.ts +0 -87
- package/dist/tools/codebase_search/openai.js +0 -26
- package/dist/tools/codebase_search/openai.js.map +0 -1
- package/dist/tools/codebase_search/prompts.cjs +0 -57
- package/dist/tools/codebase_search/prompts.cjs.map +0 -1
- package/dist/tools/codebase_search/prompts.d.ts +0 -7
- package/dist/tools/codebase_search/prompts.js +0 -10
- package/dist/tools/codebase_search/prompts.js.map +0 -1
- package/dist/tools/codebase_search/types.cjs +0 -19
- package/dist/tools/codebase_search/types.cjs.map +0 -1
- package/dist/tools/codebase_search/types.d.ts +0 -50
- package/dist/tools/codebase_search/types.js +0 -1
- package/dist/tools/codebase_search/types.js.map +0 -1
- package/dist/tools/codebase_search/vercel.cjs +0 -626
- package/dist/tools/codebase_search/vercel.cjs.map +0 -1
- package/dist/tools/codebase_search/vercel.d.ts +0 -65
- package/dist/tools/codebase_search/vercel.js +0 -20
- package/dist/tools/codebase_search/vercel.js.map +0 -1
- package/dist/tracing/core.cjs +0 -410
- package/dist/tracing/core.cjs.map +0 -1
- package/dist/tracing/core.d.ts +0 -58
- package/dist/tracing/core.js +0 -12
- package/dist/tracing/core.js.map +0 -1
- package/dist/tracing/index.cjs +0 -422
- package/dist/tracing/index.cjs.map +0 -1
- package/dist/tracing/index.d.ts +0 -5
- package/dist/tracing/index.js +0 -17
- package/dist/tracing/index.js.map +0 -1
- package/dist/tracing/interaction.cjs +0 -273
- package/dist/tracing/interaction.cjs.map +0 -1
- package/dist/tracing/interaction.d.ts +0 -41
- package/dist/tracing/interaction.js +0 -11
- package/dist/tracing/interaction.js.map +0 -1
- package/dist/tracing/otel.cjs +0 -56
- package/dist/tracing/otel.cjs.map +0 -1
- package/dist/tracing/otel.d.ts +0 -2
- package/dist/tracing/otel.js +0 -10
- package/dist/tracing/otel.js.map +0 -1
- package/dist/tracing/types.cjs +0 -19
- package/dist/tracing/types.cjs.map +0 -1
- package/dist/tracing/types.d.ts +0 -124
- package/dist/tracing/types.js +0 -1
- package/dist/tracing/types.js.map +0 -1
- /package/dist/{chunk-GTV27THY.js.map → chunk-3CCWSLQW.js.map} +0 -0
- /package/dist/{chunk-DP2PT36G.js.map → chunk-7I2A7GGJ.js.map} +0 -0
- /package/dist/{chunk-CEXBKXWU.js.map → chunk-AKSXZBPT.js.map} +0 -0
- /package/dist/{chunk-PKJ7ODTG.js.map → chunk-L6YOMTFU.js.map} +0 -0
- /package/dist/{chunk-OPNTDMHH.js.map → chunk-LN7GNFET.js.map} +0 -0
- /package/dist/{chunk-KXEPBLVD.js.map → chunk-MLROWLS6.js.map} +0 -0
- /package/dist/{chunk-PW6K6OJL.js.map → chunk-MPL6BDR6.js.map} +0 -0
- /package/dist/{chunk-ZHB57ORD.js.map → chunk-PD3EDFQD.js.map} +0 -0
- /package/dist/{chunk-5KQ2WRBU.js.map → chunk-PJNL35DC.js.map} +0 -0
- /package/dist/{chunk-UT3NQLCF.js.map → chunk-Q65LL6UM.js.map} +0 -0
- /package/dist/{chunk-W37OFBSG.js.map → chunk-QTBFL4DG.js.map} +0 -0
- /package/dist/{chunk-BLCCGRKT.js.map → chunk-SNYHVDE4.js.map} +0 -0
- /package/dist/{chunk-O7LJEVZO.js.map → chunk-TIMDDHYB.js.map} +0 -0
- /package/dist/{chunk-Q3NH3NPD.js.map → chunk-UHIANNKC.js.map} +0 -0
- /package/dist/{chunk-7UU4NF4G.js.map → chunk-UKAAT6KT.js.map} +0 -0
- /package/dist/{chunk-YSFEKIYQ.js.map → chunk-WTENYKJP.js.map} +0 -0
- /package/dist/{chunk-BTMMUG3E.js.map → chunk-XTLPA7ZP.js.map} +0 -0
- /package/dist/{chunk-ULHHMZRL.js.map → chunk-Z57GJLCG.js.map} +0 -0
- /package/dist/{chunk-WDBYAXZ5.js.map → chunk-ZE64EWUV.js.map} +0 -0
package/dist/client.cjs
CHANGED
|
@@ -36,7 +36,7 @@ var init_package = __esm({
|
|
|
36
36
|
"package.json"() {
|
|
37
37
|
package_default = {
|
|
38
38
|
name: "@morphllm/morphsdk",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.200",
|
|
40
40
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
41
41
|
type: "module",
|
|
42
42
|
main: "./dist/index.cjs",
|
|
@@ -93,16 +93,6 @@ var init_package = __esm({
|
|
|
93
93
|
import: "./dist/tools/warp_grep/harness.js",
|
|
94
94
|
require: "./dist/tools/warp_grep/harness.cjs"
|
|
95
95
|
},
|
|
96
|
-
"./tracing": {
|
|
97
|
-
types: "./dist/tracing/index.d.ts",
|
|
98
|
-
import: "./dist/tracing/index.js",
|
|
99
|
-
require: "./dist/tracing/index.cjs"
|
|
100
|
-
},
|
|
101
|
-
"./tracing/otel": {
|
|
102
|
-
types: "./dist/tracing/otel.d.ts",
|
|
103
|
-
import: "./dist/tracing/otel.js",
|
|
104
|
-
require: "./dist/tracing/otel.cjs"
|
|
105
|
-
},
|
|
106
96
|
"./tools/fastapply": {
|
|
107
97
|
types: "./dist/tools/fastapply/index.d.ts",
|
|
108
98
|
import: "./dist/tools/fastapply/index.js",
|
|
@@ -123,26 +113,6 @@ var init_package = __esm({
|
|
|
123
113
|
import: "./dist/tools/fastapply/vercel.js",
|
|
124
114
|
require: "./dist/tools/fastapply/vercel.cjs"
|
|
125
115
|
},
|
|
126
|
-
"./tools/codebase-search": {
|
|
127
|
-
types: "./dist/tools/codebase_search/index.d.ts",
|
|
128
|
-
import: "./dist/tools/codebase_search/index.js",
|
|
129
|
-
require: "./dist/tools/codebase_search/index.cjs"
|
|
130
|
-
},
|
|
131
|
-
"./tools/codebase-search/anthropic": {
|
|
132
|
-
types: "./dist/tools/codebase_search/anthropic.d.ts",
|
|
133
|
-
import: "./dist/tools/codebase_search/anthropic.js",
|
|
134
|
-
require: "./dist/tools/codebase_search/anthropic.cjs"
|
|
135
|
-
},
|
|
136
|
-
"./tools/codebase-search/openai": {
|
|
137
|
-
types: "./dist/tools/codebase_search/openai.d.ts",
|
|
138
|
-
import: "./dist/tools/codebase_search/openai.js",
|
|
139
|
-
require: "./dist/tools/codebase_search/openai.cjs"
|
|
140
|
-
},
|
|
141
|
-
"./tools/codebase-search/vercel": {
|
|
142
|
-
types: "./dist/tools/codebase_search/vercel.d.ts",
|
|
143
|
-
import: "./dist/tools/codebase_search/vercel.js",
|
|
144
|
-
require: "./dist/tools/codebase_search/vercel.cjs"
|
|
145
|
-
},
|
|
146
116
|
"./modelrouter": {
|
|
147
117
|
types: "./dist/modelrouter/index.d.ts",
|
|
148
118
|
import: "./dist/modelrouter/index.js",
|
|
@@ -183,7 +153,7 @@ var init_package = __esm({
|
|
|
183
153
|
"!dist/**/*.test.*"
|
|
184
154
|
],
|
|
185
155
|
scripts: {
|
|
186
|
-
build: "tsup version.ts index.ts edge.ts client.ts core/index.ts core/client.ts core/resource.ts core/error.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/
|
|
156
|
+
build: "tsup version.ts index.ts edge.ts client.ts core/index.ts core/client.ts core/resource.ts core/error.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve && tsup ai-sdk/index.ts --format esm,cjs --sourcemap --dts --no-clean --out-dir dist/ai-sdk",
|
|
187
157
|
prepare: "npm run build",
|
|
188
158
|
typecheck: "tsc --noEmit && tsc --noEmit -p ai-sdk/tsconfig.json",
|
|
189
159
|
lint: "eslint .",
|
|
@@ -212,10 +182,6 @@ var init_package = __esm({
|
|
|
212
182
|
},
|
|
213
183
|
license: "MIT",
|
|
214
184
|
dependencies: {
|
|
215
|
-
"@opentelemetry/api": "^1.9.0",
|
|
216
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
|
|
217
|
-
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
218
|
-
"@traceloop/node-server-sdk": "^0.27.0",
|
|
219
185
|
"@vscode/ripgrep": "^1.17.0",
|
|
220
186
|
ai: ">=5.0.0",
|
|
221
187
|
diff: "^7.0.0",
|
|
@@ -1678,86 +1644,6 @@ async function executeEditFile(input, config = {}) {
|
|
|
1678
1644
|
}
|
|
1679
1645
|
}
|
|
1680
1646
|
|
|
1681
|
-
// tools/codebase_search/core.ts
|
|
1682
|
-
init_logger();
|
|
1683
|
-
var DEFAULT_TIMEOUT3 = 3e4;
|
|
1684
|
-
var emptyStats = { totalResults: 0, candidatesRetrieved: 0, searchTimeMs: 0 };
|
|
1685
|
-
async function runSearch(client, input, repoId, timeout, baseURL) {
|
|
1686
|
-
const startTime = Date.now();
|
|
1687
|
-
logger.debug("CodebaseSearch", "request", { query: input.query.slice(0, 100), repo_id: repoId });
|
|
1688
|
-
try {
|
|
1689
|
-
const data = await client.post(
|
|
1690
|
-
"/v1/codebase_search",
|
|
1691
|
-
{
|
|
1692
|
-
baseURL: baseURL ?? client.reposURL,
|
|
1693
|
-
timeout,
|
|
1694
|
-
body: {
|
|
1695
|
-
query: input.query,
|
|
1696
|
-
repoId,
|
|
1697
|
-
targetDirectories: input.target_directories || [],
|
|
1698
|
-
limit: input.limit || 10,
|
|
1699
|
-
candidateLimit: 50
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
);
|
|
1703
|
-
const elapsed = Date.now() - startTime;
|
|
1704
|
-
logger.debug("CodebaseSearch", "response", { results_count: data.results?.length || 0, latency_ms: elapsed });
|
|
1705
|
-
return {
|
|
1706
|
-
success: true,
|
|
1707
|
-
results: data.results || [],
|
|
1708
|
-
stats: data.stats || { totalResults: 0, candidatesRetrieved: 0, searchTimeMs: elapsed }
|
|
1709
|
-
};
|
|
1710
|
-
} catch (error) {
|
|
1711
|
-
const message = error instanceof MorphError && error.statusCode ? `Search failed (${error.statusCode}): ${error.message}` : error instanceof Error ? error.message : "Unknown error";
|
|
1712
|
-
logger.error("CodebaseSearch", "error", { error: message, latency_ms: Date.now() - startTime });
|
|
1713
|
-
return { success: false, results: [], stats: { ...emptyStats }, error: message };
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
var CodebaseSearchClient = class extends APIResource {
|
|
1717
|
-
timeout;
|
|
1718
|
-
constructor(clientOrConfig = {}) {
|
|
1719
|
-
super(
|
|
1720
|
-
clientOrConfig instanceof MorphAPIClient ? clientOrConfig : new MorphAPIClient({
|
|
1721
|
-
apiKey: clientOrConfig.apiKey,
|
|
1722
|
-
timeout: clientOrConfig.timeout ?? DEFAULT_TIMEOUT3,
|
|
1723
|
-
retryConfig: clientOrConfig.retryConfig,
|
|
1724
|
-
debug: clientOrConfig.debug
|
|
1725
|
-
})
|
|
1726
|
-
);
|
|
1727
|
-
this.timeout = (clientOrConfig instanceof MorphAPIClient ? void 0 : clientOrConfig.timeout) ?? DEFAULT_TIMEOUT3;
|
|
1728
|
-
}
|
|
1729
|
-
/**
|
|
1730
|
-
* Execute a semantic code search
|
|
1731
|
-
*
|
|
1732
|
-
* @param input - Search parameters including query, repoId, and target directories
|
|
1733
|
-
* @param overrides - Optional config overrides for this operation
|
|
1734
|
-
* @returns Search results with ranked code matches
|
|
1735
|
-
*/
|
|
1736
|
-
async search(input, overrides) {
|
|
1737
|
-
return runSearch(
|
|
1738
|
-
this._client,
|
|
1739
|
-
{ query: input.query, target_directories: input.target_directories, explanation: input.explanation, limit: input.limit },
|
|
1740
|
-
input.repoId,
|
|
1741
|
-
overrides?.timeout ?? this.timeout,
|
|
1742
|
-
overrides?.searchUrl
|
|
1743
|
-
);
|
|
1744
|
-
}
|
|
1745
|
-
};
|
|
1746
|
-
async function executeCodebaseSearch(input, config) {
|
|
1747
|
-
const apiKey = config.apiKey || process.env.MORPH_API_KEY;
|
|
1748
|
-
if (!apiKey) {
|
|
1749
|
-
throw new Error("MORPH_API_KEY not found. Set environment variable or pass in config");
|
|
1750
|
-
}
|
|
1751
|
-
const client = new MorphAPIClient({
|
|
1752
|
-
apiKey,
|
|
1753
|
-
reposURL: config.searchUrl,
|
|
1754
|
-
timeout: config.timeout ?? DEFAULT_TIMEOUT3,
|
|
1755
|
-
retryConfig: config.retryConfig,
|
|
1756
|
-
debug: config.debug
|
|
1757
|
-
});
|
|
1758
|
-
return runSearch(client, input, config.repoId, config.timeout ?? DEFAULT_TIMEOUT3, config.searchUrl);
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
1647
|
// tools/warp_grep/agent/runner.ts
|
|
1762
1648
|
init_config();
|
|
1763
1649
|
|
|
@@ -2731,13 +2617,13 @@ function parseGitHubUrl(input) {
|
|
|
2731
2617
|
|
|
2732
2618
|
// tools/compact/core.ts
|
|
2733
2619
|
var DEFAULT_API_URL3 = "https://api.morphllm.com";
|
|
2734
|
-
var
|
|
2620
|
+
var DEFAULT_TIMEOUT3 = 12e4;
|
|
2735
2621
|
function resolveClient(clientOrConfig) {
|
|
2736
2622
|
if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;
|
|
2737
2623
|
return new MorphAPIClient({
|
|
2738
2624
|
apiKey: clientOrConfig.morphApiKey,
|
|
2739
2625
|
baseURL: clientOrConfig.morphApiUrl ?? DEFAULT_API_URL3,
|
|
2740
|
-
timeout: clientOrConfig.timeout ??
|
|
2626
|
+
timeout: clientOrConfig.timeout ?? DEFAULT_TIMEOUT3,
|
|
2741
2627
|
retryConfig: clientOrConfig.retryConfig,
|
|
2742
2628
|
debug: clientOrConfig.debug
|
|
2743
2629
|
});
|
|
@@ -2750,7 +2636,7 @@ var CompactClient = class extends APIResource {
|
|
|
2750
2636
|
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
2751
2637
|
this.config = {
|
|
2752
2638
|
morphApiUrl: this._client.baseURL,
|
|
2753
|
-
timeout: cfg.timeout ??
|
|
2639
|
+
timeout: cfg.timeout ?? DEFAULT_TIMEOUT3,
|
|
2754
2640
|
debug: cfg.debug ?? false
|
|
2755
2641
|
};
|
|
2756
2642
|
}
|
|
@@ -3120,13 +3006,13 @@ function formatResult(result) {
|
|
|
3120
3006
|
// modelrouter/core.ts
|
|
3121
3007
|
init_logger();
|
|
3122
3008
|
var DEFAULT_API_URL4 = "https://api.morphllm.com";
|
|
3123
|
-
var
|
|
3009
|
+
var DEFAULT_TIMEOUT4 = 5e3;
|
|
3124
3010
|
function resolveClient2(clientOrConfig) {
|
|
3125
3011
|
if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;
|
|
3126
3012
|
return new MorphAPIClient({
|
|
3127
3013
|
apiKey: clientOrConfig.apiKey,
|
|
3128
3014
|
baseURL: clientOrConfig.apiUrl ?? DEFAULT_API_URL4,
|
|
3129
|
-
timeout: clientOrConfig.timeout ??
|
|
3015
|
+
timeout: clientOrConfig.timeout ?? DEFAULT_TIMEOUT4,
|
|
3130
3016
|
retryConfig: clientOrConfig.retryConfig,
|
|
3131
3017
|
debug: clientOrConfig.debug
|
|
3132
3018
|
});
|
|
@@ -3138,7 +3024,7 @@ var BaseRouter = class extends APIResource {
|
|
|
3138
3024
|
super(resolveClient2(clientOrConfig));
|
|
3139
3025
|
this.provider = provider;
|
|
3140
3026
|
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
3141
|
-
this.timeout = cfg.timeout ??
|
|
3027
|
+
this.timeout = cfg.timeout ?? DEFAULT_TIMEOUT4;
|
|
3142
3028
|
}
|
|
3143
3029
|
/** Throw the historical "API key is required" message when no key is resolvable. */
|
|
3144
3030
|
requireApiKey() {
|
|
@@ -3244,7 +3130,7 @@ var RouterClassifier = class extends APIResource {
|
|
|
3244
3130
|
constructor(clientOrConfig = {}) {
|
|
3245
3131
|
super(resolveClient2(clientOrConfig));
|
|
3246
3132
|
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
3247
|
-
this.timeout = cfg.timeout ??
|
|
3133
|
+
this.timeout = cfg.timeout ?? DEFAULT_TIMEOUT4;
|
|
3248
3134
|
}
|
|
3249
3135
|
/** Classify an input across the requested axes (all three by default). */
|
|
3250
3136
|
async classify(input) {
|
|
@@ -3302,7 +3188,7 @@ var TOOL_PARAMETERS = {
|
|
|
3302
3188
|
required: ["search_term"]
|
|
3303
3189
|
};
|
|
3304
3190
|
function createWarpGrepTool(config) {
|
|
3305
|
-
const
|
|
3191
|
+
const tool4 = {
|
|
3306
3192
|
type: "function",
|
|
3307
3193
|
function: {
|
|
3308
3194
|
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
@@ -3310,7 +3196,7 @@ function createWarpGrepTool(config) {
|
|
|
3310
3196
|
parameters: TOOL_PARAMETERS
|
|
3311
3197
|
}
|
|
3312
3198
|
};
|
|
3313
|
-
return Object.assign(
|
|
3199
|
+
return Object.assign(tool4, {
|
|
3314
3200
|
execute: async (input) => {
|
|
3315
3201
|
return executeToolCall(input, config);
|
|
3316
3202
|
},
|
|
@@ -3321,7 +3207,7 @@ function createWarpGrepTool(config) {
|
|
|
3321
3207
|
}
|
|
3322
3208
|
function createGitHubSearchTool(config) {
|
|
3323
3209
|
const client = new WarpGrepClient(config);
|
|
3324
|
-
const
|
|
3210
|
+
const tool4 = {
|
|
3325
3211
|
type: "function",
|
|
3326
3212
|
function: {
|
|
3327
3213
|
name: GITHUB_SEARCH_TOOL_NAME,
|
|
@@ -3329,7 +3215,7 @@ function createGitHubSearchTool(config) {
|
|
|
3329
3215
|
parameters: GITHUB_SEARCH_INPUT_SCHEMA
|
|
3330
3216
|
}
|
|
3331
3217
|
};
|
|
3332
|
-
return Object.assign(
|
|
3218
|
+
return Object.assign(tool4, {
|
|
3333
3219
|
execute: async (input) => {
|
|
3334
3220
|
const github = input.github_url || input.owner_repo;
|
|
3335
3221
|
if (!github) {
|
|
@@ -3343,107 +3229,6 @@ function createGitHubSearchTool(config) {
|
|
|
3343
3229
|
});
|
|
3344
3230
|
}
|
|
3345
3231
|
|
|
3346
|
-
// tools/codebase_search/prompts.ts
|
|
3347
|
-
var CODEBASE_SEARCH_DESCRIPTION = `Semantic search that finds code by meaning, not exact text.
|
|
3348
|
-
|
|
3349
|
-
Use this to explore unfamiliar codebases or ask "how/where/what" questions:
|
|
3350
|
-
- "How does X work?" - Find implementation details
|
|
3351
|
-
- "Where is Y handled?" - Locate specific functionality
|
|
3352
|
-
- "What happens when Z?" - Understand flow
|
|
3353
|
-
|
|
3354
|
-
The tool uses two-stage retrieval (embedding similarity + reranking) to find the most semantically relevant code chunks.
|
|
3355
|
-
|
|
3356
|
-
Returns code chunks with file paths, line ranges, and full content ranked by relevance.`;
|
|
3357
|
-
var CODEBASE_SEARCH_SYSTEM_PROMPT = `You have access to the codebase_search tool that performs semantic code search.
|
|
3358
|
-
|
|
3359
|
-
When searching:
|
|
3360
|
-
- Use natural language queries describing what you're looking for
|
|
3361
|
-
- Be specific about functionality, not variable names
|
|
3362
|
-
- Use target_directories to narrow search if you know the area
|
|
3363
|
-
- Results are ranked by relevance (rerank score is most important)
|
|
3364
|
-
|
|
3365
|
-
The tool returns:
|
|
3366
|
-
- File paths with symbol names (e.g. "src/auth.ts::AuthService@L1-L17")
|
|
3367
|
-
- Line ranges for precise navigation
|
|
3368
|
-
- Full code content for each match
|
|
3369
|
-
- Dual relevance scores: embedding similarity + rerank score
|
|
3370
|
-
|
|
3371
|
-
Use results to understand code or answer questions. The content is provided in full - avoid re-reading unless you need more context.`;
|
|
3372
|
-
|
|
3373
|
-
// tools/codebase_search/openai.ts
|
|
3374
|
-
function createCodebaseSearchTool(config) {
|
|
3375
|
-
const toolDefinition = {
|
|
3376
|
-
type: "function",
|
|
3377
|
-
function: {
|
|
3378
|
-
name: "codebase_search",
|
|
3379
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
3380
|
-
parameters: {
|
|
3381
|
-
type: "object",
|
|
3382
|
-
properties: {
|
|
3383
|
-
query: {
|
|
3384
|
-
type: "string",
|
|
3385
|
-
description: 'A complete question about what you want to understand. Ask as if talking to a colleague: "How does X work?", "What happens when Y?", "Where is Z handled?"'
|
|
3386
|
-
},
|
|
3387
|
-
target_directories: {
|
|
3388
|
-
type: "array",
|
|
3389
|
-
items: { type: "string" },
|
|
3390
|
-
description: "Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo."
|
|
3391
|
-
},
|
|
3392
|
-
explanation: {
|
|
3393
|
-
type: "string",
|
|
3394
|
-
description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal."
|
|
3395
|
-
},
|
|
3396
|
-
limit: {
|
|
3397
|
-
type: "number",
|
|
3398
|
-
description: "Maximum results to return (default: 10)"
|
|
3399
|
-
}
|
|
3400
|
-
},
|
|
3401
|
-
required: ["query", "target_directories", "explanation"]
|
|
3402
|
-
}
|
|
3403
|
-
}
|
|
3404
|
-
};
|
|
3405
|
-
return Object.assign(toolDefinition, {
|
|
3406
|
-
execute: async (input) => {
|
|
3407
|
-
const parsedInput = typeof input === "string" ? JSON.parse(input) : input;
|
|
3408
|
-
return executeCodebaseSearch(parsedInput, config);
|
|
3409
|
-
},
|
|
3410
|
-
formatResult: (result) => {
|
|
3411
|
-
return formatResult2(result);
|
|
3412
|
-
},
|
|
3413
|
-
getSystemPrompt: () => {
|
|
3414
|
-
return CODEBASE_SEARCH_SYSTEM_PROMPT;
|
|
3415
|
-
}
|
|
3416
|
-
});
|
|
3417
|
-
}
|
|
3418
|
-
function formatResult2(result) {
|
|
3419
|
-
if (!result.success) {
|
|
3420
|
-
return `Search failed: ${result.error}`;
|
|
3421
|
-
}
|
|
3422
|
-
if (result.results.length === 0) {
|
|
3423
|
-
return "No matching code found. Try rephrasing your query or removing directory filters.";
|
|
3424
|
-
}
|
|
3425
|
-
const lines = [];
|
|
3426
|
-
lines.push(`Found ${result.results.length} relevant code sections (${result.stats.searchTimeMs}ms):
|
|
3427
|
-
`);
|
|
3428
|
-
result.results.forEach((r, i) => {
|
|
3429
|
-
const relevance = (r.rerankScore * 100).toFixed(1);
|
|
3430
|
-
lines.push(`${i + 1}. ${r.filepath} (${relevance}% relevant)`);
|
|
3431
|
-
lines.push(` Symbol: ${r.symbolPath}`);
|
|
3432
|
-
lines.push(` Language: ${r.language}`);
|
|
3433
|
-
lines.push(` Lines: ${r.startLine}-${r.endLine}`);
|
|
3434
|
-
lines.push(` Code:`);
|
|
3435
|
-
const codeLines = r.content.split("\n");
|
|
3436
|
-
codeLines.slice(0, Math.min(codeLines.length, 20)).forEach((line) => {
|
|
3437
|
-
lines.push(` ${line}`);
|
|
3438
|
-
});
|
|
3439
|
-
if (codeLines.length > 20) {
|
|
3440
|
-
lines.push(` ... (${codeLines.length - 20} more lines)`);
|
|
3441
|
-
}
|
|
3442
|
-
lines.push("");
|
|
3443
|
-
});
|
|
3444
|
-
return lines.join("\n");
|
|
3445
|
-
}
|
|
3446
|
-
|
|
3447
3232
|
// tools/fastapply/prompts.ts
|
|
3448
3233
|
var EDIT_FILE_TOOL_DESCRIPTION = `Use this tool to make an edit to an existing file.
|
|
3449
3234
|
|
|
@@ -3514,7 +3299,7 @@ async function execute(input, config) {
|
|
|
3514
3299
|
function getSystemPrompt() {
|
|
3515
3300
|
return EDIT_FILE_SYSTEM_PROMPT;
|
|
3516
3301
|
}
|
|
3517
|
-
function
|
|
3302
|
+
function formatResult2(result) {
|
|
3518
3303
|
if (!result.success) {
|
|
3519
3304
|
return `Error editing file: ${result.error}`;
|
|
3520
3305
|
}
|
|
@@ -3537,7 +3322,7 @@ function createEditFileTool(config = {}) {
|
|
|
3537
3322
|
return execute(parsedInput, config);
|
|
3538
3323
|
},
|
|
3539
3324
|
formatResult: (result) => {
|
|
3540
|
-
return
|
|
3325
|
+
return formatResult2(result);
|
|
3541
3326
|
},
|
|
3542
3327
|
getSystemPrompt: () => {
|
|
3543
3328
|
return getSystemPrompt();
|
|
@@ -3562,18 +3347,6 @@ var OpenAIToolFactory = class {
|
|
|
3562
3347
|
morphApiKey: this.config.apiKey
|
|
3563
3348
|
});
|
|
3564
3349
|
}
|
|
3565
|
-
/**
|
|
3566
|
-
* Create an OpenAI-compatible codebase search tool
|
|
3567
|
-
*
|
|
3568
|
-
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
3569
|
-
* @returns OpenAI ChatCompletionTool with execute and formatResult methods
|
|
3570
|
-
*/
|
|
3571
|
-
createCodebaseSearchTool(toolConfig) {
|
|
3572
|
-
return createCodebaseSearchTool({
|
|
3573
|
-
...toolConfig,
|
|
3574
|
-
apiKey: this.config.apiKey
|
|
3575
|
-
});
|
|
3576
|
-
}
|
|
3577
3350
|
/**
|
|
3578
3351
|
* Create an OpenAI-compatible edit file tool
|
|
3579
3352
|
*
|
|
@@ -3609,12 +3382,12 @@ var INPUT_SCHEMA = {
|
|
|
3609
3382
|
required: ["search_term"]
|
|
3610
3383
|
};
|
|
3611
3384
|
function createWarpGrepTool2(config) {
|
|
3612
|
-
const
|
|
3385
|
+
const tool4 = {
|
|
3613
3386
|
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
3614
3387
|
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
3615
3388
|
input_schema: INPUT_SCHEMA
|
|
3616
3389
|
};
|
|
3617
|
-
return Object.assign(
|
|
3390
|
+
return Object.assign(tool4, {
|
|
3618
3391
|
execute: async (input) => {
|
|
3619
3392
|
return executeToolCall(input, config);
|
|
3620
3393
|
},
|
|
@@ -3625,12 +3398,12 @@ function createWarpGrepTool2(config) {
|
|
|
3625
3398
|
}
|
|
3626
3399
|
function createGitHubSearchTool2(config) {
|
|
3627
3400
|
const client = new WarpGrepClient(config);
|
|
3628
|
-
const
|
|
3401
|
+
const tool4 = {
|
|
3629
3402
|
name: GITHUB_SEARCH_TOOL_NAME,
|
|
3630
3403
|
description: GITHUB_SEARCH_DESCRIPTION,
|
|
3631
3404
|
input_schema: GITHUB_SEARCH_INPUT_SCHEMA
|
|
3632
3405
|
};
|
|
3633
|
-
return Object.assign(
|
|
3406
|
+
return Object.assign(tool4, {
|
|
3634
3407
|
execute: async (input) => {
|
|
3635
3408
|
const github = input.github_url || input.owner_repo;
|
|
3636
3409
|
if (!github) {
|
|
@@ -3644,77 +3417,6 @@ function createGitHubSearchTool2(config) {
|
|
|
3644
3417
|
});
|
|
3645
3418
|
}
|
|
3646
3419
|
|
|
3647
|
-
// tools/codebase_search/anthropic.ts
|
|
3648
|
-
function createCodebaseSearchTool2(config) {
|
|
3649
|
-
const toolDefinition = {
|
|
3650
|
-
name: "codebase_search",
|
|
3651
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
3652
|
-
input_schema: {
|
|
3653
|
-
type: "object",
|
|
3654
|
-
properties: {
|
|
3655
|
-
explanation: {
|
|
3656
|
-
type: "string",
|
|
3657
|
-
description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal."
|
|
3658
|
-
},
|
|
3659
|
-
query: {
|
|
3660
|
-
type: "string",
|
|
3661
|
-
description: 'A complete question about what you want to understand. Ask as if talking to a colleague: "How does X work?", "What happens when Y?", "Where is Z handled?"'
|
|
3662
|
-
},
|
|
3663
|
-
target_directories: {
|
|
3664
|
-
type: "array",
|
|
3665
|
-
items: { type: "string" },
|
|
3666
|
-
description: "Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo."
|
|
3667
|
-
},
|
|
3668
|
-
limit: {
|
|
3669
|
-
type: "number",
|
|
3670
|
-
description: "Maximum results to return (default: 10)"
|
|
3671
|
-
}
|
|
3672
|
-
},
|
|
3673
|
-
required: ["query", "target_directories", "explanation"]
|
|
3674
|
-
},
|
|
3675
|
-
cache_control: { type: "ephemeral" }
|
|
3676
|
-
};
|
|
3677
|
-
return Object.assign(toolDefinition, {
|
|
3678
|
-
execute: async (input) => {
|
|
3679
|
-
return executeCodebaseSearch(input, config);
|
|
3680
|
-
},
|
|
3681
|
-
formatResult: (result) => {
|
|
3682
|
-
return formatResult4(result);
|
|
3683
|
-
},
|
|
3684
|
-
getSystemPrompt: () => {
|
|
3685
|
-
return CODEBASE_SEARCH_SYSTEM_PROMPT;
|
|
3686
|
-
}
|
|
3687
|
-
});
|
|
3688
|
-
}
|
|
3689
|
-
function formatResult4(result) {
|
|
3690
|
-
if (!result.success) {
|
|
3691
|
-
return `Search failed: ${result.error}`;
|
|
3692
|
-
}
|
|
3693
|
-
if (result.results.length === 0) {
|
|
3694
|
-
return "No matching code found. Try rephrasing your query or broadening the search scope.";
|
|
3695
|
-
}
|
|
3696
|
-
const lines = [];
|
|
3697
|
-
lines.push(`Found ${result.results.length} relevant code sections (searched ${result.stats.candidatesRetrieved} candidates in ${result.stats.searchTimeMs}ms):
|
|
3698
|
-
`);
|
|
3699
|
-
result.results.forEach((r, i) => {
|
|
3700
|
-
const relevance = (r.rerankScore * 100).toFixed(1);
|
|
3701
|
-
lines.push(`${i + 1}. ${r.filepath} (${relevance}% relevant)`);
|
|
3702
|
-
lines.push(` Symbol: ${r.symbolPath}`);
|
|
3703
|
-
lines.push(` Language: ${r.language}`);
|
|
3704
|
-
lines.push(` Lines: ${r.startLine}-${r.endLine}`);
|
|
3705
|
-
lines.push(` Code:`);
|
|
3706
|
-
const codeLines = r.content.split("\n");
|
|
3707
|
-
codeLines.slice(0, Math.min(codeLines.length, 20)).forEach((line) => {
|
|
3708
|
-
lines.push(` ${line}`);
|
|
3709
|
-
});
|
|
3710
|
-
if (codeLines.length > 20) {
|
|
3711
|
-
lines.push(` ... (${codeLines.length - 20} more lines)`);
|
|
3712
|
-
}
|
|
3713
|
-
lines.push("");
|
|
3714
|
-
});
|
|
3715
|
-
return lines.join("\n");
|
|
3716
|
-
}
|
|
3717
|
-
|
|
3718
3420
|
// tools/fastapply/anthropic.ts
|
|
3719
3421
|
var editFileTool2 = {
|
|
3720
3422
|
name: "edit_file",
|
|
@@ -3738,7 +3440,7 @@ var editFileTool2 = {
|
|
|
3738
3440
|
required: ["target_filepath", "instruction", "code_edit"]
|
|
3739
3441
|
}
|
|
3740
3442
|
};
|
|
3741
|
-
function
|
|
3443
|
+
function formatResult3(result) {
|
|
3742
3444
|
if (!result.success) {
|
|
3743
3445
|
return `Error editing file: ${result.error}`;
|
|
3744
3446
|
}
|
|
@@ -3755,7 +3457,7 @@ function createEditFileTool2(config = {}) {
|
|
|
3755
3457
|
return executeEditFile(input, config);
|
|
3756
3458
|
},
|
|
3757
3459
|
formatResult: (result) => {
|
|
3758
|
-
return
|
|
3460
|
+
return formatResult3(result);
|
|
3759
3461
|
},
|
|
3760
3462
|
getSystemPrompt: () => {
|
|
3761
3463
|
return EDIT_FILE_SYSTEM_PROMPT;
|
|
@@ -4121,18 +3823,6 @@ var AnthropicToolFactory = class {
|
|
|
4121
3823
|
morphApiKey: this.config.apiKey
|
|
4122
3824
|
});
|
|
4123
3825
|
}
|
|
4124
|
-
/**
|
|
4125
|
-
* Create an Anthropic-compatible codebase search tool
|
|
4126
|
-
*
|
|
4127
|
-
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
4128
|
-
* @returns Anthropic Tool with execute and formatResult methods
|
|
4129
|
-
*/
|
|
4130
|
-
createCodebaseSearchTool(toolConfig) {
|
|
4131
|
-
return createCodebaseSearchTool2({
|
|
4132
|
-
...toolConfig,
|
|
4133
|
-
apiKey: this.config.apiKey
|
|
4134
|
-
});
|
|
4135
|
-
}
|
|
4136
3826
|
/**
|
|
4137
3827
|
* Create an Anthropic-compatible edit file tool
|
|
4138
3828
|
*
|
|
@@ -4234,56 +3924,15 @@ function createGitHubSearchTool3(config) {
|
|
|
4234
3924
|
});
|
|
4235
3925
|
}
|
|
4236
3926
|
|
|
4237
|
-
// tools/
|
|
3927
|
+
// tools/fastapply/vercel.ts
|
|
4238
3928
|
var import_ai2 = require("ai");
|
|
4239
3929
|
var import_zod2 = require("zod");
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
explanation: import_zod2.z.string().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal."),
|
|
4245
|
-
limit: import_zod2.z.number().optional().describe("Max results to return (default: 10)")
|
|
4246
|
-
});
|
|
4247
|
-
return (0, import_ai2.tool)({
|
|
4248
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
4249
|
-
inputSchema: schema,
|
|
4250
|
-
execute: async (params) => {
|
|
4251
|
-
const { query, target_directories, explanation, limit } = params;
|
|
4252
|
-
const result = await executeCodebaseSearch(
|
|
4253
|
-
{ query, target_directories, explanation, limit },
|
|
4254
|
-
config
|
|
4255
|
-
);
|
|
4256
|
-
if (!result.success) {
|
|
4257
|
-
return {
|
|
4258
|
-
error: result.error,
|
|
4259
|
-
results: []
|
|
4260
|
-
};
|
|
4261
|
-
}
|
|
4262
|
-
return {
|
|
4263
|
-
found: result.results.length,
|
|
4264
|
-
searchTime: `${result.stats.searchTimeMs}ms`,
|
|
4265
|
-
results: result.results.map((r) => ({
|
|
4266
|
-
file: r.filepath,
|
|
4267
|
-
symbol: r.symbolPath,
|
|
4268
|
-
lines: `${r.startLine}-${r.endLine}`,
|
|
4269
|
-
language: r.language,
|
|
4270
|
-
relevance: `${(r.rerankScore * 100).toFixed(1)}%`,
|
|
4271
|
-
code: r.content
|
|
4272
|
-
}))
|
|
4273
|
-
};
|
|
4274
|
-
}
|
|
4275
|
-
});
|
|
4276
|
-
}
|
|
4277
|
-
|
|
4278
|
-
// tools/fastapply/vercel.ts
|
|
4279
|
-
var import_ai3 = require("ai");
|
|
4280
|
-
var import_zod3 = require("zod");
|
|
4281
|
-
var editFileSchema = import_zod3.z.object({
|
|
4282
|
-
target_filepath: import_zod3.z.string().describe("The path of the target file to modify"),
|
|
4283
|
-
instruction: import_zod3.z.string().describe("A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit."),
|
|
4284
|
-
code_edit: import_zod3.z.string().describe("Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections.")
|
|
3930
|
+
var editFileSchema = import_zod2.z.object({
|
|
3931
|
+
target_filepath: import_zod2.z.string().describe("The path of the target file to modify"),
|
|
3932
|
+
instruction: import_zod2.z.string().describe("A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit."),
|
|
3933
|
+
code_edit: import_zod2.z.string().describe("Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections.")
|
|
4285
3934
|
});
|
|
4286
|
-
var editFileTool3 = (0,
|
|
3935
|
+
var editFileTool3 = (0, import_ai2.tool)({
|
|
4287
3936
|
description: EDIT_FILE_TOOL_DESCRIPTION,
|
|
4288
3937
|
inputSchema: editFileSchema,
|
|
4289
3938
|
execute: async (params) => {
|
|
@@ -4304,12 +3953,12 @@ var editFileTool3 = (0, import_ai3.tool)({
|
|
|
4304
3953
|
}
|
|
4305
3954
|
});
|
|
4306
3955
|
function createEditFileTool3(config = {}) {
|
|
4307
|
-
const schema =
|
|
4308
|
-
target_filepath:
|
|
4309
|
-
instruction:
|
|
4310
|
-
code_edit:
|
|
3956
|
+
const schema = import_zod2.z.object({
|
|
3957
|
+
target_filepath: import_zod2.z.string().describe("The path of the target file to modify"),
|
|
3958
|
+
instruction: import_zod2.z.string().describe("A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit."),
|
|
3959
|
+
code_edit: import_zod2.z.string().describe("Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections.")
|
|
4311
3960
|
});
|
|
4312
|
-
return (0,
|
|
3961
|
+
return (0, import_ai2.tool)({
|
|
4313
3962
|
description: config.description || EDIT_FILE_TOOL_DESCRIPTION,
|
|
4314
3963
|
inputSchema: schema,
|
|
4315
3964
|
execute: async (params) => {
|
|
@@ -4335,8 +3984,8 @@ function createEditFileTool3(config = {}) {
|
|
|
4335
3984
|
}
|
|
4336
3985
|
|
|
4337
3986
|
// subagents/vercel.ts
|
|
4338
|
-
var
|
|
4339
|
-
var
|
|
3987
|
+
var import_ai3 = require("ai");
|
|
3988
|
+
var import_zod3 = require("zod");
|
|
4340
3989
|
var DEFAULT_MAX_TURNS2 = {
|
|
4341
3990
|
quick: 3,
|
|
4342
3991
|
medium: 6,
|
|
@@ -4364,18 +4013,18 @@ function createExploreSubagent2(config) {
|
|
|
4364
4013
|
) : null;
|
|
4365
4014
|
const runPromise = (async () => {
|
|
4366
4015
|
try {
|
|
4367
|
-
const codebaseSearchSchema =
|
|
4368
|
-
searchRequest:
|
|
4016
|
+
const codebaseSearchSchema = import_zod3.z.object({
|
|
4017
|
+
searchRequest: import_zod3.z.string().describe("Natural language description of what to search for")
|
|
4369
4018
|
});
|
|
4370
|
-
const sendMessageSchema =
|
|
4371
|
-
message:
|
|
4019
|
+
const sendMessageSchema = import_zod3.z.object({
|
|
4020
|
+
message: import_zod3.z.string().describe("The message to send to the orchestrator")
|
|
4372
4021
|
});
|
|
4373
|
-
const result = await (0,
|
|
4022
|
+
const result = await (0, import_ai3.generateText)({
|
|
4374
4023
|
model: config.model,
|
|
4375
4024
|
system: getSystemPrompt2(thoroughness),
|
|
4376
4025
|
prompt,
|
|
4377
4026
|
tools: {
|
|
4378
|
-
codebase_search: (0,
|
|
4027
|
+
codebase_search: (0, import_ai3.tool)({
|
|
4379
4028
|
description: CODEBASE_SEARCH_TOOL.description,
|
|
4380
4029
|
inputSchema: codebaseSearchSchema,
|
|
4381
4030
|
execute: async (params) => {
|
|
@@ -4398,7 +4047,7 @@ function createExploreSubagent2(config) {
|
|
|
4398
4047
|
return formatResult(warpResult);
|
|
4399
4048
|
}
|
|
4400
4049
|
}),
|
|
4401
|
-
send_message: (0,
|
|
4050
|
+
send_message: (0, import_ai3.tool)({
|
|
4402
4051
|
description: SEND_MESSAGE_TOOL.description,
|
|
4403
4052
|
inputSchema: sendMessageSchema,
|
|
4404
4053
|
execute: async (params) => {
|
|
@@ -4429,7 +4078,7 @@ function createExploreSubagent2(config) {
|
|
|
4429
4078
|
}
|
|
4430
4079
|
})
|
|
4431
4080
|
},
|
|
4432
|
-
stopWhen: (0,
|
|
4081
|
+
stopWhen: (0, import_ai3.stepCountIs)(getMaxTurns2(config))
|
|
4433
4082
|
});
|
|
4434
4083
|
callbacks.onStep?.({
|
|
4435
4084
|
step: searchCount,
|
|
@@ -4472,10 +4121,10 @@ function createExploreSubagent2(config) {
|
|
|
4472
4121
|
}
|
|
4473
4122
|
return runPromise;
|
|
4474
4123
|
}
|
|
4475
|
-
const exploreToolSchema =
|
|
4476
|
-
searchRequest:
|
|
4124
|
+
const exploreToolSchema = import_zod3.z.object({
|
|
4125
|
+
searchRequest: import_zod3.z.string().describe("What to explore in the codebase. Be specific about what you want to understand.")
|
|
4477
4126
|
});
|
|
4478
|
-
const exploreTool = (0,
|
|
4127
|
+
const exploreTool = (0, import_ai3.tool)({
|
|
4479
4128
|
description: "Explore a codebase to answer questions about code structure, find implementations, trace call chains, and understand architecture. Returns a summary of findings. Use this for broad exploration rather than pinpoint keyword searches.",
|
|
4480
4129
|
inputSchema: exploreToolSchema,
|
|
4481
4130
|
execute: async (params) => {
|
|
@@ -4602,18 +4251,6 @@ var VercelToolFactory = class {
|
|
|
4602
4251
|
morphApiKey: this.config.apiKey
|
|
4603
4252
|
});
|
|
4604
4253
|
}
|
|
4605
|
-
/**
|
|
4606
|
-
* Create a Vercel AI SDK-compatible codebase search tool
|
|
4607
|
-
*
|
|
4608
|
-
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
4609
|
-
* @returns Vercel AI SDK tool
|
|
4610
|
-
*/
|
|
4611
|
-
createCodebaseSearchTool(toolConfig) {
|
|
4612
|
-
return createCodebaseSearchTool3({
|
|
4613
|
-
...toolConfig,
|
|
4614
|
-
apiKey: this.config.apiKey
|
|
4615
|
-
});
|
|
4616
|
-
}
|
|
4617
4254
|
/**
|
|
4618
4255
|
* Create a Vercel AI SDK-compatible edit file tool
|
|
4619
4256
|
*
|
|
@@ -4658,8 +4295,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
4658
4295
|
config;
|
|
4659
4296
|
/** FastApply tool for editing files with AI-powered merge */
|
|
4660
4297
|
fastApply;
|
|
4661
|
-
/** CodebaseSearch tool for semantic code search */
|
|
4662
|
-
codebaseSearch;
|
|
4663
4298
|
/** WarpGrep tool for fast code search using ripgrep */
|
|
4664
4299
|
warpGrep;
|
|
4665
4300
|
/** Model routers for intelligent model selection */
|
|
@@ -4699,7 +4334,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
4699
4334
|
this.config = config;
|
|
4700
4335
|
logger.debug("MorphClient", "initialized", { debug: !!config.debug, timeout: config.timeout });
|
|
4701
4336
|
this.fastApply = new FastApplyClient(this);
|
|
4702
|
-
this.codebaseSearch = new CodebaseSearchClient(this);
|
|
4703
4337
|
this.warpGrep = new WarpGrepClient(this);
|
|
4704
4338
|
this.routers = {
|
|
4705
4339
|
openai: new OpenAIRouter(this),
|