node-tools hands each bundle its own environment (hq ADR 0192)
The mesh composes every served module's words into MESH_TOOL_ENV; the runtime takes it at start and removes it from its own environment, then gives each registration's contributor and each launched child the runtime's words plus its own module's, never another's. Against an SDK without collectToolsEach it says so and serves with the runtime's words only. The test serves two imported bundles and one launched, each answering with its own words and none of the others'.
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
import { registerModuleTools } from "@novox/mesh-sdk/tools";
|
||||
registerModuleTools("delta", (env) => [
|
||||
{ name: "given", description: "what delta was given", input: {}, run: async () => ({ mine: env.DELTA_TOKEN_FILE ?? null, theirs: env.GAMMA_CONFIG_FILE ?? null }) },
|
||||
]);
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// A bundle that reads what it was given (novox/hq ADR 0192): its contributor's environment.
|
||||
import { registerModuleTools } from "@novox/mesh-sdk/tools";
|
||||
registerModuleTools("gamma", (env) => [
|
||||
{ name: "given", description: "what gamma was given", input: {}, run: async () => ({ mine: env.GAMMA_CONFIG_FILE ?? null, theirs: env.DELTA_TOKEN_FILE ?? null, runtime: env.MESH_OPERATOR_ACCOUNT ?? null, composed: env.MESH_TOOL_ENV ?? null }) },
|
||||
]);
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
// Launched (ADR 0188): its environment is the child's own.
|
||||
import { serveStdio } from "@novox/mesh-sdk/stdio";
|
||||
await serveStdio("zeta", [
|
||||
{ name: "given", description: "what zeta was given", input: {}, run: async () => ({ mine: process.env.ZETA_URL ?? null, theirs: process.env.GAMMA_CONFIG_FILE ?? null, composed: process.env.MESH_TOOL_ENV ?? null }) },
|
||||
]);
|
||||
Reference in New Issue
Block a user