feat(web): skills API types + client methods
This commit is contained in:
@@ -10,6 +10,7 @@ import type {
|
|||||||
ViewFileResult,
|
ViewFileResult,
|
||||||
AgentsResponse,
|
AgentsResponse,
|
||||||
GitMeta,
|
GitMeta,
|
||||||
|
Skill,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
export class ApiError extends Error {
|
export class ApiError extends Error {
|
||||||
@@ -187,6 +188,20 @@ export const api = {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ message_id: body.messageId, name: body.name }),
|
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: {
|
messages: {
|
||||||
@@ -218,6 +233,10 @@ export const api = {
|
|||||||
request<AgentsResponse>(`/api/projects/${projectId}/agents`),
|
request<AgentsResponse>(`/api/projects/${projectId}/agents`),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
skills: {
|
||||||
|
list: () => request<{ skills: Skill[] }>('/api/skills'),
|
||||||
|
},
|
||||||
|
|
||||||
settings: {
|
settings: {
|
||||||
get: () => request<Record<string, unknown>>('/api/settings'),
|
get: () => request<Record<string, unknown>>('/api/settings'),
|
||||||
patch: (body: Record<string, unknown>) =>
|
patch: (body: Record<string, unknown>) =>
|
||||||
|
|||||||
@@ -231,6 +231,16 @@ export interface GitMeta {
|
|||||||
behind: number;
|
behind: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Batch 9.6: skill catalog row. Returned by GET /api/skills and consumed by
|
||||||
|
// the slash-command dropdown. `path` and `mtime` are exposed for debug surface
|
||||||
|
// (/api/skills) but the dropdown only renders name + description.
|
||||||
|
export interface Skill {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
path: string;
|
||||||
|
mtime: number;
|
||||||
|
}
|
||||||
|
|
||||||
// v1.9: 'settings' is an ephemeral pane kind — never persisted, always
|
// v1.9: 'settings' is an ephemeral pane kind — never persisted, always
|
||||||
// singleton per workspace. The pane hook filters it out before writing to
|
// singleton per workspace. The pane hook filters it out before writing to
|
||||||
// localStorage and dedupes on insertion via toggleSettingsPane().
|
// localStorage and dedupes on insertion via toggleSettingsPane().
|
||||||
|
|||||||
Reference in New Issue
Block a user