mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-29 13:09:46 +00:00
refactor(core): split out instance and route through workspaces (#19335)
This commit is contained in:
parent
e528ed5d86
commit
a76be695c7
8 changed files with 622 additions and 598 deletions
|
|
@ -411,6 +411,113 @@ export class Auth extends HeyApiClient {
|
|||
}
|
||||
}
|
||||
|
||||
export class App extends HeyApiClient {
|
||||
/**
|
||||
* Write log
|
||||
*
|
||||
* Write a log entry to the server logs with specified level and metadata.
|
||||
*/
|
||||
public log<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
service?: string
|
||||
level?: "debug" | "info" | "error" | "warn"
|
||||
message?: string
|
||||
extra?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
{ in: "body", key: "service" },
|
||||
{ in: "body", key: "level" },
|
||||
{ in: "body", key: "message" },
|
||||
{ in: "body", key: "extra" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).post<AppLogResponses, AppLogErrors, ThrowOnError>({
|
||||
url: "/log",
|
||||
...options,
|
||||
...params,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
...params.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List agents
|
||||
*
|
||||
* Get a list of all available AI agents in the OpenCode system.
|
||||
*/
|
||||
public agents<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<AppAgentsResponses, unknown, ThrowOnError>({
|
||||
url: "/agent",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List skills
|
||||
*
|
||||
* Get a list of all available skills in the OpenCode system.
|
||||
*/
|
||||
public skills<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<AppSkillsResponses, unknown, ThrowOnError>({
|
||||
url: "/skill",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Project extends HeyApiClient {
|
||||
/**
|
||||
* List all projects
|
||||
|
|
@ -3773,113 +3880,6 @@ export class Command extends HeyApiClient {
|
|||
}
|
||||
}
|
||||
|
||||
export class App extends HeyApiClient {
|
||||
/**
|
||||
* Write log
|
||||
*
|
||||
* Write a log entry to the server logs with specified level and metadata.
|
||||
*/
|
||||
public log<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
service?: string
|
||||
level?: "debug" | "info" | "error" | "warn"
|
||||
message?: string
|
||||
extra?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
{ in: "body", key: "service" },
|
||||
{ in: "body", key: "level" },
|
||||
{ in: "body", key: "message" },
|
||||
{ in: "body", key: "extra" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).post<AppLogResponses, AppLogErrors, ThrowOnError>({
|
||||
url: "/log",
|
||||
...options,
|
||||
...params,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
...params.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List agents
|
||||
*
|
||||
* Get a list of all available AI agents in the OpenCode system.
|
||||
*/
|
||||
public agents<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<AppAgentsResponses, unknown, ThrowOnError>({
|
||||
url: "/agent",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List skills
|
||||
*
|
||||
* Get a list of all available skills in the OpenCode system.
|
||||
*/
|
||||
public skills<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "directory" },
|
||||
{ in: "query", key: "workspace" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<AppSkillsResponses, unknown, ThrowOnError>({
|
||||
url: "/skill",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Lsp extends HeyApiClient {
|
||||
/**
|
||||
* Get LSP status
|
||||
|
|
@ -3962,6 +3962,11 @@ export class OpencodeClient extends HeyApiClient {
|
|||
return (this._auth ??= new Auth({ client: this.client }))
|
||||
}
|
||||
|
||||
private _app?: App
|
||||
get app(): App {
|
||||
return (this._app ??= new App({ client: this.client }))
|
||||
}
|
||||
|
||||
private _project?: Project
|
||||
get project(): Project {
|
||||
return (this._project ??= new Project({ client: this.client }))
|
||||
|
|
@ -4062,11 +4067,6 @@ export class OpencodeClient extends HeyApiClient {
|
|||
return (this._command ??= new Command({ client: this.client }))
|
||||
}
|
||||
|
||||
private _app?: App
|
||||
get app(): App {
|
||||
return (this._app ??= new App({ client: this.client }))
|
||||
}
|
||||
|
||||
private _lsp?: Lsp
|
||||
get lsp(): Lsp {
|
||||
return (this._lsp ??= new Lsp({ client: this.client }))
|
||||
|
|
|
|||
|
|
@ -2249,6 +2249,53 @@ export type AuthSetResponses = {
|
|||
|
||||
export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses]
|
||||
|
||||
export type AppLogData = {
|
||||
body?: {
|
||||
/**
|
||||
* Service name for the log entry
|
||||
*/
|
||||
service: string
|
||||
/**
|
||||
* Log level
|
||||
*/
|
||||
level: "debug" | "info" | "error" | "warn"
|
||||
/**
|
||||
* Log message
|
||||
*/
|
||||
message: string
|
||||
/**
|
||||
* Additional metadata for the log entry
|
||||
*/
|
||||
extra?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
path?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
}
|
||||
url: "/log"
|
||||
}
|
||||
|
||||
export type AppLogErrors = {
|
||||
/**
|
||||
* Bad request
|
||||
*/
|
||||
400: BadRequestError
|
||||
}
|
||||
|
||||
export type AppLogError = AppLogErrors[keyof AppLogErrors]
|
||||
|
||||
export type AppLogResponses = {
|
||||
/**
|
||||
* Log entry written successfully
|
||||
*/
|
||||
200: boolean
|
||||
}
|
||||
|
||||
export type AppLogResponse = AppLogResponses[keyof AppLogResponses]
|
||||
|
||||
export type ProjectListData = {
|
||||
body?: never
|
||||
path?: never
|
||||
|
|
@ -5036,53 +5083,6 @@ export type CommandListResponses = {
|
|||
|
||||
export type CommandListResponse = CommandListResponses[keyof CommandListResponses]
|
||||
|
||||
export type AppLogData = {
|
||||
body?: {
|
||||
/**
|
||||
* Service name for the log entry
|
||||
*/
|
||||
service: string
|
||||
/**
|
||||
* Log level
|
||||
*/
|
||||
level: "debug" | "info" | "error" | "warn"
|
||||
/**
|
||||
* Log message
|
||||
*/
|
||||
message: string
|
||||
/**
|
||||
* Additional metadata for the log entry
|
||||
*/
|
||||
extra?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
path?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
}
|
||||
url: "/log"
|
||||
}
|
||||
|
||||
export type AppLogErrors = {
|
||||
/**
|
||||
* Bad request
|
||||
*/
|
||||
400: BadRequestError
|
||||
}
|
||||
|
||||
export type AppLogError = AppLogErrors[keyof AppLogErrors]
|
||||
|
||||
export type AppLogResponses = {
|
||||
/**
|
||||
* Log entry written successfully
|
||||
*/
|
||||
200: boolean
|
||||
}
|
||||
|
||||
export type AppLogResponse = AppLogResponses[keyof AppLogResponses]
|
||||
|
||||
export type AppAgentsData = {
|
||||
body?: never
|
||||
path?: never
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue