blun-king-cli 9.1.520 → 9.1.525
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/CHANGELOG.md +32 -0
- package/LIESMICH.txt +4 -2
- package/README.md +4 -2
- package/agent-spine-plugin/.claude-plugin/marketplace.json +1 -1
- package/agent-spine-plugin/.claude-plugin/plugin.json +1 -1
- package/agent-spine-plugin/.codex-plugin/plugin.json +1 -2
- package/agent-spine-plugin/CHANGELOG.md +81 -14
- package/agent-spine-plugin/CONTRIBUTING.md +52 -0
- package/agent-spine-plugin/README.md +6 -4
- package/agent-spine-plugin/SECURITY.md +47 -0
- package/agent-spine-plugin/blun.plugin.json +2 -2
- package/agent-spine-plugin/docs/acceptance.md +2 -2
- package/agent-spine-plugin/docs/architecture.md +1 -1
- package/agent-spine-plugin/docs/gateway-runtime.md +2 -2
- package/agent-spine-plugin/docs/host-integration.md +2 -2
- package/agent-spine-plugin/docs/learning.md +37 -2
- package/agent-spine-plugin/docs/preflight-recall.md +1 -1
- package/agent-spine-plugin/docs/quality-gates.md +1 -1
- package/agent-spine-plugin/docs/relationships.md +1 -1
- package/agent-spine-plugin/docs/session-briefing.md +1 -1
- package/agent-spine-plugin/docs/source-roots.md +1 -1
- package/agent-spine-plugin/hooks/codex.json +1 -1
- package/agent-spine-plugin/hooks/version.json +1 -1
- package/agent-spine-plugin/package.json +1 -1
- package/agent-spine-plugin/scripts/check-hosts.js +2 -2
- package/agent-spine-plugin/skills/agent-spine/SKILL.md +3 -3
- package/agent-spine-plugin/src/cli.js +69 -5
- package/agent-spine-plugin/src/hook.js +41 -23
- package/agent-spine-plugin/src/index.js +2 -1
- package/agent-spine-plugin/src/lib/acceptance.js +2 -3
- package/agent-spine-plugin/src/lib/attention.js +4 -4
- package/agent-spine-plugin/src/lib/audit.js +12 -3
- package/agent-spine-plugin/src/lib/authentication.js +4 -2
- package/agent-spine-plugin/src/lib/briefing.js +20 -8
- package/agent-spine-plugin/src/lib/catalog.js +28 -3
- package/agent-spine-plugin/src/lib/channel-runtime.js +2 -2
- package/agent-spine-plugin/src/lib/continuity.js +18 -13
- package/agent-spine-plugin/src/lib/documents.js +23 -5
- package/agent-spine-plugin/src/lib/feed-transport.js +4 -2
- package/agent-spine-plugin/src/lib/graph.js +47 -12
- package/agent-spine-plugin/src/lib/learning.js +422 -48
- package/agent-spine-plugin/src/lib/paths.js +50 -1
- package/agent-spine-plugin/src/lib/persona-runtime.js +20 -14
- package/agent-spine-plugin/src/lib/preflight.js +50 -26
- package/agent-spine-plugin/src/lib/source-roots.js +38 -7
- package/agent-spine-plugin/src/mcp.js +50 -4
- package/agent-spine-plugin/src/version.js +1 -1
- package/bin/telegram-approval-relay.cjs +2 -0
- package/blun.mjs +111 -8
- package/package.json +8 -2
- package/scripts/check-approval-observability-regression.js +111 -0
- package/scripts/check-bundled-agent-spine-regression.js +48 -0
- package/scripts/check-session-picker-resume-metrics-regression.js +97 -0
- package/scripts/check-session-start-hook-context-regression.js +54 -4
- package/scripts/check-shell-terminal-isolation-regression.js +81 -0
- package/scripts/check-slash-escape-regression.js +89 -0
- package/scripts/check-telegram-loop-exactly-once-regression.js +71 -0
- package/telegram-plugin/bin/telegram-approval-relay.cjs +2 -1
package/blun.mjs
CHANGED
|
@@ -234150,6 +234150,15 @@ var init_permission = __esmMin((() => {
|
|
|
234150
234150
|
let requestedApproval = false;
|
|
234151
234151
|
if (this.agent.rpc?.requestApproval) {
|
|
234152
234152
|
requestedApproval = true;
|
|
234153
|
+
this.agent.records.logRecord({
|
|
234154
|
+
type: "permission.approval_requested",
|
|
234155
|
+
turnId: Number(context.turnId),
|
|
234156
|
+
toolCallId: id,
|
|
234157
|
+
toolName: name,
|
|
234158
|
+
action,
|
|
234159
|
+
display,
|
|
234160
|
+
policyName: policyName ?? null
|
|
234161
|
+
});
|
|
234153
234162
|
this.agent.hooks?.fireAndForgetTrigger?.("PermissionRequest", {
|
|
234154
234163
|
matcherValue: name,
|
|
234155
234164
|
inputData: {
|
|
@@ -297952,7 +297961,7 @@ var init_session$1 = __esmMin((() => {
|
|
|
297952
297961
|
const { agent } = await this.createAgent({ type: "main" }, { profile: DEFAULT_AGENT_PROFILES["agent"] });
|
|
297953
297962
|
const mc = this.options.missionContract;
|
|
297954
297963
|
if (mc && Array.isArray(mc.acceptanceCriteria) && mc.acceptanceCriteria.length > 0) await agent.injection.setMissionContract(mc);
|
|
297955
|
-
|
|
297964
|
+
this.scheduleSessionStart("startup");
|
|
297956
297965
|
return agent;
|
|
297957
297966
|
}
|
|
297958
297967
|
async resume() {
|
|
@@ -297965,7 +297974,7 @@ var init_session$1 = __esmMin((() => {
|
|
|
297965
297974
|
const profile = DEFAULT_AGENT_PROFILES["agent"];
|
|
297966
297975
|
if (main !== void 0 && profile !== void 0 && main.config.systemPrompt === "") await this.bootstrapAgentProfile(main, profile);
|
|
297967
297976
|
if (main !== void 0) this.ensureBaselineSkill(main);
|
|
297968
|
-
|
|
297977
|
+
this.scheduleSessionStart("resume");
|
|
297969
297978
|
return { warning };
|
|
297970
297979
|
}
|
|
297971
297980
|
async close() {
|
|
@@ -298500,6 +298509,11 @@ var init_session$1 = __esmMin((() => {
|
|
|
298500
298509
|
if (agent === void 0) throw new BlunError(ErrorCodes.AGENT_NOT_FOUND, "Main agent was not found");
|
|
298501
298510
|
return agent;
|
|
298502
298511
|
}
|
|
298512
|
+
scheduleSessionStart(source) {
|
|
298513
|
+
void this.triggerSessionStart(source).catch((error) => {
|
|
298514
|
+
this.log.warn("session start hook failed", { source, error });
|
|
298515
|
+
});
|
|
298516
|
+
}
|
|
298503
298517
|
async triggerSessionStart(source) {
|
|
298504
298518
|
const results = await this.hookEngine.trigger("SessionStart", {
|
|
298505
298519
|
matcherValue: source,
|
|
@@ -316397,7 +316411,7 @@ function buildLocalSpawnOptions(isWindows, cwd, env) {
|
|
|
316397
316411
|
"pipe",
|
|
316398
316412
|
"pipe"
|
|
316399
316413
|
],
|
|
316400
|
-
detached:
|
|
316414
|
+
detached: true,
|
|
316401
316415
|
windowsHide: true
|
|
316402
316416
|
};
|
|
316403
316417
|
}
|
|
@@ -424151,7 +424165,8 @@ async function handleLoopCommand(host, args) {
|
|
|
424151
424165
|
host.setAppState?.({ loop });
|
|
424152
424166
|
host.track("loop_start", { interval: loop.interval });
|
|
424153
424167
|
host.showStatus(`/loop ${loop.status}`);
|
|
424154
|
-
if (
|
|
424168
|
+
if (host.telegramRemoteCommandContext !== void 0) host.sendNormalUserInput(loop.prompt);
|
|
424169
|
+
else if (isStreaming(host) || host.state.appState.isCompacting) host.enqueueNormalUserInput(loop.prompt);
|
|
424155
424170
|
else host.sendNormalUserInput(loop.prompt);
|
|
424156
424171
|
return;
|
|
424157
424172
|
}
|
|
@@ -500646,6 +500661,10 @@ registerUiCatalogFragment({
|
|
|
500646
500661
|
"sessionPicker.time.daysAgo": "{count}d ago",
|
|
500647
500662
|
"sessionPicker.current": "current",
|
|
500648
500663
|
"sessionPicker.imported": "imported",
|
|
500664
|
+
"sessionPicker.resume.metrics": "Resume {resumeSize} · {messages} messages · {tokens} tokens · Wire {wireSize}",
|
|
500665
|
+
"sessionPicker.resume.missing": "checkpoint missing",
|
|
500666
|
+
"sessionPicker.resume.stale": "checkpoint stale",
|
|
500667
|
+
"sessionPicker.resume.invalid": "checkpoint invalid",
|
|
500649
500668
|
"sessionPicker.footer.matches": "Showing {from}-{to} of {loaded} loaded / {matches} matches",
|
|
500650
500669
|
"sessionPicker.footer.sessions": "Showing {from}-{to} of {count} sessions",
|
|
500651
500670
|
"sessionPicker.footer.loadedSessions": "Showing {from}-{to} of {loaded} loaded / {total} sessions"
|
|
@@ -500670,6 +500689,10 @@ registerUiCatalogFragment({
|
|
|
500670
500689
|
"sessionPicker.time.daysAgo": "vor {count} T.",
|
|
500671
500690
|
"sessionPicker.current": "aktuell",
|
|
500672
500691
|
"sessionPicker.imported": "importiert",
|
|
500692
|
+
"sessionPicker.resume.metrics": "Resume {resumeSize} · {messages} Nachrichten · {tokens} Tokens · Wire {wireSize}",
|
|
500693
|
+
"sessionPicker.resume.missing": "Checkpoint fehlt",
|
|
500694
|
+
"sessionPicker.resume.stale": "Checkpoint veraltet",
|
|
500695
|
+
"sessionPicker.resume.invalid": "Checkpoint ungültig",
|
|
500673
500696
|
"sessionPicker.footer.matches": "Anzeige {from}-{to} · {loaded} geladen · {matches} Treffer",
|
|
500674
500697
|
"sessionPicker.footer.sessions": "Anzeige {from}-{to} von {count} Sitzungen",
|
|
500675
500698
|
"sessionPicker.footer.loadedSessions": "Anzeige {from}-{to} · {loaded} von {total} Sitzungen geladen"
|
|
@@ -500694,6 +500717,10 @@ registerUiCatalogFragment({
|
|
|
500694
500717
|
"sessionPicker.time.daysAgo": "hace {count} d",
|
|
500695
500718
|
"sessionPicker.current": "actual",
|
|
500696
500719
|
"sessionPicker.imported": "importada",
|
|
500720
|
+
"sessionPicker.resume.metrics": "Reanudación {resumeSize} · {messages} mensajes · {tokens} tokens · Wire {wireSize}",
|
|
500721
|
+
"sessionPicker.resume.missing": "Falta el punto de reanudación",
|
|
500722
|
+
"sessionPicker.resume.stale": "Punto de reanudación desactualizado",
|
|
500723
|
+
"sessionPicker.resume.invalid": "Punto de reanudación no válido",
|
|
500697
500724
|
"sessionPicker.footer.matches": "Mostrando {from}-{to} · {loaded} cargadas · {matches} coincidencias",
|
|
500698
500725
|
"sessionPicker.footer.sessions": "Mostrando {from}-{to} de {count} sesiones",
|
|
500699
500726
|
"sessionPicker.footer.loadedSessions": "Mostrando {from}-{to} · {loaded} de {total} sesiones cargadas"
|
|
@@ -500718,6 +500745,10 @@ registerUiCatalogFragment({
|
|
|
500718
500745
|
"sessionPicker.time.daysAgo": "il y a {count} j",
|
|
500719
500746
|
"sessionPicker.current": "actuelle",
|
|
500720
500747
|
"sessionPicker.imported": "importée",
|
|
500748
|
+
"sessionPicker.resume.metrics": "Reprise {resumeSize} · {messages} messages · {tokens} tokens · Wire {wireSize}",
|
|
500749
|
+
"sessionPicker.resume.missing": "Point de reprise manquant",
|
|
500750
|
+
"sessionPicker.resume.stale": "Point de reprise obsolète",
|
|
500751
|
+
"sessionPicker.resume.invalid": "Point de reprise non valide",
|
|
500721
500752
|
"sessionPicker.footer.matches": "Affichage de {from}-{to} · {loaded} chargées · {matches} résultats",
|
|
500722
500753
|
"sessionPicker.footer.sessions": "Affichage de {from}-{to} sur {count} sessions",
|
|
500723
500754
|
"sessionPicker.footer.loadedSessions": "Affichage de {from}-{to} · {loaded} sessions chargées sur {total}"
|
|
@@ -500742,6 +500773,10 @@ registerUiCatalogFragment({
|
|
|
500742
500773
|
"sessionPicker.time.daysAgo": "för {count} d sedan",
|
|
500743
500774
|
"sessionPicker.current": "aktuell",
|
|
500744
500775
|
"sessionPicker.imported": "importerad",
|
|
500776
|
+
"sessionPicker.resume.metrics": "Återupptagning {resumeSize} · {messages} meddelanden · {tokens} token · Wire {wireSize}",
|
|
500777
|
+
"sessionPicker.resume.missing": "Återupptagningspunkt saknas",
|
|
500778
|
+
"sessionPicker.resume.stale": "Återupptagningspunkt är inaktuell",
|
|
500779
|
+
"sessionPicker.resume.invalid": "Ogiltig återupptagningspunkt",
|
|
500745
500780
|
"sessionPicker.footer.matches": "Visar {from}-{to} · {loaded} inlästa · {matches} träffar",
|
|
500746
500781
|
"sessionPicker.footer.sessions": "Visar {from}-{to} av {count} sessioner",
|
|
500747
500782
|
"sessionPicker.footer.loadedSessions": "Visar {from}-{to} · {loaded} av {total} sessioner inlästa"
|
|
@@ -500766,6 +500801,10 @@ registerUiCatalogFragment({
|
|
|
500766
500801
|
"sessionPicker.time.daysAgo": "před {count} d",
|
|
500767
500802
|
"sessionPicker.current": "aktuální",
|
|
500768
500803
|
"sessionPicker.imported": "importováno",
|
|
500804
|
+
"sessionPicker.resume.metrics": "Obnovení {resumeSize} · {messages} zpráv · {tokens} tokenů · Wire {wireSize}",
|
|
500805
|
+
"sessionPicker.resume.missing": "Bod obnovení chybí",
|
|
500806
|
+
"sessionPicker.resume.stale": "Bod obnovení je zastaralý",
|
|
500807
|
+
"sessionPicker.resume.invalid": "Neplatný bod obnovení",
|
|
500769
500808
|
"sessionPicker.footer.matches": "Zobrazeno {from}–{to}; načteno {loaded}, shod {matches}",
|
|
500770
500809
|
"sessionPicker.footer.sessions": "Zobrazeno {from}–{to} z {count} relací",
|
|
500771
500810
|
"sessionPicker.footer.loadedSessions": "Zobrazeno {from}–{to}; načteno {loaded} z {total} relací"
|
|
@@ -501020,6 +501059,21 @@ var SessionPickerComponent = class extends Container {
|
|
|
501020
501059
|
const promptLine = indent + currentTheme.fg("textDim", promptMarker + promptText);
|
|
501021
501060
|
card.push(promptLine);
|
|
501022
501061
|
}
|
|
501062
|
+
const resume = session.resume;
|
|
501063
|
+
if (resume !== void 0) {
|
|
501064
|
+
if (resume.status === "missing") card.push(indent + currentTheme.fg("warning", uiText("sessionPicker.resume.missing")));
|
|
501065
|
+
else if (resume.status === "invalid") card.push(indent + currentTheme.fg("error", uiText("sessionPicker.resume.invalid")));
|
|
501066
|
+
else {
|
|
501067
|
+
const metrics = uiText("sessionPicker.resume.metrics", {
|
|
501068
|
+
resumeSize: formatByteSize(resume.resumeBytes),
|
|
501069
|
+
messages: resume.messages.toLocaleString(getCurrentUiLocale()),
|
|
501070
|
+
tokens: formatLiveTokenCount(resume.tokens),
|
|
501071
|
+
wireSize: formatByteSize(resume.wireBytes)
|
|
501072
|
+
});
|
|
501073
|
+
const suffix = resume.status === "stale" ? ` · ${uiText("sessionPicker.resume.stale")}` : "";
|
|
501074
|
+
card.push(indent + currentTheme.fg(resume.status === "stale" ? "warning" : "textMuted", truncateToWidth(metrics + suffix, Math.max(8, width - indentWidth), ELLIPSIS$4)));
|
|
501075
|
+
}
|
|
501076
|
+
}
|
|
501023
501077
|
return card;
|
|
501024
501078
|
}
|
|
501025
501079
|
};
|
|
@@ -505909,6 +505963,7 @@ var EditorKeyboardController = class {
|
|
|
505909
505963
|
return;
|
|
505910
505964
|
}
|
|
505911
505965
|
if (autocompleteCancelled) {
|
|
505966
|
+
if (editor.inputMode === "prompt" && editor.getText().trimStart().startsWith("/")) editor.setText("");
|
|
505912
505967
|
this.clearPendingUndoEsc();
|
|
505913
505968
|
return;
|
|
505914
505969
|
}
|
|
@@ -505949,8 +506004,9 @@ var EditorKeyboardController = class {
|
|
|
505949
506004
|
return true;
|
|
505950
506005
|
};
|
|
505951
506006
|
editor.onCtrlS = () => {
|
|
505952
|
-
|
|
505953
|
-
host.
|
|
506007
|
+
const draft = editor.getText().trim();
|
|
506008
|
+
if (!host.streamingUI.hasActiveTurn() && host.state.appState.streamingPhase === "idle" && !draft.trimStart().startsWith("/")) return;
|
|
506009
|
+
host.flushQueuedMessages(draft, editor.inputMode);
|
|
505954
506010
|
host.updateQueueDisplay();
|
|
505955
506011
|
host.state.ui.requestRender();
|
|
505956
506012
|
};
|
|
@@ -516666,9 +516722,56 @@ function sessionRowsForPicker(sessions, currentSessionId, currentSessionHasConte
|
|
|
516666
516722
|
last_prompt: session.lastPrompt ?? null,
|
|
516667
516723
|
work_dir: session.workDir,
|
|
516668
516724
|
updated_at: session.updatedAt ?? session.createdAt ?? 0,
|
|
516669
|
-
metadata: session.metadata
|
|
516725
|
+
metadata: session.metadata,
|
|
516726
|
+
session_dir: session.sessionDir
|
|
516670
516727
|
}));
|
|
516671
516728
|
}
|
|
516729
|
+
const SESSION_RESUME_METRICS_CONCURRENCY = 8;
|
|
516730
|
+
const SESSION_RESUME_STALE_AFTER_MS = 6e4;
|
|
516731
|
+
async function statSessionFile(filePath) {
|
|
516732
|
+
try {
|
|
516733
|
+
return await stat(filePath);
|
|
516734
|
+
} catch {
|
|
516735
|
+
return null;
|
|
516736
|
+
}
|
|
516737
|
+
}
|
|
516738
|
+
async function readSessionResumeMetrics(session) {
|
|
516739
|
+
if (typeof session.session_dir !== "string" || session.session_dir.length === 0) return { status: "missing" };
|
|
516740
|
+
const agentDir = join(session.session_dir, "agents", "main");
|
|
516741
|
+
const wirePath = join(agentDir, "wire.jsonl");
|
|
516742
|
+
const checkpointPath = join(agentDir, "resume-checkpoint.json");
|
|
516743
|
+
const [resumeStat, wireStat] = await Promise.all([
|
|
516744
|
+
statSessionFile(checkpointPath),
|
|
516745
|
+
statSessionFile(wirePath)
|
|
516746
|
+
]);
|
|
516747
|
+
if (resumeStat === null) return { status: "missing" };
|
|
516748
|
+
if (wireStat === null) return { status: "invalid" };
|
|
516749
|
+
const checkpoint = await loadResumeCheckpoint({ wirePath }).catch(() => ({ ok: false }));
|
|
516750
|
+
if (!checkpoint.ok) return { status: "invalid" };
|
|
516751
|
+
const context = checkpoint.snapshot?.context;
|
|
516752
|
+
const messages = Array.isArray(context?.history) ? context.history.length : Number.isSafeInteger(context?.tokenCountCoveredMessageCount) ? context.tokenCountCoveredMessageCount : 0;
|
|
516753
|
+
const tokens = Number.isSafeInteger(context?.tokenCount) ? context.tokenCount : 0;
|
|
516754
|
+
const stale = wireStat.size > checkpoint.offset && wireStat.mtimeMs - resumeStat.mtimeMs > SESSION_RESUME_STALE_AFTER_MS;
|
|
516755
|
+
return {
|
|
516756
|
+
status: stale ? "stale" : "ok",
|
|
516757
|
+
resumeBytes: resumeStat.size,
|
|
516758
|
+
wireBytes: wireStat.size,
|
|
516759
|
+
messages,
|
|
516760
|
+
tokens
|
|
516761
|
+
};
|
|
516762
|
+
}
|
|
516763
|
+
async function enrichSessionRowsForPicker(rows) {
|
|
516764
|
+
let nextIndex = 0;
|
|
516765
|
+
const workerCount = Math.min(SESSION_RESUME_METRICS_CONCURRENCY, rows.length);
|
|
516766
|
+
await Promise.all(Array.from({ length: workerCount }, async () => {
|
|
516767
|
+
while (nextIndex < rows.length) {
|
|
516768
|
+
const index = nextIndex++;
|
|
516769
|
+
const row = rows[index];
|
|
516770
|
+
if (row !== void 0) row.resume = await readSessionResumeMetrics(row);
|
|
516771
|
+
}
|
|
516772
|
+
}));
|
|
516773
|
+
return rows;
|
|
516774
|
+
}
|
|
516672
516775
|
//#endregion
|
|
516673
516776
|
//#region src/tui/utils/startup.ts
|
|
516674
516777
|
function combineStartupNotice(existing, next) {
|
|
@@ -519873,7 +519976,7 @@ var BlunTUI = class {
|
|
|
519873
519976
|
this.state.sessionsScope = scope;
|
|
519874
519977
|
try {
|
|
519875
519978
|
const sessions = scope === "all" ? await this.harness.listSessions({}) : await this.harness.listSessions({ workDir: this.state.appState.workDir });
|
|
519876
|
-
this.state.sessions = sessionRowsForPicker(sessions, this.state.appState.sessionId, this.hasSessionContent());
|
|
519979
|
+
this.state.sessions = await enrichSessionRowsForPicker(sessionRowsForPicker(sessions, this.state.appState.sessionId, this.hasSessionContent()));
|
|
519877
519980
|
} catch {} finally {
|
|
519878
519981
|
this.state.loadingSessions = false;
|
|
519879
519982
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blun-king-cli",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.525",
|
|
4
4
|
"description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "node --test test/*.test.js",
|
|
12
|
-
"prepack": "node scripts/check-release-metadata.js && node scripts/check-todo-loop-regression.js && node scripts/check-todo-recovery-catalog-regression.js && node scripts/check-historical-tool-result-preview-regression.js && node scripts/check-session-start-hook-context-regression.js && node scripts/check-queue-controls-regression.js && node scripts/check-approval-queue-shortcuts-regression.js && node scripts/check-telegram-bridge-watchdog.js && node scripts/check-resume-replay-regression.js && node scripts/check-session-cancel-regression.js && node scripts/check-plugin-startup-regression.js && node scripts/check-active-profile-plugin-startup.js && node scripts/check-mcp-startup-wait-budget.js",
|
|
12
|
+
"prepack": "node scripts/check-release-metadata.js && node scripts/check-shell-terminal-isolation-regression.js && node scripts/check-todo-loop-regression.js && node scripts/check-telegram-loop-exactly-once-regression.js && node scripts/check-session-picker-resume-metrics-regression.js && node scripts/check-bundled-agent-spine-regression.js && node scripts/check-todo-recovery-catalog-regression.js && node scripts/check-historical-tool-result-preview-regression.js && node scripts/check-session-start-hook-context-regression.js && node scripts/check-queue-controls-regression.js && node scripts/check-approval-queue-shortcuts-regression.js && node scripts/check-approval-observability-regression.js && node scripts/check-slash-escape-regression.js && node scripts/check-telegram-bridge-watchdog.js && node scripts/check-resume-replay-regression.js && node scripts/check-session-cancel-regression.js && node scripts/check-plugin-startup-regression.js && node scripts/check-active-profile-plugin-startup.js && node scripts/check-mcp-startup-wait-budget.js",
|
|
13
13
|
"release:verify": "node scripts/check-release-metadata.js --external",
|
|
14
14
|
"postinstall": "node scripts/fix-node-pty-perms.js"
|
|
15
15
|
},
|
|
@@ -38,15 +38,21 @@
|
|
|
38
38
|
"scripts/check-package-regression.js",
|
|
39
39
|
"scripts/check-active-profile-plugin-startup.js",
|
|
40
40
|
"scripts/check-approval-queue-shortcuts-regression.js",
|
|
41
|
+
"scripts/check-bundled-agent-spine-regression.js",
|
|
42
|
+
"scripts/check-approval-observability-regression.js",
|
|
43
|
+
"scripts/check-slash-escape-regression.js",
|
|
41
44
|
"scripts/check-mcp-startup-wait-budget.js",
|
|
42
45
|
"scripts/check-plugin-startup-regression.js",
|
|
43
46
|
"scripts/check-queue-controls-regression.js",
|
|
44
47
|
"scripts/check-telegram-bridge-watchdog.js",
|
|
45
48
|
"scripts/check-resume-replay-regression.js",
|
|
46
49
|
"scripts/check-session-cancel-regression.js",
|
|
50
|
+
"scripts/check-shell-terminal-isolation-regression.js",
|
|
51
|
+
"scripts/check-session-picker-resume-metrics-regression.js",
|
|
47
52
|
"scripts/check-release-metadata.js",
|
|
48
53
|
"scripts/check-historical-tool-result-preview-regression.js",
|
|
49
54
|
"scripts/check-session-start-hook-context-regression.js",
|
|
55
|
+
"scripts/check-telegram-loop-exactly-once-regression.js",
|
|
50
56
|
"scripts/check-todo-recovery-catalog-regression.js",
|
|
51
57
|
"scripts/check-todo-loop-regression.js",
|
|
52
58
|
"scripts/fix-node-pty-perms.js",
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const assert = require('node:assert/strict');
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
|
|
8
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
9
|
+
const bundlePath = process.env.BLUN_BUNDLE_UNDER_TEST
|
|
10
|
+
? path.resolve(process.env.BLUN_BUNDLE_UNDER_TEST)
|
|
11
|
+
: path.join(packageRoot, 'blun.mjs');
|
|
12
|
+
const relayPath = process.env.BLUN_APPROVAL_RELAY_UNDER_TEST
|
|
13
|
+
? path.resolve(process.env.BLUN_APPROVAL_RELAY_UNDER_TEST)
|
|
14
|
+
: path.join(packageRoot, 'bin', 'telegram-approval-relay.cjs');
|
|
15
|
+
const pluginRelayPath = process.env.BLUN_PLUGIN_APPROVAL_RELAY_UNDER_TEST
|
|
16
|
+
? path.resolve(process.env.BLUN_PLUGIN_APPROVAL_RELAY_UNDER_TEST)
|
|
17
|
+
: path.join(packageRoot, 'telegram-plugin', 'bin', 'telegram-approval-relay.cjs');
|
|
18
|
+
|
|
19
|
+
const bundle = fs.readFileSync(bundlePath, 'utf8');
|
|
20
|
+
const requestToolApproval = bundle.match(
|
|
21
|
+
/async requestToolApproval\(context, result, policyName\) \{[\s\S]*?\n\t\t\}/,
|
|
22
|
+
);
|
|
23
|
+
assert(requestToolApproval, 'APPROVAL_OBSERVABILITY_REGRESSION: requestToolApproval is missing');
|
|
24
|
+
assert.match(
|
|
25
|
+
requestToolApproval[0],
|
|
26
|
+
/this\.agent\.records\.logRecord\(\{[\s\S]*?type: "permission\.approval_requested"[\s\S]*?toolCallId: id[\s\S]*?toolName: name/,
|
|
27
|
+
'APPROVAL_OBSERVABILITY_REGRESSION: opening an approval is invisible in the wire',
|
|
28
|
+
);
|
|
29
|
+
assert(
|
|
30
|
+
requestToolApproval[0].indexOf('type: "permission.approval_requested"')
|
|
31
|
+
< requestToolApproval[0].indexOf('await this.agent.rpc.requestApproval'),
|
|
32
|
+
'APPROVAL_OBSERVABILITY_REGRESSION: approval wire event is emitted too late',
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const ApprovalProbe = Function(`return class ApprovalProbe {${requestToolApproval[0]}};`)();
|
|
36
|
+
const wireRecords = [];
|
|
37
|
+
const probe = new ApprovalProbe();
|
|
38
|
+
probe.agent = {
|
|
39
|
+
records: { logRecord(record) { wireRecords.push(record); } },
|
|
40
|
+
rpc: { async requestApproval() { return { decision: 'approved' }; } },
|
|
41
|
+
hooks: { fireAndForgetTrigger() {} },
|
|
42
|
+
telemetry: { track() {} },
|
|
43
|
+
};
|
|
44
|
+
probe.recordApprovalResult = () => {};
|
|
45
|
+
probe.permissionPolicyResolutionToPrepare = () => undefined;
|
|
46
|
+
probe.formatApprovalRejectionMessage = () => '';
|
|
47
|
+
|
|
48
|
+
const approvalRun = probe.requestToolApproval({
|
|
49
|
+
signal: new AbortController().signal,
|
|
50
|
+
turnId: 7,
|
|
51
|
+
toolCall: { id: 'tool-7', name: 'Bash' },
|
|
52
|
+
execution: {
|
|
53
|
+
description: 'Run command',
|
|
54
|
+
display: { kind: 'command', command: 'echo ok' },
|
|
55
|
+
},
|
|
56
|
+
args: { command: 'echo ok' },
|
|
57
|
+
}, {}, 'manual-approval');
|
|
58
|
+
assert.equal(wireRecords.length, 1, 'approval request must be written before awaiting a response');
|
|
59
|
+
assert.deepEqual(
|
|
60
|
+
wireRecords[0],
|
|
61
|
+
{
|
|
62
|
+
type: 'permission.approval_requested',
|
|
63
|
+
turnId: 7,
|
|
64
|
+
toolCallId: 'tool-7',
|
|
65
|
+
toolName: 'Bash',
|
|
66
|
+
action: 'Run command',
|
|
67
|
+
display: { kind: 'command', command: 'echo ok' },
|
|
68
|
+
policyName: 'manual-approval',
|
|
69
|
+
},
|
|
70
|
+
'approval wire record lost identifying fields',
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
function checkRelay(modulePath, label) {
|
|
74
|
+
delete require.cache[require.resolve(modulePath)];
|
|
75
|
+
const { resolveTelegramApprovalTarget } = require(modulePath);
|
|
76
|
+
assert.equal(
|
|
77
|
+
resolveTelegramApprovalTarget(['1605241602', '-1003927574737']),
|
|
78
|
+
'1605241602',
|
|
79
|
+
`${label}: one authorized private chat must be selected even when groups are also allowed`,
|
|
80
|
+
);
|
|
81
|
+
assert.equal(
|
|
82
|
+
resolveTelegramApprovalTarget(['0', '-1003927574737']),
|
|
83
|
+
null,
|
|
84
|
+
`${label}: zero is not a positive private Telegram chat ID`,
|
|
85
|
+
);
|
|
86
|
+
assert.equal(
|
|
87
|
+
resolveTelegramApprovalTarget(['1605241602', '8711923962', '-1003927574737']),
|
|
88
|
+
null,
|
|
89
|
+
`${label}: multiple authorized private chats must remain fail-closed`,
|
|
90
|
+
);
|
|
91
|
+
assert.equal(
|
|
92
|
+
resolveTelegramApprovalTarget(['1605241602', '8711923962'], '8711923962'),
|
|
93
|
+
'8711923962',
|
|
94
|
+
`${label}: an explicitly configured authorized chat must win`,
|
|
95
|
+
);
|
|
96
|
+
assert.equal(
|
|
97
|
+
resolveTelegramApprovalTarget(['1605241602'], '-1003927574737'),
|
|
98
|
+
null,
|
|
99
|
+
`${label}: an unauthorized configured chat must be rejected`,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
checkRelay(relayPath, 'package relay');
|
|
104
|
+
checkRelay(pluginRelayPath, 'plugin relay');
|
|
105
|
+
|
|
106
|
+
approvalRun.then(() => {
|
|
107
|
+
process.stdout.write('approval-observability-regression PASS\n');
|
|
108
|
+
}).catch((error) => {
|
|
109
|
+
process.stderr.write(`${error.stack || error.message}\n`);
|
|
110
|
+
process.exitCode = 1;
|
|
111
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const assert = require('node:assert/strict');
|
|
2
|
+
const { execFileSync } = require('node:child_process');
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
const expectedVersion = '0.11.4';
|
|
7
|
+
const pluginRoot = process.env.BLUN_AGENT_SPINE_ROOT_UNDER_TEST
|
|
8
|
+
? path.resolve(process.env.BLUN_AGENT_SPINE_ROOT_UNDER_TEST)
|
|
9
|
+
: path.resolve(__dirname, '..', 'agent-spine-plugin');
|
|
10
|
+
|
|
11
|
+
function readJson(relativePath) {
|
|
12
|
+
return JSON.parse(fs.readFileSync(path.join(pluginRoot, relativePath), 'utf8'));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
for (const relativePath of [
|
|
16
|
+
'package.json',
|
|
17
|
+
'hooks/version.json',
|
|
18
|
+
'.claude-plugin/plugin.json',
|
|
19
|
+
'.codex-plugin/plugin.json',
|
|
20
|
+
'blun.plugin.json',
|
|
21
|
+
]) {
|
|
22
|
+
assert.equal(
|
|
23
|
+
readJson(relativePath).version,
|
|
24
|
+
expectedVersion,
|
|
25
|
+
`BUNDLED_AGENT_SPINE_REGRESSION: ${relativePath} must declare ${expectedVersion}`,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const runtimeVersion = execFileSync(
|
|
30
|
+
process.execPath,
|
|
31
|
+
[path.join(pluginRoot, 'bin', 'agentspine.js'), '--version'],
|
|
32
|
+
{ encoding: 'utf8' },
|
|
33
|
+
).trim();
|
|
34
|
+
assert.equal(
|
|
35
|
+
runtimeVersion,
|
|
36
|
+
expectedVersion,
|
|
37
|
+
'BUNDLED_AGENT_SPINE_REGRESSION: packaged runtime version is stale',
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
for (const relativePath of ['CONTRIBUTING.md', 'SECURITY.md']) {
|
|
41
|
+
assert.equal(
|
|
42
|
+
fs.existsSync(path.join(pluginRoot, relativePath)),
|
|
43
|
+
true,
|
|
44
|
+
`BUNDLED_AGENT_SPINE_REGRESSION: README link target ${relativePath} is missing`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(`bundled-agent-spine-regression PASS (${expectedVersion})`);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const assert = require('node:assert/strict');
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
|
|
5
|
+
const bundlePath = process.env.BLUN_BUNDLE_UNDER_TEST
|
|
6
|
+
? path.resolve(process.env.BLUN_BUNDLE_UNDER_TEST)
|
|
7
|
+
: path.join(__dirname, '..', 'blun.mjs');
|
|
8
|
+
const bundle = fs.readFileSync(bundlePath, 'utf8');
|
|
9
|
+
|
|
10
|
+
const rowsMatch = /function sessionRowsForPicker\(sessions, currentSessionId, currentSessionHasContent\) \{([\s\S]*?)\n\}/.exec(bundle);
|
|
11
|
+
assert(rowsMatch, 'SESSION_PICKER_RESUME_METRICS: sessionRowsForPicker is missing');
|
|
12
|
+
const sessionRowsForPicker = Function(
|
|
13
|
+
`return function sessionRowsForPicker(sessions, currentSessionId, currentSessionHasContent) {${rowsMatch[1]}\n};`,
|
|
14
|
+
)();
|
|
15
|
+
|
|
16
|
+
const rows = sessionRowsForPicker([{
|
|
17
|
+
id: 'session-a',
|
|
18
|
+
title: 'A',
|
|
19
|
+
lastPrompt: 'work',
|
|
20
|
+
workDir: 'C:/work',
|
|
21
|
+
updatedAt: 1,
|
|
22
|
+
metadata: {},
|
|
23
|
+
sessionDir: 'C:/state/session-a',
|
|
24
|
+
}], 'other', true);
|
|
25
|
+
assert.equal(rows[0].session_dir, 'C:/state/session-a');
|
|
26
|
+
|
|
27
|
+
const metricsMatch = /async function readSessionResumeMetrics\(session\) \{([\s\S]*?)\n\}\nasync function enrichSessionRowsForPicker/.exec(bundle);
|
|
28
|
+
assert(metricsMatch, 'SESSION_PICKER_RESUME_METRICS: readSessionResumeMetrics is missing');
|
|
29
|
+
|
|
30
|
+
function buildReader({ resumeStat, wireStat, checkpoint }) {
|
|
31
|
+
return Function(
|
|
32
|
+
'join',
|
|
33
|
+
'statSessionFile',
|
|
34
|
+
'loadResumeCheckpoint',
|
|
35
|
+
'SESSION_RESUME_STALE_AFTER_MS',
|
|
36
|
+
`return async function readSessionResumeMetrics(session) {${metricsMatch[1]}\n};`,
|
|
37
|
+
)(
|
|
38
|
+
path.join,
|
|
39
|
+
async (filePath) => filePath.endsWith('resume-checkpoint.json') ? resumeStat : wireStat,
|
|
40
|
+
async () => checkpoint,
|
|
41
|
+
60_000,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
(async () => {
|
|
46
|
+
const missing = await buildReader({ resumeStat: null, wireStat: null, checkpoint: null })({
|
|
47
|
+
session_dir: 'C:/state/session-a',
|
|
48
|
+
});
|
|
49
|
+
assert.deepEqual(missing, { status: 'missing' });
|
|
50
|
+
|
|
51
|
+
const invalid = await buildReader({
|
|
52
|
+
resumeStat: { size: 1_024, mtimeMs: 1_000 },
|
|
53
|
+
wireStat: { size: 2_048, mtimeMs: 1_000 },
|
|
54
|
+
checkpoint: { ok: false },
|
|
55
|
+
})({ session_dir: 'C:/state/session-a' });
|
|
56
|
+
assert.deepEqual(invalid, { status: 'invalid' });
|
|
57
|
+
|
|
58
|
+
const ok = await buildReader({
|
|
59
|
+
resumeStat: { size: 1_024, mtimeMs: 1_000 },
|
|
60
|
+
wireStat: { size: 2_048, mtimeMs: 1_500 },
|
|
61
|
+
checkpoint: {
|
|
62
|
+
ok: true,
|
|
63
|
+
offset: 2_048,
|
|
64
|
+
snapshot: { context: { history: [{}, {}, {}], tokenCount: 1_200 } },
|
|
65
|
+
},
|
|
66
|
+
})({ session_dir: 'C:/state/session-a' });
|
|
67
|
+
assert.deepEqual(ok, {
|
|
68
|
+
status: 'ok',
|
|
69
|
+
resumeBytes: 1_024,
|
|
70
|
+
wireBytes: 2_048,
|
|
71
|
+
messages: 3,
|
|
72
|
+
tokens: 1_200,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const stale = await buildReader({
|
|
76
|
+
resumeStat: { size: 1_024, mtimeMs: 1_000 },
|
|
77
|
+
wireStat: { size: 4_096, mtimeMs: 62_000 },
|
|
78
|
+
checkpoint: {
|
|
79
|
+
ok: true,
|
|
80
|
+
offset: 2_048,
|
|
81
|
+
snapshot: { context: { history: [{}], tokenCount: 500 } },
|
|
82
|
+
},
|
|
83
|
+
})({ session_dir: 'C:/state/session-a' });
|
|
84
|
+
assert.equal(stale.status, 'stale');
|
|
85
|
+
assert.equal(stale.wireBytes, 4_096);
|
|
86
|
+
|
|
87
|
+
const renderBlock = /const resume = session\.resume;([\s\S]*?)\n\t\treturn card;/.exec(bundle);
|
|
88
|
+
assert(renderBlock, 'SESSION_PICKER_RESUME_METRICS: resume metrics are not rendered');
|
|
89
|
+
assert.match(renderBlock[1], /formatByteSize\(resume\.resumeBytes\)/);
|
|
90
|
+
assert.match(renderBlock[1], /formatByteSize\(resume\.wireBytes\)/);
|
|
91
|
+
assert.match(renderBlock[1], /sessionPicker\.resume\.stale/);
|
|
92
|
+
|
|
93
|
+
console.log('session-picker-resume-metrics-regression PASS');
|
|
94
|
+
})().catch((error) => {
|
|
95
|
+
console.error(error);
|
|
96
|
+
process.exitCode = 1;
|
|
97
|
+
});
|
|
@@ -33,6 +33,15 @@ const stringPredicate = bundle.match(
|
|
|
33
33
|
const trigger = bundle.match(
|
|
34
34
|
/async triggerSessionStart\(source\) \{[\s\S]*?\n\t\t\}/,
|
|
35
35
|
);
|
|
36
|
+
const scheduler = bundle.match(
|
|
37
|
+
/scheduleSessionStart\(source\) \{[\s\S]*?\n\t\t\}/,
|
|
38
|
+
);
|
|
39
|
+
const createMain = bundle.match(
|
|
40
|
+
/async createMain\(\) \{[\s\S]*?\n\t\t\}/,
|
|
41
|
+
);
|
|
42
|
+
const resume = bundle.match(
|
|
43
|
+
/async resume\(\) \{[\s\S]*?\n\t\t\}/,
|
|
44
|
+
);
|
|
36
45
|
|
|
37
46
|
assert(renderer, 'SESSION_START_HOOK_CONTEXT_REGRESSION: SessionStart renderer is missing');
|
|
38
47
|
assert(allowRenderer, 'SESSION_START_HOOK_CONTEXT_REGRESSION: shared allow renderer is missing');
|
|
@@ -40,6 +49,9 @@ assert(wrapperRenderer, 'SESSION_START_HOOK_CONTEXT_REGRESSION: hook wrapper ren
|
|
|
40
49
|
assert(messageSelector, 'SESSION_START_HOOK_CONTEXT_REGRESSION: hook message selector is missing');
|
|
41
50
|
assert(stringPredicate, 'SESSION_START_HOOK_CONTEXT_REGRESSION: hook string predicate is missing');
|
|
42
51
|
assert(trigger, 'SESSION_START_HOOK_CONTEXT_REGRESSION: SessionStart trigger is missing');
|
|
52
|
+
assert(scheduler, 'SESSION_START_HOOK_CONTEXT_REGRESSION: non-blocking SessionStart scheduler is missing');
|
|
53
|
+
assert(createMain, 'SESSION_START_HOOK_CONTEXT_REGRESSION: createMain is missing');
|
|
54
|
+
assert(resume, 'SESSION_START_HOOK_CONTEXT_REGRESSION: resume is missing');
|
|
43
55
|
assert(
|
|
44
56
|
/renderAllowHookResult\("SessionStart", results\)/.test(renderer[0]),
|
|
45
57
|
'SESSION_START_HOOK_CONTEXT_REGRESSION: SessionStart output is not rendered',
|
|
@@ -58,7 +70,21 @@ assert(
|
|
|
58
70
|
);
|
|
59
71
|
assert(
|
|
60
72
|
/await mainAgent\.records\.flush\(\)/.test(trigger[0]),
|
|
61
|
-
'SESSION_START_HOOK_CONTEXT_REGRESSION: SessionStart reminder is not flushed
|
|
73
|
+
'SESSION_START_HOOK_CONTEXT_REGRESSION: completed SessionStart reminder is not flushed',
|
|
74
|
+
);
|
|
75
|
+
assert(
|
|
76
|
+
/this\.scheduleSessionStart\("startup"\)/.test(createMain[0])
|
|
77
|
+
&& !/await this\.triggerSessionStart\("startup"\)/.test(createMain[0]),
|
|
78
|
+
'SESSION_START_HOOK_CONTEXT_REGRESSION: fresh-session input is still blocked by SessionStart',
|
|
79
|
+
);
|
|
80
|
+
assert(
|
|
81
|
+
/this\.scheduleSessionStart\("resume"\)/.test(resume[0])
|
|
82
|
+
&& !/await this\.triggerSessionStart\("resume"\)/.test(resume[0]),
|
|
83
|
+
'SESSION_START_HOOK_CONTEXT_REGRESSION: resumed-session input is still blocked by SessionStart',
|
|
84
|
+
);
|
|
85
|
+
assert(
|
|
86
|
+
/void this\.triggerSessionStart\(source\)\.catch\(/.test(scheduler[0]),
|
|
87
|
+
'SESSION_START_HOOK_CONTEXT_REGRESSION: SessionStart is not detached from interactive startup',
|
|
62
88
|
);
|
|
63
89
|
|
|
64
90
|
const packageRoot = path.resolve(__dirname, '..');
|
|
@@ -75,11 +101,11 @@ const blunSessionStart = agentSpineManifest.hooks.find(
|
|
|
75
101
|
const codexSessionStart = agentSpineCodexHooks.hooks.SessionStart?.[0]?.hooks?.[0];
|
|
76
102
|
|
|
77
103
|
assert(
|
|
78
|
-
blunSessionStart?.timeout >=
|
|
79
|
-
'SESSION_START_HOOK_CONTEXT_REGRESSION: BLUN AgentSpine SessionStart timeout must cover
|
|
104
|
+
blunSessionStart?.timeout >= 180,
|
|
105
|
+
'SESSION_START_HOOK_CONTEXT_REGRESSION: BLUN AgentSpine SessionStart timeout must cover the measured 123.6 s cold scan',
|
|
80
106
|
);
|
|
81
107
|
assert(
|
|
82
|
-
codexSessionStart?.timeout >=
|
|
108
|
+
codexSessionStart?.timeout >= 180,
|
|
83
109
|
'SESSION_START_HOOK_CONTEXT_REGRESSION: Codex AgentSpine SessionStart timeout must match the BLUN runtime budget',
|
|
84
110
|
);
|
|
85
111
|
|
|
@@ -126,9 +152,16 @@ const triggerFunction = trigger[0].replace(
|
|
|
126
152
|
/^async triggerSessionStart/,
|
|
127
153
|
'async function triggerSessionStart',
|
|
128
154
|
);
|
|
155
|
+
const schedulerFunction = scheduler[0].replace(
|
|
156
|
+
/^scheduleSessionStart/,
|
|
157
|
+
'function scheduleSessionStart',
|
|
158
|
+
);
|
|
129
159
|
const runTrigger = Function(
|
|
130
160
|
`${wrapperRenderer[0]}\n${messageSelector[0]}\n${stringPredicate[0]}\n${allowRenderer[0]}\n${renderer[0]}\n${triggerFunction}\nreturn triggerSessionStart;`,
|
|
131
161
|
)();
|
|
162
|
+
const scheduleTrigger = Function(
|
|
163
|
+
`${schedulerFunction}\nreturn scheduleSessionStart;`,
|
|
164
|
+
)();
|
|
132
165
|
|
|
133
166
|
(async () => {
|
|
134
167
|
const reminders = [];
|
|
@@ -171,6 +204,23 @@ const runTrigger = Function(
|
|
|
171
204
|
'runtime probe used the wrong reminder origin',
|
|
172
205
|
);
|
|
173
206
|
|
|
207
|
+
let detachedCompleted = false;
|
|
208
|
+
const detachedStartedAt = Date.now();
|
|
209
|
+
scheduleTrigger.call({
|
|
210
|
+
async triggerSessionStart(source) {
|
|
211
|
+
assert(source === 'startup', 'detached runtime probe lost the startup source');
|
|
212
|
+
await new Promise((resolve) => setTimeout(resolve, 75));
|
|
213
|
+
detachedCompleted = true;
|
|
214
|
+
},
|
|
215
|
+
log: { warn() {} },
|
|
216
|
+
}, 'startup');
|
|
217
|
+
assert(
|
|
218
|
+
Date.now() - detachedStartedAt < 50 && detachedCompleted === false,
|
|
219
|
+
'SessionStart scheduler still waits for the hook before returning',
|
|
220
|
+
);
|
|
221
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
222
|
+
assert(detachedCompleted, 'detached SessionStart hook did not finish in the background');
|
|
223
|
+
|
|
174
224
|
process.stdout.write('session-start-hook-context-regression PASS\n');
|
|
175
225
|
})().catch((error) => {
|
|
176
226
|
process.stderr.write(`${error.stack || error.message}\n`);
|