@newheap/platform-ai-chat 0.14.0 → 0.15.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 +27 -0
- package/admin/index.d.ts +665 -77
- package/agent-runs/index.d.ts +450 -17
- package/fesm2022/newheap-platform-ai-chat-admin.mjs +3417 -361
- package/fesm2022/newheap-platform-ai-chat-admin.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat-agent-runs.mjs +1288 -61
- package/fesm2022/newheap-platform-ai-chat-agent-runs.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat-testing.mjs +4023 -777
- package/fesm2022/newheap-platform-ai-chat-testing.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat.mjs +3135 -541
- package/fesm2022/newheap-platform-ai-chat.mjs.map +1 -1
- package/i18n/en.json +741 -28
- package/i18n/nl.json +741 -28
- package/index.d.ts +1293 -20
- package/package.json +1 -1
- package/testing/index.d.ts +379 -22
package/package.json
CHANGED
package/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AssistantStatus, AgentSummary, Conversation, ClientContext, AssistantPreferences, ToolCatalogEntry, AdminAgentInput, McpServerInput, RunCatalog, LiveConversationChanged, LiveConversationRead, LiveConversationRemoved, LiveConversationEvent,
|
|
2
|
-
import * as
|
|
1
|
+
import { AssistantStatus, AgentSummary, Conversation, ClientContext, AssistantPreferences, ToolCatalogEntry, AdminAgentInput, CodeRunSettings, AgentRunSettingsRequest, DataSkillRequest, DataTriggerRequest, McpServerInput, McpCustomAuthMode, McpDiscovery, RunCatalog, AssistantAccount, AgentRunStatus, AgentTriggerReceipt, AgentRunMcpSkip, ApprovalPresentation, AgentProposalStatus, AgentProposalOrigin, NhAssistantMcpAuthorizationWindow, NhAssistantMcpAuthorizationOutcome, NhAssistantMcpAuthorizationHandle, LiveConversationChanged, LiveConversationRead, LiveConversationRemoved, LiveConversationEvent, LiveAgentWorkChanged, NhAssistantLiveService, NhAssistantLiveState } from '@newheap/platform-ai-chat';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
3
|
import { InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
|
|
@@ -64,7 +64,18 @@ interface NhAssistantMockFailStep {
|
|
|
64
64
|
errorCode: string;
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Needs the caller's own connection to an MCP server each person connects to (`connectionScope:
|
|
69
|
+
* 'user'`). Without an active connection the mock streams `connection.required`, adds `text` and
|
|
70
|
+
* ends the turn; with one the step is skipped and the next steps play.
|
|
71
|
+
*/
|
|
72
|
+
interface NhAssistantMockConnectionStep {
|
|
73
|
+
connectionRequired: {
|
|
74
|
+
serverId: string;
|
|
75
|
+
text?: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
type NhAssistantMockStep = NhAssistantMockTextStep | NhAssistantMockToolStep | NhAssistantMockApprovalStep | NhAssistantMockErrorStep | NhAssistantMockFailStep | NhAssistantMockConnectionStep;
|
|
68
79
|
/** A scripted assistant turn, chosen by matching the user's message. */
|
|
69
80
|
interface NhAssistantMockTurn {
|
|
70
81
|
/** Case-insensitive substring, regular expression or predicate. Omit to match every message. */
|
|
@@ -88,9 +99,13 @@ interface NhAssistantMockRemoteTool {
|
|
|
88
99
|
/** Remote annotation; the mock passes it on as an untrusted hint. */
|
|
89
100
|
readOnlyHint?: boolean | null;
|
|
90
101
|
}
|
|
91
|
-
/** A simulated MCP server. The mock stores `secret` but never returns
|
|
102
|
+
/** A simulated MCP server. The mock stores `secret` and `oauth.clientSecret` but never returns them. */
|
|
92
103
|
interface NhAssistantMockMcpServer extends McpServerInput {
|
|
93
104
|
remoteTools?: NhAssistantMockRemoteTool[];
|
|
105
|
+
/** An `oauth` organization server starts connected. */
|
|
106
|
+
organizationConnected?: boolean;
|
|
107
|
+
/** A server each person connects to starts with the caller's own account connected. */
|
|
108
|
+
personalConnected?: boolean;
|
|
94
109
|
}
|
|
95
110
|
/** A preconfigured agent. Code agents default to the scenario's chat agents. */
|
|
96
111
|
interface NhAssistantMockAdminAgent extends AdminAgentInput {
|
|
@@ -107,6 +122,49 @@ interface NhAssistantMockAdminAgent extends AdminAgentInput {
|
|
|
107
122
|
shadow?: boolean;
|
|
108
123
|
/** The technical account in code, as with `ServiceAccount(actorId)`. */
|
|
109
124
|
serviceAccount?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Whether a code agent says what it works on, as with `WorksOn`; by default it does when the
|
|
127
|
+
* scenario gives `worksOnSubjectTypes`, `worksOnAllSubjects` or `worksOnApplication`.
|
|
128
|
+
*/
|
|
129
|
+
worksOnDeclared?: boolean;
|
|
130
|
+
/** The object types the agent is known to work on, shown as a hint next to "All objects". */
|
|
131
|
+
knownSubjectTypes?: string[];
|
|
132
|
+
/**
|
|
133
|
+
* How a code agent runs, as its code says (`codeRunSettings` of its run configuration). By default
|
|
134
|
+
* it answers to its `serviceAccount` when it has one and to itself otherwise, with the platform's
|
|
135
|
+
* approval policy and the model.
|
|
136
|
+
*/
|
|
137
|
+
codeRunSettings?: Partial<CodeRunSettings>;
|
|
138
|
+
/**
|
|
139
|
+
* The run configuration an agent created in the administration starts with, as administrators saved
|
|
140
|
+
* it: its run settings, skills and triggers defined as data. Without it such an agent has none and
|
|
141
|
+
* the administration offers the guided setup.
|
|
142
|
+
*/
|
|
143
|
+
runConfiguration?: NhAssistantMockRunConfigurationPreset;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The run configuration as data an agent created in the administration starts with. The mock saves it
|
|
147
|
+
* through its own endpoints in order (the run settings, then each skill, then each trigger), so every
|
|
148
|
+
* part is checked as an administrator's save is, against the scenario's run catalog and accounts; a
|
|
149
|
+
* part the mock refuses fails the scenario at once, like a startup check. Skills and triggers start in
|
|
150
|
+
* shadow, as saved ones do, unless `shadow` is `false`.
|
|
151
|
+
*/
|
|
152
|
+
interface NhAssistantMockRunConfigurationPreset {
|
|
153
|
+
runSettings: AgentRunSettingsRequest;
|
|
154
|
+
skills?: NhAssistantMockDataSkill[];
|
|
155
|
+
triggers?: NhAssistantMockDataTrigger[];
|
|
156
|
+
}
|
|
157
|
+
/** A skill defined as data of a preset run configuration. */
|
|
158
|
+
interface NhAssistantMockDataSkill extends DataSkillRequest {
|
|
159
|
+
skillId: string;
|
|
160
|
+
/** Default `true`, as for a saved skill; `false` puts it live. */
|
|
161
|
+
shadow?: boolean;
|
|
162
|
+
}
|
|
163
|
+
/** A trigger defined as data of a preset run configuration. */
|
|
164
|
+
interface NhAssistantMockDataTrigger extends DataTriggerRequest {
|
|
165
|
+
triggerId: string;
|
|
166
|
+
/** Default `true`, as for a saved trigger; `false` puts it live. */
|
|
167
|
+
shadow?: boolean;
|
|
110
168
|
}
|
|
111
169
|
/**
|
|
112
170
|
* Administration data of the mock. Hosts without an admin scenario still get working
|
|
@@ -120,22 +178,57 @@ interface NhAssistantMockAdminScenario {
|
|
|
120
178
|
tools?: ToolCatalogEntry[];
|
|
121
179
|
agents?: NhAssistantMockAdminAgent[];
|
|
122
180
|
mcpServers?: NhAssistantMockMcpServer[];
|
|
181
|
+
/**
|
|
182
|
+
* Authentication modes the application registered in code (`AddMcpCredentialProvider`), which
|
|
183
|
+
* `GET admin/mcp-auth-modes` lists and servers may use. Default none.
|
|
184
|
+
*/
|
|
185
|
+
mcpAuthModes?: McpCustomAuthMode[];
|
|
123
186
|
/** Policies the host knows; `requiredPolicy` must be one of them. Default: any value. */
|
|
124
187
|
policies?: string[];
|
|
125
188
|
/** Hosts that may receive the user's token (`forward-user-token`). Default: none. */
|
|
126
189
|
forwardUserTokenHosts?: string[];
|
|
190
|
+
/** Secret references that name an available secret. Default: every `config:` reference. */
|
|
191
|
+
secretReferences?: string[];
|
|
192
|
+
/** Client certificate names the host configured. Default: none. */
|
|
193
|
+
clientCertificates?: string[];
|
|
194
|
+
/** The caller's consent to background use of personal servers (`mcp-connections`). Default: none. */
|
|
195
|
+
mcpConnections?: {
|
|
196
|
+
serverId: string;
|
|
197
|
+
allowBackgroundUse: boolean;
|
|
198
|
+
}[];
|
|
199
|
+
/**
|
|
200
|
+
* What the mock authorization window answers to an MCP authorization: the person approves
|
|
201
|
+
* (default), denies, or closes the window. `NhAssistantMockBackend.setMcpAuthorizationOutcome`
|
|
202
|
+
* changes it.
|
|
203
|
+
*/
|
|
204
|
+
mcpAuthorization?: 'approve' | 'deny' | 'cancel';
|
|
205
|
+
/** Discovery results per server host, over the mock's defaults (`https://auth.<host>`, PKCE, dynamic registration). */
|
|
206
|
+
mcpDiscovery?: Record<string, Partial<McpDiscovery>>;
|
|
207
|
+
/** Origins an authorization may return to in redirect mode. Default: any. */
|
|
208
|
+
mcpReturnOrigins?: string[];
|
|
127
209
|
/**
|
|
128
210
|
* The building blocks in code that run configuration as data names. Default: none, with
|
|
129
|
-
* `policies` as the approval policies.
|
|
211
|
+
* `policies` as the approval policies. `divisions: true` lets agents created in the
|
|
212
|
+
* administration work per division, as an application that lists its divisions does.
|
|
130
213
|
*/
|
|
131
214
|
runCatalog?: Partial<RunCatalog>;
|
|
132
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* Triggers in code, per agent; they cannot change in the administration. `subjectType` is the type
|
|
217
|
+
* a trigger names up front, `nh-system` for a schedule for the whole application.
|
|
218
|
+
*/
|
|
133
219
|
codeTriggers?: {
|
|
134
220
|
agentId: string;
|
|
135
221
|
triggerId: string;
|
|
136
222
|
source: 'event' | 'schedule' | 'webhook';
|
|
137
223
|
skillId?: string | null;
|
|
224
|
+
subjectType?: string | null;
|
|
138
225
|
}[];
|
|
226
|
+
/**
|
|
227
|
+
* The accounts `GET admin/accounts` finds, as the application's `INhActorSearch` would. With
|
|
228
|
+
* accounts, run settings accept only these technical accounts; without, the account search is
|
|
229
|
+
* unavailable and any id that does not start with `unknown` is accepted.
|
|
230
|
+
*/
|
|
231
|
+
accounts?: AssistantAccount[];
|
|
139
232
|
}
|
|
140
233
|
/** A person in the simulated organization. */
|
|
141
234
|
interface NhAssistantMockPerson {
|
|
@@ -156,6 +249,141 @@ interface NhAssistantMockCollaboration {
|
|
|
156
249
|
/** Default 20. */
|
|
157
250
|
maxParticipants?: number;
|
|
158
251
|
}
|
|
252
|
+
/** A subject of a mock subject type, as the application's resolver describes it. */
|
|
253
|
+
interface NhAssistantMockSubject {
|
|
254
|
+
id: string;
|
|
255
|
+
displayName: string;
|
|
256
|
+
/** Default `global`. */
|
|
257
|
+
scopeKey?: string;
|
|
258
|
+
divisionId?: string | null;
|
|
259
|
+
/** Whether the signed-in user may read the subject; others never find it. Default `true`. */
|
|
260
|
+
readable?: boolean;
|
|
261
|
+
/** The signed-in user's role on a readable subject. Default `participant`, who may run its agents. */
|
|
262
|
+
role?: 'reader' | 'participant' | 'approver';
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* A division the application lists, for agents that work on the whole application per division:
|
|
266
|
+
* the run catalog then reports divisions only when `admin.runCatalog.divisions` says so.
|
|
267
|
+
*/
|
|
268
|
+
interface NhAssistantMockDivision {
|
|
269
|
+
/** The division's id, a GUID; its subject of the whole application is `nh-system/division-{id:N}`. */
|
|
270
|
+
id: string;
|
|
271
|
+
name: string;
|
|
272
|
+
/** Whether the signed-in user works in the division. Default `true`. */
|
|
273
|
+
readable?: boolean;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* What a run of an agent started by hand does in the mock, which runs no agents: it ends at once with
|
|
277
|
+
* this status and result, leaving this many open proposals. The agent's state decides first, as on
|
|
278
|
+
* the server: a stopped agent or one disabled in code is refused (`409`), and a paused agent answers
|
|
279
|
+
* `waiting` with `assistant-agent-paused`.
|
|
280
|
+
*/
|
|
281
|
+
interface NhAssistantMockRunNow {
|
|
282
|
+
/** Default `completed`. */
|
|
283
|
+
status?: AgentRunStatus;
|
|
284
|
+
/** The run's result; default none. */
|
|
285
|
+
result?: string | null;
|
|
286
|
+
/**
|
|
287
|
+
* The run's result per culture (`en`, `nl-NL`), as a run whose rules wrote it per culture keeps it:
|
|
288
|
+
* a reader gets the one of the request's language (exact, then the language), `result` otherwise.
|
|
289
|
+
*/
|
|
290
|
+
results?: Readonly<Record<string, string>>;
|
|
291
|
+
/** The open proposals the run leaves on its subject. Default 0. */
|
|
292
|
+
proposals?: number;
|
|
293
|
+
/**
|
|
294
|
+
* The receipt's outcome. Default `started`. `ignored` and `deferred` record no run; `waiting` records
|
|
295
|
+
* none either and names `assistant-skill-paused`, as for a paused skill.
|
|
296
|
+
*/
|
|
297
|
+
outcome?: AgentTriggerReceipt['outcome'];
|
|
298
|
+
/**
|
|
299
|
+
* The runs by hand the agent may make per object in a day; a start beyond it answers
|
|
300
|
+
* `409 assistant-trigger-rate-limited`. Default no limit.
|
|
301
|
+
*/
|
|
302
|
+
dailyLimit?: number;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* A run that happened before the first request, for the run histories (`GET runs`, the
|
|
306
|
+
* administration's runs view) and `GET runs/{id}`. The mock shows it to the caller as the server
|
|
307
|
+
* would: on an object the caller reads, for the whole application when the caller passes the agent's
|
|
308
|
+
* view policy, by default its required policy; administrators see every run of an agent.
|
|
309
|
+
*/
|
|
310
|
+
interface NhAssistantMockRun {
|
|
311
|
+
/** Default a generated id. */
|
|
312
|
+
id?: string;
|
|
313
|
+
agentId: string;
|
|
314
|
+
/** An object type of `subjectTypes`, or `nh-system` for the whole application. */
|
|
315
|
+
subjectType: string;
|
|
316
|
+
/** The object's id, or `global` (or `division-…`) for the whole application. */
|
|
317
|
+
subjectId: string;
|
|
318
|
+
/** The object's name; default the name `subjectTypes` gives it, or the id. */
|
|
319
|
+
subjectDisplayName?: string;
|
|
320
|
+
/** Default `completed`. */
|
|
321
|
+
status?: AgentRunStatus;
|
|
322
|
+
/** Why a `failed` run failed, such as `assistant-trigger-rolled-back`. Default `assistant-turn-failed`. */
|
|
323
|
+
failureCode?: string;
|
|
324
|
+
/** Default `manual`. */
|
|
325
|
+
triggerId?: string;
|
|
326
|
+
/** The run's answer as Markdown, model output; default none. */
|
|
327
|
+
result?: string | null;
|
|
328
|
+
/**
|
|
329
|
+
* The run's result per culture (`en`, `nl-NL`), as a run whose rules wrote it per culture keeps it:
|
|
330
|
+
* a reader gets the one of the request's language (exact, then the language), `result` otherwise.
|
|
331
|
+
*/
|
|
332
|
+
results?: Readonly<Record<string, string>>;
|
|
333
|
+
/** When the run was queued, ISO 8601; default now. */
|
|
334
|
+
createdAt?: string;
|
|
335
|
+
/** How long the run took. Default 30. */
|
|
336
|
+
durationSeconds?: number;
|
|
337
|
+
/** Default 0. */
|
|
338
|
+
proposalCount?: number;
|
|
339
|
+
/** Default 0. */
|
|
340
|
+
toolCalls?: number;
|
|
341
|
+
/** Default 0. */
|
|
342
|
+
tokens?: number;
|
|
343
|
+
/** The run worked in the agent's shadow thread. Default `false`. */
|
|
344
|
+
shadow?: boolean;
|
|
345
|
+
/** The personal MCP servers the run left out, as the server records them. Default none. */
|
|
346
|
+
mcpConnectionSkips?: AgentRunMcpSkip[];
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* A subject type the application registered with `AddSubjectType`, with its names per language, the
|
|
350
|
+
* entity it stands for, its link template and the subjects people can find. The mock checks it as
|
|
351
|
+
* the server checks the registration at startup: a dash-case id outside the reserved `nh-` prefix,
|
|
352
|
+
* names of 1 to 100 characters with one in the fallback language, and one `{id}` in the link.
|
|
353
|
+
*/
|
|
354
|
+
interface NhAssistantMockSubjectType {
|
|
355
|
+
id: string;
|
|
356
|
+
/** Names per culture name, such as `{ en: 'Project', nl: 'Project' }`; without, people see the id. */
|
|
357
|
+
names?: Record<string, string>;
|
|
358
|
+
pluralNames?: Record<string, string>;
|
|
359
|
+
/** Default `en`. */
|
|
360
|
+
fallbackLanguage?: string;
|
|
361
|
+
entityType?: string | null;
|
|
362
|
+
entityTypeFull?: string | null;
|
|
363
|
+
/** Link template with exactly one `{id}`, such as `/projects/{id}`. */
|
|
364
|
+
link?: string | null;
|
|
365
|
+
subjects?: NhAssistantMockSubject[];
|
|
366
|
+
/** Whether `GET subjects/{type}/search` finds the subjects by name. Default: when the type has subjects. */
|
|
367
|
+
searchable?: boolean;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* A group of agents the application registers in code, checked as the server checks it at startup:
|
|
371
|
+
* a dash-case id of at most 64 characters, a name of 1 to 100 characters per language with one in the
|
|
372
|
+
* fallback language, and optional descriptions of at most 300 characters the same way.
|
|
373
|
+
*/
|
|
374
|
+
interface NhAssistantMockAgentGroup {
|
|
375
|
+
id: string;
|
|
376
|
+
/** Names per culture name, such as `{ en: 'Project management', nl: 'Projectbeheer' }`. */
|
|
377
|
+
names: Record<string, string>;
|
|
378
|
+
descriptions?: Record<string, string>;
|
|
379
|
+
/** Default `en`. */
|
|
380
|
+
fallbackLanguage?: string;
|
|
381
|
+
/**
|
|
382
|
+
* The agents in the group when the mock starts: agents in code join it in code (`InGroup`), agents
|
|
383
|
+
* created as data as an administrator put them there. Administrators' later choices win.
|
|
384
|
+
*/
|
|
385
|
+
agentIds?: string[];
|
|
386
|
+
}
|
|
159
387
|
/** The scenario the mock API plays without a back-end. */
|
|
160
388
|
interface NhAssistantMockScenario {
|
|
161
389
|
/** Default `true`. */
|
|
@@ -171,6 +399,69 @@ interface NhAssistantMockScenario {
|
|
|
171
399
|
preferences?: AssistantPreferences;
|
|
172
400
|
admin?: NhAssistantMockAdminScenario;
|
|
173
401
|
collaboration?: NhAssistantMockCollaboration;
|
|
402
|
+
/**
|
|
403
|
+
* The application's subject types: the run catalog lists them, next to the platform's `nh-system`
|
|
404
|
+
* (the whole application, `isSystem`) that the mock always adds as the server does,
|
|
405
|
+
* `GET subjects/{type}/search` finds their readable subjects and `GET subjects/{type}/{id}/work`
|
|
406
|
+
* names a subject chosen by id, `nh-system/global` included.
|
|
407
|
+
*/
|
|
408
|
+
subjectTypes?: NhAssistantMockSubjectType[];
|
|
409
|
+
/**
|
|
410
|
+
* The application's divisions: `GET subjects/nh-system/search` finds those the user works in by
|
|
411
|
+
* name, and the whole application in a division is named after it.
|
|
412
|
+
*/
|
|
413
|
+
divisions?: NhAssistantMockDivision[];
|
|
414
|
+
/**
|
|
415
|
+
* The authorization policies the signed-in user passes: agents' required, run and view policies.
|
|
416
|
+
* Default: every policy. Without a run policy an agent runs for the whole application for
|
|
417
|
+
* administrators (`admin.canAdminister`), as the server's administration policy decides.
|
|
418
|
+
*/
|
|
419
|
+
callerPolicies?: string[];
|
|
420
|
+
/** What a run by hand does, per agent id; `POST threads/start` and the agents of a subject show it. */
|
|
421
|
+
runNow?: Record<string, NhAssistantMockRunNow>;
|
|
422
|
+
/** Runs that happened before the first request, for the run histories and their results. */
|
|
423
|
+
runs?: NhAssistantMockRun[];
|
|
424
|
+
/**
|
|
425
|
+
* The application's groups of agents (`AddAgentGroup`) with the agents that join them in code: the
|
|
426
|
+
* run catalog lists them, administrators put agents in them and take them out, and `GET boards`
|
|
427
|
+
* shows their boards.
|
|
428
|
+
*/
|
|
429
|
+
agentGroups?: NhAssistantMockAgentGroup[];
|
|
430
|
+
/**
|
|
431
|
+
* Proposals the agents left, for example ones a run for the whole application placed at projects:
|
|
432
|
+
* the approval inbox, their thread and their subject's work list them, and people decide them.
|
|
433
|
+
*/
|
|
434
|
+
proposals?: NhAssistantMockProposal[];
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* A proposal an agent left, as the mock serves it; the mock fills what it leaves out. With
|
|
438
|
+
* `placedBy` a run placed it here from another subject, such as a run for the whole application.
|
|
439
|
+
*/
|
|
440
|
+
interface NhAssistantMockProposal {
|
|
441
|
+
approvalId: string;
|
|
442
|
+
agentId: string;
|
|
443
|
+
subjectType: string;
|
|
444
|
+
subjectId: string;
|
|
445
|
+
subjectDisplayName?: string | null;
|
|
446
|
+
subjectTypeName?: string | null;
|
|
447
|
+
subjectLink?: string | null;
|
|
448
|
+
/** The thread the proposal waits in. Default `{approvalId}-thread`. */
|
|
449
|
+
conversationId?: string;
|
|
450
|
+
runId?: string | null;
|
|
451
|
+
toolId: string;
|
|
452
|
+
presentation?: ApprovalPresentation | null;
|
|
453
|
+
/** Default `pending`. */
|
|
454
|
+
status?: AgentProposalStatus;
|
|
455
|
+
rationale?: string | null;
|
|
456
|
+
placedBy?: AgentProposalOrigin | null;
|
|
457
|
+
/**
|
|
458
|
+
* Whether the signed-in user may decide it. Default `true`. A proposal of the whole application
|
|
459
|
+
* (`nh-system`) exists only for its approvers who pass the agent's view policy, by default its
|
|
460
|
+
* required policy: the administrators in the mock; for anybody else it is not found at all.
|
|
461
|
+
*/
|
|
462
|
+
canDecide?: boolean;
|
|
463
|
+
/** Why not, when `canDecide` is `false`. Default `assistant-approval-policy-denied`. */
|
|
464
|
+
reasonCode?: string | null;
|
|
174
465
|
}
|
|
175
466
|
/** One request the mock API received, for assertions in tests. */
|
|
176
467
|
interface NhAssistantMockRequest {
|
|
@@ -180,10 +471,28 @@ interface NhAssistantMockRequest {
|
|
|
180
471
|
body: unknown;
|
|
181
472
|
}
|
|
182
473
|
|
|
474
|
+
/**
|
|
475
|
+
* The authorization window of the mock API: instead of a popup at an authorization server it plays
|
|
476
|
+
* the callback of the started flow right away, as the scenario's `admin.mcpAuthorization` says. It
|
|
477
|
+
* records the authorization URLs it was asked to show.
|
|
478
|
+
*/
|
|
479
|
+
declare class NhAssistantMockAuthorizationWindow implements NhAssistantMcpAuthorizationWindow {
|
|
480
|
+
private readonly callback;
|
|
481
|
+
/** The authorization URLs shown, oldest first. */
|
|
482
|
+
readonly shown: string[];
|
|
483
|
+
/** How many windows were closed without finishing, for example because starting failed. */
|
|
484
|
+
closed: number;
|
|
485
|
+
constructor(callback: (flowId: string) => NhAssistantMcpAuthorizationOutcome);
|
|
486
|
+
open(): NhAssistantMcpAuthorizationHandle;
|
|
487
|
+
}
|
|
488
|
+
|
|
183
489
|
declare const NH_ASSISTANT_MOCK_SCENARIO: InjectionToken<NhAssistantMockScenario>;
|
|
184
490
|
/** Path the mock reports as hub; the mock live service answers it in memory. */
|
|
185
491
|
declare const NH_ASSISTANT_MOCK_HUB_PATH = "/hub/assistant-mock";
|
|
186
|
-
/**
|
|
492
|
+
/**
|
|
493
|
+
* One live update of the mock, as the assistant hub would send it. Agent work for the whole
|
|
494
|
+
* application (`wholeApplication`) reaches the caller only while a screen watches it, as on the hub.
|
|
495
|
+
*/
|
|
187
496
|
type NhAssistantMockLiveMessage = {
|
|
188
497
|
kind: 'changed';
|
|
189
498
|
data: LiveConversationChanged;
|
|
@@ -196,6 +505,10 @@ type NhAssistantMockLiveMessage = {
|
|
|
196
505
|
} | {
|
|
197
506
|
kind: 'event';
|
|
198
507
|
data: LiveConversationEvent;
|
|
508
|
+
} | {
|
|
509
|
+
kind: 'agent-work';
|
|
510
|
+
data: LiveAgentWorkChanged;
|
|
511
|
+
wholeApplication: boolean;
|
|
199
512
|
};
|
|
200
513
|
/**
|
|
201
514
|
* In-memory implementation of the assistant HTTP API and its event streams. It keeps
|
|
@@ -212,8 +525,12 @@ declare class NhAssistantMockBackend {
|
|
|
212
525
|
private readonly pageContexts;
|
|
213
526
|
private readonly enabledState;
|
|
214
527
|
private readonly admin;
|
|
215
|
-
private readonly canAdministerState;
|
|
216
528
|
private readonly currentUser;
|
|
529
|
+
private readonly proposals;
|
|
530
|
+
private readonly subjects;
|
|
531
|
+
private readonly agentRuns;
|
|
532
|
+
private readonly boards;
|
|
533
|
+
private readonly canAdministerState;
|
|
217
534
|
private readonly members;
|
|
218
535
|
private readonly readPositions;
|
|
219
536
|
private readonly shareTokens;
|
|
@@ -223,8 +540,8 @@ declare class NhAssistantMockBackend {
|
|
|
223
540
|
private sequence;
|
|
224
541
|
/** Requests received so far, oldest first. */
|
|
225
542
|
readonly requests: NhAssistantMockRequest[];
|
|
226
|
-
readonly enabled:
|
|
227
|
-
readonly canAdminister:
|
|
543
|
+
readonly enabled: _angular_core.Signal<boolean>;
|
|
544
|
+
readonly canAdminister: _angular_core.Signal<boolean>;
|
|
228
545
|
/** Live updates for the mock live service, in the order the hub would send them. */
|
|
229
546
|
readonly live$: Observable<NhAssistantMockLiveMessage>;
|
|
230
547
|
constructor();
|
|
@@ -240,6 +557,18 @@ declare class NhAssistantMockBackend {
|
|
|
240
557
|
setCanAdminister(canAdminister: boolean): void;
|
|
241
558
|
/** Replaces the tools a simulated MCP server lists; the next sync picks them up. */
|
|
242
559
|
setRemoteTools(serverId: string, tools: NhAssistantMockRemoteTool[]): void;
|
|
560
|
+
/**
|
|
561
|
+
* The window the assistant components open for MCP authorizations; `provideNhAssistantMockApi`
|
|
562
|
+
* provides it as `NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW`.
|
|
563
|
+
*/
|
|
564
|
+
readonly authorizationWindow: NhAssistantMockAuthorizationWindow;
|
|
565
|
+
/** What the mock authorization window answers next: the person approves, denies or closes it. */
|
|
566
|
+
setMcpAuthorizationOutcome(outcome: 'approve' | 'deny' | 'cancel'): void;
|
|
567
|
+
/**
|
|
568
|
+
* Simulates an OAuth connection that ended outside the application: a refused refresh
|
|
569
|
+
* (`reauthorization-required`) or another authorization server (`issuer-changed`).
|
|
570
|
+
*/
|
|
571
|
+
setMcpConnectionStatus(serverId: string, status: 'reauthorization-required' | 'issuer-changed'): void;
|
|
243
572
|
/** A `fetch` implementation that answers the assistant endpoints below `apiBaseUrl`. */
|
|
244
573
|
readonly fetch: (input: string, init: RequestInit) => Promise<Response>;
|
|
245
574
|
private route;
|
|
@@ -262,21 +591,42 @@ declare class NhAssistantMockBackend {
|
|
|
262
591
|
private addMember;
|
|
263
592
|
private removeMember;
|
|
264
593
|
private emitChanged;
|
|
594
|
+
/**
|
|
595
|
+
* Announces that the work of an agent changed, as the server does after its runs and proposals:
|
|
596
|
+
* the work of an object reaches the caller, the work of the whole application only when the caller
|
|
597
|
+
* passes the agent's view policy, by default its required policy, and only while a screen watches it
|
|
598
|
+
* (`NhAssistantMockLiveService.watchAgentWork`). The mock runs no agents on its own; call it to show a
|
|
599
|
+
* screen what a run in the background would change. Runs by hand and decisions announce themselves.
|
|
600
|
+
*/
|
|
601
|
+
publishAgentWork(change: LiveAgentWorkChanged, agentId: string): void;
|
|
265
602
|
private emitLive;
|
|
266
603
|
private maxParticipants;
|
|
604
|
+
/** A contract error with the one status the server gives its code. */
|
|
267
605
|
private error;
|
|
606
|
+
/**
|
|
607
|
+
* Whether the caller decides the agent's proposals of the whole application: an approver of the whole
|
|
608
|
+
* application (an administrator in the mock) who passes the agent's view policy, by default its
|
|
609
|
+
* required policy.
|
|
610
|
+
*/
|
|
611
|
+
/** Whether the caller passes the agent's view policy, by default its required policy. */
|
|
612
|
+
private readsApplicationWork;
|
|
613
|
+
private decidesForApplication;
|
|
268
614
|
private nextId;
|
|
615
|
+
/** An administration answer about agents with each agent's groups, as the server answers it. */
|
|
616
|
+
private withGroups;
|
|
617
|
+
private groupsOf;
|
|
269
618
|
private result;
|
|
270
619
|
private json;
|
|
271
620
|
private empty;
|
|
272
|
-
static ɵfac:
|
|
273
|
-
static ɵprov:
|
|
621
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantMockBackend, never>;
|
|
622
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NhAssistantMockBackend>;
|
|
274
623
|
}
|
|
275
624
|
|
|
276
|
-
type NhAssistantLiveSurface = Pick<NhAssistantLiveService, 'changed$' | 'read$' | 'removed$' | 'events$' | 'agentWork$' | 'resync$' | 'state' | 'connect' | 'stop'>;
|
|
625
|
+
type NhAssistantLiveSurface = Pick<NhAssistantLiveService, 'changed$' | 'read$' | 'removed$' | 'events$' | 'agentWork$' | 'resync$' | 'state' | 'connect' | 'stop' | 'watchAgentWork'>;
|
|
277
626
|
/**
|
|
278
627
|
* Stands in for the SignalR live service: it delivers the mock back-end's live updates in
|
|
279
|
-
* memory, so shared conversations, other tabs and parallel turns behave as with a real hub.
|
|
628
|
+
* memory, so shared conversations, other tabs and parallel turns behave as with a real hub. The work
|
|
629
|
+
* of agents for the whole application arrives only while a screen watches it, as on the hub.
|
|
280
630
|
*/
|
|
281
631
|
declare class NhAssistantMockLiveService implements NhAssistantLiveSurface {
|
|
282
632
|
private readonly backend;
|
|
@@ -284,32 +634,39 @@ declare class NhAssistantMockLiveService implements NhAssistantLiveSurface {
|
|
|
284
634
|
private readonly readSubject;
|
|
285
635
|
private readonly removedSubject;
|
|
286
636
|
private readonly eventSubject;
|
|
637
|
+
private readonly agentWorkSubject;
|
|
287
638
|
private readonly resyncSubject;
|
|
639
|
+
private readonly watchers;
|
|
288
640
|
private readonly stateSignal;
|
|
289
641
|
private subscription?;
|
|
290
642
|
readonly changed$: Observable<LiveConversationChanged>;
|
|
291
643
|
readonly read$: Observable<LiveConversationRead>;
|
|
292
644
|
readonly removed$: Observable<LiveConversationRemoved>;
|
|
293
645
|
readonly events$: Observable<LiveConversationEvent>;
|
|
294
|
-
/**
|
|
646
|
+
/** The work of agents that changed: runs by hand, decisions and `NhAssistantMockBackend.publishAgentWork`. */
|
|
295
647
|
readonly agentWork$: Observable<LiveAgentWorkChanged>;
|
|
648
|
+
/** Whether a screen watches the work of agents for the whole application. */
|
|
649
|
+
readonly watching: _angular_core.Signal<boolean>;
|
|
296
650
|
readonly resync$: Observable<void>;
|
|
297
|
-
readonly state:
|
|
651
|
+
readonly state: _angular_core.Signal<NhAssistantLiveState>;
|
|
298
652
|
constructor();
|
|
299
653
|
connect(hubPath: string | null): Promise<void>;
|
|
654
|
+
/** Follows the work of agents for the whole application until the returned function is called. */
|
|
655
|
+
watchAgentWork(): () => void;
|
|
300
656
|
stop(): Promise<void>;
|
|
301
|
-
static ɵfac:
|
|
302
|
-
static ɵprov:
|
|
657
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantMockLiveService, never>;
|
|
658
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NhAssistantMockLiveService>;
|
|
303
659
|
}
|
|
304
660
|
|
|
305
661
|
/**
|
|
306
662
|
* Replaces the assistant transport with an in-memory back-end that plays `script`.
|
|
307
663
|
* Register it after `provideNhAssistant(...)` in the same injector. Every client feature
|
|
308
664
|
* (status, agents, conversations, streamed turns, approvals, cancellation, sharing, read
|
|
309
|
-
* state and
|
|
310
|
-
* switch the feature flag, simulate a colleague or inspect the
|
|
665
|
+
* state, live updates and MCP authorizations) then works without a server. Inject
|
|
666
|
+
* `NhAssistantMockBackend` to switch the feature flag, simulate a colleague or inspect the
|
|
667
|
+
* received requests.
|
|
311
668
|
*/
|
|
312
669
|
declare function provideNhAssistantMockApi(script: NhAssistantMockScenario): EnvironmentProviders;
|
|
313
670
|
|
|
314
|
-
export { NH_ASSISTANT_MOCK_HUB_PATH, NH_ASSISTANT_MOCK_SCENARIO, NhAssistantMockBackend, NhAssistantMockLiveService, provideNhAssistantMockApi };
|
|
315
|
-
export type { NhAssistantMockAdminAgent, NhAssistantMockAdminScenario, NhAssistantMockApprovalStep, NhAssistantMockCollaboration, NhAssistantMockErrorStep, NhAssistantMockFailStep, NhAssistantMockLiveMessage, NhAssistantMockMcpServer, NhAssistantMockPerson, NhAssistantMockRemoteTool, NhAssistantMockRequest, NhAssistantMockScenario, NhAssistantMockStep, NhAssistantMockTextStep, NhAssistantMockTiming, NhAssistantMockToolStep, NhAssistantMockTurn };
|
|
671
|
+
export { NH_ASSISTANT_MOCK_HUB_PATH, NH_ASSISTANT_MOCK_SCENARIO, NhAssistantMockAuthorizationWindow, NhAssistantMockBackend, NhAssistantMockLiveService, provideNhAssistantMockApi };
|
|
672
|
+
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 };
|