@cortexkit/pi-magic-context 0.49.1 → 0.49.3
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/compaction-marker-candidates-cd17s4ys.js +18 -0
- package/dist/compaction-marker-candidates-worker.js +24 -0
- package/dist/{embedding-backfill-scywarbn.js → embedding-backfill-r7n7dj50.js} +4 -4
- package/dist/{index-vakawmbc.js → index-2apf1afe.js} +5 -20
- package/dist/index-399p688g.js +19 -0
- package/dist/{index-0rasmwm8.js → index-57njcjax.js} +6 -6
- package/dist/{index-fqb1bddn.js → index-590pwxvr.js} +14 -3
- package/dist/{index-kjd1fj55.js → index-9n88gmpf.js} +45 -7
- package/dist/{index-b2anqqad.js → index-9ygacw4e.js} +101 -31
- package/dist/{index-p5zesr4e.js → index-a1jmtv6r.js} +3 -3
- package/dist/{index-28vnkyy7.js → index-bv2r9rpa.js} +57 -30
- package/dist/{index-r874cgmv.js → index-g1csz24n.js} +1 -1
- package/dist/index-g3600tpw.js +212 -0
- package/dist/{index-g7hndmqm.js → index-g7984a4r.js} +4 -2
- package/dist/{index-rd53pk0h.js → index-mzn6t38b.js} +1 -1
- package/dist/{index-rdtgp48t.js → index-xvm5cdyn.js} +1 -1
- package/dist/index.js +13712 -12032
- package/dist/message-index-2damq13v.js +56 -0
- package/dist/{message-index-bounded-110sb4fm.js → message-index-bounded-0qa5eacp.js} +16 -15
- package/dist/migration-worker.js +3 -3
- package/dist/{project-embedding-registry-64t0mw8y.js → project-embedding-registry-fzc4eb29.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +22 -5
- package/dist/{read-session-chunk-rvmc25n5.js → read-session-chunk-q05ztqg5.js} +4 -3
- package/dist/{read-session-raw-npx3920c.js → read-session-raw-527m0yxx.js} +2 -1
- package/dist/{search-7z3w8pmz.js → search-5m0jjf29.js} +11 -10
- package/dist/{storage-tags-kjnsqbdb.js → storage-tags-1b2w0wst.js} +1 -1
- package/dist/subagent-entry.js +13 -11
- package/package.json +2 -2
- /package/dist/{index-2pp04pmg.js → index-69vas84q.js} +0 -0
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
hasPendingMigrations,
|
|
46
46
|
getMainThreadMigrationBodyCount,
|
|
47
47
|
runMigrations
|
|
48
|
-
} from "./index-
|
|
48
|
+
} from "./index-mzn6t38b.js";
|
|
49
49
|
import {
|
|
50
50
|
closeQuietly,
|
|
51
51
|
ensureColumn,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
import {
|
|
62
62
|
bootQuietRemainingMs,
|
|
63
63
|
scheduleAfterBootQuiet
|
|
64
|
-
} from "./index-
|
|
64
|
+
} from "./index-g7984a4r.js";
|
|
65
65
|
import {
|
|
66
66
|
logSlowWriteTransaction
|
|
67
67
|
} from "./index-0vrkp1jq.js";
|
|
@@ -1287,7 +1287,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1287
1287
|
startMessageFtsRowidMapBackfill(db).then(async () => {
|
|
1288
1288
|
if (!readsOpenCodeStore)
|
|
1289
1289
|
return;
|
|
1290
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1290
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-q05ztqg5.js"));
|
|
1291
1291
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-05ppypkz.js"));
|
|
1292
1292
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
1293
1293
|
readPage: readRawSessionMessagePage
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
visitRawSessionMessages2,
|
|
52
52
|
readRawSessionMessageById2,
|
|
53
53
|
readSessionChunk2
|
|
54
|
-
} from "./index-
|
|
54
|
+
} from "./index-590pwxvr.js";
|
|
55
55
|
import {
|
|
56
56
|
isRecord,
|
|
57
57
|
providerVisibleMessage,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
getTagNumberByMessageId2,
|
|
66
66
|
getTagsBySession2,
|
|
67
67
|
getTagById2
|
|
68
|
-
} from "./index-
|
|
68
|
+
} from "./index-9n88gmpf.js";
|
|
69
69
|
import {
|
|
70
70
|
estimateTokens
|
|
71
71
|
} from "./index-r56xgha8.js";
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
} from "./index-8976mezv.js";
|
|
86
86
|
import {
|
|
87
87
|
noteRawSessionSummaryRowWritten2
|
|
88
|
-
} from "./index-
|
|
88
|
+
} from "./index-2apf1afe.js";
|
|
89
89
|
import {
|
|
90
90
|
piHarnessKindFromExecutable,
|
|
91
91
|
isPidAlive
|
|
@@ -96,8 +96,8 @@ import {
|
|
|
96
96
|
commitLkgWithRecoveryFence,
|
|
97
97
|
clearLkgRecoveryFence,
|
|
98
98
|
deleteSessionScopedRows,
|
|
99
|
-
|
|
100
|
-
} from "./index-
|
|
99
|
+
getLastIndexedOrdinal2
|
|
100
|
+
} from "./index-9ygacw4e.js";
|
|
101
101
|
import {
|
|
102
102
|
SubcClient,
|
|
103
103
|
connectionFileExists,
|
|
@@ -110,7 +110,7 @@ import {
|
|
|
110
110
|
} from "./index-4gfq5t09.js";
|
|
111
111
|
import {
|
|
112
112
|
getErrorMessage
|
|
113
|
-
} from "./index-
|
|
113
|
+
} from "./index-a1jmtv6r.js";
|
|
114
114
|
import {
|
|
115
115
|
V2_MEMORY_CATEGORIES,
|
|
116
116
|
CATEGORY_PRIORITY,
|
|
@@ -124,13 +124,13 @@ import {
|
|
|
124
124
|
expandWorkspaceIdentitySetWithAliases,
|
|
125
125
|
resolveStoredPathWorkspaceIdentity,
|
|
126
126
|
storedPathBelongsToWorkspace
|
|
127
|
-
} from "./index-
|
|
127
|
+
} from "./index-mzn6t38b.js";
|
|
128
128
|
import {
|
|
129
129
|
directoryHasGitMetadata,
|
|
130
130
|
resolveProjectIdentityForSession,
|
|
131
131
|
normalizeStoredProjectPath,
|
|
132
132
|
storedPathBelongsToIdentity
|
|
133
|
-
} from "./index-
|
|
133
|
+
} from "./index-g7984a4r.js";
|
|
134
134
|
import {
|
|
135
135
|
drainBackgroundBatches,
|
|
136
136
|
markProjectLoadUntrusted2,
|
|
@@ -142,7 +142,7 @@ import {
|
|
|
142
142
|
unregisterProjectEmbedding2,
|
|
143
143
|
getProjectEmbeddingSnapshot2,
|
|
144
144
|
embedTextForProject2
|
|
145
|
-
} from "./index-
|
|
145
|
+
} from "./index-g1csz24n.js";
|
|
146
146
|
import {
|
|
147
147
|
getNoteByIdInScope,
|
|
148
148
|
getNotes,
|
|
@@ -158,7 +158,7 @@ import {
|
|
|
158
158
|
resolveMemoriesByIdsForSearch2,
|
|
159
159
|
unifiedSearch2,
|
|
160
160
|
formatSearchResults2
|
|
161
|
-
} from "./index-
|
|
161
|
+
} from "./index-57njcjax.js";
|
|
162
162
|
import {
|
|
163
163
|
saveEmbedding,
|
|
164
164
|
invalidateMemory2
|
|
@@ -179,6 +179,11 @@ import {
|
|
|
179
179
|
mergeMemoryStats2,
|
|
180
180
|
archiveMemory2
|
|
181
181
|
} from "./index-xjqheg7a.js";
|
|
182
|
+
import {
|
|
183
|
+
isMarkerCandidateBasisCurrent2,
|
|
184
|
+
invalidateMarkerCandidateBasis2,
|
|
185
|
+
readMarkerCandidateBasis2
|
|
186
|
+
} from "./index-g3600tpw.js";
|
|
182
187
|
import {
|
|
183
188
|
computeNormalizedHash
|
|
184
189
|
} from "./index-9x1f96r8.js";
|
|
@@ -7312,7 +7317,7 @@ function clampWatermark(value, maxCopiedTag) {
|
|
|
7312
7317
|
function copySessionStateForClone(db, sourceSessionId, destinationSessionId, filter) {
|
|
7313
7318
|
return runImmediate(db, () => {
|
|
7314
7319
|
const hasTemporalDecisions = tableExists(db, "temporal_decisions");
|
|
7315
|
-
if (countRows(db, "compartments", destinationSessionId) > 0 || countRows(db, "tags", destinationSessionId) > 0 || hasTemporalDecisions && countRows(db, "temporal_decisions", destinationSessionId) > 0 || filter.copySessionNotesAndFacts === true && (tableExists(db, "notes") && countRows(db, "notes", destinationSessionId) > 0 || tableExists(db, "session_facts") && countRows(db, "session_facts", destinationSessionId) > 0)) {
|
|
7320
|
+
if (filter.requireEmptyDestinationMeta === true && countRows(db, "session_meta", destinationSessionId) > 0 || countRows(db, "compartments", destinationSessionId) > 0 || countRows(db, "tags", destinationSessionId) > 0 || hasTemporalDecisions && countRows(db, "temporal_decisions", destinationSessionId) > 0 || filter.copySessionNotesAndFacts === true && (tableExists(db, "notes") && countRows(db, "notes", destinationSessionId) > 0 || tableExists(db, "session_facts") && countRows(db, "session_facts", destinationSessionId) > 0)) {
|
|
7316
7321
|
return {
|
|
7317
7322
|
kind: "destination-not-empty",
|
|
7318
7323
|
compartmentsCopied: 0,
|
|
@@ -11010,22 +11015,18 @@ function isOpenCodeGapHistorianAbsent(sessionId, endId, nextId) {
|
|
|
11010
11015
|
) LIMIT 1`).get(sessionId, end.timeCreated, end.id, next.timeCreated, next.id);
|
|
11011
11016
|
return !row;
|
|
11012
11017
|
}
|
|
11018
|
+
var LEGACY_MARKER_LINEAGE_SQL = `SELECT m.id
|
|
11019
|
+
FROM message m
|
|
11020
|
+
WHERE +m.session_id = ? AND m.id IN (SELECT value FROM json_each(?)) AND m.id <> ?
|
|
11021
|
+
AND COALESCE(json_extract(m.data, '$.summary'), 0) = 1
|
|
11022
|
+
AND COALESCE(json_extract(m.data, '$.finish'), '') = 'stop'
|
|
11023
|
+
AND COALESCE(json_extract(m.data, '$.parentID'), '') = ?
|
|
11024
|
+
AND EXISTS (SELECT 1 FROM part p
|
|
11025
|
+
WHERE +p.session_id = m.session_id AND p.message_id = m.id
|
|
11026
|
+
AND COALESCE(json_extract(p.data, '$.type'), '') = 'text'
|
|
11027
|
+
AND COALESCE(json_extract(p.data, '$.text'), '') = ?)`;
|
|
11013
11028
|
function removeLegacyMarkerLineageRows(db, args) {
|
|
11014
|
-
const legacySummaries = db.prepare(
|
|
11015
|
-
FROM message m
|
|
11016
|
-
WHERE m.session_id = ?
|
|
11017
|
-
AND m.id <> ?
|
|
11018
|
-
AND COALESCE(json_extract(m.data, '$.summary'), 0) = 1
|
|
11019
|
-
AND COALESCE(json_extract(m.data, '$.finish'), '') = 'stop'
|
|
11020
|
-
AND COALESCE(json_extract(m.data, '$.parentID'), '') = ?
|
|
11021
|
-
AND EXISTS (
|
|
11022
|
-
SELECT 1
|
|
11023
|
-
FROM part p
|
|
11024
|
-
WHERE +p.session_id = m.session_id
|
|
11025
|
-
AND p.message_id = m.id
|
|
11026
|
-
AND COALESCE(json_extract(p.data, '$.type'), '') = 'text'
|
|
11027
|
-
AND COALESCE(json_extract(p.data, '$.text'), '') = ?
|
|
11028
|
-
)`).all(args.sessionId, args.summaryMessageId, args.boundaryMessageId, args.summaryText);
|
|
11029
|
+
const legacySummaries = db.prepare(LEGACY_MARKER_LINEAGE_SQL).all(args.sessionId, JSON.stringify(args.candidateIds), args.summaryMessageId, args.boundaryMessageId, args.summaryText);
|
|
11029
11030
|
const legacySummaryIds = legacySummaries.flatMap((row) => typeof row.id === "string" ? [row.id] : []);
|
|
11030
11031
|
if (legacySummaryIds.length === 0)
|
|
11031
11032
|
return;
|
|
@@ -11042,7 +11043,7 @@ function removeLegacyMarkerLineageRows(db, args) {
|
|
|
11042
11043
|
AND COALESCE(json_extract(data, '$.type'), '') = 'compaction'
|
|
11043
11044
|
AND COALESCE(json_extract(data, '$.auto'), 0) = 1`).run(args.sessionId, args.boundaryMessageId, args.compactionPartId);
|
|
11044
11045
|
}
|
|
11045
|
-
function
|
|
11046
|
+
function injectCompactionMarkerFromBasis(args, validatedBasis) {
|
|
11046
11047
|
const db = getWritableOpenCodeDb();
|
|
11047
11048
|
if (!isOpenCodeSchemaCompatible(db, getOpenCodeDbPath())) {
|
|
11048
11049
|
return null;
|
|
@@ -11072,10 +11073,16 @@ function injectCompactionMarker(args) {
|
|
|
11072
11073
|
time: { created: boundaryTime + 1, completed: boundaryTime + 1 }
|
|
11073
11074
|
});
|
|
11074
11075
|
try {
|
|
11076
|
+
const basis = validatedBasis ?? readMarkerCandidateBasis2(db, args.sessionId);
|
|
11077
|
+
if (!basis)
|
|
11078
|
+
return null;
|
|
11075
11079
|
runMarkerWriteTransaction(db, "compaction-marker-inject", () => {
|
|
11080
|
+
if (!validatedBasis && !isMarkerCandidateBasisCurrent2(db, basis))
|
|
11081
|
+
throw new Error("host store changed after marker candidate preparation; marker unchanged");
|
|
11076
11082
|
removeLegacyMarkerLineageRows(db, {
|
|
11077
11083
|
sessionId: args.sessionId,
|
|
11078
11084
|
boundaryMessageId: boundary.id,
|
|
11085
|
+
candidateIds: basis.ids,
|
|
11079
11086
|
summaryText: args.summaryText,
|
|
11080
11087
|
summaryMessageId: summaryMsgId,
|
|
11081
11088
|
compactionPartId
|
|
@@ -11096,6 +11103,7 @@ function injectCompactionMarker(args) {
|
|
|
11096
11103
|
time_updated = excluded.time_updated,
|
|
11097
11104
|
data = excluded.data`).run(summaryMsgId, args.sessionId, boundaryTime + 1, boundaryTime + 1, summaryMsgData);
|
|
11098
11105
|
noteRawSessionSummaryRowWritten2(args.sessionId, summaryMsgId);
|
|
11106
|
+
invalidateMarkerCandidateBasis2(db, args.sessionId);
|
|
11099
11107
|
db.prepare(`INSERT INTO part (id, message_id, session_id, time_created, time_updated, data)
|
|
11100
11108
|
VALUES (?, ?, ?, ?, ?, ?)
|
|
11101
11109
|
ON CONFLICT(id) DO UPDATE SET
|
|
@@ -11117,6 +11125,9 @@ function injectCompactionMarker(args) {
|
|
|
11117
11125
|
return null;
|
|
11118
11126
|
}
|
|
11119
11127
|
}
|
|
11128
|
+
|
|
11129
|
+
class MarkerCandidateUnavailableError extends Error {
|
|
11130
|
+
}
|
|
11120
11131
|
function replaceCompactionMarker(existing, args) {
|
|
11121
11132
|
let connection;
|
|
11122
11133
|
let entered = false;
|
|
@@ -11124,14 +11135,23 @@ function replaceCompactionMarker(existing, args) {
|
|
|
11124
11135
|
try {
|
|
11125
11136
|
const db = getWritableOpenCodeDb();
|
|
11126
11137
|
connection = db;
|
|
11138
|
+
const basis = readMarkerCandidateBasis2(db, args.sessionId);
|
|
11139
|
+
if (!basis) {
|
|
11140
|
+
return {
|
|
11141
|
+
kind: "deferred",
|
|
11142
|
+
error: new Error("marker candidate preparation pending; marker unchanged")
|
|
11143
|
+
};
|
|
11144
|
+
}
|
|
11127
11145
|
const marker = runMarkerWriteTransaction(db, "compaction-marker-replace", () => {
|
|
11128
11146
|
entered = true;
|
|
11147
|
+
if (!isMarkerCandidateBasisCurrent2(db, basis))
|
|
11148
|
+
throw new MarkerCandidateUnavailableError("host store changed after marker candidate preparation; marker unchanged");
|
|
11129
11149
|
if (existing) {
|
|
11130
11150
|
db.prepare("DELETE FROM part WHERE id = ?").run(existing.summaryPartId);
|
|
11131
11151
|
db.prepare("DELETE FROM message WHERE id = ?").run(existing.summaryMessageId);
|
|
11132
11152
|
db.prepare("DELETE FROM part WHERE id = ?").run(existing.compactionPartId);
|
|
11133
11153
|
}
|
|
11134
|
-
const replacement =
|
|
11154
|
+
const replacement = injectCompactionMarkerFromBasis(args, basis);
|
|
11135
11155
|
if (!replacement) {
|
|
11136
11156
|
throw new Error(`failed to inject replacement marker at ordinal ${args.endOrdinal}`);
|
|
11137
11157
|
}
|
|
@@ -11140,6 +11160,8 @@ function replaceCompactionMarker(existing, args) {
|
|
|
11140
11160
|
});
|
|
11141
11161
|
return { kind: "committed", marker };
|
|
11142
11162
|
} catch (error) {
|
|
11163
|
+
if (error instanceof MarkerCandidateUnavailableError)
|
|
11164
|
+
return { kind: "deferred", error };
|
|
11143
11165
|
log2(`[magic-context] compaction-marker: atomic replacement failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
11144
11166
|
const definitelyNoCut = !entered || !readyToCommit && connection?.inTransaction === false;
|
|
11145
11167
|
return {
|
|
@@ -11890,6 +11912,11 @@ function stripMemoryMuralBlock(m0Text) {
|
|
|
11890
11912
|
var absentBoundaryEpisodeBySession = new BoundedSessionMap(INJECTION_CACHE_MAX);
|
|
11891
11913
|
var precedesVerdictBySession = new BoundedSessionMap(INJECTION_CACHE_MAX);
|
|
11892
11914
|
var precedesWindowLoggedBySession = new BoundedSessionMap(INJECTION_CACHE_MAX);
|
|
11915
|
+
function resetPrefixTrimFallbackState(sessionId) {
|
|
11916
|
+
absentBoundaryEpisodeBySession.delete(sessionId);
|
|
11917
|
+
precedesVerdictBySession.delete(sessionId);
|
|
11918
|
+
precedesWindowLoggedBySession.delete(sessionId);
|
|
11919
|
+
}
|
|
11893
11920
|
|
|
11894
11921
|
// src/pi-ordinal-alignment.ts
|
|
11895
11922
|
var ALIGNED = { kind: "aligned", offset: 0 };
|
|
@@ -14117,7 +14144,7 @@ function err3(text) {
|
|
|
14117
14144
|
}
|
|
14118
14145
|
function captureAnchorOrdinal(db, sessionId) {
|
|
14119
14146
|
try {
|
|
14120
|
-
const ordinal =
|
|
14147
|
+
const ordinal = getLastIndexedOrdinal2(db, sessionId);
|
|
14121
14148
|
return ordinal > 0 ? ordinal : null;
|
|
14122
14149
|
} catch {
|
|
14123
14150
|
return null;
|
|
@@ -15322,4 +15349,4 @@ function registerMagicContextTools(pi, opts) {
|
|
|
15322
15349
|
}
|
|
15323
15350
|
}
|
|
15324
15351
|
|
|
15325
|
-
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, countHistorianRuns, recordHistorianRun, summarizeImportance, tallyFactsByCategory, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId, noteTouchedAt, noteNudgePickIndex, formatNoteNudge, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, SYNTH_USER_ID_PREFIX, resolvePiStableId, resolvePiRealStableId, isPiContentFallbackId, isPiIndexFallbackId, piContentFallbackIds, readPiSessionSnapshot, readPiSessionMessages, readPiSessionMessagePage, findRestartModelSeedFromBranch, iterateEntriesToRawMessageRange, 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, isDirectiveShapedProjectRule, takeCurateSafetyRefusalCount, wakePlaneStatus, loadPiConfig, loadPiConfigDetailed, unregisterPiProjectEmbeddings, ensureProjectRegisteredFromPiDirectory, resolvePiHarnessDetection, resolvePiHarnessKind, 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, resolvePiOrdinalAlignment, piRawOrdinalOffsetSource, resolvePiOrdinalAlignmentForContext, isPiOrdinalAlignmentUnanchored, clearPiOrdinalAlignmentSession, rememberTodowriteToolCallTodos, parseTodos, setTodoSnapshot, registerTodoOverlay, registerTodoStateLifecycle, syncCtxMemoryToolEnabled, registerMagicContextTools };
|
|
15352
|
+
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, countHistorianRuns, recordHistorianRun, summarizeImportance, tallyFactsByCategory, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId, noteTouchedAt, noteNudgePickIndex, formatNoteNudge, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, SYNTH_USER_ID_PREFIX, resolvePiStableId, resolvePiRealStableId, isPiContentFallbackId, isPiIndexFallbackId, piContentFallbackIds, readPiSessionSnapshot, readPiSessionMessages, readPiSessionMessagePage, findRestartModelSeedFromBranch, iterateEntriesToRawMessageRange, 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, isDirectiveShapedProjectRule, takeCurateSafetyRefusalCount, wakePlaneStatus, loadPiConfig, loadPiConfigDetailed, unregisterPiProjectEmbeddings, ensureProjectRegisteredFromPiDirectory, resolvePiHarnessDetection, resolvePiHarnessKind, 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, resolvePiOrdinalAlignment, piRawOrdinalOffsetSource, resolvePiOrdinalAlignmentForContext, isPiOrdinalAlignmentUnanchored, clearPiOrdinalAlignmentSession, rememberTodowriteToolCallTodos, parseTodos, setTodoSnapshot, registerTodoOverlay, registerTodoStateLifecycle, syncCtxMemoryToolEnabled, registerMagicContextTools };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerExitAbort
|
|
3
|
+
} from "./index-399p688g.js";
|
|
4
|
+
import {
|
|
5
|
+
log2
|
|
6
|
+
} from "./index-x3dcnxh0.js";
|
|
7
|
+
import {
|
|
8
|
+
getSqliteDatabasePath2
|
|
9
|
+
} from "./index-3cgbv47m.js";
|
|
10
|
+
|
|
11
|
+
// ../plugin/src/features/magic-context/compaction-marker-candidates.ts
|
|
12
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
import { Worker } from "node:worker_threads";
|
|
15
|
+
var candidates = new WeakMap;
|
|
16
|
+
var pending = new WeakMap;
|
|
17
|
+
var workers = new Set;
|
|
18
|
+
var missingWorkerWarnings = new Set;
|
|
19
|
+
var ownWriteRevisions = new Map;
|
|
20
|
+
var exitRegistered = false;
|
|
21
|
+
function reportWorkerUnavailable(entry, detail) {
|
|
22
|
+
if (missingWorkerWarnings.has(entry.href))
|
|
23
|
+
return;
|
|
24
|
+
missingWorkerWarnings.add(entry.href);
|
|
25
|
+
const path = entry.protocol === "file:" ? fileURLToPath(entry) : entry.href;
|
|
26
|
+
log2(`[magic-context] [ERROR] compaction-marker: candidate worker unavailable ${path}: ${detail}; marker unchanged, advancement deferred`);
|
|
27
|
+
}
|
|
28
|
+
var MARKER_CERTIFICATION_SQL = `SELECT
|
|
29
|
+
(SELECT rowid FROM message WHERE id = ?) AS previousRowid,
|
|
30
|
+
(SELECT rowid FROM message ORDER BY rowid DESC LIMIT 1) AS newestRowid,
|
|
31
|
+
(SELECT id FROM message ORDER BY rowid DESC LIMIT 1) AS newestId,
|
|
32
|
+
EXISTS(SELECT 1 FROM message
|
|
33
|
+
WHERE rowid > ? AND +session_id = ? AND json_valid(data)
|
|
34
|
+
AND COALESCE(json_extract(data, '$.summary'), 0) = 1) AS newSummary`;
|
|
35
|
+
function isMarkerCandidateBasisCurrent2(db, basis) {
|
|
36
|
+
if (basis.connection !== db || ownWriteRevisions.get(basis.revisionKey) !== basis.ownWriteRevision)
|
|
37
|
+
return false;
|
|
38
|
+
try {
|
|
39
|
+
const current = db.prepare(MARKER_CERTIFICATION_SQL).get(basis.frontier?.id ?? null, basis.frontier?.rowid ?? 0, basis.sessionId);
|
|
40
|
+
if (current.newSummary || basis.frontier && (current.previousRowid !== basis.frontier.rowid || current.newestRowid === null || current.newestRowid < basis.frontier.rowid))
|
|
41
|
+
return false;
|
|
42
|
+
if (current.newestRowid !== null && (!Number.isSafeInteger(current.newestRowid) || current.newestId === null))
|
|
43
|
+
return false;
|
|
44
|
+
basis.frontier = current.newestRowid === null || current.newestId === null ? null : { rowid: current.newestRowid, id: current.newestId };
|
|
45
|
+
return true;
|
|
46
|
+
} catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function invalidateMarkerCandidateBasis2(db, sessionId) {
|
|
51
|
+
candidates.get(db)?.delete(sessionId);
|
|
52
|
+
const path = getSqliteDatabasePath2(db);
|
|
53
|
+
if (!path)
|
|
54
|
+
return;
|
|
55
|
+
const key = `${realpathSync(path)}\x00${sessionId}`;
|
|
56
|
+
const revision = ownWriteRevisions.get(key);
|
|
57
|
+
if (revision !== undefined)
|
|
58
|
+
ownWriteRevisions.set(key, revision + 1);
|
|
59
|
+
}
|
|
60
|
+
function readMarkerCandidateBasis2(db, sessionId) {
|
|
61
|
+
const basis = candidates.get(db)?.get(sessionId);
|
|
62
|
+
if (basis && isMarkerCandidateBasisCurrent2(db, basis))
|
|
63
|
+
return basis;
|
|
64
|
+
candidates.get(db)?.delete(sessionId);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
function prepareMarkerCandidateBasis2(db, sessionId, options = {}) {
|
|
68
|
+
if (readMarkerCandidateBasis2(db, sessionId))
|
|
69
|
+
return Promise.resolve(true);
|
|
70
|
+
const path = getSqliteDatabasePath2(db);
|
|
71
|
+
if (!path || db.inTransaction)
|
|
72
|
+
return Promise.resolve(false);
|
|
73
|
+
const active = pending.get(db) ?? new Map;
|
|
74
|
+
const existing = active.get(sessionId);
|
|
75
|
+
if (existing)
|
|
76
|
+
return existing;
|
|
77
|
+
const revisionKey = `${realpathSync(path)}\x00${sessionId}`;
|
|
78
|
+
const ownWriteRevision = ownWriteRevisions.get(revisionKey) ?? 0;
|
|
79
|
+
ownWriteRevisions.set(revisionKey, ownWriteRevision);
|
|
80
|
+
const entry = options.entry ?? markerWorkerEntry();
|
|
81
|
+
if (entry.protocol === "file:" && !existsSync(fileURLToPath(entry))) {
|
|
82
|
+
reportWorkerUnavailable(entry, "file missing");
|
|
83
|
+
return Promise.resolve(false);
|
|
84
|
+
}
|
|
85
|
+
const preparation = runCandidateWorker(path, sessionId, options).then((snapshot) => {
|
|
86
|
+
if (!snapshot)
|
|
87
|
+
return false;
|
|
88
|
+
const basis = {
|
|
89
|
+
...snapshot,
|
|
90
|
+
connection: db,
|
|
91
|
+
sessionId,
|
|
92
|
+
revisionKey,
|
|
93
|
+
ownWriteRevision
|
|
94
|
+
};
|
|
95
|
+
if (!isMarkerCandidateBasisCurrent2(db, basis)) {
|
|
96
|
+
candidates.get(db)?.delete(sessionId);
|
|
97
|
+
log2(`[magic-context] compaction-marker: deferred candidate preparation for ${sessionId}: summary set or frontier changed during discovery; marker unchanged`);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const sessions = candidates.get(db) ?? new Map;
|
|
101
|
+
sessions.set(sessionId, basis);
|
|
102
|
+
candidates.set(db, sessions);
|
|
103
|
+
return true;
|
|
104
|
+
}).finally(() => {
|
|
105
|
+
if (active.get(sessionId) === preparation)
|
|
106
|
+
active.delete(sessionId);
|
|
107
|
+
});
|
|
108
|
+
active.set(sessionId, preparation);
|
|
109
|
+
pending.set(db, active);
|
|
110
|
+
return preparation;
|
|
111
|
+
}
|
|
112
|
+
function markerWorkerEntry() {
|
|
113
|
+
return new URL(new URL(import.meta.url).pathname.endsWith(".ts") ? "./compaction-marker-candidates-worker.ts" : "./compaction-marker-candidates-worker.js", import.meta.url);
|
|
114
|
+
}
|
|
115
|
+
function runCandidateWorker(path, sessionId, options) {
|
|
116
|
+
if (!exitRegistered) {
|
|
117
|
+
exitRegistered = true;
|
|
118
|
+
const controller = new AbortController;
|
|
119
|
+
controller.signal.addEventListener("abort", () => {
|
|
120
|
+
for (const worker of workers) {
|
|
121
|
+
worker.terminate();
|
|
122
|
+
worker.unref();
|
|
123
|
+
}
|
|
124
|
+
}, { once: true });
|
|
125
|
+
registerExitAbort(controller);
|
|
126
|
+
}
|
|
127
|
+
return new Promise((resolve) => {
|
|
128
|
+
const entry = options.entry ?? markerWorkerEntry();
|
|
129
|
+
let worker;
|
|
130
|
+
let timer;
|
|
131
|
+
let done = false;
|
|
132
|
+
const finish = (snapshot) => {
|
|
133
|
+
if (done)
|
|
134
|
+
return;
|
|
135
|
+
done = true;
|
|
136
|
+
clearTimeout(timer);
|
|
137
|
+
if (!worker) {
|
|
138
|
+
resolve(snapshot);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
workers.delete(worker);
|
|
142
|
+
const stopped = worker.terminate();
|
|
143
|
+
worker.unref();
|
|
144
|
+
stopped.then(() => resolve(snapshot), () => resolve(snapshot));
|
|
145
|
+
};
|
|
146
|
+
const deadline = (ms) => {
|
|
147
|
+
clearTimeout(timer);
|
|
148
|
+
timer = setTimeout(() => {
|
|
149
|
+
reportWorkerUnavailable(entry, "worker deadline exceeded");
|
|
150
|
+
finish();
|
|
151
|
+
}, ms);
|
|
152
|
+
timer.unref?.();
|
|
153
|
+
};
|
|
154
|
+
try {
|
|
155
|
+
worker = new Worker(entry, { workerData: { path, sessionId } });
|
|
156
|
+
workers.add(worker);
|
|
157
|
+
worker.unref();
|
|
158
|
+
deadline(options.acceptMs ?? 2000);
|
|
159
|
+
worker.on("message", (reply) => {
|
|
160
|
+
if (reply.kind === "accepted")
|
|
161
|
+
deadline(options.resultMs ?? 600000);
|
|
162
|
+
else if (reply.kind === "candidates")
|
|
163
|
+
finish(reply.snapshot);
|
|
164
|
+
else {
|
|
165
|
+
reportWorkerUnavailable(entry, reply.error);
|
|
166
|
+
finish();
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
worker.on("error", (error) => {
|
|
170
|
+
reportWorkerUnavailable(entry, error.message);
|
|
171
|
+
finish();
|
|
172
|
+
});
|
|
173
|
+
worker.on("exit", (code) => {
|
|
174
|
+
if (!done)
|
|
175
|
+
reportWorkerUnavailable(entry, `worker exited before replying (${code})`);
|
|
176
|
+
finish();
|
|
177
|
+
});
|
|
178
|
+
} catch (error) {
|
|
179
|
+
reportWorkerUnavailable(entry, error instanceof Error ? error.message : String(error));
|
|
180
|
+
finish();
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function scanMarkerSummaryCandidates(db, sessionId) {
|
|
185
|
+
const ownsSnapshot = !db.inTransaction;
|
|
186
|
+
if (ownsSnapshot)
|
|
187
|
+
db.exec("BEGIN");
|
|
188
|
+
try {
|
|
189
|
+
return db.prepare(`SELECT id FROM message WHERE session_id=? AND
|
|
190
|
+
CASE WHEN json_valid(data) THEN COALESCE(json_extract(data,'$.summary'),0) ELSE 0 END=1`).all(sessionId).map((row) => row.id);
|
|
191
|
+
} finally {
|
|
192
|
+
if (ownsSnapshot)
|
|
193
|
+
db.exec("ROLLBACK");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function scanMarkerCandidateSnapshot2(db, sessionId) {
|
|
197
|
+
const ownsSnapshot = !db.inTransaction;
|
|
198
|
+
if (ownsSnapshot)
|
|
199
|
+
db.exec("BEGIN");
|
|
200
|
+
try {
|
|
201
|
+
const ids = scanMarkerSummaryCandidates(db, sessionId);
|
|
202
|
+
const frontier = db.prepare("SELECT rowid,id FROM message ORDER BY rowid DESC LIMIT 1").get() ?? null;
|
|
203
|
+
if (frontier && !Number.isSafeInteger(frontier.rowid))
|
|
204
|
+
throw new Error("marker frontier rowid is not a safe integer");
|
|
205
|
+
return { ids, frontier };
|
|
206
|
+
} finally {
|
|
207
|
+
if (ownsSnapshot)
|
|
208
|
+
db.exec("ROLLBACK");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { isMarkerCandidateBasisCurrent2, invalidateMarkerCandidateBasis2, readMarkerCandidateBasis2, prepareMarkerCandidateBasis2, scanMarkerCandidateSnapshot2 };
|
|
@@ -183,10 +183,10 @@ function classifyGitError(error, rawDirectory) {
|
|
|
183
183
|
}
|
|
184
184
|
return new ProjectIdentityError("unknown", rawDirectory, "git rev-list failed while resolving project identity", asError(error));
|
|
185
185
|
}
|
|
186
|
-
function resolveProjectIdentityStrict(directory, allowHomeProject = homeProjectPermission) {
|
|
186
|
+
function resolveProjectIdentityStrict(directory, allowHomeProject = homeProjectPermission, options = {}) {
|
|
187
187
|
assertProjectAllowed(directory, allowHomeProject);
|
|
188
188
|
const canonical = path2.resolve(directory);
|
|
189
|
-
const cached = identityCache.get(canonical);
|
|
189
|
+
const cached = options.cache === false ? undefined : identityCache.get(canonical);
|
|
190
190
|
if (cached !== undefined) {
|
|
191
191
|
return cached;
|
|
192
192
|
}
|
|
@@ -217,6 +217,8 @@ function resolveProjectIdentityStrict(directory, allowHomeProject = homeProjectP
|
|
|
217
217
|
throw new ProjectIdentityError("unknown", directory, "git rev-list returned no valid root commit hash");
|
|
218
218
|
}
|
|
219
219
|
const identity = `git:${rootCommit}`;
|
|
220
|
+
if (options.cache === false)
|
|
221
|
+
return identity;
|
|
220
222
|
identityCache.set(canonical, identity);
|
|
221
223
|
lastKnownGitIdentityCache.set(canonical, identity);
|
|
222
224
|
rememberGitIdentity(canonical, identity);
|