@cortexkit/opencode-magic-context 0.43.0 → 0.43.2

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 (102) hide show
  1. package/dist/{announcement-8mgn61fw.js → announcement-1a8bvswd.js} +2 -1
  2. package/dist/{conflict-warning-hook-t2vb0wnx.js → conflict-warning-hook-hyk9y29x.js} +6 -4
  3. package/dist/{derive-budgets-0sg5vp61.js → derive-budgets-b8ybssh9.js} +3 -2
  4. package/dist/features/magic-context/dreamer/classify.d.ts +12 -0
  5. package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
  6. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +7 -4
  7. package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
  8. package/dist/features/magic-context/dreamer/map-memories.d.ts +3 -1
  9. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
  10. package/dist/features/magic-context/dreamer/refresh-primers.d.ts +3 -1
  11. package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
  12. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  13. package/dist/features/magic-context/dreamer/verify.d.ts +4 -1
  14. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  15. package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -1
  16. package/dist/features/magic-context/store-generation-rebase.d.ts +62 -1
  17. package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
  18. package/dist/hooks/auto-update-checker/checker.d.ts +1 -0
  19. package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
  20. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  21. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +6 -0
  22. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  23. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +7 -0
  24. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  25. package/dist/hooks/magic-context/compartment-trigger.d.ts +2 -1
  26. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  27. package/dist/hooks/magic-context/ctx-reduce-availability.d.ts +60 -8
  28. package/dist/hooks/magic-context/ctx-reduce-availability.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/hook.d.ts +3 -1
  30. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/lkg-slot.d.ts +1 -0
  32. package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
  33. package/dist/hooks/magic-context/rust-mode-transform.d.ts +2 -0
  34. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/send-session-notification.d.ts +1 -0
  36. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/system-prompt-hash.d.ts +9 -0
  38. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  41. package/dist/{index-8w1skpnm.js → index-0ccmyzbj.js} +6 -6
  42. package/dist/{index-ntbmt6rq.js → index-4b30nf6z.js} +1 -1
  43. package/dist/{index-rpz2me0v.js → index-6j8th2hd.js} +2 -2
  44. package/dist/{index-99sfbrrf.js → index-6w9p73jz.js} +1 -1
  45. package/dist/{index-4ftb5hcq.js → index-6z9g64js.js} +7 -1
  46. package/dist/{index-9skq8m9y.js → index-9r1cbh9e.js} +1 -1
  47. package/dist/{index-ykg9sdzz.js → index-bmzt6xgy.js} +3 -3
  48. package/dist/{safe-notification-target-fepvcbsj.js → index-febg06dy.js} +6 -7
  49. package/dist/{index-d0dh7v0f.js → index-g6hpfkqa.js} +361 -118
  50. package/dist/{index-rvwvdq59.js → index-jgnag7sa.js} +38 -4
  51. package/dist/{index-w2ety11c.js → index-pa67brzn.js} +3 -3
  52. package/dist/{index-ygwdyntq.js → index-tdrv6nd0.js} +6 -4
  53. package/dist/{index-qp20p2py.js → index-wgzyeyf5.js} +1 -1
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +801 -240
  56. package/dist/{message-time-backfill-gzjer78y.js → message-time-backfill-0ccvyk9n.js} +3 -2
  57. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  58. package/dist/{read-session-chunk-ec3jkvhg.js → read-session-chunk-53a7qbrh.js} +4 -3
  59. package/dist/{recomp-orchestrator-6akjp11f.js → recomp-orchestrator-adsgqgse.js} +9 -7
  60. package/dist/safe-notification-target-vrkjrbgb.js +10 -0
  61. package/dist/{send-session-notification-f6gwkesy.js → send-session-notification-e28r4xx2.js} +7 -3
  62. package/dist/shared/data-path.d.ts.map +1 -1
  63. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  64. package/dist/shared/opencode-db-path.d.ts.map +1 -1
  65. package/dist/shared/test-fake-executable.d.ts +38 -0
  66. package/dist/shared/test-fake-executable.d.ts.map +1 -0
  67. package/dist/shared/test-temp-dir.d.ts +1 -1
  68. package/dist/shared/test-temp-dir.d.ts.map +1 -1
  69. package/dist/shared/user-facing-codes.d.ts +10 -0
  70. package/dist/shared/user-facing-codes.d.ts.map +1 -1
  71. package/dist/{task-config-ex4nt0q0.js → task-config-mgf5nsh3.js} +1 -1
  72. package/dist/v2/hidden-completion.d.ts.map +1 -1
  73. package/dist/v2/hooks/context.d.ts.map +1 -1
  74. package/dist/v2/hooks/hidden-child.d.ts +6 -0
  75. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  76. package/dist/v2/hooks/payload.d.ts.map +1 -1
  77. package/dist/v2/hooks/refusal.d.ts +9 -1
  78. package/dist/v2/hooks/refusal.d.ts.map +1 -1
  79. package/dist/v2/hooks/restore-rows.d.ts +29 -0
  80. package/dist/v2/hooks/restore-rows.d.ts.map +1 -0
  81. package/dist/v2/hooks/types.d.ts +1 -0
  82. package/dist/v2/hooks/types.d.ts.map +1 -1
  83. package/dist/v2/hooks/update-check.d.ts +8 -0
  84. package/dist/v2/hooks/update-check.d.ts.map +1 -1
  85. package/dist/v2/host-service.d.ts +1 -1
  86. package/dist/v2/host-service.d.ts.map +1 -1
  87. package/dist/v2/server.js +1171 -366
  88. package/dist/v2/store-reader.d.ts +8 -0
  89. package/dist/v2/store-reader.d.ts.map +1 -1
  90. package/dist/wrapup-orchestrator-8xzbpvm8.js +18 -0
  91. package/package.json +2 -1
  92. package/src/features/magic-context/dreamer/task-registry.ts +1 -1
  93. package/src/shared/data-path.ts +6 -6
  94. package/src/shared/model-suggestion-retry.test.ts +43 -0
  95. package/src/shared/model-suggestion-retry.ts +17 -0
  96. package/src/shared/opencode-db-path.test.ts +18 -0
  97. package/src/shared/opencode-db-path.ts +5 -2
  98. package/src/shared/test-fake-executable.test.ts +54 -0
  99. package/src/shared/test-fake-executable.ts +110 -0
  100. package/src/shared/test-temp-dir.ts +3 -0
  101. package/src/shared/user-facing-codes.ts +11 -0
  102. package/dist/wrapup-orchestrator-5akc87gr.js +0 -16
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  sessionLog
3
- } from "./index-qp20p2py.js";
3
+ } from "./index-wgzyeyf5.js";
4
+ import {
5
+ isDefaultSessionTitle2
6
+ } from "./index-febg06dy.js";
4
7
  import {
5
8
  shouldHoldIgnoredNotification
6
- } from "./index-ykg9sdzz.js";
9
+ } from "./index-bmzt6xgy.js";
7
10
 
8
11
  // src/shared/error-message.ts
9
12
  function getErrorMessage(error) {
@@ -183,7 +186,7 @@ async function sendIgnoredMessageNow(client, sessionId, text, params, forcePersi
183
186
  holdIgnoredNotification({ client, sessionId, text, params, forcePersist }, "during target checks");
184
187
  return "queued";
185
188
  }
186
- const { waitForSafeNotificationTarget } = await import("./safe-notification-target-fepvcbsj.js");
189
+ const { waitForSafeNotificationTarget } = await import("./safe-notification-target-vrkjrbgb.js");
187
190
  if (await waitForSafeNotificationTarget(client, sessionId) === "skip") {
188
191
  sessionLog(sessionId, "notification skipped (session not titled yet)");
189
192
  return "skipped";
@@ -323,6 +326,37 @@ async function revertNoticeIfUnsafe(notification) {
323
326
  lastDeliveredText.set(notification.sessionId, notification.text);
324
327
  return true;
325
328
  }
329
+ async function sendCommandResult2(client, sessionId, text, params) {
330
+ if (shouldHoldIgnoredNotification(sessionId)) {
331
+ return sendIgnoredMessage2(client, sessionId, text, params);
332
+ }
333
+ const { isTuiConnected } = await import("./rpc-notifications-4amf6mf4.js");
334
+ if (isTuiConnected(sessionId))
335
+ return sendIgnoredMessage2(client, sessionId, text, params);
336
+ const session = client?.session;
337
+ try {
338
+ const title = (await session?.get?.({ path: { id: sessionId } }))?.data?.title;
339
+ if (title && isDefaultSessionTitle2(title)) {
340
+ if (!session?.update)
341
+ return "failed";
342
+ const updated = await session.update({
343
+ path: { id: sessionId },
344
+ body: { title: "Magic Context" }
345
+ });
346
+ if (updated.error)
347
+ return "failed";
348
+ }
349
+ idleSessions.add(sessionId);
350
+ const disposition = await sendIgnoredMessage2(client, sessionId, text, params);
351
+ if (disposition === "sent" && !shouldHoldIgnoredNotification(sessionId)) {
352
+ await session?.abort?.({ path: { id: sessionId } });
353
+ }
354
+ return disposition;
355
+ } catch (error) {
356
+ sessionLog(sessionId, "command result delivery failed:", getErrorMessage(error));
357
+ return "failed";
358
+ }
359
+ }
326
360
  async function sendIgnoredMessage2(client, sessionId, text, params, forcePersist = false) {
327
361
  if (await trySendTuiToast(sessionId, text, params, forcePersist)) {
328
362
  notifyDelivered(sessionId, params);
@@ -410,4 +444,4 @@ async function sendStatusNotification2(_client, sessionId, text, params) {
410
444
  }
411
445
  }
412
446
 
413
- export { getErrorMessage, describeError, setNotificationServerUrl2, sendIgnoredMessage2, flushIgnoredMessages2, clearIgnoredMessages2, observeIgnoredNotificationEvent2, sendStatusNotification2 };
447
+ export { getErrorMessage, describeError, setNotificationServerUrl2, sendCommandResult2, sendIgnoredMessage2, flushIgnoredMessages2, clearIgnoredMessages2, observeIgnoredNotificationEvent2, sendStatusNotification2 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sessionLog
3
- } from "./index-qp20p2py.js";
3
+ } from "./index-wgzyeyf5.js";
4
4
  import {
5
5
  COMPARTMENT_LEASE_RENEWAL_MS,
6
6
  acquireCompartmentLease,
@@ -23,13 +23,13 @@ import {
23
23
  registerActiveCompartmentRun,
24
24
  setRecompStarting2,
25
25
  setRecompTerminal2
26
- } from "./index-d0dh7v0f.js";
26
+ } from "./index-g6hpfkqa.js";
27
27
  import {
28
28
  pushNotification2
29
29
  } from "./index-jdxxq8cz.js";
30
30
  import {
31
31
  sendStatusNotification2
32
- } from "./index-rvwvdq59.js";
32
+ } from "./index-jgnag7sa.js";
33
33
 
34
34
  // src/hooks/magic-context/wrapup-orchestrator.ts
35
35
  import * as crypto from "node:crypto";
@@ -1,17 +1,17 @@
1
+ import {
2
+ getHarness
3
+ } from "./index-6z9g64js.js";
1
4
  import {
2
5
  openCodeDbExists,
3
6
  withReadOnlySessionDb,
4
7
  getRawSessionMessageCountFromDb,
5
8
  getMessageTimesFromOpenCodeDb
6
- } from "./index-ykg9sdzz.js";
9
+ } from "./index-bmzt6xgy.js";
7
10
  import {
8
11
  UNKNOWN_FIT_RATIO,
9
12
  resolveDecisionCalibration,
10
13
  providerMass
11
14
  } from "./index-y5145x8k.js";
12
- import {
13
- getHarness
14
- } from "./index-4ftb5hcq.js";
15
15
 
16
16
  // src/features/magic-context/reclaim-protection.ts
17
17
  var CTX_REDUCE_KEEP = 3;
@@ -4340,6 +4340,8 @@ function hasCountableParts(message) {
4340
4340
  case "step-start":
4341
4341
  case "step-finish":
4342
4342
  return true;
4343
+ case "file":
4344
+ return typeof p.url === "string" && p.url.startsWith("data:image/");
4343
4345
  default:
4344
4346
  return false;
4345
4347
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getMagicContextLogPath
3
- } from "./index-4ftb5hcq.js";
3
+ } from "./index-6z9g64js.js";
4
4
 
5
5
  // src/shared/logger.ts
6
6
  import * as fs from "node:fs";
@@ -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;AAgGvE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA88BpC,QAAA,MAAM,MAAM,EAAE,YAAY,GAAG;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAIjD,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;AAgGvE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAi9BpC,QAAA,MAAM,MAAM,EAAE,YAAY,GAAG;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAIjD,CAAC;AAEF,eAAe,MAAM,CAAC"}