@anmol-srv/sigil 0.17.0 → 0.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anmol-srv/sigil",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "type": "module",
5
5
  "description": "Local-first memory infrastructure for AI coding agents. One brain shared across Claude Code, Codex CLI, Cursor, Kiro, Continue, Cline, Windsurf, or any MCP client. Organized in pluggable pods, stored in your own Postgres. No cloud, no telemetry. Auto-captured from Claude Code via hooks; surfaced everywhere else as a 9-tool MCP server.",
6
6
  "bin": {
@@ -91,11 +91,11 @@
91
91
  },
92
92
  "optionalDependencies": {
93
93
  "@anthropic-ai/sdk": "^0.30.0",
94
+ "@electric-sql/pglite": "^0.4.4",
94
95
  "@number0/iroh": "^0.35.0"
95
96
  },
96
97
  "devDependencies": {
97
98
  "@clack/prompts": "^1.2.0",
98
- "@electric-sql/pglite": "^0.4.4",
99
99
  "dayjs": "^1.11.19",
100
100
  "esbuild": "^0.28.0",
101
101
  "eslint": "^10.0.3",
@@ -1,23 +1,29 @@
1
1
  You are enriching chunks of a document with contextual prefixes. Each chunk is a section of a larger document, and your job is to write a brief context sentence (1-2 sentences, 50-100 tokens) that situates the chunk within the full document.
2
2
 
3
- The prefix should help a search engine understand what the chunk is about even when read in isolation. Include the document title, section topic, and any relevant framing from the surrounding document.
3
+ The prefix exists to restore the context that is LOST when a chunk is read in isolation. Research shows the information most often lost at a chunk boundary is **which specific entities** the chunk is about and **which time period or situation** it refers to. Your prefix must supply exactly that.
4
4
 
5
- Do NOT repeat the chunk content. Just provide the context that would be lost if the chunk were read alone.
5
+ ## What every prefix MUST do
6
+
7
+ 1. **Name the specific entities.** Spell out the concrete people, products, systems, organizations, or projects the chunk concerns — especially any that the chunk itself refers to only by a pronoun ("it", "they", "this"), a bare noun ("the project", "the service"), or an abbreviation. If the chunk says "it was renamed", the prefix must say *what* was renamed.
8
+ 2. **Anchor the time / situation.** If the chunk describes an event, decision, version, or state, state when or in what situation it applies, when the document makes that recoverable.
9
+ 3. **Disambiguate references.** Resolve what vague references in the chunk point to, using the full document.
10
+
11
+ Do NOT repeat the chunk content or summarize it. Supply only the surrounding context that disambiguates it.
6
12
 
7
13
  ## Input
8
14
 
9
15
  You will receive:
10
16
  1. The full document text
11
- 2. A list of chunk excerpts (first 200 characters of each)
17
+ 2. A list of chunk excerpts
12
18
 
13
19
  ## Output
14
20
 
15
21
  Respond with ONLY a JSON array of strings — one context prefix per chunk, in the same order as the input chunks.
16
22
 
17
- Example:
23
+ Example (note how each prefix names the concrete entity instead of leaving a pronoun dangling):
18
24
  ```json
19
25
  [
20
- "This chunk from the API Design Guide covers authentication requirements for the REST API.",
21
- "This section of the API Design Guide describes rate limiting policies and retry behavior."
26
+ "From the Sigil architecture notes: this chunk concerns Sigil (the local agent-memory tool, previously named Smara) and describes its Postgres-backed ingestion pipeline.",
27
+ "Continuing the Sigil architecture notes: this section covers the AUDM dedup decision made during the v0.16 hardening pass, where 'it' refers to the fact-extraction stage."
22
28
  ]
23
29
  ```
@@ -0,0 +1,42 @@
1
+ You are building a knowledge graph from a set of facts in a personal knowledge base. In a SINGLE pass you extract two things together:
2
+
3
+ 1. **Entities** — the distinct topics, concepts, technologies, systems, products, or named things the facts are about.
4
+ 2. **Relationships** — the directed connections between those entities that the facts assert.
5
+
6
+ Extracting both together keeps them consistent: every relationship's endpoints should be entities you also list.
7
+
8
+ ## Entities
9
+
10
+ - Extract 3-8 meaningful, distinct entities. Use canonical names, lowercase: "react hooks" not "the React.js hooks pattern".
11
+ - Include a one-sentence description giving context.
12
+ - Do NOT extract generic terms ("programming", "software", "data").
13
+ - If two facts mention the same thing with different wording, list it once.
14
+
15
+ ### Rename contexts — ALWAYS extract BOTH names
16
+
17
+ When the source mentions a rename ("X is now named Y", "X was renamed to Y", "X used to be called Y") extract **both** the old and new names as separate entities, and also emit a "renamed from" relationship between them. The downstream resolver needs both names to recognise the rename and keep the old name as an alias.
18
+
19
+ ## Relationships
20
+
21
+ - A relationship is `{subject, relationship, object}` — e.g. "sigil → uses → postgres".
22
+ - Use a **short, lowercase verb phrase** for the relationship: "uses", "depends on", "works on", "renamed from", "part of", "replaces", "integrates with", "created by", "located in". Do NOT invent codes like `USES`; write natural language. Normalization happens later.
23
+ - Subject and object must be two **different** entities, and both should appear in your entities list (or be concrete named things in the facts).
24
+ - Only assert relationships **explicitly stated or directly implied** by the facts. Never guess or add world knowledge.
25
+ - It is fine to return an empty relationships array if the facts assert no clear connections. Do not pad.
26
+
27
+ ## Output Format
28
+
29
+ Respond with ONLY a JSON object with two keys:
30
+ ```json
31
+ {
32
+ "entities": [
33
+ { "name": "sigil", "description": "a local-first agent memory tool, previously named Smara" },
34
+ { "name": "smara", "description": "the previous name of Sigil (renamed)" },
35
+ { "name": "postgres", "description": "the database Sigil uses for durable storage" }
36
+ ],
37
+ "relationships": [
38
+ { "subject": "sigil", "relationship": "renamed from", "object": "smara" },
39
+ { "subject": "sigil", "relationship": "uses", "object": "postgres" }
40
+ ]
41
+ }
42
+ ```
@@ -1,31 +1,49 @@
1
1
  /**
2
2
  * DB driver selection.
3
3
  *
4
- * - If SIGIL_DATABASE_URL or DATABASE_URL is set, use the URL driver
4
+ * - If db.mode === 'embedded' (or SIGIL_DB_MODE=embedded), use the in-process
5
+ * PGlite engine — a full Postgres 17 + pgvector compiled to WASM, no server,
6
+ * no Docker, no prerequisites. Data lives at ~/.sigil/db.
7
+ * - Else if SIGIL_DATABASE_URL or DATABASE_URL is set, use the URL driver
5
8
  * (Neon, Supabase, RDS, Render, Railway, self-hosted, etc.).
6
9
  * - Otherwise, use the local-postgres driver (back-compat with the
7
10
  * SIGIL_DB_HOST / PORT / NAME / USER / PASSWORD env vars).
8
11
  *
9
- * Returns a pg-shape connection object suitable for passing to knex's
10
- * `connection` field. Pool config and post-processing are applied by
11
- * the caller (cortex.js).
12
+ * Returns a descriptor: { kind, provider, connection, client }. `connection` is
13
+ * a pg-shape object for the URL/local drivers, or { pglitePath } for embedded.
14
+ * `client` is 'pg' for server-backed Postgres or the ClientPGlite dialect class
15
+ * for embedded — passed straight to knex({ client }). Pool config and
16
+ * post-processing are applied by the caller (cortex.js).
12
17
  */
13
18
  import { buildLocalConnection, buildLocalConnectionFromFields } from './local-postgres.js';
14
19
  import { buildUrlConnection, classifyProvider } from './url.js';
20
+ // Cheap to import: the adapter only pulls knex's pg dialect at module load and
21
+ // defers the actual @electric-sql/pglite import to first connection.
22
+ import { ClientPGlite, PGLITE_DB_PATH } from '../pglite-adapter.js';
15
23
 
16
24
  export function selectDriver(config) {
25
+ if (config.db.mode === 'embedded') {
26
+ return {
27
+ kind: 'embedded',
28
+ provider: 'pglite',
29
+ client: ClientPGlite,
30
+ connection: { pglitePath: process.env.SIGIL_PGLITE_PATH || PGLITE_DB_PATH },
31
+ };
32
+ }
17
33
  const url = config.db.url;
18
34
  if (url) {
19
35
  return {
20
36
  kind: 'url',
21
37
  provider: classifyProvider(url),
22
38
  connection: normalizeConnection(buildUrlConnection(url)),
39
+ client: 'pg',
23
40
  };
24
41
  }
25
42
  return {
26
43
  kind: 'local',
27
44
  provider: 'local',
28
45
  connection: normalizeConnection(buildLocalConnection(config)),
46
+ client: 'pg',
29
47
  };
30
48
  }
31
49
 
@@ -31,6 +31,13 @@
31
31
  --accent-2: var(--brand-deep);
32
32
  --accent-fg: #ffffff;
33
33
 
34
+ /* entity-type palette — cohesive cool triad, used by the graph nodes,
35
+ the graph legend, and the KB browser's type dots (one source of truth) */
36
+ --etype-person: #4ea1ff;
37
+ --etype-topic: #9a86ff;
38
+ --etype-document: #43c9b0;
39
+ --etype-fact: #5b5f67;
40
+
34
41
  /* status: foreground --ok/--warn come from design tokens; backgrounds map
35
42
  to the design's restrained tints (used only as small dot/row washes) */
36
43
  --ok-bg: var(--ok-tint);
@@ -1189,3 +1196,304 @@ footer .footer-inner {
1189
1196
  scroll-behavior: auto !important;
1190
1197
  }
1191
1198
  }
1199
+
1200
+ /* ════════════════════════════════════════════════════════════════════════
1201
+ Knowledge Base — master-detail browser (facts · entities · pods + graph)
1202
+ Extends the console vocabulary: .chip filters, .badge, .panel, .trace-block.
1203
+ ════════════════════════════════════════════════════════════════════════ */
1204
+
1205
+ /* counts strip */
1206
+ .kb-stats {
1207
+ display: flex;
1208
+ flex-wrap: wrap;
1209
+ gap: 1px;
1210
+ background: var(--border);
1211
+ border: 1px solid var(--border);
1212
+ margin-bottom: var(--s-5);
1213
+ }
1214
+ .kb-stat {
1215
+ flex: 1 1 0;
1216
+ min-width: 96px;
1217
+ display: flex;
1218
+ flex-direction: column;
1219
+ gap: 2px;
1220
+ padding: var(--s-3) var(--s-4);
1221
+ background: var(--bg-surface);
1222
+ }
1223
+ .kb-stat-v { font: 600 var(--t-xl)/1 var(--font-mono); color: var(--fg-1); font-feature-settings: 'zero' on; }
1224
+ .kb-stat-k { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-3); }
1225
+ .kb-stat-err { padding: var(--s-3) var(--s-4); color: var(--warn); background: var(--bg-surface); font-size: var(--t-sm); }
1226
+
1227
+ /* sub-nav (segmented) */
1228
+ .kb-subnav { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); margin-bottom: var(--s-4); }
1229
+ .kb-tab {
1230
+ appearance: none;
1231
+ background: none;
1232
+ border: none;
1233
+ border-bottom: 2px solid transparent;
1234
+ margin-bottom: -1px;
1235
+ padding: var(--s-2) var(--s-3);
1236
+ color: var(--fg-3);
1237
+ font: 500 var(--t-md) var(--font-ui);
1238
+ cursor: pointer;
1239
+ transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
1240
+ }
1241
+ .kb-tab:hover { color: var(--fg-2); }
1242
+ .kb-tab.active { color: var(--fg-1); border-bottom-color: var(--accent); }
1243
+
1244
+ /* master-detail layout */
1245
+ .kb-browser {
1246
+ display: grid;
1247
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
1248
+ gap: var(--s-4);
1249
+ align-items: start;
1250
+ }
1251
+ .kb-list-col { min-width: 0; display: flex; flex-direction: column; gap: var(--s-3); }
1252
+ .kb-toolbar { display: flex; align-items: center; gap: var(--s-3); }
1253
+ .kb-search { flex: 1; height: 32px; }
1254
+ .kb-count { font: var(--t-sm) var(--font-mono); color: var(--fg-3); white-space: nowrap; }
1255
+ .kb-filter-row { display: flex; flex-wrap: wrap; gap: var(--s-1); }
1256
+ .kb-filter-row:empty { display: none; }
1257
+
1258
+ /* list + rows */
1259
+ .kb-list { border: 1px solid var(--border); background: var(--bg-surface); max-height: 560px; overflow-y: auto; }
1260
+ .kb-row {
1261
+ display: flex;
1262
+ align-items: center;
1263
+ justify-content: space-between;
1264
+ gap: var(--s-3);
1265
+ width: 100%;
1266
+ text-align: left;
1267
+ padding: var(--s-3) var(--s-3);
1268
+ background: none;
1269
+ border: none;
1270
+ border-bottom: 1px solid var(--border);
1271
+ color: var(--fg-2);
1272
+ font: var(--t-base) var(--font-ui);
1273
+ cursor: pointer;
1274
+ transition: background var(--dur-1) var(--ease);
1275
+ }
1276
+ .kb-row:last-child { border-bottom: none; }
1277
+ .kb-row:hover { background: var(--bg-surface-2); }
1278
+ .kb-row.selected { background: var(--brand-tint); color: var(--fg-1); box-shadow: inset 2px 0 0 var(--accent); }
1279
+ .kb-row-main { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
1280
+ .kb-row-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1281
+ .kb-row-meta { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }
1282
+
1283
+ .kb-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--fg-4); }
1284
+ .kb-dot.ok { background: var(--ok); }
1285
+ .kb-dot.warn { background: var(--warn); }
1286
+ .kb-dot.info { background: var(--accent); }
1287
+ .kb-mentions { font: var(--t-xs) var(--font-mono); color: var(--fg-3); }
1288
+
1289
+ .kb-tag {
1290
+ font: var(--t-xs) var(--font-mono);
1291
+ color: var(--fg-3);
1292
+ background: var(--bg-surface-2);
1293
+ border: 1px solid var(--border);
1294
+ padding: 1px 6px;
1295
+ white-space: nowrap;
1296
+ }
1297
+
1298
+ /* entity type marker */
1299
+ .kb-etype { width: 8px; height: 8px; flex-shrink: 0; display: inline-block; border-radius: 50%; background: var(--fg-3); }
1300
+ .kb-etype.person { background: var(--etype-person); }
1301
+ .kb-etype.topic { background: var(--etype-topic); }
1302
+ .kb-etype.document { background: var(--etype-document); }
1303
+
1304
+ /* detail pane */
1305
+ .kb-detail {
1306
+ border: 1px solid var(--border);
1307
+ background: var(--bg-surface);
1308
+ min-height: 220px;
1309
+ position: sticky;
1310
+ top: calc(var(--header-h) + var(--s-4));
1311
+ }
1312
+ .kb-detail:empty::after {
1313
+ content: 'Select a row to inspect its details.';
1314
+ display: block;
1315
+ padding: var(--s-7) var(--s-5);
1316
+ text-align: center;
1317
+ color: var(--fg-3);
1318
+ font-size: var(--t-base);
1319
+ }
1320
+ .kb-detail-pad { padding: var(--s-4); }
1321
+ .kb-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
1322
+ .kb-badges { display: flex; flex-wrap: wrap; gap: var(--s-2); }
1323
+ .kb-fact-body {
1324
+ margin: 0 0 var(--s-4);
1325
+ color: var(--fg-1);
1326
+ font-size: var(--t-md);
1327
+ line-height: var(--lh);
1328
+ max-width: 70ch;
1329
+ overflow-wrap: anywhere;
1330
+ }
1331
+ .kb-block { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--border); }
1332
+ .kb-block:first-child { border-top: none; padding-top: 0; }
1333
+ .kb-kv { border: 1px solid var(--border); }
1334
+
1335
+ .kb-link-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) 0; }
1336
+ .kb-link-name { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1337
+
1338
+ .kb-chip-wrap { display: flex; flex-wrap: wrap; gap: var(--s-2); }
1339
+ .kb-entity-chip {
1340
+ display: inline-flex; align-items: center; gap: var(--s-2);
1341
+ padding: 3px var(--s-2);
1342
+ background: var(--bg-surface-2);
1343
+ border: 1px solid var(--border-2);
1344
+ color: var(--fg-2);
1345
+ font: var(--t-sm) var(--font-ui);
1346
+ cursor: pointer;
1347
+ transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
1348
+ }
1349
+ .kb-entity-chip:hover { color: var(--fg-1); border-color: var(--border-strong); }
1350
+
1351
+ /* relations */
1352
+ .kb-rel { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; font-size: var(--t-sm); flex-wrap: wrap; }
1353
+ .kb-rel-node { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-1); }
1354
+ .kb-rel-type {
1355
+ font: var(--t-xs) var(--font-mono); color: var(--fg-3);
1356
+ background: var(--bg-surface-2); border: 1px solid var(--border); padding: 1px 6px;
1357
+ }
1358
+ .kb-rel-btn { width: 100%; justify-content: flex-start; background: none; border: none; border-bottom: 1px solid var(--border); cursor: pointer; text-align: left; }
1359
+ .kb-rel-btn:last-child { border-bottom: none; }
1360
+ .kb-rel-btn:hover .kb-rel-node { color: var(--accent); }
1361
+
1362
+ .kb-mini-fact { padding: var(--s-2) 0; border-bottom: 1px solid var(--border); color: var(--fg-2); font-size: var(--t-sm); overflow-wrap: anywhere; }
1363
+ .kb-mini-fact:last-child { border-bottom: none; }
1364
+
1365
+ .kb-entity-title { display: flex; align-items: center; gap: var(--s-2); font: 600 var(--t-lg) var(--font-ui); color: var(--fg-1); }
1366
+ .kb-entity-sub { margin-top: 2px; font-size: var(--t-sm); color: var(--fg-3); }
1367
+
1368
+ /* pods table */
1369
+ .kb-pod-list { border: 1px solid var(--border); }
1370
+ .kb-pod-head, .kb-pod-row {
1371
+ display: grid;
1372
+ grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 70px 70px minmax(0, 1.4fr);
1373
+ gap: var(--s-3);
1374
+ align-items: center;
1375
+ padding: var(--s-3) var(--s-4);
1376
+ }
1377
+ .kb-pod-head { background: var(--bg-surface-2); border-bottom: 1px solid var(--border); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-3); }
1378
+ .kb-pod-row { background: var(--bg-surface); border-bottom: 1px solid var(--border); }
1379
+ .kb-pod-row:last-child { border-bottom: none; }
1380
+ .kb-pod-name { color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1381
+ .kb-pod-row .kb-tag { justify-self: start; } /* keep the tag content-sized, not stretched across the grid cell */
1382
+ .kb-pod-num { font: var(--t-base) var(--font-mono); color: var(--fg-2); text-align: right; }
1383
+ .kb-pod-when { font: var(--t-sm) var(--font-mono); color: var(--fg-3); }
1384
+
1385
+ /* relationship graph */
1386
+ .kb-graph-mount { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--border); }
1387
+ .kb-graph-svg { display: block; width: 100%; background: var(--bg-canvas); border: 1px solid var(--border); touch-action: none; }
1388
+ .kb-edge { stroke: var(--border-2); stroke-width: 1; }
1389
+ .kb-edge-label { fill: var(--fg-4); font: 9px var(--font-mono); }
1390
+ .kb-node-g { cursor: grab; }
1391
+ .kb-node-g:focus-visible { outline: none; }
1392
+ .kb-node-g:focus-visible .kb-node-box { stroke: var(--accent); stroke-width: 2; }
1393
+ .kb-node-g.dragging { cursor: grabbing; }
1394
+ .kb-node-box { fill: var(--surface-2); stroke: var(--border-2); stroke-width: 1; }
1395
+ .kb-node-box.type-person { stroke: var(--brand-deep); }
1396
+ .kb-node-box.type-topic { stroke: var(--border-strong); }
1397
+ .kb-node-box.type-document { stroke: var(--fg-4); }
1398
+ .kb-node-g.focal .kb-node-box { fill: var(--brand-tint); stroke: var(--accent); stroke-width: 1.5; }
1399
+ .kb-node-label { fill: var(--fg-1); font: 500 11px var(--font-ui); pointer-events: none; }
1400
+ .kb-node-g:not(.focal):hover .kb-node-box { fill: var(--surface-3); stroke: var(--accent); }
1401
+ .kb-graph-hint { margin: var(--s-2) 0 0; font-size: var(--t-xs); }
1402
+ .kb-graph-empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-5); }
1403
+ .kb-graph-empty .kb-node.focal {
1404
+ display: inline-flex; padding: var(--s-2) var(--s-4);
1405
+ background: var(--brand-tint); border: 1.5px solid var(--accent); color: var(--fg-1);
1406
+ font: 500 var(--t-md) var(--font-ui);
1407
+ }
1408
+
1409
+ /* skeleton */
1410
+ .kb-skel-wrap { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3); }
1411
+ .kb-skel {
1412
+ height: 16px;
1413
+ background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
1414
+ background-size: 200% 100%;
1415
+ animation: kb-shimmer 1.1s linear infinite;
1416
+ }
1417
+ .kb-skel:nth-child(2) { width: 86%; }
1418
+ .kb-skel:nth-child(3) { width: 72%; }
1419
+ .kb-skel:nth-child(4) { width: 90%; }
1420
+ .kb-skel:nth-child(5) { width: 64%; }
1421
+ @keyframes kb-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
1422
+
1423
+ /* responsive: stack master-detail; detail un-sticks below the list */
1424
+ @media (max-width: 920px) {
1425
+ .kb-browser { grid-template-columns: 1fr; }
1426
+ .kb-detail { position: static; }
1427
+ .kb-list { max-height: 380px; }
1428
+ }
1429
+ @media (max-width: 560px) {
1430
+ .kb-stat { min-width: 0; flex-basis: 33%; }
1431
+ .kb-pod-head, .kb-pod-row { grid-template-columns: minmax(0, 1.6fr) 56px 56px; }
1432
+ .kb-pod-head span:nth-child(2), .kb-pod-row .kb-tag,
1433
+ .kb-pod-head span:nth-child(5), .kb-pod-when { display: none; }
1434
+ }
1435
+
1436
+ /* ════════════════════════════════════════════════════════════════════════
1437
+ Graph view — whole-KB force-directed canvas
1438
+ ════════════════════════════════════════════════════════════════════════ */
1439
+ .graph-meta { font: var(--t-sm) var(--font-mono); color: var(--fg-3); white-space: nowrap; }
1440
+
1441
+ .graph-stage {
1442
+ position: relative;
1443
+ width: 100%;
1444
+ height: calc(100vh - var(--header-h) - 220px);
1445
+ min-height: 460px;
1446
+ border: 1px solid var(--border);
1447
+ background:
1448
+ radial-gradient(circle at 1px 1px, rgba(255,255,255,0.025) 1px, transparent 0) 0 0 / 22px 22px,
1449
+ var(--bg-canvas);
1450
+ overflow: hidden;
1451
+ }
1452
+ #graph-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
1453
+ #graph-canvas:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }
1454
+ #graph-canvas:active { cursor: grabbing; }
1455
+
1456
+ .graph-legend {
1457
+ position: absolute; left: var(--s-3); bottom: var(--s-3);
1458
+ display: flex; flex-wrap: wrap; gap: var(--s-3);
1459
+ padding: var(--s-2) var(--s-3);
1460
+ background: var(--bg-overlay);
1461
+ border: 1px solid var(--border);
1462
+ backdrop-filter: blur(6px);
1463
+ }
1464
+ .gl-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--fg-3); }
1465
+ .gl-dot { width: 9px; height: 9px; border-radius: 50%; }
1466
+ .gl-dot.entity.person { background: var(--etype-person); }
1467
+ .gl-dot.entity.topic { background: var(--etype-topic); }
1468
+ .gl-dot.entity.document { background: var(--etype-document); }
1469
+ .gl-dot.fact { background: var(--etype-fact); width: 7px; height: 7px; }
1470
+
1471
+ .graph-zoom {
1472
+ position: absolute; right: var(--s-3); bottom: var(--s-3);
1473
+ display: flex; gap: 1px; background: var(--border); border: 1px solid var(--border);
1474
+ }
1475
+ .graph-zoom .btn { background: var(--bg-overlay); backdrop-filter: blur(6px); min-width: 30px; justify-content: center; }
1476
+ .graph-zoom .btn:hover { background: var(--bg-surface-2); }
1477
+
1478
+ .graph-tooltip {
1479
+ position: absolute; z-index: 5; max-width: 240px;
1480
+ padding: var(--s-2) var(--s-3);
1481
+ background: var(--bg-surface); border: 1px solid var(--border-2);
1482
+ box-shadow: var(--shadow-2);
1483
+ font-size: var(--t-sm); color: var(--fg-1); line-height: var(--lh-tight);
1484
+ pointer-events: none; overflow-wrap: anywhere;
1485
+ }
1486
+ .gt-kind { display: block; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-3); margin-bottom: 3px; }
1487
+ .gt-meta { display: block; margin-top: var(--s-2); font: var(--t-xs) var(--font-mono); color: var(--fg-3); }
1488
+
1489
+ .graph-overlay {
1490
+ position: absolute; inset: 0; display: none;
1491
+ align-items: center; justify-content: center;
1492
+ background: var(--bg-canvas);
1493
+ }
1494
+ .graph-status { color: var(--fg-3); font-size: var(--t-base); max-width: 42ch; text-align: center; padding: var(--s-5); }
1495
+ .graph-status.err { color: var(--warn); }
1496
+
1497
+ @media (max-width: 920px) {
1498
+ .graph-stage { height: calc(100vh - var(--header-h) - 260px); }
1499
+ }