@cortexkit/pi-magic-context 0.49.50 → 0.49.52
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-ywvhr524.js → index-0hewsw7v.js} +1 -1
- package/dist/{index-jexm22qn.js → index-73c292h9.js} +3 -3
- package/dist/{index-jy9fq8gp.js → index-akmmkmhf.js} +2 -2
- package/dist/{index-38bm78h4.js → index-cc73przv.js} +7 -7
- package/dist/{index-4j5442b0.js → index-fec4ezww.js} +1 -1
- package/dist/{index-ch3rvpjg.js → index-ktez4jwz.js} +1 -1
- package/dist/{index-4ss8c8ky.js → index-mb34ngfr.js} +30 -7
- package/dist/{index-06rdy9h6.js → index-rjz01pvv.js} +1 -1
- package/dist/index.js +3789 -2024
- package/dist/{message-index-bounded-wg71m86d.js → message-index-bounded-d50b5f2z.js} +2 -2
- package/dist/migration-worker.js +1 -1
- package/dist/raw-ordinal-warmup-worker.js +3 -3
- package/dist/{read-session-chunk-dmpabgvh.js → read-session-chunk-9yr9mava.js} +1 -1
- package/dist/{render-71rpjt3g.js → render-3s7kbr61.js} +4 -4
- package/dist/{search-m61nenns.js → search-2vgt4717.js} +3 -3
- package/dist/{search-archive-w12r0c45.js → search-archive-dd1z7xn0.js} +3 -3
- package/dist/subagent-entry.js +8 -8
- package/dist/tag-snapshot-worker-pi.js +1 -1
- package/dist/{v2-archive-reader-5n1w78zj.js → v2-archive-reader-6jbyaafn.js} +1 -1
- package/package.json +3 -1
|
@@ -31,7 +31,7 @@ serveWorkerJobs(async (initial, port) => {
|
|
|
31
31
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
32
32
|
import("./storage-memory-0ndn65fm.js"),
|
|
33
33
|
import("./project-embedding-registry-hpca84nz.js"),
|
|
34
|
-
import("./search-
|
|
34
|
+
import("./search-2vgt4717.js"),
|
|
35
35
|
import("./compartment-chunk-embedding-wg7emg3z.js"),
|
|
36
36
|
import("./embedding-activity-ew6dshfd.js"),
|
|
37
37
|
import("./harness-9872e0ym.js"),
|
|
@@ -139,9 +139,9 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
139
139
|
import("./sqlite-v89bj0yy.js"),
|
|
140
140
|
import("./store-reader-mmfw2h48.js"),
|
|
141
141
|
import("./store-0hhs1db3.js"),
|
|
142
|
-
import("./read-session-chunk-
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
142
|
+
import("./read-session-chunk-9yr9mava.js"),
|
|
143
|
+
import("./render-3s7kbr61.js"),
|
|
144
|
+
import("./search-archive-dd1z7xn0.js"),
|
|
145
145
|
import("./expand-attachments-8sxeyj26.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
expandToolPart,
|
|
40
40
|
visitRawSessionMessages2,
|
|
41
41
|
readRawSessionMessageById2
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-fec4ezww.js";
|
|
43
43
|
import {
|
|
44
44
|
isRecord,
|
|
45
45
|
providerVisibleMessage,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
import {
|
|
65
65
|
isPidAlive,
|
|
66
66
|
readProcessStartTime
|
|
67
|
-
} from "./index-
|
|
67
|
+
} from "./index-rjz01pvv.js";
|
|
68
68
|
import {
|
|
69
69
|
gaDatabasePath2,
|
|
70
70
|
V2StoreReader2
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
import {
|
|
57
57
|
piHarnessKindFromExecutable,
|
|
58
58
|
getErrorMessage
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-rjz01pvv.js";
|
|
60
60
|
import {
|
|
61
61
|
getOrCreateSessionMeta,
|
|
62
62
|
updateSessionMeta,
|
|
@@ -70,10 +70,10 @@ import {
|
|
|
70
70
|
renderMessageByOrdinal2,
|
|
71
71
|
renderVerboseRange2,
|
|
72
72
|
renderItemByTag2
|
|
73
|
-
} from "./index-
|
|
73
|
+
} from "./index-akmmkmhf.js";
|
|
74
74
|
import {
|
|
75
75
|
getLastIndexedOrdinal
|
|
76
|
-
} from "./index-
|
|
76
|
+
} from "./index-0hewsw7v.js";
|
|
77
77
|
import {
|
|
78
78
|
setNoteLastReadAt,
|
|
79
79
|
getPersistedCompactionMarkerState,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
hasRawMessageProvider2,
|
|
84
84
|
setRawMessageProvider2,
|
|
85
85
|
readSessionChunk2
|
|
86
|
-
} from "./index-
|
|
86
|
+
} from "./index-fec4ezww.js";
|
|
87
87
|
import {
|
|
88
88
|
stableStringify
|
|
89
89
|
} from "./index-jxm4bvm4.js";
|
|
@@ -134,7 +134,7 @@ import {
|
|
|
134
134
|
resolveMemoriesByIdsForSearch2,
|
|
135
135
|
unifiedSearch2,
|
|
136
136
|
formatSearchResults2
|
|
137
|
-
} from "./index-
|
|
137
|
+
} from "./index-mb34ngfr.js";
|
|
138
138
|
import {
|
|
139
139
|
TODO_STATUSES,
|
|
140
140
|
TODO_PRIORITIES,
|
|
@@ -184,7 +184,7 @@ import {
|
|
|
184
184
|
} from "./index-xssjy4z9.js";
|
|
185
185
|
import {
|
|
186
186
|
renderSearchArchive2
|
|
187
|
-
} from "./index-
|
|
187
|
+
} from "./index-ktez4jwz.js";
|
|
188
188
|
import {
|
|
189
189
|
computeNormalizedHash
|
|
190
190
|
} from "./index-9x1f96r8.js";
|
|
@@ -3629,7 +3629,7 @@ function updateUserMemoryContent(db, id, content) {
|
|
|
3629
3629
|
db.prepare("UPDATE user_memories SET content = ?, updated_at = ? WHERE id = ?").run(content, Date.now(), id);
|
|
3630
3630
|
}
|
|
3631
3631
|
function dismissUserMemory(db, id) {
|
|
3632
|
-
db.prepare("UPDATE user_memories SET status = 'dismissed', updated_at = ? WHERE id = ?").run(Date.now(), id);
|
|
3632
|
+
db.prepare("UPDATE user_memories SET status = 'dismissed', updated_at = ? WHERE id = ? AND status = 'active'").run(Date.now(), id);
|
|
3633
3633
|
}
|
|
3634
3634
|
function parseCandidateIds(raw) {
|
|
3635
3635
|
try {
|
|
@@ -2242,7 +2242,7 @@ function normalizeDetectedLimitModelKey(modelKey) {
|
|
|
2242
2242
|
return typeof modelKey === "string" && modelKey.length > 0 ? piModelRefToCanonical(modelKey) : null;
|
|
2243
2243
|
}
|
|
2244
2244
|
function normalizeEmergencyRecoveryOrigin(value) {
|
|
2245
|
-
return value === "provider_overflow" || value === "proactive_model_shrink" ? value : null;
|
|
2245
|
+
return value === "provider_overflow" || value === "proactive_model_shrink" || value === "history_boundary_over_window" ? value : null;
|
|
2246
2246
|
}
|
|
2247
2247
|
function parseOverflowState(result, modelKey) {
|
|
2248
2248
|
if (!result) {
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
clearIndexedMessages,
|
|
92
92
|
indexSingleMessage,
|
|
93
93
|
indexMessagesAfterOrdinal
|
|
94
|
-
} from "./index-
|
|
94
|
+
} from "./index-0hewsw7v.js";
|
|
95
95
|
import {
|
|
96
96
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
97
97
|
withMessageFtsSessionFilter
|
|
@@ -128,8 +128,13 @@ var USER_FACING_FAILURES = {
|
|
|
128
128
|
},
|
|
129
129
|
history_boundary_unresolved: {
|
|
130
130
|
code: "MC-H04",
|
|
131
|
-
sentence: "This request was not sent:
|
|
132
|
-
action: "
|
|
131
|
+
sentence: "This request was not sent: it is larger than the model's context window, and Magic Context could not cut the already-summarized history out of it.",
|
|
132
|
+
action: "Run /ctx-flush to compress the history now, then send your message again."
|
|
133
|
+
},
|
|
134
|
+
history_boundary_recovering: {
|
|
135
|
+
code: "MC-H08",
|
|
136
|
+
sentence: "This request was not sent: it is larger than the model's context window, and Magic Context could not cut the already-summarized history out of it.",
|
|
137
|
+
action: "Send your message again: Magic Context will first summarize more of the history and drop old tool output to make it fit."
|
|
133
138
|
},
|
|
134
139
|
history_over_window_unmanaged: {
|
|
135
140
|
code: "MC-H06",
|
|
@@ -1891,6 +1896,8 @@ function getDefaultSubcConnectionFile() {
|
|
|
1891
1896
|
var RERANK_MODEL = "gte-reranker-modernbert-base-f32";
|
|
1892
1897
|
var RERANK_LANE_LIMIT = 25;
|
|
1893
1898
|
var DEADLINE_MS = 1500;
|
|
1899
|
+
var SYNAPSE_RESTART_BACKOFF_MS = 30000;
|
|
1900
|
+
var SYNAPSE_ABSENT_BACKOFF_MS = 10 * 60000;
|
|
1894
1901
|
var DOCUMENT_BYTES = 1024;
|
|
1895
1902
|
var proseWordSegmenter = new Intl.Segmenter(undefined, { granularity: "word" });
|
|
1896
1903
|
function isProseQuery(query) {
|
|
@@ -2033,10 +2040,11 @@ async function bounded(promise) {
|
|
|
2033
2040
|
}
|
|
2034
2041
|
}
|
|
2035
2042
|
var connections = new Map;
|
|
2043
|
+
var synapseRetryAt = new Map;
|
|
2036
2044
|
async function connect(connectionFile) {
|
|
2037
2045
|
let connection = connections.get(connectionFile);
|
|
2038
2046
|
if (!connection) {
|
|
2039
|
-
connection = inRootAsyncContext2(() => SubcClient.connect({ connectionFile }));
|
|
2047
|
+
connection = inRootAsyncContext2(() => SubcClient.connect({ connectionFile, routeOpenRetryDeadlineMs: 0 }));
|
|
2040
2048
|
connections.set(connectionFile, connection);
|
|
2041
2049
|
connection.catch(() => connections.delete(connectionFile));
|
|
2042
2050
|
}
|
|
@@ -2106,24 +2114,39 @@ function remoteRerankSkipped(reason, onSkipped) {
|
|
|
2106
2114
|
logRerankFallback(safe);
|
|
2107
2115
|
onSkipped?.(line);
|
|
2108
2116
|
}
|
|
2109
|
-
async function prepareReranker(projectRoot, sessionId, connectionFile, injectedClient, config) {
|
|
2117
|
+
async function prepareReranker(projectRoot, sessionId, connectionFile, injectedClient, config, now = Date.now) {
|
|
2110
2118
|
if (config?.provider === "off")
|
|
2111
2119
|
return null;
|
|
2112
2120
|
if (config?.provider === "remote")
|
|
2113
2121
|
return { remote: config };
|
|
2122
|
+
const daemonFile = connectionFile ?? getDefaultSubcConnectionFile();
|
|
2123
|
+
const rememberAbsence = injectedClient === undefined;
|
|
2124
|
+
if (rememberAbsence && (synapseRetryAt.get(daemonFile) ?? 0) > now())
|
|
2125
|
+
return null;
|
|
2126
|
+
let catalogRequested = false;
|
|
2114
2127
|
try {
|
|
2115
2128
|
if (injectedClient === null)
|
|
2116
2129
|
throw new RerankFailure("missing_synapse");
|
|
2117
|
-
const client = injectedClient ?? await connect(
|
|
2130
|
+
const client = injectedClient ?? await connect(daemonFile);
|
|
2118
2131
|
const identity = {
|
|
2119
2132
|
project_root: projectRoot,
|
|
2120
2133
|
harness: "magic-context",
|
|
2121
2134
|
session: sessionId
|
|
2122
2135
|
};
|
|
2136
|
+
catalogRequested = true;
|
|
2123
2137
|
const lane = pinReranker(await bounded(client.call("synapse", "models.list", {}, { timeoutMs: DEADLINE_MS, targetKind: "management_surface", identity })));
|
|
2138
|
+
if (rememberAbsence)
|
|
2139
|
+
synapseRetryAt.delete(daemonFile);
|
|
2124
2140
|
return { client, lane, identity };
|
|
2125
2141
|
} catch (error) {
|
|
2126
|
-
|
|
2142
|
+
const reason = reasonOf(error);
|
|
2143
|
+
if (rememberAbsence && catalogRequested && reason === "unknown_module") {
|
|
2144
|
+
const failedAt = now();
|
|
2145
|
+
const previousRetryAt = synapseRetryAt.get(daemonFile);
|
|
2146
|
+
const backoff = previousRetryAt !== undefined && failedAt - previousRetryAt < SYNAPSE_ABSENT_BACKOFF_MS ? SYNAPSE_ABSENT_BACKOFF_MS : SYNAPSE_RESTART_BACKOFF_MS;
|
|
2147
|
+
synapseRetryAt.set(daemonFile, failedAt + backoff);
|
|
2148
|
+
}
|
|
2149
|
+
logRerankFallback(reason);
|
|
2127
2150
|
return null;
|
|
2128
2151
|
}
|
|
2129
2152
|
}
|
|
@@ -1789,7 +1789,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1789
1789
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
1790
1790
|
if (signal.aborted || !readsOpenCodeStore)
|
|
1791
1791
|
return;
|
|
1792
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1792
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-9yr9mava.js"));
|
|
1793
1793
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-krre2qnb.js"));
|
|
1794
1794
|
if (signal.aborted)
|
|
1795
1795
|
return;
|