@cortexkit/pi-magic-context 0.49.18 → 0.49.20

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 (59) hide show
  1. package/dist/auto-search-worker.js +53 -10
  2. package/dist/chunk-embedding-write-worker.js +29 -22
  3. package/dist/{compaction-marker-candidates-wjzqbspm.js → compaction-marker-candidates-fnm47jat.js} +3 -3
  4. package/dist/compaction-marker-candidates-worker.js +2 -2
  5. package/dist/compartment-chunk-embedding-81qesfjs.js +64 -0
  6. package/dist/embedding-backfill-56e871c6.js +24 -0
  7. package/dist/embedding-worker-process.js +2 -2
  8. package/dist/embedding-worker.js +5 -5
  9. package/dist/historian-calibration-extension.js +1 -1
  10. package/dist/index-54wmg4rj.js +82 -0
  11. package/dist/{index-xnch62s6.js → index-5n5zxs8e.js} +314 -127
  12. package/dist/{index-gdjv1nnd.js → index-5vgt1zeh.js} +6 -7
  13. package/dist/{index-qpq6w67c.js → index-6kb2xpw7.js} +2 -2
  14. package/dist/{index-d43hmn31.js → index-af9t637y.js} +68 -16
  15. package/dist/{index-z2rkv0mb.js → index-b8am7tns.js} +4 -4
  16. package/dist/{index-rhprywn6.js → index-bttctq07.js} +23 -5
  17. package/dist/{index-e1rza8gp.js → index-dzem6gn9.js} +1 -1
  18. package/dist/{index-2mmy81qt.js → index-e19qtjj0.js} +468 -18
  19. package/dist/{index-7bqrfyny.js → index-fgs78jyd.js} +12 -15
  20. package/dist/{index-d4dt19md.js → index-hqw0rt9k.js} +1 -1
  21. package/dist/{index-rrwv9y2k.js → index-hws5f0z9.js} +1 -1
  22. package/dist/{index-f18ec69t.js → index-jn44h81p.js} +1 -1
  23. package/dist/{index-xxn1tpnv.js → index-jt0g3hn0.js} +45 -28
  24. package/dist/{index-d8gc0112.js → index-jxjr7kz9.js} +3 -3
  25. package/dist/{index-4bv5bttd.js → index-kqb3d8bs.js} +9 -5
  26. package/dist/{index-gp928w10.js → index-mtvvhcw4.js} +10 -10
  27. package/dist/{index-1kcfwk9c.js → index-my0dn413.js} +1 -1
  28. package/dist/{index-apgwdby5.js → index-n4wyxcgr.js} +1 -1
  29. package/dist/{index-g7p75667.js → index-p63nwn5v.js} +2 -2
  30. package/dist/{index-svgkv4g2.js → index-qerzchrs.js} +2 -2
  31. package/dist/{index-vktahpdj.js → index-rfyvax95.js} +9 -3
  32. package/dist/{index-yygsh681.js → index-rgfb753z.js} +3 -3
  33. package/dist/{index-d21pdr8v.js → index-tb3d9trm.js} +2 -2
  34. package/dist/{index-vmcgew7x.js → index-v2epyzbm.js} +75 -57
  35. package/dist/{index-fvjthct0.js → index-vdy273xw.js} +107 -20
  36. package/dist/{index-jrap43gc.js → index-w1avzkdt.js} +1 -1
  37. package/dist/{index-r9f4f6s1.js → index-zhwwp8zz.js} +64 -8
  38. package/dist/index.js +1119 -247
  39. package/dist/{logger-dygt96rn.js → logger-shetp43v.js} +1 -1
  40. package/dist/{message-fts-rowid-map-cvpy2dmb.js → message-fts-rowid-map-bpexnsdj.js} +6 -5
  41. package/dist/{message-index-bounded-g9hgresf.js → message-index-bounded-d4r3weh0.js} +14 -13
  42. package/dist/{message-index-74qdqmq7.js → message-index-mvag9crh.js} +14 -13
  43. package/dist/{message-time-backfill-ssshbdy8.js → message-time-backfill-kc10yrcj.js} +3 -3
  44. package/dist/migration-worker.js +12 -11
  45. package/dist/{project-embedding-registry-vf1ncptn.js → project-embedding-registry-cfrg952x.js} +13 -12
  46. package/dist/raw-ordinal-warmup-worker.js +136 -101
  47. package/dist/{read-session-chunk-chepqmw5.js → read-session-chunk-7g4zvpd8.js} +9 -8
  48. package/dist/{read-session-raw-9s3xn7fc.js → read-session-raw-0fsjh10f.js} +4 -3
  49. package/dist/{safe-notification-target-2rkvkmw8.js → safe-notification-target-zcpchea6.js} +2 -2
  50. package/dist/search-archive-qbhp7e89.js +21 -0
  51. package/dist/{search-6ztbx25v.js → search-hp4g3g9v.js} +22 -21
  52. package/dist/{sqlite-fsp0sf3r.js → sqlite-d67n6dtr.js} +1 -1
  53. package/dist/{storage-memory-yxxc5v4n.js → storage-memory-9g882j7a.js} +2 -2
  54. package/dist/{storage-tags-1kets0q8.js → storage-tags-m2qcp1g2.js} +7 -5
  55. package/dist/subagent-entry.js +26 -25
  56. package/dist/tag-snapshot-worker-pi.js +66 -55
  57. package/package.json +1 -1
  58. package/dist/embedding-backfill-vwag34t0.js +0 -23
  59. package/dist/search-archive-jg4a1kcx.js +0 -20
@@ -17,7 +17,7 @@ import {
17
17
  getMagicContextStorageDir,
18
18
  log2,
19
19
  sessionLog2
20
- } from "./index-7bqrfyny.js";
20
+ } from "./index-fgs78jyd.js";
21
21
  import {
22
22
  piModelRefToCanonical,
23
23
  modelRefLookupOrder,
@@ -54,6 +54,7 @@ import {
54
54
  serializeStrippedPlaceholderState,
55
55
  THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
56
56
  THINKING_BINDING_STRIP_ORDER_END_MARKER,
57
+ COMPACTION_OFF_THINKING_FROZEN_PREFIX,
57
58
  parseProcessedImageMarkers,
58
59
  serializeProcessedImageMarkers,
59
60
  getPendingPiCompactionMarkerState,
@@ -66,7 +67,7 @@ import {
66
67
  visitRawSessionMessages2,
67
68
  readRawSessionMessageById2,
68
69
  readSessionChunk2
69
- } from "./index-r9f4f6s1.js";
70
+ } from "./index-zhwwp8zz.js";
70
71
  import {
71
72
  isRecord,
72
73
  providerVisibleMessage,
@@ -80,25 +81,25 @@ import {
80
81
  getTagNumberByMessageId2,
81
82
  getTagsBySession2,
82
83
  getTagById2
83
- } from "./index-rhprywn6.js";
84
+ } from "./index-bttctq07.js";
84
85
  import {
85
86
  estimateTokens
86
- } from "./index-1kcfwk9c.js";
87
+ } from "./index-my0dn413.js";
87
88
  import {
88
89
  inRootAsyncContext2,
89
90
  Database2,
90
91
  withSqliteBackgroundWriter2,
91
92
  withoutSqliteTransformPass2
92
- } from "./index-rrwv9y2k.js";
93
+ } from "./index-hws5f0z9.js";
93
94
  import {
94
95
  stableStringify,
95
96
  closeQuietly,
96
97
  getTableColumnNames
97
- } from "./index-jrap43gc.js";
98
+ } from "./index-w1avzkdt.js";
98
99
  import {
99
100
  piHarnessKindFromExecutable,
100
101
  isPidAlive
101
- } from "./index-apgwdby5.js";
102
+ } from "./index-n4wyxcgr.js";
102
103
  import {
103
104
  BoundedSessionMap,
104
105
  clearLkgFenceProcessState,
@@ -108,21 +109,21 @@ import {
108
109
  V2StoreReader,
109
110
  deleteSessionScopedRows,
110
111
  getLastIndexedOrdinal2
111
- } from "./index-fvjthct0.js";
112
+ } from "./index-vdy273xw.js";
112
113
  import {
113
114
  resolveOpenCodeDbPath,
114
115
  assertOpenCodeStoreGeneration
115
116
  } from "./index-8976mezv.js";
116
117
  import {
117
118
  noteRawSessionSummaryRowWritten2
118
- } from "./index-vktahpdj.js";
119
+ } from "./index-rfyvax95.js";
119
120
  import {
120
121
  SubcClient,
121
122
  connectionFileExists,
122
123
  SYNAPSE_DEFAULT_MODEL,
123
124
  toSynapseLaneDescriptor,
124
125
  SynapseEmbeddingProvider
125
- } from "./index-d8gc0112.js";
126
+ } from "./index-jxjr7kz9.js";
126
127
  import {
127
128
  invalidateAutoEmbedSession,
128
129
  drainBackgroundBatches,
@@ -135,10 +136,10 @@ import {
135
136
  unregisterProjectEmbedding2,
136
137
  getProjectEmbeddingSnapshot2,
137
138
  embedTextForProject2
138
- } from "./index-vmcgew7x.js";
139
+ } from "./index-v2epyzbm.js";
139
140
  import {
140
141
  getErrorMessage
141
- } from "./index-gp928w10.js";
142
+ } from "./index-mtvvhcw4.js";
142
143
  import {
143
144
  V2_MEMORY_CATEGORIES,
144
145
  CATEGORY_PRIORITY,
@@ -152,13 +153,13 @@ import {
152
153
  expandWorkspaceIdentitySetWithAliases,
153
154
  resolveStoredPathWorkspaceIdentity,
154
155
  storedPathBelongsToWorkspace
155
- } from "./index-gdjv1nnd.js";
156
+ } from "./index-5vgt1zeh.js";
156
157
  import {
157
158
  directoryHasGitMetadata,
158
159
  resolveProjectIdentityForSession,
159
160
  normalizeStoredProjectPath,
160
161
  storedPathBelongsToIdentity
161
- } from "./index-g7p75667.js";
162
+ } from "./index-p63nwn5v.js";
162
163
  import {
163
164
  getNoteByIdInScope,
164
165
  getNotes,
@@ -174,7 +175,7 @@ import {
174
175
  resolveMemoriesByIdsForSearch2,
175
176
  unifiedSearch2,
176
177
  formatSearchResults2
177
- } from "./index-d43hmn31.js";
178
+ } from "./index-af9t637y.js";
178
179
  import {
179
180
  computeCueContentHash,
180
181
  getMuralCueState,
@@ -190,25 +191,28 @@ import {
190
191
  supersededMemory2,
191
192
  mergeMemoryStats2,
192
193
  archiveMemory2
193
- } from "./index-e1rza8gp.js";
194
+ } from "./index-dzem6gn9.js";
194
195
  import {
195
196
  saveEmbedding,
196
197
  invalidateMemory2
197
198
  } from "./index-yhzhdp3m.js";
199
+ import {
200
+ preflightLocalEmbeddingPooling
201
+ } from "./index-e19qtjj0.js";
198
202
  import {
199
203
  isMarkerCandidateBasisCurrent2,
200
204
  invalidateMarkerCandidateBasis2,
201
205
  readMarkerCandidateBasis2
202
- } from "./index-qpq6w67c.js";
206
+ } from "./index-6kb2xpw7.js";
203
207
  import {
204
208
  renderSearchArchive2
205
- } from "./index-d21pdr8v.js";
209
+ } from "./index-tb3d9trm.js";
206
210
  import {
207
211
  computeNormalizedHash
208
212
  } from "./index-9x1f96r8.js";
209
213
  import {
210
214
  logSlowWriteTransaction
211
- } from "./index-d4dt19md.js";
215
+ } from "./index-hqw0rt9k.js";
212
216
  import {
213
217
  ensureStorageDirectorySync,
214
218
  writeStorageFileAtomicSync
@@ -5221,11 +5225,15 @@ function clonePiContentDecisions(raw, filter) {
5221
5225
  ])}`);
5222
5226
  continue;
5223
5227
  }
5224
- if (entry.startsWith(THINKING_BINDING_RECOVERY_FROZEN_PREFIX)) {
5225
- const messageId = entry.slice(THINKING_BINDING_RECOVERY_FROZEN_PREFIX.length);
5228
+ const thinkingPrefix = [
5229
+ THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
5230
+ COMPACTION_OFF_THINKING_FROZEN_PREFIX
5231
+ ].find((prefix) => entry.startsWith(prefix));
5232
+ if (thinkingPrefix) {
5233
+ const messageId = entry.slice(thinkingPrefix.length);
5226
5234
  if (messageId.length === 0 || !filter.includeMessageId(messageId))
5227
5235
  continue;
5228
- copied.push(`${THINKING_BINDING_RECOVERY_FROZEN_PREFIX}${mapMessageId(filter, messageId) ?? messageId}`);
5236
+ copied.push(`${thinkingPrefix}${mapMessageId(filter, messageId) ?? messageId}`);
5229
5237
  continue;
5230
5238
  }
5231
5239
  if (entry.startsWith(MERGED_REASONING_PARTS_PREFIX) || entry.startsWith("pi-content-replay-"))
@@ -9927,7 +9935,7 @@ function unregisterPiProjectEmbeddings(db) {
9927
9935
  registeredIdentitiesByDatabase.delete(db);
9928
9936
  registrationFingerprintsByDatabase.get(db)?.clear();
9929
9937
  }
9930
- async function ensureProjectRegisteredFromPiDirectory(directory, db) {
9938
+ async function ensureProjectRegisteredFromPiDirectory(directory, db, options = {}) {
9931
9939
  const detailed = loadPiConfigDetailed({ cwd: directory });
9932
9940
  const projectIdentity = resolveProjectIdentityForSession(directory, detailed.config.allow_home_project);
9933
9941
  if (!projectIdentity)
@@ -9958,6 +9966,9 @@ async function ensureProjectRegisteredFromPiDirectory(directory, db) {
9958
9966
  memoryEnabled: detailed.config.memory.enabled,
9959
9967
  gitCommitEnabled: detailed.config.memory.git_commit_indexing.enabled
9960
9968
  };
9969
+ if (options.preflightLocalPooling && routing.primary.provider === "local") {
9970
+ await preflightLocalEmbeddingPooling(routing.primary.model ?? "Xenova/all-MiniLM-L6-v2");
9971
+ }
9961
9972
  let registered = registeredIdentitiesByDatabase.get(db);
9962
9973
  if (!registered) {
9963
9974
  registered = new Set;
@@ -12712,7 +12723,7 @@ function createCtxReduceTool(deps) {
12712
12723
  params = unwrapImitatedReducedArgs(params, ["drop"], { drop: "string" });
12713
12724
  const sessionId = ctx.sessionManager.getSessionId();
12714
12725
  if (!params.drop) {
12715
- return err4("Error: 'drop' must be provided.");
12726
+ return err4(`Error: 'drop' must be provided as a string of tag numbers, for example {"drop": "3-5,8"}.`);
12716
12727
  }
12717
12728
  let dropIds = [];
12718
12729
  try {
@@ -12876,7 +12887,7 @@ function createCtxSearchTool(deps) {
12876
12887
  label: "Magic Context: Search",
12877
12888
  description: CTX_SEARCH_DESCRIPTION,
12878
12889
  parameters: ParamsSchema4,
12879
- async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
12890
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
12880
12891
  params = unwrapImitatedReducedArgs(params, ["query"], {
12881
12892
  query: "string",
12882
12893
  limit: "number",
@@ -12972,6 +12983,7 @@ function createCtxSearchTool(deps) {
12972
12983
  gitRepositoryAvailable: directoryHasGitMetadata(ctx.cwd),
12973
12984
  explicitSearch: true,
12974
12985
  rerankConnectionFile: deps.rerankConnectionFile,
12986
+ signal,
12975
12987
  ...dateRange
12976
12988
  });
12977
12989
  return {
@@ -13516,6 +13528,11 @@ function createTodowriteTool() {
13516
13528
 
13517
13529
  // src/tools/index.ts
13518
13530
  var CTX_MEMORY_TOOL_NAME = "ctx_memory";
13531
+ function setOmpEssentialLoadMode(definition) {
13532
+ if (resolvePiHarnessKind() !== "omp")
13533
+ return definition;
13534
+ return Object.assign(definition, { loadMode: "essential" });
13535
+ }
13519
13536
  function syncCtxMemoryToolEnabled(pi, memoryEnabled) {
13520
13537
  const activeTools = pi.getActiveTools();
13521
13538
  const isActive = activeTools.includes(CTX_MEMORY_TOOL_NAME);
@@ -13534,11 +13551,11 @@ function registerMagicContextTools(pi, opts) {
13534
13551
  const surfaceTool = (definition) => {
13535
13552
  const parameters = structuredClone(definition.parameters);
13536
13553
  applyJsonSchemaParameterDescriptions(definition.name, parameters, registration.preset, smartNotesAvailable ? opts.smartNotesEnabled : false);
13537
- return throwReturnedToolErrors({
13554
+ return setOmpEssentialLoadMode(throwReturnedToolErrors({
13538
13555
  ...definition,
13539
13556
  parameters,
13540
13557
  description: definition.name === "ctx_note" && !smartNotesAvailable ? withoutSmartNoteText(registration.preset === "light" ? CTX_NOTE_LIGHT_DESCRIPTION : definition.description) : registration.descriptionFor(definition.name, definition.description)
13541
- });
13558
+ }));
13542
13559
  };
13543
13560
  pi.registerTool(surfaceTool(createCtxSearchTool({
13544
13561
  db: opts.db,
@@ -13560,7 +13577,7 @@ function registerMagicContextTools(pi, opts) {
13560
13577
  };
13561
13578
  pi.registerTool(surfaceTool(createCtxMemoryTool(memoryDeps)));
13562
13579
  if (opts.allowDreamerActions === true) {
13563
- pi.registerTool(throwReturnedToolErrors(createCtxMemoryListTool(memoryDeps)));
13580
+ pi.registerTool(setOmpEssentialLoadMode(throwReturnedToolErrors(createCtxMemoryListTool(memoryDeps))));
13564
13581
  }
13565
13582
  }
13566
13583
  if (!opts.sessionScopedToolsDisabled) {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./index-1kcfwk9c.js";
3
+ } from "./index-my0dn413.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./index-0h2mkab2.js";
7
7
  import {
8
8
  log2
9
- } from "./index-7bqrfyny.js";
9
+ } from "./index-fgs78jyd.js";
10
10
  import {
11
11
  inRootAsyncContext2
12
- } from "./index-rrwv9y2k.js";
12
+ } from "./index-hws5f0z9.js";
13
13
 
14
14
  // ../plugin/src/features/magic-context/memory/embedding-synapse.ts
15
15
  import { createHash } from "node:crypto";
@@ -3,18 +3,21 @@ import {
3
3
  tagRevisionCountSql,
4
4
  tagRevisionKey,
5
5
  TAG_INSERT_CONFLICT_ROWS
6
- } from "./index-jrap43gc.js";
6
+ } from "./index-w1avzkdt.js";
7
7
  import {
8
8
  getTagsBySession2,
9
9
  getTagsByNumbers2
10
- } from "./index-rhprywn6.js";
10
+ } from "./index-bttctq07.js";
11
11
  import {
12
12
  inRootAsyncContext2,
13
13
  getSqliteDatabasePath2
14
- } from "./index-rrwv9y2k.js";
14
+ } from "./index-hws5f0z9.js";
15
15
  import {
16
16
  createFailClosedBlockingError
17
- } from "./index-gp928w10.js";
17
+ } from "./index-mtvvhcw4.js";
18
+ import {
19
+ createWorkerShutdown
20
+ } from "./index-54wmg4rj.js";
18
21
 
19
22
  // src/tag-snapshot-worker-client-pi.ts
20
23
  import { setImmediate as yieldImmediate } from "node:timers/promises";
@@ -228,6 +231,7 @@ function startPiTagSnapshotWorker(request, options = {}) {
228
231
  const started = performance.now();
229
232
  const consumer = createPiHydrationPacketConsumer(request, options.cached, options.byteLimit);
230
233
  const worker = inRootAsyncContext2(() => new Worker(entry, { workerData: request }));
234
+ const shutdown = createWorkerShutdown(worker, "pi-tag-snapshot", 1000);
231
235
  let exited = false;
232
236
  let settled = false;
233
237
  let consumption = Promise.resolve();
@@ -292,7 +296,7 @@ function startPiTagSnapshotWorker(request, options = {}) {
292
296
  clearTimeout(timer);
293
297
  rejectResult(error);
294
298
  if (!exited)
295
- worker.terminate().catch(() => {});
299
+ shutdown.close();
296
300
  }
297
301
  const timer = inRootAsyncContext2(() => setTimeout(() => abort(new PiTagHydrationError("job deadline exceeded", "deadline")), options.deadlineMs ?? 1e4));
298
302
  timer.unref();
@@ -5,7 +5,7 @@ import {
5
5
  importPluginModule,
6
6
  writeForwardedLogLine2,
7
7
  log2
8
- } from "./index-7bqrfyny.js";
8
+ } from "./index-fgs78jyd.js";
9
9
  import {
10
10
  inRootAsyncContext2,
11
11
  registerSlowWriteReporter2,
@@ -16,10 +16,10 @@ import {
16
16
  withoutSqliteTransformPass2,
17
17
  isTransientSqliteError2,
18
18
  withPrivilegedWriter2
19
- } from "./index-rrwv9y2k.js";
19
+ } from "./index-hws5f0z9.js";
20
20
  import {
21
21
  scheduleAfterBootQuiet
22
- } from "./index-g7p75667.js";
22
+ } from "./index-p63nwn5v.js";
23
23
  import {
24
24
  getHarness2,
25
25
  harnessOwnsOpenCodeStore2
@@ -34,13 +34,13 @@ import {
34
34
  parseRpcPortFile,
35
35
  inspectProcessesAsync,
36
36
  inspectWindowsProcessesSync
37
- } from "./index-apgwdby5.js";
37
+ } from "./index-n4wyxcgr.js";
38
38
  import {
39
39
  configureContextDatabasePragmas2
40
40
  } from "./index-fapenpch.js";
41
41
  import {
42
42
  startMessageFtsRowidMapBackfill2
43
- } from "./index-yygsh681.js";
43
+ } from "./index-rgfb753z.js";
44
44
  import {
45
45
  LKG_SLOT_CHUNKS_DDL,
46
46
  SESSION_REPLAY_DECISIONS_DDL,
@@ -50,13 +50,13 @@ import {
50
50
  hasPendingMigrations,
51
51
  getMainThreadMigrationBodyCount,
52
52
  runMigrations
53
- } from "./index-gdjv1nnd.js";
53
+ } from "./index-5vgt1zeh.js";
54
54
  import {
55
55
  closeQuietly,
56
56
  ensureColumn,
57
57
  installV95PerfSchema,
58
58
  installTagIdentityRevisionTrigger
59
- } from "./index-jrap43gc.js";
59
+ } from "./index-w1avzkdt.js";
60
60
  import {
61
61
  resolveOpenCodeDbPath,
62
62
  hasV1MessageTables,
@@ -65,7 +65,7 @@ import {
65
65
  } from "./index-8976mezv.js";
66
66
  import {
67
67
  logSlowWriteTransaction
68
- } from "./index-d4dt19md.js";
68
+ } from "./index-hqw0rt9k.js";
69
69
  import {
70
70
  shouldEnforcePrivateStoragePermissions,
71
71
  ensureStorageDirectorySync,
@@ -1305,8 +1305,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1305
1305
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1306
1306
  if (signal.aborted || !readsOpenCodeStore)
1307
1307
  return;
1308
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-chepqmw5.js"));
1309
- const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-ssshbdy8.js"));
1308
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-7g4zvpd8.js"));
1309
+ const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-kc10yrcj.js"));
1310
1310
  if (signal.aborted)
1311
1311
  return;
1312
1312
  await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./index-7bqrfyny.js";
3
+ } from "./index-fgs78jyd.js";
4
4
 
5
5
  // ../plugin/src/hooks/magic-context/read-session-formatting.ts
6
6
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./index-7bqrfyny.js";
3
+ } from "./index-fgs78jyd.js";
4
4
 
5
5
  // ../plugin/src/shared/rpc-utils.ts
6
6
  import { execFile, execFileSync } from "node:child_process";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getMagicContextStorageDir,
3
3
  log2
4
- } from "./index-7bqrfyny.js";
4
+ } from "./index-fgs78jyd.js";
5
5
  import {
6
6
  inRootAsyncContext2
7
- } from "./index-rrwv9y2k.js";
7
+ } from "./index-hws5f0z9.js";
8
8
  import {
9
9
  projectDirectoryKey
10
10
  } from "./index-wrr9rp9a.js";
@@ -3,10 +3,10 @@ import {
3
3
  } from "./index-0h2mkab2.js";
4
4
  import {
5
5
  isUserHomeDirectory
6
- } from "./index-g7p75667.js";
6
+ } from "./index-p63nwn5v.js";
7
7
  import {
8
8
  logSlowWriteTransaction
9
- } from "./index-d4dt19md.js";
9
+ } from "./index-hqw0rt9k.js";
10
10
 
11
11
  // ../plugin/src/features/magic-context/session-project-storage.ts
12
12
  var SESSION_CHUNK_REPAIR_BATCH_SIZE = 100;
@@ -2,13 +2,16 @@ import {
2
2
  inRootAsyncContext2,
3
3
  getSqliteDatabasePath2,
4
4
  releaseIndexOwner2
5
- } from "./index-rrwv9y2k.js";
5
+ } from "./index-hws5f0z9.js";
6
6
  import {
7
7
  registerExitAbort
8
8
  } from "./index-399p688g.js";
9
9
  import {
10
10
  log2
11
- } from "./index-7bqrfyny.js";
11
+ } from "./index-fgs78jyd.js";
12
+ import {
13
+ createWorkerShutdown
14
+ } from "./index-54wmg4rj.js";
12
15
 
13
16
  // ../plugin/src/hooks/magic-context/read-session-raw.ts
14
17
  import { isMainThread } from "node:worker_threads";
@@ -17,6 +20,7 @@ import { isMainThread } from "node:worker_threads";
17
20
  import { Worker } from "node:worker_threads";
18
21
  var ACCEPT_TIMEOUT_MS = 2000;
19
22
  var RESULT_TIMEOUT_MS = 10 * 60000;
23
+ var WARMUP_CLOSE_DEADLINE_MS = 2000;
20
24
  var FAILURE_BACKOFF_MS = 5 * 60000;
21
25
  var inFlight = new Map;
22
26
  var connectionIds = new WeakMap;
@@ -45,6 +49,7 @@ function runSessionWarmupWorker(input, options) {
45
49
  return new Promise((resolve) => {
46
50
  const openCancellation = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
47
51
  let worker;
52
+ let shutdown;
48
53
  let deadline;
49
54
  let settled = false;
50
55
  const finish = (result) => {
@@ -56,7 +61,7 @@ function runSessionWarmupWorker(input, options) {
56
61
  options.signal?.removeEventListener("abort", abort);
57
62
  if (worker) {
58
63
  activeWorkers.delete(worker);
59
- const stopped = worker.terminate();
64
+ const stopped = shutdown?.close() ?? worker.terminate();
60
65
  worker.unref();
61
66
  stopped.finally(() => {
62
67
  releaseIndexOwner2(input);
@@ -82,6 +87,7 @@ function runSessionWarmupWorker(input, options) {
82
87
  worker = inRootAsyncContext2(() => new Worker(options.entry ?? defaultEntry(), {
83
88
  workerData: { ...input, openCancellation: openCancellation.buffer }
84
89
  }));
90
+ shutdown = createWorkerShutdown(worker, "raw-ordinal-warmup", WARMUP_CLOSE_DEADLINE_MS);
85
91
  } catch (error) {
86
92
  finish({ failure: "start-failed", detail: String(error) });
87
93
  return;
@@ -2,13 +2,13 @@ import {
2
2
  getSqliteDatabasePath2,
3
3
  withSqliteBackgroundWriter2,
4
4
  withoutSqliteTransformPass2
5
- } from "./index-rrwv9y2k.js";
5
+ } from "./index-hws5f0z9.js";
6
6
  import {
7
7
  runSessionWarmupWorker
8
- } from "./index-vktahpdj.js";
8
+ } from "./index-rfyvax95.js";
9
9
  import {
10
10
  logSlowWriteTransaction
11
- } from "./index-d4dt19md.js";
11
+ } from "./index-hqw0rt9k.js";
12
12
 
13
13
  // ../plugin/src/features/magic-context/message-fts-rowid-map.ts
14
14
  import { createHash } from "node:crypto";
@@ -3,10 +3,10 @@ import {
3
3
  } from "./index-1cvyaw9a.js";
4
4
  import {
5
5
  estimateTokens
6
- } from "./index-1kcfwk9c.js";
6
+ } from "./index-my0dn413.js";
7
7
  import {
8
8
  readRawSessionMessageIdOrdinalsForRange2
9
- } from "./index-r9f4f6s1.js";
9
+ } from "./index-zhwwp8zz.js";
10
10
 
11
11
  // ../plugin/src/tools/ctx-expand/search-archive.ts
12
12
  var archiveReadsOnThisThread = 0;