agent-knowledge 1.3.13 → 1.3.15
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/agent-desk-plugin.json +1 -1
- package/dist/ui/app.js +66 -1
- package/dist/ui/index.html +1 -0
- package/dist/ui/morphdom.min.js +1 -0
- package/dist/ui/render-knowledge.js +55 -63
- package/dist/ui/render-panel.js +22 -27
- package/dist/ui/render-search.js +22 -26
- package/dist/ui/render-sessions.js +43 -42
- package/dist/ui/ui-utils.js +16 -1
- package/package.json +2 -1
- package/scripts/copy-ui.js +5 -1
package/agent-desk-plugin.json
CHANGED
package/dist/ui/app.js
CHANGED
|
@@ -320,6 +320,63 @@
|
|
|
320
320
|
if (state.search.query.trim()) doSearch();
|
|
321
321
|
});
|
|
322
322
|
|
|
323
|
+
// ── Delegated click/keydown handlers for morphed containers ──────────
|
|
324
|
+
|
|
325
|
+
// Knowledge grid cards
|
|
326
|
+
el.knowledgeGrid.addEventListener('click', (e) => {
|
|
327
|
+
const card = e.target.closest('.knowledge-card[data-path]');
|
|
328
|
+
if (card) K.openKnowledgePanel(card.dataset.path);
|
|
329
|
+
});
|
|
330
|
+
el.knowledgeGrid.addEventListener('keydown', (e) => {
|
|
331
|
+
if (e.key !== 'Enter') return;
|
|
332
|
+
const card = e.target.closest('.knowledge-card[data-path]');
|
|
333
|
+
if (card) K.openKnowledgePanel(card.dataset.path);
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// Knowledge search results
|
|
337
|
+
el.knowledgeSearchResults.addEventListener('click', (e) => {
|
|
338
|
+
const card = e.target.closest('.knowledge-result-item[data-path]');
|
|
339
|
+
if (card) K.openKnowledgePanel(card.dataset.path);
|
|
340
|
+
});
|
|
341
|
+
el.knowledgeSearchResults.addEventListener('keydown', (e) => {
|
|
342
|
+
if (e.key !== 'Enter') return;
|
|
343
|
+
const card = e.target.closest('.knowledge-result-item[data-path]');
|
|
344
|
+
if (card) K.openKnowledgePanel(card.dataset.path);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// Session cards
|
|
348
|
+
el.sessionsList.addEventListener('click', (e) => {
|
|
349
|
+
const card = e.target.closest('.session-card[data-session-id]');
|
|
350
|
+
if (card) K.openSessionPanel(card.dataset.sessionId);
|
|
351
|
+
});
|
|
352
|
+
el.sessionsList.addEventListener('keydown', (e) => {
|
|
353
|
+
if (e.key !== 'Enter') return;
|
|
354
|
+
const card = e.target.closest('.session-card[data-session-id]');
|
|
355
|
+
if (card) K.openSessionPanel(card.dataset.sessionId);
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// Search results
|
|
359
|
+
el.searchResults.addEventListener('click', (e) => {
|
|
360
|
+
const card = e.target.closest('.result-item[data-session-id]');
|
|
361
|
+
if (card) K.openSessionPanel(card.dataset.sessionId, card.dataset.excerpt);
|
|
362
|
+
});
|
|
363
|
+
el.searchResults.addEventListener('keydown', (e) => {
|
|
364
|
+
if (e.key !== 'Enter') return;
|
|
365
|
+
const card = e.target.closest('.result-item[data-session-id]');
|
|
366
|
+
if (card) K.openSessionPanel(card.dataset.sessionId, card.dataset.excerpt);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// Panel body — related entries & knowledge links
|
|
370
|
+
el.panelBody.addEventListener('click', (e) => {
|
|
371
|
+
const entry = e.target.closest('.related-entry[data-path]');
|
|
372
|
+
if (entry) K.openKnowledgePanel(entry.dataset.path);
|
|
373
|
+
});
|
|
374
|
+
el.panelBody.addEventListener('keydown', (e) => {
|
|
375
|
+
if (e.key !== 'Enter') return;
|
|
376
|
+
const entry = e.target.closest('.related-entry[data-path]');
|
|
377
|
+
if (entry) K.openKnowledgePanel(entry.dataset.path);
|
|
378
|
+
});
|
|
379
|
+
|
|
323
380
|
// Keyboard shortcuts
|
|
324
381
|
document.addEventListener('keydown', (e) => {
|
|
325
382
|
// Escape closes panel
|
|
@@ -488,7 +545,13 @@
|
|
|
488
545
|
// ── Init ───────────────────────────────────────────────────────────────────
|
|
489
546
|
|
|
490
547
|
async function init() {
|
|
491
|
-
|
|
548
|
+
try {
|
|
549
|
+
el = _buildEl();
|
|
550
|
+
K._el = el;
|
|
551
|
+
K._state = state;
|
|
552
|
+
} catch (err) {
|
|
553
|
+
console.error('[agent-knowledge] init _buildEl failed:', err);
|
|
554
|
+
}
|
|
492
555
|
K.initTheme();
|
|
493
556
|
bindEvents();
|
|
494
557
|
K.initSessionScroll(state, el);
|
|
@@ -566,6 +629,8 @@
|
|
|
566
629
|
K._root = shadow;
|
|
567
630
|
init();
|
|
568
631
|
K.initPanelResize();
|
|
632
|
+
var themeBtn = shadow.getElementById('theme-toggle');
|
|
633
|
+
if (themeBtn) themeBtn.style.display = 'none';
|
|
569
634
|
};
|
|
570
635
|
|
|
571
636
|
K.unmount = function () {
|
package/dist/ui/index.html
CHANGED
|
@@ -348,6 +348,7 @@
|
|
|
348
348
|
media="(prefers-color-scheme: dark)"
|
|
349
349
|
/>
|
|
350
350
|
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/highlight.min.js"></script>
|
|
351
|
+
<script src="morphdom.min.js"></script>
|
|
351
352
|
<script src="ui-utils.js"></script>
|
|
352
353
|
<script src="render-knowledge.js"></script>
|
|
353
354
|
<script src="render-search.js"></script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=global||self,global.morphdom=factory())})(this,function(){"use strict";var DOCUMENT_FRAGMENT_NODE=11;function morphAttrs(fromNode,toNode){var toNodeAttrs=toNode.attributes;var attr;var attrName;var attrNamespaceURI;var attrValue;var fromValue;if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE||fromNode.nodeType===DOCUMENT_FRAGMENT_NODE){return}for(var i=toNodeAttrs.length-1;i>=0;i--){attr=toNodeAttrs[i];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;attrValue=attr.value;if(attrNamespaceURI){attrName=attr.localName||attrName;fromValue=fromNode.getAttributeNS(attrNamespaceURI,attrName);if(fromValue!==attrValue){if(attr.prefix==="xmlns"){attrName=attr.name}fromNode.setAttributeNS(attrNamespaceURI,attrName,attrValue)}}else{fromValue=fromNode.getAttribute(attrName);if(fromValue!==attrValue){fromNode.setAttribute(attrName,attrValue)}}}var fromNodeAttrs=fromNode.attributes;for(var d=fromNodeAttrs.length-1;d>=0;d--){attr=fromNodeAttrs[d];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;if(attrNamespaceURI){attrName=attr.localName||attrName;if(!toNode.hasAttributeNS(attrNamespaceURI,attrName)){fromNode.removeAttributeNS(attrNamespaceURI,attrName)}}else{if(!toNode.hasAttribute(attrName)){fromNode.removeAttribute(attrName)}}}}var range;var NS_XHTML="http://www.w3.org/1999/xhtml";var doc=typeof document==="undefined"?undefined:document;var HAS_TEMPLATE_SUPPORT=!!doc&&"content"in doc.createElement("template");var HAS_RANGE_SUPPORT=!!doc&&doc.createRange&&"createContextualFragment"in doc.createRange();function createFragmentFromTemplate(str){var template=doc.createElement("template");template.innerHTML=str;return template.content.childNodes[0]}function createFragmentFromRange(str){if(!range){range=doc.createRange();range.selectNode(doc.body)}var fragment=range.createContextualFragment(str);return fragment.childNodes[0]}function createFragmentFromWrap(str){var fragment=doc.createElement("body");fragment.innerHTML=str;return fragment.childNodes[0]}function toElement(str){str=str.trim();if(HAS_TEMPLATE_SUPPORT){return createFragmentFromTemplate(str)}else if(HAS_RANGE_SUPPORT){return createFragmentFromRange(str)}return createFragmentFromWrap(str)}function compareNodeNames(fromEl,toEl){var fromNodeName=fromEl.nodeName;var toNodeName=toEl.nodeName;var fromCodeStart,toCodeStart;if(fromNodeName===toNodeName){return true}fromCodeStart=fromNodeName.charCodeAt(0);toCodeStart=toNodeName.charCodeAt(0);if(fromCodeStart<=90&&toCodeStart>=97){return fromNodeName===toNodeName.toUpperCase()}else if(toCodeStart<=90&&fromCodeStart>=97){return toNodeName===fromNodeName.toUpperCase()}else{return false}}function createElementNS(name,namespaceURI){return!namespaceURI||namespaceURI===NS_XHTML?doc.createElement(name):doc.createElementNS(namespaceURI,name)}function moveChildren(fromEl,toEl){var curChild=fromEl.firstChild;while(curChild){var nextChild=curChild.nextSibling;toEl.appendChild(curChild);curChild=nextChild}return toEl}function syncBooleanAttrProp(fromEl,toEl,name){if(fromEl[name]!==toEl[name]){fromEl[name]=toEl[name];if(fromEl[name]){fromEl.setAttribute(name,"")}else{fromEl.removeAttribute(name)}}}var specialElHandlers={OPTION:function(fromEl,toEl){var parentNode=fromEl.parentNode;if(parentNode){var parentName=parentNode.nodeName.toUpperCase();if(parentName==="OPTGROUP"){parentNode=parentNode.parentNode;parentName=parentNode&&parentNode.nodeName.toUpperCase()}if(parentName==="SELECT"&&!parentNode.hasAttribute("multiple")){if(fromEl.hasAttribute("selected")&&!toEl.selected){fromEl.setAttribute("selected","selected");fromEl.removeAttribute("selected")}parentNode.selectedIndex=-1}}syncBooleanAttrProp(fromEl,toEl,"selected")},INPUT:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"checked");syncBooleanAttrProp(fromEl,toEl,"disabled");if(fromEl.value!==toEl.value){fromEl.value=toEl.value}if(!toEl.hasAttribute("value")){fromEl.removeAttribute("value")}},TEXTAREA:function(fromEl,toEl){var newValue=toEl.value;if(fromEl.value!==newValue){fromEl.value=newValue}var firstChild=fromEl.firstChild;if(firstChild){var oldValue=firstChild.nodeValue;if(oldValue==newValue||!newValue&&oldValue==fromEl.placeholder){return}firstChild.nodeValue=newValue}},SELECT:function(fromEl,toEl){if(!toEl.hasAttribute("multiple")){var selectedIndex=-1;var i=0;var curChild=fromEl.firstChild;var optgroup;var nodeName;while(curChild){nodeName=curChild.nodeName&&curChild.nodeName.toUpperCase();if(nodeName==="OPTGROUP"){optgroup=curChild;curChild=optgroup.firstChild;if(!curChild){curChild=optgroup.nextSibling;optgroup=null}}else{if(nodeName==="OPTION"){if(curChild.hasAttribute("selected")){selectedIndex=i;break}i++}curChild=curChild.nextSibling;if(!curChild&&optgroup){curChild=optgroup.nextSibling;optgroup=null}}}fromEl.selectedIndex=selectedIndex}}};var ELEMENT_NODE=1;var DOCUMENT_FRAGMENT_NODE$1=11;var TEXT_NODE=3;var COMMENT_NODE=8;function noop(){}function defaultGetNodeKey(node){if(node){return node.getAttribute&&node.getAttribute("id")||node.id}}function morphdomFactory(morphAttrs){return function morphdom(fromNode,toNode,options){if(!options){options={}}if(typeof toNode==="string"){if(fromNode.nodeName==="#document"||fromNode.nodeName==="HTML"){var toNodeHtml=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeHtml}else if(fromNode.nodeName==="BODY"){var toNodeBody=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeBody;var bodyElement=toNode.querySelector("body");if(bodyElement){toNode=bodyElement}}else{toNode=toElement(toNode)}}else if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE$1){toNode=toNode.firstElementChild}var getNodeKey=options.getNodeKey||defaultGetNodeKey;var onBeforeNodeAdded=options.onBeforeNodeAdded||noop;var onNodeAdded=options.onNodeAdded||noop;var onBeforeElUpdated=options.onBeforeElUpdated||noop;var onElUpdated=options.onElUpdated||noop;var onBeforeNodeDiscarded=options.onBeforeNodeDiscarded||noop;var onNodeDiscarded=options.onNodeDiscarded||noop;var onBeforeElChildrenUpdated=options.onBeforeElChildrenUpdated||noop;var skipFromChildren=options.skipFromChildren||noop;var addChild=options.addChild||function(parent,child){return parent.appendChild(child)};var childrenOnly=options.childrenOnly===true;var fromNodesLookup=Object.create(null);var keyedRemovalList=[];function addKeyedRemoval(key){keyedRemovalList.push(key)}function walkDiscardedChildNodes(node,skipKeyedNodes){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=undefined;if(skipKeyedNodes&&(key=getNodeKey(curChild))){addKeyedRemoval(key)}else{onNodeDiscarded(curChild);if(curChild.firstChild){walkDiscardedChildNodes(curChild,skipKeyedNodes)}}curChild=curChild.nextSibling}}}function removeNode(node,parentNode,skipKeyedNodes){if(onBeforeNodeDiscarded(node)===false){return}if(parentNode){parentNode.removeChild(node)}onNodeDiscarded(node);walkDiscardedChildNodes(node,skipKeyedNodes)}function indexTree(node){if(node.nodeType===ELEMENT_NODE||node.nodeType===DOCUMENT_FRAGMENT_NODE$1){var curChild=node.firstChild;while(curChild){var key=getNodeKey(curChild);if(key){fromNodesLookup[key]=curChild}indexTree(curChild);curChild=curChild.nextSibling}}}indexTree(fromNode);function handleNodeAdded(el){onNodeAdded(el);var curChild=el.firstChild;while(curChild){var nextSibling=curChild.nextSibling;var key=getNodeKey(curChild);if(key){var unmatchedFromEl=fromNodesLookup[key];if(unmatchedFromEl&&compareNodeNames(curChild,unmatchedFromEl)){curChild.parentNode.replaceChild(unmatchedFromEl,curChild);morphEl(unmatchedFromEl,curChild)}else{handleNodeAdded(curChild)}}else{handleNodeAdded(curChild)}curChild=nextSibling}}function cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey){while(curFromNodeChild){var fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey=getNodeKey(curFromNodeChild)){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}}function morphEl(fromEl,toEl,childrenOnly){var toElKey=getNodeKey(toEl);if(toElKey){delete fromNodesLookup[toElKey]}if(!childrenOnly){var beforeUpdateResult=onBeforeElUpdated(fromEl,toEl);if(beforeUpdateResult===false){return}else if(beforeUpdateResult instanceof HTMLElement){fromEl=beforeUpdateResult;indexTree(fromEl)}morphAttrs(fromEl,toEl);onElUpdated(fromEl);if(onBeforeElChildrenUpdated(fromEl,toEl)===false){return}}if(fromEl.nodeName!=="TEXTAREA"){morphChildren(fromEl,toEl)}else{specialElHandlers.TEXTAREA(fromEl,toEl)}}function morphChildren(fromEl,toEl){var skipFrom=skipFromChildren(fromEl,toEl);var curToNodeChild=toEl.firstChild;var curFromNodeChild=fromEl.firstChild;var curToNodeKey;var curFromNodeKey;var fromNextSibling;var toNextSibling;var matchingFromEl;outer:while(curToNodeChild){toNextSibling=curToNodeChild.nextSibling;curToNodeKey=getNodeKey(curToNodeChild);while(!skipFrom&&curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curToNodeChild.isSameNode&&curToNodeChild.isSameNode(curFromNodeChild)){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey=getNodeKey(curFromNodeChild);var curFromNodeType=curFromNodeChild.nodeType;var isCompatible=undefined;if(curFromNodeType===curToNodeChild.nodeType){if(curFromNodeType===ELEMENT_NODE){if(curToNodeKey){if(curToNodeKey!==curFromNodeKey){if(matchingFromEl=fromNodesLookup[curToNodeKey]){if(fromNextSibling===matchingFromEl){isCompatible=false}else{fromEl.insertBefore(matchingFromEl,curFromNodeChild);if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=matchingFromEl;curFromNodeKey=getNodeKey(curFromNodeChild)}}else{isCompatible=false}}}else if(curFromNodeKey){isCompatible=false}isCompatible=isCompatible!==false&&compareNodeNames(curFromNodeChild,curToNodeChild);if(isCompatible){morphEl(curFromNodeChild,curToNodeChild)}}else if(curFromNodeType===TEXT_NODE||curFromNodeType==COMMENT_NODE){isCompatible=true;if(curFromNodeChild.nodeValue!==curToNodeChild.nodeValue){curFromNodeChild.nodeValue=curToNodeChild.nodeValue}}}if(isCompatible){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}if(curToNodeKey&&(matchingFromEl=fromNodesLookup[curToNodeKey])&&compareNodeNames(matchingFromEl,curToNodeChild)){if(!skipFrom){addChild(fromEl,matchingFromEl)}morphEl(matchingFromEl,curToNodeChild)}else{var onBeforeNodeAddedResult=onBeforeNodeAdded(curToNodeChild);if(onBeforeNodeAddedResult!==false){if(onBeforeNodeAddedResult){curToNodeChild=onBeforeNodeAddedResult}if(curToNodeChild.actualize){curToNodeChild=curToNodeChild.actualize(fromEl.ownerDocument||doc)}addChild(fromEl,curToNodeChild);handleNodeAdded(curToNodeChild)}}curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling}cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey);var specialElHandler=specialElHandlers[fromEl.nodeName];if(specialElHandler){specialElHandler(fromEl,toEl)}}var morphedNode=fromNode;var morphedNodeType=morphedNode.nodeType;var toNodeType=toNode.nodeType;if(!childrenOnly){if(morphedNodeType===ELEMENT_NODE){if(toNodeType===ELEMENT_NODE){if(!compareNodeNames(fromNode,toNode)){onNodeDiscarded(fromNode);morphedNode=moveChildren(fromNode,createElementNS(toNode.nodeName,toNode.namespaceURI))}}else{morphedNode=toNode}}else if(morphedNodeType===TEXT_NODE||morphedNodeType===COMMENT_NODE){if(toNodeType===morphedNodeType){if(morphedNode.nodeValue!==toNode.nodeValue){morphedNode.nodeValue=toNode.nodeValue}return morphedNode}else{morphedNode=toNode}}}if(morphedNode===toNode){onNodeDiscarded(fromNode)}else{if(toNode.isSameNode&&toNode.isSameNode(morphedNode)){return}morphEl(morphedNode,toNode,childrenOnly);if(keyedRemovalList){for(var i=0,len=keyedRemovalList.length;i<len;i++){var elToRemove=fromNodesLookup[keyedRemovalList[i]];if(elToRemove){removeNode(elToRemove,elToRemove.parentNode,false)}}}}if(!childrenOnly&&morphedNode!==fromNode&&fromNode.parentNode){if(morphedNode.actualize){morphedNode=morphedNode.actualize(fromNode.ownerDocument||doc)}fromNode.parentNode.replaceChild(morphedNode,fromNode)}return morphedNode}}var morphdom=morphdomFactory(morphAttrs);return morphdom});
|
|
@@ -14,35 +14,37 @@
|
|
|
14
14
|
: state.knowledge.entries.filter((e) => e.category === cat);
|
|
15
15
|
|
|
16
16
|
if (filtered.length === 0) {
|
|
17
|
-
el.knowledgeGrid
|
|
17
|
+
K.morph(el.knowledgeGrid, '');
|
|
18
18
|
el.knowledgeEmpty.classList.remove('hidden');
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
el.knowledgeEmpty.classList.add('hidden');
|
|
23
|
-
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
K.morph(
|
|
24
|
+
el.knowledgeGrid,
|
|
25
|
+
filtered
|
|
26
|
+
.map((entry) => {
|
|
27
|
+
const cat = entry.category || 'notes';
|
|
28
|
+
const catIcons = {
|
|
29
|
+
projects: 'code',
|
|
30
|
+
people: 'group',
|
|
31
|
+
decisions: 'gavel',
|
|
32
|
+
workflows: 'account_tree',
|
|
33
|
+
notes: 'sticky_note_2',
|
|
34
|
+
};
|
|
35
|
+
const icon = catIcons[cat] || 'article';
|
|
36
|
+
const title = entry.title || entry.path || entry.id || 'Untitled';
|
|
37
|
+
const tags = (entry.tags || [])
|
|
38
|
+
.slice(0, 3)
|
|
39
|
+
.map((t) => `<span class="card-tag">${K.esc(t)}</span>`)
|
|
40
|
+
.join('');
|
|
41
|
+
const time = K.relativeTime(entry.updated || entry.created);
|
|
42
|
+
|
|
43
|
+
const maturity = entry.maturity || 'candidate';
|
|
44
|
+
const accessCount = entry.access_count || 0;
|
|
45
|
+
const hasDuplicates = !!state.knowledge.duplicateClusters[entry.path || ''];
|
|
46
|
+
|
|
47
|
+
return `<div class="knowledge-card${hasDuplicates ? ' has-duplicates' : ''}" data-path="${K.esc(entry.path || entry.id || '')}" tabindex="0" role="button">
|
|
46
48
|
<div class="card-header-row">
|
|
47
49
|
<span class="card-category" data-cat="${K.esc(cat)}">
|
|
48
50
|
<span class="material-symbols-outlined" style="font-size:14px">${icon}</span>
|
|
@@ -57,15 +59,9 @@
|
|
|
57
59
|
<div class="card-title">${K.esc(title)}</div>
|
|
58
60
|
${tags ? `<div class="card-tags">${tags}</div>` : ''}
|
|
59
61
|
</div>`;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
el.knowledgeGrid.querySelectorAll('.knowledge-card').forEach((card) => {
|
|
64
|
-
card.addEventListener('click', () => K.openKnowledgePanel(card.dataset.path));
|
|
65
|
-
card.addEventListener('keydown', (e) => {
|
|
66
|
-
if (e.key === 'Enter') K.openKnowledgePanel(card.dataset.path);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
62
|
+
})
|
|
63
|
+
.join(''),
|
|
64
|
+
);
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
// ── Knowledge search ──────────────────────────────────────────────────────
|
|
@@ -106,28 +102,30 @@
|
|
|
106
102
|
el.knowledgeEmpty.classList.add('hidden');
|
|
107
103
|
el.knowledgeGrid.style.display = 'none';
|
|
108
104
|
el.knowledgeSearchResults.style.display = '';
|
|
109
|
-
|
|
110
|
-
.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
105
|
+
K.morph(
|
|
106
|
+
el.knowledgeSearchResults,
|
|
107
|
+
results
|
|
108
|
+
.map((r) => {
|
|
109
|
+
const title = r.title || r.path || '';
|
|
110
|
+
const excerpt = r.excerpt || '';
|
|
111
|
+
const score = r.score;
|
|
112
|
+
const maturity = r.maturity || 'candidate';
|
|
113
|
+
const accessCount = r.access_count || 0;
|
|
114
|
+
const decayF = r.decay_factor;
|
|
115
|
+
const matMult = r.maturity_multiplier;
|
|
116
|
+
const path = r.path || '';
|
|
117
|
+
|
|
118
|
+
let scoreBreakdown = '';
|
|
119
|
+
if (score != null) {
|
|
120
|
+
const parts = [];
|
|
121
|
+
parts.push(`relevance: ${score.toFixed(2)}`);
|
|
122
|
+
if (decayF != null) parts.push(`decay: ${decayF.toFixed(2)}`);
|
|
123
|
+
if (matMult != null) parts.push(`maturity: x${matMult.toFixed(1)}`);
|
|
124
|
+
const finalScore = score * (decayF || 1) * (matMult || 1);
|
|
125
|
+
scoreBreakdown = `<div class="score-breakdown">Score: ${finalScore.toFixed(2)} (${parts.join(' \u00d7 ')})</div>`;
|
|
126
|
+
}
|
|
129
127
|
|
|
130
|
-
|
|
128
|
+
return `<div class="result-item knowledge-result-item" data-path="${K.esc(path)}" tabindex="0" role="button">
|
|
131
129
|
<div class="result-meta">
|
|
132
130
|
<span class="maturity-badge" data-maturity="${K.esc(maturity)}">${K.esc(maturity)}${accessCount > 0 ? ` <span class="maturity-reads">· ${accessCount} reads</span>` : ''}</span>
|
|
133
131
|
<span class="result-entry-title">${K.esc(title)}</span>
|
|
@@ -136,15 +134,9 @@
|
|
|
136
134
|
<div class="result-excerpt">${K.highlightExcerpt(excerpt, query)}</div>
|
|
137
135
|
${scoreBreakdown}
|
|
138
136
|
</div>`;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
el.knowledgeSearchResults.querySelectorAll('.knowledge-result-item').forEach((card) => {
|
|
143
|
-
card.addEventListener('click', () => K.openKnowledgePanel(card.dataset.path));
|
|
144
|
-
card.addEventListener('keydown', (e) => {
|
|
145
|
-
if (e.key === 'Enter') K.openKnowledgePanel(card.dataset.path);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
137
|
+
})
|
|
138
|
+
.join(''),
|
|
139
|
+
);
|
|
148
140
|
}
|
|
149
141
|
|
|
150
142
|
// ── Load knowledge from API ───────────────────────────────────────────────
|
package/dist/ui/render-panel.js
CHANGED
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
function openPanel(type, data) {
|
|
10
10
|
const state = K._state;
|
|
11
11
|
const el = K._el;
|
|
12
|
+
if (!el || !el.sidePanel) return;
|
|
12
13
|
state.panel = { open: true, type, data };
|
|
13
14
|
el.sidePanel.hidden = false;
|
|
14
15
|
requestAnimationFrame(() => el.sidePanel.classList.add('open'));
|
|
15
|
-
el.contentWrapper.classList.add('panel-visible');
|
|
16
|
+
if (el.contentWrapper) el.contentWrapper.classList.add('panel-visible');
|
|
16
17
|
|
|
17
18
|
if (type === 'knowledge') {
|
|
18
19
|
renderKnowledgePanel(data, el);
|
|
@@ -49,7 +50,10 @@
|
|
|
49
50
|
// ── Knowledge panel ───────────────────────────────────────────────────────
|
|
50
51
|
|
|
51
52
|
function renderKnowledgePanel(data, el) {
|
|
52
|
-
|
|
53
|
+
K.morph(
|
|
54
|
+
el.panelTitle,
|
|
55
|
+
`<span class="material-symbols-outlined panel-icon">article</span>${K.esc(data.title)}`,
|
|
56
|
+
);
|
|
53
57
|
const meta = data.meta || {};
|
|
54
58
|
const entry = meta.entry || meta;
|
|
55
59
|
const category = entry.category || meta.category || '';
|
|
@@ -92,15 +96,7 @@
|
|
|
92
96
|
html += '</div></div>';
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
el.panelBody
|
|
96
|
-
|
|
97
|
-
// Bind click handlers on related entries
|
|
98
|
-
el.panelBody.querySelectorAll('.related-entry').forEach((entryEl) => {
|
|
99
|
-
entryEl.addEventListener('click', () => K.openKnowledgePanel(entryEl.dataset.path));
|
|
100
|
-
entryEl.addEventListener('keydown', (e) => {
|
|
101
|
-
if (e.key === 'Enter') K.openKnowledgePanel(entryEl.dataset.path);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
99
|
+
K.morph(el.panelBody, html);
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
// ── Session panel ─────────────────────────────────────────────────────────
|
|
@@ -111,7 +107,10 @@
|
|
|
111
107
|
const id = data.sessionId || s.id || '';
|
|
112
108
|
const meta = s.meta || s;
|
|
113
109
|
|
|
114
|
-
|
|
110
|
+
K.morph(
|
|
111
|
+
el.panelTitle,
|
|
112
|
+
`<span class="material-symbols-outlined panel-icon">terminal</span>Session ${K.esc(id.slice(0, 8))}`,
|
|
113
|
+
);
|
|
115
114
|
|
|
116
115
|
let html = '<div class="panel-meta">';
|
|
117
116
|
if (meta.cwd)
|
|
@@ -167,7 +166,7 @@
|
|
|
167
166
|
'<div class="empty-state"><span class="material-symbols-outlined empty-icon">chat_bubble</span><div class="empty-text">No messages available</div></div>';
|
|
168
167
|
}
|
|
169
168
|
|
|
170
|
-
el.panelBody
|
|
169
|
+
K.morph(el.panelBody, html);
|
|
171
170
|
|
|
172
171
|
// Scroll to and highlight matching message from search
|
|
173
172
|
if (data.searchExcerpt) {
|
|
@@ -212,8 +211,10 @@
|
|
|
212
211
|
// ── Consolidate panel ─────────────────────────────────────────────────────
|
|
213
212
|
|
|
214
213
|
function renderConsolidatePanel(data, el) {
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
K.morph(
|
|
215
|
+
el.panelTitle,
|
|
216
|
+
'<span class="material-symbols-outlined panel-icon">content_copy</span>Duplicate Analysis',
|
|
217
|
+
);
|
|
217
218
|
|
|
218
219
|
let html = '<div class="panel-meta">';
|
|
219
220
|
html += `<span class="panel-meta-item">${data.totalEntries} entries scanned</span>`;
|
|
@@ -251,18 +252,16 @@
|
|
|
251
252
|
}
|
|
252
253
|
}
|
|
253
254
|
|
|
254
|
-
el.panelBody
|
|
255
|
-
|
|
256
|
-
el.panelBody.querySelectorAll('.related-entry').forEach((entryEl) => {
|
|
257
|
-
entryEl.addEventListener('click', () => K.openKnowledgePanel(entryEl.dataset.path));
|
|
258
|
-
});
|
|
255
|
+
K.morph(el.panelBody, html);
|
|
259
256
|
}
|
|
260
257
|
|
|
261
258
|
// ── Reflect panel ─────────────────────────────────────────────────────────
|
|
262
259
|
|
|
263
260
|
function renderReflectPanel(data, el) {
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
K.morph(
|
|
262
|
+
el.panelTitle,
|
|
263
|
+
'<span class="material-symbols-outlined panel-icon">psychology</span>Reflection Analysis',
|
|
264
|
+
);
|
|
266
265
|
|
|
267
266
|
let html = '<div class="panel-meta">';
|
|
268
267
|
html += `<span class="panel-meta-item">${data.totalEntries} total entries</span>`;
|
|
@@ -296,11 +295,7 @@
|
|
|
296
295
|
html += '</div>';
|
|
297
296
|
}
|
|
298
297
|
|
|
299
|
-
el.panelBody
|
|
300
|
-
|
|
301
|
-
el.panelBody.querySelectorAll('.related-entry').forEach((entryEl) => {
|
|
302
|
-
entryEl.addEventListener('click', () => K.openKnowledgePanel(entryEl.dataset.path));
|
|
303
|
-
});
|
|
298
|
+
K.morph(el.panelBody, html);
|
|
304
299
|
}
|
|
305
300
|
|
|
306
301
|
// ── Panel resize ──────────────────────────────────────────────────────────
|
package/dist/ui/render-search.js
CHANGED
|
@@ -46,20 +46,22 @@
|
|
|
46
46
|
const { results, loading, query } = state.search;
|
|
47
47
|
|
|
48
48
|
if (loading) {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
K.morph(
|
|
50
|
+
el.searchResults,
|
|
51
|
+
'<div class="loading-inline"><div class="loading-spinner small"></div><span>Searching...</span></div>',
|
|
52
|
+
);
|
|
51
53
|
el.searchEmpty.classList.add('hidden');
|
|
52
54
|
return;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
if (!query.trim()) {
|
|
56
|
-
el.searchResults
|
|
58
|
+
K.morph(el.searchResults, '');
|
|
57
59
|
el.searchEmpty.classList.remove('hidden');
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
if (results.length === 0) {
|
|
62
|
-
el.searchResults
|
|
64
|
+
K.morph(el.searchResults, '');
|
|
63
65
|
el.searchEmpty.querySelector('.empty-text').textContent = 'No results found';
|
|
64
66
|
el.searchEmpty.querySelector('.empty-hint').textContent = `No matches for "${query}"`;
|
|
65
67
|
el.searchEmpty.classList.remove('hidden');
|
|
@@ -67,18 +69,20 @@
|
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
el.searchEmpty.classList.add('hidden');
|
|
70
|
-
|
|
71
|
-
.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
K.morph(
|
|
73
|
+
el.searchResults,
|
|
74
|
+
results
|
|
75
|
+
.map((r) => {
|
|
76
|
+
const sessionId = r.id || r.sessionId || r.session_id || '';
|
|
77
|
+
const excerpt = r.excerpt || r.text || r.content || '';
|
|
78
|
+
const role = r.role || '';
|
|
79
|
+
const score = r.score;
|
|
80
|
+
const meta = r.metadata;
|
|
81
|
+
const project = r.project || '';
|
|
82
|
+
const time = K.relativeTime(r.timestamp || r.date);
|
|
83
|
+
const roleIcon = role === 'user' ? 'person' : role === 'assistant' ? 'smart_toy' : 'chat';
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
return `<div class="result-item" data-session-id="${K.esc(sessionId)}" data-excerpt="${K.esc(excerpt)}" tabindex="0" role="button">
|
|
82
86
|
<div class="result-meta">
|
|
83
87
|
<span class="role-badge" data-role="${K.esc(role)}"><span class="material-symbols-outlined" style="font-size:12px">${roleIcon}</span> ${K.esc(role)}</span>
|
|
84
88
|
${project ? `<span class="result-project">${K.esc(project)}</span>` : ''}
|
|
@@ -87,17 +91,9 @@
|
|
|
87
91
|
</div>
|
|
88
92
|
<div class="result-excerpt">${K.highlightExcerpt(excerpt, query)}</div>
|
|
89
93
|
</div>`;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
el.searchResults.querySelectorAll('.result-item').forEach((card) => {
|
|
94
|
-
card.addEventListener('click', () =>
|
|
95
|
-
K.openSessionPanel(card.dataset.sessionId, card.dataset.excerpt),
|
|
96
|
-
);
|
|
97
|
-
card.addEventListener('keydown', (e) => {
|
|
98
|
-
if (e.key === 'Enter') K.openSessionPanel(card.dataset.sessionId, card.dataset.excerpt);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
94
|
+
})
|
|
95
|
+
.join(''),
|
|
96
|
+
);
|
|
101
97
|
}
|
|
102
98
|
|
|
103
99
|
// ── Export ──────────────────────────────────────────────────────────────────
|
|
@@ -84,9 +84,11 @@
|
|
|
84
84
|
const projects = [...new Set(sessions.map((s) => s.project).filter(Boolean))].sort();
|
|
85
85
|
const sel = el.sessionProjectFilter;
|
|
86
86
|
const current = sel.value;
|
|
87
|
-
|
|
87
|
+
K.morph(
|
|
88
|
+
sel,
|
|
88
89
|
'<option value="">All projects</option>' +
|
|
89
|
-
|
|
90
|
+
projects.map((p) => `<option value="${K.esc(p)}">${K.esc(p)}</option>`).join(''),
|
|
91
|
+
);
|
|
90
92
|
sel.value = current;
|
|
91
93
|
}
|
|
92
94
|
|
|
@@ -99,36 +101,38 @@
|
|
|
99
101
|
: state.sessions.list;
|
|
100
102
|
|
|
101
103
|
if (list.length === 0) {
|
|
102
|
-
el.sessionsList
|
|
104
|
+
K.morph(el.sessionsList, '');
|
|
103
105
|
el.sessionsEmpty.classList.remove('hidden');
|
|
104
106
|
return;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
el.sessionsEmpty.classList.add('hidden');
|
|
108
|
-
|
|
109
|
-
.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
110
|
+
K.morph(
|
|
111
|
+
el.sessionsList,
|
|
112
|
+
list
|
|
113
|
+
.map((s) => {
|
|
114
|
+
const id = s.sessionId || s.id || '';
|
|
115
|
+
const project = s.project || '';
|
|
116
|
+
const branch = s.branch || s.gitBranch || s.git_branch || '';
|
|
117
|
+
const count = s.messageCount || s.message_count || s.count || 0;
|
|
118
|
+
const date = s.startTime || s.date || s.created || s.startedAt || '';
|
|
119
|
+
const preview = s.preview || '';
|
|
120
|
+
const time = K.relativeTime(date);
|
|
121
|
+
const dateStr = date
|
|
122
|
+
? new Date(date).toLocaleDateString(undefined, {
|
|
123
|
+
month: 'short',
|
|
124
|
+
day: 'numeric',
|
|
125
|
+
year: 'numeric',
|
|
126
|
+
})
|
|
127
|
+
: '';
|
|
128
|
+
|
|
129
|
+
const title = preview
|
|
130
|
+
? preview.length > 80
|
|
131
|
+
? preview.slice(0, 80) + '\u2026'
|
|
132
|
+
: preview
|
|
133
|
+
: id.slice(0, 8);
|
|
134
|
+
|
|
135
|
+
return `<div class="session-card" data-session-id="${K.esc(id)}" tabindex="0" role="button">
|
|
132
136
|
<div class="session-header">
|
|
133
137
|
<span class="session-title">${K.esc(title)}</span>
|
|
134
138
|
<span class="session-date">${dateStr || time || ''}</span>
|
|
@@ -140,15 +144,9 @@
|
|
|
140
144
|
<span class="session-meta-item"><span class="material-symbols-outlined">tag</span>${K.esc(id.slice(0, 8))}</span>
|
|
141
145
|
</div>
|
|
142
146
|
</div>`;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
el.sessionsList.querySelectorAll('.session-card').forEach((card) => {
|
|
147
|
-
card.addEventListener('click', () => K.openSessionPanel(card.dataset.sessionId));
|
|
148
|
-
card.addEventListener('keydown', (e) => {
|
|
149
|
-
if (e.key === 'Enter') K.openSessionPanel(card.dataset.sessionId);
|
|
150
|
-
});
|
|
151
|
-
});
|
|
147
|
+
})
|
|
148
|
+
.join(''),
|
|
149
|
+
);
|
|
152
150
|
}
|
|
153
151
|
|
|
154
152
|
// ── Open session in side panel ────────────────────────────────────────────
|
|
@@ -185,7 +183,7 @@
|
|
|
185
183
|
function renderEmbeddingStats(state, el) {
|
|
186
184
|
const stats = state.embeddings.stats;
|
|
187
185
|
if (!stats || !stats.totalEntries) {
|
|
188
|
-
el.embeddingsStatsGrid
|
|
186
|
+
K.morph(el.embeddingsStatsGrid, '');
|
|
189
187
|
el.embeddingsStatus.style.display = 'none';
|
|
190
188
|
el.embeddingsEmpty.classList.remove('hidden');
|
|
191
189
|
return;
|
|
@@ -207,17 +205,20 @@
|
|
|
207
205
|
{ label: 'DB Size', value: (stats.dbSizeMB || 0).toFixed(1) + ' MB', detail: 'on disk' },
|
|
208
206
|
];
|
|
209
207
|
|
|
210
|
-
|
|
211
|
-
.
|
|
212
|
-
|
|
208
|
+
K.morph(
|
|
209
|
+
el.embeddingsStatsGrid,
|
|
210
|
+
cards
|
|
211
|
+
.map(
|
|
212
|
+
(c) => `
|
|
213
213
|
<div class="embedding-stat-card">
|
|
214
214
|
<span class="stat-label">${K.esc(c.label)}</span>
|
|
215
215
|
<span class="stat-number">${K.esc(String(c.value))}</span>
|
|
216
216
|
${c.detail ? `<span class="stat-detail">${K.esc(c.detail)}</span>` : ''}
|
|
217
217
|
</div>
|
|
218
218
|
`,
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
)
|
|
220
|
+
.join(''),
|
|
221
|
+
);
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
// ── Export ──────────────────────────────────────────────────────────────────
|
package/dist/ui/ui-utils.js
CHANGED
|
@@ -14,11 +14,16 @@
|
|
|
14
14
|
// ── Escape HTML ─────────────────────────────────────────────────────────────
|
|
15
15
|
|
|
16
16
|
function esc(str) {
|
|
17
|
+
if (str === null || str === undefined) return '';
|
|
17
18
|
const d = document.createElement('div');
|
|
18
|
-
d.textContent = str;
|
|
19
|
+
d.textContent = String(str);
|
|
19
20
|
return d.innerHTML;
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
function escAttr(str) {
|
|
24
|
+
return esc(str).replace(/"/g, '"');
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
// ── Debounce ────────────────────────────────────────────────────────────────
|
|
23
28
|
|
|
24
29
|
function debounce(fn, ms) {
|
|
@@ -181,11 +186,20 @@
|
|
|
181
186
|
return tag === 'input' || tag === 'textarea' || tag === 'select' || active.isContentEditable;
|
|
182
187
|
}
|
|
183
188
|
|
|
189
|
+
// ── Morphdom wrapper ────────────────────────────────────────────────────────
|
|
190
|
+
|
|
191
|
+
function morph(el, newInnerHTML) {
|
|
192
|
+
var wrap = document.createElement(el.tagName);
|
|
193
|
+
wrap.innerHTML = newInnerHTML;
|
|
194
|
+
morphdom(el, wrap, { childrenOnly: true });
|
|
195
|
+
}
|
|
196
|
+
|
|
184
197
|
// ── Export ──────────────────────────────────────────────────────────────────
|
|
185
198
|
|
|
186
199
|
Object.assign(window.Knowledge, {
|
|
187
200
|
$,
|
|
188
201
|
esc,
|
|
202
|
+
escAttr,
|
|
189
203
|
debounce,
|
|
190
204
|
relativeTime,
|
|
191
205
|
renderMd,
|
|
@@ -198,5 +212,6 @@
|
|
|
198
212
|
toggleTheme,
|
|
199
213
|
stripFrontmatter,
|
|
200
214
|
isInputFocused,
|
|
215
|
+
morph,
|
|
201
216
|
});
|
|
202
217
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-knowledge",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.15",
|
|
4
4
|
"description": "Cross-session memory and recall for AI agents — git-synced knowledge base, knowledge graph, confidence scoring, hybrid semantic+TF-IDF search, auto-distillation with secrets scrubbing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
77
77
|
"better-sqlite3": "^11.0.0",
|
|
78
|
+
"morphdom": "^2.7.8",
|
|
78
79
|
"sqlite-vec": "^0.1.0",
|
|
79
80
|
"ws": "^8.20.0"
|
|
80
81
|
},
|
package/scripts/copy-ui.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { cpSync } from 'fs';
|
|
1
|
+
import { cpSync, copyFileSync } from 'fs';
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
import { dirname, join } from 'path';
|
|
4
4
|
|
|
5
5
|
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
6
6
|
cpSync(join(root, 'src', 'ui'), join(root, 'dist', 'ui'), { recursive: true });
|
|
7
|
+
copyFileSync(
|
|
8
|
+
join(root, 'node_modules', 'morphdom', 'dist', 'morphdom-umd.min.js'),
|
|
9
|
+
join(root, 'dist', 'ui', 'morphdom.min.js'),
|
|
10
|
+
);
|