API / @aihu/plugin-demo

@aihu/plugin-demo

Plugins

Canonical proof-of-life for the @aihu/plugin API — exercises macros, middleware, and transforms.

version
0.1.2
exports
5
values
3
types
2
01

createDemoRoutes

function
function createDemoRoutes(_config?: DemoOptions): { readonly demoEndpoint: RouteHandler }

Create the demo plugin route handlers.

02

createDemoRuntime

functionagent
function createDemoRuntime(): DemoResource

Create a reactive demo runtime surface.

03

demo

function
function demo(options?: DemoOptions): Plugin

Create the `@aihu/plugin-demo` plugin.

04

DemoOptions

interface
interface DemoOptions {
  /**
   * Greeting name used by the $greeting macro lowering declaration.
   * Defaults to 'World'.
   */
  readonly greetingName?: string
}

Options for the demo plugin and its associated factories.

05

DemoResource

interface
interface DemoResource {
  /** Read the current count. */
  readonly count: () => number
  /** Increment the count by 1. */
  readonly increment: () => void
}

Shape returned by `createDemoRuntime()`.