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
package/README.md
CHANGED
|
@@ -32,8 +32,8 @@ This repo owns the generic module-side runtime harnesses used across the stack:
|
|
|
32
32
|
- `buildWasmEdgeEmscriptenPthreadRunner(...)` plus the shared native runner
|
|
33
33
|
source and runner-level pthread smoke test
|
|
34
34
|
|
|
35
|
-
Flow-specific standalone harnessing lives in
|
|
36
|
-
enqueue/drain behavior on top of
|
|
35
|
+
Flow-specific standalone harnessing now lives in host runtime packages that
|
|
36
|
+
layer flow enqueue/drain behavior on top of the SDK runtime host. Package-
|
|
37
37
|
specific validation suites, including conjunction replay/V&V, are expected to
|
|
38
38
|
sit on top of these shared harnesses instead of defining their own runtime
|
|
39
39
|
process model.
|
|
@@ -107,16 +107,43 @@ Modules can now declare one or both canonical invoke surfaces in
|
|
|
107
107
|
- `direct`: in-memory invocation through `plugin_invoke_stream`
|
|
108
108
|
- `command`: WASI command-mode invocation through `_start`
|
|
109
109
|
|
|
110
|
-
Both surfaces consume and produce the
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
request
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
Both surfaces consume and produce the SDS `PIV` FlatBuffer envelope
|
|
111
|
+
(`file_identifier "$PIV"`). `PIV.REQUEST` and `PIV.RESPONSE` route SDS payload
|
|
112
|
+
frames by `TAB.PORT_ID` using a shared `PAYLOAD_ARENA`. `TAB.WIRE_FORMAT`
|
|
113
|
+
declares whether each frame body is a regular FlatBuffer or an aligned-binary
|
|
114
|
+
payload. Command mode reads one `PIV` request from `stdin` and writes one `PIV`
|
|
115
|
+
response to `stdout`. Direct mode takes the same request bytes from guest
|
|
116
|
+
memory and returns response bytes in guest memory. Direct-mode hosts must pass
|
|
117
|
+
request and response-length pointers allocated by the module's `plugin_alloc`;
|
|
118
|
+
the generated bridge validates those guest-memory ranges and returns a
|
|
119
|
+
canonical `invalid-request-pointer` response, or `0` for an invalid
|
|
120
|
+
response-length pointer, instead of dereferencing arbitrary addresses. When a
|
|
121
|
+
PIV request has an empty `PAYLOAD_ARENA`, the generated direct bridge treats
|
|
122
|
+
`TAB.OFFSET` as an absolute guest-memory pointer only if that range was
|
|
123
|
+
allocated by `plugin_alloc`; otherwise it fails closed with
|
|
124
|
+
`invalid-request-pointer`. Public JS decoders can materialize the same
|
|
125
|
+
empty-arena TAB offsets by passing `{ externalArena }` to
|
|
126
|
+
`decodePluginInvokeRequest` or `decodePluginInvokeResponse`.
|
|
127
|
+
Public JS encoders can also emit empty-arena PIV descriptors by passing
|
|
128
|
+
`externalArena` to `encodePluginInvokeRequest` or
|
|
129
|
+
`encodePluginInvokeResponse` and supplying frame `offset`/`size` values into
|
|
130
|
+
that arena. Browser direct-mode harness invocation requires `externalArena` to
|
|
131
|
+
be a full view of the module's active SharedArrayBuffer-backed memory and
|
|
132
|
+
passes frame `offset`/`size` descriptors through without copying the selected
|
|
133
|
+
frame bytes into a separate allocation. The browser direct harness also authors
|
|
134
|
+
the PIV request envelope itself into `plugin_alloc`-owned module memory before calling
|
|
135
|
+
`plugin_invoke_stream`; it does not route external-arena direct calls through a
|
|
136
|
+
JS-owned `invokeRaw` request-byte frame. Command-mode invocation rejects
|
|
137
|
+
`externalArena` because stdin has no guest-memory address space.
|
|
138
|
+
|
|
139
|
+
SDS `TAB` is the canonical transport descriptor. It preserves port id, payload
|
|
140
|
+
offset/size, alignment, wire format, type identity, ownership, mutability, and
|
|
141
|
+
frame id. Older SDK-local invoke descriptors and fields are not part of the
|
|
142
|
+
wire ABI. For stream-pump compatibility, the SDK uses `TAB.FRAME_ID` as packed
|
|
143
|
+
stream bookkeeping: `(sequence << 1) | endOfStream`.
|
|
144
|
+
Source-built modules can set this on an emitted output frame with
|
|
145
|
+
`plugin_set_output_stream_frame(outputIndex, sequence, endOfStream)` or set the
|
|
146
|
+
raw frame id with `plugin_set_output_frame_id(outputIndex, frameId)`.
|
|
120
147
|
|
|
121
148
|
For simple single-input / single-output methods, command mode also supports a
|
|
122
149
|
raw shortcut:
|
|
@@ -174,12 +201,12 @@ This repo currently includes:
|
|
|
174
201
|
transport, bundle handling, and compilation
|
|
175
202
|
- deterministic REC+MBL conformance vectors under
|
|
176
203
|
[`examples/single-file-bundle/vectors`](./examples/single-file-bundle/vectors)
|
|
177
|
-
- reference Node and browser hosts plus the legacy sync `
|
|
204
|
+
- reference Node and browser hosts plus the legacy sync `space_data_module_host` bridge for
|
|
178
205
|
sync-safe guest hostcalls
|
|
179
206
|
|
|
180
207
|
The current host/runtime contract is two-tiered:
|
|
181
208
|
|
|
182
|
-
- raw guest `
|
|
209
|
+
- raw guest `space_data_module_host` imports stay sync-only
|
|
183
210
|
- generic async capabilities such as filesystem, network, IPFS, and protocol
|
|
184
211
|
adapters are exposed through `NodeHost`, `BrowserHost`,
|
|
185
212
|
`createRuntimeHost()` capability registries, and the browser/module harness
|
|
@@ -245,6 +272,27 @@ semantics.
|
|
|
245
272
|
The supported isomorphic profile and browser edge shims are documented in
|
|
246
273
|
[`docs/browser-wasmedge-isomorphic.md`](./docs/browser-wasmedge-isomorphic.md).
|
|
247
274
|
|
|
275
|
+
GPU-accelerated modules should follow the host-owned GPU capability standard in
|
|
276
|
+
[`docs/gpu-module-abi.md`](./docs/gpu-module-abi.md). The reusable C/C++ layout
|
|
277
|
+
header and starter manifest live in
|
|
278
|
+
[`templates/gpu-module`](./templates/gpu-module).
|
|
279
|
+
|
|
280
|
+
The GPU surface is intentionally host-owned. A portable module advertises the
|
|
281
|
+
optional `gpu_compute` capability with scope `webgpu.v1`, keeps a correct CPU
|
|
282
|
+
fallback in `dist/isomorphic/module.wasm`, and lets the embedding host choose a
|
|
283
|
+
backend:
|
|
284
|
+
|
|
285
|
+
- browser hosts use WebGPU through a browser adapter
|
|
286
|
+
- WasmEdge deployments use a native host extension backed by Dawn
|
|
287
|
+
- modules share the SDK C/C++ layout header for dispatch descriptors, result
|
|
288
|
+
records, buffer roles, and split high/low `f32` representations of `f64`
|
|
289
|
+
values
|
|
290
|
+
|
|
291
|
+
The public invoke API should remain domain-specific. GPU command buffers,
|
|
292
|
+
devices, queue ownership, and asynchronous buffer mapping stay behind the host
|
|
293
|
+
capability boundary rather than becoming new sync `space_data_module_host`
|
|
294
|
+
imports.
|
|
295
|
+
|
|
248
296
|
The checked-in same-artifact demo lives in
|
|
249
297
|
[`examples/isomorphic-loader`](./examples/isomorphic-loader):
|
|
250
298
|
|
|
@@ -285,7 +333,7 @@ This repo now exposes a manifest-driven harness generator from
|
|
|
285
333
|
clock/time smoke
|
|
286
334
|
- `npm run test:host-surfaces`
|
|
287
335
|
- authoritative Node-host coverage for HTTP, TCP, UDP, TLS, WebSocket, MQTT,
|
|
288
|
-
process execution, timers, filesystem, and the sync `
|
|
336
|
+
process execution, timers, filesystem, and the sync `space_data_module_host` ABI
|
|
289
337
|
- `npm run test:stream-ingest`
|
|
290
338
|
- correctness coverage for chunked size-prefixed FlatBuffer ingest into the
|
|
291
339
|
runtime-host row store
|
|
@@ -506,11 +554,11 @@ the remaining raw wasm bytes.
|
|
|
506
554
|
## Host ABI
|
|
507
555
|
|
|
508
556
|
This repo also defines the module-facing capability vocabulary and the first
|
|
509
|
-
synchronous hostcall bridge under the import module `
|
|
557
|
+
synchronous hostcall bridge under the import module `space_data_module_host`.
|
|
510
558
|
|
|
511
559
|
The current sync import surface is:
|
|
512
560
|
|
|
513
|
-
- `
|
|
561
|
+
- `call(request_ptr, request_len) -> i32`
|
|
514
562
|
- `response_len() -> i32`
|
|
515
563
|
- `read_response(dst_ptr, dst_len) -> i32`
|
|
516
564
|
- `last_status_code() -> i32`
|
|
@@ -530,13 +578,52 @@ includes:
|
|
|
530
578
|
`protocol_dial` `database` `storage_adapter` `storage_query` `storage_write`
|
|
531
579
|
`context_read` `context_write` `process_exec` `crypto_hash` `crypto_sign`
|
|
532
580
|
`crypto_verify` `crypto_encrypt` `crypto_decrypt` `crypto_key_agreement`
|
|
533
|
-
`crypto_kdf` `wallet_sign` `ipfs` `
|
|
534
|
-
`render_hooks`
|
|
581
|
+
`crypto_kdf` `wallet_sign` `ipfs` `gpu_compute` `scene_access`
|
|
582
|
+
`entity_access` `render_hooks`
|
|
535
583
|
|
|
536
584
|
Manifests can also declare coarse runtime targets for planning and compliance:
|
|
537
585
|
|
|
538
586
|
`node` `browser` `wasi` `wasmedge` `server` `desktop` `edge`
|
|
539
587
|
|
|
588
|
+
## Credential Lanes (`secrets:<lane>`)
|
|
589
|
+
|
|
590
|
+
A module that needs an operator's third-party credential — a Space-Track login,
|
|
591
|
+
a data-provider API password, an account at any service the operator uses —
|
|
592
|
+
reads it at runtime from the node's encrypted credential keystore instead of
|
|
593
|
+
carrying it in the manifest, the flow, or a record.
|
|
594
|
+
|
|
595
|
+
Lane ids are **operator-defined** (lowercase `[a-z0-9_-]{2,64}`). A few are
|
|
596
|
+
well-known (`spacetrack`, `edc_cpf`, `myintelsat`) because the node ships a
|
|
597
|
+
verifier for them, but an operator may create a lane for any service; take the
|
|
598
|
+
lane id as module configuration, not as a compile-time constant.
|
|
599
|
+
|
|
600
|
+
Reading a lane requires the capability `secrets:<lane>` **and** an operator
|
|
601
|
+
approval recorded against your module's exact content hash. Approval is per
|
|
602
|
+
lane: `secrets:spacetrack` conveys nothing about any other lane, and the host
|
|
603
|
+
re-checks the exact lane on every call. Without an approval the module is denied
|
|
604
|
+
at load. There is no list or export operation — a guest can never enumerate the
|
|
605
|
+
keystore.
|
|
606
|
+
|
|
607
|
+
The guest helper is [`src/host/cpp/secretsClient.hpp`](./src/host/cpp/secretsClient.hpp):
|
|
608
|
+
|
|
609
|
+
```cpp
|
|
610
|
+
#include "sdm_hostcall_wire.hpp" // must be included first
|
|
611
|
+
#include "secretsClient.hpp"
|
|
612
|
+
|
|
613
|
+
sdm_secrets::Credential cred;
|
|
614
|
+
if (!sdm_secrets::secrets_get(lane, &cred)) {
|
|
615
|
+
log_error("provider credential unavailable"); // the CONDITION, never the contents
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
const bool ok = provider_login(cred.username, cred.secret);
|
|
619
|
+
sdm_secrets::wipe(&cred); // on every path, including failures
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
The credential arrives as plaintext: never log it, never persist it, never
|
|
623
|
+
forward it anywhere but the provider it belongs to, and wipe it as soon as the
|
|
624
|
+
call is done. Full contract, wire shapes, and failure modes:
|
|
625
|
+
[`docs/secrets-capability.md`](./docs/secrets-capability.md).
|
|
626
|
+
|
|
540
627
|
## Environment Notes
|
|
541
628
|
|
|
542
629
|
| Surface | Node.js | Browser |
|
|
@@ -586,7 +673,6 @@ inspect the parsed `REC`, `PNM`, and `ENC` records produced by the real
|
|
|
586
673
|
## Related Projects
|
|
587
674
|
|
|
588
675
|
- [`spacedatastandards.org`](https://spacedatastandards.org)
|
|
589
|
-
- [`sdn-flow`](https://github.com/DigitalArsenal/sdn-flow)
|
|
590
676
|
- [`hd-wallet-wasm`](https://github.com/nicktj-dev/hd-wallet-wasm)
|
|
591
677
|
|
|
592
678
|
## Development
|
|
@@ -609,6 +695,17 @@ generated bindings must come from upstream SDS sources or published SDS
|
|
|
609
695
|
artifacts generated with `flatc-wasm`. Do not add repo-local shadow `.fbs`
|
|
610
696
|
families or hand-authored generated classes in this repo.
|
|
611
697
|
|
|
698
|
+
PLG bindings are mirrored from SDS generated artifacts. During cross-repo schema
|
|
699
|
+
work, point the generator at the active SDS checkout:
|
|
700
|
+
|
|
701
|
+
```sh
|
|
702
|
+
SPACE_DATA_STANDARDS_ROOT=/path/to/spacedatastandards.org \
|
|
703
|
+
node scripts/generate-plg-bindings.mjs
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
Without the override, the generator uses the installed `spacedatastandards.org`
|
|
707
|
+
package and still refuses to read SDK-local schema copies.
|
|
708
|
+
|
|
612
709
|
If another repo needs the same compiler runtime, the package also exposes a
|
|
613
710
|
shared emception session at `space-data-module-sdk/compiler/emception` with
|
|
614
711
|
helpers for serialized command execution and virtual filesystem access.
|
package/bin/space-data-module.js
CHANGED
|
@@ -16,6 +16,16 @@ import {
|
|
|
16
16
|
validateManifestWithStandards,
|
|
17
17
|
} from "../src/compliance/index.js";
|
|
18
18
|
import { bytesToBase64 } from "../src/utils/encoding.js";
|
|
19
|
+
import {
|
|
20
|
+
signModuleArtifact,
|
|
21
|
+
verifyModuleArtifact,
|
|
22
|
+
} from "../src/bundle/signing.js";
|
|
23
|
+
import {
|
|
24
|
+
checkFlowProgram,
|
|
25
|
+
compileFlowProgram,
|
|
26
|
+
loadFlowDocument,
|
|
27
|
+
resolveFlowDependencies,
|
|
28
|
+
} from "../src/flow/flowCompiler.js";
|
|
19
29
|
|
|
20
30
|
async function main(argv) {
|
|
21
31
|
const [command, ...rest] = argv;
|
|
@@ -24,8 +34,16 @@ async function main(argv) {
|
|
|
24
34
|
return runCheck(rest);
|
|
25
35
|
case "compile":
|
|
26
36
|
return runCompile(rest);
|
|
37
|
+
case "flow":
|
|
38
|
+
return runFlow(rest);
|
|
39
|
+
case "parity":
|
|
40
|
+
return runParity(rest);
|
|
27
41
|
case "protect":
|
|
28
42
|
return runProtect(rest);
|
|
43
|
+
case "sign":
|
|
44
|
+
return runSign(rest);
|
|
45
|
+
case "verify":
|
|
46
|
+
return runVerify(rest);
|
|
29
47
|
case "help":
|
|
30
48
|
case "--help":
|
|
31
49
|
case "-h":
|
|
@@ -84,6 +102,46 @@ function parseArgs(argv) {
|
|
|
84
102
|
case "--mnemonic":
|
|
85
103
|
options.mnemonic = requireValue(argv, ++index, value);
|
|
86
104
|
break;
|
|
105
|
+
case "--deps":
|
|
106
|
+
options.depsPath = requireValue(argv, ++index, value);
|
|
107
|
+
break;
|
|
108
|
+
case "--key":
|
|
109
|
+
options.keyPath = path.resolve(requireValue(argv, ++index, value));
|
|
110
|
+
break;
|
|
111
|
+
case "--trusted":
|
|
112
|
+
options.trustedKeys = requireValue(argv, ++index, value);
|
|
113
|
+
break;
|
|
114
|
+
case "--require-signature":
|
|
115
|
+
options.requireSignature = true;
|
|
116
|
+
break;
|
|
117
|
+
case "--fixture":
|
|
118
|
+
options.fixturePath = path.resolve(requireValue(argv, ++index, value));
|
|
119
|
+
break;
|
|
120
|
+
case "--lanes":
|
|
121
|
+
options.lanes = requireValue(argv, ++index, value)
|
|
122
|
+
.split(",")
|
|
123
|
+
.map((lane) => lane.trim())
|
|
124
|
+
.filter(Boolean);
|
|
125
|
+
break;
|
|
126
|
+
case "--timeout-sec":
|
|
127
|
+
options.timeoutMs =
|
|
128
|
+
Number(requireValue(argv, ++index, value)) * 1000;
|
|
129
|
+
break;
|
|
130
|
+
case "--self-test-divergence":
|
|
131
|
+
options.injectDivergence = requireValue(argv, ++index, value);
|
|
132
|
+
break;
|
|
133
|
+
case "--chrome-binary":
|
|
134
|
+
options.chromeBinary = requireValue(argv, ++index, value);
|
|
135
|
+
break;
|
|
136
|
+
case "--wasmedge-binary":
|
|
137
|
+
options.wasmedgeBinary = requireValue(argv, ++index, value);
|
|
138
|
+
break;
|
|
139
|
+
case "--docker-platform":
|
|
140
|
+
options.dockerPlatform = requireValue(argv, ++index, value);
|
|
141
|
+
break;
|
|
142
|
+
case "--allow-single-lane":
|
|
143
|
+
options.allowSingleLane = true;
|
|
144
|
+
break;
|
|
87
145
|
default:
|
|
88
146
|
throw new Error(`Unknown argument: ${value}`);
|
|
89
147
|
}
|
|
@@ -105,9 +163,17 @@ function printUsage() {
|
|
|
105
163
|
space-data-module check --repo-root .
|
|
106
164
|
space-data-module check --manifest ./manifest.json --wasm ./dist/module.wasm
|
|
107
165
|
space-data-module compile --manifest ./manifest.json --source ./src/module.c --out ./dist/module.wasm
|
|
166
|
+
space-data-module parity --wasm ./dist/isomorphic/module.wasm --fixture ./fixtures/parity/basic.json
|
|
167
|
+
space-data-module parity --wasm ./dist/isomorphic/module.wasm --fixture ./f.json --lanes browser,wasmedge,docker-wasmedge [--json]
|
|
168
|
+
space-data-module parity ... --self-test-divergence docker-wasmedge (fire drill: prove the diff fails loudly)
|
|
169
|
+
space-data-module flow check ./flows/my.flow.json --deps ./modules-root
|
|
170
|
+
space-data-module flow compile ./flows/my.flow.json --deps ./modules-root [--out ./flows/my/dist]
|
|
108
171
|
space-data-module protect --manifest ./manifest.json --wasm ./dist/module.wasm --json
|
|
109
172
|
space-data-module protect --manifest ./manifest.json --wasm ./dist/module.wasm --recipient-public-key <hex> --out ./dist/module.wasm.enc
|
|
110
173
|
space-data-module protect --manifest ./manifest.json --wasm ./dist/module.wasm --single-file-bundle --out ./dist/module.bundle.wasm
|
|
174
|
+
space-data-module sign --wasm ./dist/module.wasm --key ./test/support/dev-module-signing-keypair.json [--out ./dist/module.signed.wasm]
|
|
175
|
+
space-data-module verify --wasm ./dist/module.wasm --trusted <pubKeyHex[,pubKeyHex...]> [--require-signature]
|
|
176
|
+
space-data-module verify --wasm ./dist/module.wasm --key ./test/support/dev-module-signing-keypair.json
|
|
111
177
|
`);
|
|
112
178
|
}
|
|
113
179
|
|
|
@@ -123,6 +189,139 @@ function printReport(report) {
|
|
|
123
189
|
}
|
|
124
190
|
}
|
|
125
191
|
|
|
192
|
+
// space-data-module flow check|compile <flow.json> [--deps <path>] [--out <dir>]
|
|
193
|
+
async function runFlow(argv) {
|
|
194
|
+
const [subcommand, ...rest] = argv;
|
|
195
|
+
if (subcommand !== "check" && subcommand !== "compile") {
|
|
196
|
+
printUsage();
|
|
197
|
+
return 1;
|
|
198
|
+
}
|
|
199
|
+
const positionals = rest.filter((value) => !value.startsWith("--"));
|
|
200
|
+
const flags = [];
|
|
201
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
202
|
+
const value = rest[index];
|
|
203
|
+
if (!value.startsWith("--")) continue;
|
|
204
|
+
flags.push(value);
|
|
205
|
+
if (value !== "--json" && rest[index + 1] !== undefined) {
|
|
206
|
+
flags.push(rest[++index]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const flowPath = positionals[0] ? path.resolve(positionals[0]) : null;
|
|
210
|
+
if (!flowPath) {
|
|
211
|
+
throw new Error(`flow ${subcommand} requires a <flow.json> path.`);
|
|
212
|
+
}
|
|
213
|
+
const options = parseArgs(flags);
|
|
214
|
+
|
|
215
|
+
const flow = await loadFlowDocument(flowPath);
|
|
216
|
+
const dependencies = await resolveFlowDependencies({
|
|
217
|
+
depsPath: options.depsPath ?? path.dirname(flowPath),
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
if (subcommand === "check") {
|
|
221
|
+
const check = checkFlowProgram({ flow, dependencies });
|
|
222
|
+
if (options.json) {
|
|
223
|
+
console.log(JSON.stringify(check, null, 2));
|
|
224
|
+
} else {
|
|
225
|
+
console.log(`${check.ok ? "PASS" : "FAIL"} ${flowPath}`);
|
|
226
|
+
for (const issue of check.issues) {
|
|
227
|
+
console.log(` ${issue.severity.toUpperCase()} ${issue.code}: ${issue.message}`);
|
|
228
|
+
}
|
|
229
|
+
console.log(` capabilities: [${check.capabilities.join(", ")}]`);
|
|
230
|
+
for (const node of check.nodes) {
|
|
231
|
+
console.log(` node ${node.nodeId}: ${node.pluginId}:${node.methodId} (${node.dispatchModel})`);
|
|
232
|
+
}
|
|
233
|
+
for (const component of check.componentDependencies) {
|
|
234
|
+
console.log(
|
|
235
|
+
` component ${component.pluginId}${component.minVersion ? `@${component.minVersion}` : ""}` +
|
|
236
|
+
`${component.resolved ? "" : " (unresolved)"}`,
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return check.ok ? 0 : 1;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const outDir =
|
|
244
|
+
options.outputPath ??
|
|
245
|
+
path.join(
|
|
246
|
+
path.dirname(flowPath),
|
|
247
|
+
path.basename(flowPath).replace(/\.flow\.json$/, "").replace(/\.json$/, ""),
|
|
248
|
+
"dist",
|
|
249
|
+
);
|
|
250
|
+
const result = await compileFlowProgram({
|
|
251
|
+
flow,
|
|
252
|
+
dependencies,
|
|
253
|
+
outDir,
|
|
254
|
+
flowSourcePath: flowPath,
|
|
255
|
+
});
|
|
256
|
+
if (options.json) {
|
|
257
|
+
console.log(
|
|
258
|
+
JSON.stringify(
|
|
259
|
+
{
|
|
260
|
+
outDir,
|
|
261
|
+
outputs: result.outputs,
|
|
262
|
+
capabilities: result.check.capabilities,
|
|
263
|
+
artifact: result.artifact,
|
|
264
|
+
report: result.report,
|
|
265
|
+
},
|
|
266
|
+
null,
|
|
267
|
+
2,
|
|
268
|
+
),
|
|
269
|
+
);
|
|
270
|
+
} else {
|
|
271
|
+
console.log(`Wrote ${result.outputs.moduleWasmPath}`);
|
|
272
|
+
console.log(` capabilities: [${result.check.capabilities.join(", ")}]`);
|
|
273
|
+
for (const node of result.check.nodes) {
|
|
274
|
+
console.log(` node ${node.nodeId}: ${node.pluginId}:${node.methodId} (${node.dispatchModel})`);
|
|
275
|
+
}
|
|
276
|
+
for (const issue of result.check.warnings) {
|
|
277
|
+
console.log(` WARNING ${issue.code}: ${issue.message}`);
|
|
278
|
+
}
|
|
279
|
+
printReport(result.report);
|
|
280
|
+
}
|
|
281
|
+
return result.report.ok ? 0 : 1;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// space-data-module parity --wasm <module.wasm> --fixture <fixture.json>
|
|
285
|
+
// [--lanes browser,wasmedge,docker-wasmedge] [--json] [--timeout-sec N]
|
|
286
|
+
// [--self-test-divergence <lane>] [--chrome-binary|--wasmedge-binary <bin>]
|
|
287
|
+
// [--docker-platform <p>] [--allow-single-lane]
|
|
288
|
+
//
|
|
289
|
+
// ONE module.wasm, three runtimes, byte-identical behavior. Exit 0 only when
|
|
290
|
+
// every lane × thread-count run matches; any divergence, missing lane, or
|
|
291
|
+
// WasmEdge pin drift exits non-zero with a per-case mismatch report.
|
|
292
|
+
async function runParity(argv) {
|
|
293
|
+
const options = parseArgs(argv);
|
|
294
|
+
if (!options.wasmPath || !options.fixturePath) {
|
|
295
|
+
throw new Error("parity requires --wasm and --fixture.");
|
|
296
|
+
}
|
|
297
|
+
const { runParityHarness, formatParityReport } = await import(
|
|
298
|
+
"../src/testing/parityHarness.js"
|
|
299
|
+
);
|
|
300
|
+
const report = await runParityHarness({
|
|
301
|
+
wasmPath: options.wasmPath,
|
|
302
|
+
fixturePath: options.fixturePath,
|
|
303
|
+
lanes: options.lanes,
|
|
304
|
+
timeoutMs: options.timeoutMs,
|
|
305
|
+
injectDivergence: options.injectDivergence,
|
|
306
|
+
chromeBinary: options.chromeBinary,
|
|
307
|
+
wasmedgeBinary: options.wasmedgeBinary,
|
|
308
|
+
dockerPlatform: options.dockerPlatform,
|
|
309
|
+
allowSingleLane: options.allowSingleLane === true,
|
|
310
|
+
log: (line) => console.error(line),
|
|
311
|
+
});
|
|
312
|
+
if (options.json) {
|
|
313
|
+
console.log(JSON.stringify(report, null, 2));
|
|
314
|
+
} else {
|
|
315
|
+
const text = formatParityReport(report);
|
|
316
|
+
if (report.ok) {
|
|
317
|
+
console.log(text);
|
|
318
|
+
} else {
|
|
319
|
+
console.error(text);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return report.ok ? 0 : 2;
|
|
323
|
+
}
|
|
324
|
+
|
|
126
325
|
async function runCheck(argv) {
|
|
127
326
|
const options = parseArgs(argv);
|
|
128
327
|
if (options.manifestPath) {
|
|
@@ -248,6 +447,70 @@ async function runProtect(argv) {
|
|
|
248
447
|
return 0;
|
|
249
448
|
}
|
|
250
449
|
|
|
450
|
+
async function runSign(argv) {
|
|
451
|
+
const options = parseArgs(argv);
|
|
452
|
+
if (!options.wasmPath || !options.keyPath) {
|
|
453
|
+
throw new Error("sign requires --wasm and --key <keypair.json>.");
|
|
454
|
+
}
|
|
455
|
+
const keypair = JSON.parse(await readFile(options.keyPath, "utf8"));
|
|
456
|
+
if (!keypair.privateKeySeedHex) {
|
|
457
|
+
throw new Error("key file must contain privateKeySeedHex.");
|
|
458
|
+
}
|
|
459
|
+
const wasmBytes = new Uint8Array(await readFile(options.wasmPath));
|
|
460
|
+
const result = await signModuleArtifact(wasmBytes, {
|
|
461
|
+
privateKeySeedHex: keypair.privateKeySeedHex,
|
|
462
|
+
keyId: keypair.keyId ?? null,
|
|
463
|
+
});
|
|
464
|
+
const outputPath = options.outputPath ?? options.wasmPath;
|
|
465
|
+
await writeFile(outputPath, result.wasmBytes);
|
|
466
|
+
if (options.json) {
|
|
467
|
+
console.log(
|
|
468
|
+
JSON.stringify(
|
|
469
|
+
{
|
|
470
|
+
outputPath,
|
|
471
|
+
keyId: result.signature.keyId,
|
|
472
|
+
publicKeyHex: result.signature.publicKeyHex,
|
|
473
|
+
canonicalModuleHashHex: result.canonicalModuleHashHex,
|
|
474
|
+
},
|
|
475
|
+
null,
|
|
476
|
+
2,
|
|
477
|
+
),
|
|
478
|
+
);
|
|
479
|
+
} else {
|
|
480
|
+
console.log(`signed=${outputPath}`);
|
|
481
|
+
console.log(`keyId=${result.signature.keyId}`);
|
|
482
|
+
console.log(`publicKeyHex=${result.signature.publicKeyHex}`);
|
|
483
|
+
console.log(`canonicalModuleHashHex=${result.canonicalModuleHashHex}`);
|
|
484
|
+
}
|
|
485
|
+
return 0;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
async function runVerify(argv) {
|
|
489
|
+
const options = parseArgs(argv);
|
|
490
|
+
if (!options.wasmPath) {
|
|
491
|
+
throw new Error("verify requires --wasm.");
|
|
492
|
+
}
|
|
493
|
+
let trustedPublicKeys = options.trustedKeys;
|
|
494
|
+
if (!trustedPublicKeys && options.keyPath) {
|
|
495
|
+
const keypair = JSON.parse(await readFile(options.keyPath, "utf8"));
|
|
496
|
+
trustedPublicKeys = keypair.publicKeyHex;
|
|
497
|
+
}
|
|
498
|
+
const wasmBytes = new Uint8Array(await readFile(options.wasmPath));
|
|
499
|
+
const result = await verifyModuleArtifact(wasmBytes, {
|
|
500
|
+
trustedPublicKeys,
|
|
501
|
+
requireSignature: options.requireSignature ?? true,
|
|
502
|
+
});
|
|
503
|
+
if (options.json) {
|
|
504
|
+
console.log(JSON.stringify(result, null, 2));
|
|
505
|
+
} else {
|
|
506
|
+
console.log(`verified=${result.verified}`);
|
|
507
|
+
console.log(`signed=${result.signed}`);
|
|
508
|
+
if (result.keyId) console.log(`keyId=${result.keyId}`);
|
|
509
|
+
if (result.publicKeyHex) console.log(`publicKeyHex=${result.publicKeyHex}`);
|
|
510
|
+
}
|
|
511
|
+
return result.verified ? 0 : 1;
|
|
512
|
+
}
|
|
513
|
+
|
|
251
514
|
main(process.argv.slice(2))
|
|
252
515
|
.then((exitCode) => {
|
|
253
516
|
process.exitCode = exitCode;
|
package/docs/.nojekyll
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/docs/AGENTS.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# AGENTS
|
|
2
|
+
|
|
3
|
+
Apply the root `AGENTS.md` first. The docs in this repo are normative whenever
|
|
4
|
+
they use words like "canonical", "required", or "must".
|
|
5
|
+
|
|
6
|
+
## What Authors Should Expect From These Docs
|
|
7
|
+
|
|
8
|
+
- When behavior changes, update the relevant doc in the same change. Do not let
|
|
9
|
+
README, examples, and normative docs drift.
|
|
10
|
+
- Keep browser/WasmEdge portability aligned with
|
|
11
|
+
`docs/browser-wasmedge-isomorphic.md`.
|
|
12
|
+
- Keep the async host adapter boundary aligned with
|
|
13
|
+
`docs/browser-wasmedge-isomorphic.md` and `docs/testing-harness.md`.
|
|
14
|
+
- When the generic async capability boundary changes, update the exported types
|
|
15
|
+
and public entry points in the same change so `NodeHost`, `BrowserHost`,
|
|
16
|
+
`createRuntimeHost()`, and harness `callHost(...)` stay in sync.
|
|
17
|
+
- Keep publication layout and release expectations aligned with
|
|
18
|
+
`docs/module-publication-standard.md`.
|
|
19
|
+
- Keep binary FlatBuffer ingest guidance aligned with
|
|
20
|
+
`docs/flatsql-streaming-standard.md`.
|
|
21
|
+
- Keep testing claims aligned with `docs/testing-harness.md`.
|
|
22
|
+
- If you change user-facing behavior, update the nearest example README as well.
|
|
23
|
+
|
|
24
|
+
## Read These First
|
|
25
|
+
|
|
26
|
+
- `docs/browser-wasmedge-isomorphic.md`
|
|
27
|
+
- `docs/flatsql-streaming-standard.md`
|
|
28
|
+
- `docs/module-publication-standard.md`
|
|
29
|
+
- `docs/testing-harness.md`
|
|
30
|
+
|
|
31
|
+
## Note
|
|
32
|
+
|
|
33
|
+
If you are only authoring a module, prefer following these docs over editing
|
|
34
|
+
them. Edit docs here only when the canonical guidance itself needs to change.
|