@morphllm/morphsdk 0.2.152 → 0.2.154
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-WKHAZ732.js → chunk-2WAHX6I2.js} +2 -2
- package/dist/{chunk-ZFYFLNRE.js → chunk-3BTUUH23.js} +2 -2
- package/dist/{chunk-3ZR5RSJQ.js → chunk-3XO33KPS.js} +2 -2
- package/dist/{chunk-3ZR5RSJQ.js.map → chunk-3XO33KPS.js.map} +1 -1
- package/dist/{chunk-75C4DV27.js → chunk-4R6F66B7.js} +2 -2
- package/dist/{chunk-SVLY35WI.js → chunk-5IKDEESU.js} +3 -3
- package/dist/{chunk-YLWVLRWH.js → chunk-A6T6E636.js} +2 -2
- package/dist/{chunk-UAGEVTXM.js → chunk-D5UUKDKL.js} +2 -2
- package/dist/{chunk-R5IYAFFN.js → chunk-FOKMTUWC.js} +2 -2
- package/dist/chunk-GLQWEINZ.js +53 -0
- package/dist/chunk-GLQWEINZ.js.map +1 -0
- package/dist/{chunk-P7USBFIJ.js → chunk-J43SJUCO.js} +1 -1
- package/dist/{chunk-PO6IPUDB.js → chunk-KRRO7FF2.js} +2 -2
- package/dist/{chunk-PIBNTOS7.js → chunk-LK4C3NYX.js} +2 -2
- package/dist/{chunk-OLL7QI3Y.js → chunk-MTRH7FMN.js} +2 -2
- package/dist/{chunk-I6CWGOEL.js → chunk-N4KLUOXK.js} +2 -2
- package/dist/{chunk-U253YYNH.js → chunk-P57SFOLD.js} +2 -2
- package/dist/{chunk-BN6IXTDU.js → chunk-PRHEWGWC.js} +23 -23
- package/dist/{chunk-ZHRXNOXP.js → chunk-Q77CT3RI.js} +2 -2
- package/dist/{chunk-3TARZOBZ.js → chunk-QSATHLZJ.js} +2 -2
- package/dist/{chunk-3TARZOBZ.js.map → chunk-QSATHLZJ.js.map} +1 -1
- package/dist/{chunk-AGFVQOGJ.js → chunk-SCVWDNQP.js} +2 -2
- package/dist/chunk-SCVWDNQP.js.map +1 -0
- package/dist/{chunk-G7FGC7EQ.js → chunk-TAGDMT3K.js} +2 -2
- package/dist/{chunk-KXN4YMCP.js → chunk-UDI5U6QV.js} +2 -2
- package/dist/{chunk-Q72OV4VF.js → chunk-VK76R3IN.js} +2 -2
- package/dist/{chunk-DOWJVFKI.js → chunk-WQU6QXSU.js} +17 -16
- package/dist/chunk-WQU6QXSU.js.map +1 -0
- package/dist/{chunk-55ESIZID.js → chunk-Y5O3A7SU.js} +2 -2
- package/dist/{chunk-LYL2MWM6.js → chunk-YKBVE3CE.js} +2 -2
- package/dist/{chunk-WU2325QJ.js → chunk-ZHKANLAQ.js} +2 -2
- package/dist/{chunk-L7EVPMOK.js → chunk-ZSA3NL5T.js} +2 -2
- package/dist/client.cjs +140 -97
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +24 -23
- package/dist/edge.cjs +2 -2
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.js +7 -7
- package/dist/index.cjs +140 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -25
- package/dist/modelrouter/core.cjs +1 -1
- package/dist/modelrouter/core.cjs.map +1 -1
- package/dist/modelrouter/core.js +3 -3
- package/dist/modelrouter/index.cjs +1 -1
- package/dist/modelrouter/index.cjs.map +1 -1
- package/dist/modelrouter/index.js +3 -3
- package/dist/subagents/anthropic.cjs +138 -15
- package/dist/subagents/anthropic.cjs.map +1 -1
- package/dist/subagents/anthropic.js +6 -4
- package/dist/subagents/vercel.cjs +138 -15
- package/dist/subagents/vercel.cjs.map +1 -1
- package/dist/subagents/vercel.js +6 -4
- package/dist/tools/browser/anthropic.cjs +1 -1
- package/dist/tools/browser/anthropic.cjs.map +1 -1
- package/dist/tools/browser/anthropic.js +5 -5
- package/dist/tools/browser/core.cjs +1 -1
- package/dist/tools/browser/core.cjs.map +1 -1
- package/dist/tools/browser/core.js +4 -4
- package/dist/tools/browser/index.cjs +1 -1
- package/dist/tools/browser/index.cjs.map +1 -1
- package/dist/tools/browser/index.js +7 -7
- package/dist/tools/browser/openai.cjs +1 -1
- package/dist/tools/browser/openai.cjs.map +1 -1
- package/dist/tools/browser/openai.js +5 -5
- package/dist/tools/browser/profiles/core.cjs +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/tools/browser/vercel.cjs.map +1 -1
- package/dist/tools/browser/vercel.js +5 -5
- package/dist/tools/codebase_search/anthropic.cjs +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/tools/compact/core.cjs.map +1 -1
- package/dist/tools/compact/core.js +1 -1
- package/dist/tools/compact/index.cjs +50 -3
- package/dist/tools/compact/index.cjs.map +1 -1
- package/dist/tools/compact/index.d.ts +10 -0
- package/dist/tools/compact/index.js +6 -2
- package/dist/tools/fastapply/anthropic.cjs +1 -1
- package/dist/tools/fastapply/anthropic.cjs.map +1 -1
- package/dist/tools/fastapply/anthropic.js +4 -4
- package/dist/tools/fastapply/apply.cjs +1 -1
- package/dist/tools/fastapply/apply.cjs.map +1 -1
- package/dist/tools/fastapply/apply.d.ts +1 -1
- package/dist/tools/fastapply/apply.js +2 -2
- package/dist/tools/fastapply/core.cjs +1 -1
- package/dist/tools/fastapply/core.cjs.map +1 -1
- package/dist/tools/fastapply/core.js +3 -3
- package/dist/tools/fastapply/index.cjs +1 -1
- package/dist/tools/fastapply/index.cjs.map +1 -1
- package/dist/tools/fastapply/index.js +6 -6
- package/dist/tools/fastapply/openai.cjs +1 -1
- package/dist/tools/fastapply/openai.cjs.map +1 -1
- package/dist/tools/fastapply/openai.js +4 -4
- package/dist/tools/fastapply/types.cjs.map +1 -1
- package/dist/tools/fastapply/types.d.ts +1 -1
- package/dist/tools/fastapply/vercel.cjs +1 -1
- package/dist/tools/fastapply/vercel.cjs.map +1 -1
- package/dist/tools/fastapply/vercel.js +4 -4
- package/dist/tools/index.cjs +1 -1
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +6 -6
- package/dist/tools/utils/resilience.cjs +1 -1
- 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 +1 -1
- 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 +138 -15
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +6 -4
- package/dist/tools/warp_grep/client.cjs +138 -15
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +5 -3
- package/dist/tools/warp_grep/gemini.cjs +138 -15
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +5 -3
- package/dist/tools/warp_grep/gemini.js.map +1 -1
- package/dist/tools/warp_grep/index.cjs +138 -15
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +5 -3
- package/dist/tools/warp_grep/openai.cjs +138 -15
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +6 -4
- package/dist/tools/warp_grep/vercel.cjs +138 -15
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +6 -4
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AGFVQOGJ.js.map +0 -1
- package/dist/chunk-DOWJVFKI.js.map +0 -1
- /package/dist/{chunk-WKHAZ732.js.map → chunk-2WAHX6I2.js.map} +0 -0
- /package/dist/{chunk-ZFYFLNRE.js.map → chunk-3BTUUH23.js.map} +0 -0
- /package/dist/{chunk-75C4DV27.js.map → chunk-4R6F66B7.js.map} +0 -0
- /package/dist/{chunk-SVLY35WI.js.map → chunk-5IKDEESU.js.map} +0 -0
- /package/dist/{chunk-YLWVLRWH.js.map → chunk-A6T6E636.js.map} +0 -0
- /package/dist/{chunk-UAGEVTXM.js.map → chunk-D5UUKDKL.js.map} +0 -0
- /package/dist/{chunk-R5IYAFFN.js.map → chunk-FOKMTUWC.js.map} +0 -0
- /package/dist/{chunk-P7USBFIJ.js.map → chunk-J43SJUCO.js.map} +0 -0
- /package/dist/{chunk-PO6IPUDB.js.map → chunk-KRRO7FF2.js.map} +0 -0
- /package/dist/{chunk-PIBNTOS7.js.map → chunk-LK4C3NYX.js.map} +0 -0
- /package/dist/{chunk-OLL7QI3Y.js.map → chunk-MTRH7FMN.js.map} +0 -0
- /package/dist/{chunk-I6CWGOEL.js.map → chunk-N4KLUOXK.js.map} +0 -0
- /package/dist/{chunk-U253YYNH.js.map → chunk-P57SFOLD.js.map} +0 -0
- /package/dist/{chunk-BN6IXTDU.js.map → chunk-PRHEWGWC.js.map} +0 -0
- /package/dist/{chunk-ZHRXNOXP.js.map → chunk-Q77CT3RI.js.map} +0 -0
- /package/dist/{chunk-G7FGC7EQ.js.map → chunk-TAGDMT3K.js.map} +0 -0
- /package/dist/{chunk-KXN4YMCP.js.map → chunk-UDI5U6QV.js.map} +0 -0
- /package/dist/{chunk-Q72OV4VF.js.map → chunk-VK76R3IN.js.map} +0 -0
- /package/dist/{chunk-55ESIZID.js.map → chunk-Y5O3A7SU.js.map} +0 -0
- /package/dist/{chunk-LYL2MWM6.js.map → chunk-YKBVE3CE.js.map} +0 -0
- /package/dist/{chunk-WU2325QJ.js.map → chunk-ZHKANLAQ.js.map} +0 -0
- /package/dist/{chunk-L7EVPMOK.js.map → chunk-ZSA3NL5T.js.map} +0 -0
|
@@ -4,19 +4,21 @@ import {
|
|
|
4
4
|
createWarpGrepTool,
|
|
5
5
|
execute,
|
|
6
6
|
warpGrepTool
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-Q77CT3RI.js";
|
|
8
8
|
import "../../chunk-Q6QCHAMD.js";
|
|
9
9
|
import {
|
|
10
10
|
formatResult
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-WQU6QXSU.js";
|
|
12
12
|
import "../../chunk-63VHBANJ.js";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-YKBVE3CE.js";
|
|
14
14
|
import "../../chunk-GVGJIXV2.js";
|
|
15
15
|
import "../../chunk-B3AKP3RA.js";
|
|
16
16
|
import "../../chunk-VNAGVCSP.js";
|
|
17
17
|
import "../../chunk-CMSHXALI.js";
|
|
18
18
|
import "../../chunk-I3J46TSB.js";
|
|
19
|
-
import "../../chunk-
|
|
19
|
+
import "../../chunk-GLQWEINZ.js";
|
|
20
|
+
import "../../chunk-SCVWDNQP.js";
|
|
21
|
+
import "../../chunk-3XO33KPS.js";
|
|
20
22
|
import "../../chunk-PZ5AY32C.js";
|
|
21
23
|
export {
|
|
22
24
|
createGitHubReadFileTool,
|
|
@@ -939,7 +939,7 @@ var import_openai = __toESM(require("openai"), 1);
|
|
|
939
939
|
// package.json
|
|
940
940
|
var package_default = {
|
|
941
941
|
name: "@morphllm/morphsdk",
|
|
942
|
-
version: "0.2.
|
|
942
|
+
version: "0.2.154",
|
|
943
943
|
description: "TypeScript SDK and CLI for Morph Fast Apply integration",
|
|
944
944
|
type: "module",
|
|
945
945
|
main: "./dist/index.cjs",
|
|
@@ -1805,6 +1805,131 @@ function parseGitHubUrl(input) {
|
|
|
1805
1805
|
);
|
|
1806
1806
|
}
|
|
1807
1807
|
|
|
1808
|
+
// tools/compact/core.ts
|
|
1809
|
+
var DEFAULT_API_URL2 = "https://api.morphllm.com";
|
|
1810
|
+
var DEFAULT_TIMEOUT = 12e4;
|
|
1811
|
+
var CompactClient = class {
|
|
1812
|
+
config;
|
|
1813
|
+
constructor(config = {}) {
|
|
1814
|
+
this.config = {
|
|
1815
|
+
...config,
|
|
1816
|
+
morphApiUrl: config.morphApiUrl ?? DEFAULT_API_URL2,
|
|
1817
|
+
timeout: config.timeout ?? DEFAULT_TIMEOUT
|
|
1818
|
+
};
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Compact messages or text via /v1/compact.
|
|
1822
|
+
* Returns per-message `compacted_line_ranges` showing which lines were removed.
|
|
1823
|
+
*
|
|
1824
|
+
* @example
|
|
1825
|
+
* ```typescript
|
|
1826
|
+
* const client = new CompactClient({ morphApiKey: 'sk-...' });
|
|
1827
|
+
* const result = await client.compact({
|
|
1828
|
+
* input: codeFile,
|
|
1829
|
+
* query: "authentication",
|
|
1830
|
+
* compressionRatio: 0.5,
|
|
1831
|
+
* });
|
|
1832
|
+
* console.log(result.output);
|
|
1833
|
+
* ```
|
|
1834
|
+
*/
|
|
1835
|
+
async compact(input) {
|
|
1836
|
+
const apiKey = this.config.morphApiKey || (typeof process !== "undefined" ? process.env?.MORPH_API_KEY : void 0);
|
|
1837
|
+
const debug = this.config.debug || false;
|
|
1838
|
+
if (!apiKey) {
|
|
1839
|
+
throw new Error(
|
|
1840
|
+
"Morph API key not found. Set MORPH_API_KEY environment variable or pass morphApiKey in config."
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
const url = `${this.config.morphApiUrl}/v1/compact`;
|
|
1844
|
+
if (debug) {
|
|
1845
|
+
console.log(`[Compact] Calling ${url}`);
|
|
1846
|
+
}
|
|
1847
|
+
const body = {
|
|
1848
|
+
compression_ratio: input.compressionRatio ?? 0.5,
|
|
1849
|
+
preserve_recent: input.preserveRecent ?? 2,
|
|
1850
|
+
model: input.model ?? "morph-compactor",
|
|
1851
|
+
include_line_ranges: input.includeLineRanges ?? true,
|
|
1852
|
+
include_markers: input.includeMarkers ?? true
|
|
1853
|
+
};
|
|
1854
|
+
if (input.query !== void 0) {
|
|
1855
|
+
body.query = input.query;
|
|
1856
|
+
}
|
|
1857
|
+
if (input.messages) {
|
|
1858
|
+
body.messages = input.messages;
|
|
1859
|
+
} else if (typeof input.input === "string") {
|
|
1860
|
+
body.input = input.input;
|
|
1861
|
+
} else if (Array.isArray(input.input)) {
|
|
1862
|
+
body.messages = input.input;
|
|
1863
|
+
} else {
|
|
1864
|
+
throw new Error("Either 'input' or 'messages' must be provided");
|
|
1865
|
+
}
|
|
1866
|
+
const startTime = Date.now();
|
|
1867
|
+
const response = await fetch(url, {
|
|
1868
|
+
method: "POST",
|
|
1869
|
+
headers: {
|
|
1870
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
1871
|
+
"Content-Type": "application/json"
|
|
1872
|
+
},
|
|
1873
|
+
body: JSON.stringify(body),
|
|
1874
|
+
signal: AbortSignal.timeout(this.config.timeout)
|
|
1875
|
+
});
|
|
1876
|
+
if (!response.ok) {
|
|
1877
|
+
const text = await response.text();
|
|
1878
|
+
throw new Error(`Compact API error ${response.status}: ${text}`);
|
|
1879
|
+
}
|
|
1880
|
+
const data = await response.json();
|
|
1881
|
+
if (debug) {
|
|
1882
|
+
console.log(`[Compact] compact() done in ${Date.now() - startTime}ms`);
|
|
1883
|
+
}
|
|
1884
|
+
return data;
|
|
1885
|
+
}
|
|
1886
|
+
};
|
|
1887
|
+
|
|
1888
|
+
// tools/compact/utils.ts
|
|
1889
|
+
async function compactFileContexts(files, query, apiKey, apiUrl, maxTokens = 1e4, maxConcurrency = 3) {
|
|
1890
|
+
const totalLength = files.reduce((sum, file) => sum + file.content.length, 0);
|
|
1891
|
+
const estimatedTokens = totalLength / 3;
|
|
1892
|
+
if (estimatedTokens <= maxTokens) {
|
|
1893
|
+
return files;
|
|
1894
|
+
}
|
|
1895
|
+
let compressionRatio = maxTokens / estimatedTokens;
|
|
1896
|
+
compressionRatio = Math.max(0.3, Math.min(0.99, compressionRatio));
|
|
1897
|
+
const client = new CompactClient({
|
|
1898
|
+
morphApiKey: apiKey,
|
|
1899
|
+
morphApiUrl: apiUrl
|
|
1900
|
+
});
|
|
1901
|
+
const results = [];
|
|
1902
|
+
const inProgress = /* @__PURE__ */ new Set();
|
|
1903
|
+
for (const file of files) {
|
|
1904
|
+
if (file.content.length < 500) {
|
|
1905
|
+
results.push({ path: file.path, content: file.content });
|
|
1906
|
+
continue;
|
|
1907
|
+
}
|
|
1908
|
+
const task = async () => {
|
|
1909
|
+
try {
|
|
1910
|
+
const result = await client.compact({
|
|
1911
|
+
input: file.content,
|
|
1912
|
+
query,
|
|
1913
|
+
compressionRatio,
|
|
1914
|
+
preserveRecent: 0
|
|
1915
|
+
});
|
|
1916
|
+
results.push({ path: file.path, content: result.output });
|
|
1917
|
+
} catch (error) {
|
|
1918
|
+
console.error(`[compactFileContexts] Failed to compact file ${file.path}:`, error);
|
|
1919
|
+
results.push({ path: file.path, content: file.content });
|
|
1920
|
+
}
|
|
1921
|
+
};
|
|
1922
|
+
const promise = task().finally(() => inProgress.delete(promise));
|
|
1923
|
+
inProgress.add(promise);
|
|
1924
|
+
if (inProgress.size >= maxConcurrency) {
|
|
1925
|
+
await Promise.race(inProgress);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
await Promise.all(inProgress);
|
|
1929
|
+
const orderMap = new Map(files.map((f, i) => [f.path, i]));
|
|
1930
|
+
return results.sort((a, b) => (orderMap.get(a.path) ?? 0) - (orderMap.get(b.path) ?? 0));
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1808
1933
|
// tools/warp_grep/client.ts
|
|
1809
1934
|
var DEFAULT_CODE_SEARCH_URL = "https://morphllm.com";
|
|
1810
1935
|
async function getLocalProvider(repoRoot, excludes, allowNames) {
|
|
@@ -1934,20 +2059,9 @@ async function executeToolCall(input, config) {
|
|
|
1934
2059
|
timeout: config.timeout,
|
|
1935
2060
|
search_type: config.search_type
|
|
1936
2061
|
});
|
|
1937
|
-
|
|
1938
|
-
if (result.terminationReason !== "completed" || !finish?.metadata) {
|
|
1939
|
-
const errorDetails = result.errors?.map((e) => e.message).join("; ") || "unknown reason";
|
|
1940
|
-
console.error(`[warp_grep] executeToolCall failed. Reason: ${result.terminationReason}. Errors: ${errorDetails}. Turns: ${result.timings?.turns?.length ?? 0}`);
|
|
1941
|
-
return { success: false, error: `Search did not complete: ${errorDetails}` };
|
|
1942
|
-
}
|
|
1943
|
-
const contexts = (finish.resolved ?? []).map((r) => ({
|
|
1944
|
-
file: r.path,
|
|
1945
|
-
content: r.content,
|
|
1946
|
-
lines: r.ranges
|
|
1947
|
-
}));
|
|
1948
|
-
return { success: true, contexts, summary: finish.payload };
|
|
2062
|
+
return processAgentResult(result, parsed.search_term, config.morphApiKey, config.morphApiUrl);
|
|
1949
2063
|
}
|
|
1950
|
-
function processAgentResult(result) {
|
|
2064
|
+
async function processAgentResult(result, searchTerm, apiKey, apiUrl) {
|
|
1951
2065
|
const finish = result.finish;
|
|
1952
2066
|
if (result.terminationReason !== "completed" || !finish?.metadata) {
|
|
1953
2067
|
const errorDetails = result.errors?.map((e) => e.message).join("; ") || "unknown reason";
|
|
@@ -1959,6 +2073,15 @@ function processAgentResult(result) {
|
|
|
1959
2073
|
content: r.content,
|
|
1960
2074
|
lines: r.ranges
|
|
1961
2075
|
}));
|
|
2076
|
+
try {
|
|
2077
|
+
const compactable = contexts.map((c) => ({ path: c.file, content: c.content }));
|
|
2078
|
+
const compacted = await compactFileContexts(compactable, searchTerm, apiKey, apiUrl);
|
|
2079
|
+
for (let i = 0; i < contexts.length; i++) {
|
|
2080
|
+
contexts[i].content = compacted[i].content;
|
|
2081
|
+
}
|
|
2082
|
+
} catch (error) {
|
|
2083
|
+
console.error(`[warp_grep] Failed to compact result contexts:`, error);
|
|
2084
|
+
}
|
|
1962
2085
|
return { success: true, contexts, summary: finish.payload };
|
|
1963
2086
|
}
|
|
1964
2087
|
async function* executeToolCallStreaming(input, config) {
|
|
@@ -1987,7 +2110,7 @@ async function* executeToolCallStreaming(input, config) {
|
|
|
1987
2110
|
}
|
|
1988
2111
|
yield value;
|
|
1989
2112
|
}
|
|
1990
|
-
return processAgentResult(agentResult);
|
|
2113
|
+
return processAgentResult(agentResult, parsed.search_term, config.morphApiKey, config.morphApiUrl);
|
|
1991
2114
|
}
|
|
1992
2115
|
async function fetchRawGitHubFile(owner, repo, filePath, branch, timeout) {
|
|
1993
2116
|
const branches = branch ? [branch] : ["HEAD"];
|