@arbor-education/agent-view-frontend 0.2.1
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 +205 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.ts +429 -0
- package/dist/index.js +2169 -0
- package/dist/style.css +1 -0
- package/package.json +85 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { JSX as JSX_2 } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare type Agent = {
|
|
4
|
+
id: string;
|
|
5
|
+
invocation_id: string;
|
|
6
|
+
agent_definition_ref: string;
|
|
7
|
+
agent_intent?: string | null;
|
|
8
|
+
invocation_name: string;
|
|
9
|
+
application_id: string;
|
|
10
|
+
application_name?: string;
|
|
11
|
+
created_by: string;
|
|
12
|
+
status: AgentStatus;
|
|
13
|
+
context_ref: string | null;
|
|
14
|
+
checklist_ref: string | null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export declare type AgentBrief = {
|
|
18
|
+
tripId: string | null;
|
|
19
|
+
isNewTrip: boolean;
|
|
20
|
+
tripName: string;
|
|
21
|
+
destination: string;
|
|
22
|
+
website: string;
|
|
23
|
+
hasRunBefore: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export declare type AgentChecklistItem = {
|
|
27
|
+
task: string;
|
|
28
|
+
status: AgentChecklistItemStatus;
|
|
29
|
+
description: string;
|
|
30
|
+
prompt?: string;
|
|
31
|
+
clarificationPrompts?: string[];
|
|
32
|
+
children?: AgentChecklistItem[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export declare type AgentChecklistItemStatus = 'generating-a-response' | 'hitl' | 'complete' | 'failed';
|
|
36
|
+
|
|
37
|
+
export declare type AgentChecklistResponse = {
|
|
38
|
+
invocation_id: string;
|
|
39
|
+
checklist: AgentChecklistItem[];
|
|
40
|
+
openingMessage?: ChatMessage;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export declare type AgentDefinition = {
|
|
44
|
+
ref: string;
|
|
45
|
+
display_name: string;
|
|
46
|
+
agent_intent: string;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export declare const AgentMonitorKanban: ({ jwt, headers, baseUrl, agentDefinitionsUrl, agentsUrl, agentUrl, agentChecklistUrl, agentResourcesUrl, agentChatUrl, institutions, }: AgentMonitorKanbanProps) => JSX_2.Element;
|
|
51
|
+
|
|
52
|
+
export declare type AgentMonitorKanbanProps = {
|
|
53
|
+
jwt?: string;
|
|
54
|
+
headers?: Record<string, string>;
|
|
55
|
+
baseUrl: string;
|
|
56
|
+
agentDefinitionsUrl?: string;
|
|
57
|
+
agentsUrl?: string;
|
|
58
|
+
agentUrl?: string;
|
|
59
|
+
agentChecklistUrl?: string;
|
|
60
|
+
agentResourcesUrl?: string;
|
|
61
|
+
agentChatUrl?: string;
|
|
62
|
+
institutions?: InstitutionConfig[];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export declare type AgentResource = {
|
|
66
|
+
uri: string;
|
|
67
|
+
type: AgentResourceType;
|
|
68
|
+
name: string;
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export declare type AgentResourceType = 'MIS_RECORD' | 'FILE' | 'WORKFLOW' | 'LINK';
|
|
73
|
+
|
|
74
|
+
export declare class AgentServiceClient {
|
|
75
|
+
private readonly baseUrl;
|
|
76
|
+
private readonly token?;
|
|
77
|
+
private customHeaders?;
|
|
78
|
+
private readonly urls;
|
|
79
|
+
private readonly fetchImpl;
|
|
80
|
+
constructor(options: AgentServiceClientOptions);
|
|
81
|
+
setHeaders(headers?: Record<string, string>): void;
|
|
82
|
+
listAgentDefinitions(): Promise<ApiAgentDefinition[]>;
|
|
83
|
+
getAgentDefinition(agentDefinitionRef: string): Promise<ApiAgentDefinition>;
|
|
84
|
+
listTripOptions(): Promise<ApiTripOption[]>;
|
|
85
|
+
getDataset(): Promise<{
|
|
86
|
+
dataset: ApiDemoDataset;
|
|
87
|
+
}>;
|
|
88
|
+
setDataset(dataset: ApiDemoDataset): Promise<{
|
|
89
|
+
dataset: ApiDemoDataset;
|
|
90
|
+
}>;
|
|
91
|
+
listAgents(params?: ListAgentsParams): Promise<ApiAgentInvocation[]>;
|
|
92
|
+
createAgent(agentDefinitionRef: string, options?: {
|
|
93
|
+
invocationName?: string;
|
|
94
|
+
agentIntent?: string;
|
|
95
|
+
}): Promise<ApiCreateAgentResponse>;
|
|
96
|
+
getAgent(agentId: string): Promise<ApiAgentInvocationDetail>;
|
|
97
|
+
getAgentChecklist(agentId: string): Promise<ApiChecklistEndpointResponse>;
|
|
98
|
+
getAgentResources(agentId: string): Promise<ApiResourcesEndpointResponse>;
|
|
99
|
+
getAgentContext(agentId: string): Promise<unknown>;
|
|
100
|
+
cancelAgent(agentId: string): Promise<ApiAgentInvocation>;
|
|
101
|
+
archiveAgent(agentId: string): Promise<ApiAgentInvocation>;
|
|
102
|
+
chat(agentId: string, request: ApiChatRequest, options?: ChatOptions): Promise<ApiChatStreamEvent>;
|
|
103
|
+
private authHeaders;
|
|
104
|
+
private apiUrl;
|
|
105
|
+
private resolveUrl;
|
|
106
|
+
private request;
|
|
107
|
+
private toError;
|
|
108
|
+
private consumeSse;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export declare type AgentServiceClientOptions = {
|
|
112
|
+
baseUrl: string;
|
|
113
|
+
token?: string;
|
|
114
|
+
headers?: Record<string, string>;
|
|
115
|
+
urls?: AgentServiceUrlOverrides;
|
|
116
|
+
fetch?: FetchLike;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export declare type AgentServiceConfig = {
|
|
120
|
+
jwt?: string;
|
|
121
|
+
headers?: Record<string, string>;
|
|
122
|
+
urls: AgentServiceUrls;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export declare class AgentServiceError extends Error {
|
|
126
|
+
readonly status: number;
|
|
127
|
+
readonly detail: unknown;
|
|
128
|
+
constructor(status: number, detail: unknown, message?: string);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export declare type AgentServiceLoadState = 'idle' | 'loading' | 'error';
|
|
132
|
+
|
|
133
|
+
export declare type AgentServiceUrlOverrides = {
|
|
134
|
+
agentDefinitions?: string;
|
|
135
|
+
agents?: string;
|
|
136
|
+
agent?: string;
|
|
137
|
+
agentChecklist?: string;
|
|
138
|
+
agentResources?: string;
|
|
139
|
+
agentChat?: string;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export declare type AgentServiceUrls = AgentServiceUrlOverrides & {
|
|
143
|
+
baseUrl: string;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export declare type AgentStatus = 'generating-a-response' | 'hitl' | 'complete' | 'failed';
|
|
147
|
+
|
|
148
|
+
export declare const AgentView: ({ agent, open, onClose, initialBrief, initialPhase, initialChecklist, fetchAgentChecklist, fetchAgentResources, connector, }: AgentViewProps) => JSX_2.Element;
|
|
149
|
+
|
|
150
|
+
export declare type AgentViewProps = {
|
|
151
|
+
agent: Agent;
|
|
152
|
+
open: boolean;
|
|
153
|
+
onClose: () => void;
|
|
154
|
+
initialBrief?: AgentBrief;
|
|
155
|
+
initialPhase?: WorkspacePhase;
|
|
156
|
+
initialChecklist?: AgentChecklistItem[] | null;
|
|
157
|
+
fetchAgentChecklist?: (invocationId: string) => Promise<AgentChecklistResponse>;
|
|
158
|
+
fetchAgentResources?: (invocationId: string) => Promise<AgentResource[]>;
|
|
159
|
+
connector: ChatConnector;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export declare type ApiAgentDefinition = {
|
|
163
|
+
schema_version?: number;
|
|
164
|
+
name: string;
|
|
165
|
+
agent_intent?: string;
|
|
166
|
+
display_name: string;
|
|
167
|
+
description: string;
|
|
168
|
+
enabled?: boolean;
|
|
169
|
+
default_model?: {
|
|
170
|
+
name: string;
|
|
171
|
+
parameters: Record<string, unknown>;
|
|
172
|
+
};
|
|
173
|
+
skill_refs?: string[];
|
|
174
|
+
mcps?: Array<{
|
|
175
|
+
server: string;
|
|
176
|
+
tools: string[];
|
|
177
|
+
}>;
|
|
178
|
+
workflow_refs?: string[];
|
|
179
|
+
tags?: string[];
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export declare type ApiAgentInvocation = {
|
|
183
|
+
id: string;
|
|
184
|
+
invocation_id?: string | null;
|
|
185
|
+
agent_definition_ref: string;
|
|
186
|
+
agent_intent?: string | null;
|
|
187
|
+
invocation_name?: string | null;
|
|
188
|
+
application_id: string;
|
|
189
|
+
application_name?: string;
|
|
190
|
+
created_by: string;
|
|
191
|
+
status: ApiAgentInvocationStatus;
|
|
192
|
+
context_ref?: string | null;
|
|
193
|
+
checklist_ref?: string | null;
|
|
194
|
+
opening_message?: string;
|
|
195
|
+
opening_follow_up_prompts?: string[];
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export declare type ApiAgentInvocationDetail = ApiAgentInvocation & {
|
|
199
|
+
checklist_items?: ApiChecklistItem[] | null;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export declare type ApiAgentInvocationStatus = 'active' | 'cancelled' | 'archived';
|
|
203
|
+
|
|
204
|
+
export declare type ApiAgentResource = {
|
|
205
|
+
uri: string;
|
|
206
|
+
type?: string;
|
|
207
|
+
name?: string;
|
|
208
|
+
description?: string;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export declare type ApiChatMessage = {
|
|
212
|
+
role: ApiChatRole;
|
|
213
|
+
content: string;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export declare type ApiChatRequest = {
|
|
217
|
+
messages: ApiChatMessage[];
|
|
218
|
+
model?: string;
|
|
219
|
+
model_kwargs?: Record<string, unknown>;
|
|
220
|
+
chat_id?: string;
|
|
221
|
+
client_message_id?: string;
|
|
222
|
+
meta?: Record<string, unknown>;
|
|
223
|
+
moderation_enabled?: boolean;
|
|
224
|
+
auto_title?: boolean;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export declare type ApiChatRole = 'system' | 'user' | 'assistant';
|
|
228
|
+
|
|
229
|
+
export declare type ApiChatStreamError = {
|
|
230
|
+
error: true;
|
|
231
|
+
chat_id?: string;
|
|
232
|
+
message: string;
|
|
233
|
+
is_final: boolean;
|
|
234
|
+
meta?: Record<string, unknown>;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export declare type ApiChatStreamEvent = {
|
|
238
|
+
chat_id: string;
|
|
239
|
+
event_id: string;
|
|
240
|
+
client_message_id: string;
|
|
241
|
+
message: ApiChatMessage;
|
|
242
|
+
timestamp: string;
|
|
243
|
+
is_final: boolean;
|
|
244
|
+
moderation_status: string | null;
|
|
245
|
+
follow_up_prompts?: string[];
|
|
246
|
+
meta: Record<string, unknown>;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
declare type ApiChecklistEndpointResponse = ApiChecklistItem[] | {
|
|
250
|
+
checklist_items?: ApiChecklistItem[] | null;
|
|
251
|
+
checklist?: ApiChecklistItem[] | null;
|
|
252
|
+
items?: ApiChecklistItem[] | null;
|
|
253
|
+
opening_message?: string;
|
|
254
|
+
opening_follow_up_prompts?: string[];
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export declare type ApiChecklistItem = {
|
|
258
|
+
id?: string;
|
|
259
|
+
task?: string;
|
|
260
|
+
name?: string;
|
|
261
|
+
label?: string;
|
|
262
|
+
description?: string;
|
|
263
|
+
status?: ApiChecklistItemStatus;
|
|
264
|
+
prompt?: string;
|
|
265
|
+
follow_up_prompts?: string[];
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export declare type ApiChecklistItemStatus = 'in_progress' | 'requires_attention' | 'failed' | 'complete' | 'available' | 'generating-a-response' | 'hitl';
|
|
269
|
+
|
|
270
|
+
export declare type ApiCreateAgentResponse = {
|
|
271
|
+
id: string;
|
|
272
|
+
status: ApiAgentInvocationStatus;
|
|
273
|
+
self_link: string;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export declare type ApiDemoDataset = 'full' | 'sparse' | 'empty';
|
|
277
|
+
|
|
278
|
+
export declare type ApiResourcesEndpointResponse = ApiAgentResource[] | {
|
|
279
|
+
resources?: ApiAgentResource[] | null;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export declare type ApiTripOption = {
|
|
283
|
+
id: string;
|
|
284
|
+
name: string;
|
|
285
|
+
has_run_before?: boolean;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export declare const buildAgentFromDefinition: (definition: AgentDefinition, invocationName: string) => Agent;
|
|
289
|
+
|
|
290
|
+
export declare interface ChatConnector {
|
|
291
|
+
openingMessage(): ChatMessage;
|
|
292
|
+
start(brief: AgentBrief): Promise<ChatTurn>;
|
|
293
|
+
sendMessage(text: string): Promise<ChatTurn>;
|
|
294
|
+
stop(): Promise<void>;
|
|
295
|
+
seedChecklist?(checklist: AgentChecklistItem[]): void;
|
|
296
|
+
bootstrapConversation?(prompt?: string): Promise<ChatMessage[]>;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export declare type ChatMessage = {
|
|
300
|
+
id: string;
|
|
301
|
+
author: ChatMessageAuthor;
|
|
302
|
+
text: string;
|
|
303
|
+
followUpPrompts?: string[];
|
|
304
|
+
pending?: boolean;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
export declare type ChatMessageAuthor = 'agent' | 'user' | 'system';
|
|
308
|
+
|
|
309
|
+
export declare type ChatOptions = {
|
|
310
|
+
onEvent?: (event: ApiChatStreamEvent) => void;
|
|
311
|
+
signal?: AbortSignal;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
export declare type ChatTurn = {
|
|
315
|
+
message: ChatMessage;
|
|
316
|
+
checklist?: AgentChecklistItem[];
|
|
317
|
+
phase?: WorkspacePhase;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export declare const createHttpChatConnectorFactory: (client: AgentServiceClient, options?: HttpChatConnectorOptions & {
|
|
321
|
+
resolveOpeningMessage?: (agent: {
|
|
322
|
+
id: string;
|
|
323
|
+
invocation_id: string;
|
|
324
|
+
}) => ChatMessage | undefined;
|
|
325
|
+
}) => (agent: {
|
|
326
|
+
id: string;
|
|
327
|
+
invocation_id: string;
|
|
328
|
+
}) => HttpChatConnector;
|
|
329
|
+
|
|
330
|
+
declare type FetchLike = typeof fetch;
|
|
331
|
+
|
|
332
|
+
export declare class HttpChatConnector implements ChatConnector {
|
|
333
|
+
private readonly client;
|
|
334
|
+
private readonly agentId;
|
|
335
|
+
private readonly opening;
|
|
336
|
+
private readonly model?;
|
|
337
|
+
private readonly bootstrapPrompt;
|
|
338
|
+
private chatId?;
|
|
339
|
+
private seededChecklist;
|
|
340
|
+
constructor(client: AgentServiceClient, agentId: string, options?: HttpChatConnectorOptions);
|
|
341
|
+
openingMessage(): ChatMessage;
|
|
342
|
+
bootstrapConversation(prompt?: string): Promise<ChatMessage[]>;
|
|
343
|
+
start(brief: AgentBrief): Promise<ChatTurn>;
|
|
344
|
+
sendMessage(text: string): Promise<ChatTurn>;
|
|
345
|
+
stop(): Promise<void>;
|
|
346
|
+
seedChecklist(checklist: AgentChecklistItem[]): void;
|
|
347
|
+
private exchange;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export declare type HttpChatConnectorOptions = {
|
|
351
|
+
openingMessage?: ChatMessage;
|
|
352
|
+
model?: string;
|
|
353
|
+
bootstrapPrompt?: string;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
export declare type InstitutionConfig = {
|
|
357
|
+
name: string;
|
|
358
|
+
applicationId: string;
|
|
359
|
+
applicationUrl: string;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
export declare type ListAgentsParams = {
|
|
363
|
+
status?: ApiAgentInvocationStatus;
|
|
364
|
+
agentDefinitionRef?: string;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
export declare const mapApiAgent: (record: ApiAgentInvocation) => Agent;
|
|
368
|
+
|
|
369
|
+
export declare const mapApiAgentDefinition: (record: ApiAgentDefinition) => AgentDefinition;
|
|
370
|
+
|
|
371
|
+
export declare const mapApiAgentStatus: (status: string) => AgentStatus;
|
|
372
|
+
|
|
373
|
+
export declare const mapApiChecklistEndpointResponse: (invocationId: string, payload: ApiChecklistEndpointResponse, agent?: Pick<ApiAgentInvocation, "opening_message" | "opening_follow_up_prompts">) => AgentChecklistResponse;
|
|
374
|
+
|
|
375
|
+
export declare const mapApiChecklistItem: (item: ApiChecklistItem) => AgentChecklistItem;
|
|
376
|
+
|
|
377
|
+
export declare const mapApiChecklistResponse: (invocationId: string, detail: ApiAgentInvocationDetail) => AgentChecklistResponse;
|
|
378
|
+
|
|
379
|
+
export declare const mapApiChecklistStatus: (status: ApiChecklistItemStatus | string | undefined) => AgentChecklistItemStatus;
|
|
380
|
+
|
|
381
|
+
export declare const mapApiOpeningMessage: (record: Pick<ApiAgentInvocation, "opening_message" | "opening_follow_up_prompts">) => ChatMessage | undefined;
|
|
382
|
+
|
|
383
|
+
export declare const mapApiResource: (record: ApiAgentResource) => AgentResource;
|
|
384
|
+
|
|
385
|
+
export declare const mapApiResourcesEndpointResponse: (payload: ApiResourcesEndpointResponse) => AgentResource[];
|
|
386
|
+
|
|
387
|
+
export declare const mapApiTripOption: (record: ApiTripOption) => {
|
|
388
|
+
hasRunBefore?: true | undefined;
|
|
389
|
+
id: string;
|
|
390
|
+
name: string;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
export declare const NewAgentModal: ({ open, onClose, onStart, agentDefinitions, }: NewAgentModalProps) => JSX_2.Element | null;
|
|
394
|
+
|
|
395
|
+
export declare type NewAgentModalProps = {
|
|
396
|
+
open: boolean;
|
|
397
|
+
onClose: () => void;
|
|
398
|
+
onStart: (payload: NewAgentStartPayload) => void | Promise<void>;
|
|
399
|
+
agentDefinitions: AgentDefinition[];
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
export declare type NewAgentStartPayload = {
|
|
403
|
+
definition: AgentDefinition;
|
|
404
|
+
invocationName: string;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
export declare type TripOption = {
|
|
408
|
+
id: string;
|
|
409
|
+
name: string;
|
|
410
|
+
hasRunBefore?: boolean;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
export declare const useAgentService: (config: AgentServiceConfig) => UseAgentServiceResult;
|
|
414
|
+
|
|
415
|
+
export declare type UseAgentServiceResult = {
|
|
416
|
+
agents: Agent[];
|
|
417
|
+
agentDefinitions: AgentDefinition[];
|
|
418
|
+
loadState: AgentServiceLoadState;
|
|
419
|
+
loadError: string | null;
|
|
420
|
+
reload: () => void;
|
|
421
|
+
fetchAgentChecklist: (invocationId: string) => Promise<AgentChecklistResponse>;
|
|
422
|
+
fetchAgentResources: (invocationId: string) => Promise<AgentResource[]>;
|
|
423
|
+
createAgent: (payload: NewAgentStartPayload) => Promise<Agent>;
|
|
424
|
+
chatConnector: (agent: Agent) => ChatConnector;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
export declare type WorkspacePhase = 'briefing' | 'running' | 'stopped' | 'complete';
|
|
428
|
+
|
|
429
|
+
export { }
|