Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(plugins): 移除普通详情中的发布区块

liugaowei929656459cdd
diff --git a/apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx b/apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx
index cc1b13d39a..9786f9b8a5 100644
--- a/apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx
+++ b/apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx
@@ -1,5 +1,4 @@
import type { PreparedPluginContribution } from '../../../shared/pluginContributions';
-import { PluginVersionUpdates } from './PluginVersionUpdates';
import { PluginShareButton } from './PluginShareButton';
import { Button } from '@/components/ui/button';
import { GithubAccountCard } from '@/features/cc-agent/GithubAccountCard';
@@ -119,9 +118,7 @@ interface GhostPluginDetailViewProps {
/** Opens publishing; package preparation and submission belong to the dialog. */
onContribute?: () => void;
contributionBusy?: boolean;
- contributionSummary?: string;
publishingPreview?: PreparedPluginContribution;
- onRefreshPublishing?: () => void;
contributionUnavailableReason?: string;
toggleDisabled: boolean;
onIconLoadError?: () => void;
@@ -164,9 +161,7 @@ export function GhostPluginDetailView({
onExport,
onContribute,
contributionBusy = false,
- contributionSummary,
publishingPreview,
- onRefreshPublishing,
contributionUnavailableReason,
toggleDisabled,
onIconLoadError,
@@ -174,7 +169,6 @@ export function GhostPluginDetailView({
const { t } = useTranslation();
const { scrolled, onScroll } = usePluginDetailScrolled();
const enableSwitchId = useId();
- const contributionNoticeId = useId();
const publicationBlocked = publishingPreview?.preflight?.actions.canSubmit === false;
const [githubConnectionVersion, setGithubConnectionVersion] = useState(0);
const [taskApprovalPending, setTaskApprovalPending] = useState(false);
@@ -297,7 +291,6 @@ export function GhostPluginDetailView({
onClick={onContribute}
loading={contributionBusy}
disabled={Boolean(contributionUnavailableReason)}
- aria-describedby={contributionNoticeId}
title={contributionUnavailableReason}
>
{t('settings.ghosts.contribution.publishPlugin')}
@@ -536,47 +529,7 @@ export function GhostPluginDetailView({
{!remote ? <GhostLibrarySection ghostId={detail.id} enabled={ghost?.manifest.library === true} /> : null}
- {publishingSection ?? ((onContribute || contributionUnavailableReason || publishingPreview || detail.releaseNotes?.trim()) ? (
- <PluginVersionUpdates key={detail.id}>
- {(onContribute || contributionUnavailableReason) ? (
- <div className="mt-3 space-y-1 text-13 leading-5 text-[var(--text-secondary)]">
- <p id={contributionNoticeId}>
- {contributionUnavailableReason ?? t('settings.ghosts.contribution.publishHint')}
- </p>
- {contributionBusy || contributionSummary ? (
- <p role="status">
- {contributionBusy ? t('settings.ghosts.contribution.preparing') : contributionSummary}
- </p>
- ) : null}
- </div>
- ) : null}
-
- {publishingPreview ? (
- <section className="space-y-2 text-13 leading-5 text-[var(--text-secondary)]">
- <div className="flex flex-wrap items-center justify-between gap-2">
- <h3 className="font-medium text-[var(--text-primary)]">
- {publicationBlocked ? `${t('settings.ghosts.contribution.version')} · ${publishingPreview.version}` : t('settings.ghosts.contribution.publishingVersion', { version: publishingPreview.version })}
- </h3>
- <Button size="sm" variant="secondary" tone="quiet" onClick={onRefreshPublishing}>
- {t('settings.ghosts.contribution.refreshSummary')}
- </Button>
- </div>
- {publishingPreview.releaseNotes?.trim() ? (
- <>
- <h4 className="font-medium text-[var(--text-primary)]">{t('settings.ghosts.contribution.releaseNotes')}</h4>
- <p className="max-h-48 overflow-y-auto whitespace-pre-wrap break-words">{publishingPreview.releaseNotes}</p>
- </>
- ) : null}
- {!publicationBlocked ? <p>{t('settings.ghosts.contribution.versionConsumedHint')}</p> : null}
- </section>
- ) : detail.releaseNotes?.trim() ? (
- <section className="space-y-2">
- <h3 className="text-14 font-medium text-[var(--text-primary)]">{t('settings.ghosts.contribution.releaseNotes')} · {detail.version}</h3>
- <p className="whitespace-pre-wrap break-words text-13 leading-5 text-[var(--text-secondary)]">{detail.releaseNotes}</p>
- </section>
- ) : null}
- </PluginVersionUpdates>
- ) : null)}
+ {publishingSection}
<DetailsSection detail={remote ? { ...detail, installDir: null } : detail} panelStatus={panelStatus} />
</article>
diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx
index c237bbd087..83e4b2127f 100644
--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx
+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginDetailSections.test.tsx
@@ -252,27 +252,22 @@ describe('Ghost plugin detail sections', () => {
fireEvent.click(screen.getByRole('button', { name: 'Permissions: Read service' }));
expect(within(await screen.findByRole('dialog')).getByText('Only the declared service')).toBeTruthy();
});
- it('shows the plugin purpose and capabilities before the collapsed local update notes', () => {
+ it('keeps installed use details focused on the plugin without a version and publishing section', () => {
vi.stubGlobal('ResizeObserver', class { observe() {} disconnect() {} });
render(<GhostPluginDetailView ghost={null} detail={{ ...detail, releaseNotes: 'Only version changes', tools: [{ name: 'example', description: 'Example tool' }] }} panelStatus={null}
onBack={vi.fn()} onToggle={vi.fn()} onUse={vi.fn()} onUpdate={vi.fn()} onUpdateFromFile={vi.fn()}
onUninstall={vi.fn()} toggleDisabled={false} />);
- const summary = screen.getByText('settings.ghosts.contribution.versionUpdates');
- const updates = summary.closest('details')!;
- expect(updates.open).toBe(false);
- expect(screen.getByText(detail.description).compareDocumentPosition(updates) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
- expect(screen.getByRole('heading', { name: 'Tools' }).compareDocumentPosition(updates) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
- fireEvent.click(summary);
- expect(updates.open).toBe(true);
- expect(screen.getByText('Only version changes')).toBeTruthy();
+ expect(screen.getByText(detail.description)).toBeTruthy();
+ expect(screen.getByRole('heading', { name: 'Tools' })).toBeTruthy();
+ expect(screen.queryByText('settings.ghosts.contribution.versionUpdates')).toBeNull();
+ expect(screen.queryByText('Only version changes')).toBeNull();
});
it.each(['pending', 'approved', 'rejected', 'cancelled'] as const)(
- 'keeps the %s version result without advertising a submission that cannot be repeated', (status) => {
+ 'hides a submission that cannot be repeated for the %s version without showing publishing details', (status) => {
vi.stubGlobal('ResizeObserver', class { observe() {} disconnect() {} });
const publish = vi.fn();
- const refresh = vi.fn();
const preview: PreparedPluginContribution = {
preparedId: 'preview', instanceId: 'instance', pluginId: 'plugin', ghostId: 'example',
name: detail.name, description: detail.description, version: '1.0.0', sha256: 'a'.repeat(64),
@@ -289,51 +284,37 @@ describe('Ghost plugin detail sections', () => {
const view = (prepared: PreparedPluginContribution) => <GhostPluginDetailView
ghost={null} detail={detail} panelStatus={null} onBack={vi.fn()} onToggle={vi.fn()} onUse={vi.fn()}
onUpdate={vi.fn()} onUpdateFromFile={vi.fn()} onUninstall={vi.fn()} toggleDisabled={false}
- onContribute={publish} onRefreshPublishing={refresh}
- publishingPreview={prepared} contributionSummary={`1.0.0 · ${status}`}
+ onContribute={publish} publishingPreview={prepared}
contributionUnavailableReason={prepared.preflight?.actions.canSubmit ? undefined : 'Change the version before publishing again'} />;
const { rerender } = render(view(preview));
- const updates = screen.getByText('settings.ghosts.contribution.versionUpdates').closest('details')!;
- expect(updates.open).toBe(false);
- expect(screen.getByRole('heading', { name: 'settings.ghosts.contribution.version · 1.0.0' }).closest('details')).toBe(updates);
- fireEvent.click(screen.getByText('settings.ghosts.contribution.versionUpdates'));
expect(screen.queryByRole('button', { name: 'settings.ghosts.contribution.publishPlugin' })).toBeNull();
- expect(screen.getByRole('status').textContent).toBe(`1.0.0 · ${status}`);
- expect(screen.getByText('Change the version before publishing again')).toBeTruthy();
- expect(screen.getByRole('heading', { name: 'settings.ghosts.contribution.version · 1.0.0' })).toBeTruthy();
+ expect(screen.queryByText('settings.ghosts.contribution.versionUpdates')).toBeNull();
+ expect(screen.queryByText('Change the version before publishing again')).toBeNull();
expect(screen.queryByText('settings.ghosts.contribution.versionConsumedHint')).toBeNull();
- expect(screen.getByText('Complete package release notes')).toBeTruthy();
- fireEvent.click(screen.getByRole('button', { name: 'settings.ghosts.contribution.refreshSummary' }));
- expect(refresh).toHaveBeenCalledOnce();
+ expect(screen.queryByText('Complete package release notes')).toBeNull();
expect(publish).not.toHaveBeenCalled();
// A previous cancelled/rejected/approved result does not hide a new eligible version.
rerender(view({ ...preview, version: '1.1.0', preflight: { ...preview.preflight!, target: { ...preview.preflight!.target, version: '1.1.0' }, pendingRelease: null, blockers: [], actions: { canSubmit: true } } }));
const submit = screen.getByRole('button', { name: 'settings.ghosts.contribution.publishPlugin' });
expect(submit).toHaveProperty('disabled', false);
- expect(screen.getByRole('heading', { name: 'settings.ghosts.contribution.publishingVersion' })).toBeTruthy();
fireEvent.click(submit);
expect(publish).toHaveBeenCalledOnce();
},
);
- it('keeps the local publishing entry in the use header and release information secondary', () => {
+ it('keeps the local publishing entry in the use header without a publishing section', () => {
vi.stubGlobal('ResizeObserver', class { observe() {} disconnect() {} });
const publish = vi.fn();
render(<GhostPluginDetailView ghost={null} detail={detail} panelStatus={null}
onBack={vi.fn()} onToggle={vi.fn()} onUse={vi.fn()} onUpdate={vi.fn()}
onUpdateFromFile={vi.fn()} onUninstall={vi.fn()} toggleDisabled={false}
- onContribute={publish} contributionSummary="2.0.0 · Pending Review" />);
- const summary = screen.getByText('settings.ghosts.contribution.versionUpdates');
- const updates = summary.closest('details')!;
- expect(updates.open).toBe(false);
+ onContribute={publish} />);
+ expect(screen.queryByText('settings.ghosts.contribution.versionUpdates')).toBeNull();
expect(screen.getByRole('button', { name: 'settings.ghosts.contribution.publishPlugin' }).closest('header')).toBeTruthy();
- expect(within(updates).getByRole('status').textContent).toBe('2.0.0 · Pending Review');
const chat = screen.getByRole('button', { name: 'settings.ghosts.detail.chatAction' });
expect(within(chat.closest('.plugin-detail-actions') as HTMLElement).getByRole('switch')).toBeTruthy();
- expect(screen.getByText('Example plugin').compareDocumentPosition(updates) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
- fireEvent.click(summary);
+ expect(screen.getByText('Example plugin')).toBeTruthy();
const action = screen.getByRole('button', { name: 'settings.ghosts.contribution.publishPlugin' });
- expect(within(updates).getByRole('status').textContent).toBe('2.0.0 · Pending Review');
fireEvent.click(action);
expect(publish).toHaveBeenCalledOnce();
});
diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginPage.navigation.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginPage.navigation.test.tsx
index 3bf9aaad1d..1995659f76 100644
--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginPage.navigation.test.tsx
+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginPage.navigation.test.tsx
@@ -405,7 +405,7 @@ describe('plugin page return navigation', () => {
{ id: 'personal-plugin', namespace: 'org', namespaceState: 'confirmed', publishingSource: { kind: 'local', source: 'manual' }, approval: 'approved', reason: 'privatePlugin' },
{ id: 'personal-plugin', namespace: null, namespaceState: 'pending', approval: 'approved', reason: 'identityPending' },
{ id: 'personal-plugin', namespace: null, namespaceState: 'confirmed', publishingSource: { kind: 'local', source: 'manual' }, approval: 'invalid', reason: 'approvalRequired' },
- ])('explains why $id cannot be published ($reason)', async ({ id, namespace, namespaceState, approval, reason }) => {
+ ])('keeps publishing restrictions out of use details for $id ($reason)', async ({ id, namespace, namespaceState, approval, reason }) => {
const installed = {
manifest: { ...detail.manifest, id, name: 'Installed Plugin' },
dir: '/tmp/brain/' + id, namespace, namespaceState, publishingSource: { kind: 'local', source: 'manual' },
@@ -415,9 +415,9 @@ describe('plugin page return navigation', () => {
window.electronAPI.pluginMarket.snapshot = async () => ({ items: [], unavailableReason: null, customSourceNames: [], unavailableCustomSourceNames: [] });
render(page('/plugins'));
fireEvent.click(await screen.findByText('Installed Plugin'));
- fireEvent.click(screen.getByText('settings.ghosts.contribution.versionUpdates'));
+ expect(screen.queryByText('settings.ghosts.contribution.versionUpdates')).toBeNull();
expect(screen.queryByRole('button', { name: 'settings.ghosts.contribution.publishPlugin' })).toBeNull();
- expect(screen.getByText('settings.ghosts.contribution.unavailable.' + reason)).toBeTruthy();
+ expect(screen.queryByText('settings.ghosts.contribution.unavailable.' + reason)).toBeNull();
});
it('offers only locally publishable exact installations and opens a read-only package summary without uploading or publishing', async () => {
diff --git a/docs/plugin-community-contribution.md b/docs/plugin-community-contribution.md
index 9923213fd6..3079ad06a9 100644
--- a/docs/plugin-community-contribution.md
+++ b/docs/plugin-community-contribution.md
@@ -19,7 +19,7 @@ Host 固定并再核对当前安装内容,不弹保存或选文件框,不另
安装身份未确认或权限未批准的实例不进入选择框。没有可选项时区分未安装与没有可发布实例,
引导安装、使用自己的插件并核对详情。选择后留在当前弹窗,展示所选精确本地安装的实际名称、版本、用途、更新说明与只读预检结果,不创建上传或占用版本;点击“提交 {{version}} 审核”才开始上传。关闭弹窗保留管理列表位置,不提交。
选择框打开后独立完整读取本人插件版本事实,不受管理列表搜索和分页影响。已知当前版本已提审、插件有待审版本或无提交权时,在选项内直接说明并禁止选择;未知或读取失败时不冒充可提交。选中后的实际包预检仍是最终提交条件;限制或错误固定显示在底部按钮上方,不藏在用途、更新说明的滚动区域中。首次发布从“发布插件”页面的页头按钮选择本地版本,再提交审核,新版沿已有管理详情提交,审核结果仍在同一管理详情查看,不把 Agent 的调用步骤作为用户页面。
-不能发布的实例仍在详情固定位置显示实际原因(保留标识、组织/私域、身份或权限批准未就绪),
+普通使用详情不显示“版本与更新”区块或发布限制说明,发布内容和原因集中在发布弹窗与管理页面;不能发布的实例隐藏发布入口,
安装不表示作者权,最终仍由 Main、服务端核验私域台账与 public ACL。
个人账号和组织成员均可按当前登录身份向公开市场投稿,作者和管理权归提交者本人,组织管理员不因此获得其他成员投稿的管理权。组织内部发布及私域插件继续原流程。
未登录时复用现有登录入口;登录意图只在内存保存,
@@ -33,7 +33,7 @@ Host 固定并再核对当前安装内容,不弹保存或选文件框,不另
单个历史版本不显示无用下拉框。完整退回原因保留,历史选择不改变本地版本、当前提审或提交目标。
顶部返回按固定父页面跳转:管理详情返回“发布插件”列表,再返回原插件列表,同账号保留查询、筛选和列表位置。管理读取本机安装不改变普通详情的选择;管理页不再提供实际跳往普通详情的“打开插件”按钮。普通插件详情仍沿原列表返回逻辑。
-官方 public 插件不允许经客户端提审(包括 Agent 工具),即使当前账号有提交授权也不例外。请通过 GitHub 仓库提交修改,以保证仓库源码完整、便于后续维护。官方身份只取 Host 可信官方来源或服务端 publisherKind,不根据名字、包内 author 或自定义市场声明认定;界面隐藏提交入口并显示原因,Main 在准备和实际写入前复核。普通第三方 public 插件沿既有授权流程。
+官方 public 插件不允许经客户端提审(包括 Agent 工具),即使当前账号有提交授权也不例外。请通过 GitHub 仓库提交修改,以保证仓库源码完整、便于后续维护。官方身份只取 Host 可信官方来源或服务端 publisherKind,不根据名字、包内 author 或自定义市场声明认定;普通使用详情隐藏提交入口,不展示发布限制说明,Main 在准备和实际写入前复核。普通第三方 public 插件沿既有授权流程。
## 版本更新与取消审核