@morphllm/morphsdk 0.2.199 → 0.2.201
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/ai-sdk/index.cjs +0 -1
- package/dist/ai-sdk/index.js +0 -1
- package/dist/{chunk-HYRHI2UL.js → chunk-2PPYWRMZ.js} +0 -1
- package/dist/{chunk-IA5K2HTC.js → chunk-44OIEPIO.js} +1 -2
- package/dist/{chunk-FBRNUWEB.js → chunk-4OUGA3KS.js} +0 -1
- package/dist/{chunk-CEXBKXWU.js → chunk-5NSYDT36.js} +3 -4
- package/dist/{chunk-G2RSY56Q.js → chunk-6TZCVTW5.js} +0 -1
- package/dist/{chunk-F3NCFNUX.js → chunk-6WP7EA4F.js} +0 -1
- package/dist/{chunk-5KQ2WRBU.js → chunk-B376VMIH.js} +2 -3
- package/dist/{chunk-OPNTDMHH.js → chunk-BZXOAC2R.js} +6 -7
- package/dist/{chunk-YSFEKIYQ.js → chunk-DBNSOYQ3.js} +2 -3
- package/dist/{chunk-PW6K6OJL.js → chunk-EQAWWVKV.js} +1 -2
- package/dist/{chunk-ZZ25FZG2.js → chunk-ETBRAKVV.js} +0 -1
- package/dist/chunk-FBOZIVVQ.js +0 -0
- package/dist/{chunk-GKRPR5PZ.js → chunk-FVT4PU4I.js} +18 -70
- package/dist/{chunk-MRMBFJR2.js → chunk-HDP4QAZL.js} +0 -1
- package/dist/{chunk-TPP2UGQP.js → chunk-I26FQELI.js} +0 -1
- package/dist/{chunk-BTMMUG3E.js → chunk-ILY5N5NJ.js} +2 -3
- package/dist/{chunk-7UU4NF4G.js → chunk-JBAY3PRV.js} +4 -5
- package/dist/chunk-LDM7RNNN.js +0 -0
- package/dist/{chunk-ZHB57ORD.js → chunk-LISSWRUD.js} +8 -9
- package/dist/{chunk-CCJK3HTG.js → chunk-M34E2AMK.js} +0 -1
- package/dist/{chunk-WDBYAXZ5.js → chunk-M6AVXUM4.js} +2 -3
- package/dist/{chunk-QRXG5CAZ.js → chunk-MF56KEI4.js} +0 -1
- package/dist/{chunk-PZ5AY32C.js → chunk-MLKGABMK.js} +0 -1
- package/dist/{chunk-5TOJD2C5.js → chunk-NRG6QX3L.js} +0 -1
- package/dist/{chunk-GTV27THY.js → chunk-NWGRW4V7.js} +1 -2
- package/dist/{chunk-63VHBANJ.js → chunk-OPDWMD4Q.js} +0 -1
- package/dist/{chunk-O7LJEVZO.js → chunk-OVLUL5AC.js} +5 -6
- package/dist/{chunk-W37OFBSG.js → chunk-P2KW2O5R.js} +2 -3
- package/dist/{chunk-63WE2C5R.js → chunk-PA3UTI4A.js} +0 -1
- package/dist/{chunk-Q3NH3NPD.js → chunk-RJXAXR7Q.js} +5 -6
- package/dist/{chunk-A4D2CIIT.js → chunk-RYVW7RUM.js} +1 -2
- package/dist/{chunk-ULHHMZRL.js → chunk-RZOJ4GSY.js} +4 -5
- package/dist/{chunk-UT3NQLCF.js → chunk-SU7AAS3O.js} +2 -3
- package/dist/{chunk-DP2PT36G.js → chunk-TS3OJ4LA.js} +1 -2
- package/dist/{chunk-BLCCGRKT.js → chunk-TZC3EOZS.js} +5 -6
- package/dist/{chunk-Q6QCHAMD.js → chunk-UAPK3AIJ.js} +0 -1
- package/dist/{chunk-JOC3ZI56.js → chunk-UZCXOOZO.js} +2 -38
- package/dist/{chunk-PKJ7ODTG.js → chunk-VOXUA5ZH.js} +4 -5
- package/dist/{chunk-KXEPBLVD.js → chunk-WBTXEJOC.js} +12 -13
- package/dist/{chunk-YPKNMYD4.js → chunk-ZSHVXDA2.js} +0 -1
- package/dist/{client-CGW0Cevz.d.ts → client-BWhi-vSj.d.ts} +4 -65
- package/dist/client.cjs +45 -413
- package/dist/client.d.ts +2 -4
- package/dist/client.js +32 -38
- package/dist/core/client.cjs +2 -38
- package/dist/core/client.js +6 -7
- package/dist/core/error.cjs +2 -38
- package/dist/core/error.js +4 -5
- package/dist/core/index.cjs +2 -38
- package/dist/core/index.js +8 -9
- package/dist/core/resource.cjs +0 -1
- package/dist/core/resource.js +2 -3
- package/dist/edge.cjs +2 -38
- package/dist/edge.js +10 -11
- package/dist/index.cjs +48 -418
- package/dist/index.d.ts +2 -4
- package/dist/index.js +39 -48
- package/dist/modelrouter/core.cjs +2 -38
- package/dist/modelrouter/core.js +8 -9
- package/dist/modelrouter/index.cjs +2 -38
- package/dist/modelrouter/index.js +8 -9
- package/dist/modelrouter/types.cjs +0 -1
- package/dist/modelrouter/types.js +0 -1
- package/dist/subagents/anthropic.cjs +2 -38
- package/dist/subagents/anthropic.d.ts +1 -1
- package/dist/subagents/anthropic.js +19 -20
- package/dist/subagents/index.cjs +0 -1
- package/dist/subagents/index.d.ts +1 -1
- package/dist/subagents/index.js +2 -3
- package/dist/subagents/prompts.cjs +0 -1
- package/dist/subagents/prompts.d.ts +1 -1
- package/dist/subagents/prompts.js +2 -3
- package/dist/subagents/types.cjs +0 -1
- package/dist/subagents/types.d.ts +1 -1
- package/dist/subagents/types.js +0 -1
- package/dist/subagents/vercel.cjs +2 -38
- package/dist/subagents/vercel.d.ts +1 -1
- package/dist/subagents/vercel.js +19 -20
- package/dist/tools/compact/core.cjs +2 -38
- package/dist/tools/compact/core.js +8 -9
- package/dist/tools/compact/index.cjs +2 -38
- package/dist/tools/compact/index.js +9 -10
- package/dist/tools/compact/types.cjs +0 -1
- package/dist/tools/compact/types.js +0 -1
- package/dist/tools/fastapply/anthropic.cjs +2 -38
- package/dist/tools/fastapply/anthropic.js +11 -12
- package/dist/tools/fastapply/apply.cjs +2 -38
- package/dist/tools/fastapply/apply.js +4 -5
- package/dist/tools/fastapply/core.cjs +2 -38
- package/dist/tools/fastapply/core.js +9 -10
- package/dist/tools/fastapply/index.cjs +2 -38
- package/dist/tools/fastapply/index.js +17 -18
- package/dist/tools/fastapply/openai.cjs +2 -38
- package/dist/tools/fastapply/openai.js +11 -12
- package/dist/tools/fastapply/prompts.cjs +0 -1
- package/dist/tools/fastapply/prompts.js +2 -3
- package/dist/tools/fastapply/types.cjs +0 -1
- package/dist/tools/fastapply/types.js +0 -1
- package/dist/tools/fastapply/vercel.cjs +2 -38
- package/dist/tools/fastapply/vercel.js +11 -12
- package/dist/tools/index.cjs +2 -38
- package/dist/tools/index.js +17 -18
- package/dist/tools/utils/resilience.cjs +2 -38
- package/dist/tools/utils/resilience.js +3 -4
- package/dist/tools/warp_grep/agent/config.cjs +0 -1
- package/dist/tools/warp_grep/agent/config.js +2 -3
- package/dist/tools/warp_grep/agent/formatter.cjs +0 -1
- package/dist/tools/warp_grep/agent/formatter.js +2 -3
- package/dist/tools/warp_grep/agent/parser.cjs +0 -1
- package/dist/tools/warp_grep/agent/parser.js +2 -3
- package/dist/tools/warp_grep/agent/runner.cjs +2 -38
- package/dist/tools/warp_grep/agent/runner.js +7 -8
- package/dist/tools/warp_grep/agent/types.cjs +0 -1
- package/dist/tools/warp_grep/agent/types.js +0 -1
- package/dist/tools/warp_grep/anthropic.cjs +2 -38
- package/dist/tools/warp_grep/anthropic.d.ts +1 -1
- package/dist/tools/warp_grep/anthropic.js +19 -20
- package/dist/tools/warp_grep/client.cjs +2 -38
- package/dist/tools/warp_grep/client.d.ts +1 -1
- package/dist/tools/warp_grep/client.js +17 -18
- package/dist/tools/warp_grep/gemini.cjs +2 -38
- package/dist/tools/warp_grep/gemini.d.ts +1 -1
- package/dist/tools/warp_grep/gemini.js +18 -19
- package/dist/tools/warp_grep/harness.cjs +0 -1
- package/dist/tools/warp_grep/harness.js +14 -15
- package/dist/tools/warp_grep/index.cjs +2 -38
- package/dist/tools/warp_grep/index.d.ts +1 -1
- package/dist/tools/warp_grep/index.js +27 -28
- package/dist/tools/warp_grep/openai.cjs +2 -38
- package/dist/tools/warp_grep/openai.d.ts +1 -1
- package/dist/tools/warp_grep/openai.js +19 -20
- package/dist/tools/warp_grep/providers/code_storage_http.cjs +0 -1
- package/dist/tools/warp_grep/providers/code_storage_http.d.ts +1 -1
- package/dist/tools/warp_grep/providers/code_storage_http.js +2 -3
- package/dist/tools/warp_grep/providers/local.cjs +0 -1
- package/dist/tools/warp_grep/providers/local.js +6 -7
- package/dist/tools/warp_grep/providers/remote.cjs +0 -1
- package/dist/tools/warp_grep/providers/remote.d.ts +1 -1
- package/dist/tools/warp_grep/providers/remote.js +3 -4
- package/dist/tools/warp_grep/providers/types.cjs +0 -1
- package/dist/tools/warp_grep/providers/types.js +0 -1
- package/dist/tools/warp_grep/utils/files.cjs +0 -1
- package/dist/tools/warp_grep/utils/files.js +2 -3
- package/dist/tools/warp_grep/utils/github.cjs +0 -1
- package/dist/tools/warp_grep/utils/github.js +2 -3
- package/dist/tools/warp_grep/utils/paths.cjs +0 -1
- package/dist/tools/warp_grep/utils/paths.js +2 -3
- package/dist/tools/warp_grep/utils/ripgrep.cjs +0 -1
- package/dist/tools/warp_grep/utils/ripgrep.js +2 -3
- package/dist/tools/warp_grep/vercel.cjs +2 -38
- package/dist/tools/warp_grep/vercel.d.ts +1 -1
- package/dist/tools/warp_grep/vercel.js +19 -20
- package/dist/{types-qwD753FR.d.ts → types-DxZLPogx.d.ts} +1 -1
- package/dist/version.cjs +2 -38
- package/dist/version.js +2 -3
- package/package.json +2 -37
- package/dist/ai-sdk/index.cjs.map +0 -1
- package/dist/ai-sdk/index.js.map +0 -1
- package/dist/chunk-5KQ2WRBU.js.map +0 -1
- package/dist/chunk-5TOJD2C5.js.map +0 -1
- package/dist/chunk-63VHBANJ.js.map +0 -1
- package/dist/chunk-63WE2C5R.js.map +0 -1
- package/dist/chunk-7UU4NF4G.js.map +0 -1
- package/dist/chunk-A4D2CIIT.js.map +0 -1
- package/dist/chunk-BLCCGRKT.js.map +0 -1
- package/dist/chunk-BTMMUG3E.js.map +0 -1
- package/dist/chunk-CCJK3HTG.js.map +0 -1
- package/dist/chunk-CEXBKXWU.js.map +0 -1
- package/dist/chunk-DP2PT36G.js.map +0 -1
- package/dist/chunk-EMURAU6J.js +0 -148
- package/dist/chunk-EMURAU6J.js.map +0 -1
- package/dist/chunk-F3NCFNUX.js.map +0 -1
- package/dist/chunk-FBRNUWEB.js.map +0 -1
- package/dist/chunk-G2RSY56Q.js.map +0 -1
- package/dist/chunk-GKRPR5PZ.js.map +0 -1
- package/dist/chunk-GTV27THY.js.map +0 -1
- package/dist/chunk-HYRHI2UL.js.map +0 -1
- package/dist/chunk-IA5K2HTC.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-KXEPBLVD.js.map +0 -1
- package/dist/chunk-MEZTHMB2.js +0 -83
- package/dist/chunk-MEZTHMB2.js.map +0 -1
- package/dist/chunk-MRMBFJR2.js.map +0 -1
- package/dist/chunk-O7LJEVZO.js.map +0 -1
- package/dist/chunk-OPNTDMHH.js.map +0 -1
- package/dist/chunk-PKJ7ODTG.js.map +0 -1
- package/dist/chunk-PW6K6OJL.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-Q3NH3NPD.js.map +0 -1
- package/dist/chunk-Q6QCHAMD.js.map +0 -1
- package/dist/chunk-QRXG5CAZ.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-TPP2UGQP.js.map +0 -1
- package/dist/chunk-ULHHMZRL.js.map +0 -1
- package/dist/chunk-UT3NQLCF.js.map +0 -1
- package/dist/chunk-VS5F2ORN.js +0 -97
- package/dist/chunk-VS5F2ORN.js.map +0 -1
- package/dist/chunk-VZ7BOH2K.js +0 -1
- package/dist/chunk-VZ7BOH2K.js.map +0 -1
- package/dist/chunk-W37OFBSG.js.map +0 -1
- package/dist/chunk-WDBYAXZ5.js.map +0 -1
- package/dist/chunk-X2K57BH6.js +0 -1
- package/dist/chunk-X2K57BH6.js.map +0 -1
- package/dist/chunk-YPKNMYD4.js.map +0 -1
- package/dist/chunk-YQMPVJ2L.js +0 -32
- package/dist/chunk-YQMPVJ2L.js.map +0 -1
- package/dist/chunk-YSFEKIYQ.js.map +0 -1
- package/dist/chunk-ZHB57ORD.js.map +0 -1
- package/dist/chunk-ZZ25FZG2.js.map +0 -1
- package/dist/client.cjs.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/core/client.cjs.map +0 -1
- package/dist/core/client.js.map +0 -1
- package/dist/core/error.cjs.map +0 -1
- package/dist/core/error.js.map +0 -1
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/resource.cjs.map +0 -1
- package/dist/core/resource.js.map +0 -1
- package/dist/edge.cjs.map +0 -1
- package/dist/edge.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/modelrouter/core.cjs.map +0 -1
- package/dist/modelrouter/core.js.map +0 -1
- package/dist/modelrouter/index.cjs.map +0 -1
- package/dist/modelrouter/index.js.map +0 -1
- package/dist/modelrouter/types.cjs.map +0 -1
- package/dist/modelrouter/types.js.map +0 -1
- package/dist/otel-CG0uqXjp.d.ts +0 -42
- package/dist/subagents/anthropic.cjs.map +0 -1
- package/dist/subagents/anthropic.js.map +0 -1
- package/dist/subagents/index.cjs.map +0 -1
- package/dist/subagents/index.js.map +0 -1
- package/dist/subagents/prompts.cjs.map +0 -1
- package/dist/subagents/prompts.js.map +0 -1
- package/dist/subagents/types.cjs.map +0 -1
- package/dist/subagents/types.js.map +0 -1
- package/dist/subagents/vercel.cjs.map +0 -1
- package/dist/subagents/vercel.js.map +0 -1
- 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/tools/compact/core.cjs.map +0 -1
- package/dist/tools/compact/core.js.map +0 -1
- package/dist/tools/compact/index.cjs.map +0 -1
- package/dist/tools/compact/index.js.map +0 -1
- package/dist/tools/compact/types.cjs.map +0 -1
- package/dist/tools/compact/types.js.map +0 -1
- package/dist/tools/fastapply/anthropic.cjs.map +0 -1
- package/dist/tools/fastapply/anthropic.js.map +0 -1
- package/dist/tools/fastapply/apply.cjs.map +0 -1
- package/dist/tools/fastapply/apply.js.map +0 -1
- package/dist/tools/fastapply/core.cjs.map +0 -1
- package/dist/tools/fastapply/core.js.map +0 -1
- package/dist/tools/fastapply/index.cjs.map +0 -1
- package/dist/tools/fastapply/index.js.map +0 -1
- package/dist/tools/fastapply/openai.cjs.map +0 -1
- package/dist/tools/fastapply/openai.js.map +0 -1
- package/dist/tools/fastapply/prompts.cjs.map +0 -1
- package/dist/tools/fastapply/prompts.js.map +0 -1
- package/dist/tools/fastapply/types.cjs.map +0 -1
- package/dist/tools/fastapply/types.js.map +0 -1
- package/dist/tools/fastapply/vercel.cjs.map +0 -1
- package/dist/tools/fastapply/vercel.js.map +0 -1
- package/dist/tools/index.cjs.map +0 -1
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/utils/resilience.cjs.map +0 -1
- package/dist/tools/utils/resilience.js.map +0 -1
- package/dist/tools/warp_grep/agent/config.cjs.map +0 -1
- package/dist/tools/warp_grep/agent/config.js.map +0 -1
- package/dist/tools/warp_grep/agent/formatter.cjs.map +0 -1
- package/dist/tools/warp_grep/agent/formatter.js.map +0 -1
- package/dist/tools/warp_grep/agent/parser.cjs.map +0 -1
- package/dist/tools/warp_grep/agent/parser.js.map +0 -1
- package/dist/tools/warp_grep/agent/runner.cjs.map +0 -1
- package/dist/tools/warp_grep/agent/runner.js.map +0 -1
- package/dist/tools/warp_grep/agent/types.cjs.map +0 -1
- package/dist/tools/warp_grep/agent/types.js.map +0 -1
- package/dist/tools/warp_grep/anthropic.cjs.map +0 -1
- package/dist/tools/warp_grep/anthropic.js.map +0 -1
- package/dist/tools/warp_grep/client.cjs.map +0 -1
- package/dist/tools/warp_grep/client.js.map +0 -1
- package/dist/tools/warp_grep/gemini.cjs.map +0 -1
- package/dist/tools/warp_grep/gemini.js.map +0 -1
- package/dist/tools/warp_grep/harness.cjs.map +0 -1
- package/dist/tools/warp_grep/harness.js.map +0 -1
- package/dist/tools/warp_grep/index.cjs.map +0 -1
- package/dist/tools/warp_grep/index.js.map +0 -1
- package/dist/tools/warp_grep/openai.cjs.map +0 -1
- package/dist/tools/warp_grep/openai.js.map +0 -1
- package/dist/tools/warp_grep/providers/code_storage_http.cjs.map +0 -1
- package/dist/tools/warp_grep/providers/code_storage_http.js.map +0 -1
- package/dist/tools/warp_grep/providers/local.cjs.map +0 -1
- package/dist/tools/warp_grep/providers/local.js.map +0 -1
- package/dist/tools/warp_grep/providers/remote.cjs.map +0 -1
- package/dist/tools/warp_grep/providers/remote.js.map +0 -1
- package/dist/tools/warp_grep/providers/types.cjs.map +0 -1
- package/dist/tools/warp_grep/providers/types.js.map +0 -1
- package/dist/tools/warp_grep/utils/files.cjs.map +0 -1
- package/dist/tools/warp_grep/utils/files.js.map +0 -1
- package/dist/tools/warp_grep/utils/github.cjs.map +0 -1
- package/dist/tools/warp_grep/utils/github.js.map +0 -1
- package/dist/tools/warp_grep/utils/paths.cjs.map +0 -1
- package/dist/tools/warp_grep/utils/paths.js.map +0 -1
- package/dist/tools/warp_grep/utils/ripgrep.cjs.map +0 -1
- package/dist/tools/warp_grep/utils/ripgrep.js.map +0 -1
- package/dist/tools/warp_grep/vercel.cjs.map +0 -1
- package/dist/tools/warp_grep/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/version.cjs.map +0 -1
- package/dist/version.js.map +0 -1
package/dist/chunk-IDMKQWQG.js
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
metadata
|
|
3
|
-
} from "./chunk-TLXVGE4R.js";
|
|
4
|
-
|
|
5
|
-
// tracing/interaction.ts
|
|
6
|
-
import { context, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
|
-
import * as traceloop from "@traceloop/node-server-sdk";
|
|
8
|
-
var ASSOC = "traceloop.association.properties.";
|
|
9
|
-
var ENTITY_INPUT = "traceloop.entity.input";
|
|
10
|
-
var ENTITY_OUTPUT = "traceloop.entity.output";
|
|
11
|
-
var ENTITY_NAME = "traceloop.entity.name";
|
|
12
|
-
var SPAN_KIND = "traceloop.span.kind";
|
|
13
|
-
function uuid() {
|
|
14
|
-
const c = globalThis.crypto;
|
|
15
|
-
if (c?.randomUUID) return c.randomUUID();
|
|
16
|
-
return "xxxxxxxxxxxx4xxxyxxx".replace(/[xy]/g, (ch) => {
|
|
17
|
-
const r = Math.random() * 16 | 0;
|
|
18
|
-
return (ch === "x" ? r : r & 3 | 8).toString(16);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function asString(v) {
|
|
22
|
-
if (v == null) return "";
|
|
23
|
-
return typeof v === "string" ? v : JSON.stringify(v);
|
|
24
|
-
}
|
|
25
|
-
function associationProps(ctx, extra) {
|
|
26
|
-
const props = { ...extra };
|
|
27
|
-
if (ctx.userId) props.user_id = ctx.userId;
|
|
28
|
-
if (ctx.convoId) props.convo_id = ctx.convoId;
|
|
29
|
-
if (ctx.eventId) props.event_id = ctx.eventId;
|
|
30
|
-
if (ctx.event) props.event_name = ctx.event;
|
|
31
|
-
return props;
|
|
32
|
-
}
|
|
33
|
-
function createInteractionApi(initial, traceContent, onClose) {
|
|
34
|
-
const ctx = {
|
|
35
|
-
...initial,
|
|
36
|
-
eventId: initial.eventId ?? uuid()
|
|
37
|
-
};
|
|
38
|
-
const properties = { ...initial.properties ?? {} };
|
|
39
|
-
let input = initial.input;
|
|
40
|
-
let workflowSpan = null;
|
|
41
|
-
let finished = false;
|
|
42
|
-
const withAssoc = (fn) => traceloop.withAssociationProperties(associationProps(ctx, properties), fn);
|
|
43
|
-
const workflowName = () => ctx.event ?? "interaction";
|
|
44
|
-
function ensureWorkflowSpan() {
|
|
45
|
-
if (workflowSpan) return workflowSpan;
|
|
46
|
-
const span = traceloop.getTraceloopTracer().startSpan(workflowName());
|
|
47
|
-
span.setAttribute(SPAN_KIND, "workflow");
|
|
48
|
-
for (const [k, v] of Object.entries(associationProps(ctx, properties))) {
|
|
49
|
-
span.setAttribute(ASSOC + k, v);
|
|
50
|
-
}
|
|
51
|
-
if (traceContent && input) span.setAttribute(ENTITY_INPUT, input);
|
|
52
|
-
workflowSpan = span;
|
|
53
|
-
return span;
|
|
54
|
-
}
|
|
55
|
-
function withWorkflowContext(fn) {
|
|
56
|
-
return withAssoc(() => {
|
|
57
|
-
const span = ensureWorkflowSpan();
|
|
58
|
-
return context.with(trace.setSpan(context.active(), span), fn);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function closeWorkflowSpan(apply) {
|
|
62
|
-
if (finished) return;
|
|
63
|
-
withAssoc(() => {
|
|
64
|
-
const span = ensureWorkflowSpan();
|
|
65
|
-
apply(span);
|
|
66
|
-
span.end();
|
|
67
|
-
});
|
|
68
|
-
workflowSpan = null;
|
|
69
|
-
finished = true;
|
|
70
|
-
onClose?.(ctx.eventId);
|
|
71
|
-
}
|
|
72
|
-
function failWorkflowSpan(err) {
|
|
73
|
-
const e = err instanceof Error ? err : new Error(String(err));
|
|
74
|
-
closeWorkflowSpan((span) => {
|
|
75
|
-
span.recordException(e);
|
|
76
|
-
span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
|
|
77
|
-
if (traceContent) span.setAttribute(ENTITY_OUTPUT, `ERROR: ${e.message}`);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
const toolName = (p) => typeof p === "string" ? p : p.name;
|
|
81
|
-
function startToolSpan(params) {
|
|
82
|
-
const name = toolName(params);
|
|
83
|
-
const span = traceloop.getTraceloopTracer().startSpan(name);
|
|
84
|
-
span.setAttribute(SPAN_KIND, "tool");
|
|
85
|
-
span.setAttribute(ENTITY_NAME, name);
|
|
86
|
-
for (const [k, v] of Object.entries(associationProps(ctx, properties))) {
|
|
87
|
-
span.setAttribute(ASSOC + k, v);
|
|
88
|
-
}
|
|
89
|
-
if (typeof params !== "string" && params.properties) {
|
|
90
|
-
for (const [k, v] of Object.entries(params.properties)) span.setAttribute(k, v);
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
setInput(value) {
|
|
94
|
-
if (traceContent) span.setAttribute(ENTITY_INPUT, asString(value));
|
|
95
|
-
},
|
|
96
|
-
setOutput(value) {
|
|
97
|
-
if (traceContent) span.setAttribute(ENTITY_OUTPUT, asString(value));
|
|
98
|
-
},
|
|
99
|
-
setError(error) {
|
|
100
|
-
const e = typeof error === "string" ? new Error(error) : error;
|
|
101
|
-
span.recordException(e);
|
|
102
|
-
span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });
|
|
103
|
-
},
|
|
104
|
-
end() {
|
|
105
|
-
span.end();
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
getEventId: () => ctx.eventId,
|
|
111
|
-
setInput(value) {
|
|
112
|
-
input = value;
|
|
113
|
-
},
|
|
114
|
-
setProperty(key, value) {
|
|
115
|
-
properties[key] = value;
|
|
116
|
-
},
|
|
117
|
-
setProperties(props) {
|
|
118
|
-
Object.assign(properties, props);
|
|
119
|
-
},
|
|
120
|
-
vercelAiSdkMetadata() {
|
|
121
|
-
return metadata({
|
|
122
|
-
userId: ctx.userId ?? "unknown",
|
|
123
|
-
convoId: ctx.convoId,
|
|
124
|
-
eventName: ctx.event,
|
|
125
|
-
eventId: ctx.eventId,
|
|
126
|
-
properties
|
|
127
|
-
});
|
|
128
|
-
},
|
|
129
|
-
async run(fn) {
|
|
130
|
-
try {
|
|
131
|
-
return await Promise.resolve(withWorkflowContext(fn));
|
|
132
|
-
} catch (err) {
|
|
133
|
-
failWorkflowSpan(err);
|
|
134
|
-
throw err;
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
withSpan(params, fn) {
|
|
138
|
-
const name = typeof params === "string" ? params : params.name;
|
|
139
|
-
return Promise.resolve(withWorkflowContext(() => traceloop.withTask({ name }, fn)));
|
|
140
|
-
},
|
|
141
|
-
withTool(params, fn) {
|
|
142
|
-
const name = toolName(params);
|
|
143
|
-
const version = typeof params === "string" ? void 0 : params.version;
|
|
144
|
-
return Promise.resolve(withWorkflowContext(() => traceloop.withTool({ name, version }, fn)));
|
|
145
|
-
},
|
|
146
|
-
startToolSpan,
|
|
147
|
-
trackTool(params) {
|
|
148
|
-
const span = startToolSpan({ name: params.name, properties: params.properties });
|
|
149
|
-
if (params.input !== void 0) span.setInput(params.input);
|
|
150
|
-
if (params.output !== void 0) span.setOutput(params.output);
|
|
151
|
-
if (params.error) span.setError(params.error);
|
|
152
|
-
span.end();
|
|
153
|
-
},
|
|
154
|
-
async finish(opts) {
|
|
155
|
-
const output = typeof opts === "string" ? opts : opts.output;
|
|
156
|
-
if (typeof opts !== "string" && opts.properties) Object.assign(properties, opts.properties);
|
|
157
|
-
closeWorkflowSpan((span) => {
|
|
158
|
-
if (traceContent) span.setAttribute(ENTITY_OUTPUT, output);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function createNoopInteraction(initial) {
|
|
164
|
-
const ctx = {
|
|
165
|
-
...initial,
|
|
166
|
-
eventId: initial.eventId ?? uuid()
|
|
167
|
-
};
|
|
168
|
-
const properties = { ...initial.properties ?? {} };
|
|
169
|
-
const noopToolSpan = { setInput() {
|
|
170
|
-
}, setOutput() {
|
|
171
|
-
}, setError() {
|
|
172
|
-
}, end() {
|
|
173
|
-
} };
|
|
174
|
-
return {
|
|
175
|
-
getEventId: () => ctx.eventId,
|
|
176
|
-
setInput() {
|
|
177
|
-
},
|
|
178
|
-
setProperty(key, value) {
|
|
179
|
-
properties[key] = value;
|
|
180
|
-
},
|
|
181
|
-
setProperties(props) {
|
|
182
|
-
Object.assign(properties, props);
|
|
183
|
-
},
|
|
184
|
-
vercelAiSdkMetadata() {
|
|
185
|
-
return metadata({
|
|
186
|
-
userId: ctx.userId ?? "unknown",
|
|
187
|
-
convoId: ctx.convoId,
|
|
188
|
-
eventName: ctx.event,
|
|
189
|
-
eventId: ctx.eventId,
|
|
190
|
-
properties
|
|
191
|
-
});
|
|
192
|
-
},
|
|
193
|
-
async run(fn) {
|
|
194
|
-
return await fn();
|
|
195
|
-
},
|
|
196
|
-
async withSpan(_params, fn) {
|
|
197
|
-
return await fn();
|
|
198
|
-
},
|
|
199
|
-
async withTool(_params, fn) {
|
|
200
|
-
return await fn();
|
|
201
|
-
},
|
|
202
|
-
startToolSpan: () => noopToolSpan,
|
|
203
|
-
trackTool() {
|
|
204
|
-
},
|
|
205
|
-
async finish() {
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export {
|
|
211
|
-
createInteractionApi,
|
|
212
|
-
createNoopInteraction
|
|
213
|
-
};
|
|
214
|
-
//# sourceMappingURL=chunk-IDMKQWQG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tracing/interaction.ts"],"sourcesContent":["/**\n * Morph Tracing — interactions, tools, and manual spans.\n *\n * An `Interaction` is one user turn / agent run. It threads association\n * properties (user_id / convo_id / event_id) onto every span created inside it —\n * including the auto-instrumented LLM spans — so a whole conversation stitches\n * together in the Morph UI. Built on Traceloop's `withTask` / `withTool` and a\n * manual tracer for already-completed tool spans.\n */\nimport { context, SpanStatusCode, trace, type Span } from '@opentelemetry/api';\nimport * as traceloop from '@traceloop/node-server-sdk';\n\nimport { metadata as buildMetadata } from './otel.js';\nimport type {\n FinishOptions,\n SpanParams,\n ToolParams,\n ToolSpan,\n TrackToolParams,\n TraceContext,\n} from './types.js';\n\n// Traceloop semantic-convention attribute keys.\nconst ASSOC = 'traceloop.association.properties.';\nconst ENTITY_INPUT = 'traceloop.entity.input';\nconst ENTITY_OUTPUT = 'traceloop.entity.output';\nconst ENTITY_NAME = 'traceloop.entity.name';\nconst SPAN_KIND = 'traceloop.span.kind';\n\nfunction uuid(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) return c.randomUUID();\n return 'xxxxxxxxxxxx4xxxyxxx'.replace(/[xy]/g, (ch) => {\n const r = (Math.random() * 16) | 0;\n return (ch === 'x' ? r : (r & 0x3) | 0x8).toString(16);\n });\n}\n\nfunction asString(v: unknown): string {\n if (v == null) return '';\n return typeof v === 'string' ? v : JSON.stringify(v);\n}\n\nexport interface Interaction {\n getEventId(): string | undefined;\n setInput(input: string): void;\n setProperty(key: string, value: string): void;\n setProperties(props: Record<string, string>): void;\n /**\n * Run `fn` with this interaction's association properties active — required so\n * auto-instrumented OpenAI/Anthropic spans inherit user_id / convo_id / tags.\n */\n run<T>(fn: () => Promise<T> | T): Promise<T>;\n /** Run `fn` inside a traced task span; LLM calls within inherit attribution. */\n withSpan<T>(params: SpanParams | string, fn: () => Promise<T> | T): Promise<T>;\n /** Run `fn` inside a traced tool span. */\n withTool<T>(params: ToolParams | string, fn: () => Promise<T> | T): Promise<T>;\n /** Start a tool span you end manually. */\n startToolSpan(params: ToolParams | string): ToolSpan;\n /** Record an already-completed tool invocation. */\n trackTool(params: TrackToolParams): void;\n /** Metadata for the Vercel AI SDK `experimental_telemetry.metadata`. */\n vercelAiSdkMetadata(): Record<string, string>;\n /** End the interaction with its final output. */\n finish(opts: FinishOptions | string): Promise<void>;\n}\n\nexport type Tracer = Pick<Interaction, 'withSpan' | 'withTool' | 'startToolSpan' | 'trackTool'>;\n\n/** Build the association-property bag Traceloop propagates onto child spans. */\nfunction associationProps(\n ctx: TraceContext & { userId?: string },\n extra: Record<string, string>,\n): Record<string, string> {\n const props: Record<string, string> = { ...extra };\n if (ctx.userId) props.user_id = ctx.userId;\n if (ctx.convoId) props.convo_id = ctx.convoId;\n if (ctx.eventId) props.event_id = ctx.eventId;\n if (ctx.event) props.event_name = ctx.event;\n return props;\n}\n\nexport function createInteractionApi(\n initial: TraceContext & { userId?: string },\n traceContent: boolean,\n onClose?: (eventId: string) => void,\n): Interaction {\n const ctx: TraceContext & { userId?: string } = {\n ...initial,\n eventId: initial.eventId ?? uuid(),\n };\n const properties: Record<string, string> = { ...(initial.properties ?? {}) };\n let input = initial.input;\n let workflowSpan: Span | null = null;\n let finished = false;\n\n const withAssoc = <T>(fn: () => Promise<T> | T): Promise<T> | T =>\n traceloop.withAssociationProperties(associationProps(ctx, properties), fn);\n\n const workflowName = () => ctx.event ?? 'interaction';\n\n /** Open the interaction workflow span once; stays active until finish(). */\n function ensureWorkflowSpan(): Span {\n if (workflowSpan) return workflowSpan;\n const span = traceloop.getTraceloopTracer().startSpan(workflowName());\n span.setAttribute(SPAN_KIND, 'workflow');\n for (const [k, v] of Object.entries(associationProps(ctx, properties))) {\n span.setAttribute(ASSOC + k, v);\n }\n if (traceContent && input) span.setAttribute(ENTITY_INPUT, input);\n workflowSpan = span;\n return span;\n }\n\n /** Run fn with association props and the workflow span as the active parent. */\n function withWorkflowContext<T>(fn: () => Promise<T> | T): Promise<T> | T {\n return withAssoc(() => {\n const span = ensureWorkflowSpan();\n return context.with(trace.setSpan(context.active(), span), fn);\n });\n }\n\n /** Close the workflow span exactly once, applying final attributes. */\n function closeWorkflowSpan(apply: (span: Span) => void): void {\n if (finished) return;\n withAssoc(() => {\n const span = ensureWorkflowSpan();\n apply(span);\n span.end();\n });\n workflowSpan = null;\n finished = true;\n onClose?.(ctx.eventId!);\n }\n\n /** Record an exception + ERROR status on the workflow span, then close it. */\n function failWorkflowSpan(err: unknown): void {\n const e = err instanceof Error ? err : new Error(String(err));\n closeWorkflowSpan((span) => {\n span.recordException(e);\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n if (traceContent) span.setAttribute(ENTITY_OUTPUT, `ERROR: ${e.message}`);\n });\n }\n\n const toolName = (p: ToolParams | string) => (typeof p === 'string' ? p : p.name);\n\n function startToolSpan(params: ToolParams | string): ToolSpan {\n const name = toolName(params);\n const span: Span = traceloop.getTraceloopTracer().startSpan(name);\n span.setAttribute(SPAN_KIND, 'tool');\n span.setAttribute(ENTITY_NAME, name);\n for (const [k, v] of Object.entries(associationProps(ctx, properties))) {\n span.setAttribute(ASSOC + k, v);\n }\n if (typeof params !== 'string' && params.properties) {\n for (const [k, v] of Object.entries(params.properties)) span.setAttribute(k, v);\n }\n return {\n setInput(value: unknown) {\n if (traceContent) span.setAttribute(ENTITY_INPUT, asString(value));\n },\n setOutput(value: unknown) {\n if (traceContent) span.setAttribute(ENTITY_OUTPUT, asString(value));\n },\n setError(error: Error | string) {\n const e = typeof error === 'string' ? new Error(error) : error;\n span.recordException(e);\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n },\n end() {\n span.end();\n },\n };\n }\n\n return {\n getEventId: () => ctx.eventId,\n setInput(value: string) {\n input = value;\n },\n setProperty(key: string, value: string) {\n properties[key] = value;\n },\n setProperties(props: Record<string, string>) {\n Object.assign(properties, props);\n },\n vercelAiSdkMetadata() {\n return buildMetadata({\n userId: ctx.userId ?? 'unknown',\n convoId: ctx.convoId,\n eventName: ctx.event,\n eventId: ctx.eventId,\n properties,\n });\n },\n async run(fn) {\n try {\n return await Promise.resolve(withWorkflowContext(fn));\n } catch (err) {\n // Natively record the failure on the workflow span and ship it, so a\n // throwing interaction still lands in the trace as an errored span.\n failWorkflowSpan(err);\n throw err;\n }\n },\n withSpan(params, fn) {\n const name = typeof params === 'string' ? params : params.name;\n return Promise.resolve(withWorkflowContext(() => traceloop.withTask({ name }, fn)));\n },\n withTool(params, fn) {\n const name = toolName(params);\n const version = typeof params === 'string' ? undefined : params.version;\n return Promise.resolve(withWorkflowContext(() => traceloop.withTool({ name, version }, fn)));\n },\n startToolSpan,\n trackTool(params: TrackToolParams) {\n const span = startToolSpan({ name: params.name, properties: params.properties });\n if (params.input !== undefined) span.setInput(params.input);\n if (params.output !== undefined) span.setOutput(params.output);\n if (params.error) span.setError(params.error);\n span.end();\n },\n async finish(opts) {\n const output = typeof opts === 'string' ? opts : opts.output;\n if (typeof opts !== 'string' && opts.properties) Object.assign(properties, opts.properties);\n // No-op if run() already closed the span on error; otherwise end it now.\n // (Creates one if finish() is called alone, i.e. begin() → finish().)\n closeWorkflowSpan((span) => {\n if (traceContent) span.setAttribute(ENTITY_OUTPUT, output);\n });\n },\n };\n}\n\n/**\n * Inert Interaction for disabled instances. Preserves control flow — run() /\n * withTool() still execute their callback and rethrow errors — but never touches\n * the tracer. Required because the OTel provider is a process-wide singleton: a\n * disabled instance that created real spans would ship them through whichever\n * enabled instance registered the provider.\n */\nexport function createNoopInteraction(initial: TraceContext & { userId?: string }): Interaction {\n const ctx: TraceContext & { userId?: string } = {\n ...initial,\n eventId: initial.eventId ?? uuid(),\n };\n const properties: Record<string, string> = { ...(initial.properties ?? {}) };\n const noopToolSpan: ToolSpan = { setInput() {}, setOutput() {}, setError() {}, end() {} };\n\n return {\n getEventId: () => ctx.eventId,\n setInput() {},\n setProperty(key: string, value: string) {\n properties[key] = value;\n },\n setProperties(props: Record<string, string>) {\n Object.assign(properties, props);\n },\n vercelAiSdkMetadata() {\n return buildMetadata({\n userId: ctx.userId ?? 'unknown',\n convoId: ctx.convoId,\n eventName: ctx.event,\n eventId: ctx.eventId,\n properties,\n });\n },\n async run(fn) {\n return await fn();\n },\n async withSpan(_params, fn) {\n return await fn();\n },\n async withTool(_params, fn) {\n return await fn();\n },\n startToolSpan: () => noopToolSpan,\n trackTool() {},\n async finish() {},\n };\n}\n"],"mappings":";;;;;AASA,SAAS,SAAS,gBAAgB,aAAwB;AAC1D,YAAY,eAAe;AAa3B,IAAM,QAAQ;AACd,IAAM,eAAe;AACrB,IAAM,gBAAgB;AACtB,IAAM,cAAc;AACpB,IAAM,YAAY;AAElB,SAAS,OAAe;AACtB,QAAM,IAAK,WAA0D;AACrE,MAAI,GAAG,WAAY,QAAO,EAAE,WAAW;AACvC,SAAO,uBAAuB,QAAQ,SAAS,CAAC,OAAO;AACrD,UAAM,IAAK,KAAK,OAAO,IAAI,KAAM;AACjC,YAAQ,OAAO,MAAM,IAAK,IAAI,IAAO,GAAK,SAAS,EAAE;AAAA,EACvD,CAAC;AACH;AAEA,SAAS,SAAS,GAAoB;AACpC,MAAI,KAAK,KAAM,QAAO;AACtB,SAAO,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC;AACrD;AA6BA,SAAS,iBACP,KACA,OACwB;AACxB,QAAM,QAAgC,EAAE,GAAG,MAAM;AACjD,MAAI,IAAI,OAAQ,OAAM,UAAU,IAAI;AACpC,MAAI,IAAI,QAAS,OAAM,WAAW,IAAI;AACtC,MAAI,IAAI,QAAS,OAAM,WAAW,IAAI;AACtC,MAAI,IAAI,MAAO,OAAM,aAAa,IAAI;AACtC,SAAO;AACT;AAEO,SAAS,qBACd,SACA,cACA,SACa;AACb,QAAM,MAA0C;AAAA,IAC9C,GAAG;AAAA,IACH,SAAS,QAAQ,WAAW,KAAK;AAAA,EACnC;AACA,QAAM,aAAqC,EAAE,GAAI,QAAQ,cAAc,CAAC,EAAG;AAC3E,MAAI,QAAQ,QAAQ;AACpB,MAAI,eAA4B;AAChC,MAAI,WAAW;AAEf,QAAM,YAAY,CAAI,OACV,oCAA0B,iBAAiB,KAAK,UAAU,GAAG,EAAE;AAE3E,QAAM,eAA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AC,EAAG;AAC3E,QAAM,eAAyB,EAAE,WAAW;AAAA,EAAC,GAAG,YAAY;AAAA,EAAC,GAAG,WAAW;AAAA,EAAC,GAAG,MAAM;AAAA,EAAC,EAAE;AAExF,SAAO;AAAA,IACL,YAAY,MAAM,IAAI;AAAA,IACtB,WAAW;AAAA,IAAC;AAAA,IACZ,YAAY,KAAa,OAAe;AACtC,iBAAW,GAAG,IAAI;AAAA,IACpB;AAAA,IACA,cAAc,OAA+B;AAC3C,aAAO,OAAO,YAAY,KAAK;AAAA,IACjC;AAAA,IACA,sBAAsB;AACpB,aAAO,SAAc;AAAA,QACnB,QAAQ,IAAI,UAAU;AAAA,QACtB,SAAS,IAAI;AAAA,QACb,WAAW,IAAI;AAAA,QACf,SAAS,IAAI;AAAA,QACb;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,MAAM,IAAI,IAAI;AACZ,aAAO,MAAM,GAAG;AAAA,IAClB;AAAA,IACA,MAAM,SAAS,SAAS,IAAI;AAC1B,aAAO,MAAM,GAAG;AAAA,IAClB;AAAA,IACA,MAAM,SAAS,SAAS,IAAI;AAC1B,aAAO,MAAM,GAAG;AAAA,IAClB;AAAA,IACA,eAAe,MAAM;AAAA,IACrB,YAAY;AAAA,IAAC;AAAA,IACb,MAAM,SAAS;AAAA,IAAC;AAAA,EAClB;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../version.ts"],"sourcesContent":["{\n \"name\": \"@morphllm/morphsdk\",\n \"version\": \"0.2.199\",\n \"description\": \"TypeScript SDK and CLI for Morph Fast Apply integration\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./logger\": {\n \"types\": \"./dist/logger.d.ts\",\n \"import\": \"./dist/logger.js\",\n \"require\": \"./dist/logger.cjs\"\n },\n \"./edge\": {\n \"types\": \"./dist/edge.d.ts\",\n \"import\": \"./dist/edge.js\",\n \"require\": \"./dist/edge.cjs\"\n },\n \"./tools/warp-grep\": {\n \"types\": \"./dist/tools/warp_grep/index.d.ts\",\n \"import\": \"./dist/tools/warp_grep/index.js\",\n \"require\": \"./dist/tools/warp_grep/index.cjs\"\n },\n \"./tools/warp-grep/openai\": {\n \"types\": \"./dist/tools/warp_grep/openai.d.ts\",\n \"import\": \"./dist/tools/warp_grep/openai.js\",\n \"require\": \"./dist/tools/warp_grep/openai.cjs\"\n },\n \"./tools/warp-grep/anthropic\": {\n \"types\": \"./dist/tools/warp_grep/anthropic.d.ts\",\n \"import\": \"./dist/tools/warp_grep/anthropic.js\",\n \"require\": \"./dist/tools/warp_grep/anthropic.cjs\"\n },\n \"./tools/warp-grep/vercel\": {\n \"types\": \"./dist/tools/warp_grep/vercel.d.ts\",\n \"import\": \"./dist/tools/warp_grep/vercel.js\",\n \"require\": \"./dist/tools/warp_grep/vercel.cjs\"\n },\n \"./tools/warp-grep/client\": {\n \"types\": \"./dist/tools/warp_grep/client.d.ts\",\n \"import\": \"./dist/tools/warp_grep/client.js\",\n \"require\": \"./dist/tools/warp_grep/client.cjs\"\n },\n \"./tools/warp-grep/gemini\": {\n \"types\": \"./dist/tools/warp_grep/gemini.d.ts\",\n \"import\": \"./dist/tools/warp_grep/gemini.js\",\n \"require\": \"./dist/tools/warp_grep/gemini.cjs\"\n },\n \"./tools/warp-grep/harness\": {\n \"types\": \"./dist/tools/warp_grep/harness.d.ts\",\n \"import\": \"./dist/tools/warp_grep/harness.js\",\n \"require\": \"./dist/tools/warp_grep/harness.cjs\"\n },\n \"./tracing\": {\n \"types\": \"./dist/tracing/index.d.ts\",\n \"import\": \"./dist/tracing/index.js\",\n \"require\": \"./dist/tracing/index.cjs\"\n },\n \"./tracing/otel\": {\n \"types\": \"./dist/tracing/otel.d.ts\",\n \"import\": \"./dist/tracing/otel.js\",\n \"require\": \"./dist/tracing/otel.cjs\"\n },\n \"./tools/fastapply\": {\n \"types\": \"./dist/tools/fastapply/index.d.ts\",\n \"import\": \"./dist/tools/fastapply/index.js\",\n \"require\": \"./dist/tools/fastapply/index.cjs\"\n },\n \"./tools/fastapply/anthropic\": {\n \"types\": \"./dist/tools/fastapply/anthropic.d.ts\",\n \"import\": \"./dist/tools/fastapply/anthropic.js\",\n \"require\": \"./dist/tools/fastapply/anthropic.cjs\"\n },\n \"./tools/fastapply/openai\": {\n \"types\": \"./dist/tools/fastapply/openai.d.ts\",\n \"import\": \"./dist/tools/fastapply/openai.js\",\n \"require\": \"./dist/tools/fastapply/openai.cjs\"\n },\n \"./tools/fastapply/vercel\": {\n \"types\": \"./dist/tools/fastapply/vercel.d.ts\",\n \"import\": \"./dist/tools/fastapply/vercel.js\",\n \"require\": \"./dist/tools/fastapply/vercel.cjs\"\n },\n \"./tools/codebase-search\": {\n \"types\": \"./dist/tools/codebase_search/index.d.ts\",\n \"import\": \"./dist/tools/codebase_search/index.js\",\n \"require\": \"./dist/tools/codebase_search/index.cjs\"\n },\n \"./tools/codebase-search/anthropic\": {\n \"types\": \"./dist/tools/codebase_search/anthropic.d.ts\",\n \"import\": \"./dist/tools/codebase_search/anthropic.js\",\n \"require\": \"./dist/tools/codebase_search/anthropic.cjs\"\n },\n \"./tools/codebase-search/openai\": {\n \"types\": \"./dist/tools/codebase_search/openai.d.ts\",\n \"import\": \"./dist/tools/codebase_search/openai.js\",\n \"require\": \"./dist/tools/codebase_search/openai.cjs\"\n },\n \"./tools/codebase-search/vercel\": {\n \"types\": \"./dist/tools/codebase_search/vercel.d.ts\",\n \"import\": \"./dist/tools/codebase_search/vercel.js\",\n \"require\": \"./dist/tools/codebase_search/vercel.cjs\"\n },\n \"./modelrouter\": {\n \"types\": \"./dist/modelrouter/index.d.ts\",\n \"import\": \"./dist/modelrouter/index.js\",\n \"require\": \"./dist/modelrouter/index.cjs\"\n },\n \"./tools/compact\": {\n \"types\": \"./dist/tools/compact/index.d.ts\",\n \"import\": \"./dist/tools/compact/index.js\",\n \"require\": \"./dist/tools/compact/index.cjs\"\n },\n \"./subagents\": {\n \"types\": \"./dist/subagents/index.d.ts\",\n \"import\": \"./dist/subagents/index.js\",\n \"require\": \"./dist/subagents/index.cjs\"\n },\n \"./subagents/vercel\": {\n \"types\": \"./dist/subagents/vercel.d.ts\",\n \"import\": \"./dist/subagents/vercel.js\",\n \"require\": \"./dist/subagents/vercel.cjs\"\n },\n \"./subagents/anthropic\": {\n \"types\": \"./dist/subagents/anthropic.d.ts\",\n \"import\": \"./dist/subagents/anthropic.js\",\n \"require\": \"./dist/subagents/anthropic.cjs\"\n },\n \"./ai-sdk\": {\n \"types\": \"./dist/ai-sdk/index.d.ts\",\n \"import\": \"./dist/ai-sdk/index.js\",\n \"require\": \"./dist/ai-sdk/index.cjs\"\n }\n },\n \"files\": [\n \"dist/**/*.js\",\n \"dist/**/*.cjs\",\n \"dist/**/*.d.ts\",\n \"dist/**/*.map\",\n \"!dist/**/__tests__/**\",\n \"!dist/**/*.test.*\"\n ],\n \"scripts\": {\n \"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/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/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 tracing/index.ts tracing/core.ts tracing/interaction.ts tracing/otel.ts tracing/types.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\",\n \"prepare\": \"npm run build\",\n \"typecheck\": \"tsc --noEmit && tsc --noEmit -p ai-sdk/tsconfig.json\",\n \"lint\": \"eslint .\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest watch\",\n \"test:anthropic\": \"vitest run anthropic\",\n \"test:openai\": \"vitest run openai\",\n \"test:vercel\": \"vitest run vercel\",\n \"test:git\": \"vitest run git\",\n \"test:agent\": \"npx tsx tests/fullAgentTest.ts\",\n \"test:integration\": \"npx tsx tests/fullIntegrationTest.ts\",\n \"test:e2e\": \"vitest run --config vitest.e2e.config.ts\",\n \"release:patch\": \"npm version patch && npm publish\",\n \"release:minor\": \"npm version minor && npm publish\",\n \"release:major\": \"npm version major && npm publish\"\n },\n \"keywords\": [\n \"morph\",\n \"fast-apply\",\n \"cli\",\n \"sdk\",\n \"edit-file\"\n ],\n \"engines\": {\n \"node\": \">=18\"\n },\n \"license\": \"MIT\",\n \"dependencies\": {\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/exporter-trace-otlp-http\": \"^0.203.0\",\n \"@opentelemetry/sdk-trace-base\": \"^2.7.1\",\n \"@traceloop/node-server-sdk\": \"^0.27.0\",\n \"@vscode/ripgrep\": \"^1.17.0\",\n \"ai\": \">=5.0.0\",\n \"diff\": \"^7.0.0\",\n \"openai\": \"^4.52.7\",\n \"zod\": \">=3.23.0\"\n },\n \"devDependencies\": {\n \"@ai-sdk/anthropic\": \"^2.0.70\",\n \"@ai-sdk/openai\": \"^2.0.35\",\n \"@anthropic-ai/sdk\": \"^0.30.1\",\n \"@google/generative-ai\": \"^0.24.1\",\n \"@types/diff\": \"^7.0.2\",\n \"@types/node\": \"^20.14.10\",\n \"@typescript-eslint/eslint-plugin\": \"^7.18.0\",\n \"@typescript-eslint/parser\": \"^7.18.0\",\n \"dotenv\": \"^16.4.5\",\n \"eslint\": \"^8.57.0\",\n \"shx\": \"^0.3.4\",\n \"tsup\": \"^8.5.0\",\n \"tsx\": \"^4.16.2\",\n \"typescript\": \"^5.5.4\",\n \"vitest\": \"^2.1.6\"\n },\n \"peerDependencies\": {\n \"@ai-sdk/openai-compatible\": \">=2.0.74 <4\",\n \"@anthropic-ai/sdk\": \">=0.25.0\",\n \"@google/generative-ai\": \">=0.21.0\",\n \"ai\": \">=5.0.0\",\n \"zod\": \">=3.23.0\"\n },\n \"peerDependenciesMeta\": {\n \"@anthropic-ai/sdk\": {\n \"optional\": true\n },\n \"@google/generative-ai\": {\n \"optional\": true\n },\n \"ai\": {\n \"optional\": true\n },\n \"zod\": {\n \"optional\": true\n }\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","import pkg from './package.json' with { type: 'json' };\nexport const SDK_VERSION: string = pkg.version;\n"],"mappings":";AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW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_SEARCH_SYSTEM_PROMPT
|
|
4
|
-
} from "./chunk-YQMPVJ2L.js";
|
|
5
|
-
import {
|
|
6
|
-
executeCodebaseSearch
|
|
7
|
-
} from "./chunk-VS5F2ORN.js";
|
|
8
|
-
|
|
9
|
-
// tools/codebase_search/openai.ts
|
|
10
|
-
var codebaseSearchTool = {
|
|
11
|
-
type: "function",
|
|
12
|
-
function: {
|
|
13
|
-
name: "codebase_search",
|
|
14
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
15
|
-
parameters: {
|
|
16
|
-
type: "object",
|
|
17
|
-
properties: {
|
|
18
|
-
query: {
|
|
19
|
-
type: "string",
|
|
20
|
-
description: 'A complete question or description 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?"'
|
|
21
|
-
},
|
|
22
|
-
target_directories: {
|
|
23
|
-
type: "array",
|
|
24
|
-
items: { type: "string" },
|
|
25
|
-
description: "Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo."
|
|
26
|
-
},
|
|
27
|
-
explanation: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal."
|
|
30
|
-
},
|
|
31
|
-
limit: {
|
|
32
|
-
type: "number",
|
|
33
|
-
description: "Maximum results to return (default: 10)"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
required: ["query", "target_directories", "explanation"]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
function createCodebaseSearchTool(config) {
|
|
41
|
-
const toolDefinition = {
|
|
42
|
-
type: "function",
|
|
43
|
-
function: {
|
|
44
|
-
name: "codebase_search",
|
|
45
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
46
|
-
parameters: {
|
|
47
|
-
type: "object",
|
|
48
|
-
properties: {
|
|
49
|
-
query: {
|
|
50
|
-
type: "string",
|
|
51
|
-
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?"'
|
|
52
|
-
},
|
|
53
|
-
target_directories: {
|
|
54
|
-
type: "array",
|
|
55
|
-
items: { type: "string" },
|
|
56
|
-
description: "Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo."
|
|
57
|
-
},
|
|
58
|
-
explanation: {
|
|
59
|
-
type: "string",
|
|
60
|
-
description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal."
|
|
61
|
-
},
|
|
62
|
-
limit: {
|
|
63
|
-
type: "number",
|
|
64
|
-
description: "Maximum results to return (default: 10)"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
required: ["query", "target_directories", "explanation"]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
return Object.assign(toolDefinition, {
|
|
72
|
-
execute: async (input) => {
|
|
73
|
-
const parsedInput = typeof input === "string" ? JSON.parse(input) : input;
|
|
74
|
-
return executeCodebaseSearch(parsedInput, config);
|
|
75
|
-
},
|
|
76
|
-
formatResult: (result) => {
|
|
77
|
-
return formatResult(result);
|
|
78
|
-
},
|
|
79
|
-
getSystemPrompt: () => {
|
|
80
|
-
return CODEBASE_SEARCH_SYSTEM_PROMPT;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
async function execute(input, config) {
|
|
85
|
-
return executeCodebaseSearch(input, config);
|
|
86
|
-
}
|
|
87
|
-
function formatResult(result) {
|
|
88
|
-
if (!result.success) {
|
|
89
|
-
return `Search failed: ${result.error}`;
|
|
90
|
-
}
|
|
91
|
-
if (result.results.length === 0) {
|
|
92
|
-
return "No matching code found. Try rephrasing your query or removing directory filters.";
|
|
93
|
-
}
|
|
94
|
-
const lines = [];
|
|
95
|
-
lines.push(`Found ${result.results.length} relevant code sections (${result.stats.searchTimeMs}ms):
|
|
96
|
-
`);
|
|
97
|
-
result.results.forEach((r, i) => {
|
|
98
|
-
const relevance = (r.rerankScore * 100).toFixed(1);
|
|
99
|
-
lines.push(`${i + 1}. ${r.filepath} (${relevance}% relevant)`);
|
|
100
|
-
lines.push(` Symbol: ${r.symbolPath}`);
|
|
101
|
-
lines.push(` Language: ${r.language}`);
|
|
102
|
-
lines.push(` Lines: ${r.startLine}-${r.endLine}`);
|
|
103
|
-
lines.push(` Code:`);
|
|
104
|
-
const codeLines = r.content.split("\n");
|
|
105
|
-
codeLines.slice(0, Math.min(codeLines.length, 20)).forEach((line) => {
|
|
106
|
-
lines.push(` ${line}`);
|
|
107
|
-
});
|
|
108
|
-
if (codeLines.length > 20) {
|
|
109
|
-
lines.push(` ... (${codeLines.length - 20} more lines)`);
|
|
110
|
-
}
|
|
111
|
-
lines.push("");
|
|
112
|
-
});
|
|
113
|
-
return lines.join("\n");
|
|
114
|
-
}
|
|
115
|
-
function getSystemPrompt() {
|
|
116
|
-
return CODEBASE_SEARCH_SYSTEM_PROMPT;
|
|
117
|
-
}
|
|
118
|
-
var openai_default = { createCodebaseSearchTool, execute, formatResult, getSystemPrompt };
|
|
119
|
-
|
|
120
|
-
export {
|
|
121
|
-
codebaseSearchTool,
|
|
122
|
-
createCodebaseSearchTool,
|
|
123
|
-
execute,
|
|
124
|
-
formatResult,
|
|
125
|
-
getSystemPrompt,
|
|
126
|
-
openai_default
|
|
127
|
-
};
|
|
128
|
-
//# sourceMappingURL=chunk-K2JR2NFQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/codebase_search/openai.ts"],"sourcesContent":["/**\n * OpenAI SDK adapter for codebase_search tool\n */\n\nimport type { ChatCompletionTool } from 'openai/resources/chat/completions';\nimport { executeCodebaseSearch } from './core.js';\nimport { CODEBASE_SEARCH_DESCRIPTION, CODEBASE_SEARCH_SYSTEM_PROMPT } from './prompts.js';\nimport type { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './types.js';\n\n/**\n * Direct codebase_search tool definition\n * Use this when you want to pass config at execute time\n */\nexport const codebaseSearchTool: ChatCompletionTool = {\n type: 'function',\n function: {\n name: 'codebase_search',\n description: CODEBASE_SEARCH_DESCRIPTION,\n parameters: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description: 'A complete question or description 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?\"',\n },\n target_directories: {\n type: 'array',\n items: { type: 'string' },\n description: 'Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo.',\n },\n explanation: {\n type: 'string',\n description: 'One sentence explanation as to why this tool is being used, and how it contributes to the goal.',\n },\n limit: {\n type: 'number',\n description: 'Maximum results to return (default: 10)',\n },\n },\n required: ['query', 'target_directories', 'explanation'],\n },\n },\n};\n\n/**\n * Create OpenAI-native codebase_search tool with execute and formatResult methods\n * \n * @param config - Configuration with repoId\n * @returns OpenAI ChatCompletionTool definition with methods\n * \n * @example\n * ```ts\n * import OpenAI from 'openai';\n * import { createCodebaseSearchTool } from 'morphsdk/tools/openai';\n * \n * const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });\n * const tool = createCodebaseSearchTool({ repoId: 'my-project' });\n * \n * const response = await client.chat.completions.create({\n * model: \"gpt-4o\",\n * tools: [tool], // tool itself is the ChatCompletionTool\n * messages: [{ role: \"user\", content: \"Find authentication code\" }]\n * });\n * \n * // Execute and format\n * const result = await tool.execute(toolCallArgs);\n * const formatted = tool.formatResult(result);\n * ```\n */\nexport function createCodebaseSearchTool(config: CodebaseSearchConfig) {\n const toolDefinition: ChatCompletionTool = {\n type: 'function',\n function: {\n name: 'codebase_search',\n description: CODEBASE_SEARCH_DESCRIPTION,\n parameters: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n 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?\"',\n },\n target_directories: {\n type: 'array',\n items: { type: 'string' },\n description: 'Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo.',\n },\n explanation: {\n type: 'string',\n description: 'One sentence explanation as to why this tool is being used, and how it contributes to the goal.',\n },\n limit: {\n type: 'number',\n description: 'Maximum results to return (default: 10)',\n },\n },\n required: ['query', 'target_directories', 'explanation'],\n },\n },\n };\n\n return Object.assign(toolDefinition, {\n execute: async (input: CodebaseSearchInput | string): Promise<CodebaseSearchResult> => {\n const parsedInput = typeof input === 'string' ? JSON.parse(input) : input;\n return executeCodebaseSearch(parsedInput, config);\n },\n formatResult: (result: CodebaseSearchResult): string => {\n return formatResult(result);\n },\n getSystemPrompt: (): string => {\n return CODEBASE_SEARCH_SYSTEM_PROMPT;\n },\n });\n}\n\n/**\n * Execute codebase_search tool call\n * \n * @param input - Tool input from GPT (parsed from tool_calls)\n * @param config - Configuration with repoId (REQUIRED)\n * @returns Search results\n * \n * @example\n * ```ts\n * // Handle tool calls from GPT:\n * if (response.choices[0].message.tool_calls) {\n * for (const toolCall of response.choices[0].message.tool_calls) {\n * const args = JSON.parse(toolCall.function.arguments);\n * const result = await execute(args, { repoId: 'my-project' });\n * console.log(`Found ${result.results.length} matches`);\n * }\n * }\n * ```\n */\nexport async function execute(\n input: CodebaseSearchInput,\n config: CodebaseSearchConfig\n): Promise<CodebaseSearchResult> {\n return executeCodebaseSearch(input, config);\n}\n\n/**\n * Format search results for GPT\n * \n * @param result - Search result from endpoint\n * @returns Formatted string for tool message\n */\nexport function formatResult(result: CodebaseSearchResult): string {\n if (!result.success) {\n return `Search failed: ${result.error}`;\n }\n\n if (result.results.length === 0) {\n return 'No matching code found. Try rephrasing your query or removing directory filters.';\n }\n\n const lines: string[] = [];\n \n lines.push(`Found ${result.results.length} relevant code sections (${result.stats.searchTimeMs}ms):\\n`);\n\n result.results.forEach((r, i) => {\n const relevance = (r.rerankScore * 100).toFixed(1);\n lines.push(`${i + 1}. ${r.filepath} (${relevance}% relevant)`);\n lines.push(` Symbol: ${r.symbolPath}`);\n lines.push(` Language: ${r.language}`);\n lines.push(` Lines: ${r.startLine}-${r.endLine}`);\n lines.push(` Code:`);\n \n // Show code content\n const codeLines = r.content.split('\\n');\n codeLines.slice(0, Math.min(codeLines.length, 20)).forEach(line => {\n lines.push(` ${line}`);\n });\n \n if (codeLines.length > 20) {\n lines.push(` ... (${codeLines.length - 20} more lines)`);\n }\n \n lines.push('');\n });\n\n return lines.join('\\n');\n}\n\n/**\n * Get the system prompt for codebase_search usage\n * \n * @returns System prompt to guide GPT\n */\nexport function getSystemPrompt(): string {\n return CODEBASE_SEARCH_SYSTEM_PROMPT;\n}\n\n/**\n * Default export for convenience\n */\nexport default { createCodebaseSearchTool, execute, formatResult, getSystemPrompt };\n\n"],"mappings":";;;;;;;;;AAaO,IAAM,qBAAyC;AAAA,EACpD,MAAM;AAAA,EACN,UAAU;AAAA,IACR,MAAM;AAAA,IACN,aAAa;AAAA,IACb,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,QACV,OAAO;AAAA,UACL,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,QACA,oBAAoB;AAAA,UAClB,MAAM;AAAA,UACN,OAAO,EAAE,MAAM,SAAS;AAAA,UACxB,aAAa;AAAA,QACf;AAAA,QACA,aAAa;AAAA,UACX,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,QACA,OAAO;AAAA,UACL,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,MACF;AAAA,MACA,UAAU,CAAC,SAAS,sBAAsB,aAAa;AAAA,IACzD;AAAA,EACF;AACF;AA2BO,SAAS,yBAAyB,QAA8B;AACrE,QAAM,iBAAqC;AAAA,IACzC,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,MACb,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,OAAO;AAAA,YACL,MAAM;AAAA,YACN,aAAa;AAAA,UACf;AAAA,UACA,oBAAoB;AAAA,YAClB,MAAM;AAAA,YACN,OAAO,EAAE,MAAM,SAAS;AAAA,YACxB,aAAa;AAAA,UACf;AAAA,UACA,aAAa;A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ACtC,cAAU,MAAM,GAAG,KAAK,IAAI,UAAU,QAAQ,EAAE,CAAC,EAAE,QAAQ,UAAQ;AACjE,YAAM,KAAK,QAAQ,IAAI,EAAE;AAAA,IAC3B,CAAC;AAED,QAAI,UAAU,SAAS,IAAI;AACzB,YAAM,KAAK,aAAa,UAAU,SAAS,EAAE,cAAc;AAAA,IAC7D;AAEA,UAAM,KAAK,EAAE;AAAA,EACf,CAAC;AAED,SAAO,MAAM,KAAK,IAAI;AACxB;AAOO,SAAS,kBAA0B;AACxC,SAAO;AACT;AAKA,IAAO,iBAAQ,EAAE,0BAA0B,SAAS,cAAc,gBAAgB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/warp_grep/client.ts"],"sourcesContent":["/**\n * WarpGrep client for programmatic code search\n */\n\nimport { runWarpGrep, runWarpGrepStreaming } from './agent/runner.js';\nimport { logger } from '../../logger.js';\nimport { RemoteCommandsProvider } from './providers/remote.js';\nimport type { WarpGrepProvider } from './providers/types.js';\nimport type { AgentRunResult, WarpGrepStep } from './agent/types.js';\nimport type {\n WarpGrepClientConfig,\n WarpGrepInput,\n WarpGrepResult,\n WarpGrepContext,\n WarpGrepToolConfig,\n GitHubSearchInput,\n GitHubReadFileInput,\n GitHubReadFileResult,\n RemoteCommands,\n} from './types.js';\nimport { createCodeStorageHttpCommands } from './providers/code_storage_http.js';\nimport { parseGitHubUrl } from './utils/github.js';\nimport { compactFileContexts } from '../compact/utils.js';\nimport { MorphAPIClient } from '../../core/client.js';\nimport { APIResource } from '../../core/resource.js';\n\nconst DEFAULT_CODE_SEARCH_URL = 'https://api.morphllm.com';\n\n/**\n * Lazy-load LocalRipgrepProvider to avoid importing Node.js-specific\n * modules (child_process, fs) in edge environments like Cloudflare Workers.\n * Only loads when actually needed (i.e., when no remoteCommands or provider is specified).\n */\nasync function getLocalProvider(repoRoot: string, excludes?: string[], allowNames?: string[]): Promise<WarpGrepProvider> {\n const { LocalRipgrepProvider } = await import('./providers/local.js');\n const opts = allowNames?.length ? { allowNames } : undefined;\n return new LocalRipgrepProvider(repoRoot, excludes, opts);\n}\n\n/**\n * WarpGrep client for programmatic code search\n * \n * @example\n * ```typescript\n * import { WarpGrepClient } from '@morphllm/morphsdk';\n * \n * const client = new WarpGrepClient({ morphApiKey: process.env.MORPH_API_KEY });\n * \n * // Simple usage - defaults to LocalRipgrepProvider\n * const result = await client.execute({\n * searchTerm: 'Find authentication middleware',\n * repoRoot: '.'\n * });\n *\n * // With custom excludes\n * const result = await client.execute({\n * searchTerm: 'Find database models',\n * repoRoot: '.',\n * excludes: ['node_modules', '.git', 'dist']\n * });\n * ```\n *\n * @deprecated Prefer the unified `MorphClient` (`new MorphClient({ apiKey }).warpGrep`).\n * Standalone clients remain only for backwards compatibility and may be removed in a future\n * major version — do not use them in new code.\n */\nexport class WarpGrepClient extends APIResource {\n private config: WarpGrepClientConfig;\n\n constructor(clientOrConfig: MorphAPIClient | WarpGrepClientConfig = {}) {\n const isClient = clientOrConfig instanceof MorphAPIClient;\n super(\n isClient\n ? clientOrConfig\n : new MorphAPIClient({\n apiKey: clientOrConfig.morphApiKey,\n baseURL: clientOrConfig.morphApiUrl,\n timeout: clientOrConfig.timeout,\n retryConfig: clientOrConfig.retryConfig,\n debug: clientOrConfig.debug,\n }),\n );\n const cfg: WarpGrepClientConfig = isClient ? {} : clientOrConfig;\n // The agent loop talks to /v1/chat/completions through the `openai` package\n // (see agent/runner.ts), sourcing credentials/host/timeout from the transport.\n // `timeout` stays undefined-able so the runner's env-aware default still applies.\n this.config = {\n ...cfg,\n morphApiKey: this._client.resolveApiKey(),\n morphApiUrl: this._client.baseURL,\n timeout: this._client.timeout,\n retryConfig: this._client.retryConfig,\n debug: this._client.debug,\n };\n }\n\n /**\n * Execute a code search\n *\n * @param input - Search parameters including searchTerm, repoRoot, and optional provider\n * @returns Search results with relevant code contexts, or an AsyncGenerator if streamSteps is true\n *\n * @example\n * ```typescript\n * // Standard execution\n * const result = await client.execute({\n * searchTerm: 'Find authentication middleware',\n * repoRoot: '.'\n * });\n *\n * if (result.success) {\n * for (const ctx of result.contexts) {\n * console.log(`File: ${ctx.file}`);\n * console.log(ctx.content);\n * }\n * }\n *\n * // Streaming execution\n * const stream = client.execute({\n * searchTerm: 'Find auth middleware',\n * repoRoot: '.',\n * streamSteps: true\n * });\n *\n * for await (const step of stream) {\n * console.log(`Turn ${step.turn}:`, step.toolCalls);\n * }\n * ```\n */\n execute(input: WarpGrepInput & { streamSteps: true }): AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined>;\n execute(input: WarpGrepInput & { streamSteps?: false | undefined }): Promise<WarpGrepResult>;\n execute(input: WarpGrepInput): Promise<WarpGrepResult> | AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined> {\n const toolConfig: WarpGrepToolConfig = {\n repoRoot: input.repoRoot,\n remoteCommands: input.remoteCommands,\n provider: input.provider,\n excludes: input.excludes,\n includes: input.includes,\n debug: input.debug ?? this.config.debug,\n morphApiKey: this.config.morphApiKey,\n morphApiUrl: this.config.morphApiUrl,\n retryConfig: this.config.retryConfig,\n timeout: this.config.timeout,\n search_type: input.search_type,\n };\n\n if (input.streamSteps) {\n return executeToolCallStreaming({ search_term: input.searchTerm }, toolConfig);\n }\n return executeToolCall({ search_term: input.searchTerm }, toolConfig);\n }\n\n /**\n * Search a public GitHub repository\n *\n * @example\n * ```typescript\n * // Simple usage\n * const result = await client.searchGitHub({\n * searchTerm: 'Find authentication middleware',\n * github: 'vercel/next.js',\n * });\n *\n * // With streaming\n * const stream = client.searchGitHub({\n * searchTerm: 'Find auth middleware',\n * github: 'https://github.com/vercel/next.js',\n * streamSteps: true,\n * });\n * for await (const step of stream) {\n * console.log(`Turn ${step.turn}:`, step.toolCalls);\n * }\n * ```\n */\n searchGitHub(input: GitHubSearchInput & { streamSteps: true }): AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined>;\n searchGitHub(input: GitHubSearchInput & { streamSteps?: false | undefined }): Promise<WarpGrepResult>;\n searchGitHub(input: GitHubSearchInput): Promise<WarpGrepResult> | AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined> {\n if (input.streamSteps) {\n return this._searchGitHubStreaming(input);\n }\n return this._searchGitHubAsync(input);\n }\n\n /**\n * Read a single file from a public GitHub repository\n *\n * @example\n * ```typescript\n * const result = await client.readGitHubFile({\n * github: 'vercel/next.js',\n * path: 'src/server/app-render/index.tsx',\n * startLine: 1,\n * endLine: 50,\n * });\n * if (result.success) console.log(result.content);\n * ```\n */\n async readGitHubFile(input: GitHubReadFileInput): Promise<GitHubReadFileResult> {\n return executeGitHubReadFile(input, { timeout: this.config.timeout });\n }\n\n private async _resolveGitHubRepo(input: GitHubSearchInput): Promise<{ repo: string; remoteCommands: RemoteCommands }> {\n const { owner, repo } = parseGitHubUrl(input.github);\n const baseUrl = this.config.codeSearchUrl || DEFAULT_CODE_SEARCH_URL;\n logger.debug('WarpGrep', 'github_resolve', { owner_repo: `${owner}/${repo}`, branch: input.branch });\n\n const resolveStart = Date.now();\n const importRes = await fetch(`${baseUrl}/api/code-search/get-or-create?url=${encodeURIComponent(`${owner}/${repo}`)}`, {\n headers: this.config.morphApiKey ? { Authorization: `Bearer ${this.config.morphApiKey}` } : undefined,\n });\n if (!importRes.ok) {\n const text = await importRes.text().catch(() => importRes.statusText);\n logger.error('WarpGrep', 'github_resolve_failed', { owner_repo: `${owner}/${repo}`, status: importRes.status, error: text });\n throw new Error(`Failed to import repo ${owner}/${repo}: ${text}`);\n }\n const { repoId, defaultBranch } = await importRes.json();\n logger.debug('WarpGrep', 'github_repo_fetched', { repo_id: repoId, default_branch: defaultBranch, latency_ms: Date.now() - resolveStart });\n\n return {\n repo,\n remoteCommands: createCodeStorageHttpCommands({\n baseUrl,\n repoId,\n branch: input.branch || defaultBranch,\n apiKey: this.config.morphApiKey,\n }),\n };\n }\n\n private async _searchGitHubAsync(input: GitHubSearchInput): Promise<WarpGrepResult> {\n try {\n const { remoteCommands } = await this._resolveGitHubRepo(input);\n return this.execute({\n searchTerm: input.searchTerm,\n repoRoot: '.',\n remoteCommands,\n });\n } catch (error) {\n return { success: false, error: error instanceof Error ? error.message : String(error) };\n }\n }\n\n private async *_searchGitHubStreaming(input: GitHubSearchInput): AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined> {\n let remoteCommands: RemoteCommands;\n try {\n ({ remoteCommands } = await this._resolveGitHubRepo(input));\n } catch (error) {\n return { success: false, error: error instanceof Error ? error.message : String(error) };\n }\n\n const generator = this.execute({\n searchTerm: input.searchTerm,\n repoRoot: '.',\n remoteCommands,\n streamSteps: true,\n });\n\n let result: WarpGrepResult;\n for (;;) {\n const { value, done } = await generator.next();\n if (done) {\n result = value;\n break;\n }\n yield value;\n }\n return result;\n }\n}\n\n/**\n * Execute a warp grep search directly\n *\n * @param input - Search parameters\n * @param config - Optional client configuration\n * @returns Search results, or an AsyncGenerator if streamSteps is true\n *\n * @example\n * ```typescript\n * import { executeWarpGrep } from '@morphllm/morphsdk/tools/warp-grep';\n *\n * const result = await executeWarpGrep({\n * searchTerm: 'Find authentication middleware',\n * repoRoot: '.'\n * });\n *\n * // Streaming\n * const stream = executeWarpGrep({\n * searchTerm: 'Find auth',\n * repoRoot: '.',\n * streamSteps: true\n * });\n * for await (const step of stream) {\n * console.log(step.turn, step.toolCalls);\n * }\n * ```\n */\nexport function executeWarpGrep(\n input: WarpGrepInput & { streamSteps: true },\n config?: WarpGrepClientConfig\n): AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined>;\nexport function executeWarpGrep(\n input: WarpGrepInput & { streamSteps?: false | undefined },\n config?: WarpGrepClientConfig\n): Promise<WarpGrepResult>;\nexport function executeWarpGrep(\n input: WarpGrepInput,\n config?: WarpGrepClientConfig\n): Promise<WarpGrepResult> | AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined> {\n const client = new WarpGrepClient(config);\n if (input.streamSteps) {\n return client.execute({ ...input, streamSteps: true });\n }\n return client.execute({ ...input, streamSteps: false });\n}\n\nexport async function executeToolCall(\n input: { search_term: string } | string,\n config: WarpGrepToolConfig\n): Promise<WarpGrepResult> {\n const parsed = typeof input === 'string' ? JSON.parse(input) : input;\n\n // Priority: remoteCommands > provider > LocalRipgrepProvider (lazy-loaded for edge compatibility)\n const allowNames = config.search_type === 'node_modules' ? ['node_modules'] : undefined;\n const provider = config.remoteCommands\n ? new RemoteCommandsProvider(config.repoRoot, config.remoteCommands)\n : config.provider ?? await getLocalProvider(config.repoRoot, config.excludes, allowNames);\n\n const result = await runWarpGrep({\n searchTerm: parsed.search_term,\n repoRoot: config.repoRoot,\n provider,\n excludes: config.excludes,\n includes: config.includes,\n debug: config.debug ?? false,\n morphApiKey: config.morphApiKey,\n morphApiUrl: config.morphApiUrl,\n retryConfig: config.retryConfig,\n timeout: config.timeout,\n search_type: config.search_type,\n });\n\n return processAgentResult(result, parsed.search_term, config.morphApiKey, config.morphApiUrl);\n}\n\n/**\n * Helper to process AgentRunResult into WarpGrepResult\n */\nasync function processAgentResult(\n result: AgentRunResult,\n searchTerm: string,\n apiKey?: string,\n apiUrl?: string\n): Promise<WarpGrepResult> {\n const finish = result.finish;\n if (result.terminationReason !== 'completed' || !finish?.metadata) {\n const errorDetails = result.errors?.map(e => e.message).join('; ') || 'unknown reason';\n console.error(`[warp_grep] processAgentResult failed. Reason: ${result.terminationReason}. Errors: ${errorDetails}. Turns: ${result.timings?.turns?.length ?? 0}`);\n return { success: false, error: `Search did not complete: ${errorDetails}` };\n }\n\n const contexts: WarpGrepContext[] = (finish.resolved ?? []).map(r => ({\n file: r.path,\n content: r.content,\n lines: r.ranges,\n }));\n\n try {\n const compactable = contexts.map(c => ({ path: c.file, content: c.content }));\n const compacted = await compactFileContexts(compactable, searchTerm, apiKey, apiUrl);\n for (let i = 0; i < contexts.length; i++) {\n contexts[i].content = compacted[i].content;\n }\n } catch (error) {\n console.error(`[warp_grep] Failed to compact result contexts:`, error);\n }\n\n return { success: true, contexts, summary: finish.payload };\n}\n\n/**\n * Streaming version of executeToolCall that yields WarpGrepStep for each turn.\n */\nexport async function* executeToolCallStreaming(\n input: { search_term: string } | string,\n config: WarpGrepToolConfig\n): AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined> {\n const parsed = typeof input === 'string' ? JSON.parse(input) : input;\n\n // Priority: remoteCommands > provider > LocalRipgrepProvider (lazy-loaded for edge compatibility)\n const allowNames = config.search_type === 'node_modules' ? ['node_modules'] : undefined;\n const provider = config.remoteCommands\n ? new RemoteCommandsProvider(config.repoRoot, config.remoteCommands)\n : config.provider ?? await getLocalProvider(config.repoRoot, config.excludes, allowNames);\n\n const generator = runWarpGrepStreaming({\n searchTerm: parsed.search_term,\n repoRoot: config.repoRoot,\n provider,\n excludes: config.excludes,\n includes: config.includes,\n debug: config.debug ?? false,\n morphApiKey: config.morphApiKey,\n morphApiUrl: config.morphApiUrl,\n retryConfig: config.retryConfig,\n timeout: config.timeout,\n search_type: config.search_type,\n });\n\n // Forward all yielded steps\n let agentResult: AgentRunResult;\n for (;;) {\n const { value, done } = await generator.next();\n if (done) {\n agentResult = value;\n break;\n }\n yield value;\n }\n\n // `await` is load-bearing: an async generator hands its `return` value back as\n // the `done` result without awaiting it, so returning the Promise directly would\n // surface an un-awaited Promise to streaming consumers instead of the result.\n return await processAgentResult(agentResult, parsed.search_term, config.morphApiKey, config.morphApiUrl);\n}\n\n/**\n * Fetch raw file content from a public GitHub repository.\n * Tries the given branch first, then falls back to main/master/develop.\n */\nasync function fetchRawGitHubFile(\n owner: string,\n repo: string,\n filePath: string,\n branch?: string,\n timeout?: number,\n): Promise<{ content: string; branch: string }> {\n const branches = branch ? [branch] : ['HEAD'];\n const fallbacks = ['main', 'master', 'develop'];\n\n const fetchWithTimeout = (url: string) =>\n timeout ? fetch(url, { signal: AbortSignal.timeout(timeout) }) : fetch(url);\n\n for (const b of branches) {\n const url = `https://raw.githubusercontent.com/${owner}/${repo}/${b}/${filePath}`;\n const res = await fetchWithTimeout(url);\n if (res.ok) return { content: await res.text(), branch: b };\n }\n\n for (const fb of fallbacks) {\n if (branch && fb === branch) continue;\n const url = `https://raw.githubusercontent.com/${owner}/${repo}/${fb}/${filePath}`;\n const res = await fetchWithTimeout(url);\n if (res.ok) return { content: await res.text(), branch: fb };\n }\n\n throw new Error(`File not found: ${owner}/${repo}/${filePath}`);\n}\n\n/**\n * Read a single file (or line range) from a public GitHub repository\n */\nexport async function executeGitHubReadFile(\n input: GitHubReadFileInput,\n config?: { timeout?: number },\n): Promise<GitHubReadFileResult> {\n try {\n const { owner, repo } = parseGitHubUrl(input.github);\n const { content: raw, branch } = await fetchRawGitHubFile(\n owner, repo, input.path, input.branch, config?.timeout,\n );\n\n const allLines = raw.split('\\n');\n const totalLines = allLines.length;\n const start = Math.max(1, input.startLine ?? 1);\n const end = Math.min(totalLines, input.endLine ?? totalLines);\n\n const selected = allLines.slice(start - 1, end);\n const padWidth = String(end).length;\n const numbered = selected\n .map((line, i) => `${String(start + i).padStart(padWidth)}|${line}`)\n .join('\\n');\n\n return {\n success: true,\n content: numbered,\n path: input.path,\n github: `${owner}/${repo}`,\n branch,\n lineRange: [start, end],\n totalLines,\n };\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n}\n\n/**\n * Format a GitHub read file result for display or tool responses\n */\nexport function formatGitHubReadFileResult(result: GitHubReadFileResult): string {\n if (!result.success) {\n return `Failed to read file: ${result.error}`;\n }\n\n const rangeStr = result.lineRange\n ? ` (lines ${result.lineRange[0]}-${result.lineRange[1]} of ${result.totalLines})`\n : '';\n\n return `File: ${result.github}/${result.path}${rangeStr}\\n\\n${result.content}`;\n}\n\n/**\n * Format warp grep results for display or tool responses\n * \n * @param result - The search result\n * @returns Formatted string representation\n */\nexport function formatResult(result: WarpGrepResult): string {\n if (!result.success) {\n return `Search failed: ${result.error}`;\n }\n\n if (!result.contexts || result.contexts.length === 0) {\n return 'No relevant code found. Try rephrasing your search term.';\n }\n\n const parts: string[] = [];\n parts.push(`Morph Fast Context subagent performed search on repository:\\n`);\n parts.push('Relevant context found:');\n\n for (const ctx of result.contexts) {\n const rangeStr = !ctx.lines || ctx.lines === '*'\n ? '*'\n : ctx.lines.map(([s, e]) => `${s}-${e}`).join(',');\n parts.push(`- ${ctx.file}:${rangeStr}`);\n }\n\n parts.push('\\nHere is the content of files:\\n');\n\n for (const ctx of result.contexts) {\n const rangeStr = !ctx.lines || ctx.lines === '*'\n ? ''\n : ` lines=\"${ctx.lines.map(([s, e]) => `${s}-${e}`).join(',')}\"`;\n parts.push(`<file path=\"${ctx.file}\"${rangeStr}>`);\n parts.push(ctx.content);\n parts.push('</file>\\n');\n }\n\n return parts.join('\\n');\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAM,0BAA0B;AAOhC,eAAe,iBAAiB,UAAkB,UAAqB,YAAkD;AACvH,QAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,sCAAsB;AACpE,QAAM,OAAO,YAAY,SAAS,EAAE,WAAW,IAAI;AACnD,SAAO,IAAI,qBAAqB,UAAU,UAAU,IAAI;AAC1D;AA6BO,IAAM,iBAAN,cAA6B,YAAY;AAAA,EACtC;AAAA,EAER,YAAY,iBAAwD,CAAC,GAAG;AACtE,UAAM,WAAW,0BAA0B;AAC3C;AAAA,MACE,WACI,iBACA,IAAI,eAAe;AAAA,QACjB,QAAQ,eAAe;AAAA,QACvB,SAAS,eAAe;AAAA,QACxB,SAAS,eAAe;AAAA,QACxB,aAAa,eAAe;AAAA,QAC5B,OAAO,eAAe;AAAA,MACxB,CAAC;AAAA,IACP;AACA,UAAM,MAA4B,WAAW,CAAC,IAAI;AAIlD,SAAK,SAAS;AAAA,MACZ,GAAG;AAAA,MACH,aAAa,KAAK,QAAQ,cAAc;AAAA,MACxC,aAAa,KAAK,QAAQ;AAAA,MAC1B,SAAS,KAAK,QAAQ;AAAA,MACtB,aAAa,KAAK,QAAQ;AAAA,MAC1B,OAAO,KAAK,QAAQ;AAAA,IACtB;A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
-
executeCodebaseSearch
|
|
7
|
-
} from "./chunk-VS5F2ORN.js";
|
|
8
|
-
|
|
9
|
-
// tools/codebase_search/anthropic.ts
|
|
10
|
-
function createCodebaseSearchTool(config) {
|
|
11
|
-
const toolDefinition = {
|
|
12
|
-
name: "codebase_search",
|
|
13
|
-
description: CODEBASE_SEARCH_DESCRIPTION,
|
|
14
|
-
input_schema: {
|
|
15
|
-
type: "object",
|
|
16
|
-
properties: {
|
|
17
|
-
explanation: {
|
|
18
|
-
type: "string",
|
|
19
|
-
description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal."
|
|
20
|
-
},
|
|
21
|
-
query: {
|
|
22
|
-
type: "string",
|
|
23
|
-
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?"'
|
|
24
|
-
},
|
|
25
|
-
target_directories: {
|
|
26
|
-
type: "array",
|
|
27
|
-
items: { type: "string" },
|
|
28
|
-
description: "Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo."
|
|
29
|
-
},
|
|
30
|
-
limit: {
|
|
31
|
-
type: "number",
|
|
32
|
-
description: "Maximum results to return (default: 10)"
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
required: ["query", "target_directories", "explanation"]
|
|
36
|
-
},
|
|
37
|
-
cache_control: { type: "ephemeral" }
|
|
38
|
-
};
|
|
39
|
-
return Object.assign(toolDefinition, {
|
|
40
|
-
execute: async (input) => {
|
|
41
|
-
return executeCodebaseSearch(input, config);
|
|
42
|
-
},
|
|
43
|
-
formatResult: (result) => {
|
|
44
|
-
return formatResult(result);
|
|
45
|
-
},
|
|
46
|
-
getSystemPrompt: () => {
|
|
47
|
-
return CODEBASE_SEARCH_SYSTEM_PROMPT;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function formatResult(result) {
|
|
52
|
-
if (!result.success) {
|
|
53
|
-
return `Search failed: ${result.error}`;
|
|
54
|
-
}
|
|
55
|
-
if (result.results.length === 0) {
|
|
56
|
-
return "No matching code found. Try rephrasing your query or broadening the search scope.";
|
|
57
|
-
}
|
|
58
|
-
const lines = [];
|
|
59
|
-
lines.push(`Found ${result.results.length} relevant code sections (searched ${result.stats.candidatesRetrieved} candidates in ${result.stats.searchTimeMs}ms):
|
|
60
|
-
`);
|
|
61
|
-
result.results.forEach((r, i) => {
|
|
62
|
-
const relevance = (r.rerankScore * 100).toFixed(1);
|
|
63
|
-
lines.push(`${i + 1}. ${r.filepath} (${relevance}% relevant)`);
|
|
64
|
-
lines.push(` Symbol: ${r.symbolPath}`);
|
|
65
|
-
lines.push(` Language: ${r.language}`);
|
|
66
|
-
lines.push(` Lines: ${r.startLine}-${r.endLine}`);
|
|
67
|
-
lines.push(` Code:`);
|
|
68
|
-
const codeLines = r.content.split("\n");
|
|
69
|
-
codeLines.slice(0, Math.min(codeLines.length, 20)).forEach((line) => {
|
|
70
|
-
lines.push(` ${line}`);
|
|
71
|
-
});
|
|
72
|
-
if (codeLines.length > 20) {
|
|
73
|
-
lines.push(` ... (${codeLines.length - 20} more lines)`);
|
|
74
|
-
}
|
|
75
|
-
lines.push("");
|
|
76
|
-
});
|
|
77
|
-
return lines.join("\n");
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export {
|
|
81
|
-
createCodebaseSearchTool
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=chunk-MEZTHMB2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/codebase_search/anthropic.ts"],"sourcesContent":["/**\n * Anthropic SDK adapter for codebase_search tool\n */\n\nimport type { Tool } from '@anthropic-ai/sdk/resources/messages';\nimport { executeCodebaseSearch } from './core.js';\nimport { CODEBASE_SEARCH_DESCRIPTION, CODEBASE_SEARCH_SYSTEM_PROMPT } from './prompts.js';\nimport type { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './types.js';\n\n\n/**\n * Create Anthropic-native codebase_search tool with execute and formatResult methods\n * \n * @param config - Configuration with repoId\n * @returns Anthropic Tool definition with execute and formatResult methods\n * \n * @example\n * ```ts\n * import Anthropic from '@anthropic-ai/sdk';\n * import { createCodebaseSearchTool } from 'morphsdk/tools/anthropic';\n * \n * const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });\n * const tool = createCodebaseSearchTool({ repoId: 'my-project' });\n * \n * const response = await client.messages.create({\n * model: \"claude-sonnet-4-5-20250929\",\n * tools: [tool], // tool itself is the Tool definition\n * messages: [{ role: \"user\", content: \"Find authentication code\" }]\n * });\n * \n * // Execute tool and format result\n * const result = await tool.execute(toolUseBlock.input);\n * const formatted = tool.formatResult(result);\n * ```\n */\nexport function createCodebaseSearchTool(config: CodebaseSearchConfig) {\n const toolDefinition: Tool = {\n name: 'codebase_search',\n description: CODEBASE_SEARCH_DESCRIPTION,\n input_schema: {\n type: 'object',\n properties: {\n explanation: {\n type: 'string',\n description: 'One sentence explanation as to why this tool is being used, and how it contributes to the goal.',\n },\n query: {\n type: 'string',\n 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?\"',\n },\n target_directories: {\n type: 'array',\n items: { type: 'string' },\n description: 'Prefix directory paths to limit search scope (single directory only, no glob patterns). Use [] to search entire repo.',\n },\n limit: {\n type: 'number',\n description: 'Maximum results to return (default: 10)',\n },\n },\n required: ['query', 'target_directories', 'explanation'],\n },\n cache_control: { type: 'ephemeral' } as any,\n } as any;\n\n return Object.assign(toolDefinition, {\n execute: async (input: CodebaseSearchInput): Promise<CodebaseSearchResult> => {\n return executeCodebaseSearch(input, config);\n },\n formatResult: (result: CodebaseSearchResult): string => {\n return formatResult(result);\n },\n getSystemPrompt: (): string => {\n return CODEBASE_SEARCH_SYSTEM_PROMPT;\n },\n });\n}\n\n/**\n * Format search results for Claude\n * \n * @param result - Search result from endpoint\n * @returns Formatted string for tool_result\n */\nfunction formatResult(result: CodebaseSearchResult): string {\n if (!result.success) {\n return `Search failed: ${result.error}`;\n }\n\n if (result.results.length === 0) {\n return 'No matching code found. Try rephrasing your query or broadening the search scope.';\n }\n\n const lines: string[] = [];\n \n lines.push(`Found ${result.results.length} relevant code sections (searched ${result.stats.candidatesRetrieved} candidates in ${result.stats.searchTimeMs}ms):\\n`);\n\n result.results.forEach((r, i) => {\n const relevance = (r.rerankScore * 100).toFixed(1);\n lines.push(`${i + 1}. ${r.filepath} (${relevance}% relevant)`);\n lines.push(` Symbol: ${r.symbolPath}`);\n lines.push(` Language: ${r.language}`);\n lines.push(` Lines: ${r.startLine}-${r.endLine}`);\n lines.push(` Code:`);\n \n // Show code content with indentation\n const codeLines = r.content.split('\\n');\n codeLines.slice(0, Math.min(codeLines.length, 20)).forEach(line => {\n lines.push(` ${line}`);\n });\n \n if (codeLines.length > 20) {\n lines.push(` ... (${codeLines.length - 20} more lines)`);\n }\n \n lines.push('');\n });\n\n return lines.join('\\n');\n}\n\n"],"mappings":";;;;;;;;;AAmCO,SAAS,yBAAyB,QAA8B;AACrE,QAAM,iBAAuB;AAAA,IAC3B,MAAM;AAAA,IACN,aAAa;AAAA,IACb,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,YAAY;AAAA,QACV,aAAa;AAAA,UACX,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,QACA,OAAO;AAAA,UACL,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,QACA,oBAAoB;AAAA,UAClB,MAAM;AAAA,UACN,OAAO,EAAE,MAAM,SAAS;AAAA,UACxB,aAAa;AAAA,QACf;AAAA,QACA,OAAO;AAAA,UACL,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,MACF;AAAA,MACA,UAAU,CAAC,SAAS,sBAAsB,aAAa;AAAA,IACzD;AAAA,IACA,eAAe,EAAE,MAAM,YAAY;AAAA,EACrC;AAEA,SAAO,OAAO,OAAO,gBAAgB;AAAA,IACnC,SAAS,OAAO,UAA8D;AAC5E,aAAO,sBAAsB,OAAO,M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ts"],"sourcesContent":["/**\n * HTTP-based RemoteCommands for code search against the Morph landing API.\n *\n * Translates grep/read/listDir into POST requests to the code-search endpoints,\n * so the WarpGrep agent can search GitHub repositories that have been indexed\n * by the Morph code storage service.\n */\n\nimport type { RemoteCommands } from '../types.js';\n\n/**\n * The WarpGrep model addresses files as if the repo were checked out at\n * /home/ubuntu/repo (its training root), while the code-search endpoints\n * expect repo-relative paths. Strip the training root and any leading\n * slashes at this boundary — the same normalization the dashboard\n * playground applies via warpgrep-mock-paths.ts.\n */\nconst MODEL_REPO_ROOT = /^\\/?home\\/ubuntu\\/repo(?:\\/|$)/;\n\nexport function toRepoRelative(path: string): string {\n if (!path) return path;\n const stripped = path.replace(MODEL_REPO_ROOT, '').replace(/^\\.?\\/+/, '');\n return stripped || '.';\n}\n\nexport interface CodeStorageHttpConfig {\n /** Base URL for the code search API (e.g. \"https://api.morphllm.com\") */\n baseUrl: string;\n /** Repository ID returned by the get-or-create endpoint */\n repoId: string;\n /** Git branch to search */\n branch: string;\n /** Morph API key, forwarded as a Bearer token (api.morphllm.com requires it) */\n apiKey?: string;\n}\n\nasync function post(url: string, body: Record<string, unknown>, op: string, apiKey?: string): Promise<string> {\n const res = await fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),\n },\n body: JSON.stringify(body),\n });\n if (!res.ok) {\n const text = await res.text().catch(() => res.statusText);\n // Return error as content instead of throwing so the agent can handle it gracefully\n try {\n const parsed = JSON.parse(text);\n if (parsed.error) return `Error: ${parsed.error}`;\n } catch { /* not JSON, fall through */ }\n return `Error: ${op} failed (${res.status}): ${text}`;\n }\n const data = await res.json();\n if (data.error) throw new Error(data.error);\n return data.stdout;\n}\n\nexport function createCodeStorageHttpCommands(config: CodeStorageHttpConfig): RemoteCommands {\n const { baseUrl, repoId, branch, apiKey } = config;\n const encodedRepoId = encodeURIComponent(repoId);\n\n return {\n grep: (pattern: string, path: string, glob?: string) =>\n post(`${baseUrl}/api/code-search/${encodedRepoId}/grep`, { pattern, path: toRepoRelative(path), glob, branch }, 'grep', apiKey),\n\n read: (path: string, start: number, end: number) =>\n post(`${baseUrl}/api/code-search/${encodedRepoId}/read`, { path: toRepoRelative(path), start, end, branch }, 'read', apiKey),\n\n listDir: (path: string, maxDepth: number) =>\n post(`${baseUrl}/api/code-search/${encodedRepoId}/list`, { path: toRepoRelative(path), maxDepth, branch }, 'list', apiKey),\n };\n}\n"],"mappings":";AAiBA,IAAM,kBAAkB;AAEjB,SAAS,eAAe,MAAsB;AACnD,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,WAAW,KAAK,QAAQ,iBAAiB,EAAE,EAAE,QAAQ,WAAW,EAAE;AACxE,SAAO,YAAY;AACrB;AAaA,eAAe,KAAK,KAAa,MAA+B,IAAY,QAAkC;AAC5G,QAAM,MAAM,MAAM,MAAM,KAAK;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,GAAI,SAAS,EAAE,eAAe,UAAU,MAAM,GAAG,IAAI,CAAC;AAAA,IACxD;AAAA,IACA,MAAM,KAAK,UAAU,IAAI;AAAA,EAC3B,CAAC;AACD,MAAI,CAAC,IAAI,IAAI;AACX,UAAM,OAAO,MAAM,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,UAAU;AAExD,QAAI;AACF,YAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,UAAI,OAAO,MAAO,QAAO,UAAU,OAAO,KAAK;AAAA,IACjD,QAAQ;AAAA,IAA+B;AACvC,WAAO,UAAU,EAAE,YAAY,IAAI,MAAM,MAAM,IAAI;AAAA,EACrD;AACA,QAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,MAAI,KAAK,MAAO,OAAM,IAAI,MAAM,KAAK,KAAK;AAC1C,SAAO,KAAK;AACd;AAEO,SAAS,8BAA8B,QAA+C;AAC3F,QAAM,EAAE,SAAS,QAAQ,QAAQ,OAAO,IAAI;AAC5C,QAAM,gBAAgB,mBAAmB,MAAM;AAE/C,SAAO;AAAA,IACL,MAAM,CAAC,SAAiB,MAAc,SACpC,KAAK,GAAG,OAAO,oBAAoB,aAAa,SAAS,EAAE,SAAS,MAAM,eAAe,IAAI,GAAG,MAAM,OAAO,GAAG,QAAQ,MAAM;AAAA,IAEhI,MAAM,CAAC,MAAc,OAAe,QAClC,KAAK,GAAG,OAAO,oBAAoB,aAAa,SAAS,EAAE,MAAM,eAAe,IAAI,GAAG,OAAO,KAAK,OAAO,GAAG,QAAQ,MAAM;AAAA,IAE7H,SAAS,CAAC,MAAc,aACtB,KAAK,GAAG,OAAO,oBAAoB,aAAa,SAAS,EAAE,MAAM,eAAe,IAAI,GAAG,UAAU,OAAO,GAAG,QAAQ,MAAM;AAAA,EAC7H;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../tools/fastapply/anthropic.ts"],"sourcesContent":["/**\n * Anthropic SDK adapter for edit_file tool\n */\n\nimport type { Tool } from '@anthropic-ai/sdk/resources/messages';\nimport { executeEditFile } from './core.js';\nimport { EDIT_FILE_TOOL_DESCRIPTION, EDIT_FILE_SYSTEM_PROMPT } from './prompts.js';\nimport type { EditFileInput, EditFileResult, EditFileConfig } from './types.js';\n\n/**\n * Anthropic-native tool definition for edit_file\n * \n * @example\n * ```ts\n * import Anthropic from '@anthropic-ai/sdk';\n * import { editFileTool } from 'morphsdk/tools/anthropic';\n * \n * const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });\n * \n * const response = await client.messages.create({\n * model: \"claude-sonnet-4-5-20250929\",\n * tools: [editFileTool],\n * messages: [{ role: \"user\", content: \"Fix the bug in app.ts\" }]\n * });\n * ```\n */\nexport const editFileTool: Tool = {\n name: 'edit_file',\n description: EDIT_FILE_TOOL_DESCRIPTION,\n input_schema: {\n type: 'object',\n properties: {\n target_filepath: {\n type: 'string',\n description: 'The path of the target file to modify',\n },\n instruction: {\n type: 'string',\n description: 'A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit.',\n },\n code_edit: {\n type: 'string',\n description: 'Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections.',\n },\n },\n required: ['target_filepath', 'instruction', 'code_edit'],\n },\n};\n\n/**\n * Format the result for passing back to Claude\n * \n * @param result - The edit result\n * @returns Formatted string for tool_result\n */\nexport function formatResult(result: EditFileResult): string {\n if (!result.success) {\n return `Error editing file: ${result.error}`;\n }\n \n const { changes } = result;\n return `Successfully applied changes to ${result.filepath}. Added ${changes.linesAdded}, removed ${changes.linesRemoved}, modified ${changes.linesModified}.`;\n}\n\n/**\n * Create a custom edit_file tool with configuration\n * \n * @param config - Configuration options\n * @returns Tool definition with execute and formatResult methods\n * \n * @example\n * ```ts\n * const tool = createEditFileTool({\n * baseDir: './src',\n * generateUdiff: true,\n * morphApiKey: 'sk-...',\n * description: 'Custom tool description for your use case'\n * });\n * \n * // Use as Anthropic tool\n * const response = await client.messages.create({\n * tools: [tool], // tool itself is the Tool definition\n * ...\n * });\n * \n * // Execute and format\n * const result = await tool.execute(toolUseBlock.input);\n * const formatted = tool.formatResult(result);\n * ```\n */\nexport function createEditFileTool(config: EditFileConfig = {}) {\n const toolDef: Tool = {\n ...editFileTool,\n ...(config.description && { description: config.description }),\n };\n \n return Object.assign({}, toolDef, {\n execute: async (input: EditFileInput): Promise<EditFileResult> => {\n return executeEditFile(input, config);\n },\n formatResult: (result: EditFileResult): string => {\n return formatResult(result);\n },\n getSystemPrompt: (): string => {\n return EDIT_FILE_SYSTEM_PROMPT;\n },\n });\n}\n\n/**\n * Execute the edit_file tool with raw input\n * \n * @param input - Tool input from Claude's tool_use\n * @param config - Configuration for Fast Apply\n * @returns Tool result to send back to Claude\n */\nexport async function execute(\n input: EditFileInput,\n config?: EditFileConfig\n): Promise<EditFileResult> {\n return executeEditFile(input, config);\n}\n\n/**\n * Get the system prompt for the edit_file tool\n * \n * @returns System prompt string\n */\nex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