@cortexkit/opencode-magic-context 0.49.77 → 0.49.79
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/{context-8zhjv9tj.js → context-gb3gjahp.js} +63 -143
- package/dist/features/magic-context/dreamer/curate-category-rotation.d.ts +1 -1
- package/dist/features/magic-context/dreamer/curate-category-rotation.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/curate-memory-safety.d.ts +5 -1
- package/dist/features/magic-context/dreamer/curate-memory-safety.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts +2 -0
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/hooks/magic-context/image-token-estimate.d.ts.map +1 -1
- package/dist/{index-5jtq51xv.js → index-2dadxknq.js} +110 -59
- package/dist/{index-8mt6vvwx.js → index-2q0t43fy.js} +1 -1
- package/dist/{index-1pfjvk89.js → index-8ykmp4jv.js} +6 -6
- package/dist/{index-kn23xzst.js → index-aawwdt26.js} +1 -1
- package/dist/{index-ng6gfs0y.js → index-enpatj5k.js} +120 -14
- package/dist/{index-xkn7vq89.js → index-f619wjj9.js} +3 -3
- package/dist/{index-swfwxev1.js → index-hgdkwp21.js} +2 -2
- package/dist/{index-72qk8fs8.js → index-m0tbtzqh.js} +3 -3
- package/dist/{index-r865s8hf.js → index-m6rkq3t4.js} +1 -1
- package/dist/{index-dcdk1thy.js → index-sy5wbbw6.js} +5 -5
- package/dist/{index-7jj5jk78.js → index-tvkzkk4s.js} +5 -5
- package/dist/{index-k6b1av2m.js → index-twmeey4h.js} +2 -2
- package/dist/{index-bw3pmrtk.js → index-v8x07j6c.js} +4 -4
- package/dist/{index-rjm4hjyb.js → index-xsdaz3mq.js} +1 -1
- package/dist/{index-bdnak4d0.js → index-y208s7zx.js} +5 -3
- package/dist/{index-vr6t0y4w.js → index-zzvd4a9z.js} +1 -1
- package/dist/index.js +18 -18
- package/dist/{message-index-bounded-s0bckzqz.js → message-index-bounded-cfkeyf72.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-kqyb1y8c.js → read-session-chunk-s3qac56g.js} +2 -2
- package/dist/{recomp-orchestrator-38ed4yhj.js → recomp-orchestrator-jf60eef6.js} +7 -7
- package/dist/{render-8s531gd5.js → render-bjxgkrk6.js} +6 -6
- package/dist/{search-archive-4vcfm0wv.js → search-archive-a60k0x2n.js} +4 -4
- package/dist/{search-m4r4v4aw.js → search-mpde08f1.js} +5 -5
- package/dist/shared/subagent-runner.d.ts +9 -0
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/{storage-tags-d3nqrva7.js → storage-tags-6e83pvff.js} +1 -1
- package/dist/{store-h2a1g3wh.js → store-j5rvve3v.js} +1 -1
- package/dist/{transform-postprocess-phase-ch5fsw7h.js → transform-postprocess-phase-m1be339w.js} +8 -8
- package/dist/v2/auto-search-worker.js +1 -1
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-9nm9edea.js → context-fzp6ynz4.js} +156 -185
- package/dist/v2/fold/host-media.d.ts +16 -11
- package/dist/v2/fold/host-media.d.ts.map +1 -1
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/restore.d.ts +7 -5
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts +8 -0
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-vfx2zx9y.js → message-index-bounded-0xy4dn04.js} +3 -3
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-bh402br0.js → read-session-chunk-6mt2t6dy.js} +2 -2
- package/dist/v2/{recomp-orchestrator-43grkr1k.js → recomp-orchestrator-4r63zen2.js} +6 -6
- package/dist/v2/{render-90pve6jf.js → render-7tr9d67f.js} +6 -6
- package/dist/v2/{search-archive-9sx7fn3t.js → search-archive-2ck9sbsc.js} +4 -4
- package/dist/v2/{search-xr5wb3a3.js → search-y01mww69.js} +4 -4
- package/dist/v2/{server-86vydsx9.js → server-0dmzr7f9.js} +2 -2
- package/dist/v2/{server-92fhew3p.js → server-1svqwm7m.js} +5 -5
- package/dist/v2/{server-6jxvkyrr.js → server-2gcfmd47.js} +1 -1
- package/dist/v2/{server-b0k0cfkd.js → server-d7dbk2h6.js} +2 -2
- package/dist/v2/{server-gsz7h1zr.js → server-dhdn8mwq.js} +1 -1
- package/dist/v2/{server-06ew2dbf.js → server-qpnjsg1v.js} +4 -4
- package/dist/v2/{server-fw2sjpkx.js → server-r00xyx66.js} +1 -1
- package/dist/v2/{server-b8qp1ark.js → server-r9xsgnez.js} +1 -1
- package/dist/v2/{server-65r7p1z4.js → server-tkznm2j9.js} +2 -2
- package/dist/v2/{server-474m6n9v.js → server-wc0bb04b.js} +120 -14
- package/dist/v2/{server-cxkb9725.js → server-xdh4r20h.js} +5 -3
- package/dist/v2/server.js +2 -2
- package/dist/v2/{storage-tags-j4he6hwe.js → storage-tags-z8j8wq34.js} +1 -1
- package/dist/v2/{store-4se2a0n0.js → store-1fax2zhj.js} +1 -1
- package/dist/v2/{v2-archive-reader-rm5qkv00.js → v2-archive-reader-jatkdt2s.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-ghbsa00k.js → wrapup-orchestrator-z91sebhb.js} +6 -6
- package/dist/{v2-archive-reader-gwe0ry1a.js → v2-archive-reader-sw01917z.js} +1 -1
- package/dist/{wrapup-orchestrator-q12ejyw9.js → wrapup-orchestrator-1k48hzxg.js} +8 -8
- package/package.json +1 -1
- package/src/shared/subagent-runner.ts +10 -0
|
@@ -31,7 +31,7 @@ serveWorkerJobs(async (initial, port) => {
|
|
|
31
31
|
import("./embedding-cache-mgyr73ef.js"),
|
|
32
32
|
import("./storage-memory-e6a7mb0k.js"),
|
|
33
33
|
import("./project-embedding-registry-sw4z2ptg.js"),
|
|
34
|
-
import("./search-
|
|
34
|
+
import("./search-mpde08f1.js"),
|
|
35
35
|
import("./compartment-chunk-embedding-ymc9mtwv.js"),
|
|
36
36
|
import("./embedding-activity-g1dhes6g.js"),
|
|
37
37
|
import("./harness-e4avh192.js"),
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
rebaseSessionCoordinatesAsync,
|
|
39
39
|
resolveOpenCodeProtectedTailBoundary,
|
|
40
40
|
getActiveCompartmentRun
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-sy5wbbw6.js";
|
|
42
42
|
import"./index-sd3egckz.js";
|
|
43
43
|
import {
|
|
44
44
|
getHarness2
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
applyJsonSchemaParameterDescriptions,
|
|
131
131
|
MagicContextRpcServer,
|
|
132
132
|
subagentTemperature
|
|
133
|
-
} from "./index-
|
|
133
|
+
} from "./index-2dadxknq.js";
|
|
134
134
|
import {
|
|
135
135
|
resolveHistorianModel2
|
|
136
136
|
} from "./index-5kym00ag.js";
|
|
@@ -187,7 +187,7 @@ import {
|
|
|
187
187
|
markServedShapeRepair,
|
|
188
188
|
getEmptyImageParts,
|
|
189
189
|
estimateFinalWireInputTokens
|
|
190
|
-
} from "./index-
|
|
190
|
+
} from "./index-y208s7zx.js";
|
|
191
191
|
import {
|
|
192
192
|
hasMeaningfulUserText2,
|
|
193
193
|
preloadTokenizer,
|
|
@@ -213,12 +213,12 @@ import {
|
|
|
213
213
|
cleanUserText2,
|
|
214
214
|
readRawSessionMessageIdOrdinalsForRange2,
|
|
215
215
|
readRawSessionMessageOrdinalById2
|
|
216
|
-
} from "./index-
|
|
217
|
-
import"./index-
|
|
216
|
+
} from "./index-2q0t43fy.js";
|
|
217
|
+
import"./index-zzvd4a9z.js";
|
|
218
218
|
import"./index-s32f8y67.js";
|
|
219
219
|
import {
|
|
220
220
|
scheduleClearAndReindex
|
|
221
|
-
} from "./index-
|
|
221
|
+
} from "./index-m6rkq3t4.js";
|
|
222
222
|
import {
|
|
223
223
|
invalidateAutoEmbedSession,
|
|
224
224
|
clearEmbedSessionState
|
|
@@ -262,7 +262,7 @@ import {
|
|
|
262
262
|
getSlot,
|
|
263
263
|
dropSlot,
|
|
264
264
|
copySessionStateForClone
|
|
265
|
-
} from "./index-
|
|
265
|
+
} from "./index-xsdaz3mq.js";
|
|
266
266
|
import {
|
|
267
267
|
startBootDeadline,
|
|
268
268
|
BOOT_SQLITE_BUSY_TIMEOUT_MS,
|
|
@@ -270,7 +270,7 @@ import {
|
|
|
270
270
|
openDatabaseAsync,
|
|
271
271
|
isDatabasePersisted,
|
|
272
272
|
getDatabasePersistenceError
|
|
273
|
-
} from "./index-
|
|
273
|
+
} from "./index-aawwdt26.js";
|
|
274
274
|
import"./index-fr0wbhdn.js";
|
|
275
275
|
import"./index-xx05vta0.js";
|
|
276
276
|
import {
|
|
@@ -293,7 +293,7 @@ import {
|
|
|
293
293
|
servedHeadChanged,
|
|
294
294
|
noteHostCheckpointCommit,
|
|
295
295
|
isSyntheticHeadMessage2
|
|
296
|
-
} from "./index-
|
|
296
|
+
} from "./index-8ykmp4jv.js";
|
|
297
297
|
import"./index-832w615x.js";
|
|
298
298
|
import"./index-qt1qqasc.js";
|
|
299
299
|
import {
|
|
@@ -314,8 +314,8 @@ import {
|
|
|
314
314
|
} from "./index-x8a7jmkh.js";
|
|
315
315
|
import"./index-e6ncz7a6.js";
|
|
316
316
|
import"./index-1sq1krqw.js";
|
|
317
|
-
import"./index-
|
|
318
|
-
import"./index-
|
|
317
|
+
import"./index-m0tbtzqh.js";
|
|
318
|
+
import"./index-f619wjj9.js";
|
|
319
319
|
import"./index-98qy103c.js";
|
|
320
320
|
import {
|
|
321
321
|
detectConflicts
|
|
@@ -326,6 +326,10 @@ import {
|
|
|
326
326
|
formatStorageRecoveryNotice,
|
|
327
327
|
hasStorageNoticeShape,
|
|
328
328
|
dropStorageNotices,
|
|
329
|
+
rememberHostMedia,
|
|
330
|
+
hostMediaAsset,
|
|
331
|
+
hostMediaFromEncoded,
|
|
332
|
+
HOST_RESTORE_MEDIA,
|
|
329
333
|
restoreRow,
|
|
330
334
|
isToolError,
|
|
331
335
|
toolErrorText,
|
|
@@ -336,12 +340,12 @@ import {
|
|
|
336
340
|
readV2RawMessagePagesForConversion2,
|
|
337
341
|
createV2RawMessageReader2,
|
|
338
342
|
createV2RawMessageProvider2
|
|
339
|
-
} from "./index-
|
|
343
|
+
} from "./index-enpatj5k.js";
|
|
340
344
|
import"./index-fmsr7v69.js";
|
|
341
|
-
import"./index-
|
|
345
|
+
import"./index-twmeey4h.js";
|
|
342
346
|
import"./index-52x68mj4.js";
|
|
343
|
-
import"./index-
|
|
344
|
-
import"./index-
|
|
347
|
+
import"./index-v8x07j6c.js";
|
|
348
|
+
import"./index-hgdkwp21.js";
|
|
345
349
|
import {
|
|
346
350
|
isDreamerRunnable,
|
|
347
351
|
isSmartNoteSurfaceAvailable,
|
|
@@ -688,128 +692,6 @@ function trimToRecordedBoundary(db, sessionId, messages) {
|
|
|
688
692
|
return safeStart;
|
|
689
693
|
}
|
|
690
694
|
|
|
691
|
-
// src/v2/fold/host-media.ts
|
|
692
|
-
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
693
|
-
function isClassInstance(value) {
|
|
694
|
-
if (!isRecord2(value))
|
|
695
|
-
return false;
|
|
696
|
-
const prototype = Object.getPrototypeOf(value);
|
|
697
|
-
return prototype !== Object.prototype && prototype !== null;
|
|
698
|
-
}
|
|
699
|
-
var rememberedAssetClass;
|
|
700
|
-
var rememberedMessageClass;
|
|
701
|
-
var schemaUsesAssets = new WeakMap;
|
|
702
|
-
function rememberHostMedia(messages) {
|
|
703
|
-
for (const message of messages) {
|
|
704
|
-
if (!isClassInstance(message))
|
|
705
|
-
continue;
|
|
706
|
-
rememberedMessageClass ??= Object.getPrototypeOf(message).constructor;
|
|
707
|
-
if (rememberedAssetClass)
|
|
708
|
-
return;
|
|
709
|
-
const content = message.content;
|
|
710
|
-
if (!Array.isArray(content))
|
|
711
|
-
continue;
|
|
712
|
-
for (const part of content) {
|
|
713
|
-
if (!isRecord2(part) || part.type !== "media")
|
|
714
|
-
continue;
|
|
715
|
-
const media = part.media;
|
|
716
|
-
if (isClassInstance(media) && isRecord2(media.source)) {
|
|
717
|
-
rememberedAssetClass = Object.getPrototypeOf(media).constructor;
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
function hostUsesMediaAssets() {
|
|
724
|
-
const messageClass = rememberedMessageClass;
|
|
725
|
-
if (!messageClass)
|
|
726
|
-
return rememberedAssetClass !== undefined;
|
|
727
|
-
const cached = schemaUsesAssets.get(messageClass);
|
|
728
|
-
if (cached !== undefined)
|
|
729
|
-
return cached;
|
|
730
|
-
let uses = rememberedAssetClass !== undefined;
|
|
731
|
-
if (!uses) {
|
|
732
|
-
try {
|
|
733
|
-
uses = JSON.stringify(messageClass.ast).includes('"Media.Asset"');
|
|
734
|
-
} catch {
|
|
735
|
-
uses = false;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
schemaUsesAssets.set(messageClass, uses);
|
|
739
|
-
return uses;
|
|
740
|
-
}
|
|
741
|
-
function decodeThroughHostSchema(encoded) {
|
|
742
|
-
const source = encoded.source;
|
|
743
|
-
const messageClass = rememberedMessageClass;
|
|
744
|
-
if (!messageClass)
|
|
745
|
-
return "no host message class seen";
|
|
746
|
-
const fields = messageClass.fields;
|
|
747
|
-
const union = fields?.content?.value;
|
|
748
|
-
const members = union?.members;
|
|
749
|
-
if (!Array.isArray(members))
|
|
750
|
-
return "host content schema has no union members";
|
|
751
|
-
const mediaPart = members.find((member) => {
|
|
752
|
-
const typeField = member?.fields;
|
|
753
|
-
const literal = typeField?.type?.ast?.literal;
|
|
754
|
-
return literal === "media";
|
|
755
|
-
});
|
|
756
|
-
const assetSchema = mediaPart?.fields?.media;
|
|
757
|
-
const encoding = assetSchema?.ast?.encoding;
|
|
758
|
-
const decode = Array.isArray(encoding) ? encoding[0]?.transformation?.decode : undefined;
|
|
759
|
-
const getter = decode;
|
|
760
|
-
let asset;
|
|
761
|
-
if (getter?._tag === "Transform") {
|
|
762
|
-
if (typeof getter.transform !== "function")
|
|
763
|
-
return "host media schema has no decode transformation";
|
|
764
|
-
asset = getter.transform(encoded);
|
|
765
|
-
} else {
|
|
766
|
-
if (getter?._tag !== undefined)
|
|
767
|
-
return `host media schema has unsupported decode transformation: ${String(getter._tag)}`;
|
|
768
|
-
const run = getter?.run;
|
|
769
|
-
if (typeof run !== "function")
|
|
770
|
-
return "host media schema has no decode transformation";
|
|
771
|
-
const result = run.call(decode, { _tag: "Some", value: encoded }, {});
|
|
772
|
-
const option = result?._tag === "Success" ? result.value : undefined;
|
|
773
|
-
asset = option?._tag === "Some" ? option.value : undefined;
|
|
774
|
-
}
|
|
775
|
-
if (!isClassInstance(asset) || asset.source !== source)
|
|
776
|
-
return "host media schema decode did not return an asset";
|
|
777
|
-
return asset;
|
|
778
|
-
}
|
|
779
|
-
function hostMediaAsset(data, mediaType) {
|
|
780
|
-
return hostMediaFromEncoded({ source: { type: "base64", data, mediaType } });
|
|
781
|
-
}
|
|
782
|
-
function hostMediaFromEncoded(value) {
|
|
783
|
-
if (!isRecord2(value.source))
|
|
784
|
-
return "missing Media.Asset source";
|
|
785
|
-
const encoded = structuredClone(value);
|
|
786
|
-
if (encoded.source.type === "bytes") {
|
|
787
|
-
if (typeof encoded.source.data !== "string")
|
|
788
|
-
return "bytes media has no JSON codec payload";
|
|
789
|
-
encoded.source.data = new Uint8Array(Buffer.from(encoded.source.data, "base64"));
|
|
790
|
-
}
|
|
791
|
-
if (!["bytes", "base64", "url", "ref"].includes(String(encoded.source.type)))
|
|
792
|
-
return "unknown Media.Asset source";
|
|
793
|
-
let first = "no Media.Asset seen in this process";
|
|
794
|
-
if (rememberedAssetClass) {
|
|
795
|
-
try {
|
|
796
|
-
return new rememberedAssetClass(encoded);
|
|
797
|
-
} catch (error) {
|
|
798
|
-
first = `remembered asset class threw: ${String(error)}`;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
let second;
|
|
802
|
-
try {
|
|
803
|
-
const decoded = decodeThroughHostSchema(encoded);
|
|
804
|
-
if (typeof decoded !== "string")
|
|
805
|
-
return decoded;
|
|
806
|
-
second = decoded;
|
|
807
|
-
} catch (error) {
|
|
808
|
-
second = `host media schema decode threw: ${String(error)}`;
|
|
809
|
-
}
|
|
810
|
-
return `${first}; ${second}`;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
695
|
// src/v2/fold/idle.ts
|
|
814
696
|
class HostFoldIdle {
|
|
815
697
|
fold;
|
|
@@ -1575,6 +1457,43 @@ function rejectContentPart(message, part, reason) {
|
|
|
1575
1457
|
else
|
|
1576
1458
|
log2(text);
|
|
1577
1459
|
}
|
|
1460
|
+
var mediaRepairLogged = new Set;
|
|
1461
|
+
function unpassableAttachmentNote(name, mediaType) {
|
|
1462
|
+
return `[Attachment ${name ? `"${name}" ` : ""}(${mediaType}) could not be passed to the model]`;
|
|
1463
|
+
}
|
|
1464
|
+
function repairMediaPart(message, partIndex, part) {
|
|
1465
|
+
const media = isRecord(part.media) ? part.media : undefined;
|
|
1466
|
+
const source = isRecord(media?.source) ? media.source : undefined;
|
|
1467
|
+
const mediaType = [part.mediaType, media?.mediaType, source?.mediaType].find((value) => typeof value === "string");
|
|
1468
|
+
let asset = "the part has neither an encoded asset nor inline data";
|
|
1469
|
+
if (media && source)
|
|
1470
|
+
asset = hostMediaFromEncoded(media);
|
|
1471
|
+
else if (part.media === undefined && typeof part.data === "string" && mediaType)
|
|
1472
|
+
asset = hostMediaAsset(part.data, mediaType);
|
|
1473
|
+
const sessionID = typeof message.info.sessionID === "string" ? message.info.sessionID : "";
|
|
1474
|
+
const key = JSON.stringify([sessionID, message.info.id ?? null, partIndex]);
|
|
1475
|
+
if (!mediaRepairLogged.has(key)) {
|
|
1476
|
+
mediaRepairLogged.add(key);
|
|
1477
|
+
const where = `message=${String(message.info.id ?? "<head>")} part=${partIndex} mediaType=${mediaType ?? "unknown"} fields=${Object.keys(part).join(",")}`;
|
|
1478
|
+
const text = typeof asset === "string" ? `v2 context replaced a media part that has no host asset by a note: ${where} reason=${JSON.stringify(asset)}` : `v2 context rebuilt a media part that had no host asset instance: ${where}`;
|
|
1479
|
+
if (sessionID)
|
|
1480
|
+
sessionLog2(sessionID, text);
|
|
1481
|
+
else
|
|
1482
|
+
log2(text);
|
|
1483
|
+
}
|
|
1484
|
+
if (typeof asset !== "string") {
|
|
1485
|
+
if (media)
|
|
1486
|
+
return { ...part, media: asset };
|
|
1487
|
+
const { type: _type, mediaType: _mediaType, data: _data, ...rest } = part;
|
|
1488
|
+
return { type: "media", media: asset, ...rest };
|
|
1489
|
+
}
|
|
1490
|
+
const name = typeof part.filename === "string" ? part.filename : undefined;
|
|
1491
|
+
return {
|
|
1492
|
+
type: "text",
|
|
1493
|
+
text: unpassableAttachmentNote(name, mediaType ?? "unknown media type"),
|
|
1494
|
+
...part.cache === undefined ? {} : { cache: part.cache }
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1578
1497
|
var emptyTextOmissionLogged = new Set;
|
|
1579
1498
|
function placeCacheHint(content, hint) {
|
|
1580
1499
|
if (content.length === 0 || content.some((part) => part.cache !== undefined))
|
|
@@ -1941,6 +1860,10 @@ function adaptPayload(draft, syntheticIDs = new Set, messageTimes = new Map, hid
|
|
|
1941
1860
|
const { synthetic: _synthetic, ...clean } = part;
|
|
1942
1861
|
const original = hostPartTypes.has(clean.type) && !containsHostInstance(clean) ? hostParts.get(contentKey(clean)) : undefined;
|
|
1943
1862
|
const projected = original ?? clean;
|
|
1863
|
+
if (projected.type === "media" && !isHostInstance(projected.media)) {
|
|
1864
|
+
content.push(repairMediaPart(message, partIndex, projected));
|
|
1865
|
+
continue;
|
|
1866
|
+
}
|
|
1944
1867
|
if (imageOmissions.get(message.info.id ?? "")?.has(partIndex))
|
|
1945
1868
|
emptyImages.add(projected);
|
|
1946
1869
|
content.push(projected);
|
|
@@ -2898,10 +2821,7 @@ ${cached}
|
|
|
2898
2821
|
return this.replayInput(args, replay);
|
|
2899
2822
|
}
|
|
2900
2823
|
rendered(row, model) {
|
|
2901
|
-
return restoreRow(row, model,
|
|
2902
|
-
asset: hostMediaAsset,
|
|
2903
|
-
unavailable: () => {}
|
|
2904
|
-
} : undefined);
|
|
2824
|
+
return restoreRow(row, model, HOST_RESTORE_MEDIA);
|
|
2905
2825
|
}
|
|
2906
2826
|
record(row, messages) {
|
|
2907
2827
|
const data = JSON.stringify(encodeNative(messages));
|
|
@@ -7681,10 +7601,10 @@ async function registerContext(context) {
|
|
|
7681
7601
|
if (moduleBoundarySeq !== undefined)
|
|
7682
7602
|
sessionLog2(draft.sessionID, `v2 restore: from the module boundary ${moduleBoundaryID} to the host checkpoint`);
|
|
7683
7603
|
const present = new Set(args.messages.map((message) => message.id));
|
|
7684
|
-
const restored = restoredRows.rows(reader, draft.sessionID, boundary, cut.seq).filter((row) => !retiredInstructions(row)).filter((row) => !present.has(row.id)).flatMap((row) => restoreRow(row, draft.model,
|
|
7604
|
+
const restored = restoredRows.rows(reader, draft.sessionID, boundary, cut.seq).filter((row) => !retiredInstructions(row)).filter((row) => !present.has(row.id)).flatMap((row) => restoreRow(row, draft.model, {
|
|
7685
7605
|
asset: hostMediaAsset,
|
|
7686
7606
|
unavailable: (detail) => sessionLog2(draft.sessionID, `v2 restore: attachment replaced by a note row=${detail.rowID} name=${JSON.stringify(detail.name ?? null)} mediaType=${detail.mediaType} reason=${JSON.stringify(detail.reason)}`)
|
|
7687
|
-
}
|
|
7607
|
+
}));
|
|
7688
7608
|
return [
|
|
7689
7609
|
...rustModeModuleClient ? [] : coveredInstructionRows(reader, draft.sessionID, Math.min(boundary, cut.seq), draft.model, retiredInstructions),
|
|
7690
7610
|
...restored,
|
|
@@ -14,7 +14,7 @@ export declare function peekCurateCategoryScope<T extends {
|
|
|
14
14
|
export declare function beginCurateCategoryRun<T extends {
|
|
15
15
|
category: string;
|
|
16
16
|
}>(db: Database, projectIdentity: string, memories: readonly T[]): CurateCategoryScope<T> | null;
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function curateTaskStateAfterCategoryTurn(db: Database, projectIdentity: string, category: CurateMemoryCategory): string;
|
|
18
18
|
export declare function getActiveCurateCategory(db: Database, projectIdentity: string): CurateMemoryCategory | null;
|
|
19
19
|
export declare function getCurateCategoryScopeRefusal(args: {
|
|
20
20
|
scope: CurateMemoryCategory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curate-category-rotation.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/curate-category-rotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD,eAAO,MAAM,wBAAwB,sFAAuB,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAY7E,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAI7F;AAYD,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE;IAC/D,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,CAAC,EAAE,CAAC;CACjB;AAuCD,wBAAgB,uBAAuB,CAAC,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EAClE,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,SAAS,CAAC,EAAE,GACvB,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI,CAgB/B;AAED,wB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AE,QAAQ,EACZ,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,oBAAoB,GAC/B,MAAM,CASR;AAED,wBAAgB,uBAAuB,CACnC,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,GACxB,oBAAoB,GAAG,IAAI,CAG7B;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAChD,KAAK,EAAE,oBAAoB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CAChD,GAAG,MAAM,GAAG,IAAI,CAWhB"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Memory } from "../memory";
|
|
2
2
|
export type CurateMutationVerdict = "archive" | "update";
|
|
3
|
-
|
|
3
|
+
declare const CURATE_SAFETY_REFUSAL_REASONS: readonly ["missing-active-same-category-successor", "user-profile-is-not-project-memory", "directive-shaped-project-rule", "content-loss"];
|
|
4
|
+
export type CurateSafetyRefusalReason = (typeof CURATE_SAFETY_REFUSAL_REASONS)[number];
|
|
5
|
+
/** Read the reason labels for one refused call. The `refused=` field counts memories across the child session, not operations in this result. */
|
|
6
|
+
export declare function parseCurateSafetyRefusal(action: unknown, output: string): CurateSafetyRefusalReason[] | null;
|
|
4
7
|
export interface CurateSafetyRefusal {
|
|
5
8
|
memoryId: number;
|
|
6
9
|
verdict: CurateMutationVerdict;
|
|
@@ -18,4 +21,5 @@ export declare function assessCurateMutationSafety(args: {
|
|
|
18
21
|
}): CurateSafetyRefusal | null;
|
|
19
22
|
export declare function recordCurateSafetyRefusal(sessionId: string, refusal: CurateSafetyRefusal): number;
|
|
20
23
|
export declare function takeCurateSafetyRefusalCount(sessionId: string): number;
|
|
24
|
+
export {};
|
|
21
25
|
//# sourceMappingURL=curate-memory-safety.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curate-memory-safety.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/curate-memory-safety.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOxC,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,QAAQ,CAAC;AACzD,MAAM,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"curate-memory-safety.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/curate-memory-safety.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOxC,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,QAAQ,CAAC;AACzD,QAAA,MAAM,6BAA6B,4IAKzB,CAAC;AACX,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAIvF,iJAAiJ;AACjJ,wBAAgB,wBAAwB,CACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,GACf,yBAAyB,EAAE,GAAG,IAAI,CAapC;AAED,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,MAAM,EAAE,yBAAyB,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAoBD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,qBAAqB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/C,GAAG,mBAAmB,GAAG,IAAI,CAgD7B;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAWjG;AAED,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAItE"}
|
|
@@ -4,6 +4,7 @@ import type { PluginContext } from "../../../plugin/types";
|
|
|
4
4
|
import type { ModelInput } from "../../../shared/model-resolution";
|
|
5
5
|
import type { Database } from "../../../shared/sqlite";
|
|
6
6
|
import { type ClassifyModuleClient } from "./classify";
|
|
7
|
+
import { type CurateSafetyRefusalReason } from "./curate-memory-safety";
|
|
7
8
|
import { type RetrospectiveRawProvider } from "./retrospective-raw-provider";
|
|
8
9
|
import { type DreamTaskName, type DreamTaskProgress } from "./task-registry";
|
|
9
10
|
import type { TaskExecutor } from "./task-scheduler";
|
|
@@ -74,6 +75,7 @@ export interface DreamTaskExecutorDeps {
|
|
|
74
75
|
interface CurateMemoryOperationSummary {
|
|
75
76
|
totalCalls: number;
|
|
76
77
|
completedActions: string[];
|
|
78
|
+
refusals: CurateSafetyRefusalReason[][];
|
|
77
79
|
}
|
|
78
80
|
export declare function inspectCurateMemoryOperations(messages: unknown): CurateMemoryOperationSummary;
|
|
79
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-executor.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/task-executor.ts"],"names":[],"mappings":"AAcA,OAAO,EAEH,KAAK,wBAAwB,EAGhC,MAAM,uDAAuD,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAK1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AASnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAiBvD,OAAO,E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WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;SAChC,KAAK,OAAO,CAAC;YAAE,SAAS,EAAE;gBAAE,KAAK,CAAC,EAAE,MAAM,CAAC;gBAAC,UAAU,CAAC,EAAE,MAAM,CAAA;aAAE,GAAG,IAAI,CAAA;SAAE,CAAC,CAAC;KAChF,CAAC;CACL;AAoKD,UAAU,4BAA4B;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,yBAAyB,EAAE,EAAE,CAAC;CAC3C;AAMD,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,OAAO,GAAG,4BAA4B,CA4C7F;AA0FD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,YAAY,CAmyBjF;AA4BD;;;;;;;;+EAQ+E;AAC/E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA+B9F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-token-estimate.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/image-token-estimate.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIlE;
|
|
1
|
+
{"version":3,"file":"image-token-estimate.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/image-token-estimate.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIlE;AAkED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAE/E;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAOpF;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAexE"}
|