API reference
remote
Import
Section titled “Import”import * as api from "@fungi.computer/mycelium/remote";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | RemoteOperationDescriptor | One operation’s model-facing contract with its schemas as JSON Schema. |
| type alias | RemoteModuleDescriptor | A module’s operations keyed by their dotted path below the module, for a host that runs the module in another isolate. Identity, alias and placement stay the host’s decision; this carries only what the model may call. |
| function | describeModule() | Project one module’s callable surface; unrepresentable schemas throw. |
| function | invokeModuleOperation() | Run one described operation through its own input and output schemas. |
| function | remoteModule() | Rebuild a described module on the host side. Each operation parses its input and
output against the described JSON Schema, then forwards to invoke. |
RemoteOperationDescriptortype alias
Section titled “RemoteOperationDescriptor”type RemoteOperationDescriptor = Readonly<{ replay: "safe" | "unsafe"; description?: string; input: MyceliumJsonValue; output: MyceliumJsonValue | null;}>;One operation’s model-facing contract with its schemas as JSON Schema.
RemoteModuleDescriptortype alias
Section titled “RemoteModuleDescriptor”type RemoteModuleDescriptor = Readonly<{ description?: string; operations: Readonly<Record<string, RemoteOperationDescriptor>>;}>;A module’s operations keyed by their dotted path below the module, for a host that runs the module in another isolate. Identity, alias and placement stay the host’s decision; this carries only what the model may call.
describeModule()function
Section titled “describeModule()”function describeModule(registration): RemoteModuleDescriptor;Project one module’s callable surface; unrepresentable schemas throw.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
registration |
ModuleRegistration |
Returns
Section titled “Returns”invokeModuleOperation()function
Section titled “invokeModuleOperation()”function invokeModuleOperation( registration, path, input, context,): Promise<JSONType>;Run one described operation through its own input and output schemas.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
registration |
ModuleRegistration |
path |
string |
input |
unknown |
context |
InvocationContext |
Returns
Section titled “Returns”Promise<JSONType>
remoteModule()function
Section titled “remoteModule()”function remoteModule(options): ModuleRegistration;Rebuild a described module on the host side. Each operation parses its input and
output against the described JSON Schema, then forwards to invoke.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
Readonly<{ id: string; name: string; descriptor: RemoteModuleDescriptor; invoke: (path, input, context) => Promise<MyceliumJsonValue>; }> |