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