@cortexkit/opencode-magic-context 0.36.0 → 0.36.1
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/config/index.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-dw9fs934.js → conflict-warning-hook-mt0ttc4x.js} +2 -2
- package/dist/features/magic-context/context-authority.d.ts +12 -0
- package/dist/features/magic-context/context-authority.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts +2 -0
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +2 -0
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/lease.d.ts +10 -3
- package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +2 -0
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/module-apply.d.ts +5 -0
- package/dist/features/magic-context/dreamer/module-apply.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/promote-primers.d.ts +2 -0
- package/dist/features/magic-context/dreamer/promote-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts +2 -0
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +5 -2
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +2 -0
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts +2 -0
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/schema-fence-probe.d.ts +1 -0
- package/dist/features/magic-context/schema-fence-probe.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/condition-compiler.d.ts +1 -0
- package/dist/features/magic-context/smart-notes/condition-compiler.d.ts.map +1 -1
- package/dist/features/magic-context/storage-clone.d.ts +6 -0
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-identity-merge.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +2 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +1 -1
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts +2 -0
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/hooks/magic-context/child-session-spawn.d.ts +1 -0
- package/dist/hooks/magic-context/child-session-spawn.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-off-transition.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts +5 -3
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -1
- package/dist/hooks/magic-context/embed-session-state.d.ts +1 -1
- package/dist/hooks/magic-context/embed-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +8 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts +5 -2
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +1 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +20 -3
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +1 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +3 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +6 -1
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-3nfgbsp4.js → index-1skzp4dc.js} +347 -44
- package/dist/{index-z8v31d85.js → index-3zqcdwqr.js} +137 -10
- package/dist/{index-0c9dmw9m.js → index-8mtsfhyg.js} +33 -3
- package/dist/{index-37rt2bka.js → index-zp6x6s6a.js} +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +820 -548
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rust-tool-backends.d.ts +4 -0
- package/dist/plugin/rust-tool-backends.d.ts.map +1 -1
- package/dist/{recomp-orchestrator-7wbbvf87.js → recomp-orchestrator-a0g9b52q.js} +3 -3
- package/dist/shared/conflict-fixer.d.ts.map +1 -1
- package/dist/shared/jsonc-edit.d.ts +18 -0
- package/dist/shared/jsonc-edit.d.ts.map +1 -0
- package/dist/shared/jsonc-parser.d.ts +11 -1
- package/dist/shared/jsonc-parser.d.ts.map +1 -1
- package/dist/shared/prompt-surface.d.ts +5 -3
- package/dist/shared/prompt-surface.d.ts.map +1 -1
- package/dist/shared/rpc-utils.d.ts +16 -0
- package/dist/shared/rpc-utils.d.ts.map +1 -1
- package/dist/shared/tui-preferences.d.ts +9 -0
- package/dist/shared/tui-preferences.d.ts.map +1 -1
- package/dist/{storage-meta-session-kh5egr11.js → storage-meta-session-df9tstzr.js} +1 -1
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/config/index.test.ts +23 -0
- package/src/config/index.ts +41 -9
- package/src/config/schema/magic-context.test.ts +2 -1
- package/src/config/schema/magic-context.ts +3 -3
- package/src/shared/conflict-fixer.test.ts +174 -0
- package/src/shared/conflict-fixer.ts +66 -70
- package/src/shared/jsonc-edit.ts +295 -0
- package/src/shared/jsonc-parser.test.ts +33 -0
- package/src/shared/jsonc-parser.ts +54 -2
- package/src/shared/prompt-surface.test.ts +53 -2
- package/src/shared/prompt-surface.ts +20 -9
- package/src/shared/rpc-utils.test.ts +36 -0
- package/src/shared/rpc-utils.ts +71 -0
- package/src/shared/tui-preferences.test.ts +52 -2
- package/src/shared/tui-preferences.ts +42 -17
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
readSessionChunk,
|
|
36
36
|
stableStringify,
|
|
37
37
|
updateSessionMeta
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-3zqcdwqr.js";
|
|
39
39
|
import {
|
|
40
40
|
Database,
|
|
41
41
|
closeQuietly,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
} from "./index-3tnkymva.js";
|
|
45
45
|
import {
|
|
46
46
|
detectConfigFile
|
|
47
|
-
} from "./index-
|
|
47
|
+
} from "./index-8mtsfhyg.js";
|
|
48
48
|
import {
|
|
49
49
|
pushNotification
|
|
50
50
|
} from "./index-d62ypazr.js";
|
|
@@ -389,6 +389,171 @@ function buildPrimaryLanguageDirective(language) {
|
|
|
389
389
|
return `Use ${target} for your natural-language replies to the user unless the user explicitly asks for another language. Keep code, identifiers, file paths, commands, logs, and quoted text verbatim.`;
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
+
// src/features/magic-context/fail-closed-block.ts
|
|
393
|
+
var FAIL_CLOSED_DOCTOR_COMMAND = "npx @cortexkit/magic-context@latest doctor";
|
|
394
|
+
var FAIL_CLOSED_REPROBE_EVERY_N = 5;
|
|
395
|
+
|
|
396
|
+
class FailClosedBlockingError extends Error {
|
|
397
|
+
code = "FAIL_CLOSED_BLOCKING";
|
|
398
|
+
reason;
|
|
399
|
+
constructor(message, reason, options) {
|
|
400
|
+
super(message, options);
|
|
401
|
+
this.name = "FailClosedBlockingError";
|
|
402
|
+
this.reason = reason;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
var OPENCODE_INTERNAL_AGENT_NAMES = new Set(["title", "summary", "compaction"]);
|
|
406
|
+
function isMagicContextHiddenAgentName(agent) {
|
|
407
|
+
if (agent === "sidekick" || agent === "smart-note-compiler" || agent.startsWith("smart-note-")) {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
if (agent === "historian" || agent.startsWith("historian-"))
|
|
411
|
+
return true;
|
|
412
|
+
if (agent === "dreamer" || agent.startsWith("dreamer-"))
|
|
413
|
+
return true;
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
var MAX_FORMATTED_BLOCKING_PROCESSES = 8;
|
|
417
|
+
function formatFailClosedBlockingProcesses(processes) {
|
|
418
|
+
const uniqueProcesses = new Map;
|
|
419
|
+
for (const process2 of processes) {
|
|
420
|
+
if (!process2.harness.trim() || !Number.isInteger(process2.pid) || process2.pid <= 0)
|
|
421
|
+
continue;
|
|
422
|
+
uniqueProcesses.set(`${process2.harness}\x00${process2.pid}`, {
|
|
423
|
+
harness: process2.harness.trim(),
|
|
424
|
+
pid: process2.pid
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
const entries = [...uniqueProcesses.values()];
|
|
428
|
+
const visible = entries.slice(0, MAX_FORMATTED_BLOCKING_PROCESSES);
|
|
429
|
+
const rendered = visible.map(({ harness, pid }) => `${harness} (PID ${pid})`);
|
|
430
|
+
const omitted = entries.length - visible.length;
|
|
431
|
+
if (omitted > 0)
|
|
432
|
+
rendered.push(`${omitted} more blocking process(es)`);
|
|
433
|
+
if (rendered.length === 0)
|
|
434
|
+
return "a live harness process";
|
|
435
|
+
if (rendered.length === 1)
|
|
436
|
+
return rendered[0];
|
|
437
|
+
const last = rendered.pop();
|
|
438
|
+
return `${rendered.join(", ")}, and ${last}`;
|
|
439
|
+
}
|
|
440
|
+
function formatFailClosedBlockingMessage(reason) {
|
|
441
|
+
if (reason.kind === "migration_guard") {
|
|
442
|
+
if (reason.unreadableFile) {
|
|
443
|
+
const arm = reason.unreadableArm ?? "io";
|
|
444
|
+
const recovery = arm === "io" ? `If no OpenCode server is running, it is safe to delete ${reason.unreadableFile} and retry.` : `The file may be a recent incomplete write; retry after the file is older than the ten-minute grace window, or stop OpenCode before deleting it.`;
|
|
445
|
+
return [
|
|
446
|
+
`Magic Context cannot migrate the shared database because RPC discovery file ${reason.unreadableFile} is uncertain (${arm} arm), so the absence of a live OpenCode server cannot be proven.`,
|
|
447
|
+
recovery,
|
|
448
|
+
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
449
|
+
].join(" ");
|
|
450
|
+
}
|
|
451
|
+
return [
|
|
452
|
+
`Magic Context cannot migrate the shared database because ${formatFailClosedBlockingProcesses(reason.blockingProcesses)} may be running an older Magic Context build that would fail against the migrated database.`,
|
|
453
|
+
"Restart the blocking process (it will pick up the new build and migrate on start), or shut it down and retry.",
|
|
454
|
+
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
455
|
+
].join(" ");
|
|
456
|
+
}
|
|
457
|
+
if (reason.kind === "schema_fence") {
|
|
458
|
+
return [
|
|
459
|
+
`Magic Context cannot operate: this Magic Context build is older than the database; upgrade/restart this harness (upstream migration lane v${reason.persistedVersion}, build supports through v${reason.supportedVersion}).`,
|
|
460
|
+
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
461
|
+
].join(" ");
|
|
462
|
+
}
|
|
463
|
+
const cause = reason.cause.trim().length > 0 ? reason.cause.trim() : "unknown storage error";
|
|
464
|
+
return [
|
|
465
|
+
`Magic Context cannot operate: persistent storage failed (${cause}).`,
|
|
466
|
+
"The plugin will not silently degrade to native compaction while enabled.",
|
|
467
|
+
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
468
|
+
].join(" ");
|
|
469
|
+
}
|
|
470
|
+
function createFailClosedBlockingError(reason, options) {
|
|
471
|
+
return new FailClosedBlockingError(formatFailClosedBlockingMessage(reason), reason, options);
|
|
472
|
+
}
|
|
473
|
+
function isFailClosedBlockingError(error) {
|
|
474
|
+
return error instanceof FailClosedBlockingError || typeof error === "object" && error !== null && error.name === "FailClosedBlockingError" && error.code === "FAIL_CLOSED_BLOCKING";
|
|
475
|
+
}
|
|
476
|
+
function shouldBypassFailClosedBlock(input) {
|
|
477
|
+
if (input.isPiSubagentEnv === true)
|
|
478
|
+
return true;
|
|
479
|
+
if (input.isInternalChildSession === true)
|
|
480
|
+
return true;
|
|
481
|
+
const agent = typeof input.agent === "string" ? input.agent.trim() : "";
|
|
482
|
+
if (agent.length === 0)
|
|
483
|
+
return false;
|
|
484
|
+
if (OPENCODE_INTERNAL_AGENT_NAMES.has(agent))
|
|
485
|
+
return true;
|
|
486
|
+
if (isMagicContextHiddenAgentName(agent))
|
|
487
|
+
return true;
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
function resolveAgentNameFromMessages(messages) {
|
|
491
|
+
for (let i = messages.length - 1;i >= 0; i -= 1) {
|
|
492
|
+
const info = messages[i]?.info;
|
|
493
|
+
if (!info || typeof info !== "object")
|
|
494
|
+
continue;
|
|
495
|
+
const agent = info.agent;
|
|
496
|
+
if (typeof agent === "string" && agent.length > 0)
|
|
497
|
+
return agent;
|
|
498
|
+
}
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
function createFailClosedController(options) {
|
|
502
|
+
const reprobeEveryN = Math.max(1, options?.reprobeEveryN ?? FAIL_CLOSED_REPROBE_EVERY_N);
|
|
503
|
+
let reason = null;
|
|
504
|
+
let blockedPassCount = 0;
|
|
505
|
+
return {
|
|
506
|
+
arm(next) {
|
|
507
|
+
reason = next;
|
|
508
|
+
blockedPassCount = 0;
|
|
509
|
+
},
|
|
510
|
+
clear() {
|
|
511
|
+
reason = null;
|
|
512
|
+
blockedPassCount = 0;
|
|
513
|
+
},
|
|
514
|
+
isArmed() {
|
|
515
|
+
return reason !== null;
|
|
516
|
+
},
|
|
517
|
+
getReason() {
|
|
518
|
+
return reason;
|
|
519
|
+
},
|
|
520
|
+
async enforce(input) {
|
|
521
|
+
if (!reason)
|
|
522
|
+
return;
|
|
523
|
+
if (!input.blockingEnabled)
|
|
524
|
+
return;
|
|
525
|
+
if (input.exempt)
|
|
526
|
+
return;
|
|
527
|
+
blockedPassCount += 1;
|
|
528
|
+
const shouldReprobe = typeof input.tryReopen === "function" && (blockedPassCount === 1 || blockedPassCount % reprobeEveryN === 0);
|
|
529
|
+
if (shouldReprobe) {
|
|
530
|
+
try {
|
|
531
|
+
const healed = await input.tryReopen?.();
|
|
532
|
+
if (healed) {
|
|
533
|
+
reason = null;
|
|
534
|
+
blockedPassCount = 0;
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
} catch {}
|
|
538
|
+
}
|
|
539
|
+
const blockedReason = reason;
|
|
540
|
+
if (!blockedReason)
|
|
541
|
+
return;
|
|
542
|
+
throw createFailClosedBlockingError(blockedReason);
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
var lastHookInitFailure = null;
|
|
547
|
+
function recordHookInitFailure(failure) {
|
|
548
|
+
lastHookInitFailure = failure;
|
|
549
|
+
}
|
|
550
|
+
function clearHookInitFailure() {
|
|
551
|
+
lastHookInitFailure = null;
|
|
552
|
+
}
|
|
553
|
+
function getLastHookInitFailure() {
|
|
554
|
+
return lastHookInitFailure;
|
|
555
|
+
}
|
|
556
|
+
|
|
392
557
|
// src/features/magic-context/storage-db.ts
|
|
393
558
|
import {
|
|
394
559
|
chmodSync,
|
|
@@ -451,6 +616,7 @@ var PS_PROBE_TIMEOUT_MS = 1000;
|
|
|
451
616
|
var OPEN_CODE_COMMAND_MARKERS = ["opencode", "node", "bun", "electron"];
|
|
452
617
|
var rpcIdentityReadFileSync = readFileSync;
|
|
453
618
|
var rpcIdentityExecFileSync = execFileSync;
|
|
619
|
+
var rpcProcessListExecFileSync = execFileSync;
|
|
454
620
|
var rpcIdentityPlatform = process.platform;
|
|
455
621
|
var rpcIdentityNowMs = () => Date.now();
|
|
456
622
|
function parseLinuxProcessStartTime(statContent, uptimeContent) {
|
|
@@ -523,6 +689,49 @@ function isPidIdentityPlausible(record) {
|
|
|
523
689
|
return true;
|
|
524
690
|
return commandLooksLikeOpenCode(command);
|
|
525
691
|
}
|
|
692
|
+
function commandLooksLikePi(command) {
|
|
693
|
+
const normalized = command.trim().toLowerCase().replaceAll("\\", "/");
|
|
694
|
+
const tokens = normalized.split(/\s+/).filter(Boolean);
|
|
695
|
+
const executableName = (token) => (token ?? "").split("/").at(-1) ?? "";
|
|
696
|
+
const first = executableName(tokens[0]).replace(/\.exe$/, "");
|
|
697
|
+
if (["pi", "pi.cmd", "omp", "oh-my-pi"].includes(first))
|
|
698
|
+
return true;
|
|
699
|
+
if (["node", "bun", "deno"].includes(first)) {
|
|
700
|
+
const script = executableName(tokens[1]);
|
|
701
|
+
return ["pi", "pi.js", "pi.mjs", "pi.cjs"].includes(script) || normalized.includes("pi-coding-agent");
|
|
702
|
+
}
|
|
703
|
+
return false;
|
|
704
|
+
}
|
|
705
|
+
function inspectLivePiProcesses() {
|
|
706
|
+
if (false) {}
|
|
707
|
+
try {
|
|
708
|
+
const output = String(rpcProcessListExecFileSync("ps", ["-axo", "pid=,command="], {
|
|
709
|
+
encoding: "utf8",
|
|
710
|
+
timeout: PS_PROBE_TIMEOUT_MS
|
|
711
|
+
}));
|
|
712
|
+
const pids = new Set;
|
|
713
|
+
for (const line of output.split(/\r?\n/)) {
|
|
714
|
+
const match = /^\s*(\d+)\s+(.+)$/.exec(line);
|
|
715
|
+
if (!match)
|
|
716
|
+
continue;
|
|
717
|
+
const pid = Number(match[1]);
|
|
718
|
+
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid)
|
|
719
|
+
continue;
|
|
720
|
+
if (commandLooksLikePi(match[2]))
|
|
721
|
+
pids.add(pid);
|
|
722
|
+
}
|
|
723
|
+
return { state: "known", processIds: [...pids].sort((left, right) => left - right) };
|
|
724
|
+
} catch (error) {
|
|
725
|
+
return {
|
|
726
|
+
state: "unreadable",
|
|
727
|
+
processIds: [],
|
|
728
|
+
error: error instanceof Error ? error.message : String(error)
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
function discoverLivePiProcessIds() {
|
|
733
|
+
return inspectLivePiProcesses().processIds;
|
|
734
|
+
}
|
|
526
735
|
function parseRpcPortFile(content, fallbackPid = 0) {
|
|
527
736
|
const trimmed = content.trim();
|
|
528
737
|
if (!trimmed)
|
|
@@ -1251,7 +1460,8 @@ function prepareMirrorPageStatements(db) {
|
|
|
1251
1460
|
deleteNote: db.prepare("DELETE FROM notes WHERE id = ?"),
|
|
1252
1461
|
deleteNoteRevisions: db.prepare("DELETE FROM mirror_note_revisions WHERE module_project = ? AND module_row_id = ?"),
|
|
1253
1462
|
updateNote: db.prepare(`UPDATE notes SET type = ?, status = ?, project_path = ?, session_id = ?, content = ?,
|
|
1254
|
-
surface_condition = ?,
|
|
1463
|
+
surface_condition = ?, compiled_provider = ?, compiled_config = ?, compiled_at = ?, compile_status = ?,
|
|
1464
|
+
ready_at = ?, ready_reason = ?, manifest_json = ?, compiled_check = ?,
|
|
1255
1465
|
check_hash = ?, check_cron = ?, check_failure_count = ?, check_network_failure_count = ?,
|
|
1256
1466
|
check_quarantined_until = ?, check_next_due_at = ?, check_compiled_at = ?, check_false_since_at = ?,
|
|
1257
1467
|
check_last_liveness_at = ?, last_checked_at = ?, check_status = ?, check_version = ?,
|
|
@@ -1325,6 +1535,18 @@ function prepareMirrorPageStatements(db) {
|
|
|
1325
1535
|
function mirrorIdentity(db, domain, moduleProject, moduleRowId, statements) {
|
|
1326
1536
|
return (statements?.identityByModule ?? db.prepare("SELECT context_row_id FROM mirror_identity WHERE domain = ? AND module_project = ? AND module_row_id = ?")).get(domain, moduleProject, moduleRowId) ?? null;
|
|
1327
1537
|
}
|
|
1538
|
+
function applyMirroredNoteCompileFields(args) {
|
|
1539
|
+
return withPrivilegedWriter(args.db, () => {
|
|
1540
|
+
const result = args.db.prepare(`UPDATE notes
|
|
1541
|
+
SET compiled_provider = ?, compiled_config = ?, compiled_at = ?, compile_status = ?
|
|
1542
|
+
WHERE id = (
|
|
1543
|
+
SELECT context_row_id
|
|
1544
|
+
FROM mirror_identity
|
|
1545
|
+
WHERE domain = 'notes' AND module_project = ? AND module_row_id = ?
|
|
1546
|
+
)`).run(args.fields.compiledProvider, args.fields.compiledConfig, args.fields.compiledAt, args.fields.compileStatus, args.moduleProject, args.moduleRowId);
|
|
1547
|
+
return result.changes === 1;
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1328
1550
|
function rememberIdentity(db, domain, moduleProject, moduleRowId, contextRowId, statements) {
|
|
1329
1551
|
const existing = mirrorIdentity(db, domain, moduleProject, moduleRowId, statements);
|
|
1330
1552
|
if (existing)
|
|
@@ -1507,7 +1729,7 @@ function applyNoteRow(db, feed, statements) {
|
|
|
1507
1729
|
}
|
|
1508
1730
|
const moduleStatus = rowString(effectiveRow, "status", "active");
|
|
1509
1731
|
const contextStatus = moduleStatus === "surfaced" || moduleStatus === "surfacing" ? "ready" : moduleStatus;
|
|
1510
|
-
statements.updateNote.run(rowString(effectiveRow, "type", "smart"), contextStatus, moduleProject, rowNullableString(effectiveRow, "session_id"), rowString(effectiveRow, "content"), rowNullableString(effectiveRow, "surface_condition"), typeof effectiveRow.ready_at === "number" ? effectiveRow.ready_at : null, rowNullableString(effectiveRow, "ready_reason"), rowNullableString(effectiveRow, "manifest_json"), rowNullableString(effectiveRow, "compiled_check"), rowNullableString(effectiveRow, "check_hash"), rowNullableString(effectiveRow, "check_cron"), rowNumber(effectiveRow, "check_failure_count"), rowNumber(effectiveRow, "check_network_failure_count"), typeof effectiveRow.check_quarantined_until === "number" ? effectiveRow.check_quarantined_until : null, typeof effectiveRow.check_next_due_at === "number" ? effectiveRow.check_next_due_at : null, typeof effectiveRow.check_compiled_at === "number" ? effectiveRow.check_compiled_at : null, typeof effectiveRow.check_false_since_at === "number" ? effectiveRow.check_false_since_at : null, typeof effectiveRow.check_last_liveness_at === "number" ? effectiveRow.check_last_liveness_at : null, typeof effectiveRow.last_checked_at === "number" ? effectiveRow.last_checked_at : null, rowString(effectiveRow, "check_status", "uncompiled"), rowNumber(effectiveRow, "check_version"), rowNumber(effectiveRow, "policy_version", 1), rowNullableString(effectiveRow, "anchor_block_id"), typeof effectiveRow.anchor_ordinal === "number" ? effectiveRow.anchor_ordinal : null, rowNumber(effectiveRow, "created_at_ms"), rowNumber(effectiveRow, "updated_at_ms"), contextId);
|
|
1732
|
+
statements.updateNote.run(rowString(effectiveRow, "type", "smart"), contextStatus, moduleProject, rowNullableString(effectiveRow, "session_id"), rowString(effectiveRow, "content"), rowNullableString(effectiveRow, "surface_condition"), rowNullableString(effectiveRow, "compiled_provider"), rowNullableString(effectiveRow, "compiled_config"), typeof effectiveRow.compiled_at === "number" ? effectiveRow.compiled_at : null, rowNullableString(effectiveRow, "compile_status"), typeof effectiveRow.ready_at === "number" ? effectiveRow.ready_at : null, rowNullableString(effectiveRow, "ready_reason"), rowNullableString(effectiveRow, "manifest_json"), rowNullableString(effectiveRow, "compiled_check"), rowNullableString(effectiveRow, "check_hash"), rowNullableString(effectiveRow, "check_cron"), rowNumber(effectiveRow, "check_failure_count"), rowNumber(effectiveRow, "check_network_failure_count"), typeof effectiveRow.check_quarantined_until === "number" ? effectiveRow.check_quarantined_until : null, typeof effectiveRow.check_next_due_at === "number" ? effectiveRow.check_next_due_at : null, typeof effectiveRow.check_compiled_at === "number" ? effectiveRow.check_compiled_at : null, typeof effectiveRow.check_false_since_at === "number" ? effectiveRow.check_false_since_at : null, typeof effectiveRow.check_last_liveness_at === "number" ? effectiveRow.check_last_liveness_at : null, typeof effectiveRow.last_checked_at === "number" ? effectiveRow.last_checked_at : null, rowString(effectiveRow, "check_status", "uncompiled"), rowNumber(effectiveRow, "check_version"), rowNumber(effectiveRow, "policy_version", 1), rowNullableString(effectiveRow, "anchor_block_id"), typeof effectiveRow.anchor_ordinal === "number" ? effectiveRow.anchor_ordinal : null, rowNumber(effectiveRow, "created_at_ms"), rowNumber(effectiveRow, "updated_at_ms"), contextId);
|
|
1511
1733
|
statements.upsertNoteRevision.run(moduleProject, feed.module_row_id, contextId, rowNumber(effectiveRow, "status_version"));
|
|
1512
1734
|
}
|
|
1513
1735
|
function applyMirrorPage(args) {
|
|
@@ -5407,14 +5629,16 @@ function enforceMigrationOnOpenGuard(db, dbPath, dbDir, latestSupportedVersion)
|
|
|
5407
5629
|
return true;
|
|
5408
5630
|
}
|
|
5409
5631
|
const discovery = inspectRpcServerDiscovery(dbDir);
|
|
5410
|
-
|
|
5632
|
+
const piPids = discoverLivePiProcessIds();
|
|
5633
|
+
if ((discovery.state === "absent" || discovery.state === "stale") && piPids.length === 0) {
|
|
5411
5634
|
lastMigrationOnOpenRefusal = null;
|
|
5412
5635
|
return true;
|
|
5413
5636
|
}
|
|
5637
|
+
const blockingPids = [...new Set([...discovery.serverPids, ...piPids])].sort((left, right) => left - right);
|
|
5414
5638
|
lastMigrationOnOpenRefusal = {
|
|
5415
5639
|
persistedVersion,
|
|
5416
5640
|
supportedVersion: latestSupportedVersion,
|
|
5417
|
-
serverPids:
|
|
5641
|
+
serverPids: blockingPids,
|
|
5418
5642
|
...discovery.unreadableFile ? { unreadableFile: discovery.unreadableFile } : {},
|
|
5419
5643
|
...discovery.unreadableArm ? { unreadableArm: discovery.unreadableArm } : {}
|
|
5420
5644
|
};
|
|
@@ -5424,7 +5648,11 @@ function enforceMigrationOnOpenGuard(db, dbPath, dbDir, latestSupportedVersion)
|
|
|
5424
5648
|
const recovery = arm === "io" ? `If no OpenCode server is running, it is safe to delete ${unreadableFile} and retry.` : `Retry after the file is older than the ten-minute grace window, or stop OpenCode before deleting it.`;
|
|
5425
5649
|
log(`[magic-context] storage fatal: refusing to migrate ${dbPath} from upstream migration v${persistedVersion} to v${latestSupportedVersion} because RPC discovery file ${unreadableFile} is uncertain (${arm} arm), so the absence of a live OpenCode server cannot be proven. ${recovery}`);
|
|
5426
5650
|
} else {
|
|
5427
|
-
|
|
5651
|
+
const blockers = [
|
|
5652
|
+
...discovery.serverPids.map((pid) => `OpenCode server PID ${pid}`),
|
|
5653
|
+
...piPids.map((pid) => `Pi harness PID ${pid}`)
|
|
5654
|
+
];
|
|
5655
|
+
log(`[magic-context] storage fatal: refusing to migrate ${dbPath} from upstream migration v${persistedVersion} to v${latestSupportedVersion} while ${blockers.join(", ")} may still use the old plugin build. Restart the blocking harness, then retry this process.`);
|
|
5428
5656
|
}
|
|
5429
5657
|
return false;
|
|
5430
5658
|
}
|
|
@@ -6698,13 +6926,14 @@ var state = {
|
|
|
6698
6926
|
noticeEmitted: false,
|
|
6699
6927
|
failure: null
|
|
6700
6928
|
};
|
|
6701
|
-
function recordStaleFence(persistedVersion, supportedVersion) {
|
|
6929
|
+
function recordStaleFence(persistedVersion, supportedVersion, reason = "newer_schema") {
|
|
6702
6930
|
state.consecutiveFailures += 1;
|
|
6703
6931
|
state.totalFailures += 1;
|
|
6704
6932
|
const latched = state.consecutiveFailures >= STALE_CHILD_SPAWN_LATCH_THRESHOLD;
|
|
6705
6933
|
state.latched ||= latched;
|
|
6706
6934
|
const failure = {
|
|
6707
6935
|
failureClass: STALE_CHILD_SPAWN_FAILURE,
|
|
6936
|
+
reason,
|
|
6708
6937
|
persistedVersion,
|
|
6709
6938
|
supportedVersion,
|
|
6710
6939
|
consecutiveFailures: state.consecutiveFailures,
|
|
@@ -6731,7 +6960,7 @@ function probeChildSpawnFence(db) {
|
|
|
6731
6960
|
return recordStaleFence(persistedVersion, LATEST_SUPPORTED_VERSION);
|
|
6732
6961
|
}
|
|
6733
6962
|
} catch {
|
|
6734
|
-
return
|
|
6963
|
+
return recordStaleFence(LATEST_SUPPORTED_VERSION, LATEST_SUPPORTED_VERSION, "read_error");
|
|
6735
6964
|
}
|
|
6736
6965
|
state.consecutiveFailures = 0;
|
|
6737
6966
|
state.latched = false;
|
|
@@ -9336,25 +9565,31 @@ var ERROR_CLASSES = new Set([
|
|
|
9336
9565
|
]);
|
|
9337
9566
|
// src/hooks/magic-context/child-session-spawn.ts
|
|
9338
9567
|
var STALE_PLUGIN_RESTART_NOTICE = "Magic Context: plugin build is older than its database — restart OpenCode";
|
|
9339
|
-
|
|
9568
|
+
var SCHEMA_PROBE_FAILURE_NOTICE = `Magic Context: unable to verify the database schema before spawning a child — run ${FAIL_CLOSED_DOCTOR_COMMAND}`;
|
|
9569
|
+
async function surfaceSchemaFenceFailure(args, failure) {
|
|
9340
9570
|
if (!args.parentSessionId)
|
|
9341
9571
|
return;
|
|
9342
|
-
|
|
9343
|
-
|
|
9572
|
+
const notice = failure.reason === "read_error" ? SCHEMA_PROBE_FAILURE_NOTICE : STALE_PLUGIN_RESTART_NOTICE;
|
|
9573
|
+
if (args.db) {
|
|
9574
|
+
try {
|
|
9344
9575
|
updateSessionMeta(args.db, args.parentSessionId, {
|
|
9345
|
-
lastTransformError:
|
|
9576
|
+
lastTransformError: notice
|
|
9346
9577
|
});
|
|
9578
|
+
} catch (error) {
|
|
9579
|
+
sessionLog(args.parentSessionId, `schema-fence warning persistence failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
9347
9580
|
}
|
|
9581
|
+
}
|
|
9582
|
+
try {
|
|
9348
9583
|
pushNotification("toast", {
|
|
9349
9584
|
title: "Magic Context",
|
|
9350
|
-
message:
|
|
9585
|
+
message: notice,
|
|
9351
9586
|
variant: "error",
|
|
9352
9587
|
duration: 1e4
|
|
9353
9588
|
}, args.parentSessionId);
|
|
9354
9589
|
pushNotification("action", { action: "refresh-sidebar" }, args.parentSessionId);
|
|
9355
|
-
await sendIgnoredMessage(args.client, args.parentSessionId,
|
|
9590
|
+
await sendIgnoredMessage(args.client, args.parentSessionId, notice, args.notificationParams ?? {}, true);
|
|
9356
9591
|
} catch (error) {
|
|
9357
|
-
sessionLog(args.parentSessionId, `
|
|
9592
|
+
sessionLog(args.parentSessionId, `schema-fence warning delivery failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
9358
9593
|
}
|
|
9359
9594
|
}
|
|
9360
9595
|
async function createChildSessionWithFence(args) {
|
|
@@ -9367,7 +9602,7 @@ async function createChildSessionWithFence(args) {
|
|
|
9367
9602
|
if (args.onFenceLatched)
|
|
9368
9603
|
await args.onFenceLatched(verdict.failure);
|
|
9369
9604
|
else
|
|
9370
|
-
await
|
|
9605
|
+
await surfaceSchemaFenceFailure(args, verdict.failure);
|
|
9371
9606
|
}
|
|
9372
9607
|
return null;
|
|
9373
9608
|
}
|
|
@@ -9784,11 +10019,21 @@ function normalizeSDKResponse(response, fallback, options) {
|
|
|
9784
10019
|
return fallback;
|
|
9785
10020
|
}
|
|
9786
10021
|
// src/shared/prompt-surface.ts
|
|
10022
|
+
function promptSurfaceConfigIdentity(config) {
|
|
10023
|
+
return JSON.stringify({
|
|
10024
|
+
default: config?.default ?? "full",
|
|
10025
|
+
models: Object.entries(config?.models ?? {}).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0),
|
|
10026
|
+
guidanceOverridePath: config?.guidance_override_path ?? null,
|
|
10027
|
+
toolDescriptions: Object.entries(config?.tool_descriptions ?? {}).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0)
|
|
10028
|
+
});
|
|
10029
|
+
}
|
|
9787
10030
|
function isValidPromptSurfaceModelKey(key) {
|
|
9788
10031
|
if (key.length === 0 || key.trim() !== key)
|
|
9789
10032
|
return false;
|
|
9790
10033
|
const slash = key.indexOf("/");
|
|
9791
|
-
if (slash
|
|
10034
|
+
if (slash < 0)
|
|
10035
|
+
return !key.includes("*");
|
|
10036
|
+
if (slash === 0 || slash === key.length - 1)
|
|
9792
10037
|
return false;
|
|
9793
10038
|
const provider = key.slice(0, slash);
|
|
9794
10039
|
const modelID = key.slice(slash + 1);
|
|
@@ -9839,7 +10084,7 @@ function resolveModelConfigValue(values, modelKey) {
|
|
|
9839
10084
|
function resolvePromptSurface(config, modelKey) {
|
|
9840
10085
|
const fallback = config?.default ?? "full";
|
|
9841
10086
|
const match = resolveModelConfigValue(config?.models, modelKey);
|
|
9842
|
-
if (match
|
|
10087
|
+
if (match) {
|
|
9843
10088
|
return { preset: match.value, source: match.source };
|
|
9844
10089
|
}
|
|
9845
10090
|
return { preset: fallback, source: "default" };
|
|
@@ -26803,14 +27048,14 @@ var PiConfigSchema = exports_external.object({
|
|
|
26803
27048
|
}).optional();
|
|
26804
27049
|
var PromptSurfacePresetSchema = exports_external.enum(["full", "light"]);
|
|
26805
27050
|
var PromptSurfaceModelKeySchema = exports_external.string().refine(isValidPromptSurfaceModelKey, {
|
|
26806
|
-
message: "Use a non-empty provider/model key or the literal provider/* wildcard; model IDs may contain additional slashes and matching is case-sensitive."
|
|
27051
|
+
message: "Use a non-empty bare model key, provider/model key, or the literal provider/* wildcard; model IDs may contain additional slashes and matching is case-sensitive."
|
|
26807
27052
|
});
|
|
26808
27053
|
var PromptSurfaceToolKeySchema = exports_external.string().refine((value) => value.trim().length > 0, {
|
|
26809
27054
|
message: "tool description keys must not be empty or whitespace-only"
|
|
26810
27055
|
});
|
|
26811
27056
|
var PromptSurfaceConfigSchema = exports_external.object({
|
|
26812
27057
|
default: PromptSurfacePresetSchema.default("full").describe('Fallback prompt-surface preset ("full" or "light").'),
|
|
26813
|
-
models: exports_external.record(PromptSurfaceModelKeySchema, PromptSurfacePresetSchema).optional().describe("Literal per-model routing. Keys are provider/model or provider/*; matching is case-sensitive and preserves additional slashes in model IDs."),
|
|
27058
|
+
models: exports_external.record(PromptSurfaceModelKeySchema, PromptSurfacePresetSchema).optional().describe("Literal per-model routing. Keys are bare model IDs, provider/model, or provider/*; matching is case-sensitive and preserves additional slashes in model IDs."),
|
|
26814
27059
|
guidance_override_path: exports_external.string().refine((value) => value.trim().length > 0, {
|
|
26815
27060
|
message: "guidance_override_path must not be empty or whitespace-only"
|
|
26816
27061
|
}).optional().describe("USER-LEVEL ONLY path to a complete primary guidance section. Relative paths resolve from the user config file."),
|
|
@@ -27003,7 +27248,7 @@ var MagicContextConfigSchema = exports_external.object({
|
|
|
27003
27248
|
retina_handoff: exports_external.boolean().default(false).describe("When true, dreamer skips smart notes whose surface conditions compiled to retina provider configs at authoring time. Default false keeps both paths active until the retina consumer is deployed.")
|
|
27004
27249
|
}).default({ retina_handoff: false }).describe("Smart-note ownership transition controls."),
|
|
27005
27250
|
cache_ttl: exports_external.union([exports_external.string(), exports_external.object({ default: exports_external.string() }).catchall(exports_external.string())]).default("5m").describe('Cache TTL: string (e.g. "5m", "1h", "30s") or per-model object ({ default: "5m", "model-id": "10m" }). Set to "never" for lanes kept warm by an external keepwarm proxy — disables the idle-TTL heuristic so MC never initiates a rebuild based on elapsed time.'),
|
|
27006
|
-
prompt_surface: PromptSurfaceConfigSchema.default({ default: "full" }).describe("Prompt-surface presets: default is full; models use
|
|
27251
|
+
prompt_surface: PromptSurfaceConfigSchema.default({ default: "full" }).describe("Prompt-surface presets: default is full; models use bare model IDs, provider/model, or provider/* routing keys. Guidance and tool-description overrides are user-level only. On OpenCode and Pi, per-model routing applies to the guidance block only: tool descriptions are registered once per process, so they follow the default preset (a v1 plugin-surface limitation; per-model tool descriptions are planned for the OpenCode v2 plugin API once the SDK stabilizes)."),
|
|
27007
27252
|
output_reserve: exports_external.union([
|
|
27008
27253
|
exports_external.number().min(0),
|
|
27009
27254
|
exports_external.object({ default: exports_external.number().min(0) }).catchall(exports_external.number().min(0))
|
|
@@ -31379,7 +31624,11 @@ function registerProjectShadowEmbedding(db, projectIdentity, config2, sourceDire
|
|
|
31379
31624
|
const prior = shadowRegistrations.get(projectIdentity);
|
|
31380
31625
|
if (prior && prior.providerIdentity === providerIdentity) {
|
|
31381
31626
|
provider.dispose();
|
|
31627
|
+
dbForShadowQueue.set(projectIdentity, db);
|
|
31382
31628
|
persistShadowDescriptor(db, prior);
|
|
31629
|
+
const backfillAlreadyArmed = hasPendingShadowBackfill(projectIdentity) || shadowQueue.some((item) => item.projectIdentity === projectIdentity);
|
|
31630
|
+
if (!backfillAlreadyArmed)
|
|
31631
|
+
maybeArmShadowBackfill(db, projectIdentity, prior);
|
|
31383
31632
|
return {
|
|
31384
31633
|
...snapshotFor({
|
|
31385
31634
|
projectIdentity,
|
|
@@ -35999,24 +36248,52 @@ class BoundedSessionMap {
|
|
|
35999
36248
|
// src/hooks/magic-context/compartment-render-epoch.ts
|
|
36000
36249
|
var COMPARTMENT_RENDER_EPOCH = "cre2";
|
|
36001
36250
|
var EPOCH_COMPONENT_PREFIX = "|compartment-render:";
|
|
36002
|
-
|
|
36003
|
-
|
|
36004
|
-
|
|
36005
|
-
|
|
36251
|
+
var MURAL_COMPONENT_PREFIX = "|mural-enabled:";
|
|
36252
|
+
var BUDGET_COMPONENT_PREFIX = "|render-budgets:";
|
|
36253
|
+
function encodeCachedM0UpgradeIdentity(upgradeState, compartmentRenderEpoch = COMPARTMENT_RENDER_EPOCH, muralEnabled = null, renderBudgetIdentity = null) {
|
|
36254
|
+
let encoded = upgradeState ?? "";
|
|
36255
|
+
if (compartmentRenderEpoch !== null) {
|
|
36256
|
+
encoded += `${EPOCH_COMPONENT_PREFIX}${compartmentRenderEpoch}`;
|
|
36257
|
+
}
|
|
36258
|
+
if (muralEnabled !== null) {
|
|
36259
|
+
encoded += `${MURAL_COMPONENT_PREFIX}${muralEnabled ? "1" : "0"}`;
|
|
36260
|
+
}
|
|
36261
|
+
if (renderBudgetIdentity !== null) {
|
|
36262
|
+
encoded += `${BUDGET_COMPONENT_PREFIX}${renderBudgetIdentity}`;
|
|
36263
|
+
}
|
|
36264
|
+
return encoded.length > 0 ? encoded : null;
|
|
36265
|
+
}
|
|
36266
|
+
function component(value, prefix) {
|
|
36267
|
+
const start = value.lastIndexOf(prefix);
|
|
36268
|
+
if (start < 0)
|
|
36269
|
+
return null;
|
|
36270
|
+
const valueStart = start + prefix.length;
|
|
36271
|
+
const end = value.indexOf("|", valueStart);
|
|
36272
|
+
const result = value.slice(valueStart, end < 0 ? value.length : end);
|
|
36273
|
+
return result.length > 0 ? result : null;
|
|
36006
36274
|
}
|
|
36007
36275
|
function decodeCachedM0UpgradeIdentity(value) {
|
|
36008
36276
|
if (value === null) {
|
|
36009
|
-
return {
|
|
36010
|
-
|
|
36011
|
-
|
|
36012
|
-
|
|
36013
|
-
|
|
36277
|
+
return {
|
|
36278
|
+
upgradeState: null,
|
|
36279
|
+
compartmentRenderEpoch: null,
|
|
36280
|
+
muralEnabled: null,
|
|
36281
|
+
renderBudgetIdentity: null
|
|
36282
|
+
};
|
|
36014
36283
|
}
|
|
36015
|
-
const
|
|
36016
|
-
|
|
36284
|
+
const componentIndexes = [
|
|
36285
|
+
value.indexOf(EPOCH_COMPONENT_PREFIX),
|
|
36286
|
+
value.indexOf(MURAL_COMPONENT_PREFIX),
|
|
36287
|
+
value.indexOf(BUDGET_COMPONENT_PREFIX)
|
|
36288
|
+
].filter((index) => index >= 0);
|
|
36289
|
+
const identityEnd = componentIndexes.length > 0 ? Math.min(...componentIndexes) : value.length;
|
|
36290
|
+
const upgradeState = value.slice(0, identityEnd);
|
|
36291
|
+
const muralComponent = component(value, MURAL_COMPONENT_PREFIX);
|
|
36017
36292
|
return {
|
|
36018
36293
|
upgradeState: upgradeState.length > 0 ? upgradeState : null,
|
|
36019
|
-
compartmentRenderEpoch:
|
|
36294
|
+
compartmentRenderEpoch: component(value, EPOCH_COMPONENT_PREFIX),
|
|
36295
|
+
muralEnabled: muralComponent === "1" ? true : muralComponent === "0" ? false : null,
|
|
36296
|
+
renderBudgetIdentity: component(value, BUDGET_COMPONENT_PREFIX)
|
|
36020
36297
|
};
|
|
36021
36298
|
}
|
|
36022
36299
|
|
|
@@ -36703,6 +36980,9 @@ function lastCompartmentBoundaryId(compartments) {
|
|
|
36703
36980
|
}
|
|
36704
36981
|
var DEFAULT_HISTORY_BUDGET_TOKENS = 60000;
|
|
36705
36982
|
var DEFAULT_MEMORY_BUDGET_TOKENS = 8000;
|
|
36983
|
+
function renderBudgetIdentity(memoryBudget, historyBudget) {
|
|
36984
|
+
return `m${memoryBudget ?? DEFAULT_MEMORY_BUDGET_TOKENS}-h${historyBudget ?? DEFAULT_HISTORY_BUDGET_TOKENS}`;
|
|
36985
|
+
}
|
|
36706
36986
|
var DEFAULT_USER_PROFILE_BUDGET_TOKENS = 4000;
|
|
36707
36987
|
var MAX_FORCED_MEMORIES_PER_DELTA = 10;
|
|
36708
36988
|
var M0_EMPTY_BODY = "<session-history></session-history>";
|
|
@@ -36976,7 +37256,9 @@ function readCurrentM0SnapshotMarkersUncached(args) {
|
|
|
36976
37256
|
compartmentRenderEpoch: COMPARTMENT_RENDER_EPOCH,
|
|
36977
37257
|
systemHash: hard.systemHash,
|
|
36978
37258
|
modelKey: hard.modelKey,
|
|
36979
|
-
projectIdentity: args.projectPath ?? null
|
|
37259
|
+
projectIdentity: args.projectPath ?? null,
|
|
37260
|
+
muralEnabled: args.muralEnabled === true,
|
|
37261
|
+
renderBudgetIdentity: renderBudgetIdentity(args.memoryInjectionBudgetTokens, args.historyBudgetTokens)
|
|
36980
37262
|
}
|
|
36981
37263
|
};
|
|
36982
37264
|
}
|
|
@@ -36989,7 +37271,9 @@ function refreshVolatileMarkerInputs(markers, args) {
|
|
|
36989
37271
|
materializedAt: Date.now(),
|
|
36990
37272
|
systemHash: hard.systemHash,
|
|
36991
37273
|
modelKey: hard.modelKey,
|
|
36992
|
-
projectIdentity: args.projectPath ?? null
|
|
37274
|
+
projectIdentity: args.projectPath ?? null,
|
|
37275
|
+
muralEnabled: args.muralEnabled === true,
|
|
37276
|
+
renderBudgetIdentity: renderBudgetIdentity(args.memoryInjectionBudgetTokens, args.historyBudgetTokens)
|
|
36993
37277
|
};
|
|
36994
37278
|
}
|
|
36995
37279
|
function readCurrentM0SnapshotMarkers(args) {
|
|
@@ -37055,7 +37339,9 @@ function snapshotMarkersFromCachedM0(state2) {
|
|
|
37055
37339
|
systemHash: state2.cachedM0SystemHash ?? "",
|
|
37056
37340
|
modelKey: state2.cachedM0ModelKey ?? "",
|
|
37057
37341
|
projectIdentity: state2.cachedM0ProjectIdentity ?? null,
|
|
37058
|
-
muralHash: state2.cachedM0MuralHash ?? null
|
|
37342
|
+
muralHash: state2.cachedM0MuralHash ?? null,
|
|
37343
|
+
muralEnabled: cachedUpgradeIdentity.muralEnabled,
|
|
37344
|
+
renderBudgetIdentity: cachedUpgradeIdentity.renderBudgetIdentity
|
|
37059
37345
|
};
|
|
37060
37346
|
}
|
|
37061
37347
|
function mustMaterialize(args) {
|
|
@@ -37069,6 +37355,9 @@ function mustMaterialize(args) {
|
|
|
37069
37355
|
if (cachedUpgradeIdentity.compartmentRenderEpoch !== current.compartmentRenderEpoch) {
|
|
37070
37356
|
return { value: true, reason: "compartment_render_epoch" };
|
|
37071
37357
|
}
|
|
37358
|
+
if (cachedUpgradeIdentity.muralEnabled !== null && cachedUpgradeIdentity.muralEnabled !== current.muralEnabled || cachedUpgradeIdentity.renderBudgetIdentity !== null && cachedUpgradeIdentity.renderBudgetIdentity !== current.renderBudgetIdentity) {
|
|
37359
|
+
return { value: true, reason: "render_config" };
|
|
37360
|
+
}
|
|
37072
37361
|
if (hard.modelKey !== "" && hard.modelKey !== (args.state.cachedM0ModelKey ?? "")) {
|
|
37073
37362
|
return { value: true, reason: "model_change" };
|
|
37074
37363
|
}
|
|
@@ -37385,7 +37674,7 @@ function applyMarkersToState(state2, m0Bytes, markers, m1Bytes) {
|
|
|
37385
37674
|
state2.cachedM0ProjectDocsHash = markers.projectDocsHash;
|
|
37386
37675
|
state2.cachedM0MaterializedAt = markers.materializedAt;
|
|
37387
37676
|
state2.cachedM0SessionFactsVersion = markers.sessionFactsVersion;
|
|
37388
|
-
state2.cachedM0UpgradeState = encodeCachedM0UpgradeIdentity(markers.upgradeState, markers.compartmentRenderEpoch);
|
|
37677
|
+
state2.cachedM0UpgradeState = encodeCachedM0UpgradeIdentity(markers.upgradeState, markers.compartmentRenderEpoch, markers.muralEnabled, markers.renderBudgetIdentity);
|
|
37389
37678
|
state2.cachedM0SystemHash = markers.systemHash;
|
|
37390
37679
|
state2.cachedM0ModelKey = markers.modelKey;
|
|
37391
37680
|
state2.cachedM0ProjectIdentity = markers.projectIdentity;
|
|
@@ -37432,6 +37721,9 @@ function materializeM0(options) {
|
|
|
37432
37721
|
projectPath,
|
|
37433
37722
|
projectDirectory,
|
|
37434
37723
|
injectDocs: options.injectDocs,
|
|
37724
|
+
muralEnabled: options.muralEnabled,
|
|
37725
|
+
memoryInjectionBudgetTokens: options.memoryInjectionBudgetTokens,
|
|
37726
|
+
historyBudgetTokens: options.historyBudgetTokens,
|
|
37435
37727
|
hardSignals: options.hardSignals,
|
|
37436
37728
|
workspaceIdentitySet: {
|
|
37437
37729
|
identities: workspace.identities,
|
|
@@ -37527,7 +37819,9 @@ function materializeM0(options) {
|
|
|
37527
37819
|
compartmentRenderEpoch: COMPARTMENT_RENDER_EPOCH,
|
|
37528
37820
|
systemHash: snapshotMarkers.systemHash,
|
|
37529
37821
|
modelKey: snapshotMarkers.modelKey,
|
|
37530
|
-
projectIdentity: projectPath ?? null
|
|
37822
|
+
projectIdentity: projectPath ?? null,
|
|
37823
|
+
muralEnabled: snapshotMarkers.muralEnabled,
|
|
37824
|
+
renderBudgetIdentity: snapshotMarkers.renderBudgetIdentity
|
|
37531
37825
|
};
|
|
37532
37826
|
const memoryEpochStale = current.workspaceFingerprint !== null || snapshotMarkers.workspaceFingerprint !== null ? current.workspaceFingerprint !== snapshotMarkers.workspaceFingerprint : current.projectMemoryEpoch !== snapshotMarkers.projectMemoryEpoch;
|
|
37533
37827
|
const stale = memoryEpochStale || current.projectUserProfileVersion !== snapshotMarkers.projectUserProfileVersion || current.maxCompartmentSeq !== snapshotMarkers.maxCompartmentSeq || current.maxMutationId !== snapshotMarkers.maxMutationId || current.maxMemoryMutationId !== snapshotMarkers.maxMemoryMutationId || current.sessionFactsVersion !== snapshotMarkers.sessionFactsVersion || current.upgradeState !== snapshotMarkers.upgradeState || (current.projectIdentity ?? null) !== (snapshotMarkers.projectIdentity ?? null);
|
|
@@ -37562,7 +37856,7 @@ function materializeM0(options) {
|
|
|
37562
37856
|
projectDocsHash: snapshotMarkers.projectDocsHash,
|
|
37563
37857
|
materializedAt: snapshotMarkers.materializedAt,
|
|
37564
37858
|
sessionFactsVersion: snapshotMarkers.sessionFactsVersion,
|
|
37565
|
-
upgradeState: encodeCachedM0UpgradeIdentity(snapshotMarkers.upgradeState, snapshotMarkers.compartmentRenderEpoch),
|
|
37859
|
+
upgradeState: encodeCachedM0UpgradeIdentity(snapshotMarkers.upgradeState, snapshotMarkers.compartmentRenderEpoch, snapshotMarkers.muralEnabled, snapshotMarkers.renderBudgetIdentity),
|
|
37566
37860
|
systemHash: snapshotMarkers.systemHash,
|
|
37567
37861
|
modelKey: snapshotMarkers.modelKey,
|
|
37568
37862
|
projectIdentity: snapshotMarkers.projectIdentity
|
|
@@ -37802,7 +38096,9 @@ function markersFromCachedRow(row) {
|
|
|
37802
38096
|
systemHash: row.cached_m0_system_hash ?? "",
|
|
37803
38097
|
modelKey: row.cached_m0_model_key ?? "",
|
|
37804
38098
|
projectIdentity: row.cached_m0_project_identity ?? null,
|
|
37805
|
-
muralHash: row.cached_m0_mural_hash ?? null
|
|
38099
|
+
muralHash: row.cached_m0_mural_hash ?? null,
|
|
38100
|
+
muralEnabled: cachedUpgradeIdentity.muralEnabled,
|
|
38101
|
+
renderBudgetIdentity: cachedUpgradeIdentity.renderBudgetIdentity
|
|
37806
38102
|
};
|
|
37807
38103
|
}
|
|
37808
38104
|
function cachedRowMatchesState(row, state2) {
|
|
@@ -37827,7 +38123,7 @@ function applyCachedRowToState(state2, row) {
|
|
|
37827
38123
|
state2.cachedM0ProjectDocsHash = markers.projectDocsHash;
|
|
37828
38124
|
state2.cachedM0MaterializedAt = markers.materializedAt;
|
|
37829
38125
|
state2.cachedM0SessionFactsVersion = markers.sessionFactsVersion;
|
|
37830
|
-
state2.cachedM0UpgradeState = encodeCachedM0UpgradeIdentity(markers.upgradeState, markers.compartmentRenderEpoch);
|
|
38126
|
+
state2.cachedM0UpgradeState = encodeCachedM0UpgradeIdentity(markers.upgradeState, markers.compartmentRenderEpoch, markers.muralEnabled, markers.renderBudgetIdentity);
|
|
37831
38127
|
state2.cachedM0SystemHash = markers.systemHash;
|
|
37832
38128
|
state2.cachedM0ModelKey = markers.modelKey;
|
|
37833
38129
|
state2.cachedM0ProjectIdentity = markers.projectIdentity;
|
|
@@ -37913,6 +38209,10 @@ function renderFreshM0NonPersisted(options) {
|
|
|
37913
38209
|
projectPath,
|
|
37914
38210
|
projectDirectory,
|
|
37915
38211
|
injectDocs: options.injectDocs,
|
|
38212
|
+
muralEnabled: options.muralEnabled,
|
|
38213
|
+
memoryInjectionBudgetTokens: options.memoryInjectionBudgetTokens,
|
|
38214
|
+
historyBudgetTokens: options.historyBudgetTokens,
|
|
38215
|
+
hardSignals: options.hardSignals,
|
|
37916
38216
|
workspaceIdentitySet: {
|
|
37917
38217
|
identities: workspace.identities,
|
|
37918
38218
|
namesByIdentity: workspace.namesByIdentity
|
|
@@ -38009,7 +38309,10 @@ function injectM0M1(options) {
|
|
|
38009
38309
|
projectDirectory: options.projectDirectory,
|
|
38010
38310
|
hardSignals: options.hardSignals,
|
|
38011
38311
|
workspaceIdentitySet: options.workspaceIdentitySet,
|
|
38012
|
-
injectDocs: options.injectDocs
|
|
38312
|
+
injectDocs: options.injectDocs,
|
|
38313
|
+
muralEnabled: options.muralEnabled,
|
|
38314
|
+
memoryInjectionBudgetTokens: options.memoryInjectionBudgetTokens,
|
|
38315
|
+
historyBudgetTokens: options.historyBudgetTokens
|
|
38013
38316
|
});
|
|
38014
38317
|
let rematerialized = false;
|
|
38015
38318
|
let contentionExhausted = false;
|
|
@@ -42351,4 +42654,4 @@ async function runUpgradeMemoryMigration(ctx, sessionId, migrationDirectory) {
|
|
|
42351
42654
|
}
|
|
42352
42655
|
}
|
|
42353
42656
|
|
|
42354
|
-
export { withContentLanguageDirective, buildPrimaryLanguageDirective, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, resolveLegacyConfigSourcesForHarness, migrateMagicContextConfigLocations, exports_external, DEFAULT_PROTECTED_TAGS, parseCron, nextOccurrence, nextDueAtMs, resolvePromptSurface, resolveModelConfigOrDefault, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, DEFAULT_LOCAL_EMBEDDING_MODEL, MagicContextConfigSchema, getOpenCodeDbPath, removeMcOwnedCompactionMarkers, ProjectIdentityError, resolveProjectIdentityStrict, takeDubiousOwnershipProjectIdentityWarning, resolveProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, recordSessionProjectIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, rpcPortDir, rpcPortFilePath, isPidAlive, parseRpcPortFile, registerModuleNoteEvaluationBridge, getModuleNoteEvaluationBridge, getContextStoreUuid, ensureContextStoreUuid, getAuthorityManagedMarker, reconcileAuthorityProject, checksumAuthoritySeedRows, prepareAuthority, drainAuthority, getMirrorCursor, applyMirrorPage, pullMemoryMirrorOnce, V2_MEMORY_CATEGORIES, CATEGORY_PRIORITY, resolveWorkspaceShareCategories, resolveWorkspaceIdentitySet, expandWorkspaceIdentitySetWithAliases, resolveStoredPathWorkspaceIdentity, storedPathBelongsToWorkspace, sourceNameForMemory, computeWorkspaceEpochFingerprint, recordToolDefinition, getMeasuredToolDefinitionTokens, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, getDatabasePath, getPersistedSchemaVersion, setSqlitePragmaConfig, runSqliteOptimize, openDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, clearRecompStaging, recordEmbeddingMeasurement, getMaxM0MutationId, queueMemoryMutation, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationIdForProjects, MAX_EXECUTE_THRESHOLD, escalationBands, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, getEmergencyRecoveryArmedAt, loadPersistedUsage, loadProtectedTailMeta, resetProtectedTailNoEligibleHead, getWrapupInProgressState, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getPersistedReasoningWatermark, setPersistedReasoningWatermark, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getLastNudgeLevel, setLastNudgeLevel, resetLastNudgeCycle, resetLastNudgeCycleIfTailShrank, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, getNoteNudgeAnchors, getAutoSearchHintDecisions, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, pruneAutoSearchHintDecisions, removeNoteNudgeAnchorByMessageId, removeAutoSearchHintDecisionByMessageId, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, setNoteLastReadAt, getHistorianFailureState, clearHistorianFailureState, getOverflowState, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, removeStrippedPlaceholderId, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, addProcessedImageStrippedIds, getPendingCompactionMarkerState, clearPendingCompactionMarkerStateIf, peekDeferredExecutePending, setDeferredExecutePendingIfAbsent, clearDeferredExecutePendingIfMatches, getSessionsWithPendingMarker, setSessionWorkMetrics, getNotes, addNote, getSessionNotes, getPendingSmartNotes, getReadySmartNotes, updateNote, dismissNote, markNoteReady, markNoteChecked, queuePendingOp, getPendingOps, clearPendingOps, removePendingOp, PRIMER_CANDIDATE_TTL_MS, PRIMER_CANDIDATE_MAX_AGE_MS, primerOccurrenceKey, primerOccurrenceUtcDay, updatePrimerCandidateEmbedding, getPrimerCandidatesByIds, getPrimerCandidatesForPromotion, countPrimerCandidatesForProject, getActivePrimers, createPrimer, updatePrimerSupport, updatePrimerAnswer, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectMemoryEpoch, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, getActiveTagTokenAggregate, AGE_RECLAIM_MIN_TOKENS, getOldestActiveUnprotectedToolTags, getActiveToolTagsForAgeReclaim, getTriggerTagTokenUpperBound, getActiveTagTokenTotalsByMessage, tagTokenCountIsNull, backfillTagTokenCounts, insertTag, updateTagStatus, updateTagDropMode, updateCavemanDepth, updateTagMessageId, deleteTagsByMessageId, getMaxTagNumberBySession, getTagNumberByMessageId, deriveTagLoadFloor, getTagsBySession, getActiveTagsBySession, getDroppedTagsBySession, getTagsByNumbers, getMaxDroppedTagNumber, getToolTagNumberByOwner, getNullOwnerToolTag, adoptNullOwnerToolTag, getCandidateToolOwners, pickNearestPriorOwner, createChildSessionWithFence, detectOverflow, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, extractLatestAssistantText, hasLengthCappedOutput, setKeepSubagents, shouldKeepSubagents, recordChildInvocation, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, Priority, AdmissionClass, StaleRouteHandleError, SocketClosedError, SocketTimeoutError, SubcClient, isConsumerReconnectTransient, getCompartmentEvents, loadCompartmentChunkEmbeddingsForSearch, cosineSimilarity, SYNAPSE_DEFAULT_MODEL, SynapseEmbeddingProvider, computeNormalizedHash, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitTimeMs, enforceProjectCap, GIT_SWEEP_LEASE_RENEWAL_MS, acquireGitSweepLease, renewGitSweepLease, markGitSweepSuccessAndRelease, parkGitSweepNonIndexable, releaseGitSweepLease, saveEmbeddingIfHashMatches, getProjectEmbeddings, peekProjectEmbeddings, invalidateProject, invalidateMemory, markProjectLoadUntrusted, contentSha256, sweepStaleEmbeddingIdentitiesForProject, registerProjectEmbedding, registerProjectShadowEmbedding, getShadowEmbeddingMeasurementCohort, getPrimaryEmbeddingMeasurementCohort, embedShadowTextForProject, enqueueShadowEmbeddingItems, registerProjectInObservationMode, getProjectEmbeddingSnapshot, embedTextForProject, embedBatchForProject, embedItemsForProject, embedUnembeddedMemoriesForProject, drainCommitBacklogForProject, embedSessionCompartmentChunks, getEmbeddingCoverageStatus, isEmbeddingEnabled, embedText, ensureMemoryEmbeddings, computeCueContentHash, hasMuralCueColumns, getMuralCueState, memoryNeedsCue, setMuralCue, recordMuralCueRejection, hasMemoryShareableColumn, hasMemoryClassifiedAtColumn, getUnclassifiedMemoryIds, ModuleMemoryAuthorityError, insertMemory, insertMemoryIdempotent, getMemoryByHash, getMemoriesByProject, buildWorkspaceMemorySqlFilter, getMemoriesByProjects, getMaxMemoryIdForProjects, readNewMemoriesForM1Union, getMemoryById, getMemoriesByIds, updateMemorySeenCount, updateMemoryRetrievalCount, setMemoryClassification, supersededMemory, mergeMemoryStats, archiveMemory, getMemoryCountsByStatus, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, MARKER_SUMMARY_TEXT, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, getMural, BoundedSessionMap, extractM0Block, formatDate, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, prepareCompartmentInjection, renderCompartmentInjection, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, injectM0M1, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, RECOVERY_NO_HEAD_LIMIT, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, snapRangeToCompartments, LKG_SNAPSHOT_ARRAY, LKG_SNAPSHOT_OBJECT, LKG_SNAPSHOT_KEY, LKG_SNAPSHOT_STRING, LKG_SNAPSHOT_NUMBER, LKG_SNAPSHOT_BOOLEAN, LKG_SNAPSHOT_NULL, LKG_SNAPSHOT_UNDEFINED, lkgContentDigestFromFields, lkgContentDigest, captureSlot, getSlot, dropSlot, noteEntry, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure, isRecompSkip, isRecompComplete, extractRecompReason, contextualizeUpgradeReason, setRecompStarting, setRecompNote, setRecompTerminal, runManagedRecomp, runManagedUpgrade };
|
|
42657
|
+
export { withContentLanguageDirective, buildPrimaryLanguageDirective, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, resolveLegacyConfigSourcesForHarness, migrateMagicContextConfigLocations, exports_external, DEFAULT_PROTECTED_TAGS, parseCron, nextOccurrence, nextDueAtMs, promptSurfaceConfigIdentity, resolvePromptSurface, resolveModelConfigOrDefault, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, DEFAULT_LOCAL_EMBEDDING_MODEL, MagicContextConfigSchema, getOpenCodeDbPath, removeMcOwnedCompactionMarkers, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, createFailClosedController, recordHookInitFailure, clearHookInitFailure, getLastHookInitFailure, ProjectIdentityError, resolveProjectIdentityStrict, takeDubiousOwnershipProjectIdentityWarning, resolveProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, recordSessionProjectIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, rpcPortDir, rpcPortFilePath, isPidAlive, parseRpcPortFile, registerModuleNoteEvaluationBridge, getModuleNoteEvaluationBridge, getContextStoreUuid, ensureContextStoreUuid, getAuthorityManagedMarker, reconcileAuthorityProject, checksumAuthoritySeedRows, prepareAuthority, drainAuthority, getMirrorCursor, applyMirroredNoteCompileFields, applyMirrorPage, pullMemoryMirrorOnce, V2_MEMORY_CATEGORIES, CATEGORY_PRIORITY, resolveWorkspaceShareCategories, resolveWorkspaceIdentitySet, expandWorkspaceIdentitySetWithAliases, resolveStoredPathWorkspaceIdentity, storedPathBelongsToWorkspace, sourceNameForMemory, computeWorkspaceEpochFingerprint, recordToolDefinition, getMeasuredToolDefinitionTokens, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, getDatabasePath, getPersistedSchemaVersion, setSqlitePragmaConfig, runSqliteOptimize, openDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, clearRecompStaging, recordEmbeddingMeasurement, getMaxM0MutationId, queueMemoryMutation, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationIdForProjects, MAX_EXECUTE_THRESHOLD, escalationBands, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, getEmergencyRecoveryArmedAt, loadPersistedUsage, loadProtectedTailMeta, resetProtectedTailNoEligibleHead, getWrapupInProgressState, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getPersistedReasoningWatermark, setPersistedReasoningWatermark, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getLastNudgeLevel, setLastNudgeLevel, resetLastNudgeCycle, resetLastNudgeCycleIfTailShrank, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, getNoteNudgeAnchors, getAutoSearchHintDecisions, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, pruneAutoSearchHintDecisions, removeNoteNudgeAnchorByMessageId, removeAutoSearchHintDecisionByMessageId, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, setNoteLastReadAt, getHistorianFailureState, clearHistorianFailureState, getOverflowState, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, removeStrippedPlaceholderId, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, addProcessedImageStrippedIds, getPendingCompactionMarkerState, clearPendingCompactionMarkerStateIf, peekDeferredExecutePending, setDeferredExecutePendingIfAbsent, clearDeferredExecutePendingIfMatches, getSessionsWithPendingMarker, setSessionWorkMetrics, getNotes, addNote, getSessionNotes, getPendingSmartNotes, getReadySmartNotes, updateNote, dismissNote, markNoteReady, markNoteChecked, queuePendingOp, getPendingOps, clearPendingOps, removePendingOp, PRIMER_CANDIDATE_TTL_MS, PRIMER_CANDIDATE_MAX_AGE_MS, primerOccurrenceKey, primerOccurrenceUtcDay, updatePrimerCandidateEmbedding, getPrimerCandidatesByIds, getPrimerCandidatesForPromotion, countPrimerCandidatesForProject, getActivePrimers, createPrimer, updatePrimerSupport, updatePrimerAnswer, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectMemoryEpoch, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, getActiveTagTokenAggregate, AGE_RECLAIM_MIN_TOKENS, getOldestActiveUnprotectedToolTags, getActiveToolTagsForAgeReclaim, getTriggerTagTokenUpperBound, getActiveTagTokenTotalsByMessage, tagTokenCountIsNull, backfillTagTokenCounts, insertTag, updateTagStatus, updateTagDropMode, updateCavemanDepth, updateTagMessageId, deleteTagsByMessageId, getMaxTagNumberBySession, getTagNumberByMessageId, deriveTagLoadFloor, getTagsBySession, getActiveTagsBySession, getDroppedTagsBySession, getTagsByNumbers, getMaxDroppedTagNumber, getToolTagNumberByOwner, getNullOwnerToolTag, adoptNullOwnerToolTag, getCandidateToolOwners, pickNearestPriorOwner, createChildSessionWithFence, detectOverflow, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, extractLatestAssistantText, hasLengthCappedOutput, setKeepSubagents, shouldKeepSubagents, recordChildInvocation, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, Priority, AdmissionClass, StaleRouteHandleError, SocketClosedError, SocketTimeoutError, SubcClient, isConsumerReconnectTransient, getCompartmentEvents, loadCompartmentChunkEmbeddingsForSearch, cosineSimilarity, SYNAPSE_DEFAULT_MODEL, SynapseEmbeddingProvider, computeNormalizedHash, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitTimeMs, enforceProjectCap, GIT_SWEEP_LEASE_RENEWAL_MS, acquireGitSweepLease, renewGitSweepLease, markGitSweepSuccessAndRelease, parkGitSweepNonIndexable, releaseGitSweepLease, saveEmbeddingIfHashMatches, getProjectEmbeddings, peekProjectEmbeddings, invalidateProject, invalidateMemory, markProjectLoadUntrusted, contentSha256, sweepStaleEmbeddingIdentitiesForProject, registerProjectEmbedding, registerProjectShadowEmbedding, getShadowEmbeddingMeasurementCohort, getPrimaryEmbeddingMeasurementCohort, embedShadowTextForProject, enqueueShadowEmbeddingItems, registerProjectInObservationMode, getProjectEmbeddingSnapshot, embedTextForProject, embedBatchForProject, embedItemsForProject, embedUnembeddedMemoriesForProject, drainCommitBacklogForProject, embedSessionCompartmentChunks, getEmbeddingCoverageStatus, isEmbeddingEnabled, embedText, ensureMemoryEmbeddings, computeCueContentHash, hasMuralCueColumns, getMuralCueState, memoryNeedsCue, setMuralCue, recordMuralCueRejection, hasMemoryShareableColumn, hasMemoryClassifiedAtColumn, getUnclassifiedMemoryIds, ModuleMemoryAuthorityError, insertMemory, insertMemoryIdempotent, getMemoryByHash, getMemoriesByProject, buildWorkspaceMemorySqlFilter, getMemoriesByProjects, getMaxMemoryIdForProjects, readNewMemoriesForM1Union, getMemoryById, getMemoriesByIds, updateMemorySeenCount, updateMemoryRetrievalCount, setMemoryClassification, supersededMemory, mergeMemoryStats, archiveMemory, getMemoryCountsByStatus, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, MARKER_SUMMARY_TEXT, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, getMural, BoundedSessionMap, extractM0Block, formatDate, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, prepareCompartmentInjection, renderCompartmentInjection, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, injectM0M1, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, RECOVERY_NO_HEAD_LIMIT, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, snapRangeToCompartments, LKG_SNAPSHOT_ARRAY, LKG_SNAPSHOT_OBJECT, LKG_SNAPSHOT_KEY, LKG_SNAPSHOT_STRING, LKG_SNAPSHOT_NUMBER, LKG_SNAPSHOT_BOOLEAN, LKG_SNAPSHOT_NULL, LKG_SNAPSHOT_UNDEFINED, lkgContentDigestFromFields, lkgContentDigest, captureSlot, getSlot, dropSlot, noteEntry, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure, isRecompSkip, isRecompComplete, extractRecompReason, contextualizeUpgradeReason, setRecompStarting, setRecompNote, setRecompTerminal, runManagedRecomp, runManagedUpgrade };
|