@cortexkit/opencode-magic-context 0.49.78 → 0.49.79

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 (67) hide show
  1. package/dist/auto-search-worker.js +1 -1
  2. package/dist/chunk-embedding-write-worker.js +1 -1
  3. package/dist/{context-6pxdmpay.js → context-gb3gjahp.js} +14 -14
  4. package/dist/features/magic-context/dreamer/curate-category-rotation.d.ts +1 -1
  5. package/dist/features/magic-context/dreamer/curate-category-rotation.d.ts.map +1 -1
  6. package/dist/features/magic-context/dreamer/curate-memory-safety.d.ts +5 -1
  7. package/dist/features/magic-context/dreamer/curate-memory-safety.d.ts.map +1 -1
  8. package/dist/features/magic-context/dreamer/task-executor.d.ts +2 -0
  9. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  10. package/dist/hooks/magic-context/image-token-estimate.d.ts.map +1 -1
  11. package/dist/{index-c7xvvhdd.js → index-2dadxknq.js} +110 -59
  12. package/dist/{index-8mt6vvwx.js → index-2q0t43fy.js} +1 -1
  13. package/dist/{index-1pfjvk89.js → index-8ykmp4jv.js} +6 -6
  14. package/dist/{index-kn23xzst.js → index-aawwdt26.js} +1 -1
  15. package/dist/{index-xkn7vq89.js → index-f619wjj9.js} +3 -3
  16. package/dist/{index-c3a833vk.js → index-hgdkwp21.js} +2 -2
  17. package/dist/{index-72qk8fs8.js → index-m0tbtzqh.js} +3 -3
  18. package/dist/{index-r865s8hf.js → index-m6rkq3t4.js} +1 -1
  19. package/dist/{index-dcdk1thy.js → index-sy5wbbw6.js} +5 -5
  20. package/dist/{index-7jj5jk78.js → index-tvkzkk4s.js} +5 -5
  21. package/dist/{index-k6b1av2m.js → index-twmeey4h.js} +2 -2
  22. package/dist/{index-cssarkg7.js → index-v8x07j6c.js} +3 -3
  23. package/dist/{index-rjm4hjyb.js → index-xsdaz3mq.js} +1 -1
  24. package/dist/{index-bdnak4d0.js → index-y208s7zx.js} +5 -3
  25. package/dist/{index-vr6t0y4w.js → index-zzvd4a9z.js} +1 -1
  26. package/dist/index.js +18 -18
  27. package/dist/{message-index-bounded-s0bckzqz.js → message-index-bounded-cfkeyf72.js} +3 -3
  28. package/dist/migration-worker.js +1 -1
  29. package/dist/raw-ordinal-warmup-worker.js +4 -4
  30. package/dist/{read-session-chunk-kqyb1y8c.js → read-session-chunk-s3qac56g.js} +2 -2
  31. package/dist/{recomp-orchestrator-38ed4yhj.js → recomp-orchestrator-jf60eef6.js} +7 -7
  32. package/dist/{render-8s531gd5.js → render-bjxgkrk6.js} +6 -6
  33. package/dist/{search-archive-2f1j2dh8.js → search-archive-a60k0x2n.js} +4 -4
  34. package/dist/{search-m4r4v4aw.js → search-mpde08f1.js} +5 -5
  35. package/dist/shared/subagent-runner.d.ts +9 -0
  36. package/dist/shared/subagent-runner.d.ts.map +1 -1
  37. package/dist/{storage-tags-d3nqrva7.js → storage-tags-6e83pvff.js} +1 -1
  38. package/dist/{transform-postprocess-phase-ch5fsw7h.js → transform-postprocess-phase-m1be339w.js} +8 -8
  39. package/dist/v2/auto-search-worker.js +1 -1
  40. package/dist/v2/chunk-embedding-write-worker.js +1 -1
  41. package/dist/v2/{context-h3r9gxrd.js → context-fzp6ynz4.js} +107 -56
  42. package/dist/v2/{message-index-bounded-vfx2zx9y.js → message-index-bounded-0xy4dn04.js} +3 -3
  43. package/dist/v2/migration-worker.js +1 -1
  44. package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
  45. package/dist/v2/{read-session-chunk-bh402br0.js → read-session-chunk-6mt2t6dy.js} +2 -2
  46. package/dist/v2/{recomp-orchestrator-43grkr1k.js → recomp-orchestrator-4r63zen2.js} +6 -6
  47. package/dist/v2/{render-90pve6jf.js → render-7tr9d67f.js} +6 -6
  48. package/dist/v2/{search-archive-ha08g13n.js → search-archive-2ck9sbsc.js} +4 -4
  49. package/dist/v2/{search-xr5wb3a3.js → search-y01mww69.js} +4 -4
  50. package/dist/v2/{server-86vydsx9.js → server-0dmzr7f9.js} +2 -2
  51. package/dist/v2/{server-92fhew3p.js → server-1svqwm7m.js} +5 -5
  52. package/dist/v2/{server-6jxvkyrr.js → server-2gcfmd47.js} +1 -1
  53. package/dist/v2/{server-fjd90bk0.js → server-d7dbk2h6.js} +2 -2
  54. package/dist/v2/{server-gsz7h1zr.js → server-dhdn8mwq.js} +1 -1
  55. package/dist/v2/{server-qcbxjpkv.js → server-qpnjsg1v.js} +3 -3
  56. package/dist/v2/{server-fw2sjpkx.js → server-r00xyx66.js} +1 -1
  57. package/dist/v2/{server-b8qp1ark.js → server-r9xsgnez.js} +1 -1
  58. package/dist/v2/{server-65r7p1z4.js → server-tkznm2j9.js} +2 -2
  59. package/dist/v2/{server-cxkb9725.js → server-xdh4r20h.js} +5 -3
  60. package/dist/v2/server.js +2 -2
  61. package/dist/v2/{storage-tags-j4he6hwe.js → storage-tags-z8j8wq34.js} +1 -1
  62. package/dist/v2/{v2-archive-reader-xs0d7yyr.js → v2-archive-reader-jatkdt2s.js} +1 -1
  63. package/dist/v2/{wrapup-orchestrator-ghbsa00k.js → wrapup-orchestrator-z91sebhb.js} +6 -6
  64. package/dist/{v2-archive-reader-maj9xst8.js → v2-archive-reader-sw01917z.js} +1 -1
  65. package/dist/{wrapup-orchestrator-q12ejyw9.js → wrapup-orchestrator-1k48hzxg.js} +8 -8
  66. package/package.json +1 -1
  67. package/src/shared/subagent-runner.ts +10 -0
@@ -36,7 +36,7 @@ import"./server-jdfe07mp.js";
36
36
  import {
37
37
  LATEST_SUPPORTED_VERSION,
38
38
  enforceSchemaFence
39
- } from "./server-b8qp1ark.js";
39
+ } from "./server-r9xsgnez.js";
40
40
  import"./server-468mya5v.js";
41
41
  import"./server-jn4pktdk.js";
42
42
  import"./server-xepx8t43.js";
@@ -220,7 +220,7 @@ import {
220
220
  startCompartmentAgent,
221
221
  setRecompStarting2,
222
222
  setRecompTerminal2
223
- } from "./server-92fhew3p.js";
223
+ } from "./server-1svqwm7m.js";
224
224
  import {
225
225
  resolveHistorianModel2
226
226
  } from "./server-5kym00ag.js";
@@ -534,7 +534,7 @@ import {
534
534
  adoptNullOwnerToolTag2,
535
535
  getCandidateToolOwners2,
536
536
  pickNearestPriorOwner2
537
- } from "./server-cxkb9725.js";
537
+ } from "./server-xdh4r20h.js";
538
538
  import {
539
539
  textMentionsRecentCommit,
540
540
  hasMeaningfulUserText2,
@@ -616,12 +616,12 @@ import {
616
616
  readRawSessionMessageOrdinalById2,
617
617
  readSessionChunk2,
618
618
  readRawSessionSeedTail2
619
- } from "./server-6jxvkyrr.js";
619
+ } from "./server-2gcfmd47.js";
620
620
  import {
621
621
  cleanSearchText,
622
622
  matchedSearchSnippet,
623
623
  getLastIndexedOrdinal
624
- } from "./server-fw2sjpkx.js";
624
+ } from "./server-r00xyx66.js";
625
625
  import"./server-ds8vpfkr.js";
626
626
  import {
627
627
  getMessageIndexEpoch,
@@ -648,7 +648,7 @@ import {
648
648
  resolveMemoriesByIdsForSearch2,
649
649
  unifiedSearch2,
650
650
  formatSearchResults2
651
- } from "./server-65r7p1z4.js";
651
+ } from "./server-tkznm2j9.js";
652
652
  import {
653
653
  embedPauseBySession,
654
654
  embedRunStateBySession,
@@ -796,7 +796,7 @@ import {
796
796
  saveSourceContent,
797
797
  replaceSourceContent,
798
798
  getSourceContents
799
- } from "./server-gsz7h1zr.js";
799
+ } from "./server-dhdn8mwq.js";
800
800
  import {
801
801
  startBootDeadline,
802
802
  getUnconfirmedMigrationHolders,
@@ -812,7 +812,7 @@ import {
812
812
  openDatabaseAsync,
813
813
  isDatabasePersisted,
814
814
  getDatabasePersistenceError
815
- } from "./server-b8qp1ark.js";
815
+ } from "./server-r9xsgnez.js";
816
816
  import {
817
817
  V2_MEMORY_CATEGORIES,
818
818
  CATEGORY_PRIORITY
@@ -1001,14 +1001,14 @@ import {
1001
1001
  renderMessageByOrdinal2,
1002
1002
  renderVerboseRangeForTool2,
1003
1003
  renderItemByTag2
1004
- } from "./server-86vydsx9.js";
1004
+ } from "./server-0dmzr7f9.js";
1005
1005
  import"./server-52x68mj4.js";
1006
1006
  import {
1007
1007
  readV2ArchiveOffThread2
1008
- } from "./server-qcbxjpkv.js";
1008
+ } from "./server-qpnjsg1v.js";
1009
1009
  import {
1010
1010
  renderSearchArchiveOffThread2
1011
- } from "./server-fjd90bk0.js";
1011
+ } from "./server-d7dbk2h6.js";
1012
1012
  import {
1013
1013
  markHostInstructionRow,
1014
1014
  hostInstructionRow,
@@ -5496,7 +5496,7 @@ function beginCurateCategoryRun(db, projectIdentity, memories) {
5496
5496
  }));
5497
5497
  return scope;
5498
5498
  }
5499
- function curateTaskStateAfterSuccess(db, projectIdentity, category) {
5499
+ function curateTaskStateAfterCategoryTurn(db, projectIdentity, category) {
5500
5500
  const state = readState(db, projectIdentity);
5501
5501
  return JSON.stringify({
5502
5502
  ...state,
@@ -26193,7 +26193,7 @@ function registerRpcHandlers(rpcServer, args) {
26193
26193
  const db = readDatabase();
26194
26194
  if (!db)
26195
26195
  return { ok: false, error: "db unavailable" };
26196
- const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-43grkr1k.js"));
26196
+ const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-4r63zen2.js"));
26197
26197
  const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-8g4r97bp.js"));
26198
26198
  log2(`[rpc] recomp requested for session ${sessionId}`);
26199
26199
  if (!args.client && !args.hiddenCompletionExecutor) {
@@ -26278,7 +26278,7 @@ function registerRpcHandlers(rpcServer, args) {
26278
26278
  const db = readDatabase();
26279
26279
  if (!db)
26280
26280
  return { ok: false, error: "db unavailable" };
26281
- const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-ghbsa00k.js"));
26281
+ const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-z91sebhb.js"));
26282
26282
  const model = await args.readSelectedSessionModel?.(sessionId) ?? liveSessionState.liveModelBySession.get(sessionId);
26283
26283
  const window = resolveOpenCodeWrapupWindow(db, sessionId, model);
26284
26284
  if (!window)
@@ -33785,6 +33785,22 @@ function isDirectiveShapedProjectRule(category, content) {
33785
33785
  // src/features/magic-context/dreamer/curate-memory-safety.ts
33786
33786
  var PROJECT_SCOPED_CATEGORIES = new Set(V2_MEMORY_CATEGORIES);
33787
33787
  var USER_PROFILE_REFERENCE = /\buser(?:[\s_-]+)(?:profile|preferences?)\b|\bU\d+\b/i;
33788
+ var CURATE_SAFETY_REFUSAL_REASONS = [
33789
+ "missing-active-same-category-successor",
33790
+ "user-profile-is-not-project-memory",
33791
+ "directive-shaped-project-rule",
33792
+ "content-loss"
33793
+ ];
33794
+ var refusalReasons = new Set(CURATE_SAFETY_REFUSAL_REASONS);
33795
+ function parseCurateSafetyRefusal(action, output) {
33796
+ if (action !== "archive" && action !== "update")
33797
+ return null;
33798
+ const refusal = /^Skipped (archive|update) for memory \[ID: -?\d+(?:, -?\d+)*\]: curate safety refusal \(([a-z,-]+)\); refused=[1-9]\d*\.$/.exec(output);
33799
+ if (refusal?.[1] !== action || !refusal[2])
33800
+ return null;
33801
+ const reasons = [...new Set(refusal[2].split(","))];
33802
+ return reasons.every((reason) => refusalReasons.has(reason)) ? reasons : null;
33803
+ }
33788
33804
  var refusalCountsBySession = new Map;
33789
33805
  function isSurvivingConsolidationTarget(memory, successor, projectIdentity) {
33790
33806
  return successor !== null && successor.id !== memory.id && successor.status === "active" && successor.supersededByMemoryId === null && (successor.expiresAt === null || successor.expiresAt > Date.now()) && projectIdentity(successor) === projectIdentity(memory) && successor.category === memory.category;
@@ -38782,8 +38798,11 @@ function validateCurateAssistantText(text) {
38782
38798
  }
38783
38799
  return text;
38784
38800
  }
38801
+ function emptyCurateMemoryOperations() {
38802
+ return { totalCalls: 0, completedActions: [], refusals: [] };
38803
+ }
38785
38804
  function inspectCurateMemoryOperations(messages) {
38786
- const summary = { totalCalls: 0, completedActions: [] };
38805
+ const summary = emptyCurateMemoryOperations();
38787
38806
  if (!Array.isArray(messages))
38788
38807
  return summary;
38789
38808
  for (const message of messages) {
@@ -38798,28 +38817,69 @@ function inspectCurateMemoryOperations(messages) {
38798
38817
  const toolName = part.tool ?? part.name;
38799
38818
  if (toolName !== "ctx_memory")
38800
38819
  continue;
38820
+ const state = isRecord(part.state) ? part.state : null;
38821
+ const input = isRecord(state?.input) ? state.input : null;
38822
+ const action = input?.action;
38823
+ const output = state?.status === "completed" && typeof state.output === "string" ? state.output : null;
38824
+ if (output && (action === "get" || action === "list") && /^(?:Found \d+ (?:active )?memor(?:y|ies):|No active memories found\.$|id -?\d+: not found or not visible from this project)/.test(output))
38825
+ continue;
38801
38826
  summary.totalCalls += 1;
38802
- if (!isRecord(part.state) || part.state.status !== "completed")
38827
+ if (!output)
38803
38828
  continue;
38804
- const input = isRecord(part.state.input) ? part.state.input : null;
38805
- const action = input?.action;
38806
- const output = typeof part.state.output === "string" ? part.state.output : "";
38807
- if (output === "completed" && (action === "merge" || action === "archive" || action === "update") || action === "merge" && output.startsWith("Merged memories") || action === "archive" && output.startsWith("Archived memor") || action === "update" && output.startsWith("Updated memory"))
38829
+ if (action === "merge" && output.startsWith("Merged memories") || action === "archive" && output.startsWith("Archived memor") || action === "update" && output.startsWith("Updated memory")) {
38808
38830
  summary.completedActions.push(action);
38831
+ } else {
38832
+ const reasons = parseCurateSafetyRefusal(action, output);
38833
+ if (reasons)
38834
+ summary.refusals.push(reasons);
38835
+ }
38809
38836
  }
38810
38837
  }
38811
38838
  return summary;
38812
38839
  }
38840
+ function unrecognisedCurateOperations(operations) {
38841
+ return operations.totalCalls - operations.completedActions.length - operations.refusals.length;
38842
+ }
38843
+ function validateCurateOutput(messages, text, transport) {
38844
+ const operations = inspectCurateMemoryOperations(messages);
38845
+ if (text)
38846
+ validateCurateAssistantText(text);
38847
+ if (operations.completedActions.length || operations.refusals.length && !unrecognisedCurateOperations(operations))
38848
+ return operations;
38849
+ if (!text && transport === "child")
38850
+ throw new Error("Dreamer returned no assistant output.");
38851
+ if (operations.totalCalls > 0)
38852
+ throw new Error("Curate returned no completed ctx_memory tool result.");
38853
+ if (!text)
38854
+ throw new Error("Dreamer returned no assistant output.");
38855
+ return operations;
38856
+ }
38813
38857
  function formatExpiredArchiveProgress(count) {
38814
38858
  return `curate: archived ${count} expired ${count === 1 ? "memory" : "memories"}`;
38815
38859
  }
38816
- function formatCurateMemoryOperations(actions) {
38860
+ function formatCurateMemoryOperations(operations) {
38861
+ const { completedActions: actions, refusals } = operations;
38862
+ if (!actions.length && !refusals.length)
38863
+ return null;
38817
38864
  const actionCounts = new Map;
38818
38865
  for (const action of actions)
38819
38866
  actionCounts.set(action, (actionCounts.get(action) ?? 0) + 1);
38820
38867
  const actionDetail = [...actionCounts].map(([action, count]) => count === 1 ? action : `${action} ×${count}`).join(", ");
38821
- const noun = actions.length === 1 ? "operation" : "operations";
38822
- return `curate: ${actions.length} memory ${noun} applied${actionDetail ? ` (${actionDetail})` : ""}`;
38868
+ const applied = actions.length ? `${actions.length} memory ${actions.length === 1 ? "operation" : "operations"} applied (${actionDetail})` : "no changes";
38869
+ const detail = [`curate: ${applied}`];
38870
+ if (refusals.length) {
38871
+ const reasonCounts = new Map;
38872
+ for (const reasons of refusals) {
38873
+ for (const reason of reasons)
38874
+ reasonCounts.set(reason, (reasonCounts.get(reason) ?? 0) + 1);
38875
+ }
38876
+ const countedReasons = [...reasonCounts].sort(([a], [b]) => a.localeCompare(b)).map(([reason, count]) => `${reason} ×${count}`).join(", ");
38877
+ detail.push(`${refusals.length} ${refusals.length === 1 ? "operation" : "operations"} refused (${countedReasons})`);
38878
+ }
38879
+ const unrecognised = unrecognisedCurateOperations(operations);
38880
+ if (unrecognised)
38881
+ detail.push(`${unrecognised} with an unrecognised result`);
38882
+ return detail.join("; ");
38823
38883
  }
38824
38884
  function requireDreamClient(client) {
38825
38885
  if (!client)
@@ -39027,6 +39087,7 @@ function createDreamTaskExecutor(deps) {
39027
39087
  };
39028
39088
  return writtenIds.length || deletedIds.length || archivedIds.length || mergedIds.length ? changes : null;
39029
39089
  }
39090
+ let curateCategory;
39030
39091
  try {
39031
39092
  const skip = (reason) => {
39032
39093
  log2(`[dreamer] ${config.task}: skipped (${reason})`);
@@ -39338,7 +39399,10 @@ function createDreamTaskExecutor(deps) {
39338
39399
  computeMemoryDelta,
39339
39400
  reportProgress,
39340
39401
  leaseAcquisition,
39341
- moduleRoute
39402
+ moduleRoute,
39403
+ onCurateCategory: (category) => {
39404
+ curateCategory = category;
39405
+ }
39342
39406
  });
39343
39407
  } catch (error) {
39344
39408
  if (error instanceof DreamTokenBudgetExceeded) {
@@ -39356,7 +39420,11 @@ function createDreamTaskExecutor(deps) {
39356
39420
  transient,
39357
39421
  error: brief,
39358
39422
  failureDetail: formatDreamRunFailure(failure),
39359
- ...retrospectiveOverflow ? { schedulePatch: retrospectiveOverflow.schedulePatch } : {}
39423
+ ...retrospectiveOverflow ? { schedulePatch: retrospectiveOverflow.schedulePatch } : curateCategory && !transient ? {
39424
+ schedulePatch: {
39425
+ taskStateJson: curateTaskStateAfterCategoryTurn(db, projectIdentity, curateCategory)
39426
+ }
39427
+ } : {}
39360
39428
  };
39361
39429
  } finally {
39362
39430
  deps.onProgress?.(null, config.task);
@@ -39863,6 +39931,8 @@ async function runAgenticTask(config, ctx, helpers) {
39863
39931
  const scope = beginCurateCategoryRun(db, projectIdentity, loadActiveMemoryPromptMemories(db, projectIdentity));
39864
39932
  curateMemories = scope?.memories ?? [];
39865
39933
  curateCategory = scope?.category;
39934
+ if (curateCategory)
39935
+ helpers.onCurateCategory(curateCategory);
39866
39936
  log2(`[dreamer] curate pool: category=${curateCategory ?? "none"} in_scope=${curateMemories.length} expired_archived=${expiredArchived}`);
39867
39937
  if (curateMemories.length === 0) {
39868
39938
  const progress = expiredArchived > 0 ? formatExpiredArchiveProgress(expiredArchived) : "curate: no populated project-memory category";
@@ -39898,7 +39968,7 @@ async function runAgenticTask(config, ctx, helpers) {
39898
39968
  }
39899
39969
  const curateChunks = curateMemories ? chunkCurateMemories(curateMemories, Math.max(4000, Math.floor(resolveRetrospectiveUsableInputTokens(config, deps) * 2))) : [];
39900
39970
  const batches = task === "curate" ? curateChunks : [{ memories: [], crossChunkCandidates: [] }];
39901
- const completedActions = [];
39971
+ const curateOperations = emptyCurateMemoryOperations();
39902
39972
  let curateRefused = 0;
39903
39973
  let run = {
39904
39974
  output: [],
@@ -39947,14 +40017,7 @@ async function runAgenticTask(config, ctx, helpers) {
39947
40017
  parseDocsProposalOutput(text);
39948
40018
  if (task !== "curate")
39949
40019
  return text;
39950
- const memoryOperations = inspectCurateMemoryOperations(completion.messages);
39951
- if (text)
39952
- validateCurateAssistantText(text);
39953
- if (memoryOperations.totalCalls > 0 && memoryOperations.completedActions.length === 0)
39954
- throw new Error("Curate returned no completed ctx_memory tool result.");
39955
- if (!text && memoryOperations.completedActions.length === 0)
39956
- throw new Error("Dreamer returned no assistant output.");
39957
- return { text: text || null, memoryOperations };
40020
+ return validateCurateOutput(completion.messages, text, "hidden");
39958
40021
  }
39959
40022
  });
39960
40023
  childSessionId = hidden.childSessionId;
@@ -40013,24 +40076,15 @@ async function runAgenticTask(config, ctx, helpers) {
40013
40076
  parseDocsProposalOutput(text);
40014
40077
  return text;
40015
40078
  }
40016
- const memoryOperations = inspectCurateMemoryOperations(messages);
40017
- if (text)
40018
- validateCurateAssistantText(text);
40019
- if (memoryOperations.completedActions.length > 0) {
40020
- return { text, memoryOperations };
40021
- }
40022
- if (!text)
40023
- throw new Error("Dreamer returned no assistant output.");
40024
- if (memoryOperations.totalCalls > 0) {
40025
- throw new Error("Curate returned no completed ctx_memory tool result.");
40026
- }
40027
- return { text, memoryOperations };
40079
+ return validateCurateOutput(messages, text, "child");
40028
40080
  }
40029
40081
  });
40030
40082
  promptSettled = true;
40031
40083
  }
40032
- if (task === "curate") {
40033
- completedActions.push(...run.validated.memoryOperations.completedActions);
40084
+ if (typeof run.validated !== "string") {
40085
+ curateOperations.totalCalls += run.validated.totalCalls;
40086
+ curateOperations.completedActions.push(...run.validated.completedActions);
40087
+ curateOperations.refusals.push(...run.validated.refusals);
40034
40088
  curateRefused += takeCurateSafetyRefusalCount(childSessionId ?? "");
40035
40089
  }
40036
40090
  if (childSessionId && !deps.hiddenCompletionExecutor) {
@@ -40046,17 +40100,15 @@ async function runAgenticTask(config, ctx, helpers) {
40046
40100
  childSessionId = null;
40047
40101
  }
40048
40102
  }
40049
- if (task === "curate")
40050
- run.validated = {
40051
- text: null,
40052
- memoryOperations: { totalCalls: completedActions.length, completedActions }
40053
- };
40054
40103
  if (leaseLost)
40055
40104
  throw new Error("Dream lease lost during task");
40056
40105
  if (curateRefused > 0) {
40057
40106
  helpers.reportProgress(curateRefused, curateRefused);
40058
40107
  log2(`[dreamer] curate safety summary: refused=${curateRefused}`);
40059
40108
  }
40109
+ const unrecognised = unrecognisedCurateOperations(curateOperations);
40110
+ if (unrecognised > 0)
40111
+ log2(`[dreamer] curate result summary: unrecognised=${unrecognised}`);
40060
40112
  recordInvocation("completed", run.output);
40061
40113
  if (task === "maintain-docs" && docsHashes && changes) {
40062
40114
  try {
@@ -40076,13 +40128,12 @@ async function runAgenticTask(config, ctx, helpers) {
40076
40128
  return { status: "failed", error: reason };
40077
40129
  }
40078
40130
  }
40079
- const curateOutput = task === "curate" ? run.validated : undefined;
40080
40131
  const curateScopeProgress = task === "curate" && curateCategory && curateMemories ? `curate: ${curateCategory} (${curateMemories.length})` : null;
40081
40132
  const progress = [
40082
40133
  curateScopeProgress,
40083
40134
  expiredArchived > 0 ? formatExpiredArchiveProgress(expiredArchived) : null,
40084
- curateOutput && curateOutput.memoryOperations.completedActions.length > 0 ? formatCurateMemoryOperations(curateOutput.memoryOperations.completedActions) : null,
40085
- curateRefused > 0 ? `curate: refused ${curateRefused} unsafe mutation(s)` : null
40135
+ formatCurateMemoryOperations(curateOperations),
40136
+ curateRefused > 0 && !curateOperations.refusals.length ? `curate: refused ${curateRefused} unsafe mutation(s)` : null
40086
40137
  ].filter((value) => Boolean(value)).join("; ");
40087
40138
  const curateCount = task === "curate" && curateCategory ? loadActiveMemoryPromptMemories(db, projectIdentity).filter((memory) => curateCategoryForMemoryCategory(memory.category) === curateCategory).length : undefined;
40088
40139
  const curateBacklog = curateCount !== undefined && curateCategory ? {
@@ -40101,7 +40152,7 @@ async function runAgenticTask(config, ctx, helpers) {
40101
40152
  ...curateBacklog ? { backlog: curateBacklog } : {},
40102
40153
  ...curateCategory ? {
40103
40154
  schedulePatch: {
40104
- taskStateJson: curateTaskStateAfterSuccess(db, projectIdentity, curateCategory)
40155
+ taskStateJson: curateTaskStateAfterCategoryTurn(db, projectIdentity, curateCategory)
40105
40156
  }
40106
40157
  } : {}
40107
40158
  };
@@ -4,7 +4,7 @@ import {
4
4
  yieldIndexChunk2
5
5
  } from "./server-gzy5w8ya.js";
6
6
  import"./server-1zx87sdm.js";
7
- import"./server-cxkb9725.js";
7
+ import"./server-xdh4r20h.js";
8
8
  import"./server-y8xjr8rx.js";
9
9
  import"./server-pavzsdc6.js";
10
10
  import"./server-j8376q08.js";
@@ -17,7 +17,7 @@ import"./server-1d042x6w.js";
17
17
  import"./server-6ash6z8z.js";
18
18
  import"./server-2ra6pwf3.js";
19
19
  import"./server-3ap5dmhc.js";
20
- import"./server-6jxvkyrr.js";
20
+ import"./server-2gcfmd47.js";
21
21
  import {
22
22
  MESSAGE_INDEX_MAX_FTS_BYTES,
23
23
  messageIndexSkipKey,
@@ -25,7 +25,7 @@ import {
25
25
  markMessageIndexDirty,
26
26
  getIndexableContent,
27
27
  indexSingleMessage
28
- } from "./server-fw2sjpkx.js";
28
+ } from "./server-r00xyx66.js";
29
29
  import"./server-ds8vpfkr.js";
30
30
  import"./server-5sbsnpkn.js";
31
31
 
@@ -19,7 +19,7 @@ import"./server-fb3zxn06.js";
19
19
  import {
20
20
  setSqlitePragmaConfig,
21
21
  initializeDatabase
22
- } from "./server-b8qp1ark.js";
22
+ } from "./server-r9xsgnez.js";
23
23
  import"./server-468mya5v.js";
24
24
  import"./server-v0p37hm2.js";
25
25
  import"./server-96ztjvkn.js";
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
19
19
  await main();
20
20
  async function main() {
21
21
  if (input.v2ArchiveReader) {
22
- const { serveV2ArchiveReads } = await import("./v2-archive-reader-xs0d7yyr.js");
22
+ const { serveV2ArchiveReads } = await import("./v2-archive-reader-jatkdt2s.js");
23
23
  await serveV2ArchiveReads(port, openConnections);
24
24
  return;
25
25
  }
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
51
51
  await runMessageFtsRowidMapBackfill(db);
52
52
  reply = { kind: "fts-rowid-backfill" };
53
53
  } else if (input.searchArchive) {
54
- const { renderSearchArchive } = await import("./search-archive-ha08g13n.js");
54
+ const { renderSearchArchive } = await import("./search-archive-2ck9sbsc.js");
55
55
  const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-wg5zc29f.js");
56
56
  const archive = input.searchArchive;
57
57
  let raw;
@@ -81,7 +81,7 @@ serveWorkerJobs(async (input, port) => {
81
81
  const { setHarness } = await import("./harness-e4avh192.js");
82
82
  setHarness(input.harness ?? "opencode");
83
83
  const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
84
- import("./message-index-bounded-vfx2zx9y.js"),
84
+ import("./message-index-bounded-0xy4dn04.js"),
85
85
  import("./sqlite-context-pragmas-mv9jqwjh.js")
86
86
  ]);
87
87
  configureContextDatabasePragmas(db);
@@ -95,7 +95,7 @@ serveWorkerJobs(async (input, port) => {
95
95
  measurements: result.measurements
96
96
  };
97
97
  } else if (input.tagRatio !== undefined) {
98
- const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-j4he6hwe.js");
98
+ const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-z8j8wq34.js");
99
99
  const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
100
100
  if (delta)
101
101
  reply = { kind: "tag-delta", delta };
@@ -38,8 +38,8 @@ import {
38
38
  readSessionChunk2,
39
39
  getRawSessionMessageIdsThrough2,
40
40
  readRawSessionSeedTail2
41
- } from "./server-6jxvkyrr.js";
42
- import"./server-cxkb9725.js";
41
+ } from "./server-2gcfmd47.js";
42
+ import"./server-xdh4r20h.js";
43
43
  import"./server-1zx87sdm.js";
44
44
  import"./server-3ap5dmhc.js";
45
45
  import"./server-rz6g5xne.js";
@@ -7,23 +7,23 @@ import {
7
7
  setRecompTerminal2,
8
8
  buildRecompDeps2,
9
9
  runManagedRecomp2
10
- } from "./server-92fhew3p.js";
10
+ } from "./server-1svqwm7m.js";
11
11
  import"./server-at0v0z4t.js";
12
12
  import"./server-kmaxv4g3.js";
13
13
  import"./server-10af6m7d.js";
14
14
  import"./server-jjvbk92s.js";
15
15
  import"./server-mhrgymcs.js";
16
16
  import"./server-4dhv7mqz.js";
17
- import"./server-gsz7h1zr.js";
17
+ import"./server-dhdn8mwq.js";
18
18
  import"./server-rbtx6q5v.js";
19
- import"./server-fw2sjpkx.js";
19
+ import"./server-r00xyx66.js";
20
20
  import"./server-2amn2s73.js";
21
21
  import"./server-rthnpmbp.js";
22
22
  import"./server-aewxmvnf.js";
23
23
  import"./server-qjff96a6.js";
24
24
  import"./server-qt1qqasc.js";
25
- import"./server-6jxvkyrr.js";
26
- import"./server-cxkb9725.js";
25
+ import"./server-2gcfmd47.js";
26
+ import"./server-xdh4r20h.js";
27
27
  import"./server-1zx87sdm.js";
28
28
  import"./server-3ap5dmhc.js";
29
29
  import"./server-npdey91q.js";
@@ -35,7 +35,7 @@ import"./server-rz6g5xne.js";
35
35
  import"./server-jtq03rkb.js";
36
36
  import"./server-8pdfmc27.js";
37
37
  import"./server-x6fn9x8q.js";
38
- import"./server-b8qp1ark.js";
38
+ import"./server-r9xsgnez.js";
39
39
  import"./server-fb3zxn06.js";
40
40
  import"./server-jn4pktdk.js";
41
41
  import"./server-fr0wbhdn.js";
@@ -2,20 +2,20 @@ import {
2
2
  renderMessageByOrdinal2,
3
3
  renderVerboseRangeForTool2,
4
4
  renderItemByTag2
5
- } from "./server-86vydsx9.js";
6
- import"./server-gsz7h1zr.js";
5
+ } from "./server-0dmzr7f9.js";
6
+ import"./server-dhdn8mwq.js";
7
7
  import"./server-rbtx6q5v.js";
8
- import"./server-fw2sjpkx.js";
8
+ import"./server-r00xyx66.js";
9
9
  import"./server-2amn2s73.js";
10
10
  import"./server-rthnpmbp.js";
11
- import"./server-6jxvkyrr.js";
12
- import"./server-cxkb9725.js";
11
+ import"./server-2gcfmd47.js";
12
+ import"./server-xdh4r20h.js";
13
13
  import"./server-1zx87sdm.js";
14
14
  import"./server-3ap5dmhc.js";
15
15
  import"./server-rz6g5xne.js";
16
16
  import"./server-8pdfmc27.js";
17
17
  import"./server-x6fn9x8q.js";
18
- import"./server-b8qp1ark.js";
18
+ import"./server-r9xsgnez.js";
19
19
  import"./server-fb3zxn06.js";
20
20
  import"./server-jn4pktdk.js";
21
21
  import"./server-fr0wbhdn.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  renderSearchArchive2,
3
3
  renderSearchArchiveOffThread2
4
- } from "./server-fjd90bk0.js";
5
- import"./server-qcbxjpkv.js";
4
+ } from "./server-d7dbk2h6.js";
5
+ import"./server-qpnjsg1v.js";
6
6
  import"./server-52x68mj4.js";
7
- import"./server-6jxvkyrr.js";
8
- import"./server-cxkb9725.js";
7
+ import"./server-2gcfmd47.js";
8
+ import"./server-xdh4r20h.js";
9
9
  import"./server-1zx87sdm.js";
10
10
  import"./server-3ap5dmhc.js";
11
11
  import"./server-rz6g5xne.js";
@@ -5,7 +5,7 @@ import {
5
5
  resolveMemoriesByIdsForSearch2,
6
6
  unifiedSearch2,
7
7
  formatSearchResults2
8
- } from "./server-65r7p1z4.js";
8
+ } from "./server-tkznm2j9.js";
9
9
  import"./server-52x68mj4.js";
10
10
  import"./server-kmaxv4g3.js";
11
11
  import"./server-10af6m7d.js";
@@ -13,11 +13,11 @@ import"./server-jjvbk92s.js";
13
13
  import"./server-mhrgymcs.js";
14
14
  import"./server-4dhv7mqz.js";
15
15
  import"./server-rbtx6q5v.js";
16
- import"./server-fw2sjpkx.js";
16
+ import"./server-r00xyx66.js";
17
17
  import"./server-2amn2s73.js";
18
18
  import"./server-qt1qqasc.js";
19
- import"./server-6jxvkyrr.js";
20
- import"./server-cxkb9725.js";
19
+ import"./server-2gcfmd47.js";
20
+ import"./server-xdh4r20h.js";
21
21
  import"./server-1zx87sdm.js";
22
22
  import"./server-3ap5dmhc.js";
23
23
  import"./server-d706s5xn.js";
@@ -3,12 +3,12 @@ import {
3
3
  } from "./server-y8xjr8rx.js";
4
4
  import {
5
5
  getTagById2
6
- } from "./server-cxkb9725.js";
6
+ } from "./server-xdh4r20h.js";
7
7
  import {
8
8
  expandToolPart,
9
9
  visitRawSessionMessages2,
10
10
  readRawSessionMessageById2
11
- } from "./server-6jxvkyrr.js";
11
+ } from "./server-2gcfmd47.js";
12
12
 
13
13
  // src/tools/ctx-expand/render.ts
14
14
  import { createHash } from "node:crypto";
@@ -101,7 +101,7 @@ import {
101
101
  foldShrunkPartTags2,
102
102
  getTagNumberByMessageId2,
103
103
  getActiveTagsBySession2
104
- } from "./server-cxkb9725.js";
104
+ } from "./server-xdh4r20h.js";
105
105
  import {
106
106
  hasMeaningfulUserText2,
107
107
  estimateTokens,
@@ -156,14 +156,14 @@ import {
156
156
  getRawSessionTagKeysThrough2,
157
157
  getLegacyProtectedTailStartOrdinal2,
158
158
  readSessionChunk2
159
- } from "./server-6jxvkyrr.js";
159
+ } from "./server-2gcfmd47.js";
160
160
  import {
161
161
  clearCompressionDepth,
162
162
  clearCompressionDepthRange,
163
163
  toMessageIndexSource,
164
164
  clearIndexedMessagesInTransaction,
165
165
  indexSourcesAfterOrdinal
166
- } from "./server-fw2sjpkx.js";
166
+ } from "./server-r00xyx66.js";
167
167
  import {
168
168
  COMPARTMENT_LEASE_RENEWAL_MS,
169
169
  getCompartmentLeaseBlocker,
@@ -210,7 +210,7 @@ import {
210
210
  getProjectState,
211
211
  recordSubagentInvocation,
212
212
  getLatestHistorianInvocationId
213
- } from "./server-gsz7h1zr.js";
213
+ } from "./server-dhdn8mwq.js";
214
214
  import {
215
215
  invalidateAutoEmbedSession
216
216
  } from "./server-2amn2s73.js";
@@ -270,7 +270,7 @@ import {
270
270
  LATEST_SUPPORTED_VERSION,
271
271
  getPersistedSchemaVersion,
272
272
  openDatabase
273
- } from "./server-b8qp1ark.js";
273
+ } from "./server-r9xsgnez.js";
274
274
  import {
275
275
  parseCompartmentOutput,
276
276
  resolveWorkspaceShareCategories,
@@ -6,7 +6,7 @@ import {
6
6
  estimateMessageTokens,
7
7
  getCandidateToolOwners2,
8
8
  pickNearestPriorOwner2
9
- } from "./server-cxkb9725.js";
9
+ } from "./server-xdh4r20h.js";
10
10
  import {
11
11
  OMO_INTERNAL_INITIATOR_MARKER,
12
12
  isSystemDirective,
@@ -19,10 +19,10 @@ import {
19
19
  rawMessageWorkerSource2,
20
20
  rawMessageOffThreadRangeReader2,
21
21
  readRawSessionMessageIdOrdinalsForRange2
22
- } from "./server-6jxvkyrr.js";
22
+ } from "./server-2gcfmd47.js";
23
23
  import {
24
24
  readV2ArchiveOffThread2
25
- } from "./server-qcbxjpkv.js";
25
+ } from "./server-qpnjsg1v.js";
26
26
 
27
27
  // src/tools/ctx-expand/search-archive.ts
28
28
  var archiveReadsOnThisThread = 0;
@@ -58,7 +58,7 @@ import {
58
58
  getPendingPiCompactionMarkerState,
59
59
  logPiCompactionMarkerClear,
60
60
  isPrefixBoundThinkingModel
61
- } from "./server-cxkb9725.js";
61
+ } from "./server-xdh4r20h.js";
62
62
  import {
63
63
  BoundedSessionMap,
64
64
  getMeasuredToolDefinitionTokens,