@cortexkit/magic-context 0.49.81 → 0.49.82
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/index.js +157 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42758,11 +42758,22 @@ var init_storage_identity_merge = __esm(() => {
|
|
|
42758
42758
|
];
|
|
42759
42759
|
});
|
|
42760
42760
|
|
|
42761
|
+
// ../plugin/src/features/magic-context/memory/identity-merge-command.ts
|
|
42762
|
+
function shellArg(value, platform) {
|
|
42763
|
+
if (/^[\w.:/-]+$/.test(value))
|
|
42764
|
+
return value;
|
|
42765
|
+
return platform === "win32" ? `"${value}"` : `'${value.replaceAll("'", "'\\''")}'`;
|
|
42766
|
+
}
|
|
42767
|
+
function identityMergeCommand(from, to, platform = process.platform) {
|
|
42768
|
+
return `${IDENTITY_MERGE_COMMAND} --from ${shellArg(from, platform)} --to ${to ? shellArg(to, platform) : '"DESTINATION_IDENTITY"'}`;
|
|
42769
|
+
}
|
|
42770
|
+
var IDENTITY_MERGE_COMMAND = "npx @cortexkit/magic-context@latest doctor merge-identities", IDENTITY_MERGE_PREVIEW_HINT = "It shows what would move. Add --apply to move them.";
|
|
42771
|
+
|
|
42761
42772
|
// src/commands/doctor-identity-splits.ts
|
|
42762
42773
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
42763
42774
|
import { createHash as createHash6 } from "node:crypto";
|
|
42764
42775
|
import { existsSync as existsSync34, readdirSync as readdirSync7, realpathSync as realpathSync9, statSync as statSync19 } from "node:fs";
|
|
42765
|
-
import { dirname as dirname21, join as join27, resolve as resolve15 } from "node:path";
|
|
42776
|
+
import { dirname as dirname21, isAbsolute as isAbsolute9, join as join27, resolve as resolve15 } from "node:path";
|
|
42766
42777
|
function tableExists5(db, table) {
|
|
42767
42778
|
return !!db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table);
|
|
42768
42779
|
}
|
|
@@ -42790,6 +42801,39 @@ function orphanedPathReason(directory) {
|
|
|
42790
42801
|
return;
|
|
42791
42802
|
return "directory is empty and has no git metadata";
|
|
42792
42803
|
}
|
|
42804
|
+
function resolveReadOnly(directory) {
|
|
42805
|
+
if (!existsSync34(directory))
|
|
42806
|
+
return;
|
|
42807
|
+
try {
|
|
42808
|
+
const roots = execFileSync6("git", ["rev-list", "--max-parents=0", "HEAD"], {
|
|
42809
|
+
cwd: directory,
|
|
42810
|
+
windowsHide: true,
|
|
42811
|
+
encoding: "utf8",
|
|
42812
|
+
timeout: 5000,
|
|
42813
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
42814
|
+
}).trim().split(/\s+/).filter((root) => /^[0-9a-f]{40,64}$/.test(root)).sort();
|
|
42815
|
+
if (roots[0])
|
|
42816
|
+
return `git:${roots[0]}`;
|
|
42817
|
+
} catch {}
|
|
42818
|
+
try {
|
|
42819
|
+
const result = execFileSync6("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
42820
|
+
cwd: directory,
|
|
42821
|
+
windowsHide: true,
|
|
42822
|
+
encoding: "utf8",
|
|
42823
|
+
timeout: 5000,
|
|
42824
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
42825
|
+
});
|
|
42826
|
+
if (result.trim() === "true")
|
|
42827
|
+
return;
|
|
42828
|
+
} catch (error) {
|
|
42829
|
+
if (String(error.stderr).includes("not a git repository"))
|
|
42830
|
+
return `dir:${createHash6("md5").update(projectDirectoryKey(directory)).digest("hex").slice(0, 12)}`;
|
|
42831
|
+
}
|
|
42832
|
+
return;
|
|
42833
|
+
}
|
|
42834
|
+
function canonicalIdentity(directory, storageDir) {
|
|
42835
|
+
return readRememberedGitIdentity(directory, storageDir) ?? (orphanedPathReason(directory) ? undefined : resolveReadOnly(directory));
|
|
42836
|
+
}
|
|
42793
42837
|
function findIdentitySplits(db, host, includeSingles = false) {
|
|
42794
42838
|
if (!tableExists5(db, "session_projects"))
|
|
42795
42839
|
return [];
|
|
@@ -42855,7 +42899,7 @@ function findIdentitySplits(db, host, includeSingles = false) {
|
|
|
42855
42899
|
const gitIdentities = new Map;
|
|
42856
42900
|
for (const [directoryKey, spellings] of directorySpellings) {
|
|
42857
42901
|
for (const directory of spellings) {
|
|
42858
|
-
const dirIdentity =
|
|
42902
|
+
const dirIdentity = directoryFallback(directory);
|
|
42859
42903
|
const hasData = [
|
|
42860
42904
|
"memories",
|
|
42861
42905
|
"notes",
|
|
@@ -42915,7 +42959,7 @@ function formatIdentitySplits(splits) {
|
|
|
42915
42959
|
...identityLines(split)
|
|
42916
42960
|
] : [
|
|
42917
42961
|
`Project identity split: ${split.directory} (read-only; no merge performed)`,
|
|
42918
|
-
|
|
42962
|
+
` Review with ${IDENTITY_MERGE_COMMAND} before choosing which identity to keep.`,
|
|
42919
42963
|
...identityLines(split)
|
|
42920
42964
|
];
|
|
42921
42965
|
});
|
|
@@ -42923,8 +42967,82 @@ function formatIdentitySplits(splits) {
|
|
|
42923
42967
|
function identityLines(split) {
|
|
42924
42968
|
return split.identities.map((row) => ` ${row.identity}: ${row.sessions} sessions, ${row.memories} memories, ${row.notes} notes, ${row.dreamer} dreamer rows (identity-wide counts)`);
|
|
42925
42969
|
}
|
|
42970
|
+
function eventDirectory(data, sessionId) {
|
|
42971
|
+
try {
|
|
42972
|
+
const event = JSON.parse(data);
|
|
42973
|
+
const directory = event?.location?.directory;
|
|
42974
|
+
if (event?.sessionID === sessionId && typeof directory === "string" && isAbsolute9(directory))
|
|
42975
|
+
return directory;
|
|
42976
|
+
} catch {}
|
|
42977
|
+
}
|
|
42978
|
+
function readSessionMoves(host) {
|
|
42979
|
+
if (!host || !tableExists5(host, "session_v2") || !tableExists5(host, "event"))
|
|
42980
|
+
return [];
|
|
42981
|
+
try {
|
|
42982
|
+
return host.prepare(`SELECT s.id, s.directory, c.data AS initial, m.data AS latest
|
|
42983
|
+
FROM session_v2 AS s
|
|
42984
|
+
JOIN event AS c ON c.aggregate_id = s.id AND c.seq = 0 AND c.type = 'session.created.1'
|
|
42985
|
+
JOIN event AS m ON m.aggregate_id = s.id AND m.seq = (
|
|
42986
|
+
SELECT MAX(seq) FROM event WHERE aggregate_id = s.id AND type GLOB 'session.moved.*'
|
|
42987
|
+
) AND m.type = 'session.moved.1' AND m.seq > c.seq`).all();
|
|
42988
|
+
} catch {
|
|
42989
|
+
return [];
|
|
42990
|
+
}
|
|
42991
|
+
}
|
|
42992
|
+
function formatStrandedDirectoryMemories(db, host, storageDir, splits) {
|
|
42993
|
+
if (!tableExists5(db, "memories") || !tableExists5(db, "session_projects"))
|
|
42994
|
+
return [];
|
|
42995
|
+
const seen = new Set(splits.flatMap(({ identities }) => identities.map(({ identity }) => identity)));
|
|
42996
|
+
const stranded = db.prepare(`SELECT m.project_path AS identity, COUNT(*) AS memories,
|
|
42997
|
+
MAX(MAX(m.last_seen_at, COALESCE(m.last_retrieved_at, 0))) AS lastUse
|
|
42998
|
+
FROM memories AS m WHERE m.project_path GLOB 'dir:*'
|
|
42999
|
+
AND NOT EXISTS (SELECT 1 FROM session_projects AS sp WHERE sp.project_path = m.project_path)
|
|
43000
|
+
GROUP BY m.project_path ORDER BY m.project_path`).all().filter(({ identity }) => !seen.has(identity));
|
|
43001
|
+
if (stranded.length === 0)
|
|
43002
|
+
return [];
|
|
43003
|
+
const keys = new Set(stranded.map(({ identity }) => identity));
|
|
43004
|
+
const binding = db.prepare("SELECT project_path FROM session_projects WHERE session_id = ? AND harness = 'opencode2'");
|
|
43005
|
+
const canonicalKeys = new Map;
|
|
43006
|
+
const sourceFolders = new Map;
|
|
43007
|
+
const destinations = new Map;
|
|
43008
|
+
for (const row of readSessionMoves(host)) {
|
|
43009
|
+
const source = eventDirectory(row.initial, row.id);
|
|
43010
|
+
if (!source)
|
|
43011
|
+
continue;
|
|
43012
|
+
const from = directoryFallback(source);
|
|
43013
|
+
if (!keys.has(from))
|
|
43014
|
+
continue;
|
|
43015
|
+
const latest = eventDirectory(row.latest, row.id);
|
|
43016
|
+
if (source === row.directory)
|
|
43017
|
+
continue;
|
|
43018
|
+
sourceFolders.set(from, source);
|
|
43019
|
+
const current = binding.get(row.id);
|
|
43020
|
+
if (latest === row.directory && current && !canonicalKeys.has(row.directory)) {
|
|
43021
|
+
canonicalKeys.set(row.directory, canonicalIdentity(row.directory, storageDir));
|
|
43022
|
+
}
|
|
43023
|
+
const resolved = canonicalKeys.get(row.directory);
|
|
43024
|
+
const target = latest === row.directory && current?.project_path === resolved ? resolved : undefined;
|
|
43025
|
+
const choices = destinations.get(from) ?? new Set;
|
|
43026
|
+
choices.add(target);
|
|
43027
|
+
destinations.set(from, choices);
|
|
43028
|
+
}
|
|
43029
|
+
return stranded.flatMap(({ identity, memories, lastUse }) => {
|
|
43030
|
+
const time = new Date(lastUse);
|
|
43031
|
+
const when = lastUse > 0 && Number.isFinite(time.getTime()) ? time.toISOString() : "unknown";
|
|
43032
|
+
const choices = destinations.get(identity);
|
|
43033
|
+
const target = choices?.size === 1 ? [...choices][0] : undefined;
|
|
43034
|
+
const from = sourceFolders.get(identity) ?? identity;
|
|
43035
|
+
return [
|
|
43036
|
+
`Memories left under folder key ${identity}: ${memories} ${memories === 1 ? "memory" : "memories"}; last used ${when}. No session is currently recorded for this key.`,
|
|
43037
|
+
target ? " Review a merge into the session's current project:" : " The destination can't be determined. If you choose one, replace DESTINATION_IDENTITY in:",
|
|
43038
|
+
` ${identityMergeCommand(from, target)}`,
|
|
43039
|
+
` ${IDENTITY_MERGE_PREVIEW_HINT}`
|
|
43040
|
+
];
|
|
43041
|
+
});
|
|
43042
|
+
}
|
|
42926
43043
|
function diagnoseIdentitySplits() {
|
|
42927
|
-
const
|
|
43044
|
+
const storageDir = getMagicContextStorageDir();
|
|
43045
|
+
const db = openExistingContextDatabase(join27(storageDir, "context.db"), {
|
|
42928
43046
|
readonly: true
|
|
42929
43047
|
});
|
|
42930
43048
|
if (!db)
|
|
@@ -42932,15 +43050,18 @@ function diagnoseIdentitySplits() {
|
|
|
42932
43050
|
let host = null;
|
|
42933
43051
|
try {
|
|
42934
43052
|
host = openExistingDatabase(resolveOpenCodeDbPath().path, { readonly: true });
|
|
42935
|
-
|
|
42936
|
-
|
|
42937
|
-
|
|
43053
|
+
const splits = host ? findIdentitySplits(db, host) : [];
|
|
43054
|
+
return [
|
|
43055
|
+
...host ? formatIdentitySplits(splits) : ["Identity split check skipped: OpenCode session directories unavailable."],
|
|
43056
|
+
...formatStrandedDirectoryMemories(db, host, storageDir, splits)
|
|
43057
|
+
];
|
|
42938
43058
|
} finally {
|
|
42939
43059
|
host?.close();
|
|
42940
43060
|
db.close();
|
|
42941
43061
|
}
|
|
42942
43062
|
}
|
|
42943
43063
|
var init_doctor_identity_splits = __esm(async () => {
|
|
43064
|
+
init_project_identity();
|
|
42944
43065
|
init_project_identity_cache();
|
|
42945
43066
|
init_data_path();
|
|
42946
43067
|
init_opencode_db_path();
|
|
@@ -42948,7 +43069,6 @@ var init_doctor_identity_splits = __esm(async () => {
|
|
|
42948
43069
|
});
|
|
42949
43070
|
|
|
42950
43071
|
// src/commands/doctor-merge-identity.ts
|
|
42951
|
-
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
42952
43072
|
import { createHash as createHash7 } from "node:crypto";
|
|
42953
43073
|
import { existsSync as existsSync35, mkdtempSync as mkdtempSync2, readdirSync as readdirSync8, readFileSync as readFileSync23, statSync as statSync20 } from "node:fs";
|
|
42954
43074
|
import { dirname as dirname22, join as join28, resolve as resolve16 } from "node:path";
|
|
@@ -43000,39 +43120,6 @@ function printReport(report) {
|
|
|
43000
43120
|
if (report.dryRun)
|
|
43001
43121
|
console.log(" No writes. Review this preview, then repeat with --apply to confirm.");
|
|
43002
43122
|
}
|
|
43003
|
-
function resolveReadOnly(directory) {
|
|
43004
|
-
if (!existsSync35(directory))
|
|
43005
|
-
return;
|
|
43006
|
-
try {
|
|
43007
|
-
const roots = execFileSync7("git", ["rev-list", "--max-parents=0", "HEAD"], {
|
|
43008
|
-
cwd: directory,
|
|
43009
|
-
windowsHide: true,
|
|
43010
|
-
encoding: "utf8",
|
|
43011
|
-
timeout: 5000,
|
|
43012
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
43013
|
-
}).trim().split(/\s+/).filter((root) => /^[0-9a-f]{40,64}$/.test(root)).sort();
|
|
43014
|
-
if (roots[0])
|
|
43015
|
-
return `git:${roots[0]}`;
|
|
43016
|
-
} catch {}
|
|
43017
|
-
try {
|
|
43018
|
-
const result = execFileSync7("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
43019
|
-
cwd: directory,
|
|
43020
|
-
windowsHide: true,
|
|
43021
|
-
encoding: "utf8",
|
|
43022
|
-
timeout: 5000,
|
|
43023
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
43024
|
-
});
|
|
43025
|
-
if (result.trim() === "true")
|
|
43026
|
-
return;
|
|
43027
|
-
} catch (error) {
|
|
43028
|
-
if (String(error.stderr).includes("not a git repository"))
|
|
43029
|
-
return `dir:${createHash7("md5").update(projectDirectoryKey(directory)).digest("hex").slice(0, 12)}`;
|
|
43030
|
-
}
|
|
43031
|
-
return;
|
|
43032
|
-
}
|
|
43033
|
-
function canonicalIdentity(directory, storageDir) {
|
|
43034
|
-
return readRememberedGitIdentity(directory, storageDir) ?? (orphanedPathReason(directory) ? undefined : resolveReadOnly(directory));
|
|
43035
|
-
}
|
|
43036
43123
|
function directoryDoesNotExist(directory) {
|
|
43037
43124
|
try {
|
|
43038
43125
|
statSync20(directory);
|
|
@@ -43174,6 +43261,9 @@ function observations(db, hostPath, storageDir) {
|
|
|
43174
43261
|
}
|
|
43175
43262
|
function runMergeIdentityCli(args, deps = {}) {
|
|
43176
43263
|
const options = parseMergeIdentityArgs(args);
|
|
43264
|
+
if (options.from && !/^(git|dir):/.test(options.from)) {
|
|
43265
|
+
options.from = directoryFallback(options.from);
|
|
43266
|
+
}
|
|
43177
43267
|
const dbPath = options.dbPath ?? join28(getMagicContextStorageDir(), "context.db");
|
|
43178
43268
|
const storageDir = dirname22(dbPath);
|
|
43179
43269
|
const hostPath = options.hostPath ?? (options.dbPath ? join28(storageDir, "host.db") : resolveOpenCodeDbPath().path);
|
|
@@ -46216,6 +46306,11 @@ var init_user_facing_codes = __esm(() => {
|
|
|
46216
46306
|
sentence: "History compression is paused because this session's saved summaries no longer line up with its messages.",
|
|
46217
46307
|
action: "Run /ctx-recomp to rebuild them."
|
|
46218
46308
|
},
|
|
46309
|
+
fork_history_gap: {
|
|
46310
|
+
code: "MC-H09",
|
|
46311
|
+
sentence: "This fork's saved history has a gap.",
|
|
46312
|
+
action: "Run /ctx-recomp to rebuild its history."
|
|
46313
|
+
},
|
|
46219
46314
|
history_boundary_unresolved: {
|
|
46220
46315
|
code: "MC-H04",
|
|
46221
46316
|
sentence: "This request was not sent: it is larger than the model's context window, and Magic Context could not cut the already-summarized history out of it.",
|
|
@@ -49258,6 +49353,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
49258
49353
|
"ERROR [tail-hygiene-last-writer-check-failed]: structural production guard failed open: \x01",
|
|
49259
49354
|
"historian: refreshed stale protected-tail snapshot at run time (was: \x01) — eligible head \x01-\x01",
|
|
49260
49355
|
"mc-module: historian firing for \x01: await_timeout_ms=\x01 attempt_budget_ms=\x01 firing_budget_ms=\x01\x020s",
|
|
49356
|
+
"This session changed projects. \x01 memories stayed with the old project (\x01); nothing moved. \x01\x021p",
|
|
49261
49357
|
"v2 context omitted a content part the host would reject: type=<missing> message=\x01 reason=\x01",
|
|
49262
49358
|
"v2 refusal: interrupting the turn before the provider request arm=compaction-fold cause=\x01",
|
|
49263
49359
|
"[magic-context] host overflow check: using isContextOverflow from @earendil-works/pi-ai",
|
|
@@ -49284,6 +49380,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
49284
49380
|
"compaction-marker drain: retryable failure; preserving deferred history refresh signal \x01",
|
|
49285
49381
|
"LKG SNAPSHOT PREPARATION FAILED; forcing synchronous capture on the next applied pass: \x01",
|
|
49286
49382
|
"mc-module: execute_threshold channel=\x01 model=\x01 configured=\x01 provenance=\x01 effective=\x01 source=\x01",
|
|
49383
|
+
"This session changed projects. \x01 memories stayed with the old folder (\x01); nothing moved. \x01\x021p",
|
|
49287
49384
|
"compaction-marker drain: retryable failure; preserving deferred history refresh signal",
|
|
49288
49385
|
"event message.removed: cleared compaction marker (boundary or summary message removed)",
|
|
49289
49386
|
"LKG SNAPSHOT PREPARATION FAILED; forcing synchronous capture on the next applied pass:",
|
|
@@ -49304,6 +49401,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
49304
49401
|
"[magic-context] host stall profiler: \x01ms main-thread stall, \x01 samples, top owner none → \x01\x022p",
|
|
49305
49402
|
"historian publish stage: stage=post-publish-drops status=started elapsed=0.0ms range=\x01-\x01",
|
|
49306
49403
|
"mc-request-byte-cap refused bytes=\x01 cap=\x01 method=\x01 kind=\x01 session=\x01 page_index=\x01 page_total=\x01",
|
|
49404
|
+
"This session changed projects. \x01 memory stayed with the old project (\x01); nothing moved. \x01\x021p",
|
|
49307
49405
|
"latest-turn thinking recovery: refused locally (the recovery state could not be read)",
|
|
49308
49406
|
"rust compaction-marker drain: candidate preparation deferred; pending target retained",
|
|
49309
49407
|
"served check: record dropped reason=session_cleared; the next request is not compared",
|
|
@@ -49320,6 +49418,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
49320
49418
|
"[magic-context] tool-owner backfill failed (continuing with lazy adoption fallback): \x01",
|
|
49321
49419
|
"historian publish stage: stage=post-publish-drops status=completed elapsed=\x01ms range=\x01-\x01",
|
|
49322
49420
|
"raw_fallback_over_context_limit estimated=\x01 trusted=\x01 proxy_bytes=\x01 proxy_tokens=\x01 limit=\x01",
|
|
49421
|
+
"This session changed projects. \x01 memory stayed with the old folder (\x01); nothing moved. \x01\x021p",
|
|
49323
49422
|
"transform refused degraded pass site=host-instruction-retention-persistence-failure: \x01",
|
|
49324
49423
|
"transform: emergency fail-closed abort failed; refusing to return a sendable prompt: \x01",
|
|
49325
49424
|
"v2 refusal: interrupting the turn before the provider request arm=storage-busy cause=\x01",
|
|
@@ -49954,6 +50053,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
49954
50053
|
"[mc-module][\x01] historian oversize admission refused before spawn: \x01",
|
|
49955
50054
|
"compaction-marker drain: applied at ordinal \x01, boundary user msg \x01 \x01\x021i",
|
|
49956
50055
|
"mc_rust_emergency_refusal frozen_over_proven_limit module=\x01 limit=\x01",
|
|
50056
|
+
"project binding changed harness=\x01 cwd=\x01 old=\x01 new=\x01 memories=\x01 notice=\x01\x021p",
|
|
49957
50057
|
"recovery projection: case=conversation_only released=\x01 normalized=\x01",
|
|
49958
50058
|
"rust input coverage: oc_input=\x01 marker_at=\x01 covered=\x01 first_ordinal=\x01",
|
|
49959
50059
|
"rust parked health probe failed; refusing without a full request \x01",
|
|
@@ -50027,6 +50127,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
50027
50127
|
"mc-module: lineage descent pending build-skew for target \x01 edge \x01",
|
|
50028
50128
|
"native reasoning activation failed; retaining previous replay: \x01",
|
|
50029
50129
|
"placeholder strip: removed=\x01 discovered=\x01 pruned=\x01 keptToolOwners=\x01",
|
|
50130
|
+
"project binding write failed harness=opencode cwd=\x01 attempted=\x01: \x01\x021p",
|
|
50030
50131
|
"project binding write failed harness=opencode cwd=\x01 attempted=\x01: \x01",
|
|
50031
50132
|
"project binding write recovered harness=opencode cwd=\x01 identity=\x01",
|
|
50032
50133
|
"Subagent temperature omitted for \x01: host model metadata says no \x01\x020m",
|
|
@@ -50045,6 +50146,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
50045
50146
|
"transform: cannot force-start compartment agent without client",
|
|
50046
50147
|
"transform: injected memories/facts block (no compartments yet)",
|
|
50047
50148
|
"v2 compaction hook: fired answered=true source=module row=none",
|
|
50149
|
+
"v2 fork saved history has a gap; /ctx-recomp repairs this fork",
|
|
50048
50150
|
'invalid cache_ttl "\x01" in ctx-status; falling back to default 5m',
|
|
50049
50151
|
"v2 boundary trim: dropped \x01 messages before the module boundary",
|
|
50050
50152
|
"Subagent temperature sent for \x01: no host or models.dev metadata\x020m",
|
|
@@ -50243,6 +50345,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
50243
50345
|
"models-dev-cache: output reserve capped at 25% for \x01/\x01: \x01 → \x01\x020m,1m",
|
|
50244
50346
|
"native tag replay unavailable; retaining native history: \x01",
|
|
50245
50347
|
"post-transform snapshot failed; using independent reads: \x01",
|
|
50348
|
+
"project binding changed harness=\x01 cwd=\x01 old=\x01 new=\x01 memories=\x01\x021p",
|
|
50246
50349
|
"system prompt date refresh failed (keeping frozen date): \x01",
|
|
50247
50350
|
"system prompt token estimate failed (using prior count): \x01",
|
|
50248
50351
|
"transform tag persistence failed; not serving this pass: \x01",
|
|
@@ -50316,7 +50419,6 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
50316
50419
|
"event message.removed: pruned auto-search decision for \x01\x020i",
|
|
50317
50420
|
"event session.compacted pending-marker cleanup failed: \x01",
|
|
50318
50421
|
"mc-module: native reasoning replay proof not recorded: \x01",
|
|
50319
|
-
"project binding changed harness=opencode cwd=\x01 old=\x01 new=\x01\x021p,2p",
|
|
50320
50422
|
"reasoning cleanup: cleared=\x01 inlineStripped=\x01 watermark=\x01→\x01",
|
|
50321
50423
|
"WARN: message_end: synthetic todowrite capture failed: \x01",
|
|
50322
50424
|
"[dreamer] retrospective: no reply-following user lines",
|
|
@@ -51136,6 +51238,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
51136
51238
|
"lkg_frozen_replay_released reason=\x01",
|
|
51137
51239
|
"reasoning replay: cleared=\x01 inline=\x01",
|
|
51138
51240
|
"subagent token accounting failed: \x01",
|
|
51241
|
+
"v2 fork skipped compartment \x01 (\x01-\x01): \x01",
|
|
51139
51242
|
"v2 model-limit cache warm failed: \x01",
|
|
51140
51243
|
"wrapup no-op: boundaryDiagnostics=\x01",
|
|
51141
51244
|
"current-compaction-id-unavailable",
|
|
@@ -51369,6 +51472,7 @@ var init_issue_log_templates_generated = __esm(() => {
|
|
|
51369
51472
|
"pp.setupAndOperations",
|
|
51370
51473
|
"pp.todoPermissionRead",
|
|
51371
51474
|
"preemptive-compaction",
|
|
51475
|
+
"projectBindingWarning",
|
|
51372
51476
|
"refusal notice failed",
|
|
51373
51477
|
"served check skipped:",
|
|
51374
51478
|
"stableIdSchemePersist",
|
|
@@ -52769,10 +52873,10 @@ var init_omp_hide_secrets = __esm(() => {
|
|
|
52769
52873
|
});
|
|
52770
52874
|
|
|
52771
52875
|
// src/commands/doctor-omp.ts
|
|
52772
|
-
import { execFileSync as
|
|
52876
|
+
import { execFileSync as execFileSync7, spawnSync as spawnSync8 } from "node:child_process";
|
|
52773
52877
|
import { existsSync as existsSync42, readFileSync as readFileSync27 } from "node:fs";
|
|
52774
52878
|
import { createRequire as createRequire3 } from "node:module";
|
|
52775
|
-
import { isAbsolute as
|
|
52879
|
+
import { isAbsolute as isAbsolute10, join as join35, resolve as resolve19 } from "node:path";
|
|
52776
52880
|
function parseSemver(value) {
|
|
52777
52881
|
const match = value?.match(/(\d+)\.(\d+)\.(\d+)/);
|
|
52778
52882
|
return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
|
|
@@ -53116,7 +53220,7 @@ function runGhCommandWithDeps(deps, args) {
|
|
|
53116
53220
|
async function runIssueFlow(options) {
|
|
53117
53221
|
if (options.reportPath) {
|
|
53118
53222
|
const report = await runHealthChecks({ ...options, quiet: true });
|
|
53119
|
-
const path =
|
|
53223
|
+
const path = isAbsolute10(options.reportPath) ? options.reportPath : join35(options.cwd, options.reportPath);
|
|
53120
53224
|
const bundle = writeOmpIssueReport(path, ompIssueBody("Generated non-interactively by `doctor --issue --report`.", report, readLogLines(report.logFiles), null, options.cwd));
|
|
53121
53225
|
options.prompts.log.success(bundle.fullPath ? `Sanitized report written to ${bundle.path}; full report at ${bundle.fullPath}` : `Sanitized report written to ${bundle.path}`);
|
|
53122
53226
|
return 0;
|
|
@@ -53219,7 +53323,7 @@ var init_doctor_omp = __esm(async () => {
|
|
|
53219
53323
|
openExistingContextDatabase,
|
|
53220
53324
|
now: () => new Date,
|
|
53221
53325
|
inspectMagicContextLogs,
|
|
53222
|
-
execFileSync:
|
|
53326
|
+
execFileSync: execFileSync7,
|
|
53223
53327
|
spawnSync: spawnSync8
|
|
53224
53328
|
};
|
|
53225
53329
|
});
|
|
@@ -58541,11 +58645,11 @@ var init_logs_pi = __esm(() => {
|
|
|
58541
58645
|
});
|
|
58542
58646
|
|
|
58543
58647
|
// src/commands/doctor-pi.ts
|
|
58544
|
-
import { execFileSync as
|
|
58648
|
+
import { execFileSync as execFileSync8, spawnSync as spawnSync11 } from "node:child_process";
|
|
58545
58649
|
import { existsSync as existsSync50, lstatSync as lstatSync6, readdirSync as readdirSync12, readFileSync as readFileSync34, rmSync as rmSync10 } from "node:fs";
|
|
58546
58650
|
import { createRequire as createRequire8 } from "node:module";
|
|
58547
58651
|
import { homedir as homedir22 } from "node:os";
|
|
58548
|
-
import { basename as basename7, isAbsolute as
|
|
58652
|
+
import { basename as basename7, isAbsolute as isAbsolute11, join as join44 } from "node:path";
|
|
58549
58653
|
function depsFrom(options) {
|
|
58550
58654
|
return {
|
|
58551
58655
|
...DEFAULT_DEPS5,
|
|
@@ -58583,7 +58687,7 @@ function selfVersion2() {
|
|
|
58583
58687
|
}
|
|
58584
58688
|
function getLatestNpmVersion(packageName) {
|
|
58585
58689
|
try {
|
|
58586
|
-
return
|
|
58690
|
+
return execFileSync8("npm", ["view", packageName, "version"], {
|
|
58587
58691
|
windowsHide: true,
|
|
58588
58692
|
encoding: "utf-8",
|
|
58589
58693
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -59382,7 +59486,7 @@ async function runIssueFlow3(options) {
|
|
|
59382
59486
|
if (options.reportPath) {
|
|
59383
59487
|
try {
|
|
59384
59488
|
const report = await options.deps.collectDiagnostics(options.cwd);
|
|
59385
|
-
const outputPath =
|
|
59489
|
+
const outputPath = isAbsolute11(options.reportPath) ? options.reportPath : join44(options.cwd, options.reportPath);
|
|
59386
59490
|
const bundled = await bundleIssueReport2(report, "Generated non-interactively by `doctor --issue --report`.", "Magic Context diagnostic report", { cwd: options.cwd, now: options.deps.now(), outputPath });
|
|
59387
59491
|
options.prompts.log.info(`Report written to ${bundled.path}`);
|
|
59388
59492
|
return 0;
|
|
@@ -59587,7 +59691,7 @@ var init_doctor_pi = __esm(async () => {
|
|
|
59587
59691
|
probeCacheUse: probeHostProcessesUsing,
|
|
59588
59692
|
readProcessCommand,
|
|
59589
59693
|
now: () => new Date,
|
|
59590
|
-
execFileSync:
|
|
59694
|
+
execFileSync: execFileSync8,
|
|
59591
59695
|
spawnSync: spawnSync11
|
|
59592
59696
|
};
|
|
59593
59697
|
});
|
|
@@ -59885,12 +59989,12 @@ var SINGLE_STORE_HELP = [
|
|
|
59885
59989
|
`);
|
|
59886
59990
|
var MERGE_IDENTITY_HELP = [
|
|
59887
59991
|
"",
|
|
59888
|
-
" Usage: magic-context doctor merge-identities [--from <identity> --to <identity>] [--apply] [--force] [--verbose] [--db <path>] [--backup-root <dir>]",
|
|
59992
|
+
" Usage: magic-context doctor merge-identities [--from <identity-or-folder> --to <identity>] [--apply] [--force] [--verbose] [--db <path>] [--backup-root <dir>]",
|
|
59889
59993
|
"",
|
|
59890
59994
|
" Merge every project-scoped row from one project identity into another.",
|
|
59891
59995
|
"",
|
|
59892
59996
|
" Options:",
|
|
59893
|
-
" --from <identity>
|
|
59997
|
+
" --from <identity-or-folder> Source key, or a folder path naming its old dir: key",
|
|
59894
59998
|
" --to <identity> Identity that receives them",
|
|
59895
59999
|
" (no flags) List splits; --from/--to previews without writing",
|
|
59896
60000
|
" --apply Confirm the reviewed preview; hosts must be closed",
|