@agent-mc/plugin-sdk

中文文档
3.3.0发布于 2026/11/05MITTypeScriptESM + CJS近 30 天下载 2.8万

SDK for building Agent Mission Control plugins

原始使用文档
文档目录12 节
  1. Overview
  2. Install
  3. Usage
  4. Backend types
  5. Browser bridge types
  6. Manifest validation
  7. PluginContext API
  8. Permissions
  9. Exports
  10. Backend Lifecycle
  11. Documentation
  12. License

@agent-mc/plugin-sdk

TypeScript types, interfaces, and validators for building Agent Mission Control plugins

npm TypeScript License: MIT


Overview

This package provides the type definitions and manifest validators for Agent Mission Control (AMC) plugins. It is a dev dependency for plugin projects — it supplies TypeScript interfaces for the sandboxed PluginContext your backend code receives, the AgentMC browser bridge your UI code uses, and a Zod-powered manifest validator for build-time checks.

Install

npm install @agent-mc/plugin-sdk --save-dev

Usage

Backend types

import type { PluginActivate, PluginContext } from '@agent-mc/plugin-sdk'

const activate: PluginActivate = (ctx) => {
  return {
    async onEnable() {
      const data = await ctx.storage.get('config')
      ctx.log.info('Plugin enabled', data)
    },
    async onShutdown() {
      ctx.log.info('Goodbye')
    },
  }
}

export default activate

Browser bridge types

import type { AgentMC } from '@agent-mc/plugin-sdk/browser'

declare global {
  interface Window { AgentMC: AgentMC }
}

const settings = await window.AgentMC.settings.getAll()

Manifest validation

import { validateManifest } from '@agent-mc/plugin-sdk/validators'

const result = validateManifest(manifest)
if (!result.valid) {
  console.error(result.errors)
}

PluginContext API

Every backend plugin receives a PluginContext with these sandboxed capabilities:

CapabilityInterfacePermissionDescription
storagePluginStoragestorageKey-value store (get, set, delete, list)
dbPluginDbstorageSQLite collections (insert, query, getById, update, delete)
fsPluginFsstorageSandboxed filesystem (readFile, writeFile, exists, listDir)
sessionsPluginSessionssessionsCreate and manage Claude Code sessions
aiPluginAiaiDirect AI text generation (generateMessage, generateTitle)
httpPluginHttpnetworkOutbound HTTP requests (fetch)
cronPluginCroncronScheduled recurring tasks
cliPluginClicliHTTP endpoints on AMC's control server
toastPluginToastnotifications*In-app toasts and OS notifications
sidebarPluginSidebar—Badge count and navigation items
settingsPluginSettings—Read plugin settings (getAll, get)
logPluginLogger—Scoped logging (info, warn, error, debug)
eventsPluginEvents—Pub/sub event system (emit, on)

* toast.show() is always available; only toast.notify() (OS-level) requires the notifications permission.

Permissions

Declare in manifest.json — AMC shows these at install and enforces at runtime:

{
  "permissions": ["storage", "network", "ai"]
}
PermissionGrants
storagectx.storage, ctx.db, ctx.fs
sessionsctx.sessions
aictx.ai
networkctx.http
cronctx.cron
clictx.cli
notificationsctx.toast.notify()
rssAccess to AMC's built-in RSS feed data

Exports

This package provides five entry points:

Import pathWhat it provides
@agent-mc/plugin-sdkAll TypeScript types + validateManifest() + manifestSchema + checkCommandTables()
@agent-mc/plugin-sdk/browserAgentMC browser bridge type for UI plugins
@agent-mc/plugin-sdk/validatorsZod manifest schema and validation function
@agent-mc/plugin-sdk/commandscreateCommandChannel (backend) and createCommandClient (panel): a private command channel agents cannot write to
@agent-mc/plugin-sdk/testingcreateTestContext, createRpcDouble and describeForgedRowsAreInert for plugin tests

Backend Lifecycle

interface PluginBackend {
  onEnable?(): Promise<void> | void
  onDisable?(): Promise<void> | void
  onSettingsChanged?(settings: Record<string, unknown>): Promise<void> | void
  onAppReady?(): Promise<void> | void
  onShutdown?(): Promise<void> | void
}

Documentation

Full guides, API reference, and examples: Omniscio Plugin SDK Docs

License

MIT

版本与发布记录

@agent-mc/plugin-sdk 共发布 13 个版本,首次发布于 2026/05/20;过去 12 个月发布了 13 个版本。

版本发布日期距今
3.3.0latest2026/11/051 天前
3.2.02026/10/289 天前
3.1.02026/10/0730 天前
3.0.02026/09/032 个月前
2.0.02026/08/112 个月前
1.0.72026/07/034 个月前

关于 @agent-mc/plugin-sdk 的常见问题

@agent-mc/plugin-sdk 是什么?

SDK for building Agent Mission Control plugins

如何安装 @agent-mc/plugin-sdk?

在项目目录运行 npm install @agent-mc/plugin-sdk,或使用 pnpm add / yarn add / bun add。

@agent-mc/plugin-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agent-mc/plugin-sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@agent-mc/plugin-sdk 可以商用吗?

@agent-mc/plugin-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agent-mc/plugin-sdk 的下载量有多少?

根据 npm 官方下载统计,@agent-mc/plugin-sdk 在 2026/10/05 – 2026/11/03 这 30 天内被下载 28,352 次,日均约 945 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agent-mc/plugin-sdk 还在维护吗?

最新版本 3.3.0 发布于 2026/11/05(1 天前);至今共发布 13 个版本,其中过去 12 个月发布了 13 个;首次发布于 2026/05/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。