@powerhousedao/knowledge-note 1.0.1 → 1.0.2
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/dist/editors/health-report-editor/editor.d.ts.map +1 -1
- package/dist/editors/health-report-editor/editor.js +100 -17
- package/dist/editors/knowledge-note-editor/editor.d.ts.map +1 -1
- package/dist/editors/knowledge-note-editor/editor.js +12 -3
- package/dist/editors/knowledge-vault/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/knowledge-vault/components/GettingStarted.js +26 -7
- package/dist/editors/knowledge-vault/components/GraphView.d.ts +1 -1
- package/dist/editors/knowledge-vault/components/GraphView.d.ts.map +1 -1
- package/dist/editors/knowledge-vault/components/GraphView.js +1 -1
- package/dist/editors/knowledge-vault/components/HealthDashboard.d.ts.map +1 -1
- package/dist/editors/knowledge-vault/components/HealthDashboard.js +16 -4
- package/dist/editors/knowledge-vault/hooks/use-drive-init.d.ts.map +1 -1
- package/dist/editors/knowledge-vault/hooks/use-drive-init.js +14 -4
- package/dist/editors/moc-editor/editor.d.ts.map +1 -1
- package/dist/editors/moc-editor/editor.js +13 -4
- package/dist/editors/tension-editor/editor.d.ts.map +1 -1
- package/dist/editors/tension-editor/editor.js +60 -9
- package/dist/package.json +1 -1
- package/dist/processors/graph-indexer/index.d.ts.map +1 -1
- package/dist/processors/graph-indexer/query.d.ts.map +1 -1
- package/dist/processors/graph-indexer/query.js +2 -1
- package/dist/processors/methodology-indexer/factory.d.ts.map +1 -1
- package/dist/processors/methodology-indexer/index.d.ts.map +1 -1
- package/dist/processors/methodology-indexer/index.js +1 -3
- package/dist/processors/methodology-indexer/query.d.ts.map +1 -1
- package/dist/processors/methodology-indexer/query.js +17 -5
- package/dist/style.css +15 -0
- package/dist/subgraphs/knowledge-graph/subgraph.d.ts.map +1 -1
- package/dist/subgraphs/knowledge-graph/subgraph.js +45 -15
- package/dist/subgraphs/methodology/subgraph.d.ts.map +1 -1
- package/dist/subgraphs/methodology/subgraph.js +18 -5
- package/dist/tests/processor/graph-indexer.test.js +8 -2
- package/dist/tests/unit/knowledge-note-reducers.test.js +4 -1
- package/dist/tests/unit/lifecycle-state-machine.test.js +16 -4
- package/dist/tests/unit/moc-reducers.test.js +1 -1
- package/dist/tests/unit/pipeline-queue-reducers.test.js +10 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/health-report-editor/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/health-report-editor/editor.tsx"],"names":[],"mappings":"AAcA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAuU7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
3
|
-
import { useSelectedHealthReportDocument
|
|
3
|
+
import { useSelectedHealthReportDocument } from "../../document-models/health-report/v1/hooks.js";
|
|
4
4
|
import { setSelectedNode, useDocumentsInSelectedDrive, } from "@powerhousedao/reactor-browser";
|
|
5
5
|
import { TOOLBAR_CLASS } from "../shared/theme-context.js";
|
|
6
6
|
const STATUS_BADGE = {
|
|
@@ -14,26 +14,103 @@ export default function Editor() {
|
|
|
14
14
|
const documents = useDocumentsInSelectedDrive();
|
|
15
15
|
const isEmpty = !state.generatedAt;
|
|
16
16
|
if (isEmpty) {
|
|
17
|
-
return (_jsx("div", { className: "min-h-screen", style: { backgroundColor: "var(--bai-bg)", color: "var(--bai-text)" }, children: _jsxs("div", { className: "mx-auto max-w-3xl", children: [_jsx(DocumentToolbar, { className: TOOLBAR_CLASS }), _jsx("div", { className: "flex h-64 items-center justify-center rounded-xl m-6", style: {
|
|
17
|
+
return (_jsx("div", { className: "min-h-screen", style: { backgroundColor: "var(--bai-bg)", color: "var(--bai-text)" }, children: _jsxs("div", { className: "mx-auto max-w-3xl", children: [_jsx(DocumentToolbar, { className: TOOLBAR_CLASS }), _jsx("div", { className: "flex h-64 items-center justify-center rounded-xl m-6", style: {
|
|
18
|
+
backgroundColor: "var(--bai-surface)",
|
|
19
|
+
border: "1px solid var(--bai-border)",
|
|
20
|
+
}, children: _jsxs("div", { className: "text-center", children: [_jsx("p", { className: "text-sm", style: { color: "var(--bai-text-muted)" }, children: "No health report generated yet" }), _jsx("p", { className: "mt-1 text-xs", style: { color: "var(--bai-text-faint)" }, children: "Run /health in Claude Code to generate a vault health report" })] }) })] }) }));
|
|
18
21
|
}
|
|
19
22
|
const metrics = state.graphMetrics;
|
|
20
23
|
const checks = state.checks ?? [];
|
|
21
24
|
const recommendations = state.recommendations ?? [];
|
|
22
|
-
return (_jsx("div", { className: "min-h-screen", style: { backgroundColor: "var(--bai-bg)", color: "var(--bai-text)" }, children: _jsxs("div", { className: "mx-auto max-w-4xl", children: [_jsx(DocumentToolbar, { className: TOOLBAR_CLASS }), _jsxs("div", { className: "p-6 space-y-6", children: [_jsxs("div", { className: "flex items-center gap-4 rounded-xl p-6", style: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
return (_jsx("div", { className: "min-h-screen", style: { backgroundColor: "var(--bai-bg)", color: "var(--bai-text)" }, children: _jsxs("div", { className: "mx-auto max-w-4xl", children: [_jsx(DocumentToolbar, { className: TOOLBAR_CLASS }), _jsxs("div", { className: "p-6 space-y-6", children: [_jsxs("div", { className: "flex items-center gap-4 rounded-xl p-6", style: {
|
|
26
|
+
backgroundColor: "var(--bai-surface)",
|
|
27
|
+
border: "1px solid var(--bai-border)",
|
|
28
|
+
}, children: [_jsx("span", { className: `rounded-full border px-4 py-1.5 text-sm font-bold ${STATUS_BADGE[state.overallStatus ?? "PASS"]}`, children: state.overallStatus }), _jsxs("div", { className: "flex-1", children: [_jsx("h1", { className: "text-xl font-bold", style: { color: "var(--bai-text)" }, children: "Vault Health" }), _jsxs("p", { className: "text-xs", style: { color: "var(--bai-text-muted)" }, children: ["Generated ", new Date(state.generatedAt).toLocaleString(), state.generatedBy && ` by ${state.generatedBy}`, state.mode && ` \u2022 ${state.mode} mode`] })] })] }), metrics && (_jsx("div", { className: "grid grid-cols-4 gap-3", children: [
|
|
29
|
+
{
|
|
30
|
+
label: "Notes",
|
|
31
|
+
value: metrics.noteCount,
|
|
32
|
+
color: "var(--bai-accent)",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "MOCs",
|
|
36
|
+
value: metrics.mocCount,
|
|
37
|
+
color: undefined,
|
|
38
|
+
cls: "text-blue-400",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: "Edges",
|
|
42
|
+
value: metrics.connectionCount,
|
|
43
|
+
color: undefined,
|
|
44
|
+
cls: "text-emerald-400",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Density",
|
|
48
|
+
value: `${(metrics.density * 100).toFixed(1)}%`,
|
|
49
|
+
color: "var(--bai-text-secondary)",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "Orphans",
|
|
53
|
+
value: metrics.orphanCount,
|
|
54
|
+
color: undefined,
|
|
55
|
+
cls: metrics.orphanCount > 0
|
|
56
|
+
? "text-amber-400"
|
|
57
|
+
: "text-emerald-400",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "Dangling",
|
|
61
|
+
value: metrics.danglingLinkCount,
|
|
62
|
+
color: undefined,
|
|
63
|
+
cls: metrics.danglingLinkCount > 0
|
|
64
|
+
? "text-red-400"
|
|
65
|
+
: "text-emerald-400",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Avg Links",
|
|
69
|
+
value: metrics.averageLinksPerNote.toFixed(1),
|
|
70
|
+
color: undefined,
|
|
71
|
+
cls: metrics.averageLinksPerNote < 2
|
|
72
|
+
? "text-amber-400"
|
|
73
|
+
: "text-emerald-400",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: "MOC Coverage",
|
|
77
|
+
value: `${(metrics.mocCoverage * 100).toFixed(0)}%`,
|
|
78
|
+
color: "var(--bai-text-tertiary)",
|
|
79
|
+
},
|
|
80
|
+
].map((m) => (_jsxs("div", { className: "rounded-xl p-4", style: {
|
|
81
|
+
backgroundColor: "var(--bai-surface)",
|
|
82
|
+
boxShadow: "0 0 0 1px var(--bai-ring)",
|
|
83
|
+
}, children: [_jsx("p", { className: `text-xl font-bold ${m.cls ?? ""}`, style: m.color ? { color: m.color } : undefined, children: m.value }), _jsx("p", { className: "text-[10px]", style: { color: "var(--bai-text-faint)" }, children: m.label })] }, m.label))) })), _jsxs("div", { className: "rounded-xl p-6", style: {
|
|
84
|
+
backgroundColor: "var(--bai-surface)",
|
|
85
|
+
border: "1px solid var(--bai-border)",
|
|
86
|
+
}, children: [_jsxs("h3", { className: "mb-3 text-xs font-semibold uppercase tracking-wider", style: { color: "var(--bai-text-muted)" }, children: ["Health Checks (", checks.length, ")"] }), checks.length === 0 ? (_jsx("p", { className: "text-sm py-4 text-center", style: { color: "var(--bai-text-faint)" }, children: "No checks recorded" })) : (_jsx("div", { className: "space-y-3", children: checks.map((check) => (_jsxs("div", { className: "rounded-lg px-4 py-3", style: {
|
|
87
|
+
backgroundColor: "var(--bai-bg)",
|
|
88
|
+
border: "1px solid var(--bai-border)",
|
|
89
|
+
}, children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("span", { className: `mt-0.5 shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-bold ${STATUS_BADGE[check.status]}`, children: check.status }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "text-xs font-medium", style: { color: "var(--bai-text-secondary)" }, children: check.category.replaceAll("_", " ") }), _jsx("p", { className: "mt-0.5 text-xs", style: { color: "var(--bai-text-muted)" }, children: check.message }), check.affectedItems.length > 0 &&
|
|
90
|
+
check.status !== "PASS" && (_jsxs("div", { className: "mt-1.5 flex flex-wrap gap-1", children: [check.affectedItems
|
|
91
|
+
.slice(0, 5)
|
|
92
|
+
.map((item, i) => {
|
|
93
|
+
const noteDoc = (documents ?? []).find((d) => (d.header.documentType ===
|
|
94
|
+
"bai/knowledge-note" ||
|
|
95
|
+
d.header.documentType ===
|
|
96
|
+
"bai/source") &&
|
|
33
97
|
(d.state.global.title === item ||
|
|
34
98
|
d.header.name === item));
|
|
35
|
-
return noteDoc ? (_jsx("button", { type: "button", onClick: () => setSelectedNode(noteDoc.header.id), className: "rounded px-1.5 py-0.5 text-[10px] cursor-pointer", style: {
|
|
36
|
-
|
|
99
|
+
return noteDoc ? (_jsx("button", { type: "button", onClick: () => setSelectedNode(noteDoc.header.id), className: "rounded px-1.5 py-0.5 text-[10px] cursor-pointer", style: {
|
|
100
|
+
backgroundColor: "var(--bai-hover)",
|
|
101
|
+
color: "var(--bai-accent)",
|
|
102
|
+
}, children: item.length > 50
|
|
103
|
+
? item.slice(0, 50) + "\u2026"
|
|
104
|
+
: item }, i)) : (_jsx("span", { className: "rounded px-1.5 py-0.5 text-[10px]", style: {
|
|
105
|
+
backgroundColor: "var(--bai-hover)",
|
|
106
|
+
color: "var(--bai-text-faint)",
|
|
107
|
+
}, children: item.length > 50
|
|
108
|
+
? item.slice(0, 50) + "\u2026"
|
|
109
|
+
: item }, i));
|
|
110
|
+
}), check.affectedItems.length > 5 && (_jsxs("span", { className: "text-[10px]", style: { color: "var(--bai-text-faint)" }, children: ["+", check.affectedItems.length - 5, " more"] }))] }))] })] }), check.status !== "PASS" && (_jsx(CheckGuidance, { category: check.category, affectedItems: check.affectedItems }))] }, check.id))) }))] }), recommendations.length > 0 && (_jsxs("div", { className: "rounded-xl p-6", style: {
|
|
111
|
+
backgroundColor: "var(--bai-surface)",
|
|
112
|
+
border: "1px solid var(--bai-border)",
|
|
113
|
+
}, children: [_jsxs("h3", { className: "mb-3 text-xs font-semibold uppercase tracking-wider", style: { color: "var(--bai-text-muted)" }, children: ["Recommendations (", recommendations.length, ")"] }), _jsx("ul", { className: "space-y-2", children: recommendations.map((rec, i) => (_jsxs("li", { className: "flex items-start gap-2 text-xs", style: { color: "var(--bai-text-secondary)" }, children: [_jsx("span", { className: "mt-0.5 h-1.5 w-1.5 shrink-0 rounded-full", style: { backgroundColor: "var(--bai-accent)" } }), rec] }, i))) })] }))] })] }) }));
|
|
37
114
|
}
|
|
38
115
|
const GUIDANCE = {
|
|
39
116
|
ORPHAN_DETECTION: {
|
|
@@ -77,9 +154,15 @@ const GUIDANCE = {
|
|
|
77
154
|
icon: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z",
|
|
78
155
|
},
|
|
79
156
|
};
|
|
80
|
-
function CheckGuidance({ category, affectedItems }) {
|
|
157
|
+
function CheckGuidance({ category, affectedItems, }) {
|
|
81
158
|
const guidance = GUIDANCE[category];
|
|
82
159
|
if (!guidance)
|
|
83
160
|
return null;
|
|
84
|
-
return (_jsx("div", { className: "mt-3 rounded-lg px-4 py-3", style: {
|
|
161
|
+
return (_jsx("div", { className: "mt-3 rounded-lg px-4 py-3", style: {
|
|
162
|
+
backgroundColor: "var(--bai-surface)",
|
|
163
|
+
border: "1px solid var(--bai-border)",
|
|
164
|
+
}, children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("svg", { className: "mt-0.5 h-4 w-4 shrink-0", style: { color: "var(--bai-accent)" }, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: guidance.icon }) }), _jsxs("div", { className: "flex-1 space-y-2", children: [_jsxs("div", { children: [_jsx("p", { className: "text-[10px] font-semibold uppercase tracking-wider", style: { color: "var(--bai-text-muted)" }, children: "How to fix" }), _jsx("p", { className: "mt-0.5 text-xs leading-relaxed", style: { color: "var(--bai-text-secondary)" }, children: guidance.manual })] }), _jsxs("div", { className: "flex items-center gap-2 rounded-md px-3 py-2", style: {
|
|
165
|
+
backgroundColor: "var(--bai-bg)",
|
|
166
|
+
border: "1px solid var(--bai-border)",
|
|
167
|
+
}, children: [_jsx("span", { className: "text-[10px] font-semibold", style: { color: "var(--bai-text-muted)" }, children: "AI Agent:" }), _jsx("code", { className: "text-[11px] font-mono", style: { color: "var(--bai-accent)" }, children: guidance.agent }), _jsx("span", { className: "text-[10px]", style: { color: "var(--bai-text-faint)" }, children: "in Claude Code" })] })] })] }) }));
|
|
85
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/knowledge-note-editor/editor.tsx"],"names":[],"mappings":"AAgCA,MAAM,CAAC,OAAO,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/knowledge-note-editor/editor.tsx"],"names":[],"mappings":"AAgCA,MAAM,CAAC,OAAO,UAAU,MAAM,4CA2X7B"}
|
|
@@ -64,10 +64,19 @@ export default function Editor() {
|
|
|
64
64
|
actor,
|
|
65
65
|
timestamp: ts,
|
|
66
66
|
comment,
|
|
67
|
-
})), onApprove: (id, actor, ts, comment) => dispatch(actions.approveNote({ id, actor, timestamp: ts, comment })), onReject: (id, actor, ts, comment) => dispatch(actions.rejectNote({ id, actor, timestamp: ts, comment })), onArchive: (id, actor, ts, comment) => dispatch(actions.archiveNote({ id, actor, timestamp: ts, comment })), onRestore: (id, actor, ts, comment) => dispatch(actions.restoreNote({ id, actor, timestamp: ts, comment })) }), _jsx("
|
|
68
|
-
if (e.key === "Enter")
|
|
67
|
+
})), onApprove: (id, actor, ts, comment) => dispatch(actions.approveNote({ id, actor, timestamp: ts, comment })), onReject: (id, actor, ts, comment) => dispatch(actions.rejectNote({ id, actor, timestamp: ts, comment })), onArchive: (id, actor, ts, comment) => dispatch(actions.archiveNote({ id, actor, timestamp: ts, comment })), onRestore: (id, actor, ts, comment) => dispatch(actions.restoreNote({ id, actor, timestamp: ts, comment })) }), _jsx("textarea", { defaultValue: state.title ?? "", placeholder: "Untitled Note", onBlur: (e) => handleSetTitle(e.target.value.trim()), onKeyDown: (e) => {
|
|
68
|
+
if (e.key === "Enter" && !e.shiftKey)
|
|
69
69
|
e.currentTarget.blur();
|
|
70
|
-
},
|
|
70
|
+
}, onInput: (e) => {
|
|
71
|
+
const el = e.currentTarget;
|
|
72
|
+
el.style.height = "auto";
|
|
73
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
74
|
+
}, ref: (el) => {
|
|
75
|
+
if (el) {
|
|
76
|
+
el.style.height = "auto";
|
|
77
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
78
|
+
}
|
|
79
|
+
}, rows: 1, className: "w-full resize-y border-0 bg-transparent text-2xl font-bold leading-snug outline-none", style: { color: "var(--bai-text)", overflow: "hidden" } })] }), _jsx("textarea", { defaultValue: state.description ?? "", placeholder: "Brief description (max 200 chars)...", maxLength: 200, rows: 2, onBlur: (e) => handleSetDescription(e.target.value.trim()), className: "w-full resize-none rounded-lg px-3 py-2 text-sm outline-none placeholder:opacity-50 focus:border-[#cba6f7]/50", style: {
|
|
71
80
|
backgroundColor: "var(--bai-bg)",
|
|
72
81
|
color: "var(--bai-text-secondary)",
|
|
73
82
|
border: "1px solid var(--bai-border)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/DriveExplorer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA+BlD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/DriveExplorer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA+BlD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,2CA+UtD"}
|
|
@@ -14,16 +14,29 @@ function GettingStartedModal({ onClose }) {
|
|
|
14
14
|
{ id: "graph", label: "Graph & Links" },
|
|
15
15
|
{ id: "plugin", label: "AI Agent" },
|
|
16
16
|
];
|
|
17
|
-
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [_jsx("div", { className: "absolute inset-0 bg-black/60", onClick: onClose }), _jsxs("div", { className: "relative z-10 flex h-[80vh] w-[720px] max-w-[90vw] flex-col rounded-2xl shadow-2xl", style: {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [_jsx("div", { className: "absolute inset-0 bg-black/60", onClick: onClose }), _jsxs("div", { className: "relative z-10 flex h-[80vh] w-[720px] max-w-[90vw] flex-col rounded-2xl shadow-2xl", style: {
|
|
18
|
+
backgroundColor: "var(--bai-surface)",
|
|
19
|
+
border: "1px solid var(--bai-border)",
|
|
20
|
+
}, children: [_jsxs("div", { className: "flex items-center justify-between px-6 py-4", style: { borderBottom: "1px solid var(--bai-border)" }, children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-bold", style: { color: "var(--bai-text)" }, children: "Getting Started" }), _jsx("p", { className: "text-xs", style: { color: "var(--bai-text-muted)" }, children: "Learn how to use the Knowledge Vault" })] }), _jsx("button", { type: "button", onClick: onClose, className: "rounded-lg p-2 transition-colors", style: { color: "var(--bai-text-muted)" }, children: _jsx("svg", { className: "h-5 w-5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }) })] }), _jsxs("div", { className: "flex flex-1 overflow-hidden", children: [_jsx("div", { className: "w-44 shrink-0 py-3", style: { borderRight: "1px solid var(--bai-border)" }, children: sections.map((s) => (_jsx("button", { type: "button", onClick: () => setActiveSection(s.id), className: "flex w-full px-4 py-2 text-left text-xs transition-colors", style: {
|
|
21
|
+
backgroundColor: activeSection === s.id
|
|
22
|
+
? "var(--bai-accent-soft)"
|
|
23
|
+
: "transparent",
|
|
24
|
+
color: activeSection === s.id
|
|
25
|
+
? "var(--bai-accent)"
|
|
26
|
+
: "var(--bai-text-tertiary)",
|
|
20
27
|
fontWeight: activeSection === s.id ? 500 : 400,
|
|
21
28
|
}, children: s.label }, s.id))) }), _jsxs("div", { className: "flex-1 overflow-y-auto px-6 py-5", children: [activeSection === "overview" && _jsx(OverviewSection, {}), activeSection === "sources" && _jsx(SourcesSection, {}), activeSection === "notes" && _jsx(NotesSection, {}), activeSection === "pipeline" && _jsx(PipelineSection, {}), activeSection === "graph" && _jsx(GraphSection, {}), activeSection === "plugin" && _jsx(PluginSection, {})] })] })] })] }));
|
|
22
29
|
}
|
|
23
30
|
const H = ({ children }) => (_jsx("h3", { className: "mb-3 text-sm font-semibold", style: { color: "var(--bai-text)" }, children: children }));
|
|
24
31
|
const P = ({ children }) => (_jsx("p", { className: "mb-4 text-xs leading-relaxed", style: { color: "var(--bai-text-tertiary)" }, children: children }));
|
|
25
|
-
const Step = ({ n, title, children, }) => (_jsxs("div", { className: "mb-4 flex gap-3", children: [_jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-[10px] font-bold", style: {
|
|
26
|
-
|
|
32
|
+
const Step = ({ n, title, children, }) => (_jsxs("div", { className: "mb-4 flex gap-3", children: [_jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-[10px] font-bold", style: {
|
|
33
|
+
backgroundColor: "var(--bai-accent-soft)",
|
|
34
|
+
color: "var(--bai-accent)",
|
|
35
|
+
}, children: n }), _jsxs("div", { children: [_jsx("p", { className: "text-xs font-medium", style: { color: "var(--bai-text)" }, children: title }), _jsx("p", { className: "mt-0.5 text-xs", style: { color: "var(--bai-text-muted)" }, children: children })] })] }));
|
|
36
|
+
const Tip = ({ children }) => (_jsx("div", { className: "mb-4 rounded-lg px-4 py-3", style: {
|
|
37
|
+
border: "1px solid var(--bai-accent-soft)",
|
|
38
|
+
backgroundColor: "var(--bai-accent-soft)",
|
|
39
|
+
}, children: _jsx("p", { className: "text-xs", style: { color: "var(--bai-accent)", opacity: 0.8 }, children: children }) }));
|
|
27
40
|
function OverviewSection() {
|
|
28
41
|
return (_jsxs("div", { children: [_jsx(H, { children: "What is the Knowledge Vault?" }), _jsx(P, { children: "A structured knowledge management system where raw content (articles, notes, transcripts) is processed into atomic claims, connected into a knowledge graph, and maintained over time." }), _jsx(H, { children: "The Navigation Tabs" }), _jsx("div", { className: "space-y-2 mb-4", children: [
|
|
29
42
|
{
|
|
@@ -62,7 +75,10 @@ function SourcesSection() {
|
|
|
62
75
|
"WEB_PAGE",
|
|
63
76
|
"BOOK_CHAPTER",
|
|
64
77
|
"MANUAL_ENTRY",
|
|
65
|
-
].map((t) => (_jsx("span", { className: "rounded px-2 py-1 text-[10px]", style: {
|
|
78
|
+
].map((t) => (_jsx("span", { className: "rounded px-2 py-1 text-[10px]", style: {
|
|
79
|
+
backgroundColor: "var(--bai-bg)",
|
|
80
|
+
color: "var(--bai-text-tertiary)",
|
|
81
|
+
}, children: t }, t))) }), _jsx(H, { children: "Source Lifecycle" }), _jsx(P, { children: "INBOX (new) \u2192 EXTRACTING (queued for AI) \u2192 EXTRACTED (claims created) \u2192 ARCHIVED (done)" }), _jsx(Tip, { children: "You can edit a source after creating it. Click \"Edit\" in the source viewer. Saving resets the status to INBOX so it can be re-processed with the updated content." }), _jsx(H, { children: "Deleting Sources" }), _jsx(P, { children: "In the Sources tab, hover over a source and click the trash icon. A confirmation dialog will appear before deletion." })] }));
|
|
66
82
|
}
|
|
67
83
|
function NotesSection() {
|
|
68
84
|
return (_jsxs("div", { children: [_jsx(H, { children: "Knowledge Notes" }), _jsx(P, { children: "Each note is an atomic claim \u2014 one idea, one point. Notes have declarative titles that read as complete sentences." }), _jsx(H, { children: "Note Structure" }), _jsx("div", { className: "space-y-1 mb-4", children: [
|
|
@@ -153,7 +169,10 @@ function GraphSection() {
|
|
|
153
169
|
].map((item) => (_jsxs("div", { className: "flex gap-2 rounded px-3 py-1.5", style: { backgroundColor: "var(--bai-bg)" }, children: [_jsx("span", { className: "shrink-0 text-[10px] font-medium w-20", style: { color: "var(--bai-text-secondary)" }, children: item.metric }), _jsx("span", { className: "text-[10px]", style: { color: "var(--bai-text-muted)" }, children: item.desc })] }, item.metric))) }), _jsx(Tip, { children: "The graph auto-syncs when notes change. If you add a link in the note editor, the graph view updates on the next tab switch." })] }));
|
|
154
170
|
}
|
|
155
171
|
function PluginSection() {
|
|
156
|
-
return (_jsxs("div", { children: [_jsx(H, { children: "AI Agent (Claude Plugin)" }), _jsx(P, { children: "The powerhouse-knowledge plugin connects Claude Code to your vault. The AI agent can extract claims, find connections, verify quality, and analyze the graph." }), _jsx(H, { children: "Setup \u2014 Local" }), _jsx(Step, { n: 1, title: "Start the reactor locally", children: "Run ph vetra --watch in your project directory. MCP is served at http://localhost:4001/mcp" }), _jsx(Step, { n: 2, title: "Open Claude Code with the plugin", children: "claude --plugin-dir ~/path/to/powerhouse-knowledge" }), _jsx(Step, { n: 3, title: "Run /setup", children: "This imports the Ars Contexta methodology (249 research claims) if not already present." }), _jsx(H, { children: "Setup \u2014 Remote Vault" }), _jsx(P, { children: "You can also connect to any remote Switchboard instance instead of running locally. Edit .mcp.json in the plugin directory to point to the remote reactor:" }), _jsxs("div", { className: "mb-4 rounded-lg px-4 py-3 font-mono text-[11px]", style: {
|
|
172
|
+
return (_jsxs("div", { children: [_jsx(H, { children: "AI Agent (Claude Plugin)" }), _jsx(P, { children: "The powerhouse-knowledge plugin connects Claude Code to your vault. The AI agent can extract claims, find connections, verify quality, and analyze the graph." }), _jsx(H, { children: "Setup \u2014 Local" }), _jsx(Step, { n: 1, title: "Start the reactor locally", children: "Run ph vetra --watch in your project directory. MCP is served at http://localhost:4001/mcp" }), _jsx(Step, { n: 2, title: "Open Claude Code with the plugin", children: "claude --plugin-dir ~/path/to/powerhouse-knowledge" }), _jsx(Step, { n: 3, title: "Run /setup", children: "This imports the Ars Contexta methodology (249 research claims) if not already present." }), _jsx(H, { children: "Setup \u2014 Remote Vault" }), _jsx(P, { children: "You can also connect to any remote Switchboard instance instead of running locally. Edit .mcp.json in the plugin directory to point to the remote reactor:" }), _jsxs("div", { className: "mb-4 rounded-lg px-4 py-3 font-mono text-[11px]", style: {
|
|
173
|
+
backgroundColor: "var(--bai-bg)",
|
|
174
|
+
color: "var(--bai-text-secondary)",
|
|
175
|
+
}, children: [_jsx("span", { style: { color: "var(--bai-text-muted)" }, children: `{` }), _jsx("br", {}), _jsx("span", { style: { color: "var(--bai-text-muted)" }, children: ` "mcpServers": { "reactor-mcp": {` }), _jsx("br", {}), _jsx("span", { style: { color: "var(--bai-text-muted)" }, children: ` "url": "` }), _jsx("span", { className: "text-emerald-400", children: "https://your-switchboard.example.com/mcp" }), _jsx("span", { style: { color: "var(--bai-text-muted)" }, children: `"` }), _jsx("br", {}), _jsx("span", { style: { color: "var(--bai-text-muted)" }, children: ` }}` }), _jsx("br", {}), _jsx("span", { style: { color: "var(--bai-text-muted)" }, children: `}` })] }), _jsx(Tip, { children: "No local reactor needed when connecting remotely. The plugin talks to the remote Switchboard via MCP over HTTPS. All skills work the same way \u2014 the only difference is the endpoint URL." }), _jsx(H, { children: "Key Commands" }), _jsx("div", { className: "space-y-1 mb-4", children: [
|
|
157
176
|
{ cmd: "/seed", desc: "Ingest source material for processing" },
|
|
158
177
|
{ cmd: "/extract", desc: "Extract atomic claims from a source" },
|
|
159
178
|
{ cmd: "/connect", desc: "Find and create links between notes" },
|
|
@@ -36,6 +36,6 @@ type GraphViewProps = {
|
|
|
36
36
|
mocs?: MocInfo[];
|
|
37
37
|
tensions?: TensionInfo[];
|
|
38
38
|
};
|
|
39
|
-
export declare function GraphView({ notes, graphState, mocs, tensions }: GraphViewProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function GraphView({ notes, graphState, mocs, tensions, }: GraphViewProps): import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
export {};
|
|
41
41
|
//# sourceMappingURL=GraphView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphView.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/GraphView.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAUzE,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,EAAE,CAAC;IACJ,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,gBAAgB,EAAE,MAAM,CAAC;QACzB,gBAAgB,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,EAAE,CAAC;IACJ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,IAAI,CAAC;AAET,KAAK,OAAO,GAAG;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACzD,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,iBAAiB,EA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,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AA0XF,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,GACT,EAAE,cAAc,2CAupBhB"}
|
|
@@ -328,7 +328,7 @@ function getLayoutOptions() {
|
|
|
328
328
|
/* ------------------------------------------------------------------ */
|
|
329
329
|
/* Component */
|
|
330
330
|
/* ------------------------------------------------------------------ */
|
|
331
|
-
export function GraphView({ notes, graphState, mocs, tensions }) {
|
|
331
|
+
export function GraphView({ notes, graphState, mocs, tensions, }) {
|
|
332
332
|
const containerRef = useRef(null);
|
|
333
333
|
const cyRef = useRef(null);
|
|
334
334
|
const [selectedDetail, setSelectedDetail] = useState(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HealthDashboard.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/HealthDashboard.tsx"],"names":[],"mappings":"AAqBA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"HealthDashboard.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/components/HealthDashboard.tsx"],"names":[],"mappings":"AAqBA,wBAAgB,eAAe,4CA8kB9B"}
|
|
@@ -191,7 +191,14 @@ export function HealthDashboard() {
|
|
|
191
191
|
border: "1px solid var(--bai-border)",
|
|
192
192
|
}, children: [_jsx("span", { className: `rounded-full border px-4 py-1.5 text-sm font-bold ${STATUS_BADGE[agentReport?.overallStatus ?? health.overallStatus]}`, children: agentReport?.overallStatus ?? health.overallStatus }), _jsxs("div", { className: "flex-1", children: [_jsx("h2", { className: "text-lg font-bold", style: { color: "var(--bai-text)" }, children: "Vault Health" }), _jsx("p", { className: "text-xs", style: { color: "var(--bai-text-muted)" }, children: agentReport
|
|
193
193
|
? `Agent report from ${new Date(agentReport.generatedAt).toLocaleString()} by ${agentReport.generatedBy}`
|
|
194
|
-
: "Live metrics \u2014 run /health in Claude Code for a full agent report" })] }), _jsx("span", { className: "rounded-full border px-3 py-1 text-[10px] font-medium", style: {
|
|
194
|
+
: "Live metrics \u2014 run /health in Claude Code for a full agent report" })] }), _jsx("span", { className: "rounded-full border px-3 py-1 text-[10px] font-medium", style: {
|
|
195
|
+
borderColor: "var(--bai-border)",
|
|
196
|
+
color: "var(--bai-text-muted)",
|
|
197
|
+
}, children: agentReport ? "Agent" : "Live" })] }), agentReport?.recommendations &&
|
|
198
|
+
agentReport.recommendations.length > 0 && (_jsxs("div", { className: "rounded-xl p-4", style: {
|
|
199
|
+
backgroundColor: "var(--bai-accent-soft)",
|
|
200
|
+
border: "1px solid var(--bai-border)",
|
|
201
|
+
}, children: [_jsx("h3", { className: "mb-2 text-xs font-semibold", style: { color: "var(--bai-accent)" }, children: "Agent Recommendations" }), _jsx("ul", { className: "space-y-1", children: agentReport.recommendations.map((rec, i) => (_jsxs("li", { className: "flex items-start gap-2 text-xs", style: { color: "var(--bai-text-secondary)" }, children: [_jsx("span", { className: "mt-0.5 h-1.5 w-1.5 shrink-0 rounded-full", style: { backgroundColor: "var(--bai-accent)" } }), rec] }, i))) })] })), _jsx("div", { className: "grid grid-cols-4 gap-3", children: [
|
|
195
202
|
{
|
|
196
203
|
label: "Notes",
|
|
197
204
|
value: agentReport?.graphMetrics?.noteCount ?? health.noteCount,
|
|
@@ -225,13 +232,18 @@ export function HealthDashboard() {
|
|
|
225
232
|
{
|
|
226
233
|
label: "Orphans",
|
|
227
234
|
value: agentReport?.graphMetrics?.orphanCount ?? health.orphanCount,
|
|
228
|
-
colorClass: (agentReport?.graphMetrics?.orphanCount ?? health.orphanCount) >
|
|
235
|
+
colorClass: (agentReport?.graphMetrics?.orphanCount ?? health.orphanCount) >
|
|
236
|
+
0
|
|
237
|
+
? "text-amber-400"
|
|
238
|
+
: "text-emerald-400",
|
|
229
239
|
colorStyle: undefined,
|
|
230
240
|
},
|
|
231
241
|
{
|
|
232
242
|
label: "Avg Links",
|
|
233
|
-
value: (agentReport?.graphMetrics?.averageLinksPerNote ??
|
|
234
|
-
|
|
243
|
+
value: (agentReport?.graphMetrics?.averageLinksPerNote ??
|
|
244
|
+
health.avgLinksPerNote).toFixed(1),
|
|
245
|
+
colorClass: (agentReport?.graphMetrics?.averageLinksPerNote ??
|
|
246
|
+
health.avgLinksPerNote) < 2
|
|
235
247
|
? "text-amber-400"
|
|
236
248
|
: "text-emerald-400",
|
|
237
249
|
colorStyle: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-drive-init.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/hooks/use-drive-init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-drive-init.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/hooks/use-drive-init.ts"],"names":[],"mappings":"AA+DA,wBAAgB,YAAY,SAsB3B;AAsGD;;;GAGG;AACH,wBAAgB,YAAY,wBAI3B"}
|
|
@@ -38,7 +38,11 @@ const FOLDERS = [
|
|
|
38
38
|
{ name: "research" },
|
|
39
39
|
];
|
|
40
40
|
const SINGLETONS = [
|
|
41
|
-
{
|
|
41
|
+
{
|
|
42
|
+
name: "PipelineQueue",
|
|
43
|
+
type: "bai/pipeline-queue",
|
|
44
|
+
folderPath: "ops/queue",
|
|
45
|
+
},
|
|
42
46
|
{ name: "HealthReport", type: "bai/health-report", folderPath: "ops/health" },
|
|
43
47
|
{ name: "KnowledgeGraph", type: "bai/knowledge-graph", folderPath: "self" },
|
|
44
48
|
{ name: "VaultConfig", type: "bai/vault-config", folderPath: "self" },
|
|
@@ -70,11 +74,15 @@ async function initDrive(driveId, existingNodes) {
|
|
|
70
74
|
const existingFolderMap = buildExistingFolderMap(existingNodes);
|
|
71
75
|
const folderIds = new Map(existingFolderMap);
|
|
72
76
|
for (const folder of FOLDERS) {
|
|
73
|
-
const path = folder.parentPath
|
|
77
|
+
const path = folder.parentPath
|
|
78
|
+
? `${folder.parentPath}/${folder.name}`
|
|
79
|
+
: folder.name;
|
|
74
80
|
if (folderIds.has(path)) {
|
|
75
81
|
continue;
|
|
76
82
|
}
|
|
77
|
-
const parentId = folder.parentPath
|
|
83
|
+
const parentId = folder.parentPath
|
|
84
|
+
? folderIds.get(folder.parentPath)
|
|
85
|
+
: undefined;
|
|
78
86
|
try {
|
|
79
87
|
const result = await addFolder(driveId, folder.name, parentId);
|
|
80
88
|
folderIds.set(path, result.id);
|
|
@@ -124,7 +132,9 @@ function buildExistingFolderMap(nodes) {
|
|
|
124
132
|
let current = folder;
|
|
125
133
|
while (current) {
|
|
126
134
|
pathParts.unshift(current.name);
|
|
127
|
-
current = current.parentFolder
|
|
135
|
+
current = current.parentFolder
|
|
136
|
+
? folderById.get(current.parentFolder)
|
|
137
|
+
: undefined;
|
|
128
138
|
}
|
|
129
139
|
map.set(pathParts.join("/"), folder.id);
|
|
130
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/moc-editor/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/moc-editor/editor.tsx"],"names":[],"mappings":"AAuBA,MAAM,CAAC,OAAO,UAAU,MAAM,4CA6X7B"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
3
|
import { generateId } from "document-model/core";
|
|
4
4
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
5
|
+
import { setSelectedNode, useDocumentsInSelectedDrive, } from "@powerhousedao/reactor-browser";
|
|
5
6
|
import { useSelectedMocDocument, actions, } from "@powerhousedao/knowledge-note/document-models/moc";
|
|
6
7
|
import { TOOLBAR_CLASS } from "../shared/theme-context.js";
|
|
7
8
|
const TIERS = ["HUB", "DOMAIN", "TOPIC"];
|
|
@@ -16,6 +17,7 @@ function ts() {
|
|
|
16
17
|
export default function Editor() {
|
|
17
18
|
const [document, dispatch] = useSelectedMocDocument();
|
|
18
19
|
const state = document.state.global;
|
|
20
|
+
const allDocs = useDocumentsInSelectedDrive();
|
|
19
21
|
const [newQuestion, setNewQuestion] = useState("");
|
|
20
22
|
const [newIdeaRef, setNewIdeaRef] = useState("");
|
|
21
23
|
const [newIdeaPhrase, setNewIdeaPhrase] = useState("");
|
|
@@ -47,10 +49,17 @@ export default function Editor() {
|
|
|
47
49
|
} })] }), _jsxs("div", { className: "grid grid-cols-2 gap-6", children: [_jsxs("div", { className: "rounded-xl p-6", style: {
|
|
48
50
|
backgroundColor: "var(--bai-surface)",
|
|
49
51
|
border: "1px solid var(--bai-border)",
|
|
50
|
-
}, children: [_jsxs("h3", { className: "mb-3 text-xs font-semibold uppercase tracking-wider", style: { color: "var(--bai-text-muted)" }, children: ["Core Ideas (", (state.coreIdeas ?? []).length, ")"] }), _jsxs("div", { className: "space-y-2", children: [(state.coreIdeas ?? []).map((idea) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
}, children: [_jsxs("h3", { className: "mb-3 text-xs font-semibold uppercase tracking-wider", style: { color: "var(--bai-text-muted)" }, children: ["Core Ideas (", (state.coreIdeas ?? []).length, ")"] }), _jsxs("div", { className: "space-y-2", children: [(state.coreIdeas ?? []).map((idea) => {
|
|
53
|
+
const linkedDoc = (allDocs ?? []).find((d) => d.header.id === idea.noteRef);
|
|
54
|
+
const noteTitle = linkedDoc
|
|
55
|
+
? (linkedDoc.state.global.title ?? linkedDoc.header.name)
|
|
56
|
+
: null;
|
|
57
|
+
return (_jsxs("div", { className: "group flex items-start gap-2 rounded-lg px-3 py-2", style: {
|
|
58
|
+
backgroundColor: "var(--bai-bg)",
|
|
59
|
+
boxShadow: "0 0 0 1px var(--bai-ring)",
|
|
60
|
+
}, children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("p", { className: "text-xs", style: { color: "var(--bai-text-secondary)" }, children: idea.contextPhrase }), idea.noteRef &&
|
|
61
|
+
(noteTitle ? (_jsxs("button", { type: "button", onClick: () => setSelectedNode(idea.noteRef), className: "mt-0.5 text-[10px] text-left truncate max-w-full transition-colors hover:underline", style: { color: "var(--bai-accent)" }, title: `Open note: ${noteTitle}`, children: [noteTitle, _jsxs("svg", { className: "ml-1 inline h-2.5 w-2.5", style: { color: "var(--bai-text-faint)" }, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" }), _jsx("path", { d: "M15 3h6v6" }), _jsx("path", { d: "M10 14L21 3" })] })] })) : (_jsx("p", { className: "text-[10px] font-mono mt-0.5", style: { color: "var(--bai-text-faint)" }, children: idea.noteRef.slice(0, 12) })))] }), _jsx("button", { type: "button", onClick: () => dispatch(actions.removeCoreIdea({ id: idea.id })), className: "opacity-0 hover:text-red-400 group-hover:opacity-100", style: { color: "var(--bai-text-faint)" }, children: "\u00D7" })] }, idea.id));
|
|
62
|
+
}), _jsxs("form", { className: "flex gap-2", onSubmit: (e) => {
|
|
54
63
|
e.preventDefault();
|
|
55
64
|
if (!newIdeaRef.trim() || !newIdeaPhrase.trim())
|
|
56
65
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/tension-editor/editor.tsx"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/tension-editor/editor.tsx"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAyO7B"}
|
|
@@ -24,28 +24,79 @@ export default function Editor() {
|
|
|
24
24
|
const involvedNotes = (state.involvedRefs ?? []).map((ref) => {
|
|
25
25
|
const doc = (allDocs ?? []).find((d) => d.header.id === ref);
|
|
26
26
|
const title = doc
|
|
27
|
-
? (doc.state.global
|
|
27
|
+
? (doc.state.global
|
|
28
|
+
.title ?? doc.header.name)
|
|
28
29
|
: ref.slice(0, 12);
|
|
29
30
|
return { ref, title, exists: !!doc };
|
|
30
31
|
});
|
|
31
|
-
return (_jsx("div", { className: "min-h-screen", style: { backgroundColor: "var(--bai-bg)", color: "var(--bai-text)" }, children: _jsxs("div", { className: "mx-auto max-w-3xl", children: [_jsx(DocumentToolbar, { className: TOOLBAR_CLASS }), _jsxs("div", { className: "p-6 space-y-6", children: [_jsxs("div", { className: "rounded-xl p-6", style: {
|
|
32
|
+
return (_jsx("div", { className: "min-h-screen", style: { backgroundColor: "var(--bai-bg)", color: "var(--bai-text)" }, children: _jsxs("div", { className: "mx-auto max-w-3xl", children: [_jsx(DocumentToolbar, { className: TOOLBAR_CLASS }), _jsxs("div", { className: "p-6 space-y-6", children: [_jsxs("div", { className: "rounded-xl p-6", style: {
|
|
33
|
+
backgroundColor: "var(--bai-surface)",
|
|
34
|
+
border: "1px solid var(--bai-border)",
|
|
35
|
+
}, children: [_jsxs("div", { className: "flex items-center gap-3 mb-3", children: [_jsx("span", { className: `rounded-full border px-3 py-1 text-xs font-semibold ${STATUS_COLORS[state.status ?? "OPEN"]}`, children: state.status }), state.observedBy && (_jsxs("span", { className: "text-xs", style: { color: "var(--bai-text-faint)" }, children: ["by ", state.observedBy] })), state.observedAt && (_jsx("span", { className: "text-xs", style: { color: "var(--bai-text-faint)" }, children: new Date(state.observedAt).toLocaleDateString() }))] }), _jsx("h1", { className: "text-xl font-bold", style: { color: "var(--bai-text)" }, children: state.title }), state.description && (_jsx("p", { className: "mt-2 text-sm", style: { color: "var(--bai-text-tertiary)" }, children: state.description }))] }), state.content && (_jsxs("div", { className: "rounded-xl p-6", style: {
|
|
36
|
+
backgroundColor: "var(--bai-surface)",
|
|
37
|
+
border: "1px solid var(--bai-border)",
|
|
38
|
+
}, children: [_jsx("h3", { className: "mb-2 text-xs font-semibold uppercase tracking-wider", style: { color: "var(--bai-text-muted)" }, children: "Analysis" }), _jsx("div", { className: "rounded-lg px-4 py-3", style: {
|
|
39
|
+
backgroundColor: "var(--bai-deep)",
|
|
40
|
+
border: "1px solid var(--bai-border)",
|
|
41
|
+
}, children: _jsx("pre", { className: "whitespace-pre-wrap text-sm leading-relaxed", style: { color: "var(--bai-text-secondary)" }, children: state.content }) })] })), _jsxs("div", { className: "rounded-xl p-6", style: {
|
|
42
|
+
backgroundColor: "var(--bai-surface)",
|
|
43
|
+
border: "1px solid var(--bai-border)",
|
|
44
|
+
}, children: [_jsxs("h3", { className: "mb-3 text-xs font-semibold uppercase tracking-wider", style: { color: "var(--bai-text-muted)" }, children: ["Involved Notes (", involvedNotes.length, ")"] }), _jsx("div", { className: "space-y-2", children: involvedNotes.map((note) => (_jsxs("div", { className: "flex items-center gap-3 rounded-lg px-4 py-3", style: {
|
|
45
|
+
backgroundColor: "var(--bai-bg)",
|
|
46
|
+
border: "1px solid var(--bai-border)",
|
|
47
|
+
}, children: [_jsx("span", { className: "h-2 w-2 shrink-0 rounded-full bg-red-400" }), note.exists ? (_jsx("button", { type: "button", onClick: () => setSelectedNode(note.ref), className: "flex-1 text-left text-xs transition-colors truncate", style: { color: "var(--bai-accent)" }, children: note.title })) : (_jsx("span", { className: "flex-1 text-xs font-mono truncate", style: { color: "var(--bai-text-faint)" }, children: note.ref }))] }, note.ref))) })] }), state.resolution && (_jsxs("div", { className: "rounded-xl p-6", style: {
|
|
48
|
+
backgroundColor: "var(--bai-surface)",
|
|
49
|
+
border: "1px solid var(--bai-border)",
|
|
50
|
+
}, children: [_jsx("h3", { className: "mb-2 text-xs font-semibold uppercase tracking-wider", style: { color: "var(--bai-text-muted)" }, children: "Resolution" }), _jsx("p", { className: "text-sm leading-relaxed", style: { color: "var(--bai-text-secondary)" }, children: state.resolution }), state.resolvedAt && (_jsxs("p", { className: "mt-2 text-[10px]", style: { color: "var(--bai-text-faint)" }, children: ["Resolved ", new Date(state.resolvedAt).toLocaleString()] }))] })), state.status === "OPEN" && (_jsxs("div", { className: "flex gap-3", children: [_jsx("button", { type: "button", onClick: () => {
|
|
32
51
|
const resolution = prompt("How was this resolved? (one side is correct)");
|
|
33
52
|
if (resolution)
|
|
34
53
|
dispatch(actions.resolveTension({ resolution, resolvedAt: ts() }));
|
|
35
|
-
}, className: "rounded-lg px-4 py-2 text-sm font-medium", style: {
|
|
54
|
+
}, className: "rounded-lg px-4 py-2 text-sm font-medium", style: {
|
|
55
|
+
backgroundColor: "var(--bai-accent)",
|
|
56
|
+
color: "var(--bai-accent-text)",
|
|
57
|
+
}, children: "Resolve" }), _jsx("button", { type: "button", onClick: () => {
|
|
36
58
|
const resolution = prompt("Why is this tension apparent, not real?");
|
|
37
59
|
if (resolution)
|
|
38
60
|
dispatch(actions.dissolveTension({ resolution, resolvedAt: ts() }));
|
|
39
|
-
}, className: "rounded-lg px-4 py-2 text-sm font-medium", style: {
|
|
61
|
+
}, className: "rounded-lg px-4 py-2 text-sm font-medium", style: {
|
|
62
|
+
backgroundColor: "var(--bai-hover)",
|
|
63
|
+
color: "var(--bai-text-secondary)",
|
|
64
|
+
}, children: "Dissolve" })] }))] })] }) }));
|
|
40
65
|
}
|
|
41
|
-
function CreateForm({ dispatch }) {
|
|
66
|
+
function CreateForm({ dispatch, }) {
|
|
42
67
|
const [title, setTitle] = useState("");
|
|
43
68
|
const [desc, setDesc] = useState("");
|
|
44
69
|
const [content, setContent] = useState("");
|
|
45
70
|
const [observer, setObserver] = useState("");
|
|
46
71
|
const INPUT = "w-full rounded-lg px-3 py-2 text-sm outline-none focus:border-[#cba6f7]/50";
|
|
47
|
-
return (_jsx("div", { className: "min-h-screen", style: { backgroundColor: "var(--bai-bg)", color: "var(--bai-text)" }, children: _jsxs("div", { className: "mx-auto max-w-2xl", children: [_jsx(DocumentToolbar, { className: TOOLBAR_CLASS }), _jsx("div", { className: "p-6", children: _jsxs("div", { className: "rounded-xl p-8 space-y-4", style: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
return (_jsx("div", { className: "min-h-screen", style: { backgroundColor: "var(--bai-bg)", color: "var(--bai-text)" }, children: _jsxs("div", { className: "mx-auto max-w-2xl", children: [_jsx(DocumentToolbar, { className: TOOLBAR_CLASS }), _jsx("div", { className: "p-6", children: _jsxs("div", { className: "rounded-xl p-8 space-y-4", style: {
|
|
73
|
+
backgroundColor: "var(--bai-surface)",
|
|
74
|
+
border: "1px solid var(--bai-border)",
|
|
75
|
+
}, children: [_jsx("h2", { className: "text-lg font-bold", style: { color: "var(--bai-text)" }, children: "Identify Tension" }), _jsx("p", { className: "text-xs", style: { color: "var(--bai-text-muted)" }, children: "Record a contradiction between two or more claims in the vault" }), _jsx("input", { type: "text", value: title, onChange: (e) => setTitle(e.target.value), placeholder: "What's the contradiction? (e.g., 'vault as tool vs vault as cognitive infrastructure')", className: INPUT, style: {
|
|
76
|
+
backgroundColor: "var(--bai-bg)",
|
|
77
|
+
color: "var(--bai-text-secondary)",
|
|
78
|
+
border: "1px solid var(--bai-border)",
|
|
79
|
+
} }), _jsx("input", { type: "text", value: desc, onChange: (e) => setDesc(e.target.value), placeholder: "Brief summary of the conflict", className: INPUT, style: {
|
|
80
|
+
backgroundColor: "var(--bai-bg)",
|
|
81
|
+
color: "var(--bai-text-secondary)",
|
|
82
|
+
border: "1px solid var(--bai-border)",
|
|
83
|
+
} }), _jsx("textarea", { value: content, onChange: (e) => setContent(e.target.value), placeholder: "Full analysis of the contradiction \u2014 why it matters, what's at stake...", rows: 6, className: INPUT, style: {
|
|
84
|
+
backgroundColor: "var(--bai-deep)",
|
|
85
|
+
color: "var(--bai-text-secondary)",
|
|
86
|
+
border: "1px solid var(--bai-border)",
|
|
87
|
+
} }), _jsx("input", { type: "text", value: observer, onChange: (e) => setObserver(e.target.value), placeholder: "Observed by (optional)", className: INPUT, style: {
|
|
88
|
+
backgroundColor: "var(--bai-bg)",
|
|
89
|
+
color: "var(--bai-text-secondary)",
|
|
90
|
+
border: "1px solid var(--bai-border)",
|
|
91
|
+
} }), _jsx("button", { type: "button", disabled: !title.trim() || !desc.trim(), onClick: () => dispatch(actions.createTension({
|
|
92
|
+
title,
|
|
93
|
+
description: desc,
|
|
94
|
+
content: content || undefined,
|
|
95
|
+
involvedRefs: [],
|
|
96
|
+
observedAt: ts(),
|
|
97
|
+
observedBy: observer || undefined,
|
|
98
|
+
})), className: "rounded-lg px-4 py-2 text-sm font-medium hover:opacity-80 disabled:opacity-40", style: {
|
|
99
|
+
backgroundColor: "var(--bai-accent)",
|
|
100
|
+
color: "var(--bai-accent-text)",
|
|
101
|
+
}, children: "Create Tension" })] }) })] }) }));
|
|
51
102
|
}
|
package/dist/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/graph-indexer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,qBAAa,qBAAsB,SAAQ,qBAAqB,CAAC,EAAE,CAAC;WAClD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAItC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY,CACzB,UAAU,EAAE,oBAAoB,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/graph-indexer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEj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EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAyBD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;gBAEzB,OAAO,CAAC,eAAe,EAAE,CAAC;gBAK1B,OAAO,CAAC,eAAe,EAAE,CAAC;iCAM9B,MAAM,GACjB,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;0BASX,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;mBAS1C,OAAO,CAAC,eAAe,EAAE,CAAC;aAchC,OAAO,CAAC,gBAAgB,CAAC;4BAiB1B,MAAM,sBAEjB,OAAO,CAAC,gBAAgB,EAAE,CAAC;0BA4CF,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;eAS9C,OAAO,CAAC,MAAM,CAAC;uBAOP,MAAM,mBAAe,OAAO,CAAC,eAAe,EAAE,CAAC;6BAgBzC,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;+BASrC,OAAO,CAClC,KAAK,CAAC;QACJ,CAAC,EAAE,eAAe,CAAC;QACnB,CAAC,EAAE,eAAe,CAAC;QACnB,YAAY,EAAE,eAAe,CAAC;KAC/B,CAAC,CACH;eAuDgB,OAAO,CAAC,eAAe,EAAE,CAAC;EA6D9C"}
|
|
@@ -163,7 +163,8 @@ export function createGraphQuery(db) {
|
|
|
163
163
|
const aId = sources[i];
|
|
164
164
|
const bId = sources[j];
|
|
165
165
|
// Check if A→B or B→A exists
|
|
166
|
-
if (!edgeSet.has(`${aId}->${bId}`) &&
|
|
166
|
+
if (!edgeSet.has(`${aId}->${bId}`) &&
|
|
167
|
+
!edgeSet.has(`${bId}->${aId}`)) {
|
|
167
168
|
const a = nodeMap.get(aId);
|
|
168
169
|
const b = nodeMap.get(bId);
|
|
169
170
|
if (a && b) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../processors/methodology-indexer/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,eAAO,MAAM,kCAAkC,GAC5C,QAAQ,oBAAoB,MACtB,aAAa,gBAAgB,KAAG,OAAO,CAAC,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../processors/methodology-indexer/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,eAAO,MAAM,kCAAkC,GAC5C,QAAQ,oBAAoB,MACtB,aAAa,gBAAgB,KAAG,OAAO,CAAC,eAAe,EAAE,CAgC/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/methodology-indexer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,2BAA4B,SAAQ,qBAAqB,CAAC,aAAa,CAAC;WACnE,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAItC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY,CACzB,UAAU,EAAE,oBAAoB,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC;IAsGV,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/methodology-indexer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,2BAA4B,SAAQ,qBAAqB,CAAC,aAAa,CAAC;WACnE,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAItC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY,CACzB,UAAU,EAAE,oBAAoB,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC;IAsGV,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;YAYrB,WAAW;CAkB1B"}
|
|
@@ -89,9 +89,7 @@ export class MethodologyIndexerProcessor extends RelationalDbProcessor {
|
|
|
89
89
|
}
|
|
90
90
|
async onDisconnect() {
|
|
91
91
|
try {
|
|
92
|
-
await this.relationalDb
|
|
93
|
-
.deleteFrom("methodology_connections")
|
|
94
|
-
.execute();
|
|
92
|
+
await this.relationalDb.deleteFrom("methodology_connections").execute();
|
|
95
93
|
await this.relationalDb.deleteFrom("methodology_claims").execute();
|
|
96
94
|
console.log(`[MethodologyIndexer] Cleaned up namespace: ${this.namespace}`);
|
|
97
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../processors/methodology-indexer/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../processors/methodology-indexer/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC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
export function createMethodologyQuery(db) {
|
|
23
23
|
return {
|
|
24
24
|
async allClaims() {
|
|
25
|
-
const rows = await db
|
|
25
|
+
const rows = await db
|
|
26
|
+
.selectFrom("methodology_claims")
|
|
27
|
+
.selectAll()
|
|
28
|
+
.execute();
|
|
26
29
|
return rows.map(rowToClaim);
|
|
27
30
|
},
|
|
28
31
|
async claimCount() {
|
|
29
|
-
const rows = await db
|
|
32
|
+
const rows = await db
|
|
33
|
+
.selectFrom("methodology_claims")
|
|
34
|
+
.selectAll()
|
|
35
|
+
.execute();
|
|
30
36
|
return rows.length;
|
|
31
37
|
},
|
|
32
38
|
async claimByDocumentId(documentId) {
|
|
@@ -63,7 +69,7 @@ export function createMethodologyQuery(db) {
|
|
|
63
69
|
const q = `%"${topic.toLowerCase()}"%`;
|
|
64
70
|
const rows = await db
|
|
65
71
|
.selectFrom("methodology_claims")
|
|
66
|
-
.where(eb => eb(eb.fn("lower", ["topics"]), "like", q))
|
|
72
|
+
.where((eb) => eb(eb.fn("lower", ["topics"]), "like", q))
|
|
67
73
|
.selectAll()
|
|
68
74
|
.execute();
|
|
69
75
|
return rows.map(rowToClaim);
|
|
@@ -85,8 +91,14 @@ export function createMethodologyQuery(db) {
|
|
|
85
91
|
return rows.map(rowToConnection);
|
|
86
92
|
},
|
|
87
93
|
async stats() {
|
|
88
|
-
const claims = await db
|
|
89
|
-
|
|
94
|
+
const claims = await db
|
|
95
|
+
.selectFrom("methodology_claims")
|
|
96
|
+
.selectAll()
|
|
97
|
+
.execute();
|
|
98
|
+
const connections = await db
|
|
99
|
+
.selectFrom("methodology_connections")
|
|
100
|
+
.selectAll()
|
|
101
|
+
.execute();
|
|
90
102
|
const kindDist = {};
|
|
91
103
|
for (const c of claims) {
|
|
92
104
|
const k = c.kind ?? "unknown";
|
package/dist/style.css
CHANGED
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
--font-weight-semibold: 600;
|
|
74
74
|
--font-weight-bold: 700;
|
|
75
75
|
--tracking-wider: 0.05em;
|
|
76
|
+
--leading-snug: 1.375;
|
|
76
77
|
--leading-relaxed: 1.625;
|
|
77
78
|
--radius-md: 0.375rem;
|
|
78
79
|
--radius-lg: 0.5rem;
|
|
@@ -601,6 +602,9 @@
|
|
|
601
602
|
.max-w-\[120px\] {
|
|
602
603
|
max-width: 120px;
|
|
603
604
|
}
|
|
605
|
+
.max-w-full {
|
|
606
|
+
max-width: 100%;
|
|
607
|
+
}
|
|
604
608
|
.min-w-0 {
|
|
605
609
|
min-width: calc(var(--spacing) * 0);
|
|
606
610
|
}
|
|
@@ -1222,6 +1226,10 @@
|
|
|
1222
1226
|
--tw-leading: var(--leading-relaxed);
|
|
1223
1227
|
line-height: var(--leading-relaxed);
|
|
1224
1228
|
}
|
|
1229
|
+
.leading-snug {
|
|
1230
|
+
--tw-leading: var(--leading-snug);
|
|
1231
|
+
line-height: var(--leading-snug);
|
|
1232
|
+
}
|
|
1225
1233
|
.font-bold {
|
|
1226
1234
|
--tw-font-weight: var(--font-weight-bold);
|
|
1227
1235
|
font-weight: var(--font-weight-bold);
|
|
@@ -1559,6 +1567,13 @@
|
|
|
1559
1567
|
}
|
|
1560
1568
|
}
|
|
1561
1569
|
}
|
|
1570
|
+
.hover\:underline {
|
|
1571
|
+
&:hover {
|
|
1572
|
+
@media (hover: hover) {
|
|
1573
|
+
text-decoration-line: underline;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1562
1577
|
.hover\:opacity-80 {
|
|
1563
1578
|
&:hover {
|
|
1564
1579
|
@media (hover: hover) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subgraph.d.ts","sourceRoot":"","sources":["../../../subgraphs/knowledge-graph/subgraph.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,KAAK,YAAY,EAElB,MAAM,4BAA4B,CAAC;AAMpC,qBAAa,sBAAuB,SAAQ,YAAY;IAC7C,IAAI,SAAoB;IAExB,QAAQ,
|
|
1
|
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;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE,MAAM,CAAA;aAAE;qCAMhB,OAAO,QAAQ;gBAAE,OAAO,EAAE,MAAM,CAAA;aAAE;;;;;;;;;;;;;;;;;;;;;;;MAsDnE;gBAEU,IAAI,EAAE,YAAY;IAI9B,OAAO,CAAC,QAAQ;IAUhB;;;;OAIG;IACH,OAAO,CAAC,aAAa,CAAqB;YAE5B,cAAc;CAmD7B"}
|
|
@@ -50,16 +50,31 @@ export class KnowledgeGraphSubgraph extends BaseSubgraph {
|
|
|
50
50
|
documentId: String!
|
|
51
51
|
depth: Int
|
|
52
52
|
): [ConnectionResult!]!
|
|
53
|
-
knowledgeGraphNodesByStatus(
|
|
54
|
-
|
|
53
|
+
knowledgeGraphNodesByStatus(
|
|
54
|
+
driveId: ID!
|
|
55
|
+
status: String!
|
|
56
|
+
): [KnowledgeGraphNode!]!
|
|
57
|
+
knowledgeGraphBacklinks(
|
|
58
|
+
driveId: ID!
|
|
59
|
+
documentId: String!
|
|
60
|
+
): [KnowledgeGraphEdge!]!
|
|
55
61
|
knowledgeGraphDensity(driveId: ID!): Float!
|
|
56
62
|
|
|
57
|
-
knowledgeGraphSearch(
|
|
63
|
+
knowledgeGraphSearch(
|
|
64
|
+
driveId: ID!
|
|
65
|
+
query: String!
|
|
66
|
+
limit: Int
|
|
67
|
+
): [KnowledgeGraphNode!]!
|
|
58
68
|
knowledgeGraphTriangles(driveId: ID!, limit: Int): [Triangle!]!
|
|
59
69
|
knowledgeGraphBridges(driveId: ID!): [KnowledgeGraphNode!]!
|
|
60
|
-
knowledgeGraphForwardLinks(
|
|
70
|
+
knowledgeGraphForwardLinks(
|
|
71
|
+
driveId: ID!
|
|
72
|
+
documentId: String!
|
|
73
|
+
): [KnowledgeGraphEdge!]!
|
|
61
74
|
|
|
62
|
-
"""
|
|
75
|
+
"""
|
|
76
|
+
Debug: raw processor DB tables
|
|
77
|
+
"""
|
|
63
78
|
knowledgeGraphDebug(driveId: ID!): GraphDebugInfo!
|
|
64
79
|
}
|
|
65
80
|
|
|
@@ -125,7 +140,11 @@ export class KnowledgeGraphSubgraph extends BaseSubgraph {
|
|
|
125
140
|
knowledgeGraphTriangles: async (_, args) => {
|
|
126
141
|
const query = this.getQuery(args.driveId);
|
|
127
142
|
const triangles = await query.triangles(args.limit ?? 20);
|
|
128
|
-
return triangles.map((t) => ({
|
|
143
|
+
return triangles.map((t) => ({
|
|
144
|
+
noteA: t.a,
|
|
145
|
+
noteB: t.b,
|
|
146
|
+
sharedTarget: t.sharedTarget,
|
|
147
|
+
}));
|
|
129
148
|
},
|
|
130
149
|
knowledgeGraphBridges: async (_, args) => {
|
|
131
150
|
const query = this.getQuery(args.driveId);
|
|
@@ -150,14 +169,21 @@ export class KnowledgeGraphSubgraph extends BaseSubgraph {
|
|
|
150
169
|
rawNodeCount: rawNodes.length,
|
|
151
170
|
rawEdgeCount: rawEdges.length,
|
|
152
171
|
rawNodes: rawNodes.map((r) => ({
|
|
153
|
-
id: r.id,
|
|
154
|
-
|
|
155
|
-
|
|
172
|
+
id: r.id,
|
|
173
|
+
documentId: r.document_id,
|
|
174
|
+
title: r.title,
|
|
175
|
+
description: r.description,
|
|
176
|
+
noteType: r.note_type,
|
|
177
|
+
status: r.status,
|
|
178
|
+
updatedAt: r.updated_at,
|
|
156
179
|
})),
|
|
157
180
|
rawEdges: rawEdges.map((r) => ({
|
|
158
|
-
id: r.id,
|
|
159
|
-
|
|
160
|
-
|
|
181
|
+
id: r.id,
|
|
182
|
+
sourceDocumentId: r.source_document_id,
|
|
183
|
+
targetDocumentId: r.target_document_id,
|
|
184
|
+
linkType: r.link_type,
|
|
185
|
+
targetTitle: r.target_title,
|
|
186
|
+
updatedAt: r.updated_at,
|
|
161
187
|
})),
|
|
162
188
|
processorNamespace: namespace,
|
|
163
189
|
};
|
|
@@ -165,8 +191,10 @@ export class KnowledgeGraphSubgraph extends BaseSubgraph {
|
|
|
165
191
|
catch (err) {
|
|
166
192
|
console.warn(`[KnowledgeGraphSubgraph] Debug query failed for ${namespace}:`, err);
|
|
167
193
|
return {
|
|
168
|
-
rawNodeCount: 0,
|
|
169
|
-
|
|
194
|
+
rawNodeCount: 0,
|
|
195
|
+
rawEdgeCount: 0,
|
|
196
|
+
rawNodes: [],
|
|
197
|
+
rawEdges: [],
|
|
170
198
|
processorNamespace: namespace,
|
|
171
199
|
};
|
|
172
200
|
}
|
|
@@ -205,7 +233,9 @@ export class KnowledgeGraphSubgraph extends BaseSubgraph {
|
|
|
205
233
|
parentIdentifier: parentFolder ?? driveId,
|
|
206
234
|
});
|
|
207
235
|
console.log(`[KnowledgeGraphSubgraph] Auto-created KnowledgeGraph in drive ${driveId}` +
|
|
208
|
-
(parentFolder
|
|
236
|
+
(parentFolder
|
|
237
|
+
? ` (folder: /self/)`
|
|
238
|
+
: ` (drive root — /self/ folder not found)`));
|
|
209
239
|
}
|
|
210
240
|
}
|
|
211
241
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subgraph.d.ts","sourceRoot":"","sources":["../../../subgraphs/methodology/subgraph.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"subgraph.d.ts","sourceRoot":"","sources":["../../../subgraphs/methodology/subgraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM7E,qBAAa,mBAAoB,SAAQ,YAAY;IAC1C,IAAI,SAAiB;IAErB,QAAQ,iCAiDf;IAEO,SAAS;;mCAGT,OAAO,QACJ;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,CAAA;aAAE;mCAM7B,OAAO,QAAQ;gBAAE,OAAO,EAAE,MAAM,CAAA;aAAE;yCAM1D,OAAO,QACJ;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAA;aAAE;0CAOpC,OAAO,QACJ;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE;sCAOrC,OAAO,QACJ;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE,MAAM,CAAA;aAAE;kCAMnB,OAAO,QAAQ;gBAAE,OAAO,EAAE,MAAM,CAAA;aAAE;;;;;4CAMzD,OAAO,QACJ;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE,MAAM,CAAA;aAAE;0CAO1C,OAAO,QACJ;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAA;aAAE;;MAMhD;gBAEU,IAAI,EAAE,YAAY;IAI9B,OAAO,CAAC,QAAQ;CASjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { gql } from "graphql-tag";
|
|
2
|
-
import { BaseSubgraph
|
|
2
|
+
import { BaseSubgraph } from "@powerhousedao/reactor-api";
|
|
3
3
|
import { MethodologyIndexerProcessor } from "../../processors/methodology-indexer/index.js";
|
|
4
4
|
import { createMethodologyQuery } from "../../processors/methodology-indexer/query.js";
|
|
5
5
|
export class MethodologySubgraph extends BaseSubgraph {
|
|
@@ -31,14 +31,27 @@ export class MethodologySubgraph extends BaseSubgraph {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
extend type Query {
|
|
34
|
-
methodologySearch(
|
|
34
|
+
methodologySearch(
|
|
35
|
+
driveId: ID!
|
|
36
|
+
query: String!
|
|
37
|
+
limit: Int
|
|
38
|
+
): [MethodologyClaim!]!
|
|
35
39
|
methodologyClaims(driveId: ID!): [MethodologyClaim!]!
|
|
36
40
|
methodologyClaimsByKind(driveId: ID!, kind: String!): [MethodologyClaim!]!
|
|
37
|
-
methodologyClaimsByTopic(
|
|
41
|
+
methodologyClaimsByTopic(
|
|
42
|
+
driveId: ID!
|
|
43
|
+
topic: String!
|
|
44
|
+
): [MethodologyClaim!]!
|
|
38
45
|
methodologyClaimById(driveId: ID!, documentId: String!): MethodologyClaim
|
|
39
46
|
methodologyStats(driveId: ID!): MethodologyStats!
|
|
40
|
-
methodologyConnectionsFrom(
|
|
41
|
-
|
|
47
|
+
methodologyConnectionsFrom(
|
|
48
|
+
driveId: ID!
|
|
49
|
+
documentId: String!
|
|
50
|
+
): [MethodologyConnection!]!
|
|
51
|
+
methodologyConnectionsTo(
|
|
52
|
+
driveId: ID!
|
|
53
|
+
targetRef: String!
|
|
54
|
+
): [MethodologyConnection!]!
|
|
42
55
|
}
|
|
43
56
|
`;
|
|
44
57
|
resolvers = {
|
|
@@ -41,7 +41,10 @@ describe("graph_nodes table", () => {
|
|
|
41
41
|
expect(row.status).toBe("CANONICAL");
|
|
42
42
|
expect(row.updated_at).toBe("2024-01-01T00:00:00Z");
|
|
43
43
|
// cleanup
|
|
44
|
-
await db
|
|
44
|
+
await db
|
|
45
|
+
.deleteFrom("graph_nodes")
|
|
46
|
+
.where("document_id", "=", "doc-1")
|
|
47
|
+
.execute();
|
|
45
48
|
});
|
|
46
49
|
});
|
|
47
50
|
describe("graph_edges table", () => {
|
|
@@ -232,7 +235,10 @@ describe("upsert on conflict", () => {
|
|
|
232
235
|
expect(rows[0].status).toBe("CANONICAL");
|
|
233
236
|
expect(rows[0].updated_at).toBe("2024-06-01T00:00:00Z");
|
|
234
237
|
// cleanup
|
|
235
|
-
await db
|
|
238
|
+
await db
|
|
239
|
+
.deleteFrom("graph_nodes")
|
|
240
|
+
.where("document_id", "=", docId)
|
|
241
|
+
.execute();
|
|
236
242
|
});
|
|
237
243
|
});
|
|
238
244
|
describe("edge reconciliation", () => {
|
|
@@ -4,7 +4,10 @@ import { reducer, utils, actions, } from "@powerhousedao/knowledge-note/document
|
|
|
4
4
|
describe("Content module — state mutations", () => {
|
|
5
5
|
it("SET_TITLE — updates state.global.title", () => {
|
|
6
6
|
const document = utils.createDocument();
|
|
7
|
-
const updated = reducer(document, actions.setTitle({
|
|
7
|
+
const updated = reducer(document, actions.setTitle({
|
|
8
|
+
title: "My Note Title",
|
|
9
|
+
updatedAt: "2026-01-01T00:00:00Z",
|
|
10
|
+
}));
|
|
8
11
|
expect(updated.state.global.title).toBe("My Note Title");
|
|
9
12
|
});
|
|
10
13
|
it("SET_DESCRIPTION — updates state.global.description", () => {
|
|
@@ -204,9 +204,21 @@ describe("Lifecycle state machine — DRAFT → IN_REVIEW → CANONICAL → ARCH
|
|
|
204
204
|
expect(restored.state.global.status).toBe("DRAFT");
|
|
205
205
|
expect(restored.state.global.lifecycleEvents).toHaveLength(4);
|
|
206
206
|
const events = restored.state.global.lifecycleEvents;
|
|
207
|
-
expect(events[0]).toMatchObject({
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
expect(events[0]).toMatchObject({
|
|
208
|
+
fromStatus: "DRAFT",
|
|
209
|
+
toStatus: "IN_REVIEW",
|
|
210
|
+
});
|
|
211
|
+
expect(events[1]).toMatchObject({
|
|
212
|
+
fromStatus: "IN_REVIEW",
|
|
213
|
+
toStatus: "CANONICAL",
|
|
214
|
+
});
|
|
215
|
+
expect(events[2]).toMatchObject({
|
|
216
|
+
fromStatus: "CANONICAL",
|
|
217
|
+
toStatus: "ARCHIVED",
|
|
218
|
+
});
|
|
219
|
+
expect(events[3]).toMatchObject({
|
|
220
|
+
fromStatus: "ARCHIVED",
|
|
221
|
+
toStatus: "DRAFT",
|
|
222
|
+
});
|
|
211
223
|
});
|
|
212
224
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { reducer, utils, actions } from "@powerhousedao/knowledge-note/document-models/moc/v1";
|
|
2
|
+
import { reducer, utils, actions, } from "@powerhousedao/knowledge-note/document-models/moc/v1";
|
|
3
3
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
4
4
|
/** Create a fresh MOC document with CREATE_MOC already applied. */
|
|
5
5
|
function makeInitialisedMoc() {
|
|
@@ -89,7 +89,10 @@ describe("PipelineQueue — queue management reducers", () => {
|
|
|
89
89
|
completedAt: "2026-01-01T03:00:00Z",
|
|
90
90
|
},
|
|
91
91
|
}));
|
|
92
|
-
expect(after2.state.global.tasks[0].completedPhases).toEqual([
|
|
92
|
+
expect(after2.state.global.tasks[0].completedPhases).toEqual([
|
|
93
|
+
"create",
|
|
94
|
+
"reflect",
|
|
95
|
+
]);
|
|
93
96
|
expect(after2.state.global.tasks[0].currentPhase).toBe("reweave");
|
|
94
97
|
});
|
|
95
98
|
// ── Test 4 ──────────────────────────────────────────────────────────────────
|
|
@@ -144,7 +147,12 @@ describe("PipelineQueue — queue management reducers", () => {
|
|
|
144
147
|
const task = completed.state.global.tasks[0];
|
|
145
148
|
expect(task.status).toBe("DONE");
|
|
146
149
|
expect(task.currentPhase).toBeNull();
|
|
147
|
-
expect(task.completedPhases).toEqual([
|
|
150
|
+
expect(task.completedPhases).toEqual([
|
|
151
|
+
"create",
|
|
152
|
+
"reflect",
|
|
153
|
+
"reweave",
|
|
154
|
+
"verify",
|
|
155
|
+
]);
|
|
148
156
|
expect(completed.state.global.completedCount).toBe(1);
|
|
149
157
|
expect(completed.state.global.activeCount).toBe(0);
|
|
150
158
|
});
|