@cortexkit/pi-magic-context 0.43.1 → 0.43.2
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.
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
cleanUserText2,
|
|
42
42
|
readRawSessionMessages2,
|
|
43
43
|
readSessionChunk2
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-mea04n1j.js";
|
|
45
45
|
import {
|
|
46
46
|
logSlowWriteTransaction
|
|
47
47
|
} from "./index-17102c1m.js";
|
|
@@ -16898,7 +16898,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
16898
16898
|
{ readRawSessionMessagePage, readRawSessionMessages },
|
|
16899
16899
|
{ startMessageTimeBackfill }
|
|
16900
16900
|
] = await Promise.all([
|
|
16901
|
-
import("./read-session-chunk-
|
|
16901
|
+
import("./read-session-chunk-ky2sprnf.js"),
|
|
16902
16902
|
import("./message-time-backfill-f0v3yvza.js")
|
|
16903
16903
|
]);
|
|
16904
16904
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
@@ -2042,7 +2042,7 @@ function retreatPastHostUnservedRows(messages, exclusiveEnd, floor) {
|
|
|
2042
2042
|
// ../plugin/src/shared/opencode-db-path.ts
|
|
2043
2043
|
import { existsSync as existsSync2, readdirSync, statSync as statSync2 } from "node:fs";
|
|
2044
2044
|
import { homedir as homedir2 } from "node:os";
|
|
2045
|
-
import { isAbsolute, join as join2 } from "node:path";
|
|
2045
|
+
import { isAbsolute, join as join2, resolve as resolve2 } from "node:path";
|
|
2046
2046
|
var cachedResolution = null;
|
|
2047
2047
|
var lastReadFailure = null;
|
|
2048
2048
|
var claimedDiagnostics = new Set;
|
|
@@ -2125,7 +2125,7 @@ function resolveV2Fresh(dataDir, channel, env) {
|
|
|
2125
2125
|
const filename = sourceOpenCodeDatabaseFilename("v2", channel, env);
|
|
2126
2126
|
const explicit = env.OPENCODE_DB !== undefined;
|
|
2127
2127
|
return {
|
|
2128
|
-
path: filename === ":memory:" ? filename :
|
|
2128
|
+
path: filename === ":memory:" ? filename : resolve2(dataDir, filename),
|
|
2129
2129
|
source: explicit ? "OPENCODE_DB" : env.OPENCODE_CHANNEL ? "channel" : "default",
|
|
2130
2130
|
channel: explicit ? null : channel
|
|
2131
2131
|
};
|
|
@@ -2717,6 +2717,34 @@ function readRawSessionTailFromDb(db, sessionId, baseOrdinal, anchorMessageId) {
|
|
|
2717
2717
|
}
|
|
2718
2718
|
return { messages, absoluteMessageCount: Math.max(0, ord - 1) };
|
|
2719
2719
|
}
|
|
2720
|
+
function readRawSessionMessageOrdinalByIdFromDb(db, sessionId, messageId) {
|
|
2721
|
+
const row = db.prepare(`SELECT COUNT(candidate.id) AS ordinal
|
|
2722
|
+
FROM message AS target
|
|
2723
|
+
JOIN message AS candidate
|
|
2724
|
+
ON candidate.session_id = target.session_id
|
|
2725
|
+
AND NOT (
|
|
2726
|
+
CASE WHEN json_valid(candidate.data) = 1
|
|
2727
|
+
THEN COALESCE(json_extract(candidate.data, '$.summary'), 0)
|
|
2728
|
+
ELSE 0 END = 1
|
|
2729
|
+
AND CASE WHEN json_valid(candidate.data) = 1
|
|
2730
|
+
THEN COALESCE(json_extract(candidate.data, '$.finish'), '')
|
|
2731
|
+
ELSE '' END = 'stop'
|
|
2732
|
+
)
|
|
2733
|
+
AND (candidate.time_created < target.time_created
|
|
2734
|
+
OR (candidate.time_created = target.time_created AND candidate.id <= target.id))
|
|
2735
|
+
WHERE target.session_id = ?
|
|
2736
|
+
AND target.id = ?
|
|
2737
|
+
AND NOT (
|
|
2738
|
+
CASE WHEN json_valid(target.data) = 1
|
|
2739
|
+
THEN COALESCE(json_extract(target.data, '$.summary'), 0)
|
|
2740
|
+
ELSE 0 END = 1
|
|
2741
|
+
AND CASE WHEN json_valid(target.data) = 1
|
|
2742
|
+
THEN COALESCE(json_extract(target.data, '$.finish'), '')
|
|
2743
|
+
ELSE '' END = 'stop'
|
|
2744
|
+
)`).get(sessionId, messageId);
|
|
2745
|
+
const ordinal = row?.ordinal;
|
|
2746
|
+
return typeof ordinal === "number" && ordinal > 0 ? ordinal : null;
|
|
2747
|
+
}
|
|
2720
2748
|
function readRawSessionMessageByIdFromDb(db, sessionId, messageId) {
|
|
2721
2749
|
const row = db.prepare("SELECT id, data, time_created, time_updated FROM message WHERE session_id = ? AND id = ?").get(sessionId, messageId);
|
|
2722
2750
|
if (!row || !isRawMessageRow(row) || typeof row.time_created !== "number") {
|
|
@@ -4272,6 +4300,43 @@ function hasRawSessionMessageById2(sessionId, messageId) {
|
|
|
4272
4300
|
return provider.hasMessageById(messageId);
|
|
4273
4301
|
return readRawSessionMessageById(sessionId, messageId) !== null;
|
|
4274
4302
|
}
|
|
4303
|
+
function readRawSessionMessageOrdinalById2(sessionId, messageId) {
|
|
4304
|
+
const provider = sessionProviders.get(sessionId);
|
|
4305
|
+
if (provider?.readMessageOrdinalById) {
|
|
4306
|
+
return provider.readMessageOrdinalById(messageId);
|
|
4307
|
+
}
|
|
4308
|
+
if (provider?.readMessageIdOrdinals) {
|
|
4309
|
+
return provider.readMessageIdOrdinals().get(messageId) ?? null;
|
|
4310
|
+
}
|
|
4311
|
+
if (provider?.readMessageOrdinalPage) {
|
|
4312
|
+
let after = null;
|
|
4313
|
+
let ordinal = 0;
|
|
4314
|
+
while (true) {
|
|
4315
|
+
const page = provider.readMessageOrdinalPage(after, 500);
|
|
4316
|
+
if (page.length === 0)
|
|
4317
|
+
return null;
|
|
4318
|
+
for (const entry of page) {
|
|
4319
|
+
if (entry.contributesOrdinal)
|
|
4320
|
+
ordinal += 1;
|
|
4321
|
+
if (entry.id === messageId)
|
|
4322
|
+
return entry.contributesOrdinal ? ordinal : null;
|
|
4323
|
+
}
|
|
4324
|
+
const last = page.at(-1);
|
|
4325
|
+
if (!last || page.length < 500)
|
|
4326
|
+
return null;
|
|
4327
|
+
after = { timeCreated: last.timeCreated, id: last.id };
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
if (provider?.readMessageById) {
|
|
4331
|
+
return provider.readMessageById(messageId)?.ordinal ?? null;
|
|
4332
|
+
}
|
|
4333
|
+
if (provider) {
|
|
4334
|
+
return provider.readMessages().find((message) => message.id === messageId)?.ordinal ?? null;
|
|
4335
|
+
}
|
|
4336
|
+
if (!openCodeDbExists())
|
|
4337
|
+
return null;
|
|
4338
|
+
return withReadOnlySessionDb((db) => readRawSessionMessageOrdinalByIdFromDb(db, sessionId, messageId));
|
|
4339
|
+
}
|
|
4275
4340
|
function readRawSessionMessageById(sessionId, messageId) {
|
|
4276
4341
|
const provider = sessionProviders.get(sessionId);
|
|
4277
4342
|
if (provider?.readMessageById) {
|
|
@@ -4650,4 +4715,4 @@ function readSessionChunk2(sessionId, tokenBudget, offset = 1, eligibleEndOrdina
|
|
|
4650
4715
|
toolResultBoundaries
|
|
4651
4716
|
};
|
|
4652
4717
|
}
|
|
4653
|
-
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, registerSlowWriteReporter, detectSqliteRuntime, Database, withPrivilegedWriter, closeQuietly, withReadOnlySessionDb, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, setDatabase, loadToolDefinitionMeasurements, resolveDecisionCalibration, providerMass, localBudget, calibrationForModelKey, historyLocalBudget, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, readRawSessionMessageRange2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageIdOrdinalsForRange2, hasRawSessionMessageById2, getRawSessionMessageCount2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, readSessionChunk2 };
|
|
4718
|
+
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, registerSlowWriteReporter, detectSqliteRuntime, Database, withPrivilegedWriter, closeQuietly, withReadOnlySessionDb, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, setDatabase, loadToolDefinitionMeasurements, resolveDecisionCalibration, providerMass, localBudget, calibrationForModelKey, historyLocalBudget, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, readRawSessionMessageRange2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageIdOrdinalsForRange2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, getRawSessionMessageCount2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, readSessionChunk2 };
|
package/dist/index.js
CHANGED
|
@@ -402,7 +402,7 @@ import {
|
|
|
402
402
|
registerTodoStateLifecycle,
|
|
403
403
|
syncCtxMemoryToolEnabled,
|
|
404
404
|
registerMagicContextTools
|
|
405
|
-
} from "./index-
|
|
405
|
+
} from "./index-bkrh6jhp.js";
|
|
406
406
|
import {
|
|
407
407
|
CTX_REDUCE_KEEP,
|
|
408
408
|
newestCtxReduceTagNumbers,
|
|
@@ -512,7 +512,7 @@ import {
|
|
|
512
512
|
getRawSessionTagKeysThrough2,
|
|
513
513
|
getLegacyProtectedTailStartOrdinal2,
|
|
514
514
|
readSessionChunk2
|
|
515
|
-
} from "./index-
|
|
515
|
+
} from "./index-mea04n1j.js";
|
|
516
516
|
import {
|
|
517
517
|
pushNotification2
|
|
518
518
|
} from "./index-b3eqj1g6.js";
|
|
@@ -1824,6 +1824,8 @@ function setCtxReduceRegisteredGlobally(registered) {
|
|
|
1824
1824
|
var availabilityBySession = new BoundedSessionMap(1000);
|
|
1825
1825
|
var permissionDeniedBySession = new BoundedSessionMap(2000);
|
|
1826
1826
|
var ctxReducePermissionDenyLogged = new BoundedSessionMap(1000);
|
|
1827
|
+
var ctxReduceSpawnPermissionDenied = new BoundedSessionMap(1000);
|
|
1828
|
+
var ctxReduceSpawnPermissionReads = new Map;
|
|
1827
1829
|
|
|
1828
1830
|
// ../plugin/src/hooks/magic-context/derive-budgets.ts
|
|
1829
1831
|
var TRIGGER_BUDGET_PERCENTAGE = 0.05;
|
|
@@ -2780,6 +2782,11 @@ var USER_FACING_FAILURES = {
|
|
|
2780
2782
|
sentence: "Some finished background sessions could not be removed from this host.",
|
|
2781
2783
|
action: "They are removed automatically the next time Magic Context runs inside a registered OpenCode service."
|
|
2782
2784
|
},
|
|
2785
|
+
historian_saved_history_misaligned: {
|
|
2786
|
+
code: "MC-H03",
|
|
2787
|
+
sentence: "History compression is paused because this session's saved summaries no longer line up with its messages.",
|
|
2788
|
+
action: "Run /ctx-recomp to rebuild them."
|
|
2789
|
+
},
|
|
2783
2790
|
recomp_unavailable: {
|
|
2784
2791
|
code: "MC-R01",
|
|
2785
2792
|
sentence: "History compression could not be rebuilt.",
|
|
@@ -2950,6 +2957,11 @@ var USER_FACING_FAILURES = {
|
|
|
2950
2957
|
sentence: "History compression is paused while the engine syncs.",
|
|
2951
2958
|
action: "Retry in a moment."
|
|
2952
2959
|
},
|
|
2960
|
+
history_compression_needs_message: {
|
|
2961
|
+
code: "MC-C12",
|
|
2962
|
+
sentence: "History compression has not seen this session since Magic Context reconnected.",
|
|
2963
|
+
action: "Send a message in this session first, then run /ctx-wrapup again."
|
|
2964
|
+
},
|
|
2953
2965
|
context_service_unavailable: {
|
|
2954
2966
|
code: "MC-C10",
|
|
2955
2967
|
sentence: "Magic Context is temporarily unavailable.",
|
|
@@ -7260,8 +7272,11 @@ async function classifyOneChunk(args, chunk, anchors, sliceMs, signal) {
|
|
|
7260
7272
|
anchors
|
|
7261
7273
|
});
|
|
7262
7274
|
if (moduleRoute) {
|
|
7263
|
-
const run = await runClassifyThroughModule(args, chunk, anchors, signal);
|
|
7264
|
-
recordInvocation(args, startedAt, {
|
|
7275
|
+
const { accounting, ...run } = await runClassifyThroughModule(args, chunk, anchors, signal);
|
|
7276
|
+
recordInvocation(args, startedAt, {
|
|
7277
|
+
status: "completed",
|
|
7278
|
+
moduleAccounting: accounting
|
|
7279
|
+
});
|
|
7265
7280
|
return run;
|
|
7266
7281
|
}
|
|
7267
7282
|
const executor = resolveHiddenCompletionExecutor(args.hiddenCompletionExecutor, args.client, args.db, args.sessionDirectory, "classify-memories");
|
|
@@ -7363,7 +7378,7 @@ async function runClassifyThroughModule(args, chunk, anchors, signal) {
|
|
|
7363
7378
|
task: "classify",
|
|
7364
7379
|
command_id: `classify:${args.moduleCommandId ?? Date.now()}:${createHash5("sha256").update(chunk.map((candidate) => candidate.id).join(",")).digest("hex").slice(0, 24)}`,
|
|
7365
7380
|
authority_generation: args.moduleAuthorityGeneration,
|
|
7366
|
-
|
|
7381
|
+
model_chain: resolvedModelChain,
|
|
7367
7382
|
payload: {
|
|
7368
7383
|
prompt_body: prompt,
|
|
7369
7384
|
items: chunk.map((candidate) => ({
|
|
@@ -7384,6 +7399,7 @@ async function runClassifyThroughModule(args, chunk, anchors, signal) {
|
|
|
7384
7399
|
if (result.truncated === true) {
|
|
7385
7400
|
throw new Error("classify returned length-capped output");
|
|
7386
7401
|
}
|
|
7402
|
+
const accounting = moduleClassifyAccounting(result);
|
|
7387
7403
|
const parsed = validateClassifyManifest(manifestText, new Set(chunk.map((candidate) => candidate.id)));
|
|
7388
7404
|
const rows = parsed.map((entry) => {
|
|
7389
7405
|
const candidate = chunk.find((item) => item.id === entry.id);
|
|
@@ -7456,7 +7472,39 @@ async function runClassifyThroughModule(args, chunk, anchors, signal) {
|
|
|
7456
7472
|
throw new Error(`module accepted unknown memory ${moduleId}`);
|
|
7457
7473
|
return candidate.contextMemory.id;
|
|
7458
7474
|
});
|
|
7459
|
-
return {
|
|
7475
|
+
return {
|
|
7476
|
+
classified: acceptedContextIds.length,
|
|
7477
|
+
changed: acceptedContextIds.length,
|
|
7478
|
+
accounting
|
|
7479
|
+
};
|
|
7480
|
+
}
|
|
7481
|
+
function nonNegativeCount(value) {
|
|
7482
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : 0;
|
|
7483
|
+
}
|
|
7484
|
+
function moduleClassifyAccounting(result) {
|
|
7485
|
+
const accounting = {};
|
|
7486
|
+
const usage = result.usage;
|
|
7487
|
+
if (usage && typeof usage === "object") {
|
|
7488
|
+
const record = usage;
|
|
7489
|
+
accounting.tokens = {
|
|
7490
|
+
input: nonNegativeCount(record.input),
|
|
7491
|
+
output: nonNegativeCount(record.output),
|
|
7492
|
+
cacheRead: nonNegativeCount(record.cache_read),
|
|
7493
|
+
cacheWrite: nonNegativeCount(record.cache_write)
|
|
7494
|
+
};
|
|
7495
|
+
}
|
|
7496
|
+
const diagnostics = result.diagnostics;
|
|
7497
|
+
const model = diagnostics && typeof diagnostics === "object" ? diagnostics.model : undefined;
|
|
7498
|
+
if (typeof model === "string") {
|
|
7499
|
+
const parsed = parseProviderModel(model);
|
|
7500
|
+
if (parsed) {
|
|
7501
|
+
accounting.providerId = parsed.providerID;
|
|
7502
|
+
accounting.modelId = parsed.modelID;
|
|
7503
|
+
} else if (model.trim()) {
|
|
7504
|
+
accounting.modelId = model.trim();
|
|
7505
|
+
}
|
|
7506
|
+
}
|
|
7507
|
+
return accounting;
|
|
7460
7508
|
}
|
|
7461
7509
|
function applyClassifications(args, chunk, manifestText) {
|
|
7462
7510
|
const byId = new Map(chunk.map((m) => [m.id, m]));
|
|
@@ -7501,6 +7549,11 @@ function recordInvocation(args, startedAt, params) {
|
|
|
7501
7549
|
providerId: params.completion.providerId,
|
|
7502
7550
|
modelId: params.completion.modelId
|
|
7503
7551
|
} : {},
|
|
7552
|
+
...params.moduleAccounting ? {
|
|
7553
|
+
tokens: params.moduleAccounting.tokens,
|
|
7554
|
+
providerId: params.moduleAccounting.providerId,
|
|
7555
|
+
modelId: params.moduleAccounting.modelId
|
|
7556
|
+
} : {},
|
|
7504
7557
|
error: params.error
|
|
7505
7558
|
});
|
|
7506
7559
|
}
|
|
@@ -31937,6 +31990,9 @@ ${result}`;
|
|
|
31937
31990
|
});
|
|
31938
31991
|
}
|
|
31939
31992
|
|
|
31993
|
+
// ../plugin/src/features/magic-context/store-generation-rebase.ts
|
|
31994
|
+
var repairCheckedSessions = new WeakMap;
|
|
31995
|
+
|
|
31940
31996
|
// ../plugin/src/hooks/magic-context/historian-state-file.ts
|
|
31941
31997
|
import { mkdirSync as mkdirSync5, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "node:fs";
|
|
31942
31998
|
function cleanupHistorianStateFile(path) {
|
|
@@ -32000,6 +32056,7 @@ async function sendStatusNotification(_client, sessionId, text, params) {
|
|
|
32000
32056
|
var inconsistentProducerWindows = new Set;
|
|
32001
32057
|
var HISTORIAN_ALERT_COOLDOWN_MS2 = 60 * 1000;
|
|
32002
32058
|
var lastHistorianAlertBySession2 = new Map;
|
|
32059
|
+
var STORED_COMPARTMENT_FAILURE_BACKOFF_MS = 30 * 60 * 1000;
|
|
32003
32060
|
|
|
32004
32061
|
// ../plugin/src/hooks/magic-context/compartment-runner-recomp.ts
|
|
32005
32062
|
function insertRecompCompartmentRows(db, sessionId, compartments, now) {
|
|
@@ -34063,7 +34120,7 @@ function buildStatusView(source, options) {
|
|
|
34063
34120
|
// package.json
|
|
34064
34121
|
var package_default = {
|
|
34065
34122
|
name: "@cortexkit/pi-magic-context",
|
|
34066
|
-
version: "0.43.
|
|
34123
|
+
version: "0.43.2",
|
|
34067
34124
|
type: "module",
|
|
34068
34125
|
description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
|
|
34069
34126
|
main: "dist/index.js",
|
|
@@ -16,11 +16,12 @@ import {
|
|
|
16
16
|
primeInMemoryTailRawMessageCache2,
|
|
17
17
|
readRawSessionMessageIdOrdinalsForRange2,
|
|
18
18
|
hasRawSessionMessageById2,
|
|
19
|
+
readRawSessionMessageOrdinalById2,
|
|
19
20
|
getRawSessionMessageCount2,
|
|
20
21
|
getRawSessionTagKeysThrough2,
|
|
21
22
|
getLegacyProtectedTailStartOrdinal2,
|
|
22
23
|
readSessionChunk2
|
|
23
|
-
} from "./index-
|
|
24
|
+
} from "./index-mea04n1j.js";
|
|
24
25
|
import"./index-bfd52y8p.js";
|
|
25
26
|
export {
|
|
26
27
|
cleanUserText2 as cleanUserText,
|
|
@@ -36,6 +37,7 @@ export {
|
|
|
36
37
|
primeInMemoryTailRawMessageCache2 as primeInMemoryTailRawMessageCache,
|
|
37
38
|
primeTailRawMessageCache2 as primeTailRawMessageCache,
|
|
38
39
|
readRawSessionMessageIdOrdinalsForRange2 as readRawSessionMessageIdOrdinalsForRange,
|
|
40
|
+
readRawSessionMessageOrdinalById2 as readRawSessionMessageOrdinalById,
|
|
39
41
|
readRawSessionMessagePage2 as readRawSessionMessagePage,
|
|
40
42
|
readRawSessionMessageRange2 as readRawSessionMessageRange,
|
|
41
43
|
readRawSessionMessages2 as readRawSessionMessages,
|
package/dist/subagent-entry.js
CHANGED
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
ensureProjectRegisteredFromPiDirectory,
|
|
11
11
|
resolvePiHarnessKind,
|
|
12
12
|
registerMagicContextTools
|
|
13
|
-
} from "./index-
|
|
14
|
-
import"./index-
|
|
13
|
+
} from "./index-bkrh6jhp.js";
|
|
14
|
+
import"./index-mea04n1j.js";
|
|
15
15
|
import"./index-17102c1m.js";
|
|
16
16
|
|
|
17
17
|
// src/subagent-entry.ts
|
package/package.json
CHANGED