@chosengeneration/light-code 0.143.0 → 0.144.0
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.cjs +154 -48
- package/dist/server.cjs +147 -41
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -24258,7 +24258,7 @@ __export(server_exports, {
|
|
|
24258
24258
|
});
|
|
24259
24259
|
module.exports = __toCommonJS(server_exports);
|
|
24260
24260
|
var import_promises34 = __toESM(require("node:fs/promises"), 1);
|
|
24261
|
-
var
|
|
24261
|
+
var import_node_fs15 = require("node:fs");
|
|
24262
24262
|
var import_node_http = require("node:http");
|
|
24263
24263
|
var import_node_path61 = __toESM(require("node:path"), 1);
|
|
24264
24264
|
|
|
@@ -58886,9 +58886,22 @@ var McpConnection = class {
|
|
|
58886
58886
|
return result.tools.map((tool) => ({
|
|
58887
58887
|
name: tool.name,
|
|
58888
58888
|
description: tool.description ?? "",
|
|
58889
|
-
inputSchema: tool.inputSchema
|
|
58889
|
+
inputSchema: tool.inputSchema,
|
|
58890
|
+
...tool._meta?.["lightCode/panelOnly"] === true ? { panelOnly: true } : {}
|
|
58890
58891
|
}));
|
|
58891
58892
|
}
|
|
58893
|
+
/** The same call, keeping what a button needs that the model's text rendering drops. */
|
|
58894
|
+
async callToolRaw(name, args) {
|
|
58895
|
+
if (this.client === void 0)
|
|
58896
|
+
throw new Error(`MCP server "${this.serverName}" is not connected.`);
|
|
58897
|
+
const timeoutSeconds = this.config.toolTimeouts?.[name] ?? this.config.timeout ?? this.defaultTimeout?.();
|
|
58898
|
+
const result = await this.client.callTool({ name, arguments: args }, void 0, timeoutSeconds === void 0 ? void 0 : { timeout: timeoutSeconds * 1e3 });
|
|
58899
|
+
return {
|
|
58900
|
+
text: renderToolResult(result),
|
|
58901
|
+
isError: result.isError === true,
|
|
58902
|
+
...result.structuredContent !== void 0 ? { structured: result.structuredContent } : {}
|
|
58903
|
+
};
|
|
58904
|
+
}
|
|
58892
58905
|
async callTool(name, args) {
|
|
58893
58906
|
if (this.client === void 0)
|
|
58894
58907
|
throw new Error(`MCP server "${this.serverName}" is not connected.`);
|
|
@@ -59039,6 +59052,8 @@ var McpRegistry = class {
|
|
|
59039
59052
|
statuses = /* @__PURE__ */ new Map();
|
|
59040
59053
|
errors = /* @__PURE__ */ new Map();
|
|
59041
59054
|
toolsByServer = /* @__PURE__ */ new Map();
|
|
59055
|
+
/** Tools a server marked for its own settings-tab buttons only: never offered to the model. */
|
|
59056
|
+
panelTools = /* @__PURE__ */ new Map();
|
|
59042
59057
|
logs = /* @__PURE__ */ new Map();
|
|
59043
59058
|
servers = {};
|
|
59044
59059
|
constructor(secrets, events, logger, getAlwaysAllowed = () => [], defaultTimeout = void 0, isRepositoryServer = async () => false) {
|
|
@@ -59163,7 +59178,9 @@ var McpRegistry = class {
|
|
|
59163
59178
|
if (connection === void 0)
|
|
59164
59179
|
return;
|
|
59165
59180
|
try {
|
|
59166
|
-
const
|
|
59181
|
+
const listed = await connection.listTools();
|
|
59182
|
+
this.panelTools.set(name, new Set(listed.filter((descriptor) => descriptor.panelOnly === true).map((descriptor) => descriptor.name)));
|
|
59183
|
+
const descriptors = listed.filter((descriptor) => descriptor.panelOnly !== true);
|
|
59167
59184
|
this.toolsByServer.set(name, descriptors.map((descriptor) => ({
|
|
59168
59185
|
descriptor,
|
|
59169
59186
|
tool: adaptTool(name, descriptor.name, descriptor.description, descriptor.inputSchema, async (args) => {
|
|
@@ -59194,6 +59211,22 @@ var McpRegistry = class {
|
|
|
59194
59211
|
if (options.silent !== true)
|
|
59195
59212
|
this.events.onStateChanged();
|
|
59196
59213
|
}
|
|
59214
|
+
/**
|
|
59215
|
+
* Calls one of a server's tools for a button the user pressed, returning the structured answer as
|
|
59216
|
+
* well as the text. Reaches a panel-only tool, and an ordinary one; deny rules still apply.
|
|
59217
|
+
*/
|
|
59218
|
+
async callPanelTool(server, tool, args) {
|
|
59219
|
+
const connection = this.connections.get(server);
|
|
59220
|
+
if (connection === void 0)
|
|
59221
|
+
throw new Error(`MCP server "${server}" is not running.`);
|
|
59222
|
+
const known = this.panelTools.get(server)?.has(tool) === true || (this.toolsByServer.get(server) ?? []).some((entry) => entry.descriptor.name === tool);
|
|
59223
|
+
if (!known)
|
|
59224
|
+
throw new Error(`"${server}" offers no tool "${tool}".`);
|
|
59225
|
+
const decision = denyCheck(tool, args, this.servers[server]?.deny);
|
|
59226
|
+
if (decision.denied)
|
|
59227
|
+
throw new Error(decision.message ?? "Refused by a deny rule.");
|
|
59228
|
+
return connection.callToolRaw(tool, args);
|
|
59229
|
+
}
|
|
59197
59230
|
async restart(name) {
|
|
59198
59231
|
await this.disconnect(name);
|
|
59199
59232
|
const config2 = this.servers[name];
|
|
@@ -64290,7 +64323,14 @@ var addonPageSchema = external_exports.object({
|
|
|
64290
64323
|
* - "Test connection". Pressed by the user, about a record they are looking at, so it is not an
|
|
64291
64324
|
* agent's tool call and asks no approval.
|
|
64292
64325
|
*/
|
|
64293
|
-
actions: external_exports.array(external_exports.object({
|
|
64326
|
+
actions: external_exports.array(external_exports.object({
|
|
64327
|
+
label: external_exports.string().min(1).max(40),
|
|
64328
|
+
tool: external_exports.string().regex(/^[a-zA-Z0-9_-]{1,64}$/),
|
|
64329
|
+
/** Shown before it runs, needing a second press: for an action that changes something. */
|
|
64330
|
+
confirm: external_exports.string().max(800).optional(),
|
|
64331
|
+
/** Offered only for records with this value - "Set up SSH key" for password sign-in. */
|
|
64332
|
+
showWhen: external_exports.object({ field: external_exports.string().regex(KEY), equals: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]) }).optional()
|
|
64333
|
+
})).max(5).optional(),
|
|
64294
64334
|
max: external_exports.number().int().positive().max(500).optional()
|
|
64295
64335
|
}).optional()
|
|
64296
64336
|
});
|
|
@@ -64345,6 +64385,10 @@ function cleanAddonValues(fields, values) {
|
|
|
64345
64385
|
}
|
|
64346
64386
|
return { ok: true, values: out };
|
|
64347
64387
|
}
|
|
64388
|
+
function recordUpdateFrom(structured) {
|
|
64389
|
+
const update = structured?.lightCode?.recordUpdate;
|
|
64390
|
+
return update !== null && typeof update === "object" && !Array.isArray(update) ? update : void 0;
|
|
64391
|
+
}
|
|
64348
64392
|
function isShown(field2, values) {
|
|
64349
64393
|
if (field2.showWhen === void 0)
|
|
64350
64394
|
return true;
|
|
@@ -64354,21 +64398,27 @@ function isShown(field2, values) {
|
|
|
64354
64398
|
}
|
|
64355
64399
|
|
|
64356
64400
|
// ../../packages/core/dist/addons/discover.js
|
|
64357
|
-
function defaultAddonFolders(env2, execPath, platform) {
|
|
64401
|
+
function defaultAddonFolders(env2, execPath, platform, npmrc) {
|
|
64358
64402
|
const folders = [];
|
|
64359
|
-
const
|
|
64403
|
+
const configured = npmrc?.split(/\r?\n/).map((line) => /^\s*prefix\s*=\s*(.+?)\s*$/.exec(line)?.[1]).find((value) => value !== void 0)?.replace(/^["']|["']$/g, "");
|
|
64404
|
+
const prefixes = [env2["npm_config_prefix"] ?? env2["NPM_CONFIG_PREFIX"], configured].filter((p) => p !== void 0 && p.length > 0);
|
|
64360
64405
|
if (platform === "win32") {
|
|
64361
|
-
|
|
64362
|
-
folders.push(import_node_path32.default.join(prefix, "node_modules"));
|
|
64406
|
+
for (const prefix of prefixes)
|
|
64407
|
+
folders.push(import_node_path32.default.join(expandWindows(prefix, env2), "node_modules"));
|
|
64363
64408
|
if (env2["APPDATA"] !== void 0)
|
|
64364
64409
|
folders.push(import_node_path32.default.join(env2["APPDATA"], "npm", "node_modules"));
|
|
64410
|
+
if (import_node_path32.default.basename(execPath).toLowerCase() === "node.exe")
|
|
64411
|
+
folders.push(import_node_path32.default.join(import_node_path32.default.dirname(execPath), "node_modules"));
|
|
64365
64412
|
} else {
|
|
64366
|
-
|
|
64367
|
-
folders.push(import_node_path32.default.join(prefix, "lib", "node_modules"));
|
|
64413
|
+
for (const prefix of prefixes)
|
|
64414
|
+
folders.push(import_node_path32.default.join(prefix.replace(/^~(?=\/|$)/, env2["HOME"] ?? "~"), "lib", "node_modules"));
|
|
64368
64415
|
folders.push(import_node_path32.default.join(import_node_path32.default.dirname(import_node_path32.default.dirname(execPath)), "lib", "node_modules"));
|
|
64369
64416
|
}
|
|
64370
64417
|
return [...new Set(folders.map((folder) => import_node_path32.default.resolve(folder)))];
|
|
64371
64418
|
}
|
|
64419
|
+
function expandWindows(value, env2) {
|
|
64420
|
+
return value.replace(/%([^%]+)%|\$\{([^}]+)\}/g, (whole, a, b) => env2[a ?? b ?? ""] ?? whole);
|
|
64421
|
+
}
|
|
64372
64422
|
function addonServerName(pkg) {
|
|
64373
64423
|
const bare = pkg.replace(/^@[^/]+\//, "").replace(/^(light-code|lightcode|fire-code)-addon-/i, "");
|
|
64374
64424
|
const slug = bare.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -64586,6 +64636,7 @@ var import_node_path33 = __toESM(require("node:path"), 1);
|
|
|
64586
64636
|
var SETTINGS_ENV = "LIGHT_CODE_ADDON_SETTINGS";
|
|
64587
64637
|
var DATA_ENV = "LIGHT_CODE_ADDON_DATA";
|
|
64588
64638
|
var DOWNLOADS_ENV = "LIGHT_CODE_ADDON_DOWNLOADS";
|
|
64639
|
+
var PANEL_TOOLS_ENV = "LIGHT_CODE_ADDON_PANEL_TOOLS";
|
|
64589
64640
|
function addonDataDir(storageDir, addon) {
|
|
64590
64641
|
return import_node_path33.default.join(storageDir, "addons", addon.server);
|
|
64591
64642
|
}
|
|
@@ -64601,7 +64652,8 @@ function deliveryFor(storageDir, addon, settings, stored) {
|
|
|
64601
64652
|
const env2 = {
|
|
64602
64653
|
[SETTINGS_ENV]: file2,
|
|
64603
64654
|
[DATA_ENV]: dir,
|
|
64604
|
-
[DOWNLOADS_ENV]: addonDownloadsDir(storageDir, addon)
|
|
64655
|
+
[DOWNLOADS_ENV]: addonDownloadsDir(storageDir, addon),
|
|
64656
|
+
[PANEL_TOOLS_ENV]: "1"
|
|
64605
64657
|
};
|
|
64606
64658
|
const secrets = {};
|
|
64607
64659
|
const secretFields = (owner) => ((owner === "record" ? addon.page?.records?.fields : addon.page?.fields) ?? []).filter((field2) => field2.type === "secret").map((field2) => field2.key);
|
|
@@ -65596,6 +65648,7 @@ function pick2(hubs, name) {
|
|
|
65596
65648
|
|
|
65597
65649
|
// ../../packages/core/dist/host/bridge.js
|
|
65598
65650
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
65651
|
+
var import_node_fs11 = require("node:fs");
|
|
65599
65652
|
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
65600
65653
|
|
|
65601
65654
|
// ../../packages/core/dist/modes/autoGuidance.js
|
|
@@ -78610,6 +78663,8 @@ ${preview.text}` } : {}
|
|
|
78610
78663
|
let backgroundRun = false;
|
|
78611
78664
|
let backgroundRunErrors = [];
|
|
78612
78665
|
let userTurnRunning = false;
|
|
78666
|
+
let userTurnSettled;
|
|
78667
|
+
let userTurnWindingDown = false;
|
|
78613
78668
|
let scheduledRunInFlight;
|
|
78614
78669
|
let pythonNestedContext;
|
|
78615
78670
|
let pythonNestedCallsAllowed = false;
|
|
@@ -79631,10 +79686,17 @@ ${preview.text}` } : {}
|
|
|
79631
79686
|
let installedAddons = [];
|
|
79632
79687
|
let addonProblems = [];
|
|
79633
79688
|
const addonRoot = services.codebaseDir ?? storageDir;
|
|
79689
|
+
function readUserNpmrc() {
|
|
79690
|
+
try {
|
|
79691
|
+
return (0, import_node_fs11.readFileSync)(process.env["NPM_CONFIG_USERCONFIG"] ?? import_node_path50.default.join(import_node_os6.default.homedir(), ".npmrc"), "utf8");
|
|
79692
|
+
} catch {
|
|
79693
|
+
return void 0;
|
|
79694
|
+
}
|
|
79695
|
+
}
|
|
79634
79696
|
function addonFolders(config2) {
|
|
79635
79697
|
return {
|
|
79636
79698
|
configured: (config2.addons?.folders ?? []).map((folder) => import_node_path50.default.resolve(folder)),
|
|
79637
|
-
defaults: defaultAddonFolders(process.env, process.execPath, process.platform)
|
|
79699
|
+
defaults: defaultAddonFolders(process.env, process.execPath, process.platform, readUserNpmrc())
|
|
79638
79700
|
};
|
|
79639
79701
|
}
|
|
79640
79702
|
async function rescanAddons(config2) {
|
|
@@ -79693,7 +79755,14 @@ ${preview.text}` } : {}
|
|
|
79693
79755
|
state: addonState(addon, config2.mcpServers ?? {}),
|
|
79694
79756
|
values: settings?.values ?? {},
|
|
79695
79757
|
secretsSet: await isSet(void 0, addon.page.fields ?? []),
|
|
79696
|
-
records: await Promise.all((settings?.records ?? []).map(async (record2) => ({ ...record2, secretsSet: await isSet(record2.id, addon.page?.records?.fields ?? []) })))
|
|
79758
|
+
records: await Promise.all((settings?.records ?? []).map(async (record2) => ({ ...record2, secretsSet: await isSet(record2.id, addon.page?.records?.fields ?? []) }))),
|
|
79759
|
+
tools: (mcp.states_().find((server) => server.name === addon.server)?.tools ?? []).map((tool) => ({
|
|
79760
|
+
name: tool.namespacedName,
|
|
79761
|
+
server: addon.server,
|
|
79762
|
+
tool: tool.name,
|
|
79763
|
+
description: tool.description,
|
|
79764
|
+
permission: tool.permission
|
|
79765
|
+
}))
|
|
79697
79766
|
}
|
|
79698
79767
|
});
|
|
79699
79768
|
}
|
|
@@ -79782,18 +79851,23 @@ ${preview.text}` } : {}
|
|
|
79782
79851
|
return reply(false, "That button is not one this add-on declares.");
|
|
79783
79852
|
const { config: config2 } = await configManager.load();
|
|
79784
79853
|
if (addonState(addon, config2.mcpServers ?? {}) !== "enabled")
|
|
79785
|
-
return reply(false, `Enable ${addon.displayName} first
|
|
79854
|
+
return reply(false, `Enable ${addon.displayName} first, on the Add-ons tab in Settings.`);
|
|
79786
79855
|
const record2 = (config2.addons?.settings?.[pkg]?.records ?? []).find((candidate) => candidate.id === id);
|
|
79787
79856
|
if (record2 === void 0)
|
|
79788
79857
|
return reply(false, `That ${spec.noun} no longer exists.`);
|
|
79789
79858
|
await mcp.ensureConnected();
|
|
79790
|
-
const target = mcp.enabledTools().find((candidate) => candidate.name === `${addon.server}__${tool}`);
|
|
79791
|
-
if (target === void 0)
|
|
79792
|
-
return reply(false, `${addon.displayName} is not running, or offers no "${tool}". See its log in Settings \u2192 MCP.`);
|
|
79793
79859
|
try {
|
|
79794
|
-
const result = await
|
|
79795
|
-
const
|
|
79796
|
-
|
|
79860
|
+
const result = await mcp.callPanelTool(addon.server, tool, { [spec.keyField]: record2.values[spec.keyField] });
|
|
79861
|
+
const update = result.isError ? void 0 : recordUpdateFrom(result.structured);
|
|
79862
|
+
if (update !== void 0) {
|
|
79863
|
+
const cleaned = cleanAddonValues(spec.fields, { ...record2.values, ...update });
|
|
79864
|
+
if (cleaned.ok) {
|
|
79865
|
+
const current = config2.addons?.settings?.[pkg] ?? {};
|
|
79866
|
+
await storeAddonSettings(addon, { ...current, records: (current.records ?? []).map((r) => r.id === id ? { id, values: cleaned.values } : r) });
|
|
79867
|
+
await postAddonPage(pkg);
|
|
79868
|
+
}
|
|
79869
|
+
}
|
|
79870
|
+
reply(!result.isError, result.text.slice(0, 4e3));
|
|
79797
79871
|
} catch (error51) {
|
|
79798
79872
|
reply(false, error51 instanceof Error ? error51.message : String(error51));
|
|
79799
79873
|
}
|
|
@@ -79824,7 +79898,13 @@ ${preview.text}` } : {}
|
|
|
79824
79898
|
...state === "updated" && enabled !== void 0 ? { enabledVersion: enabled } : {},
|
|
79825
79899
|
...addon.page !== void 0 ? { pageTitle: addon.page.title } : {},
|
|
79826
79900
|
...addon.icon !== void 0 ? { icon: addon.icon } : {},
|
|
79827
|
-
...addon.pageProblem !== void 0 ? { pageProblem: addon.pageProblem } : {}
|
|
79901
|
+
...addon.pageProblem !== void 0 ? { pageProblem: addon.pageProblem } : {},
|
|
79902
|
+
...(() => {
|
|
79903
|
+
const running = state === "enabled" ? mcp.states_().find((server) => server.name === addon.server) : void 0;
|
|
79904
|
+
if (running === void 0)
|
|
79905
|
+
return {};
|
|
79906
|
+
return { status: running.status, ...running.error !== void 0 ? { error: running.error } : {}, logs: running.logs.slice(-40) };
|
|
79907
|
+
})()
|
|
79828
79908
|
};
|
|
79829
79909
|
});
|
|
79830
79910
|
post({
|
|
@@ -80026,6 +80106,9 @@ ${preview.text}` } : {}
|
|
|
80026
80106
|
if (handoffAbort !== void 0)
|
|
80027
80107
|
return;
|
|
80028
80108
|
const progress = (phase, extra = {}) => post({ type: "handoffProgress", phase, ...extra });
|
|
80109
|
+
if (userTurnRunning && userTurnWindingDown && userTurnSettled !== void 0) {
|
|
80110
|
+
await Promise.race([userTurnSettled, new Promise((resolve) => setTimeout(resolve, 3e4))]);
|
|
80111
|
+
}
|
|
80029
80112
|
if (userTurnRunning || scheduledRunInFlight !== void 0) {
|
|
80030
80113
|
progress("failed", { message: "A reply is still running. Wait for it to finish, or press Stop, then try again." });
|
|
80031
80114
|
return;
|
|
@@ -80587,7 +80670,10 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
80587
80670
|
taskCheckpoint = checkpoint;
|
|
80588
80671
|
post({ type: "checkpointAvailable" });
|
|
80589
80672
|
},
|
|
80590
|
-
onDone: (ending) =>
|
|
80673
|
+
onDone: (ending) => {
|
|
80674
|
+
userTurnWindingDown = true;
|
|
80675
|
+
post({ type: "done", ...ending === "question" ? { awaitingAnswer: true } : {} });
|
|
80676
|
+
},
|
|
80591
80677
|
onError: (message4) => post({ type: "error", message: message4 })
|
|
80592
80678
|
}, turnOptions);
|
|
80593
80679
|
} catch (error51) {
|
|
@@ -85755,10 +85841,14 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85755
85841
|
await scheduledRunInFlight;
|
|
85756
85842
|
}
|
|
85757
85843
|
userTurnRunning = true;
|
|
85844
|
+
userTurnWindingDown = false;
|
|
85845
|
+
const turn = handleSendMessage(composeUserText(message4.text, { replyTo: boundedQuote(message4.replyTo), reactions: takeReactions() }), message4.images);
|
|
85846
|
+
userTurnSettled = turn.then(() => void 0, () => void 0);
|
|
85758
85847
|
try {
|
|
85759
|
-
await
|
|
85848
|
+
await turn;
|
|
85760
85849
|
} finally {
|
|
85761
85850
|
userTurnRunning = false;
|
|
85851
|
+
userTurnWindingDown = false;
|
|
85762
85852
|
}
|
|
85763
85853
|
})();
|
|
85764
85854
|
} else if (message4.type === "compactConversation") {
|
|
@@ -87338,7 +87428,7 @@ var import_promises28 = __toESM(require("node:fs/promises"), 1);
|
|
|
87338
87428
|
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
87339
87429
|
|
|
87340
87430
|
// ../../packages/core/dist/lsp/catalog.js
|
|
87341
|
-
var
|
|
87431
|
+
var import_node_fs12 = require("node:fs");
|
|
87342
87432
|
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
87343
87433
|
var c = (command, ...args) => ({ command, args });
|
|
87344
87434
|
var LSP_LANGUAGES = [
|
|
@@ -87397,7 +87487,7 @@ function languageIdFor(language, file2) {
|
|
|
87397
87487
|
var found = /* @__PURE__ */ new Map();
|
|
87398
87488
|
function findOnPath(command, env2 = process.env) {
|
|
87399
87489
|
if (import_node_path51.default.isAbsolute(command))
|
|
87400
|
-
return (0,
|
|
87490
|
+
return (0, import_node_fs12.existsSync)(command) ? command : void 0;
|
|
87401
87491
|
if (env2 !== process.env)
|
|
87402
87492
|
return searchPath(command, env2);
|
|
87403
87493
|
const hit = found.get(command);
|
|
@@ -87413,7 +87503,7 @@ function searchPath(command, env2) {
|
|
|
87413
87503
|
for (const dir of dirs) {
|
|
87414
87504
|
for (const ext of exts) {
|
|
87415
87505
|
const candidate = import_node_path51.default.join(dir, command + ext);
|
|
87416
|
-
if ((0,
|
|
87506
|
+
if ((0, import_node_fs12.existsSync)(candidate) && (process.platform !== "win32" || ext !== "" || /\.(exe|cmd|bat)$/i.test(candidate)))
|
|
87417
87507
|
return candidate;
|
|
87418
87508
|
}
|
|
87419
87509
|
}
|
|
@@ -90014,7 +90104,16 @@ Settings \u2192 Export source code saves the whole repository as a zip that buil
|
|
|
90014
90104
|
"bastion",
|
|
90015
90105
|
"host key",
|
|
90016
90106
|
"addon tab",
|
|
90017
|
-
"linux tab"
|
|
90107
|
+
"linux tab",
|
|
90108
|
+
"add-ons tab",
|
|
90109
|
+
"enable addon",
|
|
90110
|
+
"disable addon",
|
|
90111
|
+
"linux tab missing",
|
|
90112
|
+
"ssh key",
|
|
90113
|
+
"set up ssh key",
|
|
90114
|
+
"key setup",
|
|
90115
|
+
"authorized_keys",
|
|
90116
|
+
"passwordless"
|
|
90018
90117
|
],
|
|
90019
90118
|
body: `
|
|
90020
90119
|
**An add-on is an npm package that runs an MCP server**, labelled in its \`package.json\`:
|
|
@@ -90031,11 +90130,12 @@ Settings \u2192 Export source code saves the whole repository as a zip that buil
|
|
|
90031
90130
|
\`registerTool\`, \`StdioServerTransport\`). \`examples/light-code-addon-hello\` in the source is a
|
|
90032
90131
|
complete one. Light Code, Fire Code, the Node host and the JetBrains plugin all use the same add-ons.
|
|
90033
90132
|
|
|
90034
|
-
**Install it** with \`npm i -g <package or folder>\`, then **Settings \u2192
|
|
90035
|
-
|
|
90036
|
-
|
|
90037
|
-
|
|
90038
|
-
|
|
90133
|
+
**Install it** with \`npm i -g <package or folder>\`, then open **Settings \u2192 Add-ons** (the puzzle
|
|
90134
|
+
piece). Light Code finds it by itself in npm's global folder - also where \`npm config set prefix\` moved
|
|
90135
|
+
it, and beside node.exe - and in any folders listed there (Browse\u2026 adds one). **Installed is not
|
|
90136
|
+
enabled**: press Enable, read the program it will run, and confirm. Its tools then appear as
|
|
90137
|
+
\`addon-<name>__<tool>\` and are asked about like every other tool. An add-on's server is not listed on
|
|
90138
|
+
the MCP tab, which keeps the servers you configured yourself.
|
|
90039
90139
|
|
|
90040
90140
|
**An update stays off until you enable the new version** - new code is looked at first. An add-on
|
|
90041
90141
|
that is no longer installed stays off and is listed so you can remove it. Enabling writes an ordinary
|
|
@@ -90047,13 +90147,14 @@ can never switch an add-on on. \`addons.folders\` is user-scope only.
|
|
|
90047
90147
|
editor's own Node inside VS Code, so no Node install is needed there; Fire Code uses its Node.
|
|
90048
90148
|
|
|
90049
90149
|
**An add-on can bring its own settings tab**, with its own icon - it appears in Settings only while
|
|
90050
|
-
the add-on is installed
|
|
90150
|
+
the add-on is installed **and enabled**; disable it and the tab goes (what you entered is kept). The tab
|
|
90151
|
+
lists the tools the add-on gives the assistant, each with Ask first / Always allow / Never. The add-on describes the fields in \`package.json\`
|
|
90051
90152
|
(\`lightCode.addon.settings\`: a title, its own fields, and a list such as "machines" with buttons like
|
|
90052
90153
|
Test connection); Light Code draws the form. What you enter is kept in your settings, passwords in
|
|
90053
90154
|
secret storage, and the add-on receives them when it starts - saving the tab restarts it.
|
|
90054
90155
|
|
|
90055
|
-
**The Linux add-on** (\`npm i -g @chosengeneration/light-code-addon-linux\`): enable it
|
|
90056
|
-
|
|
90156
|
+
**The Linux add-on** (\`npm i -g @chosengeneration/light-code-addon-linux\`): enable it on the
|
|
90157
|
+
**Add-ons** tab, then add machines on its **Linux** tab, each with a short label (\`prod-web-1\`), host, user
|
|
90057
90158
|
and sign-in (Pageant - the default - the Windows OpenSSH agent, a key file, or a password), and press
|
|
90058
90159
|
Test connection. The assistant can then list the machines, **run read-only commands** (\`df -h\`, \`tail\`,
|
|
90059
90160
|
\`grep\`, \`ps\`, \`journalctl\`, \`systemctl status\`, \`docker ps\`... joined with \`|\`; nothing that writes,
|
|
@@ -90062,7 +90163,12 @@ ssh.exe, no new program - with one sign-in per machine reused, and a refused sig
|
|
|
90062
90163
|
it does not set off security monitoring or lock an account. Host keys are trusted the first time and
|
|
90063
90164
|
checked after; a changed key is refused until you press Forget host key. A machine behind a bastion:
|
|
90064
90165
|
add the bastion too and put its label in *Connect through*. Newer PuTTY keys (.ppk version 3): load
|
|
90065
|
-
them into Pageant, or export an OpenSSH key from PuTTYgen.
|
|
90166
|
+
them into Pageant, or export an OpenSSH key from PuTTYgen. **No key yet?** Choose Password, then press
|
|
90167
|
+
**Set up SSH key** on the machine: it makes one key for this PC (\`.ssh\\light-code_ed25519\`), adds its
|
|
90168
|
+
public half to the server's authorized_keys with the stored password, proves the key works, and switches
|
|
90169
|
+
the machine to it. It is a button only - the assistant cannot call it - and the tab lists the tools the
|
|
90170
|
+
assistant does get. A globally installed add-on is found by itself (npm's folder, your .npmrc prefix,
|
|
90171
|
+
or beside node.exe); the folder box is only for somewhere else.
|
|
90066
90172
|
`
|
|
90067
90173
|
},
|
|
90068
90174
|
{
|
|
@@ -93243,7 +93349,7 @@ var RoutedSecretStore = class {
|
|
|
93243
93349
|
|
|
93244
93350
|
// src/userVariables.ts
|
|
93245
93351
|
var import_promises32 = __toESM(require("node:fs/promises"), 1);
|
|
93246
|
-
var
|
|
93352
|
+
var import_node_fs13 = require("node:fs");
|
|
93247
93353
|
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
93248
93354
|
var UserVariableStore = class {
|
|
93249
93355
|
constructor(filePath) {
|
|
@@ -93277,7 +93383,7 @@ function userVariablesPath(userDir) {
|
|
|
93277
93383
|
}
|
|
93278
93384
|
function readVariablesFile(filePath) {
|
|
93279
93385
|
try {
|
|
93280
|
-
const raw = JSON.parse((0,
|
|
93386
|
+
const raw = JSON.parse((0, import_node_fs13.readFileSync)(filePath, "utf8"));
|
|
93281
93387
|
const parsed = sessionVariablesSchema.safeParse(raw["variables"]);
|
|
93282
93388
|
return parsed.success ? parsed.data : [];
|
|
93283
93389
|
} catch {
|
|
@@ -93301,7 +93407,7 @@ function hostedUser(env2 = process.env) {
|
|
|
93301
93407
|
}
|
|
93302
93408
|
|
|
93303
93409
|
// src/session.ts
|
|
93304
|
-
var
|
|
93410
|
+
var import_node_fs14 = require("node:fs");
|
|
93305
93411
|
var import_promises33 = __toESM(require("node:fs/promises"), 1);
|
|
93306
93412
|
var import_node_path60 = __toESM(require("node:path"), 1);
|
|
93307
93413
|
|
|
@@ -93560,7 +93666,7 @@ var FileConfigStore = class {
|
|
|
93560
93666
|
};
|
|
93561
93667
|
let watcher;
|
|
93562
93668
|
try {
|
|
93563
|
-
watcher = (0,
|
|
93669
|
+
watcher = (0, import_node_fs14.watch)(import_node_path60.default.dirname(filePath), (_event, filename) => {
|
|
93564
93670
|
if (filename === import_node_path60.default.basename(filePath)) onChange();
|
|
93565
93671
|
});
|
|
93566
93672
|
} catch {
|
|
@@ -94358,7 +94464,7 @@ async function startServer(options) {
|
|
|
94358
94464
|
connection.transport.post({ type: "credentials", credentials: await readCredentials() });
|
|
94359
94465
|
}
|
|
94360
94466
|
if (options.credentialsFile !== void 0) {
|
|
94361
|
-
(0,
|
|
94467
|
+
(0, import_node_fs15.watchFile)(options.credentialsFile, { interval: 1500 }, () => {
|
|
94362
94468
|
for (const connection of connections.values()) void postCredentials(connection);
|
|
94363
94469
|
});
|
|
94364
94470
|
}
|