@lumavox/server 0.6.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @lumavox/server
2
2
 
3
3
  The Lumavox API from your server, with your organisation's API key: speech,
4
- images and video, voices, your asset library, agents, knowledge, end users
4
+ images and video, voices, your asset library, agents, knowledge, tools, end users
5
5
  and the ephemeral keys their devices talk to agents with — every operation
6
6
  a key may call, typed from the published OpenAPI document. **Zero
7
7
  dependencies**: `fetch` and the web platform only — Node 20.3 or later,
@@ -68,7 +68,8 @@ list's page.
68
68
  | `tts`, `stt` | `create` |
69
69
  | `voices` | `list`, `page`, `get`, `create`, `uploadUrl`, `upload`, `update`, `delete`, `resample`, `design`, `saveDesign`, `wait` |
70
70
  | `assets` | `list`, `page`, `get`, `uploadUrl`, `confirm`, `upload`, `update`, `delete`, `deleteMany`, `move`, `wait`; `assets.folders.*` |
71
- | `agents` | `list`, `page`, `get`, `create`, `update`, `delete`; `agents.settings.get/update`; `agents.knowledge.list/set` |
71
+ | `agents` | `list`, `page`, `get`, `create`, `update`, `delete`; `agents.settings.get/update`; `agents.knowledge.list/set`; `agents.tools.list/set` |
72
+ | `tools` | `list`, `page`, `get`, `create` (a webhook's signing secret, shown once), `update`, `delete`, `rotateSecret`, `test` |
72
73
  | `knowledge` | `list`, `page`, `get`, `create`, `bulk`, `fromUrl`, `uploadUrl`, `fromFile`, `upload`, `update`, `delete`, `reindex`, `refresh`, `setAgents`, `search`, `categories`, `insights`, `wait` |
73
74
  | `usage` | `get`, `plan` |
74
75
  | the client | `health()` |
package/dist/client.d.ts CHANGED
@@ -20,6 +20,7 @@ import { Generations, Jobs, Skybox } from "./resources/generations.js";
20
20
  import { Knowledge } from "./resources/knowledge.js";
21
21
  import { Stt, Tts } from "./resources/speech.js";
22
22
  import { Templates } from "./resources/templates.js";
23
+ import { Tools } from "./resources/tools.js";
23
24
  import { Usage } from "./resources/usage.js";
24
25
  import { Voices } from "./resources/voices.js";
25
26
  import { type Fetch, type RequestOptions } from "./transport.js";
@@ -53,6 +54,7 @@ export interface Client {
53
54
  readonly assets: Assets;
54
55
  readonly agents: Agents;
55
56
  readonly knowledge: Knowledge;
57
+ readonly tools: Tools;
56
58
  /** Whether the API is up, and its version. Sends no key. */
57
59
  health(options?: RequestOptions): Promise<HealthResponse>;
58
60
  }
package/dist/client.js CHANGED
@@ -6,6 +6,7 @@ import { Generations, Jobs, Skybox } from "./resources/generations.js";
6
6
  import { Knowledge } from "./resources/knowledge.js";
7
7
  import { Stt, Tts } from "./resources/speech.js";
8
8
  import { Templates } from "./resources/templates.js";
9
+ import { Tools } from "./resources/tools.js";
9
10
  import { Usage } from "./resources/usage.js";
10
11
  import { Voices } from "./resources/voices.js";
11
12
  import { REFUSAL, refusedHere } from "./runtime.js";
@@ -45,6 +46,7 @@ export function createClient(options) {
45
46
  assets: new Assets(transport, "/v1/assets"),
46
47
  agents: new Agents(transport, "/v1/agents"),
47
48
  knowledge: new Knowledge(transport, "/v1/knowledge"),
49
+ tools: new Tools(transport, "/v1/tools"),
48
50
  health: (request) => transport
49
51
  .request({ method: "GET", path: "/health", open: true }, request)
50
52
  .then((answer) => answer.data),
@@ -1 +1 @@
1
- export type { AgentCreateRequest, AgentInfo, AgentKnowledgeUpdate, AgentPage, AgentSettingsInfo, AgentSettingsUpdate, AgentStt, AgentSttInfo, AgentSummary, AgentUpdate, AgentVoice, AgentVoiceInfo, ApiKeySelf, AssetBulkRequest, AssetDetail, AssetMoveRequest, AssetPage, AssetsAffected, AssetSummary, AssetUpdate, AssignedAgent, AudioRequest, BulkEditKnowledgeData, BulkEditKnowledgeError, BulkEditKnowledgeErrors, BulkEditKnowledgeResponse, BulkEditKnowledgeResponses, ClientOptions, CompactionInfo, CompactRequest, CompactSessionData, CompactSessionError, CompactSessionErrors, CompactSessionResponse, CompactSessionResponses, ConfirmAssetUploadData, ConfirmAssetUploadError, ConfirmAssetUploadErrors, ConfirmAssetUploadResponse, ConfirmAssetUploadResponses, CreateAgentData, CreateAgentError, CreateAgentErrors, CreateAgentResponse, CreateAgentResponses, CreateAssetFolderData, CreateAssetFolderError, CreateAssetFolderErrors, CreateAssetFolderResponse, CreateAssetFolderResponses, CreateAssetUploadUrlData, CreateAssetUploadUrlError, CreateAssetUploadUrlErrors, CreateAssetUploadUrlResponse, CreateAssetUploadUrlResponses, CreateAudioData, CreateAudioError, CreateAudioErrors, CreateAudioResponse, CreateAudioResponses, CreateEndUserData, CreateEndUserError, CreateEndUserErrors, CreateEndUserResponse, CreateEndUserResponses, CreateEphemeralKeyData, CreateEphemeralKeyError, CreateEphemeralKeyErrors, CreateEphemeralKeyResponse, CreateEphemeralKeyResponses, CreateImageData, CreateImageError, CreateImageErrors, CreateImageResponse, CreateImageResponses, CreateKnowledgeData, CreateKnowledgeError, CreateKnowledgeErrors, CreateKnowledgeFromFileData, CreateKnowledgeFromFileError, CreateKnowledgeFromFileErrors, CreateKnowledgeFromFileResponse, CreateKnowledgeFromFileResponses, CreateKnowledgeFromUrlData, CreateKnowledgeFromUrlError, CreateKnowledgeFromUrlErrors, CreateKnowledgeFromUrlResponse, CreateKnowledgeFromUrlResponses, CreateKnowledgeResponse, CreateKnowledgeResponses, CreateKnowledgeUploadUrlData, CreateKnowledgeUploadUrlError, CreateKnowledgeUploadUrlErrors, CreateKnowledgeUploadUrlResponse, CreateKnowledgeUploadUrlResponses, CreateSessionData, CreateSessionError, CreateSessionErrors, CreateSessionResponse, CreateSessionResponses, CreateSkyboxData, CreateSkyboxError, CreateSkyboxErrors, CreateSkyboxResponse, CreateSkyboxResponses, CreateTranscriptionData, CreateTranscriptionError, CreateTranscriptionErrors, CreateTranscriptionResponse, CreateTranscriptionResponses, CreateVideoData, CreateVideoError, CreateVideoErrors, CreateVideoResponse, CreateVideoResponses, CreateVoiceData, CreateVoiceError, CreateVoiceErrors, CreateVoiceResponse, CreateVoiceResponses, CreateVoiceUploadUrlData, CreateVoiceUploadUrlError, CreateVoiceUploadUrlErrors, CreateVoiceUploadUrlResponse, CreateVoiceUploadUrlResponses, DeleteAgentData, DeleteAgentError, DeleteAgentErrors, DeleteAgentResponse, DeleteAgentResponses, DeleteAllFactsData, DeleteAllFactsError, DeleteAllFactsErrors, DeleteAllFactsResponse, DeleteAllFactsResponses, DeleteAssetData, DeleteAssetError, DeleteAssetErrors, DeleteAssetFolderData, DeleteAssetFolderError, DeleteAssetFolderErrors, DeleteAssetFolderResponse, DeleteAssetFolderResponses, DeleteAssetResponse, DeleteAssetResponses, DeleteAssetsData, DeleteAssetsError, DeleteAssetsErrors, DeleteAssetsResponse, DeleteAssetsResponses, DeleteEndUserData, DeleteEndUserError, DeleteEndUserErrors, DeleteEndUserResponse, DeleteEndUserResponses, DeleteFactData, DeleteFactError, DeleteFactErrors, DeleteFactResponse, DeleteFactResponses, DeleteKnowledgeData, DeleteKnowledgeError, DeleteKnowledgeErrors, DeleteKnowledgeResponse, DeleteKnowledgeResponses, DeleteSessionData, DeleteSessionError, DeleteSessionErrors, DeleteSessionResponse, DeleteSessionResponses, DeleteVoiceData, DeleteVoiceError, DeleteVoiceErrors, DeleteVoiceResponse, DeleteVoiceResponses, DesignVoiceData, DesignVoiceError, DesignVoiceErrors, DesignVoiceResponse, DesignVoiceResponses, EndUserCreateRequest, EndUserDeleted, EndUserInfo, EndUserPage, EndUserUpdateRequest, EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EphemeralKeyInfo, EphemeralKeyLimits, EphemeralKeyPage, EphemeralTokenSelf, ErrorCode, ErrorInfo, ErrorResponse, ExtractSessionFactsData, ExtractSessionFactsError, ExtractSessionFactsErrors, ExtractSessionFactsResponse, ExtractSessionFactsResponses, FactInfo, FactPage, FactsDeleted, FolderCreate, FolderDeleted, FolderDetail, FolderPage, FolderSummary, FolderUpdate, GenerateFromTemplateData, GenerateFromTemplateError, GenerateFromTemplateErrors, GenerateFromTemplateResponse, GenerateFromTemplateResponses, GenerationAudio, GenerationImage, GenerationInfo, GenerationPage, GenerationSkybox, GenerationTranscript, GenerationVideo, GetAgentData, GetAgentError, GetAgentErrors, GetAgentResponse, GetAgentResponses, GetAgentSettingsData, GetAgentSettingsError, GetAgentSettingsErrors, GetAgentSettingsResponse, GetAgentSettingsResponses, GetAssetData, GetAssetError, GetAssetErrors, GetAssetFolderData, GetAssetFolderError, GetAssetFolderErrors, GetAssetFolderResponse, GetAssetFolderResponses, GetAssetResponse, GetAssetResponses, GetAudioData, GetAudioError, GetAudioErrors, GetAudioResponse, GetAudioResponses, GetEndUserData, GetEndUserError, GetEndUserErrors, GetEndUserResponse, GetEndUserResponses, GetEphemeralKeyData, GetEphemeralKeyError, GetEphemeralKeyErrors, GetEphemeralKeyLimitsData, GetEphemeralKeyLimitsError, GetEphemeralKeyLimitsErrors, GetEphemeralKeyLimitsResponse, GetEphemeralKeyLimitsResponses, GetEphemeralKeyResponse, GetEphemeralKeyResponses, GetGenerationData, GetGenerationError, GetGenerationErrors, GetGenerationResponse, GetGenerationResponses, GetHealthData, GetHealthResponse, GetHealthResponses, GetImageData, GetImageError, GetImageErrors, GetImageResponse, GetImageResponses, GetKnowledgeData, GetKnowledgeError, GetKnowledgeErrors, GetKnowledgeInsightsData, GetKnowledgeInsightsError, GetKnowledgeInsightsErrors, GetKnowledgeInsightsResponse, GetKnowledgeInsightsResponses, GetKnowledgeResponse, GetKnowledgeResponses, GetPlanData, GetPlanError, GetPlanErrors, GetPlanResponse, GetPlanResponses, GetSessionData, GetSessionError, GetSessionErrors, GetSessionResponse, GetSessionResponses, GetSkyboxData, GetSkyboxError, GetSkyboxErrors, GetSkyboxResponse, GetSkyboxResponses, GetTemplateData, GetTemplateError, GetTemplateErrors, GetTemplateFileData, GetTemplateFileError, GetTemplateFileErrors, GetTemplateFileResponses, GetTemplateResponse, GetTemplateResponses, GetTokenData, GetTokenError, GetTokenErrors, GetTokenResponse, GetTokenResponses, GetTranscriptionData, GetTranscriptionError, GetTranscriptionErrors, GetTranscriptionResponse, GetTranscriptionResponses, GetUsageData, GetUsageError, GetUsageErrors, GetUsageResponse, GetUsageResponses, GetVideoData, GetVideoError, GetVideoErrors, GetVideoResponse, GetVideoResponses, GetVoiceData, GetVoiceError, GetVoiceErrors, GetVoiceResponse, GetVoiceResponses, HealthResponse, ImageRequest, KnowledgeAgentsUpdate, KnowledgeAssigned, KnowledgeBulk, KnowledgeBulkResult, KnowledgeCategoryPage, KnowledgeCitation, KnowledgeCreate, KnowledgeEntryUsage, KnowledgeFileCreate, KnowledgeInfo, KnowledgeInsights, KnowledgeLookupInfo, KnowledgePage, KnowledgeSearchHit, KnowledgeSearchRequest, KnowledgeSearchResult, KnowledgeUpdate, KnowledgeUploadRequest, KnowledgeUploadTicket, KnowledgeUrlCreate, ListAgentKnowledgeData, ListAgentKnowledgeError, ListAgentKnowledgeErrors, ListAgentKnowledgeResponse, ListAgentKnowledgeResponses, ListAgentsData, ListAgentsError, ListAgentsErrors, ListAgentsResponse, ListAgentsResponses, ListAssetFoldersData, ListAssetFoldersError, ListAssetFoldersErrors, ListAssetFoldersResponse, ListAssetFoldersResponses, ListAssetsData, ListAssetsError, ListAssetsErrors, ListAssetsResponse, ListAssetsResponses, ListEndUsersData, ListEndUsersError, ListEndUsersErrors, ListEndUsersResponse, ListEndUsersResponses, ListEphemeralKeysData, ListEphemeralKeysError, ListEphemeralKeysErrors, ListEphemeralKeysResponse, ListEphemeralKeysResponses, ListFactsData, ListFactsError, ListFactsErrors, ListFactsResponse, ListFactsResponses, ListGenerationsData, ListGenerationsError, ListGenerationsErrors, ListGenerationsResponse, ListGenerationsResponses, ListKnowledgeCategoriesData, ListKnowledgeCategoriesError, ListKnowledgeCategoriesErrors, ListKnowledgeCategoriesResponse, ListKnowledgeCategoriesResponses, ListKnowledgeData, ListKnowledgeError, ListKnowledgeErrors, ListKnowledgeResponse, ListKnowledgeResponses, ListRelationsData, ListRelationsError, ListRelationsErrors, ListRelationsResponse, ListRelationsResponses, ListSessionsData, ListSessionsError, ListSessionsErrors, ListSessionsResponse, ListSessionsResponses, ListSkyboxStylesData, ListSkyboxStylesError, ListSkyboxStylesErrors, ListSkyboxStylesResponse, ListSkyboxStylesResponses, ListTemplatesData, ListTemplatesError, ListTemplatesErrors, ListTemplatesResponse, ListTemplatesResponses, ListVoicesData, ListVoicesError, ListVoicesErrors, ListVoicesResponse, ListVoicesResponses, MessageInfo, MessageKnowledge, MessagePage, MoveAssetsData, MoveAssetsError, MoveAssetsErrors, MoveAssetsResponse, MoveAssetsResponses, OrgPlan, ProviderVoiceSettings, ProviderVoiceSettingsInfo, Reference, RefreshKnowledgeData, RefreshKnowledgeError, RefreshKnowledgeErrors, RefreshKnowledgeResponse, RefreshKnowledgeResponses, ReindexKnowledgeData, ReindexKnowledgeError, ReindexKnowledgeErrors, ReindexKnowledgeResponse, ReindexKnowledgeResponses, RelationInfo, RelationPage, ResampleVoiceData, ResampleVoiceError, ResampleVoiceErrors, ResampleVoiceResponse, ResampleVoiceResponses, RevokeEphemeralKeyData, RevokeEphemeralKeyError, RevokeEphemeralKeyErrors, RevokeEphemeralKeyResponse, RevokeEphemeralKeyResponses, SaveDesignedVoiceData, SaveDesignedVoiceError, SaveDesignedVoiceErrors, SaveDesignedVoiceResponse, SaveDesignedVoiceResponses, SearchKnowledgeData, SearchKnowledgeError, SearchKnowledgeErrors, SearchKnowledgeResponse, SearchKnowledgeResponses, SessionCreateRequest, SessionDetail, SessionInfo, SessionPage, SetAgentKnowledgeData, SetAgentKnowledgeError, SetAgentKnowledgeErrors, SetAgentKnowledgeResponse, SetAgentKnowledgeResponses, SetKnowledgeAgentsData, SetKnowledgeAgentsError, SetKnowledgeAgentsErrors, SetKnowledgeAgentsResponse, SetKnowledgeAgentsResponses, SkyboxFile, SkyboxRequest, SkyboxStyle, SkyboxStylePage, SpeechProvider, StreamDone, StreamError, StreamSegment, StreamTranscript, SynthesizeSpeechData, SynthesizeSpeechError, SynthesizeSpeechErrors, SynthesizeSpeechResponse, SynthesizeSpeechResponses, TemplateGenerateRequest, TemplateInfo, TemplateInput, TemplatePage, TokenSelf, TranscribeAssetRequest, TranscribeData, TranscribeError, TranscribeErrors, TranscribeResponse, TranscribeResponses, Transcription, TranscriptionStreamLine, TranscriptWord, TtsOptions, TtsRequest, UnansweredQuestion, UpdateAgentData, UpdateAgentError, UpdateAgentErrors, UpdateAgentResponse, UpdateAgentResponses, UpdateAgentSettingsData, UpdateAgentSettingsError, UpdateAgentSettingsErrors, UpdateAgentSettingsResponse, UpdateAgentSettingsResponses, UpdateAssetData, UpdateAssetError, UpdateAssetErrors, UpdateAssetFolderData, UpdateAssetFolderError, UpdateAssetFolderErrors, UpdateAssetFolderResponse, UpdateAssetFolderResponses, UpdateAssetResponse, UpdateAssetResponses, UpdateEndUserData, UpdateEndUserError, UpdateEndUserErrors, UpdateEndUserResponse, UpdateEndUserResponses, UpdateKnowledgeData, UpdateKnowledgeError, UpdateKnowledgeErrors, UpdateKnowledgeResponse, UpdateKnowledgeResponses, UpdateVoiceData, UpdateVoiceError, UpdateVoiceErrors, UpdateVoiceResponse, UpdateVoiceResponses, UploadConfirm, UploadTicket, UploadTicketRequest, UsageByKey, UsageDay, UsageResponse, UsageSummary, ValidationIssue, VariantInfo, VideoRequest, VoiceDesignPreview, VoiceDesignRequest, VoiceDesignResult, VoiceDesignSaveRequest, VoiceDetail, VoiceInfo, VoiceInfoPage, VoiceKind, VoiceSample, VoiceSource, VoiceStatus, VoiceUpdate, VoiceUpload, VoiceUploadRequest, VoiceUploadTicket } from './types.gen.js';
1
+ export type { AgentCreateRequest, AgentInfo, AgentKnowledgeUpdate, AgentPage, AgentSettingsInfo, AgentSettingsUpdate, AgentStt, AgentSttInfo, AgentSummary, AgentToolsUpdate, AgentUpdate, AgentVoice, AgentVoiceInfo, ApiKeySelf, AssetBulkRequest, AssetDetail, AssetMoveRequest, AssetPage, AssetsAffected, AssetSummary, AssetUpdate, AssignedAgent, AudioRequest, BulkEditKnowledgeData, BulkEditKnowledgeError, BulkEditKnowledgeErrors, BulkEditKnowledgeResponse, BulkEditKnowledgeResponses, ClientOptions, CompactionInfo, CompactRequest, CompactSessionData, CompactSessionError, CompactSessionErrors, CompactSessionResponse, CompactSessionResponses, ConfirmAssetUploadData, ConfirmAssetUploadError, ConfirmAssetUploadErrors, ConfirmAssetUploadResponse, ConfirmAssetUploadResponses, CreateAgentData, CreateAgentError, CreateAgentErrors, CreateAgentResponse, CreateAgentResponses, CreateAssetFolderData, CreateAssetFolderError, CreateAssetFolderErrors, CreateAssetFolderResponse, CreateAssetFolderResponses, CreateAssetUploadUrlData, CreateAssetUploadUrlError, CreateAssetUploadUrlErrors, CreateAssetUploadUrlResponse, CreateAssetUploadUrlResponses, CreateAudioData, CreateAudioError, CreateAudioErrors, CreateAudioResponse, CreateAudioResponses, CreateEndUserData, CreateEndUserError, CreateEndUserErrors, CreateEndUserResponse, CreateEndUserResponses, CreateEphemeralKeyData, CreateEphemeralKeyError, CreateEphemeralKeyErrors, CreateEphemeralKeyResponse, CreateEphemeralKeyResponses, CreateImageData, CreateImageError, CreateImageErrors, CreateImageResponse, CreateImageResponses, CreateKnowledgeData, CreateKnowledgeError, CreateKnowledgeErrors, CreateKnowledgeFromFileData, CreateKnowledgeFromFileError, CreateKnowledgeFromFileErrors, CreateKnowledgeFromFileResponse, CreateKnowledgeFromFileResponses, CreateKnowledgeFromUrlData, CreateKnowledgeFromUrlError, CreateKnowledgeFromUrlErrors, CreateKnowledgeFromUrlResponse, CreateKnowledgeFromUrlResponses, CreateKnowledgeResponse, CreateKnowledgeResponses, CreateKnowledgeUploadUrlData, CreateKnowledgeUploadUrlError, CreateKnowledgeUploadUrlErrors, CreateKnowledgeUploadUrlResponse, CreateKnowledgeUploadUrlResponses, CreateSessionData, CreateSessionError, CreateSessionErrors, CreateSessionResponse, CreateSessionResponses, CreateSkyboxData, CreateSkyboxError, CreateSkyboxErrors, CreateSkyboxResponse, CreateSkyboxResponses, CreateToolData, CreateToolError, CreateToolErrors, CreateToolResponse, CreateToolResponses, CreateTranscriptionData, CreateTranscriptionError, CreateTranscriptionErrors, CreateTranscriptionResponse, CreateTranscriptionResponses, CreateVideoData, CreateVideoError, CreateVideoErrors, CreateVideoResponse, CreateVideoResponses, CreateVoiceData, CreateVoiceError, CreateVoiceErrors, CreateVoiceResponse, CreateVoiceResponses, CreateVoiceUploadUrlData, CreateVoiceUploadUrlError, CreateVoiceUploadUrlErrors, CreateVoiceUploadUrlResponse, CreateVoiceUploadUrlResponses, DeleteAgentData, DeleteAgentError, DeleteAgentErrors, DeleteAgentResponse, DeleteAgentResponses, DeleteAllFactsData, DeleteAllFactsError, DeleteAllFactsErrors, DeleteAllFactsResponse, DeleteAllFactsResponses, DeleteAssetData, DeleteAssetError, DeleteAssetErrors, DeleteAssetFolderData, DeleteAssetFolderError, DeleteAssetFolderErrors, DeleteAssetFolderResponse, DeleteAssetFolderResponses, DeleteAssetResponse, DeleteAssetResponses, DeleteAssetsData, DeleteAssetsError, DeleteAssetsErrors, DeleteAssetsResponse, DeleteAssetsResponses, DeleteEndUserData, DeleteEndUserError, DeleteEndUserErrors, DeleteEndUserResponse, DeleteEndUserResponses, DeleteFactData, DeleteFactError, DeleteFactErrors, DeleteFactResponse, DeleteFactResponses, DeleteKnowledgeData, DeleteKnowledgeError, DeleteKnowledgeErrors, DeleteKnowledgeResponse, DeleteKnowledgeResponses, DeleteSessionData, DeleteSessionError, DeleteSessionErrors, DeleteSessionResponse, DeleteSessionResponses, DeleteToolData, DeleteToolError, DeleteToolErrors, DeleteToolResponse, DeleteToolResponses, DeleteVoiceData, DeleteVoiceError, DeleteVoiceErrors, DeleteVoiceResponse, DeleteVoiceResponses, DesignVoiceData, DesignVoiceError, DesignVoiceErrors, DesignVoiceResponse, DesignVoiceResponses, EndUserCreateRequest, EndUserDeleted, EndUserInfo, EndUserPage, EndUserUpdateRequest, EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EphemeralKeyInfo, EphemeralKeyLimits, EphemeralKeyPage, EphemeralTokenSelf, ErrorCode, ErrorInfo, ErrorResponse, ExtractSessionFactsData, ExtractSessionFactsError, ExtractSessionFactsErrors, ExtractSessionFactsResponse, ExtractSessionFactsResponses, FactInfo, FactPage, FactsDeleted, FolderCreate, FolderDeleted, FolderDetail, FolderPage, FolderSummary, FolderUpdate, GenerateFromTemplateData, GenerateFromTemplateError, GenerateFromTemplateErrors, GenerateFromTemplateResponse, GenerateFromTemplateResponses, GenerationAudio, GenerationImage, GenerationInfo, GenerationPage, GenerationSkybox, GenerationTranscript, GenerationVideo, GetAgentData, GetAgentError, GetAgentErrors, GetAgentResponse, GetAgentResponses, GetAgentSettingsData, GetAgentSettingsError, GetAgentSettingsErrors, GetAgentSettingsResponse, GetAgentSettingsResponses, GetAssetData, GetAssetError, GetAssetErrors, GetAssetFolderData, GetAssetFolderError, GetAssetFolderErrors, GetAssetFolderResponse, GetAssetFolderResponses, GetAssetResponse, GetAssetResponses, GetAudioData, GetAudioError, GetAudioErrors, GetAudioResponse, GetAudioResponses, GetEndUserData, GetEndUserError, GetEndUserErrors, GetEndUserResponse, GetEndUserResponses, GetEphemeralKeyData, GetEphemeralKeyError, GetEphemeralKeyErrors, GetEphemeralKeyLimitsData, GetEphemeralKeyLimitsError, GetEphemeralKeyLimitsErrors, GetEphemeralKeyLimitsResponse, GetEphemeralKeyLimitsResponses, GetEphemeralKeyResponse, GetEphemeralKeyResponses, GetGenerationData, GetGenerationError, GetGenerationErrors, GetGenerationResponse, GetGenerationResponses, GetHealthData, GetHealthResponse, GetHealthResponses, GetImageData, GetImageError, GetImageErrors, GetImageResponse, GetImageResponses, GetKnowledgeData, GetKnowledgeError, GetKnowledgeErrors, GetKnowledgeInsightsData, GetKnowledgeInsightsError, GetKnowledgeInsightsErrors, GetKnowledgeInsightsResponse, GetKnowledgeInsightsResponses, GetKnowledgeResponse, GetKnowledgeResponses, GetPlanData, GetPlanError, GetPlanErrors, GetPlanResponse, GetPlanResponses, GetSessionData, GetSessionError, GetSessionErrors, GetSessionResponse, GetSessionResponses, GetSkyboxData, GetSkyboxError, GetSkyboxErrors, GetSkyboxResponse, GetSkyboxResponses, GetTemplateData, GetTemplateError, GetTemplateErrors, GetTemplateFileData, GetTemplateFileError, GetTemplateFileErrors, GetTemplateFileResponses, GetTemplateResponse, GetTemplateResponses, GetTokenData, GetTokenError, GetTokenErrors, GetTokenResponse, GetTokenResponses, GetToolData, GetToolError, GetToolErrors, GetToolResponse, GetToolResponses, GetTranscriptionData, GetTranscriptionError, GetTranscriptionErrors, GetTranscriptionResponse, GetTranscriptionResponses, GetUsageData, GetUsageError, GetUsageErrors, GetUsageResponse, GetUsageResponses, GetVideoData, GetVideoError, GetVideoErrors, GetVideoResponse, GetVideoResponses, GetVoiceData, GetVoiceError, GetVoiceErrors, GetVoiceResponse, GetVoiceResponses, HealthResponse, ImageRequest, KnowledgeAgentsUpdate, KnowledgeAssigned, KnowledgeBulk, KnowledgeBulkResult, KnowledgeCategoryPage, KnowledgeCitation, KnowledgeCreate, KnowledgeEntryUsage, KnowledgeFileCreate, KnowledgeInfo, KnowledgeInsights, KnowledgeLookupInfo, KnowledgePage, KnowledgeSearchHit, KnowledgeSearchRequest, KnowledgeSearchResult, KnowledgeUpdate, KnowledgeUploadRequest, KnowledgeUploadTicket, KnowledgeUrlCreate, ListAgentKnowledgeData, ListAgentKnowledgeError, ListAgentKnowledgeErrors, ListAgentKnowledgeResponse, ListAgentKnowledgeResponses, ListAgentsData, ListAgentsError, ListAgentsErrors, ListAgentsResponse, ListAgentsResponses, ListAgentToolsData, ListAgentToolsError, ListAgentToolsErrors, ListAgentToolsResponse, ListAgentToolsResponses, ListAssetFoldersData, ListAssetFoldersError, ListAssetFoldersErrors, ListAssetFoldersResponse, ListAssetFoldersResponses, ListAssetsData, ListAssetsError, ListAssetsErrors, ListAssetsResponse, ListAssetsResponses, ListEndUsersData, ListEndUsersError, ListEndUsersErrors, ListEndUsersResponse, ListEndUsersResponses, ListEphemeralKeysData, ListEphemeralKeysError, ListEphemeralKeysErrors, ListEphemeralKeysResponse, ListEphemeralKeysResponses, ListFactsData, ListFactsError, ListFactsErrors, ListFactsResponse, ListFactsResponses, ListGenerationsData, ListGenerationsError, ListGenerationsErrors, ListGenerationsResponse, ListGenerationsResponses, ListKnowledgeCategoriesData, ListKnowledgeCategoriesError, ListKnowledgeCategoriesErrors, ListKnowledgeCategoriesResponse, ListKnowledgeCategoriesResponses, ListKnowledgeData, ListKnowledgeError, ListKnowledgeErrors, ListKnowledgeResponse, ListKnowledgeResponses, ListRelationsData, ListRelationsError, ListRelationsErrors, ListRelationsResponse, ListRelationsResponses, ListSessionsData, ListSessionsError, ListSessionsErrors, ListSessionsResponse, ListSessionsResponses, ListSkyboxStylesData, ListSkyboxStylesError, ListSkyboxStylesErrors, ListSkyboxStylesResponse, ListSkyboxStylesResponses, ListTemplatesData, ListTemplatesError, ListTemplatesErrors, ListTemplatesResponse, ListTemplatesResponses, ListToolsData, ListToolsError, ListToolsErrors, ListToolsResponse, ListToolsResponses, ListVoicesData, ListVoicesError, ListVoicesErrors, ListVoicesResponse, ListVoicesResponses, MessageInfo, MessageKnowledge, MessagePage, MessageSource, MessageToolCall, MoveAssetsData, MoveAssetsError, MoveAssetsErrors, MoveAssetsResponse, MoveAssetsResponses, OrgPlan, ProviderVoiceSettings, ProviderVoiceSettingsInfo, Reference, RefreshKnowledgeData, RefreshKnowledgeError, RefreshKnowledgeErrors, RefreshKnowledgeResponse, RefreshKnowledgeResponses, ReindexKnowledgeData, ReindexKnowledgeError, ReindexKnowledgeErrors, ReindexKnowledgeResponse, ReindexKnowledgeResponses, RelationInfo, RelationPage, ResampleVoiceData, ResampleVoiceError, ResampleVoiceErrors, ResampleVoiceResponse, ResampleVoiceResponses, RevokeEphemeralKeyData, RevokeEphemeralKeyError, RevokeEphemeralKeyErrors, RevokeEphemeralKeyResponse, RevokeEphemeralKeyResponses, RotateToolSecretData, RotateToolSecretError, RotateToolSecretErrors, RotateToolSecretResponse, RotateToolSecretResponses, SaveDesignedVoiceData, SaveDesignedVoiceError, SaveDesignedVoiceErrors, SaveDesignedVoiceResponse, SaveDesignedVoiceResponses, SearchKnowledgeData, SearchKnowledgeError, SearchKnowledgeErrors, SearchKnowledgeResponse, SearchKnowledgeResponses, SessionCreateRequest, SessionDetail, SessionInfo, SessionPage, SetAgentKnowledgeData, SetAgentKnowledgeError, SetAgentKnowledgeErrors, SetAgentKnowledgeResponse, SetAgentKnowledgeResponses, SetAgentToolsData, SetAgentToolsError, SetAgentToolsErrors, SetAgentToolsResponse, SetAgentToolsResponses, SetKnowledgeAgentsData, SetKnowledgeAgentsError, SetKnowledgeAgentsErrors, SetKnowledgeAgentsResponse, SetKnowledgeAgentsResponses, SkyboxFile, SkyboxRequest, SkyboxStyle, SkyboxStylePage, SpeechProvider, StreamDone, StreamError, StreamSegment, StreamTranscript, SynthesizeSpeechData, SynthesizeSpeechError, SynthesizeSpeechErrors, SynthesizeSpeechResponse, SynthesizeSpeechResponses, TemplateGenerateRequest, TemplateInfo, TemplateInput, TemplatePage, TestToolData, TestToolError, TestToolErrors, TestToolResponse, TestToolResponses, TokenSelf, ToolCreate, ToolInfo, ToolPage, ToolsAssigned, ToolTestRequest, ToolTestResult, ToolUpdate, ToolWithSecret, TranscribeAssetRequest, TranscribeData, TranscribeError, TranscribeErrors, TranscribeResponse, TranscribeResponses, Transcription, TranscriptionStreamLine, TranscriptWord, TtsOptions, TtsRequest, UnansweredQuestion, UpdateAgentData, UpdateAgentError, UpdateAgentErrors, UpdateAgentResponse, UpdateAgentResponses, UpdateAgentSettingsData, UpdateAgentSettingsError, UpdateAgentSettingsErrors, UpdateAgentSettingsResponse, UpdateAgentSettingsResponses, UpdateAssetData, UpdateAssetError, UpdateAssetErrors, UpdateAssetFolderData, UpdateAssetFolderError, UpdateAssetFolderErrors, UpdateAssetFolderResponse, UpdateAssetFolderResponses, UpdateAssetResponse, UpdateAssetResponses, UpdateEndUserData, UpdateEndUserError, UpdateEndUserErrors, UpdateEndUserResponse, UpdateEndUserResponses, UpdateKnowledgeData, UpdateKnowledgeError, UpdateKnowledgeErrors, UpdateKnowledgeResponse, UpdateKnowledgeResponses, UpdateToolData, UpdateToolError, UpdateToolErrors, UpdateToolResponse, UpdateToolResponses, UpdateVoiceData, UpdateVoiceError, UpdateVoiceErrors, UpdateVoiceResponse, UpdateVoiceResponses, UploadConfirm, UploadTicket, UploadTicketRequest, UsageByKey, UsageDay, UsageResponse, UsageSummary, ValidationIssue, VariantInfo, VideoRequest, VoiceDesignPreview, VoiceDesignRequest, VoiceDesignResult, VoiceDesignSaveRequest, VoiceDetail, VoiceInfo, VoiceInfoPage, VoiceKind, VoiceSample, VoiceSource, VoiceStatus, VoiceUpdate, VoiceUpload, VoiceUploadRequest, VoiceUploadTicket } from './types.gen.js';
@@ -1124,6 +1124,14 @@ export type MessageInfo = {
1124
1124
  */
1125
1125
  mood_intensity: number | null;
1126
1126
  role: 'user' | 'assistant';
1127
+ /**
1128
+ * On a reply: the web pages it read, with the agent's `url_context` switch on. Empty when it read none, and on the person's messages.
1129
+ */
1130
+ sources: Array<MessageSource>;
1131
+ /**
1132
+ * On a reply: the calls of your tools it made, in order, each with its arguments and what it answered. Empty when it called none, and on the person's messages.
1133
+ */
1134
+ tool_calls: Array<MessageToolCall>;
1127
1135
  };
1128
1136
  export type MessageKnowledge = {
1129
1137
  lookups: Array<KnowledgeLookupInfo>;
@@ -1149,6 +1157,50 @@ export type KnowledgeCitation = {
1149
1157
  score: number;
1150
1158
  title: string;
1151
1159
  };
1160
+ /**
1161
+ * A web page the reply read with the agent's `url_context` switch on.
1162
+ */
1163
+ export type MessageSource = {
1164
+ url: string;
1165
+ /**
1166
+ * Whether the page could be read. A reply may name a page it could not fetch — behind a login, refused by its site, gone — and answers without it.
1167
+ */
1168
+ retrieved: boolean;
1169
+ };
1170
+ export type MessageToolCall = {
1171
+ /**
1172
+ * The call's id, `call_…`: what your server or app was sent.
1173
+ */
1174
+ call_id: string;
1175
+ name: string;
1176
+ kind: 'webhook' | 'app';
1177
+ /**
1178
+ * What the model called it with.
1179
+ */
1180
+ arguments: {
1181
+ [key: string]: unknown;
1182
+ };
1183
+ /**
1184
+ * What it answered, as the model read it — its JSON, or its text, cut at 16 KB. Null when it answered nothing.
1185
+ */
1186
+ result?: unknown;
1187
+ /**
1188
+ * It answered in time, with a 2xx or a result.
1189
+ */
1190
+ ok: boolean;
1191
+ /**
1192
+ * What failed, as the model was told — or, for a tool that asks first, that it waited for the person's yes. Null when nothing did.
1193
+ */
1194
+ error: string | null;
1195
+ /**
1196
+ * How long it took.
1197
+ */
1198
+ ms: number;
1199
+ /**
1200
+ * Which of the reply's rounds of calls, 1 to 3; 0 for a call the person confirmed with a tap.
1201
+ */
1202
+ round: number;
1203
+ };
1152
1204
  export type RelationInfo = {
1153
1205
  agent_id: string;
1154
1206
  /**
@@ -1325,6 +1377,12 @@ export type AgentPage = {
1325
1377
  next_cursor: string | null;
1326
1378
  };
1327
1379
  export type AgentSummary = {
1380
+ /**
1381
+ * Whether the model may write and run Python while it replies — sums, unit conversions, dates — and answer from what it printed. Gemini's own tool: it runs at Google, with no network, and nothing of yours.
1382
+ *
1383
+ * **No fee, but not free**: the code and its output are model tokens, billed like any reply.
1384
+ */
1385
+ code_execution: boolean;
1328
1386
  /**
1329
1387
  * What to tell the model when summarising. Unset uses the organisation's default, then a built-in instruction written for in-character conversations.
1330
1388
  */
@@ -1477,6 +1535,12 @@ export type AgentSummary = {
1477
1535
  * How it speaks: register, pacing, verbosity.
1478
1536
  */
1479
1537
  tone: string | null;
1538
+ /**
1539
+ * Whether the model may read a web page by its address while it replies, when the person gives one or one is in its instructions. Gemini's own tool: the page is fetched by Google. The pages it read come back as the reply's `sources`.
1540
+ *
1541
+ * **No fee, but not free**: a page's text is model tokens, billed like any reply — a long page can be thousands. A page is untrusted input: what it says reaches the model, so the most it can steer the agent towards is the agent's own tools, and a tool marked `ask_first` still needs the person.
1542
+ */
1543
+ url_context: boolean;
1480
1544
  /**
1481
1545
  * Voice and model settings.
1482
1546
  *
@@ -1556,6 +1620,12 @@ export type AgentVoiceInfo = {
1556
1620
  voice_id: string | null;
1557
1621
  };
1558
1622
  export type AgentInfo = {
1623
+ /**
1624
+ * Whether the model may write and run Python while it replies — sums, unit conversions, dates — and answer from what it printed. Gemini's own tool: it runs at Google, with no network, and nothing of yours.
1625
+ *
1626
+ * **No fee, but not free**: the code and its output are model tokens, billed like any reply.
1627
+ */
1628
+ code_execution: boolean;
1559
1629
  /**
1560
1630
  * What to tell the model when summarising. Unset uses the organisation's default, then a built-in instruction written for in-character conversations.
1561
1631
  */
@@ -1708,6 +1778,12 @@ export type AgentInfo = {
1708
1778
  * How it speaks: register, pacing, verbosity.
1709
1779
  */
1710
1780
  tone: string | null;
1781
+ /**
1782
+ * Whether the model may read a web page by its address while it replies, when the person gives one or one is in its instructions. Gemini's own tool: the page is fetched by Google. The pages it read come back as the reply's `sources`.
1783
+ *
1784
+ * **No fee, but not free**: a page's text is model tokens, billed like any reply — a long page can be thousands. A page is untrusted input: what it says reaches the model, so the most it can steer the agent towards is the agent's own tools, and a tool marked `ask_first` still needs the person.
1785
+ */
1786
+ url_context: boolean;
1711
1787
  /**
1712
1788
  * Voice and model settings.
1713
1789
  *
@@ -1729,6 +1805,12 @@ export type AgentInfo = {
1729
1805
  version: number;
1730
1806
  };
1731
1807
  export type AgentCreateRequest = {
1808
+ /**
1809
+ * Whether the model may write and run Python while it replies — sums, unit conversions, dates — and answer from what it printed. Gemini's own tool: it runs at Google, with no network, and nothing of yours.
1810
+ *
1811
+ * **No fee, but not free**: the code and its output are model tokens, billed like any reply.
1812
+ */
1813
+ code_execution?: boolean | null;
1732
1814
  /**
1733
1815
  * What to tell the model when summarising. Unset uses the organisation's default, then a built-in instruction written for in-character conversations.
1734
1816
  */
@@ -1881,6 +1963,12 @@ export type AgentCreateRequest = {
1881
1963
  * How it speaks: register, pacing, verbosity.
1882
1964
  */
1883
1965
  tone?: string | null;
1966
+ /**
1967
+ * Whether the model may read a web page by its address while it replies, when the person gives one or one is in its instructions. Gemini's own tool: the page is fetched by Google. The pages it read come back as the reply's `sources`.
1968
+ *
1969
+ * **No fee, but not free**: a page's text is model tokens, billed like any reply — a long page can be thousands. A page is untrusted input: what it says reaches the model, so the most it can steer the agent towards is the agent's own tools, and a tool marked `ask_first` still needs the person.
1970
+ */
1971
+ url_context?: boolean | null;
1884
1972
  /**
1885
1973
  * Voice and model settings.
1886
1974
  *
@@ -2041,6 +2129,12 @@ export type AgentSettingsUpdate = {
2041
2129
  resume_max_age_days?: number | null;
2042
2130
  };
2043
2131
  export type AgentUpdate = {
2132
+ /**
2133
+ * Whether the model may write and run Python while it replies — sums, unit conversions, dates — and answer from what it printed. Gemini's own tool: it runs at Google, with no network, and nothing of yours.
2134
+ *
2135
+ * **No fee, but not free**: the code and its output are model tokens, billed like any reply.
2136
+ */
2137
+ code_execution?: boolean | null;
2044
2138
  /**
2045
2139
  * What to tell the model when summarising. Unset uses the organisation's default, then a built-in instruction written for in-character conversations.
2046
2140
  */
@@ -2193,6 +2287,12 @@ export type AgentUpdate = {
2193
2287
  * How it speaks: register, pacing, verbosity.
2194
2288
  */
2195
2289
  tone?: string | null;
2290
+ /**
2291
+ * Whether the model may read a web page by its address while it replies, when the person gives one or one is in its instructions. Gemini's own tool: the page is fetched by Google. The pages it read come back as the reply's `sources`.
2292
+ *
2293
+ * **No fee, but not free**: a page's text is model tokens, billed like any reply — a long page can be thousands. A page is untrusted input: what it says reaches the model, so the most it can steer the agent towards is the agent's own tools, and a tool marked `ask_first` still needs the person.
2294
+ */
2295
+ url_context?: boolean | null;
2196
2296
  /**
2197
2297
  * Voice and model settings.
2198
2298
  *
@@ -2574,6 +2674,218 @@ export type AgentKnowledgeUpdate = {
2574
2674
  */
2575
2675
  entry_ids: Array<string>;
2576
2676
  };
2677
+ export type ToolPage = {
2678
+ data: Array<ToolInfo>;
2679
+ /**
2680
+ * Pass as `cursor` for the next page; `null` when this is the last.
2681
+ */
2682
+ next_cursor: string | null;
2683
+ };
2684
+ export type ToolInfo = {
2685
+ /**
2686
+ * The tool's id, `tl_…`.
2687
+ */
2688
+ id: string;
2689
+ /**
2690
+ * What the model calls the tool by: 1 to 64 lower-case letters, digits and underscores, starting with a letter. Unique in your organisation; `search_knowledge` and `remember_relation` are the platform's own.
2691
+ */
2692
+ name: string;
2693
+ description: string;
2694
+ /**
2695
+ * `webhook`: your server, sent a signed `POST` with the call. `app`: the person's app, called over the agent's WebSocket. Fixed at creation.
2696
+ */
2697
+ kind: 'webhook' | 'app';
2698
+ /**
2699
+ * Its inputs, as a JSON Schema object: `{"type": "object", "properties": {…}, "required": […]}`, each property `string` (with an optional `enum`), `number`, `integer`, `boolean`, `array` (with `items`) or `object`, each with an optional `description`. Nothing else is taken: a key outside this set is refused rather than passed on unenforced.
2700
+ */
2701
+ parameters: {
2702
+ [key: string]: unknown;
2703
+ };
2704
+ /**
2705
+ * A webhook's address; `null` for an app's.
2706
+ */
2707
+ url: string | null;
2708
+ /**
2709
+ * How long a call may take, in milliseconds: 1000 to 30000, 10000 by default. Past it the call failed, and the model is told so.
2710
+ */
2711
+ timeout_ms: number;
2712
+ /**
2713
+ * Never run on the model's word alone: the agent asks the person first, and the tool runs only after they say yes.
2714
+ */
2715
+ ask_first: boolean;
2716
+ /**
2717
+ * An app's tool only: the app is told to act and the reply carries on at once, with no answer awaited.
2718
+ */
2719
+ action_only: boolean;
2720
+ /**
2721
+ * The line said before the call; `null` for none.
2722
+ */
2723
+ filler: string | null;
2724
+ /**
2725
+ * The names of the headers sent with each call; their values are never shown.
2726
+ */
2727
+ header_names: Array<string>;
2728
+ /**
2729
+ * The signing secret's last four characters; `null` for an app's tool.
2730
+ */
2731
+ secret_hint: string | null;
2732
+ /**
2733
+ * The agents it is turned on for.
2734
+ */
2735
+ agent_ids: Array<string>;
2736
+ /**
2737
+ * Moves by one on every save. Send it back as `expected_version` on an update to have the save refused (409) if somebody else changed the tool since you read it.
2738
+ */
2739
+ version: number;
2740
+ created_at: string;
2741
+ updated_at: string;
2742
+ };
2743
+ export type ToolWithSecret = ToolInfo & {
2744
+ /**
2745
+ * The signing secret, `whsec_…`, **shown this once**: every call is signed with it (`X-Tool-Signature`). Keep it on your server. `null` for an app's tool.
2746
+ */
2747
+ secret: string | null;
2748
+ };
2749
+ export type ToolCreate = {
2750
+ /**
2751
+ * What the model calls the tool by: 1 to 64 lower-case letters, digits and underscores, starting with a letter. Unique in your organisation; `search_knowledge` and `remember_relation` are the platform's own.
2752
+ */
2753
+ name: string;
2754
+ /**
2755
+ * What the tool does and when to call it, in the model's terms: it reads this to decide.
2756
+ */
2757
+ description: string;
2758
+ /**
2759
+ * `webhook`: your server, sent a signed `POST` with the call. `app`: the person's app, called over the agent's WebSocket. Fixed at creation.
2760
+ */
2761
+ kind: 'webhook' | 'app';
2762
+ /**
2763
+ * Its inputs (as above); omitted: it takes none.
2764
+ */
2765
+ parameters?: {
2766
+ [key: string]: unknown;
2767
+ };
2768
+ /**
2769
+ * A webhook's `https://` address, public, and not this platform's. An app's tool has none.
2770
+ */
2771
+ url?: string | null;
2772
+ /**
2773
+ * How long a call may take, in milliseconds: 1000 to 30000, 10000 by default. Past it the call failed, and the model is told so.
2774
+ */
2775
+ timeout_ms?: number;
2776
+ /**
2777
+ * Never run on the model's word alone: the agent asks the person first, and the tool runs only after they say yes.
2778
+ */
2779
+ ask_first?: boolean;
2780
+ /**
2781
+ * An app's tool only: the app is told to act and the reply carries on at once, with no answer awaited.
2782
+ */
2783
+ action_only?: boolean;
2784
+ /**
2785
+ * A line the agent says before the call, while it waits: `Let me check that for you.` `null`: none.
2786
+ */
2787
+ filler?: string | null;
2788
+ /**
2789
+ * A webhook's own headers, sent with every call (your API token): at most 10, stored encrypted and never shown again — a tool answers their names. `Content-Type`, `User-Agent`, `X-Tool-*` and HTTP's own are the platform's.
2790
+ */
2791
+ headers?: {
2792
+ [key: string]: string;
2793
+ } | null;
2794
+ };
2795
+ export type ToolUpdate = {
2796
+ /**
2797
+ * What the model calls the tool by: 1 to 64 lower-case letters, digits and underscores, starting with a letter. Unique in your organisation; `search_knowledge` and `remember_relation` are the platform's own.
2798
+ */
2799
+ name?: string;
2800
+ /**
2801
+ * What the tool does and when to call it, in the model's terms: it reads this to decide.
2802
+ */
2803
+ description?: string;
2804
+ /**
2805
+ * Its inputs, as a JSON Schema object: `{"type": "object", "properties": {…}, "required": […]}`, each property `string` (with an optional `enum`), `number`, `integer`, `boolean`, `array` (with `items`) or `object`, each with an optional `description`. Nothing else is taken: a key outside this set is refused rather than passed on unenforced.
2806
+ */
2807
+ parameters?: {
2808
+ [key: string]: unknown;
2809
+ };
2810
+ /**
2811
+ * A webhook's `https://` address, public, and not this platform's. An app's tool has none.
2812
+ */
2813
+ url?: string;
2814
+ /**
2815
+ * How long a call may take, in milliseconds: 1000 to 30000, 10000 by default. Past it the call failed, and the model is told so.
2816
+ */
2817
+ timeout_ms?: number;
2818
+ /**
2819
+ * Never run on the model's word alone: the agent asks the person first, and the tool runs only after they say yes.
2820
+ */
2821
+ ask_first?: boolean;
2822
+ /**
2823
+ * An app's tool only: the app is told to act and the reply carries on at once, with no answer awaited.
2824
+ */
2825
+ action_only?: boolean;
2826
+ /**
2827
+ * A line the agent says before the call, while it waits: `Let me check that for you.` `null`: none.
2828
+ */
2829
+ filler?: string | null;
2830
+ /**
2831
+ * Replaces every header; `null` or `{}` sends none.
2832
+ */
2833
+ headers?: {
2834
+ [key: string]: string;
2835
+ } | null;
2836
+ /**
2837
+ * The `version` you last read. When set and the tool has been changed since, the update is refused with 409 and nothing is written. Omit it to write unconditionally.
2838
+ */
2839
+ expected_version?: number | null;
2840
+ };
2841
+ export type ToolTestResult = {
2842
+ /**
2843
+ * Your server answered 2xx within the timeout.
2844
+ */
2845
+ ok: boolean;
2846
+ /**
2847
+ * Its HTTP status; `null` when none came (unreachable, or too slow).
2848
+ */
2849
+ status: number | null;
2850
+ /**
2851
+ * From sending to its answer's last byte.
2852
+ */
2853
+ duration_ms: number;
2854
+ /**
2855
+ * Its answer: the JSON it sent, else its text, cut at 16384 bytes; `null` for none.
2856
+ */
2857
+ result?: unknown;
2858
+ /**
2859
+ * The answer was longer than 16384 bytes and was cut.
2860
+ */
2861
+ truncated: boolean;
2862
+ /**
2863
+ * What failed, as the model would be told; `null` when it did not.
2864
+ */
2865
+ error: string | null;
2866
+ };
2867
+ export type ToolTestRequest = {
2868
+ /**
2869
+ * What the call carries as `arguments`; `{}` when omitted.
2870
+ */
2871
+ arguments?: {
2872
+ [key: string]: unknown;
2873
+ };
2874
+ };
2875
+ export type ToolsAssigned = {
2876
+ added: number;
2877
+ removed: number;
2878
+ /**
2879
+ * Ids sent that are not this organisation's, ignored.
2880
+ */
2881
+ skipped: Array<string>;
2882
+ };
2883
+ export type AgentToolsUpdate = {
2884
+ /**
2885
+ * The complete set, at most 20. An empty list turns every tool off.
2886
+ */
2887
+ tool_ids: Array<string>;
2888
+ };
2577
2889
  export type TtsRequest = {
2578
2890
  /**
2579
2891
  * An id from `GET /v1/voices` — the built-in voice, a platform voice, or one your organisation uploaded.
@@ -6111,6 +6423,380 @@ export type SetAgentKnowledgeResponses = {
6111
6423
  200: KnowledgeAssigned;
6112
6424
  };
6113
6425
  export type SetAgentKnowledgeResponse = SetAgentKnowledgeResponses[keyof SetAgentKnowledgeResponses];
6426
+ export type ListToolsData = {
6427
+ body?: never;
6428
+ path?: never;
6429
+ query?: never;
6430
+ url: '/v1/tools';
6431
+ };
6432
+ export type ListToolsErrors = {
6433
+ /**
6434
+ * Missing or invalid credentials
6435
+ */
6436
+ 401: ErrorResponse;
6437
+ /**
6438
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6439
+ */
6440
+ 403: ErrorResponse;
6441
+ /**
6442
+ * The request failed validation
6443
+ */
6444
+ 422: ErrorResponse;
6445
+ /**
6446
+ * Rate limit exceeded
6447
+ */
6448
+ 429: ErrorResponse;
6449
+ };
6450
+ export type ListToolsError = ListToolsErrors[keyof ListToolsErrors];
6451
+ export type ListToolsResponses = {
6452
+ /**
6453
+ * Every tool
6454
+ */
6455
+ 200: ToolPage;
6456
+ };
6457
+ export type ListToolsResponse = ListToolsResponses[keyof ListToolsResponses];
6458
+ export type CreateToolData = {
6459
+ body: ToolCreate;
6460
+ path?: never;
6461
+ query?: never;
6462
+ url: '/v1/tools';
6463
+ };
6464
+ export type CreateToolErrors = {
6465
+ /**
6466
+ * The request could not be read: malformed JSON
6467
+ */
6468
+ 400: ErrorResponse;
6469
+ /**
6470
+ * Missing or invalid credentials
6471
+ */
6472
+ 401: ErrorResponse;
6473
+ /**
6474
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6475
+ */
6476
+ 403: ErrorResponse;
6477
+ /**
6478
+ * A tool by that name exists already, or the library holds 200 tools.
6479
+ */
6480
+ 409: ErrorResponse;
6481
+ /**
6482
+ * The request failed validation
6483
+ */
6484
+ 422: ErrorResponse;
6485
+ /**
6486
+ * Rate limit exceeded
6487
+ */
6488
+ 429: ErrorResponse;
6489
+ /**
6490
+ * This deployment cannot seal a tool's secret (`TOOL_SECRET_KEY` unset): webhook tools cannot be saved or called.
6491
+ */
6492
+ 503: ErrorResponse;
6493
+ };
6494
+ export type CreateToolError = CreateToolErrors[keyof CreateToolErrors];
6495
+ export type CreateToolResponses = {
6496
+ /**
6497
+ * The tool, with its signing secret shown this once
6498
+ */
6499
+ 201: ToolWithSecret;
6500
+ };
6501
+ export type CreateToolResponse = CreateToolResponses[keyof CreateToolResponses];
6502
+ export type DeleteToolData = {
6503
+ body?: never;
6504
+ path: {
6505
+ tool_id: string;
6506
+ };
6507
+ query?: never;
6508
+ url: '/v1/tools/{tool_id}';
6509
+ };
6510
+ export type DeleteToolErrors = {
6511
+ /**
6512
+ * Missing or invalid credentials
6513
+ */
6514
+ 401: ErrorResponse;
6515
+ /**
6516
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6517
+ */
6518
+ 403: ErrorResponse;
6519
+ /**
6520
+ * Unknown tool id
6521
+ */
6522
+ 404: ErrorResponse;
6523
+ /**
6524
+ * The request failed validation
6525
+ */
6526
+ 422: ErrorResponse;
6527
+ /**
6528
+ * Rate limit exceeded
6529
+ */
6530
+ 429: ErrorResponse;
6531
+ };
6532
+ export type DeleteToolError = DeleteToolErrors[keyof DeleteToolErrors];
6533
+ export type DeleteToolResponses = {
6534
+ /**
6535
+ * The tool is gone
6536
+ */
6537
+ 204: void;
6538
+ };
6539
+ export type DeleteToolResponse = DeleteToolResponses[keyof DeleteToolResponses];
6540
+ export type GetToolData = {
6541
+ body?: never;
6542
+ path: {
6543
+ tool_id: string;
6544
+ };
6545
+ query?: never;
6546
+ url: '/v1/tools/{tool_id}';
6547
+ };
6548
+ export type GetToolErrors = {
6549
+ /**
6550
+ * Missing or invalid credentials
6551
+ */
6552
+ 401: ErrorResponse;
6553
+ /**
6554
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6555
+ */
6556
+ 403: ErrorResponse;
6557
+ /**
6558
+ * Unknown tool id
6559
+ */
6560
+ 404: ErrorResponse;
6561
+ /**
6562
+ * The request failed validation
6563
+ */
6564
+ 422: ErrorResponse;
6565
+ /**
6566
+ * Rate limit exceeded
6567
+ */
6568
+ 429: ErrorResponse;
6569
+ };
6570
+ export type GetToolError = GetToolErrors[keyof GetToolErrors];
6571
+ export type GetToolResponses = {
6572
+ /**
6573
+ * The tool
6574
+ */
6575
+ 200: ToolInfo;
6576
+ };
6577
+ export type GetToolResponse = GetToolResponses[keyof GetToolResponses];
6578
+ export type UpdateToolData = {
6579
+ body: ToolUpdate;
6580
+ path: {
6581
+ tool_id: string;
6582
+ };
6583
+ query?: never;
6584
+ url: '/v1/tools/{tool_id}';
6585
+ };
6586
+ export type UpdateToolErrors = {
6587
+ /**
6588
+ * The request could not be read: malformed JSON
6589
+ */
6590
+ 400: ErrorResponse;
6591
+ /**
6592
+ * Missing or invalid credentials
6593
+ */
6594
+ 401: ErrorResponse;
6595
+ /**
6596
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6597
+ */
6598
+ 403: ErrorResponse;
6599
+ /**
6600
+ * Unknown tool id
6601
+ */
6602
+ 404: ErrorResponse;
6603
+ /**
6604
+ * `expected_version` was sent and the tool has been changed since, or the new name is taken. Nothing was written.
6605
+ */
6606
+ 409: ErrorResponse;
6607
+ /**
6608
+ * The request failed validation
6609
+ */
6610
+ 422: ErrorResponse;
6611
+ /**
6612
+ * Rate limit exceeded
6613
+ */
6614
+ 429: ErrorResponse;
6615
+ /**
6616
+ * This deployment cannot seal a tool's secret (`TOOL_SECRET_KEY` unset): webhook tools cannot be saved or called.
6617
+ */
6618
+ 503: ErrorResponse;
6619
+ };
6620
+ export type UpdateToolError = UpdateToolErrors[keyof UpdateToolErrors];
6621
+ export type UpdateToolResponses = {
6622
+ /**
6623
+ * The tool as it now stands
6624
+ */
6625
+ 200: ToolInfo;
6626
+ };
6627
+ export type UpdateToolResponse = UpdateToolResponses[keyof UpdateToolResponses];
6628
+ export type RotateToolSecretData = {
6629
+ body?: never;
6630
+ path: {
6631
+ tool_id: string;
6632
+ };
6633
+ query?: never;
6634
+ url: '/v1/tools/{tool_id}/secret';
6635
+ };
6636
+ export type RotateToolSecretErrors = {
6637
+ /**
6638
+ * Missing or invalid credentials
6639
+ */
6640
+ 401: ErrorResponse;
6641
+ /**
6642
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6643
+ */
6644
+ 403: ErrorResponse;
6645
+ /**
6646
+ * Unknown tool id
6647
+ */
6648
+ 404: ErrorResponse;
6649
+ /**
6650
+ * The request failed validation
6651
+ */
6652
+ 422: ErrorResponse;
6653
+ /**
6654
+ * Rate limit exceeded
6655
+ */
6656
+ 429: ErrorResponse;
6657
+ /**
6658
+ * This deployment cannot seal a tool's secret (`TOOL_SECRET_KEY` unset): webhook tools cannot be saved or called.
6659
+ */
6660
+ 503: ErrorResponse;
6661
+ };
6662
+ export type RotateToolSecretError = RotateToolSecretErrors[keyof RotateToolSecretErrors];
6663
+ export type RotateToolSecretResponses = {
6664
+ /**
6665
+ * The tool, with its new signing secret
6666
+ */
6667
+ 200: ToolWithSecret;
6668
+ };
6669
+ export type RotateToolSecretResponse = RotateToolSecretResponses[keyof RotateToolSecretResponses];
6670
+ export type TestToolData = {
6671
+ body: ToolTestRequest;
6672
+ path: {
6673
+ tool_id: string;
6674
+ };
6675
+ query?: never;
6676
+ url: '/v1/tools/{tool_id}/test';
6677
+ };
6678
+ export type TestToolErrors = {
6679
+ /**
6680
+ * The request could not be read: malformed JSON
6681
+ */
6682
+ 400: ErrorResponse;
6683
+ /**
6684
+ * Missing or invalid credentials
6685
+ */
6686
+ 401: ErrorResponse;
6687
+ /**
6688
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6689
+ */
6690
+ 403: ErrorResponse;
6691
+ /**
6692
+ * Unknown tool id
6693
+ */
6694
+ 404: ErrorResponse;
6695
+ /**
6696
+ * The tool's stored secret cannot be opened: `TOOL_SECRET_KEY` changed since it was saved. Rotate its secret, and save its headers again.
6697
+ */
6698
+ 409: ErrorResponse;
6699
+ /**
6700
+ * The request failed validation
6701
+ */
6702
+ 422: ErrorResponse;
6703
+ /**
6704
+ * Rate limit exceeded
6705
+ */
6706
+ 429: ErrorResponse;
6707
+ /**
6708
+ * This deployment cannot seal a tool's secret (`TOOL_SECRET_KEY` unset): webhook tools cannot be saved or called.
6709
+ */
6710
+ 503: ErrorResponse;
6711
+ };
6712
+ export type TestToolError = TestToolErrors[keyof TestToolErrors];
6713
+ export type TestToolResponses = {
6714
+ /**
6715
+ * What your server answered, or why it did not
6716
+ */
6717
+ 200: ToolTestResult;
6718
+ };
6719
+ export type TestToolResponse = TestToolResponses[keyof TestToolResponses];
6720
+ export type ListAgentToolsData = {
6721
+ body?: never;
6722
+ path: {
6723
+ agent_id: string;
6724
+ };
6725
+ query?: never;
6726
+ url: '/v1/agents/{agent_id}/tools';
6727
+ };
6728
+ export type ListAgentToolsErrors = {
6729
+ /**
6730
+ * Missing or invalid credentials
6731
+ */
6732
+ 401: ErrorResponse;
6733
+ /**
6734
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6735
+ */
6736
+ 403: ErrorResponse;
6737
+ /**
6738
+ * Unknown agent id
6739
+ */
6740
+ 404: ErrorResponse;
6741
+ /**
6742
+ * The request failed validation
6743
+ */
6744
+ 422: ErrorResponse;
6745
+ /**
6746
+ * Rate limit exceeded
6747
+ */
6748
+ 429: ErrorResponse;
6749
+ };
6750
+ export type ListAgentToolsError = ListAgentToolsErrors[keyof ListAgentToolsErrors];
6751
+ export type ListAgentToolsResponses = {
6752
+ /**
6753
+ * The tools this agent can call
6754
+ */
6755
+ 200: ToolPage;
6756
+ };
6757
+ export type ListAgentToolsResponse = ListAgentToolsResponses[keyof ListAgentToolsResponses];
6758
+ export type SetAgentToolsData = {
6759
+ body: AgentToolsUpdate;
6760
+ path: {
6761
+ agent_id: string;
6762
+ };
6763
+ query?: never;
6764
+ url: '/v1/agents/{agent_id}/tools';
6765
+ };
6766
+ export type SetAgentToolsErrors = {
6767
+ /**
6768
+ * The request could not be read: malformed JSON
6769
+ */
6770
+ 400: ErrorResponse;
6771
+ /**
6772
+ * Missing or invalid credentials
6773
+ */
6774
+ 401: ErrorResponse;
6775
+ /**
6776
+ * The key is valid but its scopes do not cover this capability — a key limited to `tts` gets this from `/v1/images` rather than a 401
6777
+ */
6778
+ 403: ErrorResponse;
6779
+ /**
6780
+ * Unknown agent id
6781
+ */
6782
+ 404: ErrorResponse;
6783
+ /**
6784
+ * The request failed validation
6785
+ */
6786
+ 422: ErrorResponse;
6787
+ /**
6788
+ * Rate limit exceeded
6789
+ */
6790
+ 429: ErrorResponse;
6791
+ };
6792
+ export type SetAgentToolsError = SetAgentToolsErrors[keyof SetAgentToolsErrors];
6793
+ export type SetAgentToolsResponses = {
6794
+ /**
6795
+ * How many tools were turned on and off
6796
+ */
6797
+ 200: ToolsAssigned;
6798
+ };
6799
+ export type SetAgentToolsResponse = SetAgentToolsResponses[keyof SetAgentToolsResponses];
6114
6800
  export type SynthesizeSpeechData = {
6115
6801
  body: TtsRequest;
6116
6802
  path?: never;
package/dist/index.d.ts CHANGED
@@ -8,15 +8,16 @@ export { type Client, type ClientOptions, createClient, DEFAULT_BASE_URL, } from
8
8
  export { AuthenticationError, ConflictError, ConnectionError, InsufficientCreditsError, NotFoundError, PermissionError, PlatformError, type PlatformErrorCode, type PlatformErrorInit, RateLimitError, ServerError, TimeoutError, ValidationError, } from "./errors.js";
9
9
  export type * from "./gen/index.js";
10
10
  export type { Page } from "./paging.js";
11
- export type { AgentKnowledge, AgentSettings, Agents, } from "./resources/agents.js";
11
+ export type { AgentKnowledge, AgentSettings, Agents, AgentTools, } from "./resources/agents.js";
12
12
  export type { AssetListParams, Assets, AssetUploadFields, FolderListParams, Folders, } from "./resources/assets.js";
13
13
  export type { EndUserCreated, EndUserExport, EndUserListParams, EndUsers, } from "./resources/end-users.js";
14
14
  export type { EphemeralKeyCreateOptions, EphemeralKeyListParams, EphemeralKeyRevokeOptions, EphemeralKeys, } from "./resources/ephemeral-keys.js";
15
15
  export type { GenerationListParams, Generations, Jobs, Skybox, } from "./resources/generations.js";
16
16
  export type { Knowledge, KnowledgeInsightsParams, KnowledgeListParams, KnowledgeUploadFields, } from "./resources/knowledge.js";
17
- export type { Resource, Waitable } from "./resources/resource.js";
17
+ export type { Library, Listing, Resource, Waitable, WaitableLibrary, } from "./resources/resource.js";
18
18
  export type { Speech, Stt, SttEvent, SttParams, Transcript, Tts, } from "./resources/speech.js";
19
19
  export type { TemplateFile, Templates } from "./resources/templates.js";
20
+ export type { Tools } from "./resources/tools.js";
20
21
  export type { Usage, UsageParams } from "./resources/usage.js";
21
22
  export type { Voices, VoiceUploadFields } from "./resources/voices.js";
22
23
  export type { Fetch, RequestOptions } from "./transport.js";
@@ -6,15 +6,16 @@
6
6
  * - **A save reaches running sessions within a minute**, not at once: an
7
7
  * agent's version travels through the platform's `STANDING` copy.
8
8
  * - **`settings`** are the organisation's, for every agent;
9
- * **`knowledge.set`** replaces the entries one agent may look up.
9
+ * **`knowledge.set`** replaces the entries one agent may look up, and
10
+ * **`tools.set`** the tools it can call.
10
11
  * - **`create` is a 409 at the plan's maximum agents**; `delete` answers
11
12
  * `true`, and `false` for one already gone.
12
13
  * - **`list()` reads one page**: an organisation's agents are few, and the
13
14
  * route answers them all with `next_cursor` `null` (`paging.ts`).
14
15
  */
15
- import type { AgentCreateRequest, AgentInfo, AgentKnowledgeUpdate, AgentPage, AgentSettingsInfo, AgentSettingsUpdate, AgentSummary, AgentUpdate, KnowledgeAssigned, KnowledgeInfo } from "../gen/index.js";
16
+ import type { AgentCreateRequest, AgentInfo, AgentKnowledgeUpdate, AgentPage, AgentSettingsInfo, AgentSettingsUpdate, AgentSummary, AgentToolsUpdate, AgentUpdate, KnowledgeAssigned, KnowledgeInfo, ToolInfo, ToolsAssigned } from "../gen/index.js";
16
17
  import type { RequestOptions, Transport } from "../transport.js";
17
- import { Editable } from "./resource.js";
18
+ import { Library } from "./resource.js";
18
19
  /** `agents.settings`: the organisation's, for every agent. */
19
20
  export interface AgentSettings {
20
21
  get(options?: RequestOptions): Promise<AgentSettingsInfo>;
@@ -27,13 +28,18 @@ export interface AgentKnowledge {
27
28
  /** Replaces them all with these. */
28
29
  set(agentId: string, body: AgentKnowledgeUpdate, options?: RequestOptions): Promise<KnowledgeAssigned>;
29
30
  }
30
- export declare class Agents extends Editable<AgentInfo, AgentUpdate> {
31
+ /** `agents.tools`: the tools one agent can call. */
32
+ export interface AgentTools {
33
+ /** Every tool it can call. */
34
+ list(agentId: string, options?: RequestOptions): AsyncGenerator<ToolInfo, void, undefined>;
35
+ /** Replaces them all with these, 20 at most. */
36
+ set(agentId: string, body: AgentToolsUpdate, options?: RequestOptions): Promise<ToolsAssigned>;
37
+ }
38
+ export declare class Agents extends Library<AgentInfo, AgentUpdate, AgentSummary, AgentPage, AgentCreateRequest> {
31
39
  readonly settings: AgentSettings;
32
40
  readonly knowledge: AgentKnowledge;
41
+ readonly tools: AgentTools;
33
42
  constructor(api: Transport, base: string);
34
- /** The page of agents, as the route answers it. */
35
- page(options?: RequestOptions): Promise<AgentPage>;
36
- /** Every agent. */
37
- list(options?: RequestOptions): AsyncGenerator<AgentSummary, void, undefined>;
38
- create(body: AgentCreateRequest, options?: RequestOptions): Promise<AgentInfo>;
43
+ /** An agent's links to what the organisation has: its knowledge, its tools. */
44
+ protected links<T extends AgentKnowledge | AgentTools>(rest: string): T;
39
45
  }
@@ -6,34 +6,29 @@
6
6
  * - **A save reaches running sessions within a minute**, not at once: an
7
7
  * agent's version travels through the platform's `STANDING` copy.
8
8
  * - **`settings`** are the organisation's, for every agent;
9
- * **`knowledge.set`** replaces the entries one agent may look up.
9
+ * **`knowledge.set`** replaces the entries one agent may look up, and
10
+ * **`tools.set`** the tools it can call.
10
11
  * - **`create` is a 409 at the plan's maximum agents**; `delete` answers
11
12
  * `true`, and `false` for one already gone.
12
13
  * - **`list()` reads one page**: an organisation's agents are few, and the
13
14
  * route answers them all with `next_cursor` `null` (`paging.ts`).
14
15
  */
15
- import { Editable } from "./resource.js";
16
- export class Agents extends Editable {
16
+ import { Library } from "./resource.js";
17
+ export class Agents extends Library {
17
18
  constructor(api, base) {
18
19
  super(api, base);
19
20
  this.settings = {
20
21
  get: (options) => this.send("GET", "/settings", options),
21
22
  update: (body, options) => this.send("PUT", "/settings", options, body),
22
23
  };
23
- this.knowledge = {
24
- list: (id, options) => this.each(this.at(id, "/knowledge"), {}, options),
25
- set: (id, body, options) => this.send("PUT", this.at(id, "/knowledge"), options, body),
26
- };
27
- }
28
- /** The page of agents, as the route answers it. */
29
- page(options) {
30
- return this.send("GET", "", options);
24
+ this.knowledge = this.links("/knowledge");
25
+ this.tools = this.links("/tools");
31
26
  }
32
- /** Every agent. */
33
- list(options) {
34
- return this.each("", {}, options);
35
- }
36
- create(body, options) {
37
- return this.send("POST", "", options, body);
27
+ /** An agent's links to what the organisation has: its knowledge, its tools. */
28
+ links(rest) {
29
+ return {
30
+ list: (id, options) => this.each(this.at(id, rest), {}, options),
31
+ set: (id, body, options) => this.send("PUT", this.at(id, rest), options, body),
32
+ };
38
33
  }
39
34
  }
@@ -40,3 +40,17 @@ export declare class Waitable<Item extends Job & {
40
40
  /** `item` as made, or as it ended when `options.wait` says to wait. */
41
41
  protected settled(item: Item, options: UploadOptions): Promise<Item>;
42
42
  }
43
+ /** What a `Library` adds to its base. */
44
+ export interface Listing<Listed, ListPage, Create, Created> {
45
+ /** The page, as the route answers it: all of them, `next_cursor` `null`. */
46
+ page(options?: RequestOptions): Promise<ListPage>;
47
+ /** Every one of them. */
48
+ list(options?: RequestOptions): AsyncGenerator<Listed, void, undefined>;
49
+ create(body: Create, options?: RequestOptions): Promise<Created>;
50
+ }
51
+ /** An editable listed whole and made by a `POST`: the agents, the tools. */
52
+ export declare const Library: new <Item, Update, Listed, ListPage, Create, Created = Item>(api: Transport, base: string) => Editable<Item, Update> & Listing<Listed, ListPage, Create, Created>;
53
+ /** A waitable listed whole and made by a `POST`: the voices. */
54
+ export declare const WaitableLibrary: new <Item extends Job & {
55
+ id: string;
56
+ }, Update, Listed, ListPage, Create>(api: Transport, base: string) => Waitable<Item, Update> & Listing<Listed, ListPage, Create, Item>;
@@ -13,6 +13,9 @@
13
13
  * `false` when there is nothing by that id — already done. One that
14
14
  * reports what went with it (an end user's, a folder's) answers those
15
15
  * counts, and `null` for nothing by that id: the same rule, with a body.
16
+ * - **`Library`** and **`WaitableLibrary`**: one of the two, listed whole
17
+ * in one page and made by a `POST` to the list — `page()`, `list()`,
18
+ * `create(body)`, written once (`listed`).
16
19
  * - **`Waitable`**: an editable whose items are jobs — a voice, an asset,
17
20
  * a knowledge entry — with `wait(id)` and `settled`, which an upload
18
21
  * answers through.
@@ -83,3 +86,23 @@ export class Waitable extends Editable {
83
86
  : item;
84
87
  }
85
88
  }
89
+ /**
90
+ * `Listing`'s three methods on `Base`, written once for every resource
91
+ * listed whole in one page and made by a `POST` to the list: a mixin, as
92
+ * the agents and the tools are editables and the voices waitables.
93
+ */
94
+ const listed = (Base) => class extends Base {
95
+ page(options) {
96
+ return this.send("GET", "", options);
97
+ }
98
+ list(options) {
99
+ return this.each("", {}, options);
100
+ }
101
+ create(body, options) {
102
+ return this.send("POST", "", options, body);
103
+ }
104
+ };
105
+ /** An editable listed whole and made by a `POST`: the agents, the tools. */
106
+ export const Library = listed(Editable);
107
+ /** A waitable listed whole and made by a `POST`: the voices. */
108
+ export const WaitableLibrary = listed(Waitable);
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `client.tools`: what an organisation's agents can call while they reply
3
+ * — `/v1/tools*`. A tool is your server (`webhook`), sent a signed `POST`
4
+ * with the call, or the person's app (`app`), called over the agent's
5
+ * socket; each is turned on per agent (`agents.tools.set`), 20 at most.
6
+ *
7
+ * - **`create(body)`** answers a webhook's signing secret once, as does
8
+ * `rotateSecret` (`secret`); every call carries `X-Tool-Signature`.
9
+ * - **`test(id, { arguments })`** sends your server one call, signed as a
10
+ * real one, and answers what came back.
11
+ * - **`list()` reads one page**: a library holds 200 tools at most.
12
+ * - **`update` with `expected_version`** refuses an edit made over
13
+ * somebody else's (409); `delete` answers `true`, and `false` for one
14
+ * already gone.
15
+ */
16
+ import type { ToolCreate, ToolInfo, ToolPage, ToolTestRequest, ToolTestResult, ToolUpdate, ToolWithSecret } from "../gen/index.js";
17
+ import type { RequestOptions } from "../transport.js";
18
+ import { Library } from "./resource.js";
19
+ export declare class Tools extends Library<ToolInfo, ToolUpdate, ToolInfo, ToolPage, ToolCreate, ToolWithSecret> {
20
+ /** A new signing secret, shown this once. */
21
+ rotateSecret(id: string, options?: RequestOptions): Promise<ToolWithSecret>;
22
+ /** One call to your server, as a conversation would send it: `{ arguments }`. */
23
+ test(id: string, body?: ToolTestRequest, options?: RequestOptions): Promise<ToolTestResult>;
24
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `client.tools`: what an organisation's agents can call while they reply
3
+ * — `/v1/tools*`. A tool is your server (`webhook`), sent a signed `POST`
4
+ * with the call, or the person's app (`app`), called over the agent's
5
+ * socket; each is turned on per agent (`agents.tools.set`), 20 at most.
6
+ *
7
+ * - **`create(body)`** answers a webhook's signing secret once, as does
8
+ * `rotateSecret` (`secret`); every call carries `X-Tool-Signature`.
9
+ * - **`test(id, { arguments })`** sends your server one call, signed as a
10
+ * real one, and answers what came back.
11
+ * - **`list()` reads one page**: a library holds 200 tools at most.
12
+ * - **`update` with `expected_version`** refuses an edit made over
13
+ * somebody else's (409); `delete` answers `true`, and `false` for one
14
+ * already gone.
15
+ */
16
+ import { Library } from "./resource.js";
17
+ export class Tools extends Library {
18
+ /** A new signing secret, shown this once. */
19
+ rotateSecret(id, options) {
20
+ return this.send("POST", this.at(id, "/secret"), options);
21
+ }
22
+ /** One call to your server, as a conversation would send it: `{ arguments }`. */
23
+ test(id, body = {}, options) {
24
+ return this.send("POST", this.at(id, "/test"), options, body);
25
+ }
26
+ }
@@ -16,20 +16,18 @@
16
16
  import type { VoiceDesignRequest, VoiceDesignResult, VoiceDesignSaveRequest, VoiceDetail, VoiceInfo, VoiceInfoPage, VoiceUpdate, VoiceUpload, VoiceUploadRequest, VoiceUploadTicket } from "../gen/index.js";
17
17
  import type { RequestOptions } from "../transport.js";
18
18
  import { type UploadData, type UploadOptions } from "../upload.js";
19
- import { Waitable } from "./resource.js";
19
+ import { WaitableLibrary } from "./resource.js";
20
20
  /** A recording's voice: the create's fields, and the recording's type. */
21
21
  export type VoiceUploadFields = Omit<VoiceUpload, "upload_id"> & {
22
22
  /** A Blob's own type by default: `audio/wav`, `audio/mpeg`, … */
23
23
  content_type?: string;
24
24
  };
25
- /** `update` renames a voice, or changes its description or defaults. */
26
- export declare class Voices extends Waitable<VoiceDetail, VoiceUpdate> {
27
- /** The page of voices, as the route answers it: all of them, `next_cursor` `null`. */
28
- page(options?: RequestOptions): Promise<VoiceInfoPage>;
29
- /** Every voice this organisation may speak with. */
30
- list(options?: RequestOptions): AsyncGenerator<VoiceInfo, void, undefined>;
31
- /** Clones a recording already `PUT` to its ticket: `pending` at once. */
32
- create(body: VoiceUpload, options?: RequestOptions): Promise<VoiceDetail>;
25
+ /**
26
+ * `update` renames a voice, or changes its description or defaults;
27
+ * `list()` is every voice this organisation may speak with; `create(body)`
28
+ * clones a recording already `PUT` to its ticket, `pending` at once.
29
+ */
30
+ export declare class Voices extends WaitableLibrary<VoiceDetail, VoiceUpdate, VoiceInfo, VoiceInfoPage, VoiceUpload> {
33
31
  /** A signed URL to `PUT` a recording to, with exactly this type. */
34
32
  uploadUrl(body: VoiceUploadRequest, options?: RequestOptions): Promise<VoiceUploadTicket>;
35
33
  /** Uploads a recording and clones it: `uploadUrl`, the `PUT`, `create`. */
@@ -14,21 +14,13 @@
14
14
  * - **`list()` reads one page**: the route answers every voice in it.
15
15
  */
16
16
  import { needType, put, } from "../upload.js";
17
- import { Waitable } from "./resource.js";
18
- /** `update` renames a voice, or changes its description or defaults. */
19
- export class Voices extends Waitable {
20
- /** The page of voices, as the route answers it: all of them, `next_cursor` `null`. */
21
- page(options) {
22
- return this.send("GET", "", options);
23
- }
24
- /** Every voice this organisation may speak with. */
25
- list(options) {
26
- return this.each("", {}, options);
27
- }
28
- /** Clones a recording already `PUT` to its ticket: `pending` at once. */
29
- create(body, options) {
30
- return this.send("POST", "", options, body);
31
- }
17
+ import { WaitableLibrary } from "./resource.js";
18
+ /**
19
+ * `update` renames a voice, or changes its description or defaults;
20
+ * `list()` is every voice this organisation may speak with; `create(body)`
21
+ * clones a recording already `PUT` to its ticket, `pending` at once.
22
+ */
23
+ export class Voices extends WaitableLibrary {
32
24
  /** A signed URL to `PUT` a recording to, with exactly this type. */
33
25
  uploadUrl(body, options) {
34
26
  return this.send("POST", "/upload-url", options, body);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumavox/server",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "The Lumavox API from your server: end users, ephemeral keys and the rest, typed from the published OpenAPI document. Zero dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",