@swifty.js/swifty 0.0.31 → 0.0.33
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/README.md +110 -3
- package/dist/acp-5WRTN2LL.js +14 -0
- package/dist/agent-3CAPJCPD.js +4 -0
- package/dist/anthropic-FXRRA63E.js +4 -0
- package/dist/{bwrap-TPE6G4BM.js → bwrap-ZTS67W2K.js} +1 -1
- package/dist/checker-3O7QF7XV.js +4 -0
- package/dist/chunk-2U4IWZ6E.js +4 -0
- package/dist/chunk-35X3GW25.js +4 -0
- package/dist/chunk-4C3KJLJV.js +4 -0
- package/dist/chunk-4HSQBZBI.js +4 -0
- package/dist/{chunk-AGJYBJ5M.js → chunk-4PQYUHSN.js} +1 -1
- package/dist/chunk-6I3HEMIE.js +4 -0
- package/dist/{chunk-C3WGLVVZ.js → chunk-7JQHFZRD.js} +2 -2
- package/dist/chunk-C5WLP3DH.js +5 -0
- package/dist/chunk-FUKVR3XO.js +608 -0
- package/dist/chunk-FZORZF22.js +16 -0
- package/dist/chunk-G2TE2QZM.js +4 -0
- package/dist/chunk-I7XJSLRI.js +4 -0
- package/dist/{chunk-OQCEP2F5.js → chunk-IKQTIDRL.js} +1 -1
- package/dist/chunk-IZ7QOBSB.js +4 -0
- package/dist/chunk-LC7ZWLIH.js +4 -0
- package/dist/chunk-LHSUYZO5.js +4 -0
- package/dist/chunk-M4D66APS.js +67 -0
- package/dist/chunk-NAAAN2TD.js +60 -0
- package/dist/chunk-NCZR3AGA.js +65 -0
- package/dist/{server-BNT2IIKB.js → chunk-PXQD6GWP.js} +15 -22
- package/dist/{chunk-FPQ2LBL4.js → chunk-QQVDL4QT.js} +1 -1
- package/dist/{chunk-TCQ4EB4G.js → chunk-TNF3EHFY.js} +1 -1
- package/dist/chunk-XGUH7SGV.js +4 -0
- package/dist/chunk-YIKI3EPG.js +150 -0
- package/dist/chunk-YKWIZE5D.js +4 -0
- package/dist/{devtools-OJ75EP3T.js → devtools-WJM4UVVT.js} +1 -1
- package/dist/esm-46WSO26W.js +4 -0
- package/dist/esm-4DBD7ONK.js +229 -0
- package/dist/esm-6EDGM6QS.js +4 -0
- package/dist/esm-D6BB3FBR.js +4 -0
- package/dist/esm-P2KEXEEK.js +4 -0
- package/dist/esm-XYKZYVLV.js +4 -0
- package/dist/esm-YJVVI2QX.js +4 -0
- package/dist/getMachineId-bsd-NBOQ3GRQ.js +4 -0
- package/dist/getMachineId-darwin-6VBNSUFR.js +5 -0
- package/dist/getMachineId-linux-RQ33NIOO.js +4 -0
- package/dist/getMachineId-unsupported-IWOYPUHZ.js +4 -0
- package/dist/getMachineId-win-ITT3WXP6.js +4 -0
- package/dist/lib/agent-NNYCUIOF.js +10 -0
- package/dist/lib/{anthropic-R6DMXE7U.js → anthropic-B33M2AVN.js} +4 -4
- package/dist/lib/{checker-M7RKMKJQ.js → checker-UPY4CXUL.js} +3 -3
- package/dist/lib/{chunk-OQIQOU5S.js → chunk-3OFLDUAW.js} +121 -1
- package/dist/lib/{chunk-EY7HE52Q.js → chunk-3XCGUKGJ.js} +18 -24
- package/dist/lib/{chunk-J6AV7SIF.js → chunk-AFYPVA5C.js} +261 -25
- package/dist/lib/{chunk-FZ4Y6MBN.js → chunk-BCBD34D2.js} +1 -1
- package/dist/lib/{chunk-A4MXZA5Q.js → chunk-CFYAZWDA.js} +10 -4
- package/dist/lib/{chunk-4MDCRPVV.js → chunk-FODSMOWP.js} +6 -6
- package/dist/lib/chunk-GTHYQZRL.js +31 -0
- package/dist/lib/{chunk-EWE5IWZE.js → chunk-LDWFI6MR.js} +15 -4
- package/dist/lib/{chunk-OEPCNATU.js → chunk-TJLAJGG4.js} +2 -2
- package/dist/lib/index.d.ts +2339 -1581
- package/dist/lib/index.js +12210 -10961
- package/dist/lib/{openai-5N42ZYIJ.js → openai-C2PZFGJ2.js} +3 -3
- package/dist/lib/providers-UJEWP7C7.js +419 -0
- package/dist/lib/{tool-filter-XG2GXFVN.js → tool-filter-BFEINZIA.js} +1 -1
- package/dist/main.js +190 -183
- package/dist/{node-4LTSRXL2.js → node-A6KBFKOV.js} +1 -1
- package/dist/{openai-NQYARTT6.js → openai-WPEICAZ4.js} +1 -1
- package/dist/providers-WNYZUMZ3.js +6 -0
- package/dist/seatbelt-PSPJ5LBR.js +5 -0
- package/dist/server-YPBLBRDN.js +4 -0
- package/dist/src-3A5BCUSZ.js +4 -0
- package/dist/src-CRYFVH7Y.js +12 -0
- package/dist/src-Y77IB66J.js +4 -0
- package/dist/src-ZCW4GCG2.js +4 -0
- package/dist/{tool-filter-5NDJMSTD.js → tool-filter-X6IYME2K.js} +1 -1
- package/dist/turndown.es-WNOSVZF6.js +83 -0
- package/package.json +38 -15
- package/dist/agent-O6C4FCQY.js +0 -4
- package/dist/anthropic-CFM2DXMB.js +0 -4
- package/dist/checker-A6PGACKZ.js +0 -4
- package/dist/chunk-4ABFUBO4.js +0 -601
- package/dist/chunk-AQ3A5CF4.js +0 -5
- package/dist/chunk-MVVSONAE.js +0 -4
- package/dist/chunk-OTVZGPHD.js +0 -121
- package/dist/chunk-X3UA5OZL.js +0 -4
- package/dist/chunk-Y2UUXOQA.js +0 -4
- package/dist/chunk-YAXZ2OUD.js +0 -150
- package/dist/lib/agent-YRTROHXU.js +0 -10
- package/dist/seatbelt-YXUQ5XR3.js +0 -5
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{e as T,h as c}from"./chunk-2U4IWZ6E.js";import{d as e,k as p,q as _,r as s,s as i,t as E,v as O}from"./chunk-G2TE2QZM.js";import"./chunk-FZORZF22.js";import"./chunk-YKWIZE5D.js";import"./chunk-LC7ZWLIH.js";import"./chunk-IZ7QOBSB.js";c();_();O();var o="otlp_http_metric_exporter";var t=class extends T{_url;constructor(r){super(i(E(r??{},"METRICS","v1/metrics",{"Content-Type":"application/x-protobuf"}),p,o,e,r?.selfObsMeterProvider),r),this._url=r?.url}setSelfObsMeterProvider(r){this.setMetrics(s(o,e,this._url,r))}};export{t as OTLPMetricExporter};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a,b,c,d,e,f,h as g}from"./chunk-2U4IWZ6E.js";import"./chunk-G2TE2QZM.js";import"./chunk-FZORZF22.js";import"./chunk-YKWIZE5D.js";import"./chunk-LC7ZWLIH.js";import"./chunk-IZ7QOBSB.js";g();export{a as AggregationTemporalityPreference,b as CumulativeTemporalitySelector,c as DeltaTemporalitySelector,d as LowMemoryTemporalitySelector,f as OTLPMetricExporter,e as OTLPMetricExporterBase};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a}from"./chunk-35X3GW25.js";import"./chunk-G2TE2QZM.js";import"./chunk-FZORZF22.js";import"./chunk-YKWIZE5D.js";import"./chunk-LC7ZWLIH.js";import"./chunk-IZ7QOBSB.js";export{a as OTLPTraceExporter};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a as t,c as L,f as e,m as p,q as _,s as O,t as T,v as s}from"./chunk-G2TE2QZM.js";import"./chunk-FZORZF22.js";import"./chunk-YKWIZE5D.js";import"./chunk-LC7ZWLIH.js";import"./chunk-IZ7QOBSB.js";L();_();s();var E="otlp_http_log_exporter";var r=class extends t{constructor(o={}){super(O(T(o,"LOGS","v1/logs",{"Content-Type":"application/json"}),p,E,e,o.selfObsMeterProvider))}};export{r as OTLPLogExporter};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a as e,c as _,e as o,l as p,q as O,s as T,t as E,v as a}from"./chunk-G2TE2QZM.js";import"./chunk-FZORZF22.js";import"./chunk-YKWIZE5D.js";import"./chunk-LC7ZWLIH.js";import"./chunk-IZ7QOBSB.js";_();O();a();var P="otlp_http_span_exporter";var r=class extends e{constructor(t={}){super(T(E(t,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),p,P,o,t.selfObsMeterProvider))}};export{r as OTLPTraceExporter};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a as t,b as s}from"./chunk-6I3HEMIE.js";import{p as r,u as n}from"./chunk-LC7ZWLIH.js";import{b as i}from"./chunk-IZ7QOBSB.js";import{promises as o}from"fs";async function m(){try{return(await o.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(e){r.debug(`error reading machine id: ${e}`)}try{return(await t("kenv -q smbios.system.uuid")).stdout.trim()}catch(e){r.debug(`error reading machine id: ${e}`)}}var a=i(()=>{s();n()});a();export{m as getMachineId};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a as n,b as s}from"./chunk-6I3HEMIE.js";import{p as i,u as o}from"./chunk-LC7ZWLIH.js";import{b as d}from"./chunk-IZ7QOBSB.js";async function l(){try{let t=(await n('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
5
|
+
`).find(c=>c.includes("IOPlatformUUID"));if(!t)return;let r=t.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(e){i.debug(`error reading machine id: ${e}`)}}var a=d(()=>{s();o()});a();export{l as getMachineId};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{p as r,u as a}from"./chunk-LC7ZWLIH.js";import{b as n}from"./chunk-IZ7QOBSB.js";import{promises as o}from"fs";async function m(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let i of t)try{return(await o.readFile(i,{encoding:"utf8"})).trim()}catch(e){r.debug(`error reading machine id: ${e}`)}}var c=n(()=>{a()});c();export{m as getMachineId};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{p as e,u as d}from"./chunk-LC7ZWLIH.js";import{b as n}from"./chunk-IZ7QOBSB.js";async function t(){e.debug("could not read machine-id: unsupported platform")}var o=n(()=>{d()});o();export{t as getMachineId};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a as s,b as d}from"./chunk-6I3HEMIE.js";import{p as n,u as a}from"./chunk-LC7ZWLIH.js";import{b as o}from"./chunk-IZ7QOBSB.js";import*as r from"process";async function f(){let c="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";r.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in r.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let i=(await s(`${e} ${c}`)).stdout.split("REG_SZ");if(i.length===2)return i[1].trim()}catch(t){n.debug(`error reading machine id: ${t}`)}}var m=o(()=>{d();a()});m();export{f as getMachineId};
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
markLastUserTailForCache,
|
|
6
6
|
markToolsForCache,
|
|
7
7
|
needsToolSearchBeta
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FODSMOWP.js";
|
|
9
9
|
import "./chunk-XT67KGWE.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-BCBD34D2.js";
|
|
11
|
+
import "./chunk-3OFLDUAW.js";
|
|
12
|
+
import "./chunk-3XCGUKGJ.js";
|
|
13
13
|
export {
|
|
14
14
|
AnthropicClient,
|
|
15
15
|
buildAnthropicMessages,
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
evaluateRules,
|
|
6
6
|
extractContent,
|
|
7
7
|
isSafeCommand
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-CFYAZWDA.js";
|
|
9
|
+
import "./chunk-BCBD34D2.js";
|
|
10
|
+
import "./chunk-3XCGUKGJ.js";
|
|
11
11
|
export {
|
|
12
12
|
PathSandbox,
|
|
13
13
|
PermissionChecker,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createChildLogger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3XCGUKGJ.js";
|
|
4
4
|
|
|
5
5
|
// src/llm/errors.ts
|
|
6
6
|
var LLMError = class extends Error {
|
|
@@ -288,6 +288,10 @@ function loadSingleFile(path) {
|
|
|
288
288
|
const parsed2 = safeParse(z.array(MCPServerConfigSchema), raw.mcp_servers);
|
|
289
289
|
if (parsed2.success) {
|
|
290
290
|
mcpServers = parsed2.data;
|
|
291
|
+
} else {
|
|
292
|
+
throw new ConfigError(
|
|
293
|
+
`Invalid MCP server configuration in ${path}: ${getParseErrorMessage(parsed2.error)}`
|
|
294
|
+
);
|
|
291
295
|
}
|
|
292
296
|
}
|
|
293
297
|
if ("hooks" in raw) {
|
|
@@ -323,6 +327,7 @@ function validateProviders(config) {
|
|
|
323
327
|
throw new ConfigError("At least one provider MUST be configured.");
|
|
324
328
|
}
|
|
325
329
|
const requiredFields = ["name", "protocol", "base_url", "model"];
|
|
330
|
+
const baseUrls = /* @__PURE__ */ new Map();
|
|
326
331
|
for (let i = 0; i < config.providers.length; i++) {
|
|
327
332
|
const p = config.providers[i];
|
|
328
333
|
const values = {
|
|
@@ -340,11 +345,123 @@ function validateProviders(config) {
|
|
|
340
345
|
`Provider #${String(i + 1)}: invalid protocol '${p.protocol}', MUST be one of: ${Array.from(VALID_PROTOCOLS).join(", ")}`
|
|
341
346
|
);
|
|
342
347
|
}
|
|
348
|
+
const previous = baseUrls.get(p.base_url);
|
|
349
|
+
if (previous !== void 0) {
|
|
350
|
+
throw new ConfigError(
|
|
351
|
+
`Provider #${String(i + 1)}: duplicate base_url '${p.base_url}' (already used by provider #${String(previous + 1)}).`
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
baseUrls.set(p.base_url, i);
|
|
343
355
|
}
|
|
344
356
|
}
|
|
357
|
+
function validateMcpServers(config) {
|
|
358
|
+
const names = /* @__PURE__ */ new Map();
|
|
359
|
+
for (let i = 0; i < config.mcp_servers.length; i++) {
|
|
360
|
+
const server = config.mcp_servers[i];
|
|
361
|
+
const position = `MCP server #${String(i + 1)}`;
|
|
362
|
+
if (!server.name.trim()) {
|
|
363
|
+
throw new ConfigError(`${position}: name must not be empty.`);
|
|
364
|
+
}
|
|
365
|
+
const previous = names.get(server.name);
|
|
366
|
+
if (previous !== void 0) {
|
|
367
|
+
throw new ConfigError(
|
|
368
|
+
`${position}: duplicate name '${server.name}' (already used by MCP server #${String(previous + 1)}).`
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
names.set(server.name, i);
|
|
372
|
+
const hasCommand = Boolean(server.command?.trim());
|
|
373
|
+
const hasUrl = Boolean(server.url?.trim());
|
|
374
|
+
if (hasCommand === hasUrl) {
|
|
375
|
+
throw new ConfigError(
|
|
376
|
+
`${position} '${server.name}': configure exactly one of command or url.`
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
if (hasCommand && server.transport && server.transport !== "stdio") {
|
|
380
|
+
throw new ConfigError(`${position} '${server.name}': command servers must use stdio.`);
|
|
381
|
+
}
|
|
382
|
+
if (hasUrl && server.transport && !["http", "sse"].includes(server.transport)) {
|
|
383
|
+
throw new ConfigError(`${position} '${server.name}': URL transport must be http or sse.`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
var PROJECT_MCP_FILENAME = ".mcp.json";
|
|
388
|
+
var McpJsonEntrySchema = z.looseObject({
|
|
389
|
+
command: z.string().optional(),
|
|
390
|
+
args: z.array(z.string()).optional(),
|
|
391
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
392
|
+
type: z.enum(["stdio", "sse", "http"]).optional(),
|
|
393
|
+
url: z.string().optional(),
|
|
394
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
395
|
+
});
|
|
396
|
+
var McpJsonFileSchema = z.looseObject({
|
|
397
|
+
// Parse entries independently below so one bad server does not disable every
|
|
398
|
+
// valid server in the project file.
|
|
399
|
+
mcpServers: z.record(z.string(), z.unknown()).default({})
|
|
400
|
+
});
|
|
401
|
+
function mcpServerFromJsonEntry(name, entry) {
|
|
402
|
+
const transport = entry.type ?? (entry.command !== void 0 ? "stdio" : "http");
|
|
403
|
+
if (transport === "stdio") {
|
|
404
|
+
if (!entry.command || entry.url !== void 0) {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
return { name, command: entry.command, args: entry.args, env: entry.env };
|
|
408
|
+
}
|
|
409
|
+
if (!entry.url || entry.command !== void 0) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
return { name, url: entry.url, transport, headers: entry.headers };
|
|
413
|
+
}
|
|
414
|
+
function loadProjectMcpServers(workDir) {
|
|
415
|
+
const path = join(workDir, PROJECT_MCP_FILENAME);
|
|
416
|
+
if (!existsSync(path)) {
|
|
417
|
+
return [];
|
|
418
|
+
}
|
|
419
|
+
let raw;
|
|
420
|
+
try {
|
|
421
|
+
raw = JSON.parse(readFileSync(path, "utf-8"));
|
|
422
|
+
} catch (err) {
|
|
423
|
+
log.error({ err, path }, "invalid .mcp.json");
|
|
424
|
+
return [];
|
|
425
|
+
}
|
|
426
|
+
const parsed = safeParse(McpJsonFileSchema, raw);
|
|
427
|
+
if (!parsed.success) {
|
|
428
|
+
log.error({ error: parsed.error, path }, "invalid .mcp.json");
|
|
429
|
+
return [];
|
|
430
|
+
}
|
|
431
|
+
const servers = [];
|
|
432
|
+
for (const [name, rawEntry] of Object.entries(parsed.data.mcpServers)) {
|
|
433
|
+
const parsedEntry = safeParse(McpJsonEntrySchema, rawEntry);
|
|
434
|
+
if (!name.trim() || !parsedEntry.success) {
|
|
435
|
+
log.warn(
|
|
436
|
+
{ name, path, error: parsedEntry.success ? void 0 : parsedEntry.error },
|
|
437
|
+
"skipping invalid .mcp.json server entry"
|
|
438
|
+
);
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
const server = mcpServerFromJsonEntry(name, parsedEntry.data);
|
|
442
|
+
if (server) {
|
|
443
|
+
servers.push(server);
|
|
444
|
+
} else {
|
|
445
|
+
log.warn({ name, path }, "skipping invalid .mcp.json server entry");
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return servers;
|
|
449
|
+
}
|
|
450
|
+
function withProjectMcpServers(config, workDir) {
|
|
451
|
+
const projectServers = loadProjectMcpServers(workDir);
|
|
452
|
+
if (projectServers.length === 0) {
|
|
453
|
+
return config;
|
|
454
|
+
}
|
|
455
|
+
const known = new Set(config.mcp_servers.map((s) => s.name));
|
|
456
|
+
return {
|
|
457
|
+
...config,
|
|
458
|
+
mcp_servers: [...config.mcp_servers, ...projectServers.filter((s) => !known.has(s.name))]
|
|
459
|
+
};
|
|
460
|
+
}
|
|
345
461
|
function loadConfig(path, options = {}) {
|
|
346
462
|
if (path) {
|
|
347
463
|
const config2 = loadSingleFile(path);
|
|
464
|
+
validateMcpServers(config2);
|
|
348
465
|
if (!options.allowEmptyProviders || config2.providers.length > 0) {
|
|
349
466
|
validateProviders(config2);
|
|
350
467
|
}
|
|
@@ -358,6 +475,7 @@ function loadConfig(path, options = {}) {
|
|
|
358
475
|
throw new ConfigError(`No config file found, expected ${candidate}.`);
|
|
359
476
|
}
|
|
360
477
|
const config = loadSingleFile(candidate);
|
|
478
|
+
validateMcpServers(config);
|
|
361
479
|
if (!options.allowEmptyProviders || config.providers.length > 0) {
|
|
362
480
|
validateProviders(config);
|
|
363
481
|
}
|
|
@@ -444,6 +562,8 @@ export {
|
|
|
444
562
|
resolveAPIKey,
|
|
445
563
|
HookConfigSchema,
|
|
446
564
|
forkEnabled,
|
|
565
|
+
loadProjectMcpServers,
|
|
566
|
+
withProjectMcpServers,
|
|
447
567
|
loadConfig,
|
|
448
568
|
INTERRUPTED_TOOL_RESULT,
|
|
449
569
|
REJECTED_TOOL_RESULT,
|
|
@@ -228,7 +228,7 @@ function errSerializer(err) {
|
|
|
228
228
|
return { message: safeStringify(err), value: err };
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
// src/utils/
|
|
231
|
+
// src/utils/utils.ts
|
|
232
232
|
var log = createChildLogger({ module: "utils" });
|
|
233
233
|
function contentToText(content) {
|
|
234
234
|
if (typeof content === "string") {
|
|
@@ -336,29 +336,23 @@ function boolArg(args, key, fallback) {
|
|
|
336
336
|
}
|
|
337
337
|
return fallback ?? Boolean(v);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
if (
|
|
341
|
-
return
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
const left = [];
|
|
349
|
-
const right = [];
|
|
350
|
-
const equal = [];
|
|
351
|
-
for (const item of arr) {
|
|
352
|
-
const result = compare(item, pivot);
|
|
353
|
-
if (result < 0) {
|
|
354
|
-
left.push(item);
|
|
355
|
-
} else if (result > 0) {
|
|
356
|
-
right.push(item);
|
|
357
|
-
} else {
|
|
358
|
-
equal.push(item);
|
|
359
|
-
}
|
|
339
|
+
function formatToolArgs(args) {
|
|
340
|
+
if (args.command) {
|
|
341
|
+
return truncate(strArg(args, "command"), 80);
|
|
342
|
+
}
|
|
343
|
+
if (args.file_path) {
|
|
344
|
+
return truncate(strArg(args, "file_path"), 80);
|
|
345
|
+
}
|
|
346
|
+
if (args.pattern) {
|
|
347
|
+
return truncate(strArg(args, "pattern"), 80);
|
|
360
348
|
}
|
|
361
|
-
|
|
349
|
+
if (args.description) {
|
|
350
|
+
return truncate(strArg(args, "description"), 80);
|
|
351
|
+
}
|
|
352
|
+
return "";
|
|
353
|
+
}
|
|
354
|
+
function truncate(value, max) {
|
|
355
|
+
return value.length > max ? `${value.slice(0, max)}\u2026` : value;
|
|
362
356
|
}
|
|
363
357
|
|
|
364
358
|
export {
|
|
@@ -380,5 +374,5 @@ export {
|
|
|
380
374
|
strList,
|
|
381
375
|
strArg,
|
|
382
376
|
boolArg,
|
|
383
|
-
|
|
377
|
+
formatToolArgs
|
|
384
378
|
};
|