@cortexkit/pi-magic-context 0.49.34 → 0.49.35
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 +11 -6
- package/dist/chunk-embedding-write-worker.js +16 -13
- package/dist/{compaction-marker-candidates-p1kqkqhq.js → compaction-marker-candidates-hk2frhac.js} +3 -2
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{compartment-chunk-embedding-8c85ebce.js → compartment-chunk-embedding-5j1d1e3v.js} +8 -7
- package/dist/embedding-backfill-jt459ady.js +26 -0
- package/dist/embedding-worker-process.js +2 -1
- package/dist/embedding-worker.js +5 -4
- package/dist/expand-attachments-8sxeyj26.js +21 -0
- package/dist/historian-calibration-extension.js +2 -1
- package/dist/{index-0mc0vv97.js → index-0rvn6vhq.js} +3 -3
- package/dist/{index-hqw0rt9k.js → index-0wtm7g7f.js} +1 -1
- package/dist/{index-np9ryr8y.js → index-11knwv2h.js} +20 -240
- package/dist/{index-0gymvr5j.js → index-2p691ayw.js} +19 -8
- package/dist/{index-wqpjhx1p.js → index-2qqsnh1b.js} +2 -2
- package/dist/index-3bb24eb6.js +229 -0
- package/dist/{index-48twbev2.js → index-6pk49fc3.js} +37 -51
- package/dist/index-6y6v2wvn.js +194 -0
- package/dist/{index-e61zxfts.js → index-8m82cez2.js} +4 -4
- package/dist/{index-xn5yh0pn.js → index-a11nmw5t.js} +29 -128
- package/dist/index-by1bzjcd.js +24 -0
- package/dist/index-c6wbq66z.js +168 -0
- package/dist/{index-jn44h81p.js → index-cq71g4dk.js} +1 -1
- package/dist/{index-6wdwv3a6.js → index-d0w84hy5.js} +1 -1
- package/dist/{index-pb3ea2tq.js → index-d107f484.js} +5 -5
- package/dist/index-d21rhpbd.js +4171 -0
- package/dist/index-dnp1jjar.js +222 -0
- package/dist/index-ea37qn4x.js +777 -0
- package/dist/{index-f4fz95fy.js → index-fzm8fm4z.js} +303 -4980
- package/dist/{index-fgs78jyd.js → index-gymgz20n.js} +5 -222
- package/dist/index-hgd00nas.js +113 -0
- package/dist/{index-cj3bkd16.js → index-m68qfjte.js} +2 -2
- package/dist/{index-6981g1xv.js → index-mkh1cm5k.js} +1 -1
- package/dist/{index-4zemngt7.js → index-mp0gh04g.js} +2 -2
- package/dist/{index-23t8ryqw.js → index-n0zjvs3h.js} +1 -168
- package/dist/{index-bvpar0bg.js → index-rgvqh5x7.js} +2 -2
- package/dist/{index-gwxaz0z5.js → index-rzfr7wdv.js} +2 -2
- package/dist/{index-eenxm3t3.js → index-svqk0701.js} +40 -29
- package/dist/{index-9xd7qveg.js → index-vgfk2xa5.js} +4 -4
- package/dist/index-w26zvs1q.js +528 -0
- package/dist/index-wrr9rp9a.js +16 -0
- package/dist/{index-my0dn413.js → index-wt7vmyj4.js} +1 -1
- package/dist/{index-c474g0gj.js → index-yacs388s.js} +1 -1
- package/dist/{index-g2tfayfc.js → index-yg42q9bc.js} +95 -550
- package/dist/{index-eqw9t2ty.js → index-yhsmjvqa.js} +3 -3
- package/dist/index.js +523 -236
- package/dist/{logger-shetp43v.js → logger-2j70hhz4.js} +2 -1
- package/dist/{message-fts-rowid-map-3mbvdgn9.js → message-fts-rowid-map-aw4xa05a.js} +5 -4
- package/dist/{message-index-bounded-a6na71rg.js → message-index-bounded-da34vhs4.js} +12 -10
- package/dist/{message-time-backfill-e3r8ddh1.js → message-time-backfill-x45573rs.js} +3 -2
- package/dist/migration-worker.js +13 -10
- package/dist/{project-embedding-registry-acqb6be4.js → project-embedding-registry-davzvsz9.js} +13 -11
- package/dist/raw-ordinal-warmup-worker.js +12 -7
- package/dist/{read-session-chunk-2xcp6f40.js → read-session-chunk-nbcznexm.js} +14 -8
- package/dist/{read-session-raw-g9b1zdn5.js → read-session-raw-zb8kpa2y.js} +3 -2
- package/dist/render-d931g2vv.js +41 -0
- package/dist/{safe-notification-target-zcpchea6.js → safe-notification-target-jk69jxwp.js} +3 -2
- package/dist/search-archive-a76pp30g.js +24 -0
- package/dist/{search-b6hp64hc.js → search-atp7g95j.js} +24 -20
- package/dist/{storage-tags-6409qq18.js → storage-tags-jy8b0xsy.js} +5 -4
- package/dist/store-kabezr25.js +453 -0
- package/dist/store-reader-2m80zs5z.js +14 -0
- package/dist/subagent-entry.js +31 -23
- package/dist/tag-snapshot-worker-pi.js +15 -12
- package/dist/v2-archive-reader-wcjcfdzq.js +11 -0
- package/package.json +1 -1
- package/dist/embedding-backfill-rwfmyvze.js +0 -24
- package/dist/search-archive-jate39w5.js +0 -21
|
@@ -24,16 +24,16 @@ var [
|
|
|
24
24
|
{ Database, registerSqliteDiagnosticSink },
|
|
25
25
|
{ log }
|
|
26
26
|
] = await Promise.all([
|
|
27
|
-
import("./embedding-backfill-
|
|
27
|
+
import("./embedding-backfill-jt459ady.js"),
|
|
28
28
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
29
29
|
import("./storage-memory-0ndn65fm.js"),
|
|
30
|
-
import("./project-embedding-registry-
|
|
31
|
-
import("./search-
|
|
32
|
-
import("./compartment-chunk-embedding-
|
|
30
|
+
import("./project-embedding-registry-davzvsz9.js"),
|
|
31
|
+
import("./search-atp7g95j.js"),
|
|
32
|
+
import("./compartment-chunk-embedding-5j1d1e3v.js"),
|
|
33
33
|
import("./embedding-activity-ew6dshfd.js"),
|
|
34
34
|
import("./harness-9872e0ym.js"),
|
|
35
35
|
import("./sqlite-v89bj0yy.js"),
|
|
36
|
-
import("./logger-
|
|
36
|
+
import("./logger-2j70hhz4.js")
|
|
37
37
|
]);
|
|
38
38
|
setHarness(input.harness);
|
|
39
39
|
registerSqliteDiagnosticSink(log, getHarness);
|
|
@@ -127,6 +127,7 @@ async function run(jobInput) {
|
|
|
127
127
|
} else {
|
|
128
128
|
const jobStarted = performance.now();
|
|
129
129
|
const steps = {};
|
|
130
|
+
const diagnostics = input.options.autoSearchDiagnostics;
|
|
130
131
|
const results = await unifiedSearch(db, input.sessionId, input.projectPath, input.query, {
|
|
131
132
|
...input.options,
|
|
132
133
|
backfillMemoryEmbeddings: false,
|
|
@@ -134,7 +135,11 @@ async function run(jobInput) {
|
|
|
134
135
|
measurementDisabled: true,
|
|
135
136
|
embedQuery: async (text) => (await request({ kind: "query", text })).result ?? null,
|
|
136
137
|
isEmbeddingRuntimeEnabled: () => input.embeddingRuntimeEnabled,
|
|
137
|
-
stepTimings: steps
|
|
138
|
+
stepTimings: steps,
|
|
139
|
+
onAutoSearchDiagnostics: diagnostics ? () => port.postMessage({
|
|
140
|
+
kind: "diagnostics",
|
|
141
|
+
diagnostics
|
|
142
|
+
}) : undefined
|
|
138
143
|
});
|
|
139
144
|
port.postMessage({
|
|
140
145
|
kind: "result",
|
|
@@ -11,34 +11,37 @@ import {
|
|
|
11
11
|
isWorkerCloseMessage,
|
|
12
12
|
exitOnWorkerClose
|
|
13
13
|
} from "./index-54wmg4rj.js";
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
16
|
-
import"./index-
|
|
14
|
+
import"./index-wt7vmyj4.js";
|
|
15
|
+
import"./index-gymgz20n.js";
|
|
16
|
+
import"./index-dnp1jjar.js";
|
|
17
|
+
import"./index-rzfr7wdv.js";
|
|
17
18
|
import"./index-399p688g.js";
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
19
|
+
import"./index-mkh1cm5k.js";
|
|
20
|
+
import"./index-rgvqh5x7.js";
|
|
20
21
|
import {
|
|
21
22
|
replaceCompartmentChunkEmbeddings2,
|
|
22
23
|
recordChunkEmbedBackoff2,
|
|
23
24
|
loadUnembeddedSessionChunkCandidates2,
|
|
24
25
|
countUnembeddedSessionCompartments2
|
|
25
|
-
} from "./index-
|
|
26
|
+
} from "./index-2p691ayw.js";
|
|
26
27
|
import {
|
|
27
28
|
recordSessionProjectIdentity,
|
|
28
29
|
acquireGitSweepLease,
|
|
29
30
|
renewGitSweepLease,
|
|
30
31
|
releaseGitSweepLease
|
|
31
|
-
} from "./index-
|
|
32
|
-
import"./index-
|
|
32
|
+
} from "./index-mp0gh04g.js";
|
|
33
|
+
import"./index-6pk49fc3.js";
|
|
33
34
|
import {
|
|
34
35
|
LATEST_SUPPORTED_VERSION,
|
|
35
36
|
enforceSchemaFence
|
|
36
|
-
} from "./index-
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
37
|
+
} from "./index-11knwv2h.js";
|
|
38
|
+
import"./index-3bb24eb6.js";
|
|
39
|
+
import"./index-d107f484.js";
|
|
40
|
+
import"./index-yacs388s.js";
|
|
39
41
|
import"./index-135e8hvg.js";
|
|
40
|
-
import"./index-
|
|
41
|
-
import"./index-
|
|
42
|
+
import"./index-n0zjvs3h.js";
|
|
43
|
+
import"./index-c6wbq66z.js";
|
|
44
|
+
import"./index-0wtm7g7f.js";
|
|
42
45
|
|
|
43
46
|
// ../plugin/src/features/magic-context/chunk-embedding-write-worker.ts
|
|
44
47
|
import { parentPort, workerData } from "node:worker_threads";
|
package/dist/{compaction-marker-candidates-p1kqkqhq.js → compaction-marker-candidates-hk2frhac.js}
RENAMED
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
readMarkerCandidateBasis2,
|
|
5
5
|
prepareMarkerCandidateBasis2,
|
|
6
6
|
scanMarkerCandidateSnapshot2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-d0w84hy5.js";
|
|
8
8
|
import"./index-399p688g.js";
|
|
9
9
|
import"./index-2qtx0q6h.js";
|
|
10
|
-
import"./index-
|
|
10
|
+
import"./index-gymgz20n.js";
|
|
11
11
|
import"./index-0h2mkab2.js";
|
|
12
|
+
import"./index-dnp1jjar.js";
|
|
12
13
|
export {
|
|
13
14
|
invalidateMarkerCandidateBasis2 as invalidateMarkerCandidateBasis,
|
|
14
15
|
isMarkerCandidateBasisCurrent2 as isMarkerCandidateBasisCurrent,
|
|
@@ -6,7 +6,7 @@ if (!port)
|
|
|
6
6
|
port.postMessage({ kind: "accepted" });
|
|
7
7
|
var [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
|
|
8
8
|
import("./sqlite-v89bj0yy.js"),
|
|
9
|
-
import("./compaction-marker-candidates-
|
|
9
|
+
import("./compaction-marker-candidates-hk2frhac.js")
|
|
10
10
|
]);
|
|
11
11
|
var input = workerData;
|
|
12
12
|
var db;
|
package/dist/{compartment-chunk-embedding-8c85ebce.js → compartment-chunk-embedding-5j1d1e3v.js}
RENAMED
|
@@ -24,16 +24,17 @@ import {
|
|
|
24
24
|
countSessionCompartmentEmbedCoverage2,
|
|
25
25
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
26
26
|
countUnembeddedSessionCompartmentsPolite2
|
|
27
|
-
} from "./index-
|
|
28
|
-
import"./index-
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
27
|
+
} from "./index-2p691ayw.js";
|
|
28
|
+
import"./index-rzfr7wdv.js";
|
|
29
|
+
import"./index-rgvqh5x7.js";
|
|
30
|
+
import"./index-mkh1cm5k.js";
|
|
31
31
|
import"./index-399p688g.js";
|
|
32
|
-
import"./index-
|
|
33
|
-
import"./index-
|
|
32
|
+
import"./index-0wtm7g7f.js";
|
|
33
|
+
import"./index-wt7vmyj4.js";
|
|
34
34
|
import"./index-2qtx0q6h.js";
|
|
35
|
-
import"./index-
|
|
35
|
+
import"./index-gymgz20n.js";
|
|
36
36
|
import"./index-0h2mkab2.js";
|
|
37
|
+
import"./index-dnp1jjar.js";
|
|
37
38
|
import"./index-54wmg4rj.js";
|
|
38
39
|
export {
|
|
39
40
|
CHUNK_WINDOW_SAFETY_RATIO2 as CHUNK_WINDOW_SAFETY_RATIO,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensureMemoryEmbeddings2
|
|
3
|
+
} from "./index-vgfk2xa5.js";
|
|
4
|
+
import"./index-a11nmw5t.js";
|
|
5
|
+
import"./index-9p40dgkm.js";
|
|
6
|
+
import"./index-hgd00nas.js";
|
|
7
|
+
import"./index-yhzhdp3m.js";
|
|
8
|
+
import"./index-mp0gh04g.js";
|
|
9
|
+
import"./index-2p691ayw.js";
|
|
10
|
+
import"./index-2qqsnh1b.js";
|
|
11
|
+
import"./index-rzfr7wdv.js";
|
|
12
|
+
import"./index-ccanzg8p.js";
|
|
13
|
+
import"./index-6pk49fc3.js";
|
|
14
|
+
import"./index-rgvqh5x7.js";
|
|
15
|
+
import"./index-mkh1cm5k.js";
|
|
16
|
+
import"./index-399p688g.js";
|
|
17
|
+
import"./index-0wtm7g7f.js";
|
|
18
|
+
import"./index-wt7vmyj4.js";
|
|
19
|
+
import"./index-2qtx0q6h.js";
|
|
20
|
+
import"./index-gymgz20n.js";
|
|
21
|
+
import"./index-0h2mkab2.js";
|
|
22
|
+
import"./index-dnp1jjar.js";
|
|
23
|
+
import"./index-54wmg4rj.js";
|
|
24
|
+
export {
|
|
25
|
+
ensureMemoryEmbeddings2 as ensureMemoryEmbeddings
|
|
26
|
+
};
|
package/dist/embedding-worker.js
CHANGED
|
@@ -3,16 +3,17 @@ import {
|
|
|
3
3
|
} from "./index-0h2mkab2.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gymgz20n.js";
|
|
7
|
+
import"./index-dnp1jjar.js";
|
|
7
8
|
import"./index-ccanzg8p.js";
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-rzfr7wdv.js";
|
|
10
|
+
import"./index-wt7vmyj4.js";
|
|
10
11
|
import"./index-2qtx0q6h.js";
|
|
11
12
|
import {
|
|
12
13
|
resolveLocalEmbeddingWorkerRuntime,
|
|
13
14
|
getLocalEmbeddingNativeMemoryStats,
|
|
14
15
|
LocalEmbeddingProvider
|
|
15
|
-
} from "./index-
|
|
16
|
+
} from "./index-2qqsnh1b.js";
|
|
16
17
|
import {
|
|
17
18
|
setStoragePrivatePermissionEnforcement
|
|
18
19
|
} from "./index-81nthk8j.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// ../plugin/src/v2/hooks/expand-attachments.ts
|
|
2
|
+
function createV2RecoveryAttachments(reader) {
|
|
3
|
+
return (sessionId, messageId) => {
|
|
4
|
+
const row = reader.messageById(sessionId, messageId);
|
|
5
|
+
if (row?.type !== "user" || !Array.isArray(row.data.files))
|
|
6
|
+
return [];
|
|
7
|
+
return row.data.files.map((file, index) => {
|
|
8
|
+
const source = file.source;
|
|
9
|
+
return {
|
|
10
|
+
type: "file",
|
|
11
|
+
filename: file.name,
|
|
12
|
+
mime: file.mime,
|
|
13
|
+
url: source?.uri,
|
|
14
|
+
partIndex: index + 1
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
createV2RecoveryAttachments
|
|
21
|
+
};
|
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
} from "./index-0b5kqg7n.js";
|
|
11
11
|
import"./index-4knyh1kt.js";
|
|
12
12
|
import"./index-6x556c2q.js";
|
|
13
|
-
import"./index-
|
|
13
|
+
import"./index-gymgz20n.js";
|
|
14
14
|
import"./index-0h2mkab2.js";
|
|
15
|
+
import"./index-dnp1jjar.js";
|
|
15
16
|
export {
|
|
16
17
|
HISTORIAN_CACHE_TAIL_ENV2 as HISTORIAN_CACHE_TAIL_ENV,
|
|
17
18
|
HISTORIAN_MAX_OUTPUT_TOKENS_ENV2 as HISTORIAN_MAX_OUTPUT_TOKENS_ENV,
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
tagRevisionCountSql,
|
|
4
4
|
tagRevisionKey,
|
|
5
5
|
TAG_INSERT_CONFLICT_ROWS
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-yacs388s.js";
|
|
7
7
|
import {
|
|
8
8
|
getTagsBySession2,
|
|
9
9
|
getTagsByNumbers2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-yhsmjvqa.js";
|
|
11
11
|
import {
|
|
12
12
|
inRootAsyncContext2,
|
|
13
13
|
getSqliteDatabasePath2,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./index-2qtx0q6h.js";
|
|
16
16
|
import {
|
|
17
17
|
createFailClosedBlockingError
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-3bb24eb6.js";
|
|
19
19
|
import {
|
|
20
20
|
createWorkerShutdown
|
|
21
21
|
} from "./index-54wmg4rj.js";
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getHarness2,
|
|
3
|
+
harnessOwnsOpenCodeStore2
|
|
4
|
+
} from "./index-0h2mkab2.js";
|
|
1
5
|
import {
|
|
2
6
|
getMagicContextStorageDir,
|
|
3
7
|
getLegacyOpenCodeMagicContextStorageDir,
|
|
4
|
-
sanitizeDiagnosticText,
|
|
5
8
|
importPluginModule,
|
|
6
9
|
writeForwardedLogLine2,
|
|
7
10
|
log2
|
|
8
|
-
} from "./index-
|
|
9
|
-
import {
|
|
10
|
-
getHarness2,
|
|
11
|
-
harnessOwnsOpenCodeStore2
|
|
12
|
-
} from "./index-0h2mkab2.js";
|
|
11
|
+
} from "./index-gymgz20n.js";
|
|
13
12
|
import {
|
|
14
13
|
inRootAsyncContext2,
|
|
15
14
|
registerSlowWriteReporter2,
|
|
@@ -25,13 +24,16 @@ import {
|
|
|
25
24
|
} from "./index-2qtx0q6h.js";
|
|
26
25
|
import {
|
|
27
26
|
scheduleAfterBootQuiet
|
|
28
|
-
} from "./index-
|
|
27
|
+
} from "./index-6pk49fc3.js";
|
|
29
28
|
import {
|
|
30
29
|
configureContextDatabasePragmas2
|
|
31
30
|
} from "./index-fapenpch.js";
|
|
31
|
+
import {
|
|
32
|
+
attachFailClosedBlockingProcessEvidence
|
|
33
|
+
} from "./index-3bb24eb6.js";
|
|
32
34
|
import {
|
|
33
35
|
startMessageFtsRowidMapBackfill2
|
|
34
|
-
} from "./index-
|
|
36
|
+
} from "./index-rgvqh5x7.js";
|
|
35
37
|
import {
|
|
36
38
|
LKG_SLOT_CHUNKS_DDL,
|
|
37
39
|
SESSION_REPLAY_DECISIONS_DDL,
|
|
@@ -41,24 +43,26 @@ import {
|
|
|
41
43
|
hasPendingMigrations,
|
|
42
44
|
getMainThreadMigrationBodyCount,
|
|
43
45
|
runMigrations
|
|
44
|
-
} from "./index-
|
|
46
|
+
} from "./index-d107f484.js";
|
|
45
47
|
import {
|
|
46
48
|
ensureColumn,
|
|
47
49
|
installV95PerfSchema,
|
|
48
50
|
installTagIdentityRevisionTrigger
|
|
49
|
-
} from "./index-
|
|
51
|
+
} from "./index-yacs388s.js";
|
|
50
52
|
import {
|
|
51
53
|
resolveOpenCodeDbPath,
|
|
52
|
-
hasV1MessageTables
|
|
54
|
+
hasV1MessageTables
|
|
55
|
+
} from "./index-n0zjvs3h.js";
|
|
56
|
+
import {
|
|
53
57
|
setDatabase,
|
|
54
58
|
loadToolDefinitionMeasurements
|
|
55
|
-
} from "./index-
|
|
59
|
+
} from "./index-c6wbq66z.js";
|
|
56
60
|
import {
|
|
57
61
|
closeQuietly
|
|
58
62
|
} from "./index-nrzkqte4.js";
|
|
59
63
|
import {
|
|
60
64
|
logSlowWriteTransaction
|
|
61
|
-
} from "./index-
|
|
65
|
+
} from "./index-0wtm7g7f.js";
|
|
62
66
|
import {
|
|
63
67
|
shouldEnforcePrivateStoragePermissions,
|
|
64
68
|
ensureStorageDirectorySync,
|
|
@@ -68,230 +72,6 @@ import {
|
|
|
68
72
|
tightenStorageTreeSync
|
|
69
73
|
} from "./index-81nthk8j.js";
|
|
70
74
|
|
|
71
|
-
// ../plugin/src/features/magic-context/fail-closed-block.ts
|
|
72
|
-
var FAIL_CLOSED_DOCTOR_COMMAND = "npx @cortexkit/magic-context@latest doctor";
|
|
73
|
-
var FAIL_CLOSED_REPROBE_EVERY_N = 5;
|
|
74
|
-
function attachFailClosedBlockingProcessEvidence(process2, evidence) {
|
|
75
|
-
Object.defineProperties(process2, {
|
|
76
|
-
startTime: { configurable: true, value: evidence.startTime },
|
|
77
|
-
commandLine: { configurable: true, value: evidence.commandLine }
|
|
78
|
-
});
|
|
79
|
-
return process2;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
class FailClosedBlockingError extends Error {
|
|
83
|
-
code = "FAIL_CLOSED_BLOCKING";
|
|
84
|
-
reason;
|
|
85
|
-
constructor(message, reason, options) {
|
|
86
|
-
super(message, options);
|
|
87
|
-
this.name = "FailClosedBlockingError";
|
|
88
|
-
this.reason = reason;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
var OPENCODE_INTERNAL_AGENT_NAMES = new Set(["title", "summary", "compaction"]);
|
|
92
|
-
function isMagicContextHiddenAgentName(agent) {
|
|
93
|
-
if (agent === "smart-note-compiler" || agent.startsWith("smart-note-")) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
if (agent === "historian" || agent.startsWith("historian-"))
|
|
97
|
-
return true;
|
|
98
|
-
if (agent === "dreamer" || agent.startsWith("dreamer-"))
|
|
99
|
-
return true;
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
var MAX_FORMATTED_BLOCKING_PROCESSES = 8;
|
|
103
|
-
var MAX_FORMATTED_COMMAND_LINE_LENGTH = 80;
|
|
104
|
-
function normalizeFailClosedProcessKind(process2) {
|
|
105
|
-
switch (process2.kind) {
|
|
106
|
-
case "OpenCode server":
|
|
107
|
-
case "OpenCode instance (TUI/CLI)":
|
|
108
|
-
case "Pi":
|
|
109
|
-
case "process":
|
|
110
|
-
return process2.kind;
|
|
111
|
-
}
|
|
112
|
-
switch (process2.harness?.trim().toLowerCase()) {
|
|
113
|
-
case "opencode server":
|
|
114
|
-
return "OpenCode server";
|
|
115
|
-
case "opencode instance (tui/cli)":
|
|
116
|
-
case "opencode instance":
|
|
117
|
-
return "OpenCode instance (TUI/CLI)";
|
|
118
|
-
case "pi":
|
|
119
|
-
case "pi harness":
|
|
120
|
-
case "omp":
|
|
121
|
-
return "Pi";
|
|
122
|
-
default:
|
|
123
|
-
return "process";
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
function formatFailClosedProcessStartTime(startTime) {
|
|
127
|
-
if (!Number.isFinite(startTime) || startTime <= 0)
|
|
128
|
-
return "unverified";
|
|
129
|
-
try {
|
|
130
|
-
const parts = new Intl.DateTimeFormat("en-US", {
|
|
131
|
-
day: "numeric",
|
|
132
|
-
hour: "2-digit",
|
|
133
|
-
minute: "2-digit",
|
|
134
|
-
month: "short",
|
|
135
|
-
hour12: false
|
|
136
|
-
}).formatToParts(new Date(startTime));
|
|
137
|
-
const values = Object.fromEntries(parts.map(({ type, value }) => [type, value]));
|
|
138
|
-
if (!values.month || !values.day || !values.hour || !values.minute)
|
|
139
|
-
return "unverified";
|
|
140
|
-
return `${values.month} ${values.day} ${values.hour}:${values.minute}`;
|
|
141
|
-
} catch {
|
|
142
|
-
return "unverified";
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function formatFailClosedCommandLine(commandLine) {
|
|
146
|
-
if (typeof commandLine !== "string" || commandLine.trim().length === 0)
|
|
147
|
-
return "unverified";
|
|
148
|
-
try {
|
|
149
|
-
const normalized = commandLine.replaceAll("\x00", " ").replace(/\s+/g, " ").trim();
|
|
150
|
-
if (normalized.length === 0)
|
|
151
|
-
return "unverified";
|
|
152
|
-
const sanitized = sanitizeDiagnosticText(normalized).trim();
|
|
153
|
-
if (sanitized.length === 0)
|
|
154
|
-
return "unverified";
|
|
155
|
-
return sanitized.length > MAX_FORMATTED_COMMAND_LINE_LENGTH ? `${sanitized.slice(0, MAX_FORMATTED_COMMAND_LINE_LENGTH - 3)}...` : sanitized;
|
|
156
|
-
} catch {
|
|
157
|
-
return "unverified";
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function formatFailClosedBlockingProcesses(processes) {
|
|
161
|
-
const uniqueProcesses = new Map;
|
|
162
|
-
for (const process2 of processes) {
|
|
163
|
-
if (!Number.isInteger(process2.pid) || process2.pid <= 0)
|
|
164
|
-
continue;
|
|
165
|
-
const candidate = {
|
|
166
|
-
kind: normalizeFailClosedProcessKind(process2),
|
|
167
|
-
pid: process2.pid,
|
|
168
|
-
startTime: process2.startTime,
|
|
169
|
-
commandLine: process2.commandLine
|
|
170
|
-
};
|
|
171
|
-
const previous = uniqueProcesses.get(process2.pid);
|
|
172
|
-
if (!previous || previous.kind === "process" && candidate.kind !== "process") {
|
|
173
|
-
uniqueProcesses.set(process2.pid, candidate);
|
|
174
|
-
} else {
|
|
175
|
-
uniqueProcesses.set(process2.pid, {
|
|
176
|
-
...previous,
|
|
177
|
-
startTime: previous.startTime ?? candidate.startTime,
|
|
178
|
-
commandLine: previous.commandLine ?? candidate.commandLine
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
const entries = [...uniqueProcesses.values()];
|
|
183
|
-
const visible = entries.slice(0, MAX_FORMATTED_BLOCKING_PROCESSES);
|
|
184
|
-
const rendered = visible.map(({ kind, pid }) => `${kind} (PID ${pid})`);
|
|
185
|
-
const omitted = entries.length - visible.length;
|
|
186
|
-
if (omitted > 0)
|
|
187
|
-
rendered.push(`${omitted} more blocking process(es)`);
|
|
188
|
-
if (rendered.length === 0)
|
|
189
|
-
return "a live process";
|
|
190
|
-
const summary = rendered.length === 1 ? rendered[0] : `${rendered.slice(0, -1).join(", ")}, and ${rendered.at(-1)}`;
|
|
191
|
-
const evidence = entries.map(({ kind, pid, startTime, commandLine }) => `- PID ${pid}: ${kind}, started ${formatFailClosedProcessStartTime(startTime)}, cmd: ${formatFailClosedCommandLine(commandLine)}`).join(`
|
|
192
|
-
`);
|
|
193
|
-
return `${summary}
|
|
194
|
-
Blocking process evidence:
|
|
195
|
-
${evidence}`;
|
|
196
|
-
}
|
|
197
|
-
function formatFailClosedBlockingMessage(reason) {
|
|
198
|
-
if (reason.kind === "migration_guard") {
|
|
199
|
-
if (reason.unreadableFile) {
|
|
200
|
-
const arm = reason.unreadableArm ?? "io";
|
|
201
|
-
const recovery = arm === "io" ? `If none of these processes are running, it is safe to delete ${reason.unreadableFile} and retry.` : `The file may be a recent incomplete write; retry after the file is older than the ten-minute grace window, or stop the relevant process before deleting it.`;
|
|
202
|
-
return [
|
|
203
|
-
`Magic Context cannot migrate the shared database because RPC discovery file ${reason.unreadableFile} is uncertain (${arm} arm), so the absence of a live process cannot be proven.`,
|
|
204
|
-
recovery,
|
|
205
|
-
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
206
|
-
].join(" ");
|
|
207
|
-
}
|
|
208
|
-
return [
|
|
209
|
-
`Magic Context cannot migrate the shared database (one database serves every project on this machine) because ${formatFailClosedBlockingProcesses(reason.blockingProcesses)} may be running an older Magic Context build that would fail against the migrated database.`,
|
|
210
|
-
`The database is at upstream migration v${reason.persistedVersion}; this build needs v${reason.supportedVersion}.`,
|
|
211
|
-
"Restart the blocking process — even one from a different project — and it will pick up the new build and migrate on start; or shut it down and retry.",
|
|
212
|
-
"If that host loads a pinned or cached older Magic Context build, a restart alone is not enough: stop it or update its Magic Context build, then start this host once so it migrates the database with nothing older attached.",
|
|
213
|
-
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
214
|
-
].join(" ");
|
|
215
|
-
}
|
|
216
|
-
if (reason.kind === "schema_fence") {
|
|
217
|
-
return [
|
|
218
|
-
`Magic Context cannot operate: this Magic Context build is older than the database; upgrade/restart this harness (upstream migration lane v${reason.persistedVersion}, build supports through v${reason.supportedVersion}).`,
|
|
219
|
-
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
220
|
-
].join(" ");
|
|
221
|
-
}
|
|
222
|
-
const cause = reason.cause.trim().length > 0 ? reason.cause.trim() : "unknown storage error";
|
|
223
|
-
return [
|
|
224
|
-
`Magic Context cannot operate: persistent storage failed (${cause}).`,
|
|
225
|
-
"The plugin will not silently degrade to native compaction while enabled.",
|
|
226
|
-
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
227
|
-
].join(" ");
|
|
228
|
-
}
|
|
229
|
-
function createFailClosedBlockingError(reason, options) {
|
|
230
|
-
return new FailClosedBlockingError(formatFailClosedBlockingMessage(reason), reason, options);
|
|
231
|
-
}
|
|
232
|
-
function isFailClosedBlockingError(error) {
|
|
233
|
-
return error instanceof FailClosedBlockingError || typeof error === "object" && error !== null && error.name === "FailClosedBlockingError" && error.code === "FAIL_CLOSED_BLOCKING";
|
|
234
|
-
}
|
|
235
|
-
function shouldBypassFailClosedBlock(input) {
|
|
236
|
-
if (input.isPiSubagentEnv === true)
|
|
237
|
-
return true;
|
|
238
|
-
if (input.isInternalChildSession === true)
|
|
239
|
-
return true;
|
|
240
|
-
const agent = typeof input.agent === "string" ? input.agent.trim() : "";
|
|
241
|
-
if (agent.length === 0)
|
|
242
|
-
return false;
|
|
243
|
-
if (OPENCODE_INTERNAL_AGENT_NAMES.has(agent))
|
|
244
|
-
return true;
|
|
245
|
-
if (isMagicContextHiddenAgentName(agent))
|
|
246
|
-
return true;
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
function createFailClosedController(options) {
|
|
250
|
-
const reprobeEveryN = Math.max(1, options?.reprobeEveryN ?? FAIL_CLOSED_REPROBE_EVERY_N);
|
|
251
|
-
let reason = null;
|
|
252
|
-
let blockedPassCount = 0;
|
|
253
|
-
return {
|
|
254
|
-
arm(next) {
|
|
255
|
-
reason = next;
|
|
256
|
-
blockedPassCount = 0;
|
|
257
|
-
},
|
|
258
|
-
clear() {
|
|
259
|
-
reason = null;
|
|
260
|
-
blockedPassCount = 0;
|
|
261
|
-
},
|
|
262
|
-
isArmed() {
|
|
263
|
-
return reason !== null;
|
|
264
|
-
},
|
|
265
|
-
getReason() {
|
|
266
|
-
return reason;
|
|
267
|
-
},
|
|
268
|
-
async enforce(input) {
|
|
269
|
-
if (!reason)
|
|
270
|
-
return;
|
|
271
|
-
if (!input.blockingEnabled)
|
|
272
|
-
return;
|
|
273
|
-
if (input.exempt)
|
|
274
|
-
return;
|
|
275
|
-
blockedPassCount += 1;
|
|
276
|
-
const shouldReprobe = typeof input.tryReopen === "function" && (blockedPassCount === 1 || blockedPassCount % reprobeEveryN === 0);
|
|
277
|
-
if (shouldReprobe) {
|
|
278
|
-
try {
|
|
279
|
-
const healed = await input.tryReopen?.();
|
|
280
|
-
if (healed) {
|
|
281
|
-
reason = null;
|
|
282
|
-
blockedPassCount = 0;
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
} catch {}
|
|
286
|
-
}
|
|
287
|
-
const blockedReason = reason;
|
|
288
|
-
if (!blockedReason)
|
|
289
|
-
return;
|
|
290
|
-
throw createFailClosedBlockingError(blockedReason);
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
|
|
295
75
|
// ../plugin/src/shared/rpc-utils.ts
|
|
296
76
|
import { execFile, execFileSync } from "node:child_process";
|
|
297
77
|
import { readFileSync } from "node:fs";
|
|
@@ -2005,8 +1785,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
2005
1785
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
2006
1786
|
if (signal.aborted || !readsOpenCodeStore)
|
|
2007
1787
|
return;
|
|
2008
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
2009
|
-
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-
|
|
1788
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-nbcznexm.js"));
|
|
1789
|
+
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-x45573rs.js"));
|
|
2010
1790
|
if (signal.aborted)
|
|
2011
1791
|
return;
|
|
2012
1792
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
@@ -3525,4 +3305,4 @@ function closeDatabase() {
|
|
|
3525
3305
|
return Promise.all(pendingDatabaseCloses).then(() => {});
|
|
3526
3306
|
}
|
|
3527
3307
|
|
|
3528
|
-
export {
|
|
3308
|
+
export { piHarnessKindFromExecutable, isPidAlive, readProcessStartTime, getErrorMessage, describeError, startBootDeadline, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, getDatabasePath, getPersistedSchemaVersion, enforceSchemaFence, setSqlitePragmaConfig, applySqliteTuningPragmas, runSqliteOptimize, initializeDatabase, openDatabase, openCurrentDatabase, openDatabaseAsync, closeDatabase };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEstimatorFingerprint,
|
|
3
3
|
estimateTokens
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-wt7vmyj4.js";
|
|
5
5
|
import {
|
|
6
6
|
getHarness2
|
|
7
7
|
} from "./index-0h2mkab2.js";
|
|
8
8
|
import {
|
|
9
9
|
log2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-gymgz20n.js";
|
|
11
11
|
import {
|
|
12
12
|
isSynapseEmbeddingTruncated
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-rzfr7wdv.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-rgvqh5x7.js";
|
|
17
17
|
import {
|
|
18
18
|
isKnownAutocommit
|
|
19
19
|
} from "./index-nrzkqte4.js";
|
|
@@ -975,15 +975,26 @@ var unretainedSearchPools = new WeakMap;
|
|
|
975
975
|
function getLastCompartmentChunkPoolWarm2() {
|
|
976
976
|
return lastChunkPoolWarm;
|
|
977
977
|
}
|
|
978
|
-
function peekCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId, dateRange = null) {
|
|
979
|
-
if (!modelId)
|
|
978
|
+
function peekCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId, dateRange = null, diagnostic) {
|
|
979
|
+
if (!modelId) {
|
|
980
|
+
if (diagnostic)
|
|
981
|
+
diagnostic.peek = "no-model";
|
|
980
982
|
return null;
|
|
983
|
+
}
|
|
981
984
|
trackSearchPool(db, sessionId, projectPath, modelId);
|
|
982
985
|
const entry = getDecodedSearchPool(db).get(searchPoolKey(sessionId, projectPath, modelId));
|
|
983
|
-
if (!entry || searchPoolInTransaction(db))
|
|
986
|
+
if (!entry || searchPoolInTransaction(db)) {
|
|
987
|
+
if (diagnostic)
|
|
988
|
+
diagnostic.peek = entry ? "transaction" : "missing";
|
|
984
989
|
return null;
|
|
985
|
-
|
|
990
|
+
}
|
|
991
|
+
if (!sameSessionSignature(readSessionChunkSignature(db, sessionId), entry.sessionSignature)) {
|
|
992
|
+
if (diagnostic)
|
|
993
|
+
diagnostic.peek = "signature-changed";
|
|
986
994
|
return null;
|
|
995
|
+
}
|
|
996
|
+
if (diagnostic)
|
|
997
|
+
diagnostic.peek = "hit";
|
|
987
998
|
touchDecodedSearchPoolEntry(entry);
|
|
988
999
|
return filterSearchPoolDates(entry.rows, dateRange);
|
|
989
1000
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./index-ccanzg8p.js";
|
|
4
4
|
import {
|
|
5
5
|
getSynapseLaneIdentity
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-rzfr7wdv.js";
|
|
7
7
|
import {
|
|
8
8
|
getHarness2
|
|
9
9
|
} from "./index-0h2mkab2.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getMagicContextStorageDir,
|
|
12
12
|
importPluginModule,
|
|
13
13
|
log2
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-gymgz20n.js";
|
|
15
15
|
import {
|
|
16
16
|
inRootAsyncContext2
|
|
17
17
|
} from "./index-2qtx0q6h.js";
|