clawvault 2.6.1 → 3.0.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/bin/command-registration.test.js +1 -3
- package/bin/register-core-commands.js +10 -23
- package/bin/register-maintenance-commands.js +3 -20
- package/bin/register-query-commands.js +23 -0
- package/bin/register-task-commands.js +1 -18
- package/bin/register-task-commands.test.js +0 -16
- package/bin/register-vault-operations-commands.js +1 -29
- package/dist/{chunk-QVMXF7FY.js → chunk-3D6BCTP6.js} +39 -1
- package/dist/{chunk-R2MIW5G7.js → chunk-3DHXQHYG.js} +1 -1
- package/dist/{chunk-Q2J5YTUF.js → chunk-3NSBOUT3.js} +73 -36
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/{chunk-AZYOKJYC.js → chunk-62YTUT6J.js} +2 -2
- package/dist/chunk-6U6MK36V.js +205 -0
- package/dist/{chunk-4QYGFWRM.js → chunk-7R7O6STJ.js} +4 -4
- package/dist/{chunk-VXEOHTSL.js → chunk-C7OK5WKP.js} +4 -4
- package/dist/chunk-CMB7UL7C.js +327 -0
- package/dist/chunk-DEFFDRVP.js +938 -0
- package/dist/{chunk-HIHOUSXS.js → chunk-E7MFQB6D.js} +59 -18
- package/dist/{chunk-ME37YNW3.js → chunk-F2JEUD4J.js} +6 -4
- package/dist/chunk-GAJV4IGR.js +82 -0
- package/dist/chunk-GQSLDZTS.js +560 -0
- package/dist/{chunk-4OXMU5S2.js → chunk-GUKMRGM7.js} +1 -1
- package/dist/{chunk-T76H47ZS.js → chunk-H34S76MB.js} +6 -6
- package/dist/{chunk-R6SXNSFD.js → chunk-JY6FYXIT.js} +10 -5
- package/dist/chunk-K234IDRJ.js +1073 -0
- package/dist/{chunk-IEVLHNLU.js → chunk-LNJA2UGL.js} +86 -9
- package/dist/{chunk-MFAWT5O5.js → chunk-LYHGEHXG.js} +1 -0
- package/dist/chunk-MFM6K7PU.js +374 -0
- package/dist/{chunk-QWQ3TIKS.js → chunk-N2AXRYLC.js} +1 -1
- package/dist/chunk-PAH27GSN.js +108 -0
- package/dist/{chunk-OIWVQYQF.js → chunk-QBLMXKF2.js} +1 -1
- package/dist/{chunk-FHFUXL6G.js → chunk-QK3UCXWL.js} +2 -2
- package/dist/{chunk-3BTHWPMB.js → chunk-SJSFRIYS.js} +1 -1
- package/dist/{chunk-4VRIMU4O.js → chunk-U55BGUAU.js} +2 -2
- package/dist/{chunk-PBEE567J.js → chunk-VGLOTGAS.js} +1 -1
- package/dist/{chunk-F55HGNU4.js → chunk-WAZ3NLWL.js} +47 -0
- package/dist/{chunk-KL4NAOMO.js → chunk-WGRQ6HDV.js} +1 -1
- package/dist/{chunk-UEOUADMO.js → chunk-YKTA5JOJ.js} +13 -10
- package/dist/{chunk-XAVB4GB4.js → chunk-ZVVFWOLW.js} +4 -4
- package/dist/cli/index.cjs +10033 -0
- package/dist/cli/index.d.cts +5 -0
- package/dist/cli/index.js +20 -18
- package/dist/commands/archive.cjs +287 -0
- package/dist/commands/archive.d.cts +11 -0
- package/dist/commands/archive.js +1 -0
- package/dist/commands/backlog.cjs +721 -0
- package/dist/commands/backlog.d.cts +53 -0
- package/dist/commands/backlog.js +3 -2
- package/dist/commands/blocked.cjs +204 -0
- package/dist/commands/blocked.d.cts +26 -0
- package/dist/commands/blocked.js +3 -2
- package/dist/commands/checkpoint.cjs +244 -0
- package/dist/commands/checkpoint.d.cts +41 -0
- package/dist/commands/checkpoint.js +2 -1
- package/dist/commands/compat.cjs +369 -0
- package/dist/commands/compat.d.cts +28 -0
- package/dist/commands/compat.js +2 -1
- package/dist/commands/context.cjs +2989 -0
- package/dist/commands/context.d.cts +2 -0
- package/dist/commands/context.js +5 -4
- package/dist/commands/doctor.cjs +3062 -0
- package/dist/commands/doctor.d.cts +21 -0
- package/dist/commands/doctor.d.ts +6 -1
- package/dist/commands/doctor.js +13 -11
- package/dist/commands/embed.cjs +232 -0
- package/dist/commands/embed.d.cts +17 -0
- package/dist/commands/embed.js +5 -2
- package/dist/commands/entities.cjs +141 -0
- package/dist/commands/entities.d.cts +7 -0
- package/dist/commands/entities.js +1 -0
- package/dist/commands/graph.cjs +501 -0
- package/dist/commands/graph.d.cts +21 -0
- package/dist/commands/graph.js +1 -0
- package/dist/commands/inject.cjs +1636 -0
- package/dist/commands/inject.d.cts +2 -0
- package/dist/commands/inject.d.ts +1 -1
- package/dist/commands/inject.js +4 -2
- package/dist/commands/kanban.cjs +884 -0
- package/dist/commands/kanban.d.cts +63 -0
- package/dist/commands/kanban.js +4 -3
- package/dist/commands/link.cjs +965 -0
- package/dist/commands/link.d.cts +11 -0
- package/dist/commands/link.js +1 -0
- package/dist/commands/migrate-observations.cjs +362 -0
- package/dist/commands/migrate-observations.d.cts +19 -0
- package/dist/commands/migrate-observations.js +3 -2
- package/dist/commands/observe.cjs +4099 -0
- package/dist/commands/observe.d.cts +23 -0
- package/dist/commands/observe.d.ts +1 -0
- package/dist/commands/observe.js +11 -9
- package/dist/commands/project.cjs +1341 -0
- package/dist/commands/project.d.cts +85 -0
- package/dist/commands/project.js +5 -4
- package/dist/commands/rebuild.cjs +3136 -0
- package/dist/commands/rebuild.d.cts +11 -0
- package/dist/commands/rebuild.js +10 -8
- package/dist/commands/recover.cjs +361 -0
- package/dist/commands/recover.d.cts +38 -0
- package/dist/commands/recover.js +3 -2
- package/dist/commands/reflect.cjs +1008 -0
- package/dist/commands/reflect.d.cts +11 -0
- package/dist/commands/reflect.js +6 -4
- package/dist/commands/repair-session.cjs +457 -0
- package/dist/commands/repair-session.d.cts +38 -0
- package/dist/commands/repair-session.js +1 -0
- package/dist/commands/replay.cjs +4103 -0
- package/dist/commands/replay.d.cts +16 -0
- package/dist/commands/replay.js +12 -10
- package/dist/commands/session-recap.cjs +353 -0
- package/dist/commands/session-recap.d.cts +27 -0
- package/dist/commands/session-recap.js +1 -0
- package/dist/commands/setup.cjs +1345 -0
- package/dist/commands/setup.d.cts +100 -0
- package/dist/commands/setup.d.ts +90 -2
- package/dist/commands/setup.js +21 -2
- package/dist/commands/shell-init.cjs +75 -0
- package/dist/commands/shell-init.d.cts +7 -0
- package/dist/commands/shell-init.js +2 -0
- package/dist/commands/sleep.cjs +6028 -0
- package/dist/commands/sleep.d.cts +36 -0
- package/dist/commands/sleep.d.ts +1 -1
- package/dist/commands/sleep.js +17 -15
- package/dist/commands/status.cjs +2736 -0
- package/dist/commands/status.d.cts +52 -0
- package/dist/commands/status.js +12 -10
- package/dist/commands/tailscale.cjs +1532 -0
- package/dist/commands/tailscale.d.cts +52 -0
- package/dist/commands/tailscale.js +1 -0
- package/dist/commands/task.cjs +1236 -0
- package/dist/commands/task.d.cts +97 -0
- package/dist/commands/task.js +4 -3
- package/dist/commands/template.cjs +457 -0
- package/dist/commands/template.d.cts +36 -0
- package/dist/commands/template.js +2 -1
- package/dist/commands/wake.cjs +2626 -0
- package/dist/commands/wake.d.cts +22 -0
- package/dist/commands/wake.d.ts +1 -1
- package/dist/commands/wake.js +10 -9
- package/dist/context-BUGaWpyL.d.cts +46 -0
- package/dist/index.cjs +14526 -0
- package/dist/index.d.cts +858 -0
- package/dist/index.d.ts +192 -7
- package/dist/index.js +101 -75
- package/dist/{inject-x65KXWPk.d.ts → inject-Bzi5E-By.d.cts} +1 -1
- package/dist/inject-Bzi5E-By.d.ts +137 -0
- package/dist/lib/auto-linker.cjs +176 -0
- package/dist/lib/auto-linker.d.cts +26 -0
- package/dist/lib/auto-linker.js +1 -0
- package/dist/lib/canvas-layout.cjs +136 -0
- package/dist/lib/canvas-layout.d.cts +31 -0
- package/dist/lib/canvas-layout.d.ts +16 -100
- package/dist/lib/canvas-layout.js +78 -20
- package/dist/lib/config.cjs +78 -0
- package/dist/lib/config.d.cts +11 -0
- package/dist/lib/config.js +1 -0
- package/dist/lib/entity-index.cjs +84 -0
- package/dist/lib/entity-index.d.cts +26 -0
- package/dist/lib/entity-index.js +1 -0
- package/dist/lib/project-utils.cjs +864 -0
- package/dist/lib/project-utils.d.cts +97 -0
- package/dist/lib/project-utils.js +4 -3
- package/dist/lib/session-repair.cjs +239 -0
- package/dist/lib/session-repair.d.cts +110 -0
- package/dist/lib/session-repair.js +1 -0
- package/dist/lib/session-utils.cjs +209 -0
- package/dist/lib/session-utils.d.cts +63 -0
- package/dist/lib/session-utils.js +1 -0
- package/dist/lib/tailscale.cjs +1183 -0
- package/dist/lib/tailscale.d.cts +225 -0
- package/dist/lib/tailscale.js +1 -0
- package/dist/lib/task-utils.cjs +1137 -0
- package/dist/lib/task-utils.d.cts +208 -0
- package/dist/lib/task-utils.js +3 -2
- package/dist/lib/template-engine.cjs +47 -0
- package/dist/lib/template-engine.d.cts +11 -0
- package/dist/lib/template-engine.js +1 -0
- package/dist/lib/webdav.cjs +568 -0
- package/dist/lib/webdav.d.cts +109 -0
- package/dist/lib/webdav.js +1 -0
- package/dist/plugin/index.cjs +1907 -0
- package/dist/plugin/index.d.cts +36 -0
- package/dist/plugin/index.d.ts +36 -0
- package/dist/plugin/index.js +572 -0
- package/dist/plugin/inject.cjs +356 -0
- package/dist/plugin/inject.d.cts +54 -0
- package/dist/plugin/inject.d.ts +54 -0
- package/dist/plugin/inject.js +17 -0
- package/dist/plugin/observe.cjs +631 -0
- package/dist/plugin/observe.d.cts +39 -0
- package/dist/plugin/observe.d.ts +39 -0
- package/dist/plugin/observe.js +18 -0
- package/dist/plugin/templates.cjs +593 -0
- package/dist/plugin/templates.d.cts +52 -0
- package/dist/plugin/templates.d.ts +52 -0
- package/dist/plugin/templates.js +25 -0
- package/dist/plugin/types.cjs +18 -0
- package/dist/plugin/types.d.cts +209 -0
- package/dist/plugin/types.d.ts +209 -0
- package/dist/plugin/types.js +0 -0
- package/dist/plugin/vault.cjs +927 -0
- package/dist/plugin/vault.d.cts +68 -0
- package/dist/plugin/vault.d.ts +68 -0
- package/dist/plugin/vault.js +22 -0
- package/dist/{types-C74wgGL1.d.ts → types-Y2_Um2Ls.d.cts} +44 -1
- package/dist/types-Y2_Um2Ls.d.ts +205 -0
- package/hooks/clawvault/handler.js +70 -7
- package/hooks/clawvault/handler.test.js +91 -0
- package/openclaw.plugin.json +56 -0
- package/package.json +17 -7
- package/templates/memory-event.md +67 -0
- package/templates/party.md +63 -0
- package/templates/primitive-registry.yaml +551 -0
- package/templates/run.md +68 -0
- package/templates/trigger.md +68 -0
- package/templates/workspace.md +50 -0
- package/dashboard/lib/graph-diff.js +0 -104
- package/dashboard/lib/graph-diff.test.js +0 -75
- package/dashboard/lib/vault-parser.js +0 -556
- package/dashboard/lib/vault-parser.test.js +0 -254
- package/dashboard/public/app.js +0 -796
- package/dashboard/public/index.html +0 -52
- package/dashboard/public/styles.css +0 -221
- package/dashboard/server.js +0 -374
- package/dist/chunk-MAKNAHAW.js +0 -375
- package/dist/chunk-MDIH26GC.js +0 -183
- package/dist/chunk-MGDEINGP.js +0 -99
- package/dist/chunk-RVYA52PY.js +0 -363
- package/dist/chunk-TLGBDTYT.js +0 -33
- package/dist/commands/canvas.d.ts +0 -15
- package/dist/commands/canvas.js +0 -199
- package/dist/commands/sync-bd.d.ts +0 -10
- package/dist/commands/sync-bd.js +0 -9
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>ClawVault Graph Dashboard</title>
|
|
7
|
-
<link rel="stylesheet" href="/styles.css">
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<header class="toolbar">
|
|
11
|
-
<div class="toolbar-title">
|
|
12
|
-
<h1>ClawVault Live Graph</h1>
|
|
13
|
-
<p id="stats">Loading graph...</p>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="toolbar-controls">
|
|
16
|
-
<input id="search" type="search" placeholder="Search nodes, ids, tags..." autocomplete="off">
|
|
17
|
-
<select id="category-filter">
|
|
18
|
-
<option value="all">All categories</option>
|
|
19
|
-
</select>
|
|
20
|
-
<select id="tag-filter">
|
|
21
|
-
<option value="all">All tags</option>
|
|
22
|
-
</select>
|
|
23
|
-
<select id="node-type-filter">
|
|
24
|
-
<option value="all">All node types</option>
|
|
25
|
-
<option value="resolved">Resolved only</option>
|
|
26
|
-
<option value="missing">Missing only</option>
|
|
27
|
-
</select>
|
|
28
|
-
<button id="tv-mode" type="button" aria-pressed="false">TV Mode</button>
|
|
29
|
-
<button id="refresh" type="button">Refresh</button>
|
|
30
|
-
<div class="status-pill" id="realtime-status">Realtime: connecting...</div>
|
|
31
|
-
</div>
|
|
32
|
-
</header>
|
|
33
|
-
|
|
34
|
-
<main class="layout">
|
|
35
|
-
<section id="graph" aria-label="Vault graph visualization"></section>
|
|
36
|
-
<aside class="details-panel">
|
|
37
|
-
<h2>Node Details</h2>
|
|
38
|
-
<div id="node-details">
|
|
39
|
-
<p>Select a node to inspect details and connections.</p>
|
|
40
|
-
</div>
|
|
41
|
-
</aside>
|
|
42
|
-
</main>
|
|
43
|
-
|
|
44
|
-
<script src="/vendor/force-graph.min.js"></script>
|
|
45
|
-
<script>
|
|
46
|
-
if (!window.ForceGraph) {
|
|
47
|
-
document.write('<script src="https://unpkg.com/force-graph"><\/script>');
|
|
48
|
-
}
|
|
49
|
-
</script>
|
|
50
|
-
<script type="module" src="/app.js"></script>
|
|
51
|
-
</body>
|
|
52
|
-
</html>
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
color-scheme: dark;
|
|
3
|
-
font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
|
|
4
|
-
--bg: #070a10;
|
|
5
|
-
--bg-elevated: #0d1522;
|
|
6
|
-
--panel: #111b2a;
|
|
7
|
-
--panel-border: #213247;
|
|
8
|
-
--text: #dce9ff;
|
|
9
|
-
--muted: #90a7c3;
|
|
10
|
-
--accent: #75d3ff;
|
|
11
|
-
--accent-strong: #b7f0ff;
|
|
12
|
-
--ok: #58f1c6;
|
|
13
|
-
--warn: #ffd479;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
* {
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
html,
|
|
21
|
-
body {
|
|
22
|
-
margin: 0;
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: 100%;
|
|
25
|
-
background: radial-gradient(circle at top, #122235 0%, var(--bg) 46%, #05080d 100%);
|
|
26
|
-
color: var(--text);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
body {
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-direction: column;
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.toolbar {
|
|
36
|
-
border-bottom: 1px solid var(--panel-border);
|
|
37
|
-
background: rgba(10, 16, 26, 0.9);
|
|
38
|
-
backdrop-filter: blur(8px);
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: space-between;
|
|
42
|
-
gap: 0.8rem;
|
|
43
|
-
padding: 0.7rem 0.9rem;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.toolbar h1 {
|
|
47
|
-
margin: 0;
|
|
48
|
-
font-size: 1.05rem;
|
|
49
|
-
letter-spacing: 0.02em;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.toolbar p {
|
|
53
|
-
margin: 0.2rem 0 0;
|
|
54
|
-
color: var(--muted);
|
|
55
|
-
font-size: 0.82rem;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.toolbar-controls {
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
gap: 0.5rem;
|
|
62
|
-
flex-wrap: wrap;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
input,
|
|
66
|
-
select,
|
|
67
|
-
button {
|
|
68
|
-
border: 1px solid var(--panel-border);
|
|
69
|
-
background: var(--panel);
|
|
70
|
-
color: var(--text);
|
|
71
|
-
border-radius: 9px;
|
|
72
|
-
padding: 0.5rem 0.7rem;
|
|
73
|
-
font-size: 0.88rem;
|
|
74
|
-
transition: border-color 160ms ease, transform 140ms ease, background-color 160ms ease;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
input,
|
|
78
|
-
select {
|
|
79
|
-
min-width: 150px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
input {
|
|
83
|
-
min-width: 200px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
button {
|
|
87
|
-
cursor: pointer;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
button:hover {
|
|
91
|
-
border-color: var(--accent);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
button:active {
|
|
95
|
-
transform: translateY(1px);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.status-pill {
|
|
99
|
-
border: 1px solid #294464;
|
|
100
|
-
border-radius: 999px;
|
|
101
|
-
background: #14253a;
|
|
102
|
-
color: var(--muted);
|
|
103
|
-
font-size: 0.76rem;
|
|
104
|
-
line-height: 1;
|
|
105
|
-
padding: 0.4rem 0.65rem;
|
|
106
|
-
white-space: nowrap;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.status-pill.ok {
|
|
110
|
-
border-color: #1f6350;
|
|
111
|
-
color: #93f0d6;
|
|
112
|
-
background: #0f2f2a;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.status-pill.warn {
|
|
116
|
-
border-color: #7a5620;
|
|
117
|
-
color: #ffe0a3;
|
|
118
|
-
background: #342510;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.layout {
|
|
122
|
-
display: grid;
|
|
123
|
-
grid-template-columns: minmax(0, 1fr) 320px;
|
|
124
|
-
min-height: 0;
|
|
125
|
-
flex: 1;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
#graph {
|
|
129
|
-
min-height: 0;
|
|
130
|
-
position: relative;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.details-panel {
|
|
134
|
-
border-left: 1px solid var(--panel-border);
|
|
135
|
-
padding: 1rem;
|
|
136
|
-
background: rgba(13, 21, 34, 0.87);
|
|
137
|
-
overflow-y: auto;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.details-panel h2 {
|
|
141
|
-
margin-top: 0;
|
|
142
|
-
font-size: 0.98rem;
|
|
143
|
-
letter-spacing: 0.01em;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.meta-label {
|
|
147
|
-
color: var(--muted);
|
|
148
|
-
font-size: 0.8rem;
|
|
149
|
-
margin-bottom: 0.15rem;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.meta-value {
|
|
153
|
-
margin: 0 0 0.72rem;
|
|
154
|
-
font-size: 0.9rem;
|
|
155
|
-
line-height: 1.4;
|
|
156
|
-
word-break: break-word;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.connection-list {
|
|
160
|
-
list-style: none;
|
|
161
|
-
margin: 0;
|
|
162
|
-
padding: 0;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.connection-list li {
|
|
166
|
-
border-bottom: 1px solid var(--panel-border);
|
|
167
|
-
padding: 0.36rem 0;
|
|
168
|
-
font-size: 0.88rem;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.connection-list li:last-child {
|
|
172
|
-
border-bottom: none;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.connection-link {
|
|
176
|
-
color: var(--accent);
|
|
177
|
-
text-decoration: none;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.connection-link:hover {
|
|
181
|
-
color: var(--accent-strong);
|
|
182
|
-
text-decoration: underline;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
body.tv-mode .toolbar,
|
|
186
|
-
body.tv-mode .details-panel {
|
|
187
|
-
opacity: 0;
|
|
188
|
-
pointer-events: none;
|
|
189
|
-
transform: translateY(-8px);
|
|
190
|
-
transition: opacity 280ms ease, transform 280ms ease;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
body.tv-mode .layout {
|
|
194
|
-
display: block;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
body.tv-mode #graph {
|
|
198
|
-
width: 100vw;
|
|
199
|
-
height: 100vh;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
body.tv-mode {
|
|
203
|
-
background: #03050a;
|
|
204
|
-
cursor: none;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
@media (max-width: 1200px) {
|
|
208
|
-
.layout {
|
|
209
|
-
grid-template-columns: minmax(0, 1fr);
|
|
210
|
-
grid-template-rows: minmax(0, 1fr) auto;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
#graph {
|
|
214
|
-
height: 64vh;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.details-panel {
|
|
218
|
-
border-left: 0;
|
|
219
|
-
border-top: 1px solid var(--panel-border);
|
|
220
|
-
}
|
|
221
|
-
}
|
package/dashboard/server.js
DELETED
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
import * as fs from 'node:fs/promises';
|
|
3
|
-
import * as os from 'node:os';
|
|
4
|
-
import * as path from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import chokidar from 'chokidar';
|
|
7
|
-
import { WebSocketServer } from 'ws';
|
|
8
|
-
import { buildVaultGraph } from './lib/vault-parser.js';
|
|
9
|
-
import { diffGraphs } from './lib/graph-diff.js';
|
|
10
|
-
|
|
11
|
-
const DEFAULT_PORT = 3377;
|
|
12
|
-
const HOST = '0.0.0.0';
|
|
13
|
-
|
|
14
|
-
export async function startDashboard(options = {}) {
|
|
15
|
-
const port = normalizePort(options.port ?? DEFAULT_PORT);
|
|
16
|
-
const vaultPath = resolveVaultPath(options.vaultPath);
|
|
17
|
-
await assertVaultPath(vaultPath);
|
|
18
|
-
|
|
19
|
-
const app = express();
|
|
20
|
-
const serverDir = path.dirname(fileURLToPath(import.meta.url));
|
|
21
|
-
const projectDir = path.resolve(serverDir, '..');
|
|
22
|
-
const publicDir = path.join(serverDir, 'public');
|
|
23
|
-
const forceGraphDistDir = path.join(projectDir, 'node_modules', 'force-graph', 'dist');
|
|
24
|
-
|
|
25
|
-
const graphStore = createLiveGraphStore(vaultPath);
|
|
26
|
-
await graphStore.init();
|
|
27
|
-
|
|
28
|
-
app.get('/api/graph', async (req, res) => {
|
|
29
|
-
try {
|
|
30
|
-
const shouldRefresh = req.query.refresh === '1';
|
|
31
|
-
if (shouldRefresh) {
|
|
32
|
-
await graphStore.refresh({ reason: 'api:refresh' });
|
|
33
|
-
}
|
|
34
|
-
res.json(graphStore.getGraph());
|
|
35
|
-
} catch (error) {
|
|
36
|
-
res.status(500).json({
|
|
37
|
-
error: 'Failed to build graph',
|
|
38
|
-
detail: error instanceof Error ? error.message : String(error)
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
app.get('/api/health', (_req, res) => {
|
|
44
|
-
res.json({
|
|
45
|
-
ok: true,
|
|
46
|
-
vaultPath
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
app.use('/vendor', express.static(forceGraphDistDir));
|
|
51
|
-
app.use(express.static(publicDir, { extensions: ['html'] }));
|
|
52
|
-
|
|
53
|
-
const server = await new Promise((resolve, reject) => {
|
|
54
|
-
const runningServer = app
|
|
55
|
-
.listen(port, HOST, () => resolve(runningServer))
|
|
56
|
-
.on('error', reject);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const wsServer = new WebSocketServer({
|
|
60
|
-
server,
|
|
61
|
-
path: '/ws'
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const unsubscribeGraphUpdates = graphStore.subscribe((update) => {
|
|
65
|
-
broadcast(wsServer, {
|
|
66
|
-
type: 'graph:patch',
|
|
67
|
-
payload: {
|
|
68
|
-
version: update.version,
|
|
69
|
-
reason: update.reason,
|
|
70
|
-
changedPaths: update.changedPaths,
|
|
71
|
-
...update.patch
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
wsServer.on('connection', (socket) => {
|
|
77
|
-
socket.send(
|
|
78
|
-
JSON.stringify({
|
|
79
|
-
type: 'graph:init',
|
|
80
|
-
payload: {
|
|
81
|
-
version: graphStore.getVersion(),
|
|
82
|
-
graph: graphStore.getGraph()
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const heartbeatInterval = setInterval(() => {
|
|
89
|
-
for (const client of wsServer.clients) {
|
|
90
|
-
if (client.readyState === 1) {
|
|
91
|
-
client.ping();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}, 20_000);
|
|
95
|
-
|
|
96
|
-
await graphStore.startWatching();
|
|
97
|
-
|
|
98
|
-
logStartup({
|
|
99
|
-
port,
|
|
100
|
-
vaultPath
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
let isShuttingDown = false;
|
|
104
|
-
const shutdown = async () => {
|
|
105
|
-
if (isShuttingDown) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
isShuttingDown = true;
|
|
109
|
-
clearInterval(heartbeatInterval);
|
|
110
|
-
unsubscribeGraphUpdates();
|
|
111
|
-
await graphStore.close();
|
|
112
|
-
await new Promise((resolve) => wsServer.close(() => resolve()));
|
|
113
|
-
server.close(() => {
|
|
114
|
-
process.exit(0);
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
process.on('SIGINT', () => {
|
|
119
|
-
void shutdown();
|
|
120
|
-
});
|
|
121
|
-
process.on('SIGTERM', () => {
|
|
122
|
-
void shutdown();
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
return server;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function createLiveGraphStore(vaultPath) {
|
|
129
|
-
const subscribers = new Set();
|
|
130
|
-
const changedPathBuffer = new Set();
|
|
131
|
-
const refreshDebounceMs = 240;
|
|
132
|
-
let graph = null;
|
|
133
|
-
let version = 0;
|
|
134
|
-
let refreshTimer = null;
|
|
135
|
-
let watcher = null;
|
|
136
|
-
let inFlightRefresh = null;
|
|
137
|
-
let refreshQueued = false;
|
|
138
|
-
|
|
139
|
-
async function init() {
|
|
140
|
-
graph = await buildVaultGraph(vaultPath);
|
|
141
|
-
version = 1;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function getGraph() {
|
|
145
|
-
return graph;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function getVersion() {
|
|
149
|
-
return version;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function subscribe(listener) {
|
|
153
|
-
subscribers.add(listener);
|
|
154
|
-
return () => {
|
|
155
|
-
subscribers.delete(listener);
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function emit(update) {
|
|
160
|
-
for (const listener of subscribers) {
|
|
161
|
-
listener(update);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function queueRefresh({ reason, changedPath }) {
|
|
166
|
-
if (changedPath) {
|
|
167
|
-
changedPathBuffer.add(changedPath);
|
|
168
|
-
}
|
|
169
|
-
if (refreshTimer) {
|
|
170
|
-
clearTimeout(refreshTimer);
|
|
171
|
-
}
|
|
172
|
-
refreshTimer = setTimeout(() => {
|
|
173
|
-
refreshTimer = null;
|
|
174
|
-
void refresh({ reason });
|
|
175
|
-
}, refreshDebounceMs);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
async function refresh({ reason = 'manual' } = {}) {
|
|
179
|
-
if (inFlightRefresh) {
|
|
180
|
-
refreshQueued = true;
|
|
181
|
-
return inFlightRefresh;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const changedPaths = Array.from(changedPathBuffer).sort((a, b) => a.localeCompare(b));
|
|
185
|
-
changedPathBuffer.clear();
|
|
186
|
-
|
|
187
|
-
inFlightRefresh = buildVaultGraph(vaultPath)
|
|
188
|
-
.then((nextGraph) => {
|
|
189
|
-
const patch = diffGraphs(graph, nextGraph);
|
|
190
|
-
graph = nextGraph;
|
|
191
|
-
if (!patch.hasChanges) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
version += 1;
|
|
195
|
-
emit({
|
|
196
|
-
version,
|
|
197
|
-
reason,
|
|
198
|
-
changedPaths,
|
|
199
|
-
patch
|
|
200
|
-
});
|
|
201
|
-
})
|
|
202
|
-
.finally(async () => {
|
|
203
|
-
inFlightRefresh = null;
|
|
204
|
-
if (refreshQueued) {
|
|
205
|
-
refreshQueued = false;
|
|
206
|
-
await refresh({ reason: 'coalesced' });
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
return inFlightRefresh;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
async function startWatching() {
|
|
214
|
-
watcher = chokidar.watch(path.join(vaultPath, '**', '*.md'), {
|
|
215
|
-
persistent: true,
|
|
216
|
-
ignoreInitial: true,
|
|
217
|
-
awaitWriteFinish: {
|
|
218
|
-
stabilityThreshold: 180,
|
|
219
|
-
pollInterval: 50
|
|
220
|
-
},
|
|
221
|
-
ignored: (watchedPath) => isIgnoredPath(vaultPath, watchedPath)
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
watcher
|
|
225
|
-
.on('add', (filePath) => {
|
|
226
|
-
queueRefresh({
|
|
227
|
-
reason: 'fs:add',
|
|
228
|
-
changedPath: toRelativeVaultPath(vaultPath, filePath)
|
|
229
|
-
});
|
|
230
|
-
})
|
|
231
|
-
.on('change', (filePath) => {
|
|
232
|
-
queueRefresh({
|
|
233
|
-
reason: 'fs:change',
|
|
234
|
-
changedPath: toRelativeVaultPath(vaultPath, filePath)
|
|
235
|
-
});
|
|
236
|
-
})
|
|
237
|
-
.on('unlink', (filePath) => {
|
|
238
|
-
queueRefresh({
|
|
239
|
-
reason: 'fs:unlink',
|
|
240
|
-
changedPath: toRelativeVaultPath(vaultPath, filePath)
|
|
241
|
-
});
|
|
242
|
-
})
|
|
243
|
-
.on('error', (error) => {
|
|
244
|
-
console.error(`Dashboard file watcher error: ${error instanceof Error ? error.message : String(error)}`);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
async function close() {
|
|
249
|
-
if (refreshTimer) {
|
|
250
|
-
clearTimeout(refreshTimer);
|
|
251
|
-
refreshTimer = null;
|
|
252
|
-
}
|
|
253
|
-
if (watcher) {
|
|
254
|
-
await watcher.close();
|
|
255
|
-
watcher = null;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return {
|
|
260
|
-
init,
|
|
261
|
-
getGraph,
|
|
262
|
-
getVersion,
|
|
263
|
-
subscribe,
|
|
264
|
-
refresh,
|
|
265
|
-
startWatching,
|
|
266
|
-
close
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function broadcast(wsServer, data) {
|
|
271
|
-
const payload = JSON.stringify(data);
|
|
272
|
-
for (const client of wsServer.clients) {
|
|
273
|
-
if (client.readyState === 1) {
|
|
274
|
-
client.send(payload);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function isIgnoredPath(vaultPath, watchedPath) {
|
|
280
|
-
const relativePath = toRelativeVaultPath(vaultPath, watchedPath);
|
|
281
|
-
const segments = relativePath.split('/').filter(Boolean);
|
|
282
|
-
|
|
283
|
-
return segments.some((segment) =>
|
|
284
|
-
segment === '.git' || segment === '.obsidian' || segment === '.trash' || segment === 'node_modules'
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function toRelativeVaultPath(vaultPath, absolutePath) {
|
|
289
|
-
return path.relative(vaultPath, absolutePath).split(path.sep).join('/');
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function parseArgs(argv) {
|
|
293
|
-
const options = {
|
|
294
|
-
port: DEFAULT_PORT,
|
|
295
|
-
vaultPath: undefined
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
for (let i = 0; i < argv.length; i += 1) {
|
|
299
|
-
const arg = argv[i];
|
|
300
|
-
if (arg === '--port' || arg === '-p') {
|
|
301
|
-
options.port = argv[i + 1];
|
|
302
|
-
i += 1;
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
if (arg === '--vault' || arg === '-v') {
|
|
306
|
-
options.vaultPath = argv[i + 1];
|
|
307
|
-
i += 1;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return options;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function normalizePort(value) {
|
|
315
|
-
const parsed = Number.parseInt(String(value), 10);
|
|
316
|
-
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65535) {
|
|
317
|
-
throw new Error(`Invalid port: ${value}`);
|
|
318
|
-
}
|
|
319
|
-
return parsed;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function resolveVaultPath(input) {
|
|
323
|
-
const candidate = input || process.env.CLAWVAULT_PATH || process.cwd();
|
|
324
|
-
return path.resolve(candidate);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
async function assertVaultPath(vaultPath) {
|
|
328
|
-
let stat;
|
|
329
|
-
try {
|
|
330
|
-
stat = await fs.stat(vaultPath);
|
|
331
|
-
} catch (error) {
|
|
332
|
-
throw new Error(`Vault path not found: ${vaultPath}`);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (!stat.isDirectory()) {
|
|
336
|
-
throw new Error(`Vault path is not a directory: ${vaultPath}`);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function logStartup({ port, vaultPath }) {
|
|
341
|
-
const interfaces = os.networkInterfaces();
|
|
342
|
-
const networkUrls = [];
|
|
343
|
-
|
|
344
|
-
for (const addresses of Object.values(interfaces)) {
|
|
345
|
-
for (const address of addresses ?? []) {
|
|
346
|
-
if (address.family !== 'IPv4' || address.internal) {
|
|
347
|
-
continue;
|
|
348
|
-
}
|
|
349
|
-
networkUrls.push(`http://${address.address}:${port}`);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
console.log('\nClawVault Dashboard');
|
|
354
|
-
console.log(`Vault: ${vaultPath}`);
|
|
355
|
-
console.log(`Local: http://localhost:${port}`);
|
|
356
|
-
for (const url of networkUrls) {
|
|
357
|
-
console.log(`Network: ${url}`);
|
|
358
|
-
}
|
|
359
|
-
console.log('\nPress Ctrl+C to stop.\n');
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
const currentFile = fileURLToPath(import.meta.url);
|
|
363
|
-
const executedFile = process.argv[1] ? path.resolve(process.argv[1]) : '';
|
|
364
|
-
|
|
365
|
-
if (currentFile === executedFile) {
|
|
366
|
-
startDashboard(parseArgs(process.argv.slice(2))).catch((error) => {
|
|
367
|
-
if (error && typeof error === 'object' && 'code' in error && error.code === 'EADDRINUSE') {
|
|
368
|
-
console.error('Port already in use.');
|
|
369
|
-
} else {
|
|
370
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
371
|
-
}
|
|
372
|
-
process.exit(1);
|
|
373
|
-
});
|
|
374
|
-
}
|