@newheap/platform-ai-chat 0.10.0 → 0.12.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 CHANGED
@@ -453,7 +453,9 @@ use small built-in outline glyphs:
453
453
  ## Translations
454
454
 
455
455
  All keys live under `nh-assistant.`. With `translations: 'bundled'` the library
456
- merges its `en` and `nl` texts whenever the host loads a language; other
456
+ merges its `en` and `nl` texts whenever the host loads a language. A regional
457
+ language such as `nl-NL`, `nl-BE` or `en-GB` receives the texts of its base
458
+ language, so a host with regional languages needs no merge of its own; other
457
459
  languages receive English. Keys the host defines under `nh-assistant.` win, so a
458
460
  host adds only what the server decides:
459
461
 
package/admin/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { NhAssistantStore, NhAssistantError, ApplicationContext, ApplicationContextVersion, AdminAgent, ToolCatalogEntry, McpServer, AssistantAutonomy, AgentProposalFeedbackCategory, AgentFeedbackSummaryRow, AgentFeedbackItem, AgentFeedbackCategoryCount, StaleKind, AgentProposalFeedbackGroup, McpServerTestResult, McpAuthMode, McpToolEffect, McpTool } from '@newheap/platform-ai-chat';
2
+ import { NhAssistantStore, NhAssistantError, ApplicationContext, ApplicationContextVersion, AdminAgent, ToolCatalogEntry, McpServer, SetAgentStateRequest, AgentSkillState, AssistantAutonomy, AgentEvaluation, AgentReplay, AgentEvaluationCost, AgentProposalFeedbackCategory, AgentFeedbackSummaryRow, AgentFeedbackItem, AgentFeedbackCategoryCount, StaleKind, AgentProposalFeedbackGroup, McpServerTestResult, McpAuthMode, McpToolEffect, McpTool } from '@newheap/platform-ai-chat';
3
3
 
4
4
  type NhAssistantAdminTab = 'context' | 'agents' | 'mcp-servers';
5
5
  /**
@@ -59,10 +59,13 @@ declare class NhAssistantAdminContextComponent {
59
59
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAdminContextComponent, "nh-assistant-admin-context", never, {}, {}, never, never, true, never>;
60
60
  }
61
61
 
62
+ type AgentStateAction = SetAgentStateRequest['state'];
62
63
  /**
63
- * Agent administration: code agents (override, disable, reset) and agents created here
64
- * (edit, disable, delete). Editing opens `nh-assistant-admin-agent-editor`; the feedback action
65
- * opens `nh-assistant-agent-feedback-report` for the agent.
64
+ * Agent administration: code agents (override, reset) and agents created here (edit, delete),
65
+ * and for every agent its run state with pause, stop and resume, each with an optional reason.
66
+ * Editing opens `nh-assistant-admin-agent-editor`; the feedback action opens
67
+ * `nh-assistant-agent-feedback-report` for the agent, and the evaluation action of an agent with
68
+ * shadow variants opens `nh-assistant-agent-evaluation`.
66
69
  */
67
70
  declare class NhAssistantAdminAgentsComponent {
68
71
  private readonly admin;
@@ -70,6 +73,7 @@ declare class NhAssistantAdminAgentsComponent {
70
73
  private readonly injector;
71
74
  private readonly host;
72
75
  private readonly backButton;
76
+ private readonly reasonInput;
73
77
  private subscription?;
74
78
  private actionSubscription?;
75
79
  readonly id: string;
@@ -82,11 +86,21 @@ declare class NhAssistantAdminAgentsComponent {
82
86
  readonly editing: _angular_core.WritableSignal<AdminAgent | null | undefined>;
83
87
  /** The agent whose feedback report is shown instead of the list. */
84
88
  readonly reporting: _angular_core.WritableSignal<AdminAgent | null>;
89
+ /** The agent whose comparison with its shadow variants is shown instead of the list. */
90
+ readonly evaluating: _angular_core.WritableSignal<AdminAgent | null>;
85
91
  readonly confirming: _angular_core.WritableSignal<{
86
92
  agentId: string;
87
93
  action: "delete" | "reset";
88
94
  } | null>;
89
95
  readonly busyAgentId: _angular_core.WritableSignal<string | null>;
96
+ /** The state change whose reason is being entered, of the agent or one of its skills. */
97
+ readonly changingState: _angular_core.WritableSignal<{
98
+ agentId: string;
99
+ skillId?: string;
100
+ state: AgentStateAction;
101
+ } | null>;
102
+ readonly stateReason: _angular_core.WritableSignal<string>;
103
+ readonly maxReason = 500;
90
104
  readonly error: _angular_core.WritableSignal<NhAssistantError | null>;
91
105
  readonly errorKeys: _angular_core.Signal<string[]>;
92
106
  constructor();
@@ -95,10 +109,24 @@ declare class NhAssistantAdminAgentsComponent {
95
109
  edit(agent: AdminAgent): void;
96
110
  /** Shows what people said when they rejected the agent's proposals. */
97
111
  openReport(agent: AdminAgent): void;
112
+ /** The shadow variants of an agent, by id. */
113
+ variantsOf(agent: AdminAgent): string[];
114
+ /** Compares the agent with its shadow variants. */
115
+ openEvaluation(agent: AdminAgent): void;
116
+ /** Returns to the list and to the evaluation action of the agent whose comparison was open. */
117
+ closeEvaluation(): void;
98
118
  /** Returns to the list and to the feedback action of the agent whose report was open. */
99
119
  closeReport(): void;
100
120
  onSaved(agent: AdminAgent): void;
101
- setEnabled(agent: AdminAgent, isEnabled: boolean): void;
121
+ /** The state changes the agent allows: none for an agent that is disabled in code. */
122
+ stateActions(agent: AdminAgent): AgentStateAction[];
123
+ /** The state changes a skill allows. */
124
+ skillActions(skill: AgentSkillState): AgentStateAction[];
125
+ /** Opens the reason form of a state change of the agent or, with a skill, of that skill. */
126
+ askState(agent: AdminAgent, state: AgentStateAction, skill?: AgentSkillState): void;
127
+ isChangingState(agentId: string, state: AgentStateAction, skillId?: string): boolean;
128
+ applyState(agent: AdminAgent): void;
129
+ value(event: Event): string;
102
130
  confirm(agentId: string, action: 'delete' | 'reset'): void;
103
131
  isConfirming(agentId: string, action: 'delete' | 'reset'): boolean;
104
132
  reset(agent: AdminAgent): void;
@@ -135,7 +163,6 @@ declare class NhAssistantAdminAgentEditorComponent {
135
163
  readonly instructions: _angular_core.WritableSignal<string>;
136
164
  readonly autonomy: _angular_core.WritableSignal<AssistantAutonomy>;
137
165
  readonly requiredPolicy: _angular_core.WritableSignal<string>;
138
- readonly isEnabled: _angular_core.WritableSignal<boolean>;
139
166
  readonly toolSelectors: _angular_core.WritableSignal<string[]>;
140
167
  readonly mcpServerIds: _angular_core.WritableSignal<string[]>;
141
168
  readonly newSelector: _angular_core.WritableSignal<string>;
@@ -168,6 +195,81 @@ declare class NhAssistantAdminAgentEditorComponent {
168
195
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAdminAgentEditorComponent, "nh-assistant-admin-agent-editor", never, { "agent": { "alias": "agent"; "required": false; "isSignal": true; }; "tools": { "alias": "tools"; "required": false; "isSignal": true; }; "servers": { "alias": "servers"; "required": false; "isSignal": true; }; }, { "saved": "saved"; "cancelled": "cancelled"; }, never, never, true, never>;
169
196
  }
170
197
 
198
+ /** Periods the evaluation offers, in days before now; the server allows at most 92. */
199
+ type NhAssistantEvaluationPeriod = 7 | 30 | 90;
200
+ /** One row of the cost comparison: a measure of the live agent next to the variant's. */
201
+ interface NhAssistantCostRow {
202
+ key: 'runs' | 'model-calls' | 'tokens' | 'tool-calls';
203
+ live: AgentEvaluationCost;
204
+ variant: AgentEvaluationCost;
205
+ }
206
+ /**
207
+ * Compares a shadow variant of an agent with the live agent, for the agent's administrators: the
208
+ * runs that handled the same events, per tool the proposals both made, only one made and what
209
+ * people decided about the live ones, what each cost and how each routed, with links to the threads
210
+ * of the differences. Small numbers mislead, so counts stand next to every share. Administrators
211
+ * replay the recorded runs of the period into the variant and export the comparison as JSON Lines.
212
+ * The report holds no messages or arguments.
213
+ */
214
+ declare class NhAssistantAgentEvaluationComponent {
215
+ private readonly admin;
216
+ private readonly panel;
217
+ private readonly document;
218
+ private subscription?;
219
+ private replaySubscription?;
220
+ /** The live agent. */
221
+ readonly agentId: _angular_core.InputSignal<string>;
222
+ /** Its shadow variants; the first is compared until another is chosen. */
223
+ readonly variants: _angular_core.InputSignal<readonly string[]>;
224
+ readonly id: string;
225
+ readonly periods: readonly NhAssistantEvaluationPeriod[];
226
+ readonly maxReplayRuns = 500;
227
+ readonly canOpenThreads: boolean;
228
+ readonly variant: _angular_core.WritableSignal<string>;
229
+ readonly period: _angular_core.WritableSignal<NhAssistantEvaluationPeriod>;
230
+ readonly loading: _angular_core.WritableSignal<boolean>;
231
+ readonly error: _angular_core.WritableSignal<NhAssistantError | null>;
232
+ readonly errorKeys: _angular_core.Signal<string[]>;
233
+ readonly evaluation: _angular_core.WritableSignal<AgentEvaluation | null>;
234
+ readonly exporting: _angular_core.WritableSignal<boolean>;
235
+ readonly exportError: _angular_core.WritableSignal<NhAssistantError | null>;
236
+ readonly exportErrorKeys: _angular_core.Signal<string[]>;
237
+ readonly canExport: _angular_core.Signal<boolean>;
238
+ readonly replays: _angular_core.WritableSignal<AgentReplay[]>;
239
+ readonly replayRuns: _angular_core.WritableSignal<number>;
240
+ readonly replaying: _angular_core.WritableSignal<boolean>;
241
+ readonly replayError: _angular_core.WritableSignal<NhAssistantError | null>;
242
+ readonly replayErrorKeys: _angular_core.Signal<string[]>;
243
+ readonly replayRunning: _angular_core.Signal<boolean>;
244
+ readonly costRows: _angular_core.Signal<NhAssistantCostRow[]>;
245
+ /** Routing matters only when one of the two worked in a skill. */
246
+ readonly showRouting: _angular_core.Signal<boolean>;
247
+ /** The period the last load asked for, so the report, the export and a replay agree. */
248
+ private range;
249
+ constructor();
250
+ /** Reloads the comparison and the variant's replays for the chosen period. */
251
+ load(): void;
252
+ loadReplays(): void;
253
+ onVariant(event: Event): void;
254
+ onPeriod(event: Event): void;
255
+ onReplayRuns(event: Event): void;
256
+ /** Replays the live agent's recorded runs of the period into the variant. */
257
+ replay(): void;
258
+ /** Downloads the paired runs of the comparison as a JSON Lines file. */
259
+ export(): Promise<void>;
260
+ /** Opens a thread of the comparison in the assistant panel, when the host has one. */
261
+ openThread(conversationId: string): void;
262
+ /** The share of a count in a total, or `null` without a total. */
263
+ share(count: number, total: number): number | null;
264
+ total(row: AgentEvaluation['tools'][number]): number;
265
+ categories(row: AgentEvaluation['tools'][number]): {
266
+ category: string;
267
+ count: number;
268
+ }[];
269
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantAgentEvaluationComponent, never>;
270
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAgentEvaluationComponent, "nh-assistant-agent-evaluation", never, { "agentId": { "alias": "agentId"; "required": true; "isSignal": true; }; "variants": { "alias": "variants"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
271
+ }
272
+
171
273
  /** Periods the report offers, in days before now. */
172
274
  type NhAssistantFeedbackPeriod = 7 | 30 | 90;
173
275
  /** A summary row with its most frequent feedback categories and why open proposals closed. */
@@ -371,5 +473,5 @@ declare class NhAssistantAdminMcpToolsComponent {
371
473
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAdminMcpToolsComponent, "nh-assistant-admin-mcp-tools", never, { "server": { "alias": "server"; "required": true; "isSignal": true; }; }, { "closed": "closed"; "synced": "synced"; }, never, never, true, never>;
372
474
  }
373
475
 
374
- export { NH_ASSISTANT_MAX_INSTRUCTIONS, NhAssistantAdminAgentEditorComponent, NhAssistantAdminAgentsComponent, NhAssistantAdminComponent, NhAssistantAdminContextComponent, NhAssistantAdminMcpServerEditorComponent, NhAssistantAdminMcpServersComponent, NhAssistantAdminMcpToolsComponent, NhAssistantAgentFeedbackReportComponent, nhAssistantSelectorMatches };
375
- export type { NhAssistantAdminTab, NhAssistantFeedbackPeriod, NhAssistantSecretAction };
476
+ export { NH_ASSISTANT_MAX_INSTRUCTIONS, NhAssistantAdminAgentEditorComponent, NhAssistantAdminAgentsComponent, NhAssistantAdminComponent, NhAssistantAdminContextComponent, NhAssistantAdminMcpServerEditorComponent, NhAssistantAdminMcpServersComponent, NhAssistantAdminMcpToolsComponent, NhAssistantAgentEvaluationComponent, NhAssistantAgentFeedbackReportComponent, nhAssistantSelectorMatches };
477
+ export type { NhAssistantAdminTab, NhAssistantEvaluationPeriod, NhAssistantFeedbackPeriod, NhAssistantSecretAction };
@@ -212,9 +212,9 @@ declare class NhAssistantAgentProposalsComponent {
212
212
 
213
213
  /**
214
214
  * The runs of an agent thread, newest first: trigger, status, failure, usage, proposals and the
215
- * summary the next run starts from. Participants cancel an open run; approvers resume or restart
216
- * a failed or cancelled one. With live updates it reloads by itself when a run or proposal of the
217
- * thread changes.
215
+ * summary the next run starts from, and the agent that handed a run its work. Participants cancel
216
+ * an open run; approvers resume or restart a failed or cancelled one. With live updates it reloads
217
+ * by itself when a run or proposal of the thread changes.
218
218
  */
219
219
  declare class NhAssistantRunTimelineComponent {
220
220
  private readonly api;
@@ -224,6 +224,8 @@ declare class NhAssistantRunTimelineComponent {
224
224
  readonly role: _angular_core.InputSignal<AgentSubjectRole>;
225
225
  /** Emits after a run was cancelled or retried. */
226
226
  readonly changed: _angular_core.OutputEmitterRef<void>;
227
+ /** Emits the thread of the agent that handed a run its work, so the host can open it. */
228
+ readonly openConversation: _angular_core.OutputEmitterRef<string>;
227
229
  readonly loading: _angular_core.WritableSignal<boolean>;
228
230
  readonly loadFailed: _angular_core.WritableSignal<boolean>;
229
231
  readonly runs: _angular_core.WritableSignal<AgentRun[]>;
@@ -242,7 +244,7 @@ declare class NhAssistantRunTimelineComponent {
242
244
  /** A quiet load, after a live update, shows no loading state and keeps the runs when it fails. */
243
245
  private fetch;
244
246
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantRunTimelineComponent, never>;
245
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantRunTimelineComponent, "nh-assistant-run-timeline", never, { "conversationId": { "alias": "conversationId"; "required": true; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; }, { "changed": "changed"; }, never, never, true, never>;
247
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantRunTimelineComponent, "nh-assistant-run-timeline", never, { "conversationId": { "alias": "conversationId"; "required": true; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; }, { "changed": "changed"; "openConversation": "openConversation"; }, never, never, true, never>;
246
248
  }
247
249
 
248
250
  /**