diff --git a/src/api.ts b/src/api.ts index 3a3708b..ae844a1 100644 --- a/src/api.ts +++ b/src/api.ts @@ -106,6 +106,61 @@ export interface AddResponse { [key: string]: unknown } +/** One skill as the cloud skill center lists it (`GET /skills` item). */ +export interface SkillSummary { + name: string + description?: string + category?: string | null + execution_mode?: string + enabled?: boolean + revision?: number + manifest_sha256?: string + files?: number + bytes?: number + script_changed?: boolean + [key: string]: unknown +} + +/** `GET /skills` response. */ +export interface SkillListing { + items?: SkillSummary[] + total?: number + trash_total?: number + [key: string]: unknown +} + +/** One file inside a skill bundle (`GET /skills/:name/bundle`). */ +export interface SkillBundleFile { + path: string + sha256: string + size?: number + encoding?: string + /** Base64 payload; present on every bundle file. */ + data: string +} + +/** `GET /skills/:name/bundle` response. */ +export interface SkillBundle { + name: string + revision: number + manifest_sha256: string + script_changed?: boolean + script_changes?: string[] + files: SkillBundleFile[] + [key: string]: unknown +} + +/** One file in a skill write payload: text inline, or base64 for binaries. */ +export type SkillUploadFile = { path: string; content: string } | { path: string; base64: string } + +/** `POST /skills` / `PATCH /skills/:name` outcome. */ +export interface SkillWriteResult { + skill?: SkillSummary + revision?: number + manifest_sha256?: string + [key: string]: unknown +} + /** One dashboard account as the login endpoint returns it. */ export interface AccountInfo { id?: string @@ -325,6 +380,26 @@ export class CloudClient { return this.request>('GET', '/storage/status') } + /** List the cloud skill center inventory (memory token). */ + listSkills(): Promise> { + return this.request('GET', '/skills') + } + + /** Fetch one skill bundle with hashed, base64-carried files (memory token). */ + skillBundle(name: string): Promise> { + return this.request('GET', `/skills/${encodeURIComponent(name)}/bundle`) + } + + /** Create one skill in the center; `expected_revision` must be 0 (memory token). */ + createSkill(body: Record): Promise> { + return this.request('POST', '/skills', body) + } + + /** Replace one skill's files/description at an expected revision (memory token). */ + updateSkill(name: string, body: Record): Promise> { + return this.request('PATCH', `/skills/${encodeURIComponent(name)}`, body) + } + /** * One call against the dashboard auth surface (`/api/auth/*`). *