@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.
Files changed (138) hide show
  1. package/README.md +9 -3
  2. package/dist/announcement-3c1vertn.js +14 -0
  3. package/dist/config/project-security.d.ts.map +1 -1
  4. package/dist/config/schema/magic-context.d.ts +756 -4
  5. package/dist/config/schema/magic-context.d.ts.map +1 -1
  6. package/dist/conflict-warning-hook-z5sd697e.js +16 -0
  7. package/dist/derive-budgets-901a0pk0.js +11 -0
  8. package/dist/features/magic-context/compartment-lease.d.ts +6 -0
  9. package/dist/features/magic-context/compartment-lease.d.ts.map +1 -1
  10. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  11. package/dist/features/magic-context/storage-db.d.ts +18 -1
  12. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  13. package/dist/features/magic-context/storage-meta-persisted.d.ts +11 -12
  14. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  15. package/dist/features/magic-context/storage-meta.d.ts +1 -1
  16. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  17. package/dist/features/magic-context/storage-subagent-invocations.d.ts +3 -2
  18. package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
  19. package/dist/features/magic-context/storage-tags.d.ts +6 -0
  20. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  21. package/dist/features/magic-context/storage.d.ts +2 -2
  22. package/dist/features/magic-context/storage.d.ts.map +1 -1
  23. package/dist/features/magic-context/subagent-token-capture.d.ts +2 -1
  24. package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
  25. package/dist/hooks/magic-context/compaction-marker-manager.d.ts +6 -1
  26. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
  27. package/dist/hooks/magic-context/compartment-runner.d.ts +2 -1
  28. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/hook.d.ts +4 -3
  30. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/inject-compartments.d.ts +6 -0
  32. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  33. package/dist/hooks/magic-context/module-state-sync.d.ts +2 -1
  34. package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/module-transport.d.ts +11 -4
  36. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/module-wire.d.ts +6 -1
  38. package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/read-session-db.d.ts +15 -0
  40. package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/rust-mode-transform.d.ts +10 -0
  42. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/send-session-notification.d.ts +6 -0
  44. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/sentinel.d.ts +5 -16
  46. package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +32 -0
  49. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  51. package/dist/{index-y1yr57fw.js → index-0bycg0np.js} +18 -18
  52. package/dist/{index-1yh8g550.js → index-22jkk6wg.js} +2 -15
  53. package/dist/{index-dmvy29z0.js → index-3wzdwt6p.js} +11 -15
  54. package/dist/{index-d1mxrd3p.js → index-7k55qm8a.js} +17 -12
  55. package/dist/{index-4x691bz5.js → index-dkv2dn46.js} +5 -2
  56. package/dist/{index-cvda5jb3.js → index-dn1rwpd8.js} +11 -11
  57. package/dist/{index-rgdqj8nj.js → index-e7vx3byk.js} +1 -1
  58. package/dist/{index-szf8w1p5.js → index-fmsr7v69.js} +2 -2
  59. package/dist/{index-d62ypazr.js → index-jdxxq8cz.js} +6 -11
  60. package/dist/{index-9j3tx8hy.js → index-may8skc8.js} +6 -25
  61. package/dist/{index-eq9wr75c.js → index-npx8vhmy.js} +57 -108
  62. package/dist/{index-zwjhba2r.js → index-q264erdp.js} +122 -41
  63. package/dist/{index-b9j85d29.js → index-raatkvw5.js} +49 -11
  64. package/dist/{index-9xexf8s7.js → index-rn7gafjr.js} +1 -9
  65. package/dist/index-v6t0tg85.js +13 -0
  66. package/dist/{index-j8r0ejb3.js → index-vmmjdpc0.js} +1694 -11167
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +2149 -1799
  69. package/dist/model-resolution-dxatzjde.js +12 -0
  70. package/dist/{index-dynqfgx1.js → module-asyncify-2EFITU5U-rkqjhjxd.js} +69 -8
  71. package/dist/plugin/boot-deadline.d.ts +47 -0
  72. package/dist/plugin/boot-deadline.d.ts.map +1 -0
  73. package/dist/plugin/conflict-warning-hook.d.ts +10 -0
  74. package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
  75. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
  76. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  77. package/dist/plugin/messages-transform.d.ts.map +1 -1
  78. package/dist/prompt-context-5y5ms8f9.js +6 -0
  79. package/dist/recomp-orchestrator-f5m2wk74.js +19 -0
  80. package/dist/rpc-notifications-4amf6mf4.js +14 -0
  81. package/dist/{index-vnz6jvdc.js → safe-notification-target-q9z81zt3.js} +4 -3
  82. package/dist/send-session-notification-hdh02wy9.js +16 -0
  83. package/dist/shared/conflict-detector.d.ts +3 -1
  84. package/dist/shared/conflict-detector.d.ts.map +1 -1
  85. package/dist/shared/harness.d.ts +3 -3
  86. package/dist/shared/harness.d.ts.map +1 -1
  87. package/dist/shared/model-resolution.d.ts +3 -3
  88. package/dist/shared/model-resolution.d.ts.map +1 -1
  89. package/dist/shared/prompt-surface-runtime.d.ts +2 -2
  90. package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
  91. package/dist/shared/tag-transcript.d.ts.map +1 -1
  92. package/dist/shared/transcript.d.ts +2 -1
  93. package/dist/shared/transcript.d.ts.map +1 -1
  94. package/dist/storage-meta-session-3rxx9ekm.js +20 -0
  95. package/dist/task-config-hnv93r7p.js +9 -0
  96. package/dist/transformers-node-wasm.js +328 -328
  97. package/dist/transformers-web.js +72 -72
  98. package/dist/{transformers.node-b1wa0hgx.js → transformers.node-dpmf3wpx.js} +74 -74
  99. package/package.json +1 -1
  100. package/src/config/index.test.ts +28 -0
  101. package/src/config/project-security.hostile-matrix.test.ts +78 -9
  102. package/src/config/project-security.ts +4 -3
  103. package/src/config/schema/magic-context.test.ts +64 -0
  104. package/src/config/schema/magic-context.ts +100 -6
  105. package/src/shared/conflict-detector.test.ts +24 -0
  106. package/src/shared/conflict-detector.ts +25 -7
  107. package/src/shared/harness.ts +3 -3
  108. package/src/shared/model-resolution.test.ts +61 -0
  109. package/src/shared/model-resolution.ts +14 -5
  110. package/src/shared/prompt-surface-runtime.ts +3 -3
  111. package/src/shared/tag-transcript.ts +11 -0
  112. package/src/shared/transcript.ts +3 -1
  113. package/dist/announcement-3g9xg433.js +0 -18
  114. package/dist/conflict-warning-hook-rf17b6et.js +0 -17
  115. package/dist/derive-budgets-9q2d3r93.js +0 -14
  116. package/dist/emscripten-module-49k43zfy.js +0 -507
  117. package/dist/emscripten-module-ex4v0x4z.js +0 -606
  118. package/dist/emscripten-module-jfs3d1dq.js +0 -1536
  119. package/dist/emscripten-module-ss4g4spn.js +0 -4563
  120. package/dist/ffi-bbm9vkfa.js +0 -92
  121. package/dist/ffi-kb5r0x1j.js +0 -92
  122. package/dist/ffi-qnrt0y78.js +0 -80
  123. package/dist/ffi-yx2hpf4p.js +0 -80
  124. package/dist/index-8sseka65.js +0 -251
  125. package/dist/index-ss632za9.js +0 -77
  126. package/dist/model-resolution-6w6wzw18.js +0 -17
  127. package/dist/module-ES6BEMUI-1yjdz59c.js +0 -14
  128. package/dist/module-asyncify-2EFITU5U-fdkx4fhy.js +0 -9
  129. package/dist/prompt-context-29qkb28f.js +0 -7
  130. package/dist/recomp-orchestrator-m37p3fq6.js +0 -34
  131. package/dist/rpc-notifications-1ffm755w.js +0 -17
  132. package/dist/safe-notification-target-2a8py95v.js +0 -11
  133. package/dist/send-session-notification-bw7eex6w.js +0 -20
  134. package/dist/storage-meta-session-dse3qv6s.js +0 -23
  135. package/dist/task-config-gv6s04fp.js +0 -18
  136. /package/dist/{index-37yzyeca.js → index-3fe78beq.js} +0 -0
  137. /package/dist/{index-8mtsfhyg.js → index-jfpk81yt.js} +0 -0
  138. /package/dist/{index-2wchnyk6.js → index-kby1sng5.js} +0 -0
@@ -1,15 +1,15 @@
1
1
  import {
2
- piModelRefToCanonical
3
- } from "./index-2wchnyk6.js";
2
+ log
3
+ } from "./index-dkv2dn46.js";
4
4
  import {
5
5
  withReadOnlySessionDb
6
- } from "./index-b9j85d29.js";
6
+ } from "./index-raatkvw5.js";
7
7
  import {
8
- log
9
- } from "./index-4x691bz5.js";
8
+ piModelRefToCanonical
9
+ } from "./index-kby1sng5.js";
10
10
  import {
11
11
  getHarness
12
- } from "./index-37yzyeca.js";
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 placeholders2 = sessionIds.map(() => "?").join(", ");
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 (${placeholders2})
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 getOrCreateSessionMeta(db, sessionId) {
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 updateSessionMeta(db, sessionId, updates) {
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 advanceToolReclaimWatermark(db, sessionId, maxTagNumber) {
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 markSessionCleanupPending(db, sessionId, rustModuleCleanupRequired = false) {
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 retryPendingSessionCleanups(db, limit = 200) {
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
- clearSession(db, row.session_id);
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 retryPendingRustSessionCleanupsForProject(db, projectPath, deleteSession, limit = 200) {
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
- clearSession(db, row.session_id, true);
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 clearSession(db, sessionId, rustModuleCleanupAcknowledged = false) {
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, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession };
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, __export, __require };
37
+ export { __toESM, __commonJS, __require };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getMagicContextStorageDir
3
- } from "./index-37yzyeca.js";
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 ANNOUNCEMENT_VERSION = "0.31.0";
24
- var ANNOUNCEMENT_FEATURES = [
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 ANNOUNCEMENT_FOOTER = "Join us on Discord: https://discord.gg/F2uWxjGnU";
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 readLastAnnouncedVersion() {
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 shouldShowAnnouncement() {
62
- if (!ANNOUNCEMENT_VERSION || ANNOUNCEMENT_FEATURES.length === 0)
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
- markAnnouncementSeen(ANNOUNCEMENT_VERSION);
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(ANNOUNCEMENT_VERSION, state.version);
68
+ const ordering = compareSemverCore(ANNOUNCEMENT_VERSION2, state.version);
73
69
  if (ordering === null) {
74
- return state.version !== ANNOUNCEMENT_VERSION;
70
+ return state.version !== ANNOUNCEMENT_VERSION2;
75
71
  }
76
72
  return ordering > 0;
77
73
  }
78
74
 
79
- export { isValidSemver, compareSemverCore, ANNOUNCEMENT_VERSION, ANNOUNCEMENT_FEATURES, ANNOUNCEMENT_FOOTER, readLastAnnouncedVersion, markAnnouncementSeen, shouldShowAnnouncement };
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 model2 = readString(entry);
17
- return model2 ? { model: model2 } : undefined;
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 value2 of values) {
39
- const entry = normalizeModelEntry(value2, harness);
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 resolveHistorianModel(config, harness) {
59
+ function resolveHistorianModel2(config, harness) {
56
60
  const historian = asRecord(asRecord(config)?.historian);
57
- const block = asRecord(historian?.[harness]);
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 resolveDreamerTaskModel(args) {
73
+ function resolveDreamerTaskModel2(args) {
70
74
  const dreamer = asRecord(asRecord(args.config)?.dreamer);
71
- const harnessBlock = asRecord(dreamer?.[args.harness]);
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 resolveOpenCodeAgentOverrides(agent) {
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 resolveHistorianAgentOverrides(agent) {
130
+ function resolveHistorianAgentOverrides2(agent) {
126
131
  return {
127
132
  maxTokens: 32000,
128
- ...resolveOpenCodeAgentOverrides(agent)
133
+ ...resolveOpenCodeAgentOverrides2(agent)
129
134
  };
130
135
  }
131
136
 
132
- export { normalizeModelEntry, resolveFallbackEntries, resolveHistorianModel, resolveDreamerTaskModel, resolveOpenCodeAgentOverrides, resolveHistorianAgentOverrides };
137
+ export { resolveHistorianModel2, resolveDreamerTaskModel2, resolveOpenCodeAgentOverrides2, resolveHistorianAgentOverrides2 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getMagicContextLogPath
3
- } from "./index-37yzyeca.js";
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-4x691bz5.js";
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-37yzyeca.js";
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((value2) => JSON.stringify(value2 ?? "").toLowerCase().includes("image") || JSON.stringify(value2 ?? "").toLowerCase().includes("vision"));
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 deriveTriggerBudget(mainContextLimit, executeThresholdPercentage) {
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 deriveHistorianChunkTokens(historianContextLimit) {
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 resolveHistorianContextLimit(historianModelOverride) {
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, deriveTriggerBudget, deriveHistorianChunkTokens, resolveHistorianContextLimit };
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-1yh8g550.js";
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 resolvePromptContext(client, sessionId) {
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 { resolvePromptContext };
75
+ export { resolvePromptContext2 };
@@ -2,7 +2,7 @@
2
2
  var queue = [];
3
3
  var nextNotificationId = 1;
4
4
  var sinks = new Set;
5
- function registerNotificationSink(sink) {
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 pushNotification(type, payload, sessionId) {
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 acknowledgeNotifications(ids) {
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 drainNotifications(lastReceivedId = 0, sessionId, options = {}) {
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 isTuiConnected(sessionId) {
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 { registerNotificationSink, pushNotification, acknowledgeNotifications, __resetNotificationStateForTests, drainNotifications, isTuiConnected };
99
+ export { registerNotificationSink2, pushNotification2, acknowledgeNotifications2, drainNotifications2, isTuiConnected2 };
@@ -1,6 +1,6 @@
1
1
  import {
2
- resolveDreamerTaskModel
3
- } from "./index-d1mxrd3p.js";
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 buildDreamTaskRuntimeConfigs(dreamer, harness, language, muralModel) {
71
+ function buildDreamTaskRuntimeConfigs2(dreamer, harness, language, muralModel) {
72
72
  return CANONICAL_DREAM_TASKS.map((task) => {
73
- const resolved = resolveDreamerTaskModel({
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 userMemoryCollectionEnabled(dreamer) {
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
- function userMemoryPromotionThreshold(dreamer) {
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 };