@cortexkit/pi-magic-context 0.49.27 → 0.49.28
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.js +27 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3549,7 +3549,7 @@ function startHostStallProfilerSwitch() {
|
|
|
3549
3549
|
// package.json
|
|
3550
3550
|
var package_default = {
|
|
3551
3551
|
name: "@cortexkit/pi-magic-context",
|
|
3552
|
-
version: "0.49.
|
|
3552
|
+
version: "0.49.28",
|
|
3553
3553
|
type: "module",
|
|
3554
3554
|
description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
|
|
3555
3555
|
main: "dist/index.js",
|
|
@@ -14927,8 +14927,8 @@ async function mapMemories(args) {
|
|
|
14927
14927
|
result.failureStage = outcome.failure.stage;
|
|
14928
14928
|
}
|
|
14929
14929
|
const committed = outcome.mapped + outcome.independent;
|
|
14930
|
+
const committedIds = new Set(outcome.committedIds);
|
|
14930
14931
|
runLeaseGuardedWrite(args.db, args.holderId, args.leaseKey, () => {
|
|
14931
|
-
const committedIds = new Set(outcome.committedIds);
|
|
14932
14932
|
for (const memory of batch.inputs) {
|
|
14933
14933
|
if (committedIds.has(memory.id)) {
|
|
14934
14934
|
delete retries[memory.id];
|
|
@@ -14963,7 +14963,22 @@ async function mapMemories(args) {
|
|
|
14963
14963
|
log2(`[dreamer] map-memories: targeted retry still omitted ${outcome.requeue.length} id(s); leaving them unmapped for the next run`);
|
|
14964
14964
|
}
|
|
14965
14965
|
}
|
|
14966
|
-
if (outcome.failure?.class === "timeout" &&
|
|
14966
|
+
if (outcome.failure?.class === "timeout" && batch.inputs.length > 1) {
|
|
14967
|
+
const unmapped = batch.inputs.filter((memory) => !committedIds.has(memory.id));
|
|
14968
|
+
const splitSize = Math.floor(batch.inputs.length / 2);
|
|
14969
|
+
const splits = [];
|
|
14970
|
+
for (let offset = 0;offset < unmapped.length; offset += splitSize) {
|
|
14971
|
+
splits.push({
|
|
14972
|
+
inputs: unmapped.slice(offset, offset + splitSize),
|
|
14973
|
+
isOmissionRetry: batch.isOmissionRetry
|
|
14974
|
+
});
|
|
14975
|
+
}
|
|
14976
|
+
if (splits.length > 0) {
|
|
14977
|
+
batches.splice(i + 1, 0, ...splits);
|
|
14978
|
+
log2(`[dreamer] map-memories: splitting batch [${batch.inputs.map((memory) => memory.id).join(",")}] into ${splits.map((split) => split.inputs.length).join("+")} after timeout; retrying ${unmapped.length} uncommitted mapping(s)`);
|
|
14979
|
+
}
|
|
14980
|
+
}
|
|
14981
|
+
if (outcome.failure?.class === "timeout" && batch.inputs.length === 1 && committed === 0) {
|
|
14967
14982
|
consecutiveTimeouts += 1;
|
|
14968
14983
|
timeoutStreakElapsedMs.push(outcome.failure.elapsedMs);
|
|
14969
14984
|
if (consecutiveTimeouts >= CONSECUTIVE_TIMEOUT_LIMIT2) {
|
|
@@ -14971,7 +14986,7 @@ async function mapMemories(args) {
|
|
|
14971
14986
|
log2(`[dreamer] map-memories starvation: circuit breaker tripped after ${consecutiveTimeouts} consecutive batch timeouts with no committed mappings (investigation made no durable progress); per-batch elapsed [${timeoutStreakElapsedMs.join("ms, ")}ms] vs ${sliceMs}ms slice; stopping with ${result.remaining} mapping(s) remaining`);
|
|
14972
14987
|
break;
|
|
14973
14988
|
}
|
|
14974
|
-
} else {
|
|
14989
|
+
} else if (committed > 0 || outcome.failure?.class !== "timeout") {
|
|
14975
14990
|
consecutiveTimeouts = 0;
|
|
14976
14991
|
timeoutStreakElapsedMs = [];
|
|
14977
14992
|
}
|
|
@@ -22630,6 +22645,8 @@ async function awaitInFlightDreamers(registrationOwner) {
|
|
|
22630
22645
|
return;
|
|
22631
22646
|
await Promise.allSettled(runs);
|
|
22632
22647
|
}
|
|
22648
|
+
var RUNNER_TIMEOUT_HEADROOM_MINUTES = 5;
|
|
22649
|
+
var UNKNOWN_TASK_TIMEOUT_MINUTES = 30;
|
|
22633
22650
|
function createPiDreamerClient(opts, onAdjunctsRefreshNeeded = opts.onAdjunctsRefreshNeeded, isRegistrationOwnerActive = () => true, getMaxOutputTokens = () => opts.config.maxTokens, getDreamerConfig = () => opts.config) {
|
|
22634
22651
|
const runner = piSubagentRunnerFactory();
|
|
22635
22652
|
const budgetStates = new Map;
|
|
@@ -22683,7 +22700,7 @@ function createPiDreamerClient(opts, onAdjunctsRefreshNeeded = opts.onAdjunctsRe
|
|
|
22683
22700
|
userMessage,
|
|
22684
22701
|
model: perTaskModel,
|
|
22685
22702
|
fallbackModels: undefined,
|
|
22686
|
-
timeoutMs:
|
|
22703
|
+
timeoutMs: ((taskConfig?.timeoutMinutes ?? UNKNOWN_TASK_TIMEOUT_MINUTES) + RUNNER_TIMEOUT_HEADROOM_MINUTES) * 60 * 1000,
|
|
22687
22704
|
cwd: dreamSession.directory,
|
|
22688
22705
|
signal: args.signal ? AbortSignal.any([args.signal, controller.signal]) : controller.signal,
|
|
22689
22706
|
thinkingLevel: extractBodyVariant(args),
|
|
@@ -22792,7 +22809,11 @@ function accountingTaskFromTitle(title) {
|
|
|
22792
22809
|
const task = title.slice("magic-context-dream-".length);
|
|
22793
22810
|
if (!title.startsWith("magic-context-dream-") || task.length === 0)
|
|
22794
22811
|
return null;
|
|
22795
|
-
|
|
22812
|
+
if (task === "classify")
|
|
22813
|
+
return "classify-memories";
|
|
22814
|
+
if (task === "user-memories")
|
|
22815
|
+
return "review-user-memories";
|
|
22816
|
+
return task;
|
|
22796
22817
|
}
|
|
22797
22818
|
function readSessionTitle(args) {
|
|
22798
22819
|
const body = args.body;
|
package/package.json
CHANGED