645 lines
21 KiB
TypeScript
645 lines
21 KiB
TypeScript
import { createQueryApi } from '@kevisual/query/api';
|
||
import { query } from '@/modules/query.ts';
|
||
const api = {
|
||
"opencode": {
|
||
/**
|
||
* 创建 OpenCode 客户端,如果存在则复用
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"create": {
|
||
"path": "opencode",
|
||
"key": "create",
|
||
"id": "b662fba3c0a8a593",
|
||
"description": "创建 OpenCode 客户端",
|
||
"metadata": {
|
||
"tags": [
|
||
"opencode"
|
||
],
|
||
"args": {
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "create-opencode-client",
|
||
"title": "创建 OpenCode 客户端",
|
||
"summary": "创建 OpenCode 客户端,如果存在则复用",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 关闭 OpenCode 客户端, 未提供端口则关闭默认端口
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"close": {
|
||
"path": "opencode",
|
||
"key": "close",
|
||
"id": "49672adea9daa837",
|
||
"description": "关闭 OpenCode 客户端",
|
||
"metadata": {
|
||
"tags": [
|
||
"opencode"
|
||
],
|
||
"args": {
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "close-opencode-client",
|
||
"title": "关闭 OpenCode 客户端",
|
||
"summary": "关闭 OpenCode 客户端, 未提供端口则关闭默认端口",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 重启 OpenCode 客户端
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"restart": {
|
||
"path": "opencode",
|
||
"key": "restart",
|
||
"id": "e0b1564a796ea88b",
|
||
"description": "重启 OpenCode 客户端",
|
||
"metadata": {
|
||
"tags": [
|
||
"opencode"
|
||
],
|
||
"args": {
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "restart-opencode-client",
|
||
"title": "重启 OpenCode 客户端",
|
||
"summary": "重启 OpenCode 客户端",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 获取当前 OpenCode 服务的 URL 地址
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"getUrl": {
|
||
"path": "opencode",
|
||
"key": "getUrl",
|
||
"id": "c611acf038e41279",
|
||
"description": "获取 OpenCode 服务 URL",
|
||
"metadata": {
|
||
"tags": [
|
||
"opencode"
|
||
],
|
||
"args": {
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "get-opencode-url",
|
||
"title": "获取 OpenCode 服务 URL",
|
||
"summary": "获取当前 OpenCode 服务的 URL 地址",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
"ls-projects": {
|
||
"path": "opencode",
|
||
"key": "ls-projects",
|
||
"id": "ee72cd09da63d13d",
|
||
"metadata": {
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 运行一个已有的 OpenCode 项目
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.projectPath - {string} OpenCode 项目的路径, 默认为 /workspace
|
||
*/
|
||
"runProject": {
|
||
"path": "opencode",
|
||
"key": "runProject",
|
||
"id": "112127fa82fe1d9d",
|
||
"metadata": {
|
||
"tags": [
|
||
"opencode"
|
||
],
|
||
"args": {
|
||
"projectPath": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 项目的路径, 默认为 /workspace",
|
||
"type": "string",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "run-opencode-project",
|
||
"title": "运行 OpenCode 项目",
|
||
"summary": "运行一个已有的 OpenCode 项目",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
}
|
||
},
|
||
"opencode-cnb": {
|
||
/**
|
||
* 创建 OpenCode 客户端
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.question - {string} 问题
|
||
* @param data.baseUrl - {string} OpenCode 服务地址,默认为 http://localhost:4096
|
||
* @param data.directory - {string} 运行目录,默认为根目录
|
||
* @param data.messageId - {string} 消息 ID,选填
|
||
* @param data.sessionId - {string} 会话 ID,选填
|
||
* @param data.providerId - {string} 指定使用的提供商 ID,默认为空,表示使用默认提供商
|
||
* @param data.modelId - {string} 指定使用的模型 ID,默认为空,表示使用默认模型
|
||
* @param data.parts - {array} 消息内容的分块,优先于 question 参数
|
||
* @param data.awaitAnswer - {boolean} 是否等待回答完成,默认为 false,开启后会在回答完成后返回完整回答内容
|
||
*/
|
||
"question": {
|
||
"path": "opencode-cnb",
|
||
"key": "question",
|
||
"id": "193c9c63bc50cbbc",
|
||
"description": "创建 OpenCode 客户端",
|
||
"metadata": {
|
||
"args": {
|
||
"question": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "问题"
|
||
},
|
||
"baseUrl": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务地址,默认为 http://localhost:4096",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"directory": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "运行目录,默认为根目录",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"messageId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "消息 ID,选填",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"sessionId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "会话 ID,选填",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"providerId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "指定使用的提供商 ID,默认为空,表示使用默认提供商",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"modelId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "指定使用的模型 ID,默认为空,表示使用默认模型",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"parts": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "消息内容的分块,优先于 question 参数",
|
||
"type": "array",
|
||
"items": {},
|
||
"optional": true
|
||
},
|
||
"awaitAnswer": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "是否等待回答完成,默认为 false,开启后会在回答完成后返回完整回答内容",
|
||
"type": "boolean",
|
||
"optional": true
|
||
}
|
||
},
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 获取 OpenCode 可用模型列表,返回 providerID 和 modelID
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.baseUrl - {string} OpenCode 服务地址,默认为 http://localhost:4096
|
||
*/
|
||
"models": {
|
||
"path": "opencode-cnb",
|
||
"key": "models",
|
||
"id": "a66f19f8427e7085",
|
||
"description": "获取 OpenCode 可用模型列表,返回 providerID 和 modelID",
|
||
"metadata": {
|
||
"args": {
|
||
"baseUrl": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务地址,默认为 http://localhost:4096",
|
||
"type": "string",
|
||
"optional": true
|
||
}
|
||
},
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
}
|
||
},
|
||
"opencode-session": {
|
||
/**
|
||
* 在指定目录创建一个新的 OpenCode 会话
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.directory - {string} 工作目录,默认为 /workspace
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"create": {
|
||
"path": "opencode-session",
|
||
"key": "create",
|
||
"id": "f07990a69e2a1eaf",
|
||
"description": "创建 OpenCode Session",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"directory": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "工作目录,默认为 /workspace",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "create-opencode-session",
|
||
"title": "创建 Session",
|
||
"summary": "在指定目录创建一个新的 OpenCode 会话",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 更新指定 OpenCode 会话的属性,如标题
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.sessionId - {string} Session ID
|
||
* @param data.title - {string} 新的会话标题
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"update": {
|
||
"path": "opencode-session",
|
||
"key": "update",
|
||
"id": "0a6f7cd78fa5ff20",
|
||
"description": "更新 OpenCode Session",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"sessionId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "Session ID"
|
||
},
|
||
"title": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "新的会话标题",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "update-opencode-session",
|
||
"title": "更新 Session",
|
||
"summary": "更新指定 OpenCode 会话的属性,如标题",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 根据 ID 删除指定的 OpenCode 会话及其所有数据
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.sessionId - {string} Session ID
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"delete": {
|
||
"path": "opencode-session",
|
||
"key": "delete",
|
||
"id": "c7bd762b2eccdfc2",
|
||
"description": "删除 OpenCode Session",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"sessionId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "Session ID"
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "delete-opencode-session",
|
||
"title": "删除 Session",
|
||
"summary": "根据 ID 删除指定的 OpenCode 会话及其所有数据",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 中止正在运行的 OpenCode 会话
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.sessionId - {string} Session ID
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"abort": {
|
||
"path": "opencode-session",
|
||
"key": "abort",
|
||
"id": "0b89922558164ffd",
|
||
"description": "中止 OpenCode Session",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"sessionId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "Session ID"
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "abort-opencode-session",
|
||
"title": "中止 Session",
|
||
"summary": "中止正在运行的 OpenCode 会话",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 对指定的 OpenCode 会话进行内容总结
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.sessionId - {string} Session ID
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"summarize": {
|
||
"path": "opencode-session",
|
||
"key": "summarize",
|
||
"id": "c51ae8a43b269383",
|
||
"description": "总结 OpenCode Session",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"sessionId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "Session ID"
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "summarize-opencode-session",
|
||
"title": "总结 Session",
|
||
"summary": "对指定的 OpenCode 会话进行内容总结",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 获取当前 OpenCode 会话的运行状态,可按目录过滤
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.directory - {string} 工作目录
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"status": {
|
||
"path": "opencode-session",
|
||
"key": "status",
|
||
"id": "a2507055e8e1ed42",
|
||
"description": "获取 OpenCode Session 状态",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"directory": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "工作目录",
|
||
"type": "string",
|
||
"optional": true
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "get-opencode-session-status",
|
||
"title": "获取 Session 状态",
|
||
"summary": "获取当前 OpenCode 会话的运行状态,可按目录过滤",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 列出指定 OpenCode 会话的所有消息记录
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.sessionId - {string} Session ID
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"messages": {
|
||
"path": "opencode-session",
|
||
"key": "messages",
|
||
"id": "04e78517e6e9144e",
|
||
"description": "列出 OpenCode Session 消息",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"sessionId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "Session ID"
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "list-opencode-session-messages",
|
||
"title": "列出 Session 消息",
|
||
"summary": "列出指定 OpenCode 会话的所有消息记录",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 列出 OpenCode 中的所有会话,可按目录过滤
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"list": {
|
||
"path": "opencode-session",
|
||
"key": "list",
|
||
"id": "a44e79adfcb199dd",
|
||
"description": "列出所有 OpenCode Session",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "list-opencode-sessions",
|
||
"title": "列出所有 Session",
|
||
"summary": "列出 OpenCode 中的所有会话,可按目录过滤",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 根据 ID 获取指定的 OpenCode 会话信息
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.id - {string} Session ID
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"get": {
|
||
"path": "opencode-session",
|
||
"key": "get",
|
||
"id": "7acea53865affb10",
|
||
"description": "获取指定 OpenCode Session",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"id": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "Session ID"
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "get-opencode-session",
|
||
"title": "获取 Session",
|
||
"summary": "根据 ID 获取指定的 OpenCode 会话信息",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
},
|
||
/**
|
||
* 从指定消息处 Fork 一个 OpenCode 会话
|
||
*
|
||
* @param data - Request parameters
|
||
* @param data.sessionId - {string} Session ID
|
||
* @param data.messageId - {string} 从该消息处开始 Fork
|
||
* @param data.port - {number} OpenCode 服务端口,默认为 4096
|
||
*/
|
||
"fork": {
|
||
"path": "opencode-session",
|
||
"key": "fork",
|
||
"id": "d43a8e2282412078",
|
||
"description": "Fork OpenCode Session",
|
||
"metadata": {
|
||
"tags": [
|
||
"session"
|
||
],
|
||
"args": {
|
||
"sessionId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "Session ID"
|
||
},
|
||
"messageId": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"type": "string",
|
||
"description": "从该消息处开始 Fork"
|
||
},
|
||
"port": {
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"description": "OpenCode 服务端口,默认为 4096",
|
||
"type": "number",
|
||
"optional": true
|
||
}
|
||
},
|
||
"skill": "fork-opencode-session",
|
||
"title": "Fork Session",
|
||
"summary": "从指定消息处 Fork 一个 OpenCode 会话",
|
||
"url": "/root/v1/cnb-dev",
|
||
"source": "query-proxy-api"
|
||
}
|
||
}
|
||
}
|
||
} as const;
|
||
const queryApi = createQueryApi({ api, query });
|
||
|
||
export { queryApi };
|