@morphllm/morphsdk 0.2.183 → 0.2.185
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-ALIS2RQM.js → chunk-24UC6ZQN.js} +2 -2
- package/dist/{chunk-HC3E2X3Q.js → chunk-43XUL5AE.js} +4 -4
- package/dist/{chunk-Z34FIIIY.js → chunk-5DXTZFD3.js} +3 -3
- package/dist/{chunk-6RGCQJCA.js → chunk-6NRW2BKD.js} +2 -2
- package/dist/{chunk-4AL5UU43.js → chunk-6TC4MPWU.js} +3 -3
- package/dist/{chunk-L6XLP5KW.js → chunk-6U5G2SPA.js} +4 -4
- package/dist/{chunk-Q4FFGCHN.js → chunk-7MBCP5WN.js} +2 -2
- package/dist/{chunk-SNEZIVPK.js → chunk-AO6QTJXC.js} +2 -2
- package/dist/{chunk-IDMKQWQG.js → chunk-ATAKRJQZ.js} +36 -1
- package/dist/chunk-ATAKRJQZ.js.map +1 -0
- package/dist/{chunk-ZP25QXTM.js → chunk-BSAYA7BP.js} +24 -24
- package/dist/{chunk-5B37BXPY.js → chunk-BSOTPFW4.js} +2 -2
- package/dist/{chunk-H4Z53LJO.js → chunk-G6ICBE5C.js} +2 -2
- package/dist/{chunk-MZSQVPMW.js → chunk-GA5UGAQO.js} +4 -4
- package/dist/{chunk-RVQWKMNC.js → chunk-GWZXD7DR.js} +2 -2
- package/dist/{chunk-YJMW3BWV.js → chunk-HON2QMAH.js} +4 -4
- package/dist/{chunk-2ZJ7HYSD.js → chunk-ISUN3WUG.js} +4 -4
- package/dist/{chunk-7POEHIJD.js → chunk-ITL5FQQZ.js} +2 -2
- package/dist/{chunk-4CAD3PJZ.js → chunk-K5475RSJ.js} +2 -2
- package/dist/{chunk-YQCT5FNK.js → chunk-K65ABCMU.js} +3 -26
- package/dist/chunk-K65ABCMU.js.map +1 -0
- package/dist/{chunk-5Y46GS6X.js → chunk-L2DS6J5U.js} +4 -4
- package/dist/{chunk-FTEHMPEN.js → chunk-L56HIF2J.js} +4 -4
- package/dist/{chunk-XZSCODV4.js → chunk-OMWX2LLV.js} +2 -2
- package/dist/{chunk-LN7GNFET.js → chunk-OPNTDMHH.js} +4 -4
- package/dist/{chunk-4FZMH2PJ.js → chunk-QTAWBCIT.js} +2 -2
- package/dist/{chunk-FJCXN2MZ.js → chunk-RZPKIVZG.js} +4 -4
- package/dist/{chunk-STJTJDAV.js → chunk-SYMPPKBU.js} +6 -14
- package/dist/chunk-SYMPPKBU.js.map +1 -0
- package/dist/{chunk-BIENM7HG.js → chunk-TNS73YVX.js} +2 -2
- package/dist/{chunk-D2KFCCAO.js → chunk-TSODFOG7.js} +3 -3
- package/dist/{chunk-D2KFCCAO.js.map → chunk-TSODFOG7.js.map} +1 -1
- package/dist/{chunk-VLE7NFGC.js → chunk-TX6EOYB4.js} +2 -2
- package/dist/{chunk-F2AEMPYM.js → chunk-VLXXQUBO.js} +2 -2
- package/dist/{chunk-Q5YPHAVJ.js → chunk-WMLU7FIF.js} +4 -4
- package/dist/{chunk-57TTNFVC.js → chunk-X2W36VGZ.js} +3 -3
- package/dist/{chunk-7PTLVOSX.js → chunk-XVBHUK4P.js} +2 -2
- package/dist/{chunk-3CKKTPPO.js → chunk-YN2PYKR2.js} +2 -2
- package/dist/client.cjs +2 -25
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +28 -28
- package/dist/core/client.cjs +2 -2
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.js +4 -4
- package/dist/core/error.cjs +2 -2
- package/dist/core/error.cjs.map +1 -1
- package/dist/core/error.js +3 -3
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +4 -4
- package/dist/edge.cjs +2 -2
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +7 -7
- package/dist/git/client.cjs +2 -2
- package/dist/git/client.cjs.map +1 -1
- package/dist/git/client.js +5 -5
- package/dist/git/index.cjs +2 -2
- package/dist/git/index.cjs.map +1 -1
- package/dist/git/index.js +5 -5
- package/dist/index.cjs +2 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -32
- package/dist/modelrouter/core.cjs +2 -2
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +5 -5
- package/dist/modelrouter/index.cjs +2 -2
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +5 -5
- package/dist/subagents/anthropic.cjs +2 -2
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.js +9 -9
- package/dist/subagents/vercel.cjs +2 -2
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.js +9 -9
- package/dist/tools/browser/anthropic.cjs +2 -2
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +7 -7
- package/dist/tools/browser/core.cjs +2 -2
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +6 -6
- package/dist/tools/browser/index.cjs +2 -2
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +11 -11
- package/dist/tools/browser/openai.cjs +2 -2
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +7 -7
- package/dist/tools/browser/profiles/core.cjs +2 -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 +2 -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 +2 -2
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +7 -7
- package/dist/tools/codebase_search/anthropic.cjs +2 -2
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +6 -6
- package/dist/tools/codebase_search/core.cjs +2 -2
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.js +5 -5
- package/dist/tools/codebase_search/index.cjs +2 -2
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +10 -10
- package/dist/tools/codebase_search/openai.cjs +2 -2
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +6 -6
- package/dist/tools/codebase_search/vercel.cjs +2 -2
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +6 -6
- package/dist/tools/compact/core.cjs +2 -2
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.js +5 -5
- package/dist/tools/compact/index.cjs +2 -2
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.js +6 -6
- package/dist/tools/fastapply/anthropic.cjs +2 -2
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +7 -7
- package/dist/tools/fastapply/apply.cjs +2 -2
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +2 -2
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +6 -6
- package/dist/tools/fastapply/index.cjs +2 -2
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +11 -11
- package/dist/tools/fastapply/openai.cjs +2 -2
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +7 -7
- package/dist/tools/fastapply/vercel.cjs +2 -2
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +7 -7
- package/dist/tools/index.cjs +2 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +11 -11
- package/dist/tools/reflex/core.cjs +2 -25
- package/dist/tools/reflex/core.cjs.map +1 -1
- package/dist/tools/reflex/core.d.ts +1 -6
- package/dist/tools/reflex/core.js +5 -5
- package/dist/tools/reflex/index.cjs +2 -25
- package/dist/tools/reflex/index.cjs.map +1 -1
- package/dist/tools/reflex/index.js +5 -5
- package/dist/tools/reflex/types.cjs.map +1 -1
- package/dist/tools/reflex/types.d.ts +2 -30
- package/dist/tools/utils/resilience.cjs +2 -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 +2 -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 +2 -2
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +9 -9
- package/dist/tools/warp_grep/client.cjs +2 -2
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +8 -8
- package/dist/tools/warp_grep/gemini.cjs +2 -2
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +8 -8
- package/dist/tools/warp_grep/harness.js +2 -2
- package/dist/tools/warp_grep/index.cjs +2 -2
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +10 -10
- package/dist/tools/warp_grep/openai.cjs +2 -2
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +9 -9
- package/dist/tools/warp_grep/providers/local.js +2 -2
- package/dist/tools/warp_grep/vercel.cjs +2 -2
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +9 -9
- package/dist/tracing/core.cjs +34 -40
- package/dist/tracing/core.cjs.map +1 -1
- package/dist/tracing/core.d.ts +3 -6
- package/dist/tracing/core.js +2 -3
- package/dist/tracing/index.cjs +42 -42
- package/dist/tracing/index.cjs.map +1 -1
- package/dist/tracing/index.d.ts +35 -1
- package/dist/tracing/index.js +10 -4
- package/dist/tracing/interaction.cjs +30 -0
- package/dist/tracing/interaction.cjs.map +1 -1
- package/dist/tracing/interaction.js +1 -1
- package/dist/tracing/types.cjs.map +1 -1
- package/dist/tracing/types.d.ts +27 -14
- package/dist/version.cjs +2 -2
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-IDMKQWQG.js.map +0 -1
- package/dist/chunk-PICGNBUE.js +0 -35
- package/dist/chunk-PICGNBUE.js.map +0 -1
- package/dist/chunk-STJTJDAV.js.map +0 -1
- package/dist/chunk-YQCT5FNK.js.map +0 -1
- package/dist/tracing/signals.cjs +0 -59
- package/dist/tracing/signals.cjs.map +0 -1
- package/dist/tracing/signals.d.ts +0 -13
- package/dist/tracing/signals.js +0 -8
- package/dist/tracing/signals.js.map +0 -1
- /package/dist/{chunk-ALIS2RQM.js.map → chunk-24UC6ZQN.js.map} +0 -0
- /package/dist/{chunk-HC3E2X3Q.js.map → chunk-43XUL5AE.js.map} +0 -0
- /package/dist/{chunk-Z34FIIIY.js.map → chunk-5DXTZFD3.js.map} +0 -0
- /package/dist/{chunk-6RGCQJCA.js.map → chunk-6NRW2BKD.js.map} +0 -0
- /package/dist/{chunk-4AL5UU43.js.map → chunk-6TC4MPWU.js.map} +0 -0
- /package/dist/{chunk-L6XLP5KW.js.map → chunk-6U5G2SPA.js.map} +0 -0
- /package/dist/{chunk-Q4FFGCHN.js.map → chunk-7MBCP5WN.js.map} +0 -0
- /package/dist/{chunk-SNEZIVPK.js.map → chunk-AO6QTJXC.js.map} +0 -0
- /package/dist/{chunk-ZP25QXTM.js.map → chunk-BSAYA7BP.js.map} +0 -0
- /package/dist/{chunk-5B37BXPY.js.map → chunk-BSOTPFW4.js.map} +0 -0
- /package/dist/{chunk-H4Z53LJO.js.map → chunk-G6ICBE5C.js.map} +0 -0
- /package/dist/{chunk-MZSQVPMW.js.map → chunk-GA5UGAQO.js.map} +0 -0
- /package/dist/{chunk-RVQWKMNC.js.map → chunk-GWZXD7DR.js.map} +0 -0
- /package/dist/{chunk-YJMW3BWV.js.map → chunk-HON2QMAH.js.map} +0 -0
- /package/dist/{chunk-2ZJ7HYSD.js.map → chunk-ISUN3WUG.js.map} +0 -0
- /package/dist/{chunk-7POEHIJD.js.map → chunk-ITL5FQQZ.js.map} +0 -0
- /package/dist/{chunk-4CAD3PJZ.js.map → chunk-K5475RSJ.js.map} +0 -0
- /package/dist/{chunk-5Y46GS6X.js.map → chunk-L2DS6J5U.js.map} +0 -0
- /package/dist/{chunk-FTEHMPEN.js.map → chunk-L56HIF2J.js.map} +0 -0
- /package/dist/{chunk-XZSCODV4.js.map → chunk-OMWX2LLV.js.map} +0 -0
- /package/dist/{chunk-LN7GNFET.js.map → chunk-OPNTDMHH.js.map} +0 -0
- /package/dist/{chunk-4FZMH2PJ.js.map → chunk-QTAWBCIT.js.map} +0 -0
- /package/dist/{chunk-FJCXN2MZ.js.map → chunk-RZPKIVZG.js.map} +0 -0
- /package/dist/{chunk-BIENM7HG.js.map → chunk-TNS73YVX.js.map} +0 -0
- /package/dist/{chunk-VLE7NFGC.js.map → chunk-TX6EOYB4.js.map} +0 -0
- /package/dist/{chunk-F2AEMPYM.js.map → chunk-VLXXQUBO.js.map} +0 -0
- /package/dist/{chunk-Q5YPHAVJ.js.map → chunk-WMLU7FIF.js.map} +0 -0
- /package/dist/{chunk-57TTNFVC.js.map → chunk-X2W36VGZ.js.map} +0 -0
- /package/dist/{chunk-7PTLVOSX.js.map → chunk-XVBHUK4P.js.map} +0 -0
- /package/dist/{chunk-3CKKTPPO.js.map → chunk-YN2PYKR2.js.map} +0 -0
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
executeToolCall,
|
|
15
15
|
formatGitHubReadFileResult,
|
|
16
16
|
formatResult
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-43XUL5AE.js";
|
|
18
18
|
|
|
19
19
|
// tools/warp_grep/openai.ts
|
|
20
20
|
var TOOL_PARAMETERS = {
|
|
@@ -104,4 +104,4 @@ export {
|
|
|
104
104
|
createGitHubReadFileTool,
|
|
105
105
|
openai_default
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-24UC6ZQN.js.map
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
runWarpGrep,
|
|
12
12
|
runWarpGrepStreaming
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-7MBCP5WN.js";
|
|
14
14
|
import {
|
|
15
15
|
compactFileContexts
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TNS73YVX.js";
|
|
17
17
|
import {
|
|
18
18
|
MorphAPIClient
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-L2DS6J5U.js";
|
|
20
20
|
import {
|
|
21
21
|
logger
|
|
22
22
|
} from "./chunk-F3NCFNUX.js";
|
|
@@ -321,4 +321,4 @@ export {
|
|
|
321
321
|
formatGitHubReadFileResult,
|
|
322
322
|
formatResult
|
|
323
323
|
};
|
|
324
|
-
//# sourceMappingURL=chunk-
|
|
324
|
+
//# sourceMappingURL=chunk-43XUL5AE.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphAPIClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L2DS6J5U.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
6
|
} from "./chunk-F3NCFNUX.js";
|
|
7
7
|
import {
|
|
8
8
|
MorphError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OMWX2LLV.js";
|
|
10
10
|
import {
|
|
11
11
|
APIResource
|
|
12
12
|
} from "./chunk-LKFZBBTD.js";
|
|
@@ -94,4 +94,4 @@ export {
|
|
|
94
94
|
CodebaseSearchClient,
|
|
95
95
|
executeCodebaseSearch
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-5DXTZFD3.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OMWX2LLV.js";
|
|
4
4
|
|
|
5
5
|
// core/error.ts
|
|
6
6
|
async function toMorphError(response) {
|
|
@@ -21,4 +21,4 @@ async function toMorphError(response) {
|
|
|
21
21
|
export {
|
|
22
22
|
toMorphError
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-6NRW2BKD.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphAPIClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L2DS6J5U.js";
|
|
4
4
|
import {
|
|
5
5
|
MorphError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OMWX2LLV.js";
|
|
7
7
|
import {
|
|
8
8
|
APIResource
|
|
9
9
|
} from "./chunk-LKFZBBTD.js";
|
|
@@ -75,4 +75,4 @@ var CompactClient = class extends APIResource {
|
|
|
75
75
|
export {
|
|
76
76
|
CompactClient
|
|
77
77
|
};
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
78
|
+
//# sourceMappingURL=chunk-6TC4MPWU.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
executeCodebaseSearch
|
|
3
|
+
} from "./chunk-5DXTZFD3.js";
|
|
1
4
|
import {
|
|
2
5
|
CODEBASE_SEARCH_DESCRIPTION,
|
|
3
6
|
CODEBASE_SEARCH_SYSTEM_PROMPT
|
|
4
7
|
} from "./chunk-YQMPVJ2L.js";
|
|
5
|
-
import {
|
|
6
|
-
executeCodebaseSearch
|
|
7
|
-
} from "./chunk-Z34FIIIY.js";
|
|
8
8
|
|
|
9
9
|
// tools/codebase_search/anthropic.ts
|
|
10
10
|
function createCodebaseSearchTool(config) {
|
|
@@ -80,4 +80,4 @@ function formatResult(result) {
|
|
|
80
80
|
export {
|
|
81
81
|
createCodebaseSearchTool
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-6U5G2SPA.js.map
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "./chunk-F3NCFNUX.js";
|
|
24
24
|
import {
|
|
25
25
|
SDK_VERSION
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-TSODFOG7.js";
|
|
27
27
|
|
|
28
28
|
// tools/warp_grep/agent/runner.ts
|
|
29
29
|
import OpenAI from "openai";
|
|
@@ -425,4 +425,4 @@ export {
|
|
|
425
425
|
runWarpGrepStreaming,
|
|
426
426
|
runWarpGrep
|
|
427
427
|
};
|
|
428
|
-
//# sourceMappingURL=chunk-
|
|
428
|
+
//# sourceMappingURL=chunk-7MBCP5WN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphAPIClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L2DS6J5U.js";
|
|
4
4
|
import {
|
|
5
5
|
APIResource
|
|
6
6
|
} from "./chunk-LKFZBBTD.js";
|
|
@@ -558,4 +558,4 @@ var MorphGit = class extends APIResource {
|
|
|
558
558
|
export {
|
|
559
559
|
MorphGit
|
|
560
560
|
};
|
|
561
|
-
//# sourceMappingURL=chunk-
|
|
561
|
+
//# sourceMappingURL=chunk-AO6QTJXC.js.map
|
|
@@ -5,6 +5,36 @@ import {
|
|
|
5
5
|
// tracing/interaction.ts
|
|
6
6
|
import { context, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
7
|
import * as traceloop from "@traceloop/node-server-sdk";
|
|
8
|
+
|
|
9
|
+
// tracing/reflex.ts
|
|
10
|
+
var REFLEX_RUN_ATTRIBUTE = "morph.reflex.run";
|
|
11
|
+
var USER_TRANSFORM = "user_message";
|
|
12
|
+
var ASSISTANT_TRANSFORM = "assistant_message";
|
|
13
|
+
function normalizeEvals(evals) {
|
|
14
|
+
if (!evals) return [];
|
|
15
|
+
const out = [];
|
|
16
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17
|
+
const add = (models, transform) => {
|
|
18
|
+
if (!Array.isArray(models)) return;
|
|
19
|
+
for (const raw of models) {
|
|
20
|
+
const model = typeof raw === "string" ? raw.trim() : "";
|
|
21
|
+
if (!model) continue;
|
|
22
|
+
const key = `${model} ${transform}`;
|
|
23
|
+
if (seen.has(key)) continue;
|
|
24
|
+
seen.add(key);
|
|
25
|
+
out.push({ model, transform });
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
add(evals.user, USER_TRANSFORM);
|
|
29
|
+
add(evals.assistant, ASSISTANT_TRANSFORM);
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
function serializeEvals(evals) {
|
|
33
|
+
const entries = normalizeEvals(evals);
|
|
34
|
+
return entries.length ? JSON.stringify(entries) : null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// tracing/interaction.ts
|
|
8
38
|
var ASSOC = "traceloop.association.properties.";
|
|
9
39
|
var ENTITY_INPUT = "traceloop.entity.input";
|
|
10
40
|
var ENTITY_OUTPUT = "traceloop.entity.output";
|
|
@@ -39,6 +69,7 @@ function createInteractionApi(initial, traceContent, onClose) {
|
|
|
39
69
|
let input = initial.input;
|
|
40
70
|
let workflowSpan = null;
|
|
41
71
|
let finished = false;
|
|
72
|
+
const reflexRun = serializeEvals(initial.evals);
|
|
42
73
|
const withAssoc = (fn) => traceloop.withAssociationProperties(associationProps(ctx, properties), fn);
|
|
43
74
|
const workflowName = () => ctx.event ?? "interaction";
|
|
44
75
|
function ensureWorkflowSpan() {
|
|
@@ -49,6 +80,7 @@ function createInteractionApi(initial, traceContent, onClose) {
|
|
|
49
80
|
span.setAttribute(ASSOC + k, v);
|
|
50
81
|
}
|
|
51
82
|
if (traceContent && input) span.setAttribute(ENTITY_INPUT, input);
|
|
83
|
+
if (reflexRun) span.setAttribute(REFLEX_RUN_ATTRIBUTE, reflexRun);
|
|
52
84
|
workflowSpan = span;
|
|
53
85
|
return span;
|
|
54
86
|
}
|
|
@@ -208,7 +240,10 @@ function createNoopInteraction(initial) {
|
|
|
208
240
|
}
|
|
209
241
|
|
|
210
242
|
export {
|
|
243
|
+
REFLEX_RUN_ATTRIBUTE,
|
|
244
|
+
normalizeEvals,
|
|
245
|
+
serializeEvals,
|
|
211
246
|
createInteractionApi,
|
|
212
247
|
createNoopInteraction
|
|
213
248
|
};
|
|
214
|
-
//# sourceMappingURL=chunk-
|
|
249
|
+
//# sourceMappingURL=chunk-ATAKRJQZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tracing/interaction.ts","../tracing/reflex.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 { REFLEX_RUN_ATTRIBUTE, serializeEvals } from './reflex.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 // Serialized once. Set as a raw attribute on the workflow span only — NOT an\n // association property, so it is not copied onto every child LLM span. Ingest\n // reads `morph.reflex.run` off the workflow-span to enqueue the evals.\n const reflexRun = serializeEvals(initial.evals);\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 if (reflexRun) span.setAttribute(REFLEX_RUN_ATTRIBUTE, reflexRun);\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","/**\n * Morph Tracing — eval selection (which Reflexes to run on a trace).\n *\n * The public API is `evals` (see {@link EvalSelection}): `{ user, assistant }` choosing which role\n * each model classifies. We deliberately keep the public surface to plain nouns and hide the wire\n * detail: the selection is serialized onto a single\n * `morph.reflex.run` attribute on the interaction's workflow span (NOT an association property,\n * so it is not copied onto child LLM spans), and the per-role choice maps to the backend's\n * transform ids. Morph's ingest reads that attribute and runs the classifications async; results\n * land in the traces dashboard already labeled.\n */\nimport type { EvalSelection } from './types.js';\n\n/** Raw span attribute key carrying the serialized selection (internal wire detail). */\nexport const REFLEX_RUN_ATTRIBUTE = 'morph.reflex.run';\n\n// Public role → backend transform id. `user` classifies the user's message, `assistant` the\n// agent's output. (Whole-conversation evals are not exposed yet.)\nconst USER_TRANSFORM = 'user_message';\nconst ASSISTANT_TRANSFORM = 'assistant_message';\n\n/** One serialized entry on the wire: the model alias and the transform to run it on. */\nexport interface EvalRunEntry {\n model: string;\n transform: string;\n}\n\n/**\n * Normalize a public `evals` selection into deduped `{ model, transform }` wire entries.\n * `user` models run on the user turn, `assistant` models on the agent turn. Drops blank models;\n * preserves first-seen order. Exported for tests and so callers can see exactly what runs.\n */\nexport function normalizeEvals(evals: EvalSelection | undefined): EvalRunEntry[] {\n if (!evals) return [];\n const out: EvalRunEntry[] = [];\n const seen = new Set<string>();\n const add = (models: string[] | undefined, transform: string): void => {\n // Guard against a non-array (e.g. an untyped JS caller passing { user: \"jailbreak\" }) — iterating\n // a string would emit one bogus entry per character. Types forbid this; this is runtime defense.\n if (!Array.isArray(models)) return;\n for (const raw of models) {\n const model = typeof raw === 'string' ? raw.trim() : '';\n if (!model) continue;\n const key = `${model} ${transform}`;\n if (seen.has(key)) continue;\n seen.add(key);\n out.push({ model, transform });\n }\n };\n add(evals.user, USER_TRANSFORM);\n add(evals.assistant, ASSISTANT_TRANSFORM);\n return out;\n}\n\n/**\n * Serialize an `evals` selection to the `morph.reflex.run` attribute string, or `null` when\n * there is nothing to run (so the attribute is simply omitted and no classification is enqueued).\n */\nexport function serializeEvals(evals: EvalSelection | undefined): string | null {\n const entries = normalizeEvals(evals);\n return entries.length ? JSON.stringify(entries) : null;\n}\n"],"mappings":";;;;;AASA,SAAS,SAAS,gBAAgB,aAAwB;AAC1D,YAAY,eAAe;;;ACIpB,IAAM,uBAAuB;AAIpC,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAarB,SAAS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S,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,70 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createGitHubSearchTool as createGitHubSearchTool3,
|
|
3
|
-
createWarpGrepTool as createWarpGrepTool3
|
|
4
|
-
} from "./chunk-VLE7NFGC.js";
|
|
5
1
|
import {
|
|
6
2
|
createGitHubSearchTool as createGitHubSearchTool2,
|
|
7
3
|
createWarpGrepTool as createWarpGrepTool2
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-K5475RSJ.js";
|
|
9
5
|
import {
|
|
10
6
|
createGitHubSearchTool,
|
|
11
7
|
createWarpGrepTool
|
|
12
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-24UC6ZQN.js";
|
|
9
|
+
import {
|
|
10
|
+
createGitHubSearchTool as createGitHubSearchTool3,
|
|
11
|
+
createWarpGrepTool as createWarpGrepTool3
|
|
12
|
+
} from "./chunk-TX6EOYB4.js";
|
|
13
13
|
import {
|
|
14
14
|
ReflexClient
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-K65ABCMU.js";
|
|
16
16
|
import {
|
|
17
17
|
createCodebaseSearchTool as createCodebaseSearchTool3
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RZPKIVZG.js";
|
|
19
19
|
import {
|
|
20
20
|
createCodebaseSearchTool as createCodebaseSearchTool2
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-6U5G2SPA.js";
|
|
22
22
|
import {
|
|
23
23
|
createCodebaseSearchTool
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-L56HIF2J.js";
|
|
25
25
|
import {
|
|
26
26
|
CodebaseSearchClient
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-5DXTZFD3.js";
|
|
28
28
|
import {
|
|
29
29
|
BrowserClient
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HON2QMAH.js";
|
|
31
31
|
import {
|
|
32
32
|
createExploreSubagent as createExploreSubagent2
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-GWZXD7DR.js";
|
|
34
34
|
import {
|
|
35
35
|
createEditFileTool
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-ISUN3WUG.js";
|
|
37
37
|
import {
|
|
38
38
|
createEditFileTool as createEditFileTool3
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-GA5UGAQO.js";
|
|
40
40
|
import {
|
|
41
41
|
createEditFileTool as createEditFileTool2
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-WMLU7FIF.js";
|
|
43
43
|
import {
|
|
44
44
|
FastApplyClient
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-YN2PYKR2.js";
|
|
46
46
|
import {
|
|
47
47
|
MorphGit
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-AO6QTJXC.js";
|
|
49
49
|
import {
|
|
50
50
|
createExploreSubagent
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-VLXXQUBO.js";
|
|
52
52
|
import {
|
|
53
53
|
WarpGrepClient
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-43XUL5AE.js";
|
|
55
55
|
import {
|
|
56
56
|
AnthropicRouter,
|
|
57
57
|
GeminiRouter,
|
|
58
58
|
OpenAIRouter,
|
|
59
59
|
RawRouter,
|
|
60
60
|
RouterClassifier
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-X2W36VGZ.js";
|
|
62
62
|
import {
|
|
63
63
|
CompactClient
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-6TC4MPWU.js";
|
|
65
65
|
import {
|
|
66
66
|
MorphAPIClient
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-L2DS6J5U.js";
|
|
68
68
|
import {
|
|
69
69
|
logger
|
|
70
70
|
} from "./chunk-F3NCFNUX.js";
|
|
@@ -689,4 +689,4 @@ export {
|
|
|
689
689
|
VercelToolFactory,
|
|
690
690
|
MorphClient
|
|
691
691
|
};
|
|
692
|
-
//# sourceMappingURL=chunk-
|
|
692
|
+
//# sourceMappingURL=chunk-BSAYA7BP.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-2HMEZZKK.js";
|
|
5
5
|
import {
|
|
6
6
|
executeBrowserTask
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HON2QMAH.js";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
10
|
} from "./chunk-PZ5AY32C.js";
|
|
@@ -93,4 +93,4 @@ export {
|
|
|
93
93
|
createBrowserTool,
|
|
94
94
|
openai_exports
|
|
95
95
|
};
|
|
96
|
-
//# sourceMappingURL=chunk-
|
|
96
|
+
//# sourceMappingURL=chunk-BSOTPFW4.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-2HMEZZKK.js";
|
|
5
5
|
import {
|
|
6
6
|
executeBrowserTask
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HON2QMAH.js";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
10
|
} from "./chunk-PZ5AY32C.js";
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
createBrowserTool,
|
|
78
78
|
anthropic_exports
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-G6ICBE5C.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
executeEditFile
|
|
3
|
-
} from "./chunk-3CKKTPPO.js";
|
|
4
1
|
import {
|
|
5
2
|
EDIT_FILE_SYSTEM_PROMPT,
|
|
6
3
|
EDIT_FILE_TOOL_DESCRIPTION
|
|
7
4
|
} from "./chunk-63WE2C5R.js";
|
|
5
|
+
import {
|
|
6
|
+
executeEditFile
|
|
7
|
+
} from "./chunk-YN2PYKR2.js";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
10
|
} from "./chunk-PZ5AY32C.js";
|
|
@@ -86,4 +86,4 @@ export {
|
|
|
86
86
|
vercel_default,
|
|
87
87
|
vercel_exports
|
|
88
88
|
};
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
89
|
+
//# sourceMappingURL=chunk-GA5UGAQO.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WarpGrepClient,
|
|
3
3
|
formatResult
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-43XUL5AE.js";
|
|
5
5
|
import {
|
|
6
6
|
CODEBASE_SEARCH_TOOL,
|
|
7
7
|
SEND_MESSAGE_TOOL,
|
|
@@ -262,4 +262,4 @@ function deduplicateContexts(contexts) {
|
|
|
262
262
|
export {
|
|
263
263
|
createExploreSubagent
|
|
264
264
|
};
|
|
265
|
-
//# sourceMappingURL=chunk-
|
|
265
|
+
//# sourceMappingURL=chunk-GWZXD7DR.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProfilesClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ITL5FQQZ.js";
|
|
4
4
|
import {
|
|
5
5
|
buildEmbedCode,
|
|
6
6
|
buildLiveIframe,
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
} from "./chunk-YTYCHRQ2.js";
|
|
10
10
|
import {
|
|
11
11
|
MorphAPIClient
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-L2DS6J5U.js";
|
|
13
13
|
import {
|
|
14
14
|
logger
|
|
15
15
|
} from "./chunk-F3NCFNUX.js";
|
|
16
16
|
import {
|
|
17
17
|
fetchWithRetry,
|
|
18
18
|
withTimeout
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-OMWX2LLV.js";
|
|
20
20
|
import {
|
|
21
21
|
APIResource
|
|
22
22
|
} from "./chunk-LKFZBBTD.js";
|
|
@@ -619,4 +619,4 @@ export {
|
|
|
619
619
|
getWebp,
|
|
620
620
|
checkHealth
|
|
621
621
|
};
|
|
622
|
-
//# sourceMappingURL=chunk-
|
|
622
|
+
//# sourceMappingURL=chunk-HON2QMAH.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
executeEditFile
|
|
3
|
-
} from "./chunk-3CKKTPPO.js";
|
|
4
1
|
import {
|
|
5
2
|
EDIT_FILE_SYSTEM_PROMPT,
|
|
6
3
|
EDIT_FILE_TOOL_DESCRIPTION
|
|
7
4
|
} from "./chunk-63WE2C5R.js";
|
|
5
|
+
import {
|
|
6
|
+
executeEditFile
|
|
7
|
+
} from "./chunk-YN2PYKR2.js";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
10
|
} from "./chunk-PZ5AY32C.js";
|
|
@@ -91,4 +91,4 @@ export {
|
|
|
91
91
|
openai_default,
|
|
92
92
|
openai_exports
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-ISUN3WUG.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-2VERUKO2.js";
|
|
13
13
|
import {
|
|
14
14
|
fetchWithRetry
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OMWX2LLV.js";
|
|
16
16
|
|
|
17
17
|
// tools/browser/profiles/core.ts
|
|
18
18
|
var DEFAULT_API_URL = process.env.MORPH_ENVIRONMENT === "DEV" ? "http://localhost:8000" : "https://browser.morphllm.com";
|
|
@@ -386,4 +386,4 @@ export {
|
|
|
386
386
|
listRepos,
|
|
387
387
|
getProfileState
|
|
388
388
|
};
|
|
389
|
-
//# sourceMappingURL=chunk-
|
|
389
|
+
//# sourceMappingURL=chunk-ITL5FQQZ.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
executeToolCall,
|
|
15
15
|
formatGitHubReadFileResult,
|
|
16
16
|
formatResult
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-43XUL5AE.js";
|
|
18
18
|
|
|
19
19
|
// tools/warp_grep/anthropic.ts
|
|
20
20
|
var INPUT_SCHEMA = {
|
|
@@ -90,4 +90,4 @@ export {
|
|
|
90
90
|
createGitHubSearchTool,
|
|
91
91
|
createGitHubReadFileTool
|
|
92
92
|
};
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-K5475RSJ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MorphAPIClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L2DS6J5U.js";
|
|
4
4
|
import {
|
|
5
5
|
MorphError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OMWX2LLV.js";
|
|
7
7
|
import {
|
|
8
8
|
APIResource
|
|
9
9
|
} from "./chunk-LKFZBBTD.js";
|
|
@@ -36,29 +36,6 @@ var ReflexClient = class extends APIResource {
|
|
|
36
36
|
});
|
|
37
37
|
return toPredictResult(raw, completionId);
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Record thumbs-up / thumbs-down feedback on a prediction. Reference the
|
|
41
|
-
* prediction by the `completionId` from `predict()` or by a stored `resultId`.
|
|
42
|
-
*/
|
|
43
|
-
async flag(input) {
|
|
44
|
-
if (!input.completionId && !input.resultId) {
|
|
45
|
-
throw new MorphError("flag() requires completionId or resultId", "reflex_flag_missing_ref");
|
|
46
|
-
}
|
|
47
|
-
const body = { good_or_bad: input.verdict };
|
|
48
|
-
if (input.completionId) body.completion_id = input.completionId;
|
|
49
|
-
if (input.resultId) body.result_id = input.resultId;
|
|
50
|
-
if (input.correctedLabel != null) body.corrected_label = input.correctedLabel;
|
|
51
|
-
if (input.reason != null) body.reason = input.reason;
|
|
52
|
-
if (input.score != null) body.score = input.score;
|
|
53
|
-
const raw = await this._client.post("/v1/reflex/predictions/flag", { body });
|
|
54
|
-
return {
|
|
55
|
-
resultId: raw.result_id ?? null,
|
|
56
|
-
completionId: raw.completion_id ?? null,
|
|
57
|
-
verdict: raw.flagged_good_or_bad ?? null,
|
|
58
|
-
correctedLabel: raw.flagged_corrected_label ?? null,
|
|
59
|
-
flagged: Boolean(raw.flagged)
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
39
|
};
|
|
63
40
|
var ReflexJobsResource = class extends APIResource {
|
|
64
41
|
/** Start a training job from labeled data, a description, or unlabeled text. */
|
|
@@ -198,4 +175,4 @@ export {
|
|
|
198
175
|
ReflexClient,
|
|
199
176
|
ReflexJobsResource
|
|
200
177
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
178
|
+
//# sourceMappingURL=chunk-K65ABCMU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/reflex/core.ts"],"sourcesContent":["/**\n * Reflex: train and serve small text classifiers.\n *\n * const morph = new MorphClient({ apiKey });\n * const job = await morph.reflex.jobs.create({ trainingData: rows, suffix: 'support' });\n * const ready = await morph.reflex.jobs.waitForReady(job.id);\n * const out = await morph.reflex.predict({ model: ready.fineTunedModel!, text: 'refund please' });\n *\n * Mirrors the OpenAI fine-tuning shape (`reflex.jobs.create/retrieve/list/cancel/delete`)\n * plus `reflex.predict`. All HTTP goes through the shared `MorphAPIClient` transport.\n */\nimport { MorphAPIClient } from '../../core/client.js';\nimport { APIResource } from '../../core/resource.js';\nimport { MorphError } from '../utils/resilience.js';\nimport type {\n CreateReflexJobInput,\n DeletedReflexJob,\n ListReflexJobsInput,\n ReflexConfig,\n ReflexEvent,\n ReflexJob,\n ReflexJobList,\n ReflexPredictClass,\n ReflexPredictInput,\n ReflexPredictResult,\n} from './types.js';\n\nconst BASE_MODEL = 'morph-reflex-v1';\n\n/** Build a transport from either a shared client or a standalone `ReflexConfig`. */\nfunction resolveClient(clientOrConfig: MorphAPIClient | ReflexConfig): MorphAPIClient {\n if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;\n return new MorphAPIClient({\n apiKey: clientOrConfig.apiKey,\n baseURL: clientOrConfig.baseUrl,\n timeout: clientOrConfig.timeout,\n retryConfig: clientOrConfig.retryConfig,\n debug: clientOrConfig.debug,\n });\n}\n\n/**\n * @deprecated Prefer the unified `MorphClient` (`new MorphClient({ apiKey }).reflex`).\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 ReflexClient extends APIResource {\n /** Train, retrieve, and manage classifier jobs. */\n public readonly jobs: ReflexJobsResource;\n\n constructor(clientOrConfig: MorphAPIClient | ReflexConfig = {}) {\n super(resolveClient(clientOrConfig));\n this.jobs = new ReflexJobsResource(this._client);\n }\n\n /** Classify text against a trained model. The model must be `succeeded`. */\n async predict(input: ReflexPredictInput): Promise<ReflexPredictResult> {\n const completionId = input.completionId ?? crypto.randomUUID();\n const raw = await this._client.post<RawPredict>('/v1/reflex/predict', {\n body: { model: input.model, text: input.text },\n headers: { 'X-Completion-Id': completionId },\n });\n return toPredictResult(raw, completionId);\n }\n}\n\nexport class ReflexJobsResource extends APIResource {\n /** Start a training job from labeled data, a description, or unlabeled text. */\n async create(input: CreateReflexJobInput): Promise<ReflexJob> {\n return toReflexJob(await this._client.post<RawJob>('/v1/fine_tuning/jobs', { body: createBody(input) }));\n }\n\n /** Fetch a job by id. */\n async retrieve(id: string): Promise<ReflexJob> {\n return toReflexJob(await this._client.get<RawJob>(`/v1/fine_tuning/jobs/${encodeURIComponent(id)}`));\n }\n\n /** List the caller's jobs, newest first. */\n async list(input: ListReflexJobsInput = {}): Promise<ReflexJobList> {\n const raw = await this._client.get<RawJobList>('/v1/fine_tuning/jobs', {\n query: { limit: input.limit, after: input.after },\n });\n return { data: (raw.data ?? []).map(toReflexJob), hasMore: Boolean(raw.has_more) };\n }\n\n /** Stop a queued or running job. */\n async cancel(id: string): Promise<ReflexJob> {\n return toReflexJob(await this._client.post<RawJob>(`/v1/fine_tuning/jobs/${encodeURIComponent(id)}/cancel`));\n }\n\n /** Delete a job and its trained model. */\n async delete(id: string): Promise<DeletedReflexJob> {\n const raw = await this._client.delete<{ id: string; deleted?: boolean }>(\n `/v1/fine_tuning/jobs/${encodeURIComponent(id)}`,\n );\n return { id: raw.id, deleted: Boolean(raw.deleted) };\n }\n\n /** The training loss curve as events, plus a terminal event. */\n async events(id: string): Promise<ReflexEvent[]> {\n const raw = await this._client.get<{ data?: RawEvent[] }>(\n `/v1/fine_tuning/jobs/${encodeURIComponent(id)}/events`,\n );\n return (raw.data ?? []).map(toReflexEvent);\n }\n\n /**\n * Poll until the job reaches a terminal status and return it on success.\n * Throws a `MorphError` if it fails, is cancelled, or exceeds `timeoutMs`.\n */\n async waitForReady(id: string, opts: { pollMs?: number; timeoutMs?: number } = {}): Promise<ReflexJob> {\n const pollMs = opts.pollMs ?? 3_000;\n const deadline = Date.now() + (opts.timeoutMs ?? 15 * 60_000);\n\n for (;;) {\n const job = await this.retrieve(id);\n if (job.status === 'succeeded') return job;\n if (job.status === 'failed' || job.status === 'cancelled') {\n throw new MorphError(job.error?.message ?? `Reflex job ${job.status}`, `reflex_job_${job.status}`);\n }\n if (Date.now() >= deadline) {\n throw new MorphError(`Reflex job ${id} did not finish in time`, 'reflex_timeout');\n }\n await sleep(pollMs);\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Mapping (camelCase <-> snake_case) and helpers\n// ---------------------------------------------------------------------------\n\ninterface RawJob {\n id: string;\n model: string;\n created_at: number;\n finished_at: number | null;\n fine_tuned_model: string | null;\n status: ReflexJob['status'];\n labels?: string[];\n trained_examples?: number;\n result?: { accuracy: number | null; f1_score: number | null } | null;\n error?: { message: string } | null;\n suffix?: string | null;\n}\ninterface RawJobList {\n data?: RawJob[];\n has_more?: boolean;\n}\ninterface RawPredictClass {\n class_id: number;\n label: string;\n score: number;\n selected: boolean;\n}\ninterface RawPredict {\n model: string;\n mode?: string;\n classes?: RawPredictClass[];\n inference_time_ms: number;\n}\ninterface RawEvent {\n id: string;\n created_at: number;\n level: ReflexEvent['level'];\n message: string;\n type: ReflexEvent['type'];\n data?: { epoch?: number; step?: number; train_loss?: number };\n}\n\nfunction createBody(input: CreateReflexJobInput): Record<string, unknown> {\n const base: Record<string, unknown> = { model: BASE_MODEL };\n if (input.suffix) base.suffix = input.suffix;\n\n if ('trainingData' in input) {\n if (input.labels) base.labels = input.labels;\n return { ...base, training_data: input.trainingData };\n }\n if ('generate' in input) {\n return {\n ...base,\n labels: input.labels,\n generate: {\n description: input.generate.description,\n ...(input.generate.examplesPerLabel != null ? { examples_per_label: input.generate.examplesPerLabel } : {}),\n },\n };\n }\n return {\n ...base,\n labels: input.labels,\n label_data: {\n texts: input.labelData.texts,\n ...(input.labelData.description ? { description: input.labelData.description } : {}),\n },\n };\n}\n\nfunction toReflexJob(raw: RawJob): ReflexJob {\n return {\n id: raw.id,\n object: 'fine_tuning.job',\n model: raw.model,\n createdAt: raw.created_at,\n finishedAt: raw.finished_at ?? null,\n fineTunedModel: raw.fine_tuned_model ?? null,\n status: raw.status,\n labels: raw.labels ?? [],\n trainedExamples: raw.trained_examples ?? 0,\n result: raw.result ? { accuracy: raw.result.accuracy ?? null, f1Score: raw.result.f1_score ?? null } : null,\n error: raw.error ? { message: raw.error.message } : null,\n suffix: raw.suffix ?? null,\n };\n}\n\nfunction toPredictResult(raw: RawPredict, completionId: string): ReflexPredictResult {\n const classes: ReflexPredictClass[] = (raw.classes ?? []).map(c => ({\n classId: c.class_id,\n label: c.label,\n score: c.score,\n selected: c.selected,\n }));\n const selectedClasses = classes.filter(c => c.selected);\n // Top selected class by score derives the back-compat label/confidence.\n const top = selectedClasses.reduce<ReflexPredictClass | null>(\n (best, c) => (best === null || c.score > best.score ? c : best),\n null,\n );\n return {\n model: raw.model,\n mode: raw.mode === 'multi_label' ? 'multi_label' : 'single_label',\n classes,\n selected: selectedClasses.map(c => c.label),\n label: top ? top.label : null,\n confidence: top ? top.score : null,\n allScores: classes.map(c => c.score),\n inferenceTimeMs: raw.inference_time_ms,\n completionId,\n };\n}\n\nfunction toReflexEvent(raw: RawEvent): ReflexEvent {\n return {\n id: raw.id,\n createdAt: raw.created_at,\n level: raw.level,\n message: raw.message,\n type: raw.type,\n data: { epoch: raw.data?.epoch ?? 0, step: raw.data?.step ?? 0, trainLoss: raw.data?.train_loss ?? 0 },\n };\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n"],"mappings":";;;;;;;;;;;AA2BA,IAAM,aAAa;AAGnB,SAAS,cAAc,gBAA+D;AACpF,MAAI,0BAA0B,eAAgB,QAAO;AACrD,SAAO,IAAI,eAAe;AAAA,IACxB,QAAQ,eAAe;AAAA,IACvB,SAAS,eAAe;AAAA,IACxB,SAAS,eAAe;AAAA,IACxB,aAAa,eAAe;AAAA,IAC5B,OAAO,eAAe;AAAA,EACxB,CAAC;AACH;AAOO,IAAM,eAAN,cAA2B,YAAY;AAAA;AAAA,EAE5B;AAAA,EAEhB,YAAY,iBAAgD,CAAC,GAAG;AAC9D,UAAM,cAAc,cAAc,CAAC;AACnC,SAAK,OAAO,IAAI,mBAAmB,KAAK,OAAO;AAAA,EACjD;AAAA;AAAA,EAGA,MAAM,QAAQ,OAAyD;AACrE,UAAM,eAAe,MAAM,gBAAgB,OAAO,WAAW;AAC7D,UAAM,MAAM,MAAM,KAAK,QAAQ,KAAiB,sBAAsB;AAAA,MACpE,MAAM,EAAE,OAAO,MAAM,OAAO,MAAM,MAAM,KAAK;AAAA,MAC7C,SAAS,EAAE,mBAAmB,aAAa;AAAA,IAC7C,CAAC;AACD,WAAO,gBAAgB,KAAK,YAAY;AAAA,EAC1C;AACF;AAEO,IAAM,qBAAN,cAAi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I;AAAA,IACb,MAAM,IAAI;AAAA,IACV,MAAM,EAAE,OAAO,IAAI,MAAM,SAAS,GAAG,MAAM,IAAI,MAAM,QAAQ,GAAG,WAAW,IAAI,MAAM,cAAc,EAAE;AAAA,EACvG;AACF;AAEA,SAAS,MAAM,IAA2B;AACxC,SAAO,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AACvD;","names":[]}
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
} from "./chunk-F3NCFNUX.js";
|
|
4
4
|
import {
|
|
5
5
|
toMorphError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6NRW2BKD.js";
|
|
7
7
|
import {
|
|
8
8
|
MorphError,
|
|
9
9
|
fetchWithRetry,
|
|
10
10
|
withTimeout
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OMWX2LLV.js";
|
|
12
12
|
import {
|
|
13
13
|
SDK_VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TSODFOG7.js";
|
|
15
15
|
|
|
16
16
|
// core/client.ts
|
|
17
17
|
var DEFAULT_BASE_URL = "https://api.morphllm.com";
|
|
@@ -117,4 +117,4 @@ var MorphAPIClient = class {
|
|
|
117
117
|
export {
|
|
118
118
|
MorphAPIClient
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-L2DS6J5U.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
executeCodebaseSearch
|
|
3
|
+
} from "./chunk-5DXTZFD3.js";
|
|
1
4
|
import {
|
|
2
5
|
CODEBASE_SEARCH_DESCRIPTION,
|
|
3
6
|
CODEBASE_SEARCH_SYSTEM_PROMPT
|
|
4
7
|
} from "./chunk-YQMPVJ2L.js";
|
|
5
|
-
import {
|
|
6
|
-
executeCodebaseSearch
|
|
7
|
-
} from "./chunk-Z34FIIIY.js";
|
|
8
8
|
|
|
9
9
|
// tools/codebase_search/openai.ts
|
|
10
10
|
var codebaseSearchTool = {
|
|
@@ -125,4 +125,4 @@ export {
|
|
|
125
125
|
getSystemPrompt,
|
|
126
126
|
openai_default
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
128
|
+
//# sourceMappingURL=chunk-L56HIF2J.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TSODFOG7.js";
|
|
4
4
|
|
|
5
5
|
// tools/utils/resilience.ts
|
|
6
6
|
var DEFAULT_RETRY_CONFIG = {
|
|
@@ -91,4 +91,4 @@ export {
|
|
|
91
91
|
withTimeout,
|
|
92
92
|
MorphError
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-OMWX2LLV.js.map
|