blun-king-cli 9.1.483 → 9.1.484
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/blun.mjs +34 -17
- package/package.json +1 -1
package/blun.mjs
CHANGED
|
@@ -298449,17 +298449,16 @@ var init_types = __esmMin((() => {
|
|
|
298449
298449
|
//#endregion
|
|
298450
298450
|
//#region ../../packages/agent-core/src/plugin/manifest.ts
|
|
298451
298451
|
async function parseManifest(pluginRoot) {
|
|
298452
|
-
const
|
|
298453
|
-
const
|
|
298454
|
-
const
|
|
298455
|
-
|
|
298456
|
-
if (!rootJsonExists && !dirJsonExists) return { diagnostics: [{
|
|
298452
|
+
const candidates = pluginManifestCandidates(pluginRoot);
|
|
298453
|
+
const existing = [];
|
|
298454
|
+
for (const candidate of candidates) if (await isFile$1(candidate.path)) existing.push(candidate);
|
|
298455
|
+
if (existing.length === 0) return { diagnostics: [{
|
|
298457
298456
|
severity: "error",
|
|
298458
|
-
message: `No manifest at ${BLUN_PLUGIN_ROOT_PATH} or ${
|
|
298457
|
+
message: `No manifest at ${BLUN_PLUGIN_ROOT_PATH}, ${BLUN_PLUGIN_DIR_PATH}, or ${CODEX_PLUGIN_DIR_PATH}`
|
|
298459
298458
|
}] };
|
|
298460
|
-
const manifestPath =
|
|
298461
|
-
const manifestKind =
|
|
298462
|
-
const shadowedManifestPath =
|
|
298459
|
+
const manifestPath = existing[0].path;
|
|
298460
|
+
const manifestKind = existing[0].kind;
|
|
298461
|
+
const shadowedManifestPath = existing[1]?.path;
|
|
298463
298462
|
let raw;
|
|
298464
298463
|
try {
|
|
298465
298464
|
raw = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
@@ -298539,6 +298538,18 @@ async function parseManifest(pluginRoot) {
|
|
|
298539
298538
|
diagnostics
|
|
298540
298539
|
};
|
|
298541
298540
|
}
|
|
298541
|
+
function pluginManifestCandidates(pluginRoot) {
|
|
298542
|
+
return [{
|
|
298543
|
+
kind: "blun-plugin-root",
|
|
298544
|
+
path: path.join(pluginRoot, BLUN_PLUGIN_ROOT_PATH)
|
|
298545
|
+
}, {
|
|
298546
|
+
kind: "blun-plugin-dir",
|
|
298547
|
+
path: path.join(pluginRoot, BLUN_PLUGIN_DIR_PATH)
|
|
298548
|
+
}, {
|
|
298549
|
+
kind: "codex-plugin-dir",
|
|
298550
|
+
path: path.join(pluginRoot, CODEX_PLUGIN_DIR_PATH)
|
|
298551
|
+
}];
|
|
298552
|
+
}
|
|
298542
298553
|
function recordUnsupportedRuntimeFields(raw, diagnostics) {
|
|
298543
298554
|
for (const field of UNSUPPORTED_RUNTIME_FIELDS) {
|
|
298544
298555
|
if (raw[field] === void 0) continue;
|
|
@@ -298596,7 +298607,7 @@ async function resolveSkillsField(pluginRoot, raw, diagnostics) {
|
|
|
298596
298607
|
return resolved;
|
|
298597
298608
|
}
|
|
298598
298609
|
async function resolvePluginPathField(input) {
|
|
298599
|
-
if (!input.value.startsWith("./")) {
|
|
298610
|
+
if (!input.value.startsWith("./") && !path.isAbsolute(input.value)) {
|
|
298600
298611
|
input.diagnostics.push({
|
|
298601
298612
|
severity: "warn",
|
|
298602
298613
|
message: `"${input.field}" path must start with "./" (got "${input.value}")`
|
|
@@ -298864,8 +298875,9 @@ function commandNameFromFile(file, root) {
|
|
|
298864
298875
|
async function normalizePluginMcpServer(input) {
|
|
298865
298876
|
const { config } = input;
|
|
298866
298877
|
if (config.transport === "http" || config.transport === "sse") return config;
|
|
298867
|
-
|
|
298868
|
-
|
|
298878
|
+
const configuredCommand = config.command;
|
|
298879
|
+
let command = expandPluginRootToken(configuredCommand, input.pluginRoot);
|
|
298880
|
+
if (command.startsWith("./") || command !== configuredCommand) {
|
|
298869
298881
|
const resolvedCommand = await resolvePluginPathField({
|
|
298870
298882
|
pluginRoot: input.pluginRoot,
|
|
298871
298883
|
field: `mcpServers.${input.name}.command`,
|
|
@@ -298881,7 +298893,8 @@ async function normalizePluginMcpServer(input) {
|
|
|
298881
298893
|
});
|
|
298882
298894
|
return;
|
|
298883
298895
|
}
|
|
298884
|
-
|
|
298896
|
+
const args = config.args?.map((arg) => expandPluginRootToken(arg, input.pluginRoot));
|
|
298897
|
+
let cwd = config.cwd === void 0 ? void 0 : expandPluginRootToken(config.cwd, input.pluginRoot);
|
|
298885
298898
|
if (cwd !== void 0) {
|
|
298886
298899
|
const resolvedCwd = await resolvePluginPathField({
|
|
298887
298900
|
pluginRoot: input.pluginRoot,
|
|
@@ -298895,9 +298908,13 @@ async function normalizePluginMcpServer(input) {
|
|
|
298895
298908
|
return {
|
|
298896
298909
|
...config,
|
|
298897
298910
|
command,
|
|
298911
|
+
args,
|
|
298898
298912
|
cwd
|
|
298899
298913
|
};
|
|
298900
298914
|
}
|
|
298915
|
+
function expandPluginRootToken(value, pluginRoot) {
|
|
298916
|
+
return value.replaceAll("${PLUGIN_ROOT}", pluginRoot).replaceAll("${BLUN_PLUGIN_ROOT}", pluginRoot);
|
|
298917
|
+
}
|
|
298901
298918
|
function readAuthor(raw) {
|
|
298902
298919
|
if (typeof raw === "string") return { name: raw };
|
|
298903
298920
|
if (!isObject$4(raw)) return void 0;
|
|
@@ -298965,12 +298982,13 @@ async function isDir(p) {
|
|
|
298965
298982
|
return false;
|
|
298966
298983
|
}
|
|
298967
298984
|
}
|
|
298968
|
-
var BLUN_PLUGIN_ROOT_PATH, BLUN_PLUGIN_DIR_PATH, UNSUPPORTED_RUNTIME_FIELDS;
|
|
298985
|
+
var BLUN_PLUGIN_ROOT_PATH, BLUN_PLUGIN_DIR_PATH, CODEX_PLUGIN_DIR_PATH, UNSUPPORTED_RUNTIME_FIELDS;
|
|
298969
298986
|
var init_manifest$1 = __esmMin((() => {
|
|
298970
298987
|
init_schema();
|
|
298971
298988
|
init_types();
|
|
298972
298989
|
BLUN_PLUGIN_ROOT_PATH = "blun.plugin.json";
|
|
298973
298990
|
BLUN_PLUGIN_DIR_PATH = ".blun-plugin/plugin.json";
|
|
298991
|
+
CODEX_PLUGIN_DIR_PATH = ".codex-plugin/plugin.json";
|
|
298974
298992
|
UNSUPPORTED_RUNTIME_FIELDS = [
|
|
298975
298993
|
"tools",
|
|
298976
298994
|
"apps",
|
|
@@ -299119,9 +299137,8 @@ async function detectPluginRoot(dir) {
|
|
|
299119
299137
|
return dir;
|
|
299120
299138
|
}
|
|
299121
299139
|
async function hasManifest(dir) {
|
|
299122
|
-
const
|
|
299123
|
-
|
|
299124
|
-
return await isFile(rootManifest) || await isFile(dirManifest);
|
|
299140
|
+
for (const candidate of pluginManifestCandidates(dir)) if (await isFile(candidate.path)) return true;
|
|
299141
|
+
return false;
|
|
299125
299142
|
}
|
|
299126
299143
|
async function isFile(p) {
|
|
299127
299144
|
try {
|