@morphllm/morphsdk 0.2.120 → 0.2.121
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-XQ4KEOJT.js → chunk-266SWRHK.js} +2 -2
- package/dist/{chunk-2BPPWIJI.js → chunk-3HBZXN6E.js} +2 -2
- package/dist/{chunk-P4EPXC2Q.js → chunk-7IZUNRPZ.js} +31 -17
- package/dist/{chunk-P4EPXC2Q.js.map → chunk-7IZUNRPZ.js.map} +1 -1
- package/dist/{chunk-NLDYHLRB.js → chunk-7QZFNYOH.js} +2 -2
- package/dist/{chunk-5HPN4VL2.js → chunk-AI3ZCOCT.js} +1 -1
- package/dist/{chunk-VVEK5JSH.js → chunk-BDKXYMU2.js} +4 -4
- package/dist/{chunk-RODHADNG.js → chunk-C3BQUIFE.js} +5 -5
- package/dist/{chunk-HBWOWL7L.js → chunk-CIFPLFBQ.js} +2 -2
- package/dist/{chunk-RZ4VC4BG.js → chunk-CXP63PHW.js} +2 -2
- package/dist/{chunk-6ODXYTLF.js → chunk-DL3Y3R6A.js} +2 -2
- package/dist/{chunk-4RO43W62.js → chunk-EJYFE73S.js} +8 -3
- package/dist/chunk-EJYFE73S.js.map +1 -0
- package/dist/{chunk-A54BOCBI.js → chunk-EZFXR52Q.js} +2 -2
- package/dist/{chunk-HQAPRX5T.js → chunk-FV3R3JGV.js} +4 -4
- package/dist/{chunk-7HKYJ2MW.js → chunk-GNRMDXJA.js} +2 -2
- package/dist/chunk-J267T54M.js +76 -0
- package/dist/chunk-J267T54M.js.map +1 -0
- package/dist/{chunk-TVPEH6FF.js → chunk-JBIFS33U.js} +2 -2
- package/dist/{chunk-7TM4RBXE.js → chunk-L4PK4VC7.js} +2 -2
- package/dist/{chunk-T7F3DIRK.js → chunk-MAAULSSQ.js} +2 -2
- package/dist/{chunk-BVINWDTA.js → chunk-QDGB6FLI.js} +6 -6
- package/dist/{chunk-FZUUET6R.js → chunk-U5UDFQXK.js} +2 -2
- package/dist/{chunk-NW6PJIID.js → chunk-W37KJB25.js} +2 -2
- package/dist/{chunk-4VLTYTEY.js → chunk-WEBUKGPK.js} +3 -3
- package/dist/{chunk-HCN2MLSO.js → chunk-XERAWJ3H.js} +2 -2
- package/dist/{chunk-SNY2UKHQ.js → chunk-YMOTJ6ZP.js} +4 -4
- package/dist/{client-D7iO2TbA.d.ts → client-Bp3MRcJc.d.ts} +6 -1
- package/dist/client.cjs +90 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +4 -1
- package/dist/client.js +22 -21
- package/dist/edge.cjs +81 -2
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.d.ts +3 -0
- package/dist/edge.js +8 -4
- package/dist/index.cjs +92 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +26 -22
- package/dist/modelrouter/core.cjs +7 -2
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +3 -3
- package/dist/modelrouter/index.cjs +7 -2
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +3 -3
- package/dist/tools/browser/anthropic.cjs +7 -2
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +5 -5
- package/dist/tools/browser/core.cjs +7 -2
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +4 -4
- package/dist/tools/browser/index.cjs +7 -2
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +7 -7
- package/dist/tools/browser/openai.cjs +7 -2
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +5 -5
- 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 +5 -5
- package/dist/tools/codebase_search/anthropic.cjs +7 -2
- package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
- package/dist/tools/codebase_search/anthropic.js +4 -4
- package/dist/tools/codebase_search/core.cjs +7 -2
- package/dist/tools/codebase_search/core.cjs.map +1 -1
- package/dist/tools/codebase_search/core.js +3 -3
- package/dist/tools/codebase_search/index.cjs +7 -2
- package/dist/tools/codebase_search/index.cjs.map +1 -1
- package/dist/tools/codebase_search/index.js +6 -6
- package/dist/tools/codebase_search/openai.cjs +7 -2
- package/dist/tools/codebase_search/openai.cjs.map +1 -1
- package/dist/tools/codebase_search/openai.js +4 -4
- package/dist/tools/codebase_search/vercel.cjs +7 -2
- package/dist/tools/codebase_search/vercel.cjs.map +1 -1
- package/dist/tools/codebase_search/vercel.js +4 -4
- package/dist/tools/compact/core.cjs +110 -0
- package/dist/tools/compact/core.cjs.map +1 -0
- package/dist/tools/compact/core.d.ts +37 -0
- package/dist/tools/compact/core.js +8 -0
- package/dist/tools/compact/core.js.map +1 -0
- package/dist/tools/compact/index.cjs +112 -0
- package/dist/tools/compact/index.cjs.map +1 -0
- package/dist/tools/compact/index.d.ts +4 -0
- package/dist/tools/compact/index.js +8 -0
- package/dist/tools/compact/index.js.map +1 -0
- package/dist/tools/compact/types.cjs +19 -0
- package/dist/tools/compact/types.cjs.map +1 -0
- package/dist/tools/compact/types.d.ts +60 -0
- package/dist/tools/compact/types.js +1 -0
- package/dist/tools/compact/types.js.map +1 -0
- package/dist/tools/fastapply/anthropic.cjs +7 -2
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +4 -4
- package/dist/tools/fastapply/apply.cjs +7 -2
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +7 -2
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +3 -3
- package/dist/tools/fastapply/index.cjs +7 -2
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.d.ts +1 -1
- package/dist/tools/fastapply/index.js +8 -8
- package/dist/tools/fastapply/openai.cjs +7 -2
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +4 -4
- package/dist/tools/fastapply/vercel.cjs +7 -2
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.d.ts +1 -1
- package/dist/tools/fastapply/vercel.js +4 -4
- package/dist/tools/index.cjs +7 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +8 -8
- 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 +3 -3
- package/dist/tools/warp_grep/anthropic.cjs +7 -2
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +5 -5
- package/dist/tools/warp_grep/client.cjs +7 -2
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +4 -4
- package/dist/tools/warp_grep/gemini.cjs +7 -2
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +4 -4
- package/dist/tools/warp_grep/harness.js +4 -4
- package/dist/tools/warp_grep/index.cjs +7 -2
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +7 -7
- package/dist/tools/warp_grep/openai.cjs +7 -2
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +5 -5
- package/dist/tools/warp_grep/vercel.cjs +7 -2
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +5 -5
- 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-4RO43W62.js.map +0 -1
- package/dist/{chunk-XQ4KEOJT.js.map → chunk-266SWRHK.js.map} +0 -0
- package/dist/{chunk-2BPPWIJI.js.map → chunk-3HBZXN6E.js.map} +0 -0
- package/dist/{chunk-NLDYHLRB.js.map → chunk-7QZFNYOH.js.map} +0 -0
- package/dist/{chunk-5HPN4VL2.js.map → chunk-AI3ZCOCT.js.map} +0 -0
- package/dist/{chunk-VVEK5JSH.js.map → chunk-BDKXYMU2.js.map} +0 -0
- package/dist/{chunk-RODHADNG.js.map → chunk-C3BQUIFE.js.map} +0 -0
- package/dist/{chunk-HBWOWL7L.js.map → chunk-CIFPLFBQ.js.map} +0 -0
- package/dist/{chunk-RZ4VC4BG.js.map → chunk-CXP63PHW.js.map} +0 -0
- package/dist/{chunk-6ODXYTLF.js.map → chunk-DL3Y3R6A.js.map} +0 -0
- package/dist/{chunk-A54BOCBI.js.map → chunk-EZFXR52Q.js.map} +0 -0
- package/dist/{chunk-HQAPRX5T.js.map → chunk-FV3R3JGV.js.map} +0 -0
- package/dist/{chunk-7HKYJ2MW.js.map → chunk-GNRMDXJA.js.map} +0 -0
- package/dist/{chunk-TVPEH6FF.js.map → chunk-JBIFS33U.js.map} +0 -0
- package/dist/{chunk-7TM4RBXE.js.map → chunk-L4PK4VC7.js.map} +0 -0
- package/dist/{chunk-T7F3DIRK.js.map → chunk-MAAULSSQ.js.map} +0 -0
- package/dist/{chunk-BVINWDTA.js.map → chunk-QDGB6FLI.js.map} +0 -0
- package/dist/{chunk-FZUUET6R.js.map → chunk-U5UDFQXK.js.map} +0 -0
- package/dist/{chunk-NW6PJIID.js.map → chunk-W37KJB25.js.map} +0 -0
- package/dist/{chunk-4VLTYTEY.js.map → chunk-WEBUKGPK.js.map} +0 -0
- package/dist/{chunk-HCN2MLSO.js.map → chunk-XERAWJ3H.js.map} +0 -0
- package/dist/{chunk-SNY2UKHQ.js.map → chunk-YMOTJ6ZP.js.map} +0 -0
- package/dist/{vercel-B1GZ_g9N.d.ts → vercel-BTSPdTA-.d.ts} +2 -2
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-2HMEZZKK.js";
|
|
5
5
|
import {
|
|
6
6
|
executeBrowserTask
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WEBUKGPK.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-EZFXR52Q.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
executeEditFile
|
|
3
|
+
} from "./chunk-AI3ZCOCT.js";
|
|
1
4
|
import {
|
|
2
5
|
EDIT_FILE_SYSTEM_PROMPT,
|
|
3
6
|
EDIT_FILE_TOOL_DESCRIPTION
|
|
4
7
|
} from "./chunk-63WE2C5R.js";
|
|
5
|
-
import {
|
|
6
|
-
executeEditFile
|
|
7
|
-
} from "./chunk-5HPN4VL2.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-FV3R3JGV.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-YQMPVJ2L.js";
|
|
5
5
|
import {
|
|
6
6
|
executeCodebaseSearch
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CIFPLFBQ.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-GNRMDXJA.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// tools/compact/core.ts
|
|
2
|
+
import OpenAI from "openai";
|
|
3
|
+
var DEFAULT_API_URL = "https://api.morphllm.com";
|
|
4
|
+
var DEFAULT_TIMEOUT = 12e4;
|
|
5
|
+
var CompactClient = class {
|
|
6
|
+
config;
|
|
7
|
+
constructor(config = {}) {
|
|
8
|
+
this.config = {
|
|
9
|
+
morphApiUrl: DEFAULT_API_URL,
|
|
10
|
+
timeout: DEFAULT_TIMEOUT,
|
|
11
|
+
...config
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compact conversation context using Morph compactor
|
|
16
|
+
*
|
|
17
|
+
* @param input - Compact parameters including input content and optional prompt
|
|
18
|
+
* @returns Compact result with compacted output and usage stats
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const client = new CompactClient({ morphApiKey: 'sk-...' });
|
|
23
|
+
* const result = await client.compact({
|
|
24
|
+
* input: 'Long conversation context to compact...',
|
|
25
|
+
* prompt: 'Focus on the code review feedback',
|
|
26
|
+
* });
|
|
27
|
+
* console.log(result.output);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
async compact(input) {
|
|
31
|
+
const apiKey = this.config.morphApiKey || (typeof process !== "undefined" ? process.env?.MORPH_API_KEY : void 0);
|
|
32
|
+
const debug = this.config.debug || false;
|
|
33
|
+
if (!apiKey) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"Morph API key not found. Set MORPH_API_KEY environment variable or pass morphApiKey in config."
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const client = new OpenAI({
|
|
39
|
+
apiKey,
|
|
40
|
+
baseURL: `${this.config.morphApiUrl}/v1`,
|
|
41
|
+
timeout: this.config.timeout,
|
|
42
|
+
maxRetries: this.config.retryConfig?.maxRetries ?? 3
|
|
43
|
+
});
|
|
44
|
+
const instructions = input.prompt ? `The user's next message will be: "${input.prompt}"
|
|
45
|
+
Prioritize keeping context relevant to this query.` : void 0;
|
|
46
|
+
if (debug) {
|
|
47
|
+
console.log(`[Compact] Calling ${this.config.morphApiUrl}/v1/responses`);
|
|
48
|
+
console.log(`[Compact] Model: ${input.model || "morph-compactor"}`);
|
|
49
|
+
}
|
|
50
|
+
const startTime = Date.now();
|
|
51
|
+
const response = await client.responses.create({
|
|
52
|
+
model: input.model || "morph-compactor",
|
|
53
|
+
input: input.input,
|
|
54
|
+
...instructions && { instructions },
|
|
55
|
+
...input.temperature != null && { temperature: input.temperature },
|
|
56
|
+
...input.max_output_tokens != null && { max_output_tokens: input.max_output_tokens },
|
|
57
|
+
stream: false
|
|
58
|
+
});
|
|
59
|
+
const elapsed = Date.now() - startTime;
|
|
60
|
+
if (debug) {
|
|
61
|
+
console.log(`[Compact] Success in ${elapsed}ms`);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
id: response.id,
|
|
65
|
+
output: response.output,
|
|
66
|
+
usage: response.usage,
|
|
67
|
+
status: response.status ?? "completed",
|
|
68
|
+
model: response.model
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
CompactClient
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=chunk-J267T54M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/compact/core.ts"],"sourcesContent":["/**\n * Core implementation of Morph Compact\n *\n * Uses the OpenAI Responses API to compact conversation context\n * via the Morph compactor model.\n */\n\nimport OpenAI from 'openai';\nimport type { CompactConfig, CompactInput, CompactResult } from './types.js';\n\nconst DEFAULT_API_URL = 'https://api.morphllm.com';\nconst DEFAULT_TIMEOUT = 120000;\n\n/**\n * CompactClient for programmatic context compaction\n */\nexport class CompactClient {\n private config: Required<Pick<CompactConfig, 'morphApiUrl' | 'timeout'>> & CompactConfig;\n\n constructor(config: CompactConfig = {}) {\n this.config = {\n morphApiUrl: DEFAULT_API_URL,\n timeout: DEFAULT_TIMEOUT,\n ...config,\n };\n }\n\n /**\n * Compact conversation context using Morph compactor\n *\n * @param input - Compact parameters including input content and optional prompt\n * @returns Compact result with compacted output and usage stats\n *\n * @example\n * ```typescript\n * const client = new CompactClient({ morphApiKey: 'sk-...' });\n * const result = await client.compact({\n * input: 'Long conversation context to compact...',\n * prompt: 'Focus on the code review feedback',\n * });\n * console.log(result.output);\n * ```\n */\n async compact(input: CompactInput): Promise<CompactResult> {\n const apiKey = this.config.morphApiKey || (typeof process !== 'undefined' ? process.env?.MORPH_API_KEY : undefined);\n const debug = this.config.debug || false;\n\n if (!apiKey) {\n throw new Error(\n 'Morph API key not found. Set MORPH_API_KEY environment variable or pass morphApiKey in config.'\n );\n }\n\n const client = new OpenAI({\n apiKey,\n baseURL: `${this.config.morphApiUrl}/v1`,\n timeout: this.config.timeout,\n maxRetries: this.config.retryConfig?.maxRetries ?? 3,\n });\n\n const instructions = input.prompt\n ? `The user's next message will be: \"${input.prompt}\"\\nPrioritize keeping context relevant to this query.`\n : undefined;\n\n if (debug) {\n console.log(`[Compact] Calling ${this.config.morphApiUrl}/v1/responses`);\n console.log(`[Compact] Model: ${input.model || 'morph-compactor'}`);\n }\n\n const startTime = Date.now();\n\n const response = await client.responses.create({\n model: input.model || 'morph-compactor',\n input: input.input as any,\n ...(instructions && { instructions }),\n ...(input.temperature != null && { temperature: input.temperature }),\n ...(input.max_output_tokens != null && { max_output_tokens: input.max_output_tokens }),\n stream: false,\n });\n\n const elapsed = Date.now() - startTime;\n\n if (debug) {\n console.log(`[Compact] Success in ${elapsed}ms`);\n }\n\n return {\n id: response.id,\n output: response.output as any,\n usage: response.usage as any,\n status: response.status ?? 'completed',\n model: response.model,\n };\n }\n}\n"],"mappings":";AAOA,OAAO,YAAY;AAGnB,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AAKjB,IAAM,gBAAN,MAAoB;AAAA,EACjB;AAAA,EAER,YAAY,SAAwB,CAAC,GAAG;AACtC,SAAK,SAAS;AAAA,MACZ,aAAa;AAAA,MACb,SAAS;AAAA,MACT,GAAG;AAAA,IACL;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,MAAM,QAAQ,OAA6C;AACzD,UAAM,SAAS,KAAK,OAAO,gBAAgB,OAAO,YAAY,cAAc,QAAQ,KAAK,gBAAgB;AACzG,UAAM,QAAQ,KAAK,OAAO,SAAS;AAEnC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,SAAS,IAAI,OAAO;AAAA,MACxB;AAAA,MACA,SAAS,GAAG,KAAK,OAAO,WAAW;AAAA,MACnC,SAAS,KAAK,OAAO;AAAA,MACrB,YAAY,KAAK,OAAO,aAAa,cAAc;AAAA,IACrD,CAAC;AAED,UAAM,eAAe,MAAM,SACvB,qCAAqC,MAAM,MAAM;AAAA,sDACjD;AAEJ,QAAI,OAAO;AACT,cAAQ,IAAI,qBAAqB,KAAK,OAAO,WAAW,eAAe;AACvE,cAAQ,IAAI,oBAAoB,MAAM,SAAS,iBAAiB,EAAE;AAAA,IACpE;AAEA,UAAM,YAAY,KAAK,IAAI;AAE3B,UAAM,WAAW,MAAM,OAAO,UAAU,OAAO;AAAA,MAC7C,OAAO,MAAM,SAAS;AAAA,MACtB,OAAO,MAAM;AAAA,MACb,GAAI,gBAAgB,EAAE,aAAa;AAAA,MACnC,GAAI,MAAM,eAAe,QAAQ,EAAE,aAAa,MAAM,YAAY;AAAA,MAClE,GAAI,MAAM,qBAAqB,QAAQ,EAAE,mBAAmB,MAAM,kBAAkB;AAAA,MACpF,QAAQ;AAAA,IACV,CAAC;AAED,UAAM,UAAU,KAAK,IAAI,IAAI;AAE7B,QAAI,OAAO;AACT,cAAQ,IAAI,wBAAwB,OAAO,IAAI;AAAA,IACjD;AAEA,WAAO;AAAA,MACL,IAAI,SAAS;AAAA,MACb,QAAQ,SAAS;AAAA,MACjB,OAAO,SAAS;AAAA,MAChB,QAAQ,SAAS,UAAU;AAAA,MAC3B,OAAO,SAAS;AAAA,IAClB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-2VERUKO2.js";
|
|
13
13
|
import {
|
|
14
14
|
fetchWithRetry
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3HBZXN6E.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-JBIFS33U.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchWithRetry,
|
|
3
3
|
withTimeout
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3HBZXN6E.js";
|
|
5
5
|
|
|
6
6
|
// modelrouter/core.ts
|
|
7
7
|
var DEFAULT_CONFIG = {
|
|
@@ -209,4 +209,4 @@ export {
|
|
|
209
209
|
GeminiRouter,
|
|
210
210
|
RawRouter
|
|
211
211
|
};
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
212
|
+
//# sourceMappingURL=chunk-L4PK4VC7.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-2HMEZZKK.js";
|
|
4
4
|
import {
|
|
5
5
|
executeBrowserTask
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WEBUKGPK.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
9
|
} from "./chunk-PZ5AY32C.js";
|
|
@@ -54,4 +54,4 @@ export {
|
|
|
54
54
|
browserTool,
|
|
55
55
|
vercel_exports
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-MAAULSSQ.js.map
|
|
@@ -8,6 +8,10 @@ import {
|
|
|
8
8
|
toolListDirectory,
|
|
9
9
|
toolRead
|
|
10
10
|
} from "./chunk-3MLWXJTJ.js";
|
|
11
|
+
import {
|
|
12
|
+
AGENT_CONFIG,
|
|
13
|
+
DEFAULT_MODEL
|
|
14
|
+
} from "./chunk-5PNMAWLC.js";
|
|
11
15
|
import {
|
|
12
16
|
formatAgentToolOutput
|
|
13
17
|
} from "./chunk-APP75CBN.js";
|
|
@@ -17,13 +21,9 @@ import {
|
|
|
17
21
|
import {
|
|
18
22
|
getSystemPrompt
|
|
19
23
|
} from "./chunk-FMLHRJDF.js";
|
|
20
|
-
import {
|
|
21
|
-
AGENT_CONFIG,
|
|
22
|
-
DEFAULT_MODEL
|
|
23
|
-
} from "./chunk-5PNMAWLC.js";
|
|
24
24
|
import {
|
|
25
25
|
SDK_VERSION
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EJYFE73S.js";
|
|
27
27
|
|
|
28
28
|
// tools/warp_grep/agent/runner.ts
|
|
29
29
|
import OpenAI from "openai";
|
|
@@ -406,4 +406,4 @@ export {
|
|
|
406
406
|
runWarpGrep,
|
|
407
407
|
runWarpGrepStreaming
|
|
408
408
|
};
|
|
409
|
-
//# sourceMappingURL=chunk-
|
|
409
|
+
//# sourceMappingURL=chunk-QDGB6FLI.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
executeToolCall,
|
|
6
6
|
executeToolCallStreaming
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-C3BQUIFE.js";
|
|
8
8
|
|
|
9
9
|
// tools/warp_grep/vercel.ts
|
|
10
10
|
import { tool } from "ai";
|
|
@@ -63,4 +63,4 @@ export {
|
|
|
63
63
|
createWarpGrepTool,
|
|
64
64
|
vercel_default
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-U5UDFQXK.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YQMPVJ2L.js";
|
|
4
4
|
import {
|
|
5
5
|
executeCodebaseSearch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CIFPLFBQ.js";
|
|
7
7
|
|
|
8
8
|
// tools/codebase_search/vercel.ts
|
|
9
9
|
import { tool } from "ai";
|
|
@@ -55,4 +55,4 @@ export {
|
|
|
55
55
|
getSystemPrompt,
|
|
56
56
|
vercel_default
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
58
|
+
//# sourceMappingURL=chunk-W37KJB25.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProfilesClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JBIFS33U.js";
|
|
4
4
|
import {
|
|
5
5
|
buildEmbedCode,
|
|
6
6
|
buildLiveIframe,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
fetchWithRetry,
|
|
12
12
|
withTimeout
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3HBZXN6E.js";
|
|
14
14
|
|
|
15
15
|
// tools/browser/core.ts
|
|
16
16
|
var DEFAULT_CONFIG = {
|
|
@@ -609,4 +609,4 @@ export {
|
|
|
609
609
|
getWebp,
|
|
610
610
|
checkHealth
|
|
611
611
|
};
|
|
612
|
-
//# sourceMappingURL=chunk-
|
|
612
|
+
//# sourceMappingURL=chunk-WEBUKGPK.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
executeToolCall,
|
|
7
7
|
formatResult
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-C3BQUIFE.js";
|
|
9
9
|
import {
|
|
10
10
|
getSystemPrompt
|
|
11
11
|
} from "./chunk-FMLHRJDF.js";
|
|
@@ -50,4 +50,4 @@ export {
|
|
|
50
50
|
execute,
|
|
51
51
|
createWarpGrepTool
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-XERAWJ3H.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
executeEditFile
|
|
3
|
+
} from "./chunk-AI3ZCOCT.js";
|
|
1
4
|
import {
|
|
2
5
|
EDIT_FILE_SYSTEM_PROMPT,
|
|
3
6
|
EDIT_FILE_TOOL_DESCRIPTION
|
|
4
7
|
} from "./chunk-63WE2C5R.js";
|
|
5
|
-
import {
|
|
6
|
-
executeEditFile
|
|
7
|
-
} from "./chunk-5HPN4VL2.js";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
10
|
} from "./chunk-PZ5AY32C.js";
|
|
@@ -79,4 +79,4 @@ export {
|
|
|
79
79
|
getSystemPrompt,
|
|
80
80
|
anthropic_exports
|
|
81
81
|
};
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
82
|
+
//# sourceMappingURL=chunk-YMOTJ6ZP.js.map
|
|
@@ -4,6 +4,7 @@ import { CodebaseSearchClient } from './tools/codebase_search/core.js';
|
|
|
4
4
|
import { BrowserClient } from './tools/browser/core.js';
|
|
5
5
|
import { WarpGrepClient } from './tools/warp_grep/client.js';
|
|
6
6
|
import { MorphGit } from './git/client.js';
|
|
7
|
+
import { CompactClient } from './tools/compact/core.js';
|
|
7
8
|
import { OpenAIRouter, AnthropicRouter, GeminiRouter, RawRouter } from './modelrouter/core.js';
|
|
8
9
|
import { EditFileConfig, EditFileInput, EditFileResult, EditChanges } from './tools/fastapply/types.js';
|
|
9
10
|
import { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './tools/codebase_search/types.js';
|
|
@@ -800,8 +801,8 @@ declare class VercelToolFactory {
|
|
|
800
801
|
* @returns Vercel AI SDK tool
|
|
801
802
|
*/
|
|
802
803
|
createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): ai.Tool<{
|
|
803
|
-
target_filepath: string;
|
|
804
804
|
instructions: string;
|
|
805
|
+
target_filepath: string;
|
|
805
806
|
code_edit: string;
|
|
806
807
|
}, {
|
|
807
808
|
success: boolean;
|
|
@@ -903,6 +904,10 @@ declare class MorphClient {
|
|
|
903
904
|
anthropic: AnthropicToolFactory;
|
|
904
905
|
/** Vercel AI SDK tool factories */
|
|
905
906
|
vercel: VercelToolFactory;
|
|
907
|
+
/** Responses API with compact tool */
|
|
908
|
+
responses: {
|
|
909
|
+
compact: CompactClient['compact'];
|
|
910
|
+
};
|
|
906
911
|
/**
|
|
907
912
|
* Create a new Morph SDK client
|
|
908
913
|
*
|
package/dist/client.cjs
CHANGED
|
@@ -36,7 +36,7 @@ var init_package = __esm({
|
|
|
36
36
|
"package.json"() {
|
|
37
37
|
package_default = {
|
|
38
38
|
name: "@morphllm/morphsdk",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.121",
|
|
40
40
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
41
41
|
type: "module",
|
|
42
42
|
main: "./dist/index.cjs",
|
|
@@ -162,6 +162,11 @@ var init_package = __esm({
|
|
|
162
162
|
types: "./dist/modelrouter/index.d.ts",
|
|
163
163
|
import: "./dist/modelrouter/index.js",
|
|
164
164
|
require: "./dist/modelrouter/index.cjs"
|
|
165
|
+
},
|
|
166
|
+
"./tools/compact": {
|
|
167
|
+
types: "./dist/tools/compact/index.d.ts",
|
|
168
|
+
import: "./dist/tools/compact/index.js",
|
|
169
|
+
require: "./dist/tools/compact/index.cjs"
|
|
165
170
|
}
|
|
166
171
|
},
|
|
167
172
|
files: [
|
|
@@ -173,7 +178,7 @@ var init_package = __esm({
|
|
|
173
178
|
"!dist/**/*.test.*"
|
|
174
179
|
],
|
|
175
180
|
scripts: {
|
|
176
|
-
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/prompt.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/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/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/utils/resilience.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve",
|
|
181
|
+
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/prompt.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/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/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 --format esm,cjs --sourcemap --clean --dts --dts-resolve",
|
|
177
182
|
prepare: "npm run build",
|
|
178
183
|
typecheck: "tsc --noEmit",
|
|
179
184
|
lint: "eslint .",
|
|
@@ -4834,6 +4839,78 @@ var MorphGit = class {
|
|
|
4834
4839
|
var import_isomorphic_git2 = __toESM(require("isomorphic-git"), 1);
|
|
4835
4840
|
var import_node2 = __toESM(require("isomorphic-git/http/node"), 1);
|
|
4836
4841
|
|
|
4842
|
+
// tools/compact/core.ts
|
|
4843
|
+
var import_openai3 = __toESM(require("openai"), 1);
|
|
4844
|
+
var DEFAULT_API_URL4 = "https://api.morphllm.com";
|
|
4845
|
+
var DEFAULT_TIMEOUT3 = 12e4;
|
|
4846
|
+
var CompactClient = class {
|
|
4847
|
+
config;
|
|
4848
|
+
constructor(config = {}) {
|
|
4849
|
+
this.config = {
|
|
4850
|
+
morphApiUrl: DEFAULT_API_URL4,
|
|
4851
|
+
timeout: DEFAULT_TIMEOUT3,
|
|
4852
|
+
...config
|
|
4853
|
+
};
|
|
4854
|
+
}
|
|
4855
|
+
/**
|
|
4856
|
+
* Compact conversation context using Morph compactor
|
|
4857
|
+
*
|
|
4858
|
+
* @param input - Compact parameters including input content and optional prompt
|
|
4859
|
+
* @returns Compact result with compacted output and usage stats
|
|
4860
|
+
*
|
|
4861
|
+
* @example
|
|
4862
|
+
* ```typescript
|
|
4863
|
+
* const client = new CompactClient({ morphApiKey: 'sk-...' });
|
|
4864
|
+
* const result = await client.compact({
|
|
4865
|
+
* input: 'Long conversation context to compact...',
|
|
4866
|
+
* prompt: 'Focus on the code review feedback',
|
|
4867
|
+
* });
|
|
4868
|
+
* console.log(result.output);
|
|
4869
|
+
* ```
|
|
4870
|
+
*/
|
|
4871
|
+
async compact(input) {
|
|
4872
|
+
const apiKey = this.config.morphApiKey || (typeof process !== "undefined" ? process.env?.MORPH_API_KEY : void 0);
|
|
4873
|
+
const debug = this.config.debug || false;
|
|
4874
|
+
if (!apiKey) {
|
|
4875
|
+
throw new Error(
|
|
4876
|
+
"Morph API key not found. Set MORPH_API_KEY environment variable or pass morphApiKey in config."
|
|
4877
|
+
);
|
|
4878
|
+
}
|
|
4879
|
+
const client = new import_openai3.default({
|
|
4880
|
+
apiKey,
|
|
4881
|
+
baseURL: `${this.config.morphApiUrl}/v1`,
|
|
4882
|
+
timeout: this.config.timeout,
|
|
4883
|
+
maxRetries: this.config.retryConfig?.maxRetries ?? 3
|
|
4884
|
+
});
|
|
4885
|
+
const instructions = input.prompt ? `The user's next message will be: "${input.prompt}"
|
|
4886
|
+
Prioritize keeping context relevant to this query.` : void 0;
|
|
4887
|
+
if (debug) {
|
|
4888
|
+
console.log(`[Compact] Calling ${this.config.morphApiUrl}/v1/responses`);
|
|
4889
|
+
console.log(`[Compact] Model: ${input.model || "morph-compactor"}`);
|
|
4890
|
+
}
|
|
4891
|
+
const startTime = Date.now();
|
|
4892
|
+
const response = await client.responses.create({
|
|
4893
|
+
model: input.model || "morph-compactor",
|
|
4894
|
+
input: input.input,
|
|
4895
|
+
...instructions && { instructions },
|
|
4896
|
+
...input.temperature != null && { temperature: input.temperature },
|
|
4897
|
+
...input.max_output_tokens != null && { max_output_tokens: input.max_output_tokens },
|
|
4898
|
+
stream: false
|
|
4899
|
+
});
|
|
4900
|
+
const elapsed = Date.now() - startTime;
|
|
4901
|
+
if (debug) {
|
|
4902
|
+
console.log(`[Compact] Success in ${elapsed}ms`);
|
|
4903
|
+
}
|
|
4904
|
+
return {
|
|
4905
|
+
id: response.id,
|
|
4906
|
+
output: response.output,
|
|
4907
|
+
usage: response.usage,
|
|
4908
|
+
status: response.status ?? "completed",
|
|
4909
|
+
model: response.model
|
|
4910
|
+
};
|
|
4911
|
+
}
|
|
4912
|
+
};
|
|
4913
|
+
|
|
4837
4914
|
// modelrouter/core.ts
|
|
4838
4915
|
var DEFAULT_CONFIG3 = {
|
|
4839
4916
|
apiUrl: "https://api.morphllm.com",
|
|
@@ -5705,6 +5782,8 @@ var MorphClient = class {
|
|
|
5705
5782
|
anthropic;
|
|
5706
5783
|
/** Vercel AI SDK tool factories */
|
|
5707
5784
|
vercel;
|
|
5785
|
+
/** Responses API with compact tool */
|
|
5786
|
+
responses;
|
|
5708
5787
|
/**
|
|
5709
5788
|
* Create a new Morph SDK client
|
|
5710
5789
|
*
|
|
@@ -5781,6 +5860,15 @@ var MorphClient = class {
|
|
|
5781
5860
|
retryConfig: config.retryConfig
|
|
5782
5861
|
})
|
|
5783
5862
|
};
|
|
5863
|
+
const compactClient = new CompactClient({
|
|
5864
|
+
morphApiKey: config.apiKey,
|
|
5865
|
+
timeout: config.timeout,
|
|
5866
|
+
retryConfig: config.retryConfig,
|
|
5867
|
+
debug: config.debug
|
|
5868
|
+
});
|
|
5869
|
+
this.responses = {
|
|
5870
|
+
compact: compactClient.compact.bind(compactClient)
|
|
5871
|
+
};
|
|
5784
5872
|
this.openai = new OpenAIToolFactory(config);
|
|
5785
5873
|
this.anthropic = new AnthropicToolFactory(config);
|
|
5786
5874
|
this.vercel = new VercelToolFactory(config);
|