@streamcore/plugin
v0.1.3
Published
Plugin SDK for StreamCoreAI — build TypeScript/JavaScript plugins for the streamcore server
Readme
@streamcore/plugin
TypeScript/JavaScript SDK for building StreamCoreAI plugins. Plugins are subprocesses spawned by the Go voice agent server; they talk to the server over JSON-RPC 2.0 on stdin/stdout so the LLM can call your code during conversations.
For the full workflow (manifests, plugin directory layout, and how the server loads plugins), see the Plugin Development Guide.
Installation
npm install @streamcore/pluginFrom this repo (for development):
cd plugin-sdk/typescript
npm install
npm run buildWhen published, install the package by name and depend on it from your plugin project.
Usage
import { StreamCoreAIPlugin } from "@streamcore/plugin";
const plugin = new StreamCoreAIPlugin();
plugin.onExecute(async (params) => {
// `params` matches the JSON Schema in your plugin.yaml
return "result string for the LLM";
});
plugin.onInitialize(async () => {
plugin.log("Plugin initialized");
});
plugin.run(); // JSON-RPC loop on stdin/stdout; blocks until stdin closesAPI
| Method | Description |
|--------|-------------|
| onExecute(handler) | Required. Called when the LLM invokes the plugin. handler receives Record<string, unknown> and returns a string (or Promise<string>). |
| onInitialize(handler) | Optional. Runs once when the server sends the initialize RPC. |
| log(message) | Writes a line to stderr (shows up in server logs). |
| run() | Starts the JSON-RPC line loop on stdin; exits when stdin is closed and work is finished. |
See also
- Plugin Development Guide —
plugin.yaml,language: typescript, entrypoints, and testing
