@cortexkit/pi-magic-context 0.49.13 → 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.
- package/dist/auto-search-worker.js +1 -1
- package/dist/chunk-embedding-write-worker.js +2 -2
- package/dist/historian-calibration-extension.js +15 -103
- package/dist/{index-wp9q91kn.js → index-0awvkeb5.js} +2 -2
- package/dist/index-1vw4f2pe.js +907 -0
- package/dist/{index-53xdqb3d.js → index-75ah9413.js} +1 -1
- package/dist/{index-vv1j5cak.js → index-a4pk5yv9.js} +1 -1
- package/dist/{index-y29y2j2w.js → index-ajfpyk0x.js} +164 -11
- package/dist/{index-t27xk4r7.js → index-ccsscaap.js} +2 -2
- package/dist/{index-aypx5h57.js → index-hshd96pt.js} +7 -7
- package/dist/{index-ed9d2ded.js → index-j0n09wtp.js} +4 -1
- package/dist/index.js +2516 -2071
- package/dist/{message-index-bounded-80n96ehp.js → message-index-bounded-z4d3x9ty.js} +3 -3
- package/dist/{message-index-7w179p64.js → message-index-dw4z9efj.js} +3 -3
- package/dist/migration-worker.js +2 -2
- package/dist/raw-ordinal-warmup-worker.js +3 -3
- package/dist/{read-session-chunk-83864b37.js → read-session-chunk-0fsgg2k1.js} +2 -2
- package/dist/{search-hffb8xht.js → search-ddbz6v60.js} +7 -7
- package/dist/{storage-tags-zmf30zqp.js → storage-tags-3kb5tvgg.js} +3 -1
- package/dist/subagent-entry.js +7 -7
- package/dist/tag-snapshot-worker-pi.js +235 -0
- package/package.json +5 -3
- /package/dist/{index-e6xnpach.js → index-b7p25tm0.js} +0 -0
- /package/dist/{index-3cnarwf8.js → index-bet4sd3e.js} +0 -0
|
@@ -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/
|
|
355
|
-
|
|
356
|
-
|
|
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
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
-
|
|
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,
|
|
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 };
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
hasPendingMigrations,
|
|
52
52
|
getMainThreadMigrationBodyCount,
|
|
53
53
|
runMigrations
|
|
54
|
-
} from "./index-
|
|
54
|
+
} from "./index-bet4sd3e.js";
|
|
55
55
|
import {
|
|
56
56
|
closeQuietly,
|
|
57
57
|
ensureColumn,
|
|
@@ -1298,7 +1298,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1298
1298
|
startMessageFtsRowidMapBackfill(db).then(async () => {
|
|
1299
1299
|
if (!readsOpenCodeStore)
|
|
1300
1300
|
return;
|
|
1301
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1301
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-0fsgg2k1.js"));
|
|
1302
1302
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-r2ar1qvk.js"));
|
|
1303
1303
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
1304
1304
|
readPage: readRawSessionMessagePage
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
readRawSessionMessageIdOrdinalsForRange2,
|
|
57
57
|
readRawSessionMessageById2,
|
|
58
58
|
readSessionChunk2
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-75ah9413.js";
|
|
60
60
|
import {
|
|
61
61
|
isRecord,
|
|
62
62
|
providerVisibleMessage,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
getTagNumberByMessageId2,
|
|
71
71
|
getTagsBySession2,
|
|
72
72
|
getTagById2
|
|
73
|
-
} from "./index-
|
|
73
|
+
} from "./index-j0n09wtp.js";
|
|
74
74
|
import {
|
|
75
75
|
estimateTokens
|
|
76
76
|
} from "./index-g4jf772p.js";
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
clearLkgRecoveryFence,
|
|
104
104
|
deleteSessionScopedRows,
|
|
105
105
|
getLastIndexedOrdinal2
|
|
106
|
-
} from "./index-
|
|
106
|
+
} from "./index-a4pk5yv9.js";
|
|
107
107
|
import {
|
|
108
108
|
SubcClient,
|
|
109
109
|
connectionFileExists,
|
|
@@ -129,7 +129,7 @@ import {
|
|
|
129
129
|
} from "./index-nwbhe6qv.js";
|
|
130
130
|
import {
|
|
131
131
|
getErrorMessage
|
|
132
|
-
} from "./index-
|
|
132
|
+
} from "./index-ccsscaap.js";
|
|
133
133
|
import {
|
|
134
134
|
V2_MEMORY_CATEGORIES,
|
|
135
135
|
CATEGORY_PRIORITY,
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
expandWorkspaceIdentitySetWithAliases,
|
|
144
144
|
resolveStoredPathWorkspaceIdentity,
|
|
145
145
|
storedPathBelongsToWorkspace
|
|
146
|
-
} from "./index-
|
|
146
|
+
} from "./index-bet4sd3e.js";
|
|
147
147
|
import {
|
|
148
148
|
directoryHasGitMetadata,
|
|
149
149
|
resolveProjectIdentityForSession,
|
|
@@ -166,7 +166,7 @@ import {
|
|
|
166
166
|
resolveMemoriesByIdsForSearch2,
|
|
167
167
|
unifiedSearch2,
|
|
168
168
|
formatSearchResults2
|
|
169
|
-
} from "./index-
|
|
169
|
+
} from "./index-0awvkeb5.js";
|
|
170
170
|
import {
|
|
171
171
|
computeCueContentHash,
|
|
172
172
|
getMuralCueState,
|
|
@@ -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 };
|
|
@@ -2511,6 +2511,9 @@ function toTagEntry(row) {
|
|
|
2511
2511
|
tokenCount: typeof row.token_count === "number" ? row.token_count : null
|
|
2512
2512
|
};
|
|
2513
2513
|
}
|
|
2514
|
+
function normalizeTagSnapshotRow2(row) {
|
|
2515
|
+
return isTagRow(row) ? toTagEntry(row) : null;
|
|
2516
|
+
}
|
|
2514
2517
|
function isTagNumberRow(row) {
|
|
2515
2518
|
if (row === null || typeof row !== "object")
|
|
2516
2519
|
return false;
|
|
@@ -3380,4 +3383,4 @@ function deleteToolTagsByOwner(db, sessionId, ownerMsgId) {
|
|
|
3380
3383
|
return getDeleteToolTagsByOwnerStatement(db).all(sessionId, ownerMsgId).length;
|
|
3381
3384
|
}
|
|
3382
3385
|
|
|
3383
|
-
export { UNKNOWN_FIT_RATIO, resolveDecisionCalibration, hasMeasuredDecisionCalibration, providerMass, localBudget, calibrationForModelKey, historyLocalBudget, adoptedProtectedToolsPolicy, protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, rememberCurrentToolOutputCount, currentReclaimableToolOutputCount, isRecord, TEXT_TAG_IDENTITY_MARKER, PI_FALLBACK_PREFIXES_JSON, contentTagOwnerMessageId, TailHygieneJsonMemo, piJsonHash, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, TODO_STATUSES, TODO_PRIORITIES, TITLE_DONE_STATUSES, normalizeTodoStateJson, buildSyntheticTodoPart, stripChannel1ReminderSpans, compareMeasuredTailPrefix, formatTailHygienePrefixMismatch, freezeTailHygieneMeasurement, effectiveTailHygiene, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, decideChannel1, evaluateChannel2, buildChannel2Reminder, buildChannel1Reminder, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, getPendingOpsCount, clearPendingOps, removePendingOp, updateTagByteSize2, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, updateTagInputByteSize2, updateTagTokenCount2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, scanTagOwnerDelta2, updateTagInputTokenCount2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markTagDropped2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, PiTagIdentityConflictError2, getPiMessageTagCandidates2, findPiTagIdentityConflict2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
|
|
3386
|
+
export { UNKNOWN_FIT_RATIO, resolveDecisionCalibration, hasMeasuredDecisionCalibration, providerMass, localBudget, calibrationForModelKey, historyLocalBudget, adoptedProtectedToolsPolicy, protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, rememberCurrentToolOutputCount, currentReclaimableToolOutputCount, isRecord, TEXT_TAG_IDENTITY_MARKER, PI_FALLBACK_PREFIXES_JSON, contentTagOwnerMessageId, TailHygieneJsonMemo, piJsonHash, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, TODO_STATUSES, TODO_PRIORITIES, TITLE_DONE_STATUSES, normalizeTodoStateJson, buildSyntheticTodoPart, stripChannel1ReminderSpans, compareMeasuredTailPrefix, formatTailHygienePrefixMismatch, freezeTailHygieneMeasurement, effectiveTailHygiene, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, decideChannel1, evaluateChannel2, buildChannel2Reminder, buildChannel1Reminder, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, getPendingOpsCount, clearPendingOps, removePendingOp, updateTagByteSize2, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, updateTagInputByteSize2, updateTagTokenCount2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, scanTagOwnerDelta2, updateTagInputTokenCount2, tagTokenCountIsNull2, backfillTagTokenCounts2, normalizeTagSnapshotRow2, insertTag2, updateTagStatus2, markTagDropped2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, PiTagIdentityConflictError2, getPiMessageTagCandidates2, findPiTagIdentityConflict2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
|