fix(cli): declare the packages the shipped presets name
The bundle split emptied `apps/cli`'s plugin dependencies, and the flat module fallback links only that manifest's closure — so a preset row naming `@deepseek-ai/dsh-persona` resolved to nothing and every preset mount failed, leaving each session with an agent that had no tools, persona, or token meter. Which packages the shipped presets compose is not implied by any bundle: the presets live beside this manifest, so this is where their closure is declared. The hermetic skill test now addresses the registry through the composed agent, the only shape that can see a preset's `isolate` realm.
This commit is contained in:
@@ -3,6 +3,8 @@ import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { expect, it } from 'vitest'
|
||||
import type {} from '@deepseek-ai/dsh-skill'
|
||||
import { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import type {} from '@deepseek-ai/dsh-agent-presets'
|
||||
import { launchWebScaffold, type WebScaffold } from './scaffold.ts'
|
||||
|
||||
async function writeSkill(root: string, name: string): Promise<void> {
|
||||
@@ -37,10 +39,26 @@ it('isolates replay skill discovery from every ambient host root', async () => {
|
||||
let scaffold: WebScaffold | undefined
|
||||
try {
|
||||
scaffold = await launchWebScaffold()
|
||||
const names = (await scaffold.ctx.skills.list({ cwd: scaffold.workspaceCwd })).map(skill => skill.name)
|
||||
expect(names).not.toContain('ambient-dsh')
|
||||
expect(names).not.toContain('ambient-agents')
|
||||
expect(names).not.toContain('ambient-bundled')
|
||||
const ctx = scaffold.ctx
|
||||
// The skill registry belongs to one agent's preset, behind an `isolate`
|
||||
// realm the host cannot resolve by name — so the roots under test are only
|
||||
// reachable through a composed agent, which is also the only shape that
|
||||
// ever asks. `serviceFor` is the same addressing the gateway's `skill.list`
|
||||
// uses for a browser request about a session.
|
||||
const handle = await ctx.agents.create({
|
||||
sessionId: SessionId('hermetic-skills'),
|
||||
setup: agentCtx => ctx.agentPresets.mount(agentCtx).then(() => undefined),
|
||||
})
|
||||
try {
|
||||
const skills = ctx.agentPresets.serviceFor(handle.agent, 'skills')
|
||||
if (skills === undefined) throw new Error('composed agent mounts no skill registry')
|
||||
const names = (await skills.list({ cwd: scaffold.workspaceCwd })).map(skill => skill.name)
|
||||
expect(names).not.toContain('ambient-dsh')
|
||||
expect(names).not.toContain('ambient-agents')
|
||||
expect(names).not.toContain('ambient-bundled')
|
||||
} finally {
|
||||
await handle.dispose()
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
await scaffold?.close()
|
||||
|
||||
Reference in New Issue
Block a user