@cortexkit/pi-magic-context 0.49.48 → 0.49.50
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 +5 -5
- package/dist/chunk-embedding-write-worker.js +12 -12
- package/dist/{compaction-marker-candidates-17a21jfn.js → compaction-marker-candidates-9yhrstyb.js} +2 -2
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{compartment-chunk-embedding-nyjs3dfh.js → compartment-chunk-embedding-wg7emg3z.js} +7 -7
- package/dist/embedding-backfill-fbhpk2yy.js +27 -0
- package/dist/embedding-worker-process.js +1 -1
- package/dist/embedding-worker.js +5 -5
- package/dist/historian-calibration-extension.js +1 -1
- package/dist/{index-bbffazv6.js → index-06rdy9h6.js} +11 -9
- package/dist/{index-h1rtbjrp.js → index-38bm78h4.js} +25 -21
- package/dist/{index-tsg6swzr.js → index-38pf5bqw.js} +6 -4
- package/dist/{index-w26zvs1q.js → index-46wk0td0.js} +1 -1
- package/dist/{index-vnygvrad.js → index-4j5442b0.js} +7 -7
- package/dist/{index-806brt0p.js → index-4ss8c8ky.js} +10 -10
- package/dist/{index-bbbp8zs1.js → index-6d0bby9d.js} +2 -2
- package/dist/{index-000fthre.js → index-7y60kyea.js} +1 -1
- package/dist/{index-gzk7d940.js → index-aec63gtj.js} +3 -0
- package/dist/{index-6748dkmx.js → index-ch3rvpjg.js} +2 -2
- package/dist/{index-0wtm7g7f.js → index-j0eagxkz.js} +1 -1
- package/dist/{index-gwm5x42c.js → index-jexm22qn.js} +3 -3
- package/dist/{index-yacs388s.js → index-jxm4bvm4.js} +1 -1
- package/dist/{index-pja6ggeq.js → index-jy9fq8gp.js} +11 -11
- package/dist/{index-4sa1rx3h.js → index-ndg15t3x.js} +4 -4
- package/dist/{index-j1kkx3f3.js → index-pkg07s54.js} +2 -2
- package/dist/{index-bhj8kymt.js → index-qcsjj9m0.js} +3 -3
- package/dist/{index-gwvahsdz.js → index-qm139qq2.js} +2 -2
- package/dist/{index-rcenqffj.js → index-r6dj8rm9.js} +27 -11
- package/dist/{index-3g9fnq6y.js → index-szn2tac8.js} +1 -1
- package/dist/{index-zwbgxt01.js → index-ty2m0s0s.js} +6 -5
- package/dist/{index-2kmwjq42.js → index-xssjy4z9.js} +1 -1
- package/dist/{index-6pk49fc3.js → index-xx1911hb.js} +1 -1
- package/dist/{index-cq71g4dk.js → index-yjgkjkjs.js} +1 -1
- package/dist/{index-zybqfwfv.js → index-ywvhr524.js} +4 -4
- package/dist/{index-gymgz20n.js → index-yxeg8zaa.js} +23 -20
- package/dist/{index-d107f484.js → index-zc6fdyx7.js} +4 -4
- package/dist/{index-mp0gh04g.js → index-zxm7ckvc.js} +2 -2
- package/dist/index.js +194 -122
- package/dist/{logger-2j70hhz4.js → logger-hhgpkbx1.js} +1 -1
- package/dist/{message-fts-rowid-map-ff4qg3e4.js → message-fts-rowid-map-tec2x7qe.js} +4 -4
- package/dist/{message-index-bounded-f0bk44ch.js → message-index-bounded-wg71m86d.js} +10 -10
- package/dist/{message-time-backfill-x45573rs.js → message-time-backfill-krre2qnb.js} +2 -2
- package/dist/migration-worker.js +9 -9
- package/dist/{project-embedding-registry-ysaezfqw.js → project-embedding-registry-hpca84nz.js} +12 -12
- package/dist/raw-ordinal-warmup-worker.js +8 -8
- package/dist/{read-session-chunk-6nt4dzkk.js → read-session-chunk-dmpabgvh.js} +8 -8
- package/dist/{read-session-raw-nttnwy8p.js → read-session-raw-75dcxtdy.js} +2 -2
- package/dist/{render-yn7fgmg7.js → render-71rpjt3g.js} +17 -17
- package/dist/{safe-notification-target-jk69jxwp.js → safe-notification-target-8s1xg0q9.js} +2 -2
- package/dist/{search-archive-pcf0za02.js → search-archive-w12r0c45.js} +10 -10
- package/dist/{search-yvcam5gm.js → search-m61nenns.js} +20 -20
- package/dist/{storage-tags-s0zqj0m0.js → storage-tags-ahhwtfdq.js} +4 -4
- package/dist/subagent-entry.js +26 -26
- package/dist/tag-snapshot-worker-pi.js +11 -11
- package/dist/{v2-archive-reader-accb2tjp.js → v2-archive-reader-5n1w78zj.js} +1 -1
- package/package.json +1 -1
- package/dist/embedding-backfill-er9jc4xf.js +0 -27
|
@@ -6710,6 +6710,7 @@ var BaseEmbeddingConfigSchema = object({
|
|
|
6710
6710
|
query_instruction: union([string2(), literal(false)]).optional().describe("OpenAI-compatible query prefix override. A string is prepended verbatim to search queries; false disables the built-in model-family instruction. Qwen3-Embedding, gte-Qwen instruct, e5 instruct, and Nomic families have built-in recipes. Query-only changes do not re-embed stored content. User-level only; project values are ignored."),
|
|
6711
6711
|
document_prefix: string2().optional().describe("OpenAI-compatible stored-document prefix override, prepended verbatim. Defaults to the model-family recipe (empty for Qwen3/gte/e5 instruct; 'search_document: ' for Nomic). Changing it changes stored vectors and triggers re-embedding. User-level only; project values are ignored."),
|
|
6712
6712
|
truncate: string2().optional().describe("Optional truncate mode sent in the embedding request body (e.g. NVIDIA NIM accepts 'NONE' | 'START' | 'END'). Omitted from the request when unset."),
|
|
6713
|
+
dimensions: number2().int().min(1).max(8192).optional().describe("Optional output width for Matryoshka embedding models (e.g. Qwen3-Embedding-8B accepts 768 | 1024 | 2048 | 4096; OpenAI text-embedding-3-* accept smaller widths than native). Sent as the OpenAI-compatible `dimensions` request field. Omitted from the request when unset, so the endpoint default applies. Changing it changes the produced vectors and folds into the embedding model identity, so switching widths re-embeds rather than mixing vector spaces. Not supported for the local provider, and ignored from project config like the other embedding fields (a repository cannot choose how private text is embedded)."),
|
|
6713
6714
|
max_input_tokens: number2().int().positive().optional().describe("Optional maximum input tokens for chunk embeddings. Defaults conservatively to 512 when omitted."),
|
|
6714
6715
|
local_runtime: _enum(["auto", "native", "wasm"]).default("auto").describe("Local provider only: ONNX runtime selection. 'auto' uses native under Node and uses WASM under Bun versions before 1.4.0, where Bun's NAPI teardown race can panic on quit; native is restored automatically on Bun 1.4.0+. Inference runs in a dedicated worker after disabling POSIX telemetry in the native process environment. Compiled Bun hosts and hosts without a verified in-process opt-out use a subprocess instead. Windows native ONNX emits OS-controlled ETW diagnostics, not direct uploads. On Bun before 1.4.0, even explicit 'native' uses WASM because native worker teardown can crash the process. Set 'wasm' to avoid loading the native addon on newer hosts too."),
|
|
6715
6716
|
local_dtype: _enum([
|
|
@@ -6758,6 +6759,7 @@ var EmbeddingConfigSchema = BaseEmbeddingConfigSchema.transform((data) => {
|
|
|
6758
6759
|
...model ? { model } : {},
|
|
6759
6760
|
...endpoint ? { endpoint } : {},
|
|
6760
6761
|
...apiKey ? { api_key: apiKey } : {},
|
|
6762
|
+
...data.dimensions ? { dimensions: data.dimensions } : {},
|
|
6761
6763
|
...inputType ? { input_type: inputType } : {},
|
|
6762
6764
|
...queryInputType ? { query_input_type: queryInputType } : {},
|
|
6763
6765
|
...data.query_instruction !== undefined ? { query_instruction: data.query_instruction } : {},
|
|
@@ -6784,6 +6786,7 @@ var EmbeddingConfigSchema = BaseEmbeddingConfigSchema.transform((data) => {
|
|
|
6784
6786
|
provider: "openai-compatible",
|
|
6785
6787
|
model: data.model?.trim() ?? "",
|
|
6786
6788
|
endpoint: data.endpoint?.trim() ?? "",
|
|
6789
|
+
...data.dimensions ? { dimensions: data.dimensions } : {},
|
|
6787
6790
|
...apiKey ? { api_key: apiKey } : {},
|
|
6788
6791
|
...inputType ? { input_type: inputType } : {},
|
|
6789
6792
|
...queryInputType ? { query_input_type: queryInputType } : {},
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./index-1cvyaw9a.js";
|
|
4
4
|
import {
|
|
5
5
|
estimateTokens
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-7y60kyea.js";
|
|
7
7
|
import {
|
|
8
8
|
readRawSessionMessageIdOrdinalsForRange2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-4j5442b0.js";
|
|
10
10
|
|
|
11
11
|
// ../plugin/src/tools/ctx-expand/search-archive.ts
|
|
12
12
|
var archiveReadsOnThisThread = 0;
|
|
@@ -139,9 +139,9 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
139
139
|
import("./sqlite-v89bj0yy.js"),
|
|
140
140
|
import("./store-reader-mmfw2h48.js"),
|
|
141
141
|
import("./store-0hhs1db3.js"),
|
|
142
|
-
import("./read-session-chunk-
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
142
|
+
import("./read-session-chunk-dmpabgvh.js"),
|
|
143
|
+
import("./render-71rpjt3g.js"),
|
|
144
|
+
import("./search-archive-w12r0c45.js"),
|
|
145
145
|
import("./expand-attachments-8sxeyj26.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
piModelRefToCanonical
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-aec63gtj.js";
|
|
4
4
|
import {
|
|
5
5
|
getHarness2
|
|
6
6
|
} from "./index-0h2mkab2.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getMagicContextStorageDir,
|
|
10
10
|
log2,
|
|
11
11
|
sessionLog2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-yxeg8zaa.js";
|
|
13
13
|
import {
|
|
14
14
|
MERGED_REASONING_PARTS_PREFIX,
|
|
15
15
|
decodeMergedReasoningParts,
|
|
@@ -39,15 +39,15 @@ import {
|
|
|
39
39
|
expandToolPart,
|
|
40
40
|
visitRawSessionMessages2,
|
|
41
41
|
readRawSessionMessageById2
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-4j5442b0.js";
|
|
43
43
|
import {
|
|
44
44
|
isRecord,
|
|
45
45
|
providerVisibleMessage,
|
|
46
46
|
getTagById2
|
|
47
|
-
} from "./index-
|
|
47
|
+
} from "./index-qcsjj9m0.js";
|
|
48
48
|
import {
|
|
49
49
|
estimateTokens
|
|
50
|
-
} from "./index-
|
|
50
|
+
} from "./index-7y60kyea.js";
|
|
51
51
|
import {
|
|
52
52
|
prepareCachedStatement2,
|
|
53
53
|
withSqliteBackgroundWriter2,
|
|
@@ -60,21 +60,21 @@ import {
|
|
|
60
60
|
tagRevisionKey,
|
|
61
61
|
tagIdentityRevisionKey,
|
|
62
62
|
deleteTagIdentityRevisions
|
|
63
|
-
} from "./index-
|
|
63
|
+
} from "./index-jxm4bvm4.js";
|
|
64
64
|
import {
|
|
65
65
|
isPidAlive,
|
|
66
66
|
readProcessStartTime
|
|
67
|
-
} from "./index-
|
|
67
|
+
} from "./index-06rdy9h6.js";
|
|
68
68
|
import {
|
|
69
69
|
gaDatabasePath2,
|
|
70
70
|
V2StoreReader2
|
|
71
71
|
} from "./index-nvh6d3bz.js";
|
|
72
72
|
import {
|
|
73
73
|
deleteUnmappedMessageFtsRows2
|
|
74
|
-
} from "./index-
|
|
74
|
+
} from "./index-6d0bby9d.js";
|
|
75
75
|
import {
|
|
76
76
|
deleteChunkEmbedBackoffForSession2
|
|
77
|
-
} from "./index-
|
|
77
|
+
} from "./index-ndg15t3x.js";
|
|
78
78
|
import {
|
|
79
79
|
invalidateAutoEmbedSession,
|
|
80
80
|
drainBackgroundBatches
|
|
@@ -85,10 +85,10 @@ import {
|
|
|
85
85
|
import {
|
|
86
86
|
layoutLkgPrefix,
|
|
87
87
|
assembleLkgPrefix
|
|
88
|
-
} from "./index-
|
|
88
|
+
} from "./index-zc6fdyx7.js";
|
|
89
89
|
import {
|
|
90
90
|
logSlowWriteTransaction
|
|
91
|
-
} from "./index-
|
|
91
|
+
} from "./index-j0eagxkz.js";
|
|
92
92
|
import {
|
|
93
93
|
ensurePrivateStorageDirectorySync,
|
|
94
94
|
writeStorageFileSync,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEstimatorFingerprint,
|
|
3
3
|
estimateTokens
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-7y60kyea.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-yxeg8zaa.js";
|
|
11
11
|
import {
|
|
12
12
|
isSynapseEmbeddingTruncated
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-qm139qq2.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-6d0bby9d.js";
|
|
17
17
|
import {
|
|
18
18
|
isKnownAutocommit
|
|
19
19
|
} from "./index-nrzkqte4.js";
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
tagRevisionCountSql,
|
|
4
4
|
tagRevisionKey,
|
|
5
5
|
TAG_INSERT_CONFLICT_ROWS
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-jxm4bvm4.js";
|
|
7
7
|
import {
|
|
8
8
|
getTagsBySession2,
|
|
9
9
|
getTagsByNumbers2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-qcsjj9m0.js";
|
|
11
11
|
import {
|
|
12
12
|
inRootAsyncContext2,
|
|
13
13
|
getSqliteDatabasePath2,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-7y60kyea.js";
|
|
4
4
|
import {
|
|
5
5
|
getHarness2
|
|
6
6
|
} from "./index-0h2mkab2.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLog2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-yxeg8zaa.js";
|
|
10
10
|
import {
|
|
11
11
|
getTagIdentityWriteGeneration2,
|
|
12
12
|
getSqliteDatabasePath2
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
jsonHashSink,
|
|
16
16
|
tagOrderConstraintIndex,
|
|
17
17
|
tagIdentityRevisionKey
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-jxm4bvm4.js";
|
|
19
19
|
import {
|
|
20
20
|
DEFAULT_PROTECTED_TOOLS,
|
|
21
21
|
normalizeProtectedToolName,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-7y60kyea.js";
|
|
4
4
|
import {
|
|
5
5
|
getHarness2
|
|
6
6
|
} from "./index-0h2mkab2.js";
|
|
7
7
|
import {
|
|
8
8
|
log2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-yxeg8zaa.js";
|
|
10
10
|
import {
|
|
11
11
|
inRootAsyncContext2
|
|
12
12
|
} from "./index-2qtx0q6h.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-7y60kyea.js";
|
|
4
4
|
import {
|
|
5
5
|
getHarness2
|
|
6
6
|
} from "./index-0h2mkab2.js";
|
|
7
7
|
import {
|
|
8
8
|
log2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-yxeg8zaa.js";
|
|
10
10
|
import {
|
|
11
11
|
sanitizeDiagnosticText
|
|
12
12
|
} from "./index-dnp1jjar.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isSynapseEmbeddingTruncated,
|
|
16
16
|
getSynapseBatchRequestKey,
|
|
17
17
|
SynapseEmbeddingProvider
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-qm139qq2.js";
|
|
19
19
|
import {
|
|
20
20
|
inRootAsyncContext2,
|
|
21
21
|
getSqliteDatabasePath2
|
|
@@ -43,10 +43,10 @@ import {
|
|
|
43
43
|
countSessionCompartmentEmbedCoverage2,
|
|
44
44
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
45
45
|
countUnembeddedSessionCompartmentsPolite2
|
|
46
|
-
} from "./index-
|
|
46
|
+
} from "./index-ndg15t3x.js";
|
|
47
47
|
import {
|
|
48
48
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-aec63gtj.js";
|
|
50
50
|
import {
|
|
51
51
|
embeddingModelsMatch,
|
|
52
52
|
resolveEmbeddingTextPrefixes,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
getEmbeddingProviderIdentity,
|
|
57
57
|
dominantEmbeddingFailure,
|
|
58
58
|
LocalEmbeddingProvider
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-38pf5bqw.js";
|
|
60
60
|
import {
|
|
61
61
|
embedPauseBySession,
|
|
62
62
|
activeEmbeddingSessions,
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
} from "./index-hgd00nas.js";
|
|
68
68
|
import {
|
|
69
69
|
setBootQuietPeriodForTests
|
|
70
|
-
} from "./index-
|
|
70
|
+
} from "./index-xx1911hb.js";
|
|
71
71
|
import {
|
|
72
72
|
isEmbeddingHostBusy2
|
|
73
73
|
} from "./index-9p40dgkm.js";
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
acquireGitSweepLease,
|
|
79
79
|
renewGitSweepLease,
|
|
80
80
|
releaseGitSweepLease
|
|
81
|
-
} from "./index-
|
|
81
|
+
} from "./index-zxm7ckvc.js";
|
|
82
82
|
import {
|
|
83
83
|
saveEmbeddingIfHashMatches,
|
|
84
84
|
getMemoryEmbedCoverage,
|
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
} from "./index-nrzkqte4.js";
|
|
90
90
|
import {
|
|
91
91
|
logSlowWriteTransaction
|
|
92
|
-
} from "./index-
|
|
92
|
+
} from "./index-j0eagxkz.js";
|
|
93
93
|
|
|
94
94
|
// ../plugin/src/features/magic-context/memory/embedding-openai.ts
|
|
95
95
|
import { createHash } from "node:crypto";
|
|
@@ -284,6 +284,7 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
284
284
|
queryPrefix;
|
|
285
285
|
documentPrefix;
|
|
286
286
|
truncate;
|
|
287
|
+
dimensions;
|
|
287
288
|
initialized = false;
|
|
288
289
|
failureTimes = [];
|
|
289
290
|
circuitOpenUntil = 0;
|
|
@@ -303,6 +304,7 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
303
304
|
this.queryPrefix = prefixes.queryPrefix;
|
|
304
305
|
this.documentPrefix = prefixes.documentPrefix;
|
|
305
306
|
this.truncate = options.truncate?.trim() ?? "";
|
|
307
|
+
this.dimensions = typeof options.dimensions === "number" && Number.isInteger(options.dimensions) && options.dimensions > 0 ? options.dimensions : undefined;
|
|
306
308
|
this.rateLimitKey = rateLimitStateKey(this.endpoint, this.apiKey);
|
|
307
309
|
const maxInputTokensSet = typeof options.maxInputTokens === "number" && Number.isFinite(options.maxInputTokens);
|
|
308
310
|
this.maxInputTokens = maxInputTokensSet ? Math.max(1, Math.floor(options.maxInputTokens)) : DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2;
|
|
@@ -320,7 +322,8 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
320
322
|
...this.apiKey ? { api_key: this.apiKey } : {},
|
|
321
323
|
...this.inputType ? { input_type: this.inputType } : {},
|
|
322
324
|
...options.documentPrefix !== undefined ? { document_prefix: options.documentPrefix } : {},
|
|
323
|
-
...this.truncate ? { truncate: this.truncate } : {}
|
|
325
|
+
...this.truncate ? { truncate: this.truncate } : {},
|
|
326
|
+
...this.dimensions ? { dimensions: this.dimensions } : {}
|
|
324
327
|
});
|
|
325
328
|
}
|
|
326
329
|
async initialize() {
|
|
@@ -426,7 +429,8 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
426
429
|
model: this.model,
|
|
427
430
|
input: requestTexts,
|
|
428
431
|
...inputTypeForRequest ? { input_type: inputTypeForRequest } : {},
|
|
429
|
-
...this.truncate ? { truncate: this.truncate } : {}
|
|
432
|
+
...this.truncate ? { truncate: this.truncate } : {},
|
|
433
|
+
...this.dimensions ? { dimensions: this.dimensions } : {}
|
|
430
434
|
}),
|
|
431
435
|
redirect: "error",
|
|
432
436
|
signal: internalController.signal
|
|
@@ -499,6 +503,16 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
499
503
|
results[slot] = Float32Array.from(embedding);
|
|
500
504
|
}
|
|
501
505
|
});
|
|
506
|
+
if (this.dimensions !== undefined) {
|
|
507
|
+
const requested = this.dimensions;
|
|
508
|
+
const returned = results.find((r) => r !== null && r.length !== requested)?.length;
|
|
509
|
+
if (returned !== undefined) {
|
|
510
|
+
const failure = this.failure("invalid_envelope", `requested dimensions=${requested} but endpoint returned ${returned}-dim vectors; the endpoint may not support the dimensions parameter for this model`, false);
|
|
511
|
+
log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
|
|
512
|
+
this.recordFailure(requestStartedAt, isProbe, failure);
|
|
513
|
+
return Array.from({ length: texts.length }, () => null);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
502
516
|
if (results.every((r) => r === null)) {
|
|
503
517
|
const failure = this.failure("invalid_envelope", `response had keys [${responseKeys.join(", ")}] but data[].embedding was absent`, false);
|
|
504
518
|
log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
|
|
@@ -1240,6 +1254,7 @@ function resolveEmbeddingConfig(config) {
|
|
|
1240
1254
|
...config.query_instruction !== undefined ? { query_instruction: config.query_instruction } : {},
|
|
1241
1255
|
...config.document_prefix !== undefined ? { document_prefix: config.document_prefix } : {},
|
|
1242
1256
|
...truncate ? { truncate } : {},
|
|
1257
|
+
...config.dimensions ? { dimensions: config.dimensions } : {},
|
|
1243
1258
|
...config.max_input_tokens ? {
|
|
1244
1259
|
max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(config.max_input_tokens)
|
|
1245
1260
|
} : {}
|
|
@@ -1289,6 +1304,7 @@ function createProvider(config, context) {
|
|
|
1289
1304
|
queryInstruction: config.query_instruction,
|
|
1290
1305
|
documentPrefix: config.document_prefix,
|
|
1291
1306
|
truncate: config.truncate,
|
|
1307
|
+
dimensions: config.dimensions,
|
|
1292
1308
|
maxInputTokens: config.max_input_tokens
|
|
1293
1309
|
});
|
|
1294
1310
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-aec63gtj.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-yxeg8zaa.js";
|
|
7
7
|
import {
|
|
8
8
|
isSynapseEmbeddingTruncated,
|
|
9
9
|
SynapseEmbeddingProvider
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-qm139qq2.js";
|
|
11
11
|
import {
|
|
12
12
|
LocalEmbeddingProvider
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-38pf5bqw.js";
|
|
14
14
|
import {
|
|
15
15
|
OpenAICompatibleEmbeddingProvider,
|
|
16
16
|
getProjectEmbeddingSnapshot2,
|
|
17
17
|
embedBatchForProject2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-r6dj8rm9.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./index-9p40dgkm.js";
|
|
@@ -62,6 +62,7 @@ function createProvider(config) {
|
|
|
62
62
|
queryInstruction: config.query_instruction,
|
|
63
63
|
documentPrefix: config.document_prefix,
|
|
64
64
|
truncate: config.truncate,
|
|
65
|
+
dimensions: config.dimensions,
|
|
65
66
|
maxInputTokens: config.max_input_tokens
|
|
66
67
|
});
|
|
67
68
|
}
|
|
@@ -6,19 +6,19 @@ import {
|
|
|
6
6
|
removeNestedBlocks,
|
|
7
7
|
hasMeaningfulUserText2,
|
|
8
8
|
extractTexts2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-7y60kyea.js";
|
|
10
10
|
import {
|
|
11
11
|
cleanUserText2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-4j5442b0.js";
|
|
13
13
|
import {
|
|
14
14
|
recordMessageFtsRowid2,
|
|
15
15
|
recordIndexedMessageTime2,
|
|
16
16
|
messageFtsOrdinalRangeIsMapped2,
|
|
17
17
|
deleteUnmappedMessageFtsRows2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-6d0bby9d.js";
|
|
19
19
|
import {
|
|
20
20
|
logSlowWriteTransaction
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-j0eagxkz.js";
|
|
22
22
|
|
|
23
23
|
// ../plugin/src/features/magic-context/compression-depth-storage.ts
|
|
24
24
|
var incrementDepthStatements = new WeakMap;
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
readFileSync,
|
|
19
19
|
readlinkSync,
|
|
20
20
|
realpathSync,
|
|
21
|
+
unlinkSync,
|
|
21
22
|
writeFileSync
|
|
22
23
|
} from "node:fs";
|
|
23
24
|
import * as os from "node:os";
|
|
@@ -43,29 +44,31 @@ function getMagicContextLogPath(harness = getHarness2()) {
|
|
|
43
44
|
function getProjectMagicContextDir(directory) {
|
|
44
45
|
return path.join(directory, ".cortexkit", "magic-context");
|
|
45
46
|
}
|
|
46
|
-
var GITIGNORE_GUARD_OPEN = "# >>> cortexkit:magic-context";
|
|
47
|
-
var GITIGNORE_GUARD_CLOSE = "# <<< cortexkit:magic-context";
|
|
48
47
|
function ensureCortexKitArtifactGitignore(directory) {
|
|
49
48
|
try {
|
|
50
|
-
const
|
|
51
|
-
const gitignorePath = path.join(
|
|
52
|
-
|
|
53
|
-
if (existsSync(gitignorePath))
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const artifactDir = getProjectMagicContextDir(directory);
|
|
50
|
+
const gitignorePath = path.join(artifactDir, ".gitignore");
|
|
51
|
+
mkdirSync(artifactDir, { recursive: true });
|
|
52
|
+
if (!existsSync(gitignorePath) || readFileSync(gitignorePath, "utf8") !== `*
|
|
53
|
+
`) {
|
|
54
|
+
writeFileSync(gitignorePath, `*
|
|
55
|
+
`, "utf8");
|
|
57
56
|
}
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
const sharedPath = path.join(directory, ".cortexkit", ".gitignore");
|
|
58
|
+
if (!existsSync(sharedPath))
|
|
59
|
+
return;
|
|
60
|
+
const existing = readFileSync(sharedPath).toString("latin1");
|
|
61
|
+
const next = existing.replace(/^# >>> cortexkit:magic-context\r?\n(?:(?!^# (?:>>>|<<<) cortexkit:)[\s\S])*?^# <<< cortexkit:magic-context(?:\r?\n|$)/gm, "");
|
|
62
|
+
if (next === existing)
|
|
63
|
+
return;
|
|
64
|
+
const remaining = Buffer.from(next, "latin1");
|
|
65
|
+
if (remaining.toString("utf8").trim() === "")
|
|
66
|
+
unlinkSync(sharedPath);
|
|
67
|
+
else
|
|
68
|
+
writeFileSync(sharedPath, remaining);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
log2("Failed to ensure project artifact gitignore", { directory, error: String(error) });
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
73
|
function getProjectMagicContextHistorianDir(directory) {
|
|
71
74
|
return path.join(getProjectMagicContextDir(directory), "historian");
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./index-135e8hvg.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-yxeg8zaa.js";
|
|
7
7
|
import {
|
|
8
8
|
ensureColumn,
|
|
9
9
|
healAllNullColumns,
|
|
10
10
|
installV95PerfSchema
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-jxm4bvm4.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveOpenCodeDbPath,
|
|
14
14
|
openCodeDbPathExists,
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
normalizeStoredProjectPath,
|
|
22
22
|
storedPathBelongsToIdentity
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-xx1911hb.js";
|
|
24
24
|
import {
|
|
25
25
|
logSlowWriteTransaction
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-j0eagxkz.js";
|
|
27
27
|
|
|
28
28
|
// ../plugin/src/features/magic-context/migrations.ts
|
|
29
29
|
import { isMainThread } from "node:worker_threads";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./index-0h2mkab2.js";
|
|
4
4
|
import {
|
|
5
5
|
isUserHomeDirectory
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-xx1911hb.js";
|
|
7
7
|
import {
|
|
8
8
|
logSlowWriteTransaction
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-j0eagxkz.js";
|
|
10
10
|
|
|
11
11
|
// ../plugin/src/features/magic-context/session-project-storage.ts
|
|
12
12
|
var SESSION_CHUNK_REPAIR_BATCH_SIZE = 100;
|