Show module names for dynamic plugins

This commit is contained in:
ZiyaZhang
2026-08-11 08:54:29 -07:00
parent 2614a2df93
commit eea356e785
8 changed files with 36 additions and 26 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/host/plugin-inventory/README.md
README.md: d7a50824d337c66a30ba4332ffb1e36f9ad46547
README.zh.md: e424b968f1f692fb30b3b0e49efe6c3cd5fadf70
README.md: 23fbf07d7900ecc881f81b5da3f8cbe6a45669de
README.zh.md: 87058cde595b83e980b8f3cec4192e6099b8d9ea

View File

@@ -2,7 +2,7 @@
English | [中文](README.zh.md)
Read-only Host projection of the current Cordis Loader tree. `PluginInventoryService` registers the `pluginInventory` service and publishes one generated direct Remote, `pluginInventory/list`. Every call reads `ctx.loader.entries()` directly, skips structural group rows, and returns the remaining entries in Loader order with only their Loader entry id, local display id, effective enablement, and current root Fiber phase.
Read-only Host projection of the current Cordis Loader tree. `PluginInventoryService` registers the `pluginInventory` service and publishes one generated direct Remote, `pluginInventory/list`. Every call reads `ctx.loader.entries()` directly, skips structural group rows, and returns the remaining entries in Loader order with only their Loader entry id, module specifier, effective enablement, and current root Fiber phase.
The phase is `pending`, `loading`, `active`, `failed`, or `unloading`; it is `null` when the entry has no live root Fiber. The snapshot is intentionally point-in-time: Loader remains the sole lifecycle authority, while this package owns no cache, history, provenance model, event stream, or mutation path. Its public payload types live under `./types`, and TypeRT generates the Host and Client Remote artifacts exposed by `./typert` and `./remote`.

View File

@@ -2,7 +2,7 @@
[English](README.md) | 中文
当前 Cordis Loader 树的只读 Host 投影。`PluginInventoryService` 注册 `pluginInventory` 服务,并发布一个由 TypeRT 生成的直接 Remote`pluginInventory/list`。每次调用都直接读取 `ctx.loader.entries()`,跳过结构性的 group 行,再按 Loader 顺序返回其余条目,并且只包含 Loader 条目 id、本地展示 id、有效启用状态与当前根 Fiber 阶段。
当前 Cordis Loader 树的只读 Host 投影。`PluginInventoryService` 注册 `pluginInventory` 服务,并发布一个由 TypeRT 生成的直接 Remote`pluginInventory/list`。每次调用都直接读取 `ctx.loader.entries()`,跳过结构性的 group 行,再按 Loader 顺序返回其余条目,并且只包含 Loader 条目 id、模块标识、有效启用状态与当前根 Fiber 阶段。
阶段为 `pending``loading``active``failed``unloading`;条目没有存活的根 Fiber 时则为 `null`。该快照刻意只表示调用当下Loader 仍是唯一的生命周期权威,本包不拥有缓存、历史、来源模型、事件流或修改路径。公开 payload 类型位于 `./types`TypeRT 生成由 `./typert``./remote` 导出的 Host 和 Client Remote 产物。

View File

@@ -60,7 +60,7 @@ export class PluginInventoryService extends GatewayService {
if (entry.options.group) continue
entries.push({
entryId: pluginEntryId(entry.id),
displayId: entry.options.id,
moduleName: entry.options.name,
enabled: !entry.disabled,
fiberPhase: entry.fiber === undefined ? null : FIBER_PHASE[entry.fiber.state],
})

View File

@@ -15,8 +15,8 @@ export type PluginFiberPhase =
/** One non-group Loader entry exposed to trusted clients. */
export interface PluginInventoryEntry {
readonly entryId: PluginEntryId
/** Local Loader id used as the compact card title. */
readonly displayId: string
/** Exact module specifier imported by the Loader entry. */
readonly moduleName: string
/** Effective Loader enablement, including disabled ancestor groups. */
readonly enabled: boolean
readonly fiberPhase: PluginFiberPhase

View File

@@ -56,19 +56,19 @@ describe('PluginInventoryService', () => {
entries: [
{
entryId: activeId,
displayId: activeId,
moduleName: 'cordis:active',
enabled: true,
fiberPhase: 'active',
},
{
entryId: pendingId,
displayId: pendingId,
moduleName: 'cordis:pending',
enabled: true,
fiberPhase: 'pending',
},
{
entryId: disabledId,
displayId: disabledId,
moduleName: 'cordis:not-installed',
enabled: false,
fiberPhase: null,
},
@@ -78,7 +78,7 @@ describe('PluginInventoryService', () => {
await ctx.loader.update(activeId, { disabled: true })
expect(inventory.list().entries.find(entry => entry.entryId === activeId)).toEqual({
entryId: activeId,
displayId: activeId,
moduleName: 'cordis:active',
enabled: false,
fiberPhase: null,
})