chore: generate
This commit is contained in:
@@ -10,147 +10,148 @@ import { zodToJsonSchema } from "zod-to-json-schema"
|
|||||||
import { errors } from "../error"
|
import { errors } from "../error"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
export const ExperimentalRoutes = lazy(() => new Hono()
|
export const ExperimentalRoutes = lazy(() =>
|
||||||
.get(
|
new Hono()
|
||||||
"/tool/ids",
|
.get(
|
||||||
describeRoute({
|
"/tool/ids",
|
||||||
summary: "List tool IDs",
|
describeRoute({
|
||||||
description:
|
summary: "List tool IDs",
|
||||||
"Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.",
|
description:
|
||||||
operationId: "tool.ids",
|
"Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.",
|
||||||
responses: {
|
operationId: "tool.ids",
|
||||||
200: {
|
responses: {
|
||||||
description: "Tool IDs",
|
200: {
|
||||||
content: {
|
description: "Tool IDs",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(z.array(z.string()).meta({ ref: "ToolIDs" })),
|
"application/json": {
|
||||||
|
schema: resolver(z.array(z.string()).meta({ ref: "ToolIDs" })),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400),
|
||||||
},
|
},
|
||||||
...errors(400),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
async (c) => {
|
|
||||||
return c.json(await ToolRegistry.ids())
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.get(
|
|
||||||
"/tool",
|
|
||||||
describeRoute({
|
|
||||||
summary: "List tools",
|
|
||||||
description:
|
|
||||||
"Get a list of available tools with their JSON schema parameters for a specific provider and model combination.",
|
|
||||||
operationId: "tool.list",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "Tools",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(
|
|
||||||
z
|
|
||||||
.array(
|
|
||||||
z
|
|
||||||
.object({
|
|
||||||
id: z.string(),
|
|
||||||
description: z.string(),
|
|
||||||
parameters: z.any(),
|
|
||||||
})
|
|
||||||
.meta({ ref: "ToolListItem" }),
|
|
||||||
)
|
|
||||||
.meta({ ref: "ToolList" }),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...errors(400),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"query",
|
|
||||||
z.object({
|
|
||||||
provider: z.string(),
|
|
||||||
model: z.string(),
|
|
||||||
}),
|
}),
|
||||||
|
async (c) => {
|
||||||
|
return c.json(await ToolRegistry.ids())
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.get(
|
||||||
|
"/tool",
|
||||||
|
describeRoute({
|
||||||
|
summary: "List tools",
|
||||||
|
description:
|
||||||
|
"Get a list of available tools with their JSON schema parameters for a specific provider and model combination.",
|
||||||
|
operationId: "tool.list",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "Tools",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(
|
||||||
|
z
|
||||||
|
.array(
|
||||||
|
z
|
||||||
|
.object({
|
||||||
|
id: z.string(),
|
||||||
|
description: z.string(),
|
||||||
|
parameters: z.any(),
|
||||||
|
})
|
||||||
|
.meta({ ref: "ToolListItem" }),
|
||||||
|
)
|
||||||
|
.meta({ ref: "ToolList" }),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...errors(400),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
validator(
|
||||||
|
"query",
|
||||||
|
z.object({
|
||||||
|
provider: z.string(),
|
||||||
|
model: z.string(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
async (c) => {
|
||||||
|
const { provider } = c.req.valid("query")
|
||||||
|
const tools = await ToolRegistry.tools(provider)
|
||||||
|
return c.json(
|
||||||
|
tools.map((t) => ({
|
||||||
|
id: t.id,
|
||||||
|
description: t.description,
|
||||||
|
// Handle both Zod schemas and plain JSON schemas
|
||||||
|
parameters: (t.parameters as any)?._def ? zodToJsonSchema(t.parameters as any) : t.parameters,
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.post(
|
||||||
|
"/worktree",
|
||||||
|
describeRoute({
|
||||||
|
summary: "Create worktree",
|
||||||
|
description: "Create a new git worktree for the current project.",
|
||||||
|
operationId: "worktree.create",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "Worktree created",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(Worktree.Info),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...errors(400),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
validator("json", Worktree.create.schema),
|
||||||
|
async (c) => {
|
||||||
|
const body = c.req.valid("json")
|
||||||
|
const worktree = await Worktree.create(body)
|
||||||
|
return c.json(worktree)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.get(
|
||||||
|
"/worktree",
|
||||||
|
describeRoute({
|
||||||
|
summary: "List worktrees",
|
||||||
|
description: "List all sandbox worktrees for the current project.",
|
||||||
|
operationId: "worktree.list",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "List of worktree directories",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(z.array(z.string())),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
const sandboxes = await Project.sandboxes(Instance.project.id)
|
||||||
|
return c.json(sandboxes)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.get(
|
||||||
|
"/resource",
|
||||||
|
describeRoute({
|
||||||
|
summary: "Get MCP resources",
|
||||||
|
description: "Get all available MCP resources from connected servers. Optionally filter by name.",
|
||||||
|
operationId: "experimental.resource.list",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "MCP resources",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(z.record(z.string(), MCP.Resource)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
return c.json(await MCP.resources())
|
||||||
|
},
|
||||||
),
|
),
|
||||||
async (c) => {
|
|
||||||
const { provider } = c.req.valid("query")
|
|
||||||
const tools = await ToolRegistry.tools(provider)
|
|
||||||
return c.json(
|
|
||||||
tools.map((t) => ({
|
|
||||||
id: t.id,
|
|
||||||
description: t.description,
|
|
||||||
// Handle both Zod schemas and plain JSON schemas
|
|
||||||
parameters: (t.parameters as any)?._def ? zodToJsonSchema(t.parameters as any) : t.parameters,
|
|
||||||
})),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.post(
|
|
||||||
"/worktree",
|
|
||||||
describeRoute({
|
|
||||||
summary: "Create worktree",
|
|
||||||
description: "Create a new git worktree for the current project.",
|
|
||||||
operationId: "worktree.create",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "Worktree created",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(Worktree.Info),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...errors(400),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator("json", Worktree.create.schema),
|
|
||||||
async (c) => {
|
|
||||||
const body = c.req.valid("json")
|
|
||||||
const worktree = await Worktree.create(body)
|
|
||||||
return c.json(worktree)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.get(
|
|
||||||
"/worktree",
|
|
||||||
describeRoute({
|
|
||||||
summary: "List worktrees",
|
|
||||||
description: "List all sandbox worktrees for the current project.",
|
|
||||||
operationId: "worktree.list",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "List of worktree directories",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.array(z.string())),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
async (c) => {
|
|
||||||
const sandboxes = await Project.sandboxes(Instance.project.id)
|
|
||||||
return c.json(sandboxes)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.get(
|
|
||||||
"/resource",
|
|
||||||
describeRoute({
|
|
||||||
summary: "Get MCP resources",
|
|
||||||
description: "Get all available MCP resources from connected servers. Optionally filter by name.",
|
|
||||||
operationId: "experimental.resource.list",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "MCP resources",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.record(z.string(), MCP.Resource)),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
async (c) => {
|
|
||||||
return c.json(await MCP.resources())
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,190 +7,191 @@ import { LSP } from "../../lsp"
|
|||||||
import { Instance } from "../../project/instance"
|
import { Instance } from "../../project/instance"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
export const FileRoutes = lazy(() => new Hono()
|
export const FileRoutes = lazy(() =>
|
||||||
.get(
|
new Hono()
|
||||||
"/find",
|
.get(
|
||||||
describeRoute({
|
"/find",
|
||||||
summary: "Find text",
|
describeRoute({
|
||||||
description: "Search for text patterns across files in the project using ripgrep.",
|
summary: "Find text",
|
||||||
operationId: "find.text",
|
description: "Search for text patterns across files in the project using ripgrep.",
|
||||||
responses: {
|
operationId: "find.text",
|
||||||
200: {
|
responses: {
|
||||||
description: "Matches",
|
200: {
|
||||||
content: {
|
description: "Matches",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(Ripgrep.Match.shape.data.array()),
|
"application/json": {
|
||||||
|
schema: resolver(Ripgrep.Match.shape.data.array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"query",
|
|
||||||
z.object({
|
|
||||||
pattern: z.string(),
|
|
||||||
}),
|
}),
|
||||||
),
|
validator(
|
||||||
async (c) => {
|
"query",
|
||||||
const pattern = c.req.valid("query").pattern
|
z.object({
|
||||||
const result = await Ripgrep.search({
|
pattern: z.string(),
|
||||||
cwd: Instance.directory,
|
}),
|
||||||
pattern,
|
),
|
||||||
limit: 10,
|
async (c) => {
|
||||||
})
|
const pattern = c.req.valid("query").pattern
|
||||||
return c.json(result)
|
const result = await Ripgrep.search({
|
||||||
},
|
cwd: Instance.directory,
|
||||||
)
|
pattern,
|
||||||
.get(
|
limit: 10,
|
||||||
"/find/file",
|
})
|
||||||
describeRoute({
|
return c.json(result)
|
||||||
summary: "Find files",
|
},
|
||||||
description: "Search for files or directories by name or pattern in the project directory.",
|
)
|
||||||
operationId: "find.files",
|
.get(
|
||||||
responses: {
|
"/find/file",
|
||||||
200: {
|
describeRoute({
|
||||||
description: "File paths",
|
summary: "Find files",
|
||||||
content: {
|
description: "Search for files or directories by name or pattern in the project directory.",
|
||||||
"application/json": {
|
operationId: "find.files",
|
||||||
schema: resolver(z.string().array()),
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "File paths",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(z.string().array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"query",
|
|
||||||
z.object({
|
|
||||||
query: z.string(),
|
|
||||||
dirs: z.enum(["true", "false"]).optional(),
|
|
||||||
type: z.enum(["file", "directory"]).optional(),
|
|
||||||
limit: z.coerce.number().int().min(1).max(200).optional(),
|
|
||||||
}),
|
}),
|
||||||
),
|
validator(
|
||||||
async (c) => {
|
"query",
|
||||||
const query = c.req.valid("query").query
|
z.object({
|
||||||
const dirs = c.req.valid("query").dirs
|
query: z.string(),
|
||||||
const type = c.req.valid("query").type
|
dirs: z.enum(["true", "false"]).optional(),
|
||||||
const limit = c.req.valid("query").limit
|
type: z.enum(["file", "directory"]).optional(),
|
||||||
const results = await File.search({
|
limit: z.coerce.number().int().min(1).max(200).optional(),
|
||||||
query,
|
}),
|
||||||
limit: limit ?? 10,
|
),
|
||||||
dirs: dirs !== "false",
|
async (c) => {
|
||||||
type,
|
const query = c.req.valid("query").query
|
||||||
})
|
const dirs = c.req.valid("query").dirs
|
||||||
return c.json(results)
|
const type = c.req.valid("query").type
|
||||||
},
|
const limit = c.req.valid("query").limit
|
||||||
)
|
const results = await File.search({
|
||||||
.get(
|
query,
|
||||||
"/find/symbol",
|
limit: limit ?? 10,
|
||||||
describeRoute({
|
dirs: dirs !== "false",
|
||||||
summary: "Find symbols",
|
type,
|
||||||
description: "Search for workspace symbols like functions, classes, and variables using LSP.",
|
})
|
||||||
operationId: "find.symbols",
|
return c.json(results)
|
||||||
responses: {
|
},
|
||||||
200: {
|
)
|
||||||
description: "Symbols",
|
.get(
|
||||||
content: {
|
"/find/symbol",
|
||||||
"application/json": {
|
describeRoute({
|
||||||
schema: resolver(LSP.Symbol.array()),
|
summary: "Find symbols",
|
||||||
|
description: "Search for workspace symbols like functions, classes, and variables using LSP.",
|
||||||
|
operationId: "find.symbols",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "Symbols",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(LSP.Symbol.array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"query",
|
|
||||||
z.object({
|
|
||||||
query: z.string(),
|
|
||||||
}),
|
}),
|
||||||
),
|
validator(
|
||||||
async (c) => {
|
"query",
|
||||||
/*
|
z.object({
|
||||||
|
query: z.string(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
async (c) => {
|
||||||
|
/*
|
||||||
const query = c.req.valid("query").query
|
const query = c.req.valid("query").query
|
||||||
const result = await LSP.workspaceSymbol(query)
|
const result = await LSP.workspaceSymbol(query)
|
||||||
return c.json(result)
|
return c.json(result)
|
||||||
*/
|
*/
|
||||||
return c.json([])
|
return c.json([])
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.get(
|
.get(
|
||||||
"/file",
|
"/file",
|
||||||
describeRoute({
|
describeRoute({
|
||||||
summary: "List files",
|
summary: "List files",
|
||||||
description: "List files and directories in a specified path.",
|
description: "List files and directories in a specified path.",
|
||||||
operationId: "file.list",
|
operationId: "file.list",
|
||||||
responses: {
|
responses: {
|
||||||
200: {
|
200: {
|
||||||
description: "Files and directories",
|
description: "Files and directories",
|
||||||
content: {
|
content: {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
schema: resolver(File.Node.array()),
|
schema: resolver(File.Node.array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"query",
|
|
||||||
z.object({
|
|
||||||
path: z.string(),
|
|
||||||
}),
|
}),
|
||||||
),
|
validator(
|
||||||
async (c) => {
|
"query",
|
||||||
const path = c.req.valid("query").path
|
z.object({
|
||||||
const content = await File.list(path)
|
path: z.string(),
|
||||||
return c.json(content)
|
}),
|
||||||
},
|
),
|
||||||
)
|
async (c) => {
|
||||||
.get(
|
const path = c.req.valid("query").path
|
||||||
"/file/content",
|
const content = await File.list(path)
|
||||||
describeRoute({
|
return c.json(content)
|
||||||
summary: "Read file",
|
},
|
||||||
description: "Read the content of a specified file.",
|
)
|
||||||
operationId: "file.read",
|
.get(
|
||||||
responses: {
|
"/file/content",
|
||||||
200: {
|
describeRoute({
|
||||||
description: "File content",
|
summary: "Read file",
|
||||||
content: {
|
description: "Read the content of a specified file.",
|
||||||
"application/json": {
|
operationId: "file.read",
|
||||||
schema: resolver(File.Content),
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "File content",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(File.Content),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"query",
|
|
||||||
z.object({
|
|
||||||
path: z.string(),
|
|
||||||
}),
|
}),
|
||||||
),
|
validator(
|
||||||
async (c) => {
|
"query",
|
||||||
const path = c.req.valid("query").path
|
z.object({
|
||||||
const content = await File.read(path)
|
path: z.string(),
|
||||||
return c.json(content)
|
}),
|
||||||
},
|
),
|
||||||
)
|
async (c) => {
|
||||||
.get(
|
const path = c.req.valid("query").path
|
||||||
"/file/status",
|
const content = await File.read(path)
|
||||||
describeRoute({
|
return c.json(content)
|
||||||
summary: "Get file status",
|
},
|
||||||
description: "Get the git status of all files in the project.",
|
)
|
||||||
operationId: "file.status",
|
.get(
|
||||||
responses: {
|
"/file/status",
|
||||||
200: {
|
describeRoute({
|
||||||
description: "File status",
|
summary: "Get file status",
|
||||||
content: {
|
description: "Get the git status of all files in the project.",
|
||||||
"application/json": {
|
operationId: "file.status",
|
||||||
schema: resolver(File.Info.array()),
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "File status",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(File.Info.array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
const content = await File.status()
|
||||||
|
return c.json(content)
|
||||||
},
|
},
|
||||||
}),
|
),
|
||||||
async (c) => {
|
|
||||||
const content = await File.status()
|
|
||||||
return c.json(content)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,122 +13,123 @@ const log = Log.create({ service: "server" })
|
|||||||
|
|
||||||
export const GlobalDisposedEvent = BusEvent.define("global.disposed", z.object({}))
|
export const GlobalDisposedEvent = BusEvent.define("global.disposed", z.object({}))
|
||||||
|
|
||||||
export const GlobalRoutes = lazy(() => new Hono()
|
export const GlobalRoutes = lazy(() =>
|
||||||
.get(
|
new Hono()
|
||||||
"/health",
|
.get(
|
||||||
describeRoute({
|
"/health",
|
||||||
summary: "Get health",
|
describeRoute({
|
||||||
description: "Get health information about the OpenCode server.",
|
summary: "Get health",
|
||||||
operationId: "global.health",
|
description: "Get health information about the OpenCode server.",
|
||||||
responses: {
|
operationId: "global.health",
|
||||||
200: {
|
responses: {
|
||||||
description: "Health information",
|
200: {
|
||||||
content: {
|
description: "Health information",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(z.object({ healthy: z.literal(true), version: z.string() })),
|
"application/json": {
|
||||||
|
schema: resolver(z.object({ healthy: z.literal(true), version: z.string() })),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
return c.json({ healthy: true, version: Installation.VERSION })
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
async (c) => {
|
.get(
|
||||||
return c.json({ healthy: true, version: Installation.VERSION })
|
"/event",
|
||||||
},
|
describeRoute({
|
||||||
)
|
summary: "Get global events",
|
||||||
.get(
|
description: "Subscribe to global events from the OpenCode system using server-sent events.",
|
||||||
"/event",
|
operationId: "global.event",
|
||||||
describeRoute({
|
responses: {
|
||||||
summary: "Get global events",
|
200: {
|
||||||
description: "Subscribe to global events from the OpenCode system using server-sent events.",
|
description: "Event stream",
|
||||||
operationId: "global.event",
|
content: {
|
||||||
responses: {
|
"text/event-stream": {
|
||||||
200: {
|
schema: resolver(
|
||||||
description: "Event stream",
|
z
|
||||||
content: {
|
.object({
|
||||||
"text/event-stream": {
|
directory: z.string(),
|
||||||
schema: resolver(
|
payload: BusEvent.payloads(),
|
||||||
z
|
})
|
||||||
.object({
|
.meta({
|
||||||
directory: z.string(),
|
ref: "GlobalEvent",
|
||||||
payload: BusEvent.payloads(),
|
}),
|
||||||
})
|
),
|
||||||
.meta({
|
},
|
||||||
ref: "GlobalEvent",
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
}),
|
async (c) => {
|
||||||
async (c) => {
|
log.info("global event connected")
|
||||||
log.info("global event connected")
|
return streamSSE(c, async (stream) => {
|
||||||
return streamSSE(c, async (stream) => {
|
|
||||||
stream.writeSSE({
|
|
||||||
data: JSON.stringify({
|
|
||||||
payload: {
|
|
||||||
type: "server.connected",
|
|
||||||
properties: {},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
async function handler(event: any) {
|
|
||||||
await stream.writeSSE({
|
|
||||||
data: JSON.stringify(event),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
GlobalBus.on("event", handler)
|
|
||||||
|
|
||||||
// Send heartbeat every 30s to prevent WKWebView timeout (60s default)
|
|
||||||
const heartbeat = setInterval(() => {
|
|
||||||
stream.writeSSE({
|
stream.writeSSE({
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
payload: {
|
payload: {
|
||||||
type: "server.heartbeat",
|
type: "server.connected",
|
||||||
properties: {},
|
properties: {},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
}, 30000)
|
async function handler(event: any) {
|
||||||
|
await stream.writeSSE({
|
||||||
|
data: JSON.stringify(event),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
GlobalBus.on("event", handler)
|
||||||
|
|
||||||
await new Promise<void>((resolve) => {
|
// Send heartbeat every 30s to prevent WKWebView timeout (60s default)
|
||||||
stream.onAbort(() => {
|
const heartbeat = setInterval(() => {
|
||||||
clearInterval(heartbeat)
|
stream.writeSSE({
|
||||||
GlobalBus.off("event", handler)
|
data: JSON.stringify({
|
||||||
resolve()
|
payload: {
|
||||||
log.info("global event disconnected")
|
type: "server.heartbeat",
|
||||||
|
properties: {},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}, 30000)
|
||||||
|
|
||||||
|
await new Promise<void>((resolve) => {
|
||||||
|
stream.onAbort(() => {
|
||||||
|
clearInterval(heartbeat)
|
||||||
|
GlobalBus.off("event", handler)
|
||||||
|
resolve()
|
||||||
|
log.info("global event disconnected")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
},
|
||||||
},
|
)
|
||||||
)
|
.post(
|
||||||
.post(
|
"/dispose",
|
||||||
"/dispose",
|
describeRoute({
|
||||||
describeRoute({
|
summary: "Dispose instance",
|
||||||
summary: "Dispose instance",
|
description: "Clean up and dispose all OpenCode instances, releasing all resources.",
|
||||||
description: "Clean up and dispose all OpenCode instances, releasing all resources.",
|
operationId: "global.dispose",
|
||||||
operationId: "global.dispose",
|
responses: {
|
||||||
responses: {
|
200: {
|
||||||
200: {
|
description: "Global disposed",
|
||||||
description: "Global disposed",
|
content: {
|
||||||
content: {
|
"application/json": {
|
||||||
"application/json": {
|
schema: resolver(z.boolean()),
|
||||||
schema: resolver(z.boolean()),
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
await Instance.disposeAll()
|
||||||
|
GlobalBus.emit("event", {
|
||||||
|
directory: "global",
|
||||||
|
payload: {
|
||||||
|
type: GlobalDisposedEvent.type,
|
||||||
|
properties: {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return c.json(true)
|
||||||
},
|
},
|
||||||
}),
|
),
|
||||||
async (c) => {
|
|
||||||
await Instance.disposeAll()
|
|
||||||
GlobalBus.emit("event", {
|
|
||||||
directory: "global",
|
|
||||||
payload: {
|
|
||||||
type: GlobalDisposedEvent.type,
|
|
||||||
properties: {},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return c.json(true)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,219 +6,220 @@ import { Config } from "../../config/config"
|
|||||||
import { errors } from "../error"
|
import { errors } from "../error"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
export const McpRoutes = lazy(() => new Hono()
|
export const McpRoutes = lazy(() =>
|
||||||
.get(
|
new Hono()
|
||||||
"/",
|
.get(
|
||||||
describeRoute({
|
"/",
|
||||||
summary: "Get MCP status",
|
describeRoute({
|
||||||
description: "Get the status of all Model Context Protocol (MCP) servers.",
|
summary: "Get MCP status",
|
||||||
operationId: "mcp.status",
|
description: "Get the status of all Model Context Protocol (MCP) servers.",
|
||||||
responses: {
|
operationId: "mcp.status",
|
||||||
200: {
|
responses: {
|
||||||
description: "MCP server status",
|
200: {
|
||||||
content: {
|
description: "MCP server status",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(z.record(z.string(), MCP.Status)),
|
"application/json": {
|
||||||
|
schema: resolver(z.record(z.string(), MCP.Status)),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}),
|
|
||||||
async (c) => {
|
|
||||||
return c.json(await MCP.status())
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.post(
|
|
||||||
"/",
|
|
||||||
describeRoute({
|
|
||||||
summary: "Add MCP server",
|
|
||||||
description: "Dynamically add a new Model Context Protocol (MCP) server to the system.",
|
|
||||||
operationId: "mcp.add",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "MCP server added successfully",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.record(z.string(), MCP.Status)),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...errors(400),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"json",
|
|
||||||
z.object({
|
|
||||||
name: z.string(),
|
|
||||||
config: Config.Mcp,
|
|
||||||
}),
|
}),
|
||||||
),
|
async (c) => {
|
||||||
async (c) => {
|
return c.json(await MCP.status())
|
||||||
const { name, config } = c.req.valid("json")
|
},
|
||||||
const result = await MCP.add(name, config)
|
)
|
||||||
return c.json(result.status)
|
.post(
|
||||||
},
|
"/",
|
||||||
)
|
describeRoute({
|
||||||
.post(
|
summary: "Add MCP server",
|
||||||
"/:name/auth",
|
description: "Dynamically add a new Model Context Protocol (MCP) server to the system.",
|
||||||
describeRoute({
|
operationId: "mcp.add",
|
||||||
summary: "Start MCP OAuth",
|
responses: {
|
||||||
description: "Start OAuth authentication flow for a Model Context Protocol (MCP) server.",
|
200: {
|
||||||
operationId: "mcp.auth.start",
|
description: "MCP server added successfully",
|
||||||
responses: {
|
content: {
|
||||||
200: {
|
"application/json": {
|
||||||
description: "OAuth flow started",
|
schema: resolver(z.record(z.string(), MCP.Status)),
|
||||||
content: {
|
},
|
||||||
"application/json": {
|
|
||||||
schema: resolver(
|
|
||||||
z.object({
|
|
||||||
authorizationUrl: z.string().describe("URL to open in browser for authorization"),
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400),
|
||||||
},
|
},
|
||||||
...errors(400, 404),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
async (c) => {
|
|
||||||
const name = c.req.param("name")
|
|
||||||
const supportsOAuth = await MCP.supportsOAuth(name)
|
|
||||||
if (!supportsOAuth) {
|
|
||||||
return c.json({ error: `MCP server ${name} does not support OAuth` }, 400)
|
|
||||||
}
|
|
||||||
const result = await MCP.startAuth(name)
|
|
||||||
return c.json(result)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.post(
|
|
||||||
"/:name/auth/callback",
|
|
||||||
describeRoute({
|
|
||||||
summary: "Complete MCP OAuth",
|
|
||||||
description:
|
|
||||||
"Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.",
|
|
||||||
operationId: "mcp.auth.callback",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "OAuth authentication completed",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(MCP.Status),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...errors(400, 404),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"json",
|
|
||||||
z.object({
|
|
||||||
code: z.string().describe("Authorization code from OAuth callback"),
|
|
||||||
}),
|
}),
|
||||||
|
validator(
|
||||||
|
"json",
|
||||||
|
z.object({
|
||||||
|
name: z.string(),
|
||||||
|
config: Config.Mcp,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
async (c) => {
|
||||||
|
const { name, config } = c.req.valid("json")
|
||||||
|
const result = await MCP.add(name, config)
|
||||||
|
return c.json(result.status)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.post(
|
||||||
|
"/:name/auth",
|
||||||
|
describeRoute({
|
||||||
|
summary: "Start MCP OAuth",
|
||||||
|
description: "Start OAuth authentication flow for a Model Context Protocol (MCP) server.",
|
||||||
|
operationId: "mcp.auth.start",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "OAuth flow started",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(
|
||||||
|
z.object({
|
||||||
|
authorizationUrl: z.string().describe("URL to open in browser for authorization"),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...errors(400, 404),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
const name = c.req.param("name")
|
||||||
|
const supportsOAuth = await MCP.supportsOAuth(name)
|
||||||
|
if (!supportsOAuth) {
|
||||||
|
return c.json({ error: `MCP server ${name} does not support OAuth` }, 400)
|
||||||
|
}
|
||||||
|
const result = await MCP.startAuth(name)
|
||||||
|
return c.json(result)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.post(
|
||||||
|
"/:name/auth/callback",
|
||||||
|
describeRoute({
|
||||||
|
summary: "Complete MCP OAuth",
|
||||||
|
description:
|
||||||
|
"Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.",
|
||||||
|
operationId: "mcp.auth.callback",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "OAuth authentication completed",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(MCP.Status),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...errors(400, 404),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
validator(
|
||||||
|
"json",
|
||||||
|
z.object({
|
||||||
|
code: z.string().describe("Authorization code from OAuth callback"),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
async (c) => {
|
||||||
|
const name = c.req.param("name")
|
||||||
|
const { code } = c.req.valid("json")
|
||||||
|
const status = await MCP.finishAuth(name, code)
|
||||||
|
return c.json(status)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.post(
|
||||||
|
"/:name/auth/authenticate",
|
||||||
|
describeRoute({
|
||||||
|
summary: "Authenticate MCP OAuth",
|
||||||
|
description: "Start OAuth flow and wait for callback (opens browser)",
|
||||||
|
operationId: "mcp.auth.authenticate",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "OAuth authentication completed",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(MCP.Status),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...errors(400, 404),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
const name = c.req.param("name")
|
||||||
|
const supportsOAuth = await MCP.supportsOAuth(name)
|
||||||
|
if (!supportsOAuth) {
|
||||||
|
return c.json({ error: `MCP server ${name} does not support OAuth` }, 400)
|
||||||
|
}
|
||||||
|
const status = await MCP.authenticate(name)
|
||||||
|
return c.json(status)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.delete(
|
||||||
|
"/:name/auth",
|
||||||
|
describeRoute({
|
||||||
|
summary: "Remove MCP OAuth",
|
||||||
|
description: "Remove OAuth credentials for an MCP server",
|
||||||
|
operationId: "mcp.auth.remove",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "OAuth credentials removed",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(z.object({ success: z.literal(true) })),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...errors(404),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
const name = c.req.param("name")
|
||||||
|
await MCP.removeAuth(name)
|
||||||
|
return c.json({ success: true as const })
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.post(
|
||||||
|
"/:name/connect",
|
||||||
|
describeRoute({
|
||||||
|
description: "Connect an MCP server",
|
||||||
|
operationId: "mcp.connect",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "MCP server connected successfully",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(z.boolean()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
validator("param", z.object({ name: z.string() })),
|
||||||
|
async (c) => {
|
||||||
|
const { name } = c.req.valid("param")
|
||||||
|
await MCP.connect(name)
|
||||||
|
return c.json(true)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.post(
|
||||||
|
"/:name/disconnect",
|
||||||
|
describeRoute({
|
||||||
|
description: "Disconnect an MCP server",
|
||||||
|
operationId: "mcp.disconnect",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "MCP server disconnected successfully",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(z.boolean()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
validator("param", z.object({ name: z.string() })),
|
||||||
|
async (c) => {
|
||||||
|
const { name } = c.req.valid("param")
|
||||||
|
await MCP.disconnect(name)
|
||||||
|
return c.json(true)
|
||||||
|
},
|
||||||
),
|
),
|
||||||
async (c) => {
|
|
||||||
const name = c.req.param("name")
|
|
||||||
const { code } = c.req.valid("json")
|
|
||||||
const status = await MCP.finishAuth(name, code)
|
|
||||||
return c.json(status)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.post(
|
|
||||||
"/:name/auth/authenticate",
|
|
||||||
describeRoute({
|
|
||||||
summary: "Authenticate MCP OAuth",
|
|
||||||
description: "Start OAuth flow and wait for callback (opens browser)",
|
|
||||||
operationId: "mcp.auth.authenticate",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "OAuth authentication completed",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(MCP.Status),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...errors(400, 404),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
async (c) => {
|
|
||||||
const name = c.req.param("name")
|
|
||||||
const supportsOAuth = await MCP.supportsOAuth(name)
|
|
||||||
if (!supportsOAuth) {
|
|
||||||
return c.json({ error: `MCP server ${name} does not support OAuth` }, 400)
|
|
||||||
}
|
|
||||||
const status = await MCP.authenticate(name)
|
|
||||||
return c.json(status)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.delete(
|
|
||||||
"/:name/auth",
|
|
||||||
describeRoute({
|
|
||||||
summary: "Remove MCP OAuth",
|
|
||||||
description: "Remove OAuth credentials for an MCP server",
|
|
||||||
operationId: "mcp.auth.remove",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "OAuth credentials removed",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.object({ success: z.literal(true) })),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...errors(404),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
async (c) => {
|
|
||||||
const name = c.req.param("name")
|
|
||||||
await MCP.removeAuth(name)
|
|
||||||
return c.json({ success: true as const })
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.post(
|
|
||||||
"/:name/connect",
|
|
||||||
describeRoute({
|
|
||||||
description: "Connect an MCP server",
|
|
||||||
operationId: "mcp.connect",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "MCP server connected successfully",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.boolean()),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator("param", z.object({ name: z.string() })),
|
|
||||||
async (c) => {
|
|
||||||
const { name } = c.req.valid("param")
|
|
||||||
await MCP.connect(name)
|
|
||||||
return c.json(true)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.post(
|
|
||||||
"/:name/disconnect",
|
|
||||||
describeRoute({
|
|
||||||
description: "Disconnect an MCP server",
|
|
||||||
operationId: "mcp.disconnect",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "MCP server disconnected successfully",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.boolean()),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator("param", z.object({ name: z.string() })),
|
|
||||||
async (c) => {
|
|
||||||
const { name } = c.req.valid("param")
|
|
||||||
await MCP.disconnect(name)
|
|
||||||
return c.json(true)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,63 +5,64 @@ import { PermissionNext } from "@/permission/next"
|
|||||||
import { errors } from "../error"
|
import { errors } from "../error"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
export const PermissionRoutes = lazy(() => new Hono()
|
export const PermissionRoutes = lazy(() =>
|
||||||
.post(
|
new Hono()
|
||||||
"/:requestID/reply",
|
.post(
|
||||||
describeRoute({
|
"/:requestID/reply",
|
||||||
summary: "Respond to permission request",
|
describeRoute({
|
||||||
description: "Approve or deny a permission request from the AI assistant.",
|
summary: "Respond to permission request",
|
||||||
operationId: "permission.reply",
|
description: "Approve or deny a permission request from the AI assistant.",
|
||||||
responses: {
|
operationId: "permission.reply",
|
||||||
200: {
|
responses: {
|
||||||
description: "Permission processed successfully",
|
200: {
|
||||||
content: {
|
description: "Permission processed successfully",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(z.boolean()),
|
"application/json": {
|
||||||
|
schema: resolver(z.boolean()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400, 404),
|
||||||
},
|
},
|
||||||
...errors(400, 404),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"param",
|
|
||||||
z.object({
|
|
||||||
requestID: z.string(),
|
|
||||||
}),
|
}),
|
||||||
),
|
validator(
|
||||||
validator("json", z.object({ reply: PermissionNext.Reply, message: z.string().optional() })),
|
"param",
|
||||||
async (c) => {
|
z.object({
|
||||||
const params = c.req.valid("param")
|
requestID: z.string(),
|
||||||
const json = c.req.valid("json")
|
}),
|
||||||
await PermissionNext.reply({
|
),
|
||||||
requestID: params.requestID,
|
validator("json", z.object({ reply: PermissionNext.Reply, message: z.string().optional() })),
|
||||||
reply: json.reply,
|
async (c) => {
|
||||||
message: json.message,
|
const params = c.req.valid("param")
|
||||||
})
|
const json = c.req.valid("json")
|
||||||
return c.json(true)
|
await PermissionNext.reply({
|
||||||
},
|
requestID: params.requestID,
|
||||||
)
|
reply: json.reply,
|
||||||
.get(
|
message: json.message,
|
||||||
"/",
|
})
|
||||||
describeRoute({
|
return c.json(true)
|
||||||
summary: "List pending permissions",
|
},
|
||||||
description: "Get all pending permission requests across all sessions.",
|
)
|
||||||
operationId: "permission.list",
|
.get(
|
||||||
responses: {
|
"/",
|
||||||
200: {
|
describeRoute({
|
||||||
description: "List of pending permissions",
|
summary: "List pending permissions",
|
||||||
content: {
|
description: "Get all pending permission requests across all sessions.",
|
||||||
"application/json": {
|
operationId: "permission.list",
|
||||||
schema: resolver(PermissionNext.Request.array()),
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "List of pending permissions",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(PermissionNext.Request.array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
const permissions = await PermissionNext.list()
|
||||||
|
return c.json(permissions)
|
||||||
},
|
},
|
||||||
}),
|
),
|
||||||
async (c) => {
|
|
||||||
const permissions = await PermissionNext.list()
|
|
||||||
return c.json(permissions)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,75 +7,76 @@ import z from "zod"
|
|||||||
import { errors } from "../error"
|
import { errors } from "../error"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
export const ProjectRoutes = lazy(() => new Hono()
|
export const ProjectRoutes = lazy(() =>
|
||||||
.get(
|
new Hono()
|
||||||
"/",
|
.get(
|
||||||
describeRoute({
|
"/",
|
||||||
summary: "List all projects",
|
describeRoute({
|
||||||
description: "Get a list of projects that have been opened with OpenCode.",
|
summary: "List all projects",
|
||||||
operationId: "project.list",
|
description: "Get a list of projects that have been opened with OpenCode.",
|
||||||
responses: {
|
operationId: "project.list",
|
||||||
200: {
|
responses: {
|
||||||
description: "List of projects",
|
200: {
|
||||||
content: {
|
description: "List of projects",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(Project.Info.array()),
|
"application/json": {
|
||||||
|
schema: resolver(Project.Info.array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
const projects = await Project.list()
|
||||||
|
return c.json(projects)
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
async (c) => {
|
.get(
|
||||||
const projects = await Project.list()
|
"/current",
|
||||||
return c.json(projects)
|
describeRoute({
|
||||||
},
|
summary: "Get current project",
|
||||||
)
|
description: "Retrieve the currently active project that OpenCode is working with.",
|
||||||
.get(
|
operationId: "project.current",
|
||||||
"/current",
|
responses: {
|
||||||
describeRoute({
|
200: {
|
||||||
summary: "Get current project",
|
description: "Current project information",
|
||||||
description: "Retrieve the currently active project that OpenCode is working with.",
|
content: {
|
||||||
operationId: "project.current",
|
"application/json": {
|
||||||
responses: {
|
schema: resolver(Project.Info),
|
||||||
200: {
|
},
|
||||||
description: "Current project information",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(Project.Info),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
return c.json(Instance.project)
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
async (c) => {
|
.patch(
|
||||||
return c.json(Instance.project)
|
"/:projectID",
|
||||||
},
|
describeRoute({
|
||||||
)
|
summary: "Update project",
|
||||||
.patch(
|
description: "Update project properties such as name, icon and color.",
|
||||||
"/:projectID",
|
operationId: "project.update",
|
||||||
describeRoute({
|
responses: {
|
||||||
summary: "Update project",
|
200: {
|
||||||
description: "Update project properties such as name, icon and color.",
|
description: "Updated project information",
|
||||||
operationId: "project.update",
|
content: {
|
||||||
responses: {
|
"application/json": {
|
||||||
200: {
|
schema: resolver(Project.Info),
|
||||||
description: "Updated project information",
|
},
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(Project.Info),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400, 404),
|
||||||
},
|
},
|
||||||
...errors(400, 404),
|
}),
|
||||||
|
validator("param", z.object({ projectID: z.string() })),
|
||||||
|
validator("json", Project.update.schema.omit({ projectID: true })),
|
||||||
|
async (c) => {
|
||||||
|
const projectID = c.req.valid("param").projectID
|
||||||
|
const body = c.req.valid("json")
|
||||||
|
const project = await Project.update({ ...body, projectID })
|
||||||
|
return c.json(project)
|
||||||
},
|
},
|
||||||
}),
|
),
|
||||||
validator("param", z.object({ projectID: z.string() })),
|
|
||||||
validator("json", Project.update.schema.omit({ projectID: true })),
|
|
||||||
async (c) => {
|
|
||||||
const projectID = c.req.valid("param").projectID
|
|
||||||
const body = c.req.valid("json")
|
|
||||||
const project = await Project.update({ ...body, projectID })
|
|
||||||
return c.json(project)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,156 +9,157 @@ import { mapValues } from "remeda"
|
|||||||
import { errors } from "../error"
|
import { errors } from "../error"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
export const ProviderRoutes = lazy(() => new Hono()
|
export const ProviderRoutes = lazy(() =>
|
||||||
.get(
|
new Hono()
|
||||||
"/",
|
.get(
|
||||||
describeRoute({
|
"/",
|
||||||
summary: "List providers",
|
describeRoute({
|
||||||
description: "Get a list of all available AI providers, including both available and connected ones.",
|
summary: "List providers",
|
||||||
operationId: "provider.list",
|
description: "Get a list of all available AI providers, including both available and connected ones.",
|
||||||
responses: {
|
operationId: "provider.list",
|
||||||
200: {
|
responses: {
|
||||||
description: "List of providers",
|
200: {
|
||||||
content: {
|
description: "List of providers",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(
|
"application/json": {
|
||||||
z.object({
|
schema: resolver(
|
||||||
all: ModelsDev.Provider.array(),
|
z.object({
|
||||||
default: z.record(z.string(), z.string()),
|
all: ModelsDev.Provider.array(),
|
||||||
connected: z.array(z.string()),
|
default: z.record(z.string(), z.string()),
|
||||||
}),
|
connected: z.array(z.string()),
|
||||||
),
|
}),
|
||||||
|
),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
}),
|
async (c) => {
|
||||||
async (c) => {
|
const config = await Config.get()
|
||||||
const config = await Config.get()
|
const disabled = new Set(config.disabled_providers ?? [])
|
||||||
const disabled = new Set(config.disabled_providers ?? [])
|
const enabled = config.enabled_providers ? new Set(config.enabled_providers) : undefined
|
||||||
const enabled = config.enabled_providers ? new Set(config.enabled_providers) : undefined
|
|
||||||
|
|
||||||
const allProviders = await ModelsDev.get()
|
const allProviders = await ModelsDev.get()
|
||||||
const filteredProviders: Record<string, (typeof allProviders)[string]> = {}
|
const filteredProviders: Record<string, (typeof allProviders)[string]> = {}
|
||||||
for (const [key, value] of Object.entries(allProviders)) {
|
for (const [key, value] of Object.entries(allProviders)) {
|
||||||
if ((enabled ? enabled.has(key) : true) && !disabled.has(key)) {
|
if ((enabled ? enabled.has(key) : true) && !disabled.has(key)) {
|
||||||
filteredProviders[key] = value
|
filteredProviders[key] = value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const connected = await Provider.list()
|
const connected = await Provider.list()
|
||||||
const providers = Object.assign(
|
const providers = Object.assign(
|
||||||
mapValues(filteredProviders, (x) => Provider.fromModelsDevProvider(x)),
|
mapValues(filteredProviders, (x) => Provider.fromModelsDevProvider(x)),
|
||||||
connected,
|
connected,
|
||||||
)
|
)
|
||||||
return c.json({
|
return c.json({
|
||||||
all: Object.values(providers),
|
all: Object.values(providers),
|
||||||
default: mapValues(providers, (item) => Provider.sort(Object.values(item.models))[0].id),
|
default: mapValues(providers, (item) => Provider.sort(Object.values(item.models))[0].id),
|
||||||
connected: Object.keys(connected),
|
connected: Object.keys(connected),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.get(
|
.get(
|
||||||
"/auth",
|
"/auth",
|
||||||
describeRoute({
|
describeRoute({
|
||||||
summary: "Get provider auth methods",
|
summary: "Get provider auth methods",
|
||||||
description: "Retrieve available authentication methods for all AI providers.",
|
description: "Retrieve available authentication methods for all AI providers.",
|
||||||
operationId: "provider.auth",
|
operationId: "provider.auth",
|
||||||
responses: {
|
responses: {
|
||||||
200: {
|
200: {
|
||||||
description: "Provider auth methods",
|
description: "Provider auth methods",
|
||||||
content: {
|
content: {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
schema: resolver(z.record(z.string(), z.array(ProviderAuth.Method))),
|
schema: resolver(z.record(z.string(), z.array(ProviderAuth.Method))),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
return c.json(await ProviderAuth.methods())
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
async (c) => {
|
.post(
|
||||||
return c.json(await ProviderAuth.methods())
|
"/:providerID/oauth/authorize",
|
||||||
},
|
describeRoute({
|
||||||
)
|
summary: "OAuth authorize",
|
||||||
.post(
|
description: "Initiate OAuth authorization for a specific AI provider to get an authorization URL.",
|
||||||
"/:providerID/oauth/authorize",
|
operationId: "provider.oauth.authorize",
|
||||||
describeRoute({
|
responses: {
|
||||||
summary: "OAuth authorize",
|
200: {
|
||||||
description: "Initiate OAuth authorization for a specific AI provider to get an authorization URL.",
|
description: "Authorization URL and method",
|
||||||
operationId: "provider.oauth.authorize",
|
content: {
|
||||||
responses: {
|
"application/json": {
|
||||||
200: {
|
schema: resolver(ProviderAuth.Authorization.optional()),
|
||||||
description: "Authorization URL and method",
|
},
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(ProviderAuth.Authorization.optional()),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400),
|
||||||
},
|
},
|
||||||
...errors(400),
|
}),
|
||||||
|
validator(
|
||||||
|
"param",
|
||||||
|
z.object({
|
||||||
|
providerID: z.string().meta({ description: "Provider ID" }),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
validator(
|
||||||
|
"json",
|
||||||
|
z.object({
|
||||||
|
method: z.number().meta({ description: "Auth method index" }),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
async (c) => {
|
||||||
|
const providerID = c.req.valid("param").providerID
|
||||||
|
const { method } = c.req.valid("json")
|
||||||
|
const result = await ProviderAuth.authorize({
|
||||||
|
providerID,
|
||||||
|
method,
|
||||||
|
})
|
||||||
|
return c.json(result)
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
validator(
|
.post(
|
||||||
"param",
|
"/:providerID/oauth/callback",
|
||||||
z.object({
|
describeRoute({
|
||||||
providerID: z.string().meta({ description: "Provider ID" }),
|
summary: "OAuth callback",
|
||||||
}),
|
description: "Handle the OAuth callback from a provider after user authorization.",
|
||||||
),
|
operationId: "provider.oauth.callback",
|
||||||
validator(
|
responses: {
|
||||||
"json",
|
200: {
|
||||||
z.object({
|
description: "OAuth callback processed successfully",
|
||||||
method: z.number().meta({ description: "Auth method index" }),
|
content: {
|
||||||
}),
|
"application/json": {
|
||||||
),
|
schema: resolver(z.boolean()),
|
||||||
async (c) => {
|
},
|
||||||
const providerID = c.req.valid("param").providerID
|
|
||||||
const { method } = c.req.valid("json")
|
|
||||||
const result = await ProviderAuth.authorize({
|
|
||||||
providerID,
|
|
||||||
method,
|
|
||||||
})
|
|
||||||
return c.json(result)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.post(
|
|
||||||
"/:providerID/oauth/callback",
|
|
||||||
describeRoute({
|
|
||||||
summary: "OAuth callback",
|
|
||||||
description: "Handle the OAuth callback from a provider after user authorization.",
|
|
||||||
operationId: "provider.oauth.callback",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "OAuth callback processed successfully",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.boolean()),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400),
|
||||||
},
|
},
|
||||||
...errors(400),
|
}),
|
||||||
|
validator(
|
||||||
|
"param",
|
||||||
|
z.object({
|
||||||
|
providerID: z.string().meta({ description: "Provider ID" }),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
validator(
|
||||||
|
"json",
|
||||||
|
z.object({
|
||||||
|
method: z.number().meta({ description: "Auth method index" }),
|
||||||
|
code: z.string().optional().meta({ description: "OAuth authorization code" }),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
async (c) => {
|
||||||
|
const providerID = c.req.valid("param").providerID
|
||||||
|
const { method, code } = c.req.valid("json")
|
||||||
|
await ProviderAuth.callback({
|
||||||
|
providerID,
|
||||||
|
method,
|
||||||
|
code,
|
||||||
|
})
|
||||||
|
return c.json(true)
|
||||||
},
|
},
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"param",
|
|
||||||
z.object({
|
|
||||||
providerID: z.string().meta({ description: "Provider ID" }),
|
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
validator(
|
|
||||||
"json",
|
|
||||||
z.object({
|
|
||||||
method: z.number().meta({ description: "Auth method index" }),
|
|
||||||
code: z.string().optional().meta({ description: "OAuth authorization code" }),
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
async (c) => {
|
|
||||||
const providerID = c.req.valid("param").providerID
|
|
||||||
const { method, code } = c.req.valid("json")
|
|
||||||
await ProviderAuth.callback({
|
|
||||||
providerID,
|
|
||||||
method,
|
|
||||||
code,
|
|
||||||
})
|
|
||||||
return c.json(true)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,162 +7,163 @@ import { Storage } from "../../storage/storage"
|
|||||||
import { errors } from "../error"
|
import { errors } from "../error"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
export const PtyRoutes = lazy(() => new Hono()
|
export const PtyRoutes = lazy(() =>
|
||||||
.get(
|
new Hono()
|
||||||
"/",
|
.get(
|
||||||
describeRoute({
|
"/",
|
||||||
summary: "List PTY sessions",
|
describeRoute({
|
||||||
description: "Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.",
|
summary: "List PTY sessions",
|
||||||
operationId: "pty.list",
|
description: "Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.",
|
||||||
responses: {
|
operationId: "pty.list",
|
||||||
200: {
|
responses: {
|
||||||
description: "List of sessions",
|
200: {
|
||||||
content: {
|
description: "List of sessions",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(Pty.Info.array()),
|
"application/json": {
|
||||||
|
schema: resolver(Pty.Info.array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
|
async (c) => {
|
||||||
|
return c.json(Pty.list())
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
async (c) => {
|
.post(
|
||||||
return c.json(Pty.list())
|
"/",
|
||||||
},
|
describeRoute({
|
||||||
)
|
summary: "Create PTY session",
|
||||||
.post(
|
description: "Create a new pseudo-terminal (PTY) session for running shell commands and processes.",
|
||||||
"/",
|
operationId: "pty.create",
|
||||||
describeRoute({
|
responses: {
|
||||||
summary: "Create PTY session",
|
200: {
|
||||||
description: "Create a new pseudo-terminal (PTY) session for running shell commands and processes.",
|
description: "Created session",
|
||||||
operationId: "pty.create",
|
content: {
|
||||||
responses: {
|
"application/json": {
|
||||||
200: {
|
schema: resolver(Pty.Info),
|
||||||
description: "Created session",
|
},
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(Pty.Info),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400),
|
||||||
},
|
},
|
||||||
...errors(400),
|
}),
|
||||||
|
validator("json", Pty.CreateInput),
|
||||||
|
async (c) => {
|
||||||
|
const info = await Pty.create(c.req.valid("json"))
|
||||||
|
return c.json(info)
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
validator("json", Pty.CreateInput),
|
.get(
|
||||||
async (c) => {
|
"/:ptyID",
|
||||||
const info = await Pty.create(c.req.valid("json"))
|
describeRoute({
|
||||||
return c.json(info)
|
summary: "Get PTY session",
|
||||||
},
|
description: "Retrieve detailed information about a specific pseudo-terminal (PTY) session.",
|
||||||
)
|
operationId: "pty.get",
|
||||||
.get(
|
responses: {
|
||||||
"/:ptyID",
|
200: {
|
||||||
describeRoute({
|
description: "Session info",
|
||||||
summary: "Get PTY session",
|
content: {
|
||||||
description: "Retrieve detailed information about a specific pseudo-terminal (PTY) session.",
|
"application/json": {
|
||||||
operationId: "pty.get",
|
schema: resolver(Pty.Info),
|
||||||
responses: {
|
},
|
||||||
200: {
|
|
||||||
description: "Session info",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(Pty.Info),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(404),
|
||||||
},
|
},
|
||||||
...errors(404),
|
}),
|
||||||
|
validator("param", z.object({ ptyID: z.string() })),
|
||||||
|
async (c) => {
|
||||||
|
const info = Pty.get(c.req.valid("param").ptyID)
|
||||||
|
if (!info) {
|
||||||
|
throw new Storage.NotFoundError({ message: "Session not found" })
|
||||||
|
}
|
||||||
|
return c.json(info)
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
validator("param", z.object({ ptyID: z.string() })),
|
.put(
|
||||||
async (c) => {
|
"/:ptyID",
|
||||||
const info = Pty.get(c.req.valid("param").ptyID)
|
describeRoute({
|
||||||
if (!info) {
|
summary: "Update PTY session",
|
||||||
throw new Storage.NotFoundError({ message: "Session not found" })
|
description: "Update properties of an existing pseudo-terminal (PTY) session.",
|
||||||
}
|
operationId: "pty.update",
|
||||||
return c.json(info)
|
responses: {
|
||||||
},
|
200: {
|
||||||
)
|
description: "Updated session",
|
||||||
.put(
|
content: {
|
||||||
"/:ptyID",
|
"application/json": {
|
||||||
describeRoute({
|
schema: resolver(Pty.Info),
|
||||||
summary: "Update PTY session",
|
},
|
||||||
description: "Update properties of an existing pseudo-terminal (PTY) session.",
|
|
||||||
operationId: "pty.update",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "Updated session",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(Pty.Info),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400),
|
||||||
},
|
},
|
||||||
...errors(400),
|
}),
|
||||||
|
validator("param", z.object({ ptyID: z.string() })),
|
||||||
|
validator("json", Pty.UpdateInput),
|
||||||
|
async (c) => {
|
||||||
|
const info = await Pty.update(c.req.valid("param").ptyID, c.req.valid("json"))
|
||||||
|
return c.json(info)
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
validator("param", z.object({ ptyID: z.string() })),
|
.delete(
|
||||||
validator("json", Pty.UpdateInput),
|
"/:ptyID",
|
||||||
async (c) => {
|
describeRoute({
|
||||||
const info = await Pty.update(c.req.valid("param").ptyID, c.req.valid("json"))
|
summary: "Remove PTY session",
|
||||||
return c.json(info)
|
description: "Remove and terminate a specific pseudo-terminal (PTY) session.",
|
||||||
},
|
operationId: "pty.remove",
|
||||||
)
|
responses: {
|
||||||
.delete(
|
200: {
|
||||||
"/:ptyID",
|
description: "Session removed",
|
||||||
describeRoute({
|
content: {
|
||||||
summary: "Remove PTY session",
|
"application/json": {
|
||||||
description: "Remove and terminate a specific pseudo-terminal (PTY) session.",
|
schema: resolver(z.boolean()),
|
||||||
operationId: "pty.remove",
|
},
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "Session removed",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.boolean()),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(404),
|
||||||
},
|
},
|
||||||
...errors(404),
|
}),
|
||||||
|
validator("param", z.object({ ptyID: z.string() })),
|
||||||
|
async (c) => {
|
||||||
|
await Pty.remove(c.req.valid("param").ptyID)
|
||||||
|
return c.json(true)
|
||||||
},
|
},
|
||||||
}),
|
)
|
||||||
validator("param", z.object({ ptyID: z.string() })),
|
.get(
|
||||||
async (c) => {
|
"/:ptyID/connect",
|
||||||
await Pty.remove(c.req.valid("param").ptyID)
|
describeRoute({
|
||||||
return c.json(true)
|
summary: "Connect to PTY session",
|
||||||
},
|
description: "Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.",
|
||||||
)
|
operationId: "pty.connect",
|
||||||
.get(
|
responses: {
|
||||||
"/:ptyID/connect",
|
200: {
|
||||||
describeRoute({
|
description: "Connected session",
|
||||||
summary: "Connect to PTY session",
|
content: {
|
||||||
description: "Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.",
|
"application/json": {
|
||||||
operationId: "pty.connect",
|
schema: resolver(z.boolean()),
|
||||||
responses: {
|
},
|
||||||
200: {
|
|
||||||
description: "Connected session",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.boolean()),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(404),
|
||||||
},
|
},
|
||||||
...errors(404),
|
}),
|
||||||
},
|
validator("param", z.object({ ptyID: z.string() })),
|
||||||
}),
|
upgradeWebSocket((c) => {
|
||||||
validator("param", z.object({ ptyID: z.string() })),
|
const id = c.req.param("ptyID")
|
||||||
upgradeWebSocket((c) => {
|
let handler: ReturnType<typeof Pty.connect>
|
||||||
const id = c.req.param("ptyID")
|
if (!Pty.get(id)) throw new Error("Session not found")
|
||||||
let handler: ReturnType<typeof Pty.connect>
|
return {
|
||||||
if (!Pty.get(id)) throw new Error("Session not found")
|
onOpen(_event, ws) {
|
||||||
return {
|
handler = Pty.connect(id, ws)
|
||||||
onOpen(_event, ws) {
|
},
|
||||||
handler = Pty.connect(id, ws)
|
onMessage(event) {
|
||||||
},
|
handler?.onMessage(String(event.data))
|
||||||
onMessage(event) {
|
},
|
||||||
handler?.onMessage(String(event.data))
|
onClose() {
|
||||||
},
|
handler?.onClose()
|
||||||
onClose() {
|
},
|
||||||
handler?.onClose()
|
}
|
||||||
},
|
}),
|
||||||
}
|
),
|
||||||
}),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,92 +6,93 @@ import z from "zod"
|
|||||||
import { errors } from "../error"
|
import { errors } from "../error"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
export const QuestionRoutes = lazy(() => new Hono()
|
export const QuestionRoutes = lazy(() =>
|
||||||
.get(
|
new Hono()
|
||||||
"/",
|
.get(
|
||||||
describeRoute({
|
"/",
|
||||||
summary: "List pending questions",
|
describeRoute({
|
||||||
description: "Get all pending question requests across all sessions.",
|
summary: "List pending questions",
|
||||||
operationId: "question.list",
|
description: "Get all pending question requests across all sessions.",
|
||||||
responses: {
|
operationId: "question.list",
|
||||||
200: {
|
responses: {
|
||||||
description: "List of pending questions",
|
200: {
|
||||||
content: {
|
description: "List of pending questions",
|
||||||
"application/json": {
|
content: {
|
||||||
schema: resolver(Question.Request.array()),
|
"application/json": {
|
||||||
|
schema: resolver(Question.Request.array()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}),
|
|
||||||
async (c) => {
|
|
||||||
const questions = await Question.list()
|
|
||||||
return c.json(questions)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.post(
|
|
||||||
"/:requestID/reply",
|
|
||||||
describeRoute({
|
|
||||||
summary: "Reply to question request",
|
|
||||||
description: "Provide answers to a question request from the AI assistant.",
|
|
||||||
operationId: "question.reply",
|
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "Question answered successfully",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.boolean()),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...errors(400, 404),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"param",
|
|
||||||
z.object({
|
|
||||||
requestID: z.string(),
|
|
||||||
}),
|
}),
|
||||||
),
|
async (c) => {
|
||||||
validator("json", Question.Reply),
|
const questions = await Question.list()
|
||||||
async (c) => {
|
return c.json(questions)
|
||||||
const params = c.req.valid("param")
|
},
|
||||||
const json = c.req.valid("json")
|
)
|
||||||
await Question.reply({
|
.post(
|
||||||
requestID: params.requestID,
|
"/:requestID/reply",
|
||||||
answers: json.answers,
|
describeRoute({
|
||||||
})
|
summary: "Reply to question request",
|
||||||
return c.json(true)
|
description: "Provide answers to a question request from the AI assistant.",
|
||||||
},
|
operationId: "question.reply",
|
||||||
)
|
responses: {
|
||||||
.post(
|
200: {
|
||||||
"/:requestID/reject",
|
description: "Question answered successfully",
|
||||||
describeRoute({
|
content: {
|
||||||
summary: "Reject question request",
|
"application/json": {
|
||||||
description: "Reject a question request from the AI assistant.",
|
schema: resolver(z.boolean()),
|
||||||
operationId: "question.reject",
|
},
|
||||||
responses: {
|
|
||||||
200: {
|
|
||||||
description: "Question rejected successfully",
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: resolver(z.boolean()),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...errors(400, 404),
|
||||||
},
|
},
|
||||||
...errors(400, 404),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
validator(
|
|
||||||
"param",
|
|
||||||
z.object({
|
|
||||||
requestID: z.string(),
|
|
||||||
}),
|
}),
|
||||||
|
validator(
|
||||||
|
"param",
|
||||||
|
z.object({
|
||||||
|
requestID: z.string(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
validator("json", Question.Reply),
|
||||||
|
async (c) => {
|
||||||
|
const params = c.req.valid("param")
|
||||||
|
const json = c.req.valid("json")
|
||||||
|
await Question.reply({
|
||||||
|
requestID: params.requestID,
|
||||||
|
answers: json.answers,
|
||||||
|
})
|
||||||
|
return c.json(true)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.post(
|
||||||
|
"/:requestID/reject",
|
||||||
|
describeRoute({
|
||||||
|
summary: "Reject question request",
|
||||||
|
description: "Reject a question request from the AI assistant.",
|
||||||
|
operationId: "question.reject",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "Question rejected successfully",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: resolver(z.boolean()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...errors(400, 404),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
validator(
|
||||||
|
"param",
|
||||||
|
z.object({
|
||||||
|
requestID: z.string(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
async (c) => {
|
||||||
|
const params = c.req.valid("param")
|
||||||
|
await Question.reject(params.requestID)
|
||||||
|
return c.json(true)
|
||||||
|
},
|
||||||
),
|
),
|
||||||
async (c) => {
|
|
||||||
const params = c.req.valid("param")
|
|
||||||
await Question.reject(params.requestID)
|
|
||||||
return c.json(true)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import type {
|
|||||||
AppAgentsResponses,
|
AppAgentsResponses,
|
||||||
AppLogErrors,
|
AppLogErrors,
|
||||||
AppLogResponses,
|
AppLogResponses,
|
||||||
|
AppSkillsResponses,
|
||||||
Auth as Auth3,
|
Auth as Auth3,
|
||||||
AuthSetErrors,
|
AuthSetErrors,
|
||||||
AuthSetResponses,
|
AuthSetResponses,
|
||||||
@@ -100,7 +101,6 @@ import type {
|
|||||||
SessionCreateResponses,
|
SessionCreateResponses,
|
||||||
SessionDeleteErrors,
|
SessionDeleteErrors,
|
||||||
SessionDeleteResponses,
|
SessionDeleteResponses,
|
||||||
SessionDiffErrors,
|
|
||||||
SessionDiffResponses,
|
SessionDiffResponses,
|
||||||
SessionForkResponses,
|
SessionForkResponses,
|
||||||
SessionGetErrors,
|
SessionGetErrors,
|
||||||
@@ -653,48 +653,6 @@ export class Tool extends HeyApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Instance extends HeyApiClient {
|
|
||||||
/**
|
|
||||||
* Dispose instance
|
|
||||||
*
|
|
||||||
* Clean up and dispose the current OpenCode instance, releasing all resources.
|
|
||||||
*/
|
|
||||||
public dispose<ThrowOnError extends boolean = false>(
|
|
||||||
parameters?: {
|
|
||||||
directory?: string
|
|
||||||
},
|
|
||||||
options?: Options<never, ThrowOnError>,
|
|
||||||
) {
|
|
||||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
||||||
return (options?.client ?? this.client).post<InstanceDisposeResponses, unknown, ThrowOnError>({
|
|
||||||
url: "/instance/dispose",
|
|
||||||
...options,
|
|
||||||
...params,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Path extends HeyApiClient {
|
|
||||||
/**
|
|
||||||
* Get paths
|
|
||||||
*
|
|
||||||
* Retrieve the current working directory and related path information for the OpenCode instance.
|
|
||||||
*/
|
|
||||||
public get<ThrowOnError extends boolean = false>(
|
|
||||||
parameters?: {
|
|
||||||
directory?: string
|
|
||||||
},
|
|
||||||
options?: Options<never, ThrowOnError>,
|
|
||||||
) {
|
|
||||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
||||||
return (options?.client ?? this.client).get<PathGetResponses, unknown, ThrowOnError>({
|
|
||||||
url: "/path",
|
|
||||||
...options,
|
|
||||||
...params,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Worktree extends HeyApiClient {
|
export class Worktree extends HeyApiClient {
|
||||||
/**
|
/**
|
||||||
* List worktrees
|
* List worktrees
|
||||||
@@ -751,27 +709,34 @@ export class Worktree extends HeyApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Vcs extends HeyApiClient {
|
export class Resource extends HeyApiClient {
|
||||||
/**
|
/**
|
||||||
* Get VCS info
|
* Get MCP resources
|
||||||
*
|
*
|
||||||
* Retrieve version control system (VCS) information for the current project, such as git branch.
|
* Get all available MCP resources from connected servers. Optionally filter by name.
|
||||||
*/
|
*/
|
||||||
public get<ThrowOnError extends boolean = false>(
|
public list<ThrowOnError extends boolean = false>(
|
||||||
parameters?: {
|
parameters?: {
|
||||||
directory?: string
|
directory?: string
|
||||||
},
|
},
|
||||||
options?: Options<never, ThrowOnError>,
|
options?: Options<never, ThrowOnError>,
|
||||||
) {
|
) {
|
||||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
return (options?.client ?? this.client).get<VcsGetResponses, unknown, ThrowOnError>({
|
return (options?.client ?? this.client).get<ExperimentalResourceListResponses, unknown, ThrowOnError>({
|
||||||
url: "/vcs",
|
url: "/experimental/resource",
|
||||||
...options,
|
...options,
|
||||||
...params,
|
...params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class Experimental extends HeyApiClient {
|
||||||
|
private _resource?: Resource
|
||||||
|
get resource(): Resource {
|
||||||
|
return (this._resource ??= new Resource({ client: this.client }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Session extends HeyApiClient {
|
export class Session extends HeyApiClient {
|
||||||
/**
|
/**
|
||||||
* List sessions
|
* List sessions
|
||||||
@@ -1197,9 +1162,9 @@ export class Session extends HeyApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get session diff
|
* Get message diff
|
||||||
*
|
*
|
||||||
* Get all file changes (diffs) made during this session.
|
* Get the file changes (diff) that resulted from a specific user message in the session.
|
||||||
*/
|
*/
|
||||||
public diff<ThrowOnError extends boolean = false>(
|
public diff<ThrowOnError extends boolean = false>(
|
||||||
parameters: {
|
parameters: {
|
||||||
@@ -1221,7 +1186,7 @@ export class Session extends HeyApiClient {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
return (options?.client ?? this.client).get<SessionDiffResponses, SessionDiffErrors, ThrowOnError>({
|
return (options?.client ?? this.client).get<SessionDiffResponses, unknown, ThrowOnError>({
|
||||||
url: "/session/{sessionID}/diff",
|
url: "/session/{sessionID}/diff",
|
||||||
...options,
|
...options,
|
||||||
...params,
|
...params,
|
||||||
@@ -1877,27 +1842,6 @@ export class Question extends HeyApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Command extends HeyApiClient {
|
|
||||||
/**
|
|
||||||
* List commands
|
|
||||||
*
|
|
||||||
* Get a list of all available commands in the OpenCode system.
|
|
||||||
*/
|
|
||||||
public list<ThrowOnError extends boolean = false>(
|
|
||||||
parameters?: {
|
|
||||||
directory?: string
|
|
||||||
},
|
|
||||||
options?: Options<never, ThrowOnError>,
|
|
||||||
) {
|
|
||||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
||||||
return (options?.client ?? this.client).get<CommandListResponses, unknown, ThrowOnError>({
|
|
||||||
url: "/command",
|
|
||||||
...options,
|
|
||||||
...params,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Oauth extends HeyApiClient {
|
export class Oauth extends HeyApiClient {
|
||||||
/**
|
/**
|
||||||
* OAuth authorize
|
* OAuth authorize
|
||||||
@@ -2208,70 +2152,6 @@ export class File 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
|
|
||||||
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: "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
|
|
||||||
},
|
|
||||||
options?: Options<never, ThrowOnError>,
|
|
||||||
) {
|
|
||||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
||||||
return (options?.client ?? this.client).get<AppAgentsResponses, unknown, ThrowOnError>({
|
|
||||||
url: "/agent",
|
|
||||||
...options,
|
|
||||||
...params,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Auth extends HeyApiClient {
|
export class Auth extends HeyApiClient {
|
||||||
/**
|
/**
|
||||||
* Remove MCP OAuth
|
* Remove MCP OAuth
|
||||||
@@ -2522,76 +2402,6 @@ export class Mcp extends HeyApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Resource extends HeyApiClient {
|
|
||||||
/**
|
|
||||||
* Get MCP resources
|
|
||||||
*
|
|
||||||
* Get all available MCP resources from connected servers. Optionally filter by name.
|
|
||||||
*/
|
|
||||||
public list<ThrowOnError extends boolean = false>(
|
|
||||||
parameters?: {
|
|
||||||
directory?: string
|
|
||||||
},
|
|
||||||
options?: Options<never, ThrowOnError>,
|
|
||||||
) {
|
|
||||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
||||||
return (options?.client ?? this.client).get<ExperimentalResourceListResponses, unknown, ThrowOnError>({
|
|
||||||
url: "/experimental/resource",
|
|
||||||
...options,
|
|
||||||
...params,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Experimental extends HeyApiClient {
|
|
||||||
private _resource?: Resource
|
|
||||||
get resource(): Resource {
|
|
||||||
return (this._resource ??= new Resource({ client: this.client }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Lsp extends HeyApiClient {
|
|
||||||
/**
|
|
||||||
* Get LSP status
|
|
||||||
*
|
|
||||||
* Get LSP server status
|
|
||||||
*/
|
|
||||||
public status<ThrowOnError extends boolean = false>(
|
|
||||||
parameters?: {
|
|
||||||
directory?: string
|
|
||||||
},
|
|
||||||
options?: Options<never, ThrowOnError>,
|
|
||||||
) {
|
|
||||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
||||||
return (options?.client ?? this.client).get<LspStatusResponses, unknown, ThrowOnError>({
|
|
||||||
url: "/lsp",
|
|
||||||
...options,
|
|
||||||
...params,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Formatter extends HeyApiClient {
|
|
||||||
/**
|
|
||||||
* Get formatter status
|
|
||||||
*
|
|
||||||
* Get formatter status
|
|
||||||
*/
|
|
||||||
public status<ThrowOnError extends boolean = false>(
|
|
||||||
parameters?: {
|
|
||||||
directory?: string
|
|
||||||
},
|
|
||||||
options?: Options<never, ThrowOnError>,
|
|
||||||
) {
|
|
||||||
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
|
||||||
return (options?.client ?? this.client).get<FormatterStatusResponses, unknown, ThrowOnError>({
|
|
||||||
url: "/formatter",
|
|
||||||
...options,
|
|
||||||
...params,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Control extends HeyApiClient {
|
export class Control extends HeyApiClient {
|
||||||
/**
|
/**
|
||||||
* Get next TUI request
|
* Get next TUI request
|
||||||
@@ -2930,6 +2740,215 @@ export class Tui extends HeyApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class Instance extends HeyApiClient {
|
||||||
|
/**
|
||||||
|
* Dispose instance
|
||||||
|
*
|
||||||
|
* Clean up and dispose the current OpenCode instance, releasing all resources.
|
||||||
|
*/
|
||||||
|
public dispose<ThrowOnError extends boolean = false>(
|
||||||
|
parameters?: {
|
||||||
|
directory?: string
|
||||||
|
},
|
||||||
|
options?: Options<never, ThrowOnError>,
|
||||||
|
) {
|
||||||
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
|
return (options?.client ?? this.client).post<InstanceDisposeResponses, unknown, ThrowOnError>({
|
||||||
|
url: "/instance/dispose",
|
||||||
|
...options,
|
||||||
|
...params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Path extends HeyApiClient {
|
||||||
|
/**
|
||||||
|
* Get paths
|
||||||
|
*
|
||||||
|
* Retrieve the current working directory and related path information for the OpenCode instance.
|
||||||
|
*/
|
||||||
|
public get<ThrowOnError extends boolean = false>(
|
||||||
|
parameters?: {
|
||||||
|
directory?: string
|
||||||
|
},
|
||||||
|
options?: Options<never, ThrowOnError>,
|
||||||
|
) {
|
||||||
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
|
return (options?.client ?? this.client).get<PathGetResponses, unknown, ThrowOnError>({
|
||||||
|
url: "/path",
|
||||||
|
...options,
|
||||||
|
...params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Vcs extends HeyApiClient {
|
||||||
|
/**
|
||||||
|
* Get VCS info
|
||||||
|
*
|
||||||
|
* Retrieve version control system (VCS) information for the current project, such as git branch.
|
||||||
|
*/
|
||||||
|
public get<ThrowOnError extends boolean = false>(
|
||||||
|
parameters?: {
|
||||||
|
directory?: string
|
||||||
|
},
|
||||||
|
options?: Options<never, ThrowOnError>,
|
||||||
|
) {
|
||||||
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
|
return (options?.client ?? this.client).get<VcsGetResponses, unknown, ThrowOnError>({
|
||||||
|
url: "/vcs",
|
||||||
|
...options,
|
||||||
|
...params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Command extends HeyApiClient {
|
||||||
|
/**
|
||||||
|
* List commands
|
||||||
|
*
|
||||||
|
* Get a list of all available commands in the OpenCode system.
|
||||||
|
*/
|
||||||
|
public list<ThrowOnError extends boolean = false>(
|
||||||
|
parameters?: {
|
||||||
|
directory?: string
|
||||||
|
},
|
||||||
|
options?: Options<never, ThrowOnError>,
|
||||||
|
) {
|
||||||
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
|
return (options?.client ?? this.client).get<CommandListResponses, unknown, ThrowOnError>({
|
||||||
|
url: "/command",
|
||||||
|
...options,
|
||||||
|
...params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
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: "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
|
||||||
|
},
|
||||||
|
options?: Options<never, ThrowOnError>,
|
||||||
|
) {
|
||||||
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
|
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
|
||||||
|
},
|
||||||
|
options?: Options<never, ThrowOnError>,
|
||||||
|
) {
|
||||||
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
|
return (options?.client ?? this.client).get<AppSkillsResponses, unknown, ThrowOnError>({
|
||||||
|
url: "/skill",
|
||||||
|
...options,
|
||||||
|
...params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Lsp extends HeyApiClient {
|
||||||
|
/**
|
||||||
|
* Get LSP status
|
||||||
|
*
|
||||||
|
* Get LSP server status
|
||||||
|
*/
|
||||||
|
public status<ThrowOnError extends boolean = false>(
|
||||||
|
parameters?: {
|
||||||
|
directory?: string
|
||||||
|
},
|
||||||
|
options?: Options<never, ThrowOnError>,
|
||||||
|
) {
|
||||||
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
|
return (options?.client ?? this.client).get<LspStatusResponses, unknown, ThrowOnError>({
|
||||||
|
url: "/lsp",
|
||||||
|
...options,
|
||||||
|
...params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Formatter extends HeyApiClient {
|
||||||
|
/**
|
||||||
|
* Get formatter status
|
||||||
|
*
|
||||||
|
* Get formatter status
|
||||||
|
*/
|
||||||
|
public status<ThrowOnError extends boolean = false>(
|
||||||
|
parameters?: {
|
||||||
|
directory?: string
|
||||||
|
},
|
||||||
|
options?: Options<never, ThrowOnError>,
|
||||||
|
) {
|
||||||
|
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
|
||||||
|
return (options?.client ?? this.client).get<FormatterStatusResponses, unknown, ThrowOnError>({
|
||||||
|
url: "/formatter",
|
||||||
|
...options,
|
||||||
|
...params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Auth2 extends HeyApiClient {
|
export class Auth2 extends HeyApiClient {
|
||||||
/**
|
/**
|
||||||
* Set auth credentials
|
* Set auth credentials
|
||||||
@@ -3023,24 +3042,14 @@ export class OpencodeClient extends HeyApiClient {
|
|||||||
return (this._tool ??= new Tool({ client: this.client }))
|
return (this._tool ??= new Tool({ client: this.client }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private _instance?: Instance
|
|
||||||
get instance(): Instance {
|
|
||||||
return (this._instance ??= new Instance({ client: this.client }))
|
|
||||||
}
|
|
||||||
|
|
||||||
private _path?: Path
|
|
||||||
get path(): Path {
|
|
||||||
return (this._path ??= new Path({ client: this.client }))
|
|
||||||
}
|
|
||||||
|
|
||||||
private _worktree?: Worktree
|
private _worktree?: Worktree
|
||||||
get worktree(): Worktree {
|
get worktree(): Worktree {
|
||||||
return (this._worktree ??= new Worktree({ client: this.client }))
|
return (this._worktree ??= new Worktree({ client: this.client }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private _vcs?: Vcs
|
private _experimental?: Experimental
|
||||||
get vcs(): Vcs {
|
get experimental(): Experimental {
|
||||||
return (this._vcs ??= new Vcs({ client: this.client }))
|
return (this._experimental ??= new Experimental({ client: this.client }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private _session?: Session
|
private _session?: Session
|
||||||
@@ -3063,11 +3072,6 @@ export class OpencodeClient extends HeyApiClient {
|
|||||||
return (this._question ??= new Question({ client: this.client }))
|
return (this._question ??= new Question({ client: this.client }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private _command?: Command
|
|
||||||
get command(): Command {
|
|
||||||
return (this._command ??= new Command({ client: this.client }))
|
|
||||||
}
|
|
||||||
|
|
||||||
private _provider?: Provider
|
private _provider?: Provider
|
||||||
get provider(): Provider {
|
get provider(): Provider {
|
||||||
return (this._provider ??= new Provider({ client: this.client }))
|
return (this._provider ??= new Provider({ client: this.client }))
|
||||||
@@ -3083,19 +3087,39 @@ export class OpencodeClient extends HeyApiClient {
|
|||||||
return (this._file ??= new File({ client: this.client }))
|
return (this._file ??= new File({ client: this.client }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private _app?: App
|
|
||||||
get app(): App {
|
|
||||||
return (this._app ??= new App({ client: this.client }))
|
|
||||||
}
|
|
||||||
|
|
||||||
private _mcp?: Mcp
|
private _mcp?: Mcp
|
||||||
get mcp(): Mcp {
|
get mcp(): Mcp {
|
||||||
return (this._mcp ??= new Mcp({ client: this.client }))
|
return (this._mcp ??= new Mcp({ client: this.client }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private _experimental?: Experimental
|
private _tui?: Tui
|
||||||
get experimental(): Experimental {
|
get tui(): Tui {
|
||||||
return (this._experimental ??= new Experimental({ client: this.client }))
|
return (this._tui ??= new Tui({ client: this.client }))
|
||||||
|
}
|
||||||
|
|
||||||
|
private _instance?: Instance
|
||||||
|
get instance(): Instance {
|
||||||
|
return (this._instance ??= new Instance({ client: this.client }))
|
||||||
|
}
|
||||||
|
|
||||||
|
private _path?: Path
|
||||||
|
get path(): Path {
|
||||||
|
return (this._path ??= new Path({ client: this.client }))
|
||||||
|
}
|
||||||
|
|
||||||
|
private _vcs?: Vcs
|
||||||
|
get vcs(): Vcs {
|
||||||
|
return (this._vcs ??= new Vcs({ client: this.client }))
|
||||||
|
}
|
||||||
|
|
||||||
|
private _command?: Command
|
||||||
|
get command(): Command {
|
||||||
|
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
|
private _lsp?: Lsp
|
||||||
@@ -3108,11 +3132,6 @@ export class OpencodeClient extends HeyApiClient {
|
|||||||
return (this._formatter ??= new Formatter({ client: this.client }))
|
return (this._formatter ??= new Formatter({ client: this.client }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private _tui?: Tui
|
|
||||||
get tui(): Tui {
|
|
||||||
return (this._tui ??= new Tui({ client: this.client }))
|
|
||||||
}
|
|
||||||
|
|
||||||
private _auth?: Auth2
|
private _auth?: Auth2
|
||||||
get auth(): Auth2 {
|
get auth(): Auth2 {
|
||||||
return (this._auth ??= new Auth2({ client: this.client }))
|
return (this._auth ??= new Auth2({ client: this.client }))
|
||||||
|
|||||||
@@ -62,6 +62,13 @@ export type EventLspUpdated = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type EventFileEdited = {
|
||||||
|
type: "file.edited"
|
||||||
|
properties: {
|
||||||
|
file: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export type FileDiff = {
|
export type FileDiff = {
|
||||||
file: string
|
file: string
|
||||||
before: string
|
before: string
|
||||||
@@ -599,13 +606,6 @@ export type EventSessionCompacted = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EventFileEdited = {
|
|
||||||
type: "file.edited"
|
|
||||||
properties: {
|
|
||||||
file: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Todo = {
|
export type Todo = {
|
||||||
/**
|
/**
|
||||||
* Brief description of the task
|
* Brief description of the task
|
||||||
@@ -843,15 +843,15 @@ export type EventPtyDeleted = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EventServerConnected = {
|
export type EventGlobalDisposed = {
|
||||||
type: "server.connected"
|
type: "global.disposed"
|
||||||
properties: {
|
properties: {
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EventGlobalDisposed = {
|
export type EventServerConnected = {
|
||||||
type: "global.disposed"
|
type: "server.connected"
|
||||||
properties: {
|
properties: {
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
@@ -864,6 +864,7 @@ export type Event =
|
|||||||
| EventServerInstanceDisposed
|
| EventServerInstanceDisposed
|
||||||
| EventLspClientDiagnostics
|
| EventLspClientDiagnostics
|
||||||
| EventLspUpdated
|
| EventLspUpdated
|
||||||
|
| EventFileEdited
|
||||||
| EventMessageUpdated
|
| EventMessageUpdated
|
||||||
| EventMessageRemoved
|
| EventMessageRemoved
|
||||||
| EventMessagePartUpdated
|
| EventMessagePartUpdated
|
||||||
@@ -876,7 +877,6 @@ export type Event =
|
|||||||
| EventQuestionReplied
|
| EventQuestionReplied
|
||||||
| EventQuestionRejected
|
| EventQuestionRejected
|
||||||
| EventSessionCompacted
|
| EventSessionCompacted
|
||||||
| EventFileEdited
|
|
||||||
| EventTodoUpdated
|
| EventTodoUpdated
|
||||||
| EventTuiPromptAppend
|
| EventTuiPromptAppend
|
||||||
| EventTuiCommandExecute
|
| EventTuiCommandExecute
|
||||||
@@ -896,8 +896,8 @@ export type Event =
|
|||||||
| EventPtyUpdated
|
| EventPtyUpdated
|
||||||
| EventPtyExited
|
| EventPtyExited
|
||||||
| EventPtyDeleted
|
| EventPtyDeleted
|
||||||
| EventServerConnected
|
|
||||||
| EventGlobalDisposed
|
| EventGlobalDisposed
|
||||||
|
| EventServerConnected
|
||||||
|
|
||||||
export type GlobalEvent = {
|
export type GlobalEvent = {
|
||||||
directory: string
|
directory: string
|
||||||
@@ -1796,98 +1796,6 @@ export type Config = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ToolIds = Array<string>
|
|
||||||
|
|
||||||
export type ToolListItem = {
|
|
||||||
id: string
|
|
||||||
description: string
|
|
||||||
parameters: unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ToolList = Array<ToolListItem>
|
|
||||||
|
|
||||||
export type Path = {
|
|
||||||
home: string
|
|
||||||
state: string
|
|
||||||
config: string
|
|
||||||
worktree: string
|
|
||||||
directory: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Worktree = {
|
|
||||||
name: string
|
|
||||||
branch: string
|
|
||||||
directory: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type WorktreeCreateInput = {
|
|
||||||
name?: string
|
|
||||||
startCommand?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type VcsInfo = {
|
|
||||||
branch: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TextPartInput = {
|
|
||||||
id?: string
|
|
||||||
type: "text"
|
|
||||||
text: string
|
|
||||||
synthetic?: boolean
|
|
||||||
ignored?: boolean
|
|
||||||
time?: {
|
|
||||||
start: number
|
|
||||||
end?: number
|
|
||||||
}
|
|
||||||
metadata?: {
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type FilePartInput = {
|
|
||||||
id?: string
|
|
||||||
type: "file"
|
|
||||||
mime: string
|
|
||||||
filename?: string
|
|
||||||
url: string
|
|
||||||
source?: FilePartSource
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AgentPartInput = {
|
|
||||||
id?: string
|
|
||||||
type: "agent"
|
|
||||||
name: string
|
|
||||||
source?: {
|
|
||||||
value: string
|
|
||||||
start: number
|
|
||||||
end: number
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SubtaskPartInput = {
|
|
||||||
id?: string
|
|
||||||
type: "subtask"
|
|
||||||
prompt: string
|
|
||||||
description: string
|
|
||||||
agent: string
|
|
||||||
model?: {
|
|
||||||
providerID: string
|
|
||||||
modelID: string
|
|
||||||
}
|
|
||||||
command?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Command = {
|
|
||||||
name: string
|
|
||||||
description?: string
|
|
||||||
agent?: string
|
|
||||||
model?: string
|
|
||||||
mcp?: boolean
|
|
||||||
template: string
|
|
||||||
subtask?: boolean
|
|
||||||
hints: Array<string>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Model = {
|
export type Model = {
|
||||||
id: string
|
id: string
|
||||||
providerID: string
|
providerID: string
|
||||||
@@ -1973,6 +1881,83 @@ export type Provider = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ToolIds = Array<string>
|
||||||
|
|
||||||
|
export type ToolListItem = {
|
||||||
|
id: string
|
||||||
|
description: string
|
||||||
|
parameters: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ToolList = Array<ToolListItem>
|
||||||
|
|
||||||
|
export type Worktree = {
|
||||||
|
name: string
|
||||||
|
branch: string
|
||||||
|
directory: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type WorktreeCreateInput = {
|
||||||
|
name?: string
|
||||||
|
startCommand?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type McpResource = {
|
||||||
|
name: string
|
||||||
|
uri: string
|
||||||
|
description?: string
|
||||||
|
mimeType?: string
|
||||||
|
client: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TextPartInput = {
|
||||||
|
id?: string
|
||||||
|
type: "text"
|
||||||
|
text: string
|
||||||
|
synthetic?: boolean
|
||||||
|
ignored?: boolean
|
||||||
|
time?: {
|
||||||
|
start: number
|
||||||
|
end?: number
|
||||||
|
}
|
||||||
|
metadata?: {
|
||||||
|
[key: string]: unknown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FilePartInput = {
|
||||||
|
id?: string
|
||||||
|
type: "file"
|
||||||
|
mime: string
|
||||||
|
filename?: string
|
||||||
|
url: string
|
||||||
|
source?: FilePartSource
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AgentPartInput = {
|
||||||
|
id?: string
|
||||||
|
type: "agent"
|
||||||
|
name: string
|
||||||
|
source?: {
|
||||||
|
value: string
|
||||||
|
start: number
|
||||||
|
end: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SubtaskPartInput = {
|
||||||
|
id?: string
|
||||||
|
type: "subtask"
|
||||||
|
prompt: string
|
||||||
|
description: string
|
||||||
|
agent: string
|
||||||
|
model?: {
|
||||||
|
providerID: string
|
||||||
|
modelID: string
|
||||||
|
}
|
||||||
|
command?: string
|
||||||
|
}
|
||||||
|
|
||||||
export type ProviderAuthMethod = {
|
export type ProviderAuthMethod = {
|
||||||
type: "oauth" | "api"
|
type: "oauth" | "api"
|
||||||
label: string
|
label: string
|
||||||
@@ -2030,27 +2015,6 @@ export type File = {
|
|||||||
status: "added" | "deleted" | "modified"
|
status: "added" | "deleted" | "modified"
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Agent = {
|
|
||||||
name: string
|
|
||||||
description?: string
|
|
||||||
mode: "subagent" | "primary" | "all"
|
|
||||||
native?: boolean
|
|
||||||
hidden?: boolean
|
|
||||||
topP?: number
|
|
||||||
temperature?: number
|
|
||||||
color?: string
|
|
||||||
permission: PermissionRuleset
|
|
||||||
model?: {
|
|
||||||
modelID: string
|
|
||||||
providerID: string
|
|
||||||
}
|
|
||||||
prompt?: string
|
|
||||||
options: {
|
|
||||||
[key: string]: unknown
|
|
||||||
}
|
|
||||||
steps?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export type McpStatusConnected = {
|
export type McpStatusConnected = {
|
||||||
status: "connected"
|
status: "connected"
|
||||||
}
|
}
|
||||||
@@ -2080,12 +2044,48 @@ export type McpStatus =
|
|||||||
| McpStatusNeedsAuth
|
| McpStatusNeedsAuth
|
||||||
| McpStatusNeedsClientRegistration
|
| McpStatusNeedsClientRegistration
|
||||||
|
|
||||||
export type McpResource = {
|
export type Path = {
|
||||||
|
home: string
|
||||||
|
state: string
|
||||||
|
config: string
|
||||||
|
worktree: string
|
||||||
|
directory: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type VcsInfo = {
|
||||||
|
branch: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Command = {
|
||||||
name: string
|
name: string
|
||||||
uri: string
|
|
||||||
description?: string
|
description?: string
|
||||||
mimeType?: string
|
agent?: string
|
||||||
client: string
|
model?: string
|
||||||
|
mcp?: boolean
|
||||||
|
template: string
|
||||||
|
subtask?: boolean
|
||||||
|
hints: Array<string>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Agent = {
|
||||||
|
name: string
|
||||||
|
description?: string
|
||||||
|
mode: "subagent" | "primary" | "all"
|
||||||
|
native?: boolean
|
||||||
|
hidden?: boolean
|
||||||
|
topP?: number
|
||||||
|
temperature?: number
|
||||||
|
color?: string
|
||||||
|
permission: PermissionRuleset
|
||||||
|
model?: {
|
||||||
|
modelID: string
|
||||||
|
providerID: string
|
||||||
|
}
|
||||||
|
prompt?: string
|
||||||
|
options: {
|
||||||
|
[key: string]: unknown
|
||||||
|
}
|
||||||
|
steps?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LspStatus = {
|
export type LspStatus = {
|
||||||
@@ -2469,6 +2469,29 @@ export type ConfigUpdateResponses = {
|
|||||||
|
|
||||||
export type ConfigUpdateResponse = ConfigUpdateResponses[keyof ConfigUpdateResponses]
|
export type ConfigUpdateResponse = ConfigUpdateResponses[keyof ConfigUpdateResponses]
|
||||||
|
|
||||||
|
export type ConfigProvidersData = {
|
||||||
|
body?: never
|
||||||
|
path?: never
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/config/providers"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ConfigProvidersResponses = {
|
||||||
|
/**
|
||||||
|
* List of providers
|
||||||
|
*/
|
||||||
|
200: {
|
||||||
|
providers: Array<Provider>
|
||||||
|
default: {
|
||||||
|
[key: string]: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]
|
||||||
|
|
||||||
export type ToolIdsData = {
|
export type ToolIdsData = {
|
||||||
body?: never
|
body?: never
|
||||||
path?: never
|
path?: never
|
||||||
@@ -2525,42 +2548,6 @@ export type ToolListResponses = {
|
|||||||
|
|
||||||
export type ToolListResponse = ToolListResponses[keyof ToolListResponses]
|
export type ToolListResponse = ToolListResponses[keyof ToolListResponses]
|
||||||
|
|
||||||
export type InstanceDisposeData = {
|
|
||||||
body?: never
|
|
||||||
path?: never
|
|
||||||
query?: {
|
|
||||||
directory?: string
|
|
||||||
}
|
|
||||||
url: "/instance/dispose"
|
|
||||||
}
|
|
||||||
|
|
||||||
export type InstanceDisposeResponses = {
|
|
||||||
/**
|
|
||||||
* Instance disposed
|
|
||||||
*/
|
|
||||||
200: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export type InstanceDisposeResponse = InstanceDisposeResponses[keyof InstanceDisposeResponses]
|
|
||||||
|
|
||||||
export type PathGetData = {
|
|
||||||
body?: never
|
|
||||||
path?: never
|
|
||||||
query?: {
|
|
||||||
directory?: string
|
|
||||||
}
|
|
||||||
url: "/path"
|
|
||||||
}
|
|
||||||
|
|
||||||
export type PathGetResponses = {
|
|
||||||
/**
|
|
||||||
* Path
|
|
||||||
*/
|
|
||||||
200: Path
|
|
||||||
}
|
|
||||||
|
|
||||||
export type PathGetResponse = PathGetResponses[keyof PathGetResponses]
|
|
||||||
|
|
||||||
export type WorktreeListData = {
|
export type WorktreeListData = {
|
||||||
body?: never
|
body?: never
|
||||||
path?: never
|
path?: never
|
||||||
@@ -2606,23 +2593,26 @@ export type WorktreeCreateResponses = {
|
|||||||
|
|
||||||
export type WorktreeCreateResponse = WorktreeCreateResponses[keyof WorktreeCreateResponses]
|
export type WorktreeCreateResponse = WorktreeCreateResponses[keyof WorktreeCreateResponses]
|
||||||
|
|
||||||
export type VcsGetData = {
|
export type ExperimentalResourceListData = {
|
||||||
body?: never
|
body?: never
|
||||||
path?: never
|
path?: never
|
||||||
query?: {
|
query?: {
|
||||||
directory?: string
|
directory?: string
|
||||||
}
|
}
|
||||||
url: "/vcs"
|
url: "/experimental/resource"
|
||||||
}
|
}
|
||||||
|
|
||||||
export type VcsGetResponses = {
|
export type ExperimentalResourceListResponses = {
|
||||||
/**
|
/**
|
||||||
* VCS info
|
* MCP resources
|
||||||
*/
|
*/
|
||||||
200: VcsInfo
|
200: {
|
||||||
|
[key: string]: McpResource
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses]
|
export type ExperimentalResourceListResponse =
|
||||||
|
ExperimentalResourceListResponses[keyof ExperimentalResourceListResponses]
|
||||||
|
|
||||||
export type SessionListData = {
|
export type SessionListData = {
|
||||||
body?: never
|
body?: never
|
||||||
@@ -3058,9 +3048,6 @@ export type SessionShareResponse = SessionShareResponses[keyof SessionShareRespo
|
|||||||
export type SessionDiffData = {
|
export type SessionDiffData = {
|
||||||
body?: never
|
body?: never
|
||||||
path: {
|
path: {
|
||||||
/**
|
|
||||||
* Session ID
|
|
||||||
*/
|
|
||||||
sessionID: string
|
sessionID: string
|
||||||
}
|
}
|
||||||
query?: {
|
query?: {
|
||||||
@@ -3070,22 +3057,9 @@ export type SessionDiffData = {
|
|||||||
url: "/session/{sessionID}/diff"
|
url: "/session/{sessionID}/diff"
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SessionDiffErrors = {
|
|
||||||
/**
|
|
||||||
* Bad request
|
|
||||||
*/
|
|
||||||
400: BadRequestError
|
|
||||||
/**
|
|
||||||
* Not found
|
|
||||||
*/
|
|
||||||
404: NotFoundError
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SessionDiffError = SessionDiffErrors[keyof SessionDiffErrors]
|
|
||||||
|
|
||||||
export type SessionDiffResponses = {
|
export type SessionDiffResponses = {
|
||||||
/**
|
/**
|
||||||
* List of diffs
|
* Successfully retrieved diff
|
||||||
*/
|
*/
|
||||||
200: Array<FileDiff>
|
200: Array<FileDiff>
|
||||||
}
|
}
|
||||||
@@ -3757,47 +3731,6 @@ export type QuestionRejectResponses = {
|
|||||||
|
|
||||||
export type QuestionRejectResponse = QuestionRejectResponses[keyof QuestionRejectResponses]
|
export type QuestionRejectResponse = QuestionRejectResponses[keyof QuestionRejectResponses]
|
||||||
|
|
||||||
export type CommandListData = {
|
|
||||||
body?: never
|
|
||||||
path?: never
|
|
||||||
query?: {
|
|
||||||
directory?: string
|
|
||||||
}
|
|
||||||
url: "/command"
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CommandListResponses = {
|
|
||||||
/**
|
|
||||||
* List of commands
|
|
||||||
*/
|
|
||||||
200: Array<Command>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CommandListResponse = CommandListResponses[keyof CommandListResponses]
|
|
||||||
|
|
||||||
export type ConfigProvidersData = {
|
|
||||||
body?: never
|
|
||||||
path?: never
|
|
||||||
query?: {
|
|
||||||
directory?: string
|
|
||||||
}
|
|
||||||
url: "/config/providers"
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ConfigProvidersResponses = {
|
|
||||||
/**
|
|
||||||
* List of providers
|
|
||||||
*/
|
|
||||||
200: {
|
|
||||||
providers: Array<Provider>
|
|
||||||
default: {
|
|
||||||
[key: string]: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]
|
|
||||||
|
|
||||||
export type ProviderListData = {
|
export type ProviderListData = {
|
||||||
body?: never
|
body?: never
|
||||||
path?: never
|
path?: never
|
||||||
@@ -4112,70 +4045,6 @@ export type FileStatusResponses = {
|
|||||||
|
|
||||||
export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]
|
export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
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
|
|
||||||
query?: {
|
|
||||||
directory?: string
|
|
||||||
}
|
|
||||||
url: "/agent"
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AppAgentsResponses = {
|
|
||||||
/**
|
|
||||||
* List of agents
|
|
||||||
*/
|
|
||||||
200: Array<Agent>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]
|
|
||||||
|
|
||||||
export type McpStatusData = {
|
export type McpStatusData = {
|
||||||
body?: never
|
body?: never
|
||||||
path?: never
|
path?: never
|
||||||
@@ -4408,63 +4277,6 @@ export type McpDisconnectResponses = {
|
|||||||
|
|
||||||
export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses]
|
export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses]
|
||||||
|
|
||||||
export type ExperimentalResourceListData = {
|
|
||||||
body?: never
|
|
||||||
path?: never
|
|
||||||
query?: {
|
|
||||||
directory?: string
|
|
||||||
}
|
|
||||||
url: "/experimental/resource"
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ExperimentalResourceListResponses = {
|
|
||||||
/**
|
|
||||||
* MCP resources
|
|
||||||
*/
|
|
||||||
200: {
|
|
||||||
[key: string]: McpResource
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ExperimentalResourceListResponse =
|
|
||||||
ExperimentalResourceListResponses[keyof ExperimentalResourceListResponses]
|
|
||||||
|
|
||||||
export type LspStatusData = {
|
|
||||||
body?: never
|
|
||||||
path?: never
|
|
||||||
query?: {
|
|
||||||
directory?: string
|
|
||||||
}
|
|
||||||
url: "/lsp"
|
|
||||||
}
|
|
||||||
|
|
||||||
export type LspStatusResponses = {
|
|
||||||
/**
|
|
||||||
* LSP server status
|
|
||||||
*/
|
|
||||||
200: Array<LspStatus>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses]
|
|
||||||
|
|
||||||
export type FormatterStatusData = {
|
|
||||||
body?: never
|
|
||||||
path?: never
|
|
||||||
query?: {
|
|
||||||
directory?: string
|
|
||||||
}
|
|
||||||
url: "/formatter"
|
|
||||||
}
|
|
||||||
|
|
||||||
export type FormatterStatusResponses = {
|
|
||||||
/**
|
|
||||||
* Formatter status
|
|
||||||
*/
|
|
||||||
200: Array<FormatterStatus>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses]
|
|
||||||
|
|
||||||
export type TuiAppendPromptData = {
|
export type TuiAppendPromptData = {
|
||||||
body?: {
|
body?: {
|
||||||
text: string
|
text: string
|
||||||
@@ -4759,6 +4571,200 @@ export type TuiControlResponseResponses = {
|
|||||||
|
|
||||||
export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses]
|
export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses]
|
||||||
|
|
||||||
|
export type InstanceDisposeData = {
|
||||||
|
body?: never
|
||||||
|
path?: never
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/instance/dispose"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type InstanceDisposeResponses = {
|
||||||
|
/**
|
||||||
|
* Instance disposed
|
||||||
|
*/
|
||||||
|
200: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export type InstanceDisposeResponse = InstanceDisposeResponses[keyof InstanceDisposeResponses]
|
||||||
|
|
||||||
|
export type PathGetData = {
|
||||||
|
body?: never
|
||||||
|
path?: never
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/path"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PathGetResponses = {
|
||||||
|
/**
|
||||||
|
* Path
|
||||||
|
*/
|
||||||
|
200: Path
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PathGetResponse = PathGetResponses[keyof PathGetResponses]
|
||||||
|
|
||||||
|
export type VcsGetData = {
|
||||||
|
body?: never
|
||||||
|
path?: never
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/vcs"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type VcsGetResponses = {
|
||||||
|
/**
|
||||||
|
* VCS info
|
||||||
|
*/
|
||||||
|
200: VcsInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses]
|
||||||
|
|
||||||
|
export type CommandListData = {
|
||||||
|
body?: never
|
||||||
|
path?: never
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/command"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CommandListResponses = {
|
||||||
|
/**
|
||||||
|
* List of commands
|
||||||
|
*/
|
||||||
|
200: Array<Command>
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
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
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/agent"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AppAgentsResponses = {
|
||||||
|
/**
|
||||||
|
* List of agents
|
||||||
|
*/
|
||||||
|
200: Array<Agent>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]
|
||||||
|
|
||||||
|
export type AppSkillsData = {
|
||||||
|
body?: never
|
||||||
|
path?: never
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/skill"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AppSkillsResponses = {
|
||||||
|
/**
|
||||||
|
* List of skills
|
||||||
|
*/
|
||||||
|
200: Array<{
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
location: string
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AppSkillsResponse = AppSkillsResponses[keyof AppSkillsResponses]
|
||||||
|
|
||||||
|
export type LspStatusData = {
|
||||||
|
body?: never
|
||||||
|
path?: never
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/lsp"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type LspStatusResponses = {
|
||||||
|
/**
|
||||||
|
* LSP server status
|
||||||
|
*/
|
||||||
|
200: Array<LspStatus>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses]
|
||||||
|
|
||||||
|
export type FormatterStatusData = {
|
||||||
|
body?: never
|
||||||
|
path?: never
|
||||||
|
query?: {
|
||||||
|
directory?: string
|
||||||
|
}
|
||||||
|
url: "/formatter"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FormatterStatusResponses = {
|
||||||
|
/**
|
||||||
|
* Formatter status
|
||||||
|
*/
|
||||||
|
200: Array<FormatterStatus>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses]
|
||||||
|
|
||||||
export type AuthSetData = {
|
export type AuthSetData = {
|
||||||
body?: Auth
|
body?: Auth
|
||||||
path: {
|
path: {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user