Skip to content

feat: isolate plugin availability by client - #4653

Merged
liruifengv merged 7 commits into
release/2026-11-04from
fix/plugin-marketplace-followup
Nov 3, 2026
Merged

liruifengv merged 7 commits into
release/2026-11-04from
fix/plugin-marketplace-followup

Conversation

@liruifengv

@liruifengv liruifengv commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

需求或 Bug

插件后台需要控制插件可用于 Desktop、CLI,还是同时可用于两端。当前 Desktop 和 CLI 共享安装记录与运行能力,因此在 Desktop 安装 Desktop-only 插件后,CLI 仍可能看到并运行它。

本 PR 在保留共享安装的前提下,按 server 宿主过滤市场并隔离运行能力;目录配置变化后,可以隐藏或恢复已有安装,无需重新安装。Web 和 Remote Control 跟随所连接 server 的宿主身份。

Bug 复现步骤

N/A

根本原因

N/A

代码变更

核心思路

使用 clients 表示产品宿主可用性,继续使用 platforms 表示 server 操作系统可用性,两个条件必须同时满足。installed.json 与托管插件文件仍共享,根据当前宿主计算管理可见性和运行资格。最近一次成功获取的可用性配置缓存到 plugins/availability.json,使重启和离线启动保持相同行为。

未提供 clients 时表示双端可用,因此现有目录和安装行为不变。自定义插件与共享 enabled 状态也保持现状。

flowchart LR
    Catalog[插件市场目录] --> Availability[统一客户端与 OS 可用性]
    Identity[server 宿主身份] --> Availability
    Availability --> Marketplace[过滤市场与安装校验]
    Availability --> Installed[过滤安装记录与运行能力]
    Catalog --> Cache[plugins/availability.json]
    Cache --> Installed
    Web[Web / Remote Control] --> Identity
Loading

可用性规则统一放在 Core,不再由 Vue、kap-server 和 TUI 分别实现。缓存只保存可用性,不是市场响应缓存,也不会减少目录请求。

关键决策

决策 选择 未选择 理由
安装模型 共享一条记录和一份托管文件 Desktop 与 CLI 分开安装 配置扩展后直接识别已有安装,无需迁移或再次下载
可用性撤销 隐藏并停止运行能力 删除文件或改写共享 enabled 后续配置恢复时可以安全复用同一安装
未知可用性 保留已有安装 直接视为不可用 避免离线启动和旧记录被意外破坏
Web 与 Remote Control 使用所连接 server 的身份 根据浏览器 UA 或 OS 推断 插件实际安装和执行发生在 server 上
共享启停状态 保留现有共享 enabled 行为 新增按端独立启停 本 PR 隔离的是可用性,不改变用户已有的启停意图

典型生命周期

sequenceDiagram
    participant Desktop
    participant Catalog as 插件后台
    participant CLI
    Desktop->>Catalog: 读取 clients=["desktop"] 的目录
    Desktop->>Desktop: 安装并缓存可用性
    CLI->>CLI: 读取共享安装,隐藏并排除运行能力
    CLI->>Catalog: clients 变为 ["desktop","cli"] 后刷新
    CLI->>CLI: 重新计算可用性并显示已有安装
    CLI->>Catalog: clients 变为 ["desktop"] 后刷新
    CLI->>CLI: 再次隐藏,但不删除安装
Loading

只有可用性实际变化才触发 reconcile。新规则必须在目录成功刷新后生效;目录不可访问时继续使用最后已知配置。

阅读指南

  1. packages/agent-core-v2/src/app/plugin/marketplace.ts:clients 解析,以及统一的客户端 / OS 判断。
  2. packages/agent-core-v2/src/app/plugin/availability.ts:持久化最后已知可用性,以及安装记录匹配。
  3. packages/agent-core-v2/src/app/plugin/manager.ts:已安装列表过滤、写操作保护,以及所有运行能力边界。
  4. packages/agent-core-v2/src/app/plugin/pluginService.ts 与 marketplaceService.ts:宿主接入、最终安装校验和目录刷新后的 reconcile。
  5. packages/kap-server/src/routes/plugins.ts:server 侧市场过滤和安装状态合并。
  6. apps/kimi-code/src/utils/plugin-marketplace.ts:CLI 通过 SDK 使用同一可用性实现。

其余改动包括 SDK 导出、CLI 更新检查接线、测试桩、回归测试和中英文文档。

行为变化与受影响用户

行为 修改前 修改后 旧行为使用者 退出方式
未声明 clients 的目录 按 server OS 过滤 不变:OS 匹配时 Desktop 和 CLI 均可用 现有市场目录和自定义目录 无需处理
Desktop-only 或 CLI-only 安装 共享安装可能在另一端显示并运行 从不支持端的管理 API 和全部运行能力中隐藏 使用宿主受限市场条目的用户 将 clients 配置为同时支持双端
目录可用性变化 没有按宿主区分的生命周期 成功刷新后隐藏或恢复已有安装,不重装、不删除 插件配置会扩展或收窄的用户 恢复原 clients 配置并刷新
离线启动或旧安装记录 从共享 installed.json 加载 保留最后已知可用性;配置缺失或未知时不强制禁用 升级后或离线启动的现有用户 成功刷新目录后采用当前规则
Web 与 Remote Control 只按 server OS 过滤 客户端可用性跟随所连接 server 的 Desktop / CLI 身份 浏览器和远程控制用户 连接到目标宿主 server
安装、预览、更新、启停和卸载 只有 OS 校验和 UI 过滤 同时执行宿主校验,包括 capability 预解析安装和隐藏记录写保护 CLI、Desktop 和 capability 编排路径 使用受支持宿主,或让条目支持双端
自定义插件与共享 enabled 共享安装和启停状态 不变 现有自定义插件用户 无需处理

影响模块包括 agent-core-v2 插件管理、kap-server 插件 REST 路由、node-sdk 导出、CLI/TUI 市场加载和更新检查,以及中英文插件与 server API 文档。

覆盖场景包括 Desktop 与 CLI 管理器共享 home、全部运行能力入口、预解析安装、Desktop/CLI server 的 REST 安装、目录配置扩展/移除/恢复、自定义插件、可用性缺失、CLI 过滤和更新检查。本 PR 不改变视觉布局,因此无需截图。

验证结果
  • pnpm exec vitest run packages/agent-core-v2/test/app/plugin packages/kap-server/test/plugins.test.ts:170 项通过。
  • pnpm exec vitest run apps/kimi-code/test/utils/plugin-marketplace.test.ts apps/kimi-code/test/tui/components/dialogs/plugins-selector.test.ts apps/kimi-code/test/tui/commands/plugin-commands.test.ts apps/kimi-code/test/tui/controllers/plugin-update-notifier.test.ts:105 项通过。
  • code-app 中运行 pnpm exec vitest run packages/app-client/test/usePlugins.test.ts packages/app-components/test/pluginsPanel.test.ts:125 项通过。
  • agent-core-v2、kap-server、node-sdk 和 apps/kimi-code 类型检查通过。
  • pnpm --filter kimi-code-docs run build 通过。
  • node scripts/check-no-comments.mjs 和 git diff --check 通过。

Checklist

  • 我已阅读并遵循 CONTRIBUTING。
  • 我已链接相关 issue(外部 PR 需要维护者的 /approve)。
  • 我已添加证明功能可用的测试。
  • 上述行为变化表已覆盖本次行为变化,相关场景均提供退出方式。
  • 已运行 gen-changesets skill,或本 PR 无需 changeset。
  • 已运行 gen-docs skill,并完成相关文档更新。

@changeset-bot

changeset-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2d29ffb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T13:30:09.675136Z 2d29ffb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@2d29ffb
npx https://pkg.pr.new/@moonshot-ai/kimi-code@2d29ffb

commit: 2d29ffb

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4b3970e35

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b021e620c3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +339 to +342
if (!Array.isArray(value)) return [];
return [...new Set(value.filter((client): client is PluginClient =>
PLUGIN_MARKETPLACE_CLIENTS.includes(client as PluginClient)
))];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject malformed client constraints before caching them

When a managed or custom catalog sends clients as a scalar, an empty array, or an array containing only unknown values, this silently converts the field to [] instead of rejecting the catalog. The resulting availability entry matches neither host, so a successful catalog refresh hides the plugin and disables its runtime capabilities without reporting the malformed configuration; validate the field like platforms rather than filtering invalid values away.

AGENTS.md reference: AGENTS.md:L130-L132

Useful? React with 👍 / 👎.

@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ba94cccff

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 904823bbcc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d29ffb869

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@liruifengv
liruifengv merged commit 22bf0c8 into release/2026-11-04 Nov 3, 2026
14 checks passed
@liruifengv
liruifengv deleted the fix/plugin-marketplace-followup branch November 3, 2026 13:33
Grapedge pushed a commit that referenced this pull request Nov 4, 2026
* fix(tui): read welcome cwd and footer git status from the session environment (#4649)

* fix(tui): show remote cwd in welcome panel

* fix(tui): read footer git status through the session environment

The footer ran git and gh on the local machine, so a remote-bound session
hid the git badge. Read branch, working-tree, and pull request state through
the SDK instead: a live session's own environment, or the local work dir
before the lazy session exists. The local HEAD poll stays as a refresh
trigger only.

Core git commands now time out after 30s, and the pull request cache is
keyed by branch so a branch switch no longer serves the previous branch's
pull request.

* fix(agent-core-v2): resolve local git and gh outside the working directory

GitService spawned bare git and gh with the workspace as cwd. On Windows a
bare name is looked up in the cwd before PATH, so a binary planted in the
workspace could run, and the TUI footer now reads git status at startup,
before the workspace trust gate. Resolve both through PATH for the local
environment and refuse any match inside the working directory.

* chore: merge changesets for remote cwd and git status

* fix(tui): drop the startup Ready. row once startup succeeds

The startup progress row turned into a permanent "Ready." line under the
welcome panel. Remove it on success; a failed startup still leaves the
"Startup failed." row.

* fix(agent-core-v2): compare workspace containment case-insensitively on Windows

resolveProgramPath compared the PATH candidate against the working directory
case-sensitively, so on Windows a PATH entry spelled with different casing
(c:\repo\bin vs C:\Repo) let a workspace-local executable through.

* fix(tui): keep the footer git badge through a remote disconnect

The git cache key included the environment status, so a remote dropping to
connecting or disconnected rebuilt the cache and lost the last badge. Key
the cache by session and work dir only, and refresh it when the environment
turns ready again.

* feat: isolate plugin availability by client (#4653)

* fix: preserve marketplace descriptions

* fix: preserve localized plugin display names

* feat: isolate plugin availability by client

* fix: preserve cli marketplace loading

* fix: harden plugin availability reconciliation

* fix: hash plugin marketplace provenance

* fix: complete plugin availability reconciliation

* fix(transcript): keep realigned turn ids unique when folding cold facts (#4658)

* fix(transcript): keep realigned turn ids unique when folding cold facts

Realigning base turns to their wire ids only skipped ordinals held by
turns without a wire id. When an inherited turn held a forked turn's
wire id, that turn kept its base ordinal, and the next turn's wire id
could land on the same ordinal, so two turns shared a turn id and the
later one replaced the earlier in clients. Claim ordinals in order:
turns without a wire id or already at their wire id first, then each
realigned turn takes its wire id when free, else keeps its ordinal or
moves to the next free one.

* chore: add changeset for side chat turn order fix

* fix(kap-server): wait for an agent's history before accepting its prompt (#4659)

* fix(kap-server): backfill a side chat fork before replying to :btw

A fork's inherited history folds into a cold turn at t0, while the live
transcript only records it as markers. When the fork's first prompt
started before anything read the fork transcript, its live turn took t0;
the history backfill then merged the inherited main turn into it by turn
id, so the first side chat turn carried the main answer and the real
answer landed in a duplicate turn. Finish the fork's history backfill
before :btw replies, so the inherited turn holds t0 before the first
prompt can start.

* fix(kap-server): wait for an agent's history before accepting its prompt

Delaying the :btw reply did not order the fork's first prompt after its
history backfill: other clients learn the fork from the agent roster as
soon as it is created, and checking for a live transcript with
forSessionLive created one, so every :btw also waited for the whole main
history. Move the wait to prompt submission: a prompt for a non-main
agent awaits that agent's history backfill before it is enqueued, which
covers every client and leaves :btw unchanged. The backfill is cached
per agent, so later prompts do not wait again.

* fix: safely launch Windows SSH executors (#4664)

* feat: support Windows SSH remote environments

* Delete .changeset/windows-remote-environments.md

Signed-off-by: 7Sageer <[email protected]>

---------

Signed-off-by: 7Sageer <[email protected]>

* fix(agent-core-v2): match regional plugin locales (#4666)

* fix(plugins): confirm stopping Windows CU processes before install (#4670)

* fix(plugins): confirm stopping Windows CU processes before install

* test(plugins): cover capability install confirmation contract

* fix(plugins): preserve bodyless installs and plugin-only repairs

* chore: sync web dist from code-app (#4667)

* chore: sync web dist from code-app

code-app: 63661fc449e2ec0ce024bc08fe87f2c757d483e8

* chore: sync web dist from code-app

code-app: d0e913a6c9607be778c62f0c74ee7310bfb8862a

* chore: sync web dist from code-app

code-app: b306f4a2f9be8944e5a8064ecb076e3137c968f1

---------

Co-authored-by: kimi-agent-bot <[email protected]>

* ci: release packages (#4672)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: 7Sageer <[email protected]>
Co-authored-by: 7Sageer <[email protected]>
Co-authored-by: liruifengv <[email protected]>
Co-authored-by: qer <[email protected]>
Co-authored-by: kimi-agent-bot <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Fifteen rows enter the ledger: the six commits that landed on
upstream/main after the last refresh, and the nine commits that reach
main only through the release/2026-11-04 sync (MoonshotAI#4674), which is where
the 2.5.0 changelog entries come from.

Each 2.5.0 row records what it needs from this tree, so the next batch
starts from the blocker instead of rediscovering it:

- MoonshotAI#4658 and MoonshotAI#4659 are ported (79a4199, 7a531f5) with tests that
  fail on the pre-change tree.
- MoonshotAI#4649 is in_progress: its agent-core-v2 half landed in 2fa7b6b,
  while the footer and welcome half needs the pull-request API of MoonshotAI#4527
  and the session workdir of MoonshotAI#4062.
- MoonshotAI#4653, MoonshotAI#4666 and MoonshotAI#4670 build on the MoonshotAI#4525 plugin marketplace, absent
  here; MoonshotAI#4670 additionally needs isError2.
- MoonshotAI#4664 needs the MoonshotAI#4062 remote environments.
- MoonshotAI#4667 and MoonshotAI#4672 are generated-bundle and release commits; settling
  them as not-applicable needs a signature.

Rows were appended by a one-off writer because --refresh fetches and
that fetch does not complete on this network; the file still parses
under the tool's own column contract, and --verify --batch B5 passes
both new probes.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Second slice of upstream 8019337 (MoonshotAI#4525), and the seam MoonshotAI#4653 needs. An
entry can now declare the clients it serves and the platforms it runs on;
`marketplaceEntryInstallableOnHost` requires both to match the host, while
`marketplaceEntryVisibleOnHost` also shows a cloud-only entry anywhere
without making it installable there. `pluginClientForIdentity` maps the
desktop identity to `desktop` and every other host to `cli`.

Parsing keeps an absent `clients` list open to everyone, drops unknown client
names, and turns a non-array into an empty list rather than silently
admitting the entry — the three behaviours upstream pins.

Verified: agent-core-v2 typecheck clean, check-no-comments clean;
`marketplace.test.ts` 13 pass.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Fourth slice of upstream 8019337 (MoonshotAI#4525), and the provenance MoonshotAI#4653's
availability cache keys on. `PluginRecord` and `PluginSummary` now carry
`origin` (`marketplace` | `custom` | `unknown`) and an optional `catalogId`.

The installed-file record keeps both fields optional and `recordFrom`
defaults a missing origin to `unknown`, so an `installed.json` written before
this change still loads and is not mislabelled as marketplace or custom. No
rewrite of existing files is needed; the next persist simply writes the new
fields.

Classifying a fresh install is deliberately left out: the marketplace install
path that knows the catalog entry does not exist in the fork yet, so every
install would be labelled from a guess. `install()` therefore still produces
`unknown` until that path passes the entry.

Verified: agent-core-v2 typecheck clean, check-no-comments clean; plugin
suites 129 pass, including two new cases — a pre-origin record reads as
`unknown`, and a marketplace origin with its catalog id survives a reload.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
The availability half of upstream 45e8f0e0f0e (MoonshotAI#4653), built on the fields the
MoonshotAI#4525 slices added. `PluginAvailabilityStore` keeps
`<home>/plugins/availability.json`: per marketplace source, each catalog
entry's client list, platform list, artifact digest and check time. `update()`
writes only when a value actually changed and reports whether it did;
`refresh()` reloads; `entryFor()` resolves an installed record back to its
catalog entry by source and catalog id, and `supports()` answers whether this
host may install it.

Resolution follows the record's provenance: a `custom` plugin is always
allowed, a `marketplace` plugin is matched through the source it came from,
and an `unknown` plugin must match the artifact digest it was installed from —
when several catalog entries claim the same id the lookup returns a
restrictive empty entry rather than guessing.

Local-form divergence: upstream locks with `proper-lockfile`, which is not a
dependency here. The equivalent is an `open(..., 'wx')` lock file with a
50 ms retry, a 10 s wait and a 5 s stale reclaim, so a crashed writer cannot
block the next one; the write itself is still temp-file plus rename. Corrupt
JSON throws instead of being read as an empty cache.

Verified: agent-core-v2 typecheck clean, check-no-comments clean; plugin suite
137 pass including the new availability cases (single change signal,
concurrent writers, stale-lock reclaim, provenance matching, corrupt cache).
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
The engine half of MoonshotAI#4653: the marketplace catalog route now records every
entry's clients, platforms and artifact digest into
`<home>/plugins/availability.json` after reading the catalog, and hides
entries whose `clients`/`platforms` exclude this host.

The fork has no `PluginMarketplaceService` — it reads the catalog in this
route and in the TUI helper — so this is where upstream's service-side
`availability.update()` and `marketplaceEntryInstallableOnHost` check land.
`PluginAvailabilityStore` is exported from the engine entry so the route (and
later the install path) can reach it.

Verified: agent-core-v2 and kap-server typecheck clean, check-no-comments
clean; kap-server plugins suite 13 pass, including a new case that the
catalog read writes one source section carrying the catalog ids and that no
entry without client/platform metadata disappears from the response.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Completes the provenance chain of MoonshotAI#4653. The install request carries only a
source URL, so the record could not say whether it came from the catalog; the
availability cache can, because each entry stores the digest of the artifact
it points at. `PluginAvailabilityStore.matchByArtifact()` turns an install
source back into its marketplace source and catalog id, and `installPlugin`
passes that to `manager.install(source, provenance)`, which now threads
origin/catalogId/marketplaceSource into the record, the persisted file and the
summary.

An install the cache does not recognise keeps `origin: 'unknown'` — the
previous behaviour — rather than being guessed as custom, and a custom plugin
stays custom through the availability store's own rule.

Verified: agent-core-v2 typecheck clean, check-no-comments clean; plugin
suites 141 pass, including a new case that a cached catalog source produces a
marketplace record with its catalog id, and that the id lands in
installed.json.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
The klient plugin summary schema had drifted behind the engine: `origin`,
`catalogId` and `marketplaceSource` were added to `PluginSummary` by the MoonshotAI#4653
provenance slices, and the wire schema did not list them, so the contract
parity assertion was failing on both summary and info.

The schema now carries the origin enum and the two optional provenance fields,
plus the three description fields upstream exposes (`description`,
`shortDescription`, `longDescription`), which `recordToSummary` fills from the
manifest and its `interface` block — a schema field the engine never populates
would have been a wire field that is always absent.

Verified: agent-core-v2 and klient typecheck clean (contract-parity included),
check-no-comments clean; plugin suites 140 pass, kap-server plugins 13,
klient facade 32.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Closes the TUI half of MoonshotAI#4653. Loading the marketplace from the CLI now records
the catalog in `$KIMI_CODE_HOME/plugins/availability.json` before returning,
and a changed catalog re-reads the installed list so a plugin the catalog just
stopped targeting for this host disappears from `/plugins`; an unchanged
catalog does no extra work. The plugin selector filters rows through the
shared `marketplaceEntryVisibleOnHost` predicate instead of its own copy, so
the panel and the server agree on what this host may see.

Cache read and write failures degrade to "no cache" rather than failing the
marketplace load: the file is an optimisation, and a corrupt or unwritable
cache must not take `/plugins` down with it. The entry it feeds still drives
the installed list on the next successful write.

Docs describe the new catalog fields and the cache in both locales:
`customization/plugins.md` for entry-level `clients`/`platforms` and what
hiding/restoring an installation means, `reference/server-api.md` for the
filtered marketplace response, the availability file, and the `origin`/
`catalogId` fields plugin summaries now carry.

The marketplace loader test compares with `toMatchObject` now: the parser
returns the full entry shape, so a strict equality assertion would have to
restate every optional field the catalog may carry.

Verified: apps/kimi-code typecheck clean; check-no-comments and
check-no-hardcoded-prose pass by exit status; the four marketplace/selector/
notifier suites 110 pass.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant