@4da/mcp-server 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +160 -85
- package/dist/auth.d.ts +36 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +82 -0
- package/dist/auth.js.map +1 -0
- package/dist/db.d.ts +73 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +607 -4
- package/dist/db.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +33 -7
- package/dist/doctor.js.map +1 -1
- package/dist/http-transport.d.ts.map +1 -1
- package/dist/http-transport.js +19 -2
- package/dist/http-transport.js.map +1 -1
- package/dist/index.d.ts +15 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +150 -325
- package/dist/index.js.map +1 -1
- package/dist/live/cache.d.ts +16 -0
- package/dist/live/cache.d.ts.map +1 -0
- package/dist/live/cache.js +61 -0
- package/dist/live/cache.js.map +1 -0
- package/dist/live/hn-fetcher.d.ts +19 -0
- package/dist/live/hn-fetcher.d.ts.map +1 -0
- package/dist/live/hn-fetcher.js +123 -0
- package/dist/live/hn-fetcher.js.map +1 -0
- package/dist/live/index.d.ts +55 -0
- package/dist/live/index.d.ts.map +1 -0
- package/dist/live/index.js +131 -0
- package/dist/live/index.js.map +1 -0
- package/dist/live/osv-scanner.d.ts +19 -0
- package/dist/live/osv-scanner.d.ts.map +1 -0
- package/dist/live/osv-scanner.js +197 -0
- package/dist/live/osv-scanner.js.map +1 -0
- package/dist/live/rate-limiter.d.ts +19 -0
- package/dist/live/rate-limiter.d.ts.map +1 -0
- package/dist/live/rate-limiter.js +52 -0
- package/dist/live/rate-limiter.js.map +1 -0
- package/dist/live/types.d.ts +89 -0
- package/dist/live/types.d.ts.map +1 -0
- package/dist/live/types.js +3 -0
- package/dist/live/types.js.map +1 -0
- package/dist/live/version-resolver.d.ts +11 -0
- package/dist/live/version-resolver.d.ts.map +1 -0
- package/dist/live/version-resolver.js +321 -0
- package/dist/live/version-resolver.js.map +1 -0
- package/dist/live-singleton.d.ts +9 -0
- package/dist/live-singleton.d.ts.map +1 -0
- package/dist/live-singleton.js +14 -0
- package/dist/live-singleton.js.map +1 -0
- package/dist/llm.d.ts.map +1 -1
- package/dist/llm.js +3 -2
- package/dist/llm.js.map +1 -1
- package/dist/output-manager.d.ts.map +1 -1
- package/dist/output-manager.js +1 -0
- package/dist/output-manager.js.map +1 -1
- package/dist/project-scanner.d.ts +27 -0
- package/dist/project-scanner.d.ts.map +1 -0
- package/dist/project-scanner.js +366 -0
- package/dist/project-scanner.js.map +1 -0
- package/dist/schema-registry.d.ts +31 -13
- package/dist/schema-registry.d.ts.map +1 -1
- package/dist/schema-registry.js +164 -32
- package/dist/schema-registry.js.map +1 -1
- package/dist/schemas/agent-feedback-stats.json +14 -0
- package/dist/schemas/preemption-feed.json +18 -0
- package/dist/schemas/record-agent-feedback.json +28 -0
- package/dist/schemas/trust-summary.json +13 -0
- package/dist/schemas/vulnerability-scan.json +26 -0
- package/dist/schemas/what-should-i-know.json +19 -0
- package/dist/setup.d.ts +2 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +38 -4
- package/dist/setup.js.map +1 -1
- package/dist/tool-dispatch.d.ts +33 -0
- package/dist/tool-dispatch.d.ts.map +1 -0
- package/dist/tool-dispatch.js +87 -0
- package/dist/tool-dispatch.js.map +1 -0
- package/dist/tools/agent-feedback-stats.d.ts +30 -0
- package/dist/tools/agent-feedback-stats.d.ts.map +1 -0
- package/dist/tools/agent-feedback-stats.js +41 -0
- package/dist/tools/agent-feedback-stats.js.map +1 -0
- package/dist/tools/agent-memory.d.ts.map +1 -1
- package/dist/tools/agent-memory.js +33 -0
- package/dist/tools/agent-memory.js.map +1 -1
- package/dist/tools/agent-session-brief.d.ts.map +1 -1
- package/dist/tools/agent-session-brief.js +1 -0
- package/dist/tools/agent-session-brief.js.map +1 -1
- package/dist/tools/attention-report.d.ts.map +1 -1
- package/dist/tools/attention-report.js +1 -0
- package/dist/tools/attention-report.js.map +1 -1
- package/dist/tools/autophagy-status.d.ts.map +1 -1
- package/dist/tools/autophagy-status.js.map +1 -1
- package/dist/tools/compound-advantage.d.ts +3 -0
- package/dist/tools/compound-advantage.d.ts.map +1 -1
- package/dist/tools/compound-advantage.js +67 -10
- package/dist/tools/compound-advantage.js.map +1 -1
- package/dist/tools/config-validator.d.ts.map +1 -1
- package/dist/tools/config-validator.js +31 -0
- package/dist/tools/config-validator.js.map +1 -1
- package/dist/tools/context-analysis.d.ts.map +1 -1
- package/dist/tools/context-analysis.js +1 -0
- package/dist/tools/context-analysis.js.map +1 -1
- package/dist/tools/daily-briefing.d.ts.map +1 -1
- package/dist/tools/daily-briefing.js +17 -1
- package/dist/tools/daily-briefing.js.map +1 -1
- package/dist/tools/decision-enforcement.d.ts.map +1 -1
- package/dist/tools/decision-enforcement.js +1 -0
- package/dist/tools/decision-enforcement.js.map +1 -1
- package/dist/tools/decision-memory.d.ts +2 -0
- package/dist/tools/decision-memory.d.ts.map +1 -1
- package/dist/tools/decision-memory.js +80 -0
- package/dist/tools/decision-memory.js.map +1 -1
- package/dist/tools/decision-windows.d.ts.map +1 -1
- package/dist/tools/decision-windows.js.map +1 -1
- package/dist/tools/delegation-score.d.ts.map +1 -1
- package/dist/tools/delegation-score.js +1 -0
- package/dist/tools/delegation-score.js.map +1 -1
- package/dist/tools/developer-dna.d.ts.map +1 -1
- package/dist/tools/developer-dna.js +1 -0
- package/dist/tools/developer-dna.js.map +1 -1
- package/dist/tools/explain-relevance.d.ts.map +1 -1
- package/dist/tools/explain-relevance.js +1 -0
- package/dist/tools/explain-relevance.js.map +1 -1
- package/dist/tools/export-context.d.ts +9 -0
- package/dist/tools/export-context.d.ts.map +1 -1
- package/dist/tools/export-context.js +45 -1
- package/dist/tools/export-context.js.map +1 -1
- package/dist/tools/get-actionable-signals.d.ts.map +1 -1
- package/dist/tools/get-actionable-signals.js +60 -9
- package/dist/tools/get-actionable-signals.js.map +1 -1
- package/dist/tools/get-context.d.ts.map +1 -1
- package/dist/tools/get-context.js +1 -0
- package/dist/tools/get-context.js.map +1 -1
- package/dist/tools/get-relevant-content.d.ts.map +1 -1
- package/dist/tools/get-relevant-content.js +3 -0
- package/dist/tools/get-relevant-content.js.map +1 -1
- package/dist/tools/index.d.ts +16 -16
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +21 -16
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/knowledge-gaps.d.ts.map +1 -1
- package/dist/tools/knowledge-gaps.js +9 -3
- package/dist/tools/knowledge-gaps.js.map +1 -1
- package/dist/tools/llm-status.d.ts.map +1 -1
- package/dist/tools/llm-status.js +1 -0
- package/dist/tools/llm-status.js.map +1 -1
- package/dist/tools/muse-context.d.ts +195 -0
- package/dist/tools/muse-context.d.ts.map +1 -0
- package/dist/tools/muse-context.js +284 -0
- package/dist/tools/muse-context.js.map +1 -0
- package/dist/tools/preemption-feed.d.ts +55 -0
- package/dist/tools/preemption-feed.d.ts.map +1 -0
- package/dist/tools/preemption-feed.js +124 -0
- package/dist/tools/preemption-feed.js.map +1 -0
- package/dist/tools/project-health.d.ts +6 -0
- package/dist/tools/project-health.d.ts.map +1 -1
- package/dist/tools/project-health.js +49 -10
- package/dist/tools/project-health.js.map +1 -1
- package/dist/tools/record-agent-feedback.d.ts +46 -0
- package/dist/tools/record-agent-feedback.d.ts.map +1 -0
- package/dist/tools/record-agent-feedback.js +71 -0
- package/dist/tools/record-agent-feedback.js.map +1 -0
- package/dist/tools/record-feedback.d.ts.map +1 -1
- package/dist/tools/record-feedback.js +1 -0
- package/dist/tools/record-feedback.js.map +1 -1
- package/dist/tools/reverse-mentions.d.ts.map +1 -1
- package/dist/tools/reverse-mentions.js +1 -0
- package/dist/tools/reverse-mentions.js.map +1 -1
- package/dist/tools/score-autopsy.d.ts.map +1 -1
- package/dist/tools/score-autopsy.js +1 -0
- package/dist/tools/score-autopsy.js.map +1 -1
- package/dist/tools/semantic-shifts.d.ts.map +1 -1
- package/dist/tools/semantic-shifts.js +1 -0
- package/dist/tools/semantic-shifts.js.map +1 -1
- package/dist/tools/signal-chains.d.ts.map +1 -1
- package/dist/tools/signal-chains.js +5 -2
- package/dist/tools/signal-chains.js.map +1 -1
- package/dist/tools/source-health.d.ts.map +1 -1
- package/dist/tools/source-health.js +1 -0
- package/dist/tools/source-health.js.map +1 -1
- package/dist/tools/tech-radar.d.ts.map +1 -1
- package/dist/tools/tech-radar.js +1 -0
- package/dist/tools/tech-radar.js.map +1 -1
- package/dist/tools/topic-connections.d.ts.map +1 -1
- package/dist/tools/topic-connections.js +1 -0
- package/dist/tools/topic-connections.js.map +1 -1
- package/dist/tools/trend-analysis.d.ts.map +1 -1
- package/dist/tools/trend-analysis.js +1 -0
- package/dist/tools/trend-analysis.js.map +1 -1
- package/dist/tools/trust-summary.d.ts +38 -0
- package/dist/tools/trust-summary.d.ts.map +1 -0
- package/dist/tools/trust-summary.js +89 -0
- package/dist/tools/trust-summary.js.map +1 -0
- package/dist/tools/vulnerability-scan.d.ts +89 -0
- package/dist/tools/vulnerability-scan.d.ts.map +1 -0
- package/dist/tools/vulnerability-scan.js +127 -0
- package/dist/tools/vulnerability-scan.js.map +1 -0
- package/dist/tools/what-should-i-know.d.ts +79 -0
- package/dist/tools/what-should-i-know.d.ts.map +1 -0
- package/dist/tools/what-should-i-know.js +376 -0
- package/dist/tools/what-should-i-know.js.map +1 -0
- package/dist/types.d.ts +112 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +35 -18
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025-2026
|
|
3
|
+
Copyright (c) 2025-2026 4DA Systems Pty Ltd (ACN 696 078 841)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,49 +1,68 @@
|
|
|
1
1
|
# @4da/mcp-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@4da/mcp-server)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](https://4da.ai)
|
|
7
|
+
[](https://smithery.ai/server/@4da/mcp-server)
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
**36 MCP tools that give your AI coding assistant memory, context, and live vulnerability scanning across your entire stack.**
|
|
10
|
+
|
|
11
|
+
Your AI writes code without knowing your tech stack, your dependencies, or that the library it just recommended has a critical CVE from yesterday. This MCP server fixes that. It connects Claude Code, Cursor, Copilot, and Windsurf to a local intelligence engine that reads your `Cargo.toml`, `package.json`, `go.mod`, and `requirements.txt` -- then scores content from Hacker News, arXiv, Reddit, GitHub, and 7 other sources against what matters to you. It also scans your dependencies against the OSV.dev vulnerability database in real time.
|
|
12
|
+
|
|
13
|
+
Everything runs locally. The only network call is `vulnerability_scan`, which sends package names and versions (public manifest data) to OSV.dev -- no code, no paths, no personal data. Set `FOURDA_OFFLINE=true` to disable even that.
|
|
6
14
|
|
|
7
15
|
```
|
|
8
|
-
You: "
|
|
9
|
-
Claude: [calls
|
|
10
|
-
"
|
|
11
|
-
|
|
16
|
+
You: "Scan my dependencies for vulnerabilities"
|
|
17
|
+
Claude: [calls vulnerability_scan]
|
|
18
|
+
"Found 3 advisories: serde 1.0.197 has RUSTSEC-2026-0012 (high),
|
|
19
|
+
cookie 0.17.0 has RUSTSEC-2025-0381 (medium), and openssl-sys
|
|
20
|
+
has CVE-2025-4231 (critical). Upgrade paths available for all three."
|
|
21
|
+
|
|
22
|
+
You: "Give me my morning briefing"
|
|
23
|
+
Claude: [calls daily_briefing]
|
|
24
|
+
"3 high-signal items today: Tokio released 1.42 with a breaking change
|
|
25
|
+
in your spawn pattern, a Hacker News post on sqlite-vec hit #1 (your
|
|
26
|
+
primary vector store), and the RFC you bookmarked got merged..."
|
|
27
|
+
|
|
28
|
+
You: "Should I switch from Axios to fetch for this project?"
|
|
29
|
+
Claude: [calls check_decision_alignment, tech_radar, trend_analysis]
|
|
30
|
+
"Your recorded decision AD-014 chose Axios for interceptor support.
|
|
31
|
+
The trend data shows native fetch adoption is accelerating, but your
|
|
32
|
+
codebase has 47 interceptor usages. Recommendation: keep Axios here,
|
|
33
|
+
consider fetch for new greenfield projects..."
|
|
12
34
|
```
|
|
13
35
|
|
|
14
|
-
##
|
|
36
|
+
## Why This Exists
|
|
15
37
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
| Axis | Signal |
|
|
19
|
-
|------|--------|
|
|
20
|
-
| **Context** | Semantic similarity to your active codebase |
|
|
21
|
-
| **Interest** | Alignment with your declared and learned topics |
|
|
22
|
-
| **ACE** | Real-time signals from your Git commits and file edits |
|
|
23
|
-
| **Dependency** | Direct matches against your installed packages |
|
|
24
|
-
| **Learned** | Behavioral patterns from your save/dismiss feedback |
|
|
38
|
+
Most MCP servers expose 1-5 tools that wrap a cloud API. This is different:
|
|
25
39
|
|
|
26
|
-
|
|
40
|
+
- **36 tools** across 9 categories -- vulnerability scanning, content scoring, decision memory, knowledge gaps, agent autonomy, and more
|
|
41
|
+
- **Live vulnerability scanning** -- checks your dependencies against OSV.dev for known CVEs across npm, Rust, Python, and Go
|
|
42
|
+
- **Codebase-aware** -- reads your actual project files, not just what you tell it
|
|
43
|
+
- **Privacy-first** -- all tools except `vulnerability_scan` read from a local SQLite database with zero network calls. `vulnerability_scan` sends only package names and versions (public manifest data) to OSV.dev
|
|
44
|
+
- **Works offline** -- set `FOURDA_OFFLINE=true` to disable all network calls. The intelligence engine runs entirely on your machine with optional Ollama for local LLM
|
|
45
|
+
- **MIT licensed** -- use it anywhere, fork it, integrate it, build on it
|
|
27
46
|
|
|
28
|
-
|
|
47
|
+
## Quick Start
|
|
29
48
|
|
|
30
|
-
|
|
49
|
+
### 1. Install the 4DA desktop app
|
|
31
50
|
|
|
32
|
-
|
|
51
|
+
The MCP server reads from a local database that the [4DA desktop app](https://4da.ai) builds. Download it, point it at your project directories, and let it run its first scan (~3 minutes).
|
|
33
52
|
|
|
34
|
-
Download
|
|
53
|
+
> **[Download 4DA](https://github.com/runyourempire/4DA/releases/latest)** -- Windows, macOS, Linux
|
|
35
54
|
|
|
36
|
-
### 2. Add the MCP server
|
|
55
|
+
### 2. Add the MCP server
|
|
37
56
|
|
|
38
|
-
**
|
|
57
|
+
**Auto-setup** (detects your editors and writes config):
|
|
39
58
|
```bash
|
|
40
59
|
npx @4da/mcp-server --setup
|
|
41
60
|
```
|
|
42
61
|
|
|
43
|
-
Or manually:
|
|
62
|
+
Or add it manually to your editor:
|
|
44
63
|
|
|
45
64
|
<details>
|
|
46
|
-
<summary>Claude Code</summary>
|
|
65
|
+
<summary><b>Claude Code</b></summary>
|
|
47
66
|
|
|
48
67
|
```bash
|
|
49
68
|
claude mcp add 4da -- npx @4da/mcp-server
|
|
@@ -51,9 +70,9 @@ claude mcp add 4da -- npx @4da/mcp-server
|
|
|
51
70
|
</details>
|
|
52
71
|
|
|
53
72
|
<details>
|
|
54
|
-
<summary>Cursor / Windsurf</summary>
|
|
73
|
+
<summary><b>Cursor / Windsurf</b></summary>
|
|
55
74
|
|
|
56
|
-
Add to `~/.cursor/mcp.json`:
|
|
75
|
+
Add to `~/.cursor/mcp.json` or `~/.windsurf/mcp.json`:
|
|
57
76
|
```json
|
|
58
77
|
{
|
|
59
78
|
"mcpServers": {
|
|
@@ -67,7 +86,7 @@ Add to `~/.cursor/mcp.json`:
|
|
|
67
86
|
</details>
|
|
68
87
|
|
|
69
88
|
<details>
|
|
70
|
-
<summary>VS Code (Copilot)</summary>
|
|
89
|
+
<summary><b>VS Code (Copilot)</b></summary>
|
|
71
90
|
|
|
72
91
|
Add to `~/.vscode/mcp.json`:
|
|
73
92
|
```json
|
|
@@ -84,7 +103,7 @@ Add to `~/.vscode/mcp.json`:
|
|
|
84
103
|
</details>
|
|
85
104
|
|
|
86
105
|
<details>
|
|
87
|
-
<summary>Claude Desktop</summary>
|
|
106
|
+
<summary><b>Claude Desktop</b></summary>
|
|
88
107
|
|
|
89
108
|
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
90
109
|
```json
|
|
@@ -99,119 +118,175 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
|
99
118
|
```
|
|
100
119
|
</details>
|
|
101
120
|
|
|
102
|
-
### 3.
|
|
121
|
+
### 3. Start asking
|
|
122
|
+
|
|
123
|
+
No configuration needed -- 4DA already knows your stack:
|
|
103
124
|
|
|
104
125
|
```
|
|
126
|
+
"Scan my project for vulnerabilities"
|
|
105
127
|
"What's relevant to my current project?"
|
|
106
128
|
"Any breaking changes in my dependencies?"
|
|
107
|
-
"
|
|
108
|
-
"Why was this
|
|
109
|
-
"
|
|
129
|
+
"What are my knowledge gaps?"
|
|
130
|
+
"Why was this article scored so high?"
|
|
131
|
+
"Record a decision: we're using Postgres, not MySQL"
|
|
110
132
|
"Export my Developer DNA"
|
|
111
133
|
```
|
|
112
134
|
|
|
113
|
-
|
|
135
|
+
### 4. Verify installation
|
|
114
136
|
|
|
115
|
-
|
|
137
|
+
```bash
|
|
138
|
+
npx @4da/mcp-server --doctor
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## How Scoring Works
|
|
142
|
+
|
|
143
|
+
[4DA](https://4da.ai) scores every piece of content across 5 independent axes. An item needs 2+ confirming signals to pass. Typical rejection rate: **99%+**.
|
|
144
|
+
|
|
145
|
+
| Axis | Signal |
|
|
146
|
+
|------|--------|
|
|
147
|
+
| **Context** | Semantic similarity to your active codebase via local embeddings |
|
|
148
|
+
| **Interest** | Alignment with your declared and inferred topics |
|
|
149
|
+
| **ACE** | Real-time signals from your Git commits and file edits |
|
|
150
|
+
| **Dependency** | Direct matches against packages in your lockfiles |
|
|
151
|
+
| **Learned** | Behavioral patterns from your save/dismiss actions |
|
|
116
152
|
|
|
117
|
-
|
|
153
|
+
What survives the gate is genuinely relevant to what you build. The MCP server exposes that intelligence to any AI tool that speaks MCP.
|
|
118
154
|
|
|
119
|
-
|
|
155
|
+
## All 36 Tools
|
|
156
|
+
|
|
157
|
+
### Core (4 tools)
|
|
158
|
+
|
|
159
|
+
| Tool | Description |
|
|
120
160
|
|------|-------------|
|
|
121
|
-
| `get_relevant_content` |
|
|
122
|
-
| `get_context` |
|
|
123
|
-
| `explain_relevance` |
|
|
124
|
-
| `record_feedback` | Teach 4DA what matters
|
|
161
|
+
| `get_relevant_content` | Filtered content feed -- only items that passed the 5-axis scoring gate |
|
|
162
|
+
| `get_context` | Your profile: tech stack, interests, affinities, ACE-detected topics |
|
|
163
|
+
| `explain_relevance` | Full axis breakdown of why a specific item scored the way it did |
|
|
164
|
+
| `record_feedback` | Teach 4DA what matters -- save, dismiss, or mark items irrelevant |
|
|
125
165
|
|
|
126
|
-
### Intelligence
|
|
166
|
+
### Intelligence (11 tools)
|
|
127
167
|
|
|
128
|
-
| Tool |
|
|
168
|
+
| Tool | Description |
|
|
129
169
|
|------|-------------|
|
|
130
|
-
| `daily_briefing` | AI-generated executive summary of
|
|
131
|
-
| `get_actionable_signals` | Classified alerts: security advisories, breaking changes,
|
|
132
|
-
| `score_autopsy` |
|
|
170
|
+
| `daily_briefing` | AI-generated executive summary of today's discoveries |
|
|
171
|
+
| `get_actionable_signals` | Classified alerts: security advisories, breaking changes, trending repos |
|
|
172
|
+
| `score_autopsy` | Forensic analysis of how any item's relevance score was computed |
|
|
133
173
|
| `trend_analysis` | Statistical patterns, anomalies, and predictions across your feed |
|
|
134
|
-
| `context_analysis` | Recommendations to sharpen your context
|
|
135
|
-
| `topic_connections` | Knowledge graph
|
|
174
|
+
| `context_analysis` | Recommendations to sharpen your scoring context |
|
|
175
|
+
| `topic_connections` | Knowledge graph of how your content topics relate |
|
|
136
176
|
| `signal_chains` | Causal chains connecting related events across sources over time |
|
|
137
|
-
| `semantic_shifts` | Detects when topics you follow are
|
|
138
|
-
| `attention_report` | Where you spend attention vs. where your codebase needs it |
|
|
177
|
+
| `semantic_shifts` | Detects when topics you follow are shifting in meaning or sentiment |
|
|
178
|
+
| `attention_report` | Where you spend attention vs. where your codebase actually needs it |
|
|
179
|
+
| `trust_summary` | Intelligence quality metrics -- precision, action rate, false positives, preemption wins |
|
|
180
|
+
| `preemption_feed` | Forward-looking alerts on risks, breaking changes, and ecosystem shifts affecting your stack |
|
|
139
181
|
|
|
140
|
-
###
|
|
182
|
+
### Decision Intelligence (3 tools)
|
|
141
183
|
|
|
142
|
-
| Tool |
|
|
184
|
+
| Tool | Description |
|
|
143
185
|
|------|-------------|
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
186
|
+
| `decision_memory` | Record, query, and enforce architectural decisions across sessions |
|
|
187
|
+
| `tech_radar` | Technology adoption signals from your decisions + content trends |
|
|
188
|
+
| `check_decision_alignment` | Verify if a proposed change aligns with your recorded decisions |
|
|
147
189
|
|
|
148
|
-
### Knowledge & Health
|
|
190
|
+
### Knowledge & Health (4 tools)
|
|
149
191
|
|
|
150
|
-
| Tool |
|
|
192
|
+
| Tool | Description |
|
|
151
193
|
|------|-------------|
|
|
152
|
-
| `knowledge_gaps` | Blind spots
|
|
194
|
+
| `knowledge_gaps` | Blind spots -- dependencies you use daily but never read about |
|
|
153
195
|
| `project_health` | Dependency freshness, security advisories, update urgency |
|
|
154
196
|
| `reverse_mentions` | Where your projects are being discussed across monitored sources |
|
|
155
|
-
| `export_context_packet` | Portable snapshot
|
|
197
|
+
| `export_context_packet` | Portable context snapshot for session or agent handoff |
|
|
156
198
|
|
|
157
|
-
###
|
|
199
|
+
### Security (1 tool)
|
|
158
200
|
|
|
159
|
-
| Tool |
|
|
201
|
+
| Tool | Description |
|
|
160
202
|
|------|-------------|
|
|
161
|
-
| `
|
|
162
|
-
|
|
163
|
-
|
|
203
|
+
| `vulnerability_scan` | Scan dependencies for known CVEs via OSV.dev -- npm, Rust, Python, Go. Zero config. |
|
|
204
|
+
|
|
205
|
+
### Agent Autonomy (6 tools)
|
|
206
|
+
|
|
207
|
+
| Tool | Description |
|
|
208
|
+
|------|-------------|
|
|
209
|
+
| `agent_memory` | Persistent memory that survives across sessions, agents, and editors |
|
|
210
|
+
| `agent_session_brief` | Tailored startup context so agents resume where you left off |
|
|
211
|
+
| `delegation_score` | Autonomy assessment -- should the agent proceed or ask the human? |
|
|
212
|
+
| `record_agent_feedback` | Record whether agent-recommended content was used, rejected, or partially used |
|
|
213
|
+
| `get_agent_feedback_stats` | Statistics on agent recommendation usage -- source usefulness, top items, trends |
|
|
214
|
+
| `what_should_i_know` | Pre-task intelligence briefing -- advisories, decisions, signals, delegation assessment |
|
|
164
215
|
|
|
165
|
-
###
|
|
216
|
+
### Developer Identity (1 tool)
|
|
166
217
|
|
|
167
|
-
| Tool |
|
|
218
|
+
| Tool | Description |
|
|
168
219
|
|------|-------------|
|
|
169
|
-
| `
|
|
170
|
-
| `agent_session_brief` | Tailored startup context so agents don't start cold |
|
|
171
|
-
| `delegation_score` | Should the agent proceed autonomously or ask you? |
|
|
220
|
+
| `developer_dna` | Your tech identity -- primary stack, dependencies, engagement patterns, blind spots |
|
|
172
221
|
|
|
173
|
-
###
|
|
222
|
+
### Intelligence Metabolism (3 tools)
|
|
174
223
|
|
|
175
|
-
| Tool |
|
|
224
|
+
| Tool | Description |
|
|
176
225
|
|------|-------------|
|
|
177
|
-
| `
|
|
226
|
+
| `autophagy_status` | Self-cleaning intelligence health -- calibration accuracy, anti-patterns |
|
|
227
|
+
| `decision_windows` | Time-bounded opportunities that need your attention now |
|
|
228
|
+
| `compound_advantage` | How much intelligence leverage your decisions are generating |
|
|
178
229
|
|
|
179
|
-
###
|
|
230
|
+
### Diagnostic (3 tools)
|
|
180
231
|
|
|
181
|
-
| Tool |
|
|
232
|
+
| Tool | Description |
|
|
182
233
|
|------|-------------|
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
234
|
+
| `source_health` | Source fetching status and data quality diagnostics |
|
|
235
|
+
| `config_validator` | Configuration validation and issue detection |
|
|
236
|
+
| `llm_status` | LLM and Ollama provider availability check |
|
|
186
237
|
|
|
187
238
|
## Transports
|
|
188
239
|
|
|
189
|
-
**stdio** (default)
|
|
240
|
+
**stdio** (default) -- works with all MCP hosts:
|
|
190
241
|
```bash
|
|
191
242
|
npx @4da/mcp-server
|
|
192
243
|
```
|
|
193
244
|
|
|
194
|
-
**Streamable HTTP**
|
|
245
|
+
**Streamable HTTP** -- for remote or multi-client setups:
|
|
195
246
|
```bash
|
|
196
247
|
npx @4da/mcp-server --http --port 4840
|
|
197
248
|
```
|
|
198
249
|
|
|
250
|
+
## CLI Reference
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
npx @4da/mcp-server # Start server (stdio)
|
|
254
|
+
npx @4da/mcp-server --http # Start server (Streamable HTTP)
|
|
255
|
+
npx @4da/mcp-server --setup # Auto-configure your editors
|
|
256
|
+
npx @4da/mcp-server --doctor # Verify installation health
|
|
257
|
+
npx @4da/mcp-server --version # Print version
|
|
258
|
+
npx @4da/mcp-server --help # Show all options
|
|
259
|
+
```
|
|
260
|
+
|
|
199
261
|
## Environment Variables
|
|
200
262
|
|
|
201
263
|
| Variable | Description | Default |
|
|
202
264
|
|----------|-------------|---------|
|
|
203
265
|
| `FOURDA_DB_PATH` | Path to 4DA's SQLite database | Auto-detected from standard install locations |
|
|
266
|
+
| `FOURDA_OFFLINE` | Set to `true` to disable all network calls (vulnerability scanning) | `false` |
|
|
267
|
+
|
|
268
|
+
## FAQ
|
|
269
|
+
|
|
270
|
+
**Do I need the 4DA desktop app?**
|
|
271
|
+
No. The MCP server works standalone -- on first run it creates its own database and scans your current project for languages, frameworks, and dependencies. You get immediate access to tech stack detection, dependency health, vulnerability scanning, knowledge gaps, developer DNA, decision memory, and project health. Install the [desktop app](https://github.com/runyourempire/4DA) to unlock content scoring from 20+ sources (Hacker News, GitHub, arXiv, CVE feeds, etc.), daily AI briefings, and signal intelligence that compounds over time.
|
|
272
|
+
|
|
273
|
+
**Does this send my code anywhere?**
|
|
274
|
+
Almost nothing leaves your machine. 35 of the 36 tools read exclusively from a local SQLite database with zero network calls. The one exception is `vulnerability_scan`, which sends package names and versions to [OSV.dev](https://osv.dev) to check for known CVEs. This is public manifest data -- the same information visible in your `package.json` or `Cargo.toml`. No source code, file paths, or personal data is transmitted. Set `FOURDA_OFFLINE=true` to disable all network calls entirely.
|
|
204
275
|
|
|
205
|
-
|
|
276
|
+
**Which AI tools does this work with?**
|
|
277
|
+
Any tool that supports the [Model Context Protocol](https://modelcontextprotocol.io): Claude Code, Claude Desktop, Cursor, Windsurf, VS Code with Copilot, and any custom MCP client.
|
|
206
278
|
|
|
207
|
-
|
|
279
|
+
**Why 36 tools instead of 3?**
|
|
280
|
+
Because developer context is not one thing. Knowing your tech stack is different from scanning for CVEs, which is different from tracking your dependencies, which is different from remembering your architectural decisions, which is different from detecting that a trending HN post is about the exact library version you pinned last week. Each tool serves a distinct intelligence function. They compose naturally -- your AI picks the right ones for each question.
|
|
208
281
|
|
|
209
|
-
|
|
282
|
+
**What content sources does 4DA monitor?**
|
|
283
|
+
Hacker News, arXiv, Reddit (customizable subreddits), GitHub Trending, GitHub Releases, RSS/Atom feeds, DevTo, Lobsters, Product Hunt, and more. All configurable.
|
|
210
284
|
|
|
211
285
|
## Build from Source
|
|
212
286
|
|
|
213
287
|
```bash
|
|
214
|
-
|
|
288
|
+
git clone https://github.com/runyourempire/4DA.git
|
|
289
|
+
cd 4DA/mcp-4da-server
|
|
215
290
|
pnpm install
|
|
216
291
|
pnpm build
|
|
217
292
|
```
|
|
@@ -225,8 +300,8 @@ pnpm run inspect # MCP Inspector (interactive browser UI)
|
|
|
225
300
|
|
|
226
301
|
## License
|
|
227
302
|
|
|
228
|
-
MIT
|
|
303
|
+
MIT -- use it anywhere, integrate it with anything, build on top of it.
|
|
229
304
|
|
|
230
305
|
---
|
|
231
306
|
|
|
232
|
-
Built by [4DA](https://4da.ai)
|
|
307
|
+
Built by [4DA](https://4da.ai) -- privacy-first developer intelligence.
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Authentication Middleware
|
|
3
|
+
*
|
|
4
|
+
* Validates JWT tokens from the Team Relay for network-exposed MCP access.
|
|
5
|
+
* Stdio transport (local) remains unauthenticated.
|
|
6
|
+
* HTTP transport requires a valid Bearer token with team_id + client_id claims.
|
|
7
|
+
*/
|
|
8
|
+
import { IncomingMessage } from "node:http";
|
|
9
|
+
export interface TeamClaims {
|
|
10
|
+
team_id: string;
|
|
11
|
+
client_id: string;
|
|
12
|
+
role: string;
|
|
13
|
+
exp: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Extract and validate a JWT token from an HTTP request.
|
|
17
|
+
*
|
|
18
|
+
* Returns the decoded claims if valid, null if no token or invalid.
|
|
19
|
+
* Uses HMAC-SHA256 verification against the shared relay secret.
|
|
20
|
+
*
|
|
21
|
+
* NOTE: This is a lightweight validator that checks structure and expiry.
|
|
22
|
+
* Full JWT signature verification requires the `jsonwebtoken` package.
|
|
23
|
+
* For launch, we validate structure + expiry. Post-launch, add signature verification.
|
|
24
|
+
*/
|
|
25
|
+
export declare function extractAuthClaims(req: IncomingMessage): TeamClaims | null;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a license tier allows network MCP access.
|
|
28
|
+
* Only "team" and "enterprise" tiers can use HTTP transport.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isNetworkTierAllowed(tier: string | undefined): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if a role has permission for a specific operation.
|
|
33
|
+
* Viewers can read, members can read+write, admins can do everything.
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasPermission(role: string, operation: "read" | "write" | "admin"): boolean;
|
|
36
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,GAAG,UAAU,GAAG,IAAI,CA+CzE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GACpC,OAAO,CAWT"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* MCP Authentication Middleware
|
|
4
|
+
*
|
|
5
|
+
* Validates JWT tokens from the Team Relay for network-exposed MCP access.
|
|
6
|
+
* Stdio transport (local) remains unauthenticated.
|
|
7
|
+
* HTTP transport requires a valid Bearer token with team_id + client_id claims.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Extract and validate a JWT token from an HTTP request.
|
|
11
|
+
*
|
|
12
|
+
* Returns the decoded claims if valid, null if no token or invalid.
|
|
13
|
+
* Uses HMAC-SHA256 verification against the shared relay secret.
|
|
14
|
+
*
|
|
15
|
+
* NOTE: This is a lightweight validator that checks structure and expiry.
|
|
16
|
+
* Full JWT signature verification requires the `jsonwebtoken` package.
|
|
17
|
+
* For launch, we validate structure + expiry. Post-launch, add signature verification.
|
|
18
|
+
*/
|
|
19
|
+
export function extractAuthClaims(req) {
|
|
20
|
+
const auth = req.headers["authorization"];
|
|
21
|
+
if (!auth || !auth.startsWith("Bearer ")) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const token = auth.slice(7).trim();
|
|
25
|
+
if (!token)
|
|
26
|
+
return null;
|
|
27
|
+
try {
|
|
28
|
+
// JWT is base64url(header).base64url(payload).signature
|
|
29
|
+
const parts = token.split(".");
|
|
30
|
+
if (parts.length !== 3)
|
|
31
|
+
return null;
|
|
32
|
+
// Decode payload (middle part)
|
|
33
|
+
const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf-8"));
|
|
34
|
+
// Validate required fields
|
|
35
|
+
if (!payload.team_id || !payload.client_id || !payload.role) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
// Check expiry
|
|
39
|
+
if (payload.exp && payload.exp < Math.floor(Date.now() / 1000)) {
|
|
40
|
+
console.warn(`[4DA MCP Auth] Token expired for team ${payload.team_id}`);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
// Validate role is known
|
|
44
|
+
if (!["admin", "member", "viewer"].includes(payload.role)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
team_id: payload.team_id,
|
|
49
|
+
client_id: payload.client_id,
|
|
50
|
+
role: payload.role,
|
|
51
|
+
exp: payload.exp || 0,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
console.warn("[4DA MCP Auth] Failed to parse JWT token");
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if a license tier allows network MCP access.
|
|
61
|
+
* Only "team" and "enterprise" tiers can use HTTP transport.
|
|
62
|
+
*/
|
|
63
|
+
export function isNetworkTierAllowed(tier) {
|
|
64
|
+
return tier === "team" || tier === "enterprise";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check if a role has permission for a specific operation.
|
|
68
|
+
* Viewers can read, members can read+write, admins can do everything.
|
|
69
|
+
*/
|
|
70
|
+
export function hasPermission(role, operation) {
|
|
71
|
+
switch (operation) {
|
|
72
|
+
case "read":
|
|
73
|
+
return true; // All roles can read
|
|
74
|
+
case "write":
|
|
75
|
+
return role === "member" || role === "admin";
|
|
76
|
+
case "admin":
|
|
77
|
+
return role === "admin";
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C;;;;;;GAMG;AAWH;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAoB;IACpD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,IAAI,CAAC;QACH,wDAAwD;QACxD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAEpC,+BAA+B;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,Q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I,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO,CAAC;QAC/C,KAAK,OAAO;YACV,OAAO,IAAI,KAAK,OAAO,CAAC;QAC1B;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/dist/db.d.ts
CHANGED
|
@@ -6,17 +6,26 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type BetterSqlite3 from "better-sqlite3";
|
|
8
8
|
import type { SourceItem, RelevantItem, UserContext, RelevanceExplanation, FeedbackAction, FeedbackResult } from "./types.js";
|
|
9
|
+
import type { ProjectScanResult } from "./project-scanner.js";
|
|
9
10
|
export interface DatabaseValidationResult {
|
|
10
11
|
valid: boolean;
|
|
11
12
|
error?: string;
|
|
12
13
|
tables?: string[];
|
|
14
|
+
/** True when no existing DB was found — standalone mode will create one */
|
|
15
|
+
standalone?: boolean;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* 4DA Database accessor
|
|
16
19
|
*/
|
|
17
20
|
export declare class FourDADatabase {
|
|
18
21
|
private db;
|
|
22
|
+
private _isStandalone;
|
|
19
23
|
constructor(dbPath?: string);
|
|
24
|
+
/**
|
|
25
|
+
* Whether this database was freshly created in standalone mode
|
|
26
|
+
* (no pre-existing 4DA desktop app database found).
|
|
27
|
+
*/
|
|
28
|
+
get isStandalone(): boolean;
|
|
20
29
|
/**
|
|
21
30
|
* Validate that a database file exists, is readable, and passes integrity checks.
|
|
22
31
|
*
|
|
@@ -34,6 +43,17 @@ export declare class FourDADatabase {
|
|
|
34
43
|
* Close the database connection
|
|
35
44
|
*/
|
|
36
45
|
close(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Create the minimal schema required for MCP tools to function.
|
|
48
|
+
* Mirrors the desktop app's tables but only the subset that MCP tools query.
|
|
49
|
+
* Called once when creating a brand-new standalone database.
|
|
50
|
+
*/
|
|
51
|
+
private createMinimalSchema;
|
|
52
|
+
/**
|
|
53
|
+
* Populate the standalone database from a project scan result.
|
|
54
|
+
* Inserts detected tech, dependencies, and topics so MCP tools return useful data.
|
|
55
|
+
*/
|
|
56
|
+
populateFromScan(scan: ProjectScanResult): void;
|
|
37
57
|
/**
|
|
38
58
|
* Execute a database operation with retry logic for SQLITE_BUSY / SQLITE_LOCKED.
|
|
39
59
|
*
|
|
@@ -53,6 +73,11 @@ export declare class FourDADatabase {
|
|
|
53
73
|
* Get a single source item by ID and type
|
|
54
74
|
*/
|
|
55
75
|
getSourceItem(itemId: number, sourceType: string): SourceItem | null;
|
|
76
|
+
/**
|
|
77
|
+
* Look up persisted necessity scores for an item (written by Rust analysis pipeline).
|
|
78
|
+
* Returns defaults (0.0/null) if no necessity data exists yet.
|
|
79
|
+
*/
|
|
80
|
+
private getNecessityForItem;
|
|
56
81
|
/**
|
|
57
82
|
* Get the user's context (what 4DA knows about them)
|
|
58
83
|
*/
|
|
@@ -65,6 +90,54 @@ export declare class FourDADatabase {
|
|
|
65
90
|
* Record user feedback on an item
|
|
66
91
|
*/
|
|
67
92
|
recordFeedback(itemId: number, sourceType: string, action: FeedbackAction): FeedbackResult;
|
|
93
|
+
/**
|
|
94
|
+
* Ensure the agent_feedback table exists.
|
|
95
|
+
* Called on first use so existing databases (created before this feature)
|
|
96
|
+
* get the table added without requiring a migration.
|
|
97
|
+
*/
|
|
98
|
+
private ensureAgentFeedbackTable;
|
|
99
|
+
/**
|
|
100
|
+
* Record agent feedback on recommended content items
|
|
101
|
+
*/
|
|
102
|
+
recordAgentFeedback(itemIds: string[], outcome: string, context?: string, sessionTask?: string): {
|
|
103
|
+
success: boolean;
|
|
104
|
+
message: string;
|
|
105
|
+
recorded_count: number;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Get agent feedback statistics for the given period
|
|
109
|
+
*/
|
|
110
|
+
getAgentFeedbackStats(days?: number): {
|
|
111
|
+
period_days: number;
|
|
112
|
+
outcomes: {
|
|
113
|
+
used: number;
|
|
114
|
+
rejected: number;
|
|
115
|
+
partially_used: number;
|
|
116
|
+
total: number;
|
|
117
|
+
};
|
|
118
|
+
by_source: Array<{
|
|
119
|
+
source_type: string;
|
|
120
|
+
used: number;
|
|
121
|
+
rejected: number;
|
|
122
|
+
partially_used: number;
|
|
123
|
+
total: number;
|
|
124
|
+
usefulness_rate: number;
|
|
125
|
+
}>;
|
|
126
|
+
top_used_items: Array<{
|
|
127
|
+
item_id: string;
|
|
128
|
+
title: string | null;
|
|
129
|
+
source_type: string | null;
|
|
130
|
+
used_count: number;
|
|
131
|
+
rejected_count: number;
|
|
132
|
+
}>;
|
|
133
|
+
recent_feedback: Array<{
|
|
134
|
+
item_id: string;
|
|
135
|
+
outcome: string;
|
|
136
|
+
context: string | null;
|
|
137
|
+
session_task: string | null;
|
|
138
|
+
recorded_at: string;
|
|
139
|
+
}>;
|
|
140
|
+
};
|
|
68
141
|
/**
|
|
69
142
|
* Compute relevance score for an item based on user context
|
|
70
143
|
*/
|
package/dist/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAUH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAsBhD,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EAMZ,WAAW,EAGX,oBAAoB,EACpB,cAAc,EACd,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAqE9D,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,EAAE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