@cortexkit/opencode-magic-context 0.46.1 → 0.47.0
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/auto-search-worker.js +115 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/live-run-config.d.ts.map +1 -1
- package/dist/config/migrate-config-location.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +11 -3
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-7fj2b9jw.js → conflict-warning-hook-z44ynfz7.js} +5 -4
- package/dist/{context-sh2m2vde.js → context-wq4ffwyb.js} +108 -23
- package/dist/{derive-budgets-7nj7r1rv.js → derive-budgets-ke12jnnh.js} +1 -1
- package/dist/embedding-worker.js +2 -2
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +2 -0
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +7 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +2 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-storage.d.ts +8 -2
- package/dist/features/magic-context/session-project-storage.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +2 -5
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +12 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +7 -2
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +1 -0
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +3 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/hooks/magic-context/active-anthropic-turn.d.ts +8 -0
- package/dist/hooks/magic-context/active-anthropic-turn.d.ts.map +1 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-blocking.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-blocking.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-deadline.d.ts +7 -0
- package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-host-review.fixture.d.ts +3 -0
- package/dist/hooks/magic-context/auto-search-host-review.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-lock-review.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-lock-review.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-long-lock-review.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-long-lock-review.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-omp-host-review.fixture.d.ts +4 -0
- package/dist/hooks/magic-context/auto-search-omp-host-review.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-omp-loader.fixture.d.ts +3 -0
- package/dist/hooks/magic-context/auto-search-omp-loader.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-snapshot.fixture.d.ts +4 -0
- package/dist/hooks/magic-context/auto-search-snapshot.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +69 -0
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-worker.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-worker.d.ts.map +1 -0
- package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +3 -5
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts +2 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +3 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +2 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-drain-gate.d.ts +11 -0
- package/dist/hooks/magic-context/historian-drain-gate.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook.d.ts +2 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts +25 -0
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts.map +1 -0
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts +61 -0
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts.map +1 -0
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/opencode-proven-floor.d.ts +6 -0
- package/dist/hooks/magic-context/opencode-proven-floor.d.ts.map +1 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/reasoning-budget-status.d.ts +15 -0
- package/dist/hooks/magic-context/reasoning-budget-status.d.ts.map +1 -0
- package/dist/hooks/magic-context/reasoning-budget.d.ts +40 -0
- package/dist/hooks/magic-context/reasoning-budget.d.ts.map +1 -0
- package/dist/hooks/magic-context/reasoning-removal.d.ts +6 -6
- package/dist/hooks/magic-context/reasoning-removal.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts +4 -0
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +7 -3
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +13 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts +5 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +3 -28
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +28 -6
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +3 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-0d3g3461.js → index-0c82743p.js} +2 -1
- package/dist/{index-5p8jdswx.js → index-5a2r0p9f.js} +3 -3
- package/dist/{index-sjthx78w.js → index-6d9e1m08.js} +4647 -11000
- package/dist/{index-majxda46.js → index-6wkcswft.js} +1 -1
- package/dist/index-92bp57hg.js +2063 -0
- package/dist/{index-sfnj6h8h.js → index-9pk9exrb.js} +3 -3
- package/dist/{index-7qw742ev.js → index-adwfkpex.js} +5 -24
- package/dist/{index-3h0ybwah.js → index-bb36vgr3.js} +80 -12
- package/dist/{index-pkbcrdqs.js → index-cwf6s3ay.js} +1072 -2422
- package/dist/index-fnn5pjtt.js +6554 -0
- package/dist/{index-sgthv3f7.js → index-gg8j07zz.js} +1 -1
- package/dist/{index-8x2v7gg9.js → index-m5fe6jch.js} +7 -3
- package/dist/{v2/server-g0fjrkta.js → index-rrbbspwh.js} +42 -27
- package/dist/index-rrrsepyw.js +3464 -0
- package/dist/{index-hpecdzec.js → index-w2t4ah5j.js} +948 -501
- package/dist/{v2/server-fg34g6a5.js → index-wx8a6bw3.js} +48 -8
- package/dist/{index-r5hmbx3t.js → index-x3kwrmqk.js} +146 -3571
- package/dist/index-yr3zj7e7.js +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +624 -65
- package/dist/{message-time-backfill-68gj6t3e.js → message-time-backfill-r5epkzj3.js} +1 -1
- package/dist/migration-worker.js +7 -5
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/host-stall-profiler-report.d.ts +67 -0
- package/dist/plugin/host-stall-profiler-report.d.ts.map +1 -0
- package/dist/plugin/host-stall-profiler.d.ts +96 -0
- package/dist/plugin/host-stall-profiler.d.ts.map +1 -0
- package/dist/plugin/messages-transform.d.ts +21 -6
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/{read-session-chunk-egz7r68d.js → read-session-chunk-4jey7hpt.js} +4 -4
- package/dist/{recomp-orchestrator-y15j0rb9.js → recomp-orchestrator-rervg6q4.js} +13 -10
- package/dist/{send-session-notification-dyw42dtr.js → send-session-notification-0m68ms3n.js} +4 -3
- package/dist/shared/auto-search-lifecycle.d.ts +7 -0
- package/dist/shared/auto-search-lifecycle.d.ts.map +1 -0
- package/dist/shared/historian-tool-expansions.d.ts +1 -1
- package/dist/shared/historian-tool-expansions.d.ts.map +1 -1
- package/dist/shared/historian-tool-template.d.ts +2 -2
- package/dist/shared/historian-tool-template.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts +16 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/status-view.d.ts.map +1 -1
- package/dist/shared/window-geometry.d.ts +4 -0
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-bqhz6vdr.js → transform-postprocess-phase-z5hzpsxv.js} +13 -10
- package/dist/v2/auto-search-worker.js +115 -0
- package/dist/v2/{context-zecmzk5s.js → context-14v1hr8b.js} +3783 -4668
- package/dist/v2/{derive-budgets-kdgp4s3r.js → derive-budgets-nc9avxz8.js} +2 -2
- package/dist/v2/embedding-worker.js +3 -3
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/{message-time-backfill-r6qkem1x.js → message-time-backfill-1f9tzvcs.js} +1 -1
- package/dist/v2/migration-worker.js +7 -5
- package/dist/v2/{read-session-chunk-8vjp6581.js → read-session-chunk-gyyv7w2r.js} +4 -4
- package/dist/v2/{recomp-orchestrator-8ejxvrzz.js → recomp-orchestrator-42vjba7p.js} +17 -14
- package/dist/v2/{send-session-notification-qs0j78v6.js → send-session-notification-c0wtscea.js} +5 -4
- package/dist/v2/server-3trjk1hx.js +6360 -0
- package/dist/v2/{server-e29d7p7c.js → server-50hvkg3v.js} +7 -3
- package/dist/v2/{server-y8maxeft.js → server-cpepxy2q.js} +2 -1
- package/dist/v2/server-d0sraw7m.js +3403 -0
- package/dist/v2/server-e0c1b7a7.js +2063 -0
- package/dist/v2/{server-mcfawjgc.js → server-efhwzx05.js} +5 -24
- package/dist/v2/{server-3n4q9xme.js → server-fcdehk1s.js} +1 -1
- package/dist/{index-q4yp4b52.js → v2/server-fq7kq32k.js} +42 -27
- package/dist/v2/{server-jc7y02q0.js → server-nf82q6pt.js} +1117 -7290
- package/dist/v2/{server-frbm99q5.js → server-njt3np1k.js} +99 -3465
- package/dist/v2/{server-qp5hx1ad.js → server-nm9n3aqq.js} +107 -12
- package/dist/v2/{server-c5gz8wph.js → server-rz514f14.js} +7 -2
- package/dist/v2/{server-wvjvfhck.js → server-vd4e7174.js} +1 -1
- package/dist/{index-fg34g6a5.js → v2/server-wx8a6bw3.js} +48 -8
- package/dist/v2/{server-xa4xe3rv.js → server-y10vbq6y.js} +1 -1
- package/dist/v2/server-yr3zj7e7.js +23 -0
- package/dist/v2/server.js +5 -5
- package/dist/v2/{wrapup-orchestrator-0snhvwcv.js → wrapup-orchestrator-nbz854vc.js} +16 -13
- package/dist/wrapup-orchestrator-b2dztrar.js +29 -0
- package/package.json +3 -3
- package/src/config/index.ts +6 -0
- package/src/config/live-run-config.test.ts +37 -1
- package/src/config/live-run-config.ts +28 -0
- package/src/config/migrate-config-location.ts +10 -3
- package/src/config/schema/magic-context.test.ts +4 -3
- package/src/config/schema/magic-context.ts +18 -6
- package/src/shared/auto-search-lifecycle.ts +27 -0
- package/src/shared/historian-tool-defaults.json +6 -6
- package/src/shared/historian-tool-expansions.ts +65 -8
- package/src/shared/historian-tool-preview-defaults.json +13 -0
- package/src/shared/historian-tool-template.ts +48 -14
- package/src/shared/sqlite-640-review-r2.test.ts +136 -0
- package/src/shared/sqlite-640-review.test.ts +183 -0
- package/src/shared/sqlite-acquisition-routing.test.ts +18 -0
- package/src/shared/sqlite.ts +84 -14
- package/src/shared/status-view.test.ts +6 -1
- package/src/shared/status-view.ts +15 -1
- package/src/shared/tag-transcript.ts +6 -0
- package/src/shared/window-geometry.ts +10 -0
- package/dist/wrapup-orchestrator-39amhv9s.js +0 -26
- /package/dist/{index-en1k8h8m.js → index-5prbx026.js} +0 -0
- /package/dist/v2/{index-en1k8h8m.js → index-5prbx026.js} +0 -0
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
SynapseEmbeddingProvider,
|
|
25
25
|
computeNormalizedHash,
|
|
26
26
|
getLocalEmbeddingNativeMemoryStats
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-m5fe6jch.js";
|
|
28
28
|
import {
|
|
29
29
|
getHarness,
|
|
30
30
|
harnessOwnsOpenCodeStore,
|
|
@@ -63,11 +63,8 @@ import {
|
|
|
63
63
|
isTransientSqliteError,
|
|
64
64
|
SqliteAcquisitionBusyError,
|
|
65
65
|
withAsyncPrivilegedWriter
|
|
66
|
-
} from "./index-
|
|
66
|
+
} from "./index-wx8a6bw3.js";
|
|
67
67
|
import {
|
|
68
|
-
isFailClosedBlockingError,
|
|
69
|
-
shouldBypassFailClosedBlock,
|
|
70
|
-
resolveAgentNameFromMessages,
|
|
71
68
|
canonicalProjectDirectory,
|
|
72
69
|
shouldSkipHomeProjectMemory,
|
|
73
70
|
ProjectIdentityError,
|
|
@@ -82,12 +79,6 @@ import {
|
|
|
82
79
|
storedPathBelongsToIdentity,
|
|
83
80
|
beginBootQuietPeriod,
|
|
84
81
|
scheduleAfterBootQuiet,
|
|
85
|
-
registerOwnRpcServerInstance,
|
|
86
|
-
rpcPortDir,
|
|
87
|
-
rpcPortFilePath,
|
|
88
|
-
parseRpcPortFile,
|
|
89
|
-
inspectProcessesAsync,
|
|
90
|
-
configureContextDatabasePragmas,
|
|
91
82
|
layoutLkgPrefix,
|
|
92
83
|
assembleLkgPrefix,
|
|
93
84
|
V2_MEMORY_CATEGORIES,
|
|
@@ -98,7 +89,238 @@ import {
|
|
|
98
89
|
expandWorkspaceIdentitySetWithAliases,
|
|
99
90
|
resolveStoredPathWorkspaceIdentity,
|
|
100
91
|
storedPathBelongsToWorkspace,
|
|
101
|
-
computeWorkspaceEpochFingerprint
|
|
92
|
+
computeWorkspaceEpochFingerprint
|
|
93
|
+
} from "./index-x3kwrmqk.js";
|
|
94
|
+
import {
|
|
95
|
+
recordSessionProjectIdentity,
|
|
96
|
+
hasRecordedSessionProjectIdentity,
|
|
97
|
+
getMessageIndexSourceIdentity,
|
|
98
|
+
isMessageIndexSourceCurrent,
|
|
99
|
+
getLastIndexedOrdinal,
|
|
100
|
+
getMessageIndexReconciliationStartOrdinal,
|
|
101
|
+
isMessageIndexReconciledThrough,
|
|
102
|
+
clearIndexedMessages,
|
|
103
|
+
indexSingleMessage,
|
|
104
|
+
indexMessagesAfterOrdinal,
|
|
105
|
+
sweepOrphanedOpenCodeMessageIndexes,
|
|
106
|
+
SESSION_NOTE_CONDITION_ERROR,
|
|
107
|
+
getNoteByIdInScope,
|
|
108
|
+
getNotes,
|
|
109
|
+
addNote,
|
|
110
|
+
getSessionNotes,
|
|
111
|
+
getPendingSmartNotes,
|
|
112
|
+
getReadySmartNotes,
|
|
113
|
+
updateNote,
|
|
114
|
+
dismissNotes,
|
|
115
|
+
dismissNote,
|
|
116
|
+
markNoteReady,
|
|
117
|
+
markNoteChecked,
|
|
118
|
+
PRIMER_CANDIDATE_TTL_MS,
|
|
119
|
+
PRIMER_CANDIDATE_MAX_AGE_MS,
|
|
120
|
+
primerOccurrenceKey,
|
|
121
|
+
primerOccurrenceUtcDay,
|
|
122
|
+
updatePrimerCandidateEmbedding,
|
|
123
|
+
getPrimerCandidatesByIds,
|
|
124
|
+
getPrimerCandidatesForPromotion,
|
|
125
|
+
countPrimerCandidatesForProject,
|
|
126
|
+
getActivePrimers,
|
|
127
|
+
createPrimer,
|
|
128
|
+
updatePrimerSupport,
|
|
129
|
+
updatePrimerAnswer,
|
|
130
|
+
cosineSimilarity,
|
|
131
|
+
drainBackgroundBatches,
|
|
132
|
+
GIT_SWEEP_LEASE_RENEWAL_MS,
|
|
133
|
+
acquireGitSweepLease,
|
|
134
|
+
renewGitSweepLease,
|
|
135
|
+
markGitSweepSuccessAndRelease,
|
|
136
|
+
parkGitSweepNonIndexable,
|
|
137
|
+
releaseGitSweepLease,
|
|
138
|
+
saveEmbeddingIfHashMatches,
|
|
139
|
+
invalidateProject,
|
|
140
|
+
invalidateMemory,
|
|
141
|
+
describeShadowBackfillWriteRefusal,
|
|
142
|
+
markProjectLoadUntrusted,
|
|
143
|
+
drainProjectEmbeddingIdentityMaintenance,
|
|
144
|
+
drainStaleEmbeddingIdentitiesForProject,
|
|
145
|
+
registerProjectEmbedding,
|
|
146
|
+
registerProjectShadowEmbedding,
|
|
147
|
+
enqueueShadowEmbeddingItems,
|
|
148
|
+
registerProjectInObservationMode,
|
|
149
|
+
unregisterProjectShadowEmbedding,
|
|
150
|
+
getProjectEmbeddingSnapshot,
|
|
151
|
+
embedTextForProject,
|
|
152
|
+
embedBatchForProject,
|
|
153
|
+
embedUnembeddedMemoriesForProject,
|
|
154
|
+
embedUnembeddedMemoriesForProjectOutcome,
|
|
155
|
+
drainCommitBacklogForProject,
|
|
156
|
+
embedSessionCompartmentChunks,
|
|
157
|
+
getEmbeddingCoverageStatus,
|
|
158
|
+
computeCueContentHash,
|
|
159
|
+
hasMuralCueColumns,
|
|
160
|
+
getMuralCueState,
|
|
161
|
+
memoryNeedsCue,
|
|
162
|
+
setMuralCue,
|
|
163
|
+
recordMuralCueRejection,
|
|
164
|
+
hasMemoryShareableColumn,
|
|
165
|
+
hasMemoryClassifiedAtColumn,
|
|
166
|
+
getUnclassifiedMemoryIds,
|
|
167
|
+
insertMemory,
|
|
168
|
+
insertMemoryIdempotent,
|
|
169
|
+
getMemoryByHash,
|
|
170
|
+
getMemoriesByProject,
|
|
171
|
+
getMemoriesForList,
|
|
172
|
+
getMaxMemoryIdForProjects,
|
|
173
|
+
getMemoryById,
|
|
174
|
+
getMemoriesByIds,
|
|
175
|
+
updateMemorySeenCount,
|
|
176
|
+
setMemoryClassification,
|
|
177
|
+
supersededMemory,
|
|
178
|
+
mergeMemoryStats,
|
|
179
|
+
archiveMemory,
|
|
180
|
+
getMemoryCountsByStatus,
|
|
181
|
+
recordMemoryMapping,
|
|
182
|
+
recordMemoryVerifications,
|
|
183
|
+
getUnmappedMemoryIds,
|
|
184
|
+
clearMemoryVerifications,
|
|
185
|
+
getMemoryVerifications,
|
|
186
|
+
resolveGitTopLevel,
|
|
187
|
+
readGitHead,
|
|
188
|
+
readGitChangedFilesSince,
|
|
189
|
+
readGitFileChangeTimesSince,
|
|
190
|
+
verificationFileExists,
|
|
191
|
+
normalizeVerificationFiles
|
|
192
|
+
} from "./index-fnn5pjtt.js";
|
|
193
|
+
import {
|
|
194
|
+
hasTrustedAbsoluteWall,
|
|
195
|
+
applyProvenInputFloor,
|
|
196
|
+
formatWindowDerivationLine,
|
|
197
|
+
isSaneLimit,
|
|
198
|
+
getSdkWindowGeometry,
|
|
199
|
+
getSdkContextLimit,
|
|
200
|
+
getSdkOutputLimit,
|
|
201
|
+
deriveTriggerBudget2,
|
|
202
|
+
resolveKnownHistorianContextLimit2,
|
|
203
|
+
resolveHistorianProducerLimits2
|
|
204
|
+
} from "./index-0c82743p.js";
|
|
205
|
+
import {
|
|
206
|
+
resolveModelCalibration,
|
|
207
|
+
calibrateBuckets,
|
|
208
|
+
resolveDecisionCalibration
|
|
209
|
+
} from "./index-1zx87sdm.js";
|
|
210
|
+
import {
|
|
211
|
+
hasMeaningfulUserText2,
|
|
212
|
+
extractTexts2,
|
|
213
|
+
extractToolCallSummaries,
|
|
214
|
+
getTokenizerNativeMemoryStats,
|
|
215
|
+
estimateTokens,
|
|
216
|
+
estimateFixedPromptTokens,
|
|
217
|
+
normalizeText
|
|
218
|
+
} from "./index-5eqk6z3s.js";
|
|
219
|
+
import {
|
|
220
|
+
protectedToolTagNumbers,
|
|
221
|
+
protectedToolTokenCount,
|
|
222
|
+
peelLeadingMcTagNotation,
|
|
223
|
+
isRecord,
|
|
224
|
+
contentTagOwnerMessageId,
|
|
225
|
+
normalizeTodoStateJson,
|
|
226
|
+
computeSyntheticCallId,
|
|
227
|
+
CHANNEL1_SENTINEL,
|
|
228
|
+
toolOutputTokens,
|
|
229
|
+
decideChannel1,
|
|
230
|
+
evaluateChannel2,
|
|
231
|
+
formatChannel1Evaluation,
|
|
232
|
+
formatChannel2Evaluation,
|
|
233
|
+
reclaimableToolOutputCount,
|
|
234
|
+
buildChannel2Reminder,
|
|
235
|
+
buildChannel1Reminder,
|
|
236
|
+
queuePendingOp,
|
|
237
|
+
getPendingOps,
|
|
238
|
+
hasPendingDropOps,
|
|
239
|
+
clearPendingOps,
|
|
240
|
+
removePendingOp,
|
|
241
|
+
getTriggerTagTokenUpperBound,
|
|
242
|
+
getActiveTagTokenTotalsByMessage,
|
|
243
|
+
getReasoningTokenEstimatesByMessage,
|
|
244
|
+
updateTagStatus,
|
|
245
|
+
getInertWhitespaceAssistantTags,
|
|
246
|
+
deriveTagLoadFloor,
|
|
247
|
+
getTagsBySession,
|
|
248
|
+
getActiveTagsBySession,
|
|
249
|
+
getDroppedTagsBySession,
|
|
250
|
+
getTagsByNumbers,
|
|
251
|
+
getDroppedTagsByNumbers,
|
|
252
|
+
getMaxDroppedTagNumber,
|
|
253
|
+
getTagById,
|
|
254
|
+
expandToolPart,
|
|
255
|
+
isRawCompactionSummaryInfo,
|
|
256
|
+
extractInMemoryMessageViews,
|
|
257
|
+
buildInMemoryTailRawMessages,
|
|
258
|
+
estimateTrueRawMessageTokens,
|
|
259
|
+
toolPartHasUserAnswer,
|
|
260
|
+
DreamTokenBudgetExceeded,
|
|
261
|
+
isEditTool,
|
|
262
|
+
describeFinalWireTail,
|
|
263
|
+
estimateMessageTokens,
|
|
264
|
+
wireContentBytes,
|
|
265
|
+
createFinalWireUsageTracker,
|
|
266
|
+
estimateFinalWireInputTokens,
|
|
267
|
+
estimateAppendedWireTokens,
|
|
268
|
+
detectLatestTurnThinkingMismatch,
|
|
269
|
+
isPrefixBoundThinkingModel,
|
|
270
|
+
detectOverflow,
|
|
271
|
+
modelAcceptsEmptyContent,
|
|
272
|
+
isAnthropicFamilyRoute,
|
|
273
|
+
variantChangeBustsProviderCache,
|
|
274
|
+
setRawMessageProvider2,
|
|
275
|
+
cleanUserText2,
|
|
276
|
+
withRawSessionMessageCache2,
|
|
277
|
+
readRawSessionMessages2,
|
|
278
|
+
visitRawSessionMessages2,
|
|
279
|
+
primeTailRawMessageCache2,
|
|
280
|
+
primeInMemoryTailRawMessageCache2,
|
|
281
|
+
readRawSessionMessageOrdinalPage2,
|
|
282
|
+
getRawSessionStoredMessageCount2,
|
|
283
|
+
readRawSessionMessageIdOrdinalsForRange2,
|
|
284
|
+
readRawSessionMessagePartsById2,
|
|
285
|
+
readRawSessionMessageById2,
|
|
286
|
+
readSessionChunk2,
|
|
287
|
+
readRawSessionSeedTail2
|
|
288
|
+
} from "./index-bb36vgr3.js";
|
|
289
|
+
import {
|
|
290
|
+
observeTemporalDecisions,
|
|
291
|
+
getMeasuredToolDefinitionTokens
|
|
292
|
+
} from "./index-5gq3b2ya.js";
|
|
293
|
+
import {
|
|
294
|
+
openCodeDbExists,
|
|
295
|
+
withReadOnlySessionDb,
|
|
296
|
+
assistantAwaitingTools,
|
|
297
|
+
latestPersistedMessageForRecovery,
|
|
298
|
+
findLastAssistantModelFromOpenCodeDb
|
|
299
|
+
} from "./index-6wkcswft.js";
|
|
300
|
+
import {
|
|
301
|
+
CANONICAL_DREAM_TASKS,
|
|
302
|
+
DREAM_TASK_CAPABILITIES,
|
|
303
|
+
toolLoopDreamTasks,
|
|
304
|
+
formatDreamTaskBacklogs,
|
|
305
|
+
formatDreamTaskFailures,
|
|
306
|
+
processedDreamTaskItems,
|
|
307
|
+
leaseKindFor,
|
|
308
|
+
leaseKeyFor,
|
|
309
|
+
isCanonicalDreamTask,
|
|
310
|
+
compareTaskOrder,
|
|
311
|
+
buildDreamTaskRuntimeConfigs2,
|
|
312
|
+
userMemoryCollectionEnabled2
|
|
313
|
+
} from "./index-mc22ayvf.js";
|
|
314
|
+
import {
|
|
315
|
+
isFailClosedBlockingError,
|
|
316
|
+
shouldBypassFailClosedBlock,
|
|
317
|
+
resolveAgentNameFromMessages,
|
|
318
|
+
registerOwnRpcServerInstance,
|
|
319
|
+
rpcPortDir,
|
|
320
|
+
rpcPortFilePath,
|
|
321
|
+
parseRpcPortFile,
|
|
322
|
+
inspectProcessesAsync,
|
|
323
|
+
configureContextDatabasePragmas,
|
|
102
324
|
getUnconfirmedMigrationHolders,
|
|
103
325
|
getSchemaFenceRejection,
|
|
104
326
|
getMigrationOnOpenRefusal,
|
|
@@ -108,7 +330,7 @@ import {
|
|
|
108
330
|
runSqliteOptimize,
|
|
109
331
|
openDatabase,
|
|
110
332
|
openCurrentDatabase
|
|
111
|
-
} from "./index-
|
|
333
|
+
} from "./index-rrrsepyw.js";
|
|
112
334
|
import {
|
|
113
335
|
getMagicContextBuiltinCommands,
|
|
114
336
|
formatConfigParseStatusLine,
|
|
@@ -129,8 +351,6 @@ import {
|
|
|
129
351
|
renderDreamFailure,
|
|
130
352
|
dreamFailureCode,
|
|
131
353
|
renderEmbeddingFailure,
|
|
132
|
-
recordSessionProjectIdentity,
|
|
133
|
-
hasRecordedSessionProjectIdentity,
|
|
134
354
|
clampProducerAtomChars,
|
|
135
355
|
producerInputTokenLimit,
|
|
136
356
|
historianProducerReserve,
|
|
@@ -146,20 +366,13 @@ import {
|
|
|
146
366
|
embedRunStateBySession,
|
|
147
367
|
invalidateAutoEmbedSession,
|
|
148
368
|
getEmbedDrainUiStatus,
|
|
369
|
+
ensureSessionMetaRow,
|
|
149
370
|
getCompartments,
|
|
150
371
|
getLastCompartmentEndMessage,
|
|
151
372
|
getLastCompartmentEndMessageId,
|
|
152
|
-
getMessageIndexSourceIdentity,
|
|
153
|
-
isMessageIndexSourceCurrent,
|
|
154
|
-
getLastIndexedOrdinal,
|
|
155
|
-
getMessageIndexReconciliationStartOrdinal,
|
|
156
|
-
isMessageIndexReconciledThrough,
|
|
157
|
-
clearIndexedMessages,
|
|
158
|
-
indexSingleMessage,
|
|
159
|
-
indexMessagesAfterOrdinal,
|
|
160
|
-
sweepOrphanedOpenCodeMessageIndexes,
|
|
161
373
|
MAX_EXECUTE_THRESHOLD,
|
|
162
374
|
escalationBands,
|
|
375
|
+
decodeMergedReasoningParts,
|
|
163
376
|
sessionDecisionCalibration,
|
|
164
377
|
getProtectionWindowForSession,
|
|
165
378
|
isRustMarkerAdmissionFenced,
|
|
@@ -176,6 +389,7 @@ import {
|
|
|
176
389
|
resolveCompactionModeRecord,
|
|
177
390
|
getCompactionModeRecord,
|
|
178
391
|
setCompactionModeRecord,
|
|
392
|
+
getProtectedTailDrainBudgetSkip,
|
|
179
393
|
clearPersistedReasoningWatermark,
|
|
180
394
|
getEmergencyInputSample,
|
|
181
395
|
clearEmergencyDropSample,
|
|
@@ -209,7 +423,10 @@ import {
|
|
|
209
423
|
getPersistedCompactionMarkerState,
|
|
210
424
|
setPersistedCompactionMarkerState,
|
|
211
425
|
getStrippedPlaceholderIds,
|
|
426
|
+
getThinkingBindingRecoveryTarget,
|
|
427
|
+
armThinkingBindingRecovery,
|
|
212
428
|
clearThinkingBindingRecoveryIf,
|
|
429
|
+
getMergedReasoningStrippedIds,
|
|
213
430
|
getStaleReduceStrippedIds,
|
|
214
431
|
getProcessedImageStrippedIds,
|
|
215
432
|
getPendingCompactionMarkerState,
|
|
@@ -218,6 +435,7 @@ import {
|
|
|
218
435
|
setSessionWorkMetrics,
|
|
219
436
|
getObservedEpochFloor,
|
|
220
437
|
resolveEpochFloorForPass,
|
|
438
|
+
providerResponseFailed,
|
|
221
439
|
claimLkgRequestIdentity,
|
|
222
440
|
noteCapturedLkgRequest,
|
|
223
441
|
measuredLkgPrefix,
|
|
@@ -240,6 +458,7 @@ import {
|
|
|
240
458
|
dropSlot,
|
|
241
459
|
noteEntry,
|
|
242
460
|
getLkgSlotHeapStats,
|
|
461
|
+
TOOL_SWEEP_SCOPED_MARKER,
|
|
243
462
|
useScopedToolSweep,
|
|
244
463
|
createPreAdoptionToolSweepResolver,
|
|
245
464
|
queueMemoryMutation,
|
|
@@ -248,117 +467,31 @@ import {
|
|
|
248
467
|
updateSessionMeta,
|
|
249
468
|
retryPendingSessionCleanups,
|
|
250
469
|
retryPendingRustSessionCleanupsForProject,
|
|
251
|
-
SESSION_NOTE_CONDITION_ERROR,
|
|
252
|
-
getNoteByIdInScope,
|
|
253
|
-
getNotes,
|
|
254
|
-
addNote,
|
|
255
|
-
getSessionNotes,
|
|
256
|
-
getPendingSmartNotes,
|
|
257
|
-
getReadySmartNotes,
|
|
258
|
-
updateNote,
|
|
259
|
-
dismissNotes,
|
|
260
|
-
dismissNote,
|
|
261
|
-
markNoteReady,
|
|
262
|
-
markNoteChecked,
|
|
263
|
-
PRIMER_CANDIDATE_TTL_MS,
|
|
264
|
-
PRIMER_CANDIDATE_MAX_AGE_MS,
|
|
265
|
-
primerOccurrenceKey,
|
|
266
|
-
primerOccurrenceUtcDay,
|
|
267
|
-
updatePrimerCandidateEmbedding,
|
|
268
|
-
getPrimerCandidatesByIds,
|
|
269
|
-
getPrimerCandidatesForPromotion,
|
|
270
|
-
countPrimerCandidatesForProject,
|
|
271
|
-
getActivePrimers,
|
|
272
|
-
createPrimer,
|
|
273
|
-
updatePrimerSupport,
|
|
274
|
-
updatePrimerAnswer,
|
|
275
470
|
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
276
|
-
getProjectState,
|
|
277
|
-
bumpProjectUserProfileVersion,
|
|
278
|
-
createChildSessionWithFence,
|
|
279
|
-
HiddenCompletionRefusal,
|
|
280
|
-
DreamerProviderOutputFailureError,
|
|
281
|
-
withDreamerModelCooldown,
|
|
282
|
-
providerOutputFailureFromInvalidManifest,
|
|
283
|
-
extractLatestAssistantText,
|
|
284
|
-
hasLengthCappedOutput,
|
|
285
|
-
parseProviderModel,
|
|
286
|
-
modelBodyField,
|
|
287
|
-
toModelEntry,
|
|
288
|
-
isPromptTimeoutError,
|
|
289
|
-
getPromptFailureDetail,
|
|
290
|
-
promptSyncWithValidatedOutputRetry,
|
|
291
|
-
normalizeSDKResponse,
|
|
292
|
-
failedInvocationStatus,
|
|
293
|
-
recordChildInvocation,
|
|
294
|
-
createPromptAsyncTransport,
|
|
295
|
-
promptSurfaceHashMaterial,
|
|
296
|
-
createPromptSurfaceRuntime,
|
|
297
|
-
createPromptSurfaceGuidanceEpochCache,
|
|
298
|
-
teardownChildSession,
|
|
299
|
-
getCompartmentEvents,
|
|
300
|
-
cosineSimilarity,
|
|
301
|
-
drainBackgroundBatches,
|
|
302
|
-
GIT_SWEEP_LEASE_RENEWAL_MS,
|
|
303
|
-
acquireGitSweepLease,
|
|
304
|
-
renewGitSweepLease,
|
|
305
|
-
markGitSweepSuccessAndRelease,
|
|
306
|
-
parkGitSweepNonIndexable,
|
|
307
|
-
releaseGitSweepLease,
|
|
308
|
-
saveEmbeddingIfHashMatches,
|
|
309
|
-
invalidateProject,
|
|
310
|
-
invalidateMemory,
|
|
311
|
-
describeShadowBackfillWriteRefusal,
|
|
312
|
-
markProjectLoadUntrusted,
|
|
313
|
-
drainProjectEmbeddingIdentityMaintenance,
|
|
314
|
-
drainStaleEmbeddingIdentitiesForProject,
|
|
315
|
-
registerProjectEmbedding,
|
|
316
|
-
registerProjectShadowEmbedding,
|
|
317
|
-
enqueueShadowEmbeddingItems,
|
|
318
|
-
registerProjectInObservationMode,
|
|
319
|
-
unregisterProjectShadowEmbedding,
|
|
320
|
-
getProjectEmbeddingSnapshot,
|
|
321
|
-
embedTextForProject,
|
|
322
|
-
embedBatchForProject,
|
|
323
|
-
embedUnembeddedMemoriesForProject,
|
|
324
|
-
embedUnembeddedMemoriesForProjectOutcome,
|
|
325
|
-
drainCommitBacklogForProject,
|
|
326
|
-
embedSessionCompartmentChunks,
|
|
327
|
-
getEmbeddingCoverageStatus,
|
|
328
|
-
computeCueContentHash,
|
|
329
|
-
hasMuralCueColumns,
|
|
330
|
-
getMuralCueState,
|
|
331
|
-
memoryNeedsCue,
|
|
332
|
-
setMuralCue,
|
|
333
|
-
recordMuralCueRejection,
|
|
334
|
-
hasMemoryShareableColumn,
|
|
335
|
-
hasMemoryClassifiedAtColumn,
|
|
336
|
-
getUnclassifiedMemoryIds,
|
|
337
|
-
insertMemory,
|
|
338
|
-
insertMemoryIdempotent,
|
|
339
|
-
getMemoryByHash,
|
|
340
|
-
getMemoriesByProject,
|
|
341
|
-
getMemoriesForList,
|
|
342
|
-
getMaxMemoryIdForProjects,
|
|
343
|
-
getMemoryById,
|
|
344
|
-
getMemoriesByIds,
|
|
345
|
-
updateMemorySeenCount,
|
|
346
|
-
setMemoryClassification,
|
|
347
|
-
supersededMemory,
|
|
348
|
-
mergeMemoryStats,
|
|
349
|
-
archiveMemory,
|
|
350
|
-
getMemoryCountsByStatus,
|
|
351
|
-
recordMemoryMapping,
|
|
352
|
-
recordMemoryVerifications,
|
|
353
|
-
getUnmappedMemoryIds,
|
|
354
|
-
clearMemoryVerifications,
|
|
355
|
-
getMemoryVerifications,
|
|
356
|
-
resolveGitTopLevel,
|
|
357
|
-
readGitHead,
|
|
358
|
-
readGitChangedFilesSince,
|
|
359
|
-
readGitFileChangeTimesSince,
|
|
360
|
-
verificationFileExists,
|
|
361
|
-
normalizeVerificationFiles,
|
|
471
|
+
getProjectState,
|
|
472
|
+
bumpProjectUserProfileVersion,
|
|
473
|
+
createChildSessionWithFence,
|
|
474
|
+
HiddenCompletionRefusal,
|
|
475
|
+
DreamerProviderOutputFailureError,
|
|
476
|
+
withDreamerModelCooldown,
|
|
477
|
+
providerOutputFailureFromInvalidManifest,
|
|
478
|
+
extractLatestAssistantText,
|
|
479
|
+
hasLengthCappedOutput,
|
|
480
|
+
parseProviderModel,
|
|
481
|
+
modelBodyField,
|
|
482
|
+
toModelEntry,
|
|
483
|
+
isPromptTimeoutError,
|
|
484
|
+
getPromptFailureDetail,
|
|
485
|
+
promptSyncWithValidatedOutputRetry,
|
|
486
|
+
normalizeSDKResponse,
|
|
487
|
+
failedInvocationStatus,
|
|
488
|
+
recordChildInvocation,
|
|
489
|
+
createPromptAsyncTransport,
|
|
490
|
+
promptSurfaceHashMaterial,
|
|
491
|
+
createPromptSurfaceRuntime,
|
|
492
|
+
createPromptSurfaceGuidanceEpochCache,
|
|
493
|
+
teardownChildSession,
|
|
494
|
+
getCompartmentEvents,
|
|
362
495
|
runTokenLog,
|
|
363
496
|
formatRunTokenLog,
|
|
364
497
|
resolveHiddenCompletionExecutor,
|
|
@@ -407,6 +540,8 @@ import {
|
|
|
407
540
|
clearNoteNudgeTriggerAndCooldown,
|
|
408
541
|
resetNoteNudgeCooldownOnly,
|
|
409
542
|
RECOVERY_NO_HEAD_LIMIT,
|
|
543
|
+
deriveProtectedTailTokenTarget,
|
|
544
|
+
selectPerRunCap,
|
|
410
545
|
resolveOpenCodeProtectedTailBoundary,
|
|
411
546
|
getRawHistoryEligibility,
|
|
412
547
|
hasRunnableCompartmentWindow,
|
|
@@ -414,126 +549,7 @@ import {
|
|
|
414
549
|
snapRangeToCompartments,
|
|
415
550
|
getActiveCompartmentRun,
|
|
416
551
|
startCompartmentAgent
|
|
417
|
-
} from "./index-
|
|
418
|
-
import {
|
|
419
|
-
hasTrustedAbsoluteWall,
|
|
420
|
-
applyProvenInputFloor,
|
|
421
|
-
formatWindowDerivationLine,
|
|
422
|
-
isSaneLimit,
|
|
423
|
-
getSdkWindowGeometry,
|
|
424
|
-
getSdkContextLimit,
|
|
425
|
-
getSdkOutputLimit,
|
|
426
|
-
deriveTriggerBudget2,
|
|
427
|
-
resolveKnownHistorianContextLimit2,
|
|
428
|
-
resolveHistorianProducerLimits2
|
|
429
|
-
} from "./index-0d3g3461.js";
|
|
430
|
-
import {
|
|
431
|
-
resolveModelCalibration,
|
|
432
|
-
calibrateBuckets,
|
|
433
|
-
resolveDecisionCalibration
|
|
434
|
-
} from "./index-1zx87sdm.js";
|
|
435
|
-
import {
|
|
436
|
-
hasMeaningfulUserText2,
|
|
437
|
-
extractTexts2,
|
|
438
|
-
extractToolCallSummaries,
|
|
439
|
-
getTokenizerNativeMemoryStats,
|
|
440
|
-
estimateTokens,
|
|
441
|
-
estimateFixedPromptTokens,
|
|
442
|
-
normalizeText
|
|
443
|
-
} from "./index-5eqk6z3s.js";
|
|
444
|
-
import {
|
|
445
|
-
protectedToolTagNumbers,
|
|
446
|
-
protectedToolTokenCount,
|
|
447
|
-
peelLeadingMcTagNotation,
|
|
448
|
-
isRecord,
|
|
449
|
-
contentTagOwnerMessageId,
|
|
450
|
-
normalizeTodoStateJson,
|
|
451
|
-
computeSyntheticCallId,
|
|
452
|
-
CHANNEL1_SENTINEL,
|
|
453
|
-
toolOutputTokens,
|
|
454
|
-
decideChannel1,
|
|
455
|
-
evaluateChannel2,
|
|
456
|
-
formatChannel1Evaluation,
|
|
457
|
-
formatChannel2Evaluation,
|
|
458
|
-
reclaimableToolOutputCount,
|
|
459
|
-
buildChannel2Reminder,
|
|
460
|
-
buildChannel1Reminder,
|
|
461
|
-
queuePendingOp,
|
|
462
|
-
getPendingOps,
|
|
463
|
-
hasPendingDropOps,
|
|
464
|
-
clearPendingOps,
|
|
465
|
-
removePendingOp,
|
|
466
|
-
getTriggerTagTokenUpperBound,
|
|
467
|
-
getActiveTagTokenTotalsByMessage,
|
|
468
|
-
updateTagStatus,
|
|
469
|
-
getInertWhitespaceAssistantTags,
|
|
470
|
-
deriveTagLoadFloor,
|
|
471
|
-
getTagsBySession,
|
|
472
|
-
getActiveTagsBySession,
|
|
473
|
-
getDroppedTagsBySession,
|
|
474
|
-
getTagsByNumbers,
|
|
475
|
-
getDroppedTagsByNumbers,
|
|
476
|
-
getMaxDroppedTagNumber,
|
|
477
|
-
getTagById,
|
|
478
|
-
expandToolPart,
|
|
479
|
-
isRawCompactionSummaryInfo,
|
|
480
|
-
extractInMemoryMessageViews,
|
|
481
|
-
buildInMemoryTailRawMessages,
|
|
482
|
-
estimateTrueRawMessageTokens,
|
|
483
|
-
toolPartHasUserAnswer,
|
|
484
|
-
DreamTokenBudgetExceeded,
|
|
485
|
-
isEditTool,
|
|
486
|
-
describeFinalWireTail,
|
|
487
|
-
estimateMessageTokens,
|
|
488
|
-
wireContentBytes,
|
|
489
|
-
createFinalWireUsageTracker,
|
|
490
|
-
estimateFinalWireInputTokens,
|
|
491
|
-
estimateAppendedWireTokens,
|
|
492
|
-
isPrefixBoundThinkingModel,
|
|
493
|
-
detectOverflow,
|
|
494
|
-
modelAcceptsEmptyContent,
|
|
495
|
-
isAnthropicFamilyRoute,
|
|
496
|
-
variantChangeBustsProviderCache,
|
|
497
|
-
setRawMessageProvider2,
|
|
498
|
-
cleanUserText2,
|
|
499
|
-
withRawSessionMessageCache2,
|
|
500
|
-
readRawSessionMessages2,
|
|
501
|
-
visitRawSessionMessages2,
|
|
502
|
-
primeTailRawMessageCache2,
|
|
503
|
-
primeInMemoryTailRawMessageCache2,
|
|
504
|
-
readRawSessionMessageOrdinalPage2,
|
|
505
|
-
getRawSessionStoredMessageCount2,
|
|
506
|
-
readRawSessionMessageIdOrdinalsForRange2,
|
|
507
|
-
readRawSessionMessagePartsById2,
|
|
508
|
-
readRawSessionMessageById2,
|
|
509
|
-
readSessionChunk2,
|
|
510
|
-
readRawSessionSeedTail2
|
|
511
|
-
} from "./index-3h0ybwah.js";
|
|
512
|
-
import {
|
|
513
|
-
observeTemporalDecisions,
|
|
514
|
-
getMeasuredToolDefinitionTokens
|
|
515
|
-
} from "./index-5gq3b2ya.js";
|
|
516
|
-
import {
|
|
517
|
-
openCodeDbExists,
|
|
518
|
-
withReadOnlySessionDb,
|
|
519
|
-
assistantAwaitingTools,
|
|
520
|
-
latestPersistedMessageForRecovery,
|
|
521
|
-
findLastAssistantModelFromOpenCodeDb
|
|
522
|
-
} from "./index-majxda46.js";
|
|
523
|
-
import {
|
|
524
|
-
CANONICAL_DREAM_TASKS,
|
|
525
|
-
DREAM_TASK_CAPABILITIES,
|
|
526
|
-
toolLoopDreamTasks,
|
|
527
|
-
formatDreamTaskBacklogs,
|
|
528
|
-
formatDreamTaskFailures,
|
|
529
|
-
processedDreamTaskItems,
|
|
530
|
-
leaseKindFor,
|
|
531
|
-
leaseKeyFor,
|
|
532
|
-
isCanonicalDreamTask,
|
|
533
|
-
compareTaskOrder,
|
|
534
|
-
buildDreamTaskRuntimeConfigs2,
|
|
535
|
-
userMemoryCollectionEnabled2
|
|
536
|
-
} from "./index-mc22ayvf.js";
|
|
552
|
+
} from "./index-6d9e1m08.js";
|
|
537
553
|
import {
|
|
538
554
|
registerNotificationSink2,
|
|
539
555
|
pushNotification2,
|
|
@@ -541,12 +557,6 @@ import {
|
|
|
541
557
|
drainNotifications2,
|
|
542
558
|
isTuiConnected2
|
|
543
559
|
} from "./index-x8a7jmkh.js";
|
|
544
|
-
import {
|
|
545
|
-
flushIgnoredMessages2,
|
|
546
|
-
clearIgnoredMessages2,
|
|
547
|
-
observeIgnoredNotificationEvent2,
|
|
548
|
-
sendStatusNotification2
|
|
549
|
-
} from "./index-7qw742ev.js";
|
|
550
560
|
import {
|
|
551
561
|
indexCommitsForProject,
|
|
552
562
|
embedUnembeddedCommits,
|
|
@@ -554,7 +564,9 @@ import {
|
|
|
554
564
|
parseIdShapedQuery,
|
|
555
565
|
resolveMemoriesByIdsForSearch,
|
|
556
566
|
unifiedSearch,
|
|
557
|
-
formatSearchResults
|
|
567
|
+
formatSearchResults
|
|
568
|
+
} from "./index-92bp57hg.js";
|
|
569
|
+
import {
|
|
558
570
|
findSessionId,
|
|
559
571
|
findLastUserMessageId,
|
|
560
572
|
clearAutoSearchForSession,
|
|
@@ -571,18 +583,26 @@ import {
|
|
|
571
583
|
canConsumeDeferredOnThisPass,
|
|
572
584
|
hasReclaimRide,
|
|
573
585
|
reclaimRideLabel,
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
586
|
+
replayClearedReasoning,
|
|
587
|
+
replayStrippedInlineThinking,
|
|
588
|
+
stripClearedReasoning,
|
|
589
|
+
snapshotTrailingBlankSourceDecisions,
|
|
590
|
+
projectOpencodeReasoningBudgetCutoff,
|
|
591
|
+
resolveKeepReasoningTokens,
|
|
592
|
+
reasoningBudgetCutoff,
|
|
593
|
+
captureOpencodeReasoningBudgetStatus,
|
|
594
|
+
reasoningBudgetStatusLine,
|
|
577
595
|
ENGINE_RECONNECTING_USER_MESSAGE,
|
|
578
596
|
contextRefusalError,
|
|
579
597
|
protectedToolRefusal,
|
|
580
598
|
outgoingContextRefusal,
|
|
581
599
|
EmergencyFailClosedError,
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
600
|
+
latestAssistantTurnStart,
|
|
601
|
+
latestAssistantTurnMessages,
|
|
602
|
+
hasActiveAnthropicThinkingTurn,
|
|
603
|
+
replayCavemanCompression,
|
|
604
|
+
DegradedPassRefusalError,
|
|
605
|
+
degradedPassError,
|
|
586
606
|
applyFlushedStatuses,
|
|
587
607
|
stripStructuralNoise,
|
|
588
608
|
logTransformTiming,
|
|
@@ -596,11 +616,17 @@ import {
|
|
|
596
616
|
abortSessionFailClosed2,
|
|
597
617
|
evaluateEmergencyFailClosed2,
|
|
598
618
|
runPostTransformPhase2
|
|
599
|
-
} from "./index-
|
|
619
|
+
} from "./index-cwf6s3ay.js";
|
|
620
|
+
import {
|
|
621
|
+
flushIgnoredMessages2,
|
|
622
|
+
clearIgnoredMessages2,
|
|
623
|
+
observeIgnoredNotificationEvent2,
|
|
624
|
+
sendStatusNotification2
|
|
625
|
+
} from "./index-adwfkpex.js";
|
|
600
626
|
import {
|
|
601
627
|
setRecompStarting2,
|
|
602
628
|
setRecompTerminal2
|
|
603
|
-
} from "./index-
|
|
629
|
+
} from "./index-gg8j07zz.js";
|
|
604
630
|
import {
|
|
605
631
|
ANNOUNCEMENT_VERSION2,
|
|
606
632
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -5927,7 +5953,7 @@ function getAsyncModule() {
|
|
|
5927
5953
|
await beforeModuleLoad();
|
|
5928
5954
|
const [{ default: singlefileAsyncifyVariant }, { newQuickJSAsyncWASMModuleFromVariant }] = await importPluginModule(() => Promise.all([
|
|
5929
5955
|
import("./index-e7vx3byk.js").then((m)=>__toESM(m.default,1)),
|
|
5930
|
-
import("./index-
|
|
5956
|
+
import("./index-5prbx026.js")
|
|
5931
5957
|
]));
|
|
5932
5958
|
const module = await newQuickJSAsyncWASMModuleFromVariant(singlefileAsyncifyVariant);
|
|
5933
5959
|
return module;
|
|
@@ -8875,9 +8901,11 @@ function countCompartmentsSince(db, projectPath, since) {
|
|
|
8875
8901
|
}
|
|
8876
8902
|
function countProjectSessionsSince(db, projectPath, since) {
|
|
8877
8903
|
const row = since === null ? db.prepare("SELECT COUNT(*) AS cnt FROM session_projects WHERE project_path = ?").get(projectPath) : db.prepare(`SELECT COUNT(*) AS cnt FROM session_projects sp
|
|
8878
|
-
JOIN schema_migrations_meta activity
|
|
8904
|
+
LEFT JOIN schema_migrations_meta activity
|
|
8879
8905
|
ON activity.key = 'retrospective_activity:' || sp.session_id
|
|
8880
|
-
|
|
8906
|
+
LEFT JOIN message_history_index history ON history.session_id = sp.session_id
|
|
8907
|
+
WHERE sp.project_path = ?
|
|
8908
|
+
AND COALESCE(CAST(activity.value AS INTEGER), history.updated_at) > ?`).get(projectPath, since);
|
|
8881
8909
|
return row?.cnt ?? 0;
|
|
8882
8910
|
}
|
|
8883
8911
|
function countMappedMemories(db, projectPath) {
|
|
@@ -8952,10 +8980,11 @@ function hasActiveMemories(db, projectPath) {
|
|
|
8952
8980
|
return db.prepare("SELECT 1 AS one FROM memories WHERE project_path = ? AND status IN ('active','permanent') LIMIT 1").get(projectPath) != null;
|
|
8953
8981
|
}
|
|
8954
8982
|
var RECENT_PROJECT_SESSIONS_SQL = `SELECT sp.session_id FROM session_projects sp
|
|
8955
|
-
|
|
8956
|
-
|
|
8983
|
+
LEFT JOIN schema_migrations_meta activity
|
|
8984
|
+
ON activity.key = 'retrospective_activity:' || sp.session_id
|
|
8985
|
+
LEFT JOIN message_history_index history ON history.session_id = sp.session_id
|
|
8957
8986
|
WHERE sp.project_path = ?
|
|
8958
|
-
AND (sp.updated_at > ? OR CAST(activity.value AS INTEGER) > ?)`;
|
|
8987
|
+
AND (sp.updated_at > ? OR COALESCE(CAST(activity.value AS INTEGER), history.updated_at) > ?)`;
|
|
8959
8988
|
function hasRecentProjectSession(db, projectPath, since) {
|
|
8960
8989
|
return db.prepare(`${RECENT_PROJECT_SESSIONS_SQL} LIMIT 1`).get(projectPath, since, since) != null;
|
|
8961
8990
|
}
|
|
@@ -12848,12 +12877,68 @@ function resolveModelCacheTtl(config, modelKey, configuredExplicitly = typeof co
|
|
|
12848
12877
|
};
|
|
12849
12878
|
}
|
|
12850
12879
|
|
|
12880
|
+
// src/hooks/magic-context/opencode-proven-floor.ts
|
|
12881
|
+
var KEY = "opencodeProvenInputFloor";
|
|
12882
|
+
function recordOpenCodeProvenInputFloor(db, sessionId, modelKey, tokens) {
|
|
12883
|
+
db.prepare(`UPDATE session_meta SET deferred_execute_state = json_set(
|
|
12884
|
+
CASE WHEN json_valid(deferred_execute_state) AND json_type(deferred_execute_state) = 'object'
|
|
12885
|
+
THEN deferred_execute_state ELSE '{}' END, '$.${KEY}', json(?)) WHERE session_id = ?`).run(JSON.stringify({ modelKey, tokens, basis: "provider_usage_v1" }), sessionId);
|
|
12886
|
+
}
|
|
12887
|
+
function largestAcceptedInput(sessionId, modelKey) {
|
|
12888
|
+
return withReadOnlySessionDb((db) => {
|
|
12889
|
+
const rows = db.prepare(`SELECT
|
|
12890
|
+
COALESCE(json_extract(data, '$.providerID'), json_extract(data, '$.model.providerID')) AS provider,
|
|
12891
|
+
COALESCE(json_extract(data, '$.modelID'), json_extract(data, '$.model.id')) AS model,
|
|
12892
|
+
json_extract(data, '$.finish') AS finish, json_extract(data, '$.error') AS error,
|
|
12893
|
+
json_extract(data, '$.tokens.input') AS input,
|
|
12894
|
+
json_extract(data, '$.tokens.cache.read') AS cacheRead,
|
|
12895
|
+
json_extract(data, '$.tokens.cache.write') AS cacheWrite
|
|
12896
|
+
FROM message WHERE session_id = ? AND json_valid(data)
|
|
12897
|
+
AND json_extract(data, '$.role') = 'assistant'`).all(sessionId);
|
|
12898
|
+
let largest = 0;
|
|
12899
|
+
for (const row of rows) {
|
|
12900
|
+
if (!row.provider || !row.model || piModelRefToCanonical(`${row.provider}/${row.model}`) !== piModelRefToCanonical(modelKey) || providerResponseFailed(row))
|
|
12901
|
+
continue;
|
|
12902
|
+
const components = [row.input ?? 0, row.cacheRead ?? 0, row.cacheWrite ?? 0];
|
|
12903
|
+
if (components.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0)) {
|
|
12904
|
+
largest = Math.max(largest, components.reduce((sum, n) => sum + n, 0));
|
|
12905
|
+
}
|
|
12906
|
+
}
|
|
12907
|
+
return largest;
|
|
12908
|
+
});
|
|
12909
|
+
}
|
|
12910
|
+
function resolveOpenCodeProvenInputFloor(db, sessionId, modelKey) {
|
|
12911
|
+
const row = db.prepare("SELECT observed_safe_input_tokens, last_observed_model_key, deferred_execute_state FROM session_meta WHERE session_id = ?").get(sessionId);
|
|
12912
|
+
const stored = row?.observed_safe_input_tokens ?? 0;
|
|
12913
|
+
if (!modelKey || piModelRefToCanonical(row?.last_observed_model_key ?? "") !== piModelRefToCanonical(modelKey) || !Number.isFinite(stored) || stored <= 0)
|
|
12914
|
+
return 0;
|
|
12915
|
+
try {
|
|
12916
|
+
const record = JSON.parse(row?.deferred_execute_state ?? "{}")[KEY];
|
|
12917
|
+
if (record?.basis === "provider_usage_v1" && record.modelKey === modelKey && record.tokens === stored)
|
|
12918
|
+
return stored;
|
|
12919
|
+
} catch {}
|
|
12920
|
+
let measured = 0;
|
|
12921
|
+
try {
|
|
12922
|
+
measured = largestAcceptedInput(sessionId, modelKey);
|
|
12923
|
+
} catch {}
|
|
12924
|
+
const repaired = Math.min(stored, measured);
|
|
12925
|
+
updateSessionMeta(db, sessionId, {
|
|
12926
|
+
observedSafeInputTokens: repaired,
|
|
12927
|
+
cacheAlertSent: false,
|
|
12928
|
+
lastUsageContextLimit: 0
|
|
12929
|
+
});
|
|
12930
|
+
recordOpenCodeProvenInputFloor(db, sessionId, modelKey, repaired);
|
|
12931
|
+
sessionLog(sessionId, `legacy proven input floor ${stored} clamped to accepted provider usage: ${repaired}`);
|
|
12932
|
+
return repaired;
|
|
12933
|
+
}
|
|
12934
|
+
|
|
12851
12935
|
// src/hooks/magic-context/event-resolvers.ts
|
|
12852
12936
|
var DEFAULT_CONTEXT_LIMIT = 200000;
|
|
12853
12937
|
function modelMatchedPersistedUsage(db, sessionID, modelKey) {
|
|
12854
12938
|
if (!db || !sessionID || !modelKey)
|
|
12855
12939
|
return;
|
|
12856
12940
|
try {
|
|
12941
|
+
resolveOpenCodeProvenInputFloor(db, sessionID, modelKey);
|
|
12857
12942
|
const persisted = loadPersistedUsage(db, sessionID);
|
|
12858
12943
|
if (persisted !== null && piModelRefToCanonical(persisted.lastObservedModelKey ?? "") === piModelRefToCanonical(modelKey)) {
|
|
12859
12944
|
return persisted;
|
|
@@ -13965,6 +14050,29 @@ function formatThresholdClampNote(opts) {
|
|
|
13965
14050
|
// src/shared/rust-mode-status.ts
|
|
13966
14051
|
var RUST_MODE_HOST_PATHS_LINE = "Host backends → MODULE: ctx_memory, ctx_note; historian: module-side";
|
|
13967
14052
|
|
|
14053
|
+
// src/hooks/magic-context/historian-drain-gate.ts
|
|
14054
|
+
var loggedWindows = new WeakMap;
|
|
14055
|
+
function isHistorianDrainBudgetSpent(args) {
|
|
14056
|
+
const target = deriveProtectedTailTokenTarget(args);
|
|
14057
|
+
const state = getProtectedTailDrainBudgetSkip({
|
|
14058
|
+
...args,
|
|
14059
|
+
usable: target.usable,
|
|
14060
|
+
perRunCap: selectPerRunCap({ ...args, N: target.N })
|
|
14061
|
+
});
|
|
14062
|
+
if (!state)
|
|
14063
|
+
return false;
|
|
14064
|
+
let windows = loggedWindows.get(args.db);
|
|
14065
|
+
if (!windows) {
|
|
14066
|
+
windows = new Map;
|
|
14067
|
+
loggedWindows.set(args.db, windows);
|
|
14068
|
+
}
|
|
14069
|
+
if (windows.get(args.sessionId) !== state.resetsAt) {
|
|
14070
|
+
windows.set(args.sessionId, state.resetsAt);
|
|
14071
|
+
sessionLog(args.sessionId, `historian skip: internal drain budget spent (${state.spentTokens}/${state.limitTokens} tokens); next eligible at ${new Date(state.nextEligibleAt).toISOString()}`);
|
|
14072
|
+
}
|
|
14073
|
+
return true;
|
|
14074
|
+
}
|
|
14075
|
+
|
|
13968
14076
|
// src/hooks/magic-context/compartment-trigger.ts
|
|
13969
14077
|
var PROACTIVE_TRIGGER_OFFSET_PERCENTAGE = 2;
|
|
13970
14078
|
var POST_DROP_TARGET_RATIO = 0.75;
|
|
@@ -14025,7 +14133,7 @@ function buildTriggerInMemoryTail(db, sessionId, messages) {
|
|
|
14025
14133
|
function getProactiveCompartmentTriggerPercentage(executeThresholdPercentage) {
|
|
14026
14134
|
return Math.max(0, executeThresholdPercentage - PROACTIVE_TRIGGER_OFFSET_PERCENTAGE);
|
|
14027
14135
|
}
|
|
14028
|
-
function estimateProjectedPostDropPercentage(db, sessionId, usage, activeTags,
|
|
14136
|
+
function estimateProjectedPostDropPercentage(db, sessionId, usage, activeTags, keepReasoningTokens, clearedReasoningThroughTag, canClearReasoning, liveBudgetCutoff) {
|
|
14029
14137
|
const totalActiveBytes = activeTags.reduce((sum, tag) => sum + tag.byteSize + tag.reasoningByteSize, 0);
|
|
14030
14138
|
if (totalActiveBytes === 0)
|
|
14031
14139
|
return null;
|
|
@@ -14035,9 +14143,25 @@ function estimateProjectedPostDropPercentage(db, sessionId, usage, activeTags, c
|
|
|
14035
14143
|
if (pendingDrops.length > 0) {
|
|
14036
14144
|
droppableBytes += activeTags.filter((tag) => pendingDropTagIds.has(tag.tagNumber)).reduce((sum, tag) => sum + tag.byteSize + tag.reasoningByteSize, 0);
|
|
14037
14145
|
}
|
|
14038
|
-
|
|
14039
|
-
|
|
14040
|
-
const
|
|
14146
|
+
if (canClearReasoning && keepReasoningTokens !== undefined && clearedReasoningThroughTag !== undefined) {
|
|
14147
|
+
const estimates = getReasoningTokenEstimatesByMessage(db, sessionId, sessionDecisionCalibration(db, sessionId).proseRatio);
|
|
14148
|
+
const groups = new Map;
|
|
14149
|
+
for (const tag of activeTags) {
|
|
14150
|
+
const id = tag.type === "tool" ? tag.toolOwnerMessageId : tag.messageId;
|
|
14151
|
+
if (!id)
|
|
14152
|
+
continue;
|
|
14153
|
+
const group = groups.get(id) ?? { tag: 0, cost: estimates.get(id) ?? 0 };
|
|
14154
|
+
if (!estimates.has(id))
|
|
14155
|
+
group.cost += tag.reasoningByteSize / 4;
|
|
14156
|
+
group.tag = Math.max(group.tag, tag.tagNumber);
|
|
14157
|
+
groups.set(id, group);
|
|
14158
|
+
}
|
|
14159
|
+
const steps = [...groups.values()].sort((a, b) => a.tag - b.tag);
|
|
14160
|
+
const reasoningAgeCutoff = liveBudgetCutoff ?? reasoningBudgetCutoff(steps.map((step, index) => ({
|
|
14161
|
+
...step,
|
|
14162
|
+
exempt: index === steps.length - 1,
|
|
14163
|
+
alreadyRemoved: step.tag <= clearedReasoningThroughTag
|
|
14164
|
+
})), keepReasoningTokens);
|
|
14041
14165
|
for (const tag of activeTags) {
|
|
14042
14166
|
if (tag.type !== "message")
|
|
14043
14167
|
continue;
|
|
@@ -14107,7 +14231,7 @@ function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThr
|
|
|
14107
14231
|
usageSource: "live",
|
|
14108
14232
|
taggerFloor
|
|
14109
14233
|
});
|
|
14110
|
-
const hasProtectedEligibleHead = boundary.offset < boundary.protectedTailStart;
|
|
14234
|
+
const hasProtectedEligibleHead = boundary.offset < Math.min(boundary.protectedTailStart, boundary.eligibleEndOrdinal);
|
|
14111
14235
|
if (!hasProtectedEligibleHead) {
|
|
14112
14236
|
return {
|
|
14113
14237
|
...TAIL_INFO_DEFAULTS,
|
|
@@ -14119,7 +14243,7 @@ function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThr
|
|
|
14119
14243
|
const seed = sessionDecisionCalibration(db, sessionId);
|
|
14120
14244
|
const sourceRatio = Math.max(seed.proseRatio, seed.toolsRatio);
|
|
14121
14245
|
const scanBudget = Math.floor(Math.max(MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE, triggerBudget * TAIL_SIZE_TRIGGER_MULTIPLIER) / sourceRatio);
|
|
14122
|
-
const chunk = readSessionChunk2(sessionId, scanBudget, rawEligibility.offset, boundary.
|
|
14246
|
+
const chunk = readSessionChunk2(sessionId, scanBudget, rawEligibility.offset, boundary.eligibleEndOrdinal);
|
|
14123
14247
|
const isMeaningful = chunk.hasMore || boundary.trueRawEligibleTokens >= MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE || Math.ceil(chunk.tokenEstimate * sourceRatio) >= MIN_PROACTIVE_TAIL_TOKEN_ESTIMATE || chunk.messageCount >= MIN_PROACTIVE_TAIL_MESSAGE_COUNT;
|
|
14124
14248
|
return {
|
|
14125
14249
|
nextStartOrdinal: rawEligibility.offset,
|
|
@@ -14141,11 +14265,19 @@ function getUnsummarizedTailInfo(db, sessionId, triggerBudget, usage, executeThr
|
|
|
14141
14265
|
function formatProjectedPostDropPercentage(value) {
|
|
14142
14266
|
return value === null ? "none" : `${value.toFixed(1)}%`;
|
|
14143
14267
|
}
|
|
14144
|
-
function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPercentage, executeThresholdPercentage, triggerBudget,
|
|
14268
|
+
function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPercentage, executeThresholdPercentage, triggerBudget, keepReasoningTokens, commitClusterTrigger, preloadedActiveTags, contextLimit, inMemoryTail, taggerFloorOverride, reasoningProjection, reclaimRide) {
|
|
14145
14269
|
if (sessionMeta.compartmentInProgress) {
|
|
14146
14270
|
sessionLog(sessionId, `compartment trigger: skipped — historian already in progress (usage=${usage.percentage.toFixed(1)}%)`);
|
|
14147
14271
|
return { shouldFire: false };
|
|
14148
14272
|
}
|
|
14273
|
+
if (isHistorianDrainBudgetSpent({
|
|
14274
|
+
db,
|
|
14275
|
+
sessionId,
|
|
14276
|
+
usagePercentage: usage.percentage,
|
|
14277
|
+
contextLimit: resolveBoundaryContextLimit(usage, contextLimit),
|
|
14278
|
+
executeThresholdPercentage
|
|
14279
|
+
}))
|
|
14280
|
+
return { shouldFire: false };
|
|
14149
14281
|
const lazyInMemoryTail = typeof inMemoryTail === "function" ? inMemoryTail : undefined;
|
|
14150
14282
|
let resolvedInMemoryTail = typeof inMemoryTail === "function" ? undefined : inMemoryTail;
|
|
14151
14283
|
if (resolvedInMemoryTail) {
|
|
@@ -14197,7 +14329,7 @@ function checkCompartmentTrigger(db, sessionId, sessionMeta, usage, _previousPer
|
|
|
14197
14329
|
return { shouldFire: false };
|
|
14198
14330
|
}
|
|
14199
14331
|
const canClearReasoning = reasoningProjection?.canClearReasoning ?? modelAcceptsEmptyContent(reasoningProjection?.providerID);
|
|
14200
|
-
const projectedPostDropPercentage = estimateProjectedPostDropPercentage(db, sessionId, usage, preloadedActiveTags ?? getActiveTagsBySession(db, sessionId),
|
|
14332
|
+
const projectedPostDropPercentage = estimateProjectedPostDropPercentage(db, sessionId, usage, preloadedActiveTags ?? getActiveTagsBySession(db, sessionId), keepReasoningTokens, sessionMeta.clearedReasoningThroughTag, canClearReasoning, reasoningProjection?.budgetCutoff);
|
|
14201
14333
|
const relativePostDropTarget = executeThresholdPercentage * POST_DROP_TARGET_RATIO;
|
|
14202
14334
|
const rideLabel = reclaimRide ? reclaimRideLabel(reclaimRide) : "ride=none";
|
|
14203
14335
|
const dropsCanLand = reclaimRide !== undefined && hasReclaimRide(reclaimRide);
|
|
@@ -14349,7 +14481,9 @@ function executeStatus(db, sessionId, executeThresholdPercentageConfig = DEFAULT
|
|
|
14349
14481
|
const displayPercentage = contextUsage?.percentage ?? meta.lastContextPercentage;
|
|
14350
14482
|
const displayContextLimit = contextLimit && contextLimit > 0 ? contextLimit : displayPercentage > 0 ? Math.round(displayInputTokens / (displayPercentage / 100)) : 0;
|
|
14351
14483
|
const parseFailureLines = (display?.configParseFailures ?? []).map(formatConfigParseStatusLine);
|
|
14484
|
+
const reasoningLine = reasoningBudgetStatusLine(sessionId);
|
|
14352
14485
|
const lines = [
|
|
14486
|
+
...reasoningLine ? [reasoningLine, ""] : [],
|
|
14353
14487
|
...openCodeDbStatusLine ? [openCodeDbStatusLine, ""] : [],
|
|
14354
14488
|
...parseFailureLines,
|
|
14355
14489
|
...parseFailureLines.length > 0 ? [""] : [],
|
|
@@ -16662,7 +16796,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16662
16796
|
return { count: buildCompartmentCount(db, sessionId, moduleStatus) };
|
|
16663
16797
|
});
|
|
16664
16798
|
const buildManagedCtx = async (db) => {
|
|
16665
|
-
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-
|
|
16799
|
+
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-ke12jnnh.js"));
|
|
16666
16800
|
const { resolveHistorianModel } = await importPluginModule(() => import("./model-resolution-xhfmyyvy.js"));
|
|
16667
16801
|
const { userMemoryCollectionEnabled } = await importPluginModule(() => import("./task-config-v81k8jvk.js"));
|
|
16668
16802
|
const DEFAULT_HISTORIAN_TIMEOUT_MS = 10 * 60 * 1000;
|
|
@@ -16698,8 +16832,8 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16698
16832
|
const db = readDatabase();
|
|
16699
16833
|
if (!db)
|
|
16700
16834
|
return { ok: false, error: "db unavailable" };
|
|
16701
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16702
|
-
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-
|
|
16835
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-rervg6q4.js"));
|
|
16836
|
+
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-0m68ms3n.js"));
|
|
16703
16837
|
log(`[rpc] recomp requested for session ${sessionId}`);
|
|
16704
16838
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
16705
16839
|
return {
|
|
@@ -16768,7 +16902,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16768
16902
|
const db = readDatabase();
|
|
16769
16903
|
if (!db)
|
|
16770
16904
|
return { ok: false, error: "db unavailable" };
|
|
16771
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16905
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-b2dztrar.js"));
|
|
16772
16906
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16773
16907
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16774
16908
|
const ctx = {
|
|
@@ -16828,18 +16962,225 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16828
16962
|
return { show: false };
|
|
16829
16963
|
}
|
|
16830
16964
|
return {
|
|
16831
|
-
show: true,
|
|
16832
|
-
version: ANNOUNCEMENT_VERSION2,
|
|
16833
|
-
features: [...ANNOUNCEMENT_FEATURES2],
|
|
16834
|
-
footer: ANNOUNCEMENT_FOOTER2
|
|
16965
|
+
show: true,
|
|
16966
|
+
version: ANNOUNCEMENT_VERSION2,
|
|
16967
|
+
features: [...ANNOUNCEMENT_FEATURES2],
|
|
16968
|
+
footer: ANNOUNCEMENT_FOOTER2
|
|
16969
|
+
};
|
|
16970
|
+
});
|
|
16971
|
+
rpcServer.handle("mark-announced", async () => {
|
|
16972
|
+
if (ANNOUNCEMENT_VERSION2) {
|
|
16973
|
+
markAnnouncementSeen2(ANNOUNCEMENT_VERSION2);
|
|
16974
|
+
}
|
|
16975
|
+
return { ok: true };
|
|
16976
|
+
});
|
|
16977
|
+
}
|
|
16978
|
+
|
|
16979
|
+
// src/hooks/magic-context/latest-thinking-recovery.ts
|
|
16980
|
+
var LATEST_THINKING_RESTORE = "latest_thinking_original";
|
|
16981
|
+
var knownRejectedSessions = new Set;
|
|
16982
|
+
var lastPassTurnAnchor = new Map;
|
|
16983
|
+
var ACTIVE = `${LATEST_THINKING_RESTORE}:`;
|
|
16984
|
+
var ARMED = `${LATEST_THINKING_RESTORE}_armed:`;
|
|
16985
|
+
var UNRECOVERABLE = `${LATEST_THINKING_RESTORE}_unavailable`;
|
|
16986
|
+
var LATEST_THINKING_UNSAFE = "ANTHROPIC_LATEST_TURN_EDIT_UNSAFE: The provider rejected edits to this thinking turn and its original context cannot be safely replayed. Send a new user message or /clear to continue.";
|
|
16987
|
+
function armLatestThinkingRecovery(db, sessionId) {
|
|
16988
|
+
knownRejectedSessions.add(sessionId);
|
|
16989
|
+
ensureSessionMetaRow(db, sessionId);
|
|
16990
|
+
const current = getThinkingBindingRecoveryTarget(db, sessionId);
|
|
16991
|
+
const anchor = lastPassTurnAnchor.get(sessionId);
|
|
16992
|
+
const next = current?.startsWith(ACTIVE) ? UNRECOVERABLE + ":" + current.slice(ACTIVE.length) : current?.startsWith(UNRECOVERABLE) || current?.startsWith(ARMED) ? current : anchor !== undefined ? ARMED + anchor : LATEST_THINKING_RESTORE;
|
|
16993
|
+
db.prepare("UPDATE session_meta SET thinking_binding_recovery_target = ? WHERE session_id = ?").run(next, sessionId);
|
|
16994
|
+
}
|
|
16995
|
+
function clone(value) {
|
|
16996
|
+
if (Array.isArray(value))
|
|
16997
|
+
return value.map(clone);
|
|
16998
|
+
if (!isRecord(value))
|
|
16999
|
+
return value;
|
|
17000
|
+
const proto = Object.getPrototypeOf(value);
|
|
17001
|
+
if (proto !== Object.prototype && proto !== null)
|
|
17002
|
+
return value;
|
|
17003
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, clone(item)]));
|
|
17004
|
+
}
|
|
17005
|
+
function isThinkingPart(part) {
|
|
17006
|
+
return isRecord(part) && ["thinking", "reasoning", "redacted_thinking"].includes(String(part.type));
|
|
17007
|
+
}
|
|
17008
|
+
function replayableOriginal(part) {
|
|
17009
|
+
if (!isThinkingPart(part) || !isRecord(part))
|
|
17010
|
+
return false;
|
|
17011
|
+
const metadata = isRecord(part.metadata) && isRecord(part.metadata.anthropic) ? part.metadata.anthropic : {};
|
|
17012
|
+
const signature = part.signature ?? part.thinkingSignature ?? metadata.signature ?? part.data ?? metadata.redactedData;
|
|
17013
|
+
return typeof signature === "string" && signature.length > 0 && part.text !== "[cleared]" && part.thinking !== "[cleared]";
|
|
17014
|
+
}
|
|
17015
|
+
function prepareLatestThinkingRecovery(args) {
|
|
17016
|
+
const start = latestAssistantTurnStart(args.messages);
|
|
17017
|
+
const anchor = start > 0 ? args.id(args.messages[start - 1], start - 1) : undefined;
|
|
17018
|
+
if (anchor === undefined)
|
|
17019
|
+
lastPassTurnAnchor.delete(args.sessionId);
|
|
17020
|
+
else
|
|
17021
|
+
lastPassTurnAnchor.set(args.sessionId, anchor);
|
|
17022
|
+
let target;
|
|
17023
|
+
try {
|
|
17024
|
+
target = getThinkingBindingRecoveryTarget(args.db, args.sessionId);
|
|
17025
|
+
} catch (error) {
|
|
17026
|
+
if (knownRejectedSessions.has(args.sessionId))
|
|
17027
|
+
throw contextRefusalError(LATEST_THINKING_UNSAFE);
|
|
17028
|
+
return { restore: false, ended: false };
|
|
17029
|
+
}
|
|
17030
|
+
if (!target || !target.startsWith(LATEST_THINKING_RESTORE)) {
|
|
17031
|
+
knownRejectedSessions.delete(args.sessionId);
|
|
17032
|
+
return { restore: false, ended: false };
|
|
17033
|
+
}
|
|
17034
|
+
const armedAnchor = target.startsWith(ARMED) ? target.slice(ARMED.length) : undefined;
|
|
17035
|
+
if (target === LATEST_THINKING_RESTORE || armedAnchor !== undefined && armedAnchor !== anchor) {
|
|
17036
|
+
args.db.prepare("UPDATE session_meta SET thinking_binding_recovery_target = '' WHERE session_id = ? AND thinking_binding_recovery_target = ?").run(args.sessionId, target);
|
|
17037
|
+
knownRejectedSessions.delete(args.sessionId);
|
|
17038
|
+
return { restore: false, ended: false };
|
|
17039
|
+
}
|
|
17040
|
+
knownRejectedSessions.add(args.sessionId);
|
|
17041
|
+
const savedAnchor = target.startsWith(ACTIVE) ? target.slice(ACTIVE.length) : target.startsWith(UNRECOVERABLE + ":") ? target.slice(UNRECOVERABLE.length + 1) : undefined;
|
|
17042
|
+
if (savedAnchor !== undefined && savedAnchor !== anchor) {
|
|
17043
|
+
args.db.prepare("UPDATE session_meta SET thinking_binding_recovery_target = '' WHERE session_id = ? AND thinking_binding_recovery_target = ?").run(args.sessionId, target);
|
|
17044
|
+
knownRejectedSessions.delete(args.sessionId);
|
|
17045
|
+
return { restore: false, ended: true };
|
|
17046
|
+
}
|
|
17047
|
+
if (target.startsWith(UNRECOVERABLE) || !anchor)
|
|
17048
|
+
throw contextRefusalError(LATEST_THINKING_UNSAFE);
|
|
17049
|
+
if (armedAnchor !== undefined) {
|
|
17050
|
+
args.db.prepare("UPDATE session_meta SET thinking_binding_recovery_target = ? WHERE session_id = ? AND thinking_binding_recovery_target = ?").run(ACTIVE + anchor, args.sessionId, target);
|
|
17051
|
+
}
|
|
17052
|
+
const active = args.messages.slice(start);
|
|
17053
|
+
if (!active.some((message) => args.parts(message).some(replayableOriginal)))
|
|
17054
|
+
throw contextRefusalError(LATEST_THINKING_UNSAFE + " [missing-thinking-original]");
|
|
17055
|
+
const ids = new Map(args.messages.map((message, index) => [args.id(message, index), index]));
|
|
17056
|
+
for (const decision of getMergedReasoningStrippedIds(args.db, args.sessionId)) {
|
|
17057
|
+
if (decision === "binding_mismatch_order:end" || decision === TOOL_SWEEP_SCOPED_MARKER)
|
|
17058
|
+
continue;
|
|
17059
|
+
const id = decodeMergedReasoningParts(decision)?.[0] ?? (decision.startsWith("binding_mismatch:") ? decision.slice("binding_mismatch:".length) : decision);
|
|
17060
|
+
const index = ids.get(id);
|
|
17061
|
+
if (index === undefined || index >= start && !args.parts(args.messages[index]).some(replayableOriginal))
|
|
17062
|
+
throw contextRefusalError(LATEST_THINKING_UNSAFE + ` [missing-original:${id}]`);
|
|
17063
|
+
}
|
|
17064
|
+
return { restore: true, ended: false };
|
|
17065
|
+
}
|
|
17066
|
+
function captureOriginalTurn(messages, parts, setParts) {
|
|
17067
|
+
const start = Math.max(0, latestAssistantTurnStart(messages) - 1);
|
|
17068
|
+
const originals = messages.slice(start).map((message) => ({ message, parts: clone(parts(message)) }));
|
|
17069
|
+
const before = messages.slice(0, start);
|
|
17070
|
+
return (target = messages) => {
|
|
17071
|
+
const first = target.findIndex((message) => originals.some((original) => original.message === message || isRecord(message) && isRecord(original.message) && (isRecord(message.info) && isRecord(original.message.info) && message.info.id === original.message.info.id || message.role === original.message.role && message.timestamp !== undefined && message.timestamp === original.message.timestamp)));
|
|
17072
|
+
const prefix = first >= 0 ? target.slice(0, first) : target === messages ? before : target.slice();
|
|
17073
|
+
for (const original of originals) {
|
|
17074
|
+
setParts(original.message, clone(original.parts));
|
|
17075
|
+
}
|
|
17076
|
+
target.length = 0;
|
|
17077
|
+
target.push(...prefix, ...originals.map((original) => original.message));
|
|
17078
|
+
};
|
|
17079
|
+
}
|
|
17080
|
+
function captureLatestTurnOriginals(messages) {
|
|
17081
|
+
return captureOriginalTurn(messages, (message) => message.parts, (message, parts) => {
|
|
17082
|
+
message.parts = parts;
|
|
17083
|
+
});
|
|
17084
|
+
}
|
|
17085
|
+
function armBindingRecoverySafely(db, sessionId) {
|
|
17086
|
+
if (getThinkingBindingRecoveryTarget(db, sessionId)?.startsWith(LATEST_THINKING_RESTORE))
|
|
17087
|
+
armLatestThinkingRecovery(db, sessionId);
|
|
17088
|
+
else
|
|
17089
|
+
armThinkingBindingRecovery(db, sessionId);
|
|
17090
|
+
}
|
|
17091
|
+
function armLatestThinkingRecoveryFromError(args) {
|
|
17092
|
+
if (!detectLatestTurnThinkingMismatch(args.error))
|
|
17093
|
+
return false;
|
|
17094
|
+
if (!isAnthropicFamilyRoute(args.providerID, args.modelID))
|
|
17095
|
+
return true;
|
|
17096
|
+
armLatestThinkingRecovery(args.db, args.sessionId);
|
|
17097
|
+
dropSlot(args.sessionId, "latest-thinking-recovery-arm");
|
|
17098
|
+
return true;
|
|
17099
|
+
}
|
|
17100
|
+
|
|
17101
|
+
// src/hooks/magic-context/lkg-replay-fit.ts
|
|
17102
|
+
var RAW_FALLBACK_BYTES_PER_CONTEXT_TOKEN = 4;
|
|
17103
|
+
function lkgReplayLimit(args) {
|
|
17104
|
+
const { db, sessionId, model } = args;
|
|
17105
|
+
const trusted = model ? resolveTrustedContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : undefined;
|
|
17106
|
+
if (trusted !== undefined && trusted > 0)
|
|
17107
|
+
return trusted;
|
|
17108
|
+
const detected = getOverflowState(db, sessionId, args.modelKey).detectedContextLimit;
|
|
17109
|
+
return detected > 0 ? detected : undefined;
|
|
17110
|
+
}
|
|
17111
|
+
function measureLkgReplay(args) {
|
|
17112
|
+
const baseline = args.measuredInputTokens ?? 0;
|
|
17113
|
+
const tailLimit = Math.max(0, args.limit - baseline);
|
|
17114
|
+
const proxy = wireContentBytes(args.messages, tailLimit * RAW_FALLBACK_BYTES_PER_CONTEXT_TOKEN, RAW_FALLBACK_BYTES_PER_CONTEXT_TOKEN);
|
|
17115
|
+
const skipped = { proxy, estimatorRan: false, trusted: false };
|
|
17116
|
+
if (proxy === null)
|
|
17117
|
+
return { fit: "unproven", tokens: null, ...skipped };
|
|
17118
|
+
const proxyTokens = baseline + Math.ceil(proxy.bytes / RAW_FALLBACK_BYTES_PER_CONTEXT_TOKEN);
|
|
17119
|
+
if (proxy.aborted || proxyTokens > args.limit) {
|
|
17120
|
+
return { fit: "over", tokens: null, proxyTokens, ...skipped };
|
|
17121
|
+
}
|
|
17122
|
+
let estimate;
|
|
17123
|
+
try {
|
|
17124
|
+
estimate = args.estimate();
|
|
17125
|
+
} catch {
|
|
17126
|
+
return { fit: "unproven", tokens: null, ...skipped };
|
|
17127
|
+
}
|
|
17128
|
+
const seen = { proxy, estimatorRan: true, trusted: estimate.trusted };
|
|
17129
|
+
const tokens = baseline + estimate.tokens;
|
|
17130
|
+
if (!estimate.trusted || !Number.isFinite(tokens) || tokens <= 0 || estimate.tokens < 0) {
|
|
17131
|
+
return {
|
|
17132
|
+
fit: "unproven",
|
|
17133
|
+
tokens: Number.isFinite(estimate.tokens) ? estimate.tokens : null,
|
|
17134
|
+
...seen
|
|
16835
17135
|
};
|
|
17136
|
+
}
|
|
17137
|
+
return tokens > args.limit ? { fit: "over", tokens, proxyTokens, ...seen } : { fit: "under", tokens, ...seen };
|
|
17138
|
+
}
|
|
17139
|
+
function measureLkgReplayRequest(args) {
|
|
17140
|
+
let measured;
|
|
17141
|
+
try {
|
|
17142
|
+
measured = args.model ? measuredLkgPrefix({
|
|
17143
|
+
...args,
|
|
17144
|
+
slot: getSlot(args.sessionId),
|
|
17145
|
+
modelKey: `${args.model.providerID}/${args.model.modelID}`
|
|
17146
|
+
}) : undefined;
|
|
17147
|
+
} catch {
|
|
17148
|
+
measured = undefined;
|
|
17149
|
+
}
|
|
17150
|
+
const estimator = args.estimator ?? estimateFinalWireInputTokens;
|
|
17151
|
+
return measureLkgReplay({
|
|
17152
|
+
messages: measured?.appendedMessages ?? args.messages,
|
|
17153
|
+
limit: args.limit,
|
|
17154
|
+
measuredInputTokens: measured?.inputTokens,
|
|
17155
|
+
estimate: () => measured ? estimateAppendedWireTokens({
|
|
17156
|
+
messages: measured.appendedMessages,
|
|
17157
|
+
providerID: args.model?.providerID,
|
|
17158
|
+
modelID: args.model?.modelID
|
|
17159
|
+
}) : estimator({
|
|
17160
|
+
messages: args.messages,
|
|
17161
|
+
systemPromptTokens: args.systemPromptTokens,
|
|
17162
|
+
providerID: args.model?.providerID,
|
|
17163
|
+
modelID: args.model?.modelID,
|
|
17164
|
+
agentName: args.agentName
|
|
17165
|
+
})
|
|
16836
17166
|
});
|
|
16837
|
-
|
|
16838
|
-
|
|
16839
|
-
|
|
16840
|
-
|
|
16841
|
-
|
|
16842
|
-
}
|
|
17167
|
+
}
|
|
17168
|
+
function lkgReplayFits(args) {
|
|
17169
|
+
let limit;
|
|
17170
|
+
try {
|
|
17171
|
+
limit = lkgReplayLimit(args);
|
|
17172
|
+
} catch {
|
|
17173
|
+
return { fits: false, detail: null };
|
|
17174
|
+
}
|
|
17175
|
+
if (limit === undefined)
|
|
17176
|
+
return { fits: false, detail: null };
|
|
17177
|
+
const measure = measureLkgReplayRequest({ ...args, limit });
|
|
17178
|
+
if (measure.fit === "under")
|
|
17179
|
+
return { fits: true };
|
|
17180
|
+
return {
|
|
17181
|
+
fits: false,
|
|
17182
|
+
detail: measure.fit === "over" ? `lkg_over_context_limit estimated=${measure.tokens ?? "skipped"} proxy_tokens=${measure.proxyTokens ?? "unavailable"} limit=${limit}` : `lkg_fit_untrusted estimated=${measure.tokens ?? "unavailable"} limit=${limit}`
|
|
17183
|
+
};
|
|
16843
17184
|
}
|
|
16844
17185
|
|
|
16845
17186
|
// src/hooks/magic-context/storage-busy-refusal.ts
|
|
@@ -17968,10 +18309,10 @@ function createPassOutcome() {
|
|
|
17968
18309
|
finalized = true;
|
|
17969
18310
|
},
|
|
17970
18311
|
get captureEligible() {
|
|
17971
|
-
return finalized && degradations.
|
|
18312
|
+
return finalized && degradations.every((item) => item.kind !== "fatal" && item.site === "auto-search-timeout");
|
|
17972
18313
|
},
|
|
17973
18314
|
isCaptureEligible() {
|
|
17974
|
-
return finalized && degradations.
|
|
18315
|
+
return finalized && degradations.every((item) => item.kind !== "fatal" && item.site === "auto-search-timeout");
|
|
17975
18316
|
}
|
|
17976
18317
|
};
|
|
17977
18318
|
}
|
|
@@ -18560,91 +18901,6 @@ function createHistorianHostRunner(args) {
|
|
|
18560
18901
|
});
|
|
18561
18902
|
}
|
|
18562
18903
|
|
|
18563
|
-
// src/hooks/magic-context/lkg-replay-fit.ts
|
|
18564
|
-
var RAW_FALLBACK_BYTES_PER_CONTEXT_TOKEN = 4;
|
|
18565
|
-
function lkgReplayLimit(args) {
|
|
18566
|
-
const { db, sessionId, model } = args;
|
|
18567
|
-
const trusted = model ? resolveTrustedContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : undefined;
|
|
18568
|
-
if (trusted !== undefined && trusted > 0)
|
|
18569
|
-
return trusted;
|
|
18570
|
-
const detected = getOverflowState(db, sessionId, args.modelKey).detectedContextLimit;
|
|
18571
|
-
return detected > 0 ? detected : undefined;
|
|
18572
|
-
}
|
|
18573
|
-
function measureLkgReplay(args) {
|
|
18574
|
-
const baseline = args.measuredInputTokens ?? 0;
|
|
18575
|
-
const tailLimit = Math.max(0, args.limit - baseline);
|
|
18576
|
-
const proxy = wireContentBytes(args.messages, tailLimit * RAW_FALLBACK_BYTES_PER_CONTEXT_TOKEN, RAW_FALLBACK_BYTES_PER_CONTEXT_TOKEN);
|
|
18577
|
-
const skipped = { proxy, estimatorRan: false, trusted: false };
|
|
18578
|
-
if (proxy === null)
|
|
18579
|
-
return { fit: "unproven", tokens: null, ...skipped };
|
|
18580
|
-
const proxyTokens = baseline + Math.ceil(proxy.bytes / RAW_FALLBACK_BYTES_PER_CONTEXT_TOKEN);
|
|
18581
|
-
if (proxy.aborted || proxyTokens > args.limit) {
|
|
18582
|
-
return { fit: "over", tokens: null, proxyTokens, ...skipped };
|
|
18583
|
-
}
|
|
18584
|
-
let estimate;
|
|
18585
|
-
try {
|
|
18586
|
-
estimate = args.estimate();
|
|
18587
|
-
} catch {
|
|
18588
|
-
return { fit: "unproven", tokens: null, ...skipped };
|
|
18589
|
-
}
|
|
18590
|
-
const seen = { proxy, estimatorRan: true, trusted: estimate.trusted };
|
|
18591
|
-
const tokens = baseline + estimate.tokens;
|
|
18592
|
-
if (!estimate.trusted || !Number.isFinite(tokens) || tokens <= 0 || estimate.tokens < 0) {
|
|
18593
|
-
return {
|
|
18594
|
-
fit: "unproven",
|
|
18595
|
-
tokens: Number.isFinite(estimate.tokens) ? estimate.tokens : null,
|
|
18596
|
-
...seen
|
|
18597
|
-
};
|
|
18598
|
-
}
|
|
18599
|
-
return tokens > args.limit ? { fit: "over", tokens, proxyTokens, ...seen } : { fit: "under", tokens, ...seen };
|
|
18600
|
-
}
|
|
18601
|
-
function measureLkgReplayRequest(args) {
|
|
18602
|
-
let measured;
|
|
18603
|
-
try {
|
|
18604
|
-
measured = args.model ? measuredLkgPrefix({
|
|
18605
|
-
...args,
|
|
18606
|
-
slot: getSlot(args.sessionId),
|
|
18607
|
-
modelKey: `${args.model.providerID}/${args.model.modelID}`
|
|
18608
|
-
}) : undefined;
|
|
18609
|
-
} catch {
|
|
18610
|
-
measured = undefined;
|
|
18611
|
-
}
|
|
18612
|
-
const estimator = args.estimator ?? estimateFinalWireInputTokens;
|
|
18613
|
-
return measureLkgReplay({
|
|
18614
|
-
messages: measured?.appendedMessages ?? args.messages,
|
|
18615
|
-
limit: args.limit,
|
|
18616
|
-
measuredInputTokens: measured?.inputTokens,
|
|
18617
|
-
estimate: () => measured ? estimateAppendedWireTokens({
|
|
18618
|
-
messages: measured.appendedMessages,
|
|
18619
|
-
providerID: args.model?.providerID,
|
|
18620
|
-
modelID: args.model?.modelID
|
|
18621
|
-
}) : estimator({
|
|
18622
|
-
messages: args.messages,
|
|
18623
|
-
systemPromptTokens: args.systemPromptTokens,
|
|
18624
|
-
providerID: args.model?.providerID,
|
|
18625
|
-
modelID: args.model?.modelID,
|
|
18626
|
-
agentName: args.agentName
|
|
18627
|
-
})
|
|
18628
|
-
});
|
|
18629
|
-
}
|
|
18630
|
-
function lkgReplayFits(args) {
|
|
18631
|
-
let limit;
|
|
18632
|
-
try {
|
|
18633
|
-
limit = lkgReplayLimit(args);
|
|
18634
|
-
} catch {
|
|
18635
|
-
return { fits: false, detail: null };
|
|
18636
|
-
}
|
|
18637
|
-
if (limit === undefined)
|
|
18638
|
-
return { fits: false, detail: null };
|
|
18639
|
-
const measure = measureLkgReplayRequest({ ...args, limit });
|
|
18640
|
-
if (measure.fit === "under")
|
|
18641
|
-
return { fits: true };
|
|
18642
|
-
return {
|
|
18643
|
-
fits: false,
|
|
18644
|
-
detail: measure.fit === "over" ? `lkg_over_context_limit estimated=${measure.tokens ?? "skipped"} proxy_tokens=${measure.proxyTokens ?? "unavailable"} limit=${limit}` : `lkg_fit_untrusted estimated=${measure.tokens ?? "unavailable"} limit=${limit}`
|
|
18645
|
-
};
|
|
18646
|
-
}
|
|
18647
|
-
|
|
18648
18904
|
// src/hooks/magic-context/module-state-sync.ts
|
|
18649
18905
|
import { createHmac, randomUUID as randomUUID4 } from "node:crypto";
|
|
18650
18906
|
|
|
@@ -19276,6 +19532,73 @@ function moduleRawBlockMappings(message) {
|
|
|
19276
19532
|
}
|
|
19277
19533
|
return mappings;
|
|
19278
19534
|
}
|
|
19535
|
+
function moduleToolOutput(part, state, text) {
|
|
19536
|
+
const attachments = state.attachments ?? part.attachments;
|
|
19537
|
+
const error = state.status === "error";
|
|
19538
|
+
if (!Array.isArray(attachments) || attachments.length === 0) {
|
|
19539
|
+
return { kind: { type: error ? "error_text" : "text", text } };
|
|
19540
|
+
}
|
|
19541
|
+
const blocks = [{ kind: { type: "text", text } }];
|
|
19542
|
+
for (const attachment of attachments) {
|
|
19543
|
+
const child = attachment !== null && typeof attachment === "object" ? attachment : {};
|
|
19544
|
+
const string = (key) => typeof child[key] === "string" ? child[key] : undefined;
|
|
19545
|
+
const mime = string("mime") ?? string("mimeType");
|
|
19546
|
+
const data = string("data");
|
|
19547
|
+
const url = string("url");
|
|
19548
|
+
let kind;
|
|
19549
|
+
if (child.type === "text" && typeof child.text === "string") {
|
|
19550
|
+
kind = { type: "text", text: child.text };
|
|
19551
|
+
} else if (mime !== undefined && (data !== undefined || url !== undefined)) {
|
|
19552
|
+
const prefix = `data:${mime};base64,`;
|
|
19553
|
+
const nativeUrl = url ?? "";
|
|
19554
|
+
const source = data !== undefined ? { type: "data_base64", data } : nativeUrl.startsWith(prefix) ? { type: "data_base64", data: nativeUrl.slice(prefix.length) } : { type: "url", url };
|
|
19555
|
+
const filename = string("filename") ?? string("name");
|
|
19556
|
+
kind = {
|
|
19557
|
+
type: "media",
|
|
19558
|
+
media: {
|
|
19559
|
+
kind: mime.startsWith("image/") ? "image" : mime.startsWith("audio/") ? "audio" : mime.startsWith("video/") ? "video" : mime === "application/pdf" ? "document" : "file",
|
|
19560
|
+
media_type: mime,
|
|
19561
|
+
...filename !== undefined ? { filename } : {},
|
|
19562
|
+
source
|
|
19563
|
+
}
|
|
19564
|
+
};
|
|
19565
|
+
} else {
|
|
19566
|
+
kind = {
|
|
19567
|
+
type: "opaque",
|
|
19568
|
+
opaque: {
|
|
19569
|
+
source: { type: "harness", harness: "opencode" },
|
|
19570
|
+
kind: string("type") ?? "attachment",
|
|
19571
|
+
raw: attachment
|
|
19572
|
+
}
|
|
19573
|
+
};
|
|
19574
|
+
}
|
|
19575
|
+
const rawAttachment = { ...child };
|
|
19576
|
+
const sourceFields = [];
|
|
19577
|
+
if (kind.type === "media") {
|
|
19578
|
+
const media = kind.media;
|
|
19579
|
+
const derivedUrl = media.source.type === "data_base64" ? `data:${mime};base64,${media.source.data}` : media.source.url;
|
|
19580
|
+
for (const [field, derived] of [
|
|
19581
|
+
["url", derivedUrl],
|
|
19582
|
+
["data", media.source.data]
|
|
19583
|
+
]) {
|
|
19584
|
+
if (child[field] !== undefined && child[field] === derived) {
|
|
19585
|
+
delete rawAttachment[field];
|
|
19586
|
+
sourceFields.push(field);
|
|
19587
|
+
}
|
|
19588
|
+
}
|
|
19589
|
+
}
|
|
19590
|
+
blocks.push(kind.type === "opaque" ? { kind } : {
|
|
19591
|
+
kind,
|
|
19592
|
+
provider_extras: {
|
|
19593
|
+
opencode: {
|
|
19594
|
+
rawAttachment,
|
|
19595
|
+
...sourceFields.length ? { rawAttachmentSourceFields: sourceFields } : {}
|
|
19596
|
+
}
|
|
19597
|
+
}
|
|
19598
|
+
});
|
|
19599
|
+
}
|
|
19600
|
+
return { kind: { type: error ? "error_content" : "content", blocks } };
|
|
19601
|
+
}
|
|
19279
19602
|
function encodeOpenCodeMessagesToCk(messages) {
|
|
19280
19603
|
return messages.map((message, index) => {
|
|
19281
19604
|
const raw = message !== null && typeof message === "object" ? message : {};
|
|
@@ -19346,12 +19669,7 @@ function encodeOpenCodeMessagesToCk(messages) {
|
|
|
19346
19669
|
type: "tool_result",
|
|
19347
19670
|
id: callId,
|
|
19348
19671
|
tool_name: toolName,
|
|
19349
|
-
output:
|
|
19350
|
-
kind: {
|
|
19351
|
-
type: state.status === "error" ? "error_text" : "text",
|
|
19352
|
-
text: output
|
|
19353
|
-
}
|
|
19354
|
-
}
|
|
19672
|
+
output: moduleToolOutput(part, state, output)
|
|
19355
19673
|
}
|
|
19356
19674
|
});
|
|
19357
19675
|
}
|
|
@@ -21232,7 +21550,7 @@ function buildTransformBody(args) {
|
|
|
21232
21550
|
historian_model_limits: args.passInputs.historian_model_limits,
|
|
21233
21551
|
historian_model_variants: args.passInputs.historian_model_variants,
|
|
21234
21552
|
historian_timeout_ms: args.passInputs.historian_timeout_ms,
|
|
21235
|
-
|
|
21553
|
+
keep_reasoning_tokens_effective: args.passInputs.keep_reasoning_tokens_effective,
|
|
21236
21554
|
caveman_enabled: args.passInputs.caveman_enabled === true,
|
|
21237
21555
|
caveman_min_chars: args.passInputs.caveman_min_chars ?? 500,
|
|
21238
21556
|
cache_ttl: args.passInputs.cache_ttl,
|
|
@@ -21752,6 +22070,15 @@ function createRustModeTransform(deps, options) {
|
|
|
21752
22070
|
sessionLog(sessionId, "RUST LOOP BREAKER: suppressing host directives after three consecutive synthetic turns until a real user message arrives");
|
|
21753
22071
|
}
|
|
21754
22072
|
const inputCount = messages.length;
|
|
22073
|
+
const inputHasActiveThinking = hasActiveAnthropicThinkingTurn(messages, "anthropic");
|
|
22074
|
+
const thinkingRecovery = prepareLatestThinkingRecovery({
|
|
22075
|
+
db: deps.db,
|
|
22076
|
+
sessionId,
|
|
22077
|
+
messages,
|
|
22078
|
+
id: (message) => message?.info.id,
|
|
22079
|
+
parts: (message) => message?.parts ?? []
|
|
22080
|
+
});
|
|
22081
|
+
const restoreLatestTurnOriginals = thinkingRecovery.restore ? captureLatestTurnOriginals(messages) : undefined;
|
|
21755
22082
|
let requestInputTokens = 0;
|
|
21756
22083
|
let decision = "error";
|
|
21757
22084
|
let materializeReason = "none";
|
|
@@ -22177,7 +22504,7 @@ function createRustModeTransform(deps, options) {
|
|
|
22177
22504
|
historian_model_chain: historianChain,
|
|
22178
22505
|
historian_model_variants: resolvedHistorianModelVariants(historianModels),
|
|
22179
22506
|
historian_timeout_ms: historianRun?.timeoutMs ?? deps.historianTimeoutMs ?? DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
22180
|
-
|
|
22507
|
+
keep_reasoning_tokens_effective: resolveKeepReasoningTokens(deps.keepReasoningTokens, modelKey ?? undefined),
|
|
22181
22508
|
caveman_enabled: !sessionMeta.isSubagent && deps.cavemanTextCompression?.enabled === true,
|
|
22182
22509
|
caveman_min_chars: deps.cavemanTextCompression?.minChars ?? 500,
|
|
22183
22510
|
cache_ttl: sessionMeta.cacheTtl,
|
|
@@ -22830,7 +23157,12 @@ function createRustModeTransform(deps, options) {
|
|
|
22830
23157
|
throw error;
|
|
22831
23158
|
}
|
|
22832
23159
|
}
|
|
23160
|
+
const protectedThinkingMessages = latestAssistantTurnMessages(appliedMessages);
|
|
23161
|
+
const activeThinkingTurn = inputHasActiveThinking && isAnthropicFamilyRoute(model?.providerID, model?.modelID);
|
|
22833
23162
|
const postprocess = runRustModePostprocess2({
|
|
23163
|
+
activeThinkingTurn,
|
|
23164
|
+
protectedThinkingMessages: thinkingRecovery.restore ? protectedThinkingMessages : undefined,
|
|
23165
|
+
restoreLatestTurnOriginals: () => restoreLatestTurnOriginals?.(appliedMessages),
|
|
22834
23166
|
db: deps.db,
|
|
22835
23167
|
sessionId,
|
|
22836
23168
|
messages: appliedMessages,
|
|
@@ -23090,6 +23422,7 @@ function createRustModeTransform(deps, options) {
|
|
|
23090
23422
|
agentName: deps.getNotificationParams?.(sessionId)?.agent,
|
|
23091
23423
|
systemPromptHash: sessionMeta.systemPromptHash
|
|
23092
23424
|
});
|
|
23425
|
+
captureOpencodeReasoningBudgetStatus(sessionId, output.messages, resolveKeepReasoningTokens(deps.keepReasoningTokens, modelKey ?? undefined), isPrefixBoundThinkingModel(model?.providerID, model?.modelID));
|
|
23093
23426
|
finishPass(true);
|
|
23094
23427
|
if (state.markerAdmissionFenced) {
|
|
23095
23428
|
setRustMarkerAdmissionFence(deps.db, sessionId, false);
|
|
@@ -23372,8 +23705,24 @@ function historianJoinFailClosedMessage(input) {
|
|
|
23372
23705
|
return `historian did not complete within ${seconds} s: ${reason}`;
|
|
23373
23706
|
}
|
|
23374
23707
|
function runCompartmentPhase(args) {
|
|
23708
|
+
if (args.historianRunnable !== false && !args.compactionOff && args.canRunCompartments && !getActiveCompartmentRun(args.sessionId) && (args.sessionMeta.compartmentInProgress || args.contextUsage.percentage >= BLOCK_UNTIL_DONE_PERCENTAGE) && isHistorianDrainBudgetSpent({
|
|
23709
|
+
db: args.db,
|
|
23710
|
+
sessionId: args.sessionId,
|
|
23711
|
+
contextLimit: args.boundaryContextLimit,
|
|
23712
|
+
executeThresholdPercentage: args.boundaryExecuteThresholdPercentage,
|
|
23713
|
+
usagePercentage: args.boundaryUsage.percentage
|
|
23714
|
+
})) {
|
|
23715
|
+
if (args.sessionMeta.compartmentInProgress) {
|
|
23716
|
+
updateSessionMeta(args.db, args.sessionId, { compartmentInProgress: false });
|
|
23717
|
+
}
|
|
23718
|
+
return runCompartmentPhaseImpl({
|
|
23719
|
+
...args,
|
|
23720
|
+
canRunCompartments: false,
|
|
23721
|
+
sessionMeta: { compartmentInProgress: false }
|
|
23722
|
+
});
|
|
23723
|
+
}
|
|
23375
23724
|
const historianRunnable = args.historianRunnable !== false;
|
|
23376
|
-
const willReadRawHistory = historianRunnable && !args.compactionOff && args.canRunCompartments && getActiveCompartmentRun(args.sessionId) === undefined &&
|
|
23725
|
+
const willReadRawHistory = historianRunnable && !args.compactionOff && args.canRunCompartments && getActiveCompartmentRun(args.sessionId) === undefined && args.contextUsage.percentage >= BLOCK_UNTIL_DONE_PERCENTAGE;
|
|
23377
23726
|
if (!willReadRawHistory) {
|
|
23378
23727
|
return runCompartmentPhaseImpl(args);
|
|
23379
23728
|
}
|
|
@@ -23499,7 +23848,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
23499
23848
|
compartmentInProgress = false;
|
|
23500
23849
|
}
|
|
23501
23850
|
if (historianRunnable && args.canRunCompartments && args.sessionMeta.compartmentInProgress && !getActiveCompartmentRun(args.sessionId)) {
|
|
23502
|
-
if (!hasEligibleHistoryForCompartment()) {
|
|
23851
|
+
if (args.contextUsage.percentage >= BLOCK_UNTIL_DONE_PERCENTAGE && !hasEligibleHistoryForCompartment()) {
|
|
23503
23852
|
sessionLog(args.sessionId, `transform: skipping compartment start, no eligible history before protected tail (beyond ${lastObservedCompartmentEnd})`);
|
|
23504
23853
|
updateSessionMeta(args.db, args.sessionId, { compartmentInProgress: false });
|
|
23505
23854
|
compartmentInProgress = false;
|
|
@@ -23516,7 +23865,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
23516
23865
|
db: args.db,
|
|
23517
23866
|
sessionId: args.sessionId,
|
|
23518
23867
|
historianChunkTokens: args.historianChunkTokens,
|
|
23519
|
-
boundarySnapshot:
|
|
23868
|
+
boundarySnapshot: args.preResolvedBoundarySnapshot,
|
|
23520
23869
|
currentContextLimit: args.boundaryContextLimit,
|
|
23521
23870
|
historyBudgetTokens: args.historyBudgetTokens,
|
|
23522
23871
|
historianTimeoutMs: args.historianTimeoutMs,
|
|
@@ -23535,6 +23884,12 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
23535
23884
|
autoPromote: args.autoPromote,
|
|
23536
23885
|
onCompartmentStatePublished: args.onCompartmentStatePublished,
|
|
23537
23886
|
preserveInjectionCacheUntilConsumed: true
|
|
23887
|
+
}, undefined, () => {
|
|
23888
|
+
const snapshot = getBoundarySnapshotForCompartment();
|
|
23889
|
+
if (snapshot && hasRunnableCompartmentWindow(snapshot))
|
|
23890
|
+
return snapshot;
|
|
23891
|
+
sessionLog(args.sessionId, `transform: skipping compartment start, no eligible history before protected tail (beyond ${lastObservedCompartmentEnd})`);
|
|
23892
|
+
return null;
|
|
23538
23893
|
});
|
|
23539
23894
|
compartmentInProgress = true;
|
|
23540
23895
|
}
|
|
@@ -23889,7 +24244,19 @@ function createTransform(deps) {
|
|
|
23889
24244
|
sessionDirectoryFellBack = true;
|
|
23890
24245
|
}
|
|
23891
24246
|
}
|
|
23892
|
-
const
|
|
24247
|
+
const activeThinkingModel = findLastAssistantModel(messages) ?? deps.liveModelBySession?.get(sessionId);
|
|
24248
|
+
const thinkingRecovery = prepareLatestThinkingRecovery({
|
|
24249
|
+
db,
|
|
24250
|
+
sessionId,
|
|
24251
|
+
messages,
|
|
24252
|
+
id: (message) => message?.info.id,
|
|
24253
|
+
parts: (message) => message?.parts ?? []
|
|
24254
|
+
});
|
|
24255
|
+
if (thinkingRecovery.ended)
|
|
24256
|
+
deps.pendingMaterializationSessions?.add(sessionId);
|
|
24257
|
+
let restoreLatestTurnOriginals;
|
|
24258
|
+
let activeThinkingTurn = hasActiveAnthropicThinkingTurn(messages, activeThinkingModel?.providerID, activeThinkingModel?.modelID);
|
|
24259
|
+
let freezeM0M1 = activeThinkingTurn && isPrefixBoundThinkingModel(activeThinkingModel?.providerID, activeThinkingModel?.modelID) || sessionDirectoryFellBack && sessionMeta.cachedM0Bytes != null && sessionMeta.cachedM1Bytes != null && (() => {
|
|
23893
24260
|
try {
|
|
23894
24261
|
return hasRecordedSessionProjectIdentity(db, sessionId);
|
|
23895
24262
|
} catch {
|
|
@@ -24019,7 +24386,10 @@ function createTransform(deps) {
|
|
|
24019
24386
|
}
|
|
24020
24387
|
}
|
|
24021
24388
|
const resolvedProviderID = modelForBudget?.providerID;
|
|
24389
|
+
activeThinkingTurn ||= hasActiveAnthropicThinkingTurn(messages, resolvedProviderID, modelForBudget?.modelID);
|
|
24390
|
+
freezeM0M1 ||= activeThinkingTurn && isPrefixBoundThinkingModel(resolvedProviderID, modelForBudget?.modelID);
|
|
24022
24391
|
const canUseEmptySentinels = modelAcceptsEmptyContent(resolvedProviderID);
|
|
24392
|
+
const protectedThinkingMessages = activeThinkingTurn || isAnthropicFamilyRoute(resolvedProviderID, modelForBudget?.modelID) ? latestAssistantTurnMessages(messages) : new Set;
|
|
24023
24393
|
const resolvedContextLimit = modelForBudget ? resolveTrustedContextLimit(modelForBudget.providerID, modelForBudget.modelID, {
|
|
24024
24394
|
db,
|
|
24025
24395
|
sessionID: sessionId
|
|
@@ -24129,19 +24499,33 @@ function createTransform(deps) {
|
|
|
24129
24499
|
if (false) {}
|
|
24130
24500
|
return false;
|
|
24131
24501
|
};
|
|
24132
|
-
const startRecoveryRun = () => {
|
|
24133
|
-
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
|
|
24137
|
-
|
|
24138
|
-
|
|
24139
|
-
|
|
24502
|
+
const startRecoveryRun = (onReady) => {
|
|
24503
|
+
if (isHistorianDrainBudgetSpent({
|
|
24504
|
+
db,
|
|
24505
|
+
sessionId,
|
|
24506
|
+
contextLimit: boundaryContextLimit,
|
|
24507
|
+
executeThresholdPercentage: boundaryExecuteThreshold,
|
|
24508
|
+
usagePercentage: boundaryUsageForProtectedTail.percentage
|
|
24509
|
+
}))
|
|
24140
24510
|
return false;
|
|
24141
|
-
|
|
24142
|
-
|
|
24511
|
+
if (!canRunCompartments || !deps.client && !deps.hiddenCompletionExecutor || getActiveCompartmentRun(sessionId))
|
|
24512
|
+
return false;
|
|
24513
|
+
const prepareRecoveryBoundary = () => {
|
|
24514
|
+
const scale = emergencyUsagePercentageEarly >= 95 ? 0.25 : 0.5;
|
|
24515
|
+
let boundarySnapshot = getRunnableBoundaryForCompartment();
|
|
24516
|
+
if (!boundarySnapshot || !hasRunnableCompartmentWindow(boundarySnapshot)) {
|
|
24517
|
+
boundarySnapshot = getRunnableBoundaryForCompartment(scale);
|
|
24518
|
+
}
|
|
24519
|
+
if (false) {}
|
|
24520
|
+
if (!boundarySnapshot || !hasRunnableCompartmentWindow(boundarySnapshot))
|
|
24521
|
+
return null;
|
|
24522
|
+
onReady?.();
|
|
24523
|
+
return boundarySnapshot;
|
|
24524
|
+
};
|
|
24525
|
+
const urgent = emergencyUsagePercentageEarly >= 95;
|
|
24526
|
+
const boundarySnapshot = urgent ? prepareRecoveryBoundary() : undefined;
|
|
24527
|
+
if (urgent && !boundarySnapshot)
|
|
24143
24528
|
return false;
|
|
24144
|
-
}
|
|
24145
24529
|
updateSessionMeta(db, sessionId, { compartmentInProgress: true });
|
|
24146
24530
|
startCompartmentAgent({
|
|
24147
24531
|
client: deps.client,
|
|
@@ -24150,7 +24534,7 @@ function createTransform(deps) {
|
|
|
24150
24534
|
db,
|
|
24151
24535
|
sessionId,
|
|
24152
24536
|
historianChunkTokens: historianRun?.chunkTokens ?? deps.getHistorianChunkTokens?.() ?? 20000,
|
|
24153
|
-
boundarySnapshot,
|
|
24537
|
+
boundarySnapshot: boundarySnapshot ?? undefined,
|
|
24154
24538
|
currentContextLimit: boundaryContextLimit,
|
|
24155
24539
|
historyBudgetTokens,
|
|
24156
24540
|
historianTimeoutMs: historianRun?.timeoutMs ?? deps.historianTimeoutMs,
|
|
@@ -24171,7 +24555,7 @@ function createTransform(deps) {
|
|
|
24171
24555
|
deferredHistoryRefreshSessions.add(sid);
|
|
24172
24556
|
deferredMaterializationSessions.add(sid);
|
|
24173
24557
|
}
|
|
24174
|
-
});
|
|
24558
|
+
}, undefined, urgent ? undefined : prepareRecoveryBoundary);
|
|
24175
24559
|
return true;
|
|
24176
24560
|
};
|
|
24177
24561
|
if (fullFeatureMode && !compactionOff && historianFailureState.failureCount > 0 && emergencyUsagePercentageEarly >= 95 && !recoveryNoHeadEscapeActive) {
|
|
@@ -24185,13 +24569,15 @@ function createTransform(deps) {
|
|
|
24185
24569
|
sessionLog(sessionId, "transform: emergency recovery remains armed — no complete eligible head before protected tail");
|
|
24186
24570
|
}
|
|
24187
24571
|
sessionLog(sessionId, `EMERGENCY: historian recovery requested at ${emergencyPercentage}%, failures: ${historianFailureState.failureCount}`);
|
|
24188
|
-
} else if (fullFeatureMode && !compactionOff && isFirstTransformPassForSession && historianFailureState.failureCount > 0
|
|
24189
|
-
|
|
24190
|
-
|
|
24191
|
-
|
|
24572
|
+
} else if (fullFeatureMode && !compactionOff && isFirstTransformPassForSession && historianFailureState.failureCount > 0) {
|
|
24573
|
+
startRecoveryRun(() => {
|
|
24574
|
+
sessionLog(sessionId, `transform: historian recovery triggered on session load after ${historianFailureState.failureCount} failure(s)`);
|
|
24575
|
+
if (deps.client) {
|
|
24576
|
+
withoutSqliteTransformPass(() => sendStatusNotification2(deps.client, sessionId, `## Historian recovery
|
|
24192
24577
|
|
|
24193
24578
|
Historian previously failed ${historianFailureState.failureCount} time(s), so Magic Context is retrying history comparting immediately after restart.`, notificationParams));
|
|
24194
|
-
|
|
24579
|
+
}
|
|
24580
|
+
});
|
|
24195
24581
|
}
|
|
24196
24582
|
logTransformTiming(sessionId, "emergencyRecoveryBlock", tFirstPass);
|
|
24197
24583
|
const memoryProjectDirectory = compartmentDirectory || process.cwd();
|
|
@@ -24219,7 +24605,10 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24219
24605
|
const tTrigger = performance.now();
|
|
24220
24606
|
try {
|
|
24221
24607
|
const inMemoryTail = buildTriggerInMemoryTail(db, sessionId, extractInMemoryMessageViews(messages));
|
|
24222
|
-
const triggerResult = checkCompartmentTrigger(db, sessionId, sessionMeta, boundaryUsageForProtectedTail, sessionMeta.lastContextPercentage, boundaryExecuteThreshold, deriveTriggerBudget2(boundaryContextLimit, boundaryExecuteThreshold), deps.
|
|
24608
|
+
const triggerResult = checkCompartmentTrigger(db, sessionId, sessionMeta, boundaryUsageForProtectedTail, sessionMeta.lastContextPercentage, boundaryExecuteThreshold, deriveTriggerBudget2(boundaryContextLimit, boundaryExecuteThreshold), resolveKeepReasoningTokens(deps.keepReasoningTokens, currentModelKeyForBoundary), historianRun?.commitClusterTrigger ?? deps.commitClusterTrigger, undefined, boundaryContextLimit, inMemoryTail, taggerFloor, {
|
|
24609
|
+
providerID: resolvedProviderID,
|
|
24610
|
+
budgetCutoff: projectOpencodeReasoningBudgetCutoff(db, sessionId, messages, resolveKeepReasoningTokens(deps.keepReasoningTokens, currentModelKeyForBoundary), sessionMeta.clearedReasoningThroughTag, sessionDecisionCalibration(db, sessionId).proseRatio)
|
|
24611
|
+
}, {
|
|
24223
24612
|
hardFold: false,
|
|
24224
24613
|
force: contextUsageEarly.percentage >= forceMaterializationPercentage && (contextUsageEarly.percentage >= 95 || getEmergencyInputSample(db, sessionId) === 0),
|
|
24225
24614
|
explicitFlush: deps.pendingMaterializationSessions.has(sessionId),
|
|
@@ -24290,6 +24679,8 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24290
24679
|
servedMessages: messages
|
|
24291
24680
|
});
|
|
24292
24681
|
targets = result.targets;
|
|
24682
|
+
if (thinkingRecovery.restore)
|
|
24683
|
+
restoreLatestTurnOriginals = captureLatestTurnOriginals(messages);
|
|
24293
24684
|
reasoningByMessage = result.reasoningByMessage;
|
|
24294
24685
|
messageTagNumbers = result.messageTagNumbers;
|
|
24295
24686
|
batch = result.batch;
|
|
@@ -24550,7 +24941,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24550
24941
|
deferredHistoryRefreshSessions,
|
|
24551
24942
|
deferredMaterializationSessions,
|
|
24552
24943
|
lastHeuristicsTurnId: deps.lastHeuristicsTurnId,
|
|
24553
|
-
|
|
24944
|
+
keepReasoningTokens: resolveKeepReasoningTokens(deps.keepReasoningTokens, currentModelKeyForBoundary),
|
|
24554
24945
|
protectedTagIds,
|
|
24555
24946
|
protectedTagNumbers,
|
|
24556
24947
|
protectedCutoff,
|
|
@@ -24571,6 +24962,11 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24571
24962
|
smartDrops: deps.smartDrops === true,
|
|
24572
24963
|
protectedTools: deps.protectedTools,
|
|
24573
24964
|
resolvedProviderID,
|
|
24965
|
+
activeThinkingTurn,
|
|
24966
|
+
protectedThinkingMessages: thinkingRecovery.restore ? protectedThinkingMessages : undefined,
|
|
24967
|
+
restoreThinkingMessageIds: thinkingRecovery.restore ? new Set([...protectedThinkingMessages].flatMap((message) => typeof message.info.id === "string" ? [message.info.id] : [])) : undefined,
|
|
24968
|
+
restoreLatestTurnOriginals,
|
|
24969
|
+
resolvedModelID: modelForBudget?.modelID,
|
|
24574
24970
|
thinkingBindingRecoveryEnabledForModel: isPrefixBoundThinkingModel(modelForBudget?.providerID, modelForBudget?.modelID),
|
|
24575
24971
|
trailingBlankSourceDecisions,
|
|
24576
24972
|
passOutcome,
|
|
@@ -25226,6 +25622,102 @@ function preserveUserTerminatedTail(messages, inputMessages) {
|
|
|
25226
25622
|
}
|
|
25227
25623
|
moveUserToTail(messages, userIndex >= 0 ? messages[userIndex] : inputTail, userIndex);
|
|
25228
25624
|
}
|
|
25625
|
+
|
|
25626
|
+
class LkgAdmissionReplay extends Error {
|
|
25627
|
+
}
|
|
25628
|
+
function tryMessagesTransformLkgReplay(args) {
|
|
25629
|
+
const { output, sessionId, error, agent } = args;
|
|
25630
|
+
const slotAtEntry = getSlot(sessionId);
|
|
25631
|
+
let entry = args.entry;
|
|
25632
|
+
if (entry === undefined && slotAtEntry) {
|
|
25633
|
+
try {
|
|
25634
|
+
entry = noteEntry(sessionId, output.messages);
|
|
25635
|
+
} catch {
|
|
25636
|
+
entry = null;
|
|
25637
|
+
}
|
|
25638
|
+
}
|
|
25639
|
+
if (sessionId && slotAtEntry && !entry) {
|
|
25640
|
+
dropSlot(sessionId, "lkg_invalidated_reshape");
|
|
25641
|
+
sessionLog(sessionId, "lkg_invalidated_reshape");
|
|
25642
|
+
} else if (sessionId && entry) {
|
|
25643
|
+
let replayBlocked = false;
|
|
25644
|
+
try {
|
|
25645
|
+
const db = openDatabase();
|
|
25646
|
+
const rust = args.rust;
|
|
25647
|
+
if (error instanceof StorageBusyRefusalError && error.stage === "rust-mode-emergency" || rust?.emergencyFailClosed(sessionId, output.messages)) {
|
|
25648
|
+
replayBlocked = true;
|
|
25649
|
+
sessionLog(sessionId, "lkg_emergency_band_refused");
|
|
25650
|
+
} else if (!db || isEmergencyRecoveryArmed(sessionId) || getOverflowState(db, sessionId).needsEmergencyRecovery) {
|
|
25651
|
+
replayBlocked = true;
|
|
25652
|
+
sessionLog(sessionId, "lkg_emergency_armed");
|
|
25653
|
+
} else {
|
|
25654
|
+
const inputMessages = output.messages;
|
|
25655
|
+
const inputCount = inputMessages.length;
|
|
25656
|
+
const keys = resolveLkgModelKeys(inputMessages);
|
|
25657
|
+
const replay = replayLkg({
|
|
25658
|
+
sessionId,
|
|
25659
|
+
messages: inputMessages,
|
|
25660
|
+
modelKey: keys.modelKey,
|
|
25661
|
+
providerKey: keys.providerKey,
|
|
25662
|
+
entry,
|
|
25663
|
+
prepareReplay: (messages) => rust ? rust.stripPersistedReasoning(sessionId, messages, inputMessages) : replayRustModeBindingMismatchStrips2({
|
|
25664
|
+
db,
|
|
25665
|
+
sessionId,
|
|
25666
|
+
messages,
|
|
25667
|
+
resolvedProviderID: keys.providerKey ?? undefined
|
|
25668
|
+
})
|
|
25669
|
+
});
|
|
25670
|
+
let tsFit = true;
|
|
25671
|
+
if (replay.ok && !rust && keys.providerKey && keys.modelKey) {
|
|
25672
|
+
const model = {
|
|
25673
|
+
providerID: keys.providerKey,
|
|
25674
|
+
modelID: keys.modelKey.slice(keys.providerKey.length + 1)
|
|
25675
|
+
};
|
|
25676
|
+
if (lkgReplayLimit({
|
|
25677
|
+
db,
|
|
25678
|
+
sessionId,
|
|
25679
|
+
model,
|
|
25680
|
+
modelKey: keys.modelKey
|
|
25681
|
+
}) !== undefined) {
|
|
25682
|
+
const fit = lkgReplayFits({
|
|
25683
|
+
db,
|
|
25684
|
+
sessionId,
|
|
25685
|
+
messages: replay.messages,
|
|
25686
|
+
model,
|
|
25687
|
+
modelKey: keys.modelKey,
|
|
25688
|
+
systemPromptTokens: getOrCreateSessionMeta(db, sessionId).systemPromptTokens,
|
|
25689
|
+
agentName: agent
|
|
25690
|
+
});
|
|
25691
|
+
tsFit = fit.fits;
|
|
25692
|
+
if (!fit.fits && fit.detail)
|
|
25693
|
+
sessionLog(sessionId, fit.detail);
|
|
25694
|
+
}
|
|
25695
|
+
}
|
|
25696
|
+
if (replay.ok && (!tsFit || args.replayFits?.(replay.messages) === false || rust && !rust.replayFits(sessionId, replay.messages, inputMessages))) {
|
|
25697
|
+
replayBlocked = true;
|
|
25698
|
+
sessionLog(sessionId, "lkg_replay_does_not_fit");
|
|
25699
|
+
} else if (replay.ok) {
|
|
25700
|
+
args.onLkgReplay?.();
|
|
25701
|
+
replaceMessagesInPlace2(output, replay.messages);
|
|
25702
|
+
noteExternalLkgReplay(rust, sessionId, inputCount);
|
|
25703
|
+
sessionLog(sessionId, "lkg_replay_served");
|
|
25704
|
+
return true;
|
|
25705
|
+
} else {
|
|
25706
|
+
sessionLog(sessionId, replay.reason);
|
|
25707
|
+
}
|
|
25708
|
+
}
|
|
25709
|
+
} catch (replayError) {
|
|
25710
|
+
replayBlocked = true;
|
|
25711
|
+
sessionLog(sessionId, "lkg_replay_unavailable", replayError);
|
|
25712
|
+
}
|
|
25713
|
+
if (replayBlocked) {
|
|
25714
|
+
sessionLog(sessionId, "lkg_replay_declined");
|
|
25715
|
+
}
|
|
25716
|
+
} else if (sessionId) {
|
|
25717
|
+
sessionLog(sessionId, "lkg_miss");
|
|
25718
|
+
}
|
|
25719
|
+
return false;
|
|
25720
|
+
}
|
|
25229
25721
|
function createMessagesTransformHandler(args) {
|
|
25230
25722
|
const resolveRust = (sessionId) => args.rustReplayParticipant ? args.rustReplayParticipant() ?? undefined : resolveRustLkgReplayParticipant(sessionId);
|
|
25231
25723
|
const run = async (input, output) => {
|
|
@@ -25271,15 +25763,18 @@ function createMessagesTransformHandler(args) {
|
|
|
25271
25763
|
}
|
|
25272
25764
|
}
|
|
25273
25765
|
const magicContext = args.getMagicContext ? args.getMagicContext() : args.magicContext;
|
|
25274
|
-
const
|
|
25275
|
-
|
|
25766
|
+
const captureEntry = () => {
|
|
25767
|
+
if (!sessionId || !getSlot(sessionId))
|
|
25768
|
+
return null;
|
|
25276
25769
|
try {
|
|
25277
25770
|
return noteEntry(sessionId, output.messages);
|
|
25278
25771
|
} catch (error) {
|
|
25279
25772
|
sessionLog(sessionId, "lkg entry snapshot failed; replay unavailable", error);
|
|
25280
25773
|
return null;
|
|
25281
25774
|
}
|
|
25282
|
-
}
|
|
25775
|
+
};
|
|
25776
|
+
let entry = captureEntry();
|
|
25777
|
+
let admissionRetried = false;
|
|
25283
25778
|
try {
|
|
25284
25779
|
if (magicContext) {
|
|
25285
25780
|
const admissionDb = openDatabase();
|
|
@@ -25287,6 +25782,22 @@ function createMessagesTransformHandler(args) {
|
|
|
25287
25782
|
if (!args.compactionOff) {
|
|
25288
25783
|
await withAsyncPrivilegedWriter(admissionDb, () => {
|
|
25289
25784
|
return;
|
|
25785
|
+
}, {
|
|
25786
|
+
beforeRetry: (error) => {
|
|
25787
|
+
admissionRetried = true;
|
|
25788
|
+
entry = captureEntry();
|
|
25789
|
+
if (sessionId && tryMessagesTransformLkgReplay({
|
|
25790
|
+
output,
|
|
25791
|
+
sessionId,
|
|
25792
|
+
error,
|
|
25793
|
+
entry,
|
|
25794
|
+
rust: resolveRust(sessionId),
|
|
25795
|
+
agent,
|
|
25796
|
+
replayFits: args.replayFits,
|
|
25797
|
+
onLkgReplay: args.onLkgReplay
|
|
25798
|
+
}))
|
|
25799
|
+
throw new LkgAdmissionReplay;
|
|
25800
|
+
}
|
|
25290
25801
|
});
|
|
25291
25802
|
}
|
|
25292
25803
|
} else {
|
|
@@ -25312,9 +25823,13 @@ function createMessagesTransformHandler(args) {
|
|
|
25312
25823
|
}
|
|
25313
25824
|
}
|
|
25314
25825
|
}
|
|
25826
|
+
if (admissionRetried)
|
|
25827
|
+
entry = captureEntry();
|
|
25315
25828
|
await magicContext?.["experimental.chat.messages.transform"]?.(input, output);
|
|
25316
25829
|
return output.messages;
|
|
25317
25830
|
} catch (error) {
|
|
25831
|
+
if (error instanceof LkgAdmissionReplay)
|
|
25832
|
+
return output.messages;
|
|
25318
25833
|
if (error instanceof RawFallbackContextLimitError || error instanceof AssistantTerminalRetryError) {
|
|
25319
25834
|
throw error;
|
|
25320
25835
|
}
|
|
@@ -25330,85 +25845,17 @@ function createMessagesTransformHandler(args) {
|
|
|
25330
25845
|
}
|
|
25331
25846
|
if (args.compactionOff) {
|
|
25332
25847
|
restoreCompactionOffInput();
|
|
25333
|
-
} else if (sessionId &&
|
|
25334
|
-
|
|
25335
|
-
|
|
25336
|
-
|
|
25337
|
-
|
|
25338
|
-
|
|
25339
|
-
|
|
25340
|
-
|
|
25341
|
-
|
|
25342
|
-
|
|
25343
|
-
|
|
25344
|
-
} else if (!db || isEmergencyRecoveryArmed(sessionId) || getOverflowState(db, sessionId).needsEmergencyRecovery) {
|
|
25345
|
-
replayBlocked = true;
|
|
25346
|
-
sessionLog(sessionId, "lkg_emergency_armed");
|
|
25347
|
-
} else {
|
|
25348
|
-
const inputMessages = output.messages;
|
|
25349
|
-
const inputCount = inputMessages.length;
|
|
25350
|
-
const keys = resolveLkgModelKeys(inputMessages);
|
|
25351
|
-
const replay = replayLkg({
|
|
25352
|
-
sessionId,
|
|
25353
|
-
messages: inputMessages,
|
|
25354
|
-
modelKey: keys.modelKey,
|
|
25355
|
-
providerKey: keys.providerKey,
|
|
25356
|
-
entry,
|
|
25357
|
-
prepareReplay: (messages) => rust ? rust.stripPersistedReasoning(sessionId, messages, inputMessages) : replayRustModeBindingMismatchStrips2({
|
|
25358
|
-
db,
|
|
25359
|
-
sessionId,
|
|
25360
|
-
messages,
|
|
25361
|
-
resolvedProviderID: keys.providerKey ?? undefined
|
|
25362
|
-
})
|
|
25363
|
-
});
|
|
25364
|
-
let tsFit = true;
|
|
25365
|
-
if (replay.ok && !rust && keys.providerKey && keys.modelKey) {
|
|
25366
|
-
const model = {
|
|
25367
|
-
providerID: keys.providerKey,
|
|
25368
|
-
modelID: keys.modelKey.slice(keys.providerKey.length + 1)
|
|
25369
|
-
};
|
|
25370
|
-
if (lkgReplayLimit({
|
|
25371
|
-
db,
|
|
25372
|
-
sessionId,
|
|
25373
|
-
model,
|
|
25374
|
-
modelKey: keys.modelKey
|
|
25375
|
-
}) !== undefined) {
|
|
25376
|
-
const fit = lkgReplayFits({
|
|
25377
|
-
db,
|
|
25378
|
-
sessionId,
|
|
25379
|
-
messages: replay.messages,
|
|
25380
|
-
model,
|
|
25381
|
-
modelKey: keys.modelKey,
|
|
25382
|
-
systemPromptTokens: getOrCreateSessionMeta(db, sessionId).systemPromptTokens,
|
|
25383
|
-
agentName: agent
|
|
25384
|
-
});
|
|
25385
|
-
tsFit = fit.fits;
|
|
25386
|
-
if (!fit.fits && fit.detail)
|
|
25387
|
-
sessionLog(sessionId, fit.detail);
|
|
25388
|
-
}
|
|
25389
|
-
}
|
|
25390
|
-
if (replay.ok && (!tsFit || rust && !rust.replayFits(sessionId, replay.messages, inputMessages))) {
|
|
25391
|
-
replayBlocked = true;
|
|
25392
|
-
sessionLog(sessionId, "lkg_replay_does_not_fit");
|
|
25393
|
-
} else if (replay.ok) {
|
|
25394
|
-
args.onLkgReplay?.();
|
|
25395
|
-
replaceMessagesInPlace2(output, replay.messages);
|
|
25396
|
-
noteExternalLkgReplay(rust, sessionId, inputCount);
|
|
25397
|
-
sessionLog(sessionId, "lkg_replay_served");
|
|
25398
|
-
return output.messages;
|
|
25399
|
-
} else {
|
|
25400
|
-
sessionLog(sessionId, replay.reason);
|
|
25401
|
-
}
|
|
25402
|
-
}
|
|
25403
|
-
} catch (replayError) {
|
|
25404
|
-
replayBlocked = true;
|
|
25405
|
-
sessionLog(sessionId, "lkg_replay_unavailable", replayError);
|
|
25406
|
-
}
|
|
25407
|
-
if (replayBlocked) {
|
|
25408
|
-
sessionLog(sessionId, "lkg_replay_declined");
|
|
25409
|
-
}
|
|
25410
|
-
} else if (sessionId) {
|
|
25411
|
-
sessionLog(sessionId, "lkg_miss");
|
|
25848
|
+
} else if (sessionId && tryMessagesTransformLkgReplay({
|
|
25849
|
+
output,
|
|
25850
|
+
sessionId,
|
|
25851
|
+
error,
|
|
25852
|
+
entry,
|
|
25853
|
+
rust: resolveRust(sessionId),
|
|
25854
|
+
agent,
|
|
25855
|
+
replayFits: args.replayFits,
|
|
25856
|
+
onLkgReplay: args.onLkgReplay
|
|
25857
|
+
})) {
|
|
25858
|
+
return output.messages;
|
|
25412
25859
|
}
|
|
25413
25860
|
if (!args.compactionOff && (error instanceof UnresolvedHistoryBoundaryError || error instanceof UnmanagedOverWindowError || error instanceof DegradedPassRefusalError)) {
|
|
25414
25861
|
throw error;
|
|
@@ -27084,7 +27531,7 @@ function reasoningOf(part) {
|
|
|
27084
27531
|
function renderPartPreview(part, expandTools) {
|
|
27085
27532
|
if (!isRecord6(part))
|
|
27086
27533
|
return null;
|
|
27087
|
-
const expansion = expandToolPart(part, expandTools);
|
|
27534
|
+
const expansion = expandToolPart(part, expandTools, true);
|
|
27088
27535
|
if (expansion !== null)
|
|
27089
27536
|
return ` • tool ${part.tool}: ${expansion}`;
|
|
27090
27537
|
const text = textOf(part);
|
|
@@ -28503,4 +28950,4 @@ function createCtxSearchTools(deps) {
|
|
|
28503
28950
|
[CTX_SEARCH_TOOL_NAME]: createCtxSearchTool(deps)
|
|
28504
28951
|
};
|
|
28505
28952
|
}
|
|
28506
|
-
export { createSubcCheckoutClaimGate, openCodeEventSessionId, openOpenCodeDb, DREAMER_SYSTEM_PROMPT, runSessionProjectBackfill, SMART_NOTE_COMPILER_SYSTEM_PROMPT, createLiveSessionState, getDefaultSubcConnectionFile, SubcModuleTransport, RETROSPECTIVE_MAX_USER_MESSAGE_CHARS, RETROSPECTIVE_MESSAGE_TRUNCATION_MARKER, OpenCodeRetrospectiveRawProvider, createDreamTaskExecutor, runManualDream, runDueTasksForProject, createDbLkgPersistence, startDreamScheduleTimer, ensureProjectRegisteredFromOpenCodeDirectory, resolveContextWindowGeometry, resolveContextLimit, resolveExecuteThresholdDetail, resolveModelKey, resolveSessionId, createScheduler, describeStorageUnavailability, scheduleClearAndReindex, resolveSessionCacheTtl, runEmbedHistoryDrain, pauseEmbedHistoryDrain, formatEmbedStatusText, getSessionProperties, getSessionCreatedInfo, getMessageUpdatedAssistantInfo, getMessageUpdatedInfo, getSessionErrorInfo, getMessageRemovedInfo, summarizeManualDream, createMagicContextCommandHandler, getLiveNotificationParams, createChatMessageHook, createEventHook, createCommandExecuteBeforeHook, createToolExecuteAfterHook, recordHiddenVariantWarning, buildStatusDetail, isDebugRpcEnabled, registerRpcHandlers, clearTransformDecisionSession, scheduleOpenCodeTransformDecisionWrite, maybeDeliverChannel2, STORAGE_BUSY_MESSAGE, StorageBusyRefusalError, UnmanagedOverWindowError, UnresolvedHistoryBoundaryError, clearMessageTokensCache, createTransform, createSubcModuleClient, createModuleToolBackends, createRustRefusalRecovery, createSystemPromptHashHandler, createMessagesTransformHandler, primaryOnlyToolIds, subagentToolRefusal, guardSubagentTools, hideSubagentTools, createCtxExpandTools, CTX_MEMORY_LIST_TOOL_NAME, CTX_MEMORY_ACTIONS, createCtxMemoryTools, createCtxMemoryListTools, createCtxNoteTools, createCtxReduceTools, createCtxSearchTools, parameterDescriptionsFor, applyJsonSchemaParameterDescriptions, MagicContextRpcServer };
|
|
28953
|
+
export { createSubcCheckoutClaimGate, openCodeEventSessionId, openOpenCodeDb, DREAMER_SYSTEM_PROMPT, runSessionProjectBackfill, SMART_NOTE_COMPILER_SYSTEM_PROMPT, createLiveSessionState, getDefaultSubcConnectionFile, SubcModuleTransport, RETROSPECTIVE_MAX_USER_MESSAGE_CHARS, RETROSPECTIVE_MESSAGE_TRUNCATION_MARKER, OpenCodeRetrospectiveRawProvider, createDreamTaskExecutor, runManualDream, runDueTasksForProject, createDbLkgPersistence, startDreamScheduleTimer, ensureProjectRegisteredFromOpenCodeDirectory, recordOpenCodeProvenInputFloor, resolveOpenCodeProvenInputFloor, resolveContextWindowGeometry, resolveContextLimit, resolveExecuteThresholdDetail, resolveModelKey, resolveSessionId, createScheduler, describeStorageUnavailability, scheduleClearAndReindex, resolveSessionCacheTtl, runEmbedHistoryDrain, pauseEmbedHistoryDrain, formatEmbedStatusText, getSessionProperties, getSessionCreatedInfo, getMessageUpdatedAssistantInfo, getMessageUpdatedInfo, getSessionErrorInfo, getMessageRemovedInfo, summarizeManualDream, createMagicContextCommandHandler, getLiveNotificationParams, createChatMessageHook, createEventHook, createCommandExecuteBeforeHook, createToolExecuteAfterHook, recordHiddenVariantWarning, buildStatusDetail, isDebugRpcEnabled, registerRpcHandlers, clearTransformDecisionSession, scheduleOpenCodeTransformDecisionWrite, maybeDeliverChannel2, armLatestThinkingRecovery, armBindingRecoverySafely, armLatestThinkingRecoveryFromError, lkgReplayLimit, measureLkgReplay, STORAGE_BUSY_MESSAGE, StorageBusyRefusalError, UnmanagedOverWindowError, UnresolvedHistoryBoundaryError, clearMessageTokensCache, createTransform, createSubcModuleClient, createModuleToolBackends, createRustRefusalRecovery, createSystemPromptHashHandler, tryMessagesTransformLkgReplay, createMessagesTransformHandler, primaryOnlyToolIds, subagentToolRefusal, guardSubagentTools, hideSubagentTools, createCtxExpandTools, CTX_MEMORY_LIST_TOOL_NAME, CTX_MEMORY_ACTIONS, createCtxMemoryTools, createCtxMemoryListTools, createCtxNoteTools, createCtxReduceTools, createCtxSearchTools, parameterDescriptionsFor, applyJsonSchemaParameterDescriptions, MagicContextRpcServer };
|