blun-king-cli 9.1.483 → 9.1.485
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/bin/launcher-runtime.js +8 -0
- package/bin/session-replay-window-policy.cjs +19 -1
- package/blun.mjs +41 -19
- package/package.json +1 -1
package/bin/launcher-runtime.js
CHANGED
|
@@ -211,6 +211,12 @@ function shouldResumeAfterStartupUpdate(args, updateResult) {
|
|
|
211
211
|
&& args[0] === '-c';
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
function clearStartupUpdateViewport(output = process.stdout) {
|
|
215
|
+
if (output?.isTTY !== true || typeof output.write !== 'function') return false;
|
|
216
|
+
output.write('\u001B[2J\u001B[H');
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
|
|
214
220
|
async function superviseProtectedCore(args, env, cwd, releaseLauncherLeases, options = {}) {
|
|
215
221
|
const spawnCore = options.spawnProtectedCore || spawnProtectedCore;
|
|
216
222
|
const core = options.existingCore || spawnCore(args, env, cwd, {
|
|
@@ -457,6 +463,7 @@ async function runLauncher(options = {}) {
|
|
|
457
463
|
});
|
|
458
464
|
if (shouldResumeAfterStartupUpdate(ARGS, updateResult)) {
|
|
459
465
|
await releaseLauncherLeases();
|
|
466
|
+
clearStartupUpdateViewport(process.stdout);
|
|
460
467
|
process.exitCode = await spawnManagedLauncher(process.execPath, callerCwd);
|
|
461
468
|
return;
|
|
462
469
|
}
|
|
@@ -525,6 +532,7 @@ async function runLauncher(options = {}) {
|
|
|
525
532
|
}
|
|
526
533
|
|
|
527
534
|
module.exports = {
|
|
535
|
+
clearStartupUpdateViewport,
|
|
528
536
|
createManagedNodeEnvironment,
|
|
529
537
|
resolveLauncherPrivatePaths,
|
|
530
538
|
runLauncher,
|
|
@@ -19,4 +19,22 @@ function replayWindowStartIndex(records, activeTurnCount, startsTurn) {
|
|
|
19
19
|
return 0;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
function resolveReplayActiveTurnCount(options = {}) {
|
|
23
|
+
const savedActiveTurnCount = options.activeTurnCount;
|
|
24
|
+
if (
|
|
25
|
+
options.loadedExisting === true
|
|
26
|
+
&& Number.isSafeInteger(options.totalLines)
|
|
27
|
+
&& options.totalLines > 0
|
|
28
|
+
&& Number.isSafeInteger(savedActiveTurnCount)
|
|
29
|
+
&& savedActiveTurnCount > 0
|
|
30
|
+
) {
|
|
31
|
+
return savedActiveTurnCount;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const fallbackTurnCount = options.fallbackTurnCount;
|
|
35
|
+
return Number.isSafeInteger(fallbackTurnCount) && fallbackTurnCount > 0
|
|
36
|
+
? fallbackTurnCount
|
|
37
|
+
: undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = { replayWindowStartIndex, resolveReplayActiveTurnCount };
|
package/blun.mjs
CHANGED
|
@@ -53,7 +53,7 @@ const { clearCompactionModelConfig, normalizeCompactionModelSelection, resolveCo
|
|
|
53
53
|
const { createAgentResumeSnapshot, restoreAgentResumeSnapshot } = agentResumeSnapshot;
|
|
54
54
|
const { loadResumeCheckpoint, writeResumeCheckpoint } = sessionResumeCheckpoint;
|
|
55
55
|
const { SessionScrollbackArchive, sessionScrollbackArchiveDirectory } = sessionScrollbackArchive;
|
|
56
|
-
const { replayWindowStartIndex } = sessionReplayWindowPolicy;
|
|
56
|
+
const { replayWindowStartIndex, resolveReplayActiveTurnCount } = sessionReplayWindowPolicy;
|
|
57
57
|
const { globPatternError } = globPatternPolicy;
|
|
58
58
|
const { unsupportedUserHomePathError } = userHomePathPolicy;
|
|
59
59
|
import { EventEmitter as EventEmitter$1 } from "node:events";
|
|
@@ -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 {
|
|
@@ -506800,7 +506817,12 @@ var ScrollbackController = class {
|
|
|
506800
506817
|
reset: !resumeCheckpointRestored,
|
|
506801
506818
|
reuse: resumeCheckpointRestored
|
|
506802
506819
|
});
|
|
506803
|
-
const activeTurnCount =
|
|
506820
|
+
const activeTurnCount = resolveReplayActiveTurnCount({
|
|
506821
|
+
loadedExisting,
|
|
506822
|
+
totalLines: buffer.totalLines,
|
|
506823
|
+
activeTurnCount: buffer.activeTurnCount,
|
|
506824
|
+
fallbackTurnCount: TRANSCRIPT_MAX_TURNS
|
|
506825
|
+
});
|
|
506804
506826
|
this.suppressReplayArchiveWrites = resumeCheckpointRestored && loadedExisting && activeTurnCount === void 0;
|
|
506805
506827
|
return activeTurnCount;
|
|
506806
506828
|
}
|