@cortexkit/pi-magic-context 0.49.7 → 0.49.9
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 +3 -2
- package/dist/{index-6q5mx0cz.js → index-243wh86p.js} +38 -28
- 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-8ye22z7k.js → index-6e3yv1jt.js} +4 -4
- package/dist/index-6x556c2q.js +19 -0
- package/dist/{index-dj8hpkz7.js → index-729kkhmf.js} +4 -3
- package/dist/{index-gc2749rx.js → index-8yjhda46.js} +9 -6
- package/dist/{index-fhv6ydkq.js → index-9vzkrnrf.js} +32 -12
- package/dist/{index-7ptxvfc5.js → index-asrxgdt4.js} +33 -10
- package/dist/{index-34zacc0h.js → index-fdxzpnbj.js} +2 -2
- package/dist/{index-0eg59y8d.js → index-g13fb2sj.js} +5 -5
- package/dist/{index-gqsfhksw.js → index-gqxsds3q.js} +6 -3
- package/dist/{index-x3dcnxh0.js → index-gycf3sp7.js} +5 -1
- package/dist/{index-0ww9cgfd.js → index-h160xxaq.js} +9 -9
- package/dist/{index-dj784nyr.js → index-hy44m6jc.js} +1 -1
- package/dist/{index-290tzwp1.js → index-kh3jt7t9.js} +1 -1
- package/dist/{index-8jpqq2yk.js → index-ns319t8e.js} +14 -13
- package/dist/{index-0d8zqccx.js → index-qc8e13wc.js} +22 -22
- package/dist/{index-mrsarsbh.js → index-rkwh9kce.js} +25 -24
- package/dist/{index-21v1kfs7.js → index-szh001qb.js} +6 -3
- package/dist/{index-cyrnv16r.js → index-ta0ed2nc.js} +2 -0
- package/dist/{index-mcgehvgw.js → index-ttxsmaj5.js} +31 -16
- package/dist/{index-a7fj661j.js → index-v26j81w6.js} +5 -5
- package/dist/{index-6vjj0555.js → index-x7426vy4.js} +242 -16
- package/dist/index.js +502 -149
- package/dist/{logger-j6tecd1h.js → logger-qg51hmp7.js} +1 -1
- package/dist/{message-index-bounded-e5bv8gzm.js → message-index-bounded-y1c88n9a.js} +15 -14
- package/dist/{message-index-8rxj3cxh.js → message-index-ejaa9may.js} +15 -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-4094zemt.js} +10 -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-hsr95vex.js} +22 -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-zh23ynsh.js} +5 -5
- package/dist/subagent-entry.js +25 -24
- package/package.json +1 -1
- package/dist/embedding-backfill-vygvr2x4.js +0 -20
- /package/dist/{index-zh1jw8qp.js → index-xmdkde4v.js} +0 -0
|
@@ -18,15 +18,15 @@ var [
|
|
|
18
18
|
{ Database, registerSqliteDiagnosticSink },
|
|
19
19
|
{ log }
|
|
20
20
|
] = await Promise.all([
|
|
21
|
-
import("./embedding-backfill-
|
|
21
|
+
import("./embedding-backfill-chva00z3.js"),
|
|
22
22
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
23
|
-
import("./storage-memory-
|
|
24
|
-
import("./project-embedding-registry-
|
|
25
|
-
import("./search-
|
|
23
|
+
import("./storage-memory-axnsk5t1.js"),
|
|
24
|
+
import("./project-embedding-registry-bxawck58.js"),
|
|
25
|
+
import("./search-hsr95vex.js"),
|
|
26
26
|
import("./embedding-activity-ew6dshfd.js"),
|
|
27
27
|
import("./harness-9872e0ym.js"),
|
|
28
|
-
import("./sqlite-
|
|
29
|
-
import("./logger-
|
|
28
|
+
import("./sqlite-adjpy399.js"),
|
|
29
|
+
import("./logger-qg51hmp7.js")
|
|
30
30
|
]);
|
|
31
31
|
setHarness(input.harness);
|
|
32
32
|
registerSqliteDiagnosticSink(log, getHarness);
|
package/dist/{compaction-marker-candidates-tqcq5n00.js → compaction-marker-candidates-n4dphyz4.js}
RENAMED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
readMarkerCandidateBasis2,
|
|
5
5
|
prepareMarkerCandidateBasis2,
|
|
6
6
|
scanMarkerCandidateSnapshot2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-729kkhmf.js";
|
|
8
8
|
import"./index-399p688g.js";
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
import"./index-asrxgdt4.js";
|
|
10
|
+
import"./index-gycf3sp7.js";
|
|
11
11
|
import"./index-0h2mkab2.js";
|
|
12
12
|
export {
|
|
13
13
|
invalidateMarkerCandidateBasis2 as invalidateMarkerCandidateBasis,
|
|
@@ -5,8 +5,8 @@ if (!port)
|
|
|
5
5
|
throw new Error("marker candidate worker requires a parent port");
|
|
6
6
|
port.postMessage({ kind: "accepted" });
|
|
7
7
|
var [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
|
|
8
|
-
import("./sqlite-
|
|
9
|
-
import("./compaction-marker-candidates-
|
|
8
|
+
import("./sqlite-adjpy399.js"),
|
|
9
|
+
import("./compaction-marker-candidates-n4dphyz4.js")
|
|
10
10
|
]);
|
|
11
11
|
var input = workerData;
|
|
12
12
|
var db;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensureMemoryEmbeddings2
|
|
3
|
+
} from "./index-v26j81w6.js";
|
|
4
|
+
import"./index-qc8e13wc.js";
|
|
5
|
+
import"./index-9p40dgkm.js";
|
|
6
|
+
import"./index-6e3yv1jt.js";
|
|
7
|
+
import"./index-yhzhdp3m.js";
|
|
8
|
+
import"./index-8yjhda46.js";
|
|
9
|
+
import"./index-szh001qb.js";
|
|
10
|
+
import"./index-ta0ed2nc.js";
|
|
11
|
+
import"./index-gqxsds3q.js";
|
|
12
|
+
import"./index-fdxzpnbj.js";
|
|
13
|
+
import"./index-43zqh10z.js";
|
|
14
|
+
import"./index-4pxydwvg.js";
|
|
15
|
+
import"./index-asrxgdt4.js";
|
|
16
|
+
import"./index-gycf3sp7.js";
|
|
17
|
+
import"./index-0h2mkab2.js";
|
|
18
|
+
export {
|
|
19
|
+
ensureMemoryEmbeddings2 as ensureMemoryEmbeddings
|
|
20
|
+
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import"./index-0h2mkab2.js";
|
|
2
2
|
import {
|
|
3
3
|
log2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-gycf3sp7.js";
|
|
5
|
+
import {
|
|
6
|
+
inRootAsyncContext2
|
|
7
|
+
} from "./index-asrxgdt4.js";
|
|
5
8
|
|
|
6
9
|
// ../plugin/src/features/magic-context/memory/embedding-worker-process.ts
|
|
7
10
|
import { Worker } from "node:worker_threads";
|
|
8
11
|
var worker;
|
|
9
12
|
process.on("message", (message) => {
|
|
10
13
|
if (message.entry && !worker) {
|
|
11
|
-
|
|
14
|
+
const entry = new URL(message.entry);
|
|
15
|
+
worker = inRootAsyncContext2(() => new Worker(entry, { workerData: message.data }));
|
|
12
16
|
worker.on("message", (reply) => {
|
|
13
17
|
const wire = {
|
|
14
18
|
...reply,
|
package/dist/embedding-worker.js
CHANGED
|
@@ -3,15 +3,16 @@ import {
|
|
|
3
3
|
} from "./index-0h2mkab2.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
6
|
+
} from "./index-gycf3sp7.js";
|
|
7
|
+
import"./index-ta0ed2nc.js";
|
|
8
|
+
import"./index-szh001qb.js";
|
|
9
|
+
import"./index-4pxydwvg.js";
|
|
10
|
+
import"./index-asrxgdt4.js";
|
|
10
11
|
import {
|
|
11
12
|
resolveLocalEmbeddingWorkerRuntime,
|
|
12
13
|
getLocalEmbeddingNativeMemoryStats,
|
|
13
14
|
LocalEmbeddingProvider
|
|
14
|
-
} from "./index-
|
|
15
|
+
} from "./index-8yjhda46.js";
|
|
15
16
|
import {
|
|
16
17
|
setStoragePrivatePermissionEnforcement
|
|
17
18
|
} from "./index-81nthk8j.js";
|
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
subagentTemperature,
|
|
3
3
|
promptFingerprint,
|
|
4
4
|
readHostSystemPrompt
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-xmdkde4v.js";
|
|
6
|
+
import"./index-6x556c2q.js";
|
|
6
7
|
import"./index-0h2mkab2.js";
|
|
7
|
-
import"./index-
|
|
8
|
+
import"./index-gycf3sp7.js";
|
|
8
9
|
|
|
9
10
|
// src/historian-calibration-extension.ts
|
|
10
11
|
import { readFileSync } from "node:fs";
|
|
@@ -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-g13fb2sj.js";
|
|
50
55
|
import {
|
|
51
56
|
closeQuietly,
|
|
52
57
|
ensureColumn,
|
|
53
58
|
installV95PerfSchema,
|
|
54
59
|
installTagIdentityRevisionTrigger
|
|
55
|
-
} from "./index-
|
|
60
|
+
} from "./index-ttxsmaj5.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-4094zemt.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,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
inRootAsyncContext2,
|
|
2
3
|
getSqliteDatabasePath2,
|
|
3
4
|
releaseIndexOwner2
|
|
4
|
-
} from "./index-
|
|
5
|
+
} from "./index-asrxgdt4.js";
|
|
5
6
|
import {
|
|
6
7
|
registerExitAbort
|
|
7
8
|
} from "./index-399p688g.js";
|
|
8
9
|
import {
|
|
9
10
|
log2
|
|
10
|
-
} from "./index-
|
|
11
|
+
} from "./index-gycf3sp7.js";
|
|
11
12
|
|
|
12
13
|
// ../plugin/src/hooks/magic-context/read-session-raw.ts
|
|
13
14
|
import { isMainThread } from "node:worker_threads";
|
|
@@ -69,7 +70,7 @@ function runSessionWarmupWorker(input, options) {
|
|
|
69
70
|
deadline.unref?.();
|
|
70
71
|
};
|
|
71
72
|
try {
|
|
72
|
-
worker = new Worker(options.entry ?? defaultEntry(), { workerData: input });
|
|
73
|
+
worker = inRootAsyncContext2(() => new Worker(options.entry ?? defaultEntry(), { workerData: input }));
|
|
73
74
|
} catch (error) {
|
|
74
75
|
finish({ failure: "start-failed", detail: String(error) });
|
|
75
76
|
return;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEstimatorFingerprint,
|
|
3
3
|
estimateTokens
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-4pxydwvg.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-gycf3sp7.js";
|
|
11
11
|
import {
|
|
12
12
|
isSynapseEmbeddingTruncated
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-szh001qb.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-fdxzpnbj.js";
|
|
17
17
|
|
|
18
18
|
// ../plugin/src/features/magic-context/compartment-chunk-embedding.ts
|
|
19
19
|
import { createHash } from "node:crypto";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// ../plugin/src/shared/hidden-zen-read.ts
|
|
2
|
+
var blockedSessions = new Set;
|
|
3
|
+
var v1Runs = new Map;
|
|
4
|
+
function rememberV1HiddenRun(sessionID, run) {
|
|
5
|
+
if (run)
|
|
6
|
+
v1Runs.set(sessionID, run);
|
|
7
|
+
else {
|
|
8
|
+
v1Runs.delete(sessionID);
|
|
9
|
+
setBlockedReadSession(sessionID, false);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function setBlockedReadSession(sessionID, enabled) {
|
|
13
|
+
if (enabled)
|
|
14
|
+
blockedSessions.add(sessionID);
|
|
15
|
+
else
|
|
16
|
+
blockedSessions.delete(sessionID);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { rememberV1HiddenRun };
|
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
} from "./index-399p688g.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gycf3sp7.js";
|
|
7
7
|
import {
|
|
8
|
+
inRootAsyncContext2,
|
|
8
9
|
getSqliteDatabasePath2
|
|
9
|
-
} from "./index-
|
|
10
|
+
} from "./index-asrxgdt4.js";
|
|
10
11
|
|
|
11
12
|
// ../plugin/src/features/magic-context/compaction-marker-candidates.ts
|
|
12
13
|
import { existsSync, realpathSync } from "node:fs";
|
|
@@ -152,7 +153,7 @@ function runCandidateWorker(path, sessionId, options) {
|
|
|
152
153
|
timer.unref?.();
|
|
153
154
|
};
|
|
154
155
|
try {
|
|
155
|
-
worker = new Worker(entry, { workerData: { path, sessionId } });
|
|
156
|
+
worker = inRootAsyncContext2(() => new Worker(entry, { workerData: { path, sessionId } }));
|
|
156
157
|
workers.add(worker);
|
|
157
158
|
worker.unref();
|
|
158
159
|
deadline(options.acceptMs ?? 2000);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-ta0ed2nc.js";
|
|
4
4
|
import {
|
|
5
5
|
getSynapseLaneIdentity
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-szh001qb.js";
|
|
7
7
|
import {
|
|
8
8
|
getHarness2
|
|
9
9
|
} from "./index-0h2mkab2.js";
|
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
getMagicContextStorageDir,
|
|
12
12
|
importPluginModule,
|
|
13
13
|
log2
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-gycf3sp7.js";
|
|
15
|
+
import {
|
|
16
|
+
inRootAsyncContext2
|
|
17
|
+
} from "./index-asrxgdt4.js";
|
|
15
18
|
import {
|
|
16
19
|
computeNormalizedHash
|
|
17
20
|
} from "./index-9x1f96r8.js";
|
|
@@ -307,7 +310,7 @@ class EmbeddingWorkerClient {
|
|
|
307
310
|
start() {
|
|
308
311
|
if (this.startPromise)
|
|
309
312
|
return this.startPromise;
|
|
310
|
-
this.startPromise = this.startOwner().finally(() => {
|
|
313
|
+
this.startPromise = inRootAsyncContext2(() => this.startOwner()).finally(() => {
|
|
311
314
|
this.startPromise = null;
|
|
312
315
|
});
|
|
313
316
|
return this.startPromise;
|
|
@@ -556,10 +559,10 @@ async function acquireModelLoadLock(lockPath) {
|
|
|
556
559
|
}
|
|
557
560
|
function startLockHeartbeat(lockPath) {
|
|
558
561
|
const HEARTBEAT_MS = Math.floor(STALE_LOCK_MS / 3);
|
|
559
|
-
const timer = setInterval(() => {
|
|
562
|
+
const timer = inRootAsyncContext2(() => setInterval(() => {
|
|
560
563
|
writeStorageFileAsync(lockPath, `pid=${process.pid} alive=${Date.now()}
|
|
561
564
|
`).catch(() => {});
|
|
562
|
-
}, HEARTBEAT_MS);
|
|
565
|
+
}, HEARTBEAT_MS));
|
|
563
566
|
timer.unref?.();
|
|
564
567
|
return () => clearInterval(timer);
|
|
565
568
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
renderToolTemplate,
|
|
5
5
|
resolveModelConfigValue,
|
|
6
6
|
deriveDefaultProtectedTokens
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-ta0ed2nc.js";
|
|
8
8
|
import {
|
|
9
9
|
getHarness2,
|
|
10
10
|
harnessOwnsOpenCodeStore2
|
|
@@ -12,16 +12,18 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
log2,
|
|
14
14
|
sessionLog2
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-gycf3sp7.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveDecisionCalibration,
|
|
18
18
|
calibrationForModelKey,
|
|
19
19
|
isRecord,
|
|
20
|
+
estimateImageTokensFromDataUrl,
|
|
21
|
+
estimateToolAttachmentImageTokens,
|
|
20
22
|
providerVisiblePart,
|
|
21
23
|
TAG_SELECT_COLUMNS2,
|
|
22
24
|
getCandidateToolOwners2,
|
|
23
25
|
pickNearestPriorOwner2
|
|
24
|
-
} from "./index-
|
|
26
|
+
} from "./index-x7426vy4.js";
|
|
25
27
|
import {
|
|
26
28
|
OMO_INTERNAL_INITIATOR_MARKER,
|
|
27
29
|
isSystemDirective,
|
|
@@ -36,15 +38,15 @@ import {
|
|
|
36
38
|
formatBlock,
|
|
37
39
|
compactTextForSummary,
|
|
38
40
|
mergeCommitHashes
|
|
39
|
-
} from "./index-
|
|
41
|
+
} from "./index-4pxydwvg.js";
|
|
40
42
|
import {
|
|
41
43
|
Database2,
|
|
42
44
|
prepareCachedStatement2
|
|
43
|
-
} from "./index-
|
|
45
|
+
} from "./index-asrxgdt4.js";
|
|
44
46
|
import {
|
|
45
47
|
stableStringify,
|
|
46
48
|
closeQuietly
|
|
47
|
-
} from "./index-
|
|
49
|
+
} from "./index-ttxsmaj5.js";
|
|
48
50
|
import {
|
|
49
51
|
resolveOpenCodeDbPath,
|
|
50
52
|
assertOpenCodeStoreGeneration,
|
|
@@ -69,10 +71,10 @@ import {
|
|
|
69
71
|
hasRawSessionMessageByIdFromDb2,
|
|
70
72
|
readRawSeedTailFromDb2,
|
|
71
73
|
readRawSessionBoundaryEndpointsFromDb2
|
|
72
|
-
} from "./index-
|
|
74
|
+
} from "./index-4vj37yw9.js";
|
|
73
75
|
import {
|
|
74
76
|
logSlowWriteTransaction
|
|
75
|
-
} from "./index-
|
|
77
|
+
} from "./index-43zqh10z.js";
|
|
76
78
|
|
|
77
79
|
// ../plugin/src/features/magic-context/overflow-detection.ts
|
|
78
80
|
var OVERFLOW_PATTERNS = [
|
|
@@ -4019,6 +4021,17 @@ function opaqueThinkingCost(reasoning, output) {
|
|
|
4019
4021
|
|
|
4020
4022
|
// ../plugin/src/hooks/magic-context/final-wire-token-estimate.ts
|
|
4021
4023
|
var wireTextTokens = createTokenCountMemo(1e5, 128 * 1024 * 1024);
|
|
4024
|
+
function estimatePartImageTokens(raw) {
|
|
4025
|
+
if (!raw || typeof raw !== "object")
|
|
4026
|
+
return 0;
|
|
4027
|
+
const part = raw;
|
|
4028
|
+
if (part.ignored)
|
|
4029
|
+
return 0;
|
|
4030
|
+
if (part.type === "file" && part.mime?.startsWith("image/")) {
|
|
4031
|
+
return typeof part.url === "string" && part.url.startsWith("data:") ? estimateImageTokensFromDataUrl(part.url) : 1200;
|
|
4032
|
+
}
|
|
4033
|
+
return part.type === "tool" ? estimateToolAttachmentImageTokens(part.state) : 0;
|
|
4034
|
+
}
|
|
4022
4035
|
|
|
4023
4036
|
// ../plugin/src/hooks/magic-context/tool-input-size.ts
|
|
4024
4037
|
var SKELETON_REAL_INPUT_MAX_BYTES = 1024;
|
|
@@ -4546,13 +4559,20 @@ function readRawSessionMessageOrdinalById2(sessionId, messageId) {
|
|
|
4546
4559
|
return null;
|
|
4547
4560
|
return withReadOnlySessionDb((db) => readRawSessionMessageOrdinalByIdFromDb2(db, sessionId, messageId));
|
|
4548
4561
|
}
|
|
4562
|
+
function readRawSessionMessageOrderPosition(sessionId, messageId) {
|
|
4563
|
+
const provider = sessionProviders.get(sessionId)?.provider;
|
|
4564
|
+
if (provider) {
|
|
4565
|
+
return provider.readMessageOrderById ? provider.readMessageOrderById(messageId) : provider.readMessageOrdinalById?.(messageId) ?? null;
|
|
4566
|
+
}
|
|
4567
|
+
return readRawSessionMessageOrdinalById2(sessionId, messageId);
|
|
4568
|
+
}
|
|
4549
4569
|
function compareRawSessionMessageOrder2(sessionId, leftId, rightId) {
|
|
4550
4570
|
const provider = sessionProviders.get(sessionId)?.provider;
|
|
4551
4571
|
if (provider) {
|
|
4552
|
-
if (!provider.readMessageOrdinalById)
|
|
4572
|
+
if (!provider.readMessageOrderById && !provider.readMessageOrdinalById)
|
|
4553
4573
|
return null;
|
|
4554
|
-
const left =
|
|
4555
|
-
const right =
|
|
4574
|
+
const left = readRawSessionMessageOrderPosition(sessionId, leftId);
|
|
4575
|
+
const right = readRawSessionMessageOrderPosition(sessionId, rightId);
|
|
4556
4576
|
return left === null || right === null ? null : left - right;
|
|
4557
4577
|
}
|
|
4558
4578
|
if (!openCodeDbExists())
|
|
@@ -5034,4 +5054,4 @@ function readRawSessionSeedTail2(sessionId, boundaryId, onQuery) {
|
|
|
5034
5054
|
});
|
|
5035
5055
|
}
|
|
5036
5056
|
|
|
5037
|
-
export { detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, computeProtectionWindow, readEpochFloorSnapshot, getProtectionWindowForSession, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, isRustMarkerAdmissionFenced, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, EMERGENCY_DRAIN_FAILURE_BACKOFF_MS, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, recordOverflowDetected, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, setPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingPiMarker, setSessionWorkMetrics, getSessionWorkMetrics, resolveEpochFloorForPass, withReadOnlySessionDb, expandToolPart, retreatPastHostUnservedRows, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, modelAcceptsEmptyContent, isAnthropicFamilyRoute, variantChangeBustsProviderCache, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, findLatestAssistantReasoningMutationExemptMessage, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opaqueThinkingCost, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|
|
5057
|
+
export { detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, computeProtectionWindow, readEpochFloorSnapshot, getProtectionWindowForSession, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, isRustMarkerAdmissionFenced, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, EMERGENCY_DRAIN_FAILURE_BACKOFF_MS, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, recordOverflowDetected, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, setPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingPiMarker, setSessionWorkMetrics, getSessionWorkMetrics, resolveEpochFloorForPass, withReadOnlySessionDb, expandToolPart, retreatPastHostUnservedRows, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, modelAcceptsEmptyContent, isAnthropicFamilyRoute, variantChangeBustsProviderCache, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, findLatestAssistantReasoningMutationExemptMessage, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opaqueThinkingCost, estimatePartImageTokens, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|