@newheap/platform-ai-chat 0.17.0 → 0.19.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 +396 -12
- package/agent-runs/index.d.ts +48 -7
- package/fesm2022/newheap-platform-ai-chat-admin.mjs +5772 -2918
- package/fesm2022/newheap-platform-ai-chat-admin.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat-agent-runs.mjs +127 -35
- package/fesm2022/newheap-platform-ai-chat-agent-runs.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat-testing.mjs +4153 -837
- package/fesm2022/newheap-platform-ai-chat-testing.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat.mjs +2168 -202
- package/fesm2022/newheap-platform-ai-chat.mjs.map +1 -1
- package/i18n/en.json +640 -13
- package/i18n/nl.json +640 -13
- package/index.d.ts +1334 -41
- package/package.json +1 -1
- package/push/nh-assistant-push-worker.js +13 -6
- package/testing/index.d.ts +285 -5
package/package.json
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* It shows a notification only when no window of the application is focused; otherwise it
|
|
9
9
|
* forwards the message to the open windows, which already show the conversation live. A click
|
|
10
10
|
* focuses an open window and opens the conversation there, or opens `app` with the conversation
|
|
11
|
-
* in the URL fragment.
|
|
11
|
+
* in the URL fragment. A notification about the proposals of a run also carries the run, which the
|
|
12
|
+
* click forwards, so the application can open its inbox of the run (`openRun$`). Notifications
|
|
13
|
+
* carry a conversation id, a run id and short texts only.
|
|
12
14
|
*/
|
|
13
15
|
const settings = new URL(self.location.href).searchParams;
|
|
14
16
|
const appUrl = settings.get('app') || '/';
|
|
@@ -27,12 +29,13 @@ self.addEventListener('push', event => {
|
|
|
27
29
|
if (!payload || payload.type !== 'nh-assistant' || typeof payload.conversationId !== 'string') {
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
32
|
+
const runId = typeof payload.runId === 'string' ? payload.runId : undefined;
|
|
30
33
|
|
|
31
34
|
event.waitUntil((async () => {
|
|
32
35
|
const windows = await self.clients.matchAll({ type: 'window', includeUncontrolled: true });
|
|
33
36
|
if (windows.some(client => client.focused && client.visibilityState === 'visible')) {
|
|
34
37
|
for (const client of windows) {
|
|
35
|
-
client.postMessage({ type: 'nh-assistant.push', kind: payload.kind, conversationId: payload.conversationId });
|
|
38
|
+
client.postMessage({ type: 'nh-assistant.push', kind: payload.kind, conversationId: payload.conversationId, runId });
|
|
36
39
|
}
|
|
37
40
|
return;
|
|
38
41
|
}
|
|
@@ -42,29 +45,33 @@ self.addEventListener('push', event => {
|
|
|
42
45
|
tag: String(payload.tag || `nh-assistant:${payload.conversationId}`),
|
|
43
46
|
renotify: true,
|
|
44
47
|
icon: iconUrl,
|
|
45
|
-
data: { conversationId: payload.conversationId }
|
|
48
|
+
data: { conversationId: payload.conversationId, runId }
|
|
46
49
|
});
|
|
47
50
|
})());
|
|
48
51
|
});
|
|
49
52
|
|
|
50
53
|
self.addEventListener('notificationclick', event => {
|
|
51
54
|
event.notification.close();
|
|
52
|
-
const
|
|
55
|
+
const data = event.notification.data || {};
|
|
56
|
+
const conversationId = data.conversationId;
|
|
53
57
|
if (typeof conversationId !== 'string') {
|
|
54
58
|
return;
|
|
55
59
|
}
|
|
60
|
+
const runId = typeof data.runId === 'string' ? data.runId : undefined;
|
|
56
61
|
|
|
57
62
|
event.waitUntil((async () => {
|
|
58
63
|
const windows = await self.clients.matchAll({ type: 'window', includeUncontrolled: true });
|
|
59
64
|
const target = windows.find(client => client.focused) || windows[0];
|
|
60
65
|
if (target) {
|
|
61
66
|
await target.focus();
|
|
62
|
-
target.postMessage({ type: 'nh-assistant.open-conversation', conversationId });
|
|
67
|
+
target.postMessage({ type: 'nh-assistant.open-conversation', conversationId, runId });
|
|
63
68
|
return;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
const url = new URL(appUrl, self.location.origin);
|
|
67
|
-
url.hash =
|
|
72
|
+
url.hash = runId
|
|
73
|
+
? `nh-assistant-run=${encodeURIComponent(runId)}.${encodeURIComponent(conversationId)}`
|
|
74
|
+
: `nh-assistant-conversation=${encodeURIComponent(conversationId)}`;
|
|
68
75
|
await self.clients.openWindow(url.href);
|
|
69
76
|
})());
|
|
70
77
|
});
|
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, AgentPackage, 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: {
|
|
@@ -115,6 +136,31 @@ interface NhAssistantMockMcpServer extends McpServerInput {
|
|
|
115
136
|
/** A server each person connects to starts with the caller's own account connected. */
|
|
116
137
|
personalConnected?: boolean;
|
|
117
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* An entry of agent metadata as the application registers it with `AddAgentMetadata`: its name,
|
|
141
|
+
* whether administrators may override it on agents in code, its size limit, its searchable value and
|
|
142
|
+
* its checks.
|
|
143
|
+
*/
|
|
144
|
+
interface NhAssistantMockAgentMetadataEntry {
|
|
145
|
+
/** The entry's dash-case name. */
|
|
146
|
+
name: string;
|
|
147
|
+
/** Administrators may override it on agents in code, as `Editable()`. */
|
|
148
|
+
editable?: boolean;
|
|
149
|
+
/** The largest value in bytes of its JSON; 4,096 by default. */
|
|
150
|
+
maxBytes?: number;
|
|
151
|
+
/** The field of the value whose text is its searchable value, as `IndexBy`. */
|
|
152
|
+
indexBy?: string;
|
|
153
|
+
/**
|
|
154
|
+
* The fields of the entry's type: a value with another field is refused with `value: invalid`, as
|
|
155
|
+
* the server refuses JSON that does not fit the type. Without it every field is accepted.
|
|
156
|
+
*/
|
|
157
|
+
fields?: string[];
|
|
158
|
+
/**
|
|
159
|
+
* Checks a value as the application's validators do: codes by field path, `''` for the whole value,
|
|
160
|
+
* such as `{ code: ['unknown-code'] }`; `null` or an empty record accepts it.
|
|
161
|
+
*/
|
|
162
|
+
validate?: (value: Record<string, unknown>) => Record<string, string[]> | null;
|
|
163
|
+
}
|
|
118
164
|
/**
|
|
119
165
|
* A preconfigured agent. Code agents default to the scenario's chat agents. `startsOff` starts it
|
|
120
166
|
* off, as `StartsOff()` in code does for an agent in code.
|
|
@@ -131,12 +177,46 @@ interface NhAssistantMockAdminAgent extends AdminAgentInput {
|
|
|
131
177
|
shadow?: boolean;
|
|
132
178
|
startsOff?: boolean;
|
|
133
179
|
}[];
|
|
134
|
-
/**
|
|
135
|
-
|
|
180
|
+
/**
|
|
181
|
+
* The live agent this code agent is a shadow variant of, as `ShadowOf` in code. A data variant is
|
|
182
|
+
* created with `POST admin/agents` and `shadowOf` instead.
|
|
183
|
+
*/
|
|
184
|
+
shadowOf?: string | null;
|
|
136
185
|
/** The agent starts in shadow, as with `Shadow()` in code. */
|
|
137
186
|
shadow?: boolean;
|
|
138
187
|
/** The technical account in code, as with `ServiceAccount(actorId)`. */
|
|
139
188
|
serviceAccount?: string;
|
|
189
|
+
/**
|
|
190
|
+
* The routes that the consultations of a code agent allow, with the subject types whose
|
|
191
|
+
* consultation allows each, as `AllowConsultation` in code, such as
|
|
192
|
+
* `{ 'asker-decides': ['project'], 'subject-asker-rights': ['project'] }`; a route without types is
|
|
193
|
+
* not allowed. Without it nobody can consult the agent and its state has no `consultationRoutes`.
|
|
194
|
+
*/
|
|
195
|
+
consultations?: Partial<Record<NhAssistantConsultationRoute, string[]>>;
|
|
196
|
+
/**
|
|
197
|
+
* The descriptions of a code agent's consultations in code, by subject type, as `Description` in
|
|
198
|
+
* `AllowConsultation`. A type listed here and in no route of `consultations` is a consultation in
|
|
199
|
+
* code that only answers.
|
|
200
|
+
*/
|
|
201
|
+
consultationDescriptions?: Record<string, string>;
|
|
202
|
+
/**
|
|
203
|
+
* The tool selections of a code agent's consultations in code, by subject type, as `Tools` in
|
|
204
|
+
* `AllowConsultation`; a type without one offers every tool of the agent.
|
|
205
|
+
*/
|
|
206
|
+
consultationTools?: Record<string, string[]>;
|
|
207
|
+
/**
|
|
208
|
+
* The ceiling of a code agent that administrators may make consultable as data, as
|
|
209
|
+
* `ConsultableAsData` in code; it applies together with the scenario's `consultationsAsData`. `{}`
|
|
210
|
+
* allows answers only, as `ConsultableAsData()` without a configuration does. Without it a code
|
|
211
|
+
* agent gets no consultations as data.
|
|
212
|
+
*/
|
|
213
|
+
consultableAsData?: NhAssistantMockConsultationCeiling;
|
|
214
|
+
/**
|
|
215
|
+
* The consultations defined as data the agent starts with, as administrators saved them. The mock
|
|
216
|
+
* saves them through its own endpoint after the agent's run configuration, so each is checked as an
|
|
217
|
+
* administrator's save is; a consultation the mock refuses fails the scenario at once.
|
|
218
|
+
*/
|
|
219
|
+
dataConsultations?: NhAssistantMockDataConsultation[];
|
|
140
220
|
/**
|
|
141
221
|
* Whether a code agent says what it works on, as with `WorksOn`; by default it does when the
|
|
142
222
|
* scenario gives `worksOnSubjectTypes`, `worksOnAllSubjects` or `worksOnApplication`.
|
|
@@ -156,6 +236,69 @@ interface NhAssistantMockAdminAgent extends AdminAgentInput {
|
|
|
156
236
|
* the administration offers the guided setup.
|
|
157
237
|
*/
|
|
158
238
|
runConfiguration?: NhAssistantMockRunConfigurationPreset;
|
|
239
|
+
/**
|
|
240
|
+
* The hand-offs a code agent accepts in code, as `AcceptHandOffs`; they cannot change in the
|
|
241
|
+
* administration, and a hand-off as data about the same type is refused.
|
|
242
|
+
*/
|
|
243
|
+
codeHandOffs?: NhAssistantMockCodeHandOff[];
|
|
244
|
+
}
|
|
245
|
+
/** A hand-off a code agent of the scenario accepts in code. */
|
|
246
|
+
interface NhAssistantMockCodeHandOff {
|
|
247
|
+
subjectType: string;
|
|
248
|
+
sources: string[];
|
|
249
|
+
description?: string;
|
|
250
|
+
notifySource?: boolean;
|
|
251
|
+
/** 5 by default, as in code. */
|
|
252
|
+
maxPerSubjectPerDay?: number;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* The ceiling in code of hand-offs defined as data, as `UseHandOffsAsData`: per subject type the
|
|
256
|
+
* agents that may accept them as data and the agents that may hand off, and the highest daily limit
|
|
257
|
+
* (100 by default).
|
|
258
|
+
*/
|
|
259
|
+
interface NhAssistantMockHandOffCeiling {
|
|
260
|
+
rules: NhAssistantMockHandOffRule[];
|
|
261
|
+
maxPerSubjectPerDay?: number;
|
|
262
|
+
}
|
|
263
|
+
/** One connection of the ceiling, as `Allow(subjectType, rule => rule.To(...).From(...))`. */
|
|
264
|
+
interface NhAssistantMockHandOffRule {
|
|
265
|
+
subjectType: string;
|
|
266
|
+
to?: string[];
|
|
267
|
+
toAgentsCreatedInAdministration?: boolean;
|
|
268
|
+
from?: string[];
|
|
269
|
+
fromAgentsCreatedInAdministration?: boolean;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* The ceiling in code of shadow variants created as data, as `UseShadowVariantsAsData`: the live agents
|
|
273
|
+
* in code that may get them, whether agents created in the administration may too, and how many each
|
|
274
|
+
* (3 by default).
|
|
275
|
+
*/
|
|
276
|
+
interface NhAssistantMockShadowVariantCeiling {
|
|
277
|
+
of?: string[];
|
|
278
|
+
ofAgentsCreatedInAdministration?: boolean;
|
|
279
|
+
maxPerAgent?: number;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* A ceiling in code of consultations defined as data, as `NhAssistantConsultationCeilingBuilder`
|
|
283
|
+
* configures one: the routes data may use (none by default, which allows answers only), whether data
|
|
284
|
+
* may generate request tools and offer them to MCP clients (both off by default), and the highest
|
|
285
|
+
* limits (by default the bounds of `AllowConsultation`: 32 tool calls, 600 seconds, 32,000
|
|
286
|
+
* characters and 200 messages).
|
|
287
|
+
*/
|
|
288
|
+
interface NhAssistantMockConsultationCeiling {
|
|
289
|
+
routes?: NhAssistantConsultationRoute[];
|
|
290
|
+
allowRequests?: boolean;
|
|
291
|
+
allowMcp?: boolean;
|
|
292
|
+
maxToolCalls?: number;
|
|
293
|
+
maxTimeoutSeconds?: number;
|
|
294
|
+
maxAnswerChars?: number;
|
|
295
|
+
maxHistoryMessages?: number;
|
|
296
|
+
/** Every new consultation defined as data starts off until an administrator switches it on (`StartOff()`). */
|
|
297
|
+
startsOff?: boolean;
|
|
298
|
+
}
|
|
299
|
+
/** A consultation defined as data an agent of the scenario starts with. */
|
|
300
|
+
interface NhAssistantMockDataConsultation extends DataConsultationRequest {
|
|
301
|
+
subjectType: string;
|
|
159
302
|
}
|
|
160
303
|
/**
|
|
161
304
|
* The run configuration as data an agent created in the administration starts with. The mock saves it
|
|
@@ -227,6 +370,29 @@ interface NhAssistantMockAdminScenario {
|
|
|
227
370
|
* administration work per division, as an application that lists its divisions does.
|
|
228
371
|
*/
|
|
229
372
|
runCatalog?: Partial<RunCatalog>;
|
|
373
|
+
/**
|
|
374
|
+
* The entries of agent metadata the application registers in code with `AddAgentMetadata`, which
|
|
375
|
+
* the run catalog lists as `agentMetadata`; the scenario's agents give their values in
|
|
376
|
+
* `metadata`, in code for an agent in code and stored for an agent created as data. Default none.
|
|
377
|
+
*/
|
|
378
|
+
agentMetadata?: NhAssistantMockAgentMetadataEntry[];
|
|
379
|
+
/**
|
|
380
|
+
* Lets administrators define consultations as data within this ceiling, as `UseConsultationsAsData`
|
|
381
|
+
* in code: agents created in the administration with run settings get it, and code agents with
|
|
382
|
+
* `consultableAsData` get it together with their own. The run catalog reports it as
|
|
383
|
+
* `consultationCeiling`. Without it consultations exist in code only.
|
|
384
|
+
*/
|
|
385
|
+
consultationsAsData?: NhAssistantMockConsultationCeiling;
|
|
386
|
+
/**
|
|
387
|
+
* Lets administrators define hand-offs as data within this ceiling, as `UseHandOffsAsData` in code.
|
|
388
|
+
* Without it hand-offs exist in code only.
|
|
389
|
+
*/
|
|
390
|
+
handOffsAsData?: NhAssistantMockHandOffCeiling;
|
|
391
|
+
/**
|
|
392
|
+
* Lets administrators create shadow variants as data within this ceiling, as
|
|
393
|
+
* `UseShadowVariantsAsData` in code. Without it shadow variants exist in code only.
|
|
394
|
+
*/
|
|
395
|
+
shadowVariantsAsData?: NhAssistantMockShadowVariantCeiling;
|
|
230
396
|
/**
|
|
231
397
|
* The data classifications each model profile and its fallbacks permit together, by profile name.
|
|
232
398
|
* An agent or skill whose classification its profile does not permit is saved with the warning
|
|
@@ -251,6 +417,36 @@ interface NhAssistantMockAdminScenario {
|
|
|
251
417
|
* unavailable and any id that does not start with `unknown` is accepted.
|
|
252
418
|
*/
|
|
253
419
|
accounts?: AssistantAccount[];
|
|
420
|
+
/**
|
|
421
|
+
* The application's text assets for instructions, as its `INhAiTextAssetSource` supplies them
|
|
422
|
+
* (`UseTextAssetSource`): the run catalog reports `instructionAssets`, `GET admin/instruction-assets`
|
|
423
|
+
* lists them, and skills and agents created in the administration may name one instead of inline
|
|
424
|
+
* instructions. Without it the application offers none. Change them afterwards with
|
|
425
|
+
* `NhAssistantMockBackend.setInstructionAsset` and `removeInstructionAsset`.
|
|
426
|
+
*/
|
|
427
|
+
instructionAssets?: NhAssistantMockInstructionAsset[];
|
|
428
|
+
/**
|
|
429
|
+
* Agent packages the host imported before the mock starts, in order, as `POST
|
|
430
|
+
* admin/agent-packages/import` imports them after the scenario's agents and run configurations:
|
|
431
|
+
* their parts are linked and the parts they lock show read-only. A package the import refuses fails
|
|
432
|
+
* the scenario at once.
|
|
433
|
+
*/
|
|
434
|
+
agentPackages?: NhAssistantMockAgentPackage[];
|
|
435
|
+
}
|
|
436
|
+
/** An agent package the mock's host imported, with the options of its import. */
|
|
437
|
+
interface NhAssistantMockAgentPackage {
|
|
438
|
+
package: AgentPackage;
|
|
439
|
+
/** The technical account per agent whose run settings answer to one. */
|
|
440
|
+
serviceAccounts?: Record<string, string>;
|
|
441
|
+
}
|
|
442
|
+
/** One version of a text asset of the mock's application. */
|
|
443
|
+
interface NhAssistantMockInstructionAsset {
|
|
444
|
+
assetId: string;
|
|
445
|
+
version: number;
|
|
446
|
+
content: string;
|
|
447
|
+
/** The asset that replaces it, when the application deprecated it. */
|
|
448
|
+
replacedByAssetId?: string;
|
|
449
|
+
deprecatedAt?: string;
|
|
254
450
|
}
|
|
255
451
|
/** A person in the simulated organization. */
|
|
256
452
|
interface NhAssistantMockPerson {
|
|
@@ -454,6 +650,12 @@ interface NhAssistantMockScenario {
|
|
|
454
650
|
* the approval inbox, their thread and their subject's work list them, and people decide them.
|
|
455
651
|
*/
|
|
456
652
|
proposals?: NhAssistantMockProposal[];
|
|
653
|
+
/**
|
|
654
|
+
* Consultations of agents by other assistants, as the consulted agent's thread lists them
|
|
655
|
+
* (`GET threads/{id}/consultations`), newest first. Their proposals are those of `proposals` that
|
|
656
|
+
* name them (`consultationId`), counted per route.
|
|
657
|
+
*/
|
|
658
|
+
consultations?: NhAssistantMockConsultation[];
|
|
457
659
|
/**
|
|
458
660
|
* The application's own answer to an upload that passed the assistant's checks: `null` stores it,
|
|
459
661
|
* a code refuses it as the server passes the file source's refusal on, for example
|
|
@@ -470,9 +672,27 @@ interface NhAssistantMockScenario {
|
|
|
470
672
|
*/
|
|
471
673
|
scanUpload?: (upload: NhAssistantMockUpload) => 'refused' | 'failed' | null;
|
|
472
674
|
}
|
|
675
|
+
/** A consultation of an agent by another assistant, as the consulted agent's thread lists it. */
|
|
676
|
+
interface NhAssistantMockConsultation {
|
|
677
|
+
id: string;
|
|
678
|
+
/** The consulted agent's thread. */
|
|
679
|
+
conversationId: string;
|
|
680
|
+
askerActorId: string;
|
|
681
|
+
askerDisplayName?: string | null;
|
|
682
|
+
askingAgentId?: string | null;
|
|
683
|
+
/** Default `completed`. */
|
|
684
|
+
status?: AgentConsultationStatus;
|
|
685
|
+
/** When it started, an ISO date. Default when the mock started. */
|
|
686
|
+
createdAt?: string;
|
|
687
|
+
}
|
|
473
688
|
/**
|
|
474
689
|
* A proposal an agent left, as the mock serves it; the mock fills what it leaves out. With
|
|
475
690
|
* `placedBy` a run placed it here from another subject, such as a run for the whole application.
|
|
691
|
+
* With `consultationId` another assistant consulted the agent for `initiatorActorId`, and
|
|
692
|
+
* `consultationRoute` says who decides it: an `asker-decides` proposal waits inline for the person who
|
|
693
|
+
* asked and nobody decides it here (`assistant-consult-asker-decides`); a `subject-agent-rights`
|
|
694
|
+
* proposal runs with the agent's own rights and its asker may not decide it
|
|
695
|
+
* (`assistant-four-eyes-required`).
|
|
476
696
|
*/
|
|
477
697
|
interface NhAssistantMockProposal {
|
|
478
698
|
approvalId: string;
|
|
@@ -510,6 +730,31 @@ interface NhAssistantMockProposal {
|
|
|
510
730
|
canDecide?: boolean;
|
|
511
731
|
/** Why not, when `canDecide` is `false`. Default `assistant-approval-policy-denied`. */
|
|
512
732
|
reasonCode?: string | null;
|
|
733
|
+
/** The consultation that proposed it. Default none. */
|
|
734
|
+
consultationId?: string | null;
|
|
735
|
+
/** Who decides a consultation's proposal and whose rights run it. Default none. */
|
|
736
|
+
consultationRoute?: NhAssistantConsultationRoute | null;
|
|
737
|
+
/** The person who asked through the consultation, or who started the run. Default none. */
|
|
738
|
+
initiatorActorId?: string | null;
|
|
739
|
+
/**
|
|
740
|
+
* Whose rights execute it. Default `agent`, and `delegated` for a consultation's proposal that runs
|
|
741
|
+
* with the asker's rights.
|
|
742
|
+
*/
|
|
743
|
+
grantSource?: AgentGrantSource;
|
|
744
|
+
/**
|
|
745
|
+
* Whether the application executes the proposal's tool (`ExecuteInApplication` on the server).
|
|
746
|
+
* Default `false`. Approved, such a proposal waits as `awaiting-application` until its report is due,
|
|
747
|
+
* four hours later; an `execution-unknown` one is handed to the application again
|
|
748
|
+
* (`POST approvals/{id}/resolve` with `hand-to-application`) instead of running again.
|
|
749
|
+
*/
|
|
750
|
+
executedByApplication?: boolean;
|
|
751
|
+
/**
|
|
752
|
+
* When the application's report is due, an ISO date, for a proposal listed as `awaiting-application`
|
|
753
|
+
* or `execution-unknown` that the application executes. Default four hours after it was made.
|
|
754
|
+
*/
|
|
755
|
+
executionReportDueAt?: string | null;
|
|
756
|
+
/** The execution's result code, such as `report-overdue`. Default none. */
|
|
757
|
+
executionResultCode?: string | null;
|
|
513
758
|
}
|
|
514
759
|
/** One request the mock API received, for assertions in tests. */
|
|
515
760
|
interface NhAssistantMockRequest {
|
|
@@ -578,6 +823,9 @@ declare class NhAssistantMockBackend {
|
|
|
578
823
|
private readonly subjects;
|
|
579
824
|
private readonly agentRuns;
|
|
580
825
|
private readonly boards;
|
|
826
|
+
private readonly agentMetadata;
|
|
827
|
+
/** Agent packages: their endpoints, and the locks and links of every other administration request. */
|
|
828
|
+
private readonly agentPackages;
|
|
581
829
|
private readonly canAdministerState;
|
|
582
830
|
private readonly members;
|
|
583
831
|
private readonly readPositions;
|
|
@@ -600,6 +848,13 @@ declare class NhAssistantMockBackend {
|
|
|
600
848
|
* answer arrive as live updates. Resolves when the turn ends.
|
|
601
849
|
*/
|
|
602
850
|
simulateParticipantTurn(conversationId: string, person: NhAssistantMockPerson, text: string): Promise<void>;
|
|
851
|
+
/**
|
|
852
|
+
* Posts a message of the application into a conversation, as `INhAssistantConversationMessages`
|
|
853
|
+
* does on the server: it gets the next position in the conversation and reaches the people of the
|
|
854
|
+
* conversation as a live update. `trusted` marks an instruction for the assistant, as `Trusted`
|
|
855
|
+
* does on the server. Returns the stored message, or `null` for an unknown or archived conversation.
|
|
856
|
+
*/
|
|
857
|
+
postApplicationMessage(conversationId: string, text: string, details?: Partial<ApplicationMessageDetails>): Message | null;
|
|
603
858
|
/** Switches the simulated `NewHeap:AI:Assistant:Enabled` flag. */
|
|
604
859
|
setEnabled(enabled: boolean): void;
|
|
605
860
|
/** Switches whether the caller passes the admin policy (`canAdminister`, `admin/*`). */
|
|
@@ -618,6 +873,13 @@ declare class NhAssistantMockBackend {
|
|
|
618
873
|
* (`reauthorization-required`) or another authorization server (`issuer-changed`).
|
|
619
874
|
*/
|
|
620
875
|
setMcpConnectionStatus(serverId: string, status: 'reauthorization-required' | 'issuer-changed'): void;
|
|
876
|
+
/**
|
|
877
|
+
* Publishes or changes one version of a text asset of the application. A skill or agent that names
|
|
878
|
+
* this version with another hash then reports `asset-changed`, as after the server's next load.
|
|
879
|
+
*/
|
|
880
|
+
setInstructionAsset(asset: NhAssistantMockInstructionAsset): void;
|
|
881
|
+
/** Removes one version of a text asset; what names it reports `asset-missing`. */
|
|
882
|
+
removeInstructionAsset(assetId: string, version: number): void;
|
|
621
883
|
/** The files people uploaded, oldest first, as the application's file source stored them. */
|
|
622
884
|
get uploads(): readonly {
|
|
623
885
|
conversationId: string;
|
|
@@ -637,6 +899,12 @@ declare class NhAssistantMockBackend {
|
|
|
637
899
|
private list;
|
|
638
900
|
private create;
|
|
639
901
|
private sendMessage;
|
|
902
|
+
/**
|
|
903
|
+
* `POST conversations/{id}/approvals/{approvalId}/decide`: approves or rejects the approval the
|
|
904
|
+
* turn waits for, or leaves a consulted agent's proposal with a `leaveRoute` for the subject's
|
|
905
|
+
* approvers (`leave`). Leaving closes it here, names the proposal that now waits at the subject
|
|
906
|
+
* (`consultation.movedToApprovalId`) and resumes the turn with the step's `left` steps.
|
|
907
|
+
*/
|
|
640
908
|
private decide;
|
|
641
909
|
private cancel;
|
|
642
910
|
private playSteps;
|
|
@@ -679,7 +947,19 @@ declare class NhAssistantMockBackend {
|
|
|
679
947
|
/** Whether the caller passes the agent's view policy, by default its required policy. */
|
|
680
948
|
private readsApplicationWork;
|
|
681
949
|
private decidesForApplication;
|
|
950
|
+
/**
|
|
951
|
+
* The scenario's consultations of a thread's agent, newest first, each with the proposals of the
|
|
952
|
+
* scenario that name it, counted per route; `null` when the scenario lists none there.
|
|
953
|
+
*/
|
|
954
|
+
private consultationsOf;
|
|
682
955
|
private nextId;
|
|
956
|
+
/**
|
|
957
|
+
* The answer of an administration endpoint (`admin/...`) as its area gives it, with the groups of
|
|
958
|
+
* agents and the run catalog in the request's language, without the package locks and links.
|
|
959
|
+
*/
|
|
960
|
+
private adminResult;
|
|
961
|
+
/** An administration request of the agent packages, as `adminResult` answers it, for a path with its query. */
|
|
962
|
+
private adminCall;
|
|
683
963
|
/** An administration answer about agents with each agent's groups, as the server answers it. */
|
|
684
964
|
private withGroups;
|
|
685
965
|
private groupsOf;
|
|
@@ -737,4 +1017,4 @@ declare class NhAssistantMockLiveService implements NhAssistantLiveSurface {
|
|
|
737
1017
|
declare function provideNhAssistantMockApi(script: NhAssistantMockScenario): EnvironmentProviders;
|
|
738
1018
|
|
|
739
1019
|
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 };
|
|
1020
|
+
export type { NhAssistantMockAdminAgent, NhAssistantMockAdminScenario, NhAssistantMockAgentGroup, NhAssistantMockAgentMetadataEntry, NhAssistantMockAgentPackage, NhAssistantMockApprovalConsultation, NhAssistantMockApprovalStep, NhAssistantMockCodeHandOff, NhAssistantMockCollaboration, NhAssistantMockConnectionStep, NhAssistantMockConsultation, NhAssistantMockConsultationCeiling, NhAssistantMockDataConsultation, NhAssistantMockDataSkill, NhAssistantMockDataTrigger, NhAssistantMockDivision, NhAssistantMockErrorStep, NhAssistantMockFailStep, NhAssistantMockHandOffCeiling, NhAssistantMockHandOffRule, NhAssistantMockInstructionAsset, NhAssistantMockLiveMessage, NhAssistantMockMcpServer, NhAssistantMockPerson, NhAssistantMockProposal, NhAssistantMockRemoteTool, NhAssistantMockRequest, NhAssistantMockRun, NhAssistantMockRunConfigurationPreset, NhAssistantMockRunNow, NhAssistantMockScenario, NhAssistantMockShadowVariantCeiling, NhAssistantMockStep, NhAssistantMockSubject, NhAssistantMockSubjectType, NhAssistantMockTextStep, NhAssistantMockTiming, NhAssistantMockToolStep, NhAssistantMockTurn, NhAssistantMockUpload };
|