@4da/mcp-server 4.0.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +46 -4
- 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 +10 -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 +31 -1
- 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 +70 -7
- 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 +75 -10
- 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 +12 -1
- 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 +8 -0
- package/dist/tools/knowledge-gaps.d.ts.map +1 -1
- package/dist/tools/knowledge-gaps.js +23 -7
- 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 +12 -0
- package/dist/tools/project-health.d.ts.map +1 -1
- package/dist/tools/project-health.js +62 -11
- 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 +31 -13
- 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 +9 -2
- 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 +380 -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/dist/schema-registry.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// SPDX-License-Identifier: FSL-1.1-Apache-2.0
|
|
1
2
|
/**
|
|
2
3
|
* Schema Registry for Dynamic Context Discovery
|
|
3
4
|
*
|
|
@@ -5,144 +6,248 @@
|
|
|
5
6
|
* - Returning only one-liner summaries in list_tools
|
|
6
7
|
* - Storing full schemas as MCP Resources (lazy-loaded)
|
|
7
8
|
*
|
|
9
|
+
* Also provides category/tag metadata for tool discovery and filtering.
|
|
10
|
+
*
|
|
8
11
|
* Full schemas available at: 4da://schema/{tool_name}
|
|
12
|
+
* Category manifest at: 4da://categories
|
|
9
13
|
*/
|
|
10
14
|
/**
|
|
11
|
-
* Slim tool registry
|
|
12
|
-
* Full schemas are stored in schemas/*.json and exposed as MCP Resources
|
|
15
|
+
* Slim tool registry — one-liner descriptions + category/tag metadata.
|
|
16
|
+
* Full schemas are stored in schemas/*.json and exposed as MCP Resources.
|
|
13
17
|
*/
|
|
14
18
|
export const TOOL_REGISTRY = {
|
|
15
19
|
// Core Tools
|
|
16
20
|
get_relevant_content: {
|
|
17
21
|
summary: "Query filtered content by relevance, source, time",
|
|
18
22
|
schemaFile: "get-relevant-content.json",
|
|
23
|
+
category: "core",
|
|
24
|
+
tags: ["content", "feed", "relevance", "filter", "query"],
|
|
19
25
|
},
|
|
20
26
|
get_context: {
|
|
21
27
|
summary: "Get user's interests, tech stack, learned affinities",
|
|
22
28
|
schemaFile: "get-context.json",
|
|
29
|
+
category: "core",
|
|
30
|
+
tags: ["context", "interests", "tech-stack", "profile"],
|
|
23
31
|
},
|
|
24
32
|
explain_relevance: {
|
|
25
33
|
summary: "Understand why an item scored the way it did",
|
|
26
34
|
schemaFile: "explain-relevance.json",
|
|
35
|
+
category: "core",
|
|
36
|
+
tags: ["relevance", "scoring", "explanation", "debug"],
|
|
27
37
|
},
|
|
28
38
|
record_feedback: {
|
|
29
39
|
summary: "Teach 4DA what you like/dislike (click, save, dismiss)",
|
|
30
40
|
schemaFile: "record-feedback.json",
|
|
41
|
+
category: "core",
|
|
42
|
+
tags: ["feedback", "preference", "learning", "interaction"],
|
|
31
43
|
},
|
|
32
|
-
//
|
|
44
|
+
// Intelligence Tools
|
|
33
45
|
score_autopsy: {
|
|
34
46
|
summary: "Deep forensic analysis of relevance scores (AI-powered)",
|
|
35
47
|
schemaFile: "score-autopsy.json",
|
|
48
|
+
category: "intelligence",
|
|
49
|
+
tags: ["scoring", "forensic", "analysis", "ai", "debug"],
|
|
36
50
|
},
|
|
37
51
|
trend_analysis: {
|
|
38
52
|
summary: "Statistical patterns, anomalies, and predictions (AI-powered)",
|
|
39
53
|
schemaFile: "trend-analysis.json",
|
|
54
|
+
category: "intelligence",
|
|
55
|
+
tags: ["trends", "patterns", "predictions", "ai", "statistics"],
|
|
40
56
|
},
|
|
41
57
|
daily_briefing: {
|
|
42
58
|
summary: "Executive summary of discoveries (AI-powered)",
|
|
43
59
|
schemaFile: "daily-briefing.json",
|
|
60
|
+
category: "intelligence",
|
|
61
|
+
tags: ["briefing", "summary", "daily", "ai", "digest"],
|
|
44
62
|
},
|
|
45
63
|
context_analysis: {
|
|
46
64
|
summary: "Optimize your context for better relevance (AI-powered)",
|
|
47
65
|
schemaFile: "context-analysis.json",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
summary: "Diagnose source fetching and data quality issues",
|
|
51
|
-
schemaFile: "source-health.json",
|
|
66
|
+
category: "intelligence",
|
|
67
|
+
tags: ["context", "optimization", "relevance", "ai"],
|
|
52
68
|
},
|
|
53
69
|
topic_connections: {
|
|
54
70
|
summary: "Build knowledge graphs from content (AI-powered)",
|
|
55
71
|
schemaFile: "topic-connections.json",
|
|
72
|
+
category: "intelligence",
|
|
73
|
+
tags: ["topics", "knowledge-graph", "connections", "ai"],
|
|
74
|
+
},
|
|
75
|
+
get_actionable_signals: {
|
|
76
|
+
summary: "Classify content into actionable signals with priority levels",
|
|
77
|
+
schemaFile: "get-actionable-signals.json",
|
|
78
|
+
category: "intelligence",
|
|
79
|
+
tags: ["signals", "priority", "actionable", "classification"],
|
|
80
|
+
},
|
|
81
|
+
signal_chains: {
|
|
82
|
+
summary: "Get causal signal chains connecting related events over time",
|
|
83
|
+
schemaFile: "signal-chains.json",
|
|
84
|
+
category: "intelligence",
|
|
85
|
+
tags: ["signals", "causal", "chains", "temporal"],
|
|
86
|
+
},
|
|
87
|
+
semantic_shifts: {
|
|
88
|
+
summary: "Detect narrative shifts in topics you follow",
|
|
89
|
+
schemaFile: "semantic-shifts.json",
|
|
90
|
+
category: "intelligence",
|
|
91
|
+
tags: ["narrative", "shifts", "topics", "detection"],
|
|
92
|
+
},
|
|
93
|
+
attention_report: {
|
|
94
|
+
summary: "Analyze attention allocation vs codebase needs",
|
|
95
|
+
schemaFile: "attention-report.json",
|
|
96
|
+
category: "intelligence",
|
|
97
|
+
tags: ["attention", "allocation", "codebase", "analysis"],
|
|
98
|
+
},
|
|
99
|
+
// Diagnostic Tools
|
|
100
|
+
source_health: {
|
|
101
|
+
summary: "Diagnose source fetching and data quality issues",
|
|
102
|
+
schemaFile: "source-health.json",
|
|
103
|
+
category: "diagnostic",
|
|
104
|
+
tags: ["sources", "health", "fetching", "quality"],
|
|
56
105
|
},
|
|
57
106
|
config_validator: {
|
|
58
107
|
summary: "Validate configuration and detect issues",
|
|
59
108
|
schemaFile: "config-validator.json",
|
|
109
|
+
category: "diagnostic",
|
|
110
|
+
tags: ["config", "validation", "settings", "health"],
|
|
60
111
|
},
|
|
61
112
|
llm_status: {
|
|
62
113
|
summary: "Check LLM/Ollama configuration and availability",
|
|
63
114
|
schemaFile: "llm-status.json",
|
|
115
|
+
category: "diagnostic",
|
|
116
|
+
tags: ["llm", "ollama", "status", "availability"],
|
|
64
117
|
},
|
|
65
|
-
|
|
66
|
-
summary: "Classify content into actionable signals with priority levels",
|
|
67
|
-
schemaFile: "get-actionable-signals.json",
|
|
68
|
-
},
|
|
69
|
-
// Innovation Feature Tools
|
|
118
|
+
// Knowledge & Health Tools
|
|
70
119
|
export_context_packet: {
|
|
71
120
|
summary: "Generate portable context packet for session handoff",
|
|
72
121
|
schemaFile: "export-context.json",
|
|
122
|
+
category: "knowledge",
|
|
123
|
+
tags: ["export", "context", "handoff", "portable"],
|
|
73
124
|
},
|
|
74
125
|
knowledge_gaps: {
|
|
75
126
|
summary: "Detect knowledge gaps in your project dependencies",
|
|
76
127
|
schemaFile: "knowledge-gaps.json",
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
summary: "Get causal signal chains connecting related events over time",
|
|
80
|
-
schemaFile: "signal-chains.json",
|
|
81
|
-
},
|
|
82
|
-
semantic_shifts: {
|
|
83
|
-
summary: "Detect narrative shifts in topics you follow",
|
|
84
|
-
schemaFile: "semantic-shifts.json",
|
|
128
|
+
category: "knowledge",
|
|
129
|
+
tags: ["gaps", "dependencies", "knowledge", "detection"],
|
|
85
130
|
},
|
|
86
131
|
reverse_mentions: {
|
|
87
132
|
summary: "Find where your projects are mentioned in sources",
|
|
88
133
|
schemaFile: "reverse-mentions.json",
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
summary: "Analyze attention allocation vs codebase needs",
|
|
92
|
-
schemaFile: "attention-report.json",
|
|
134
|
+
category: "knowledge",
|
|
135
|
+
tags: ["mentions", "projects", "sources", "discovery"],
|
|
93
136
|
},
|
|
94
137
|
project_health: {
|
|
95
138
|
summary: "Project health radar for dependency freshness and security",
|
|
96
139
|
schemaFile: "project-health.json",
|
|
140
|
+
category: "knowledge",
|
|
141
|
+
tags: ["project", "health", "dependencies", "security"],
|
|
97
142
|
},
|
|
98
143
|
// Decision Intelligence Tools
|
|
99
144
|
decision_memory: {
|
|
100
145
|
summary: "Manage developer decisions (record, list, check, update, supersede)",
|
|
101
146
|
schemaFile: "decision-memory.json",
|
|
147
|
+
category: "decisions",
|
|
148
|
+
tags: ["decisions", "memory", "record", "manage"],
|
|
102
149
|
},
|
|
103
150
|
tech_radar: {
|
|
104
151
|
summary: "Generate tech radar from decisions and content signals",
|
|
105
152
|
schemaFile: "tech-radar.json",
|
|
153
|
+
category: "decisions",
|
|
154
|
+
tags: ["tech-radar", "decisions", "signals", "adopt"],
|
|
106
155
|
},
|
|
107
156
|
check_decision_alignment: {
|
|
108
157
|
summary: "Check if a technology or pattern aligns with active decisions before suggesting changes",
|
|
109
158
|
schemaFile: "decision-enforcement.json",
|
|
159
|
+
category: "decisions",
|
|
160
|
+
tags: ["alignment", "decisions", "enforcement", "check"],
|
|
110
161
|
},
|
|
111
162
|
// Agent Autonomy Tools
|
|
112
163
|
agent_memory: {
|
|
113
164
|
summary: "Cross-agent persistent memory — store and recall across sessions and tools",
|
|
114
165
|
schemaFile: "agent-memory.json",
|
|
166
|
+
category: "agent",
|
|
167
|
+
tags: ["agent", "memory", "persistent", "cross-session"],
|
|
115
168
|
},
|
|
116
169
|
agent_session_brief: {
|
|
117
170
|
summary: "Tailored session startup context for AI agents — decisions, changes, memories",
|
|
118
171
|
schemaFile: "agent-session-brief.json",
|
|
172
|
+
category: "agent",
|
|
173
|
+
tags: ["agent", "session", "brief", "startup"],
|
|
119
174
|
},
|
|
120
175
|
delegation_score: {
|
|
121
176
|
summary: "AI-delegatability assessment — should the agent proceed or ask the human?",
|
|
122
177
|
schemaFile: "delegation-score.json",
|
|
178
|
+
category: "agent",
|
|
179
|
+
tags: ["agent", "delegation", "autonomy", "assessment"],
|
|
123
180
|
},
|
|
124
181
|
// Developer DNA
|
|
125
182
|
developer_dna: {
|
|
126
183
|
summary: "Export your Developer DNA — tech identity, dependencies, engagement, blind spots",
|
|
127
184
|
schemaFile: "developer-dna.json",
|
|
185
|
+
category: "identity",
|
|
186
|
+
tags: ["identity", "dna", "profile", "tech-stack", "export"],
|
|
128
187
|
},
|
|
129
188
|
// Intelligence Metabolism Tools
|
|
130
189
|
autophagy_status: {
|
|
131
190
|
summary: "Get intelligence metabolism status — autophagy cycles, calibration accuracy, anti-patterns",
|
|
132
191
|
schemaFile: "autophagy-status.json",
|
|
192
|
+
category: "metabolism",
|
|
193
|
+
tags: ["autophagy", "metabolism", "calibration", "health"],
|
|
133
194
|
},
|
|
134
195
|
decision_windows: {
|
|
135
196
|
summary: "View and manage decision windows — time-bounded opportunities requiring attention",
|
|
136
197
|
schemaFile: "decision-windows.json",
|
|
198
|
+
category: "metabolism",
|
|
199
|
+
tags: ["decisions", "windows", "time-bounded", "opportunities"],
|
|
137
200
|
},
|
|
138
201
|
compound_advantage: {
|
|
139
202
|
summary: "Get compound advantage score — measures intelligence leverage for decisions",
|
|
140
203
|
schemaFile: "compound-advantage.json",
|
|
204
|
+
category: "metabolism",
|
|
205
|
+
tags: ["compound", "advantage", "leverage", "score"],
|
|
206
|
+
},
|
|
207
|
+
// Agent Feedback Tools
|
|
208
|
+
record_agent_feedback: {
|
|
209
|
+
summary: "Record whether agent-recommended content was used, rejected, or partially used",
|
|
210
|
+
schemaFile: "record-agent-feedback.json",
|
|
211
|
+
category: "agent",
|
|
212
|
+
tags: ["agent", "feedback", "learning", "pasifa", "scoring"],
|
|
213
|
+
},
|
|
214
|
+
get_agent_feedback_stats: {
|
|
215
|
+
summary: "Get statistics on agent recommendation usage — source usefulness, top items, trends",
|
|
216
|
+
schemaFile: "agent-feedback-stats.json",
|
|
217
|
+
category: "agent",
|
|
218
|
+
tags: ["agent", "feedback", "statistics", "analytics", "pasifa"],
|
|
219
|
+
},
|
|
220
|
+
// Synthesis Tools
|
|
221
|
+
what_should_i_know: {
|
|
222
|
+
summary: "Pre-task intelligence briefing — advisories, decisions, signals, delegation assessment",
|
|
223
|
+
schemaFile: "what-should-i-know.json",
|
|
224
|
+
category: "agent",
|
|
225
|
+
tags: ["agent", "briefing", "synthesis", "pre-task", "delegation", "advisories"],
|
|
226
|
+
},
|
|
227
|
+
// Trust & Preemption Tools
|
|
228
|
+
trust_summary: {
|
|
229
|
+
summary: "Intelligence quality metrics — precision, action rate, false positives, preemption wins",
|
|
230
|
+
schemaFile: "trust-summary.json",
|
|
231
|
+
category: "intelligence",
|
|
232
|
+
tags: ["trust", "precision", "quality", "metrics", "reliability"],
|
|
233
|
+
},
|
|
234
|
+
preemption_feed: {
|
|
235
|
+
summary: "Forward-looking alerts — signal chains, dependency risks, knowledge gaps",
|
|
236
|
+
schemaFile: "preemption-feed.json",
|
|
237
|
+
category: "intelligence",
|
|
238
|
+
tags: ["preemption", "alerts", "risks", "dependencies", "forward-looking"],
|
|
239
|
+
},
|
|
240
|
+
// Live Intelligence Tools
|
|
241
|
+
vulnerability_scan: {
|
|
242
|
+
summary: "Scan dependencies for known CVEs via OSV.dev — zero config, multi-ecosystem",
|
|
243
|
+
schemaFile: "vulnerability-scan.json",
|
|
244
|
+
category: "knowledge",
|
|
245
|
+
tags: ["security", "vulnerabilities", "cve", "dependencies", "osv", "scanning"],
|
|
141
246
|
},
|
|
142
247
|
};
|
|
143
248
|
/**
|
|
144
249
|
* Get slim tool list for list_tools response
|
|
145
|
-
* Returns minimal schema (just type: object)
|
|
250
|
+
* Returns minimal schema (just type: object) — full schema via resources
|
|
146
251
|
*/
|
|
147
252
|
export function getSlimToolList() {
|
|
148
253
|
return Object.entries(TOOL_REGISTRY).map(([name, info]) => ({
|
|
@@ -155,23 +260,50 @@ export function getSlimToolList() {
|
|
|
155
260
|
* Get list of schema resources for ListResources
|
|
156
261
|
*/
|
|
157
262
|
export function getSchemaResources() {
|
|
158
|
-
return Object.entries(TOOL_REGISTRY).map(([name
|
|
263
|
+
return Object.entries(TOOL_REGISTRY).map(([name]) => ({
|
|
159
264
|
uri: `4da://schema/${name}`,
|
|
160
265
|
name: `${name} schema`,
|
|
161
266
|
description: `Full JSON Schema for the ${name} tool`,
|
|
162
267
|
mimeType: "application/json",
|
|
163
268
|
}));
|
|
164
269
|
}
|
|
165
|
-
/**
|
|
166
|
-
* Check if a tool exists
|
|
167
|
-
*/
|
|
270
|
+
/** Check if a tool exists */
|
|
168
271
|
export function hasToolSchema(toolName) {
|
|
169
272
|
return toolName in TOOL_REGISTRY;
|
|
170
273
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Get schema filename for a tool
|
|
173
|
-
*/
|
|
274
|
+
/** Get schema filename for a tool */
|
|
174
275
|
export function getSchemaFilename(toolName) {
|
|
175
276
|
return TOOL_REGISTRY[toolName]?.schemaFile || null;
|
|
176
277
|
}
|
|
278
|
+
/** Get tool names grouped by category */
|
|
279
|
+
export function getToolsByCategory() {
|
|
280
|
+
const result = {};
|
|
281
|
+
for (const [name, entry] of Object.entries(TOOL_REGISTRY)) {
|
|
282
|
+
if (!result[entry.category]) {
|
|
283
|
+
result[entry.category] = [];
|
|
284
|
+
}
|
|
285
|
+
result[entry.category].push(name);
|
|
286
|
+
}
|
|
287
|
+
return result;
|
|
288
|
+
}
|
|
289
|
+
/** Structured category manifest for the 4da://categories resource */
|
|
290
|
+
export function getCategoryManifest() {
|
|
291
|
+
const grouped = getToolsByCategory();
|
|
292
|
+
const categories = {};
|
|
293
|
+
for (const [cat, tools] of Object.entries(grouped)) {
|
|
294
|
+
categories[cat] = { tools, count: tools.length };
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
version: "1.0.0",
|
|
298
|
+
total_tools: Object.keys(TOOL_REGISTRY).length,
|
|
299
|
+
categories,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/** Find tools matching any of the given tags */
|
|
303
|
+
export function getToolsByTags(tags) {
|
|
304
|
+
const tagSet = new Set(tags.map((t) => t.toLowerCase()));
|
|
305
|
+
return Object.entries(TOOL_REGISTRY)
|
|
306
|
+
.filter(([, entry]) => entry.tags.some((t) => tagSet.has(t.toLowerCase())))
|
|
307
|
+
.map(([name]) => name);
|
|
308
|
+
}
|
|
177
309
|
//# sourceMappingURL=schema-registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-registry.js","sourceRoot":"","sources":["../src/schema-registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema-registry.js","sourceRoot":"","sources":["../src/schema-registry.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C;;;;;;;;;;;GAWG;AAqBH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAsC;IAC9D,aAAa;IACb,oBAAoB,EAAE;QACpB,OAAO,EAAE,mDAAmD;QAC5D,UAAU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AAC;SACjC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;SAC1E,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "get_agent_feedback_stats",
|
|
3
|
+
"description": "Get statistics on how agents have used 4DA recommendations.\n\nShows which sources and topics are most valuable for AI-assisted development:\n- Total recommendations: used / rejected / partially_used counts\n- By source type: which sources produce the most agent-useful content\n- Top used item IDs (most frequently recommended and accepted)\n- Recent feedback entries\n\nUse this to understand what content is actually being used by AI agents and where PASIFA scoring can be improved.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"days": {
|
|
8
|
+
"type": "number",
|
|
9
|
+
"description": "Number of days to look back (default: 30, max: 365)",
|
|
10
|
+
"default": 30
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "preemption_feed",
|
|
3
|
+
"description": "Get forward-looking intelligence alerts about upcoming risks, breaking changes, and ecosystem shifts affecting your stack.\n\nSynthesizes signal chains, dependency health alerts, and knowledge gaps into actionable preemption intelligence. Use before dependency updates or when planning work.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"urgency_filter": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Filter by minimum urgency: critical, high, medium, watch. Default: all",
|
|
10
|
+
"enum": ["critical", "high", "medium", "watch"]
|
|
11
|
+
},
|
|
12
|
+
"limit": {
|
|
13
|
+
"type": "number",
|
|
14
|
+
"description": "Maximum alerts to return. Default: 10"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "record_agent_feedback",
|
|
3
|
+
"description": "Record whether content recommended by 4DA was useful in the agent's task.\n\nCall this after using get_relevant_content results to help 4DA learn what's actually valuable for AI-assisted development.\n\nOutcomes:\n- \"used\": Agent/developer used the recommended content (strong positive signal)\n- \"rejected\": Content was not useful — outdated, irrelevant, or wrong context (negative signal)\n- \"partially_used\": Some value extracted but not directly applicable (weak positive signal)\n\nThis feedback helps 4DA's PASIFA scoring system learn which content sources and topics are genuinely useful when agents recommend them.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"item_ids": {
|
|
8
|
+
"type": "array",
|
|
9
|
+
"items": { "type": "string" },
|
|
10
|
+
"description": "Source item IDs that were recommended (from get_relevant_content results)"
|
|
11
|
+
},
|
|
12
|
+
"outcome": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": ["used", "rejected", "partially_used"],
|
|
15
|
+
"description": "Whether the agent/developer used the recommended content"
|
|
16
|
+
},
|
|
17
|
+
"context": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Brief context about why (e.g., 'recommended to developer, they found it relevant' or 'content was outdated')"
|
|
20
|
+
},
|
|
21
|
+
"session_task": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "What task the agent was working on when it used this content"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": ["item_ids", "outcome"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "trust_summary",
|
|
3
|
+
"description": "Get intelligence quality metrics — precision, action conversion rate, false positive rate, and preemption wins.\n\nReturns trust ledger data for a configurable time window. Use this to assess how reliable 4DA's signals are before acting on them.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"days": {
|
|
8
|
+
"type": "number",
|
|
9
|
+
"description": "Number of days to analyze. Default: 30"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vulnerability_scan",
|
|
3
|
+
"description": "Scan project dependencies for known vulnerabilities (CVEs) using OSV.dev.\n\nReturns severity levels, fix versions, and upgrade recommendations for npm, Rust, Python, and Go dependencies. Zero configuration — automatically detects your stack from manifest and lock files.\n\nPrivacy: only sends package names and versions (public manifest data). No code, paths, or personal data transmitted.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project_path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Project directory to scan. Default: current working directory."
|
|
10
|
+
},
|
|
11
|
+
"severity_filter": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": ["critical", "high", "medium", "low"],
|
|
14
|
+
"description": "Only show vulnerabilities at or above this severity level."
|
|
15
|
+
},
|
|
16
|
+
"include_dev": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"description": "Include devDependencies in scan. Default: false."
|
|
19
|
+
},
|
|
20
|
+
"force_refresh": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"description": "Ignore cache and fetch fresh data from OSV.dev. Default: false."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "what_should_i_know",
|
|
3
|
+
"description": "Pre-task intelligence briefing. Given a task description and optional file paths, returns filtered advisories (security alerts, breaking changes), active decision windows, signal chains, relevant past decisions/memories, and a delegation assessment. Call this before starting any non-trivial task to get caught up on what matters.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"task": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Description of what you are about to work on"
|
|
10
|
+
},
|
|
11
|
+
"files": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": { "type": "string" },
|
|
14
|
+
"description": "File paths involved in the task (optional). Improves relevance filtering."
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["task"]
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/setup.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
14
|
* Run the setup wizard: detect editors and write MCP configurations.
|
|
15
|
+
* @param dryRun If true, only report what would be written without modifying files.
|
|
15
16
|
*/
|
|
16
|
-
export declare function runSetup(): void;
|
|
17
|
+
export declare function runSetup(dryRun?: boolean): void;
|
|
17
18
|
//# sourceMappingURL=setup.d.ts.map
|
package/dist/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AA+HH;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,UAAQ,GAAG,IAAI,CAkC7C"}
|
package/dist/setup.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: FSL-1.1-Apache-2.0
|
|
2
3
|
/**
|
|
3
4
|
* 4DA MCP Setup — Zero-friction editor configuration
|
|
4
5
|
*
|
|
@@ -105,19 +106,45 @@ const editors = [
|
|
|
105
106
|
console.log(` Written: ${configPath}`);
|
|
106
107
|
},
|
|
107
108
|
},
|
|
109
|
+
{
|
|
110
|
+
name: "Windsurf",
|
|
111
|
+
detect: () => {
|
|
112
|
+
const windsurfDir = join(homedir(), ".windsurf");
|
|
113
|
+
if (existsSync(windsurfDir)) {
|
|
114
|
+
return join(windsurfDir, "mcp.json");
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
},
|
|
118
|
+
write: (configPath) => {
|
|
119
|
+
const config = readJsonSafe(configPath);
|
|
120
|
+
const mcpServers = (config.mcpServers || {});
|
|
121
|
+
mcpServers["4da"] = MCP_CONFIG["4da"];
|
|
122
|
+
config.mcpServers = mcpServers;
|
|
123
|
+
writeJsonFile(configPath, config);
|
|
124
|
+
console.log(` Written: ${configPath}`);
|
|
125
|
+
},
|
|
126
|
+
},
|
|
108
127
|
];
|
|
109
128
|
/**
|
|
110
129
|
* Run the setup wizard: detect editors and write MCP configurations.
|
|
130
|
+
* @param dryRun If true, only report what would be written without modifying files.
|
|
111
131
|
*/
|
|
112
|
-
export function runSetup() {
|
|
132
|
+
export function runSetup(dryRun = false) {
|
|
113
133
|
console.log("\n 4DA MCP Server — Setup\n");
|
|
134
|
+
if (dryRun)
|
|
135
|
+
console.log(" [DRY RUN] No files will be modified.\n");
|
|
114
136
|
console.log(" Detecting editors...\n");
|
|
115
137
|
let configured = 0;
|
|
116
138
|
for (const editor of editors) {
|
|
117
139
|
const configPath = editor.detect();
|
|
118
140
|
if (configPath) {
|
|
119
141
|
console.log(` Found: ${editor.name}`);
|
|
120
|
-
|
|
142
|
+
if (dryRun) {
|
|
143
|
+
console.log(` Would write: ${configPath}`);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
editor.write(configPath);
|
|
147
|
+
}
|
|
121
148
|
configured++;
|
|
122
149
|
console.log("");
|
|
123
150
|
}
|
|
@@ -127,11 +154,18 @@ export function runSetup() {
|
|
|
127
154
|
console.log(" Manual setup — add to your editor's MCP config:\n");
|
|
128
155
|
console.log(` ${JSON.stringify(MCP_CONFIG, null, 2)}\n`);
|
|
129
156
|
}
|
|
130
|
-
console.log(" Done. Restart your editor to activate 4DA
|
|
157
|
+
console.log(" Done. Restart your editor to activate 4DA.");
|
|
158
|
+
console.log("");
|
|
159
|
+
console.log(" Note: This server reads data from the 4DA desktop app.");
|
|
160
|
+
console.log(" If you haven't installed it yet:");
|
|
161
|
+
console.log(" https://github.com/runyourempire/4DA/releases/latest");
|
|
162
|
+
console.log("");
|
|
163
|
+
console.log(" Run: npx @4da/mcp-server --doctor to verify everything works.\n");
|
|
131
164
|
}
|
|
132
165
|
// Run directly if invoked as a script (bin entry or pnpm run setup)
|
|
133
166
|
const isDirectRun = process.argv[1]?.endsWith("setup.js") || process.argv[1]?.endsWith("setup.ts");
|
|
134
167
|
if (isDirectRun) {
|
|
135
|
-
|
|
168
|
+
const dryRun = process.argv.includes("--dry-run");
|
|
169
|
+
runSetup(dryRun);
|
|
136
170
|
}
|
|
137
171
|
//# sourceMappingURL=setup.js.map
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,6EAA6E;AAC7E,MAAM,UAAU,GAAG;IACjB,KAAK,EAAE;QACL,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,iBAAiB,CAAC;KAC1B;CACF,CAAC;AAUF;;GAEG;AACH,SAAS,YAAY,CAAC,QAAgB;IACpC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAA4B,CAA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ic switch statement in index.ts.
|
|
5
|
+
* All 33 execute functions are imported once and mapped by tool name.
|
|
6
|
+
*
|
|
7
|
+
* Adding a new tool = add to this map + schema-registry + barrel export.
|
|
8
|
+
*/
|
|
9
|
+
import type { FourDADatabase } from "./db.js";
|
|
10
|
+
/**
|
|
11
|
+
* Executor signature — all tool execute functions follow this shape.
|
|
12
|
+
* Awaiting a sync return resolves immediately, so we can await uniformly.
|
|
13
|
+
*
|
|
14
|
+
* Uses `any` for params because each tool defines its own strict param type —
|
|
15
|
+
* type safety is enforced inside each tool file, not at the dispatch boundary.
|
|
16
|
+
* (The original switch statement used `as unknown as XParams` on every call.)
|
|
17
|
+
*/
|
|
18
|
+
export type ToolExecutor = (db: FourDADatabase, params: any) => unknown | Promise<unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* Dispatch a tool call by name. Awaits uniformly (no-op for sync executors).
|
|
21
|
+
* Returns MCP-formatted response with JSON-serialized result.
|
|
22
|
+
*/
|
|
23
|
+
export declare function dispatchTool(name: string, db: FourDADatabase, args: Record<string, unknown> | undefined): Promise<{
|
|
24
|
+
content: Array<{
|
|
25
|
+
type: string;
|
|
26
|
+
text: string;
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
/** Check if a tool exists in the dispatch map */
|
|
30
|
+
export declare function hasDispatchTool(name: string): boolean;
|
|
31
|
+
/** Get count of registered tool executors */
|
|
32
|
+
export declare function getDispatchToolCount(): number;
|
|
33
|
+
//# sourceMappingURL=tool-dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-dispatch.d.ts","sourceRoot":"","sources":["../src/tool-dispatch.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA2C9C;;;;;;;GAOG;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAoE3F;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAU7D;AAED,iDAAiD;AACjD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,6CAA6C;AAC7C,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|