@telorun/kernel 0.63.0 → 0.64.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.
- package/dist/boot-context-registry.js +1 -3
- package/dist/boot-context-registry.js.map +1 -1
- package/dist/bundle/module-artifact.js +15 -8
- package/dist/bundle/module-artifact.js.map +1 -1
- package/dist/controller-loader.js +4 -0
- package/dist/controller-loader.js.map +1 -1
- package/dist/controller-loaders/bundle-loader.js +1 -0
- package/dist/controller-loaders/bundle-loader.js.map +1 -1
- package/dist/controller-loaders/napi-loader.d.ts.map +1 -1
- package/dist/controller-loaders/napi-loader.js +24 -8
- package/dist/controller-loaders/napi-loader.js.map +1 -1
- package/dist/controller-loaders/npm-loader.js +37 -28
- package/dist/controller-loaders/npm-loader.js.map +1 -1
- package/dist/controller-registry.js +3 -5
- package/dist/controller-registry.js.map +1 -1
- package/dist/controllers/resource-definition/abstract-controller.js +2 -1
- package/dist/controllers/resource-definition/abstract-controller.js.map +1 -1
- package/dist/controllers/resource-definition/resource-definition-controller.js +2 -1
- package/dist/controllers/resource-definition/resource-definition-controller.js.map +1 -1
- package/dist/controllers/type/json-schema-controller.js +3 -0
- package/dist/controllers/type/json-schema-controller.js.map +1 -1
- package/dist/directory-lock.js +5 -5
- package/dist/directory-lock.js.map +1 -1
- package/dist/evaluation-context.js +60 -21
- package/dist/evaluation-context.js.map +1 -1
- package/dist/events.js +1 -3
- package/dist/events.js.map +1 -1
- package/dist/host-env.js +3 -2
- package/dist/host-env.js.map +1 -1
- package/dist/kernel.js +57 -26
- package/dist/kernel.js.map +1 -1
- package/dist/logging/console-sink.js +18 -29
- package/dist/logging/console-sink.js.map +1 -1
- package/dist/logging/debug-wire-sink.js +11 -23
- package/dist/logging/debug-wire-sink.js.map +1 -1
- package/dist/logging/drop-accounting.js +28 -41
- package/dist/logging/drop-accounting.js.map +1 -1
- package/dist/logging/file-sink.js +28 -38
- package/dist/logging/file-sink.js.map +1 -1
- package/dist/logging/kernel-logging.js +30 -41
- package/dist/logging/kernel-logging.js.map +1 -1
- package/dist/logging/logging-pipeline.js +197 -197
- package/dist/logging/logging-pipeline.js.map +1 -1
- package/dist/logging/sampler.js +21 -34
- package/dist/logging/sampler.js.map +1 -1
- package/dist/manifest-sources/local-manifest-cache-source.js +2 -0
- package/dist/manifest-sources/local-manifest-cache-source.js.map +1 -1
- package/dist/manifest-sources/memory-source.js +1 -3
- package/dist/manifest-sources/memory-source.js.map +1 -1
- package/dist/module-context.js +62 -37
- package/dist/module-context.js.map +1 -1
- package/dist/registry.js +5 -7
- package/dist/registry.js.map +1 -1
- package/dist/resource-context.js +30 -29
- package/dist/resource-context.js.map +1 -1
- package/dist/resource-uri.js +4 -0
- package/dist/resource-uri.js.map +1 -1
- package/dist/runtime-seam.js +42 -55
- package/dist/runtime-seam.js.map +1 -1
- package/dist/schema-validator.js +20 -18
- package/dist/schema-validator.js.map +1 -1
- package/dist/tracing.js +4 -19
- package/dist/tracing.js.map +1 -1
- package/dist/transports/oci/oci-client.js +3 -1
- package/dist/transports/oci/oci-client.js.map +1 -1
- package/dist/transports/oci/oci-transport.js +17 -16
- package/dist/transports/oci/oci-transport.js.map +1 -1
- package/dist/transports/registry-transport.js +4 -0
- package/dist/transports/registry-transport.js.map +1 -1
- package/dist/transports/transport-registry.js +1 -0
- package/dist/transports/transport-registry.js.map +1 -1
- package/package.json +3 -3
- package/src/controller-loaders/napi-loader.ts +28 -9
|
@@ -218,13 +218,26 @@ export class NapiControllerLoader {
|
|
|
218
218
|
throw new ControllerEnvMissingError("rustc not found on PATH");
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
// Read before building: the metadata answers both "where did the dylib
|
|
222
|
+
// land" and "does this crate use the SDK", and the second decides the build
|
|
223
|
+
// flags.
|
|
224
|
+
const { targetDir, libName, usesSdk } = await resolveCrateMetadata(cratePath, fallbackName);
|
|
225
|
+
|
|
221
226
|
try {
|
|
222
|
-
//
|
|
223
|
-
// `
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
|
|
227
|
+
// The backend is selected as a *dependency* feature of the SDK. A crate
|
|
228
|
+
// built on `telorun-sdk` carries no `[features]` block of its own, so this
|
|
229
|
+
// is the only way to pick one from outside it: `--no-default-features`
|
|
230
|
+
// here would apply to the controller crate, not to the SDK, and the SDK
|
|
231
|
+
// therefore declares no default backend at all. The Rust kernel passes
|
|
232
|
+
// `--features telorun-sdk/native` at the same spot.
|
|
233
|
+
//
|
|
234
|
+
// Only when the crate actually depends on the SDK. `pkg:cargo` names a
|
|
235
|
+
// Rust controller, not an SDK user — a crate may implement the napi
|
|
236
|
+
// exports by hand (the `tests/napi-echo` fixture does exactly that, which
|
|
237
|
+
// is what makes it a test of this loader rather than of the SDK). Naming a
|
|
238
|
+
// feature of a dependency it does not have is a hard cargo error.
|
|
239
|
+
const featureArgs = usesSdk ? ["--features", "telorun-sdk/napi"] : [];
|
|
240
|
+
await execFileAsync("cargo", ["build", "--release", ...featureArgs], {
|
|
228
241
|
cwd: cratePath,
|
|
229
242
|
maxBuffer: 32 * 1024 * 1024,
|
|
230
243
|
env: hostEnv(),
|
|
@@ -237,8 +250,6 @@ export class NapiControllerLoader {
|
|
|
237
250
|
);
|
|
238
251
|
}
|
|
239
252
|
|
|
240
|
-
const { targetDir, libName } = await resolveCrateMetadata(cratePath, fallbackName);
|
|
241
|
-
|
|
242
253
|
const dylibPath = await findDylib(targetDir, libName);
|
|
243
254
|
if (!dylibPath) {
|
|
244
255
|
throw new RuntimeError(
|
|
@@ -300,10 +311,14 @@ function project(module: any, entry: string | undefined, where: string): Control
|
|
|
300
311
|
return sub;
|
|
301
312
|
}
|
|
302
313
|
|
|
314
|
+
/** The SDK crate whose backend feature selects the FFI bridge, when the
|
|
315
|
+
* controller is built on it. */
|
|
316
|
+
const SDK_CRATE_NAME = "telorun-sdk";
|
|
317
|
+
|
|
303
318
|
async function resolveCrateMetadata(
|
|
304
319
|
cratePath: string,
|
|
305
320
|
fallbackName: string,
|
|
306
|
-
): Promise<{ targetDir: string; libName: string }> {
|
|
321
|
+
): Promise<{ targetDir: string; libName: string; usesSdk: boolean }> {
|
|
307
322
|
const result = await execFileAsync("cargo", [
|
|
308
323
|
"metadata",
|
|
309
324
|
"--format-version",
|
|
@@ -317,9 +332,13 @@ async function resolveCrateMetadata(
|
|
|
317
332
|
(p: any) => p.manifest_path === path.join(cratePath, "Cargo.toml"),
|
|
318
333
|
);
|
|
319
334
|
const packageName = cratePackage?.name ?? fallbackName;
|
|
335
|
+
const usesSdk = (cratePackage?.dependencies ?? []).some(
|
|
336
|
+
(dependency: any) => dependency?.name === SDK_CRATE_NAME,
|
|
337
|
+
);
|
|
320
338
|
return {
|
|
321
339
|
targetDir: metadata.target_directory,
|
|
322
340
|
libName: packageName.replace(/-/g, "_"),
|
|
341
|
+
usesSdk,
|
|
323
342
|
};
|
|
324
343
|
}
|
|
325
344
|
|