@cortexkit/opencode-magic-context 0.49.84 → 0.49.86
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/{announcement-p41dde4h.js → announcement-fnyxaahs.js} +3 -1
- package/dist/auto-search-worker.js +3 -3
- package/dist/chunk-embedding-write-worker.js +5 -4
- package/dist/{context-3sajdysh.js → context-xesm7rj3.js} +27 -26
- package/dist/{derive-budgets-0kcek5ex.js → derive-budgets-90869322.js} +3 -1
- package/dist/{embedding-backfill-k994xdas.js → embedding-backfill-v6sw58m8.js} +7 -5
- package/dist/embedding-worker.js +15 -27
- package/dist/features/magic-context/memory/embedding-worker-boundary.test-support.d.ts +24 -0
- package/dist/features/magic-context/memory/embedding-worker-boundary.test-support.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts +35 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-loop.d.ts +57 -0
- package/dist/features/magic-context/memory/embedding-worker-loop.d.ts.map +1 -0
- package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +6 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
- package/dist/{index-xjfan0za.js → index-022w6314.js} +37 -37
- package/dist/{index-tvbkemec.js → index-08jfpny9.js} +1 -1
- package/dist/{index-fgy6hnr3.js → index-1bqkqde0.js} +5 -4
- package/dist/{index-0wehkw71.js → index-1pf5qrx4.js} +4 -4
- package/dist/{index-tqnvn9pa.js → index-25nktq8n.js} +3 -3
- package/dist/{index-98qy103c.js → index-2kf73btc.js} +1 -1
- package/dist/{index-vpw46557.js → index-3dtzyred.js} +1 -1
- package/dist/{index-bd34njzg.js → index-4ntnt8ee.js} +1 -1
- package/dist/{index-w2wpx7t5.js → index-4w5rx7de.js} +1 -1
- package/dist/{index-xd0ww0ns.js → index-798s7c8s.js} +1 -1
- package/dist/{index-fpqdbb67.js → index-7svecf3m.js} +3 -3
- package/dist/{v2/server-fvnzcnww.js → index-c5tmzym6.js} +192 -11
- package/dist/{index-k0jnsjcp.js → index-d0rtbv0f.js} +6 -6
- package/dist/{index-qybp04ff.js → index-e32b3x4n.js} +3 -3
- package/dist/{index-cfy5k1pa.js → index-gxdc95cp.js} +5 -5
- package/dist/{index-w8dcjt7f.js → index-k0tb2z28.js} +1 -1
- package/dist/{index-zb4h9nrk.js → index-k50xhjw1.js} +202 -14
- package/dist/{index-szwrpyac.js → index-nny4gm06.js} +1 -1
- package/dist/{index-shpyv8gq.js → index-s8ks5nz4.js} +16 -9
- package/dist/{index-d028gmgp.js → index-ttk3trse.js} +14 -14
- package/dist/{index-skwwbcnv.js → index-w6v4dw5f.js} +24 -24
- package/dist/{index-5wjv4c41.js → index-xccywqdj.js} +15 -15
- package/dist/{index-kthfyf45.js → index-zmqx48vt.js} +3 -3
- package/dist/index.js +33 -33
- package/dist/migration-worker.js +4 -3
- package/dist/{project-embedding-registry-y3z36mjy.js → project-embedding-registry-q80scexh.js} +6 -4
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{recomp-orchestrator-m2s3jpvj.js → recomp-orchestrator-7ecg8ryx.js} +16 -15
- package/dist/{render-p2j7rn9a.js → render-yqp7q79f.js} +8 -7
- package/dist/{search-archive-hz9xh7nh.js → search-archive-r4h96j2z.js} +2 -2
- package/dist/{search-ksx0f1qd.js → search-bw22d7zc.js} +12 -10
- package/dist/shared/storage-file-mutex.d.ts.map +1 -1
- package/dist/shared/storage-permissions.d.ts +5 -3
- package/dist/shared/storage-permissions.d.ts.map +1 -1
- package/dist/{store-x0swqb5c.js → store-n4yz3n66.js} +2 -2
- package/dist/{store-reader-tsv1w4vt.js → store-reader-nf8z86n9.js} +1 -1
- package/dist/{transform-postprocess-phase-1wb2rrr1.js → transform-postprocess-phase-t99yj9vt.js} +17 -16
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +5 -4
- package/dist/v2/{context-at9nje0j.js → context-k8sx1nyy.js} +39 -39
- package/dist/v2/{derive-budgets-xbwcap8k.js → derive-budgets-ecjy1aqh.js} +4 -2
- package/dist/v2/{embedding-backfill-hjvjxp7d.js → embedding-backfill-k8kqnwfq.js} +7 -5
- package/dist/v2/embedding-worker.js +15 -27
- package/dist/v2/migration-worker.js +4 -3
- package/dist/v2/{project-embedding-registry-mzsvyads.js → project-embedding-registry-2jp1antr.js} +6 -4
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{recomp-orchestrator-nhef90gc.js → recomp-orchestrator-ssde9ft1.js} +17 -16
- package/dist/v2/{render-c9r2g2jv.js → render-fezgh7pa.js} +8 -7
- package/dist/v2/{search-archive-80ckv9kq.js → search-archive-zz1kza50.js} +2 -2
- package/dist/v2/{search-t06js5dc.js → search-m251amra.js} +11 -9
- package/dist/v2/{server-4z964n1c.js → server-3p6b0qya.js} +1 -1
- package/dist/v2/{server-3cndh146.js → server-4wwwm2ya.js} +24 -24
- package/dist/v2/{server-mr9rqn0y.js → server-97w51d8n.js} +4 -4
- package/dist/v2/{server-d706s5xn.js → server-b93f0bqh.js} +205 -17
- package/dist/v2/{server-dfesqfv1.js → server-brgandk4.js} +1 -1
- package/dist/v2/{server-w1jfaxas.js → server-cwtehwbb.js} +1 -1
- package/dist/v2/{server-y4favn4d.js → server-e2k9mt86.js} +1 -1
- package/dist/v2/{server-3hhakg5a.js → server-fsw8kbng.js} +13 -13
- package/dist/v2/{server-68q80y27.js → server-hn8b7sfe.js} +16 -9
- package/dist/v2/{server-pejjj0nv.js → server-mbkwcwgw.js} +1 -1
- package/dist/v2/{server-ry6rpspz.js → server-n5zr7190.js} +15 -15
- package/dist/v2/{server-210rc0z9.js → server-ps6rz88g.js} +1 -1
- package/dist/{index-fvnzcnww.js → v2/server-r2es6zt7.js} +192 -11
- package/dist/v2/{server-bt546axy.js → server-rz4snd3x.js} +3 -3
- package/dist/v2/{server-863bwkga.js → server-ssg29wjg.js} +6 -6
- package/dist/v2/{server-hhw6rzsn.js → server-w7mpvkpj.js} +1 -1
- package/dist/v2/{server-sy98vksf.js → server-xa8fefhw.js} +3 -3
- package/dist/v2/{server-gx1s06dx.js → server-y31y6gws.js} +5 -4
- package/dist/v2/{server-cce6m31c.js → server-ytqps2xa.js} +1 -1
- package/dist/v2/server.js +6 -4
- package/dist/v2/{store-reader-paamf0ac.js → store-reader-2vhx33n6.js} +1 -1
- package/dist/v2/{store-h3s95ywe.js → store-y56y034s.js} +2 -2
- package/dist/v2/{v2-archive-reader-1zzteaa5.js → v2-archive-reader-e2w39c3p.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-9y98qcqz.js → wrapup-orchestrator-eg5b1p89.js} +16 -15
- package/dist/{v2-archive-reader-3yjxaj5z.js → v2-archive-reader-8dsngf2j.js} +1 -1
- package/dist/{wrapup-orchestrator-sa3a075a.js → wrapup-orchestrator-nmk6yf7f.js} +17 -16
- package/package.json +1 -1
- package/src/shared/storage-file-mutex-review.test.ts +125 -2
- package/src/shared/storage-file-mutex.ts +17 -8
- package/src/shared/storage-permissions-creators.test.ts +194 -0
- package/src/shared/storage-permissions-startup.test.ts +476 -0
- package/src/shared/storage-permissions.ts +227 -12
- package/src/tui/compaction-off.ts +2 -2
- package/src/tui/slots/sidebar-content-render.test.ts +309 -0
- package/src/tui/slots/sidebar-content.tsx +134 -99
- package/src/tui-compiled/compaction-off.ts +2 -2
- package/src/tui-compiled/slots/sidebar-content.tsx +321 -247
- /package/dist/{index-rdh63md0.js → index-1y4y98r1.js} +0 -0
- /package/dist/v2/{server-9nk5h6w6.js → server-qyazxy92.js} +0 -0
|
@@ -57,6 +57,20 @@ import {
|
|
|
57
57
|
SqliteAcquisitionBusyError2,
|
|
58
58
|
withAsyncPrivilegedWriter2
|
|
59
59
|
} from "./index-gzy5w8ya.js";
|
|
60
|
+
import {
|
|
61
|
+
registerOwnRpcServerInstance,
|
|
62
|
+
rpcPortDir,
|
|
63
|
+
rpcPortFilePath,
|
|
64
|
+
parseRpcPortFile,
|
|
65
|
+
inspectProcessesAsync
|
|
66
|
+
} from "./index-gqf8r04r.js";
|
|
67
|
+
import {
|
|
68
|
+
shouldEnforcePrivateStoragePermissions,
|
|
69
|
+
ensureStorageDirectorySync,
|
|
70
|
+
writeStorageFileAtomicSync,
|
|
71
|
+
writeStorageFileAsync,
|
|
72
|
+
createStorageWriteStream
|
|
73
|
+
} from "./index-c5tmzym6.js";
|
|
60
74
|
import {
|
|
61
75
|
pruneMissingProjectIdentities,
|
|
62
76
|
shouldSkipHomeProjectMemory,
|
|
@@ -73,7 +87,7 @@ import {
|
|
|
73
87
|
storedPathBelongsToIdentity,
|
|
74
88
|
beginBootQuietPeriod,
|
|
75
89
|
scheduleAfterBootQuiet
|
|
76
|
-
} from "./index-
|
|
90
|
+
} from "./index-7svecf3m.js";
|
|
77
91
|
import {
|
|
78
92
|
recordSessionProjectIdentity,
|
|
79
93
|
hasRecordedSessionProjectIdentity,
|
|
@@ -83,7 +97,7 @@ import {
|
|
|
83
97
|
markGitSweepSuccessAndRelease,
|
|
84
98
|
parkGitSweepNonIndexable,
|
|
85
99
|
releaseGitSweepLease
|
|
86
|
-
} from "./index-
|
|
100
|
+
} from "./index-3dtzyred.js";
|
|
87
101
|
import {
|
|
88
102
|
getMagicContextBuiltinCommands,
|
|
89
103
|
formatConfigParseStatusLine,
|
|
@@ -198,7 +212,7 @@ import {
|
|
|
198
212
|
snapRangeToCompartments,
|
|
199
213
|
getActiveCompartmentRun,
|
|
200
214
|
startCompartmentAgent
|
|
201
|
-
} from "./index-
|
|
215
|
+
} from "./index-ttk3trse.js";
|
|
202
216
|
import {
|
|
203
217
|
hasTrustedAbsoluteWall,
|
|
204
218
|
applyProvenInputFloor,
|
|
@@ -210,7 +224,7 @@ import {
|
|
|
210
224
|
deriveTriggerBudget2,
|
|
211
225
|
resolveKnownHistorianContextLimit2,
|
|
212
226
|
resolveHistorianProducerLimits2
|
|
213
|
-
} from "./index-
|
|
227
|
+
} from "./index-zmqx48vt.js";
|
|
214
228
|
import {
|
|
215
229
|
resolveModelCalibration,
|
|
216
230
|
calibrateBuckets,
|
|
@@ -435,13 +449,6 @@ import {
|
|
|
435
449
|
shouldBypassFailClosedBlock,
|
|
436
450
|
resolveAgentNameFromMessages
|
|
437
451
|
} from "./index-wh9fxds5.js";
|
|
438
|
-
import {
|
|
439
|
-
registerOwnRpcServerInstance,
|
|
440
|
-
rpcPortDir,
|
|
441
|
-
rpcPortFilePath,
|
|
442
|
-
parseRpcPortFile,
|
|
443
|
-
inspectProcessesAsync
|
|
444
|
-
} from "./index-gqf8r04r.js";
|
|
445
452
|
import {
|
|
446
453
|
configureContextDatabasePragmas2
|
|
447
454
|
} from "./index-fb3zxn06.js";
|
|
@@ -455,7 +462,7 @@ import {
|
|
|
455
462
|
runSqliteOptimize,
|
|
456
463
|
openDatabase,
|
|
457
464
|
openCurrentDatabase
|
|
458
|
-
} from "./index-
|
|
465
|
+
} from "./index-xccywqdj.js";
|
|
459
466
|
import {
|
|
460
467
|
unescapeXml,
|
|
461
468
|
resolveWorkspaceShareCategories,
|
|
@@ -464,7 +471,7 @@ import {
|
|
|
464
471
|
resolveStoredPathWorkspaceIdentity,
|
|
465
472
|
storedPathBelongsToWorkspace,
|
|
466
473
|
computeWorkspaceEpochFingerprint
|
|
467
|
-
} from "./index-
|
|
474
|
+
} from "./index-4w5rx7de.js";
|
|
468
475
|
import {
|
|
469
476
|
V2_MEMORY_CATEGORIES,
|
|
470
477
|
CATEGORY_PRIORITY
|
|
@@ -571,7 +578,7 @@ import {
|
|
|
571
578
|
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
572
579
|
getProjectState,
|
|
573
580
|
bumpProjectUserProfileVersion
|
|
574
|
-
} from "./index-
|
|
581
|
+
} from "./index-w6v4dw5f.js";
|
|
575
582
|
import {
|
|
576
583
|
getLastIndexedOrdinal
|
|
577
584
|
} from "./index-05bm2ndp.js";
|
|
@@ -600,7 +607,7 @@ import {
|
|
|
600
607
|
createPrimer,
|
|
601
608
|
updatePrimerSupport,
|
|
602
609
|
updatePrimerAnswer
|
|
603
|
-
} from "./index-
|
|
610
|
+
} from "./index-4ntnt8ee.js";
|
|
604
611
|
import {
|
|
605
612
|
registerNotificationSink2,
|
|
606
613
|
pushNotification2,
|
|
@@ -612,7 +619,7 @@ import {
|
|
|
612
619
|
getCachedLocalEmbeddingPooling,
|
|
613
620
|
preflightLocalEmbeddingPooling,
|
|
614
621
|
getLocalEmbeddingNativeMemoryStats
|
|
615
|
-
} from "./index-
|
|
622
|
+
} from "./index-k50xhjw1.js";
|
|
616
623
|
import {
|
|
617
624
|
withQueryEmbeddingDeadline,
|
|
618
625
|
describeShadowBackfillWriteRefusal2,
|
|
@@ -633,7 +640,7 @@ import {
|
|
|
633
640
|
embedSessionCompartmentChunks2,
|
|
634
641
|
getEmbeddingCoverageStatus2,
|
|
635
642
|
getAutoEmbeddingSessionCoverage2
|
|
636
|
-
} from "./index-
|
|
643
|
+
} from "./index-s8ks5nz4.js";
|
|
637
644
|
import {
|
|
638
645
|
saveEmbeddingIfHashMatches,
|
|
639
646
|
invalidateProject2,
|
|
@@ -659,7 +666,7 @@ import {
|
|
|
659
666
|
readGitFileChangeTimesSince,
|
|
660
667
|
verificationFileExists,
|
|
661
668
|
normalizeVerificationFiles
|
|
662
|
-
} from "./index-
|
|
669
|
+
} from "./index-1bqkqde0.js";
|
|
663
670
|
import {
|
|
664
671
|
computeCueContentHash,
|
|
665
672
|
hasMuralCueColumns,
|
|
@@ -707,13 +714,13 @@ import {
|
|
|
707
714
|
resolveMemoriesByIdsForSearch2,
|
|
708
715
|
unifiedSearch2,
|
|
709
716
|
formatSearchResults2
|
|
710
|
-
} from "./index-
|
|
717
|
+
} from "./index-d0rtbv0f.js";
|
|
711
718
|
import {
|
|
712
719
|
scheduleReconciliation,
|
|
713
720
|
scheduleIncrementalIndex,
|
|
714
721
|
getMessageIndexQueueHeapStats,
|
|
715
722
|
clearSessionTracking
|
|
716
|
-
} from "./index-
|
|
723
|
+
} from "./index-798s7c8s.js";
|
|
717
724
|
import {
|
|
718
725
|
flushIgnoredMessages2,
|
|
719
726
|
clearIgnoredMessages2,
|
|
@@ -723,7 +730,7 @@ import {
|
|
|
723
730
|
import {
|
|
724
731
|
setRecompStarting2,
|
|
725
732
|
setRecompTerminal2
|
|
726
|
-
} from "./index-
|
|
733
|
+
} from "./index-e32b3x4n.js";
|
|
727
734
|
import {
|
|
728
735
|
makeToolCompositeKey,
|
|
729
736
|
searchMessageHistoryOffThread,
|
|
@@ -808,14 +815,14 @@ import {
|
|
|
808
815
|
abortSessionFailClosed2,
|
|
809
816
|
evaluateEmergencyFailClosed2,
|
|
810
817
|
runPostTransformPhase2
|
|
811
|
-
} from "./index-
|
|
818
|
+
} from "./index-gxdc95cp.js";
|
|
812
819
|
import {
|
|
813
820
|
ANNOUNCEMENT_VERSION2,
|
|
814
821
|
ANNOUNCEMENT_FEATURES2,
|
|
815
822
|
ANNOUNCEMENT_FOOTER2,
|
|
816
823
|
markAnnouncementSeen2,
|
|
817
824
|
shouldShowAnnouncement2
|
|
818
|
-
} from "./index-
|
|
825
|
+
} from "./index-2kf73btc.js";
|
|
819
826
|
import {
|
|
820
827
|
resolvePromptContext2
|
|
821
828
|
} from "./index-fmsr7v69.js";
|
|
@@ -826,10 +833,10 @@ import {
|
|
|
826
833
|
} from "./index-70cv85b0.js";
|
|
827
834
|
import {
|
|
828
835
|
readV2ArchiveOffThread2
|
|
829
|
-
} from "./index-
|
|
836
|
+
} from "./index-1pf5qrx4.js";
|
|
830
837
|
import {
|
|
831
838
|
renderSearchArchiveOffThread2
|
|
832
|
-
} from "./index-
|
|
839
|
+
} from "./index-nny4gm06.js";
|
|
833
840
|
import {
|
|
834
841
|
COMPACTION_ENABLED_PATH,
|
|
835
842
|
isDreamerRunnable,
|
|
@@ -850,9 +857,6 @@ import {
|
|
|
850
857
|
piModelRefToCanonical,
|
|
851
858
|
modelRefLookupOrder
|
|
852
859
|
} from "./index-avwt563y.js";
|
|
853
|
-
import {
|
|
854
|
-
canonicalProjectDirectory
|
|
855
|
-
} from "./index-knvkbfvh.js";
|
|
856
860
|
import {
|
|
857
861
|
getErrorMessage,
|
|
858
862
|
describeError
|
|
@@ -865,12 +869,8 @@ import {
|
|
|
865
869
|
logSlowWriteTransaction
|
|
866
870
|
} from "./index-m0pwswv9.js";
|
|
867
871
|
import {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
writeStorageFileAtomicSync,
|
|
871
|
-
writeStorageFileAsync,
|
|
872
|
-
createStorageWriteStream
|
|
873
|
-
} from "./index-fvnzcnww.js";
|
|
872
|
+
canonicalProjectDirectory
|
|
873
|
+
} from "./index-knvkbfvh.js";
|
|
874
874
|
|
|
875
875
|
// src/config/dependency-notes.ts
|
|
876
876
|
function scheduledTasks(config) {
|
|
@@ -16735,7 +16735,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16735
16735
|
return { count: buildCompartmentCount(db, sessionId, moduleStatus) };
|
|
16736
16736
|
});
|
|
16737
16737
|
const buildManagedCtx = async (db) => {
|
|
16738
|
-
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-
|
|
16738
|
+
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-90869322.js"));
|
|
16739
16739
|
const { resolveHistorianModel } = await importPluginModule(() => import("./model-resolution-280gmqvd.js"));
|
|
16740
16740
|
const { userObservationCollectionEnabled, userObservationsRequested } = await importPluginModule(() => import("./task-config-qt6n4bxm.js"));
|
|
16741
16741
|
const DEFAULT_HISTORIAN_TIMEOUT_MS = 10 * 60 * 1000;
|
|
@@ -16787,7 +16787,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16787
16787
|
const db = readDatabase();
|
|
16788
16788
|
if (!db)
|
|
16789
16789
|
return { ok: false, error: "db unavailable" };
|
|
16790
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16790
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-7ecg8ryx.js"));
|
|
16791
16791
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-7x518gew.js"));
|
|
16792
16792
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16793
16793
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -16872,7 +16872,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16872
16872
|
const db = readDatabase();
|
|
16873
16873
|
if (!db)
|
|
16874
16874
|
return { ok: false, error: "db unavailable" };
|
|
16875
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16875
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-nmk6yf7f.js"));
|
|
16876
16876
|
const model = await args.readSelectedSessionModel?.(sessionId) ?? liveSessionState.liveModelBySession.get(sessionId);
|
|
16877
16877
|
const window = resolveOpenCodeWrapupWindow(db, sessionId, model);
|
|
16878
16878
|
if (!window)
|
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
} from "./index-pxnzyvjc.js";
|
|
18
18
|
import {
|
|
19
19
|
LocalEmbeddingProvider
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-k50xhjw1.js";
|
|
21
21
|
import {
|
|
22
22
|
OpenAICompatibleEmbeddingProvider,
|
|
23
23
|
embedTextForProject2
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-s8ks5nz4.js";
|
|
25
25
|
import {
|
|
26
26
|
saveEmbeddingIfHashMatches
|
|
27
27
|
} from "./index-4dhv7mqz.js";
|
|
@@ -780,6 +780,7 @@ async function readGitFileChangeTimesSince(cwd, sinceMs, knownGitRoot) {
|
|
|
780
780
|
}
|
|
781
781
|
return times;
|
|
782
782
|
}
|
|
783
|
+
var TRACKED_FILES_ARGS = ["ls-files", "--recurse-submodules", "-z", "--full-name"];
|
|
783
784
|
async function gitTrackedPath(gitRoot, repoRelativePath) {
|
|
784
785
|
const stdout = await runGit(gitRoot, [
|
|
785
786
|
"ls-files",
|
|
@@ -789,7 +790,7 @@ async function gitTrackedPath(gitRoot, repoRelativePath) {
|
|
|
789
790
|
"--",
|
|
790
791
|
repoRelativePath
|
|
791
792
|
]);
|
|
792
|
-
const fallbackStdout = stdout === null ? await runGit(gitRoot,
|
|
793
|
+
const fallbackStdout = stdout === null ? await runGit(gitRoot, TRACKED_FILES_ARGS) : null;
|
|
793
794
|
if (stdout === null && fallbackStdout === null)
|
|
794
795
|
return null;
|
|
795
796
|
const matches = (stdout ?? fallbackStdout ?? "").split("\x00").filter(Boolean);
|
|
@@ -856,7 +857,7 @@ async function normalizeVerificationFiles(args) {
|
|
|
856
857
|
if (!trackedPaths) {
|
|
857
858
|
let trackedOutput = null;
|
|
858
859
|
try {
|
|
859
|
-
trackedOutput = await runGit(gitRoot,
|
|
860
|
+
trackedOutput = await runGit(gitRoot, TRACKED_FILES_ARGS);
|
|
860
861
|
} catch {}
|
|
861
862
|
trackedPaths = new Set(trackedOutput?.split("\x00").filter(Boolean) ?? []);
|
|
862
863
|
}
|
|
@@ -137,11 +137,11 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
137
137
|
{ createV2RecoveryAttachments }
|
|
138
138
|
] = await Promise.all([
|
|
139
139
|
import("./sqlite-zdgm52sv.js"),
|
|
140
|
-
import("./store-reader-
|
|
141
|
-
import("./store-
|
|
140
|
+
import("./store-reader-nf8z86n9.js"),
|
|
141
|
+
import("./store-n4yz3n66.js"),
|
|
142
142
|
import("./read-session-chunk-6wedfths.js"),
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
143
|
+
import("./render-yqp7q79f.js"),
|
|
144
|
+
import("./search-archive-r4h96j2z.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getCompartments,
|
|
10
10
|
getLastCompartmentEndMessage,
|
|
11
11
|
requestPendingMaterialization
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-w6v4dw5f.js";
|
|
13
13
|
import {
|
|
14
14
|
inRootAsyncContext2
|
|
15
15
|
} from "./index-gzy5w8ya.js";
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
getActiveCompartmentRun,
|
|
36
36
|
markActiveCompartmentRunPublished,
|
|
37
37
|
registerActiveCompartmentRun
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-ttk3trse.js";
|
|
39
39
|
import {
|
|
40
40
|
sendStatusNotification2
|
|
41
41
|
} from "./index-g6hfh4h4.js";
|
|
42
42
|
import {
|
|
43
43
|
setRecompStarting2,
|
|
44
44
|
setRecompTerminal2
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-e32b3x4n.js";
|
|
46
46
|
|
|
47
47
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
48
48
|
import * as crypto from "node:crypto";
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
getMagicContextStorageDir,
|
|
3
3
|
log2
|
|
4
4
|
} from "./index-ywrz4wy2.js";
|
|
5
|
+
import {
|
|
6
|
+
writeStorageFileAtomicSync
|
|
7
|
+
} from "./index-c5tmzym6.js";
|
|
5
8
|
import {
|
|
6
9
|
inRootAsyncContext2
|
|
7
10
|
} from "./index-gzy5w8ya.js";
|
|
8
11
|
import {
|
|
9
12
|
projectDirectoryKey
|
|
10
13
|
} from "./index-knvkbfvh.js";
|
|
11
|
-
import {
|
|
12
|
-
writeStorageFileAtomicSync
|
|
13
|
-
} from "./index-fvnzcnww.js";
|
|
14
14
|
|
|
15
15
|
// src/features/magic-context/memory/project-identity.ts
|
|
16
16
|
import { execFileSync } from "node:child_process";
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isPidAlive
|
|
3
|
+
} from "./index-gqf8r04r.js";
|
|
4
|
+
|
|
1
5
|
// src/shared/storage-permissions.ts
|
|
2
6
|
import { randomBytes } from "node:crypto";
|
|
3
7
|
import {
|
|
4
8
|
chmodSync,
|
|
5
9
|
closeSync,
|
|
10
|
+
constants,
|
|
6
11
|
createWriteStream,
|
|
12
|
+
fstatSync,
|
|
7
13
|
fsyncSync,
|
|
8
14
|
lstatSync,
|
|
9
15
|
mkdirSync,
|
|
@@ -12,16 +18,46 @@ import {
|
|
|
12
18
|
readlinkSync,
|
|
13
19
|
readSync,
|
|
14
20
|
renameSync,
|
|
21
|
+
rmdirSync,
|
|
15
22
|
rmSync,
|
|
16
23
|
symlinkSync,
|
|
17
24
|
writeFileSync,
|
|
18
25
|
writeSync
|
|
19
26
|
} from "node:fs";
|
|
20
27
|
import { open as openAsync, writeFile as writeFileAsync } from "node:fs/promises";
|
|
21
|
-
import { dirname, join } from "node:path";
|
|
28
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
22
29
|
var enforcePrivateStoragePermissions = true;
|
|
30
|
+
var STORAGE_PERMISSIONS_POLICY_VERSION = 1;
|
|
31
|
+
var STORAGE_PERMISSIONS_MARKER = `.storage-permissions-v${STORAGE_PERMISSIONS_POLICY_VERSION}`;
|
|
32
|
+
var STORAGE_PERMISSIONS_MARKER_BYTES = Buffer.from(`${STORAGE_PERMISSIONS_POLICY_VERSION}
|
|
33
|
+
`);
|
|
34
|
+
var STORAGE_PERMISSIONS_MARKER_MAX_AGE_MS = 24 * 60 * 60000;
|
|
35
|
+
var LEGACY_FENCE_TEMP_MIN_AGE_MS = 10 * 60000;
|
|
36
|
+
var storagePermissionRoots = new Set;
|
|
37
|
+
function invalidateStoragePermissionMarkers(directory) {
|
|
38
|
+
for (let current = resolve(directory);; current = dirname(current)) {
|
|
39
|
+
const marker = join(current, STORAGE_PERMISSIONS_MARKER);
|
|
40
|
+
try {
|
|
41
|
+
rmSync(marker, { force: true });
|
|
42
|
+
} catch (error) {
|
|
43
|
+
const stat = lstatSync(marker, { throwIfNoEntry: false });
|
|
44
|
+
if (stat?.isFile() || !stat && error.code !== "EROFS") {
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (storagePermissionRoots.has(current) || dirname(current) === current)
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
23
52
|
function setStoragePrivatePermissionEnforcement(enforce) {
|
|
24
53
|
enforcePrivateStoragePermissions = enforce;
|
|
54
|
+
if (enforce || process.platform === "win32")
|
|
55
|
+
return;
|
|
56
|
+
for (const root of storagePermissionRoots) {
|
|
57
|
+
try {
|
|
58
|
+
rmSync(join(root, STORAGE_PERMISSIONS_MARKER), { force: true });
|
|
59
|
+
} catch {}
|
|
60
|
+
}
|
|
25
61
|
}
|
|
26
62
|
function shouldEnforcePrivateStoragePermissions() {
|
|
27
63
|
return enforcePrivateStoragePermissions;
|
|
@@ -38,8 +74,11 @@ function ensurePrivateStorageDirectorySync(directory) {
|
|
|
38
74
|
const stat = lstatSync(directory);
|
|
39
75
|
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
40
76
|
throw new Error("Private storage directory is not a real directory");
|
|
41
|
-
if (process.platform !== "win32")
|
|
77
|
+
if (process.platform !== "win32") {
|
|
78
|
+
if ((stat.mode & 511) !== 448)
|
|
79
|
+
invalidateStoragePermissionMarkers(directory);
|
|
42
80
|
chmodSync(directory, 448);
|
|
81
|
+
}
|
|
43
82
|
}
|
|
44
83
|
function writeStorageFileSync(filePath, content, options = {}) {
|
|
45
84
|
const { forcePrivate = false, ...writeOptions } = options;
|
|
@@ -68,10 +107,9 @@ function syncStorageDirectorySync(directory) {
|
|
|
68
107
|
closeSync(fd);
|
|
69
108
|
}
|
|
70
109
|
}
|
|
71
|
-
function writeStorageFileDurableAtomicSync(filePath, content, afterTempSync) {
|
|
110
|
+
function writeStorageFileDurableAtomicSync(filePath, content, afterTempSync, tempPath = `${filePath}.${process.pid}.${randomBytes(12).toString("hex")}.tmp`) {
|
|
72
111
|
const directory = dirname(filePath);
|
|
73
112
|
ensurePrivateStorageDirectorySync(directory);
|
|
74
|
-
const tempPath = `${filePath}.${process.pid}.${randomBytes(12).toString("hex")}.tmp`;
|
|
75
113
|
let fd;
|
|
76
114
|
try {
|
|
77
115
|
fd = openStorageFileSync(tempPath, "wx", true);
|
|
@@ -153,24 +191,122 @@ async function createStorageFileHandleAsync(filePath, flags, forcePrivate = fals
|
|
|
153
191
|
const privateMode = forcePrivate || shouldEnforcePrivateStoragePermissions();
|
|
154
192
|
return openAsync(filePath, flags, privateMode ? 384 : undefined);
|
|
155
193
|
}
|
|
156
|
-
function
|
|
157
|
-
|
|
194
|
+
function readStoragePermissionCertificate(marker) {
|
|
195
|
+
const fd = openSync(marker, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
196
|
+
try {
|
|
197
|
+
const stat = fstatSync(fd);
|
|
198
|
+
const age = Date.now() - Math.floor(stat.mtimeMs);
|
|
199
|
+
if (!stat.isFile() || (stat.mode & 4095) !== 384 || stat.uid !== process.getuid?.() || stat.size !== STORAGE_PERMISSIONS_MARKER_BYTES.length || age < 0 || age >= STORAGE_PERMISSIONS_MARKER_MAX_AGE_MS) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const buffer = Buffer.alloc(STORAGE_PERMISSIONS_MARKER_BYTES.length + 1);
|
|
203
|
+
const bytesRead = readSync(fd, buffer, 0, buffer.length, 0);
|
|
204
|
+
if (bytesRead === STORAGE_PERMISSIONS_MARKER_BYTES.length && buffer.subarray(0, bytesRead).equals(STORAGE_PERMISSIONS_MARKER_BYTES)) {
|
|
205
|
+
return stat;
|
|
206
|
+
}
|
|
207
|
+
} finally {
|
|
208
|
+
closeSync(fd);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db")) {
|
|
212
|
+
if (process.platform === "win32") {
|
|
158
213
|
return { tightened: 0, failures: 0 };
|
|
159
214
|
}
|
|
215
|
+
const root = resolve(directory);
|
|
216
|
+
const marker = join(root, STORAGE_PERMISSIONS_MARKER);
|
|
160
217
|
let tightened = 0;
|
|
161
218
|
let failures = 0;
|
|
162
|
-
|
|
163
|
-
|
|
219
|
+
let keptLegacyTemp = false;
|
|
220
|
+
const removeMarker = () => {
|
|
164
221
|
try {
|
|
165
|
-
|
|
222
|
+
rmSync(marker, { force: true });
|
|
223
|
+
return true;
|
|
166
224
|
} catch {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
if (!shouldEnforcePrivateStoragePermissions()) {
|
|
229
|
+
storagePermissionRoots.add(root);
|
|
230
|
+
if (!removeMarker())
|
|
231
|
+
failures++;
|
|
232
|
+
return { tightened, failures };
|
|
233
|
+
}
|
|
234
|
+
let rootStat;
|
|
235
|
+
try {
|
|
236
|
+
rootStat = lstatSync(root);
|
|
237
|
+
if (!rootStat.isDirectory())
|
|
238
|
+
return { tightened, failures: 1 };
|
|
239
|
+
} catch {
|
|
240
|
+
return { tightened, failures: 1 };
|
|
241
|
+
}
|
|
242
|
+
storagePermissionRoots.add(root);
|
|
243
|
+
let certificate;
|
|
244
|
+
let discardMarker = false;
|
|
245
|
+
try {
|
|
246
|
+
certificate = readStoragePermissionCertificate(marker);
|
|
247
|
+
discardMarker = certificate === undefined;
|
|
248
|
+
} catch (error) {
|
|
249
|
+
discardMarker = error.code !== "ENOENT";
|
|
250
|
+
}
|
|
251
|
+
let markerRemoved;
|
|
252
|
+
const fenceDirectory = join(root, "lkg-recovery-fences");
|
|
253
|
+
const visit = (entryPath, recursive = true, optional = false, stat) => {
|
|
254
|
+
try {
|
|
255
|
+
stat ??= lstatSync(entryPath);
|
|
256
|
+
} catch (error) {
|
|
257
|
+
if (!optional || error.code !== "ENOENT")
|
|
258
|
+
failures++;
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (entryPath === root && !stat.isDirectory()) {
|
|
167
262
|
failures++;
|
|
168
263
|
return;
|
|
169
264
|
}
|
|
170
265
|
if (stat.isSymbolicLink())
|
|
171
266
|
return;
|
|
267
|
+
if (entryPath === marker && !stat.isDirectory())
|
|
268
|
+
return;
|
|
269
|
+
if (!certificate && dirname(entryPath) === fenceDirectory) {
|
|
270
|
+
const name = basename(entryPath);
|
|
271
|
+
const legacyTemp = stat.isFile() && /^.+\.json\..+\.tmp$/.test(name);
|
|
272
|
+
if (legacyTemp) {
|
|
273
|
+
const publisherPid = /^.+\.json\.([1-9]\d*)\.[a-f0-9]{24}\.tmp$/.exec(name)?.[1];
|
|
274
|
+
if (Date.now() - stat.mtimeMs <= LEGACY_FENCE_TEMP_MIN_AGE_MS || publisherPid && isPidAlive(Number(publisherPid)) !== "dead") {
|
|
275
|
+
keptLegacyTemp = true;
|
|
276
|
+
} else {
|
|
277
|
+
try {
|
|
278
|
+
rmSync(entryPath, { force: true });
|
|
279
|
+
} catch {
|
|
280
|
+
failures++;
|
|
281
|
+
}
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (stat.isDirectory() && name.endsWith(".json.locks")) {
|
|
286
|
+
try {
|
|
287
|
+
lstatSync(entryPath.slice(0, -".locks".length));
|
|
288
|
+
} catch (error) {
|
|
289
|
+
if (error.code === "ENOENT") {
|
|
290
|
+
try {
|
|
291
|
+
rmdirSync(entryPath);
|
|
292
|
+
return;
|
|
293
|
+
} catch (cleanupError) {
|
|
294
|
+
const code = cleanupError.code;
|
|
295
|
+
if (code === "ENOENT")
|
|
296
|
+
return;
|
|
297
|
+
if (code !== "ENOTEMPTY" && code !== "EEXIST")
|
|
298
|
+
failures++;
|
|
299
|
+
}
|
|
300
|
+
} else
|
|
301
|
+
failures++;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
172
305
|
const mode = stat.isDirectory() ? 448 : 384;
|
|
173
306
|
if ((stat.mode & 63) !== 0 || (stat.mode & 511) !== mode) {
|
|
307
|
+
if (certificate) {
|
|
308
|
+
markerRemoved ??= removeMarker();
|
|
309
|
+
}
|
|
174
310
|
try {
|
|
175
311
|
chmodSync(entryPath, mode);
|
|
176
312
|
tightened++;
|
|
@@ -178,7 +314,7 @@ function tightenStorageTreeSync(root) {
|
|
|
178
314
|
failures++;
|
|
179
315
|
}
|
|
180
316
|
}
|
|
181
|
-
if (!stat.isDirectory())
|
|
317
|
+
if (!recursive || !stat.isDirectory())
|
|
182
318
|
return;
|
|
183
319
|
let entries;
|
|
184
320
|
try {
|
|
@@ -190,7 +326,52 @@ function tightenStorageTreeSync(root) {
|
|
|
190
326
|
for (const entry of entries)
|
|
191
327
|
visit(join(entryPath, entry));
|
|
192
328
|
};
|
|
193
|
-
|
|
329
|
+
if (certificate) {
|
|
330
|
+
visit(root, false, false, rootStat);
|
|
331
|
+
visit(dbPath, false, true);
|
|
332
|
+
visit(`${dbPath}-wal`, false, true);
|
|
333
|
+
visit(`${dbPath}-shm`, false, true);
|
|
334
|
+
visit(join(root, "models"), true, true);
|
|
335
|
+
visit(join(root, "logs"), true, true);
|
|
336
|
+
if (markerRemoved !== undefined) {
|
|
337
|
+
certificate = undefined;
|
|
338
|
+
visit(root);
|
|
339
|
+
if (!markerRemoved && !removeMarker())
|
|
340
|
+
failures++;
|
|
341
|
+
} else if (failures > 0) {
|
|
342
|
+
if (!removeMarker())
|
|
343
|
+
failures++;
|
|
344
|
+
} else {
|
|
345
|
+
let markerChanged;
|
|
346
|
+
try {
|
|
347
|
+
const current = lstatSync(marker);
|
|
348
|
+
markerChanged = current.dev !== certificate.dev || current.ino !== certificate.ino || current.ctimeMs !== certificate.ctimeMs;
|
|
349
|
+
} catch (error) {
|
|
350
|
+
markerChanged = true;
|
|
351
|
+
discardMarker = error.code !== "ENOENT";
|
|
352
|
+
}
|
|
353
|
+
if (markerChanged) {
|
|
354
|
+
certificate = undefined;
|
|
355
|
+
visit(root);
|
|
356
|
+
if (discardMarker && !removeMarker())
|
|
357
|
+
failures++;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
visit(root, true, false, rootStat);
|
|
362
|
+
if (discardMarker && !removeMarker())
|
|
363
|
+
failures++;
|
|
364
|
+
if (failures === 0 && !keptLegacyTemp) {
|
|
365
|
+
try {
|
|
366
|
+
writeStorageFileSync(marker, STORAGE_PERMISSIONS_MARKER_BYTES, {
|
|
367
|
+
flag: "wx"
|
|
368
|
+
});
|
|
369
|
+
} catch (error) {
|
|
370
|
+
if (error.code !== "EEXIST")
|
|
371
|
+
failures++;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
194
375
|
return { tightened, failures };
|
|
195
376
|
}
|
|
196
377
|
|