@cntyclub/agent-react 0.2.0 → 0.3.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/dist/api/schema.d.ts +347 -0
- package/dist/api/schema.d.ts.map +1 -0
- package/dist/api-client.d.ts +30 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/components/agent-panel.d.ts +20 -0
- package/dist/components/agent-panel.d.ts.map +1 -0
- package/dist/components/agent-widget.d.ts +23 -0
- package/dist/components/agent-widget.d.ts.map +1 -0
- package/dist/components/message-item.d.ts +7 -0
- package/dist/components/message-item.d.ts.map +1 -0
- package/dist/components/tool-approval-card.d.ts +14 -0
- package/dist/components/tool-approval-card.d.ts.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +10 -547
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -88
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/use-agent-chat.d.ts +26 -0
- package/dist/use-agent-chat.d.ts.map +1 -0
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,547 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
header?: never;
|
|
12
|
-
path?: never;
|
|
13
|
-
cookie?: never;
|
|
14
|
-
};
|
|
15
|
-
get?: never;
|
|
16
|
-
put?: never;
|
|
17
|
-
/**
|
|
18
|
-
* Resolve a pending agent action
|
|
19
|
-
* @description Approve or decline a pending write-tool call.
|
|
20
|
-
*/
|
|
21
|
-
post: operations["agent_approval_resolve"];
|
|
22
|
-
delete?: never;
|
|
23
|
-
options?: never;
|
|
24
|
-
head?: never;
|
|
25
|
-
patch?: never;
|
|
26
|
-
trace?: never;
|
|
27
|
-
};
|
|
28
|
-
"/agent-mode/chat/": {
|
|
29
|
-
parameters: {
|
|
30
|
-
query?: never;
|
|
31
|
-
header?: never;
|
|
32
|
-
path?: never;
|
|
33
|
-
cookie?: never;
|
|
34
|
-
};
|
|
35
|
-
get?: never;
|
|
36
|
-
put?: never;
|
|
37
|
-
/**
|
|
38
|
-
* Chat with an agent
|
|
39
|
-
* @description Sends a user message to the agent identified by client_id. Read-only MCP tools run automatically; write tools come back as pending approvals the user must resolve.
|
|
40
|
-
*/
|
|
41
|
-
post: operations["agent_chat_send"];
|
|
42
|
-
delete?: never;
|
|
43
|
-
options?: never;
|
|
44
|
-
head?: never;
|
|
45
|
-
patch?: never;
|
|
46
|
-
trace?: never;
|
|
47
|
-
};
|
|
48
|
-
"/agent-mode/config/": {
|
|
49
|
-
parameters: {
|
|
50
|
-
query?: never;
|
|
51
|
-
header?: never;
|
|
52
|
-
path?: never;
|
|
53
|
-
cookie?: never;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Get agent widget config
|
|
57
|
-
* @description Widget bootstrap: safe agent display config for the resolved client_id.
|
|
58
|
-
*/
|
|
59
|
-
get: operations["agent_config_get"];
|
|
60
|
-
put?: never;
|
|
61
|
-
post?: never;
|
|
62
|
-
delete?: never;
|
|
63
|
-
options?: never;
|
|
64
|
-
head?: never;
|
|
65
|
-
patch?: never;
|
|
66
|
-
trace?: never;
|
|
67
|
-
};
|
|
68
|
-
"/agent-mode/conversations/": {
|
|
69
|
-
parameters: {
|
|
70
|
-
query?: never;
|
|
71
|
-
header?: never;
|
|
72
|
-
path?: never;
|
|
73
|
-
cookie?: never;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* List my conversations
|
|
77
|
-
* @description List the calling user's conversations with an agent.
|
|
78
|
-
*/
|
|
79
|
-
get: operations["agent_conversations_list"];
|
|
80
|
-
put?: never;
|
|
81
|
-
post?: never;
|
|
82
|
-
delete?: never;
|
|
83
|
-
options?: never;
|
|
84
|
-
head?: never;
|
|
85
|
-
patch?: never;
|
|
86
|
-
trace?: never;
|
|
87
|
-
};
|
|
88
|
-
"/agent-mode/conversations/{conversation_id}/": {
|
|
89
|
-
parameters: {
|
|
90
|
-
query?: never;
|
|
91
|
-
header?: never;
|
|
92
|
-
path?: never;
|
|
93
|
-
cookie?: never;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Get conversation messages
|
|
97
|
-
* @description Fetch or delete one of the calling user's conversations.
|
|
98
|
-
*/
|
|
99
|
-
get: operations["agent_conversation_get"];
|
|
100
|
-
put?: never;
|
|
101
|
-
post?: never;
|
|
102
|
-
/**
|
|
103
|
-
* Delete a conversation
|
|
104
|
-
* @description Fetch or delete one of the calling user's conversations.
|
|
105
|
-
*/
|
|
106
|
-
delete: operations["agent_conversation_delete"];
|
|
107
|
-
options?: never;
|
|
108
|
-
head?: never;
|
|
109
|
-
patch?: never;
|
|
110
|
-
trace?: never;
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
interface components {
|
|
114
|
-
schemas: {
|
|
115
|
-
/** @description One chat message as returned by Agent Mode endpoints (wire format). */
|
|
116
|
-
AgentChatMessage: {
|
|
117
|
-
/** Format: uuid */
|
|
118
|
-
id: string;
|
|
119
|
-
/**
|
|
120
|
-
* @description * `user` - user
|
|
121
|
-
* * `assistant` - assistant
|
|
122
|
-
* * `tool` - tool
|
|
123
|
-
* @enum {string}
|
|
124
|
-
*/
|
|
125
|
-
role: "user" | "assistant" | "tool";
|
|
126
|
-
content: string;
|
|
127
|
-
/** Format: date-time */
|
|
128
|
-
created_at: string;
|
|
129
|
-
/** @description Structured UI blocks. Table blocks: {type:'table', tool_name, columns[], rows[], row_count, truncated?, pagination?}. */
|
|
130
|
-
blocks?: {
|
|
131
|
-
[key: string]: unknown;
|
|
132
|
-
}[];
|
|
133
|
-
/** @description Assistant messages only: tools the assistant requested ({id, name, arguments}). */
|
|
134
|
-
tool_calls?: {
|
|
135
|
-
[key: string]: unknown;
|
|
136
|
-
}[];
|
|
137
|
-
tool_name?: string;
|
|
138
|
-
tool_call_id?: string;
|
|
139
|
-
};
|
|
140
|
-
/** @description Response of the chat and approval-resolve endpoints. */
|
|
141
|
-
AgentChatResponse: {
|
|
142
|
-
/**
|
|
143
|
-
* @description * `success` - success
|
|
144
|
-
* * `error` - error
|
|
145
|
-
* @enum {string}
|
|
146
|
-
*/
|
|
147
|
-
status: "success" | "error";
|
|
148
|
-
/** @description Human-readable error detail when status=error. */
|
|
149
|
-
message?: string;
|
|
150
|
-
/** Format: uuid */
|
|
151
|
-
conversation_id?: string;
|
|
152
|
-
/** @description New messages created by this call, in order. */
|
|
153
|
-
messages?: components["schemas"]["AgentChatMessage"][];
|
|
154
|
-
pending_approvals?: components["schemas"]["PendingApproval"][];
|
|
155
|
-
};
|
|
156
|
-
/** @description Response of GET /agent-mode/conversations/<id>/. */
|
|
157
|
-
AgentConversationDetailResponse: {
|
|
158
|
-
conversation: components["schemas"]["ConversationList"];
|
|
159
|
-
messages: components["schemas"]["AgentChatMessage"][];
|
|
160
|
-
pending_approvals: components["schemas"]["PendingApproval"][];
|
|
161
|
-
};
|
|
162
|
-
/** @description Response of GET /agent-mode/conversations/. */
|
|
163
|
-
AgentConversationsResponse: {
|
|
164
|
-
conversations: components["schemas"]["ConversationList"][];
|
|
165
|
-
};
|
|
166
|
-
/** @description Widget bootstrap config — safe, non-sensitive fields only. */
|
|
167
|
-
AgentPublicConfig: {
|
|
168
|
-
name: string;
|
|
169
|
-
description: string;
|
|
170
|
-
has_mcp: boolean;
|
|
171
|
-
is_public: boolean;
|
|
172
|
-
};
|
|
173
|
-
/** @description Input for POST /agent-mode/approvals/<id>/resolve/. */
|
|
174
|
-
ApprovalRequestRequest: {
|
|
175
|
-
client_id: string;
|
|
176
|
-
approve: boolean;
|
|
177
|
-
};
|
|
178
|
-
/** @description Input for POST /agent-mode/chat/. */
|
|
179
|
-
ChatRequestRequest: {
|
|
180
|
-
client_id: string;
|
|
181
|
-
message: string;
|
|
182
|
-
/** Format: uuid */
|
|
183
|
-
conversation_id?: string | null;
|
|
184
|
-
};
|
|
185
|
-
ConversationList: {
|
|
186
|
-
/** Format: uuid */
|
|
187
|
-
readonly id?: string;
|
|
188
|
-
/** @description Derived from the first user message. */
|
|
189
|
-
title?: string;
|
|
190
|
-
/** Format: date-time */
|
|
191
|
-
readonly created_at?: string;
|
|
192
|
-
/** Format: date-time */
|
|
193
|
-
readonly updated_at?: string;
|
|
194
|
-
};
|
|
195
|
-
/** @description A write-tool call waiting for the user's explicit approval. */
|
|
196
|
-
PendingApproval: {
|
|
197
|
-
/** Format: uuid */
|
|
198
|
-
id: string;
|
|
199
|
-
tool_name: string;
|
|
200
|
-
/** @description Stored arguments that will be executed verbatim on approval. */
|
|
201
|
-
arguments: {
|
|
202
|
-
[key: string]: unknown;
|
|
203
|
-
};
|
|
204
|
-
/** Format: date-time */
|
|
205
|
-
created_at: string;
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
responses: never;
|
|
209
|
-
parameters: never;
|
|
210
|
-
requestBodies: never;
|
|
211
|
-
headers: never;
|
|
212
|
-
pathItems: never;
|
|
213
|
-
}
|
|
214
|
-
interface operations {
|
|
215
|
-
agent_approval_resolve: {
|
|
216
|
-
parameters: {
|
|
217
|
-
query?: never;
|
|
218
|
-
header?: never;
|
|
219
|
-
path: {
|
|
220
|
-
call_id: string;
|
|
221
|
-
};
|
|
222
|
-
cookie?: never;
|
|
223
|
-
};
|
|
224
|
-
requestBody: {
|
|
225
|
-
content: {
|
|
226
|
-
"application/json": components["schemas"]["ApprovalRequestRequest"];
|
|
227
|
-
"application/x-www-form-urlencoded": components["schemas"]["ApprovalRequestRequest"];
|
|
228
|
-
"multipart/form-data": components["schemas"]["ApprovalRequestRequest"];
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
responses: {
|
|
232
|
-
200: {
|
|
233
|
-
headers: {
|
|
234
|
-
[name: string]: unknown;
|
|
235
|
-
};
|
|
236
|
-
content: {
|
|
237
|
-
"application/json": components["schemas"]["AgentChatResponse"];
|
|
238
|
-
};
|
|
239
|
-
};
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
agent_chat_send: {
|
|
243
|
-
parameters: {
|
|
244
|
-
query?: never;
|
|
245
|
-
header?: never;
|
|
246
|
-
path?: never;
|
|
247
|
-
cookie?: never;
|
|
248
|
-
};
|
|
249
|
-
requestBody: {
|
|
250
|
-
content: {
|
|
251
|
-
"application/json": components["schemas"]["ChatRequestRequest"];
|
|
252
|
-
"application/x-www-form-urlencoded": components["schemas"]["ChatRequestRequest"];
|
|
253
|
-
"multipart/form-data": components["schemas"]["ChatRequestRequest"];
|
|
254
|
-
};
|
|
255
|
-
};
|
|
256
|
-
responses: {
|
|
257
|
-
200: {
|
|
258
|
-
headers: {
|
|
259
|
-
[name: string]: unknown;
|
|
260
|
-
};
|
|
261
|
-
content: {
|
|
262
|
-
"application/json": components["schemas"]["AgentChatResponse"];
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
agent_config_get: {
|
|
268
|
-
parameters: {
|
|
269
|
-
query?: never;
|
|
270
|
-
header?: never;
|
|
271
|
-
path?: never;
|
|
272
|
-
cookie?: never;
|
|
273
|
-
};
|
|
274
|
-
requestBody?: never;
|
|
275
|
-
responses: {
|
|
276
|
-
200: {
|
|
277
|
-
headers: {
|
|
278
|
-
[name: string]: unknown;
|
|
279
|
-
};
|
|
280
|
-
content: {
|
|
281
|
-
"application/json": components["schemas"]["AgentPublicConfig"];
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
agent_conversations_list: {
|
|
287
|
-
parameters: {
|
|
288
|
-
query?: never;
|
|
289
|
-
header?: never;
|
|
290
|
-
path?: never;
|
|
291
|
-
cookie?: never;
|
|
292
|
-
};
|
|
293
|
-
requestBody?: never;
|
|
294
|
-
responses: {
|
|
295
|
-
200: {
|
|
296
|
-
headers: {
|
|
297
|
-
[name: string]: unknown;
|
|
298
|
-
};
|
|
299
|
-
content: {
|
|
300
|
-
"application/json": components["schemas"]["AgentConversationsResponse"];
|
|
301
|
-
};
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
};
|
|
305
|
-
agent_conversation_get: {
|
|
306
|
-
parameters: {
|
|
307
|
-
query?: never;
|
|
308
|
-
header?: never;
|
|
309
|
-
path: {
|
|
310
|
-
conversation_id: string;
|
|
311
|
-
};
|
|
312
|
-
cookie?: never;
|
|
313
|
-
};
|
|
314
|
-
requestBody?: never;
|
|
315
|
-
responses: {
|
|
316
|
-
200: {
|
|
317
|
-
headers: {
|
|
318
|
-
[name: string]: unknown;
|
|
319
|
-
};
|
|
320
|
-
content: {
|
|
321
|
-
"application/json": components["schemas"]["AgentConversationDetailResponse"];
|
|
322
|
-
};
|
|
323
|
-
};
|
|
324
|
-
};
|
|
325
|
-
};
|
|
326
|
-
agent_conversation_delete: {
|
|
327
|
-
parameters: {
|
|
328
|
-
query?: never;
|
|
329
|
-
header?: never;
|
|
330
|
-
path: {
|
|
331
|
-
conversation_id: string;
|
|
332
|
-
};
|
|
333
|
-
cookie?: never;
|
|
334
|
-
};
|
|
335
|
-
requestBody?: never;
|
|
336
|
-
responses: {
|
|
337
|
-
/** @description No response body */
|
|
338
|
-
204: {
|
|
339
|
-
headers: {
|
|
340
|
-
[name: string]: unknown;
|
|
341
|
-
};
|
|
342
|
-
content?: never;
|
|
343
|
-
};
|
|
344
|
-
};
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* All wire types derive from the generated OpenAPI schema (src/api/schema.ts,
|
|
350
|
-
* generated from api-spec/agent-mode-api.yaml — the backend's
|
|
351
|
-
* /agent-mode/schema/ document). Regenerate with `pnpm gen:api` after updating
|
|
352
|
-
* the spec; see the README for the full update workflow.
|
|
353
|
-
*/
|
|
354
|
-
type AgentModeSchemas = components["schemas"];
|
|
355
|
-
/** A structured UI block attached to a message (currently: result tables). */
|
|
356
|
-
interface TableBlock {
|
|
357
|
-
type: "table";
|
|
358
|
-
tool_name: string;
|
|
359
|
-
columns: string[];
|
|
360
|
-
rows: Record<string, unknown>[];
|
|
361
|
-
row_count: number;
|
|
362
|
-
truncated?: boolean;
|
|
363
|
-
pagination?: Record<string, unknown>;
|
|
364
|
-
}
|
|
365
|
-
type MessageBlock = TableBlock;
|
|
366
|
-
interface ToolCallInfo {
|
|
367
|
-
id?: string;
|
|
368
|
-
name?: string;
|
|
369
|
-
arguments?: Record<string, unknown>;
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* One chat message. Wire shape from the schema; `blocks`/`tool_calls` are
|
|
373
|
-
* JSON fields on the wire, narrowed here to their documented structures.
|
|
374
|
-
*/
|
|
375
|
-
interface AgentMessage extends Omit<AgentModeSchemas["AgentChatMessage"], "blocks" | "tool_calls"> {
|
|
376
|
-
blocks?: MessageBlock[];
|
|
377
|
-
tool_calls?: ToolCallInfo[];
|
|
378
|
-
}
|
|
379
|
-
type PendingApproval = AgentModeSchemas["PendingApproval"];
|
|
380
|
-
type ConversationSummary = Required<AgentModeSchemas["ConversationList"]>;
|
|
381
|
-
type AgentPublicConfig = AgentModeSchemas["AgentPublicConfig"];
|
|
382
|
-
/** Response of the chat and approval-resolve endpoints. */
|
|
383
|
-
interface ChatResponse extends Omit<AgentModeSchemas["AgentChatResponse"], "messages"> {
|
|
384
|
-
messages?: AgentMessage[];
|
|
385
|
-
}
|
|
386
|
-
type ChatRequest = AgentModeSchemas["ChatRequestRequest"];
|
|
387
|
-
type ApprovalRequest = AgentModeSchemas["ApprovalRequestRequest"];
|
|
388
|
-
/** Maps MCP tools to a page in the host app so the agent can navigate alongside chat. */
|
|
389
|
-
interface AgentPageMapping {
|
|
390
|
-
/** MCP tool names whose execution relates to this page. */
|
|
391
|
-
tools: string[];
|
|
392
|
-
/** Host-app route (path) to navigate to, e.g. "/dashboard/target-companies". */
|
|
393
|
-
route: string;
|
|
394
|
-
/** Human title shown in navigation hints. */
|
|
395
|
-
title: string;
|
|
396
|
-
/**
|
|
397
|
-
* Optional builder for dynamic routes: receives the tool arguments and
|
|
398
|
-
* returns the concrete path (e.g. `/dashboard/company/${args.id}`).
|
|
399
|
-
* Return null to skip navigation for that call.
|
|
400
|
-
*/
|
|
401
|
-
buildRoute?: (args: Record<string, unknown>) => string | null;
|
|
402
|
-
}
|
|
403
|
-
interface AgentConfig {
|
|
404
|
-
/** The Agent Mode client ID from the office panel (identifies the agent only). */
|
|
405
|
-
clientId: string;
|
|
406
|
-
/** Country Club backend base URL, e.g. https://api.country.club */
|
|
407
|
-
apiBaseUrl: string;
|
|
408
|
-
/** Returns the logged-in user's Country Club JWT (or null when logged out). */
|
|
409
|
-
getAccessToken: () => string | null | Promise<string | null>;
|
|
410
|
-
/** Display name override; falls back to the backend-configured agent name. */
|
|
411
|
-
agentName?: string;
|
|
412
|
-
/** Short line under the title in the panel header. */
|
|
413
|
-
tagline?: string;
|
|
414
|
-
/** Suggested prompts shown on the empty state. */
|
|
415
|
-
suggestions?: string[];
|
|
416
|
-
/** Navigate the host app (e.g. Next router push). Enables page-follow in popup mode. */
|
|
417
|
-
navigate?: (path: string) => void;
|
|
418
|
-
/** Tool → page mappings used for page-follow navigation and hints. */
|
|
419
|
-
pages?: AgentPageMapping[];
|
|
420
|
-
/** Widget appearance tweaks. All styling comes from the host's UI-kit theme tokens. */
|
|
421
|
-
appearance?: {
|
|
422
|
-
/** Floating button position. Default: "bottom-right". */
|
|
423
|
-
position?: "bottom-right" | "bottom-left";
|
|
424
|
-
/** Desktop popup panel size. Defaults: 400 x 640. */
|
|
425
|
-
panelWidth?: number;
|
|
426
|
-
panelHeight?: number;
|
|
427
|
-
/** Hide the floating button (render the panel through your own trigger). */
|
|
428
|
-
hideLauncher?: boolean;
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
declare class AgentApiError extends Error {
|
|
433
|
-
status: number;
|
|
434
|
-
constructor(message: string, status: number);
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Thin fetch client for the Country Club Agent Mode API.
|
|
438
|
-
*
|
|
439
|
-
* Every request carries the agent client_id (query param — also used by the
|
|
440
|
-
* backend's per-agent CORS middleware, including on preflights) and the
|
|
441
|
-
* logged-in user's bearer token.
|
|
442
|
-
*/
|
|
443
|
-
declare class AgentApiClient {
|
|
444
|
-
private config;
|
|
445
|
-
constructor(config: AgentConfig);
|
|
446
|
-
private request;
|
|
447
|
-
getConfig(): Promise<AgentPublicConfig>;
|
|
448
|
-
sendMessage(message: string, conversationId?: string | null): Promise<ChatResponse>;
|
|
449
|
-
resolveApproval(callId: string, approve: boolean): Promise<ChatResponse>;
|
|
450
|
-
listConversations(): Promise<{
|
|
451
|
-
conversations: ConversationSummary[];
|
|
452
|
-
}>;
|
|
453
|
-
getConversation(conversationId: string): Promise<{
|
|
454
|
-
conversation: ConversationSummary;
|
|
455
|
-
messages: ChatResponse["messages"];
|
|
456
|
-
pending_approvals: ChatResponse["pending_approvals"];
|
|
457
|
-
}>;
|
|
458
|
-
deleteConversation(conversationId: string): Promise<void>;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
interface AgentChatState {
|
|
462
|
-
agentInfo: AgentPublicConfig | null;
|
|
463
|
-
conversationId: string | null;
|
|
464
|
-
conversations: ConversationSummary[];
|
|
465
|
-
messages: AgentMessage[];
|
|
466
|
-
pendingApprovals: PendingApproval[];
|
|
467
|
-
sending: boolean;
|
|
468
|
-
resolvingApprovalId: string | null;
|
|
469
|
-
error: string | null;
|
|
470
|
-
}
|
|
471
|
-
interface AgentChatActions {
|
|
472
|
-
send: (text: string) => Promise<void>;
|
|
473
|
-
resolveApproval: (callId: string, approve: boolean) => Promise<void>;
|
|
474
|
-
newChat: () => void;
|
|
475
|
-
openConversation: (conversationId: string) => Promise<void>;
|
|
476
|
-
refreshConversations: () => Promise<void>;
|
|
477
|
-
deleteConversation: (conversationId: string) => Promise<void>;
|
|
478
|
-
clearError: () => void;
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Headless chat state for an Agent Mode agent: message history, sending,
|
|
482
|
-
* pending write-tool approvals, and conversation management. UI-agnostic.
|
|
483
|
-
*/
|
|
484
|
-
declare function useAgentChat(config: AgentConfig): AgentChatState & AgentChatActions;
|
|
485
|
-
|
|
486
|
-
interface AgentPanelProps {
|
|
487
|
-
config: AgentConfig;
|
|
488
|
-
chat: AgentChatState & AgentChatActions;
|
|
489
|
-
/** Fullscreen "Agent Mode" is active. */
|
|
490
|
-
agentMode: boolean;
|
|
491
|
-
/** Hide the expand button (mobile is always fullscreen). */
|
|
492
|
-
canToggleAgentMode: boolean;
|
|
493
|
-
onToggleAgentMode: () => void;
|
|
494
|
-
onClose: () => void;
|
|
495
|
-
className?: string;
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* The chat surface shared by the popup panel and fullscreen Agent Mode.
|
|
499
|
-
* Header (title, history, new chat, expand/collapse, close) + messages + input.
|
|
500
|
-
*/
|
|
501
|
-
declare function AgentPanel({ agentMode, canToggleAgentMode, chat, className, config, onClose, onToggleAgentMode, }: AgentPanelProps): React.JSX.Element;
|
|
502
|
-
|
|
503
|
-
interface AgentWidgetProps {
|
|
504
|
-
config: AgentConfig;
|
|
505
|
-
/** Controlled open state (optional). */
|
|
506
|
-
open?: boolean;
|
|
507
|
-
onOpenChange?: (open: boolean) => void;
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* The embeddable Agent Mode widget.
|
|
511
|
-
*
|
|
512
|
-
* - Closed: a floating round button (bottom-right by default).
|
|
513
|
-
* - Open on desktop: a popup panel anchored to the button, with an
|
|
514
|
-
* "Agent Mode" button that expands to a fullscreen chat. While in the popup,
|
|
515
|
-
* the widget can navigate the host app to pages related to the tools the
|
|
516
|
-
* agent uses (via `config.pages` + `config.navigate`).
|
|
517
|
-
* - Open on mobile: fullscreen from the start.
|
|
518
|
-
*
|
|
519
|
-
* All colors come from the host app's UI-kit theme tokens, so light/dark mode
|
|
520
|
-
* follows the dashboard automatically.
|
|
521
|
-
*/
|
|
522
|
-
declare function AgentWidget({ config, onOpenChange, open: controlledOpen }: AgentWidgetProps): React.JSX.Element;
|
|
523
|
-
|
|
524
|
-
/** Renders one conversation message: user/assistant bubbles or tool results. */
|
|
525
|
-
declare function MessageItem({ message }: {
|
|
526
|
-
message: AgentMessage;
|
|
527
|
-
}): React.JSX.Element | null;
|
|
528
|
-
|
|
529
|
-
interface ToolApprovalCardProps {
|
|
530
|
-
approval: PendingApproval;
|
|
531
|
-
resolving: boolean;
|
|
532
|
-
onResolve: (callId: string, approve: boolean) => void;
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Approval prompt for a write action the agent wants to perform. The stored
|
|
536
|
-
* arguments are shown so the user knows exactly what will change; nothing runs
|
|
537
|
-
* until they approve.
|
|
538
|
-
*/
|
|
539
|
-
declare function ToolApprovalCard({ approval, onResolve, resolving }: ToolApprovalCardProps): React.JSX.Element;
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* Identity helper that gives host apps full type inference/checking when
|
|
543
|
-
* declaring their agent config file.
|
|
544
|
-
*/
|
|
545
|
-
declare function defineAgentConfig(config: AgentConfig): AgentConfig;
|
|
546
|
-
|
|
547
|
-
export { AgentApiClient, AgentApiError, type AgentChatActions, type AgentChatState, type AgentConfig, type AgentMessage, type components as AgentModeComponents, type operations as AgentModeOperations, type paths as AgentModePaths, type AgentModeSchemas, type AgentPageMapping, AgentPanel, type AgentPanelProps, type AgentPublicConfig, AgentWidget, type AgentWidgetProps, type ApprovalRequest, type ChatRequest, type ChatResponse, type ConversationSummary, type MessageBlock, MessageItem, type PendingApproval, type TableBlock, ToolApprovalCard, type ToolApprovalCardProps, type ToolCallInfo, defineAgentConfig, useAgentChat };
|
|
1
|
+
export { AgentApiClient, AgentApiError } from "./api-client";
|
|
2
|
+
export { AgentPanel, type AgentPanelProps } from "./components/agent-panel";
|
|
3
|
+
export { AgentWidget, type AgentWidgetProps } from "./components/agent-widget";
|
|
4
|
+
export { MessageItem } from "./components/message-item";
|
|
5
|
+
export { ToolApprovalCard, type ToolApprovalCardProps } from "./components/tool-approval-card";
|
|
6
|
+
export { defineAgentConfig } from "./config";
|
|
7
|
+
export type { AgentConfig, AgentMessage, AgentModeSchemas, AgentPageMapping, AgentPublicConfig, ApprovalRequest, ChatRequest, ChatResponse, ConversationSummary, MessageBlock, PendingApproval, TableBlock, ToolCallInfo, } from "./types";
|
|
8
|
+
export type { components as AgentModeComponents, operations as AgentModeOperations, paths as AgentModePaths, } from "./api/schema";
|
|
9
|
+
export { useAgentChat, type AgentChatActions, type AgentChatState, } from "./use-agent-chat";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,UAAU,IAAI,mBAAmB,EACjC,UAAU,IAAI,mBAAmB,EACjC,KAAK,IAAI,cAAc,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAC"}
|