Skip to content

Commit cb4d48b

Browse files
committed
fix: export fetchJSON globally, add 25+ missing API routes, make supervisor configurable, fix project persistence, add GitHub import + codegraph integration, remove plan item numbers from UI, add MCP/Chrome Bridge routes
1 parent afa4377 commit cb4d48b

8 files changed

Lines changed: 518 additions & 38 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,69 @@ All notable changes to CortexPrism are documented here.
55
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)\
66
Versioning: [Semantic Versioning](https://semver.org/)
77

8+
## [0.45.2] — 2026-06-19
9+
10+
### Fixed
11+
12+
- **UI: `fetchJSON is not defined` on Sandbox, Projects, PromptLab, and Channels pages** — `fetchJSON()` was scoped inside `loadDashboard()` via the `DASHBOARD_JS` template, making it inaccessible to other page-specific functions. Moved `fetchJSON` to global script scope so all pages can use it.
13+
14+
- **API: 404 on `/api/metacognition/history` and `/api/metacognition/summary`** — added route handlers in `router.ts` querying `lens_events` for `meta_assessment` events. History returns last 100 assessments; summary returns decision distribution, escalation count, and recent adversarial critiques.
15+
16+
- **API: 404 on `/api/tools/registry`** — added route handler returning full tool definitions (name, description, params, capabilities). Also registered built-in tools into `globalRegistry` during server startup (`server.ts`) so both `/api/tools/list` and `/api/tools/registry` return populated data (60 tools).
17+
18+
- **API: 404 on `/api/a2a/agent-card.json`** — added `/api/a2a/agent-card.json` as an alias alongside existing `/.well-known/agent-card.json` in the A2A agent card handler.
19+
20+
- **API: 404 on `/api/processes/sub-agents`** — added route handler listing running sub-agent Deno processes via `ps` filtering.
21+
22+
- **API: 404 on `/api/providers/comparison`, `/api/router/history`, `/api/security/supervisor`, and `/api/security/supervisor/history`** — added route handlers for the Settings page extension tabs (Providers, Router, Supervisor):
23+
- `GET /api/providers/comparison` — returns each configured provider with model and context window size
24+
- `GET /api/router/history` — returns router fallthrough history (ephemeral, returns empty until router metrics are persisted)
25+
- `GET /api/security/supervisor` — returns supervisor configuration (provider, model, cache TTL) via `selectSupervisorModel()`
26+
- `PUT /api/security/supervisor` — updates supervisor provider, model, and cache TTL in config
27+
- `DELETE /api/security/supervisor/cache` — clears the supervisor decision cache
28+
- `GET /api/security/supervisor/history` — returns cached supervisor decision entries
29+
30+
- **Supervisor config now configurable** — added `SupervisorConfig` type (`provider`, `model`, `cacheTTL`) to `CortexConfig`. `selectSupervisorModel()` in `supervisor.ts` checks the explicit config first before falling through to key-detection logic. Settings UI replaced read-only stat rows with editable provider/model dropdowns (populated from configured providers and their available models) and a Save button.
31+
32+
- **UI: `TypeError: Cannot read properties of null (reading 'style')` in Settings tabs** — `switchSettingsTab()` and `switchSettingsExtTab()` were accessing `.style.display` on `document.getElementById('settings-ext-tab-*')` elements that may not exist if `extendSettings()` hasn't been called yet. Added null-guards (`?.style`) on all three tab button references.
33+
34+
- **API: 404 on `/api/memori/checkpoints`** — added route handler querying the `memori_checkpoints` table with optional `sessionId` and `limit` query params, returning turn number, timestamp, tokens used, tool call count, and goal snapshot per checkpoint.
35+
36+
- **API: 404 on `/api/daemons/health`** — added route handler returning live daemon status (validator, executor, scheduler) with their Unix socket paths. Also added `GET /api/daemons/:name/logs?lines=` for log retrieval and `POST /api/daemons/:name/restart`.
37+
38+
- **API: 404 on `/api/memory/privacy`, `/api/memory/heuristics`, `/api/memory/embeddings`, and `/api/memory/vector-store`** — added Memory page extension tab route handlers:
39+
- `GET/PUT /api/memory/privacy` — PII redaction toggle and max retention days, stored in config
40+
- `GET /api/memory/heuristics` — heuristic category catalog with rule counts; `PUT` runs the heuristic cycle
41+
- `GET/PUT /api/memory/embeddings` — embedding provider/model/URL/key/dimensions configuration
42+
- `GET/PUT /api/memory/vector-store` — vector store backend selection (SQLite/Qdrant/ChromaDB/Pinecone)
43+
44+
- **Projects: GitHub import + Codegraph integration** — added `POST /api/projects/import-github` to clone a GitHub repository into the local workspaces area, create a filesystem project, and best-effort index it into Codegraph. The Projects page now has an **Import from GitHub** action with both modal and inline fallback repo pickers.
45+
46+
- **Codegraph: created Projects now appear in project selector** — `GET /api/codegraph/projects` now merges indexed codegraph projects with filesystem projects from the Projects page. Selecting a filesystem-only project in Codegraph auto-indexes it on first load via `GET /api/codegraph/architecture` before rendering the graph.
47+
48+
- **Projects import persistence + Codegraph first-load feedback** — GitHub-imported projects now persist the actual cloned workspace path in `cortex-project.json` instead of the metadata directory path, so later Codegraph loads index the real repository. The Codegraph page now shows that first load may take longer while indexing, and surfaces backend error messages instead of a generic empty failure state.
49+
50+
- **API: MCP & Chrome Bridge routes added** — added route handlers for the MCP page and Chrome Bridge settings page:
51+
- `GET /api/mcp/connections` — list configured MCP connections with status
52+
- `GET /api/mcp/connections/:name/tools` — browse tools for a connection
53+
- `POST /api/mcp/connections` — add and connect a new MCP server
54+
- `POST /api/mcp/connections/:name/connect` — reconnect a disconnected server
55+
- `POST /api/mcp/connections/:name/disconnect` — gracefully disconnect
56+
- `DELETE /api/mcp/connections/:name` — remove a connection
57+
- `GET /api/mcp/server` — local MCP server status
58+
- `GET /api/chrome-bridge/status` — Chrome Bridge connection state, tools, and metrics
59+
- `POST /api/chrome-bridge/start` — start the chrome-bridge MCP server
60+
- `POST /api/chrome-bridge/stop` — stop the chrome-bridge MCP server
61+
- `GET /api/chrome-bridge/tools` — list registered chrome-bridge tools
62+
63+
- **GitHub token detection on Version Control page** — fixed `getGitHubToken()` to read from the actual config locations (`config.update.githubToken` and `config.pluginUpdate.githubToken`) instead of a non-existent top-level `config.githubToken`, so the page correctly reports configured tokens.
64+
865
## [0.45.1] — 2026-06-19
966

1067
### Fixed
1168

1269
- **UI: removed Tailwind CDN from production** — replaced `cdn.tailwindcss.com` script tag with inline CSS (`html { height: 100% }`), removed 3 redundant Tailwind utility class usages (`h-full`, `flex`), and updated CSP headers accordingly
13-
- **UI: fixed SyntaxError in sandbox/bug-repro JavaScript** — corrected string escaping in 7 onclick handlers from `\''` to `\\''` (template literal double-escape) in sandbox snapshots, workspace snapshots, and bug repro sections; the broken escaping caused `Uncaught SyntaxError: Unexpected string` in the inline SPA
70+
- **UI: fixed SyntaxError on Projects page Delete button** — `JSON.stringify(p.name)` in the onclick handler was emitting double quotes that broke the HTML attribute boundary (`onclick="deleteProject("name")"`). Changed to `escAttr(p.name)` wrapped in single-quote JS string delimiters.
1471
- **UI: vault credential form accessibility** — wrapped vault credential modal inputs in a `<form>` element with proper button types, added `autocomplete="current-password"` to the password field
1572

1673
## [0.45.0] — 2026-06-19

‎src/config/config.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,14 @@ export interface CortexConfig {
425425
a2a?: import('../a2a/types.ts').A2AConfig;
426426
/** Server-level security configuration */
427427
server?: ServerConfig;
428+
/** Security supervisor model override */
429+
supervisor?: SupervisorConfig;
430+
}
431+
432+
export interface SupervisorConfig {
433+
provider: ProviderKind;
434+
model: string;
435+
cacheTTL?: number;
428436
}
429437

430438
const DEFAULT_CONFIG: CortexConfig = {

‎src/projects/manager.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ export async function createProject(name: string, opts?: {
2222
agentId?: string;
2323
description?: string;
2424
tools?: string[];
25+
path?: string;
2526
}): Promise<ProjectConfig> {
2627
const dir = getProjectDir(name);
2728
await ensureDir(dir);
2829

2930
const config: ProjectConfig = {
3031
name,
31-
path: dir,
32+
path: opts?.path ?? dir,
3233
agentId: opts?.agentId,
3334
description: opts?.description,
3435
tools: opts?.tools ?? [],

‎src/security/supervisor.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,17 @@ function cacheDecision(
9797
* Use Model Quartermaster or config default to select optimal supervisor model
9898
* Prefer fast, cheap models (gemini-2.0-flash, gpt-4o-mini, claude-3.5-haiku)
9999
*/
100-
async function selectSupervisorModel(): Promise<{ provider: ProviderKind; model: string }> {
100+
export async function selectSupervisorModel(): Promise<{ provider: ProviderKind; model: string }> {
101101
const config = await loadConfig();
102102

103+
// Explicit supervisor config takes priority
104+
if (config.supervisor?.provider && config.supervisor?.model) {
105+
return {
106+
provider: config.supervisor.provider,
107+
model: config.supervisor.model,
108+
};
109+
}
110+
103111
if (config.modelSelection?.enabled) {
104112
try {
105113
const { buildRequestContext, getCandidateModels, ModelArbiter } = await import(

0 commit comments

Comments
 (0)