@chosengeneration/light-code 0.144.0 → 0.145.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 +75 -22
- package/dist/server.cjs +72 -19
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -79686,6 +79686,17 @@ ${preview.text}` } : {}
|
|
|
79686
79686
|
let installedAddons = [];
|
|
79687
79687
|
let addonProblems = [];
|
|
79688
79688
|
const addonRoot = services.codebaseDir ?? storageDir;
|
|
79689
|
+
let mcpStartProblem;
|
|
79690
|
+
function describeFailure2(error51, stack = false) {
|
|
79691
|
+
if (!(error51 instanceof Error))
|
|
79692
|
+
return String(error51);
|
|
79693
|
+
const code = error51.code;
|
|
79694
|
+
const head = `${error51.message}${typeof code === "string" && !error51.message.includes(code) ? ` (${code})` : ""}`;
|
|
79695
|
+
if (!stack || error51.stack === void 0)
|
|
79696
|
+
return head;
|
|
79697
|
+
return `${head}
|
|
79698
|
+
${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
79699
|
+
}
|
|
79689
79700
|
function readUserNpmrc() {
|
|
79690
79701
|
try {
|
|
79691
79702
|
return (0, import_node_fs11.readFileSync)(process.env["NPM_CONFIG_USERCONFIG"] ?? import_node_path50.default.join(import_node_os6.default.homedir(), ".npmrc"), "utf8");
|
|
@@ -79712,17 +79723,17 @@ ${preview.text}` } : {}
|
|
|
79712
79723
|
if (addon.page === void 0)
|
|
79713
79724
|
continue;
|
|
79714
79725
|
const settings = config2.addons?.settings?.[addon.package];
|
|
79715
|
-
const stored = /* @__PURE__ */ new Set();
|
|
79716
|
-
for (const ref of possibleSecretRefs(addon, settings))
|
|
79717
|
-
if (await secrets.get(ref) !== void 0)
|
|
79718
|
-
stored.add(ref);
|
|
79719
|
-
const delivery = deliveryFor(addonRoot, addon, settings, stored);
|
|
79720
79726
|
try {
|
|
79727
|
+
const stored = /* @__PURE__ */ new Set();
|
|
79728
|
+
for (const ref of possibleSecretRefs(addon, settings))
|
|
79729
|
+
if (await secrets.get(ref) !== void 0)
|
|
79730
|
+
stored.add(ref);
|
|
79731
|
+
const delivery = deliveryFor(addonRoot, addon, settings, stored);
|
|
79721
79732
|
await writeFileAtomically(delivery.file, JSON.stringify(delivery.contents, null, 2));
|
|
79722
79733
|
await import_promises27.default.mkdir(addonDownloadsDir(addonRoot, addon), { recursive: true });
|
|
79723
79734
|
delivered.set(addon.package, delivery.env);
|
|
79724
79735
|
} catch (error51) {
|
|
79725
|
-
logger.warn(`Could not
|
|
79736
|
+
logger.warn(`Could not prepare the settings for add-on ${addon.package}: ${describeFailure2(error51)}`);
|
|
79726
79737
|
}
|
|
79727
79738
|
}
|
|
79728
79739
|
await mcp.configure(runnableServers(servers, installedAddons, { execPath: process.execPath, electron: process.versions["electron"] !== void 0 }, workspaceMcpServers, (addon) => delivered.get(addon.package) ?? {}));
|
|
@@ -79918,7 +79929,10 @@ ${preview.text}` } : {}
|
|
|
79918
79929
|
})),
|
|
79919
79930
|
folders: folders.configured,
|
|
79920
79931
|
defaultFolders: folders.defaults,
|
|
79921
|
-
|
|
79932
|
+
.../* @__PURE__ */ (() => {
|
|
79933
|
+
const shown2 = error51 ?? mcpStartProblem;
|
|
79934
|
+
return shown2 !== void 0 ? { error: shown2 } : {};
|
|
79935
|
+
})()
|
|
79922
79936
|
});
|
|
79923
79937
|
}
|
|
79924
79938
|
async function handleEnableAddon(pkg) {
|
|
@@ -79939,10 +79953,23 @@ ${preview.text}` } : {}
|
|
|
79939
79953
|
const next = { ...servers, [addon.server]: addonServerEntry(addon, existing) };
|
|
79940
79954
|
await configManager.save("user", { mcpServers: next });
|
|
79941
79955
|
setMcpServersState(next);
|
|
79942
|
-
|
|
79943
|
-
|
|
79944
|
-
|
|
79945
|
-
|
|
79956
|
+
mcpStartProblem = void 0;
|
|
79957
|
+
try {
|
|
79958
|
+
await configureMcp(next);
|
|
79959
|
+
postMcp();
|
|
79960
|
+
await postAddons();
|
|
79961
|
+
await mcp.ensureConnected();
|
|
79962
|
+
} catch (error51) {
|
|
79963
|
+
logger.warn(`Starting add-on ${addon.package} failed: ${describeFailure2(error51, true)}`);
|
|
79964
|
+
postMcp();
|
|
79965
|
+
await postAddons(`${addon.displayName} is enabled, but starting it failed: ${describeFailure2(error51)}. To retry, press Disable and then Enable.`);
|
|
79966
|
+
return;
|
|
79967
|
+
}
|
|
79968
|
+
const started = mcp.states_().find((server) => server.name === addon.server);
|
|
79969
|
+
if (started?.status === "failed") {
|
|
79970
|
+
const said = started.logs.filter((line) => !/^(Starting |Failed: )/.test(line)).slice(-3).join(" | ");
|
|
79971
|
+
await postAddons(`${addon.displayName} was enabled but could not start: ${started.error ?? "no reason given"}${said.length > 0 ? ` - it said: ${said}` : ""}. Its full log is under Log on its row below.`);
|
|
79972
|
+
}
|
|
79946
79973
|
}
|
|
79947
79974
|
async function handleRemoveAddon(server) {
|
|
79948
79975
|
const { config: config2 } = await configManager.load();
|
|
@@ -85821,6 +85848,20 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85821
85848
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
85822
85849
|
}
|
|
85823
85850
|
}
|
|
85851
|
+
function reportAddonFailure(operation, work, pkg) {
|
|
85852
|
+
work.catch(async (error51) => {
|
|
85853
|
+
logger.warn(`${operation} failed: ${describeFailure2(error51, true)}`);
|
|
85854
|
+
const said = `${operation} failed: ${describeFailure2(error51)}`;
|
|
85855
|
+
try {
|
|
85856
|
+
if (pkg !== void 0)
|
|
85857
|
+
await postAddonPage(pkg, { error: said });
|
|
85858
|
+
else
|
|
85859
|
+
await postAddons(said);
|
|
85860
|
+
} catch {
|
|
85861
|
+
post({ type: "error", message: said });
|
|
85862
|
+
}
|
|
85863
|
+
});
|
|
85864
|
+
}
|
|
85824
85865
|
function reportFailure(operation, work) {
|
|
85825
85866
|
work.catch((error51) => {
|
|
85826
85867
|
const reason = error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -86076,21 +86117,21 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86076
86117
|
} else if (message4.type === "requestAddonPage") {
|
|
86077
86118
|
reportFailure("postAddonPage", postAddonPage(message4.package));
|
|
86078
86119
|
} else if (message4.type === "saveAddonRecord") {
|
|
86079
|
-
|
|
86120
|
+
reportAddonFailure("Saving", handleSaveAddonRecord(message4), message4.package);
|
|
86080
86121
|
} else if (message4.type === "deleteAddonRecord") {
|
|
86081
|
-
|
|
86122
|
+
reportAddonFailure("Removing", handleDeleteAddonRecord(message4.package, message4.id), message4.package);
|
|
86082
86123
|
} else if (message4.type === "saveAddonValues") {
|
|
86083
|
-
|
|
86124
|
+
reportAddonFailure("Saving", handleSaveAddonValues(message4), message4.package);
|
|
86084
86125
|
} else if (message4.type === "runAddonAction") {
|
|
86085
|
-
|
|
86126
|
+
reportAddonFailure(message4.tool, handleRunAddonAction(message4.package, message4.id, message4.tool), message4.package);
|
|
86086
86127
|
} else if (message4.type === "requestAddons") {
|
|
86087
86128
|
reportFailure("postAddons", postAddons());
|
|
86088
86129
|
} else if (message4.type === "enableAddon") {
|
|
86089
|
-
|
|
86130
|
+
reportAddonFailure("Enabling", handleEnableAddon(message4.package));
|
|
86090
86131
|
} else if (message4.type === "removeAddon") {
|
|
86091
|
-
|
|
86132
|
+
reportAddonFailure("Disabling", handleRemoveAddon(message4.server));
|
|
86092
86133
|
} else if (message4.type === "saveAddonFolders") {
|
|
86093
|
-
|
|
86134
|
+
reportAddonFailure("Saving the folders", handleSaveAddonFolders(message4.folders));
|
|
86094
86135
|
} else if (message4.type === "openCodebaseInstructions") {
|
|
86095
86136
|
reportFailure("handleOpenCodebaseInstructions", handleOpenCodebaseInstructions());
|
|
86096
86137
|
} else if (message4.type === "requestAtlassian") {
|
|
@@ -86505,8 +86546,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86505
86546
|
const { config: config2 } = await configManager.load();
|
|
86506
86547
|
await syncMcpFromConfig(config2);
|
|
86507
86548
|
await mcp.ensureConnected();
|
|
86549
|
+
mcpStartProblem = void 0;
|
|
86508
86550
|
} catch (error51) {
|
|
86509
|
-
logger.warn(`Could not start MCP servers: ${error51
|
|
86551
|
+
logger.warn(`Could not start MCP servers: ${describeFailure2(error51, true)}`);
|
|
86552
|
+
mcpStartProblem = `Starting MCP servers and add-ons failed when Light Code opened: ${describeFailure2(error51)}`;
|
|
86553
|
+
await postAddons().catch(() => void 0);
|
|
86510
86554
|
}
|
|
86511
86555
|
})();
|
|
86512
86556
|
void (async () => {
|
|
@@ -90109,6 +90153,9 @@ Settings \u2192 Export source code saves the whole repository as a zip that buil
|
|
|
90109
90153
|
"enable addon",
|
|
90110
90154
|
"disable addon",
|
|
90111
90155
|
"linux tab missing",
|
|
90156
|
+
"addon could not start",
|
|
90157
|
+
"addon failed",
|
|
90158
|
+
"start again",
|
|
90112
90159
|
"ssh key",
|
|
90113
90160
|
"set up ssh key",
|
|
90114
90161
|
"key setup",
|
|
@@ -90169,6 +90216,12 @@ public half to the server's authorized_keys with the stored password, proves the
|
|
|
90169
90216
|
the machine to it. It is a button only - the assistant cannot call it - and the tab lists the tools the
|
|
90170
90217
|
assistant does get. A globally installed add-on is found by itself (npm's folder, your .npmrc prefix,
|
|
90171
90218
|
or beside node.exe); the folder box is only for somewhere else.
|
|
90219
|
+
|
|
90220
|
+
**The Linux tab is missing, or Enable seemed to do nothing?** Look at the add-on's row on the **Add-ons**
|
|
90221
|
+
tab: once enabled it says Running, or *Could not start* with the reason, a **Log** with what the add-on
|
|
90222
|
+
printed, and **Start again**. An add-on that cannot start is still enabled, so its tab is there. Any
|
|
90223
|
+
other failure is shown at the top of the Add-ons tab (not in the chat). Fire Code writes the full error to
|
|
90224
|
+
the agent's log too (right-click the codebase \u2192 View agent log); VS Code to View \u2192 Output \u2192 Light Code.
|
|
90172
90225
|
`
|
|
90173
90226
|
},
|
|
90174
90227
|
{
|