(
options: { statuses?: readonly WorkspaceTurnTaskStatus[] } = {}
)
| 191 | } |
| 192 | |
| 193 | async listAllWorkspaceTurns( |
| 194 | options: { statuses?: readonly WorkspaceTurnTaskStatus[] } = {} |
| 195 | ): Promise<WorkspaceTurnTaskHandleRecord[]> { |
| 196 | let entries: Array<{ isDirectory: () => boolean; name: string }>; |
| 197 | try { |
| 198 | entries = await fsPromises.readdir(this.config.sessionsDir, { withFileTypes: true }); |
| 199 | } catch (error) { |
| 200 | if (isErrnoWithCode(error, "ENOENT")) return []; |
| 201 | throw error; |
| 202 | } |
| 203 | |
| 204 | const recordsByOwner = await Promise.all( |
| 205 | entries |
| 206 | .filter((entry) => entry.isDirectory()) |
| 207 | .map((entry) => this.listWorkspaceTurns(entry.name, options)) |
| 208 | ); |
| 209 | return recordsByOwner.flat().sort((a, b) => a.createdAt.localeCompare(b.createdAt)); |
| 210 | } |
| 211 | |
| 212 | async isWorkspaceOwnedBy(ownerWorkspaceId: string, workspaceId: string): Promise<boolean> { |
| 213 | assert(ownerWorkspaceId.trim().length > 0, "isWorkspaceOwnedBy requires ownerWorkspaceId"); |
no test coverage detected