@cortexkit/opencode-magic-context 0.33.1 → 0.34.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/README.md +20 -3
- package/dist/config/agent-disable.d.ts +22 -0
- package/dist/config/agent-disable.d.ts.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/migrate-experimental.d.ts +2 -1
- package/dist/config/migrate-experimental.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +9 -0
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +90 -17
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/config/transform-mode.d.ts +2 -0
- package/dist/config/transform-mode.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-n48c783v.js → conflict-warning-hook-fvpfvt0w.js} +1 -1
- package/dist/{derive-budgets-e9j09sjr.js → derive-budgets-9crp0cvd.js} +1 -1
- package/dist/features/builtin-commands/commands.d.ts +1 -1
- package/dist/features/builtin-commands/commands.d.ts.map +1 -1
- package/dist/features/magic-context/compaction-marker.d.ts +57 -0
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts +1 -0
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +1 -0
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts +1 -0
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +2 -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 +4 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts +19 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-registry.d.ts +28 -0
- package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +7 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +1 -0
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/fail-closed-block.d.ts +10 -0
- package/dist/features/magic-context/fail-closed-block.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/storage-git-commits.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts +7 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
- package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -1
- package/dist/features/magic-context/memory/project-identity.d.ts +2 -6
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts +23 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts +1 -0
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/mural/render-mural.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +8 -1
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/schema-fence-probe.d.ts +28 -0
- package/dist/features/magic-context/schema-fence-probe.d.ts.map +1 -0
- package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +37 -2
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +38 -4
- 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 +2 -2
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/hooks/magic-context/boundary-execution.d.ts +1 -1
- package/dist/hooks/magic-context/boundary-execution.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +1 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/child-session-spawn.d.ts +26 -0
- package/dist/hooks/magic-context/child-session-spawn.d.ts.map +1 -0
- package/dist/hooks/magic-context/command-handler.d.ts +3 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-off-transition.d.ts +96 -0
- package/dist/hooks/magic-context/compaction-off-transition.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +2 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-mapping.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-trigger.d.ts +12 -5
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/ctx-reduce-availability.d.ts +47 -1
- package/dist/hooks/magic-context/ctx-reduce-availability.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts +2 -2
- package/dist/hooks/magic-context/event-handler.d.ts +7 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +13 -21
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts +5 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +2 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +14 -6
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +10 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/live-session-state.d.ts +3 -0
- package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +3 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +20 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +3 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +31 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +29 -2
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-56yjaeb2.js → index-2y0ybv5x.js} +11 -1
- package/dist/{index-ey1bc14z.js → index-b563sga5.js} +7 -264
- package/dist/{index-y1c9tcm3.js → index-cn960ffd.js} +101 -20
- package/dist/{index-xyaekybw.js → index-dtas91s5.js} +6 -4
- package/dist/index-fcyvznch.js +279 -0
- package/dist/{index-63dq2g4d.js → index-ry8rh8cv.js} +138 -24
- package/dist/{index-c2gahrks.js → index-x8spt5wy.js} +1682 -893
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1677 -723
- package/dist/plugin/dream-timer.d.ts +4 -2
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +12 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts +10 -0
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +3 -7
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts +8 -0
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{recomp-orchestrator-2yb2hfh2.js → recomp-orchestrator-k72ejkkh.js} +6 -4
- package/dist/send-session-notification-6njqewzk.js +20 -0
- package/dist/shared/conflict-detector.d.ts +38 -1
- package/dist/shared/conflict-detector.d.ts.map +1 -1
- package/dist/shared/conflict-fixer.d.ts +18 -1
- package/dist/shared/conflict-fixer.d.ts.map +1 -1
- package/dist/shared/context-limit-provenance.d.ts +3 -0
- package/dist/shared/context-limit-provenance.d.ts.map +1 -0
- package/dist/shared/escalation-bands.d.ts +9 -0
- package/dist/shared/escalation-bands.d.ts.map +1 -0
- package/dist/shared/format-threshold.d.ts +1 -1
- package/dist/shared/models-dev-cache.d.ts +29 -3
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +51 -1
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/rpc-utils.d.ts +19 -0
- package/dist/shared/rpc-utils.d.ts.map +1 -1
- package/dist/shared/storage-permissions.d.ts +5 -0
- package/dist/shared/storage-permissions.d.ts.map +1 -0
- package/dist/shared/tui-runtime-specifiers.d.ts +20 -0
- package/dist/shared/tui-runtime-specifiers.d.ts.map +1 -0
- package/dist/{storage-meta-session-td6bwtky.js → storage-meta-session-xt41zbw4.js} +2 -1
- package/dist/{task-config-5nx3qfz8.js → task-config-gbp7r23g.js} +1 -1
- package/dist/tui/compaction-off.d.ts +13 -0
- package/dist/tui/compaction-off.d.ts.map +1 -0
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/dist/tui-compiled/compaction-off.d.ts +13 -0
- package/dist/tui-compiled/compaction-off.d.ts.map +1 -0
- package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/agents/dreamer.ts +68 -0
- package/src/agents/hidden-agent-registrations.ts +331 -0
- package/src/agents/historian.ts +3 -0
- package/src/agents/language-directive.test.ts +138 -0
- package/src/agents/language-directive.ts +121 -0
- package/src/agents/magic-context-prompt.language.test.ts +35 -0
- package/src/agents/magic-context-prompt.test.ts +292 -0
- package/src/agents/magic-context-prompt.ts +182 -0
- package/src/agents/permissions.test.ts +252 -0
- package/src/agents/permissions.ts +186 -0
- package/src/agents/sidekick.ts +1 -0
- package/src/agents/smart-note-compiler.ts +1 -0
- package/src/config/agent-disable.ts +106 -0
- package/src/config/compaction-accessor-guard.test.ts +82 -0
- package/src/config/compaction-backcompat.test.ts +52 -0
- package/src/config/index.test.ts +936 -0
- package/src/config/index.ts +601 -0
- package/src/config/migrate-config-location.test.ts +332 -0
- package/src/config/migrate-config-location.ts +635 -0
- package/src/config/migrate-dreamer-v2.test.ts +287 -0
- package/src/config/migrate-dreamer-v2.ts +336 -0
- package/src/config/migrate-experimental.test.ts +41 -0
- package/src/config/migrate-experimental.ts +185 -0
- package/src/config/project-security.test.ts +388 -0
- package/src/config/project-security.ts +611 -0
- package/src/config/prune-config-leaf.test.ts +78 -0
- package/src/config/prune-config-leaf.ts +68 -0
- package/src/config/removed-config-keys.test.ts +116 -0
- package/src/config/schema/agent-overrides.ts +45 -0
- package/src/config/schema/magic-context.test.ts +359 -0
- package/src/config/schema/magic-context.ts +991 -0
- package/src/config/transform-mode.test.ts +62 -0
- package/src/config/transform-mode.ts +34 -0
- package/src/config/variable.test.ts +323 -0
- package/src/config/variable.ts +192 -0
- package/src/features/magic-context/defaults.ts +1 -0
- package/src/features/magic-context/dreamer/cron.ts +243 -0
- package/src/features/magic-context/dreamer/task-registry.ts +151 -0
- package/src/shared/conflict-detector.test.ts +121 -0
- package/src/shared/conflict-detector.ts +50 -3
- package/src/shared/conflict-fixer.test.ts +309 -0
- package/src/shared/conflict-fixer.ts +82 -5
- package/src/shared/context-limit-provenance.ts +6 -0
- package/src/shared/escalation-bands.test.ts +23 -0
- package/src/shared/escalation-bands.ts +18 -0
- package/src/shared/format-threshold.ts +1 -1
- package/src/shared/models-dev-cache.test.ts +171 -0
- package/src/shared/models-dev-cache.ts +195 -38
- package/src/shared/rpc-server.ts +27 -18
- package/src/shared/rpc-types.ts +55 -1
- package/src/shared/rpc-utils.test.ts +157 -0
- package/src/shared/rpc-utils.ts +137 -0
- package/src/shared/storage-permissions.ts +20 -0
- package/src/shared/tui-runtime-specifiers.ts +32 -0
- package/src/tui/compaction-off.test.ts +56 -0
- package/src/tui/compaction-off.ts +29 -0
- package/src/tui/data/context-db.ts +6 -0
- package/src/tui/index.tsx +113 -65
- package/src/tui/slots/sidebar-content.tsx +189 -91
- package/src/tui/tui-compiled-runtime-imports.test.ts +151 -0
- package/src/tui-compiled/compaction-off.ts +29 -0
- package/src/tui-compiled/data/context-db.ts +6 -0
- package/src/tui-compiled/index.tsx +558 -455
- package/src/tui-compiled/slots/sidebar-content.tsx +334 -169
- package/dist/send-session-notification-tghq9gnh.js +0 -11
- /package/dist/{index-v7fmc1s2.js → index-ygcng9t8.js} +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
import { TUI_RUNTIME_SPECIFIERS } from "../shared/tui-runtime-specifiers";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Every `opentui:runtime-module:*` import in the compiled TUI bundle must name an
|
|
9
|
+
* export the target module actually has.
|
|
10
|
+
*
|
|
11
|
+
* The Solid transform routes ALL of its emitted imports — renderer helpers and
|
|
12
|
+
* control-flow builtins (`For`, `Show`, `Index`, `Switch`, `Match`, ...) alike —
|
|
13
|
+
* through the single `moduleName` that `scripts/build-tui.ts` passes it, which is
|
|
14
|
+
* `@opentui/solid`. But `@opentui/solid` only re-exports its own renderer
|
|
15
|
+
* helpers; the builtins live in `solid-js`. So a bundle built without the
|
|
16
|
+
* redirect in `build-tui.ts` contains
|
|
17
|
+
*
|
|
18
|
+
* import { For as _$For } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
19
|
+
*
|
|
20
|
+
* and the host throws `Export named 'For' not found` while loading the plugin.
|
|
21
|
+
* OpenCode swallows that error, so the only visible symptom is a missing sidebar
|
|
22
|
+
* and missing /ctx-* commands — no crash and nothing on stderr.
|
|
23
|
+
*
|
|
24
|
+
* This test resolves each specifier against the real module export sets instead
|
|
25
|
+
* of a hardcoded list, so it keeps holding when OpenTUI changes which names it
|
|
26
|
+
* re-exports. It covers every specifier `build-tui.ts` rewrites (via the shared
|
|
27
|
+
* `TUI_RUNTIME_SPECIFIERS` list) and fails on any runtime module id outside that
|
|
28
|
+
* set, so a future import from e.g. `solid-js/store` cannot slip through
|
|
29
|
+
* unverified.
|
|
30
|
+
*/
|
|
31
|
+
describe("compiled TUI runtime imports", () => {
|
|
32
|
+
const COMPILED_ROOT = join(import.meta.dir, "..", "tui-compiled");
|
|
33
|
+
const IMPORT_PATTERN = /import \{([^}]+)\} from "opentui:runtime-module:([^"]+)"/g;
|
|
34
|
+
|
|
35
|
+
function compiledFiles(dir: string): string[] {
|
|
36
|
+
const found: string[] = [];
|
|
37
|
+
for (const entry of readdirSync(dir)) {
|
|
38
|
+
const full = join(dir, entry);
|
|
39
|
+
if (statSync(full).isDirectory()) {
|
|
40
|
+
found.push(...compiledFiles(full));
|
|
41
|
+
} else if (entry.endsWith(".ts") || entry.endsWith(".tsx")) {
|
|
42
|
+
found.push(full);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return found;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Export sets for EVERY specifier build-tui.ts rewrites, keyed by module id.
|
|
49
|
+
* Built from the shared list so the test cannot cover fewer modules than the
|
|
50
|
+
* build rewrites. */
|
|
51
|
+
async function loadExportSets(): Promise<Record<string, Set<string>>> {
|
|
52
|
+
const entries = await Promise.all(
|
|
53
|
+
TUI_RUNTIME_SPECIFIERS.map(
|
|
54
|
+
async (specifier) =>
|
|
55
|
+
[specifier, new Set(Object.keys(await import(specifier)))] as const,
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
return Object.fromEntries(entries);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
test("every runtime specifier exists in the module it is imported from", async () => {
|
|
62
|
+
const exportSets = await loadExportSets();
|
|
63
|
+
|
|
64
|
+
const unresolved: string[] = [];
|
|
65
|
+
let checked = 0;
|
|
66
|
+
|
|
67
|
+
for (const file of compiledFiles(COMPILED_ROOT)) {
|
|
68
|
+
const source = readFileSync(file, "utf8");
|
|
69
|
+
for (const match of source.matchAll(IMPORT_PATTERN)) {
|
|
70
|
+
const moduleId = decodeURIComponent(match[2] ?? "");
|
|
71
|
+
const exports = exportSets[moduleId];
|
|
72
|
+
if (!exports) {
|
|
73
|
+
// A runtime module id outside the rewritten set means the build
|
|
74
|
+
// emitted something this guard does not know how to verify.
|
|
75
|
+
// Failing is the only safe answer: skipping it silently is the
|
|
76
|
+
// exact hole that let the `For` misroute ship.
|
|
77
|
+
unresolved.push(
|
|
78
|
+
`${file}: imports from unknown runtime module '${moduleId}' — ` +
|
|
79
|
+
"add it to TUI_RUNTIME_SPECIFIERS so it can be verified",
|
|
80
|
+
);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
for (const specifier of (match[1] ?? "").split(",")) {
|
|
85
|
+
const importedName = specifier
|
|
86
|
+
.trim()
|
|
87
|
+
.split(/\s+as\s+/)[0]
|
|
88
|
+
?.trim();
|
|
89
|
+
if (!importedName) continue;
|
|
90
|
+
checked += 1;
|
|
91
|
+
if (!exports.has(importedName)) {
|
|
92
|
+
unresolved.push(
|
|
93
|
+
`${file}: '${importedName}' is not exported by ${moduleId}`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
expect(checked).toBeGreaterThan(0);
|
|
101
|
+
expect(unresolved).toEqual([]);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test("every rewritten specifier resolves to a non-empty module", async () => {
|
|
105
|
+
// A specifier that stops resolving already fails loudly on its own: the
|
|
106
|
+
// dynamic import inside loadExportSets throws and takes the test with it.
|
|
107
|
+
// What that does NOT catch is a specifier that resolves to an empty module
|
|
108
|
+
// (a renamed or emptied subpath export), which would make the guard above
|
|
109
|
+
// report every import from it as unresolved for a misleading reason.
|
|
110
|
+
const exportSets = await loadExportSets();
|
|
111
|
+
|
|
112
|
+
const empty = TUI_RUNTIME_SPECIFIERS.filter(
|
|
113
|
+
(specifier) => (exportSets[specifier]?.size ?? 0) === 0,
|
|
114
|
+
);
|
|
115
|
+
expect(empty).toEqual([]);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test("TUI_RUNTIME_SPECIFIERS has no duplicates", () => {
|
|
119
|
+
// Object.fromEntries silently collapses duplicate keys, so a duplicated
|
|
120
|
+
// entry would shrink the export-set map without any other signal.
|
|
121
|
+
expect([...new Set(TUI_RUNTIME_SPECIFIERS)]).toEqual([...TUI_RUNTIME_SPECIFIERS]);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test("solid control-flow builtins are imported from solid-js, not @opentui/solid", async () => {
|
|
125
|
+
const openTuiExports = new Set(Object.keys(await import("@opentui/solid")));
|
|
126
|
+
const solidExports = new Set(Object.keys(await import("solid-js")));
|
|
127
|
+
|
|
128
|
+
// The builtins that belong to solid-js alone — the exact set the
|
|
129
|
+
// transform would otherwise misroute to @opentui/solid.
|
|
130
|
+
const misroutable = [...solidExports].filter((name) => !openTuiExports.has(name));
|
|
131
|
+
|
|
132
|
+
const violations: string[] = [];
|
|
133
|
+
for (const file of compiledFiles(COMPILED_ROOT)) {
|
|
134
|
+
const source = readFileSync(file, "utf8");
|
|
135
|
+
for (const match of source.matchAll(IMPORT_PATTERN)) {
|
|
136
|
+
if (decodeURIComponent(match[2] ?? "") !== "@opentui/solid") continue;
|
|
137
|
+
for (const specifier of (match[1] ?? "").split(",")) {
|
|
138
|
+
const importedName = specifier
|
|
139
|
+
.trim()
|
|
140
|
+
.split(/\s+as\s+/)[0]
|
|
141
|
+
?.trim();
|
|
142
|
+
if (importedName && misroutable.includes(importedName)) {
|
|
143
|
+
violations.push(`${file}: '${importedName}' must come from solid-js`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
expect(violations).toEqual([]);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SidebarSnapshot } from "../shared/rpc-types";
|
|
2
|
+
|
|
3
|
+
export interface CompactionOffSidebarRow {
|
|
4
|
+
label: "Memories" | "Notes" | "Archived compartments";
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Formats context pressure from the current wire input and the model context
|
|
10
|
+
* limit. It deliberately does not use the stored Magic Context threshold
|
|
11
|
+
* percentage, because native compaction acts on the model window instead.
|
|
12
|
+
*/
|
|
13
|
+
export function nativeCompactionContextLabel(snapshot: SidebarSnapshot): string {
|
|
14
|
+
if (snapshot.contextLimit <= 0) return "Context: unknown · native compaction";
|
|
15
|
+
const percentage = (snapshot.inputTokens / snapshot.contextLimit) * 100;
|
|
16
|
+
return `Context: ${percentage.toFixed(1)}% · native compaction`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function compactionOffSidebarRows(snapshot: SidebarSnapshot): CompactionOffSidebarRow[] {
|
|
20
|
+
const rows: CompactionOffSidebarRow[] = [
|
|
21
|
+
{ label: "Memories", value: String(snapshot.memoryCount) },
|
|
22
|
+
{ label: "Notes", value: String(snapshot.sessionNoteCount) },
|
|
23
|
+
];
|
|
24
|
+
const archivedCount = snapshot.archivedCompartmentCount ?? 0;
|
|
25
|
+
if (archivedCount > 0) {
|
|
26
|
+
rows.push({ label: "Archived compartments", value: String(archivedCount) });
|
|
27
|
+
}
|
|
28
|
+
return rows;
|
|
29
|
+
}
|
|
@@ -65,6 +65,7 @@ const EMPTY_SNAPSHOT: SidebarSnapshot = {
|
|
|
65
65
|
sessionNoteCount: 0,
|
|
66
66
|
readySmartNoteCount: 0,
|
|
67
67
|
cacheTtl: "5m",
|
|
68
|
+
lastTransformError: null,
|
|
68
69
|
lastDreamerRunAt: null,
|
|
69
70
|
projectIdentity: null,
|
|
70
71
|
compartmentTokens: 0,
|
|
@@ -194,6 +195,7 @@ export async function loadStatusDetail(
|
|
|
194
195
|
cacheTtlMs: 0,
|
|
195
196
|
cacheRemainingMs: 0,
|
|
196
197
|
cacheExpired: false,
|
|
198
|
+
cacheNeverExpires: false,
|
|
197
199
|
executeThreshold: 65,
|
|
198
200
|
executeThresholdMode: "percentage",
|
|
199
201
|
protectedTagCount: 20,
|
|
@@ -202,6 +204,10 @@ export async function loadStatusDetail(
|
|
|
202
204
|
compressionBudget: null,
|
|
203
205
|
compressionUsage: null,
|
|
204
206
|
toastDurationMs: 5000,
|
|
207
|
+
storage_versions: {
|
|
208
|
+
context_db_schema_version: null,
|
|
209
|
+
plugin_supported_version: 0,
|
|
210
|
+
},
|
|
205
211
|
};
|
|
206
212
|
|
|
207
213
|
if (!rpcClient) return emptyDetail;
|