tree: e31f624fc31c994f00b9029a2386c0aa87ebbfbe [search]
  1. examples/
  2. scripts/
  3. src/
  4. package.json
  5. README.md
  6. README.zh-CN.md
  7. tsconfig.acceptance.json
  8. tsconfig.json
packages/plugin-sdk/README.md

@maka-agent/plugin-sdk

简体中文

TypeScript contracts and authoring helpers for Maka Host services and shared NSH workbench UI plugins. Bundle guest code before shipping it to the runtime.

ModuleContents
src/index.tsHostService, RequestContext, and top-level SDK exports
src/workbench.tsNSH UI plugin activate(context), contribution descriptors, UiContext, and UiRuntime
src/workbench-views.tsShared view contracts for navigation, conversations, previews, and settings
src/composer-view.tsReplaceable composer view contract and resident session controller interface
src/workspace-view.tsWorkspace file/diff preview contracts and action handles
src/generated/runtime.tsGenerated Rust wire types and deployment schemas
src/generated/methods.tsTyped Host RPC method inputs and outputs
src/contracts.tsJSON Schema catalog exported from tools/schema

UI contributions and live reload

  • Service bindings — context.services[importName][index] invokes declared Host imports under the UI instance's captured identity, while context.operations tracks and recovers its two-phase mutation receipts. Trusted UI code can also access context.host directly.
  • Typed embedded views — Declare { kind: 'view', contract } with defineUiViewContract<Input>(id) and mount providers via runtime.renderView(target, contract, input, options?).
  • Commands — Implement run({ sessionId, argument? }) and optional enabled(context), declared with title, shortcut, trigger, and takesArgument metadata.
  • Hot-reload handoff — Optional prepareReload() returns serializable JSON before a VM reload; the replacement activation with the same (instance, packageId) receives it in context.restored while keeping its live Host client and pending operation receipts.

Regenerating contracts

After changing Rust wire types (schemars), regenerate and verify the SDK from maka-schema without building V8 or maka-cli:

npm --workspace @maka-agent/plugin-sdk run schema:generate
npm --workspace @maka-agent/plugin-sdk run schema:check

See plugins and the maka-plugin-authoring skill for runnable examples.