Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Hello-World example plugin source.
|
||||
*
|
||||
* Plugin authors write TypeScript / AssemblyScript / Rust against the
|
||||
* `@toolctrl/plugin-sdk` types, then compile to a single `.wasm` binary
|
||||
* with their toolchain of choice (wasm-pack, AssemblyScript's `asc`,
|
||||
* etc.). The host runtime treats the .wasm as opaque — only its
|
||||
* exports (`handleHello` here) and the `plugin.toml` manifest matter.
|
||||
*
|
||||
* Building this file to WASM is intentionally outside the scope of
|
||||
* the foundation: the `toolctrl plugin build` CLI is deferred (see
|
||||
* `docs/improvement-plan/06-plugin-system/wasm-sandbox.md` Deviations).
|
||||
* Operators wanting a working hello-world today can hand-compile via
|
||||
* AssemblyScript or use any other WASM toolchain that produces a flat
|
||||
* function export — the runtime contract is just `(arg) -> result`.
|
||||
*/
|
||||
|
||||
import { defineHook } from "../../src/index.js";
|
||||
|
||||
export const handleHello = defineHook<{ name: string }, { greeting: string }>((input, ctx) => {
|
||||
ctx.log.info({ name: input.name }, "hello-plugin.invoked");
|
||||
return { greeting: `Hello, ${input.name}!` };
|
||||
});
|
||||
Reference in new issue
Block a user