test(agent-presets): cover the direct mountPreset boundary; refresh the module graph
The exported mountPreset carries its own unscoped-context guard beside the service's, and the per-file gate wants it exercised where it lives. The module graph regen after the master merge had been swallowed by a silenced generator run.
This commit is contained in:
@@ -10,7 +10,7 @@ import ToolRegistry from '@deepseek-ai/dsh-tools'
|
|||||||
import AgentRegistry, { assembleContextFor, type Agent } from '@deepseek-ai/dsh-agent'
|
import AgentRegistry, { assembleContextFor, type Agent } from '@deepseek-ai/dsh-agent'
|
||||||
import AgentLoop from '@deepseek-ai/dsh-agent-loop'
|
import AgentLoop from '@deepseek-ai/dsh-agent-loop'
|
||||||
import { beforeEach, describe, expect, it } from 'vitest'
|
import { beforeEach, describe, expect, it } from 'vitest'
|
||||||
import AgentPresets, { leakedServices, livePresetMounts } from '@deepseek-ai/dsh-agent-presets'
|
import AgentPresets, { leakedServices, livePresetMounts, mountPreset } from '@deepseek-ai/dsh-agent-presets'
|
||||||
|
|
||||||
const FIXTURES = join(dirname(fileURLToPath(import.meta.url)), 'fixtures')
|
const FIXTURES = join(dirname(fileURLToPath(import.meta.url)), 'fixtures')
|
||||||
const ROOTS = [
|
const ROOTS = [
|
||||||
@@ -155,6 +155,14 @@ describe('rejecting a composition that cannot be used', () => {
|
|||||||
expect(rootResolves(ctx, 'fixtureIsolatedSvc')).toBe(false)
|
expect(rootResolves(ctx, 'fixtureIsolatedSvc')).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('refuses to mount a preset directly into an unscoped context', async () => {
|
||||||
|
// The service's own mount() guards this before delegating; the exported
|
||||||
|
// function is callable on its own, so the boundary holds there too.
|
||||||
|
const preset = await ctx.agentPresets.resolve('standard')
|
||||||
|
|
||||||
|
await expect(mountPreset(ctx, preset)).rejects.toThrow(/unscoped context/)
|
||||||
|
})
|
||||||
|
|
||||||
it('reports the known ids when a preset is unknown', async () => {
|
it('reports the known ids when a preset is unknown', async () => {
|
||||||
await expect(ctx.agentPresets.resolve('nope'))
|
await expect(ctx.agentPresets.resolve('nope'))
|
||||||
.rejects.toThrow(/preset "nope" not found \(available: .*standard/)
|
.rejects.toThrow(/preset "nope" not found \(available: .*standard/)
|
||||||
|
|||||||
Reference in New Issue
Block a user