@flowscripter/runtime
v1.2.1
Published
Flowscripter runtime library
Readme
runtime
Flowscripter runtime library
Work in progress.
Bun Module Usage
Add the module:
bun add @flowscripter/runtime
Use the module:
import { createRuntime } from "@flowscripter/runtime";
const runtime = createRuntime({
config: { logLevel: "info", components: { myComponent: { retries: 3 } } },
logger, // optional: a plugin-api Logger
output, // optional: a plugin-api Output
onProgress: (event) => {},
onMetric: (event) => {},
});
runtime.updateConfig({ logLevel: "debug" });Development
Install dependencies:
bun install
Build (produces dist/ for Node.js and TypeScript consumers; Bun uses raw source directly):
bun run build
Test:
bun test
Format:
bunx oxfmt
Lint:
bunx oxlint index.ts src/ tests/
Generate HTML API Documentation:
bunx typedoc index.ts
Documentation
Overview
createRuntime(options) returns an independent runtime instance with no module-level state and no platform-specific imports, so it runs under Bun and in browsers. The host supplies an already parsed config object and the Logger, Output, progress and metric sinks defined in @flowscripter/plugin-api.
- Log level comes from
config.logLevel(debug,info,warn,error,silent; defaultinfo) and is applied by the runtime before the host logger is called. updateConfigreplaces the whole config. Listeners registered withonConfigChangereceive the new and previous config, and only when something changed.- Component config is returned opaque by
getComponentConfig(handle); each component validates its own config. - Unknown top-level config keys are ignored with a single warning.
- Failures in host supplied loggers, outputs, callbacks and listeners never propagate to the caller.
runtime.contextis theRuntimeContextpassed to components. It requires thesession,registry,datastoreManagerandsessionManageroptions.
API
Link to auto-generated API docs:
License
MIT © Flowscripter
