@thyn-ai/sqai 0.1.1 → 0.1.3

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/dist/index.d.cts CHANGED
@@ -140,12 +140,29 @@ interface RuntimeStatus {
140
140
  platform: string;
141
141
  managed: boolean;
142
142
  }
143
+ /** A runtime bundle resolved for a specific module filter (build-on-provision). */
144
+ interface FilteredBundle {
145
+ url: string;
146
+ sha256: string;
147
+ version: string;
148
+ cacheKey: string;
149
+ }
143
150
  interface ProvisionerOptions {
144
151
  contract: CapabilityContract;
145
152
  autoInstall: boolean;
153
+ /**
154
+ * Build-on-provision: the developer's module filter. All 4,762 functions are
155
+ * available in the contract; only the selected modules are compiled + installed.
156
+ * Empty/undefined → the default pinned bundle (contract.runtime_bundle).
157
+ */
158
+ runtimeModules?: string[];
159
+ /** Build service that compiles a bundle for an exact filter (POST /v1/runtime/build). */
160
+ buildServiceUrl?: string;
146
161
  /** Injection points for tests. */
147
162
  runtimeFactory?: (config?: MojoRuntimeConfig) => MojoRuntime;
148
163
  downloadBundle?: (url: string, destination: string) => Promise<void>;
164
+ /** Resolve a filtered bundle (default: POST to buildServiceUrl). Test injection. */
165
+ resolveFilteredBundle?: (modules: string[], platformKey: string) => Promise<FilteredBundle>;
149
166
  /** Bundle cache directory (default: OS user cache — runtimeCacheDir()). */
150
167
  cacheDir?: string;
151
168
  /** Trust-root overrides (default: the embedded trust root). */
@@ -171,6 +188,27 @@ declare class RuntimeProvisioner {
171
188
  stop(): Promise<void>;
172
189
  private newRuntime;
173
190
  private cacheDir;
191
+ /** Normalized module filter (sorted, unique, non-empty) or null for the default bundle. */
192
+ private filterModules;
193
+ /** Ask the build service to compile + sign a bundle for exactly these modules. */
194
+ private resolveFilteredBundle;
195
+ /**
196
+ * The filter's cache key, computed IDENTICALLY to the build service
197
+ * (sha256("mods|platform|version")[:20], mods = sorted+unique, comma-joined).
198
+ * Lets the reuse fast-path find an already-running filtered daemon without a
199
+ * build-service round-trip. The build service's returned key is authoritative
200
+ * for install; this only has to match for the reuse optimization to hit.
201
+ */
202
+ private localCacheKey;
203
+ /**
204
+ * Deterministic per-filter daemon endpoint so a filtered runtime never collides
205
+ * with the default (or another filter's) daemon on the shared default socket.
206
+ */
207
+ private filterEndpoint;
208
+ private static readonly DAEMON_ENDPOINT_ENV;
209
+ /** Point the about-to-be-spawned daemon at a filter-specific socket/port/dir. */
210
+ private applyDaemonEndpointEnv;
211
+ private restoreEnv;
174
212
  private doEnsure;
175
213
  private provisionError;
176
214
  private wrapVerificationError;
@@ -179,7 +217,7 @@ declare class RuntimeProvisioner {
179
217
  private verifiedInstallOrNull;
180
218
  private acquireLock;
181
219
  private lockIsStale;
182
- /** Serialize installers on `<cacheDir>/<version>.lock`; returns the verified install. */
220
+ /** Serialize installers on `<cacheDir>/<installKey>.lock`; returns the verified install. */
183
221
  private ensureInstalled;
184
222
  /** Holder-of-the-lock path: download → verify → extract → atomic rename. */
185
223
  private downloadVerifyExtract;
@@ -384,6 +422,15 @@ interface SqaiConfig {
384
422
  timeout?: number;
385
423
  maxRetries?: number;
386
424
  resultStore?: ResultStoreConfig;
425
+ /**
426
+ * Build-on-provision module filter. All 4,762 functions are available in the
427
+ * contract; set this to install only the modules you use. The build service
428
+ * compiles + signs a bundle for exactly this set (cached by filter-hash).
429
+ * Omit for the default pinned bundle. Env: SQAI_RUNTIME_MODULES (comma-separated).
430
+ */
431
+ runtimeModules?: string[];
432
+ /** Build service endpoint for filtered bundles. Env: SQAI_BUILD_SERVICE_URL. */
433
+ buildServiceUrl?: string;
387
434
  /** BYO substrate (tests). */
388
435
  runtime?: Runtime;
389
436
  /** BYO computation dispatch target (tests / custom self-hosted engines). */
package/dist/index.d.ts CHANGED
@@ -140,12 +140,29 @@ interface RuntimeStatus {
140
140
  platform: string;
141
141
  managed: boolean;
142
142
  }
143
+ /** A runtime bundle resolved for a specific module filter (build-on-provision). */
144
+ interface FilteredBundle {
145
+ url: string;
146
+ sha256: string;
147
+ version: string;
148
+ cacheKey: string;
149
+ }
143
150
  interface ProvisionerOptions {
144
151
  contract: CapabilityContract;
145
152
  autoInstall: boolean;
153
+ /**
154
+ * Build-on-provision: the developer's module filter. All 4,762 functions are
155
+ * available in the contract; only the selected modules are compiled + installed.
156
+ * Empty/undefined → the default pinned bundle (contract.runtime_bundle).
157
+ */
158
+ runtimeModules?: string[];
159
+ /** Build service that compiles a bundle for an exact filter (POST /v1/runtime/build). */
160
+ buildServiceUrl?: string;
146
161
  /** Injection points for tests. */
147
162
  runtimeFactory?: (config?: MojoRuntimeConfig) => MojoRuntime;
148
163
  downloadBundle?: (url: string, destination: string) => Promise<void>;
164
+ /** Resolve a filtered bundle (default: POST to buildServiceUrl). Test injection. */
165
+ resolveFilteredBundle?: (modules: string[], platformKey: string) => Promise<FilteredBundle>;
149
166
  /** Bundle cache directory (default: OS user cache — runtimeCacheDir()). */
150
167
  cacheDir?: string;
151
168
  /** Trust-root overrides (default: the embedded trust root). */
@@ -171,6 +188,27 @@ declare class RuntimeProvisioner {
171
188
  stop(): Promise<void>;
172
189
  private newRuntime;
173
190
  private cacheDir;
191
+ /** Normalized module filter (sorted, unique, non-empty) or null for the default bundle. */
192
+ private filterModules;
193
+ /** Ask the build service to compile + sign a bundle for exactly these modules. */
194
+ private resolveFilteredBundle;
195
+ /**
196
+ * The filter's cache key, computed IDENTICALLY to the build service
197
+ * (sha256("mods|platform|version")[:20], mods = sorted+unique, comma-joined).
198
+ * Lets the reuse fast-path find an already-running filtered daemon without a
199
+ * build-service round-trip. The build service's returned key is authoritative
200
+ * for install; this only has to match for the reuse optimization to hit.
201
+ */
202
+ private localCacheKey;
203
+ /**
204
+ * Deterministic per-filter daemon endpoint so a filtered runtime never collides
205
+ * with the default (or another filter's) daemon on the shared default socket.
206
+ */
207
+ private filterEndpoint;
208
+ private static readonly DAEMON_ENDPOINT_ENV;
209
+ /** Point the about-to-be-spawned daemon at a filter-specific socket/port/dir. */
210
+ private applyDaemonEndpointEnv;
211
+ private restoreEnv;
174
212
  private doEnsure;
175
213
  private provisionError;
176
214
  private wrapVerificationError;
@@ -179,7 +217,7 @@ declare class RuntimeProvisioner {
179
217
  private verifiedInstallOrNull;
180
218
  private acquireLock;
181
219
  private lockIsStale;
182
- /** Serialize installers on `<cacheDir>/<version>.lock`; returns the verified install. */
220
+ /** Serialize installers on `<cacheDir>/<installKey>.lock`; returns the verified install. */
183
221
  private ensureInstalled;
184
222
  /** Holder-of-the-lock path: download → verify → extract → atomic rename. */
185
223
  private downloadVerifyExtract;
@@ -384,6 +422,15 @@ interface SqaiConfig {
384
422
  timeout?: number;
385
423
  maxRetries?: number;
386
424
  resultStore?: ResultStoreConfig;
425
+ /**
426
+ * Build-on-provision module filter. All 4,762 functions are available in the
427
+ * contract; set this to install only the modules you use. The build service
428
+ * compiles + signs a bundle for exactly this set (cached by filter-hash).
429
+ * Omit for the default pinned bundle. Env: SQAI_RUNTIME_MODULES (comma-separated).
430
+ */
431
+ runtimeModules?: string[];
432
+ /** Build service endpoint for filtered bundles. Env: SQAI_BUILD_SERVICE_URL. */
433
+ buildServiceUrl?: string;
387
434
  /** BYO substrate (tests). */
388
435
  runtime?: Runtime;
389
436
  /** BYO computation dispatch target (tests / custom self-hosted engines). */