31 lines
1.0 KiB
Markdown
31 lines
1.0 KiB
Markdown
# @toolctrl/plugin-sdk
|
|
|
|
Phase 06 Task #21 foundation — TypeScript SDK plugin authors import against.
|
|
|
|
## Scope (foundation)
|
|
|
|
- Type definitions: `HostApi`, `PluginContext`, `HookHandler`
|
|
- Example plugin scaffold under `examples/hello-world/` (TypeScript source + manifest)
|
|
|
|
## How plugin authors use this
|
|
|
|
1. `pnpm add -D @toolctrl/plugin-sdk`
|
|
2. Implement a hook handler:
|
|
|
|
```ts
|
|
import type { HookHandler } from "@toolctrl/plugin-sdk";
|
|
|
|
export const handler: HookHandler<{ name: string }, { greeting: string }> = (input, ctx) => {
|
|
ctx.log.info({ name: input.name }, "hello");
|
|
return { greeting: `Hello, ${input.name}!` };
|
|
};
|
|
```
|
|
|
|
3. Build to WASM with `wasm-pack`, AssemblyScript, or similar (operator-side CLI tooling is **deferred**, see `docs/improvement-plan/06-plugin-system/wasm-sandbox.md`).
|
|
4. Sign the resulting `.wasm` and ship to operator alongside the `plugin.toml` manifest.
|
|
|
|
## Deferred
|
|
|
|
- AssemblyScript/Rust toolchain bindings → Phase 06 Task #23 docs follow-up
|
|
- Plugin build/sign/publish CLI → backlog
|