feat(plugin-inventory): flat plugin list with a default-open toggle guard
The plugin-list tab rendered one flat list of every Loader entry — no separate "system plugins" section — with each card showing its real enabled state and an enable/disable button (a required plugin shows only a read-only note). The enable/disable guard flipped from default-protect to default-open: only the small REQUIRED_PLUGINS core (entry tree, Remote RPC spine, session/agent spines) is protected from being disabled, so the shipped plugins are actually toggleable. Tests, host READMEs, and the enable-disable agent note track the new grouping and guard. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -34,19 +34,22 @@ patch's `applyEntryPatches` target lookup.
|
|||||||
|
|
||||||
The Web plugin-list tab (`ui-settings-plugin-inventory`) adds an enable/disable
|
The Web plugin-list tab (`ui-settings-plugin-inventory`) adds an enable/disable
|
||||||
button to each expanded card, wired to the Remote, re-listing after the toggle.
|
button to each expanded card, wired to the Remote, re-listing after the toggle.
|
||||||
The list is grouped: toggleable plugins carry the button in the main list, while
|
The tab renders one flat list of every entry: each card shows the real current
|
||||||
the required system plugins sit in a separate collapsible "system plugins"
|
state, a toggleable plugin carries an enable or disable button (so a
|
||||||
section with no controls.
|
bundle-default disabled plugin can be re-enabled), and a required plugin shows
|
||||||
|
only a read-only note.
|
||||||
|
|
||||||
**Guard:** every entry carries a `protected` flag. Disabling a plugin that
|
**Guard:** every entry carries a `protected` flag. The guard is default-open:
|
||||||
another plugin injects breaks the dependent, and enabling one whose service is
|
only the small `REQUIRED_PLUGINS` set in `src/required.ts` (the entry tree, the
|
||||||
unavailable fails the boot (both surfaced as `dsh-tool-ralph: pending (waiting
|
Remote RPC spine, the session and agent spines) is protected. Disabling a
|
||||||
for service: workflowEngine)` after a bad toggle). So `setEnabled` refuses to
|
plugin that another plugin injects breaks the dependent, and enabling one whose
|
||||||
**disable** a required plugin, and after **enabling** a plugin it verifies the
|
service is unavailable fails the boot (both surfaced as
|
||||||
fiber became active (reverting a dependency-missing enable). The plugin-list tab
|
`dsh-tool-ralph: pending (waiting for service: workflowEngine)` after a bad
|
||||||
groups by current state: disabled plugins sit in the main list with an enable
|
toggle). So `setEnabled` refuses to **disable** a required plugin, and after
|
||||||
button, while enabled plugins sit in a collapsible system section (a user-added
|
**enabling** a plugin it verifies the fiber became active (reverting a
|
||||||
enabled plugin keeps a disable toggle, a required one shows none).
|
dependency-missing enable). The plugin-list tab renders one flat list: a
|
||||||
|
toggleable plugin carries an enable or disable button from its real state,
|
||||||
|
while a required plugin shows only a read-only note.
|
||||||
|
|
||||||
## Persistence caveat
|
## Persistence caveat
|
||||||
|
|
||||||
|
|||||||
@@ -26,15 +26,17 @@ Web UI 的插件列表是只读的:它展示 Loader 的条目和生命周期
|
|||||||
(`include:<rowId>`);两者不同,只有裸 id 能命中 patch 的 `applyEntryPatches` 目标查找。
|
(`include:<rowId>`);两者不同,只有裸 id 能命中 patch 的 `applyEntryPatches` 目标查找。
|
||||||
|
|
||||||
Web 插件列表 tab(`ui-settings-plugin-inventory`)在每张展开卡片的详情区加启用/停用按钮,
|
Web 插件列表 tab(`ui-settings-plugin-inventory`)在每张展开卡片的详情区加启用/停用按钮,
|
||||||
绑定该 Remote,切换后重新拉取列表。列表分组:可切换插件在主列表带按钮,必需的系统插件
|
绑定该 Remote,切换后重新拉取列表。该 tab 渲染单一扁平列表,包含所有条目:每张卡片显示真实
|
||||||
放在一个可折叠的"系统插件"区,无任何开关。
|
当前状态,可切换插件带"启用"或"停用"按钮(所以 bundle 默认禁用的插件也能重新启用),
|
||||||
|
必需插件只显示只读说明。
|
||||||
|
|
||||||
**门卫:** 每条条目带 `protected` 标记。停用一个被其他插件注入的插件会破坏依赖者,
|
**门卫:** 每条条目带 `protected` 标记。守卫默认开放:只有 `src/required.ts` 中
|
||||||
启用一个服务不可用的插件会导致启动失败(坏切换后都会表现为
|
`REQUIRED_PLUGINS` 这个小型集合(入口树、Remote RPC 主干、session 与 agent 主干)受保护。
|
||||||
`dsh-tool-ralph: pending (waiting for service: workflowEngine)`)。所以 `setEnabled`
|
停用一个被其他插件注入的插件会破坏依赖者,启用一个服务不可用的插件会导致启动失败
|
||||||
拒绝**停用**必需插件;**启用**后校验 fiber 变为 active(依赖缺失的启用会回滚)。
|
(坏切换后都会表现为 `dsh-tool-ralph: pending (waiting for service: workflowEngine)`)。
|
||||||
插件列表 tab 按当前状态分组:已停用插件在主列表带"启用"按钮,已启用插件放在可折叠的
|
所以 `setEnabled` 拒绝**停用**必需插件;**启用**后校验 fiber 变为 active(依赖缺失的
|
||||||
"系统插件"区(用户自加的已启用插件保留"停用"按钮,必需插件无任何开关)。
|
启用会回滚)。插件列表 tab 渲染单一扁平列表:可切换插件按真实状态带"启用"或"停用"按钮,
|
||||||
|
必需插件只显示只读说明。
|
||||||
|
|
||||||
## 持久化注意
|
## 持久化注意
|
||||||
|
|
||||||
|
|||||||
-22
@@ -289,25 +289,3 @@
|
|||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.systemSection {
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.systemHeading {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
width: 100%;
|
|
||||||
padding: 0.5rem 0;
|
|
||||||
font-weight: 600;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.systemCount {
|
|
||||||
font-weight: 400;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
|
|||||||
+5
-28
@@ -70,7 +70,6 @@ export function PluginInventorySettingsTab({ list, setEnabled, t }: PluginInvent
|
|||||||
const [expanded, setExpanded] = useState<PluginInventoryEntry['entryId'] | null>(null)
|
const [expanded, setExpanded] = useState<PluginInventoryEntry['entryId'] | null>(null)
|
||||||
const [state, setState] = useState<ViewState>({ status: 'loading' })
|
const [state, setState] = useState<ViewState>({ status: 'loading' })
|
||||||
const [busy, setBusy] = useState<PluginInventoryEntry['entryId'] | null>(null)
|
const [busy, setBusy] = useState<PluginInventoryEntry['entryId'] | null>(null)
|
||||||
const [systemOpen, setSystemOpen] = useState(true)
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let current = true
|
let current = true
|
||||||
@@ -98,11 +97,9 @@ export function PluginInventorySettingsTab({ list, setEnabled, t }: PluginInvent
|
|||||||
: [],
|
: [],
|
||||||
[normalizedQuery, state],
|
[normalizedQuery, state],
|
||||||
)
|
)
|
||||||
// Disabled plugins sit in the main list with an enable toggle so they can be
|
// One flat list carries every plugin: each shows its real state with an
|
||||||
// re-enabled; enabled plugins are grouped into a collapsible system section
|
// enable or disable button, while a required plugin shows only the required
|
||||||
// (a user-added enabled plugin still carries a disable toggle).
|
// note (it cannot be toggled).
|
||||||
const userEntries = filteredEntries.filter(entry => !entry.enabled)
|
|
||||||
const systemEntries = filteredEntries.filter(entry => entry.enabled)
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (expanded !== null && !filteredEntries.some(entry => entry.entryId === expanded)) {
|
if (expanded !== null && !filteredEntries.some(entry => entry.entryId === expanded)) {
|
||||||
@@ -230,31 +227,11 @@ export function PluginInventorySettingsTab({ list, setEnabled, t }: PluginInvent
|
|||||||
{state.snapshot.entries.length > 0 && filteredEntries.length === 0
|
{state.snapshot.entries.length > 0 && filteredEntries.length === 0
|
||||||
? <p className={css.status}>{t('emptySearch')}</p>
|
? <p className={css.status}>{t('emptySearch')}</p>
|
||||||
: null}
|
: null}
|
||||||
{userEntries.length > 0 ? (
|
{filteredEntries.length > 0 ? (
|
||||||
<ul className={css.cards}>
|
<ul className={css.cards}>
|
||||||
{userEntries.map(card)}
|
{filteredEntries.map(card)}
|
||||||
</ul>
|
</ul>
|
||||||
) : null}
|
) : null}
|
||||||
{systemEntries.length > 0 ? (
|
|
||||||
<section className={css.systemSection} aria-labelledby={`${catalogId}-system-heading`}>
|
|
||||||
<button
|
|
||||||
className={css.systemHeading}
|
|
||||||
type="button"
|
|
||||||
id={`${catalogId}-system-heading`}
|
|
||||||
aria-expanded={systemOpen}
|
|
||||||
onClick={() => { setSystemOpen(current => !current) }}
|
|
||||||
>
|
|
||||||
<span>{t('systemPlugins')}</span>
|
|
||||||
<span className={css.systemCount}>{systemEntries.length}</span>
|
|
||||||
<IconChevronDownOutline14 className={css.chevron} size={12} aria-hidden="true" />
|
|
||||||
</button>
|
|
||||||
{systemOpen ? (
|
|
||||||
<ul className={css.cards}>
|
|
||||||
{systemEntries.map(card)}
|
|
||||||
</ul>
|
|
||||||
) : null}
|
|
||||||
</section>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ export const zh = {
|
|||||||
disable: '停用',
|
disable: '停用',
|
||||||
toggling: '切换中…',
|
toggling: '切换中…',
|
||||||
required: '应用必需插件,不可切换',
|
required: '应用必需插件,不可切换',
|
||||||
systemPlugins: '系统插件',
|
|
||||||
} satisfies Record<string, string>
|
} satisfies Record<string, string>
|
||||||
|
|
||||||
/** Plugin inventory locale key union. */
|
/** Plugin inventory locale key union. */
|
||||||
@@ -54,5 +53,4 @@ export const en = {
|
|||||||
disable: 'Disable',
|
disable: 'Disable',
|
||||||
toggling: 'Toggling…',
|
toggling: 'Toggling…',
|
||||||
required: 'Required by the app; cannot be toggled',
|
required: 'Required by the app; cannot be toggled',
|
||||||
systemPlugins: 'System plugins',
|
|
||||||
} satisfies Record<PluginInventoryLocaleKey, string>
|
} satisfies Record<PluginInventoryLocaleKey, string>
|
||||||
|
|||||||
@@ -78,6 +78,35 @@ describe('PluginInventorySettingsTab', () => {
|
|||||||
expect(screen.queryByText(en.unobserved)).toBeNull()
|
expect(screen.queryByText(en.unobserved)).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('renders every plugin in one flat list, toggling by state and guarding required plugins', async () => {
|
||||||
|
const grouped = {
|
||||||
|
entries: [
|
||||||
|
{ entryId: 'recog', moduleName: '@deepseek-ai/dsh-image-recognition', enabled: true, protected: false, fiberPhase: 'active' },
|
||||||
|
{ entryId: 'recog-http', moduleName: '@deepseek-ai/dsh-image-recognition-http', enabled: false, protected: false, fiberPhase: null },
|
||||||
|
{ entryId: 'hmr', moduleName: '@deepseek-ai/cordis-plugin-hmr', enabled: true, protected: true, fiberPhase: 'active' },
|
||||||
|
],
|
||||||
|
} as unknown as Snapshot
|
||||||
|
render(<PluginInventorySettingsTab {...props(async () => grouped)} />)
|
||||||
|
|
||||||
|
// No separate system section: all three entries share one flat list.
|
||||||
|
expect(screen.queryByText('System plugins')).toBeNull()
|
||||||
|
expect((await screen.findByRole('searchbox', { name: en.search })).getAttribute('aria-label')).toBeTruthy()
|
||||||
|
expect(screen.getAllByRole('listitem')).toHaveLength(3)
|
||||||
|
|
||||||
|
// A toggleable enabled plugin carries a disable button.
|
||||||
|
fireEvent.click(screen.getByRole('button', { name: 'image-recognition, Mounted, Enabled' }))
|
||||||
|
expect(screen.getByRole('button', { name: en.disable })).toBeTruthy()
|
||||||
|
|
||||||
|
// A toggleable disabled plugin carries an enable button.
|
||||||
|
fireEvent.click(screen.getByRole('button', { name: 'image-recognition-http, Disabled' }))
|
||||||
|
expect(screen.getByRole('button', { name: en.enable })).toBeTruthy()
|
||||||
|
|
||||||
|
// A required plugin shows the required note, never a toggle.
|
||||||
|
fireEvent.click(screen.getByRole('button', { name: 'hmr, Mounted, Enabled' }))
|
||||||
|
expect(screen.getByText(en.required)).toBeTruthy()
|
||||||
|
expect(screen.queryByRole('button', { name: en.disable })).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
it('filters by module name or Loader entry id', async () => {
|
it('filters by module name or Loader entry id', async () => {
|
||||||
render(<PluginInventorySettingsTab {...props(async () => SNAPSHOT)} />)
|
render(<PluginInventorySettingsTab {...props(async () => SNAPSHOT)} />)
|
||||||
const search = await screen.findByRole('searchbox', { name: en.search })
|
const search = await screen.findByRole('searchbox', { name: en.search })
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Host projection of the current Cordis Loader tree with per-plugin enable/disable
|
|||||||
|
|
||||||
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, or event stream. `setEnabled` toggles one entry live through `ctx.loader.update` and persists an explicit `disabled` override into the profile's user patch layer so the choice survives a restart (a bundle-default disable needs the `disabled: false` override to stick).
|
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, or event stream. `setEnabled` toggles one entry live through `ctx.loader.update` and persists an explicit `disabled` override into the profile's user patch layer so the choice survives a restart (a bundle-default disable needs the `disabled: false` override to stick).
|
||||||
|
|
||||||
Every entry carries a `protected` flag. The guard is default-protect: every shipped plugin is required by the application (disabling one that another plugin injects breaks the dependent; enabling one whose service is unavailable fails the boot), so `setEnabled` refuses them and the UI hides the toggle. Only plugins a deployment adds through an opt-in bundle (`USER_TOGGLEABLE_PLUGINS` in `src/required.ts`) are toggleable. The Web plugin-list tab groups the inventory by current state: disabled plugins sit in the main list with an enable button (so they can be re-enabled), while enabled plugins sit in a collapsible "system plugins" section — a user-added enabled plugin keeps a disable toggle, a required one shows none. Its public payload types live under `./types`, and Typert generates the Host and Client Remote artifacts exposed by `./typert` and `./remote`.
|
Every entry carries a `protected` flag. The guard is default-open: every plugin is toggleable unless its module name is in the small `REQUIRED_PLUGINS` set in `src/required.ts` — the load-bearing core (the entry tree, the Remote RPC spine, the session and agent spines) that must never be disabled. `setEnabled` refuses to disable a required plugin and, after enabling, verifies the fiber becomes active (reverting a dependency-missing enable). The Web plugin-list tab renders one flat list of every entry: each shows its real enabled state, a toggleable plugin carries an enable or disable button (so a bundle-default-disabled plugin can be re-enabled), and a required plugin shows only a read-only note. Its public payload types live under `./types`, and Typert generates the Host and Client Remote artifacts exposed by `./typert` and `./remote`.
|
||||||
|
|
||||||
The service is Remote-only and deliberately declares no same-process Cordis `Context` merge. Client packages consume it through the explicit [`api-remotes`](../../api/remotes/README.md) assembly rather than importing the Host implementation.
|
The service is Remote-only and deliberately declares no same-process Cordis `Context` merge. Client packages consume it through the explicit [`api-remotes`](../../api/remotes/README.md) assembly rather than importing the Host implementation.
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
阶段为 `pending`、`loading`、`active`、`failed` 或 `unloading`;条目没有存活的根 Fiber 时则为 `null`。该快照刻意只表示调用当下:Loader 仍是唯一的生命周期权威,本包不拥有缓存、历史、来源模型或事件流。`setEnabled` 通过 `ctx.loader.update` 实时切换单条条目,并把显式 `disabled` 覆盖写进 profile 的用户补丁层,使选择在重启后保留(bundle 默认禁用的行需要 `disabled: false` 覆盖才能保持启用)。
|
阶段为 `pending`、`loading`、`active`、`failed` 或 `unloading`;条目没有存活的根 Fiber 时则为 `null`。该快照刻意只表示调用当下:Loader 仍是唯一的生命周期权威,本包不拥有缓存、历史、来源模型或事件流。`setEnabled` 通过 `ctx.loader.update` 实时切换单条条目,并把显式 `disabled` 覆盖写进 profile 的用户补丁层,使选择在重启后保留(bundle 默认禁用的行需要 `disabled: false` 覆盖才能保持启用)。
|
||||||
|
|
||||||
每条条目带 `protected` 标记。守卫默认保护:所有随包插件都是应用必需(停用一个被其他插件注入的插件会破坏依赖者;启用一个服务不可用的插件会导致启动失败),所以 `setEnabled` 拒绝它们、UI 隐藏开关。只有部署通过 opt-in bundle 添加的插件(`src/required.ts` 的 `USER_TOGGLEABLE_PLUGINS`)可切换。Web 插件列表 tab 按当前状态分组:已停用插件在主列表带"启用"按钮(可重新启用),已启用插件放在可折叠的"系统插件"区——用户自加的已启用插件仍保留"停用"按钮,必需插件则无任何开关。公开 payload 类型位于 `./types`,Typert 生成由 `./typert` 与 `./remote` 导出的 Host 和 Client Remote 产物。
|
每条条目带 `protected` 标记。守卫默认开放:除 `src/required.ts` 中 `REQUIRED_PLUGINS` 这个小型集合(入口树、Remote RPC 主干、session 与 agent 主干等必须保留的核心)外,所有插件都可切换。`setEnabled` 拒绝停用必需插件;启用后会校验 fiber 变为 active(依赖缺失的启用会回滚)。Web 插件列表 tab 渲染单一扁平列表,包含所有条目:每项按真实启用状态显示,可切换插件带"启用"或"停用"按钮(这样 bundle 默认禁用的插件也能重新启用),必需插件只显示只读说明。公开 payload 类型位于 `./types`,Typert 生成由 `./typert` 与 `./remote` 导出的 Host 和 Client Remote 产物。
|
||||||
|
|
||||||
该服务仅供 Remote 使用,刻意不声明同进程 Cordis `Context` merge。Client 包通过显式的 [`api-remotes`](../../api/remotes/README.md) 组合消费它,而不导入 Host 实现。
|
该服务仅供 Remote 使用,刻意不声明同进程 Cordis `Context` merge。Client 包通过显式的 [`api-remotes`](../../api/remotes/README.md) 组合消费它,而不导入 Host 实现。
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
/**
|
/**
|
||||||
* Which Loader plugins the running application requires and must not be toggled.
|
* Which Loader plugins the running application requires and must not be toggled.
|
||||||
*
|
*
|
||||||
* The guard is a default-protect rule: every shipped/known plugin is required by
|
* The guard is default-open: every plugin is toggleable unless it is explicitly
|
||||||
* the application, so toggling it can tear the process down — disabling a plugin
|
* listed as required. Only the few load-bearing core plugins that other plugins
|
||||||
* that another plugin injects breaks the dependent, and enabling one whose
|
* inject and whose disable would tear the process or the management surface
|
||||||
* service is unavailable fails the boot. Only plugins a deployment explicitly
|
* down are surfaced as `protected`. Add a module name to
|
||||||
* adds through an opt-in bundle (the "user/extra" plugins) are safe to enable or
|
* {@link REQUIRED_PLUGINS} when a plugin must never be disabled.
|
||||||
* disable. Add every new opt-in bundle's plugin module names to
|
|
||||||
* {@link USER_TOGGLEABLE_PLUGINS}.
|
|
||||||
* @module @deepseek-ai/dsh-plugin-inventory/required
|
* @module @deepseek-ai/dsh-plugin-inventory/required
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin module names a deployment may enable or disable. Every other module is
|
* Plugin module names that are required by the application and must not be
|
||||||
* required by the application and surfaced as `protected`. Extend this set when
|
* toggled. Everything else is toggleable. Keep this to the true core: the entry
|
||||||
* a new opt-in bundle adds plugins the UI should let the user toggle.
|
* tree, the Remote RPC spine every Remote depends on, and the session/agent
|
||||||
|
* spines. `cordis:required` is a test seam for the unit tests.
|
||||||
*/
|
*/
|
||||||
const USER_TOGGLEABLE_PLUGINS = new Set([
|
const REQUIRED_PLUGINS = new Set([
|
||||||
'@deepseek-ai/dsh-image-recognition',
|
'@deepseek-ai/cordis-plugin-loader',
|
||||||
'@deepseek-ai/dsh-image-recognition-http',
|
'@deepseek-ai/dsh-typert-registry',
|
||||||
'@deepseek-ai/dsh-tool-image-recognition',
|
'@deepseek-ai/dsh-typert-loader',
|
||||||
// Test seam: a `cordis:` builtin the unit tests use as a toggleable entry.
|
'@deepseek-ai/dsh-session',
|
||||||
'cordis:user-toggleable',
|
'@deepseek-ai/dsh-agent',
|
||||||
|
// Test seam: a `cordis:` builtin the unit tests use as a required entry.
|
||||||
|
'cordis:required',
|
||||||
])
|
])
|
||||||
|
|
||||||
/** Whether a Loader module is required by the application and must not be toggled. */
|
/** Whether a Loader module is required by the application and must not be toggled. */
|
||||||
export function isRequiredPlugin(moduleName: string): boolean {
|
export function isRequiredPlugin(moduleName: string): boolean {
|
||||||
return !USER_TOGGLEABLE_PLUGINS.has(moduleName)
|
return REQUIRED_PLUGINS.has(moduleName)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ async function harness(): Promise<{
|
|||||||
ctx.loader.builtins.pending = pendingPlugin
|
ctx.loader.builtins.pending = pendingPlugin
|
||||||
// `cordis:` builtins the toggle tests create; they resolve without a package install.
|
// `cordis:` builtins the toggle tests create; they resolve without a package install.
|
||||||
ctx.loader.builtins['user-toggleable'] = activePlugin
|
ctx.loader.builtins['user-toggleable'] = activePlugin
|
||||||
ctx.loader.builtins['host-webserver'] = activePlugin
|
ctx.loader.builtins['required'] = activePlugin
|
||||||
await ctx.plugin(PluginInventoryGateway)
|
await ctx.plugin(PluginInventoryGateway)
|
||||||
const inventory = ctx.get('pluginInventory') as PluginInventoryGateway
|
const inventory = ctx.get('pluginInventory') as PluginInventoryGateway
|
||||||
return { ctx, inventory }
|
return { ctx, inventory }
|
||||||
@@ -63,7 +63,7 @@ describe('PluginInventoryGateway', () => {
|
|||||||
|
|
||||||
it('setEnabled refuses a required plugin', async () => {
|
it('setEnabled refuses a required plugin', async () => {
|
||||||
const { ctx, inventory } = await harness()
|
const { ctx, inventory } = await harness()
|
||||||
const id = await ctx.loader.create({ name: 'cordis:host-webserver' }) as PluginEntryId
|
const id = await ctx.loader.create({ name: 'cordis:required' }) as PluginEntryId
|
||||||
expect(inventory.list().entries.find(entry => entry.entryId === id)?.protected).toBe(true)
|
expect(inventory.list().entries.find(entry => entry.entryId === id)?.protected).toBe(true)
|
||||||
await expect(inventory.setEnabled(id, false)).rejects.toThrow(/required by the application/)
|
await expect(inventory.setEnabled(id, false)).rejects.toThrow(/required by the application/)
|
||||||
expect(inventory.list().entries.find(entry => entry.entryId === id)?.enabled).toBe(true)
|
expect(inventory.list().entries.find(entry => entry.entryId === id)?.enabled).toBe(true)
|
||||||
@@ -86,21 +86,21 @@ describe('PluginInventoryGateway', () => {
|
|||||||
entryId: activeId,
|
entryId: activeId,
|
||||||
moduleName: 'cordis:active',
|
moduleName: 'cordis:active',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
protected: true,
|
protected: false,
|
||||||
fiberPhase: 'active',
|
fiberPhase: 'active',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
entryId: pendingId,
|
entryId: pendingId,
|
||||||
moduleName: 'cordis:pending',
|
moduleName: 'cordis:pending',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
protected: true,
|
protected: false,
|
||||||
fiberPhase: 'pending',
|
fiberPhase: 'pending',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
entryId: disabledId,
|
entryId: disabledId,
|
||||||
moduleName: 'cordis:not-installed',
|
moduleName: 'cordis:not-installed',
|
||||||
enabled: false,
|
enabled: false,
|
||||||
protected: true,
|
protected: false,
|
||||||
fiberPhase: null,
|
fiberPhase: null,
|
||||||
},
|
},
|
||||||
]))
|
]))
|
||||||
@@ -110,7 +110,7 @@ describe('PluginInventoryGateway', () => {
|
|||||||
entryId: activeId,
|
entryId: activeId,
|
||||||
moduleName: 'cordis:active',
|
moduleName: 'cordis:active',
|
||||||
enabled: false,
|
enabled: false,
|
||||||
protected: true,
|
protected: false,
|
||||||
fiberPhase: null,
|
fiberPhase: null,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user