@cortexkit/pi-magic-context 0.49.19 → 0.49.21
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 +48 -9
- package/dist/chunk-embedding-write-worker.js +29 -22
- package/dist/{compaction-marker-candidates-wjzqbspm.js → compaction-marker-candidates-p1kqkqhq.js} +3 -3
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/compartment-chunk-embedding-y01m95c2.js +64 -0
- package/dist/embedding-backfill-2vh6m3bg.js +24 -0
- package/dist/embedding-worker-process.js +2 -2
- package/dist/embedding-worker.js +6 -6
- package/dist/historian-calibration-extension.js +1 -1
- package/dist/{index-e1rza8gp.js → index-29nw7n1r.js} +1 -1
- package/dist/{index-rrwv9y2k.js → index-2qtx0q6h.js} +214 -5
- package/dist/{index-msqrs4nf.js → index-3c3ztwgc.js} +5 -5
- package/dist/index-54wmg4rj.js +82 -0
- package/dist/{index-yygsh681.js → index-579m1751.js} +3 -3
- package/dist/{index-rc1dez8m.js → index-5j6vwg4z.js} +154 -13
- package/dist/{index-qpq6w67c.js → index-6wdwv3a6.js} +2 -2
- package/dist/{index-vktahpdj.js → index-at6py2k3.js} +9 -3
- package/dist/{index-bxmf4dhr.js → index-ccanzg8p.js} +2367 -1243
- package/dist/{index-sqt2haap.js → index-dbgg6hsf.js} +28 -14
- package/dist/{index-7bqrfyny.js → index-fgs78jyd.js} +12 -15
- package/dist/{index-58mj0dzc.js → index-ftvm2acc.js} +181 -46
- package/dist/{index-wveb51es.js → index-gqjxy2p7.js} +74 -9
- package/dist/{index-d8gc0112.js → index-gwxaz0z5.js} +4 -6
- package/dist/{index-d4dt19md.js → index-hqw0rt9k.js} +1 -1
- package/dist/{index-g7p75667.js → index-hxp6q5f8.js} +2 -2
- package/dist/{index-svgkv4g2.js → index-j3pz3a1b.js} +2 -2
- package/dist/{index-f18ec69t.js → index-jn44h81p.js} +1 -1
- package/dist/{index-1kcfwk9c.js → index-my0dn413.js} +1 -1
- package/dist/{index-apgwdby5.js → index-n4wyxcgr.js} +1 -1
- package/dist/{index-rhprywn6.js → index-n8e5e9fp.js} +28 -7
- package/dist/{index-z2rkv0mb.js → index-pe5gz5c4.js} +5 -5
- package/dist/{index-dtp1efvf.js → index-st4gwt64.js} +2 -2
- package/dist/{index-xnch62s6.js → index-vx6f7wff.js} +314 -127
- package/dist/{index-jrap43gc.js → index-w1avzkdt.js} +1 -1
- package/dist/{index-vmcgew7x.js → index-w1twp2kp.js} +78 -58
- package/dist/{index-ek9zvs4f.js → index-w6r3ggnp.js} +57 -27
- package/dist/{index-ym6nh2gk.js → index-wgmhk91m.js} +113 -20
- package/dist/{index-2mmy81qt.js → index-wqpjhx1p.js} +501 -20
- package/dist/index.js +1178 -417
- package/dist/{logger-dygt96rn.js → logger-shetp43v.js} +1 -1
- package/dist/{message-fts-rowid-map-cvpy2dmb.js → message-fts-rowid-map-59y476bk.js} +6 -5
- package/dist/{message-index-rc2x41k4.js → message-index-3snxf11x.js} +15 -14
- package/dist/{message-index-bounded-66saeq5j.js → message-index-bounded-4ngt600v.js} +15 -14
- package/dist/{message-time-backfill-ssshbdy8.js → message-time-backfill-e3r8ddh1.js} +3 -3
- package/dist/migration-worker.js +12 -11
- package/dist/{project-embedding-registry-vf1ncptn.js → project-embedding-registry-hfyzs654.js} +14 -13
- package/dist/raw-ordinal-warmup-worker.js +136 -101
- package/dist/{read-session-chunk-h5bzj91r.js → read-session-chunk-5dmc77q2.js} +10 -9
- package/dist/{read-session-raw-9s3xn7fc.js → read-session-raw-yxv2fv34.js} +4 -3
- package/dist/{safe-notification-target-2rkvkmw8.js → safe-notification-target-zcpchea6.js} +2 -2
- package/dist/search-archive-3daj5ttc.js +21 -0
- package/dist/{search-wh7b9zht.js → search-jhfh3tsj.js} +23 -22
- package/dist/{sqlite-fsp0sf3r.js → sqlite-v89bj0yy.js} +7 -1
- package/dist/{storage-memory-yxxc5v4n.js → storage-memory-0ndn65fm.js} +2 -2
- package/dist/{storage-tags-1kets0q8.js → storage-tags-r48vxthe.js} +7 -5
- package/dist/subagent-entry.js +28 -26
- package/dist/tag-snapshot-worker-pi.js +22 -14
- package/package.json +5 -2
- package/dist/embedding-backfill-vwag34t0.js +0 -23
- package/dist/search-archive-4817pqev.js +0 -20
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
renderToolTemplate,
|
|
5
5
|
resolveModelConfigValue,
|
|
6
6
|
deriveDefaultProtectedTokens
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-ccanzg8p.js";
|
|
8
8
|
import {
|
|
9
9
|
getHarness2,
|
|
10
10
|
harnessOwnsOpenCodeStore2
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
log2,
|
|
14
14
|
sessionLog2
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-fgs78jyd.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveDecisionCalibration,
|
|
18
18
|
calibrationForModelKey,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
TAG_SELECT_COLUMNS2,
|
|
24
24
|
getCandidateToolOwners2,
|
|
25
25
|
pickNearestPriorOwner2
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-n8e5e9fp.js";
|
|
27
27
|
import {
|
|
28
28
|
OMO_INTERNAL_INITIATOR_MARKER,
|
|
29
29
|
isSystemDirective,
|
|
@@ -39,15 +39,15 @@ import {
|
|
|
39
39
|
formatBlock,
|
|
40
40
|
compactTextForSummary,
|
|
41
41
|
mergeCommitHashes
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-my0dn413.js";
|
|
43
43
|
import {
|
|
44
44
|
Database2,
|
|
45
45
|
prepareCachedStatement2
|
|
46
|
-
} from "./index-
|
|
46
|
+
} from "./index-2qtx0q6h.js";
|
|
47
47
|
import {
|
|
48
48
|
stableStringify,
|
|
49
49
|
closeQuietly
|
|
50
|
-
} from "./index-
|
|
50
|
+
} from "./index-w1avzkdt.js";
|
|
51
51
|
import {
|
|
52
52
|
resolveOpenCodeDbPath,
|
|
53
53
|
assertOpenCodeStoreGeneration,
|
|
@@ -72,10 +72,10 @@ import {
|
|
|
72
72
|
hasRawSessionMessageByIdFromDb2,
|
|
73
73
|
readRawSeedTailFromDb2,
|
|
74
74
|
readRawSessionBoundaryEndpointsFromDb2
|
|
75
|
-
} from "./index-
|
|
75
|
+
} from "./index-at6py2k3.js";
|
|
76
76
|
import {
|
|
77
77
|
logSlowWriteTransaction
|
|
78
|
-
} from "./index-
|
|
78
|
+
} from "./index-hqw0rt9k.js";
|
|
79
79
|
|
|
80
80
|
// ../plugin/src/features/magic-context/overflow-detection.ts
|
|
81
81
|
var OVERFLOW_PATTERNS = [
|
|
@@ -1213,6 +1213,23 @@ function readReplayDocument(db, sessionId, mode = "strict") {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
return { ...doc, trailingBlank: Object.fromEntries(merged) };
|
|
1215
1215
|
}
|
|
1216
|
+
function readAllTrailingBlankDecisions(db, sessionId, rawColumn) {
|
|
1217
|
+
let decisions;
|
|
1218
|
+
try {
|
|
1219
|
+
decisions = new Map(Object.entries(parseReplayDocument(rawColumn, "read").trailingBlank));
|
|
1220
|
+
} catch (error) {
|
|
1221
|
+
if (error instanceof ReplayDocumentError)
|
|
1222
|
+
return new Map;
|
|
1223
|
+
throw error;
|
|
1224
|
+
}
|
|
1225
|
+
if (!hasReplayDecisionTable(db))
|
|
1226
|
+
return decisions;
|
|
1227
|
+
for (const row of readDecisionRows(db, sessionId)) {
|
|
1228
|
+
if (isPersistedTrailingBlankDecision(row.decision))
|
|
1229
|
+
decisions.set(row.message_id, row.decision);
|
|
1230
|
+
}
|
|
1231
|
+
return decisions;
|
|
1232
|
+
}
|
|
1216
1233
|
function updateReplayDocument(db, sessionId, mutate) {
|
|
1217
1234
|
invalidateReplayEnvelopeSnapshot(db, sessionId);
|
|
1218
1235
|
let initial;
|
|
@@ -2540,6 +2557,51 @@ function getCompactionMarkerHealth(db, sessionId, now = Date.now()) {
|
|
|
2540
2557
|
pendingSinceMs: firstFailedAt
|
|
2541
2558
|
};
|
|
2542
2559
|
}
|
|
2560
|
+
function executeReclaimFromReplay(raw) {
|
|
2561
|
+
try {
|
|
2562
|
+
return parseReplayDocument(raw).executeReclaim;
|
|
2563
|
+
} catch {
|
|
2564
|
+
return;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
function loadPostprocessReplaySnapshot(db, sessionId) {
|
|
2568
|
+
const row = db.prepare(`SELECT stale_reduce_stripped_ids, processed_image_stripped_ids,
|
|
2569
|
+
stripped_placeholder_ids, note_nudge_anchors,
|
|
2570
|
+
auto_search_hint_decisions, todo_permission_denied,
|
|
2571
|
+
todo_synthetic_call_id, todo_synthetic_anchor_message_id,
|
|
2572
|
+
todo_synthetic_state_json, pending_compaction_marker_state,
|
|
2573
|
+
compaction_marker_state, compaction_marker_target_end_message_id,
|
|
2574
|
+
merged_reasoning_stripped_ids, thinking_binding_recovery_target,
|
|
2575
|
+
trailing_blank_decisions
|
|
2576
|
+
FROM session_meta WHERE session_id = ?`).get(sessionId);
|
|
2577
|
+
const placeholders = parseStrippedPlaceholderState(row?.stripped_placeholder_ids);
|
|
2578
|
+
const todoPermissionDenied = row?.todo_permission_denied === 1 ? true : row?.todo_permission_denied === 0 ? false : null;
|
|
2579
|
+
const thinkingBindingRecoveryTarget = row?.thinking_binding_recovery_target;
|
|
2580
|
+
return {
|
|
2581
|
+
servedShapeRepair: (() => {
|
|
2582
|
+
try {
|
|
2583
|
+
return parseReplayDocument(row?.trailing_blank_decisions).servedShapeRepair;
|
|
2584
|
+
} catch {
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2587
|
+
})(),
|
|
2588
|
+
executeReclaim: executeReclaimFromReplay(row?.trailing_blank_decisions),
|
|
2589
|
+
staleReduceStrippedIds: new Set(parseStrippedBlob(row?.stale_reduce_stripped_ids)),
|
|
2590
|
+
processedImageStrippedIds: new Set(parseProcessedImageMarkers(row?.processed_image_stripped_ids).keys()),
|
|
2591
|
+
processedImageMarkers: parseProcessedImageMarkers(row?.processed_image_stripped_ids),
|
|
2592
|
+
strippedPlaceholderIds: new Set(placeholders.ids),
|
|
2593
|
+
hiddenSeamPlaceholderIds: new Set(placeholders.hiddenSeamIds),
|
|
2594
|
+
noteNudgeAnchors: parseJsonArray(row?.note_nudge_anchors, isValidNoteNudgeAnchor),
|
|
2595
|
+
autoSearchHintDecisions: parseJsonArray(row?.auto_search_hint_decisions, isValidAutoSearchHintDecision),
|
|
2596
|
+
todoPermissionDenied,
|
|
2597
|
+
todoSyntheticAnchor: parsePersistedTodoSyntheticAnchor(row),
|
|
2598
|
+
pendingCompactionMarker: parsePendingCompactionMarkerState(row?.pending_compaction_marker_state),
|
|
2599
|
+
compactionMarker: parsePersistedCompactionMarkerState(row?.compaction_marker_state, row?.compaction_marker_target_end_message_id),
|
|
2600
|
+
mergedReasoningStrippedIds: new Set(parseStrippedBlob(row?.merged_reasoning_stripped_ids)),
|
|
2601
|
+
thinkingBindingRecoveryTarget: typeof thinkingBindingRecoveryTarget === "string" && thinkingBindingRecoveryTarget.length > 0 ? thinkingBindingRecoveryTarget : null,
|
|
2602
|
+
trailingBlankDecisions: readAllTrailingBlankDecisions(db, sessionId, row?.trailing_blank_decisions)
|
|
2603
|
+
};
|
|
2604
|
+
}
|
|
2543
2605
|
function clearPendingCompactionMarkerStateIf(db, sessionId, expected) {
|
|
2544
2606
|
const expectedBlob = stableStringify(expected);
|
|
2545
2607
|
const result = db.prepare(`UPDATE session_meta SET pending_compaction_marker_state = NULL
|
|
@@ -3894,6 +3956,9 @@ function hasAnthropicReasoning(messages) {
|
|
|
3894
3956
|
});
|
|
3895
3957
|
}
|
|
3896
3958
|
|
|
3959
|
+
// ../plugin/src/hooks/magic-context/served-shape-repair.ts
|
|
3960
|
+
var sources = new WeakMap;
|
|
3961
|
+
|
|
3897
3962
|
// ../plugin/src/hooks/magic-context/strip-content.ts
|
|
3898
3963
|
var METADATA_PART_TYPES = new Set([
|
|
3899
3964
|
"step-start",
|
|
@@ -5063,4 +5128,4 @@ function readRawSessionSeedTail2(sessionId, boundaryId, onQuery) {
|
|
|
5063
5128
|
});
|
|
5064
5129
|
}
|
|
5065
5130
|
|
|
5066
|
-
export { detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, computeProtectionWindow, readEpochFloorSnapshot, getProtectionWindowForSession, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, isRustMarkerAdmissionFenced, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, EMERGENCY_DRAIN_FAILURE_BACKOFF_MS, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, recordOverflowDetected, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, COMPACTION_OFF_THINKING_FROZEN_PREFIX, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, setPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingPiMarker, setSessionWorkMetrics, getSessionWorkMetrics, resolveEpochFloorForPass, withReadOnlySessionDb, expandToolPart, retreatPastHostUnservedRows, isCoveredInstructionRow, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, isFilePart, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, modelAcceptsEmptyContent, isAnthropicFamilyRoute, variantChangeBustsProviderCache, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, findLatestAssistantReasoningMutationExemptMessage, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opaqueThinkingCost, estimatePartImageTokens, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|
|
5131
|
+
export { detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, computeProtectionWindow, readEpochFloorSnapshot, getProtectionWindowForSession, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, isRustMarkerAdmissionFenced, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, EMERGENCY_DRAIN_FAILURE_BACKOFF_MS, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, recordOverflowDetected, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, COMPACTION_OFF_THINKING_FROZEN_PREFIX, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, setPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingPiMarker, setSessionWorkMetrics, getSessionWorkMetrics, resolveEpochFloorForPass, withReadOnlySessionDb, expandToolPart, retreatPastHostUnservedRows, isCoveredInstructionRow, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, isFilePart, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, modelAcceptsEmptyContent, isAnthropicFamilyRoute, variantChangeBustsProviderCache, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, findLatestAssistantReasoningMutationExemptMessage, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opaqueThinkingCost, estimatePartImageTokens, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./index-
|
|
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-
|
|
9
|
+
} from "./index-fgs78jyd.js";
|
|
10
10
|
import {
|
|
11
11
|
inRootAsyncContext2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-2qtx0q6h.js";
|
|
13
13
|
|
|
14
14
|
// ../plugin/src/features/magic-context/memory/embedding-synapse.ts
|
|
15
15
|
import { createHash } from "node:crypto";
|
|
@@ -1788,7 +1788,6 @@ function getSynapseBatchRequestKey(args) {
|
|
|
1788
1788
|
required_fingerprint: args.fingerprint,
|
|
1789
1789
|
required_epoch: args.tableEpoch,
|
|
1790
1790
|
allow_equivalent: false,
|
|
1791
|
-
accept_declared: false,
|
|
1792
1791
|
ids: args.items.map((item) => item.id),
|
|
1793
1792
|
content_sha256: args.items.map((item) => item.contentSha256),
|
|
1794
1793
|
...args.purpose === "query" ? { purpose: args.purpose } : {}
|
|
@@ -2177,8 +2176,7 @@ class SynapseEmbeddingProvider {
|
|
|
2177
2176
|
model: metadata.model,
|
|
2178
2177
|
required_fingerprint: metadata.fingerprint,
|
|
2179
2178
|
required_epoch: metadata.table_epoch,
|
|
2180
|
-
allow_equivalent: false
|
|
2181
|
-
accept_declared: false
|
|
2179
|
+
allow_equivalent: false
|
|
2182
2180
|
};
|
|
2183
2181
|
}
|
|
2184
2182
|
batchRequest(items, requestKey, purpose) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getMagicContextStorageDir,
|
|
3
3
|
log2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-fgs78jyd.js";
|
|
5
5
|
import {
|
|
6
6
|
inRootAsyncContext2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-2qtx0q6h.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-
|
|
6
|
+
} from "./index-hxp6q5f8.js";
|
|
7
7
|
import {
|
|
8
8
|
logSlowWriteTransaction
|
|
9
|
-
} from "./index-
|
|
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;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-my0dn413.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-fgs78jyd.js";
|
|
10
10
|
import {
|
|
11
11
|
getTagIdentityWriteGeneration2,
|
|
12
12
|
getSqliteDatabasePath2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-2qtx0q6h.js";
|
|
14
14
|
import {
|
|
15
15
|
jsonHashSink,
|
|
16
16
|
tagOrderConstraintIndex,
|
|
17
17
|
tagIdentityRevisionKey
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-w1avzkdt.js";
|
|
19
19
|
import {
|
|
20
20
|
DEFAULT_PROTECTED_TOOLS,
|
|
21
21
|
normalizeProtectedToolName,
|
|
@@ -591,13 +591,16 @@ function stripDanglingTagNotationGlobally(value) {
|
|
|
591
591
|
function stripTagSectionCharacters(value) {
|
|
592
592
|
return value.replace(STRAY_SECTION_CHAR_REGEX, "");
|
|
593
593
|
}
|
|
594
|
-
function stripPersistedAssistantText(value) {
|
|
594
|
+
function stripPersistedAssistantText(value, acceptsEmpty = true) {
|
|
595
|
+
if (!acceptsEmpty && !value.includes("§") && !value.trim())
|
|
596
|
+
return value;
|
|
595
597
|
let text = stripWellFormedLeadingTagPrefix(value);
|
|
596
598
|
text = stripCompleteTagPairsGlobally(text);
|
|
597
599
|
text = stripMalformedTagNotationGlobally(text);
|
|
598
600
|
text = stripDanglingTagNotationGlobally(text);
|
|
599
601
|
text = stripTagSectionCharacters(text);
|
|
600
|
-
|
|
602
|
+
const stripped = text.trim();
|
|
603
|
+
return !acceptsEmpty && value.trim().length > 0 && stripped.length === 0 ? value : stripped;
|
|
601
604
|
}
|
|
602
605
|
function byteSize(value) {
|
|
603
606
|
return encoder.encode(value).length;
|
|
@@ -3172,6 +3175,24 @@ function getActiveTagsBySession2(db, sessionId) {
|
|
|
3172
3175
|
const rows = getActiveTagsBySessionStatement(db).all(sessionId).filter(isTagRow);
|
|
3173
3176
|
return rows.map(toTagEntry);
|
|
3174
3177
|
}
|
|
3178
|
+
function getTailHygieneTags2(db, sessionId) {
|
|
3179
|
+
const active = getActiveTagsBySession2(db, sessionId);
|
|
3180
|
+
let orphanStatement = getNullOwnerToolTagsBySessionStatements.get(db);
|
|
3181
|
+
if (!orphanStatement) {
|
|
3182
|
+
orphanStatement = db.prepare(`SELECT ${TAG_SELECT_COLUMNS2} FROM tags
|
|
3183
|
+
WHERE session_id = ? AND type = 'tool' AND tool_owner_message_id IS NULL
|
|
3184
|
+
ORDER BY tag_number ASC, id ASC`);
|
|
3185
|
+
getNullOwnerToolTagsBySessionStatements.set(db, orphanStatement);
|
|
3186
|
+
}
|
|
3187
|
+
const seen = new Set(active.map((tag) => `${tag.tagNumber}\x00${tag.messageId}\x00${tag.type}`));
|
|
3188
|
+
for (const row of orphanStatement.all(sessionId).filter(isTagRow)) {
|
|
3189
|
+
const orphan = toTagEntry(row);
|
|
3190
|
+
const key = `${orphan.tagNumber}\x00${orphan.messageId}\x00${orphan.type}`;
|
|
3191
|
+
if (!seen.has(key))
|
|
3192
|
+
active.push(orphan);
|
|
3193
|
+
}
|
|
3194
|
+
return active;
|
|
3195
|
+
}
|
|
3175
3196
|
function getTagsForPendingOperations2(db, sessionId, pendingTagNumbers, protectedCount, recentToolWindow) {
|
|
3176
3197
|
const byNumber = new Map;
|
|
3177
3198
|
for (const tag of getTagsByNumbers2(db, sessionId, pendingTagNumbers)) {
|
|
@@ -3385,4 +3406,4 @@ function deleteToolTagsByOwner(db, sessionId, ownerMsgId) {
|
|
|
3385
3406
|
return getDeleteToolTagsByOwnerStatement(db).all(sessionId, ownerMsgId).length;
|
|
3386
3407
|
}
|
|
3387
3408
|
|
|
3388
|
-
export { UNKNOWN_FIT_RATIO, resolveDecisionCalibration, hasMeasuredDecisionCalibration, providerMass, localBudget, calibrationForModelKey, historyLocalBudget, adoptedProtectedToolsPolicy, protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, rememberCurrentToolOutputCount, currentReclaimableToolOutputCount, isRecord, TEXT_TAG_IDENTITY_MARKER, PI_FALLBACK_PREFIXES_JSON, contentTagOwnerMessageId, TailHygieneJsonMemo, piJsonHash, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, TODO_STATUSES, TODO_PRIORITIES, TITLE_DONE_STATUSES, normalizeTodoStateJson, buildSyntheticTodoPart, stripChannel1ReminderSpans, compareMeasuredTailPrefix, formatTailHygienePrefixMismatch, freezeTailHygieneMeasurement, effectiveTailHygiene, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, decideChannel1, evaluateChannel2, buildChannel2Reminder, buildChannel1Reminder, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, getPendingOpsCount, clearPendingOps, removePendingOp, updateTagByteSize2, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, updateTagInputByteSize2, updateTagTokenCount2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, scanTagOwnerDelta2, updateTagInputTokenCount2, tagTokenCountIsNull2, backfillTagTokenCounts2, normalizeTagSnapshotRow2, insertTag2, updateTagStatus2, markTagDropped2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, PiTagIdentityConflictError2, getPiMessageTagCandidates2, findPiTagIdentityConflict2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
|
|
3409
|
+
export { UNKNOWN_FIT_RATIO, resolveDecisionCalibration, hasMeasuredDecisionCalibration, providerMass, localBudget, calibrationForModelKey, historyLocalBudget, adoptedProtectedToolsPolicy, protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, rememberCurrentToolOutputCount, currentReclaimableToolOutputCount, isRecord, TEXT_TAG_IDENTITY_MARKER, PI_FALLBACK_PREFIXES_JSON, contentTagOwnerMessageId, TailHygieneJsonMemo, piJsonHash, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, TODO_STATUSES, TODO_PRIORITIES, TITLE_DONE_STATUSES, normalizeTodoStateJson, buildSyntheticTodoPart, stripChannel1ReminderSpans, compareMeasuredTailPrefix, formatTailHygienePrefixMismatch, freezeTailHygieneMeasurement, effectiveTailHygiene, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, decideChannel1, evaluateChannel2, buildChannel2Reminder, buildChannel1Reminder, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, getPendingOpsCount, clearPendingOps, removePendingOp, updateTagByteSize2, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, updateTagInputByteSize2, updateTagTokenCount2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, scanTagOwnerDelta2, updateTagInputTokenCount2, tagTokenCountIsNull2, backfillTagTokenCounts2, normalizeTagSnapshotRow2, insertTag2, updateTagStatus2, markTagDropped2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, PiTagIdentityConflictError2, getPiMessageTagCandidates2, findPiTagIdentityConflict2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-ccanzg8p.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-fgs78jyd.js";
|
|
7
7
|
import {
|
|
8
8
|
isSynapseEmbeddingTruncated,
|
|
9
9
|
SynapseEmbeddingProvider
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-gwxaz0z5.js";
|
|
11
11
|
import {
|
|
12
12
|
LocalEmbeddingProvider
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-wqpjhx1p.js";
|
|
14
14
|
import {
|
|
15
15
|
OpenAICompatibleEmbeddingProvider,
|
|
16
16
|
getProjectEmbeddingSnapshot2,
|
|
17
17
|
embedBatchForProject2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-w1twp2kp.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./index-9p40dgkm.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./index-1cvyaw9a.js";
|
|
4
4
|
import {
|
|
5
5
|
estimateTokens
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-my0dn413.js";
|
|
7
7
|
import {
|
|
8
8
|
readRawSessionMessageIdOrdinalsForRange2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-gqjxy2p7.js";
|
|
10
10
|
|
|
11
11
|
// ../plugin/src/tools/ctx-expand/search-archive.ts
|
|
12
12
|
var archiveReadsOnThisThread = 0;
|