@aexol/spectral 0.2.5 → 0.2.7
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.js +10 -47
- package/dist/mcp/agent-dir.js +18 -0
- package/dist/mcp/app-bridge.bundle.js +67 -0
- package/dist/mcp/commands.js +263 -0
- package/dist/mcp/config.js +532 -0
- package/dist/mcp/consent-manager.js +59 -0
- package/dist/mcp/direct-tools.js +354 -0
- package/dist/mcp/errors.js +165 -0
- package/dist/mcp/glimpse-ui.js +67 -0
- package/dist/mcp/host-html-template.js +412 -0
- package/dist/mcp/index.js +291 -0
- package/dist/mcp/init.js +280 -0
- package/dist/mcp/lifecycle.js +79 -0
- package/dist/mcp/logger.js +130 -0
- package/dist/mcp/mcp-auth-flow.js +283 -0
- package/dist/mcp/mcp-auth.js +226 -0
- package/dist/mcp/mcp-callback-server.js +225 -0
- package/dist/mcp/mcp-oauth-provider.js +243 -0
- package/dist/mcp/mcp-panel.js +646 -0
- package/dist/mcp/mcp-setup-panel.js +485 -0
- package/dist/mcp/metadata-cache.js +158 -0
- package/dist/mcp/npx-resolver.js +385 -0
- package/dist/mcp/oauth-handler.js +54 -0
- package/dist/mcp/onboarding-state.js +56 -0
- package/dist/mcp/proxy-modes.js +714 -0
- package/dist/mcp/resource-tools.js +14 -0
- package/dist/mcp/sampling-handler.js +206 -0
- package/dist/mcp/server-manager.js +301 -0
- package/dist/mcp/state.js +1 -0
- package/dist/mcp/tool-metadata.js +128 -0
- package/dist/mcp/tool-registrar.js +43 -0
- package/dist/mcp/types.js +93 -0
- package/dist/mcp/ui-resource-handler.js +113 -0
- package/dist/mcp/ui-server.js +522 -0
- package/dist/mcp/ui-session.js +306 -0
- package/dist/mcp/ui-stream-types.js +58 -0
- package/dist/mcp/utils.js +104 -0
- package/dist/mcp/vitest.config.js +13 -0
- package/dist/server/pi-bridge.js +9 -30
- package/package.json +6 -3
package/dist/cli.js
CHANGED
|
@@ -79,40 +79,9 @@ function resolvePiBin() {
|
|
|
79
79
|
function resolveAexolExtensionPath() {
|
|
80
80
|
return resolve(__dirname, "extensions", "aexol-mcp.js");
|
|
81
81
|
}
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* pi-mcp-adapter declares its extension entry via `"pi": { "extensions":
|
|
86
|
-
* ["./index.ts"] }` — it does NOT export a `main` or `exports` field. We
|
|
87
|
-
* therefore walk up node_modules ourselves, locate the package directory, and
|
|
88
|
-
* return the absolute path to `index.ts`.
|
|
89
|
-
*
|
|
90
|
-
* Returns null if the package is not installed (graceful degradation).
|
|
91
|
-
*/
|
|
92
|
-
function resolveMcpAdapterPath() {
|
|
93
|
-
const rel = "node_modules/pi-mcp-adapter/package.json";
|
|
94
|
-
let dir = __dirname;
|
|
95
|
-
const root = "/";
|
|
96
|
-
for (let i = 0; i < 20; i++) {
|
|
97
|
-
const pkgPath = resolve(dir, rel);
|
|
98
|
-
try {
|
|
99
|
-
const raw = readFileSync(pkgPath, "utf8");
|
|
100
|
-
const pkg = JSON.parse(raw);
|
|
101
|
-
const extRel = pkg.pi?.extensions?.[0];
|
|
102
|
-
if (extRel) {
|
|
103
|
-
return resolve(dirname(pkgPath), extRel);
|
|
104
|
-
}
|
|
105
|
-
break; // package found but no pi.extensions — shouldn't happen
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
// package.json not readable at this level, keep walking up
|
|
109
|
-
}
|
|
110
|
-
const parent = dirname(dir);
|
|
111
|
-
if (parent === dir || parent === root)
|
|
112
|
-
break;
|
|
113
|
-
dir = parent;
|
|
114
|
-
}
|
|
115
|
-
return null;
|
|
82
|
+
/** Absolute path to the bundled pi-mcp-adapter extension, sitting next to this file in dist/. */
|
|
83
|
+
function resolveMcpExtensionPath() {
|
|
84
|
+
return resolve(__dirname, "mcp", "index.js");
|
|
116
85
|
}
|
|
117
86
|
// ---- Branded helpers ---------------------------------------------------------
|
|
118
87
|
function printVersion() {
|
|
@@ -237,20 +206,14 @@ async function main() {
|
|
|
237
206
|
process.stderr.write(`spectral: bundled Aexol MCP extension not found at ${aexolExtPath}. This is a packaging bug.\n`);
|
|
238
207
|
process.exit(1);
|
|
239
208
|
}
|
|
240
|
-
//
|
|
241
|
-
//
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
process.
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
process.stderr.write("[spectral] pi-mcp-adapter not found; standard MCP servers disabled.\n");
|
|
249
|
-
}
|
|
250
|
-
const extFlags = ["--extension", aexolExtPath];
|
|
251
|
-
if (mcpAdapterPath) {
|
|
252
|
-
extFlags.push("--extension", mcpAdapterPath);
|
|
209
|
+
// Bundled pi-mcp-adapter extension for standard MCP server support
|
|
210
|
+
// (stdio + SSE/HTTP transports, lazy loading, OAuth, /mcp panel).
|
|
211
|
+
const mcpExtPath = resolveMcpExtensionPath();
|
|
212
|
+
if (!existsSync(mcpExtPath)) {
|
|
213
|
+
process.stderr.write(`spectral: bundled MCP extension not found at ${mcpExtPath}. This is a packaging bug.\n`);
|
|
214
|
+
process.exit(1);
|
|
253
215
|
}
|
|
216
|
+
const extFlags = ["--extension", aexolExtPath, "--extension", mcpExtPath];
|
|
254
217
|
const finalArgs = [...extFlags, ...args];
|
|
255
218
|
delegateToPi(finalArgs);
|
|
256
219
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
export function getAgentDir() {
|
|
4
|
+
const configured = process.env.PI_CODING_AGENT_DIR?.trim();
|
|
5
|
+
if (!configured) {
|
|
6
|
+
return join(homedir(), ".pi", "agent");
|
|
7
|
+
}
|
|
8
|
+
if (configured === "~") {
|
|
9
|
+
return homedir();
|
|
10
|
+
}
|
|
11
|
+
if (configured.startsWith("~/")) {
|
|
12
|
+
return resolve(homedir(), configured.slice(2));
|
|
13
|
+
}
|
|
14
|
+
return resolve(configured);
|
|
15
|
+
}
|
|
16
|
+
export function getAgentPath(...segments) {
|
|
17
|
+
return join(getAgentDir(), ...segments);
|
|
18
|
+
}
|