@cortexkit/pi-magic-context 0.49.7 → 0.49.8
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 +6 -6
- package/dist/{compaction-marker-candidates-tqcq5n00.js → compaction-marker-candidates-n4dphyz4.js} +3 -3
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/embedding-backfill-chva00z3.js +20 -0
- package/dist/embedding-worker-process.js +6 -2
- package/dist/embedding-worker.js +6 -5
- package/dist/historian-calibration-extension.js +1 -1
- package/dist/{index-fhv6ydkq.js → index-18qe4gs1.js} +18 -11
- package/dist/{index-0j0zqb4t.js → index-3veejgp8.js} +1 -1
- package/dist/{index-0vrkp1jq.js → index-43zqh10z.js} +1 -1
- package/dist/{index-r56xgha8.js → index-4pxydwvg.js} +1 -1
- package/dist/{index-7mm27xdc.js → index-4vj37yw9.js} +4 -3
- package/dist/{index-6vjj0555.js → index-54r5vs9w.js} +4 -4
- package/dist/{index-8ye22z7k.js → index-6e3yv1jt.js} +4 -4
- package/dist/{index-dj8hpkz7.js → index-729kkhmf.js} +4 -3
- package/dist/{index-gc2749rx.js → index-8yjhda46.js} +9 -6
- package/dist/{index-7ptxvfc5.js → index-asrxgdt4.js} +33 -10
- package/dist/{index-34zacc0h.js → index-fdxzpnbj.js} +2 -2
- package/dist/{index-gqsfhksw.js → index-gqxsds3q.js} +6 -3
- package/dist/{index-x3dcnxh0.js → index-gycf3sp7.js} +5 -1
- package/dist/{index-dj784nyr.js → index-hy44m6jc.js} +1 -1
- package/dist/{index-mrsarsbh.js → index-jsyjxgfy.js} +25 -24
- package/dist/{index-290tzwp1.js → index-kh3jt7t9.js} +1 -1
- package/dist/{index-8jpqq2yk.js → index-pdhbj18g.js} +14 -13
- package/dist/{index-0d8zqccx.js → index-qc8e13wc.js} +22 -22
- package/dist/{index-0eg59y8d.js → index-r8cy8hmq.js} +5 -5
- package/dist/{index-6q5mx0cz.js → index-rggtvnbg.js} +38 -28
- package/dist/{index-21v1kfs7.js → index-szh001qb.js} +6 -3
- package/dist/{index-cyrnv16r.js → index-ta0ed2nc.js} +2 -0
- package/dist/{index-0ww9cgfd.js → index-tdhppxwd.js} +9 -9
- package/dist/{index-a7fj661j.js → index-v26j81w6.js} +5 -5
- package/dist/{index-mcgehvgw.js → index-zzn7qbps.js} +1 -1
- package/dist/index.js +109 -86
- package/dist/{logger-j6tecd1h.js → logger-qg51hmp7.js} +1 -1
- package/dist/{message-index-8rxj3cxh.js → message-index-1wta074c.js} +14 -14
- package/dist/{message-index-bounded-e5bv8gzm.js → message-index-bounded-ss3ctdwb.js} +14 -14
- package/dist/{message-time-backfill-hmekd2jj.js → message-time-backfill-q9s88zdv.js} +3 -3
- package/dist/migration-worker.js +10 -10
- package/dist/{project-embedding-registry-z5m4eh3d.js → project-embedding-registry-bxawck58.js} +11 -11
- package/dist/raw-ordinal-warmup-worker.js +6 -6
- package/dist/{read-session-chunk-sp5adk01.js → read-session-chunk-1jagnq05.js} +9 -9
- package/dist/{read-session-raw-s14c7nf3.js → read-session-raw-hm7ptnrh.js} +3 -3
- package/dist/{safe-notification-target-vn9kpmv4.js → safe-notification-target-62ty6rvp.js} +2 -2
- package/dist/{search-hgfaqytc.js → search-x7cachq0.js} +21 -21
- package/dist/{sqlite-f8kh2n10.js → sqlite-adjpy399.js} +3 -1
- package/dist/{storage-memory-yf7r98vz.js → storage-memory-axnsk5t1.js} +2 -2
- package/dist/{storage-tags-0xk95neb.js → storage-tags-6j5s2q49.js} +5 -5
- package/dist/subagent-entry.js +24 -24
- package/package.json +1 -1
- package/dist/embedding-backfill-vygvr2x4.js +0 -20
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getMagicContextStorageDir,
|
|
8
8
|
log2,
|
|
9
9
|
sessionLog2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-gycf3sp7.js";
|
|
11
11
|
import {
|
|
12
12
|
piModelRefToCanonical,
|
|
13
13
|
modelRefLookupOrder,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
PER_HARNESS_MODEL_KEYS,
|
|
21
21
|
ConfigProfilesSchema,
|
|
22
22
|
MagicContextConfigSchema
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-ta0ed2nc.js";
|
|
24
24
|
import {
|
|
25
25
|
MERGED_REASONING_PARTS_PREFIX,
|
|
26
26
|
decodeMergedReasoningParts,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
readRawSessionMessageIdOrdinalsForRange2,
|
|
57
57
|
readRawSessionMessageById2,
|
|
58
58
|
readSessionChunk2
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-18qe4gs1.js";
|
|
60
60
|
import {
|
|
61
61
|
isRecord,
|
|
62
62
|
providerVisibleMessage,
|
|
@@ -70,31 +70,32 @@ import {
|
|
|
70
70
|
getTagNumberByMessageId2,
|
|
71
71
|
getTagsBySession2,
|
|
72
72
|
getTagById2
|
|
73
|
-
} from "./index-
|
|
73
|
+
} from "./index-54r5vs9w.js";
|
|
74
74
|
import {
|
|
75
75
|
estimateTokens
|
|
76
|
-
} from "./index-
|
|
76
|
+
} from "./index-4pxydwvg.js";
|
|
77
77
|
import {
|
|
78
|
+
inRootAsyncContext2,
|
|
78
79
|
Database2,
|
|
79
80
|
withSqliteBackgroundWriter2,
|
|
80
81
|
withoutSqliteTransformPass2
|
|
81
|
-
} from "./index-
|
|
82
|
+
} from "./index-asrxgdt4.js";
|
|
82
83
|
import {
|
|
83
84
|
stableStringify,
|
|
84
85
|
closeQuietly,
|
|
85
86
|
getTableColumnNames
|
|
86
|
-
} from "./index-
|
|
87
|
+
} from "./index-zzn7qbps.js";
|
|
87
88
|
import {
|
|
88
89
|
resolveOpenCodeDbPath,
|
|
89
90
|
assertOpenCodeStoreGeneration
|
|
90
91
|
} from "./index-8976mezv.js";
|
|
91
92
|
import {
|
|
92
93
|
noteRawSessionSummaryRowWritten2
|
|
93
|
-
} from "./index-
|
|
94
|
+
} from "./index-4vj37yw9.js";
|
|
94
95
|
import {
|
|
95
96
|
piHarnessKindFromExecutable,
|
|
96
97
|
isPidAlive
|
|
97
|
-
} from "./index-
|
|
98
|
+
} from "./index-3veejgp8.js";
|
|
98
99
|
import {
|
|
99
100
|
BoundedSessionMap,
|
|
100
101
|
clearLkgFenceProcessState,
|
|
@@ -102,20 +103,20 @@ import {
|
|
|
102
103
|
clearLkgRecoveryFence,
|
|
103
104
|
deleteSessionScopedRows,
|
|
104
105
|
getLastIndexedOrdinal2
|
|
105
|
-
} from "./index-
|
|
106
|
+
} from "./index-tdhppxwd.js";
|
|
106
107
|
import {
|
|
107
108
|
SubcClient,
|
|
108
109
|
connectionFileExists,
|
|
109
110
|
SYNAPSE_DEFAULT_MODEL,
|
|
110
111
|
toSynapseLaneDescriptor,
|
|
111
112
|
SynapseEmbeddingProvider
|
|
112
|
-
} from "./index-
|
|
113
|
+
} from "./index-szh001qb.js";
|
|
113
114
|
import {
|
|
114
115
|
sameProjectDirectory
|
|
115
|
-
} from "./index-
|
|
116
|
+
} from "./index-fdxzpnbj.js";
|
|
116
117
|
import {
|
|
117
118
|
getErrorMessage
|
|
118
|
-
} from "./index-
|
|
119
|
+
} from "./index-rggtvnbg.js";
|
|
119
120
|
import {
|
|
120
121
|
V2_MEMORY_CATEGORIES,
|
|
121
122
|
CATEGORY_PRIORITY,
|
|
@@ -129,13 +130,13 @@ import {
|
|
|
129
130
|
expandWorkspaceIdentitySetWithAliases,
|
|
130
131
|
resolveStoredPathWorkspaceIdentity,
|
|
131
132
|
storedPathBelongsToWorkspace
|
|
132
|
-
} from "./index-
|
|
133
|
+
} from "./index-r8cy8hmq.js";
|
|
133
134
|
import {
|
|
134
135
|
directoryHasGitMetadata,
|
|
135
136
|
resolveProjectIdentityForSession,
|
|
136
137
|
normalizeStoredProjectPath,
|
|
137
138
|
storedPathBelongsToIdentity
|
|
138
|
-
} from "./index-
|
|
139
|
+
} from "./index-gqxsds3q.js";
|
|
139
140
|
import {
|
|
140
141
|
drainBackgroundBatches,
|
|
141
142
|
markProjectLoadUntrusted2,
|
|
@@ -147,7 +148,7 @@ import {
|
|
|
147
148
|
unregisterProjectEmbedding2,
|
|
148
149
|
getProjectEmbeddingSnapshot2,
|
|
149
150
|
embedTextForProject2
|
|
150
|
-
} from "./index-
|
|
151
|
+
} from "./index-qc8e13wc.js";
|
|
151
152
|
import {
|
|
152
153
|
getNoteByIdInScope,
|
|
153
154
|
getNotes,
|
|
@@ -164,7 +165,7 @@ import {
|
|
|
164
165
|
resolveMemoriesByIdsForSearch2,
|
|
165
166
|
unifiedSearch2,
|
|
166
167
|
formatSearchResults2
|
|
167
|
-
} from "./index-
|
|
168
|
+
} from "./index-pdhbj18g.js";
|
|
168
169
|
import {
|
|
169
170
|
computeCueContentHash,
|
|
170
171
|
getMuralCueState,
|
|
@@ -180,7 +181,7 @@ import {
|
|
|
180
181
|
supersededMemory2,
|
|
181
182
|
mergeMemoryStats2,
|
|
182
183
|
archiveMemory2
|
|
183
|
-
} from "./index-
|
|
184
|
+
} from "./index-hy44m6jc.js";
|
|
184
185
|
import {
|
|
185
186
|
saveEmbedding,
|
|
186
187
|
invalidateMemory2
|
|
@@ -189,13 +190,13 @@ import {
|
|
|
189
190
|
isMarkerCandidateBasisCurrent2,
|
|
190
191
|
invalidateMarkerCandidateBasis2,
|
|
191
192
|
readMarkerCandidateBasis2
|
|
192
|
-
} from "./index-
|
|
193
|
+
} from "./index-729kkhmf.js";
|
|
193
194
|
import {
|
|
194
195
|
computeNormalizedHash
|
|
195
196
|
} from "./index-9x1f96r8.js";
|
|
196
197
|
import {
|
|
197
198
|
logSlowWriteTransaction
|
|
198
|
-
} from "./index-
|
|
199
|
+
} from "./index-43zqh10z.js";
|
|
199
200
|
import {
|
|
200
201
|
ensureStorageDirectorySync,
|
|
201
202
|
writeStorageFileAtomicSync
|
|
@@ -4212,7 +4213,7 @@ var V2_MESSAGE_PAGE_SQL = `WITH bounds AS (
|
|
|
4212
4213
|
SELECT seq FROM session_message
|
|
4213
4214
|
WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
|
|
4214
4215
|
ORDER BY seq ASC LIMIT 1 OFFSET ?
|
|
4215
|
-
), -1) END AS after_seq,
|
|
4216
|
+
), (SELECT MAX(seq) FROM session_message WHERE session_id = ?), -1) END AS after_seq,
|
|
4216
4217
|
COALESCE((
|
|
4217
4218
|
SELECT seq FROM session_message
|
|
4218
4219
|
WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
|
|
@@ -4414,7 +4415,7 @@ class V2StoreReader {
|
|
|
4414
4415
|
}
|
|
4415
4416
|
}
|
|
4416
4417
|
const maximumSeq = Number.MAX_SAFE_INTEGER;
|
|
4417
|
-
const rows = this.prepare(V2_MESSAGE_PAGE_SQL).all(afterOrdinal, sessionID, ...RAW_MESSAGE_TYPES, Math.max(0, afterOrdinal - 1), sessionID, ...RAW_MESSAGE_TYPES, finalWatermark - 1, maximumSeq, sessionID, ...RAW_MESSAGE_TYPES, pageSize);
|
|
4418
|
+
const rows = this.prepare(V2_MESSAGE_PAGE_SQL).all(afterOrdinal, sessionID, ...RAW_MESSAGE_TYPES, Math.max(0, afterOrdinal - 1), sessionID, sessionID, ...RAW_MESSAGE_TYPES, finalWatermark - 1, maximumSeq, sessionID, ...RAW_MESSAGE_TYPES, pageSize);
|
|
4418
4419
|
return rows.map(decode);
|
|
4419
4420
|
});
|
|
4420
4421
|
}
|
|
@@ -11063,10 +11064,10 @@ async function probeWakePlaneCatalog() {
|
|
|
11063
11064
|
if (!await connectionFileExists(file)) {
|
|
11064
11065
|
throw new Error("subc connection is not configured");
|
|
11065
11066
|
}
|
|
11066
|
-
const client = await SubcClient.connect({
|
|
11067
|
+
const client = await inRootAsyncContext2(() => SubcClient.connect({
|
|
11067
11068
|
connectionFile: file,
|
|
11068
11069
|
handshakeTimeoutMs: WAKE_PLANE_HANDSHAKE_TIMEOUT_MS
|
|
11069
|
-
});
|
|
11070
|
+
}));
|
|
11070
11071
|
try {
|
|
11071
11072
|
return await client.catalogList();
|
|
11072
11073
|
} finally {
|
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
getHarness2
|
|
3
3
|
} from "./index-0h2mkab2.js";
|
|
4
4
|
import {
|
|
5
|
+
inRootAsyncContext2,
|
|
5
6
|
isTransientSqliteError2
|
|
6
|
-
} from "./index-
|
|
7
|
+
} from "./index-asrxgdt4.js";
|
|
7
8
|
import {
|
|
8
9
|
PROMOTABLE_CATEGORIES,
|
|
9
10
|
CATEGORY_DEFAULT_TTL
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
sanitizeDiagnosticText,
|
|
14
15
|
log2,
|
|
15
16
|
sessionLog2
|
|
16
|
-
} from "./index-
|
|
17
|
+
} from "./index-gycf3sp7.js";
|
|
17
18
|
import {
|
|
18
19
|
resolveWorkspaceShareCategories,
|
|
19
20
|
resolveWorkspaceIdentitySet,
|
|
@@ -21,17 +22,17 @@ import {
|
|
|
21
22
|
resolveStoredPathWorkspaceIdentity,
|
|
22
23
|
sourceNameForMemory,
|
|
23
24
|
managedAuthorityNoteRow
|
|
24
|
-
} from "./index-
|
|
25
|
+
} from "./index-r8cy8hmq.js";
|
|
25
26
|
import {
|
|
26
27
|
isKnownAutocommit
|
|
27
|
-
} from "./index-
|
|
28
|
+
} from "./index-zzn7qbps.js";
|
|
28
29
|
import {
|
|
29
30
|
SubcClient
|
|
30
|
-
} from "./index-
|
|
31
|
+
} from "./index-szh001qb.js";
|
|
31
32
|
import {
|
|
32
33
|
buildCanonicalChunkTextFromFts,
|
|
33
34
|
loadCompartmentChunkEmbeddingsForSearch
|
|
34
|
-
} from "./index-
|
|
35
|
+
} from "./index-6e3yv1jt.js";
|
|
35
36
|
import {
|
|
36
37
|
recordEmbeddingMeasurement,
|
|
37
38
|
saveCommitEmbedding,
|
|
@@ -49,7 +50,7 @@ import {
|
|
|
49
50
|
getProjectEmbeddingSnapshot2,
|
|
50
51
|
embedTextForProject2,
|
|
51
52
|
embedItemsForProject2
|
|
52
|
-
} from "./index-
|
|
53
|
+
} from "./index-qc8e13wc.js";
|
|
53
54
|
import {
|
|
54
55
|
saveEmbeddingIfHashMatches,
|
|
55
56
|
getProjectEmbeddings2
|
|
@@ -59,7 +60,7 @@ import {
|
|
|
59
60
|
isEmbeddingEnabled,
|
|
60
61
|
embedText,
|
|
61
62
|
ensureMemoryEmbeddings2
|
|
62
|
-
} from "./index-
|
|
63
|
+
} from "./index-v26j81w6.js";
|
|
63
64
|
import {
|
|
64
65
|
getMemorySelectColumns2,
|
|
65
66
|
isMemoryRow2,
|
|
@@ -73,10 +74,10 @@ import {
|
|
|
73
74
|
getMemoryById2,
|
|
74
75
|
updateMemorySeenCount2,
|
|
75
76
|
updateMemoryRetrievalCount2
|
|
76
|
-
} from "./index-
|
|
77
|
+
} from "./index-hy44m6jc.js";
|
|
77
78
|
import {
|
|
78
79
|
getIndexedMessageCorpusSize2
|
|
79
|
-
} from "./index-
|
|
80
|
+
} from "./index-tdhppxwd.js";
|
|
80
81
|
import {
|
|
81
82
|
computeNormalizedHash
|
|
82
83
|
} from "./index-9x1f96r8.js";
|
|
@@ -612,8 +613,8 @@ var USER_FACING_FAILURES = {
|
|
|
612
613
|
},
|
|
613
614
|
history_boundary_unresolved: {
|
|
614
615
|
code: "MC-H04",
|
|
615
|
-
sentence: "This request was not sent:
|
|
616
|
-
action: "
|
|
616
|
+
sentence: "This request was not sent: Magic Context could not safely place the history summary boundary in the loaded conversation, and the untrimmed request is larger than the model's context window.",
|
|
617
|
+
action: "Reopen this session in its current project directory, then run /ctx-recomp to rebuild the history summary. A model with a larger context window can also help."
|
|
617
618
|
},
|
|
618
619
|
history_over_window_unmanaged: {
|
|
619
620
|
code: "MC-H06",
|
|
@@ -2153,7 +2154,7 @@ var connections = new Map;
|
|
|
2153
2154
|
async function connect(connectionFile) {
|
|
2154
2155
|
let connection = connections.get(connectionFile);
|
|
2155
2156
|
if (!connection) {
|
|
2156
|
-
connection = SubcClient.connect({ connectionFile });
|
|
2157
|
+
connection = inRootAsyncContext2(() => SubcClient.connect({ connectionFile }));
|
|
2157
2158
|
connections.set(connectionFile, connection);
|
|
2158
2159
|
connection.catch(() => connections.delete(connectionFile));
|
|
2159
2160
|
}
|
|
@@ -4,25 +4,26 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
sanitizeDiagnosticText,
|
|
6
6
|
log2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-gycf3sp7.js";
|
|
8
8
|
import {
|
|
9
9
|
isUserHomeDirectory,
|
|
10
10
|
setBootQuietPeriodForTests
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-gqxsds3q.js";
|
|
12
12
|
import {
|
|
13
|
+
inRootAsyncContext2,
|
|
13
14
|
withSqliteBackgroundWriter2,
|
|
14
15
|
withoutSqliteTransformPass2,
|
|
15
16
|
isTransientSqliteError2
|
|
16
|
-
} from "./index-
|
|
17
|
+
} from "./index-asrxgdt4.js";
|
|
17
18
|
import {
|
|
18
19
|
estimateTokens
|
|
19
|
-
} from "./index-
|
|
20
|
+
} from "./index-4pxydwvg.js";
|
|
20
21
|
import {
|
|
21
22
|
SYNAPSE_DEFAULT_MODEL,
|
|
22
23
|
isSynapseEmbeddingTruncated,
|
|
23
24
|
getSynapseBatchRequestKey,
|
|
24
25
|
SynapseEmbeddingProvider
|
|
25
|
-
} from "./index-
|
|
26
|
+
} from "./index-szh001qb.js";
|
|
26
27
|
import {
|
|
27
28
|
CHUNK_WINDOW_SAFETY_RATIO,
|
|
28
29
|
normalizeCompartmentChunkMaxInputTokens,
|
|
@@ -39,10 +40,17 @@ import {
|
|
|
39
40
|
countSessionCompartmentEmbedCoverage,
|
|
40
41
|
countSessionCompartmentEmbedCoveragePolite,
|
|
41
42
|
countUnembeddedSessionCompartmentsPolite
|
|
42
|
-
} from "./index-
|
|
43
|
+
} from "./index-6e3yv1jt.js";
|
|
43
44
|
import {
|
|
44
45
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
45
|
-
} from "./index-
|
|
46
|
+
} from "./index-ta0ed2nc.js";
|
|
47
|
+
import {
|
|
48
|
+
embeddingModelsMatch,
|
|
49
|
+
resolveEmbeddingTextPrefixes,
|
|
50
|
+
getEmbeddingProviderIdentity,
|
|
51
|
+
dominantEmbeddingFailure,
|
|
52
|
+
LocalEmbeddingProvider
|
|
53
|
+
} from "./index-8yjhda46.js";
|
|
46
54
|
import {
|
|
47
55
|
isEmbeddingHostBusy2
|
|
48
56
|
} from "./index-9p40dgkm.js";
|
|
@@ -51,16 +59,9 @@ import {
|
|
|
51
59
|
getMemoryEmbedCoverage,
|
|
52
60
|
invalidateProject2
|
|
53
61
|
} from "./index-yhzhdp3m.js";
|
|
54
|
-
import {
|
|
55
|
-
embeddingModelsMatch,
|
|
56
|
-
resolveEmbeddingTextPrefixes,
|
|
57
|
-
getEmbeddingProviderIdentity,
|
|
58
|
-
dominantEmbeddingFailure,
|
|
59
|
-
LocalEmbeddingProvider
|
|
60
|
-
} from "./index-gc2749rx.js";
|
|
61
62
|
import {
|
|
62
63
|
logSlowWriteTransaction
|
|
63
|
-
} from "./index-
|
|
64
|
+
} from "./index-43zqh10z.js";
|
|
64
65
|
|
|
65
66
|
// ../plugin/src/features/magic-context/session-project-storage.ts
|
|
66
67
|
var SESSION_CHUNK_REPAIR_BATCH_SIZE = 100;
|
|
@@ -1012,7 +1013,6 @@ function listShadowBackfillStalls2(db, projectIdentity) {
|
|
|
1012
1013
|
}
|
|
1013
1014
|
return stalls;
|
|
1014
1015
|
}
|
|
1015
|
-
|
|
1016
1016
|
// ../plugin/src/features/magic-context/project-embedding-registry.ts
|
|
1017
1017
|
var OFF_PROVIDER_IDENTITY = "embedding-provider:off";
|
|
1018
1018
|
var SWEEP_MAX_WALL_CLOCK_MS = 10 * 60 * 1000;
|
|
@@ -2604,12 +2604,12 @@ async function drainCommitBacklogForProject2(db, projectIdentity, deadline) {
|
|
|
2604
2604
|
}
|
|
2605
2605
|
let total = 0;
|
|
2606
2606
|
let leaseLost = false;
|
|
2607
|
-
const renewal = setInterval(() => {
|
|
2607
|
+
const renewal = inRootAsyncContext2(() => setInterval(() => {
|
|
2608
2608
|
try {
|
|
2609
2609
|
if (!renewGitSweepLease(db, projectIdentity, holderId))
|
|
2610
2610
|
leaseLost = true;
|
|
2611
2611
|
} catch {}
|
|
2612
|
-
}, SESSION_EMBED_LEASE_RENEWAL_MS);
|
|
2612
|
+
}, SESSION_EMBED_LEASE_RENEWAL_MS));
|
|
2613
2613
|
renewal.unref?.();
|
|
2614
2614
|
try {
|
|
2615
2615
|
while (!leaseLost && !isEmbeddingHostBusy2() && Date.now() < deadline && total < COMMIT_DRAIN_MAX_PER_SWEEP) {
|
|
@@ -2773,12 +2773,12 @@ async function drainCompartmentChunkBacklogForProject(db, projectIdentity, deadl
|
|
|
2773
2773
|
}
|
|
2774
2774
|
let total = 0;
|
|
2775
2775
|
let leaseLost = false;
|
|
2776
|
-
const renewal = setInterval(() => {
|
|
2776
|
+
const renewal = inRootAsyncContext2(() => setInterval(() => {
|
|
2777
2777
|
try {
|
|
2778
2778
|
if (!renewGitSweepLease(db, projectIdentity, holderId))
|
|
2779
2779
|
leaseLost = true;
|
|
2780
2780
|
} catch {}
|
|
2781
|
-
}, SESSION_EMBED_LEASE_RENEWAL_MS);
|
|
2781
|
+
}, SESSION_EMBED_LEASE_RENEWAL_MS));
|
|
2782
2782
|
renewal.unref?.();
|
|
2783
2783
|
try {
|
|
2784
2784
|
while (!leaseLost && !isEmbeddingHostBusy2() && Date.now() < deadline && total < CHUNK_DRAIN_MAX_PER_SWEEP) {
|
|
@@ -2819,14 +2819,14 @@ async function embedSessionCompartmentChunks2(db, projectIdentity, sessionId, op
|
|
|
2819
2819
|
drainAbort.abort();
|
|
2820
2820
|
else
|
|
2821
2821
|
options?.signal?.addEventListener("abort", forwardCallerAbort, { once: true });
|
|
2822
|
-
const renewal = setInterval(() => {
|
|
2822
|
+
const renewal = inRootAsyncContext2(() => setInterval(() => {
|
|
2823
2823
|
try {
|
|
2824
2824
|
if (!renewGitSweepLease(db, projectIdentity, holderId)) {
|
|
2825
2825
|
leaseLost = true;
|
|
2826
2826
|
drainAbort.abort();
|
|
2827
2827
|
}
|
|
2828
2828
|
} catch {}
|
|
2829
|
-
}, SESSION_EMBED_LEASE_RENEWAL_MS);
|
|
2829
|
+
}, SESSION_EMBED_LEASE_RENEWAL_MS));
|
|
2830
2830
|
renewal.unref?.();
|
|
2831
2831
|
const batchSize = Math.max(1, options?.batchSize ?? CHUNK_DRAIN_BATCH_SIZE);
|
|
2832
2832
|
const skipIds = [];
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./index-135e8hvg.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gycf3sp7.js";
|
|
7
7
|
import {
|
|
8
8
|
ensureColumn,
|
|
9
9
|
healAllNullColumns,
|
|
10
10
|
installV95PerfSchema
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-zzn7qbps.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveOpenCodeDbPath,
|
|
14
14
|
openCodeDbPathExists,
|
|
@@ -16,14 +16,14 @@ import {
|
|
|
16
16
|
} from "./index-8976mezv.js";
|
|
17
17
|
import {
|
|
18
18
|
Database2
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-asrxgdt4.js";
|
|
20
20
|
import {
|
|
21
21
|
normalizeStoredProjectPath,
|
|
22
22
|
storedPathBelongsToIdentity
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-gqxsds3q.js";
|
|
24
24
|
import {
|
|
25
25
|
logSlowWriteTransaction
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-43zqh10z.js";
|
|
27
27
|
|
|
28
28
|
// ../plugin/src/features/magic-context/migrations.ts
|
|
29
29
|
import { isMainThread } from "node:worker_threads";
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
importPluginModule,
|
|
6
6
|
writeForwardedLogLine2,
|
|
7
7
|
log2
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-gycf3sp7.js";
|
|
9
9
|
import {
|
|
10
|
+
inRootAsyncContext2,
|
|
10
11
|
registerSlowWriteReporter2,
|
|
11
12
|
registerSqliteDiagnosticSink2,
|
|
12
13
|
detectSqliteRuntime2,
|
|
@@ -15,7 +16,11 @@ import {
|
|
|
15
16
|
withoutSqliteTransformPass2,
|
|
16
17
|
isTransientSqliteError2,
|
|
17
18
|
withPrivilegedWriter2
|
|
18
|
-
} from "./index-
|
|
19
|
+
} from "./index-asrxgdt4.js";
|
|
20
|
+
import {
|
|
21
|
+
bootQuietRemainingMs,
|
|
22
|
+
scheduleAfterBootQuiet
|
|
23
|
+
} from "./index-gqxsds3q.js";
|
|
19
24
|
import {
|
|
20
25
|
getHarness2,
|
|
21
26
|
harnessOwnsOpenCodeStore2
|
|
@@ -30,13 +35,13 @@ import {
|
|
|
30
35
|
parseRpcPortFile,
|
|
31
36
|
inspectProcessesAsync,
|
|
32
37
|
inspectWindowsProcessesSync
|
|
33
|
-
} from "./index-
|
|
38
|
+
} from "./index-3veejgp8.js";
|
|
34
39
|
import {
|
|
35
40
|
configureContextDatabasePragmas2
|
|
36
41
|
} from "./index-fapenpch.js";
|
|
37
42
|
import {
|
|
38
43
|
startMessageFtsRowidMapBackfill
|
|
39
|
-
} from "./index-
|
|
44
|
+
} from "./index-fdxzpnbj.js";
|
|
40
45
|
import {
|
|
41
46
|
LKG_SLOT_CHUNKS_DDL,
|
|
42
47
|
SESSION_REPLAY_DECISIONS_DDL,
|
|
@@ -46,26 +51,22 @@ import {
|
|
|
46
51
|
hasPendingMigrations,
|
|
47
52
|
getMainThreadMigrationBodyCount,
|
|
48
53
|
runMigrations
|
|
49
|
-
} from "./index-
|
|
54
|
+
} from "./index-r8cy8hmq.js";
|
|
50
55
|
import {
|
|
51
56
|
closeQuietly,
|
|
52
57
|
ensureColumn,
|
|
53
58
|
installV95PerfSchema,
|
|
54
59
|
installTagIdentityRevisionTrigger
|
|
55
|
-
} from "./index-
|
|
60
|
+
} from "./index-zzn7qbps.js";
|
|
56
61
|
import {
|
|
57
62
|
resolveOpenCodeDbPath,
|
|
58
63
|
hasV1MessageTables,
|
|
59
64
|
setDatabase,
|
|
60
65
|
loadToolDefinitionMeasurements
|
|
61
66
|
} from "./index-8976mezv.js";
|
|
62
|
-
import {
|
|
63
|
-
bootQuietRemainingMs,
|
|
64
|
-
scheduleAfterBootQuiet
|
|
65
|
-
} from "./index-gqsfhksw.js";
|
|
66
67
|
import {
|
|
67
68
|
logSlowWriteTransaction
|
|
68
|
-
} from "./index-
|
|
69
|
+
} from "./index-43zqh10z.js";
|
|
69
70
|
import {
|
|
70
71
|
shouldEnforcePrivateStoragePermissions,
|
|
71
72
|
ensureStorageDirectorySync,
|
|
@@ -413,15 +414,25 @@ var activeMigrations = 0;
|
|
|
413
414
|
var activeSince = 0;
|
|
414
415
|
var accumulatedMs = 0;
|
|
415
416
|
var idleWaiters = [];
|
|
416
|
-
|
|
417
|
-
|
|
417
|
+
var testClock;
|
|
418
|
+
function now() {
|
|
419
|
+
return testClock?.now() ?? performance.now();
|
|
420
|
+
}
|
|
421
|
+
function scheduleTimeout(callback, delayMs) {
|
|
422
|
+
if (testClock)
|
|
423
|
+
return testClock.setTimeout(callback, delayMs);
|
|
424
|
+
const timer = setTimeout(callback, delayMs);
|
|
425
|
+
return () => clearTimeout(timer);
|
|
426
|
+
}
|
|
427
|
+
function offThreadMigrationMs(at = now()) {
|
|
428
|
+
return accumulatedMs + (activeMigrations > 0 ? Math.max(0, at - activeSince) : 0);
|
|
418
429
|
}
|
|
419
430
|
function isOffThreadMigrationRunning() {
|
|
420
431
|
return activeMigrations > 0;
|
|
421
432
|
}
|
|
422
433
|
function beginOffThreadMigration() {
|
|
423
434
|
if (activeMigrations === 0)
|
|
424
|
-
activeSince =
|
|
435
|
+
activeSince = now();
|
|
425
436
|
activeMigrations += 1;
|
|
426
437
|
let ended = false;
|
|
427
438
|
return () => {
|
|
@@ -431,7 +442,7 @@ function beginOffThreadMigration() {
|
|
|
431
442
|
activeMigrations -= 1;
|
|
432
443
|
if (activeMigrations > 0)
|
|
433
444
|
return;
|
|
434
|
-
accumulatedMs += Math.max(0,
|
|
445
|
+
accumulatedMs += Math.max(0, now() - activeSince);
|
|
435
446
|
const waiters = idleWaiters;
|
|
436
447
|
idleWaiters = [];
|
|
437
448
|
for (const wake of waiters)
|
|
@@ -444,10 +455,10 @@ function whenOffThreadMigrationIdle() {
|
|
|
444
455
|
return new Promise((resolve) => idleWaiters.push(resolve));
|
|
445
456
|
}
|
|
446
457
|
function startBootDeadline(timeoutMs, onDeferred) {
|
|
447
|
-
const startedAt =
|
|
458
|
+
const startedAt = now();
|
|
448
459
|
const migratedAtStart = offThreadMigrationMs(startedAt);
|
|
449
460
|
const budgetMs = Math.max(0, timeoutMs);
|
|
450
|
-
let
|
|
461
|
+
let cancelTimer;
|
|
451
462
|
let cancelled = false;
|
|
452
463
|
let deferredReported = false;
|
|
453
464
|
let resolveExpired;
|
|
@@ -455,12 +466,12 @@ function startBootDeadline(timeoutMs, onDeferred) {
|
|
|
455
466
|
resolveExpired = resolve;
|
|
456
467
|
});
|
|
457
468
|
const remainingMs = () => {
|
|
458
|
-
const
|
|
459
|
-
const countedMs =
|
|
469
|
+
const currentTime = now();
|
|
470
|
+
const countedMs = currentTime - startedAt - (offThreadMigrationMs(currentTime) - migratedAtStart);
|
|
460
471
|
return budgetMs - countedMs;
|
|
461
472
|
};
|
|
462
473
|
const check = () => {
|
|
463
|
-
|
|
474
|
+
cancelTimer = undefined;
|
|
464
475
|
if (cancelled)
|
|
465
476
|
return;
|
|
466
477
|
if (isOffThreadMigrationRunning()) {
|
|
@@ -473,19 +484,18 @@ function startBootDeadline(timeoutMs, onDeferred) {
|
|
|
473
484
|
}
|
|
474
485
|
const left = remainingMs();
|
|
475
486
|
if (left > 0) {
|
|
476
|
-
|
|
487
|
+
cancelTimer = scheduleTimeout(check, left);
|
|
477
488
|
return;
|
|
478
489
|
}
|
|
479
490
|
resolveExpired();
|
|
480
491
|
};
|
|
481
|
-
|
|
492
|
+
cancelTimer = scheduleTimeout(check, budgetMs);
|
|
482
493
|
return {
|
|
483
494
|
expired,
|
|
484
495
|
cancel: () => {
|
|
485
496
|
cancelled = true;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
timer = undefined;
|
|
497
|
+
cancelTimer?.();
|
|
498
|
+
cancelTimer = undefined;
|
|
489
499
|
}
|
|
490
500
|
};
|
|
491
501
|
}
|
|
@@ -502,7 +512,7 @@ function runMigrationsOffThread(data) {
|
|
|
502
512
|
return new Promise((resolve, reject) => {
|
|
503
513
|
let worker;
|
|
504
514
|
try {
|
|
505
|
-
worker = new Worker(workerEntryOverride ?? defaultWorkerEntry(), { workerData: data });
|
|
515
|
+
worker = inRootAsyncContext2(() => new Worker(workerEntryOverride ?? defaultWorkerEntry(), { workerData: data }));
|
|
506
516
|
} catch (error) {
|
|
507
517
|
reject(workerStartError(error instanceof Error ? error.message : String(error)));
|
|
508
518
|
return;
|
|
@@ -1288,8 +1298,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1288
1298
|
startMessageFtsRowidMapBackfill(db).then(async () => {
|
|
1289
1299
|
if (!readsOpenCodeStore)
|
|
1290
1300
|
return;
|
|
1291
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1292
|
-
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-
|
|
1301
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-1jagnq05.js"));
|
|
1302
|
+
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-q9s88zdv.js"));
|
|
1293
1303
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
1294
1304
|
readPage: readRawSessionMessagePage
|
|
1295
1305
|
}));
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-4pxydwvg.js";
|
|
4
4
|
import {
|
|
5
5
|
getHarness2
|
|
6
6
|
} from "./index-0h2mkab2.js";
|
|
7
7
|
import {
|
|
8
8
|
log2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-gycf3sp7.js";
|
|
10
|
+
import {
|
|
11
|
+
inRootAsyncContext2
|
|
12
|
+
} from "./index-asrxgdt4.js";
|
|
10
13
|
|
|
11
14
|
// ../plugin/src/features/magic-context/memory/embedding-synapse.ts
|
|
12
15
|
import { createHash } from "node:crypto";
|
|
@@ -1921,7 +1924,7 @@ async function getSharedClient(options) {
|
|
|
1921
1924
|
if (sharedClientPromise && sharedClientFile === options.connectionFile)
|
|
1922
1925
|
return sharedClientPromise;
|
|
1923
1926
|
sharedClientFile = options.connectionFile;
|
|
1924
|
-
sharedClientPromise = SubcClient.connect({ connectionFile: options.connectionFile }).then((client) => {
|
|
1927
|
+
sharedClientPromise = inRootAsyncContext2(() => SubcClient.connect({ connectionFile: options.connectionFile })).then((client) => {
|
|
1925
1928
|
sharedClient = client;
|
|
1926
1929
|
return client;
|
|
1927
1930
|
});
|
|
@@ -4837,6 +4837,7 @@ var FIELDS = [
|
|
|
4837
4837
|
];
|
|
4838
4838
|
var MINUTE_MS = 60000;
|
|
4839
4839
|
var MAX_SEARCH_MS = 4 * 366 * 24 * 60 * MINUTE_MS;
|
|
4840
|
+
var candidateVisitsForTests;
|
|
4840
4841
|
function parseField(token, spec) {
|
|
4841
4842
|
const values = new Set;
|
|
4842
4843
|
const normalize = (n) => spec.name === "day-of-week" && n === 7 ? 0 : n;
|
|
@@ -4956,6 +4957,7 @@ function nextOccurrence(cron, after, excludeCivilMinute, maxSearchMs = MAX_SEARC
|
|
|
4956
4957
|
let cursorMs = Math.floor(afterMs / MINUTE_MS) * MINUTE_MS + MINUTE_MS;
|
|
4957
4958
|
const capMs = afterMs + Math.max(0, Math.min(MAX_SEARCH_MS, maxSearchMs));
|
|
4958
4959
|
while (cursorMs <= capMs) {
|
|
4960
|
+
candidateVisitsForTests?.();
|
|
4959
4961
|
const candidate = new Date(cursorMs);
|
|
4960
4962
|
if (matchesCron(cron, candidate)) {
|
|
4961
4963
|
if (!excludeCivilMinute || civilMinuteKey(candidate) !== excludeCivilMinute) {
|