Files
codex-app-server/cloud/console-react/src/api/paths.ts
T
host 7589876cff feat: 控制台浏览器远控面板
- TaskDetailPanel 新增“浏览器”页签,内嵌 BrowserPanel。
- 开始观看:fetch + ReadableStream 读 SSE(EventSource 发不出
  X-API-Key),最新帧以 data URI 显示;状态每 5 秒轮询。
- 接管/交还:POST /browser/control;接管后点画面按 1280x800
  换算坐标 POST /browser/input,键盘直达页面。
- 产物:cloud/console.html 由 vite 单文件构建重打(341451 字节,
  含 browser/state 与“浏览器远控”标记)。
2026-10-30 07:01:48 +08:00

69 lines
4.1 KiB
TypeScript

// Every API path in the app, in one place. No section or hook builds a
// URL string by hand; they all go through this table. Paths are
// same-origin absolute paths, exactly as in the live console.
const enc = encodeURIComponent;
export const paths = {
health: "/health",
relayModels: "/relay/models",
quotaMe: "/users/me/quota",
userKeys: "/users/me/keys",
userKey: (id: string) => "/users/me/keys/" + enc(id),
githubRepos: "/github/repos",
projects: "/projects",
project: (id: string) => "/projects/" + enc(id),
projectMembers: (pid: string) => "/projects/" + enc(pid) + "/members",
projectMember: (pid: string, uid: string) => "/projects/" + enc(pid) + "/members/" + enc(uid),
projectSkills: (pid: string) => "/projects/" + enc(pid) + "/skills",
projectApps: (pid: string) => "/projects/" + enc(pid) + "/apps",
projectMcp: (pid: string) => "/projects/" + enc(pid) + "/mcp-servers",
projectMcpReload: (pid: string) => "/projects/" + enc(pid) + "/mcp-servers/reload",
projectMcpOauth: (pid: string, name: string) => "/projects/" + enc(pid) + "/mcp-servers/" + enc(name) + "/oauth-login",
projectAutomations: (pid: string) => "/projects/" + enc(pid) + "/automations",
projectAutomationCancel: (pid: string, id: string) => "/projects/" + enc(pid) + "/automations/" + enc(id) + "/cancel",
projectTriage: (pid: string) => "/projects/" + enc(pid) + "/triage",
projectTodos: (pid: string) => "/projects/" + enc(pid) + "/todos",
projectTodo: (pid: string, id: string) => "/projects/" + enc(pid) + "/todos/" + enc(id),
workers: "/workers",
environments: (pid: string) => "/environments?project_id=" + enc(pid),
environmentsCreate: "/environments",
environmentArchive: (id: string) => "/environments/" + enc(id) + "/archive",
tasks: (pid: string) => "/tasks?project_id=" + enc(pid),
tasksPage: (pid: string, limit: number, offset: number, status?: string, executor?: string, q?: string) => {
let u = "/tasks?project_id=" + enc(pid) + "&limit=" + limit + "&offset=" + offset + "&order=desc";
if (status) u += "&status=" + enc(status);
if (executor) u += "&executor=" + enc(executor);
if (q && q.trim()) u += "&q=" + enc(q.trim());
return u;
},
tasksByParent: (pid: string, parent: string) => "/tasks?project_id=" + enc(pid) + "&parent_task_id=" + enc(parent),
tasksCreate: "/tasks",
task: (id: string) => "/tasks/" + enc(id),
taskAction: (id: string, kind: string) => "/tasks/" + enc(id) + "/" + kind,
taskFork: (id: string) => "/tasks/" + enc(id) + "/fork",
taskContinue: (id: string) => "/tasks/" + enc(id) + "/continue",
taskTrace: (id: string) => "/tasks/" + enc(id) + "/trace",
taskTraceStream: (id: string) => "/tasks/" + enc(id) + "/trace/stream",
taskAgents: (id: string) => "/tasks/" + enc(id) + "/agents",
taskReviews: (id: string) => "/tasks/" + enc(id) + "/reviews",
taskReviewFindings: (id: string, rid: string) => "/tasks/" + enc(id) + "/reviews/" + enc(rid) + "/findings",
taskApprovals: (id: string) => "/tasks/" + enc(id) + "/approvals",
taskApprovalDecision: (id: string, aid: string, verb: string) => "/tasks/" + enc(id) + "/approvals/" + enc(aid) + "/" + verb,
taskFollowups: (id: string) => "/tasks/" + enc(id) + "/followups",
taskChatHistory: (id: string) => "/tasks/" + enc(id) + "/chat-history",
taskMessages: (id: string) => "/tasks/" + enc(id) + "/messages",
taskMessagesTo: (target: string) => "/tasks/" + enc(target) + "/messages",
taskThread: (id: string) => "/tasks/" + enc(id) + "/thread",
taskThreads: (id: string) => "/tasks/" + enc(id) + "/threads",
taskThreadAction: (id: string, kind: string) => "/tasks/" + enc(id) + "/thread/" + kind,
taskCost: (id: string) => "/tasks/" + enc(id) + "/cost",
taskBrowserState: (id: string) => "/tasks/" + enc(id) + "/browser/state",
taskBrowserStream: (id: string) => "/tasks/" + enc(id) + "/browser/stream",
taskBrowserInput: (id: string) => "/tasks/" + enc(id) + "/browser/input",
taskBrowserControl: (id: string) => "/tasks/" + enc(id) + "/browser/control",
uploads: "/uploads",
adminQuotas: "/admin/quotas",
adminQuotaUser: (uid: string) => "/admin/quotas?user_id=" + enc(uid),
adminSweep: "/admin/sweep",
adminBackup: "/admin/backup",
};