tree: 7518cff4415031325b7ad0d8b0ccb8ac1c5003ef [search]
  1. agent/
  2. application/
  3. interactions/
  4. settings/
  5. shared/
  6. skills/
  7. workspace/
  8. README.md
  9. README.zh-CN.md
plugins/README.md

Plugins

简体中文

A plugin is declared by a leaf package.ts. It lists executable entries, configuration, imports and exports. A Cargo crate is a compilation unit: one plugin may use several crates, and related plugins may share an implementation crate.

FamilyWhat it owns
agentConversations, model execution, tools, goals and scheduling
workspaceFiles, processes, Web and Decisions API services
settingsConnections, credentials and preferences
skillsSkill discovery, reads and publication
interactionsQuestions and forms
application/Deployment management, plugin installation and UI authoring
shared/Shared TypeScript contracts and authoring helpers

For an existing plugin, start with its declaration and follow its selected implementation. Native entries select an implementation supplied by the executable; JavaScript entries name their bundled local module. Neither a family directory nor a linked crate activates a plugin.

Packages declare application.host, application.ui, or a composition template. Each deployment instance selects its entry through usePackage: host / ui / composition; a pure UI plugin needs no placeholder Host service. The terminal shell and desktop shell run the same NSH workbench, sharing dynamic UI modules and public Host capabilities. A package may declare a root contribution to provide the entire application; the deployment source selects it through ui: { path, id }. Maka’s default workbench is an ordinary UI package, and a missing root never falls back to it. Installation implies user trust, so UI plugins use the existing workbench capabilities directly.

A deployment may also select an immutable root composition through base.package, applying the same overrides to its inherited children while keeping independent roots in instances. Unlike a structural composition instance, this adds no parent or identity namespace. remove records a deletion; configurationFields records exact object-field edits, with an omitted value deleting a field and explicit null remaining a value. Whole-field configuration overrides retain their replacement semantics. The template's ui is inherited unless the source selects another root or explicitly clears base.ui. See the product baseline model and canonical types.

A UI entry can declare service imports and bind them to Host exports, including its own package's backend. UiContext.application is the native application client bound to those imports, retaining the Client, journal and original receipts. UiContext.services[importName][index] selects a particular provider, including imports with multiple providers; UiContext.operations recovers that instance’s original mutation receipts. Keep business controllers local to their owning activation and its application client. The full UiContext.host and maka/host remain available to trusted UI code, including root and catalog integration. See the UI authoring guide.

Business UI can be a formal view contribution with a named contract. Consumers select its UiTarget ({ path, id }) through configuration and render it with UiRuntime.renderView(target, contract, input), which checks the target’s contribution kind and contract. Conversation navigation, sessions, composers, settings and workspace previews use these shared contracts, so their providers can be selected independently of the root application. Commands declare title and optional description, shortcut, order, trigger, takesArgument and hint; implementations can also report whether the command is enabled.

Each UI module’s synchronous activate(context) returns { exports, prepareReload? }. The activation owns shared business state and resources across its rendered contributions; use nsh.cleanup for resource cleanup. Optional prepareReload() saves owned edits and returns JSON before the shared VM is replaced. The same instance identity and package ID receive that state through context.restored, including a new package revision. Roots receive { context, runtime } and own layout and navigation; business views retain their own state and reload handoff.

Build a single package from the repository root:

node scripts/plugins/build.mjs   --plugin plugins/workspace/workspace-web --output /tmp/maka-web-bundle

The builder replaces its output directory. It emits immutable-package inputs under packages/; inspect one with maka application inspect-package --package /tmp/maka-web-bundle/packages/workspace-web.

To include a plugin in Maka, add its path to the product selection, then add instances and bindings in the composition. A new native implementation also needs a factory in the product registry. An import identifies a dependency; Host grants determine which calls are allowed.

The plugin-authoring skill includes a runnable standalone starter and guides for services, UI, state and native extensions. The SDK supplies the exact contracts.

Plugin lists use the package author's displayName and description. Describe what the user can do in one sentence; internal package IDs remain stable technical identities. Optional localizations maps language tags to translated names and descriptions:

{
  id: 'example.notes',
  displayName: 'Notes',
  description: 'Write and find your notes.',
  localizations: {
    'zh-CN': { displayName: '笔记', description: '记录和查找笔记。' },
  },
  // application: ...
}

The plugin manager displays and searches this copy. Missing translations fall back to the default copy, then the instance name or package ID. Labels should predict the action or destination, following Apple's guidance on clear names. Use familiar icons with accessible labels and tooltips for common actions; keep explicit text for consequential or unfamiliar actions. Shell lists use their native virtualized controls and preserve the visible row; data cursors remain an implementation detail.

Configured Agent service tools capture permission for exactly their selected method on the original binding. Do not duplicate those direct calls in the Host's native grants. Independent background preparation, executor callbacks and cross-component delegation still require their explicit grants; tool confirmation, filesystem/network permissions and resource checks remain separate. Existing saved tool configurations acquire this behavior when the new native implementation starts, without rewriting deployment sources or launcher grants.