@hahnpro/hpc-api 2026.2.3 → 2026.2.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @hahnpro/hpc-api
2
2
 
3
+ # 2026.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Added to Ai-Interface: ResourceSelectionOption abd SelectionMessage
8
+ - Added getLogbookEntriesByIds to task.service
9
+
3
10
  # 2026.2.2
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hahnpro/hpc-api",
3
- "version": "2026.2.3",
3
+ "version": "2026.2.5",
4
4
  "description": "Module for easy access to the HahnPRO Cloud API",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -35,13 +35,15 @@ export declare enum Role {
35
35
  export declare enum ToolType {
36
36
  HANDOFF = "handoff",
37
37
  CHOICE = "choice",
38
- ACTION = "action"
38
+ ACTION = "action",
39
+ BUILT_IN_ACTION = "built_in-action"
39
40
  }
40
41
  export declare enum ReferenceType {
41
42
  ASSET = "asset",
42
43
  ASSET_TYPE = "asset-type",
43
44
  DOCUMENT = "document",
44
45
  EVENT = "event",
46
+ LOGBOOK_ENTRY = "logbook-entry",
45
47
  TASK = "task",
46
48
  WEB_SOURCE = "web-source"
47
49
  }
@@ -58,6 +60,12 @@ interface AssistantLabels {
58
60
  description?: string;
59
61
  welcomeMessage?: string;
60
62
  }
63
+ interface SelectionMessage {
64
+ message: string;
65
+ resourceType: ReferenceType;
66
+ moreMatches: boolean;
67
+ choices: ResourceSelectionOption[];
68
+ }
61
69
  interface BaseMessage {
62
70
  id?: string;
63
71
  responseId?: string;
@@ -103,7 +111,7 @@ export interface ToolMessage extends BaseMessage {
103
111
  agentStack?: string[];
104
112
  status?: ToolMessageStatus;
105
113
  result?: any;
106
- args?: any;
114
+ args?: SelectionMessage | any;
107
115
  contextVariables?: Record<string, unknown>;
108
116
  }
109
117
  export interface UserMessage extends BaseMessage {
@@ -132,4 +140,29 @@ export interface ThreadPopulated extends Thread {
132
140
  firstMessage?: Message;
133
141
  lastMessage?: Message;
134
142
  }
143
+ export interface BaseResourceSelectionOption {
144
+ id: string;
145
+ name?: string;
146
+ resourceType: ReferenceType;
147
+ }
148
+ export interface AssetResourceSelectionOption extends BaseResourceSelectionOption {
149
+ resourceType: ReferenceType.ASSET;
150
+ type?: string;
151
+ typeName?: string;
152
+ location?: string;
153
+ factory?: string;
154
+ }
155
+ export interface DocumentResourceSelectionOption extends BaseResourceSelectionOption {
156
+ resourceType: ReferenceType.DOCUMENT;
157
+ mimetype?: string;
158
+ }
159
+ export interface LogbookEntryResourceSelectionOption extends BaseResourceSelectionOption {
160
+ resourceType: ReferenceType.LOGBOOK_ENTRY;
161
+ date: string;
162
+ duration?: number;
163
+ }
164
+ export interface GenericResourceSelectionOption extends BaseResourceSelectionOption {
165
+ resourceType: Exclude<ReferenceType, ReferenceType.ASSET | ReferenceType.DOCUMENT | ReferenceType.LOGBOOK_ENTRY>;
166
+ }
167
+ export type ResourceSelectionOption = AssetResourceSelectionOption | DocumentResourceSelectionOption | LogbookEntryResourceSelectionOption | GenericResourceSelectionOption;
135
168
  export {};
@@ -44,6 +44,7 @@ var ToolType;
44
44
  ToolType["HANDOFF"] = "handoff";
45
45
  ToolType["CHOICE"] = "choice";
46
46
  ToolType["ACTION"] = "action";
47
+ ToolType["BUILT_IN_ACTION"] = "built_in-action";
47
48
  })(ToolType || (exports.ToolType = ToolType = {}));
48
49
  var ReferenceType;
49
50
  (function (ReferenceType) {
@@ -51,6 +52,7 @@ var ReferenceType;
51
52
  ReferenceType["ASSET_TYPE"] = "asset-type";
52
53
  ReferenceType["DOCUMENT"] = "document";
53
54
  ReferenceType["EVENT"] = "event";
55
+ ReferenceType["LOGBOOK_ENTRY"] = "logbook-entry";
54
56
  ReferenceType["TASK"] = "task";
55
57
  ReferenceType["WEB_SOURCE"] = "web-source";
56
58
  })(ReferenceType || (exports.ReferenceType = ReferenceType = {}));
@@ -1,4 +1,4 @@
1
- export type { AiAssistant, AssistantMessage, Message, SpeechToken, SystemMessage, Thread, ThreadPopulated, ToolMessage, UserMessage, } from './ai.interface';
1
+ export type { AiAssistant, AssetResourceSelectionOption, AssistantMessage, DocumentResourceSelectionOption, GenericResourceSelectionOption, LogbookEntryResourceSelectionOption, Message, ResourceSelectionOption, SpeechToken, SystemMessage, Thread, ThreadPopulated, ToolMessage, UserMessage, } from './ai.interface';
2
2
  export type { Alert, AlertCondition, TimeSeriesReference } from './alert.interface';
3
3
  export type { Api } from './api.interface';
4
4
  export type { AddToProperty, Asset, AssetRevision, AssetType, AssetTypeRevision, Attachment, EventCause, EventLevelOverride, RemoveFromProperty, Template, } from './asset.interface';
@@ -19,18 +19,18 @@ export type { NotificationRule, StatusRule, TagRule } from './notification-rule.
19
19
  export type { Notification, NotificationType } from './notification.interface';
20
20
  export type { OrganizationRoleRepresentation } from './organization-role-representation.interface';
21
21
  export { OrganizationMembersInviteOrAdd } from './organization.interface';
22
- export type { Organization, CreateOrganizationDto, OrganizationData, OrganizationDataKind, OrganizationDomain, OrganizationExtraProperties, OrganizationName, OrganizationRolesAdjustment, OrganizationSearchQuery, SubscriptionType, UserWithOrgRoles, } from './organization.interface';
22
+ export type { CreateOrganizationDto, Organization, OrganizationData, OrganizationDataKind, OrganizationDomain, OrganizationExtraProperties, OrganizationName, OrganizationRolesAdjustment, OrganizationSearchQuery, SubscriptionType, UserWithOrgRoles, } from './organization.interface';
23
23
  export type { CreateOrgWithResourcesDto, OrganizationResourcesProgress, OrganizationResourcesProgressDto, OrganizationResourcesProgressErrorDto, } from './organizations-resources.interface';
24
24
  export type { Owner } from './owner.interface';
25
25
  export type { DeleteAssetQuery, DeleteAssetTypeQuery, DeleteQuery } from './query.interface';
26
- export type { ConnectedResources, ConnectedResourceType, OrgResourcePermission, Resource, ResourceReference, SharedResources, } from './resource.interface';
27
26
  export type { CreateReferenceDto, ObjectReference, ReferencesQuery } from './reference.interface';
27
+ export type { ConnectedResources, ConnectedResourceType, OrgResourcePermission, Resource, ResourceReference, SharedResources, } from './resource.interface';
28
28
  export type { JsonSchema, JsonSchemaArray, JsonSchemaForm, JsonSchemaType, JsonSchemaTypeName } from './schema.interface';
29
29
  export type { SearchOptions, SearchResult, SearchSortOption, SortableField } from './search.interface';
30
30
  export type { Secret } from './secret.interface';
31
31
  export type { ServerSentEvent } from './sse.interface';
32
32
  export type { Artifact, FileType, Storage, StorageProvider } from './storage.interface';
33
- export type { LogbookEntry, LogbookEntryDto, Task, Assignee } from './task.interface';
33
+ export type { Assignee, LogbookEntry, LogbookEntryDto, Task } from './task.interface';
34
34
  export type { TimeSeries, TimeSeriesBucket, TimeSeriesCondition, TimeSeriesValue, TS_GROUPS } from './timeseries.interface';
35
35
  export type { Application, Consent, Permission, TableSetting, TableSettingProfile, UserSettings } from './user-settings.interface';
36
36
  export type { VaultSecret } from './vault.interface';
@@ -42,5 +42,5 @@ export { EventLevel } from './event.interface';
42
42
  export { LABEL_COLORS } from './label.interface';
43
43
  export { OwnerType } from './owner.interface';
44
44
  export { ObjectReferenceType } from './reference.interface';
45
- export { PermissionType, ResourceType, ResourceApiPath, resourceApiPathToTypeMap } from './resource.interface';
46
- export { Priority, TaskStatus, AssigneeType } from './task.interface';
45
+ export { PermissionType, ResourceApiPath, resourceApiPathToTypeMap, ResourceType } from './resource.interface';
46
+ export { AssigneeType, Priority, TaskStatus } from './task.interface';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AssigneeType = exports.TaskStatus = exports.Priority = exports.resourceApiPathToTypeMap = exports.ResourceApiPath = exports.ResourceType = exports.PermissionType = exports.ObjectReferenceType = exports.OwnerType = exports.LABEL_COLORS = exports.EventLevel = exports.instanceOfTimePeriod = exports.ReturnType = exports.AlertType = exports.AlertLevel = exports.ToolType = exports.ToolMessageStatus = exports.Role = exports.ReferenceType = exports.FinishReason = exports.AvailableLanguages = exports.AssistantMessageStatus = exports.OrganizationMembersInviteOrAdd = void 0;
3
+ exports.TaskStatus = exports.Priority = exports.AssigneeType = exports.ResourceType = exports.resourceApiPathToTypeMap = exports.ResourceApiPath = exports.PermissionType = exports.ObjectReferenceType = exports.OwnerType = exports.LABEL_COLORS = exports.EventLevel = exports.instanceOfTimePeriod = exports.ReturnType = exports.AlertType = exports.AlertLevel = exports.ToolType = exports.ToolMessageStatus = exports.Role = exports.ReferenceType = exports.FinishReason = exports.AvailableLanguages = exports.AssistantMessageStatus = exports.OrganizationMembersInviteOrAdd = void 0;
4
4
  var organization_interface_1 = require("./organization.interface");
5
5
  Object.defineProperty(exports, "OrganizationMembersInviteOrAdd", { enumerable: true, get: function () { return organization_interface_1.OrganizationMembersInviteOrAdd; } });
6
6
  var ai_interface_1 = require("./ai.interface");
@@ -28,10 +28,10 @@ var reference_interface_1 = require("./reference.interface");
28
28
  Object.defineProperty(exports, "ObjectReferenceType", { enumerable: true, get: function () { return reference_interface_1.ObjectReferenceType; } });
29
29
  var resource_interface_1 = require("./resource.interface");
30
30
  Object.defineProperty(exports, "PermissionType", { enumerable: true, get: function () { return resource_interface_1.PermissionType; } });
31
- Object.defineProperty(exports, "ResourceType", { enumerable: true, get: function () { return resource_interface_1.ResourceType; } });
32
31
  Object.defineProperty(exports, "ResourceApiPath", { enumerable: true, get: function () { return resource_interface_1.ResourceApiPath; } });
33
32
  Object.defineProperty(exports, "resourceApiPathToTypeMap", { enumerable: true, get: function () { return resource_interface_1.resourceApiPathToTypeMap; } });
33
+ Object.defineProperty(exports, "ResourceType", { enumerable: true, get: function () { return resource_interface_1.ResourceType; } });
34
34
  var task_interface_1 = require("./task.interface");
35
+ Object.defineProperty(exports, "AssigneeType", { enumerable: true, get: function () { return task_interface_1.AssigneeType; } });
35
36
  Object.defineProperty(exports, "Priority", { enumerable: true, get: function () { return task_interface_1.Priority; } });
36
37
  Object.defineProperty(exports, "TaskStatus", { enumerable: true, get: function () { return task_interface_1.TaskStatus; } });
37
- Object.defineProperty(exports, "AssigneeType", { enumerable: true, get: function () { return task_interface_1.AssigneeType; } });
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataMockService = void 0;
4
- const crypto_1 = require("crypto");
5
4
  const _1 = require(".");
6
5
  const interfaces_1 = require("../interfaces");
7
6
  class DataMockService extends _1.APIBaseMock {
@@ -9,7 +8,7 @@ class DataMockService extends _1.APIBaseMock {
9
8
  super();
10
9
  }
11
10
  async addOne(dto) {
12
- const dtoWithId = { id: (0, crypto_1.randomUUID)(), ...dto };
11
+ const dtoWithId = { id: globalThis.crypto.randomUUID(), ...dto };
13
12
  this.data.push(dtoWithId);
14
13
  return Promise.resolve(dtoWithId);
15
14
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrganizationsMockService = void 0;
4
- const crypto_1 = require("crypto");
5
4
  const _1 = require(".");
6
5
  class OrganizationsMockService extends _1.APIBaseMock {
7
6
  constructor(organizations) {
@@ -19,7 +18,7 @@ class OrganizationsMockService extends _1.APIBaseMock {
19
18
  return Promise.resolve({ id });
20
19
  }
21
20
  async addOne(dto) {
22
- const dtoWithId = { id: (0, crypto_1.randomUUID)(), ...dto };
21
+ const dtoWithId = { id: globalThis.crypto.randomUUID(), ...dto };
23
22
  this.data.push(dtoWithId);
24
23
  return Promise.resolve(dtoWithId);
25
24
  }
@@ -15,6 +15,7 @@ export declare class TaskMockService extends BaseService implements TaskService
15
15
  findByName(name: string, options?: any): Promise<Paginated<Task>>;
16
16
  findByAsset(assetId: string, options?: any): Promise<Paginated<Task>>;
17
17
  getLogbookEntries(taskId: string, limit?: number, offset?: number, _options?: TokenOption): Promise<Paginated<LogbookEntry>>;
18
+ getLogbookEntriesByIds(ids: string[], _options?: TokenOption): Promise<LogbookEntry[]>;
18
19
  addLogbookEntry(taskId: string, dto: LogbookEntryDto, _options?: TokenOption): Promise<LogbookEntry>;
19
20
  updateLogbookEntry(taskId: string, entryId: string, dto: Partial<LogbookEntryDto>, _options?: TokenOption): Promise<LogbookEntry>;
20
21
  deleteLogbookEntry(taskId: string, entryId: string, _options?: TokenOption): Promise<{
@@ -67,6 +67,10 @@ class TaskMockService extends BaseService {
67
67
  pages: Math.max(1, Math.ceil(taskEntries.length / limit)),
68
68
  };
69
69
  }
70
+ getLogbookEntriesByIds(ids, _options = {}) {
71
+ const entries = this.entries.filter((e) => ids.includes(e.id));
72
+ return Promise.resolve(entries);
73
+ }
70
74
  async addLogbookEntry(taskId, dto, _options = {}) {
71
75
  const id = globalThis.crypto?.randomUUID?.() || Math.random().toString(36).slice(2);
72
76
  const now = new Date().toISOString();
@@ -1,5 +1,6 @@
1
1
  import PQueue from 'p-queue';
2
- export declare class Queue extends PQueue {
2
+ declare const PQueueBase: typeof PQueue;
3
+ export declare class Queue extends PQueueBase {
3
4
  private peak;
4
5
  private total;
5
6
  constructor(options: QueueOptions);
@@ -15,3 +16,4 @@ export interface QueueOptions {
15
16
  timeout?: number;
16
17
  throwOnTimeout?: boolean;
17
18
  }
19
+ export {};
package/src/lib/queue.js CHANGED
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Queue = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const p_queue_1 = tslib_1.__importDefault(require("p-queue"));
6
- class Queue extends p_queue_1.default {
6
+ const PQueueBase = p_queue_1.default.default ?? p_queue_1.default;
7
+ class Queue extends PQueueBase {
7
8
  constructor(options) {
8
9
  super(options);
9
10
  this.peak = 0;
@@ -12,6 +12,7 @@ export declare class TaskService extends BaseService {
12
12
  findByName(name: string, options?: TokenOption): Promise<Paginated<Task>>;
13
13
  findByAsset(assetId: string, options?: TokenOption): Promise<Paginated<Task>>;
14
14
  getLogbookEntries(taskId: string, limit?: number, offset?: number, options?: TokenOption): Promise<Paginated<LogbookEntry>>;
15
+ getLogbookEntriesByIds(ids: string[], options?: TokenOption): Promise<LogbookEntry[]>;
15
16
  addLogbookEntry(taskId: string, entry: LogbookEntryDto, options?: TokenOption): Promise<LogbookEntry>;
16
17
  updateLogbookEntry(taskId: string, entryId: string, entry: Partial<LogbookEntryDto>, options?: TokenOption): Promise<LogbookEntry>;
17
18
  deleteLogbookEntry(taskId: string, entryId: string, options?: TokenOption): Promise<{
@@ -21,10 +21,10 @@ class TaskService extends BaseService {
21
21
  return this.httpClient.post(this.basePath, dto, options);
22
22
  }
23
23
  findByName(name, options = {}) {
24
- return this.httpClient.get(`${this.basePath}?name=${encodeURIComponent(name)}`, options);
24
+ return this.httpClient.get(`${this.basePath}`, { ...options, params: { filter: `name==${name}` } });
25
25
  }
26
26
  findByAsset(assetId, options = {}) {
27
- return this.httpClient.get(`${this.basePath}?assetRef=${assetId}`, options);
27
+ return this.httpClient.get(`${this.basePath}`, { ...options, params: { filter: `assetRef==${assetId}` } });
28
28
  }
29
29
  getLogbookEntries(taskId, limit = 50, offset = 0, options = {}) {
30
30
  return this.httpClient.get(`${this.basePath}/${taskId}/logbook`, {
@@ -32,6 +32,14 @@ class TaskService extends BaseService {
32
32
  params: { limit: String(limit), offset: String(offset) },
33
33
  });
34
34
  }
35
+ getLogbookEntriesByIds(ids, options = {}) {
36
+ return this.httpClient.get(`${this.basePath}/logbook`, {
37
+ ...options,
38
+ params: {
39
+ ids: ids.join(','),
40
+ },
41
+ });
42
+ }
35
43
  addLogbookEntry(taskId, entry, options = {}) {
36
44
  return this.httpClient.post(`${this.basePath}/${taskId}/logbook`, entry, options);
37
45
  }