feat(opencode): add filesystem read and list routes

This commit is contained in:
Dax Raad
2026-06-02 01:54:27 -04:00
parent 0136f03fa9
commit 5937e606df
10 changed files with 414 additions and 15 deletions
+77
View File
@@ -247,6 +247,10 @@ import type {
TuiShowToastResponses,
TuiSubmitPromptErrors,
TuiSubmitPromptResponses,
V2FsListErrors,
V2FsListResponses,
V2FsReadErrors,
V2FsReadResponses,
V2ModelListErrors,
V2ModelListResponses,
V2PermissionRequestListErrors,
@@ -4727,6 +4731,74 @@ export class Permission3 extends HeyApiClient {
}
}
export class Fs extends HeyApiClient {
/**
* Read file
*
* Read one file relative to the requested location.
*/
public read<ThrowOnError extends boolean = false>(
parameters: {
location?: {
directory?: string
workspace?: string
}
path: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "query", key: "location" },
{ in: "query", key: "path" },
],
},
],
)
return (options?.client ?? this.client).get<V2FsReadResponses, V2FsReadErrors, ThrowOnError>({
url: "/api/fs/read",
...options,
...params,
})
}
/**
* List directory
*
* List direct children of one directory relative to the requested location.
*/
public list<ThrowOnError extends boolean = false>(
parameters?: {
location?: {
directory?: string
workspace?: string
}
path?: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "query", key: "location" },
{ in: "query", key: "path" },
],
},
],
)
return (options?.client ?? this.client).get<V2FsListResponses, V2FsListErrors, ThrowOnError>({
url: "/api/fs/list",
...options,
...params,
})
}
}
export class V2 extends HeyApiClient {
private _session?: Session3
get session(): Session3 {
@@ -4747,6 +4819,11 @@ export class V2 extends HeyApiClient {
get permission(): Permission3 {
return (this._permission ??= new Permission3({ client: this.client }))
}
private _fs?: Fs
get fs(): Fs {
return (this._fs ??= new Fs({ client: this.client }))
}
}
export class Control extends HeyApiClient {