@morphllm/morphsdk 0.2.170 → 0.2.172
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-IY7DESC3.js → chunk-2SNAXTUJ.js} +4 -4
- package/dist/chunk-453ZV2AX.js +120 -0
- package/dist/chunk-453ZV2AX.js.map +1 -0
- package/dist/chunk-53ZJMCWU.js +142 -0
- package/dist/chunk-53ZJMCWU.js.map +1 -0
- package/dist/{chunk-5KFQBI4J.js → chunk-5DA6SZQJ.js} +2 -2
- package/dist/chunk-66OHYI24.js +78 -0
- package/dist/chunk-66OHYI24.js.map +1 -0
- package/dist/chunk-6X6QMRQG.js +158 -0
- package/dist/chunk-6X6QMRQG.js.map +1 -0
- package/dist/{chunk-76XER44U.js → chunk-7PVVPLRL.js} +2 -2
- package/dist/{chunk-BCPZAPWY.js → chunk-AE7M2I52.js} +2 -2
- package/dist/{chunk-LNXIVRPY.js → chunk-CQF76HJC.js} +30 -6
- package/dist/chunk-CQF76HJC.js.map +1 -0
- package/dist/{chunk-OJQYBWHR.js → chunk-ESXCQBMU.js} +2 -2
- package/dist/{chunk-LAGN62H5.js → chunk-FOIDGIY4.js} +29 -10
- package/dist/chunk-FOIDGIY4.js.map +1 -0
- package/dist/{chunk-KUPSW5QN.js → chunk-GJZXDRH5.js} +8 -3
- package/dist/{chunk-KUPSW5QN.js.map → chunk-GJZXDRH5.js.map} +1 -1
- package/dist/{chunk-5IR3YE77.js → chunk-IJ33I7P5.js} +4 -4
- package/dist/{chunk-E5QWXVTF.js → chunk-IN2U7AAI.js} +99 -143
- package/dist/chunk-IN2U7AAI.js.map +1 -0
- package/dist/{chunk-LE66XCOI.js → chunk-JWZ5DLAS.js} +27 -10
- package/dist/chunk-JWZ5DLAS.js.map +1 -0
- package/dist/chunk-LKFZBBTD.js +12 -0
- package/dist/chunk-LKFZBBTD.js.map +1 -0
- package/dist/{chunk-6LPWEZ6H.js → chunk-MO6S2LRD.js} +2 -2
- package/dist/{chunk-S4IEM5EG.js → chunk-NI7PWQ3B.js} +4 -4
- package/dist/{chunk-GLQWEINZ.js → chunk-QAXXE4AD.js} +2 -2
- package/dist/{chunk-YG2I377B.js → chunk-QFE5523Q.js} +18 -3
- package/dist/chunk-QFE5523Q.js.map +1 -0
- package/dist/{chunk-G4FPDEUP.js → chunk-QQXNZIVK.js} +4 -4
- package/dist/{chunk-A3ZUWLYX.js → chunk-QZ3V2BP7.js} +2 -2
- package/dist/chunk-QZR7SJ5N.js +24 -0
- package/dist/chunk-QZR7SJ5N.js.map +1 -0
- package/dist/{chunk-SYD6BRQX.js → chunk-SJVLAGUL.js} +4 -4
- package/dist/{chunk-JMEQ6FLB.js → chunk-U4J3BVAQ.js} +4 -4
- package/dist/{chunk-QAWYDWDW.js → chunk-U4MRSZQQ.js} +2 -2
- package/dist/{chunk-WU3D46MH.js → chunk-UADW6FYD.js} +2 -2
- package/dist/{chunk-K7NY5SVR.js → chunk-VBARKJWL.js} +2 -2
- package/dist/{chunk-OPNTDMHH.js → chunk-VLZ6PNAD.js} +4 -4
- package/dist/chunk-VZ7BOH2K.js +1 -0
- package/dist/chunk-VZ7BOH2K.js.map +1 -0
- package/dist/{chunk-GUGHUAJU.js → chunk-XJDXV5VX.js} +2 -2
- package/dist/{chunk-GPNUS3H2.js → chunk-XYTYIAMQ.js} +2 -2
- package/dist/{chunk-MKBVWPU7.js → chunk-Z4GJVN52.js} +23 -8
- package/dist/chunk-Z4GJVN52.js.map +1 -0
- package/dist/chunk-ZLSNL6M2.js +97 -0
- package/dist/chunk-ZLSNL6M2.js.map +1 -0
- package/dist/{client-DsAAqupx.d.ts → client-Dh6yzCm4.d.ts} +14 -5
- package/dist/client.cjs +741 -525
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +5 -1
- package/dist/client.js +31 -27
- package/dist/core/client.cjs +540 -0
- package/dist/core/client.cjs.map +1 -0
- package/dist/core/client.d.ts +79 -0
- package/dist/core/client.js +12 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/error.cjs +309 -0
- package/dist/core/error.cjs.map +1 -0
- package/dist/core/error.d.ts +18 -0
- package/dist/core/error.js +10 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/index.cjs +552 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +20 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/resource.cjs +36 -0
- package/dist/core/resource.cjs.map +1 -0
- package/dist/core/resource.d.ts +18 -0
- package/dist/core/resource.js +8 -0
- package/dist/core/resource.js.map +1 -0
- package/dist/edge.cjs +252 -174
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.d.ts +2 -0
- package/dist/edge.js +8 -5
- package/dist/git/client.cjs +529 -9
- package/dist/git/client.cjs.map +1 -1
- package/dist/git/client.d.ts +8 -2
- package/dist/git/client.js +7 -1
- package/dist/git/index.cjs +529 -9
- package/dist/git/index.cjs.map +1 -1
- package/dist/git/index.d.ts +2 -0
- package/dist/git/index.js +7 -1
- package/dist/index.cjs +688 -466
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +49 -33
- package/dist/modelrouter/core.cjs +204 -125
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.d.ts +36 -9
- package/dist/modelrouter/core.js +6 -3
- package/dist/modelrouter/index.cjs +204 -125
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.d.ts +3 -0
- package/dist/modelrouter/index.js +6 -3
- package/dist/subagents/anthropic.cjs +268 -52
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.js +10 -6
- package/dist/subagents/vercel.cjs +268 -52
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.js +10 -6
- package/dist/tools/browser/anthropic.cjs +7 -2
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +9 -6
- package/dist/tools/browser/core.cjs +162 -10
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.d.ts +8 -2
- package/dist/tools/browser/core.js +8 -5
- package/dist/tools/browser/index.cjs +163 -11
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.d.ts +2 -0
- package/dist/tools/browser/index.js +18 -15
- package/dist/tools/browser/index.js.map +1 -1
- package/dist/tools/browser/openai.cjs +7 -2
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +9 -6
- package/dist/tools/browser/profiles/core.cjs +7 -2
- package/dist/tools/browser/profiles/core.cjs.map +1 -1
- package/dist/tools/browser/profiles/core.js +3 -3
- package/dist/tools/browser/profiles/index.cjs +7 -2
- package/dist/tools/browser/profiles/index.cjs.map +1 -1
- package/dist/tools/browser/profiles/index.js +3 -3
- package/dist/tools/browser/vercel.cjs +7 -2
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +9 -6
- package/dist/tools/codebase_search/anthropic.cjs +162 -41
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +7 -4
- package/dist/tools/codebase_search/core.cjs +195 -66
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.d.ts +18 -7
- package/dist/tools/codebase_search/core.js +6 -3
- package/dist/tools/codebase_search/index.cjs +162 -41
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.d.ts +2 -0
- package/dist/tools/codebase_search/index.js +13 -10
- package/dist/tools/codebase_search/openai.cjs +162 -41
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +7 -4
- package/dist/tools/codebase_search/vercel.cjs +162 -41
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +7 -4
- package/dist/tools/compact/core.cjs +551 -47
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.d.ts +16 -3
- package/dist/tools/compact/core.js +7 -1
- package/dist/tools/compact/index.cjs +549 -47
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.d.ts +2 -0
- package/dist/tools/compact/index.js +8 -2
- package/dist/tools/fastapply/anthropic.cjs +32 -3
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +8 -4
- package/dist/tools/fastapply/apply.cjs +23 -3
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +258 -13
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.d.ts +8 -2
- package/dist/tools/fastapply/core.js +7 -3
- package/dist/tools/fastapply/index.cjs +32 -3
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.d.ts +2 -0
- package/dist/tools/fastapply/index.js +13 -9
- package/dist/tools/fastapply/openai.cjs +32 -3
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +8 -4
- package/dist/tools/fastapply/vercel.cjs +32 -3
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +8 -4
- package/dist/tools/index.cjs +32 -3
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +13 -9
- package/dist/tools/reflex/core.cjs +693 -0
- package/dist/tools/reflex/core.cjs.map +1 -0
- package/dist/tools/reflex/core.d.ts +53 -0
- package/dist/tools/reflex/core.js +16 -0
- package/dist/tools/reflex/core.js.map +1 -0
- package/dist/tools/reflex/index.cjs +693 -0
- package/dist/tools/reflex/index.cjs.map +1 -0
- package/dist/tools/reflex/index.d.ts +5 -0
- package/dist/tools/reflex/index.js +16 -0
- package/dist/tools/reflex/index.js.map +1 -0
- package/dist/tools/reflex/types.cjs +19 -0
- package/dist/tools/reflex/types.cjs.map +1 -0
- package/dist/tools/reflex/types.d.ts +113 -0
- package/dist/tools/reflex/types.js +1 -0
- package/dist/tools/reflex/types.js.map +1 -0
- package/dist/tools/utils/resilience.cjs +7 -2
- package/dist/tools/utils/resilience.cjs.map +1 -1
- package/dist/tools/utils/resilience.js +2 -2
- package/dist/tools/warp_grep/agent/runner.cjs +7 -2
- package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
- package/dist/tools/warp_grep/agent/runner.js +2 -2
- package/dist/tools/warp_grep/anthropic.cjs +268 -52
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.d.ts +2 -0
- package/dist/tools/warp_grep/anthropic.js +10 -6
- package/dist/tools/warp_grep/client.cjs +268 -52
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.d.ts +8 -2
- package/dist/tools/warp_grep/client.js +9 -5
- package/dist/tools/warp_grep/gemini.cjs +268 -52
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.d.ts +2 -0
- package/dist/tools/warp_grep/gemini.js +9 -5
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/harness.js +5 -5
- package/dist/tools/warp_grep/index.cjs +268 -52
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.d.ts +2 -0
- package/dist/tools/warp_grep/index.js +12 -8
- package/dist/tools/warp_grep/openai.cjs +268 -52
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.d.ts +2 -0
- package/dist/tools/warp_grep/openai.js +10 -6
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/vercel.cjs +268 -52
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.d.ts +2 -0
- package/dist/tools/warp_grep/vercel.js +10 -6
- package/dist/version.cjs +7 -2
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -2
- package/dist/chunk-E5QWXVTF.js.map +0 -1
- package/dist/chunk-INBZD4EX.js +0 -197
- package/dist/chunk-INBZD4EX.js.map +0 -1
- package/dist/chunk-LAGN62H5.js.map +0 -1
- package/dist/chunk-LE66XCOI.js.map +0 -1
- package/dist/chunk-LNXIVRPY.js.map +0 -1
- package/dist/chunk-MKBVWPU7.js.map +0 -1
- package/dist/chunk-SCVWDNQP.js +0 -84
- package/dist/chunk-SCVWDNQP.js.map +0 -1
- package/dist/chunk-VE7J6VYX.js +0 -102
- package/dist/chunk-VE7J6VYX.js.map +0 -1
- package/dist/chunk-YG2I377B.js.map +0 -1
- /package/dist/{chunk-IY7DESC3.js.map → chunk-2SNAXTUJ.js.map} +0 -0
- /package/dist/{chunk-5KFQBI4J.js.map → chunk-5DA6SZQJ.js.map} +0 -0
- /package/dist/{chunk-76XER44U.js.map → chunk-7PVVPLRL.js.map} +0 -0
- /package/dist/{chunk-BCPZAPWY.js.map → chunk-AE7M2I52.js.map} +0 -0
- /package/dist/{chunk-OJQYBWHR.js.map → chunk-ESXCQBMU.js.map} +0 -0
- /package/dist/{chunk-5IR3YE77.js.map → chunk-IJ33I7P5.js.map} +0 -0
- /package/dist/{chunk-6LPWEZ6H.js.map → chunk-MO6S2LRD.js.map} +0 -0
- /package/dist/{chunk-S4IEM5EG.js.map → chunk-NI7PWQ3B.js.map} +0 -0
- /package/dist/{chunk-GLQWEINZ.js.map → chunk-QAXXE4AD.js.map} +0 -0
- /package/dist/{chunk-G4FPDEUP.js.map → chunk-QQXNZIVK.js.map} +0 -0
- /package/dist/{chunk-A3ZUWLYX.js.map → chunk-QZ3V2BP7.js.map} +0 -0
- /package/dist/{chunk-SYD6BRQX.js.map → chunk-SJVLAGUL.js.map} +0 -0
- /package/dist/{chunk-JMEQ6FLB.js.map → chunk-U4J3BVAQ.js.map} +0 -0
- /package/dist/{chunk-QAWYDWDW.js.map → chunk-U4MRSZQQ.js.map} +0 -0
- /package/dist/{chunk-WU3D46MH.js.map → chunk-UADW6FYD.js.map} +0 -0
- /package/dist/{chunk-K7NY5SVR.js.map → chunk-VBARKJWL.js.map} +0 -0
- /package/dist/{chunk-OPNTDMHH.js.map → chunk-VLZ6PNAD.js.map} +0 -0
- /package/dist/{chunk-GUGHUAJU.js.map → chunk-XJDXV5VX.js.map} +0 -0
- /package/dist/{chunk-GPNUS3H2.js.map → chunk-XYTYIAMQ.js.map} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { WarpGrepStep } from './agent/types.js';
|
|
2
2
|
import { W as WarpGrepClientConfig, a as WarpGrepInput, b as WarpGrepResult, G as GitHubSearchInput, e as GitHubReadFileInput, f as GitHubReadFileResult, d as WarpGrepToolConfig } from '../../types-CtkD4o1_.js';
|
|
3
|
+
import { MorphAPIClient } from '../../core/client.js';
|
|
4
|
+
import { APIResource } from '../../core/resource.js';
|
|
3
5
|
import '../utils/resilience.js';
|
|
4
6
|
import './providers/types.js';
|
|
5
7
|
|
|
@@ -29,10 +31,14 @@ import './providers/types.js';
|
|
|
29
31
|
* excludes: ['node_modules', '.git', 'dist']
|
|
30
32
|
* });
|
|
31
33
|
* ```
|
|
34
|
+
*
|
|
35
|
+
* @deprecated Prefer the unified `MorphClient` (`new MorphClient({ apiKey }).warpGrep`).
|
|
36
|
+
* Standalone clients remain only for backwards compatibility and may be removed in a future
|
|
37
|
+
* major version — do not use them in new code.
|
|
32
38
|
*/
|
|
33
|
-
declare class WarpGrepClient {
|
|
39
|
+
declare class WarpGrepClient extends APIResource {
|
|
34
40
|
private config;
|
|
35
|
-
constructor(
|
|
41
|
+
constructor(clientOrConfig?: MorphAPIClient | WarpGrepClientConfig);
|
|
36
42
|
/**
|
|
37
43
|
* Execute a code search
|
|
38
44
|
*
|
|
@@ -6,18 +6,22 @@ import {
|
|
|
6
6
|
executeWarpGrep,
|
|
7
7
|
formatGitHubReadFileResult,
|
|
8
8
|
formatResult
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-CQF76HJC.js";
|
|
10
10
|
import "../../chunk-63VHBANJ.js";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-7PVVPLRL.js";
|
|
12
12
|
import "../../chunk-GVGJIXV2.js";
|
|
13
13
|
import "../../chunk-A4D2CIIT.js";
|
|
14
14
|
import "../../chunk-IA5K2HTC.js";
|
|
15
15
|
import "../../chunk-FBRNUWEB.js";
|
|
16
16
|
import "../../chunk-CCJK3HTG.js";
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-QAXXE4AD.js";
|
|
18
|
+
import "../../chunk-66OHYI24.js";
|
|
19
|
+
import "../../chunk-453ZV2AX.js";
|
|
19
20
|
import "../../chunk-F3NCFNUX.js";
|
|
20
|
-
import "../../chunk-
|
|
21
|
+
import "../../chunk-QZR7SJ5N.js";
|
|
22
|
+
import "../../chunk-XYTYIAMQ.js";
|
|
23
|
+
import "../../chunk-GJZXDRH5.js";
|
|
24
|
+
import "../../chunk-LKFZBBTD.js";
|
|
21
25
|
import "../../chunk-PZ5AY32C.js";
|
|
22
26
|
export {
|
|
23
27
|
WarpGrepClient,
|
|
@@ -941,7 +941,7 @@ var import_openai = __toESM(require("openai"), 1);
|
|
|
941
941
|
// package.json
|
|
942
942
|
var package_default = {
|
|
943
943
|
name: "@morphllm/morphsdk",
|
|
944
|
-
version: "0.2.
|
|
944
|
+
version: "0.2.172",
|
|
945
945
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
946
946
|
type: "module",
|
|
947
947
|
main: "./dist/index.cjs",
|
|
@@ -1078,6 +1078,11 @@ var package_default = {
|
|
|
1078
1078
|
import: "./dist/tools/compact/index.js",
|
|
1079
1079
|
require: "./dist/tools/compact/index.cjs"
|
|
1080
1080
|
},
|
|
1081
|
+
"./tools/reflex": {
|
|
1082
|
+
types: "./dist/tools/reflex/index.d.ts",
|
|
1083
|
+
import: "./dist/tools/reflex/index.js",
|
|
1084
|
+
require: "./dist/tools/reflex/index.cjs"
|
|
1085
|
+
},
|
|
1081
1086
|
"./subagents": {
|
|
1082
1087
|
types: "./dist/subagents/index.d.ts",
|
|
1083
1088
|
import: "./dist/subagents/index.js",
|
|
@@ -1103,7 +1108,7 @@ var package_default = {
|
|
|
1103
1108
|
"!dist/**/*.test.*"
|
|
1104
1109
|
],
|
|
1105
1110
|
scripts: {
|
|
1106
|
-
build: "tsup version.ts index.ts edge.ts client.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 git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
|
|
1111
|
+
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 git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/reflex/index.ts tools/reflex/core.ts tools/reflex/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
|
|
1107
1112
|
prepare: "npm run build",
|
|
1108
1113
|
typecheck: "tsc --noEmit",
|
|
1109
1114
|
lint: "eslint .",
|
|
@@ -1886,16 +1891,238 @@ function parseGitHubUrl(input) {
|
|
|
1886
1891
|
);
|
|
1887
1892
|
}
|
|
1888
1893
|
|
|
1894
|
+
// tools/utils/resilience.ts
|
|
1895
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
1896
|
+
maxRetries: 3,
|
|
1897
|
+
initialDelay: 1e3,
|
|
1898
|
+
maxDelay: 3e4,
|
|
1899
|
+
backoffMultiplier: 2,
|
|
1900
|
+
retryableErrors: ["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND"]
|
|
1901
|
+
};
|
|
1902
|
+
async function fetchWithRetry(url, options, retryConfig = {}) {
|
|
1903
|
+
const {
|
|
1904
|
+
maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,
|
|
1905
|
+
initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,
|
|
1906
|
+
maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,
|
|
1907
|
+
backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,
|
|
1908
|
+
retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,
|
|
1909
|
+
onRetry
|
|
1910
|
+
} = retryConfig;
|
|
1911
|
+
let lastError = null;
|
|
1912
|
+
let delay = initialDelay;
|
|
1913
|
+
options = { ...options, headers: { "X-Morph-SDK-Version": SDK_VERSION, ...options.headers } };
|
|
1914
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1915
|
+
try {
|
|
1916
|
+
const response = await fetch(url, options);
|
|
1917
|
+
if (response.status === 429 || response.status === 503) {
|
|
1918
|
+
if (attempt < maxRetries) {
|
|
1919
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
1920
|
+
const waitTime = retryAfter ? parseInt(retryAfter) * 1e3 : Math.min(delay, maxDelay);
|
|
1921
|
+
const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);
|
|
1922
|
+
if (onRetry) {
|
|
1923
|
+
onRetry(attempt + 1, error);
|
|
1924
|
+
}
|
|
1925
|
+
await sleep(waitTime);
|
|
1926
|
+
delay *= backoffMultiplier;
|
|
1927
|
+
continue;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
return response;
|
|
1931
|
+
} catch (error) {
|
|
1932
|
+
lastError = error;
|
|
1933
|
+
const isRetryable = retryableErrors.some(
|
|
1934
|
+
(errType) => lastError?.message?.includes(errType)
|
|
1935
|
+
);
|
|
1936
|
+
if (!isRetryable || attempt === maxRetries) {
|
|
1937
|
+
throw lastError;
|
|
1938
|
+
}
|
|
1939
|
+
const waitTime = Math.min(delay, maxDelay);
|
|
1940
|
+
if (onRetry) {
|
|
1941
|
+
onRetry(attempt + 1, lastError);
|
|
1942
|
+
}
|
|
1943
|
+
await sleep(waitTime);
|
|
1944
|
+
delay *= backoffMultiplier;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
throw lastError || new Error("Max retries exceeded");
|
|
1948
|
+
}
|
|
1949
|
+
async function withTimeout(promise, timeoutMs, errorMessage) {
|
|
1950
|
+
let timeoutId;
|
|
1951
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
1952
|
+
timeoutId = setTimeout(() => {
|
|
1953
|
+
reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));
|
|
1954
|
+
}, timeoutMs);
|
|
1955
|
+
});
|
|
1956
|
+
try {
|
|
1957
|
+
const result = await Promise.race([promise, timeoutPromise]);
|
|
1958
|
+
clearTimeout(timeoutId);
|
|
1959
|
+
return result;
|
|
1960
|
+
} catch (error) {
|
|
1961
|
+
clearTimeout(timeoutId);
|
|
1962
|
+
throw error;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
function sleep(ms) {
|
|
1966
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1967
|
+
}
|
|
1968
|
+
var MorphError = class extends Error {
|
|
1969
|
+
constructor(message, code, statusCode, retryable = false) {
|
|
1970
|
+
super(message);
|
|
1971
|
+
this.code = code;
|
|
1972
|
+
this.statusCode = statusCode;
|
|
1973
|
+
this.retryable = retryable;
|
|
1974
|
+
this.name = "MorphError";
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
|
|
1978
|
+
// core/error.ts
|
|
1979
|
+
async function toMorphError(response) {
|
|
1980
|
+
let message = `Morph API request failed (${response.status})`;
|
|
1981
|
+
let code = "api_error";
|
|
1982
|
+
try {
|
|
1983
|
+
const body = await response.json();
|
|
1984
|
+
message = body.error?.message ?? body.message ?? message;
|
|
1985
|
+
code = body.error?.code ?? body.error?.type ?? code;
|
|
1986
|
+
} catch {
|
|
1987
|
+
}
|
|
1988
|
+
if (response.status === 401) code = "authentication_error";
|
|
1989
|
+
if (response.status === 429) code = "rate_limit_exceeded";
|
|
1990
|
+
const retryable = response.status === 429 || response.status === 503;
|
|
1991
|
+
return new MorphError(message, code, response.status, retryable);
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
// core/client.ts
|
|
1995
|
+
var DEFAULT_BASE_URL = "https://api.morphllm.com";
|
|
1996
|
+
var DEFAULT_REPOS_URL = "https://repos.morphllm.com";
|
|
1997
|
+
var DEFAULT_BROWSER_URL = "https://browser.morphllm.com";
|
|
1998
|
+
var DEFAULT_TIMEOUT = 6e4;
|
|
1999
|
+
var env = (name) => typeof process !== "undefined" ? process.env?.[name] : void 0;
|
|
2000
|
+
var stripTrailingSlash = (url) => url.replace(/\/+$/, "");
|
|
2001
|
+
var MorphAPIClient = class {
|
|
2002
|
+
/** Explicit key as provided; resolved against env at request time. */
|
|
2003
|
+
apiKey;
|
|
2004
|
+
baseURL;
|
|
2005
|
+
reposURL;
|
|
2006
|
+
browserURL;
|
|
2007
|
+
/** Explicit default timeout (ms), if set. The request default is applied lazily so
|
|
2008
|
+
* resources can read an undefined value and supply their own fallback. */
|
|
2009
|
+
timeout;
|
|
2010
|
+
retryConfig;
|
|
2011
|
+
debug;
|
|
2012
|
+
constructor(options = {}) {
|
|
2013
|
+
this.apiKey = options.apiKey;
|
|
2014
|
+
this.baseURL = stripTrailingSlash(options.baseURL ?? DEFAULT_BASE_URL);
|
|
2015
|
+
this.reposURL = stripTrailingSlash(options.reposURL ?? env("MORPH_SEARCH_URL") ?? DEFAULT_REPOS_URL);
|
|
2016
|
+
this.browserURL = stripTrailingSlash(
|
|
2017
|
+
options.browserURL ?? (env("MORPH_ENVIRONMENT") === "DEV" ? "http://localhost:8000" : DEFAULT_BROWSER_URL)
|
|
2018
|
+
);
|
|
2019
|
+
this.timeout = options.timeout;
|
|
2020
|
+
this.retryConfig = options.retryConfig;
|
|
2021
|
+
this.debug = options.debug ?? false;
|
|
2022
|
+
if (this.debug) logger.enable();
|
|
2023
|
+
}
|
|
2024
|
+
/** The key actually used for requests: explicit, else `MORPH_API_KEY`. */
|
|
2025
|
+
resolveApiKey() {
|
|
2026
|
+
return this.apiKey ?? env("MORPH_API_KEY");
|
|
2027
|
+
}
|
|
2028
|
+
/** Headers shared with tools that bring their own HTTP client (FastApply/WarpGrep via the `openai` package). */
|
|
2029
|
+
defaultHeaders() {
|
|
2030
|
+
return { "X-Morph-SDK-Version": SDK_VERSION };
|
|
2031
|
+
}
|
|
2032
|
+
buildURL(path6, baseURL) {
|
|
2033
|
+
if (/^https?:\/\//i.test(path6)) return path6;
|
|
2034
|
+
const base = stripTrailingSlash(baseURL ?? this.baseURL);
|
|
2035
|
+
return `${base}${path6.startsWith("/") ? "" : "/"}${path6}`;
|
|
2036
|
+
}
|
|
2037
|
+
buildHeaders(apiKey, extra) {
|
|
2038
|
+
return {
|
|
2039
|
+
"Content-Type": "application/json",
|
|
2040
|
+
"X-Morph-SDK-Version": SDK_VERSION,
|
|
2041
|
+
Authorization: `Bearer ${apiKey}`,
|
|
2042
|
+
...extra
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
applyQuery(url, query) {
|
|
2046
|
+
if (!query) return url;
|
|
2047
|
+
const params = new URLSearchParams();
|
|
2048
|
+
for (const [key, value] of Object.entries(query)) {
|
|
2049
|
+
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
2050
|
+
}
|
|
2051
|
+
const qs = params.toString();
|
|
2052
|
+
return qs ? `${url}${url.includes("?") ? "&" : "?"}${qs}` : url;
|
|
2053
|
+
}
|
|
2054
|
+
async request(method, path6, opts = {}) {
|
|
2055
|
+
const apiKey = this.resolveApiKey();
|
|
2056
|
+
if (!apiKey) {
|
|
2057
|
+
throw new MorphError(
|
|
2058
|
+
"Morph API key not found. Set the MORPH_API_KEY environment variable or pass apiKey in config.",
|
|
2059
|
+
"missing_api_key",
|
|
2060
|
+
401
|
|
2061
|
+
);
|
|
2062
|
+
}
|
|
2063
|
+
const url = this.applyQuery(this.buildURL(path6, opts.baseURL), opts.query);
|
|
2064
|
+
const timeout = opts.timeout ?? this.timeout ?? DEFAULT_TIMEOUT;
|
|
2065
|
+
const init = {
|
|
2066
|
+
method,
|
|
2067
|
+
headers: this.buildHeaders(apiKey, opts.headers),
|
|
2068
|
+
...opts.body !== void 0 ? { body: JSON.stringify(opts.body) } : {},
|
|
2069
|
+
...opts.signal ? { signal: opts.signal } : {}
|
|
2070
|
+
};
|
|
2071
|
+
logger.debug("MorphAPIClient", "request", { method, url });
|
|
2072
|
+
const response = await withTimeout(
|
|
2073
|
+
fetchWithRetry(url, init, this.retryConfig ?? {}),
|
|
2074
|
+
timeout,
|
|
2075
|
+
`Morph request to ${url} timed out after ${timeout}ms`
|
|
2076
|
+
);
|
|
2077
|
+
if (opts.raw) return response;
|
|
2078
|
+
if (!response.ok) throw await toMorphError(response);
|
|
2079
|
+
if (opts.stream) return response;
|
|
2080
|
+
if (response.status === 204) return void 0;
|
|
2081
|
+
const text = await response.text();
|
|
2082
|
+
return text ? JSON.parse(text) : void 0;
|
|
2083
|
+
}
|
|
2084
|
+
get(path6, opts) {
|
|
2085
|
+
return this.request("GET", path6, opts);
|
|
2086
|
+
}
|
|
2087
|
+
post(path6, opts) {
|
|
2088
|
+
return this.request("POST", path6, opts);
|
|
2089
|
+
}
|
|
2090
|
+
delete(path6, opts) {
|
|
2091
|
+
return this.request("DELETE", path6, opts);
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
|
|
2095
|
+
// core/resource.ts
|
|
2096
|
+
var APIResource = class {
|
|
2097
|
+
_client;
|
|
2098
|
+
constructor(client) {
|
|
2099
|
+
this._client = client;
|
|
2100
|
+
}
|
|
2101
|
+
};
|
|
2102
|
+
|
|
1889
2103
|
// tools/compact/core.ts
|
|
1890
2104
|
var DEFAULT_API_URL2 = "https://api.morphllm.com";
|
|
1891
|
-
var
|
|
1892
|
-
|
|
2105
|
+
var DEFAULT_TIMEOUT2 = 12e4;
|
|
2106
|
+
function resolveClient(clientOrConfig) {
|
|
2107
|
+
if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;
|
|
2108
|
+
return new MorphAPIClient({
|
|
2109
|
+
apiKey: clientOrConfig.morphApiKey,
|
|
2110
|
+
baseURL: clientOrConfig.morphApiUrl ?? DEFAULT_API_URL2,
|
|
2111
|
+
timeout: clientOrConfig.timeout ?? DEFAULT_TIMEOUT2,
|
|
2112
|
+
retryConfig: clientOrConfig.retryConfig,
|
|
2113
|
+
debug: clientOrConfig.debug
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
var CompactClient = class extends APIResource {
|
|
2117
|
+
/** Resolved URL/timeout, exposed for backwards-compatible introspection. */
|
|
1893
2118
|
config;
|
|
1894
|
-
constructor(
|
|
2119
|
+
constructor(clientOrConfig = {}) {
|
|
2120
|
+
super(resolveClient(clientOrConfig));
|
|
2121
|
+
const cfg = clientOrConfig instanceof MorphAPIClient ? {} : clientOrConfig;
|
|
1895
2122
|
this.config = {
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
2123
|
+
morphApiUrl: this._client.baseURL,
|
|
2124
|
+
timeout: cfg.timeout ?? DEFAULT_TIMEOUT2,
|
|
2125
|
+
debug: cfg.debug ?? false
|
|
1899
2126
|
};
|
|
1900
2127
|
}
|
|
1901
2128
|
/**
|
|
@@ -1914,17 +2141,6 @@ var CompactClient = class {
|
|
|
1914
2141
|
* ```
|
|
1915
2142
|
*/
|
|
1916
2143
|
async compact(input) {
|
|
1917
|
-
const apiKey = this.config.morphApiKey || (typeof process !== "undefined" ? process.env?.MORPH_API_KEY : void 0);
|
|
1918
|
-
const debug = this.config.debug || false;
|
|
1919
|
-
if (!apiKey) {
|
|
1920
|
-
throw new Error(
|
|
1921
|
-
"Morph API key not found. Set MORPH_API_KEY environment variable or pass morphApiKey in config."
|
|
1922
|
-
);
|
|
1923
|
-
}
|
|
1924
|
-
const url = `${this.config.morphApiUrl}/v1/compact`;
|
|
1925
|
-
if (debug) {
|
|
1926
|
-
console.log(`[Compact] Calling ${url}`);
|
|
1927
|
-
}
|
|
1928
2144
|
const body = {
|
|
1929
2145
|
compression_ratio: input.compressionRatio ?? 0.5,
|
|
1930
2146
|
preserve_recent: input.preserveRecent ?? 2,
|
|
@@ -1932,37 +2148,19 @@ var CompactClient = class {
|
|
|
1932
2148
|
include_line_ranges: input.includeLineRanges ?? true,
|
|
1933
2149
|
include_markers: input.includeMarkers ?? true
|
|
1934
2150
|
};
|
|
1935
|
-
if (input.query !== void 0)
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
if (input.
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
}
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
const startTime = Date.now();
|
|
1948
|
-
const response = await fetch(url, {
|
|
1949
|
-
method: "POST",
|
|
1950
|
-
headers: {
|
|
1951
|
-
"Authorization": `Bearer ${apiKey}`,
|
|
1952
|
-
"Content-Type": "application/json"
|
|
1953
|
-
},
|
|
1954
|
-
body: JSON.stringify(body),
|
|
1955
|
-
signal: AbortSignal.timeout(this.config.timeout)
|
|
1956
|
-
});
|
|
1957
|
-
if (!response.ok) {
|
|
1958
|
-
const text = await response.text();
|
|
1959
|
-
throw new Error(`Compact API error ${response.status}: ${text}`);
|
|
1960
|
-
}
|
|
1961
|
-
const data = await response.json();
|
|
1962
|
-
if (debug) {
|
|
1963
|
-
console.log(`[Compact] compact() done in ${Date.now() - startTime}ms`);
|
|
2151
|
+
if (input.query !== void 0) body.query = input.query;
|
|
2152
|
+
if (input.messages) body.messages = input.messages;
|
|
2153
|
+
else if (typeof input.input === "string") body.input = input.input;
|
|
2154
|
+
else if (Array.isArray(input.input)) body.messages = input.input;
|
|
2155
|
+
else throw new Error("Either 'input' or 'messages' must be provided");
|
|
2156
|
+
try {
|
|
2157
|
+
return await this._client.post("/v1/compact", { body, timeout: this.config.timeout });
|
|
2158
|
+
} catch (err) {
|
|
2159
|
+
if (err instanceof MorphError) {
|
|
2160
|
+
throw new Error(`Compact API error ${err.statusCode}: ${err.message}`);
|
|
2161
|
+
}
|
|
2162
|
+
throw err;
|
|
1964
2163
|
}
|
|
1965
|
-
return data;
|
|
1966
2164
|
}
|
|
1967
2165
|
};
|
|
1968
2166
|
|
|
@@ -2018,10 +2216,28 @@ async function getLocalProvider(repoRoot, excludes, allowNames) {
|
|
|
2018
2216
|
const opts = allowNames?.length ? { allowNames } : void 0;
|
|
2019
2217
|
return new LocalRipgrepProvider2(repoRoot, excludes, opts);
|
|
2020
2218
|
}
|
|
2021
|
-
var WarpGrepClient = class {
|
|
2219
|
+
var WarpGrepClient = class extends APIResource {
|
|
2022
2220
|
config;
|
|
2023
|
-
constructor(
|
|
2024
|
-
|
|
2221
|
+
constructor(clientOrConfig = {}) {
|
|
2222
|
+
const isClient = clientOrConfig instanceof MorphAPIClient;
|
|
2223
|
+
super(
|
|
2224
|
+
isClient ? clientOrConfig : new MorphAPIClient({
|
|
2225
|
+
apiKey: clientOrConfig.morphApiKey,
|
|
2226
|
+
baseURL: clientOrConfig.morphApiUrl,
|
|
2227
|
+
timeout: clientOrConfig.timeout,
|
|
2228
|
+
retryConfig: clientOrConfig.retryConfig,
|
|
2229
|
+
debug: clientOrConfig.debug
|
|
2230
|
+
})
|
|
2231
|
+
);
|
|
2232
|
+
const cfg = isClient ? {} : clientOrConfig;
|
|
2233
|
+
this.config = {
|
|
2234
|
+
...cfg,
|
|
2235
|
+
morphApiKey: this._client.resolveApiKey(),
|
|
2236
|
+
morphApiUrl: this._client.baseURL,
|
|
2237
|
+
timeout: this._client.timeout,
|
|
2238
|
+
retryConfig: this._client.retryConfig,
|
|
2239
|
+
debug: this._client.debug
|
|
2240
|
+
};
|
|
2025
2241
|
}
|
|
2026
2242
|
execute(input) {
|
|
2027
2243
|
const toolConfig = {
|