@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/index.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",
|
|
@@ -1329,7 +1295,6 @@ __export(index_exports, {
|
|
|
1329
1295
|
APIResource: () => APIResource,
|
|
1330
1296
|
AnthropicRouter: () => AnthropicRouter,
|
|
1331
1297
|
AnthropicToolFactory: () => AnthropicToolFactory,
|
|
1332
|
-
CodebaseSearchClient: () => CodebaseSearchClient,
|
|
1333
1298
|
CompactClient: () => CompactClient,
|
|
1334
1299
|
FastApplyAnchorIntegrityError: () => FastApplyAnchorIntegrityError,
|
|
1335
1300
|
FastApplyClient: () => FastApplyClient,
|
|
@@ -1697,86 +1662,6 @@ async function executeEditFile(input, config = {}) {
|
|
|
1697
1662
|
}
|
|
1698
1663
|
}
|
|
1699
1664
|
|
|
1700
|
-
// tools/codebase_search/core.ts
|
|
1701
|
-
init_logger();
|
|
1702
|
-
var DEFAULT_TIMEOUT3 = 3e4;
|
|
1703
|
-
var emptyStats = { totalResults: 0, candidatesRetrieved: 0, searchTimeMs: 0 };
|
|
1704
|
-
async function runSearch(client, input, repoId, timeout, baseURL) {
|
|
1705
|
-
const startTime = Date.now();
|
|
1706
|
-
logger.debug("CodebaseSearch", "request", { query: input.query.slice(0, 100), repo_id: repoId });
|
|
1707
|
-
try {
|
|
1708
|
-
const data = await client.post(
|
|
1709
|
-
"/v1/codebase_search",
|
|
1710
|
-
{
|
|
1711
|
-
baseURL: baseURL ?? client.reposURL,
|
|
1712
|
-
timeout,
|
|
1713
|
-
body: {
|
|
1714
|
-
query: input.query,
|
|
1715
|
-
repoId,
|
|
1716
|
-
targetDirectories: input.target_directories || [],
|
|
1717
|
-
limit: input.limit || 10,
|
|
1718
|
-
candidateLimit: 50
|
|
1719
|
-
}
|
|
1720
|
-
}
|
|
1721
|
-
);
|
|
1722
|
-
const elapsed = Date.now() - startTime;
|
|
1723
|
-
logger.debug("CodebaseSearch", "response", { results_count: data.results?.length || 0, latency_ms: elapsed });
|
|
1724
|
-
return {
|
|
1725
|
-
success: true,
|
|
1726
|
-
results: data.results || [],
|
|
1727
|
-
stats: data.stats || { totalResults: 0, candidatesRetrieved: 0, searchTimeMs: elapsed }
|
|
1728
|
-
};
|
|
1729
|
-
} catch (error) {
|
|
1730
|
-
const message = error instanceof MorphError && error.statusCode ? `Search failed (${error.statusCode}): ${error.message}` : error instanceof Error ? error.message : "Unknown error";
|
|
1731
|
-
logger.error("CodebaseSearch", "error", { error: message, latency_ms: Date.now() - startTime });
|
|
1732
|
-
return { success: false, results: [], stats: { ...emptyStats }, error: message };
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
var CodebaseSearchClient = class extends APIResource {
|
|
1736
|
-
timeout;
|
|
1737
|
-
constructor(clientOrConfig = {}) {
|
|
1738
|
-
super(
|
|
1739
|
-
clientOrConfig instanceof MorphAPIClient ? clientOrConfig : new MorphAPIClient({
|
|
1740
|
-
apiKey: clientOrConfig.apiKey,
|
|
1741
|
-
timeout: clientOrConfig.timeout ?? DEFAULT_TIMEOUT3,
|
|
1742
|
-
retryConfig: clientOrConfig.retryConfig,
|
|
1743
|
-
debug: clientOrConfig.debug
|
|
1744
|
-
})
|
|
1745
|
-
);
|
|
1746
|
-
this.timeout = (clientOrConfig instanceof MorphAPIClient ? void 0 : clientOrConfig.timeout) ?? DEFAULT_TIMEOUT3;
|
|
1747
|
-
}
|
|
1748
|
-
/**
|
|
1749
|
-
* Execute a semantic code search
|
|
1750
|
-
*
|
|
1751
|
-
* @param input - Search parameters including query, repoId, and target directories
|
|
1752
|
-
* @param overrides - Optional config overrides for this operation
|
|
1753
|
-
* @returns Search results with ranked code matches
|
|
1754
|
-
*/
|
|
1755
|
-
async search(input, overrides) {
|
|
1756
|
-
return runSearch(
|
|
1757
|
-
this._client,
|
|
1758
|
-
{ query: input.query, target_directories: input.target_directories, explanation: input.explanation, limit: input.limit },
|
|
1759
|
-
input.repoId,
|
|
1760
|
-
overrides?.timeout ?? this.timeout,
|
|
1761
|
-
overrides?.searchUrl
|
|
1762
|
-
);
|
|
1763
|
-
}
|
|
1764
|
-
};
|
|
1765
|
-
async function executeCodebaseSearch(input, config) {
|
|
1766
|
-
const apiKey = config.apiKey || process.env.MORPH_API_KEY;
|
|
1767
|
-
if (!apiKey) {
|
|
1768
|
-
throw new Error("MORPH_API_KEY not found. Set environment variable or pass in config");
|
|
1769
|
-
}
|
|
1770
|
-
const client = new MorphAPIClient({
|
|
1771
|
-
apiKey,
|
|
1772
|
-
reposURL: config.searchUrl,
|
|
1773
|
-
timeout: config.timeout ?? DEFAULT_TIMEOUT3,
|
|
1774
|
-
retryConfig: config.retryConfig,
|
|
1775
|
-
debug: config.debug
|
|
1776
|
-
});
|
|
1777
|
-
return runSearch(client, input, config.repoId, config.timeout ?? DEFAULT_TIMEOUT3, config.searchUrl);
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
1665
|
// tools/warp_grep/agent/runner.ts
|
|
1781
1666
|
init_config();
|
|
1782
1667
|
|
|
@@ -2750,13 +2635,13 @@ function parseGitHubUrl(input) {
|
|
|
2750
2635
|
|
|
2751
2636
|
// tools/compact/core.ts
|
|
2752
2637
|
var DEFAULT_API_URL3 = "https://api.morphllm.com";
|
|
2753
|
-
var
|
|
2638
|
+
var DEFAULT_TIMEOUT3 = 12e4;
|
|
2754
2639
|
function resolveClient(clientOrConfig) {
|
|
2755
2640
|
if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;
|
|
2756
2641
|
return new MorphAPIClient({
|
|
2757
2642
|
apiKey: clientOrConfig.morphApiKey,
|
|
2758
2643
|
baseURL: clientOrConfig.morphApiUrl ?? DEFAULT_API_URL3,
|
|
2759
|
-
timeout: clientOrConfig.timeout ??
|
|
2644
|
+
timeout: clientOrConfig.timeout ?? DEFAULT_TIMEOUT3,
|
|
2760
2645
|
retryConfig: clientOrConfig.retryConfig,
|
|
2761
2646
|
debug: clientOrConfig.debug
|
|
2762
2647
|
});
|
|
@@ -2769,7 +2654,7 @@ var CompactClient = class extends APIResource {
|
|
|
2769
2654
|
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
2770
2655
|
this.config = {
|
|
2771
2656
|
morphApiUrl: this._client.baseURL,
|
|
2772
|
-
timeout: cfg.timeout ??
|
|
2657
|
+
timeout: cfg.timeout ?? DEFAULT_TIMEOUT3,
|
|
2773
2658
|
debug: cfg.debug ?? false
|
|
2774
2659
|
};
|
|
2775
2660
|
}
|
|
@@ -3139,13 +3024,13 @@ function formatResult(result) {
|
|
|
3139
3024
|
// modelrouter/core.ts
|
|
3140
3025
|
init_logger();
|
|
3141
3026
|
var DEFAULT_API_URL4 = "https://api.morphllm.com";
|
|
3142
|
-
var
|
|
3027
|
+
var DEFAULT_TIMEOUT4 = 5e3;
|
|
3143
3028
|
function resolveClient2(clientOrConfig) {
|
|
3144
3029
|
if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;
|
|
3145
3030
|
return new MorphAPIClient({
|
|
3146
3031
|
apiKey: clientOrConfig.apiKey,
|
|
3147
3032
|
baseURL: clientOrConfig.apiUrl ?? DEFAULT_API_URL4,
|
|
3148
|
-
timeout: clientOrConfig.timeout ??
|
|
3033
|
+
timeout: clientOrConfig.timeout ?? DEFAULT_TIMEOUT4,
|
|
3149
3034
|
retryConfig: clientOrConfig.retryConfig,
|
|
3150
3035
|
debug: clientOrConfig.debug
|
|
3151
3036
|
});
|
|
@@ -3157,7 +3042,7 @@ var BaseRouter = class extends APIResource {
|
|
|
3157
3042
|
super(resolveClient2(clientOrConfig));
|
|
3158
3043
|
this.provider = provider;
|
|
3159
3044
|
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
3160
|
-
this.timeout = cfg.timeout ??
|
|
3045
|
+
this.timeout = cfg.timeout ?? DEFAULT_TIMEOUT4;
|
|
3161
3046
|
}
|
|
3162
3047
|
/** Throw the historical "API key is required" message when no key is resolvable. */
|
|
3163
3048
|
requireApiKey() {
|
|
@@ -3263,7 +3148,7 @@ var RouterClassifier = class extends APIResource {
|
|
|
3263
3148
|
constructor(clientOrConfig = {}) {
|
|
3264
3149
|
super(resolveClient2(clientOrConfig));
|
|
3265
3150
|
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
3266
|
-
this.timeout = cfg.timeout ??
|
|
3151
|
+
this.timeout = cfg.timeout ?? DEFAULT_TIMEOUT4;
|
|
3267
3152
|
}
|
|
3268
3153
|
/** Classify an input across the requested axes (all three by default). */
|
|
3269
3154
|
async classify(input) {
|
|
@@ -3321,7 +3206,7 @@ var TOOL_PARAMETERS = {
|
|
|
3321
3206
|
required: ["search_term"]
|
|
3322
3207
|
};
|
|
3323
3208
|
function createWarpGrepTool(config) {
|
|
3324
|
-
const
|
|
3209
|
+
const tool4 = {
|
|
3325
3210
|
type: "function",
|
|
3326
3211
|
function: {
|
|
3327
3212
|
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
@@ -3329,7 +3214,7 @@ function createWarpGrepTool(config) {
|
|
|
3329
3214
|
parameters: TOOL_PARAMETERS
|
|
3330
3215
|
}
|
|
3331
3216
|
};
|
|
3332
|
-
return Object.assign(
|
|
3217
|
+
return Object.assign(tool4, {
|
|
3333
3218
|
execute: async (input) => {
|
|
3334
3219
|
return executeToolCall(input, config);
|
|
3335
3220
|
},
|
|
@@ -3340,7 +3225,7 @@ function createWarpGrepTool(config) {
|
|
|
3340
3225
|
}
|
|
3341
3226
|
function createGitHubSearchTool(config) {
|
|
3342
3227
|
const client = new WarpGrepClient(config);
|
|
3343
|
-
const
|
|
3228
|
+
const tool4 = {
|
|
3344
3229
|
type: "function",
|
|
3345
3230
|
function: {
|
|
3346
3231
|
name: GITHUB_SEARCH_TOOL_NAME,
|
|
@@ -3348,7 +3233,7 @@ function createGitHubSearchTool(config) {
|
|
|
3348
3233
|
parameters: GITHUB_SEARCH_INPUT_SCHEMA
|
|
3349
3234
|
}
|
|
3350
3235
|
};
|
|
3351
|
-
return Object.assign(
|
|
3236
|
+
return Object.assign(tool4, {
|
|
3352
3237
|
execute: async (input) => {
|
|
3353
3238
|
const github = input.github_url || input.owner_repo;
|
|
3354
3239
|
if (!github) {
|
|
@@ -3362,107 +3247,6 @@ function createGitHubSearchTool(config) {
|
|
|
3362
3247
|
});
|
|
3363
3248
|
}
|
|
3364
3249
|
|
|
3365
|
-
// tools/codebase_search/prompts.ts
|
|
3366
|
-
var CODEBASE_SEARCH_DESCRIPTION = `Semantic search that finds code by meaning, not exact text.
|
|
3367
|
-
|
|
3368
|
-
Use this to explore unfamiliar codebases or ask "how/where/what" questions:
|
|
3369
|
-
- "How does X work?" - Find implementation details
|
|
3370
|
-
- "Where is Y handled?" - Locate specific functionality
|
|
3371
|
-
- "What happens when Z?" - Understand flow
|
|
3372
|
-
|
|
3373
|
-
The tool uses two-stage retrieval (embedding similarity + reranking) to find the most semantically relevant code chunks.
|
|
3374
|
-
|
|
3375
|
-
Returns code chunks with file paths, line ranges, and full content ranked by relevance.`;
|
|
3376
|
-
var CODEBASE_SEARCH_SYSTEM_PROMPT = `You have access to the codebase_search tool that performs semantic code search.
|
|
3377
|
-
|
|
3378
|
-
When searching:
|
|
3379
|
-
- Use natural language queries describing what you're looking for
|
|
3380
|
-
- Be specific about functionality, not variable names
|
|
3381
|
-
- Use target_directories to narrow search if you know the area
|
|
3382
|
-
- Results are ranked by relevance (rerank score is most important)
|
|
3383
|
-
|
|
3384
|
-
The tool returns:
|
|
3385
|
-
- File paths with symbol names (e.g. "src/auth.ts::AuthService@L1-L17")
|
|
3386
|
-
- Line ranges for precise navigation
|
|
3387
|
-
- Full code content for each match
|
|
3388
|
-
- Dual relevance scores: embedding similarity + rerank score
|
|
3389
|
-
|
|
3390
|
-
Use results to understand code or answer questions. The content is provided in full - avoid re-reading unless you need more context.`;
|
|
3391
|
-
|
|
3392
|
-
// tools/codebase_search/openai.ts
|
|
3393
|
-
function createCodebaseSearchTool(config) {
|
|
3394
|
-
const toolDefinition = {
|
|
3395
|
-
type: "function",
|
|
3396
|
-
function: {
|
|
3397
|
-
name: "codebase_search",
|
|
3398
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
3399
|
-
parameters: {
|
|
3400
|
-
type: "object",
|
|
3401
|
-
properties: {
|
|
3402
|
-
query: {
|
|
3403
|
-
type: "string",
|
|
3404
|
-
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?"'
|
|
3405
|
-
},
|
|
3406
|
-
target_directories: {
|
|
3407
|
-
type: "array",
|
|
3408
|
-
items: { type: "string" },
|
|
3409
|
-
description: "Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo."
|
|
3410
|
-
},
|
|
3411
|
-
explanation: {
|
|
3412
|
-
type: "string",
|
|
3413
|
-
description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal."
|
|
3414
|
-
},
|
|
3415
|
-
limit: {
|
|
3416
|
-
type: "number",
|
|
3417
|
-
description: "Maximum results to return (default: 10)"
|
|
3418
|
-
}
|
|
3419
|
-
},
|
|
3420
|
-
required: ["query", "target_directories", "explanation"]
|
|
3421
|
-
}
|
|
3422
|
-
}
|
|
3423
|
-
};
|
|
3424
|
-
return Object.assign(toolDefinition, {
|
|
3425
|
-
execute: async (input) => {
|
|
3426
|
-
const parsedInput = typeof input === "string" ? JSON.parse(input) : input;
|
|
3427
|
-
return executeCodebaseSearch(parsedInput, config);
|
|
3428
|
-
},
|
|
3429
|
-
formatResult: (result) => {
|
|
3430
|
-
return formatResult2(result);
|
|
3431
|
-
},
|
|
3432
|
-
getSystemPrompt: () => {
|
|
3433
|
-
return CODEBASE_SEARCH_SYSTEM_PROMPT;
|
|
3434
|
-
}
|
|
3435
|
-
});
|
|
3436
|
-
}
|
|
3437
|
-
function formatResult2(result) {
|
|
3438
|
-
if (!result.success) {
|
|
3439
|
-
return `Search failed: ${result.error}`;
|
|
3440
|
-
}
|
|
3441
|
-
if (result.results.length === 0) {
|
|
3442
|
-
return "No matching code found. Try rephrasing your query or removing directory filters.";
|
|
3443
|
-
}
|
|
3444
|
-
const lines = [];
|
|
3445
|
-
lines.push(`Found ${result.results.length} relevant code sections (${result.stats.searchTimeMs}ms):
|
|
3446
|
-
`);
|
|
3447
|
-
result.results.forEach((r, i) => {
|
|
3448
|
-
const relevance = (r.rerankScore * 100).toFixed(1);
|
|
3449
|
-
lines.push(`${i + 1}. ${r.filepath} (${relevance}% relevant)`);
|
|
3450
|
-
lines.push(` Symbol: ${r.symbolPath}`);
|
|
3451
|
-
lines.push(` Language: ${r.language}`);
|
|
3452
|
-
lines.push(` Lines: ${r.startLine}-${r.endLine}`);
|
|
3453
|
-
lines.push(` Code:`);
|
|
3454
|
-
const codeLines = r.content.split("\n");
|
|
3455
|
-
codeLines.slice(0, Math.min(codeLines.length, 20)).forEach((line) => {
|
|
3456
|
-
lines.push(` ${line}`);
|
|
3457
|
-
});
|
|
3458
|
-
if (codeLines.length > 20) {
|
|
3459
|
-
lines.push(` ... (${codeLines.length - 20} more lines)`);
|
|
3460
|
-
}
|
|
3461
|
-
lines.push("");
|
|
3462
|
-
});
|
|
3463
|
-
return lines.join("\n");
|
|
3464
|
-
}
|
|
3465
|
-
|
|
3466
3250
|
// tools/fastapply/prompts.ts
|
|
3467
3251
|
var EDIT_FILE_TOOL_DESCRIPTION = `Use this tool to make an edit to an existing file.
|
|
3468
3252
|
|
|
@@ -3533,7 +3317,7 @@ async function execute(input, config) {
|
|
|
3533
3317
|
function getSystemPrompt() {
|
|
3534
3318
|
return EDIT_FILE_SYSTEM_PROMPT;
|
|
3535
3319
|
}
|
|
3536
|
-
function
|
|
3320
|
+
function formatResult2(result) {
|
|
3537
3321
|
if (!result.success) {
|
|
3538
3322
|
return `Error editing file: ${result.error}`;
|
|
3539
3323
|
}
|
|
@@ -3556,7 +3340,7 @@ function createEditFileTool(config = {}) {
|
|
|
3556
3340
|
return execute(parsedInput, config);
|
|
3557
3341
|
},
|
|
3558
3342
|
formatResult: (result) => {
|
|
3559
|
-
return
|
|
3343
|
+
return formatResult2(result);
|
|
3560
3344
|
},
|
|
3561
3345
|
getSystemPrompt: () => {
|
|
3562
3346
|
return getSystemPrompt();
|
|
@@ -3581,18 +3365,6 @@ var OpenAIToolFactory = class {
|
|
|
3581
3365
|
morphApiKey: this.config.apiKey
|
|
3582
3366
|
});
|
|
3583
3367
|
}
|
|
3584
|
-
/**
|
|
3585
|
-
* Create an OpenAI-compatible codebase search tool
|
|
3586
|
-
*
|
|
3587
|
-
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
3588
|
-
* @returns OpenAI ChatCompletionTool with execute and formatResult methods
|
|
3589
|
-
*/
|
|
3590
|
-
createCodebaseSearchTool(toolConfig) {
|
|
3591
|
-
return createCodebaseSearchTool({
|
|
3592
|
-
...toolConfig,
|
|
3593
|
-
apiKey: this.config.apiKey
|
|
3594
|
-
});
|
|
3595
|
-
}
|
|
3596
3368
|
/**
|
|
3597
3369
|
* Create an OpenAI-compatible edit file tool
|
|
3598
3370
|
*
|
|
@@ -3628,12 +3400,12 @@ var INPUT_SCHEMA = {
|
|
|
3628
3400
|
required: ["search_term"]
|
|
3629
3401
|
};
|
|
3630
3402
|
function createWarpGrepTool2(config) {
|
|
3631
|
-
const
|
|
3403
|
+
const tool4 = {
|
|
3632
3404
|
name: config.name ?? WARP_GREP_TOOL_NAME,
|
|
3633
3405
|
description: config.description ?? WARP_GREP_DESCRIPTION,
|
|
3634
3406
|
input_schema: INPUT_SCHEMA
|
|
3635
3407
|
};
|
|
3636
|
-
return Object.assign(
|
|
3408
|
+
return Object.assign(tool4, {
|
|
3637
3409
|
execute: async (input) => {
|
|
3638
3410
|
return executeToolCall(input, config);
|
|
3639
3411
|
},
|
|
@@ -3644,12 +3416,12 @@ function createWarpGrepTool2(config) {
|
|
|
3644
3416
|
}
|
|
3645
3417
|
function createGitHubSearchTool2(config) {
|
|
3646
3418
|
const client = new WarpGrepClient(config);
|
|
3647
|
-
const
|
|
3419
|
+
const tool4 = {
|
|
3648
3420
|
name: GITHUB_SEARCH_TOOL_NAME,
|
|
3649
3421
|
description: GITHUB_SEARCH_DESCRIPTION,
|
|
3650
3422
|
input_schema: GITHUB_SEARCH_INPUT_SCHEMA
|
|
3651
3423
|
};
|
|
3652
|
-
return Object.assign(
|
|
3424
|
+
return Object.assign(tool4, {
|
|
3653
3425
|
execute: async (input) => {
|
|
3654
3426
|
const github = input.github_url || input.owner_repo;
|
|
3655
3427
|
if (!github) {
|
|
@@ -3663,77 +3435,6 @@ function createGitHubSearchTool2(config) {
|
|
|
3663
3435
|
});
|
|
3664
3436
|
}
|
|
3665
3437
|
|
|
3666
|
-
// tools/codebase_search/anthropic.ts
|
|
3667
|
-
function createCodebaseSearchTool2(config) {
|
|
3668
|
-
const toolDefinition = {
|
|
3669
|
-
name: "codebase_search",
|
|
3670
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
3671
|
-
input_schema: {
|
|
3672
|
-
type: "object",
|
|
3673
|
-
properties: {
|
|
3674
|
-
explanation: {
|
|
3675
|
-
type: "string",
|
|
3676
|
-
description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal."
|
|
3677
|
-
},
|
|
3678
|
-
query: {
|
|
3679
|
-
type: "string",
|
|
3680
|
-
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?"'
|
|
3681
|
-
},
|
|
3682
|
-
target_directories: {
|
|
3683
|
-
type: "array",
|
|
3684
|
-
items: { type: "string" },
|
|
3685
|
-
description: "Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo."
|
|
3686
|
-
},
|
|
3687
|
-
limit: {
|
|
3688
|
-
type: "number",
|
|
3689
|
-
description: "Maximum results to return (default: 10)"
|
|
3690
|
-
}
|
|
3691
|
-
},
|
|
3692
|
-
required: ["query", "target_directories", "explanation"]
|
|
3693
|
-
},
|
|
3694
|
-
cache_control: { type: "ephemeral" }
|
|
3695
|
-
};
|
|
3696
|
-
return Object.assign(toolDefinition, {
|
|
3697
|
-
execute: async (input) => {
|
|
3698
|
-
return executeCodebaseSearch(input, config);
|
|
3699
|
-
},
|
|
3700
|
-
formatResult: (result) => {
|
|
3701
|
-
return formatResult4(result);
|
|
3702
|
-
},
|
|
3703
|
-
getSystemPrompt: () => {
|
|
3704
|
-
return CODEBASE_SEARCH_SYSTEM_PROMPT;
|
|
3705
|
-
}
|
|
3706
|
-
});
|
|
3707
|
-
}
|
|
3708
|
-
function formatResult4(result) {
|
|
3709
|
-
if (!result.success) {
|
|
3710
|
-
return `Search failed: ${result.error}`;
|
|
3711
|
-
}
|
|
3712
|
-
if (result.results.length === 0) {
|
|
3713
|
-
return "No matching code found. Try rephrasing your query or broadening the search scope.";
|
|
3714
|
-
}
|
|
3715
|
-
const lines = [];
|
|
3716
|
-
lines.push(`Found ${result.results.length} relevant code sections (searched ${result.stats.candidatesRetrieved} candidates in ${result.stats.searchTimeMs}ms):
|
|
3717
|
-
`);
|
|
3718
|
-
result.results.forEach((r, i) => {
|
|
3719
|
-
const relevance = (r.rerankScore * 100).toFixed(1);
|
|
3720
|
-
lines.push(`${i + 1}. ${r.filepath} (${relevance}% relevant)`);
|
|
3721
|
-
lines.push(` Symbol: ${r.symbolPath}`);
|
|
3722
|
-
lines.push(` Language: ${r.language}`);
|
|
3723
|
-
lines.push(` Lines: ${r.startLine}-${r.endLine}`);
|
|
3724
|
-
lines.push(` Code:`);
|
|
3725
|
-
const codeLines = r.content.split("\n");
|
|
3726
|
-
codeLines.slice(0, Math.min(codeLines.length, 20)).forEach((line) => {
|
|
3727
|
-
lines.push(` ${line}`);
|
|
3728
|
-
});
|
|
3729
|
-
if (codeLines.length > 20) {
|
|
3730
|
-
lines.push(` ... (${codeLines.length - 20} more lines)`);
|
|
3731
|
-
}
|
|
3732
|
-
lines.push("");
|
|
3733
|
-
});
|
|
3734
|
-
return lines.join("\n");
|
|
3735
|
-
}
|
|
3736
|
-
|
|
3737
3438
|
// tools/fastapply/anthropic.ts
|
|
3738
3439
|
var editFileTool2 = {
|
|
3739
3440
|
name: "edit_file",
|
|
@@ -3757,7 +3458,7 @@ var editFileTool2 = {
|
|
|
3757
3458
|
required: ["target_filepath", "instruction", "code_edit"]
|
|
3758
3459
|
}
|
|
3759
3460
|
};
|
|
3760
|
-
function
|
|
3461
|
+
function formatResult3(result) {
|
|
3761
3462
|
if (!result.success) {
|
|
3762
3463
|
return `Error editing file: ${result.error}`;
|
|
3763
3464
|
}
|
|
@@ -3774,7 +3475,7 @@ function createEditFileTool2(config = {}) {
|
|
|
3774
3475
|
return executeEditFile(input, config);
|
|
3775
3476
|
},
|
|
3776
3477
|
formatResult: (result) => {
|
|
3777
|
-
return
|
|
3478
|
+
return formatResult3(result);
|
|
3778
3479
|
},
|
|
3779
3480
|
getSystemPrompt: () => {
|
|
3780
3481
|
return EDIT_FILE_SYSTEM_PROMPT;
|
|
@@ -4140,18 +3841,6 @@ var AnthropicToolFactory = class {
|
|
|
4140
3841
|
morphApiKey: this.config.apiKey
|
|
4141
3842
|
});
|
|
4142
3843
|
}
|
|
4143
|
-
/**
|
|
4144
|
-
* Create an Anthropic-compatible codebase search tool
|
|
4145
|
-
*
|
|
4146
|
-
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
4147
|
-
* @returns Anthropic Tool with execute and formatResult methods
|
|
4148
|
-
*/
|
|
4149
|
-
createCodebaseSearchTool(toolConfig) {
|
|
4150
|
-
return createCodebaseSearchTool2({
|
|
4151
|
-
...toolConfig,
|
|
4152
|
-
apiKey: this.config.apiKey
|
|
4153
|
-
});
|
|
4154
|
-
}
|
|
4155
3844
|
/**
|
|
4156
3845
|
* Create an Anthropic-compatible edit file tool
|
|
4157
3846
|
*
|
|
@@ -4253,56 +3942,15 @@ function createGitHubSearchTool3(config) {
|
|
|
4253
3942
|
});
|
|
4254
3943
|
}
|
|
4255
3944
|
|
|
4256
|
-
// tools/
|
|
3945
|
+
// tools/fastapply/vercel.ts
|
|
4257
3946
|
var import_ai2 = require("ai");
|
|
4258
3947
|
var import_zod2 = require("zod");
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
explanation: import_zod2.z.string().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal."),
|
|
4264
|
-
limit: import_zod2.z.number().optional().describe("Max results to return (default: 10)")
|
|
4265
|
-
});
|
|
4266
|
-
return (0, import_ai2.tool)({
|
|
4267
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
4268
|
-
inputSchema: schema,
|
|
4269
|
-
execute: async (params) => {
|
|
4270
|
-
const { query, target_directories, explanation, limit } = params;
|
|
4271
|
-
const result = await executeCodebaseSearch(
|
|
4272
|
-
{ query, target_directories, explanation, limit },
|
|
4273
|
-
config
|
|
4274
|
-
);
|
|
4275
|
-
if (!result.success) {
|
|
4276
|
-
return {
|
|
4277
|
-
error: result.error,
|
|
4278
|
-
results: []
|
|
4279
|
-
};
|
|
4280
|
-
}
|
|
4281
|
-
return {
|
|
4282
|
-
found: result.results.length,
|
|
4283
|
-
searchTime: `${result.stats.searchTimeMs}ms`,
|
|
4284
|
-
results: result.results.map((r) => ({
|
|
4285
|
-
file: r.filepath,
|
|
4286
|
-
symbol: r.symbolPath,
|
|
4287
|
-
lines: `${r.startLine}-${r.endLine}`,
|
|
4288
|
-
language: r.language,
|
|
4289
|
-
relevance: `${(r.rerankScore * 100).toFixed(1)}%`,
|
|
4290
|
-
code: r.content
|
|
4291
|
-
}))
|
|
4292
|
-
};
|
|
4293
|
-
}
|
|
4294
|
-
});
|
|
4295
|
-
}
|
|
4296
|
-
|
|
4297
|
-
// tools/fastapply/vercel.ts
|
|
4298
|
-
var import_ai3 = require("ai");
|
|
4299
|
-
var import_zod3 = require("zod");
|
|
4300
|
-
var editFileSchema = import_zod3.z.object({
|
|
4301
|
-
target_filepath: import_zod3.z.string().describe("The path of the target file to modify"),
|
|
4302
|
-
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."),
|
|
4303
|
-
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.")
|
|
3948
|
+
var editFileSchema = import_zod2.z.object({
|
|
3949
|
+
target_filepath: import_zod2.z.string().describe("The path of the target file to modify"),
|
|
3950
|
+
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."),
|
|
3951
|
+
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.")
|
|
4304
3952
|
});
|
|
4305
|
-
var editFileTool3 = (0,
|
|
3953
|
+
var editFileTool3 = (0, import_ai2.tool)({
|
|
4306
3954
|
description: EDIT_FILE_TOOL_DESCRIPTION,
|
|
4307
3955
|
inputSchema: editFileSchema,
|
|
4308
3956
|
execute: async (params) => {
|
|
@@ -4323,12 +3971,12 @@ var editFileTool3 = (0, import_ai3.tool)({
|
|
|
4323
3971
|
}
|
|
4324
3972
|
});
|
|
4325
3973
|
function createEditFileTool3(config = {}) {
|
|
4326
|
-
const schema =
|
|
4327
|
-
target_filepath:
|
|
4328
|
-
instruction:
|
|
4329
|
-
code_edit:
|
|
3974
|
+
const schema = import_zod2.z.object({
|
|
3975
|
+
target_filepath: import_zod2.z.string().describe("The path of the target file to modify"),
|
|
3976
|
+
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."),
|
|
3977
|
+
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.")
|
|
4330
3978
|
});
|
|
4331
|
-
return (0,
|
|
3979
|
+
return (0, import_ai2.tool)({
|
|
4332
3980
|
description: config.description || EDIT_FILE_TOOL_DESCRIPTION,
|
|
4333
3981
|
inputSchema: schema,
|
|
4334
3982
|
execute: async (params) => {
|
|
@@ -4354,8 +4002,8 @@ function createEditFileTool3(config = {}) {
|
|
|
4354
4002
|
}
|
|
4355
4003
|
|
|
4356
4004
|
// subagents/vercel.ts
|
|
4357
|
-
var
|
|
4358
|
-
var
|
|
4005
|
+
var import_ai3 = require("ai");
|
|
4006
|
+
var import_zod3 = require("zod");
|
|
4359
4007
|
var DEFAULT_MAX_TURNS2 = {
|
|
4360
4008
|
quick: 3,
|
|
4361
4009
|
medium: 6,
|
|
@@ -4383,18 +4031,18 @@ function createExploreSubagent2(config) {
|
|
|
4383
4031
|
) : null;
|
|
4384
4032
|
const runPromise = (async () => {
|
|
4385
4033
|
try {
|
|
4386
|
-
const codebaseSearchSchema =
|
|
4387
|
-
searchRequest:
|
|
4034
|
+
const codebaseSearchSchema = import_zod3.z.object({
|
|
4035
|
+
searchRequest: import_zod3.z.string().describe("Natural language description of what to search for")
|
|
4388
4036
|
});
|
|
4389
|
-
const sendMessageSchema =
|
|
4390
|
-
message:
|
|
4037
|
+
const sendMessageSchema = import_zod3.z.object({
|
|
4038
|
+
message: import_zod3.z.string().describe("The message to send to the orchestrator")
|
|
4391
4039
|
});
|
|
4392
|
-
const result = await (0,
|
|
4040
|
+
const result = await (0, import_ai3.generateText)({
|
|
4393
4041
|
model: config.model,
|
|
4394
4042
|
system: getSystemPrompt2(thoroughness),
|
|
4395
4043
|
prompt,
|
|
4396
4044
|
tools: {
|
|
4397
|
-
codebase_search: (0,
|
|
4045
|
+
codebase_search: (0, import_ai3.tool)({
|
|
4398
4046
|
description: CODEBASE_SEARCH_TOOL.description,
|
|
4399
4047
|
inputSchema: codebaseSearchSchema,
|
|
4400
4048
|
execute: async (params) => {
|
|
@@ -4417,7 +4065,7 @@ function createExploreSubagent2(config) {
|
|
|
4417
4065
|
return formatResult(warpResult);
|
|
4418
4066
|
}
|
|
4419
4067
|
}),
|
|
4420
|
-
send_message: (0,
|
|
4068
|
+
send_message: (0, import_ai3.tool)({
|
|
4421
4069
|
description: SEND_MESSAGE_TOOL.description,
|
|
4422
4070
|
inputSchema: sendMessageSchema,
|
|
4423
4071
|
execute: async (params) => {
|
|
@@ -4448,7 +4096,7 @@ function createExploreSubagent2(config) {
|
|
|
4448
4096
|
}
|
|
4449
4097
|
})
|
|
4450
4098
|
},
|
|
4451
|
-
stopWhen: (0,
|
|
4099
|
+
stopWhen: (0, import_ai3.stepCountIs)(getMaxTurns2(config))
|
|
4452
4100
|
});
|
|
4453
4101
|
callbacks.onStep?.({
|
|
4454
4102
|
step: searchCount,
|
|
@@ -4491,10 +4139,10 @@ function createExploreSubagent2(config) {
|
|
|
4491
4139
|
}
|
|
4492
4140
|
return runPromise;
|
|
4493
4141
|
}
|
|
4494
|
-
const exploreToolSchema =
|
|
4495
|
-
searchRequest:
|
|
4142
|
+
const exploreToolSchema = import_zod3.z.object({
|
|
4143
|
+
searchRequest: import_zod3.z.string().describe("What to explore in the codebase. Be specific about what you want to understand.")
|
|
4496
4144
|
});
|
|
4497
|
-
const exploreTool = (0,
|
|
4145
|
+
const exploreTool = (0, import_ai3.tool)({
|
|
4498
4146
|
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.",
|
|
4499
4147
|
inputSchema: exploreToolSchema,
|
|
4500
4148
|
execute: async (params) => {
|
|
@@ -4621,18 +4269,6 @@ var VercelToolFactory = class {
|
|
|
4621
4269
|
morphApiKey: this.config.apiKey
|
|
4622
4270
|
});
|
|
4623
4271
|
}
|
|
4624
|
-
/**
|
|
4625
|
-
* Create a Vercel AI SDK-compatible codebase search tool
|
|
4626
|
-
*
|
|
4627
|
-
* @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
|
|
4628
|
-
* @returns Vercel AI SDK tool
|
|
4629
|
-
*/
|
|
4630
|
-
createCodebaseSearchTool(toolConfig) {
|
|
4631
|
-
return createCodebaseSearchTool3({
|
|
4632
|
-
...toolConfig,
|
|
4633
|
-
apiKey: this.config.apiKey
|
|
4634
|
-
});
|
|
4635
|
-
}
|
|
4636
4272
|
/**
|
|
4637
4273
|
* Create a Vercel AI SDK-compatible edit file tool
|
|
4638
4274
|
*
|
|
@@ -4677,8 +4313,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
4677
4313
|
config;
|
|
4678
4314
|
/** FastApply tool for editing files with AI-powered merge */
|
|
4679
4315
|
fastApply;
|
|
4680
|
-
/** CodebaseSearch tool for semantic code search */
|
|
4681
|
-
codebaseSearch;
|
|
4682
4316
|
/** WarpGrep tool for fast code search using ripgrep */
|
|
4683
4317
|
warpGrep;
|
|
4684
4318
|
/** Model routers for intelligent model selection */
|
|
@@ -4718,7 +4352,6 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
4718
4352
|
this.config = config;
|
|
4719
4353
|
logger.debug("MorphClient", "initialized", { debug: !!config.debug, timeout: config.timeout });
|
|
4720
4354
|
this.fastApply = new FastApplyClient(this);
|
|
4721
|
-
this.codebaseSearch = new CodebaseSearchClient(this);
|
|
4722
4355
|
this.warpGrep = new WarpGrepClient(this);
|
|
4723
4356
|
this.routers = {
|
|
4724
4357
|
openai: new OpenAIRouter(this),
|
|
@@ -4736,7 +4369,7 @@ var MorphClient = class extends MorphAPIClient {
|
|
|
4736
4369
|
};
|
|
4737
4370
|
|
|
4738
4371
|
// tools/warp_grep/index.ts
|
|
4739
|
-
var
|
|
4372
|
+
var import_zod4 = require("zod");
|
|
4740
4373
|
|
|
4741
4374
|
// tools/warp_grep/providers/index.ts
|
|
4742
4375
|
init_local();
|
|
@@ -4767,15 +4400,14 @@ ${payload}
|
|
|
4767
4400
|
var sharedFormatter = new ToolOutputFormatter();
|
|
4768
4401
|
|
|
4769
4402
|
// tools/warp_grep/index.ts
|
|
4770
|
-
var warpGrepInputSchema =
|
|
4771
|
-
search_term:
|
|
4403
|
+
var warpGrepInputSchema = import_zod4.z.object({
|
|
4404
|
+
search_term: import_zod4.z.string().describe("Search problem statement that this subagent is supposed to research for")
|
|
4772
4405
|
});
|
|
4773
4406
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4774
4407
|
0 && (module.exports = {
|
|
4775
4408
|
APIResource,
|
|
4776
4409
|
AnthropicRouter,
|
|
4777
4410
|
AnthropicToolFactory,
|
|
4778
|
-
CodebaseSearchClient,
|
|
4779
4411
|
CompactClient,
|
|
4780
4412
|
FastApplyAnchorIntegrityError,
|
|
4781
4413
|
FastApplyClient,
|