@kitelev/exocortex-cli 13.278.0 → 13.279.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v13.
|
|
2
|
+
// @kitelev/exocortex-cli v13.279.0
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -311,7 +311,7 @@ ${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.
|
|
|
311
311
|
`)}termToXML(e){return e instanceof Zf.IRI?`<uri>${this.escapeXML(e.value)}</uri>`:e instanceof eh.BlankNode?`<bnode>${this.escapeXML(e.id)}</bnode>`:e instanceof Jf.Literal?this.literalToXML(e):`<literal>${this.escapeXML(String(e))}</literal>`}literalToXML(e){let t=this.escapeXML(e.value);if(e.datatype)return`<literal datatype="${this.escapeXML(e.datatype.value)}">${t}</literal>`;if(e.language){let r=`xml:lang="${this.escapeXML(e.language)}"`;return e.hasDirection()&&e.direction&&(r+=` direction="${e.direction}"`),`<literal ${r}>${t}</literal>`}return`<literal>${t}</literal>`}serializeCSV(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=[];s.push(i.map(a=>this.escapeCSV(a)).join(","));for(let a of e){let c=i.map(u=>{let l=a.get(u);return l===void 0?"":this.escapeCSV(this.termToCSV(l))});s.push(c.join(","))}return s.join(`
|
|
312
312
|
`)}termToCSV(e){return e instanceof Zf.IRI?e.value:e instanceof eh.BlankNode?`_:${e.id}`:e instanceof Jf.Literal?this.literalToCSV(e):String(e)}literalToCSV(e){if(e.datatype)return`${e.value}^^<${e.datatype.value}>`;if(e.language){let t=e.language;return e.hasDirection()&&e.direction&&(t+=`--${e.direction}`),`${e.value}@${t}`}return e.value}serializeTurtle(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=[];s.push(`# SPARQL Results - ${e.length} solution(s)`),s.push(`# Variables: ${i.join(", ")}`),s.push("");for(let a=0;a<e.length;a++){let c=e[a];s.push(`# Solution ${a+1}`);for(let u of i){let l=c.get(u);l!==void 0&&s.push(`?${u} = ${this.termToTurtle(l)}`)}s.push("")}return s.join(`
|
|
313
313
|
`).trimEnd()}termToTurtle(e){return e instanceof Zf.IRI?`<${e.value}>`:e instanceof eh.BlankNode?`_:${e.id}`:e instanceof Jf.Literal?e.toString():`"${String(e)}"`}escapeXML(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}escapeCSV(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
314
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}};th.ResultSerializer=f0});var pw=v(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.FileAlreadyExistsError=po.FileNotFoundError=void 0;var h0=class extends Error{static{o(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};po.FileNotFoundError=h0;var d0=class extends Error{static{o(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};po.FileAlreadyExistsError=d0});var m0=v(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.HeadlessError=void 0;var p0=class extends Error{static{o(this,"HeadlessError")}constructor(e,t){super(`"${e}" requires UI. CLI alternative: ${t}`),this.action=e,this.cliAlternative=t,this.name="HeadlessError"}};rh.HeadlessError=p0});var gw=v(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.ActionInterpreter=void 0;var zN=Be(),mw=m0(),QN=Ay(),YN=Cy(),KN=s0(),nh="https://exocortex.my/ontology/exo-ui#",XN="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",g0=class{static{o(this,"ActionInterpreter")}constructor(e,t,r,i){this.tripleStore=e,this.assetCreationService=t,this.vaultAdapter=r,this.fileSystem=i,this.handlers=new Map,this.customHandlers=new Map,this.createAssetHandler=async(s,a)=>{let c=s.params.targetClass,u=s.params.template,l=s.params.location;if(a.uiProvider.isHeadless&&!l)return{success:!1,message:new mw.HeadlessError("CreateAssetAction without location","--location <path>").message};if(!this.assetCreationService)return{success:!1,message:"AssetCreationService not initialized"};try{return{success:!0,navigateTo:await this.assetCreationService.createAsset({className:c,label:u,folderPath:l}),refresh:!0}}catch(f){return{success:!1,message:`Failed to create asset: ${f instanceof Error?f.message:String(f)}`}}},this.updatePropertyHandler=async(s,a)=>{let c=s.params.targetProperty,u=s.params.targetValue,l=s.params.targetAsset;if(!this.vaultAdapter)return{success:!1,message:"VaultAdapter not initialized"};let f;if(l){let h=this.vaultAdapter.getAbstractFileByPath(l);if(h&&"basename"in h)f=h;else return{success:!1,message:`Target asset not found: ${l}`}}else f=a.currentAsset;if(!f)return{success:!1,message:"No target asset"};try{return await this.vaultAdapter.updateFrontmatter(f,h=>{let d={...h};return u==null?delete d[c]:d[c]=u,d}),{success:!0,refresh:!0}}catch(h){return{success:!1,message:`Failed to update property: ${h instanceof Error?h.message:String(h)}`}}},this.navigateHandler=async(s,a)=>{let c=s.params.target;if(!c)return{success:!1,message:"NavigateAction requires 'target' parameter"};let u;if(c.startsWith("SELECT")||c.startsWith("ASK")){let f=await this.tripleStore.match(void 0,void 0,void 0);if(f.length===0)return{success:!1,message:"No results found"};if(c.startsWith("ASK"))return a.currentAsset?(await a.uiProvider.navigate(a.currentAsset.path),{success:!0}):{success:!0,message:"Query returned true"};let h=f[0];u="value"in h.subject?h.subject.value:String(h.subject)}else u=c;let l=await this.resolveAssetUri(u);return l?(await a.uiProvider.navigate(l),{success:!0}):{success:!1,message:"Asset not found"}},this.executeSparqlHandler=async(s,a)=>{let c=s.params.query;if(!c)return{success:!1,message:"ExecuteSPARQLAction requires 'query' parameter"};try{let l=new QN.SPARQLParser().parse(c);if(l.type!=="query"||l.queryType!=="SELECT")return{success:!1,message:"ExecuteSPARQLAction only supports SELECT queries"};let h=new YN.AlgebraTranslator().translate(l);return{success:!0,data:(await new KN.QueryExecutor(this.tripleStore).executeAll(h)).map(w=>w.toJSON())}}catch(u){return{success:!1,message:`Failed to execute SPARQL query: ${u instanceof Error?u.message:String(u)}`}}},this.showModalHandler=async(s,a)=>{let c=s.params.modalType,u=s.params.modalParams,l=s.params.Action_cliAlternative;if(a.uiProvider.isHeadless)return{success:!1,message:new mw.HeadlessError("ShowModalAction",l||"Use appropriate CLI arguments").message};let f;try{f=u?JSON.parse(u):{}}catch(h){return{success:!1,message:`Invalid modalParams JSON: ${h instanceof Error?h.message:String(h)}`}}try{let h;if(c==="input")h=await a.uiProvider.showInputModal(f);else if(c==="select")h=await a.uiProvider.showSelectModal(f);else if(c==="confirm")h=await a.uiProvider.showConfirm(f.message||"");else return{success:!1,message:`Unknown modal type: ${c}`};return{success:!0,data:h}}catch(h){return{success:!1,message:`Modal failed: ${h instanceof Error?h.message:String(h)}`}}},this.triggerHookHandler=async(s,a)=>({success:!1,message:`Not implemented: TriggerHookAction (hookName: ${String(s.params.hookName)})`}),this.customHandler=async(s,a)=>{let c=s.params.handler,u=this.customHandlers.get(c);return u?u(s,a):{success:!1,message:`Custom handler not found: ${c}`}},this.compositeHandler=async(s,a)=>({success:!1,message:"Not implemented: CompositeAction"}),this.registerBuiltinHandlers()}registerBuiltinHandlers(){this.handlers.set("exo-ui:CreateAssetAction",this.createAssetHandler),this.handlers.set("exo-ui:UpdatePropertyAction",this.updatePropertyHandler),this.handlers.set("exo-ui:NavigateAction",this.navigateHandler),this.handlers.set("exo-ui:ExecuteSPARQLAction",this.executeSparqlHandler),this.handlers.set("exo-ui:ShowModalAction",this.showModalHandler),this.handlers.set("exo-ui:TriggerHookAction",this.triggerHookHandler),this.handlers.set("exo-ui:CustomHandlerAction",this.customHandler),this.handlers.set("exo-ui:CompositeAction",this.compositeHandler)}registerCustomHandler(e,t){this.customHandlers.set(e,t)}hasHandler(e){return this.handlers.has(e)||this.customHandlers.has(e)}async execute(e,t){let r;try{r=await this.loadActionDefinition(e)}catch(s){return{success:!1,message:`Failed to load action definition: ${s instanceof Error?s.message:String(s)}`}}let i=this.handlers.get(r.type)||this.customHandlers.get(r.type);return i?i(r,t):{success:!1,message:`Unknown action type: ${r.type}`}}async loadActionDefinition(e){let t=new zN.IRI(e),r=await this.tripleStore.match(t,void 0,void 0),i,s={};for(let a of r){let c="value"in a.predicate?a.predicate.value:String(a.predicate);if(c===XN){let u="value"in a.object?a.object.value:String(a.object);u.startsWith(nh)&&(i="exo-ui:"+u.substring(nh.length))}else if(c.startsWith(nh)){let u=c.substring(nh.length),l="value"in a.object?a.object.value:String(a.object);s[u]=l}}if(!i)throw new Error(`Action type not found for: ${e}`);return{type:i,params:s}}async resolveAssetUri(e){if(!this.fileSystem)return null;let t=e.split("/").pop();return t?this.fileSystem.findFileByUID(t):null}};ih.ActionInterpreter=g0});var yw=v(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.container=void 0;as.registerCoreServices=E4;as.createChildContainer=T4;as.getContainer=A4;as.resetContainer=x4;Qu();var jc=Le();Object.defineProperty(as,"container",{enumerable:!0,get:o(function(){return jc.container},"get")});var ht=ct(),JN=Dm(),ZN=Bl(),e4=cg(),t4=ql(),r4=eg(),n4=Fm(),i4=$m(),s4=Mm(),a4=Ql(),o4=Yl(),c4=Ym(),u4=Xm(),l4=rg(),f4=zm(),h4=lg(),d4=pg(),p4=hg(),m4=qm(),g4=Wm(),y4=ag(),v4=ig(),S4=ty(),_4=Um(),w4=gg(),b4=Sg();function E4(n){let e=n||jc.container;e.registerSingleton(ht.DI_TOKENS.TaskFrontmatterGenerator,ZN.TaskFrontmatterGenerator),e.registerSingleton(ht.DI_TOKENS.DynamicFrontmatterGenerator,e4.DynamicFrontmatterGenerator),e.registerSingleton(ht.DI_TOKENS.AlgorithmExtractor,t4.AlgorithmExtractor),e.registerSingleton(ht.DI_TOKENS.EffortStatusWorkflow,a4.EffortStatusWorkflow),e.registerSingleton(ht.DI_TOKENS.StatusTimestampService,o4.StatusTimestampService),e.registerSingleton(ht.DI_TOKENS.TaskStatusService,s4.TaskStatusService),e.registerSingleton(ht.DI_TOKENS.TaskCreationService,JN.TaskCreationService),e.registerSingleton(ht.DI_TOKENS.ProjectCreationService,n4.ProjectCreationService),e.registerSingleton(ht.DI_TOKENS.AreaCreationService,i4.AreaCreationService),e.registerSingleton(ht.DI_TOKENS.ClassCreationService,m4.ClassCreationService),e.registerSingleton(ht.DI_TOKENS.ConceptCreationService,g4.ConceptCreationService),e.registerSingleton(ht.DI_TOKENS.FleetingNoteCreationService,y4.FleetingNoteCreationService),e.registerSingleton(ht.DI_TOKENS.SupervisionCreationService,v4.SupervisionCreationService),e.registerSingleton(ht.DI_TOKENS.GenericAssetCreationService,b4.GenericAssetCreationService),e.registerSingleton(ht.DI_TOKENS.PropertyCleanupService,r4.PropertyCleanupService),e.registerSingleton(ht.DI_TOKENS.FolderRepairService,c4.FolderRepairService),e.registerSingleton(ht.DI_TOKENS.LabelToAliasService,u4.LabelToAliasService),e.registerSingleton(ht.DI_TOKENS.RenameToUidService,l4.RenameToUidService),e.registerSingleton(ht.DI_TOKENS.PlanningService,h4.PlanningService),e.registerSingleton(ht.DI_TOKENS.EffortVotingService,f4.EffortVotingService),e.registerSingleton(ht.DI_TOKENS.SessionEventService,d4.SessionEventService),e.registerSingleton(ht.DI_TOKENS.AssetConversionService,p4.AssetConversionService),e.registerSingleton(ht.DI_TOKENS.NoteToRDFConverter,S4.NoteToRDFConverter),e.registerSingleton(ht.DI_TOKENS.AreaHierarchyBuilder,_4.AreaHierarchyBuilder),e.registerSingleton(ht.DI_TOKENS.URIConstructionService,w4.URIConstructionService)}o(E4,"registerCoreServices");function T4(){return jc.container.createChildContainer()}o(T4,"createChildContainer");function A4(){return jc.container}o(A4,"getContainer");function x4(){jc.container.reset()}o(x4,"resetContainer")});var y0=v(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.DEFAULT_COLORS=mo.NODE_FLAGS=void 0;mo.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};mo.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var S0=v(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.StringTable=void 0;var v0=class n{static{o(this,"StringTable")}constructor(e){if(this.stringToIndex=new Map,this.strings=[],this.memoryBytes=0,e)for(let t of e)this.intern(t)}intern(e){let t=this.stringToIndex.get(e);if(t!==void 0)return t;let r=this.strings.length;return this.strings.push(e),this.stringToIndex.set(e,r),this.memoryBytes+=e.length*2+50,r}getIndex(e){return this.stringToIndex.get(e)??-1}getString(e){if(e<0||e>=this.strings.length)throw new RangeError(`StringTable index out of bounds: ${e}`);return this.strings[e]}has(e){return this.stringToIndex.has(e)}hasIndex(e){return e>=0&&e<this.strings.length}get size(){return this.strings.length}getMemoryBytes(){return this.memoryBytes}*entries(){for(let e=0;e<this.strings.length;e++)yield[e,this.strings[e]]}*values(){for(let e of this.strings)yield e}toArray(){return[...this.strings]}clear(){this.stringToIndex.clear(),this.strings=[],this.memoryBytes=0}static fromJSON(e){return new n(e)}toJSON(){return this.strings}internAll(e){return e.map(t=>this.intern(t))}getStrings(e){return e.map(t=>this.getString(t))}search(e){let t=typeof e=="string"?new RegExp(e):e,r=[];for(let i=0;i<this.strings.length;i++)t.test(this.strings[i])&&r.push([i,this.strings[i]]);return r}getStats(){let e=this.strings.reduce((t,r)=>t+r.length,0);return{count:this.strings.length,memoryBytes:this.memoryBytes,avgStringLength:this.strings.length>0?e/this.strings.length:0}}};sh.StringTable=v0});var vw=v(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.CompactGraphStore=void 0;var ah=S0(),kr=y0(),C4={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function _0(n,e){if(n===void 0)return e;if(typeof n=="number")return n;if(n.startsWith("#")){let t=n.slice(1);if(t.length===6)return parseInt(t,16)<<8|255;if(t.length===8)return parseInt(t,16)}return e}o(_0,"parseColor");var w0=class{static{o(this,"CompactGraphStore")}constructor(e){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex=new Map,this.indexToNodeId=[],this.edgeIdToIndex=new Map,this.config={...C4,...e},this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity),this.uriTable=new ah.StringTable,this.labelTable=new ah.StringTable,this.typeTable=new ah.StringTable,this.predicateTable=new ah.StringTable}allocateNodeArrays(e){return{positions:new Float32Array(e*2),radii:new Float32Array(e),colors:new Uint32Array(e),types:new Uint16Array(e),flags:new Uint8Array(e)}}allocateEdgeArrays(e){return{sourceIndices:new Uint32Array(e),targetIndices:new Uint32Array(e),predicateIndices:new Uint16Array(e),widths:new Float32Array(e),colors:new Uint32Array(e)}}resizeNodeArrays(e){if(e<=this.nodeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateNodeArrays(e);t.positions.set(this.nodes.positions.subarray(0,this.nodeCount*2)),t.radii.set(this.nodes.radii.subarray(0,this.nodeCount)),t.colors.set(this.nodes.colors.subarray(0,this.nodeCount)),t.types.set(this.nodes.types.subarray(0,this.nodeCount)),t.flags.set(this.nodes.flags.subarray(0,this.nodeCount)),this.nodes=t,this.nodeCapacity=e}resizeEdgeArrays(e){if(e<=this.edgeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateEdgeArrays(e);t.sourceIndices.set(this.edges.sourceIndices.subarray(0,this.edgeCount)),t.targetIndices.set(this.edges.targetIndices.subarray(0,this.edgeCount)),t.predicateIndices.set(this.edges.predicateIndices.subarray(0,this.edgeCount)),t.widths.set(this.edges.widths.subarray(0,this.edgeCount)),t.colors.set(this.edges.colors.subarray(0,this.edgeCount)),this.edges=t,this.edgeCapacity=e}ensureNodeCapacity(e){let t=this.nodeCount+e;if(t>this.nodeCapacity){let r=Math.max(t,Math.floor(this.nodeCapacity*this.config.growthFactor));this.resizeNodeArrays(r)}}ensureEdgeCapacity(e){let t=this.edgeCount+e;if(t>this.edgeCapacity){let r=Math.max(t,Math.floor(this.edgeCapacity*this.config.growthFactor));this.resizeEdgeArrays(r)}}addNode(e){let t=this.nodeIdToIndex.get(e.id);if(t!==void 0)return this.updateNodeAt(t,e),t;this.ensureNodeCapacity(1);let r=this.nodeCount++,i=r*2;this.nodes.positions[i]=e.x??Math.random()*1e3-500,this.nodes.positions[i+1]=e.y??Math.random()*1e3-500,this.nodes.radii[r]=e.radius??8,this.nodes.colors[r]=_0(e.color,kr.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=kr.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=kr.NODE_FLAGS.PINNED),e.isArchived&&(s|=kr.NODE_FLAGS.ARCHIVED),this.nodes.flags[r]=s,this.nodeIdToIndex.set(e.id,r),this.indexToNodeId[r]=e.id,this.uriTable.intern(e.id),e.label&&this.labelTable.intern(e.label),r}updateNodeAt(e,t){let r=e*2;t.x!==void 0&&(this.nodes.positions[r]=t.x),t.y!==void 0&&(this.nodes.positions[r+1]=t.y),t.radius!==void 0&&(this.nodes.radii[e]=t.radius),t.color!==void 0&&(this.nodes.colors[e]=_0(t.color,kr.DEFAULT_COLORS.NODE)),t.assetClass!==void 0&&(this.nodes.types[e]=this.typeTable.intern(t.assetClass));let i=this.nodes.flags[e];t.isPinned!==void 0&&(i=t.isPinned?i|kr.NODE_FLAGS.PINNED:i&~kr.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|kr.NODE_FLAGS.ARCHIVED:i&~kr.NODE_FLAGS.ARCHIVED),this.nodes.flags[e]=i}addEdge(e){let t=this.nodeIdToIndex.get(e.sourceId),r=this.nodeIdToIndex.get(e.targetId);if(t===void 0||r===void 0)return-1;let i=`${e.sourceId}->${e.targetId}:${e.predicate??"link"}`,s=this.edgeIdToIndex.get(i);if(s!==void 0)return s;this.ensureEdgeCapacity(1);let a=this.edgeCount++;return this.edges.sourceIndices[a]=t,this.edges.targetIndices[a]=r,this.edges.widths[a]=e.width??1,this.edges.colors[a]=_0(e.color,kr.DEFAULT_COLORS.EDGE),e.predicate?this.edges.predicateIndices[a]=this.predicateTable.intern(e.predicate):this.edges.predicateIndices[a]=0,this.edgeIdToIndex.set(i,a),a}addNodes(e){return this.ensureNodeCapacity(e.length),e.map(t=>this.addNode(t))}addEdges(e){return this.ensureEdgeCapacity(e.length),e.map(t=>this.addEdge(t))}loadChunk(e){let r=this.addNodes(e.nodes).filter(a=>a>=0).length,s=this.addEdges(e.edges).filter(a=>a>=0).length;return{nodesAdded:r,edgesAdded:s}}getNodePosition(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return null;let r=t*2;return{x:this.nodes.positions[r],y:this.nodes.positions[r+1]}}getNodePositionByIndex(e){let t=e*2;return{x:this.nodes.positions[t],y:this.nodes.positions[t+1]}}setNodePosition(e,t,r){let i=this.nodeIdToIndex.get(e);if(i===void 0)return!1;let s=i*2;return this.nodes.positions[s]=t,this.nodes.positions[s+1]=r,!0}setNodePositionByIndex(e,t,r){let i=e*2;this.nodes.positions[i]=t,this.nodes.positions[i+1]=r}updateNodePositions(e){let t=0;for(let[r,i]of e)this.setNodePosition(r,i.x,i.y)&&t++;return t}applyNodeUpdates(e){let t=performance.now(),r=0;for(let i of e){let s=i.index;if(!(s<0||s>=this.nodeCount)){if(i.x!==void 0||i.y!==void 0){let a=s*2;i.x!==void 0&&(this.nodes.positions[a]=i.x),i.y!==void 0&&(this.nodes.positions[a+1]=i.y)}i.radius!==void 0&&(this.nodes.radii[s]=i.radius),i.color!==void 0&&(this.nodes.colors[s]=i.color),i.setFlags!==void 0&&(this.nodes.flags[s]|=i.setFlags),i.clearFlags!==void 0&&(this.nodes.flags[s]&=~i.clearFlags),r++}}return{nodesUpdated:r,edgesUpdated:0,timeMs:performance.now()-t}}getNodeFlags(e){let t=this.nodeIdToIndex.get(e);return t===void 0?0:this.nodes.flags[t]}setNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]|=t,!0)}clearNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]&=~t,!0)}hasNodeFlag(e,t){return(this.getNodeFlags(e)&t)!==0}selectNode(e){return this.setNodeFlag(e,kr.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,kr.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~kr.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&kr.NODE_FLAGS.SELECTED&&e.push(this.indexToNodeId[t]);return e}getNodeId(e){return this.indexToNodeId[e]}getNodeIndex(e){return this.nodeIdToIndex.get(e)}hasNode(e){return this.nodeIdToIndex.has(e)}getNodeCount(){return this.nodeCount}getEdgeCount(){return this.edgeCount}getNodeEdges(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=[];for(let i=0;i<this.edgeCount;i++)this.edges.sourceIndices[i]===t?r.push({edgeIndex:i,isSource:!0}):this.edges.targetIndices[i]===t&&r.push({edgeIndex:i,isSource:!1});return r}getNeighbors(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=new Set;for(let i=0;i<this.edgeCount;i++)if(this.edges.sourceIndices[i]===t){let s=this.edges.targetIndices[i];r.add(this.indexToNodeId[s])}else if(this.edges.targetIndices[i]===t){let s=this.edges.sourceIndices[i];r.add(this.indexToNodeId[s])}return Array.from(r)}getRawArrays(){return{nodes:this.nodes,edges:this.edges,nodeCount:this.nodeCount,edgeCount:this.edgeCount}}getPositionsArray(){return this.nodes.positions.subarray(0,this.nodeCount*2)}getMemoryStats(){let e=this.nodeCapacity*2*4+this.nodeCapacity*4+this.nodeCapacity*4+this.nodeCapacity*2+this.nodeCapacity,t=this.edgeCapacity*4+this.edgeCapacity*4+this.edgeCapacity*2+this.edgeCapacity*4+this.edgeCapacity*4,r=this.uriTable.getMemoryBytes()+this.labelTable.getMemoryBytes()+this.typeTable.getMemoryBytes()+this.predicateTable.getMemoryBytes();return{nodeCount:this.nodeCount,edgeCount:this.edgeCount,nodeCapacity:this.nodeCapacity,edgeCapacity:this.edgeCapacity,nodeMemoryBytes:e,edgeMemoryBytes:t,stringTableBytes:r,totalBytes:e+t+r,internedStringCount:this.uriTable.size+this.labelTable.size+this.typeTable.size+this.predicateTable.size}}clear(){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex.clear(),this.indexToNodeId=[],this.edgeIdToIndex.clear(),this.uriTable.clear(),this.labelTable.clear(),this.typeTable.clear(),this.predicateTable.clear(),this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity)}getTypeTable(){return this.typeTable}getLabelTable(){return this.labelTable}getUriTable(){return this.uriTable}getPredicateTable(){return this.predicateTable}};oh.CompactGraphStore=w0});var Sw=v(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.MemoryPool=void 0;yo.getGlobalPool=O4;yo.resetGlobalPool=P4;var I4={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},ch=class{static{o(this,"MemoryPool")}constructor(e){this.float32Pool=new Map,this.uint32Pool=new Map,this.uint16Pool=new Map,this.uint8Pool=new Map,this.stats={poolHits:0,poolMisses:0,pooledArrays:0,pooledMemory:0,returned:0,rejected:0},this.config={...I4,...e};for(let t of this.config.sizeBuckets)this.float32Pool.set(t,[]),this.uint32Pool.set(t,[]),this.uint16Pool.set(t,[]),this.uint8Pool.set(t,[])}getBucketSize(e){for(let t of this.config.sizeBuckets)if(t>=e)return t;return e}getFloat32(e){let t=this.getBucketSize(e),r=this.float32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Float32Array(t)}getUint32(e){let t=this.getBucketSize(e),r=this.uint32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint32Array(t)}getUint16(e){let t=this.getBucketSize(e),r=this.uint16Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*2;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint16Array(t)}getUint8(e){let t=this.getBucketSize(e),r=this.uint8Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint8Array(t)}releaseFloat32(e){this.releaseToPool(this.float32Pool,e,4)}releaseUint32(e){this.releaseToPool(this.uint32Pool,e,4)}releaseUint16(e){this.releaseToPool(this.uint16Pool,e,2)}releaseUint8(e){this.releaseToPool(this.uint8Pool,e,1)}releaseToPool(e,t,r){let i=t.length,s=e.get(i);if(s&&s.length<this.config.maxPooledArrays){if(this.config.autoCleanup&&this.stats.pooledMemory+i*r>this.config.maxPoolMemory){this.stats.rejected++;return}s.push(t),this.stats.returned++,this.stats.pooledArrays++,this.stats.pooledMemory+=i*r}else this.stats.rejected++}getStats(){return{...this.stats}}getHitRatio(){let e=this.stats.poolHits+this.stats.poolMisses;return e>0?this.stats.poolHits/e:0}clear(){for(let e of this.float32Pool.values())e.length=0;for(let e of this.uint32Pool.values())e.length=0;for(let e of this.uint16Pool.values())e.length=0;for(let e of this.uint8Pool.values())e.length=0;this.stats.pooledArrays=0,this.stats.pooledMemory=0}cleanup(e){if(this.stats.pooledMemory<=e)return;let t=[...this.config.sizeBuckets].sort((r,i)=>i-r);for(let r of t){if(this.stats.pooledMemory<=e)break;for(let[i,s]of[[this.float32Pool,4],[this.uint32Pool,4],[this.uint16Pool,2],[this.uint8Pool,1]]){let a=i.get(r);if(a)for(;a.length>0&&this.stats.pooledMemory>e;)a.pop(),this.stats.pooledArrays--,this.stats.pooledMemory-=r*s}}}resetStats(){this.stats.poolHits=0,this.stats.poolMisses=0,this.stats.returned=0,this.stats.rejected=0}};yo.MemoryPool=ch;var go=null;function O4(){return go||(go=new ch),go}o(O4,"getGlobalPool");function P4(){go&&go.clear(),go=null}o(P4,"resetGlobalPool")});var _w=v($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.StreamingLoader=void 0;$c.createStreamingSource=R4;var D4={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},b0=class{static{o(this,"StreamingLoader")}constructor(e,t){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.progressCallbacks=[],this.abortController=null,this.store=e,this.config={...D4,...t}}getState(){return this.state}getProgress(){let e=this.totalChunks!==void 0&&this.totalChunks>0?this.chunksProcessed/this.totalChunks:0;return{currentChunk:this.chunksProcessed,totalChunks:this.totalChunks,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,progress:e,isComplete:this.state==="completed"}}onProgress(e){return this.progressCallbacks.push(e),()=>{let t=this.progressCallbacks.indexOf(e);t>=0&&this.progressCallbacks.splice(t,1)}}notifyProgress(){let e=this.getProgress();for(let t of this.progressCallbacks)t(e)}loadChunk(e){if(this.state==="error")throw new Error("Loader is in error state");this.state="loading",e.totalChunks!==void 0&&(this.totalChunks=e.totalChunks);for(let t of e.nodes)this.store.addNode(t),this.nodesLoaded++;for(let t of e.edges)this.store.addEdge(t)>=0?this.edgesLoaded++:this.pendingEdges.push(t);this.chunksProcessed++,e.isLast&&this.finishLoading(),this.notifyProgress()}finishLoading(){if(this.config.autoResolveEdges&&this.pendingEdges.length>0){for(let e of this.pendingEdges)this.store.addEdge(e)>=0&&this.edgesLoaded++;this.pendingEdges=[]}this.state="completed",this.notifyProgress()}async loadFromIterator(e){this.reset(),this.state="loading",this.abortController=new AbortController;try{for await(let r of e){if(this.abortController.signal.aborted){this.state="paused";return}this.loadChunk(r),this.config.chunkDelay>0&&await this.delay(this.config.chunkDelay)}this.state!=="completed"&&this.finishLoading()}catch(t){throw this.state="error",t}finally{this.abortController=null}}async loadFromArrays(e,t){let r=this.createChunks(e,t);await this.loadFromIterator(this.arrayToAsyncIterator(r))}createChunks(e,t){let r=[],{chunkSize:i}=this.config,s=Math.ceil(e.length/i),a=Array(s).fill(null).map(()=>[]);for(let c of t){let u=e.findIndex(l=>l.id===c.sourceId);if(u>=0){let l=Math.floor(u/i);a[l].push(c)}}for(let c=0;c<s;c++){let u=c*i,l=Math.min(u+i,e.length);r.push({chunkIndex:c,totalChunks:s,nodes:e.slice(u,l),edges:a[c],isLast:c===s-1})}return r}async*arrayToAsyncIterator(e){for(let t of e)yield t}delay(e){return new Promise(t=>setTimeout(t,e))}cancel(){this.abortController&&this.abortController.abort(),this.state="paused"}reset(){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.totalChunks=void 0,this.abortController=null}getPendingEdgeCount(){return this.pendingEdges.length}getStats(){return{state:this.state,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,chunksProcessed:this.chunksProcessed,totalChunks:this.totalChunks,pendingEdges:this.pendingEdges.length,storeStats:this.store.getMemoryStats()}}};$c.StreamingLoader=b0;async function*R4(n,e,t=1e3){let r=0,i=0,s;for(;;){let a=await e(n,r,t);if(a.totalCount!==void 0&&s===void 0&&(s=Math.ceil(a.totalCount/t)),yield{chunkIndex:i,totalChunks:s,nodes:a.nodes,edges:a.edges,isLast:!a.hasMore},!a.hasMore)break;r+=t,i++}}o(R4,"createStreamingSource")});var Ew=v(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.createStreamingSource=xt.StreamingLoader=xt.resetGlobalPool=xt.getGlobalPool=xt.MemoryPool=xt.CompactGraphStore=xt.StringTable=xt.DEFAULT_COLORS=xt.NODE_FLAGS=void 0;var ww=y0();Object.defineProperty(xt,"NODE_FLAGS",{enumerable:!0,get:o(function(){return ww.NODE_FLAGS},"get")});Object.defineProperty(xt,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return ww.DEFAULT_COLORS},"get")});var F4=S0();Object.defineProperty(xt,"StringTable",{enumerable:!0,get:o(function(){return F4.StringTable},"get")});var N4=vw();Object.defineProperty(xt,"CompactGraphStore",{enumerable:!0,get:o(function(){return N4.CompactGraphStore},"get")});var E0=Sw();Object.defineProperty(xt,"MemoryPool",{enumerable:!0,get:o(function(){return E0.MemoryPool},"get")});Object.defineProperty(xt,"getGlobalPool",{enumerable:!0,get:o(function(){return E0.getGlobalPool},"get")});Object.defineProperty(xt,"resetGlobalPool",{enumerable:!0,get:o(function(){return E0.resetGlobalPool},"get")});var bw=_w();Object.defineProperty(xt,"StreamingLoader",{enumerable:!0,get:o(function(){return bw.StreamingLoader},"get")});Object.defineProperty(xt,"createStreamingSource",{enumerable:!0,get:o(function(){return bw.createStreamingSource},"get")})});var ai=v(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.ErrorCode=void 0;var Tw;(function(n){n[n.INVALID_INPUT=1e3]="INVALID_INPUT",n[n.INVALID_FORMAT=1001]="INVALID_FORMAT",n[n.MISSING_REQUIRED_FIELD=1002]="MISSING_REQUIRED_FIELD",n[n.INVALID_SCHEMA=1003]="INVALID_SCHEMA",n[n.NETWORK_ERROR=2e3]="NETWORK_ERROR",n[n.REQUEST_TIMEOUT=2001]="REQUEST_TIMEOUT",n[n.CONNECTION_FAILED=2002]="CONNECTION_FAILED",n[n.FILE_READ_ERROR=2003]="FILE_READ_ERROR",n[n.FILE_WRITE_ERROR=2004]="FILE_WRITE_ERROR",n[n.INVALID_STATE=3e3]="INVALID_STATE",n[n.INVALID_TRANSITION=3001]="INVALID_TRANSITION",n[n.OPERATION_FAILED=3002]="OPERATION_FAILED",n[n.CONCURRENT_MODIFICATION=3003]="CONCURRENT_MODIFICATION",n[n.PERMISSION_DENIED=4e3]="PERMISSION_DENIED",n[n.UNAUTHORIZED=4001]="UNAUTHORIZED",n[n.FORBIDDEN=4003]="FORBIDDEN",n[n.NOT_FOUND=5e3]="NOT_FOUND",n[n.RESOURCE_EXHAUSTED=5001]="RESOURCE_EXHAUSTED",n[n.ALREADY_EXISTS=5002]="ALREADY_EXISTS",n[n.UNKNOWN_ERROR=9e3]="UNKNOWN_ERROR",n[n.INTERNAL_ERROR=9001]="INTERNAL_ERROR"})(Tw||(uh.ErrorCode=Tw={}))});var oi=v(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.ApplicationError=void 0;var T0=class extends Error{static{o(this,"ApplicationError")}constructor(e,t){super(e),this.name=this.constructor.name,this.context=t,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
|
|
314
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}};th.ResultSerializer=f0});var pw=v(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.FileAlreadyExistsError=po.FileNotFoundError=void 0;var h0=class extends Error{static{o(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};po.FileNotFoundError=h0;var d0=class extends Error{static{o(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};po.FileAlreadyExistsError=d0});var m0=v(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.HeadlessError=void 0;var p0=class extends Error{static{o(this,"HeadlessError")}constructor(e,t){super(`"${e}" requires UI. CLI alternative: ${t}`),this.action=e,this.cliAlternative=t,this.name="HeadlessError"}};rh.HeadlessError=p0});var gw=v(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.ActionInterpreter=void 0;var zN=Be(),mw=m0(),QN=Ay(),YN=Cy(),KN=s0(),nh="https://exocortex.my/ontology/exo-ui#",XN="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",g0=class{static{o(this,"ActionInterpreter")}constructor(e,t,r,i,s){this.tripleStore=e,this.assetCreationService=t,this.vaultAdapter=r,this.fileSystem=i,this.webhookService=s,this.handlers=new Map,this.customHandlers=new Map,this.createAssetHandler=async(a,c)=>{let u=a.params.targetClass,l=a.params.template,f=a.params.location;if(c.uiProvider.isHeadless&&!f)return{success:!1,message:new mw.HeadlessError("CreateAssetAction without location","--location <path>").message};if(!this.assetCreationService)return{success:!1,message:"AssetCreationService not initialized"};try{return{success:!0,navigateTo:await this.assetCreationService.createAsset({className:u,label:l,folderPath:f}),refresh:!0}}catch(h){return{success:!1,message:`Failed to create asset: ${h instanceof Error?h.message:String(h)}`}}},this.updatePropertyHandler=async(a,c)=>{let u=a.params.targetProperty,l=a.params.targetValue,f=a.params.targetAsset;if(!this.vaultAdapter)return{success:!1,message:"VaultAdapter not initialized"};let h;if(f){let d=this.vaultAdapter.getAbstractFileByPath(f);if(d&&"basename"in d)h=d;else return{success:!1,message:`Target asset not found: ${f}`}}else h=c.currentAsset;if(!h)return{success:!1,message:"No target asset"};try{return await this.vaultAdapter.updateFrontmatter(h,d=>{let p={...d};return l==null?delete p[u]:p[u]=l,p}),{success:!0,refresh:!0}}catch(d){return{success:!1,message:`Failed to update property: ${d instanceof Error?d.message:String(d)}`}}},this.navigateHandler=async(a,c)=>{let u=a.params.target;if(!u)return{success:!1,message:"NavigateAction requires 'target' parameter"};let l;if(u.startsWith("SELECT")||u.startsWith("ASK")){let h=await this.tripleStore.match(void 0,void 0,void 0);if(h.length===0)return{success:!1,message:"No results found"};if(u.startsWith("ASK"))return c.currentAsset?(await c.uiProvider.navigate(c.currentAsset.path),{success:!0}):{success:!0,message:"Query returned true"};let d=h[0];l="value"in d.subject?d.subject.value:String(d.subject)}else l=u;let f=await this.resolveAssetUri(l);return f?(await c.uiProvider.navigate(f),{success:!0}):{success:!1,message:"Asset not found"}},this.executeSparqlHandler=async(a,c)=>{let u=a.params.query;if(!u)return{success:!1,message:"ExecuteSPARQLAction requires 'query' parameter"};try{let f=new QN.SPARQLParser().parse(u);if(f.type!=="query"||f.queryType!=="SELECT")return{success:!1,message:"ExecuteSPARQLAction only supports SELECT queries"};let d=new YN.AlgebraTranslator().translate(f);return{success:!0,data:(await new KN.QueryExecutor(this.tripleStore).executeAll(d)).map(T=>T.toJSON())}}catch(l){return{success:!1,message:`Failed to execute SPARQL query: ${l instanceof Error?l.message:String(l)}`}}},this.showModalHandler=async(a,c)=>{let u=a.params.modalType,l=a.params.modalParams,f=a.params.Action_cliAlternative;if(c.uiProvider.isHeadless)return{success:!1,message:new mw.HeadlessError("ShowModalAction",f||"Use appropriate CLI arguments").message};let h;try{h=l?JSON.parse(l):{}}catch(d){return{success:!1,message:`Invalid modalParams JSON: ${d instanceof Error?d.message:String(d)}`}}try{let d;if(u==="input")d=await c.uiProvider.showInputModal(h);else if(u==="select")d=await c.uiProvider.showSelectModal(h);else if(u==="confirm")d=await c.uiProvider.showConfirm(h.message||"");else return{success:!1,message:`Unknown modal type: ${u}`};return{success:!0,data:d}}catch(d){return{success:!1,message:`Modal failed: ${d instanceof Error?d.message:String(d)}`}}},this.triggerHookHandler=async(a,c)=>{let u=a.params.hookName,l=a.params.payload;if(!u)return{success:!1,message:"TriggerHookAction requires 'hookName' parameter"};if(!this.webhookService)return{success:!1,message:"WebhookService not initialized"};let f;if(typeof l=="string")try{f=JSON.parse(l)}catch{f={raw:l}}else l&&typeof l=="object"&&(f=l);try{return await this.webhookService.dispatchEvent({event:"property.changed",timestamp:new Date().toISOString(),filePath:c.currentAsset?.path??"",data:{hookName:u,payload:f}}),{success:!0}}catch(h){return{success:!1,message:`Failed to trigger hook: ${h instanceof Error?h.message:String(h)}`}}},this.customHandler=async(a,c)=>{let u=a.params.handler,l=this.customHandlers.get(u);return l?l(a,c):{success:!1,message:`Custom handler not found: ${u}`}},this.compositeHandler=async(a,c)=>({success:!1,message:"Not implemented: CompositeAction"}),this.registerBuiltinHandlers()}registerBuiltinHandlers(){this.handlers.set("exo-ui:CreateAssetAction",this.createAssetHandler),this.handlers.set("exo-ui:UpdatePropertyAction",this.updatePropertyHandler),this.handlers.set("exo-ui:NavigateAction",this.navigateHandler),this.handlers.set("exo-ui:ExecuteSPARQLAction",this.executeSparqlHandler),this.handlers.set("exo-ui:ShowModalAction",this.showModalHandler),this.handlers.set("exo-ui:TriggerHookAction",this.triggerHookHandler),this.handlers.set("exo-ui:CustomHandlerAction",this.customHandler),this.handlers.set("exo-ui:CompositeAction",this.compositeHandler)}registerCustomHandler(e,t){this.customHandlers.set(e,t)}hasHandler(e){return this.handlers.has(e)||this.customHandlers.has(e)}async execute(e,t){let r;try{r=await this.loadActionDefinition(e)}catch(s){return{success:!1,message:`Failed to load action definition: ${s instanceof Error?s.message:String(s)}`}}let i=this.handlers.get(r.type)||this.customHandlers.get(r.type);return i?i(r,t):{success:!1,message:`Unknown action type: ${r.type}`}}async loadActionDefinition(e){let t=new zN.IRI(e),r=await this.tripleStore.match(t,void 0,void 0),i,s={};for(let a of r){let c="value"in a.predicate?a.predicate.value:String(a.predicate);if(c===XN){let u="value"in a.object?a.object.value:String(a.object);u.startsWith(nh)&&(i="exo-ui:"+u.substring(nh.length))}else if(c.startsWith(nh)){let u=c.substring(nh.length),l="value"in a.object?a.object.value:String(a.object);s[u]=l}}if(!i)throw new Error(`Action type not found for: ${e}`);return{type:i,params:s}}async resolveAssetUri(e){if(!this.fileSystem)return null;let t=e.split("/").pop();return t?this.fileSystem.findFileByUID(t):null}};ih.ActionInterpreter=g0});var yw=v(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.container=void 0;as.registerCoreServices=E4;as.createChildContainer=T4;as.getContainer=A4;as.resetContainer=x4;Qu();var jc=Le();Object.defineProperty(as,"container",{enumerable:!0,get:o(function(){return jc.container},"get")});var ht=ct(),JN=Dm(),ZN=Bl(),e4=cg(),t4=ql(),r4=eg(),n4=Fm(),i4=$m(),s4=Mm(),a4=Ql(),o4=Yl(),c4=Ym(),u4=Xm(),l4=rg(),f4=zm(),h4=lg(),d4=pg(),p4=hg(),m4=qm(),g4=Wm(),y4=ag(),v4=ig(),S4=ty(),_4=Um(),w4=gg(),b4=Sg();function E4(n){let e=n||jc.container;e.registerSingleton(ht.DI_TOKENS.TaskFrontmatterGenerator,ZN.TaskFrontmatterGenerator),e.registerSingleton(ht.DI_TOKENS.DynamicFrontmatterGenerator,e4.DynamicFrontmatterGenerator),e.registerSingleton(ht.DI_TOKENS.AlgorithmExtractor,t4.AlgorithmExtractor),e.registerSingleton(ht.DI_TOKENS.EffortStatusWorkflow,a4.EffortStatusWorkflow),e.registerSingleton(ht.DI_TOKENS.StatusTimestampService,o4.StatusTimestampService),e.registerSingleton(ht.DI_TOKENS.TaskStatusService,s4.TaskStatusService),e.registerSingleton(ht.DI_TOKENS.TaskCreationService,JN.TaskCreationService),e.registerSingleton(ht.DI_TOKENS.ProjectCreationService,n4.ProjectCreationService),e.registerSingleton(ht.DI_TOKENS.AreaCreationService,i4.AreaCreationService),e.registerSingleton(ht.DI_TOKENS.ClassCreationService,m4.ClassCreationService),e.registerSingleton(ht.DI_TOKENS.ConceptCreationService,g4.ConceptCreationService),e.registerSingleton(ht.DI_TOKENS.FleetingNoteCreationService,y4.FleetingNoteCreationService),e.registerSingleton(ht.DI_TOKENS.SupervisionCreationService,v4.SupervisionCreationService),e.registerSingleton(ht.DI_TOKENS.GenericAssetCreationService,b4.GenericAssetCreationService),e.registerSingleton(ht.DI_TOKENS.PropertyCleanupService,r4.PropertyCleanupService),e.registerSingleton(ht.DI_TOKENS.FolderRepairService,c4.FolderRepairService),e.registerSingleton(ht.DI_TOKENS.LabelToAliasService,u4.LabelToAliasService),e.registerSingleton(ht.DI_TOKENS.RenameToUidService,l4.RenameToUidService),e.registerSingleton(ht.DI_TOKENS.PlanningService,h4.PlanningService),e.registerSingleton(ht.DI_TOKENS.EffortVotingService,f4.EffortVotingService),e.registerSingleton(ht.DI_TOKENS.SessionEventService,d4.SessionEventService),e.registerSingleton(ht.DI_TOKENS.AssetConversionService,p4.AssetConversionService),e.registerSingleton(ht.DI_TOKENS.NoteToRDFConverter,S4.NoteToRDFConverter),e.registerSingleton(ht.DI_TOKENS.AreaHierarchyBuilder,_4.AreaHierarchyBuilder),e.registerSingleton(ht.DI_TOKENS.URIConstructionService,w4.URIConstructionService)}o(E4,"registerCoreServices");function T4(){return jc.container.createChildContainer()}o(T4,"createChildContainer");function A4(){return jc.container}o(A4,"getContainer");function x4(){jc.container.reset()}o(x4,"resetContainer")});var y0=v(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.DEFAULT_COLORS=mo.NODE_FLAGS=void 0;mo.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};mo.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var S0=v(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.StringTable=void 0;var v0=class n{static{o(this,"StringTable")}constructor(e){if(this.stringToIndex=new Map,this.strings=[],this.memoryBytes=0,e)for(let t of e)this.intern(t)}intern(e){let t=this.stringToIndex.get(e);if(t!==void 0)return t;let r=this.strings.length;return this.strings.push(e),this.stringToIndex.set(e,r),this.memoryBytes+=e.length*2+50,r}getIndex(e){return this.stringToIndex.get(e)??-1}getString(e){if(e<0||e>=this.strings.length)throw new RangeError(`StringTable index out of bounds: ${e}`);return this.strings[e]}has(e){return this.stringToIndex.has(e)}hasIndex(e){return e>=0&&e<this.strings.length}get size(){return this.strings.length}getMemoryBytes(){return this.memoryBytes}*entries(){for(let e=0;e<this.strings.length;e++)yield[e,this.strings[e]]}*values(){for(let e of this.strings)yield e}toArray(){return[...this.strings]}clear(){this.stringToIndex.clear(),this.strings=[],this.memoryBytes=0}static fromJSON(e){return new n(e)}toJSON(){return this.strings}internAll(e){return e.map(t=>this.intern(t))}getStrings(e){return e.map(t=>this.getString(t))}search(e){let t=typeof e=="string"?new RegExp(e):e,r=[];for(let i=0;i<this.strings.length;i++)t.test(this.strings[i])&&r.push([i,this.strings[i]]);return r}getStats(){let e=this.strings.reduce((t,r)=>t+r.length,0);return{count:this.strings.length,memoryBytes:this.memoryBytes,avgStringLength:this.strings.length>0?e/this.strings.length:0}}};sh.StringTable=v0});var vw=v(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.CompactGraphStore=void 0;var ah=S0(),kr=y0(),C4={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function _0(n,e){if(n===void 0)return e;if(typeof n=="number")return n;if(n.startsWith("#")){let t=n.slice(1);if(t.length===6)return parseInt(t,16)<<8|255;if(t.length===8)return parseInt(t,16)}return e}o(_0,"parseColor");var w0=class{static{o(this,"CompactGraphStore")}constructor(e){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex=new Map,this.indexToNodeId=[],this.edgeIdToIndex=new Map,this.config={...C4,...e},this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity),this.uriTable=new ah.StringTable,this.labelTable=new ah.StringTable,this.typeTable=new ah.StringTable,this.predicateTable=new ah.StringTable}allocateNodeArrays(e){return{positions:new Float32Array(e*2),radii:new Float32Array(e),colors:new Uint32Array(e),types:new Uint16Array(e),flags:new Uint8Array(e)}}allocateEdgeArrays(e){return{sourceIndices:new Uint32Array(e),targetIndices:new Uint32Array(e),predicateIndices:new Uint16Array(e),widths:new Float32Array(e),colors:new Uint32Array(e)}}resizeNodeArrays(e){if(e<=this.nodeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateNodeArrays(e);t.positions.set(this.nodes.positions.subarray(0,this.nodeCount*2)),t.radii.set(this.nodes.radii.subarray(0,this.nodeCount)),t.colors.set(this.nodes.colors.subarray(0,this.nodeCount)),t.types.set(this.nodes.types.subarray(0,this.nodeCount)),t.flags.set(this.nodes.flags.subarray(0,this.nodeCount)),this.nodes=t,this.nodeCapacity=e}resizeEdgeArrays(e){if(e<=this.edgeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateEdgeArrays(e);t.sourceIndices.set(this.edges.sourceIndices.subarray(0,this.edgeCount)),t.targetIndices.set(this.edges.targetIndices.subarray(0,this.edgeCount)),t.predicateIndices.set(this.edges.predicateIndices.subarray(0,this.edgeCount)),t.widths.set(this.edges.widths.subarray(0,this.edgeCount)),t.colors.set(this.edges.colors.subarray(0,this.edgeCount)),this.edges=t,this.edgeCapacity=e}ensureNodeCapacity(e){let t=this.nodeCount+e;if(t>this.nodeCapacity){let r=Math.max(t,Math.floor(this.nodeCapacity*this.config.growthFactor));this.resizeNodeArrays(r)}}ensureEdgeCapacity(e){let t=this.edgeCount+e;if(t>this.edgeCapacity){let r=Math.max(t,Math.floor(this.edgeCapacity*this.config.growthFactor));this.resizeEdgeArrays(r)}}addNode(e){let t=this.nodeIdToIndex.get(e.id);if(t!==void 0)return this.updateNodeAt(t,e),t;this.ensureNodeCapacity(1);let r=this.nodeCount++,i=r*2;this.nodes.positions[i]=e.x??Math.random()*1e3-500,this.nodes.positions[i+1]=e.y??Math.random()*1e3-500,this.nodes.radii[r]=e.radius??8,this.nodes.colors[r]=_0(e.color,kr.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=kr.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=kr.NODE_FLAGS.PINNED),e.isArchived&&(s|=kr.NODE_FLAGS.ARCHIVED),this.nodes.flags[r]=s,this.nodeIdToIndex.set(e.id,r),this.indexToNodeId[r]=e.id,this.uriTable.intern(e.id),e.label&&this.labelTable.intern(e.label),r}updateNodeAt(e,t){let r=e*2;t.x!==void 0&&(this.nodes.positions[r]=t.x),t.y!==void 0&&(this.nodes.positions[r+1]=t.y),t.radius!==void 0&&(this.nodes.radii[e]=t.radius),t.color!==void 0&&(this.nodes.colors[e]=_0(t.color,kr.DEFAULT_COLORS.NODE)),t.assetClass!==void 0&&(this.nodes.types[e]=this.typeTable.intern(t.assetClass));let i=this.nodes.flags[e];t.isPinned!==void 0&&(i=t.isPinned?i|kr.NODE_FLAGS.PINNED:i&~kr.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|kr.NODE_FLAGS.ARCHIVED:i&~kr.NODE_FLAGS.ARCHIVED),this.nodes.flags[e]=i}addEdge(e){let t=this.nodeIdToIndex.get(e.sourceId),r=this.nodeIdToIndex.get(e.targetId);if(t===void 0||r===void 0)return-1;let i=`${e.sourceId}->${e.targetId}:${e.predicate??"link"}`,s=this.edgeIdToIndex.get(i);if(s!==void 0)return s;this.ensureEdgeCapacity(1);let a=this.edgeCount++;return this.edges.sourceIndices[a]=t,this.edges.targetIndices[a]=r,this.edges.widths[a]=e.width??1,this.edges.colors[a]=_0(e.color,kr.DEFAULT_COLORS.EDGE),e.predicate?this.edges.predicateIndices[a]=this.predicateTable.intern(e.predicate):this.edges.predicateIndices[a]=0,this.edgeIdToIndex.set(i,a),a}addNodes(e){return this.ensureNodeCapacity(e.length),e.map(t=>this.addNode(t))}addEdges(e){return this.ensureEdgeCapacity(e.length),e.map(t=>this.addEdge(t))}loadChunk(e){let r=this.addNodes(e.nodes).filter(a=>a>=0).length,s=this.addEdges(e.edges).filter(a=>a>=0).length;return{nodesAdded:r,edgesAdded:s}}getNodePosition(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return null;let r=t*2;return{x:this.nodes.positions[r],y:this.nodes.positions[r+1]}}getNodePositionByIndex(e){let t=e*2;return{x:this.nodes.positions[t],y:this.nodes.positions[t+1]}}setNodePosition(e,t,r){let i=this.nodeIdToIndex.get(e);if(i===void 0)return!1;let s=i*2;return this.nodes.positions[s]=t,this.nodes.positions[s+1]=r,!0}setNodePositionByIndex(e,t,r){let i=e*2;this.nodes.positions[i]=t,this.nodes.positions[i+1]=r}updateNodePositions(e){let t=0;for(let[r,i]of e)this.setNodePosition(r,i.x,i.y)&&t++;return t}applyNodeUpdates(e){let t=performance.now(),r=0;for(let i of e){let s=i.index;if(!(s<0||s>=this.nodeCount)){if(i.x!==void 0||i.y!==void 0){let a=s*2;i.x!==void 0&&(this.nodes.positions[a]=i.x),i.y!==void 0&&(this.nodes.positions[a+1]=i.y)}i.radius!==void 0&&(this.nodes.radii[s]=i.radius),i.color!==void 0&&(this.nodes.colors[s]=i.color),i.setFlags!==void 0&&(this.nodes.flags[s]|=i.setFlags),i.clearFlags!==void 0&&(this.nodes.flags[s]&=~i.clearFlags),r++}}return{nodesUpdated:r,edgesUpdated:0,timeMs:performance.now()-t}}getNodeFlags(e){let t=this.nodeIdToIndex.get(e);return t===void 0?0:this.nodes.flags[t]}setNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]|=t,!0)}clearNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]&=~t,!0)}hasNodeFlag(e,t){return(this.getNodeFlags(e)&t)!==0}selectNode(e){return this.setNodeFlag(e,kr.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,kr.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~kr.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&kr.NODE_FLAGS.SELECTED&&e.push(this.indexToNodeId[t]);return e}getNodeId(e){return this.indexToNodeId[e]}getNodeIndex(e){return this.nodeIdToIndex.get(e)}hasNode(e){return this.nodeIdToIndex.has(e)}getNodeCount(){return this.nodeCount}getEdgeCount(){return this.edgeCount}getNodeEdges(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=[];for(let i=0;i<this.edgeCount;i++)this.edges.sourceIndices[i]===t?r.push({edgeIndex:i,isSource:!0}):this.edges.targetIndices[i]===t&&r.push({edgeIndex:i,isSource:!1});return r}getNeighbors(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=new Set;for(let i=0;i<this.edgeCount;i++)if(this.edges.sourceIndices[i]===t){let s=this.edges.targetIndices[i];r.add(this.indexToNodeId[s])}else if(this.edges.targetIndices[i]===t){let s=this.edges.sourceIndices[i];r.add(this.indexToNodeId[s])}return Array.from(r)}getRawArrays(){return{nodes:this.nodes,edges:this.edges,nodeCount:this.nodeCount,edgeCount:this.edgeCount}}getPositionsArray(){return this.nodes.positions.subarray(0,this.nodeCount*2)}getMemoryStats(){let e=this.nodeCapacity*2*4+this.nodeCapacity*4+this.nodeCapacity*4+this.nodeCapacity*2+this.nodeCapacity,t=this.edgeCapacity*4+this.edgeCapacity*4+this.edgeCapacity*2+this.edgeCapacity*4+this.edgeCapacity*4,r=this.uriTable.getMemoryBytes()+this.labelTable.getMemoryBytes()+this.typeTable.getMemoryBytes()+this.predicateTable.getMemoryBytes();return{nodeCount:this.nodeCount,edgeCount:this.edgeCount,nodeCapacity:this.nodeCapacity,edgeCapacity:this.edgeCapacity,nodeMemoryBytes:e,edgeMemoryBytes:t,stringTableBytes:r,totalBytes:e+t+r,internedStringCount:this.uriTable.size+this.labelTable.size+this.typeTable.size+this.predicateTable.size}}clear(){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex.clear(),this.indexToNodeId=[],this.edgeIdToIndex.clear(),this.uriTable.clear(),this.labelTable.clear(),this.typeTable.clear(),this.predicateTable.clear(),this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity)}getTypeTable(){return this.typeTable}getLabelTable(){return this.labelTable}getUriTable(){return this.uriTable}getPredicateTable(){return this.predicateTable}};oh.CompactGraphStore=w0});var Sw=v(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.MemoryPool=void 0;yo.getGlobalPool=O4;yo.resetGlobalPool=P4;var I4={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},ch=class{static{o(this,"MemoryPool")}constructor(e){this.float32Pool=new Map,this.uint32Pool=new Map,this.uint16Pool=new Map,this.uint8Pool=new Map,this.stats={poolHits:0,poolMisses:0,pooledArrays:0,pooledMemory:0,returned:0,rejected:0},this.config={...I4,...e};for(let t of this.config.sizeBuckets)this.float32Pool.set(t,[]),this.uint32Pool.set(t,[]),this.uint16Pool.set(t,[]),this.uint8Pool.set(t,[])}getBucketSize(e){for(let t of this.config.sizeBuckets)if(t>=e)return t;return e}getFloat32(e){let t=this.getBucketSize(e),r=this.float32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Float32Array(t)}getUint32(e){let t=this.getBucketSize(e),r=this.uint32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint32Array(t)}getUint16(e){let t=this.getBucketSize(e),r=this.uint16Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*2;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint16Array(t)}getUint8(e){let t=this.getBucketSize(e),r=this.uint8Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint8Array(t)}releaseFloat32(e){this.releaseToPool(this.float32Pool,e,4)}releaseUint32(e){this.releaseToPool(this.uint32Pool,e,4)}releaseUint16(e){this.releaseToPool(this.uint16Pool,e,2)}releaseUint8(e){this.releaseToPool(this.uint8Pool,e,1)}releaseToPool(e,t,r){let i=t.length,s=e.get(i);if(s&&s.length<this.config.maxPooledArrays){if(this.config.autoCleanup&&this.stats.pooledMemory+i*r>this.config.maxPoolMemory){this.stats.rejected++;return}s.push(t),this.stats.returned++,this.stats.pooledArrays++,this.stats.pooledMemory+=i*r}else this.stats.rejected++}getStats(){return{...this.stats}}getHitRatio(){let e=this.stats.poolHits+this.stats.poolMisses;return e>0?this.stats.poolHits/e:0}clear(){for(let e of this.float32Pool.values())e.length=0;for(let e of this.uint32Pool.values())e.length=0;for(let e of this.uint16Pool.values())e.length=0;for(let e of this.uint8Pool.values())e.length=0;this.stats.pooledArrays=0,this.stats.pooledMemory=0}cleanup(e){if(this.stats.pooledMemory<=e)return;let t=[...this.config.sizeBuckets].sort((r,i)=>i-r);for(let r of t){if(this.stats.pooledMemory<=e)break;for(let[i,s]of[[this.float32Pool,4],[this.uint32Pool,4],[this.uint16Pool,2],[this.uint8Pool,1]]){let a=i.get(r);if(a)for(;a.length>0&&this.stats.pooledMemory>e;)a.pop(),this.stats.pooledArrays--,this.stats.pooledMemory-=r*s}}}resetStats(){this.stats.poolHits=0,this.stats.poolMisses=0,this.stats.returned=0,this.stats.rejected=0}};yo.MemoryPool=ch;var go=null;function O4(){return go||(go=new ch),go}o(O4,"getGlobalPool");function P4(){go&&go.clear(),go=null}o(P4,"resetGlobalPool")});var _w=v($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.StreamingLoader=void 0;$c.createStreamingSource=R4;var D4={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},b0=class{static{o(this,"StreamingLoader")}constructor(e,t){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.progressCallbacks=[],this.abortController=null,this.store=e,this.config={...D4,...t}}getState(){return this.state}getProgress(){let e=this.totalChunks!==void 0&&this.totalChunks>0?this.chunksProcessed/this.totalChunks:0;return{currentChunk:this.chunksProcessed,totalChunks:this.totalChunks,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,progress:e,isComplete:this.state==="completed"}}onProgress(e){return this.progressCallbacks.push(e),()=>{let t=this.progressCallbacks.indexOf(e);t>=0&&this.progressCallbacks.splice(t,1)}}notifyProgress(){let e=this.getProgress();for(let t of this.progressCallbacks)t(e)}loadChunk(e){if(this.state==="error")throw new Error("Loader is in error state");this.state="loading",e.totalChunks!==void 0&&(this.totalChunks=e.totalChunks);for(let t of e.nodes)this.store.addNode(t),this.nodesLoaded++;for(let t of e.edges)this.store.addEdge(t)>=0?this.edgesLoaded++:this.pendingEdges.push(t);this.chunksProcessed++,e.isLast&&this.finishLoading(),this.notifyProgress()}finishLoading(){if(this.config.autoResolveEdges&&this.pendingEdges.length>0){for(let e of this.pendingEdges)this.store.addEdge(e)>=0&&this.edgesLoaded++;this.pendingEdges=[]}this.state="completed",this.notifyProgress()}async loadFromIterator(e){this.reset(),this.state="loading",this.abortController=new AbortController;try{for await(let r of e){if(this.abortController.signal.aborted){this.state="paused";return}this.loadChunk(r),this.config.chunkDelay>0&&await this.delay(this.config.chunkDelay)}this.state!=="completed"&&this.finishLoading()}catch(t){throw this.state="error",t}finally{this.abortController=null}}async loadFromArrays(e,t){let r=this.createChunks(e,t);await this.loadFromIterator(this.arrayToAsyncIterator(r))}createChunks(e,t){let r=[],{chunkSize:i}=this.config,s=Math.ceil(e.length/i),a=Array(s).fill(null).map(()=>[]);for(let c of t){let u=e.findIndex(l=>l.id===c.sourceId);if(u>=0){let l=Math.floor(u/i);a[l].push(c)}}for(let c=0;c<s;c++){let u=c*i,l=Math.min(u+i,e.length);r.push({chunkIndex:c,totalChunks:s,nodes:e.slice(u,l),edges:a[c],isLast:c===s-1})}return r}async*arrayToAsyncIterator(e){for(let t of e)yield t}delay(e){return new Promise(t=>setTimeout(t,e))}cancel(){this.abortController&&this.abortController.abort(),this.state="paused"}reset(){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.totalChunks=void 0,this.abortController=null}getPendingEdgeCount(){return this.pendingEdges.length}getStats(){return{state:this.state,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,chunksProcessed:this.chunksProcessed,totalChunks:this.totalChunks,pendingEdges:this.pendingEdges.length,storeStats:this.store.getMemoryStats()}}};$c.StreamingLoader=b0;async function*R4(n,e,t=1e3){let r=0,i=0,s;for(;;){let a=await e(n,r,t);if(a.totalCount!==void 0&&s===void 0&&(s=Math.ceil(a.totalCount/t)),yield{chunkIndex:i,totalChunks:s,nodes:a.nodes,edges:a.edges,isLast:!a.hasMore},!a.hasMore)break;r+=t,i++}}o(R4,"createStreamingSource")});var Ew=v(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.createStreamingSource=xt.StreamingLoader=xt.resetGlobalPool=xt.getGlobalPool=xt.MemoryPool=xt.CompactGraphStore=xt.StringTable=xt.DEFAULT_COLORS=xt.NODE_FLAGS=void 0;var ww=y0();Object.defineProperty(xt,"NODE_FLAGS",{enumerable:!0,get:o(function(){return ww.NODE_FLAGS},"get")});Object.defineProperty(xt,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return ww.DEFAULT_COLORS},"get")});var F4=S0();Object.defineProperty(xt,"StringTable",{enumerable:!0,get:o(function(){return F4.StringTable},"get")});var N4=vw();Object.defineProperty(xt,"CompactGraphStore",{enumerable:!0,get:o(function(){return N4.CompactGraphStore},"get")});var E0=Sw();Object.defineProperty(xt,"MemoryPool",{enumerable:!0,get:o(function(){return E0.MemoryPool},"get")});Object.defineProperty(xt,"getGlobalPool",{enumerable:!0,get:o(function(){return E0.getGlobalPool},"get")});Object.defineProperty(xt,"resetGlobalPool",{enumerable:!0,get:o(function(){return E0.resetGlobalPool},"get")});var bw=_w();Object.defineProperty(xt,"StreamingLoader",{enumerable:!0,get:o(function(){return bw.StreamingLoader},"get")});Object.defineProperty(xt,"createStreamingSource",{enumerable:!0,get:o(function(){return bw.createStreamingSource},"get")})});var ai=v(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.ErrorCode=void 0;var Tw;(function(n){n[n.INVALID_INPUT=1e3]="INVALID_INPUT",n[n.INVALID_FORMAT=1001]="INVALID_FORMAT",n[n.MISSING_REQUIRED_FIELD=1002]="MISSING_REQUIRED_FIELD",n[n.INVALID_SCHEMA=1003]="INVALID_SCHEMA",n[n.NETWORK_ERROR=2e3]="NETWORK_ERROR",n[n.REQUEST_TIMEOUT=2001]="REQUEST_TIMEOUT",n[n.CONNECTION_FAILED=2002]="CONNECTION_FAILED",n[n.FILE_READ_ERROR=2003]="FILE_READ_ERROR",n[n.FILE_WRITE_ERROR=2004]="FILE_WRITE_ERROR",n[n.INVALID_STATE=3e3]="INVALID_STATE",n[n.INVALID_TRANSITION=3001]="INVALID_TRANSITION",n[n.OPERATION_FAILED=3002]="OPERATION_FAILED",n[n.CONCURRENT_MODIFICATION=3003]="CONCURRENT_MODIFICATION",n[n.PERMISSION_DENIED=4e3]="PERMISSION_DENIED",n[n.UNAUTHORIZED=4001]="UNAUTHORIZED",n[n.FORBIDDEN=4003]="FORBIDDEN",n[n.NOT_FOUND=5e3]="NOT_FOUND",n[n.RESOURCE_EXHAUSTED=5001]="RESOURCE_EXHAUSTED",n[n.ALREADY_EXISTS=5002]="ALREADY_EXISTS",n[n.UNKNOWN_ERROR=9e3]="UNKNOWN_ERROR",n[n.INTERNAL_ERROR=9001]="INTERNAL_ERROR"})(Tw||(uh.ErrorCode=Tw={}))});var oi=v(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.ApplicationError=void 0;var T0=class extends Error{static{o(this,"ApplicationError")}constructor(e,t){super(e),this.name=this.constructor.name,this.context=t,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
|
|
315
315
|
|
|
316
316
|
\u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
|
|
317
317
|
|
|
@@ -446,7 +446,7 @@ globstar while`,e,d,t,p,S),this.matchOne(e.slice(d),t.slice(p),r))return this.de
|
|
|
446
446
|
${t}
|
|
447
447
|
Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes")})})}};var dd=class{static{o(this,"CLIContainer")}static setup(){Go.container.register(Tu.DI_TOKENS.ILogger,{useFactory:o(()=>new cd("exocortex-cli"),"useFactory")}),Go.container.register(Tu.DI_TOKENS.IEventBus,{useClass:ud}),Go.container.register(Tu.DI_TOKENS.IConfiguration,{useClass:ld}),Go.container.register(Tu.DI_TOKENS.INotificationService,{useClass:hd})}static reset(){Go.container.clearInstances()}};function Au(n){dd.setup(),va.container.register(ws.DI_TOKENS.IVaultAdapter,{useFactory:o(()=>new ds(n),"useFactory")})}o(Au,"setupContainer");function uj(n){if(n.length===0)return"No practices found.";let e=[];for(let t of n){let r="\u2B1C";t.doneToday?r="\u2705":t.inProgressToday&&(r="\u{1F504}");let i=t.estimatedDuration?` (${t.estimatedDuration}m)`:"";e.push(`${r} ${t.label}${i}`)}return e.join(`
|
|
448
448
|
`)}o(uj,"formatPractices");function lj(n){let e=[`\u{1F4C5} Daily Review: ${n.date}`,"","\u{1F4CA} Tasks:",` Planned: ${n.plannedCount}`,` Completed: ${n.completedCount}`,` In Progress: ${n.inProgressCount}`,` Progress: ${n.completionPercentage}%`,"",`\u23F1\uFE0F Total time: ${Math.round(n.totalTimeMinutes)} minutes`];if(n.practicesDue.length>0){e.push(""),e.push(`\u{1F4CB} Practices due (${n.practicesDue.length}):`);for(let t of n.practicesDue){let r=t.estimatedDuration?` (${t.estimatedDuration}m)`:"";e.push(` \u2B1C ${t.label}${r}`)}}return e.join(`
|
|
449
|
-
`)}o(lj,"formatSummary");function yA(){let n=new Lt("daily").description("Daily review operations for mobile-friendly workflow");return n.command("practices").description("List today's practices (recurring tasks)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async e=>{let t=e.format||"text";K.setFormat(t);try{let r=(0,Wo.resolve)(e.vault);if(!(0,Ho.existsSync)(r))throw new Xt(r);Au(r);let s=await va.container.resolve(ws.DailyReviewService).getPractices();if(t==="json"){let a=Ye.success({practices:s,count:s.length});console.log(JSON.stringify(a,null,2))}else console.log(uj(s))}catch(r){K.handle(r)}}),n.command("summary").description("Show today's daily review summary").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").option("--date <value>","Date in YYYY-MM-DD format (default: today)").action(async e=>{let t=e.format||"text";K.setFormat(t);try{let r=(0,Wo.resolve)(e.vault);if(!(0,Ho.existsSync)(r))throw new Xt(r);Au(r);let i=va.container.resolve(ws.DailyReviewService),s;if(e.date&&(s=new Date(e.date),isNaN(s.getTime())))throw new rt(`Invalid date format: ${e.date}`,"exocortex daily summary --date YYYY-MM-DD",{date:e.date});let a=await i.getDailyReviewSummary(s);if(t==="json"){let c=Ye.success(a);console.log(JSON.stringify(c,null,2))}else console.log(lj(a))}catch(r){K.handle(r)}}),n.command("log").description("Quick capture an activity").argument("<label>","Activity label/description").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").option("--start","Start the task immediately (default: true)").option("--no-start","Don't start the task immediately").action(async(e,t)=>{let r=t.format||"text";K.setFormat(r);try{let i=(0,Wo.resolve)(t.vault);if(!(0,Ho.existsSync)(i))throw new Xt(i);Au(i);let s=va.container.resolve(ws.DailyReviewService),a=t.start!==!1,c=await s.quickCapture(e,a);if(r==="json"){let u=Ye.success(c);console.log(JSON.stringify(u,null,2))}else{let u=c.started?"\u{1F504}":"\u2B1C";console.log(`${u} Created: ${c.label}`),console.log(` Path: ${c.path}`)}}catch(i){K.handle(i)}}),n.command("start").description("Start a practice (create task instance from prototype)").argument("<prototype-uid>","Practice/prototype UID to start").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async(e,t)=>{let r=t.format||"text";K.setFormat(r);try{let i=(0,Wo.resolve)(t.vault);if(!(0,Ho.existsSync)(i))throw new Xt(i);Au(i);let a=await va.container.resolve(ws.DailyReviewService).createFromPractice({prototypeUid:e,startImmediately:!0});if(r==="json"){let c=Ye.success(a);console.log(JSON.stringify(c,null,2))}else console.log(`\u{1F504} Started: ${a.label}`),console.log(` Path: ${a.path}`)}catch(i){K.handle(i)}}),n.command("done").description("Mark a practice as done").argument("<prototype-uid>","Practice/prototype UID to mark as done").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async(e,t)=>{let r=t.format||"text";K.setFormat(r);try{let i=(0,Wo.resolve)(t.vault);if(!(0,Ho.existsSync)(i))throw new Xt(i);if(Au(i),await va.container.resolve(ws.DailyReviewService).markPracticeDone(e),r==="json"){let a=Ye.success({prototypeUid:e,status:"done"});console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 Marked as done: ${e}`)}catch(i){K.handle(i)}}),n}o(yA,"dailyReviewCommand");var gi=new Lt;gi.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.
|
|
449
|
+
`)}o(lj,"formatSummary");function yA(){let n=new Lt("daily").description("Daily review operations for mobile-friendly workflow");return n.command("practices").description("List today's practices (recurring tasks)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async e=>{let t=e.format||"text";K.setFormat(t);try{let r=(0,Wo.resolve)(e.vault);if(!(0,Ho.existsSync)(r))throw new Xt(r);Au(r);let s=await va.container.resolve(ws.DailyReviewService).getPractices();if(t==="json"){let a=Ye.success({practices:s,count:s.length});console.log(JSON.stringify(a,null,2))}else console.log(uj(s))}catch(r){K.handle(r)}}),n.command("summary").description("Show today's daily review summary").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").option("--date <value>","Date in YYYY-MM-DD format (default: today)").action(async e=>{let t=e.format||"text";K.setFormat(t);try{let r=(0,Wo.resolve)(e.vault);if(!(0,Ho.existsSync)(r))throw new Xt(r);Au(r);let i=va.container.resolve(ws.DailyReviewService),s;if(e.date&&(s=new Date(e.date),isNaN(s.getTime())))throw new rt(`Invalid date format: ${e.date}`,"exocortex daily summary --date YYYY-MM-DD",{date:e.date});let a=await i.getDailyReviewSummary(s);if(t==="json"){let c=Ye.success(a);console.log(JSON.stringify(c,null,2))}else console.log(lj(a))}catch(r){K.handle(r)}}),n.command("log").description("Quick capture an activity").argument("<label>","Activity label/description").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").option("--start","Start the task immediately (default: true)").option("--no-start","Don't start the task immediately").action(async(e,t)=>{let r=t.format||"text";K.setFormat(r);try{let i=(0,Wo.resolve)(t.vault);if(!(0,Ho.existsSync)(i))throw new Xt(i);Au(i);let s=va.container.resolve(ws.DailyReviewService),a=t.start!==!1,c=await s.quickCapture(e,a);if(r==="json"){let u=Ye.success(c);console.log(JSON.stringify(u,null,2))}else{let u=c.started?"\u{1F504}":"\u2B1C";console.log(`${u} Created: ${c.label}`),console.log(` Path: ${c.path}`)}}catch(i){K.handle(i)}}),n.command("start").description("Start a practice (create task instance from prototype)").argument("<prototype-uid>","Practice/prototype UID to start").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async(e,t)=>{let r=t.format||"text";K.setFormat(r);try{let i=(0,Wo.resolve)(t.vault);if(!(0,Ho.existsSync)(i))throw new Xt(i);Au(i);let a=await va.container.resolve(ws.DailyReviewService).createFromPractice({prototypeUid:e,startImmediately:!0});if(r==="json"){let c=Ye.success(a);console.log(JSON.stringify(c,null,2))}else console.log(`\u{1F504} Started: ${a.label}`),console.log(` Path: ${a.path}`)}catch(i){K.handle(i)}}),n.command("done").description("Mark a practice as done").argument("<prototype-uid>","Practice/prototype UID to mark as done").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: text|json","text").action(async(e,t)=>{let r=t.format||"text";K.setFormat(r);try{let i=(0,Wo.resolve)(t.vault);if(!(0,Ho.existsSync)(i))throw new Xt(i);if(Au(i),await va.container.resolve(ws.DailyReviewService).markPracticeDone(e),r==="json"){let a=Ye.success({prototypeUid:e,status:"done"});console.log(JSON.stringify(a,null,2))}else console.log(`\u2705 Marked as done: ${e}`)}catch(i){K.handle(i)}}),n}o(yA,"dailyReviewCommand");var gi=new Lt;gi.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.279.0");gi.command("sparql").description("SPARQL query execution").addCommand(Q3());gi.addCommand(tA());gi.addCommand(iA());gi.addCommand(sA());gi.addCommand(oA());gi.addCommand(cA());gi.addCommand(dA());gi.addCommand(yA());gi.parse();
|
|
450
450
|
/*! Bundled license information:
|
|
451
451
|
|
|
452
452
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED