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.
116 lines
3.4 KiB
TypeScript
116 lines
3.4 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import type { AssistantProject } from '../../shared/assistant-contracts'
|
|
import {
|
|
ExecutionSpaceResolver,
|
|
REMOTE_EXECUTION_SPACE_UNAVAILABLE
|
|
} from './execution-space-resolver'
|
|
|
|
function project(
|
|
overrides: Partial<AssistantProject> = {}
|
|
): AssistantProject {
|
|
return {
|
|
id: '00000000-0000-4000-8000-000000000101',
|
|
name: 'Project',
|
|
description: '',
|
|
rootPath: 'C:\\Workspace',
|
|
executionSpace: {
|
|
kind: 'local',
|
|
rootPath: 'C:\\Workspace'
|
|
},
|
|
kind: 'user',
|
|
status: 'active',
|
|
createdAt: '2026-08-01T00:00:00.000Z',
|
|
updatedAt: '2026-08-01T00:00:00.000Z',
|
|
...overrides
|
|
}
|
|
}
|
|
|
|
describe('ExecutionSpaceResolver', () => {
|
|
it('uses a stable local cache identity without accessing the workspace', () => {
|
|
const resolver = new ExecutionSpaceResolver()
|
|
const first = resolver.resolveProject(project())
|
|
const second = resolver.resolveProject(project())
|
|
|
|
expect(first.kind).toBe('local')
|
|
expect(second.cacheIdentity).toBe(first.cacheIdentity)
|
|
expect(first.workspaceAccess).not.toBe(second.workspaceAccess)
|
|
})
|
|
|
|
it('keeps remote workspace operations unavailable without a factory', async () => {
|
|
const descriptor = new ExecutionSpaceResolver().resolveProject(
|
|
remoteProject()
|
|
)
|
|
|
|
expect(descriptor.kind).toBe('ssh')
|
|
await expect(
|
|
descriptor.workspaceAccess.listDirectory({ path: '' })
|
|
).rejects.toThrow(REMOTE_EXECUTION_SPACE_UNAVAILABLE)
|
|
})
|
|
|
|
it('binds remote access only to the configured Host and path', () => {
|
|
const workspaceAccess = {
|
|
manage: vi.fn(),
|
|
getIdentity: vi.fn(),
|
|
listDirectory: vi.fn(),
|
|
stat: vi.fn(),
|
|
readText: vi.fn(),
|
|
writeTextAtomic: vi.fn(),
|
|
search: vi.fn(),
|
|
getChanges: vi.fn(),
|
|
dispose: vi.fn()
|
|
}
|
|
const factory = {
|
|
create: vi.fn(() => workspaceAccess)
|
|
}
|
|
const resolver = new ExecutionSpaceResolver(factory)
|
|
const first = resolver.resolveProject(remoteProject())
|
|
const second = resolver.resolveProject(remoteProject())
|
|
|
|
expect(first.workspaceAccess).toBe(workspaceAccess)
|
|
expect(first.cacheIdentity).toBe(second.cacheIdentity)
|
|
expect(factory.create).toHaveBeenCalledWith({
|
|
hostId: '00000000-0000-4000-8000-000000000201',
|
|
remoteRootPath: '/srv/project'
|
|
})
|
|
})
|
|
|
|
it('changes remote identities only with stable project configuration', () => {
|
|
const resolver = new ExecutionSpaceResolver()
|
|
const first = resolver.resolveProject(remoteProject())
|
|
const nextPath = resolver.resolveProject(
|
|
remoteProject({
|
|
rootPath: '/srv/other',
|
|
executionSpace: {
|
|
kind: 'ssh',
|
|
hostId: '00000000-0000-4000-8000-000000000201',
|
|
remoteRootPath: '/srv/other'
|
|
}
|
|
})
|
|
)
|
|
const nextProject = resolver.resolveProject(
|
|
remoteProject({
|
|
id: '00000000-0000-4000-8000-000000000102'
|
|
})
|
|
)
|
|
|
|
expect(nextPath.cacheIdentity).not.toBe(first.cacheIdentity)
|
|
expect(nextProject.cacheIdentity).toBe(first.cacheIdentity)
|
|
expect(nextProject.routeIdentity).not.toBe(first.routeIdentity)
|
|
})
|
|
})
|
|
|
|
function remoteProject(
|
|
overrides: Partial<AssistantProject> = {}
|
|
): AssistantProject {
|
|
return project({
|
|
rootPath: '/srv/project',
|
|
executionSpace: {
|
|
kind: 'ssh',
|
|
hostId: '00000000-0000-4000-8000-000000000201',
|
|
remoteRootPath: '/srv/project'
|
|
},
|
|
runtimeSelection: { provider: 'opencode' },
|
|
...overrides
|
|
})
|
|
}
|