@cortexkit/opencode-magic-context 0.36.1 → 0.38.0
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/README.md +2 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +2 -1
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +10 -0
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-mt0ttc4x.js → conflict-warning-hook-an4fxhwf.js} +3 -3
- package/dist/{derive-budgets-88mxk2w1.js → derive-budgets-da4yg3tz.js} +3 -2
- package/dist/features/magic-context/context-authority.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify-prompt.d.ts +5 -1
- package/dist/features/magic-context/dreamer/classify-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/manifest-parser.d.ts +8 -0
- package/dist/features/magic-context/dreamer/manifest-parser.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +7 -1
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +18 -0
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +5 -0
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts +5 -1
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/fail-closed-block.d.ts +6 -1
- package/dist/features/magic-context/fail-closed-block.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-openai.d.ts +3 -1
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/project-identity.d.ts +6 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/reclaim-protection.d.ts +13 -0
- package/dist/features/magic-context/reclaim-protection.d.ts.map +1 -0
- package/dist/features/magic-context/smart-notes/runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/wake-plane.d.ts +21 -0
- package/dist/features/magic-context/smart-notes/wake-plane.d.ts.map +1 -0
- package/dist/features/magic-context/storage-db.d.ts +19 -3
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +23 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-primers.d.ts +11 -0
- package/dist/features/magic-context/storage-primers.d.ts.map +1 -1
- package/dist/features/magic-context/storage-schema-helpers.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +13 -5
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts +7 -0
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
- package/dist/features/magic-context/window-report-ledger.d.ts +70 -0
- package/dist/features/magic-context/window-report-ledger.d.ts.map +1 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +8 -1
- package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
- package/dist/hooks/auto-update-checker/index.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-cycle.d.ts +16 -0
- package/dist/hooks/magic-context/channel2-cycle.d.ts.map +1 -0
- package/dist/hooks/magic-context/channel2-delivery.d.ts +3 -9
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +2 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +33 -103
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +4 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts +3 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/fold-execution-gate.d.ts +2 -0
- package/dist/hooks/magic-context/fold-execution-gate.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.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.map +1 -1
- package/dist/hooks/magic-context/live-session-state.d.ts +3 -0
- package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +20 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +8 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts +6 -1
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +21 -2
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +27 -0
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +78 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-reclaim.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +14 -3
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +10 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-nsx2n9eg.js → index-4cz5nfxf.js} +3 -3
- package/dist/{index-f1tnb3vm.js → index-8pqfcghm.js} +21 -9
- package/dist/index-9zhhvr4w.js +733 -0
- package/dist/{index-zp6x6s6a.js → index-cae89eas.js} +25 -6
- package/dist/index-cgyfn1s2.js +53 -0
- package/dist/{index-3zqcdwqr.js → index-crke4z5j.js} +7 -4
- package/dist/{index-1skzp4dc.js → index-mmvhrqqb.js} +1991 -274
- package/dist/{index-tsgs7td8.js → index-pck9vadr.js} +1 -1
- package/dist/{index-3tnkymva.js → index-sw8gnq34.js} +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1714 -988
- package/dist/plugin/hooks/create-session-hooks.d.ts +3 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +2 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{recomp-orchestrator-a0g9b52q.js → recomp-orchestrator-jsde4ygw.js} +7 -6
- package/dist/{safe-notification-target-c11fdda2.js → safe-notification-target-b693f9x3.js} +2 -2
- package/dist/{send-session-notification-bgtf4853.js → send-session-notification-dxske5zm.js} +3 -3
- package/dist/shared/conflict-detector.d.ts +63 -0
- package/dist/shared/conflict-detector.d.ts.map +1 -1
- package/dist/shared/harness-provider-map.d.ts +8 -0
- package/dist/shared/harness-provider-map.d.ts.map +1 -1
- package/dist/shared/logger.d.ts +8 -0
- package/dist/shared/logger.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts +7 -0
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- package/dist/shared/prompt-surface.d.ts +2 -0
- package/dist/shared/prompt-surface.d.ts.map +1 -1
- package/dist/shared/rpc-client.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +29 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/rpc-utils.d.ts +28 -9
- package/dist/shared/rpc-utils.d.ts.map +1 -1
- package/dist/shared/tail-hygiene-status.d.ts +15 -0
- package/dist/shared/tail-hygiene-status.d.ts.map +1 -0
- package/dist/shared/window-geometry.d.ts +90 -0
- package/dist/shared/window-geometry.d.ts.map +1 -0
- package/dist/{storage-meta-session-df9tstzr.js → storage-meta-session-mk4gsnke.js} +4 -3
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/config/index.ts +2 -0
- package/src/config/latch-permanence-guard.test.ts +218 -0
- package/src/config/project-security.ts +10 -1
- package/src/config/schema/magic-context.ts +12 -2
- package/src/shared/__fixtures__/window-overlay.v1.json +337 -0
- package/src/shared/conflict-detector.test.ts +176 -1
- package/src/shared/conflict-detector.ts +126 -3
- package/src/shared/harness-provider-map.test.ts +20 -0
- package/src/shared/harness-provider-map.ts +19 -0
- package/src/shared/logger.test.ts +119 -0
- package/src/shared/logger.ts +33 -15
- package/src/shared/models-dev-cache.test.ts +42 -0
- package/src/shared/models-dev-cache.ts +62 -9
- package/src/shared/prompt-surface-runtime.ts +5 -3
- package/src/shared/prompt-surface.test.ts +38 -0
- package/src/shared/prompt-surface.ts +15 -2
- package/src/shared/rpc-client.ts +4 -2
- package/src/shared/rpc-server.ts +1 -0
- package/src/shared/rpc-types.ts +30 -0
- package/src/shared/rpc-utils.test.ts +162 -13
- package/src/shared/rpc-utils.ts +224 -31
- package/src/shared/tail-hygiene-status.ts +57 -0
- package/src/shared/window-geometry.test.ts +342 -0
- package/src/shared/window-geometry.ts +626 -0
- package/src/tui/data/context-db.ts +5 -0
- package/src/tui/index.tsx +33 -1
- package/src/tui/slots/sidebar-content.tsx +17 -5
- package/src/tui-compiled/data/context-db.ts +5 -0
- package/src/tui-compiled/index.tsx +359 -273
- package/src/tui-compiled/slots/sidebar-content.tsx +316 -287
- package/dist/index-wgvxkqpx.js +0 -342
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./index-8mtsfhyg.js";
|
|
4
4
|
import {
|
|
5
5
|
waitForSafeNotificationTarget
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-pck9vadr.js";
|
|
7
7
|
import {
|
|
8
8
|
log
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-8pqfcghm.js";
|
|
10
10
|
import {
|
|
11
11
|
__require
|
|
12
12
|
} from "./index-wckvcay0.js";
|
|
@@ -59,14 +59,17 @@ function detectConflicts(directory, options) {
|
|
|
59
59
|
omoAnthropicRecovery: false
|
|
60
60
|
};
|
|
61
61
|
const reasons = [];
|
|
62
|
-
|
|
62
|
+
let compactionResult = options?.resolvedCompaction ?? checkCompaction(directory);
|
|
63
|
+
if (process.env.OPENCODE_DISABLE_AUTOCOMPACT) {
|
|
64
|
+
compactionResult = { auto: false, prune: false };
|
|
65
|
+
}
|
|
63
66
|
if (compactionEnabled && compactionResult.auto) {
|
|
64
67
|
conflicts.compactionAuto = true;
|
|
65
|
-
reasons.push("OpenCode auto-compaction is enabled (compaction.auto=true)");
|
|
68
|
+
reasons.push(options?.resolvedCompaction ? "OpenCode auto-compaction is enabled (compaction.auto=true) (resolved config)" : "OpenCode auto-compaction is enabled (compaction.auto=true)");
|
|
66
69
|
}
|
|
67
70
|
if (compactionEnabled && compactionResult.prune) {
|
|
68
71
|
conflicts.compactionPrune = true;
|
|
69
|
-
reasons.push("OpenCode prune is enabled (compaction.prune=true)");
|
|
72
|
+
reasons.push(options?.resolvedCompaction ? "OpenCode prune is enabled (compaction.prune=true) (resolved config)" : "OpenCode prune is enabled (compaction.prune=true)");
|
|
70
73
|
}
|
|
71
74
|
const dcpFound = checkDcpPlugin(directory);
|
|
72
75
|
if (dcpFound) {
|
|
@@ -93,6 +96,22 @@ function detectConflicts(directory, options) {
|
|
|
93
96
|
nativeCompaction: { auto: compactionResult.auto, prune: compactionResult.prune }
|
|
94
97
|
};
|
|
95
98
|
}
|
|
99
|
+
async function resolveCompactionForBoot(client, timeoutMs = 2000) {
|
|
100
|
+
try {
|
|
101
|
+
const result = await Promise.race([
|
|
102
|
+
client.config.get(),
|
|
103
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("config.get() timed out")), timeoutMs))
|
|
104
|
+
]);
|
|
105
|
+
const compaction = result?.data?.compaction;
|
|
106
|
+
if (typeof compaction?.auto !== "boolean" || typeof compaction?.prune !== "boolean") {
|
|
107
|
+
log(`[magic-context] conflict-detector: resolved config carried no explicit compaction block (${JSON.stringify(compaction) ?? "absent"}); falling back to file-based detection`);
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return { auto: compaction.auto, prune: compaction.prune };
|
|
111
|
+
} catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
96
115
|
function checkCompaction(directory) {
|
|
97
116
|
if (process.env.OPENCODE_DISABLE_AUTOCOMPACT) {
|
|
98
117
|
return { auto: false, prune: false };
|
|
@@ -586,4 +605,4 @@ async function sendStartupAnnouncement(client, directory, version, features, foo
|
|
|
586
605
|
markSeen(version);
|
|
587
606
|
}
|
|
588
607
|
|
|
589
|
-
export { detectConflicts, sendConflictWarning, cleanupConflictWarnings, sendSchemaFenceWarning, sendStartupAnnouncement };
|
|
608
|
+
export { detectConflicts, resolveCompactionForBoot, sendConflictWarning, cleanupConflictWarnings, sendSchemaFenceWarning, sendStartupAnnouncement };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/shared/harness-provider-map.ts
|
|
2
|
+
var CANONICAL_TO_PI_PROVIDER = {
|
|
3
|
+
openai: "openai-codex",
|
|
4
|
+
google: "google-antigravity"
|
|
5
|
+
};
|
|
6
|
+
var PI_TO_CANONICAL_PROVIDER = {
|
|
7
|
+
"openai-codex": "openai",
|
|
8
|
+
"google-antigravity": "google"
|
|
9
|
+
};
|
|
10
|
+
var CANONICAL_TO_OMP_PROVIDER = {
|
|
11
|
+
openai: "openai-codex",
|
|
12
|
+
google: "google-antigravity"
|
|
13
|
+
};
|
|
14
|
+
var OMP_TO_CANONICAL_PROVIDER = {
|
|
15
|
+
"openai-codex": "openai",
|
|
16
|
+
"google-antigravity": "google"
|
|
17
|
+
};
|
|
18
|
+
function remapProviderPrefix(ref, map) {
|
|
19
|
+
if (typeof ref !== "string")
|
|
20
|
+
return ref;
|
|
21
|
+
const slash = ref.indexOf("/");
|
|
22
|
+
if (slash <= 0)
|
|
23
|
+
return ref;
|
|
24
|
+
const provider = ref.slice(0, slash);
|
|
25
|
+
if (!Object.hasOwn(map, provider))
|
|
26
|
+
return ref;
|
|
27
|
+
return `${map[provider]}${ref.slice(slash)}`;
|
|
28
|
+
}
|
|
29
|
+
function piModelRefToCanonical(ref) {
|
|
30
|
+
return remapProviderPrefix(ref, PI_TO_CANONICAL_PROVIDER);
|
|
31
|
+
}
|
|
32
|
+
function resolveModelRefForPi(ref) {
|
|
33
|
+
return remapProviderPrefix(piModelRefToCanonical(ref), CANONICAL_TO_PI_PROVIDER);
|
|
34
|
+
}
|
|
35
|
+
function modelRefLookupOrder(ref) {
|
|
36
|
+
const canonical = piModelRefToCanonical(ompModelRefToCanonical(ref));
|
|
37
|
+
return [
|
|
38
|
+
...new Set([
|
|
39
|
+
canonical,
|
|
40
|
+
ref,
|
|
41
|
+
resolveModelRefForPi(canonical),
|
|
42
|
+
resolveModelRefForOmp(canonical)
|
|
43
|
+
])
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
function ompModelRefToCanonical(ref) {
|
|
47
|
+
return remapProviderPrefix(ref, OMP_TO_CANONICAL_PROVIDER);
|
|
48
|
+
}
|
|
49
|
+
function resolveModelRefForOmp(ref) {
|
|
50
|
+
return remapProviderPrefix(ompModelRefToCanonical(ref), CANONICAL_TO_OMP_PROVIDER);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { piModelRefToCanonical, modelRefLookupOrder };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
piModelRefToCanonical
|
|
3
|
+
} from "./index-cgyfn1s2.js";
|
|
1
4
|
import {
|
|
2
5
|
closeQuietly,
|
|
3
6
|
getRawSessionMessageCountFromDb,
|
|
4
7
|
openCodeDbExists,
|
|
5
8
|
withReadOnlySessionDb
|
|
6
|
-
} from "./index-
|
|
9
|
+
} from "./index-sw8gnq34.js";
|
|
7
10
|
import {
|
|
8
11
|
log
|
|
9
|
-
} from "./index-
|
|
12
|
+
} from "./index-8pqfcghm.js";
|
|
10
13
|
import {
|
|
11
14
|
getHarness
|
|
12
15
|
} from "./index-mmrhhk9a.js";
|
|
@@ -2822,7 +2825,7 @@ function persistCachedM0(db, sessionId, payload) {
|
|
|
2822
2825
|
cached_m0_system_hash = ?,
|
|
2823
2826
|
cached_m0_model_key = ?,
|
|
2824
2827
|
cached_m0_project_identity = ?
|
|
2825
|
-
WHERE session_id = ?`).run(Buffer.from(payload.m0Bytes), payload.muralDataUrl ?? null, payload.muralHash ?? null, payload.projectMemoryEpoch, payload.workspaceFingerprint ?? null, payload.projectUserProfileVersion, payload.maxCompartmentSeq, payload.maxMemoryId, payload.maxMutationId, payload.maxMemoryMutationId ?? null, payload.m1Bytes ? Buffer.from(payload.m1Bytes) : null, payload.projectDocsHash, payload.materializedAt, payload.sessionFactsVersion, payload.upgradeState, payload.systemHash ?? "", payload.modelKey
|
|
2828
|
+
WHERE session_id = ?`).run(Buffer.from(payload.m0Bytes), payload.muralDataUrl ?? null, payload.muralHash ?? null, payload.projectMemoryEpoch, payload.workspaceFingerprint ?? null, payload.projectUserProfileVersion, payload.maxCompartmentSeq, payload.maxMemoryId, payload.maxMutationId, payload.maxMemoryMutationId ?? null, payload.m1Bytes ? Buffer.from(payload.m1Bytes) : null, payload.projectDocsHash, payload.materializedAt, payload.sessionFactsVersion, payload.upgradeState, payload.systemHash ?? "", payload.modelKey ? piModelRefToCanonical(payload.modelKey) : "", payload.projectIdentity ?? null, sessionId);
|
|
2826
2829
|
}
|
|
2827
2830
|
function clearCachedM0M1(db, sessionId) {
|
|
2828
2831
|
ensureSessionMetaRow(db, sessionId);
|
|
@@ -2944,7 +2947,7 @@ function updateSessionMeta(db, sessionId, updates) {
|
|
|
2944
2947
|
values.push(value ? 1 : 0);
|
|
2945
2948
|
} else if (typeof value === "string" || typeof value === "number") {
|
|
2946
2949
|
setClauses.push(`${column} = ?`);
|
|
2947
|
-
values.push(value);
|
|
2950
|
+
values.push(key === "lastObservedModelKey" && typeof value === "string" ? piModelRefToCanonical(value) : value);
|
|
2948
2951
|
}
|
|
2949
2952
|
}
|
|
2950
2953
|
if (setClauses.length === 0) {
|