cortex-claude 0.7.2__tar.gz → 0.8.0__tar.gz
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.
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/PKG-INFO +16 -8
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/README.md +15 -7
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/pyproject.toml +4 -1
- cortex_claude-0.8.0/src/cortex_claude/__init__.py +1 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/storage/migrations.py +14 -1
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/index.html +3 -2
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/package-lock.json +2 -2
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/public/fonts/bricolage-grotesque.woff2 +0 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/App.tsx +133 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/components/Cleanup.tsx +294 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/components/ClusterDetail.tsx +122 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/components/ClusterGrid.tsx +177 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/components/DetailPanel.tsx +298 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/components/GraphView.tsx +311 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/components/Header.tsx +47 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/components/MemoryList.tsx +201 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/components/Sidebar.tsx +163 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/index.css +221 -0
- cortex_claude-0.8.0/src/cortex_claude/web/frontend/src/lib/api.ts +189 -0
- cortex_claude-0.8.0/src/cortex_claude/web/server.py +796 -0
- cortex_claude-0.8.0/src/cortex_claude/web/static/assets/index-B9k2qiyD.css +2 -0
- cortex_claude-0.8.0/src/cortex_claude/web/static/assets/index-BmJmjCzf.js +329 -0
- cortex_claude-0.8.0/src/cortex_claude/web/static/fonts/bricolage-grotesque.woff2 +0 -0
- cortex_claude-0.8.0/src/cortex_claude/web/static/index.html +15 -0
- cortex_claude-0.7.2/src/cortex_claude/__init__.py +0 -1
- cortex_claude-0.7.2/src/cortex_claude/web/frontend/src/App.tsx +0 -122
- cortex_claude-0.7.2/src/cortex_claude/web/frontend/src/components/DetailPanel.tsx +0 -226
- cortex_claude-0.7.2/src/cortex_claude/web/frontend/src/components/GraphView.tsx +0 -349
- cortex_claude-0.7.2/src/cortex_claude/web/frontend/src/components/Header.tsx +0 -40
- cortex_claude-0.7.2/src/cortex_claude/web/frontend/src/components/Sidebar.tsx +0 -276
- cortex_claude-0.7.2/src/cortex_claude/web/frontend/src/index.css +0 -32
- cortex_claude-0.7.2/src/cortex_claude/web/frontend/src/lib/api.ts +0 -63
- cortex_claude-0.7.2/src/cortex_claude/web/server.py +0 -287
- cortex_claude-0.7.2/src/cortex_claude/web/static/assets/index-BiPLkRYh.css +0 -2
- cortex_claude-0.7.2/src/cortex_claude/web/static/assets/index-Cg9ibm7y.js +0 -329
- cortex_claude-0.7.2/src/cortex_claude/web/static/index.html +0 -14
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/.claude/hooks/post-tool-use.sh +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/.claude/hooks/session-start.sh +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/.github/workflows/ci.yml +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/.github/workflows/publish.yml +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/.gitignore +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/ARCHITECTURE.md +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/CONTRIBUTING.md +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/LICENSE +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/docs/example-ui.gif +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/docs/logo.png +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/examples/config.json +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/examples/mcp-global.json +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/examples/mcp-project.json +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/scripts/benchmark.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/scripts/demo.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/__main__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/capture/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/capture/filter.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/clustering/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/clustering/engine.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/code/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/code/extractor.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/code/facts.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/core/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/core/decay.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/core/engine.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/core/privacy.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/core/scope_manager.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/core/token_budget.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/daemon.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/embeddings/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/embeddings/engine.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/embeddings/tokenizer.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/facts/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/facts/claude_extract.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/facts/extractor.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/facts/normalizer.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/facts/patterns.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/facts/spacy_extract.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/facts/temporal.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/models/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/models/fact.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/models/memory.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/models/scope.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/pipeline/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/app.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/config.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/clusters.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/code.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/facts.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/forget.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/recall.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/save.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/scopes.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/status.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/server/tools/traverse.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/setup.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/storage/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/storage/cluster_repo.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/storage/database.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/storage/fact_repo.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/storage/memory_repo.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/summarizer/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/summarizer/extractive.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/summarizer/scoring.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/.gitignore +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/README.md +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/eslint.config.js +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/package.json +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/public/favicon.svg +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/public/icons.svg +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/src/assets/hero.png +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/src/assets/vite.svg +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/src/lib/cn.ts +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/src/main.tsx +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/src/vite-env.d.ts +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/tsconfig.app.json +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/tsconfig.json +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/tsconfig.node.json +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/vite.config.ts +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/static/favicon.svg +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/static/icons.svg +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/conftest.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_code_graph_reindex.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_confidence.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_daemon_project_scan.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_fact_merging.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_forget_scopes_status.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_fts_and_decay.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_graph_traversal.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_privacy.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_progressive_recall.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_save_recall.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/integration/test_storage.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/__init__.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_capture_filter.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_claude_extract.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_clustering.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_code_extractor.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_code_facts.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_config.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_decay.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_fact_repo.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_facts.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_migration_v6.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_migration_v7.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_normalizer.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_patterns.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_pre_tool_use_hook.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_privacy.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_scope_manager.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_summarizer.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_temporal.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_token_budget.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/tests/unit/test_tokenizer.py +0 -0
- {cortex_claude-0.7.2 → cortex_claude-0.8.0}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: cortex-claude
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Local-first, token-efficient memory system for Claude Code via MCP
|
|
5
5
|
Project-URL: Homepage, https://github.com/rafaelaugusto/cortex-claude
|
|
6
6
|
Project-URL: Repository, https://github.com/rafaelaugusto/cortex-claude
|
|
@@ -68,7 +68,7 @@ Description-Content-Type: text/markdown
|
|
|
68
68
|
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License">
|
|
69
69
|
</a>
|
|
70
70
|
<a href="pyproject.toml">
|
|
71
|
-
<img src="https://img.shields.io/badge/version-0.
|
|
71
|
+
<img src="https://img.shields.io/badge/version-0.8.0-green.svg" alt="Version">
|
|
72
72
|
</a>
|
|
73
73
|
<a href="pyproject.toml">
|
|
74
74
|
<img src="https://img.shields.io/badge/python-%3E%3D3.11-brightgreen.svg" alt="Python">
|
|
@@ -366,19 +366,27 @@ Combines **vector similarity** (semantic meaning) with **FTS5** (exact keyword m
|
|
|
366
366
|
|
|
367
367
|
### Web Dashboard
|
|
368
368
|
|
|
369
|
-
|
|
369
|
+
Browse, explore and prune your memory:
|
|
370
370
|
|
|
371
371
|
```bash
|
|
372
372
|
cortex-claude web
|
|
373
373
|
# Opens at http://localhost:37800
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
+
The dashboard navigates the way recall does — cheapest layer first. It never
|
|
377
|
+
draws the whole graph, so it stays responsive on a database with tens of
|
|
378
|
+
thousands of facts.
|
|
379
|
+
|
|
376
380
|
Features:
|
|
377
|
-
- **
|
|
378
|
-
- **
|
|
379
|
-
- **
|
|
380
|
-
- **
|
|
381
|
-
- **
|
|
381
|
+
- **Cluster map** — the landing view is your semantic sub-graphs, sized by member count. Open one to see its own sub-graph and its strongest memories.
|
|
382
|
+
- **Entity focus** — click a node for that entity's neighbourhood, its facts, and the memories that mention it.
|
|
383
|
+
- **Memory browser** — search, filter by scope and tag, sort by recency, relevance, last use or size. Paginated server-side.
|
|
384
|
+
- **Bulk cleanup** — select by tag, scope, cluster or regex and preview exactly what goes before anything is deleted. Removing a memory takes its facts and its vector with it.
|
|
385
|
+
- **Live stats** — memory and fact counts, clusters, storage, and a 30-day intake sparkline for spotting the day auto-capture ran away with itself.
|
|
386
|
+
|
|
387
|
+
The dashboard binds to localhost only, sends no CORS headers, and validates
|
|
388
|
+
`Host` and `Origin` so no other page in your browser can read or modify your
|
|
389
|
+
memory.
|
|
382
390
|
|
|
383
391
|
---
|
|
384
392
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License">
|
|
14
14
|
</a>
|
|
15
15
|
<a href="pyproject.toml">
|
|
16
|
-
<img src="https://img.shields.io/badge/version-0.
|
|
16
|
+
<img src="https://img.shields.io/badge/version-0.8.0-green.svg" alt="Version">
|
|
17
17
|
</a>
|
|
18
18
|
<a href="pyproject.toml">
|
|
19
19
|
<img src="https://img.shields.io/badge/python-%3E%3D3.11-brightgreen.svg" alt="Python">
|
|
@@ -311,19 +311,27 @@ Combines **vector similarity** (semantic meaning) with **FTS5** (exact keyword m
|
|
|
311
311
|
|
|
312
312
|
### Web Dashboard
|
|
313
313
|
|
|
314
|
-
|
|
314
|
+
Browse, explore and prune your memory:
|
|
315
315
|
|
|
316
316
|
```bash
|
|
317
317
|
cortex-claude web
|
|
318
318
|
# Opens at http://localhost:37800
|
|
319
319
|
```
|
|
320
320
|
|
|
321
|
+
The dashboard navigates the way recall does — cheapest layer first. It never
|
|
322
|
+
draws the whole graph, so it stays responsive on a database with tens of
|
|
323
|
+
thousands of facts.
|
|
324
|
+
|
|
321
325
|
Features:
|
|
322
|
-
- **
|
|
323
|
-
- **
|
|
324
|
-
- **
|
|
325
|
-
- **
|
|
326
|
-
- **
|
|
326
|
+
- **Cluster map** — the landing view is your semantic sub-graphs, sized by member count. Open one to see its own sub-graph and its strongest memories.
|
|
327
|
+
- **Entity focus** — click a node for that entity's neighbourhood, its facts, and the memories that mention it.
|
|
328
|
+
- **Memory browser** — search, filter by scope and tag, sort by recency, relevance, last use or size. Paginated server-side.
|
|
329
|
+
- **Bulk cleanup** — select by tag, scope, cluster or regex and preview exactly what goes before anything is deleted. Removing a memory takes its facts and its vector with it.
|
|
330
|
+
- **Live stats** — memory and fact counts, clusters, storage, and a 30-day intake sparkline for spotting the day auto-capture ran away with itself.
|
|
331
|
+
|
|
332
|
+
The dashboard binds to localhost only, sends no CORS headers, and validates
|
|
333
|
+
`Host` and `Origin` so no other page in your browser can read or modify your
|
|
334
|
+
memory.
|
|
327
335
|
|
|
328
336
|
---
|
|
329
337
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cortex-claude"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.8.0"
|
|
4
4
|
description = "Local-first, token-efficient memory system for Claude Code via MCP"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = { text = "MIT" }
|
|
@@ -74,6 +74,9 @@ build-backend = "hatchling.build"
|
|
|
74
74
|
|
|
75
75
|
[tool.hatch.build.targets.wheel]
|
|
76
76
|
packages = ["src/cortex_claude"]
|
|
77
|
+
# The dashboard ships as the built bundle in web/static; the React sources that
|
|
78
|
+
# produce it are build-time only and would otherwise duplicate the webfont.
|
|
79
|
+
exclude = ["src/cortex_claude/web/frontend"]
|
|
77
80
|
|
|
78
81
|
[tool.pytest.ini_options]
|
|
79
82
|
testpaths = ["tests"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.8.0"
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import sqlite3
|
|
4
4
|
|
|
5
|
-
SCHEMA_VERSION =
|
|
5
|
+
SCHEMA_VERSION = 8
|
|
6
6
|
|
|
7
7
|
SCHEMA_SQL = """
|
|
8
8
|
CREATE TABLE IF NOT EXISTS schema_version (
|
|
@@ -57,6 +57,7 @@ CREATE INDEX IF NOT EXISTS idx_facts_subject ON facts(subject);
|
|
|
57
57
|
CREATE INDEX IF NOT EXISTS idx_facts_object ON facts(object);
|
|
58
58
|
CREATE INDEX IF NOT EXISTS idx_facts_relation ON facts(relation);
|
|
59
59
|
CREATE INDEX IF NOT EXISTS idx_facts_subject_relation ON facts(subject, relation);
|
|
60
|
+
CREATE INDEX IF NOT EXISTS idx_facts_source ON facts(source_memory_id);
|
|
60
61
|
|
|
61
62
|
CREATE TABLE IF NOT EXISTS meta (
|
|
62
63
|
key TEXT PRIMARY KEY,
|
|
@@ -122,6 +123,8 @@ def initialize_schema(conn: sqlite3.Connection, embedding_dim: int = 384) -> Non
|
|
|
122
123
|
_migrate_to_v6(conn)
|
|
123
124
|
if current < 7:
|
|
124
125
|
_migrate_to_v7(conn)
|
|
126
|
+
if current < 8:
|
|
127
|
+
_migrate_to_v8(conn)
|
|
125
128
|
return
|
|
126
129
|
|
|
127
130
|
conn.executescript(SCHEMA_SQL)
|
|
@@ -266,3 +269,13 @@ def _migrate_to_v6(conn: sqlite3.Connection) -> None:
|
|
|
266
269
|
|
|
267
270
|
conn.execute("UPDATE schema_version SET version = 6")
|
|
268
271
|
conn.commit()
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def _migrate_to_v8(conn: sqlite3.Connection) -> None:
|
|
275
|
+
"""Index facts by source memory. The cluster sub-graph query and
|
|
276
|
+
FactRepository.search_by_memories both join on this column."""
|
|
277
|
+
conn.execute(
|
|
278
|
+
"CREATE INDEX IF NOT EXISTS idx_facts_source ON facts(source_memory_id)"
|
|
279
|
+
)
|
|
280
|
+
conn.execute("UPDATE schema_version SET version = 8")
|
|
281
|
+
conn.commit()
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
<html lang="
|
|
2
|
+
<html lang="pt-BR">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<
|
|
7
|
+
<link rel="preload" href="/fonts/bricolage-grotesque.woff2" as="font" type="font/woff2" crossorigin />
|
|
8
|
+
<title>Cortex · Memória</title>
|
|
8
9
|
</head>
|
|
9
10
|
<body>
|
|
10
11
|
<div id="root"></div>
|
{cortex_claude-0.7.2 → cortex_claude-0.8.0}/src/cortex_claude/web/frontend/package-lock.json
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "frontend",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.5.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@types/cytoscape": "^3.21.9",
|
|
12
12
|
"class-variance-authority": "^0.7.1",
|
|
Binary file
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react'
|
|
2
|
+
import { Header } from '@/components/Header'
|
|
3
|
+
import { Sidebar, type View } from '@/components/Sidebar'
|
|
4
|
+
import { ClusterGrid } from '@/components/ClusterGrid'
|
|
5
|
+
import { ClusterDetail } from '@/components/ClusterDetail'
|
|
6
|
+
import { MemoryList } from '@/components/MemoryList'
|
|
7
|
+
import { Cleanup } from '@/components/Cleanup'
|
|
8
|
+
import { EntityPanel, MemoryPanel } from '@/components/DetailPanel'
|
|
9
|
+
import { fetchOverview, type CleanupRule, type Cluster, type Memory, type Overview } from '@/lib/api'
|
|
10
|
+
|
|
11
|
+
export default function App() {
|
|
12
|
+
const [overview, setOverview] = useState<Overview | null>(null)
|
|
13
|
+
const [view, setView] = useState<View>('clusters')
|
|
14
|
+
const [scope, setScope] = useState('all')
|
|
15
|
+
const [tag, setTag] = useState<string | null>(null)
|
|
16
|
+
const [cluster, setCluster] = useState<Cluster | null>(null)
|
|
17
|
+
const [memory, setMemory] = useState<Memory | null>(null)
|
|
18
|
+
const [entity, setEntity] = useState<string | null>(null)
|
|
19
|
+
const [seedRules, setSeedRules] = useState<CleanupRule[]>([])
|
|
20
|
+
const [refreshKey, setRefreshKey] = useState(0)
|
|
21
|
+
|
|
22
|
+
const reload = useCallback(() => {
|
|
23
|
+
fetchOverview().then(setOverview).catch(() => setOverview(null))
|
|
24
|
+
setRefreshKey((k) => k + 1)
|
|
25
|
+
}, [])
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
fetchOverview().then(setOverview).catch(() => setOverview(null))
|
|
29
|
+
}, [])
|
|
30
|
+
|
|
31
|
+
const goView = (v: View) => {
|
|
32
|
+
setView(v)
|
|
33
|
+
setCluster(null)
|
|
34
|
+
setMemory(null)
|
|
35
|
+
setEntity(null)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const pickTag = (t: string | null) => {
|
|
39
|
+
setTag(t)
|
|
40
|
+
if (t) {
|
|
41
|
+
setView('memories')
|
|
42
|
+
setCluster(null)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const openMemory = (m: Memory) => {
|
|
47
|
+
setMemory(m)
|
|
48
|
+
setEntity(null)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const openEntity = (name: string) => {
|
|
52
|
+
setEntity(name)
|
|
53
|
+
setMemory(null)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const cleanCluster = (c: Cluster) => {
|
|
57
|
+
setSeedRules([{ type: 'cluster', value: c.id, scope: c.scope }])
|
|
58
|
+
goView('cleanup')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className="flex h-screen flex-col overflow-hidden bg-ink">
|
|
63
|
+
<Header overview={overview} />
|
|
64
|
+
|
|
65
|
+
<div className="flex min-h-0 flex-1">
|
|
66
|
+
<Sidebar
|
|
67
|
+
overview={overview}
|
|
68
|
+
view={view}
|
|
69
|
+
scope={scope}
|
|
70
|
+
tag={tag}
|
|
71
|
+
onView={goView}
|
|
72
|
+
onScope={(s) => {
|
|
73
|
+
setScope(s)
|
|
74
|
+
setCluster(null)
|
|
75
|
+
}}
|
|
76
|
+
onTag={pickTag}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<main className="relative min-w-0 flex-1 overflow-hidden">
|
|
80
|
+
{view === 'clusters' &&
|
|
81
|
+
(cluster ? (
|
|
82
|
+
<ClusterDetail
|
|
83
|
+
cluster={cluster}
|
|
84
|
+
onBack={() => setCluster(null)}
|
|
85
|
+
onSelectMemory={openMemory}
|
|
86
|
+
onSelectEntity={openEntity}
|
|
87
|
+
onCleanCluster={cleanCluster}
|
|
88
|
+
/>
|
|
89
|
+
) : (
|
|
90
|
+
<ClusterGrid scope={scope} onOpen={setCluster} />
|
|
91
|
+
))}
|
|
92
|
+
|
|
93
|
+
{view === 'memories' && (
|
|
94
|
+
<MemoryList
|
|
95
|
+
scope={scope}
|
|
96
|
+
tag={tag}
|
|
97
|
+
onClearTag={() => setTag(null)}
|
|
98
|
+
onSelect={openMemory}
|
|
99
|
+
selectedId={memory?.id}
|
|
100
|
+
refreshKey={refreshKey}
|
|
101
|
+
/>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
{view === 'cleanup' && (
|
|
105
|
+
<Cleanup
|
|
106
|
+
overview={overview}
|
|
107
|
+
seedRules={seedRules}
|
|
108
|
+
onSeedConsumed={() => setSeedRules([])}
|
|
109
|
+
onDone={reload}
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
{memory && (
|
|
114
|
+
<MemoryPanel
|
|
115
|
+
memory={memory}
|
|
116
|
+
onClose={() => setMemory(null)}
|
|
117
|
+
onChanged={reload}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
|
|
121
|
+
{entity && (
|
|
122
|
+
<EntityPanel
|
|
123
|
+
name={entity}
|
|
124
|
+
onClose={() => setEntity(null)}
|
|
125
|
+
onSelectMemory={openMemory}
|
|
126
|
+
onSelectEntity={setEntity}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</main>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react'
|
|
2
|
+
import { AlertTriangle, Plus, X } from 'lucide-react'
|
|
3
|
+
import {
|
|
4
|
+
executeCleanup,
|
|
5
|
+
formatCount,
|
|
6
|
+
formatDateTime,
|
|
7
|
+
formatSize,
|
|
8
|
+
previewCleanup,
|
|
9
|
+
type CleanupPreview,
|
|
10
|
+
type CleanupRule,
|
|
11
|
+
type Overview,
|
|
12
|
+
} from '@/lib/api'
|
|
13
|
+
import { cn } from '@/lib/cn'
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
overview: Overview | null
|
|
17
|
+
seedRules: CleanupRule[]
|
|
18
|
+
onSeedConsumed: () => void
|
|
19
|
+
onDone: () => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ruleKey(r: CleanupRule): string {
|
|
23
|
+
return `${r.type}:${r.value}`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ruleLabel(r: CleanupRule): string {
|
|
27
|
+
switch (r.type) {
|
|
28
|
+
case 'tag':
|
|
29
|
+
return `tag “${r.value}”`
|
|
30
|
+
case 'cluster':
|
|
31
|
+
return `cluster #${r.value}`
|
|
32
|
+
case 'scope':
|
|
33
|
+
return `escopo “${r.value}”`
|
|
34
|
+
case 'pattern':
|
|
35
|
+
return `padrão /${r.value}/`
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function Cleanup({ overview, seedRules, onSeedConsumed, onDone }: Props) {
|
|
40
|
+
const [selected, setSelected] = useState<CleanupRule[]>([])
|
|
41
|
+
const [pattern, setPattern] = useState('')
|
|
42
|
+
const [preview, setPreview] = useState<CleanupPreview | null>(null)
|
|
43
|
+
const [loading, setLoading] = useState(false)
|
|
44
|
+
const [confirming, setConfirming] = useState(false)
|
|
45
|
+
const [result, setResult] = useState<string | null>(null)
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!seedRules.length) return
|
|
49
|
+
setSelected((prev) => {
|
|
50
|
+
const keys = new Set(prev.map(ruleKey))
|
|
51
|
+
return [...prev, ...seedRules.filter((r) => !keys.has(ruleKey(r)))]
|
|
52
|
+
})
|
|
53
|
+
onSeedConsumed()
|
|
54
|
+
}, [seedRules, onSeedConsumed])
|
|
55
|
+
|
|
56
|
+
const candidates = useMemo<CleanupRule[]>(() => {
|
|
57
|
+
if (!overview) return []
|
|
58
|
+
const tags: CleanupRule[] = overview.tags
|
|
59
|
+
.filter((t) => t.name !== 'auto-capture')
|
|
60
|
+
.slice(0, 12)
|
|
61
|
+
.map((t) => ({ type: 'tag', value: t.name }))
|
|
62
|
+
const scopes: CleanupRule[] = overview.scopes
|
|
63
|
+
.filter((s) => s.memories > 0 && s.name !== 'global')
|
|
64
|
+
.map((s) => ({ type: 'scope', value: s.name }))
|
|
65
|
+
return [...tags, ...scopes]
|
|
66
|
+
}, [overview])
|
|
67
|
+
|
|
68
|
+
const counts = useMemo(() => {
|
|
69
|
+
const map = new Map<string, number>()
|
|
70
|
+
overview?.tags.forEach((t) => map.set(`tag:${t.name}`, t.count))
|
|
71
|
+
overview?.scopes.forEach((s) => map.set(`scope:${s.name}`, s.memories))
|
|
72
|
+
return map
|
|
73
|
+
}, [overview])
|
|
74
|
+
|
|
75
|
+
const toggle = (rule: CleanupRule) => {
|
|
76
|
+
setPreview(null)
|
|
77
|
+
setConfirming(false)
|
|
78
|
+
setResult(null)
|
|
79
|
+
setSelected((prev) => {
|
|
80
|
+
const key = ruleKey(rule)
|
|
81
|
+
return prev.some((r) => ruleKey(r) === key)
|
|
82
|
+
? prev.filter((r) => ruleKey(r) !== key)
|
|
83
|
+
: [...prev, rule]
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const addPattern = () => {
|
|
88
|
+
const value = pattern.trim()
|
|
89
|
+
if (!value) return
|
|
90
|
+
toggle({ type: 'pattern', value })
|
|
91
|
+
setPattern('')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const runPreview = useCallback(async () => {
|
|
95
|
+
if (!selected.length) return
|
|
96
|
+
setLoading(true)
|
|
97
|
+
setConfirming(false)
|
|
98
|
+
setResult(null)
|
|
99
|
+
try {
|
|
100
|
+
setPreview(await previewCleanup(selected))
|
|
101
|
+
} finally {
|
|
102
|
+
setLoading(false)
|
|
103
|
+
}
|
|
104
|
+
}, [selected])
|
|
105
|
+
|
|
106
|
+
const runDelete = async () => {
|
|
107
|
+
setLoading(true)
|
|
108
|
+
try {
|
|
109
|
+
const r = await executeCleanup(selected)
|
|
110
|
+
setResult(`${formatCount(r.deleted)} memórias apagadas.`)
|
|
111
|
+
setSelected([])
|
|
112
|
+
setPreview(null)
|
|
113
|
+
setConfirming(false)
|
|
114
|
+
onDone()
|
|
115
|
+
} finally {
|
|
116
|
+
setLoading(false)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div className="grid h-full grid-cols-[1fr_380px] overflow-hidden">
|
|
122
|
+
<div className="overflow-y-auto p-6">
|
|
123
|
+
<h2 className="display text-xl text-text">Limpar memória</h2>
|
|
124
|
+
<p className="mt-1.5 max-w-xl text-[13px] leading-relaxed text-text-dim">
|
|
125
|
+
Escolha o que remover. As regras somam — uma memória que bata em qualquer uma
|
|
126
|
+
delas entra na conta. Nada é apagado antes de você ver a prévia.
|
|
127
|
+
</p>
|
|
128
|
+
|
|
129
|
+
<p className="eyebrow mb-2.5 mt-7">Por tag e escopo</p>
|
|
130
|
+
<div className="flex flex-wrap gap-1.5">
|
|
131
|
+
{candidates.map((rule) => {
|
|
132
|
+
const active = selected.some((r) => ruleKey(r) === ruleKey(rule))
|
|
133
|
+
const count = counts.get(ruleKey(rule))
|
|
134
|
+
return (
|
|
135
|
+
<button
|
|
136
|
+
key={ruleKey(rule)}
|
|
137
|
+
onClick={() => toggle(rule)}
|
|
138
|
+
className={cn(
|
|
139
|
+
'flex items-center gap-2 rounded-[10px] border px-3 py-2 text-xs transition-colors',
|
|
140
|
+
active
|
|
141
|
+
? 'border-accent bg-accent/12 text-accent'
|
|
142
|
+
: 'border-border text-text-dim hover:border-hairline hover:text-text',
|
|
143
|
+
)}
|
|
144
|
+
>
|
|
145
|
+
<span>{ruleLabel(rule)}</span>
|
|
146
|
+
{count !== undefined && (
|
|
147
|
+
<span className="tnum font-mono text-[10px] opacity-70">
|
|
148
|
+
{formatCount(count)}
|
|
149
|
+
</span>
|
|
150
|
+
)}
|
|
151
|
+
</button>
|
|
152
|
+
)
|
|
153
|
+
})}
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<p className="eyebrow mb-2.5 mt-7">Por padrão no conteúdo</p>
|
|
157
|
+
<div className="flex max-w-md gap-2">
|
|
158
|
+
<input
|
|
159
|
+
value={pattern}
|
|
160
|
+
onChange={(e) => setPattern(e.target.value)}
|
|
161
|
+
onKeyDown={(e) => e.key === 'Enter' && addPattern()}
|
|
162
|
+
placeholder="ex.: ^Command: (ls|cat|head)"
|
|
163
|
+
className="flex-1 rounded-[10px] border border-border bg-ink px-3 py-2 font-mono text-xs text-text outline-none transition-colors placeholder:text-text-mute focus:border-accent/60"
|
|
164
|
+
/>
|
|
165
|
+
<button onClick={addPattern} className="btn-ghost px-3 text-xs text-text-dim">
|
|
166
|
+
<Plus size={14} />
|
|
167
|
+
</button>
|
|
168
|
+
</div>
|
|
169
|
+
<p className="mt-1.5 font-mono text-[10px] text-text-mute">
|
|
170
|
+
expressão regular, sem diferenciar maiúsculas
|
|
171
|
+
</p>
|
|
172
|
+
|
|
173
|
+
{selected.length > 0 && (
|
|
174
|
+
<>
|
|
175
|
+
<p className="eyebrow mb-2.5 mt-7">Regras ativas</p>
|
|
176
|
+
<div className="flex flex-wrap gap-1.5">
|
|
177
|
+
{selected.map((r) => (
|
|
178
|
+
<button
|
|
179
|
+
key={ruleKey(r)}
|
|
180
|
+
onClick={() => toggle(r)}
|
|
181
|
+
className="flex items-center gap-1.5 rounded-[10px] border border-accent bg-accent/12 px-3 py-1.5 text-xs text-accent"
|
|
182
|
+
>
|
|
183
|
+
{ruleLabel(r)} <X size={12} />
|
|
184
|
+
</button>
|
|
185
|
+
))}
|
|
186
|
+
</div>
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div className="flex min-h-0 flex-col border-l border-border bg-surface">
|
|
192
|
+
<p className="eyebrow border-b border-border px-4 py-3">Prévia</p>
|
|
193
|
+
|
|
194
|
+
<div className="flex-1 overflow-y-auto p-4">
|
|
195
|
+
{result ? (
|
|
196
|
+
<p className="text-sm text-teal">{result}</p>
|
|
197
|
+
) : !preview ? (
|
|
198
|
+
<p className="text-[13px] leading-relaxed text-text-mute">
|
|
199
|
+
{selected.length
|
|
200
|
+
? 'Rode a prévia para ver exatamente o que será removido.'
|
|
201
|
+
: 'Selecione ao menos uma regra.'}
|
|
202
|
+
</p>
|
|
203
|
+
) : (
|
|
204
|
+
<>
|
|
205
|
+
<p className="display tnum text-3xl text-text">{formatCount(preview.count)}</p>
|
|
206
|
+
<p className="eyebrow mt-0.5">memórias atingidas</p>
|
|
207
|
+
<p className="mt-2 text-xs text-text-dim">
|
|
208
|
+
{formatSize(preview.size)} de conteúdo
|
|
209
|
+
</p>
|
|
210
|
+
|
|
211
|
+
{preview.by_scope.length > 0 && (
|
|
212
|
+
<div className="mt-4 flex flex-col gap-1">
|
|
213
|
+
{preview.by_scope.map((s) => (
|
|
214
|
+
<div
|
|
215
|
+
key={s.scope}
|
|
216
|
+
className="flex justify-between font-mono text-[11px] text-text-mute"
|
|
217
|
+
>
|
|
218
|
+
<span className="truncate">{s.scope}</span>
|
|
219
|
+
<span className="tnum">{formatCount(s.count)}</span>
|
|
220
|
+
</div>
|
|
221
|
+
))}
|
|
222
|
+
</div>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
{preview.sample.length > 0 && (
|
|
226
|
+
<>
|
|
227
|
+
<p className="eyebrow mb-2 mt-5">Amostra</p>
|
|
228
|
+
<div className="flex flex-col gap-1.5">
|
|
229
|
+
{preview.sample.map((s) => (
|
|
230
|
+
<div key={s.id} className="panel p-2.5">
|
|
231
|
+
<p className="line-clamp-3 text-[11px] leading-snug text-text-dim">
|
|
232
|
+
{s.content}
|
|
233
|
+
</p>
|
|
234
|
+
<p className="mt-1 font-mono text-[9px] text-text-mute">
|
|
235
|
+
{s._scope} · {formatDateTime(s.created_at)}
|
|
236
|
+
</p>
|
|
237
|
+
</div>
|
|
238
|
+
))}
|
|
239
|
+
</div>
|
|
240
|
+
</>
|
|
241
|
+
)}
|
|
242
|
+
</>
|
|
243
|
+
)}
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
<div className="border-t border-border p-3">
|
|
247
|
+
{confirming && preview ? (
|
|
248
|
+
<div className="flex flex-col gap-2.5">
|
|
249
|
+
<div className="flex items-start gap-2 text-[12px] leading-snug text-text-dim">
|
|
250
|
+
<AlertTriangle size={15} className="mt-px shrink-0 text-magenta" />
|
|
251
|
+
<span>
|
|
252
|
+
Apagar {formatCount(preview.count)} memórias e os fatos ligados a elas.
|
|
253
|
+
Não dá pra desfazer.
|
|
254
|
+
</span>
|
|
255
|
+
</div>
|
|
256
|
+
<div className="flex gap-2">
|
|
257
|
+
<button
|
|
258
|
+
onClick={runDelete}
|
|
259
|
+
disabled={loading}
|
|
260
|
+
className="btn-danger flex-1 py-2 text-xs"
|
|
261
|
+
>
|
|
262
|
+
{loading ? 'Apagando…' : 'Apagar de vez'}
|
|
263
|
+
</button>
|
|
264
|
+
<button
|
|
265
|
+
onClick={() => setConfirming(false)}
|
|
266
|
+
className="btn-ghost px-4 py-2 text-xs text-text-dim"
|
|
267
|
+
>
|
|
268
|
+
Cancelar
|
|
269
|
+
</button>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
) : (
|
|
273
|
+
<div className="flex gap-2">
|
|
274
|
+
<button
|
|
275
|
+
onClick={runPreview}
|
|
276
|
+
disabled={!selected.length || loading}
|
|
277
|
+
className="btn-ghost flex-1 py-2 text-xs text-text-dim"
|
|
278
|
+
>
|
|
279
|
+
{loading ? 'Calculando…' : 'Pré-visualizar'}
|
|
280
|
+
</button>
|
|
281
|
+
<button
|
|
282
|
+
onClick={() => setConfirming(true)}
|
|
283
|
+
disabled={!preview || preview.count === 0 || loading}
|
|
284
|
+
className="btn-accent px-4 py-2 text-xs"
|
|
285
|
+
>
|
|
286
|
+
Apagar
|
|
287
|
+
</button>
|
|
288
|
+
</div>
|
|
289
|
+
)}
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
)
|
|
294
|
+
}
|