A launched bundle serves under the module the runtime names (hq ADR 0193)
serveRegisteredOverStdio lists the registrations of the module named by MESH_SERVED_MODULE by their own names and every other registration as <seat>.<verb>. Before, the first registration was taken for the module's own, so a bundle registering its seat first listed the seat's verbs as its own tools. Contributors are given the process's environment, the bundle's own. 0.1.4.
This commit is contained in:
+12
-5
@@ -89,13 +89,20 @@ export async function serveStdio(name: string, tools: ToolDefinition[]): Promise
|
||||
}
|
||||
}
|
||||
|
||||
/** The word the node's runtime sets for a bundle it launches: the module it serves the bundle as
|
||||
* (novox/hq ADR 0193). */
|
||||
export const SERVED_AS = "MESH_SERVED_MODULE";
|
||||
|
||||
/**
|
||||
* Serve everything registered with `registerModuleTools` over stdio: the one-line entry for a bundle
|
||||
* that already registers the way the in-process shortcut expects, so one source serves both ways.
|
||||
* Serve everything registered with `registerModuleTools` over stdio — the launcher every TypeScript
|
||||
* bundle the runtime serves is started through (novox/hq ADR 0193). What the module the runtime
|
||||
* serves this bundle as registered is listed by its own name; anything registered under another
|
||||
* name — a seat this module implements — is listed `<seat>.<verb>`, whichever was registered first.
|
||||
* Every contributor is given this process's environment, which is the bundle's own.
|
||||
*/
|
||||
export async function serveRegisteredOverStdio(): Promise<void> {
|
||||
const groups = collectTools();
|
||||
const name = groups[0]?.module ?? "bundle";
|
||||
export async function serveRegisteredOverStdio(as: string | undefined = process.env[SERVED_AS]): Promise<void> {
|
||||
const groups = collectTools(process.env);
|
||||
const name = as ?? groups[0]?.module ?? "bundle";
|
||||
const tools: ToolDefinition[] = [];
|
||||
for (const g of groups) {
|
||||
for (const t of g.tools) tools.push(g.module === name ? t : { ...t, name: `${g.module}.${t.name}` });
|
||||
|
||||
Reference in New Issue
Block a user