@hahnpro/ai-sdk 0.11.0 → 0.11.2

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/package.json CHANGED
@@ -1,42 +1,41 @@
1
1
  {
2
2
  "name": "@hahnpro/ai-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "dependencies": {
8
- "@hahnpro/hpc-api": "2025.2.13",
9
- "@hahnpro/ms-speech-sdk": "1.45.0",
10
- "openid-client": "6.5.1",
8
+ "@hahnpro/hpc-api": "2026.5.1",
11
9
  "pretty-bytes": "6.1.1",
12
10
  "tslib": "^2.3.0"
13
11
  },
14
12
  "peerDependencies": {
15
- "@angular/cdk": "^18.0.0 || ^19.0.0 || ^20.0.0",
16
- "@angular/common": "^18.0.0 || ^19.0.0 || ^20.0.0",
17
- "@angular/core": "^18.0.0 || ^19.0.0 || ^20.0.0",
18
- "@angular/forms": "^18.0.0 || ^19.0.0 || ^20.0.0",
19
- "@angular/material": "^18.0.0 || ^19.0.0 || ^20.0.0",
20
- "@angular/platform-browser": "^18.0.0 || ^19.0.0 || ^20.0.0",
21
- "@angular/router": "^18.0.0 || ^19.0.0 || ^20.0.0",
13
+ "@angular/cdk": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
14
+ "@angular/common": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
15
+ "@angular/core": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
16
+ "@angular/forms": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
17
+ "@angular/material": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
18
+ "@angular/platform-browser": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
19
+ "@angular/router": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
22
20
  "@jsverse/transloco": "^7.6.0",
23
21
  "date-fns": "^4.0.0",
24
22
  "ngx-extended-pdf-viewer": "^23.0.0",
25
23
  "ngx-logger": "^5.0.0",
26
- "ngx-markdown": "^18.0.0 || ^19.0.0 || ^20.0.0",
24
+ "ngx-markdown": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
27
25
  "rxjs": "~7.8.0",
28
26
  "socket.io-client": "^4.8.0"
29
27
  },
30
28
  "sideEffects": false,
31
29
  "module": "fesm2022/hahnpro-ai-sdk.mjs",
32
- "typings": "index.d.ts",
30
+ "typings": "types/hahnpro-ai-sdk.d.ts",
33
31
  "exports": {
34
32
  "./package.json": {
35
33
  "default": "./package.json"
36
34
  },
37
35
  ".": {
38
- "types": "./index.d.ts",
36
+ "types": "./types/hahnpro-ai-sdk.d.ts",
39
37
  "default": "./fesm2022/hahnpro-ai-sdk.mjs"
40
38
  }
41
- }
39
+ },
40
+ "type": "module"
42
41
  }
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { OnInit, ElementRef, InjectionToken, Provider, EnvironmentProviders } from '@angular/core';
2
+ import { ChangeDetectorRef, OnInit, ElementRef, InjectionToken, Provider, EnvironmentProviders } from '@angular/core';
3
3
  import * as _hahnpro_hpc_api from '@hahnpro/hpc-api';
4
- import { Message, AiAssistant, ThreadPopulated, AssistantMessage as AssistantMessage$1, SystemMessage, ToolMessage, UserMessage as UserMessage$1, Paginated, Thread, SpeechToken, RequestParameter, Asset, AssetType, Content, Event } from '@hahnpro/hpc-api';
4
+ import { ReferenceType, Message, AiAssistant, ThreadPopulated, AssistantMessage as AssistantMessage$1, Role, SystemMessage, ToolMessage, UserMessage as UserMessage$1, AiAssistantId, Paginated, Thread, SpeechToken, RequestParameter, Asset, AssetType, Content, Event, Task, LogbookEntry } from '@hahnpro/hpc-api';
5
5
  import { Subject, Observable } from 'rxjs';
6
6
  import * as i1 from '@jsverse/transloco';
7
7
  import { TranslocoService, TranslocoLoader } from '@jsverse/transloco';
@@ -12,7 +12,7 @@ import * as i1$1 from '@angular/common';
12
12
  interface ContextReference {
13
13
  reference_id: number;
14
14
  id: string;
15
- resourceType: 'asset' | 'asset-type' | 'content' | 'event' | 'web-source';
15
+ resourceType: ReferenceType;
16
16
  pageNumber?: number;
17
17
  firstOccurrence?: boolean;
18
18
  retrievalDate?: string;
@@ -29,7 +29,6 @@ declare class ChatService {
29
29
  highlightContext: string | null;
30
30
  isLoading: boolean;
31
31
  model: string | null;
32
- locale: string;
33
32
  isProcessing: boolean;
34
33
  threadEventSubject: Subject<{
35
34
  type: WebSocketMessageType;
@@ -41,6 +40,8 @@ declare class ChatService {
41
40
  private readonly router;
42
41
  private readonly socket;
43
42
  private readonly translocoService;
43
+ private readonly zone;
44
+ private _cdRef;
44
45
  private _activeView;
45
46
  private _activeAssistant;
46
47
  private _activeThread;
@@ -49,22 +50,24 @@ declare class ChatService {
49
50
  private threadEvents$;
50
51
  constructor();
51
52
  get activeAssistant(): AiAssistant;
53
+ getLocale(): string;
52
54
  get activeThread(): ThreadPopulated | null;
53
55
  get activeView(): ChatView;
54
56
  get assistants(): AiAssistant[];
55
57
  get messages(): ChatMessage[];
56
58
  get title(): string;
59
+ setChangeDetector(cdRef: ChangeDetectorRef): void;
57
60
  init(): Promise<void>;
58
- createThreadForModal(assistantId: string, initialMessage?: string, context?: Record<string, unknown> | null, hidden?: boolean): Promise<void>;
59
- openEmptyThread(assistantId: string): Promise<void>;
60
- createThread(initialMessage?: string, assistantId?: string): Promise<void>;
61
+ createThreadForModal(assistantId: AiAssistantId, initialMessage?: string, context?: Record<string, unknown> | null): Promise<void>;
62
+ openEmptyThread(assistantId: AiAssistantId): Promise<void>;
63
+ createThread(initialMessage?: string, assistantId?: AiAssistantId): Promise<void>;
61
64
  deleteThread(threadId: string): Promise<_hahnpro_hpc_api.Thread>;
62
65
  showStart(): void;
63
66
  showThreadList(): void;
64
67
  openThread(thread: string | ThreadPopulated, isNewThread?: boolean): Promise<void>;
65
68
  getAssistantName(thread: ThreadPopulated): string;
66
69
  private getMessages;
67
- sendMessage(content: string, context?: Record<string, unknown>, hidden?: boolean): Promise<void>;
70
+ sendMessage(content: string, context?: Record<string, unknown>): Promise<void>;
68
71
  selectChoice(selection: any, toolMessage: any): void;
69
72
  closeThread(): void;
70
73
  abortThread(): Promise<void>;
@@ -75,37 +78,32 @@ declare class ChatService {
75
78
  private updatePartialMessage;
76
79
  private prettifyMessage;
77
80
  /**
78
- * Replace IDs in the message content with a more readable format, which can be processed to properly identify references.
79
- * @param message The message to process.
81
+ * Replace IDs in the message content with a more readable format, which can be processed to properly identify references. * @param message The message to process.
80
82
  * @returns The processed message content.
81
- */
82
- private replaceIds;
83
+ */ private replaceIds;
83
84
  /**
84
- * Check if the last keyword in the string is 'Asset' or 'Typ'.
85
- * @param str The string to check.
85
+ * Check if the last keyword in the string is 'Asset' or 'Typ'. * @param str The string to check.
86
86
  * @returns An object with the last keyword and its index, or null if neither is found.
87
- */
88
- private checkLastKeyword;
87
+ */ private checkLastKeyword;
89
88
  /**
90
- * Prettify JSON strings in messages by converting them to a Markdown table.
91
- * @param content The content of the message.
89
+ * Prettify JSON strings in messages by converting them to a Markdown table. * @param content The content of the message.
92
90
  * @returns The prettified content.
93
- */
94
- private replaceJsonWithMdTable;
91
+ */ private replaceJsonWithMdTable;
95
92
  retryMessage(message: AssistantMessage): void;
96
93
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatService, never>;
97
94
  static ɵprov: i0.ɵɵInjectableDeclaration<ChatService>;
98
95
  }
99
96
  interface MessageContent {
97
+ suggestions?: string[];
100
98
  response: string;
101
99
  references: ContextReference[];
102
100
  }
103
101
  interface AssistantMessage extends AssistantMessage$1 {
104
- role: 'assistant';
102
+ role: Role.ASSISTANT;
105
103
  parsedContent?: MessageContent;
106
104
  }
107
105
  interface UserMessage extends UserMessage$1 {
108
- role: 'user';
106
+ role: Role.USER;
109
107
  parsedContent?: MessageContent;
110
108
  }
111
109
  type ChatMessage = AssistantMessage | SystemMessage | ToolMessage | UserMessage;
@@ -138,6 +136,7 @@ interface ChatDialogData {
138
136
  event?: EventData;
139
137
  assistant?: ChatAssistantType;
140
138
  initialMessage?: string;
139
+ threadId?: string;
141
140
  context?: Record<string, unknown>;
142
141
  messageHandler?: (message: {
143
142
  type: WebSocketMessageType;
@@ -175,12 +174,13 @@ declare class AiChatComponent implements OnInit {
175
174
  readonly elementRef: ElementRef<any>;
176
175
  private auth;
177
176
  asset: AssetData;
178
- assistant: ChatAssistantType;
177
+ assistantType: ChatAssistantType;
179
178
  initialMessage?: string;
179
+ threadId?: string;
180
180
  context?: Record<string, unknown>;
181
181
  ngOnInit(): Promise<void>;
182
182
  static ɵfac: i0.ɵɵFactoryDeclaration<AiChatComponent, never>;
183
- static ɵcmp: i0.ɵɵComponentDeclaration<AiChatComponent, "ai-chat", never, { "asset": { "alias": "asset"; "required": false; }; "assistant": { "alias": "assistant"; "required": false; }; "initialMessage": { "alias": "initialMessage"; "required": false; }; "context": { "alias": "context"; "required": false; }; }, {}, never, never, true, never>;
183
+ static ɵcmp: i0.ɵɵComponentDeclaration<AiChatComponent, "ai-chat", never, { "asset": { "alias": "asset"; "required": false; }; "assistantType": { "alias": "assistantType"; "required": false; }; "initialMessage": { "alias": "initialMessage"; "required": false; }; "threadId": { "alias": "threadId"; "required": false; }; "context": { "alias": "context"; "required": false; }; }, {}, never, never, true, never>;
184
184
  }
185
185
 
186
186
  declare const translations: {
@@ -293,13 +293,27 @@ declare const translations: {
293
293
  retry: string;
294
294
  select_asset: string;
295
295
  send_message: string;
296
+ send_voice_message: string;
296
297
  source: string;
298
+ starting_voice_input: string;
297
299
  stop_recording: string;
300
+ cancel_recording: string;
301
+ finish_recording: string;
302
+ no_speech_detected: string;
303
+ transcribing_voice_input: string;
304
+ transcription_failed: string;
305
+ voice_input_failed: string;
298
306
  suggested_prompts: string;
299
307
  threads: string;
300
308
  toast_error_delete_entry: string;
301
309
  toast_success_delete_entry: string;
302
310
  tools: {
311
+ addTaskLogbookEntry: {
312
+ completed: string;
313
+ failed: string;
314
+ pending: string;
315
+ processing: string;
316
+ };
303
317
  createAxaltaEvent: {
304
318
  completed: string;
305
319
  failed: string;
@@ -318,6 +332,24 @@ declare const translations: {
318
332
  pending: string;
319
333
  processing: string;
320
334
  };
335
+ createJSONReport: {
336
+ completed: string;
337
+ failed: string;
338
+ pending: string;
339
+ processing: string;
340
+ };
341
+ findTaskByName: {
342
+ completed: string;
343
+ failed: string;
344
+ pending: string;
345
+ processing: string;
346
+ };
347
+ findTasksByAsset: {
348
+ completed: string;
349
+ failed: string;
350
+ pending: string;
351
+ processing: string;
352
+ };
321
353
  getAdditionalDataTemplate: {
322
354
  completed: string;
323
355
  failed: string;
@@ -330,12 +362,36 @@ declare const translations: {
330
362
  pending: string;
331
363
  processing: string;
332
364
  };
365
+ getIncidentTemplate: {
366
+ completed: string;
367
+ failed: string;
368
+ pending: string;
369
+ processing: string;
370
+ };
333
371
  getReportTemplate: {
334
372
  completed: string;
335
373
  failed: string;
336
374
  pending: string;
337
375
  processing: string;
338
376
  };
377
+ getTaskLogbookEntries: {
378
+ completed: string;
379
+ failed: string;
380
+ pending: string;
381
+ processing: string;
382
+ };
383
+ searchAssetTypes: {
384
+ completed: string;
385
+ failed: string;
386
+ pending: string;
387
+ processing: string;
388
+ };
389
+ searchAssets: {
390
+ completed: string;
391
+ failed: string;
392
+ pending: string;
393
+ processing: string;
394
+ };
339
395
  searchForAssetAxalta: {
340
396
  completed: string;
341
397
  failed: string;
@@ -348,7 +404,7 @@ declare const translations: {
348
404
  pending: string;
349
405
  processing: string;
350
406
  };
351
- searchForAssets: {
407
+ searchForAssetsByIdNameType: {
352
408
  completed: string;
353
409
  failed: string;
354
410
  pending: string;
@@ -366,6 +422,12 @@ declare const translations: {
366
422
  pending: string;
367
423
  processing: string;
368
424
  };
425
+ updateTaskLogbookEntry: {
426
+ completed: string;
427
+ failed: string;
428
+ pending: string;
429
+ processing: string;
430
+ };
369
431
  };
370
432
  use_microphone: string;
371
433
  use_web_search: string;
@@ -609,6 +671,7 @@ declare const translations: {
609
671
  legal_notice: string;
610
672
  list: string;
611
673
  loading: string;
674
+ logbook_entry: string;
612
675
  logo: string;
613
676
  manage_groups: string;
614
677
  manage_identity_providers: string;
@@ -927,13 +990,27 @@ declare const translations: {
927
990
  retry: string;
928
991
  select_asset: string;
929
992
  send_message: string;
993
+ send_voice_message: string;
930
994
  source: string;
995
+ starting_voice_input: string;
931
996
  stop_recording: string;
997
+ cancel_recording: string;
998
+ finish_recording: string;
999
+ no_speech_detected: string;
1000
+ transcribing_voice_input: string;
1001
+ transcription_failed: string;
1002
+ voice_input_failed: string;
932
1003
  suggested_prompts: string;
933
1004
  threads: string;
934
1005
  toast_error_delete_entry: string;
935
1006
  toast_success_delete_entry: string;
936
1007
  tools: {
1008
+ addTaskLogbookEntry: {
1009
+ completed: string;
1010
+ failed: string;
1011
+ pending: string;
1012
+ processing: string;
1013
+ };
937
1014
  createAxaltaEvent: {
938
1015
  completed: string;
939
1016
  failed: string;
@@ -952,6 +1029,24 @@ declare const translations: {
952
1029
  pending: string;
953
1030
  processing: string;
954
1031
  };
1032
+ createJSONReport: {
1033
+ completed: string;
1034
+ failed: string;
1035
+ pending: string;
1036
+ processing: string;
1037
+ };
1038
+ findTaskByName: {
1039
+ completed: string;
1040
+ failed: string;
1041
+ pending: string;
1042
+ processing: string;
1043
+ };
1044
+ findTasksByAsset: {
1045
+ completed: string;
1046
+ failed: string;
1047
+ pending: string;
1048
+ processing: string;
1049
+ };
955
1050
  getAdditionalDataTemplate: {
956
1051
  completed: string;
957
1052
  failed: string;
@@ -964,12 +1059,36 @@ declare const translations: {
964
1059
  pending: string;
965
1060
  processing: string;
966
1061
  };
1062
+ getIncidentTemplate: {
1063
+ completed: string;
1064
+ failed: string;
1065
+ pending: string;
1066
+ processing: string;
1067
+ };
967
1068
  getReportTemplate: {
968
1069
  completed: string;
969
1070
  failed: string;
970
1071
  pending: string;
971
1072
  processing: string;
972
1073
  };
1074
+ getTaskLogbookEntries: {
1075
+ completed: string;
1076
+ failed: string;
1077
+ pending: string;
1078
+ processing: string;
1079
+ };
1080
+ searchAssetTypes: {
1081
+ completed: string;
1082
+ failed: string;
1083
+ pending: string;
1084
+ processing: string;
1085
+ };
1086
+ searchAssets: {
1087
+ completed: string;
1088
+ failed: string;
1089
+ pending: string;
1090
+ processing: string;
1091
+ };
973
1092
  searchForAssetAxalta: {
974
1093
  completed: string;
975
1094
  failed: string;
@@ -982,7 +1101,7 @@ declare const translations: {
982
1101
  pending: string;
983
1102
  processing: string;
984
1103
  };
985
- searchForAssets: {
1104
+ searchForAssetsByIdNameType: {
986
1105
  completed: string;
987
1106
  failed: string;
988
1107
  pending: string;
@@ -1000,6 +1119,12 @@ declare const translations: {
1000
1119
  pending: string;
1001
1120
  processing: string;
1002
1121
  };
1122
+ updateTaskLogbookEntry: {
1123
+ completed: string;
1124
+ failed: string;
1125
+ pending: string;
1126
+ processing: string;
1127
+ };
1003
1128
  };
1004
1129
  use_microphone: string;
1005
1130
  use_web_search: string;
@@ -1231,6 +1356,7 @@ declare const translations: {
1231
1356
  legal_notice: string;
1232
1357
  list: string;
1233
1358
  loading: string;
1359
+ logbook_entry: string;
1234
1360
  logo: string;
1235
1361
  manage_groups: string;
1236
1362
  manage_identity_providers: string;
@@ -1467,29 +1593,35 @@ interface AuthAdapter {
1467
1593
  }): Promise<void>;
1468
1594
  loginPopup?(): Promise<void>;
1469
1595
  logout?(): Promise<void>;
1596
+ baseUrl?: string;
1470
1597
  }
1471
1598
  declare const AUTH_ADAPTER: InjectionToken<AuthAdapter>;
1472
1599
 
1473
1600
  declare class ApiService {
1601
+ private auth;
1474
1602
  private _baseUrl;
1475
1603
  private apiPath;
1476
- private auth;
1477
1604
  private httpClient;
1478
1605
  get baseUrl(): string;
1479
1606
  get apiUrl(): string;
1480
1607
  get user(): User | null;
1481
- addMessage(message: string, threadId?: string, assistantId?: string, context?: Record<string, unknown>): Promise<Message>;
1608
+ addMessage(message: string, threadId?: string, assistantId?: AiAssistantId, context?: Record<string, unknown>): Promise<Message>;
1482
1609
  getAccessToken(): Promise<string>;
1483
- createThread(assistantId: string, isEphemeral?: boolean): Promise<ThreadPopulated>;
1610
+ createThread(assistantId: AiAssistantId, isEphemeral?: boolean): Promise<ThreadPopulated>;
1484
1611
  getThread(threadId: string): Promise<ThreadPopulated>;
1485
- getThreadMessages(threadId: string): Promise<Paginated<Message[]>>;
1612
+ getThreadMessages(threadId: string): Promise<Paginated<Message>>;
1486
1613
  deleteThread(threadId: string): Promise<Thread>;
1487
1614
  getAssistants(): Promise<AiAssistant[]>;
1488
1615
  getSpeechToken(): Promise<SpeechToken>;
1489
- getAssets(params?: RequestParameter): Promise<Paginated<Asset[]>>;
1490
- getAssetTypes(params?: RequestParameter): Promise<Paginated<AssetType[]>>;
1491
- getContents(params?: RequestParameter): Promise<Paginated<Content[]>>;
1492
- getEvents(params?: RequestParameter): Promise<Paginated<Event[]>>;
1616
+ transcribeAudio(form: FormData, config?: Config): Promise<{
1617
+ text: string;
1618
+ }>;
1619
+ getAssets(params?: RequestParameter): Promise<Paginated<Asset>>;
1620
+ getAssetTypes(params?: RequestParameter): Promise<Paginated<AssetType>>;
1621
+ getContents(params?: RequestParameter): Promise<Paginated<Content>>;
1622
+ getEvents(params?: RequestParameter): Promise<Paginated<Event>>;
1623
+ getTasks(params?: RequestParameter): Promise<Paginated<Task>>;
1624
+ getLogbookEntriesByIds(ids: string[]): Promise<LogbookEntry[]>;
1493
1625
  downloadContent(id: string, type?: FileType): Promise<Blob>;
1494
1626
  loadUsersAsPermissions(): Promise<Permission[]>;
1495
1627
  static ɵfac: i0.ɵɵFactoryDeclaration<ApiService, never>;
@@ -1501,6 +1633,7 @@ type TokenOption = {
1501
1633
  type Config = TokenOption & {
1502
1634
  headers?: Record<string, string>;
1503
1635
  params?: any;
1636
+ signal?: AbortSignal;
1504
1637
  };
1505
1638
  declare class HttpClient {
1506
1639
  private auth;