feat(web): skills API types + client methods

This commit is contained in:
2026-05-18 01:10:51 +00:00
parent 529a77c959
commit eaacd432e8
2 changed files with 29 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import type {
ViewFileResult,
AgentsResponse,
GitMeta,
Skill,
} from './types';
export class ApiError extends Error {
@@ -187,6 +188,20 @@ export const api = {
method: 'POST',
body: JSON.stringify({ message_id: body.messageId, name: body.name }),
}),
// Batch 9.6: slash-command invocation. Server loads the skill body
// authoritatively (client doesn't get to forge file contents), persists
// a synthetic skill_use tool_use + tool_result + user message + streaming
// assistant, and enqueues inference. Returns all 4 new message IDs.
skillInvoke: (chatId: string, skillName: string, userMessage: string | null) =>
request<{
synth_assistant_id: string;
tool_message_id: string;
user_message_id: string;
assistant_message_id: string;
}>(`/api/chats/${chatId}/skill_invoke`, {
method: 'POST',
body: JSON.stringify({ skill_name: skillName, user_message: userMessage }),
}),
},
messages: {
@@ -218,6 +233,10 @@ export const api = {
request<AgentsResponse>(`/api/projects/${projectId}/agents`),
},
skills: {
list: () => request<{ skills: Skill[] }>('/api/skills'),
},
settings: {
get: () => request<Record<string, unknown>>('/api/settings'),
patch: (body: Record<string, unknown>) =>