nlm-memory 0.5.0 → 0.5.2
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 +89 -34
- package/dist/cli/digest.d.ts +20 -0
- package/dist/cli/digest.js +142 -0
- package/dist/cli/digest.js.map +1 -0
- package/dist/cli/nlm.d.ts +1 -0
- package/dist/cli/nlm.js +25 -1
- package/dist/cli/nlm.js.map +1 -1
- package/dist/core/digest/compose.d.ts +38 -0
- package/dist/core/digest/compose.js +93 -0
- package/dist/core/digest/compose.js.map +1 -0
- package/dist/core/digest/hook-liveness.d.ts +32 -0
- package/dist/core/digest/hook-liveness.js +54 -0
- package/dist/core/digest/hook-liveness.js.map +1 -0
- package/dist/http/app.js +2 -1
- package/dist/http/app.js.map +1 -1
- package/dist/mcp/server.js +20 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/ui/assets/{index-C8cpwbYJ.css → index-Beo8psd-.css} +1 -1
- package/dist/ui/assets/{index-CB50QnL-.js → index-CSPTTeeM.js} +8 -8
- package/dist/ui/index.html +2 -2
- package/package.json +26 -1
- package/.agents/plugins/marketplace.json +0 -20
- package/.github/workflows/ci.yml +0 -30
- package/docs/methodology/re-derivation-rate.md +0 -112
- package/docs/methodology/useful-hit-rate.md +0 -79
- package/docs/plans/2026-05-20-fts5-lexical-recall.md +0 -1088
- package/docs/plans/2026-05-20-recall-daemon-wedge-fix.md +0 -662
- package/docs/plans/2026-05-20-recall-hook-design.md +0 -131
- package/docs/plans/2026-05-20-recall-hook-implementation.md +0 -1222
- package/docs/plans/desktop-product.md +0 -69
- package/docs/plans/factstore-design.md +0 -236
- package/logs/CHANGELOG/CHANGELOG-2026.md +0 -1575
- package/logs/CHANGELOG/CHANGELOG.md +0 -209
- package/migrations/000_initial_schema.sql +0 -174
- package/migrations/001_entity_type_rename.sql +0 -17
- package/migrations/002_adapter_state_extend.sql +0 -12
- package/migrations/003_session_embeddings.sql +0 -11
- package/migrations/004_facts.sql +0 -46
- package/migrations/005_sources.sql +0 -31
- package/migrations/006_providers.sql +0 -33
- package/migrations/007_source_tokens.sql +0 -17
- package/migrations/008_fts_rebuild.sql +0 -9
- package/migrations/009_session_embedding_chunks.sql +0 -46
- package/migrations/010_sources_opencode.sql +0 -30
- package/migrations/011_sources_hermes_agent.sql +0 -30
- package/migrations/012_sources_aider.sql +0 -30
- package/migrations/013_adapter_state_failure_count.sql +0 -12
- package/migrations/014_sources_cursor.sql +0 -30
- package/migrations/015_sources_windsurf.sql +0 -30
- package/plugin-hermes-agent/README.md +0 -49
- package/plugin-hermes-agent/__init__.py +0 -75
- package/plugin-hermes-agent/plugin.yaml +0 -15
- package/scripts/backfill-citations.mjs +0 -0
- package/scripts/build-codex-plugin.mjs +0 -61
- package/scripts/deepseek-probe.mjs +0 -67
- package/scripts/extract-triples.mjs +0 -207
- package/scripts/longmemeval/embedding-cache.ts +0 -77
- package/scripts/longmemeval/fetch-dataset.sh +0 -25
- package/scripts/longmemeval/run-harness.ts +0 -315
- package/scripts/longmemeval/scorer.ts +0 -99
- package/scripts/longmemeval/tsconfig.json +0 -9
- package/scripts/longmemeval/types.ts +0 -35
- package/scripts/nlm-daily-digest.py +0 -239
- package/scripts/nlm-daily-digest.sh +0 -28
- package/src/cli/classify-parity.ts +0 -257
- package/src/cli/launchctl-helpers.ts +0 -49
- package/src/cli/nlm.ts +0 -1078
- package/src/core/actions/actions-log.ts +0 -118
- package/src/core/actions/overlay.ts +0 -117
- package/src/core/adapters/aider.ts +0 -205
- package/src/core/adapters/claude-code.ts +0 -293
- package/src/core/adapters/common.ts +0 -54
- package/src/core/adapters/cursor.ts +0 -486
- package/src/core/adapters/from-source.ts +0 -67
- package/src/core/adapters/hermes-agent.ts +0 -240
- package/src/core/adapters/hermes.ts +0 -277
- package/src/core/adapters/jsonl-generic.ts +0 -208
- package/src/core/adapters/opencode.ts +0 -281
- package/src/core/adapters/pi.ts +0 -264
- package/src/core/adapters/windsurf.ts +0 -386
- package/src/core/classifier/prompt.ts +0 -200
- package/src/core/dataset/build-dataset.ts +0 -463
- package/src/core/embedding/chunk-body.ts +0 -76
- package/src/core/embedding/embed-backfill.ts +0 -210
- package/src/core/embedding/embed-normalize.ts +0 -135
- package/src/core/facts/backfill-facts.ts +0 -254
- package/src/core/facts/extract-facts.ts +0 -50
- package/src/core/hook/citation-detect.ts +0 -124
- package/src/core/hook/cite-memo.ts +0 -68
- package/src/core/hook/claude-settings.ts +0 -187
- package/src/core/hook/gate.ts +0 -25
- package/src/core/hook/hook-log.ts +0 -41
- package/src/core/hook/memo-sweep.ts +0 -164
- package/src/core/hook/memo.ts +0 -67
- package/src/core/hook/pointer-block.ts +0 -26
- package/src/core/hook/select.ts +0 -32
- package/src/core/hook/transcript.ts +0 -121
- package/src/core/ingest/ingest-session.ts +0 -111
- package/src/core/providers/provider-models.ts +0 -100
- package/src/core/providers/provider-registry.ts +0 -196
- package/src/core/recall/citation-log.ts +0 -108
- package/src/core/recall/filter.ts +0 -27
- package/src/core/recall/index.ts +0 -6
- package/src/core/recall/match-fields.ts +0 -40
- package/src/core/recall/query-log.ts +0 -149
- package/src/core/recall/query-shape.ts +0 -66
- package/src/core/recall/recall-service.ts +0 -320
- package/src/core/recall/recent-log.ts +0 -59
- package/src/core/recall/tokenize.ts +0 -18
- package/src/core/recall/useful-scan.ts +0 -336
- package/src/core/recall-facts/fact-query-log.ts +0 -150
- package/src/core/recall-facts/fact-recall-service.ts +0 -327
- package/src/core/scheduler/scan-once.ts +0 -142
- package/src/core/scheduler/scheduler.ts +0 -225
- package/src/core/sources/source-registry.ts +0 -278
- package/src/core/storage/db-restore.ts +0 -133
- package/src/core/storage/live-status.ts +0 -45
- package/src/core/storage/migrate.ts +0 -72
- package/src/core/storage/sqlite-fact-store.ts +0 -304
- package/src/core/storage/sqlite-session-store.ts +0 -810
- package/src/hook/hook-auth.ts +0 -18
- package/src/hook/prompt-recall-hook.ts +0 -180
- package/src/hook/session-end-hook.ts +0 -81
- package/src/hook/session-start-hook.ts +0 -168
- package/src/hook/stop-hook.ts +0 -239
- package/src/http/app.ts +0 -1215
- package/src/install/claude-code.ts +0 -128
- package/src/install/codex.ts +0 -367
- package/src/install/cursor.ts +0 -68
- package/src/install/hermes-agent.ts +0 -76
- package/src/install/hermes.ts +0 -78
- package/src/install/nlm-dir-perms.ts +0 -55
- package/src/install/ollama.ts +0 -284
- package/src/install/setup.ts +0 -489
- package/src/install/windsurf.ts +0 -68
- package/src/llm/classifier-box.ts +0 -64
- package/src/llm/deepseek-client.ts +0 -150
- package/src/llm/env-autoload.ts +0 -55
- package/src/llm/ollama-client.ts +0 -189
- package/src/mcp/server.ts +0 -534
- package/src/ports/fact-store.ts +0 -102
- package/src/ports/llm-client.ts +0 -52
- package/src/ports/logger.ts +0 -16
- package/src/ports/session-store.ts +0 -45
- package/src/ports/transcript-adapter.ts +0 -55
- package/src/shared/types.ts +0 -149
- package/src/ui/App.tsx +0 -58
- package/src/ui/components/PromoteOpenButton.tsx +0 -65
- package/src/ui/components/SessionDrawer.tsx +0 -199
- package/src/ui/components/SideNav.tsx +0 -162
- package/src/ui/components/Skeleton.tsx +0 -107
- package/src/ui/index.html +0 -13
- package/src/ui/lib/actions.ts +0 -30
- package/src/ui/lib/api.ts +0 -92
- package/src/ui/lib/dataset.ts +0 -141
- package/src/ui/lib/registries.ts +0 -155
- package/src/ui/lib/view-settings.ts +0 -41
- package/src/ui/main.tsx +0 -15
- package/src/ui/pages/Live.tsx +0 -229
- package/src/ui/pages/Pulse.tsx +0 -415
- package/src/ui/pages/Recall.tsx +0 -190
- package/src/ui/pages/River.tsx +0 -354
- package/src/ui/pages/Search.tsx +0 -386
- package/src/ui/pages/Stub.tsx +0 -9
- package/src/ui/pages/Thread.tsx +0 -473
- package/src/ui/pages/settings/Classifier.tsx +0 -227
- package/src/ui/pages/settings/Data.tsx +0 -190
- package/src/ui/pages/settings/Index.tsx +0 -65
- package/src/ui/pages/settings/Labels.tsx +0 -224
- package/src/ui/pages/settings/Providers.tsx +0 -305
- package/src/ui/pages/settings/SettingsSubnav.tsx +0 -28
- package/src/ui/pages/settings/Sources.tsx +0 -326
- package/src/ui/pages/settings/Views.tsx +0 -96
- package/src/ui/styles.css +0 -1890
- package/src/ui/tsconfig.json +0 -21
- package/src/ui/vite.config.ts +0 -19
- package/tests/fixtures/claude_code/short_session.jsonl +0 -2
- package/tests/fixtures/claude_code/standard_iso.jsonl +0 -4
- package/tests/fixtures/claude_code/tool_heavy.jsonl +0 -8
- package/tests/fixtures/claude_code/with_subagent.jsonl +0 -7
- package/tests/fixtures/facts.ts +0 -17
- package/tests/fixtures/golden-corpus.ts +0 -85
- package/tests/fixtures/hermes/paired_request_dump.json +0 -24
- package/tests/fixtures/hermes/paired_session.json +0 -23
- package/tests/fixtures/hermes/request_dump.json +0 -28
- package/tests/fixtures/hermes/session_iso.json +0 -38
- package/tests/fixtures/hermes/session_unix.json +0 -38
- package/tests/fixtures/hermes/system_only.json +0 -18
- package/tests/fixtures/pi/error-connection-abort.jsonl +0 -8
- package/tests/fixtures/pi/short-successful.jsonl +0 -5
- package/tests/fixtures/pi/with-custom-message.jsonl +0 -6
- package/tests/fixtures/sessions.ts +0 -22
- package/tests/integration/backfill-facts.test.ts +0 -362
- package/tests/integration/citation-explicit.test.ts +0 -111
- package/tests/integration/cite-event.test.ts +0 -169
- package/tests/integration/cite-memo.test.ts +0 -87
- package/tests/integration/db-restore.test.ts +0 -153
- package/tests/integration/embed-backfill.test.ts +0 -176
- package/tests/integration/fact-supersedence.test.ts +0 -313
- package/tests/integration/fts-index.test.ts +0 -60
- package/tests/integration/getbyids-sqlite.test.ts +0 -100
- package/tests/integration/hermes-agent-hooks.test.ts +0 -248
- package/tests/integration/hook-claude-settings.test.ts +0 -218
- package/tests/integration/hook-log.test.ts +0 -54
- package/tests/integration/hook-memo.test.ts +0 -68
- package/tests/integration/hook-pre-compact.test.ts +0 -105
- package/tests/integration/hook-subagent-start.test.ts +0 -102
- package/tests/integration/http.test.ts +0 -401
- package/tests/integration/keyword-search-fts.test.ts +0 -66
- package/tests/integration/mcp-recall-logging.test.ts +0 -88
- package/tests/integration/mcp.test.ts +0 -260
- package/tests/integration/memo-sweep.test.ts +0 -91
- package/tests/integration/prompt-recall-hook.test.ts +0 -88
- package/tests/integration/provider-registry.test.ts +0 -107
- package/tests/integration/recall-golden.test.ts +0 -59
- package/tests/integration/recall-sqlite.test.ts +0 -169
- package/tests/integration/scheduler.test.ts +0 -391
- package/tests/integration/session-end-hook.test.ts +0 -48
- package/tests/integration/session-start-hook.test.ts +0 -126
- package/tests/integration/source-registry.test.ts +0 -122
- package/tests/integration/sqlite-fact-store.test.ts +0 -346
- package/tests/integration/stop-hook.test.ts +0 -560
- package/tests/integration/wal-checkpoint.test.ts +0 -49
- package/tests/unit/cli/launchctl-helpers.test.ts +0 -60
- package/tests/unit/core/adapters/aider.test.ts +0 -230
- package/tests/unit/core/adapters/claude-code.test.ts +0 -118
- package/tests/unit/core/adapters/cursor.test.ts +0 -485
- package/tests/unit/core/adapters/hermes-agent.test.ts +0 -329
- package/tests/unit/core/adapters/hermes.test.ts +0 -81
- package/tests/unit/core/adapters/jsonl-generic.test.ts +0 -142
- package/tests/unit/core/adapters/opencode.test.ts +0 -354
- package/tests/unit/core/adapters/pi.test.ts +0 -110
- package/tests/unit/core/adapters/windsurf.test.ts +0 -416
- package/tests/unit/core/classifier/prompt.test.ts +0 -126
- package/tests/unit/core/embedding/chunk-body.test.ts +0 -100
- package/tests/unit/core/facts/extract-facts.test.ts +0 -117
- package/tests/unit/core/filter.test.ts +0 -40
- package/tests/unit/core/hook/citation-detect-cite-session.test.ts +0 -96
- package/tests/unit/core/hook/citation-detect.test.ts +0 -124
- package/tests/unit/core/hook/gate.test.ts +0 -29
- package/tests/unit/core/hook/pointer-block.test.ts +0 -22
- package/tests/unit/core/hook/select.test.ts +0 -66
- package/tests/unit/core/match-fields.test.ts +0 -39
- package/tests/unit/core/mcp-cite-session.test.ts +0 -51
- package/tests/unit/core/providers/provider-models.test.ts +0 -101
- package/tests/unit/core/query-shape.test.ts +0 -92
- package/tests/unit/core/recall-facts/fact-recall-service.test.ts +0 -258
- package/tests/unit/core/recall-service.test.ts +0 -200
- package/tests/unit/core/storage/live-status.test.ts +0 -54
- package/tests/unit/core/tokenize.test.ts +0 -32
- package/tests/unit/core/useful-scan.test.ts +0 -537
- package/tests/unit/llm/embed.test.ts +0 -93
- package/tests/unit/llm/ollama-client.test.ts +0 -124
- package/tests/unit/scripts/longmemeval-scorer.test.ts +0 -114
- package/tsconfig.json +0 -31
- package/tsconfig.test.json +0 -11
- package/vitest.config.ts +0 -22
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { NavLink } from "react-router-dom";
|
|
3
|
-
|
|
4
|
-
const STORAGE_KEY = "nlm.sidenav.collapsed";
|
|
5
|
-
|
|
6
|
-
interface NavItem {
|
|
7
|
-
to: string;
|
|
8
|
-
label: string;
|
|
9
|
-
icon: JSX.Element;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const NAV_ITEMS: NavItem[] = [
|
|
13
|
-
{ to: "/live", label: "Live", icon: liveIcon() },
|
|
14
|
-
{ to: "/pulse", label: "Pulse", icon: pulseIcon() },
|
|
15
|
-
{ to: "/river", label: "River", icon: riverIcon() },
|
|
16
|
-
{ to: "/thread", label: "Thread", icon: threadIcon() },
|
|
17
|
-
{ to: "/search", label: "Search", icon: searchIcon() },
|
|
18
|
-
{ to: "/recall", label: "Recall", icon: recallIcon() },
|
|
19
|
-
{ to: "/settings", label: "Settings", icon: settingsIcon() },
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
export function SideNav() {
|
|
23
|
-
const [collapsed, setCollapsed] = useState<boolean>(() => {
|
|
24
|
-
if (typeof window === "undefined") return false;
|
|
25
|
-
return window.localStorage.getItem(STORAGE_KEY) === "1";
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
document.body.style.setProperty("--sidenav-w", collapsed ? "52px" : "180px");
|
|
30
|
-
window.localStorage.setItem(STORAGE_KEY, collapsed ? "1" : "0");
|
|
31
|
-
}, [collapsed]);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<nav className={`sidenav${collapsed ? " collapsed" : ""}`} aria-label="Primary navigation">
|
|
35
|
-
<div className="sidenav-header">
|
|
36
|
-
<span className="sidenav-wordmark">NLM</span>
|
|
37
|
-
<button
|
|
38
|
-
className="sidenav-toggle"
|
|
39
|
-
aria-label="Toggle sidebar"
|
|
40
|
-
onClick={() => setCollapsed((c) => !c)}
|
|
41
|
-
>
|
|
42
|
-
{collapsed ? chevronRight() : chevronLeft()}
|
|
43
|
-
</button>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
<div className="sidenav-items">
|
|
47
|
-
{NAV_ITEMS.map((item) => (
|
|
48
|
-
<NavLink
|
|
49
|
-
key={item.to}
|
|
50
|
-
to={item.to}
|
|
51
|
-
className={({ isActive }) => `sidenav-item${isActive ? " active" : ""}`}
|
|
52
|
-
data-label={item.label}
|
|
53
|
-
>
|
|
54
|
-
<span className="item-icon">{item.icon}</span>
|
|
55
|
-
<span className="item-label">{item.label}</span>
|
|
56
|
-
</NavLink>
|
|
57
|
-
))}
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<div className="sidenav-footer">
|
|
61
|
-
<NavLink to="/settings/data" className="sidenav-item sidenav-data" data-label="Data">
|
|
62
|
-
<span className="item-icon">{dataIcon()}</span>
|
|
63
|
-
<span className="item-label">Data</span>
|
|
64
|
-
</NavLink>
|
|
65
|
-
</div>
|
|
66
|
-
</nav>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// ── icons — extracted verbatim from Astro SideNav for visual parity ──────
|
|
71
|
-
|
|
72
|
-
function svg(children: JSX.Element, size = 16) {
|
|
73
|
-
return (
|
|
74
|
-
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round">
|
|
75
|
-
{children}
|
|
76
|
-
</svg>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function liveIcon() {
|
|
81
|
-
// green-dot broadcast — distinct from pulse so /live reads as its own thing
|
|
82
|
-
return svg(
|
|
83
|
-
<>
|
|
84
|
-
<circle cx="12" cy="12" r="3" />
|
|
85
|
-
<path d="M19 12a7 7 0 00-14 0M22 12a10 10 0 00-20 0" />
|
|
86
|
-
</>,
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function pulseIcon() {
|
|
91
|
-
return svg(<polyline points="22 12 18 12 15 21 9 3 6 12 2 12" />);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function riverIcon() {
|
|
95
|
-
return svg(<path d="M2 12c1.5-3 3-4.5 4.5-4.5S9 9 10.5 12s3 4.5 4.5 4.5S18 15 19.5 12 21 7.5 22 7.5" />);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function threadIcon() {
|
|
99
|
-
return svg(
|
|
100
|
-
<>
|
|
101
|
-
<line x1="6" y1="3" x2="6" y2="15" />
|
|
102
|
-
<circle cx="18" cy="6" r="3" />
|
|
103
|
-
<circle cx="6" cy="18" r="3" />
|
|
104
|
-
<path d="M18 9a9 9 0 01-9 9" />
|
|
105
|
-
</>,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function searchIcon() {
|
|
110
|
-
return svg(
|
|
111
|
-
<>
|
|
112
|
-
<circle cx="11" cy="11" r="8" />
|
|
113
|
-
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
114
|
-
</>,
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function recallIcon() {
|
|
119
|
-
// bar-chart — observability / adoption telemetry
|
|
120
|
-
return svg(
|
|
121
|
-
<>
|
|
122
|
-
<line x1="6" y1="20" x2="6" y2="13" />
|
|
123
|
-
<line x1="12" y1="20" x2="12" y2="4" />
|
|
124
|
-
<line x1="18" y1="20" x2="18" y2="9" />
|
|
125
|
-
</>,
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function settingsIcon() {
|
|
130
|
-
return svg(
|
|
131
|
-
<>
|
|
132
|
-
<path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
|
|
133
|
-
<circle cx="12" cy="12" r="3" />
|
|
134
|
-
</>,
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function dataIcon() {
|
|
139
|
-
return (
|
|
140
|
-
<svg width={14} height={14} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round">
|
|
141
|
-
<ellipse cx="12" cy="5" rx="9" ry="3" />
|
|
142
|
-
<path d="M21 12c0 1.657-4.03 3-9 3S3 13.657 3 12" />
|
|
143
|
-
<path d="M3 5v14c0 1.657 4.03 3 9 3s9-1.343 9-3V5" />
|
|
144
|
-
</svg>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function chevronLeft() {
|
|
149
|
-
return (
|
|
150
|
-
<svg width={14} height={14} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
|
|
151
|
-
<polyline points="15 18 9 12 15 6" />
|
|
152
|
-
</svg>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function chevronRight() {
|
|
157
|
-
return (
|
|
158
|
-
<svg width={14} height={14} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
|
|
159
|
-
<polyline points="9 18 15 12 9 6" />
|
|
160
|
-
</svg>
|
|
161
|
-
);
|
|
162
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skeleton — shape-matched placeholders for first-load states.
|
|
3
|
-
*
|
|
4
|
-
* Only used where the shape is known + the data fetch is slow enough that
|
|
5
|
-
* the page reflowing from "Loading…" to populated is jarring. Cached
|
|
6
|
-
* refetches reuse stale data; they never show a skeleton.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export function Skeleton({
|
|
10
|
-
w,
|
|
11
|
-
h = 12,
|
|
12
|
-
radius = 4,
|
|
13
|
-
className,
|
|
14
|
-
}: {
|
|
15
|
-
w?: number | string;
|
|
16
|
-
h?: number | string;
|
|
17
|
-
radius?: number;
|
|
18
|
-
className?: string;
|
|
19
|
-
}) {
|
|
20
|
-
const style: React.CSSProperties = {
|
|
21
|
-
width: typeof w === "number" ? `${w}px` : w ?? "100%",
|
|
22
|
-
height: typeof h === "number" ? `${h}px` : h,
|
|
23
|
-
borderRadius: radius,
|
|
24
|
-
};
|
|
25
|
-
return <span className={`skeleton${className ? ` ${className}` : ""}`} style={style} aria-hidden="true" />;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function PulseSkeleton() {
|
|
29
|
-
return (
|
|
30
|
-
<div className="page-pad">
|
|
31
|
-
<div className="kpi-row">
|
|
32
|
-
{Array.from({ length: 4 }).map((_, i) => (
|
|
33
|
-
<div key={i} className="kpi">
|
|
34
|
-
<Skeleton h={10} w={70} />
|
|
35
|
-
<Skeleton h={28} w={90} />
|
|
36
|
-
<Skeleton h={10} w={60} />
|
|
37
|
-
</div>
|
|
38
|
-
))}
|
|
39
|
-
<div className="kpi"><Skeleton h={56} /></div>
|
|
40
|
-
</div>
|
|
41
|
-
<div className="pulse-grid">
|
|
42
|
-
{Array.from({ length: 4 }).map((_, i) => (
|
|
43
|
-
<section key={i} className="card">
|
|
44
|
-
<header className="card-head"><Skeleton h={14} w={140} /></header>
|
|
45
|
-
<div style={{ display: "flex", flexDirection: "column", gap: 10, padding: "12px 0" }}>
|
|
46
|
-
{Array.from({ length: 5 }).map((__, j) => (
|
|
47
|
-
<Skeleton key={j} h={12} w={`${65 + ((j * 7) % 30)}%`} />
|
|
48
|
-
))}
|
|
49
|
-
</div>
|
|
50
|
-
</section>
|
|
51
|
-
))}
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function SessionListSkeleton({ rows = 6 }: { rows?: number }) {
|
|
58
|
-
return (
|
|
59
|
-
<ul className="session-list">
|
|
60
|
-
{Array.from({ length: rows }).map((_, i) => (
|
|
61
|
-
<li key={i} className="session-row session-row-detail">
|
|
62
|
-
<Skeleton h={18} w={56} radius={10} />
|
|
63
|
-
<div className="session-row-main">
|
|
64
|
-
<Skeleton h={13} w={`${50 + ((i * 11) % 35)}%`} />
|
|
65
|
-
<Skeleton h={11} w={`${30 + ((i * 13) % 50)}%`} />
|
|
66
|
-
</div>
|
|
67
|
-
<Skeleton h={10} w={48} />
|
|
68
|
-
</li>
|
|
69
|
-
))}
|
|
70
|
-
</ul>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function TableRowSkeleton({ rows = 8, cols = 6 }: { rows?: number; cols?: number }) {
|
|
75
|
-
return (
|
|
76
|
-
<tbody>
|
|
77
|
-
{Array.from({ length: rows }).map((_, i) => (
|
|
78
|
-
<tr key={i}>
|
|
79
|
-
{Array.from({ length: cols }).map((__, j) => (
|
|
80
|
-
<td key={j}><Skeleton h={12} w={j === 0 ? "70%" : j === cols - 1 ? "60%" : "50%"} /></td>
|
|
81
|
-
))}
|
|
82
|
-
</tr>
|
|
83
|
-
))}
|
|
84
|
-
</tbody>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function SessionDrawerSkeleton() {
|
|
89
|
-
return (
|
|
90
|
-
<div className="drawer-body">
|
|
91
|
-
<dl className="kv-list">
|
|
92
|
-
{Array.from({ length: 5 }).map((_, i) => (
|
|
93
|
-
<div key={i} style={{ display: "contents" }}>
|
|
94
|
-
<dt className="kv-label"><Skeleton h={10} w={70} /></dt>
|
|
95
|
-
<dd className="kv-value"><Skeleton h={12} w={`${40 + ((i * 13) % 50)}%`} /></dd>
|
|
96
|
-
</div>
|
|
97
|
-
))}
|
|
98
|
-
</dl>
|
|
99
|
-
<h4 className="drawer-section"><Skeleton h={12} w={100} /></h4>
|
|
100
|
-
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
|
101
|
-
{Array.from({ length: 4 }).map((_, i) => (
|
|
102
|
-
<Skeleton key={i} h={12} w={`${55 + ((i * 7) % 35)}%`} />
|
|
103
|
-
))}
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
}
|
package/src/ui/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>nlm memory</title>
|
|
7
|
-
<link rel="stylesheet" href="./styles.css" />
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="./main.tsx"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/src/ui/lib/actions.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action client. POSTs to /api/action; callers refetch the dataset to see
|
|
3
|
-
* the overlay re-applied. Returns the new action id so callers can stash
|
|
4
|
-
* it for undo.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface ActionPayload {
|
|
8
|
-
kind: string;
|
|
9
|
-
subject_type: string;
|
|
10
|
-
subject_id: string;
|
|
11
|
-
payload?: Record<string, unknown>;
|
|
12
|
-
actor?: string;
|
|
13
|
-
runtime?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function postAction(input: ActionPayload): Promise<string> {
|
|
17
|
-
const res = await fetch("/api/action", {
|
|
18
|
-
method: "POST",
|
|
19
|
-
headers: { "Content-Type": "application/json" },
|
|
20
|
-
body: JSON.stringify({ ...input, runtime: input.runtime ?? "web-ui" }),
|
|
21
|
-
});
|
|
22
|
-
if (!res.ok) throw new Error(`POST /api/action → ${res.status}`);
|
|
23
|
-
const data = (await res.json()) as { id: string };
|
|
24
|
-
return data.id;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export async function undoAction(actionId: string): Promise<void> {
|
|
28
|
-
const res = await fetch(`/api/action/${encodeURIComponent(actionId)}/undo`, { method: "POST" });
|
|
29
|
-
if (!res.ok) throw new Error(`undo → ${res.status}`);
|
|
30
|
-
}
|
package/src/ui/lib/api.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
export interface RecentRead {
|
|
4
|
-
ts: string;
|
|
5
|
-
source: string;
|
|
6
|
-
query: string | null;
|
|
7
|
-
mode: string;
|
|
8
|
-
nResults: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface RecentWrite {
|
|
12
|
-
id: string;
|
|
13
|
-
runtime: string;
|
|
14
|
-
label: string;
|
|
15
|
-
summary: string;
|
|
16
|
-
createdAt: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface RecentMarker {
|
|
20
|
-
sessionId: string;
|
|
21
|
-
kind: "decision" | "open";
|
|
22
|
-
text: string;
|
|
23
|
-
label: string;
|
|
24
|
-
createdAt: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function fetchJson<T>(path: string): Promise<T> {
|
|
28
|
-
const res = await fetch(path);
|
|
29
|
-
if (!res.ok) throw new Error(`${path} → ${res.status}`);
|
|
30
|
-
return res.json() as Promise<T>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface PolledResult<T> {
|
|
34
|
-
/** Most recent successful payload, or `initial` until the first fetch lands. */
|
|
35
|
-
data: T;
|
|
36
|
-
/** Message from the latest failed tick; cleared on the next success. */
|
|
37
|
-
error: string | null;
|
|
38
|
-
/** Epoch ms of the last successful fetch, or null before the first. */
|
|
39
|
-
lastUpdated: number | null;
|
|
40
|
-
/** True until the first tick resolves (success or failure). */
|
|
41
|
-
loading: boolean;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function usePolledEndpoint<T>(path: string, intervalMs: number, initial: T): PolledResult<T> {
|
|
45
|
-
const [state, setState] = useState<PolledResult<T>>({
|
|
46
|
-
data: initial,
|
|
47
|
-
error: null,
|
|
48
|
-
lastUpdated: null,
|
|
49
|
-
loading: true,
|
|
50
|
-
});
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
let cancelled = false;
|
|
53
|
-
const tick = async () => {
|
|
54
|
-
try {
|
|
55
|
-
const next = await fetchJson<T>(path);
|
|
56
|
-
if (!cancelled) {
|
|
57
|
-
setState({ data: next, error: null, lastUpdated: Date.now(), loading: false });
|
|
58
|
-
}
|
|
59
|
-
} catch (e) {
|
|
60
|
-
// Keep prior data on transient failure; surface the error so the
|
|
61
|
-
// UI can flag staleness. The next tick retries.
|
|
62
|
-
if (!cancelled) {
|
|
63
|
-
setState((prev) => ({
|
|
64
|
-
...prev,
|
|
65
|
-
error: e instanceof Error ? e.message : String(e),
|
|
66
|
-
loading: false,
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
void tick();
|
|
72
|
-
const id = setInterval(tick, intervalMs);
|
|
73
|
-
return () => {
|
|
74
|
-
cancelled = true;
|
|
75
|
-
clearInterval(id);
|
|
76
|
-
};
|
|
77
|
-
}, [path, intervalMs]);
|
|
78
|
-
return state;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function relativeTime(iso: string): string {
|
|
82
|
-
if (!iso) return "";
|
|
83
|
-
const t = Date.parse(iso);
|
|
84
|
-
if (!Number.isFinite(t)) return "";
|
|
85
|
-
const s = Math.max(0, Math.floor((Date.now() - t) / 1000));
|
|
86
|
-
if (s < 60) return `${s}s ago`;
|
|
87
|
-
const m = Math.floor(s / 60);
|
|
88
|
-
if (m < 60) return `${m}m ago`;
|
|
89
|
-
const h = Math.floor(m / 60);
|
|
90
|
-
if (h < 24) return `${h}h ago`;
|
|
91
|
-
return `${Math.floor(h / 24)}d ago`;
|
|
92
|
-
}
|
package/src/ui/lib/dataset.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dataset hook + types. /api/dataset is the single read backbone for pulse,
|
|
3
|
-
* river, search, and thread. Fetched once on mount; pages compose against
|
|
4
|
-
* the cached result. Optional polling for live refresh.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
8
|
-
|
|
9
|
-
export interface DatasetSession {
|
|
10
|
-
id: string;
|
|
11
|
-
date: string;
|
|
12
|
-
started_at: string | null;
|
|
13
|
-
ended_at: string | null;
|
|
14
|
-
label: string;
|
|
15
|
-
summary: string;
|
|
16
|
-
entities: string[];
|
|
17
|
-
decisions: string[];
|
|
18
|
-
open: string[];
|
|
19
|
-
open_questions: { id: string; text: string; resolved: boolean }[];
|
|
20
|
-
status: "active" | "idle" | "closed" | "superseded";
|
|
21
|
-
duration_min: number;
|
|
22
|
-
runtime: string;
|
|
23
|
-
supersedes?: string;
|
|
24
|
-
superseded_by?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface DatasetEntity {
|
|
28
|
-
canonical: string;
|
|
29
|
-
type: string;
|
|
30
|
-
status: string;
|
|
31
|
-
session_count: number;
|
|
32
|
-
last_seen_session: string | null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface DatasetAlert {
|
|
36
|
-
id: string;
|
|
37
|
-
type: "stale";
|
|
38
|
-
severity: "high" | "medium";
|
|
39
|
-
entity: string;
|
|
40
|
-
summary: string;
|
|
41
|
-
sessions: string[];
|
|
42
|
-
age_days: number;
|
|
43
|
-
last_touch_at: string | null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface Dataset {
|
|
47
|
-
meta: {
|
|
48
|
-
last_sync: string;
|
|
49
|
-
sessions_total: number;
|
|
50
|
-
entities_total: number;
|
|
51
|
-
db_present: boolean;
|
|
52
|
-
db_path: string;
|
|
53
|
-
};
|
|
54
|
-
sessions: DatasetSession[];
|
|
55
|
-
entities: DatasetEntity[];
|
|
56
|
-
entity_colors: Record<string, string>;
|
|
57
|
-
entity_type: Record<string, string>;
|
|
58
|
-
entity_status: Record<string, string>;
|
|
59
|
-
metrics: {
|
|
60
|
-
this_week: number;
|
|
61
|
-
last_week: number;
|
|
62
|
-
sparkline: number[];
|
|
63
|
-
healthy: number;
|
|
64
|
-
sparse: number;
|
|
65
|
-
stale: number;
|
|
66
|
-
closed_decisions: number;
|
|
67
|
-
};
|
|
68
|
-
alerts: DatasetAlert[];
|
|
69
|
-
runtimes: DatasetRuntime[];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface DatasetRuntime {
|
|
73
|
-
name: string;
|
|
74
|
-
status: "active" | "idle" | "dormant";
|
|
75
|
-
sessions_total: number;
|
|
76
|
-
this_week: number;
|
|
77
|
-
last_week: number;
|
|
78
|
-
last_session_at: string | null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface DatasetState {
|
|
82
|
-
data: Dataset | null;
|
|
83
|
-
loading: boolean;
|
|
84
|
-
error: string | null;
|
|
85
|
-
refetch: () => Promise<void>;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
interface DatasetInternal {
|
|
89
|
-
data: Dataset | null;
|
|
90
|
-
loading: boolean;
|
|
91
|
-
error: string | null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export function useDataset(pollMs?: number): DatasetState {
|
|
95
|
-
const [state, setState] = useState<DatasetInternal>({ data: null, loading: true, error: null });
|
|
96
|
-
const cancelledRef = useRef(false);
|
|
97
|
-
|
|
98
|
-
const load = useCallback(async () => {
|
|
99
|
-
try {
|
|
100
|
-
const res = await fetch("/api/dataset");
|
|
101
|
-
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
102
|
-
const data = (await res.json()) as Dataset;
|
|
103
|
-
if (!cancelledRef.current) setState({ data, loading: false, error: null });
|
|
104
|
-
} catch (e) {
|
|
105
|
-
if (!cancelledRef.current) {
|
|
106
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
107
|
-
setState((prev) => ({ data: prev.data, loading: false, error: msg }));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}, []);
|
|
111
|
-
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
cancelledRef.current = false;
|
|
114
|
-
void load();
|
|
115
|
-
if (pollMs && pollMs > 0) {
|
|
116
|
-
const id = setInterval(load, pollMs);
|
|
117
|
-
return () => {
|
|
118
|
-
cancelledRef.current = true;
|
|
119
|
-
clearInterval(id);
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
return () => {
|
|
123
|
-
cancelledRef.current = true;
|
|
124
|
-
};
|
|
125
|
-
}, [pollMs, load]);
|
|
126
|
-
|
|
127
|
-
return { ...state, refetch: load };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function relativeAge(iso: string | null | undefined): string {
|
|
131
|
-
if (!iso) return "—";
|
|
132
|
-
const t = Date.parse(iso);
|
|
133
|
-
if (!Number.isFinite(t)) return "—";
|
|
134
|
-
const days = Math.floor((Date.now() - t) / 86_400_000);
|
|
135
|
-
if (days <= 0) return "today";
|
|
136
|
-
if (days === 1) return "1d";
|
|
137
|
-
if (days < 30) return `${days}d`;
|
|
138
|
-
const months = Math.floor(days / 30);
|
|
139
|
-
if (months < 12) return `${months}mo`;
|
|
140
|
-
return `${Math.floor(days / 365)}y`;
|
|
141
|
-
}
|
package/src/ui/lib/registries.ts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared types + tiny helpers for the sources and providers registries.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors the daemon contracts in src/core/sources/source-registry.ts and
|
|
5
|
-
* src/core/providers/provider-registry.ts. HTTP responses always carry
|
|
6
|
-
* redacted rows (no api_key, no source token) except the one-time reveal
|
|
7
|
-
* on insert/regenerate.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export type SourceKind = "claude-code" | "hermes" | "pi" | "jsonl-generic" | "webhook";
|
|
11
|
-
|
|
12
|
-
export interface SourceRow {
|
|
13
|
-
id: number;
|
|
14
|
-
kind: SourceKind;
|
|
15
|
-
name: string;
|
|
16
|
-
pathOrUrl: string | null;
|
|
17
|
-
runtimeLabel: string;
|
|
18
|
-
parseConfig: Record<string, unknown>;
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
token: string | null;
|
|
21
|
-
hasToken: boolean;
|
|
22
|
-
createdAt: string;
|
|
23
|
-
updatedAt: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type ProviderKind =
|
|
27
|
-
| "deepseek"
|
|
28
|
-
| "ollama"
|
|
29
|
-
| "openai"
|
|
30
|
-
| "anthropic"
|
|
31
|
-
| "openrouter"
|
|
32
|
-
| "openai-compatible";
|
|
33
|
-
|
|
34
|
-
export interface ProviderRow {
|
|
35
|
-
id: number;
|
|
36
|
-
kind: ProviderKind;
|
|
37
|
-
name: string;
|
|
38
|
-
baseUrl: string | null;
|
|
39
|
-
apiKey: string | null;
|
|
40
|
-
hasApiKey: boolean;
|
|
41
|
-
defaultModel: string | null;
|
|
42
|
-
enabled: boolean;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
updatedAt: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const SOURCE_KINDS: ReadonlyArray<SourceKind> = [
|
|
48
|
-
"claude-code", "hermes", "pi", "jsonl-generic", "webhook",
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
export const PROVIDER_KINDS: ReadonlyArray<ProviderKind> = [
|
|
52
|
-
"deepseek", "ollama", "openai", "anthropic", "openrouter", "openai-compatible",
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
export const PROVIDER_KIND_LABEL: Record<ProviderKind, string> = {
|
|
56
|
-
deepseek: "DeepSeek",
|
|
57
|
-
ollama: "Ollama",
|
|
58
|
-
openai: "OpenAI",
|
|
59
|
-
anthropic: "Anthropic",
|
|
60
|
-
openrouter: "OpenRouter",
|
|
61
|
-
"openai-compatible": "OpenAI-compatible",
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const SOURCE_KIND_LABEL: Record<SourceKind, string> = {
|
|
65
|
-
"claude-code": "Claude Code",
|
|
66
|
-
hermes: "Hermes",
|
|
67
|
-
pi: "pi.dev",
|
|
68
|
-
"jsonl-generic": "Custom JSONL",
|
|
69
|
-
webhook: "Webhook",
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/** Defaults the "Add source" wizard offers per kind. The user can edit. */
|
|
73
|
-
export const SOURCE_PRESETS: Record<
|
|
74
|
-
SourceKind,
|
|
75
|
-
{ name: string; runtimeLabel: string; pathOrUrl: string | null; parseConfig: Record<string, unknown> }
|
|
76
|
-
> = {
|
|
77
|
-
"claude-code": {
|
|
78
|
-
name: "Claude Code",
|
|
79
|
-
runtimeLabel: "claude-code",
|
|
80
|
-
pathOrUrl: "~/.claude/projects",
|
|
81
|
-
parseConfig: {},
|
|
82
|
-
},
|
|
83
|
-
hermes: {
|
|
84
|
-
name: "Hermes",
|
|
85
|
-
runtimeLabel: "hermes",
|
|
86
|
-
pathOrUrl: "~/.hermes/sessions",
|
|
87
|
-
parseConfig: {},
|
|
88
|
-
},
|
|
89
|
-
pi: {
|
|
90
|
-
name: "pi.dev",
|
|
91
|
-
runtimeLabel: "pi",
|
|
92
|
-
pathOrUrl: "~/.pi/transcripts",
|
|
93
|
-
parseConfig: {},
|
|
94
|
-
},
|
|
95
|
-
"jsonl-generic": {
|
|
96
|
-
name: "",
|
|
97
|
-
runtimeLabel: "",
|
|
98
|
-
pathOrUrl: "",
|
|
99
|
-
parseConfig: {
|
|
100
|
-
idField: "session_id",
|
|
101
|
-
textField: "text",
|
|
102
|
-
startedAtField: "started_at",
|
|
103
|
-
endedAtField: "ended_at",
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
webhook: {
|
|
107
|
-
name: "",
|
|
108
|
-
runtimeLabel: "",
|
|
109
|
-
pathOrUrl: null,
|
|
110
|
-
parseConfig: {},
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const PROVIDER_PRESETS: Record<ProviderKind, { baseUrl: string | null; defaultModel: string | null }> = {
|
|
115
|
-
deepseek: { baseUrl: "https://api.deepseek.com", defaultModel: "deepseek-v4-flash" },
|
|
116
|
-
ollama: { baseUrl: "http://localhost:11434", defaultModel: "phi4-mini:latest" },
|
|
117
|
-
openai: { baseUrl: "https://api.openai.com/v1", defaultModel: "gpt-4o-mini" },
|
|
118
|
-
anthropic: { baseUrl: "https://api.anthropic.com", defaultModel: "claude-haiku-4-5-20251001" },
|
|
119
|
-
openrouter: { baseUrl: "https://openrouter.ai/api/v1", defaultModel: "anthropic/claude-haiku-4-5" },
|
|
120
|
-
"openai-compatible": { baseUrl: "", defaultModel: null },
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export async function fetchSources(): Promise<SourceRow[]> {
|
|
124
|
-
const r = await fetch("/api/sources");
|
|
125
|
-
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
126
|
-
const data = (await r.json()) as { sources: SourceRow[] };
|
|
127
|
-
return data.sources;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export async function fetchProviders(): Promise<ProviderRow[]> {
|
|
131
|
-
const r = await fetch("/api/providers");
|
|
132
|
-
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
133
|
-
const data = (await r.json()) as { providers: ProviderRow[] };
|
|
134
|
-
return data.providers;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export async function fetchProviderModels(id: number): Promise<string[]> {
|
|
138
|
-
const r = await fetch(`/api/providers/${id}/models`);
|
|
139
|
-
const data = (await r.json()) as { models?: string[]; error?: string };
|
|
140
|
-
if (!r.ok || data.error) throw new Error(data.error ?? `HTTP ${r.status}`);
|
|
141
|
-
return data.models ?? [];
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface TestResult {
|
|
145
|
-
ok: boolean;
|
|
146
|
-
modelCount?: number;
|
|
147
|
-
latencyMs: number;
|
|
148
|
-
error?: string;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export async function testProvider(id: number): Promise<TestResult> {
|
|
152
|
-
const r = await fetch(`/api/providers/${id}/test`, { method: "POST" });
|
|
153
|
-
const data = (await r.json()) as TestResult;
|
|
154
|
-
return data;
|
|
155
|
-
}
|