space-data-module-sdk 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -20
- package/bin/space-data-module.js +263 -0
- package/docs/.nojekyll +1 -0
- package/docs/AGENTS.md +34 -0
- package/docs/architecture.svg +141 -0
- package/docs/browser-wasmedge-isomorphic.md +179 -0
- package/docs/flatsql-streaming-standard.md +341 -0
- package/docs/gpu-module-abi.md +193 -0
- package/docs/index.html +125 -0
- package/docs/isomorphic-pthreads.md +188 -0
- package/docs/isomorphic-sdn-runtime-plan.md +167 -0
- package/docs/language-runtime-matrix.md +82 -0
- package/docs/manifest-structure.svg +114 -0
- package/docs/module-bundle-runtime-plan.md +19 -0
- package/docs/module-lifecycle.svg +70 -0
- package/docs/module-publication-standard.md +540 -0
- package/docs/node-red-default-node-parity.md +88 -0
- package/docs/protocol-installation.md +196 -0
- package/docs/secrets-capability.md +152 -0
- package/docs/styles.css +288 -0
- package/docs/testing-harness.md +408 -0
- package/docs/tri-runtime-parity.md +132 -0
- package/docs/wallet-callback.html +2 -0
- package/package.json +25 -6
- package/schemas/HttpRequestAbi.fbs +41 -0
- package/schemas/HttpResponseAbi.fbs +36 -0
- package/schemas/PluginManifest.fbs +2 -1
- package/src/AGENTS.md +1 -1
- package/src/app/codec.js +548 -0
- package/src/app/index.js +6 -0
- package/src/browser.js +5 -0
- package/src/bundle/constants.js +1 -0
- package/src/bundle/index.js +15 -0
- package/src/bundle/sigdomain.js +179 -0
- package/src/bundle/signing.js +767 -0
- package/src/bundle/wasm.js +3 -2
- package/src/capabilities.js +3 -0
- package/src/compat/index.js +7 -0
- package/src/compat/sdnLegacy.js +449 -0
- package/src/compiler/compileModule.js +556 -55
- package/src/compiler/flatcSupport.js +41 -27
- package/src/compiler/index.d.ts +2 -0
- package/src/compiler/index.js +18 -0
- package/src/compiler/invokeGlue.js +1212 -183
- package/src/compiler/pthreadArtifactGuard.js +910 -0
- package/src/compiler/sdnShimGenerator.js +323 -0
- package/src/compiler/wasiThreadsToolchain.js +150 -0
- package/src/compliance/index.js +11 -1
- package/src/compliance/legacyWildcardPorts.js +228 -0
- package/src/compliance/pluginCompliance.js +1000 -96
- package/src/field-stream/index.d.ts +31 -0
- package/src/field-stream/index.js +119 -0
- package/src/flow/dependencyStreamBridge.js +234 -0
- package/src/flow/flatsqlLinkShim.js +304 -0
- package/src/flow/flowCodec.js +107 -0
- package/src/flow/flowCompiler.js +2900 -0
- package/src/flow/flowRuntimeHost.js +877 -0
- package/src/flow/index.d.ts +117 -0
- package/src/flow/index.js +31 -0
- package/src/flow/isomorphicFlowHost.js +384 -0
- package/src/flow/jsFlowRuntime.js +275 -0
- package/src/flow/normalize.js +294 -0
- package/src/flow/runtime-src/flow_runtime.cpp +1699 -0
- package/src/flow/vendor/sdn-flow/MethodRegistry.js +400 -0
- package/src/flow/vendor/sdn-flow/constants.js +39 -0
- package/src/flow/vendor/sdn-flow/index.js +29 -0
- package/src/flow/vendor/sdn-flow/normalize.js +506 -0
- package/src/flow/vendor/sdn-flow/wasmCompatibility.js +189 -0
- package/src/generated/http/cpp/HttpRequestAbi_generated.h +285 -0
- package/src/generated/http/cpp/HttpResponseAbi_generated.h +192 -0
- package/src/generated/http/sdn/http/http-header.js +53 -0
- package/src/generated/http/sdn/http/http-header.ts +67 -0
- package/src/generated/http/sdn/http/http-request.js +132 -0
- package/src/generated/http/sdn/http/http-request.ts +179 -0
- package/src/generated/http/sdn/http/http-response.js +144 -0
- package/src/generated/http/sdn/http/http-response.ts +168 -0
- package/src/generated/http/sdn/http.js +11 -0
- package/src/generated/http/sdn/http.ts +4 -0
- package/src/generated/orbpro/flow/backpressure-policy.d.ts +12 -0
- package/src/generated/orbpro/flow/backpressure-policy.d.ts.map +1 -0
- package/src/generated/orbpro/flow/backpressure-policy.js +17 -0
- package/src/generated/orbpro/flow/backpressure-policy.js.map +1 -0
- package/src/generated/orbpro/flow/backpressure-policy.ts +15 -0
- package/src/generated/orbpro/flow/flow-bundle-manifest.d.ts +142 -0
- package/src/generated/orbpro/flow/flow-bundle-manifest.d.ts.map +1 -0
- package/src/generated/orbpro/flow/flow-bundle-manifest.js +304 -0
- package/src/generated/orbpro/flow/flow-bundle-manifest.js.map +1 -0
- package/src/generated/orbpro/flow/flow-bundle-manifest.ts +399 -0
- package/src/generated/orbpro/flow/flow-edge.d.ts +113 -0
- package/src/generated/orbpro/flow/flow-edge.d.ts.map +1 -0
- package/src/generated/orbpro/flow/flow-edge.js +221 -0
- package/src/generated/orbpro/flow/flow-edge.js.map +1 -0
- package/src/generated/orbpro/flow/flow-edge.ts +292 -0
- package/src/generated/orbpro/flow/flow-node.d.ts +80 -0
- package/src/generated/orbpro/flow/flow-node.d.ts.map +1 -0
- package/src/generated/orbpro/flow/flow-node.js +158 -0
- package/src/generated/orbpro/flow/flow-node.js.map +1 -0
- package/src/generated/orbpro/flow/flow-node.ts +202 -0
- package/src/generated/orbpro/flow/flow-program.d.ts +164 -0
- package/src/generated/orbpro/flow/flow-program.d.ts.map +1 -0
- package/src/generated/orbpro/flow/flow-program.js +350 -0
- package/src/generated/orbpro/flow/flow-program.js.map +1 -0
- package/src/generated/orbpro/flow/flow-program.ts +477 -0
- package/src/generated/orbpro/flow/flow-trigger.d.ts +108 -0
- package/src/generated/orbpro/flow/flow-trigger.d.ts.map +1 -0
- package/src/generated/orbpro/flow/flow-trigger.js +207 -0
- package/src/generated/orbpro/flow/flow-trigger.js.map +1 -0
- package/src/generated/orbpro/flow/flow-trigger.ts +276 -0
- package/src/generated/orbpro/flow/node-kind.d.ts +13 -0
- package/src/generated/orbpro/flow/node-kind.d.ts.map +1 -0
- package/src/generated/orbpro/flow/node-kind.js +16 -0
- package/src/generated/orbpro/flow/node-kind.js.map +1 -0
- package/src/generated/orbpro/{invoke.ts → flow/node-kind.ts} +12 -2
- package/src/generated/orbpro/flow/plugin-version-binding.d.ts +52 -0
- package/src/generated/orbpro/flow/plugin-version-binding.d.ts.map +1 -0
- package/src/generated/orbpro/flow/plugin-version-binding.js +85 -0
- package/src/generated/orbpro/flow/plugin-version-binding.js.map +1 -0
- package/src/generated/orbpro/flow/plugin-version-binding.ts +121 -0
- package/src/generated/orbpro/flow/schema-hash-binding.d.ts +70 -0
- package/src/generated/orbpro/flow/schema-hash-binding.d.ts.map +1 -0
- package/src/generated/orbpro/flow/schema-hash-binding.js +143 -0
- package/src/generated/orbpro/flow/schema-hash-binding.js.map +1 -0
- package/src/generated/orbpro/flow/schema-hash-binding.ts +189 -0
- package/src/generated/orbpro/flow/trigger-binding.d.ts +71 -0
- package/src/generated/orbpro/flow/trigger-binding.d.ts.map +1 -0
- package/src/generated/orbpro/flow/trigger-binding.js +142 -0
- package/src/generated/orbpro/flow/trigger-binding.js.map +1 -0
- package/src/generated/orbpro/flow/trigger-binding.ts +181 -0
- package/src/generated/orbpro/flow/trigger-kind.d.ts +14 -0
- package/src/generated/orbpro/flow/trigger-kind.d.ts.map +1 -0
- package/src/generated/orbpro/flow/trigger-kind.js +17 -0
- package/src/generated/orbpro/flow/trigger-kind.js.map +1 -0
- package/src/generated/orbpro/flow/trigger-kind.ts +17 -0
- package/src/generated/orbpro/flow.d.ts +21 -0
- package/src/generated/orbpro/flow.d.ts.map +1 -0
- package/src/generated/orbpro/flow.js +23 -0
- package/src/generated/orbpro/flow.js.map +1 -0
- package/src/generated/orbpro/flow.ts +24 -0
- package/src/generated/orbpro/manifest/capability-kind.d.ts +2 -1
- package/src/generated/orbpro/manifest/capability-kind.js +1 -0
- package/src/generated/orbpro/manifest/capability-kind.ts +1 -0
- package/src/generated/orbpro/plugin/stream-invoke-request.d.ts +93 -0
- package/src/generated/orbpro/plugin/stream-invoke-request.js +160 -0
- package/src/generated/orbpro/plugin/stream-invoke-request.ts +211 -0
- package/src/generated/orbpro/plugin/stream-invoke-response.d.ts +99 -0
- package/src/generated/orbpro/plugin/stream-invoke-response.js +175 -0
- package/src/generated/orbpro/plugin/stream-invoke-response.ts +226 -0
- package/src/generated/orbpro/plugin.js +8 -0
- package/src/generated/orbpro/stream.d.ts +12 -0
- package/src/generated/orbpro/stream.js +14 -0
- package/src/generated/orbpro/stream.ts +15 -0
- package/src/generated/spacedatastandards/plg/EntryFunction.d.ts +52 -0
- package/src/generated/spacedatastandards/plg/EntryFunction.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/EntryFunction.js +106 -0
- package/src/generated/spacedatastandards/plg/EntryFunction.ts +162 -0
- package/src/generated/spacedatastandards/plg/FlatBufferTypeRef.d.ts +90 -0
- package/src/generated/spacedatastandards/plg/FlatBufferTypeRef.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/FlatBufferTypeRef.js +189 -0
- package/src/generated/spacedatastandards/plg/FlatBufferTypeRef.ts +270 -0
- package/src/generated/spacedatastandards/plg/PLG.d.ts +492 -0
- package/src/generated/spacedatastandards/plg/PLG.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLG.js +1139 -0
- package/src/generated/spacedatastandards/plg/PLG.ts +1600 -0
- package/src/generated/spacedatastandards/plg/PLGAcceptedTypeSet.d.ts +63 -0
- package/src/generated/spacedatastandards/plg/PLGAcceptedTypeSet.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGAcceptedTypeSet.js +138 -0
- package/src/generated/spacedatastandards/plg/PLGAcceptedTypeSet.ts +189 -0
- package/src/generated/spacedatastandards/plg/PLGBuildArtifact.d.ts +41 -0
- package/src/generated/spacedatastandards/plg/PLGBuildArtifact.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGBuildArtifact.js +104 -0
- package/src/generated/spacedatastandards/plg/PLGBuildArtifact.ts +151 -0
- package/src/generated/spacedatastandards/plg/PLGFlowEdge.d.ts +68 -0
- package/src/generated/spacedatastandards/plg/PLGFlowEdge.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGFlowEdge.js +124 -0
- package/src/generated/spacedatastandards/plg/PLGFlowEdge.ts +184 -0
- package/src/generated/spacedatastandards/plg/PLGFlowEdgeContract.d.ts +58 -0
- package/src/generated/spacedatastandards/plg/PLGFlowEdgeContract.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGFlowEdgeContract.js +126 -0
- package/src/generated/spacedatastandards/plg/PLGFlowEdgeContract.ts +161 -0
- package/src/generated/spacedatastandards/plg/PLGFlowNode.d.ts +82 -0
- package/src/generated/spacedatastandards/plg/PLGFlowNode.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGFlowNode.js +164 -0
- package/src/generated/spacedatastandards/plg/PLGFlowNode.ts +244 -0
- package/src/generated/spacedatastandards/plg/PLGFlowTrigger.d.ts +55 -0
- package/src/generated/spacedatastandards/plg/PLGFlowTrigger.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGFlowTrigger.js +105 -0
- package/src/generated/spacedatastandards/plg/PLGFlowTrigger.ts +162 -0
- package/src/generated/spacedatastandards/plg/PLGFlowTriggerBinding.d.ts +42 -0
- package/src/generated/spacedatastandards/plg/PLGFlowTriggerBinding.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGFlowTriggerBinding.js +83 -0
- package/src/generated/spacedatastandards/plg/PLGFlowTriggerBinding.ts +127 -0
- package/src/generated/spacedatastandards/plg/PLGHostCapability.d.ts +36 -0
- package/src/generated/spacedatastandards/plg/PLGHostCapability.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGHostCapability.js +90 -0
- package/src/generated/spacedatastandards/plg/PLGHostCapability.ts +127 -0
- package/src/generated/spacedatastandards/plg/PLGMethodManifest.d.ts +53 -0
- package/src/generated/spacedatastandards/plg/PLGMethodManifest.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGMethodManifest.js +153 -0
- package/src/generated/spacedatastandards/plg/PLGMethodManifest.ts +210 -0
- package/src/generated/spacedatastandards/plg/PLGPortManifest.d.ts +70 -0
- package/src/generated/spacedatastandards/plg/PLGPortManifest.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGPortManifest.js +149 -0
- package/src/generated/spacedatastandards/plg/PLGPortManifest.ts +212 -0
- package/src/generated/spacedatastandards/plg/PLGProtocolSpec.d.ts +73 -0
- package/src/generated/spacedatastandards/plg/PLGProtocolSpec.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGProtocolSpec.js +199 -0
- package/src/generated/spacedatastandards/plg/PLGProtocolSpec.ts +292 -0
- package/src/generated/spacedatastandards/plg/PLGTimerSpec.d.ts +40 -0
- package/src/generated/spacedatastandards/plg/PLGTimerSpec.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PLGTimerSpec.js +103 -0
- package/src/generated/spacedatastandards/plg/PLGTimerSpec.ts +148 -0
- package/src/generated/spacedatastandards/plg/PluginCapability.d.ts +41 -0
- package/src/generated/spacedatastandards/plg/PluginCapability.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PluginCapability.js +82 -0
- package/src/generated/spacedatastandards/plg/{plugin-capability.ts → PluginCapability.ts} +55 -18
- package/src/generated/spacedatastandards/plg/PluginDependency.d.ts +42 -0
- package/src/generated/spacedatastandards/plg/PluginDependency.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/PluginDependency.js +80 -0
- package/src/generated/spacedatastandards/plg/PluginDependency.ts +124 -0
- package/src/generated/spacedatastandards/plg/TAB.d.ts +85 -0
- package/src/generated/spacedatastandards/plg/TAB.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/TAB.js +173 -0
- package/src/generated/spacedatastandards/plg/TAB.ts +228 -0
- package/src/generated/spacedatastandards/plg/bufferMutability.d.ts +18 -0
- package/src/generated/spacedatastandards/plg/bufferMutability.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/bufferMutability.js +20 -0
- package/src/generated/spacedatastandards/plg/bufferMutability.ts +23 -0
- package/src/generated/spacedatastandards/plg/bufferOwnership.d.ts +18 -0
- package/src/generated/spacedatastandards/plg/bufferOwnership.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/bufferOwnership.js +20 -0
- package/src/generated/spacedatastandards/plg/bufferOwnership.ts +23 -0
- package/src/generated/spacedatastandards/plg/drainBehavior.d.ts +20 -0
- package/src/generated/spacedatastandards/plg/drainBehavior.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/drainBehavior.js +22 -0
- package/src/generated/spacedatastandards/plg/drainBehavior.ts +25 -0
- package/src/generated/spacedatastandards/plg/flowEdgeRoutePolicy.d.ts +10 -0
- package/src/generated/spacedatastandards/plg/flowEdgeRoutePolicy.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/flowEdgeRoutePolicy.js +12 -0
- package/src/generated/spacedatastandards/plg/flowEdgeRoutePolicy.ts +13 -0
- package/src/generated/spacedatastandards/plg/hostCapabilityKind.d.ts +51 -0
- package/src/generated/spacedatastandards/plg/hostCapabilityKind.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/hostCapabilityKind.js +53 -0
- package/src/generated/spacedatastandards/plg/hostCapabilityKind.ts +55 -0
- package/src/generated/spacedatastandards/plg/invokeSurfaceKind.d.ts +15 -0
- package/src/generated/spacedatastandards/plg/invokeSurfaceKind.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/invokeSurfaceKind.js +17 -0
- package/src/generated/spacedatastandards/plg/invokeSurfaceKind.ts +19 -0
- package/src/generated/spacedatastandards/plg/main.d.ts +29 -0
- package/src/generated/spacedatastandards/plg/main.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/main.js +30 -0
- package/src/generated/spacedatastandards/plg/main.ts +32 -0
- package/src/generated/spacedatastandards/plg/payloadWireFormat.d.ts +17 -0
- package/src/generated/spacedatastandards/plg/payloadWireFormat.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/payloadWireFormat.js +19 -0
- package/src/generated/spacedatastandards/plg/payloadWireFormat.ts +21 -0
- package/src/generated/spacedatastandards/plg/pluginCategory.d.ts +82 -0
- package/src/generated/spacedatastandards/plg/pluginCategory.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/pluginCategory.js +84 -0
- package/src/generated/spacedatastandards/plg/pluginCategory.ts +103 -0
- package/src/generated/spacedatastandards/plg/publicationState.d.ts +18 -0
- package/src/generated/spacedatastandards/plg/publicationState.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/publicationState.js +20 -0
- package/src/generated/spacedatastandards/plg/purchaseTier.d.ts +18 -0
- package/src/generated/spacedatastandards/plg/purchaseTier.d.ts.map +1 -0
- package/src/generated/spacedatastandards/plg/purchaseTier.js +20 -0
- package/src/host/AGENTS.md +2 -2
- package/src/host/abi.js +53 -66
- package/src/host/browserHost.js +355 -8
- package/src/host/cpp/keyslotClient.hpp +231 -0
- package/src/host/cpp/secretsClient.hpp +583 -0
- package/src/host/hostcallWire.js +183 -0
- package/src/host/index.js +2 -0
- package/src/host/isomorphicLoader.js +44 -7
- package/src/host/nodeHost.js +227 -8
- package/src/host/sabHostcallChannel.js +206 -0
- package/src/host/timerDriver.js +203 -0
- package/src/host/wasiShim.js +41 -1
- package/src/host/wasiThreadBrowserWorker.mjs +48 -0
- package/src/host/wasiThreadHost.js +393 -0
- package/src/host/wasiThreadWorker.mjs +32 -0
- package/src/host/wasiThreadWorkerRuntime.js +93 -0
- package/src/http/index.js +339 -0
- package/src/index.d.ts +716 -10
- package/src/index.js +4 -0
- package/src/invoke/codec.js +1202 -128
- package/src/invoke/index.js +5 -1
- package/src/licensing/index.d.ts +2 -0
- package/src/licensing/index.js +2 -0
- package/src/licensing/records.js +287 -8
- package/src/manifest/codec.js +62 -14
- package/src/manifest/index.js +2 -0
- package/src/manifest/legacyToPlg.js +164 -25
- package/src/manifest/normalize.js +1 -0
- package/src/manifest/plgCodec.js +1303 -62
- package/src/manifest/typeRefs.js +162 -24
- package/src/runtime/compiledRuntimeAbi.js +47 -0
- package/src/runtime/compiledRuntimeAbi.json +33 -0
- package/src/runtime/index.d.ts +32 -0
- package/src/runtime/index.js +1 -0
- package/src/runtime-host/index.js +3 -0
- package/src/runtime-host/methodRegistry.js +55 -0
- package/src/standards/index.js +200 -56
- package/src/standards/sharedCatalog.js +16 -0
- package/src/testing/browserModuleHarness.js +604 -31
- package/src/testing/docker/wasmedge-parity.Dockerfile +39 -0
- package/src/testing/index.d.ts +151 -0
- package/src/testing/index.js +21 -0
- package/src/testing/native/wasmedge_emscripten_pthread_runner.c +25 -1
- package/src/testing/parityBrowserRunner.js +138 -0
- package/src/testing/parityHarness.js +616 -0
- package/src/testing/parityLanes.js +537 -0
- package/src/testing/processInvoke.js +29 -21
- package/src/testing/streamInvokeCodec.js +10 -175
- package/src/testing/wasmedgePin.json +6 -0
- package/src/testing/workerModuleHarness.js +242 -0
- package/src/testing/workerModuleHarnessWorker.js +176 -0
- package/src/transport/index.js +3 -0
- package/src/transport/pki.js +299 -11
- package/src/transport/records.js +16 -7
- package/src/utils/ecdsaDer.js +106 -0
- package/src/utils/wasmCrypto.js +0 -43
- package/templates/gpu-module/README.md +48 -0
- package/templates/gpu-module/include/space_data_gpu_abi.h +122 -0
- package/templates/gpu-module/manifest.json +84 -0
- package/schemas/PluginInvokeRequest.fbs +0 -18
- package/schemas/PluginInvokeResponse.fbs +0 -30
- package/schemas/spacedatastandards/PLG.fbs +0 -191
- package/src/generated/orbpro/invoke/plugin-invoke-request.d.ts +0 -51
- package/src/generated/orbpro/invoke/plugin-invoke-request.d.ts.map +0 -1
- package/src/generated/orbpro/invoke/plugin-invoke-request.js +0 -131
- package/src/generated/orbpro/invoke/plugin-invoke-request.js.map +0 -1
- package/src/generated/orbpro/invoke/plugin-invoke-request.ts +0 -173
- package/src/generated/orbpro/invoke/plugin-invoke-response.d.ts +0 -76
- package/src/generated/orbpro/invoke/plugin-invoke-response.d.ts.map +0 -1
- package/src/generated/orbpro/invoke/plugin-invoke-response.js +0 -184
- package/src/generated/orbpro/invoke/plugin-invoke-response.js.map +0 -1
- package/src/generated/orbpro/invoke/plugin-invoke-response.ts +0 -243
- package/src/generated/orbpro/invoke.d.ts +0 -3
- package/src/generated/orbpro/invoke.js +0 -5
- package/src/generated/spacedatastandards/plg/entry-function.js +0 -86
- package/src/generated/spacedatastandards/plg/entry-function.ts +0 -119
- package/src/generated/spacedatastandards/plg/index.js +0 -16
- package/src/generated/spacedatastandards/plg/index.ts +0 -11
- package/src/generated/spacedatastandards/plg/plg.js +0 -657
- package/src/generated/spacedatastandards/plg/plg.ts +0 -924
- package/src/generated/spacedatastandards/plg/plugin-capability.js +0 -66
- package/src/generated/spacedatastandards/plg/plugin-category.js +0 -15
- package/src/generated/spacedatastandards/plg/plugin-category.ts +0 -53
- package/src/generated/spacedatastandards/plg/plugin-dependency.js +0 -63
- package/src/generated/spacedatastandards/plg/plugin-dependency.ts +0 -86
- package/src/generated/spacedatastandards/plg/publication-state.js +0 -9
- package/src/generated/spacedatastandards/plg/purchase-tier.js +0 -9
- /package/src/generated/spacedatastandards/plg/{publication-state.ts → publicationState.ts} +0 -0
- /package/src/generated/spacedatastandards/plg/{purchase-tier.ts → purchaseTier.ts} +0 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# Testing Harness
|
|
2
|
+
|
|
3
|
+
> Cross-runtime acceptance is owned by the **tri-runtime parity harness**
|
|
4
|
+
> (`space-data-module parity`): one `dist/isomorphic/module.wasm`, identical
|
|
5
|
+
> behavior in browser / native WasmEdge / Docker WasmEdge, byte-diffed. See
|
|
6
|
+
> [`docs/tri-runtime-parity.md`](./tri-runtime-parity.md). "Works in X" is not
|
|
7
|
+
> module evidence.
|
|
8
|
+
|
|
9
|
+
This repo now includes two related testing/runtime surfaces in
|
|
10
|
+
`space-data-module-sdk/testing`:
|
|
11
|
+
|
|
12
|
+
- the manifest-driven harness generator for contract smoke tests
|
|
13
|
+
- the canonical dynamic runtime-host harness for multi-module process and
|
|
14
|
+
WasmEdge execution
|
|
15
|
+
|
|
16
|
+
The runtime-host harness is the new baseline for paid-module/server/browser-node
|
|
17
|
+
execution. Single-module invoke is still supported, but it now sits on top of
|
|
18
|
+
the same host-controlled process model as a compatibility profile.
|
|
19
|
+
|
|
20
|
+
## Public API
|
|
21
|
+
|
|
22
|
+
Use the generator when you want contract-level smoke coverage for an arbitrary
|
|
23
|
+
module or flow manifest:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import {
|
|
27
|
+
generateManifestHarnessPlan,
|
|
28
|
+
materializeHarnessScenario,
|
|
29
|
+
} from "space-data-module-sdk/testing";
|
|
30
|
+
|
|
31
|
+
const plan = generateManifestHarnessPlan({
|
|
32
|
+
manifest,
|
|
33
|
+
preferredWireFormat: "aligned-binary",
|
|
34
|
+
payloadForPort({ methodId, portId, typeRef }) {
|
|
35
|
+
if (methodId === "echo" && portId === "in") {
|
|
36
|
+
console.log("selected wire format:", typeRef?.wireFormat ?? "flatbuffer");
|
|
37
|
+
return "hello";
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const commandCase = materializeHarnessScenario(
|
|
44
|
+
plan.scenarios.find((scenario) => scenario.id === "command:echo"),
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For actual runtime-host execution, use `createModuleHarness(...)` or the lower
|
|
49
|
+
level process clients:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
import {
|
|
53
|
+
createModuleHarness,
|
|
54
|
+
createPluginInvokeProcessClient,
|
|
55
|
+
resolveWasmEdgePluginLaunchPlan,
|
|
56
|
+
} from "space-data-module-sdk";
|
|
57
|
+
|
|
58
|
+
const harness = await createModuleHarness({
|
|
59
|
+
runtime: {
|
|
60
|
+
kind: "process",
|
|
61
|
+
hostProfile: "runtime-host",
|
|
62
|
+
command: process.execPath,
|
|
63
|
+
args: ["--input-type=module", "--eval", runtimeHostServerScript],
|
|
64
|
+
modules: [
|
|
65
|
+
{ moduleId: "alpha", metadata: { tier: "paid" } },
|
|
66
|
+
{ moduleId: "beta", metadata: { tier: "paid" } },
|
|
67
|
+
],
|
|
68
|
+
defaultModuleId: "alpha",
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
await harness.installModule({ moduleId: "gamma", metadata: { tier: "trial" } });
|
|
73
|
+
const modules = await harness.listModules();
|
|
74
|
+
const rowHandle = await harness.appendRow({
|
|
75
|
+
schemaFileId: "OMM",
|
|
76
|
+
payload: { noradCatId: 25544 },
|
|
77
|
+
});
|
|
78
|
+
const region = await harness.allocateRegion({
|
|
79
|
+
layoutId: "propagator-state",
|
|
80
|
+
recordByteLength: 64,
|
|
81
|
+
alignment: 16,
|
|
82
|
+
initialRecords: [new Uint8Array(64)],
|
|
83
|
+
});
|
|
84
|
+
const response = await harness.invokeModule("beta", {
|
|
85
|
+
methodId: "echo",
|
|
86
|
+
inputs: [{ portId: "request", payload: new TextEncoder().encode("hello") }],
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The same host control surface is available from `createPluginInvokeProcessClient`
|
|
91
|
+
and `createWasmEdgeStreamProcessClient`:
|
|
92
|
+
|
|
93
|
+
- `installModule(definition)`
|
|
94
|
+
- `listModules()`
|
|
95
|
+
- `unloadModule(moduleId)`
|
|
96
|
+
- `invokeModule(moduleId, request)`
|
|
97
|
+
- `appendRow({ schemaFileId, payload })`
|
|
98
|
+
- `listRows(schemaFileId?)`
|
|
99
|
+
- `resolveRow({ schemaFileId, rowId })`
|
|
100
|
+
- `allocateRegion({ layoutId, recordByteLength, alignment, initialRecords })`
|
|
101
|
+
- `describeRegion(regionId)`
|
|
102
|
+
- `resolveRecord({ regionId, recordIndex })`
|
|
103
|
+
|
|
104
|
+
In-process `createRuntimeHost()` also exposes `registerExternalRegion(...)`,
|
|
105
|
+
`setRegionRecordCount(...)`, and `resolveRecordView(...)` for hosts that already
|
|
106
|
+
own resident buffers and need transient region descriptors without turning raw
|
|
107
|
+
addresses into durable harness identity. Those helpers are not part of the
|
|
108
|
+
current process/WasmEdge control protocol, which remains copy-based.
|
|
109
|
+
|
|
110
|
+
For outer transport ingest, the runtime-host surface also exposes
|
|
111
|
+
`createFlatBufferStreamIngestor(...)`. That helper is intentionally outside the
|
|
112
|
+
module invoke ABI. It accepts little-endian size-prefixed FlatBuffer stream
|
|
113
|
+
chunks and appends durable rows through `createFlatSqlRuntimeStore()`.
|
|
114
|
+
|
|
115
|
+
Identity rules remain:
|
|
116
|
+
|
|
117
|
+
- standards rows are addressed by `($SCHEMA_FILE_ID, rowId)`
|
|
118
|
+
- aligned runtime records are addressed by `(regionId, recordIndex)`
|
|
119
|
+
- raw pointers remain internal execution details, not durable harness identity
|
|
120
|
+
|
|
121
|
+
The generator does two things:
|
|
122
|
+
|
|
123
|
+
1. It derives smoke cases from the manifest shape and invoke surfaces.
|
|
124
|
+
2. It classifies declared capabilities by runtime surface:
|
|
125
|
+
- WASI-native
|
|
126
|
+
- sync hostcall
|
|
127
|
+
- async host API
|
|
128
|
+
|
|
129
|
+
When a port advertises multiple payload wire formats, pass
|
|
130
|
+
`preferredWireFormat` to select which declared type ref the generated smoke
|
|
131
|
+
cases should use. This is useful for contracts that accept regular FlatBuffer
|
|
132
|
+
inputs but also expose aligned-binary ports or dual-format test fixtures.
|
|
133
|
+
Aligned-binary entries are expected to ship with a regular FlatBuffer fallback
|
|
134
|
+
for the same schema in the same accepted type set, and the harness will choose
|
|
135
|
+
between those declared type refs rather than inventing one.
|
|
136
|
+
|
|
137
|
+
## Flows
|
|
138
|
+
|
|
139
|
+
Flows are treated as degenerate modules for harness generation. The generator
|
|
140
|
+
does not require a separate flow-only code path. A flow manifest still produces
|
|
141
|
+
method-level invoke cases and capability classifications.
|
|
142
|
+
|
|
143
|
+
For runtime execution, flows should target the same dynamic runtime-host model.
|
|
144
|
+
Host runtime packages may still compile or bundle flows for deployment, but the harness
|
|
145
|
+
contract in this repo is now the canonical host surface for:
|
|
146
|
+
|
|
147
|
+
- installing multiple modules into one host
|
|
148
|
+
- wiring host-owned row and region services
|
|
149
|
+
- exercising the same control plane in process mode and WasmEdge mode
|
|
150
|
+
|
|
151
|
+
## Runtime Matrix
|
|
152
|
+
|
|
153
|
+
The runtime matrix lives in `test/runtime-matrix.test.js` and is intentionally a
|
|
154
|
+
separate integration script:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm run test:runtime-matrix
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Languages covered
|
|
161
|
+
|
|
162
|
+
- Node.js: native WASI runner
|
|
163
|
+
- Go: native WASI runner via `wazero`
|
|
164
|
+
- Python: native WASI runner via `wasmtime`
|
|
165
|
+
- C#: fallback wrapper around the canonical Node runner
|
|
166
|
+
- Java: fallback wrapper around the canonical Node runner
|
|
167
|
+
- Rust: fallback wrapper around the canonical Node runner
|
|
168
|
+
- Swift: fallback wrapper around the canonical Node runner
|
|
169
|
+
|
|
170
|
+
### Why some languages are wrappers today
|
|
171
|
+
|
|
172
|
+
`../flatbuffers/wasm` documents a wider language/runtime ecosystem than this SDK
|
|
173
|
+
currently maintains natively. The SDK matrix therefore uses:
|
|
174
|
+
|
|
175
|
+
- native WASI execution where the runtime path is clean and stable in this repo
|
|
176
|
+
- a shared Node-based fallback where the language/runtime bridge is still in
|
|
177
|
+
flux or would otherwise make the test suite fragile
|
|
178
|
+
|
|
179
|
+
That keeps every supported language in the matrix immediately while preserving a
|
|
180
|
+
single canonical execution baseline.
|
|
181
|
+
|
|
182
|
+
## Dynamic Runtime-Host Harness
|
|
183
|
+
|
|
184
|
+
The SDK now treats dynamic host composition as the default server/browser/WasmEdge
|
|
185
|
+
execution model. The harness supports two execution profiles:
|
|
186
|
+
|
|
187
|
+
1. Compatibility profile:
|
|
188
|
+
- single module
|
|
189
|
+
- plain `invoke(...)`
|
|
190
|
+
- same shape as the earlier process harness
|
|
191
|
+
|
|
192
|
+
2. Runtime-host profile:
|
|
193
|
+
- multiple installed modules in one host
|
|
194
|
+
- explicit module install/list/unload/invoke controls
|
|
195
|
+
- host-owned row services and aligned-binary region services
|
|
196
|
+
|
|
197
|
+
Process mode can emulate the runtime host with a normal Node child process. For
|
|
198
|
+
WasmEdge, the runner can start in standalone host mode with:
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
const plan = resolveWasmEdgePluginLaunchPlan({
|
|
202
|
+
hostProfile: "runtime-host",
|
|
203
|
+
wasmEdgeRunnerBinary: process.env.WASMEDGE_RUNNER_BINARY,
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
That launches the runner with `--serve-runtime-host` and no preloaded guest
|
|
208
|
+
module. Modules are then installed over the host control channel.
|
|
209
|
+
|
|
210
|
+
## Covered Surfaces
|
|
211
|
+
|
|
212
|
+
The matrix and the existing Node host tests together cover:
|
|
213
|
+
|
|
214
|
+
- method calling through command-mode invoke envelopes
|
|
215
|
+
- aligned-binary metadata preservation on command-mode echoes
|
|
216
|
+
- stdin/stdout/stderr capture for WASI guests
|
|
217
|
+
- args and environment wiring
|
|
218
|
+
- filesystem path smoke through WASI/preopen setup
|
|
219
|
+
- WASI clock/time smoke
|
|
220
|
+
- sync `space_data_module_host` byte-envelope coverage for `random.bytes`
|
|
221
|
+
- host capability surface classification
|
|
222
|
+
- the Node host API suite for HTTP, TCP, UDP, TLS, WebSocket, MQTT, exec,
|
|
223
|
+
context, crypto, timers, and filesystem semantics
|
|
224
|
+
|
|
225
|
+
Run the host-only suite directly with:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm run test:host-surfaces
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Run the streamed FlatBuffer ingest checks with:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
npm run test:stream-ingest
|
|
235
|
+
npm run test:module-stream
|
|
236
|
+
npm run benchmark:stream-1gib
|
|
237
|
+
npm run benchmark:module-stream-1gib
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
The 1 GiB path is env-gated and intended for local stress/perf work. It
|
|
241
|
+
measures either outer transport ingest or chunked resident-module ingest, not
|
|
242
|
+
one giant SDS `$PIV` invoke request.
|
|
243
|
+
|
|
244
|
+
## Important Edge Cases
|
|
245
|
+
|
|
246
|
+
### 1. Generated harnesses are contract smoke tests, not semantic proofs
|
|
247
|
+
|
|
248
|
+
The manifest can tell the harness how to invoke a method, but not what the
|
|
249
|
+
method should do. Generated cases therefore verify ABI compatibility and surface
|
|
250
|
+
shape. Any module-specific semantics still need scenario fixtures or custom
|
|
251
|
+
validators.
|
|
252
|
+
|
|
253
|
+
### 2. Command mode owns stdout
|
|
254
|
+
|
|
255
|
+
For command-surface plugin tests, stdout is the invoke response channel. A guest
|
|
256
|
+
method that writes arbitrary bytes to stdout can corrupt the response envelope.
|
|
257
|
+
Use stderr for diagnostics in command-mode methods.
|
|
258
|
+
|
|
259
|
+
### 3. Direct invoke is not the cross-language baseline today
|
|
260
|
+
|
|
261
|
+
The matrix uses command-mode invoke for broad portability. Direct invoke still
|
|
262
|
+
exists and is covered in the Node-based SDK tests, but it requires runtime-
|
|
263
|
+
specific memory management and export calling that is not yet normalized across
|
|
264
|
+
every language adapter.
|
|
265
|
+
|
|
266
|
+
For dynamic runtime-host tests, use the host-control APIs instead of assuming a
|
|
267
|
+
single command-surface guest is the whole runtime.
|
|
268
|
+
|
|
269
|
+
Direct invoke is also not the right path for multi-hundred-megabyte or 1 GiB
|
|
270
|
+
single-request benchmarks. The invoke ABI is still batch-oriented and fully
|
|
271
|
+
buffered.
|
|
272
|
+
|
|
273
|
+
If a module needs resident internal state, such as a FlatSQL instance imported
|
|
274
|
+
inside the SDN module itself, prefer `createModuleFlatBufferStreamPump(...)`
|
|
275
|
+
with a persistent direct-surface harness. That keeps the stream chunked and
|
|
276
|
+
binary while preserving guest state across many small invokes.
|
|
277
|
+
|
|
278
|
+
### 4. WASI filesystem behavior is still only smoke-tested cross-runtime
|
|
279
|
+
|
|
280
|
+
Preopen path handling is not perfectly consistent across all runtimes used by
|
|
281
|
+
the matrix. The integration suite therefore asserts that filesystem wiring does
|
|
282
|
+
not crash and that path-based probes run, but the authoritative filesystem
|
|
283
|
+
semantics remain in the Node host tests.
|
|
284
|
+
|
|
285
|
+
### 5. Pipes are partially portable, not universally portable
|
|
286
|
+
|
|
287
|
+
The outer harness processes use normal OS pipes for subprocess communication.
|
|
288
|
+
Inside the guest, many runtimes are more reliable with file-backed stdin/stdout/
|
|
289
|
+
stderr descriptors than with arbitrary pipe wiring. The matrix currently uses
|
|
290
|
+
file-backed guest stdio for portability. That covers the portable stdio-style
|
|
291
|
+
pipe contract, but not arbitrary named-pipe services.
|
|
292
|
+
|
|
293
|
+
### 6. Network and most Node-RED-style host services are not WASI-native
|
|
294
|
+
|
|
295
|
+
Pure WASI does not provide a portable HTTP/TCP/UDP/WebSocket/MQTT/process-exec
|
|
296
|
+
surface here. Those capabilities exist today on the async host API side, and
|
|
297
|
+
the repo tests them through the Node host, browser host, and browser module
|
|
298
|
+
harness suites. Treat the runtime matrix as the portable guest suite and
|
|
299
|
+
`npm run test:host-surfaces` as the authoritative host-adapter suite for the
|
|
300
|
+
default Node-RED-style services.
|
|
301
|
+
|
|
302
|
+
### 7. Random entropy is not a stable libc-level cross-runtime assertion here
|
|
303
|
+
|
|
304
|
+
The capability matrix still marks `random` as WASI-native in principle, but the
|
|
305
|
+
libc entry points used by standalone C guests are not consistently portable
|
|
306
|
+
across every runtime in this matrix. The suite therefore classifies `random`
|
|
307
|
+
correctly but does not hard-fail the matrix on a specific libc randomness call.
|
|
308
|
+
|
|
309
|
+
### 8. The sync guest hostcall ABI is intentionally narrow
|
|
310
|
+
|
|
311
|
+
The current `space_data_module_host` sync ABI is JSON-over-memory and only supports
|
|
312
|
+
synchronous operations cleanly. That makes these capabilities practical for
|
|
313
|
+
WASM guests today:
|
|
314
|
+
|
|
315
|
+
- `clock`
|
|
316
|
+
- `schedule_cron`
|
|
317
|
+
- `filesystem.resolvePath`
|
|
318
|
+
|
|
319
|
+
These remain async host API capabilities today from a guest execution
|
|
320
|
+
perspective:
|
|
321
|
+
|
|
322
|
+
- `network`
|
|
323
|
+
- `http`
|
|
324
|
+
- `tcp`
|
|
325
|
+
- `udp`
|
|
326
|
+
- `tls`
|
|
327
|
+
- `websocket`
|
|
328
|
+
- `mqtt`
|
|
329
|
+
- `timers`
|
|
330
|
+
- `process_exec`
|
|
331
|
+
- `context_read`
|
|
332
|
+
- `context_write`
|
|
333
|
+
- `crypto_hash`
|
|
334
|
+
- `crypto_sign`
|
|
335
|
+
- `crypto_verify`
|
|
336
|
+
- `crypto_encrypt`
|
|
337
|
+
- `crypto_decrypt`
|
|
338
|
+
- `crypto_key_agreement`
|
|
339
|
+
- `crypto_kdf`
|
|
340
|
+
- `ipfs`
|
|
341
|
+
- `protocol_handle`
|
|
342
|
+
- `protocol_dial`
|
|
343
|
+
|
|
344
|
+
Portable-but-narrow today:
|
|
345
|
+
|
|
346
|
+
- `logging` via stdout/stderr
|
|
347
|
+
- `pipe` via stdio descriptors only
|
|
348
|
+
|
|
349
|
+
The harness generator exposes this distinction explicitly so module authors can
|
|
350
|
+
see which capabilities are portable in the raw guest ABI today and which
|
|
351
|
+
require the async host adapter path.
|
|
352
|
+
|
|
353
|
+
That async host adapter path is now a single generic capability boundary:
|
|
354
|
+
|
|
355
|
+
- `NodeHost.invoke(...)`
|
|
356
|
+
- `BrowserHost.invoke(...)`
|
|
357
|
+
- `createRuntimeHost().invoke(...)`
|
|
358
|
+
- `loadModule(...).callHost(...)`
|
|
359
|
+
- `createBrowserModuleHarness(...).callHost(...)`
|
|
360
|
+
|
|
361
|
+
Those entry points all dispatch the same awaited capability ids and operation
|
|
362
|
+
names. If you override reference behavior, do it with explicit
|
|
363
|
+
`capabilityAdapters` keyed by canonical capability id rather than inventing a
|
|
364
|
+
repo-local host API variant.
|
|
365
|
+
|
|
366
|
+
This JSON-over-memory note applies only to the current sync `space_data_module_host` guest
|
|
367
|
+
ABI. It is not the canonical FlatBuffer stream-ingest contract, which uses
|
|
368
|
+
direct size-prefixed FlatBuffer frames and keeps payload bytes binary end-to-end.
|
|
369
|
+
|
|
370
|
+
## Strict Standalone WASI Target
|
|
371
|
+
|
|
372
|
+
When a manifest declares `runtimeTargets: ["wasi"]`, the SDK should interpret
|
|
373
|
+
that as a stricter statement than "can run inside some wrapper-managed WASM
|
|
374
|
+
host." It means the artifact is expected to run as a standalone WASI program.
|
|
375
|
+
|
|
376
|
+
The current SDK enforcement for that target is:
|
|
377
|
+
|
|
378
|
+
- `invokeSurfaces` must include `command`
|
|
379
|
+
- capabilities must stay within the current standalone-WASI subset:
|
|
380
|
+
- `logging`
|
|
381
|
+
- `clock`
|
|
382
|
+
- `random`
|
|
383
|
+
- `filesystem`
|
|
384
|
+
- `pipe`
|
|
385
|
+
- hosted protocols may only use `wasi-pipe`
|
|
386
|
+
|
|
387
|
+
Anything else still requires a host adapter, delegated service, or a future raw
|
|
388
|
+
guest async ABI expansion and therefore should not claim the canonical `wasi`
|
|
389
|
+
runtime target yet.
|
|
390
|
+
|
|
391
|
+
## WasmEdge Deployment Target
|
|
392
|
+
|
|
393
|
+
Use `runtimeTargets: ["wasmedge"]` for the standard server-side deployment
|
|
394
|
+
target when the goal is maximum WASI compatibility rather than strict
|
|
395
|
+
standalone-WASI purity.
|
|
396
|
+
|
|
397
|
+
That target assumes a WasmEdge environment with socket/TLS extensions
|
|
398
|
+
available. In this repo’s capability matrix, these families become reasonable
|
|
399
|
+
guest-side targets even though they are not plain standalone WASI:
|
|
400
|
+
|
|
401
|
+
- `network`
|
|
402
|
+
- `http`
|
|
403
|
+
- `tcp`
|
|
404
|
+
- `udp`
|
|
405
|
+
- `tls`
|
|
406
|
+
|
|
407
|
+
The full Node-RED parity map lives in
|
|
408
|
+
[`docs/node-red-default-node-parity.md`](./node-red-default-node-parity.md).
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Tri-Runtime Parity Harness
|
|
2
|
+
|
|
3
|
+
ONE `dist/isomorphic/module.wasm`, THREE runtimes, IDENTICAL behavior:
|
|
4
|
+
|
|
5
|
+
1. **browser** — real headless Chrome behind COOP/COEP (cross-origin isolated,
|
|
6
|
+
SAB-capable), running the SDK browser WASI shim. Never jsdom — jsdom masks
|
|
7
|
+
Illegal-invocation and threading realities.
|
|
8
|
+
2. **wasmedge** — a native WasmEdge binary, version-locked to the pin.
|
|
9
|
+
3. **docker-wasmedge** — a pinned Docker WasmEdge container.
|
|
10
|
+
|
|
11
|
+
Cross-runtime divergence is a **P1 SDK defect**, never a "platform quirk".
|
|
12
|
+
"Works in X" is inadmissible as module evidence; module-touching work needs a
|
|
13
|
+
parity receipt from this harness.
|
|
14
|
+
|
|
15
|
+
## Running
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
space-data-module parity \
|
|
19
|
+
--wasm ./dist/isomorphic/module.wasm \
|
|
20
|
+
--fixture ./fixtures/parity/sgp4-command.json \
|
|
21
|
+
[--lanes browser,wasmedge,docker-wasmedge] [--json] [--timeout-sec N] \
|
|
22
|
+
[--wasmedge-binary <bin>] [--chrome-binary <bin>] [--docker-platform <p>]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- Exit `0` only when every lane × thread-count run is byte-identical and every
|
|
26
|
+
error/trap class matches. Any divergence, missing lane run, pin drift, or
|
|
27
|
+
lane that cannot execute exits non-zero with a per-case report (SHA-256
|
|
28
|
+
digests, lengths, first divergent byte offset + hex windows).
|
|
29
|
+
- All three lanes run by default. `--lanes` narrows explicitly — lanes are
|
|
30
|
+
never skipped silently, and fewer than two lanes is rejected
|
|
31
|
+
(`--allow-single-lane` exists for lane bring-up debugging only; it can never
|
|
32
|
+
produce parity evidence).
|
|
33
|
+
- `--self-test-divergence <lane>` is a fire drill: it XORs one output byte of
|
|
34
|
+
that lane after execution to prove the diff path fails loudly end-to-end.
|
|
35
|
+
|
|
36
|
+
Programmatic API (Node): `runParityHarness`, `diffParityRuns`,
|
|
37
|
+
`normalizeParityFixture`, `loadWasmEdgePin` from `space-data-module-sdk/testing`.
|
|
38
|
+
|
|
39
|
+
CI wiring in this repo:
|
|
40
|
+
|
|
41
|
+
- `npm run test:parity` — always-on unit suite (pin single-sourcing, fixture
|
|
42
|
+
normalization, diff loudness incl. injected divergence).
|
|
43
|
+
- `npm run test:parity-tri-lane` — the real three lanes against the sgp4
|
|
44
|
+
module (needs Chrome, native WasmEdge at the pin, Docker).
|
|
45
|
+
|
|
46
|
+
## The WasmEdge pin: ONE place
|
|
47
|
+
|
|
48
|
+
`src/testing/wasmedgePin.json` is the single source of truth:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{ "wasmedgeVersion": "0.16.4", "dockerImageRepository": "space-data-module-sdk/parity-wasmedge" }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- The native lane runs `wasmedge --version` and hard-fails on mismatch
|
|
55
|
+
(`PARITY PIN-DRIFT`).
|
|
56
|
+
- The docker lane derives its image tag from the same version
|
|
57
|
+
(`space-data-module-sdk/parity-wasmedge:0.16.4`), builds it on demand from
|
|
58
|
+
`src/testing/docker/wasmedge-parity.Dockerfile` (version injected via
|
|
59
|
+
`--build-arg` from the pin — the Dockerfile itself pins nothing), and
|
|
60
|
+
version-checks the container runtime before running cases.
|
|
61
|
+
|
|
62
|
+
Host and container WasmEdge versions therefore pin and bump TOGETHER by
|
|
63
|
+
editing one string. Keep the pin aligned with the node host's embedded
|
|
64
|
+
runtime (space-data-network `scripts/install-wasmedge.sh`, currently 0.16.4 —
|
|
65
|
+
the verified runtime for the libwasmedge atomic-wait fixes).
|
|
66
|
+
|
|
67
|
+
## Determinism contract
|
|
68
|
+
|
|
69
|
+
Every lane receives EXACTLY the same guest-observable inputs:
|
|
70
|
+
|
|
71
|
+
- stdin bytes are encoded once by the orchestrator (`encodePluginInvokeRequest`
|
|
72
|
+
for `request` cases, raw bytes otherwise) and shipped verbatim to each lane;
|
|
73
|
+
- guest env is delivered explicitly (`wasmedge --env`, browser shim `env`) —
|
|
74
|
+
the ambient host environment never leaks into the guest;
|
|
75
|
+
- guest argv[0] is always `module.wasm` (relative invocation from a private
|
|
76
|
+
staging dir in the wasmedge lanes, literal argv in the browser shim);
|
|
77
|
+
- thread counts are swept via the fixture's `threadEnvVar`
|
|
78
|
+
(default `SDM_PARITY_THREADS`) — runs at 1/2/4/8 (fixture-configurable) must
|
|
79
|
+
be byte-identical within a lane AND across lanes. Browser sequential
|
|
80
|
+
*throughput* divergence is sanctioned until `browser-worker-topology` lands;
|
|
81
|
+
results must still match byte-for-byte;
|
|
82
|
+
- signed/published artifacts are stripped to the canonical module payload once
|
|
83
|
+
(`toLoadableWasmBytes`) so every lane executes identical wasm bytes.
|
|
84
|
+
|
|
85
|
+
## Fixtures
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"name": "sgp4-command-parity",
|
|
90
|
+
"threadEnvVar": "SDM_PARITY_THREADS",
|
|
91
|
+
"threadCounts": [1, 2, 4, 8],
|
|
92
|
+
"cases": [
|
|
93
|
+
{
|
|
94
|
+
"id": "ingest-omm",
|
|
95
|
+
"expect": "ok",
|
|
96
|
+
"request": {
|
|
97
|
+
"methodId": "ingest_omm",
|
|
98
|
+
"inputs": [{ "portId": "omm", "payloadFile": "omm-25544.fb",
|
|
99
|
+
"typeRef": { "schemaName": "orbpro.sds.omm", "fileIdentifier": "$OMM" } }]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{ "id": "malformed-stdin", "stdinUtf8": "not a PIV frame" }
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- `request` cases go through the canonical PIV invoke codec; raw cases take
|
|
108
|
+
`stdinFile` / `stdinBase64` / `stdinHex` / `stdinUtf8`.
|
|
109
|
+
- `expect` (`"ok" | "guest-error" | "trap"`) is optional; without it the case
|
|
110
|
+
only requires the class to be IDENTICAL across lanes (malformed-input
|
|
111
|
+
fixtures compare error/trap classes this way).
|
|
112
|
+
- Payloads: `payloadFile` (relative to the fixture), `payloadBase64`,
|
|
113
|
+
`payloadHex`, `payloadUtf8`.
|
|
114
|
+
- Committed payload binaries are regenerated deterministically by
|
|
115
|
+
`node fixtures/parity/generate-fixtures.mjs`.
|
|
116
|
+
|
|
117
|
+
## Scope and current limits (v1)
|
|
118
|
+
|
|
119
|
+
- The execution profile is the **command surface** (stdin → stdout WASI run),
|
|
120
|
+
the one surface all three runtimes share without a host adapter. Output
|
|
121
|
+
parity = stdout bytes + exit/trap class per run.
|
|
122
|
+
- Persisted-state manifests (`stateFiles`) are diffed whenever a lane reports
|
|
123
|
+
them; the wasmedge lanes will populate them when fixture-declared preopens
|
|
124
|
+
land. The browser shim currently has no filesystem authority
|
|
125
|
+
(`fd_prestat_get` → BADF), so state-writing fixtures cannot claim tri-lane
|
|
126
|
+
parity yet.
|
|
127
|
+
- Threaded (wasi-threads) modules run in the wasmedge lanes today; the browser
|
|
128
|
+
lane's worker topology for nested-worker SAB sharing is the known open fork
|
|
129
|
+
(`browser-worker-topology`). Timer restart/misfire and cursor/persist/reload
|
|
130
|
+
parity ride on the same fixture schema (future case kinds) — the diff engine
|
|
131
|
+
already treats every run as (class, bytes, state) so new kinds plug in
|
|
132
|
+
without new comparison rules.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="referrer" content="no-referrer"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src https://static.spacedatanetwork.org; style-src 'none'; connect-src 'none'; img-src 'none'; font-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'"><title>Completing wallet connection</title></head><body><p>Completing wallet connection</p><script src="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-callback.0f2dee485c8f0d7afe5f70b4b42093a382c92d32af551bd71b41733336091c7a.js" integrity="sha384-UZG2zFMk46nuXFtMDyh5Rgfsai9CJXgmqvWILzXVbKJfdbSvg+7GRavCRgLXL5xy" crossorigin="anonymous" data-callback-identity="sdn.wallet.callback.v1"></script></body></html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "space-data-module-sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Module SDK for building, validating, signing, and deploying WebAssembly modules on the Space Data Network.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"./compiler": "./src/compiler/index.js",
|
|
33
33
|
"./compiler/emception": "./src/compiler/emception.js",
|
|
34
34
|
"./bundle": "./src/bundle/index.js",
|
|
35
|
+
"./app": "./src/app/index.js",
|
|
35
36
|
"./deployment": "./src/deployment/index.js",
|
|
36
37
|
"./invoke": "./src/invoke/index.js",
|
|
37
38
|
"./runtime": "./src/runtime/index.js",
|
|
@@ -40,29 +41,46 @@
|
|
|
40
41
|
"default": "./src/runtime-host/index.js"
|
|
41
42
|
},
|
|
42
43
|
"./host/browser": "./src/host/browserHost.js",
|
|
44
|
+
"./host/timer-driver": "./src/host/timerDriver.js",
|
|
45
|
+
"./flow": {
|
|
46
|
+
"types": "./src/flow/index.d.ts",
|
|
47
|
+
"default": "./src/flow/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./flow/compiler": "./src/flow/flowCompiler.js",
|
|
50
|
+
"./http": "./src/http/index.js",
|
|
43
51
|
"./host/browser-edge-shims": "./src/host/browserEdgeShims.js",
|
|
44
52
|
"./host/wasi-shim": "./src/host/wasiShim.js",
|
|
45
53
|
"./host/isomorphic": "./src/host/isomorphicLoader.js",
|
|
46
54
|
"./testing/browser": "./src/testing/browserModuleHarness.js",
|
|
55
|
+
"./testing/module-flatbuffer-stream-pump": {
|
|
56
|
+
"types": "./src/index.d.ts",
|
|
57
|
+
"default": "./src/testing/moduleFlatbufferStreamPump.js"
|
|
58
|
+
},
|
|
47
59
|
"./testing": "./src/testing/index.js",
|
|
48
60
|
"./standards": "./src/standards/index.js",
|
|
49
61
|
"./utils/wasm-crypto": "./src/utils/wasmCrypto.js",
|
|
50
|
-
"./schemas/*": "./schemas/*"
|
|
62
|
+
"./schemas/*": "./schemas/*",
|
|
63
|
+
"./compat": "./src/compat/index.js"
|
|
51
64
|
},
|
|
52
65
|
"files": [
|
|
53
66
|
"bin/",
|
|
67
|
+
"docs/",
|
|
54
68
|
"schemas/",
|
|
55
|
-
"src/"
|
|
69
|
+
"src/",
|
|
70
|
+
"templates/"
|
|
56
71
|
],
|
|
57
72
|
"scripts": {
|
|
58
|
-
"test": "node --test",
|
|
73
|
+
"test": "for test_file in test/*.test.js; do node --test \"$test_file\" || exit 1; done",
|
|
59
74
|
"test:host-surfaces": "node --test test/node-host.test.js test/host-abi.test.js test/browser-host.test.js test/browser-module-harness.test.js test/testing-harness.test.js",
|
|
60
75
|
"test:runtime-matrix": "SPACE_DATA_MODULE_SDK_ENABLE_RUNTIME_MATRIX=1 node --test test/runtime-matrix.test.js",
|
|
76
|
+
"test:parity": "node --test test/parity-harness.test.js",
|
|
77
|
+
"test:parity-tri-lane": "SPACE_DATA_MODULE_SDK_ENABLE_TRI_RUNTIME_PARITY=1 node --test test/parity-tri-lane.test.js",
|
|
61
78
|
"test:stream-ingest": "node --test test/runtime-host-stream-ingest.test.js",
|
|
62
79
|
"test:module-stream": "node --test test/module-flatbuffer-stream-pump.test.js",
|
|
63
80
|
"benchmark:stream-1gib": "SPACE_DATA_MODULE_SDK_ENABLE_1GB_STREAM_TEST=1 node --test test/runtime-host-stream-ingest.test.js",
|
|
64
81
|
"benchmark:module-stream-1gib": "SPACE_DATA_MODULE_SDK_ENABLE_1GB_MODULE_STREAM_TEST=1 node --test test/module-flatbuffer-stream-pump.test.js",
|
|
65
82
|
"start:lab": "node ./lab/server.js",
|
|
83
|
+
"check:nav": "node scripts/check-sdn-stack-nav.mjs module-sdk docs/index.html docs/styles.css",
|
|
66
84
|
"check:compliance": "node ./bin/space-data-module.js check --repo-root .",
|
|
67
85
|
"generate:vectors": "node ./examples/single-file-bundle/generate-vectors.mjs",
|
|
68
86
|
"prepublishOnly": "npm test && npm run check:compliance"
|
|
@@ -71,11 +89,12 @@
|
|
|
71
89
|
"flatbuffers": "^25.9.23",
|
|
72
90
|
"flatc-wasm": "^26.1.32",
|
|
73
91
|
"flatsql": "^0.4.2",
|
|
74
|
-
"hd-wallet-wasm": "
|
|
92
|
+
"hd-wallet-wasm": "2.0.28",
|
|
75
93
|
"sdn-emception": "1.0.0",
|
|
76
|
-
"spacedatastandards.org": "
|
|
94
|
+
"spacedatastandards.org": "https://github.com/DigitalArsenal/spacedatastandards.org/archive/84f7d65ae07321d5314dedb0f5dce11a6e0919cd.tar.gz"
|
|
77
95
|
},
|
|
78
96
|
"devDependencies": {
|
|
97
|
+
"esbuild": "^0.28.0",
|
|
79
98
|
"express": "^4.21.2"
|
|
80
99
|
},
|
|
81
100
|
"engines": {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Canonical HTTP request envelope for WASM-served HTTP (host-owned ABI).
|
|
2
|
+
//
|
|
3
|
+
// TRUE isomorphism contract: ALL HTTP semantics (routing, query parsing,
|
|
4
|
+
// content negotiation, caching decisions) live inside the wasm module. The
|
|
5
|
+
// host — Go daemon or browser harness — is a dumb pipe that delivers exactly
|
|
6
|
+
// one HttpRequest frame to the module's HTTP method and streams back the
|
|
7
|
+
// HttpResponse frame (schemas/HttpResponseAbi.fbs) verbatim.
|
|
8
|
+
//
|
|
9
|
+
// Two-root convention: FlatBuffers allows one root_type/file_identifier per
|
|
10
|
+
// schema file, so the request and response roots live in sibling files
|
|
11
|
+
// (mirroring schemas/orbpro/CatalogQueryRequest.fbs + CatalogQueryResult.fbs).
|
|
12
|
+
// The shared HttpHeader table is declared here and included by the response
|
|
13
|
+
// schema.
|
|
14
|
+
|
|
15
|
+
namespace sdn.http;
|
|
16
|
+
|
|
17
|
+
table HttpHeader {
|
|
18
|
+
/// Lower-cased header name. NAME is a FlatBuffers key so header vectors
|
|
19
|
+
/// are sorted and binary-searchable; encoders must sort by NAME.
|
|
20
|
+
NAME:string (key);
|
|
21
|
+
VALUE:string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
table HttpRequest {
|
|
25
|
+
/// HTTP method verb, upper-case (GET, POST, ...).
|
|
26
|
+
METHOD:string;
|
|
27
|
+
/// URL path only (no query string), e.g. "/api/v1/omm/bulk".
|
|
28
|
+
PATH:string;
|
|
29
|
+
/// Raw query string without the leading "?", still URL-encoded. The module
|
|
30
|
+
/// owns all parsing.
|
|
31
|
+
QUERY:string;
|
|
32
|
+
/// Request headers, sorted by NAME.
|
|
33
|
+
HEADERS:[HttpHeader];
|
|
34
|
+
/// Raw request body bytes (may be absent).
|
|
35
|
+
BODY:[ubyte];
|
|
36
|
+
/// Remote address ("ip:port") as observed by the host pipe.
|
|
37
|
+
REMOTE:string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
root_type HttpRequest;
|
|
41
|
+
file_identifier "$HTQ";
|