@cortexkit/pi-magic-context 0.44.2 → 0.44.4
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/{index-esnhck8v.js → index-5am7amy4.js} +229 -60
- package/dist/{index-gsff513e.js → index-npagr1cy.js} +113 -30
- package/dist/index.js +401 -221
- package/dist/{read-session-chunk-zhtcx9f1.js → read-session-chunk-w493f72c.js} +1 -1
- package/dist/subagent-entry.js +2 -2
- package/package.json +8 -4
|
@@ -2296,7 +2296,10 @@ function installTransactionRouting(db, readonly) {
|
|
|
2296
2296
|
writable: true,
|
|
2297
2297
|
value: (sql) => {
|
|
2298
2298
|
if (/^\s*BEGIN\s+(?:IMMEDIATE|EXCLUSIVE)(?:\s+TRANSACTION)?\s*;?\s*$/i.test(sql)) {
|
|
2299
|
-
|
|
2299
|
+
if (transformPassScope.getStore()?.active || backgroundWriterScope.getStore())
|
|
2300
|
+
acquireShort(db, () => nativeExec(sql), sql.trim());
|
|
2301
|
+
else
|
|
2302
|
+
nativeExec(sql);
|
|
2300
2303
|
return db;
|
|
2301
2304
|
}
|
|
2302
2305
|
return nativeExec(sql);
|
|
@@ -2399,8 +2402,27 @@ function buildNodeSqliteDatabaseClass(DatabaseSync) {
|
|
|
2399
2402
|
return NodeSqliteDatabase;
|
|
2400
2403
|
}
|
|
2401
2404
|
var Database = TrackedDatabase;
|
|
2405
|
+
function pragmaValue(db, name) {
|
|
2406
|
+
const row = db.prepare(`PRAGMA ${name}`).get();
|
|
2407
|
+
if (!row)
|
|
2408
|
+
return;
|
|
2409
|
+
return row[name] ?? Object.values(row)[0];
|
|
2410
|
+
}
|
|
2411
|
+
function pragmaNumber(db, name) {
|
|
2412
|
+
try {
|
|
2413
|
+
const value = pragmaValue(db, name);
|
|
2414
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
2415
|
+
} catch {
|
|
2416
|
+
return null;
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2402
2419
|
var privilegeDepth = new WeakMap;
|
|
2403
2420
|
var transformPassScope = new AsyncLocalStorage;
|
|
2421
|
+
var admissionScope = new AsyncLocalStorage;
|
|
2422
|
+
var backgroundWriterScope = new AsyncLocalStorage;
|
|
2423
|
+
function withSqliteBackgroundWriter(operation) {
|
|
2424
|
+
return backgroundWriterScope.run(true, operation);
|
|
2425
|
+
}
|
|
2404
2426
|
function isTransientSqliteError(error) {
|
|
2405
2427
|
if (!error || typeof error !== "object")
|
|
2406
2428
|
return false;
|
|
@@ -2412,28 +2434,32 @@ class SqliteAcquisitionBusyError extends Error {
|
|
|
2412
2434
|
code = "SQLITE_BUSY";
|
|
2413
2435
|
stage;
|
|
2414
2436
|
constructor(cause, stage = "BEGIN IMMEDIATE") {
|
|
2415
|
-
super("SQLite writer acquisition remained busy
|
|
2437
|
+
super("SQLite writer acquisition remained busy", { cause });
|
|
2416
2438
|
this.name = "SqliteAcquisitionBusyError";
|
|
2417
2439
|
this.stage = stage;
|
|
2418
2440
|
}
|
|
2419
2441
|
}
|
|
2420
|
-
|
|
2421
|
-
|
|
2442
|
+
var SHORT_BUSY_TIMEOUT_MS = 25;
|
|
2443
|
+
var FOREGROUND_IN_PASS_BUSY_TIMEOUT_MS = 250;
|
|
2444
|
+
function acquireShort(db, acquire, site) {
|
|
2445
|
+
const started = performance.now();
|
|
2446
|
+
const previous = pragmaNumber(db, "busy_timeout");
|
|
2447
|
+
let acquired = false;
|
|
2448
|
+
try {
|
|
2449
|
+
const timeout = transformPassScope.getStore()?.active && !admissionScope.getStore() && !backgroundWriterScope.getStore() ? FOREGROUND_IN_PASS_BUSY_TIMEOUT_MS : SHORT_BUSY_TIMEOUT_MS;
|
|
2450
|
+
db.exec(`PRAGMA busy_timeout=${timeout}`);
|
|
2422
2451
|
acquire();
|
|
2423
|
-
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
throw new SqliteAcquisitionBusyError(error, stage);
|
|
2435
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, delays[attempt]);
|
|
2436
|
-
}
|
|
2452
|
+
acquired = true;
|
|
2453
|
+
} catch (error) {
|
|
2454
|
+
if (transformPassScope.getStore()?.active && isTransientSqliteError(error))
|
|
2455
|
+
throw new SqliteAcquisitionBusyError(error, site);
|
|
2456
|
+
throw error;
|
|
2457
|
+
} finally {
|
|
2458
|
+
if (previous !== null)
|
|
2459
|
+
db.exec(`PRAGMA busy_timeout=${previous}`);
|
|
2460
|
+
const elapsed = performance.now() - started;
|
|
2461
|
+
if (elapsed >= 250)
|
|
2462
|
+
console.warn(`[${new Date().toISOString()}] [magic-context] sqlite acquisition site=${site} lane=${transformPassScope.getStore()?.active ? "foreground" : "background"} elapsed=${Math.round(elapsed)}ms attempts=1 outcome=${acquired ? "acquired" : "busy"}`);
|
|
2437
2463
|
}
|
|
2438
2464
|
}
|
|
2439
2465
|
function isInTransaction(db) {
|
|
@@ -2448,7 +2474,13 @@ function withPrivilegedWriter(db, operation) {
|
|
|
2448
2474
|
if (nested) {
|
|
2449
2475
|
db.exec(`SAVEPOINT ${savepoint}`);
|
|
2450
2476
|
} else {
|
|
2451
|
-
|
|
2477
|
+
try {
|
|
2478
|
+
db.exec("BEGIN IMMEDIATE");
|
|
2479
|
+
} catch (error) {
|
|
2480
|
+
if (transformPassScope.getStore()?.active && isTransientSqliteError(error))
|
|
2481
|
+
throw new SqliteAcquisitionBusyError(error);
|
|
2482
|
+
throw error;
|
|
2483
|
+
}
|
|
2452
2484
|
}
|
|
2453
2485
|
privilegeDepth.set(db, previousDepth + 1);
|
|
2454
2486
|
try {
|
|
@@ -2666,8 +2698,8 @@ function readRawSessionMessagesFromDb(db, sessionId) {
|
|
|
2666
2698
|
};
|
|
2667
2699
|
});
|
|
2668
2700
|
}
|
|
2669
|
-
function readRawSessionMessagePageFromDb(db, sessionId, afterOrdinal, limit, finalWatermark = Number.MAX_SAFE_INTEGER) {
|
|
2670
|
-
const messageRows = readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWatermark);
|
|
2701
|
+
function readRawSessionMessagePageFromDb(db, sessionId, afterOrdinal, limit, finalWatermark = Number.MAX_SAFE_INTEGER, after) {
|
|
2702
|
+
const messageRows = readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWatermark, after);
|
|
2671
2703
|
if (messageRows.length === 0)
|
|
2672
2704
|
return [];
|
|
2673
2705
|
const placeholders = messageRows.map(() => "?").join(", ");
|
|
@@ -2678,15 +2710,22 @@ function readRawSessionMessagePageFromDb(db, sessionId, afterOrdinal, limit, fin
|
|
|
2678
2710
|
ORDER BY message_id ASC, time_created ASC, id ASC`).all(sessionId, ...messageRows.map((row) => row.id)).filter(isRawPartRow);
|
|
2679
2711
|
return assembleRawMessagePage(messageRows, partRows);
|
|
2680
2712
|
}
|
|
2681
|
-
function readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWatermark) {
|
|
2713
|
+
function readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWatermark, after) {
|
|
2682
2714
|
const remaining = Math.max(0, Math.floor(finalWatermark) - Math.floor(afterOrdinal));
|
|
2683
2715
|
const pageSize = Math.min(Math.max(1, Math.floor(limit)), remaining);
|
|
2684
2716
|
if (pageSize === 0)
|
|
2685
2717
|
return [];
|
|
2718
|
+
const parameters = [sessionId];
|
|
2719
|
+
if (after)
|
|
2720
|
+
parameters.push(after.timeCreated, after.timeCreated, after.timeCreated, after.id);
|
|
2721
|
+
parameters.push(pageSize);
|
|
2722
|
+
if (!after)
|
|
2723
|
+
parameters.push(Math.max(0, Math.floor(afterOrdinal)));
|
|
2686
2724
|
return db.prepare(`SELECT id, data, time_created, time_updated
|
|
2687
2725
|
FROM message
|
|
2688
2726
|
WHERE session_id = ?
|
|
2689
|
-
|
|
2727
|
+
${after ? "AND time_created >= ? AND (time_created > ? OR (time_created = ? AND id > ?))" : ""}
|
|
2728
|
+
AND NOT (
|
|
2690
2729
|
CASE WHEN json_valid(data) = 1
|
|
2691
2730
|
THEN COALESCE(json_extract(data, '$.summary'), 0)
|
|
2692
2731
|
ELSE 0 END = 1
|
|
@@ -2695,7 +2734,7 @@ function readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWaterma
|
|
|
2695
2734
|
ELSE '' END = 'stop'
|
|
2696
2735
|
)
|
|
2697
2736
|
ORDER BY time_created ASC, id ASC
|
|
2698
|
-
LIMIT ? OFFSET
|
|
2737
|
+
LIMIT ? ${after ? "" : "OFFSET ?"}`).all(...parameters).filter(isRawMessageRow).map((row, index) => ({
|
|
2699
2738
|
...row,
|
|
2700
2739
|
ordinal: Math.floor(afterOrdinal) + index + 1
|
|
2701
2740
|
}));
|
|
@@ -2748,8 +2787,8 @@ var RAW_SUMMARY_PART_DATA_SQL = `CASE
|
|
|
2748
2787
|
)
|
|
2749
2788
|
)
|
|
2750
2789
|
END`;
|
|
2751
|
-
function readRawSessionMessageSummaryPageFromDb(db, sessionId, afterOrdinal, limit, finalWatermark = Number.MAX_SAFE_INTEGER) {
|
|
2752
|
-
const messageRows = readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWatermark);
|
|
2790
|
+
function readRawSessionMessageSummaryPageFromDb(db, sessionId, afterOrdinal, limit, finalWatermark = Number.MAX_SAFE_INTEGER, after) {
|
|
2791
|
+
const messageRows = readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWatermark, after);
|
|
2753
2792
|
if (messageRows.length === 0)
|
|
2754
2793
|
return [];
|
|
2755
2794
|
const placeholders = messageRows.map(() => "?").join(", ");
|
|
@@ -3450,6 +3489,21 @@ function isFilePart(part) {
|
|
|
3450
3489
|
return p.type === "file" && typeof p.url === "string";
|
|
3451
3490
|
}
|
|
3452
3491
|
|
|
3492
|
+
// ../plugin/src/shared/user-answer.ts
|
|
3493
|
+
function hasUserAnswerMetadata(value) {
|
|
3494
|
+
if (!isRecord(value))
|
|
3495
|
+
return false;
|
|
3496
|
+
if (value.userAnswer === true)
|
|
3497
|
+
return true;
|
|
3498
|
+
if (Array.isArray(value.answers))
|
|
3499
|
+
return true;
|
|
3500
|
+
if (typeof value.answer === "string")
|
|
3501
|
+
return true;
|
|
3502
|
+
if (Array.isArray(value.selectedOptions) || typeof value.customInput === "string")
|
|
3503
|
+
return true;
|
|
3504
|
+
return Array.isArray(value.results) && value.results.some(hasUserAnswerMetadata);
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3453
3507
|
// ../plugin/src/features/magic-context/dreamer/token-budget.ts
|
|
3454
3508
|
class DreamTokenBudgetExceeded extends Error {
|
|
3455
3509
|
sessionId;
|
|
@@ -3947,6 +4001,20 @@ var tokenizer_calibration_seeds_default = [
|
|
|
3947
4001
|
toolsRatio: 0.850953,
|
|
3948
4002
|
proseRatio: 1.000017
|
|
3949
4003
|
},
|
|
4004
|
+
{
|
|
4005
|
+
prefix: "openai/gpt-6-sol",
|
|
4006
|
+
systemRatio: 1.000278,
|
|
4007
|
+
toolsRatio: 0.850953,
|
|
4008
|
+
proseRatio: 1.000017,
|
|
4009
|
+
provenance: "Mirrored from openai/gpt-6-astra; prose inherited-unmeasured. Reported OAuth system/tools counts match GPT-5.5; no independent API-key measurement."
|
|
4010
|
+
},
|
|
4011
|
+
{
|
|
4012
|
+
prefix: "openai/gpt-6.1-sol",
|
|
4013
|
+
systemRatio: 1.000278,
|
|
4014
|
+
toolsRatio: 0.850953,
|
|
4015
|
+
proseRatio: 1.000017,
|
|
4016
|
+
provenance: "Mirrored from openai/gpt-6-astra; prose inherited-unmeasured. Reported OAuth system/tools counts match GPT-5.5; no independent API-key measurement."
|
|
4017
|
+
},
|
|
3950
4018
|
{
|
|
3951
4019
|
prefix: "openai/gpt-5",
|
|
3952
4020
|
systemRatio: 1,
|
|
@@ -4050,7 +4118,7 @@ var tokenizer_calibration_seeds_default = [
|
|
|
4050
4118
|
// ../plugin/src/hooks/magic-context/tokenizer-calibration.ts
|
|
4051
4119
|
var CALIBRATION_TABLE = tokenizer_calibration_seeds_default;
|
|
4052
4120
|
var NEUTRAL = { systemRatio: 1, toolsRatio: 1, proseRatio: 1 };
|
|
4053
|
-
var CALIBRATION_TABLE_REVISION = "2026-09-
|
|
4121
|
+
var CALIBRATION_TABLE_REVISION = "2026-09-30-sol-tokenizer-seeds-v3";
|
|
4054
4122
|
var UNKNOWN_FIT_RATIO = Math.max(2, ...CALIBRATION_TABLE.flatMap((entry) => [
|
|
4055
4123
|
entry.systemRatio,
|
|
4056
4124
|
entry.toolsRatio,
|
|
@@ -4387,6 +4455,8 @@ function getRawSessionMessageOrdinalCount2(sessionId) {
|
|
|
4387
4455
|
var RAW_MESSAGE_RANGE_PAGE_SIZE = 100;
|
|
4388
4456
|
function readRawSessionMessageRangeFromSource(sessionId, fromOrdinal, toOrdinal) {
|
|
4389
4457
|
const provider = sessionProviders.get(sessionId);
|
|
4458
|
+
if (provider?.iterateMessageRange)
|
|
4459
|
+
return [...provider.iterateMessageRange(fromOrdinal, toOrdinal)];
|
|
4390
4460
|
if (provider && !provider.readMessagePage) {
|
|
4391
4461
|
return provider.readMessages().filter((message) => message.ordinal >= fromOrdinal && message.ordinal <= toOrdinal);
|
|
4392
4462
|
}
|
|
@@ -4394,9 +4464,10 @@ function readRawSessionMessageRangeFromSource(sessionId, fromOrdinal, toOrdinal)
|
|
|
4394
4464
|
return [];
|
|
4395
4465
|
const messages = [];
|
|
4396
4466
|
let afterOrdinal = fromOrdinal - 1;
|
|
4467
|
+
let after;
|
|
4397
4468
|
while (afterOrdinal < toOrdinal) {
|
|
4398
4469
|
const limit = Math.min(RAW_MESSAGE_RANGE_PAGE_SIZE, toOrdinal - afterOrdinal);
|
|
4399
|
-
const page = provider?.readMessagePage ? provider.readMessagePage(afterOrdinal, limit, toOrdinal) : withReadOnlySessionDb((db) => readRawSessionMessagePageFromDb(db, sessionId, afterOrdinal, limit, toOrdinal));
|
|
4470
|
+
const page = provider?.readMessagePage ? provider.readMessagePage(afterOrdinal, limit, toOrdinal, after) : withReadOnlySessionDb((db) => readRawSessionMessagePageFromDb(db, sessionId, afterOrdinal, limit, toOrdinal, after));
|
|
4400
4471
|
if (page.length === 0)
|
|
4401
4472
|
break;
|
|
4402
4473
|
let nextOrdinal = afterOrdinal;
|
|
@@ -4409,6 +4480,8 @@ function readRawSessionMessageRangeFromSource(sessionId, fromOrdinal, toOrdinal)
|
|
|
4409
4480
|
if (nextOrdinal <= afterOrdinal)
|
|
4410
4481
|
break;
|
|
4411
4482
|
afterOrdinal = nextOrdinal;
|
|
4483
|
+
const last = page.at(-1);
|
|
4484
|
+
after = last ? { timeCreated: last.createdAt ?? 0, id: last.id } : undefined;
|
|
4412
4485
|
}
|
|
4413
4486
|
return messages;
|
|
4414
4487
|
}
|
|
@@ -4419,6 +4492,13 @@ function visitRawSessionMessages2(sessionId, fromOrdinal, toOrdinal, visit, opti
|
|
|
4419
4492
|
if (to < from)
|
|
4420
4493
|
return;
|
|
4421
4494
|
const provider = sessionProviders.get(sessionId);
|
|
4495
|
+
if (provider?.iterateMessageRange) {
|
|
4496
|
+
for (const message of provider.iterateMessageRange(from, to)) {
|
|
4497
|
+
if (!visit(message))
|
|
4498
|
+
return;
|
|
4499
|
+
}
|
|
4500
|
+
return;
|
|
4501
|
+
}
|
|
4422
4502
|
if (provider && !provider.readMessagePage) {
|
|
4423
4503
|
for (const message of provider.readMessages()) {
|
|
4424
4504
|
if (message.ordinal < from || message.ordinal > to)
|
|
@@ -4432,10 +4512,11 @@ function visitRawSessionMessages2(sessionId, fromOrdinal, toOrdinal, visit, opti
|
|
|
4432
4512
|
return;
|
|
4433
4513
|
const pageSize = Math.max(1, Math.floor(options.pageSize ?? RAW_MESSAGE_VISIT_PAGE_SIZE));
|
|
4434
4514
|
let afterOrdinal = from - 1;
|
|
4515
|
+
let after;
|
|
4435
4516
|
while (afterOrdinal < to) {
|
|
4436
4517
|
const limit = Math.min(pageSize, to - afterOrdinal);
|
|
4437
4518
|
const cursor = afterOrdinal;
|
|
4438
|
-
const page = provider?.readMessagePage ? provider.readMessagePage(cursor, limit, to) : withReadOnlySessionDb((db) => options.summary ? readRawSessionMessageSummaryPageFromDb(db, sessionId, cursor, limit, to) : readRawSessionMessagePageFromDb(db, sessionId, cursor, limit, to));
|
|
4519
|
+
const page = provider?.readMessagePage ? provider.readMessagePage(cursor, limit, to, after) : withReadOnlySessionDb((db) => options.summary ? readRawSessionMessageSummaryPageFromDb(db, sessionId, cursor, limit, to, after) : readRawSessionMessagePageFromDb(db, sessionId, cursor, limit, to, after));
|
|
4439
4520
|
if (page.length === 0)
|
|
4440
4521
|
return;
|
|
4441
4522
|
let nextOrdinal = afterOrdinal;
|
|
@@ -4449,6 +4530,8 @@ function visitRawSessionMessages2(sessionId, fromOrdinal, toOrdinal, visit, opti
|
|
|
4449
4530
|
if (nextOrdinal <= afterOrdinal)
|
|
4450
4531
|
return;
|
|
4451
4532
|
afterOrdinal = nextOrdinal;
|
|
4533
|
+
const last = page.at(-1);
|
|
4534
|
+
after = last ? { timeCreated: last.createdAt ?? 0, id: last.id } : undefined;
|
|
4452
4535
|
}
|
|
4453
4536
|
}
|
|
4454
4537
|
function readRawSessionMessageRange2(sessionId, fromOrdinal, toOrdinal) {
|
|
@@ -4989,4 +5072,4 @@ function readSessionChunk2(sessionId, tokenBudget, offset = 1, eligibleEndOrdina
|
|
|
4989
5072
|
toolResultBoundaries
|
|
4990
5073
|
};
|
|
4991
5074
|
}
|
|
4992
|
-
export { CTX_REDUCE_KEEP, newestCtxReduceTagNumbers, textMentionsRecentCommit, removeSystemReminders, hasMeaningfulUserText2, extractTexts2, extractToolCallSummaries, preloadTokenizer, estimateTokens, normalizeText, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isRecord, stableStringify, estimateImageTokensFromDataUrl, TODO_STATUSES, TODO_PRIORITIES, TITLE_DONE_STATUSES, normalizeTodoStateJson, buildSyntheticTodoPart, stripChannel1ReminderSpans, compareMeasuredTailPrefix, formatTailHygienePrefixMismatch, freezeTailHygieneMeasurement, effectiveTailHygiene, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, decideChannel1, evaluateChannel2, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, planEmergencyDrop, measureEmergencyTag, updateTagByteSize, getRecentTagOwnerMessageIds, AGE_RECLAIM_MIN_TOKENS, getOldestActiveUnprotectedToolTags, getActiveToolTagsForAgeReclaim, getTriggerTagTokenUpperBound, updateTagInputByteSize, updateTagTokenCount, getPersistedToolTagAccounting, getAllStatusTagTokenTotalsFlat, updateTagInputTokenCount, tagTokenCountIsNull, backfillTagTokenCounts, insertTag, updateTagStatus, getInertWhitespaceAssistantTags, updateTagDropMode, updateCavemanDepth, hasPiFallbackMessageTags, findAdoptableFallbackTags, hasPiFallbackToolOwnerTags, findPiFallbackToolOwnerTags, adoptPiFallbackToolOwnerTag, adoptPiFallbackMessageTag, getMaxTagNumberBySession, getTagNumberByMessageId, getAssignableTagNumberByMessageId, deriveTagLoadFloor, TAG_SELECT_COLUMNS, getTagsBySession, getActiveTagsBySession, getTagsForPendingOperations, getTagsByNumbers, getDroppedTagsByNumbers, getMaxDroppedTagNumber, getToolTagNumberByOwner, getNullOwnerToolTag, adoptNullOwnerToolTag, retreatPastHostUnservedRows, resolveOpenCodeDbPath, hasV1MessageTables, assertOpenCodeStoreGeneration, openCodeDbPathExists, getOpenCodeDbProbeDescriptions, recordOpenCodeDbReadFailure, clearOpenCodeDbReadFailure, claimOpenCodeDbDiagnosticOnce,
|
|
5075
|
+
export { registerSlowWriteReporter, detectSqliteRuntime, Database, withSqliteBackgroundWriter, withPrivilegedWriter, CTX_REDUCE_KEEP, newestCtxReduceTagNumbers, textMentionsRecentCommit, removeSystemReminders, hasMeaningfulUserText2, extractTexts2, extractToolCallSummaries, preloadTokenizer, estimateTokens, normalizeText, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isRecord, stableStringify, estimateImageTokensFromDataUrl, TODO_STATUSES, TODO_PRIORITIES, TITLE_DONE_STATUSES, normalizeTodoStateJson, buildSyntheticTodoPart, stripChannel1ReminderSpans, compareMeasuredTailPrefix, formatTailHygienePrefixMismatch, freezeTailHygieneMeasurement, effectiveTailHygiene, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, decideChannel1, evaluateChannel2, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, planEmergencyDrop, measureEmergencyTag, updateTagByteSize, getRecentTagOwnerMessageIds, AGE_RECLAIM_MIN_TOKENS, getOldestActiveUnprotectedToolTags, getActiveToolTagsForAgeReclaim, getTriggerTagTokenUpperBound, updateTagInputByteSize, updateTagTokenCount, getPersistedToolTagAccounting, getAllStatusTagTokenTotalsFlat, updateTagInputTokenCount, tagTokenCountIsNull, backfillTagTokenCounts, insertTag, updateTagStatus, getInertWhitespaceAssistantTags, updateTagDropMode, updateCavemanDepth, hasPiFallbackMessageTags, findAdoptableFallbackTags, hasPiFallbackToolOwnerTags, findPiFallbackToolOwnerTags, adoptPiFallbackToolOwnerTag, adoptPiFallbackMessageTag, getMaxTagNumberBySession, getTagNumberByMessageId, getAssignableTagNumberByMessageId, deriveTagLoadFloor, TAG_SELECT_COLUMNS, getTagsBySession, getActiveTagsBySession, getTagsForPendingOperations, getTagsByNumbers, getDroppedTagsByNumbers, getMaxDroppedTagNumber, getToolTagNumberByOwner, getNullOwnerToolTag, adoptNullOwnerToolTag, retreatPastHostUnservedRows, resolveOpenCodeDbPath, hasV1MessageTables, assertOpenCodeStoreGeneration, openCodeDbPathExists, getOpenCodeDbProbeDescriptions, recordOpenCodeDbReadFailure, clearOpenCodeDbReadFailure, claimOpenCodeDbDiagnosticOnce, closeQuietly, withReadOnlySessionDb, RAW_SUMMARY_TEXT_MAX_CHARS, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, setDatabase, loadToolDefinitionMeasurements, resolveDecisionCalibration, providerMass, localBudget, calibrationForModelKey, historyLocalBudget, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, visitRawSessionMessages2, readRawSessionMessageRange2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageIdOrdinalsForRange2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, getRawSessionMessageCount2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, readSessionChunk2 };
|