@cortexkit/opencode-magic-context 0.41.2 → 0.41.3
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/README.md +9 -3
- package/dist/announcement-3c1vertn.js +14 -0
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +756 -4
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/conflict-warning-hook-z5sd697e.js +16 -0
- package/dist/derive-budgets-901a0pk0.js +11 -0
- package/dist/features/magic-context/compartment-lease.d.ts +6 -0
- package/dist/features/magic-context/compartment-lease.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +18 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +11 -12
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-subagent-invocations.d.ts +3 -2
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +6 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +2 -2
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts +2 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +6 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts +2 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +4 -3
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +6 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +2 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +11 -4
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts +6 -1
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +15 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +10 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +6 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts +5 -16
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +32 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-y1yr57fw.js → index-0bycg0np.js} +18 -18
- package/dist/{index-1yh8g550.js → index-22jkk6wg.js} +2 -15
- package/dist/{index-dmvy29z0.js → index-3wzdwt6p.js} +11 -15
- package/dist/{index-d1mxrd3p.js → index-7k55qm8a.js} +17 -12
- package/dist/{index-4x691bz5.js → index-dkv2dn46.js} +5 -2
- package/dist/{index-cvda5jb3.js → index-dn1rwpd8.js} +11 -11
- package/dist/{index-rgdqj8nj.js → index-e7vx3byk.js} +1 -1
- package/dist/{index-szf8w1p5.js → index-fmsr7v69.js} +2 -2
- package/dist/{index-d62ypazr.js → index-jdxxq8cz.js} +6 -11
- package/dist/{index-9j3tx8hy.js → index-may8skc8.js} +6 -25
- package/dist/{index-eq9wr75c.js → index-npx8vhmy.js} +57 -108
- package/dist/{index-zwjhba2r.js → index-q264erdp.js} +122 -41
- package/dist/{index-b9j85d29.js → index-raatkvw5.js} +49 -11
- package/dist/{index-9xexf8s7.js → index-rn7gafjr.js} +1 -9
- package/dist/index-v6t0tg85.js +13 -0
- package/dist/{index-j8r0ejb3.js → index-vmmjdpc0.js} +1694 -11167
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2149 -1799
- package/dist/model-resolution-dxatzjde.js +12 -0
- package/dist/{index-dynqfgx1.js → module-asyncify-2EFITU5U-rkqjhjxd.js} +69 -8
- package/dist/plugin/boot-deadline.d.ts +47 -0
- package/dist/plugin/boot-deadline.d.ts.map +1 -0
- package/dist/plugin/conflict-warning-hook.d.ts +10 -0
- package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/prompt-context-5y5ms8f9.js +6 -0
- package/dist/recomp-orchestrator-f5m2wk74.js +19 -0
- package/dist/rpc-notifications-4amf6mf4.js +14 -0
- package/dist/{index-vnz6jvdc.js → safe-notification-target-q9z81zt3.js} +4 -3
- package/dist/send-session-notification-hdh02wy9.js +16 -0
- package/dist/shared/conflict-detector.d.ts +3 -1
- package/dist/shared/conflict-detector.d.ts.map +1 -1
- package/dist/shared/harness.d.ts +3 -3
- package/dist/shared/harness.d.ts.map +1 -1
- package/dist/shared/model-resolution.d.ts +3 -3
- package/dist/shared/model-resolution.d.ts.map +1 -1
- package/dist/shared/prompt-surface-runtime.d.ts +2 -2
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/transcript.d.ts +2 -1
- package/dist/shared/transcript.d.ts.map +1 -1
- package/dist/storage-meta-session-3rxx9ekm.js +20 -0
- package/dist/task-config-hnv93r7p.js +9 -0
- package/dist/transformers-node-wasm.js +328 -328
- package/dist/transformers-web.js +72 -72
- package/dist/{transformers.node-b1wa0hgx.js → transformers.node-dpmf3wpx.js} +74 -74
- package/package.json +1 -1
- package/src/config/index.test.ts +28 -0
- package/src/config/project-security.hostile-matrix.test.ts +78 -9
- package/src/config/project-security.ts +4 -3
- package/src/config/schema/magic-context.test.ts +64 -0
- package/src/config/schema/magic-context.ts +100 -6
- package/src/shared/conflict-detector.test.ts +24 -0
- package/src/shared/conflict-detector.ts +25 -7
- package/src/shared/harness.ts +3 -3
- package/src/shared/model-resolution.test.ts +61 -0
- package/src/shared/model-resolution.ts +14 -5
- package/src/shared/prompt-surface-runtime.ts +3 -3
- package/src/shared/tag-transcript.ts +11 -0
- package/src/shared/transcript.ts +3 -1
- package/dist/announcement-3g9xg433.js +0 -18
- package/dist/conflict-warning-hook-rf17b6et.js +0 -17
- package/dist/derive-budgets-9q2d3r93.js +0 -14
- package/dist/emscripten-module-49k43zfy.js +0 -507
- package/dist/emscripten-module-ex4v0x4z.js +0 -606
- package/dist/emscripten-module-jfs3d1dq.js +0 -1536
- package/dist/emscripten-module-ss4g4spn.js +0 -4563
- package/dist/ffi-bbm9vkfa.js +0 -92
- package/dist/ffi-kb5r0x1j.js +0 -92
- package/dist/ffi-qnrt0y78.js +0 -80
- package/dist/ffi-yx2hpf4p.js +0 -80
- package/dist/index-8sseka65.js +0 -251
- package/dist/index-ss632za9.js +0 -77
- package/dist/model-resolution-6w6wzw18.js +0 -17
- package/dist/module-ES6BEMUI-1yjdz59c.js +0 -14
- package/dist/module-asyncify-2EFITU5U-fdkx4fhy.js +0 -9
- package/dist/prompt-context-29qkb28f.js +0 -7
- package/dist/recomp-orchestrator-m37p3fq6.js +0 -34
- package/dist/rpc-notifications-1ffm755w.js +0 -17
- package/dist/safe-notification-target-2a8py95v.js +0 -11
- package/dist/send-session-notification-bw7eex6w.js +0 -20
- package/dist/storage-meta-session-dse3qv6s.js +0 -23
- package/dist/task-config-gv6s04fp.js +0 -18
- /package/dist/{index-37yzyeca.js → index-3fe78beq.js} +0 -0
- /package/dist/{index-8mtsfhyg.js → index-jfpk81yt.js} +0 -0
- /package/dist/{index-2wchnyk6.js → index-kby1sng5.js} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./index-
|
|
2
|
+
log
|
|
3
|
+
} from "./index-dkv2dn46.js";
|
|
4
4
|
import {
|
|
5
5
|
withReadOnlySessionDb
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-raatkvw5.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./index-
|
|
8
|
+
piModelRefToCanonical
|
|
9
|
+
} from "./index-kby1sng5.js";
|
|
10
10
|
import {
|
|
11
11
|
getHarness
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-3fe78beq.js";
|
|
13
13
|
|
|
14
14
|
// src/features/magic-context/storage-meta-session.ts
|
|
15
15
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
@@ -429,11 +429,11 @@ function deleteSessionScopedRows(db, sessionIds, harness, options = {}) {
|
|
|
429
429
|
return 0;
|
|
430
430
|
let deletableSessionIds = [...sessionIds];
|
|
431
431
|
if (options.rustModuleCleanupAcknowledged !== true) {
|
|
432
|
-
const
|
|
432
|
+
const placeholders = sessionIds.map(() => "?").join(", ");
|
|
433
433
|
const harnessPredicate = harness === undefined ? "" : " AND harness = ?";
|
|
434
434
|
const protectedRows = db.prepare(`SELECT session_id
|
|
435
435
|
FROM pending_session_cleanup
|
|
436
|
-
WHERE session_id IN (${
|
|
436
|
+
WHERE session_id IN (${placeholders})
|
|
437
437
|
AND harness LIKE '%:rust'${harnessPredicate}`).all(...sessionIds, ...harness === undefined ? [] : [`${harness}:rust`]);
|
|
438
438
|
const protectedSessionIds = new Set(protectedRows.map((row) => row.session_id));
|
|
439
439
|
deletableSessionIds = sessionIds.filter((sessionId) => !protectedSessionIds.has(sessionId));
|
|
@@ -511,7 +511,7 @@ function getSessionMetaSelectColumns(db) {
|
|
|
511
511
|
sessionMetaSelectColumnsCache.set(db, projection);
|
|
512
512
|
return projection;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function getOrCreateSessionMeta2(db, sessionId) {
|
|
515
515
|
const result = db.prepare(`SELECT ${getSessionMetaSelectColumns(db)} FROM session_meta WHERE session_id = ?`).get(sessionId);
|
|
516
516
|
if (isSessionMetaRow(result)) {
|
|
517
517
|
return toSessionMeta(result);
|
|
@@ -527,7 +527,7 @@ function getOrCreateSessionMeta(db, sessionId) {
|
|
|
527
527
|
}
|
|
528
528
|
return defaults;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function updateSessionMeta2(db, sessionId, updates) {
|
|
531
531
|
const setClauses = [];
|
|
532
532
|
const values = [];
|
|
533
533
|
for (const [key, column] of Object.entries(META_COLUMNS)) {
|
|
@@ -556,7 +556,7 @@ function updateSessionMeta(db, sessionId, updates) {
|
|
|
556
556
|
db.prepare(`UPDATE session_meta SET ${setClauses.join(", ")} WHERE session_id = ?`).run(...values, sessionId);
|
|
557
557
|
})();
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function advanceToolReclaimWatermark2(db, sessionId, maxTagNumber) {
|
|
560
560
|
if (maxTagNumber <= 0)
|
|
561
561
|
return;
|
|
562
562
|
db.transaction(() => {
|
|
@@ -567,7 +567,7 @@ function advanceToolReclaimWatermark(db, sessionId, maxTagNumber) {
|
|
|
567
567
|
function rustCleanupHarness() {
|
|
568
568
|
return `${getHarness()}:rust`;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function markSessionCleanupPending2(db, sessionId, rustModuleCleanupRequired = false) {
|
|
571
571
|
const row = db.prepare(`INSERT INTO pending_session_cleanup (session_id, harness, requested_at, last_attempt_at)
|
|
572
572
|
VALUES (?, ?, ?, NULL)
|
|
573
573
|
ON CONFLICT(session_id) DO UPDATE SET
|
|
@@ -580,7 +580,7 @@ function markSessionCleanupPending(db, sessionId, rustModuleCleanupRequired = fa
|
|
|
580
580
|
RETURNING harness`).get(sessionId, rustModuleCleanupRequired ? rustCleanupHarness() : getHarness(), Date.now());
|
|
581
581
|
return row.harness.endsWith(":rust");
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function retryPendingSessionCleanups2(db, limit = 200) {
|
|
584
584
|
const rows = db.prepare(`SELECT session_id
|
|
585
585
|
FROM pending_session_cleanup
|
|
586
586
|
WHERE harness NOT LIKE '%:rust'
|
|
@@ -591,7 +591,7 @@ function retryPendingSessionCleanups(db, limit = 200) {
|
|
|
591
591
|
for (const row of rows) {
|
|
592
592
|
try {
|
|
593
593
|
db.prepare("UPDATE pending_session_cleanup SET last_attempt_at = ? WHERE session_id = ?").run(Date.now(), row.session_id);
|
|
594
|
-
|
|
594
|
+
clearSession2(db, row.session_id);
|
|
595
595
|
cleared += 1;
|
|
596
596
|
} catch {
|
|
597
597
|
failedSessionIds.push(row.session_id);
|
|
@@ -599,7 +599,7 @@ function retryPendingSessionCleanups(db, limit = 200) {
|
|
|
599
599
|
}
|
|
600
600
|
return { attempted: rows.length, cleared, failedSessionIds };
|
|
601
601
|
}
|
|
602
|
-
async function
|
|
602
|
+
async function retryPendingRustSessionCleanupsForProject2(db, projectPath, deleteSession, limit = 200) {
|
|
603
603
|
const harness = getHarness();
|
|
604
604
|
const rows = db.prepare(`SELECT pending.session_id
|
|
605
605
|
FROM pending_session_cleanup pending
|
|
@@ -616,7 +616,7 @@ async function retryPendingRustSessionCleanupsForProject(db, projectPath, delete
|
|
|
616
616
|
try {
|
|
617
617
|
db.prepare("UPDATE pending_session_cleanup SET last_attempt_at = ? WHERE session_id = ?").run(Date.now(), row.session_id);
|
|
618
618
|
await deleteSession(row.session_id);
|
|
619
|
-
|
|
619
|
+
clearSession2(db, row.session_id, true);
|
|
620
620
|
cleared += 1;
|
|
621
621
|
} catch {
|
|
622
622
|
failedSessionIds.push(row.session_id);
|
|
@@ -624,7 +624,7 @@ async function retryPendingRustSessionCleanupsForProject(db, projectPath, delete
|
|
|
624
624
|
}
|
|
625
625
|
return { attempted: rows.length, cleared, failedSessionIds };
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function clearSession2(db, sessionId, rustModuleCleanupAcknowledged = false) {
|
|
628
628
|
const transactionStartedAt = performance.now();
|
|
629
629
|
db.transaction(() => {
|
|
630
630
|
deleteSessionScopedRows(db, [sessionId], undefined, {
|
|
@@ -634,4 +634,4 @@ function clearSession(db, sessionId, rustModuleCleanupAcknowledged = false) {
|
|
|
634
634
|
logSlowWriteTransaction("clear-session", transactionStartedAt);
|
|
635
635
|
}
|
|
636
636
|
|
|
637
|
-
export { logSlowWriteTransaction, ensureSessionMetaRow, persistCachedM0, clearCachedM0M1, SESSION_SCOPED_TABLES, deleteSessionScopedRows,
|
|
637
|
+
export { logSlowWriteTransaction, ensureSessionMetaRow, persistCachedM0, clearCachedM0M1, SESSION_SCOPED_TABLES, deleteSessionScopedRows, getOrCreateSessionMeta2, updateSessionMeta2, advanceToolReclaimWatermark2, markSessionCleanupPending2, retryPendingSessionCleanups2, retryPendingRustSessionCleanupsForProject2, clearSession2 };
|
|
@@ -18,7 +18,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
18
18
|
return cached;
|
|
19
19
|
}
|
|
20
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
22
|
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
23
23
|
for (let key of __getOwnPropNames(mod))
|
|
24
24
|
if (!__hasOwnProp.call(to, key))
|
|
@@ -32,19 +32,6 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
32
32
|
return to;
|
|
33
33
|
};
|
|
34
34
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
35
|
-
var __returnValue = (v) => v;
|
|
36
|
-
function __exportSetter(name, newValue) {
|
|
37
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
38
|
-
}
|
|
39
|
-
var __export = (target, all) => {
|
|
40
|
-
for (var name in all)
|
|
41
|
-
__defProp(target, name, {
|
|
42
|
-
get: all[name],
|
|
43
|
-
enumerable: true,
|
|
44
|
-
configurable: true,
|
|
45
|
-
set: __exportSetter.bind(all, name)
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
35
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
49
36
|
|
|
50
|
-
export { __toESM, __commonJS,
|
|
37
|
+
export { __toESM, __commonJS, __require };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getMagicContextStorageDir
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-3fe78beq.js";
|
|
4
4
|
|
|
5
5
|
// src/shared/announcement.ts
|
|
6
6
|
import * as fs from "node:fs";
|
|
@@ -20,14 +20,14 @@ function compareSemverCore(a, b) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// src/shared/announcement.ts
|
|
23
|
-
var
|
|
24
|
-
var
|
|
23
|
+
var ANNOUNCEMENT_VERSION2 = "0.31.0";
|
|
24
|
+
var ANNOUNCEMENT_FEATURES2 = [
|
|
25
25
|
"New /ctx-wrapup command: compact older history on demand, keeping the newest N messages raw. Run it before switching to a smaller-context model.",
|
|
26
26
|
"ctx_search now also searches your session notes and smart notes.",
|
|
27
27
|
"Project identity now survives transient git failures (slow disks, dubious ownership) without splitting your project memory.",
|
|
28
28
|
"Removed the ctx_reduce_enabled setting; agent-controlled reduction is always on. Caveman text compression is now independent (caveman_text_compression.enabled)."
|
|
29
29
|
];
|
|
30
|
-
var
|
|
30
|
+
var ANNOUNCEMENT_FOOTER2 = "Join us on Discord: https://discord.gg/F2uWxjGnU";
|
|
31
31
|
var STATE_FILENAME = "last_announced_version";
|
|
32
32
|
function getStateFilePath() {
|
|
33
33
|
return path.join(getMagicContextStorageDir(), STATE_FILENAME);
|
|
@@ -45,11 +45,7 @@ function readAnnouncementState() {
|
|
|
45
45
|
return { status: "error" };
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const state = readAnnouncementState();
|
|
50
|
-
return state.status === "valid" ? state.version : "";
|
|
51
|
-
}
|
|
52
|
-
function markAnnouncementSeen(version) {
|
|
48
|
+
function markAnnouncementSeen2(version) {
|
|
53
49
|
if (!version)
|
|
54
50
|
return;
|
|
55
51
|
try {
|
|
@@ -58,22 +54,22 @@ function markAnnouncementSeen(version) {
|
|
|
58
54
|
fs.writeFileSync(getStateFilePath(), version);
|
|
59
55
|
} catch {}
|
|
60
56
|
}
|
|
61
|
-
function
|
|
62
|
-
if (!
|
|
57
|
+
function shouldShowAnnouncement2() {
|
|
58
|
+
if (!ANNOUNCEMENT_VERSION2 || ANNOUNCEMENT_FEATURES2.length === 0)
|
|
63
59
|
return false;
|
|
64
60
|
const state = readAnnouncementState();
|
|
65
61
|
if (state.status === "missing") {
|
|
66
|
-
|
|
62
|
+
markAnnouncementSeen2(ANNOUNCEMENT_VERSION2);
|
|
67
63
|
return false;
|
|
68
64
|
}
|
|
69
65
|
if (state.status === "error") {
|
|
70
66
|
return false;
|
|
71
67
|
}
|
|
72
|
-
const ordering = compareSemverCore(
|
|
68
|
+
const ordering = compareSemverCore(ANNOUNCEMENT_VERSION2, state.version);
|
|
73
69
|
if (ordering === null) {
|
|
74
|
-
return state.version !==
|
|
70
|
+
return state.version !== ANNOUNCEMENT_VERSION2;
|
|
75
71
|
}
|
|
76
72
|
return ordering > 0;
|
|
77
73
|
}
|
|
78
74
|
|
|
79
|
-
export { isValidSemver, compareSemverCore,
|
|
75
|
+
export { isValidSemver, compareSemverCore, ANNOUNCEMENT_VERSION2, ANNOUNCEMENT_FEATURES2, ANNOUNCEMENT_FOOTER2, markAnnouncementSeen2, shouldShowAnnouncement2 };
|
|
@@ -11,10 +11,14 @@ function readString(value) {
|
|
|
11
11
|
function hasOwn(record, key) {
|
|
12
12
|
return Object.hasOwn(record, key);
|
|
13
13
|
}
|
|
14
|
+
function resolveHarnessBlock(container, harness) {
|
|
15
|
+
const selected = harness === "omp" ? container?.omp ?? container?.pi : container?.[harness];
|
|
16
|
+
return asRecord(selected);
|
|
17
|
+
}
|
|
14
18
|
function normalizeModelEntry(entry, harness) {
|
|
15
19
|
if (typeof entry === "string") {
|
|
16
|
-
const
|
|
17
|
-
return
|
|
20
|
+
const model = readString(entry);
|
|
21
|
+
return model ? { model } : undefined;
|
|
18
22
|
}
|
|
19
23
|
const objectEntry = asRecord(entry);
|
|
20
24
|
if (!objectEntry)
|
|
@@ -35,8 +39,8 @@ function sameAttempt(a, b) {
|
|
|
35
39
|
function resolveFallbackEntries(value, harness) {
|
|
36
40
|
const values = Array.isArray(value) ? value : value === undefined ? [] : [value];
|
|
37
41
|
const resolved = [];
|
|
38
|
-
for (const
|
|
39
|
-
const entry = normalizeModelEntry(
|
|
42
|
+
for (const value of values) {
|
|
43
|
+
const entry = normalizeModelEntry(value, harness);
|
|
40
44
|
if (!entry || !isValidModelReference(entry))
|
|
41
45
|
continue;
|
|
42
46
|
if (resolved.some((candidate) => sameAttempt(candidate, entry)))
|
|
@@ -52,9 +56,9 @@ function resolvePrimaryEntry(args) {
|
|
|
52
56
|
const qualifier = entry.qualifier ?? readString(args.defaultQualifier);
|
|
53
57
|
return qualifier ? { ...entry, qualifier } : entry;
|
|
54
58
|
}
|
|
55
|
-
function
|
|
59
|
+
function resolveHistorianModel2(config, harness) {
|
|
56
60
|
const historian = asRecord(asRecord(config)?.historian);
|
|
57
|
-
const block =
|
|
61
|
+
const block = resolveHarnessBlock(historian, harness);
|
|
58
62
|
if (!block)
|
|
59
63
|
return { fallbacks: [] };
|
|
60
64
|
return {
|
|
@@ -66,9 +70,9 @@ function resolveHistorianModel(config, harness) {
|
|
|
66
70
|
fallbacks: resolveFallbackEntries(block.fallback_models, harness)
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
|
-
function
|
|
73
|
+
function resolveDreamerTaskModel2(args) {
|
|
70
74
|
const dreamer = asRecord(asRecord(args.config)?.dreamer);
|
|
71
|
-
const harnessBlock =
|
|
75
|
+
const harnessBlock = resolveHarnessBlock(dreamer, args.harness);
|
|
72
76
|
const taskBlock = asRecord(asRecord(harnessBlock?.tasks)?.[args.task]);
|
|
73
77
|
const schedulingTask = asRecord(asRecord(dreamer?.tasks)?.[args.task]);
|
|
74
78
|
if (!harnessBlock) {
|
|
@@ -97,7 +101,7 @@ function resolveDreamerTaskModel(args) {
|
|
|
97
101
|
promotionThreshold: typeof schedulingTask?.promotion_threshold === "number" ? schedulingTask.promotion_threshold : undefined
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
|
-
function
|
|
104
|
+
function resolveOpenCodeAgentOverrides2(agent) {
|
|
101
105
|
const source = asRecord(agent);
|
|
102
106
|
if (!source)
|
|
103
107
|
return {};
|
|
@@ -108,6 +112,7 @@ function resolveOpenCodeAgentOverrides(agent) {
|
|
|
108
112
|
thinking_level: _thinking,
|
|
109
113
|
opencode,
|
|
110
114
|
pi,
|
|
115
|
+
omp,
|
|
111
116
|
tasks,
|
|
112
117
|
...rest
|
|
113
118
|
} = source;
|
|
@@ -122,11 +127,11 @@ function resolveOpenCodeAgentOverrides(agent) {
|
|
|
122
127
|
...primary?.qualifier ? { variant: primary.qualifier } : {}
|
|
123
128
|
};
|
|
124
129
|
}
|
|
125
|
-
function
|
|
130
|
+
function resolveHistorianAgentOverrides2(agent) {
|
|
126
131
|
return {
|
|
127
132
|
maxTokens: 32000,
|
|
128
|
-
...
|
|
133
|
+
...resolveOpenCodeAgentOverrides2(agent)
|
|
129
134
|
};
|
|
130
135
|
}
|
|
131
136
|
|
|
132
|
-
export {
|
|
137
|
+
export { resolveHistorianModel2, resolveDreamerTaskModel2, resolveOpenCodeAgentOverrides2, resolveHistorianAgentOverrides2 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getMagicContextLogPath
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-3fe78beq.js";
|
|
4
4
|
|
|
5
5
|
// src/shared/logger.ts
|
|
6
6
|
import * as fs from "node:fs";
|
|
@@ -362,8 +362,11 @@ function getLoggerDiagnostics() {
|
|
|
362
362
|
lastErrorTime
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
|
+
function flushLogger() {
|
|
366
|
+
flush();
|
|
367
|
+
}
|
|
365
368
|
if (!isTestEnv) {
|
|
366
369
|
process.on("exit", flush);
|
|
367
370
|
}
|
|
368
371
|
|
|
369
|
-
export { sanitizeDiagnosticText, hasShareabilitySensitiveText, log, sessionLog, getLoggerDiagnostics };
|
|
372
|
+
export { sanitizeDiagnosticText, hasShareabilitySensitiveText, log, sessionLog, getLoggerDiagnostics, flushLogger };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
modelRefLookupOrder
|
|
3
|
-
} from "./index-2wchnyk6.js";
|
|
4
1
|
import {
|
|
5
2
|
sessionLog
|
|
6
|
-
} from "./index-
|
|
3
|
+
} from "./index-dkv2dn46.js";
|
|
4
|
+
import {
|
|
5
|
+
modelRefLookupOrder
|
|
6
|
+
} from "./index-kby1sng5.js";
|
|
7
7
|
import {
|
|
8
|
-
getDataDir,
|
|
9
8
|
getHarness,
|
|
9
|
+
getDataDir,
|
|
10
10
|
getMagicContextStorageDir
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-3fe78beq.js";
|
|
12
12
|
|
|
13
13
|
// src/shared/models-dev-cache.ts
|
|
14
14
|
import { mkdirSync, readFileSync as readFileSync2, renameSync, writeFileSync } from "node:fs";
|
|
@@ -554,7 +554,7 @@ function setCachedModelMetadata(cache, key, model) {
|
|
|
554
554
|
if (rawLimit === undefined)
|
|
555
555
|
return;
|
|
556
556
|
const values = [model?.capabilities, model?.modalities, model?.input, model?.attachment];
|
|
557
|
-
const vision = values.some((
|
|
557
|
+
const vision = values.some((value) => JSON.stringify(value ?? "").toLowerCase().includes("image") || JSON.stringify(value ?? "").toLowerCase().includes("vision"));
|
|
558
558
|
const value = {
|
|
559
559
|
limit: rawLimit,
|
|
560
560
|
contextLimit: isSaneLimit(contextLimit) ? contextLimit : undefined,
|
|
@@ -702,7 +702,7 @@ var HISTORIAN_CHUNK_PERCENTAGE = 0.25;
|
|
|
702
702
|
var HISTORIAN_CHUNK_MIN = 8000;
|
|
703
703
|
var HISTORIAN_CHUNK_MAX = 50000;
|
|
704
704
|
var DEFAULT_HISTORIAN_CONTEXT_FALLBACK = 128000;
|
|
705
|
-
function
|
|
705
|
+
function deriveTriggerBudget2(mainContextLimit, executeThresholdPercentage) {
|
|
706
706
|
if (!Number.isFinite(mainContextLimit) || mainContextLimit <= 0) {
|
|
707
707
|
return TRIGGER_BUDGET_MIN;
|
|
708
708
|
}
|
|
@@ -711,14 +711,14 @@ function deriveTriggerBudget(mainContextLimit, executeThresholdPercentage) {
|
|
|
711
711
|
const derived = Math.round(usable * TRIGGER_BUDGET_PERCENTAGE);
|
|
712
712
|
return Math.max(TRIGGER_BUDGET_MIN, Math.min(TRIGGER_BUDGET_MAX, derived));
|
|
713
713
|
}
|
|
714
|
-
function
|
|
714
|
+
function deriveHistorianChunkTokens2(historianContextLimit) {
|
|
715
715
|
if (!Number.isFinite(historianContextLimit) || historianContextLimit <= 0) {
|
|
716
716
|
return HISTORIAN_CHUNK_MIN;
|
|
717
717
|
}
|
|
718
718
|
const derived = Math.round(historianContextLimit * HISTORIAN_CHUNK_PERCENTAGE);
|
|
719
719
|
return Math.max(HISTORIAN_CHUNK_MIN, Math.min(HISTORIAN_CHUNK_MAX, derived));
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function resolveHistorianContextLimit2(historianModelOverride) {
|
|
722
722
|
if (typeof historianModelOverride === "string" && historianModelOverride.includes("/")) {
|
|
723
723
|
const [providerID, ...rest] = historianModelOverride.split("/");
|
|
724
724
|
const modelID = rest.join("/");
|
|
@@ -735,4 +735,4 @@ function resolveHistorianContextLimit(historianModelOverride) {
|
|
|
735
735
|
return DEFAULT_HISTORIAN_CONTEXT_FALLBACK;
|
|
736
736
|
}
|
|
737
737
|
|
|
738
|
-
export { setStoragePrivatePermissionEnforcement, shouldEnforcePrivateStoragePermissions, setWindowOverlayPath, reloadWindowOverlay, formatWindowDerivationLine, isSaneLimit, setOutputReserveConfig, refreshModelLimitsFromApi, refreshModelLimitsAfterAuthOnce, getSdkWindowGeometry, getSdkContextLimit, modelSupportsVision,
|
|
738
|
+
export { setStoragePrivatePermissionEnforcement, shouldEnforcePrivateStoragePermissions, setWindowOverlayPath, reloadWindowOverlay, formatWindowDerivationLine, isSaneLimit, setOutputReserveConfig, refreshModelLimitsFromApi, refreshModelLimitsAfterAuthOnce, getSdkWindowGeometry, getSdkContextLimit, modelSupportsVision, deriveTriggerBudget2, deriveHistorianChunkTokens2, resolveHistorianContextLimit2 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__commonJS,
|
|
3
3
|
__require
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-22jkk6wg.js";
|
|
5
5
|
|
|
6
6
|
// ../../node_modules/.bun/@jitl+quickjs-ffi-types@0.32.0/node_modules/@jitl/quickjs-ffi-types/dist/index.js
|
|
7
7
|
var require_dist = __commonJS(function(exports, module) {
|
|
@@ -40,7 +40,7 @@ function isComplete(ctx) {
|
|
|
40
40
|
return Boolean(ctx.agent && ctx.model && ctx.variant);
|
|
41
41
|
}
|
|
42
42
|
var PROMPT_CONTEXT_MESSAGE_LIMIT = 50;
|
|
43
|
-
async function
|
|
43
|
+
async function resolvePromptContext2(client, sessionId) {
|
|
44
44
|
if (!client || !sessionId)
|
|
45
45
|
return null;
|
|
46
46
|
const c = client;
|
|
@@ -72,4 +72,4 @@ async function resolvePromptContext(client, sessionId) {
|
|
|
72
72
|
return result;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export {
|
|
75
|
+
export { resolvePromptContext2 };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var queue = [];
|
|
3
3
|
var nextNotificationId = 1;
|
|
4
4
|
var sinks = new Set;
|
|
5
|
-
function
|
|
5
|
+
function registerNotificationSink2(sink) {
|
|
6
6
|
sinks.add(sink);
|
|
7
7
|
return () => {
|
|
8
8
|
sinks.delete(sink);
|
|
@@ -15,7 +15,7 @@ function notificationMatchesSink(notification, sink) {
|
|
|
15
15
|
return notification.sessionId === sink.sessionId;
|
|
16
16
|
return sink.protocol !== 2;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function pushNotification2(type, payload, sessionId) {
|
|
19
19
|
const notification = { id: nextNotificationId++, type, payload, sessionId };
|
|
20
20
|
queue.push(notification);
|
|
21
21
|
for (const sink of sinks) {
|
|
@@ -40,21 +40,16 @@ function pushNotification(type, payload, sessionId) {
|
|
|
40
40
|
queue.splice(evictionIndex >= 0 ? evictionIndex : 0, 1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function acknowledgeNotifications2(ids) {
|
|
44
44
|
const acknowledged = new Set(ids.filter((id) => Number.isSafeInteger(id) && id > 0));
|
|
45
45
|
if (acknowledged.size === 0)
|
|
46
46
|
return;
|
|
47
47
|
queue = queue.filter((notification) => !acknowledged.has(notification.id));
|
|
48
48
|
}
|
|
49
|
-
function __resetNotificationStateForTests() {
|
|
50
|
-
queue = [];
|
|
51
|
-
nextNotificationId = 1;
|
|
52
|
-
sinks.clear();
|
|
53
|
-
}
|
|
54
49
|
function cursor(value) {
|
|
55
50
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
56
51
|
}
|
|
57
|
-
function
|
|
52
|
+
function drainNotifications2(lastReceivedId = 0, sessionId, options = {}) {
|
|
58
53
|
const sessionCursor = cursor(lastReceivedId);
|
|
59
54
|
if (options.globalOnly) {
|
|
60
55
|
queue = queue.filter((notification) => notification.sessionId !== undefined || notification.id > sessionCursor);
|
|
@@ -87,7 +82,7 @@ function drainNotifications(lastReceivedId = 0, sessionId, options = {}) {
|
|
|
87
82
|
}
|
|
88
83
|
return queue.filter((notification) => notification.id > sessionCursor && matchesClient(notification));
|
|
89
84
|
}
|
|
90
|
-
function
|
|
85
|
+
function isTuiConnected2(sessionId) {
|
|
91
86
|
if (sinks.size === 0)
|
|
92
87
|
return false;
|
|
93
88
|
if (sessionId === undefined)
|
|
@@ -101,4 +96,4 @@ function isTuiConnected(sessionId) {
|
|
|
101
96
|
return false;
|
|
102
97
|
}
|
|
103
98
|
|
|
104
|
-
export {
|
|
99
|
+
export { registerNotificationSink2, pushNotification2, acknowledgeNotifications2, drainNotifications2, isTuiConnected2 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./index-
|
|
2
|
+
resolveDreamerTaskModel2
|
|
3
|
+
} from "./index-7k55qm8a.js";
|
|
4
4
|
|
|
5
5
|
// src/features/magic-context/dreamer/task-registry.ts
|
|
6
6
|
var CANONICAL_DREAM_TASKS = [
|
|
@@ -68,9 +68,9 @@ function compareTaskOrder(a, b) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// src/features/magic-context/dreamer/task-config.ts
|
|
71
|
-
function
|
|
71
|
+
function buildDreamTaskRuntimeConfigs2(dreamer, harness, language, muralModel) {
|
|
72
72
|
return CANONICAL_DREAM_TASKS.map((task) => {
|
|
73
|
-
const resolved =
|
|
73
|
+
const resolved = resolveDreamerTaskModel2({
|
|
74
74
|
config: { dreamer },
|
|
75
75
|
harness,
|
|
76
76
|
task,
|
|
@@ -88,27 +88,8 @@ function buildDreamTaskRuntimeConfigs(dreamer, harness, language, muralModel) {
|
|
|
88
88
|
};
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function userMemoryCollectionEnabled2(dreamer) {
|
|
92
92
|
const schedule = dreamer?.tasks?.["review-user-memories"]?.schedule;
|
|
93
93
|
return typeof schedule === "string" && schedule.trim() !== "";
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
return dreamer?.tasks?.["review-user-memories"]?.promotion_threshold ?? 3;
|
|
97
|
-
}
|
|
98
|
-
function dreamTaskScheduled(dreamer, task) {
|
|
99
|
-
const schedule = dreamer?.tasks?.[task]?.schedule;
|
|
100
|
-
return typeof schedule === "string" && schedule.trim() !== "";
|
|
101
|
-
}
|
|
102
|
-
function enabledDreamTasks(dreamer) {
|
|
103
|
-
if (!dreamer?.tasks)
|
|
104
|
-
return [];
|
|
105
|
-
return CANONICAL_DREAM_TASKS.filter((t) => dreamer.tasks[t]?.schedule?.trim());
|
|
106
|
-
}
|
|
107
|
-
function summarizeDreamSchedule(dreamer) {
|
|
108
|
-
const enabled = enabledDreamTasks(dreamer);
|
|
109
|
-
if (enabled.length === 0)
|
|
110
|
-
return "manual-only";
|
|
111
|
-
return enabled.map((t) => `${t} ${dreamer?.tasks[t]?.schedule}`).join(", ");
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { CANONICAL_DREAM_TASKS, formatDreamTaskBacklogs, processedDreamTaskItems, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs, userMemoryCollectionEnabled, userMemoryPromotionThreshold, dreamTaskScheduled, enabledDreamTasks, summarizeDreamSchedule };
|
|
95
|
+
export { CANONICAL_DREAM_TASKS, formatDreamTaskBacklogs, processedDreamTaskItems, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs2, userMemoryCollectionEnabled2 };
|