@kvell007/embed-labs-cli 0.1.0-alpha.92 → 0.1.0-alpha.94
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/embed-labs-mcp-bridge.mjs +15 -9
- package/dist/index.js +24 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -640,7 +640,7 @@ const tools = [
|
|
|
640
640
|
},
|
|
641
641
|
{
|
|
642
642
|
name: "dbt_plugin_update_check",
|
|
643
|
-
description: "Check the published Embed Labs Codex/OpenCode plugin release and report whether the local plugins should be updated.",
|
|
643
|
+
description: "Check the published Embed Labs Codex/OpenCode/Trae plugin release and report whether the local plugins should be updated.",
|
|
644
644
|
inputSchema: {
|
|
645
645
|
type: "object",
|
|
646
646
|
properties: {
|
|
@@ -650,25 +650,29 @@ const tools = [
|
|
|
650
650
|
codex_target: { type: "string" },
|
|
651
651
|
codexTarget: { type: "string" },
|
|
652
652
|
opencode_target: { type: "string" },
|
|
653
|
-
opencodeTarget: { type: "string" }
|
|
653
|
+
opencodeTarget: { type: "string" },
|
|
654
|
+
trae_target: { type: "string" },
|
|
655
|
+
traeTarget: { type: "string" }
|
|
654
656
|
}
|
|
655
657
|
}
|
|
656
658
|
},
|
|
657
659
|
{
|
|
658
660
|
name: "dbt_plugin_update",
|
|
659
|
-
description: "Update the local Embed Labs Codex/OpenCode plugin installation from the published release. Restart
|
|
661
|
+
description: "Update the local Embed Labs Codex/OpenCode/Trae plugin installation from the published release. Restart the updated client after this finishes.",
|
|
660
662
|
inputSchema: {
|
|
661
663
|
type: "object",
|
|
662
664
|
properties: {
|
|
663
|
-
target_plugin: { type: "string", enum: ["codex", "opencode", "all"] },
|
|
664
|
-
plugin: { type: "string", enum: ["codex", "opencode", "all"] },
|
|
665
|
+
target_plugin: { type: "string", enum: ["codex", "opencode", "trae", "all"] },
|
|
666
|
+
plugin: { type: "string", enum: ["codex", "opencode", "trae", "all"] },
|
|
665
667
|
release_url: { type: "string" },
|
|
666
668
|
releaseUrl: { type: "string" },
|
|
667
669
|
target: { type: "string" },
|
|
668
670
|
codex_target: { type: "string" },
|
|
669
671
|
codexTarget: { type: "string" },
|
|
670
672
|
opencode_target: { type: "string" },
|
|
671
|
-
opencodeTarget: { type: "string" }
|
|
673
|
+
opencodeTarget: { type: "string" },
|
|
674
|
+
trae_target: { type: "string" },
|
|
675
|
+
traeTarget: { type: "string" }
|
|
672
676
|
}
|
|
673
677
|
}
|
|
674
678
|
},
|
|
@@ -1080,7 +1084,7 @@ function authNotReadyResult(status) {
|
|
|
1080
1084
|
"2. Create or copy your Embed Labs API Token.",
|
|
1081
1085
|
"3. Update the local CLI, then run: embedlabs auth login --token <your_token>",
|
|
1082
1086
|
"4. Verify device binding with: embedlabs auth device status",
|
|
1083
|
-
"5. Restart Codex/OpenCode so the plugin picks up the refreshed CLI and auth file."
|
|
1087
|
+
"5. Restart Codex/OpenCode/Trae so the plugin picks up the refreshed CLI and auth file."
|
|
1084
1088
|
].join("\n"),
|
|
1085
1089
|
details: {
|
|
1086
1090
|
dashboard_url: "https://api.embedboard.com/dashboard",
|
|
@@ -3063,19 +3067,21 @@ async function pluginUpdateCheck(args) {
|
|
|
3063
3067
|
pushOptional(command, "target", args.target);
|
|
3064
3068
|
pushOptional(command, "codex-target", args.codex_target || args.codexTarget);
|
|
3065
3069
|
pushOptional(command, "opencode-target", args.opencode_target || args.opencodeTarget);
|
|
3070
|
+
pushOptional(command, "trae-target", args.trae_target || args.traeTarget);
|
|
3066
3071
|
return await runEmbed(command);
|
|
3067
3072
|
}
|
|
3068
3073
|
|
|
3069
3074
|
async function pluginUpdate(args) {
|
|
3070
3075
|
const target = asString(args.target_plugin || args.plugin || "all").toLowerCase();
|
|
3071
|
-
if (!["codex", "opencode", "all"].includes(target)) {
|
|
3072
|
-
throw new Error("target_plugin must be codex, opencode, or all");
|
|
3076
|
+
if (!["codex", "opencode", "trae", "all"].includes(target)) {
|
|
3077
|
+
throw new Error("target_plugin must be codex, opencode, trae, or all");
|
|
3073
3078
|
}
|
|
3074
3079
|
const command = ["plugin", "update", target];
|
|
3075
3080
|
pushOptional(command, "release-url", args.release_url || args.releaseUrl);
|
|
3076
3081
|
pushOptional(command, "target", args.target);
|
|
3077
3082
|
pushOptional(command, "codex-target", args.codex_target || args.codexTarget);
|
|
3078
3083
|
pushOptional(command, "opencode-target", args.opencode_target || args.opencodeTarget);
|
|
3084
|
+
pushOptional(command, "trae-target", args.trae_target || args.traeTarget);
|
|
3079
3085
|
return await runEmbed(command);
|
|
3080
3086
|
}
|
|
3081
3087
|
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const DEFAULT_AUTH_FILE = process.env.EMBED_AUTH_FILE ?? ".embed-labs/auth.json"
|
|
|
20
20
|
const DEFAULT_DEVICE_FILE = process.env.EMBED_DEVICE_FILE ?? join(dirname(DEFAULT_AUTH_FILE), "device.json");
|
|
21
21
|
const DEFAULT_DASHBOARD_URL = process.env.EMBED_DASHBOARD_URL ?? "https://api.embedboard.com/dashboard";
|
|
22
22
|
const EMBED_CLIENT_NAME = "embedlabs-cli";
|
|
23
|
-
const EMBED_CLIENT_VERSION = process.env.EMBED_CLIENT_VERSION ?? "0.1.0";
|
|
23
|
+
const EMBED_CLIENT_VERSION = process.env.EMBED_CLIENT_VERSION ?? installedCliPackageVersion() ?? "0.1.0";
|
|
24
24
|
const DEFAULT_AGENT_ARTIFACT_DIR = process.env.EMBED_AGENT_ARTIFACT_DIR ?? ".embed-labs/artifacts";
|
|
25
25
|
const TOOL_INTEGRITY_RELOGIN_MESSAGE = "工具完整性校验失败,请在当前电脑重新执行 embedlabs auth login --token <key>";
|
|
26
26
|
const DOCTOR_USAGE = "Usage: embed doctor [--json]";
|
|
@@ -99,6 +99,15 @@ const BUILD_IMAGE_BOOT_LOGO_USAGE = "Usage: embed build image boot-logo --logo <
|
|
|
99
99
|
const IMAGE_BOOT_LOGO_COMPOSE_USAGE = "Usage: embed image boot-logo compose --package <boot-logo-package.json> --base-image <boot.img|image.img> --output <image> [--manifest <manifest.json>] [--force] [--json]";
|
|
100
100
|
const BUILD_IMAGE_DTB_USAGE = "Usage: embed build image dtb --dtb <local.dtb|local.dts> [--input-format auto|dtb|dts] [--account <account_id>] [--project <project_id>] [--board taishanpi] [--variant 1M-RK3566] [--output <package.json>] [--json]";
|
|
101
101
|
const IMAGE_DTB_COMPOSE_USAGE = "Usage: embed image dtb compose --package <dtb-package.json> --base-image <boot.img|image.img> --output <image> [--manifest <manifest.json>] [--force] [--json]";
|
|
102
|
+
function installedCliPackageVersion() {
|
|
103
|
+
try {
|
|
104
|
+
const manifest = require("../package.json");
|
|
105
|
+
return typeof manifest.version === "string" && manifest.version.trim() ? manifest.version.trim() : undefined;
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
102
111
|
const LOCAL_TOOLCHAIN_LIST_USAGE = "Usage: embed local toolchain list [--board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor] [--channel stable] [--metadata-root <path>] [--install-root <path>] [--json]";
|
|
103
112
|
const LOCAL_TOOLCHAIN_INSTALLED_USAGE = "Usage: embed local toolchain installed [--board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor] [--channel stable] [--metadata-root <path>] [--install-root <path>] [--json]";
|
|
104
113
|
const LOCAL_TOOLCHAIN_LATEST_USAGE = "Usage: embed local toolchain latest [--board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor] [--channel stable] [--metadata-root <path>] [--json]";
|
|
@@ -1948,7 +1957,7 @@ async function pluginInstall(parsed) {
|
|
|
1948
1957
|
installed.push(installedOpenCode.data);
|
|
1949
1958
|
}
|
|
1950
1959
|
if (target === "trae" || target === "all") {
|
|
1951
|
-
const installedTrae = await installTraeMcpIntegration(parsed, installingAll);
|
|
1960
|
+
const installedTrae = await installTraeMcpIntegration(parsed, installingAll, manifest?.data);
|
|
1952
1961
|
if (!installedTrae.ok) {
|
|
1953
1962
|
return installedTrae;
|
|
1954
1963
|
}
|
|
@@ -1978,6 +1987,7 @@ async function pluginUpdateCheck(parsed) {
|
|
|
1978
1987
|
const opencodePackage = manifest.packages?.find((item) => item.id === "opencode-embed-labs");
|
|
1979
1988
|
const codexTarget = join(codexPluginTargetRoot(parsed, true), CODEX_PLUGIN_NAME);
|
|
1980
1989
|
const openCodeTarget = openCodePluginTargetRoot(parsed, true);
|
|
1990
|
+
const traeTarget = traePluginTargetRoot(parsed, true);
|
|
1981
1991
|
return ok({
|
|
1982
1992
|
release_url: pluginReleaseBaseUrl(parsed),
|
|
1983
1993
|
latest_version: manifest.version,
|
|
@@ -2004,8 +2014,8 @@ async function pluginUpdateCheck(parsed) {
|
|
|
2004
2014
|
await pluginUpdateItem({
|
|
2005
2015
|
id: "trae",
|
|
2006
2016
|
displayName: "Embed Labs Trae MCP integration",
|
|
2007
|
-
targetPath:
|
|
2008
|
-
installedVersion:
|
|
2017
|
+
targetPath: traeTarget,
|
|
2018
|
+
installedVersion: await installedTraePluginVersion(traeTarget),
|
|
2009
2019
|
latestVersion: manifest.version,
|
|
2010
2020
|
updateCommand: "embedlabs plugin update trae"
|
|
2011
2021
|
})
|
|
@@ -2058,7 +2068,7 @@ async function pluginUpdateItem(input) {
|
|
|
2058
2068
|
notes.push("Plugin is not installed in the selected target.");
|
|
2059
2069
|
}
|
|
2060
2070
|
else if (updateAvailable) {
|
|
2061
|
-
notes.push("A newer plugin release is available. Run the update command, then restart
|
|
2071
|
+
notes.push("A newer plugin release is available. Run the update command, then restart the updated client.");
|
|
2062
2072
|
}
|
|
2063
2073
|
else if (versionOrder > 0) {
|
|
2064
2074
|
notes.push("Installed plugin is newer than the selected release channel; no update is needed.");
|
|
@@ -2192,7 +2202,7 @@ async function installOpenCodePlugin(parsed, context) {
|
|
|
2192
2202
|
cleanup: legacyCleanup
|
|
2193
2203
|
});
|
|
2194
2204
|
}
|
|
2195
|
-
async function installTraeMcpIntegration(parsed, installingAll) {
|
|
2205
|
+
async function installTraeMcpIntegration(parsed, installingAll, manifest) {
|
|
2196
2206
|
const targetRoot = traePluginTargetRoot(parsed, installingAll);
|
|
2197
2207
|
const configPath = join(targetRoot, "mcp.json");
|
|
2198
2208
|
const cacheRoot = join(targetRoot, "globalStorage", ".mcp_gallery_cache");
|
|
@@ -2208,7 +2218,8 @@ async function installTraeMcpIntegration(parsed, installingAll) {
|
|
|
2208
2218
|
await cp(iconSource, iconPath);
|
|
2209
2219
|
const launcher = await resolveEmbedCliMcpLauncher(process.env.EMBED_CLI_BIN?.trim() || await resolveExecutableOnPath("embedlabs") || await resolveExecutableOnPath("embed") || "");
|
|
2210
2220
|
const cloudUrl = pluginMcpCloudApiUrl(parsed);
|
|
2211
|
-
const
|
|
2221
|
+
const version = manifest?.version ?? await localPluginVersion("codex") ?? EMBED_CLIENT_VERSION;
|
|
2222
|
+
const gallery = traeGalleryMetadata(galleryId, iconPath, launcher, cloudUrl, version);
|
|
2212
2223
|
const galleryPath = join(cacheRoot, `${galleryId}.json`);
|
|
2213
2224
|
await writeFile(galleryPath, `${JSON.stringify(gallery, null, 2)}\n`, "utf8");
|
|
2214
2225
|
await mkdir(targetRoot, { recursive: true });
|
|
@@ -2250,7 +2261,7 @@ async function resolveEmbedLabsIconForTrae() {
|
|
|
2250
2261
|
}
|
|
2251
2262
|
return undefined;
|
|
2252
2263
|
}
|
|
2253
|
-
function traeGalleryMetadata(galleryId, iconPath, launcher, cloudUrl) {
|
|
2264
|
+
function traeGalleryMetadata(galleryId, iconPath, launcher, cloudUrl, version) {
|
|
2254
2265
|
return {
|
|
2255
2266
|
id: galleryId,
|
|
2256
2267
|
name: "embed-labs",
|
|
@@ -2275,7 +2286,7 @@ function traeGalleryMetadata(galleryId, iconPath, launcher, cloudUrl) {
|
|
|
2275
2286
|
]
|
|
2276
2287
|
}
|
|
2277
2288
|
},
|
|
2278
|
-
version
|
|
2289
|
+
version,
|
|
2279
2290
|
repository: "https://github.com/kkwell/Embed-Labs-Cloud",
|
|
2280
2291
|
mcpServerType: "stdio",
|
|
2281
2292
|
categories: ["开发者工具"],
|
|
@@ -3624,6 +3635,10 @@ async function installedCodexPluginVersion(pluginPath) {
|
|
|
3624
3635
|
async function installedOpenCodePluginVersion(targetRoot) {
|
|
3625
3636
|
return await readPackageVersion(join(targetRoot, "node_modules", "embed-labs", "package.json"));
|
|
3626
3637
|
}
|
|
3638
|
+
async function installedTraePluginVersion(targetRoot) {
|
|
3639
|
+
const galleryPath = join(targetRoot, "globalStorage", ".mcp_gallery_cache", "local.embed-labs.mcp_server.json");
|
|
3640
|
+
return await readPackageVersion(galleryPath);
|
|
3641
|
+
}
|
|
3627
3642
|
async function readPackageVersion(filePath) {
|
|
3628
3643
|
try {
|
|
3629
3644
|
const parsed = JSON.parse(await readFile(filePath, "utf8"));
|