@adaas/a-frame 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.conf/tsconfig.browser.json +7 -1
- package/.conf/tsconfig.node.json +7 -1
- package/dist/browser/A-FrameBrowserStorageBlobs.context-CZTTvpn2.d.mts +53 -0
- package/dist/browser/A-FrameBrowserStorageBlobs.context-CaGTyatz.d.mts +40 -0
- package/dist/browser/A-FrameBrowserStorageBlobs.context-DjeEH8cn.d.mts +53 -0
- package/dist/browser/A-FrameBrowserStorageBlobs.context-vCsuTea9.d.mts +40 -0
- package/dist/browser/A-FrameBundle.types-LzfgdMiQ.d.mts +71 -0
- package/dist/browser/A-FrameChannel.component-4mTNctXL.d.mts +704 -0
- package/dist/browser/A-FrameChannel.types-BXEKJK9t.d.mts +205 -0
- package/dist/browser/A-FrameChannel.types-Ba3wgUZj.d.mts +199 -0
- package/dist/browser/A-FrameChannel.types-BfINhQZe.d.mts +145 -0
- package/dist/browser/A-FrameChannel.types-DfacgYL1.d.mts +199 -0
- package/dist/browser/A-FrameCompletion.entity-Dzy9sIa8.d.mts +72 -0
- package/dist/browser/A-FrameDefinition.entity-C1aK-gdl.d.mts +370 -0
- package/dist/browser/A-FrameDefinition.entity-CKPXsarS.d.mts +358 -0
- package/dist/browser/A-FrameDefinition.entity-yA0GsBoe.d.mts +143 -0
- package/dist/browser/A-FrameDefinition.types-BT02yAhQ.d.mts +232 -0
- package/dist/browser/A-FrameDynamicContentOperation.context-CoViNb19.d.mts +297 -0
- package/dist/browser/A-FrameDynamicContentOperation.context-Dd7Lb7X2.d.mts +266 -0
- package/dist/browser/A-FrameDynamicPatch.entity-BRuF1tqs.d.mts +29 -0
- package/dist/browser/A-FrameDynamicStructure.entity-DMvI_EPT.d.mts +210 -0
- package/dist/browser/A-FrameDynamicStructure.entity-DxkPP9mR.d.mts +235 -0
- package/dist/browser/A-FrameEnv.types-DnK-CYVk.d.mts +21 -0
- package/dist/browser/A-FrameNamespace.entity-BDg1FUgo.d.mts +136 -0
- package/dist/browser/A-FrameSchema.entity-DjYIhsoj.d.mts +141 -0
- package/dist/browser/A-FrameSegment.entity-D1xjjWvG.d.mts +161 -0
- package/dist/browser/A-FrameSegment.entity-D7Aj39Wh.d.mts +146 -0
- package/dist/browser/bundle.d.mts +6 -2
- package/dist/browser/bundle.mjs +1 -1
- package/dist/browser/bundle.mjs.map +1 -1
- package/dist/browser/channel.d.mts +51 -74
- package/dist/browser/channel.mjs +1 -2
- package/dist/browser/channel.mjs.map +1 -1
- package/dist/browser/chunk-2RNFZSBL.mjs +2 -0
- package/dist/browser/chunk-2RNFZSBL.mjs.map +1 -0
- package/dist/browser/chunk-46LRNZRG.mjs +2 -0
- package/dist/browser/chunk-46LRNZRG.mjs.map +1 -0
- package/dist/browser/chunk-52HFO3OY.mjs +2 -0
- package/dist/browser/chunk-52HFO3OY.mjs.map +1 -0
- package/dist/browser/chunk-643KGQKR.mjs +3 -0
- package/dist/browser/chunk-643KGQKR.mjs.map +1 -0
- package/dist/browser/chunk-66BBIZAM.mjs +3 -0
- package/dist/browser/chunk-66BBIZAM.mjs.map +1 -0
- package/dist/browser/chunk-6NPQURSO.mjs +2 -0
- package/dist/browser/chunk-6NPQURSO.mjs.map +1 -0
- package/dist/browser/chunk-6WAOMX7M.mjs +2 -0
- package/dist/browser/chunk-6WAOMX7M.mjs.map +1 -0
- package/dist/browser/chunk-77HU5SRQ.mjs +2 -0
- package/dist/browser/chunk-77HU5SRQ.mjs.map +1 -0
- package/dist/browser/chunk-AET6XULU.mjs +2 -0
- package/dist/browser/chunk-AET6XULU.mjs.map +1 -0
- package/dist/browser/chunk-BIBPE2GT.mjs +3 -0
- package/dist/browser/chunk-BIBPE2GT.mjs.map +1 -0
- package/dist/browser/chunk-CDJKU4DK.mjs +2 -0
- package/dist/browser/chunk-CDJKU4DK.mjs.map +1 -0
- package/dist/browser/chunk-CT67Y46H.mjs +3 -0
- package/dist/browser/chunk-CT67Y46H.mjs.map +1 -0
- package/dist/browser/chunk-EFC7OUNO.mjs +2 -0
- package/dist/browser/chunk-EFC7OUNO.mjs.map +1 -0
- package/dist/browser/chunk-EJIX7H7A.mjs +2 -0
- package/dist/browser/chunk-EJIX7H7A.mjs.map +1 -0
- package/dist/browser/chunk-FHJ5ATND.mjs +3 -0
- package/dist/browser/chunk-FHJ5ATND.mjs.map +1 -0
- package/dist/browser/chunk-FVH2EEVP.mjs +3 -0
- package/dist/browser/chunk-FVH2EEVP.mjs.map +1 -0
- package/dist/browser/chunk-G6ULYKSU.mjs +2 -0
- package/dist/browser/chunk-G6ULYKSU.mjs.map +1 -0
- package/dist/browser/chunk-G7MKGKG5.mjs +2 -0
- package/dist/browser/chunk-G7MKGKG5.mjs.map +1 -0
- package/dist/browser/chunk-GOMJPGVB.mjs +3 -0
- package/dist/browser/chunk-GOMJPGVB.mjs.map +1 -0
- package/dist/browser/chunk-INQV5UZA.mjs +2 -0
- package/dist/browser/chunk-INQV5UZA.mjs.map +1 -0
- package/dist/browser/chunk-INXPVBTZ.mjs +2 -0
- package/dist/browser/chunk-INXPVBTZ.mjs.map +1 -0
- package/dist/browser/chunk-KFMVTZ7T.mjs +2 -0
- package/dist/browser/chunk-KFMVTZ7T.mjs.map +1 -0
- package/dist/browser/chunk-LK6C7C3S.mjs +2 -0
- package/dist/browser/chunk-LK6C7C3S.mjs.map +1 -0
- package/dist/browser/chunk-LOGRQOWP.mjs +3 -0
- package/dist/browser/chunk-LOGRQOWP.mjs.map +1 -0
- package/dist/browser/chunk-LZACYSUC.mjs +3 -0
- package/dist/browser/chunk-LZACYSUC.mjs.map +1 -0
- package/dist/browser/chunk-NTOIVRX3.mjs +2 -0
- package/dist/browser/chunk-NTOIVRX3.mjs.map +1 -0
- package/dist/browser/chunk-OES2N3X7.mjs +3 -0
- package/dist/browser/chunk-OES2N3X7.mjs.map +1 -0
- package/dist/browser/chunk-OFKV5GNB.mjs +1 -1
- package/dist/browser/chunk-OFKV5GNB.mjs.map +1 -1
- package/dist/browser/chunk-OVLM5A32.mjs +3 -0
- package/dist/browser/chunk-OVLM5A32.mjs.map +1 -0
- package/dist/browser/chunk-QATIN7CO.mjs +1 -1
- package/dist/browser/chunk-QATIN7CO.mjs.map +1 -1
- package/dist/browser/chunk-QOL7CAUZ.mjs +2 -0
- package/dist/browser/chunk-QOL7CAUZ.mjs.map +1 -0
- package/dist/browser/chunk-RCB3PX4V.mjs +2 -0
- package/dist/browser/chunk-RCB3PX4V.mjs.map +1 -0
- package/dist/browser/chunk-RWQSCROK.mjs +3 -0
- package/dist/browser/chunk-RWQSCROK.mjs.map +1 -0
- package/dist/browser/chunk-TIAUMK2X.mjs +2 -0
- package/dist/browser/chunk-TIAUMK2X.mjs.map +1 -0
- package/dist/browser/chunk-TQPC5MYM.mjs +3 -0
- package/dist/browser/chunk-TQPC5MYM.mjs.map +1 -0
- package/dist/browser/chunk-UNIKTCXL.mjs +3 -0
- package/dist/browser/chunk-UNIKTCXL.mjs.map +1 -0
- package/dist/browser/chunk-UULJJ5C5.mjs +3 -0
- package/dist/browser/chunk-UULJJ5C5.mjs.map +1 -0
- package/dist/browser/chunk-VSSANMPF.mjs +2 -0
- package/dist/browser/chunk-VSSANMPF.mjs.map +1 -0
- package/dist/browser/chunk-VW2BZYNY.mjs +2 -0
- package/dist/browser/chunk-VW2BZYNY.mjs.map +1 -0
- package/dist/browser/chunk-WAXBOWM6.mjs +3 -0
- package/dist/browser/chunk-WAXBOWM6.mjs.map +1 -0
- package/dist/browser/chunk-WXCQCHAX.mjs +2 -0
- package/dist/browser/chunk-WXCQCHAX.mjs.map +1 -0
- package/dist/browser/chunk-XKKBIIZG.mjs +3 -0
- package/dist/browser/chunk-XKKBIIZG.mjs.map +1 -0
- package/dist/browser/chunk-XR7FVA5M.mjs +3 -0
- package/dist/browser/chunk-XR7FVA5M.mjs.map +1 -0
- package/dist/browser/chunk-YQJFTBGV.mjs +1 -1
- package/dist/browser/chunk-YQJFTBGV.mjs.map +1 -1
- package/dist/browser/chunk-YTAMZDWC.mjs +3 -0
- package/dist/browser/chunk-YTAMZDWC.mjs.map +1 -0
- package/dist/browser/chunk-ZEONOTRL.mjs +2 -0
- package/dist/browser/chunk-ZEONOTRL.mjs.map +1 -0
- package/dist/browser/completion.d.mts +10 -0
- package/dist/browser/completion.mjs +2 -0
- package/dist/browser/completion.mjs.map +1 -0
- package/dist/browser/core.d.mts +7 -6
- package/dist/browser/core.mjs +1 -1
- package/dist/browser/core.mjs.map +1 -1
- package/dist/browser/credentials.d.mts +74 -0
- package/dist/browser/credentials.mjs +2 -0
- package/dist/browser/credentials.mjs.map +1 -0
- package/dist/browser/definition.d.mts +3 -2
- package/dist/browser/definition.mjs +1 -1
- package/dist/browser/dynamic-content.d.mts +13 -0
- package/dist/browser/dynamic-content.mjs +2 -0
- package/dist/browser/dynamic-content.mjs.map +1 -0
- package/dist/browser/dynamic-feature.d.mts +66 -6
- package/dist/browser/dynamic-feature.mjs +3 -1
- package/dist/browser/dynamic-feature.mjs.map +1 -1
- package/dist/browser/dynamic-structure.d.mts +77 -3
- package/dist/browser/dynamic-structure.mjs +1 -1
- package/dist/browser/dynamic-structure.mjs.map +1 -1
- package/dist/browser/env.d.mts +16 -2
- package/dist/browser/env.mjs +1 -1
- package/dist/browser/frame-index.d.mts +70 -9
- package/dist/browser/frame-index.mjs +1 -1
- package/dist/browser/models.d.mts +64 -0
- package/dist/browser/models.mjs +2 -0
- package/dist/browser/models.mjs.map +1 -0
- package/dist/browser/namespace.d.mts +1 -1
- package/dist/browser/namespace.mjs +1 -1
- package/dist/browser/schema.d.mts +10 -0
- package/dist/browser/schema.mjs +2 -0
- package/dist/browser/schema.mjs.map +1 -0
- package/dist/browser/segment.d.mts +13 -0
- package/dist/browser/segment.mjs +2 -0
- package/dist/browser/segment.mjs.map +1 -0
- package/dist/browser/storage.d.mts +13 -7
- package/dist/browser/storage.mjs +1 -1
- package/dist/browser/vector.d.mts +7 -0
- package/dist/browser/vector.mjs +1 -1
- package/dist/cli.cjs +5593 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/node/A-FrameChannel.component--YErPxf4.d.mts +97 -0
- package/dist/node/A-FrameChannel.component-BjgqMh1B.d.ts +97 -0
- package/dist/node/A-FrameChannel.component-C0O3TaRD.d.ts +679 -0
- package/dist/node/A-FrameChannel.component-CgBZYBz0.d.mts +379 -0
- package/dist/node/A-FrameChannel.component-CkZserv3.d.ts +97 -0
- package/dist/node/A-FrameChannel.component-DMA-3sUB.d.mts +679 -0
- package/dist/node/A-FrameChannel.component-DYV8omYR.d.ts +379 -0
- package/dist/node/A-FrameChannel.component-DwgYNfFn.d.mts +97 -0
- package/dist/node/A-FrameChannel.types-B3_xWKEO.d.mts +151 -0
- package/dist/node/A-FrameChannel.types-BGcVXTqa.d.ts +205 -0
- package/dist/node/A-FrameChannel.types-Boi8QqDK.d.mts +205 -0
- package/dist/node/A-FrameChannel.types-BsE6bNky.d.mts +205 -0
- package/dist/node/A-FrameChannel.types-C-gxXl8m.d.ts +151 -0
- package/dist/node/A-FrameChannel.types-DD2B11rf.d.ts +205 -0
- package/dist/node/A-FrameChannel.types-DYMgRiCF.d.mts +205 -0
- package/dist/node/A-FrameChannel.types-DwyZRsOy.d.ts +205 -0
- package/dist/node/A-FrameCompletion.entity-Brx11JMp.d.ts +72 -0
- package/dist/node/A-FrameCompletion.entity-Dzy9sIa8.d.mts +72 -0
- package/dist/node/A-FrameDefinition.entity-BIF0sclD.d.ts +370 -0
- package/dist/node/A-FrameDefinition.entity-Bt9ua6cn.d.ts +358 -0
- package/dist/node/A-FrameDefinition.entity-C0kzaGJ0.d.ts +143 -0
- package/dist/node/A-FrameDefinition.entity-C1aK-gdl.d.mts +370 -0
- package/dist/node/A-FrameDefinition.entity-CKPXsarS.d.mts +358 -0
- package/dist/node/A-FrameDefinition.entity-yA0GsBoe.d.mts +143 -0
- package/dist/node/A-FrameDefinition.types-BA_pLGpo.d.ts +232 -0
- package/dist/node/A-FrameDefinition.types-BT02yAhQ.d.mts +232 -0
- package/dist/node/A-FrameDynamicContentOperation.context-C_aH1gEn.d.ts +297 -0
- package/dist/node/A-FrameDynamicContentOperation.context-CoViNb19.d.mts +297 -0
- package/dist/node/A-FrameDynamicContentOperation.context-DRqH2c3o.d.ts +266 -0
- package/dist/node/A-FrameDynamicContentOperation.context-Dd7Lb7X2.d.mts +266 -0
- package/dist/node/A-FrameDynamicPatch.entity-BRuF1tqs.d.mts +29 -0
- package/dist/node/A-FrameDynamicPatch.entity-BRuF1tqs.d.ts +29 -0
- package/dist/node/A-FrameDynamicStructure.entity-BVCbolMd.d.ts +210 -0
- package/dist/node/A-FrameDynamicStructure.entity-DMvI_EPT.d.mts +210 -0
- package/dist/node/A-FrameDynamicStructure.entity-DxkPP9mR.d.mts +235 -0
- package/dist/node/A-FrameDynamicStructure.entity-DxkPP9mR.d.ts +235 -0
- package/dist/node/A-FrameLogger.component.env-node-DIDBeuiz.d.mts +114 -0
- package/dist/node/A-FrameLogger.component.env-node-DIDBeuiz.d.ts +114 -0
- package/dist/node/A-FrameNamespace.entity-BDg1FUgo.d.mts +136 -0
- package/dist/node/A-FrameNamespace.entity-HDXcLGcS.d.ts +136 -0
- package/dist/node/A-FrameSchema.entity-DjYIhsoj.d.mts +141 -0
- package/dist/node/A-FrameSchema.entity-DjYIhsoj.d.ts +141 -0
- package/dist/node/A-FrameSegment.entity-C0izuOmC.d.ts +161 -0
- package/dist/node/A-FrameSegment.entity-CMCgFCWU.d.ts +146 -0
- package/dist/node/A-FrameSegment.entity-D1xjjWvG.d.mts +161 -0
- package/dist/node/A-FrameSegment.entity-D7Aj39Wh.d.mts +146 -0
- package/dist/node/A-FrameStorage.component-BnNKzvpY.d.mts +107 -0
- package/dist/node/A-FrameStorage.component-CDztogHV.d.mts +107 -0
- package/dist/node/A-FrameStorage.component-CW0YgKDI.d.mts +107 -0
- package/dist/node/A-FrameStorage.component-D4UEkIBx.d.mts +107 -0
- package/dist/node/A-FrameStorage.component-DV_jwK6r.d.ts +107 -0
- package/dist/node/A-FrameStorage.component-Di4EvbtC.d.ts +107 -0
- package/dist/node/A-FrameStorage.component-emIH1a1M.d.ts +107 -0
- package/dist/node/A-FrameStorage.component-y-JPiIQ4.d.ts +107 -0
- package/dist/node/bundle.cjs +66 -21
- package/dist/node/bundle.cjs.map +1 -1
- package/dist/node/bundle.d.mts +88 -24
- package/dist/node/bundle.d.ts +88 -24
- package/dist/node/bundle.mjs +65 -20
- package/dist/node/bundle.mjs.map +1 -1
- package/dist/node/channel.cjs +33 -26
- package/dist/node/channel.d.mts +10 -6
- package/dist/node/channel.d.ts +10 -6
- package/dist/node/channel.mjs +13 -6
- package/dist/node/chunk-2HUSP34L.mjs +55 -0
- package/dist/node/chunk-2HUSP34L.mjs.map +1 -0
- package/dist/node/chunk-2KXGI2E5.cjs +474 -0
- package/dist/node/chunk-2KXGI2E5.cjs.map +1 -0
- package/dist/node/chunk-2OQMOIR5.mjs +170 -0
- package/dist/node/chunk-2OQMOIR5.mjs.map +1 -0
- package/dist/node/chunk-2UI7RJ4Q.mjs +207 -0
- package/dist/node/chunk-2UI7RJ4Q.mjs.map +1 -0
- package/dist/node/chunk-3SLICJ3L.cjs +265 -0
- package/dist/node/chunk-3SLICJ3L.cjs.map +1 -0
- package/dist/node/chunk-3ZDHQOIU.cjs +92 -0
- package/dist/node/chunk-3ZDHQOIU.cjs.map +1 -0
- package/dist/node/chunk-5BKCX2RO.mjs +1 -1
- package/dist/node/chunk-5BKCX2RO.mjs.map +1 -1
- package/dist/node/chunk-5NCGXLP2.mjs +6 -0
- package/dist/node/chunk-5NCGXLP2.mjs.map +1 -0
- package/dist/node/chunk-5OTXZ7BB.mjs +53 -0
- package/dist/node/chunk-5OTXZ7BB.mjs.map +1 -0
- package/dist/node/chunk-5PYIATGT.mjs +469 -0
- package/dist/node/chunk-5PYIATGT.mjs.map +1 -0
- package/dist/node/chunk-64QCZG53.cjs +57 -0
- package/dist/node/chunk-64QCZG53.cjs.map +1 -0
- package/dist/node/chunk-652OEICJ.cjs +4 -0
- package/dist/node/chunk-652OEICJ.cjs.map +1 -0
- package/dist/node/chunk-674ZX6XJ.mjs +187 -0
- package/dist/node/chunk-674ZX6XJ.mjs.map +1 -0
- package/dist/node/chunk-6ID2IXYX.mjs +6 -0
- package/dist/node/chunk-6ID2IXYX.mjs.map +1 -0
- package/dist/node/chunk-7EM3Q7HA.mjs +655 -0
- package/dist/node/chunk-7EM3Q7HA.mjs.map +1 -0
- package/dist/node/chunk-7MVVMISA.cjs +293 -0
- package/dist/node/chunk-7MVVMISA.cjs.map +1 -0
- package/dist/node/chunk-7NSLGCAZ.mjs +1395 -0
- package/dist/node/chunk-7NSLGCAZ.mjs.map +1 -0
- package/dist/node/chunk-7OLLATCC.mjs +1289 -0
- package/dist/node/chunk-7OLLATCC.mjs.map +1 -0
- package/dist/node/chunk-7SEZMRLI.cjs +183 -0
- package/dist/node/chunk-7SEZMRLI.cjs.map +1 -0
- package/dist/node/chunk-A4CVDMSV.mjs +608 -0
- package/dist/node/chunk-A4CVDMSV.mjs.map +1 -0
- package/dist/node/chunk-A7CJIUYY.cjs +4 -0
- package/dist/node/chunk-A7CJIUYY.cjs.map +1 -0
- package/dist/node/chunk-ALFFUJ2J.mjs +163 -0
- package/dist/node/chunk-ALFFUJ2J.mjs.map +1 -0
- package/dist/node/chunk-AMMQ76RJ.mjs +179 -0
- package/dist/node/chunk-AMMQ76RJ.mjs.map +1 -0
- package/dist/node/chunk-AUKWKGVA.cjs +688 -0
- package/dist/node/chunk-AUKWKGVA.cjs.map +1 -0
- package/dist/node/chunk-AY6UMDWD.cjs +270 -0
- package/dist/node/chunk-AY6UMDWD.cjs.map +1 -0
- package/dist/node/chunk-B7ZDJXD3.cjs +1 -1
- package/dist/node/chunk-B7ZDJXD3.cjs.map +1 -1
- package/dist/node/chunk-BBYOL3LM.cjs +1308 -0
- package/dist/node/chunk-BBYOL3LM.cjs.map +1 -0
- package/dist/node/chunk-BINGAHFW.cjs +1308 -0
- package/dist/node/chunk-BINGAHFW.cjs.map +1 -0
- package/dist/node/chunk-BSBY37MG.cjs +55 -0
- package/dist/node/chunk-BSBY37MG.cjs.map +1 -0
- package/dist/node/chunk-BWX7HFTH.cjs +209 -0
- package/dist/node/chunk-BWX7HFTH.cjs.map +1 -0
- package/dist/node/chunk-C37B34MH.cjs +188 -0
- package/dist/node/chunk-C37B34MH.cjs.map +1 -0
- package/dist/node/chunk-C6BBKHQG.cjs +250 -0
- package/dist/node/chunk-C6BBKHQG.cjs.map +1 -0
- package/dist/node/chunk-CLCAS67N.cjs +8 -0
- package/dist/node/chunk-CLCAS67N.cjs.map +1 -0
- package/dist/node/chunk-CNU3CRTR.mjs +43 -0
- package/dist/node/chunk-CNU3CRTR.mjs.map +1 -0
- package/dist/node/chunk-CV5FPKU6.mjs +6 -0
- package/dist/node/chunk-CV5FPKU6.mjs.map +1 -0
- package/dist/node/chunk-CZYOAFIR.mjs +129 -0
- package/dist/node/chunk-CZYOAFIR.mjs.map +1 -0
- package/dist/node/chunk-D2HTYEJZ.cjs +209 -0
- package/dist/node/chunk-D2HTYEJZ.cjs.map +1 -0
- package/dist/node/chunk-EMLZZPOT.cjs +1446 -0
- package/dist/node/chunk-EMLZZPOT.cjs.map +1 -0
- package/dist/node/chunk-EOIXXXBV.cjs +55 -0
- package/dist/node/chunk-EOIXXXBV.cjs.map +1 -0
- package/dist/node/chunk-F4UCOZW5.mjs +1 -1
- package/dist/node/chunk-F4UCOZW5.mjs.map +1 -1
- package/dist/node/chunk-F64CK4NI.mjs +53 -0
- package/dist/node/chunk-F64CK4NI.mjs.map +1 -0
- package/dist/node/chunk-FAV62EUG.cjs +35 -0
- package/dist/node/chunk-FAV62EUG.cjs.map +1 -0
- package/dist/node/chunk-GHSPKZUN.mjs +529 -0
- package/dist/node/chunk-GHSPKZUN.mjs.map +1 -0
- package/dist/node/chunk-GRNVK7DW.mjs +97 -0
- package/dist/node/chunk-GRNVK7DW.mjs.map +1 -0
- package/dist/node/chunk-H5VGRPD5.cjs +8 -0
- package/dist/node/chunk-H5VGRPD5.cjs.map +1 -0
- package/dist/node/chunk-HAMDDCPS.cjs +8 -0
- package/dist/node/chunk-HAMDDCPS.cjs.map +1 -0
- package/dist/node/chunk-HAORARSB.cjs +75 -0
- package/dist/node/chunk-HAORARSB.cjs.map +1 -0
- package/dist/node/chunk-HELNAM5Y.cjs +8 -0
- package/dist/node/chunk-HELNAM5Y.cjs.map +1 -0
- package/dist/node/chunk-HET6L5PD.mjs +530 -0
- package/dist/node/chunk-HET6L5PD.mjs.map +1 -0
- package/dist/node/chunk-HI5SEX53.mjs +264 -0
- package/dist/node/chunk-HI5SEX53.mjs.map +1 -0
- package/dist/node/chunk-HZGFXE4Q.mjs +6 -0
- package/dist/node/chunk-HZGFXE4Q.mjs.map +1 -0
- package/dist/node/chunk-IAL2NK2V.mjs +73 -0
- package/dist/node/chunk-IAL2NK2V.mjs.map +1 -0
- package/dist/node/chunk-IHELFDCW.mjs +327 -0
- package/dist/node/chunk-IHELFDCW.mjs.map +1 -0
- package/dist/node/chunk-ILD6OSYW.mjs +966 -0
- package/dist/node/chunk-ILD6OSYW.mjs.map +1 -0
- package/dist/node/chunk-IP6DFAO7.mjs +264 -0
- package/dist/node/chunk-IP6DFAO7.mjs.map +1 -0
- package/dist/node/chunk-IYEDO7OQ.cjs +276 -0
- package/dist/node/chunk-IYEDO7OQ.cjs.map +1 -0
- package/dist/node/chunk-JFPGFPQD.mjs +1413 -0
- package/dist/node/chunk-JFPGFPQD.mjs.map +1 -0
- package/dist/node/chunk-JHZGTVYF.cjs +999 -0
- package/dist/node/chunk-JHZGTVYF.cjs.map +1 -0
- package/dist/node/chunk-JN3UJBUH.mjs +608 -0
- package/dist/node/chunk-JN3UJBUH.mjs.map +1 -0
- package/dist/node/chunk-JNPDXCCN.mjs +530 -0
- package/dist/node/chunk-JNPDXCCN.mjs.map +1 -0
- package/dist/node/chunk-JQBYDEMW.mjs +1 -1
- package/dist/node/chunk-JQBYDEMW.mjs.map +1 -1
- package/dist/node/chunk-JQJ7N4NL.cjs +267 -0
- package/dist/node/chunk-JQJ7N4NL.cjs.map +1 -0
- package/dist/node/chunk-K4AJBPPY.cjs +174 -0
- package/dist/node/chunk-K4AJBPPY.cjs.map +1 -0
- package/dist/node/chunk-K7SXPJPK.cjs +131 -0
- package/dist/node/chunk-K7SXPJPK.cjs.map +1 -0
- package/dist/node/chunk-KFW4GE7H.mjs +1289 -0
- package/dist/node/chunk-KFW4GE7H.mjs.map +1 -0
- package/dist/node/chunk-KKL2DF2D.cjs +518 -0
- package/dist/node/chunk-KKL2DF2D.cjs.map +1 -0
- package/dist/node/chunk-KKMKQGTR.cjs +620 -0
- package/dist/node/chunk-KKMKQGTR.cjs.map +1 -0
- package/dist/node/chunk-KNTO7FCZ.mjs +207 -0
- package/dist/node/chunk-KNTO7FCZ.mjs.map +1 -0
- package/dist/node/chunk-KTKVW3PH.mjs +286 -0
- package/dist/node/chunk-KTKVW3PH.mjs.map +1 -0
- package/dist/node/chunk-KZPSF32W.mjs +33 -0
- package/dist/node/chunk-KZPSF32W.mjs.map +1 -0
- package/dist/node/chunk-LWKFCMA7.mjs +129 -0
- package/dist/node/chunk-LWKFCMA7.mjs.map +1 -0
- package/dist/node/chunk-M2ZSE6YJ.mjs +512 -0
- package/dist/node/chunk-M2ZSE6YJ.mjs.map +1 -0
- package/dist/node/chunk-M6DJYGDO.cjs +167 -0
- package/dist/node/chunk-M6DJYGDO.cjs.map +1 -0
- package/dist/node/chunk-MAHKDTOQ.mjs +3 -0
- package/dist/node/chunk-MAHKDTOQ.mjs.map +1 -0
- package/dist/node/chunk-MM2R2OM6.cjs +541 -0
- package/dist/node/chunk-MM2R2OM6.cjs.map +1 -0
- package/dist/node/chunk-MSOD5UQH.cjs +45 -0
- package/dist/node/chunk-MSOD5UQH.cjs.map +1 -0
- package/dist/node/chunk-MVAWR76Q.cjs +276 -0
- package/dist/node/chunk-MVAWR76Q.cjs.map +1 -0
- package/dist/node/chunk-MXUO7OR5.cjs +97 -0
- package/dist/node/chunk-MXUO7OR5.cjs.map +1 -0
- package/dist/node/chunk-N4THTV6P.cjs +131 -0
- package/dist/node/chunk-N4THTV6P.cjs.map +1 -0
- package/dist/node/chunk-NIXKAQVP.cjs +1 -1
- package/dist/node/chunk-NIXKAQVP.cjs.map +1 -1
- package/dist/node/chunk-NUPXUUPM.cjs +1428 -0
- package/dist/node/chunk-NUPXUUPM.cjs.map +1 -0
- package/dist/node/chunk-NWOUVAIS.cjs +45 -0
- package/dist/node/chunk-NWOUVAIS.cjs.map +1 -0
- package/dist/node/chunk-OK7I5OQ3.mjs +89 -0
- package/dist/node/chunk-OK7I5OQ3.mjs.map +1 -0
- package/dist/node/chunk-OMGYXCFM.mjs +248 -0
- package/dist/node/chunk-OMGYXCFM.mjs.map +1 -0
- package/dist/node/chunk-OYZAQMKD.mjs +263 -0
- package/dist/node/chunk-OYZAQMKD.mjs.map +1 -0
- package/dist/node/chunk-P2LULMNL.cjs +189 -0
- package/dist/node/chunk-P2LULMNL.cjs.map +1 -0
- package/dist/node/chunk-PABEFHCO.mjs +63 -0
- package/dist/node/chunk-PABEFHCO.mjs.map +1 -0
- package/dist/node/chunk-Q5NYJQP2.cjs +8 -0
- package/dist/node/chunk-Q5NYJQP2.cjs.map +1 -0
- package/dist/node/chunk-QCEWWJ3N.cjs +65 -0
- package/dist/node/chunk-QCEWWJ3N.cjs.map +1 -0
- package/dist/node/chunk-QW4AZ3Z2.cjs +542 -0
- package/dist/node/chunk-QW4AZ3Z2.cjs.map +1 -0
- package/dist/node/chunk-RK5WSZ5J.mjs +43 -0
- package/dist/node/chunk-RK5WSZ5J.mjs.map +1 -0
- package/dist/node/chunk-RPHYBPXT.mjs +30 -0
- package/dist/node/chunk-RPHYBPXT.mjs.map +1 -0
- package/dist/node/chunk-RVXASBMQ.mjs +273 -0
- package/dist/node/chunk-RVXASBMQ.mjs.map +1 -0
- package/dist/node/chunk-RVZTZD32.mjs +187 -0
- package/dist/node/chunk-RVZTZD32.mjs.map +1 -0
- package/dist/node/chunk-RWLKISZQ.mjs +273 -0
- package/dist/node/chunk-RWLKISZQ.mjs.map +1 -0
- package/dist/node/chunk-SESXQJDD.cjs +999 -0
- package/dist/node/chunk-SESXQJDD.cjs.map +1 -0
- package/dist/node/chunk-SKIEPTFS.mjs +6 -0
- package/dist/node/chunk-SKIEPTFS.mjs.map +1 -0
- package/dist/node/chunk-SL7FT5R5.mjs +94 -0
- package/dist/node/chunk-SL7FT5R5.mjs.map +1 -0
- package/dist/node/chunk-SXHQW74T.mjs +43 -0
- package/dist/node/chunk-SXHQW74T.mjs.map +1 -0
- package/dist/node/chunk-TEJKDVNT.cjs +620 -0
- package/dist/node/chunk-TEJKDVNT.cjs.map +1 -0
- package/dist/node/chunk-TQS5WYND.cjs +352 -0
- package/dist/node/chunk-TQS5WYND.cjs.map +1 -0
- package/dist/node/chunk-UCAWV2IG.mjs +184 -0
- package/dist/node/chunk-UCAWV2IG.mjs.map +1 -0
- package/dist/node/chunk-UDUJDEAO.cjs +189 -0
- package/dist/node/chunk-UDUJDEAO.cjs.map +1 -0
- package/dist/node/chunk-VMJDL4SS.cjs +542 -0
- package/dist/node/chunk-VMJDL4SS.cjs.map +1 -0
- package/dist/node/chunk-VNOZTB3B.cjs +8 -0
- package/dist/node/chunk-VNOZTB3B.cjs.map +1 -0
- package/dist/node/chunk-VPMBZGYR.mjs +327 -0
- package/dist/node/chunk-VPMBZGYR.mjs.map +1 -0
- package/dist/node/chunk-WEPNBKOA.mjs +6 -0
- package/dist/node/chunk-WEPNBKOA.mjs.map +1 -0
- package/dist/node/chunk-WTBRJXFG.cjs +100 -0
- package/dist/node/chunk-WTBRJXFG.cjs.map +1 -0
- package/dist/node/chunk-WXCQCHAX.mjs +3 -0
- package/dist/node/chunk-WXCQCHAX.mjs.map +1 -0
- package/dist/node/chunk-X3TRPYGV.cjs +352 -0
- package/dist/node/chunk-X3TRPYGV.cjs.map +1 -0
- package/dist/node/chunk-XFUF7SDO.cjs +1 -1
- package/dist/node/chunk-XFUF7SDO.cjs.map +1 -1
- package/dist/node/chunk-XP2EPEBM.mjs +966 -0
- package/dist/node/chunk-XP2EPEBM.mjs.map +1 -0
- package/dist/node/chunk-XPIJ6BKP.cjs +45 -0
- package/dist/node/chunk-XPIJ6BKP.cjs.map +1 -0
- package/dist/node/chunk-YRVBMP7I.cjs +542 -0
- package/dist/node/chunk-YRVBMP7I.cjs.map +1 -0
- package/dist/node/chunk-ZIHSN5EE.mjs +530 -0
- package/dist/node/chunk-ZIHSN5EE.mjs.map +1 -0
- package/dist/node/chunk-ZNQMUU7I.cjs +32 -0
- package/dist/node/chunk-ZNQMUU7I.cjs.map +1 -0
- package/dist/node/completion.cjs +23 -0
- package/dist/node/completion.cjs.map +1 -0
- package/dist/node/completion.d.mts +10 -0
- package/dist/node/completion.d.ts +10 -0
- package/dist/node/completion.mjs +6 -0
- package/dist/node/completion.mjs.map +1 -0
- package/dist/node/core.cjs +67 -38
- package/dist/node/core.cjs.map +1 -1
- package/dist/node/core.d.mts +13 -8
- package/dist/node/core.d.ts +13 -8
- package/dist/node/core.mjs +58 -29
- package/dist/node/core.mjs.map +1 -1
- package/dist/node/credentials.cjs +17 -0
- package/dist/node/credentials.cjs.map +1 -0
- package/dist/node/credentials.d.mts +74 -0
- package/dist/node/credentials.d.ts +74 -0
- package/dist/node/credentials.mjs +4 -0
- package/dist/node/credentials.mjs.map +1 -0
- package/dist/node/definition.cjs +6 -4
- package/dist/node/definition.d.mts +3 -2
- package/dist/node/definition.d.ts +3 -2
- package/dist/node/definition.mjs +4 -2
- package/dist/node/dynamic-content.cjs +30 -0
- package/dist/node/dynamic-content.cjs.map +1 -0
- package/dist/node/dynamic-content.d.mts +13 -0
- package/dist/node/dynamic-content.d.ts +13 -0
- package/dist/node/dynamic-content.mjs +9 -0
- package/dist/node/dynamic-content.mjs.map +1 -0
- package/dist/node/dynamic-feature.cjs +41 -7
- package/dist/node/dynamic-feature.cjs.map +1 -1
- package/dist/node/dynamic-feature.d.mts +66 -6
- package/dist/node/dynamic-feature.d.ts +66 -6
- package/dist/node/dynamic-feature.mjs +16 -9
- package/dist/node/dynamic-feature.mjs.map +1 -1
- package/dist/node/dynamic-structure.cjs +45 -136
- package/dist/node/dynamic-structure.cjs.map +1 -1
- package/dist/node/dynamic-structure.d.mts +77 -3
- package/dist/node/dynamic-structure.d.ts +77 -3
- package/dist/node/dynamic-structure.mjs +16 -135
- package/dist/node/dynamic-structure.mjs.map +1 -1
- package/dist/node/env.cjs +3 -3
- package/dist/node/env.d.mts +26 -0
- package/dist/node/env.d.ts +26 -0
- package/dist/node/env.mjs +2 -2
- package/dist/node/frame-index.cjs +7 -4
- package/dist/node/frame-index.d.mts +70 -9
- package/dist/node/frame-index.d.ts +70 -9
- package/dist/node/frame-index.mjs +6 -3
- package/dist/node/logger.d.mts +4 -113
- package/dist/node/logger.d.ts +4 -113
- package/dist/node/models.cjs +14 -0
- package/dist/node/models.cjs.map +1 -0
- package/dist/node/models.d.mts +64 -0
- package/dist/node/models.d.ts +64 -0
- package/dist/node/models.mjs +5 -0
- package/dist/node/models.mjs.map +1 -0
- package/dist/node/namespace.cjs +7 -5
- package/dist/node/namespace.d.mts +1 -1
- package/dist/node/namespace.d.ts +1 -1
- package/dist/node/namespace.mjs +4 -2
- package/dist/node/schema.cjs +22 -0
- package/dist/node/schema.cjs.map +1 -0
- package/dist/node/schema.d.mts +10 -0
- package/dist/node/schema.d.ts +10 -0
- package/dist/node/schema.mjs +5 -0
- package/dist/node/schema.mjs.map +1 -0
- package/dist/node/segment.cjs +25 -0
- package/dist/node/segment.cjs.map +1 -0
- package/dist/node/segment.d.mts +13 -0
- package/dist/node/segment.d.ts +13 -0
- package/dist/node/segment.mjs +8 -0
- package/dist/node/segment.mjs.map +1 -0
- package/dist/node/storage.cjs +17 -14
- package/dist/node/storage.d.mts +18 -6
- package/dist/node/storage.d.ts +18 -6
- package/dist/node/storage.mjs +11 -8
- package/dist/node/vector.cjs +2 -2
- package/dist/node/vector.d.mts +7 -0
- package/dist/node/vector.d.ts +7 -0
- package/dist/node/vector.mjs +1 -1
- package/examples/article/main.ts +358 -0
- package/examples/components.ts +660 -0
- package/examples/feature/file-system.components.ts +211 -0
- package/examples/feature/main.ts +374 -0
- package/examples/interaction/main.ts +426 -0
- package/examples/logger.ts +126 -0
- package/examples/structure/main.ts +195 -0
- package/examples/structure/renderer.ts +296 -0
- package/examples/structure/server-app.components.ts +387 -0
- package/jest.config.browser.ts +9 -0
- package/jest.config.examples.ts +49 -0
- package/jest.config.integration.ts +38 -0
- package/jest.config.ts +56 -27
- package/jest.config.unit.ts +38 -0
- package/package.json +75 -7
- package/src/index.ts +13 -0
- package/src/lib/A-Frame/A-Frame.component.env-browser.ts +14 -3
- package/src/lib/A-Frame/A-Frame.component.env-node.ts +45 -15
- package/src/lib/A-Frame/A-Frame.context.ts +9 -8
- package/src/lib/A-Frame/decorators/A-FrameDefine.decorator.ts +4 -4
- package/src/lib/A-FrameBundle/A-FrameBundle.builder.env-node.ts +95 -25
- package/src/lib/A-FrameBundle/A-FrameBundle.constants.ts +1 -1
- package/src/lib/A-FrameBundle/A-FrameBundle.types.ts +54 -13
- package/src/lib/A-FrameBundle/index.browser.ts +1 -1
- package/src/lib/A-FrameBundle/index.ts +1 -1
- package/src/lib/A-FrameCLI/A-FrameCLI.container.ts +18 -7
- package/src/lib/A-FrameChannel/A-FrameChannel.component.env-browser.ts +0 -2
- package/src/lib/A-FrameChannel/A-FrameChannel.component.env-node.ts +14 -15
- package/src/lib/A-FrameChannel/A-FrameChannel.component.ts +542 -7
- package/src/lib/A-FrameChannel/A-FrameChannel.constants.ts +2 -0
- package/src/lib/A-FrameChannel/A-FrameChannel.types.ts +65 -1
- package/src/lib/A-FrameChannel/A-FrameChannelDsgStream.entity.ts +112 -0
- package/src/lib/A-FrameChannel/A-FrameChannelStream.entity.ts +1 -0
- package/src/lib/A-FrameChannel/index.browser.ts +5 -0
- package/src/lib/A-FrameCompletion/A-FrameCompletion.constants.ts +3 -0
- package/src/lib/A-FrameCompletion/A-FrameCompletion.entity.ts +128 -0
- package/src/lib/A-FrameCompletion/A-FrameCompletion.types.ts +40 -0
- package/src/lib/A-FrameCompletion/index.ts +3 -0
- package/src/lib/A-FrameCredentials/A-FrameCredentials.constants.ts +5 -0
- package/src/lib/A-FrameCredentials/A-FrameCredentials.entity.ts +120 -0
- package/src/lib/A-FrameCredentials/A-FrameCredentials.types.ts +39 -0
- package/src/lib/A-FrameCredentials/index.ts +3 -0
- package/src/lib/A-FrameDefinition/A-FrameDefinition.entity.ts +23 -1
- package/src/lib/A-FrameDefinition/A-FrameDefinition.types.ts +34 -1
- package/src/lib/A-FrameDynamicContent/A-FrameDynamicContent.constants.ts +5 -0
- package/src/lib/A-FrameDynamicContent/A-FrameDynamicContent.entity.ts +348 -0
- package/src/lib/A-FrameDynamicContent/A-FrameDynamicContent.error.ts +10 -0
- package/src/lib/A-FrameDynamicContent/A-FrameDynamicContent.types.ts +116 -0
- package/src/lib/A-FrameDynamicContent/A-FrameDynamicContentIndex.context.ts +288 -0
- package/src/lib/A-FrameDynamicContent/A-FrameDynamicContentOperation.context.ts +26 -0
- package/src/lib/A-FrameDynamicContent/index.ts +5 -0
- package/src/lib/A-FrameDynamicFeature/A-FrameDynamicFeature.constants.ts +6 -0
- package/src/lib/A-FrameDynamicFeature/A-FrameDynamicFeature.entity.ts +253 -4
- package/src/lib/A-FrameDynamicFeature/A-FrameDynamicFeature.error.ts +11 -0
- package/src/lib/A-FrameDynamicFeature/A-FrameDynamicFeature.types.ts +188 -4
- package/src/lib/A-FrameDynamicFeature/A-FrameDynamicFeatureOperation.context.ts +33 -0
- package/src/lib/A-FrameDynamicFeature/A-FrameMethodMapIndex.context.ts +99 -0
- package/src/lib/A-FrameDynamicFeature/A-FrameMethodMapper.component.ts +182 -0
- package/src/lib/A-FrameDynamicFeature/index.ts +6 -1
- package/src/lib/A-FrameDynamicPatch/index.ts +2 -0
- package/src/lib/A-FrameDynamicStructure/A-FrameComponentMapIndex.context.ts +99 -0
- package/src/lib/A-FrameDynamicStructure/A-FrameComponentMapper.component.ts +320 -0
- package/src/lib/A-FrameDynamicStructure/A-FrameDynamicStructure.constants.ts +2 -1
- package/src/lib/A-FrameDynamicStructure/A-FrameDynamicStructure.entity.ts +240 -128
- package/src/lib/A-FrameDynamicStructure/A-FrameDynamicStructure.types.ts +183 -87
- package/src/lib/A-FrameDynamicStructure/index.ts +3 -0
- package/src/lib/A-FrameEnv/A-FrameEnv.fragment.env-browser.ts +5 -1
- package/src/lib/A-FrameEnv/A-FrameEnv.fragment.env-node.ts +23 -1
- package/src/lib/A-FrameEnv/A-FrameEnv.types.ts +12 -0
- package/src/lib/A-FrameIndex/A-FrameIndex.context.ts +63 -13
- package/src/lib/A-FrameIndex/A-FrameIndex.types.ts +53 -0
- package/src/lib/A-FrameModels/A-FrameModels.constants.ts +75 -0
- package/src/lib/A-FrameModels/index.ts +1 -0
- package/src/lib/A-FrameNamespace/A-FrameNamespace.entity.ts +10 -3
- package/src/lib/A-FrameNamespace/A-FrameNamespace.types.ts +5 -0
- package/src/lib/A-FrameSchema/A-FrameSchema.constants.ts +4 -0
- package/src/lib/A-FrameSchema/A-FrameSchema.entity.ts +154 -0
- package/src/lib/A-FrameSchema/A-FrameSchema.types.ts +88 -0
- package/src/lib/A-FrameSchema/index.ts +3 -0
- package/src/lib/A-FrameSegment/A-FrameSegment.constants.ts +12 -0
- package/src/lib/A-FrameSegment/A-FrameSegment.entity.ts +221 -0
- package/src/lib/A-FrameSegment/A-FrameSegment.types.ts +91 -0
- package/src/lib/A-FrameSegment/index.ts +3 -0
- package/src/lib/A-FrameStorage/A-FrameStorage.codec.ts +10 -4
- package/src/lib/A-FrameStorage/browser/A-FrameBrowserStorage.component.ts +21 -0
- package/src/lib/A-FrameStorage/browser/A-FrameBrowserStorageBlobs.context.ts +39 -21
- package/src/lib/A-FrameStorage/node/A-FrameNodeStorage.component.ts +124 -42
- package/src/lib/A-FrameVector/A-FrameVector.entity.ts +24 -0
- package/tests/A-Frame.browser.test.ts +167 -57
- package/tests/A-FrameDynamicContent.browser.test.ts +74 -0
- package/tests/integration/A-Frame.integration.test.ts +272 -0
- package/tests/integration/A-FrameCompletion.integration.test.ts +88 -0
- package/tests/integration/A-FrameContentMapping.integration.test.ts +261 -0
- package/tests/integration/A-FrameDefinition.integration.test.ts +154 -0
- package/tests/integration/A-FrameDynamicContent.integration.test.ts +126 -0
- package/tests/integration/A-FrameDynamicFeature.integration.test.ts +337 -0
- package/tests/integration/A-FrameDynamicStructure.integration.test.ts +264 -0
- package/tests/integration/A-FrameNamespace.integration.test.ts +109 -0
- package/tests/integration/A-FrameSchema.integration.test.ts +74 -0
- package/tests/integration/A-FrameSegment.integration.test.ts +102 -0
- package/tests/integration/A-FrameStorage.integration.test.ts +598 -0
- package/tests/jest.setup.browser.ts +1 -1
- package/tests/jest.setup.ts +4 -0
- package/tests/jest.setup.unit.ts +30 -0
- package/tests/unit/A-FrameChannel.unit.test.ts +124 -0
- package/tests/unit/A-FrameCompletion.unit.test.ts +25 -0
- package/tests/unit/A-FrameDefinition.unit.test.ts +36 -0
- package/tests/unit/A-FrameDynamicContent.unit.test.ts +28 -0
- package/tests/unit/A-FrameNamespace.unit.test.ts +35 -0
- package/tests/unit/A-FrameSchema.unit.test.ts +31 -0
- package/tests/unit/A-FrameSegment.unit.test.ts +20 -0
- package/tests/unit/mocks/MockA_FrameChannel.ts +112 -0
- package/tsconfig.browser.json +2 -0
- package/tsconfig.json +6 -0
- package/tsup.config.ts +52 -0
- package/tests/A-Frame.test.ts +0 -98
|
@@ -0,0 +1,1395 @@
|
|
|
1
|
+
import { A_FrameDynamicStructure, A_FrameDynamicStructureFeatures, A_FrameDynamicStructureOperation, A_FrameDynamicPatch } from './chunk-KTKVW3PH.mjs';
|
|
2
|
+
import { A_FrameIndex } from './chunk-KNTO7FCZ.mjs';
|
|
3
|
+
import { A_FrameEnv } from './chunk-RK5WSZ5J.mjs';
|
|
4
|
+
import { A_FrameNamespace, A_FrameNamespaceFeatures } from './chunk-2OQMOIR5.mjs';
|
|
5
|
+
import { A_FrameDefinition, A_FrameDefinitionFeatures } from './chunk-HI5SEX53.mjs';
|
|
6
|
+
import { A_FrameHashHelper } from './chunk-442DXGOD.mjs';
|
|
7
|
+
import { A_FrameVector } from './chunk-PABEFHCO.mjs';
|
|
8
|
+
import { __decorateClass, __decorateParam } from './chunk-OI76LHVT.mjs';
|
|
9
|
+
import { A_Inject, A_Feature, A_Caller, A_Error, A_Entity, A_Context, A_Scope, A_Fragment, A_Component } from '@adaas/a-concept';
|
|
10
|
+
import * as http from 'http';
|
|
11
|
+
import * as https from 'https';
|
|
12
|
+
|
|
13
|
+
// src/lib/A-FrameChannel/A-FrameChannel.constants.ts
|
|
14
|
+
var A_FrameFeatures = {
|
|
15
|
+
Request: "_A_FRAME_REQUEST",
|
|
16
|
+
Socket: "_A_FRAME_SOCKET",
|
|
17
|
+
Stream: "_A_FRAME_STREAM",
|
|
18
|
+
Send: "_A_FRAME_SEND"
|
|
19
|
+
};
|
|
20
|
+
var A_FrameChannelStreamStatuses = {
|
|
21
|
+
Open: "open",
|
|
22
|
+
Closed: "closed"
|
|
23
|
+
};
|
|
24
|
+
var A_FrameChannelStreamFeatures = {
|
|
25
|
+
open: "_A_FRAME_CHANNEL_STREAM_OPEN",
|
|
26
|
+
send: "_A_FRAME_CHANNEL_STREAM_SEND",
|
|
27
|
+
onEvent: "_A_FRAME_CHANNEL_STREAM_ON_EVENT",
|
|
28
|
+
onError: "_A_FRAME_CHANNEL_STREAM_ON_ERROR",
|
|
29
|
+
onComplete: "_A_FRAME_CHANNEL_STREAM_ON_COMPLETE",
|
|
30
|
+
onClose: "_A_FRAME_CHANNEL_STREAM_ON_CLOSE"
|
|
31
|
+
};
|
|
32
|
+
var A_FrameChannelSocketStatuses = {
|
|
33
|
+
Connecting: "connecting",
|
|
34
|
+
Open: "open",
|
|
35
|
+
Closed: "closed"
|
|
36
|
+
};
|
|
37
|
+
var A_FrameChannelSocketFeatures = {
|
|
38
|
+
onEvent: "_A_FRAME_CHANNEL_SOCKET_ON_EVENT",
|
|
39
|
+
onError: "_A_FRAME_CHANNEL_SOCKET_ON_ERROR",
|
|
40
|
+
onOpen: "_A_FRAME_CHANNEL_SOCKET_ON_OPEN",
|
|
41
|
+
onClose: "_A_FRAME_CHANNEL_SOCKET_ON_CLOSE"
|
|
42
|
+
};
|
|
43
|
+
var A_FrameChannelRequest = class extends A_Fragment {
|
|
44
|
+
constructor(method, path, body) {
|
|
45
|
+
super({ name: "a-frame-channel-request" });
|
|
46
|
+
this.method = method;
|
|
47
|
+
this.path = path;
|
|
48
|
+
this.body = body;
|
|
49
|
+
}
|
|
50
|
+
complete(response) {
|
|
51
|
+
this._response = response;
|
|
52
|
+
}
|
|
53
|
+
fail(error) {
|
|
54
|
+
this._error = error;
|
|
55
|
+
}
|
|
56
|
+
get response() {
|
|
57
|
+
return this._response;
|
|
58
|
+
}
|
|
59
|
+
get error() {
|
|
60
|
+
return this._error;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var A_FrameChannelError = class extends A_Error {
|
|
64
|
+
};
|
|
65
|
+
A_FrameChannelError.InvalidRequest = "InvalidRequest";
|
|
66
|
+
A_FrameChannelError.Timeout = "Timeout";
|
|
67
|
+
A_FrameChannelError.RequestFailed = "RequestFailed";
|
|
68
|
+
var A_FrameChannelEvent = class extends A_Fragment {
|
|
69
|
+
constructor(name, data) {
|
|
70
|
+
super({ name: "a-frame-channel-event-" + name });
|
|
71
|
+
this._data = data;
|
|
72
|
+
this._eventName = name;
|
|
73
|
+
}
|
|
74
|
+
get name() {
|
|
75
|
+
return this._eventName;
|
|
76
|
+
}
|
|
77
|
+
get data() {
|
|
78
|
+
return this._data;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var A_FrameChannelStream = class extends A_Entity {
|
|
82
|
+
static onEvent(name) {
|
|
83
|
+
const eventName = (name || "all") + A_FrameChannelStreamFeatures.onEvent;
|
|
84
|
+
return (target, propertyKey, descriptor) => {
|
|
85
|
+
return A_Feature.Extend({
|
|
86
|
+
name: eventName,
|
|
87
|
+
scope: [target.constructor]
|
|
88
|
+
})(target, propertyKey, descriptor);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The scope of the session, Will be destroyed after the session is closed.
|
|
93
|
+
*/
|
|
94
|
+
get scope() {
|
|
95
|
+
if (!this._scope) {
|
|
96
|
+
this._scope = A_Context.allocate(this, new A_Scope({ name: `${this.aseid.id}-scope` }));
|
|
97
|
+
}
|
|
98
|
+
return this._scope;
|
|
99
|
+
}
|
|
100
|
+
get method() {
|
|
101
|
+
return this._method;
|
|
102
|
+
}
|
|
103
|
+
get path() {
|
|
104
|
+
return this._path;
|
|
105
|
+
}
|
|
106
|
+
get body() {
|
|
107
|
+
return this._body;
|
|
108
|
+
}
|
|
109
|
+
get status() {
|
|
110
|
+
return this._status;
|
|
111
|
+
}
|
|
112
|
+
get error() {
|
|
113
|
+
return this._error;
|
|
114
|
+
}
|
|
115
|
+
get initDate() {
|
|
116
|
+
return new Date(this._initDate);
|
|
117
|
+
}
|
|
118
|
+
complete() {
|
|
119
|
+
this._status = A_FrameChannelStreamStatuses.Closed;
|
|
120
|
+
}
|
|
121
|
+
fail(error) {
|
|
122
|
+
this._status = A_FrameChannelStreamStatuses.Closed;
|
|
123
|
+
this._error = error;
|
|
124
|
+
}
|
|
125
|
+
destroy() {
|
|
126
|
+
this.scope.destroy();
|
|
127
|
+
}
|
|
128
|
+
async open() {
|
|
129
|
+
await this.call(A_FrameChannelStreamFeatures.open);
|
|
130
|
+
}
|
|
131
|
+
async send() {
|
|
132
|
+
await this.call(A_FrameChannelStreamFeatures.send);
|
|
133
|
+
}
|
|
134
|
+
async propagate(name, data) {
|
|
135
|
+
const request = new A_FrameChannelEvent(name, data);
|
|
136
|
+
const executionScope = new A_Scope({
|
|
137
|
+
name: "A_FrameChannelStream.propagate",
|
|
138
|
+
fragments: [request]
|
|
139
|
+
}).inherit(this.scope);
|
|
140
|
+
try {
|
|
141
|
+
const callName = (name || "all") + A_FrameChannelStreamFeatures.onEvent;
|
|
142
|
+
await this.call(callName, executionScope);
|
|
143
|
+
executionScope.destroy();
|
|
144
|
+
} catch {
|
|
145
|
+
executionScope.destroy();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
fromNew(newEntity) {
|
|
149
|
+
this.aseid = this.generateASEID();
|
|
150
|
+
this._method = newEntity.method;
|
|
151
|
+
this._path = newEntity.path;
|
|
152
|
+
this._body = newEntity.body;
|
|
153
|
+
this._initDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
154
|
+
}
|
|
155
|
+
fromJSON(serialized) {
|
|
156
|
+
this._method = serialized.method;
|
|
157
|
+
this._path = serialized.path;
|
|
158
|
+
this._body = serialized.body;
|
|
159
|
+
this._initDate = serialized.initDate;
|
|
160
|
+
}
|
|
161
|
+
toJSON() {
|
|
162
|
+
return {
|
|
163
|
+
...super.toJSON(),
|
|
164
|
+
initDate: this._initDate,
|
|
165
|
+
status: this._status,
|
|
166
|
+
error: this._error ? this._error.toJSON() : void 0,
|
|
167
|
+
method: this._method,
|
|
168
|
+
path: this._path,
|
|
169
|
+
body: this._body
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// src/lib/A-FrameDynamicSession/A-FrameDynamicSession.constants.ts
|
|
175
|
+
var A_FrameDynamicSessionFeatures = {
|
|
176
|
+
Init: "_A_FRAME_DYNAMIC_SESSION_INIT",
|
|
177
|
+
Question: "_A_FRAME_DYNAMIC_SESSION_QUESTION",
|
|
178
|
+
Answer: "_A_FRAME_DYNAMIC_SESSION_ANSWER",
|
|
179
|
+
Destroy: "_A_FRAME_DYNAMIC_SESSION_DESTROY"
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/lib/A-FrameDynamicSession/A-FrameDynamicSession.entity.ts
|
|
183
|
+
var A_FrameDynamicSession = class extends A_Entity {
|
|
184
|
+
static get concept() {
|
|
185
|
+
return "a-frame";
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
*
|
|
189
|
+
*/
|
|
190
|
+
get scope() {
|
|
191
|
+
if (!this._scope) {
|
|
192
|
+
this._scope = A_Context.allocate(this, new A_Scope({ name: `${this.aseid.id}-scope` }));
|
|
193
|
+
}
|
|
194
|
+
return this._scope;
|
|
195
|
+
}
|
|
196
|
+
get currentTurn() {
|
|
197
|
+
return this._currentTurn;
|
|
198
|
+
}
|
|
199
|
+
get initDate() {
|
|
200
|
+
return new Date(this._initDate);
|
|
201
|
+
}
|
|
202
|
+
static onQuestion() {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
static onAnswer() {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
fromNew(newEntity) {
|
|
209
|
+
this._turnsCount = newEntity.turnsCount || 5;
|
|
210
|
+
this._currentTurn = 0;
|
|
211
|
+
this._initDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
212
|
+
}
|
|
213
|
+
fromJSON(serialized) {
|
|
214
|
+
this._turnsCount = serialized.turnsCount;
|
|
215
|
+
this._currentTurn = serialized.currentTurn;
|
|
216
|
+
this._initDate = serialized.initDate;
|
|
217
|
+
}
|
|
218
|
+
async init() {
|
|
219
|
+
await this.call(A_FrameDynamicSessionFeatures.Init);
|
|
220
|
+
}
|
|
221
|
+
async destroy(scope) {
|
|
222
|
+
await this.call(A_FrameDynamicSessionFeatures.Destroy, scope);
|
|
223
|
+
}
|
|
224
|
+
async question() {
|
|
225
|
+
this._currentTurn++;
|
|
226
|
+
await this.call(A_FrameDynamicSessionFeatures.Question);
|
|
227
|
+
}
|
|
228
|
+
async answer() {
|
|
229
|
+
await this.call(A_FrameDynamicSessionFeatures.Answer);
|
|
230
|
+
}
|
|
231
|
+
toJSON() {
|
|
232
|
+
return {
|
|
233
|
+
...super.toJSON(),
|
|
234
|
+
turnsCount: this._turnsCount,
|
|
235
|
+
currentTurn: this._currentTurn,
|
|
236
|
+
initDate: this._initDate
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
var A_FrameChannelDsgStream = class extends A_FrameChannelStream {
|
|
241
|
+
constructor() {
|
|
242
|
+
super(...arguments);
|
|
243
|
+
this._resolvedComponents = [];
|
|
244
|
+
}
|
|
245
|
+
// ── Configuration ──────────────────────────────────────────────────────
|
|
246
|
+
/**
|
|
247
|
+
* Provide the callback that sends a component-search response back to the
|
|
248
|
+
* server via HTTP POST. Must be set before the SSE stream is opened.
|
|
249
|
+
*/
|
|
250
|
+
setRespondFn(fn) {
|
|
251
|
+
this._respondFn = fn;
|
|
252
|
+
}
|
|
253
|
+
// ── Result accessor ────────────────────────────────────────────────────
|
|
254
|
+
/**
|
|
255
|
+
* Contains the resolved components after `structure_complete` is received.
|
|
256
|
+
* Empty until the server pushes the final structure.
|
|
257
|
+
*/
|
|
258
|
+
get resolvedComponents() {
|
|
259
|
+
return this._resolvedComponents;
|
|
260
|
+
}
|
|
261
|
+
async onSearchComponent(event) {
|
|
262
|
+
if (!this._respondFn) return;
|
|
263
|
+
const { requestId, vector } = event.data;
|
|
264
|
+
const queryVector = new A_FrameVector(vector ?? []);
|
|
265
|
+
const results = A_FrameIndex.search(queryVector, { topK: 1 });
|
|
266
|
+
const top = results[0];
|
|
267
|
+
await this._respondFn(requestId, {
|
|
268
|
+
component: top?.record?.name ?? null,
|
|
269
|
+
score: top?.score ?? 0
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
async onStructureComplete(event) {
|
|
273
|
+
const { components } = event.data;
|
|
274
|
+
this._resolvedComponents = Array.isArray(components) ? components : [];
|
|
275
|
+
}
|
|
276
|
+
async onStructureError(event) {
|
|
277
|
+
const { message } = event.data ?? {};
|
|
278
|
+
console.error("[A_FrameChannelDsgStream] Server reported structure error:", message ?? "unknown");
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
__decorateClass([
|
|
282
|
+
A_FrameChannelStream.onEvent("search_component"),
|
|
283
|
+
__decorateParam(0, A_Inject(A_FrameChannelEvent))
|
|
284
|
+
], A_FrameChannelDsgStream.prototype, "onSearchComponent", 1);
|
|
285
|
+
__decorateClass([
|
|
286
|
+
A_FrameChannelStream.onEvent("structure_complete"),
|
|
287
|
+
__decorateParam(0, A_Inject(A_FrameChannelEvent))
|
|
288
|
+
], A_FrameChannelDsgStream.prototype, "onStructureComplete", 1);
|
|
289
|
+
__decorateClass([
|
|
290
|
+
A_FrameChannelStream.onEvent("structure_error"),
|
|
291
|
+
__decorateParam(0, A_Inject(A_FrameChannelEvent))
|
|
292
|
+
], A_FrameChannelDsgStream.prototype, "onStructureError", 1);
|
|
293
|
+
|
|
294
|
+
// src/lib/A-FrameDynamicContent/A-FrameDynamicContent.constants.ts
|
|
295
|
+
var A_FrameDynamicContentFeatures = {
|
|
296
|
+
Generate: "_A_FRAME_DYNAMIC_CONTENT_GENERATE",
|
|
297
|
+
Patch: "_A_FRAME_DYNAMIC_CONTENT_PATCH"
|
|
298
|
+
};
|
|
299
|
+
var A_FrameDynamicContentOperation = class extends A_Fragment {
|
|
300
|
+
constructor(params = {}) {
|
|
301
|
+
super({ name: "a-frame-dynamic-content-operation-context" });
|
|
302
|
+
this._meta = /* @__PURE__ */ new Map();
|
|
303
|
+
this._meta.set("params", params);
|
|
304
|
+
}
|
|
305
|
+
get params() {
|
|
306
|
+
return this._meta.get("params");
|
|
307
|
+
}
|
|
308
|
+
get(key) {
|
|
309
|
+
return this._meta.get(key);
|
|
310
|
+
}
|
|
311
|
+
set(key, value) {
|
|
312
|
+
this._meta.set(key, value);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
var A_FrameDynamicContentError = class extends A_Error {
|
|
316
|
+
};
|
|
317
|
+
A_FrameDynamicContentError.GenerationFailed = "GenerationFailed";
|
|
318
|
+
A_FrameDynamicContentError.PatchFailed = "PatchFailed";
|
|
319
|
+
A_FrameDynamicContentError.InvalidPatch = "InvalidPatch";
|
|
320
|
+
A_FrameDynamicContentError.PieceNotFound = "PieceNotFound";
|
|
321
|
+
var _A_FrameDynamicContentIndex = class _A_FrameDynamicContentIndex extends A_Fragment {
|
|
322
|
+
constructor() {
|
|
323
|
+
super(...arguments);
|
|
324
|
+
/** Ordered list of segment IDs — defines the canonical reading order. */
|
|
325
|
+
this._order = [];
|
|
326
|
+
/** O(1) lookup by id. */
|
|
327
|
+
this._map = /* @__PURE__ */ new Map();
|
|
328
|
+
}
|
|
329
|
+
// ── Accessors ─────────────────────────────────────────────────────────────
|
|
330
|
+
get count() {
|
|
331
|
+
return this._order.length;
|
|
332
|
+
}
|
|
333
|
+
get size() {
|
|
334
|
+
return this._order.length;
|
|
335
|
+
}
|
|
336
|
+
// ── Basic mutation ────────────────────────────────────────────────────────
|
|
337
|
+
/** Append one or more segments to the end. */
|
|
338
|
+
add(...segments) {
|
|
339
|
+
segments.forEach((seg) => {
|
|
340
|
+
this._map.set(seg.id, seg);
|
|
341
|
+
if (!this._order.includes(seg.id)) {
|
|
342
|
+
this._order.push(seg.id);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
/** Replace the content of an existing segment in-place (position unchanged). */
|
|
347
|
+
update(segment) {
|
|
348
|
+
this._map.set(segment.id, segment);
|
|
349
|
+
if (!this._order.includes(segment.id)) {
|
|
350
|
+
this._order.push(segment.id);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/** Remove a segment by id. */
|
|
354
|
+
remove(id) {
|
|
355
|
+
this._map.delete(id);
|
|
356
|
+
const idx = this._order.indexOf(id);
|
|
357
|
+
if (idx !== -1) this._order.splice(idx, 1);
|
|
358
|
+
}
|
|
359
|
+
/** Remove all segments. */
|
|
360
|
+
clear() {
|
|
361
|
+
this._map.clear();
|
|
362
|
+
this._order = [];
|
|
363
|
+
}
|
|
364
|
+
// ── Positional insertion ──────────────────────────────────────────────────
|
|
365
|
+
/** Insert `segment` immediately before the segment with `targetId`. */
|
|
366
|
+
insertBefore(targetId, segment) {
|
|
367
|
+
this._map.set(segment.id, segment);
|
|
368
|
+
const targetIdx = this._order.indexOf(targetId);
|
|
369
|
+
if (targetIdx === -1) {
|
|
370
|
+
this._order.push(segment.id);
|
|
371
|
+
} else {
|
|
372
|
+
this._order.splice(targetIdx, 0, segment.id);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/** Insert `segment` immediately after the segment with `targetId`. */
|
|
376
|
+
insertAfter(targetId, segment) {
|
|
377
|
+
this._map.set(segment.id, segment);
|
|
378
|
+
const targetIdx = this._order.indexOf(targetId);
|
|
379
|
+
if (targetIdx === -1) {
|
|
380
|
+
this._order.push(segment.id);
|
|
381
|
+
} else {
|
|
382
|
+
this._order.splice(targetIdx + 1, 0, segment.id);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/** Swap the content of `targetId` with `segment`, keeping the same position. */
|
|
386
|
+
replace(targetId, segment) {
|
|
387
|
+
const pos = this._order.indexOf(targetId);
|
|
388
|
+
if (pos === -1) return;
|
|
389
|
+
this._map.delete(targetId);
|
|
390
|
+
this._map.set(segment.id, segment);
|
|
391
|
+
this._order[pos] = segment.id;
|
|
392
|
+
}
|
|
393
|
+
// ── Position management ────────────────────────────────────────────────────
|
|
394
|
+
/** Move the segment with `id` to absolute zero-based `newPosition`. */
|
|
395
|
+
moveTo(id, newPosition) {
|
|
396
|
+
const from = this._order.indexOf(id);
|
|
397
|
+
if (from === -1) return;
|
|
398
|
+
this._order.splice(from, 1);
|
|
399
|
+
const clipped = Math.max(0, Math.min(newPosition, this._order.length));
|
|
400
|
+
this._order.splice(clipped, 0, id);
|
|
401
|
+
}
|
|
402
|
+
/** Move `id` to directly before `targetId`. */
|
|
403
|
+
moveBefore(id, targetId) {
|
|
404
|
+
const from = this._order.indexOf(id);
|
|
405
|
+
if (from === -1) return;
|
|
406
|
+
this._order.splice(from, 1);
|
|
407
|
+
const to = this._order.indexOf(targetId);
|
|
408
|
+
this._order.splice(to === -1 ? 0 : to, 0, id);
|
|
409
|
+
}
|
|
410
|
+
/** Move `id` to directly after `targetId`. */
|
|
411
|
+
moveAfter(id, targetId) {
|
|
412
|
+
const from = this._order.indexOf(id);
|
|
413
|
+
if (from === -1) return;
|
|
414
|
+
this._order.splice(from, 1);
|
|
415
|
+
const to = this._order.indexOf(targetId);
|
|
416
|
+
this._order.splice(to === -1 ? this._order.length : to + 1, 0, id);
|
|
417
|
+
}
|
|
418
|
+
// ── Patch operation dispatch ──────────────────────────────────────────────
|
|
419
|
+
/**
|
|
420
|
+
* Apply a single `A_FrameContentPatchOperation` to the index.
|
|
421
|
+
* For `add` and `replace` the caller must supply the resolved `segment`.
|
|
422
|
+
* For `remove` only the `op` is needed.
|
|
423
|
+
*/
|
|
424
|
+
applyOperation(op, segment) {
|
|
425
|
+
switch (op.action) {
|
|
426
|
+
case "remove": {
|
|
427
|
+
if (op.targetId) this.remove(op.targetId);
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
case "replace": {
|
|
431
|
+
if (op.targetId && segment) this.replace(op.targetId, segment);
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
case "add": {
|
|
435
|
+
if (!segment) break;
|
|
436
|
+
if (!op.targetId || op.position === "append") {
|
|
437
|
+
this.add(segment);
|
|
438
|
+
} else if (op.position === "before") {
|
|
439
|
+
this.insertBefore(op.targetId, segment);
|
|
440
|
+
} else {
|
|
441
|
+
this.insertAfter(op.targetId, segment);
|
|
442
|
+
}
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
// ── Lookup ────────────────────────────────────────────────────────────────
|
|
448
|
+
get(id) {
|
|
449
|
+
return this._map.get(id);
|
|
450
|
+
}
|
|
451
|
+
/** Returns all segments in their current canonical order. */
|
|
452
|
+
list() {
|
|
453
|
+
return this._order.map((id) => this._map.get(id)).filter((s) => s !== void 0);
|
|
454
|
+
}
|
|
455
|
+
// ── Search ────────────────────────────────────────────────────────────────
|
|
456
|
+
/**
|
|
457
|
+
* Rank all embedded segments by cosine similarity to the query vector.
|
|
458
|
+
*/
|
|
459
|
+
search(vector, topK = _A_FrameDynamicContentIndex.PATCH_PIECE_LIMIT) {
|
|
460
|
+
const queryVec = vector.normalize();
|
|
461
|
+
return this.list().filter((s) => s.isEmbed && s.vector).map((s) => ({
|
|
462
|
+
segment: s,
|
|
463
|
+
score: queryVec.dot(s.vector.normalize())
|
|
464
|
+
})).sort((a, b) => b.score - a.score).slice(0, topK);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Rank segments by how many instruction keywords appear in their content.
|
|
468
|
+
* Words shorter than 4 characters are ignored.
|
|
469
|
+
*/
|
|
470
|
+
searchByKeywords(instruction, topK = _A_FrameDynamicContentIndex.PATCH_PIECE_LIMIT) {
|
|
471
|
+
const keywords = instruction.toLowerCase().split(/\W+/).filter((w) => w.length > 3);
|
|
472
|
+
if (keywords.length === 0) return [];
|
|
473
|
+
return this.list().map((segment) => {
|
|
474
|
+
const lower = segment.content.toLowerCase();
|
|
475
|
+
const score = keywords.reduce(
|
|
476
|
+
(acc, kw) => acc + (lower.includes(kw) ? 1 : 0),
|
|
477
|
+
0
|
|
478
|
+
);
|
|
479
|
+
return { segment, score };
|
|
480
|
+
}).filter((s) => s.score > 0).sort((a, b) => b.score - a.score).slice(0, topK);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Select at most `limit` segments most relevant to a patch instruction.
|
|
484
|
+
*
|
|
485
|
+
* Priority:
|
|
486
|
+
* 1. Vector search — when `vector` is provided and segments carry embeddings.
|
|
487
|
+
* 2. Keyword search — fallback when embeddings are absent or vector is null.
|
|
488
|
+
* 3. Identity — first N segments when neither search finds candidates.
|
|
489
|
+
*/
|
|
490
|
+
selectForPatch(vector, instruction, limit = _A_FrameDynamicContentIndex.PATCH_PIECE_LIMIT) {
|
|
491
|
+
const all = this.list();
|
|
492
|
+
if (all.length <= limit) return all;
|
|
493
|
+
if (vector) {
|
|
494
|
+
const hasEmbedded = all.some((s) => s.isEmbed);
|
|
495
|
+
if (hasEmbedded) {
|
|
496
|
+
const results = this.search(vector, limit);
|
|
497
|
+
if (results.length > 0) return results.map((r) => r.segment);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
const kwResults = this.searchByKeywords(instruction, limit);
|
|
501
|
+
if (kwResults.length > 0) return kwResults.map((r) => r.segment);
|
|
502
|
+
return all.slice(0, limit);
|
|
503
|
+
}
|
|
504
|
+
// ── Similarity helpers ────────────────────────────────────────────────────
|
|
505
|
+
cosineSimilarity(a, b) {
|
|
506
|
+
if (!b) return 0;
|
|
507
|
+
const dot = a.dot(b);
|
|
508
|
+
const mag = a.magnitude() * b.magnitude();
|
|
509
|
+
return mag === 0 ? 0 : dot / mag;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
/** Maximum segments forwarded to the server in a single patch request. */
|
|
513
|
+
_A_FrameDynamicContentIndex.PATCH_PIECE_LIMIT = 5;
|
|
514
|
+
var A_FrameDynamicContentIndex = _A_FrameDynamicContentIndex;
|
|
515
|
+
|
|
516
|
+
// src/lib/A-FrameSegment/A-FrameSegment.constants.ts
|
|
517
|
+
var A_FrameSegmentFeatures = {
|
|
518
|
+
Load: "_A_FRAME_SEGMENT_LOAD",
|
|
519
|
+
Save: "_A_FRAME_SEGMENT_SAVE",
|
|
520
|
+
Embed: "_A_FRAME_SEGMENT_EMBED",
|
|
521
|
+
Destroy: "_A_FRAME_SEGMENT_DESTROY"
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
// src/lib/A-FrameSegment/A-FrameSegment.entity.ts
|
|
525
|
+
var A_FrameSegment = class extends A_Entity {
|
|
526
|
+
static get concept() {
|
|
527
|
+
return "a-frame";
|
|
528
|
+
}
|
|
529
|
+
// ─── Getters ──────────────────────────────────────────────────────────────
|
|
530
|
+
get id() {
|
|
531
|
+
return this.aseid.id;
|
|
532
|
+
}
|
|
533
|
+
get content() {
|
|
534
|
+
return this._content;
|
|
535
|
+
}
|
|
536
|
+
get hash() {
|
|
537
|
+
return this._hash;
|
|
538
|
+
}
|
|
539
|
+
get vector() {
|
|
540
|
+
return this._vector;
|
|
541
|
+
}
|
|
542
|
+
get embedding() {
|
|
543
|
+
return this._vector?.values ?? null;
|
|
544
|
+
}
|
|
545
|
+
//-----------------------------------------------------------------------------------------------------
|
|
546
|
+
//--------------------------------------- Computed properties -----------------------------------------
|
|
547
|
+
//-----------------------------------------------------------------------------------------------------
|
|
548
|
+
get aFrameServerVersion() {
|
|
549
|
+
return this._aFrameServerVersion;
|
|
550
|
+
}
|
|
551
|
+
get aFrameVersion() {
|
|
552
|
+
return this._aFrameVersion;
|
|
553
|
+
}
|
|
554
|
+
get isEmbed() {
|
|
555
|
+
return this._vector !== void 0;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Saves Segment to storage. The actual implementation of saving is handled by the A_FrameSegmentFeatures.Save feature, which can be implemented by the environment to persist the definition to a database, file system, or other storage mechanism.
|
|
559
|
+
*
|
|
560
|
+
* @param scope
|
|
561
|
+
* @returns
|
|
562
|
+
*/
|
|
563
|
+
save(scope) {
|
|
564
|
+
return this.call(A_FrameSegmentFeatures.Save, scope);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Deletes the namespace from storage. The actual implementation of deletion is handled by the A_FrameSegmentFeatures.Destroy feature, which can be implemented by the environment to remove the namespace from the database, file system, or other storage mechanism.
|
|
568
|
+
*
|
|
569
|
+
* @param scope
|
|
570
|
+
* @returns
|
|
571
|
+
*/
|
|
572
|
+
destroy(scope) {
|
|
573
|
+
return this.call(A_FrameSegmentFeatures.Destroy, scope);
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Loads the namespace from storage. The actual implementation of loading is handled by the A_FrameSegmentFeatures.Load feature, which can be implemented by the environment to retrieve the namespace from the database, file system, or other storage mechanism and populate the entity's properties accordingly.
|
|
577
|
+
*
|
|
578
|
+
* @param scope
|
|
579
|
+
* @returns
|
|
580
|
+
*/
|
|
581
|
+
async load(scope) {
|
|
582
|
+
return this.call(A_FrameSegmentFeatures.Load, scope);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Updates the definition's properties. This can be used to modify the source code, description, metadata, or namespace of the definition. After updating, you may want to call `embed()` again to refresh the embedding based on the new content.
|
|
586
|
+
*
|
|
587
|
+
* @param updates
|
|
588
|
+
*/
|
|
589
|
+
update(updates) {
|
|
590
|
+
if (updates.content) this._content = updates.content;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Generates an embedding vector for the namespace using the A_FrameSegmentFeatures.Embed feature. This typically involves sending the namespace's content (name + description) to an embedding model and storing the resulting vector in the entity. Once embedded, the namespace can be searched using its vector representation.
|
|
594
|
+
*
|
|
595
|
+
* @param scope
|
|
596
|
+
* @returns
|
|
597
|
+
*/
|
|
598
|
+
embed(scope) {
|
|
599
|
+
return this.call(A_FrameSegmentFeatures.Embed, scope);
|
|
600
|
+
}
|
|
601
|
+
// ─── A_Entity lifecycle ───────────────────────────────────────────────────
|
|
602
|
+
fromNew(init) {
|
|
603
|
+
super.fromNew(init);
|
|
604
|
+
this._content = init.content;
|
|
605
|
+
const hashSource = this._content;
|
|
606
|
+
this._hash = A_FrameHashHelper.fnv1a(hashSource);
|
|
607
|
+
}
|
|
608
|
+
fromJSON(serialized) {
|
|
609
|
+
this._content = serialized.content;
|
|
610
|
+
this._hash = serialized.hash;
|
|
611
|
+
this._vector = serialized.embedding ? new A_FrameVector(serialized.embedding) : void 0;
|
|
612
|
+
this._embeddedAt = serialized.embeddedAt;
|
|
613
|
+
this._model = serialized.model;
|
|
614
|
+
this._credentialId = serialized.credentialId;
|
|
615
|
+
this._aFrameVersion = serialized.aFrameVersion;
|
|
616
|
+
this._aFrameServerVersion = serialized.aFrameServerVersion;
|
|
617
|
+
}
|
|
618
|
+
toJSON() {
|
|
619
|
+
return {
|
|
620
|
+
...super.toJSON(),
|
|
621
|
+
hash: this._hash,
|
|
622
|
+
content: this._content,
|
|
623
|
+
embedding: this._vector?.values,
|
|
624
|
+
embeddedAt: this._embeddedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
625
|
+
model: this._model,
|
|
626
|
+
credentialId: this._credentialId,
|
|
627
|
+
aFrameVersion: this._aFrameVersion,
|
|
628
|
+
aFrameServerVersion: this._aFrameServerVersion
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
// ─── Embedding hydration ──────────────────────────────────────────────────
|
|
632
|
+
hydrateFromRecord(record) {
|
|
633
|
+
if (record.hash !== this._hash) {
|
|
634
|
+
throw new Error(
|
|
635
|
+
`A_FrameSegment.hydrateFromRecord: hash mismatch for "${this._content}" (expected ${this._hash}, got ${record.hash})`
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
this._vector = new A_FrameVector(record.embedding);
|
|
639
|
+
this._embeddedAt = record.embeddedAt;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Populate the embedding vector directly from a raw `Float32Array`.
|
|
643
|
+
* Use this when the vector is obtained externally (e.g. from a server
|
|
644
|
+
* response) without going through the full `embed()` feature pipeline.
|
|
645
|
+
*/
|
|
646
|
+
hydrateFromEmbedding(embedding) {
|
|
647
|
+
this._vector = new A_FrameVector(embedding);
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Build the text string sent to the embedding model.
|
|
651
|
+
* Uses content so the vector captures semantic intent.
|
|
652
|
+
*/
|
|
653
|
+
toString() {
|
|
654
|
+
const parts = [`// content: ${this._content}`];
|
|
655
|
+
return parts.join("\n");
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
// src/lib/A-FrameDynamicContent/A-FrameDynamicContent.entity.ts
|
|
660
|
+
var A_FrameDynamicContent = class extends A_Entity {
|
|
661
|
+
static get concept() {
|
|
662
|
+
return "a-frame";
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
*
|
|
666
|
+
*/
|
|
667
|
+
get scope() {
|
|
668
|
+
if (!this._scope) {
|
|
669
|
+
this._scope = A_Context.allocate(this, new A_Scope({ name: `${this.aseid.id}-scope` }));
|
|
670
|
+
}
|
|
671
|
+
return this._scope;
|
|
672
|
+
}
|
|
673
|
+
get index() {
|
|
674
|
+
const index = this.scope.resolve(A_FrameDynamicContentIndex);
|
|
675
|
+
return index;
|
|
676
|
+
}
|
|
677
|
+
fromNew(options) {
|
|
678
|
+
super.fromNew(options);
|
|
679
|
+
const index = new A_FrameDynamicContentIndex({ name: `${this.aseid.id}` });
|
|
680
|
+
this.scope.register(index);
|
|
681
|
+
this.createdAt = Date.now();
|
|
682
|
+
this.prompt = options.prompt;
|
|
683
|
+
this.model = options.options?.model || "default-model";
|
|
684
|
+
this._patchPieceLimit = options.options?.patchPieceLimit || A_FrameDynamicContentIndex.PATCH_PIECE_LIMIT;
|
|
685
|
+
this._history = [];
|
|
686
|
+
this._version = 0;
|
|
687
|
+
}
|
|
688
|
+
// ── Accessors ────────────────────────────────────────────────────────────
|
|
689
|
+
/** Ordered list of content pieces (output of the last generate or patch). */
|
|
690
|
+
get segments() {
|
|
691
|
+
return this.index.list();
|
|
692
|
+
}
|
|
693
|
+
/** Full content reconstructed from all segments in index order. */
|
|
694
|
+
get content() {
|
|
695
|
+
return this.index.list().map((s) => s.content).join("\n");
|
|
696
|
+
}
|
|
697
|
+
/** Alias for `content` — kept for backward compatibility. */
|
|
698
|
+
get text() {
|
|
699
|
+
return this.content;
|
|
700
|
+
}
|
|
701
|
+
/** Immutable patch history. */
|
|
702
|
+
get history() {
|
|
703
|
+
return this._history;
|
|
704
|
+
}
|
|
705
|
+
/** Current content version (increments with each patch). */
|
|
706
|
+
get version() {
|
|
707
|
+
return this._version;
|
|
708
|
+
}
|
|
709
|
+
/** The AI model name to use for generation / patching. */
|
|
710
|
+
get modelName() {
|
|
711
|
+
return this.model;
|
|
712
|
+
}
|
|
713
|
+
// ── Main pipeline ─────────────────────────────────────────────────────────
|
|
714
|
+
/**
|
|
715
|
+
* Generate content from the entity's prompt.
|
|
716
|
+
* Populates `pieces` and creates the first history entry.
|
|
717
|
+
*/
|
|
718
|
+
async generate() {
|
|
719
|
+
const operation = new A_FrameDynamicContentOperation();
|
|
720
|
+
if (!this.scope.isInheritedFrom(A_Context.scope(this)))
|
|
721
|
+
this.scope.inherit(A_Context.scope(this));
|
|
722
|
+
const executionScope = new A_Scope({
|
|
723
|
+
name: "a-frame-dynamic-content-generate",
|
|
724
|
+
fragments: [operation]
|
|
725
|
+
}).inherit(this.scope);
|
|
726
|
+
try {
|
|
727
|
+
await this.call(A_FrameDynamicContentFeatures.Generate, executionScope);
|
|
728
|
+
executionScope.destroy();
|
|
729
|
+
} catch (err) {
|
|
730
|
+
executionScope.destroy();
|
|
731
|
+
throw new A_FrameDynamicContentError({
|
|
732
|
+
title: A_FrameDynamicContentError.GenerationFailed,
|
|
733
|
+
description: `Failed to generate content: ${err instanceof Error ? err.message : String(err)}`
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Apply a natural-language patch instruction to the current pieces.
|
|
739
|
+
* The server identifies which pieces to add, replace, or remove using
|
|
740
|
+
* semantic search over piece embeddings.
|
|
741
|
+
*/
|
|
742
|
+
async patch(instruction) {
|
|
743
|
+
if (!this.scope.isInheritedFrom(A_Context.scope(this)))
|
|
744
|
+
this.scope.inherit(A_Context.scope(this));
|
|
745
|
+
const executionScope = new A_Scope({
|
|
746
|
+
name: "a-frame-dynamic-content-patch"
|
|
747
|
+
}).inherit(this.scope);
|
|
748
|
+
const inputSegment = new A_FrameSegment({
|
|
749
|
+
content: instruction
|
|
750
|
+
});
|
|
751
|
+
executionScope.register(inputSegment);
|
|
752
|
+
await inputSegment.embed();
|
|
753
|
+
const targetSegments = this.index.selectForPatch(inputSegment.vector ?? null, instruction, this._patchPieceLimit);
|
|
754
|
+
const operation = new A_FrameDynamicContentOperation({
|
|
755
|
+
instruction,
|
|
756
|
+
segments: targetSegments
|
|
757
|
+
});
|
|
758
|
+
executionScope.register(operation);
|
|
759
|
+
try {
|
|
760
|
+
await this.call(A_FrameDynamicContentFeatures.Patch, executionScope);
|
|
761
|
+
executionScope.destroy();
|
|
762
|
+
} catch (err) {
|
|
763
|
+
executionScope.destroy();
|
|
764
|
+
throw new A_FrameDynamicContentError({
|
|
765
|
+
title: A_FrameDynamicContentError.PatchFailed,
|
|
766
|
+
description: `Failed to patch content: ${err instanceof Error ? err.message : String(err)}`
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
// ── Hydration ─────────────────────────────────────────────────────────────
|
|
771
|
+
/**
|
|
772
|
+
* Populate index from the segments created by the channel after a generate response.
|
|
773
|
+
* Creates the first history entry.
|
|
774
|
+
*/
|
|
775
|
+
hydrateFromGeneration(segments, meta) {
|
|
776
|
+
segments.forEach((s) => this.index.add(s));
|
|
777
|
+
this._history.push(new A_FrameDynamicPatch({
|
|
778
|
+
version: this._version,
|
|
779
|
+
timestamp: Date.now(),
|
|
780
|
+
reason: `Generated for: "${this.prompt}"`,
|
|
781
|
+
encoded: Buffer.from(JSON.stringify(this.index.list())).toString("base64"),
|
|
782
|
+
delta: this.index.size
|
|
783
|
+
}));
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Apply a patch diff returned by the server to the current piece list.
|
|
787
|
+
* Increments the version and records a history entry.
|
|
788
|
+
*/
|
|
789
|
+
hydrateFromPatch(patchResult, meta) {
|
|
790
|
+
const prevCount = this.index.size;
|
|
791
|
+
for (const op of patchResult.operations) {
|
|
792
|
+
let segment;
|
|
793
|
+
if (op.segment) {
|
|
794
|
+
segment = new A_FrameSegment({ content: op.segment.content });
|
|
795
|
+
if (op.segment.embedding?.length) {
|
|
796
|
+
segment.hydrateFromEmbedding(new Float32Array(op.segment.embedding));
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
this.index.applyOperation(op, segment);
|
|
800
|
+
}
|
|
801
|
+
this._version++;
|
|
802
|
+
this._history.push(new A_FrameDynamicPatch({
|
|
803
|
+
version: this._version,
|
|
804
|
+
timestamp: Date.now(),
|
|
805
|
+
reason: patchResult.patchSummary,
|
|
806
|
+
encoded: Buffer.from(JSON.stringify(this.index.list())).toString("base64"),
|
|
807
|
+
delta: this.index.size - prevCount
|
|
808
|
+
}));
|
|
809
|
+
}
|
|
810
|
+
// ── Serialisation ──────────────────────────────────────────────────────────
|
|
811
|
+
toJSON() {
|
|
812
|
+
return {
|
|
813
|
+
...super.toJSON(),
|
|
814
|
+
prompt: this.prompt,
|
|
815
|
+
metadata: {
|
|
816
|
+
model: this.model,
|
|
817
|
+
createdAt: this.createdAt
|
|
818
|
+
},
|
|
819
|
+
history: this._history.map((item) => item.toJSON())
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
// src/lib/A-FrameChannel/A-FrameChannel.component.ts
|
|
825
|
+
var A_FrameChannel = class extends A_Component {
|
|
826
|
+
async generate(prompt) {
|
|
827
|
+
const request = new A_FrameChannelRequest("POST", "/api/v1/completions", { prompt, max_tokens: 512 });
|
|
828
|
+
const executionScope = new A_Scope({
|
|
829
|
+
name: "A_FrameChannel.generate",
|
|
830
|
+
fragments: [request]
|
|
831
|
+
}).inherit(A_Context.scope(this));
|
|
832
|
+
try {
|
|
833
|
+
await this.call(A_FrameFeatures.Request, executionScope);
|
|
834
|
+
executionScope.destroy();
|
|
835
|
+
return request;
|
|
836
|
+
} catch (err) {
|
|
837
|
+
executionScope.destroy();
|
|
838
|
+
throw new A_FrameChannelError({
|
|
839
|
+
title: A_FrameChannelError.RequestFailed,
|
|
840
|
+
description: `Failed to generate completion: ${err instanceof Error ? err.message : String(err)}`
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
async embed(input) {
|
|
845
|
+
const request = new A_FrameChannelRequest("POST", "/api/v1/embeddings", { input });
|
|
846
|
+
const executionScope = new A_Scope({
|
|
847
|
+
name: "A_FrameChannel.embed",
|
|
848
|
+
fragments: [request]
|
|
849
|
+
}).inherit(A_Context.scope(this));
|
|
850
|
+
try {
|
|
851
|
+
await this.call(A_FrameFeatures.Request, executionScope);
|
|
852
|
+
executionScope.destroy();
|
|
853
|
+
return request;
|
|
854
|
+
} catch (err) {
|
|
855
|
+
executionScope.destroy();
|
|
856
|
+
throw new A_FrameChannelError({
|
|
857
|
+
title: A_FrameChannelError.RequestFailed,
|
|
858
|
+
description: `Failed to embed input: ${err instanceof Error ? err.message : String(err)}`
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
async getCredentials() {
|
|
863
|
+
const request = new A_FrameChannelRequest("GET", "/api/v1/credentials/me");
|
|
864
|
+
const executionScope = new A_Scope({
|
|
865
|
+
name: "A_FrameChannel.getCredentials",
|
|
866
|
+
fragments: [request]
|
|
867
|
+
}).inherit(A_Context.scope(this));
|
|
868
|
+
try {
|
|
869
|
+
await this.call(A_FrameFeatures.Request, executionScope);
|
|
870
|
+
executionScope.destroy();
|
|
871
|
+
return request;
|
|
872
|
+
} catch (err) {
|
|
873
|
+
executionScope.destroy();
|
|
874
|
+
throw new A_FrameChannelError({
|
|
875
|
+
title: A_FrameChannelError.RequestFailed,
|
|
876
|
+
description: `Failed to get credentials: ${err instanceof Error ? err.message : String(err)}`
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
async ping() {
|
|
881
|
+
const request = new A_FrameChannelRequest("GET", "/health");
|
|
882
|
+
const executionScope = new A_Scope({
|
|
883
|
+
name: "A_FrameChannel.ping",
|
|
884
|
+
fragments: [request]
|
|
885
|
+
}).inherit(A_Context.scope(this));
|
|
886
|
+
try {
|
|
887
|
+
await this.call(A_FrameFeatures.Request, executionScope);
|
|
888
|
+
executionScope.destroy();
|
|
889
|
+
return request;
|
|
890
|
+
} catch {
|
|
891
|
+
executionScope.destroy();
|
|
892
|
+
return request;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
async embedDefinition(definition, env) {
|
|
896
|
+
const request = new A_FrameChannelRequest("POST", "/api/v1/definition/embed", {
|
|
897
|
+
definition: definition.toJSON()
|
|
898
|
+
});
|
|
899
|
+
const executionScope = new A_Scope({
|
|
900
|
+
name: "A_FrameChannel.embedDefinition",
|
|
901
|
+
fragments: [request]
|
|
902
|
+
}).inherit(A_Context.scope(this));
|
|
903
|
+
try {
|
|
904
|
+
await this.call(A_FrameFeatures.Request, executionScope);
|
|
905
|
+
executionScope.destroy();
|
|
906
|
+
const response = request.response;
|
|
907
|
+
if (!response.data || !response.data[0] || !response.data[0].embedding) {
|
|
908
|
+
throw new A_FrameChannelError({
|
|
909
|
+
title: A_FrameChannelError.InvalidRequest,
|
|
910
|
+
description: `Invalid embedding response for definition "${definition.name}"`
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
const vector = new Float32Array(response.data[0].embedding);
|
|
914
|
+
definition.hydrateFromEmbedding(vector, {
|
|
915
|
+
model: response.model,
|
|
916
|
+
dimensions: response.meta.dimensions,
|
|
917
|
+
inputCount: response.meta.input_count,
|
|
918
|
+
aFrameServerVersion: response.meta.server_version,
|
|
919
|
+
aFrameVersion: env.A_FRAME_VERSION,
|
|
920
|
+
credentialId: response.meta.credential_id,
|
|
921
|
+
date: response.date,
|
|
922
|
+
aFrameMeta: response.aFrameMeta
|
|
923
|
+
});
|
|
924
|
+
} catch (err) {
|
|
925
|
+
throw new A_FrameChannelError({
|
|
926
|
+
title: A_FrameChannelError.RequestFailed,
|
|
927
|
+
description: `Failed to embed definition "${definition.name}": ${err instanceof Error ? err.message : String(err)}`
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
async embedNamespace(namespace, env) {
|
|
932
|
+
const request = new A_FrameChannelRequest("POST", "/api/v1/namespace/embed", {
|
|
933
|
+
namespace: namespace.toJSON()
|
|
934
|
+
});
|
|
935
|
+
const executionScope = new A_Scope({
|
|
936
|
+
name: "A_FrameChannel.embedNamespace",
|
|
937
|
+
fragments: [request]
|
|
938
|
+
}).inherit(A_Context.scope(this));
|
|
939
|
+
try {
|
|
940
|
+
await this.call(A_FrameFeatures.Request, executionScope);
|
|
941
|
+
executionScope.destroy();
|
|
942
|
+
const response = request.response;
|
|
943
|
+
if (!response.data || !response.data[0] || !response.data[0].embedding) {
|
|
944
|
+
throw new A_FrameChannelError({
|
|
945
|
+
title: A_FrameChannelError.InvalidRequest,
|
|
946
|
+
description: `Invalid embedding response for namespace "${namespace.name}"`
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
const vector = new Float32Array(response.data[0].embedding);
|
|
950
|
+
namespace.hydrateFromEmbedding(vector, {
|
|
951
|
+
model: response.model,
|
|
952
|
+
dimensions: response.meta.dimensions,
|
|
953
|
+
inputCount: response.meta.input_count,
|
|
954
|
+
aFrameServerVersion: response.meta.server_version,
|
|
955
|
+
aFrameVersion: env.A_FRAME_VERSION,
|
|
956
|
+
credentialId: response.meta.credential_id,
|
|
957
|
+
date: response.date
|
|
958
|
+
});
|
|
959
|
+
} catch (err) {
|
|
960
|
+
throw new A_FrameChannelError({
|
|
961
|
+
title: A_FrameChannelError.RequestFailed,
|
|
962
|
+
description: `Failed to embed namespace "${namespace.name}": ${err instanceof Error ? err.message : String(err)}`
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
async embedSegment(segment, env) {
|
|
967
|
+
const request = new A_FrameChannelRequest("POST", "/api/v1/segment/embed", {
|
|
968
|
+
segment: segment.toJSON()
|
|
969
|
+
});
|
|
970
|
+
const executionScope = new A_Scope({
|
|
971
|
+
name: "A_FrameChannel.embedNamespace",
|
|
972
|
+
fragments: [request]
|
|
973
|
+
}).inherit(A_Context.scope(this));
|
|
974
|
+
try {
|
|
975
|
+
await this.call(A_FrameFeatures.Request, executionScope);
|
|
976
|
+
executionScope.destroy();
|
|
977
|
+
const response = request.response;
|
|
978
|
+
if (!response.data || !response.data[0] || !response.data[0].embedding) {
|
|
979
|
+
throw new A_FrameChannelError({
|
|
980
|
+
title: A_FrameChannelError.InvalidRequest,
|
|
981
|
+
description: `Error during embed a segment: ${segment.content}`
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
const vector = new Float32Array(response.data[0].embedding);
|
|
985
|
+
segment.fromJSON({
|
|
986
|
+
aseid: segment.aseid.toString(),
|
|
987
|
+
content: segment.content,
|
|
988
|
+
hash: segment.hash,
|
|
989
|
+
embedding: vector,
|
|
990
|
+
model: response.model,
|
|
991
|
+
// dimensions: response.meta.dimensions,
|
|
992
|
+
// inputCount: response.meta.input_count,
|
|
993
|
+
aFrameServerVersion: response.meta.server_version,
|
|
994
|
+
aFrameVersion: env.A_FRAME_VERSION,
|
|
995
|
+
credentialId: response.meta.credential_id,
|
|
996
|
+
embeddedAt: response.date
|
|
997
|
+
});
|
|
998
|
+
} catch (err) {
|
|
999
|
+
throw new A_FrameChannelError({
|
|
1000
|
+
title: A_FrameChannelError.RequestFailed,
|
|
1001
|
+
description: `Failed to embed segment with content "${segment.content}": ${err instanceof Error ? err.message : String(err)}`
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
async generateDynamicStructure(structure, session, operation) {
|
|
1006
|
+
const openRequest = new A_FrameChannelRequest(
|
|
1007
|
+
"POST",
|
|
1008
|
+
"/api/v1/dsg/stream/open"
|
|
1009
|
+
);
|
|
1010
|
+
const openScope = new A_Scope({
|
|
1011
|
+
name: "A_FrameChannel.generateDynamicStructure:open",
|
|
1012
|
+
fragments: [openRequest]
|
|
1013
|
+
}).inherit(A_Context.scope(this));
|
|
1014
|
+
await this.call(A_FrameFeatures.Request, openScope);
|
|
1015
|
+
openScope.destroy();
|
|
1016
|
+
const { channelId } = openRequest.response;
|
|
1017
|
+
const channel = this;
|
|
1018
|
+
const dsgStream = new A_FrameChannelDsgStream({
|
|
1019
|
+
method: "GET",
|
|
1020
|
+
path: `/api/v1/dsg/stream/${channelId}`
|
|
1021
|
+
});
|
|
1022
|
+
dsgStream.setRespondFn(async (requestId, data) => {
|
|
1023
|
+
const respondRequest = new A_FrameChannelRequest(
|
|
1024
|
+
"POST",
|
|
1025
|
+
"/api/v1/dsg/stream/respond",
|
|
1026
|
+
{ requestId, data }
|
|
1027
|
+
);
|
|
1028
|
+
const respondScope = new A_Scope({
|
|
1029
|
+
name: "A_FrameChannel.generateDynamicStructure:respond",
|
|
1030
|
+
fragments: [respondRequest]
|
|
1031
|
+
}).inherit(A_Context.scope(channel));
|
|
1032
|
+
await channel.call(A_FrameFeatures.Request, respondScope);
|
|
1033
|
+
respondScope.destroy();
|
|
1034
|
+
});
|
|
1035
|
+
const streamScope = new A_Scope({
|
|
1036
|
+
name: "A_FrameChannel.generateDynamicStructure:stream",
|
|
1037
|
+
entities: [dsgStream]
|
|
1038
|
+
}).inherit(A_Context.scope(this));
|
|
1039
|
+
const streamTask = this.call(A_FrameFeatures.Stream, streamScope);
|
|
1040
|
+
const generateRequest = new A_FrameChannelRequest(
|
|
1041
|
+
"POST",
|
|
1042
|
+
"/api/v1/dsg/structure/generate-stream",
|
|
1043
|
+
{ channelId, prompt: structure.prompt }
|
|
1044
|
+
);
|
|
1045
|
+
const generateScope = new A_Scope({
|
|
1046
|
+
name: "A_FrameChannel.generateDynamicStructure:generate",
|
|
1047
|
+
fragments: [generateRequest]
|
|
1048
|
+
}).inherit(A_Context.scope(this));
|
|
1049
|
+
await this.call(A_FrameFeatures.Request, generateScope);
|
|
1050
|
+
generateScope.destroy();
|
|
1051
|
+
await streamTask;
|
|
1052
|
+
streamScope.destroy();
|
|
1053
|
+
structure.hydrateFromResolved(
|
|
1054
|
+
dsgStream.resolvedComponents,
|
|
1055
|
+
{ model: "sse-stream", serverVersion: "0.0.0" }
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
async generateDynamicContent(content, operation) {
|
|
1059
|
+
const request = new A_FrameChannelRequest(
|
|
1060
|
+
"POST",
|
|
1061
|
+
"/api/v1/content/generate",
|
|
1062
|
+
{ prompt: content.prompt, model: content.modelName }
|
|
1063
|
+
);
|
|
1064
|
+
const requestScope = new A_Scope({
|
|
1065
|
+
name: "A_FrameChannel.generateDynamicContent",
|
|
1066
|
+
fragments: [request]
|
|
1067
|
+
}).inherit(A_Context.scope(this));
|
|
1068
|
+
await this.call(A_FrameFeatures.Request, requestScope);
|
|
1069
|
+
requestScope.destroy();
|
|
1070
|
+
const resp = request.response;
|
|
1071
|
+
const segments = (resp.segments ?? []).map((w) => {
|
|
1072
|
+
const seg = new A_FrameSegment({ content: w.content });
|
|
1073
|
+
if (w.embedding?.length) {
|
|
1074
|
+
seg.hydrateFromEmbedding(new Float32Array(w.embedding));
|
|
1075
|
+
}
|
|
1076
|
+
return seg;
|
|
1077
|
+
});
|
|
1078
|
+
content.hydrateFromGeneration(segments, {
|
|
1079
|
+
model: resp.model,
|
|
1080
|
+
serverVersion: resp.meta?.server_version ?? "0.0.0"
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
async patchDynamicContent(content, operation) {
|
|
1084
|
+
const { instruction, segments } = operation.params;
|
|
1085
|
+
const wireIdToAseid = /* @__PURE__ */ new Map();
|
|
1086
|
+
const wireSegments = segments.map((s, idx) => {
|
|
1087
|
+
const wireId = `s${idx}`;
|
|
1088
|
+
wireIdToAseid.set(wireId, String(s.id));
|
|
1089
|
+
return {
|
|
1090
|
+
id: wireId,
|
|
1091
|
+
index: idx,
|
|
1092
|
+
text: s.content,
|
|
1093
|
+
vector: s.vector ? Array.from(s.vector.values) : void 0
|
|
1094
|
+
};
|
|
1095
|
+
});
|
|
1096
|
+
const request = new A_FrameChannelRequest(
|
|
1097
|
+
"POST",
|
|
1098
|
+
"/api/v1/content/patch",
|
|
1099
|
+
{
|
|
1100
|
+
prompt: content.prompt,
|
|
1101
|
+
segments: wireSegments,
|
|
1102
|
+
instruction,
|
|
1103
|
+
model: content.modelName
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
const requestScope = new A_Scope({
|
|
1107
|
+
name: "A_FrameChannel.patchDynamicContent",
|
|
1108
|
+
fragments: [request]
|
|
1109
|
+
}).inherit(A_Context.scope(this));
|
|
1110
|
+
await this.call(A_FrameFeatures.Request, requestScope);
|
|
1111
|
+
requestScope.destroy();
|
|
1112
|
+
const resp = request.response;
|
|
1113
|
+
const translatedOperations = resp.operations.map((op) => ({
|
|
1114
|
+
...op,
|
|
1115
|
+
targetId: op.targetId ? wireIdToAseid.get(op.targetId) ?? op.targetId : op.targetId
|
|
1116
|
+
}));
|
|
1117
|
+
content.hydrateFromPatch(
|
|
1118
|
+
{ ...resp, operations: translatedOperations },
|
|
1119
|
+
{
|
|
1120
|
+
model: resp.model,
|
|
1121
|
+
serverVersion: resp.meta?.server_version ?? "0.0.0"
|
|
1122
|
+
}
|
|
1123
|
+
);
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
__decorateClass([
|
|
1127
|
+
A_Feature.Extend({
|
|
1128
|
+
name: A_FrameDefinitionFeatures.Embed,
|
|
1129
|
+
scope: [A_FrameDefinition]
|
|
1130
|
+
}),
|
|
1131
|
+
__decorateParam(0, A_Inject(A_Caller)),
|
|
1132
|
+
__decorateParam(1, A_Inject(A_FrameEnv))
|
|
1133
|
+
], A_FrameChannel.prototype, "embedDefinition", 1);
|
|
1134
|
+
__decorateClass([
|
|
1135
|
+
A_Feature.Extend({
|
|
1136
|
+
name: A_FrameNamespaceFeatures.Embed,
|
|
1137
|
+
scope: [A_FrameNamespace]
|
|
1138
|
+
}),
|
|
1139
|
+
__decorateParam(0, A_Inject(A_Caller)),
|
|
1140
|
+
__decorateParam(1, A_Inject(A_FrameEnv))
|
|
1141
|
+
], A_FrameChannel.prototype, "embedNamespace", 1);
|
|
1142
|
+
__decorateClass([
|
|
1143
|
+
A_Feature.Extend({
|
|
1144
|
+
name: A_FrameSegmentFeatures.Embed,
|
|
1145
|
+
scope: [A_FrameSegment]
|
|
1146
|
+
}),
|
|
1147
|
+
__decorateParam(0, A_Inject(A_Caller)),
|
|
1148
|
+
__decorateParam(1, A_Inject(A_FrameEnv))
|
|
1149
|
+
], A_FrameChannel.prototype, "embedSegment", 1);
|
|
1150
|
+
__decorateClass([
|
|
1151
|
+
A_Feature.Extend({
|
|
1152
|
+
name: A_FrameDynamicStructureFeatures.Generate,
|
|
1153
|
+
scope: [A_FrameDynamicStructure]
|
|
1154
|
+
}),
|
|
1155
|
+
__decorateParam(0, A_Inject(A_Caller)),
|
|
1156
|
+
__decorateParam(1, A_Inject(A_FrameDynamicSession)),
|
|
1157
|
+
__decorateParam(2, A_Inject(A_FrameDynamicStructureOperation))
|
|
1158
|
+
], A_FrameChannel.prototype, "generateDynamicStructure", 1);
|
|
1159
|
+
__decorateClass([
|
|
1160
|
+
A_Feature.Extend({
|
|
1161
|
+
name: A_FrameDynamicContentFeatures.Generate,
|
|
1162
|
+
scope: [A_FrameDynamicContent]
|
|
1163
|
+
}),
|
|
1164
|
+
__decorateParam(0, A_Inject(A_Caller)),
|
|
1165
|
+
__decorateParam(1, A_Inject(A_FrameDynamicContentOperation))
|
|
1166
|
+
], A_FrameChannel.prototype, "generateDynamicContent", 1);
|
|
1167
|
+
__decorateClass([
|
|
1168
|
+
A_Feature.Extend({
|
|
1169
|
+
name: A_FrameDynamicContentFeatures.Patch,
|
|
1170
|
+
scope: [A_FrameDynamicContent]
|
|
1171
|
+
}),
|
|
1172
|
+
__decorateParam(0, A_Inject(A_Caller)),
|
|
1173
|
+
__decorateParam(1, A_Inject(A_FrameDynamicContentOperation))
|
|
1174
|
+
], A_FrameChannel.prototype, "patchDynamicContent", 1);
|
|
1175
|
+
var A_FrameNodeChannel = class extends A_FrameChannel {
|
|
1176
|
+
async request(context, env) {
|
|
1177
|
+
const url = `${env.A_FRAME_SERVER_URL}${context.path}`;
|
|
1178
|
+
const parsedUrl = new URL(url);
|
|
1179
|
+
const client = parsedUrl.protocol === "https:" ? https : http;
|
|
1180
|
+
const payload = context.body !== void 0 ? JSON.stringify(context.body) : void 0;
|
|
1181
|
+
const result = await new Promise((resolve, reject) => {
|
|
1182
|
+
const req = client.request(
|
|
1183
|
+
{
|
|
1184
|
+
protocol: parsedUrl.protocol,
|
|
1185
|
+
hostname: parsedUrl.hostname,
|
|
1186
|
+
port: parsedUrl.port,
|
|
1187
|
+
path: `${parsedUrl.pathname}${parsedUrl.search}`,
|
|
1188
|
+
method: context.method,
|
|
1189
|
+
headers: {
|
|
1190
|
+
...payload ? { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(payload) } : {},
|
|
1191
|
+
Authorization: `Bearer ${env.A_FRAME_SERVER_API_KEY}`
|
|
1192
|
+
}
|
|
1193
|
+
},
|
|
1194
|
+
(res) => {
|
|
1195
|
+
const chunks = [];
|
|
1196
|
+
res.on("data", (chunk) => chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)));
|
|
1197
|
+
res.on("end", () => {
|
|
1198
|
+
const raw = Buffer.concat(chunks).toString("utf8");
|
|
1199
|
+
if ((res.statusCode ?? 500) >= 400) {
|
|
1200
|
+
console.error(`[A-FrameChannel] <-- ${res.statusCode} ${context.method} ${url}`);
|
|
1201
|
+
reject(
|
|
1202
|
+
new A_FrameChannelError({
|
|
1203
|
+
title: A_FrameChannelError.RequestFailed,
|
|
1204
|
+
description: `Request to ${context.path} failed with status ${res.statusCode}`
|
|
1205
|
+
})
|
|
1206
|
+
);
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
if (!raw) {
|
|
1210
|
+
console.log(`[A-FrameChannel] <-- ${res.statusCode} ${context.method} ${url} (empty)`);
|
|
1211
|
+
resolve(void 0);
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
try {
|
|
1215
|
+
const parsed = JSON.parse(raw);
|
|
1216
|
+
console.log(`[A-FrameChannel] <-- ${res.statusCode} ${context.method} ${url}`);
|
|
1217
|
+
resolve(parsed);
|
|
1218
|
+
} catch {
|
|
1219
|
+
console.error(`[A-FrameChannel] <-- ${res.statusCode} ${context.method} ${url} (invalid JSON)`);
|
|
1220
|
+
reject(
|
|
1221
|
+
new A_FrameChannelError({
|
|
1222
|
+
title: A_FrameChannelError.RequestFailed,
|
|
1223
|
+
description: `Invalid JSON response from ${context.path}`
|
|
1224
|
+
})
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
);
|
|
1230
|
+
req.setTimeout(env.A_FRAME_REQUEST_TIMEOUT, () => {
|
|
1231
|
+
console.error(`[A-FrameChannel] TIMEOUT ${context.method} ${url}`);
|
|
1232
|
+
req.destroy(
|
|
1233
|
+
new A_FrameChannelError({
|
|
1234
|
+
title: A_FrameChannelError.Timeout,
|
|
1235
|
+
description: `Request to ${context.path} timed out after ${env.A_FRAME_REQUEST_TIMEOUT}ms`
|
|
1236
|
+
})
|
|
1237
|
+
);
|
|
1238
|
+
});
|
|
1239
|
+
req.on("error", (err) => reject(err));
|
|
1240
|
+
if (payload) req.write(payload);
|
|
1241
|
+
req.end();
|
|
1242
|
+
});
|
|
1243
|
+
context.complete(result);
|
|
1244
|
+
}
|
|
1245
|
+
async stream(stream, env) {
|
|
1246
|
+
const url = `${env.A_FRAME_SERVER_URL}${stream.path}`;
|
|
1247
|
+
const parsedUrl = new URL(url);
|
|
1248
|
+
const client = parsedUrl.protocol === "https:" ? https : http;
|
|
1249
|
+
const payload = stream.body !== void 0 ? JSON.stringify(stream.body) : void 0;
|
|
1250
|
+
await new Promise((resolve, reject) => {
|
|
1251
|
+
const req = client.request(
|
|
1252
|
+
{
|
|
1253
|
+
protocol: parsedUrl.protocol,
|
|
1254
|
+
hostname: parsedUrl.hostname,
|
|
1255
|
+
port: parsedUrl.port,
|
|
1256
|
+
path: `${parsedUrl.pathname}${parsedUrl.search}`,
|
|
1257
|
+
method: stream.method,
|
|
1258
|
+
headers: {
|
|
1259
|
+
...payload ? { "Content-Type": "application/json" } : {},
|
|
1260
|
+
Accept: "text/event-stream",
|
|
1261
|
+
Authorization: `Bearer ${env.A_FRAME_SERVER_API_KEY}`,
|
|
1262
|
+
...payload ? { "Content-Length": Buffer.byteLength(payload) } : {}
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
(res) => {
|
|
1266
|
+
if ((res.statusCode ?? 500) >= 400) {
|
|
1267
|
+
console.error(`[A-FrameChannel] <-- ${res.statusCode} ${stream.method} ${url}`);
|
|
1268
|
+
reject(
|
|
1269
|
+
new A_FrameChannelError({
|
|
1270
|
+
title: A_FrameChannelError.RequestFailed,
|
|
1271
|
+
description: `Stream request to ${stream.path} failed with status ${res.statusCode}`
|
|
1272
|
+
})
|
|
1273
|
+
);
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
let buffer = "";
|
|
1277
|
+
res.on("data", async (chunk) => {
|
|
1278
|
+
buffer += Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk);
|
|
1279
|
+
const lines = buffer.split("\n");
|
|
1280
|
+
buffer = lines.pop() || "";
|
|
1281
|
+
for (const line of lines) {
|
|
1282
|
+
if (!line.startsWith("data: ")) continue;
|
|
1283
|
+
const data = line.slice(6).trim();
|
|
1284
|
+
if (data === "[DONE]") continue;
|
|
1285
|
+
try {
|
|
1286
|
+
const event = JSON.parse(data);
|
|
1287
|
+
await stream.propagate(event.type, event.data);
|
|
1288
|
+
} catch {
|
|
1289
|
+
console.error(`[A-FrameChannel] Invalid SSE payload from ${stream.path}: ${data}`);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
res.on("end", () => {
|
|
1294
|
+
console.log(`[A-FrameChannel] <-- ${res.statusCode} ${stream.method} ${url} (stream complete)`);
|
|
1295
|
+
resolve();
|
|
1296
|
+
});
|
|
1297
|
+
res.on("error", (err) => reject(err));
|
|
1298
|
+
}
|
|
1299
|
+
);
|
|
1300
|
+
req.setTimeout(3e5, () => {
|
|
1301
|
+
console.error(`[A-FrameChannel] TIMEOUT ${stream.method} ${url}`);
|
|
1302
|
+
req.destroy(
|
|
1303
|
+
new A_FrameChannelError({
|
|
1304
|
+
title: A_FrameChannelError.Timeout,
|
|
1305
|
+
description: `Stream request to ${stream.path} timed out after 300 seconds`
|
|
1306
|
+
})
|
|
1307
|
+
);
|
|
1308
|
+
});
|
|
1309
|
+
req.on("error", (err) => reject(err));
|
|
1310
|
+
if (payload) req.write(payload);
|
|
1311
|
+
req.end();
|
|
1312
|
+
});
|
|
1313
|
+
stream.complete();
|
|
1314
|
+
}
|
|
1315
|
+
async send(stream, event, env) {
|
|
1316
|
+
const url = `${env.A_FRAME_SERVER_URL}${stream.path}/send`;
|
|
1317
|
+
const parsedUrl = new URL(url);
|
|
1318
|
+
const client = parsedUrl.protocol === "https:" ? https : http;
|
|
1319
|
+
const payload = JSON.stringify({ type: event.name, data: event.data });
|
|
1320
|
+
await new Promise((resolve, reject) => {
|
|
1321
|
+
const req = client.request(
|
|
1322
|
+
{
|
|
1323
|
+
protocol: parsedUrl.protocol,
|
|
1324
|
+
hostname: parsedUrl.hostname,
|
|
1325
|
+
port: parsedUrl.port,
|
|
1326
|
+
path: `${parsedUrl.pathname}${parsedUrl.search}`,
|
|
1327
|
+
method: "POST",
|
|
1328
|
+
headers: {
|
|
1329
|
+
"Content-Type": "application/json",
|
|
1330
|
+
Authorization: `Bearer ${env.A_FRAME_SERVER_API_KEY}`,
|
|
1331
|
+
"Content-Length": Buffer.byteLength(payload)
|
|
1332
|
+
}
|
|
1333
|
+
},
|
|
1334
|
+
(res) => {
|
|
1335
|
+
res.resume();
|
|
1336
|
+
res.on("end", () => {
|
|
1337
|
+
if ((res.statusCode ?? 500) >= 400) {
|
|
1338
|
+
console.error(`[A-FrameChannel] <-- ${res.statusCode} POST ${url}`);
|
|
1339
|
+
reject(
|
|
1340
|
+
new A_FrameChannelError({
|
|
1341
|
+
title: A_FrameChannelError.RequestFailed,
|
|
1342
|
+
description: `Send event "${event.name}" to ${stream.path} failed with status ${res.statusCode}`
|
|
1343
|
+
})
|
|
1344
|
+
);
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
console.log(`[A-FrameChannel] --> ${res.statusCode} POST ${url} (event: ${event.name})`);
|
|
1348
|
+
resolve();
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
);
|
|
1352
|
+
req.setTimeout(15e3, () => {
|
|
1353
|
+
console.error(`[A-FrameChannel] TIMEOUT POST ${url}`);
|
|
1354
|
+
req.destroy(
|
|
1355
|
+
new A_FrameChannelError({
|
|
1356
|
+
title: A_FrameChannelError.Timeout,
|
|
1357
|
+
description: `Send event "${event.name}" to ${stream.path} timed out after 15 seconds`
|
|
1358
|
+
})
|
|
1359
|
+
);
|
|
1360
|
+
});
|
|
1361
|
+
req.on("error", (err) => reject(err));
|
|
1362
|
+
req.write(payload);
|
|
1363
|
+
req.end();
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
__decorateClass([
|
|
1368
|
+
A_Feature.Extend({
|
|
1369
|
+
name: A_FrameFeatures.Request,
|
|
1370
|
+
scope: [A_FrameChannel]
|
|
1371
|
+
}),
|
|
1372
|
+
__decorateParam(0, A_Inject(A_FrameChannelRequest)),
|
|
1373
|
+
__decorateParam(1, A_Inject(A_FrameEnv))
|
|
1374
|
+
], A_FrameNodeChannel.prototype, "request", 1);
|
|
1375
|
+
__decorateClass([
|
|
1376
|
+
A_Feature.Extend({
|
|
1377
|
+
name: A_FrameFeatures.Stream,
|
|
1378
|
+
scope: [A_FrameChannel]
|
|
1379
|
+
}),
|
|
1380
|
+
__decorateParam(0, A_Inject(A_FrameChannelStream)),
|
|
1381
|
+
__decorateParam(1, A_Inject(A_FrameEnv))
|
|
1382
|
+
], A_FrameNodeChannel.prototype, "stream", 1);
|
|
1383
|
+
__decorateClass([
|
|
1384
|
+
A_Feature.Extend({
|
|
1385
|
+
name: A_FrameFeatures.Send,
|
|
1386
|
+
scope: [A_FrameChannel]
|
|
1387
|
+
}),
|
|
1388
|
+
__decorateParam(0, A_Inject(A_FrameChannelStream)),
|
|
1389
|
+
__decorateParam(1, A_Inject(A_FrameChannelEvent)),
|
|
1390
|
+
__decorateParam(2, A_Inject(A_FrameEnv))
|
|
1391
|
+
], A_FrameNodeChannel.prototype, "send", 1);
|
|
1392
|
+
|
|
1393
|
+
export { A_FrameChannel, A_FrameChannelError, A_FrameChannelEvent, A_FrameChannelRequest, A_FrameChannelSocketFeatures, A_FrameChannelSocketStatuses, A_FrameChannelStream, A_FrameChannelStreamFeatures, A_FrameChannelStreamStatuses, A_FrameFeatures, A_FrameNodeChannel };
|
|
1394
|
+
//# sourceMappingURL=chunk-7NSLGCAZ.mjs.map
|
|
1395
|
+
//# sourceMappingURL=chunk-7NSLGCAZ.mjs.map
|