@cortexkit/magic-context 0.31.4 → 0.32.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/dist/index.js +28 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -148449,6 +148449,9 @@ var init_project_docs_hash = __esm(() => {
|
|
|
148449
148449
|
docsCache = new Map;
|
|
148450
148450
|
});
|
|
148451
148451
|
|
|
148452
|
+
// ../plugin/src/features/magic-context/storage-clone.ts
|
|
148453
|
+
var init_storage_clone = () => {};
|
|
148454
|
+
|
|
148452
148455
|
// ../plugin/src/shared/error-message.ts
|
|
148453
148456
|
function getErrorMessage(error) {
|
|
148454
148457
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -150001,7 +150004,7 @@ var init_storage_primers = __esm(() => {
|
|
|
150001
150004
|
// ../plugin/src/features/magic-context/storage-source.ts
|
|
150002
150005
|
var init_storage_source = () => {};
|
|
150003
150006
|
// ../plugin/src/features/magic-context/storage-tags.ts
|
|
150004
|
-
var insertTagStatements, updateTagStatusStatements, updateTagDropModeStatements, updateTagMessageIdStatements, getTagNumbersByMessageIdStatements, deleteTagsByMessageIdStatements, getMaxTagNumberBySessionStatements, getTagNumberByMessageIdStatements, updateTagByteSizeStatements, updateTagInputByteSizeStatements, RECLAIM_HINT_EXCLUDED_TOOLS, RECLAIM_HINT_EXCLUDED_LIST, updateTagTokenCountStatements, updateTagInputTokenCountStatements, getOwnerScopedToolTagNumbersStatements, getMinMessageTagNumberForRawIdStatements, getActiveTagsBySessionStatements, getMaxDroppedTagNumberStatements, getToolTagNumberByOwnerStatements, getNullOwnerToolTagStatements, adoptNullOwnerToolTagStatements, deleteToolTagsByOwnerStatements;
|
|
150007
|
+
var insertTagStatements, updateTagStatusStatements, updateTagDropModeStatements, updateTagMessageIdStatements, getTagNumbersByMessageIdStatements, deleteTagsByMessageIdStatements, getMaxTagNumberBySessionStatements, getTagNumberByMessageIdStatements, hasPiFallbackMessageTagStatements, updateTagByteSizeStatements, updateTagInputByteSizeStatements, RECLAIM_HINT_EXCLUDED_TOOLS, RECLAIM_HINT_EXCLUDED_LIST, updateTagTokenCountStatements, updateTagInputTokenCountStatements, getOwnerScopedToolTagNumbersStatements, getMinMessageTagNumberForRawIdStatements, getActiveTagsBySessionStatements, getMaxDroppedTagNumberStatements, getToolTagNumberByOwnerStatements, getNullOwnerToolTagStatements, adoptNullOwnerToolTagStatements, deleteToolTagsByOwnerStatements;
|
|
150005
150008
|
var init_storage_tags = __esm(() => {
|
|
150006
150009
|
insertTagStatements = new WeakMap;
|
|
150007
150010
|
updateTagStatusStatements = new WeakMap;
|
|
@@ -150011,6 +150014,7 @@ var init_storage_tags = __esm(() => {
|
|
|
150011
150014
|
deleteTagsByMessageIdStatements = new WeakMap;
|
|
150012
150015
|
getMaxTagNumberBySessionStatements = new WeakMap;
|
|
150013
150016
|
getTagNumberByMessageIdStatements = new WeakMap;
|
|
150017
|
+
hasPiFallbackMessageTagStatements = new WeakMap;
|
|
150014
150018
|
updateTagByteSizeStatements = new WeakMap;
|
|
150015
150019
|
updateTagInputByteSizeStatements = new WeakMap;
|
|
150016
150020
|
RECLAIM_HINT_EXCLUDED_TOOLS = ["todowrite"];
|
|
@@ -150046,6 +150050,7 @@ var init_storage = __esm(async () => {
|
|
|
150046
150050
|
init_migrations();
|
|
150047
150051
|
init_project_docs_hash();
|
|
150048
150052
|
init_project_identity2();
|
|
150053
|
+
init_storage_clone();
|
|
150049
150054
|
init_storage_m0_mutation_log();
|
|
150050
150055
|
init_storage_memory_mutation_log();
|
|
150051
150056
|
init_storage_meta_shared();
|
|
@@ -165486,8 +165491,11 @@ var init_magic_context = __esm(() => {
|
|
|
165486
165491
|
provider: "local",
|
|
165487
165492
|
model: DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
165488
165493
|
}).describe("Embedding provider configuration"),
|
|
165489
|
-
temporal_awareness: exports_external.boolean().default(true).describe('Inject wall-clock gap markers (<!-- +Xm -->) between user messages where > 5 min elapsed since the previous message, and add
|
|
165494
|
+
temporal_awareness: exports_external.boolean().default(true).describe('Inject wall-clock gap markers (<!-- +Xm -->) between user messages where > 5 min elapsed since the previous message, and add compact date ranges to compartment headings. Gives the agent a sense of session pacing and "how long ago" across multi-day sessions. Graduated from experimental.temporal_awareness; default: true (set false to opt out).'),
|
|
165490
165495
|
keep_subagents: exports_external.boolean().default(false).describe("Debug: keep the child sessions Magic Context spawns for its own subagents (historian, dreamer, sidekick, memory-migration) instead of deleting them on success. Useful for short-term inspection/data collection — their full transcript (prompt, tool calls, token usage, output) stays in the host session store. Kept sessions accumulate until manually cleared; leave false for normal use. Requires a restart to take effect."),
|
|
165496
|
+
shadow_transform: exports_external.object({
|
|
165497
|
+
enabled: exports_external.boolean().default(false).describe("Dev flag: mirror every transform pass to the Magic Context Rust module over subc and byte-compare outputs. No behavior impact; default off.")
|
|
165498
|
+
}).default({ enabled: false }).describe("Developer-only shadow transform lane. When enabled, the plugin fire-and-forgets a copy of each finalized transform to the Rust module for comparison; the live output is unchanged."),
|
|
165491
165499
|
todowrite: exports_external.object({
|
|
165492
165500
|
enabled: exports_external.boolean().default(true).describe("Pi only: register Magic Context's todowrite task-list tool. Disable if you use your own todo extension. OpenCode ships its own built-in todowrite; this setting has no effect there."),
|
|
165493
165501
|
overlay: exports_external.boolean().default(true).describe("Pi only: show the persistent todo overlay above the editor while tasks are active.")
|
|
@@ -165638,6 +165646,10 @@ function stripUnsafeProjectConfigFields(projectRaw) {
|
|
|
165638
165646
|
delete projectRaw.sqlite;
|
|
165639
165647
|
warnings.push("Ignoring sqlite.* from project config (security: SQLite cache/mmap PRAGMAs apply to the " + "process-global shared database handle; only user-level config may set them).");
|
|
165640
165648
|
}
|
|
165649
|
+
if ("shadow_transform" in projectRaw) {
|
|
165650
|
+
delete projectRaw.shadow_transform;
|
|
165651
|
+
warnings.push("Ignoring shadow_transform from project config (security: this developer-only mirror lane is user-level only).");
|
|
165652
|
+
}
|
|
165641
165653
|
const embedding = projectRaw.embedding;
|
|
165642
165654
|
if (isPlainObject2(embedding)) {
|
|
165643
165655
|
const removed = [];
|
|
@@ -168147,6 +168159,17 @@ function migrateLegacyAgentEnabledConfigForDoctor(mcConfig, logs) {
|
|
|
168147
168159
|
migrateLegacyAgentEnabled("historian");
|
|
168148
168160
|
return { changed, fixes };
|
|
168149
168161
|
}
|
|
168162
|
+
function checkUserMemoriesDreamerCompatibility(mcConfig) {
|
|
168163
|
+
const dreamerObj = mcConfig?.dreamer;
|
|
168164
|
+
if (dreamerObj?.disable !== true)
|
|
168165
|
+
return null;
|
|
168166
|
+
const tasksObj = dreamerObj.tasks;
|
|
168167
|
+
const reviewTask = tasksObj?.["review-user-memories"];
|
|
168168
|
+
const schedule = reviewTask?.schedule;
|
|
168169
|
+
if (typeof schedule !== "string" || schedule.trim() === "")
|
|
168170
|
+
return null;
|
|
168171
|
+
return 'dreamer.tasks["review-user-memories"] is scheduled but dreamer.disable=true, so new promotions will not run. Remove dreamer.disable or set dreamer.tasks["review-user-memories"].schedule="" to disable the task.';
|
|
168172
|
+
}
|
|
168150
168173
|
async function fetchNpmLatest(pkg, timeoutMs = 5000) {
|
|
168151
168174
|
try {
|
|
168152
168175
|
const controller = new AbortController;
|
|
@@ -168778,12 +168801,9 @@ async function runDoctor(options = {}) {
|
|
|
168778
168801
|
try {
|
|
168779
168802
|
const mcRaw = readFileSync14(paths.magicContextConfig, "utf-8");
|
|
168780
168803
|
const mcConfig = import_comment_json8.parse(mcRaw);
|
|
168781
|
-
const
|
|
168782
|
-
|
|
168783
|
-
|
|
168784
|
-
const userMemEnabled = userMemObj?.enabled !== false;
|
|
168785
|
-
if (userMemEnabled && dreamerDisabled) {
|
|
168786
|
-
log2.warn("dreamer.user_memories is enabled but dreamer.disable=true, so new promotions will not run. Remove dreamer.disable or set dreamer.user_memories.enabled=false.");
|
|
168804
|
+
const warning = checkUserMemoriesDreamerCompatibility(mcConfig);
|
|
168805
|
+
if (warning) {
|
|
168806
|
+
log2.warn(warning);
|
|
168787
168807
|
issues++;
|
|
168788
168808
|
}
|
|
168789
168809
|
} catch {}
|