space-data-module-sdk 0.8.14 → 0.8.16

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.
Files changed (125) hide show
  1. package/bin/space-data-module.js +91 -0
  2. package/docs/_shell/consumer-assets.html +5 -0
  3. package/docs/browser-wasmedge-isomorphic.html +261 -0
  4. package/docs/byo-wasm-quickstart.html +226 -0
  5. package/docs/byo-wasm-quickstart.md +204 -0
  6. package/docs/conformance.html +156 -0
  7. package/docs/conformance.md +92 -0
  8. package/docs/emception-shared-memory-verdict.md +209 -0
  9. package/docs/events-abi.html +313 -0
  10. package/docs/events-abi.md +530 -0
  11. package/docs/families/analytics.html +178 -0
  12. package/docs/families/analytics.md +104 -0
  13. package/docs/families/attitude.html +157 -0
  14. package/docs/families/attitude.md +36 -0
  15. package/docs/families/behavior.html +157 -0
  16. package/docs/families/behavior.md +36 -0
  17. package/docs/families/breakup.html +157 -0
  18. package/docs/families/breakup.md +36 -0
  19. package/docs/families/conjunction.html +186 -0
  20. package/docs/families/conjunction.md +121 -0
  21. package/docs/families/data-source.html +318 -0
  22. package/docs/families/effects.html +157 -0
  23. package/docs/families/effects.md +36 -0
  24. package/docs/families/environment.html +170 -0
  25. package/docs/families/environment.md +73 -0
  26. package/docs/families/estimation.html +190 -0
  27. package/docs/families/estimation.md +128 -0
  28. package/docs/families/gnc.html +157 -0
  29. package/docs/families/gnc.md +36 -0
  30. package/docs/families/maneuver.html +209 -0
  31. package/docs/families/maneuver.md +206 -0
  32. package/docs/families/obstruction.html +191 -0
  33. package/docs/families/obstruction.md +96 -0
  34. package/docs/families/propagator.html +333 -0
  35. package/docs/families/propulsion.html +157 -0
  36. package/docs/families/propulsion.md +36 -0
  37. package/docs/families/reentry.html +157 -0
  38. package/docs/families/reentry.md +36 -0
  39. package/docs/families/rf.html +193 -0
  40. package/docs/families/rf.md +136 -0
  41. package/docs/families/scheduler.html +157 -0
  42. package/docs/families/scheduler.md +36 -0
  43. package/docs/families/sensor.html +157 -0
  44. package/docs/families/sensor.md +36 -0
  45. package/docs/families/signature.html +157 -0
  46. package/docs/families/signature.md +36 -0
  47. package/docs/flatsql-host-contract.html +176 -0
  48. package/docs/flatsql-streaming-standard.html +375 -0
  49. package/docs/gpu-module-abi.html +233 -0
  50. package/docs/harness-family-matrix.md +135 -0
  51. package/docs/index.html +216 -85
  52. package/docs/isomorphic-pthreads.html +228 -0
  53. package/docs/isomorphic-pthreads.md +84 -0
  54. package/docs/isomorphic-sdn-runtime-plan.html +274 -0
  55. package/docs/language-runtime-matrix.html +182 -0
  56. package/docs/llms.txt +86 -0
  57. package/docs/module-bundle-runtime-plan.html +146 -0
  58. package/docs/module-publication-standard.html +503 -0
  59. package/docs/node-red-default-node-parity.html +201 -0
  60. package/docs/propagator-abi.md +73 -21
  61. package/docs/protect-and-sign.html +181 -0
  62. package/docs/protect-and-sign.md +120 -0
  63. package/docs/protocol-installation.html +296 -0
  64. package/docs/publication-submission.html +158 -0
  65. package/docs/publication-submission.md +78 -0
  66. package/docs/secrets-capability.html +206 -0
  67. package/docs/styles.css +860 -167
  68. package/docs/testing-harness.html +408 -0
  69. package/docs/tri-runtime-parity-gate.html +182 -0
  70. package/docs/tri-runtime-parity.html +203 -0
  71. package/include/orbpro/orbpro_event_runner.h +951 -0
  72. package/include/orbpro/orbpro_events_abi.h +565 -0
  73. package/include/orbpro/orbpro_propagator_abi.h +17 -0
  74. package/package.json +15 -5
  75. package/schemas/orbpro/Events.fbs +501 -0
  76. package/schemas/orbpro/Propagator.fbs +72 -9
  77. package/schemas/orbpro/reference-frame-crosswalk.json +108 -0
  78. package/schemas/orbpro/reference-frame.lock.json +98 -0
  79. package/src/browser.js +13 -0
  80. package/src/conformance/abiDriver.js +225 -0
  81. package/src/conformance/index.js +151 -0
  82. package/src/conformance/propagatorSuite.js +526 -0
  83. package/src/conformance/selfTest.js +275 -0
  84. package/src/conformance/selfTestCorpus.js +68 -0
  85. package/src/conformance/twoBodyReference.js +132 -0
  86. package/src/generated/orbpro/events-abi.js +206 -0
  87. package/src/generated/orbpro/events-abi.ts +319 -0
  88. package/src/generated/orbpro/propagator/reference-frame.js +17 -0
  89. package/src/generated/orbpro/propagator/reference-frame.ts +91 -1
  90. package/src/generated/orbpro/propagator-abi.js +17 -0
  91. package/src/generated/orbpro/propagator-abi.ts +17 -0
  92. package/src/generated/spacedatastandards/plg/CCT.d.ts +94 -0
  93. package/src/generated/spacedatastandards/plg/CCT.d.ts.map +1 -0
  94. package/src/generated/spacedatastandards/plg/CCT.js +208 -0
  95. package/src/generated/spacedatastandards/plg/CCT.ts +281 -0
  96. package/src/generated/spacedatastandards/plg/CCTCategory.d.ts +98 -0
  97. package/src/generated/spacedatastandards/plg/CCTCategory.d.ts.map +1 -0
  98. package/src/generated/spacedatastandards/plg/CCTCategory.js +177 -0
  99. package/src/generated/spacedatastandards/plg/CCTCategory.ts +269 -0
  100. package/src/generated/spacedatastandards/plg/CCTCategoryRollup.d.ts +54 -0
  101. package/src/generated/spacedatastandards/plg/CCTCategoryRollup.d.ts.map +1 -0
  102. package/src/generated/spacedatastandards/plg/CCTCategoryRollup.js +106 -0
  103. package/src/generated/spacedatastandards/plg/CCTCategoryRollup.ts +144 -0
  104. package/src/generated/spacedatastandards/plg/PLG.d.ts +46 -2
  105. package/src/generated/spacedatastandards/plg/PLG.d.ts.map +1 -1
  106. package/src/generated/spacedatastandards/plg/PLG.js +78 -5
  107. package/src/generated/spacedatastandards/plg/PLG.ts +90 -5
  108. package/src/generated/spacedatastandards/plg/capabilityClass.d.ts +181 -0
  109. package/src/generated/spacedatastandards/plg/capabilityClass.d.ts.map +1 -0
  110. package/src/generated/spacedatastandards/plg/capabilityClass.js +183 -0
  111. package/src/generated/spacedatastandards/plg/capabilityClass.ts +208 -0
  112. package/src/generated/spacedatastandards/plg/main.d.ts +4 -0
  113. package/src/generated/spacedatastandards/plg/main.d.ts.map +1 -1
  114. package/src/generated/spacedatastandards/plg/main.js +4 -0
  115. package/src/generated/spacedatastandards/plg/main.ts +4 -0
  116. package/src/generated/spacedatastandards/plg/pluginCategory.d.ts +40 -2
  117. package/src/generated/spacedatastandards/plg/pluginCategory.d.ts.map +1 -1
  118. package/src/generated/spacedatastandards/plg/pluginCategory.js +40 -2
  119. package/src/generated/spacedatastandards/plg/pluginCategory.ts +40 -2
  120. package/src/host/browserModuleHarness.js +8 -0
  121. package/src/host/wasiThreadHost.js +189 -14
  122. package/src/index.d.ts +18 -1
  123. package/src/testing/isomorphicHarness.js +233 -0
  124. package/src/transport/index.js +16 -0
  125. package/src/transport/records.js +1015 -3
@@ -0,0 +1,176 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="description" content="The current floor is ^2.0.0. The 1.x history below is what made the" />
7
+ <title>FlatSQL host contract — Space Data Module SDK</title>
8
+ <link rel="stylesheet" href="./styles.css" />
9
+ <!-- SDN_CONSUMER_ASSETS_START -->
10
+ <link rel="stylesheet" href="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-public-client.c3f68d1cfd88478f10d836a5e829d1dfc6a10157972cf0f7d4d319d0636f2cc4.css" integrity="sha384-fICuhN4I9xqOK1F5vGGzl26opuO+xQIvTZXMSV76lWTBiQ6AfzztMGLLDw8yRT8i" crossorigin="anonymous">
11
+ <script defer src="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-public-client.f611e7e151a3b5c38384272f8894a4c6634f0a29bf925b0e02e0e27f8db0bfff.js" integrity="sha384-R+QqsKoWJIS7iWrtPmgJ49DVnb1hSGjZokupbLInJd1PLp8RwQhtF/hnaerc33ci" crossorigin="anonymous" data-sdn-wallet-public-client="v1"></script>
12
+ <script defer src="https://static.spacedatanetwork.org/assets/sdn-stack-nav/1.0.0/sdn-stack-nav.52fde607eee38ffa116188201f50258ed50bd18c9f06c1af9678f763147a8fe5.js" integrity="sha384-dgeojhJ8vTszHXIbv7O7nZcEzqD10oUYYJjBmPrV7+kLQEUlXLQD4ek5Q7HOFiO5" crossorigin="anonymous" data-nav-style-url="https://static.spacedatanetwork.org/assets/sdn-stack-nav/1.0.0/sdn-stack-nav.36a36359ce18322185e9ff179f88175bab67d5ad84a14d9c08a54f2ff27267e7.css" data-nav-style-integrity="sha384-c4M8Fg+kYaeOYYtJVr7jJsde24IhSWkWaRyAOHEZU9jozhRck089aw+mnHwxymds" data-wallet-client-url="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-public-client.f611e7e151a3b5c38384272f8894a4c6634f0a29bf925b0e02e0e27f8db0bfff.js" data-wallet-client-integrity="sha384-R+QqsKoWJIS7iWrtPmgJ49DVnb1hSGjZokupbLInJd1PLp8RwQhtF/hnaerc33ci" data-wallet-style-url="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-public-client.c3f68d1cfd88478f10d836a5e829d1dfc6a10157972cf0f7d4d319d0636f2cc4.css" data-wallet-style-integrity="sha384-fICuhN4I9xqOK1F5vGGzl26opuO+xQIvTZXMSV76lWTBiQ6AfzztMGLLDw8yRT8i" data-wallet-client-id="sdn-module-sdk-pages-v1" data-wallet-callback-uri="https://digitalarsenal.github.io/space-data-module-sdk/wallet-callback.html" data-wallet-registry-sha256="e1ce6fe903c9700484a8a87d96581c8cad97063dabf63030b4518a31a3bdaa93"></script>
13
+ <!-- SDN_CONSUMER_ASSETS_END -->
14
+ </head>
15
+ <body>
16
+ <a class="skip-link" href="#main">Skip to content</a>
17
+ <sdn-stack-nav active="module-sdk"></sdn-stack-nav>
18
+ <header class="site-header">
19
+ <a class="site-brand" href="./">Space Data Module SDK</a>
20
+ <nav class="header-links" aria-label="Site">
21
+ <a href="./byo-wasm-quickstart.html">Quickstart</a>
22
+ <a href="./conformance.html">Conformance</a>
23
+ <a href="https://github.com/DigitalArsenal/space-data-module-sdk">GitHub</a>
24
+ <a class="stack-button" href="#stack">Stack</a>
25
+ </nav>
26
+ </header>
27
+ <div class="shell">
28
+ <nav class="sidebar" id="sidebar" aria-label="Documentation">
29
+ <h2>Start here</h2><ul>
30
+ <li><a href="./index.html"><span>Harness family matrix</span></a></li>
31
+ <li><a href="./byo-wasm-quickstart.html"><span>BYO-wasm quickstart</span></a></li>
32
+ <li><a href="./conformance.html"><span>Conformance kit</span></a></li>
33
+ <li><a href="./protect-and-sign.html"><span>Protect and sign</span></a></li>
34
+ <li><a href="./publication-submission.html"><span>Publication and listing</span></a></li>
35
+ </ul>
36
+ <h2>Dynamics</h2><ul>
37
+ <li><a href="./families/propagator.html"><span>Propagator</span><span class="tag tag-shipped">shipped</span></a></li>
38
+ <li><a href="./families/maneuver.html"><span>Maneuver</span><span class="tag tag-experimental">experimental</span></a></li>
39
+ <li><a href="./families/propulsion.html"><span>Propulsion</span><span class="tag tag-planned">planned</span></a></li>
40
+ <li><a href="./families/attitude.html"><span>Attitude</span><span class="tag tag-planned">planned</span></a></li>
41
+ <li><a href="./families/gnc.html"><span>GNC</span><span class="tag tag-planned">planned</span></a></li>
42
+ </ul>
43
+ <h2>Environment and interaction</h2><ul>
44
+ <li><a href="./families/rf.html"><span>RF</span><span class="tag tag-designed">designed</span></a></li>
45
+ <li><a href="./families/sensor.html"><span>Sensor</span><span class="tag tag-planned">planned</span></a></li>
46
+ <li><a href="./families/signature.html"><span>Signature</span><span class="tag tag-planned">planned</span></a></li>
47
+ <li><a href="./families/environment.html"><span>Environment</span><span class="tag tag-planned">planned</span></a></li>
48
+ <li><a href="./families/obstruction.html"><span>Obstruction</span><span class="tag tag-designed">designed</span></a></li>
49
+ </ul>
50
+ <h2>Event physics</h2><ul>
51
+ <li><a href="./families/breakup.html"><span>Breakup</span><span class="tag tag-planned">planned</span></a></li>
52
+ <li><a href="./families/reentry.html"><span>Reentry</span><span class="tag tag-planned">planned</span></a></li>
53
+ <li><a href="./families/conjunction.html"><span>Conjunction</span><span class="tag tag-designed">designed</span></a></li>
54
+ <li><a href="./families/effects.html"><span>Effects</span><span class="tag tag-planned">planned</span></a></li>
55
+ </ul>
56
+ <h2>Estimation, data and logic</h2><ul>
57
+ <li><a href="./families/estimation.html"><span>Estimation</span><span class="tag tag-experimental">experimental</span></a></li>
58
+ <li><a href="./families/data-source.html"><span>Data source</span><span class="tag tag-shipped">shipped</span></a></li>
59
+ <li><a href="./families/analytics.html"><span>Analytics</span><span class="tag tag-experimental">experimental</span></a></li>
60
+ <li><a href="./families/scheduler.html"><span>Scheduler</span><span class="tag tag-planned">planned</span></a></li>
61
+ <li><a href="./families/behavior.html"><span>Behavior</span><span class="tag tag-planned">planned</span></a></li>
62
+ </ul>
63
+ <h2>Runtime contract</h2><ul>
64
+ <li><a href="./events-abi.html"><span>Event locator ABI</span></a></li>
65
+ <li><a href="./module-publication-standard.html"><span>Module publication standard</span></a></li>
66
+ <li><a href="./browser-wasmedge-isomorphic.html"><span>Browser / WasmEdge isomorphism</span></a></li>
67
+ <li><a href="./isomorphic-pthreads.html"><span>Isomorphic pthreads</span></a></li>
68
+ <li><a href="./tri-runtime-parity.html"><span>Tri-runtime parity</span></a></li>
69
+ <li><a href="./tri-runtime-parity-gate.html"><span>Tri-runtime parity gate</span></a></li>
70
+ <li><a href="./testing-harness.html"><span>Testing harness</span></a></li>
71
+ <li><a href="./language-runtime-matrix.html"><span>Language and runtime matrix</span></a></li>
72
+ </ul>
73
+ <h2>Host surfaces</h2><ul>
74
+ <li><a href="./flatsql-host-contract.html" aria-current="page"><span>FlatSQL host contract</span></a></li>
75
+ <li><a href="./flatsql-streaming-standard.html"><span>FlatSQL streaming standard</span></a></li>
76
+ <li><a href="./secrets-capability.html"><span>Credential lanes</span></a></li>
77
+ <li><a href="./protocol-installation.html"><span>Protocol installation</span></a></li>
78
+ <li><a href="./gpu-module-abi.html"><span>GPU module ABI</span></a></li>
79
+ <li><a href="./module-bundle-runtime-plan.html"><span>Module bundle runtime</span></a></li>
80
+ <li><a href="./isomorphic-sdn-runtime-plan.html"><span>Isomorphic SDN runtime</span></a></li>
81
+ <li><a href="./node-red-default-node-parity.html"><span>Node-RED node parity</span></a></li>
82
+ </ul>
83
+ </nav>
84
+ <main class="doc" id="main">
85
+ <h1>FlatSQL host contract</h1>
86
+ <p>The current floor is <strong><code>^2.0.0</code></strong>. The 1.x history below is what made the contract, and it still describes the contract 2.0.0 ships — see <a href="#the-200-floor-is-a-licence-change-not-a-port">The 2.0.0 floor is a licence change, not a port</a> at the end for why the major bump costs nothing here.</p>
87
+ <h2 id="the-defect-the-bump-repairs"><a class="anchor" href="#the-defect-the-bump-repairs" aria-hidden="true">#</a>The defect the bump repairs</h2>
88
+ <p>The SDK floored <code>flatsql</code> at <code>^0.4.2</code>. <code>^0.4.2</code> admits nothing in 1.x, so the floor sat a full major behind, and — the part that matters — the 0.4.x <code>wasm/flatsql-wasi.wasm</code> is an <strong>emscripten-glue artifact</strong>. Measured on the shipped bytes:</p>
89
+ <div class="table-wrap"><table><thead><tr><th>version</th><th>imports</th><th>shape</th></tr></thead><tbody><tr><td>0.4.2</td><td><strong>69</strong></td><td>59 on <code>env</code>: ~40 <code>invoke_*</code> EH trampolines, <code>__cxa_*</code>, <code>__resumeException</code>, <code>llvm_eh_typeid_for</code>, 10 <code>__syscall_*</code>, <code>emscripten_notify_memory_growth</code></td></tr><tr><td>1.4.4</td><td><strong>13</strong></td><td>7 <code>flatsql_io_*</code> + 6 WASI preview1</td></tr></tbody></table></div>
90
+ <p>Under the pinned WasmEdge 0.16.4:</p>
91
+ <div class="codeblock"><pre><code>0.4.2 -&gt; instantiation failed: unknown import … &quot;env&quot; &quot;invoke_vi&quot;
92
+ 1.4.4 -&gt; links; blocked only on the DECLARED capability env.flatsql_io_open</code></pre></div>
93
+ <p>Modules are EH-free and <code>emcc</code>-shaped artifacts are a browser-only trap, so <code>^0.4.2</code> pinned a <strong>non-isomorphic engine</strong>. That is an auto-reject under the module contract, and the tri-runtime parity gate now says so out loud: <code>flatsql-standalone :: FORBIDDEN import class [emscripten-eh, emscripten-runtime, emscripten-syscall] — 59 import(s)</code>.</p>
94
+ <h2 id="what-the-bump-costs"><a class="anchor" href="#what-the-bump-costs" aria-hidden="true">#</a>What the bump costs</h2>
95
+ <p>Nothing at the JS call sites. The SDK uses <code>FlatSQLDatabase.fromSchema</code>, <code>.query</code>, <code>.insert</code>, and <code>DirectAccessor.registerAccessor</code>/<code>.registerBuilder</code> (<code>src/runtime-host/flatsqlRuntimeStore.js</code>); all are present in 1.4.4, and the C ABI went 57 → 96 exports with <strong>zero removed</strong>.</p>
96
+ <p>One real behavioral change surfaced, and it is a <em>fix</em>, not a break:</p>
97
+ <blockquote><p><strong>0.4.2 silently ignored <code>ORDER BY</code>.</strong> <code>listRows()</code> is <code>SELECT … ORDER BY schemaFileId, rowId</code>, and on 0.4.2 it returned INSERTION order. 1.4.4 honours the clause. <code>test/runtime-host-stream-ingest.test.js</code> had encoded the broken behaviour (OMM-then-ENTM); it now asserts the sorted contract and checks payloads by handle instead of by position, so it cannot re-encode an engine bug as SDK semantics.</p></blockquote>
98
+ <h2 id="the-host-contract-14x-makes-unconditional"><a class="anchor" href="#the-host-contract-14x-makes-unconditional" aria-hidden="true">#</a>The host contract 1.4.x makes unconditional</h2>
99
+ <p>1.4.x imports these seven functions on module <code>env</code> <strong>unconditionally</strong>. A host that does not supply them cannot instantiate the artifact, so host wiring and the artifact bump land together or not at all:</p>
100
+ <div class="codeblock"><pre><code>i32 flatsql_io_open(ptr path, i32 pathLen, i32 flags)
101
+ i32 flatsql_io_read(i32 h, ptr dst, i32 len, f64 offset)
102
+ i32 flatsql_io_write(i32 h, ptr src, i32 len, f64 offset)
103
+ i32 flatsql_io_truncate(i32 h, f64 size)
104
+ i32 flatsql_io_sync(i32 h)
105
+ f64 flatsql_io_size(i32 h)
106
+ i32 flatsql_io_close(i32 h)</code></pre></div>
107
+ <p><strong>Offsets are <code>f64</code>, never <code>i64</code>.</strong> emscripten legalizes i64 across the JS boundary for the browser target and not for <code>STANDALONE_WASM</code>; using i64 would give one import two different signatures in the two lanes, which is the exact shape of a cross-runtime divergence.</p>
108
+ <p>The SDK publishes this contract so consumers wire it identically in both lanes rather than each inventing it:</p>
109
+ <div class="codeblock"><div class="codeblock-head">js</div><pre><code>import {
110
+ FLATSQL_IO_IMPORTS, // the seven &quot;env.flatsql_io_*&quot; keys
111
+ FLATSQL_IO_SIGNATURES, // params/result valtypes, f64 offsets
112
+ HOST_SURFACES, // HOST_SURFACES[&quot;flatsql-engine&quot;]
113
+ } from &quot;space-data-module-sdk/testing&quot;;</code></pre></div>
114
+ <h2 id="what-the-sdk-does-not-do"><a class="anchor" href="#what-the-sdk-does-not-do" aria-hidden="true">#</a>What the SDK does NOT do</h2>
115
+ <p>module-sdk does not link the VFS into its own artifacts, and that is by design: an SDK module exports <strong>zero</strong> <code>flatsql_io_*</code> imports. A module keeps the generic hook set, which rides inside the one sanctioned <code>space_data_module_host</code> bridge; a private import would be a NEW HOST CAPABILITY, and that is an owner decision, never a dependency bump. The SDK consumes flatsql through its <strong>JS API</strong> only (<code>src/runtime-host/flatsqlRuntimeStore.js</code>); flow artifacts receive the live engine from the caller as <code>engineLink</code> (<code>src/flow/flowRuntimeHost.js</code>), so the host that instantiates the engine is the host that supplies the seven imports.</p>
116
+ <h2 id="evidence"><a class="anchor" href="#evidence" aria-hidden="true">#</a>Evidence</h2>
117
+ <p><code>space-data-module parity-gate</code> — the <code>flatsql-standalone</code> artifact resolves through this repo's own dependency, so the gate always classifies the engine a consumer would actually load. At 1.4.4 it reports <code>in-surface (WASI + declared capabilities: 7)</code>, <code>satisfied</code> in the real-browser lane and <code>runner-cannot-supply-declared-capability</code> under the bare WasmEdge CLI, naming <code>env.flatsql_io_open</code> as the single blocker.</p>
118
+ <h2 id="the-200-floor-is-a-licence-change-not-a-port"><a class="anchor" href="#the-200-floor-is-a-licence-change-not-a-port" aria-hidden="true">#</a>The 2.0.0 floor is a licence change, not a port</h2>
119
+ <p><code>flatsql</code> 2.0.0 is 1.4.5's code republished under the <a href="https://polyformproject.org/licenses/noncommercial/1.0.0/">PolyForm Noncommercial License 1.0.0</a>. The major is semver signalling the licence, not an API break. Measured on the two published tarballs, every file is byte-identical except three:</p>
120
+ <div class="codeblock"><pre><code>LICENSE Apache-2.0 -&gt; PolyForm Noncommercial 1.0.0
121
+ package.json &quot;version&quot; and &quot;license&quot; only
122
+ README.md licence + contact section</code></pre></div>
123
+ <p>The host contract above therefore carries over unchanged. On <code>wasm/flatsql-wasi.wasm</code>, 2.0.0 imports the same <strong>13</strong> — the seven <code>flatsql_io_*</code> on <code>env</code> plus six WASI preview1 — and exports the same <strong>102</strong> as 1.4.4, so the parity gate classifies the 2.0.0 engine exactly as it classified 1.4.4.</p>
124
+ <p>Two consequences for anyone reading this floor:</p>
125
+ <ul>
126
+ <li><strong>Every pre-2.0.0 <code>flatsql</code> is withdrawn from npm.</strong> A pin below <code>^2.0.0</code> resolves to nothing. There is no supported lower floor.</li>
127
+ <li><strong>Commercial use of the engine needs a licence</strong> from DigitalArsenal.io, Inc. (<a href="mailto:tj@digitalarsenal.io">tj@digitalarsenal.io</a>). The SDK stays MIT and consumes flatsql through its JS API only, but installing the SDK installs the engine, so the obligation reaches the SDK's consumers.</li>
128
+ </ul>
129
+
130
+ <p class="doc-footer">
131
+ Source of truth for this page:
132
+ <code>docs/flatsql-host-contract.md</code>. Regenerate with
133
+ <code>npm run build:docs</code>.
134
+ </p>
135
+ </main>
136
+ <nav class="rail" aria-label="On this page"><h2>On this page</h2><ul><li><a class="depth-2" href="#the-defect-the-bump-repairs">The defect the bump repairs</a></li>
137
+ <li><a class="depth-2" href="#what-the-bump-costs">What the bump costs</a></li>
138
+ <li><a class="depth-2" href="#the-host-contract-14x-makes-unconditional">The host contract 1.4.x makes unconditional</a></li>
139
+ <li><a class="depth-2" href="#what-the-sdk-does-not-do">What the SDK does NOT do</a></li>
140
+ <li><a class="depth-2" href="#evidence">Evidence</a></li>
141
+ <li><a class="depth-2" href="#the-200-floor-is-a-licence-change-not-a-port">The 2.0.0 floor is a licence change, not a port</a></li></ul></nav>
142
+ </div>
143
+ <section id="stack" class="section" aria-labelledby="stack-title">
144
+ <div class="section-head">
145
+ <p class="eyebrow">SDN Stack</p>
146
+ <h2 id="stack-title">Connected sites</h2>
147
+ </div>
148
+ <div class="link-list">
149
+ <a href="https://spacedatastandards.org/">
150
+ <span>Standards</span>
151
+ <small>Canonical schemas, record contracts, and generated bindings.</small>
152
+ </a>
153
+ <a href="https://digitalarsenal.github.io/flatbuffers/">
154
+ <span>FlatBuffers</span>
155
+ <small>Binary encoding, schema tooling, and runtime documentation.</small>
156
+ </a>
157
+ <a href="https://digitalarsenal.github.io/flatsql/">
158
+ <span>FlatSQL</span>
159
+ <small>SQL-style queries over FlatBuffer-backed datasets and streams.</small>
160
+ </a>
161
+ <a href="https://spacedatanetwork.org/">
162
+ <span>SDN</span>
163
+ <small>Distributed publication, discovery, delivery, and marketplace infrastructure.</small>
164
+ </a>
165
+ <a href="https://digitalarsenal.github.io/space-data-module-sdk/" class="active">
166
+ <span>Module SDK</span>
167
+ <small>WASM module packaging, validation, and host compatibility tooling.</small>
168
+ </a>
169
+ </div>
170
+ </section>
171
+ <footer class="site-footer">
172
+ Space Data Module SDK — Apache-2.0. Every ABI page renders a Markdown
173
+ source in <code>docs/</code>; edit the Markdown, never the HTML.
174
+ </footer>
175
+ </body>
176
+ </html>
@@ -0,0 +1,375 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="description" content="This document defines the recommended standard for getting streamed" />
7
+ <title>FlatSQL streaming standard — Space Data Module SDK</title>
8
+ <link rel="stylesheet" href="./styles.css" />
9
+ <!-- SDN_CONSUMER_ASSETS_START -->
10
+ <link rel="stylesheet" href="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-public-client.c3f68d1cfd88478f10d836a5e829d1dfc6a10157972cf0f7d4d319d0636f2cc4.css" integrity="sha384-fICuhN4I9xqOK1F5vGGzl26opuO+xQIvTZXMSV76lWTBiQ6AfzztMGLLDw8yRT8i" crossorigin="anonymous">
11
+ <script defer src="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-public-client.f611e7e151a3b5c38384272f8894a4c6634f0a29bf925b0e02e0e27f8db0bfff.js" integrity="sha384-R+QqsKoWJIS7iWrtPmgJ49DVnb1hSGjZokupbLInJd1PLp8RwQhtF/hnaerc33ci" crossorigin="anonymous" data-sdn-wallet-public-client="v1"></script>
12
+ <script defer src="https://static.spacedatanetwork.org/assets/sdn-stack-nav/1.0.0/sdn-stack-nav.52fde607eee38ffa116188201f50258ed50bd18c9f06c1af9678f763147a8fe5.js" integrity="sha384-dgeojhJ8vTszHXIbv7O7nZcEzqD10oUYYJjBmPrV7+kLQEUlXLQD4ek5Q7HOFiO5" crossorigin="anonymous" data-nav-style-url="https://static.spacedatanetwork.org/assets/sdn-stack-nav/1.0.0/sdn-stack-nav.36a36359ce18322185e9ff179f88175bab67d5ad84a14d9c08a54f2ff27267e7.css" data-nav-style-integrity="sha384-c4M8Fg+kYaeOYYtJVr7jJsde24IhSWkWaRyAOHEZU9jozhRck089aw+mnHwxymds" data-wallet-client-url="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-public-client.f611e7e151a3b5c38384272f8894a4c6634f0a29bf925b0e02e0e27f8db0bfff.js" data-wallet-client-integrity="sha384-R+QqsKoWJIS7iWrtPmgJ49DVnb1hSGjZokupbLInJd1PLp8RwQhtF/hnaerc33ci" data-wallet-style-url="https://static.spacedatanetwork.org/assets/hd-wallet-ui/2.0.28/sdn-wallet-public-client.c3f68d1cfd88478f10d836a5e829d1dfc6a10157972cf0f7d4d319d0636f2cc4.css" data-wallet-style-integrity="sha384-fICuhN4I9xqOK1F5vGGzl26opuO+xQIvTZXMSV76lWTBiQ6AfzztMGLLDw8yRT8i" data-wallet-client-id="sdn-module-sdk-pages-v1" data-wallet-callback-uri="https://digitalarsenal.github.io/space-data-module-sdk/wallet-callback.html" data-wallet-registry-sha256="e1ce6fe903c9700484a8a87d96581c8cad97063dabf63030b4518a31a3bdaa93"></script>
13
+ <!-- SDN_CONSUMER_ASSETS_END -->
14
+ </head>
15
+ <body>
16
+ <a class="skip-link" href="#main">Skip to content</a>
17
+ <sdn-stack-nav active="module-sdk"></sdn-stack-nav>
18
+ <header class="site-header">
19
+ <a class="site-brand" href="./">Space Data Module SDK</a>
20
+ <nav class="header-links" aria-label="Site">
21
+ <a href="./byo-wasm-quickstart.html">Quickstart</a>
22
+ <a href="./conformance.html">Conformance</a>
23
+ <a href="https://github.com/DigitalArsenal/space-data-module-sdk">GitHub</a>
24
+ <a class="stack-button" href="#stack">Stack</a>
25
+ </nav>
26
+ </header>
27
+ <div class="shell">
28
+ <nav class="sidebar" id="sidebar" aria-label="Documentation">
29
+ <h2>Start here</h2><ul>
30
+ <li><a href="./index.html"><span>Harness family matrix</span></a></li>
31
+ <li><a href="./byo-wasm-quickstart.html"><span>BYO-wasm quickstart</span></a></li>
32
+ <li><a href="./conformance.html"><span>Conformance kit</span></a></li>
33
+ <li><a href="./protect-and-sign.html"><span>Protect and sign</span></a></li>
34
+ <li><a href="./publication-submission.html"><span>Publication and listing</span></a></li>
35
+ </ul>
36
+ <h2>Dynamics</h2><ul>
37
+ <li><a href="./families/propagator.html"><span>Propagator</span><span class="tag tag-shipped">shipped</span></a></li>
38
+ <li><a href="./families/maneuver.html"><span>Maneuver</span><span class="tag tag-experimental">experimental</span></a></li>
39
+ <li><a href="./families/propulsion.html"><span>Propulsion</span><span class="tag tag-planned">planned</span></a></li>
40
+ <li><a href="./families/attitude.html"><span>Attitude</span><span class="tag tag-planned">planned</span></a></li>
41
+ <li><a href="./families/gnc.html"><span>GNC</span><span class="tag tag-planned">planned</span></a></li>
42
+ </ul>
43
+ <h2>Environment and interaction</h2><ul>
44
+ <li><a href="./families/rf.html"><span>RF</span><span class="tag tag-designed">designed</span></a></li>
45
+ <li><a href="./families/sensor.html"><span>Sensor</span><span class="tag tag-planned">planned</span></a></li>
46
+ <li><a href="./families/signature.html"><span>Signature</span><span class="tag tag-planned">planned</span></a></li>
47
+ <li><a href="./families/environment.html"><span>Environment</span><span class="tag tag-planned">planned</span></a></li>
48
+ <li><a href="./families/obstruction.html"><span>Obstruction</span><span class="tag tag-designed">designed</span></a></li>
49
+ </ul>
50
+ <h2>Event physics</h2><ul>
51
+ <li><a href="./families/breakup.html"><span>Breakup</span><span class="tag tag-planned">planned</span></a></li>
52
+ <li><a href="./families/reentry.html"><span>Reentry</span><span class="tag tag-planned">planned</span></a></li>
53
+ <li><a href="./families/conjunction.html"><span>Conjunction</span><span class="tag tag-designed">designed</span></a></li>
54
+ <li><a href="./families/effects.html"><span>Effects</span><span class="tag tag-planned">planned</span></a></li>
55
+ </ul>
56
+ <h2>Estimation, data and logic</h2><ul>
57
+ <li><a href="./families/estimation.html"><span>Estimation</span><span class="tag tag-experimental">experimental</span></a></li>
58
+ <li><a href="./families/data-source.html"><span>Data source</span><span class="tag tag-shipped">shipped</span></a></li>
59
+ <li><a href="./families/analytics.html"><span>Analytics</span><span class="tag tag-experimental">experimental</span></a></li>
60
+ <li><a href="./families/scheduler.html"><span>Scheduler</span><span class="tag tag-planned">planned</span></a></li>
61
+ <li><a href="./families/behavior.html"><span>Behavior</span><span class="tag tag-planned">planned</span></a></li>
62
+ </ul>
63
+ <h2>Runtime contract</h2><ul>
64
+ <li><a href="./events-abi.html"><span>Event locator ABI</span></a></li>
65
+ <li><a href="./module-publication-standard.html"><span>Module publication standard</span></a></li>
66
+ <li><a href="./browser-wasmedge-isomorphic.html"><span>Browser / WasmEdge isomorphism</span></a></li>
67
+ <li><a href="./isomorphic-pthreads.html"><span>Isomorphic pthreads</span></a></li>
68
+ <li><a href="./tri-runtime-parity.html"><span>Tri-runtime parity</span></a></li>
69
+ <li><a href="./tri-runtime-parity-gate.html"><span>Tri-runtime parity gate</span></a></li>
70
+ <li><a href="./testing-harness.html"><span>Testing harness</span></a></li>
71
+ <li><a href="./language-runtime-matrix.html"><span>Language and runtime matrix</span></a></li>
72
+ </ul>
73
+ <h2>Host surfaces</h2><ul>
74
+ <li><a href="./flatsql-host-contract.html"><span>FlatSQL host contract</span></a></li>
75
+ <li><a href="./flatsql-streaming-standard.html" aria-current="page"><span>FlatSQL streaming standard</span></a></li>
76
+ <li><a href="./secrets-capability.html"><span>Credential lanes</span></a></li>
77
+ <li><a href="./protocol-installation.html"><span>Protocol installation</span></a></li>
78
+ <li><a href="./gpu-module-abi.html"><span>GPU module ABI</span></a></li>
79
+ <li><a href="./module-bundle-runtime-plan.html"><span>Module bundle runtime</span></a></li>
80
+ <li><a href="./isomorphic-sdn-runtime-plan.html"><span>Isomorphic SDN runtime</span></a></li>
81
+ <li><a href="./node-red-default-node-parity.html"><span>Node-RED node parity</span></a></li>
82
+ </ul>
83
+ </nav>
84
+ <main class="doc" id="main">
85
+ <h1>FlatSQL streaming standard</h1>
86
+ <p>This document defines the recommended standard for getting streamed FlatBuffer payloads into FlatSQL-backed storage while keeping the same model portable across browser, server, OrbPro, and WasmEdge.</p>
87
+ <h2 id="short-version"><a class="anchor" href="#short-version" aria-hidden="true">#</a>Short Version</h2>
88
+ <p>Use three layers, not one:</p>
89
+ <ol>
90
+ <li>Transport stream: little-endian <code>u32</code> size prefix + one FlatBuffer payload per frame</li>
91
+ <li>Module invoke ABI: SDS <code>$PIV</code> request/response envelopes with <code>TAB</code> frame descriptors</li>
92
+ <li>Durable storage identity: host-owned append-only row handles and host-owned runtime regions</li>
93
+ </ol>
94
+ <p>Do not treat a module-owned mutable FlatSQL database as the canonical ABI. That can exist as an adapter or example, but it is not the durable cross-host contract.</p>
95
+ <h2 id="canonical-transport"><a class="anchor" href="#canonical-transport" aria-hidden="true">#</a>Canonical Transport</h2>
96
+ <p>The canonical transport for streamed FlatBuffers is:</p>
97
+ <ul>
98
+ <li><code>4-byte little-endian payload length</code></li>
99
+ <li>followed by one FlatBuffer payload</li>
100
+ <li>repeated until end of stream</li>
101
+ <li>payload bytes stay binary end-to-end; the canonical ingest path does not transcode frames through JSON</li>
102
+ </ul>
103
+ <p>Each payload must carry a readable FlatBuffer file identifier. The runtime uses that identifier to derive the durable <code>schemaFileId</code>.</p>
104
+ <p>This transport is intentionally separate from module invocation. It is the right shape for:</p>
105
+ <ul>
106
+ <li>WebSocket feeds</li>
107
+ <li>HTTP chunk/file ingestion</li>
108
+ <li>local file replay</li>
109
+ <li>browser worker or server-side stream processing</li>
110
+ </ul>
111
+ <p>It is not the same thing as a SDS <code>$PIV</code> invoke envelope.</p>
112
+ <h2 id="canonical-durable-storage"><a class="anchor" href="#canonical-durable-storage" aria-hidden="true">#</a>Canonical Durable Storage</h2>
113
+ <p>The durable storage model is host-owned.</p>
114
+ <p>Standards records are addressed by:</p>
115
+ <ul>
116
+ <li><code>($SCHEMA_FILE_ID, rowId)</code></li>
117
+ </ul>
118
+ <p>Rules:</p>
119
+ <ul>
120
+ <li><code>rowId</code> is append-only</li>
121
+ <li><code>rowId</code> is never reused</li>
122
+ <li>logical updates create new rows</li>
123
+ <li>&quot;latest&quot; or &quot;upsert&quot; views are host-side projections or indexes</li>
124
+ <li>row payloads remain raw binary or native in-memory values; the canonical runtime-host row path does not stringify payloads</li>
125
+ </ul>
126
+ <p>High-performance derived runtime state is addressed by:</p>
127
+ <ul>
128
+ <li><code>(regionId, recordIndex)</code></li>
129
+ </ul>
130
+ <p>Rules:</p>
131
+ <ul>
132
+ <li>the host allocates or registers regions</li>
133
+ <li>regions are fixed-layout aligned-binary buffers</li>
134
+ <li>regions are not indexed in FlatSQL</li>
135
+ <li>raw pointers remain internal execution details only</li>
136
+ </ul>
137
+ <p>The stable storage ABI lives in <code>schemas/HostStorageAbi.fbs</code>.</p>
138
+ <h2 id="canonical-module-abi"><a class="anchor" href="#canonical-module-abi" aria-hidden="true">#</a>Canonical Module ABI</h2>
139
+ <p>When streamed payloads must cross into a module, use the invoke ABI:</p>
140
+ <ul>
141
+ <li>SDS <code>$PIV</code> <code>REQUEST</code></li>
142
+ <li>SDS <code>$PIV</code> <code>RESPONSE</code></li>
143
+ <li>SDS <code>TAB</code> frame descriptors</li>
144
+ </ul>
145
+ <p>Each input frame should preserve:</p>
146
+ <ul>
147
+ <li><code>portId</code></li>
148
+ <li><code>typeRef</code></li>
149
+ <li><code>streamId</code></li>
150
+ <li><code>sequence</code></li>
151
+ <li><code>endOfStream</code></li>
152
+ <li>alignment metadata when required</li>
153
+ </ul>
154
+ <p>This is the correct way to tell a module &quot;these frames belong to the same logical stream.&quot;</p>
155
+ <p>It is not a byte-streaming transport. The current invoke ABI is still buffer-oriented:</p>
156
+ <ul>
157
+ <li>the full request is materialized before <code>plugin_invoke_stream(...)</code></li>
158
+ <li>the full response is materialized before it is returned</li>
159
+ </ul>
160
+ <p>So a single 1 GiB SDS <code>$PIV</code> invoke request is not the intended path.</p>
161
+ <h2 id="flatsql-specific-rules"><a class="anchor" href="#flatsql-specific-rules" aria-hidden="true">#</a>FlatSQL-Specific Rules</h2>
162
+ <p>If the goal is &quot;stream FlatBuffers into FlatSQL&quot;, standardize the host-side behavior first:</p>
163
+ <ol>
164
+ <li>split the outer size-prefixed transport stream into payload frames</li>
165
+ <li>derive <code>schemaFileId</code> from the FlatBuffer file identifier</li>
166
+ <li>append immutable host-owned rows</li>
167
+ <li>maintain host-side logical indexes or latest-record projections as needed</li>
168
+ <li>expose query and row-resolution APIs on top of that store</li>
169
+ </ol>
170
+ <p>That means the durable primitive is <code>append</code>, not <code>upsert</code>.</p>
171
+ <p><code>upsert_records</code> is allowed as a higher-level adapter surface, but only if it is defined as:</p>
172
+ <ul>
173
+ <li>append new immutable row(s)</li>
174
+ <li>update a logical index/view</li>
175
+ <li>never rewrite an existing durable <code>rowId</code></li>
176
+ </ul>
177
+ <p>If a module or flow needs fast numeric state, keep that data in runtime regions, not in FlatSQL tables.</p>
178
+ <h2 id="browser-and-wasmedge"><a class="anchor" href="#browser-and-wasmedge" aria-hidden="true">#</a>Browser and WasmEdge</h2>
179
+ <p>The same transport/storage model should be used in both:</p>
180
+ <ul>
181
+ <li>browser: host-side stream ingest + host-owned rows/regions</li>
182
+ <li>WasmEdge: host-side stream ingest + host-owned rows/regions</li>
183
+ </ul>
184
+ <p>Use module invocation for:</p>
185
+ <ul>
186
+ <li>compute batches</li>
187
+ <li>typed transformation steps</li>
188
+ <li>stateful direct-surface module sessions</li>
189
+ </ul>
190
+ <p>Use host-side stream ingest for:</p>
191
+ <ul>
192
+ <li>large continuous feeds</li>
193
+ <li>catalog replay</li>
194
+ <li>ingestion into host-owned FlatSQL-backed stores</li>
195
+ <li>any workload that should not be forced through one contiguous invoke buffer</li>
196
+ </ul>
197
+ <p>The new helper for this outer transport path is <code>createFlatBufferStreamIngestor(...)</code>, exported from <code>space-data-module-sdk/runtime-host</code>.</p>
198
+ <h2 id="streaming-into-a-module-owned-flatsql-engine"><a class="anchor" href="#streaming-into-a-module-owned-flatsql-engine" aria-hidden="true">#</a>Streaming Into A Module-Owned FlatSQL Engine</h2>
199
+ <p>If the goal is not a host-owned durable store, but a stateful SDN module that imports <code>flatsql</code> internally and owns its own in-memory query state, use a persistent direct-surface module instance plus chunked binary invokes.</p>
200
+ <p>Rules:</p>
201
+ <ul>
202
+ <li>do not change <code>flatsql</code> itself</li>
203
+ <li>import <code>flatsql</code> inside the SDN module implementation</li>
204
+ <li>keep the module instance resident across invokes</li>
205
+ <li>feed it many small FlatBuffer frames, not one giant invoke envelope</li>
206
+ <li>use command surface only for stateless one-shot work; use direct surface for resident FlatSQL state</li>
207
+ </ul>
208
+ <p>The SDK helper for this path is <code>createModuleFlatBufferStreamPump(...)</code>, exported from <code>space-data-module-sdk/testing</code> and the browser/root package surfaces.</p>
209
+ <p>That helper:</p>
210
+ <ul>
211
+ <li>accepts the same outer size-prefixed FlatBuffer stream chunks</li>
212
+ <li>decodes frames incrementally</li>
213
+ <li>emits small SDS <code>$PIV</code> request batches into a live module instance</li>
214
+ <li>preserves <code>streamId</code>, <code>sequence</code>, and final <code>endOfStream</code></li>
215
+ <li>never routes payloads through JSON</li>
216
+ </ul>
217
+ <p>Example:</p>
218
+ <div class="codeblock"><div class="codeblock-head">js</div><pre><code>import {
219
+ createBrowserModuleHarness,
220
+ createModuleFlatBufferStreamPump,
221
+ } from &quot;space-data-module-sdk&quot;;
222
+
223
+ const harness = await createBrowserModuleHarness({
224
+ wasmSource,
225
+ surface: &quot;direct&quot;,
226
+ });
227
+
228
+ const pump = createModuleFlatBufferStreamPump({
229
+ harness,
230
+ methodId: &quot;upsert_records&quot;,
231
+ portId: &quot;records&quot;,
232
+ maxFramesPerInvoke: 64,
233
+ typeResolver(_payload, context) {
234
+ return {
235
+ acceptsAnyFlatbuffer: true,
236
+ fileIdentifier: context.rawFileIdentifier,
237
+ };
238
+ },
239
+ });
240
+
241
+ await pump.pushBytes(chunkA);
242
+ await pump.pushBytes(chunkB);
243
+ await pump.finish();</code></pre></div>
244
+ <p>This is the right shape for OrbPro-style browser ingest when:</p>
245
+ <ul>
246
+ <li>the raw FlatBuffer payloads are the source of truth</li>
247
+ <li>the UI/runtime should not materialize JS record mirrors</li>
248
+ <li>a resident module should own FlatSQL/query state directly</li>
249
+ </ul>
250
+ <p>It is still batch-oriented per invoke, but it removes the architectural anti-pattern of building one monolithic request envelope for a long-running stream.</p>
251
+ <h2 id="example-import-path"><a class="anchor" href="#example-import-path" aria-hidden="true">#</a>Example Import Path</h2>
252
+ <div class="codeblock"><div class="codeblock-head">js</div><pre><code>import {
253
+ createFlatBufferStreamIngestor,
254
+ createRuntimeHost,
255
+ } from &quot;space-data-module-sdk/runtime-host&quot;;
256
+
257
+ const host = createRuntimeHost();
258
+ const ingestor = createFlatBufferStreamIngestor({
259
+ rows: host.rows,
260
+ });
261
+
262
+ ingestor.pushBytes(chunkA);
263
+ ingestor.pushBytes(chunkB);
264
+ ingestor.finish();
265
+
266
+ const rows = host.rows.listRows(&quot;OMM&quot;);</code></pre></div>
267
+ <h2 id="performance-guidance"><a class="anchor" href="#performance-guidance" aria-hidden="true">#</a>Performance Guidance</h2>
268
+ <p>There are two distinct performance questions:</p>
269
+ <ol>
270
+ <li>Outer transport ingest throughput</li>
271
+ <li>Module invoke throughput</li>
272
+ </ol>
273
+ <p>Do not mix them into one benchmark.</p>
274
+ <h3 id="outer-transport-benchmark"><a class="anchor" href="#outer-transport-benchmark" aria-hidden="true">#</a>Outer Transport Benchmark</h3>
275
+ <p>Use the runtime-host stream ingestor.</p>
276
+ <p>Commands:</p>
277
+ <div class="codeblock"><div class="codeblock-head">bash</div><pre><code>npm run test:stream-ingest
278
+ npm run benchmark:stream-1gib</code></pre></div>
279
+ <p>Optional tuning:</p>
280
+ <ul>
281
+ <li><code>SPACE_DATA_MODULE_SDK_STREAM_BENCH_BYTES</code></li>
282
+ <li><code>SPACE_DATA_MODULE_SDK_STREAM_BENCH_PAYLOAD_BYTES</code></li>
283
+ <li><code>SPACE_DATA_MODULE_SDK_STREAM_BENCH_CHUNK_BYTES</code></li>
284
+ </ul>
285
+ <p>The 1 GiB benchmark is env-gated on purpose. It is a local stress path, not a default suite member.</p>
286
+ <h3 id="module-invoke-benchmark"><a class="anchor" href="#module-invoke-benchmark" aria-hidden="true">#</a>Module Invoke Benchmark</h3>
287
+ <p>Benchmark direct invoke separately with many smaller requests and a tiny response. Treat the current invoke ABI as batch-oriented, not as a raw stream transport.</p>
288
+ <p>Recommended total sizes:</p>
289
+ <ul>
290
+ <li>CI / regular local: <code>1 MiB</code>, <code>8 MiB</code>, <code>32 MiB</code>, <code>128 MiB</code></li>
291
+ <li>local stress: <code>256 MiB</code> or higher in chunked totals</li>
292
+ </ul>
293
+ <p>Avoid a single 1 GiB request envelope on the current codepath.</p>
294
+ <p>For the resident module-ingest shape, use:</p>
295
+ <div class="codeblock"><div class="codeblock-head">bash</div><pre><code>npm run test:module-stream
296
+ npm run benchmark:module-stream-1gib</code></pre></div>
297
+ <p>That benchmark exercises the chunked module stream-pump path, not a single huge invoke buffer.</p>
298
+ <h2 id="current-non-canonical-example"><a class="anchor" href="#current-non-canonical-example" aria-hidden="true">#</a>Current Non-Canonical Example</h2>
299
+ <p><code>examples/flatsql-store-local</code> is still useful as an adapter example, but it is not the canonical durable identity model. It exposes a module-owned mutable logical database. The canonical model for cross-host durability is host-owned rows plus host-owned runtime regions.</p>
300
+ <h2 id="body-reference-delivery-deliverref"><a class="anchor" href="#body-reference-delivery-deliverref" aria-hidden="true">#</a>Body-Reference Delivery (<code>&quot;deliver&quot;:&quot;ref&quot;</code>)</h2>
301
+ <p>Loop C.5c adds an OPTIONAL near-zero-copy egress mode for capability hostcalls whose result is an aligned stream that the module passes through VERBATIM to an HTTP response body (the retrieval flow's flatbuffer branch). The election is always the GUEST's; hosts never invent it.</p>
302
+ <ol>
303
+ <li>The module adds <code>&quot;deliver&quot;:&quot;ref&quot;</code> to the hostcall payload (<code>storage.flatsql_query_stream</code> / <code>storage.flatsql_epoch_stream</code>).</li>
304
+ <li>A ref-capable host keeps the materialized bytes in ITS memory, registers them on the calling instance's hostcall-bridge body-ref registry, and answers with NO binary segment:</li>
305
+ </ol>
306
+ <div class="codeblock"><div class="codeblock-head">json</div><pre><code> {&quot;ok&quot;:true,&quot;result&quot;:{&quot;rows&quot;:N,&quot;columns&quot;:M,
307
+ &quot;ref&quot;:{&quot;token&quot;:T,&quot;size&quot;:S,&quot;frames&quot;:F,&quot;fnv1a64&quot;:&quot;&lt;16 hex&gt;&quot;}}}</code></pre></div>
308
+ <ul>
309
+ <li><code>token</code> — opaque, single-use, scoped to this module instance's bridge and the current exchange.</li>
310
+ <li><code>size</code> — byte length of the referenced stream.</li>
311
+ <li><code>frames</code> — size-prefixed frame count, skipping zero-length prefixes (the <code>x-sdn-record-count</code> rule); omitted when the framing is malformed.</li>
312
+ <li><code>fnv1a64</code> — word-folded FNV-1a 64 content hash (<code>fnv1a64Hex</code> in <code>space-data-module-sdk/http</code> is the reference implementation; it is bit-identical to foundation/decision-gate's in-wasm hasher, so reference-mode entity tags equal hashed-stream entity tags).</li>
313
+ </ul>
314
+ <p>A host that does not understand <code>deliver</code> simply returns the byte segment as always; modules MUST fall back to verbatim byte passthrough.</p>
315
+ <ol>
316
+ <li>The module forwards the reference in-band as a small JSON descriptor frame <code>{&quot;$sdnbodyref&quot;:1,&quot;token&quot;:T,&quot;size&quot;:S,&quot;frames&quot;:F,&quot;fnv1a64&quot;:&quot;…&quot;}</code> (an aligned stream can never collide: it starts with a <code>u32le</code> size prefix, not <code>{</code>).</li>
317
+ <li><code>foundation/http-respond</code> recognizes the descriptor on its body port and emits <code>$HTR</code> with <code>BODY_REF_TOKEN</code>/<code>BODY_REF_SIZE</code> set and NO inline body (schema <code>HttpResponseAbi.fbs</code>).</li>
318
+ <li>The host egress substitutes the byte buffer registered under the token (Go: <code>flowrt.htrPipe</code> + <code>modulert.HostBridge.TakeBodyRef</code>; JS: <code>createBodyRefRegistry</code> from <code>space-data-module-sdk/http</code>). Tokens are single-use; hosts drop unconsumed references at end-of-exchange (304 and error paths never consume theirs).</li>
319
+ </ol>
320
+ <p>The stream bytes therefore never enter the flow's linear memory: the only byte movement left on a warm request is the host's socket write.</p>
321
+
322
+ <p class="doc-footer">
323
+ Source of truth for this page:
324
+ <code>docs/flatsql-streaming-standard.md</code>. Regenerate with
325
+ <code>npm run build:docs</code>.
326
+ </p>
327
+ </main>
328
+ <nav class="rail" aria-label="On this page"><h2>On this page</h2><ul><li><a class="depth-2" href="#short-version">Short Version</a></li>
329
+ <li><a class="depth-2" href="#canonical-transport">Canonical Transport</a></li>
330
+ <li><a class="depth-2" href="#canonical-durable-storage">Canonical Durable Storage</a></li>
331
+ <li><a class="depth-2" href="#canonical-module-abi">Canonical Module ABI</a></li>
332
+ <li><a class="depth-2" href="#flatsql-specific-rules">FlatSQL-Specific Rules</a></li>
333
+ <li><a class="depth-2" href="#browser-and-wasmedge">Browser and WasmEdge</a></li>
334
+ <li><a class="depth-2" href="#streaming-into-a-module-owned-flatsql-engine">Streaming Into A Module-Owned FlatSQL Engine</a></li>
335
+ <li><a class="depth-2" href="#example-import-path">Example Import Path</a></li>
336
+ <li><a class="depth-2" href="#performance-guidance">Performance Guidance</a></li>
337
+ <li><a class="depth-3" href="#outer-transport-benchmark">Outer Transport Benchmark</a></li>
338
+ <li><a class="depth-3" href="#module-invoke-benchmark">Module Invoke Benchmark</a></li>
339
+ <li><a class="depth-2" href="#current-non-canonical-example">Current Non-Canonical Example</a></li>
340
+ <li><a class="depth-2" href="#body-reference-delivery-deliverref">Body-Reference Delivery (<code>&quot;deliver&quot;:&quot;ref&quot;</code>)</a></li></ul></nav>
341
+ </div>
342
+ <section id="stack" class="section" aria-labelledby="stack-title">
343
+ <div class="section-head">
344
+ <p class="eyebrow">SDN Stack</p>
345
+ <h2 id="stack-title">Connected sites</h2>
346
+ </div>
347
+ <div class="link-list">
348
+ <a href="https://spacedatastandards.org/">
349
+ <span>Standards</span>
350
+ <small>Canonical schemas, record contracts, and generated bindings.</small>
351
+ </a>
352
+ <a href="https://digitalarsenal.github.io/flatbuffers/">
353
+ <span>FlatBuffers</span>
354
+ <small>Binary encoding, schema tooling, and runtime documentation.</small>
355
+ </a>
356
+ <a href="https://digitalarsenal.github.io/flatsql/">
357
+ <span>FlatSQL</span>
358
+ <small>SQL-style queries over FlatBuffer-backed datasets and streams.</small>
359
+ </a>
360
+ <a href="https://spacedatanetwork.org/">
361
+ <span>SDN</span>
362
+ <small>Distributed publication, discovery, delivery, and marketplace infrastructure.</small>
363
+ </a>
364
+ <a href="https://digitalarsenal.github.io/space-data-module-sdk/" class="active">
365
+ <span>Module SDK</span>
366
+ <small>WASM module packaging, validation, and host compatibility tooling.</small>
367
+ </a>
368
+ </div>
369
+ </section>
370
+ <footer class="site-footer">
371
+ Space Data Module SDK — Apache-2.0. Every ABI page renders a Markdown
372
+ source in <code>docs/</code>; edit the Markdown, never the HTML.
373
+ </footer>
374
+ </body>
375
+ </html>