@cortexkit/opencode-magic-context 0.49.52 → 0.49.54
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 +3 -4
- package/dist/{context-bkkd7br4.js → context-vx5gw5h2.js} +117 -80
- package/dist/{embedding-backfill-3wdjzrvs.js → embedding-backfill-2dvf3rcn.js} +4 -4
- package/dist/embedding-worker.js +2 -2
- package/dist/features/magic-context/compartment-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/message-fts-session-filter.d.ts +1 -1
- package/dist/features/magic-context/message-fts-session-filter.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +8 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-host-instruction-retention.d.ts +10 -3
- package/dist/features/magic-context/storage-host-instruction-retention.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +19 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +1 -1
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/hooks/magic-context/active-anthropic-turn.d.ts +6 -0
- package/dist/hooks/magic-context/active-anthropic-turn.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +2 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts +75 -2
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +14 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +12 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/host-served-rows.d.ts +12 -2
- package/dist/hooks/magic-context/host-served-rows.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +10 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts +43 -0
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts.map +1 -1
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts +102 -26
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts +18 -2
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -1
- package/dist/hooks/magic-context/pending-marker-rearm.d.ts +20 -0
- package/dist/hooks/magic-context/pending-marker-rearm.d.ts.map +1 -0
- package/dist/hooks/magic-context/priced-pass-sizing.d.ts +7 -0
- package/dist/hooks/magic-context/priced-pass-sizing.d.ts.map +1 -1
- package/dist/hooks/magic-context/routine-cleanup-decision.d.ts +11 -1
- package/dist/hooks/magic-context/routine-cleanup-decision.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/served-check.d.ts +127 -0
- package/dist/hooks/magic-context/served-check.d.ts.map +1 -0
- package/dist/hooks/magic-context/signed-thinking-hold.d.ts +32 -4
- package/dist/hooks/magic-context/signed-thinking-hold.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +35 -1
- 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-29ff546v.js +2747 -0
- package/dist/{index-8d7gkgjs.js → index-2vsd5064.js} +3 -3
- package/dist/{index-kaqs6h31.js → index-52x68mj4.js} +1 -1
- package/dist/{index-k2efzh9r.js → index-567xsm72.js} +7 -5
- package/dist/{index-q9m97m5g.js → index-5gqszjq9.js} +4 -4
- package/dist/{index-a4zmmhxs.js → index-5ptp2de1.js} +6 -8
- package/dist/{index-jjy5a5w0.js → index-6nqz8hsz.js} +16 -5
- package/dist/{index-a6aqpfp6.js → index-9mggb1nv.js} +403 -1
- package/dist/{index-kanfby7e.js → index-9n6mdfqy.js} +452 -442
- package/dist/{index-fxgaaptn.js → index-a3n2dczz.js} +8 -7
- package/dist/{index-g3j49m95.js → index-b6rdv8re.js} +1 -1
- package/dist/{index-qbda6a8k.js → index-by14cr73.js} +30 -19
- package/dist/{index-25tm250q.js → index-dhdv88e5.js} +1 -1
- package/dist/{index-4xpff2m1.js → index-eyr425dx.js} +820 -179
- package/dist/{index-x4h461yf.js → index-h62j8z2r.js} +1 -1
- package/dist/{index-xqhejxmd.js → index-pdh4tdcq.js} +1 -1
- package/dist/{index-9gs34125.js → index-sk6p6esd.js} +3777 -2544
- package/dist/{index-pb8ysnq2.js → index-sv5tn72j.js} +1 -1
- package/dist/{index-bamnjp2t.js → index-sx1sppd6.js} +11 -7
- package/dist/{index-x7jcqpy6.js → index-tx8nfw85.js} +539 -29
- package/dist/{index-42n4fhxy.js → index-xj5bap1r.js} +61 -54
- package/dist/{index-rbs27k1d.js → index-xstbytjn.js} +1 -1
- package/dist/{index-0jc25yjf.js → index-xvtjwhm6.js} +3 -3
- package/dist/{index-qtpkkzan.js → index-yamsmkmh.js} +4 -4
- package/dist/index.js +87 -68
- package/dist/{message-index-bounded-71b75npz.js → message-index-bounded-xav3h8qe.js} +5 -6
- package/dist/migration-worker.js +3 -4
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts +6 -0
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/{project-embedding-registry-5dwh5zfn.js → project-embedding-registry-f2azrq24.js} +5 -3
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-bfv831yx.js → read-session-chunk-70aam2c1.js} +4 -5
- package/dist/{recomp-orchestrator-8gj1b7pz.js → recomp-orchestrator-wbm4kpq9.js} +15 -16
- package/dist/{render-b3zcz9x4.js → render-73vrt30h.js} +10 -11
- package/dist/{search-archive-dp9afcv1.js → search-archive-ew4c3bsw.js} +7 -8
- package/dist/{search-y3w590tn.js → search-jfwb4ms3.js} +14 -15
- package/dist/shared/test-open-files.d.ts +17 -0
- package/dist/shared/test-open-files.d.ts.map +1 -0
- package/dist/{storage-tags-kdb4qsyq.js → storage-tags-arnkn5t1.js} +4 -2
- package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-8awze16a.js → transform-postprocess-phase-mt4dcbhd.js} +16 -17
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +3 -4
- package/dist/v2/{context-99v7x7fm.js → context-13er940g.js} +1147 -467
- package/dist/v2/{embedding-backfill-x1zpc04f.js → embedding-backfill-48qbnh7p.js} +4 -4
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/fold/instruction-supersession.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-2pev910h.js → message-index-bounded-sw8hyqw1.js} +5 -6
- package/dist/v2/migration-worker.js +3 -4
- package/dist/v2/{project-embedding-registry-v2fxrs8b.js → project-embedding-registry-kwahtjgg.js} +5 -3
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-a454a4d2.js → read-session-chunk-nqkn0yb4.js} +4 -5
- package/dist/v2/{recomp-orchestrator-03fskpsa.js → recomp-orchestrator-cdkfynz4.js} +15 -16
- package/dist/v2/{render-cryx4xsj.js → render-a7j6fqbd.js} +10 -11
- package/dist/v2/{search-2qj4w7rw.js → search-8dc9ex0a.js} +13 -14
- package/dist/v2/{search-archive-xw2rsq81.js → search-archive-3a36887a.js} +7 -8
- package/dist/v2/{server-kreheyw5.js → server-0ayyh3mx.js} +5 -7
- package/dist/v2/{server-t8n27rbt.js → server-4x0xq8a1.js} +1 -1
- package/dist/v2/{server-kaqs6h31.js → server-52x68mj4.js} +1 -1
- package/dist/v2/{server-cpstyzvy.js → server-578pc4tf.js} +3 -3
- package/dist/v2/{server-sb55ddgn.js → server-5p0bjk3y.js} +1 -1
- package/dist/v2/{server-58h6rrnx.js → server-6k0rnwbd.js} +1 -1
- package/dist/v2/{server-y5cma2j1.js → server-79tbtk5w.js} +8 -7
- package/dist/v2/{server-b3h8vqa6.js → server-7rmf6a57.js} +538 -28
- package/dist/v2/{server-xjzx27w2.js → server-7waad75d.js} +29 -18
- package/dist/v2/{server-wq9y9a03.js → server-96g41nad.js} +61 -54
- package/dist/v2/{server-txdsx71h.js → server-avfc9ezb.js} +4 -4
- package/dist/v2/{server-ww7xbxxf.js → server-b0357as4.js} +357 -1
- package/dist/v2/{server-qsvm6w79.js → server-beydmd68.js} +3763 -2484
- package/dist/v2/server-gge95a03.js +2687 -0
- package/dist/v2/{server-kfw4m268.js → server-jwydbwcx.js} +1 -1
- package/dist/v2/{server-brsx45r6.js → server-kwtnrhv3.js} +1 -1
- package/dist/v2/{server-4h4acntc.js → server-rpmkz5ta.js} +11 -7
- package/dist/v2/{server-0ms13pc8.js → server-rz6g5xne.js} +16 -5
- package/dist/v2/{server-dkfs58nq.js → server-v817sf79.js} +1 -1
- package/dist/v2/{server-vjadwb3j.js → server-ycvqg2s3.js} +3 -3
- package/dist/v2/server.js +4 -4
- package/dist/v2/{storage-tags-rzv7y0n3.js → storage-tags-19da4c0m.js} +4 -2
- package/dist/v2/{v2-archive-reader-3575hw8s.js → v2-archive-reader-jm3d7ccj.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-shzv6t4v.js → wrapup-orchestrator-xnqq81c4.js} +18 -18
- package/dist/{v2-archive-reader-75fdm0te.js → v2-archive-reader-9bbfh131.js} +1 -1
- package/dist/{wrapup-orchestrator-e0z7nvnx.js → wrapup-orchestrator-svhee0fn.js} +16 -17
- package/package.json +1 -1
- package/src/shared/escalation-bands.test.ts +16 -1
- package/src/shared/sqlite-placeholders.test.ts +103 -0
- package/src/shared/storage-file-mutex-review.test.ts +5 -7
- package/src/shared/test-open-files.test.ts +194 -0
- package/src/shared/test-open-files.ts +71 -0
- package/dist/index-bkg4hdyh.js +0 -3865
- package/dist/index-d9vfe7xq.js +0 -16
- package/dist/index-hsv31e69.js +0 -405
- package/dist/v2/server-d9vfe7xq.js +0 -16
- package/dist/v2/server-kgq2e2hh.js +0 -361
- package/dist/v2/server-rcchadw0.js +0 -3865
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-rz6g5xne.js";
|
|
4
4
|
import {
|
|
5
5
|
embedPauseBySession,
|
|
6
6
|
activeEmbeddingSessions,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
logLocalEmbeddingPoolingUnavailableOnce,
|
|
84
84
|
getEmbeddingProviderIdentity,
|
|
85
85
|
LocalEmbeddingProvider
|
|
86
|
-
} from "./server-
|
|
86
|
+
} from "./server-kwtnrhv3.js";
|
|
87
87
|
import {
|
|
88
88
|
isKnownAutocommit
|
|
89
89
|
} from "./server-8ajstryz.js";
|
|
@@ -2573,17 +2573,21 @@ async function embedItemsForProject2(projectIdentity, items, signal, db, session
|
|
|
2573
2573
|
}
|
|
2574
2574
|
return { vectors, modelId, generation };
|
|
2575
2575
|
}
|
|
2576
|
-
async function
|
|
2576
|
+
async function embedItemsWindowBounded2(projectIdentity, items, signal, db, sessionId = projectIdentity, options = {}) {
|
|
2577
2577
|
if (items.length <= MAX_WINDOWS_PER_EMBED_CALL) {
|
|
2578
|
-
return embedItemsForProject2(projectIdentity, items, signal, db,
|
|
2578
|
+
return embedItemsForProject2(projectIdentity, items, signal, db, sessionId);
|
|
2579
2579
|
}
|
|
2580
2580
|
const vectors = new Map;
|
|
2581
2581
|
let modelId = null;
|
|
2582
2582
|
let generation = null;
|
|
2583
2583
|
for (let start = 0;start < items.length; start += MAX_WINDOWS_PER_EMBED_CALL) {
|
|
2584
|
-
const
|
|
2584
|
+
const slice = items.slice(start, start + MAX_WINDOWS_PER_EMBED_CALL);
|
|
2585
|
+
const result = await embedItemsForProject2(projectIdentity, slice, signal, db, sessionId);
|
|
2585
2586
|
if (!result)
|
|
2586
2587
|
return null;
|
|
2588
|
+
if (options.stopOnIncompleteSlice && slice.some((item) => !result.vectors.has(item.id))) {
|
|
2589
|
+
return null;
|
|
2590
|
+
}
|
|
2587
2591
|
if (modelId === null) {
|
|
2588
2592
|
modelId = result.modelId;
|
|
2589
2593
|
generation = result.generation;
|
|
@@ -2796,7 +2800,7 @@ async function embedCandidateChunkBatch(db, projectIdentity, modelId, candidates
|
|
|
2796
2800
|
let result = null;
|
|
2797
2801
|
const attemptStart = Date.now();
|
|
2798
2802
|
try {
|
|
2799
|
-
result = await
|
|
2803
|
+
result = await embedItemsWindowBounded2(projectIdentity, items, signal, db);
|
|
2800
2804
|
} catch (error) {
|
|
2801
2805
|
log2("[magic-context] failed to proactively embed compartment chunks:", error);
|
|
2802
2806
|
}
|
|
@@ -3160,4 +3164,4 @@ function _resetProjectEmbeddingRegistryForTests2() {
|
|
|
3160
3164
|
setBootQuietPeriodForTests(null);
|
|
3161
3165
|
}
|
|
3162
3166
|
|
|
3163
|
-
export { saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, withQueryEmbeddingDeadline, OpenAICompatibleEmbeddingProvider, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, retainProjectEmbedding2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, getAutoEmbeddingSessionCoverage2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
|
|
3167
|
+
export { saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, withQueryEmbeddingDeadline, OpenAICompatibleEmbeddingProvider, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, retainProjectEmbedding2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedItemsWindowBounded2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, getAutoEmbeddingSessionCoverage2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_PROTECTED_TOOLS,
|
|
3
|
-
mergeProtectedTools
|
|
4
|
-
} from "./server-d9vfe7xq.js";
|
|
5
1
|
import {
|
|
6
2
|
modelRefLookupOrder
|
|
7
3
|
} from "./server-avwt563y.js";
|
|
@@ -6554,6 +6550,21 @@ function resolvePromptSurface(config, modelKey) {
|
|
|
6554
6550
|
return { preset: fallback, source: "default" };
|
|
6555
6551
|
}
|
|
6556
6552
|
|
|
6553
|
+
// src/shared/protected-tools-policy.ts
|
|
6554
|
+
var DEFAULT_PROTECTED_TOOLS = {
|
|
6555
|
+
todowrite: 1,
|
|
6556
|
+
ctx_reduce: 3
|
|
6557
|
+
};
|
|
6558
|
+
function normalizeProtectedToolName(name) {
|
|
6559
|
+
return (name ?? "").toLowerCase().replace(/^mcp_/, "");
|
|
6560
|
+
}
|
|
6561
|
+
function mergeProtectedTools(...maps) {
|
|
6562
|
+
return Object.fromEntries([DEFAULT_PROTECTED_TOOLS, ...maps].flatMap((map) => Object.entries(map ?? {}).map(([name, count]) => [
|
|
6563
|
+
normalizeProtectedToolName(name),
|
|
6564
|
+
count
|
|
6565
|
+
])));
|
|
6566
|
+
}
|
|
6567
|
+
|
|
6557
6568
|
// src/config/schema/agent-overrides.ts
|
|
6558
6569
|
var PermissionValueSchema = _enum(["ask", "allow", "deny"]);
|
|
6559
6570
|
var PermissionSchema = object({
|
|
@@ -7180,4 +7191,4 @@ function deriveDefaultProtectedTokens(usableSoft) {
|
|
|
7180
7191
|
return Math.min(64000, Math.max(lowerBound, target));
|
|
7181
7192
|
}
|
|
7182
7193
|
|
|
7183
|
-
export { string, number, boolean, unknown, array, object, union, tuple, record, literal, isValidLanguageCode, withContentLanguageDirective, buildPrimaryLanguageDirective, parseCron, nextOccurrence, nextDueAtMs, renderToolTemplate, promptSurfaceConfigIdentity, resolveModelConfigValue, resolvePromptSurface, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, PROTECTED_TOKENS_MIN, DEFAULT_LOCAL_EMBEDDING_MODEL, PER_HARNESS_MIGRATION_INVENTORY, PER_HARNESS_MODEL_KEYS, ConfigProfilesSchema, DREAM_TASK_PROMOTION_DEFAULTS, MagicContextConfigSchema, LIVE_RELOAD_CONFIG_PATHS, deriveDefaultProtectedTokens };
|
|
7194
|
+
export { string, number, boolean, unknown, array, object, union, tuple, record, literal, isValidLanguageCode, withContentLanguageDirective, buildPrimaryLanguageDirective, parseCron, nextOccurrence, nextDueAtMs, renderToolTemplate, promptSurfaceConfigIdentity, resolveModelConfigValue, resolvePromptSurface, DEFAULT_PROTECTED_TOOLS, normalizeProtectedToolName, mergeProtectedTools, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, PROTECTED_TOKENS_MIN, DEFAULT_LOCAL_EMBEDDING_MODEL, PER_HARNESS_MIGRATION_INVENTORY, PER_HARNESS_MODEL_KEYS, ConfigProfilesSchema, DREAM_TASK_PROMOTION_DEFAULTS, MagicContextConfigSchema, LIVE_RELOAD_CONFIG_PATHS, deriveDefaultProtectedTokens };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-rz6g5xne.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
6
|
} from "./server-bb6kf05j.js";
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
} from "./server-mxsy9h1d.js";
|
|
11
11
|
import {
|
|
12
12
|
LocalEmbeddingProvider
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-kwtnrhv3.js";
|
|
14
14
|
import {
|
|
15
15
|
OpenAICompatibleEmbeddingProvider,
|
|
16
16
|
getProjectEmbeddingSnapshot2,
|
|
17
17
|
embedBatchForProject2
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-rpmkz5ta.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./server-qt1qqasc.js";
|
package/dist/v2/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadPluginConfigDetailed
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-5p0bjk3y.js";
|
|
4
4
|
import {
|
|
5
5
|
setHarness2
|
|
6
6
|
} from "./server-pavzsdc6.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
union,
|
|
23
23
|
tuple,
|
|
24
24
|
record
|
|
25
|
-
} from "./server-
|
|
25
|
+
} from "./server-rz6g5xne.js";
|
|
26
26
|
import {
|
|
27
27
|
pushNotification2
|
|
28
28
|
} from "./server-x8a7jmkh.js";
|
|
@@ -7875,7 +7875,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
7875
7875
|
// package.json
|
|
7876
7876
|
var package_default = {
|
|
7877
7877
|
name: "@cortexkit/opencode-magic-context",
|
|
7878
|
-
version: "0.49.
|
|
7878
|
+
version: "0.49.54",
|
|
7879
7879
|
type: "module",
|
|
7880
7880
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
7881
7881
|
main: "dist/index.js",
|
|
@@ -8196,7 +8196,7 @@ async function setup(context) {
|
|
|
8196
8196
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
8197
8197
|
log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
|
|
8198
8198
|
}
|
|
8199
|
-
const { registerContext } = await import("./context-
|
|
8199
|
+
const { registerContext } = await import("./context-13er940g.js");
|
|
8200
8200
|
setHarness2("opencode2");
|
|
8201
8201
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
8202
8202
|
const duties = await registerContext(context);
|
|
@@ -64,9 +64,11 @@ import {
|
|
|
64
64
|
adoptNullOwnerToolTag2,
|
|
65
65
|
getCandidateToolOwners2,
|
|
66
66
|
pickNearestPriorOwner2
|
|
67
|
-
} from "./server-
|
|
67
|
+
} from "./server-beydmd68.js";
|
|
68
68
|
import"./server-1zx87sdm.js";
|
|
69
|
-
import"./server-
|
|
69
|
+
import"./server-rz6g5xne.js";
|
|
70
|
+
import"./server-b0357as4.js";
|
|
71
|
+
import"./server-np27dgyt.js";
|
|
70
72
|
import"./server-3jc6qmdz.js";
|
|
71
73
|
import"./server-gzy5w8ya.js";
|
|
72
74
|
import"./server-bb6kf05j.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
releaseCompartmentLeaseBestEffort,
|
|
12
12
|
getCompartments,
|
|
13
13
|
getLastCompartmentEndMessage
|
|
14
|
-
} from "./server-
|
|
14
|
+
} from "./server-7rmf6a57.js";
|
|
15
15
|
import"./server-2amn2s73.js";
|
|
16
16
|
import"./server-3jc6qmdz.js";
|
|
17
17
|
import"./server-mxsy9h1d.js";
|
|
@@ -24,31 +24,31 @@ import"./server-1d042x6w.js";
|
|
|
24
24
|
import"./server-rz5jnhnv.js";
|
|
25
25
|
import"./server-966dq3pd.js";
|
|
26
26
|
import"./server-g61hgy1y.js";
|
|
27
|
-
import"./server-
|
|
27
|
+
import"./server-jwydbwcx.js";
|
|
28
28
|
import {
|
|
29
29
|
getWrapupInProgressState,
|
|
30
30
|
acquireWrapupInProgress,
|
|
31
31
|
updateWrapupInProgress,
|
|
32
32
|
releaseWrapupInProgress,
|
|
33
33
|
getHistorianFailureState,
|
|
34
|
-
clearEmergencyRecovery
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
import"./server-
|
|
38
|
-
import"./server-kreheyw5.js";
|
|
34
|
+
clearEmergencyRecovery
|
|
35
|
+
} from "./server-beydmd68.js";
|
|
36
|
+
import"./server-b0357as4.js";
|
|
37
|
+
import"./server-0ayyh3mx.js";
|
|
39
38
|
import"./server-1zx87sdm.js";
|
|
40
|
-
import"./server-
|
|
41
|
-
import"./server-0ms13pc8.js";
|
|
39
|
+
import"./server-rz6g5xne.js";
|
|
42
40
|
import"./server-2ra6pwf3.js";
|
|
43
41
|
import"./server-7vrtk78d.js";
|
|
44
|
-
import
|
|
42
|
+
import {
|
|
43
|
+
prepareRawSessionOrdinals2
|
|
44
|
+
} from "./server-gge95a03.js";
|
|
45
45
|
import"./server-fr0wbhdn.js";
|
|
46
|
-
import"./server-
|
|
46
|
+
import"./server-6k0rnwbd.js";
|
|
47
47
|
import"./server-3yk44ddz.js";
|
|
48
48
|
import"./server-rthnpmbp.js";
|
|
49
49
|
import"./server-fb3zxn06.js";
|
|
50
50
|
import"./server-468mya5v.js";
|
|
51
|
-
import"./server-
|
|
51
|
+
import"./server-4x0xq8a1.js";
|
|
52
52
|
import {
|
|
53
53
|
pushNotification2
|
|
54
54
|
} from "./server-x8a7jmkh.js";
|
|
@@ -63,16 +63,16 @@ import {
|
|
|
63
63
|
registerActiveCompartmentRun,
|
|
64
64
|
setRecompStarting2,
|
|
65
65
|
setRecompTerminal2
|
|
66
|
-
} from "./server-
|
|
66
|
+
} from "./server-96g41nad.js";
|
|
67
67
|
import"./server-qt1qqasc.js";
|
|
68
|
-
import"./server-
|
|
68
|
+
import"./server-rpmkz5ta.js";
|
|
69
69
|
import"./server-qp5sj6n5.js";
|
|
70
70
|
import"./server-4dhv7mqz.js";
|
|
71
|
-
import"./server-
|
|
72
|
-
import"./server-
|
|
71
|
+
import"./server-kwtnrhv3.js";
|
|
72
|
+
import"./server-ycvqg2s3.js";
|
|
73
73
|
import"./server-jjvbk92s.js";
|
|
74
|
-
import"./server-
|
|
75
|
-
import"./server-
|
|
74
|
+
import"./server-v817sf79.js";
|
|
75
|
+
import"./server-5p0bjk3y.js";
|
|
76
76
|
import"./server-sa1fdt41.js";
|
|
77
77
|
import"./server-5kgesxck.js";
|
|
78
78
|
import"./server-91gb0vh8.js";
|
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runManagedWrapup2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
3
|
+
} from "./index-567xsm72.js";
|
|
4
|
+
import"./index-yamsmkmh.js";
|
|
5
|
+
import"./index-xj5bap1r.js";
|
|
6
6
|
import"./index-90z05d0p.js";
|
|
7
7
|
import"./index-sd3egckz.js";
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
8
|
+
import"./index-pdh4tdcq.js";
|
|
9
|
+
import"./index-2vsd5064.js";
|
|
10
10
|
import"./index-jjvbk92s.js";
|
|
11
|
-
import"./index-
|
|
11
|
+
import"./index-sx1sppd6.js";
|
|
12
12
|
import"./index-4dhv7mqz.js";
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
13
|
+
import"./index-tx8nfw85.js";
|
|
14
|
+
import"./index-dhdv88e5.js";
|
|
15
|
+
import"./index-h62j8z2r.js";
|
|
16
16
|
import"./index-2amn2s73.js";
|
|
17
17
|
import"./index-6athgjba.js";
|
|
18
18
|
import"./index-gapnh6tk.js";
|
|
19
19
|
import"./index-r9agn061.js";
|
|
20
20
|
import"./index-qt1qqasc.js";
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
21
|
+
import"./index-29ff546v.js";
|
|
22
|
+
import"./index-sk6p6esd.js";
|
|
23
23
|
import"./index-1zx87sdm.js";
|
|
24
24
|
import"./index-em92bp7f.js";
|
|
25
25
|
import"./index-x8a7jmkh.js";
|
|
26
26
|
import"./index-gz001bx7.js";
|
|
27
|
-
import"./index-
|
|
28
|
-
import"./index-
|
|
27
|
+
import"./index-xstbytjn.js";
|
|
28
|
+
import"./index-6nqz8hsz.js";
|
|
29
29
|
import"./index-qperbvjn.js";
|
|
30
30
|
import"./index-hexdee98.js";
|
|
31
31
|
import"./index-hsyczpn7.js";
|
|
32
|
-
import"./index-
|
|
32
|
+
import"./index-5ptp2de1.js";
|
|
33
33
|
import"./index-fb3zxn06.js";
|
|
34
|
-
import"./index-
|
|
34
|
+
import"./index-sv5tn72j.js";
|
|
35
35
|
import"./index-fr0wbhdn.js";
|
|
36
36
|
import"./index-0k283v27.js";
|
|
37
37
|
import"./index-2ny9xwdn.js";
|
|
38
38
|
import"./index-wh9fxds5.js";
|
|
39
39
|
import"./index-ga5q492k.js";
|
|
40
|
-
import"./index-
|
|
41
|
-
import"./index-a6aqpfp6.js";
|
|
40
|
+
import"./index-9mggb1nv.js";
|
|
42
41
|
import"./index-36wseasx.js";
|
|
43
42
|
import"./index-96ztjvkn.js";
|
|
44
43
|
import"./index-v0p37hm2.js";
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { escalationBands } from "./escalation-bands";
|
|
2
|
+
import { escalationBands, MAX_EXECUTE_THRESHOLD } from "./escalation-bands";
|
|
3
3
|
|
|
4
4
|
describe("escalationBands", () => {
|
|
5
5
|
test.each([
|
|
@@ -20,4 +20,19 @@ describe("escalationBands", () => {
|
|
|
20
20
|
expect(escalationBands(65).forceMaterializationPercentage).toBe(85);
|
|
21
21
|
expect(escalationBands(80).forceMaterializationPercentage).toBe(85);
|
|
22
22
|
});
|
|
23
|
+
|
|
24
|
+
// No threshold puts the force band at or above 95%. A pass held for signed
|
|
25
|
+
// thinking therefore never reaches 95% with compaction on (the hold ends in
|
|
26
|
+
// force-band pressure), and neither the OpenCode postprocess phase nor
|
|
27
|
+
// Pi's pipeline has a 95% release for a held turn any more: that removal
|
|
28
|
+
// rests on this bound. Raising the
|
|
29
|
+
// threshold clamp past 92% would let a reading in [95%, threshold + 2%) be
|
|
30
|
+
// held again.
|
|
31
|
+
test("the force band starts below 95% for every threshold", () => {
|
|
32
|
+
expect(escalationBands(Infinity).forceMaterializationPercentage).toBeLessThan(95);
|
|
33
|
+
expect(escalationBands(Number.MAX_VALUE).forceMaterializationPercentage).toBeLessThan(95);
|
|
34
|
+
expect(escalationBands(MAX_EXECUTE_THRESHOLD).forceMaterializationPercentage).toBeLessThan(
|
|
35
|
+
95,
|
|
36
|
+
);
|
|
37
|
+
});
|
|
23
38
|
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join, relative, resolve } from "node:path";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
|
|
6
|
+
const packagesRoot = resolve(import.meta.dir, "../../..");
|
|
7
|
+
const reason =
|
|
8
|
+
"node:sqlite on Node 22.16 to 22.19 and 24.0 to 24.6 rejects positional arguments for numbered placeholders; use plain ? and pass the value again";
|
|
9
|
+
const sqlStart =
|
|
10
|
+
/^\s*(?:SELECT|WITH|INSERT|UPDATE|DELETE|REPLACE|CREATE|ALTER|DROP|PRAGMA|EXPLAIN)\b/i;
|
|
11
|
+
|
|
12
|
+
function sourceFiles(directory: string): string[] {
|
|
13
|
+
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
14
|
+
if (["node_modules", "dist", "target", ".git"].includes(entry.name)) return [];
|
|
15
|
+
const path = join(directory, entry.name);
|
|
16
|
+
return entry.isDirectory() ? sourceFiles(path) : path.endsWith(".ts") ? [path] : [];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function numberedSqlPlaceholders(path: string, text = readFileSync(path, "utf8")): string[] {
|
|
21
|
+
if (!/\?[0-9]/.test(text)) return [];
|
|
22
|
+
const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true);
|
|
23
|
+
const violations = new Set<number>();
|
|
24
|
+
function checkLiterals(node: ts.Node): void {
|
|
25
|
+
if (
|
|
26
|
+
(ts.isStringLiteralLike(node) || ts.isTemplateLiteralToken(node)) &&
|
|
27
|
+
/\?[0-9]/.test(node.text)
|
|
28
|
+
) {
|
|
29
|
+
violations.add(source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1);
|
|
30
|
+
}
|
|
31
|
+
ts.forEachChild(node, checkLiterals);
|
|
32
|
+
}
|
|
33
|
+
function visit(node: ts.Node): void {
|
|
34
|
+
// The AST excludes comments and regex literals. Inspect whole SQL expressions
|
|
35
|
+
// so a numbered placeholder inside a template interpolation is caught too.
|
|
36
|
+
if (ts.isCallExpression(node)) {
|
|
37
|
+
const callee = node.expression;
|
|
38
|
+
const name = ts.isPropertyAccessExpression(callee)
|
|
39
|
+
? callee.name.text
|
|
40
|
+
: ts.isIdentifier(callee)
|
|
41
|
+
? callee.text
|
|
42
|
+
: "";
|
|
43
|
+
if (["prepare", "exec", "query"].includes(name) && node.arguments[0])
|
|
44
|
+
checkLiterals(node.arguments[0]);
|
|
45
|
+
}
|
|
46
|
+
if (
|
|
47
|
+
ts.isVariableDeclaration(node) &&
|
|
48
|
+
ts.isIdentifier(node.name) &&
|
|
49
|
+
/sql/i.test(node.name.text) &&
|
|
50
|
+
node.initializer
|
|
51
|
+
) {
|
|
52
|
+
checkLiterals(node.initializer);
|
|
53
|
+
}
|
|
54
|
+
const head = ts.isTemplateExpression(node)
|
|
55
|
+
? node.head.text
|
|
56
|
+
: ts.isStringLiteralLike(node)
|
|
57
|
+
? node.text
|
|
58
|
+
: "";
|
|
59
|
+
if (sqlStart.test(head)) checkLiterals(node);
|
|
60
|
+
ts.forEachChild(node, visit);
|
|
61
|
+
}
|
|
62
|
+
visit(source);
|
|
63
|
+
return [...violations]
|
|
64
|
+
.sort((a, b) => a - b)
|
|
65
|
+
.map((line) => `${relative(packagesRoot, path)}:${line}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
describe("SQLite positional placeholders", () => {
|
|
69
|
+
test("rejects numbered SQL placeholders across every package", () => {
|
|
70
|
+
const violations = sourceFiles(packagesRoot).flatMap((path) =>
|
|
71
|
+
numberedSqlPlaceholders(path),
|
|
72
|
+
);
|
|
73
|
+
expect(violations, reason).toEqual([]);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("finds SQL calls, named fragments, returned SQL and interpolated placeholders", () => {
|
|
77
|
+
const fixtures = [
|
|
78
|
+
'db.prepare("SELECT ?1").get(value)',
|
|
79
|
+
"db.query(`SELECT ${flag ? '?1' : '?'}`).get(value)",
|
|
80
|
+
'db.exec("INSERT INTO t VALUES (?2)")',
|
|
81
|
+
'const MESSAGE_FILTER_SQL = " AND session_id = ?1"',
|
|
82
|
+
'function select() { return "SELECT ?3"; }',
|
|
83
|
+
'db.prepare<{ x: string }>("SELECT ?1")',
|
|
84
|
+
];
|
|
85
|
+
for (const fixture of fixtures)
|
|
86
|
+
expect(numberedSqlPlaceholders("fixture.ts", fixture)).toHaveLength(1);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("ignores comments, regexes, prose and anonymous SQL bindings", () => {
|
|
90
|
+
expect(
|
|
91
|
+
numberedSqlPlaceholders(
|
|
92
|
+
"fixture.ts",
|
|
93
|
+
[
|
|
94
|
+
"// SELECT ?1",
|
|
95
|
+
"/* db.prepare('SELECT ?2') */",
|
|
96
|
+
"const model = /[-_.]?5[-_.]1/;",
|
|
97
|
+
'const prose = "Did you mean ?1 or ?2?";',
|
|
98
|
+
'db.prepare("SELECT ?, ?").get(x, x);',
|
|
99
|
+
].join("\n"),
|
|
100
|
+
),
|
|
101
|
+
).toEqual([]);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { expect, spyOn, test } from "bun:test";
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
2
|
import { readdirSync, readFileSync, rmdirSync, writeFileSync } from "node:fs";
|
|
4
3
|
import { join } from "node:path";
|
|
5
4
|
import { __resetRpcIdentityTestHooks, __setRpcIdentityTestHooks } from "./rpc-utils";
|
|
6
5
|
import { withStorageFileMutex } from "./storage-file-mutex";
|
|
7
6
|
import * as permissions from "./storage-permissions";
|
|
7
|
+
import { listOpenFiles } from "./test-open-files";
|
|
8
8
|
import { createTestTempDir } from "./test-temp-dir";
|
|
9
9
|
|
|
10
10
|
const mutex = join(import.meta.dir, "storage-file-mutex.ts");
|
|
@@ -54,12 +54,10 @@ withStorageFileMutex(${JSON.stringify(join(root, "locks"))}, () => {
|
|
|
54
54
|
expect(new TextDecoder().decode(first.value)).toContain("HELD");
|
|
55
55
|
reader.releaseLock();
|
|
56
56
|
if (process.platform === "darwin") {
|
|
57
|
-
const files =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
expect(files.status).toBe(0);
|
|
62
|
-
const names = files.stdout.split("\n").filter((line) => line.startsWith("n"));
|
|
57
|
+
const files = listOpenFiles(child.pid);
|
|
58
|
+
// A paused child's isolation cannot be established from a missing inventory.
|
|
59
|
+
if (!files.available) throw new Error(files.reason);
|
|
60
|
+
const names = files.paths;
|
|
63
61
|
expect(
|
|
64
62
|
names.some((line) =>
|
|
65
63
|
/\/(?:\.local\/share\/opencode|\.local\/share\/cortexkit\/magic-context|\.config\/(?:opencode|cortexkit))\//.test(
|