blun-king-cli 9.1.340 → 9.1.342
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
CHANGED
|
@@ -272,6 +272,13 @@ function isAutomaticRunningUpdateMode(mode) {
|
|
|
272
272
|
return mode === RUNNING_UPDATE_MODES.RESUME || mode === RUNNING_UPDATE_MODES.NEW;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
function shouldLaunchPreparedRuntimeAutomatically(runtime, mode) {
|
|
276
|
+
return runtime !== undefined
|
|
277
|
+
&& runtime !== null
|
|
278
|
+
&& isAutomaticRunningUpdateMode(mode)
|
|
279
|
+
&& runtime.mode === mode;
|
|
280
|
+
}
|
|
281
|
+
|
|
275
282
|
async function prepareAutomaticStartupRuntime(options) {
|
|
276
283
|
if (options.existingRuntime !== undefined) return options.existingRuntime;
|
|
277
284
|
const runningUpdateMode = readRunningUpdateMode(options.profileHome);
|
|
@@ -796,6 +803,23 @@ async function runLauncher(options = {}) {
|
|
|
796
803
|
} catch {}
|
|
797
804
|
}
|
|
798
805
|
|
|
806
|
+
if (shouldLaunchPreparedRuntimeAutomatically(deferredPendingRuntime, runningUpdateMode)) {
|
|
807
|
+
const pendingArgs = deferredPendingRuntime.mode === RUNNING_UPDATE_MODES.RESUME
|
|
808
|
+
&& deferredPendingRuntime.sessionId !== undefined
|
|
809
|
+
? handoffArgsForMode(RAW_ARGS, deferredPendingRuntime.mode, deferredPendingRuntime.sessionId)
|
|
810
|
+
: RAW_ARGS;
|
|
811
|
+
await releaseNotice();
|
|
812
|
+
process.exitCode = await spawnActiveLauncher(
|
|
813
|
+
deferredPendingRuntime.packageRoot,
|
|
814
|
+
deferredPendingRuntime.cwd || callerCwd,
|
|
815
|
+
pendingArgs,
|
|
816
|
+
deferredPendingRuntime.mode === RUNNING_UPDATE_MODES.RESUME
|
|
817
|
+
? { resumeSessionId: deferredPendingRuntime.sessionId }
|
|
818
|
+
: {},
|
|
819
|
+
);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
|
|
799
823
|
// --- 1. Oeffentlicher npm-Update-Dialog. -------------------------------
|
|
800
824
|
const updateResult = options.skipUpdateNotice === true
|
|
801
825
|
? { kind: 'continue', reason: 'notice_busy' }
|
|
@@ -917,6 +941,7 @@ module.exports = {
|
|
|
917
941
|
runningUpdateRecheckDelay,
|
|
918
942
|
runLauncher,
|
|
919
943
|
scheduleRunningUpdateRecheck,
|
|
944
|
+
shouldLaunchPreparedRuntimeAutomatically,
|
|
920
945
|
shouldRecoverActivatedRuntime,
|
|
921
946
|
shouldDetachProtectedCore,
|
|
922
947
|
spawnManagedLauncher,
|
|
@@ -7,6 +7,12 @@ const {
|
|
|
7
7
|
const DEFAULT_MAX_CHARS = 3_000;
|
|
8
8
|
const DEFAULT_MAX_SECTIONS = 5;
|
|
9
9
|
const RECENT_USER_MESSAGES = 4;
|
|
10
|
+
const NON_ACTIONABLE_USER_ORIGINS = new Set([
|
|
11
|
+
'background_task',
|
|
12
|
+
'compaction_summary',
|
|
13
|
+
'injection',
|
|
14
|
+
'skill_activation',
|
|
15
|
+
]);
|
|
10
16
|
const STOP_WORDS = new Set([
|
|
11
17
|
'aber', 'alle', 'alles', 'auch', 'eine', 'einem', 'einen', 'einer', 'eines',
|
|
12
18
|
'fuer', 'haben', 'hier', 'immer', 'jetzt', 'kann', 'machen', 'mehr', 'mich',
|
|
@@ -35,10 +41,16 @@ function textFromMessage(message) {
|
|
|
35
41
|
.join('\n');
|
|
36
42
|
}
|
|
37
43
|
|
|
44
|
+
function isActionableMistakeInput(message) {
|
|
45
|
+
if (message?.role !== 'user') return false;
|
|
46
|
+
const originKind = String(message?.origin?.kind || '').trim();
|
|
47
|
+
return !NON_ACTIONABLE_USER_ORIGINS.has(originKind);
|
|
48
|
+
}
|
|
49
|
+
|
|
38
50
|
function recentUserText(history, limit = RECENT_USER_MESSAGES) {
|
|
39
51
|
if (!Array.isArray(history)) return '';
|
|
40
52
|
return history
|
|
41
|
-
.filter(
|
|
53
|
+
.filter(isActionableMistakeInput)
|
|
42
54
|
.map(textFromMessage)
|
|
43
55
|
.filter(Boolean)
|
|
44
56
|
.slice(-Math.max(1, Number(limit) || RECENT_USER_MESSAGES))
|
|
@@ -47,7 +59,7 @@ function recentUserText(history, limit = RECENT_USER_MESSAGES) {
|
|
|
47
59
|
|
|
48
60
|
function isLowInformationMistakeTurn(history) {
|
|
49
61
|
if (!Array.isArray(history)) return false;
|
|
50
|
-
const message = history.findLast(
|
|
62
|
+
const message = history.findLast(isActionableMistakeInput);
|
|
51
63
|
if (message === undefined) return false;
|
|
52
64
|
if (typeof message.content === 'string') {
|
|
53
65
|
return isLowInformationPersonalMemoryQuery(message.content);
|