@agent-native/dispatch

中文文档
0.42.4发布于 2026/11/11MITES Module构建来源已验证近 30 天下载 3.3万

Dispatch — workspace control plane for agent-native apps. Vault, integrations, destinations, scheduled jobs, and cross-app delegation, shipped as a single drop-in package.

原始使用文档
文档目录6 节
  1. Install
  2. Compose
  3. Exports
  4. Verify a community template branch
  5. What it's for
  6. Eject

@agent-native/dispatch

Dispatch is the Agent-Native workspace control plane and a separate product. It is not a Toolkit capability module.

Workspace control plane for agent-native apps — vault, integrations, destinations, cross-app workspace resources, recurring "dream" report jobs, and cross-app delegation, shipped as a single drop-in package.

Powers the dispatch template. Provides:

  • Drizzle schemas — destinations, identity links, link tokens, approval requests, audit events, dream reports/proposals, vault secrets/grants/ requests/audit, workspace resources/grants
  • Server layer — setupDispatch(config) plus Nitro plugins for auth, integrations, agent chat, DB, and core routes
  • Actions — ~90 defineAction modules (vault grants/requests, workspace resource grants, destinations, dream jobs, provider-api catalog/docs/ request, Slack thread context, connected-agent discovery, audit/approvals, platform messaging, and more) consumed as agent tools + HTTP endpoints
  • Routes — a full React Router 7 RouteConfig[] (chat, overview, apps, vault, integrations, agents, workspace, messaging, destinations, identities, approvals, automations, audit, settings, dreams, extensions, ...) to splat into a consumer's app/routes.ts
  • React components — DispatchShell, Layout/NavContent, CreateAppPopover/CreateAppFlow, AppKeysPopover, plus a full shadcn/ui-based components/ui/* primitive set. SimpleAgentsPanel is also exported for embedding the shared agent manager in another workspace UI.
  • Styles — dispatch.css Tailwind layer

Install

pnpm add @agent-native/dispatch

Peer-depends on @agent-native/core (>=0.8.0), react/react-dom (>=19.2.7), and react-router (>=8).

Compose

Template's app/routes.ts:

import { type RouteConfig } from "@react-router/dev/routes";
import { dispatchRoutes } from "@agent-native/dispatch/routes";

export default [
  ...localRoutes, // consumer's own routes win on collision
  ...dispatchRoutes, // dispatch fills in everything else
] satisfies RouteConfig;

Template's server/plugins/*.ts (each export lives in its own file so Nitro auto-loads it):

// server/plugins/setup-dispatch.ts
import { setupDispatch } from "@agent-native/dispatch/server";
export default setupDispatch({ auth: { googleOnly: true } });

// server/plugins/auth.ts
export { dispatchAuthPlugin as default } from "@agent-native/dispatch/server";

// server/plugins/integrations.ts
export { dispatchIntegrationsPlugin as default } from "@agent-native/dispatch/server";

// server/plugins/agent-chat.ts
export { dispatchAgentChatPlugin as default } from "@agent-native/dispatch/server";

// server/plugins/db.ts
export { dispatchDbPlugin as default } from "@agent-native/dispatch/server";

// server/plugins/core-routes.ts
export { dispatchCoreRoutesPlugin as default } from "@agent-native/dispatch/server";

Template's server/db/schema.ts:

export * from "@agent-native/dispatch/db";

@agent-native/dispatch/actions doesn't need a manual import for most consumers: import "@agent-native/dispatch/server" (pulled in by the plugin wiring above) side-effect-registers every Dispatch action via registerPackageActions, and the framework's autoDiscoverActions merges them in after the consumer's local actions/ directory. Drop a same-named file in the consumer's own actions/ to override any single action.

Exports

SubpathWhat it is
.Shared config types only — DispatchConfig, DispatchAuthConfig, DispatchIntegrationsConfig. Import this where a type is needed without pulling in server/client code.
./routesdispatchRoutes — a programmatic RouteConfig[] covering every Dispatch page (chat, overview, metrics, operations, apps, vault, integrations, agents, workspace, messaging, destinations, identities, approvals, automations, audit, settings, dreams, extensions, thread-debug, team, and a workspace-app catch-all route).
./routes/pages/*Individual compiled page modules the routes above point at (e.g. ./routes/pages/vault.js). Not normally imported directly.
./serversetupDispatch(config) plus the Nitro plugin set: dispatchAuthPlugin, dispatchIntegrationsPlugin, dispatchAgentChatPlugin, dispatchDbPlugin, dispatchCoreRoutesPlugin. Importing this module also side-effect-registers all Dispatch actions.
./shared/feature-flagsThe default-off DISPATCH_WORKSPACE_SSO_FLAG definition used to target browser workspace sign-in safely.
./shared/workspace-ssoExact first-party workspace SSO origins and the additive custom registration parser shared by Dispatch and the identity hub.
./server/lib/thread-link-previewloadThreadLinkPreview(threadId) — server-only helper (reads request context and checks thread ownership) that builds link-preview metadata for shared thread URLs.
./actionsdispatchActions — the flat name → ActionEntry map of every Dispatch action (vault, workspace resources, destinations, dream jobs, provider-api catalog/docs/request, connected agents, audit, approvals, platform messaging, and more).
./dbgetDb() / db(), the Drizzle schema namespace, the Dispatch table exports (dispatchDestinations, dispatchIdentityLinks, dispatchLinkTokens, dispatchApprovalRequests, dispatchAuditEvents, dispatchDreams, dispatchDreamProposals, vaultSecrets, vaultGrants, vaultRequests, vaultAuditLog, workspaceResources, workspaceResourceGrants), and migrations.
./lib/thread-link-previewIsomorphic helpers behind the server one above — extractThreadPreviewImageUrl, buildThreadLinkPreviewMeta, and the ThreadLinkPreview type. Safe to import from client code.
./componentsEscape-hatch UI pieces for custom layouts: DispatchShell, Layout/NavContent (plus DispatchExtensionConfig/DispatchNavIcon/DispatchNavItem/DispatchNavSection types), CreateAppPopover/CreateAppFlow, AppKeysPopover. Most consumers only need dispatchRoutes and never import from here directly.
./components/ui/*The shadcn/ui primitive set Dispatch's own UI is built on (button, dialog, dropdown-menu, card, command, calendar, chart, ...), exported per-file so a consumer can reuse one primitive without pulling in the rest.
./styles/dispatch.cssTailwind layer with Dispatch-specific styles. Import once in the consumer's global CSS entry.

Hosts that compose the exported layout can brand its desktop and mobile navigation together without forking Dispatch:

import { Layout } from "@agent-native/dispatch/components";

<Layout brandName="Acme Workspace" brandIcon={<AcmeMark />}>
  {children}
</Layout>;

Verify a community template branch

When a branch verification fails, an organization owner or admin can call inspect-community-builder-backup with only branchName. It reads bounded backup and branch status metadata from the organization's saved Builder project to show whether the backup is partial, valid, complete and current, whether the branch is active, archived, deleted or unknown, and whether it is idle or has unpushed changes. It only reads existing status metadata; it does not request a backup, download a bundle, or verify app files. backupPartial returns missing or invalid when the provider flag is absent or malformed; it never coerces those cases to false. An explicit provider invalid/no-backup status with no backup object is a typed status_no_backup failure; other missing backup objects remain malformed status failures. verificationPerformed is always false. Use verify-curated-community-app for the separate hash verification step. The verifier requests a bundle-download URL and may refresh provider backup state; this status action does not. Status metadata is diagnostic only and never authorizes an install or a retry.

Organization owners and admins can call verify-curated-community-app with sourceId, appId, and branchName to check an existing Builder branch in the organization's configured Builder project. Project selection and reviewed file pins come from Dispatch; callers cannot supply another project or hashes.

The action uses the saved Builder connection with project read access. It requires a complete backup whose digest and immutable commit match the idle, clean branch before and after reading its Git bundle. Every regular file under apps/<appId> must match the reviewed template's exact path and Git blob hash; missing, extra, changed, or linked files fail verification. The result contains commit and file hashes, without file contents or signed download URLs.

The server needs a writable temporary directory. Verification bounds pack decompression before a JavaScript Git reader opens an isolated object store, never checks out or executes app code, and removes its temporary files. Stale or partial backups, unverifiable identities, access errors, and size limits fail closed.

Verification does not install an app, grant access, change Community Lab, or mark an app ready. Builder-mode community installs remain disabled pending verified generated-branch acceptance.

What it's for

Dispatch is the workspace control plane sitting above individual template apps:

  • Vault — shared workspace secrets with a request → grant → audit flow, scoped per app.
  • Workspace resources — cross-app resources (e.g. shared instructions or data) with explicit per-app grants and effective-context resolution.
  • Simple agents and agent packs — reusable agents keep a Claude-compatible Markdown/JSON profile at agents/<slug>.md and can own sibling files under agents/<slug>/context/, references/, and skills/<name>/SKILL.md. The import-agent-pack and list-agent-pack actions create/read the whole pack; import-agent remains the fast single-file path. Unsafe capabilities such as credentials, hooks, shell commands, and local environment settings are stripped or reported as warnings. Pack files are text resources, not an execution grant.
  • Integrations & destinations — outbound messaging channel setup (Slack, Teams, Discord, Telegram, WhatsApp, email, and more) and a destinations queue for delivering agent output.
  • Dream jobs — a recurring background job (ensure-dream-job) that scans agent thread-debug history across connected sources and produces pending, evidence-backed proposals (create-dream-report, list-dream-candidates, apply-dream-proposal / reject-dream-proposal) without an extra LLM call.
  • Connected agents & provider APIs — discovery of other workspace apps (list-connected-agents, open_app, ask_app) and a generic provider-api catalog/docs/request surface for calling third-party APIs through stored credentials.
  • Approvals & audit — a shared approval-request/audit-event model used across the above surfaces.

Eject

There is no agent-native.package.json / CLI package-lifecycle wiring for this package yet (unlike @agent-native/scheduling). To customize beyond the setupDispatch config surface, copy the files you want to own out of node_modules/@agent-native/dispatch/src into your own package and swap the dependency manually.

版本与发布记录

@agent-native/dispatch 共发布 1,116 个版本,首次发布于 2026/05/05;过去 12 个月发布了 1116 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.42.4latest2026/11/11今天
0.42.4-nightly-202611101824152026/11/11今天
0.42.4-nightly-202611100324372026/11/10今天
0.42.4-nightly-202611092123492026/11/101 天前
0.42.4-nightly-202611091229522026/11/091 天前
0.42.4-nightly-202611090327252026/11/091 天前

其他发布通道:beta → 0.0.0-beta-20260821173827,dev-beta-embedded-chat-20261025 → 0.40.41-beta-embedded-chat-20261025-20261025150325,dev-embed-chat-beta-20261025 → 0.40.41-embed-chat-beta-20261025-20261025212203,dev-beta-dispatch-embed-01a15dc9 → 0.40.41-beta-dispatch-embed-01a15dc9-20261027050558,dev-embedded-chat-fix-20261027 → 0.40.41-embedded-chat-fix-20261027-20261027063754,dev-same-host-mcp-20261027 → 0.40.41-same-host-mcp-20261027-20261027081850。

关于 @agent-native/dispatch 的常见问题

@agent-native/dispatch 是什么?

Dispatch — workspace control plane for agent-native apps. Vault, integrations, destinations, scheduled jobs, and cross-app delegation, shipped as a single drop-in package.

如何安装 @agent-native/dispatch?

在项目目录运行 npm install @agent-native/dispatch,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=19.2.7)、react-dom(>=19.2.7)、react-router(>=8)、@agent-native/core(>=0.227.0-0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@agent-native/dispatch 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/agent-native__dispatch 是否存在。

@agent-native/dispatch 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agent-native/dispatch 可以商用吗?

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

@agent-native/dispatch 的下载量有多少?

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

@agent-native/dispatch 还在维护吗?

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