@cortexkit/opencode-magic-context 0.49.99 → 0.49.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/dreamer.d.ts +3 -2
- package/dist/agents/dreamer.d.ts.map +1 -1
- package/dist/agents/permissions.d.ts +2 -0
- package/dist/agents/permissions.d.ts.map +1 -1
- package/dist/agents/smart-notes-dreamer-gate.fixture.d.ts +3 -1
- package/dist/agents/smart-notes-dreamer-gate.fixture.d.ts.map +1 -1
- package/dist/auto-search-worker.js +1 -1
- package/dist/chunk-embedding-write-worker.js +1 -1
- package/dist/{context-z77a2jpx.js → context-4fjwzqqa.js} +497 -52
- package/dist/features/magic-context/dreamer/curate-memory-safety.d.ts +1 -0
- package/dist/features/magic-context/dreamer/curate-memory-safety.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-prompts.d.ts +7 -1
- package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +7 -0
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts +8 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +4 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +1 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/host-served-rows.d.ts +7 -0
- package/dist/hooks/magic-context/host-served-rows.d.ts.map +1 -1
- package/dist/hooks/magic-context/image-token-estimate.d.ts +1 -0
- package/dist/hooks/magic-context/image-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/provider-refusal-count.d.ts +84 -0
- package/dist/hooks/magic-context/provider-refusal-count.d.ts.map +1 -0
- package/dist/hooks/magic-context/signed-thinking-hold.d.ts +2 -0
- package/dist/hooks/magic-context/signed-thinking-hold.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-9q7wzca8.js → index-2b7g81z7.js} +70 -25
- package/dist/{index-xw608ytx.js → index-3cgh0ght.js} +1 -1
- package/dist/{index-mfx7hzyc.js → index-4dywj733.js} +1 -1
- package/dist/{index-dnxnj42p.js → index-634cww4x.js} +4 -4
- package/dist/{index-h1xvt8fw.js → index-63kp05sy.js} +1 -1
- package/dist/{index-5xrj3zp4.js → index-fbg61b3d.js} +3 -3
- package/dist/{index-tyjx0dwz.js → index-jjy4shhy.js} +1 -1
- package/dist/{index-0wj3jr8n.js → index-k4c0majv.js} +3 -3
- package/dist/{index-5nf2a14a.js → index-k7yytqrd.js} +364 -76
- package/dist/{index-ajmy0v5j.js → index-ke0mkz7g.js} +13 -0
- package/dist/{index-8hhmv0ff.js → index-kjhgxkdx.js} +1 -1
- package/dist/{index-4qc8d9by.js → index-mx4j316q.js} +21 -14
- package/dist/{index-9eqt7755.js → index-rakm1eay.js} +2 -2
- package/dist/{index-w6kcwhhj.js → index-rjxg7a7m.js} +212 -4
- package/dist/{index-xbna9akt.js → index-sgsaf60r.js} +5 -5
- package/dist/{index-507a56zb.js → index-tbhbxb09.js} +5 -5
- package/dist/{index-em72jhc0.js → index-y33x200y.js} +2 -2
- package/dist/{index-kjdys7e2.js → index-zg5r2syy.js} +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +154 -41
- package/dist/{message-index-bounded-6y7p974x.js → message-index-bounded-289186ah.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/plugin/messages-transform.d.ts +1 -0
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/provider-refusal-v1.d.ts +15 -0
- package/dist/plugin/provider-refusal-v1.d.ts.map +1 -0
- package/dist/plugin/subagent-tool-policy.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-9ejnbe07.js → read-session-chunk-frnwxnjg.js} +2 -2
- package/dist/{recomp-orchestrator-9k91tkyx.js → recomp-orchestrator-cvsfmctf.js} +8 -8
- package/dist/{render-9712q3gp.js → render-2a83mgrp.js} +7 -7
- package/dist/{search-archive-5jr011gc.js → search-archive-f5dzec0e.js} +5 -5
- package/dist/{search-yhaxy3e6.js → search-fxtb4844.js} +6 -6
- package/dist/{storage-tags-vd3sgd4s.js → storage-tags-2d2ba8e9.js} +1 -1
- package/dist/{store-reader-01e8t5j0.js → store-reader-c5fwa9qx.js} +1 -1
- package/dist/{store-235fjtsn.js → store-wpx314rk.js} +2 -2
- package/dist/tools/ctx-memory/constants.d.ts +2 -0
- package/dist/tools/ctx-memory/constants.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts +1 -0
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-mf5js6cs.js → transform-postprocess-phase-fyw30790.js} +9 -9
- package/dist/v2/auto-search-worker.js +1 -1
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-4fej2dzv.js → context-08pwkj6g.js} +872 -139
- package/dist/v2/fold/instruction-supersession.d.ts +18 -1
- package/dist/v2/fold/instruction-supersession.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +2 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/http-refusal-count.d.ts +41 -0
- package/dist/v2/hooks/http-refusal-count.d.ts.map +1 -0
- package/dist/v2/hooks/overflow-recovery.d.ts +3 -0
- package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -1
- package/dist/v2/hooks/revert-message-state.d.ts +6 -0
- package/dist/v2/hooks/revert-message-state.d.ts.map +1 -1
- package/dist/v2/hooks/tools.d.ts.map +1 -1
- package/dist/v2/hooks/types.d.ts +5 -0
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-wj5rs9az.js → message-index-bounded-p69v4wpy.js} +3 -3
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-89ep8br4.js → read-session-chunk-qzw3vedr.js} +2 -2
- package/dist/v2/{recomp-orchestrator-9wap1z1d.js → recomp-orchestrator-4mrvs5yc.js} +7 -7
- package/dist/v2/{render-bzzypsgy.js → render-r2djh67k.js} +7 -7
- package/dist/v2/{search-ymm2crs3.js → search-51qr14ed.js} +5 -5
- package/dist/v2/{search-archive-4yr4hw2m.js → search-archive-4bq4ff8q.js} +5 -5
- package/dist/v2/{server-8xgs110k.js → server-606mnrv4.js} +212 -4
- package/dist/v2/{server-7861dnm3.js → server-awth2wsg.js} +1 -1
- package/dist/v2/{server-d0h1gjz2.js → server-b25kh28g.js} +3 -3
- package/dist/v2/{server-62t1852h.js → server-b25nvm9c.js} +1 -1
- package/dist/v2/{server-6mq43ear.js → server-c1vcbszm.js} +1 -1
- package/dist/v2/{server-xn7fpv2b.js → server-d2a639dg.js} +3 -3
- package/dist/v2/{server-6r3b0re0.js → server-f49pxtwf.js} +41 -8
- package/dist/v2/{server-e14d7ebh.js → server-mc5t7k8v.js} +1 -1
- package/dist/v2/{server-zedjjdc5.js → server-nbdfv1wx.js} +2 -2
- package/dist/v2/{server-e8ybwfv8.js → server-p2wxmjc3.js} +2 -2
- package/dist/v2/{server-ysg14rv1.js → server-qg8jyfxa.js} +13 -0
- package/dist/v2/{server-h95cdc30.js → server-s3m2y97h.js} +1 -1
- package/dist/v2/{server-1bks09js.js → server-zzwje0mz.js} +5 -5
- package/dist/v2/server.js +2 -2
- package/dist/v2/{storage-tags-8kktww54.js → storage-tags-4t9fb4ch.js} +1 -1
- package/dist/v2/{store-0kjfynwp.js → store-mba47sxn.js} +2 -2
- package/dist/v2/{store-reader-w0srb18d.js → store-reader-w7w8vfsy.js} +1 -1
- package/dist/v2/store-reader.d.ts +7 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{v2-archive-reader-veyqp15a.js → v2-archive-reader-avcf7a5n.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-89cg7p41.js → wrapup-orchestrator-zwpjqymz.js} +7 -7
- package/dist/{v2-archive-reader-3s332fn7.js → v2-archive-reader-cnhvhggz.js} +1 -1
- package/dist/{wrapup-orchestrator-41rt7etq.js → wrapup-orchestrator-g1gnymt3.js} +9 -9
- package/package.json +1 -1
- package/src/agents/dreamer.ts +3 -2
- package/src/agents/hidden-agent-registrations.ts +2 -2
- package/src/agents/permissions.test.ts +89 -3
- package/src/agents/permissions.ts +32 -0
- package/src/agents/smart-notes-dreamer-gate.fixture.ts +27 -4
- package/src/agents/smart-notes-dreamer-gate.test.ts +5 -1
|
@@ -99,6 +99,19 @@ import {
|
|
|
99
99
|
releaseGitSweepLease
|
|
100
100
|
} from "./index-fd3hkyk1.js";
|
|
101
101
|
import {
|
|
102
|
+
CTX_MEMORY_TOOL_NAME,
|
|
103
|
+
CTX_MEMORY_LIST_TOOL_NAME,
|
|
104
|
+
CTX_MEMORY_CURATE_TOOL_NAME,
|
|
105
|
+
CTX_MEMORY_LIST_DESCRIPTION,
|
|
106
|
+
CTX_MEMORY_DESCRIPTION,
|
|
107
|
+
DEFAULT_SEARCH_LIMIT,
|
|
108
|
+
DREAMER_AGENT,
|
|
109
|
+
DREAMER_RETROSPECTIVE_AGENT,
|
|
110
|
+
DREAMER_PRIMER_INVESTIGATOR_AGENT,
|
|
111
|
+
DREAMER_MEMORY_MAPPER_AGENT,
|
|
112
|
+
DREAMER_CLASSIFIER_AGENT,
|
|
113
|
+
DREAMER_DOCS_AGENT,
|
|
114
|
+
DREAMER_REVIEWER_AGENT,
|
|
102
115
|
getMagicContextBuiltinCommands,
|
|
103
116
|
formatConfigParseStatusLine,
|
|
104
117
|
isCommitRetentionPaused,
|
|
@@ -112,13 +125,6 @@ import {
|
|
|
112
125
|
producerInputTokenLimit,
|
|
113
126
|
historianProducerReserve,
|
|
114
127
|
producerPromptFailureReason,
|
|
115
|
-
DREAMER_AGENT,
|
|
116
|
-
DREAMER_RETROSPECTIVE_AGENT,
|
|
117
|
-
DREAMER_PRIMER_INVESTIGATOR_AGENT,
|
|
118
|
-
DREAMER_MEMORY_MAPPER_AGENT,
|
|
119
|
-
DREAMER_CLASSIFIER_AGENT,
|
|
120
|
-
DREAMER_DOCS_AGENT,
|
|
121
|
-
DREAMER_REVIEWER_AGENT,
|
|
122
128
|
createChildSessionWithFence,
|
|
123
129
|
HiddenCompletionRefusal,
|
|
124
130
|
DreamerProviderOutputFailureError,
|
|
@@ -213,7 +219,7 @@ import {
|
|
|
213
219
|
snapRangeToCompartments,
|
|
214
220
|
getActiveCompartmentRun,
|
|
215
221
|
startCompartmentAgent
|
|
216
|
-
} from "./index-
|
|
222
|
+
} from "./index-2b7g81z7.js";
|
|
217
223
|
import {
|
|
218
224
|
formatWindowDerivationLine,
|
|
219
225
|
getSdkWindowGeometry,
|
|
@@ -371,7 +377,7 @@ import {
|
|
|
371
377
|
getTagsByNumbers2,
|
|
372
378
|
getDroppedTagsByNumbers2,
|
|
373
379
|
getMaxDroppedTagNumber2
|
|
374
|
-
} from "./index-
|
|
380
|
+
} from "./index-rjxg7a7m.js";
|
|
375
381
|
import {
|
|
376
382
|
BoundedSessionMap,
|
|
377
383
|
observeTemporalDecisions,
|
|
@@ -445,7 +451,7 @@ import {
|
|
|
445
451
|
readRawSessionMessageById2,
|
|
446
452
|
readSessionChunk2,
|
|
447
453
|
readRawSessionSeedTail2
|
|
448
|
-
} from "./index-
|
|
454
|
+
} from "./index-kjhgxkdx.js";
|
|
449
455
|
import {
|
|
450
456
|
buildDreamTaskRuntimeConfigs2,
|
|
451
457
|
userMemoryCollectionEnabled2
|
|
@@ -469,7 +475,7 @@ import {
|
|
|
469
475
|
runSqliteOptimize,
|
|
470
476
|
openDatabase,
|
|
471
477
|
openCurrentDatabase
|
|
472
|
-
} from "./index-
|
|
478
|
+
} from "./index-3cgh0ght.js";
|
|
473
479
|
import {
|
|
474
480
|
unescapeXml,
|
|
475
481
|
resolveWorkspaceShareCategories,
|
|
@@ -588,10 +594,10 @@ import {
|
|
|
588
594
|
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
589
595
|
getProjectState,
|
|
590
596
|
bumpProjectUserProfileVersion
|
|
591
|
-
} from "./index-
|
|
597
|
+
} from "./index-y33x200y.js";
|
|
592
598
|
import {
|
|
593
599
|
getLastIndexedOrdinal
|
|
594
|
-
} from "./index-
|
|
600
|
+
} from "./index-jjy4shhy.js";
|
|
595
601
|
import {
|
|
596
602
|
SESSION_NOTE_CONDITION_ERROR,
|
|
597
603
|
getNoteByIdInScope,
|
|
@@ -725,13 +731,13 @@ import {
|
|
|
725
731
|
resolveMemoriesByIdsForSearch2,
|
|
726
732
|
unifiedSearch2,
|
|
727
733
|
formatSearchResults2
|
|
728
|
-
} from "./index-
|
|
734
|
+
} from "./index-634cww4x.js";
|
|
729
735
|
import {
|
|
730
736
|
scheduleReconciliation,
|
|
731
737
|
scheduleIncrementalIndex,
|
|
732
738
|
getMessageIndexQueueHeapStats,
|
|
733
739
|
clearSessionTracking
|
|
734
|
-
} from "./index-
|
|
740
|
+
} from "./index-63kp05sy.js";
|
|
735
741
|
import {
|
|
736
742
|
resolveModelCacheTtl,
|
|
737
743
|
resolveContextWindowGeometry,
|
|
@@ -830,7 +836,7 @@ import {
|
|
|
830
836
|
abortSessionFailClosed2,
|
|
831
837
|
evaluateEmergencyFailClosed2,
|
|
832
838
|
runPostTransformPhase2
|
|
833
|
-
} from "./index-
|
|
839
|
+
} from "./index-mx4j316q.js";
|
|
834
840
|
import {
|
|
835
841
|
flushIgnoredMessages2,
|
|
836
842
|
clearIgnoredMessages2,
|
|
@@ -840,7 +846,7 @@ import {
|
|
|
840
846
|
import {
|
|
841
847
|
setRecompStarting2,
|
|
842
848
|
setRecompTerminal2
|
|
843
|
-
} from "./index-
|
|
849
|
+
} from "./index-fbg61b3d.js";
|
|
844
850
|
import {
|
|
845
851
|
ANNOUNCEMENT_VERSION2,
|
|
846
852
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -855,14 +861,14 @@ import {
|
|
|
855
861
|
renderMessageByOrdinal2,
|
|
856
862
|
renderVerboseRangeForTool2,
|
|
857
863
|
renderItemByTag2
|
|
858
|
-
} from "./index-
|
|
864
|
+
} from "./index-rakm1eay.js";
|
|
859
865
|
import {
|
|
860
866
|
readV2ArchiveOffThread2
|
|
861
|
-
} from "./index-
|
|
867
|
+
} from "./index-sgsaf60r.js";
|
|
862
868
|
import {
|
|
863
869
|
unresolvedLiveTailRefusal2,
|
|
864
870
|
renderSearchArchiveOffThread2
|
|
865
|
-
} from "./index-
|
|
871
|
+
} from "./index-k4c0majv.js";
|
|
866
872
|
import {
|
|
867
873
|
takeCoveredInstructionRows,
|
|
868
874
|
cloneKeepingCoveredInstructionMarks
|
|
@@ -969,14 +975,16 @@ Project memory uses exactly 5 categories. Every memory belongs to one:
|
|
|
969
975
|
- **NAMING** — naming conventions and canonical names. Not inventories.
|
|
970
976
|
|
|
971
977
|
**Legacy categories during transition:** older memories may still carry pre-v2 category names. When you touch one, map it to its 5-category home with \`action="update"\` (or \`merge\`): WORKFLOW_RULES→PROJECT_RULES, ARCHITECTURE_DECISIONS→ARCHITECTURE, CONFIG_DEFAULTS→CONFIG_VALUES, ENVIRONMENT→CONFIG_VALUES (paths) or CONSTRAINTS, KNOWN_ISSUES→CONSTRAINTS only if it's an external-system limit. USER_DIRECTIVES / USER_PREFERENCES are NOT project categories. Do not compare project memories with the global user profile or use it to justify an archive.`;
|
|
972
|
-
|
|
978
|
+
function buildCurateSystemPrompt(memoryTool) {
|
|
979
|
+
const example = (args) => memoryTool === CTX_MEMORY_TOOL_NAME ? args : `${memoryTool}(${args})`;
|
|
980
|
+
return `You are a memory-pool curator for the magic-context system. You run during a scheduled dream window to keep a project's cross-session memory store lean and well-formed.
|
|
973
981
|
|
|
974
982
|
## Memory operations
|
|
975
983
|
- The scoped category snapshot arrives in the first message. Do not list or get it again; track mutation deltas.
|
|
976
|
-
-
|
|
977
|
-
-
|
|
978
|
-
-
|
|
979
|
-
-
|
|
984
|
+
- \`${example('action="merge", ids=[N,M,...], content="...", category="..."')}\` — consolidate duplicates into one canonical memory
|
|
985
|
+
- \`${example('action="update", ids=[N], content="...", superseded_by=M')}\` — rewrite content; name where removed detail survives when cutting more than half
|
|
986
|
+
- \`${example('action="write", category="...", content="..."')}\` — create a memory (SPLITS ONLY — never mint new facts)
|
|
987
|
+
- \`${example('action="archive", ids=[N], superseded_by=M, reason="..."')}\` — consolidate a redundant memory into the named active same-category survivor
|
|
980
988
|
|
|
981
989
|
## Rules
|
|
982
990
|
1. **Assume the pool is accurate.** A separate verify task checks memories against code. You handle QUALITY only — duplicates, wording, low-value entries — never correctness, and you do NOT read the codebase.
|
|
@@ -987,6 +995,8 @@ var CURATE_SYSTEM_PROMPT = `You are a memory-pool curator for the magic-context
|
|
|
987
995
|
6. **Never mint new facts** — that is the historian's job. \`write\` is for splitting a compound memory only.
|
|
988
996
|
|
|
989
997
|
${PROJECT_MEMORY_TAXONOMY}`;
|
|
998
|
+
}
|
|
999
|
+
var CURATE_SYSTEM_PROMPT = buildCurateSystemPrompt(CTX_MEMORY_CURATE_TOOL_NAME);
|
|
990
1000
|
var MAINTAIN_DOCS_SYSTEM_PROMPT = `You are a read-only documentation investigator for the magic-context system. Use read, grep, glob and navigation tools to verify source. Never edit any file or run commands. Return only a proposed change to the project's ARCHITECTURE.md and STRUCTURE.md, not a change log. The protected regions between <!-- mc:protected START ... --> and <!-- mc:protected END --> must remain byte-identical. If the docs are accurate, return [].`;
|
|
991
1001
|
var REVIEW_USER_MEMORIES_SYSTEM_PROMPT = `You are a user-profile reviewer for the magic-context system. You run during a scheduled dream window to decide which recurring behavioral observations about the human user are real, persistent patterns worth keeping in their global user profile.
|
|
992
1002
|
|
|
@@ -1021,7 +1031,7 @@ The memories below are assumed ACCURATE (a separate verify task keeps them true)
|
|
|
1021
1031
|
Work ALL THREE phases below in order (A → B → C) over this category. Do NOT stop after consolidating — a run that only merges and never improves or archives is incomplete.
|
|
1022
1032
|
|
|
1023
1033
|
### Phase A — Consolidate duplicates
|
|
1024
|
-
Group by category, then merge near-identical / superset-subset / same-fact-different-angle clusters into one canonical memory with
|
|
1034
|
+
Group by category, then merge near-identical / superset-subset / same-fact-different-angle clusters into one canonical memory with \`${args.memoryTool ?? CTX_MEMORY_CURATE_TOOL_NAME}(action="merge", ids=[...], content="...", category="...")\`. Preserve every unique detail; terse present tense; paths/keys verbatim. Every id in a merge MUST share the same category — the system rejects cross-category merges. If two similar memories sit in different categories they are NOT duplicates; do not archive either as a consolidation. One fact per memory.
|
|
1025
1035
|
|
|
1026
1036
|
### Phase B — Improve wording
|
|
1027
1037
|
Rewrite narrative/historical → operational present tense ("X uses Y because Z", not "we switched to Y"); drop session-local context and commit hashes (unless the hash is the point); add specifics where vague. A rewrite that removes more than half the content must name the active same-category memory preserving that detail with \`superseded_by\`. \`write\` is for SPLITS ONLY (update the original down to its first fact, write the second) — a healthy run is net-neutral or net-shrinking, never net-adds facts.
|
|
@@ -1150,7 +1160,8 @@ function buildDreamTaskPrompt(task, args) {
|
|
|
1150
1160
|
projectPath: args.projectPath,
|
|
1151
1161
|
category: args.curate?.category ?? "PROJECT_RULES",
|
|
1152
1162
|
memories: args.curate?.memories ?? [],
|
|
1153
|
-
crossChunkCandidates: args.curate?.crossChunkCandidates
|
|
1163
|
+
crossChunkCandidates: args.curate?.crossChunkCandidates,
|
|
1164
|
+
memoryTool: args.curate?.memoryTool
|
|
1154
1165
|
});
|
|
1155
1166
|
case "maintain-docs":
|
|
1156
1167
|
return buildMaintainDocsPrompt(args.projectPath, args.docsChangeSet ?? "", args.existingDocs ?? { architecture: false, structure: false }, args.docsBudget, args.docsCurrentTokens, args.docsContents);
|
|
@@ -4128,7 +4139,8 @@ var refusalReasons = new Set(CURATE_SAFETY_REFUSAL_REASONS);
|
|
|
4128
4139
|
function parseCurateSafetyRefusal(action, output) {
|
|
4129
4140
|
if (action !== "archive" && action !== "update")
|
|
4130
4141
|
return null;
|
|
4131
|
-
const refusal = /^Skipped (archive|update) for memory \[ID: -?\d+(?:, -?\d+)*\]: curate safety refusal \(([a-z,-]+)\); refused=[1-9]\d*\.$/.exec(output
|
|
4142
|
+
const refusal = /^Skipped (archive|update) for memory \[ID: -?\d+(?:, -?\d+)*\]: curate safety refusal \(([a-z,-]+)\); refused=[1-9]\d*\.$/.exec(output.split(`
|
|
4143
|
+
`, 1)[0] ?? "");
|
|
4132
4144
|
if (refusal?.[1] !== action || !refusal[2])
|
|
4133
4145
|
return null;
|
|
4134
4146
|
const reasons = [...new Set(refusal[2].split(","))];
|
|
@@ -4179,14 +4191,20 @@ function assessCurateMutationSafety(args) {
|
|
|
4179
4191
|
return null;
|
|
4180
4192
|
}
|
|
4181
4193
|
function recordCurateSafetyRefusal(sessionId, refusal) {
|
|
4182
|
-
const
|
|
4183
|
-
|
|
4194
|
+
const counts = refusalCountsBySession.get(sessionId) ?? { total: 0, byMemory: new Map };
|
|
4195
|
+
const forMemory = (counts.byMemory.get(refusal.memoryId) ?? 0) + 1;
|
|
4196
|
+
counts.byMemory.set(refusal.memoryId, forMemory);
|
|
4197
|
+
const count = ++counts.total;
|
|
4198
|
+
refusalCountsBySession.set(sessionId, counts);
|
|
4184
4199
|
const lengths = refusal.originalChars === undefined ? "" : ` original_chars=${refusal.originalChars} replacement_chars=${refusal.replacementChars ?? 0}`;
|
|
4185
4200
|
log2(`[dreamer] curate safety refusal: session_id=${sessionId} memory_id=${refusal.memoryId} verdict=${refusal.verdict} reason=${refusal.reason}${lengths} refused=${count}`);
|
|
4186
4201
|
return count;
|
|
4187
4202
|
}
|
|
4203
|
+
function curateSafetyRefusalsForMemory(sessionId, memoryId) {
|
|
4204
|
+
return refusalCountsBySession.get(sessionId)?.byMemory.get(memoryId) ?? 0;
|
|
4205
|
+
}
|
|
4188
4206
|
function takeCurateSafetyRefusalCount(sessionId) {
|
|
4189
|
-
const count = refusalCountsBySession.get(sessionId) ?? 0;
|
|
4207
|
+
const count = refusalCountsBySession.get(sessionId)?.total ?? 0;
|
|
4190
4208
|
refusalCountsBySession.delete(sessionId);
|
|
4191
4209
|
return count;
|
|
4192
4210
|
}
|
|
@@ -10198,7 +10216,7 @@ function inspectCurateMemoryOperations(messages) {
|
|
|
10198
10216
|
if (!isRecord(part) || part.type !== "tool")
|
|
10199
10217
|
continue;
|
|
10200
10218
|
const toolName = part.tool ?? part.name;
|
|
10201
|
-
if (toolName !==
|
|
10219
|
+
if (toolName !== CTX_MEMORY_TOOL_NAME && toolName !== CTX_MEMORY_CURATE_TOOL_NAME)
|
|
10202
10220
|
continue;
|
|
10203
10221
|
const state = isRecord(part.state) ? part.state : null;
|
|
10204
10222
|
const input = isRecord(state?.input) ? state.input : null;
|
|
@@ -11370,6 +11388,9 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
11370
11388
|
const curateChunks = curateMemories ? chunkCurateMemories(curateMemories, Math.max(4000, Math.floor(resolveRetrospectiveUsableInputTokens(config, deps) * 2))) : [];
|
|
11371
11389
|
const batches = task === "curate" ? curateChunks : [{ memories: [], crossChunkCandidates: [] }];
|
|
11372
11390
|
const curateOperations = emptyCurateMemoryOperations();
|
|
11391
|
+
const harness = getHarness2();
|
|
11392
|
+
const curateMemoryTool = harness === "pi" || harness === "omp" ? CTX_MEMORY_TOOL_NAME : CTX_MEMORY_CURATE_TOOL_NAME;
|
|
11393
|
+
const taskSystemPrompt = task === "maintain-docs" ? MAINTAIN_DOCS_SYSTEM_PROMPT : buildCurateSystemPrompt(curateMemoryTool);
|
|
11373
11394
|
let curateRefused = 0;
|
|
11374
11395
|
let run = {
|
|
11375
11396
|
output: [],
|
|
@@ -11390,7 +11411,8 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
11390
11411
|
curate: curateMemories && curateCategory ? {
|
|
11391
11412
|
category: curateCategory,
|
|
11392
11413
|
memories: batch.memories,
|
|
11393
|
-
crossChunkCandidates: batch.crossChunkCandidates
|
|
11414
|
+
crossChunkCandidates: batch.crossChunkCandidates,
|
|
11415
|
+
memoryTool: curateMemoryTool
|
|
11394
11416
|
} : undefined
|
|
11395
11417
|
});
|
|
11396
11418
|
if (deps.hiddenCompletionExecutor) {
|
|
@@ -11399,7 +11421,7 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
11399
11421
|
parentSessionId: parent ?? undefined,
|
|
11400
11422
|
sessionDirectory: docsDir,
|
|
11401
11423
|
agent: task === "maintain-docs" ? DREAMER_DOCS_AGENT : DREAMER_AGENT,
|
|
11402
|
-
system:
|
|
11424
|
+
system: taskSystemPrompt,
|
|
11403
11425
|
prompt: taskPrompt,
|
|
11404
11426
|
title: `magic-context-dream-${task}`,
|
|
11405
11427
|
callContext: `dreamer:${task}`,
|
|
@@ -11446,7 +11468,7 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
11446
11468
|
query: { directory: docsDir },
|
|
11447
11469
|
body: {
|
|
11448
11470
|
agent: task === "maintain-docs" ? DREAMER_DOCS_AGENT : DREAMER_AGENT,
|
|
11449
|
-
system: task === "maintain-docs" ?
|
|
11471
|
+
system: task === "maintain-docs" ? taskSystemPrompt : withContentLanguageDirective(taskSystemPrompt, config.language ?? deps.language),
|
|
11450
11472
|
...modelBodyField(config.model),
|
|
11451
11473
|
parts: [{ type: "text", text: taskPrompt, synthetic: true }]
|
|
11452
11474
|
}
|
|
@@ -16466,7 +16488,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16466
16488
|
const db = readDatabase();
|
|
16467
16489
|
if (!db)
|
|
16468
16490
|
return { ok: false, error: "db unavailable" };
|
|
16469
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16491
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-cvsfmctf.js"));
|
|
16470
16492
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-tfhs4dbc.js"));
|
|
16471
16493
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16472
16494
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -16551,7 +16573,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16551
16573
|
const db = readDatabase();
|
|
16552
16574
|
if (!db)
|
|
16553
16575
|
return { ok: false, error: "db unavailable" };
|
|
16554
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16576
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-g1gnymt3.js"));
|
|
16555
16577
|
const model = await args.readSelectedSessionModel?.(sessionId) ?? liveSessionState.liveModelBySession.get(sessionId);
|
|
16556
16578
|
const window = resolveOpenCodeWrapupWindow(db, sessionId, model);
|
|
16557
16579
|
if (!window)
|
|
@@ -17609,7 +17631,8 @@ function decideSignedThinkingHold(args) {
|
|
|
17609
17631
|
const ended = readingEndsHold({
|
|
17610
17632
|
usagePercentage: args.usagePercentage,
|
|
17611
17633
|
capPercentage,
|
|
17612
|
-
forceBandPressure: args.forceBandPressure
|
|
17634
|
+
forceBandPressure: args.forceBandPressure,
|
|
17635
|
+
refusedInputTokens: args.refusedInputTokens
|
|
17613
17636
|
});
|
|
17614
17637
|
if (ended !== null)
|
|
17615
17638
|
return { held: false, reason: ended, heavyStepsBack, heavyStepTokens, capPercentage };
|
|
@@ -17624,7 +17647,8 @@ function decideSignedThinkingHold(args) {
|
|
|
17624
17647
|
function readingEndsHold(args) {
|
|
17625
17648
|
if (!(args.usagePercentage < args.capPercentage))
|
|
17626
17649
|
return "above_cap";
|
|
17627
|
-
|
|
17650
|
+
const refused = args.refusedInputTokens;
|
|
17651
|
+
return args.forceBandPressure || refused !== undefined && Number.isFinite(refused) && refused > 0 ? "force_band" : null;
|
|
17628
17652
|
}
|
|
17629
17653
|
|
|
17630
17654
|
// src/hooks/magic-context/priced-pass-sizing.ts
|
|
@@ -17805,6 +17829,235 @@ function isReasoningPart(part) {
|
|
|
17805
17829
|
return typeof part === "object" && part !== null && REASONING_PART_TYPES.has(String(part.type));
|
|
17806
17830
|
}
|
|
17807
17831
|
|
|
17832
|
+
// src/hooks/magic-context/provider-refusal-count.ts
|
|
17833
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
17834
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
17835
|
+
var RUN_END_GRACE_MS = 5000;
|
|
17836
|
+
|
|
17837
|
+
class ProviderRefusalCounts {
|
|
17838
|
+
requests = new BoundedSessionMap(1000);
|
|
17839
|
+
begin(session, startedAt, priorAssistantMessageID) {
|
|
17840
|
+
const previous = this.requests.get(session);
|
|
17841
|
+
let pending = previous?.refused;
|
|
17842
|
+
let refusedDigests = pending === undefined ? undefined : previous?.digests;
|
|
17843
|
+
if (previous)
|
|
17844
|
+
this.settle(session);
|
|
17845
|
+
let historyMatches = false;
|
|
17846
|
+
const request = {
|
|
17847
|
+
startedAt,
|
|
17848
|
+
priorAssistantMessageID,
|
|
17849
|
+
pass: {
|
|
17850
|
+
take: (model) => {
|
|
17851
|
+
const count = pending;
|
|
17852
|
+
pending = undefined;
|
|
17853
|
+
return this.requests.get(session) === request && historyMatches && count?.model === model ? count?.tokens : undefined;
|
|
17854
|
+
},
|
|
17855
|
+
save: (model, tokens) => {
|
|
17856
|
+
if (this.requests.get(session) !== request || request.ambiguousOutcome)
|
|
17857
|
+
return;
|
|
17858
|
+
request.prepared = makeCount(model, tokens);
|
|
17859
|
+
},
|
|
17860
|
+
freeze: (model, measure) => {
|
|
17861
|
+
if (this.requests.get(session) === request && !request.ambiguousOutcome && !request.settled)
|
|
17862
|
+
request.prepared = { model, measure };
|
|
17863
|
+
},
|
|
17864
|
+
observeHistory: (history) => {
|
|
17865
|
+
if (request.settled)
|
|
17866
|
+
return;
|
|
17867
|
+
request.snapshot = history;
|
|
17868
|
+
if (pending !== undefined) {
|
|
17869
|
+
historyMatches = refusedDigests !== undefined && startsWithDigests(history, refusedDigests);
|
|
17870
|
+
if (!historyMatches)
|
|
17871
|
+
pending = undefined;
|
|
17872
|
+
}
|
|
17873
|
+
refusedDigests = undefined;
|
|
17874
|
+
}
|
|
17875
|
+
}
|
|
17876
|
+
};
|
|
17877
|
+
this.requests.set(session, request);
|
|
17878
|
+
return request.pass;
|
|
17879
|
+
}
|
|
17880
|
+
latest(session, replyStartedAt) {
|
|
17881
|
+
const request = this.requests.get(session);
|
|
17882
|
+
if (request?.ambiguousOutcome)
|
|
17883
|
+
return;
|
|
17884
|
+
if (replyStartedAt !== undefined && (!Number.isFinite(replyStartedAt) || request?.startedAt !== undefined && replyStartedAt < request.startedAt))
|
|
17885
|
+
return;
|
|
17886
|
+
return request?.pass;
|
|
17887
|
+
}
|
|
17888
|
+
latestForTerminalFailure(session, assistantMessageID) {
|
|
17889
|
+
const request = this.requests.get(session);
|
|
17890
|
+
if (assistantMessageID !== undefined && assistantMessageID === request?.priorAssistantMessageID)
|
|
17891
|
+
return;
|
|
17892
|
+
return this.latest(session);
|
|
17893
|
+
}
|
|
17894
|
+
forget(session) {
|
|
17895
|
+
this.settle(session);
|
|
17896
|
+
this.requests.delete(session);
|
|
17897
|
+
}
|
|
17898
|
+
retainsHistorySnapshot(session) {
|
|
17899
|
+
return this.requests.get(session)?.snapshot !== undefined;
|
|
17900
|
+
}
|
|
17901
|
+
retainsFrozenDraft(session) {
|
|
17902
|
+
const prepared = this.requests.get(session)?.prepared;
|
|
17903
|
+
return prepared !== undefined && "measure" in prepared;
|
|
17904
|
+
}
|
|
17905
|
+
endRun(session, releaseTransport) {
|
|
17906
|
+
const request = this.requests.get(session);
|
|
17907
|
+
if (!request || request.settled || request.runEndTimer)
|
|
17908
|
+
return;
|
|
17909
|
+
const timer = setTimeout(() => {
|
|
17910
|
+
if (this.requests.peek(session)?.runEndTimer === timer)
|
|
17911
|
+
this.settle(session);
|
|
17912
|
+
releaseTransport?.();
|
|
17913
|
+
}, RUN_END_GRACE_MS);
|
|
17914
|
+
timer.unref();
|
|
17915
|
+
request.runEndTimer = timer;
|
|
17916
|
+
}
|
|
17917
|
+
settle(session) {
|
|
17918
|
+
const request = this.requests.get(session);
|
|
17919
|
+
if (!request)
|
|
17920
|
+
return;
|
|
17921
|
+
clearTimeout(request.runEndTimer);
|
|
17922
|
+
request.runEndTimer = undefined;
|
|
17923
|
+
request.settled = true;
|
|
17924
|
+
request.prepared = undefined;
|
|
17925
|
+
request.snapshot = undefined;
|
|
17926
|
+
}
|
|
17927
|
+
markOutcomeAmbiguous(session) {
|
|
17928
|
+
const request = this.requests.get(session);
|
|
17929
|
+
if (!request)
|
|
17930
|
+
return;
|
|
17931
|
+
request.ambiguousOutcome = true;
|
|
17932
|
+
request.prepared = undefined;
|
|
17933
|
+
request.snapshot = undefined;
|
|
17934
|
+
}
|
|
17935
|
+
discardDraft(session, pass) {
|
|
17936
|
+
const request = this.requests.get(session);
|
|
17937
|
+
if (request?.pass !== pass)
|
|
17938
|
+
return;
|
|
17939
|
+
request.prepared = undefined;
|
|
17940
|
+
request.refused = undefined;
|
|
17941
|
+
}
|
|
17942
|
+
discardPreparation(session, pass) {
|
|
17943
|
+
const request = this.requests.get(session);
|
|
17944
|
+
if (request?.pass !== pass)
|
|
17945
|
+
return;
|
|
17946
|
+
request.prepared = undefined;
|
|
17947
|
+
request.snapshot = undefined;
|
|
17948
|
+
}
|
|
17949
|
+
refusal(session, model, pass, tokens) {
|
|
17950
|
+
const request = this.requests.get(session);
|
|
17951
|
+
if (!request || request.settled || request.ambiguousOutcome || pass !== undefined && request.pass !== pass)
|
|
17952
|
+
return;
|
|
17953
|
+
const exact = pass && makeCount(model, tokens);
|
|
17954
|
+
if (exact) {
|
|
17955
|
+
request.refused = exact;
|
|
17956
|
+
armHistory(request);
|
|
17957
|
+
return;
|
|
17958
|
+
}
|
|
17959
|
+
if (request.refused || model !== undefined && request.prepared?.model !== model)
|
|
17960
|
+
return;
|
|
17961
|
+
const prepared = request.prepared;
|
|
17962
|
+
if (prepared && "measure" in prepared) {
|
|
17963
|
+
request.prepared = undefined;
|
|
17964
|
+
try {
|
|
17965
|
+
request.refused = makeCount(prepared.model, prepared.measure());
|
|
17966
|
+
} catch {}
|
|
17967
|
+
} else
|
|
17968
|
+
request.refused = prepared;
|
|
17969
|
+
armHistory(request);
|
|
17970
|
+
}
|
|
17971
|
+
}
|
|
17972
|
+
function makeCount(model, tokens) {
|
|
17973
|
+
return model && tokens !== undefined && Number.isFinite(tokens) && tokens > 0 ? { model, tokens } : undefined;
|
|
17974
|
+
}
|
|
17975
|
+
function armHistory(request) {
|
|
17976
|
+
if (!request.refused)
|
|
17977
|
+
return;
|
|
17978
|
+
const snapshot = request.snapshot;
|
|
17979
|
+
request.snapshot = undefined;
|
|
17980
|
+
if (request.digests || !snapshot)
|
|
17981
|
+
return;
|
|
17982
|
+
try {
|
|
17983
|
+
const digests = [];
|
|
17984
|
+
for (let index = 0;index < snapshot.ends.length; index++)
|
|
17985
|
+
digests.push(digestMessage(snapshot, index));
|
|
17986
|
+
request.digests = digests;
|
|
17987
|
+
} catch {}
|
|
17988
|
+
}
|
|
17989
|
+
var refusalHistoryDigest = {
|
|
17990
|
+
serialize: (values) => JSON.stringify(values),
|
|
17991
|
+
hash: (text) => createHash11("sha256").update(text).digest("base64")
|
|
17992
|
+
};
|
|
17993
|
+
function digestMessage(history, index) {
|
|
17994
|
+
const start = index === 0 ? 0 : history.ends[index - 1];
|
|
17995
|
+
return refusalHistoryDigest.hash(refusalHistoryDigest.serialize(history.values.slice(start, history.ends[index])));
|
|
17996
|
+
}
|
|
17997
|
+
function startsWithDigests(history, digests) {
|
|
17998
|
+
if (history.ends.length < digests.length)
|
|
17999
|
+
return false;
|
|
18000
|
+
try {
|
|
18001
|
+
for (let index = 0;index < digests.length; index++)
|
|
18002
|
+
if (digestMessage(history, index) !== digests[index])
|
|
18003
|
+
return false;
|
|
18004
|
+
} catch {
|
|
18005
|
+
return false;
|
|
18006
|
+
}
|
|
18007
|
+
return true;
|
|
18008
|
+
}
|
|
18009
|
+
function snapshotRefusalHistory(rows, read) {
|
|
18010
|
+
const values = [];
|
|
18011
|
+
const ends = new Array(rows.length);
|
|
18012
|
+
for (let index = 0;index < rows.length; index++) {
|
|
18013
|
+
read(rows[index], values);
|
|
18014
|
+
ends[index] = values.length;
|
|
18015
|
+
}
|
|
18016
|
+
return { values, ends };
|
|
18017
|
+
}
|
|
18018
|
+
function pushRefusalFields(record, values, skip) {
|
|
18019
|
+
for (const key in record) {
|
|
18020
|
+
if (key !== skip)
|
|
18021
|
+
values.push(key, record[key]);
|
|
18022
|
+
}
|
|
18023
|
+
}
|
|
18024
|
+
function readOpenCodeRefusalMessage(message, values) {
|
|
18025
|
+
values.push(message.info.role);
|
|
18026
|
+
for (const part of message.parts) {
|
|
18027
|
+
if (part === null || typeof part !== "object") {
|
|
18028
|
+
values.push(part);
|
|
18029
|
+
continue;
|
|
18030
|
+
}
|
|
18031
|
+
const record = part;
|
|
18032
|
+
switch (record.type) {
|
|
18033
|
+
case "text":
|
|
18034
|
+
case "reasoning":
|
|
18035
|
+
values.push(record.type, record.text);
|
|
18036
|
+
break;
|
|
18037
|
+
case "tool": {
|
|
18038
|
+
const state = record.state ?? {};
|
|
18039
|
+
values.push("tool", record.tool, state.status, state.input, state.output, state.error, state.attachments);
|
|
18040
|
+
break;
|
|
18041
|
+
}
|
|
18042
|
+
case "file":
|
|
18043
|
+
values.push("file", record.mime, record.url, record.filename);
|
|
18044
|
+
break;
|
|
18045
|
+
default:
|
|
18046
|
+
pushRefusalFields(record, values);
|
|
18047
|
+
}
|
|
18048
|
+
}
|
|
18049
|
+
}
|
|
18050
|
+
var activePass = new AsyncLocalStorage;
|
|
18051
|
+
function withProviderRefusalPass(session, pass, run) {
|
|
18052
|
+
return activePass.run({ session, pass }, run);
|
|
18053
|
+
}
|
|
18054
|
+
function takeProviderRefusedInputTokens(session, model) {
|
|
18055
|
+
const active = activePass.getStore();
|
|
18056
|
+
if (active?.session !== session)
|
|
18057
|
+
return;
|
|
18058
|
+
return active.pass.take(model);
|
|
18059
|
+
}
|
|
18060
|
+
|
|
17808
18061
|
// src/hooks/magic-context/recovery-fit.ts
|
|
17809
18062
|
var RECOVERY_REFUSAL_NOTICE = "Magic Context is still summarizing older history so this conversation fits the model's context window. Send your message again to continue.";
|
|
17810
18063
|
var RECOVERY_NO_HISTORY_REFUSAL_NOTICE = "This conversation no longer fits the model's context window, and Magic Context has no more older history it can summarize. Switch to a model with a larger context window to continue.";
|
|
@@ -17970,7 +18223,7 @@ function evaluateRequestToolsRelease(args) {
|
|
|
17970
18223
|
}
|
|
17971
18224
|
|
|
17972
18225
|
// src/hooks/magic-context/rust-mode-transform.ts
|
|
17973
|
-
import { createHash as
|
|
18226
|
+
import { createHash as createHash15, randomUUID as randomUUID6 } from "node:crypto";
|
|
17974
18227
|
|
|
17975
18228
|
// src/features/magic-context/memory/single-store-embedding-drain.ts
|
|
17976
18229
|
function isWatermarkRow(row) {
|
|
@@ -18027,7 +18280,7 @@ function advanceEmbeddedWatermark(db, projectPath, upTo) {
|
|
|
18027
18280
|
}
|
|
18028
18281
|
|
|
18029
18282
|
// src/features/magic-context/mural/source-revision.ts
|
|
18030
|
-
import { createHash as
|
|
18283
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
18031
18284
|
var statements = new WeakMap;
|
|
18032
18285
|
function muralSourceRevision(db, projectPath) {
|
|
18033
18286
|
let statement = statements.get(db);
|
|
@@ -18044,7 +18297,7 @@ function muralSourceRevision(db, projectPath) {
|
|
|
18044
18297
|
statements.set(db, statement);
|
|
18045
18298
|
}
|
|
18046
18299
|
const row = statement.get(projectPath, Date.now());
|
|
18047
|
-
return
|
|
18300
|
+
return createHash12("sha256").update(row.revision).digest("hex");
|
|
18048
18301
|
}
|
|
18049
18302
|
|
|
18050
18303
|
// src/features/magic-context/install-instance-id.ts
|
|
@@ -20507,7 +20760,7 @@ function noteExternalLkgReplay(participant, sessionId, inputMessages, servedMess
|
|
|
20507
20760
|
}
|
|
20508
20761
|
|
|
20509
20762
|
// src/hooks/magic-context/rust-served-raw.ts
|
|
20510
|
-
import { createHash as
|
|
20763
|
+
import { createHash as createHash14 } from "node:crypto";
|
|
20511
20764
|
class RustServedRawConflict extends EmergencyFailClosedError {
|
|
20512
20765
|
reason;
|
|
20513
20766
|
messageIds;
|
|
@@ -20521,7 +20774,7 @@ class RustServedRawConflict extends EmergencyFailClosedError {
|
|
|
20521
20774
|
}
|
|
20522
20775
|
function partDigest(part) {
|
|
20523
20776
|
const serialized = JSON.stringify(part);
|
|
20524
|
-
return
|
|
20777
|
+
return createHash14("sha256").update(stableStringify(serialized === undefined ? undefined : JSON.parse(serialized))).digest("hex");
|
|
20525
20778
|
}
|
|
20526
20779
|
function records(doc) {
|
|
20527
20780
|
if (doc.rustServedRaw === undefined)
|
|
@@ -21240,10 +21493,10 @@ function messageCacheSignature(message) {
|
|
|
21240
21493
|
const parts = Array.isArray(message.parts) ? message.parts : [];
|
|
21241
21494
|
const serializedParts = JSON.stringify(parts) ?? "null";
|
|
21242
21495
|
const serializedMessage = JSON.stringify(message) ?? "null";
|
|
21243
|
-
return `${messageIdOf(message) ?? ""}:${parts.length}:${Buffer.byteLength(serializedParts)}:${
|
|
21496
|
+
return `${messageIdOf(message) ?? ""}:${parts.length}:${Buffer.byteLength(serializedParts)}:${createHash15("sha256").update(serializedMessage).digest("hex")}`;
|
|
21244
21497
|
}
|
|
21245
21498
|
function advanceWireFingerprint(previous, encoded) {
|
|
21246
|
-
return
|
|
21499
|
+
return createHash15("sha256").update(previous).update("\\0").update(JSON.stringify(encoded) ?? "null").digest("hex");
|
|
21247
21500
|
}
|
|
21248
21501
|
function buildWireFingerprint(encoded) {
|
|
21249
21502
|
let fingerprint = "rust-wire-v1";
|
|
@@ -23042,7 +23295,7 @@ ${notice}`, {}));
|
|
|
23042
23295
|
const id = messageIdOf(message) ?? `index:${todoStart + offset}`;
|
|
23043
23296
|
const parts = message.parts?.filter((part) => isRecord3(part) && part.type === "tool" && part.tool === "todowrite");
|
|
23044
23297
|
if (parts?.length) {
|
|
23045
|
-
todoCalls.set(id,
|
|
23298
|
+
todoCalls.set(id, createHash15("sha256").update(JSON.stringify(parts)).digest("hex"));
|
|
23046
23299
|
} else {
|
|
23047
23300
|
todoCalls.delete(id);
|
|
23048
23301
|
}
|
|
@@ -25342,6 +25595,7 @@ function createTransform(deps) {
|
|
|
25342
25595
|
}
|
|
25343
25596
|
noteServedModel(sessionId, modelForBudget);
|
|
25344
25597
|
const resolvedProviderID = modelForBudget?.providerID;
|
|
25598
|
+
const refusedInputTokens = takeProviderRefusedInputTokens(sessionId, modelForBudget ? `${modelForBudget.providerID}/${modelForBudget.modelID}` : undefined);
|
|
25345
25599
|
activeThinkingTurn ||= hasActiveAnthropicThinkingTurn(messages, resolvedProviderID, modelForBudget?.modelID);
|
|
25346
25600
|
const signedThinkingPrefixBound = activeThinkingTurn && (isPrefixBoundThinkingModel(activeThinkingModel?.providerID, activeThinkingModel?.modelID) || isPrefixBoundThinkingModel(resolvedProviderID, modelForBudget?.modelID));
|
|
25347
25601
|
const canUseEmptySentinels = modelAcceptsEmptyContent(resolvedProviderID);
|
|
@@ -25420,6 +25674,7 @@ function createTransform(deps) {
|
|
|
25420
25674
|
messages,
|
|
25421
25675
|
usagePercentage: contextUsageEarly.percentage,
|
|
25422
25676
|
executeThresholdPercentage: effectiveExecuteThresholdPercentage,
|
|
25677
|
+
refusedInputTokens,
|
|
25423
25678
|
forceBandPressure: forceBandConfirmed({
|
|
25424
25679
|
percentage: contextUsageEarly.percentage,
|
|
25425
25680
|
fromEstimate: hostOverWindow,
|
|
@@ -26226,6 +26481,7 @@ ${notice}`, notificationParams));
|
|
|
26226
26481
|
const sizedHoldEnd = activeThinkingPrefixHold && !compactionOff && signedThinkingHold?.held === true ? readingEndsHold({
|
|
26227
26482
|
usagePercentage: contextUsage.percentage,
|
|
26228
26483
|
capPercentage: signedThinkingHold.capPercentage,
|
|
26484
|
+
refusedInputTokens,
|
|
26229
26485
|
forceBandPressure: forceBandConfirmed({
|
|
26230
26486
|
percentage: contextUsage.percentage,
|
|
26231
26487
|
fromEstimate: contextUsageFromEstimate,
|
|
@@ -26342,6 +26598,7 @@ ${notice}`, notificationParams));
|
|
|
26342
26598
|
protectedCutoff,
|
|
26343
26599
|
protectedCount: protectionWindow.status.protectedCount,
|
|
26344
26600
|
emergencyCeilingTokens,
|
|
26601
|
+
...refusedInputTokens === undefined ? {} : { refusedInputTokens },
|
|
26345
26602
|
pendingCompartmentInjection,
|
|
26346
26603
|
prefixTrimSourceOrder,
|
|
26347
26604
|
coveredHostInstructions,
|
|
@@ -26714,6 +26971,7 @@ ${notice}`, notificationParams));
|
|
|
26714
26971
|
}
|
|
26715
26972
|
}
|
|
26716
26973
|
reclaim?.markRetired();
|
|
26974
|
+
reclaim?.settle?.();
|
|
26717
26975
|
const signedThinkingServed = isPrefixBoundThinkingModel(modelForBudget?.providerID, modelForBudget?.modelID) && servesThinkingBlock2(messages, modelForBudget?.providerID, modelForBudget?.modelID);
|
|
26718
26976
|
finishSystemDateRefresh(deps.historyRefreshSessions, dateRequest, postTransformResult.bustedThisPass && !activeThinkingPrefixHold && !signedThinkingServed || postTransformResult.thinkingReleasedForFit === true, signedThinkingServed);
|
|
26719
26977
|
if (activeThinkingPrefixHold && !postTransformResult.thinkingReleasedForFit && sessionMeta.cachedM0Bytes != null && sessionMeta.cachedM1Bytes != null) {
|
|
@@ -27161,12 +27419,12 @@ function systemPromptDates(prompt, sticky) {
|
|
|
27161
27419
|
}
|
|
27162
27420
|
|
|
27163
27421
|
// src/hooks/magic-context/system-prompt-diagnostics.ts
|
|
27164
|
-
import { createHash as
|
|
27422
|
+
import { createHash as createHash16 } from "node:crypto";
|
|
27165
27423
|
function snapshotSystemPrompt(system, preset) {
|
|
27166
27424
|
return { elements: system.map((element) => Buffer.from(element)), preset };
|
|
27167
27425
|
}
|
|
27168
27426
|
function describeSystemPromptChange(previous, current) {
|
|
27169
|
-
const metadata = (element) => element === undefined ? "absent" : `bytes=${element.length},md5=${
|
|
27427
|
+
const metadata = (element) => element === undefined ? "absent" : `bytes=${element.length},md5=${createHash16("md5").update(element).digest("hex")}`;
|
|
27170
27428
|
const elements = [];
|
|
27171
27429
|
for (let index = 0;index < Math.max(previous?.elements.length ?? 0, current.elements.length); index++) {
|
|
27172
27430
|
const before = previous?.elements[index];
|
|
@@ -28006,12 +28264,23 @@ function createMessagesTransformHandler(args) {
|
|
|
28006
28264
|
const servedSessionId = args.recordServed === false ? null : resolveSessionId2(output);
|
|
28007
28265
|
if (servedSessionId)
|
|
28008
28266
|
beginServedRequest(servedSessionId);
|
|
28267
|
+
const refusalCounts = args.providerRefusalCounts;
|
|
28268
|
+
const pass = servedSessionId && refusalCounts && !resolveRust(servedSessionId) ? refusalCounts.begin(servedSessionId, Date.now()) : undefined;
|
|
28269
|
+
if (pass)
|
|
28270
|
+
pass.observeHistory(snapshotRefusalHistory(output.messages, readOpenCodeRefusalMessage));
|
|
28009
28271
|
let returned = false;
|
|
28010
28272
|
try {
|
|
28011
|
-
const served = await servePass(input, output);
|
|
28273
|
+
const served = await (servedSessionId && pass ? withProviderRefusalPass(servedSessionId, pass, () => servePass(input, output)) : servePass(input, output));
|
|
28012
28274
|
returned = true;
|
|
28275
|
+
if (pass) {
|
|
28276
|
+
try {
|
|
28277
|
+
refusalCounts?.captureMessages(pass, output.messages);
|
|
28278
|
+
} catch {}
|
|
28279
|
+
}
|
|
28013
28280
|
return served;
|
|
28014
28281
|
} catch (error) {
|
|
28282
|
+
if (pass && servedSessionId)
|
|
28283
|
+
refusalCounts?.discardPreparation(servedSessionId, pass);
|
|
28015
28284
|
if (args.onRefusal && isTransformRefusal(error) && !(error instanceof EmergencyFailClosedError && error.noticeHandled)) {
|
|
28016
28285
|
const sessionId = servedSessionId ?? resolveSessionId2(output);
|
|
28017
28286
|
if (sessionId) {
|
|
@@ -28066,7 +28335,7 @@ function truncateError(name, code, message, maxLen = 240) {
|
|
|
28066
28335
|
}
|
|
28067
28336
|
|
|
28068
28337
|
// src/plugin/subagent-tool-policy.ts
|
|
28069
|
-
var PRIMARY_ONLY_TOOLS = new Set(["ctx_memory", "ctx_note"]);
|
|
28338
|
+
var PRIMARY_ONLY_TOOLS = new Set(["ctx_memory", "ctx_note", CTX_MEMORY_CURATE_TOOL_NAME]);
|
|
28070
28339
|
function primaryOnlyToolIds(existing = []) {
|
|
28071
28340
|
return [...new Set([...existing, ...PRIMARY_ONLY_TOOLS])];
|
|
28072
28341
|
}
|
|
@@ -28359,23 +28628,6 @@ function createCtxExpandTools(deps) {
|
|
|
28359
28628
|
ctx_expand: createCtxExpandTool(deps)
|
|
28360
28629
|
};
|
|
28361
28630
|
}
|
|
28362
|
-
// src/tools/ctx-memory/constants.ts
|
|
28363
|
-
var CTX_MEMORY_TOOL_NAME = "ctx_memory";
|
|
28364
|
-
var CTX_MEMORY_LIST_TOOL_NAME = "ctx_memory_list";
|
|
28365
|
-
var CTX_MEMORY_LIST_DESCRIPTION = "Browse active memories, optionally filter by category.";
|
|
28366
|
-
var CTX_MEMORY_DESCRIPTION = `Durable facts about this project, shared with every agent working on it and kept for the months this work lasts.
|
|
28367
|
-
|
|
28368
|
-
Your active memories are already in <project-memory> as \`#id: fact\` lines. Write one when you learn something that must not have to be found again — a project rule, an architectural fact, a hard-won constraint, a config value, a naming convention — and especially when it cost you turns to find. One standalone fact per memory, phrased to make sense on its own. A pending intention with its evidence ("do X later, here is what we know") is ctx_note, not memory.
|
|
28369
|
-
|
|
28370
|
-
Actions:
|
|
28371
|
-
- write: new memory (content + category).
|
|
28372
|
-
- update: rewrite one memory whose fact changed (ids: [one], content; category: the current one to keep, a new one to recategorize).
|
|
28373
|
-
- archive: retire wrong or obsolete memories (ids: [one or more], optional reason).
|
|
28374
|
-
- merge: collapse duplicates into one (ids: [two or more distinct ids of memories in the same category], content).
|
|
28375
|
-
- get: fetch by id (ids: 1–20), readable in every status.
|
|
28376
|
-
The call form that works on every host sends action, content, category and ids every time: argument-dropping providers only emit required fields. For get and archive pass content="" and any valid category; for write pass ids=[].
|
|
28377
|
-
Examples: category="CONFIG_VALUES", content="OpenCode source is at ~/Work/OSS/opencode" · category="CONSTRAINTS", content="Dashboard Tauri build needs RGBA PNGs, not grayscale"`;
|
|
28378
|
-
var DEFAULT_SEARCH_LIMIT = 10;
|
|
28379
28631
|
// src/tools/ctx-memory/tools.ts
|
|
28380
28632
|
import { tool as tool2 } from "@opencode-ai/plugin";
|
|
28381
28633
|
|
|
@@ -28592,13 +28844,28 @@ function preflightCurateMutation(args) {
|
|
|
28592
28844
|
if (refusals.length === 0)
|
|
28593
28845
|
return { skip: null, successor };
|
|
28594
28846
|
let refused = 0;
|
|
28847
|
+
let steer = false;
|
|
28848
|
+
const leaveAlone = [];
|
|
28595
28849
|
for (const refusal of refusals) {
|
|
28596
28850
|
refused = recordCurateSafetyRefusal(args.sessionId, refusal);
|
|
28851
|
+
if (curateSafetyRefusalsForMemory(args.sessionId, refusal.memoryId) >= 3) {
|
|
28852
|
+
leaveAlone.push(refusal.memoryId);
|
|
28853
|
+
} else if (args.toolName === CTX_MEMORY_TOOL_NAME && params.superseded_by === undefined && (refusal.reason === "missing-active-same-category-successor" || refusal.reason === "content-loss")) {
|
|
28854
|
+
steer = true;
|
|
28855
|
+
}
|
|
28597
28856
|
}
|
|
28598
28857
|
const memoryIds = refusals.map((refusal) => refusal.memoryId).join(", ");
|
|
28599
28858
|
const reasons = [...new Set(refusals.map((refusal) => refusal.reason))].join(",");
|
|
28859
|
+
const guidance = [
|
|
28860
|
+
...steer ? [`Use ${CTX_MEMORY_CURATE_TOOL_NAME} to name the survivor with superseded_by.`] : [],
|
|
28861
|
+
...leaveAlone.map((id) => `Memory [ID: ${id}] is left as it is for this run. Do not try it again.`)
|
|
28862
|
+
];
|
|
28600
28863
|
return {
|
|
28601
|
-
skip:
|
|
28864
|
+
skip: [
|
|
28865
|
+
`Skipped ${params.action} for memory [ID: ${memoryIds}]: curate safety refusal (${reasons}); refused=${refused}.`,
|
|
28866
|
+
...guidance
|
|
28867
|
+
].join(`
|
|
28868
|
+
`),
|
|
28602
28869
|
successor
|
|
28603
28870
|
};
|
|
28604
28871
|
}
|
|
@@ -28642,12 +28909,16 @@ var ctxMemoryListArgsShape = {
|
|
|
28642
28909
|
category: tool2.schema.enum([...V2_MEMORY_CATEGORIES]).optional().describe("Filter listed memories to this category (optional)."),
|
|
28643
28910
|
limit: tool2.schema.number().optional().describe("Max results for list (default 10).")
|
|
28644
28911
|
};
|
|
28912
|
+
var ctxMemoryCurateArgsShape = {
|
|
28913
|
+
...ctxMemoryArgsShape,
|
|
28914
|
+
superseded_by: tool2.schema.number().optional().describe("ID of the active memory in the same project and category that keeps the information.")
|
|
28915
|
+
};
|
|
28645
28916
|
var ctxMemoryArgsSchema = tool2.schema.object({
|
|
28646
28917
|
...ctxMemoryArgsShape,
|
|
28647
|
-
superseded_by:
|
|
28918
|
+
superseded_by: ctxMemoryCurateArgsShape.superseded_by,
|
|
28648
28919
|
limit: tool2.schema.number().optional()
|
|
28649
28920
|
}).passthrough();
|
|
28650
|
-
function createCtxMemoryTool(deps) {
|
|
28921
|
+
function createCtxMemoryTool(deps, toolName = CTX_MEMORY_TOOL_NAME) {
|
|
28651
28922
|
const allowedActions = getAllowedActions(deps);
|
|
28652
28923
|
return tool2({
|
|
28653
28924
|
description: CTX_MEMORY_DESCRIPTION,
|
|
@@ -28696,7 +28967,8 @@ function createCtxMemoryTool(deps) {
|
|
|
28696
28967
|
const curatePreflight = toolContext.agent === DREAMER_AGENT ? preflightCurateMutation({
|
|
28697
28968
|
db: deps.db,
|
|
28698
28969
|
params: args,
|
|
28699
|
-
sessionId: toolContext.sessionID
|
|
28970
|
+
sessionId: toolContext.sessionID,
|
|
28971
|
+
toolName
|
|
28700
28972
|
}) : { skip: null, successor: null };
|
|
28701
28973
|
if (curatePreflight.skip)
|
|
28702
28974
|
return curatePreflight.skip;
|
|
@@ -29024,6 +29296,22 @@ function createCtxMemoryListTools(deps) {
|
|
|
29024
29296
|
[CTX_MEMORY_LIST_TOOL_NAME]: createCtxMemoryListTool(deps)
|
|
29025
29297
|
};
|
|
29026
29298
|
}
|
|
29299
|
+
function createDreamerMemoryTools(deps) {
|
|
29300
|
+
const memoryTool = createCtxMemoryTool(deps, CTX_MEMORY_CURATE_TOOL_NAME);
|
|
29301
|
+
return {
|
|
29302
|
+
...createCtxMemoryListTools(deps),
|
|
29303
|
+
[CTX_MEMORY_CURATE_TOOL_NAME]: tool2({
|
|
29304
|
+
description: "Maintain the project memory pool during Curate.",
|
|
29305
|
+
args: ctxMemoryCurateArgsShape,
|
|
29306
|
+
async execute(args, toolContext) {
|
|
29307
|
+
if (toolContext.agent !== DREAMER_AGENT) {
|
|
29308
|
+
return `Error: ${CTX_MEMORY_CURATE_TOOL_NAME} is only available to the dreamer agent.`;
|
|
29309
|
+
}
|
|
29310
|
+
return memoryTool.execute(args, toolContext);
|
|
29311
|
+
}
|
|
29312
|
+
})
|
|
29313
|
+
};
|
|
29314
|
+
}
|
|
29027
29315
|
// src/tools/ctx-note/constants.ts
|
|
29028
29316
|
var CTX_NOTE_DESCRIPTION = `Session notes are pending intentions: work you intend to return to, with its findings attached.
|
|
29029
29317
|
|
|
@@ -29830,7 +30118,7 @@ function formatCtxReduceReply(stampedCount, selfStampCount = 0) {
|
|
|
29830
30118
|
return parts.join(" ");
|
|
29831
30119
|
}
|
|
29832
30120
|
// src/tools/ctx-reduce/tools.ts
|
|
29833
|
-
import { createHash as
|
|
30121
|
+
import { createHash as createHash17 } from "node:crypto";
|
|
29834
30122
|
import { tool as tool4 } from "@opencode-ai/plugin";
|
|
29835
30123
|
|
|
29836
30124
|
// src/features/magic-context/range-parser.ts
|
|
@@ -29894,11 +30182,11 @@ function createCtxReduceTool(deps) {
|
|
|
29894
30182
|
const stableId = `oc-${sessionId}-${callId}`;
|
|
29895
30183
|
if (Buffer.byteLength(stableId) <= 128)
|
|
29896
30184
|
return stableId;
|
|
29897
|
-
return `oc-${
|
|
30185
|
+
return `oc-${createHash17("sha256").update(stableId).digest("hex")}`;
|
|
29898
30186
|
}
|
|
29899
30187
|
fallbackCommandSequence += 1;
|
|
29900
30188
|
const monotonicId = `oc-${sessionId}-${fallbackCommandSequence}`;
|
|
29901
|
-
return Buffer.byteLength(monotonicId) <= 128 ? monotonicId : `oc-${
|
|
30189
|
+
return Buffer.byteLength(monotonicId) <= 128 ? monotonicId : `oc-${createHash17("sha256").update(monotonicId).digest("hex")}`;
|
|
29902
30190
|
};
|
|
29903
30191
|
return tool4({
|
|
29904
30192
|
description: CTX_REDUCE_DESCRIPTION,
|
|
@@ -30752,4 +31040,4 @@ function applyHiddenSubagentTemperature(input, output, log) {
|
|
|
30752
31040
|
output.temperature = temperature;
|
|
30753
31041
|
}
|
|
30754
31042
|
|
|
30755
|
-
export { logConfigDependencyNotesOnce, openOpenCodeDb, DREAMER_SYSTEM_PROMPT, runSessionProjectBackfill, SMART_NOTE_COMPILER_SYSTEM_PROMPT, createLiveSessionState, RETROSPECTIVE_MAX_USER_MESSAGE_CHARS, RETROSPECTIVE_MESSAGE_TRUNCATION_MARKER, OpenCodeRetrospectiveRawProvider, createDreamTaskExecutor, runManualDream, runDueTasksForProject, startDreamScheduleTimer, createDreamTimerModuleClient, ensureProjectRegisteredFromOpenCodeDirectory, describeStorageUnavailability, resolveSessionCacheTtl, runEmbedHistoryDrain, pauseEmbedHistoryDrain, formatEmbedStatusText, getSessionProperties, getSessionCreatedInfo, getMessageUpdatedAssistantInfo, getMessageUpdatedInfo, getSessionErrorInfo, getMessageRemovedInfo, summarizeManualDream, createMagicContextCommandHandler, getLiveNotificationParams, createChatMessageHook, createEventHook, createCommandExecuteBeforeHook, createToolExecuteAfterHook, recordHiddenVariantWarning, buildStatusDetail, isDebugRpcEnabled, registerRpcHandlers, recordHostSqliteRuntime, maybeAutoEmbedSessionBackfill, clearTransformDecisionSession, scheduleOpenCodeTransformDecisionWrite, stageOpenCodeV2TransformDecision, bindOpenCodeV2TransformDecision, maybeDeliverChannel2, PROVIDER_OVERFLOW_NOTICE, noteServedRecoveryForOverflowHint, holdOverflowResendHint, createM0RenderOptions, lkgReplayLimit, measureLkgReplay, moduleRawBlockMappings, STORAGE_BUSY_MESSAGE, StorageBusyRefusalError, bindSystemDateRequestIdentity, bindSystemDateOutput, registerSystemDateRefresh, rustWrapupHistorianFields, isClearlyOverWindow, UnmanagedOverWindowError, UnresolvedHistoryBoundaryError, clearMessageTokensCache, rendersCompartmentHistory, createTransform, createSubcModuleClient, createModuleToolBackends, createRustRefusalRecovery, createSystemPromptHashHandler, tryMessagesTransformLkgReplay, createMessagesTransformHandler, primaryOnlyToolIds, subagentToolRefusal, guardSubagentTools, hideSubagentTools, removePrimaryOnlyTools, storedSubagentMode, createCtxExpandTools,
|
|
31043
|
+
export { logConfigDependencyNotesOnce, openOpenCodeDb, DREAMER_SYSTEM_PROMPT, runSessionProjectBackfill, SMART_NOTE_COMPILER_SYSTEM_PROMPT, createLiveSessionState, RETROSPECTIVE_MAX_USER_MESSAGE_CHARS, RETROSPECTIVE_MESSAGE_TRUNCATION_MARKER, OpenCodeRetrospectiveRawProvider, createDreamTaskExecutor, runManualDream, runDueTasksForProject, startDreamScheduleTimer, createDreamTimerModuleClient, ensureProjectRegisteredFromOpenCodeDirectory, describeStorageUnavailability, resolveSessionCacheTtl, runEmbedHistoryDrain, pauseEmbedHistoryDrain, formatEmbedStatusText, getSessionProperties, getSessionCreatedInfo, getMessageUpdatedAssistantInfo, getMessageUpdatedInfo, getSessionErrorInfo, getMessageRemovedInfo, summarizeManualDream, createMagicContextCommandHandler, getLiveNotificationParams, createChatMessageHook, createEventHook, createCommandExecuteBeforeHook, createToolExecuteAfterHook, recordHiddenVariantWarning, buildStatusDetail, isDebugRpcEnabled, registerRpcHandlers, recordHostSqliteRuntime, maybeAutoEmbedSessionBackfill, clearTransformDecisionSession, scheduleOpenCodeTransformDecisionWrite, stageOpenCodeV2TransformDecision, bindOpenCodeV2TransformDecision, maybeDeliverChannel2, PROVIDER_OVERFLOW_NOTICE, noteServedRecoveryForOverflowHint, holdOverflowResendHint, ProviderRefusalCounts, snapshotRefusalHistory, pushRefusalFields, withProviderRefusalPass, createM0RenderOptions, lkgReplayLimit, measureLkgReplay, moduleRawBlockMappings, STORAGE_BUSY_MESSAGE, StorageBusyRefusalError, bindSystemDateRequestIdentity, bindSystemDateOutput, registerSystemDateRefresh, rustWrapupHistorianFields, isClearlyOverWindow, UnmanagedOverWindowError, UnresolvedHistoryBoundaryError, clearMessageTokensCache, rendersCompartmentHistory, createTransform, createSubcModuleClient, createModuleToolBackends, createRustRefusalRecovery, createSystemPromptHashHandler, tryMessagesTransformLkgReplay, createMessagesTransformHandler, primaryOnlyToolIds, subagentToolRefusal, guardSubagentTools, hideSubagentTools, removePrimaryOnlyTools, storedSubagentMode, createCtxExpandTools, CTX_MEMORY_ACTIONS, createCtxMemoryTools, createDreamerMemoryTools, CTX_NOTE_DESCRIPTION, withoutSmartNoteText, createCtxNoteTools, createCtxReduceTools, createCtxSearchTools, parameterDescriptionsFor, applyJsonSchemaParameterDescriptions, MagicContextRpcServer, subagentTemperature, applyHiddenSubagentTemperature };
|