@andespindola/brainlink 0.1.0-beta.3 → 0.1.0-beta.31
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/AGENTS.md +5 -5
- package/CHANGELOG.md +37 -3
- package/CONTRIBUTING.md +2 -2
- package/COPYRIGHT.md +5 -0
- package/README.md +172 -20
- package/SECURITY.md +1 -1
- package/dist/application/add-note.js +62 -13
- package/dist/application/analyze-vault.js +95 -8
- package/dist/application/frontend/client-css.js +214 -100
- package/dist/application/frontend/client-html.js +60 -45
- package/dist/application/frontend/client-js.js +553 -91
- package/dist/application/get-graph-layout.js +22 -7
- package/dist/application/get-graph-node.js +12 -0
- package/dist/application/get-graph-summary.js +12 -0
- package/dist/application/get-graph.js +3 -3
- package/dist/application/import-legacy-sqlite.js +296 -0
- package/dist/application/index-vault.js +11 -4
- package/dist/application/list-agents.js +3 -3
- package/dist/application/list-links.js +5 -5
- package/dist/application/migrate-vault.js +91 -0
- package/dist/application/search-graph-node-ids.js +12 -0
- package/dist/application/search-knowledge.js +75 -5
- package/dist/application/server/routes.js +27 -1
- package/dist/benchmarks/large-vault.js +1 -1
- package/dist/cli/commands/agent-commands.js +412 -0
- package/dist/cli/commands/config-commands.js +167 -0
- package/dist/cli/commands/read-commands.js +25 -8
- package/dist/cli/commands/write-commands.js +205 -4
- package/dist/cli/main.js +4 -0
- package/dist/cli/runtime.js +5 -2
- package/dist/domain/context.js +53 -11
- package/dist/domain/embeddings.js +2 -1
- package/dist/domain/graph-layout.js +20 -14
- package/dist/domain/markdown.js +36 -4
- package/dist/domain/middle-out.js +18 -0
- package/dist/infrastructure/config.js +94 -8
- package/dist/infrastructure/file-index.js +294 -0
- package/dist/infrastructure/file-system-vault.js +15 -0
- package/dist/infrastructure/paths.js +9 -1
- package/dist/infrastructure/private-pack-codec.js +73 -0
- package/dist/infrastructure/search-packs.js +348 -0
- package/dist/infrastructure/session-state.js +172 -0
- package/dist/mcp/main.js +11 -3
- package/dist/mcp/server.js +17 -2
- package/dist/mcp/startup.js +35 -0
- package/dist/mcp/tools.js +571 -19
- package/docs/AGENT_USAGE.md +112 -16
- package/docs/ARCHITECTURE.md +37 -26
- package/docs/QUICKSTART.md +111 -0
- package/package.json +2 -3
- package/dist/infrastructure/sqlite/document-writer.js +0 -51
- package/dist/infrastructure/sqlite/graph-reader.js +0 -120
- package/dist/infrastructure/sqlite/schema.js +0 -111
- package/dist/infrastructure/sqlite/search-reader.js +0 -156
- package/dist/infrastructure/sqlite/types.js +0 -1
- package/dist/infrastructure/sqlite-index.js +0 -25
|
@@ -1,10 +1,89 @@
|
|
|
1
|
+
import { stat } from 'node:fs/promises';
|
|
2
|
+
import { performance } from 'node:perf_hooks';
|
|
1
3
|
import { validateGraph, getBrokenLinks, getOrphanNodes, getVaultStats } from '../domain/graph-analysis.js';
|
|
2
|
-
import { ensureVault, readMarkdownFiles } from '../infrastructure/file-system-vault.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { ensureVault, listVaultFiles, readMarkdownFiles } from '../infrastructure/file-system-vault.js';
|
|
5
|
+
import { resolveAgentRuntimeDefaults } from '../infrastructure/config.js';
|
|
6
|
+
import { getGraphSummary } from './get-graph-summary.js';
|
|
7
|
+
import { buildContextPackage } from './build-context.js';
|
|
8
|
+
import { indexVault } from './index-vault.js';
|
|
9
|
+
import { searchKnowledge } from './search-knowledge.js';
|
|
10
|
+
import { loadBrainlinkConfig } from '../infrastructure/config.js';
|
|
11
|
+
export const getStats = async (vaultPath, agentId) => getVaultStats(await getGraphSummary(vaultPath, agentId));
|
|
12
|
+
export const getBrokenLinksReport = async (vaultPath, agentId) => getBrokenLinks(await getGraphSummary(vaultPath, agentId));
|
|
13
|
+
export const getOrphansReport = async (vaultPath, agentId) => getOrphanNodes(await getGraphSummary(vaultPath, agentId));
|
|
14
|
+
export const validateVault = async (vaultPath, agentId) => validateGraph(await getGraphSummary(vaultPath, agentId));
|
|
15
|
+
const toRatio = (part, total) => total === 0 ? 0 : Number((part / total).toFixed(4));
|
|
16
|
+
export const getExtendedStats = async (vaultPath, agentId) => {
|
|
17
|
+
const absoluteVaultPath = await ensureVault(vaultPath);
|
|
18
|
+
const graph = await getGraphSummary(absoluteVaultPath, agentId);
|
|
19
|
+
const stats = getVaultStats(graph);
|
|
20
|
+
const markdownFiles = await readMarkdownFiles(absoluteVaultPath);
|
|
21
|
+
const allFiles = await listVaultFiles(absoluteVaultPath);
|
|
22
|
+
const totalBytes = (await Promise.all(allFiles.map(async (filePath) => {
|
|
23
|
+
try {
|
|
24
|
+
return (await stat(filePath)).size;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
}))).reduce((sum, value) => sum + value, 0);
|
|
30
|
+
const updatedAt = markdownFiles
|
|
31
|
+
.map((file) => file.updatedAt.getTime())
|
|
32
|
+
.filter((time) => Number.isFinite(time))
|
|
33
|
+
.sort((left, right) => left - right);
|
|
34
|
+
const priorities = graph.edges.reduce((state, edge) => ({
|
|
35
|
+
...state,
|
|
36
|
+
[edge.priority]: state[edge.priority] + 1
|
|
37
|
+
}), {
|
|
38
|
+
low: 0,
|
|
39
|
+
normal: 0,
|
|
40
|
+
high: 0,
|
|
41
|
+
critical: 0
|
|
42
|
+
});
|
|
43
|
+
const config = await loadBrainlinkConfig();
|
|
44
|
+
const defaults = resolveAgentRuntimeDefaults(config, agentId);
|
|
45
|
+
const probeQuery = graph.nodes[0]?.title ?? 'architecture';
|
|
46
|
+
const indexStart = performance.now();
|
|
47
|
+
await indexVault(absoluteVaultPath);
|
|
48
|
+
const indexLatency = performance.now() - indexStart;
|
|
49
|
+
const searchStart = performance.now();
|
|
50
|
+
await searchKnowledge(absoluteVaultPath, probeQuery, Math.min(defaults.defaultSearchLimit, 8), agentId, 'hybrid');
|
|
51
|
+
const searchLatency = performance.now() - searchStart;
|
|
52
|
+
const contextStart = performance.now();
|
|
53
|
+
await buildContextPackage(absoluteVaultPath, probeQuery, Math.min(defaults.defaultSearchLimit, 8), defaults.defaultContextTokens, agentId, 'hybrid');
|
|
54
|
+
const contextLatency = performance.now() - contextStart;
|
|
55
|
+
return {
|
|
56
|
+
stats,
|
|
57
|
+
storage: {
|
|
58
|
+
markdownFileCount: markdownFiles.length,
|
|
59
|
+
totalFileCount: allFiles.length,
|
|
60
|
+
totalBytes,
|
|
61
|
+
averageMarkdownBytes: markdownFiles.length === 0
|
|
62
|
+
? 0
|
|
63
|
+
: Math.round(markdownFiles.reduce((sum, file) => sum + Buffer.byteLength(file.content, 'utf8'), 0) / markdownFiles.length),
|
|
64
|
+
...(updatedAt.length > 0
|
|
65
|
+
? {
|
|
66
|
+
oldestNoteUpdatedAt: new Date(updatedAt[0]).toISOString(),
|
|
67
|
+
newestNoteUpdatedAt: new Date(updatedAt[updatedAt.length - 1]).toISOString()
|
|
68
|
+
}
|
|
69
|
+
: {})
|
|
70
|
+
},
|
|
71
|
+
quality: {
|
|
72
|
+
resolvedLinkRatio: toRatio(stats.resolvedLinkCount, stats.linkCount),
|
|
73
|
+
brokenLinkRatio: toRatio(stats.brokenLinkCount, stats.linkCount),
|
|
74
|
+
orphanRatio: toRatio(stats.orphanCount, Math.max(stats.documentCount, 1)),
|
|
75
|
+
priorityDistribution: priorities
|
|
76
|
+
},
|
|
77
|
+
observability: {
|
|
78
|
+
probeQuery,
|
|
79
|
+
latenciesMs: {
|
|
80
|
+
index: Number(indexLatency.toFixed(2)),
|
|
81
|
+
search: Number(searchLatency.toFixed(2)),
|
|
82
|
+
context: Number(contextLatency.toFixed(2))
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
8
87
|
const createCheck = (name, ok, message) => ({
|
|
9
88
|
name,
|
|
10
89
|
ok,
|
|
@@ -13,7 +92,7 @@ const createCheck = (name, ok, message) => ({
|
|
|
13
92
|
export const doctorVault = async (vaultPath) => {
|
|
14
93
|
const absoluteVaultPath = await ensureVault(vaultPath);
|
|
15
94
|
const files = await readMarkdownFiles(absoluteVaultPath);
|
|
16
|
-
const graph = await
|
|
95
|
+
const graph = await getGraphSummary(absoluteVaultPath);
|
|
17
96
|
const validation = validateGraph(graph);
|
|
18
97
|
const checks = [
|
|
19
98
|
createCheck('vault', true, `Vault ready at ${absoluteVaultPath}`),
|
|
@@ -21,8 +100,16 @@ export const doctorVault = async (vaultPath) => {
|
|
|
21
100
|
createCheck('index', graph.nodes.length > 0, `${graph.nodes.length} indexed documents found`),
|
|
22
101
|
createCheck('broken-links', validation.brokenLinks.length === 0, `${validation.brokenLinks.length} broken links found`)
|
|
23
102
|
];
|
|
103
|
+
const recommendations = files.length === 0 && graph.nodes.length === 0
|
|
104
|
+
? [
|
|
105
|
+
`Vault is empty. Add your first note: blink add "Architecture" --vault "${absoluteVaultPath}" --content "Markdown source of truth. #architecture"`,
|
|
106
|
+
`If this path is not the expected vault, inspect active config: blink config where`,
|
|
107
|
+
`If you changed vault recently, migrate existing memory: blink migrate-vault --from ~/.brainlink/vault --to "${absoluteVaultPath}"`
|
|
108
|
+
]
|
|
109
|
+
: [];
|
|
24
110
|
return {
|
|
25
111
|
ok: checks.every((check) => check.ok),
|
|
26
|
-
checks
|
|
112
|
+
checks,
|
|
113
|
+
...(recommendations.length > 0 ? { recommendations } : {})
|
|
27
114
|
};
|
|
28
115
|
};
|
|
@@ -25,6 +25,13 @@ body {
|
|
|
25
25
|
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
body {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
min-height: 100vh;
|
|
32
|
+
min-height: 100dvh;
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
button,
|
|
29
36
|
input,
|
|
30
37
|
select {
|
|
@@ -32,19 +39,44 @@ select {
|
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
.shell {
|
|
35
|
-
|
|
36
|
-
grid-template-columns: minmax(0, 1fr) 360px;
|
|
42
|
+
flex: 1 1 auto;
|
|
37
43
|
width: 100%;
|
|
38
|
-
height:
|
|
44
|
+
min-height: 0;
|
|
39
45
|
overflow: hidden;
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
.workspace {
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
43
51
|
position: relative;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
44
54
|
min-width: 0;
|
|
45
55
|
min-height: 0;
|
|
46
56
|
}
|
|
47
57
|
|
|
58
|
+
.graph-header {
|
|
59
|
+
z-index: 5;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: 12px;
|
|
63
|
+
min-height: 72px;
|
|
64
|
+
padding: 10px 16px;
|
|
65
|
+
border-bottom: 1px solid var(--line);
|
|
66
|
+
background: linear-gradient(180deg, rgba(17, 21, 27, 0.96) 0%, rgba(17, 21, 27, 0.86) 100%);
|
|
67
|
+
backdrop-filter: blur(8px);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.brand-block {
|
|
71
|
+
display: grid;
|
|
72
|
+
gap: 2px;
|
|
73
|
+
min-width: max-content;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.brand-block strong {
|
|
77
|
+
font-size: 18px;
|
|
78
|
+
}
|
|
79
|
+
|
|
48
80
|
#graph {
|
|
49
81
|
display: block;
|
|
50
82
|
width: 100%;
|
|
@@ -59,43 +91,25 @@ select {
|
|
|
59
91
|
cursor: grabbing;
|
|
60
92
|
}
|
|
61
93
|
|
|
62
|
-
.
|
|
63
|
-
position: absolute;
|
|
64
|
-
top: 18px;
|
|
65
|
-
left: 18px;
|
|
66
|
-
right: 18px;
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
justify-content: space-between;
|
|
70
|
-
gap: 18px;
|
|
71
|
-
pointer-events: none;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.topbar > div {
|
|
75
|
-
display: flex;
|
|
76
|
-
align-items: baseline;
|
|
77
|
-
gap: 12px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.topbar strong {
|
|
81
|
-
font-size: 18px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.topbar span,
|
|
85
|
-
.eyebrow,
|
|
86
|
-
.inspector small {
|
|
94
|
+
.eyebrow {
|
|
87
95
|
color: var(--muted);
|
|
88
96
|
font-size: 12px;
|
|
89
97
|
}
|
|
90
98
|
|
|
91
99
|
.search {
|
|
92
|
-
|
|
93
|
-
|
|
100
|
+
flex: 1 1 320px;
|
|
101
|
+
min-width: 220px;
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
.agent-filter {
|
|
97
105
|
width: min(220px, 28vw);
|
|
98
|
-
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.header-actions {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: 10px;
|
|
112
|
+
margin-left: auto;
|
|
99
113
|
}
|
|
100
114
|
|
|
101
115
|
.search input,
|
|
@@ -116,9 +130,6 @@ select {
|
|
|
116
130
|
}
|
|
117
131
|
|
|
118
132
|
.toolbar {
|
|
119
|
-
position: absolute;
|
|
120
|
-
left: 18px;
|
|
121
|
-
bottom: 18px;
|
|
122
133
|
display: flex;
|
|
123
134
|
gap: 8px;
|
|
124
135
|
}
|
|
@@ -138,70 +149,34 @@ select {
|
|
|
138
149
|
color: var(--accent);
|
|
139
150
|
}
|
|
140
151
|
|
|
141
|
-
.
|
|
142
|
-
display:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
min-width: 0;
|
|
146
|
-
height: 100%;
|
|
147
|
-
padding: 24px;
|
|
148
|
-
border-left: 1px solid var(--line);
|
|
149
|
-
background: var(--panel);
|
|
150
|
-
overflow: auto;
|
|
152
|
+
.floating-metrics {
|
|
153
|
+
display: flex;
|
|
154
|
+
gap: 10px;
|
|
155
|
+
flex-wrap: wrap;
|
|
151
156
|
}
|
|
152
157
|
|
|
153
|
-
.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
.metric-chip {
|
|
159
|
+
min-width: 94px;
|
|
160
|
+
padding: 10px 12px;
|
|
161
|
+
border: 1px solid var(--line);
|
|
162
|
+
border-radius: 10px;
|
|
163
|
+
background: rgba(21, 25, 31, 0.88);
|
|
164
|
+
display: grid;
|
|
165
|
+
gap: 3px;
|
|
157
166
|
}
|
|
158
167
|
|
|
159
|
-
.
|
|
160
|
-
margin-top: 6px;
|
|
168
|
+
.metric-chip strong {
|
|
161
169
|
font-size: 26px;
|
|
162
|
-
line-height: 1
|
|
163
|
-
overflow-wrap: anywhere;
|
|
170
|
+
line-height: 1;
|
|
164
171
|
}
|
|
165
172
|
|
|
166
|
-
.
|
|
167
|
-
margin-bottom: 10px;
|
|
173
|
+
.metric-chip small {
|
|
168
174
|
color: var(--muted);
|
|
169
|
-
font-size:
|
|
170
|
-
|
|
175
|
+
font-size: 11px;
|
|
176
|
+
letter-spacing: 0.03em;
|
|
171
177
|
text-transform: uppercase;
|
|
172
178
|
}
|
|
173
179
|
|
|
174
|
-
#path {
|
|
175
|
-
margin-top: 10px;
|
|
176
|
-
color: var(--muted);
|
|
177
|
-
line-height: 1.45;
|
|
178
|
-
overflow-wrap: anywhere;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.metrics {
|
|
182
|
-
display: grid;
|
|
183
|
-
grid-template-columns: repeat(3, 1fr);
|
|
184
|
-
border: 1px solid var(--line);
|
|
185
|
-
border-radius: 8px;
|
|
186
|
-
overflow: hidden;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.metrics div {
|
|
190
|
-
display: grid;
|
|
191
|
-
gap: 4px;
|
|
192
|
-
padding: 14px;
|
|
193
|
-
background: var(--panel-strong);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.metrics div + div {
|
|
197
|
-
border-left: 1px solid var(--line);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.metrics span {
|
|
201
|
-
font-size: 22px;
|
|
202
|
-
font-weight: 700;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
180
|
.tags {
|
|
206
181
|
display: flex;
|
|
207
182
|
flex-wrap: wrap;
|
|
@@ -215,6 +190,7 @@ select {
|
|
|
215
190
|
background: var(--accent-weak);
|
|
216
191
|
color: var(--accent);
|
|
217
192
|
font-size: 12px;
|
|
193
|
+
word-break: break-word;
|
|
218
194
|
overflow-wrap: anywhere;
|
|
219
195
|
}
|
|
220
196
|
|
|
@@ -230,6 +206,7 @@ li {
|
|
|
230
206
|
padding: 10px 0;
|
|
231
207
|
border-bottom: 1px solid var(--line);
|
|
232
208
|
color: var(--text);
|
|
209
|
+
word-break: break-word;
|
|
233
210
|
overflow-wrap: anywhere;
|
|
234
211
|
}
|
|
235
212
|
|
|
@@ -253,7 +230,7 @@ li small {
|
|
|
253
230
|
}
|
|
254
231
|
|
|
255
232
|
.note-content {
|
|
256
|
-
max-height:
|
|
233
|
+
max-height: min(68svh, 760px);
|
|
257
234
|
margin: 0;
|
|
258
235
|
padding: 12px;
|
|
259
236
|
border: 1px solid var(--line);
|
|
@@ -267,28 +244,165 @@ li small {
|
|
|
267
244
|
line-height: 1.5;
|
|
268
245
|
}
|
|
269
246
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
247
|
+
.content-dialog {
|
|
248
|
+
width: min(920px, calc(100vw - 32px));
|
|
249
|
+
max-height: calc(100svh - 32px);
|
|
250
|
+
padding: 0;
|
|
251
|
+
border: 1px solid var(--line);
|
|
252
|
+
border-radius: 8px;
|
|
253
|
+
background: var(--panel);
|
|
254
|
+
color: var(--text);
|
|
255
|
+
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
|
|
256
|
+
}
|
|
275
257
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
258
|
+
.content-dialog::backdrop {
|
|
259
|
+
background: rgba(4, 7, 10, 0.72);
|
|
260
|
+
backdrop-filter: blur(4px);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.content-dialog article {
|
|
264
|
+
display: grid;
|
|
265
|
+
grid-template-rows: auto auto minmax(0, 1fr);
|
|
266
|
+
max-height: calc(100svh - 34px);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.content-dialog header {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: flex-start;
|
|
272
|
+
justify-content: space-between;
|
|
273
|
+
gap: 18px;
|
|
274
|
+
padding: 22px;
|
|
275
|
+
border-bottom: 1px solid var(--line);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.content-dialog h2,
|
|
279
|
+
.content-dialog p {
|
|
280
|
+
margin: 0;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.content-dialog h2 {
|
|
284
|
+
margin-top: 6px;
|
|
285
|
+
font-size: 24px;
|
|
286
|
+
line-height: 1.15;
|
|
287
|
+
overflow-wrap: anywhere;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.content-dialog p {
|
|
291
|
+
margin-top: 8px;
|
|
292
|
+
color: var(--muted);
|
|
293
|
+
overflow-wrap: anywhere;
|
|
294
|
+
}
|
|
281
295
|
|
|
282
|
-
|
|
296
|
+
.content-dialog button {
|
|
297
|
+
flex: 0 0 auto;
|
|
298
|
+
height: 38px;
|
|
299
|
+
padding: 0 14px;
|
|
300
|
+
border: 1px solid var(--line);
|
|
301
|
+
border-radius: 8px;
|
|
302
|
+
background: var(--panel-strong);
|
|
303
|
+
color: var(--text);
|
|
304
|
+
cursor: pointer;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.content-dialog button:hover,
|
|
308
|
+
.content-dialog button:focus {
|
|
309
|
+
border-color: var(--accent);
|
|
310
|
+
color: var(--accent);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.content-meta {
|
|
314
|
+
display: grid;
|
|
315
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
316
|
+
gap: 10px;
|
|
317
|
+
padding: 14px 22px;
|
|
318
|
+
border-bottom: 1px solid var(--line);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.content-meta-section {
|
|
322
|
+
min-height: 0;
|
|
323
|
+
padding: 10px;
|
|
324
|
+
border: 1px solid var(--line);
|
|
325
|
+
border-radius: 8px;
|
|
326
|
+
background: var(--panel-strong);
|
|
327
|
+
display: grid;
|
|
328
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
329
|
+
gap: 8px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.content-meta-section h3 {
|
|
333
|
+
margin: 0;
|
|
334
|
+
color: var(--muted);
|
|
335
|
+
font-size: 11px;
|
|
336
|
+
font-weight: 700;
|
|
337
|
+
text-transform: uppercase;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.content-meta-section ul,
|
|
341
|
+
.content-meta-section .tags {
|
|
342
|
+
max-height: 140px;
|
|
343
|
+
overflow: auto;
|
|
344
|
+
align-content: flex-start;
|
|
345
|
+
padding-right: 4px;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.content-dialog .note-content {
|
|
349
|
+
max-height: none;
|
|
350
|
+
min-height: 0;
|
|
351
|
+
border: 0;
|
|
352
|
+
border-radius: 0;
|
|
353
|
+
padding: 22px;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.app-footer {
|
|
357
|
+
flex: 0 0 28px;
|
|
358
|
+
height: 28px;
|
|
359
|
+
display: flex;
|
|
360
|
+
align-items: center;
|
|
361
|
+
justify-content: center;
|
|
362
|
+
background: transparent;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.app-footer small {
|
|
366
|
+
color: var(--muted);
|
|
367
|
+
font-size: 11px;
|
|
368
|
+
letter-spacing: 0.02em;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@media (max-width: 860px) {
|
|
372
|
+
.graph-header {
|
|
283
373
|
align-items: stretch;
|
|
284
|
-
flex-
|
|
374
|
+
flex-wrap: wrap;
|
|
375
|
+
padding: 10px 12px;
|
|
376
|
+
min-height: 0;
|
|
285
377
|
}
|
|
286
378
|
|
|
287
379
|
.search {
|
|
288
380
|
width: 100%;
|
|
381
|
+
flex-basis: 100%;
|
|
382
|
+
order: 3;
|
|
289
383
|
}
|
|
290
384
|
|
|
291
385
|
.agent-filter {
|
|
292
386
|
width: 100%;
|
|
293
387
|
}
|
|
388
|
+
|
|
389
|
+
.header-actions {
|
|
390
|
+
width: 100%;
|
|
391
|
+
margin-left: 0;
|
|
392
|
+
justify-content: space-between;
|
|
393
|
+
order: 4;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.content-dialog header {
|
|
397
|
+
align-items: stretch;
|
|
398
|
+
flex-direction: column;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.metric-chip {
|
|
402
|
+
min-width: 82px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.content-meta {
|
|
406
|
+
grid-template-columns: 1fr;
|
|
407
|
+
}
|
|
294
408
|
}`;
|
|
@@ -9,58 +9,73 @@ export const createClientHtml = () => `<!doctype html>
|
|
|
9
9
|
<body>
|
|
10
10
|
<main class="shell">
|
|
11
11
|
<section class="workspace" aria-label="Knowledge graph">
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
<div>
|
|
12
|
+
<header class="graph-header" aria-label="Graph actions">
|
|
13
|
+
<div class="brand-block">
|
|
15
14
|
<strong>Brainlink</strong>
|
|
16
|
-
<span
|
|
15
|
+
<span class="eyebrow">Knowledge Graph</span>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="floating-metrics" aria-label="Graph totals">
|
|
18
|
+
<div class="metric-chip">
|
|
19
|
+
<strong id="nodeCount">0</strong>
|
|
20
|
+
<small>Notes</small>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="metric-chip">
|
|
23
|
+
<strong id="edgeCount">0</strong>
|
|
24
|
+
<small>Links</small>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="metric-chip">
|
|
27
|
+
<strong id="tagCount">0</strong>
|
|
28
|
+
<small>Tags</small>
|
|
29
|
+
</div>
|
|
17
30
|
</div>
|
|
18
31
|
<label class="search">
|
|
19
32
|
<input id="search" type="search" placeholder="Filter notes, tags or paths" autocomplete="off" />
|
|
20
33
|
</label>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
<div class="header-actions">
|
|
35
|
+
<label class="agent-filter">
|
|
36
|
+
<select id="agent"></select>
|
|
37
|
+
</label>
|
|
38
|
+
<div class="toolbar" aria-label="Graph controls">
|
|
39
|
+
<button id="zoomIn" type="button" title="Zoom in">+</button>
|
|
40
|
+
<button id="zoomOut" type="button" title="Zoom out">-</button>
|
|
41
|
+
<button id="fit" type="button" title="Fit visible nodes">◎</button>
|
|
42
|
+
<button id="reset" type="button" title="Reset view">⌂</button>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</header>
|
|
46
|
+
<canvas id="graph" aria-label="Brainlink knowledge graph"></canvas>
|
|
30
47
|
</section>
|
|
31
|
-
<aside class="inspector" aria-label="Selected note">
|
|
32
|
-
<div>
|
|
33
|
-
<span class="eyebrow">Selected note</span>
|
|
34
|
-
<h1 id="title">Graph Overview</h1>
|
|
35
|
-
<p id="path">Select a node to inspect links and backlinks.</p>
|
|
36
|
-
</div>
|
|
37
|
-
<div class="metrics">
|
|
38
|
-
<div><span id="nodeCount">0</span><small>Notes</small></div>
|
|
39
|
-
<div><span id="edgeCount">0</span><small>Links</small></div>
|
|
40
|
-
<div><span id="tagCount">0</span><small>Tags</small></div>
|
|
41
|
-
</div>
|
|
42
|
-
<section>
|
|
43
|
-
<h2>Tags</h2>
|
|
44
|
-
<div id="tags" class="tags"></div>
|
|
45
|
-
</section>
|
|
46
|
-
<section>
|
|
47
|
-
<h2>Notes</h2>
|
|
48
|
-
<ul id="notes"></ul>
|
|
49
|
-
</section>
|
|
50
|
-
<section>
|
|
51
|
-
<h2>Content</h2>
|
|
52
|
-
<pre id="content" class="note-content"></pre>
|
|
53
|
-
</section>
|
|
54
|
-
<section>
|
|
55
|
-
<h2>Outgoing</h2>
|
|
56
|
-
<ul id="outgoing"></ul>
|
|
57
|
-
</section>
|
|
58
|
-
<section>
|
|
59
|
-
<h2>Backlinks</h2>
|
|
60
|
-
<ul id="incoming"></ul>
|
|
61
|
-
</section>
|
|
62
|
-
</aside>
|
|
63
48
|
</main>
|
|
49
|
+
<footer class="app-footer" aria-label="License notice">
|
|
50
|
+
<small>MIT License · Copyright © 2026 Anderson Espindola</small>
|
|
51
|
+
</footer>
|
|
52
|
+
<dialog id="contentDialog" class="content-dialog" aria-labelledby="contentTitle">
|
|
53
|
+
<article>
|
|
54
|
+
<header>
|
|
55
|
+
<div>
|
|
56
|
+
<span class="eyebrow">Markdown content</span>
|
|
57
|
+
<h2 id="contentTitle">Selected note</h2>
|
|
58
|
+
<p id="contentPath"></p>
|
|
59
|
+
</div>
|
|
60
|
+
<button id="contentClose" type="button">Close</button>
|
|
61
|
+
</header>
|
|
62
|
+
<div class="content-meta">
|
|
63
|
+
<section class="content-meta-section">
|
|
64
|
+
<h3>Tags</h3>
|
|
65
|
+
<div id="contentTags" class="tags"></div>
|
|
66
|
+
</section>
|
|
67
|
+
<section class="content-meta-section">
|
|
68
|
+
<h3>Outgoing</h3>
|
|
69
|
+
<ul id="contentOutgoing"></ul>
|
|
70
|
+
</section>
|
|
71
|
+
<section class="content-meta-section">
|
|
72
|
+
<h3>Backlinks</h3>
|
|
73
|
+
<ul id="contentIncoming"></ul>
|
|
74
|
+
</section>
|
|
75
|
+
</div>
|
|
76
|
+
<pre id="contentBody" class="note-content"></pre>
|
|
77
|
+
</article>
|
|
78
|
+
</dialog>
|
|
64
79
|
<script src="/app.js"></script>
|
|
65
80
|
</body>
|
|
66
81
|
</html>`;
|