@cortexkit/pi-magic-context 0.49.64 → 0.49.66
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 +1 -1
- package/dist/chunk-embedding-write-worker.js +1 -1
- package/dist/{index-691zz6f4.js → index-3e0w4aa3.js} +79 -16
- package/dist/{index-98e27fdt.js → index-5vqnvjb2.js} +1 -1
- package/dist/{index-67q9cz3f.js → index-msp5k4hv.js} +1 -1
- package/dist/{index-8328rak2.js → index-ndc0xtrh.js} +1 -1
- package/dist/{index-7vhbmjgv.js → index-pehdap7a.js} +12 -1
- package/dist/{index-renfmk50.js → index-pvd2xhwy.js} +1 -1
- package/dist/{index-vkcb1cg1.js → index-thj34b3p.js} +3 -3
- package/dist/{index-ye6b3dr4.js → index-wdeb9me3.js} +1 -1
- package/dist/{index-6vmpw4z3.js → index-wxgfn7h9.js} +11 -9
- package/dist/{index-hja11zte.js → index-xrhj81gf.js} +1 -1
- package/dist/index.js +142 -42
- package/dist/{message-index-bounded-b5vft8jk.js → message-index-bounded-53hv89kz.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-nfkemn80.js → read-session-chunk-0bcnmmch.js} +2 -2
- package/dist/{render-173bqp1y.js → render-ervyr738.js} +5 -5
- package/dist/{search-archive-7snt7cyv.js → search-archive-2bh9j29f.js} +4 -4
- package/dist/{search-ea9x8vxk.js → search-btspay8j.js} +4 -4
- package/dist/{storage-tags-n8q8jk1b.js → storage-tags-2j1zhtq7.js} +1 -1
- package/dist/subagent-entry.js +9 -9
- package/dist/tag-snapshot-worker-pi.js +3 -3
- package/dist/{v2-archive-reader-5vmwk9y5.js → v2-archive-reader-kxc3cdez.js} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124,6 +124,9 @@ import {
|
|
|
124
124
|
renderHistorianMemoryBlock,
|
|
125
125
|
DEFAULT_MEMORY_BUDGET_TOKENS,
|
|
126
126
|
DEFAULT_USER_PROFILE_BUDGET_TOKENS,
|
|
127
|
+
resolveWorkspaceRenderContext,
|
|
128
|
+
sourceNamesForMemories,
|
|
129
|
+
readM0ProjectMemories,
|
|
127
130
|
trimMemoriesToBudgetV2,
|
|
128
131
|
trimWorkspaceMemoriesToBudgetV2,
|
|
129
132
|
trimUserMemoriesToBudget,
|
|
@@ -142,6 +145,7 @@ import {
|
|
|
142
145
|
resolvePiHarnessDetection,
|
|
143
146
|
resolvePiHarnessKind,
|
|
144
147
|
readSubagentStartupError,
|
|
148
|
+
inheritPiOrdinalAlignment,
|
|
145
149
|
resolvePiOrdinalAlignment,
|
|
146
150
|
piRawOrdinalOffsetSource,
|
|
147
151
|
resolvePiOrdinalAlignmentForContext,
|
|
@@ -154,7 +158,7 @@ import {
|
|
|
154
158
|
registerTodoStateLifecycle,
|
|
155
159
|
syncCtxMemoryToolEnabled,
|
|
156
160
|
registerMagicContextTools
|
|
157
|
-
} from "./index-
|
|
161
|
+
} from "./index-3e0w4aa3.js";
|
|
158
162
|
import"./index-4knyh1kt.js";
|
|
159
163
|
import {
|
|
160
164
|
canonicalModelIdentity,
|
|
@@ -244,6 +248,7 @@ import {
|
|
|
244
248
|
evaluateChannel2,
|
|
245
249
|
buildChannel2Reminder,
|
|
246
250
|
buildChannel1Reminder,
|
|
251
|
+
CACHED_TRIM_PARTIAL_SQL,
|
|
247
252
|
ensureSessionMetaRow,
|
|
248
253
|
persistCachedM0,
|
|
249
254
|
clearCachedM0M1,
|
|
@@ -404,7 +409,7 @@ import {
|
|
|
404
409
|
setSessionWorkMetrics,
|
|
405
410
|
getSessionWorkMetrics,
|
|
406
411
|
resolveEpochFloorForPass
|
|
407
|
-
} from "./index-
|
|
412
|
+
} from "./index-pehdap7a.js";
|
|
408
413
|
import {
|
|
409
414
|
textMentionsRecentCommit,
|
|
410
415
|
hasMeaningfulUserText2,
|
|
@@ -455,7 +460,7 @@ import {
|
|
|
455
460
|
openCurrentDatabase,
|
|
456
461
|
openDatabaseAsync,
|
|
457
462
|
closeDatabase
|
|
458
|
-
} from "./index-
|
|
463
|
+
} from "./index-msp5k4hv.js";
|
|
459
464
|
import {
|
|
460
465
|
LkgRecoveryFenceError,
|
|
461
466
|
clearLkgFenceProcessState,
|
|
@@ -504,7 +509,6 @@ import {
|
|
|
504
509
|
escapeXmlAttr,
|
|
505
510
|
escapeXmlContent,
|
|
506
511
|
getUncoveredCompartmentEndThrough,
|
|
507
|
-
isPartialCompartmentEnd,
|
|
508
512
|
readProjectDocsCanonical,
|
|
509
513
|
providerResponseFailed,
|
|
510
514
|
isSuccessfulProviderCompletion,
|
|
@@ -582,7 +586,7 @@ import {
|
|
|
582
586
|
getSourceContents,
|
|
583
587
|
recordSubagentInvocation,
|
|
584
588
|
getLatestHistorianInvocationId
|
|
585
|
-
} from "./index-
|
|
589
|
+
} from "./index-wxgfn7h9.js";
|
|
586
590
|
import {
|
|
587
591
|
resolveOpenCodeDbPath,
|
|
588
592
|
assertOpenCodeStoreGeneration,
|
|
@@ -648,7 +652,7 @@ import {
|
|
|
648
652
|
getRawSessionTagKeysThrough2,
|
|
649
653
|
getLegacyProtectedTailStartOrdinal2,
|
|
650
654
|
readSessionChunk2
|
|
651
|
-
} from "./index-
|
|
655
|
+
} from "./index-5vqnvjb2.js";
|
|
652
656
|
import"./index-nvh6d3bz.js";
|
|
653
657
|
import {
|
|
654
658
|
formatSynapseLaneDescriptor
|
|
@@ -688,7 +692,7 @@ import {
|
|
|
688
692
|
clearCompressionDepthRange,
|
|
689
693
|
cleanSearchText,
|
|
690
694
|
matchedSearchSnippet
|
|
691
|
-
} from "./index-
|
|
695
|
+
} from "./index-pvd2xhwy.js";
|
|
692
696
|
import {
|
|
693
697
|
rememberV1HiddenRun
|
|
694
698
|
} from "./index-6x556c2q.js";
|
|
@@ -817,7 +821,7 @@ import {
|
|
|
817
821
|
scheduleClearAndReindex,
|
|
818
822
|
clearSessionTracking,
|
|
819
823
|
createAutoSearchDiagnostics
|
|
820
|
-
} from "./index-
|
|
824
|
+
} from "./index-ndc0xtrh.js";
|
|
821
825
|
import"./index-3s39a1md.js";
|
|
822
826
|
import {
|
|
823
827
|
DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS,
|
|
@@ -846,11 +850,11 @@ import {
|
|
|
846
850
|
drainPiTagSnapshotSession,
|
|
847
851
|
assertPiTagSnapshotReady,
|
|
848
852
|
ensurePiTagSnapshotReady
|
|
849
|
-
} from "./index-
|
|
853
|
+
} from "./index-wdeb9me3.js";
|
|
850
854
|
import"./index-71rg8j43.js";
|
|
851
855
|
import"./index-8d2z6503.js";
|
|
852
|
-
import"./index-
|
|
853
|
-
import"./index-
|
|
856
|
+
import"./index-thj34b3p.js";
|
|
857
|
+
import"./index-xrhj81gf.js";
|
|
854
858
|
import {
|
|
855
859
|
__toESM
|
|
856
860
|
} from "./index-22jkk6wg.js";
|
|
@@ -3602,7 +3606,7 @@ function startHostStallProfilerSwitch() {
|
|
|
3602
3606
|
// package.json
|
|
3603
3607
|
var package_default = {
|
|
3604
3608
|
name: "@cortexkit/pi-magic-context",
|
|
3605
|
-
version: "0.49.
|
|
3609
|
+
version: "0.49.66",
|
|
3606
3610
|
type: "module",
|
|
3607
3611
|
description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
|
|
3608
3612
|
main: "dist/index.js",
|
|
@@ -7368,11 +7372,11 @@ var USER_OBSERVATIONS_DISABLED_TOGGLE = `<user_observation_extraction>disabled</
|
|
|
7368
7372
|
User-memory review is not running (the dreamer is disabled): do NOT emit a <user_observations> block.`;
|
|
7369
7373
|
function buildCompartmentAgentPrompt(inputs) {
|
|
7370
7374
|
const parts = [];
|
|
7375
|
+
parts.push(...readEnabledProjectMemories(inputs.memoryEnabled, () => inputs.projectMemory ? [inputs.projectMemory] : []));
|
|
7371
7376
|
if (inputs.seedExamples)
|
|
7372
7377
|
parts.push(inputs.seedExamples);
|
|
7373
7378
|
if (inputs.sessionReferences)
|
|
7374
7379
|
parts.push(inputs.sessionReferences);
|
|
7375
|
-
parts.push(...readEnabledProjectMemories(inputs.memoryEnabled, () => inputs.projectMemory ? [inputs.projectMemory] : []));
|
|
7376
7380
|
if (inputs.extractionFree) {
|
|
7377
7381
|
parts.push(`<extraction>disabled</extraction>
|
|
7378
7382
|
Structural recomp mode: emit compartments and <meta> only. Do NOT emit <facts>, <events>, <user_observations>, or <primer_candidates>.`);
|
|
@@ -7392,6 +7396,34 @@ Memory is disabled for this project: do NOT emit a <facts> block. Produce compar
|
|
|
7392
7396
|
|
|
7393
7397
|
`);
|
|
7394
7398
|
}
|
|
7399
|
+
function logHistorianPromptSizes(sessionId, system, prompt) {
|
|
7400
|
+
const sourceStart = prompt.indexOf(`<new_messages>
|
|
7401
|
+
|
|
7402
|
+
`);
|
|
7403
|
+
const sourceEnd = prompt.lastIndexOf(`
|
|
7404
|
+
|
|
7405
|
+
</new_messages>
|
|
7406
|
+
|
|
7407
|
+
${HISTORIAN_TRANSCRIPT_GUARD}`);
|
|
7408
|
+
const hasSource = sourceStart !== -1 && sourceEnd > sourceStart;
|
|
7409
|
+
const blockBytes = (tag) => {
|
|
7410
|
+
if (!hasSource)
|
|
7411
|
+
return 0;
|
|
7412
|
+
const start = prompt.indexOf(`<${tag}>`);
|
|
7413
|
+
const close = `</${tag}>`;
|
|
7414
|
+
const end = prompt.indexOf(close, start + 1);
|
|
7415
|
+
return start >= 0 && end > start && end < sourceStart ? Buffer.byteLength(prompt.slice(start, end + close.length)) : 0;
|
|
7416
|
+
};
|
|
7417
|
+
const memoryBytes = blockBytes("project-memory");
|
|
7418
|
+
const seedBytes = blockBytes("compartment_examples_from_other_projects");
|
|
7419
|
+
const referenceBytes = blockBytes("session_references");
|
|
7420
|
+
const newMessageBytes = hasSource ? Buffer.byteLength(prompt.slice(sourceStart, sourceEnd + `
|
|
7421
|
+
|
|
7422
|
+
</new_messages>`.length)) : 0;
|
|
7423
|
+
const systemBytes = Buffer.byteLength(system);
|
|
7424
|
+
const userBytes = Buffer.byteLength(prompt);
|
|
7425
|
+
sessionLog2(sessionId, `historian request sizes: systemBytes=${systemBytes} userBytes=${userBytes} memoryBytes=${memoryBytes} seedBytes=${seedBytes} referenceBytes=${referenceBytes} newMessageBytes=${newMessageBytes}`);
|
|
7426
|
+
}
|
|
7395
7427
|
|
|
7396
7428
|
// ../plugin/src/hooks/magic-context/compartment-runner-mapping.ts
|
|
7397
7429
|
function tierFieldsOf(c) {
|
|
@@ -9464,9 +9496,9 @@ function fnv1a(input) {
|
|
|
9464
9496
|
}
|
|
9465
9497
|
return h >>> 0;
|
|
9466
9498
|
}
|
|
9467
|
-
function selectSeeds(sessionId,
|
|
9499
|
+
function selectSeeds(sessionId, _chunkStart, count = SEED_FLOOR) {
|
|
9468
9500
|
const bands = seedsByBand();
|
|
9469
|
-
const seed = fnv1a(
|
|
9501
|
+
const seed = fnv1a(sessionId);
|
|
9470
9502
|
const picks = [];
|
|
9471
9503
|
const bandOrder = [];
|
|
9472
9504
|
for (let i = 0;i < SEED_BANDS.length; i++) {
|
|
@@ -9613,7 +9645,22 @@ function fitHistorianPrompt(args) {
|
|
|
9613
9645
|
const requested = Math.max(0, Math.floor(args.requestedChunkTokens));
|
|
9614
9646
|
const seeds = selectSeeds(args.sessionId, args.chunkStart);
|
|
9615
9647
|
const references = selectSessionReferences(args.sessionCompartments, seeds, args.sessionId, args.chunkStart);
|
|
9616
|
-
const memories =
|
|
9648
|
+
const memories = readEnabledProjectMemories(args.memoryEnabled, () => {
|
|
9649
|
+
const project = args.memoryProject;
|
|
9650
|
+
const projectPath = project?.projectPath;
|
|
9651
|
+
const workspace = project && resolveWorkspaceRenderContext(project);
|
|
9652
|
+
const rows = project ? projectPath && workspace ? readM0ProjectMemories(project.db, projectPath, workspace) : [] : (typeof args.memories === "function" ? args.memories() : args.memories) ?? [];
|
|
9653
|
+
const budget = args.memoryInjectionBudgetTokens ?? DEFAULT_MEMORY_BUDGET_TOKENS;
|
|
9654
|
+
const { selected } = workspace?.isWorkspaced ? trimWorkspaceMemoriesToBudgetV2(args.sessionId, rows, budget, workspace, {
|
|
9655
|
+
sourceNameByMemoryId: sourceNamesForMemories({
|
|
9656
|
+
memories: rows,
|
|
9657
|
+
projectPath,
|
|
9658
|
+
workspace
|
|
9659
|
+
})
|
|
9660
|
+
}) : trimMemoriesToBudgetV2(args.sessionId, rows, budget);
|
|
9661
|
+
const selectedIds = new Set(selected.map((memory) => memory.id));
|
|
9662
|
+
return orderHistorianMemories(rows.filter((memory) => selectedIds.has(memory.id)));
|
|
9663
|
+
});
|
|
9617
9664
|
const render = (refs, memoryCount, seedCount) => ({
|
|
9618
9665
|
seedExamples: renderSeedExamplesBlock(seeds.slice(0, seedCount)),
|
|
9619
9666
|
sessionReferences: renderSessionReferencesBlock(references, refs),
|
|
@@ -10175,6 +10222,7 @@ async function runHistorianPrompt(args) {
|
|
|
10175
10222
|
});
|
|
10176
10223
|
if (failure)
|
|
10177
10224
|
throw new Error(failure);
|
|
10225
|
+
logHistorianPromptSizes(parentSessionId, system, prompt);
|
|
10178
10226
|
return executor.attempt(opened, request);
|
|
10179
10227
|
}, { childSessionId: opened.childSessionId }),
|
|
10180
10228
|
timeoutMs: timeoutMs ?? DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
@@ -26704,7 +26752,6 @@ function shouldWaitForNewHistorianHistory(snapshot, options = {}) {
|
|
|
26704
26752
|
var PROACTIVE_TRIGGER_OFFSET_PERCENTAGE = 2;
|
|
26705
26753
|
var POST_DROP_TARGET_RATIO = 0.75;
|
|
26706
26754
|
var MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE = 6000;
|
|
26707
|
-
var MIN_PROACTIVE_TAIL_MESSAGE_COUNT = 12;
|
|
26708
26755
|
var DEFAULT_MIN_COMMIT_CLUSTERS_FOR_TRIGGER = 3;
|
|
26709
26756
|
var TAIL_SIZE_TRIGGER_MULTIPLIER = 3;
|
|
26710
26757
|
var BLOCK_UNTIL_DONE_PERCENTAGE = 95;
|
|
@@ -26796,7 +26843,6 @@ var TAIL_INFO_DEFAULTS = {
|
|
|
26796
26843
|
nextStartOrdinal: 1,
|
|
26797
26844
|
hasNewRawHistory: false,
|
|
26798
26845
|
hasProtectedEligibleHead: false,
|
|
26799
|
-
isMeaningful: false,
|
|
26800
26846
|
tokenEstimate: 0,
|
|
26801
26847
|
chunkHasMore: false,
|
|
26802
26848
|
trueRawEligibleTokens: 0,
|
|
@@ -26810,6 +26856,17 @@ function resolveBoundaryContextLimit(usage, fallbackContextLimit) {
|
|
|
26810
26856
|
}
|
|
26811
26857
|
return 128000;
|
|
26812
26858
|
}
|
|
26859
|
+
function scanFormattedHead(db, sessionId, triggerBudget, offset, eligibleEnd) {
|
|
26860
|
+
const seed = sessionDecisionCalibration(db, sessionId);
|
|
26861
|
+
const sourceRatio = Math.max(seed.proseRatio, seed.toolsRatio);
|
|
26862
|
+
const scanBudget = Math.floor(Math.max(MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE, triggerBudget * TAIL_SIZE_TRIGGER_MULTIPLIER) / sourceRatio);
|
|
26863
|
+
const chunk = readSessionChunk2(sessionId, scanBudget, offset, eligibleEnd);
|
|
26864
|
+
return {
|
|
26865
|
+
tokenEstimate: Math.ceil(chunk.tokenEstimate * sourceRatio),
|
|
26866
|
+
chunkHasMore: chunk.hasMore,
|
|
26867
|
+
commitClusterCount: chunk.commitClusterCount
|
|
26868
|
+
};
|
|
26869
|
+
}
|
|
26813
26870
|
function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, inMemoryTail, taggerFloor = 0, liftLivePromptFloor = false) {
|
|
26814
26871
|
return withRawSessionMessageCache2(() => {
|
|
26815
26872
|
try {
|
|
@@ -26852,20 +26909,15 @@ function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThr
|
|
|
26852
26909
|
boundarySnapshot: boundary
|
|
26853
26910
|
};
|
|
26854
26911
|
}
|
|
26855
|
-
const
|
|
26856
|
-
const
|
|
26857
|
-
const scanBudget = Math.floor(Math.max(MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE, triggerBudget * TAIL_SIZE_TRIGGER_MULTIPLIER) / sourceRatio);
|
|
26858
|
-
const chunk = readSessionChunk2(sessionId, scanBudget, rawEligibility.offset, boundary.eligibleEndOrdinal);
|
|
26859
|
-
const isMeaningful = chunk.hasMore || boundary.trueRawEligibleTokens >= MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE || Math.ceil(chunk.tokenEstimate * sourceRatio) >= MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE || chunk.messageCount >= MIN_PROACTIVE_TAIL_MESSAGE_COUNT;
|
|
26912
|
+
const formatted = scanFormattedHead(db, sessionId, triggerBudget, rawEligibility.offset, boundary.eligibleEndOrdinal);
|
|
26913
|
+
const proactiveAdmission = formatted.chunkHasMore ? "has_more" : boundary.trueRawEligibleTokens >= MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE ? "true_raw" : formatted.tokenEstimate >= MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE ? "formatted" : undefined;
|
|
26860
26914
|
return {
|
|
26861
26915
|
nextStartOrdinal: rawEligibility.offset,
|
|
26862
26916
|
hasNewRawHistory: true,
|
|
26863
26917
|
hasProtectedEligibleHead,
|
|
26864
|
-
|
|
26865
|
-
|
|
26866
|
-
chunkHasMore: chunk.hasMore,
|
|
26918
|
+
proactiveAdmission,
|
|
26919
|
+
...formatted,
|
|
26867
26920
|
trueRawEligibleTokens: boundary.trueRawEligibleTokens,
|
|
26868
|
-
commitClusterCount: chunk.commitClusterCount,
|
|
26869
26921
|
boundarySnapshot: boundary
|
|
26870
26922
|
};
|
|
26871
26923
|
} catch (error) {
|
|
@@ -26981,8 +27033,12 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
26981
27033
|
sessionLog2(sessionId, `historian redundancy skip: summarizer not needed this pass — force band is ${forceMaterializationPercentage}%; queued/automatic drops are projected to reclaim to ${projectedPostDropPercentage.toFixed(1)}% (target ${relativePostDropTarget.toFixed(1)}%) on this pass (${rideLabel})`);
|
|
26982
27034
|
return { shouldFire: false };
|
|
26983
27035
|
}
|
|
26984
|
-
|
|
27036
|
+
const admittedBy = recovery ? "overflow_recovery" : usage.percentage >= BLOCK_UNTIL_DONE_PERCENTAGE ? "emergency_95" : "force_band";
|
|
27037
|
+
const logForceFire = (trueRawTokens, formattedTokens) => {
|
|
27038
|
+
sessionLog2(sessionId, `compartment trigger: force-firing at ${usage.percentage.toFixed(1)}% (projected post-drop ${formatProjectedPostDropPercentage(projectedPostDropPercentage)}) admittedBy=${admittedBy} trueRawTokens=${trueRawTokens} formattedTokens=${formattedTokens}`);
|
|
27039
|
+
};
|
|
26985
27040
|
if (tailInfo.boundarySnapshot && hasRunnableCompartmentWindow(tailInfo.boundarySnapshot)) {
|
|
27041
|
+
logForceFire(tailInfo.trueRawEligibleTokens, tailInfo.tokenEstimate);
|
|
26986
27042
|
return {
|
|
26987
27043
|
shouldFire: true,
|
|
26988
27044
|
reason: "force_band",
|
|
@@ -26998,7 +27054,7 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
26998
27054
|
absoluteMessageCount: resolvedInMemoryTail.absoluteMessageCount
|
|
26999
27055
|
});
|
|
27000
27056
|
}
|
|
27001
|
-
|
|
27057
|
+
const boundary = resolveOpenCodeProtectedTailBoundary({
|
|
27002
27058
|
db,
|
|
27003
27059
|
sessionId,
|
|
27004
27060
|
mode: "trigger",
|
|
@@ -27009,8 +27065,18 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
27009
27065
|
emergencyTailScale: scale,
|
|
27010
27066
|
recovery
|
|
27011
27067
|
});
|
|
27068
|
+
if (!hasRunnableCompartmentWindow(boundary))
|
|
27069
|
+
return null;
|
|
27070
|
+
let formattedTokens;
|
|
27071
|
+
try {
|
|
27072
|
+
formattedTokens = scanFormattedHead(db, sessionId, triggerBudget, boundary.offset, boundary.eligibleEndOrdinal).tokenEstimate;
|
|
27073
|
+
} catch {
|
|
27074
|
+
formattedTokens = "unavailable";
|
|
27075
|
+
}
|
|
27076
|
+
logForceFire(boundary.trueRawEligibleTokens, formattedTokens);
|
|
27077
|
+
return boundary;
|
|
27012
27078
|
});
|
|
27013
|
-
if (
|
|
27079
|
+
if (scaledBoundary) {
|
|
27014
27080
|
return { shouldFire: true, reason: "force_band", boundarySnapshot: scaledBoundary };
|
|
27015
27081
|
}
|
|
27016
27082
|
sessionLog2(sessionId, "compartment trigger: force_band skipped — no protected head meets summary admission after emergency tail scale");
|
|
@@ -27019,7 +27085,7 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
27019
27085
|
const clusterEnabled = commitClusterTrigger?.enabled ?? true;
|
|
27020
27086
|
const minClusters = commitClusterTrigger?.min_clusters ?? DEFAULT_MIN_COMMIT_CLUSTERS_FOR_TRIGGER;
|
|
27021
27087
|
if (clusterEnabled && tailInfo.commitClusterCount >= minClusters && tailInfo.tokenEstimate >= triggerBudget) {
|
|
27022
|
-
sessionLog2(sessionId, `compartment trigger: commit-cluster fire — ${tailInfo.commitClusterCount} clusters (min=${minClusters})
|
|
27088
|
+
sessionLog2(sessionId, `compartment trigger: commit-cluster fire — ${tailInfo.commitClusterCount} clusters (min=${minClusters}) admittedBy=commit_clusters trueRawTokens=${tailInfo.trueRawEligibleTokens} formattedTokens=${tailInfo.tokenEstimate}`);
|
|
27023
27089
|
return {
|
|
27024
27090
|
shouldFire: true,
|
|
27025
27091
|
reason: "commit_clusters",
|
|
@@ -27027,7 +27093,8 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
27027
27093
|
};
|
|
27028
27094
|
}
|
|
27029
27095
|
if (tailInfo.tokenEstimate >= triggerBudget * TAIL_SIZE_TRIGGER_MULTIPLIER || tailInfo.chunkHasMore && tailInfo.tokenEstimate > 0) {
|
|
27030
|
-
|
|
27096
|
+
const admittedBy = tailInfo.chunkHasMore ? "has_more" : "formatted";
|
|
27097
|
+
sessionLog2(sessionId, `compartment trigger: tail-size fire — budget threshold ${triggerBudget * TAIL_SIZE_TRIGGER_MULTIPLIER} admittedBy=${admittedBy} trueRawTokens=${tailInfo.trueRawEligibleTokens} formattedTokens=${tailInfo.tokenEstimate}`);
|
|
27031
27098
|
return {
|
|
27032
27099
|
shouldFire: true,
|
|
27033
27100
|
reason: "tail_size",
|
|
@@ -27043,13 +27110,13 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
27043
27110
|
sessionLog2(sessionId, `historian redundancy skip: summarizer not needed this pass — usage is ${usage.percentage.toFixed(1)}%; queued/automatic drops are projected to reclaim to ${projectedPostDropPercentage.toFixed(1)}% (target ${relativePostDropTarget.toFixed(1)}%) on this pass (${rideLabel})`);
|
|
27044
27111
|
return { shouldFire: false };
|
|
27045
27112
|
}
|
|
27046
|
-
if (!tailInfo.hasProtectedEligibleHead || !tailInfo.
|
|
27113
|
+
if (!tailInfo.hasProtectedEligibleHead || !tailInfo.proactiveAdmission) {
|
|
27047
27114
|
let floorOnly = false;
|
|
27048
27115
|
const boundary = tailInfo.boundarySnapshot;
|
|
27049
27116
|
const floor = boundary?.diagnostics?.livePromptFloor;
|
|
27050
27117
|
if (!consumedFloorMark && floor?.ordinal && floor.from > floor.to) {
|
|
27051
27118
|
const withoutFloor = getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThresholdPercentage, contextLimit, resolvedInMemoryTail, taggerFloor, true);
|
|
27052
|
-
floorOnly = withoutFloor.hasProtectedEligibleHead && withoutFloor.
|
|
27119
|
+
floorOnly = withoutFloor.hasProtectedEligibleHead && withoutFloor.proactiveAdmission !== undefined;
|
|
27053
27120
|
if (floorOnly && primaryExecute && usage.percentage >= executeThresholdPercentage && writeExecuteReclaimState(db, sessionId, {
|
|
27054
27121
|
floorOrdinal: floor.ordinal,
|
|
27055
27122
|
floorPromptId: floor.messageId ?? null
|
|
@@ -27061,7 +27128,7 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
27061
27128
|
sessionLog2(sessionId, `compartment trigger: not firing at ${usage.percentage.toFixed(1)}% — ${refusal}; offset=${tailInfo.nextStartOrdinal} protectedStart=${boundary?.protectedTailStart ?? "none"} eligibleEnd=${boundary?.eligibleEndOrdinal ?? "none"} rawTokens=${tailInfo.trueRawEligibleTokens} chunkTokens=${tailInfo.tokenEstimate}`);
|
|
27062
27129
|
return { shouldFire: false };
|
|
27063
27130
|
}
|
|
27064
|
-
sessionLog2(sessionId, `compartment trigger: proactive fire at ${usage.percentage.toFixed(1)}% (floor=${proactiveTriggerPercentage}% projected post-drop=${formatProjectedPostDropPercentage(projectedPostDropPercentage)} target=${relativePostDropTarget.toFixed(1)}%)`);
|
|
27131
|
+
sessionLog2(sessionId, `compartment trigger: proactive fire at ${usage.percentage.toFixed(1)}% (floor=${proactiveTriggerPercentage}% projected post-drop=${formatProjectedPostDropPercentage(projectedPostDropPercentage)} target=${relativePostDropTarget.toFixed(1)}%) admittedBy=${tailInfo.proactiveAdmission} trueRawTokens=${tailInfo.trueRawEligibleTokens} formattedTokens=${tailInfo.tokenEstimate}`);
|
|
27065
27132
|
return {
|
|
27066
27133
|
shouldFire: true,
|
|
27067
27134
|
reason: "projected_headroom",
|
|
@@ -31054,6 +31121,7 @@ async function runHistorianSubagentWithTransientRetriesGuarded(args) {
|
|
|
31054
31121
|
if (failure)
|
|
31055
31122
|
throw new Error(failure);
|
|
31056
31123
|
args.onDispatch?.();
|
|
31124
|
+
logHistorianPromptSizes(args.sessionId, args.options.systemPrompt, args.options.userMessage);
|
|
31057
31125
|
result = await args.runner.run({
|
|
31058
31126
|
...args.options,
|
|
31059
31127
|
cacheTail: retryIndex > 0 ? "write" : args.options.cacheTail ?? "skip",
|
|
@@ -31358,7 +31426,8 @@ async function runPiHistorian(deps) {
|
|
|
31358
31426
|
chunkStart: Math.max(1, offset),
|
|
31359
31427
|
lastOrdinal: eligibleEndOrdinal - 1,
|
|
31360
31428
|
sessionCompartments: priorCompartments,
|
|
31361
|
-
|
|
31429
|
+
memoryProject: { db, projectPath: projectPath ?? undefined },
|
|
31430
|
+
memoryInjectionBudgetTokens: deps.memoryInjectionBudgetTokens,
|
|
31362
31431
|
memoryEnabled: memoryEnabled !== false,
|
|
31363
31432
|
userObservationsRequested
|
|
31364
31433
|
});
|
|
@@ -31470,6 +31539,9 @@ async function runPiHistorian(deps) {
|
|
|
31470
31539
|
if (chunkText !== chunk.text) {
|
|
31471
31540
|
sessionLog2(sessionId, `historian pre-flight: truncated formatted input for ${chunk.startIndex}-${chunk.endIndex} to fit ${chunkTokens} tokens`);
|
|
31472
31541
|
}
|
|
31542
|
+
if (deps.recoveryTriggerReason) {
|
|
31543
|
+
sessionLog2(sessionId, `historian recovery fire: admittedBy=${deps.recoveryTriggerReason} trueRawTokens=${boundarySnapshot.trueRawEligibleTokens} formattedChunkTokens=${chunk.tokenEstimate}`);
|
|
31544
|
+
}
|
|
31473
31545
|
const prompt = buildCompartmentAgentPrompt({
|
|
31474
31546
|
seedExamples: promptFit.seedExamples,
|
|
31475
31547
|
sessionReferences: promptFit.sessionReferences,
|
|
@@ -35488,6 +35560,7 @@ function getCachedMarkers(db, state, compartmentsForNormalization, metaOverride,
|
|
|
35488
35560
|
compartmentRenderEpoch: cachedUpgradeIdentity.compartmentRenderEpoch,
|
|
35489
35561
|
memoryRenderEpoch: cachedUpgradeIdentity.memoryRenderEpoch,
|
|
35490
35562
|
lastBaselineEndMessageId: cachedBoundary,
|
|
35563
|
+
lastBaselineEndPartial: cachedRowOverride?.cached_trim_partial === 1,
|
|
35491
35564
|
systemHash: meta.cachedM0SystemHash ?? "",
|
|
35492
35565
|
modelKey: meta.cachedM0ModelKey ?? "",
|
|
35493
35566
|
projectIdentity: meta.cachedM0ProjectIdentity ?? null,
|
|
@@ -35500,6 +35573,9 @@ function lastBaselineEndMessageId(compartments) {
|
|
|
35500
35573
|
const last = compartments.at(-1);
|
|
35501
35574
|
return last?.endMessageId && last.endMessageId.length > 0 ? last.endMessageId : null;
|
|
35502
35575
|
}
|
|
35576
|
+
function isPartialBoundary(compartments, id) {
|
|
35577
|
+
return id !== null && compartments.some((row) => row.endMessageId === id && row.endBlockIndex != null);
|
|
35578
|
+
}
|
|
35503
35579
|
function readCurrentMarkers(db, state, projectDocsHash) {
|
|
35504
35580
|
return readCurrentMarkersFromCompartments(db, state, getRenderableCompartmentsPi(db, state), projectDocsHash);
|
|
35505
35581
|
}
|
|
@@ -35524,6 +35600,7 @@ function readCurrentMarkersFromCompartments(db, state, compartments, projectDocs
|
|
|
35524
35600
|
compartmentRenderEpoch: COMPARTMENT_RENDER_EPOCH,
|
|
35525
35601
|
memoryRenderEpoch: MEMORY_RENDER_FORMAT_EPOCH,
|
|
35526
35602
|
lastBaselineEndMessageId: lastBaselineEndMessageId(compartments),
|
|
35603
|
+
lastBaselineEndPartial: isPartialBoundary(compartments, lastBaselineEndMessageId(compartments)),
|
|
35527
35604
|
systemHash: (state.hardSignals ?? EMPTY_PI_HARD_SIGNALS).systemHash,
|
|
35528
35605
|
modelKey: piModelRefToCanonical((state.hardSignals ?? EMPTY_PI_HARD_SIGNALS).modelKey),
|
|
35529
35606
|
projectIdentity: state.projectIdentity,
|
|
@@ -35693,6 +35770,7 @@ function readFrozenM0InputsPi(state, db, docs = readProjectDocsForPiM0(state), m
|
|
|
35693
35770
|
compartmentRenderEpoch: COMPARTMENT_RENDER_EPOCH,
|
|
35694
35771
|
memoryRenderEpoch: MEMORY_RENDER_FORMAT_EPOCH,
|
|
35695
35772
|
lastBaselineEndMessageId: lastBaselineEndMessageId(compartments),
|
|
35773
|
+
lastBaselineEndPartial: isPartialBoundary(compartments, lastBaselineEndMessageId(compartments)),
|
|
35696
35774
|
systemHash: (state.hardSignals ?? EMPTY_PI_HARD_SIGNALS).systemHash,
|
|
35697
35775
|
modelKey: piModelRefToCanonical((state.hardSignals ?? EMPTY_PI_HARD_SIGNALS).modelKey),
|
|
35698
35776
|
projectIdentity: state.projectIdentity,
|
|
@@ -36018,6 +36096,7 @@ function readCachedPiM0M1Row(db, sessionId) {
|
|
|
36018
36096
|
cached_m0_model_key,
|
|
36019
36097
|
cached_m0_project_identity,
|
|
36020
36098
|
cached_m0_last_baseline_end_message_id,
|
|
36099
|
+
${CACHED_TRIM_PARTIAL_SQL} AS cached_trim_partial,
|
|
36021
36100
|
memory_block_ids
|
|
36022
36101
|
FROM session_meta
|
|
36023
36102
|
WHERE session_id = ?`).get(sessionId);
|
|
@@ -36069,6 +36148,7 @@ function markersFromCachedPiRow(row, compartmentsForNormalization) {
|
|
|
36069
36148
|
compartmentRenderEpoch: cachedUpgradeIdentity.compartmentRenderEpoch,
|
|
36070
36149
|
memoryRenderEpoch: cachedUpgradeIdentity.memoryRenderEpoch,
|
|
36071
36150
|
lastBaselineEndMessageId: typeof row.cached_m0_last_baseline_end_message_id === "string" && row.cached_m0_last_baseline_end_message_id.length > 0 ? row.cached_m0_last_baseline_end_message_id : null,
|
|
36151
|
+
lastBaselineEndPartial: row.cached_trim_partial === 1,
|
|
36072
36152
|
systemHash: row.cached_m0_system_hash ?? "",
|
|
36073
36153
|
modelKey: row.cached_m0_model_key ?? "",
|
|
36074
36154
|
projectIdentity: row.cached_m0_project_identity ?? null,
|
|
@@ -36168,7 +36248,11 @@ function softRefreshCachedM1Pi(args) {
|
|
|
36168
36248
|
return {
|
|
36169
36249
|
m0: decodeCachedM0(row.cached_m0_bytes) ?? "",
|
|
36170
36250
|
m1: rendered.text,
|
|
36171
|
-
markers: {
|
|
36251
|
+
markers: {
|
|
36252
|
+
...markers,
|
|
36253
|
+
lastBaselineEndMessageId: advancedBoundary,
|
|
36254
|
+
lastBaselineEndPartial: latest?.endMessageId ? isPartialBoundary(compartments, advancedBoundary) : markers.lastBaselineEndPartial
|
|
36255
|
+
},
|
|
36172
36256
|
memoryUpdateCount: rendered.memoryUpdateCount,
|
|
36173
36257
|
recomputed: true
|
|
36174
36258
|
};
|
|
@@ -36223,7 +36307,7 @@ function replayCompletePiPrefix(db, state, row, compartments, messages, entryIds
|
|
|
36223
36307
|
if (!mural)
|
|
36224
36308
|
m0 = stripMemoryMuralBlock(m0);
|
|
36225
36309
|
const trimBoundaryId = row.cached_m0_last_baseline_end_message_id;
|
|
36226
|
-
const skippedVisibleMessages = trimBoundaryId ? trimPiMessagesToBoundary(messages, entryIds, trimBoundaryId, false, state.sessionId,
|
|
36310
|
+
const skippedVisibleMessages = trimBoundaryId ? trimPiMessagesToBoundary(messages, entryIds, trimBoundaryId, false, state.sessionId, row.cached_trim_partial === 1, (ids) => queueAutoSearchHintDecisionRetirement(db, state.sessionId, ids)) : 0;
|
|
36227
36311
|
const head = [];
|
|
36228
36312
|
prependM0M1Messages(head, m0, m1, mural, messages[0]?.timestamp);
|
|
36229
36313
|
const insertionIndex = placePiInitialSystemAtHead(messages);
|
|
@@ -36244,7 +36328,12 @@ function replayCompletePiPrefix(db, state, row, compartments, messages, entryIds
|
|
|
36244
36328
|
syntheticLeadingCount: insertionIndex + 2
|
|
36245
36329
|
};
|
|
36246
36330
|
if (state.freezePrefixForPass)
|
|
36247
|
-
state.preparedPrefix = {
|
|
36331
|
+
state.preparedPrefix = {
|
|
36332
|
+
result,
|
|
36333
|
+
messages: head,
|
|
36334
|
+
trimBoundaryId,
|
|
36335
|
+
trimBoundaryPartial: row.cached_trim_partial === 1
|
|
36336
|
+
};
|
|
36248
36337
|
return result;
|
|
36249
36338
|
}
|
|
36250
36339
|
function prepareCachedM0M1PiReplay(state, db, rowOverride) {
|
|
@@ -36262,7 +36351,7 @@ function prepareCachedM0M1PiReplay(state, db, rowOverride) {
|
|
|
36262
36351
|
function injectM0M1Pi(state, db, piMessages, entryIds, recomputeM1ThisPass = false, passSnapshot) {
|
|
36263
36352
|
if (state.preparedPrefix) {
|
|
36264
36353
|
const prepared = state.preparedPrefix;
|
|
36265
|
-
const skippedVisibleMessages = prepared.trimBoundaryId ? trimPiMessagesToBoundary(piMessages, entryIds, prepared.trimBoundaryId, false, state.sessionId,
|
|
36354
|
+
const skippedVisibleMessages = prepared.trimBoundaryId ? trimPiMessagesToBoundary(piMessages, entryIds, prepared.trimBoundaryId, false, state.sessionId, prepared.trimBoundaryPartial, (ids) => queueAutoSearchHintDecisionRetirement(db, state.sessionId, ids)) : 0;
|
|
36266
36355
|
const head = structuredClone(prepared.messages);
|
|
36267
36356
|
const timestamp = piMessages[0]?.timestamp;
|
|
36268
36357
|
if (typeof timestamp === "number") {
|
|
@@ -36425,7 +36514,8 @@ function injectM0M1Pi(state, db, piMessages, entryIds, recomputeM1ThisPass = fal
|
|
|
36425
36514
|
};
|
|
36426
36515
|
}
|
|
36427
36516
|
}
|
|
36428
|
-
const
|
|
36517
|
+
const trimBoundaryPartial = markers.lastBaselineEndPartial;
|
|
36518
|
+
const skippedVisibleMessages = trimBoundaryId ? trimPiMessagesToBoundary(piMessages, entryIds, trimBoundaryId, false, state.sessionId, trimBoundaryPartial, (ids) => queueAutoSearchHintDecisionRetirement(db, state.sessionId, ids)) : 0;
|
|
36429
36519
|
const muralWire = m0.includes("<memory-mural>") ? muralForWire(state.sessionId) : undefined;
|
|
36430
36520
|
if (!muralWire)
|
|
36431
36521
|
m0 = stripMemoryMuralBlock(m0);
|
|
@@ -36462,7 +36552,8 @@ function injectM0M1Pi(state, db, piMessages, entryIds, recomputeM1ThisPass = fal
|
|
|
36462
36552
|
state.preparedPrefix = {
|
|
36463
36553
|
result,
|
|
36464
36554
|
messages: structuredClone(piMessages.slice(insertionIndex, insertionIndex + 2)),
|
|
36465
|
-
trimBoundaryId
|
|
36555
|
+
trimBoundaryId,
|
|
36556
|
+
trimBoundaryPartial
|
|
36466
36557
|
};
|
|
36467
36558
|
return result;
|
|
36468
36559
|
}
|
|
@@ -49162,6 +49253,7 @@ function readPiBranchEntriesForContext(ctx, sessionId) {
|
|
|
49162
49253
|
};
|
|
49163
49254
|
piBranchProjectionBySession.set(sessionId, projection);
|
|
49164
49255
|
piBranchLookupByProjection.set(entries, cached.lookup);
|
|
49256
|
+
inheritPiOrdinalAlignment(sessionId, cached.entries, entries);
|
|
49165
49257
|
return entries;
|
|
49166
49258
|
}
|
|
49167
49259
|
const entries = cached && cachedAncestorIndex !== undefined ? [...cached.entries.slice(0, cachedAncestorIndex + 1), ...suffix] : suffix;
|
|
@@ -51841,6 +51933,8 @@ function spawnPiHistorianRun(args) {
|
|
|
51841
51933
|
expandTools: historian.expandTools,
|
|
51842
51934
|
thinkingLevel: historian.thinkingLevel,
|
|
51843
51935
|
memoryEnabled: historian.memoryEnabled,
|
|
51936
|
+
memoryInjectionBudgetTokens: historian.memoryInjectionBudgetTokens,
|
|
51937
|
+
recoveryTriggerReason: args.recoveryTriggerReason,
|
|
51844
51938
|
allowHomeProject: historian.allowHomeProject,
|
|
51845
51939
|
autoPromote: historian.autoPromote,
|
|
51846
51940
|
userMemoriesEnabled: historian.userMemoriesEnabled,
|
|
@@ -52098,6 +52192,7 @@ function maybeFireHistorian(args) {
|
|
|
52098
52192
|
provider,
|
|
52099
52193
|
unregister,
|
|
52100
52194
|
boundarySnapshot: snapshot,
|
|
52195
|
+
recoveryTriggerReason: "history_retirement",
|
|
52101
52196
|
refreshBoundarySnapshot: resolveRunnablePiBoundarySnapshot,
|
|
52102
52197
|
currentContextLimit: boundaryContextLimit,
|
|
52103
52198
|
fallbackModelId: modelKey
|
|
@@ -52128,6 +52223,7 @@ Historian previously failed ${failureCount} time(s), so Magic Context is retryin
|
|
|
52128
52223
|
provider,
|
|
52129
52224
|
unregister,
|
|
52130
52225
|
boundarySnapshot: prepareRecoveryBoundary,
|
|
52226
|
+
recoveryTriggerReason: "startup_recovery",
|
|
52131
52227
|
refreshBoundarySnapshot: resolveRunnablePiBoundarySnapshot,
|
|
52132
52228
|
currentContextLimit: boundaryContextLimit,
|
|
52133
52229
|
fallbackModelId: modelKey
|
|
@@ -57056,6 +57152,7 @@ Chunk ${chunkIndex}: wrapping messages ${plan.snapshot.offset}-${plan.snapshot.e
|
|
|
57056
57152
|
maxOutputTokens: deps.historianMaxOutputTokens,
|
|
57057
57153
|
thinkingLevel: deps.historianThinkingLevel,
|
|
57058
57154
|
memoryEnabled: deps.memoryEnabled,
|
|
57155
|
+
memoryInjectionBudgetTokens: deps.memoryInjectionBudgetTokens,
|
|
57059
57156
|
autoPromote: deps.autoPromote,
|
|
57060
57157
|
userMemoriesEnabled: deps.userMemoriesEnabled,
|
|
57061
57158
|
userObservationsRequested: deps.userObservationsRequested,
|
|
@@ -58231,6 +58328,7 @@ function resolveHistorianFromConfig(config, harness = PI_HARNESS_KIND, modelRegi
|
|
|
58231
58328
|
keepReasoningTokens: config.keep_reasoning_tokens,
|
|
58232
58329
|
historyBudgetPercentage: config.history_budget_percentage,
|
|
58233
58330
|
memoryEnabled: config.memory.enabled,
|
|
58331
|
+
memoryInjectionBudgetTokens: config.memory.injection_budget_tokens,
|
|
58234
58332
|
autoPromote: config.memory.auto_promote,
|
|
58235
58333
|
userMemoriesEnabled: userObservationCollectionEnabled(config.dreamer),
|
|
58236
58334
|
userObservationsRequested: userObservationsRequested(config.dreamer),
|
|
@@ -58891,6 +58989,7 @@ async function startPiMagicContextRuntime(pi, database, dbPath) {
|
|
|
58891
58989
|
...buildPiHistorianCommandOptions(bootProjectDeps.historianConfig, bootProjectDeps.config),
|
|
58892
58990
|
language: bootProjectDeps.config.language,
|
|
58893
58991
|
memoryEnabled: bootProjectDeps.config.memory.enabled,
|
|
58992
|
+
memoryInjectionBudgetTokens: bootProjectDeps.config.memory.injection_budget_tokens,
|
|
58894
58993
|
autoPromote: bootProjectDeps.config.memory.auto_promote,
|
|
58895
58994
|
compactionOff,
|
|
58896
58995
|
userMemoriesEnabled: userObservationCollectionEnabled(bootProjectDeps.config.dreamer),
|
|
@@ -58907,6 +59006,7 @@ async function startPiMagicContextRuntime(pi, database, dbPath) {
|
|
|
58907
59006
|
...buildPiHistorianCommandOptions(historian, current.config),
|
|
58908
59007
|
language: current.config.language,
|
|
58909
59008
|
memoryEnabled: current.config.memory.enabled,
|
|
59009
|
+
memoryInjectionBudgetTokens: current.config.memory.injection_budget_tokens,
|
|
58910
59010
|
autoPromote: fresh.memory.auto_promote,
|
|
58911
59011
|
compactionOff,
|
|
58912
59012
|
userMemoriesEnabled: userObservationCollectionEnabled(current.config.dreamer),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
withIndexChunk2,
|
|
4
4
|
yieldIndexChunk2
|
|
5
5
|
} from "./index-2qtx0q6h.js";
|
|
6
|
-
import"./index-
|
|
6
|
+
import"./index-pehdap7a.js";
|
|
7
7
|
import"./index-pefn1gt5.js";
|
|
8
8
|
import"./index-0h2mkab2.js";
|
|
9
9
|
import"./index-tm11k42a.js";
|
|
@@ -15,7 +15,7 @@ import"./index-wfqysrwq.js";
|
|
|
15
15
|
import"./index-x2n261wp.js";
|
|
16
16
|
import"./index-xjhq27z9.js";
|
|
17
17
|
import"./index-n0zjvs3h.js";
|
|
18
|
-
import"./index-
|
|
18
|
+
import"./index-5vqnvjb2.js";
|
|
19
19
|
import"./index-6x556c2q.js";
|
|
20
20
|
import {
|
|
21
21
|
MESSAGE_INDEX_MAX_FTS_BYTES,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
markMessageIndexDirty,
|
|
25
25
|
getIndexableContent,
|
|
26
26
|
indexSingleMessage
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-pvd2xhwy.js";
|
|
28
28
|
import"./index-ghp32f9m.js";
|
|
29
29
|
import"./index-1ts77n1b.js";
|
|
30
30
|
|
package/dist/migration-worker.js
CHANGED
|
@@ -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-
|
|
22
|
+
const { serveV2ArchiveReads } = await import("./v2-archive-reader-kxc3cdez.js");
|
|
23
23
|
await serveV2ArchiveReads(port, openConnections);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
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-
|
|
54
|
+
const { renderSearchArchive } = await import("./search-archive-2bh9j29f.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-0tytrjye.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -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-
|
|
84
|
+
import("./message-index-bounded-53hv89kz.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-
|
|
98
|
+
const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-2j1zhtq7.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,8 +38,8 @@ import {
|
|
|
38
38
|
readSessionChunk2,
|
|
39
39
|
getRawSessionMessageIdsThrough2,
|
|
40
40
|
readRawSessionSeedTail2
|
|
41
|
-
} from "./index-
|
|
42
|
-
import"./index-
|
|
41
|
+
} from "./index-5vqnvjb2.js";
|
|
42
|
+
import"./index-pehdap7a.js";
|
|
43
43
|
import"./index-6x556c2q.js";
|
|
44
44
|
import"./index-vcegxfwg.js";
|
|
45
45
|
import"./index-jhmz9tgv.js";
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
renderVerboseRange2,
|
|
4
4
|
renderVerboseRangeForTool2,
|
|
5
5
|
renderItemByTag2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-wxgfn7h9.js";
|
|
7
7
|
import"./index-k7a8x7ba.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-pvd2xhwy.js";
|
|
9
9
|
import"./index-hgd00nas.js";
|
|
10
10
|
import"./index-nvh6d3bz.js";
|
|
11
11
|
import"./index-cxczethe.js";
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
import"./index-5vqnvjb2.js";
|
|
13
|
+
import"./index-pehdap7a.js";
|
|
14
14
|
import"./index-6x556c2q.js";
|
|
15
15
|
import"./index-5rcjs14a.js";
|
|
16
16
|
import"./index-vcegxfwg.js";
|
|
17
|
-
import"./index-
|
|
17
|
+
import"./index-msp5k4hv.js";
|
|
18
18
|
import"./index-fapenpch.js";
|
|
19
19
|
import"./index-gavj3e6h.js";
|
|
20
20
|
import"./index-135e8hvg.js";
|