space-data-module-sdk 0.6.0 → 0.7.0

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 (70) hide show
  1. package/README.md +15 -2
  2. package/package.json +6 -2
  3. package/schemas/orbpro/BaseTypes.fbs +7 -0
  4. package/schemas/orbpro/CatalogQueryBase.fbs +8 -0
  5. package/schemas/orbpro/CatalogQueryRequest.fbs +14 -0
  6. package/schemas/orbpro/CatalogQueryResult.fbs +17 -0
  7. package/schemas/orbpro/EntityMetadata.fbs +53 -0
  8. package/schemas/orbpro/EntityStandardsLink.fbs +18 -0
  9. package/schemas/orbpro/Plugin.fbs +8 -0
  10. package/schemas/orbpro/Propagator.fbs +89 -0
  11. package/schemas/orbpro/StandardsRecordIndex.fbs +15 -0
  12. package/src/browser.js +1 -0
  13. package/src/generated/orbpro/entity/entity-kind.js +15 -0
  14. package/src/generated/orbpro/entity/entity-kind.ts +15 -0
  15. package/src/generated/orbpro/entity/entity-metadata.js +322 -0
  16. package/src/generated/orbpro/entity/entity-metadata.ts +426 -0
  17. package/src/generated/orbpro/entity/entity-standards-link.js +143 -0
  18. package/src/generated/orbpro/entity/entity-standards-link.ts +183 -0
  19. package/src/generated/orbpro/entity/standards-record-index.js +115 -0
  20. package/src/generated/orbpro/entity/standards-record-index.ts +147 -0
  21. package/src/generated/orbpro/entity.js +10 -0
  22. package/src/generated/orbpro/entity.ts +5 -0
  23. package/src/generated/orbpro/plugin/raw-data-payload.js +79 -0
  24. package/src/generated/orbpro/plugin/raw-data-payload.ts +92 -0
  25. package/src/generated/orbpro/plugin.js +4 -0
  26. package/src/generated/orbpro/plugin.ts +5 -0
  27. package/src/generated/orbpro/propagator/propagator-describe-sources-batch-request.js +79 -0
  28. package/src/generated/orbpro/propagator/propagator-describe-sources-batch-request.ts +95 -0
  29. package/src/generated/orbpro/propagator/propagator-describe-sources-batch-result.js +70 -0
  30. package/src/generated/orbpro/propagator/propagator-describe-sources-batch-result.ts +78 -0
  31. package/src/generated/orbpro/propagator/propagator-sample-trajectory-states-request.js +97 -0
  32. package/src/generated/orbpro/propagator/propagator-sample-trajectory-states-request.ts +117 -0
  33. package/src/generated/orbpro/propagator/propagator-sample-trajectory-states-result.js +140 -0
  34. package/src/generated/orbpro/propagator/propagator-sample-trajectory-states-result.ts +175 -0
  35. package/src/generated/orbpro/propagator/propagator-source-description.js +208 -0
  36. package/src/generated/orbpro/propagator/propagator-source-description.ts +257 -0
  37. package/src/generated/orbpro/propagator/propagator-source-kind.js +8 -0
  38. package/src/generated/orbpro/propagator/propagator-source-kind.ts +8 -0
  39. package/src/generated/orbpro/propagator/reference-frame.js +12 -0
  40. package/src/generated/orbpro/propagator/reference-frame.ts +12 -0
  41. package/src/generated/orbpro/propagator/state-flags.js +13 -0
  42. package/src/generated/orbpro/propagator/state-flags.ts +13 -0
  43. package/src/generated/orbpro/propagator/state-vector.js +55 -0
  44. package/src/generated/orbpro/propagator/state-vector.ts +61 -0
  45. package/src/generated/orbpro/propagator.js +20 -0
  46. package/src/generated/orbpro/propagator.ts +13 -0
  47. package/src/generated/orbpro/query/catalog-query-kind.js +10 -0
  48. package/src/generated/orbpro/query/catalog-query-kind.ts +10 -0
  49. package/src/generated/orbpro/query/catalog-query-request.js +89 -0
  50. package/src/generated/orbpro/query/catalog-query-request.ts +105 -0
  51. package/src/generated/orbpro/query/catalog-query-result.js +145 -0
  52. package/src/generated/orbpro/query/catalog-query-result.ts +179 -0
  53. package/src/generated/orbpro/query.js +8 -0
  54. package/src/generated/orbpro/query.ts +4 -0
  55. package/src/generated/orbpro/vec3.js +39 -0
  56. package/src/generated/orbpro/vec3.ts +40 -0
  57. package/src/host/abi.js +158 -0
  58. package/src/host/browserEdgeShims.js +17 -4
  59. package/src/host/browserHost.js +260 -48
  60. package/src/host/isomorphicLoader.js +3 -2
  61. package/src/host/nodeHost.js +168 -71
  62. package/src/index.d.ts +287 -3
  63. package/src/index.js +1 -0
  64. package/src/licensing/index.d.ts +20 -0
  65. package/src/licensing/index.js +11 -0
  66. package/src/licensing/records.js +858 -0
  67. package/src/runtime-host/index.js +34 -0
  68. package/src/testing/browserModuleHarness.js +16 -3
  69. package/src/testing/index.d.ts +1 -0
  70. package/src/testing/index.js +5 -4
@@ -23,6 +23,28 @@ function createCapabilityRegistry(capabilities = {}) {
23
23
  return registry;
24
24
  }
25
25
 
26
+ function listCapabilityOperations(capabilities) {
27
+ const operations = new Set();
28
+ for (const [capabilityId, adapter] of capabilities.entries()) {
29
+ if (!adapter || typeof adapter !== "object") {
30
+ continue;
31
+ }
32
+ const methodIds = Object.keys(adapter).filter(
33
+ (methodId) => typeof adapter[methodId] === "function" && methodId !== "invoke",
34
+ );
35
+ if (methodIds.length > 0) {
36
+ for (const methodId of methodIds) {
37
+ operations.add(`${capabilityId}.${methodId}`);
38
+ }
39
+ continue;
40
+ }
41
+ if (typeof adapter.invoke === "function") {
42
+ operations.add(`${capabilityId}.invoke`);
43
+ }
44
+ }
45
+ return Array.from(operations).sort();
46
+ }
47
+
26
48
  export function createRuntimeHost(options = {}) {
27
49
  const rows = options.rows ?? createFlatSqlRuntimeStore();
28
50
  const regions = options.regions ?? createRuntimeRegionStore();
@@ -36,6 +58,15 @@ export function createRuntimeHost(options = {}) {
36
58
  listCapabilities() {
37
59
  return Array.from(capabilities.keys()).sort();
38
60
  },
61
+ listSupportedCapabilities() {
62
+ return Array.from(capabilities.keys()).sort();
63
+ },
64
+ listOperations() {
65
+ return listCapabilityOperations(capabilities);
66
+ },
67
+ hasCapability(capability) {
68
+ return capabilities.has(normalizeCapabilityId(capability));
69
+ },
39
70
  getCapability(capability) {
40
71
  return capabilities.get(normalizeCapabilityId(capability)) ?? null;
41
72
  },
@@ -68,6 +99,9 @@ export function createRuntimeHost(options = {}) {
68
99
  `Runtime host capability "${capabilityId}" does not implement "${methodId}" or invoke().`,
69
100
  );
70
101
  },
102
+ async invoke(operation, params = {}) {
103
+ return this.invokeCapability(operation, params);
104
+ },
71
105
  };
72
106
  }
73
107
 
@@ -14,10 +14,11 @@
14
14
 
15
15
  import { createBrowserWasiShim, WasiExitError } from "../host/wasiShim.js";
16
16
  import { createBrowserHost } from "../host/browserHost.js";
17
+ import { getWasmWallet } from "../utils/wasmCrypto.js";
17
18
  import {
18
19
  createJsonHostcallBridge,
20
+ createAsyncHostDispatcher,
19
21
  createHostSyncDispatcher,
20
- dispatchHostOperation,
21
22
  DEFAULT_HOSTCALL_IMPORT_MODULE,
22
23
  } from "../host/abi.js";
23
24
  import {
@@ -126,8 +127,20 @@ async function instantiateBrowserModule(options = {}) {
126
127
  * @param {string} [options.surface] - "direct" or "command" (default: auto-detect).
127
128
  */
128
129
  export async function createBrowserModuleHarness(options = {}) {
129
- const host = options.host ?? createBrowserHost(options.hostOptions);
130
130
  const wasmModule = await compileWasmModule(options.wasmSource);
131
+ const moduleImports = WebAssembly.Module.imports(wasmModule);
132
+ const needsHostBridge = moduleImports.some(
133
+ (entry) => entry.module === DEFAULT_HOSTCALL_IMPORT_MODULE,
134
+ );
135
+ const hostOptions =
136
+ !options.host && needsHostBridge && !options.hostOptions?.wasmWallet
137
+ ? {
138
+ ...options.hostOptions,
139
+ wasmWallet: await getWasmWallet(),
140
+ }
141
+ : options.hostOptions;
142
+ const host = options.host ?? createBrowserHost(hostOptions);
143
+ const dispatchHost = createAsyncHostDispatcher(host);
131
144
 
132
145
  const profile = detectArtifactProfile(wasmModule);
133
146
  const moduleExports = WebAssembly.Module.exports(wasmModule);
@@ -240,7 +253,7 @@ export async function createBrowserModuleHarness(options = {}) {
240
253
  }
241
254
 
242
255
  async function callHost(operation, params = {}) {
243
- return dispatchHostOperation(host, operation, params);
256
+ return dispatchHost(operation, params);
244
257
  }
245
258
 
246
259
  function readManifest() {
@@ -335,6 +335,7 @@ export interface BrowserModuleHarness {
335
335
  stdout: Uint8Array;
336
336
  stderr: Uint8Array;
337
337
  };
338
+ callHost(operation: string, params?: Record<string, any>): Promise<unknown>;
338
339
  invokeRaw(
339
340
  requestBytes: Uint8Array | ArrayBuffer | ArrayBufferView,
340
341
  ): Promise<Uint8Array>;
@@ -98,6 +98,7 @@ const CapabilitySurfaceMatrix = Object.freeze({
98
98
  notes: [
99
99
  "WASI preopens are the preferred cross-runtime filesystem surface.",
100
100
  "The sync hostcall ABI currently exposes filesystem.resolvePath only.",
101
+ "Awaited filesystem reads and writes live on the generic async host boundary shared by NodeHost, BrowserHost, runtime-host capability registries, and harness callHost dispatch.",
101
102
  ],
102
103
  }),
103
104
  pipe: Object.freeze({
@@ -121,7 +122,7 @@ const CapabilitySurfaceMatrix = Object.freeze({
121
122
  nodeHostApi: true,
122
123
  notes: [
123
124
  "The coarse network capability maps to async host-side HTTP/TCP/UDP/TLS/WebSocket services.",
124
- "Browser harnesses can await the same capability surface through BrowserHost.invoke().",
125
+ "Browser and Node harnesses can await the same capability surface through BrowserHost.invoke(), loadModule(...).callHost(...), and createBrowserModuleHarness(...).callHost(...).",
125
126
  "Pure WASI guests cannot reach that surface through the current sync hostcall ABI.",
126
127
  "WasmEdge provides non-blocking socket-oriented extensions that can serve as the standard server-side max-WASI target.",
127
128
  ],
@@ -207,7 +208,7 @@ const CapabilitySurfaceMatrix = Object.freeze({
207
208
  syncHostcall: false,
208
209
  nodeHostApi: true,
209
210
  notes: [
210
- "IPFS access is available through async host adapters and browser/module harness dispatch.",
211
+ "IPFS access is available through the generic async host boundary and browser/module harness dispatch.",
211
212
  "Pure WASM guests cannot reach that surface through the current sync hostcall ABI.",
212
213
  ],
213
214
  }),
@@ -219,7 +220,7 @@ const CapabilitySurfaceMatrix = Object.freeze({
219
220
  syncHostcall: false,
220
221
  nodeHostApi: true,
221
222
  notes: [
222
- "Protocol registration is available through async host adapters and browser/module harness dispatch.",
223
+ "Protocol registration is available through the generic async host boundary and browser/module harness dispatch.",
223
224
  "Pure WASM guests cannot reach that surface through the current sync hostcall ABI.",
224
225
  ],
225
226
  }),
@@ -231,7 +232,7 @@ const CapabilitySurfaceMatrix = Object.freeze({
231
232
  syncHostcall: false,
232
233
  nodeHostApi: true,
233
234
  notes: [
234
- "Protocol dialing is available through async host adapters and browser/module harness dispatch.",
235
+ "Protocol dialing is available through the generic async host boundary and browser/module harness dispatch.",
235
236
  "Pure WASM guests cannot reach that surface through the current sync hostcall ABI.",
236
237
  ],
237
238
  }),