(request: HttpServerRequest.HttpServerRequest)
| 27 | } |
| 28 | |
| 29 | function ref(request: HttpServerRequest.HttpServerRequest): Location.Ref { |
| 30 | const query = new URL(request.url, "http://localhost").searchParams |
| 31 | const workspaceID = query.get("location[workspace]") || request.headers["x-opencode-workspace"] |
| 32 | const directory = |
| 33 | query.get("location[directory]") || |
| 34 | (request.headers["x-opencode-directory"] ? decode(request.headers["x-opencode-directory"]) : process.cwd()) |
| 35 | return Location.Ref.make({ |
| 36 | directory: AbsolutePath.make(directory), |
| 37 | workspaceID: workspaceID ? WorkspaceV2.ID.make(workspaceID) : undefined, |
| 38 | }) |
| 39 | } |
| 40 | |
| 41 | function decode(input: string) { |
| 42 | try { |
no test coverage detected