@cortexkit/opencode-magic-context 0.49.71 → 0.49.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-search-worker.js +3 -3
- package/dist/chunk-embedding-write-worker.js +1 -1
- package/dist/{context-npk0e0aj.js → context-830ksymq.js} +18 -18
- package/dist/{embedding-backfill-sk7agn5v.js → embedding-backfill-exnyad7d.js} +2 -2
- package/dist/features/magic-context/memory/embedding-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +2 -2
- package/dist/features/magic-context/project-embedding-registry.d.ts +1 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/{index-0dbc9rxd.js → index-2m1j98fj.js} +3 -3
- package/dist/{index-fcrp1k8s.js → index-3mx8math.js} +1 -1
- package/dist/{index-d0mb17q4.js → index-64qpnmjb.js} +2 -2
- package/dist/{index-gq1g9a3a.js → index-9swgykdd.js} +4 -3
- package/dist/{index-mxjdj2cz.js → index-bdnak4d0.js} +17 -3
- package/dist/{index-y664y8kq.js → index-cw3j0pwy.js} +1 -1
- package/dist/{index-5hc4kjg0.js → index-etm62gd7.js} +1 -1
- package/dist/{index-51anehwt.js → index-jeckjrh0.js} +13 -13
- package/dist/{index-cdyhpdqx.js → index-q5rcetym.js} +4 -4
- package/dist/index-q9ywd8b2.js +65 -0
- package/dist/{index-gvnt9yka.js → index-sc5segqg.js} +7 -7
- package/dist/{index-n6aye6ny.js → index-ve863q40.js} +98 -2
- package/dist/{index-mejvnav7.js → index-w8sv1v0j.js} +10 -10
- package/dist/{index-mey1nc1v.js → index-xha0yxhy.js} +1 -1
- package/dist/{index-rzxzap49.js → index-y6q5qvdz.js} +5 -5
- package/dist/{index-33bfewqe.js → index-yh7hxjxm.js} +36 -38
- package/dist/{index-fm0bpxc6.js → index-yhz1w3ss.js} +1 -1
- package/dist/{index-n19pqsnh.js → index-zt6d9fag.js} +2 -2
- package/dist/index.js +21 -21
- package/dist/{message-index-bounded-n2j33x8n.js → message-index-bounded-vf70t44t.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/{project-embedding-registry-c2sfnamh.js → project-embedding-registry-n50fbax6.js} +1 -1
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-6kdtfa7k.js → read-session-chunk-9jtq1swq.js} +2 -2
- package/dist/{recomp-orchestrator-t9670x13.js → recomp-orchestrator-sa4f2mkj.js} +10 -10
- package/dist/{render-re3akx9j.js → render-qkjgrg31.js} +6 -6
- package/dist/{search-rppmngr5.js → search-0v2v9yd5.js} +8 -8
- package/dist/{search-archive-0q8rdnrd.js → search-archive-cmfs3myg.js} +4 -4
- package/dist/{storage-tags-rptkad9p.js → storage-tags-d3nqrva7.js} +1 -1
- package/dist/{transform-postprocess-phase-qtd2wr52.js → transform-postprocess-phase-ecrcsc2w.js} +11 -11
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-vehx9ha8.js → context-q846asea.js} +33 -34
- package/dist/v2/{embedding-backfill-j2xj86zn.js → embedding-backfill-jhmn81cz.js} +2 -2
- package/dist/v2/{message-index-bounded-hfnsznj0.js → message-index-bounded-ev9sarf6.js} +3 -3
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/{project-embedding-registry-k0hjqt11.js → project-embedding-registry-07nz4qas.js} +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-qzd376gb.js → read-session-chunk-eb49qfzz.js} +2 -2
- package/dist/v2/{recomp-orchestrator-rrsbcsmc.js → recomp-orchestrator-egbf57qa.js} +9 -9
- package/dist/v2/{render-qwy9ydnb.js → render-47vjswds.js} +6 -6
- package/dist/v2/{search-q3xcyyq8.js → search-03pzsd5w.js} +7 -7
- package/dist/v2/{search-archive-gewpafej.js → search-archive-3tpaqkg4.js} +4 -4
- package/dist/v2/{server-ssdfdrpv.js → server-3jggqcpa.js} +12 -12
- package/dist/v2/{server-xxy28mq5.js → server-4nh02tdw.js} +2 -2
- package/dist/v2/{server-fczyr89c.js → server-ar3awhcy.js} +11 -11
- package/dist/v2/{server-vzrj39bj.js → server-canf6f29.js} +1 -1
- package/dist/v2/{server-vqkqv7ze.js → server-cxkb9725.js} +17 -3
- package/dist/v2/{server-07z334y6.js → server-d0ec5f7b.js} +1 -1
- package/dist/v2/{server-axmk8rr2.js → server-k8mj4ccb.js} +1 -1
- package/dist/v2/{server-d07yxksx.js → server-ndkzagjz.js} +98 -2
- package/dist/v2/server-rd7v8c8y.js +65 -0
- package/dist/v2/{server-nc4qrjde.js → server-rpdbmk63.js} +1 -1
- package/dist/v2/{server-0c7egkzr.js → server-sk08dem3.js} +2 -2
- package/dist/v2/{server-z5255w05.js → server-t091cjj4.js} +4 -3
- package/dist/v2/{server-h8y2948e.js → server-wb00e7b0.js} +3 -3
- package/dist/v2/server.js +2 -2
- package/dist/v2/{storage-tags-msa1qvk8.js → storage-tags-j4he6hwe.js} +1 -1
- package/dist/v2/{v2-archive-reader-nwaw9qph.js → v2-archive-reader-x1yvzqs8.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-xyd3r2t1.js → wrapup-orchestrator-5bccsgy0.js} +9 -9
- package/dist/{v2-archive-reader-dv00gb2a.js → v2-archive-reader-xnnwexnw.js} +1 -1
- package/dist/{wrapup-orchestrator-fzygp85w.js → wrapup-orchestrator-yrpqmwc7.js} +11 -11
- package/package.json +1 -1
- package/dist/index-zxj39ba2.js +0 -155
- package/dist/v2/server-d9aayyxk.js +0 -155
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
rawMessageWorkerSource2,
|
|
20
20
|
rawMessageOffThreadRangeReader2,
|
|
21
21
|
readRawSessionMessageIdOrdinalsForRange2
|
|
22
|
-
} from "./server-
|
|
22
|
+
} from "./server-k8mj4ccb.js";
|
|
23
23
|
import {
|
|
24
24
|
readV2ArchiveOffThread2
|
|
25
|
-
} from "./server-
|
|
25
|
+
} from "./server-wb00e7b0.js";
|
|
26
26
|
|
|
27
27
|
// src/tools/ctx-expand/search-archive.ts
|
|
28
28
|
var archiveReadsOnThisThread = 0;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./server-afsz3cmx.js";
|
|
16
16
|
import {
|
|
17
17
|
isRecord
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-cxkb9725.js";
|
|
19
19
|
import {
|
|
20
20
|
cleanSearchText,
|
|
21
21
|
hintKeywordRelevance,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isMessageIndexReconciledThrough,
|
|
26
26
|
clearIndexedMessages,
|
|
27
27
|
indexMessagesAfterOrdinal
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-d0ec5f7b.js";
|
|
29
29
|
import {
|
|
30
30
|
Priority,
|
|
31
31
|
AdmissionClass,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
enqueueShadowEmbeddingItems2,
|
|
57
57
|
getProjectEmbeddingSnapshot2,
|
|
58
58
|
embedItemsForProject2
|
|
59
|
-
} from "./server-
|
|
59
|
+
} from "./server-t091cjj4.js";
|
|
60
60
|
import {
|
|
61
61
|
recordEmbeddingMeasurement
|
|
62
62
|
} from "./server-2amn2s73.js";
|
|
@@ -64,11 +64,15 @@ import {
|
|
|
64
64
|
getProjectEmbeddings2
|
|
65
65
|
} from "./server-4dhv7mqz.js";
|
|
66
66
|
import {
|
|
67
|
+
USER_FACING_FAILURES,
|
|
67
68
|
cosineSimilarity,
|
|
68
69
|
isEmbeddingEnabled,
|
|
69
70
|
embedText,
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
relaxedFtsQuery,
|
|
72
|
+
sanitizeFtsQuery,
|
|
73
|
+
searchMemoriesFTS,
|
|
74
|
+
searchMemoriesFTSUnion
|
|
75
|
+
} from "./server-ndkzagjz.js";
|
|
72
76
|
import {
|
|
73
77
|
ModuleMemoryAuthorityError2,
|
|
74
78
|
getMemoriesByProject2,
|
|
@@ -76,12 +80,8 @@ import {
|
|
|
76
80
|
updateMemoryRetrievalCount2
|
|
77
81
|
} from "./server-jjvbk92s.js";
|
|
78
82
|
import {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
sanitizeFtsQuery,
|
|
82
|
-
searchMemoriesFTS,
|
|
83
|
-
searchMemoriesFTSUnion
|
|
84
|
-
} from "./server-d07yxksx.js";
|
|
83
|
+
ensureMemoryEmbeddings2
|
|
84
|
+
} from "./server-rd7v8c8y.js";
|
|
85
85
|
import {
|
|
86
86
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
87
87
|
withMessageFtsSessionFilter
|
|
@@ -5358,16 +5358,30 @@ function neutralizedReasoningSource(part) {
|
|
|
5358
5358
|
return isRecord(part) ? NEUTRALIZED_ORIGINALS.get(part) ?? part : part;
|
|
5359
5359
|
}
|
|
5360
5360
|
var VARIANT_CACHE_PRESERVING_MODELS = {
|
|
5361
|
-
"anthropic/claude-fable-5-1": "2026-09-02",
|
|
5362
|
-
"openai/gpt-6-astra": "2026-09-05",
|
|
5363
|
-
"anthropic/claude-opus-5-5": "2026-09-23"
|
|
5361
|
+
"anthropic/claude-fable-5-1": ["2026-09-02"],
|
|
5362
|
+
"openai/gpt-6-astra": ["2026-09-05"],
|
|
5363
|
+
"anthropic/claude-opus-5-5": ["2026-09-23", true],
|
|
5364
|
+
"anthropic/claude-sonnet-5-5": ["2026-11-23", true],
|
|
5365
|
+
"anthropic/claude-haiku-5-5": ["2026-11-23", true],
|
|
5366
|
+
"anthropic/claude-fable-5-2": ["2026-11-23", true],
|
|
5367
|
+
"anthropic/claude-mythos-5-1": ["2026-11-23", true],
|
|
5368
|
+
"anthropic/claude-mythos-5-2": ["2026-11-23", true]
|
|
5364
5369
|
};
|
|
5370
|
+
var CLAUDE_VARIANT_ALIAS = /^(?:(?:[a-z0-9-]+\.)?anthropic\.)?(?:claude-)?([a-z]+)[-_.]?([0-9]+)[-_.]([0-9]+)(?:[-@][0-9]{8})?(?:-v[0-9]+:[0-9]+)?$/i;
|
|
5365
5371
|
function canonicalVariantModelIdentity(providerID, modelID) {
|
|
5366
5372
|
const normalizedProviderID = providerID.toLowerCase();
|
|
5367
5373
|
const isAnthropicFamily = normalizedProviderID === "anthropic" || normalizedProviderID === "google-vertex-anthropic" || normalizedProviderID.includes("bedrock");
|
|
5368
5374
|
if (isAnthropicFamily && isFable51ThinkingBindingModel("anthropic", modelID)) {
|
|
5369
5375
|
return "anthropic/claude-fable-5-1";
|
|
5370
5376
|
}
|
|
5377
|
+
if (isAnthropicFamily) {
|
|
5378
|
+
const alias = CLAUDE_VARIANT_ALIAS.exec(modelID.split("/").at(-1) ?? "");
|
|
5379
|
+
if (alias) {
|
|
5380
|
+
const identity = `anthropic/claude-${alias[1].toLowerCase()}-${alias[2]}-${alias[3]}`;
|
|
5381
|
+
if (VARIANT_CACHE_PRESERVING_MODELS[identity]?.[1])
|
|
5382
|
+
return identity;
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5371
5385
|
return canonicalModelIdentity(`${providerID}/${modelID}`).toLowerCase();
|
|
5372
5386
|
}
|
|
5373
5387
|
function variantChangeBustsProviderCache(providerID, modelID) {
|
|
@@ -5,12 +5,23 @@ import {
|
|
|
5
5
|
PROMOTABLE_CATEGORIES,
|
|
6
6
|
CATEGORY_DEFAULT_TTL
|
|
7
7
|
} from "./server-fr0wbhdn.js";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
10
|
+
} from "./server-rz6g5xne.js";
|
|
8
11
|
import {
|
|
9
12
|
sessionLog2
|
|
10
13
|
} from "./server-j8376q08.js";
|
|
11
14
|
import {
|
|
15
|
+
isSynapseEmbeddingTruncated,
|
|
16
|
+
SynapseEmbeddingProvider
|
|
17
|
+
} from "./server-x6fn9x8q.js";
|
|
18
|
+
import {
|
|
19
|
+
LocalEmbeddingProvider
|
|
20
|
+
} from "./server-d706s5xn.js";
|
|
21
|
+
import {
|
|
22
|
+
OpenAICompatibleEmbeddingProvider,
|
|
12
23
|
embedTextForProject2
|
|
13
|
-
} from "./server-
|
|
24
|
+
} from "./server-t091cjj4.js";
|
|
14
25
|
import {
|
|
15
26
|
saveEmbeddingIfHashMatches
|
|
16
27
|
} from "./server-4dhv7mqz.js";
|
|
@@ -358,6 +369,91 @@ function dreamFailureCode(failureClass) {
|
|
|
358
369
|
function renderEmbeddingFailure(failureClass, style = "markdown") {
|
|
359
370
|
return renderUserFacingFailure(EMBEDDING_FAILURE_KEYS[failureClass], style);
|
|
360
371
|
}
|
|
372
|
+
// src/features/magic-context/memory/cosine-similarity.ts
|
|
373
|
+
function cosineSimilarity(a, b) {
|
|
374
|
+
if (a.length !== b.length) {
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
377
|
+
let dotProduct = 0;
|
|
378
|
+
let normA = 0;
|
|
379
|
+
let normB = 0;
|
|
380
|
+
for (let index = 0;index < a.length; index++) {
|
|
381
|
+
dotProduct += a[index] * b[index];
|
|
382
|
+
normA += a[index] * a[index];
|
|
383
|
+
normB += b[index] * b[index];
|
|
384
|
+
}
|
|
385
|
+
const denominator = Math.sqrt(normA) * Math.sqrt(normB);
|
|
386
|
+
return denominator === 0 ? 0 : dotProduct / denominator;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// src/features/magic-context/memory/embedding.ts
|
|
390
|
+
var DEFAULT_EMBEDDING_CONFIG = {
|
|
391
|
+
provider: "local",
|
|
392
|
+
model: DEFAULT_LOCAL_EMBEDDING_MODEL,
|
|
393
|
+
local_runtime: "auto"
|
|
394
|
+
};
|
|
395
|
+
var embeddingConfig = DEFAULT_EMBEDDING_CONFIG;
|
|
396
|
+
var provider = null;
|
|
397
|
+
function createProvider(config) {
|
|
398
|
+
if (config.provider === "off") {
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
if (config.provider === "openai-compatible") {
|
|
402
|
+
return new OpenAICompatibleEmbeddingProvider({
|
|
403
|
+
endpoint: config.endpoint,
|
|
404
|
+
model: config.model,
|
|
405
|
+
apiKey: config.api_key,
|
|
406
|
+
inputType: config.input_type,
|
|
407
|
+
queryInputType: config.query_input_type,
|
|
408
|
+
queryInstruction: config.query_instruction,
|
|
409
|
+
documentPrefix: config.document_prefix,
|
|
410
|
+
truncate: config.truncate,
|
|
411
|
+
dimensions: config.dimensions,
|
|
412
|
+
maxInputTokens: config.max_input_tokens
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
if (config.provider === "local") {
|
|
416
|
+
return new LocalEmbeddingProvider(config.model, config.max_input_tokens, config.local_dtype, config.local_runtime);
|
|
417
|
+
}
|
|
418
|
+
if (config.provider === "synapse") {
|
|
419
|
+
const synapse = config;
|
|
420
|
+
return new SynapseEmbeddingProvider({
|
|
421
|
+
connectionFile: synapse.synapse_connection_file ?? "",
|
|
422
|
+
projectRoot: "",
|
|
423
|
+
session: "embedding",
|
|
424
|
+
model: synapse.model,
|
|
425
|
+
fingerprint: synapse.synapse_fingerprint,
|
|
426
|
+
tableEpoch: synapse.synapse_table_epoch,
|
|
427
|
+
dims: synapse.synapse_dims,
|
|
428
|
+
recommendedBatch: synapse.synapse_recommended_batch,
|
|
429
|
+
recommendedTokenBudget: synapse.synapse_recommended_token_budget,
|
|
430
|
+
descriptor: synapse.synapse_descriptor,
|
|
431
|
+
provenance: synapse.synapse_provenance
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
throw new Error("Unknown embedding provider");
|
|
435
|
+
}
|
|
436
|
+
function getOrCreateProvider() {
|
|
437
|
+
if (provider) {
|
|
438
|
+
return provider;
|
|
439
|
+
}
|
|
440
|
+
provider = createProvider(embeddingConfig);
|
|
441
|
+
return provider;
|
|
442
|
+
}
|
|
443
|
+
function isEmbeddingEnabled() {
|
|
444
|
+
return embeddingConfig.provider !== "off";
|
|
445
|
+
}
|
|
446
|
+
async function embedText(text, signal) {
|
|
447
|
+
const currentProvider = getOrCreateProvider();
|
|
448
|
+
if (!currentProvider) {
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
if (!await currentProvider.initialize()) {
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
const vector = await currentProvider.embed(text, signal);
|
|
455
|
+
return vector && !isSynapseEmbeddingTruncated(vector) ? vector : null;
|
|
456
|
+
}
|
|
361
457
|
// src/features/magic-context/memory/promotion.ts
|
|
362
458
|
function isPromotableCategory(category) {
|
|
363
459
|
return PROMOTABLE_CATEGORIES.some((promotableCategory) => promotableCategory === category);
|
|
@@ -788,4 +884,4 @@ async function normalizeVerificationFiles(args) {
|
|
|
788
884
|
gitRoot
|
|
789
885
|
};
|
|
790
886
|
}
|
|
791
|
-
export { USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, promoteSessionFactsDurable, embedPromotedFacts, relaxedFtsQuery, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles };
|
|
887
|
+
export { USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, cosineSimilarity, isEmbeddingEnabled, embedText, promoteSessionFactsDurable, embedPromotedFacts, relaxedFtsQuery, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isEmbeddingHostBusy2
|
|
3
|
+
} from "./server-qt1qqasc.js";
|
|
4
|
+
import {
|
|
5
|
+
log2
|
|
6
|
+
} from "./server-j8376q08.js";
|
|
7
|
+
import {
|
|
8
|
+
contentSha2562,
|
|
9
|
+
getProjectEmbeddingSnapshot2,
|
|
10
|
+
embedItemsWindowBounded2
|
|
11
|
+
} from "./server-t091cjj4.js";
|
|
12
|
+
import {
|
|
13
|
+
saveEmbeddingIfHashMatches
|
|
14
|
+
} from "./server-4dhv7mqz.js";
|
|
15
|
+
|
|
16
|
+
// src/features/magic-context/memory/embedding-backfill.ts
|
|
17
|
+
var SEARCH_BACKFILL_LIMIT = 50;
|
|
18
|
+
var SEARCH_BACKFILL_REQUEST_SIZE = 10;
|
|
19
|
+
async function ensureMemoryEmbeddings2(args) {
|
|
20
|
+
if (isEmbeddingHostBusy2())
|
|
21
|
+
return args.existingEmbeddings;
|
|
22
|
+
const snapshot = getProjectEmbeddingSnapshot2(args.projectIdentity);
|
|
23
|
+
if (!snapshot?.enabled) {
|
|
24
|
+
return args.existingEmbeddings;
|
|
25
|
+
}
|
|
26
|
+
const missingMemories = args.memories.filter((memory) => !args.existingEmbeddings.has(memory.id)).sort((a, b) => a.id - b.id).slice(0, SEARCH_BACKFILL_LIMIT);
|
|
27
|
+
if (missingMemories.length === 0) {
|
|
28
|
+
return args.existingEmbeddings;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const result = await embedItemsWindowBounded2(args.projectIdentity, missingMemories.map((memory) => ({
|
|
32
|
+
id: `memory:${memory.id}`,
|
|
33
|
+
text: memory.content,
|
|
34
|
+
contentSha256: contentSha2562(memory.content)
|
|
35
|
+
})), undefined, args.db, args.projectIdentity, { maxItemsPerCall: SEARCH_BACKFILL_REQUEST_SIZE });
|
|
36
|
+
if (!result) {
|
|
37
|
+
return args.existingEmbeddings;
|
|
38
|
+
}
|
|
39
|
+
const staged = new Map;
|
|
40
|
+
args.db.transaction(() => {
|
|
41
|
+
for (const memory of missingMemories) {
|
|
42
|
+
const embedding = result.vectors.get(`memory:${memory.id}`);
|
|
43
|
+
if (!embedding) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const saved = saveEmbeddingIfHashMatches(args.db, memory.id, embedding, result.modelId, memory.normalizedHash);
|
|
47
|
+
if (saved) {
|
|
48
|
+
staged.set(memory.id, { embedding, modelId: result.modelId });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}).immediate();
|
|
52
|
+
const currentSnapshot = getProjectEmbeddingSnapshot2(args.projectIdentity);
|
|
53
|
+
if (!currentSnapshot || currentSnapshot.generation !== result.generation) {
|
|
54
|
+
return args.existingEmbeddings;
|
|
55
|
+
}
|
|
56
|
+
for (const [id, embedding] of staged) {
|
|
57
|
+
args.existingEmbeddings.set(id, embedding);
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
log2("[magic-context] failed to backfill memory embeddings:", error);
|
|
61
|
+
}
|
|
62
|
+
return args.existingEmbeddings;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { ensureMemoryEmbeddings2 };
|
|
@@ -1021,7 +1021,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1021
1021
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
1022
1022
|
if (signal.aborted || !readsOpenCodeStore)
|
|
1023
1023
|
return;
|
|
1024
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1024
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-eb49qfzz.js"));
|
|
1025
1025
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-ynb3vg6r.js"));
|
|
1026
1026
|
if (signal.aborted)
|
|
1027
1027
|
return;
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./server-y8xjr8rx.js";
|
|
4
4
|
import {
|
|
5
5
|
getTagById2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-cxkb9725.js";
|
|
7
7
|
import {
|
|
8
8
|
expandToolPart,
|
|
9
9
|
visitRawSessionMessages2,
|
|
10
10
|
readRawSessionMessageById2
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-k8mj4ccb.js";
|
|
12
12
|
|
|
13
13
|
// src/tools/ctx-expand/render.ts
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
@@ -2574,14 +2574,15 @@ async function embedItemsForProject2(projectIdentity, items, signal, db, session
|
|
|
2574
2574
|
return { vectors, modelId, generation };
|
|
2575
2575
|
}
|
|
2576
2576
|
async function embedItemsWindowBounded2(projectIdentity, items, signal, db, sessionId = projectIdentity, options = {}) {
|
|
2577
|
-
|
|
2577
|
+
const maxItemsPerCall = options.maxItemsPerCall ?? MAX_WINDOWS_PER_EMBED_CALL;
|
|
2578
|
+
if (items.length <= maxItemsPerCall) {
|
|
2578
2579
|
return embedItemsForProject2(projectIdentity, items, signal, db, sessionId);
|
|
2579
2580
|
}
|
|
2580
2581
|
const vectors = new Map;
|
|
2581
2582
|
let modelId = null;
|
|
2582
2583
|
let generation = null;
|
|
2583
|
-
for (let start = 0;start < items.length; start +=
|
|
2584
|
-
const slice = items.slice(start, start +
|
|
2584
|
+
for (let start = 0;start < items.length; start += maxItemsPerCall) {
|
|
2585
|
+
const slice = items.slice(start, start + maxItemsPerCall);
|
|
2585
2586
|
const result = await embedItemsForProject2(projectIdentity, slice, signal, db, sessionId);
|
|
2586
2587
|
if (!result)
|
|
2587
2588
|
return null;
|
|
@@ -139,9 +139,9 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
139
139
|
import("./sqlite-zdgm52sv.js"),
|
|
140
140
|
import("./store-reader-yaxtdy6f.js"),
|
|
141
141
|
import("./store-4se2a0n0.js"),
|
|
142
|
-
import("./read-session-chunk-
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
142
|
+
import("./read-session-chunk-eb49qfzz.js"),
|
|
143
|
+
import("./render-47vjswds.js"),
|
|
144
|
+
import("./search-archive-3tpaqkg4.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
package/dist/v2/server.js
CHANGED
|
@@ -7875,7 +7875,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
7875
7875
|
// package.json
|
|
7876
7876
|
var package_default = {
|
|
7877
7877
|
name: "@cortexkit/opencode-magic-context",
|
|
7878
|
-
version: "0.49.
|
|
7878
|
+
version: "0.49.72",
|
|
7879
7879
|
type: "module",
|
|
7880
7880
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
7881
7881
|
main: "dist/index.js",
|
|
@@ -8196,7 +8196,7 @@ async function setup(context) {
|
|
|
8196
8196
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
8197
8197
|
log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
|
|
8198
8198
|
}
|
|
8199
|
-
const { registerContext } = await import("./context-
|
|
8199
|
+
const { registerContext } = await import("./context-q846asea.js");
|
|
8200
8200
|
setHarness2("opencode2");
|
|
8201
8201
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
8202
8202
|
const duties = await registerContext(context);
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
releaseCompartmentLeaseBestEffort,
|
|
12
12
|
getCompartments,
|
|
13
13
|
getLastCompartmentEndMessage
|
|
14
|
-
} from "./server-
|
|
14
|
+
} from "./server-canf6f29.js";
|
|
15
15
|
import"./server-2amn2s73.js";
|
|
16
16
|
import"./server-y8xjr8rx.js";
|
|
17
17
|
import"./server-x6fn9x8q.js";
|
|
@@ -24,7 +24,7 @@ import"./server-1d042x6w.js";
|
|
|
24
24
|
import"./server-6ash6z8z.js";
|
|
25
25
|
import"./server-ds8vpfkr.js";
|
|
26
26
|
import"./server-8pdfmc27.js";
|
|
27
|
-
import"./server-
|
|
27
|
+
import"./server-d0ec5f7b.js";
|
|
28
28
|
import {
|
|
29
29
|
getWrapupInProgressState,
|
|
30
30
|
acquireWrapupInProgress,
|
|
@@ -32,16 +32,16 @@ import {
|
|
|
32
32
|
releaseWrapupInProgress,
|
|
33
33
|
getHistorianFailureState,
|
|
34
34
|
clearEmergencyRecovery
|
|
35
|
-
} from "./server-
|
|
35
|
+
} from "./server-cxkb9725.js";
|
|
36
36
|
import"./server-xepx8t43.js";
|
|
37
|
-
import"./server-
|
|
37
|
+
import"./server-rpdbmk63.js";
|
|
38
38
|
import"./server-1zx87sdm.js";
|
|
39
39
|
import"./server-rz6g5xne.js";
|
|
40
40
|
import"./server-2ra6pwf3.js";
|
|
41
41
|
import"./server-3ap5dmhc.js";
|
|
42
42
|
import {
|
|
43
43
|
prepareRawSessionOrdinals2
|
|
44
|
-
} from "./server-
|
|
44
|
+
} from "./server-k8mj4ccb.js";
|
|
45
45
|
import"./server-fr0wbhdn.js";
|
|
46
46
|
import"./server-jn4pktdk.js";
|
|
47
47
|
import"./server-afsz3cmx.js";
|
|
@@ -63,15 +63,15 @@ import {
|
|
|
63
63
|
registerActiveCompartmentRun,
|
|
64
64
|
setRecompStarting2,
|
|
65
65
|
setRecompTerminal2
|
|
66
|
-
} from "./server-
|
|
66
|
+
} from "./server-3jggqcpa.js";
|
|
67
67
|
import"./server-qt1qqasc.js";
|
|
68
|
-
import"./server-
|
|
68
|
+
import"./server-t091cjj4.js";
|
|
69
69
|
import"./server-jtq03rkb.js";
|
|
70
70
|
import"./server-4dhv7mqz.js";
|
|
71
71
|
import"./server-d706s5xn.js";
|
|
72
|
-
import"./server-
|
|
72
|
+
import"./server-ndkzagjz.js";
|
|
73
|
+
import"./server-rd7v8c8y.js";
|
|
73
74
|
import"./server-jjvbk92s.js";
|
|
74
|
-
import"./server-d07yxksx.js";
|
|
75
75
|
import"./server-9sf3qp02.js";
|
|
76
76
|
import"./server-2adwe0be.js";
|
|
77
77
|
import"./server-aewxmvnf.js";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runManagedWrapup2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
3
|
+
} from "./index-y6q5qvdz.js";
|
|
4
|
+
import"./index-q5rcetym.js";
|
|
5
|
+
import"./index-sc5segqg.js";
|
|
6
6
|
import"./index-832w615x.js";
|
|
7
7
|
import"./index-sd3egckz.js";
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
8
|
+
import"./index-ve863q40.js";
|
|
9
|
+
import"./index-q9ywd8b2.js";
|
|
10
10
|
import"./index-jjvbk92s.js";
|
|
11
|
-
import"./index-
|
|
11
|
+
import"./index-9swgykdd.js";
|
|
12
12
|
import"./index-4dhv7mqz.js";
|
|
13
|
-
import"./index-
|
|
13
|
+
import"./index-cw3j0pwy.js";
|
|
14
14
|
import"./index-tebcx987.js";
|
|
15
|
-
import"./index-
|
|
15
|
+
import"./index-etm62gd7.js";
|
|
16
16
|
import"./index-2amn2s73.js";
|
|
17
17
|
import"./index-6athgjba.js";
|
|
18
18
|
import"./index-ngwmx6nt.js";
|
|
19
19
|
import"./index-1sq1krqw.js";
|
|
20
20
|
import"./index-qt1qqasc.js";
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
21
|
+
import"./index-yhz1w3ss.js";
|
|
22
|
+
import"./index-bdnak4d0.js";
|
|
23
23
|
import"./index-1zx87sdm.js";
|
|
24
24
|
import"./index-x40zr813.js";
|
|
25
25
|
import"./index-x8a7jmkh.js";
|
|
@@ -29,7 +29,7 @@ import"./index-6nqz8hsz.js";
|
|
|
29
29
|
import"./index-jg7sbt3v.js";
|
|
30
30
|
import"./index-snbpdpa3.js";
|
|
31
31
|
import"./index-pxnzyvjc.js";
|
|
32
|
-
import"./index-
|
|
32
|
+
import"./index-3mx8math.js";
|
|
33
33
|
import"./index-fb3zxn06.js";
|
|
34
34
|
import"./index-xx05vta0.js";
|
|
35
35
|
import"./index-fr0wbhdn.js";
|
package/package.json
CHANGED