Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ All notable changes to DreamCoder will be documented in this file.

### Fixed

- Plugin reloads without an active session now include user-defined and plugin-defined agents in the agent count (#301).
- The main session now tells the agent when its memory index is empty or has not been created yet (#296). Thanks @Benson-BS.
- Asking the agent to change a setting no longer fails: the `update-config` skill builds its settings reference again (#293). Thanks @KingEmma7.
- **Saving a memory no longer asks for approval every time.** Writes to the project's memory folder are allowed like the instructions say, also in bypass mode (#270).
Expand Down
20 changes: 20 additions & 0 deletions src/server/__tests__/plugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,26 @@ describe('Plugins API', () => {
expect(typeof body.summary.errors).toBe('number')
})

it('POST /api/plugins/reload counts user agents without a cwd', async () => {
const reload = async () => {
const { req, url, segments } = makeRequest('POST', '/api/plugins/reload', {})
const res = await handlePluginsApi(req, url, segments)
expect(res.status).toBe(200)
const body = await res.json() as { summary: { agents: number } }
return body.summary.agents
}

const before = await reload()
await fs.mkdir(path.join(tmpDir, 'agents'), { recursive: true })
await fs.writeFile(
path.join(tmpDir, 'agents', 'reload-count-agent.md'),
'---\nname: reload-count-agent\ndescription: Counts after a plugin reload.\n---\n\nVerify the reload count.\n',
'utf-8',
)

expect(await reload()).toBe(before + 1)
})

it('POST /api/plugins/reload hot-reloads an active CLI session and updates slash commands', async () => {
const controlRequests: Array<{ sessionId: string; request: Record<string, unknown> }> = []
conversationService.hasSession = ((sessionId: string) => sessionId === 'session-plugins') as typeof conversationService.hasSession
Expand Down
3 changes: 2 additions & 1 deletion src/server/services/pluginService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { getPluginSkills } from '../../utils/plugins/loadPluginCommands.js'
import { clearPluginCacheExclusions } from '../../utils/plugins/orphanedPluginFilter.js'
import { parseFrontmatter } from '../../utils/frontmatterParser.js'
import { extractDescriptionFromMarkdown } from '../../utils/markdownConfigLoader.js'
import { getCwd } from '../../utils/cwd.js'
import { resetSettingsCache } from '../../utils/settings/settingsCache.js'
import type {
PluginInstallationEntry,
Expand Down Expand Up @@ -240,7 +241,7 @@ export class PluginService {

const [skills, agentDefinitions] = await Promise.all([
getPluginSkills(),
getAgentDefinitionsWithOverrides(cwd),
getAgentDefinitionsWithOverrides(cwd ?? getCwd()),
])

const hookCount = await this.getHookCount(enabled)
Expand Down
Loading