@sermas/api-client 1.0.0-alpha.150 → 1.0.0-alpha.152

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/index.d.ts CHANGED
@@ -469,6 +469,10 @@ type AppSettingsDto = {
469
469
  * Kiosk colors theme
470
470
  */
471
471
  theme?: Record<string, unknown>;
472
+ /**
473
+ * Repository
474
+ */
475
+ githubRepository?: string;
472
476
  };
473
477
  type TaskIntentDto = {
474
478
  /**
@@ -1007,6 +1011,10 @@ type DialogueTextToSpeechDto = {
1007
1011
  * Toggle TTS rendering for this message
1008
1012
  */
1009
1013
  ttsEnabled?: boolean;
1014
+ /**
1015
+ * Specify if it is a welcome message
1016
+ */
1017
+ isWelcome?: boolean;
1010
1018
  /**
1011
1019
  * SSML markup to render as speech.
1012
1020
  */
@@ -1067,6 +1075,10 @@ type DialogueMessageDto = {
1067
1075
  * Toggle TTS rendering for this message
1068
1076
  */
1069
1077
  ttsEnabled?: boolean;
1078
+ /**
1079
+ * Specify if it is a welcome message
1080
+ */
1081
+ isWelcome?: boolean;
1070
1082
  };
1071
1083
  /**
1072
1084
  * role of the message provider
@@ -1330,7 +1342,7 @@ type AgentEvaluatePromptOptionsDto = {
1330
1342
  /**
1331
1343
  * LLM provider
1332
1344
  */
1333
- type LLMProvider = 'ollama' | 'openai' | 'gemini' | 'groq' | 'antrophic' | 'mistral';
1345
+ type LLMProvider = 'ollama' | 'openai' | 'gemini' | 'groq' | 'antrophic' | 'mistral' | 'azure_openai';
1334
1346
  declare const LLMProviderEnum: {
1335
1347
  readonly OLLAMA: "ollama";
1336
1348
  readonly OPENAI: "openai";
@@ -1338,6 +1350,7 @@ declare const LLMProviderEnum: {
1338
1350
  readonly GROQ: "groq";
1339
1351
  readonly ANTROPHIC: "antrophic";
1340
1352
  readonly MISTRAL: "mistral";
1353
+ readonly AZURE_OPENAI: "azure_openai";
1341
1354
  };
1342
1355
  type AgentEvaluatePromptDto = {
1343
1356
  appId: string;
@@ -1477,6 +1490,10 @@ type ImageUIContentDto = {
1477
1490
  * Unique sortable ID used to sort chunks from the same messageId
1478
1491
  */
1479
1492
  chunkId?: string;
1493
+ /**
1494
+ * Specify if it is a welcome message
1495
+ */
1496
+ isWelcome?: boolean;
1480
1497
  };
1481
1498
  type VideoContentDto = {
1482
1499
  sources: Array<string>;
@@ -1528,6 +1545,10 @@ type VideoUIContentDto = {
1528
1545
  * Unique sortable ID used to sort chunks from the same messageId
1529
1546
  */
1530
1547
  chunkId?: string;
1548
+ /**
1549
+ * Specify if it is a welcome message
1550
+ */
1551
+ isWelcome?: boolean;
1531
1552
  };
1532
1553
  type PdfContentDto = {
1533
1554
  url: string;
@@ -1572,6 +1593,10 @@ type PdfUIContentDto = {
1572
1593
  * Unique sortable ID used to sort chunks from the same messageId
1573
1594
  */
1574
1595
  chunkId?: string;
1596
+ /**
1597
+ * Specify if it is a welcome message
1598
+ */
1599
+ isWelcome?: boolean;
1575
1600
  };
1576
1601
  type WebpageContentDto = {
1577
1602
  url: string;
@@ -1616,6 +1641,10 @@ type WebpageUIContentDto = {
1616
1641
  * Unique sortable ID used to sort chunks from the same messageId
1617
1642
  */
1618
1643
  chunkId?: string;
1644
+ /**
1645
+ * Specify if it is a welcome message
1646
+ */
1647
+ isWelcome?: boolean;
1619
1648
  };
1620
1649
  type Supported3DTypes = 'glb' | 'obj' | 'fbx';
1621
1650
  declare const Supported3DTypesEnum: {
@@ -1670,6 +1699,10 @@ type ObjectUIContentDto = {
1670
1699
  * Unique sortable ID used to sort chunks from the same messageId
1671
1700
  */
1672
1701
  chunkId?: string;
1702
+ /**
1703
+ * Specify if it is a welcome message
1704
+ */
1705
+ isWelcome?: boolean;
1673
1706
  };
1674
1707
  type TextContentDto = {
1675
1708
  text: string;
@@ -1714,6 +1747,10 @@ type TextUIContentDto = {
1714
1747
  * Unique sortable ID used to sort chunks from the same messageId
1715
1748
  */
1716
1749
  chunkId?: string;
1750
+ /**
1751
+ * Specify if it is a welcome message
1752
+ */
1753
+ isWelcome?: boolean;
1717
1754
  };
1718
1755
  type QuizAnswerDto = {
1719
1756
  answerId: string;
@@ -1765,6 +1802,10 @@ type QuizUIContentDto = {
1765
1802
  * Unique sortable ID used to sort chunks from the same messageId
1766
1803
  */
1767
1804
  chunkId?: string;
1805
+ /**
1806
+ * Specify if it is a welcome message
1807
+ */
1808
+ isWelcome?: boolean;
1768
1809
  };
1769
1810
  type ClearUIContentDto = {
1770
1811
  appId: string;
@@ -1806,6 +1847,10 @@ type ClearUIContentDto = {
1806
1847
  * Unique sortable ID used to sort chunks from the same messageId
1807
1848
  */
1808
1849
  chunkId?: string;
1850
+ /**
1851
+ * Specify if it is a welcome message
1852
+ */
1853
+ isWelcome?: boolean;
1809
1854
  };
1810
1855
  type ClearScreenDto = {
1811
1856
  appId: string;
@@ -1847,6 +1892,10 @@ type ClearScreenDto = {
1847
1892
  * Unique sortable ID used to sort chunks from the same messageId
1848
1893
  */
1849
1894
  chunkId?: string;
1895
+ /**
1896
+ * Specify if it is a welcome message
1897
+ */
1898
+ isWelcome?: boolean;
1850
1899
  };
1851
1900
  type ButtonDto = {
1852
1901
  /**
@@ -1909,6 +1958,10 @@ type ButtonsUIContentDto = {
1909
1958
  * Unique sortable ID used to sort chunks from the same messageId
1910
1959
  */
1911
1960
  chunkId?: string;
1961
+ /**
1962
+ * Specify if it is a welcome message
1963
+ */
1964
+ isWelcome?: boolean;
1912
1965
  };
1913
1966
  type DialogueMessageUIContentDto = {
1914
1967
  appId: string;
@@ -1950,6 +2003,10 @@ type DialogueMessageUIContentDto = {
1950
2003
  * Unique sortable ID used to sort chunks from the same messageId
1951
2004
  */
1952
2005
  chunkId?: string;
2006
+ /**
2007
+ * Specify if it is a welcome message
2008
+ */
2009
+ isWelcome?: boolean;
1953
2010
  };
1954
2011
  type LinkContentDto = {
1955
2012
  url: string;
@@ -1995,6 +2052,10 @@ type LinkUIContentDto = {
1995
2052
  * Unique sortable ID used to sort chunks from the same messageId
1996
2053
  */
1997
2054
  chunkId?: string;
2055
+ /**
2056
+ * Specify if it is a welcome message
2057
+ */
2058
+ isWelcome?: boolean;
1998
2059
  };
1999
2060
  type HtmlContentDto = {
2000
2061
  html: string;
@@ -2039,6 +2100,10 @@ type HtmlUIContentDto = {
2039
2100
  * Unique sortable ID used to sort chunks from the same messageId
2040
2101
  */
2041
2102
  chunkId?: string;
2103
+ /**
2104
+ * Specify if it is a welcome message
2105
+ */
2106
+ isWelcome?: boolean;
2042
2107
  };
2043
2108
  type EmailContentDto = {
2044
2109
  email: string;
@@ -2084,6 +2149,10 @@ type EmailUIContentDto = {
2084
2149
  * Unique sortable ID used to sort chunks from the same messageId
2085
2150
  */
2086
2151
  chunkId?: string;
2152
+ /**
2153
+ * Specify if it is a welcome message
2154
+ */
2155
+ isWelcome?: boolean;
2087
2156
  };
2088
2157
  type SupportedAudioTypes = 'mp3' | 'wav' | 'ogg';
2089
2158
  declare const SupportedAudioTypesEnum: {
@@ -2135,6 +2204,10 @@ type BackgroundUIAudioDto = {
2135
2204
  * Unique sortable ID used to sort chunks from the same messageId
2136
2205
  */
2137
2206
  chunkId?: string;
2207
+ /**
2208
+ * Specify if it is a welcome message
2209
+ */
2210
+ isWelcome?: boolean;
2138
2211
  };
2139
2212
  type UiInteractionButtonDto = {
2140
2213
  context: Record<string, unknown>;
@@ -2186,6 +2259,10 @@ type UIContentDto = {
2186
2259
  * Unique sortable ID used to sort chunks from the same messageId
2187
2260
  */
2188
2261
  chunkId?: string;
2262
+ /**
2263
+ * Specify if it is a welcome message
2264
+ */
2265
+ isWelcome?: boolean;
2189
2266
  };
2190
2267
  type QrCodePayloadDto = {
2191
2268
  version: number;
@@ -2684,6 +2761,10 @@ type TDataText = {
2684
2761
  * Toggle TTS rendering for this message
2685
2762
  */
2686
2763
  ttsEnabled?: boolean;
2764
+ /**
2765
+ * Specify if it is a welcome message
2766
+ */
2767
+ isWelcome?: boolean;
2687
2768
  file?: Blob | File;
2688
2769
  };
2689
2770
  sampleRate: number;
@@ -3523,19 +3604,19 @@ interface PlatformAppChangedDto {
3523
3604
  interface anonymous_schema_86 {
3524
3605
  text: string;
3525
3606
  }
3526
- interface anonymous_schema_103 {
3607
+ interface anonymous_schema_104 {
3527
3608
  auth?: string;
3528
- basic?: anonymous_schema_105;
3529
- bearer?: anonymous_schema_108;
3609
+ basic?: anonymous_schema_106;
3610
+ bearer?: anonymous_schema_109;
3530
3611
  moduleId: string;
3531
3612
  url: string;
3532
3613
  headers?: Record<string, any>;
3533
3614
  }
3534
- interface anonymous_schema_105 {
3615
+ interface anonymous_schema_106 {
3535
3616
  username?: string;
3536
3617
  password: string;
3537
3618
  }
3538
- interface anonymous_schema_108 {
3619
+ interface anonymous_schema_109 {
3539
3620
  clientType?: string;
3540
3621
  clientId?: string;
3541
3622
  clientSecret?: string;
@@ -3545,17 +3626,17 @@ interface anonymous_schema_108 {
3545
3626
  tokenUrl: string;
3546
3627
  refreshUrl?: string;
3547
3628
  }
3548
- interface anonymous_schema_158 {
3629
+ interface anonymous_schema_159 {
3549
3630
  triggerOnce?: boolean;
3550
3631
  removeRecord?: boolean;
3551
3632
  enableTool?: boolean;
3552
- toolOptions?: anonymous_schema_162;
3633
+ toolOptions?: anonymous_schema_163;
3553
3634
  repositoryId?: string;
3554
3635
  list?: boolean;
3555
3636
  oncePerSession?: boolean;
3556
3637
  matchOrRemove?: boolean;
3557
3638
  }
3558
- interface anonymous_schema_162 {
3639
+ interface anonymous_schema_163 {
3559
3640
  triggerOnce?: boolean;
3560
3641
  exclusive?: boolean;
3561
3642
  }
@@ -3616,7 +3697,7 @@ interface StringInferenceValue {
3616
3697
  probability: number;
3617
3698
  value: string;
3618
3699
  }
3619
- type anonymous_schema_224 = 'start' | 'stop';
3700
+ type anonymous_schema_225 = 'start' | 'stop';
3620
3701
  interface UserCharacterizationEventDto {
3621
3702
  appId: string;
3622
3703
  clientId?: string;
@@ -3705,6 +3786,7 @@ interface DialogueSpeechToTextDto {
3705
3786
  messageId?: string;
3706
3787
  chunkId?: string;
3707
3788
  ttsEnabled?: boolean;
3789
+ isWelcome?: boolean;
3708
3790
  }
3709
3791
  interface DialogueTaskChangedDto {
3710
3792
  appId: string;
@@ -3717,10 +3799,10 @@ interface DialogueTaskChangedDto {
3717
3799
  }
3718
3800
  interface DialogueTaskProgressDto {
3719
3801
  type: TaskEventType;
3720
- task: anonymous_schema_308;
3721
- record: anonymous_schema_309;
3802
+ task: anonymous_schema_311;
3803
+ record: anonymous_schema_312;
3722
3804
  }
3723
- interface anonymous_schema_308 {
3805
+ interface anonymous_schema_311 {
3724
3806
  taskId: string;
3725
3807
  appId: string;
3726
3808
  hint?: string;
@@ -3731,9 +3813,9 @@ interface anonymous_schema_308 {
3731
3813
  intents?: TaskIntentDto[];
3732
3814
  events?: TaskEventDto[];
3733
3815
  fields: TaskFieldDto[];
3734
- options?: anonymous_schema_158;
3816
+ options?: anonymous_schema_159;
3735
3817
  }
3736
- interface anonymous_schema_309 {
3818
+ interface anonymous_schema_312 {
3737
3819
  recordId: string;
3738
3820
  taskId: string;
3739
3821
  appId: string;
@@ -3760,9 +3842,9 @@ interface DialogueTaskRecordHandlerDto {
3760
3842
  sessionId?: string;
3761
3843
  taskId: string;
3762
3844
  recordId: string;
3763
- field: anonymous_schema_330;
3845
+ field: anonymous_schema_333;
3764
3846
  }
3765
- interface anonymous_schema_330 {
3847
+ interface anonymous_schema_333 {
3766
3848
  name: string;
3767
3849
  label?: string;
3768
3850
  hint?: string;
@@ -3801,10 +3883,10 @@ interface DialogueToolsRepositoryRecordDto {
3801
3883
  ts?: string;
3802
3884
  sessionId?: string;
3803
3885
  repositoryId?: string;
3804
- options?: anonymous_schema_349;
3886
+ options?: anonymous_schema_352;
3805
3887
  tools?: any[][];
3806
3888
  }
3807
- interface anonymous_schema_349 {
3889
+ interface anonymous_schema_352 {
3808
3890
  triggerOnce?: boolean;
3809
3891
  exclusive?: boolean;
3810
3892
  }
@@ -3873,12 +3955,12 @@ interface UIAssetChangedDto {
3873
3955
  sessionId?: string;
3874
3956
  record: UIAssetDto;
3875
3957
  }
3876
- interface anonymous_schema_431 {
3958
+ interface anonymous_schema_434 {
3877
3959
  repositoryId?: string;
3878
3960
  chunks?: Record<string, any>[];
3879
3961
  additionalProperties?: Record<string, any>;
3880
3962
  }
3881
- interface anonymous_schema_436 {
3963
+ interface anonymous_schema_439 {
3882
3964
  clearScreen?: boolean;
3883
3965
  ttsEnabled?: boolean;
3884
3966
  stopSpeech?: boolean;
@@ -4395,4 +4477,4 @@ declare class SermasApiClient {
4395
4477
  login(username: any, password: any, appId?: string): Promise<LoginResponseDto>;
4396
4478
  }
4397
4479
 
4398
- export { type AccessTokenRequestDto, type ActuationDto, type ActuationEventDto, type AdvancedDatasetRecordFilterDto, type AgentChangedDto, type AgentDto, type AgentEvaluatePromptDto, type AgentEvaluatePromptFormat, AgentEvaluatePromptFormatEnum, type AgentEvaluatePromptOptionsDto, type AgentEvaluatePromptResponseDto, type AgentHeartBeatEventDto, type AgentStatus, AgentStatusEnum, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppUserDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type AvatarTTSOptions, type BackgroundAudioDto, type BackgroundUIAudioDto, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonDto, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DatasetRecordDto, type DatasetRecordFilterDto, type DialogueActor, DialogueActorEnum, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueDocumentOptionsDto, type DialogueMemoryMessageDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueSpeechToTextDto, type DialogueTaskChangedDto, type DialogueTaskDto, type DialogueTaskProgressDto, type DialogueTaskRecordChangedDto, type DialogueTaskRecordDto, type DialogueTaskRecordHandlerDto, type DialogueTextToSpeechDto, type DialogueToolNotMatchingEventDto, type DialogueToolTriggeredEventDto, type DialogueToolsRepositoryChanged, type DialogueToolsRepositoryDto, type DialogueToolsRepositoryOptionsDto, type DialogueToolsRepositoryRecordDto, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type InteractionStartTypes, InteractionStartTypesEnum, InteractionTypeEnum, type JwtTokenDto, type KeycloakCredentials, type KeycloakJwtTokenResourceAccess, type LLMProvider, LLMProviderEnum, type LLMRole, LLMRoleEnum, type LLMSettingsDto, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LogType, LogTypeEnum, Logger, type LoggerService, type LoginRequestDto, type LoginResponseDto, type MemoryMessageType, MemoryMessageTypeEnum, type ModelGender, ModelGenderEnum, type ModelType, ModelTypeEnum, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MonitoringRecordDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectContentDtoWrapper, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectDetectionRequest, type ObjectDetectionType, ObjectDetectionTypeEnum, type ObjectUIContentDto, type OperationalStateDto, type OperationalStateEventDto, type OptionSelection, type OrientationDto, type PdfContentDto, type PdfUIContentDto, type PlatformAppChangedDto, type PlatformAppClientChangedDto, type PlatformAppDto, type PlatformAppExportFilterDto, type PlatformAppModuleConfigEventDto, type PlatformModuleConfigDto, type PlatformSettingsDto, type PlatformTokenDto, type Point3D, type PoseDto, type PositionDto, type QRCodeEventDto, type QrCodeDto, type QrCodePayloadDto, type QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RagDocumentsDto, type RagWebsiteDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAnimationDto, type RepositoryAssetMetadataDto, type RepositoryAssetTypes, RepositoryAssetTypesEnum, type RepositoryAvatarDto, type RepositoryBackgroundDto, type RepositoryBackgroundMetadataDto, type RepositoryConfigDto, type RepositoryDocumentDto, type RepositoryRobotModelDto, type RobotMapDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SermasSessionDto, type SessionChangedDto, type SessionDto, type SessionProperties, type SessionSearchFilter, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type Supported3DTypes, Supported3DTypesEnum, type SupportedAudioTypes, SupportedAudioTypesEnum, type SupportedContentTypes, SupportedContentTypesEnum, type TaskEventDto, type TaskEventTriggerDto, type TaskEventType, TaskEventTypeEnum, type TaskFieldDto, type TaskIntentDto, type TaskOptionsDto, type TaskSchemaDataType, TaskSchemaDataTypeEnum, type TextContentDto, type TextUIContentDto, type ToolsParameterSchema, type ToolsParameterSchemaTypes, ToolsParameterSchemaTypesEnum, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, type UIAssetChangedDto, type UIAssetDto, type UIContentDto, type UIContentMetadataDto, type UIContentOptionsDto, type UIInteractionDTO, type UIInteractionEventDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UiInteractionButtonDto, type UpdateUserEventDto, type UpdateUserRequestDto, type UserAgeValue, type UserCharacterizationDto, type UserCharacterizationEventDto, type UserDetectionDto, type UserDetectionEventDto, type UserEmotionValue, type UserInteractionIntentionDto, type VelocityDto, type VideoContentDto, type VideoUIContentDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerChangedDto, type XRMarkerDto, type XRMarkerListRequestDto, type XROcclusionDto, type XROcclusionResponseDto, type anonymous_schema_103, type anonymous_schema_105, type anonymous_schema_108, type anonymous_schema_158, type anonymous_schema_162, type anonymous_schema_224, type anonymous_schema_308, type anonymous_schema_309, type anonymous_schema_330, type anonymous_schema_349, type anonymous_schema_431, type anonymous_schema_436, type anonymous_schema_86, sleep };
4480
+ export { type AccessTokenRequestDto, type ActuationDto, type ActuationEventDto, type AdvancedDatasetRecordFilterDto, type AgentChangedDto, type AgentDto, type AgentEvaluatePromptDto, type AgentEvaluatePromptFormat, AgentEvaluatePromptFormatEnum, type AgentEvaluatePromptOptionsDto, type AgentEvaluatePromptResponseDto, type AgentHeartBeatEventDto, type AgentStatus, AgentStatusEnum, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppUserDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type AvatarTTSOptions, type BackgroundAudioDto, type BackgroundUIAudioDto, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonDto, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DatasetRecordDto, type DatasetRecordFilterDto, type DialogueActor, DialogueActorEnum, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueDocumentOptionsDto, type DialogueMemoryMessageDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueSpeechToTextDto, type DialogueTaskChangedDto, type DialogueTaskDto, type DialogueTaskProgressDto, type DialogueTaskRecordChangedDto, type DialogueTaskRecordDto, type DialogueTaskRecordHandlerDto, type DialogueTextToSpeechDto, type DialogueToolNotMatchingEventDto, type DialogueToolTriggeredEventDto, type DialogueToolsRepositoryChanged, type DialogueToolsRepositoryDto, type DialogueToolsRepositoryOptionsDto, type DialogueToolsRepositoryRecordDto, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type InteractionStartTypes, InteractionStartTypesEnum, InteractionTypeEnum, type JwtTokenDto, type KeycloakCredentials, type KeycloakJwtTokenResourceAccess, type LLMProvider, LLMProviderEnum, type LLMRole, LLMRoleEnum, type LLMSettingsDto, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LogType, LogTypeEnum, Logger, type LoggerService, type LoginRequestDto, type LoginResponseDto, type MemoryMessageType, MemoryMessageTypeEnum, type ModelGender, ModelGenderEnum, type ModelType, ModelTypeEnum, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MonitoringRecordDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectContentDtoWrapper, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectDetectionRequest, type ObjectDetectionType, ObjectDetectionTypeEnum, type ObjectUIContentDto, type OperationalStateDto, type OperationalStateEventDto, type OptionSelection, type OrientationDto, type PdfContentDto, type PdfUIContentDto, type PlatformAppChangedDto, type PlatformAppClientChangedDto, type PlatformAppDto, type PlatformAppExportFilterDto, type PlatformAppModuleConfigEventDto, type PlatformModuleConfigDto, type PlatformSettingsDto, type PlatformTokenDto, type Point3D, type PoseDto, type PositionDto, type QRCodeEventDto, type QrCodeDto, type QrCodePayloadDto, type QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RagDocumentsDto, type RagWebsiteDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAnimationDto, type RepositoryAssetMetadataDto, type RepositoryAssetTypes, RepositoryAssetTypesEnum, type RepositoryAvatarDto, type RepositoryBackgroundDto, type RepositoryBackgroundMetadataDto, type RepositoryConfigDto, type RepositoryDocumentDto, type RepositoryRobotModelDto, type RobotMapDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SermasSessionDto, type SessionChangedDto, type SessionDto, type SessionProperties, type SessionSearchFilter, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type Supported3DTypes, Supported3DTypesEnum, type SupportedAudioTypes, SupportedAudioTypesEnum, type SupportedContentTypes, SupportedContentTypesEnum, type TaskEventDto, type TaskEventTriggerDto, type TaskEventType, TaskEventTypeEnum, type TaskFieldDto, type TaskIntentDto, type TaskOptionsDto, type TaskSchemaDataType, TaskSchemaDataTypeEnum, type TextContentDto, type TextUIContentDto, type ToolsParameterSchema, type ToolsParameterSchemaTypes, ToolsParameterSchemaTypesEnum, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, type UIAssetChangedDto, type UIAssetDto, type UIContentDto, type UIContentMetadataDto, type UIContentOptionsDto, type UIInteractionDTO, type UIInteractionEventDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UiInteractionButtonDto, type UpdateUserEventDto, type UpdateUserRequestDto, type UserAgeValue, type UserCharacterizationDto, type UserCharacterizationEventDto, type UserDetectionDto, type UserDetectionEventDto, type UserEmotionValue, type UserInteractionIntentionDto, type VelocityDto, type VideoContentDto, type VideoUIContentDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerChangedDto, type XRMarkerDto, type XRMarkerListRequestDto, type XROcclusionDto, type XROcclusionResponseDto, type anonymous_schema_104, type anonymous_schema_106, type anonymous_schema_109, type anonymous_schema_159, type anonymous_schema_163, type anonymous_schema_225, type anonymous_schema_311, type anonymous_schema_312, type anonymous_schema_333, type anonymous_schema_352, type anonymous_schema_434, type anonymous_schema_439, type anonymous_schema_86, sleep };
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var Y=Object.defineProperty;var Z=(r,e,t)=>e in r?Y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var n=(r,e,t)=>(Z(r,typeof e!="symbol"?e+"":e,t),t);import{jwtDecode as ge}from"jwt-decode";var S=class{constructor(e){this.broker=e}async tokenRequested(e,t){return this.broker.publish("app/:appId/platform/token",e,t)}async onTokenRequested(e,t){return this.broker.subscribe("app/:appId/platform/token",e,t)}async appChanged(e,t){return this.broker.publish("app/:appId/platform/app/changed/:appId",e,t)}async onAppChanged(e,t){return this.broker.subscribe("app/:appId/platform/app/changed/:appId",e,t)}async clientChanged(e,t){return this.broker.publish("app/:appId/platform/client/changed/:clientId",e,t)}async onClientChanged(e,t){return this.broker.subscribe("app/:appId/platform/client/changed/:clientId",e,t)}async appModuleChanged(e,t){return this.broker.publish("app/:appId/platform/module",e,t)}async onAppModuleChanged(e,t){return this.broker.subscribe("app/:appId/platform/module",e,t)}async record(e,t){return this.broker.publish("app/:appId/platform/monitoring",e,t)}async onRecord(e,t){return this.broker.subscribe("app/:appId/platform/monitoring",e,t)}};var x=class{constructor(e){this.broker=e}async userUpdate(e,t){return this.broker.publish("app/:appId/auth/update",e,t)}async onUserUpdate(e,t){return this.broker.subscribe("app/:appId/auth/update",e,t)}async userRegistration(e,t){return this.broker.publish("app/:appId/auth/create",e,t)}async onUserRegistration(e,t){return this.broker.subscribe("app/:appId/auth/create",e,t)}async userLogin(e,t){return this.broker.publish("app/:appId/auth/login",e,t)}async onUserLogin(e,t){return this.broker.subscribe("app/:appId/auth/login",e,t)}};var P=class{constructor(e){this.broker=e}async moduleChanged(e,t){return this.broker.publish("system/platform/module/changed/:moduleId",e,t)}async onModuleChanged(e,t){return this.broker.subscribe("system/platform/module/changed/:moduleId",e,t)}};var E=class{constructor(e){this.broker=e}async userDetected(e,t){return this.broker.publish("app/:appId/detection/user",e,t)}async onUserDetected(e,t){return this.broker.subscribe("app/:appId/detection/user",e,t)}async interactionIntention(e,t){return this.broker.publish("app/:appId/detection/interaction",e,t)}async onInteractionIntention(e,t){return this.broker.subscribe("app/:appId/detection/interaction",e,t)}async userCharacterization(e,t){return this.broker.publish("app/:appId/detection/characterization",e,t)}async onUserCharacterization(e,t){return this.broker.subscribe("app/:appId/detection/characterization",e,t)}async audioClassification(e,t){return this.broker.publish("app/:appId/detection/audio",e,t)}async onAudioClassification(e,t){return this.broker.subscribe("app/:appId/detection/audio",e,t)}async objectDetected(e,t){return this.broker.publish("app/:appId/detection/object",e,t)}async onObjectDetected(e,t){return this.broker.subscribe("app/:appId/detection/object",e,t)}async qrCodeDetected(e,t){return this.broker.publish("app/:appId/detection/qr_code",e,t)}async onQrCodeDetected(e,t){return this.broker.subscribe("app/:appId/detection/qr_code",e,t)}async noise(e,t){return this.broker.publish("app/:appId/detection/noise",e,t)}async onNoise(e,t){return this.broker.subscribe("app/:appId/detection/noise",e,t)}};var M=class{constructor(e){this.broker=e}async dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages/:sessionId",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages/:sessionId",e,t)}async agentSpeech(e,t){return this.broker.publish("app/:appId/dialogue/speech/:sessionId/:messageId/:chunkId",e,t)}async onAgentSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/speech/:sessionId/:messageId/:chunkId",e,t)}async agentStopSpeech(e,t){return this.broker.publish("app/:appId/dialogue/stop/:sessionId",e,t)}async onAgentStopSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/stop/:sessionId",e,t)}async agentPauseSpeech(e,t){return this.broker.publish("app/:appId/dialogue/pause/:sessionId",e,t)}async onAgentPauseSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/pause/:sessionId",e,t)}async agentContinueSpeech(e,t){return this.broker.publish("app/:appId/dialogue/continue/:sessionId",e,t)}async onAgentContinueSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/continue/:sessionId",e,t)}async userSpeech(e,t){return this.broker.publish("app/:appId/dialogue/user-speech/:sessionId/:chunkId",e,t)}async onUserSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/user-speech/:sessionId/:chunkId",e,t)}async taskChanged(e,t){return this.broker.publish("app/:appId/dialogue/task/changed/:taskId",e,t)}async onTaskChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/task/changed/:taskId",e,t)}async taskProgress(e,t){return this.broker.publish("app/:appId/dialogue/task/progress/:taskId",e,t)}async onTaskProgress(e,t){return this.broker.subscribe("app/:appId/dialogue/task/progress/:taskId",e,t)}async recordChanged(e,t){return this.broker.publish("app/:appId/dialogue/task/record/:taskId",e,t)}async onRecordChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/task/record/:taskId",e,t)}async fieldHandler(e,t){return this.broker.publish("app/:appId/dialogue/task/handler",e,t)}async onFieldHandler(e,t){return this.broker.subscribe("app/:appId/dialogue/task/handler",e,t)}async toolTriggered(e,t){return this.broker.publish("app/:appId/dialogue/tool/:name",e,t)}async onToolTriggered(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/:name",e,t)}async toolChanged(e,t){return this.broker.publish("app/:appId/dialogue/tool/changed/:repositoryId",e,t)}async onToolChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/changed/:repositoryId",e,t)}async toolNotMatching(e,t){return this.broker.publish("app/:appId/dialogue/tool/not-matching",e,t)}async onToolNotMatching(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/not-matching",e,t)}};var U=class{constructor(e){this.broker=e}async userInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/user",e,t)}async onUserInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/user",e,t)}async sessionChanged(e,t){return this.broker.publish("app/:appId/session/session/changed/:sessionId",e,t)}async onSessionChanged(e,t){return this.broker.subscribe("app/:appId/session/session/changed/:sessionId",e,t)}async support(e,t){return this.broker.publish("app/:appId/session/support",e,t)}async onSupport(e,t){return this.broker.subscribe("app/:appId/session/support",e,t)}async storageUpdated(e,t){return this.broker.publish("app/:appId/session/storage/:storageId",e,t)}async onStorageUpdated(e,t){return this.broker.subscribe("app/:appId/session/storage/:storageId",e,t)}async agentInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/agent",e,t)}async onAgentInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/agent",e,t)}async agentChanged(e,t){return this.broker.publish("app/:appId/session/agent/changed/:agentId",e,t)}async onAgentChanged(e,t){return this.broker.subscribe("app/:appId/session/agent/changed/:agentId",e,t)}};var O=class{constructor(e){this.broker=e}async assetChanged(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChanged(e,t){return this.broker.subscribe("app/:appId/ui/status",e,t)}async content(e,t){return this.broker.publish("app/:appId/ui/content",e,t)}async onContent(e,t){return this.broker.subscribe("app/:appId/ui/content",e,t)}async interaction(e,t){return this.broker.publish("app/:appId/ui/interaction/:moduleId",e,t)}async onInteraction(e,t){return this.broker.subscribe("app/:appId/ui/interaction/:moduleId",e,t)}};var w=class{constructor(e){this.broker=e}async detected(e,t){return this.broker.publish("app/:appId/xr/marker/detected",e,t)}async onDetected(e,t){return this.broker.subscribe("app/:appId/xr/marker/detected",e,t)}async changed(e,t){return this.broker.publish("app/:appId/xr/marker/changed/:markerId",e,t)}async onChanged(e,t){return this.broker.subscribe("app/:appId/xr/marker/changed/:markerId",e,t)}async occluded(e,t){return this.broker.publish("app/:appId/xr/occlusion",e,t)}async onOccluded(e,t){return this.broker.subscribe("app/:appId/xr/occlusion",e,t)}};var B=class{constructor(e){this.broker=e}async actuate(e,t){return this.broker.publish("app/:appId/robotics/actuate",e,t)}async onActuate(e,t){return this.broker.subscribe("app/:appId/robotics/actuate",e,t)}async move(e,t){return this.broker.publish("app/:appId/robotics/move",e,t)}async onMove(e,t){return this.broker.subscribe("app/:appId/robotics/move",e,t)}async robotStatus(e,t){return this.broker.publish("app/:appId/robotics/status",e,t)}async onRobotStatus(e,t){return this.broker.subscribe("app/:appId/robotics/status",e,t)}async initialPose(e,t){return this.broker.publish("app/:appId/robotics/initialpose",e,t)}async onInitialPose(e,t){return this.broker.subscribe("app/:appId/robotics/initialpose",e,t)}async opState(e,t){return this.broker.publish("app/:appId/robotics/opstate",e,t)}async onOpState(e,t){return this.broker.subscribe("app/:appId/robotics/opstate",e,t)}};var m=class{constructor(e){this.broker=e;n(this,"platform");n(this,"auth");n(this,"module");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new S(e),this.auth=new x(e),this.module=new P(e),this.detection=new E(e),this.dialogue=new M(e),this.session=new U(e),this.ui=new O(e),this.xr=new w(e),this.robotics=new B(e)}};import te from"mqtt";var N,z=r=>{N=r},ee=(r="logger")=>new class{format(e){return`[${r}] ${e}`}debug(e,...t){console.debug(this.format(e))}error(e,...t){console.error(this.format(e))}fatal(e,...t){console.error(this.format(e))}log(e,...t){console.info(this.format(e))}setLogLevels(e){}verbose(e,...t){console.debug(this.format(e))}warn(e,...t){console.warn(this.format(e))}},g=class{constructor(e){n(this,"logger");this.logger=N||ee(e)}debug(e,...t){this.logger.debug(e)}error(e,...t){this.logger.error(e)}fatal(e,...t){this.logger.error(e)}log(e,...t){(this.logger.info||this.logger.log).apply(this.logger,[e])}setLogLevels(e){}verbose(e,...t){this.logger.verbose(e)}warn(e,...t){this.logger.warn(e)}};var L=class r{constructor(e){this.config=e;n(this,"logger",new g(r.name));n(this,"client");n(this,"subscriptions",[])}async reconnect(){this.logger.warn("Forcing reconnection");try{await this.disconnect()}catch(e){this.logger.warn(`reconnect: disconnection error ${e.stack}`)}try{this.client=void 0,await this.connect()}catch(e){this.logger.warn(`reconnect: connection error ${e.stack}`)}}async disconnect(){if(this.client)try{await this.client.endAsync(!0)}catch(e){this.logger.warn(`Error closing broker connection: ${e.stack}`)}}setParams(e){this.config.params=e}setToken(e){this.config.username=e,this.client&&(this.logger.debug("Token updated, reconnecting"),this.client.options.username=e,this.client.reconnect())}getClient(){return this.client||null}connect(){if(!this.client){if(!this.config.username){this.logger.debug("Skip mqtt connection, missing token");return}this.logger.debug(`Connecting to ${this.config.url}`),this.client=te.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");try{for(let e of this.subscriptions)this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(e){this.logger.warn(`Subscription failed: ${e.stack}`),setTimeout(()=>this.reconnect(),1e3)}}),this.client.on("error",e=>{this.logger.error(`mqtt client error ${e.stack}`)}),this.client.on("disconnect",()=>{this.logger.warn("mqtt disconnected")}),this.client.on("reconnect",()=>{this.logger.debug("mqtt reconnecting")}),this.client.on("connect",()=>{this.logger.debug("mqtt connected")}),this.client.on("message",(e,t)=>{let o=t;try{o=JSON.parse(t.toString())}catch{}this.logger.debug(`MSG ${e}`);let s=e.indexOf("#");s>-1&&(e=e.substring(0,s));let i=this.parseTopic(e),a=p=>p==="+";this.subscriptions.forEach(p=>{if(p.type===i.type&&!(!a(p.appId)&&p.appId!==i.appId)&&!(!a(p.resource)&&p.resource!==i.resource)&&!(!a(p.scope)&&p.scope!==i.scope)){for(let d in i.context||[])if(!a(p.context[d])&&p.context[d]!==i.context[d])return;p.callback(o)}})})}}parseTopic(e){let t=e.split("/"),[o,s,i,a]=t,p=t.slice(3);return{type:o,appId:s,resource:i,scope:a,context:p}}subscribe(e,t,o){return this.connect(),e=this.replaceTopicParams(e,{...o||{}}),this.subscriptions.push({...this.parseTopic(e),topic:e,callback:t}),()=>{let s=this.subscriptions.findIndex(a=>a.topic===e&&a.callback===t);if(s===-1)return null;let i=this.subscriptions[s];this.subscriptions.splice(s,1);try{this.client.unsubscribe(i.topic,i.callback)}catch{}}}async publish(e,t,o){let s=t.byteLength!==void 0,i;s?i=t:i=JSON.stringify(t);try{e=this.replaceTopicParams(e,{...s?{}:t,...o||{}}),await this.client.publishAsync(e,i)}catch{return!1}return!0}replaceTopicParams(e,t){t={...this.config?.params||{},...t||{}};for(let o of Object.keys(t)){let s=`:${o}`,i=t[o];if(i!=null){if(typeof i=="object"&&!Array.isArray(i)){e=this.replaceTopicParams(e,i);continue}if(!(typeof i!="string"&&typeof i!="number"))for(;e.indexOf(s)>-1;)e=e.replace(s,i.toString())}}return e=e.split("/").map(o=>o[0]===":"?"+":o).join("/"),e}};var u=class{constructor(){n(this,"_fns");this._fns=[]}eject(e){let t=this._fns.indexOf(e);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(e){this._fns=[...this._fns,e]}},oe={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,RESULT:"body",TOKEN:void 0,USERNAME:void 0,VERSION:"1.0",WITH_CREDENTIALS:!1,interceptors:{request:new u,response:new u}};var h=class{constructor(e){this.config=e}};var y=class extends Error{constructor(t,o,s){super(s);n(this,"url");n(this,"status");n(this,"statusText");n(this,"body");n(this,"request");this.name="ApiError",this.url=o.url,this.status=o.status,this.statusText=o.statusText,this.body=o.body,this.request=t}};var $=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},D=class{constructor(e){n(this,"_isResolved");n(this,"_isRejected");n(this,"_isCancelled");n(this,"cancelHandlers");n(this,"promise");n(this,"_resolve");n(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((t,o)=>{this._resolve=t,this._reject=o;let s=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(p))},i=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(p))},a=p=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(p)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),e(s,i,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new $("Request aborted"))}}get isCancelled(){return this._isCancelled}};var I=r=>typeof r=="string",G=r=>I(r)&&r!=="",H=r=>r instanceof Blob,X=r=>r instanceof FormData,re=r=>{try{return btoa(r)}catch{return Buffer.from(r).toString("base64")}},se=r=>{let e=[],t=(s,i)=>{e.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(i))}`)},o=(s,i)=>{i!=null&&(Array.isArray(i)?i.forEach(a=>o(s,a)):typeof i=="object"?Object.entries(i).forEach(([a,p])=>o(`${s}[${a}]`,p)):t(s,i))};return Object.entries(r).forEach(([s,i])=>o(s,i)),e.length?`?${e.join("&")}`:""},ie=(r,e)=>{let t=r.ENCODE_PATH||encodeURI,o=e.url.replace("{api-version}",r.VERSION).replace(/{(.*?)}/g,(i,a)=>e.path?.hasOwnProperty(a)?t(String(e.path[a])):i),s=r.BASE+o;return e.query?s+se(e.query):s},ne=r=>{if(r.formData){let e=new FormData,t=(o,s)=>{I(s)||H(s)?e.append(o,s):e.append(o,JSON.stringify(s))};return Object.entries(r.formData).filter(([,o])=>o!=null).forEach(([o,s])=>{Array.isArray(s)?s.forEach(i=>t(o,i)):t(o,s)}),e}},_=async(r,e)=>typeof e=="function"?e(r):e,ae=async(r,e)=>{let[t,o,s,i]=await Promise.all([_(e,r.TOKEN),_(e,r.USERNAME),_(e,r.PASSWORD),_(e,r.HEADERS)]),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([,p])=>p!=null).reduce((p,[d,c])=>({...p,[d]:String(c)}),{});if(G(t)&&(a.Authorization=`Bearer ${t}`),G(o)&&G(s)){let p=re(`${o}:${s}`);a.Authorization=`Basic ${p}`}return e.body!==void 0&&(e.mediaType?a["Content-Type"]=e.mediaType:H(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":I(e.body)?a["Content-Type"]="text/plain":X(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},pe=r=>{if(r.body!==void 0)return r.mediaType?.includes("application/json")||r.mediaType?.includes("+json")?JSON.stringify(r.body):I(r.body)||H(r.body)||X(r.body)?r.body:JSON.stringify(r.body)},de=async(r,e,t,o,s,i,a)=>{let p=new AbortController,d={headers:i,body:o??s,method:e.method,signal:p.signal};r.WITH_CREDENTIALS&&(d.credentials=r.CREDENTIALS);for(let c of r.interceptors.request._fns)d=await c(d);return a(()=>p.abort()),await fetch(t,d)},ce=(r,e)=>{if(e){let t=r.headers.get(e);if(I(t))return t}},ue=async r=>{if(r.status!==204)try{let e=r.headers.get("Content-Type");if(e){let t=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return await r.json();if(t.some(o=>e.includes(o)))return await r.blob();if(e.includes("multipart/form-data"))return await r.formData();if(e.includes("text/"))return await r.text()}}catch(e){console.error(e)}},le=(r,e)=>{let o={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...r.errors}[e.status];if(o)throw new y(r,e,o);if(!e.ok){let s=e.status??"unknown",i=e.statusText??"unknown",a=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new y(r,e,`Generic Error: status: ${s}; status text: ${i}; body: ${a}`)}},Q=(r,e)=>new D(async(t,o,s)=>{try{let i=ie(r,e),a=ne(e),p=pe(e),d=await ae(r,e);if(!s.isCancelled){let c=await de(r,e,i,p,a,d,s);for(let K of r.interceptors.response._fns)c=await K(c);let W=await ue(c),V=ce(c,e.responseHeader),F={url:i,ok:c.ok,status:c.status,statusText:c.statusText,body:V??W};le(e,F),t(F.body)}}catch(i){o(i)}});var j=class extends h{constructor(e){super(e)}request(e){return Q(this.config,e)}};var R=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:o}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:o}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:o}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}};var b=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:t,mediaType:"application/json"})}refreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e){let{requestBody:t,userId:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:o},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){let{userId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:t},errors:{401:"Not authorized"}})}saveUser(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:t,mediaType:"application/json"})}importUsers(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/import",body:t,mediaType:"application/json"})}};var f=class{constructor(e){this.httpRequest=e}objectDetection(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/object-detection",body:t,mediaType:"application/json"})}detectionControllerSentimentAnalysis(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:t,mediaType:"application/json"})}detectionControllerInteractionIntention(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:t,mediaType:"application/json"})}detectionControllerSendFrame(e){let{appId:t,cameraId:o,formData:s}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:t,cameraId:o},formData:s,mediaType:"multipart/form-data"})}detectionControllerServe(e){let{appId:t,cameraId:o,overlay:s}=e;return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:t,cameraId:o},query:{overlay:s}})}};var T=class{constructor(e){this.httpRequest=e}save(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}import(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}importWebsite(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document/website",body:t,mediaType:"application/json"})}removeAll(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}/all",path:{appId:t}})}remove(e){let{appId:t,documentId:o}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:t},query:{documentId:o}})}speak(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:t,mediaType:"application/json"})}text(e){let{appId:t,formData:o,sampleRate:s,sessionId:i}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:t,sessionId:i},query:{sampleRate:s},formData:o,mediaType:"multipart/form-data"})}chatMessage(e){let{appId:t,requestBody:o,sessionId:s}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:t,sessionId:s},body:o,mediaType:"application/json"})}stopAgentSpeech(e){let{appId:t,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:t,sessionId:o}})}listModels(){return this.httpRequest.request({method:"GET",url:"/api/dialogue/speech/models"})}getChatHistory(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/dialogue/memory/{sessionId}",path:{sessionId:t}})}nextStep(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tasks/next-step",body:t,mediaType:"application/json"})}setTools(e){let{repositoryId:t,requestBody:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t},body:o,mediaType:"application/json"})}addTools(e){let{repositoryId:t,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t},body:o,mediaType:"application/json"})}removeRepository(e){let{repositoryId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t}})}};var q=class{constructor(e){this.httpRequest=e}getUserSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics/user"})}getSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics"})}getClientAccessToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:t,mediaType:"application/json"})}getClientAccessToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:t,mediaType:"application/json"})}getClientRefreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:t,mediaType:"application/json"})}getClientRefreshToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:t,mediaType:"application/json"})}getRepositoryDefaults(){return this.httpRequest.request({method:"GET",url:"/api/app/repository/defaults"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app",body:t,mediaType:"application/json"})}updateApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/app",body:t,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:t},body:o,mediaType:"application/json"})}updateAppSettings(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:t},body:o,mediaType:"application/json"})}getAppRepository(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:t}})}getAppRepositoryRobots(e){let{appId:t,name:o}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:t},query:{name:o}})}getAppRepositoryAvatars(e){let{appId:t,name:o}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:t},query:{name:o}})}getAppRepositoryBackgrounds(e){let{appId:t,name:o}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:t},query:{name:o}})}readApp(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:t}})}removeApp(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:t}})}importApps(e){let{requestBody:t,skipClients:o}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:o},body:t,mediaType:"application/json"})}exportApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:t,mediaType:"application/json"})}removeApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:t,mediaType:"application/json"})}createClient(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:t},body:o,mediaType:"application/json"})}readClient(e){let{appId:t,clientId:o}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:t,clientId:o}})}removeClient(e){let{appId:t,clientId:o}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:o,appId:t}})}listTopics(e){let{appId:t,clientId:o}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:t,clientId:o}})}saveAppModule(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:t},body:o,mediaType:"application/json"})}getAppModule(e){let{appId:t,moduleId:o}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:o}})}removeAppModule(e){let{appId:t,moduleId:o}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:o}})}savePlatformModule(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:t,mediaType:"application/json"})}refreshPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}getPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}removePlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}monitoringAdd(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring",body:t,mediaType:"application/json"})}monitoringSearch(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring/search",body:t,mediaType:"application/json"})}monitoringAdvancedSearch(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring/advanced-search",body:t,mediaType:"application/json"})}};var v=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:o}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:o}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:o}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){let{spaceId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:t}})}navigationControllerGetById(e){let{spaceId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:t}})}navigationControllerGetStatus(e){let{appId:t,robotId:o}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:t,robotId:o}})}};var C=class{constructor(e){this.httpRequest=e}getUserSession(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/user/{appId}",path:{appId:t}})}search(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"POST",url:"/api/session/search/{appId}",path:{appId:t},body:o,mediaType:"application/json"})}readSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:t}})}deleteSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:t}})}createSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session",body:t,mediaType:"application/json"})}updateSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/session",body:t,mediaType:"application/json"})}support(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/support",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:t,mediaType:"application/json"})}findRecords(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:t,mediaType:"application/json"})}getRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:t}})}deleteRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:t}})}agentUpdate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:t,mediaType:"application/json"})}prompt(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent/prompt",body:t,mediaType:"application/json"})}};var A=class{constructor(e){this.httpRequest=e}notifyInteraction(e){let{appId:t,moduleId:o,requestBody:s}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:t,moduleId:o},body:s,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/content/{appId}",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}generateQrCode(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/qrcode/generate",body:t,mediaType:"application/json"})}uiModelControllerMapBlendShapes(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}getAsset(e){let{appId:t,assetId:o,type:s}=e;return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}/{type}/{assetId}",path:{appId:t,type:s,assetId:o}})}saveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/asset",formData:t,mediaType:"multipart/form-data"})}adminSaveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/admin/asset",formData:t,mediaType:"multipart/form-data"})}};var k=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:t,mediaType:"application/json"})}xrMarkerControllerSaveMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:t,mediaType:"application/json"})}xrMarkerControllerDeleteMarker(e){let{markerId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrMarkerControllerGetMarkerQrCode(e){let{markerId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var l=class{constructor(e,t=j){n(this,"agent");n(this,"authentication");n(this,"detection");n(this,"dialogue");n(this,"platform");n(this,"robotics");n(this,"session");n(this,"ui");n(this,"xr");n(this,"request");this.request=new t({BASE:e?.BASE??"",VERSION:e?.VERSION??"1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH,interceptors:{request:new u,response:new u}}),this.agent=new R(this.request),this.authentication=new b(this.request),this.detection=new f(this.request),this.dialogue=new T(this.request),this.platform=new q(this.request),this.robotics=new v(this.request),this.session=new C(this.request),this.ui=new A(this.request),this.xr=new k(this.request)}};var Kt=(r=1e3)=>new Promise(e=>setTimeout(()=>e(),r)),ye="http://localhost:8080",J=class{constructor(e){this.config=e;n(this,"logger");n(this,"api");n(this,"events");n(this,"broker");n(this,"apiUrl");n(this,"mqttUrl");n(this,"refreshTimeout");n(this,"ready",!1);n(this,"jwt");n(this,"params",{});e.logger&&z(e.logger),this.logger=new g("SermasApiClient");let t=e.baseURL||ye;this.apiUrl=`${t}`;let o=new URL(this.apiUrl),s=o.protocol.startsWith("https");this.mqttUrl=`ws${s?"s":""}://${o.hostname}${o.port?":"+o.port:""}/mqtt`,this.api=new l({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new L({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new m(this.broker)}getBroker(){return this.broker||null}async close(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),await this.broker.disconnect()}init(e=!1){if(e&&(this.ready=!1),!this.ready){if(!this.config.access_token){this.logger.debug("Access token not set, skip client init");return}this.params={appId:this.config.appId},this.broker.setParams(this.params),this.broker.setToken(this.config.access_token),this.watchToken(),this.ready=!0}}watchToken(){let e=ge(this.config.access_token);this.jwt=e,this.config.clientId=this.config.clientId||e.aud;let o=new Date(e.exp*1e3).getTime()-Date.now()-30*1e3;this.logger.verbose(`Token expires in ${Math.round(o/1e3/60/60)}min`),this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>this.refreshToken(),o)}async refreshToken(){this.logger.verbose("Refreshing token");let e;try{e=await this.api.platform.getClientRefreshToken({requestBody:{refreshToken:this.config.refresh_token,appId:this.config.appId,clientId:this.config.clientId,clientSecret:this.config.clientSecret}})}catch(t){this.logger.error(`Refresh token failed: ${t.stack}`);return}if(!e){this.logger.warn("Failed to refresh token, no response");return}return this.config.access_token=e.access_token,this.config.refresh_token=e.refresh_token,this.init(!0),e}async loadToken(e,t,o){let s=new l({BASE:this.apiUrl});this.config.appId=o||this.config.appId;let i=await s.platform.getClientAccessToken({requestBody:{clientId:e,clientSecret:t,appId:this.config.appId}});return this.config.clientId=e,this.config.clientSecret=t,this.config.appId=o||this.config.appId,this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}setToken(e,t,o){if(typeof e!="string"){let s=e;e=s.access_token,t=s.refresh_token,o=s.appId}this.config.access_token=e,this.config.refresh_token=t,o!==void 0&&(this.config.appId=o),this.init(!0)}async login(e,t,o){let s=new l({BASE:this.apiUrl});this.config.appId=o||this.config.appId;let i=await s.authentication.login({requestBody:{username:e,password:t,appId:this.config.appId}});return this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}};export{g as Logger,J as SermasApiClient,Kt as sleep};
1
+ var Y=Object.defineProperty;var Z=(r,e,t)=>e in r?Y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var n=(r,e,t)=>(Z(r,typeof e!="symbol"?e+"":e,t),t);import{jwtDecode as ge}from"jwt-decode";var k=class{constructor(e){this.broker=e}async tokenRequested(e,t){return this.broker.publish("app/:appId/platform/token",e,t)}async onTokenRequested(e,t){return this.broker.subscribe("app/:appId/platform/token",e,t)}async appChanged(e,t){return this.broker.publish("app/:appId/platform/app/changed/:appId",e,t)}async onAppChanged(e,t){return this.broker.subscribe("app/:appId/platform/app/changed/:appId",e,t)}async clientChanged(e,t){return this.broker.publish("app/:appId/platform/client/changed/:clientId",e,t)}async onClientChanged(e,t){return this.broker.subscribe("app/:appId/platform/client/changed/:clientId",e,t)}async appModuleChanged(e,t){return this.broker.publish("app/:appId/platform/module",e,t)}async onAppModuleChanged(e,t){return this.broker.subscribe("app/:appId/platform/module",e,t)}async record(e,t){return this.broker.publish("app/:appId/platform/monitoring",e,t)}async onRecord(e,t){return this.broker.subscribe("app/:appId/platform/monitoring",e,t)}};var x=class{constructor(e){this.broker=e}async userUpdate(e,t){return this.broker.publish("app/:appId/auth/update",e,t)}async onUserUpdate(e,t){return this.broker.subscribe("app/:appId/auth/update",e,t)}async userRegistration(e,t){return this.broker.publish("app/:appId/auth/create",e,t)}async onUserRegistration(e,t){return this.broker.subscribe("app/:appId/auth/create",e,t)}async userLogin(e,t){return this.broker.publish("app/:appId/auth/login",e,t)}async onUserLogin(e,t){return this.broker.subscribe("app/:appId/auth/login",e,t)}};var P=class{constructor(e){this.broker=e}async moduleChanged(e,t){return this.broker.publish("system/platform/module/changed/:moduleId",e,t)}async onModuleChanged(e,t){return this.broker.subscribe("system/platform/module/changed/:moduleId",e,t)}};var E=class{constructor(e){this.broker=e}async userDetected(e,t){return this.broker.publish("app/:appId/detection/user",e,t)}async onUserDetected(e,t){return this.broker.subscribe("app/:appId/detection/user",e,t)}async interactionIntention(e,t){return this.broker.publish("app/:appId/detection/interaction",e,t)}async onInteractionIntention(e,t){return this.broker.subscribe("app/:appId/detection/interaction",e,t)}async userCharacterization(e,t){return this.broker.publish("app/:appId/detection/characterization",e,t)}async onUserCharacterization(e,t){return this.broker.subscribe("app/:appId/detection/characterization",e,t)}async audioClassification(e,t){return this.broker.publish("app/:appId/detection/audio",e,t)}async onAudioClassification(e,t){return this.broker.subscribe("app/:appId/detection/audio",e,t)}async objectDetected(e,t){return this.broker.publish("app/:appId/detection/object",e,t)}async onObjectDetected(e,t){return this.broker.subscribe("app/:appId/detection/object",e,t)}async qrCodeDetected(e,t){return this.broker.publish("app/:appId/detection/qr_code",e,t)}async onQrCodeDetected(e,t){return this.broker.subscribe("app/:appId/detection/qr_code",e,t)}async noise(e,t){return this.broker.publish("app/:appId/detection/noise",e,t)}async onNoise(e,t){return this.broker.subscribe("app/:appId/detection/noise",e,t)}};var M=class{constructor(e){this.broker=e}async dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages/:sessionId",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages/:sessionId",e,t)}async agentSpeech(e,t){return this.broker.publish("app/:appId/dialogue/speech/:sessionId/:messageId/:chunkId",e,t)}async onAgentSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/speech/:sessionId/:messageId/:chunkId",e,t)}async agentStopSpeech(e,t){return this.broker.publish("app/:appId/dialogue/stop/:sessionId",e,t)}async onAgentStopSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/stop/:sessionId",e,t)}async agentPauseSpeech(e,t){return this.broker.publish("app/:appId/dialogue/pause/:sessionId",e,t)}async onAgentPauseSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/pause/:sessionId",e,t)}async agentContinueSpeech(e,t){return this.broker.publish("app/:appId/dialogue/continue/:sessionId",e,t)}async onAgentContinueSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/continue/:sessionId",e,t)}async userSpeech(e,t){return this.broker.publish("app/:appId/dialogue/user-speech/:sessionId/:chunkId",e,t)}async onUserSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/user-speech/:sessionId/:chunkId",e,t)}async taskChanged(e,t){return this.broker.publish("app/:appId/dialogue/task/changed/:taskId",e,t)}async onTaskChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/task/changed/:taskId",e,t)}async taskProgress(e,t){return this.broker.publish("app/:appId/dialogue/task/progress/:taskId",e,t)}async onTaskProgress(e,t){return this.broker.subscribe("app/:appId/dialogue/task/progress/:taskId",e,t)}async recordChanged(e,t){return this.broker.publish("app/:appId/dialogue/task/record/:taskId",e,t)}async onRecordChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/task/record/:taskId",e,t)}async fieldHandler(e,t){return this.broker.publish("app/:appId/dialogue/task/handler",e,t)}async onFieldHandler(e,t){return this.broker.subscribe("app/:appId/dialogue/task/handler",e,t)}async toolTriggered(e,t){return this.broker.publish("app/:appId/dialogue/tool/:name",e,t)}async onToolTriggered(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/:name",e,t)}async toolChanged(e,t){return this.broker.publish("app/:appId/dialogue/tool/changed/:repositoryId",e,t)}async onToolChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/changed/:repositoryId",e,t)}async toolNotMatching(e,t){return this.broker.publish("app/:appId/dialogue/tool/not-matching",e,t)}async onToolNotMatching(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/not-matching",e,t)}};var U=class{constructor(e){this.broker=e}async userInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/user",e,t)}async onUserInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/user",e,t)}async sessionChanged(e,t){return this.broker.publish("app/:appId/session/session/changed/:sessionId",e,t)}async onSessionChanged(e,t){return this.broker.subscribe("app/:appId/session/session/changed/:sessionId",e,t)}async support(e,t){return this.broker.publish("app/:appId/session/support",e,t)}async onSupport(e,t){return this.broker.subscribe("app/:appId/session/support",e,t)}async storageUpdated(e,t){return this.broker.publish("app/:appId/session/storage/:storageId",e,t)}async onStorageUpdated(e,t){return this.broker.subscribe("app/:appId/session/storage/:storageId",e,t)}async agentInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/agent",e,t)}async onAgentInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/agent",e,t)}async agentChanged(e,t){return this.broker.publish("app/:appId/session/agent/changed/:agentId",e,t)}async onAgentChanged(e,t){return this.broker.subscribe("app/:appId/session/agent/changed/:agentId",e,t)}};var O=class{constructor(e){this.broker=e}async assetChanged(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChanged(e,t){return this.broker.subscribe("app/:appId/ui/status",e,t)}async content(e,t){return this.broker.publish("app/:appId/ui/content",e,t)}async onContent(e,t){return this.broker.subscribe("app/:appId/ui/content",e,t)}async interaction(e,t){return this.broker.publish("app/:appId/ui/interaction/:moduleId",e,t)}async onInteraction(e,t){return this.broker.subscribe("app/:appId/ui/interaction/:moduleId",e,t)}};var w=class{constructor(e){this.broker=e}async detected(e,t){return this.broker.publish("app/:appId/xr/marker/detected",e,t)}async onDetected(e,t){return this.broker.subscribe("app/:appId/xr/marker/detected",e,t)}async changed(e,t){return this.broker.publish("app/:appId/xr/marker/changed/:markerId",e,t)}async onChanged(e,t){return this.broker.subscribe("app/:appId/xr/marker/changed/:markerId",e,t)}async occluded(e,t){return this.broker.publish("app/:appId/xr/occlusion",e,t)}async onOccluded(e,t){return this.broker.subscribe("app/:appId/xr/occlusion",e,t)}};var B=class{constructor(e){this.broker=e}async actuate(e,t){return this.broker.publish("app/:appId/robotics/actuate",e,t)}async onActuate(e,t){return this.broker.subscribe("app/:appId/robotics/actuate",e,t)}async move(e,t){return this.broker.publish("app/:appId/robotics/move",e,t)}async onMove(e,t){return this.broker.subscribe("app/:appId/robotics/move",e,t)}async robotStatus(e,t){return this.broker.publish("app/:appId/robotics/status",e,t)}async onRobotStatus(e,t){return this.broker.subscribe("app/:appId/robotics/status",e,t)}async initialPose(e,t){return this.broker.publish("app/:appId/robotics/initialpose",e,t)}async onInitialPose(e,t){return this.broker.subscribe("app/:appId/robotics/initialpose",e,t)}async opState(e,t){return this.broker.publish("app/:appId/robotics/opstate",e,t)}async onOpState(e,t){return this.broker.subscribe("app/:appId/robotics/opstate",e,t)}};var m=class{constructor(e){this.broker=e;n(this,"platform");n(this,"auth");n(this,"module");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new k(e),this.auth=new x(e),this.module=new P(e),this.detection=new E(e),this.dialogue=new M(e),this.session=new U(e),this.ui=new O(e),this.xr=new w(e),this.robotics=new B(e)}};import te from"mqtt";var N,F=r=>{N=r},ee=(r="logger")=>new class{format(e){return`[${r}] ${e}`}debug(e,...t){console.debug(this.format(e))}error(e,...t){console.error(this.format(e))}fatal(e,...t){console.error(this.format(e))}log(e,...t){console.info(this.format(e))}setLogLevels(e){}verbose(e,...t){console.debug(this.format(e))}warn(e,...t){console.warn(this.format(e))}},g=class{constructor(e){n(this,"logger");this.logger=N||ee(e)}debug(e,...t){this.logger.debug(e)}error(e,...t){this.logger.error(e)}fatal(e,...t){this.logger.error(e)}log(e,...t){(this.logger.info||this.logger.log).apply(this.logger,[e])}setLogLevels(e){}verbose(e,...t){this.logger.verbose(e)}warn(e,...t){this.logger.warn(e)}};var L=class r{constructor(e){this.config=e;n(this,"logger",new g(r.name));n(this,"client");n(this,"subscriptions",[])}async reconnect(){this.logger.warn("Forcing reconnection");try{await this.disconnect()}catch(e){this.logger.warn(`reconnect: disconnection error ${e.stack}`)}try{this.client=void 0,await this.connect()}catch(e){this.logger.warn(`reconnect: connection error ${e.stack}`)}}async disconnect(){if(this.client)try{await this.client.endAsync(!0)}catch(e){this.logger.warn(`Error closing broker connection: ${e.stack}`)}}setParams(e){this.config.params=e}setToken(e){this.config.username=e,this.client&&(this.logger.debug("Token updated, reconnecting"),this.client.options.username=e,this.client.reconnect())}getClient(){return this.client||null}connect(){if(!this.client){if(!this.config.username){this.logger.debug("Skip mqtt connection, missing token");return}this.logger.debug(`Connecting to ${this.config.url}`),this.client=te.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");try{for(let e of this.subscriptions)this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(e){this.logger.warn(`Subscription failed: ${e.stack}`),setTimeout(()=>this.reconnect(),1e3)}}),this.client.on("error",e=>{this.logger.error(`mqtt client error ${e.stack}`)}),this.client.on("disconnect",()=>{this.logger.warn("mqtt disconnected")}),this.client.on("reconnect",()=>{this.logger.debug("mqtt reconnecting")}),this.client.on("connect",()=>{this.logger.debug("mqtt connected")}),this.client.on("message",(e,t)=>{let o=t;try{o=JSON.parse(t.toString())}catch{}this.logger.debug(`MSG ${e}`);let s=e.indexOf("#");s>-1&&(e=e.substring(0,s));let i=this.parseTopic(e),a=p=>p==="+";this.subscriptions.forEach(p=>{if(p.type===i.type&&!(!a(p.appId)&&p.appId!==i.appId)&&!(!a(p.resource)&&p.resource!==i.resource)&&!(!a(p.scope)&&p.scope!==i.scope)){for(let d in i.context||[])if(!a(p.context[d])&&p.context[d]!==i.context[d])return;p.callback(o)}})})}}parseTopic(e){let t=e.split("/"),[o,s,i,a]=t,p=t.slice(3);return{type:o,appId:s,resource:i,scope:a,context:p}}subscribe(e,t,o){return this.connect(),e=this.replaceTopicParams(e,{...o||{}}),this.subscriptions.push({...this.parseTopic(e),topic:e,callback:t}),()=>{let s=this.subscriptions.findIndex(a=>a.topic===e&&a.callback===t);if(s===-1)return null;let i=this.subscriptions[s];this.subscriptions.splice(s,1);try{this.client.unsubscribe(i.topic,i.callback)}catch{}}}async publish(e,t,o){let s=t.byteLength!==void 0,i;s?i=t:i=JSON.stringify(t);try{e=this.replaceTopicParams(e,{...s?{}:t,...o||{}}),await this.client.publishAsync(e,i)}catch{return!1}return!0}replaceTopicParams(e,t){t={...this.config?.params||{},...t||{}};for(let o of Object.keys(t)){let s=`:${o}`,i=t[o];if(i!=null){if(typeof i=="object"&&!Array.isArray(i)){e=this.replaceTopicParams(e,i);continue}if(!(typeof i!="string"&&typeof i!="number"))for(;e.indexOf(s)>-1;)e=e.replace(s,i.toString())}}return e=e.split("/").map(o=>o[0]===":"?"+":o).join("/"),e}};var u=class{constructor(){n(this,"_fns");this._fns=[]}eject(e){let t=this._fns.indexOf(e);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(e){this._fns=[...this._fns,e]}},oe={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,RESULT:"body",TOKEN:void 0,USERNAME:void 0,VERSION:"1.0",WITH_CREDENTIALS:!1,interceptors:{request:new u,response:new u}};var h=class{constructor(e){this.config=e}};var y=class extends Error{constructor(t,o,s){super(s);n(this,"url");n(this,"status");n(this,"statusText");n(this,"body");n(this,"request");this.name="ApiError",this.url=o.url,this.status=o.status,this.statusText=o.statusText,this.body=o.body,this.request=t}};var $=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},D=class{constructor(e){n(this,"_isResolved");n(this,"_isRejected");n(this,"_isCancelled");n(this,"cancelHandlers");n(this,"promise");n(this,"_resolve");n(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((t,o)=>{this._resolve=t,this._reject=o;let s=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(p))},i=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(p))},a=p=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(p)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),e(s,i,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new $("Request aborted"))}}get isCancelled(){return this._isCancelled}};var I=r=>typeof r=="string",G=r=>I(r)&&r!=="",H=r=>r instanceof Blob,z=r=>r instanceof FormData,re=r=>{try{return btoa(r)}catch{return Buffer.from(r).toString("base64")}},se=r=>{let e=[],t=(s,i)=>{e.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(i))}`)},o=(s,i)=>{i!=null&&(Array.isArray(i)?i.forEach(a=>o(s,a)):typeof i=="object"?Object.entries(i).forEach(([a,p])=>o(`${s}[${a}]`,p)):t(s,i))};return Object.entries(r).forEach(([s,i])=>o(s,i)),e.length?`?${e.join("&")}`:""},ie=(r,e)=>{let t=r.ENCODE_PATH||encodeURI,o=e.url.replace("{api-version}",r.VERSION).replace(/{(.*?)}/g,(i,a)=>e.path?.hasOwnProperty(a)?t(String(e.path[a])):i),s=r.BASE+o;return e.query?s+se(e.query):s},ne=r=>{if(r.formData){let e=new FormData,t=(o,s)=>{I(s)||H(s)?e.append(o,s):e.append(o,JSON.stringify(s))};return Object.entries(r.formData).filter(([,o])=>o!=null).forEach(([o,s])=>{Array.isArray(s)?s.forEach(i=>t(o,i)):t(o,s)}),e}},_=async(r,e)=>typeof e=="function"?e(r):e,ae=async(r,e)=>{let[t,o,s,i]=await Promise.all([_(e,r.TOKEN),_(e,r.USERNAME),_(e,r.PASSWORD),_(e,r.HEADERS)]),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([,p])=>p!=null).reduce((p,[d,c])=>({...p,[d]:String(c)}),{});if(G(t)&&(a.Authorization=`Bearer ${t}`),G(o)&&G(s)){let p=re(`${o}:${s}`);a.Authorization=`Basic ${p}`}return e.body!==void 0&&(e.mediaType?a["Content-Type"]=e.mediaType:H(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":I(e.body)?a["Content-Type"]="text/plain":z(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},pe=r=>{if(r.body!==void 0)return r.mediaType?.includes("application/json")||r.mediaType?.includes("+json")?JSON.stringify(r.body):I(r.body)||H(r.body)||z(r.body)?r.body:JSON.stringify(r.body)},de=async(r,e,t,o,s,i,a)=>{let p=new AbortController,d={headers:i,body:o??s,method:e.method,signal:p.signal};r.WITH_CREDENTIALS&&(d.credentials=r.CREDENTIALS);for(let c of r.interceptors.request._fns)d=await c(d);return a(()=>p.abort()),await fetch(t,d)},ce=(r,e)=>{if(e){let t=r.headers.get(e);if(I(t))return t}},ue=async r=>{if(r.status!==204)try{let e=r.headers.get("Content-Type");if(e){let t=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return await r.json();if(t.some(o=>e.includes(o)))return await r.blob();if(e.includes("multipart/form-data"))return await r.formData();if(e.includes("text/"))return await r.text()}}catch(e){console.error(e)}},le=(r,e)=>{let o={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...r.errors}[e.status];if(o)throw new y(r,e,o);if(!e.ok){let s=e.status??"unknown",i=e.statusText??"unknown",a=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new y(r,e,`Generic Error: status: ${s}; status text: ${i}; body: ${a}`)}},X=(r,e)=>new D(async(t,o,s)=>{try{let i=ie(r,e),a=ne(e),p=pe(e),d=await ae(r,e);if(!s.isCancelled){let c=await de(r,e,i,p,a,d,s);for(let K of r.interceptors.response._fns)c=await K(c);let J=await ue(c),V=ce(c,e.responseHeader),W={url:i,ok:c.ok,status:c.status,statusText:c.statusText,body:V??J};le(e,W),t(W.body)}}catch(i){o(i)}});var j=class extends h{constructor(e){super(e)}request(e){return X(this.config,e)}};var R=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:o}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:o}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:o}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}};var b=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:t,mediaType:"application/json"})}refreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e){let{requestBody:t,userId:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:o},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){let{userId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:t},errors:{401:"Not authorized"}})}saveUser(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:t,mediaType:"application/json"})}importUsers(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/import",body:t,mediaType:"application/json"})}};var f=class{constructor(e){this.httpRequest=e}objectDetection(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/object-detection",body:t,mediaType:"application/json"})}detectionControllerSentimentAnalysis(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:t,mediaType:"application/json"})}detectionControllerInteractionIntention(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:t,mediaType:"application/json"})}detectionControllerSendFrame(e){let{appId:t,cameraId:o,formData:s}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:t,cameraId:o},formData:s,mediaType:"multipart/form-data"})}detectionControllerServe(e){let{appId:t,cameraId:o,overlay:s}=e;return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:t,cameraId:o},query:{overlay:s}})}};var T=class{constructor(e){this.httpRequest=e}save(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}import(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}importWebsite(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document/website",body:t,mediaType:"application/json"})}removeAll(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}/all",path:{appId:t}})}remove(e){let{appId:t,documentId:o}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:t},query:{documentId:o}})}speak(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:t,mediaType:"application/json"})}text(e){let{appId:t,formData:o,sampleRate:s,sessionId:i}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:t,sessionId:i},query:{sampleRate:s},formData:o,mediaType:"multipart/form-data"})}chatMessage(e){let{appId:t,requestBody:o,sessionId:s}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:t,sessionId:s},body:o,mediaType:"application/json"})}stopAgentSpeech(e){let{appId:t,sessionId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:t,sessionId:o}})}listModels(){return this.httpRequest.request({method:"GET",url:"/api/dialogue/speech/models"})}getChatHistory(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/dialogue/memory/{sessionId}",path:{sessionId:t}})}nextStep(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tasks/next-step",body:t,mediaType:"application/json"})}setTools(e){let{repositoryId:t,requestBody:o}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t},body:o,mediaType:"application/json"})}addTools(e){let{repositoryId:t,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t},body:o,mediaType:"application/json"})}removeRepository(e){let{repositoryId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t}})}};var q=class{constructor(e){this.httpRequest=e}getUserSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics/user"})}getSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics"})}getClientAccessToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:t,mediaType:"application/json"})}getClientAccessToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:t,mediaType:"application/json"})}getClientRefreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:t,mediaType:"application/json"})}getClientRefreshToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:t,mediaType:"application/json"})}getRepositoryDefaults(){return this.httpRequest.request({method:"GET",url:"/api/app/repository/defaults"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app",body:t,mediaType:"application/json"})}updateApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/app",body:t,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:t},body:o,mediaType:"application/json"})}updateAppSettings(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:t},body:o,mediaType:"application/json"})}getAppRepository(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:t}})}getAppRepositoryRobots(e){let{appId:t,name:o}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:t},query:{name:o}})}getAppRepositoryAvatars(e){let{appId:t,name:o}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:t},query:{name:o}})}getAppRepositoryBackgrounds(e){let{appId:t,name:o}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:t},query:{name:o}})}readApp(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:t}})}removeApp(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:t}})}importApps(e){let{requestBody:t,skipClients:o}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:o},body:t,mediaType:"application/json"})}exportApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:t,mediaType:"application/json"})}removeApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:t,mediaType:"application/json"})}createClient(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:t},body:o,mediaType:"application/json"})}readClient(e){let{appId:t,clientId:o}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:t,clientId:o}})}removeClient(e){let{appId:t,clientId:o}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:o,appId:t}})}listTopics(e){let{appId:t,clientId:o}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:t,clientId:o}})}saveAppModule(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:t},body:o,mediaType:"application/json"})}getAppModule(e){let{appId:t,moduleId:o}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:o}})}removeAppModule(e){let{appId:t,moduleId:o}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:o}})}savePlatformModule(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:t,mediaType:"application/json"})}refreshPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}getPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}removePlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}monitoringAdd(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring",body:t,mediaType:"application/json"})}monitoringSearch(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring/search",body:t,mediaType:"application/json"})}monitoringAdvancedSearch(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring/advanced-search",body:t,mediaType:"application/json"})}};var v=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:o}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:o}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:o}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:o}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){let{spaceId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:t}})}navigationControllerGetById(e){let{spaceId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:t}})}navigationControllerGetStatus(e){let{appId:t,robotId:o}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:t,robotId:o}})}};var C=class{constructor(e){this.httpRequest=e}getUserSession(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/user/{appId}",path:{appId:t}})}search(e){let{appId:t,requestBody:o}=e;return this.httpRequest.request({method:"POST",url:"/api/session/search/{appId}",path:{appId:t},body:o,mediaType:"application/json"})}readSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:t}})}deleteSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:t}})}createSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session",body:t,mediaType:"application/json"})}updateSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/session",body:t,mediaType:"application/json"})}support(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/support",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:t,mediaType:"application/json"})}findRecords(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:t,mediaType:"application/json"})}getRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:t}})}deleteRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:t}})}agentUpdate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:t,mediaType:"application/json"})}prompt(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent/prompt",body:t,mediaType:"application/json"})}};var A=class{constructor(e){this.httpRequest=e}notifyInteraction(e){let{appId:t,moduleId:o,requestBody:s}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:t,moduleId:o},body:s,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/content/{appId}",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}generateQrCode(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/qrcode/generate",body:t,mediaType:"application/json"})}uiModelControllerMapBlendShapes(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}getAsset(e){let{appId:t,assetId:o,type:s}=e;return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}/{type}/{assetId}",path:{appId:t,type:s,assetId:o}})}saveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/asset",formData:t,mediaType:"multipart/form-data"})}adminSaveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/admin/asset",formData:t,mediaType:"multipart/form-data"})}};var S=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:t,mediaType:"application/json"})}xrMarkerControllerSaveMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:t,mediaType:"application/json"})}xrMarkerControllerDeleteMarker(e){let{markerId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrMarkerControllerGetMarkerQrCode(e){let{markerId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var l=class{constructor(e,t=j){n(this,"agent");n(this,"authentication");n(this,"detection");n(this,"dialogue");n(this,"platform");n(this,"robotics");n(this,"session");n(this,"ui");n(this,"xr");n(this,"request");this.request=new t({BASE:e?.BASE??"",VERSION:e?.VERSION??"1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH,interceptors:{request:new u,response:new u}}),this.agent=new R(this.request),this.authentication=new b(this.request),this.detection=new f(this.request),this.dialogue=new T(this.request),this.platform=new q(this.request),this.robotics=new v(this.request),this.session=new C(this.request),this.ui=new A(this.request),this.xr=new S(this.request)}};var Kt=(r=1e3)=>new Promise(e=>setTimeout(()=>e(),r)),ye="http://localhost:8080",Q=class{constructor(e){this.config=e;n(this,"logger");n(this,"api");n(this,"events");n(this,"broker");n(this,"apiUrl");n(this,"mqttUrl");n(this,"refreshTimeout");n(this,"ready",!1);n(this,"jwt");n(this,"params",{});e.logger&&F(e.logger),this.logger=new g("SermasApiClient");let t=e.baseURL||ye;this.apiUrl=`${t}`;let o=new URL(this.apiUrl),s=o.protocol.startsWith("https");this.mqttUrl=`ws${s?"s":""}://${o.hostname}${o.port?":"+o.port:""}/mqtt`,this.api=new l({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new L({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new m(this.broker)}getBroker(){return this.broker||null}async close(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),await this.broker.disconnect()}init(e=!1){if(e&&(this.ready=!1),!this.ready){if(!this.config.access_token){this.logger.debug("Access token not set, skip client init");return}this.params={appId:this.config.appId},this.broker.setParams(this.params),this.broker.setToken(this.config.access_token),this.watchToken(),this.ready=!0}}watchToken(){let e=ge(this.config.access_token);this.jwt=e,this.config.clientId=this.config.clientId||e.aud;let o=new Date(e.exp*1e3).getTime()-Date.now()-30*1e3;this.logger.verbose(`Token expires in ${Math.round(o/1e3/60/60)}min`),this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>this.refreshToken(),o)}async refreshToken(){this.logger.verbose("Refreshing token");let e;try{e=await this.api.platform.getClientRefreshToken({requestBody:{refreshToken:this.config.refresh_token,appId:this.config.appId,clientId:this.config.clientId,clientSecret:this.config.clientSecret}})}catch(t){this.logger.error(`Refresh token failed: ${t.stack}`);return}if(!e){this.logger.warn("Failed to refresh token, no response");return}return this.config.access_token=e.access_token,this.config.refresh_token=e.refresh_token,this.init(!0),e}async loadToken(e,t,o){let s=new l({BASE:this.apiUrl});this.config.appId=o||this.config.appId;let i=await s.platform.getClientAccessToken({requestBody:{clientId:e,clientSecret:t,appId:this.config.appId}});return this.config.clientId=e,this.config.clientSecret=t,this.config.appId=o||this.config.appId,this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}setToken(e,t,o){if(typeof e!="string"){let s=e;e=s.access_token,t=s.refresh_token,o=s.appId}this.config.access_token=e,this.config.refresh_token=t,o!==void 0&&(this.config.appId=o),this.init(!0)}async login(e,t,o){let s=new l({BASE:this.apiUrl});this.config.appId=o||this.config.appId;let i=await s.authentication.login({requestBody:{username:e,password:t,appId:this.config.appId}});return this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}};export{g as Logger,Q as SermasApiClient,Kt as sleep};
2
2
  //# sourceMappingURL=index.js.map