@powerhousedao/knowledge-note 1.0.6 → 1.0.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"links-section.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-note-editor/components/links-section.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACT,MAAM,gEAAgE,CAAC;AAExE,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,CACT,EAAE,EAAE,MAAM,EACV,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,KACf,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC5D,CAAC;AA0BF,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,gBAAgB,GACjB,EAAE,iBAAiB,2CA8FnB"}
1
+ {"version":3,"file":"links-section.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-note-editor/components/links-section.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACT,MAAM,gEAAgE,CAAC;AAExE,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,CACT,EAAE,EAAE,MAAM,EACV,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,KACf,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC5D,CAAC;AA0BF,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,gBAAgB,GACjB,EAAE,iBAAiB,2CA8FnB"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useMemo, useRef, useEffect } from "react";
3
3
  import { generateId } from "document-model/core";
4
+ import { setSelectedNode } from "@powerhousedao/reactor-browser";
4
5
  import { useKnowledgeNoteDocumentsInSelectedDrive } from "@powerhousedao/knowledge-note/document-models/knowledge-note";
5
6
  const LINK_TYPES = [
6
7
  "RELATES_TO",
@@ -59,10 +60,25 @@ export function LinksSection({ links, currentDocId, onAddLink, onRemoveLink, onU
59
60
  } }, link.id))), isAdding ? (_jsx(AddLinkForm, { docOptions: docOptions, onAdd: handleAdd, onCancel: () => setIsAdding(false) })) : (_jsx("button", { type: "button", onClick: () => setIsAdding(true), className: "w-full rounded-lg border border-dashed border-white/10 py-1.5 text-xs text-gray-500 hover:border-[#cba6f7]/30 hover:text-[#cba6f7]", children: "+ Add link" }))] }));
60
61
  }
61
62
  function LinkCard({ link, isEditing, allDocOptions, onStartEdit, onCancelEdit, onUpdateLinkType, onRemoveLink, onChangeTarget, }) {
63
+ const editRef = useRef(null);
64
+ useEffect(() => {
65
+ if (!isEditing)
66
+ return;
67
+ function handleClickOutside(e) {
68
+ if (editRef.current && !editRef.current.contains(e.target)) {
69
+ onCancelEdit();
70
+ }
71
+ }
72
+ document.addEventListener("mousedown", handleClickOutside);
73
+ return () => document.removeEventListener("mousedown", handleClickOutside);
74
+ }, [isEditing, onCancelEdit]);
62
75
  if (isEditing) {
63
- return (_jsxs("div", { className: "rounded-lg border border-[#cba6f7]/20 bg-[#cba6f7]/5 p-2", children: [_jsx("p", { className: "mb-1.5 text-[10px] font-medium uppercase text-gray-500", children: "Change target document" }), _jsx(DocumentSearch, { options: allDocOptions, onSelect: (doc) => onChangeTarget(doc.id, doc.title), onCancel: onCancelEdit, autoFocus: true })] }));
76
+ return (_jsxs("div", { ref: editRef, className: "rounded-lg border border-[#cba6f7]/20 bg-[#cba6f7]/5 p-2", children: [_jsx("p", { className: "mb-1.5 text-[10px] font-medium uppercase text-gray-500", children: "Change target document" }), _jsx(DocumentSearch, { options: allDocOptions, onSelect: (doc) => onChangeTarget(doc.id, doc.title), onCancel: onCancelEdit, autoFocus: true })] }));
64
77
  }
65
- return (_jsxs("div", { className: "group flex items-center gap-2 rounded-lg border border-white/5 bg-[#1e1e2e] px-3 py-2", children: [_jsx("select", { value: link.linkType ?? "RELATES_TO", onChange: (e) => onUpdateLinkType(link.id, e.target.value), className: `rounded-md border-0 px-2 py-0.5 text-xs font-medium ${LINK_TYPE_COLORS[link.linkType ?? "RELATES_TO"]} bg-transparent`, children: LINK_TYPES.map((lt) => (_jsx("option", { value: lt, children: LINK_TYPE_LABELS[lt] }, lt))) }), _jsx("button", { type: "button", onClick: onStartEdit, className: "flex-1 truncate text-left text-sm text-gray-300 hover:text-[#cba6f7]", title: "Click to change target document", children: link.targetTitle || link.targetDocumentId || "Untitled" }), link.targetDocumentId && (_jsx("span", { className: "hidden text-[10px] font-mono text-gray-600 group-hover:inline", title: link.targetDocumentId, children: link.targetDocumentId.slice(0, 8) })), _jsx("button", { type: "button", onClick: () => onRemoveLink(link.id), className: "text-gray-600 opacity-0 transition-opacity hover:text-red-400 group-hover:opacity-100", "aria-label": "Remove link", children: "\u00D7" })] }));
78
+ return (_jsxs("div", { className: "group flex items-center gap-2 rounded-lg border border-white/5 bg-[#1e1e2e] px-3 py-2", children: [_jsx("select", { value: link.linkType ?? "RELATES_TO", onChange: (e) => onUpdateLinkType(link.id, e.target.value), className: `rounded-md border-0 px-2 py-0.5 text-xs font-medium ${LINK_TYPE_COLORS[link.linkType ?? "RELATES_TO"]} bg-transparent`, children: LINK_TYPES.map((lt) => (_jsx("option", { value: lt, children: LINK_TYPE_LABELS[lt] }, lt))) }), _jsxs("button", { type: "button", onClick: () => {
79
+ if (link.targetDocumentId)
80
+ setSelectedNode(link.targetDocumentId);
81
+ }, className: "flex-1 truncate text-left text-sm text-gray-300 hover:text-[#cba6f7] hover:underline", title: `Open: ${link.targetTitle || link.targetDocumentId || "Untitled"}`, children: [link.targetTitle || link.targetDocumentId || "Untitled", _jsxs("svg", { className: "ml-1 inline-block h-3 w-3 opacity-0 group-hover:opacity-50", 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("polyline", { points: "15 3 21 3 21 9" }), _jsx("line", { x1: "10", y1: "14", x2: "21", y2: "3" })] })] }), _jsx("button", { type: "button", onClick: onStartEdit, className: "text-gray-600 opacity-0 transition-opacity hover:text-[#cba6f7] group-hover:opacity-100", "aria-label": "Change target", title: "Change target document", children: _jsxs("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" }), _jsx("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" })] }) }), _jsx("button", { type: "button", onClick: () => onRemoveLink(link.id), className: "text-gray-600 opacity-0 transition-opacity hover:text-red-400 group-hover:opacity-100", "aria-label": "Remove link", children: "\u00D7" })] }));
66
82
  }
67
83
  function AddLinkForm({ docOptions, onAdd, onCancel, }) {
68
84
  const [selectedDoc, setSelectedDoc] = useState(null);
@@ -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;AAmClD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,2CAmXtD"}
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;AAmClD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,2CAoXtD"}
@@ -37,6 +37,7 @@ export function DriveExplorer({ children }) {
37
37
  noteRef: ci.noteRef,
38
38
  contextPhrase: ci.contextPhrase,
39
39
  })),
40
+ childRefs: state.childRefs ?? [],
40
41
  };
41
42
  });
42
43
  }, [allDocuments]);
@@ -23,6 +23,7 @@ type MocInfo = {
23
23
  noteRef: string;
24
24
  contextPhrase: string;
25
25
  }[];
26
+ childRefs: string[];
26
27
  };
27
28
  type TensionInfo = {
28
29
  id: string;
@@ -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,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AA6fF,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,GACT,EAAE,cAAc,2CAmtBhB"}
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;IACxD,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,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,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAghBF,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,GACT,EAAE,cAAc,2CAytBhB"}
@@ -184,8 +184,12 @@ function buildElements(notes, graphState, mocs, tensions) {
184
184
  }
185
185
  // Track existing node IDs for MOC + tension edge targets
186
186
  const existingNodeIds = new Set(elements.filter((e) => !e.data.source).map((e) => e.data.id));
187
- // Add MOC nodes as compound parents + edges for non-parented refs
187
+ // Add MOC nodes + edges (coreIdeas notes, childRefs child MOCs)
188
188
  if (mocs?.length) {
189
+ // Pre-register MOC IDs so childRef edges between MOCs can resolve
190
+ for (const moc of mocs) {
191
+ existingNodeIds.add(moc.id);
192
+ }
189
193
  for (const moc of mocs) {
190
194
  elements.push({
191
195
  data: {
@@ -195,7 +199,7 @@ function buildElements(notes, graphState, mocs, tensions) {
195
199
  noteType: `MOC (${moc.tier ?? "TOPIC"})`,
196
200
  description: null,
197
201
  topics: [],
198
- linkCount: moc.coreIdeas.length,
202
+ linkCount: moc.coreIdeas.length + moc.childRefs.length,
199
203
  color: MOC_NODE_COLOR,
200
204
  isMoc: true,
201
205
  },
@@ -213,6 +217,19 @@ function buildElements(notes, graphState, mocs, tensions) {
213
217
  });
214
218
  }
215
219
  }
220
+ for (const childRef of moc.childRefs) {
221
+ if (existingNodeIds.has(childRef)) {
222
+ elements.push({
223
+ data: {
224
+ id: `moc-child-${moc.id}-${childRef}`,
225
+ source: moc.id,
226
+ target: childRef,
227
+ linkType: "CORE_IDEA",
228
+ color: MOC_EDGE_COLOR,
229
+ },
230
+ });
231
+ }
232
+ }
216
233
  }
217
234
  }
218
235
  // Add tension nodes and edges to involved notes
@@ -544,10 +561,17 @@ export function GraphView({ notes, graphState, mocs, tensions, }) {
544
561
  cyRef.current = cy;
545
562
  // After layout settles, save positions and center view.
546
563
  const centerGraph = () => {
547
- cy.fit(cy.elements(), 60);
548
- if (cy.zoom() > 0.8)
549
- cy.zoom(0.8);
550
- cy.center();
564
+ try {
565
+ if (!cyRef.current || cy.destroyed())
566
+ return;
567
+ cy.fit(cy.elements(), 60);
568
+ if (cy.zoom() > 0.8)
569
+ cy.zoom(0.8);
570
+ cy.center();
571
+ }
572
+ catch {
573
+ // renderer not ready — ignore
574
+ }
551
575
  };
552
576
  cy.one("layoutstop", () => {
553
577
  savePositions(cy);
@@ -572,16 +596,17 @@ export function GraphView({ notes, graphState, mocs, tensions, }) {
572
596
  const dx = curr.x - prev.x;
573
597
  const dy = curr.y - prev.y;
574
598
  mocDragState.set(moc.id(), { x: curr.x, y: curr.y });
575
- // Move all CORE_IDEA-connected notes along with the MOC
599
+ // Move CORE_IDEA-connected notes along with the MOC,
600
+ // but skip MOC-to-MOC connections (parent ↔ child MOCs move independently)
576
601
  moc.connectedEdges().forEach((edge) => {
577
602
  if (edge.data("linkType") !== "CORE_IDEA")
578
603
  return;
579
- const child = edge.source().id() === moc.id()
580
- ? edge.target()
581
- : edge.source();
582
- if (child.grabbed())
583
- return; // don't fight if user is dragging it
584
- child.shift({ x: dx, y: dy });
604
+ const other = edge.source().id() === moc.id() ? edge.target() : edge.source();
605
+ if (other.grabbed())
606
+ return;
607
+ if (other.data("isMoc"))
608
+ return; // don't drag other MOCs
609
+ other.shift({ x: dx, y: dy });
585
610
  });
586
611
  });
587
612
  // Persist position after manual drag
@@ -1 +1 @@
1
- {"version":3,"file":"use-graph-search.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/hooks/use-graph-search.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAkJ3D,wBAAgB,cAAc;;kBAgBtB,MAAM;;;;;;uBAQN,UAAU;EA4HjB"}
1
+ {"version":3,"file":"use-graph-search.d.ts","sourceRoot":"","sources":["../../../../editors/knowledge-vault/hooks/use-graph-search.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AA4I3D,wBAAgB,cAAc;;kBAgBtB,MAAM;;;;;;uBAQN,UAAU;EA4HjB"}
@@ -102,14 +102,9 @@ function loadSearchState() {
102
102
  const raw = sessionStorage.getItem(STORAGE_KEY);
103
103
  if (raw) {
104
104
  const parsed = JSON.parse(raw);
105
- const mode = parsed.mode;
106
105
  return {
107
106
  query: parsed.query ?? "",
108
- mode: mode === "keyword"
109
- ? "keyword"
110
- : mode === "semantic"
111
- ? "semantic"
112
- : "hybrid",
107
+ mode: "hybrid",
113
108
  };
114
109
  }
115
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/moc-editor/editor.tsx"],"names":[],"mappings":"AAuBA,MAAM,CAAC,OAAO,UAAU,MAAM,4CA6X7B"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/moc-editor/editor.tsx"],"names":[],"mappings":"AAuBA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAgY7B"}
@@ -58,7 +58,7 @@ export default function Editor() {
58
58
  backgroundColor: "var(--bai-bg)",
59
59
  boxShadow: "0 0 0 1px var(--bai-ring)",
60
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));
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" })] })] })) : (_jsxs("button", { type: "button", onClick: () => setSelectedNode(idea.noteRef), className: "mt-0.5 text-[10px] font-mono text-left truncate max-w-full transition-colors hover:underline", style: { color: "var(--bai-text-faint)" }, title: `Open document: ${idea.noteRef}`, 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
62
  }), _jsxs("form", { className: "flex gap-2", onSubmit: (e) => {
63
63
  e.preventDefault();
64
64
  if (!newIdeaRef.trim() || !newIdeaPhrase.trim())
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/knowledge-note",
3
3
  "description": "Knowledge Note document model package for Powerhouse",
4
- "version": "1.0.6",
4
+ "version": "1.0.8",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [
@@ -7,7 +7,7 @@ export const graphIndexerProcessorFactory = (module) => async (driveHeader) => {
7
7
  const filter = {
8
8
  branch: ["main"],
9
9
  documentId: ["*"],
10
- documentType: ["bai/knowledge-note", "powerhouse/document-drive"],
10
+ documentType: ["bai/knowledge-note", "bai/moc", "powerhouse/document-drive"],
11
11
  scope: ["global"],
12
12
  };
13
13
  const processor = new GraphIndexerProcessor(namespace, filter, store);
@@ -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;AA+DtC,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;IAgMV,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;YAQrB,UAAU;CA8BzB"}
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;AA+DtC,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;IAsPV,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;YAQrB,UAAU;CA8BzB"}
@@ -81,8 +81,9 @@ export class GraphIndexerProcessor extends RelationalDbProcessor {
81
81
  lastByDocument.delete(deleteInput.id);
82
82
  continue;
83
83
  }
84
- // Only process knowledge-note documents
85
- if (context.documentType !== "bai/knowledge-note")
84
+ // Only process knowledge-note and moc documents
85
+ if (context.documentType !== "bai/knowledge-note" &&
86
+ context.documentType !== "bai/moc")
86
87
  continue;
87
88
  // Index operation for history tracking
88
89
  try {
@@ -120,11 +121,19 @@ export class GraphIndexerProcessor extends RelationalDbProcessor {
120
121
  if (!stateJson)
121
122
  continue;
122
123
  const parsed = JSON.parse(stateJson);
123
- // resultingState may be wrapped in { global: ... } or be the global state directly
124
124
  const global = (parsed.global ?? parsed);
125
125
  const now = new Date().toISOString();
126
- // Extract provenance
126
+ const isMoc = entry.context.documentType === "bai/moc";
127
+ // Extract provenance (knowledge notes only)
127
128
  const provenance = global.provenance;
129
+ // Map fields based on document type
130
+ const noteType = isMoc
131
+ ? `MOC (${s(global.tier, "TOPIC")})`
132
+ : (global.noteType ?? null);
133
+ const content = isMoc
134
+ ? (global.orientation ?? null)
135
+ : (global.content ?? null);
136
+ const status = isMoc ? "MOC" : (global.status ?? "DRAFT");
128
137
  // Upsert node
129
138
  await this.relationalDb
130
139
  .insertInto("graph_nodes")
@@ -133,23 +142,23 @@ export class GraphIndexerProcessor extends RelationalDbProcessor {
133
142
  document_id: documentId,
134
143
  title: global.title ?? null,
135
144
  description: global.description ?? null,
136
- note_type: global.noteType ?? null,
137
- status: global.status ?? "DRAFT",
138
- content: global.content ?? null,
145
+ note_type: noteType,
146
+ status,
147
+ content,
139
148
  author: provenance?.author ?? null,
140
149
  source_origin: provenance?.sourceOrigin ?? null,
141
- created_at: provenance?.createdAt ?? null,
150
+ created_at: global.createdAt ?? provenance?.createdAt ?? null,
142
151
  updated_at: now,
143
152
  })
144
153
  .onConflict((oc) => oc.column("document_id").doUpdateSet({
145
154
  title: global.title ?? null,
146
155
  description: global.description ?? null,
147
- note_type: global.noteType ?? null,
148
- status: global.status ?? "DRAFT",
149
- content: global.content ?? null,
156
+ note_type: noteType,
157
+ status,
158
+ content,
150
159
  author: provenance?.author ?? null,
151
160
  source_origin: provenance?.sourceOrigin ?? null,
152
- created_at: provenance?.createdAt ?? null,
161
+ created_at: global.createdAt ?? provenance?.createdAt ?? null,
153
162
  updated_at: now,
154
163
  }))
155
164
  .execute();
@@ -180,22 +189,55 @@ export class GraphIndexerProcessor extends RelationalDbProcessor {
180
189
  .deleteFrom("graph_edges")
181
190
  .where("source_document_id", "=", documentId)
182
191
  .execute();
183
- const links = global.links ?? [];
184
- if (links.length > 0) {
192
+ // Build edge list from links (notes) or coreIdeas + childRefs (MOCs)
193
+ const edgeValues = [];
194
+ if (isMoc) {
195
+ const coreIdeas = global.coreIdeas ?? [];
196
+ for (const idea of coreIdeas) {
197
+ if (idea.noteRef) {
198
+ edgeValues.push({
199
+ id: `${documentId}-ci-${idea.id ?? idea.noteRef}`,
200
+ source_document_id: documentId,
201
+ target_document_id: idea.noteRef,
202
+ link_type: "CORE_IDEA",
203
+ target_title: null,
204
+ updated_at: now,
205
+ });
206
+ }
207
+ }
208
+ const childRefs = global.childRefs ?? [];
209
+ for (const ref of childRefs) {
210
+ edgeValues.push({
211
+ id: `${documentId}-child-${ref}`,
212
+ source_document_id: documentId,
213
+ target_document_id: ref,
214
+ link_type: "CORE_IDEA",
215
+ target_title: null,
216
+ updated_at: now,
217
+ });
218
+ }
219
+ }
220
+ else {
221
+ const links = global.links ?? [];
222
+ for (const link of links) {
223
+ edgeValues.push({
224
+ id: link.id ??
225
+ `${documentId}-${link.targetDocumentId}`,
226
+ source_document_id: documentId,
227
+ target_document_id: link.targetDocumentId ?? "",
228
+ link_type: link.linkType ?? null,
229
+ target_title: link.targetTitle ?? null,
230
+ updated_at: now,
231
+ });
232
+ }
233
+ }
234
+ if (edgeValues.length > 0) {
185
235
  await this.relationalDb
186
236
  .insertInto("graph_edges")
187
- .values(links.map((link) => ({
188
- id: link.id ??
189
- `${documentId}-${link.targetDocumentId}`,
190
- source_document_id: documentId,
191
- target_document_id: link.targetDocumentId ?? "",
192
- link_type: link.linkType ?? null,
193
- target_title: link.targetTitle ?? null,
194
- updated_at: now,
195
- })))
237
+ .values(edgeValues)
196
238
  .execute();
197
239
  }
198
- console.log(`[GraphIndexer] Reconciled ${documentId}: ${links.length} edges`);
240
+ console.log(`[GraphIndexer] Reconciled ${documentId}: ${edgeValues.length} edges`);
199
241
  // Fire-and-forget embedding generation (don't block operation processing)
200
242
  const text = [global.title, global.description, global.content]
201
243
  .filter(Boolean)
package/dist/style.css CHANGED
@@ -1495,13 +1495,6 @@
1495
1495
  --tw-outline-style: none;
1496
1496
  outline-style: none;
1497
1497
  }
1498
- .group-hover\:inline {
1499
- &:is(:where(.group):hover *) {
1500
- @media (hover: hover) {
1501
- display: inline;
1502
- }
1503
- }
1504
- }
1505
1498
  .group-hover\:text-\[var\(--bai-accent\)\] {
1506
1499
  &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;aAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuDnE;gBAEU,IAAI,EAAE,YAAY;IAI9B;;;OAGG;IACH;;OAEG;IACH,OAAO,CAAC,KAAK;IAOb;;;OAGG;YACW,aAAa;IAO3B,OAAO,CAAC,QAAQ;IAIhB;;;;OAIG;IACH,OAAO,CAAC,aAAa,CAAqB;YAE5B,YAAY;YAqKZ,cAAc;CAmD7B"}
@@ -207,7 +207,7 @@ export class KnowledgeGraphSubgraph extends BaseSubgraph {
207
207
 
208
208
  extend type Mutation {
209
209
  """
210
- Backfill the graph index by reading all bai/knowledge-note documents
210
+ Backfill the graph index by reading all bai/knowledge-note and bai/moc documents
211
211
  in the drive. Use when the processor missed historical operations.
212
212
  """
213
213
  knowledgeGraphReindex(driveId: ID!): ReindexResult!
@@ -494,7 +494,9 @@ export class KnowledgeGraphSubgraph extends BaseSubgraph {
494
494
  try {
495
495
  const drive = await this.reactorClient.get(driveId);
496
496
  const nodes = drive.state.global.nodes;
497
- const noteNodes = nodes.filter((n) => n.kind === "file" && n.documentType === "bai/knowledge-note");
497
+ const noteNodes = nodes.filter((n) => n.kind === "file" &&
498
+ (n.documentType === "bai/knowledge-note" ||
499
+ n.documentType === "bai/moc"));
498
500
  const db = await this.getWritableDb(driveId);
499
501
  const now = new Date().toISOString();
500
502
  for (const node of noteNodes) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/knowledge-note",
3
3
  "description": "Knowledge Note document model package for Powerhouse",
4
- "version": "1.0.6",
4
+ "version": "1.0.8",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [