@swmansion/argent 0.26.1-next.12 → 0.26.1-next.14
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/cli-cmds.mjs +43 -18
- package/dist/client.d.ts +5 -1
- package/dist/client.js +48 -20
- package/dist/installer.mjs +1 -1
- package/dist/mcp-server.mjs +19 -7
- package/dist/tool-server.cjs +1 -1
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -1675,7 +1675,9 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
1675
1675
|
} catch {
|
|
1676
1676
|
logFd = fs.openSync("/dev/null", "w");
|
|
1677
1677
|
}
|
|
1678
|
-
const
|
|
1678
|
+
const { bun, deno, electron } = process.versions;
|
|
1679
|
+
const nodeBin = !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
|
|
1680
|
+
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
1679
1681
|
detached: true,
|
|
1680
1682
|
stdio: ["ignore", "pipe", logFd],
|
|
1681
1683
|
env: buildToolsServerEnv(paths, port, process.env, options)
|
|
@@ -1683,7 +1685,14 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
1683
1685
|
child.unref();
|
|
1684
1686
|
const pid = child.pid;
|
|
1685
1687
|
if (!pid) {
|
|
1686
|
-
|
|
1688
|
+
child.once(
|
|
1689
|
+
"error",
|
|
1690
|
+
(err) => reject(
|
|
1691
|
+
new Error(
|
|
1692
|
+
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js 20+ or add it to PATH." : `Could not start the argent tool-server: ${err.message}`
|
|
1693
|
+
)
|
|
1694
|
+
)
|
|
1695
|
+
);
|
|
1687
1696
|
return;
|
|
1688
1697
|
}
|
|
1689
1698
|
let settled = false;
|
|
@@ -17134,7 +17143,7 @@ function sha256File(filePath) {
|
|
|
17134
17143
|
createReadStream(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve11(hash2.digest("hex"))).on("error", reject);
|
|
17135
17144
|
});
|
|
17136
17145
|
}
|
|
17137
|
-
async function uploadTar(tarPath, endpoint) {
|
|
17146
|
+
async function uploadTar(tarPath, endpoint, signal) {
|
|
17138
17147
|
const init2 = {
|
|
17139
17148
|
method: "POST",
|
|
17140
17149
|
headers: {
|
|
@@ -17142,7 +17151,8 @@ async function uploadTar(tarPath, endpoint) {
|
|
|
17142
17151
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
17143
17152
|
},
|
|
17144
17153
|
body: createReadStream(tarPath),
|
|
17145
|
-
duplex: "half"
|
|
17154
|
+
duplex: "half",
|
|
17155
|
+
signal
|
|
17146
17156
|
};
|
|
17147
17157
|
const res = await fetch(`${endpoint.url}/upload`, init2);
|
|
17148
17158
|
if (!res.ok) {
|
|
@@ -17194,7 +17204,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
17194
17204
|
);
|
|
17195
17205
|
tarPath = await tarball(filePath);
|
|
17196
17206
|
wire.contentHash = await sha256File(tarPath);
|
|
17197
|
-
wire.uploadId = await uploadTar(tarPath, opts.uploadEndpoint);
|
|
17207
|
+
wire.uploadId = await uploadTar(tarPath, opts.uploadEndpoint, opts.signal);
|
|
17198
17208
|
} finally {
|
|
17199
17209
|
if (tarPath) await rm2(tarPath, { force: true }).catch(() => {
|
|
17200
17210
|
});
|
|
@@ -17263,7 +17273,7 @@ var ToolInvocationError = class extends Error {
|
|
|
17263
17273
|
function authHeaders2(token) {
|
|
17264
17274
|
return token ? { Authorization: `Bearer ${token}` } : {};
|
|
17265
17275
|
}
|
|
17266
|
-
async function consumeToolStream(body, onProgress) {
|
|
17276
|
+
async function consumeToolStream(body, onProgress, signal) {
|
|
17267
17277
|
let final;
|
|
17268
17278
|
const handleLine = (line) => {
|
|
17269
17279
|
if (!line.trim()) return;
|
|
@@ -17287,6 +17297,7 @@ async function consumeToolStream(body, onProgress) {
|
|
|
17287
17297
|
buffered += decoder.decode(value, { stream: true });
|
|
17288
17298
|
let newline;
|
|
17289
17299
|
while ((newline = buffered.indexOf("\n")) !== -1) {
|
|
17300
|
+
signal?.throwIfAborted();
|
|
17290
17301
|
const line = buffered.slice(0, newline);
|
|
17291
17302
|
buffered = buffered.slice(newline + 1);
|
|
17292
17303
|
handleLine(line);
|
|
@@ -17299,6 +17310,7 @@ async function consumeToolStream(body, onProgress) {
|
|
|
17299
17310
|
});
|
|
17300
17311
|
throw err;
|
|
17301
17312
|
}
|
|
17313
|
+
signal?.throwIfAborted();
|
|
17302
17314
|
if (!final) {
|
|
17303
17315
|
throw new Error("tool stream ended without a result \u2014 connection lost mid-run?");
|
|
17304
17316
|
}
|
|
@@ -17325,27 +17337,33 @@ function createToolsClient(options = {}) {
|
|
|
17325
17337
|
cached3 = await ensureToolsServer(options.paths);
|
|
17326
17338
|
return cached3;
|
|
17327
17339
|
}
|
|
17328
|
-
async function fetchTools() {
|
|
17340
|
+
async function fetchTools(opts) {
|
|
17341
|
+
opts?.signal?.throwIfAborted();
|
|
17329
17342
|
const { url: url2, token } = await baseUrl();
|
|
17330
|
-
const res = await fetch(`${url2}/tools`, {
|
|
17343
|
+
const res = await fetch(`${url2}/tools`, {
|
|
17344
|
+
headers: authHeaders2(token),
|
|
17345
|
+
signal: opts?.signal
|
|
17346
|
+
});
|
|
17331
17347
|
if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
|
|
17332
17348
|
const json2 = await res.json();
|
|
17333
17349
|
return json2.tools;
|
|
17334
17350
|
}
|
|
17335
|
-
async function fetchTool(name) {
|
|
17336
|
-
const tools2 = await fetchTools();
|
|
17351
|
+
async function fetchTool(name, opts) {
|
|
17352
|
+
const tools2 = await fetchTools(opts);
|
|
17337
17353
|
return tools2.find((t2) => t2.name === name) ?? null;
|
|
17338
17354
|
}
|
|
17339
17355
|
async function callTool(name, args, opts) {
|
|
17356
|
+
opts?.signal?.throwIfAborted();
|
|
17340
17357
|
const { url: url2, token } = await baseUrl();
|
|
17341
17358
|
let finalArgs = args;
|
|
17342
|
-
const meta3 = await fetchTool(name);
|
|
17359
|
+
const meta3 = await fetchTool(name, { signal: opts?.signal });
|
|
17343
17360
|
if (meta3?.fileInputs?.length) {
|
|
17344
17361
|
const { url: routedUrl } = await getResolvedToolsUrl();
|
|
17345
17362
|
const isRemote = routedUrl !== null;
|
|
17346
17363
|
finalArgs = await prepareFileInputs(meta3.fileInputs, args ?? {}, {
|
|
17347
17364
|
includeContent: isRemote,
|
|
17348
|
-
uploadEndpoint: isRemote ? { url: url2, token } : void 0
|
|
17365
|
+
uploadEndpoint: isRemote ? { url: url2, token } : void 0,
|
|
17366
|
+
signal: opts?.signal
|
|
17349
17367
|
});
|
|
17350
17368
|
}
|
|
17351
17369
|
const res = await fetch(`${url2}/tools/${encodeURIComponent(name)}`, {
|
|
@@ -17355,13 +17373,17 @@ function createToolsClient(options = {}) {
|
|
|
17355
17373
|
...opts?.onProgress ? { Accept: "application/x-ndjson" } : {},
|
|
17356
17374
|
...authHeaders2(token)
|
|
17357
17375
|
},
|
|
17358
|
-
body: JSON.stringify(finalArgs ?? {})
|
|
17376
|
+
body: JSON.stringify(finalArgs ?? {}),
|
|
17377
|
+
signal: opts?.signal
|
|
17359
17378
|
});
|
|
17360
17379
|
const contentType = res.headers.get("content-type") ?? "";
|
|
17361
17380
|
if (opts?.onProgress && res.ok && res.body && contentType.includes("application/x-ndjson")) {
|
|
17362
|
-
return consumeToolStream(res.body, opts.onProgress);
|
|
17381
|
+
return consumeToolStream(res.body, opts.onProgress, opts.signal);
|
|
17363
17382
|
}
|
|
17364
|
-
const json2 = await res.json().catch(() =>
|
|
17383
|
+
const json2 = await res.json().catch(() => {
|
|
17384
|
+
opts?.signal?.throwIfAborted();
|
|
17385
|
+
return {};
|
|
17386
|
+
});
|
|
17365
17387
|
if (!res.ok) {
|
|
17366
17388
|
throw new ToolInvocationError(errorBodyMessage(json2) ?? `${res.status} ${res.statusText}`, {
|
|
17367
17389
|
errorCode: json2.error_code,
|
|
@@ -17369,6 +17391,7 @@ function createToolsClient(options = {}) {
|
|
|
17369
17391
|
issues: Array.isArray(json2.issues) ? json2.issues : void 0
|
|
17370
17392
|
});
|
|
17371
17393
|
}
|
|
17394
|
+
opts?.signal?.throwIfAborted();
|
|
17372
17395
|
const { result: data } = await applyClientFileDirectives(json2.data);
|
|
17373
17396
|
return { data, note: json2.note };
|
|
17374
17397
|
}
|
|
@@ -18279,7 +18302,8 @@ async function materializeArtifacts(result, ctx) {
|
|
|
18279
18302
|
return null;
|
|
18280
18303
|
}
|
|
18281
18304
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
18282
|
-
headers: authHeaders3
|
|
18305
|
+
headers: authHeaders3,
|
|
18306
|
+
signal: ctx.signal
|
|
18283
18307
|
});
|
|
18284
18308
|
if (!res.ok) return null;
|
|
18285
18309
|
const data = await readCapped(res, value.size);
|
|
@@ -18306,7 +18330,8 @@ async function materializeArtifacts(result, ctx) {
|
|
|
18306
18330
|
}
|
|
18307
18331
|
try {
|
|
18308
18332
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
18309
|
-
headers: authHeaders3
|
|
18333
|
+
headers: authHeaders3,
|
|
18334
|
+
signal: ctx.signal
|
|
18310
18335
|
});
|
|
18311
18336
|
if (!res.ok) return null;
|
|
18312
18337
|
const data = Buffer.from(await res.arrayBuffer());
|
|
@@ -21881,7 +21906,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
21881
21906
|
var SESSION_ID2 = randomUUID5();
|
|
21882
21907
|
function readCliVersion() {
|
|
21883
21908
|
if (true) {
|
|
21884
|
-
return "0.26.1-next.
|
|
21909
|
+
return "0.26.1-next.14";
|
|
21885
21910
|
}
|
|
21886
21911
|
return "0.0.0";
|
|
21887
21912
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface ArgentToolResult<T = unknown> {
|
|
|
13
13
|
export interface CallToolOptions {
|
|
14
14
|
/** Receive progress events while a long-running tool works. */
|
|
15
15
|
onProgress?: (event: unknown) => void;
|
|
16
|
+
/** Stop waiting for the call. It rejects with the signal's reason, not ArgentToolError. */
|
|
17
|
+
signal?: AbortSignal;
|
|
16
18
|
}
|
|
17
19
|
/** The tool-server rejected or failed a call. */
|
|
18
20
|
export declare class ArgentToolError extends Error {
|
|
@@ -37,7 +39,9 @@ export interface ArgentFlag {
|
|
|
37
39
|
/** Feature flags and their effective state: project overrides global, then the default. */
|
|
38
40
|
export declare function listFlags(): ArgentFlag[];
|
|
39
41
|
export interface ArgentClient {
|
|
40
|
-
listTools(
|
|
42
|
+
listTools(options?: {
|
|
43
|
+
signal?: AbortSignal;
|
|
44
|
+
}): Promise<ArgentTool[]>;
|
|
41
45
|
callTool<T = unknown>(name: string, args?: Record<string, unknown>, options?: CallToolOptions): Promise<ArgentToolResult<T>>;
|
|
42
46
|
/**
|
|
43
47
|
* Stop this install's local tool-server, like `argent server stop`. The next
|
package/dist/client.js
CHANGED
|
@@ -887,7 +887,9 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
887
887
|
} catch {
|
|
888
888
|
logFd = fs4.openSync("/dev/null", "w");
|
|
889
889
|
}
|
|
890
|
-
const
|
|
890
|
+
const { bun, deno, electron } = process.versions;
|
|
891
|
+
const nodeBin = !(bun || deno || electron) && fs4.existsSync(process.execPath) ? process.execPath : "node";
|
|
892
|
+
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
891
893
|
detached: true,
|
|
892
894
|
stdio: ["ignore", "pipe", logFd],
|
|
893
895
|
env: buildToolsServerEnv(paths, port, process.env, options)
|
|
@@ -895,7 +897,14 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
895
897
|
child.unref();
|
|
896
898
|
const pid = child.pid;
|
|
897
899
|
if (!pid) {
|
|
898
|
-
|
|
900
|
+
child.once(
|
|
901
|
+
"error",
|
|
902
|
+
(err) => reject(
|
|
903
|
+
new Error(
|
|
904
|
+
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js 20+ or add it to PATH." : `Could not start the argent tool-server: ${err.message}`
|
|
905
|
+
)
|
|
906
|
+
)
|
|
907
|
+
);
|
|
899
908
|
return;
|
|
900
909
|
}
|
|
901
910
|
let settled = false;
|
|
@@ -1718,7 +1727,7 @@ function sha256File(filePath) {
|
|
|
1718
1727
|
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve7(hash.digest("hex"))).on("error", reject);
|
|
1719
1728
|
});
|
|
1720
1729
|
}
|
|
1721
|
-
async function uploadTar(tarPath, endpoint) {
|
|
1730
|
+
async function uploadTar(tarPath, endpoint, signal) {
|
|
1722
1731
|
const init = {
|
|
1723
1732
|
method: "POST",
|
|
1724
1733
|
headers: {
|
|
@@ -1726,7 +1735,8 @@ async function uploadTar(tarPath, endpoint) {
|
|
|
1726
1735
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
1727
1736
|
},
|
|
1728
1737
|
body: createReadStream(tarPath),
|
|
1729
|
-
duplex: "half"
|
|
1738
|
+
duplex: "half",
|
|
1739
|
+
signal
|
|
1730
1740
|
};
|
|
1731
1741
|
const res = await fetch(`${endpoint.url}/upload`, init);
|
|
1732
1742
|
if (!res.ok) {
|
|
@@ -1778,7 +1788,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
1778
1788
|
);
|
|
1779
1789
|
tarPath = await tarball(filePath);
|
|
1780
1790
|
wire.contentHash = await sha256File(tarPath);
|
|
1781
|
-
wire.uploadId = await uploadTar(tarPath, opts.uploadEndpoint);
|
|
1791
|
+
wire.uploadId = await uploadTar(tarPath, opts.uploadEndpoint, opts.signal);
|
|
1782
1792
|
} finally {
|
|
1783
1793
|
if (tarPath) await rm2(tarPath, { force: true }).catch(() => {
|
|
1784
1794
|
});
|
|
@@ -1847,7 +1857,7 @@ var ToolInvocationError = class extends Error {
|
|
|
1847
1857
|
function authHeaders2(token) {
|
|
1848
1858
|
return token ? { Authorization: `Bearer ${token}` } : {};
|
|
1849
1859
|
}
|
|
1850
|
-
async function consumeToolStream(body, onProgress) {
|
|
1860
|
+
async function consumeToolStream(body, onProgress, signal) {
|
|
1851
1861
|
let final;
|
|
1852
1862
|
const handleLine = (line) => {
|
|
1853
1863
|
if (!line.trim()) return;
|
|
@@ -1871,6 +1881,7 @@ async function consumeToolStream(body, onProgress) {
|
|
|
1871
1881
|
buffered += decoder.decode(value, { stream: true });
|
|
1872
1882
|
let newline;
|
|
1873
1883
|
while ((newline = buffered.indexOf("\n")) !== -1) {
|
|
1884
|
+
signal?.throwIfAborted();
|
|
1874
1885
|
const line = buffered.slice(0, newline);
|
|
1875
1886
|
buffered = buffered.slice(newline + 1);
|
|
1876
1887
|
handleLine(line);
|
|
@@ -1883,6 +1894,7 @@ async function consumeToolStream(body, onProgress) {
|
|
|
1883
1894
|
});
|
|
1884
1895
|
throw err;
|
|
1885
1896
|
}
|
|
1897
|
+
signal?.throwIfAborted();
|
|
1886
1898
|
if (!final) {
|
|
1887
1899
|
throw new Error("tool stream ended without a result \u2014 connection lost mid-run?");
|
|
1888
1900
|
}
|
|
@@ -1909,27 +1921,33 @@ function createToolsClient(options = {}) {
|
|
|
1909
1921
|
cached = await ensureToolsServer(options.paths);
|
|
1910
1922
|
return cached;
|
|
1911
1923
|
}
|
|
1912
|
-
async function fetchTools() {
|
|
1924
|
+
async function fetchTools(opts) {
|
|
1925
|
+
opts?.signal?.throwIfAborted();
|
|
1913
1926
|
const { url, token } = await baseUrl();
|
|
1914
|
-
const res = await fetch(`${url}/tools`, {
|
|
1927
|
+
const res = await fetch(`${url}/tools`, {
|
|
1928
|
+
headers: authHeaders2(token),
|
|
1929
|
+
signal: opts?.signal
|
|
1930
|
+
});
|
|
1915
1931
|
if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
|
|
1916
1932
|
const json = await res.json();
|
|
1917
1933
|
return json.tools;
|
|
1918
1934
|
}
|
|
1919
|
-
async function fetchTool(name) {
|
|
1920
|
-
const tools = await fetchTools();
|
|
1935
|
+
async function fetchTool(name, opts) {
|
|
1936
|
+
const tools = await fetchTools(opts);
|
|
1921
1937
|
return tools.find((t) => t.name === name) ?? null;
|
|
1922
1938
|
}
|
|
1923
1939
|
async function callTool(name, args, opts) {
|
|
1940
|
+
opts?.signal?.throwIfAborted();
|
|
1924
1941
|
const { url, token } = await baseUrl();
|
|
1925
1942
|
let finalArgs = args;
|
|
1926
|
-
const meta = await fetchTool(name);
|
|
1943
|
+
const meta = await fetchTool(name, { signal: opts?.signal });
|
|
1927
1944
|
if (meta?.fileInputs?.length) {
|
|
1928
1945
|
const { url: routedUrl } = await getResolvedToolsUrl();
|
|
1929
1946
|
const isRemote = routedUrl !== null;
|
|
1930
1947
|
finalArgs = await prepareFileInputs(meta.fileInputs, args ?? {}, {
|
|
1931
1948
|
includeContent: isRemote,
|
|
1932
|
-
uploadEndpoint: isRemote ? { url, token } : void 0
|
|
1949
|
+
uploadEndpoint: isRemote ? { url, token } : void 0,
|
|
1950
|
+
signal: opts?.signal
|
|
1933
1951
|
});
|
|
1934
1952
|
}
|
|
1935
1953
|
const res = await fetch(`${url}/tools/${encodeURIComponent(name)}`, {
|
|
@@ -1939,13 +1957,17 @@ function createToolsClient(options = {}) {
|
|
|
1939
1957
|
...opts?.onProgress ? { Accept: "application/x-ndjson" } : {},
|
|
1940
1958
|
...authHeaders2(token)
|
|
1941
1959
|
},
|
|
1942
|
-
body: JSON.stringify(finalArgs ?? {})
|
|
1960
|
+
body: JSON.stringify(finalArgs ?? {}),
|
|
1961
|
+
signal: opts?.signal
|
|
1943
1962
|
});
|
|
1944
1963
|
const contentType = res.headers.get("content-type") ?? "";
|
|
1945
1964
|
if (opts?.onProgress && res.ok && res.body && contentType.includes("application/x-ndjson")) {
|
|
1946
|
-
return consumeToolStream(res.body, opts.onProgress);
|
|
1965
|
+
return consumeToolStream(res.body, opts.onProgress, opts.signal);
|
|
1947
1966
|
}
|
|
1948
|
-
const json = await res.json().catch(() =>
|
|
1967
|
+
const json = await res.json().catch(() => {
|
|
1968
|
+
opts?.signal?.throwIfAborted();
|
|
1969
|
+
return {};
|
|
1970
|
+
});
|
|
1949
1971
|
if (!res.ok) {
|
|
1950
1972
|
throw new ToolInvocationError(errorBodyMessage(json) ?? `${res.status} ${res.statusText}`, {
|
|
1951
1973
|
errorCode: json.error_code,
|
|
@@ -1953,6 +1975,7 @@ function createToolsClient(options = {}) {
|
|
|
1953
1975
|
issues: Array.isArray(json.issues) ? json.issues : void 0
|
|
1954
1976
|
});
|
|
1955
1977
|
}
|
|
1978
|
+
opts?.signal?.throwIfAborted();
|
|
1956
1979
|
const { result: data } = await applyClientFileDirectives(json.data);
|
|
1957
1980
|
return { data, note: json.note };
|
|
1958
1981
|
}
|
|
@@ -2159,7 +2182,8 @@ async function materializeArtifacts(result, ctx) {
|
|
|
2159
2182
|
return null;
|
|
2160
2183
|
}
|
|
2161
2184
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
2162
|
-
headers: authHeaders3
|
|
2185
|
+
headers: authHeaders3,
|
|
2186
|
+
signal: ctx.signal
|
|
2163
2187
|
});
|
|
2164
2188
|
if (!res.ok) return null;
|
|
2165
2189
|
const data = await readCapped(res, value.size);
|
|
@@ -2186,7 +2210,8 @@ async function materializeArtifacts(result, ctx) {
|
|
|
2186
2210
|
}
|
|
2187
2211
|
try {
|
|
2188
2212
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
2189
|
-
headers: authHeaders3
|
|
2213
|
+
headers: authHeaders3,
|
|
2214
|
+
signal: ctx.signal
|
|
2190
2215
|
});
|
|
2191
2216
|
if (!res.ok) return null;
|
|
2192
2217
|
const data = Buffer.from(await res.arrayBuffer());
|
|
@@ -2345,19 +2370,22 @@ function createArgentClient() {
|
|
|
2345
2370
|
client = createToolsClient({ paths: BUNDLED_RUNTIME_PATHS });
|
|
2346
2371
|
return stopped;
|
|
2347
2372
|
}
|
|
2348
|
-
async function listTools() {
|
|
2349
|
-
const tools = await client.fetchTools();
|
|
2373
|
+
async function listTools(options) {
|
|
2374
|
+
const tools = await client.fetchTools({ signal: options?.signal });
|
|
2350
2375
|
return tools.map(({ name, description, inputSchema }) => ({ name, description, inputSchema }));
|
|
2351
2376
|
}
|
|
2352
2377
|
async function callTool(name, args = {}, options) {
|
|
2353
2378
|
try {
|
|
2354
2379
|
const response = await client.callTool(name, args, options);
|
|
2355
2380
|
const { url, token } = await client.baseUrl();
|
|
2381
|
+
options?.signal?.throwIfAborted();
|
|
2356
2382
|
const { result } = await materializeArtifacts(response.data, {
|
|
2357
2383
|
toolsUrl: url,
|
|
2358
2384
|
authToken: token,
|
|
2359
|
-
deviceId: getDeviceIdFromArgs(args)
|
|
2385
|
+
deviceId: getDeviceIdFromArgs(args),
|
|
2386
|
+
signal: options?.signal
|
|
2360
2387
|
});
|
|
2388
|
+
options?.signal?.throwIfAborted();
|
|
2361
2389
|
return { data: result, note: response.note };
|
|
2362
2390
|
} catch (err) {
|
|
2363
2391
|
if (err instanceof ToolInvocationError) {
|
package/dist/installer.mjs
CHANGED
|
@@ -16730,7 +16730,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
16730
16730
|
var SESSION_ID = randomUUID4();
|
|
16731
16731
|
function readCliVersion() {
|
|
16732
16732
|
if (true) {
|
|
16733
|
-
return "0.26.1-next.
|
|
16733
|
+
return "0.26.1-next.14";
|
|
16734
16734
|
}
|
|
16735
16735
|
return "0.0.0";
|
|
16736
16736
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -15932,7 +15932,9 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
15932
15932
|
} catch {
|
|
15933
15933
|
logFd = fs.openSync("/dev/null", "w");
|
|
15934
15934
|
}
|
|
15935
|
-
const
|
|
15935
|
+
const { bun, deno, electron } = process.versions;
|
|
15936
|
+
const nodeBin = !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
|
|
15937
|
+
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
15936
15938
|
detached: true,
|
|
15937
15939
|
stdio: ["ignore", "pipe", logFd],
|
|
15938
15940
|
env: buildToolsServerEnv(paths, port, process.env, options)
|
|
@@ -15940,7 +15942,14 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
15940
15942
|
child.unref();
|
|
15941
15943
|
const pid = child.pid;
|
|
15942
15944
|
if (!pid) {
|
|
15943
|
-
|
|
15945
|
+
child.once(
|
|
15946
|
+
"error",
|
|
15947
|
+
(err) => reject(
|
|
15948
|
+
new Error(
|
|
15949
|
+
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js 20+ or add it to PATH." : `Could not start the argent tool-server: ${err.message}`
|
|
15950
|
+
)
|
|
15951
|
+
)
|
|
15952
|
+
);
|
|
15944
15953
|
return;
|
|
15945
15954
|
}
|
|
15946
15955
|
let settled = false;
|
|
@@ -16796,7 +16805,7 @@ function sha256File(filePath) {
|
|
|
16796
16805
|
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve8(hash.digest("hex"))).on("error", reject);
|
|
16797
16806
|
});
|
|
16798
16807
|
}
|
|
16799
|
-
async function uploadTar(tarPath, endpoint) {
|
|
16808
|
+
async function uploadTar(tarPath, endpoint, signal) {
|
|
16800
16809
|
const init = {
|
|
16801
16810
|
method: "POST",
|
|
16802
16811
|
headers: {
|
|
@@ -16804,7 +16813,8 @@ async function uploadTar(tarPath, endpoint) {
|
|
|
16804
16813
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
16805
16814
|
},
|
|
16806
16815
|
body: createReadStream(tarPath),
|
|
16807
|
-
duplex: "half"
|
|
16816
|
+
duplex: "half",
|
|
16817
|
+
signal
|
|
16808
16818
|
};
|
|
16809
16819
|
const res = await fetch(`${endpoint.url}/upload`, init);
|
|
16810
16820
|
if (!res.ok) {
|
|
@@ -16856,7 +16866,7 @@ async function prepareFileInputs(specs, args, opts) {
|
|
|
16856
16866
|
);
|
|
16857
16867
|
tarPath = await tarball(filePath);
|
|
16858
16868
|
wire.contentHash = await sha256File(tarPath);
|
|
16859
|
-
wire.uploadId = await uploadTar(tarPath, opts.uploadEndpoint);
|
|
16869
|
+
wire.uploadId = await uploadTar(tarPath, opts.uploadEndpoint, opts.signal);
|
|
16860
16870
|
} finally {
|
|
16861
16871
|
if (tarPath) await rm2(tarPath, { force: true }).catch(() => {
|
|
16862
16872
|
});
|
|
@@ -17524,7 +17534,8 @@ async function materializeArtifacts(result, ctx) {
|
|
|
17524
17534
|
return null;
|
|
17525
17535
|
}
|
|
17526
17536
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
17527
|
-
headers: authHeaders2
|
|
17537
|
+
headers: authHeaders2,
|
|
17538
|
+
signal: ctx.signal
|
|
17528
17539
|
});
|
|
17529
17540
|
if (!res.ok) return null;
|
|
17530
17541
|
const data = await readCapped(res, value.size);
|
|
@@ -17551,7 +17562,8 @@ async function materializeArtifacts(result, ctx) {
|
|
|
17551
17562
|
}
|
|
17552
17563
|
try {
|
|
17553
17564
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
17554
|
-
headers: authHeaders2
|
|
17565
|
+
headers: authHeaders2,
|
|
17566
|
+
signal: ctx.signal
|
|
17555
17567
|
});
|
|
17556
17568
|
if (!res.ok) return null;
|
|
17557
17569
|
const data = Buffer.from(await res.arrayBuffer());
|
package/dist/tool-server.cjs
CHANGED
|
@@ -94814,7 +94814,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
94814
94814
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
94815
94815
|
function readCliVersion() {
|
|
94816
94816
|
if (true) {
|
|
94817
|
-
return "0.26.1-next.
|
|
94817
|
+
return "0.26.1-next.14";
|
|
94818
94818
|
}
|
|
94819
94819
|
return "0.0.0";
|
|
94820
94820
|
}
|
package/package.json
CHANGED