mcard-studio 0.0.2 → 0.0.3
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/README.md +3 -0
- package/astro.config.mjs +41 -2
- package/cli/lib/runtimeContext.mjs +6 -3
- package/dist/client/_astro/{ChartAnalyticsViewlet.jrwIemvb.js → ChartAnalyticsViewlet.CBW-JyA3.js} +1 -1
- package/dist/client/_astro/{ClmPcardViewlet.C-fU7oZf.js → ClmPcardViewlet.cvKsR2ng.js} +2 -2
- package/dist/client/_astro/{D3GraphViewlet.BCZl0b2U.js → D3GraphViewlet.8YEIrCGL.js} +1 -1
- package/dist/client/_astro/DockviewSpatialWorkbench.BTd66LPl.js +12 -0
- package/dist/client/_astro/DocumentViewlets.KY1HcNka.js +2 -0
- package/dist/client/_astro/DxfViewlet.B3N5zpZR.js +1 -0
- package/dist/client/_astro/{ExcalidrawWhiteboardViewlet.CFpPYSdn.js → ExcalidrawWhiteboardViewlet.CMJGCQN4.js} +1 -1
- package/dist/client/_astro/{FaroVCardSpanInstrumenter.un8kDMWv.js → FaroVCardSpanInstrumenter.ClIqZujq.js} +1 -1
- package/dist/client/_astro/{FontSpecimenViewlet.D7Aw2xBZ.js → FontSpecimenViewlet.ChIyr0B8.js} +1 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.D3FSc061.js +1 -0
- package/dist/client/_astro/{ImageViewlet.D4FN87n_.js → ImageViewlet.Cs-u7-wt.js} +1 -1
- package/dist/client/_astro/{KatexFormulaViewlet.CzhdIOw8.js → KatexFormulaViewlet.0nOzV_qD.js} +1 -1
- package/dist/client/_astro/{KoishiChatViewlet.5mepQvLX.js → KoishiChatViewlet.DLsMmwdb.js} +4 -4
- package/dist/client/_astro/{MCardLibraryHarness.DE8KeghO.js → MCardLibraryHarness.WBT9W10S.js} +1 -1
- package/dist/client/_astro/{MarkdownViewlet.CRuuXXmF.js → MarkdownViewlet.BIolkNXf.js} +25 -25
- package/dist/client/_astro/{MermaidDiagramViewlet.eW6sk-rF.js → MermaidDiagramViewlet.CkRk7QsS.js} +1 -1
- package/dist/client/_astro/PCardRendererBridge.DhaRSprd.js +1 -0
- package/dist/client/_astro/RendererPCardRegistry.brM2KiQs.js +1 -0
- package/dist/client/_astro/{SchemaYamlViewlet.ZJBvxItR.js → SchemaYamlViewlet.Bc7nkK4M.js} +1 -1
- package/dist/client/_astro/{ShellContainer.astro_astro_type_script_index_0_lang.j_ELcN5d.js → ShellContainer.astro_astro_type_script_index_0_lang.5q1gCLvf.js} +1 -1
- package/dist/client/_astro/{Spatial3dViewlet.DnVMBENJ.js → Spatial3dViewlet.C-jjhr0A.js} +1 -1
- package/dist/client/_astro/{StudioLayout.CBgiVbeb.css → StudioLayout.CX8XGtZV.css} +1 -1
- package/dist/client/_astro/StudioWorkbench.B1QwGHWM.js +7 -0
- package/dist/client/_astro/{SvgViewlet.BCje7Qqb.js → SvgViewlet.uGxvb06H.js} +1 -1
- package/dist/client/_astro/{TerminalView.C_Ksz6lT.js → TerminalView.DP7G7E1m.js} +1 -1
- package/dist/client/_astro/{ThemeSettingsViewlet.DJpjQQ0Z.js → ThemeSettingsViewlet.UaTHcGnF.js} +1 -1
- package/dist/client/_astro/{TikzDiagramViewlet.CXb1A8nf.js → TikzDiagramViewlet.O8MJyXfT.js} +1 -1
- package/dist/client/_astro/VideoPlayerViewlet.-ycmo3kY.js +1 -0
- package/dist/client/_astro/WebappZenViewlet.PNce4u2T.js +1 -0
- package/dist/client/_astro/{WelcomeViewport.BiYwLh6l.js → WelcomeViewport.CZ6RxGSw.js} +1 -1
- package/dist/client/_astro/{agentIdentityCredentialService.UzMMwBwv.js → agentIdentityCredentialService.BEtZzBlO.js} +1 -1
- package/dist/client/_astro/cardTypeDetector.C2HH5RnU.js +1 -0
- package/dist/client/_astro/disposable.BmlxZrDf.js +1 -0
- package/dist/client/_astro/{markdownService.BgWjyJ57.js → markdownService.CpuKl0vp.js} +1 -1
- package/dist/client/_astro/{mcardStore.CT-ollfl.js → mcardStore.nSWnzeLg.js} +1 -1
- package/dist/client/_astro/mcardVfs.BSdys1Y7.js +3 -0
- package/dist/client/_astro/pathsConfig.CSBBSzwH.js +2 -0
- package/dist/client/_astro/{polyfills._3wYPjZf.js → polyfills.Bi7kO8cu.js} +1 -1
- package/dist/client/_astro/rendererEventBus.DirFDmGw.js +1 -0
- package/dist/client/_astro/themeStore.BajxvCga.js +1 -0
- package/dist/client/_astro/{tikzCompiler.fe3qomFY.js → tikzCompiler.-fXMNQpz.js} +1 -1
- package/dist/client/_astro/{useMCardHydration.7Z-HfBh5.js → useMCardHydration.Bjj_N5Gv.js} +1 -1
- package/dist/client/_astro/vendor-clm-kernel.B0kxq3g4.js +108 -0
- package/dist/client/_astro/{vfsHandles.IX_wTpw_.js → vfsHandles.D4Pq18pW.js} +1 -1
- package/dist/client/_astro/vfsPersistence.DVrd1BZj.js +1 -0
- package/dist/client/_astro/{vfsTransactions.C_IQQg0s.js → vfsTransactions.DBNtFuRz.js} +1 -1
- package/dist/client/_astro/{workspaceStore.CD0kAVAl.js → workspaceStore.DUHW2YBc.js} +1 -1
- package/dist/server/chunks/{_.._5gPhVOLM.mjs → _.._CoQKwo62.mjs} +137 -91
- package/dist/server/chunks/{_handle__D_cIJYrU.mjs → _handle__D8dKQPUS.mjs} +3 -3
- package/dist/server/chunks/{cardTypeDetector_CyW1Xnmy.mjs → cardTypeDetector_C55M_HWS.mjs} +9 -0
- package/dist/server/chunks/{cards_B89BvF6W.mjs → cards_rVOc8K6H.mjs} +2 -2
- package/dist/server/chunks/cas_DTxlZ4Le.mjs +68 -0
- package/dist/server/chunks/{dispatch_DOwSKukU.mjs → dispatch_BTW4E_BJ.mjs} +8 -7
- package/dist/server/chunks/{dispatch_CxWKiHpn.mjs → dispatch_MbkljUxD.mjs} +8 -8
- package/dist/server/chunks/{export_DRouradA.mjs → export_DkEwDE2T.mjs} +3 -3
- package/dist/server/chunks/{health_Dfa5I0-X.mjs → health_cRt0M0yu.mjs} +1 -1
- package/dist/server/chunks/{mcard-library_7Wzoihkm.mjs → mcard-library_CLHvyslV.mjs} +1 -1
- package/dist/server/chunks/{mcardVfs_CeezzRvt.mjs → mcardVfs_DvNburKb.mjs} +5 -30
- package/dist/server/chunks/{move__RFvIDkq.mjs → move_DYcaXBLV.mjs} +6 -6
- package/dist/server/chunks/{pathsConfig_CgNYYLVm.mjs → pathsConfig_Dack-p2f.mjs} +13 -3
- package/dist/server/chunks/{proxy_CrWJQIBe.mjs → proxy_CMbbdBPW.mjs} +2 -2
- package/dist/server/chunks/{raw_DzNDaDVP.mjs → raw_C97sJWhg.mjs} +59 -26
- package/dist/server/chunks/{serverBootstrap_XKo2s6Ha.mjs → serverBootstrap_BDdSRIu5.mjs} +2 -2
- package/dist/server/chunks/tree_BwmO-pTe.mjs +186 -0
- package/dist/server/chunks/vfsCore_DIKpk-pk.mjs +98 -0
- package/dist/server/chunks/{vfsTreeScan_CKp7kMt9.mjs → vfsTreeScan_CRoCluPB.mjs} +18 -10
- package/dist/server/chunks/workspaceRoot_CRx3taID.mjs +157 -0
- package/dist/server/chunks/{write_popiFsO7.mjs → write_BLsmsTIx.mjs} +6 -5
- package/dist/server/chunks/{ws-server-init_DUjuR2-o.mjs → ws-server-init_Cfft7U5u.mjs} +343 -298
- package/dist/server/entry.mjs +1 -1
- package/dist/server/entry2.mjs +67 -28
- package/dist/server/virtual_astro_middleware.mjs +2 -2
- package/package.json +2 -2
- package/src/components/studio/views/cardViewlets/ClmRegistryComponentViewlet.tsx +133 -0
- package/src/components/studio/views/cardViewlets/DxfViewlet.tsx +230 -0
- package/src/components/studio/views/cardViewlets/VideoPlayerViewlet.tsx +4 -4
- package/src/components/studio/views/cardViewlets/coreViewletDefs.ts +2 -2
- package/src/components/studio/views/cardViewlets/documents/AudioPlayerViewlet.tsx +15 -3
- package/src/components/studio/views/cardViewlets/documents/PdfViewlet.tsx +25 -7
- package/src/components/studio/views/cardViewlets/markdown/stages/wikilinkStage.ts +2 -1
- package/src/components/studio/views/cardViewlets/mediaViewletDefs.ts +21 -1
- package/src/components/studio/views/cardViewlets/webapp/WebappCanvas.tsx +40 -15
- package/src/components/studio/views/cardViewlets/webapp/WebappDevicePresetBar.tsx +108 -0
- package/src/components/studio/views/cardViewlets/webapp/WebappZenViewlet.tsx +23 -30
- package/src/components/studio/views/fileTree/MCardFileTree.tsx +71 -54
- package/src/components/studio/views/fileTree/hooks/useFileTreeSync.ts +0 -1
- package/src/components/studio/views/fileTree/hooks/usePartitionedTrees.ts +68 -23
- package/src/components/studio/views/fileTree/hooks/useSectionAccordion.ts +21 -11
- package/src/components/studio/views/functions/UnifiedFunctionExplorerViewlet.tsx +168 -0
- package/src/components/studio/views/history/HistoryPanel.tsx +110 -0
- package/src/components/studio/views/lineage/LineagePanel.tsx +152 -0
- package/src/components/studio/views/navigation/HandleLineageDrawer.tsx +89 -0
- package/src/components/studio/views/navigation/MultiCardCollectionBrowser.tsx +154 -0
- package/src/components/studio/views/pills/HashPill.tsx +101 -0
- package/src/components/studio/views/residency/ResidencyIndicator.tsx +82 -0
- package/src/config/app_config.json +3 -3
- package/src/core/projection/catalog.ts +105 -0
- package/src/core/projection/collection.ts +148 -0
- package/src/core/projection/handleSubscription.ts +132 -0
- package/src/core/projection/index.ts +4 -0
- package/src/core/projection/selectors.ts +29 -0
- package/src/core/projection/views.ts +242 -0
- package/src/core/refinement/designMetrics.ts +104 -0
- package/src/core/refinement/fibrationProjector.ts +142 -0
- package/src/core/refinement/lagrangianEngine.ts +137 -0
- package/src/core/refinement/refinementCommands.ts +82 -0
- package/src/core/viewport/deviceArchetypeRegistry.ts +177 -0
- package/src/core/viewport/viewportAudit.ts +150 -0
- package/src/edge/storeFilter.d.ts +4 -0
- package/src/edge/storeFilter.js +54 -0
- package/src/edge/storeFilter.ts +52 -0
- package/src/lib/cryptoPolyfill.js +77 -1
- package/src/lib/fsPolyfill.js +65 -0
- package/src/lib/urlPolyfill.js +21 -0
- package/src/lib/zlibPolyfill.js +35 -0
- package/src/packages/mcard-studio/package.json +2 -2
- package/src/packages/mcard-studio/type/legacyMapping.ts +5 -0
- package/src/packages/mcard-studio/viewlets/manifests.ts +2 -0
- package/src/packages/mcard-studio/viewlets/moduleMap.ts +12 -0
- package/src/packages/mcard-studio/viewlets/refinementManifests.ts +114 -0
- package/src/pages/api/dispatch.ts +3 -2
- package/src/pages/api/vfs/cas.ts +114 -0
- package/src/pages/api/vfs/move.ts +5 -5
- package/src/pages/api/vfs/raw.ts +72 -27
- package/src/pages/api/vfs/tree.ts +130 -11
- package/src/pages/api/vfs/write.ts +5 -4
- package/src/server/api/kernelDispatch.ts +8 -8
- package/src/server/artifactCollectionService.ts +4 -7
- package/src/server/artifactRepository.ts +4 -3
- package/src/server/clmRunner.mjs +1 -1
- package/src/server/collectionOwner.mjs +5 -5
- package/src/server/effects/executionPersistenceService.mjs +11 -11
- package/src/server/effects/resultSealingService.mjs +2 -2
- package/src/server/fileIngestService.mjs +21 -9
- package/src/server/fileWatcherService.mjs +4 -1
- package/src/server/handlers/fileChangeHandler.mjs +18 -10
- package/src/server/handlers/saveExecutionLogHandler.mjs +6 -6
- package/src/server/notificationService.mjs +14 -1
- package/src/server/scripts/buildSeedingMemory.mjs +3 -3
- package/src/server/serverMemoryRepository.ts +41 -59
- package/src/server/vfsTreeScan.ts +16 -10
- package/src/server/workspaceRoot.ts +143 -5
- package/src/services/cardTypeDetector.ts +4 -0
- package/src/services/databaseSyncService.ts +30 -46
- package/src/services/namespaceProtocolClient.ts +221 -0
- package/src/services/renderers/pcard/RendererPCardRegistry.ts +4 -66
- package/src/services/renderers/pcard/modalitySpecs.ts +125 -0
- package/src/services/renderers/pcard/types.ts +7 -1
- package/src/services/renderers/rendererEventBus.ts +5 -3
- package/src/services/unifiedFunctionExecutionService.ts +145 -0
- package/src/services/vfs/vfsCore.ts +12 -1
- package/src/services/vfs/vfsMigration.ts +95 -0
- package/src/services/vfs/vfsMutations.ts +17 -35
- package/src/services/vfs/vfsPersistence.ts +19 -24
- package/src/services/vfs/vfsSync.ts +55 -17
- package/src/services/vfs/vfsVersions.ts +23 -34
- package/src/services/workbenchExecutionPolicy.ts +183 -0
- package/src/stores/mcardCollectionStore.ts +2 -0
- package/src/styles/dockview.css +34 -0
- package/src/ui/viewlets/FibrationRefinementViewlet.tsx +155 -0
- package/src/ui/viewlets/PetriConformanceViewlet.tsx +166 -0
- package/src/ui/viewlets/ResponsiveViewportLabViewlet.tsx +175 -0
- package/src/ui/viewlets/SprintGovernanceViewlet.tsx +176 -0
- package/src/ui/viewlets/viewletFocus.ts +35 -0
- package/src/ui/viewlets/viewportLabParts.tsx +190 -0
- package/dist/client/_astro/DockviewSpatialWorkbench.B_I1GJHw.js +0 -12
- package/dist/client/_astro/DocumentViewlets.B53IqmpY.js +0 -2
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.VDRYJCM-.js +0 -1
- package/dist/client/_astro/PCardRendererBridge.oxVKc0gN.js +0 -1
- package/dist/client/_astro/RendererPCardRegistry.CWjYZs2H.js +0 -1
- package/dist/client/_astro/StudioWorkbench.Blo5oSIw.js +0 -7
- package/dist/client/_astro/VideoPlayerViewlet.CmECt7yT.js +0 -1
- package/dist/client/_astro/WebappZenViewlet.whCmGVHR.js +0 -1
- package/dist/client/_astro/__vite-browser-external.CQZnr-r3.js +0 -1
- package/dist/client/_astro/cardTypeDetector.Ci4APwhX.js +0 -1
- package/dist/client/_astro/disposable.Dsb0sbRP.js +0 -1
- package/dist/client/_astro/mcardVfs.2UOw9Z-r.js +0 -3
- package/dist/client/_astro/pathsConfig.D0hV34p7.js +0 -2
- package/dist/client/_astro/rendererEventBus.DMH9afq9.js +0 -1
- package/dist/client/_astro/themeStore.CEt0e54l.js +0 -1
- package/dist/client/_astro/vendor-clm-kernel.Bvk3XHk2.js +0 -116
- package/dist/client/_astro/vfsPersistence.BuhXYeSb.js +0 -1
- package/dist/server/chunks/cryptoPolyfill_99rxUwYC.mjs +0 -180
- package/dist/server/chunks/kernelHash_DRaj51hY.mjs +0 -5
- package/dist/server/chunks/tree_CE2BhvyJ.mjs +0 -76
- package/dist/server/chunks/vfsCore_B6nCiBl5.mjs +0 -21
- package/dist/server/chunks/workspaceRoot_DVSUbYkd.mjs +0 -71
- package/src/server/kernelHash.ts +0 -22
- package/src/server/storage/cardCollection.ts +0 -94
- package/src/server/storage/index.ts +0 -3
- package/src/server/storage/mcard.ts +0 -99
- package/src/server/storage/sqliteNodeEngine.ts +0 -121
- /package/dist/server/chunks/{StudioLayout_B5ZnlqjF.mjs → StudioLayout_taayQJ5b.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./vendor-clm-kernel.
|
|
1
|
+
import{h as e}from"./vendor-clm-kernel.B0kxq3g4.js";import{h as t}from"./themeStore.BajxvCga.js";import{y as n}from"./mcardStore.nSWnzeLg.js";import{n as r}from"./pathsConfig.CSBBSzwH.js";import{n as i,t as a}from"./cardTypeDetector.C2HH5RnU.js";function o(e){let t=(e||``).trim(),n=t,r=`raw`;n.startsWith(`mcard://`)?(r=`mcard`,n=n.slice(8)):n.startsWith(`mcard:`)?(r=`mcard`,n=n.slice(6)):n.startsWith(`pcard://`)?(r=`pcard`,n=n.slice(8)):n.startsWith(`pcard:`)&&(r=`pcard`,n=n.slice(6));let[i,a]=n.split(`#`),[o,s]=i.split(`?`),c={};if(s)try{new URLSearchParams(s).forEach((e,t)=>{c[t]=e})}catch{s.split(`&`).forEach(e=>{let[t,n]=e.split(`=`);t&&(c[decodeURIComponent(t)]=decodeURIComponent(n||``))})}return{cleanHandle:o.trim(),scheme:r,params:c,anchor:a?a.trim():void 0,rawTarget:t}}function s(e,t){let n=(e||``).trim();n.startsWith(`mcard://`)&&(n=n.replace(/^mcard:\/\//,``));let i=n.replace(/:/g,`/`).replace(/^[\/\\]+/,``);return i.toLowerCase().endsWith(`.md`)?r({b64:i,versionHash:t,cacheBust:!t}):r({path:i,versionHash:t,cacheBust:!t})}function c(e,t,r){if(!e)return null;let i=r||n.get();if(!i)return null;let a=o(e).cleanHandle;if(!a)return null;if(i[a])return i[a];let s=a.replace(/\//g,`:`);if(i[s])return i[s];let c=a.replace(/:/g,`/`);if(i[c])return i[c];if(!s.endsWith(`.md`)&&i[`${s}.md`])return i[`${s}.md`];let l=Object.values(i),u=l.find(e=>e.handle===a||e.handle===s||e.handle===c||e.path===a||e.path===c||e.path.replace(/\//g,`:`)===s);if(u)return u;if(!a.endsWith(`.md`)){let e=`${a}.md`,t=`${s}.md`;if(u=l.find(n=>n.handle===t||n.path===e||n.name===e),u)return u}let d=a.toLowerCase(),f=d.endsWith(`.md`)?d:`${d}.md`;if(u=l.find(e=>{let t=e.name.toLowerCase(),n=t.replace(/\.[^.]+$/,``);return t===d||t===f||n===d}),u)return u;if(t&&t.path){let e=t.path.substring(0,t.path.lastIndexOf(`/`));if(e){let t=`${e}/${a}`.replace(/\/+/g,`/`),n=t.replace(/\//g,`:`);if(i[n])return i[n];if(!n.endsWith(`.md`)&&i[`${n}.md`])return i[`${n}.md`];if(u=l.find(e=>e.path===t||e.path===`${t}.md`),u)return u}}return u=l.find(e=>e.path.endsWith(`/${a}`)||e.path.endsWith(`/${a}.md`)||e.handle.endsWith(`:${s}`)||e.handle.endsWith(`:${s}.md`)),u||null}async function l(r){if(!r)return null;try{let o=await e({uri:r,backend:t.storageBackend,fallback:`stale`,cache:!0});if(o.content){let e=i(r),t=a({path:r,mimeType:e}),s={handle:r,hash:o.hash,path:r.replace(/:/g,`/`),name:r.split(`:`).pop()||r,mimeType:e,detectedType:t.detectedType,epistemicStatus:`definition`,readOnly:!0,content:o.content,subclass:t.subclass};return n.setKey(r,s),s}}catch(e){console.warn(`[MCardVFS] Remote resolution failed for ${r}:`,e)}return null}export{s as n,l as r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime.Dd_uD5pT.js";import{L as t}from"./vendor-clm-kernel.B0kxq3g4.js";import{_ as n,b as r,g as i,h as a,v as o,x as s,y as c}from"./themeStore.BajxvCga.js";import{a as l,y as u}from"./mcardStore.nSWnzeLg.js";import{t as d}from"./pathsConfig.CSBBSzwH.js";var f=class{options;isFlushing=!1;flushPromise=null;currentGeneration=0;retryAttempts=0;debounceTimer=null;state=`idle`;constructor(e){this.options=e}scheduleFlush(e=300){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.flush().catch(e=>console.error(`[StorageSupervisor] Flush error:`,e))},e)}async flush(){return this.isFlushing&&this.flushPromise?this.flushPromise:(this.isFlushing=!0,this.transition(`saving`),this.flushPromise=(async()=>{try{await this.options.flush(),this.currentGeneration++,this.retryAttempts=0,this.transition(`persistent`)}catch(e){throw this.transition(`error`),e}finally{this.isFlushing=!1,this.flushPromise=null}})(),this.flushPromise)}handleStaleConflict(e,t){this.transition(`stale`),console.warn(`[StorageSupervisor] Stale writer conflict: expected gen ${e}, found ${t}`)}async retryFlush(){try{return await this.flush(),!0}catch{return this.retryAttempts++,!1}}getState(){return this.state}getCurrentGeneration(){return this.currentGeneration}getRetryAttempts(){return this.retryAttempts}dispose(){this.debounceTimer&&=(clearTimeout(this.debounceTimer),null),this.isFlushing=!1,this.flushPromise=null}transition(e){this.state=e,this.options.onStateChange?.(e)}},p=e({STORE_CAS:()=>i,STORE_HANDLES:()=>n,STORE_HISTORY:()=>o,STORE_SNAPSHOTS:()=>r,getSqliteBytesFromIndexedDb:()=>C,hydrateFromIndexedDb:()=>x,idbGet:()=>h,idbGetAll:()=>g,idbPut:()=>_,loadCardsFromIndexedDb:()=>w,openIndexedDb:()=>s,saveSqliteBytesToIndexedDb:()=>S,triggerIndexedDbSync:()=>b,vfsStorageSupervisor:()=>y}),m=d.paths.workspace_dirname;async function h(e,t){try{let n=await s();return new Promise((r,i)=>{let a=n.transaction(e,`readonly`).objectStore(e).get(t);a.onsuccess=()=>r(a.result),a.onerror=()=>i(a.error)})}catch{return}}async function g(e){try{let t=await s();return new Promise((n,r)=>{let i=t.transaction(e,`readonly`).objectStore(e).getAll();i.onsuccess=()=>n(i.result||[]),i.onerror=()=>r(i.error)})}catch{return[]}}async function _(e,t,n){try{let r=await s();return new Promise((i,a)=>{let o=r.transaction(e,`readwrite`).objectStore(e),s=n===void 0?o.put(t):o.put(t,n);s.onsuccess=()=>i(),s.onerror=()=>a(s.error)})}catch{}}async function v(){if(typeof window>`u`||!window.indexedDB)return;let e=u.get(),t=Object.values(e),l=`${m}:`,d=t.filter(e=>e.handle.startsWith(l)||e.scope===m||e.path.startsWith(`${m}/`)),f=(await s()).transaction([i,n,o,r,c],`readwrite`),p=f.objectStore(i),h=f.objectStore(n);h.clear();for(let e of d)e.hash&&e.content!==void 0&&p.put({hash:e.hash,content:e.content,mimeType:e.mimeType,size:typeof e.content==`string`?e.content.length:e.content?.byteLength||0}),h.put({handle:e.handle,scope:m,path:e.path,name:e.name,hash:e.hash,detectedType:e.detectedType,epistemicStatus:e.epistemicStatus,mtime:e.mtime||Date.now()});let g=a.storageBackend;if(g&&typeof g.exportBinary==`function`){let e=g.exportBinary();e&&f.objectStore(r).put({id:`latest`,bytes:e,mtime:Date.now()})}let _=d.map(e=>({handle:e.handle,hash:e.hash,path:e.path,name:e.name,mimeType:e.mimeType,detectedType:e.detectedType,epistemicStatus:e.epistemicStatus,readOnly:e.readOnly,subclass:e.subclass,content:e.content}));f.objectStore(c).put(_,`clm_cards`)}var y=new f({flush:v,onStateChange:e=>{l({isPersistent:e===`persistent`,lastSavedIso:new Date().toISOString(),supervisorState:e})}});function b(){let e=u.get(),t=Object.values(e),n=0;for(let e of t)typeof e.content==`string`?n+=e.content.length:e.content instanceof Uint8Array&&(n+=e.content.byteLength);let r=a.storageBackend.constructor.name,i=r.includes(`Sqlite`)?`sqlite`:r.includes(`SqlJs`)?`sqljs`:`memory`;l({backendType:i,cardCount:t.length,totalBytes:n,isPersistent:!0,lastSavedIso:new Date().toISOString()}),y.scheduleFlush(300)}async function x(){if(typeof window>`u`||!window.indexedDB)return!1;try{let e=await g(n),r=`${m}:`,o=e.filter(e=>e.scope===m||e.handle&&e.handle.startsWith(r)),s=u.get(),d=t.create(`did:clm:agent:idb`),f=0,p=0;if(o.length>0)for(let e of o){let t=``;if(e.hash){let n=await h(i,e.hash);n&&n.content!==void 0&&(t=n.content)}if(!s[e.handle]||!s[e.handle].content){let n=a.writeFile(e.path,t||``,d);s[e.handle]={...e,content:t,coreCard:n},f++}typeof t==`string`&&(p+=t.length)}else{let e=await h(c,`clm_cards`);if(Array.isArray(e)&&e.length>0){for(let t of e)if((t.path.startsWith(`${m}/`)||t.handle.startsWith(r))&&(!s[t.handle]||!s[t.handle].content)){let e=a.writeFile(t.path,t.content||``,d);s[t.handle]={...t,coreCard:e},f++}}}return f>0&&(u.set({...s}),l({cardCount:Object.keys(s).length,totalBytes:p,isPersistent:!0,lastSavedIso:new Date().toISOString()}),!0)}catch(e){return console.warn(`[MCardVFS] Failed to hydrate from IndexedDB:`,e),!1}}async function S(e){typeof window<`u`&&window.indexedDB&&await _(r,{id:`latest`,bytes:e,mtime:Date.now()})}async function C(){if(typeof window<`u`&&window.indexedDB)return(await h(r,`latest`))?.bytes}async function w(){if(typeof window<`u`&&window.indexedDB)return h(c,`clm_cards`)}export{p as i,S as n,b as r,x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e,
|
|
1
|
+
import{E as e,L as t}from"./vendor-clm-kernel.B0kxq3g4.js";import{h as n}from"./themeStore.BajxvCga.js";import{y as r}from"./mcardStore.nSWnzeLg.js";import{r as i}from"./pathsConfig.CSBBSzwH.js";import{n as a,t as o}from"./cardTypeDetector.C2HH5RnU.js";import{r as s}from"./vfsPersistence.DVrd1BZj.js";async function c(i){let c=t.create(`did:clm:agent:user`),l=[];for(let t of i){let i=t.name.replace(/^[/\\]+/,``),s=`uploads/${i}`,u=s.replace(/\//g,`:`),d=t.mimeType||a(i),f=o({path:s,mimeType:d}),p=n.writeFile(s,t.content,c),m={handle:u,hash:p.hash.asHex(),path:s,name:i,mimeType:d,detectedType:f.detectedType,epistemicStatus:e(s),readOnly:!1,scope:`local-db`,subclass:f.subclass,content:t.content,coreCard:p};r.setKey(u,m),l.push(m)}return s(),l}async function l(e){let a=i(`vfs_tree`),o=await fetch(`${a}?scope=${encodeURIComponent(e)}`);if(!o.ok)throw Error(`Failed to fetch scope ${e} for forking: HTTP ${o.status}`);let c=await o.json();if(!c.success||!Array.isArray(c.files))throw Error(`Malformed tree response for fork`);let l=t.create(`did:clm:agent:user`),u=0;for(let t of c.files){let i=`forked/${e}/${t.path}`,a=i.replace(/\//g,`:`),o=t.content??``,s=n.writeFile(i,o,l),c={...t,handle:a,hash:s.hash.asHex(),path:i,name:t.name,readOnly:!1,scope:`local-db`,content:o,coreCard:s};r.setKey(a,c),u++}return s(),u}export{c as executeFileUploadTransaction,l as executeForkDirectoryTransaction};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime.Dd_uD5pT.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime.Dd_uD5pT.js";import{S as t}from"./themeStore.BajxvCga.js";import{i as n}from"./pathsConfig.CSBBSzwH.js";var r=e({$activeWorkspaceRoot:()=>o,$explorerSearchFilter:()=>c,clearExplorerSearchFilter:()=>d,setActiveWorkspaceRoot:()=>s,setExplorerSearchFilter:()=>u}),i=`clm:active_workspace_scope`;function a(){if(typeof window<`u`)try{let e=localStorage.getItem(i);if(e===`local-db`||n().some(t=>t.id===e)&&e)return e}catch{}return`local-db`}var o=t(a());function s(e){let t=e===`local-db`,r=n().some(t=>t.id===e);if(!t&&!r){console.warn(`[WorkspaceStore] Invalid workspace scope: ${e}`);return}if(o.set(e),typeof window<`u`)try{localStorage.setItem(i,e)}catch{}}var c=t(``),l=null;function u(e,t=!1){if(l&&=(clearTimeout(l),null),t){c.set(e);return}l=setTimeout(()=>{c.set(e),l=null},150)}function d(){l&&=(clearTimeout(l),null),c.set(``)}export{r as a,u as i,c as n,d as r,o as t};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
2
|
import { D as createAstro, f as renderTemplate, g as maybeRenderHead, o as renderComponent } from "./server_DQgO1z9H.mjs";
|
|
3
3
|
import { t as createComponent } from "./compiler_jjPF-nBO.mjs";
|
|
4
|
-
import { t as $$StudioLayout } from "./
|
|
5
|
-
import { i as
|
|
6
|
-
import { t as studioMCardFs } from "./
|
|
7
|
-
import "./
|
|
4
|
+
import { t as $$StudioLayout } from "./StudioLayout_taayQJ5b.mjs";
|
|
5
|
+
import { i as repoRoot, o as workspaceRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
6
|
+
import { t as studioMCardFs } from "./vfsCore_DIKpk-pk.mjs";
|
|
7
|
+
import "./mcardVfs_DvNburKb.mjs";
|
|
8
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { ContentHash, parseTriadManifest, parseYamlOrJson, routeHandle } from "clm-kernel";
|
|
@@ -17,6 +17,137 @@ var $$PCardView = createComponent(($$result, $$props, $$slots) => {
|
|
|
17
17
|
return renderTemplate`${maybeRenderHead($$result)}<main class="pcard-container" data-astro-cid-ih2q6tja>${card ? renderTemplate`<article class="pcard-view" data-astro-cid-ih2q6tja><header class="pcard-header" data-astro-cid-ih2q6tja><div class="badge" data-astro-cid-ih2q6tja>PCARD</div><h1 class="pcard-title" data-astro-cid-ih2q6tja>${card.handle}</h1><div class="hash-tag" data-astro-cid-ih2q6tja><code data-astro-cid-ih2q6tja>${card.hash}</code></div><span class="runtime-pill" data-astro-cid-ih2q6tja>Runtime: ${card.runtime}</span></header><section class="pcard-body" data-astro-cid-ih2q6tja><h2 class="section-title" data-astro-cid-ih2q6tja>Manifest / Content</h2><pre class="content-pre" data-astro-cid-ih2q6tja><code data-astro-cid-ih2q6tja>${card.content}</code></pre></section></article>` : renderTemplate`<div class="not-found-view" data-astro-cid-ih2q6tja><h1 class="not-found-title" data-astro-cid-ih2q6tja>404 — PCard Not Found</h1><p class="not-found-desc" data-astro-cid-ih2q6tja>The requested handle <code data-astro-cid-ih2q6tja>${handle}</code> could not be resolved in the sovereign archive.</p><a href="/" class="back-link" data-astro-cid-ih2q6tja>Return to Studio Workbench</a></div>`}</main>`;
|
|
18
18
|
}, "/Users/bkoo/Documents/Development/GovTech/MCard_TDD/mcard-studio/src/components/studio/pcard/PCardView.astro", void 0);
|
|
19
19
|
//#endregion
|
|
20
|
+
//#region src/services/renderers/pcard/modalitySpecs.ts
|
|
21
|
+
var MODALITIES = [
|
|
22
|
+
"mermaid",
|
|
23
|
+
"katex",
|
|
24
|
+
"d3",
|
|
25
|
+
"chartjs",
|
|
26
|
+
"excalidraw",
|
|
27
|
+
"three",
|
|
28
|
+
"tikz",
|
|
29
|
+
"table",
|
|
30
|
+
"clm-registry-component",
|
|
31
|
+
"function-explorer",
|
|
32
|
+
"fibration-dashboard",
|
|
33
|
+
"petri-inspector",
|
|
34
|
+
"sprint-governance",
|
|
35
|
+
"viewport-lab"
|
|
36
|
+
];
|
|
37
|
+
var MODALITY_SPECS = {
|
|
38
|
+
mermaid: {
|
|
39
|
+
displayName: "Mermaid Diagram PCard",
|
|
40
|
+
description: "Reactive SVG flowcharts, sequence diagrams, and class graphs",
|
|
41
|
+
mimes: ["text/vnd.mermaid", "text/x-mermaid"],
|
|
42
|
+
exts: [".mermaid", ".mmd"]
|
|
43
|
+
},
|
|
44
|
+
katex: {
|
|
45
|
+
displayName: "KaTeX Math PCard",
|
|
46
|
+
description: "Zero-bundle mathematical typography and equation proofs",
|
|
47
|
+
mimes: [
|
|
48
|
+
"text/x-tex",
|
|
49
|
+
"application/x-latex",
|
|
50
|
+
"text/x-math"
|
|
51
|
+
],
|
|
52
|
+
exts: [
|
|
53
|
+
".math",
|
|
54
|
+
".latex",
|
|
55
|
+
".tex"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
d3: {
|
|
59
|
+
displayName: "D3.js Graph PCard",
|
|
60
|
+
description: "Interactive topological force networks and hierarchical trees",
|
|
61
|
+
mimes: ["application/vnd.d3+json", "application/x-graph"],
|
|
62
|
+
exts: [
|
|
63
|
+
".d3.json",
|
|
64
|
+
".graph.json",
|
|
65
|
+
".adjlist"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
chartjs: {
|
|
69
|
+
displayName: "Chart.js Analytics PCard",
|
|
70
|
+
description: "Multi-series timeseries, bar, radar, and statistical distributions",
|
|
71
|
+
mimes: ["application/vnd.chartjs+json", "application/x-timeseries"],
|
|
72
|
+
exts: [".chart.json", ".timeseries.json"]
|
|
73
|
+
},
|
|
74
|
+
excalidraw: {
|
|
75
|
+
displayName: "Excalidraw Whiteboard PCard",
|
|
76
|
+
description: "Spatial hand-drawn conceptual sketching and architecture canvas",
|
|
77
|
+
mimes: ["application/vnd.excalidraw+json", "application/x-excalidraw"],
|
|
78
|
+
exts: [".excalidraw", ".excalidraw.json"]
|
|
79
|
+
},
|
|
80
|
+
three: {
|
|
81
|
+
displayName: "Three.js 3D Viewport PCard",
|
|
82
|
+
description: "WebGL spatial geometry, meshes, and lighting environments",
|
|
83
|
+
mimes: [
|
|
84
|
+
"model/gltf-binary",
|
|
85
|
+
"model/gltf+json",
|
|
86
|
+
"model/obj",
|
|
87
|
+
"model/stl"
|
|
88
|
+
],
|
|
89
|
+
exts: [
|
|
90
|
+
".glb",
|
|
91
|
+
".gltf",
|
|
92
|
+
".obj",
|
|
93
|
+
".stl",
|
|
94
|
+
".3ds"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
tikz: {
|
|
98
|
+
displayName: "TikZ Categorical Vector PCard",
|
|
99
|
+
description: "High-fidelity commutative diagrams and LaTeX vector diagrams",
|
|
100
|
+
mimes: ["text/x-tikz", "text/x-tikzcd"],
|
|
101
|
+
exts: [
|
|
102
|
+
".tikz",
|
|
103
|
+
".tikzcd",
|
|
104
|
+
".tikz-cd"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
table: {
|
|
108
|
+
displayName: "GFM Data Table PCard",
|
|
109
|
+
description: "Tabular record grids, sorting, filtering, and CSV evaluation",
|
|
110
|
+
mimes: ["text/csv", "text/tab-separated-values"],
|
|
111
|
+
exts: [".csv", ".tsv"]
|
|
112
|
+
},
|
|
113
|
+
"clm-registry-component": {
|
|
114
|
+
displayName: "CLM Registry Component PCard",
|
|
115
|
+
description: "Sharded clm-registry components and portal island cartridges",
|
|
116
|
+
mimes: ["application/vnd.mcard.registry+json"],
|
|
117
|
+
exts: [".registry.json", ".clm-registry.json"]
|
|
118
|
+
},
|
|
119
|
+
"function-explorer": {
|
|
120
|
+
displayName: "Supported Function Explorer PCard",
|
|
121
|
+
description: "Discoverable function and capability descriptors; never executable",
|
|
122
|
+
mimes: ["application/vnd.mcard.catalog+json"],
|
|
123
|
+
exts: [".catalog.json", ".function-catalog.json"]
|
|
124
|
+
},
|
|
125
|
+
"fibration-dashboard": {
|
|
126
|
+
displayName: "Least-Action & Fibration Dashboard PCard",
|
|
127
|
+
description: "Software Lagrangian trajectories and base-to-fiber refinement projections",
|
|
128
|
+
mimes: ["application/vnd.mcard.fibration+json"],
|
|
129
|
+
exts: [".fibration.json", ".assessment.json"]
|
|
130
|
+
},
|
|
131
|
+
"petri-inspector": {
|
|
132
|
+
displayName: "Petri Marking & Fiber Conformance PCard",
|
|
133
|
+
description: "Read-only Petri-net markings and MIME taxonomy fiber conformance",
|
|
134
|
+
mimes: ["application/vnd.mcard.petri+json"],
|
|
135
|
+
exts: [".petri.json", ".marking.json"]
|
|
136
|
+
},
|
|
137
|
+
"sprint-governance": {
|
|
138
|
+
displayName: "Sprint & Deployment Governance PCard",
|
|
139
|
+
description: "Sprint registry projections, DoD seals, and deployment unit budgets",
|
|
140
|
+
mimes: ["application/vnd.mcard.governance+json"],
|
|
141
|
+
exts: [".governance.json", ".sprint-registry.json"]
|
|
142
|
+
},
|
|
143
|
+
"viewport-lab": {
|
|
144
|
+
displayName: "Responsive Viewport Lab PCard",
|
|
145
|
+
description: "Quad-device responsive matrix: wearable, cellphone, laptop, and desktop",
|
|
146
|
+
mimes: ["application/vnd.mcard.viewport+json"],
|
|
147
|
+
exts: [".viewport.json", ".viewport-matrix.json"]
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
//#endregion
|
|
20
151
|
//#region src/services/renderers/pcard/RendererPCardRegistry.ts
|
|
21
152
|
/**
|
|
22
153
|
* RendererPCardRegistry.ts — Canonical Registry for Renderer PCards (Program PR / Sprint PR-01)
|
|
@@ -63,93 +194,8 @@ var RendererPCardRegistry = class {
|
|
|
63
194
|
return Array.from(this.pcards.values());
|
|
64
195
|
}
|
|
65
196
|
registerDefaults() {
|
|
66
|
-
const modalities =
|
|
67
|
-
|
|
68
|
-
"katex",
|
|
69
|
-
"d3",
|
|
70
|
-
"chartjs",
|
|
71
|
-
"excalidraw",
|
|
72
|
-
"three",
|
|
73
|
-
"tikz",
|
|
74
|
-
"table"
|
|
75
|
-
];
|
|
76
|
-
const specs = {
|
|
77
|
-
mermaid: {
|
|
78
|
-
displayName: "Mermaid Diagram PCard",
|
|
79
|
-
description: "Reactive SVG flowcharts, sequence diagrams, and class graphs",
|
|
80
|
-
mimes: ["text/vnd.mermaid", "text/x-mermaid"],
|
|
81
|
-
exts: [".mermaid", ".mmd"]
|
|
82
|
-
},
|
|
83
|
-
katex: {
|
|
84
|
-
displayName: "KaTeX Math PCard",
|
|
85
|
-
description: "Zero-bundle mathematical typography and equation proofs",
|
|
86
|
-
mimes: [
|
|
87
|
-
"text/x-tex",
|
|
88
|
-
"application/x-latex",
|
|
89
|
-
"text/x-math"
|
|
90
|
-
],
|
|
91
|
-
exts: [
|
|
92
|
-
".math",
|
|
93
|
-
".latex",
|
|
94
|
-
".tex"
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
d3: {
|
|
98
|
-
displayName: "D3.js Graph PCard",
|
|
99
|
-
description: "Interactive topological force networks and hierarchical trees",
|
|
100
|
-
mimes: ["application/vnd.d3+json", "application/x-graph"],
|
|
101
|
-
exts: [
|
|
102
|
-
".d3.json",
|
|
103
|
-
".graph.json",
|
|
104
|
-
".adjlist"
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
chartjs: {
|
|
108
|
-
displayName: "Chart.js Analytics PCard",
|
|
109
|
-
description: "Multi-series timeseries, bar, radar, and statistical distributions",
|
|
110
|
-
mimes: ["application/vnd.chartjs+json", "application/x-timeseries"],
|
|
111
|
-
exts: [".chart.json", ".timeseries.json"]
|
|
112
|
-
},
|
|
113
|
-
excalidraw: {
|
|
114
|
-
displayName: "Excalidraw Whiteboard PCard",
|
|
115
|
-
description: "Spatial hand-drawn conceptual sketching and architecture canvas",
|
|
116
|
-
mimes: ["application/vnd.excalidraw+json", "application/x-excalidraw"],
|
|
117
|
-
exts: [".excalidraw", ".excalidraw.json"]
|
|
118
|
-
},
|
|
119
|
-
three: {
|
|
120
|
-
displayName: "Three.js 3D Viewport PCard",
|
|
121
|
-
description: "WebGL spatial geometry, meshes, and lighting environments",
|
|
122
|
-
mimes: [
|
|
123
|
-
"model/gltf-binary",
|
|
124
|
-
"model/gltf+json",
|
|
125
|
-
"model/obj",
|
|
126
|
-
"model/stl"
|
|
127
|
-
],
|
|
128
|
-
exts: [
|
|
129
|
-
".glb",
|
|
130
|
-
".gltf",
|
|
131
|
-
".obj",
|
|
132
|
-
".stl",
|
|
133
|
-
".3ds"
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
tikz: {
|
|
137
|
-
displayName: "TikZ Categorical Vector PCard",
|
|
138
|
-
description: "High-fidelity commutative diagrams and LaTeX vector diagrams",
|
|
139
|
-
mimes: ["text/x-tikz", "text/x-tikzcd"],
|
|
140
|
-
exts: [
|
|
141
|
-
".tikz",
|
|
142
|
-
".tikzcd",
|
|
143
|
-
".tikz-cd"
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
table: {
|
|
147
|
-
displayName: "GFM Data Table PCard",
|
|
148
|
-
description: "Tabular record grids, sorting, filtering, and CSV evaluation",
|
|
149
|
-
mimes: ["text/csv", "text/tab-separated-values"],
|
|
150
|
-
exts: [".csv", ".tsv"]
|
|
151
|
-
}
|
|
152
|
-
};
|
|
197
|
+
const modalities = MODALITIES;
|
|
198
|
+
const specs = MODALITY_SPECS;
|
|
153
199
|
for (const mod of modalities) {
|
|
154
200
|
const s = specs[mod];
|
|
155
201
|
this.register({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { i as
|
|
2
|
+
import { i as repoRoot, o as workspaceRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
3
3
|
import { a as notFound, r as json, t as error } from "./apiUtils_B3BX89fM.mjs";
|
|
4
|
-
import { t as studioMCardFs } from "./
|
|
5
|
-
import "./
|
|
4
|
+
import { t as studioMCardFs } from "./vfsCore_DIKpk-pk.mjs";
|
|
5
|
+
import "./mcardVfs_DvNburKb.mjs";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { ContentHash, parseTriadManifest, parseYamlOrJson, routeHandle } from "clm-kernel";
|
|
@@ -216,6 +216,11 @@ var RULES = [
|
|
|
216
216
|
match: (c) => c.mime === "text/html",
|
|
217
217
|
result: (c) => details("media", "document", "MCard", "HtmlViewer", c.mime)
|
|
218
218
|
},
|
|
219
|
+
{
|
|
220
|
+
id: "dxf",
|
|
221
|
+
match: (c) => c.mime === "image/vnd.dxf" || c.path.endsWith(".dxf"),
|
|
222
|
+
result: (c) => details("media", "document", "MCard", "DxfViewer", "image/vnd.dxf")
|
|
223
|
+
},
|
|
219
224
|
{
|
|
220
225
|
id: "image",
|
|
221
226
|
match: (c) => c.mime.startsWith("image/"),
|
|
@@ -298,6 +303,10 @@ function sniffMimeType(filePath) {
|
|
|
298
303
|
if (detected !== "application/octet-stream") return detected;
|
|
299
304
|
if (ext === "rs") return "text/rust";
|
|
300
305
|
if (ext === "sh") return "text/x-sh";
|
|
306
|
+
if (ext === "dxf") return "image/vnd.dxf";
|
|
307
|
+
if (ext === "webm") return "video/webm";
|
|
308
|
+
if (ext === "ogg") return "audio/ogg";
|
|
309
|
+
if (ext === "flac") return "audio/flac";
|
|
301
310
|
return "application/octet-stream";
|
|
302
311
|
}
|
|
303
312
|
/** Normalize a node into the (path, mime, text-content) triple the policy consumes. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { t as PATHS } from "./
|
|
3
|
-
import {
|
|
2
|
+
import { t as PATHS } from "./pathsConfig_Dack-p2f.mjs";
|
|
3
|
+
import { i as repoRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
4
4
|
import { r as json, t as error } from "./apiUtils_B3BX89fM.mjs";
|
|
5
5
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
6
6
|
import { basename, join } from "node:path";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
+
import { t as error } from "./apiUtils_B3BX89fM.mjs";
|
|
3
|
+
import { t as studioMCardFs } from "./vfsCore_DIKpk-pk.mjs";
|
|
4
|
+
import { ContentHash, ScopeAccessError, resolveIn } from "clm-kernel";
|
|
5
|
+
//#region src/pages/api/vfs/cas.ts
|
|
6
|
+
var cas_exports = /* @__PURE__ */ __exportAll({ GET: () => GET });
|
|
7
|
+
var GET = async ({ request, url }) => {
|
|
8
|
+
const hashParam = url.searchParams.get("hash")?.trim();
|
|
9
|
+
const scopeParam = url.searchParams.get("scope")?.trim();
|
|
10
|
+
const pathHint = url.searchParams.get("pathHint")?.trim() || url.searchParams.get("path")?.trim();
|
|
11
|
+
if (!hashParam) return error("Missing required query parameter: hash", 400);
|
|
12
|
+
if (!hashParam.includes(":")) return error("Parameter must be a qualified reference (<algo>:<hex>); bare digests are forbidden", 400);
|
|
13
|
+
const [algo, hex] = hashParam.split(":");
|
|
14
|
+
if (!algo || !hex || hex.length < 32) return error("Malformed qualified reference", 400);
|
|
15
|
+
const etag = `"${hashParam}"`;
|
|
16
|
+
const ifNoneMatch = request.headers.get("if-none-match")?.trim();
|
|
17
|
+
if (ifNoneMatch === etag || ifNoneMatch === hashParam) return new Response(null, {
|
|
18
|
+
status: 304,
|
|
19
|
+
headers: {
|
|
20
|
+
"ETag": etag,
|
|
21
|
+
"Cache-Control": "private, max-age=31536000, immutable"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
try {
|
|
25
|
+
const backend = studioMCardFs.backend || studioMCardFs.storageBackend;
|
|
26
|
+
const archiveDir = studioMCardFs.archiveDir || process.env.CLM_ARCHIVE_DIR;
|
|
27
|
+
if (scopeParam) {
|
|
28
|
+
const scopeContext = {
|
|
29
|
+
roots: scopeParam.split(",").map((s) => s.trim()).filter(Boolean),
|
|
30
|
+
backend,
|
|
31
|
+
archiveDir
|
|
32
|
+
};
|
|
33
|
+
try {
|
|
34
|
+
if (!resolveIn(scopeContext, hashParam, pathHint)) return error(`Access denied: hash '${hashParam}' is outside authorization scope`, 403);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (err instanceof ScopeAccessError) return error(`Path hint escaping scope root rejected: ${err.message}`, 403);
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
let bytes;
|
|
41
|
+
if (backend && typeof backend.getRaw === "function") bytes = backend.getRaw(hashParam);
|
|
42
|
+
if (!bytes && backend && typeof backend.getRecord === "function") {
|
|
43
|
+
const rec = backend.getRecord(hashParam);
|
|
44
|
+
if (rec) bytes = rec.content;
|
|
45
|
+
}
|
|
46
|
+
if (!bytes && backend && typeof backend.get === "function") {
|
|
47
|
+
const card = backend.get(ContentHash.parse(hashParam));
|
|
48
|
+
if (card) bytes = typeof card.toPreimage === "function" ? card.toPreimage() : new TextEncoder().encode(JSON.stringify(card.toJSON ? card.toJSON() : card));
|
|
49
|
+
}
|
|
50
|
+
if (!bytes) return error(`Object not found for qualified hash ${hashParam}`, 404);
|
|
51
|
+
return new Response(bytes, {
|
|
52
|
+
status: 200,
|
|
53
|
+
headers: {
|
|
54
|
+
"Content-Type": "application/octet-stream",
|
|
55
|
+
"Content-Length": bytes.byteLength.toString(),
|
|
56
|
+
"ETag": etag,
|
|
57
|
+
"Cache-Control": "private, max-age=31536000, immutable"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
} catch (err) {
|
|
61
|
+
return error(err instanceof Error ? err.message : "Internal CAS retrieval error", 500);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region \0virtual:astro:page:src/pages/api/vfs/cas@_@ts
|
|
66
|
+
var page = () => cas_exports;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { page };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { t as PATHS } from "./
|
|
3
|
-
import { i as
|
|
2
|
+
import { t as PATHS } from "./pathsConfig_Dack-p2f.mjs";
|
|
3
|
+
import { i as repoRoot, o as workspaceRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
|
+
import { createRecord, qualify } from "clm-kernel";
|
|
6
7
|
import { atom } from "nanostores";
|
|
7
8
|
//#region src/stores/marking.ts
|
|
8
9
|
var marking = atom({ places: {} });
|
|
@@ -80,7 +81,7 @@ async function ensureKeyPair() {
|
|
|
80
81
|
keyPair = await crypto.subtle.generateKey({ name: "Ed25519" }, false, ["sign", "verify"]);
|
|
81
82
|
return keyPair;
|
|
82
83
|
}
|
|
83
|
-
async function computeHash(data) {
|
|
84
|
+
async function computeHash$1(data) {
|
|
84
85
|
const encoder = new TextEncoder();
|
|
85
86
|
const digest = await crypto.subtle.digest("SHA-256", encoder.encode(data));
|
|
86
87
|
return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
@@ -93,7 +94,7 @@ async function signVCard(params) {
|
|
|
93
94
|
sponsorDid: params.sponsorDid,
|
|
94
95
|
markingTransition: params.markingTransition
|
|
95
96
|
});
|
|
96
|
-
const payloadHash = await computeHash(payload);
|
|
97
|
+
const payloadHash = await computeHash$1(payload);
|
|
97
98
|
const encoder = new TextEncoder();
|
|
98
99
|
const signature = await crypto.subtle.sign("Ed25519", kp.privateKey, encoder.encode(payload));
|
|
99
100
|
const sigHex = Array.from(new Uint8Array(signature)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
@@ -103,7 +104,7 @@ async function signVCard(params) {
|
|
|
103
104
|
signature: sigHex,
|
|
104
105
|
sponsorDid: params.sponsorDid,
|
|
105
106
|
firedBy: "browser",
|
|
106
|
-
parentMarkingHash: await computeHash(JSON.stringify(params.markingTransition.before))
|
|
107
|
+
parentMarkingHash: await computeHash$1(JSON.stringify(params.markingTransition.before))
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
110
|
//#endregion
|
|
@@ -247,7 +248,7 @@ var POST = async ({ request }) => {
|
|
|
247
248
|
}
|
|
248
249
|
} catch {}
|
|
249
250
|
const pcard = {
|
|
250
|
-
hash:
|
|
251
|
+
hash: qualify(createRecord(action.pcardHandle)).asPrefixed(),
|
|
251
252
|
runtime,
|
|
252
253
|
concrete_impl: { runtime }
|
|
253
254
|
};
|
|
@@ -257,7 +258,7 @@ var POST = async ({ request }) => {
|
|
|
257
258
|
} catch {
|
|
258
259
|
const sealedVCard = await signVCard({
|
|
259
260
|
pcardHash: pcard.hash,
|
|
260
|
-
outputMCardHash:
|
|
261
|
+
outputMCardHash: qualify(createRecord(action.intent || "default-intent")).asPrefixed(),
|
|
261
262
|
sponsorDid: action.sponsorDid || "did:clm:agent:server",
|
|
262
263
|
markingTransition: {
|
|
263
264
|
before: action.currentMarking ?? {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { createRecord, qualify } from "clm-kernel";
|
|
3
3
|
//#region src/server/api/kernelDispatch.ts
|
|
4
4
|
async function handleKernelDispatch(intent, headers) {
|
|
5
5
|
if (headers.get("x-requested-with") !== "MCardStudio-BFF") return {
|
|
@@ -13,19 +13,19 @@ async function handleKernelDispatch(intent, headers) {
|
|
|
13
13
|
switch (intent.kind) {
|
|
14
14
|
case "TouchMCard": {
|
|
15
15
|
const content = intent.payload && intent.payload.content || "";
|
|
16
|
-
const hash =
|
|
16
|
+
const hash = qualify(createRecord(content)).asPrefixed();
|
|
17
17
|
return {
|
|
18
18
|
status: 200,
|
|
19
19
|
body: { events: [{
|
|
20
20
|
kind: "MCardTouched",
|
|
21
21
|
intentId: intent.id,
|
|
22
22
|
uri: intent.uri,
|
|
23
|
-
hash
|
|
23
|
+
hash
|
|
24
24
|
}] }
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
case "ReadMCard": {
|
|
28
|
-
const hash = intent.ref.kind === "hash" ? intent.ref.hash :
|
|
28
|
+
const hash = intent.ref.kind === "hash" ? intent.ref.hash : qualify(createRecord(intent.ref.handle)).asPrefixed();
|
|
29
29
|
return {
|
|
30
30
|
status: 200,
|
|
31
31
|
body: { events: [{
|
|
@@ -41,8 +41,8 @@ async function handleKernelDispatch(intent, headers) {
|
|
|
41
41
|
body: { events: [{
|
|
42
42
|
kind: "ExecutionReceipt",
|
|
43
43
|
intentId: intent.id,
|
|
44
|
-
receiptHash:
|
|
45
|
-
outputHash:
|
|
44
|
+
receiptHash: qualify(createRecord(intent.pcardRef)).asPrefixed(),
|
|
45
|
+
outputHash: qualify(createRecord(intent.inputRef || "")).asPrefixed(),
|
|
46
46
|
fiberId: `fiber:${intent.id}`
|
|
47
47
|
}] }
|
|
48
48
|
};
|
|
@@ -52,7 +52,7 @@ async function handleKernelDispatch(intent, headers) {
|
|
|
52
52
|
kind: "ContinuationResumed",
|
|
53
53
|
intentId: intent.id,
|
|
54
54
|
token: intent.token,
|
|
55
|
-
receiptHash:
|
|
55
|
+
receiptHash: qualify(createRecord(intent.token)).asPrefixed()
|
|
56
56
|
}] }
|
|
57
57
|
};
|
|
58
58
|
case "MembraneAction": return {
|
|
@@ -60,7 +60,7 @@ async function handleKernelDispatch(intent, headers) {
|
|
|
60
60
|
body: { events: [{
|
|
61
61
|
kind: "ActionApplied",
|
|
62
62
|
intentId: intent.id,
|
|
63
|
-
postHash:
|
|
63
|
+
postHash: qualify(createRecord(intent.action.type)).asPrefixed()
|
|
64
64
|
}] }
|
|
65
65
|
};
|
|
66
66
|
case "ObserveProcess": return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { n as getWhitelistedDirectoryProjections, t as PATHS } from "./
|
|
3
|
-
import { i as
|
|
2
|
+
import { n as getWhitelistedDirectoryProjections, t as PATHS } from "./pathsConfig_Dack-p2f.mjs";
|
|
3
|
+
import { i as repoRoot, o as workspaceRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
4
4
|
import { t as error } from "./apiUtils_B3BX89fM.mjs";
|
|
5
|
-
import { n as toTreeFiles, t as scanRoots } from "./
|
|
5
|
+
import { n as toTreeFiles, t as scanRoots } from "./vfsTreeScan_CRoCluPB.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { join } from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { t as getServerCordisContext } from "./
|
|
2
|
+
import { t as getServerCordisContext } from "./serverBootstrap_BDdSRIu5.mjs";
|
|
3
3
|
import { r as json } from "./apiUtils_B3BX89fM.mjs";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
2
|
import { f as renderTemplate, o as renderComponent } from "./server_DQgO1z9H.mjs";
|
|
3
3
|
import { t as createComponent } from "./compiler_jjPF-nBO.mjs";
|
|
4
|
-
import { t as $$StudioLayout } from "./
|
|
4
|
+
import { t as $$StudioLayout } from "./StudioLayout_taayQJ5b.mjs";
|
|
5
5
|
//#region src/pages/mcard-library.astro
|
|
6
6
|
var mcard_library_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
default: () => $$McardLibrary,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getWhitelistedDirectoryProjections, t as PATHS } from "./
|
|
2
|
-
import { t as studioMCardFs } from "./
|
|
3
|
-
import "./
|
|
1
|
+
import { n as getWhitelistedDirectoryProjections, t as PATHS } from "./pathsConfig_Dack-p2f.mjs";
|
|
2
|
+
import { a as STORE_HISTORY, c as openMigrationIndexedDb, i as STORE_HANDLES, o as STORE_LEGACY, r as STORE_CAS, s as STORE_SNAPSHOTS, t as studioMCardFs } from "./vfsCore_DIKpk-pk.mjs";
|
|
3
|
+
import "./cardTypeDetector_C55M_HWS.mjs";
|
|
4
4
|
import "clm-kernel";
|
|
5
5
|
import { atom, computed, map } from "nanostores";
|
|
6
6
|
import { initializeFaro } from "@grafana/faro-web-sdk";
|
|
@@ -417,39 +417,13 @@ var PersistenceFlushScheduler = class {
|
|
|
417
417
|
* Contract D budget: <= 250 LOC
|
|
418
418
|
*/
|
|
419
419
|
var WS_DIR$1 = PATHS.paths.workspace_dirname;
|
|
420
|
-
var DB_NAME = "clm_workbench_db";
|
|
421
|
-
var DB_VERSION = 2;
|
|
422
|
-
var STORE_CAS = "clm_cas_blobs";
|
|
423
|
-
var STORE_HANDLES = "clm_handle_registry";
|
|
424
|
-
var STORE_HISTORY = "clm_handle_history";
|
|
425
|
-
var STORE_SNAPSHOTS = "clm_sqlite_snapshots";
|
|
426
|
-
var STORE_LEGACY = "clm_content_memory_db";
|
|
427
|
-
function openIndexedDb() {
|
|
428
|
-
return new Promise((resolve, reject) => {
|
|
429
|
-
if (typeof window === "undefined" || !window.indexedDB) return reject(/* @__PURE__ */ new Error("IndexedDB not available"));
|
|
430
|
-
const req = window.indexedDB.open(DB_NAME, DB_VERSION);
|
|
431
|
-
req.onupgradeneeded = () => {
|
|
432
|
-
const db = req.result;
|
|
433
|
-
if (!db.objectStoreNames.contains("clm_cas_blobs")) db.createObjectStore(STORE_CAS, { keyPath: "hash" });
|
|
434
|
-
if (!db.objectStoreNames.contains("clm_handle_registry")) db.createObjectStore(STORE_HANDLES, { keyPath: "handle" });
|
|
435
|
-
if (!db.objectStoreNames.contains("clm_handle_history")) db.createObjectStore(STORE_HISTORY, {
|
|
436
|
-
keyPath: "id",
|
|
437
|
-
autoIncrement: true
|
|
438
|
-
});
|
|
439
|
-
if (!db.objectStoreNames.contains("clm_sqlite_snapshots")) db.createObjectStore(STORE_SNAPSHOTS, { keyPath: "id" });
|
|
440
|
-
if (!db.objectStoreNames.contains(STORE_LEGACY)) db.createObjectStore(STORE_LEGACY);
|
|
441
|
-
};
|
|
442
|
-
req.onsuccess = () => resolve(req.result);
|
|
443
|
-
req.onerror = () => reject(req.error);
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
420
|
async function performPersistenceFlush() {
|
|
447
421
|
if (typeof window === "undefined" || !window.indexedDB) return;
|
|
448
422
|
const tree = $mcardTree.get();
|
|
449
423
|
const entries = Object.values(tree);
|
|
450
424
|
const prefix = `${WS_DIR$1}:`;
|
|
451
425
|
const wsEntries = entries.filter((n) => n.handle.startsWith(prefix) || n.scope === WS_DIR$1 || n.path.startsWith(`${WS_DIR$1}/`));
|
|
452
|
-
const tx = (await
|
|
426
|
+
const tx = (await openMigrationIndexedDb()).transaction([
|
|
453
427
|
STORE_CAS,
|
|
454
428
|
STORE_HANDLES,
|
|
455
429
|
STORE_HISTORY,
|
|
@@ -458,6 +432,7 @@ async function performPersistenceFlush() {
|
|
|
458
432
|
], "readwrite");
|
|
459
433
|
const casStore = tx.objectStore(STORE_CAS);
|
|
460
434
|
const handleStore = tx.objectStore(STORE_HANDLES);
|
|
435
|
+
handleStore.clear();
|
|
461
436
|
for (const n of wsEntries) {
|
|
462
437
|
if (n.hash && n.content !== void 0) casStore.put({
|
|
463
438
|
hash: n.hash,
|