@cortexkit/pi-magic-context 0.49.9 → 0.49.11
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 +3 -3
- package/dist/{embedding-backfill-chva00z3.js → embedding-backfill-1tknh2jn.js} +3 -3
- package/dist/{index-rkwh9kce.js → index-0vq6ebae.js} +35 -16
- package/dist/{index-ns319t8e.js → index-2df03yc3.js} +12 -7
- package/dist/{index-qc8e13wc.js → index-78c864c8.js} +1 -1
- package/dist/{index-243wh86p.js → index-9azmm7cg.js} +1 -1
- package/dist/{index-6e3yv1jt.js → index-drah07tf.js} +238 -130
- package/dist/{index-9vzkrnrf.js → index-m8aaepft.js} +23 -19
- package/dist/{index-h160xxaq.js → index-s3c9dskk.js} +2 -2
- package/dist/{index-v26j81w6.js → index-s9kwv5pp.js} +1 -1
- package/dist/index.js +163 -57
- package/dist/{message-index-ejaa9may.js → message-index-5zjmsg57.js} +3 -3
- package/dist/{message-index-bounded-y1c88n9a.js → message-index-bounded-chgr6dn3.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/{project-embedding-registry-bxawck58.js → project-embedding-registry-dk5axctd.js} +2 -2
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{read-session-chunk-4094zemt.js → read-session-chunk-3kb7r5pq.js} +1 -1
- package/dist/{search-hsr95vex.js → search-8pczyejh.js} +6 -6
- package/dist/subagent-entry.js +8 -8
- package/package.json +1 -1
|
@@ -18,11 +18,11 @@ var [
|
|
|
18
18
|
{ Database, registerSqliteDiagnosticSink },
|
|
19
19
|
{ log }
|
|
20
20
|
] = await Promise.all([
|
|
21
|
-
import("./embedding-backfill-
|
|
21
|
+
import("./embedding-backfill-1tknh2jn.js"),
|
|
22
22
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
23
23
|
import("./storage-memory-axnsk5t1.js"),
|
|
24
|
-
import("./project-embedding-registry-
|
|
25
|
-
import("./search-
|
|
24
|
+
import("./project-embedding-registry-dk5axctd.js"),
|
|
25
|
+
import("./search-8pczyejh.js"),
|
|
26
26
|
import("./embedding-activity-ew6dshfd.js"),
|
|
27
27
|
import("./harness-9872e0ym.js"),
|
|
28
28
|
import("./sqlite-adjpy399.js"),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureMemoryEmbeddings2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
3
|
+
} from "./index-s9kwv5pp.js";
|
|
4
|
+
import"./index-78c864c8.js";
|
|
5
5
|
import"./index-9p40dgkm.js";
|
|
6
|
-
import"./index-
|
|
6
|
+
import"./index-drah07tf.js";
|
|
7
7
|
import"./index-yhzhdp3m.js";
|
|
8
8
|
import"./index-8yjhda46.js";
|
|
9
9
|
import"./index-szh001qb.js";
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
readRawSessionMessageIdOrdinalsForRange2,
|
|
57
57
|
readRawSessionMessageById2,
|
|
58
58
|
readSessionChunk2
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-m8aaepft.js";
|
|
60
60
|
import {
|
|
61
61
|
isRecord,
|
|
62
62
|
providerVisibleMessage,
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
clearLkgRecoveryFence,
|
|
104
104
|
deleteSessionScopedRows,
|
|
105
105
|
getLastIndexedOrdinal2
|
|
106
|
-
} from "./index-
|
|
106
|
+
} from "./index-s3c9dskk.js";
|
|
107
107
|
import {
|
|
108
108
|
SubcClient,
|
|
109
109
|
connectionFileExists,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
} from "./index-fdxzpnbj.js";
|
|
117
117
|
import {
|
|
118
118
|
getErrorMessage
|
|
119
|
-
} from "./index-
|
|
119
|
+
} from "./index-9azmm7cg.js";
|
|
120
120
|
import {
|
|
121
121
|
V2_MEMORY_CATEGORIES,
|
|
122
122
|
CATEGORY_PRIORITY,
|
|
@@ -148,7 +148,7 @@ import {
|
|
|
148
148
|
unregisterProjectEmbedding2,
|
|
149
149
|
getProjectEmbeddingSnapshot2,
|
|
150
150
|
embedTextForProject2
|
|
151
|
-
} from "./index-
|
|
151
|
+
} from "./index-78c864c8.js";
|
|
152
152
|
import {
|
|
153
153
|
getNoteByIdInScope,
|
|
154
154
|
getNotes,
|
|
@@ -165,7 +165,7 @@ import {
|
|
|
165
165
|
resolveMemoriesByIdsForSearch2,
|
|
166
166
|
unifiedSearch2,
|
|
167
167
|
formatSearchResults2
|
|
168
|
-
} from "./index-
|
|
168
|
+
} from "./index-2df03yc3.js";
|
|
169
169
|
import {
|
|
170
170
|
computeCueContentHash,
|
|
171
171
|
getMuralCueState,
|
|
@@ -4534,6 +4534,21 @@ class V2StoreReader {
|
|
|
4534
4534
|
return row ? decode(row) : null;
|
|
4535
4535
|
});
|
|
4536
4536
|
}
|
|
4537
|
+
messageTimes(sessionID, ids) {
|
|
4538
|
+
const times = new Map;
|
|
4539
|
+
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
4540
|
+
const batch = ids.slice(offset, offset + 500);
|
|
4541
|
+
const rows = this.prepare(`SELECT id, COALESCE(time_created, json_extract(data, '$.time.created')) AS created,
|
|
4542
|
+
json_extract(data, '$.time.completed') AS completed
|
|
4543
|
+
FROM session_message WHERE session_id = ? AND id IN (${batch.map(() => "?").join(",")})`).all(sessionID, ...batch);
|
|
4544
|
+
for (const row of rows)
|
|
4545
|
+
times.set(row.id, {
|
|
4546
|
+
created: typeof row.created === "number" ? row.created : undefined,
|
|
4547
|
+
completed: typeof row.completed === "number" ? row.completed : undefined
|
|
4548
|
+
});
|
|
4549
|
+
}
|
|
4550
|
+
return times;
|
|
4551
|
+
}
|
|
4537
4552
|
messageExistsById(sessionID, id) {
|
|
4538
4553
|
return trackDecodeOperation("messageExistsById", () => {
|
|
4539
4554
|
const rawTypes = RAW_MESSAGE_TYPES.map(() => "?").join(", ");
|
|
@@ -7970,6 +7985,7 @@ function formatNoteNudge(args) {
|
|
|
7970
7985
|
}
|
|
7971
7986
|
|
|
7972
7987
|
// ../plugin/src/shared/prompt-surface-runtime.ts
|
|
7988
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
7973
7989
|
import { existsSync as existsSync5, readFileSync as readFileSync7, statSync as statSync5 } from "node:fs";
|
|
7974
7990
|
import { dirname as dirname4, isAbsolute as isAbsolute3, resolve as resolve3 } from "node:path";
|
|
7975
7991
|
|
|
@@ -8001,6 +8017,9 @@ function promptSurfaceHashMaterial(systemContent, preset = "full") {
|
|
|
8001
8017
|
return preset === "full" ? systemContent : `${systemContent}
|
|
8002
8018
|
\x00magic-context-prompt-surface:${preset}`;
|
|
8003
8019
|
}
|
|
8020
|
+
function systemPromptFingerprint(systemContent, preset = "full") {
|
|
8021
|
+
return createHash5("md5").update(promptSurfaceHashMaterial(systemContent, preset)).digest("hex");
|
|
8022
|
+
}
|
|
8004
8023
|
var PROMPT_SURFACE_TOOL_ID_SET = new Set(ACTIVE_TOOL_IDS);
|
|
8005
8024
|
function resolveUserConfigDirectory(options) {
|
|
8006
8025
|
if (options.userConfigDirectory)
|
|
@@ -8113,7 +8132,7 @@ function createPromptSurfaceGuidanceEpochCache(runtime) {
|
|
|
8113
8132
|
}
|
|
8114
8133
|
|
|
8115
8134
|
// src/read-session-pi.ts
|
|
8116
|
-
import { createHash as
|
|
8135
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
8117
8136
|
var SYNTH_USER_ID_PREFIX = "synth-user-";
|
|
8118
8137
|
function resolvePiStableId(msg, index, entryIds, entryIdByRef) {
|
|
8119
8138
|
if (!msg || typeof msg !== "object")
|
|
@@ -8152,7 +8171,7 @@ function piContentFallbackIds(messages, resolveReal) {
|
|
|
8152
8171
|
return;
|
|
8153
8172
|
const m = message;
|
|
8154
8173
|
const role = typeof m.role === "string" ? m.role : "unknown";
|
|
8155
|
-
const digest =
|
|
8174
|
+
const digest = createHash6("sha256").update(stableStringify([
|
|
8156
8175
|
typeof m.responseId === "string" ? m.responseId : null,
|
|
8157
8176
|
typeof m.timestamp === "number" || typeof m.timestamp === "string" ? m.timestamp : null,
|
|
8158
8177
|
role,
|
|
@@ -9103,7 +9122,7 @@ function compareMemorySelectionPriority(left, right) {
|
|
|
9103
9122
|
}
|
|
9104
9123
|
|
|
9105
9124
|
// ../plugin/src/features/magic-context/mural/render-trigger.ts
|
|
9106
|
-
import { createHash as
|
|
9125
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
9107
9126
|
|
|
9108
9127
|
// ../plugin/src/features/magic-context/mural/mural-selection.ts
|
|
9109
9128
|
var DEFAULT_MURAL_MEMORY_BUDGET = 8000;
|
|
@@ -9792,7 +9811,7 @@ function ensureMuralRendered(db, projectIdentity, budgetTokens = DEFAULT_MURAL_M
|
|
|
9792
9811
|
return { ...cached.result };
|
|
9793
9812
|
}
|
|
9794
9813
|
const plan = planMuralRender(entries);
|
|
9795
|
-
const textHash =
|
|
9814
|
+
const textHash = createHash7("sha256").update(plan.layout.text).digest("hex");
|
|
9796
9815
|
if (existing && existing.contentHash === textHash && existing.width === plan.width && existing.height === plan.height) {
|
|
9797
9816
|
return rememberRender(db, projectIdentity, key, existing.image, {
|
|
9798
9817
|
hasMural: true,
|
|
@@ -9849,14 +9868,14 @@ function resolveMuralWire(db, projectIdentity, modelKey, enabled, budgetTokens =
|
|
|
9849
9868
|
}
|
|
9850
9869
|
|
|
9851
9870
|
// ../plugin/src/features/magic-context/compaction-marker.ts
|
|
9852
|
-
import { createHash as
|
|
9871
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
9853
9872
|
import { existsSync as existsSync6, statSync as statSync6 } from "node:fs";
|
|
9854
9873
|
var BASE62_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
9855
9874
|
var ID_PREFIX_HEX_LENGTH = 12;
|
|
9856
9875
|
var ID_SUFFIX_LENGTH = 14;
|
|
9857
9876
|
var ID_PREFIX_MASK = (1n << BigInt(ID_PREFIX_HEX_LENGTH * 4)) - 1n;
|
|
9858
9877
|
function deterministicBase62(seed, length) {
|
|
9859
|
-
let value = BigInt(`0x${
|
|
9878
|
+
let value = BigInt(`0x${createHash8("sha256").update(seed).digest("hex")}`);
|
|
9860
9879
|
const chars = Array(length);
|
|
9861
9880
|
for (let index = length - 1;index >= 0; index -= 1) {
|
|
9862
9881
|
chars[index] = BASE62_CHARS[Number(value % 62n)];
|
|
@@ -11108,7 +11127,7 @@ async function wakePlaneStatus() {
|
|
|
11108
11127
|
import { statSync as statSync7 } from "node:fs";
|
|
11109
11128
|
|
|
11110
11129
|
// ../plugin/src/plugin/embedding-bootstrap-helpers.ts
|
|
11111
|
-
import { createHash as
|
|
11130
|
+
import { createHash as createHash9 } from "node:crypto";
|
|
11112
11131
|
var EMBEDDING_AFFECTING_KEYS = new Set([
|
|
11113
11132
|
"embedding.api_key",
|
|
11114
11133
|
"embedding.endpoint",
|
|
@@ -11156,7 +11175,7 @@ var EMBEDDING_WARNING_TERMS = [
|
|
|
11156
11175
|
];
|
|
11157
11176
|
var loggedFailureSignatures = new Map;
|
|
11158
11177
|
function sha256Prefix(value, length = 16) {
|
|
11159
|
-
return
|
|
11178
|
+
return createHash9("sha256").update(value).digest("hex").slice(0, length);
|
|
11160
11179
|
}
|
|
11161
11180
|
function warningLooksEmbeddingRelated(message) {
|
|
11162
11181
|
const lower = message.toLowerCase();
|
|
@@ -12408,7 +12427,7 @@ function resolveCtxExpandMode(args, domain) {
|
|
|
12408
12427
|
}
|
|
12409
12428
|
|
|
12410
12429
|
// ../plugin/src/tools/ctx-expand/render.ts
|
|
12411
|
-
import { createHash as
|
|
12430
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
12412
12431
|
function isRecord3(value) {
|
|
12413
12432
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
12414
12433
|
}
|
|
@@ -12632,7 +12651,7 @@ function renderItemByTag(db, sessionId, number, textIndexDomain = "part") {
|
|
|
12632
12651
|
const index = scoped ? Number(scoped[2]) : 0;
|
|
12633
12652
|
const piText = message.parts.filter((part) => isRecord3(part) && part.type === "text");
|
|
12634
12653
|
const part = message.parts[index];
|
|
12635
|
-
const matching = derived ? piText.filter((part) => isRecord3(part) && typeof part.text === "string" &&
|
|
12654
|
+
const matching = derived ? piText.filter((part) => isRecord3(part) && typeof part.text === "string" && createHash10("sha256").update(part.text).digest("hex") === derived[3]) : [];
|
|
12636
12655
|
const selected = derived ? matching[Number(derived[4])] : textIndexDomain === "text" ? piText[index] : part;
|
|
12637
12656
|
return selected ? renderPartFull(selected) ?? "" : `Tag ${number}'s original text part is no longer in stored history.`;
|
|
12638
12657
|
}
|
|
@@ -15541,4 +15560,4 @@ function registerMagicContextTools(pi, opts) {
|
|
|
15541
15560
|
}
|
|
15542
15561
|
}
|
|
15543
15562
|
|
|
15544
|
-
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, embedPauseBySession, embedRunStateBySession, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, 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, 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,
|
|
15563
|
+
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, embedPauseBySession, embedRunStateBySession, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, 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, 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 };
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
buildCanonicalChunkTextFromFts,
|
|
34
34
|
loadCompartmentChunkEmbeddingsForSearch
|
|
35
|
-
} from "./index-
|
|
35
|
+
} from "./index-drah07tf.js";
|
|
36
36
|
import {
|
|
37
37
|
recordEmbeddingMeasurement,
|
|
38
38
|
saveCommitEmbedding,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
getProjectEmbeddingSnapshot2,
|
|
51
51
|
embedTextForProject2,
|
|
52
52
|
embedItemsForProject2
|
|
53
|
-
} from "./index-
|
|
53
|
+
} from "./index-78c864c8.js";
|
|
54
54
|
import {
|
|
55
55
|
saveEmbeddingIfHashMatches,
|
|
56
56
|
getProjectEmbeddings2
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
isEmbeddingEnabled,
|
|
61
61
|
embedText,
|
|
62
62
|
ensureMemoryEmbeddings2
|
|
63
|
-
} from "./index-
|
|
63
|
+
} from "./index-s9kwv5pp.js";
|
|
64
64
|
import {
|
|
65
65
|
getMemorySelectColumns2,
|
|
66
66
|
isMemoryRow2,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
} from "./index-hy44m6jc.js";
|
|
78
78
|
import {
|
|
79
79
|
getIndexedMessageCorpusSize2
|
|
80
|
-
} from "./index-
|
|
80
|
+
} from "./index-s3c9dskk.js";
|
|
81
81
|
import {
|
|
82
82
|
computeNormalizedHash
|
|
83
83
|
} from "./index-9x1f96r8.js";
|
|
@@ -3199,15 +3199,20 @@ function searchNotes(args) {
|
|
|
3199
3199
|
sourceSessionId: entry.entry.note.sessionId
|
|
3200
3200
|
}));
|
|
3201
3201
|
}
|
|
3202
|
-
function searchCompartmentChunks(args) {
|
|
3202
|
+
async function searchCompartmentChunks(args) {
|
|
3203
3203
|
if (!args.queryEmbedding || args.limit <= 0 || !args.modelId || args.modelId === "off")
|
|
3204
3204
|
return [];
|
|
3205
3205
|
const cutoff = args.maxOrdinal != null && args.maxOrdinal >= 0 ? args.maxOrdinal : null;
|
|
3206
|
-
const rows = loadCompartmentChunkEmbeddingsForSearch(args.db, args.sessionId, args.projectPath, args.modelId, args.dateRange);
|
|
3206
|
+
const rows = await loadCompartmentChunkEmbeddingsForSearch(args.db, args.sessionId, args.projectPath, args.modelId, args.dateRange);
|
|
3207
3207
|
if (rows.length === 0)
|
|
3208
3208
|
return [];
|
|
3209
3209
|
const byCompartment = new Map;
|
|
3210
|
+
let sliceStarted = performance.now();
|
|
3210
3211
|
for (const row of rows) {
|
|
3212
|
+
if (performance.now() - sliceStarted >= 4) {
|
|
3213
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
3214
|
+
sliceStarted = performance.now();
|
|
3215
|
+
}
|
|
3211
3216
|
if (cutoff !== null && row.endOrdinal > cutoff) {
|
|
3212
3217
|
continue;
|
|
3213
3218
|
}
|
|
@@ -3563,7 +3568,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3563
3568
|
const workspace = resolveSearchWorkspaceContext(db, projectPath);
|
|
3564
3569
|
const embeddingModelId = queryContract?.modelId ?? options.embeddingModelIdOverride ?? embeddingSnapshot?.modelId;
|
|
3565
3570
|
const chunkModelId = queryContract?.chunkModelId ?? options.chunkModelIdOverride ?? embeddingSnapshot?.chunkModelId;
|
|
3566
|
-
const compartmentResults = runCompartmentChunks ? searchCompartmentChunks({
|
|
3571
|
+
const compartmentResults = runCompartmentChunks ? await searchCompartmentChunks({
|
|
3567
3572
|
db,
|
|
3568
3573
|
sessionId,
|
|
3569
3574
|
projectPath,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
countSessionCompartmentEmbedCoverage,
|
|
41
41
|
countSessionCompartmentEmbedCoveragePolite,
|
|
42
42
|
countUnembeddedSessionCompartmentsPolite
|
|
43
|
-
} from "./index-
|
|
43
|
+
} from "./index-drah07tf.js";
|
|
44
44
|
import {
|
|
45
45
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
46
46
|
} from "./index-ta0ed2nc.js";
|
|
@@ -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-3kb7r5pq.js"));
|
|
1302
1302
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-q9s88zdv.js"));
|
|
1303
1303
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
1304
1304
|
readPage: readRawSessionMessagePage
|