@lumavox/server 0.4.1 → 0.6.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
@@ -128,13 +128,15 @@ and a longer one is thrown at once as a `RateLimitError` with its
128
128
 
129
129
  - **A key is prepaid**: its `credit_limit_micros` is set aside from your balance
130
130
  when it is minted, and what it does not spend comes back when it settles.
131
- `create` clamps the lifetime to the platform's maximum (`clampTtl: false`
132
- sends your body as written); your plan's own caps for one person's key
133
- are not reported yet, so a key within the platform's can still be refused.
131
+ `create` clamps the lifetime to the tighter of the platform's maximum and
132
+ your plan's for one person's key (`clampTtl: false` sends your body as
133
+ written).
134
134
  - **`revoke` answers at once**, with the figures from before the key's last
135
- spend is settled; **`inspect` shows the spend as of the last
136
- settlement**, so a key in use reads as unspent for now.
135
+ spend is settled; `revoke(id, { settled: true })` waits for the final
136
+ ones (`settled_at`), reading the key with `get` — pass a `signal` for a
137
+ deadline. **`inspect` shows a key's spend turn by turn**, as the key
138
+ itself reads it.
137
139
  - **`endUsers.export(id)`** reads every conversation and fact about a
138
140
  person with a five-minute key of their own, revoked after — on failure
139
141
  too. The key is an ordinary one: at the person's live-key cap the export
140
- fails as the mint does. Facts are the newest 100 for now.
142
+ fails as the mint does.
@@ -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, GetEphemeralKeyLimitsData, GetEphemeralKeyLimitsError, GetEphemeralKeyLimitsErrors, GetEphemeralKeyLimitsResponse, GetEphemeralKeyLimitsResponses, 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, 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';
@@ -81,12 +81,27 @@ export type SkyboxStyle = {
81
81
  image: string | null;
82
82
  };
83
83
  export type EphemeralKeyLimits = {
84
+ /**
85
+ * The platform's longest lifetime for a key.
86
+ */
84
87
  max_ttl_seconds: number;
85
88
  default_ttl_seconds: number;
86
89
  /**
87
- * Micro-credits: 1 credit is 1,000,000.
90
+ * The platform's largest credit limit for a key.
88
91
  */
89
92
  max_credit_limit_micros: number;
93
+ /**
94
+ * Your plan's longest lifetime for one end user's key; `null` sets none. A key is held to the tighter of this and `max_ttl_seconds`.
95
+ */
96
+ plan_max_ttl_seconds: number | null;
97
+ /**
98
+ * Your plan's largest credit limit for one end user's key, in micro-credits; `null` sets none. A key is held to the tighter of this and `max_credit_limit_micros`.
99
+ */
100
+ plan_max_credit_limit_micros: number | null;
101
+ /**
102
+ * How many live keys one end user may hold on your plan; `null` sets none.
103
+ */
104
+ plan_max_live_keys: number | null;
90
105
  grantable_scopes: Array<string>;
91
106
  };
92
107
  export type EphemeralKeyCreateResponse = {
@@ -100,7 +115,7 @@ export type EphemeralKeyCreateResponse = {
100
115
  */
101
116
  credit_limit_micros: number;
102
117
  /**
103
- * What it has spent, as its end user DO last settled — at the end, or daily for a long-lived key.
118
+ * What it has spent, as its end user DO last settled — at the end, or daily for a long-lived key. Final once `settled_at` is set.
104
119
  */
105
120
  credits_spent_micros: number;
106
121
  /**
@@ -116,6 +131,10 @@ export type EphemeralKeyCreateResponse = {
116
131
  last_used_at: string | null;
117
132
  revoked_at: string | null;
118
133
  revoked_reason: string | null;
134
+ /**
135
+ * When its end user DO settled it for the last time — what it spent and what came back are final from then. `null` while it is live, and for a few seconds after it ends, longer while a memory job it paid for still runs.
136
+ */
137
+ settled_at: string | null;
119
138
  active: boolean;
120
139
  /**
121
140
  * The token, in full. **Shown once**: it is signed rather than stored, so it cannot be shown again.
@@ -151,7 +170,7 @@ export type EphemeralKeyInfo = {
151
170
  */
152
171
  credit_limit_micros: number;
153
172
  /**
154
- * What it has spent, as its end user DO last settled — at the end, or daily for a long-lived key.
173
+ * What it has spent, as its end user DO last settled — at the end, or daily for a long-lived key. Final once `settled_at` is set.
155
174
  */
156
175
  credits_spent_micros: number;
157
176
  /**
@@ -167,6 +186,10 @@ export type EphemeralKeyInfo = {
167
186
  last_used_at: string | null;
168
187
  revoked_at: string | null;
169
188
  revoked_reason: string | null;
189
+ /**
190
+ * When its end user DO settled it for the last time — what it spent and what came back are final from then. `null` while it is live, and for a few seconds after it ends, longer while a memory job it paid for still runs.
191
+ */
192
+ settled_at: string | null;
170
193
  active: boolean;
171
194
  };
172
195
  export type TokenSelf = ({
@@ -182,7 +205,7 @@ export type EphemeralTokenSelf = {
182
205
  */
183
206
  credit_limit_micros: number;
184
207
  /**
185
- * What the key had spent when its end user DO last settled — at the end, or daily for a long-lived key.
208
+ * What the key has spent so far, turn by turn.
186
209
  */
187
210
  credits_spent_micros: number;
188
211
  /**
@@ -717,6 +740,10 @@ export type TemplateInfo = {
717
740
  * What one generation from it costs your organisation, in micro-credits (1 credit is 1,000,000). Knowable up front because every parameter is frozen — but on an image template your own pictures are charged on top, each at the output's per-megapixel rate and the size sent. Null when the platform has no rate for the capability.
718
741
  */
719
742
  credits_micros: number | null;
743
+ /**
744
+ * On an image template, the megapixels of the pictures the template itself sends with every generation, each charged at the output's per-megapixel rate and already in `credits_micros` — so an estimate that moves the output's size keeps this term as it is, and adds your own pictures at the size they are sent. 0 on a video or skybox template, whose price no picture changes.
745
+ */
746
+ fixed_megapixels: number;
720
747
  /**
721
748
  * The request the template froze, minus the prompt. Every entry is decided for you unless its name is in `exposed`, in which case it is the default you may override.
722
749
  */
@@ -3021,6 +3048,48 @@ export type RevokeEphemeralKeyResponses = {
3021
3048
  200: EphemeralKeyInfo;
3022
3049
  };
3023
3050
  export type RevokeEphemeralKeyResponse = RevokeEphemeralKeyResponses[keyof RevokeEphemeralKeyResponses];
3051
+ export type GetEphemeralKeyData = {
3052
+ body?: never;
3053
+ path: {
3054
+ key_id: string;
3055
+ };
3056
+ query?: never;
3057
+ url: '/v1/ephemeral-keys/{key_id}';
3058
+ };
3059
+ export type GetEphemeralKeyErrors = {
3060
+ /**
3061
+ * The request could not be read: malformed JSON
3062
+ */
3063
+ 400: ErrorResponse;
3064
+ /**
3065
+ * Missing or invalid credentials
3066
+ */
3067
+ 401: ErrorResponse;
3068
+ /**
3069
+ * 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
3070
+ */
3071
+ 403: ErrorResponse;
3072
+ /**
3073
+ * Unknown ephemeral key id
3074
+ */
3075
+ 404: ErrorResponse;
3076
+ /**
3077
+ * The request failed validation
3078
+ */
3079
+ 422: ErrorResponse;
3080
+ /**
3081
+ * Rate limit exceeded
3082
+ */
3083
+ 429: ErrorResponse;
3084
+ };
3085
+ export type GetEphemeralKeyError = GetEphemeralKeyErrors[keyof GetEphemeralKeyErrors];
3086
+ export type GetEphemeralKeyResponses = {
3087
+ /**
3088
+ * The token
3089
+ */
3090
+ 200: EphemeralKeyInfo;
3091
+ };
3092
+ export type GetEphemeralKeyResponse = GetEphemeralKeyResponses[keyof GetEphemeralKeyResponses];
3024
3093
  export type GetTokenData = {
3025
3094
  body?: never;
3026
3095
  path?: never;
@@ -4728,6 +4797,14 @@ export type ListFactsData = {
4728
4797
  * Optional, and only ever the key's own end user — their `eu_...` id or your own id for them. Anybody else is a 403.
4729
4798
  */
4730
4799
  end_user_id?: string;
4800
+ /**
4801
+ * How many to answer, 1 to 200.
4802
+ */
4803
+ limit?: number;
4804
+ /**
4805
+ * The `next_cursor` of the page before.
4806
+ */
4807
+ cursor?: string;
4731
4808
  };
4732
4809
  url: '/v1/agent/facts';
4733
4810
  };
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export type { Page } from "./paging.js";
11
11
  export type { AgentKnowledge, AgentSettings, Agents, } 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
- export type { EphemeralKeyCreateOptions, EphemeralKeyListParams, EphemeralKeys, } from "./resources/ephemeral-keys.js";
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
17
  export type { Resource, Waitable } from "./resources/resource.js";
@@ -21,18 +21,15 @@
21
21
  * and an API key cannot read them (`/v1/agent/*` takes only an ephemeral
22
22
  * key): it mints a five-minute key for them, lists their sessions (200 a
23
23
  * page), reads each transcript back to its start by `messages.next_cursor`
24
- * (200 messages a page, four sessions at a time), reads their facts, and
25
- * revokes the key in `finally` — after an abort or a failure too. The
26
- * cost: one mint (and `limits()` when cold) + ⌈S/200⌉ lists + Σ⌈M/200⌉
27
- * transcript pages + one facts read + one revoke. **Its ceilings**: the
24
+ * (200 messages a page, four sessions at a time), reads their facts (200
25
+ * a page), and revokes the key in `finally` — after an abort or a failure
26
+ * too. The cost: one mint (and `limits()` when cold) + ⌈S/200⌉ lists +
27
+ * Σ⌈M/200⌉ transcript pages + ⌈F/200⌉ fact pages + one revoke. **Its ceilings**: the
28
28
  * key is ordinary, so at the person's live-key cap or the plan's mint rate
29
29
  * the export fails as the mint does (422, 429) and can be retried once a
30
30
  * key lapses; it lives five minutes, so a history that takes longer to
31
31
  * read fails with a 401; its one micro-credit is set aside like any key's,
32
- * so an organisation with no balance cannot export (402); and the facts
33
- * route answers the newest 100 in one page until it pages (left-overs
34
- * #109) — read here by its cursor, so the day it does, the export has
35
- * them all.
32
+ * so an organisation with no balance cannot export (402).
36
33
  */
37
34
  import type { EndUserCreateRequest, EndUserDeleted, EndUserInfo, EndUserPage, EndUserUpdateRequest, FactInfo, ListEndUsersData, SessionDetail } from "../gen/index.js";
38
35
  import { type RequestOptions, type Transport } from "../transport.js";
@@ -21,18 +21,15 @@
21
21
  * and an API key cannot read them (`/v1/agent/*` takes only an ephemeral
22
22
  * key): it mints a five-minute key for them, lists their sessions (200 a
23
23
  * page), reads each transcript back to its start by `messages.next_cursor`
24
- * (200 messages a page, four sessions at a time), reads their facts, and
25
- * revokes the key in `finally` — after an abort or a failure too. The
26
- * cost: one mint (and `limits()` when cold) + ⌈S/200⌉ lists + Σ⌈M/200⌉
27
- * transcript pages + one facts read + one revoke. **Its ceilings**: the
24
+ * (200 messages a page, four sessions at a time), reads their facts (200
25
+ * a page), and revokes the key in `finally` — after an abort or a failure
26
+ * too. The cost: one mint (and `limits()` when cold) + ⌈S/200⌉ lists +
27
+ * Σ⌈M/200⌉ transcript pages + ⌈F/200⌉ fact pages + one revoke. **Its ceilings**: the
28
28
  * key is ordinary, so at the person's live-key cap or the plan's mint rate
29
29
  * the export fails as the mint does (422, 429) and can be retried once a
30
30
  * key lapses; it lives five minutes, so a history that takes longer to
31
31
  * read fails with a 401; its one micro-credit is set aside like any key's,
32
- * so an organisation with no balance cannot export (402); and the facts
33
- * route answers the newest 100 in one page until it pages (left-overs
34
- * #109) — read here by its cursor, so the day it does, the export has
35
- * them all.
32
+ * so an organisation with no balance cannot export (402).
36
33
  */
37
34
  import { pages } from "../paging.js";
38
35
  import { segment, } from "../transport.js";
@@ -128,7 +125,7 @@ export class EndUsers extends Editable {
128
125
  messages: { data: held.flat(), next_cursor: null },
129
126
  };
130
127
  });
131
- const facts = await all(pages((cursor) => read("/v1/agent/facts", { cursor })));
128
+ const facts = await all(pages((cursor) => read("/v1/agent/facts", { limit: PAGE, cursor })));
132
129
  return { end_user_id: key.end_user_id ?? id, sessions, facts };
133
130
  }
134
131
  finally {
@@ -5,24 +5,24 @@
5
5
  * - **A key is prepaid**: its `credit_limit_micros` is set aside from the
6
6
  * balance when it is minted (402 when it cannot be), and what it does not spend
7
7
  * comes back when it settles.
8
- * - **`create` clamps the lifetime by default** to the platform's maximum,
9
- * read from `limits()` — which the API never does: past a cap is a 422
10
- * (`apps/api/src/org/minting.ts`). The plan's own caps for one end
11
- * user's key are not reported yet (left-overs #107), so a key within the
12
- * platform's can still be refused.
8
+ * - **`create` clamps the lifetime by default** to the tighter of the
9
+ * platform's maximum and the plan's for one end user's key, both read
10
+ * from `limits()` — which the API never does: past a cap is a 422
11
+ * (`apps/api/src/org/minting.ts`).
13
12
  * - **`limits()` is cached five minutes per client**, so a mint is two
14
13
  * requests cold and one warm. Concurrent cold callers share one read.
15
14
  * - **`revoke` answers at once**, with the figures from before the key's
16
15
  * end user DO settles: revocation leaves through the org DO's outbox
17
- * (`apps/api/src/org/areas/keys.ts` `revokeEphemeral`). Waiting for the
18
- * final figures needs the key's read route (left-overs #106).
19
- * - **`inspect` reads a key as itself** (`GET /v1/token` with that key).
20
- * Its `credits_spent_micros` moves only when the key settles — at the end, or
21
- * daily — so a live key reads as unspent (left-overs #105).
16
+ * (`apps/api/src/org/areas/keys.ts` `revokeEphemeral`). With
17
+ * `{ settled: true }` it reads the key (`get`) until `settled_at` is set
18
+ * — seconds, longer while a memory job the key paid for runs — on the
19
+ * polls of `../wait.ts`; a `signal` is its deadline.
20
+ * - **`inspect` reads a key as itself** (`GET /v1/token` with that key):
21
+ * its spend as its end user DO counts it, turn by turn.
22
22
  */
23
23
  import type { EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EphemeralKeyInfo, EphemeralKeyLimits, EphemeralKeyPage, EphemeralTokenSelf, ListEphemeralKeysData } from "../gen/index.js";
24
24
  import { type RequestOptions } from "../transport.js";
25
- import { Resource } from "./resource.js";
25
+ import { Readable } from "./resource.js";
26
26
  export type EphemeralKeyListParams = NonNullable<ListEphemeralKeysData["query"]>;
27
27
  export interface EphemeralKeyCreateOptions extends RequestOptions {
28
28
  /**
@@ -32,12 +32,17 @@ export interface EphemeralKeyCreateOptions extends RequestOptions {
32
32
  */
33
33
  clampTtl?: boolean;
34
34
  }
35
- export declare class EphemeralKeys extends Resource {
35
+ export interface EphemeralKeyRevokeOptions extends RequestOptions {
36
+ /** Answer once the key's final figures are in (`settled_at` set), not at once. */
37
+ settled?: boolean;
38
+ }
39
+ export declare class EphemeralKeys extends Readable<EphemeralKeyInfo> {
36
40
  private cached;
37
41
  /**
38
- * What a key may be minted with: the **platform's** longest lifetime and
39
- * largest credit limit, and the scopes this API key may grant. Cached
40
- * five minutes per client.
42
+ * What a key may be minted with: the platform's longest lifetime and
43
+ * largest credit limit, the plan's for one end user's key (`plan_*`,
44
+ * `null` where it sets none), and the scopes this API key may grant.
45
+ * Cached five minutes per client.
41
46
  */
42
47
  limits(options?: RequestOptions): Promise<EphemeralKeyLimits>;
43
48
  /**
@@ -49,10 +54,11 @@ export declare class EphemeralKeys extends Resource {
49
54
  create(body: EphemeralKeyCreateRequest, options?: EphemeralKeyCreateOptions): Promise<EphemeralKeyCreateResponse>;
50
55
  /**
51
56
  * Revokes a key: it is refused from now on, and what it did not spend
52
- * comes back when it settles. `null` when there is no such key — a
53
- * revoked, expired or unknown id answers as itself, a non-UUID as none.
57
+ * comes back when it settles — awaited with `{ settled: true }`. `null`
58
+ * when there is no such key — a revoked, expired or unknown id answers
59
+ * as itself, a non-UUID as none.
54
60
  */
55
- revoke(id: string, options?: RequestOptions): Promise<EphemeralKeyInfo | null>;
61
+ revoke(id: string, options?: EphemeralKeyRevokeOptions): Promise<EphemeralKeyInfo | null>;
56
62
  /**
57
63
  * A key as it reads itself: its scopes, limit, spend and expiry. `null`
58
64
  * when the key is refused — expired, revoked, spent or not a key.
@@ -5,24 +5,25 @@
5
5
  * - **A key is prepaid**: its `credit_limit_micros` is set aside from the
6
6
  * balance when it is minted (402 when it cannot be), and what it does not spend
7
7
  * comes back when it settles.
8
- * - **`create` clamps the lifetime by default** to the platform's maximum,
9
- * read from `limits()` — which the API never does: past a cap is a 422
10
- * (`apps/api/src/org/minting.ts`). The plan's own caps for one end
11
- * user's key are not reported yet (left-overs #107), so a key within the
12
- * platform's can still be refused.
8
+ * - **`create` clamps the lifetime by default** to the tighter of the
9
+ * platform's maximum and the plan's for one end user's key, both read
10
+ * from `limits()` — which the API never does: past a cap is a 422
11
+ * (`apps/api/src/org/minting.ts`).
13
12
  * - **`limits()` is cached five minutes per client**, so a mint is two
14
13
  * requests cold and one warm. Concurrent cold callers share one read.
15
14
  * - **`revoke` answers at once**, with the figures from before the key's
16
15
  * end user DO settles: revocation leaves through the org DO's outbox
17
- * (`apps/api/src/org/areas/keys.ts` `revokeEphemeral`). Waiting for the
18
- * final figures needs the key's read route (left-overs #106).
19
- * - **`inspect` reads a key as itself** (`GET /v1/token` with that key).
20
- * Its `credits_spent_micros` moves only when the key settles — at the end, or
21
- * daily — so a live key reads as unspent (left-overs #105).
16
+ * (`apps/api/src/org/areas/keys.ts` `revokeEphemeral`). With
17
+ * `{ settled: true }` it reads the key (`get`) until `settled_at` is set
18
+ * — seconds, longer while a memory job the key paid for runs — on the
19
+ * polls of `../wait.ts`; a `signal` is its deadline.
20
+ * - **`inspect` reads a key as itself** (`GET /v1/token` with that key):
21
+ * its spend as its end user DO counts it, turn by turn.
22
22
  */
23
23
  import { AuthenticationError } from "../errors.js";
24
24
  import { orNull } from "../transport.js";
25
- import { Resource } from "./resource.js";
25
+ import { poll } from "../wait.js";
26
+ import { Readable } from "./resource.js";
26
27
  const LIMITS_TTL_MS = 5 * 60_000;
27
28
  /** The route's largest page. */
28
29
  const PAGE = 200;
@@ -44,12 +45,13 @@ function until(promise, signal) {
44
45
  });
45
46
  });
46
47
  }
47
- export class EphemeralKeys extends Resource {
48
+ export class EphemeralKeys extends Readable {
48
49
  cached = null;
49
50
  /**
50
- * What a key may be minted with: the **platform's** longest lifetime and
51
- * largest credit limit, and the scopes this API key may grant. Cached
52
- * five minutes per client.
51
+ * What a key may be minted with: the platform's longest lifetime and
52
+ * largest credit limit, the plan's for one end user's key (`plan_*`,
53
+ * `null` where it sets none), and the scopes this API key may grant.
54
+ * Cached five minutes per client.
53
55
  */
54
56
  limits(options = {}) {
55
57
  const now = Date.now();
@@ -82,18 +84,23 @@ export class EphemeralKeys extends Resource {
82
84
  const wanted = body.expires_in_seconds ?? limits.default_ttl_seconds;
83
85
  sent = {
84
86
  ...body,
85
- expires_in_seconds: Math.min(wanted, limits.max_ttl_seconds),
87
+ expires_in_seconds: Math.min(wanted, limits.max_ttl_seconds, limits.plan_max_ttl_seconds ?? wanted),
86
88
  };
87
89
  }
88
90
  return this.send("POST", "", request, sent);
89
91
  }
90
92
  /**
91
93
  * Revokes a key: it is refused from now on, and what it did not spend
92
- * comes back when it settles. `null` when there is no such key — a
93
- * revoked, expired or unknown id answers as itself, a non-UUID as none.
94
+ * comes back when it settles — awaited with `{ settled: true }`. `null`
95
+ * when there is no such key — a revoked, expired or unknown id answers
96
+ * as itself, a non-UUID as none.
94
97
  */
95
- revoke(id, options) {
96
- return orNull(this.send("DELETE", this.at(id), options));
98
+ async revoke(id, options = {}) {
99
+ const { settled, ...request } = options;
100
+ const key = await orNull(this.send("DELETE", this.at(id), request));
101
+ return key && settled
102
+ ? poll(() => this.get(id, request), request, key, (k) => !k.settled_at)
103
+ : key;
97
104
  }
98
105
  /**
99
106
  * A key as it reads itself: its scopes, limit, spend and expiry. `null`
package/dist/wait.d.ts CHANGED
@@ -32,7 +32,9 @@ export interface Job {
32
32
  status: string;
33
33
  }
34
34
  /**
35
- * Reads `read` until its status is final, starting from `first` (a job
36
- * just made, so the first read waits) or with a read now.
35
+ * Reads `read` until its status is final — or until `pending` says it no
36
+ * longer is, for what is not a job (a revoked key's settlement) —
37
+ * starting from `first` (a job just made, so the first read waits) or
38
+ * with a read now.
37
39
  */
38
- export declare function poll<T extends Job>(read: () => Promise<T>, options?: RequestOptions, first?: T): Promise<T>;
40
+ export declare function poll<T>(read: () => Promise<T>, options?: RequestOptions, first?: T, pending?: (job: T) => boolean): Promise<T>;
package/dist/wait.js CHANGED
@@ -37,12 +37,14 @@ const IN_PROGRESS = [
37
37
  const FIRST_MS = 1_000;
38
38
  const MAX_MS = 10_000;
39
39
  /**
40
- * Reads `read` until its status is final, starting from `first` (a job
41
- * just made, so the first read waits) or with a read now.
40
+ * Reads `read` until its status is final — or until `pending` says it no
41
+ * longer is, for what is not a job (a revoked key's settlement) —
42
+ * starting from `first` (a job just made, so the first read waits) or
43
+ * with a read now.
42
44
  */
43
- export async function poll(read, options = {}, first) {
45
+ export async function poll(read, options = {}, first, pending = (job) => IN_PROGRESS.includes(job.status)) {
44
46
  let job = first ?? (await read());
45
- for (let ms = FIRST_MS; IN_PROGRESS.includes(job.status);) {
47
+ for (let ms = FIRST_MS; pending(job);) {
46
48
  await sleep(ms, options.signal);
47
49
  job = await read();
48
50
  ms = Math.min(ms * 1.5, MAX_MS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumavox/server",
3
- "version": "0.4.1",
3
+ "version": "0.6.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",