@cortexkit/opencode-magic-context 0.38.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -4
- package/dist/{announcement-6c1g4es4.js → announcement-5eg4t64s.js} +6 -6
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +11 -6
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/raw-loader.d.ts +42 -0
- package/dist/config/raw-loader.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +586 -551
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-an4fxhwf.js → conflict-warning-hook-f406ggbw.js} +5 -5
- package/dist/{derive-budgets-da4yg3tz.js → derive-budgets-xk8cy5e6.js} +5 -5
- package/dist/{emscripten-module-ap8t3st0.js → emscripten-module-49k43zfy.js} +1 -1
- package/dist/{emscripten-module-682pfzaa.js → emscripten-module-ex4v0x4z.js} +1 -1
- package/dist/{emscripten-module-r5h7aghp.js → emscripten-module-jfs3d1dq.js} +1 -1
- package/dist/{emscripten-module-bkktz927.js → emscripten-module-ss4g4spn.js} +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts +3 -2
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +9 -2
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +4 -2
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +21 -5
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts +3 -2
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts +17 -6
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts +2 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts +0 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +3 -2
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts +5 -2
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +6 -3
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
- package/dist/features/magic-context/memory/types.d.ts +16 -0
- package/dist/features/magic-context/memory/types.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +3 -2
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts +3 -2
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts +3 -2
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/condition-compiler.d.ts +2 -0
- package/dist/features/magic-context/smart-notes/condition-compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-embedding-measurements.d.ts +1 -1
- package/dist/features/magic-context/storage-embedding-measurements.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +7 -2
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +1 -0
- package/dist/features/magic-context/storage-meta-shared.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-session-tables.d.ts +18 -0
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -0
- package/dist/features/magic-context/storage-tags.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/tool-definition-tokens.d.ts +10 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +33 -0
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts +3 -2
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/{ffi-d8pnn3mn.js → ffi-bbm9vkfa.js} +1 -1
- package/dist/{ffi-04jzypzk.js → ffi-kb5r0x1j.js} +1 -1
- package/dist/{ffi-t8b862vx.js → ffi-qnrt0y78.js} +1 -1
- package/dist/{ffi-9wvt2wwz.js → ffi-yx2hpf4p.js} +1 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts +3 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +4 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +4 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +4 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +14 -2
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts +7 -0
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
- package/dist/hooks/magic-context/empty-task-output.d.ts +16 -0
- package/dist/hooks/magic-context/empty-task-output.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +18 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts +14 -0
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts +13 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +1 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +12 -0
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-fallback-context-limit.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +4 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +12 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +3 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +8 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +9 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-cae89eas.js → index-1h9t9xb5.js} +2 -2
- package/dist/{index-wckvcay0.js → index-1yh8g550.js} +8 -6
- package/dist/{index-cgyfn1s2.js → index-2wchnyk6.js} +4 -2
- package/dist/{index-2y0ybv5x.js → index-3dkzzh0t.js} +15 -17
- package/dist/{index-4cz5nfxf.js → index-btj2qhmc.js} +5 -5
- package/dist/index-ehpzdy0v.js +126 -0
- package/dist/{index-mmvhrqqb.js → index-k2ts0wk1.js} +6435 -4339
- package/dist/{index-9zhhvr4w.js → index-mg1yx1ph.js} +1 -1
- package/dist/{index-ayd60xnw.js → index-rgdqj8nj.js} +3 -3
- package/dist/{index-ygcng9t8.js → index-rpgg35ms.js} +50 -50
- package/dist/index-rw0qrkvq.js +560 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27158 -24736
- package/dist/model-resolution-r9jbcz86.js +15 -0
- package/dist/{module-ES6BEMUI-atfbtnbp.js → module-ES6BEMUI-1yjdz59c.js} +4 -4
- package/dist/{module-asyncify-2EFITU5U-7xckhw8w.js → module-asyncify-2EFITU5U-fdkx4fhy.js} +1 -1
- package/dist/plugin/dream-timer.d.ts +8 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts +14 -6
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{prompt-context-jpe2dstn.js → prompt-context-29qkb28f.js} +1 -1
- package/dist/{recomp-orchestrator-jsde4ygw.js → recomp-orchestrator-2pncxee7.js} +15 -16
- package/dist/{rpc-notifications-4d22ybn5.js → rpc-notifications-1ffm755w.js} +6 -6
- package/dist/{safe-notification-target-b693f9x3.js → safe-notification-target-tepzc2xa.js} +3 -3
- package/dist/{send-session-notification-dxske5zm.js → send-session-notification-6v5b72b4.js} +7 -7
- package/dist/shared/harness-provider-map.d.ts +6 -0
- package/dist/shared/harness-provider-map.d.ts.map +1 -1
- package/dist/shared/jsonc-edit.d.ts +6 -1
- package/dist/shared/jsonc-edit.d.ts.map +1 -1
- package/dist/shared/model-resolution.d.ts +53 -0
- package/dist/shared/model-resolution.d.ts.map +1 -0
- package/dist/shared/model-suggestion-retry.d.ts +4 -1
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/resolve-fallbacks.d.ts +5 -1
- package/dist/shared/resolve-fallbacks.d.ts.map +1 -1
- package/dist/shared/status-detail-text.d.ts +4 -0
- package/dist/shared/status-detail-text.d.ts.map +1 -0
- package/dist/shared/subagent-runner.d.ts +2 -1
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/{storage-meta-session-mk4gsnke.js → storage-meta-session-yvtbaw7c.js} +8 -8
- package/dist/{task-config-gbp7r23g.js → task-config-a1qmj9bx.js} +8 -8
- package/package.json +4 -2
- package/src/config/index.test.ts +73 -17
- package/src/config/index.ts +38 -23
- package/src/config/project-security.hostile-matrix.test.ts +471 -0
- package/src/config/project-security.test.ts +26 -5
- package/src/config/project-security.ts +141 -22
- package/src/config/raw-loader.test.ts +424 -0
- package/src/config/raw-loader.ts +490 -0
- package/src/config/schema/magic-context.test.ts +145 -2
- package/src/config/schema/magic-context.ts +256 -52
- package/src/shared/harness-provider-map.test.ts +36 -0
- package/src/shared/harness-provider-map.ts +8 -0
- package/src/shared/jsonc-edit.ts +74 -1
- package/src/shared/model-resolution.test.ts +170 -0
- package/src/shared/model-resolution.ts +227 -0
- package/src/shared/model-suggestion-retry.test.ts +27 -0
- package/src/shared/model-suggestion-retry.ts +19 -10
- package/src/shared/resolve-fallbacks.test.ts +13 -1
- package/src/shared/resolve-fallbacks.ts +19 -4
- package/src/shared/status-detail-text.test.ts +80 -0
- package/src/shared/status-detail-text.ts +56 -0
- package/src/shared/subagent-runner.ts +3 -1
- package/src/tui/index.tsx +1 -1
- package/src/tui/tui-compiled-runtime-imports.test.ts +3 -0
- package/src/tui-compiled/index.tsx +1 -1
- package/dist/index-crke4z5j.js +0 -3022
- package/dist/index-td9depx5.js +0 -46
- package/dist/resolve-fallbacks-5n5tvge1.js +0 -11
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { StatusDetail } from "./rpc-types";
|
|
2
|
+
|
|
3
|
+
function formatCount(value: number): string {
|
|
4
|
+
return Math.round(value).toLocaleString();
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function formatCacheLane(detail: StatusDetail): string {
|
|
8
|
+
if (detail.cacheNeverExpires) return `never expires; TTL ${detail.cacheTtl}`;
|
|
9
|
+
if (detail.lastResponseTime <= 0) return `waiting for first response; TTL ${detail.cacheTtl}`;
|
|
10
|
+
if (detail.cacheExpired) return `expired; TTL ${detail.cacheTtl}`;
|
|
11
|
+
return `live (${Math.round(detail.cacheRemainingMs / 1000)}s remaining); TTL ${detail.cacheTtl}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Render the same StatusDetail payload that powers the TUI dialog for chat-only clients. */
|
|
15
|
+
export function formatStatusDetailMarkdown(detail: StatusDetail): string {
|
|
16
|
+
const usableLimit =
|
|
17
|
+
detail.contextLimit > 0
|
|
18
|
+
? `${formatCount(detail.contextLimit)} usable tokens`
|
|
19
|
+
: "? usable tokens";
|
|
20
|
+
const historianState = detail.historianRunning ? "running" : "idle";
|
|
21
|
+
const historianDetails = [
|
|
22
|
+
detail.boundaryPresent === undefined
|
|
23
|
+
? undefined
|
|
24
|
+
: `boundary ${detail.boundaryPresent ? "present" : "absent"}`,
|
|
25
|
+
detail.coverageOrdinal === undefined
|
|
26
|
+
? undefined
|
|
27
|
+
: `coverage ${detail.coverageOrdinal === null ? "none" : detail.coverageOrdinal}`,
|
|
28
|
+
].filter((value): value is string => value !== undefined);
|
|
29
|
+
const mode =
|
|
30
|
+
detail.compaction_enabled === false
|
|
31
|
+
? "native compaction (Magic Context history compaction disabled)"
|
|
32
|
+
: "Magic Context compaction";
|
|
33
|
+
|
|
34
|
+
const lines = [
|
|
35
|
+
"## Magic Context Status",
|
|
36
|
+
"",
|
|
37
|
+
`- **Mode:** ${mode}`,
|
|
38
|
+
`- **Usage:** ${detail.usagePercentage.toFixed(1)}% (${formatCount(detail.inputTokens)} / ${usableLimit})`,
|
|
39
|
+
`- **Cache lane:** ${formatCacheLane(detail)}`,
|
|
40
|
+
`- **Historian:** ${[historianState, ...historianDetails].join("; ")}`,
|
|
41
|
+
`- **Memory:** ${formatCount(detail.memoryCount)} active; ${formatCount(detail.memoryBlockCount)} injected`,
|
|
42
|
+
`- **Tags:** ${formatCount(detail.activeTags)} active, ${formatCount(detail.droppedTags)} dropped; ${formatCount(detail.pendingOpsCount)} pending drops`,
|
|
43
|
+
`- **Execute threshold:** ${detail.executeThreshold.toFixed(1)}%${detail.executeThresholdClamped ? " (clamped)" : ""}`,
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
if (detail.recompProgress?.phase === "recomp") {
|
|
47
|
+
lines.push(
|
|
48
|
+
`- **${detail.recompProgress.kind === "embed" ? "Embed" : "Historian"} progress:** ${formatCount(detail.recompProgress.processedMessages)} / ${formatCount(detail.recompProgress.totalMessages)}`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
if (detail.lastTransformError) {
|
|
52
|
+
lines.push(`- **Last transform error:** ${detail.lastTransformError}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
* the runner contract is purely additive on the OpenCode side.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
+
import type { ModelInput } from "./model-resolution";
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* Configuration for one subagent invocation.
|
|
34
36
|
*
|
|
@@ -63,7 +65,7 @@ export interface SubagentRunOptions {
|
|
|
63
65
|
systemPrompt: string;
|
|
64
66
|
userMessage: string;
|
|
65
67
|
model?: string | undefined;
|
|
66
|
-
fallbackModels?: readonly
|
|
68
|
+
fallbackModels?: readonly ModelInput[];
|
|
67
69
|
timeoutMs?: number | undefined;
|
|
68
70
|
cwd?: string | undefined;
|
|
69
71
|
signal?: AbortSignal | undefined;
|
package/src/tui/index.tsx
CHANGED
|
@@ -356,7 +356,7 @@ const StatusDialog = (props: { api: TuiPluginApi; s: StatusDetail }) => {
|
|
|
356
356
|
</box>
|
|
357
357
|
<R t={t()} l="Configured" v={s().cacheTtl} />
|
|
358
358
|
<R t={t()} l="Last response" v={s().lastResponseTime > 0 ? `${Math.round(elapsed() / 1000)}s ago` : "never"} />
|
|
359
|
-
<R t={t()} l="Remaining" v={s().cacheExpired ? "expired" : s().cacheNeverExpires ? "never
|
|
359
|
+
<R t={t()} l="Remaining" v={s().cacheExpired ? "expired" : s().cacheNeverExpires ? "never (MC never assumes expiry — external cache-keep)" : `${Math.round(s().cacheRemainingMs / 1000)}s`} fg={s().cacheExpired ? t().warning : t().textMuted} />
|
|
360
360
|
<R t={t()} l="Auto-execute" v={s().cacheExpired ? "yes (expired)" : s().cacheNeverExpires ? `at ≥${formatThresholdPercent(s().executeThreshold)}%` : `at TTL or ≥${formatThresholdPercent(s().executeThreshold)}%`} fg={t().textMuted} />
|
|
361
361
|
<box marginTop={1}>
|
|
362
362
|
<text fg={t().text}><b>Memory</b></text>
|
|
@@ -49,6 +49,9 @@ describe("compiled TUI runtime imports", () => {
|
|
|
49
49
|
* Built from the shared list so the test cannot cover fewer modules than the
|
|
50
50
|
* build rewrites. */
|
|
51
51
|
async function loadExportSets(): Promise<Record<string, Set<string>>> {
|
|
52
|
+
// @opentui/core/testing subclasses a core export during module initialization;
|
|
53
|
+
// warm core before the parallel imports so Bun cannot expose its TDZ.
|
|
54
|
+
await import("@opentui/core");
|
|
52
55
|
const entries = await Promise.all(
|
|
53
56
|
TUI_RUNTIME_SPECIFIERS.map(
|
|
54
57
|
async (specifier) =>
|
|
@@ -671,7 +671,7 @@ const StatusDialog = props => {
|
|
|
671
671
|
},
|
|
672
672
|
l: "Remaining",
|
|
673
673
|
get v() {
|
|
674
|
-
return _$memo(() => !!s().cacheExpired)() ? "expired" : _$memo(() => !!s().cacheNeverExpires)() ? "never
|
|
674
|
+
return _$memo(() => !!s().cacheExpired)() ? "expired" : _$memo(() => !!s().cacheNeverExpires)() ? "never (MC never assumes expiry — external cache-keep)" : `${Math.round(s().cacheRemainingMs / 1000)}s`;
|
|
675
675
|
},
|
|
676
676
|
get fg() {
|
|
677
677
|
return _$memo(() => !!s().cacheExpired)() ? t().warning : t().textMuted;
|