@newheap/platform-ai-chat 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/admin/index.d.ts +92 -6
- package/agent-runs/index.d.ts +43 -7
- package/fesm2022/newheap-platform-ai-chat-admin.mjs +837 -155
- package/fesm2022/newheap-platform-ai-chat-admin.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat-agent-runs.mjs +120 -35
- package/fesm2022/newheap-platform-ai-chat-agent-runs.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat-testing.mjs +870 -48
- package/fesm2022/newheap-platform-ai-chat-testing.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat.mjs +1018 -184
- package/fesm2022/newheap-platform-ai-chat.mjs.map +1 -1
- package/i18n/en.json +236 -12
- package/i18n/nl.json +236 -12
- package/index.d.ts +439 -31
- package/package.json +1 -1
- package/testing/index.d.ts +130 -3
package/package.json
CHANGED
package/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssistantStatus, AgentSummary, Conversation, ClientContext, AssistantPreferences, ToolCatalogEntry, AdminAgentInput, CodeRunSettings, AgentRunSettingsRequest, DataSkillRequest, DataTriggerRequest, McpServerInput, McpCustomAuthMode, McpDiscovery, RunCatalog, AssistantDataClassification, AssistantAccount, AgentRunStatus, AgentTriggerReceipt, AgentRunMcpSkip, ApprovalPresentation, AgentProposalStatus, AgentProposalOrigin, AgentProposalParent, NhAssistantMcpAuthorizationWindow, NhAssistantMcpAuthorizationOutcome, NhAssistantMcpAuthorizationHandle, LiveConversationChanged, LiveConversationRead, LiveConversationRemoved, LiveConversationEvent, LiveAgentWorkChanged, FileReference, NhAssistantUploadRequest, NhAssistantLiveService, NhAssistantLiveState } from '@newheap/platform-ai-chat';
|
|
1
|
+
import { AssistantStatus, AgentSummary, Conversation, ClientContext, NhAssistantConsultationLeaveRoute, AssistantPreferences, ToolCatalogEntry, AdminAgentInput, NhAssistantConsultationRoute, DataConsultationRequest, CodeRunSettings, AgentRunSettingsRequest, DataSkillRequest, DataTriggerRequest, McpServerInput, McpCustomAuthMode, McpDiscovery, RunCatalog, AssistantDataClassification, AssistantAccount, AgentRunStatus, AgentTriggerReceipt, AgentRunMcpSkip, ApprovalPresentation, AgentProposalStatus, AgentProposalOrigin, AgentProposalParent, AgentGrantSource, AgentConsultationStatus, NhAssistantMcpAuthorizationWindow, NhAssistantMcpAuthorizationOutcome, NhAssistantMcpAuthorizationHandle, LiveConversationChanged, LiveConversationRead, LiveConversationRemoved, LiveConversationEvent, LiveAgentWorkChanged, ApplicationMessageDetails, Message, FileReference, NhAssistantUploadRequest, NhAssistantLiveService, NhAssistantLiveState } from '@newheap/platform-ai-chat';
|
|
2
2
|
import * as _angular_core from '@angular/core';
|
|
3
3
|
import { InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
@@ -32,7 +32,10 @@ interface NhAssistantMockToolStep {
|
|
|
32
32
|
/**
|
|
33
33
|
* Pauses the turn for approval: `tool.started`, `approval.required` and
|
|
34
34
|
* `turn.completed` with status `waiting-for-approval`. The decision resumes the turn with
|
|
35
|
-
* the `approved` or `rejected` steps.
|
|
35
|
+
* the `approved` or `rejected` steps. With `consultation` the approval is a consulted agent's
|
|
36
|
+
* proposal that the person who asked decides in their own chat (`asker-decides`); with its
|
|
37
|
+
* `leaveRoute` the decision `leave` leaves it for the subject's approvers and resumes the turn with
|
|
38
|
+
* the `left` steps.
|
|
36
39
|
*/
|
|
37
40
|
interface NhAssistantMockApprovalStep {
|
|
38
41
|
approval: {
|
|
@@ -57,8 +60,26 @@ interface NhAssistantMockApprovalStep {
|
|
|
57
60
|
resultPreview?: string | null;
|
|
58
61
|
approved: NhAssistantMockStep[];
|
|
59
62
|
rejected: NhAssistantMockStep[];
|
|
63
|
+
/** The consultation that proposed it; without it the approval is the conversation's own. */
|
|
64
|
+
consultation?: NhAssistantMockApprovalConsultation;
|
|
65
|
+
/** The steps after the person left the proposal for the subject's approvers. Default none. */
|
|
66
|
+
left?: NhAssistantMockStep[];
|
|
60
67
|
};
|
|
61
68
|
}
|
|
69
|
+
/** Where a consulted agent's proposal of a mock turn comes from. */
|
|
70
|
+
interface NhAssistantMockApprovalConsultation {
|
|
71
|
+
/** Default a generated id. */
|
|
72
|
+
consultationId?: string;
|
|
73
|
+
/** The consulted agent that proposed it. */
|
|
74
|
+
agentId: string;
|
|
75
|
+
subjectType: string;
|
|
76
|
+
subjectId: string;
|
|
77
|
+
subjectDisplayName?: string | null;
|
|
78
|
+
/** The route at the subject the person may leave it for; default none, so they only approve or reject it. */
|
|
79
|
+
leaveRoute?: NhAssistantConsultationLeaveRoute | null;
|
|
80
|
+
/** The consulted agent's answer. Default none. */
|
|
81
|
+
answer?: string | null;
|
|
82
|
+
}
|
|
62
83
|
/** Ends the stream with an `error` event. */
|
|
63
84
|
interface NhAssistantMockErrorStep {
|
|
64
85
|
error: {
|
|
@@ -137,6 +158,32 @@ interface NhAssistantMockAdminAgent extends AdminAgentInput {
|
|
|
137
158
|
shadow?: boolean;
|
|
138
159
|
/** The technical account in code, as with `ServiceAccount(actorId)`. */
|
|
139
160
|
serviceAccount?: string;
|
|
161
|
+
/**
|
|
162
|
+
* The routes that the consultations of a code agent allow, with the subject types whose
|
|
163
|
+
* consultation allows each, as `AllowConsultation` in code, such as
|
|
164
|
+
* `{ 'asker-decides': ['project'], 'subject-asker-rights': ['project'] }`; a route without types is
|
|
165
|
+
* not allowed. Without it nobody can consult the agent and its state has no `consultationRoutes`.
|
|
166
|
+
*/
|
|
167
|
+
consultations?: Partial<Record<NhAssistantConsultationRoute, string[]>>;
|
|
168
|
+
/**
|
|
169
|
+
* The descriptions of a code agent's consultations in code, by subject type, as `Description` in
|
|
170
|
+
* `AllowConsultation`. A type listed here and in no route of `consultations` is a consultation in
|
|
171
|
+
* code that only answers.
|
|
172
|
+
*/
|
|
173
|
+
consultationDescriptions?: Record<string, string>;
|
|
174
|
+
/**
|
|
175
|
+
* The ceiling of a code agent that administrators may make consultable as data, as
|
|
176
|
+
* `ConsultableAsData` in code; it applies together with the scenario's `consultationsAsData`. `{}`
|
|
177
|
+
* allows answers only, as `ConsultableAsData()` without a configuration does. Without it a code
|
|
178
|
+
* agent gets no consultations as data.
|
|
179
|
+
*/
|
|
180
|
+
consultableAsData?: NhAssistantMockConsultationCeiling;
|
|
181
|
+
/**
|
|
182
|
+
* The consultations defined as data the agent starts with, as administrators saved them. The mock
|
|
183
|
+
* saves them through its own endpoint after the agent's run configuration, so each is checked as an
|
|
184
|
+
* administrator's save is; a consultation the mock refuses fails the scenario at once.
|
|
185
|
+
*/
|
|
186
|
+
dataConsultations?: NhAssistantMockDataConsultation[];
|
|
140
187
|
/**
|
|
141
188
|
* Whether a code agent says what it works on, as with `WorksOn`; by default it does when the
|
|
142
189
|
* scenario gives `worksOnSubjectTypes`, `worksOnAllSubjects` or `worksOnApplication`.
|
|
@@ -157,6 +204,26 @@ interface NhAssistantMockAdminAgent extends AdminAgentInput {
|
|
|
157
204
|
*/
|
|
158
205
|
runConfiguration?: NhAssistantMockRunConfigurationPreset;
|
|
159
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* A ceiling in code of consultations defined as data, as `NhAssistantConsultationCeilingBuilder`
|
|
209
|
+
* configures one: the routes data may use (none by default, which allows answers only), whether data
|
|
210
|
+
* may generate request tools and offer them to MCP clients (both off by default), and the highest
|
|
211
|
+
* limits (by default the bounds of `AllowConsultation`: 32 tool calls, 600 seconds, 32,000
|
|
212
|
+
* characters and 200 messages).
|
|
213
|
+
*/
|
|
214
|
+
interface NhAssistantMockConsultationCeiling {
|
|
215
|
+
routes?: NhAssistantConsultationRoute[];
|
|
216
|
+
allowRequests?: boolean;
|
|
217
|
+
allowMcp?: boolean;
|
|
218
|
+
maxToolCalls?: number;
|
|
219
|
+
maxTimeoutSeconds?: number;
|
|
220
|
+
maxAnswerChars?: number;
|
|
221
|
+
maxHistoryMessages?: number;
|
|
222
|
+
}
|
|
223
|
+
/** A consultation defined as data an agent of the scenario starts with. */
|
|
224
|
+
interface NhAssistantMockDataConsultation extends DataConsultationRequest {
|
|
225
|
+
subjectType: string;
|
|
226
|
+
}
|
|
160
227
|
/**
|
|
161
228
|
* The run configuration as data an agent created in the administration starts with. The mock saves it
|
|
162
229
|
* through its own endpoints in order (the run settings, then each skill, then each trigger), so every
|
|
@@ -227,6 +294,13 @@ interface NhAssistantMockAdminScenario {
|
|
|
227
294
|
* administration work per division, as an application that lists its divisions does.
|
|
228
295
|
*/
|
|
229
296
|
runCatalog?: Partial<RunCatalog>;
|
|
297
|
+
/**
|
|
298
|
+
* Lets administrators define consultations as data within this ceiling, as `UseConsultationsAsData`
|
|
299
|
+
* in code: agents created in the administration with run settings get it, and code agents with
|
|
300
|
+
* `consultableAsData` get it together with their own. The run catalog reports it as
|
|
301
|
+
* `consultationCeiling`. Without it consultations exist in code only.
|
|
302
|
+
*/
|
|
303
|
+
consultationsAsData?: NhAssistantMockConsultationCeiling;
|
|
230
304
|
/**
|
|
231
305
|
* The data classifications each model profile and its fallbacks permit together, by profile name.
|
|
232
306
|
* An agent or skill whose classification its profile does not permit is saved with the warning
|
|
@@ -454,6 +528,12 @@ interface NhAssistantMockScenario {
|
|
|
454
528
|
* the approval inbox, their thread and their subject's work list them, and people decide them.
|
|
455
529
|
*/
|
|
456
530
|
proposals?: NhAssistantMockProposal[];
|
|
531
|
+
/**
|
|
532
|
+
* Consultations of agents by other assistants, as the consulted agent's thread lists them
|
|
533
|
+
* (`GET threads/{id}/consultations`), newest first. Their proposals are those of `proposals` that
|
|
534
|
+
* name them (`consultationId`), counted per route.
|
|
535
|
+
*/
|
|
536
|
+
consultations?: NhAssistantMockConsultation[];
|
|
457
537
|
/**
|
|
458
538
|
* The application's own answer to an upload that passed the assistant's checks: `null` stores it,
|
|
459
539
|
* a code refuses it as the server passes the file source's refusal on, for example
|
|
@@ -470,9 +550,27 @@ interface NhAssistantMockScenario {
|
|
|
470
550
|
*/
|
|
471
551
|
scanUpload?: (upload: NhAssistantMockUpload) => 'refused' | 'failed' | null;
|
|
472
552
|
}
|
|
553
|
+
/** A consultation of an agent by another assistant, as the consulted agent's thread lists it. */
|
|
554
|
+
interface NhAssistantMockConsultation {
|
|
555
|
+
id: string;
|
|
556
|
+
/** The consulted agent's thread. */
|
|
557
|
+
conversationId: string;
|
|
558
|
+
askerActorId: string;
|
|
559
|
+
askerDisplayName?: string | null;
|
|
560
|
+
askingAgentId?: string | null;
|
|
561
|
+
/** Default `completed`. */
|
|
562
|
+
status?: AgentConsultationStatus;
|
|
563
|
+
/** When it started, an ISO date. Default when the mock started. */
|
|
564
|
+
createdAt?: string;
|
|
565
|
+
}
|
|
473
566
|
/**
|
|
474
567
|
* A proposal an agent left, as the mock serves it; the mock fills what it leaves out. With
|
|
475
568
|
* `placedBy` a run placed it here from another subject, such as a run for the whole application.
|
|
569
|
+
* With `consultationId` another assistant consulted the agent for `initiatorActorId`, and
|
|
570
|
+
* `consultationRoute` says who decides it: an `asker-decides` proposal waits inline for the person who
|
|
571
|
+
* asked and nobody decides it here (`assistant-consult-asker-decides`); a `subject-agent-rights`
|
|
572
|
+
* proposal runs with the agent's own rights and its asker may not decide it
|
|
573
|
+
* (`assistant-four-eyes-required`).
|
|
476
574
|
*/
|
|
477
575
|
interface NhAssistantMockProposal {
|
|
478
576
|
approvalId: string;
|
|
@@ -510,6 +608,17 @@ interface NhAssistantMockProposal {
|
|
|
510
608
|
canDecide?: boolean;
|
|
511
609
|
/** Why not, when `canDecide` is `false`. Default `assistant-approval-policy-denied`. */
|
|
512
610
|
reasonCode?: string | null;
|
|
611
|
+
/** The consultation that proposed it. Default none. */
|
|
612
|
+
consultationId?: string | null;
|
|
613
|
+
/** Who decides a consultation's proposal and whose rights run it. Default none. */
|
|
614
|
+
consultationRoute?: NhAssistantConsultationRoute | null;
|
|
615
|
+
/** The person who asked through the consultation, or who started the run. Default none. */
|
|
616
|
+
initiatorActorId?: string | null;
|
|
617
|
+
/**
|
|
618
|
+
* Whose rights execute it. Default `agent`, and `delegated` for a consultation's proposal that runs
|
|
619
|
+
* with the asker's rights.
|
|
620
|
+
*/
|
|
621
|
+
grantSource?: AgentGrantSource;
|
|
513
622
|
}
|
|
514
623
|
/** One request the mock API received, for assertions in tests. */
|
|
515
624
|
interface NhAssistantMockRequest {
|
|
@@ -600,6 +709,13 @@ declare class NhAssistantMockBackend {
|
|
|
600
709
|
* answer arrive as live updates. Resolves when the turn ends.
|
|
601
710
|
*/
|
|
602
711
|
simulateParticipantTurn(conversationId: string, person: NhAssistantMockPerson, text: string): Promise<void>;
|
|
712
|
+
/**
|
|
713
|
+
* Posts a message of the application into a conversation, as `INhAssistantConversationMessages`
|
|
714
|
+
* does on the server: it gets the next position in the conversation and reaches the people of the
|
|
715
|
+
* conversation as a live update. `trusted` marks an instruction for the assistant, as `Trusted`
|
|
716
|
+
* does on the server. Returns the stored message, or `null` for an unknown or archived conversation.
|
|
717
|
+
*/
|
|
718
|
+
postApplicationMessage(conversationId: string, text: string, details?: Partial<ApplicationMessageDetails>): Message | null;
|
|
603
719
|
/** Switches the simulated `NewHeap:AI:Assistant:Enabled` flag. */
|
|
604
720
|
setEnabled(enabled: boolean): void;
|
|
605
721
|
/** Switches whether the caller passes the admin policy (`canAdminister`, `admin/*`). */
|
|
@@ -637,6 +753,12 @@ declare class NhAssistantMockBackend {
|
|
|
637
753
|
private list;
|
|
638
754
|
private create;
|
|
639
755
|
private sendMessage;
|
|
756
|
+
/**
|
|
757
|
+
* `POST conversations/{id}/approvals/{approvalId}/decide`: approves or rejects the approval the
|
|
758
|
+
* turn waits for, or leaves a consulted agent's proposal with a `leaveRoute` for the subject's
|
|
759
|
+
* approvers (`leave`). Leaving closes it here, names the proposal that now waits at the subject
|
|
760
|
+
* (`consultation.movedToApprovalId`) and resumes the turn with the step's `left` steps.
|
|
761
|
+
*/
|
|
640
762
|
private decide;
|
|
641
763
|
private cancel;
|
|
642
764
|
private playSteps;
|
|
@@ -679,6 +801,11 @@ declare class NhAssistantMockBackend {
|
|
|
679
801
|
/** Whether the caller passes the agent's view policy, by default its required policy. */
|
|
680
802
|
private readsApplicationWork;
|
|
681
803
|
private decidesForApplication;
|
|
804
|
+
/**
|
|
805
|
+
* The scenario's consultations of a thread's agent, newest first, each with the proposals of the
|
|
806
|
+
* scenario that name it, counted per route; `null` when the scenario lists none there.
|
|
807
|
+
*/
|
|
808
|
+
private consultationsOf;
|
|
682
809
|
private nextId;
|
|
683
810
|
/** An administration answer about agents with each agent's groups, as the server answers it. */
|
|
684
811
|
private withGroups;
|
|
@@ -737,4 +864,4 @@ declare class NhAssistantMockLiveService implements NhAssistantLiveSurface {
|
|
|
737
864
|
declare function provideNhAssistantMockApi(script: NhAssistantMockScenario): EnvironmentProviders;
|
|
738
865
|
|
|
739
866
|
export { NH_ASSISTANT_MOCK_HUB_PATH, NH_ASSISTANT_MOCK_SCENARIO, NhAssistantMockAuthorizationWindow, NhAssistantMockBackend, NhAssistantMockLiveService, provideNhAssistantMockApi };
|
|
740
|
-
export type { NhAssistantMockAdminAgent, NhAssistantMockAdminScenario, NhAssistantMockAgentGroup, NhAssistantMockApprovalStep, NhAssistantMockCollaboration, NhAssistantMockConnectionStep, NhAssistantMockDataSkill, NhAssistantMockDataTrigger, NhAssistantMockDivision, NhAssistantMockErrorStep, NhAssistantMockFailStep, NhAssistantMockLiveMessage, NhAssistantMockMcpServer, NhAssistantMockPerson, NhAssistantMockProposal, NhAssistantMockRemoteTool, NhAssistantMockRequest, NhAssistantMockRun, NhAssistantMockRunConfigurationPreset, NhAssistantMockRunNow, NhAssistantMockScenario, NhAssistantMockStep, NhAssistantMockSubject, NhAssistantMockSubjectType, NhAssistantMockTextStep, NhAssistantMockTiming, NhAssistantMockToolStep, NhAssistantMockTurn, NhAssistantMockUpload };
|
|
867
|
+
export type { NhAssistantMockAdminAgent, NhAssistantMockAdminScenario, NhAssistantMockAgentGroup, NhAssistantMockApprovalConsultation, NhAssistantMockApprovalStep, NhAssistantMockCollaboration, NhAssistantMockConnectionStep, NhAssistantMockConsultation, NhAssistantMockConsultationCeiling, NhAssistantMockDataConsultation, NhAssistantMockDataSkill, NhAssistantMockDataTrigger, NhAssistantMockDivision, NhAssistantMockErrorStep, NhAssistantMockFailStep, NhAssistantMockLiveMessage, NhAssistantMockMcpServer, NhAssistantMockPerson, NhAssistantMockProposal, NhAssistantMockRemoteTool, NhAssistantMockRequest, NhAssistantMockRun, NhAssistantMockRunConfigurationPreset, NhAssistantMockRunNow, NhAssistantMockScenario, NhAssistantMockStep, NhAssistantMockSubject, NhAssistantMockSubjectType, NhAssistantMockTextStep, NhAssistantMockTiming, NhAssistantMockToolStep, NhAssistantMockTurn, NhAssistantMockUpload };
|