@cortexkit/pi-magic-context 0.49.14 → 0.49.15

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.
@@ -1,109 +1,21 @@
1
1
  import {
2
- subagentTemperature,
3
- promptFingerprint,
4
- readHostSystemPrompt
5
- } from "./index-y29y2j2w.js";
2
+ HISTORIAN_TEMPERATURE_ENV2,
3
+ HISTORIAN_MAX_OUTPUT_TOKENS_ENV2,
4
+ SUBAGENT_OUTPUT_CEILING_ENV2,
5
+ calibrateHistorianProviderPayload2,
6
+ ceilProviderOutputTokens2,
7
+ withoutProviderTemperature2,
8
+ historianCalibrationExtension
9
+ } from "./index-ajfpyk0x.js";
6
10
  import"./index-6x556c2q.js";
7
- import"./index-0h2mkab2.js";
8
11
  import"./index-7bqrfyny.js";
9
-
10
- // src/historian-calibration-extension.ts
11
- import { readFileSync } from "node:fs";
12
- var HISTORIAN_TEMPERATURE_ENV = "MAGIC_CONTEXT_HISTORIAN_TEMPERATURE";
13
- var HISTORIAN_MAX_OUTPUT_TOKENS_ENV = "MAGIC_CONTEXT_HISTORIAN_MAX_OUTPUT_TOKENS";
14
- function finiteNumber(value) {
15
- if (value === undefined || value.trim().length === 0)
16
- return;
17
- const parsed = Number(value);
18
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;
19
- }
20
- function calibrateHistorianProviderPayload(payload, temperature, maxOutputTokens) {
21
- if (typeof payload !== "object" || payload === null || Array.isArray(payload))
22
- return payload;
23
- if (temperature === undefined && maxOutputTokens === undefined)
24
- return payload;
25
- const calibrated = { ...payload };
26
- const generationConfig = calibrated.generationConfig;
27
- if (typeof generationConfig === "object" && generationConfig !== null && !Array.isArray(generationConfig)) {
28
- calibrated.generationConfig = {
29
- ...generationConfig,
30
- ...temperature !== undefined ? { temperature } : {},
31
- ...maxOutputTokens !== undefined ? { maxOutputTokens } : {}
32
- };
33
- return calibrated;
34
- }
35
- const inferenceConfig = calibrated.inferenceConfig;
36
- if (typeof inferenceConfig === "object" && inferenceConfig !== null && !Array.isArray(inferenceConfig)) {
37
- calibrated.inferenceConfig = {
38
- ...inferenceConfig,
39
- ...temperature !== undefined ? { temperature } : {},
40
- ...maxOutputTokens !== undefined ? { maxTokens: maxOutputTokens } : {}
41
- };
42
- return calibrated;
43
- }
44
- if (temperature !== undefined) {
45
- calibrated.temperature = temperature;
46
- }
47
- if (maxOutputTokens !== undefined) {
48
- if ("max_output_tokens" in calibrated) {
49
- calibrated.max_output_tokens = maxOutputTokens;
50
- } else if ("max_completion_tokens" in calibrated) {
51
- calibrated.max_completion_tokens = maxOutputTokens;
52
- } else if ("max_tokens" in calibrated) {
53
- calibrated.max_tokens = maxOutputTokens;
54
- } else if ("maxTokens" in calibrated) {
55
- calibrated.maxTokens = maxOutputTokens;
56
- }
57
- }
58
- return calibrated;
59
- }
60
- function withoutProviderTemperature(payload) {
61
- if (!payload || typeof payload !== "object" || Array.isArray(payload))
62
- return payload;
63
- const clean = { ...payload };
64
- delete clean.temperature;
65
- for (const key of ["generationConfig", "inferenceConfig"]) {
66
- const nested = clean[key];
67
- if (nested && typeof nested === "object" && !Array.isArray(nested)) {
68
- const options = { ...nested };
69
- delete options.temperature;
70
- clean[key] = options;
71
- }
72
- }
73
- return clean;
74
- }
75
- function historianCalibrationExtension(pi) {
76
- const intendedPath = process.env.MAGIC_CONTEXT_SUBAGENT_PROMPT_FILE;
77
- if (intendedPath) {
78
- const intended = readFileSync(intendedPath, "utf8");
79
- pi.on("context", (_event, ctx) => {
80
- const effective = readHostSystemPrompt(ctx);
81
- if (effective === undefined)
82
- return;
83
- process.stdout.write(`${JSON.stringify({ type: "mc_system_prompt", ...promptFingerprint(effective), containsIntended: effective.includes(intended) })}
84
- `);
85
- });
86
- }
87
- if (process.env.MAGIC_CONTEXT_SUBAGENT_PROVENANCE_ONLY === "1")
88
- return;
89
- const temperature = finiteNumber(process.env[HISTORIAN_TEMPERATURE_ENV]);
90
- const maxOutputTokens = finiteNumber(process.env[HISTORIAN_MAX_OUTPUT_TOKENS_ENV]);
91
- if (temperature === undefined && maxOutputTokens === undefined)
92
- return;
93
- pi.on("before_provider_request", (event, ctx) => {
94
- const model = ctx.model;
95
- const key = `${model?.provider ?? "unknown"}/${model?.id ?? "unknown"}`;
96
- const sampling = subagentTemperature(key, model, temperature, (_message, decision) => {
97
- process.stdout.write(`${JSON.stringify({ type: "mc_temperature", model: key, supported: decision.supported ?? null, source: decision.source, ...decision.entry ? { entry: decision.entry } : {} })}
98
- `);
99
- });
100
- return calibrateHistorianProviderPayload(sampling === undefined ? withoutProviderTemperature(event.payload) : event.payload, sampling, maxOutputTokens);
101
- });
102
- }
12
+ import"./index-0h2mkab2.js";
103
13
  export {
104
- HISTORIAN_MAX_OUTPUT_TOKENS_ENV,
105
- HISTORIAN_TEMPERATURE_ENV,
106
- calibrateHistorianProviderPayload,
14
+ HISTORIAN_MAX_OUTPUT_TOKENS_ENV2 as HISTORIAN_MAX_OUTPUT_TOKENS_ENV,
15
+ HISTORIAN_TEMPERATURE_ENV2 as HISTORIAN_TEMPERATURE_ENV,
16
+ SUBAGENT_OUTPUT_CEILING_ENV2 as SUBAGENT_OUTPUT_CEILING_ENV,
17
+ calibrateHistorianProviderPayload2 as calibrateHistorianProviderPayload,
18
+ ceilProviderOutputTokens2 as ceilProviderOutputTokens,
107
19
  historianCalibrationExtension as default,
108
- withoutProviderTemperature
20
+ withoutProviderTemperature2 as withoutProviderTemperature
109
21
  };
@@ -250,6 +250,24 @@ function subagentTemperature(model, metadata, temperature, log) {
250
250
  return decision.supported === true ? temperature : undefined;
251
251
  }
252
252
 
253
+ // src/historian-calibration-extension.ts
254
+ import { readFileSync as readFileSync2 } from "node:fs";
255
+
256
+ // src/host-system-prompt.ts
257
+ function readHostSystemPrompt(ctx) {
258
+ if (typeof ctx.getSystemPrompt !== "function")
259
+ return;
260
+ const raw = ctx.getSystemPrompt();
261
+ if (typeof raw === "string")
262
+ return raw;
263
+ if (Array.isArray(raw) && raw.every((part) => typeof part === "string")) {
264
+ return raw.join(`
265
+
266
+ `);
267
+ }
268
+ return;
269
+ }
270
+
253
271
  // src/subagent-telemetry.ts
254
272
  import { createHash } from "node:crypto";
255
273
  var stepCaps = new Map(buildHiddenAgentRegistrations({
@@ -351,19 +369,154 @@ class SubagentTelemetry {
351
369
  }
352
370
  }
353
371
 
354
- // src/host-system-prompt.ts
355
- function readHostSystemPrompt(ctx) {
356
- if (typeof ctx.getSystemPrompt !== "function")
372
+ // src/historian-calibration-extension.ts
373
+ var HISTORIAN_TEMPERATURE_ENV2 = "MAGIC_CONTEXT_HISTORIAN_TEMPERATURE";
374
+ var HISTORIAN_MAX_OUTPUT_TOKENS_ENV2 = "MAGIC_CONTEXT_HISTORIAN_MAX_OUTPUT_TOKENS";
375
+ var SUBAGENT_OUTPUT_CEILING_ENV2 = "MAGIC_CONTEXT_SUBAGENT_OUTPUT_CEILING";
376
+ function finiteNumber(value) {
377
+ if (value === undefined || value.trim().length === 0)
357
378
  return;
358
- const raw = ctx.getSystemPrompt();
359
- if (typeof raw === "string")
360
- return raw;
361
- if (Array.isArray(raw) && raw.every((part) => typeof part === "string")) {
362
- return raw.join(`
363
-
379
+ const parsed = Number(value);
380
+ return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;
381
+ }
382
+ function calibrateHistorianProviderPayload2(payload, temperature, maxOutputTokens) {
383
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload))
384
+ return payload;
385
+ if (temperature === undefined && maxOutputTokens === undefined)
386
+ return payload;
387
+ const calibrated = { ...payload };
388
+ const generationConfig = calibrated.generationConfig;
389
+ if (typeof generationConfig === "object" && generationConfig !== null && !Array.isArray(generationConfig)) {
390
+ calibrated.generationConfig = {
391
+ ...generationConfig,
392
+ ...temperature !== undefined ? { temperature } : {},
393
+ ...maxOutputTokens !== undefined ? { maxOutputTokens } : {}
394
+ };
395
+ return calibrated;
396
+ }
397
+ const inferenceConfig = calibrated.inferenceConfig;
398
+ if (typeof inferenceConfig === "object" && inferenceConfig !== null && !Array.isArray(inferenceConfig)) {
399
+ calibrated.inferenceConfig = {
400
+ ...inferenceConfig,
401
+ ...temperature !== undefined ? { temperature } : {},
402
+ ...maxOutputTokens !== undefined ? { maxTokens: maxOutputTokens } : {}
403
+ };
404
+ return calibrated;
405
+ }
406
+ if (temperature !== undefined) {
407
+ calibrated.temperature = temperature;
408
+ }
409
+ if (maxOutputTokens !== undefined) {
410
+ if ("max_output_tokens" in calibrated) {
411
+ calibrated.max_output_tokens = maxOutputTokens;
412
+ } else if ("max_completion_tokens" in calibrated) {
413
+ calibrated.max_completion_tokens = maxOutputTokens;
414
+ } else if ("max_tokens" in calibrated) {
415
+ calibrated.max_tokens = maxOutputTokens;
416
+ } else if ("maxTokens" in calibrated) {
417
+ calibrated.maxTokens = maxOutputTokens;
418
+ }
419
+ }
420
+ return calibrated;
421
+ }
422
+ function ceilProviderOutputTokens2(payload, ceiling) {
423
+ if (ceiling === undefined)
424
+ return payload;
425
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload))
426
+ return payload;
427
+ const lowered = (options, keys) => {
428
+ const next = { ...options };
429
+ for (const key of keys) {
430
+ const value = next[key];
431
+ if (typeof value === "number" && value > ceiling)
432
+ next[key] = ceiling;
433
+ }
434
+ return next;
435
+ };
436
+ const record = payload;
437
+ const nested = (key) => {
438
+ const value = record[key];
439
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
440
+ };
441
+ const generationConfig = nested("generationConfig");
442
+ if (generationConfig)
443
+ return {
444
+ ...record,
445
+ generationConfig: lowered(generationConfig, ["maxOutputTokens"])
446
+ };
447
+ const inferenceConfig = nested("inferenceConfig");
448
+ if (inferenceConfig)
449
+ return {
450
+ ...record,
451
+ inferenceConfig: lowered(inferenceConfig, ["maxTokens"])
452
+ };
453
+ const capped = lowered(record, [
454
+ "max_output_tokens",
455
+ "max_completion_tokens",
456
+ "max_tokens",
457
+ "maxTokens"
458
+ ]);
459
+ const thinking = nested("thinking");
460
+ if (thinking && typeof capped.max_tokens === "number" && typeof thinking.budget_tokens === "number" && thinking.budget_tokens >= capped.max_tokens) {
461
+ capped.thinking = {
462
+ ...thinking,
463
+ budget_tokens: Math.max(1024, capped.max_tokens - 1024)
464
+ };
465
+ }
466
+ return capped;
467
+ }
468
+ function withoutProviderTemperature2(payload) {
469
+ if (!payload || typeof payload !== "object" || Array.isArray(payload))
470
+ return payload;
471
+ const clean = { ...payload };
472
+ delete clean.temperature;
473
+ for (const key of ["generationConfig", "inferenceConfig"]) {
474
+ const nested = clean[key];
475
+ if (nested && typeof nested === "object" && !Array.isArray(nested)) {
476
+ const options = { ...nested };
477
+ delete options.temperature;
478
+ clean[key] = options;
479
+ }
480
+ }
481
+ return clean;
482
+ }
483
+ function historianCalibrationExtension(pi) {
484
+ const intendedPath = process.env.MAGIC_CONTEXT_SUBAGENT_PROMPT_FILE;
485
+ if (intendedPath) {
486
+ const intended = readFileSync2(intendedPath, "utf8");
487
+ pi.on("context", (_event, ctx) => {
488
+ const effective = readHostSystemPrompt(ctx);
489
+ if (effective === undefined)
490
+ return;
491
+ process.stdout.write(`${JSON.stringify({ type: "mc_system_prompt", ...promptFingerprint(effective), containsIntended: effective.includes(intended) })}
364
492
  `);
493
+ });
365
494
  }
366
- return;
495
+ const provenanceOnly = process.env.MAGIC_CONTEXT_SUBAGENT_PROVENANCE_ONLY === "1";
496
+ const maxOutputTokens = finiteNumber(process.env[HISTORIAN_MAX_OUTPUT_TOKENS_ENV2]);
497
+ const outputCeiling = finiteNumber(process.env[SUBAGENT_OUTPUT_CEILING_ENV2]);
498
+ if (provenanceOnly) {
499
+ if (maxOutputTokens === undefined && outputCeiling === undefined)
500
+ return;
501
+ pi.on("before_provider_request", (event) => ceilProviderOutputTokens2(calibrateHistorianProviderPayload2(event.payload, undefined, maxOutputTokens), outputCeiling));
502
+ return;
503
+ }
504
+ const temperature = finiteNumber(process.env[HISTORIAN_TEMPERATURE_ENV2]);
505
+ if (temperature === undefined && maxOutputTokens === undefined) {
506
+ if (outputCeiling === undefined)
507
+ return;
508
+ pi.on("before_provider_request", (event) => ceilProviderOutputTokens2(event.payload, outputCeiling));
509
+ return;
510
+ }
511
+ pi.on("before_provider_request", (event, ctx) => {
512
+ const model = ctx.model;
513
+ const key = `${model?.provider ?? "unknown"}/${model?.id ?? "unknown"}`;
514
+ const sampling = subagentTemperature(key, model, temperature, (_message, decision) => {
515
+ process.stdout.write(`${JSON.stringify({ type: "mc_temperature", model: key, supported: decision.supported ?? null, source: decision.source, ...decision.entry ? { entry: decision.entry } : {} })}
516
+ `);
517
+ });
518
+ return ceilProviderOutputTokens2(calibrateHistorianProviderPayload2(sampling === undefined ? withoutProviderTemperature2(event.payload) : event.payload, sampling, maxOutputTokens), outputCeiling);
519
+ });
367
520
  }
368
521
 
369
- export { DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS, buildHiddenAgentRegistrations, logTemperatureDecision, subagentTemperature, subagentStepCap, promptFingerprint, SubagentTelemetry, readHostSystemPrompt };
522
+ export { DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS, buildHiddenAgentRegistrations, logTemperatureDecision, readHostSystemPrompt, subagentStepCap, SubagentTelemetry, HISTORIAN_TEMPERATURE_ENV2, HISTORIAN_MAX_OUTPUT_TOKENS_ENV2, SUBAGENT_OUTPUT_CEILING_ENV2, calibrateHistorianProviderPayload2, ceilProviderOutputTokens2, withoutProviderTemperature2, historianCalibrationExtension };
@@ -15554,4 +15554,4 @@ function registerMagicContextTools(pi, opts) {
15554
15554
  }
15555
15555
  }
15556
15556
 
15557
- export { COMPACTION_ENABLED_PATH, isDreamerRunnable, isCompactionEnabled, formatConfigParseStatusLine, formatConfigParseNotice, claimConfigParseFailuresOnce, parseJsoncRecovering, detectConfigFile, MIN_PLAUSIBLE_CONTEXT_LIMIT, catalogOutputReserve, deriveWindowGeometry, hasTrustedAbsoluteWall, applyProvenInputFloor, formatWindowDerivationLine, formatWindowSource, isSaneLimit, resolveOutputReserve, getSdkWindowGeometry, getSdkContextLimit, getSdkOutputLimit, getSdkInputLimit, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, HAS_COMPARTMENT_CONTENT_SQL, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndThrough, isPartialCompartmentEnd, readProjectDocsCanonical, providerResponseFailed, isSuccessfulProviderCompletion, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, recordSystemRefreshOwnership, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, acknowledgeSystemPromptDelivery, deferDeliveredSystemRefresh, clearSystemPromptDelivery, saveLkgSlotToDb, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, replayLkg, registerLkgPersistence, LKG_SNAPSHOT_ARRAY, LKG_SNAPSHOT_OBJECT, LKG_SNAPSHOT_KEY, LKG_SNAPSHOT_STRING, LKG_SNAPSHOT_NUMBER, LKG_SNAPSHOT_BOOLEAN, LKG_SNAPSHOT_NULL, LKG_SNAPSHOT_UNDEFINED, contentSnapshotValue, signatureForFields, lkgContentFields, lkgContentDigestFromFields, isLegacyLkgDigest, legacyLkgDigestFromFields, lkgFieldsMatchDigest, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, dropSlot, TOOL_SWEEP_SCOPED_MARKER, encodePiContentDecision, decodePiContentDecision, getPiContentDecisions, freezePiContentDecision, getNativeReplayState, saveNativeToolInputs, addNativeReasoningIds, copySessionStateForClone, externalHistorianFailureReason, subprocessExitHistorianFailureReason, countHistorianRuns, recordHistorianRun, summarizeImportance, tallyFactsByCategory, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId, noteTouchedAt, noteNudgePickIndex, formatNoteNudge, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, SYNTH_USER_ID_PREFIX, resolvePiStableId, resolvePiRealStableId, isPiContentFallbackId, isPiIndexFallbackId, piContentFallbackIds, readPiSessionSnapshot, readPiSessionMessages, readPiSessionMessagePage, findRestartModelSeedFromBranch, iterateEntriesToRawMessageRange, iterateAsyncEntriesToRawMessageRange, convertEntriesToRawMessages, convertPiAssistantEntryById, convertEntriesToRawMessagePage, countPiRawMessages, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getTaskScheduleState, getFailingDreamTasks, getSkippedDreamTasks, getMostRecentTaskRunAt, pruneNonCanonicalTaskRows, deleteTaskScheduleRowsForProject, seedTaskScheduleState, writeTaskScheduleState, isRetrospectiveWindowProcessed, recordRetrospectiveWindowProcessed, curateCategoryForMemoryCategory, peekCurateCategoryScope, beginCurateCategoryRun, curateTaskStateAfterSuccess, MEMORY_MURAL_BLOCK, buildMagicContextSection, resolveMuralWire, updateCompactionMarkerAfterPublication, COMPARTMENT_RENDER_EPOCH, MEMORY_RENDER_FORMAT_EPOCH, encodeCachedM0UpgradeIdentity, decodeCachedM0UpgradeIdentity, withCachedM0MemoryIds, readCachedM0MemoryIds, renderBudgetIdentityChanged, renderedBudgetSnapshot, renderedBudgetShrinkReason, DEFAULT_HISTORY_BUDGET_TOKENS, renderCompartmentAtTier, renderDecayedCompartments, extractM0Block, TEMPORAL_MARKER_PATTERN, TEMPORAL_MARKER_REPLAY_PATTERN, temporalMarkerPrefix, renderUserProfileContent, clearInjectionCache, getVisibleMemoryIds, orderHistorianMemories, renderHistorianMemoryBlock, DEFAULT_MEMORY_BUDGET_TOKENS, DEFAULT_USER_PROFILE_BUDGET_TOKENS, trimMemoriesToBudgetV2, trimWorkspaceMemoriesToBudgetV2, trimUserMemoriesToBudget, renderMemoryBlockV2, stripMemoryMuralBlock, resetPrefixTrimFallbackState, isDirectiveShapedProjectRule, takeCurateSafetyRefusalCount, wakePlaneStatus, loadPiConfig, loadPiConfigDetailed, unregisterPiProjectEmbeddings, ensureProjectRegisteredFromPiDirectory, resolvePiHarnessDetection, resolvePiHarnessKind, resolvePiOrdinalAlignment, piRawOrdinalOffsetSource, resolvePiOrdinalAlignmentForContext, isPiOrdinalAlignmentUnanchored, clearPiOrdinalAlignmentSession, rememberTodowriteToolCallTodos, parseTodos, setTodoSnapshot, registerTodoOverlay, registerTodoStateLifecycle, syncCtxMemoryToolEnabled, registerMagicContextTools };
15557
+ export { COMPACTION_ENABLED_PATH, isDreamerRunnable, isCompactionEnabled, formatConfigParseStatusLine, formatConfigParseNotice, claimConfigParseFailuresOnce, parseJsoncRecovering, detectConfigFile, OPENCODE_OUTPUT_CAP, MIN_PLAUSIBLE_CONTEXT_LIMIT, catalogOutputReserve, deriveWindowGeometry, hasTrustedAbsoluteWall, applyProvenInputFloor, formatWindowDerivationLine, formatWindowSource, isSaneLimit, resolveOutputReserve, getSdkWindowGeometry, getSdkContextLimit, getSdkOutputLimit, getSdkInputLimit, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, HAS_COMPARTMENT_CONTENT_SQL, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndThrough, isPartialCompartmentEnd, readProjectDocsCanonical, providerResponseFailed, isSuccessfulProviderCompletion, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, recordSystemRefreshOwnership, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, acknowledgeSystemPromptDelivery, deferDeliveredSystemRefresh, clearSystemPromptDelivery, saveLkgSlotToDb, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, replayLkg, registerLkgPersistence, LKG_SNAPSHOT_ARRAY, LKG_SNAPSHOT_OBJECT, LKG_SNAPSHOT_KEY, LKG_SNAPSHOT_STRING, LKG_SNAPSHOT_NUMBER, LKG_SNAPSHOT_BOOLEAN, LKG_SNAPSHOT_NULL, LKG_SNAPSHOT_UNDEFINED, contentSnapshotValue, signatureForFields, lkgContentFields, lkgContentDigestFromFields, isLegacyLkgDigest, legacyLkgDigestFromFields, lkgFieldsMatchDigest, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, dropSlot, TOOL_SWEEP_SCOPED_MARKER, encodePiContentDecision, decodePiContentDecision, getPiContentDecisions, freezePiContentDecision, getNativeReplayState, saveNativeToolInputs, addNativeReasoningIds, copySessionStateForClone, externalHistorianFailureReason, subprocessExitHistorianFailureReason, countHistorianRuns, recordHistorianRun, summarizeImportance, tallyFactsByCategory, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId, noteTouchedAt, noteNudgePickIndex, formatNoteNudge, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, SYNTH_USER_ID_PREFIX, resolvePiStableId, resolvePiRealStableId, isPiContentFallbackId, isPiIndexFallbackId, piContentFallbackIds, readPiSessionSnapshot, readPiSessionMessages, readPiSessionMessagePage, findRestartModelSeedFromBranch, iterateEntriesToRawMessageRange, iterateAsyncEntriesToRawMessageRange, convertEntriesToRawMessages, convertPiAssistantEntryById, convertEntriesToRawMessagePage, countPiRawMessages, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getTaskScheduleState, getFailingDreamTasks, getSkippedDreamTasks, getMostRecentTaskRunAt, pruneNonCanonicalTaskRows, deleteTaskScheduleRowsForProject, seedTaskScheduleState, writeTaskScheduleState, isRetrospectiveWindowProcessed, recordRetrospectiveWindowProcessed, curateCategoryForMemoryCategory, peekCurateCategoryScope, beginCurateCategoryRun, curateTaskStateAfterSuccess, MEMORY_MURAL_BLOCK, buildMagicContextSection, resolveMuralWire, updateCompactionMarkerAfterPublication, COMPARTMENT_RENDER_EPOCH, MEMORY_RENDER_FORMAT_EPOCH, encodeCachedM0UpgradeIdentity, decodeCachedM0UpgradeIdentity, withCachedM0MemoryIds, readCachedM0MemoryIds, renderBudgetIdentityChanged, renderedBudgetSnapshot, renderedBudgetShrinkReason, DEFAULT_HISTORY_BUDGET_TOKENS, renderCompartmentAtTier, renderDecayedCompartments, extractM0Block, TEMPORAL_MARKER_PATTERN, TEMPORAL_MARKER_REPLAY_PATTERN, temporalMarkerPrefix, renderUserProfileContent, clearInjectionCache, getVisibleMemoryIds, orderHistorianMemories, renderHistorianMemoryBlock, DEFAULT_MEMORY_BUDGET_TOKENS, DEFAULT_USER_PROFILE_BUDGET_TOKENS, trimMemoriesToBudgetV2, trimWorkspaceMemoriesToBudgetV2, trimUserMemoriesToBudget, renderMemoryBlockV2, stripMemoryMuralBlock, resetPrefixTrimFallbackState, isDirectiveShapedProjectRule, takeCurateSafetyRefusalCount, wakePlaneStatus, loadPiConfig, loadPiConfigDetailed, unregisterPiProjectEmbeddings, ensureProjectRegisteredFromPiDirectory, resolvePiHarnessDetection, resolvePiHarnessKind, resolvePiOrdinalAlignment, piRawOrdinalOffsetSource, resolvePiOrdinalAlignmentForContext, isPiOrdinalAlignmentUnanchored, clearPiOrdinalAlignmentSession, rememberTodowriteToolCallTodos, parseTodos, setTodoSnapshot, registerTodoOverlay, registerTodoStateLifecycle, syncCtxMemoryToolEnabled, registerMagicContextTools };