@fnndsc/menu

中文文档
0.41.2发布于 2026/11/15MITTypeScriptES Module近 30 天下载 8343

The mise wire contract: envelope, session protocol, and result-model schemas that surfaces and the kernel both speak

原始使用文档
文档目录4 节
  1. What's in it
  2. Why it is its own package
  3. Rules that hold here
  4. See also

@fnndsc/menu

The mise wire contract: what a command returns, what a session exchanges, and the vocabularies both narrow to.

A menu declares what may be ordered and what arrives. A surface can ask for anything on it and nothing off it, which is the architectural claim this package exists to make structural: no capability exists outside the kernel and the wire, while every surface is free to compose and present as it likes above that line.

What's in it

ModuleContents
envelope.tsCommandEnvelope and its parts — status, typed model slot, error stack, resolution trace
messages.tsThe session protocol: attach, execute, complete, output, progress, prompt, pipe, shell, edit
validate.tsBoundary parsing that never throws — a ParseResult, so a caller can answer rather than crash
version.tsCONTRACT_VERSION and its exact-major compatibility rule
progress.tsThe structured-progress vocabulary
proc.tsPrompt-facing process-index state
listing.tsListingItem and its schema — one listing entry, with an open type so a backend can list its own kinds
surface.ts (subpath @fnndsc/menu/surface)The engine's contract with where it runs: OutputSink (where output goes) and Surface with its capabilities, prompts, edits and deliveries. A subpath, so a browser bundle never meets Node's Buffer

Why it is its own package

A surface author depends on the contract, not on the daemon that happens to serve it. Before this package the contract was a subpath of @fnndsc/calypso, which meant a third-party surface took a dependency on the session host to learn the shape of a result.

It imports nothing from the stack — zod and nothing else — and sits below cumin, so both the engine that produces envelopes and the browser that renders them can load it.

Rules that hold here

Open world. An envelope's model.kind is a free string: a surface narrows what it recognises and falls back to rendered for the rest. Unknown enum values degrade rather than reject — an unknown progress operation reads as task, an unknown phase as working — because a dropped message is invisible and a generic indicator is not.

Never .strict(). A plain z.object() strips unknown keys, so a field added by a newer peer is ignored rather than fatal. .strict() looks like rigour and is a compatibility break.

A new enum value ships with a fallback. safeParse fails a whole message on one unknown value. When you add to an enum on the wire, give it a .catch() in the same change if it has none.

Types are inferred, never declared twice. Payload types come from z.infer<typeof schema>. The envelope and the wire once carried separate declarations held together by a compile-time assertion; one inferred type makes that drift impossible rather than detected.

See also

  • docs/menu.adoc — the design record and the plan this package is part of
  • docs/principles.adoc — the normative architecture
  • docs/structured-progress.md — the progress contract in detail

版本与发布记录

@fnndsc/menu 共发布 48 个版本,首次发布于 2026/09/05;过去 12 个月发布了 48 个版本。

版本发布日期距今
0.41.2latest2026/11/151 天前
0.41.12026/11/141 天前
0.41.02026/11/105 天前
0.40.02026/11/087 天前
0.39.02026/11/088 天前
0.38.02026/11/069 天前

关于 @fnndsc/menu 的常见问题

@fnndsc/menu 是什么?

The mise wire contract: envelope, session protocol, and result-model schemas that surfaces and the kernel both speak

如何安装 @fnndsc/menu?

在项目目录运行 npm install @fnndsc/menu,或使用 pnpm add / yarn add / bun add。

@fnndsc/menu 支持 TypeScript 吗?

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

@fnndsc/menu 支持 ESM 还是 CommonJS?

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

@fnndsc/menu 可以商用吗?

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

@fnndsc/menu 的下载量有多少?

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

@fnndsc/menu 还在维护吗?

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