@cortexkit/pi-magic-context 0.49.77 → 0.49.78
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-0x61mf6t.js → index-077gbj21.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{search-archive-33p4gebn.js → search-archive-hrp4sa2w.js} +1 -1
- package/dist/{store-grcwn6hs.js → store-e9ve3qzt.js} +79 -13
- package/dist/subagent-entry.js +1 -1
- package/dist/{v2-archive-reader-5cydt27v.js → v2-archive-reader-w897mvf5.js} +1 -1
- package/package.json +1 -1
|
@@ -138,10 +138,10 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
138
138
|
] = await Promise.all([
|
|
139
139
|
import("./sqlite-v89bj0yy.js"),
|
|
140
140
|
import("./store-reader-mmfw2h48.js"),
|
|
141
|
-
import("./store-
|
|
141
|
+
import("./store-e9ve3qzt.js"),
|
|
142
142
|
import("./read-session-chunk-ygwyfvtr.js"),
|
|
143
143
|
import("./render-gbeyky54.js"),
|
|
144
|
-
import("./search-archive-
|
|
144
|
+
import("./search-archive-hrp4sa2w.js"),
|
|
145
145
|
import("./expand-attachments-8sxeyj26.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
package/dist/index.js
CHANGED
|
@@ -865,7 +865,7 @@ import {
|
|
|
865
865
|
} from "./index-wmkkxwvf.js";
|
|
866
866
|
import"./index-71rg8j43.js";
|
|
867
867
|
import"./index-8d2z6503.js";
|
|
868
|
-
import"./index-
|
|
868
|
+
import"./index-077gbj21.js";
|
|
869
869
|
import"./index-cyzsn2hb.js";
|
|
870
870
|
import {
|
|
871
871
|
__toESM
|
|
@@ -3618,7 +3618,7 @@ function startHostStallProfilerSwitch() {
|
|
|
3618
3618
|
// package.json
|
|
3619
3619
|
var package_default = {
|
|
3620
3620
|
name: "@cortexkit/pi-magic-context",
|
|
3621
|
-
version: "0.49.
|
|
3621
|
+
version: "0.49.78",
|
|
3622
3622
|
type: "module",
|
|
3623
3623
|
description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
|
|
3624
3624
|
main: "dist/index.js",
|
|
@@ -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-w897mvf5.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-hrp4sa2w.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-0tytrjye.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -18,7 +18,80 @@ function isStorageNoticeText(text) {
|
|
|
18
18
|
return typeof text === "string" && text.startsWith(STORAGE_NOTICE_PREFIX);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// ../plugin/src/v2/fold/host-media.ts
|
|
22
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
|
+
function isClassInstance(value) {
|
|
24
|
+
if (!isRecord(value))
|
|
25
|
+
return false;
|
|
26
|
+
const prototype = Object.getPrototypeOf(value);
|
|
27
|
+
return prototype !== Object.prototype && prototype !== null;
|
|
28
|
+
}
|
|
29
|
+
var rememberedAssetClass;
|
|
30
|
+
var rememberedAssetSchema;
|
|
31
|
+
var assetSchemaByClass = new WeakMap;
|
|
32
|
+
function decodeThroughHostSchema(encoded) {
|
|
33
|
+
const source = encoded.source;
|
|
34
|
+
const assetSchema = rememberedAssetSchema;
|
|
35
|
+
if (!assetSchema)
|
|
36
|
+
return "no host message schema with a media member seen";
|
|
37
|
+
const encoding = assetSchema.ast?.encoding;
|
|
38
|
+
const decode = Array.isArray(encoding) ? encoding[0]?.transformation?.decode : undefined;
|
|
39
|
+
const getter = decode;
|
|
40
|
+
let asset;
|
|
41
|
+
if (getter?._tag === "Transform") {
|
|
42
|
+
if (typeof getter.transform !== "function")
|
|
43
|
+
return "host media schema has no decode transformation";
|
|
44
|
+
asset = getter.transform(encoded);
|
|
45
|
+
} else {
|
|
46
|
+
if (getter?._tag !== undefined)
|
|
47
|
+
return `host media schema has unsupported decode transformation: ${String(getter._tag)}`;
|
|
48
|
+
const run = getter?.run;
|
|
49
|
+
if (typeof run !== "function")
|
|
50
|
+
return "host media schema has no decode transformation";
|
|
51
|
+
const result = run.call(decode, { _tag: "Some", value: encoded }, {});
|
|
52
|
+
const option = result?._tag === "Success" ? result.value : undefined;
|
|
53
|
+
asset = option?._tag === "Some" ? option.value : undefined;
|
|
54
|
+
}
|
|
55
|
+
if (!isClassInstance(asset) || asset.source !== source)
|
|
56
|
+
return "host media schema decode did not return an asset";
|
|
57
|
+
return asset;
|
|
58
|
+
}
|
|
59
|
+
function hostMediaAsset(data, mediaType) {
|
|
60
|
+
return hostMediaFromEncoded({ source: { type: "base64", data, mediaType } });
|
|
61
|
+
}
|
|
62
|
+
function hostMediaFromEncoded(value) {
|
|
63
|
+
if (!isRecord(value.source))
|
|
64
|
+
return "missing Media.Asset source";
|
|
65
|
+
const encoded = structuredClone(value);
|
|
66
|
+
if (encoded.source.type === "bytes") {
|
|
67
|
+
if (typeof encoded.source.data !== "string")
|
|
68
|
+
return "bytes media has no JSON codec payload";
|
|
69
|
+
encoded.source.data = new Uint8Array(Buffer.from(encoded.source.data, "base64"));
|
|
70
|
+
}
|
|
71
|
+
if (!["bytes", "base64", "url", "ref"].includes(String(encoded.source.type)))
|
|
72
|
+
return "unknown Media.Asset source";
|
|
73
|
+
let first = "no Media.Asset seen in this process";
|
|
74
|
+
if (rememberedAssetClass) {
|
|
75
|
+
try {
|
|
76
|
+
return new rememberedAssetClass(encoded);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
first = `remembered asset class threw: ${String(error)}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
let second;
|
|
82
|
+
try {
|
|
83
|
+
const decoded = decodeThroughHostSchema(encoded);
|
|
84
|
+
if (typeof decoded !== "string")
|
|
85
|
+
return decoded;
|
|
86
|
+
second = decoded;
|
|
87
|
+
} catch (error) {
|
|
88
|
+
second = `host media schema decode threw: ${String(error)}`;
|
|
89
|
+
}
|
|
90
|
+
return `${first}; ${second}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
21
93
|
// ../plugin/src/v2/fold/restore.ts
|
|
94
|
+
var HOST_RESTORE_MEDIA = { asset: hostMediaAsset, unavailable: () => {} };
|
|
22
95
|
function unavailableAttachmentNote(name, mediaType) {
|
|
23
96
|
return `[Attachment ${name ? `"${name}" ` : ""}(${mediaType}) is not available in this restored history]`;
|
|
24
97
|
}
|
|
@@ -69,17 +142,6 @@ ${[
|
|
|
69
142
|
return [];
|
|
70
143
|
const metadata = file.description === undefined ? undefined : { description: file.description };
|
|
71
144
|
const located = location ? [{ type: "text", text: `Attached file: ${location}` }] : [];
|
|
72
|
-
if (!media)
|
|
73
|
-
return [
|
|
74
|
-
...located,
|
|
75
|
-
{
|
|
76
|
-
type: "media",
|
|
77
|
-
mediaType: file.mime,
|
|
78
|
-
data: file.data,
|
|
79
|
-
filename: file.name,
|
|
80
|
-
metadata
|
|
81
|
-
}
|
|
82
|
-
];
|
|
83
145
|
const asset = media.asset(file.data, file.mime);
|
|
84
146
|
if (typeof asset === "string") {
|
|
85
147
|
media.unavailable({ rowID, name: file.name, mediaType: file.mime, reason: asset });
|
|
@@ -91,7 +153,7 @@ ${[
|
|
|
91
153
|
return [...located, { type: "media", media: asset, filename: file.name, metadata }];
|
|
92
154
|
});
|
|
93
155
|
}
|
|
94
|
-
function restoreRow(row, model, media) {
|
|
156
|
+
function restoreRow(row, model, media = HOST_RESTORE_MEDIA) {
|
|
95
157
|
const data = row.data;
|
|
96
158
|
const make = (role, content, metadata = data.metadata) => ({
|
|
97
159
|
id: row.id,
|
|
@@ -251,8 +313,12 @@ function toolStateContent(state) {
|
|
|
251
313
|
var rawMessageTypes = new Set(RAW_MESSAGE_TYPES2);
|
|
252
314
|
var isRawRow = (row) => rawMessageTypes.has(row.type);
|
|
253
315
|
var NO_MODEL = { providerID: "", id: "" };
|
|
316
|
+
var NO_MEDIA = {
|
|
317
|
+
asset: () => "rendered only to read message ids",
|
|
318
|
+
unavailable: () => {}
|
|
319
|
+
};
|
|
254
320
|
function hostServesRowById(row) {
|
|
255
|
-
return isRawRow(row) && restoreRow(row, NO_MODEL).some((message) => message.id === row.id);
|
|
321
|
+
return isRawRow(row) && restoreRow(row, NO_MODEL, NO_MEDIA).some((message) => message.id === row.id);
|
|
256
322
|
}
|
|
257
323
|
function projectRawMessages(rows, ordinalFor) {
|
|
258
324
|
return rows.filter(isRawRow).map((row, index) => {
|
package/dist/subagent-entry.js
CHANGED
|
@@ -52,7 +52,7 @@ import"./index-6x556c2q.js";
|
|
|
52
52
|
import"./index-nvh6d3bz.js";
|
|
53
53
|
import"./index-k7a8x7ba.js";
|
|
54
54
|
import"./index-8d2z6503.js";
|
|
55
|
-
import"./index-
|
|
55
|
+
import"./index-077gbj21.js";
|
|
56
56
|
import"./index-cyzsn2hb.js";
|
|
57
57
|
import"./index-gczr1m66.js";
|
|
58
58
|
import"./index-29nw7n1r.js";
|
package/package.json
CHANGED