scream-code 0.15.7 → 0.15.8
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 +1 -1
- package/dist/{app-BWXezRMl.mjs → app-Bbg_nJTR.mjs} +92 -32
- package/dist/{dispatch-BJ6GyqMS.mjs → dispatch-BaAsj0v5.mjs} +187 -68
- package/dist/{dispatch-CPK1Lkxu.mjs → dispatch-CEK-syAX.mjs} +1 -1
- package/dist/main.mjs +1 -1
- package/dist/public/assets/{index-Bvn-ixUo.js → index-DjlCHEg8.js} +19 -19
- package/dist/public/assets/index-DjlCHEg8.js.map +1 -0
- package/dist/public/index.html +1 -1
- package/dist/{text-input-dialog-MAm2GHmm.mjs → text-input-dialog-BBSjCM5z.mjs} +1 -1
- package/dist/{text-input-dialog-CnQM0DYj.mjs → text-input-dialog-C5pDKZ-c.mjs} +20 -16
- package/package.json +1 -1
- package/dist/public/assets/index-Bvn-ixUo.js.map +0 -1
|
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
|
|
|
6
6
|
import { i as __require, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-D90kvbyJ.mjs";
|
|
7
7
|
import { C as join$1, D as resolve$1, E as relative$1, S as isAbsolute$1, T as parse$7, a as isSupportedFile, b as basename$1, i as ingestFile, r as ingestDirectory, t as multiSearch, w as normalize$1, x as dirname$2, y as KnowledgeStore } from "./src-tDEINaMV.mjs";
|
|
8
8
|
import { t as require_base64_js } from "./base64-js-DzVmk6Nb.mjs";
|
|
9
|
-
import { a as setLocale, i as getLocale, n as assertScreamHostIdentity, o as t, r as createScreamDefaultHeaders, t as TextInputDialogComponent } from "./text-input-dialog-
|
|
9
|
+
import { a as setLocale, i as getLocale, n as assertScreamHostIdentity, o as t, r as createScreamDefaultHeaders, t as TextInputDialogComponent } from "./text-input-dialog-C5pDKZ-c.mjs";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
import { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
|
|
12
12
|
import * as fs$1 from "node:fs/promises";
|
|
@@ -67201,7 +67201,14 @@ const McpServerCommonFields = {
|
|
|
67201
67201
|
startupTimeoutMs: z.number().int().min(1).optional(),
|
|
67202
67202
|
toolTimeoutMs: z.number().int().min(1).optional(),
|
|
67203
67203
|
enabledTools: z.array(z.string()).optional(),
|
|
67204
|
-
disabledTools: z.array(z.string()).optional()
|
|
67204
|
+
disabledTools: z.array(z.string()).optional(),
|
|
67205
|
+
/**
|
|
67206
|
+
* Open-vocabulary capabilities this server provides (e.g. `["browser"]`).
|
|
67207
|
+
* Semantics: absent = auto-detect via built-in fingerprints;
|
|
67208
|
+
* `[]` = explicitly opted out of fingerprinting; non-empty = explicit
|
|
67209
|
+
* declaration (highest priority). See `mcp/capabilities.ts`.
|
|
67210
|
+
*/
|
|
67211
|
+
capabilities: z.array(z.string().min(1)).optional()
|
|
67205
67212
|
};
|
|
67206
67213
|
const McpServerStdioConfigSchema = z.object({
|
|
67207
67214
|
transport: z.literal("stdio"),
|
|
@@ -83173,71 +83180,83 @@ function formatElapsed$1(ms) {
|
|
|
83173
83180
|
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
83174
83181
|
return `${Math.floor(totalSeconds / 60)}m${(totalSeconds % 60).toString().padStart(2, "0")}s`;
|
|
83175
83182
|
}
|
|
83176
|
-
|
|
83177
|
-
|
|
83178
|
-
|
|
83183
|
+
const MCP_CAPABILITY_GUIDES = [{
|
|
83184
|
+
capability: "browser",
|
|
83185
|
+
variant: "mcp_browser_skill",
|
|
83186
|
+
text: `\
|
|
83179
83187
|
## Browser Automation (chrome-devtools-mcp)
|
|
83180
83188
|
|
|
83181
|
-
|
|
83182
|
-
|
|
83183
|
-
|
|
83184
|
-
|
|
83185
|
-
### Navigation & Pages
|
|
83186
|
-
- \`navigate_page\` — Go to a URL
|
|
83187
|
-
- \`new_page\` / \`close_page\` / \`list_pages\` / \`select_page\` — Manage tabs
|
|
83188
|
-
|
|
83189
|
-
### Inspecting the Page
|
|
83190
|
-
- \`take_snapshot\` — Full ARIA accessibility tree (best for understanding page structure)
|
|
83191
|
-
- \`take_screenshot\` — Capture visual screenshot (element, viewport, or full page)
|
|
83192
|
-
- \`evaluate_script\` — Execute arbitrary JS in the page (e.g. \`document.title\`, \`window.scrollBy()\`)
|
|
83193
|
-
- \`list_console_messages\` / \`get_console_message\` — Read console logs and errors
|
|
83194
|
-
- \`list_network_requests\` / \`get_network_request\` — Inspect HTTP traffic
|
|
83195
|
-
|
|
83196
|
-
### Interacting with the Page
|
|
83197
|
-
- \`click\` / \`hover\` / \`press_key\` / \`type_text\` / \`fill\` / \`fill_form\` — Interact with elements
|
|
83198
|
-
- \`drag\` — Drag and drop elements
|
|
83199
|
-
- \`wait_for\` — Wait for text/element to appear before acting
|
|
83200
|
-
- \`upload_file\` — Attach local files to file inputs
|
|
83201
|
-
- \`handle_dialog\` — Accept or dismiss browser dialogs (alert/confirm/prompt)
|
|
83189
|
+
A Chrome DevTools MCP server is connected (\`mcp__chrome_devtools__*\` tools).
|
|
83190
|
+
It drives a live Chrome instance for testing, debugging and performance
|
|
83191
|
+
analysis. Every page-scoped tool needs its \`pageId\`; use \`list_pages\` to
|
|
83192
|
+
see which pages exist.
|
|
83202
83193
|
|
|
83203
|
-
###
|
|
83204
|
-
- \`
|
|
83205
|
-
|
|
83206
|
-
-
|
|
83194
|
+
### Golden rules
|
|
83195
|
+
- \`take_snapshot\` (ARIA tree) before any interaction — \`click\` / \`fill\` /
|
|
83196
|
+
\`hover\` target the \`uid\`s it returns.
|
|
83197
|
+
- **Snapshot uids go stale after navigation or major DOM changes.** Always
|
|
83198
|
+
\`take_snapshot\` again right before acting; reusing uids from the previous
|
|
83199
|
+
page is the most common failure.
|
|
83200
|
+
- Screenshots: pass \`filePath\` to save to disk, then read the file only if
|
|
83201
|
+
you must inspect it — inline images burn context. The server already
|
|
83202
|
+
downscales and compresses screenshots for you.
|
|
83203
|
+
- After a navigation, verify page health with \`list_console_messages\`
|
|
83204
|
+
(JS errors) and \`list_network_requests\` (failed loads).
|
|
83205
|
+
- Close pages you no longer need with \`close_page\`.
|
|
83207
83206
|
|
|
83208
|
-
###
|
|
83209
|
-
|
|
83210
|
-
|
|
83211
|
-
|
|
83212
|
-
|
|
83213
|
-
|
|
83207
|
+
### Task → tool map
|
|
83208
|
+
- Open / manage pages: \`navigate_page\`, \`new_page\`, \`list_pages\`,
|
|
83209
|
+
\`select_page\`, \`close_page\`, \`resize_page\`
|
|
83210
|
+
- Read state: \`take_snapshot\`, \`evaluate_script\` (arbitrary in-page JS),
|
|
83211
|
+
\`take_screenshot\`, \`wait_for\`
|
|
83212
|
+
- Interact: \`click\`, \`fill\`, \`fill_form\` (batch — prefer over many fills),
|
|
83213
|
+
\`type_text\`, \`press_key\`, \`hover\`, \`drag\`, \`upload_file\`,
|
|
83214
|
+
\`handle_dialog\`
|
|
83215
|
+
- Debug: \`list_console_messages\`, \`get_console_message\`,
|
|
83216
|
+
\`list_network_requests\`, \`get_network_request\`
|
|
83217
|
+
- Performance & memory: \`performance_start_trace\`, \`performance_stop_trace\`,
|
|
83218
|
+
\`performance_analyze_insight\`, \`lighthouse_audit\`, \`take_heapsnapshot\`,
|
|
83219
|
+
\`emulate\` (network/CPU throttling, dark mode, mobile viewports)
|
|
83214
83220
|
|
|
83215
|
-
###
|
|
83216
|
-
|
|
83217
|
-
|
|
83218
|
-
|
|
83219
|
-
|
|
83220
|
-
|
|
83221
|
-
|
|
83221
|
+
### Local dev preview workflow
|
|
83222
|
+
Use this whenever a local dev server backs a UI change (vite/next/webpack…):
|
|
83223
|
+
1. Start the server in the background (e.g. \`pnpm dev\`) and note its port.
|
|
83224
|
+
2. \`new_page\` → \`navigate_page\` to \`http://localhost:<port>\`.
|
|
83225
|
+
3. Verify health before eyeballing: \`list_console_messages\` (JS errors) +
|
|
83226
|
+
\`list_network_requests\` (404s / failed modules).
|
|
83227
|
+
4. \`take_snapshot\` for structure, \`take_screenshot\` (with \`filePath\`) for
|
|
83228
|
+
visual acceptance of the changed part.
|
|
83229
|
+
5. After further code edits, \`navigate_page\` type=\`reload\` and repeat
|
|
83230
|
+
steps 3-4; HMR usually applies without a reload.
|
|
83222
83231
|
|
|
83223
|
-
###
|
|
83224
|
-
-
|
|
83225
|
-
-
|
|
83226
|
-
-
|
|
83227
|
-
|
|
83228
|
-
|
|
83229
|
-
|
|
83230
|
-
|
|
83232
|
+
### When to use
|
|
83233
|
+
- Test a localhost app → navigate + screenshot + console check
|
|
83234
|
+
- Debug frontend issues → console errors + network requests
|
|
83235
|
+
- Verify a UI change → screenshot before/after
|
|
83236
|
+
- Walk a form flow → fill_form + click + wait_for + screenshot
|
|
83237
|
+
- Page performance questions → performance_start_trace
|
|
83238
|
+
- Do NOT use for simple HTTP data fetching — prefer FetchURL.`
|
|
83239
|
+
}];
|
|
83240
|
+
var McpCapabilityGuideInjector = class extends DynamicInjector {
|
|
83241
|
+
guide;
|
|
83242
|
+
injectionVariant;
|
|
83243
|
+
constructor(agent, guide) {
|
|
83231
83244
|
super(agent);
|
|
83245
|
+
this.guide = guide;
|
|
83246
|
+
this.injectionVariant = guide.variant;
|
|
83232
83247
|
}
|
|
83233
83248
|
getInjection() {
|
|
83234
83249
|
if (this.injectedAt !== null) return void 0;
|
|
83235
83250
|
const mcp = this.agent.mcp;
|
|
83236
83251
|
if (!mcp) return void 0;
|
|
83237
|
-
if (!mcp.list().some((
|
|
83238
|
-
return
|
|
83252
|
+
if (!mcp.list().some((entry) => entry.status === "connected" && entry.capabilities.includes(this.guide.capability))) return void 0;
|
|
83253
|
+
return this.guide.text;
|
|
83239
83254
|
}
|
|
83240
83255
|
};
|
|
83256
|
+
/** One injector per registered capability guide. */
|
|
83257
|
+
function createMcpCapabilityGuideInjectors(agent) {
|
|
83258
|
+
return MCP_CAPABILITY_GUIDES.map((guide) => new McpCapabilityGuideInjector(agent, guide));
|
|
83259
|
+
}
|
|
83241
83260
|
//#endregion
|
|
83242
83261
|
//#region ../../packages/agent-core/src/agent/injection/permission-mode.ts
|
|
83243
83262
|
const AUTO_MODE_ENTER_REMINDER = [
|
|
@@ -83811,7 +83830,7 @@ var InjectionManager = class {
|
|
|
83811
83830
|
this.agent = agent;
|
|
83812
83831
|
this.injectors = [
|
|
83813
83832
|
new PluginSessionStartInjector(agent),
|
|
83814
|
-
|
|
83833
|
+
...createMcpCapabilityGuideInjectors(agent),
|
|
83815
83834
|
new WolfPackModeInjector(agent),
|
|
83816
83835
|
new PlanModeInjector(agent),
|
|
83817
83836
|
new PermissionModeInjector(agent),
|
|
@@ -103343,6 +103362,58 @@ function isFileExistsError(error) {
|
|
|
103343
103362
|
return typeof error === "object" && error !== null && error.code === "EEXIST";
|
|
103344
103363
|
}
|
|
103345
103364
|
//#endregion
|
|
103365
|
+
//#region ../../packages/agent-core/src/mcp/capabilities.ts
|
|
103366
|
+
function isStringArray(value) {
|
|
103367
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
103368
|
+
}
|
|
103369
|
+
/** Normalize a declared list: string items only, trimmed, lowercased, deduped. */
|
|
103370
|
+
function normalizeCapabilityList(value) {
|
|
103371
|
+
const out = [];
|
|
103372
|
+
for (const item of value) {
|
|
103373
|
+
if (typeof item !== "string") continue;
|
|
103374
|
+
const normalized = item.trim().toLowerCase();
|
|
103375
|
+
if (normalized.length > 0 && !out.includes(normalized)) out.push(normalized);
|
|
103376
|
+
}
|
|
103377
|
+
return out;
|
|
103378
|
+
}
|
|
103379
|
+
/**
|
|
103380
|
+
* `args` lives only on the stdio branch of the discriminated union, and the
|
|
103381
|
+
* runtime addServer path may carry unvalidated payloads — read it defensively
|
|
103382
|
+
* so fingerprints never throw regardless of transport or shape.
|
|
103383
|
+
*/
|
|
103384
|
+
function stringArgsOf(config) {
|
|
103385
|
+
const args = config.args;
|
|
103386
|
+
return isStringArray(args) ? args : void 0;
|
|
103387
|
+
}
|
|
103388
|
+
/**
|
|
103389
|
+
* Built-in fingerprint table. Keep entries cheap and conservative — a false
|
|
103390
|
+
* capability just shows a label / injects a guide; the user can always opt
|
|
103391
|
+
* out with an explicit `capabilities: []`.
|
|
103392
|
+
*/
|
|
103393
|
+
const MCP_CAPABILITY_PATTERNS = [{
|
|
103394
|
+
capability: "browser",
|
|
103395
|
+
matches: (name, config) => name === "chrome-devtools" || stringArgsOf(config)?.some((arg) => arg.includes("chrome-devtools-mcp")) === true
|
|
103396
|
+
}, {
|
|
103397
|
+
capability: "memory",
|
|
103398
|
+
matches: (name, config) => name === "scream-life" || stringArgsOf(config)?.some((arg) => arg.includes("scream-life")) === true
|
|
103399
|
+
}];
|
|
103400
|
+
function fingerprintCapabilities(name, config) {
|
|
103401
|
+
const out = [];
|
|
103402
|
+
for (const pattern of MCP_CAPABILITY_PATTERNS) try {
|
|
103403
|
+
if (pattern.matches(name, config)) out.push(pattern.capability);
|
|
103404
|
+
} catch {}
|
|
103405
|
+
return out;
|
|
103406
|
+
}
|
|
103407
|
+
/**
|
|
103408
|
+
* Resolve the effective capabilities of one MCP server entry.
|
|
103409
|
+
* Never throws; returns `[]` for unknown servers.
|
|
103410
|
+
*/
|
|
103411
|
+
function resolveServerCapabilities(name, config) {
|
|
103412
|
+
const raw = config.capabilities;
|
|
103413
|
+
if (Array.isArray(raw)) return normalizeCapabilityList(raw);
|
|
103414
|
+
return fingerprintCapabilities(name, config);
|
|
103415
|
+
}
|
|
103416
|
+
//#endregion
|
|
103346
103417
|
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
103347
103418
|
function isZ4Schema(s) {
|
|
103348
103419
|
return !!s._zod;
|
|
@@ -106823,7 +106894,8 @@ function toPublicEntry(entry) {
|
|
|
106823
106894
|
transport: entry.config.transport,
|
|
106824
106895
|
status: entry.status,
|
|
106825
106896
|
toolCount: entry.status === "connected" && entry.enabledNames !== void 0 ? entry.enabledNames.size : 0,
|
|
106826
|
-
error: entry.error
|
|
106897
|
+
error: entry.error,
|
|
106898
|
+
capabilities: resolveServerCapabilities(entry.name, entry.config)
|
|
106827
106899
|
};
|
|
106828
106900
|
}
|
|
106829
106901
|
function computeEnabledNames(config, tools) {
|
|
@@ -107978,7 +108050,8 @@ var Session$1 = class {
|
|
|
107978
108050
|
transport: entry.transport,
|
|
107979
108051
|
status: entry.status,
|
|
107980
108052
|
toolCount: entry.toolCount,
|
|
107981
|
-
error: entry.error
|
|
108053
|
+
error: entry.error,
|
|
108054
|
+
capabilities: entry.capabilities
|
|
107982
108055
|
}
|
|
107983
108056
|
}).catch(() => {});
|
|
107984
108057
|
}
|
|
@@ -133494,7 +133567,7 @@ async function guidedGoalSetup(host) {
|
|
|
133494
133567
|
host.showNotice(t("goal.storm_breaker"), t("goal.conflict_loop"));
|
|
133495
133568
|
return;
|
|
133496
133569
|
}
|
|
133497
|
-
const { TextInputDialogComponent } = await import("./text-input-dialog-
|
|
133570
|
+
const { TextInputDialogComponent } = await import("./text-input-dialog-BBSjCM5z.mjs");
|
|
133498
133571
|
const initialDesc = await promptText(host, TextInputDialogComponent, {
|
|
133499
133572
|
title: t("goal.setup_title_initial"),
|
|
133500
133573
|
subtitle: t("goal.setup_desc_hint"),
|
|
@@ -133515,7 +133588,7 @@ async function guidedGoalSetup(host) {
|
|
|
133515
133588
|
await showGoalConfigWizard(host, session, confirmed.trim() || objective, false);
|
|
133516
133589
|
}
|
|
133517
133590
|
async function showGoalConfigWizard(host, session, objective, replace) {
|
|
133518
|
-
const { TextInputDialogComponent } = await import("./text-input-dialog-
|
|
133591
|
+
const { TextInputDialogComponent } = await import("./text-input-dialog-BBSjCM5z.mjs");
|
|
133519
133592
|
const turnInput = await promptNumber(host, TextInputDialogComponent, {
|
|
133520
133593
|
title: t("goal.wizard_title", { objective }),
|
|
133521
133594
|
subtitle: t("goal.budget_turns_hint"),
|
|
@@ -138823,8 +138896,15 @@ function getRecommended() {
|
|
|
138823
138896
|
args: [
|
|
138824
138897
|
"-y",
|
|
138825
138898
|
"chrome-devtools-mcp@latest",
|
|
138826
|
-
"--no-usage-statistics"
|
|
138827
|
-
|
|
138899
|
+
"--no-usage-statistics",
|
|
138900
|
+
"--no-performance-crux",
|
|
138901
|
+
"--screenshot-format=jpeg",
|
|
138902
|
+
"--screenshot-quality=85",
|
|
138903
|
+
"--screenshot-max-width=1600"
|
|
138904
|
+
],
|
|
138905
|
+
env: { CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS: "1" },
|
|
138906
|
+
startupTimeoutMs: 18e4,
|
|
138907
|
+
capabilities: ["browser"]
|
|
138828
138908
|
}, {
|
|
138829
138909
|
name: "scream-life",
|
|
138830
138910
|
displayName: "ScreamLife",
|
|
@@ -138832,7 +138912,8 @@ function getRecommended() {
|
|
|
138832
138912
|
command: "bun",
|
|
138833
138913
|
args: ["{INSTALL_DIR}/Core/mcp-server.ts"],
|
|
138834
138914
|
env: { SCREAM_LIFE_DB_PATH: "{INSTALL_DIR}/Data/scream-life.db" },
|
|
138835
|
-
gitUrl: "https://github.com/LIUTod/scream-life.git"
|
|
138915
|
+
gitUrl: "https://github.com/LIUTod/scream-life.git",
|
|
138916
|
+
capabilities: ["memory"]
|
|
138836
138917
|
}];
|
|
138837
138918
|
}
|
|
138838
138919
|
function getStatusLabels() {
|
|
@@ -138844,6 +138925,12 @@ function getStatusLabels() {
|
|
|
138844
138925
|
"needs-auth": t("mcp.auth_required")
|
|
138845
138926
|
};
|
|
138846
138927
|
}
|
|
138928
|
+
function getCapabilityLabels() {
|
|
138929
|
+
return {
|
|
138930
|
+
browser: t("mcp.capability_browser"),
|
|
138931
|
+
memory: t("mcp.capability_memory")
|
|
138932
|
+
};
|
|
138933
|
+
}
|
|
138847
138934
|
async function handleMcpCommand(host, _args) {
|
|
138848
138935
|
if (!host.session) {
|
|
138849
138936
|
host.showError(t("mcp.no_session"));
|
|
@@ -138914,6 +139001,8 @@ function buildRows(servers) {
|
|
|
138914
139001
|
for (const s of servers) {
|
|
138915
139002
|
const statusLabel = getStatusLabels()[s.status] ?? s.status;
|
|
138916
139003
|
const toolInfo = s.status === "connected" ? `${s.toolCount} tools` : "";
|
|
139004
|
+
const capLabels = getCapabilityLabels();
|
|
139005
|
+
const capInfo = (s.capabilities ?? []).map((c) => capLabels[c] ?? c).join(" ");
|
|
138917
139006
|
const errorInfo = s.error ? ` — ${sanitizeDesc(s.error)}` : "";
|
|
138918
139007
|
rows.push({
|
|
138919
139008
|
kind: "installed",
|
|
@@ -138925,6 +139014,7 @@ function buildRows(servers) {
|
|
|
138925
139014
|
description: [
|
|
138926
139015
|
statusLabel,
|
|
138927
139016
|
toolInfo,
|
|
139017
|
+
capInfo,
|
|
138928
139018
|
errorInfo
|
|
138929
139019
|
].filter(Boolean).join(" ")
|
|
138930
139020
|
});
|
|
@@ -139030,12 +139120,21 @@ async function installMcp(host, rec) {
|
|
|
139030
139120
|
resolvedArgs = rec.args.map((a) => a.replaceAll("{INSTALL_DIR}", installDir));
|
|
139031
139121
|
if (resolvedEnv !== void 0) resolvedEnv = Object.fromEntries(Object.entries(resolvedEnv).map(([k, v]) => [k, v.replaceAll("{INSTALL_DIR}", installDir)]));
|
|
139032
139122
|
}
|
|
139033
|
-
await writeMcpConfig(host,
|
|
139123
|
+
await writeMcpConfig(host, {
|
|
139124
|
+
name: rec.name,
|
|
139125
|
+
command: rec.command,
|
|
139126
|
+
args: resolvedArgs,
|
|
139127
|
+
env: resolvedEnv,
|
|
139128
|
+
startupTimeoutMs: rec.startupTimeoutMs,
|
|
139129
|
+
capabilities: rec.capabilities
|
|
139130
|
+
});
|
|
139034
139131
|
const serverConfig = {
|
|
139035
139132
|
transport: "stdio",
|
|
139036
139133
|
command: rec.command,
|
|
139037
139134
|
args: resolvedArgs
|
|
139038
139135
|
};
|
|
139136
|
+
if (rec.startupTimeoutMs !== void 0) serverConfig.startupTimeoutMs = rec.startupTimeoutMs;
|
|
139137
|
+
if (rec.capabilities !== void 0) serverConfig.capabilities = rec.capabilities;
|
|
139039
139138
|
if (resolvedEnv !== void 0 && Object.keys(resolvedEnv).length > 0) serverConfig.env = resolvedEnv;
|
|
139040
139139
|
await session.addMcpServer(rec.name, serverConfig);
|
|
139041
139140
|
spinner.stop({
|
|
@@ -139083,7 +139182,7 @@ async function uninstallMcp(host, name) {
|
|
|
139083
139182
|
host.showError(t("mcp.uninstall_failed", { msg: error instanceof Error ? error.message : String(error) }));
|
|
139084
139183
|
}
|
|
139085
139184
|
}
|
|
139086
|
-
async function writeMcpConfig(host,
|
|
139185
|
+
async function writeMcpConfig(host, entry) {
|
|
139087
139186
|
const configPath = join(getDataDir(), "mcp.json");
|
|
139088
139187
|
let data = {};
|
|
139089
139188
|
try {
|
|
@@ -139093,12 +139192,13 @@ async function writeMcpConfig(host, name, command, args, env) {
|
|
|
139093
139192
|
const servers = data["mcpServers"] ?? {};
|
|
139094
139193
|
const config = {
|
|
139095
139194
|
transport: "stdio",
|
|
139096
|
-
command,
|
|
139097
|
-
args
|
|
139098
|
-
startupTimeoutMs: 3e5
|
|
139195
|
+
command: entry.command,
|
|
139196
|
+
args: entry.args
|
|
139099
139197
|
};
|
|
139100
|
-
if (
|
|
139101
|
-
|
|
139198
|
+
if (entry.startupTimeoutMs !== void 0) config["startupTimeoutMs"] = entry.startupTimeoutMs;
|
|
139199
|
+
if (entry.capabilities !== void 0) config["capabilities"] = entry.capabilities;
|
|
139200
|
+
if (entry.env !== void 0 && Object.keys(entry.env).length > 0) config["env"] = entry.env;
|
|
139201
|
+
servers[entry.name] = config;
|
|
139102
139202
|
data["mcpServers"] = servers;
|
|
139103
139203
|
await mkdir(dirname$1(configPath), { recursive: true });
|
|
139104
139204
|
await writeFile(configPath, JSON.stringify(data, null, 2), "utf-8");
|
|
@@ -140614,6 +140714,8 @@ function openUrl(url) {
|
|
|
140614
140714
|
*/
|
|
140615
140715
|
const activeServers = /* @__PURE__ */ new Set();
|
|
140616
140716
|
const activeTimers = /* @__PURE__ */ new Set();
|
|
140717
|
+
/** Idle watchdog: closes all graph servers when no viewer kept them alive. */
|
|
140718
|
+
let idleTimer = null;
|
|
140617
140719
|
function registerServer(server) {
|
|
140618
140720
|
activeServers.add(server);
|
|
140619
140721
|
server.on("close", () => {
|
|
@@ -140621,6 +140723,10 @@ function registerServer(server) {
|
|
|
140621
140723
|
});
|
|
140622
140724
|
}
|
|
140623
140725
|
function closeAllServers() {
|
|
140726
|
+
if (idleTimer !== null) {
|
|
140727
|
+
clearTimeout(idleTimer);
|
|
140728
|
+
idleTimer = null;
|
|
140729
|
+
}
|
|
140624
140730
|
for (const timer of activeTimers) clearInterval(timer);
|
|
140625
140731
|
activeTimers.clear();
|
|
140626
140732
|
for (const server of activeServers) server.close();
|
|
@@ -141824,6 +141930,7 @@ async function handleWeb(host) {
|
|
|
141824
141930
|
const store = await getKnowledgeStore();
|
|
141825
141931
|
const s = await store.stats();
|
|
141826
141932
|
if (s.entities === 0 && s.events === 0) throw new Error(t("knowledge.empty_store"));
|
|
141933
|
+
closeAllServers();
|
|
141827
141934
|
const server = createServer((req, res) => {
|
|
141828
141935
|
if (req.url === "/api/graph") {
|
|
141829
141936
|
serveGraphJSON(store, res);
|
|
@@ -141858,6 +141965,10 @@ async function handleWeb(host) {
|
|
|
141858
141965
|
});
|
|
141859
141966
|
});
|
|
141860
141967
|
const url = `http://127.0.0.1:${server.address().port}`;
|
|
141968
|
+
idleTimer = setTimeout(() => {
|
|
141969
|
+
closeAllServers();
|
|
141970
|
+
}, 10 * 6e4);
|
|
141971
|
+
idleTimer.unref();
|
|
141861
141972
|
openUrl(url);
|
|
141862
141973
|
host.showStatus(t("knowledge.web_opened", { url }));
|
|
141863
141974
|
}
|
|
@@ -143228,6 +143339,14 @@ async function executeSlashCommand(host, input) {
|
|
|
143228
143339
|
host.showError(formatErrorMessage(error));
|
|
143229
143340
|
}
|
|
143230
143341
|
return;
|
|
143342
|
+
case "invalid":
|
|
143343
|
+
host.showError(`Invalid command: /${intent.commandName}`);
|
|
143344
|
+
return;
|
|
143345
|
+
default: {
|
|
143346
|
+
const unhandled = intent;
|
|
143347
|
+
host.showError(`Unhandled slash-command intent: ${String(unhandled)}`);
|
|
143348
|
+
return;
|
|
143349
|
+
}
|
|
143231
143350
|
}
|
|
143232
143351
|
}
|
|
143233
143352
|
async function handleBuiltInSlashCommand(host, name, args) {
|
|
@@ -3,5 +3,5 @@ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
|
|
|
3
3
|
import { dirname as __cjsShimDirname } from 'node:path';
|
|
4
4
|
const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = __cjsShimDirname(__filename);
|
|
6
|
-
import { Jt as handleConnectCommand } from "./dispatch-
|
|
6
|
+
import { Jt as handleConnectCommand } from "./dispatch-BaAsj0v5.mjs";
|
|
7
7
|
export { handleConnectCommand };
|
package/dist/main.mjs
CHANGED
|
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
|
|
|
6
6
|
import "./suppress-sqlite-warning-C2VB0doZ.mjs";
|
|
7
7
|
//#region src/main.ts
|
|
8
8
|
try {
|
|
9
|
-
(await import("./app-
|
|
9
|
+
(await import("./app-Bbg_nJTR.mjs")).main();
|
|
10
10
|
} catch (error) {
|
|
11
11
|
process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
|
|
12
12
|
process.exit(1);
|