Remove Ask/Execute modes and general product tool approvals so requests use the selected runtime, enabled capabilities, and execution account permissions. Migrate retired application metadata while preserving user content. Retire the Results page while retaining conversation images and stored artifacts. Add local and remote workspace file imports, timestamps and sorting, improve image discovery and saving, and refine workspace navigation and supervision responsiveness. Include the accompanying web-search changes, tests, probes, and product documentation. Remote imports require an updated Agent. Existing artifacts are not automatically copied into project directories. Validation evidence and outstanding failures remain documented in feature progress files; no full test suite or real-model calls were rerun for this commit. Release note: Run requests without switching work modes, import files into a selected local or remote workspace folder, sort workspace files by date, and keep using conversation images after removal of the Results page.
76 lines
2.1 KiB
TypeScript
76 lines
2.1 KiB
TypeScript
import { mkdtemp, rm } from 'node:fs/promises'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
import { afterEach, expect, it } from 'vitest'
|
|
import type { ResolvedMcpServer } from '../capabilities/capability-service'
|
|
import { ModelToolProvider } from './model-tool-provider'
|
|
|
|
const temporaryDirectories: string[] = []
|
|
const crmToken = process.env.GOODBUDDY_TEST_CRM_MCP_TOKEN?.trim()
|
|
const externalTest = crmToken ? it : it.skip
|
|
|
|
afterEach(async () => {
|
|
await Promise.all(
|
|
temporaryDirectories
|
|
.splice(0)
|
|
.map((directory) =>
|
|
rm(directory, { recursive: true, force: true })
|
|
)
|
|
)
|
|
})
|
|
|
|
externalTest(
|
|
'refreshes tools from a real dynamic MCP server',
|
|
async () => {
|
|
const workspace = await mkdtemp(
|
|
join(tmpdir(), 'goodbuddy-dynamic-mcp-')
|
|
)
|
|
temporaryDirectories.push(workspace)
|
|
const server: ResolvedMcpServer = {
|
|
id: '00000000-0000-4000-8000-000000000401',
|
|
name: 'CRM',
|
|
description: '',
|
|
enabled: true,
|
|
allowDynamicTools: true,
|
|
assignments: ['model'],
|
|
secretConfigured: true,
|
|
secret: crmToken,
|
|
transport: 'http',
|
|
url: 'https://crm.digiman.live/mcp'
|
|
}
|
|
const provider = new ModelToolProvider(workspace, [server])
|
|
const signal = new AbortController().signal
|
|
const context = {
|
|
conversationId: 'dynamic-mcp-integration',
|
|
} as const
|
|
|
|
try {
|
|
const initialTools = await provider.listTools(context, signal)
|
|
const loadTool = initialTools.find(
|
|
(tool) =>
|
|
tool.displayName === 'CRM / crmtools_load_tools'
|
|
)
|
|
expect(loadTool).toBeDefined()
|
|
|
|
await provider.callTool(
|
|
loadTool?.name ?? '',
|
|
{ groups: ['opportunity'] },
|
|
signal,
|
|
context
|
|
)
|
|
|
|
const refreshedTools = await provider.listTools(context, signal)
|
|
expect(refreshedTools).toEqual(
|
|
expect.arrayContaining([
|
|
expect.objectContaining({
|
|
displayName: 'CRM / crmtools_list_opportunities'
|
|
})
|
|
])
|
|
)
|
|
} finally {
|
|
await provider.dispose()
|
|
}
|
|
},
|
|
20_000
|
|
)
|