openfox 2.0.37 → 2.0.39
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/agent-defaults/builder.agent.md +2 -0
- package/dist/agent-defaults/code-reviewer.agent.md +1 -0
- package/dist/agent-defaults/explorer.agent.md +1 -0
- package/dist/agent-defaults/planner.agent.md +1 -0
- package/dist/{chat-handler-HPXOVKUX.js → chat-handler-4YZGM7V7.js} +4 -4
- package/dist/{chunk-PKE4MQWI.js → chunk-4RYP3RBY.js} +6 -6
- package/dist/{chunk-QG2WM7EX.js → chunk-BG5ILIWN.js} +2 -2
- package/dist/{chunk-2G2H4HUO.js → chunk-BMRC6TQ5.js} +369 -35
- package/dist/{chunk-PWY6EBZ6.js → chunk-EZ3BPIUV.js} +9 -2
- package/dist/{chunk-DAC7YKYW.js → chunk-P4SOUTLD.js} +3 -3
- package/dist/{chunk-BJPPDLJX.js → chunk-UR4A2HYT.js} +277 -11
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-QI3KOU42.js → config-XOXIIBUY.js} +2 -2
- package/dist/{orchestrator-PTKTND5E.js → orchestrator-7B3XOZ4T.js} +4 -4
- package/dist/package.json +1 -1
- package/dist/{processor-D6HYPRZD.js → processor-FB2I73B3.js} +4 -4
- package/dist/{provider-ZLMMOORK.js → provider-JLLIB72V.js} +3 -3
- package/dist/{serve-NGAWODZ2.js → serve-RZWSK3AA.js} +6 -6
- package/dist/server/index.d.ts +88 -0
- package/dist/server/index.js +5 -5
- package/dist/{server-K2BDDDL4.js → server-YPCAJFOC.js} +5 -5
- package/dist/{tools-JPKBLAQ5.js → tools-ZYUJUI4R.js} +3 -3
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
tokenFromPassword,
|
|
22
22
|
verifyPassword,
|
|
23
23
|
workflowExists
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-P4SOUTLD.js";
|
|
25
25
|
import {
|
|
26
26
|
agentExists,
|
|
27
27
|
createToolRegistry,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
setMcpTools,
|
|
62
62
|
setNotifyMcpServersChanged,
|
|
63
63
|
skillExists
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-UR4A2HYT.js";
|
|
65
65
|
import {
|
|
66
66
|
getPathSeparator,
|
|
67
67
|
isAbsolutePath
|
|
@@ -148,7 +148,7 @@ import {
|
|
|
148
148
|
import express from "express";
|
|
149
149
|
import cors from "cors";
|
|
150
150
|
import { createServer as createHttpServer } from "http";
|
|
151
|
-
import { fileURLToPath as
|
|
151
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
152
152
|
import { dirname as dirname5, resolve as resolve3, join as join5 } from "path";
|
|
153
153
|
import { readFile } from "fs/promises";
|
|
154
154
|
import { createServer as createViteServer } from "vite";
|
|
@@ -1420,8 +1420,10 @@ function estimateToolTokens(toolName, description, inputSchema) {
|
|
|
1420
1420
|
var McpManager = class {
|
|
1421
1421
|
servers = /* @__PURE__ */ new Map();
|
|
1422
1422
|
onServersChanged;
|
|
1423
|
+
onToolsDiscovered;
|
|
1423
1424
|
constructor(options) {
|
|
1424
1425
|
this.onServersChanged = options?.onServersChanged;
|
|
1426
|
+
this.onToolsDiscovered = options?.onToolsDiscovered;
|
|
1425
1427
|
}
|
|
1426
1428
|
async addServer(name, config4) {
|
|
1427
1429
|
if (this.servers.has(name)) {
|
|
@@ -1481,12 +1483,34 @@ var McpManager = class {
|
|
|
1481
1483
|
entry.client = client;
|
|
1482
1484
|
entry.transport = transport;
|
|
1483
1485
|
entry.state = { name, config: entry.config, status: "connected", tools, estimatedTokens: totalTokens };
|
|
1486
|
+
const cachedTools = tools.map((t) => ({
|
|
1487
|
+
name: t.name,
|
|
1488
|
+
...t.description ? { description: t.description } : {},
|
|
1489
|
+
inputSchema: t.inputSchema,
|
|
1490
|
+
estimatedTokens: t.estimatedTokens
|
|
1491
|
+
}));
|
|
1492
|
+
entry.config.cachedTools = cachedTools;
|
|
1493
|
+
this.onToolsDiscovered?.(name, cachedTools);
|
|
1484
1494
|
logger.info("Connected to MCP server", { name, toolCount: tools.length });
|
|
1485
1495
|
this.onServersChanged?.();
|
|
1486
1496
|
} catch (error) {
|
|
1487
1497
|
const msg = error instanceof Error ? error.message : String(error);
|
|
1488
1498
|
logger.error("Failed to connect MCP server", { name, error: msg });
|
|
1489
|
-
|
|
1499
|
+
const cachedTools = entry.config.cachedTools;
|
|
1500
|
+
if (cachedTools && cachedTools.length > 0) {
|
|
1501
|
+
const disabledSet = new Set(entry.config.disabledTools ?? []);
|
|
1502
|
+
const tools = cachedTools.map((t) => ({
|
|
1503
|
+
name: t.name,
|
|
1504
|
+
description: t.description ?? "",
|
|
1505
|
+
inputSchema: t.inputSchema,
|
|
1506
|
+
enabled: !disabledSet.has(t.name),
|
|
1507
|
+
estimatedTokens: t.estimatedTokens
|
|
1508
|
+
}));
|
|
1509
|
+
const totalTokens = tools.filter((t) => t.enabled).reduce((sum, t) => sum + t.estimatedTokens, 0);
|
|
1510
|
+
entry.state = { name, config: entry.config, status: "error", tools, estimatedTokens: totalTokens, error: msg };
|
|
1511
|
+
} else {
|
|
1512
|
+
entry.state = { name, config: entry.config, status: "error", tools: [], estimatedTokens: 0, error: msg };
|
|
1513
|
+
}
|
|
1490
1514
|
this.onServersChanged?.();
|
|
1491
1515
|
}
|
|
1492
1516
|
}
|
|
@@ -1570,6 +1594,7 @@ var McpManager = class {
|
|
|
1570
1594
|
// src/server/lsp/server.ts
|
|
1571
1595
|
import { spawn } from "child_process";
|
|
1572
1596
|
import { extname } from "path";
|
|
1597
|
+
import { fileURLToPath } from "url";
|
|
1573
1598
|
import { createMessageConnection, StreamMessageReader, StreamMessageWriter } from "vscode-jsonrpc/node.js";
|
|
1574
1599
|
var LSP = {
|
|
1575
1600
|
initialize: "initialize",
|
|
@@ -1579,7 +1604,12 @@ var LSP = {
|
|
|
1579
1604
|
didOpen: "textDocument/didOpen",
|
|
1580
1605
|
didChange: "textDocument/didChange",
|
|
1581
1606
|
didClose: "textDocument/didClose",
|
|
1582
|
-
publishDiagnostics: "textDocument/publishDiagnostics"
|
|
1607
|
+
publishDiagnostics: "textDocument/publishDiagnostics",
|
|
1608
|
+
definition: "textDocument/definition",
|
|
1609
|
+
references: "textDocument/references",
|
|
1610
|
+
typeDefinition: "textDocument/typeDefinition",
|
|
1611
|
+
hover: "textDocument/hover",
|
|
1612
|
+
workspaceSymbol: "workspace/symbol"
|
|
1583
1613
|
};
|
|
1584
1614
|
var DiagnosticSeverity = {
|
|
1585
1615
|
Error: 1,
|
|
@@ -1587,7 +1617,38 @@ var DiagnosticSeverity = {
|
|
|
1587
1617
|
Information: 3,
|
|
1588
1618
|
Hint: 4
|
|
1589
1619
|
};
|
|
1620
|
+
function hoverInfo(contents, range) {
|
|
1621
|
+
return range ? { contents, range } : { contents };
|
|
1622
|
+
}
|
|
1590
1623
|
var DIAGNOSTIC_WAIT_MS = 2e3;
|
|
1624
|
+
var SYMBOL_KIND_NAMES = {
|
|
1625
|
+
1: "File",
|
|
1626
|
+
2: "Module",
|
|
1627
|
+
3: "Namespace",
|
|
1628
|
+
4: "Package",
|
|
1629
|
+
5: "Class",
|
|
1630
|
+
6: "Method",
|
|
1631
|
+
7: "Property",
|
|
1632
|
+
8: "Field",
|
|
1633
|
+
9: "Constructor",
|
|
1634
|
+
10: "Enum",
|
|
1635
|
+
11: "Interface",
|
|
1636
|
+
12: "Function",
|
|
1637
|
+
13: "Variable",
|
|
1638
|
+
14: "Constant",
|
|
1639
|
+
15: "String",
|
|
1640
|
+
16: "Number",
|
|
1641
|
+
17: "Boolean",
|
|
1642
|
+
18: "Array",
|
|
1643
|
+
19: "Object",
|
|
1644
|
+
20: "Key",
|
|
1645
|
+
21: "Null",
|
|
1646
|
+
22: "EnumMember",
|
|
1647
|
+
23: "Struct",
|
|
1648
|
+
24: "Event",
|
|
1649
|
+
25: "Operator",
|
|
1650
|
+
26: "TypeParameter"
|
|
1651
|
+
};
|
|
1591
1652
|
function mapSeverity(severity) {
|
|
1592
1653
|
switch (severity) {
|
|
1593
1654
|
case DiagnosticSeverity.Error:
|
|
@@ -1882,6 +1943,174 @@ var LspServer = class {
|
|
|
1882
1943
|
return () => this.diagnosticsCallbacks.delete(callback);
|
|
1883
1944
|
}
|
|
1884
1945
|
// ============================================================================
|
|
1946
|
+
// Code Navigation Queries
|
|
1947
|
+
// ============================================================================
|
|
1948
|
+
/**
|
|
1949
|
+
* Convert a file:// URI to a local path.
|
|
1950
|
+
* Handles Windows paths (file:///C:/...) and URL-encoded characters.
|
|
1951
|
+
*/
|
|
1952
|
+
uriToPath(uri) {
|
|
1953
|
+
try {
|
|
1954
|
+
return fileURLToPath(uri);
|
|
1955
|
+
} catch {
|
|
1956
|
+
return uri.replace(/^file:\/\//, "");
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Convert a local path to a file:// URI.
|
|
1961
|
+
*/
|
|
1962
|
+
pathToUri(path) {
|
|
1963
|
+
return `file://${path}`;
|
|
1964
|
+
}
|
|
1965
|
+
/**
|
|
1966
|
+
* Convert an LSP location to our internal CodeLocation.
|
|
1967
|
+
*/
|
|
1968
|
+
toCodeLocation(loc) {
|
|
1969
|
+
return {
|
|
1970
|
+
path: this.uriToPath(loc.uri),
|
|
1971
|
+
line: loc.range.start.line,
|
|
1972
|
+
character: loc.range.start.character,
|
|
1973
|
+
endLine: loc.range.end.line,
|
|
1974
|
+
endCharacter: loc.range.end.character
|
|
1975
|
+
};
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Ensure the server is running before making a query.
|
|
1979
|
+
*/
|
|
1980
|
+
requireConnection() {
|
|
1981
|
+
if (this.state !== "running" || !this.connection) {
|
|
1982
|
+
throw new Error("LSP server is not running");
|
|
1983
|
+
}
|
|
1984
|
+
return this.connection;
|
|
1985
|
+
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Normalize a single Location or Location[] response into CodeLocation[].
|
|
1988
|
+
*/
|
|
1989
|
+
normalizeLocations(response) {
|
|
1990
|
+
if (!response) return [];
|
|
1991
|
+
if (Array.isArray(response)) {
|
|
1992
|
+
return response.map((loc) => this.toCodeLocation(loc));
|
|
1993
|
+
}
|
|
1994
|
+
return [this.toCodeLocation(response)];
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Find the definition of a symbol at the given position.
|
|
1998
|
+
* Sends textDocument/definition request.
|
|
1999
|
+
*/
|
|
2000
|
+
async getDefinition(path, line, character) {
|
|
2001
|
+
try {
|
|
2002
|
+
const conn = this.requireConnection();
|
|
2003
|
+
const uri = this.pathToUri(path);
|
|
2004
|
+
const result = await conn.sendRequest(LSP.definition, {
|
|
2005
|
+
textDocument: { uri },
|
|
2006
|
+
position: { line, character }
|
|
2007
|
+
});
|
|
2008
|
+
return this.normalizeLocations(result);
|
|
2009
|
+
} catch {
|
|
2010
|
+
return [];
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Find all references to a symbol at the given position.
|
|
2015
|
+
* Sends textDocument/references request.
|
|
2016
|
+
*/
|
|
2017
|
+
async getReferences(path, line, character) {
|
|
2018
|
+
try {
|
|
2019
|
+
const conn = this.requireConnection();
|
|
2020
|
+
const uri = this.pathToUri(path);
|
|
2021
|
+
const result = await conn.sendRequest(LSP.references, {
|
|
2022
|
+
textDocument: { uri },
|
|
2023
|
+
position: { line, character },
|
|
2024
|
+
context: { includeDeclaration: true }
|
|
2025
|
+
});
|
|
2026
|
+
return this.normalizeLocations(result);
|
|
2027
|
+
} catch {
|
|
2028
|
+
return [];
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Find the type definition of a symbol at the given position.
|
|
2033
|
+
* Sends textDocument/typeDefinition request.
|
|
2034
|
+
*/
|
|
2035
|
+
async getTypeDefinition(path, line, character) {
|
|
2036
|
+
try {
|
|
2037
|
+
const conn = this.requireConnection();
|
|
2038
|
+
const uri = this.pathToUri(path);
|
|
2039
|
+
const result = await conn.sendRequest(LSP.typeDefinition, {
|
|
2040
|
+
textDocument: { uri },
|
|
2041
|
+
position: { line, character }
|
|
2042
|
+
});
|
|
2043
|
+
return this.normalizeLocations(result);
|
|
2044
|
+
} catch {
|
|
2045
|
+
return [];
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Search workspace for a symbol by name.
|
|
2050
|
+
* Sends workspace/symbol request.
|
|
2051
|
+
*/
|
|
2052
|
+
async findWorkspaceSymbol(query) {
|
|
2053
|
+
try {
|
|
2054
|
+
const conn = this.requireConnection();
|
|
2055
|
+
const result = await conn.sendRequest(LSP.workspaceSymbol, { query });
|
|
2056
|
+
if (!Array.isArray(result)) return [];
|
|
2057
|
+
return result.map((sym) => {
|
|
2058
|
+
const info = {
|
|
2059
|
+
name: sym.name,
|
|
2060
|
+
kind: this.symbolKindToString(sym.kind),
|
|
2061
|
+
location: this.toCodeLocation(sym.location)
|
|
2062
|
+
};
|
|
2063
|
+
if (sym.containerName) {
|
|
2064
|
+
info.containerName = sym.containerName;
|
|
2065
|
+
}
|
|
2066
|
+
return info;
|
|
2067
|
+
});
|
|
2068
|
+
} catch {
|
|
2069
|
+
return [];
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Get hover information for a symbol at the given position.
|
|
2074
|
+
* Sends textDocument/hover request.
|
|
2075
|
+
*/
|
|
2076
|
+
async getHoverInfo(path, line, character) {
|
|
2077
|
+
try {
|
|
2078
|
+
const conn = this.requireConnection();
|
|
2079
|
+
const uri = this.pathToUri(path);
|
|
2080
|
+
const result = await conn.sendRequest(LSP.hover, {
|
|
2081
|
+
textDocument: { uri },
|
|
2082
|
+
position: { line, character }
|
|
2083
|
+
});
|
|
2084
|
+
if (!result) return null;
|
|
2085
|
+
const contents = this.extractHoverContents(result.contents);
|
|
2086
|
+
const range = result.range ? {
|
|
2087
|
+
start: { line: result.range.start.line, character: result.range.start.character },
|
|
2088
|
+
end: { line: result.range.end.line, character: result.range.end.character }
|
|
2089
|
+
} : void 0;
|
|
2090
|
+
return hoverInfo(contents, range);
|
|
2091
|
+
} catch {
|
|
2092
|
+
return null;
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Extract a plain-text string from hover contents (which can be
|
|
2097
|
+
* MarkupContent, MarkedString, or an array of either).
|
|
2098
|
+
*/
|
|
2099
|
+
extractHoverContents(contents) {
|
|
2100
|
+
if (typeof contents === "string") return contents;
|
|
2101
|
+
if (Array.isArray(contents)) {
|
|
2102
|
+
return contents.map((c) => typeof c === "string" ? c : c.value).join("\n\n");
|
|
2103
|
+
}
|
|
2104
|
+
return contents.value;
|
|
2105
|
+
}
|
|
2106
|
+
/**
|
|
2107
|
+
* Convert LSP SymbolKind number to a human-readable string.
|
|
2108
|
+
* See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind
|
|
2109
|
+
*/
|
|
2110
|
+
symbolKindToString(kind) {
|
|
2111
|
+
return SYMBOL_KIND_NAMES[kind] ?? "Unknown";
|
|
2112
|
+
}
|
|
2113
|
+
// ============================================================================
|
|
1885
2114
|
// Status
|
|
1886
2115
|
// ============================================================================
|
|
1887
2116
|
isRunning() {
|
|
@@ -1893,13 +2122,22 @@ var LspServer = class {
|
|
|
1893
2122
|
getLanguage() {
|
|
1894
2123
|
return this.config.id;
|
|
1895
2124
|
}
|
|
2125
|
+
hasOpenDocuments() {
|
|
2126
|
+
return this.openDocuments.size > 0;
|
|
2127
|
+
}
|
|
2128
|
+
getExtensions() {
|
|
2129
|
+
return this.config.extensions;
|
|
2130
|
+
}
|
|
1896
2131
|
};
|
|
1897
2132
|
|
|
2133
|
+
// src/server/lsp/manager.ts
|
|
2134
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
2135
|
+
|
|
1898
2136
|
// src/server/utils/which.ts
|
|
1899
2137
|
import { access, constants } from "fs/promises";
|
|
1900
2138
|
import { join, dirname } from "path";
|
|
1901
|
-
import { fileURLToPath } from "url";
|
|
1902
|
-
var __dirname = dirname(
|
|
2139
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2140
|
+
var __dirname = dirname(fileURLToPath2(import.meta.url));
|
|
1903
2141
|
function getBundledBinPaths() {
|
|
1904
2142
|
const paths = [];
|
|
1905
2143
|
paths.push(join(process.cwd(), "node_modules", ".bin"));
|
|
@@ -1949,9 +2187,9 @@ async function which(command, workdir) {
|
|
|
1949
2187
|
// src/server/lsp/languages.ts
|
|
1950
2188
|
import { extname as extname2, basename } from "path";
|
|
1951
2189
|
import { readFileSync } from "fs";
|
|
1952
|
-
import { fileURLToPath as
|
|
2190
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1953
2191
|
import { dirname as dirname2, resolve } from "path";
|
|
1954
|
-
var __dirname2 = dirname2(
|
|
2192
|
+
var __dirname2 = dirname2(fileURLToPath3(import.meta.url));
|
|
1955
2193
|
var languagesJson = JSON.parse(readFileSync(resolve(__dirname2, "languages.json"), "utf-8"));
|
|
1956
2194
|
var LANGUAGES = languagesJson;
|
|
1957
2195
|
var extensionToLanguage = /* @__PURE__ */ new Map();
|
|
@@ -2127,6 +2365,85 @@ var LspManager = class {
|
|
|
2127
2365
|
}
|
|
2128
2366
|
return null;
|
|
2129
2367
|
}
|
|
2368
|
+
// ============================================================================
|
|
2369
|
+
// Code Navigation Queries
|
|
2370
|
+
// ============================================================================
|
|
2371
|
+
/**
|
|
2372
|
+
* Find the definition of a symbol at the given position.
|
|
2373
|
+
*/
|
|
2374
|
+
async getDefinition(path, line, character) {
|
|
2375
|
+
const server = await this.getServerForFile(path);
|
|
2376
|
+
if (!server) return [];
|
|
2377
|
+
return server.getDefinition(path, line, character);
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* Find all references to a symbol at the given position.
|
|
2381
|
+
*/
|
|
2382
|
+
async getReferences(path, line, character) {
|
|
2383
|
+
const server = await this.getServerForFile(path);
|
|
2384
|
+
if (!server) return [];
|
|
2385
|
+
return server.getReferences(path, line, character);
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Find the type definition of a symbol at the given position.
|
|
2389
|
+
*/
|
|
2390
|
+
async getTypeDefinition(path, line, character) {
|
|
2391
|
+
const server = await this.getServerForFile(path);
|
|
2392
|
+
if (!server) return [];
|
|
2393
|
+
return server.getTypeDefinition(path, line, character);
|
|
2394
|
+
}
|
|
2395
|
+
/**
|
|
2396
|
+
* Search workspace for a symbol by name.
|
|
2397
|
+
* Uses the first available server that supports workspace/symbol.
|
|
2398
|
+
*/
|
|
2399
|
+
async findWorkspaceSymbol(query) {
|
|
2400
|
+
for (const server of this.servers.values()) {
|
|
2401
|
+
if (server.isRunning()) {
|
|
2402
|
+
const results = await server.findWorkspaceSymbol(query);
|
|
2403
|
+
if (results.length > 0) return results;
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
return [];
|
|
2407
|
+
}
|
|
2408
|
+
/**
|
|
2409
|
+
* Open a file to seed the LSP server, then search for a workspace symbol.
|
|
2410
|
+
*
|
|
2411
|
+
* Some LSP servers (e.g., typescript-language-server) only index projects
|
|
2412
|
+
* after a file is opened via textDocument/didOpen. This method:
|
|
2413
|
+
* 1. Detects the language from the file and starts the appropriate server
|
|
2414
|
+
* 2. Reads the file from disk and sends didOpen to trigger project indexing
|
|
2415
|
+
* 3. Sends a hover request to flush the notification queue (JSON-RPC processes
|
|
2416
|
+
* requests sequentially, so the server must finish didOpen before responding)
|
|
2417
|
+
* 4. Queries workspace/symbol for the given symbol
|
|
2418
|
+
*/
|
|
2419
|
+
async seedAndFindWorkspaceSymbol(query, filePath) {
|
|
2420
|
+
const server = await this.getServerForFile(filePath);
|
|
2421
|
+
if (!server?.isRunning()) return [];
|
|
2422
|
+
try {
|
|
2423
|
+
const content = readFileSync2(filePath, "utf-8");
|
|
2424
|
+
await server.didOpen(filePath, content);
|
|
2425
|
+
await server.getHoverInfo(filePath, 0, 0);
|
|
2426
|
+
} catch (error) {
|
|
2427
|
+
logger.warn("Failed to seed LSP server", {
|
|
2428
|
+
path: filePath,
|
|
2429
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2430
|
+
sessionId: this.sessionId
|
|
2431
|
+
});
|
|
2432
|
+
return [];
|
|
2433
|
+
}
|
|
2434
|
+
return server.findWorkspaceSymbol(query);
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Get hover information for a symbol at the given position.
|
|
2438
|
+
*/
|
|
2439
|
+
async getHoverInfo(path, line, character) {
|
|
2440
|
+
const server = await this.getServerForFile(path);
|
|
2441
|
+
if (!server) return null;
|
|
2442
|
+
return server.getHoverInfo(path, line, character);
|
|
2443
|
+
}
|
|
2444
|
+
// ============================================================================
|
|
2445
|
+
// Shutdown
|
|
2446
|
+
// ============================================================================
|
|
2130
2447
|
/**
|
|
2131
2448
|
* Shutdown all LSP servers.
|
|
2132
2449
|
*/
|
|
@@ -3081,9 +3398,9 @@ function createSkillRoutes(configDir, projectDir) {
|
|
|
3081
3398
|
// src/server/commands/registry.ts
|
|
3082
3399
|
import { writeFile, mkdir, unlink } from "fs/promises";
|
|
3083
3400
|
import { join as join3, dirname as dirname3 } from "path";
|
|
3084
|
-
import { fileURLToPath as
|
|
3401
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
3085
3402
|
import matter from "gray-matter";
|
|
3086
|
-
var __bundleDir = dirname3(
|
|
3403
|
+
var __bundleDir = dirname3(fileURLToPath4(import.meta.url));
|
|
3087
3404
|
var DEFAULTS_DIR = join3(__bundleDir, "defaults");
|
|
3088
3405
|
var DEFAULTS_DIR_ALT = join3(__bundleDir, "command-defaults");
|
|
3089
3406
|
var COMMAND_EXTENSION = ".command.md";
|
|
@@ -3520,7 +3837,7 @@ import { Router as Router7 } from "express";
|
|
|
3520
3837
|
import { spawn as spawn2 } from "child_process";
|
|
3521
3838
|
|
|
3522
3839
|
// src/constants.ts
|
|
3523
|
-
var VERSION = "2.0.
|
|
3840
|
+
var VERSION = "2.0.39";
|
|
3524
3841
|
|
|
3525
3842
|
// src/server/routes/auto-update.ts
|
|
3526
3843
|
var updateInProgress = false;
|
|
@@ -3635,7 +3952,7 @@ function createAutoUpdateRoutes(options = {}) {
|
|
|
3635
3952
|
}
|
|
3636
3953
|
|
|
3637
3954
|
// src/server/index.ts
|
|
3638
|
-
var __dirname3 = dirname5(
|
|
3955
|
+
var __dirname3 = dirname5(fileURLToPath5(import.meta.url));
|
|
3639
3956
|
async function createServerHandle(config4) {
|
|
3640
3957
|
setRuntimeConfig(config4);
|
|
3641
3958
|
setLogLevel(config4.logging?.level ?? void 0, config4.mode);
|
|
@@ -3684,7 +4001,24 @@ async function createServerHandle(config4) {
|
|
|
3684
4001
|
(err) => logger.error("LLM initialization failed", { error: err instanceof Error ? err.message : String(err) })
|
|
3685
4002
|
);
|
|
3686
4003
|
const toolRegistry = createToolRegistry();
|
|
3687
|
-
const mcpManager = new McpManager(
|
|
4004
|
+
const mcpManager = new McpManager({
|
|
4005
|
+
onToolsDiscovered: async (name, tools) => {
|
|
4006
|
+
try {
|
|
4007
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-XOXIIBUY.js");
|
|
4008
|
+
const mode = config4.mode ?? "production";
|
|
4009
|
+
const globalConfig = await loadGlobalConfig(mode);
|
|
4010
|
+
const mcpServers2 = {
|
|
4011
|
+
...globalConfig.mcpServers ?? {}
|
|
4012
|
+
};
|
|
4013
|
+
if (mcpServers2[name]) {
|
|
4014
|
+
mcpServers2[name] = { ...mcpServers2[name], cachedTools: tools };
|
|
4015
|
+
await saveGlobalConfig(mode, { ...globalConfig, mcpServers: mcpServers2 });
|
|
4016
|
+
}
|
|
4017
|
+
} catch (err) {
|
|
4018
|
+
logger.warn("Failed to persist MCP tool cache", { name, error: String(err) });
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
});
|
|
3688
4022
|
setMcpManagerForTools(mcpManager);
|
|
3689
4023
|
setMcpConfigMode(config4.mode ?? "production");
|
|
3690
4024
|
const mcpServers = config4.mcpServers ?? {};
|
|
@@ -3700,7 +4034,7 @@ async function createServerHandle(config4) {
|
|
|
3700
4034
|
setMcpTools(mcpTools);
|
|
3701
4035
|
logger.info("MCP tools registered", { count: mcpTools.length });
|
|
3702
4036
|
}
|
|
3703
|
-
const { signalMcpReady } = await import("./server-
|
|
4037
|
+
const { signalMcpReady } = await import("./server-YPCAJFOC.js");
|
|
3704
4038
|
signalMcpReady();
|
|
3705
4039
|
});
|
|
3706
4040
|
const app = express();
|
|
@@ -3893,7 +4227,7 @@ async function createServerHandle(config4) {
|
|
|
3893
4227
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
3894
4228
|
const { getEventStore: getEventStore2 } = await import("./events-KZZPCW2Q.js");
|
|
3895
4229
|
const { buildMessagesFromStoredEvents } = await import("./folding-ENYH4LMG.js");
|
|
3896
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
4230
|
+
const { getPendingQuestionsForSession } = await import("./tools-ZYUJUI4R.js");
|
|
3897
4231
|
const session = sessionManager.getSession(req.params.id);
|
|
3898
4232
|
if (!session) {
|
|
3899
4233
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -3938,7 +4272,7 @@ async function createServerHandle(config4) {
|
|
|
3938
4272
|
const provider = providerManager.getProviders().find((p) => p.id === providerId);
|
|
3939
4273
|
const resolvedModel = model ?? provider?.models?.[0]?.id ?? "auto";
|
|
3940
4274
|
sessionManager.setSessionProvider(sessionId, providerId, resolvedModel);
|
|
3941
|
-
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-
|
|
4275
|
+
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-XOXIIBUY.js");
|
|
3942
4276
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
3943
4277
|
const updatedConfig = setDefaultModelSelection(globalConfig, providerId, resolvedModel);
|
|
3944
4278
|
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
@@ -4044,7 +4378,7 @@ async function createServerHandle(config4) {
|
|
|
4044
4378
|
if (!callId || approved === void 0) {
|
|
4045
4379
|
return res.status(400).json({ error: "callId and approved are required" });
|
|
4046
4380
|
}
|
|
4047
|
-
const { providePathConfirmation } = await import("./tools-
|
|
4381
|
+
const { providePathConfirmation } = await import("./tools-ZYUJUI4R.js");
|
|
4048
4382
|
const result = providePathConfirmation(callId, approved, alwaysAllow);
|
|
4049
4383
|
if (!result.found) {
|
|
4050
4384
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
@@ -4052,7 +4386,7 @@ async function createServerHandle(config4) {
|
|
|
4052
4386
|
const { getEventStore: getEventStore2 } = await import("./events-KZZPCW2Q.js");
|
|
4053
4387
|
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-ENYH4LMG.js");
|
|
4054
4388
|
const { createSessionStateMessage } = await import("./protocol-BKNLAEPJ.js");
|
|
4055
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
4389
|
+
const { getPendingQuestionsForSession } = await import("./tools-ZYUJUI4R.js");
|
|
4056
4390
|
const eventStore = getEventStore2();
|
|
4057
4391
|
const events = eventStore.getEvents(sessionId);
|
|
4058
4392
|
const messages = buildMessagesFromStoredEvents(events);
|
|
@@ -4073,7 +4407,7 @@ async function createServerHandle(config4) {
|
|
|
4073
4407
|
if (!skip && typeof answer !== "string") {
|
|
4074
4408
|
return res.status(400).json({ error: "answer is required when not skipping" });
|
|
4075
4409
|
}
|
|
4076
|
-
const { provideAnswer } = await import("./tools-
|
|
4410
|
+
const { provideAnswer } = await import("./tools-ZYUJUI4R.js");
|
|
4077
4411
|
const found = provideAnswer(callId, answer ?? "", skip ?? false);
|
|
4078
4412
|
if (!found) {
|
|
4079
4413
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -4109,8 +4443,8 @@ async function createServerHandle(config4) {
|
|
|
4109
4443
|
if (!session) {
|
|
4110
4444
|
return res.status(404).json({ error: "Session not found" });
|
|
4111
4445
|
}
|
|
4112
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
4113
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
4446
|
+
const { stopSessionExecution } = await import("./chat-handler-4YZGM7V7.js");
|
|
4447
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-ZYUJUI4R.js");
|
|
4114
4448
|
const queuedMessages = sessionManager.getQueueState(sessionId);
|
|
4115
4449
|
sessionManager.clearMessageQueue(sessionId);
|
|
4116
4450
|
stopSessionExecution(sessionId, sessionManager);
|
|
@@ -4221,7 +4555,7 @@ async function createServerHandle(config4) {
|
|
|
4221
4555
|
let visionFallback;
|
|
4222
4556
|
let globalWorkdir;
|
|
4223
4557
|
try {
|
|
4224
|
-
const { loadGlobalConfig, getVisionFallback } = await import("./config-
|
|
4558
|
+
const { loadGlobalConfig, getVisionFallback } = await import("./config-XOXIIBUY.js");
|
|
4225
4559
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4226
4560
|
const fallback = getVisionFallback(globalConfig);
|
|
4227
4561
|
if (fallback) {
|
|
@@ -4434,7 +4768,7 @@ async function createServerHandle(config4) {
|
|
|
4434
4768
|
return res.status(400).json({ error: "name, url, and backend are required" });
|
|
4435
4769
|
}
|
|
4436
4770
|
try {
|
|
4437
|
-
const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-
|
|
4771
|
+
const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-XOXIIBUY.js");
|
|
4438
4772
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4439
4773
|
const providerBackend = backend;
|
|
4440
4774
|
const providerModels = modelConfigs?.length ? buildModelConfigs(modelConfigs) : model ? [{ id: model, contextWindow: 2e5, source: "user" }] : [];
|
|
@@ -4472,7 +4806,7 @@ async function createServerHandle(config4) {
|
|
|
4472
4806
|
app.post("/api/init/config", async (req, res) => {
|
|
4473
4807
|
const { workdir, visionFallback } = req.body;
|
|
4474
4808
|
try {
|
|
4475
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
4809
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-XOXIIBUY.js");
|
|
4476
4810
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4477
4811
|
const updatedConfig = {
|
|
4478
4812
|
...globalConfig,
|
|
@@ -4500,7 +4834,7 @@ async function createServerHandle(config4) {
|
|
|
4500
4834
|
});
|
|
4501
4835
|
app.delete("/api/providers/:id", async (req, res) => {
|
|
4502
4836
|
const { id } = req.params;
|
|
4503
|
-
const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-
|
|
4837
|
+
const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-XOXIIBUY.js");
|
|
4504
4838
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4505
4839
|
const updatedConfig = removeProvider(globalConfig, id);
|
|
4506
4840
|
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
@@ -4512,7 +4846,7 @@ async function createServerHandle(config4) {
|
|
|
4512
4846
|
const { id } = req.params;
|
|
4513
4847
|
const { isLocal } = req.body;
|
|
4514
4848
|
try {
|
|
4515
|
-
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-
|
|
4849
|
+
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-XOXIIBUY.js");
|
|
4516
4850
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4517
4851
|
const provider = globalConfig.providers.find((p) => p.id === id);
|
|
4518
4852
|
if (!provider) {
|
|
@@ -4541,7 +4875,7 @@ async function createServerHandle(config4) {
|
|
|
4541
4875
|
models: modelConfigs
|
|
4542
4876
|
} = req.body;
|
|
4543
4877
|
try {
|
|
4544
|
-
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-
|
|
4878
|
+
const { loadGlobalConfig, saveGlobalConfig, updateProvider } = await import("./config-XOXIIBUY.js");
|
|
4545
4879
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4546
4880
|
const provider = globalConfig.providers.find((p) => p.id === id);
|
|
4547
4881
|
if (!provider) {
|
|
@@ -4579,7 +4913,7 @@ async function createServerHandle(config4) {
|
|
|
4579
4913
|
return res.status(400).json({ error: result.error });
|
|
4580
4914
|
}
|
|
4581
4915
|
const llmClient = getLLMClient();
|
|
4582
|
-
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-
|
|
4916
|
+
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-XOXIIBUY.js");
|
|
4583
4917
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4584
4918
|
const updatedConfig = setDefaultModelSelection(globalConfig, id, llmClient.getModel());
|
|
4585
4919
|
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
@@ -4606,7 +4940,7 @@ async function createServerHandle(config4) {
|
|
|
4606
4940
|
});
|
|
4607
4941
|
async function rebuildMcpTools() {
|
|
4608
4942
|
const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-B7QP6NLA.js");
|
|
4609
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
4943
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-ZYUJUI4R.js");
|
|
4610
4944
|
const mcpTools = createMcpTools2(mcpManager);
|
|
4611
4945
|
setMcpTools2(mcpTools);
|
|
4612
4946
|
}
|
|
@@ -4668,7 +5002,7 @@ async function createServerHandle(config4) {
|
|
|
4668
5002
|
};
|
|
4669
5003
|
await mcpManager.addServer(name, serverCfg);
|
|
4670
5004
|
const server = mcpManager.getServer(name);
|
|
4671
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
5005
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-XOXIIBUY.js");
|
|
4672
5006
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4673
5007
|
const updatedMcpServers = { ...globalConfig.mcpServers ?? {}, [name]: serverCfg };
|
|
4674
5008
|
await saveGlobalConfig(config4.mode ?? "production", {
|
|
@@ -4694,7 +5028,7 @@ async function createServerHandle(config4) {
|
|
|
4694
5028
|
return res.status(404).json({ error: `MCP server '${name}' not found` });
|
|
4695
5029
|
}
|
|
4696
5030
|
mcpManager.removeServer(name);
|
|
4697
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
5031
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-XOXIIBUY.js");
|
|
4698
5032
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4699
5033
|
const updatedMcpServers = { ...globalConfig.mcpServers ?? {} };
|
|
4700
5034
|
delete updatedMcpServers[name];
|
|
@@ -4719,7 +5053,7 @@ async function createServerHandle(config4) {
|
|
|
4719
5053
|
await mcpManager.setToolEnabled(name, toolName, enabled);
|
|
4720
5054
|
const server = mcpManager.getServer(name);
|
|
4721
5055
|
if (server) {
|
|
4722
|
-
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-
|
|
5056
|
+
const { loadGlobalConfig, saveGlobalConfig } = await import("./config-XOXIIBUY.js");
|
|
4723
5057
|
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4724
5058
|
const mcpServers2 = { ...globalConfig.mcpServers ?? {} };
|
|
4725
5059
|
const serverCfg = mcpServers2[name];
|
|
@@ -4919,7 +5253,7 @@ async function createServerHandle(config4) {
|
|
|
4919
5253
|
const state = sessionManager.getContextState(sessionId);
|
|
4920
5254
|
wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
|
|
4921
5255
|
});
|
|
4922
|
-
const { QueueProcessor } = await import("./processor-
|
|
5256
|
+
const { QueueProcessor } = await import("./processor-FB2I73B3.js");
|
|
4923
5257
|
const queueProcessor = new QueueProcessor({
|
|
4924
5258
|
sessionManager,
|
|
4925
5259
|
providerManager,
|
|
@@ -4994,4 +5328,4 @@ export {
|
|
|
4994
5328
|
createServerHandle,
|
|
4995
5329
|
createServer
|
|
4996
5330
|
};
|
|
4997
|
-
//# sourceMappingURL=chunk-
|
|
5331
|
+
//# sourceMappingURL=chunk-BMRC6TQ5.js.map
|
|
@@ -62,6 +62,12 @@ var visionFallbackSchema = z.object({
|
|
|
62
62
|
timeout: z.number().default(120),
|
|
63
63
|
backend: z.enum(["ollama", "openai"]).default("ollama")
|
|
64
64
|
});
|
|
65
|
+
var cachedToolSchema = z.object({
|
|
66
|
+
name: z.string(),
|
|
67
|
+
description: z.string().optional(),
|
|
68
|
+
inputSchema: z.record(z.string(), z.unknown()),
|
|
69
|
+
estimatedTokens: z.number()
|
|
70
|
+
});
|
|
65
71
|
var mcpServerSchema = z.object({
|
|
66
72
|
transport: z.enum(["stdio", "http"]).default("stdio"),
|
|
67
73
|
command: z.string().optional(),
|
|
@@ -69,7 +75,8 @@ var mcpServerSchema = z.object({
|
|
|
69
75
|
env: z.record(z.string(), z.string()).optional(),
|
|
70
76
|
url: z.string().optional(),
|
|
71
77
|
headers: z.record(z.string(), z.string()).optional(),
|
|
72
|
-
disabledTools: z.array(z.string()).optional()
|
|
78
|
+
disabledTools: z.array(z.string()).optional(),
|
|
79
|
+
cachedTools: z.array(cachedToolSchema).optional()
|
|
73
80
|
});
|
|
74
81
|
var defaultVisionFallback = {
|
|
75
82
|
enabled: false,
|
|
@@ -395,4 +402,4 @@ export {
|
|
|
395
402
|
activateProvider,
|
|
396
403
|
mergeConfigs
|
|
397
404
|
};
|
|
398
|
-
//# sourceMappingURL=chunk-
|
|
405
|
+
//# sourceMappingURL=chunk-EZ3BPIUV.js.map
|