@cortexkit/pi-magic-context 0.49.44 → 0.49.45

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 (39) hide show
  1. package/dist/auto-search-worker.js +4 -4
  2. package/dist/chunk-embedding-write-worker.js +6 -6
  3. package/dist/{compartment-chunk-embedding-jpcme6tz.js → compartment-chunk-embedding-nyjs3dfh.js} +5 -5
  4. package/dist/{embedding-backfill-v9b8gkmp.js → embedding-backfill-er9jc4xf.js} +8 -8
  5. package/dist/embedding-worker.js +3 -3
  6. package/dist/{index-wt7vmyj4.js → index-000fthre.js} +4 -0
  7. package/dist/{index-c1dqxr10.js → index-3g9fnq6y.js} +2 -1
  8. package/dist/{index-f9qet7y8.js → index-4sa1rx3h.js} +3 -3
  9. package/dist/{index-gtd9kaaf.js → index-6bedye3n.js} +6 -6
  10. package/dist/{index-j2x88zk0.js → index-7esg5v2x.js} +6 -3
  11. package/dist/{index-ck8wj35v.js → index-bbbp8zs1.js} +1 -1
  12. package/dist/{index-025nxwc9.js → index-fzadydec.js} +3 -3
  13. package/dist/{index-rzfr7wdv.js → index-gwvahsdz.js} +1 -1
  14. package/dist/{index-wwsfevck.js → index-jaqdcqwz.js} +1 -1
  15. package/dist/{index-fjmghcbx.js → index-k7gdgs11.js} +14 -13
  16. package/dist/{index-gg9r701n.js → index-nvgq29cw.js} +3 -3
  17. package/dist/{index-zttw4vew.js → index-qt711raa.js} +6 -6
  18. package/dist/{index-9tcbabqr.js → index-rcenqffj.js} +63 -21
  19. package/dist/{index-xf3ndcqd.js → index-tsg6swzr.js} +1 -1
  20. package/dist/{index-pb0ygvpa.js → index-v7m1nqwz.js} +2 -2
  21. package/dist/{index-p1jxxsth.js → index-wwf9vxpf.js} +2 -2
  22. package/dist/{index-pwp6zyx3.js → index-zchc0df8.js} +1 -1
  23. package/dist/{index-gajhgp4k.js → index-zwbgxt01.js} +3 -3
  24. package/dist/index.js +207 -30
  25. package/dist/{message-fts-rowid-map-hmgyfxxa.js → message-fts-rowid-map-ff4qg3e4.js} +2 -2
  26. package/dist/{message-index-bounded-1gj1pwjy.js → message-index-bounded-cqn6x6fc.js} +6 -6
  27. package/dist/migration-worker.js +4 -4
  28. package/dist/{project-embedding-registry-e81zewts.js → project-embedding-registry-ysaezfqw.js} +7 -7
  29. package/dist/raw-ordinal-warmup-worker.js +7 -7
  30. package/dist/{read-session-chunk-r9qy3jzj.js → read-session-chunk-0ecmbegv.js} +4 -4
  31. package/dist/{read-session-raw-a9ntjqap.js → read-session-raw-nttnwy8p.js} +1 -1
  32. package/dist/{render-dvmk12tf.js → render-s6k2xqhj.js} +10 -10
  33. package/dist/{search-archive-23s9g6dx.js → search-archive-qza20zkm.js} +6 -6
  34. package/dist/{search-khaxkbs1.js → search-p4fj69gn.js} +12 -12
  35. package/dist/{storage-tags-p9y3bnw7.js → storage-tags-g0j9mr4b.js} +2 -2
  36. package/dist/subagent-entry.js +17 -17
  37. package/dist/tag-snapshot-worker-pi.js +6 -6
  38. package/dist/{v2-archive-reader-z7qgxxp0.js → v2-archive-reader-2v7a879f.js} +1 -1
  39. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -150,7 +150,7 @@ import {
150
150
  registerTodoStateLifecycle,
151
151
  syncCtxMemoryToolEnabled,
152
152
  registerMagicContextTools
153
- } from "./index-fjmghcbx.js";
153
+ } from "./index-k7gdgs11.js";
154
154
  import"./index-4knyh1kt.js";
155
155
  import {
156
156
  canonicalModelIdentity,
@@ -353,7 +353,7 @@ import {
353
353
  getRawSessionTagKeysThrough2,
354
354
  getLegacyProtectedTailStartOrdinal2,
355
355
  readSessionChunk2
356
- } from "./index-j2x88zk0.js";
356
+ } from "./index-7esg5v2x.js";
357
357
  import {
358
358
  UNKNOWN_FIT_RATIO,
359
359
  hasMeasuredDecisionCalibration,
@@ -440,7 +440,7 @@ import {
440
440
  getToolTagNumberByOwner2,
441
441
  getNullOwnerToolTag2,
442
442
  adoptNullOwnerToolTag2
443
- } from "./index-pwp6zyx3.js";
443
+ } from "./index-zchc0df8.js";
444
444
  import {
445
445
  textMentionsRecentCommit,
446
446
  hasMeaningfulUserText2,
@@ -452,7 +452,7 @@ import {
452
452
  estimateTokens,
453
453
  estimateFixedPromptTokens,
454
454
  normalizeText
455
- } from "./index-wt7vmyj4.js";
455
+ } from "./index-000fthre.js";
456
456
  import {
457
457
  inRootAsyncContext2,
458
458
  Database2,
@@ -490,7 +490,7 @@ import {
490
490
  openCurrentDatabase,
491
491
  openDatabaseAsync,
492
492
  closeDatabase
493
- } from "./index-p1jxxsth.js";
493
+ } from "./index-wwf9vxpf.js";
494
494
  import {
495
495
  LkgRecoveryFenceError,
496
496
  clearLkgFenceProcessState,
@@ -607,7 +607,7 @@ import {
607
607
  getSourceContents,
608
608
  recordSubagentInvocation,
609
609
  getLatestHistorianInvocationId
610
- } from "./index-gtd9kaaf.js";
610
+ } from "./index-6bedye3n.js";
611
611
  import {
612
612
  resolveOpenCodeDbPath,
613
613
  assertOpenCodeStoreGeneration,
@@ -625,12 +625,12 @@ import {
625
625
  } from "./index-x2n261wp.js";
626
626
  import {
627
627
  RAW_SUMMARY_TEXT_MAX_CHARS2
628
- } from "./index-c1dqxr10.js";
628
+ } from "./index-3g9fnq6y.js";
629
629
  import"./index-ea37qn4x.js";
630
630
  import {
631
631
  formatSynapseLaneDescriptor
632
- } from "./index-rzfr7wdv.js";
633
- import"./index-ck8wj35v.js";
632
+ } from "./index-gwvahsdz.js";
633
+ import"./index-bbbp8zs1.js";
634
634
  import {
635
635
  buildCanonicalChunkTextFromFts2,
636
636
  buildCompartmentSummaryFallbackText2,
@@ -640,7 +640,7 @@ import {
640
640
  replaceCompartmentChunkEmbeddings2,
641
641
  deleteChunkEmbedBackoffForSession2,
642
642
  chunkWindowSourceKey2
643
- } from "./index-f9qet7y8.js";
643
+ } from "./index-4sa1rx3h.js";
644
644
  import {
645
645
  recordSessionProjectIdentity,
646
646
  GIT_SWEEP_LEASE_RENEWAL_MS,
@@ -665,7 +665,7 @@ import {
665
665
  clearCompressionDepthRange,
666
666
  cleanSearchText,
667
667
  matchedSearchSnippet
668
- } from "./index-025nxwc9.js";
668
+ } from "./index-fzadydec.js";
669
669
  import {
670
670
  rememberV1HiddenRun
671
671
  } from "./index-6x556c2q.js";
@@ -742,7 +742,7 @@ import {
742
742
  } from "./index-q1yc6bs0.js";
743
743
  import {
744
744
  getCachedLocalEmbeddingPooling
745
- } from "./index-xf3ndcqd.js";
745
+ } from "./index-tsg6swzr.js";
746
746
  import {
747
747
  describeShadowBackfillWriteRefusal2,
748
748
  contentSha2562,
@@ -760,10 +760,10 @@ import {
760
760
  embedSessionCompartmentChunks2,
761
761
  getEmbeddingCoverageStatus2,
762
762
  getAutoEmbeddingSessionCoverage2
763
- } from "./index-9tcbabqr.js";
763
+ } from "./index-rcenqffj.js";
764
764
  import {
765
765
  cosineSimilarity
766
- } from "./index-gajhgp4k.js";
766
+ } from "./index-zwbgxt01.js";
767
767
  import {
768
768
  USER_FACING_FAILURES,
769
769
  renderUserFacingFailure,
@@ -797,7 +797,7 @@ import {
797
797
  scheduleClearAndReindex,
798
798
  clearSessionTracking,
799
799
  createAutoSearchDiagnostics
800
- } from "./index-zttw4vew.js";
800
+ } from "./index-qt711raa.js";
801
801
  import"./index-2kmwjq42.js";
802
802
  import {
803
803
  DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS,
@@ -825,11 +825,11 @@ import {
825
825
  drainPiTagSnapshotSession,
826
826
  assertPiTagSnapshotReady,
827
827
  ensurePiTagSnapshotReady
828
- } from "./index-wwsfevck.js";
828
+ } from "./index-jaqdcqwz.js";
829
829
  import"./index-cq71g4dk.js";
830
830
  import"./index-1cvyaw9a.js";
831
- import"./index-gg9r701n.js";
832
- import"./index-pb0ygvpa.js";
831
+ import"./index-nvgq29cw.js";
832
+ import"./index-v7m1nqwz.js";
833
833
  import {
834
834
  __toESM
835
835
  } from "./index-22jkk6wg.js";
@@ -3584,7 +3584,7 @@ function startHostStallProfilerSwitch() {
3584
3584
  // package.json
3585
3585
  var package_default = {
3586
3586
  name: "@cortexkit/pi-magic-context",
3587
- version: "0.49.44",
3587
+ version: "0.49.45",
3588
3588
  type: "module",
3589
3589
  description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
3590
3590
  main: "dist/index.js",
@@ -22545,7 +22545,8 @@ var TOOL_KEYS = [
22545
22545
  "query",
22546
22546
  "symbol",
22547
22547
  "module",
22548
- "action"
22548
+ "action",
22549
+ "command"
22549
22550
  ];
22550
22551
  function record2(value) {
22551
22552
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -35342,6 +35343,16 @@ function repairPiHistoryBoundary(db, sessionId, ctx, branchEntries) {
35342
35343
  }
35343
35344
 
35344
35345
  // src/native-replay-pi.ts
35346
+ var DROP_PLACEHOLDER = /^\[dropped §\d+§\]$/u;
35347
+ var TAG_LABEL = /^§\d+§ /u;
35348
+ var RESPONSES_APIS = new Set([
35349
+ "openai-responses",
35350
+ "azure-openai-responses",
35351
+ "openai-codex-responses"
35352
+ ]);
35353
+ function isPiDropPlaceholder(text) {
35354
+ return DROP_PLACEHOLDER.test(text);
35355
+ }
35345
35356
  function getNativeEnvelope(message) {
35346
35357
  if (!isRecord(message) || isPiSystemEntry(message))
35347
35358
  return;
@@ -35428,11 +35439,142 @@ function textIdentity(part) {
35428
35439
  } catch {}
35429
35440
  return;
35430
35441
  }
35431
- function rewriteNativeAssistantTexts(message, previous, sessionId) {
35442
+ function nativeTextSlots(content, items) {
35443
+ const slots = [];
35444
+ for (let itemIndex = 0;itemIndex < items.length; itemIndex++) {
35445
+ const item = items[itemIndex];
35446
+ if (!isRecord(item))
35447
+ return;
35448
+ if (item.type === "reasoning" || item.type === "function_call" || item.type === "custom_tool_call")
35449
+ continue;
35450
+ if (item.type !== "message" || item.role !== "assistant" || !Array.isArray(item.content))
35451
+ return;
35452
+ for (let outputIndex = 0;outputIndex < item.content.length; outputIndex++) {
35453
+ const output = item.content[outputIndex];
35454
+ if (!isRecord(output) || output.type !== "output_text" || typeof output.text !== "string")
35455
+ return;
35456
+ slots.push({ itemIndex, outputIndex, text: output.text });
35457
+ }
35458
+ }
35459
+ const blocks = content.filter((block) => isRecord(block) && block.type === "text").length;
35460
+ return slots.length === blocks ? slots : undefined;
35461
+ }
35462
+ function hookRewrittenSlot(previous, partIndex, items) {
35463
+ const slots = nativeTextSlots(previous, items);
35464
+ if (!slots)
35465
+ return;
35466
+ let ordinal = 0;
35467
+ let target;
35468
+ for (let index = 0;index < previous.length; index++) {
35469
+ const block = previous[index];
35470
+ if (!isRecord(block) || block.type !== "text")
35471
+ continue;
35472
+ const slot = slots[ordinal++];
35473
+ const item = items[slot.itemIndex];
35474
+ if (typeof block.text !== "string")
35475
+ return;
35476
+ if ("textSignature" in block) {
35477
+ const identity = textIdentity(block);
35478
+ if (index === partIndex || !identity || item.id !== identity.id || item.phase !== identity.phase)
35479
+ return;
35480
+ continue;
35481
+ }
35482
+ const stripped = stripPersistedAssistantText(slot.text);
35483
+ if (stripped !== block.text.replace(TAG_LABEL, ""))
35484
+ return;
35485
+ if (index !== partIndex)
35486
+ continue;
35487
+ if (stripped === slot.text || item.content.length !== 1)
35488
+ return;
35489
+ target = slot;
35490
+ }
35491
+ return target;
35492
+ }
35493
+ function emptyAssistantMessage(item) {
35494
+ if (item.type !== "message" || item.role !== "assistant")
35495
+ return false;
35496
+ if (typeof item.content === "string")
35497
+ return !/\S/u.test(item.content);
35498
+ return Array.isArray(item.content) && !item.content.some((part) => isRecord(part) && (part.type === "output_text" && typeof part.text === "string" && /\S/u.test(part.text) || part.type === "refusal" && typeof part.refusal === "string" && /\S/u.test(part.refusal)));
35499
+ }
35500
+ function replayableNativeItems(message, model) {
35501
+ const payload = message.providerPayload;
35502
+ if (message.api !== model.api || message.model !== model.id || !isRecord(payload) || payload.type !== "openaiResponsesHistory" || !Array.isArray(payload.items) || (payload.provider ?? message.provider ?? model.provider) !== model.provider)
35503
+ return;
35504
+ return payload.items.some((item) => !isRecord(item) || item.type !== "reasoning" && !emptyAssistantMessage(item)) ? payload.items : undefined;
35505
+ }
35506
+ function signedItemText(block, items) {
35507
+ const identity = textIdentity(block);
35508
+ if (!identity)
35509
+ return;
35510
+ const matches = items.filter((item) => isRecord(item) && item.type === "message" && item.role === "assistant" && item.id === identity.id && item.phase === identity.phase);
35511
+ const outputs = matches.length === 1 && Array.isArray(matches[0].content) ? matches[0].content.filter((output) => isRecord(output) && output.type === "output_text") : [];
35512
+ const text = outputs[0]?.text;
35513
+ return outputs.length === 1 && typeof text === "string" ? text : undefined;
35514
+ }
35515
+ function piNativeDropExpectations(messages, model) {
35516
+ const expectations = [];
35517
+ if (!model || !RESPONSES_APIS.has(String(model.api)))
35518
+ return expectations;
35519
+ for (let index = 0;index < messages.length; index++) {
35520
+ const message = messages[index];
35521
+ if (!isRecord(message) || message.role !== "assistant" || !Array.isArray(message.content) || !message.content.some((block) => isRecord(block) && block.type === "text" && typeof block.text === "string" && isPiDropPlaceholder(block.text)))
35522
+ continue;
35523
+ const items = replayableNativeItems(message, model);
35524
+ if (!items)
35525
+ continue;
35526
+ const slots = nativeTextSlots(message.content, items);
35527
+ let ordinal = 0;
35528
+ for (const block of message.content) {
35529
+ if (!isRecord(block) || block.type !== "text")
35530
+ continue;
35531
+ const slot = slots?.[ordinal++];
35532
+ if (typeof block.text !== "string" || !isPiDropPlaceholder(block.text))
35533
+ continue;
35534
+ const native = "textSignature" in block ? signedItemText(block, items) : slot?.text;
35535
+ expectations.push({
35536
+ message: index,
35537
+ placeholder: block.text,
35538
+ ...native !== undefined && native !== block.text ? { stale: native } : {}
35539
+ });
35540
+ }
35541
+ }
35542
+ return expectations;
35543
+ }
35544
+ function wireAssistantTexts(payload) {
35545
+ const input = isRecord(payload) ? payload.input : undefined;
35546
+ if (!Array.isArray(input))
35547
+ return;
35548
+ const texts = new Set;
35549
+ for (const item of input) {
35550
+ if (!isRecord(item) || item.role !== "assistant")
35551
+ continue;
35552
+ if (typeof item.content === "string")
35553
+ texts.add(item.content);
35554
+ else if (Array.isArray(item.content)) {
35555
+ for (const part of item.content)
35556
+ if (isRecord(part) && typeof part.text === "string")
35557
+ texts.add(part.text);
35558
+ }
35559
+ }
35560
+ return texts;
35561
+ }
35562
+ function piNativeDropWireMismatch(payload, expectations) {
35563
+ if (!expectations?.length)
35564
+ return;
35565
+ const texts = wireAssistantTexts(payload);
35566
+ for (const expected of expectations)
35567
+ if (!texts?.has(expected.placeholder) || expected.stale !== undefined && texts.has(expected.stale))
35568
+ return `message=${expected.message} comparison=native_drop`;
35569
+ return;
35570
+ }
35571
+ function rewriteNativeAssistantTexts(message, previous, sessionId, options = {}) {
35432
35572
  const envelope = getNativeEnvelope(message);
35433
35573
  if (envelope?.message.role !== "assistant" || !isRecord(previous) || !Array.isArray(previous.content) || !Array.isArray(envelope.message.content))
35434
35574
  return;
35435
35575
  const content = envelope.message.content;
35576
+ const arrivedItems = envelope.items;
35577
+ const unsignedDrops = options.unsignedDrops === true && RESPONSES_APIS.has(String(envelope.message.api)) && envelope.payload.dt === true;
35436
35578
  for (let index = 0;index < content.length; index++) {
35437
35579
  const part = content[index];
35438
35580
  const before = previous.content[index];
@@ -35441,6 +35583,23 @@ function rewriteNativeAssistantTexts(message, previous, sessionId) {
35441
35583
  if (part.text.replace(/^§\d+§ /u, "") === before.text.replace(/^§\d+§ /u, ""))
35442
35584
  continue;
35443
35585
  const identity = textIdentity(part);
35586
+ if (identity === undefined && unsignedDrops && isPiDropPlaceholder(part.text) && !("textSignature" in part)) {
35587
+ const slot = hookRewrittenSlot(previous.content, index, arrivedItems);
35588
+ if (slot) {
35589
+ const item = envelope.items[slot.itemIndex];
35590
+ const outputs = item.content.slice();
35591
+ outputs[slot.outputIndex] = {
35592
+ ...outputs[slot.outputIndex],
35593
+ text: part.text
35594
+ };
35595
+ const items = envelope.items.slice();
35596
+ items[slot.itemIndex] = { ...item, content: outputs };
35597
+ envelope.items = items;
35598
+ envelope.payload = { ...envelope.payload, items };
35599
+ envelope.message.providerPayload = envelope.payload;
35600
+ continue;
35601
+ }
35602
+ }
35444
35603
  const sameIdentity = (value) => {
35445
35604
  const other = textIdentity(value);
35446
35605
  return identity !== undefined && other?.id === identity.id && other.phase === identity.phase;
@@ -37149,7 +37308,7 @@ function piExplainsOptionalAssistant(thinking, content) {
37149
37308
  }
37150
37309
 
37151
37310
  // src/pi-dispatch-tool-pairing.ts
37152
- var RESPONSES_APIS = new Set([
37311
+ var RESPONSES_APIS2 = new Set([
37153
37312
  "openai-responses",
37154
37313
  "openai-codex-responses",
37155
37314
  "azure-openai-responses"
@@ -37168,7 +37327,7 @@ function piToolCallPairing(messages) {
37168
37327
  const message = object7(value);
37169
37328
  if (message?.role !== "assistant" || !Array.isArray(message.content))
37170
37329
  continue;
37171
- const responses = RESPONSES_APIS.has(String(message.api));
37330
+ const responses = RESPONSES_APIS2.has(String(message.api));
37172
37331
  for (const part of message.content) {
37173
37332
  const block = object7(part);
37174
37333
  if (block?.type !== "toolCall" || typeof block.id !== "string")
@@ -37655,6 +37814,8 @@ function piResponsesAssistantTexts(value, model, host, alternatives, frozenTagSt
37655
37814
  texts.push(textIdentity2(text, undefined));
37656
37815
  continue;
37657
37816
  }
37817
+ if (host === "omp" && (block?.type === "image" || block?.type === "anthropicServerTool" || block?.type === "fallback" || block?.type === "redactedThinking" && !sameModel))
37818
+ continue;
37658
37819
  if (block?.type !== "text" || typeof block.text !== "string")
37659
37820
  return;
37660
37821
  units += block.text.length;
@@ -37693,7 +37854,9 @@ function piResponsesAssistantTexts(value, model, host, alternatives, frozenTagSt
37693
37854
  output = true;
37694
37855
  continue;
37695
37856
  }
37696
- if (item?.type !== "message" || item.role !== "assistant" || !Array.isArray(item.content))
37857
+ if (item?.type !== "message")
37858
+ return;
37859
+ if (item.role !== "assistant" || !Array.isArray(item.content))
37697
37860
  return texts;
37698
37861
  const itemTexts = [];
37699
37862
  for (const value of item.content) {
@@ -37711,11 +37874,12 @@ function piResponsesAssistantTexts(value, model, host, alternatives, frozenTagSt
37711
37874
  const signed = signature?.v === 1 && typeof signature.id === "string" && item.id === signature.id && item.phase === signature.phase && part.text === block.text.replace(/^§\d+§ /u, "");
37712
37875
  if (!signed) {
37713
37876
  const stripped = stripPersistedAssistantText(part.text);
37714
- if (!allowUnsigned || "textSignature" in block || stripped !== block.text.replace(/^§\d+§ /u, ""))
37877
+ const droppedPlaceholder = isPiDropPlaceholder(block.text) && part.text === block.text;
37878
+ if (!allowUnsigned || "textSignature" in block || !droppedPlaceholder && stripped !== block.text.replace(/^§\d+§ /u, ""))
37715
37879
  return texts;
37716
37880
  unsigned = true;
37717
- allUnsignedFrozen &&= part.text === block.text && ownsNativeResponseTagStrip(frozenTagStrips, item.id, item.phase, part.text);
37718
- rewrittenText ||= part.text !== stripped;
37881
+ allUnsignedFrozen &&= droppedPlaceholder || part.text === block.text && ownsNativeResponseTagStrip(frozenTagStrips, item.id, item.phase, part.text);
37882
+ rewrittenText ||= !droppedPlaceholder && part.text !== stripped;
37719
37883
  }
37720
37884
  bound++;
37721
37885
  itemTexts.push(part.text);
@@ -38183,7 +38347,12 @@ function preparePiDispatch(messages, model, omp, cwd) {
38183
38347
  const reminders = structure && dateReminderPlans.get(structure);
38184
38348
  if (reminders)
38185
38349
  reminders.cwd = cwd;
38186
- return { messages: output, structure };
38350
+ const nativeDrops = omp ? piNativeDropExpectations(output, model) : [];
38351
+ return {
38352
+ messages: output,
38353
+ structure,
38354
+ ...nativeDrops.length ? { nativeDrops } : {}
38355
+ };
38187
38356
  }
38188
38357
  function buildPiPreparedStructure(messages, model, prepareUser, host = "omp") {
38189
38358
  if (!messages.length || messages.length > MAX_MESSAGES)
@@ -40287,6 +40456,7 @@ function releasePiOperationPayloads(operation) {
40287
40456
  operation.managedSignature = undefined;
40288
40457
  operation.cursorRoots = undefined;
40289
40458
  operation.preparedStructure = undefined;
40459
+ operation.nativeDrops = undefined;
40290
40460
  operation.preparedHistory = undefined;
40291
40461
  }
40292
40462
  function operationKey(ctx) {
@@ -40580,6 +40750,9 @@ function registerPiGuardedContext(pi, handler, options = {}) {
40580
40750
  const fields = piConversationFields(payload);
40581
40751
  if (!fields)
40582
40752
  throw new Error("provider conversation identity could not be established");
40753
+ const nativeDrop = piNativeDropWireMismatch(checked, active.nativeDrops);
40754
+ if (nativeDrop)
40755
+ throw new Error(`provider request does not match this pass's managed dispatch (prepared turn structure); ${nativeDrop}`);
40583
40756
  const body = checked;
40584
40757
  const skipReason = piCursorConversation(checked) ? "Cursor history blob IDs do not expose prepared turn structure" : active.preparedStructure ? active.preparedStructure.structuralSkipReason ?? (active.preparedStructure.api && body?.messages === undefined && Array.isArray(body?.input) && !active.preparedStructure.responsesMessages ? "provider selected Responses items without a matching history plan" : undefined) : "prepared history representation is not modeled";
40585
40758
  if (chained && skipReason)
@@ -40693,6 +40866,7 @@ function registerPiGuardedContext(pi, handler, options = {}) {
40693
40866
  if (ctx.model?.api === "cursor-agent")
40694
40867
  active.cursorRoots = piCursorManagedRoots(result.messages, active.managedSignature, ctx.cwd);
40695
40868
  active.preparedStructure = prepared.structure;
40869
+ active.nativeDrops = prepared.nativeDrops;
40696
40870
  if (fenceEnabled && !budget.sideTurn && piChainCapableApi(ctx.model?.api))
40697
40871
  active.preparedHistory = piPreparedHistory(result.messages, ctx.model);
40698
40872
  budget.completed = true;
@@ -43576,9 +43750,10 @@ function createPiTranscript(source, sessionId, entryIds, options = {}) {
43576
43750
  message.requiresToolArcSkeleton = false;
43577
43751
  }
43578
43752
  let committed = false;
43753
+ const harness = resolvePiHarnessKind();
43579
43754
  return {
43580
43755
  messages: transcriptMessages,
43581
- harness: resolvePiHarnessKind(),
43756
+ harness,
43582
43757
  prepareToolRemovalMeasurements(callIds) {
43583
43758
  if (!options.authorizeToolRemovals || callIds.length === 0)
43584
43759
  return;
@@ -43599,7 +43774,9 @@ function createPiTranscript(source, sessionId, entryIds, options = {}) {
43599
43774
  return;
43600
43775
  committed = true;
43601
43776
  for (const index of dirtyMessages) {
43602
- rewriteNativeAssistantTexts(working[index], source[index], sessionId);
43777
+ rewriteNativeAssistantTexts(working[index], source[index], sessionId, {
43778
+ unsignedDrops: harness === "omp"
43779
+ });
43603
43780
  }
43604
43781
  for (const [index, parts] of removals) {
43605
43782
  const message = working[index];
@@ -5,8 +5,8 @@ import {
5
5
  startMessageFtsRowidMapBackfill2,
6
6
  messageFtsOrdinalRangeIsMapped2,
7
7
  deleteUnmappedMessageFtsRows2
8
- } from "./index-ck8wj35v.js";
9
- import"./index-c1dqxr10.js";
8
+ } from "./index-bbbp8zs1.js";
9
+ import"./index-3g9fnq6y.js";
10
10
  import"./index-wfqysrwq.js";
11
11
  import"./index-8sqebjzk.js";
12
12
  import"./index-0wtm7g7f.js";
@@ -3,8 +3,8 @@ import {
3
3
  withIndexChunk2,
4
4
  yieldIndexChunk2
5
5
  } from "./index-2qtx0q6h.js";
6
- import"./index-pwp6zyx3.js";
7
- import"./index-wt7vmyj4.js";
6
+ import"./index-zchc0df8.js";
7
+ import"./index-000fthre.js";
8
8
  import"./index-0h2mkab2.js";
9
9
  import"./index-gymgz20n.js";
10
10
  import"./index-dnp1jjar.js";
@@ -13,9 +13,9 @@ import"./index-gzk7d940.js";
13
13
  import"./index-8sqebjzk.js";
14
14
  import"./index-wfqysrwq.js";
15
15
  import"./index-x2n261wp.js";
16
- import"./index-c1dqxr10.js";
16
+ import"./index-3g9fnq6y.js";
17
17
  import"./index-n0zjvs3h.js";
18
- import"./index-j2x88zk0.js";
18
+ import"./index-7esg5v2x.js";
19
19
  import"./index-6x556c2q.js";
20
20
  import"./index-c6wbq66z.js";
21
21
  import {
@@ -25,8 +25,8 @@ import {
25
25
  markMessageIndexDirty,
26
26
  getIndexableContent,
27
27
  indexSingleMessage
28
- } from "./index-025nxwc9.js";
29
- import"./index-ck8wj35v.js";
28
+ } from "./index-fzadydec.js";
29
+ import"./index-bbbp8zs1.js";
30
30
  import"./index-0wtm7g7f.js";
31
31
 
32
32
  // ../plugin/src/features/magic-context/message-index-bounded.ts
@@ -17,15 +17,15 @@ import"./index-6pk49fc3.js";
17
17
  import {
18
18
  setSqlitePragmaConfig,
19
19
  initializeDatabase
20
- } from "./index-p1jxxsth.js";
20
+ } from "./index-wwf9vxpf.js";
21
21
  import"./index-fapenpch.js";
22
22
  import"./index-3bb24eb6.js";
23
23
  import"./index-8sqebjzk.js";
24
24
  import"./index-wfqysrwq.js";
25
25
  import"./index-x2n261wp.js";
26
- import"./index-c1dqxr10.js";
27
- import"./index-ck8wj35v.js";
28
- import"./index-wt7vmyj4.js";
26
+ import"./index-3g9fnq6y.js";
27
+ import"./index-bbbp8zs1.js";
28
+ import"./index-000fthre.js";
29
29
  import"./index-c6wbq66z.js";
30
30
  import {
31
31
  closeQuietly
@@ -33,22 +33,22 @@ import {
33
33
  sweepAllRegisteredProjects2,
34
34
  _setTestProviderFactoryForProject2,
35
35
  _resetProjectEmbeddingRegistryForTests2
36
- } from "./index-9tcbabqr.js";
36
+ } from "./index-rcenqffj.js";
37
37
  import"./index-9p40dgkm.js";
38
38
  import"./index-hgd00nas.js";
39
39
  import"./index-yhzhdp3m.js";
40
40
  import"./index-mp0gh04g.js";
41
- import"./index-f9qet7y8.js";
42
- import"./index-xf3ndcqd.js";
43
- import"./index-rzfr7wdv.js";
41
+ import"./index-4sa1rx3h.js";
42
+ import"./index-tsg6swzr.js";
43
+ import"./index-gwvahsdz.js";
44
44
  import"./index-gzk7d940.js";
45
45
  import"./index-6pk49fc3.js";
46
- import"./index-ck8wj35v.js";
47
- import"./index-c1dqxr10.js";
46
+ import"./index-bbbp8zs1.js";
47
+ import"./index-3g9fnq6y.js";
48
48
  import"./index-wfqysrwq.js";
49
49
  import"./index-8sqebjzk.js";
50
50
  import"./index-0wtm7g7f.js";
51
- import"./index-wt7vmyj4.js";
51
+ import"./index-000fthre.js";
52
52
  import"./index-2qtx0q6h.js";
53
53
  import"./index-gymgz20n.js";
54
54
  import"./index-0h2mkab2.js";
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
19
19
  await main();
20
20
  async function main() {
21
21
  if (input.v2ArchiveReader) {
22
- const { serveV2ArchiveReads } = await import("./v2-archive-reader-z7qgxxp0.js");
22
+ const { serveV2ArchiveReads } = await import("./v2-archive-reader-2v7a879f.js");
23
23
  await serveV2ArchiveReads(port, openConnections);
24
24
  return;
25
25
  }
@@ -30,7 +30,7 @@ serveWorkerJobs(async (input, port) => {
30
30
  { log }
31
31
  ] = await Promise.all([
32
32
  import("./sqlite-v89bj0yy.js"),
33
- import("./read-session-raw-a9ntjqap.js"),
33
+ import("./read-session-raw-nttnwy8p.js"),
34
34
  import("./harness-9872e0ym.js"),
35
35
  import("./logger-2j70hhz4.js")
36
36
  ]);
@@ -46,13 +46,13 @@ serveWorkerJobs(async (input, port) => {
46
46
  openConnections.add(db);
47
47
  db.exec("PRAGMA busy_timeout = 250");
48
48
  if (input.ftsRowidBackfill) {
49
- const { runMessageFtsRowidMapBackfill } = await import("./message-fts-rowid-map-hmgyfxxa.js");
49
+ const { runMessageFtsRowidMapBackfill } = await import("./message-fts-rowid-map-ff4qg3e4.js");
50
50
  db.exec("PRAGMA busy_timeout = 0");
51
51
  await runMessageFtsRowidMapBackfill(db);
52
52
  reply = { kind: "fts-rowid-backfill" };
53
53
  } else if (input.searchArchive) {
54
- const { renderSearchArchive } = await import("./search-archive-23s9g6dx.js");
55
- const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-a9ntjqap.js");
54
+ const { renderSearchArchive } = await import("./search-archive-qza20zkm.js");
55
+ const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-nttnwy8p.js");
56
56
  const archive = input.searchArchive;
57
57
  let raw;
58
58
  try {
@@ -81,7 +81,7 @@ serveWorkerJobs(async (input, port) => {
81
81
  const { setHarness } = await import("./harness-9872e0ym.js");
82
82
  setHarness(input.harness ?? "opencode");
83
83
  const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
84
- import("./message-index-bounded-1gj1pwjy.js"),
84
+ import("./message-index-bounded-cqn6x6fc.js"),
85
85
  import("./sqlite-context-pragmas-gcgch6qz.js")
86
86
  ]);
87
87
  configureContextDatabasePragmas(db);
@@ -95,7 +95,7 @@ serveWorkerJobs(async (input, port) => {
95
95
  measurements: result.measurements
96
96
  };
97
97
  } else if (input.tagRatio !== undefined) {
98
- const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-p9y3bnw7.js");
98
+ const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-g0j9mr4b.js");
99
99
  const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
100
100
  if (delta)
101
101
  reply = { kind: "tag-delta", delta };
@@ -38,13 +38,13 @@ import {
38
38
  readSessionChunk2,
39
39
  getRawSessionMessageIdsThrough2,
40
40
  readRawSessionSeedTail2
41
- } from "./index-j2x88zk0.js";
42
- import"./index-pwp6zyx3.js";
41
+ } from "./index-7esg5v2x.js";
42
+ import"./index-zchc0df8.js";
43
43
  import"./index-6x556c2q.js";
44
44
  import"./index-gzk7d940.js";
45
45
  import"./index-c6wbq66z.js";
46
46
  import"./index-yacs388s.js";
47
- import"./index-c1dqxr10.js";
47
+ import"./index-3g9fnq6y.js";
48
48
  import"./index-wfqysrwq.js";
49
49
  import"./index-8sqebjzk.js";
50
50
  import"./index-n0zjvs3h.js";
@@ -52,7 +52,7 @@ import"./index-0wtm7g7f.js";
52
52
  import {
53
53
  hasMeaningfulUserText2,
54
54
  extractTexts2
55
- } from "./index-wt7vmyj4.js";
55
+ } from "./index-000fthre.js";
56
56
  import"./index-2qtx0q6h.js";
57
57
  import"./index-gymgz20n.js";
58
58
  import"./index-0h2mkab2.js";
@@ -28,7 +28,7 @@ import {
28
28
  hasRawSessionMessageByIdFromDb2,
29
29
  readRawSeedTailFromDb2,
30
30
  readRawSessionBoundaryEndpointsFromDb2
31
- } from "./index-c1dqxr10.js";
31
+ } from "./index-3g9fnq6y.js";
32
32
  import"./index-wfqysrwq.js";
33
33
  import"./index-8sqebjzk.js";
34
34
  import"./index-2qtx0q6h.js";