@cortexkit/opencode-magic-context 0.42.3 → 0.42.5

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 (134) hide show
  1. package/README.md +3 -1
  2. package/dist/{announcement-3c1vertn.js → announcement-8mgn61fw.js} +1 -1
  3. package/dist/{conflict-warning-hook-aedp084d.js → conflict-warning-hook-jyj54gbe.js} +4 -4
  4. package/dist/{derive-budgets-s2pgnnm4.js → derive-budgets-v1fkhjjr.js} +2 -2
  5. package/dist/features/magic-context/context-authority.d.ts +13 -0
  6. package/dist/features/magic-context/context-authority.d.ts.map +1 -1
  7. package/dist/features/magic-context/dreamer/classify.d.ts +3 -1
  8. package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
  9. package/dist/features/magic-context/dreamer/curate-category-rotation.d.ts +26 -0
  10. package/dist/features/magic-context/dreamer/curate-category-rotation.d.ts.map +1 -0
  11. package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts +7 -5
  12. package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts.map +1 -1
  13. package/dist/features/magic-context/dreamer/task-executor.d.ts +6 -2
  14. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  15. package/dist/features/magic-context/dreamer/task-gates.d.ts +1 -0
  16. package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
  17. package/dist/features/magic-context/dreamer/task-prompts.d.ts +3 -0
  18. package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
  19. package/dist/features/magic-context/dreamer/task-registry.d.ts +9 -0
  20. package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
  21. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +5 -1
  22. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  23. package/dist/features/magic-context/memory/embedding-local.d.ts +11 -0
  24. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  25. package/dist/features/magic-context/mural/compress-cues.d.ts +3 -1
  26. package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
  27. package/dist/features/magic-context/transform-decision-log.d.ts +4 -0
  28. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/apply-operations.d.ts +4 -1
  30. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/caveman-cleanup.d.ts +4 -0
  32. package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -1
  33. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +5 -2
  34. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +2 -2
  36. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/compartment-runner-types.d.ts +61 -2
  38. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/compartment-runner.d.ts +2 -2
  40. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/dropped-token-estimate.d.ts +20 -0
  42. package/dist/hooks/magic-context/dropped-token-estimate.d.ts.map +1 -0
  43. package/dist/hooks/magic-context/heuristic-cleanup.d.ts +2 -0
  44. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/hook.d.ts +2 -2
  46. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/module-transport.d.ts +4 -1
  48. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/rust-mode-transform.d.ts +2 -0
  50. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +3 -0
  53. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +8 -0
  55. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/transform.d.ts +21 -0
  57. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  58. package/dist/{index-sf6x1ga9.js → index-1ar7b3e9.js} +3 -3
  59. package/dist/{index-wde5446v.js → index-3wbd8sdq.js} +225 -67
  60. package/dist/{index-3fe78beq.js → index-4ftb5hcq.js} +9 -1
  61. package/dist/{index-may8skc8.js → index-4wwr6cz0.js} +18 -1
  62. package/dist/{index-ecz14qke.js → index-d8mgqezq.js} +2 -2
  63. package/dist/{index-xdtge3y2.js → index-f9gem5cr.js} +2 -2
  64. package/dist/{index-z8552w7e.js → index-jkrqhc7y.js} +1 -1
  65. package/dist/{index-3wzdwt6p.js → index-ntbmt6rq.js} +1 -1
  66. package/dist/{index-gynz8qdc.js → index-p474rw9p.js} +3 -3
  67. package/dist/{index-dkv2dn46.js → index-qp20p2py.js} +1 -1
  68. package/dist/index.d.ts +4 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +1625 -148
  71. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  72. package/dist/plugin/rpc-handlers.d.ts +18 -0
  73. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  74. package/dist/plugin/rust-tool-backends.d.ts +3 -1
  75. package/dist/plugin/rust-tool-backends.d.ts.map +1 -1
  76. package/dist/{recomp-orchestrator-447vycpt.js → recomp-orchestrator-k20sfpm2.js} +6 -6
  77. package/dist/{safe-notification-target-q9z81zt3.js → safe-notification-target-fepvcbsj.js} +1 -1
  78. package/dist/{send-session-notification-2mzgd3zf.js → send-session-notification-xnypkxpx.js} +3 -3
  79. package/dist/shared/harness.d.ts +2 -1
  80. package/dist/shared/harness.d.ts.map +1 -1
  81. package/dist/shared/model-suggestion-retry.d.ts +5 -1
  82. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  83. package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
  84. package/dist/shared/rpc-types.d.ts +13 -0
  85. package/dist/shared/rpc-types.d.ts.map +1 -1
  86. package/dist/shared/status-detail-text.d.ts.map +1 -1
  87. package/dist/shared/status-summary.d.ts.map +1 -1
  88. package/dist/shared/user-facing-codes.d.ts +10 -0
  89. package/dist/shared/user-facing-codes.d.ts.map +1 -1
  90. package/dist/{storage-meta-session-fkmfhswa.js → storage-meta-session-x3j0q9qy.js} +3 -3
  91. package/dist/{task-config-hnv93r7p.js → task-config-cv8k9y8r.js} +1 -1
  92. package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
  93. package/dist/tools/ctx-note/tools.d.ts.map +1 -1
  94. package/dist/v2/fold/markers.d.ts +7 -0
  95. package/dist/v2/fold/markers.d.ts.map +1 -0
  96. package/dist/v2/fold/owner.d.ts +40 -0
  97. package/dist/v2/fold/owner.d.ts.map +1 -0
  98. package/dist/v2/fold/restore.d.ts +11 -0
  99. package/dist/v2/fold/restore.d.ts.map +1 -0
  100. package/dist/v2/hidden-completion.d.ts +20 -0
  101. package/dist/v2/hidden-completion.d.ts.map +1 -0
  102. package/dist/v2/hooks/channel2.d.ts +8 -0
  103. package/dist/v2/hooks/channel2.d.ts.map +1 -0
  104. package/dist/v2/hooks/context.d.ts +7 -0
  105. package/dist/v2/hooks/context.d.ts.map +1 -0
  106. package/dist/v2/hooks/dream-trigger.d.ts +19 -0
  107. package/dist/v2/hooks/dream-trigger.d.ts.map +1 -0
  108. package/dist/v2/hooks/payload.d.ts +12 -0
  109. package/dist/v2/hooks/payload.d.ts.map +1 -0
  110. package/dist/v2/hooks/refusal.d.ts +7 -0
  111. package/dist/v2/hooks/refusal.d.ts.map +1 -0
  112. package/dist/v2/hooks/store.d.ts +6 -0
  113. package/dist/v2/hooks/store.d.ts.map +1 -0
  114. package/dist/v2/hooks/types.d.ts +90 -0
  115. package/dist/v2/hooks/types.d.ts.map +1 -0
  116. package/dist/v2/hooks/update-check.d.ts +10 -0
  117. package/dist/v2/hooks/update-check.d.ts.map +1 -0
  118. package/dist/v2/server.d.ts +3 -1
  119. package/dist/v2/server.d.ts.map +1 -1
  120. package/dist/v2/server.js +116641 -4
  121. package/dist/v2/store-reader.d.ts +2 -0
  122. package/dist/v2/store-reader.d.ts.map +1 -1
  123. package/index.js +1 -0
  124. package/package.json +5 -4
  125. package/src/features/magic-context/dreamer/task-registry.ts +29 -0
  126. package/src/shared/harness.ts +2 -1
  127. package/src/shared/model-suggestion-retry.ts +66 -14
  128. package/src/shared/prompt-surface-runtime.ts +5 -1
  129. package/src/shared/rpc-types.ts +13 -0
  130. package/src/shared/status-detail-text.test.ts +26 -0
  131. package/src/shared/status-detail-text.ts +11 -0
  132. package/src/shared/status-summary.ts +2 -0
  133. package/src/shared/user-facing-codes.test.ts +1 -1
  134. package/src/shared/user-facing-codes.ts +10 -0
@@ -1,5 +1,13 @@
1
1
  // src/shared/harness.ts
2
2
  var currentHarness = "opencode";
3
+ var harnessLocked = false;
4
+ function setHarness(value) {
5
+ if (harnessLocked && currentHarness !== value) {
6
+ throw new Error(`Magic Context: harness already locked to "${currentHarness}"; cannot change to "${value}"`);
7
+ }
8
+ currentHarness = value;
9
+ harnessLocked = true;
10
+ }
3
11
  function getHarness() {
4
12
  return currentHarness;
5
13
  }
@@ -95,4 +103,4 @@ function getLegacyOpenCodeMagicContextStorageDir() {
95
103
  return path.join(getOpenCodeStorageDir(), "plugin", "magic-context");
96
104
  }
97
105
 
98
- export { getHarness, getDataDir, getMagicContextLogPath, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getOpenCodeStorageDir, getMagicContextStorageResolution, getMagicContextStorageDir, getLegacyOpenCodeMagicContextStorageDir };
106
+ export { setHarness, getHarness, getDataDir, getMagicContextLogPath, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getOpenCodeStorageDir, getMagicContextStorageResolution, getMagicContextStorageDir, getLegacyOpenCodeMagicContextStorageDir };
@@ -17,9 +17,26 @@ var CANONICAL_DREAM_TASKS = [
17
17
  "promote-primers",
18
18
  "refresh-primers"
19
19
  ];
20
+ var DREAM_TASK_CAPABILITIES = {
21
+ "map-memories": { requiresTools: true },
22
+ verify: { requiresTools: true },
23
+ "verify-broad": { requiresTools: true },
24
+ curate: { requiresTools: true },
25
+ "compress-cues": { requiresTools: false },
26
+ "classify-memories": { requiresTools: false },
27
+ retrospective: { requiresTools: true },
28
+ "maintain-docs": { requiresTools: true },
29
+ "evaluate-smart-notes": { requiresTools: true },
30
+ "review-user-memories": { requiresTools: true },
31
+ "promote-primers": { requiresTools: true },
32
+ "refresh-primers": { requiresTools: true }
33
+ };
20
34
  function formatDreamTaskBacklogs(backlogs, tasks = CANONICAL_DREAM_TASKS) {
21
35
  return tasks.filter((task) => backlogs[task] !== undefined).map((task) => {
22
36
  const backlog = backlogs[task];
37
+ if (task === "curate" && backlog?.category) {
38
+ return `- curate: ${backlog.category} (${backlog.pending})`;
39
+ }
23
40
  return `- ${task}: ${backlog?.pending ?? 0} pending / ${backlog?.total ?? 0} total`;
24
41
  }).join(`
25
42
  `);
@@ -92,4 +109,4 @@ function userMemoryCollectionEnabled2(dreamer) {
92
109
  const schedule = dreamer?.tasks?.["review-user-memories"]?.schedule;
93
110
  return typeof schedule === "string" && schedule.trim() !== "";
94
111
  }
95
- export { CANONICAL_DREAM_TASKS, formatDreamTaskBacklogs, processedDreamTaskItems, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs2, userMemoryCollectionEnabled2 };
112
+ export { CANONICAL_DREAM_TASKS, DREAM_TASK_CAPABILITIES, formatDreamTaskBacklogs, processedDreamTaskItems, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs2, userMemoryCollectionEnabled2 };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log
3
- } from "./index-dkv2dn46.js";
3
+ } from "./index-qp20p2py.js";
4
4
  import {
5
5
  sendStatusNotification2
6
- } from "./index-gynz8qdc.js";
6
+ } from "./index-p474rw9p.js";
7
7
  import {
8
8
  readJsoncFile
9
9
  } from "./index-sd3egckz.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sessionLog
3
- } from "./index-dkv2dn46.js";
3
+ } from "./index-qp20p2py.js";
4
4
  import {
5
5
  modelRefLookupOrder
6
6
  } from "./index-avwt563y.js";
@@ -8,7 +8,7 @@ import {
8
8
  getHarness,
9
9
  getDataDir,
10
10
  getMagicContextStorageDir
11
- } from "./index-3fe78beq.js";
11
+ } from "./index-4ftb5hcq.js";
12
12
 
13
13
  // src/shared/models-dev-cache.ts
14
14
  import { mkdirSync, readFileSync as readFileSync2, renameSync, writeFileSync } from "node:fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log
3
- } from "./index-dkv2dn46.js";
3
+ } from "./index-qp20p2py.js";
4
4
 
5
5
  // src/shared/opencode-db-path.ts
6
6
  import { existsSync, readdirSync, statSync } from "node:fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getMagicContextStorageDir
3
- } from "./index-3fe78beq.js";
3
+ } from "./index-4ftb5hcq.js";
4
4
 
5
5
  // src/shared/announcement.ts
6
6
  import * as fs from "node:fs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  sessionLog
3
- } from "./index-dkv2dn46.js";
3
+ } from "./index-qp20p2py.js";
4
4
  import {
5
5
  shouldHoldIgnoredNotification
6
- } from "./index-z8552w7e.js";
6
+ } from "./index-jkrqhc7y.js";
7
7
 
8
8
  // src/shared/error-message.ts
9
9
  function getErrorMessage(error) {
@@ -183,7 +183,7 @@ async function sendIgnoredMessageNow(client, sessionId, text, params, forcePersi
183
183
  holdIgnoredNotification({ client, sessionId, text, params, forcePersist }, "during target checks");
184
184
  return "queued";
185
185
  }
186
- const { waitForSafeNotificationTarget } = await import("./safe-notification-target-q9z81zt3.js");
186
+ const { waitForSafeNotificationTarget } = await import("./safe-notification-target-fepvcbsj.js");
187
187
  if (await waitForSafeNotificationTarget(client, sessionId) === "skip") {
188
188
  sessionLog(sessionId, "notification skipped (session not titled yet)");
189
189
  return "skipped";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getMagicContextLogPath
3
- } from "./index-3fe78beq.js";
3
+ } from "./index-4ftb5hcq.js";
4
4
 
5
5
  // src/shared/logger.ts
6
6
  import * as fs from "node:fs";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import type { PluginModule } from "@opencode-ai/plugin";
2
- declare const plugin: PluginModule;
2
+ import { setup } from "./v2/server";
3
+ declare const plugin: PluginModule & {
4
+ setup: typeof setup;
5
+ };
3
6
  export default plugin;
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAw/BvE,QAAA,MAAM,MAAM,EAAE,YAGb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA4FvE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAq6BpC,QAAA,MAAM,MAAM,EAAE,YAAY,GAAG;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAIjD,CAAC;AAEF,eAAe,MAAM,CAAC"}