Merge branch 'feat/plugin-mgmt-2-manager' into feat/plugin-mgmt-3-settings

This commit is contained in:
Yichen Jiang committed 2026-09-05 17:04:29 +08:00
commit 19c2bcb887
1 file changed
+15 -14
@@ -3,7 +3,7 @@ import { Context, FiberState, type Plugin } from '@deepseek-ai/cordis'
import Loader from '@deepseek-ai/cordis-plugin-loader'
import { remoteMethods } from '@deepseek-ai/dsh-typert-protocol'
import type { AgentPresets } from '@deepseek-ai/dsh-agent-presets'
import { ensurePluginFailures, type ProfileRuntime } from '@deepseek-ai/dsh-app-boot'
import { ensurePluginFailures, type ProfileRuntime, type RowOrigin } from '@deepseek-ai/dsh-app-boot'
import PluginInventoryGateway from '../src/index.ts'
const contexts: Context[] = []
@@ -99,29 +99,30 @@ describe('PluginInventoryGateway', () => {
it('attributes rows to their bundle through the profile runtime and lists recorded failures', async () => {
const { ctx, inventory } = await harness()
const versioned = await ctx.loader.create({ id: 'versioned', name: 'cordis:active' })
const bare = await ctx.loader.create({ id: 'bare', name: 'cordis:active' })
const off = await ctx.loader.create({ id: 'off', name: 'cordis:active', disabled: true })
const origins = new Map([
['versioned', { trust: 'external', packageName: 'ext', version: '1.2.3' }],
['bare', { trust: 'external', packageName: 'ext' }],
['off', { trust: 'external', packageName: 'ext' }],
// A bare Loader assigns ids; without a root include they are also the tree-wide ids.
const versioned = await ctx.loader.create({ name: 'cordis:active' })
const bare = await ctx.loader.create({ name: 'cordis:active' })
const off = await ctx.loader.create({ name: 'cordis:active', disabled: true })
const origins = new Map<string, RowOrigin>([
[versioned, { trust: 'external', packageName: 'ext', version: '1.2.3' }],
[bare, { trust: 'external', packageName: 'ext' }],
[off, { trust: 'external', packageName: 'ext' }],
['gone', { trust: 'external', packageName: 'ext' }],
] as const)
])
ctx.provide('profileRuntime', {
originOf: (rowId: string) => origins.get(rowId as never),
userDisabledRowIds: () => new Set(['off']),
originOf: (rowId: string) => origins.get(rowId),
userDisabledRowIds: () => new Set([off]),
} as Partial<ProfileRuntime> as never)
const registry = ensurePluginFailures(ctx)
registry.record({ entryId: 'gone', rowId: 'gone', moduleName: 'cordis:throws', groupId: 'bundle/ext', stage: 'apply', message: 'boom' })
// A record of a row that later mounted rides on the live entry and is not listed twice.
registry.record({ entryId: bare, rowId: 'bare', moduleName: 'cordis:active', groupId: 'bundle/ext', stage: 'import', message: 'stale' })
registry.record({ entryId: bare, rowId: bare, moduleName: 'cordis:active', groupId: 'bundle/ext', stage: 'import', message: 'stale' })
registry.record({
entryId: 'conflict:bundle/late:versioned', rowId: 'versioned', moduleName: 'late', groupId: 'bundle/late',
entryId: 'conflict:bundle/late:versioned', rowId: versioned, moduleName: 'late', groupId: 'bundle/late',
packageName: 'late', stage: 'conflict', message: 'row "versioned" is already declared by ext',
})
registry.record({
entryId: 'conflict:/home/cordis.patch.yml:bare', rowId: 'bare', moduleName: 'mine', groupId: '/home/cordis.patch.yml',
entryId: 'conflict:/home/cordis.patch.yml:bare', rowId: bare, moduleName: 'mine', groupId: '/home/cordis.patch.yml',
stage: 'conflict', message: 'row "bare" is already declared by ext',
})