@cortexkit/pi-magic-context 0.49.49 → 0.49.51

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.
Files changed (29) hide show
  1. package/dist/auto-search-worker.js +3 -3
  2. package/dist/chunk-embedding-write-worker.js +1 -1
  3. package/dist/{embedding-backfill-xsd7fc5c.js → embedding-backfill-fbhpk2yy.js} +4 -4
  4. package/dist/embedding-worker.js +2 -2
  5. package/dist/{index-y2g8rdmm.js → index-06rdy9h6.js} +4 -2
  6. package/dist/{index-zrbvwxtb.js → index-38pf5bqw.js} +4 -2
  7. package/dist/{index-9036v8ay.js → index-4j5442b0.js} +1 -1
  8. package/dist/{index-gzk7d940.js → index-aec63gtj.js} +3 -0
  9. package/dist/{index-bjeb4ya4.js → index-babadndp.js} +25 -7
  10. package/dist/{index-zggajt0j.js → index-ch3rvpjg.js} +1 -1
  11. package/dist/{index-8bpxfq4c.js → index-jexm22qn.js} +3 -3
  12. package/dist/{index-9n1hyjck.js → index-jy9fq8gp.js} +3 -3
  13. package/dist/{index-cmyk3bmf.js → index-r6dj8rm9.js} +20 -4
  14. package/dist/{index-vdrqxca5.js → index-sm51c9bc.js} +14 -10
  15. package/dist/{index-yc4vfwvm.js → index-ty2m0s0s.js} +4 -3
  16. package/dist/{index-wz66mger.js → index-ywvhr524.js} +1 -1
  17. package/dist/index.js +3848 -2029
  18. package/dist/{message-index-bounded-6zghm1jn.js → message-index-bounded-wg71m86d.js} +3 -3
  19. package/dist/migration-worker.js +1 -1
  20. package/dist/{project-embedding-registry-j4ywdpq0.js → project-embedding-registry-hpca84nz.js} +3 -3
  21. package/dist/raw-ordinal-warmup-worker.js +3 -3
  22. package/dist/{read-session-chunk-hs4jtxsm.js → read-session-chunk-dmpabgvh.js} +2 -2
  23. package/dist/{render-n3y6kvwq.js → render-71rpjt3g.js} +5 -5
  24. package/dist/{search-gzkbjgx0.js → search-7w8m1snz.js} +7 -7
  25. package/dist/{search-archive-1g44f9jt.js → search-archive-w12r0c45.js} +4 -4
  26. package/dist/subagent-entry.js +12 -12
  27. package/dist/tag-snapshot-worker-pi.js +1 -1
  28. package/dist/{v2-archive-reader-sez4pjd8.js → v2-archive-reader-5n1w78zj.js} +1 -1
  29. package/package.json +3 -1
@@ -27,11 +27,11 @@ serveWorkerJobs(async (initial, port) => {
27
27
  { Database, registerSqliteDiagnosticSink },
28
28
  { log }
29
29
  ] = await Promise.all([
30
- import("./embedding-backfill-xsd7fc5c.js"),
30
+ import("./embedding-backfill-fbhpk2yy.js"),
31
31
  import("./embedding-cache-7rp4gqzr.js"),
32
32
  import("./storage-memory-0ndn65fm.js"),
33
- import("./project-embedding-registry-j4ywdpq0.js"),
34
- import("./search-gzkbjgx0.js"),
33
+ import("./project-embedding-registry-hpca84nz.js"),
34
+ import("./search-7w8m1snz.js"),
35
35
  import("./compartment-chunk-embedding-wg7emg3z.js"),
36
36
  import("./embedding-activity-ew6dshfd.js"),
37
37
  import("./harness-9872e0ym.js"),
@@ -35,7 +35,7 @@ import"./index-xx1911hb.js";
35
35
  import {
36
36
  LATEST_SUPPORTED_VERSION,
37
37
  enforceSchemaFence
38
- } from "./index-y2g8rdmm.js";
38
+ } from "./index-06rdy9h6.js";
39
39
  import"./index-3bb24eb6.js";
40
40
  import"./index-zc6fdyx7.js";
41
41
  import"./index-jxm4bvm4.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  ensureMemoryEmbeddings2
3
- } from "./index-yc4vfwvm.js";
4
- import"./index-cmyk3bmf.js";
3
+ } from "./index-ty2m0s0s.js";
4
+ import"./index-r6dj8rm9.js";
5
5
  import"./index-9p40dgkm.js";
6
6
  import"./index-hgd00nas.js";
7
7
  import"./index-yhzhdp3m.js";
8
8
  import"./index-zxm7ckvc.js";
9
9
  import"./index-ndg15t3x.js";
10
- import"./index-zrbvwxtb.js";
10
+ import"./index-38pf5bqw.js";
11
11
  import"./index-qm139qq2.js";
12
- import"./index-gzk7d940.js";
12
+ import"./index-aec63gtj.js";
13
13
  import"./index-xx1911hb.js";
14
14
  import"./index-6d0bby9d.js";
15
15
  import"./index-szn2tac8.js";
@@ -5,7 +5,7 @@ import {
5
5
  log2
6
6
  } from "./index-yxeg8zaa.js";
7
7
  import"./index-dnp1jjar.js";
8
- import"./index-gzk7d940.js";
8
+ import"./index-aec63gtj.js";
9
9
  import"./index-qm139qq2.js";
10
10
  import"./index-7y60kyea.js";
11
11
  import"./index-2qtx0q6h.js";
@@ -13,7 +13,7 @@ import {
13
13
  resolveLocalEmbeddingWorkerRuntime,
14
14
  getLocalEmbeddingNativeMemoryStats,
15
15
  LocalEmbeddingProvider
16
- } from "./index-zrbvwxtb.js";
16
+ } from "./index-38pf5bqw.js";
17
17
  import {
18
18
  setStoragePrivatePermissionEnforcement
19
19
  } from "./index-81nthk8j.js";
@@ -1336,6 +1336,7 @@ var databases = new Map;
1336
1336
  var pendingAsyncOpens = new Map;
1337
1337
  var pendingDatabaseCloses = new Set;
1338
1338
  var startupBackfills = new WeakMap;
1339
+ var scheduleStartupMaintenanceOnOpen = true;
1339
1340
  var persistenceByDatabase = new WeakMap;
1340
1341
  var persistenceErrorByDatabase = new WeakMap;
1341
1342
  var pathByDatabase = new WeakMap;
@@ -1768,7 +1769,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1768
1769
  return null;
1769
1770
  }
1770
1771
  healWedgedChannel2Claims(db);
1771
- if (!explicitDbPath) {
1772
+ if (!explicitDbPath && scheduleStartupMaintenanceOnOpen) {
1772
1773
  const readsOpenCodeStore = harnessOwnsOpenCodeStore2();
1773
1774
  const state = { controller: new AbortController };
1774
1775
  startupBackfills.set(db, state);
@@ -1788,7 +1789,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1788
1789
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1789
1790
  if (signal.aborted || !readsOpenCodeStore)
1790
1791
  return;
1791
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-hs4jtxsm.js"));
1792
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-dmpabgvh.js"));
1792
1793
  const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-krre2qnb.js"));
1793
1794
  if (signal.aborted)
1794
1795
  return;
@@ -1809,6 +1810,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1809
1810
  log2(`[magic-context] message-index backfill failed (will resume next startup): ${getErrorMessage(error)}`);
1810
1811
  });
1811
1812
  }));
1813
+ state.run = runBackfills;
1812
1814
  state.timer = scheduleAfterBootQuiet(runBackfills);
1813
1815
  }
1814
1816
  setDatabase(db);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./index-gzk7d940.js";
3
+ } from "./index-aec63gtj.js";
4
4
  import {
5
5
  getSynapseLaneIdentity
6
6
  } from "./index-qm139qq2.js";
@@ -543,6 +543,7 @@ function getEmbeddingProviderIdentity(config) {
543
543
  throw new Error("Unknown embedding provider");
544
544
  }
545
545
  const truncate = config.provider === "openai-compatible" ? config.truncate?.trim() : undefined;
546
+ const dimensions = config.provider === "openai-compatible" ? config.dimensions : undefined;
546
547
  const documentPrefix = config.provider === "openai-compatible" ? resolveEmbeddingTextPrefixes(config.model, config.query_instruction, config.document_prefix).documentPrefix : "";
547
548
  const localDtype = config.provider === "local" && config.local_dtype && config.local_dtype !== "fp32" ? config.local_dtype : undefined;
548
549
  const localPooling = config.provider === "local" ? getCachedLocalEmbeddingPooling(config.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL) : null;
@@ -554,7 +555,8 @@ function getEmbeddingProviderIdentity(config) {
554
555
  apiKeyPresent: Boolean(config.api_key?.trim()),
555
556
  inputType: config.input_type?.trim() || "",
556
557
  ...documentPrefix ? { documentPrefix } : {},
557
- ...truncate ? { truncate } : {}
558
+ ...truncate ? { truncate } : {},
559
+ ...dimensions ? { dimensions } : {}
558
560
  } : {
559
561
  provider: "local",
560
562
  model: config.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL,
@@ -4,7 +4,7 @@ import {
4
4
  renderToolTemplate,
5
5
  resolveModelConfigValue,
6
6
  deriveDefaultProtectedTokens
7
- } from "./index-gzk7d940.js";
7
+ } from "./index-aec63gtj.js";
8
8
  import {
9
9
  getHarness2,
10
10
  harnessOwnsOpenCodeStore2
@@ -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 } : {},
@@ -47,7 +47,7 @@ import {
47
47
  getProjectEmbeddingSnapshot2,
48
48
  embedTextForProject2,
49
49
  embedItemsForProject2
50
- } from "./index-cmyk3bmf.js";
50
+ } from "./index-r6dj8rm9.js";
51
51
  import {
52
52
  recordEmbeddingMeasurement
53
53
  } from "./index-hgd00nas.js";
@@ -63,7 +63,7 @@ import {
63
63
  isEmbeddingEnabled,
64
64
  embedText,
65
65
  ensureMemoryEmbeddings2
66
- } from "./index-yc4vfwvm.js";
66
+ } from "./index-ty2m0s0s.js";
67
67
  import {
68
68
  getMemorySelectColumns2,
69
69
  isMemoryRow2,
@@ -91,7 +91,7 @@ import {
91
91
  clearIndexedMessages,
92
92
  indexSingleMessage,
93
93
  indexMessagesAfterOrdinal
94
- } from "./index-wz66mger.js";
94
+ } from "./index-ywvhr524.js";
95
95
  import {
96
96
  MESSAGE_FTS_SESSION_FILTER_SQL,
97
97
  withMessageFtsSessionFilter
@@ -1891,6 +1891,8 @@ function getDefaultSubcConnectionFile() {
1891
1891
  var RERANK_MODEL = "gte-reranker-modernbert-base-f32";
1892
1892
  var RERANK_LANE_LIMIT = 25;
1893
1893
  var DEADLINE_MS = 1500;
1894
+ var SYNAPSE_RESTART_BACKOFF_MS = 30000;
1895
+ var SYNAPSE_ABSENT_BACKOFF_MS = 10 * 60000;
1894
1896
  var DOCUMENT_BYTES = 1024;
1895
1897
  var proseWordSegmenter = new Intl.Segmenter(undefined, { granularity: "word" });
1896
1898
  function isProseQuery(query) {
@@ -2033,10 +2035,11 @@ async function bounded(promise) {
2033
2035
  }
2034
2036
  }
2035
2037
  var connections = new Map;
2038
+ var synapseRetryAt = new Map;
2036
2039
  async function connect(connectionFile) {
2037
2040
  let connection = connections.get(connectionFile);
2038
2041
  if (!connection) {
2039
- connection = inRootAsyncContext2(() => SubcClient.connect({ connectionFile }));
2042
+ connection = inRootAsyncContext2(() => SubcClient.connect({ connectionFile, routeOpenRetryDeadlineMs: 0 }));
2040
2043
  connections.set(connectionFile, connection);
2041
2044
  connection.catch(() => connections.delete(connectionFile));
2042
2045
  }
@@ -2106,24 +2109,39 @@ function remoteRerankSkipped(reason, onSkipped) {
2106
2109
  logRerankFallback(safe);
2107
2110
  onSkipped?.(line);
2108
2111
  }
2109
- async function prepareReranker(projectRoot, sessionId, connectionFile, injectedClient, config) {
2112
+ async function prepareReranker(projectRoot, sessionId, connectionFile, injectedClient, config, now = Date.now) {
2110
2113
  if (config?.provider === "off")
2111
2114
  return null;
2112
2115
  if (config?.provider === "remote")
2113
2116
  return { remote: config };
2117
+ const daemonFile = connectionFile ?? getDefaultSubcConnectionFile();
2118
+ const rememberAbsence = injectedClient === undefined;
2119
+ if (rememberAbsence && (synapseRetryAt.get(daemonFile) ?? 0) > now())
2120
+ return null;
2121
+ let catalogRequested = false;
2114
2122
  try {
2115
2123
  if (injectedClient === null)
2116
2124
  throw new RerankFailure("missing_synapse");
2117
- const client = injectedClient ?? await connect(connectionFile ?? getDefaultSubcConnectionFile());
2125
+ const client = injectedClient ?? await connect(daemonFile);
2118
2126
  const identity = {
2119
2127
  project_root: projectRoot,
2120
2128
  harness: "magic-context",
2121
2129
  session: sessionId
2122
2130
  };
2131
+ catalogRequested = true;
2123
2132
  const lane = pinReranker(await bounded(client.call("synapse", "models.list", {}, { timeoutMs: DEADLINE_MS, targetKind: "management_surface", identity })));
2133
+ if (rememberAbsence)
2134
+ synapseRetryAt.delete(daemonFile);
2124
2135
  return { client, lane, identity };
2125
2136
  } catch (error) {
2126
- logRerankFallback(reasonOf(error));
2137
+ const reason = reasonOf(error);
2138
+ if (rememberAbsence && catalogRequested && reason === "unknown_module") {
2139
+ const failedAt = now();
2140
+ const previousRetryAt = synapseRetryAt.get(daemonFile);
2141
+ const backoff = previousRetryAt !== undefined && failedAt - previousRetryAt < SYNAPSE_ABSENT_BACKOFF_MS ? SYNAPSE_ABSENT_BACKOFF_MS : SYNAPSE_RESTART_BACKOFF_MS;
2142
+ synapseRetryAt.set(daemonFile, failedAt + backoff);
2143
+ }
2144
+ logRerankFallback(reason);
2127
2145
  return null;
2128
2146
  }
2129
2147
  }
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-7y60kyea.js";
7
7
  import {
8
8
  readRawSessionMessageIdOrdinalsForRange2
9
- } from "./index-9036v8ay.js";
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-hs4jtxsm.js"),
143
- import("./render-n3y6kvwq.js"),
144
- import("./search-archive-1g44f9jt.js"),
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-gzk7d940.js";
3
+ } from "./index-aec63gtj.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./index-0h2mkab2.js";
@@ -39,7 +39,7 @@ import {
39
39
  expandToolPart,
40
40
  visitRawSessionMessages2,
41
41
  readRawSessionMessageById2
42
- } from "./index-9036v8ay.js";
42
+ } from "./index-4j5442b0.js";
43
43
  import {
44
44
  isRecord,
45
45
  providerVisibleMessage,
@@ -64,7 +64,7 @@ import {
64
64
  import {
65
65
  isPidAlive,
66
66
  readProcessStartTime
67
- } from "./index-y2g8rdmm.js";
67
+ } from "./index-06rdy9h6.js";
68
68
  import {
69
69
  gaDatabasePath2,
70
70
  V2StoreReader2
@@ -46,7 +46,7 @@ import {
46
46
  } from "./index-ndg15t3x.js";
47
47
  import {
48
48
  DEFAULT_LOCAL_EMBEDDING_MODEL
49
- } from "./index-gzk7d940.js";
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-zrbvwxtb.js";
59
+ } from "./index-38pf5bqw.js";
60
60
  import {
61
61
  embedPauseBySession,
62
62
  activeEmbeddingSessions,
@@ -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
  }
@@ -30,7 +30,7 @@ import {
30
30
  PER_HARNESS_MODEL_KEYS,
31
31
  ConfigProfilesSchema,
32
32
  MagicContextConfigSchema
33
- } from "./index-gzk7d940.js";
33
+ } from "./index-aec63gtj.js";
34
34
  import {
35
35
  V2_MEMORY_CATEGORIES,
36
36
  CATEGORY_PRIORITY,
@@ -56,7 +56,7 @@ import {
56
56
  import {
57
57
  piHarnessKindFromExecutable,
58
58
  getErrorMessage
59
- } from "./index-y2g8rdmm.js";
59
+ } from "./index-06rdy9h6.js";
60
60
  import {
61
61
  getOrCreateSessionMeta,
62
62
  updateSessionMeta,
@@ -70,10 +70,10 @@ import {
70
70
  renderMessageByOrdinal2,
71
71
  renderVerboseRange2,
72
72
  renderItemByTag2
73
- } from "./index-9n1hyjck.js";
73
+ } from "./index-jy9fq8gp.js";
74
74
  import {
75
75
  getLastIndexedOrdinal
76
- } from "./index-wz66mger.js";
76
+ } from "./index-ywvhr524.js";
77
77
  import {
78
78
  setNoteLastReadAt,
79
79
  getPersistedCompactionMarkerState,
@@ -83,7 +83,7 @@ import {
83
83
  hasRawMessageProvider2,
84
84
  setRawMessageProvider2,
85
85
  readSessionChunk2
86
- } from "./index-9036v8ay.js";
86
+ } from "./index-4j5442b0.js";
87
87
  import {
88
88
  stableStringify
89
89
  } from "./index-jxm4bvm4.js";
@@ -109,7 +109,7 @@ import {
109
109
  } from "./index-yhzhdp3m.js";
110
110
  import {
111
111
  preflightLocalEmbeddingPooling
112
- } from "./index-zrbvwxtb.js";
112
+ } from "./index-38pf5bqw.js";
113
113
  import {
114
114
  withQueryEmbeddingDeadline,
115
115
  markProjectLoadUntrusted2,
@@ -121,7 +121,7 @@ import {
121
121
  unregisterProjectEmbedding2,
122
122
  getProjectEmbeddingSnapshot2,
123
123
  embedTextForProject2
124
- } from "./index-cmyk3bmf.js";
124
+ } from "./index-r6dj8rm9.js";
125
125
  import {
126
126
  directoryHasGitMetadata,
127
127
  resolveProjectIdentityForSession,
@@ -134,7 +134,7 @@ import {
134
134
  resolveMemoriesByIdsForSearch2,
135
135
  unifiedSearch2,
136
136
  formatSearchResults2
137
- } from "./index-bjeb4ya4.js";
137
+ } from "./index-babadndp.js";
138
138
  import {
139
139
  TODO_STATUSES,
140
140
  TODO_PRIORITIES,
@@ -184,7 +184,7 @@ import {
184
184
  } from "./index-xssjy4z9.js";
185
185
  import {
186
186
  renderSearchArchive2
187
- } from "./index-zggajt0j.js";
187
+ } from "./index-ch3rvpjg.js";
188
188
  import {
189
189
  computeNormalizedHash
190
190
  } from "./index-9x1f96r8.js";
@@ -1732,7 +1732,8 @@ var EMBEDDING_USER_ONLY_FIELDS = [
1732
1732
  "provider",
1733
1733
  "fallback_provider",
1734
1734
  "query_instruction",
1735
- "document_prefix"
1735
+ "document_prefix",
1736
+ "dimensions"
1736
1737
  ];
1737
1738
  var PERCENTAGE_THRESHOLD_REASON = "security: a repository may only raise compaction thresholds above the user's effective value; it cannot force earlier historian work or cloned-repo cost escalation.";
1738
1739
  var TOKEN_THRESHOLD_REASON = "security: a repository may only raise execute_threshold_tokens above the user's trusted token threshold; it cannot force earlier historian work or cloned-repo cost escalation.";
@@ -6554,6 +6555,7 @@ var EMBEDDING_AFFECTING_KEYS = new Set([
6554
6555
  "embedding.provider",
6555
6556
  "embedding.input_type",
6556
6557
  "embedding.truncate",
6558
+ "embedding.dimensions",
6557
6559
  "embedding.max_input_tokens",
6558
6560
  "embedding.query_input_type",
6559
6561
  "embedding.query_instruction",
@@ -6672,6 +6674,7 @@ function fallbackConfig(config, provider) {
6672
6674
  const queryInstruction = typeof raw.query_instruction === "string" || raw.query_instruction === false ? raw.query_instruction : undefined;
6673
6675
  const documentPrefix = typeof raw.document_prefix === "string" ? raw.document_prefix : undefined;
6674
6676
  const truncate = typeof raw.truncate === "string" ? raw.truncate.trim() : "";
6677
+ const dimensions = typeof raw.dimensions === "number" ? raw.dimensions : undefined;
6675
6678
  const maxInputTokens = typeof raw.max_input_tokens === "number" ? raw.max_input_tokens : undefined;
6676
6679
  if (provider === "off")
6677
6680
  return { provider: "off" };
@@ -6686,6 +6689,7 @@ function fallbackConfig(config, provider) {
6686
6689
  ...queryInstruction !== undefined ? { query_instruction: queryInstruction } : {},
6687
6690
  ...documentPrefix !== undefined ? { document_prefix: documentPrefix } : {},
6688
6691
  ...truncate ? { truncate } : {},
6692
+ ...dimensions !== undefined ? { dimensions } : {},
6689
6693
  ...maxInputTokens !== undefined ? { max_input_tokens: maxInputTokens } : {}
6690
6694
  };
6691
6695
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./index-gzk7d940.js";
3
+ } from "./index-aec63gtj.js";
4
4
  import {
5
5
  log2
6
6
  } from "./index-yxeg8zaa.js";
@@ -10,12 +10,12 @@ import {
10
10
  } from "./index-qm139qq2.js";
11
11
  import {
12
12
  LocalEmbeddingProvider
13
- } from "./index-zrbvwxtb.js";
13
+ } from "./index-38pf5bqw.js";
14
14
  import {
15
15
  OpenAICompatibleEmbeddingProvider,
16
16
  getProjectEmbeddingSnapshot2,
17
17
  embedBatchForProject2
18
- } from "./index-cmyk3bmf.js";
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
  }
@@ -9,7 +9,7 @@ import {
9
9
  } from "./index-7y60kyea.js";
10
10
  import {
11
11
  cleanUserText2
12
- } from "./index-9036v8ay.js";
12
+ } from "./index-4j5442b0.js";
13
13
  import {
14
14
  recordMessageFtsRowid2,
15
15
  recordIndexedMessageTime2,