@cortexkit/opencode-magic-context 0.49.12 → 0.49.14
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 +3 -3
- package/dist/chunk-embedding-write-worker.js +89 -0
- package/dist/config/schema/agent-overrides.d.ts +12 -12
- package/dist/config/schema/magic-context.d.ts +88 -88
- package/dist/{conflict-warning-hook-f4x5wed7.js → conflict-warning-hook-mgq17yr3.js} +3 -3
- package/dist/{context-dam8p201.js → context-cpxqpkzv.js} +55 -71
- package/dist/{derive-budgets-5306b1jt.js → derive-budgets-zn7yzd2d.js} +1 -1
- package/dist/{embedding-backfill-qbfcbp87.js → embedding-backfill-5e1t5wha.js} +6 -5
- package/dist/embedding-worker.js +1 -1
- package/dist/features/magic-context/chunk-embedding-write-worker.d.ts +2 -0
- package/dist/features/magic-context/chunk-embedding-write-worker.d.ts.map +1 -0
- package/dist/features/magic-context/chunk-embedding-writer.d.ts +48 -0
- package/dist/features/magic-context/chunk-embedding-writer.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +3 -2
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +8 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +2 -0
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +5 -0
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts +6 -1
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +25 -11
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts +3 -0
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +5 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +2 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +3 -1
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-embed-session.d.ts +10 -0
- package/dist/hooks/magic-context/auto-embed-session.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/degraded-pass-refusal.d.ts +2 -0
- package/dist/hooks/magic-context/degraded-pass-refusal.d.ts.map +1 -1
- package/dist/hooks/magic-context/embed-session-state.d.ts +8 -1
- package/dist/hooks/magic-context/embed-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +3 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/pending-drop-eligibility.d.ts +14 -0
- package/dist/hooks/magic-context/pending-drop-eligibility.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-fx90bvjd.js → index-3kdm78zp.js} +2 -2
- package/dist/{index-gf0psee3.js → index-3kx0kg0f.js} +60 -3
- package/dist/{index-1wwh38fk.js → index-5591fg8y.js} +471 -139
- package/dist/{index-b16gpywn.js → index-944w16m0.js} +2 -2
- package/dist/{index-6sz25c3s.js → index-bxdg2nbt.js} +2 -2
- package/dist/{index-7h8a1xpc.js → index-e4dsjj1p.js} +1 -1
- package/dist/{index-05n6ykca.js → index-kf4epshg.js} +3 -3
- package/dist/index-saews2s3.js +229 -0
- package/dist/{index-yx5kgp2x.js → index-t4q9zbbf.js} +95 -73
- package/dist/{index-wqs4q74r.js → index-thvnpfsv.js} +8 -8
- package/dist/{index-95s8xaj1.js → index-tyckte5c.js} +4 -4
- package/dist/{index-qtbdx42g.js → index-w900fbhd.js} +110 -25
- package/dist/{index-6sytd5w3.js → index-xn6q9pg6.js} +7 -7
- package/dist/{index-7zd5asz9.js → index-y1qysm3q.js} +196 -243
- package/dist/{index-x2xjyq8f.js → index-yxycg7fs.js} +9 -9
- package/dist/index.js +54 -92
- package/dist/{message-index-df7swgy1.js → message-index-a6gztaqx.js} +7 -7
- package/dist/{message-index-bounded-nq6rp8xa.js → message-index-bounded-vtgpq6b4.js} +4 -4
- package/dist/migration-worker.js +2 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-q0ysjyzc.js → project-embedding-registry-x45bv3qr.js} +5 -4
- package/dist/raw-ordinal-warmup-worker.js +3 -3
- package/dist/{read-session-chunk-ax05f7gr.js → read-session-chunk-3ae3nfdn.js} +2 -2
- package/dist/{recomp-orchestrator-a0mvby4e.js → recomp-orchestrator-xqb9gwgm.js} +21 -20
- package/dist/{search-fm002702.js → search-deajrd90.js} +16 -15
- package/dist/{send-session-notification-y2wg3fkh.js → send-session-notification-24r4esbh.js} +2 -2
- package/dist/shared/model-suggestion-retry.d.ts +2 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/prompt-async-transport.d.ts.map +1 -1
- package/dist/{storage-tags-yygfb9c8.js → storage-tags-s5bg1ahx.js} +1 -1
- package/dist/{transform-postprocess-phase-s84rdf32.js → transform-postprocess-phase-k5t63qm5.js} +21 -20
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +88 -0
- package/dist/v2/{context-x60fa16g.js → context-k4jrq71s.js} +611 -210
- package/dist/v2/{derive-budgets-z25jw3py.js → derive-budgets-2zh4gm2c.js} +2 -2
- package/dist/v2/{embedding-backfill-mbjyza2a.js → embedding-backfill-jmaf8zrr.js} +6 -5
- package/dist/v2/embedding-worker.js +1 -1
- package/dist/v2/hidden-completion.d.ts +3 -2
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/transform-features.d.ts +2 -2
- package/dist/v2/hooks/transform-features.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-pgv1ndpb.js → message-index-bounded-rxxznd34.js} +4 -4
- package/dist/v2/{message-index-5nayhm1r.js → message-index-f947qtbz.js} +7 -7
- package/dist/v2/migration-worker.js +2 -2
- package/dist/v2/{project-embedding-registry-jbmjc0p4.js → project-embedding-registry-0msp56p8.js} +5 -4
- package/dist/v2/raw-ordinal-warmup-worker.js +3 -3
- package/dist/v2/{read-session-chunk-hr3w5bjk.js → read-session-chunk-rq9nx1nn.js} +2 -2
- package/dist/v2/{recomp-orchestrator-8w3449eb.js → recomp-orchestrator-1j1nqrrr.js} +21 -20
- package/dist/v2/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/v2/{search-mhmxgq0e.js → search-n8wqxb1j.js} +16 -15
- package/dist/v2/{send-session-notification-jevgj9fe.js → send-session-notification-8ghn9tnv.js} +2 -2
- package/dist/v2/{server-f7jfmrrz.js → server-34kwfsr4.js} +1 -1
- package/dist/v2/server-4gn3z5an.js +229 -0
- package/dist/v2/{server-4c10404h.js → server-6cdy4rc0.js} +2 -2
- package/dist/v2/{server-25tg45b4.js → server-cfbr1s2x.js} +7 -7
- package/dist/v2/{server-nmrm2rjy.js → server-e298hswg.js} +8 -8
- package/dist/v2/{server-9ewkzqgd.js → server-ef89gdsx.js} +2 -2
- package/dist/v2/{server-m97brnat.js → server-ehyava47.js} +2 -2
- package/dist/v2/{server-5gvkzzrf.js → server-fnqxt9j6.js} +95 -71
- package/dist/v2/{server-sz8jj92q.js → server-hek6z3w6.js} +194 -241
- package/dist/v2/{server-50mkkhy1.js → server-kmbarfmn.js} +9 -9
- package/dist/v2/{server-vknbt0gq.js → server-qhfvvfxj.js} +60 -3
- package/dist/v2/{server-37ngj8qw.js → server-zc3e54vy.js} +1 -1
- package/dist/v2/server.js +9 -8
- package/dist/v2/{storage-tags-a2gq6dw7.js → storage-tags-hcc2adpf.js} +1 -1
- package/dist/v2/store-reader.d.ts +1 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-r82y780v.js → wrapup-orchestrator-hkv8apcc.js} +16 -15
- package/dist/{wrapup-orchestrator-vmt6z3q5.js → wrapup-orchestrator-kxqj4rwh.js} +22 -21
- package/package.json +6 -5
- package/src/shared/model-suggestion-retry.test.ts +34 -0
- package/src/shared/model-suggestion-retry.ts +23 -3
- package/src/shared/prompt-async-transport.test.ts +1 -1
- package/src/shared/prompt-async-transport.ts +16 -3
- package/dist/{index-e6xnpach.js → index-b7p25tm0.js} +0 -0
- package/dist/{index-2pgxcncf.js → index-dgs16axy.js} +0 -0
- package/dist/{index-9vqb5p1s.js → index-e20m7284.js} +0 -0
- package/dist/{index-fwefky9w.js → index-mht7bq0z.js} +0 -0
- package/dist/{index-8ketfacn.js → index-v10f1rjv.js} +3 -3
- package/dist/{index-tdn0zkw4.js → index-wk0n1cgt.js} +0 -0
- package/dist/v2/{index-e6xnpach.js → index-b7p25tm0.js} +0 -0
- package/dist/v2/{server-bxpwy6fy.js → server-atbc19ab.js} +0 -0
- package/dist/v2/{server-2x42esxd.js → server-g10mdym6.js} +0 -0
- package/dist/v2/{server-fa75w6gp.js → server-k2bzedxk.js} +0 -0
- package/dist/v2/{server-kn9n2qgd.js → server-tbe1femw.js} +3 -3
- /package/dist/v2/{server-83ygfha2.js → server-vbe4se57.js} +0 -0
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
getRawSessionTagKeysThrough2,
|
|
93
93
|
getLegacyProtectedTailStartOrdinal2,
|
|
94
94
|
readSessionChunk2
|
|
95
|
-
} from "./index-
|
|
95
|
+
} from "./index-944w16m0.js";
|
|
96
96
|
import {
|
|
97
97
|
getHarness2,
|
|
98
98
|
harnessOwnsOpenCodeStore2
|
|
@@ -129,7 +129,7 @@ import {
|
|
|
129
129
|
deriveTriggerBudget2,
|
|
130
130
|
resolveHistorianProducerLimits2,
|
|
131
131
|
producerSourceLocalBudget2
|
|
132
|
-
} from "./index-
|
|
132
|
+
} from "./index-v10f1rjv.js";
|
|
133
133
|
import {
|
|
134
134
|
withContentLanguageDirective,
|
|
135
135
|
buildPrimaryLanguageDirective,
|
|
@@ -159,7 +159,7 @@ import {
|
|
|
159
159
|
LATEST_SUPPORTED_VERSION,
|
|
160
160
|
getPersistedSchemaVersion,
|
|
161
161
|
openDatabase
|
|
162
|
-
} from "./index-
|
|
162
|
+
} from "./index-yxycg7fs.js";
|
|
163
163
|
import {
|
|
164
164
|
inRootAsyncContext2,
|
|
165
165
|
Database2,
|
|
@@ -185,7 +185,7 @@ import {
|
|
|
185
185
|
resolveStoredPathWorkspaceIdentity,
|
|
186
186
|
sourceNameForMemory,
|
|
187
187
|
computeWorkspaceEpochFingerprint
|
|
188
|
-
} from "./index-
|
|
188
|
+
} from "./index-wk0n1cgt.js";
|
|
189
189
|
import {
|
|
190
190
|
getTableColumnNames
|
|
191
191
|
} from "./index-bp5083x2.js";
|
|
@@ -203,6 +203,15 @@ import {
|
|
|
203
203
|
import {
|
|
204
204
|
getMeasuredToolDefinitionTokens
|
|
205
205
|
} from "./index-n6m03s3n.js";
|
|
206
|
+
import {
|
|
207
|
+
invalidateAutoEmbedSession,
|
|
208
|
+
drainBackgroundBatches,
|
|
209
|
+
contentSha2562,
|
|
210
|
+
enqueueShadowEmbeddingItems2,
|
|
211
|
+
getProjectChunkEmbeddingModelId2,
|
|
212
|
+
getProjectEmbeddingMaxInputTokens2,
|
|
213
|
+
embedItemsForProject2
|
|
214
|
+
} from "./index-y1qysm3q.js";
|
|
206
215
|
import {
|
|
207
216
|
buildCanonicalChunkTextFromFts,
|
|
208
217
|
buildCompartmentSummaryFallbackText,
|
|
@@ -212,7 +221,7 @@ import {
|
|
|
212
221
|
replaceCompartmentChunkEmbeddings,
|
|
213
222
|
deleteChunkEmbedBackoffForSession,
|
|
214
223
|
chunkWindowSourceKey
|
|
215
|
-
} from "./index-
|
|
224
|
+
} from "./index-3kx0kg0f.js";
|
|
216
225
|
import {
|
|
217
226
|
BoundedSessionMap,
|
|
218
227
|
clearCompressionDepth,
|
|
@@ -227,7 +236,7 @@ import {
|
|
|
227
236
|
toMessageIndexSource2,
|
|
228
237
|
clearIndexedMessagesInTransaction2,
|
|
229
238
|
indexSourcesAfterOrdinal2
|
|
230
|
-
} from "./index-
|
|
239
|
+
} from "./index-thvnpfsv.js";
|
|
231
240
|
import {
|
|
232
241
|
stripWellFormedLeadingTagPrefix,
|
|
233
242
|
stripTagPrefix,
|
|
@@ -240,7 +249,7 @@ import {
|
|
|
240
249
|
foldShrunkPartTags2,
|
|
241
250
|
getTagNumberByMessageId2,
|
|
242
251
|
getActiveTagsBySession2
|
|
243
|
-
} from "./index-
|
|
252
|
+
} from "./index-mht7bq0z.js";
|
|
244
253
|
import {
|
|
245
254
|
isStrictGapHealingMessage2,
|
|
246
255
|
noteRawSessionSummaryRowWritten2,
|
|
@@ -252,14 +261,6 @@ import {
|
|
|
252
261
|
withReadOnlySessionDb,
|
|
253
262
|
getMessageTimesFromOpenCodeDb
|
|
254
263
|
} from "./index-1d289pq2.js";
|
|
255
|
-
import {
|
|
256
|
-
drainBackgroundBatches,
|
|
257
|
-
contentSha2562,
|
|
258
|
-
enqueueShadowEmbeddingItems2,
|
|
259
|
-
getProjectChunkEmbeddingModelId2,
|
|
260
|
-
getProjectEmbeddingMaxInputTokens2,
|
|
261
|
-
embedItemsForProject2
|
|
262
|
-
} from "./index-7zd5asz9.js";
|
|
263
264
|
import {
|
|
264
265
|
renderUserFacingFailure,
|
|
265
266
|
userFacingFailureCode,
|
|
@@ -268,7 +269,7 @@ import {
|
|
|
268
269
|
insertPrimerCandidates,
|
|
269
270
|
promoteSessionFactsDurable,
|
|
270
271
|
embedPromotedFacts
|
|
271
|
-
} from "./index-
|
|
272
|
+
} from "./index-bxdg2nbt.js";
|
|
272
273
|
import {
|
|
273
274
|
pushNotification2
|
|
274
275
|
} from "./index-x8a7jmkh.js";
|
|
@@ -288,11 +289,14 @@ import {
|
|
|
288
289
|
} from "./index-f71thw8j.js";
|
|
289
290
|
import {
|
|
290
291
|
sendStatusNotification2
|
|
291
|
-
} from "./index-
|
|
292
|
+
} from "./index-dgs16axy.js";
|
|
292
293
|
import {
|
|
293
294
|
isCompactionEnabled,
|
|
294
295
|
migrateLegacyAgentEnabledInMemory
|
|
295
296
|
} from "./index-ksdyrrav.js";
|
|
297
|
+
import {
|
|
298
|
+
piModelRefToCanonical
|
|
299
|
+
} from "./index-avwt563y.js";
|
|
296
300
|
import {
|
|
297
301
|
sameProjectDirectory
|
|
298
302
|
} from "./index-knvkbfvh.js";
|
|
@@ -300,13 +304,6 @@ import {
|
|
|
300
304
|
getErrorMessage,
|
|
301
305
|
describeError
|
|
302
306
|
} from "./index-y8v6yerm.js";
|
|
303
|
-
import {
|
|
304
|
-
ensureStorageDirectorySync,
|
|
305
|
-
writeStorageFileAtomicSync
|
|
306
|
-
} from "./index-fvnzcnww.js";
|
|
307
|
-
import {
|
|
308
|
-
piModelRefToCanonical
|
|
309
|
-
} from "./index-avwt563y.js";
|
|
310
307
|
import {
|
|
311
308
|
closeQuietly
|
|
312
309
|
} from "./index-8ajstryz.js";
|
|
@@ -314,6 +311,10 @@ import {
|
|
|
314
311
|
logSlowWriteTransaction,
|
|
315
312
|
WriteTransactionSteps
|
|
316
313
|
} from "./index-k29z4aqh.js";
|
|
314
|
+
import {
|
|
315
|
+
ensureStorageDirectorySync,
|
|
316
|
+
writeStorageFileAtomicSync
|
|
317
|
+
} from "./index-fvnzcnww.js";
|
|
317
318
|
|
|
318
319
|
// src/agents/permissions.ts
|
|
319
320
|
function buildAllowOnlyPermission(allowedTools, agentLabel) {
|
|
@@ -373,6 +374,15 @@ function denyTaskRoutingToCallerAgents(agentConfigs, internalAgentIds) {
|
|
|
373
374
|
}
|
|
374
375
|
return result;
|
|
375
376
|
}
|
|
377
|
+
var DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS = [
|
|
378
|
+
"read",
|
|
379
|
+
"grep",
|
|
380
|
+
"glob",
|
|
381
|
+
"aft_outline",
|
|
382
|
+
"aft_zoom",
|
|
383
|
+
"aft_search",
|
|
384
|
+
"ctx_search"
|
|
385
|
+
];
|
|
376
386
|
|
|
377
387
|
// src/agents/hidden-agent-registrations.ts
|
|
378
388
|
function clampHiddenAgentStepLimit(value, cap) {
|
|
@@ -4357,6 +4367,14 @@ var DREAMER_AGENT = "dreamer";
|
|
|
4357
4367
|
var DREAMER_RETROSPECTIVE_AGENT = "dreamer-retrospective";
|
|
4358
4368
|
var DREAMER_PRIMER_INVESTIGATOR_AGENT = "dreamer-primer-investigator";
|
|
4359
4369
|
var DREAMER_MEMORY_MAPPER_AGENT = "dreamer-memory-mapper";
|
|
4370
|
+
var DREAMER_MEMORY_MAPPER_ALLOWED_TOOLS = [
|
|
4371
|
+
"read",
|
|
4372
|
+
"grep",
|
|
4373
|
+
"glob",
|
|
4374
|
+
"aft_outline",
|
|
4375
|
+
"aft_zoom",
|
|
4376
|
+
"aft_search"
|
|
4377
|
+
];
|
|
4360
4378
|
var DREAMER_CLASSIFIER_AGENT = "dreamer-classifier";
|
|
4361
4379
|
var DREAMER_DOCS_AGENT = "dreamer-docs";
|
|
4362
4380
|
var DREAMER_REVIEWER_AGENT = "dreamer-reviewer";
|
|
@@ -4413,40 +4431,6 @@ function probeChildSpawnFence(db) {
|
|
|
4413
4431
|
return { allowSpawn: true };
|
|
4414
4432
|
}
|
|
4415
4433
|
|
|
4416
|
-
// src/hooks/magic-context/embed-session-state.ts
|
|
4417
|
-
var embedPauseBySession = new Set;
|
|
4418
|
-
var embedRunStateBySession = new Map;
|
|
4419
|
-
var autoEmbedAttemptedBySession = new Set;
|
|
4420
|
-
var autoEmbedIdentityBySession = new Map;
|
|
4421
|
-
function invalidateAutoEmbedSession(sessionId) {
|
|
4422
|
-
autoEmbedAttemptedBySession.delete(sessionId);
|
|
4423
|
-
autoEmbedIdentityBySession.delete(sessionId);
|
|
4424
|
-
}
|
|
4425
|
-
function getEmbedDrainUiStatus(sessionId, progress) {
|
|
4426
|
-
if (embedPauseBySession.has(sessionId)) {
|
|
4427
|
-
return { status: "paused" };
|
|
4428
|
-
}
|
|
4429
|
-
const activeRun = embedRunStateBySession.get(sessionId);
|
|
4430
|
-
if (activeRun && !activeRun.signal.aborted || progress?.kind === "embed" && progress.phase === "recomp") {
|
|
4431
|
-
return { status: "running" };
|
|
4432
|
-
}
|
|
4433
|
-
if (progress?.kind === "embed" && (progress.phase === "failed" || progress.phase === "skipped") && progress.message) {
|
|
4434
|
-
if (/provider/i.test(progress.message)) {
|
|
4435
|
-
return { status: "stopped", detail: progress.message };
|
|
4436
|
-
}
|
|
4437
|
-
}
|
|
4438
|
-
return { status: "idle" };
|
|
4439
|
-
}
|
|
4440
|
-
function clearEmbedSessionState(sessionId) {
|
|
4441
|
-
embedPauseBySession.delete(sessionId);
|
|
4442
|
-
const ctrl = embedRunStateBySession.get(sessionId);
|
|
4443
|
-
if (ctrl) {
|
|
4444
|
-
ctrl.abort();
|
|
4445
|
-
embedRunStateBySession.delete(sessionId);
|
|
4446
|
-
}
|
|
4447
|
-
invalidateAutoEmbedSession(sessionId);
|
|
4448
|
-
}
|
|
4449
|
-
|
|
4450
4434
|
// src/features/magic-context/compartment-lease.ts
|
|
4451
4435
|
var COMPARTMENT_LEASE_TTL_MS = 5 * 60 * 1000;
|
|
4452
4436
|
var COMPARTMENT_LEASE_RENEWAL_MS = 60 * 1000;
|
|
@@ -5366,11 +5350,12 @@ class V2StoreReader {
|
|
|
5366
5350
|
const head = Math.floor((maxChars - truncationMarker.length) / 2);
|
|
5367
5351
|
const tail = maxChars - truncationMarker.length - head;
|
|
5368
5352
|
return this.prepare(`WITH users AS (
|
|
5369
|
-
SELECT seq, time_created, data FROM session_message
|
|
5370
|
-
WHERE session_id = ? AND type = 'user' AND time_created ${before ? "<=" : ">"}
|
|
5353
|
+
SELECT session_id, seq, time_created, data FROM session_message
|
|
5354
|
+
WHERE session_id = ? AND type = 'user' AND time_created ${before ? "<=" : ">"}
|
|
5355
|
+
?
|
|
5371
5356
|
ORDER BY time_created ${direction}, seq ${direction} LIMIT ?
|
|
5372
5357
|
), texts AS (
|
|
5373
|
-
SELECT seq, time_created, CASE
|
|
5358
|
+
SELECT session_id, seq, time_created, CASE
|
|
5374
5359
|
WHEN json_extract(data, '$.synthetic') = 1 OR json_extract(data, '$.ignored') = 1 THEN ''
|
|
5375
5360
|
WHEN json_type(data, '$.text') = 'text' THEN json_extract(data, '$.text')
|
|
5376
5361
|
ELSE COALESCE((SELECT group_concat(json_extract(value, '$.text'), char(10))
|
|
@@ -5380,7 +5365,19 @@ class V2StoreReader {
|
|
|
5380
5365
|
AND COALESCE(json_extract(value, '$.ignored'), 0) <> 1), '') END AS text
|
|
5381
5366
|
FROM users WHERE json_valid(data)
|
|
5382
5367
|
) SELECT seq, time_created, CASE WHEN length(text) > ?
|
|
5383
|
-
THEN substr(text, 1, ?) || ? || substr(text, -?) ELSE text END AS text
|
|
5368
|
+
THEN substr(text, 1, ?) || ? || substr(text, -?) ELSE text END AS text,
|
|
5369
|
+
EXISTS (
|
|
5370
|
+
SELECT 1 FROM session_message assistant_reply
|
|
5371
|
+
WHERE assistant_reply.session_id = texts.session_id
|
|
5372
|
+
AND assistant_reply.type = 'assistant'
|
|
5373
|
+
AND assistant_reply.seq < texts.seq
|
|
5374
|
+
AND EXISTS (
|
|
5375
|
+
SELECT 1 FROM session_message prior_user
|
|
5376
|
+
WHERE prior_user.session_id = texts.session_id
|
|
5377
|
+
AND prior_user.type = 'user'
|
|
5378
|
+
AND prior_user.seq < assistant_reply.seq
|
|
5379
|
+
)
|
|
5380
|
+
) AS follows_assistant_reply
|
|
5384
5381
|
FROM texts ORDER BY time_created ${direction}, seq ${direction}`).all(sessionID, boundaryMs, limit, maxChars, head, truncationMarker, tail);
|
|
5385
5382
|
}
|
|
5386
5383
|
storedRowsAfter(sessionID, after) {
|
|
@@ -8943,13 +8940,12 @@ import { createHash as createHash8 } from "node:crypto";
|
|
|
8943
8940
|
var HIDDEN_HISTORIAN_AGENT = "historian";
|
|
8944
8941
|
var HIDDEN_DREAMER_AGENT = "dreamer-classifier";
|
|
8945
8942
|
var HIDDEN_CURATE_AGENT = DREAMER_AGENT;
|
|
8946
|
-
var READ_TOOLS = ["read", "grep", "glob"];
|
|
8947
8943
|
var AGENT_TOOLS = {
|
|
8948
8944
|
[HIDDEN_HISTORIAN_AGENT]: [],
|
|
8949
8945
|
[HIDDEN_DREAMER_AGENT]: [],
|
|
8950
8946
|
[HIDDEN_CURATE_AGENT]: ["ctx_memory"],
|
|
8951
|
-
[DREAMER_MEMORY_MAPPER_AGENT]:
|
|
8952
|
-
[DREAMER_PRIMER_INVESTIGATOR_AGENT]:
|
|
8947
|
+
[DREAMER_MEMORY_MAPPER_AGENT]: DREAMER_MEMORY_MAPPER_ALLOWED_TOOLS,
|
|
8948
|
+
[DREAMER_PRIMER_INVESTIGATOR_AGENT]: DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS,
|
|
8953
8949
|
[DREAMER_RETROSPECTIVE_AGENT]: ["ctx_search"]
|
|
8954
8950
|
};
|
|
8955
8951
|
var AGENT_STEPS = {
|
|
@@ -9449,6 +9445,21 @@ function externalAbortMessage(signal) {
|
|
|
9449
9445
|
const reason = signal.reason;
|
|
9450
9446
|
return `prompt aborted by external signal${reason instanceof Error && /^lease_(?:lost|expired):/.test(reason.message) ? `: ${reason.message}` : ""}`;
|
|
9451
9447
|
}
|
|
9448
|
+
function raceWithSignal(work, signal) {
|
|
9449
|
+
work = Promise.resolve(work);
|
|
9450
|
+
if (!signal)
|
|
9451
|
+
return work;
|
|
9452
|
+
return new Promise((resolve, reject) => {
|
|
9453
|
+
const abort = () => reject(new Error(externalAbortMessage(signal)));
|
|
9454
|
+
if (signal.aborted) {
|
|
9455
|
+
work.catch(() => {});
|
|
9456
|
+
abort();
|
|
9457
|
+
return;
|
|
9458
|
+
}
|
|
9459
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
9460
|
+
work.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
9461
|
+
});
|
|
9462
|
+
}
|
|
9452
9463
|
async function promptWithTimeout(client, args, timeoutMs, signal, transport) {
|
|
9453
9464
|
if (signal?.aborted) {
|
|
9454
9465
|
throw new Error(externalAbortMessage(signal));
|
|
@@ -9460,11 +9471,11 @@ async function promptWithTimeout(client, args, timeoutMs, signal, transport) {
|
|
|
9460
9471
|
try {
|
|
9461
9472
|
const request = { ...args, signal: controller.signal };
|
|
9462
9473
|
if (transport)
|
|
9463
|
-
await transport(request);
|
|
9474
|
+
await raceWithSignal(transport(request), controller.signal);
|
|
9464
9475
|
else {
|
|
9465
9476
|
if (!client)
|
|
9466
9477
|
throw new Error("Hidden completion transport is unavailable");
|
|
9467
|
-
await client.session.prompt(request);
|
|
9478
|
+
await raceWithSignal(client.session.prompt(request), controller.signal);
|
|
9468
9479
|
}
|
|
9469
9480
|
} catch (error) {
|
|
9470
9481
|
if (signal?.aborted) {
|
|
@@ -9666,7 +9677,7 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
9666
9677
|
}
|
|
9667
9678
|
let output;
|
|
9668
9679
|
try {
|
|
9669
|
-
output = await options.fetchOutput(args, attempt);
|
|
9680
|
+
output = await raceWithSignal(options.fetchOutput(args, attempt), options.signal);
|
|
9670
9681
|
} catch (error) {
|
|
9671
9682
|
throw {
|
|
9672
9683
|
error,
|
|
@@ -9970,10 +9981,20 @@ function createPromptAsyncTransport(client, childSessionId, options = {}) {
|
|
|
9970
9981
|
if (!readChildTokenBudget || !session?.prompt)
|
|
9971
9982
|
return;
|
|
9972
9983
|
return Object.assign(async (request) => {
|
|
9973
|
-
|
|
9974
|
-
const
|
|
9975
|
-
if (
|
|
9976
|
-
|
|
9984
|
+
const previous = readChildTokenBudget(childSessionId);
|
|
9985
|
+
const remaining = options.tokenBudget === undefined ? undefined : options.tokenBudget - (previous?.spent ?? 0);
|
|
9986
|
+
if (remaining !== undefined && remaining <= 0 || previous?.finalizeFired)
|
|
9987
|
+
throw new DreamTokenBudgetExceeded(childSessionId, previous?.spent ?? 0);
|
|
9988
|
+
try {
|
|
9989
|
+
await session.prompt?.({
|
|
9990
|
+
...request,
|
|
9991
|
+
...remaining === undefined ? {} : { tokenBudget: remaining }
|
|
9992
|
+
});
|
|
9993
|
+
} finally {
|
|
9994
|
+
const state = readChildTokenBudget(childSessionId);
|
|
9995
|
+
if (state)
|
|
9996
|
+
options.onBudgetUpdate?.({ ...state, sessionId: childSessionId });
|
|
9997
|
+
}
|
|
9977
9998
|
}, { childSessionId });
|
|
9978
9999
|
}
|
|
9979
10000
|
const budgetGuard = options.tokenBudget ? createDreamTokenBudget(options.tokenBudget) : undefined;
|
|
@@ -21658,6 +21679,7 @@ function registerActiveCompartmentRun(sessionId, promise, kind = "other") {
|
|
|
21658
21679
|
kind
|
|
21659
21680
|
};
|
|
21660
21681
|
const wrapped = promise.finally(() => {
|
|
21682
|
+
activeRun.settled = true;
|
|
21661
21683
|
if (activeRuns.get(sessionId)?.promise === wrapped) {
|
|
21662
21684
|
activeRuns.delete(sessionId);
|
|
21663
21685
|
}
|
|
@@ -21820,4 +21842,4 @@ async function executeContextRecomp(deps, options = {}) {
|
|
|
21820
21842
|
return (await executeContextRecompWithResult(deps, options)).message;
|
|
21821
21843
|
}
|
|
21822
21844
|
|
|
21823
|
-
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT,
|
|
21845
|
+
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, registerLkgPersistence, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "./index-wafzvyhg.js";
|
|
24
24
|
import {
|
|
25
25
|
cleanUserText2
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-944w16m0.js";
|
|
27
27
|
import {
|
|
28
28
|
recordMessageFtsRowid,
|
|
29
29
|
recordIndexedMessageTime,
|
|
@@ -36,7 +36,13 @@ import {
|
|
|
36
36
|
} from "./index-nj7yykkx.js";
|
|
37
37
|
import {
|
|
38
38
|
deleteChunkEmbedBackoffForSession
|
|
39
|
-
} from "./index-
|
|
39
|
+
} from "./index-3kx0kg0f.js";
|
|
40
|
+
import {
|
|
41
|
+
closeQuietly
|
|
42
|
+
} from "./index-8ajstryz.js";
|
|
43
|
+
import {
|
|
44
|
+
logSlowWriteTransaction
|
|
45
|
+
} from "./index-k29z4aqh.js";
|
|
40
46
|
import {
|
|
41
47
|
ensurePrivateStorageDirectorySync,
|
|
42
48
|
writeStorageFileSync,
|
|
@@ -44,12 +50,6 @@ import {
|
|
|
44
50
|
syncStorageDirectorySync,
|
|
45
51
|
writeStorageFileDurableAtomicSync
|
|
46
52
|
} from "./index-fvnzcnww.js";
|
|
47
|
-
import {
|
|
48
|
-
closeQuietly
|
|
49
|
-
} from "./index-8ajstryz.js";
|
|
50
|
-
import {
|
|
51
|
-
logSlowWriteTransaction
|
|
52
|
-
} from "./index-k29z4aqh.js";
|
|
53
53
|
|
|
54
54
|
// src/shared/bounded-session-map.ts
|
|
55
55
|
class BoundedSessionMap {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
getActiveCompartmentRun,
|
|
16
16
|
markActiveCompartmentRunPublished,
|
|
17
17
|
registerActiveCompartmentRun
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-t4q9zbbf.js";
|
|
19
19
|
import {
|
|
20
20
|
inRootAsyncContext2
|
|
21
21
|
} from "./index-wafzvyhg.js";
|
|
@@ -27,17 +27,17 @@ import {
|
|
|
27
27
|
getHistorianFailureState,
|
|
28
28
|
clearEmergencyRecovery,
|
|
29
29
|
prepareRawSessionOrdinals2
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-944w16m0.js";
|
|
31
31
|
import {
|
|
32
32
|
pushNotification2
|
|
33
33
|
} from "./index-x8a7jmkh.js";
|
|
34
34
|
import {
|
|
35
35
|
sendStatusNotification2
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-dgs16axy.js";
|
|
37
37
|
import {
|
|
38
38
|
setRecompStarting2,
|
|
39
39
|
setRecompTerminal2
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-kf4epshg.js";
|
|
41
41
|
|
|
42
42
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
43
43
|
import * as crypto from "node:crypto";
|