@cortexkit/opencode-magic-context 0.40.0 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/permissions.d.ts +5 -3
- package/dist/agents/permissions.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts +19 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/temporal-awareness.d.ts +1 -1
- package/dist/hooks/magic-context/temporal-awareness.d.ts.map +1 -1
- package/dist/{index-axpym70t.js → index-x64cmpej.js} +112 -23
- package/dist/index.js +12 -6
- package/dist/{recomp-orchestrator-dmyvqekw.js → recomp-orchestrator-dtgww0f0.js} +1 -1
- package/package.json +2 -1
- package/src/agents/permissions.ts +14 -4
|
@@ -86,9 +86,11 @@ export declare function buildAllowOnlyPermission(allowedTools: readonly string[]
|
|
|
86
86
|
* Add final `permission.task` denies for Magic Context's internal workers.
|
|
87
87
|
*
|
|
88
88
|
* OpenCode accepts either a whole-permission action or a pattern map for
|
|
89
|
-
* `permission.task`; its evaluator uses the last matching rule.
|
|
90
|
-
* whole-permission form, retain
|
|
91
|
-
* exact agent-id denies
|
|
89
|
+
* `permission.task`; its visibility evaluator uses the last matching rule.
|
|
90
|
+
* Normalize the whole-permission form, retain unrelated user rules, then append
|
|
91
|
+
* our exact agent-id denies. When the ambient task policy has a wildcard deny,
|
|
92
|
+
* re-emit that wildcard after the named denies so the Task tool is hidden rather
|
|
93
|
+
* than shown as a callable-but-refused tool.
|
|
92
94
|
*/
|
|
93
95
|
export declare function denyTaskRoutingToAgents(permission: unknown, internalAgentIds: readonly string[]): Record<string, unknown>;
|
|
94
96
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/agents/permissions.ts"],"names":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M,EAAE,GAC9B,SAAS,MAAM,EAAE,CAGnB;AAQD;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,mCAAmC,yBAA0B,CAAC;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,yCAAyC,0FAQ5C,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,aAAc,CAAC;AAE7D,eAAO,MAAM,sBAAsB,oDAAqD,CAAC"}
|
|
@@ -4,6 +4,24 @@ import type { EmbeddingProvider, EmbeddingPurpose } from "./embedding-provider";
|
|
|
4
4
|
* Kept as a literal union so the config schema, identity fold, and pipeline
|
|
5
5
|
* call share one source of truth. See issue #259. */
|
|
6
6
|
export type LocalEmbeddingDtype = "auto" | "fp32" | "fp16" | "q8" | "int8" | "uint8" | "q4" | "bnb4" | "q4f16" | "q2" | "q2f16" | "q1" | "q1f16";
|
|
7
|
+
type TransformersModule = Record<string, unknown>;
|
|
8
|
+
type LocalEmbeddingTestHooks = {
|
|
9
|
+
isElectron?: () => boolean;
|
|
10
|
+
injectWasmOrt?: () => Promise<boolean>;
|
|
11
|
+
importTransformers?: () => Promise<TransformersModule>;
|
|
12
|
+
importTransformersWasmFallback?: () => Promise<TransformersModule>;
|
|
13
|
+
modelCacheDir?: () => string;
|
|
14
|
+
log?: (message: string, data?: unknown) => void;
|
|
15
|
+
};
|
|
16
|
+
/** Test-only seams keep native-loader failures reproducible without loading a real addon. */
|
|
17
|
+
export declare function __setLocalEmbeddingTestHooks(hooks: LocalEmbeddingTestHooks): void;
|
|
18
|
+
/** Reset process-global runtime decisions between isolated provider tests. */
|
|
19
|
+
export declare function __resetLocalEmbeddingForTests(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Recognizes the permanent native-runtime load failure. A missing package or a
|
|
22
|
+
* broken platform binding is environmental rather than transient, and triggers
|
|
23
|
+
* exactly one WASM retry before the process is permanently disabled.
|
|
24
|
+
*/
|
|
7
25
|
export declare function isNativeRuntimeMissingError(error: unknown): boolean;
|
|
8
26
|
export declare class LocalEmbeddingProvider implements EmbeddingProvider {
|
|
9
27
|
readonly modelId: string;
|
|
@@ -25,4 +43,5 @@ export declare class LocalEmbeddingProvider implements EmbeddingProvider {
|
|
|
25
43
|
dispose(): Promise<void>;
|
|
26
44
|
isLoaded(): boolean;
|
|
27
45
|
}
|
|
46
|
+
export {};
|
|
28
47
|
//# sourceMappingURL=embedding-local.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding-local.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-local.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEhF;;;sDAGsD;AACtD,MAAM,MAAM,mBAAmB,GACzB,MAAM,GACN,MAAM,GACN,MAAM,GACN,IAAI,GACJ,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,OAAO,GACP,IAAI,GACJ,OAAO,GACP,IAAI,GACJ,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"embedding-local.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-local.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEhF;;;sDAGsD;AACtD,MAAM,MAAM,mBAAmB,GACzB,MAAM,GACN,MAAM,GACN,MAAM,GACN,IAAI,GACJ,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,OAAO,GACP,IAAI,GACJ,OAAO,GACP,IAAI,GACJ,OAAO,CAAC;AA4Gd,KAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIlD,KAAK,uBAAuB,GAAG;IAC3B,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,kBAAkB,CAAC,EAAE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,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAWD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,qBAAqB,EAAE,CA0D/F;AAED,eAAO,MAAM,gBAAgB;;;;;;;CAO5B,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,CAAC,CAmKD"}
|
|
@@ -56,7 +56,7 @@ export declare const TEMPORAL_MARKER_PATTERN: RegExp;
|
|
|
56
56
|
*/
|
|
57
57
|
export declare function temporalMarkerPrefix(seconds: number): string | null;
|
|
58
58
|
/**
|
|
59
|
-
* Inject HTML-comment gap markers into user-message text parts when
|
|
59
|
+
* Inject HTML-comment gap markers into authored user-message text parts when
|
|
60
60
|
* temporal awareness is enabled and the gap since the previous message's
|
|
61
61
|
* effective end time exceeds TEMPORAL_AWARENESS_THRESHOLD_SECONDS.
|
|
62
62
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temporal-awareness.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/temporal-awareness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"temporal-awareness.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/temporal-awareness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,uEAAuE;AACvE,eAAO,MAAM,oCAAoC,MAAM,CAAC;AAQxD;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyBxD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEpF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAM7C;AAED;oDACoD;AACpD,eAAO,MAAM,uBAAuB,QAA+C,CAAC;AAEpF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAInE;AAiCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAuCjE"}
|
|
@@ -7151,8 +7151,6 @@ CREATE INDEX IF NOT EXISTS idx_dream_queue_pending ON dream_queue(started_at, en
|
|
|
7151
7151
|
updated_at INTEGER NOT NULL,
|
|
7152
7152
|
harness TEXT NOT NULL DEFAULT 'opencode'
|
|
7153
7153
|
);
|
|
7154
|
-
CREATE INDEX IF NOT EXISTS idx_message_history_index_orphan_sweep
|
|
7155
|
-
ON message_history_index(harness, session_id, updated_at);
|
|
7156
7154
|
|
|
7157
7155
|
CREATE TABLE IF NOT EXISTS message_history_source (
|
|
7158
7156
|
session_id TEXT NOT NULL,
|
|
@@ -7739,6 +7737,10 @@ CREATE INDEX IF NOT EXISTS idx_dream_queue_pending ON dream_queue(started_at, en
|
|
|
7739
7737
|
ensureColumn(db, "recomp_compartments", "harness", "TEXT NOT NULL DEFAULT 'opencode'");
|
|
7740
7738
|
ensureColumn(db, "recomp_facts", "harness", "TEXT NOT NULL DEFAULT 'opencode'");
|
|
7741
7739
|
ensureColumn(db, "message_history_index", "harness", "TEXT NOT NULL DEFAULT 'opencode'");
|
|
7740
|
+
db.exec(`
|
|
7741
|
+
CREATE INDEX IF NOT EXISTS idx_message_history_index_orphan_sweep
|
|
7742
|
+
ON message_history_index(harness, session_id, updated_at);
|
|
7743
|
+
`);
|
|
7742
7744
|
ensureColumn(db, "workspaces", "share_categories", `TEXT NOT NULL DEFAULT '["CONSTRAINTS"]'`);
|
|
7743
7745
|
}
|
|
7744
7746
|
var CHANNEL2_CLAIM_TTL_MS = 10 * 60000;
|
|
@@ -34319,33 +34321,123 @@ function startLockHeartbeat(lockPath) {
|
|
|
34319
34321
|
timer.unref?.();
|
|
34320
34322
|
return () => clearInterval(timer);
|
|
34321
34323
|
}
|
|
34322
|
-
|
|
34323
|
-
|
|
34324
|
+
var localEmbeddingRuntimeMode = "native";
|
|
34325
|
+
var wasmRuntimeInjected = false;
|
|
34326
|
+
var isElectronForRuntime = () => typeof process !== "undefined" && Boolean(process.versions?.electron);
|
|
34327
|
+
var importWasmOrtForRuntime = async () => {
|
|
34328
|
+
const ortWebSpec = `onnxruntime-${"web"}`;
|
|
34329
|
+
return await import(ortWebSpec);
|
|
34330
|
+
};
|
|
34331
|
+
var importTransformersForRuntime = async () => {
|
|
34332
|
+
const transformersSpec = "@huggingface/transformers";
|
|
34333
|
+
return await import(transformersSpec);
|
|
34334
|
+
};
|
|
34335
|
+
var importTransformersWasmFallbackForRuntime = async () => {
|
|
34336
|
+
const { createRequire: createRequireFn } = await import("node:module");
|
|
34337
|
+
const requireFn = createRequireFn(import.meta.url);
|
|
34338
|
+
const nodeEntry = requireFn.resolve("@huggingface/transformers");
|
|
34339
|
+
const webEntry = pathToFileURL2(join6(dirname5(nodeEntry), "transformers.web.js")).href;
|
|
34340
|
+
return await import(webEntry);
|
|
34341
|
+
};
|
|
34342
|
+
var modelCacheDirForRuntime = () => join6(getMagicContextStorageDir(), "models");
|
|
34343
|
+
var logForRuntime = log;
|
|
34344
|
+
var injectWasmOrtForRuntime = injectWasmOrt;
|
|
34345
|
+
async function ensureWasmOrtInjected() {
|
|
34346
|
+
if (wasmRuntimeInjected)
|
|
34347
|
+
return true;
|
|
34348
|
+
if (!await injectWasmOrtForRuntime())
|
|
34324
34349
|
return false;
|
|
34325
|
-
|
|
34350
|
+
wasmRuntimeInjected = true;
|
|
34351
|
+
return true;
|
|
34352
|
+
}
|
|
34353
|
+
async function injectWasmOrt() {
|
|
34354
|
+
if (wasmRuntimeInjected)
|
|
34355
|
+
return true;
|
|
34326
34356
|
try {
|
|
34327
|
-
const
|
|
34328
|
-
const ortWeb = await import(ortWebSpec);
|
|
34357
|
+
const ortWeb = await importWasmOrtForRuntime();
|
|
34329
34358
|
try {
|
|
34330
34359
|
const { createRequire: createRequireFn } = await import("node:module");
|
|
34331
34360
|
const requireFn = createRequireFn(import.meta.url);
|
|
34332
34361
|
const mainEntry = requireFn.resolve("onnxruntime-web");
|
|
34333
34362
|
const distDir = dirname5(mainEntry);
|
|
34334
|
-
const wasmPathsPrefix = `${pathToFileURL2(distDir).href}/`;
|
|
34335
34363
|
if (ortWeb.env?.wasm) {
|
|
34336
|
-
ortWeb.env.wasm.wasmPaths =
|
|
34364
|
+
ortWeb.env.wasm.wasmPaths = `${pathToFileURL2(distDir).href}/`;
|
|
34337
34365
|
}
|
|
34338
34366
|
} catch (pathError) {
|
|
34339
34367
|
log("[magic-context] could not resolve local onnxruntime-web/dist, falling back to default WASM paths:", pathError instanceof Error ? pathError.message : String(pathError));
|
|
34340
34368
|
}
|
|
34341
34369
|
globalThis[Symbol.for("onnxruntime")] = ortWeb;
|
|
34342
|
-
|
|
34370
|
+
wasmRuntimeInjected = true;
|
|
34343
34371
|
return true;
|
|
34344
34372
|
} catch (error51) {
|
|
34345
|
-
log("[magic-context] failed to inject onnxruntime-web
|
|
34373
|
+
log("[magic-context] failed to inject onnxruntime-web:", error51 instanceof Error ? error51.message : String(error51));
|
|
34346
34374
|
return false;
|
|
34347
34375
|
}
|
|
34348
34376
|
}
|
|
34377
|
+
function likelyMuslHint() {
|
|
34378
|
+
if (process.platform !== "linux" || typeof process.report?.getReport !== "function")
|
|
34379
|
+
return "";
|
|
34380
|
+
try {
|
|
34381
|
+
const report = process.report.getReport();
|
|
34382
|
+
return typeof report.header?.glibcVersionRuntime === "string" ? "" : " Linux process report has no glibc runtime version (musl likely).";
|
|
34383
|
+
} catch {
|
|
34384
|
+
return "";
|
|
34385
|
+
}
|
|
34386
|
+
}
|
|
34387
|
+
function localEmbeddingRuntimeIsDisabled() {
|
|
34388
|
+
return localEmbeddingRuntimeMode === "disabled";
|
|
34389
|
+
}
|
|
34390
|
+
function disableLocalEmbeddingsAfterRuntimeFailure(detail) {
|
|
34391
|
+
localEmbeddingRuntimeMode = "disabled";
|
|
34392
|
+
logForRuntime(`[magic-context] local embeddings are disabled because both the onnxruntime-node native binding and the onnxruntime-web (WASM) fallback failed to load. Native failure: ${detail}. Run \`npx @cortexkit/magic-context@latest doctor\` for repair guidance (use \`doctor --force\` to reinstall cached plugin packages), or configure an \`openai-compatible\` embedding HTTP endpoint. Existing memories are unaffected.`);
|
|
34393
|
+
}
|
|
34394
|
+
async function loadTransformersForLocalEmbedding() {
|
|
34395
|
+
if (localEmbeddingRuntimeMode === "disabled") {
|
|
34396
|
+
throw new Error("local embedding runtime is disabled");
|
|
34397
|
+
}
|
|
34398
|
+
if (localEmbeddingRuntimeMode === "wasm") {
|
|
34399
|
+
if (!await ensureWasmOrtInjected()) {
|
|
34400
|
+
disableLocalEmbeddingsAfterRuntimeFailure("the previously selected WASM runtime is unavailable");
|
|
34401
|
+
throw new Error("onnxruntime-web failed to load");
|
|
34402
|
+
}
|
|
34403
|
+
try {
|
|
34404
|
+
return { module: await importTransformersWasmFallbackForRuntime(), usesWasm: true };
|
|
34405
|
+
} catch (wasmError) {
|
|
34406
|
+
disableLocalEmbeddingsAfterRuntimeFailure("the previously selected WASM runtime failed to load");
|
|
34407
|
+
throw wasmError;
|
|
34408
|
+
}
|
|
34409
|
+
}
|
|
34410
|
+
const electron = isElectronForRuntime();
|
|
34411
|
+
if (electron) {
|
|
34412
|
+
const wasInjected = wasmRuntimeInjected;
|
|
34413
|
+
if (await ensureWasmOrtInjected()) {
|
|
34414
|
+
if (!wasInjected) {
|
|
34415
|
+
logForRuntime("[magic-context] Electron detected — using onnxruntime-web (WASM) for embeddings (bypasses onnxruntime-node native load)");
|
|
34416
|
+
}
|
|
34417
|
+
return { module: await importTransformersForRuntime(), usesWasm: true };
|
|
34418
|
+
}
|
|
34419
|
+
}
|
|
34420
|
+
try {
|
|
34421
|
+
return { module: await importTransformersForRuntime(), usesWasm: false };
|
|
34422
|
+
} catch (nativeError) {
|
|
34423
|
+
if (!isNativeRuntimeMissingError(nativeError) || electron) {
|
|
34424
|
+
throw nativeError;
|
|
34425
|
+
}
|
|
34426
|
+
if (!await ensureWasmOrtInjected()) {
|
|
34427
|
+
disableLocalEmbeddingsAfterRuntimeFailure(nativeError instanceof Error ? nativeError.message : String(nativeError));
|
|
34428
|
+
throw nativeError;
|
|
34429
|
+
}
|
|
34430
|
+
localEmbeddingRuntimeMode = "wasm";
|
|
34431
|
+
try {
|
|
34432
|
+
const module = await importTransformersWasmFallbackForRuntime();
|
|
34433
|
+
logForRuntime("[magic-context] onnxruntime-node failed to load; using onnxruntime-web (WASM) for local embeddings. WASM inference is slower than native; a remote `openai-compatible` provider may be faster." + likelyMuslHint());
|
|
34434
|
+
return { module, usesWasm: true };
|
|
34435
|
+
} catch (wasmError) {
|
|
34436
|
+
disableLocalEmbeddingsAfterRuntimeFailure(nativeError instanceof Error ? nativeError.message : String(nativeError));
|
|
34437
|
+
throw wasmError;
|
|
34438
|
+
}
|
|
34439
|
+
}
|
|
34440
|
+
}
|
|
34349
34441
|
var DEFAULT_LOCAL_DTYPE = "fp32";
|
|
34350
34442
|
async function withQuietConsole(fn) {
|
|
34351
34443
|
const origWarn = console.warn;
|
|
@@ -34363,7 +34455,6 @@ async function withQuietConsole(fn) {
|
|
|
34363
34455
|
console.error = origError;
|
|
34364
34456
|
}
|
|
34365
34457
|
}
|
|
34366
|
-
var nativeRuntimeMissing = false;
|
|
34367
34458
|
function isNativeRuntimeMissingError(error51) {
|
|
34368
34459
|
const message = error51 instanceof Error ? error51.message : String(error51 ?? "");
|
|
34369
34460
|
const lower = message.toLowerCase();
|
|
@@ -34447,7 +34538,7 @@ class LocalEmbeddingProvider {
|
|
|
34447
34538
|
if (this.pipeline) {
|
|
34448
34539
|
return true;
|
|
34449
34540
|
}
|
|
34450
|
-
if (
|
|
34541
|
+
if (localEmbeddingRuntimeMode === "disabled") {
|
|
34451
34542
|
return false;
|
|
34452
34543
|
}
|
|
34453
34544
|
if (this.initPromise) {
|
|
@@ -34459,15 +34550,13 @@ class LocalEmbeddingProvider {
|
|
|
34459
34550
|
if (this.disposing) {
|
|
34460
34551
|
return;
|
|
34461
34552
|
}
|
|
34462
|
-
const
|
|
34463
|
-
const transformersSpec = "@huggingface/transformers";
|
|
34464
|
-
const transformersModule = await import(transformersSpec);
|
|
34553
|
+
const { module: transformersModule, usesWasm } = await loadTransformersForLocalEmbedding();
|
|
34465
34554
|
const env = transformersModule.env;
|
|
34466
34555
|
const LogLevel = transformersModule.LogLevel;
|
|
34467
34556
|
if (LogLevel && "ERROR" in LogLevel) {
|
|
34468
34557
|
env.logLevel = LogLevel.ERROR;
|
|
34469
34558
|
}
|
|
34470
|
-
const modelCacheDir =
|
|
34559
|
+
const modelCacheDir = modelCacheDirForRuntime();
|
|
34471
34560
|
try {
|
|
34472
34561
|
if (shouldEnforcePrivateStoragePermissions()) {
|
|
34473
34562
|
mkdirSync3(modelCacheDir, { recursive: true, mode: 448 });
|
|
@@ -34494,7 +34583,7 @@ class LocalEmbeddingProvider {
|
|
|
34494
34583
|
try {
|
|
34495
34584
|
const pipeline = await withQuietConsole(() => createPipeline("feature-extraction", this.model, {
|
|
34496
34585
|
dtype: this.dtype,
|
|
34497
|
-
...
|
|
34586
|
+
...usesWasm ? { device: "auto" } : {}
|
|
34498
34587
|
}));
|
|
34499
34588
|
if (this.disposing) {
|
|
34500
34589
|
await pipeline.dispose?.();
|
|
@@ -34526,10 +34615,9 @@ class LocalEmbeddingProvider {
|
|
|
34526
34615
|
await releaseLock();
|
|
34527
34616
|
}
|
|
34528
34617
|
} catch (error51) {
|
|
34529
|
-
if (isNativeRuntimeMissingError(error51)) {
|
|
34530
|
-
|
|
34531
|
-
|
|
34532
|
-
} else {
|
|
34618
|
+
if (!localEmbeddingRuntimeIsDisabled() && isNativeRuntimeMissingError(error51)) {
|
|
34619
|
+
disableLocalEmbeddingsAfterRuntimeFailure(error51 instanceof Error ? error51.message : String(error51));
|
|
34620
|
+
} else if (!localEmbeddingRuntimeIsDisabled()) {
|
|
34533
34621
|
log("[magic-context] embedding model failed to load:", error51);
|
|
34534
34622
|
}
|
|
34535
34623
|
this.pipeline = null;
|
|
@@ -40599,7 +40687,8 @@ function injectTemporalMarkers(messages) {
|
|
|
40599
40687
|
continue;
|
|
40600
40688
|
const msg = raw;
|
|
40601
40689
|
const role = msg.info?.role;
|
|
40602
|
-
|
|
40690
|
+
const authoredUser = role === "user" && Array.isArray(msg.parts) && hasMeaningfulUserText(msg.parts);
|
|
40691
|
+
if (prev !== null && authoredUser) {
|
|
40603
40692
|
const prevTime = prev.info?.time;
|
|
40604
40693
|
const currTime = msg.info?.time;
|
|
40605
40694
|
if (prevTime?.created !== undefined && currTime?.created !== undefined) {
|
package/dist/index.js
CHANGED
|
@@ -490,7 +490,7 @@ import {
|
|
|
490
490
|
verificationFileExists,
|
|
491
491
|
withContentLanguageDirective,
|
|
492
492
|
withRawSessionMessageCache
|
|
493
|
-
} from "./index-
|
|
493
|
+
} from "./index-x64cmpej.js";
|
|
494
494
|
import {
|
|
495
495
|
deriveHistorianChunkTokens,
|
|
496
496
|
deriveTriggerBudget,
|
|
@@ -8446,12 +8446,14 @@ function denyTaskRoutingToAgents(permission, internalAgentIds) {
|
|
|
8446
8446
|
const { task, ...otherPermissions } = configured;
|
|
8447
8447
|
const configuredTask = isPermissionAction(task) ? { "*": task } : isPermissionMap(task) ? task : {};
|
|
8448
8448
|
const internalAgentIdSet = new Set(internalAgentIds);
|
|
8449
|
-
const
|
|
8449
|
+
const hasAmbientWildcardDeny = configuredTask["*"] === "deny";
|
|
8450
|
+
const retainedTask = Object.fromEntries(Object.entries(configuredTask).filter(([agentId]) => !internalAgentIdSet.has(agentId) && (agentId !== "*" || !hasAmbientWildcardDeny)));
|
|
8450
8451
|
return {
|
|
8451
8452
|
...otherPermissions,
|
|
8452
8453
|
task: {
|
|
8453
8454
|
...retainedTask,
|
|
8454
|
-
...Object.fromEntries(internalAgentIds.map((agentId) => [agentId, "deny"]))
|
|
8455
|
+
...Object.fromEntries(internalAgentIds.map((agentId) => [agentId, "deny"])),
|
|
8456
|
+
...hasAmbientWildcardDeny ? { "*": "deny" } : {}
|
|
8455
8457
|
}
|
|
8456
8458
|
};
|
|
8457
8459
|
}
|
|
@@ -26134,7 +26136,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
26134
26136
|
const db = getDb();
|
|
26135
26137
|
if (!db)
|
|
26136
26138
|
return { ok: false, error: "db unavailable" };
|
|
26137
|
-
const { runManagedRecomp: runManagedRecomp2 } = await import("./recomp-orchestrator-
|
|
26139
|
+
const { runManagedRecomp: runManagedRecomp2 } = await import("./recomp-orchestrator-dtgww0f0.js");
|
|
26138
26140
|
const { sendIgnoredMessage: sendIgnoredMessage2 } = await import("./send-session-notification-6v5b72b4.js");
|
|
26139
26141
|
log(`[rpc] recomp requested for session ${sessionId}`);
|
|
26140
26142
|
const ctx = await buildManagedCtx(db);
|
|
@@ -26150,7 +26152,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
26150
26152
|
const db = getDb();
|
|
26151
26153
|
if (!db)
|
|
26152
26154
|
return { ok: false, error: "db unavailable" };
|
|
26153
|
-
const { runManagedUpgrade: runManagedUpgrade2 } = await import("./recomp-orchestrator-
|
|
26155
|
+
const { runManagedUpgrade: runManagedUpgrade2 } = await import("./recomp-orchestrator-dtgww0f0.js");
|
|
26154
26156
|
const { sendIgnoredMessage: sendIgnoredMessage2 } = await import("./send-session-notification-6v5b72b4.js");
|
|
26155
26157
|
log(`[rpc] session-upgrade requested for session ${sessionId}`);
|
|
26156
26158
|
const ctx = await buildManagedCtx(db);
|
|
@@ -29424,6 +29426,9 @@ function encodeOpenCodeMessagesToCk(messages) {
|
|
|
29424
29426
|
const id = typeof info.id === "string" && info.id.length > 0 && info.id || `opencode-${crypto2.createHash("sha256").update(JSON.stringify(message)).digest("hex").slice(0, 24)}`;
|
|
29425
29427
|
const ordinal = typeof raw.absolute_ordinal === "number" && raw.absolute_ordinal || typeof info.absolute_ordinal === "number" && info.absolute_ordinal || index + 1;
|
|
29426
29428
|
const role = typeof info.role === "string" ? info.role : "user";
|
|
29429
|
+
const time = info.time !== null && typeof info.time === "object" ? info.time : {};
|
|
29430
|
+
const createdAtMs = typeof time.created === "number" ? time.created : typeof info.time_created === "number" ? info.time_created : typeof info.timeCreated === "number" ? info.timeCreated : undefined;
|
|
29431
|
+
const completedAtMs = typeof time.completed === "number" ? time.completed : typeof info.time_completed === "number" ? info.time_completed : typeof info.timeCompleted === "number" ? info.timeCompleted : undefined;
|
|
29427
29432
|
const parts = Array.isArray(raw.parts) ? raw.parts : [];
|
|
29428
29433
|
const synthetic = parts.length > 0 && parts.every((part) => part !== null && typeof part === "object" && (part.synthetic === true || part.syntheticTodoMarker === true));
|
|
29429
29434
|
const content = [];
|
|
@@ -29508,7 +29513,8 @@ function encodeOpenCodeMessagesToCk(messages) {
|
|
|
29508
29513
|
summary: info.summary === true,
|
|
29509
29514
|
errored: info.error !== undefined && info.error !== null,
|
|
29510
29515
|
...typeof info.finish === "string" ? { finish: info.finish } : {},
|
|
29511
|
-
...
|
|
29516
|
+
...createdAtMs === undefined ? {} : { created_at_ms: createdAtMs },
|
|
29517
|
+
...completedAtMs === undefined ? {} : { completed_at_ms: completedAtMs }
|
|
29512
29518
|
}
|
|
29513
29519
|
}
|
|
29514
29520
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/opencode-magic-context",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"ai-tokenizer": "^1.0.6",
|
|
61
61
|
"comment-json": "^5.0.0",
|
|
62
62
|
"jsonc-parser": "^3.3.1",
|
|
63
|
+
"onnxruntime-web": "1.26.0-dev.20260416-b7804b056c",
|
|
63
64
|
"quickjs-emscripten": "^0.32.0",
|
|
64
65
|
"solid-js": "1.9.12",
|
|
65
66
|
"zod": "^4.1.8"
|
|
@@ -123,9 +123,11 @@ function isPermissionMap(value: unknown): value is Record<string, unknown> {
|
|
|
123
123
|
* Add final `permission.task` denies for Magic Context's internal workers.
|
|
124
124
|
*
|
|
125
125
|
* OpenCode accepts either a whole-permission action or a pattern map for
|
|
126
|
-
* `permission.task`; its evaluator uses the last matching rule.
|
|
127
|
-
* whole-permission form, retain
|
|
128
|
-
* exact agent-id denies
|
|
126
|
+
* `permission.task`; its visibility evaluator uses the last matching rule.
|
|
127
|
+
* Normalize the whole-permission form, retain unrelated user rules, then append
|
|
128
|
+
* our exact agent-id denies. When the ambient task policy has a wildcard deny,
|
|
129
|
+
* re-emit that wildcard after the named denies so the Task tool is hidden rather
|
|
130
|
+
* than shown as a callable-but-refused tool.
|
|
129
131
|
*/
|
|
130
132
|
export function denyTaskRoutingToAgents(
|
|
131
133
|
permission: unknown,
|
|
@@ -143,8 +145,12 @@ export function denyTaskRoutingToAgents(
|
|
|
143
145
|
? task
|
|
144
146
|
: {};
|
|
145
147
|
const internalAgentIdSet = new Set(internalAgentIds);
|
|
148
|
+
const hasAmbientWildcardDeny = configuredTask["*"] === "deny";
|
|
146
149
|
const retainedTask = Object.fromEntries(
|
|
147
|
-
Object.entries(configuredTask).filter(
|
|
150
|
+
Object.entries(configuredTask).filter(
|
|
151
|
+
([agentId]) =>
|
|
152
|
+
!internalAgentIdSet.has(agentId) && (agentId !== "*" || !hasAmbientWildcardDeny),
|
|
153
|
+
),
|
|
148
154
|
);
|
|
149
155
|
|
|
150
156
|
return {
|
|
@@ -152,6 +158,10 @@ export function denyTaskRoutingToAgents(
|
|
|
152
158
|
task: {
|
|
153
159
|
...retainedTask,
|
|
154
160
|
...Object.fromEntries(internalAgentIds.map((agentId) => [agentId, "deny"])),
|
|
161
|
+
// OpenCode's Permission.disabled uses findLast. Re-inserting the
|
|
162
|
+
// ambient wildcard after our named routing denies keeps its whole-tool
|
|
163
|
+
// deny as the final match and makes the Task tool invisible.
|
|
164
|
+
...(hasAmbientWildcardDeny ? { "*": "deny" } : {}),
|
|
155
165
|
},
|
|
156
166
|
};
|
|
157
167
|
}
|