@newheap/platform-ai-chat 0.8.1 → 0.9.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.
@@ -0,0 +1,342 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import * as _newheap_platform_ai_chat from '@newheap/platform-ai-chat';
3
+ import { AgentProposal, AgentThreadLookup, AgentTriggerReceipt, NhAssistantError, AgentProposalDecisionRight, AgentProposalFeedback, AgentProposalDecision, AgentExecutionResolution, AgentSubjectRole, AgentRun, AgentRunRetryMode, AgentThreadMemory, AgentArtifact, AgentConsultation, AgentSubjectWork, AgentSubjectWorkAgent } from '@newheap/platform-ai-chat';
4
+
5
+ /**
6
+ * The approval inbox: pending agent proposals across subjects that the signed-in person may
7
+ * decide, earliest expiry first. Proposals are decided in place, one by one or together; the
8
+ * server checks each decision against the proposal's approval policy again. After a rejection the
9
+ * inbox asks, optionally, what was wrong, also when the rejected proposals have left the list.
10
+ * With live updates the inbox reloads by itself when agent work changes, for example when a
11
+ * colleague decided a proposal or a run proposed a new one.
12
+ */
13
+ declare class NhAssistantAgentInboxComponent {
14
+ private readonly api;
15
+ private readonly proposalList;
16
+ private subscription?;
17
+ /** Limits the inbox to one agent. */
18
+ readonly agentId: _angular_core.InputSignal<string | undefined>;
19
+ /** Limits the inbox to one kind of subject, for example `project`. */
20
+ readonly subjectType: _angular_core.InputSignal<string | undefined>;
21
+ readonly itemsPerPage: _angular_core.InputSignal<number>;
22
+ readonly page: _angular_core.WritableSignal<number>;
23
+ readonly loading: _angular_core.WritableSignal<boolean>;
24
+ /** True after the first successful load; later loads keep the list, and an open feedback question, in place. */
25
+ readonly loaded: _angular_core.WritableSignal<boolean>;
26
+ readonly loadFailed: _angular_core.WritableSignal<boolean>;
27
+ readonly items: _angular_core.WritableSignal<AgentProposal[]>;
28
+ readonly total: _angular_core.WritableSignal<number>;
29
+ readonly pages: _angular_core.Signal<number>;
30
+ constructor();
31
+ load(): void;
32
+ goTo(page: number): void;
33
+ /**
34
+ * Reloads after a live update. Once the inbox is shown it reloads quietly: no loading state, and
35
+ * a failure keeps the list and an open feedback question in place. While a decision of the list
36
+ * is in flight it waits, because the decision reloads the inbox when it ends.
37
+ */
38
+ private refresh;
39
+ private fetch;
40
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantAgentInboxComponent, never>;
41
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAgentInboxComponent, "nh-assistant-agent-inbox", never, { "agentId": { "alias": "agentId"; "required": false; "isSignal": true; }; "subjectType": { "alias": "subjectType"; "required": false; "isSignal": true; }; "itemsPerPage": { "alias": "itemsPerPage"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
42
+ }
43
+
44
+ type NhAssistantAgentThreadTab = 'proposals' | 'runs' | 'consultations' | 'memory' | 'artifacts';
45
+ /**
46
+ * The agent's work on one subject, for example an "Intake review" tab on a project page: the
47
+ * caller's role, a start action for participants, and the thread's proposals, runs, consultations
48
+ * by other assistants, working memory and files. Everything follows the caller's live role on the
49
+ * subject. With live updates the view reloads by itself when the thread's runs, proposals or
50
+ * feedback change, also when a colleague decided elsewhere.
51
+ */
52
+ declare class NhAssistantAgentThreadViewComponent {
53
+ private readonly api;
54
+ private readonly proposalList;
55
+ private subscription?;
56
+ private proposalSubscription?;
57
+ private startSubscription?;
58
+ readonly agentId: _angular_core.InputSignal<string>;
59
+ readonly subjectType: _angular_core.InputSignal<string>;
60
+ readonly subjectId: _angular_core.InputSignal<string>;
61
+ /** Emits the thread's conversation id, so the host can open it in the assistant panel. */
62
+ readonly openConversation: _angular_core.OutputEmitterRef<string>;
63
+ readonly tab: _angular_core.WritableSignal<NhAssistantAgentThreadTab>;
64
+ readonly loading: _angular_core.WritableSignal<boolean>;
65
+ readonly loadFailed: _angular_core.WritableSignal<boolean>;
66
+ readonly lookup: _angular_core.WritableSignal<AgentThreadLookup | null>;
67
+ readonly proposals: _angular_core.WritableSignal<AgentProposal[]>;
68
+ readonly message: _angular_core.WritableSignal<string>;
69
+ readonly starting: _angular_core.WritableSignal<boolean>;
70
+ readonly receipt: _angular_core.WritableSignal<AgentTriggerReceipt | null>;
71
+ readonly error: _angular_core.WritableSignal<NhAssistantError | null>;
72
+ readonly errorKeys: _angular_core.Signal<string[]>;
73
+ readonly thread: _angular_core.Signal<_newheap_platform_ai_chat.AgentThread | null>;
74
+ readonly role: _angular_core.Signal<_newheap_platform_ai_chat.AgentSubjectRole>;
75
+ readonly tabs: readonly NhAssistantAgentThreadTab[];
76
+ constructor();
77
+ load(): void;
78
+ loadProposals(): void;
79
+ onMessage(event: Event): void;
80
+ start(): void;
81
+ /**
82
+ * Whether a live update is about this view: its own thread, or, before the subject has a thread,
83
+ * a run that may have started it.
84
+ */
85
+ private concerns;
86
+ /**
87
+ * Reloads after a live update. Once the thread is shown it reloads quietly: no loading state, and
88
+ * a failure keeps what is shown, including an open feedback question. While a decision of the
89
+ * proposal list is in flight only the thread reloads, because the decision reloads the proposals
90
+ * when it ends.
91
+ */
92
+ private refresh;
93
+ private fetch;
94
+ private fetchProposals;
95
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantAgentThreadViewComponent, never>;
96
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAgentThreadViewComponent, "nh-assistant-agent-thread-view", never, { "agentId": { "alias": "agentId"; "required": true; "isSignal": true; }; "subjectType": { "alias": "subjectType"; "required": true; "isSignal": true; }; "subjectId": { "alias": "subjectId"; "required": true; "isSignal": true; }; }, { "openConversation": "openConversation"; }, never, never, true, never>;
97
+ }
98
+
99
+ /** A feedback question: after a rejection above the list, or from a card's own action. */
100
+ interface NhAssistantFeedbackRequest {
101
+ approvalIds: string[];
102
+ initial: AgentProposalFeedback | null;
103
+ placement: 'prompt' | 'card';
104
+ /** What was rejected, for a single rejection. */
105
+ summary: string | null;
106
+ /** The feedback was stored; the panel thanks the person until the next action. */
107
+ saved: boolean;
108
+ }
109
+ /**
110
+ * A list of agent proposals with their decision and execution state. People who may decide see
111
+ * approve and reject on pending proposals and the resolution of an execution with an unknown
112
+ * outcome; the server checks every decision again. With `selectable`, pending proposals can be
113
+ * approved or rejected together. Deciding takes one action. After a rejection the list asks,
114
+ * optionally and above the list, what was wrong; closed proposals keep a low-key action to give or
115
+ * change that feedback later. With `decisionRights` each proposal has its own right, for example
116
+ * from the agent work on a subject, and a pending proposal the viewer may not decide says who does.
117
+ */
118
+ declare class NhAssistantAgentProposalsComponent {
119
+ private readonly api;
120
+ private readonly host;
121
+ private readonly injector;
122
+ private subscription?;
123
+ readonly proposals: _angular_core.InputSignal<AgentProposal[]>;
124
+ /** Whether the caller may decide: an approver of the subjects or the inbox owner. */
125
+ readonly canDecide: _angular_core.InputSignal<boolean>;
126
+ /**
127
+ * The caller's live right per proposal, by approval id, for example from
128
+ * `AgentSubjectWork.openProposals`. A proposal with a right uses it instead of `canDecide`.
129
+ */
130
+ readonly decisionRights: _angular_core.InputSignal<ReadonlyMap<string, AgentProposalDecisionRight> | null>;
131
+ readonly selectable: _angular_core.InputSignal<boolean>;
132
+ /** Emits after a proposal or its feedback changed, so the host reloads its list. */
133
+ readonly changed: _angular_core.OutputEmitterRef<void>;
134
+ readonly busy: _angular_core.WritableSignal<boolean>;
135
+ readonly selected: _angular_core.WritableSignal<ReadonlySet<string>>;
136
+ readonly error: _angular_core.WritableSignal<NhAssistantError | null>;
137
+ readonly errorKeys: _angular_core.Signal<string[]>;
138
+ /** Pending proposals the caller may decide. */
139
+ readonly pending: _angular_core.Signal<AgentProposal[]>;
140
+ readonly allSelected: _angular_core.Signal<boolean>;
141
+ /** The feedback question. It does not depend on `proposals`, which drop rejected proposals in the inbox. */
142
+ readonly feedback: _angular_core.WritableSignal<NhAssistantFeedbackRequest | null>;
143
+ constructor();
144
+ /** Whether the caller may decide this proposal: its own right when one was given, otherwise `canDecide`. */
145
+ mayDecide(proposal: AgentProposal): boolean;
146
+ /**
147
+ * Who decides a pending proposal that has a right the caller lacks: another approver when
148
+ * four-eyes keeps out the person who started the work, otherwise an approver.
149
+ */
150
+ waitingForKey(proposal: AgentProposal): string | null;
151
+ toggle(proposal: AgentProposal): void;
152
+ toggleAll(): void;
153
+ decide(proposal: AgentProposal, decision: AgentProposalDecision): void;
154
+ decideSelected(decision: AgentProposalDecision): void;
155
+ resolve(proposal: AgentProposal, action: AgentExecutionResolution): void;
156
+ /** Opens the feedback question in the card of a closed proposal, with the caller's own feedback. */
157
+ giveFeedback(proposal: AgentProposal): void;
158
+ /** True while the feedback question for this proposal is open, above the list or in its card. */
159
+ isAsking(proposal: AgentProposal): boolean;
160
+ /** True when the card of this proposal shows the feedback question or its thanks. */
161
+ inCard(proposal: AgentProposal): boolean;
162
+ /** Keeps the panel, which now thanks the person, and lets the host reload the proposals. */
163
+ onFeedbackSaved(): void;
164
+ /** Closes the question; from a card, focus returns to the card's feedback action. */
165
+ onFeedbackDismissed(): void;
166
+ private ask;
167
+ private run;
168
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantAgentProposalsComponent, never>;
169
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAgentProposalsComponent, "nh-assistant-agent-proposals", never, { "proposals": { "alias": "proposals"; "required": true; "isSignal": true; }; "canDecide": { "alias": "canDecide"; "required": false; "isSignal": true; }; "decisionRights": { "alias": "decisionRights"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; }, { "changed": "changed"; }, never, never, true, never>;
170
+ }
171
+
172
+ /**
173
+ * The runs of an agent thread, newest first: trigger, status, failure, usage, proposals and the
174
+ * summary the next run starts from. Participants cancel an open run; approvers resume or restart
175
+ * a failed or cancelled one. With live updates it reloads by itself when a run or proposal of the
176
+ * thread changes.
177
+ */
178
+ declare class NhAssistantRunTimelineComponent {
179
+ private readonly api;
180
+ private subscription?;
181
+ private actionSubscription?;
182
+ readonly conversationId: _angular_core.InputSignal<string>;
183
+ readonly role: _angular_core.InputSignal<AgentSubjectRole>;
184
+ /** Emits after a run was cancelled or retried. */
185
+ readonly changed: _angular_core.OutputEmitterRef<void>;
186
+ readonly loading: _angular_core.WritableSignal<boolean>;
187
+ readonly loadFailed: _angular_core.WritableSignal<boolean>;
188
+ readonly runs: _angular_core.WritableSignal<AgentRun[]>;
189
+ readonly busyRunId: _angular_core.WritableSignal<string | null>;
190
+ readonly error: _angular_core.WritableSignal<NhAssistantError | null>;
191
+ readonly errorKeys: _angular_core.Signal<string[]>;
192
+ readonly canCancel: _angular_core.Signal<boolean>;
193
+ readonly canRetry: _angular_core.Signal<boolean>;
194
+ constructor();
195
+ load(): void;
196
+ isOpen(run: AgentRun): boolean;
197
+ canRetryRun(run: AgentRun): boolean;
198
+ cancel(run: AgentRun): void;
199
+ retry(run: AgentRun, mode: AgentRunRetryMode): void;
200
+ private act;
201
+ /** A quiet load, after a live update, shows no loading state and keeps the runs when it fails. */
202
+ private fetch;
203
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantRunTimelineComponent, never>;
204
+ 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>;
205
+ }
206
+
207
+ /**
208
+ * The working memory of an agent about the subject of a thread, read-only. The agent keeps it
209
+ * up to date itself; it is shown so that people can see what the agent remembers. With live
210
+ * updates it reloads by itself when a run of the thread changes.
211
+ */
212
+ declare class NhAssistantAgentMemoryComponent {
213
+ private readonly api;
214
+ private subscription?;
215
+ readonly conversationId: _angular_core.InputSignal<string>;
216
+ readonly loading: _angular_core.WritableSignal<boolean>;
217
+ readonly loadFailed: _angular_core.WritableSignal<boolean>;
218
+ readonly memory: _angular_core.WritableSignal<AgentThreadMemory | null>;
219
+ readonly formatted: _angular_core.Signal<string | null>;
220
+ constructor();
221
+ load(): void;
222
+ /** A quiet load, after a live update, shows no loading state and keeps the memory when it fails. */
223
+ private fetch;
224
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantAgentMemoryComponent, never>;
225
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAgentMemoryComponent, "nh-assistant-agent-memory", never, { "conversationId": { "alias": "conversationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
226
+ }
227
+
228
+ /**
229
+ * The files the agent's tools saved in a thread, every version newest first. Files of the
230
+ * agent's own grant that the viewer may not read are listed as shielded and cannot be downloaded.
231
+ * With live updates the list reloads by itself when a run or proposal of the thread changes.
232
+ */
233
+ declare class NhAssistantAgentArtifactsComponent {
234
+ private readonly api;
235
+ private readonly document;
236
+ private subscription?;
237
+ readonly conversationId: _angular_core.InputSignal<string>;
238
+ readonly loading: _angular_core.WritableSignal<boolean>;
239
+ readonly loadFailed: _angular_core.WritableSignal<boolean>;
240
+ readonly downloadFailed: _angular_core.WritableSignal<boolean>;
241
+ readonly artifacts: _angular_core.WritableSignal<AgentArtifact[]>;
242
+ readonly downloadingId: _angular_core.WritableSignal<string | null>;
243
+ constructor();
244
+ load(): void;
245
+ download(artifact: AgentArtifact): Promise<void>;
246
+ /** A quiet load, after a live update, shows no loading state and keeps the files when it fails. */
247
+ private fetch;
248
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantAgentArtifactsComponent, never>;
249
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAgentArtifactsComponent, "nh-assistant-agent-artifacts", never, { "conversationId": { "alias": "conversationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
250
+ }
251
+
252
+ /**
253
+ * Who consulted the thread's agent through another assistant, newest first: the person whose rights
254
+ * were used, the asking assistant, the outcome, the usage and the proposals left for approvers. The
255
+ * question and the answer stay in the asking conversation and are never shown here. With live
256
+ * updates the list reloads by itself when a run or proposal of the thread changes.
257
+ */
258
+ declare class NhAssistantAgentConsultationsComponent {
259
+ private readonly api;
260
+ private subscription?;
261
+ readonly conversationId: _angular_core.InputSignal<string>;
262
+ readonly loading: _angular_core.WritableSignal<boolean>;
263
+ readonly loadFailed: _angular_core.WritableSignal<boolean>;
264
+ readonly consultations: _angular_core.WritableSignal<AgentConsultation[]>;
265
+ readonly total: _angular_core.WritableSignal<number>;
266
+ constructor();
267
+ load(): void;
268
+ /** A quiet load, after a live update, shows no loading state and keeps the list when it fails. */
269
+ private fetch;
270
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantAgentConsultationsComponent, never>;
271
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantAgentConsultationsComponent, "nh-assistant-agent-consultations", never, { "conversationId": { "alias": "conversationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
272
+ }
273
+
274
+ /** The outcome of starting one agent on the subject. */
275
+ interface NhAssistantStartedAgent {
276
+ agentId: string;
277
+ receipt: AgentTriggerReceipt;
278
+ }
279
+ /**
280
+ * The agent work on one subject of the application, for example in a project's dialog: the open
281
+ * proposals of every agent on the subject with the viewer's own decision right, including who
282
+ * decides when the viewer may not and the optional question after a rejection, and per agent the
283
+ * conversation about the subject and, for participants, a start action. `agentId` names the agent
284
+ * whose conversation the host offers also before it worked on the subject. With live updates the
285
+ * view reloads by itself when agent work on its subject changes. Opening a conversation uses
286
+ * `NhAssistantPanelService.openSubject` and emits `conversationOpened` afterwards.
287
+ */
288
+ declare class NhAssistantSubjectSuggestionsComponent {
289
+ private readonly api;
290
+ private readonly panel;
291
+ private readonly store;
292
+ private readonly proposalList;
293
+ private subscription?;
294
+ private startSubscription?;
295
+ private destroyed;
296
+ /** The application's kind of subject, for example `project`. */
297
+ readonly subjectType: _angular_core.InputSignal<string>;
298
+ readonly subjectId: _angular_core.InputSignal<string>;
299
+ /** The agent whose conversation about the subject the host offers, also before it worked on it. */
300
+ readonly agentId: _angular_core.InputSignal<string | undefined>;
301
+ /** Emits once the panel opens the conversation, so a host in a dialog can make room for it. */
302
+ readonly conversationOpened: _angular_core.OutputEmitterRef<AgentThreadLookup>;
303
+ readonly headingId: string;
304
+ readonly loading: _angular_core.WritableSignal<boolean>;
305
+ /** True after the first successful load; later loads keep the list, and an open feedback question, in place. */
306
+ readonly loaded: _angular_core.WritableSignal<boolean>;
307
+ readonly loadFailed: _angular_core.WritableSignal<boolean>;
308
+ /** The caller has no role on the subject, or it no longer exists. */
309
+ readonly unavailable: _angular_core.WritableSignal<boolean>;
310
+ readonly work: _angular_core.WritableSignal<AgentSubjectWork | null>;
311
+ /** The agent whose conversation is opening or which is starting. */
312
+ readonly opening: _angular_core.WritableSignal<string | null>;
313
+ readonly starting: _angular_core.WritableSignal<string | null>;
314
+ readonly started: _angular_core.WritableSignal<NhAssistantStartedAgent | null>;
315
+ readonly error: _angular_core.WritableSignal<NhAssistantError | null>;
316
+ readonly errorKeys: _angular_core.Signal<string[]>;
317
+ /** True while the assistant panel can show a conversation. */
318
+ readonly assistantEnabled: _angular_core.Signal<boolean>;
319
+ readonly agents: _angular_core.Signal<AgentSubjectWorkAgent[]>;
320
+ readonly proposals: _angular_core.Signal<_newheap_platform_ai_chat.AgentProposal[]>;
321
+ readonly decisionRights: _angular_core.Signal<ReadonlyMap<string, AgentProposalDecisionRight>>;
322
+ constructor();
323
+ load(): void;
324
+ /** The translation keys of an agent's name: from the server's status, then the convention. */
325
+ agentNameKeys(agentId: string): string[];
326
+ /** Readers may open an existing conversation; creating one needs the participant role. */
327
+ canOpen(agent: AgentSubjectWorkAgent): boolean;
328
+ open(agent: AgentSubjectWorkAgent): Promise<void>;
329
+ start(agent: AgentSubjectWorkAgent): void;
330
+ /**
331
+ * Reloads after a live update. Once the work is shown it reloads quietly: no loading state, and
332
+ * a failure keeps what is shown, including an open feedback question. While a decision of the
333
+ * list is in flight it waits, because the decision reloads the list when it ends.
334
+ */
335
+ private refresh;
336
+ private fetch;
337
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NhAssistantSubjectSuggestionsComponent, never>;
338
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NhAssistantSubjectSuggestionsComponent, "nh-assistant-subject-suggestions", never, { "subjectType": { "alias": "subjectType"; "required": true; "isSignal": true; }; "subjectId": { "alias": "subjectId"; "required": true; "isSignal": true; }; "agentId": { "alias": "agentId"; "required": false; "isSignal": true; }; }, { "conversationOpened": "conversationOpened"; }, never, never, true, never>;
339
+ }
340
+
341
+ export { NhAssistantAgentArtifactsComponent, NhAssistantAgentConsultationsComponent, NhAssistantAgentInboxComponent, NhAssistantAgentMemoryComponent, NhAssistantAgentProposalsComponent, NhAssistantAgentThreadViewComponent, NhAssistantRunTimelineComponent, NhAssistantSubjectSuggestionsComponent };
342
+ export type { NhAssistantAgentThreadTab };