@sonzai-labs/agents 1.0.3 → 1.0.7
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/dist/index.cjs +79 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +188 -1
- package/dist/index.d.ts +188 -1
- package/dist/index.js +79 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -361,6 +361,8 @@ interface ProcessOptions {
|
|
|
361
361
|
provider?: string;
|
|
362
362
|
/** LLM model for extraction (e.g. "gemini-2.5-flash", "gpt-4o-mini"). Falls back to platform default. */
|
|
363
363
|
model?: string;
|
|
364
|
+
/** When true, the response includes the full extraction payload in `extractions`. */
|
|
365
|
+
includeExtractions?: boolean;
|
|
364
366
|
}
|
|
365
367
|
interface ProcessSideEffectsSummary {
|
|
366
368
|
mood_updated: boolean;
|
|
@@ -431,6 +433,77 @@ interface ProcessResponse {
|
|
|
431
433
|
memories_created: number;
|
|
432
434
|
facts_extracted: number;
|
|
433
435
|
side_effects: ProcessSideEffectsSummary;
|
|
436
|
+
/** Present only when `includeExtractions` was set to true in the request. */
|
|
437
|
+
extractions?: SideEffectExtraction;
|
|
438
|
+
}
|
|
439
|
+
interface ExtractionFact {
|
|
440
|
+
text: string;
|
|
441
|
+
fact_type: string;
|
|
442
|
+
importance: number;
|
|
443
|
+
entities: string[];
|
|
444
|
+
sentiment: string;
|
|
445
|
+
topic_tags: string[];
|
|
446
|
+
}
|
|
447
|
+
interface ExtractionPersonalityDelta {
|
|
448
|
+
trait: string;
|
|
449
|
+
delta: number;
|
|
450
|
+
reason: string;
|
|
451
|
+
}
|
|
452
|
+
interface ExtractionDimensionDelta {
|
|
453
|
+
dimension: string;
|
|
454
|
+
delta: number;
|
|
455
|
+
reason: string;
|
|
456
|
+
}
|
|
457
|
+
interface ExtractionMoodDelta {
|
|
458
|
+
happiness: number;
|
|
459
|
+
energy: number;
|
|
460
|
+
calmness: number;
|
|
461
|
+
affection: number;
|
|
462
|
+
reason: string;
|
|
463
|
+
}
|
|
464
|
+
interface ExtractionHabit {
|
|
465
|
+
name: string;
|
|
466
|
+
category: string;
|
|
467
|
+
description: string;
|
|
468
|
+
is_reinforcement: boolean;
|
|
469
|
+
}
|
|
470
|
+
interface ExtractionInterest {
|
|
471
|
+
topic: string;
|
|
472
|
+
category: string;
|
|
473
|
+
confidence: number;
|
|
474
|
+
engagement_level: number;
|
|
475
|
+
}
|
|
476
|
+
interface ExtractionRelationshipDelta {
|
|
477
|
+
score_change: number;
|
|
478
|
+
reason: string;
|
|
479
|
+
}
|
|
480
|
+
interface ExtractionProactive {
|
|
481
|
+
type: string;
|
|
482
|
+
description: string;
|
|
483
|
+
delay_hours: number;
|
|
484
|
+
intent: string;
|
|
485
|
+
}
|
|
486
|
+
interface ExtractionRecurring {
|
|
487
|
+
description: string;
|
|
488
|
+
pattern: string;
|
|
489
|
+
confidence: number;
|
|
490
|
+
}
|
|
491
|
+
interface ExtractionInnerThoughts {
|
|
492
|
+
diary: string;
|
|
493
|
+
reflection: string;
|
|
494
|
+
}
|
|
495
|
+
interface SideEffectExtraction {
|
|
496
|
+
memory_facts: ExtractionFact[];
|
|
497
|
+
personality_deltas: ExtractionPersonalityDelta[];
|
|
498
|
+
dimension_deltas: ExtractionDimensionDelta[];
|
|
499
|
+
mood_delta?: ExtractionMoodDelta;
|
|
500
|
+
habit_observations: ExtractionHabit[];
|
|
501
|
+
interests_detected: ExtractionInterest[];
|
|
502
|
+
relationship_delta?: ExtractionRelationshipDelta;
|
|
503
|
+
proactive_suggestions: ExtractionProactive[];
|
|
504
|
+
recurring_events: ExtractionRecurring[];
|
|
505
|
+
inner_thoughts?: ExtractionInnerThoughts;
|
|
506
|
+
emotional_themes: string[];
|
|
434
507
|
}
|
|
435
508
|
interface EvalCategory {
|
|
436
509
|
name: string;
|
|
@@ -838,6 +911,51 @@ interface VoiceListOptions {
|
|
|
838
911
|
limit?: number;
|
|
839
912
|
offset?: number;
|
|
840
913
|
}
|
|
914
|
+
/** Options for text-to-speech synthesis. */
|
|
915
|
+
interface TTSOptions {
|
|
916
|
+
/** Text to synthesize (1–5000 characters). */
|
|
917
|
+
text: string;
|
|
918
|
+
/** Gemini voice name (e.g., "Kore", "Puck"). Defaults to "Kore". */
|
|
919
|
+
voiceName?: string;
|
|
920
|
+
/** Language code (e.g., "en-US"). Defaults to "en-US". */
|
|
921
|
+
language?: string;
|
|
922
|
+
/** Output audio format. Defaults to "wav". */
|
|
923
|
+
outputFormat?: "wav" | "opus";
|
|
924
|
+
}
|
|
925
|
+
/** Response from text-to-speech synthesis. */
|
|
926
|
+
interface TTSResponse {
|
|
927
|
+
/** Base64-encoded audio data. */
|
|
928
|
+
audio: string;
|
|
929
|
+
/** MIME type of the audio ("audio/wav" or "audio/ogg"). */
|
|
930
|
+
contentType: string;
|
|
931
|
+
/** Estimated audio duration in milliseconds. */
|
|
932
|
+
durationMs?: number;
|
|
933
|
+
/** Token usage for billing. */
|
|
934
|
+
usage?: {
|
|
935
|
+
promptTokens: number;
|
|
936
|
+
completionTokens: number;
|
|
937
|
+
totalTokens: number;
|
|
938
|
+
model: string;
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
/** Options for speech-to-text transcription. */
|
|
942
|
+
interface STTOptions {
|
|
943
|
+
/** Base64-encoded audio data. */
|
|
944
|
+
audio: string;
|
|
945
|
+
/** MIME type of the audio (e.g., "audio/wav", "audio/webm;codecs=opus"). */
|
|
946
|
+
audioFormat: string;
|
|
947
|
+
/** Language hint (e.g., "en-US"). */
|
|
948
|
+
language?: string;
|
|
949
|
+
}
|
|
950
|
+
/** Response from speech-to-text transcription. */
|
|
951
|
+
interface STTResponse {
|
|
952
|
+
/** Transcribed text. */
|
|
953
|
+
transcript: string;
|
|
954
|
+
/** Confidence score (0.0–1.0). */
|
|
955
|
+
confidence: number;
|
|
956
|
+
/** Detected or confirmed language code. */
|
|
957
|
+
languageCode?: string;
|
|
958
|
+
}
|
|
841
959
|
interface GenerateBioOptions {
|
|
842
960
|
name?: string;
|
|
843
961
|
gender?: string;
|
|
@@ -1218,6 +1336,15 @@ interface UpdateCustomToolOptions {
|
|
|
1218
1336
|
description?: string;
|
|
1219
1337
|
parameters?: Record<string, unknown>;
|
|
1220
1338
|
}
|
|
1339
|
+
interface GenerateAvatarOptions {
|
|
1340
|
+
style?: string;
|
|
1341
|
+
}
|
|
1342
|
+
interface GenerateAvatarResponse {
|
|
1343
|
+
success: boolean;
|
|
1344
|
+
avatar_url: string;
|
|
1345
|
+
prompt: string;
|
|
1346
|
+
generation_time_ms: number;
|
|
1347
|
+
}
|
|
1221
1348
|
interface ConsolidateOptions {
|
|
1222
1349
|
period?: string;
|
|
1223
1350
|
user_id?: string;
|
|
@@ -1773,6 +1900,32 @@ interface AcknowledgeAllOptions {
|
|
|
1773
1900
|
agentId?: string;
|
|
1774
1901
|
eventType?: string;
|
|
1775
1902
|
}
|
|
1903
|
+
interface AgentKBSearchOptions {
|
|
1904
|
+
query: string;
|
|
1905
|
+
limit?: number;
|
|
1906
|
+
}
|
|
1907
|
+
interface AgentKBSearchResult {
|
|
1908
|
+
content: string;
|
|
1909
|
+
label: string;
|
|
1910
|
+
type: string;
|
|
1911
|
+
source: string;
|
|
1912
|
+
score: number;
|
|
1913
|
+
}
|
|
1914
|
+
interface AgentKBSearchResponse {
|
|
1915
|
+
query: string;
|
|
1916
|
+
results: AgentKBSearchResult[];
|
|
1917
|
+
}
|
|
1918
|
+
/** Describes a single tool available for an agent (BYO-LLM integrations). */
|
|
1919
|
+
interface ToolSchema {
|
|
1920
|
+
name: string;
|
|
1921
|
+
description: string;
|
|
1922
|
+
endpoint: string;
|
|
1923
|
+
parameters?: Record<string, unknown>;
|
|
1924
|
+
}
|
|
1925
|
+
/** Response from the getTools endpoint. */
|
|
1926
|
+
interface ToolSchemasResponse {
|
|
1927
|
+
tools: ToolSchema[];
|
|
1928
|
+
}
|
|
1776
1929
|
|
|
1777
1930
|
/** Custom state operations for agents. */
|
|
1778
1931
|
declare class CustomStates {
|
|
@@ -1991,6 +2144,34 @@ declare class Voice {
|
|
|
1991
2144
|
* ```
|
|
1992
2145
|
*/
|
|
1993
2146
|
stream(token: VoiceStreamToken): Promise<VoiceStreamInstance>;
|
|
2147
|
+
/**
|
|
2148
|
+
* Convert text to speech audio.
|
|
2149
|
+
*
|
|
2150
|
+
* @example
|
|
2151
|
+
* ```ts
|
|
2152
|
+
* const result = await client.agents.voice.tts(agentId, {
|
|
2153
|
+
* text: "Hello, how are you?",
|
|
2154
|
+
* voiceName: "Kore",
|
|
2155
|
+
* outputFormat: "wav",
|
|
2156
|
+
* });
|
|
2157
|
+
* // result.audio is base64-encoded WAV
|
|
2158
|
+
* ```
|
|
2159
|
+
*/
|
|
2160
|
+
tts(agentId: string, options: TTSOptions): Promise<TTSResponse>;
|
|
2161
|
+
/**
|
|
2162
|
+
* Transcribe audio to text.
|
|
2163
|
+
*
|
|
2164
|
+
* @example
|
|
2165
|
+
* ```ts
|
|
2166
|
+
* const result = await client.agents.voice.stt(agentId, {
|
|
2167
|
+
* audio: base64Audio,
|
|
2168
|
+
* audioFormat: "audio/wav",
|
|
2169
|
+
* language: "en-US",
|
|
2170
|
+
* });
|
|
2171
|
+
* console.log(result.transcript);
|
|
2172
|
+
* ```
|
|
2173
|
+
*/
|
|
2174
|
+
stt(agentId: string, options: STTOptions): Promise<STTResponse>;
|
|
1994
2175
|
}
|
|
1995
2176
|
/**
|
|
1996
2177
|
* Bidirectional WebSocket connection for real-time voice chat.
|
|
@@ -2117,6 +2298,8 @@ declare class Agents {
|
|
|
2117
2298
|
}>;
|
|
2118
2299
|
/** Delete a custom tool from an agent. */
|
|
2119
2300
|
deleteCustomTool(agentId: string, toolName: string): Promise<void>;
|
|
2301
|
+
/** Trigger avatar generation for an agent. */
|
|
2302
|
+
generateAvatar(agentId: string, options?: GenerateAvatarOptions): Promise<GenerateAvatarResponse>;
|
|
2120
2303
|
/**
|
|
2121
2304
|
* Run the full Context Engine pipeline on conversation messages without
|
|
2122
2305
|
* generating a chat response. Extracts side effects via LLM, processes
|
|
@@ -2138,6 +2321,10 @@ declare class Agents {
|
|
|
2138
2321
|
getSummaries(agentId: string, options?: SummariesOptions): Promise<SummariesResponse>;
|
|
2139
2322
|
/** Get a point-in-time snapshot of an agent's personality and mood. */
|
|
2140
2323
|
getTimeMachine(agentId: string, options: TimeMachineOptions): Promise<TimeMachineResponse>;
|
|
2324
|
+
/** Search the knowledge base for an agent. */
|
|
2325
|
+
knowledgeSearch(agentId: string, options: AgentKBSearchOptions): Promise<AgentKBSearchResponse>;
|
|
2326
|
+
/** Get tool schemas available for an agent (for BYO-LLM integrations). */
|
|
2327
|
+
getTools(agentId: string): Promise<ToolSchemasResponse>;
|
|
2141
2328
|
private buildChatBody;
|
|
2142
2329
|
}
|
|
2143
2330
|
|
|
@@ -2378,4 +2565,4 @@ declare class StreamError extends SonzaiError {
|
|
|
2378
2565
|
constructor(message: string);
|
|
2379
2566
|
}
|
|
2380
2567
|
|
|
2381
|
-
export { APIError, type AcknowledgeAllOptions, type AcknowledgeNotificationsOptions, type AcknowledgeResponse, type AddContentOptions, type AddContentResponse, type Agent, type AgentCapabilities, type AgentIndex, type AgentInstance, type AgentListOptions, type AgentListResponse, type AgentToolCapabilities, type AtomicFact, AuthenticationError, BadRequestError, type BatchImportOptions, type BatchImportResponse, type BatchImportUser, type BatchPersonalityEntry, type BatchPersonalityResponse, type Big5, type Big5Scores, type Big5Trait, type BreakthroughsResponse, type ChatChoice, type ChatMessage, type ChatOptions, type ChatResponse, type ChatStreamEvent, type ChatUsage, type ConsolidateOptions, type ConsolidateResponse, type ConstellationResponse, type ContextDataOptions, type CreateAgentOptions, type CreateAnalyticsRuleOptions, type CreateCustomToolOptions, type CreateGoalOptions, type CreateSchemaOptions, type CustomLLMConfigResponse, type CustomState, type CustomStateCreateOptions, type CustomStateDeleteByKeyOptions, type CustomStateGetByKeyOptions, type CustomStateListOptions, type CustomStateListResponse, type CustomStateUpdateOptions, type CustomStateUpsertOptions, type CustomToolDefinition, type CustomToolListResponse, type DeleteGoalOptions, type DeliveryAttemptsResponse, type DialogueOptions, type DialogueResponse, type DiaryResponse, type EnrichedContextResponse, type EvalCategory, type EvalOnlyOptions, type EvalRun, type EvalRunListOptions, type EvalRunListResponse, type EvalTemplate, type EvalTemplateCategory, type EvalTemplateCreateOptions, type EvalTemplateListResponse, type EvalTemplateUpdateOptions, type EvaluateOptions, type EvaluationResult, type Fact, type FactHistoryResponse, type FactListOptions, type FactListResponse, type GenerateBioOptions, type GenerateBioResponse, type GenerateCharacterOptions, type GenerateCharacterResponse, type GenerateSeedMemoriesOptions, type GenerateSeedMemoriesResponse, type GeneratedGoal, type GetContextOptions, type Goal, type GoalPriority, type GoalStatus, type GoalType, type GoalsResponse, type HabitsResponse, type IdentityMemory, type ImageGenerateOptions, type ImageGenerateResponse, type ImportJob, type ImportJobListResponse, type InitialGoal, type InsertFactDetail, type InsertFactEntry, type InsertFactsOptions, type InsertFactsResponse, type InsertRelEntry, type InstanceCreateOptions, type InstanceListResponse, type InterestsResponse, InternalServerError, type InventoryBatchImportOptions, type InventoryBatchImportResponse, type InventoryBatchItem, type InventoryDirectUpdateOptions, type InventoryDirectUpdateResponse, type InventoryGroupResult, type InventoryItem, type InventoryQueryOptions, type InventoryQueryResponse, type InventoryUpdateOptions, type InventoryUpdateResponse, type KBAnalyticsRule, type KBAnalyticsRuleListResponse, type KBBulkUpdateEntry, type KBBulkUpdateOptions, type KBBulkUpdateResponse, type KBCandidate, type KBConversionStats, type KBConversionsResponse, type KBDocument, type KBDocumentListResponse, type KBEdge, type KBEntitySchema, type KBNode, type KBNodeDetailResponse, type KBNodeHistory, type KBNodeHistoryResponse, type KBNodeListResponse, type KBRecommendationScore, type KBRecommendationsResponse, type KBRelatedNode, type KBResolutionInfo, type KBSchemaField, type KBSchemaListResponse, type KBSearchOptions, type KBSearchResponse, type KBSearchResult, type KBSimilarityConfig, type KBStats, type KBTrendAggregation, type KBTrendRanking, type KBTrendRankingsResponse, type KBTrendsResponse, type ListAllFactsOptions, type ListAllFactsResponse, type LoreGenerationContext, type MemoryListOptions, type MemoryNode, type MemoryResetOptions, type MemoryResetResponse, type MemoryResponse, type MemorySearchOptions, type MemorySearchResponse, type MemorySearchResult, type MemorySummary, type MemoryTimelineOptions, type MemoryTimelineResponse, type ModelsProviderEntry, type ModelsResponse, type MoodAggregateResponse, type MoodResponse, NotFoundError, type Notification, type NotificationListOptions, type NotificationListResponse, PermissionDeniedError, type PersonalityBehaviors, type PersonalityDelta, type PersonalityDimensions, type PersonalityGetOptions, type PersonalityPreferences, type PersonalityProfile, type PersonalityResponse, type PersonalityShift, type PersonalityUpdateOptions, type PersonalityUpdateResponse, type PrimeContentBlock, type PrimeUserMetadata, type PrimeUserOptions, type PrimeUserResponse, type ProcessOptions, type ProcessResponse, type ProcessSideEffectsSummary, type ProjectConfigEntry, type ProjectConfigListResponse, type ProjectNotificationListOptions, type ProjectNotificationListResponse, RateLimitError, type RecentShiftsResponse, type RecordFeedbackOptions, type RelationshipResponse, type RunEvalOptions, type RunRef, type SDKBehavioralTraits, type SDKInteractionPreferences, type SDKPersonalityDimensions, type ScheduleWakeupOptions, type ScheduledWakeup, type SeedMemoriesOptions, type SeedMemoriesResponse, type SeedMemory, type SessionEndOptions, type SessionResponse, type SessionStartOptions, type SetConfigOptions, type SetCustomLLMOptions, type SetSessionToolsOptions, type SetStatusOptions, type SetStatusResponse, type SignificantMoment, type SignificantMomentsResponse, type SimulateOptions, type SimulationConfig, type SimulationEvent, type SimulationSession, Sonzai, type SonzaiConfig, SonzaiError, type StoredFact, StreamError, type StructuredColumnMapping, type StructuredImportSpec, type SummariesOptions, type SummariesResponse, type TimeMachineMoodSnapshot, type TimeMachineOptions, type TimeMachineResponse, type TimelineSession, type ToolDefinition, type TriggerEventOptions, type TriggerEventResponse, type UpdateAgentOptions, type UpdateAnalyticsRuleOptions, type UpdateCapabilitiesOptions, type UpdateCustomToolOptions, type UpdateGoalOptions, type UpdateInstanceOptions, type UpdateMetadataOptions, type UpdateMetadataResponse, type UpdateProjectOptions, type UpdateProjectResponse, type UserOverlayDetailResponse, type UserOverlayOptions, type UserOverlaysListResponse, type UserPersona, type UserPersonalityOverlay, type UserPrimingMetadata, type UsersResponse, type VoiceEntry, type VoiceListOptions, type VoiceListResponse, type VoiceStreamEvent, VoiceStreamInstance, type VoiceStreamToken, type VoiceTokenOptions, type VoiceUsage, type WakeupsResponse, type WebhookDeliveryAttempt, type WebhookEndpoint, type WebhookListResponse, type WebhookRegisterOptions, type WebhookRegisterResponse };
|
|
2568
|
+
export { APIError, type AcknowledgeAllOptions, type AcknowledgeNotificationsOptions, type AcknowledgeResponse, type AddContentOptions, type AddContentResponse, type Agent, type AgentCapabilities, type AgentIndex, type AgentInstance, type AgentKBSearchOptions, type AgentKBSearchResponse, type AgentKBSearchResult, type AgentListOptions, type AgentListResponse, type AgentToolCapabilities, type AtomicFact, AuthenticationError, BadRequestError, type BatchImportOptions, type BatchImportResponse, type BatchImportUser, type BatchPersonalityEntry, type BatchPersonalityResponse, type Big5, type Big5Scores, type Big5Trait, type BreakthroughsResponse, type ChatChoice, type ChatMessage, type ChatOptions, type ChatResponse, type ChatStreamEvent, type ChatUsage, type ConsolidateOptions, type ConsolidateResponse, type ConstellationResponse, type ContextDataOptions, type CreateAgentOptions, type CreateAnalyticsRuleOptions, type CreateCustomToolOptions, type CreateGoalOptions, type CreateSchemaOptions, type CustomLLMConfigResponse, type CustomState, type CustomStateCreateOptions, type CustomStateDeleteByKeyOptions, type CustomStateGetByKeyOptions, type CustomStateListOptions, type CustomStateListResponse, type CustomStateUpdateOptions, type CustomStateUpsertOptions, type CustomToolDefinition, type CustomToolListResponse, type DeleteGoalOptions, type DeliveryAttemptsResponse, type DialogueOptions, type DialogueResponse, type DiaryResponse, type EnrichedContextResponse, type EvalCategory, type EvalOnlyOptions, type EvalRun, type EvalRunListOptions, type EvalRunListResponse, type EvalTemplate, type EvalTemplateCategory, type EvalTemplateCreateOptions, type EvalTemplateListResponse, type EvalTemplateUpdateOptions, type EvaluateOptions, type EvaluationResult, type ExtractionDimensionDelta, type ExtractionFact, type ExtractionHabit, type ExtractionInnerThoughts, type ExtractionInterest, type ExtractionMoodDelta, type ExtractionPersonalityDelta, type ExtractionProactive, type ExtractionRecurring, type ExtractionRelationshipDelta, type Fact, type FactHistoryResponse, type FactListOptions, type FactListResponse, type GenerateAvatarOptions, type GenerateAvatarResponse, type GenerateBioOptions, type GenerateBioResponse, type GenerateCharacterOptions, type GenerateCharacterResponse, type GenerateSeedMemoriesOptions, type GenerateSeedMemoriesResponse, type GeneratedGoal, type GetContextOptions, type Goal, type GoalPriority, type GoalStatus, type GoalType, type GoalsResponse, type HabitsResponse, type IdentityMemory, type ImageGenerateOptions, type ImageGenerateResponse, type ImportJob, type ImportJobListResponse, type InitialGoal, type InsertFactDetail, type InsertFactEntry, type InsertFactsOptions, type InsertFactsResponse, type InsertRelEntry, type InstanceCreateOptions, type InstanceListResponse, type InterestsResponse, InternalServerError, type InventoryBatchImportOptions, type InventoryBatchImportResponse, type InventoryBatchItem, type InventoryDirectUpdateOptions, type InventoryDirectUpdateResponse, type InventoryGroupResult, type InventoryItem, type InventoryQueryOptions, type InventoryQueryResponse, type InventoryUpdateOptions, type InventoryUpdateResponse, type KBAnalyticsRule, type KBAnalyticsRuleListResponse, type KBBulkUpdateEntry, type KBBulkUpdateOptions, type KBBulkUpdateResponse, type KBCandidate, type KBConversionStats, type KBConversionsResponse, type KBDocument, type KBDocumentListResponse, type KBEdge, type KBEntitySchema, type KBNode, type KBNodeDetailResponse, type KBNodeHistory, type KBNodeHistoryResponse, type KBNodeListResponse, type KBRecommendationScore, type KBRecommendationsResponse, type KBRelatedNode, type KBResolutionInfo, type KBSchemaField, type KBSchemaListResponse, type KBSearchOptions, type KBSearchResponse, type KBSearchResult, type KBSimilarityConfig, type KBStats, type KBTrendAggregation, type KBTrendRanking, type KBTrendRankingsResponse, type KBTrendsResponse, type ListAllFactsOptions, type ListAllFactsResponse, type LoreGenerationContext, type MemoryListOptions, type MemoryNode, type MemoryResetOptions, type MemoryResetResponse, type MemoryResponse, type MemorySearchOptions, type MemorySearchResponse, type MemorySearchResult, type MemorySummary, type MemoryTimelineOptions, type MemoryTimelineResponse, type ModelsProviderEntry, type ModelsResponse, type MoodAggregateResponse, type MoodResponse, NotFoundError, type Notification, type NotificationListOptions, type NotificationListResponse, PermissionDeniedError, type PersonalityBehaviors, type PersonalityDelta, type PersonalityDimensions, type PersonalityGetOptions, type PersonalityPreferences, type PersonalityProfile, type PersonalityResponse, type PersonalityShift, type PersonalityUpdateOptions, type PersonalityUpdateResponse, type PrimeContentBlock, type PrimeUserMetadata, type PrimeUserOptions, type PrimeUserResponse, type ProcessOptions, type ProcessResponse, type ProcessSideEffectsSummary, type ProjectConfigEntry, type ProjectConfigListResponse, type ProjectNotificationListOptions, type ProjectNotificationListResponse, RateLimitError, type RecentShiftsResponse, type RecordFeedbackOptions, type RelationshipResponse, type RunEvalOptions, type RunRef, type SDKBehavioralTraits, type SDKInteractionPreferences, type SDKPersonalityDimensions, type STTOptions, type STTResponse, type ScheduleWakeupOptions, type ScheduledWakeup, type SeedMemoriesOptions, type SeedMemoriesResponse, type SeedMemory, type SessionEndOptions, type SessionResponse, type SessionStartOptions, type SetConfigOptions, type SetCustomLLMOptions, type SetSessionToolsOptions, type SetStatusOptions, type SetStatusResponse, type SideEffectExtraction, type SignificantMoment, type SignificantMomentsResponse, type SimulateOptions, type SimulationConfig, type SimulationEvent, type SimulationSession, Sonzai, type SonzaiConfig, SonzaiError, type StoredFact, StreamError, type StructuredColumnMapping, type StructuredImportSpec, type SummariesOptions, type SummariesResponse, type TTSOptions, type TTSResponse, type TimeMachineMoodSnapshot, type TimeMachineOptions, type TimeMachineResponse, type TimelineSession, type ToolDefinition, type ToolSchema, type ToolSchemasResponse, type TriggerEventOptions, type TriggerEventResponse, type UpdateAgentOptions, type UpdateAnalyticsRuleOptions, type UpdateCapabilitiesOptions, type UpdateCustomToolOptions, type UpdateGoalOptions, type UpdateInstanceOptions, type UpdateMetadataOptions, type UpdateMetadataResponse, type UpdateProjectOptions, type UpdateProjectResponse, type UserOverlayDetailResponse, type UserOverlayOptions, type UserOverlaysListResponse, type UserPersona, type UserPersonalityOverlay, type UserPrimingMetadata, type UsersResponse, type VoiceEntry, type VoiceListOptions, type VoiceListResponse, type VoiceStreamEvent, VoiceStreamInstance, type VoiceStreamToken, type VoiceTokenOptions, type VoiceUsage, type WakeupsResponse, type WebhookDeliveryAttempt, type WebhookEndpoint, type WebhookListResponse, type WebhookRegisterOptions, type WebhookRegisterResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -361,6 +361,8 @@ interface ProcessOptions {
|
|
|
361
361
|
provider?: string;
|
|
362
362
|
/** LLM model for extraction (e.g. "gemini-2.5-flash", "gpt-4o-mini"). Falls back to platform default. */
|
|
363
363
|
model?: string;
|
|
364
|
+
/** When true, the response includes the full extraction payload in `extractions`. */
|
|
365
|
+
includeExtractions?: boolean;
|
|
364
366
|
}
|
|
365
367
|
interface ProcessSideEffectsSummary {
|
|
366
368
|
mood_updated: boolean;
|
|
@@ -431,6 +433,77 @@ interface ProcessResponse {
|
|
|
431
433
|
memories_created: number;
|
|
432
434
|
facts_extracted: number;
|
|
433
435
|
side_effects: ProcessSideEffectsSummary;
|
|
436
|
+
/** Present only when `includeExtractions` was set to true in the request. */
|
|
437
|
+
extractions?: SideEffectExtraction;
|
|
438
|
+
}
|
|
439
|
+
interface ExtractionFact {
|
|
440
|
+
text: string;
|
|
441
|
+
fact_type: string;
|
|
442
|
+
importance: number;
|
|
443
|
+
entities: string[];
|
|
444
|
+
sentiment: string;
|
|
445
|
+
topic_tags: string[];
|
|
446
|
+
}
|
|
447
|
+
interface ExtractionPersonalityDelta {
|
|
448
|
+
trait: string;
|
|
449
|
+
delta: number;
|
|
450
|
+
reason: string;
|
|
451
|
+
}
|
|
452
|
+
interface ExtractionDimensionDelta {
|
|
453
|
+
dimension: string;
|
|
454
|
+
delta: number;
|
|
455
|
+
reason: string;
|
|
456
|
+
}
|
|
457
|
+
interface ExtractionMoodDelta {
|
|
458
|
+
happiness: number;
|
|
459
|
+
energy: number;
|
|
460
|
+
calmness: number;
|
|
461
|
+
affection: number;
|
|
462
|
+
reason: string;
|
|
463
|
+
}
|
|
464
|
+
interface ExtractionHabit {
|
|
465
|
+
name: string;
|
|
466
|
+
category: string;
|
|
467
|
+
description: string;
|
|
468
|
+
is_reinforcement: boolean;
|
|
469
|
+
}
|
|
470
|
+
interface ExtractionInterest {
|
|
471
|
+
topic: string;
|
|
472
|
+
category: string;
|
|
473
|
+
confidence: number;
|
|
474
|
+
engagement_level: number;
|
|
475
|
+
}
|
|
476
|
+
interface ExtractionRelationshipDelta {
|
|
477
|
+
score_change: number;
|
|
478
|
+
reason: string;
|
|
479
|
+
}
|
|
480
|
+
interface ExtractionProactive {
|
|
481
|
+
type: string;
|
|
482
|
+
description: string;
|
|
483
|
+
delay_hours: number;
|
|
484
|
+
intent: string;
|
|
485
|
+
}
|
|
486
|
+
interface ExtractionRecurring {
|
|
487
|
+
description: string;
|
|
488
|
+
pattern: string;
|
|
489
|
+
confidence: number;
|
|
490
|
+
}
|
|
491
|
+
interface ExtractionInnerThoughts {
|
|
492
|
+
diary: string;
|
|
493
|
+
reflection: string;
|
|
494
|
+
}
|
|
495
|
+
interface SideEffectExtraction {
|
|
496
|
+
memory_facts: ExtractionFact[];
|
|
497
|
+
personality_deltas: ExtractionPersonalityDelta[];
|
|
498
|
+
dimension_deltas: ExtractionDimensionDelta[];
|
|
499
|
+
mood_delta?: ExtractionMoodDelta;
|
|
500
|
+
habit_observations: ExtractionHabit[];
|
|
501
|
+
interests_detected: ExtractionInterest[];
|
|
502
|
+
relationship_delta?: ExtractionRelationshipDelta;
|
|
503
|
+
proactive_suggestions: ExtractionProactive[];
|
|
504
|
+
recurring_events: ExtractionRecurring[];
|
|
505
|
+
inner_thoughts?: ExtractionInnerThoughts;
|
|
506
|
+
emotional_themes: string[];
|
|
434
507
|
}
|
|
435
508
|
interface EvalCategory {
|
|
436
509
|
name: string;
|
|
@@ -838,6 +911,51 @@ interface VoiceListOptions {
|
|
|
838
911
|
limit?: number;
|
|
839
912
|
offset?: number;
|
|
840
913
|
}
|
|
914
|
+
/** Options for text-to-speech synthesis. */
|
|
915
|
+
interface TTSOptions {
|
|
916
|
+
/** Text to synthesize (1–5000 characters). */
|
|
917
|
+
text: string;
|
|
918
|
+
/** Gemini voice name (e.g., "Kore", "Puck"). Defaults to "Kore". */
|
|
919
|
+
voiceName?: string;
|
|
920
|
+
/** Language code (e.g., "en-US"). Defaults to "en-US". */
|
|
921
|
+
language?: string;
|
|
922
|
+
/** Output audio format. Defaults to "wav". */
|
|
923
|
+
outputFormat?: "wav" | "opus";
|
|
924
|
+
}
|
|
925
|
+
/** Response from text-to-speech synthesis. */
|
|
926
|
+
interface TTSResponse {
|
|
927
|
+
/** Base64-encoded audio data. */
|
|
928
|
+
audio: string;
|
|
929
|
+
/** MIME type of the audio ("audio/wav" or "audio/ogg"). */
|
|
930
|
+
contentType: string;
|
|
931
|
+
/** Estimated audio duration in milliseconds. */
|
|
932
|
+
durationMs?: number;
|
|
933
|
+
/** Token usage for billing. */
|
|
934
|
+
usage?: {
|
|
935
|
+
promptTokens: number;
|
|
936
|
+
completionTokens: number;
|
|
937
|
+
totalTokens: number;
|
|
938
|
+
model: string;
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
/** Options for speech-to-text transcription. */
|
|
942
|
+
interface STTOptions {
|
|
943
|
+
/** Base64-encoded audio data. */
|
|
944
|
+
audio: string;
|
|
945
|
+
/** MIME type of the audio (e.g., "audio/wav", "audio/webm;codecs=opus"). */
|
|
946
|
+
audioFormat: string;
|
|
947
|
+
/** Language hint (e.g., "en-US"). */
|
|
948
|
+
language?: string;
|
|
949
|
+
}
|
|
950
|
+
/** Response from speech-to-text transcription. */
|
|
951
|
+
interface STTResponse {
|
|
952
|
+
/** Transcribed text. */
|
|
953
|
+
transcript: string;
|
|
954
|
+
/** Confidence score (0.0–1.0). */
|
|
955
|
+
confidence: number;
|
|
956
|
+
/** Detected or confirmed language code. */
|
|
957
|
+
languageCode?: string;
|
|
958
|
+
}
|
|
841
959
|
interface GenerateBioOptions {
|
|
842
960
|
name?: string;
|
|
843
961
|
gender?: string;
|
|
@@ -1218,6 +1336,15 @@ interface UpdateCustomToolOptions {
|
|
|
1218
1336
|
description?: string;
|
|
1219
1337
|
parameters?: Record<string, unknown>;
|
|
1220
1338
|
}
|
|
1339
|
+
interface GenerateAvatarOptions {
|
|
1340
|
+
style?: string;
|
|
1341
|
+
}
|
|
1342
|
+
interface GenerateAvatarResponse {
|
|
1343
|
+
success: boolean;
|
|
1344
|
+
avatar_url: string;
|
|
1345
|
+
prompt: string;
|
|
1346
|
+
generation_time_ms: number;
|
|
1347
|
+
}
|
|
1221
1348
|
interface ConsolidateOptions {
|
|
1222
1349
|
period?: string;
|
|
1223
1350
|
user_id?: string;
|
|
@@ -1773,6 +1900,32 @@ interface AcknowledgeAllOptions {
|
|
|
1773
1900
|
agentId?: string;
|
|
1774
1901
|
eventType?: string;
|
|
1775
1902
|
}
|
|
1903
|
+
interface AgentKBSearchOptions {
|
|
1904
|
+
query: string;
|
|
1905
|
+
limit?: number;
|
|
1906
|
+
}
|
|
1907
|
+
interface AgentKBSearchResult {
|
|
1908
|
+
content: string;
|
|
1909
|
+
label: string;
|
|
1910
|
+
type: string;
|
|
1911
|
+
source: string;
|
|
1912
|
+
score: number;
|
|
1913
|
+
}
|
|
1914
|
+
interface AgentKBSearchResponse {
|
|
1915
|
+
query: string;
|
|
1916
|
+
results: AgentKBSearchResult[];
|
|
1917
|
+
}
|
|
1918
|
+
/** Describes a single tool available for an agent (BYO-LLM integrations). */
|
|
1919
|
+
interface ToolSchema {
|
|
1920
|
+
name: string;
|
|
1921
|
+
description: string;
|
|
1922
|
+
endpoint: string;
|
|
1923
|
+
parameters?: Record<string, unknown>;
|
|
1924
|
+
}
|
|
1925
|
+
/** Response from the getTools endpoint. */
|
|
1926
|
+
interface ToolSchemasResponse {
|
|
1927
|
+
tools: ToolSchema[];
|
|
1928
|
+
}
|
|
1776
1929
|
|
|
1777
1930
|
/** Custom state operations for agents. */
|
|
1778
1931
|
declare class CustomStates {
|
|
@@ -1991,6 +2144,34 @@ declare class Voice {
|
|
|
1991
2144
|
* ```
|
|
1992
2145
|
*/
|
|
1993
2146
|
stream(token: VoiceStreamToken): Promise<VoiceStreamInstance>;
|
|
2147
|
+
/**
|
|
2148
|
+
* Convert text to speech audio.
|
|
2149
|
+
*
|
|
2150
|
+
* @example
|
|
2151
|
+
* ```ts
|
|
2152
|
+
* const result = await client.agents.voice.tts(agentId, {
|
|
2153
|
+
* text: "Hello, how are you?",
|
|
2154
|
+
* voiceName: "Kore",
|
|
2155
|
+
* outputFormat: "wav",
|
|
2156
|
+
* });
|
|
2157
|
+
* // result.audio is base64-encoded WAV
|
|
2158
|
+
* ```
|
|
2159
|
+
*/
|
|
2160
|
+
tts(agentId: string, options: TTSOptions): Promise<TTSResponse>;
|
|
2161
|
+
/**
|
|
2162
|
+
* Transcribe audio to text.
|
|
2163
|
+
*
|
|
2164
|
+
* @example
|
|
2165
|
+
* ```ts
|
|
2166
|
+
* const result = await client.agents.voice.stt(agentId, {
|
|
2167
|
+
* audio: base64Audio,
|
|
2168
|
+
* audioFormat: "audio/wav",
|
|
2169
|
+
* language: "en-US",
|
|
2170
|
+
* });
|
|
2171
|
+
* console.log(result.transcript);
|
|
2172
|
+
* ```
|
|
2173
|
+
*/
|
|
2174
|
+
stt(agentId: string, options: STTOptions): Promise<STTResponse>;
|
|
1994
2175
|
}
|
|
1995
2176
|
/**
|
|
1996
2177
|
* Bidirectional WebSocket connection for real-time voice chat.
|
|
@@ -2117,6 +2298,8 @@ declare class Agents {
|
|
|
2117
2298
|
}>;
|
|
2118
2299
|
/** Delete a custom tool from an agent. */
|
|
2119
2300
|
deleteCustomTool(agentId: string, toolName: string): Promise<void>;
|
|
2301
|
+
/** Trigger avatar generation for an agent. */
|
|
2302
|
+
generateAvatar(agentId: string, options?: GenerateAvatarOptions): Promise<GenerateAvatarResponse>;
|
|
2120
2303
|
/**
|
|
2121
2304
|
* Run the full Context Engine pipeline on conversation messages without
|
|
2122
2305
|
* generating a chat response. Extracts side effects via LLM, processes
|
|
@@ -2138,6 +2321,10 @@ declare class Agents {
|
|
|
2138
2321
|
getSummaries(agentId: string, options?: SummariesOptions): Promise<SummariesResponse>;
|
|
2139
2322
|
/** Get a point-in-time snapshot of an agent's personality and mood. */
|
|
2140
2323
|
getTimeMachine(agentId: string, options: TimeMachineOptions): Promise<TimeMachineResponse>;
|
|
2324
|
+
/** Search the knowledge base for an agent. */
|
|
2325
|
+
knowledgeSearch(agentId: string, options: AgentKBSearchOptions): Promise<AgentKBSearchResponse>;
|
|
2326
|
+
/** Get tool schemas available for an agent (for BYO-LLM integrations). */
|
|
2327
|
+
getTools(agentId: string): Promise<ToolSchemasResponse>;
|
|
2141
2328
|
private buildChatBody;
|
|
2142
2329
|
}
|
|
2143
2330
|
|
|
@@ -2378,4 +2565,4 @@ declare class StreamError extends SonzaiError {
|
|
|
2378
2565
|
constructor(message: string);
|
|
2379
2566
|
}
|
|
2380
2567
|
|
|
2381
|
-
export { APIError, type AcknowledgeAllOptions, type AcknowledgeNotificationsOptions, type AcknowledgeResponse, type AddContentOptions, type AddContentResponse, type Agent, type AgentCapabilities, type AgentIndex, type AgentInstance, type AgentListOptions, type AgentListResponse, type AgentToolCapabilities, type AtomicFact, AuthenticationError, BadRequestError, type BatchImportOptions, type BatchImportResponse, type BatchImportUser, type BatchPersonalityEntry, type BatchPersonalityResponse, type Big5, type Big5Scores, type Big5Trait, type BreakthroughsResponse, type ChatChoice, type ChatMessage, type ChatOptions, type ChatResponse, type ChatStreamEvent, type ChatUsage, type ConsolidateOptions, type ConsolidateResponse, type ConstellationResponse, type ContextDataOptions, type CreateAgentOptions, type CreateAnalyticsRuleOptions, type CreateCustomToolOptions, type CreateGoalOptions, type CreateSchemaOptions, type CustomLLMConfigResponse, type CustomState, type CustomStateCreateOptions, type CustomStateDeleteByKeyOptions, type CustomStateGetByKeyOptions, type CustomStateListOptions, type CustomStateListResponse, type CustomStateUpdateOptions, type CustomStateUpsertOptions, type CustomToolDefinition, type CustomToolListResponse, type DeleteGoalOptions, type DeliveryAttemptsResponse, type DialogueOptions, type DialogueResponse, type DiaryResponse, type EnrichedContextResponse, type EvalCategory, type EvalOnlyOptions, type EvalRun, type EvalRunListOptions, type EvalRunListResponse, type EvalTemplate, type EvalTemplateCategory, type EvalTemplateCreateOptions, type EvalTemplateListResponse, type EvalTemplateUpdateOptions, type EvaluateOptions, type EvaluationResult, type Fact, type FactHistoryResponse, type FactListOptions, type FactListResponse, type GenerateBioOptions, type GenerateBioResponse, type GenerateCharacterOptions, type GenerateCharacterResponse, type GenerateSeedMemoriesOptions, type GenerateSeedMemoriesResponse, type GeneratedGoal, type GetContextOptions, type Goal, type GoalPriority, type GoalStatus, type GoalType, type GoalsResponse, type HabitsResponse, type IdentityMemory, type ImageGenerateOptions, type ImageGenerateResponse, type ImportJob, type ImportJobListResponse, type InitialGoal, type InsertFactDetail, type InsertFactEntry, type InsertFactsOptions, type InsertFactsResponse, type InsertRelEntry, type InstanceCreateOptions, type InstanceListResponse, type InterestsResponse, InternalServerError, type InventoryBatchImportOptions, type InventoryBatchImportResponse, type InventoryBatchItem, type InventoryDirectUpdateOptions, type InventoryDirectUpdateResponse, type InventoryGroupResult, type InventoryItem, type InventoryQueryOptions, type InventoryQueryResponse, type InventoryUpdateOptions, type InventoryUpdateResponse, type KBAnalyticsRule, type KBAnalyticsRuleListResponse, type KBBulkUpdateEntry, type KBBulkUpdateOptions, type KBBulkUpdateResponse, type KBCandidate, type KBConversionStats, type KBConversionsResponse, type KBDocument, type KBDocumentListResponse, type KBEdge, type KBEntitySchema, type KBNode, type KBNodeDetailResponse, type KBNodeHistory, type KBNodeHistoryResponse, type KBNodeListResponse, type KBRecommendationScore, type KBRecommendationsResponse, type KBRelatedNode, type KBResolutionInfo, type KBSchemaField, type KBSchemaListResponse, type KBSearchOptions, type KBSearchResponse, type KBSearchResult, type KBSimilarityConfig, type KBStats, type KBTrendAggregation, type KBTrendRanking, type KBTrendRankingsResponse, type KBTrendsResponse, type ListAllFactsOptions, type ListAllFactsResponse, type LoreGenerationContext, type MemoryListOptions, type MemoryNode, type MemoryResetOptions, type MemoryResetResponse, type MemoryResponse, type MemorySearchOptions, type MemorySearchResponse, type MemorySearchResult, type MemorySummary, type MemoryTimelineOptions, type MemoryTimelineResponse, type ModelsProviderEntry, type ModelsResponse, type MoodAggregateResponse, type MoodResponse, NotFoundError, type Notification, type NotificationListOptions, type NotificationListResponse, PermissionDeniedError, type PersonalityBehaviors, type PersonalityDelta, type PersonalityDimensions, type PersonalityGetOptions, type PersonalityPreferences, type PersonalityProfile, type PersonalityResponse, type PersonalityShift, type PersonalityUpdateOptions, type PersonalityUpdateResponse, type PrimeContentBlock, type PrimeUserMetadata, type PrimeUserOptions, type PrimeUserResponse, type ProcessOptions, type ProcessResponse, type ProcessSideEffectsSummary, type ProjectConfigEntry, type ProjectConfigListResponse, type ProjectNotificationListOptions, type ProjectNotificationListResponse, RateLimitError, type RecentShiftsResponse, type RecordFeedbackOptions, type RelationshipResponse, type RunEvalOptions, type RunRef, type SDKBehavioralTraits, type SDKInteractionPreferences, type SDKPersonalityDimensions, type ScheduleWakeupOptions, type ScheduledWakeup, type SeedMemoriesOptions, type SeedMemoriesResponse, type SeedMemory, type SessionEndOptions, type SessionResponse, type SessionStartOptions, type SetConfigOptions, type SetCustomLLMOptions, type SetSessionToolsOptions, type SetStatusOptions, type SetStatusResponse, type SignificantMoment, type SignificantMomentsResponse, type SimulateOptions, type SimulationConfig, type SimulationEvent, type SimulationSession, Sonzai, type SonzaiConfig, SonzaiError, type StoredFact, StreamError, type StructuredColumnMapping, type StructuredImportSpec, type SummariesOptions, type SummariesResponse, type TimeMachineMoodSnapshot, type TimeMachineOptions, type TimeMachineResponse, type TimelineSession, type ToolDefinition, type TriggerEventOptions, type TriggerEventResponse, type UpdateAgentOptions, type UpdateAnalyticsRuleOptions, type UpdateCapabilitiesOptions, type UpdateCustomToolOptions, type UpdateGoalOptions, type UpdateInstanceOptions, type UpdateMetadataOptions, type UpdateMetadataResponse, type UpdateProjectOptions, type UpdateProjectResponse, type UserOverlayDetailResponse, type UserOverlayOptions, type UserOverlaysListResponse, type UserPersona, type UserPersonalityOverlay, type UserPrimingMetadata, type UsersResponse, type VoiceEntry, type VoiceListOptions, type VoiceListResponse, type VoiceStreamEvent, VoiceStreamInstance, type VoiceStreamToken, type VoiceTokenOptions, type VoiceUsage, type WakeupsResponse, type WebhookDeliveryAttempt, type WebhookEndpoint, type WebhookListResponse, type WebhookRegisterOptions, type WebhookRegisterResponse };
|
|
2568
|
+
export { APIError, type AcknowledgeAllOptions, type AcknowledgeNotificationsOptions, type AcknowledgeResponse, type AddContentOptions, type AddContentResponse, type Agent, type AgentCapabilities, type AgentIndex, type AgentInstance, type AgentKBSearchOptions, type AgentKBSearchResponse, type AgentKBSearchResult, type AgentListOptions, type AgentListResponse, type AgentToolCapabilities, type AtomicFact, AuthenticationError, BadRequestError, type BatchImportOptions, type BatchImportResponse, type BatchImportUser, type BatchPersonalityEntry, type BatchPersonalityResponse, type Big5, type Big5Scores, type Big5Trait, type BreakthroughsResponse, type ChatChoice, type ChatMessage, type ChatOptions, type ChatResponse, type ChatStreamEvent, type ChatUsage, type ConsolidateOptions, type ConsolidateResponse, type ConstellationResponse, type ContextDataOptions, type CreateAgentOptions, type CreateAnalyticsRuleOptions, type CreateCustomToolOptions, type CreateGoalOptions, type CreateSchemaOptions, type CustomLLMConfigResponse, type CustomState, type CustomStateCreateOptions, type CustomStateDeleteByKeyOptions, type CustomStateGetByKeyOptions, type CustomStateListOptions, type CustomStateListResponse, type CustomStateUpdateOptions, type CustomStateUpsertOptions, type CustomToolDefinition, type CustomToolListResponse, type DeleteGoalOptions, type DeliveryAttemptsResponse, type DialogueOptions, type DialogueResponse, type DiaryResponse, type EnrichedContextResponse, type EvalCategory, type EvalOnlyOptions, type EvalRun, type EvalRunListOptions, type EvalRunListResponse, type EvalTemplate, type EvalTemplateCategory, type EvalTemplateCreateOptions, type EvalTemplateListResponse, type EvalTemplateUpdateOptions, type EvaluateOptions, type EvaluationResult, type ExtractionDimensionDelta, type ExtractionFact, type ExtractionHabit, type ExtractionInnerThoughts, type ExtractionInterest, type ExtractionMoodDelta, type ExtractionPersonalityDelta, type ExtractionProactive, type ExtractionRecurring, type ExtractionRelationshipDelta, type Fact, type FactHistoryResponse, type FactListOptions, type FactListResponse, type GenerateAvatarOptions, type GenerateAvatarResponse, type GenerateBioOptions, type GenerateBioResponse, type GenerateCharacterOptions, type GenerateCharacterResponse, type GenerateSeedMemoriesOptions, type GenerateSeedMemoriesResponse, type GeneratedGoal, type GetContextOptions, type Goal, type GoalPriority, type GoalStatus, type GoalType, type GoalsResponse, type HabitsResponse, type IdentityMemory, type ImageGenerateOptions, type ImageGenerateResponse, type ImportJob, type ImportJobListResponse, type InitialGoal, type InsertFactDetail, type InsertFactEntry, type InsertFactsOptions, type InsertFactsResponse, type InsertRelEntry, type InstanceCreateOptions, type InstanceListResponse, type InterestsResponse, InternalServerError, type InventoryBatchImportOptions, type InventoryBatchImportResponse, type InventoryBatchItem, type InventoryDirectUpdateOptions, type InventoryDirectUpdateResponse, type InventoryGroupResult, type InventoryItem, type InventoryQueryOptions, type InventoryQueryResponse, type InventoryUpdateOptions, type InventoryUpdateResponse, type KBAnalyticsRule, type KBAnalyticsRuleListResponse, type KBBulkUpdateEntry, type KBBulkUpdateOptions, type KBBulkUpdateResponse, type KBCandidate, type KBConversionStats, type KBConversionsResponse, type KBDocument, type KBDocumentListResponse, type KBEdge, type KBEntitySchema, type KBNode, type KBNodeDetailResponse, type KBNodeHistory, type KBNodeHistoryResponse, type KBNodeListResponse, type KBRecommendationScore, type KBRecommendationsResponse, type KBRelatedNode, type KBResolutionInfo, type KBSchemaField, type KBSchemaListResponse, type KBSearchOptions, type KBSearchResponse, type KBSearchResult, type KBSimilarityConfig, type KBStats, type KBTrendAggregation, type KBTrendRanking, type KBTrendRankingsResponse, type KBTrendsResponse, type ListAllFactsOptions, type ListAllFactsResponse, type LoreGenerationContext, type MemoryListOptions, type MemoryNode, type MemoryResetOptions, type MemoryResetResponse, type MemoryResponse, type MemorySearchOptions, type MemorySearchResponse, type MemorySearchResult, type MemorySummary, type MemoryTimelineOptions, type MemoryTimelineResponse, type ModelsProviderEntry, type ModelsResponse, type MoodAggregateResponse, type MoodResponse, NotFoundError, type Notification, type NotificationListOptions, type NotificationListResponse, PermissionDeniedError, type PersonalityBehaviors, type PersonalityDelta, type PersonalityDimensions, type PersonalityGetOptions, type PersonalityPreferences, type PersonalityProfile, type PersonalityResponse, type PersonalityShift, type PersonalityUpdateOptions, type PersonalityUpdateResponse, type PrimeContentBlock, type PrimeUserMetadata, type PrimeUserOptions, type PrimeUserResponse, type ProcessOptions, type ProcessResponse, type ProcessSideEffectsSummary, type ProjectConfigEntry, type ProjectConfigListResponse, type ProjectNotificationListOptions, type ProjectNotificationListResponse, RateLimitError, type RecentShiftsResponse, type RecordFeedbackOptions, type RelationshipResponse, type RunEvalOptions, type RunRef, type SDKBehavioralTraits, type SDKInteractionPreferences, type SDKPersonalityDimensions, type STTOptions, type STTResponse, type ScheduleWakeupOptions, type ScheduledWakeup, type SeedMemoriesOptions, type SeedMemoriesResponse, type SeedMemory, type SessionEndOptions, type SessionResponse, type SessionStartOptions, type SetConfigOptions, type SetCustomLLMOptions, type SetSessionToolsOptions, type SetStatusOptions, type SetStatusResponse, type SideEffectExtraction, type SignificantMoment, type SignificantMomentsResponse, type SimulateOptions, type SimulationConfig, type SimulationEvent, type SimulationSession, Sonzai, type SonzaiConfig, SonzaiError, type StoredFact, StreamError, type StructuredColumnMapping, type StructuredImportSpec, type SummariesOptions, type SummariesResponse, type TTSOptions, type TTSResponse, type TimeMachineMoodSnapshot, type TimeMachineOptions, type TimeMachineResponse, type TimelineSession, type ToolDefinition, type ToolSchema, type ToolSchemasResponse, type TriggerEventOptions, type TriggerEventResponse, type UpdateAgentOptions, type UpdateAnalyticsRuleOptions, type UpdateCapabilitiesOptions, type UpdateCustomToolOptions, type UpdateGoalOptions, type UpdateInstanceOptions, type UpdateMetadataOptions, type UpdateMetadataResponse, type UpdateProjectOptions, type UpdateProjectResponse, type UserOverlayDetailResponse, type UserOverlayOptions, type UserOverlaysListResponse, type UserPersona, type UserPersonalityOverlay, type UserPrimingMetadata, type UsersResponse, type VoiceEntry, type VoiceListOptions, type VoiceListResponse, type VoiceStreamEvent, VoiceStreamInstance, type VoiceStreamToken, type VoiceTokenOptions, type VoiceUsage, type WakeupsResponse, type WebhookDeliveryAttempt, type WebhookEndpoint, type WebhookListResponse, type WebhookRegisterOptions, type WebhookRegisterResponse };
|
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var HTTPClient = class {
|
|
|
69
69
|
this.headers = {
|
|
70
70
|
Authorization: `Bearer ${options.apiKey}`,
|
|
71
71
|
"Content-Type": "application/json",
|
|
72
|
-
"User-Agent": "sonzai-typescript/1.
|
|
72
|
+
"User-Agent": "sonzai-typescript/1.0.3"
|
|
73
73
|
};
|
|
74
74
|
this.timeout = options.timeout;
|
|
75
75
|
this.maxRetries = options.maxRetries;
|
|
@@ -113,8 +113,9 @@ var HTTPClient = class {
|
|
|
113
113
|
throw new InternalServerError("Max retries exceeded");
|
|
114
114
|
}
|
|
115
115
|
async backoff(attempt) {
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
const base = Math.min(100 * 2 ** attempt, 5e3);
|
|
117
|
+
const jitter = Math.random() * base;
|
|
118
|
+
await new Promise((resolve) => setTimeout(resolve, base + jitter));
|
|
118
119
|
}
|
|
119
120
|
isNetworkError(error) {
|
|
120
121
|
if (error instanceof SonzaiError) return false;
|
|
@@ -884,6 +885,53 @@ var Voice = class {
|
|
|
884
885
|
async stream(token) {
|
|
885
886
|
return VoiceStreamInstance.connect(token);
|
|
886
887
|
}
|
|
888
|
+
/**
|
|
889
|
+
* Convert text to speech audio.
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```ts
|
|
893
|
+
* const result = await client.agents.voice.tts(agentId, {
|
|
894
|
+
* text: "Hello, how are you?",
|
|
895
|
+
* voiceName: "Kore",
|
|
896
|
+
* outputFormat: "wav",
|
|
897
|
+
* });
|
|
898
|
+
* // result.audio is base64-encoded WAV
|
|
899
|
+
* ```
|
|
900
|
+
*/
|
|
901
|
+
async tts(agentId, options) {
|
|
902
|
+
const body = { text: options.text };
|
|
903
|
+
if (options.voiceName) body.voiceName = options.voiceName;
|
|
904
|
+
if (options.language) body.language = options.language;
|
|
905
|
+
if (options.outputFormat) body.outputFormat = options.outputFormat;
|
|
906
|
+
return this.http.post(
|
|
907
|
+
`/api/v1/agents/${agentId}/voice/tts`,
|
|
908
|
+
body
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Transcribe audio to text.
|
|
913
|
+
*
|
|
914
|
+
* @example
|
|
915
|
+
* ```ts
|
|
916
|
+
* const result = await client.agents.voice.stt(agentId, {
|
|
917
|
+
* audio: base64Audio,
|
|
918
|
+
* audioFormat: "audio/wav",
|
|
919
|
+
* language: "en-US",
|
|
920
|
+
* });
|
|
921
|
+
* console.log(result.transcript);
|
|
922
|
+
* ```
|
|
923
|
+
*/
|
|
924
|
+
async stt(agentId, options) {
|
|
925
|
+
const body = {
|
|
926
|
+
audio: options.audio,
|
|
927
|
+
audioFormat: options.audioFormat
|
|
928
|
+
};
|
|
929
|
+
if (options.language) body.language = options.language;
|
|
930
|
+
return this.http.post(
|
|
931
|
+
`/api/v1/agents/${agentId}/voice/stt`,
|
|
932
|
+
body
|
|
933
|
+
);
|
|
934
|
+
}
|
|
887
935
|
};
|
|
888
936
|
var VoiceStreamInstance = class _VoiceStreamInstance {
|
|
889
937
|
ws;
|
|
@@ -1462,6 +1510,14 @@ var Agents = class {
|
|
|
1462
1510
|
async deleteCustomTool(agentId, toolName) {
|
|
1463
1511
|
return this.http.delete(`/api/v1/agents/${agentId}/tools/${toolName}`);
|
|
1464
1512
|
}
|
|
1513
|
+
// -- Avatar Generation --
|
|
1514
|
+
/** Trigger avatar generation for an agent. */
|
|
1515
|
+
async generateAvatar(agentId, options) {
|
|
1516
|
+
return this.http.post(
|
|
1517
|
+
`/api/v1/agents/${agentId}/avatar/generate`,
|
|
1518
|
+
options ?? {}
|
|
1519
|
+
);
|
|
1520
|
+
}
|
|
1465
1521
|
// -- Process (full pipeline) --
|
|
1466
1522
|
/**
|
|
1467
1523
|
* Run the full Context Engine pipeline on conversation messages without
|
|
@@ -1480,6 +1536,7 @@ var Agents = class {
|
|
|
1480
1536
|
if (options.instanceId) body.instanceId = options.instanceId;
|
|
1481
1537
|
if (options.provider) body.provider = options.provider;
|
|
1482
1538
|
if (options.model) body.model = options.model;
|
|
1539
|
+
if (options.includeExtractions) body.include_extractions = options.includeExtractions;
|
|
1483
1540
|
return this.http.post(`/api/v1/agents/${agentId}/process`, body);
|
|
1484
1541
|
}
|
|
1485
1542
|
/** Get available LLM providers and models for the /process endpoint. */
|
|
@@ -1526,6 +1583,25 @@ var Agents = class {
|
|
|
1526
1583
|
if (options.instanceId) params.instance_id = options.instanceId;
|
|
1527
1584
|
return this.http.get(`/api/v1/agents/${agentId}/timemachine`, params);
|
|
1528
1585
|
}
|
|
1586
|
+
// -- Knowledge Search (tool endpoint) --
|
|
1587
|
+
/** Search the knowledge base for an agent. */
|
|
1588
|
+
async knowledgeSearch(agentId, options) {
|
|
1589
|
+
requireNonEmpty(agentId, "agentId");
|
|
1590
|
+
const body = { query: options.query };
|
|
1591
|
+
if (options.limit != null) body.limit = options.limit;
|
|
1592
|
+
return this.http.post(
|
|
1593
|
+
`/api/v1/agents/${agentId}/tools/knowledge-search`,
|
|
1594
|
+
body
|
|
1595
|
+
);
|
|
1596
|
+
}
|
|
1597
|
+
// -- Tool Schemas (BYO-LLM) --
|
|
1598
|
+
/** Get tool schemas available for an agent (for BYO-LLM integrations). */
|
|
1599
|
+
async getTools(agentId) {
|
|
1600
|
+
requireNonEmpty(agentId, "agentId");
|
|
1601
|
+
return this.http.get(
|
|
1602
|
+
`/api/v1/agents/${agentId}/tools`
|
|
1603
|
+
);
|
|
1604
|
+
}
|
|
1529
1605
|
buildChatBody(options) {
|
|
1530
1606
|
const body = { messages: options.messages };
|
|
1531
1607
|
if (options.userId) body.user_id = options.userId;
|