|
|
@@ -1,7 +1,7 @@
|
|
|
/** Test-owned workspaces face: the renderer standard-kit observable plus recorded actions. */
|
|
|
import { createSnapshotStore } from '@deepseek-ai/dsh-client-runtime/client'
|
|
|
import type {
|
|
|
- IWorkspaces, SessionId, SnapshotStore, WorkspaceId, WorkspaceListState, WorkspaceView,
|
|
|
+ DirectoryListing, IWorkspaces, SessionId, SnapshotStore, WorkspaceId, WorkspaceListState, WorkspaceView,
|
|
|
} from '@deepseek-ai/dsh-client-runtime/client'
|
|
|
import { workspaceListState } from './fixtures.ts'
|
|
|
import type { Stabilizer } from './fixtures.ts'
|
|
|
@@ -109,6 +109,32 @@ export class TestWorkspaces implements IWorkspaces {
|
|
|
return null
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Browse listing (recorded). The default serves an empty home level; stub
|
|
|
+ * to shape a tree.
|
|
|
+ * @param path - absolute directory to list; absent lists the home level.
|
|
|
+ * @returns the level's listing.
|
|
|
+ */
|
|
|
+ async listDirectory(path?: string): Promise<DirectoryListing> {
|
|
|
+ this.calls.push({ method: 'listDirectory', args: [path] })
|
|
|
+ const stub = this.stubs.get('listDirectory')
|
|
|
+ if (stub !== undefined) return await (stub(path) as Promise<DirectoryListing>)
|
|
|
+ return { path: '/home/test', home: '/home/test', crumbs: [{ name: '/', path: '/', hidden: false }], entries: [] }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Browse child creation (recorded). The default joins parent and name.
|
|
|
+ * @param path - absolute existing parent directory.
|
|
|
+ * @param name - single path segment.
|
|
|
+ * @returns the created directory's absolute path.
|
|
|
+ */
|
|
|
+ async createDirectory(path: string, name: string): Promise<string> {
|
|
|
+ this.calls.push({ method: 'createDirectory', args: [path, name] })
|
|
|
+ const stub = this.stubs.get('createDirectory')
|
|
|
+ if (stub !== undefined) return await (stub(path, name) as Promise<string>)
|
|
|
+ return `${path}/${name}`
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Rename a Workspace (recorded). The default echoes a minimal view.
|
|
|
* @param workspaceId - target workspace.
|