makecindy / makecindy/cindy

插件市场权限预览漏列 notify.badge —— cindy-protocol 侧 manifest 校验器需同步

Open
#1,422 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 现象

PR #1421 给插件加了未读角标能力:身份卡新增 `notify: { badge?: true }`,
装入确认框里**单列一项权限**「可在插件入口点亮未读提醒」。

桌面端本地安装 `.cindy` 包这条路走的是 `apps/desktop/src/shared/ghost.ts` 自己的
`validateGhostManifest`,认识 `notify` 字段,权限清单正确。

但**市场安装路径**的权限预览用的是服务端返回的 manifest,而服务端那份校验器
(`cindy-protocol/packages/plugin-protocol/src/manifest.ts`)是**宽进严出、忽略未知
字段**的——它不认识 `notify`,该字段会被从服务端 manifest 里抹掉。

后果:市场装入确认框的权限清单**少列**未读角标这一项,用户批准时看不到这条能力,
装完之后插件却能点亮入口角标。**权限预览低报了插件的实际能力面。**

## 位置

- 服务端校验器:`cindy-protocol/packages/plugin-protocol/src/manifest.ts`
- `GhostManifest` 缺 `notify?: GhostNotifyNeeds` 字段(desktop 侧见
`apps/desktop/src/shared/ghost.ts` 的 `GhostNotifyNeeds`);
- `validateGhostManifest` 缺 `notify` 详单的校验分支(应与 desktop 一致:
必须与 `notify` 槽成对,`badge:true` 时必须同时声明 `panel`);
- `ghostPermissionItems` 缺 `notify:badge` 这条**独立** key
(必须独立,不能并进 `notify`——并进去会让 `diffGhostPermissionItems` 的
`added` 为空,存量插件加这一档时扩权确认永远不弹)。
- 客户端消费点:`apps/desktop/src/main/plugin-market/service.ts` 的
`detail()` → 权限预览。

## 为什么单开 issue

`docs/dev-rules/protocol-and-submodules.md`:「**升级 submodule 指针前必须确认服务端
同步升级**」。协议是跨仓契约,单端先行会让两端 wire protocol 漂移,而这类漂移在客户端
仓的 typecheck / 单测里发现不了。因此 #1421 只落客户端侧,不 bump submodule 指针。

## 期望方案

1. 在 `cindy-protocol` 补齐 `notify` 详单(类型 + 校验 + 权限项),与
`apps/desktop/src/shared/ghost.ts` 的实现逐条对齐;
2. 服务端同步升级并重新校验已发布的插件 release;
3. 客户端仓 bump submodule 指针。

## 验收标准

- 发布一个声明 `notify: { badge: true }` 的插件到市场,`pluginMarket.detail()` 返回的
manifest 里 `notify.badge` 仍在;
- 市场装入确认框的权限清单里出现「可在插件入口点亮未读提醒」这一独立条目;
- 已装的只声明 `notify` 的存量插件,权限清单逐字不变、批准状态不 churn;
- 存量插件从「只有 notify」更新到「notify + badge」时,扩权确认框会弹。

## 出处

PR #1421(插件未读角标通道)实现期发现;该 PR 属客户端侧能力落地,按协议规则不并入
submodule 改动,由本 issue 独立跟踪。

Contributor guide

Open the contributing guide

Research direction

Start with cindy-protocol/packages/plugin-protocol/src/manifest.ts and compare GhostNotifyNeeds and validation behavior with apps/desktop/src/shared/ghost.ts; then trace apps/desktop/src/main/plugin-market/service.ts detail() to the permission preview. Done means notify.badge survives market detail(), appears as its own permission item, existing notify-only permissions remain unchanged, and adding badge triggers an expansion confirmation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.