65 lines
3.8 KiB
TypeScript
65 lines
3.8 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",
|
|
uploads: "/uploads",
|
|
adminQuotas: "/admin/quotas",
|
|
adminQuotaUser: (uid: string) => "/admin/quotas?user_id=" + enc(uid),
|
|
adminSweep: "/admin/sweep",
|
|
adminBackup: "/admin/backup",
|
|
};
|