Manage skills as sources over ACP (#8675)
Co-authored-by: Lifei Zhou <lifei@squareup.com>
This commit is contained in:
@@ -12,7 +12,10 @@ import type {
|
||||
ArchiveSessionRequest,
|
||||
CheckSecretRequest,
|
||||
CheckSecretResponse,
|
||||
CreateSourceRequest,
|
||||
CreateSourceResponse,
|
||||
DeleteSessionRequest,
|
||||
DeleteSourceRequest,
|
||||
DictationConfigRequest,
|
||||
DictationConfigResponse,
|
||||
DictationModelCancelRequest,
|
||||
@@ -27,6 +30,8 @@ import type {
|
||||
DictationTranscribeResponse,
|
||||
ExportSessionRequest,
|
||||
ExportSessionResponse,
|
||||
ExportSourceRequest,
|
||||
ExportSourceResponse,
|
||||
GetExtensionsRequest,
|
||||
GetExtensionsResponse,
|
||||
GetProviderDetailsRequest,
|
||||
@@ -39,8 +44,12 @@ import type {
|
||||
GetToolsResponse,
|
||||
ImportSessionRequest,
|
||||
ImportSessionResponse,
|
||||
ImportSourcesRequest,
|
||||
ImportSourcesResponse,
|
||||
ListProvidersRequest,
|
||||
ListProvidersResponse,
|
||||
ListSourcesRequest,
|
||||
ListSourcesResponse,
|
||||
ReadConfigRequest,
|
||||
ReadConfigResponse,
|
||||
ReadResourceRequest,
|
||||
@@ -51,27 +60,34 @@ import type {
|
||||
RemoveExtensionRequest,
|
||||
RemoveSecretRequest,
|
||||
UnarchiveSessionRequest,
|
||||
UpdateSourceRequest,
|
||||
UpdateSourceResponse,
|
||||
UpdateWorkingDirRequest,
|
||||
UpsertConfigRequest,
|
||||
UpsertSecretRequest,
|
||||
} from './types.gen.js';
|
||||
import {
|
||||
zCheckSecretResponse,
|
||||
zCreateSourceResponse,
|
||||
zDictationConfigResponse,
|
||||
zDictationModelDownloadProgressResponse,
|
||||
zDictationModelsListResponse,
|
||||
zDictationTranscribeResponse,
|
||||
zExportSessionResponse,
|
||||
zExportSourceResponse,
|
||||
zGetExtensionsResponse,
|
||||
zGetProviderDetailsResponse,
|
||||
zGetProviderInventoryResponse,
|
||||
zGetSessionExtensionsResponse,
|
||||
zGetToolsResponse,
|
||||
zImportSessionResponse,
|
||||
zImportSourcesResponse,
|
||||
zListProvidersResponse,
|
||||
zListSourcesResponse,
|
||||
zReadConfigResponse,
|
||||
zReadResourceResponse,
|
||||
zRefreshProviderInventoryResponse,
|
||||
zUpdateSourceResponse,
|
||||
} from './zod.gen.js';
|
||||
|
||||
export class GooseExtClient {
|
||||
@@ -208,6 +224,45 @@ export class GooseExtClient {
|
||||
await this.conn.extMethod("_goose/session/unarchive", params);
|
||||
}
|
||||
|
||||
async GooseSourcesCreate(
|
||||
params: CreateSourceRequest,
|
||||
): Promise<CreateSourceResponse> {
|
||||
const raw = await this.conn.extMethod("_goose/sources/create", params);
|
||||
return zCreateSourceResponse.parse(raw) as CreateSourceResponse;
|
||||
}
|
||||
|
||||
async GooseSourcesList(
|
||||
params: ListSourcesRequest,
|
||||
): Promise<ListSourcesResponse> {
|
||||
const raw = await this.conn.extMethod("_goose/sources/list", params);
|
||||
return zListSourcesResponse.parse(raw) as ListSourcesResponse;
|
||||
}
|
||||
|
||||
async GooseSourcesUpdate(
|
||||
params: UpdateSourceRequest,
|
||||
): Promise<UpdateSourceResponse> {
|
||||
const raw = await this.conn.extMethod("_goose/sources/update", params);
|
||||
return zUpdateSourceResponse.parse(raw) as UpdateSourceResponse;
|
||||
}
|
||||
|
||||
async GooseSourcesDelete(params: DeleteSourceRequest): Promise<void> {
|
||||
await this.conn.extMethod("_goose/sources/delete", params);
|
||||
}
|
||||
|
||||
async GooseSourcesExport(
|
||||
params: ExportSourceRequest,
|
||||
): Promise<ExportSourceResponse> {
|
||||
const raw = await this.conn.extMethod("_goose/sources/export", params);
|
||||
return zExportSourceResponse.parse(raw) as ExportSourceResponse;
|
||||
}
|
||||
|
||||
async GooseSourcesImport(
|
||||
params: ImportSourcesRequest,
|
||||
): Promise<ImportSourcesResponse> {
|
||||
const raw = await this.conn.extMethod("_goose/sources/import", params);
|
||||
return zImportSourcesResponse.parse(raw) as ImportSourcesResponse;
|
||||
}
|
||||
|
||||
async GooseDictationTranscribe(
|
||||
params: DictationTranscribeRequest,
|
||||
): Promise<DictationTranscribeResponse> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type { AddExtensionRequest, ArchiveSessionRequest, CheckSecretRequest, CheckSecretResponse, DeleteSessionRequest, DictationConfigRequest, DictationConfigResponse, DictationDownloadProgress, DictationLocalModelStatus, DictationModelCancelRequest, DictationModelDeleteRequest, DictationModelDownloadProgressRequest, DictationModelDownloadProgressResponse, DictationModelDownloadRequest, DictationModelOption, DictationModelSelectRequest, DictationModelsListRequest, DictationModelsListResponse, DictationProviderStatusEntry, DictationTranscribeRequest, DictationTranscribeResponse, EmptyResponse, ExportSessionRequest, ExportSessionResponse, ExtRequest, ExtResponse, GetExtensionsRequest, GetExtensionsResponse, GetProviderDetailsRequest, GetProviderDetailsResponse, GetProviderInventoryRequest, GetProviderInventoryResponse, GetSessionExtensionsRequest, GetSessionExtensionsResponse, GetToolsRequest, GetToolsResponse, ImportSessionRequest, ImportSessionResponse, ListProvidersRequest, ListProvidersResponse, ModelEntry, ProviderConfigKey, ProviderDetailEntry, ProviderInventoryEntryDto, ProviderInventoryModelDto, ProviderListEntry, ReadConfigRequest, ReadConfigResponse, ReadResourceRequest, ReadResourceResponse, RefreshProviderInventoryRequest, RefreshProviderInventoryResponse, RefreshProviderInventorySkipDto, RefreshProviderInventorySkipReasonDto, RemoveConfigRequest, RemoveExtensionRequest, RemoveSecretRequest, UnarchiveSessionRequest, UpdateWorkingDirRequest, UpsertConfigRequest, UpsertSecretRequest } from './types.gen.js';
|
||||
export type { AddExtensionRequest, ArchiveSessionRequest, CheckSecretRequest, CheckSecretResponse, CreateSourceRequest, CreateSourceResponse, DeleteSessionRequest, DeleteSourceRequest, DictationConfigRequest, DictationConfigResponse, DictationDownloadProgress, DictationLocalModelStatus, DictationModelCancelRequest, DictationModelDeleteRequest, DictationModelDownloadProgressRequest, DictationModelDownloadProgressResponse, DictationModelDownloadRequest, DictationModelOption, DictationModelSelectRequest, DictationModelsListRequest, DictationModelsListResponse, DictationProviderStatusEntry, DictationTranscribeRequest, DictationTranscribeResponse, EmptyResponse, ExportSessionRequest, ExportSessionResponse, ExportSourceRequest, ExportSourceResponse, ExtRequest, ExtResponse, GetExtensionsRequest, GetExtensionsResponse, GetProviderDetailsRequest, GetProviderDetailsResponse, GetProviderInventoryRequest, GetProviderInventoryResponse, GetSessionExtensionsRequest, GetSessionExtensionsResponse, GetToolsRequest, GetToolsResponse, ImportSessionRequest, ImportSessionResponse, ImportSourcesRequest, ImportSourcesResponse, ListProvidersRequest, ListProvidersResponse, ListSourcesRequest, ListSourcesResponse, ModelEntry, ProviderConfigKey, ProviderDetailEntry, ProviderInventoryEntryDto, ProviderInventoryModelDto, ProviderListEntry, ReadConfigRequest, ReadConfigResponse, ReadResourceRequest, ReadResourceResponse, RefreshProviderInventoryRequest, RefreshProviderInventoryResponse, RefreshProviderInventorySkipDto, RefreshProviderInventorySkipReasonDto, RemoveConfigRequest, RemoveExtensionRequest, RemoveSecretRequest, SourceEntry, SourceType, UnarchiveSessionRequest, UpdateSourceRequest, UpdateSourceResponse, UpdateWorkingDirRequest, UpsertConfigRequest, UpsertSecretRequest } from './types.gen.js';
|
||||
|
||||
export const GOOSE_EXT_METHODS = [
|
||||
{
|
||||
@@ -113,6 +113,36 @@ export const GOOSE_EXT_METHODS = [
|
||||
requestType: "UnarchiveSessionRequest",
|
||||
responseType: "EmptyResponse",
|
||||
},
|
||||
{
|
||||
method: "_goose/sources/create",
|
||||
requestType: "CreateSourceRequest",
|
||||
responseType: "CreateSourceResponse",
|
||||
},
|
||||
{
|
||||
method: "_goose/sources/list",
|
||||
requestType: "ListSourcesRequest",
|
||||
responseType: "ListSourcesResponse",
|
||||
},
|
||||
{
|
||||
method: "_goose/sources/update",
|
||||
requestType: "UpdateSourceRequest",
|
||||
responseType: "UpdateSourceResponse",
|
||||
},
|
||||
{
|
||||
method: "_goose/sources/delete",
|
||||
requestType: "DeleteSourceRequest",
|
||||
responseType: "EmptyResponse",
|
||||
},
|
||||
{
|
||||
method: "_goose/sources/export",
|
||||
requestType: "ExportSourceRequest",
|
||||
responseType: "ExportSourceResponse",
|
||||
},
|
||||
{
|
||||
method: "_goose/sources/import",
|
||||
requestType: "ImportSourcesRequest",
|
||||
responseType: "ImportSourcesResponse",
|
||||
},
|
||||
{
|
||||
method: "_goose/dictation/transcribe",
|
||||
requestType: "DictationTranscribeRequest",
|
||||
|
||||
@@ -395,6 +395,119 @@ export type UnarchiveSessionRequest = {
|
||||
sessionId: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new source (global or project-scoped).
|
||||
*/
|
||||
export type CreateSourceRequest = {
|
||||
type: SourceType;
|
||||
name: string;
|
||||
description: string;
|
||||
content: string;
|
||||
global: boolean;
|
||||
/**
|
||||
* Absolute path to the project root. Required when `global` is false.
|
||||
*/
|
||||
projectDir?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* The type of source entity.
|
||||
*/
|
||||
export type SourceType = 'skill';
|
||||
|
||||
export type CreateSourceResponse = {
|
||||
source: SourceEntry;
|
||||
};
|
||||
|
||||
/**
|
||||
* A source — a user-editable entity backed by an on-disk directory. Sources
|
||||
* may be either `global` (shared across all projects) or project-specific.
|
||||
*/
|
||||
export type SourceEntry = {
|
||||
type: SourceType;
|
||||
name: string;
|
||||
description: string;
|
||||
content: string;
|
||||
/**
|
||||
* Absolute path to the source's directory on disk.
|
||||
*/
|
||||
directory: string;
|
||||
/**
|
||||
* True when the source lives in the user's global sources directory; false
|
||||
* when it lives inside a specific project.
|
||||
*/
|
||||
global: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* List sources. If `type` is omitted, sources of all known types are returned.
|
||||
* Both global and project-scoped sources are included when `project_dir` is set.
|
||||
*/
|
||||
export type ListSourcesRequest = {
|
||||
type?: SourceType | null;
|
||||
projectDir?: string | null;
|
||||
};
|
||||
|
||||
export type ListSourcesResponse = {
|
||||
sources: Array<SourceEntry>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update an existing source's description and content.
|
||||
*/
|
||||
export type UpdateSourceRequest = {
|
||||
type: SourceType;
|
||||
name: string;
|
||||
description: string;
|
||||
content: string;
|
||||
global: boolean;
|
||||
projectDir?: string | null;
|
||||
};
|
||||
|
||||
export type UpdateSourceResponse = {
|
||||
source: SourceEntry;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a source and its on-disk directory.
|
||||
*/
|
||||
export type DeleteSourceRequest = {
|
||||
type: SourceType;
|
||||
name: string;
|
||||
global: boolean;
|
||||
projectDir?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Export a source as a portable JSON payload.
|
||||
*/
|
||||
export type ExportSourceRequest = {
|
||||
type: SourceType;
|
||||
name: string;
|
||||
global: boolean;
|
||||
projectDir?: string | null;
|
||||
};
|
||||
|
||||
export type ExportSourceResponse = {
|
||||
json: string;
|
||||
filename: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Import a source from a JSON export payload produced by `_goose/sources/export`.
|
||||
* The imported source is written under the given scope; on name collisions a
|
||||
* `-imported` suffix is appended.
|
||||
*/
|
||||
export type ImportSourcesRequest = {
|
||||
data: string;
|
||||
global: boolean;
|
||||
projectDir?: string | null;
|
||||
};
|
||||
|
||||
export type ImportSourcesResponse = {
|
||||
sources: Array<SourceEntry>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Transcribe audio via a dictation provider.
|
||||
*/
|
||||
@@ -535,14 +648,14 @@ export type DictationModelSelectRequest = {
|
||||
export type ExtRequest = {
|
||||
id: string;
|
||||
method: string;
|
||||
params?: AddExtensionRequest | RemoveExtensionRequest | GetToolsRequest | ReadResourceRequest | UpdateWorkingDirRequest | DeleteSessionRequest | GetExtensionsRequest | GetSessionExtensionsRequest | ListProvidersRequest | GetProviderDetailsRequest | GetProviderInventoryRequest | RefreshProviderInventoryRequest | ReadConfigRequest | UpsertConfigRequest | RemoveConfigRequest | CheckSecretRequest | UpsertSecretRequest | RemoveSecretRequest | ExportSessionRequest | ImportSessionRequest | ArchiveSessionRequest | UnarchiveSessionRequest | DictationTranscribeRequest | DictationConfigRequest | DictationModelsListRequest | DictationModelDownloadRequest | DictationModelDownloadProgressRequest | DictationModelCancelRequest | DictationModelDeleteRequest | DictationModelSelectRequest | {
|
||||
params?: AddExtensionRequest | RemoveExtensionRequest | GetToolsRequest | ReadResourceRequest | UpdateWorkingDirRequest | DeleteSessionRequest | GetExtensionsRequest | GetSessionExtensionsRequest | ListProvidersRequest | GetProviderDetailsRequest | GetProviderInventoryRequest | RefreshProviderInventoryRequest | ReadConfigRequest | UpsertConfigRequest | RemoveConfigRequest | CheckSecretRequest | UpsertSecretRequest | RemoveSecretRequest | ExportSessionRequest | ImportSessionRequest | ArchiveSessionRequest | UnarchiveSessionRequest | CreateSourceRequest | ListSourcesRequest | UpdateSourceRequest | DeleteSourceRequest | ExportSourceRequest | ImportSourcesRequest | DictationTranscribeRequest | DictationConfigRequest | DictationModelsListRequest | DictationModelDownloadRequest | DictationModelDownloadProgressRequest | DictationModelCancelRequest | DictationModelDeleteRequest | DictationModelSelectRequest | {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type ExtResponse = {
|
||||
id: string;
|
||||
result?: EmptyResponse | GetToolsResponse | ReadResourceResponse | GetExtensionsResponse | GetSessionExtensionsResponse | ListProvidersResponse | GetProviderDetailsResponse | GetProviderInventoryResponse | RefreshProviderInventoryResponse | ReadConfigResponse | CheckSecretResponse | ExportSessionResponse | ImportSessionResponse | DictationTranscribeResponse | DictationConfigResponse | DictationModelsListResponse | DictationModelDownloadProgressResponse | unknown;
|
||||
result?: EmptyResponse | GetToolsResponse | ReadResourceResponse | GetExtensionsResponse | GetSessionExtensionsResponse | ListProvidersResponse | GetProviderDetailsResponse | GetProviderInventoryResponse | RefreshProviderInventoryResponse | ReadConfigResponse | CheckSecretResponse | ExportSessionResponse | ImportSessionResponse | CreateSourceResponse | ListSourcesResponse | UpdateSourceResponse | ExportSourceResponse | ImportSourcesResponse | DictationTranscribeResponse | DictationConfigResponse | DictationModelsListResponse | DictationModelDownloadProgressResponse | unknown;
|
||||
} | {
|
||||
error: {
|
||||
code: number;
|
||||
|
||||
@@ -348,6 +348,130 @@ export const zUnarchiveSessionRequest = z.object({
|
||||
sessionId: z.string()
|
||||
});
|
||||
|
||||
/**
|
||||
* The type of source entity.
|
||||
*/
|
||||
export const zSourceType = z.enum(['skill']);
|
||||
|
||||
/**
|
||||
* Create a new source (global or project-scoped).
|
||||
*/
|
||||
export const zCreateSourceRequest = z.object({
|
||||
type: zSourceType,
|
||||
name: z.string(),
|
||||
description: z.string(),
|
||||
content: z.string(),
|
||||
global: z.boolean(),
|
||||
projectDir: z.union([
|
||||
z.string(),
|
||||
z.null()
|
||||
]).optional()
|
||||
});
|
||||
|
||||
/**
|
||||
* A source — a user-editable entity backed by an on-disk directory. Sources
|
||||
* may be either `global` (shared across all projects) or project-specific.
|
||||
*/
|
||||
export const zSourceEntry = z.object({
|
||||
type: zSourceType,
|
||||
name: z.string(),
|
||||
description: z.string(),
|
||||
content: z.string(),
|
||||
directory: z.string(),
|
||||
global: z.boolean()
|
||||
});
|
||||
|
||||
export const zCreateSourceResponse = z.object({
|
||||
source: zSourceEntry
|
||||
});
|
||||
|
||||
/**
|
||||
* List sources. If `type` is omitted, sources of all known types are returned.
|
||||
* Both global and project-scoped sources are included when `project_dir` is set.
|
||||
*/
|
||||
export const zListSourcesRequest = z.object({
|
||||
type: z.union([
|
||||
zSourceType,
|
||||
z.null()
|
||||
]).optional(),
|
||||
projectDir: z.union([
|
||||
z.string(),
|
||||
z.null()
|
||||
]).optional()
|
||||
});
|
||||
|
||||
export const zListSourcesResponse = z.object({
|
||||
sources: z.array(zSourceEntry)
|
||||
});
|
||||
|
||||
/**
|
||||
* Update an existing source's description and content.
|
||||
*/
|
||||
export const zUpdateSourceRequest = z.object({
|
||||
type: zSourceType,
|
||||
name: z.string(),
|
||||
description: z.string(),
|
||||
content: z.string(),
|
||||
global: z.boolean(),
|
||||
projectDir: z.union([
|
||||
z.string(),
|
||||
z.null()
|
||||
]).optional()
|
||||
});
|
||||
|
||||
export const zUpdateSourceResponse = z.object({
|
||||
source: zSourceEntry
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete a source and its on-disk directory.
|
||||
*/
|
||||
export const zDeleteSourceRequest = z.object({
|
||||
type: zSourceType,
|
||||
name: z.string(),
|
||||
global: z.boolean(),
|
||||
projectDir: z.union([
|
||||
z.string(),
|
||||
z.null()
|
||||
]).optional()
|
||||
});
|
||||
|
||||
/**
|
||||
* Export a source as a portable JSON payload.
|
||||
*/
|
||||
export const zExportSourceRequest = z.object({
|
||||
type: zSourceType,
|
||||
name: z.string(),
|
||||
global: z.boolean(),
|
||||
projectDir: z.union([
|
||||
z.string(),
|
||||
z.null()
|
||||
]).optional()
|
||||
});
|
||||
|
||||
export const zExportSourceResponse = z.object({
|
||||
json: z.string(),
|
||||
filename: z.string()
|
||||
});
|
||||
|
||||
/**
|
||||
* Import a source from a JSON export payload produced by `_goose/sources/export`.
|
||||
* The imported source is written under the given scope; on name collisions a
|
||||
* `-imported` suffix is appended.
|
||||
*/
|
||||
export const zImportSourcesRequest = z.object({
|
||||
data: z.string(),
|
||||
global: z.boolean(),
|
||||
projectDir: z.union([
|
||||
z.string(),
|
||||
z.null()
|
||||
]).optional()
|
||||
});
|
||||
|
||||
export const zImportSourcesResponse = z.object({
|
||||
sources: z.array(zSourceEntry)
|
||||
});
|
||||
|
||||
/**
|
||||
* Transcribe audio via a dictation provider.
|
||||
*/
|
||||
@@ -515,6 +639,12 @@ export const zExtRequest = z.object({
|
||||
zImportSessionRequest,
|
||||
zArchiveSessionRequest,
|
||||
zUnarchiveSessionRequest,
|
||||
zCreateSourceRequest,
|
||||
zListSourcesRequest,
|
||||
zUpdateSourceRequest,
|
||||
zDeleteSourceRequest,
|
||||
zExportSourceRequest,
|
||||
zImportSourcesRequest,
|
||||
zDictationTranscribeRequest,
|
||||
zDictationConfigRequest,
|
||||
zDictationModelsListRequest,
|
||||
@@ -549,6 +679,11 @@ export const zExtResponse = z.union([
|
||||
zCheckSecretResponse,
|
||||
zExportSessionResponse,
|
||||
zImportSessionResponse,
|
||||
zCreateSourceResponse,
|
||||
zListSourcesResponse,
|
||||
zUpdateSourceResponse,
|
||||
zExportSourceResponse,
|
||||
zImportSourcesResponse,
|
||||
zDictationTranscribeResponse,
|
||||
zDictationConfigResponse,
|
||||
zDictationModelsListResponse,
|
||||
|
||||
Reference in New Issue
Block a user