@cortexkit/opencode-magic-context 0.49.90 → 0.49.92
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 +4 -4
- package/dist/chunk-embedding-write-worker.js +6 -6
- package/dist/{compartment-chunk-embedding-fey2bsyf.js → compartment-chunk-embedding-rp4asvk0.js} +3 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/migrate-dreamer-v2.d.ts +1 -0
- package/dist/config/migrate-dreamer-v2.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-kbq6ppjf.js → conflict-warning-hook-exf96bpt.js} +3 -3
- package/dist/{context-cdds0gjj.js → context-e8qd2v00.js} +579 -245
- package/dist/{embedding-backfill-qjkaee9s.js → embedding-backfill-w0yq71q2.js} +6 -6
- package/dist/embedding-worker.js +3 -3
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +2 -2
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/memory/single-store-embedding-drain.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +7 -1
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +2 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +13 -3
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-parser.d.ts +2 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +7 -7
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +3 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +2 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts +4 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +5 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-drain-gate.d.ts +15 -0
- package/dist/hooks/magic-context/historian-drain-gate.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-host-runner.d.ts +1 -1
- package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts +5 -0
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/provider-overflow-notice.d.ts +8 -0
- package/dist/hooks/magic-context/provider-overflow-notice.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-db.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +5 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-1y4y98r1.js → index-01h7tqe3.js} +25 -2
- package/dist/{index-3pdknr07.js → index-0twg41mh.js} +2 -2
- package/dist/{index-q7msfgwz.js → index-3f3d548g.js} +1503 -1371
- package/dist/{index-2pdgy88n.js → index-3n376ann.js} +19 -7
- package/dist/{index-78t37mcq.js → index-41bma6qs.js} +3 -3
- package/dist/{index-qfcjrnpe.js → index-5a9kwapd.js} +4 -4
- package/dist/{index-dk3hy2a2.js → index-5pmf4jpj.js} +10 -10
- package/dist/{index-2qsca7h7.js → index-5y9w2ax7.js} +4 -4
- package/dist/{index-pxnzyvjc.js → index-6r99v53h.js} +1 -1
- package/dist/{index-mrjat4eq.js → index-6rk44cer.js} +3 -3
- package/dist/{index-60wnwcwz.js → index-901exj0f.js} +91 -26
- package/dist/{index-6zewd2n5.js → index-9ffntwyr.js} +1 -1
- package/dist/{index-h9hybzr5.js → index-anwy2mfb.js} +6 -6
- package/dist/{index-83qd3n7s.js → index-et39x9k3.js} +1 -1
- package/dist/{index-w51n3576.js → index-f25ha337.js} +1 -1
- package/dist/{index-kknjvmpx.js → index-fqth7850.js} +51 -60
- package/dist/{index-zxhev8ze.js → index-hbn5g7rt.js} +1 -1
- package/dist/{index-chpzb6xy.js → index-hre29c1a.js} +2 -2
- package/dist/{index-08jfpny9.js → index-j2w79s9r.js} +76 -6
- package/dist/{index-tt0vs4x5.js → index-jba6ny4m.js} +28 -4
- package/dist/{index-m6dnydf8.js → index-mg9s2rc3.js} +1 -1
- package/dist/{index-61knrt52.js → index-mjy2k9jr.js} +1 -1
- package/dist/{index-wmb2mcdw.js → index-n71006wq.js} +6 -6
- package/dist/{index-n1ty0vd3.js → index-r3tdqqtq.js} +127 -101
- package/dist/{index-5vsk2cpp.js → index-s7460efs.js} +12 -1
- package/dist/{index-x40zr813.js → index-sp5pvs95.js} +9 -1
- package/dist/{index-9d3qgwq0.js → index-wvbg9m0h.js} +4 -4
- package/dist/index-x3rdza40.js +63 -0
- package/dist/{index-jzfsnbmm.js → index-xg1zjht5.js} +5 -5
- package/dist/{index-60x5d68t.js → index-xn9efn18.js} +1 -1
- package/dist/{index-39rzef89.js → index-ydhymf0b.js} +3 -3
- package/dist/{index-g0mb2kb4.js → index-zzhcshdk.js} +75 -67
- package/dist/index.js +97 -60
- package/dist/{message-index-bounded-r1qys471.js → message-index-bounded-f6fc00ze.js} +6 -6
- package/dist/migration-worker.js +4 -4
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-m3fp1pa4.js → project-embedding-registry-8je0xg18.js} +7 -5
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-xv9f0wgb.js → read-session-chunk-y2ew3630.js} +5 -5
- package/dist/{recomp-orchestrator-dgyb394j.js → recomp-orchestrator-ggtcvb9g.js} +21 -20
- package/dist/{render-d014e603.js → render-q8c6wrq9.js} +14 -14
- package/dist/{search-archive-gybn6q7s.js → search-archive-pz1jf655.js} +7 -7
- package/dist/{search-9gceftb9.js → search-gjyrwapc.js} +16 -16
- package/dist/{send-session-notification-gzxz88vq.js → send-session-notification-0779tyd9.js} +2 -2
- package/dist/shared/model-suggestion-retry.d.ts +18 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/{storage-tags-f1ftvjpw.js → storage-tags-7raphcw6.js} +3 -3
- package/dist/{store-reader-nf8z86n9.js → store-reader-qbq6q4v0.js} +1 -1
- package/dist/{store-n4yz3n66.js → store-yr443ye8.js} +2 -2
- package/dist/{task-config-qt6n4bxm.js → task-config-vrebjxyy.js} +2 -1
- package/dist/{transform-postprocess-phase-34k1zwsy.js → transform-postprocess-phase-pmzdd3s2.js} +22 -21
- package/dist/v2/auto-search-worker.js +4 -4
- package/dist/v2/chunk-embedding-write-worker.js +6 -6
- package/dist/v2/{compartment-chunk-embedding-knt2468v.js → compartment-chunk-embedding-w7ht0t9v.js} +3 -3
- package/dist/v2/{context-satgm752.js → context-qqbpzk1q.js} +686 -323
- package/dist/v2/{embedding-backfill-0ar1bm97.js → embedding-backfill-95m72gxa.js} +6 -6
- package/dist/v2/embedding-worker.js +3 -3
- package/dist/v2/fold/host-media.d.ts.map +1 -1
- package/dist/v2/fold/native-replay-v3.d.ts.map +1 -1
- package/dist/v2/fold/native-replay.d.ts +1 -0
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/restore.d.ts +15 -0
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/hidden-child-native.d.ts +1 -1
- package/dist/v2/hidden-child-native.d.ts.map +1 -1
- package/dist/v2/hidden-child-record.d.ts +11 -2
- package/dist/v2/hidden-child-record.d.ts.map +1 -1
- package/dist/v2/hidden-child-sweep.d.ts +3 -0
- package/dist/v2/hidden-child-sweep.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts +4 -0
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hidden-run-holder.d.ts +6 -6
- package/dist/v2/hidden-run-holder.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +2 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/overflow-recovery.d.ts +6 -0
- package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-b07r9cjv.js → message-index-bounded-70g28hyg.js} +6 -6
- package/dist/v2/migration-worker.js +4 -4
- package/dist/v2/{project-embedding-registry-gx2waee8.js → project-embedding-registry-fcxf4qht.js} +7 -5
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-38wdy8nd.js → read-session-chunk-9rf0n9e6.js} +5 -5
- package/dist/v2/{recomp-orchestrator-wq7gbkqa.js → recomp-orchestrator-cwghhjc9.js} +21 -20
- package/dist/v2/{render-2dan17xc.js → render-e852zmxz.js} +14 -14
- package/dist/v2/{search-archive-89hdy0a2.js → search-archive-tmn6b5w8.js} +7 -7
- package/dist/v2/{search-nyqykx7q.js → search-jd3vczhn.js} +15 -15
- package/dist/v2/{send-session-notification-zazaxxpf.js → send-session-notification-v69y04f5.js} +2 -2
- package/dist/v2/server-3gz9k20t.js +63 -0
- package/dist/v2/{server-09h2vyvs.js → server-6t3asmx8.js} +6 -6
- package/dist/v2/{server-dgjqvpgd.js → server-72k2r3kt.js} +19 -7
- package/dist/v2/{server-pjk9spbf.js → server-7e89a2kf.js} +1 -1
- package/dist/v2/{server-dtcwkdqj.js → server-7x5a46hf.js} +1427 -1322
- package/dist/v2/{server-add0j5n3.js → server-8ps3717t.js} +3 -3
- package/dist/v2/{server-c7awk5s2.js → server-9011eteb.js} +4 -4
- package/dist/v2/{server-f7tzvmzs.js → server-b4efn08m.js} +1 -1
- package/dist/v2/{server-y17r5ryz.js → server-barj0mjz.js} +2 -2
- package/dist/v2/{server-b0a9h3ds.js → server-bvr9xs8h.js} +5 -5
- package/dist/v2/{server-pmws7we9.js → server-d4trxrj3.js} +91 -26
- package/dist/v2/{server-fb5hvvfc.js → server-fj3pekz2.js} +3 -3
- package/dist/v2/{server-6250cxzs.js → server-gs2251jr.js} +1 -1
- package/dist/v2/{server-a85j3kam.js → server-jkj1dq6j.js} +28 -4
- package/dist/v2/{server-ta4h0fch.js → server-js2v309w.js} +9 -9
- package/dist/v2/{server-9n2qgk29.js → server-mgxqfprb.js} +2 -2
- package/dist/v2/{server-2kswss3d.js → server-n5wn7d9b.js} +48 -60
- package/dist/v2/{server-vy0beygw.js → server-p4g021y5.js} +4 -4
- package/dist/v2/{server-x6fn9x8q.js → server-ps6zrzwj.js} +1 -1
- package/dist/v2/{server-y8xjr8rx.js → server-qb3s0mnc.js} +12 -1
- package/dist/v2/{server-stjy5dxv.js → server-qntmqaca.js} +1 -1
- package/dist/v2/{server-ytqps2xa.js → server-rkj44mez.js} +76 -6
- package/dist/v2/{server-tj65pgvg.js → server-vsqmkvxc.js} +32 -5
- package/dist/v2/{server-qyazxy92.js → server-vtgeyhq6.js} +25 -2
- package/dist/v2/{server-fn4ky6mn.js → server-x69fqsvz.js} +1 -1
- package/dist/v2/{server-yx0nyj1q.js → server-ysjjcatk.js} +3 -3
- package/dist/v2/server.js +4 -3
- package/dist/v2/{storage-tags-pmw33chf.js → storage-tags-wgsemtw1.js} +3 -3
- package/dist/v2/{store-y56y034s.js → store-enef5jcn.js} +2 -2
- package/dist/v2/{store-reader-2vhx33n6.js → store-reader-jbaqv1yp.js} +1 -1
- package/dist/v2/store-reader.d.ts +18 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{task-config-ex2vajr2.js → task-config-4nqq2s0w.js} +2 -1
- package/dist/v2/{v2-archive-reader-gh1jghf7.js → v2-archive-reader-dm1aeqk2.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-2h7ayss9.js → wrapup-orchestrator-cke368np.js} +21 -20
- package/dist/{v2-archive-reader-8158kyfd.js → v2-archive-reader-39ye0d3b.js} +1 -1
- package/dist/{wrapup-orchestrator-ct59br0c.js → wrapup-orchestrator-ggnk0r4r.js} +22 -21
- package/package.json +1 -1
- package/src/config/index.test.ts +58 -0
- package/src/config/index.ts +4 -1
- package/src/config/migrate-dreamer-v2.ts +42 -0
- package/src/shared/model-suggestion-retry.test.ts +37 -0
- package/src/shared/model-suggestion-retry.ts +38 -4
- package/src/shared/models-dev-cache.test.ts +15 -0
- package/src/shared/startup-maintenance-policy.test.ts +11 -6
- package/dist/index-ksdyrrav.js +0 -52
- package/dist/v2/server-0s95v3en.js +0 -49
- /package/dist/v2/{server-3ap5dmhc.js → server-5hwf5c7r.js} +0 -0
|
@@ -1,9 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// src/config/agent-disable.ts
|
|
2
|
+
var COMPACTION_ENABLED_PATH = `compaction${"."}enabled`;
|
|
3
|
+
function isDreamerRunnable(config) {
|
|
4
|
+
return !!config.dreamer && config.dreamer.disable !== true;
|
|
5
|
+
}
|
|
6
|
+
function isSmartNoteSurfaceAvailable(config) {
|
|
7
|
+
return config.smart_notes?.enabled !== false && isDreamerRunnable(config);
|
|
8
|
+
}
|
|
9
|
+
function isHistorianRunnable(config) {
|
|
10
|
+
return config.historian?.disable !== true;
|
|
11
|
+
}
|
|
12
|
+
function isCompactionEnabled(config) {
|
|
13
|
+
return config.compaction?.enabled !== false;
|
|
14
|
+
}
|
|
15
|
+
function clonePlainObject(value) {
|
|
16
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
return { ...value };
|
|
20
|
+
}
|
|
21
|
+
function migrateLegacyEnabledForAgent(args) {
|
|
22
|
+
const agent = clonePlainObject(args.patched[args.agentName]);
|
|
23
|
+
if (!agent || !("enabled" in agent))
|
|
24
|
+
return;
|
|
25
|
+
const enabled = agent.enabled;
|
|
26
|
+
const disable = agent.disable;
|
|
27
|
+
delete agent.enabled;
|
|
28
|
+
if (args.agentName === "historian") {
|
|
29
|
+
args.warnings.push('Removed invalid "historian.enabled" in-memory (run doctor to persist).');
|
|
30
|
+
args.patched.historian = agent;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (disable !== true && enabled === false) {
|
|
34
|
+
agent.disable = true;
|
|
35
|
+
args.warnings.push('Migrated "dreamer.enabled=false" → "dreamer.disable=true" in-memory (run doctor to persist). This now also disables manual /ctx-dream; for manual-only remove disable and set schedule="".');
|
|
36
|
+
}
|
|
37
|
+
args.patched.dreamer = agent;
|
|
38
|
+
}
|
|
39
|
+
function migrateLegacyAgentEnabledInMemory(rawConfig, warnings) {
|
|
40
|
+
const shouldPatch = ["dreamer", "historian"].some((key) => {
|
|
41
|
+
const agent = rawConfig[key];
|
|
42
|
+
return typeof agent === "object" && agent !== null && !Array.isArray(agent) && "enabled" in agent;
|
|
43
|
+
});
|
|
44
|
+
if (!shouldPatch)
|
|
45
|
+
return rawConfig;
|
|
46
|
+
const patched = { ...rawConfig };
|
|
47
|
+
migrateLegacyEnabledForAgent({ patched, agentName: "dreamer", warnings });
|
|
48
|
+
migrateLegacyEnabledForAgent({ patched, agentName: "historian", warnings });
|
|
49
|
+
return patched;
|
|
50
|
+
}
|
|
7
51
|
|
|
8
52
|
// src/features/magic-context/dreamer/task-registry.ts
|
|
9
53
|
var CANONICAL_DREAM_TASKS = [
|
|
@@ -175,57 +219,4 @@ function compareTaskOrder(a, b) {
|
|
|
175
219
|
return CANONICAL_DREAM_TASKS.indexOf(a) - CANONICAL_DREAM_TASKS.indexOf(b);
|
|
176
220
|
}
|
|
177
221
|
|
|
178
|
-
|
|
179
|
-
function buildDreamTaskRuntimeConfigs2(dreamer, harness, language, smartNotesEnabled = true) {
|
|
180
|
-
return availableDreamTasks(smartNotesEnabled).map((task) => {
|
|
181
|
-
const resolved = resolveDreamerTaskModel2({
|
|
182
|
-
config: { dreamer },
|
|
183
|
-
harness,
|
|
184
|
-
task
|
|
185
|
-
});
|
|
186
|
-
return {
|
|
187
|
-
task,
|
|
188
|
-
schedule: resolved.schedule ?? "",
|
|
189
|
-
model: resolved.primary,
|
|
190
|
-
fallbackModels: resolved.fallbacks,
|
|
191
|
-
modelConfigKey: resolved.primary?.sourceConfigKey ?? resolved.fallbacks[0]?.sourceConfigKey,
|
|
192
|
-
thinkingLevel: harness === "pi" ? resolved.primary?.qualifier : undefined,
|
|
193
|
-
language,
|
|
194
|
-
timeoutMinutes: resolved.timeoutMinutes ?? 20,
|
|
195
|
-
tokenBudget: task in DREAM_TOOL_LOOP_TOKEN_BUDGETS ? dreamer?.tasks?.[task]?.token_budget ?? DREAM_TOOL_LOOP_TOKEN_BUDGETS[task] : undefined,
|
|
196
|
-
promotionThreshold: resolved.promotionThreshold,
|
|
197
|
-
docsMaxTokens: task === "maintain-docs" ? dreamer?.tasks?.["maintain-docs"]?.max_tokens ?? 12000 : undefined,
|
|
198
|
-
retrospectiveRecencyDays: task === "retrospective" ? dreamer?.tasks?.retrospective?.recency_days ?? 30 : undefined
|
|
199
|
-
};
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
function userMemoryCollectionEnabled2(dreamer) {
|
|
203
|
-
const schedule = dreamer?.tasks?.["review-user-memories"]?.schedule;
|
|
204
|
-
return typeof schedule === "string" && schedule.trim() !== "";
|
|
205
|
-
}
|
|
206
|
-
function userObservationCollectionEnabled2(dreamer) {
|
|
207
|
-
return userObservationsRequested2(dreamer) && userMemoryCollectionEnabled2(dreamer);
|
|
208
|
-
}
|
|
209
|
-
function userObservationsRequested2(dreamer) {
|
|
210
|
-
return isDreamerRunnable({ dreamer });
|
|
211
|
-
}
|
|
212
|
-
function userMemoryPromotionThreshold2(dreamer) {
|
|
213
|
-
return dreamer?.tasks?.["review-user-memories"]?.promotion_threshold ?? 3;
|
|
214
|
-
}
|
|
215
|
-
function dreamTaskScheduled2(dreamer, task) {
|
|
216
|
-
const schedule = dreamer?.tasks?.[task]?.schedule;
|
|
217
|
-
return typeof schedule === "string" && schedule.trim() !== "";
|
|
218
|
-
}
|
|
219
|
-
function enabledDreamTasks2(dreamer, smartNotesEnabled = true) {
|
|
220
|
-
if (!dreamer?.tasks)
|
|
221
|
-
return [];
|
|
222
|
-
return availableDreamTasks(smartNotesEnabled).filter((t) => dreamer.tasks[t]?.schedule?.trim());
|
|
223
|
-
}
|
|
224
|
-
function summarizeDreamSchedule2(dreamer, smartNotesEnabled = true) {
|
|
225
|
-
const enabled = enabledDreamTasks2(dreamer, smartNotesEnabled);
|
|
226
|
-
if (enabled.length === 0)
|
|
227
|
-
return "manual-only";
|
|
228
|
-
return enabled.map((t) => `${t} ${dreamer?.tasks[t]?.schedule}`).join(", ");
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export { CANONICAL_DREAM_TASKS, MIN_POOL_TO_CLASSIFY, DREAM_TASK_CAPABILITIES, toolLoopDreamTasks, formatUnsupportedDreamTasks, formatDreamTaskBacklogs, formatDreamTaskFailures, processedDreamTaskItems, PROJECT_MEMORY_DREAM_TASKS, dreamTaskAllowedBySettings, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs2, userMemoryCollectionEnabled2, userObservationCollectionEnabled2, userObservationsRequested2, userMemoryPromotionThreshold2, dreamTaskScheduled2, enabledDreamTasks2, summarizeDreamSchedule2 };
|
|
222
|
+
export { COMPACTION_ENABLED_PATH, isDreamerRunnable, isSmartNoteSurfaceAvailable, isHistorianRunnable, isCompactionEnabled, migrateLegacyAgentEnabledInMemory, CANONICAL_DREAM_TASKS, MIN_POOL_TO_CLASSIFY, availableDreamTasks, DREAM_TOOL_LOOP_TOKEN_BUDGETS, DREAM_TASK_CAPABILITIES, toolLoopDreamTasks, formatUnsupportedDreamTasks, formatDreamTaskBacklogs, formatDreamTaskFailures, processedDreamTaskItems, PROJECT_MEMORY_DREAM_TASKS, dreamTaskAllowedBySettings, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder };
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
removeNestedBlocks,
|
|
7
7
|
hasMeaningfulUserText2,
|
|
8
8
|
extractTexts2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-s7460efs.js";
|
|
10
10
|
import {
|
|
11
11
|
cleanUserText2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-5y9w2ax7.js";
|
|
13
13
|
import {
|
|
14
14
|
recordMessageFtsRowid2,
|
|
15
15
|
recordIndexedMessageTime2,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./index-wh9fxds5.js";
|
|
4
4
|
import {
|
|
5
5
|
RAW_MESSAGE_TYPES2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-01h7tqe3.js";
|
|
7
7
|
import {
|
|
8
8
|
markHostUnservedRow
|
|
9
9
|
} from "./index-s9x93tfs.js";
|
|
@@ -166,6 +166,8 @@ function hostMediaFromEncoded(value) {
|
|
|
166
166
|
return "bytes media has no JSON codec payload";
|
|
167
167
|
encoded.source.data = new Uint8Array(Buffer.from(encoded.source.data, "base64"));
|
|
168
168
|
}
|
|
169
|
+
if (encoded.source.type === "base64" && typeof encoded.source.data !== "string")
|
|
170
|
+
return "base64 media has no payload";
|
|
169
171
|
if (!["bytes", "base64", "url", "ref"].includes(String(encoded.source.type)))
|
|
170
172
|
return "unknown Media.Asset source";
|
|
171
173
|
let first = "no Media.Asset seen in this process";
|
|
@@ -190,13 +192,80 @@ function hostMediaFromEncoded(value) {
|
|
|
190
192
|
|
|
191
193
|
// src/v2/fold/restore.ts
|
|
192
194
|
var HOST_RESTORE_MEDIA = { asset: hostMediaAsset, unavailable: () => {} };
|
|
195
|
+
function readerRestoreMedia(reader, unavailable = () => {}) {
|
|
196
|
+
return { asset: hostMediaAsset, unavailable, blob: (hash) => reader.mediaBlob(hash) };
|
|
197
|
+
}
|
|
193
198
|
function unavailableAttachmentNote(name, mediaType) {
|
|
194
199
|
return `[Attachment ${name ? `"${name}" ` : ""}(${mediaType}) is not available in this restored history]`;
|
|
195
200
|
}
|
|
201
|
+
function hostMissingMediaText(mediaType, name) {
|
|
202
|
+
return `[media unavailable: ${name === undefined ? mediaType : `${name} (${mediaType})`}]`;
|
|
203
|
+
}
|
|
204
|
+
var BLOB_HASH = /^[0-9a-f]{64}$/;
|
|
205
|
+
function readBlob(uri, media) {
|
|
206
|
+
const hash = uri.slice("media:".length);
|
|
207
|
+
if (!BLOB_HASH.test(hash))
|
|
208
|
+
return { kind: "unavailable", reason: "malformed media blob reference" };
|
|
209
|
+
if (!media.blob)
|
|
210
|
+
return { kind: "unavailable", reason: "payload is stored in the host's media blob table" };
|
|
211
|
+
const data = media.blob(hash);
|
|
212
|
+
if (data === undefined)
|
|
213
|
+
return { kind: "unavailable", reason: "the host's store has no media blob table" };
|
|
214
|
+
return data === null ? { kind: "missing" } : { kind: "found", data };
|
|
215
|
+
}
|
|
216
|
+
function withPayload(file, media) {
|
|
217
|
+
if (typeof file.data === "string")
|
|
218
|
+
return { kind: "payload", file };
|
|
219
|
+
if (!file.uri?.startsWith("media:"))
|
|
220
|
+
return { kind: "unavailable", reason: "attachment has no payload" };
|
|
221
|
+
const read = readBlob(file.uri, media);
|
|
222
|
+
if (read.kind === "unavailable")
|
|
223
|
+
return read;
|
|
224
|
+
const { uri: _uri, ...inline } = file;
|
|
225
|
+
if (read.kind === "found")
|
|
226
|
+
return { kind: "payload", file: { ...inline, data: read.data } };
|
|
227
|
+
return {
|
|
228
|
+
kind: "payload",
|
|
229
|
+
file: {
|
|
230
|
+
...inline,
|
|
231
|
+
data: Buffer.from(hostMissingMediaText(file.mime, file.name)).toString("base64"),
|
|
232
|
+
mime: "text/plain"
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
var isBlobFile = (entry) => typeof entry === "object" && entry !== null && entry.type === "file" && typeof entry.uri === "string" && entry.uri.startsWith("media:");
|
|
237
|
+
function toolContentWithPayloads(content, rowID, media) {
|
|
238
|
+
if (!Array.isArray(content) || !content.some(isBlobFile))
|
|
239
|
+
return content;
|
|
240
|
+
return content.map((entry) => {
|
|
241
|
+
if (!isBlobFile(entry))
|
|
242
|
+
return entry;
|
|
243
|
+
const mime = String(entry.mime);
|
|
244
|
+
const name = typeof entry.name === "string" ? entry.name : undefined;
|
|
245
|
+
const read = readBlob(entry.uri, media);
|
|
246
|
+
if (read.kind === "missing")
|
|
247
|
+
return { type: "text", text: hostMissingMediaText(mime, name) };
|
|
248
|
+
if (read.kind === "found")
|
|
249
|
+
return { ...entry, uri: `data:${mime};base64,${read.data}` };
|
|
250
|
+
media.unavailable({ rowID, name, mediaType: mime, reason: read.reason });
|
|
251
|
+
return { type: "text", text: unavailableAttachmentNote(name, mime) };
|
|
252
|
+
});
|
|
253
|
+
}
|
|
196
254
|
var imageMimes = new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
|
|
197
255
|
function attachmentParts(files, rowID, media) {
|
|
198
256
|
const seen = new Map;
|
|
199
|
-
return files.flatMap((
|
|
257
|
+
return files.flatMap((stored) => {
|
|
258
|
+
const result = withPayload(stored, media);
|
|
259
|
+
if (result.kind === "unavailable") {
|
|
260
|
+
media.unavailable({
|
|
261
|
+
rowID,
|
|
262
|
+
name: stored.name,
|
|
263
|
+
mediaType: stored.mime,
|
|
264
|
+
reason: result.reason
|
|
265
|
+
});
|
|
266
|
+
return [{ type: "text", text: unavailableAttachmentNote(stored.name, stored.mime) }];
|
|
267
|
+
}
|
|
268
|
+
const file = result.file;
|
|
200
269
|
if (imageMimes.has(file.mime) && file.source.type === "inline" && file.mention?.text) {
|
|
201
270
|
const key = JSON.stringify([
|
|
202
271
|
file.mime,
|
|
@@ -205,9 +274,10 @@ function attachmentParts(files, rowID, media) {
|
|
|
205
274
|
file.mention.text
|
|
206
275
|
]);
|
|
207
276
|
const payloads = seen.get(key) ?? new Set;
|
|
208
|
-
|
|
277
|
+
const payload = typeof stored.data === "string" ? stored.data : String(stored.uri);
|
|
278
|
+
if (payloads.has(payload))
|
|
209
279
|
return [];
|
|
210
|
-
payloads.add(
|
|
280
|
+
payloads.add(payload);
|
|
211
281
|
seen.set(key, payloads);
|
|
212
282
|
}
|
|
213
283
|
const uri = file.source.type === "uri" ? file.source.uri : undefined;
|
|
@@ -360,7 +430,7 @@ ${data.output?.output ?? ""}`
|
|
|
360
430
|
});
|
|
361
431
|
if (!completed)
|
|
362
432
|
continue;
|
|
363
|
-
const toolContent = state.content ?? [];
|
|
433
|
+
const toolContent = toolContentWithPayloads(state.content ?? [], row.id, media);
|
|
364
434
|
const single = toolContent.length === 1 ? toolContent[0] : undefined;
|
|
365
435
|
const result = {
|
|
366
436
|
type: "tool-result",
|
|
@@ -688,4 +758,4 @@ function createV2RawMessageProvider2(reader, sessionID) {
|
|
|
688
758
|
};
|
|
689
759
|
}
|
|
690
760
|
|
|
691
|
-
export { STORAGE_NOTICE_PREFIX, formatStorageRefusalNotice, formatStorageRecoveryNotice, isCopiedStorageNotice, hasStorageNoticeShape, dropStorageNotices, storageNoticeHasNewInput, rememberHostMedia, hostMediaAsset, hostMediaFromEncoded,
|
|
761
|
+
export { STORAGE_NOTICE_PREFIX, formatStorageRefusalNotice, formatStorageRecoveryNotice, isCopiedStorageNotice, hasStorageNoticeShape, dropStorageNotices, storageNoticeHasNewInput, rememberHostMedia, hostMediaAsset, hostMediaFromEncoded, readerRestoreMedia, restoreRow, isToolError, toolErrorText, toolStateContent, rawMessagePage2, readV2MessageRange2, iterateV2MessageRange2, servedBoundaryRow2, resolveV2BoundaryUserMessage2, readAllV2RawMessagesForConversion2, readV2RawMessagePagesForConversion2, createV2RawMessageReader2, createV2RawMessageProvider2 };
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ensureColumn,
|
|
9
9
|
healAllNullColumns,
|
|
10
10
|
installV95PerfSchema
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-mg9s2rc3.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveOpenCodeDbPath,
|
|
14
14
|
openCodeDbPathExists,
|
|
@@ -269,6 +269,8 @@ var TIER_OPEN_ANY_REGEX = /<p\d/;
|
|
|
269
269
|
var CATEGORY_BLOCK_REGEX = /<([A-Za-z_][A-Za-z0-9_-]*)>(.*?)<\/\1>/gs;
|
|
270
270
|
var HISTORIAN_CATEGORIES = new Set(V2_MEMORY_CATEGORIES);
|
|
271
271
|
var FACT_ITEM_REGEX = /^\s*\*\s*(.+)$/gm;
|
|
272
|
+
var FACT_ANCHOR_GROUP_REGEX = /^\[[ \t]*at_compartment[ \t]*=[^\]\r\n]*\]/i;
|
|
273
|
+
var FACT_ANCHOR_VALUE_REGEX = /^\[[ \t]*at_compartment[ \t]*=[ \t]*([0-9]+)(?:[ \t]+messages[ \t]*=[ \t]*([0-9]+(?:[ \t]*-[ \t]*[0-9]+)?(?:[ \t]*,[ \t]*[0-9]+(?:[ \t]*-[ \t]*[0-9]+)?)*))?[ \t]*\]$/i;
|
|
272
274
|
var UNPROCESSED_REGEX = /<unprocessed_from>(\d+)<\/unprocessed_from>/;
|
|
273
275
|
var USER_OBSERVATIONS_REGEX = /<user_observations>(.*?)<\/user_observations>/s;
|
|
274
276
|
var USER_OBS_ITEM_REGEX = /^\s*\*\s*(.+)$/gm;
|
|
@@ -279,6 +281,25 @@ var FACTS_BLOCK_REGEX = /<facts>(.*?)<\/facts>/s;
|
|
|
279
281
|
var EVENTS_BLOCK_REGEX = /<events>(.*?)<\/events>/s;
|
|
280
282
|
var EVENT_ELEMENT_REGEX = /<([a-z_]+)\s+at_compartment="(\d+)"\s*>(.*?)<\/\1>/gs;
|
|
281
283
|
var EVENT_FIELD_REGEX = /<([a-z_]+)\s*>(.*?)<\/\1>/gs;
|
|
284
|
+
function splitFactAnchorPrefix(item) {
|
|
285
|
+
let content = item;
|
|
286
|
+
let firstGroup;
|
|
287
|
+
while (content) {
|
|
288
|
+
const wrapper = content.startsWith("`") ? "`" : content.startsWith("**") ? "**" : "";
|
|
289
|
+
const group = content.slice(wrapper.length).match(FACT_ANCHOR_GROUP_REGEX)?.[0];
|
|
290
|
+
if (group === undefined || !content.startsWith(wrapper, wrapper.length + group.length))
|
|
291
|
+
break;
|
|
292
|
+
firstGroup ??= group;
|
|
293
|
+
content = content.slice(2 * wrapper.length + group.length).trim();
|
|
294
|
+
}
|
|
295
|
+
const anchor = firstGroup?.match(FACT_ANCHOR_VALUE_REGEX);
|
|
296
|
+
if (!anchor)
|
|
297
|
+
return { content };
|
|
298
|
+
const index = Number(anchor[1]);
|
|
299
|
+
const ranges = anchor[2]?.split(",") ?? [];
|
|
300
|
+
const validRanges = ranges.length <= 3 && ranges.every((range) => range.split("-").every((end) => Number.isSafeInteger(Number(end))));
|
|
301
|
+
return Number.isSafeInteger(index) && index > 0 && validRanges ? { content, originCompartmentIndex: index } : { content };
|
|
302
|
+
}
|
|
282
303
|
function searchFrom(s, regex, from) {
|
|
283
304
|
const at = s.slice(from).search(regex);
|
|
284
305
|
return at === -1 ? -1 : from + at;
|
|
@@ -451,8 +472,11 @@ function parseCompartmentOutput(text) {
|
|
|
451
472
|
log2(`[historian] Dropped <facts> category ${category} (${items.length} facts)`);
|
|
452
473
|
continue;
|
|
453
474
|
}
|
|
454
|
-
for (const
|
|
455
|
-
|
|
475
|
+
for (const item of items) {
|
|
476
|
+
const fact = splitFactAnchorPrefix(item);
|
|
477
|
+
if (fact.content)
|
|
478
|
+
facts.push({ category, ...fact });
|
|
479
|
+
}
|
|
456
480
|
}
|
|
457
481
|
const unprocessedMatch = outside.match(UNPROCESSED_REGEX);
|
|
458
482
|
const unprocessedFrom = unprocessedMatch ? parseInt(unprocessedMatch[1], 10) : null;
|
|
@@ -497,7 +521,7 @@ function parseCompartmentOutput(text) {
|
|
|
497
521
|
const remapAnchor = (anchor) => anchor >= 1 && anchor <= sortedPosition.length ? sortedPosition[anchor - 1] : anchor;
|
|
498
522
|
return {
|
|
499
523
|
compartments: sortedByStart.map(({ compartment }) => compartment),
|
|
500
|
-
facts,
|
|
524
|
+
facts: facts.map((fact) => fact.originCompartmentIndex === undefined ? fact : { ...fact, originCompartmentIndex: remapAnchor(fact.originCompartmentIndex) }),
|
|
501
525
|
droppedFactBlocks,
|
|
502
526
|
droppedFacts,
|
|
503
527
|
events: events.map((event) => event.atCompartment === null ? event : { ...event, atCompartment: remapAnchor(event.atCompartment) }),
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getCompartments,
|
|
10
10
|
getLastCompartmentEndMessage,
|
|
11
11
|
requestPendingMaterialization
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-anwy2mfb.js";
|
|
13
13
|
import {
|
|
14
14
|
inRootAsyncContext2
|
|
15
15
|
} from "./index-gzy5w8ya.js";
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
releaseWrapupInProgress,
|
|
21
21
|
getHistorianFailureState,
|
|
22
22
|
clearEmergencyRecovery
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-901exj0f.js";
|
|
24
24
|
import {
|
|
25
25
|
prepareRawSessionOrdinals2
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-5y9w2ax7.js";
|
|
27
27
|
import {
|
|
28
28
|
pushNotification2
|
|
29
29
|
} from "./index-y14pawe1.js";
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
getActiveCompartmentRun,
|
|
36
36
|
markActiveCompartmentRunPublished,
|
|
37
37
|
registerActiveCompartmentRun
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-3f3d548g.js";
|
|
39
39
|
import {
|
|
40
40
|
sendStatusNotification2
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-9ffntwyr.js";
|
|
42
42
|
import {
|
|
43
43
|
setRecompStarting2,
|
|
44
44
|
setRecompTerminal2
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-5a9kwapd.js";
|
|
46
46
|
|
|
47
47
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
48
48
|
import * as crypto from "node:crypto";
|