@cortexkit/opencode-magic-context 0.49.70 → 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-rcts8w54.js → context-830ksymq.js} +18 -18
- package/dist/{embedding-backfill-sk7agn5v.js → embedding-backfill-exnyad7d.js} +2 -2
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts +10 -2
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
- 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-95475ngp.js → index-yh7hxjxm.js} +191 -121
- 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-wv122q62.js → context-q846asea.js} +188 -117
- 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
|
@@ -5,12 +5,23 @@ import {
|
|
|
5
5
|
PROMOTABLE_CATEGORIES,
|
|
6
6
|
CATEGORY_DEFAULT_TTL
|
|
7
7
|
} from "./index-fr0wbhdn.js";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
10
|
+
} from "./index-6nqz8hsz.js";
|
|
8
11
|
import {
|
|
9
12
|
sessionLog2
|
|
10
13
|
} from "./index-ywrz4wy2.js";
|
|
11
14
|
import {
|
|
15
|
+
isSynapseEmbeddingTruncated,
|
|
16
|
+
SynapseEmbeddingProvider
|
|
17
|
+
} from "./index-pxnzyvjc.js";
|
|
18
|
+
import {
|
|
19
|
+
LocalEmbeddingProvider
|
|
20
|
+
} from "./index-zb4h9nrk.js";
|
|
21
|
+
import {
|
|
22
|
+
OpenAICompatibleEmbeddingProvider,
|
|
12
23
|
embedTextForProject2
|
|
13
|
-
} from "./index-
|
|
24
|
+
} from "./index-9swgykdd.js";
|
|
14
25
|
import {
|
|
15
26
|
saveEmbeddingIfHashMatches
|
|
16
27
|
} from "./index-4dhv7mqz.js";
|
|
@@ -361,6 +372,91 @@ function dreamFailureCode(failureClass) {
|
|
|
361
372
|
function renderEmbeddingFailure(failureClass, style = "markdown") {
|
|
362
373
|
return renderUserFacingFailure(EMBEDDING_FAILURE_KEYS[failureClass], style);
|
|
363
374
|
}
|
|
375
|
+
// src/features/magic-context/memory/cosine-similarity.ts
|
|
376
|
+
function cosineSimilarity(a, b) {
|
|
377
|
+
if (a.length !== b.length) {
|
|
378
|
+
return 0;
|
|
379
|
+
}
|
|
380
|
+
let dotProduct = 0;
|
|
381
|
+
let normA = 0;
|
|
382
|
+
let normB = 0;
|
|
383
|
+
for (let index = 0;index < a.length; index++) {
|
|
384
|
+
dotProduct += a[index] * b[index];
|
|
385
|
+
normA += a[index] * a[index];
|
|
386
|
+
normB += b[index] * b[index];
|
|
387
|
+
}
|
|
388
|
+
const denominator = Math.sqrt(normA) * Math.sqrt(normB);
|
|
389
|
+
return denominator === 0 ? 0 : dotProduct / denominator;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// src/features/magic-context/memory/embedding.ts
|
|
393
|
+
var DEFAULT_EMBEDDING_CONFIG = {
|
|
394
|
+
provider: "local",
|
|
395
|
+
model: DEFAULT_LOCAL_EMBEDDING_MODEL,
|
|
396
|
+
local_runtime: "auto"
|
|
397
|
+
};
|
|
398
|
+
var embeddingConfig = DEFAULT_EMBEDDING_CONFIG;
|
|
399
|
+
var provider = null;
|
|
400
|
+
function createProvider(config) {
|
|
401
|
+
if (config.provider === "off") {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
if (config.provider === "openai-compatible") {
|
|
405
|
+
return new OpenAICompatibleEmbeddingProvider({
|
|
406
|
+
endpoint: config.endpoint,
|
|
407
|
+
model: config.model,
|
|
408
|
+
apiKey: config.api_key,
|
|
409
|
+
inputType: config.input_type,
|
|
410
|
+
queryInputType: config.query_input_type,
|
|
411
|
+
queryInstruction: config.query_instruction,
|
|
412
|
+
documentPrefix: config.document_prefix,
|
|
413
|
+
truncate: config.truncate,
|
|
414
|
+
dimensions: config.dimensions,
|
|
415
|
+
maxInputTokens: config.max_input_tokens
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
if (config.provider === "local") {
|
|
419
|
+
return new LocalEmbeddingProvider(config.model, config.max_input_tokens, config.local_dtype, config.local_runtime);
|
|
420
|
+
}
|
|
421
|
+
if (config.provider === "synapse") {
|
|
422
|
+
const synapse = config;
|
|
423
|
+
return new SynapseEmbeddingProvider({
|
|
424
|
+
connectionFile: synapse.synapse_connection_file ?? "",
|
|
425
|
+
projectRoot: "",
|
|
426
|
+
session: "embedding",
|
|
427
|
+
model: synapse.model,
|
|
428
|
+
fingerprint: synapse.synapse_fingerprint,
|
|
429
|
+
tableEpoch: synapse.synapse_table_epoch,
|
|
430
|
+
dims: synapse.synapse_dims,
|
|
431
|
+
recommendedBatch: synapse.synapse_recommended_batch,
|
|
432
|
+
recommendedTokenBudget: synapse.synapse_recommended_token_budget,
|
|
433
|
+
descriptor: synapse.synapse_descriptor,
|
|
434
|
+
provenance: synapse.synapse_provenance
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
throw new Error("Unknown embedding provider");
|
|
438
|
+
}
|
|
439
|
+
function getOrCreateProvider() {
|
|
440
|
+
if (provider) {
|
|
441
|
+
return provider;
|
|
442
|
+
}
|
|
443
|
+
provider = createProvider(embeddingConfig);
|
|
444
|
+
return provider;
|
|
445
|
+
}
|
|
446
|
+
function isEmbeddingEnabled() {
|
|
447
|
+
return embeddingConfig.provider !== "off";
|
|
448
|
+
}
|
|
449
|
+
async function embedText(text, signal) {
|
|
450
|
+
const currentProvider = getOrCreateProvider();
|
|
451
|
+
if (!currentProvider) {
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
if (!await currentProvider.initialize()) {
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
const vector = await currentProvider.embed(text, signal);
|
|
458
|
+
return vector && !isSynapseEmbeddingTruncated(vector) ? vector : null;
|
|
459
|
+
}
|
|
364
460
|
// src/features/magic-context/memory/promotion.ts
|
|
365
461
|
function isPromotableCategory(category) {
|
|
366
462
|
return PROMOTABLE_CATEGORIES.some((promotableCategory) => promotableCategory === category);
|
|
@@ -791,4 +887,4 @@ async function normalizeVerificationFiles(args) {
|
|
|
791
887
|
gitRoot
|
|
792
888
|
};
|
|
793
889
|
}
|
|
794
|
-
export { USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, capabilityRefusalCode, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, promoteSessionFactsDurable, embedPromotedFacts, relaxedFtsQuery, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles };
|
|
890
|
+
export { USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, capabilityRefusalCode, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, cosineSimilarity, isEmbeddingEnabled, embedText, promoteSessionFactsDurable, embedPromotedFacts, relaxedFtsQuery, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles };
|
|
@@ -171,7 +171,7 @@ import {
|
|
|
171
171
|
adoptNullOwnerToolTag2,
|
|
172
172
|
getCandidateToolOwners2,
|
|
173
173
|
pickNearestPriorOwner2
|
|
174
|
-
} from "./index-
|
|
174
|
+
} from "./index-bdnak4d0.js";
|
|
175
175
|
import {
|
|
176
176
|
textMentionsRecentCommit,
|
|
177
177
|
hasMeaningfulUserText2,
|
|
@@ -224,24 +224,27 @@ import {
|
|
|
224
224
|
saveSourceContent,
|
|
225
225
|
replaceSourceContent,
|
|
226
226
|
getSourceContents
|
|
227
|
-
} from "./index-
|
|
227
|
+
} from "./index-cw3j0pwy.js";
|
|
228
228
|
import {
|
|
229
229
|
cleanSearchText,
|
|
230
230
|
matchedSearchSnippet
|
|
231
|
-
} from "./index-
|
|
231
|
+
} from "./index-etm62gd7.js";
|
|
232
232
|
import {
|
|
233
233
|
getProjectEmbeddingSnapshot2,
|
|
234
234
|
embedTextForProject2,
|
|
235
235
|
embedBatchForProject2
|
|
236
|
-
} from "./index-
|
|
236
|
+
} from "./index-9swgykdd.js";
|
|
237
237
|
import {
|
|
238
238
|
isEmbeddingHostBusy2
|
|
239
239
|
} from "./index-qt1qqasc.js";
|
|
240
|
+
import {
|
|
241
|
+
userFacingFailureCode
|
|
242
|
+
} from "./index-ve863q40.js";
|
|
240
243
|
import {
|
|
241
244
|
getMessageIndexEpoch,
|
|
242
245
|
isMessageIndexSearchable,
|
|
243
246
|
createAutoSearchDiagnostics
|
|
244
|
-
} from "./index-
|
|
247
|
+
} from "./index-xha0yxhy.js";
|
|
245
248
|
import {
|
|
246
249
|
openCodeDbExists,
|
|
247
250
|
withReadOnlySessionDb,
|
|
@@ -259,7 +262,7 @@ import {
|
|
|
259
262
|
extractToolCallObservation,
|
|
260
263
|
ToolMutationBatch,
|
|
261
264
|
createToolDropTarget
|
|
262
|
-
} from "./index-
|
|
265
|
+
} from "./index-yhz1w3ss.js";
|
|
263
266
|
import {
|
|
264
267
|
compareOpenCodeMessagesByCanonicalOrder,
|
|
265
268
|
startCompactionMarkerCandidatePreparation,
|
|
@@ -281,10 +284,7 @@ import {
|
|
|
281
284
|
peekNoteNudgeText,
|
|
282
285
|
markNoteNudgeDelivered,
|
|
283
286
|
getActiveCompartmentRun
|
|
284
|
-
} from "./index-
|
|
285
|
-
import {
|
|
286
|
-
userFacingFailureCode
|
|
287
|
-
} from "./index-n6aye6ny.js";
|
|
287
|
+
} from "./index-sc5segqg.js";
|
|
288
288
|
import {
|
|
289
289
|
getErrorMessage
|
|
290
290
|
} from "./index-y8v6yerm.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
releaseCompartmentLeaseBestEffort,
|
|
9
9
|
getCompartments,
|
|
10
10
|
getLastCompartmentEndMessage
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-cw3j0pwy.js";
|
|
12
12
|
import {
|
|
13
13
|
inRootAsyncContext2
|
|
14
14
|
} from "./index-gzy5w8ya.js";
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
releaseWrapupInProgress,
|
|
20
20
|
getHistorianFailureState,
|
|
21
21
|
clearEmergencyRecovery
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-bdnak4d0.js";
|
|
23
23
|
import {
|
|
24
24
|
prepareRawSessionOrdinals2
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-yhz1w3ss.js";
|
|
26
26
|
import {
|
|
27
27
|
pushNotification2
|
|
28
28
|
} from "./index-x8a7jmkh.js";
|
|
@@ -34,14 +34,14 @@ import {
|
|
|
34
34
|
getActiveCompartmentRun,
|
|
35
35
|
markActiveCompartmentRunPublished,
|
|
36
36
|
registerActiveCompartmentRun
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-sc5segqg.js";
|
|
38
38
|
import {
|
|
39
39
|
sendStatusNotification2
|
|
40
40
|
} from "./index-1sq1krqw.js";
|
|
41
41
|
import {
|
|
42
42
|
setRecompStarting2,
|
|
43
43
|
setRecompTerminal2
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-q5rcetym.js";
|
|
45
45
|
|
|
46
46
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
47
47
|
import * as crypto from "node:crypto";
|