@webless/agent 0.6.3 → 0.6.4

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,391 @@
1
+ import * as react from 'react';
2
+
3
+ declare const AGENT_TOOL_UI_SCHEMA_VERSION: "webless.tool-ui.v1";
4
+ type AgentToolUiFieldKind = "text" | "textarea" | "email" | "number" | "select" | "multi-select" | "checkbox" | "confirmation" | "radio" | "date" | "time" | "date-time" | "calendar" | "range" | "json";
5
+ type AgentToolUiOption = {
6
+ label: string;
7
+ value: AgentToolResultJsonValue;
8
+ };
9
+ type AgentToolUiField = {
10
+ description?: string;
11
+ kind: AgentToolUiFieldKind;
12
+ label: string;
13
+ max?: number;
14
+ maxItems?: number;
15
+ maxLength?: number;
16
+ min?: number;
17
+ minLength?: number;
18
+ options?: readonly AgentToolUiOption[];
19
+ path: string;
20
+ placeholder?: string;
21
+ required?: boolean;
22
+ step?: number;
23
+ defaultValue?: AgentToolResultJsonValue;
24
+ };
25
+ type AgentToolUiStep = {
26
+ description?: string;
27
+ fieldPaths: readonly string[];
28
+ id: string;
29
+ label: string;
30
+ };
31
+ type AgentToolUiAction = {
32
+ id: "submit" | "back" | "next" | "reset";
33
+ label: string;
34
+ };
35
+ type AgentToolUiSurface = {
36
+ actions?: readonly AgentToolUiAction[];
37
+ description?: string;
38
+ fields: readonly AgentToolUiField[];
39
+ id: string;
40
+ operationId?: string;
41
+ requestId?: string;
42
+ schemaVersion: typeof AGENT_TOOL_UI_SCHEMA_VERSION;
43
+ steps?: readonly AgentToolUiStep[];
44
+ submitLabel?: string;
45
+ title: string;
46
+ toolSlug: string;
47
+ values?: Readonly<Record<string, AgentToolResultJsonValue>>;
48
+ };
49
+
50
+ type AgentToolResultJsonValue = null | boolean | number | string | AgentToolResultJsonValue[] | {
51
+ [key: string]: AgentToolResultJsonValue;
52
+ };
53
+ type AgentToolResultEnvelope = {
54
+ schemaVersion: "webless.tool-result.v1";
55
+ output: AgentToolResultJsonValue;
56
+ presentationKinds: string[];
57
+ ui?: AgentToolUiSurface;
58
+ };
59
+
60
+ type AgentIndexVersion = "published" | "unpublished";
61
+ type AgentInputOption = {
62
+ id: string;
63
+ label: string;
64
+ description?: string;
65
+ style?: "default" | "primary" | "danger";
66
+ };
67
+ type AgentInputRequest = {
68
+ requestId: string;
69
+ kind: "question" | "session-limit" | "tool-approval";
70
+ prompt: string;
71
+ display?: "confirmation" | "select" | "text";
72
+ allowFreeform?: boolean;
73
+ options?: readonly AgentInputOption[];
74
+ ui?: AgentToolUiSurface;
75
+ action: {
76
+ callId: string;
77
+ kind: "tool-call";
78
+ toolName: string;
79
+ };
80
+ };
81
+ type AgentInputResponse = {
82
+ requestId: string;
83
+ optionId?: string;
84
+ text?: string;
85
+ value?: AgentToolResultJsonValue;
86
+ };
87
+ type AgentToolResult = {
88
+ callId: string;
89
+ toolName: string;
90
+ status: "completed" | "failed" | "rejected";
91
+ output?: unknown;
92
+ error?: {
93
+ code: string;
94
+ message: string;
95
+ };
96
+ };
97
+
98
+ type ComposerFormFieldKind = "text" | "email" | "tel" | "textarea";
99
+ type ComposerFormField = {
100
+ id: string;
101
+ kind: ComposerFormFieldKind;
102
+ label: string;
103
+ placeholder: string;
104
+ required: boolean;
105
+ autocomplete?: string;
106
+ };
107
+ type VisitorFormCard = {
108
+ type: "visitor_form";
109
+ fields: ComposerFormField[];
110
+ };
111
+
112
+ type VisitorBooking = {
113
+ eventUri: string;
114
+ inviteeUri?: string;
115
+ inviteeEmail?: string;
116
+ startTime?: string;
117
+ };
118
+ type BookingOfferEventType = {
119
+ name: string;
120
+ uri: string;
121
+ duration?: number;
122
+ locationKind?: string;
123
+ location?: string;
124
+ };
125
+ type BookingOfferSlot = {
126
+ startTime: string;
127
+ eventTypeUri?: string;
128
+ };
129
+ type BookingOffer = {
130
+ type: "booking_offer";
131
+ eventTypes: BookingOfferEventType[];
132
+ slots: BookingOfferSlot[];
133
+ };
134
+ type BookingConfirmed = VisitorBooking & {
135
+ type: "booking_confirmed";
136
+ };
137
+ type BookingCanceled = {
138
+ type: "booking_canceled";
139
+ eventUri: string;
140
+ };
141
+ type ToolCard = BookingOffer | BookingConfirmed | BookingCanceled | VisitorFormCard;
142
+
143
+ type VisitorToolResultLink = {
144
+ label: string;
145
+ href: string;
146
+ };
147
+ type VisitorToolResultDetail = {
148
+ label: string;
149
+ value: string;
150
+ };
151
+ type VisitorToolResultPresentation = {
152
+ id: string;
153
+ toolName: string;
154
+ status: AgentToolResult["status"];
155
+ kind: "summary";
156
+ title: string;
157
+ description?: string;
158
+ details?: readonly VisitorToolResultDetail[];
159
+ links?: readonly VisitorToolResultLink[];
160
+ };
161
+ type VisitorEntityResultPresentation = {
162
+ id: string;
163
+ toolName: string;
164
+ status: AgentToolResult["status"];
165
+ kind: "entity";
166
+ title: string;
167
+ description?: string;
168
+ details?: readonly VisitorToolResultDetail[];
169
+ links?: readonly VisitorToolResultLink[];
170
+ };
171
+ type VisitorCollectionItemPresentation = {
172
+ title: string;
173
+ description?: string;
174
+ details?: readonly VisitorToolResultDetail[];
175
+ href?: string;
176
+ };
177
+ type VisitorCollectionResultPresentation = {
178
+ id: string;
179
+ toolName: string;
180
+ status: AgentToolResult["status"];
181
+ kind: "collection";
182
+ title: string;
183
+ items: readonly VisitorCollectionItemPresentation[];
184
+ };
185
+ type VisitorSignatureResultPresentation = {
186
+ id: string;
187
+ toolName: string;
188
+ status: AgentToolResult["status"];
189
+ kind: "signature";
190
+ title: string;
191
+ description?: string;
192
+ statusLabel?: string;
193
+ links?: readonly VisitorToolResultLink[];
194
+ };
195
+ type VisitorBookingResultPresentation = {
196
+ id: string;
197
+ toolName: string;
198
+ status: AgentToolResult["status"];
199
+ kind: "booking";
200
+ card: ToolCard;
201
+ };
202
+ type VisitorToolInputResultPresentation = {
203
+ id: string;
204
+ toolName: string;
205
+ status: AgentToolResult["status"];
206
+ kind: "input";
207
+ surface: AgentToolUiSurface;
208
+ };
209
+ type VisitorHiddenToolResultPresentation = {
210
+ id: string;
211
+ toolName: string;
212
+ status: AgentToolResult["status"];
213
+ kind: "hidden";
214
+ };
215
+ type ResolvedVisitorToolResultPresentation = VisitorToolResultPresentation | VisitorEntityResultPresentation | VisitorCollectionResultPresentation | VisitorSignatureResultPresentation | VisitorBookingResultPresentation | VisitorToolInputResultPresentation | VisitorHiddenToolResultPresentation;
216
+ type VisitorToolResultPresenterOutput = Omit<VisitorToolResultPresentation, "id" | "toolName" | "status"> | Omit<VisitorEntityResultPresentation, "id" | "toolName" | "status"> | Omit<VisitorCollectionResultPresentation, "id" | "toolName" | "status"> | Omit<VisitorSignatureResultPresentation, "id" | "toolName" | "status"> | {
217
+ kind: "booking";
218
+ card: ToolCard;
219
+ };
220
+ type VisitorToolResultPresenter = {
221
+ kind: string;
222
+ present: (input: {
223
+ envelope: AgentToolResultEnvelope;
224
+ presentationKind: string;
225
+ result: AgentToolResult;
226
+ }) => VisitorToolResultPresenterOutput | null;
227
+ };
228
+ type VisitorToolResultRegistry = readonly VisitorToolResultPresenter[];
229
+ declare const builtInVisitorToolResultRegistry: VisitorToolResultRegistry;
230
+ declare function presentVisitorToolResult(result: AgentToolResult, registry?: VisitorToolResultRegistry): ResolvedVisitorToolResultPresentation;
231
+
232
+ type ToolStepState = "completed" | "active" | "pending" | "error";
233
+ type ToolStep = {
234
+ id: string;
235
+ kind: "planning" | "search" | "specialist";
236
+ label: string;
237
+ state: ToolStepState;
238
+ detail?: string;
239
+ };
240
+ type Citation = {
241
+ id: string;
242
+ label: string;
243
+ url: string;
244
+ };
245
+ type FollowUpSuggestion = {
246
+ id: string;
247
+ label: string;
248
+ };
249
+ type JourneyContext = {
250
+ id: string;
251
+ name: string;
252
+ currentStep?: number;
253
+ totalSteps?: number;
254
+ stepLabel?: string;
255
+ };
256
+ type ConversationMessage = {
257
+ id: string;
258
+ role: "visitor";
259
+ text: string;
260
+ createdAt: number;
261
+ runtimeText?: string;
262
+ } | {
263
+ id: string;
264
+ role: "agent";
265
+ text: string;
266
+ createdAt: number;
267
+ citations?: Citation[];
268
+ toolReceipts?: string[];
269
+ streaming?: boolean;
270
+ };
271
+ type AgentRailPhase = "idle" | "thinking" | "running-tools" | "waiting-input" | "streaming" | "error" | "complete";
272
+ type AgentRailState = {
273
+ phase: AgentRailPhase;
274
+ messages: ConversationMessage[];
275
+ toolSteps: ToolStep[];
276
+ journey: JourneyContext | null;
277
+ followUps: FollowUpSuggestion[];
278
+ streamingText: string;
279
+ pendingOffer: BookingOffer | null;
280
+ pendingInputs?: AgentInputRequest[];
281
+ toolResults?: (VisitorToolResultPresentation | VisitorEntityResultPresentation | VisitorCollectionResultPresentation | VisitorSignatureResultPresentation | VisitorToolInputResultPresentation)[];
282
+ error: string | null;
283
+ };
284
+ type AgentRailTheme = {
285
+ railMaxWidth: string;
286
+ brand: string;
287
+ brandSoft: string;
288
+ brandDeep: string;
289
+ surface: string;
290
+ surfaceMuted: string;
291
+ text: string;
292
+ textMuted: string;
293
+ textSubtle: string;
294
+ border: string;
295
+ visitorBubble: string;
296
+ visitorText: string;
297
+ success: string;
298
+ danger: string;
299
+ fontBody: string;
300
+ fontDisplay: string;
301
+ };
302
+ type AgentColorScheme = "auto" | "light" | "dark";
303
+ declare const defaultAgentRailTheme: AgentRailTheme;
304
+ declare const defaultDarkAgentRailTheme: AgentRailTheme;
305
+
306
+ type AssistTabVariant = "outline" | "ask" | "fill";
307
+ type AssistTabSide = "right" | "left" | "top" | "bottom";
308
+ declare function AssistEdgeTab({ variant, side, along, inset, visible, label, customIconUrl, logoUrl, brandColor, brandForeground, borderColor, fontFamily, mobile, surfaceColor, textColor, colorScheme, onOpen, }: {
309
+ variant: AssistTabVariant;
310
+ side: AssistTabSide;
311
+ along: number;
312
+ inset: number;
313
+ visible: boolean;
314
+ label?: string;
315
+ customIconUrl?: string;
316
+ logoUrl?: string;
317
+ brandColor?: string;
318
+ brandForeground?: string;
319
+ borderColor?: string;
320
+ fontFamily?: string;
321
+ mobile?: boolean;
322
+ surfaceColor?: string;
323
+ textColor?: string;
324
+ colorScheme?: AgentColorScheme;
325
+ onOpen: () => void;
326
+ }): react.JSX.Element;
327
+
328
+ type AgentPlacementConfig = {
329
+ side: AssistTabSide;
330
+ along: number;
331
+ inset: number;
332
+ variant: AssistTabVariant;
333
+ };
334
+ declare const DEFAULT_AGENT_PLACEMENT: AgentPlacementConfig;
335
+ declare function normalizeAgentPlacement(placement?: Partial<AgentPlacementConfig>): AgentPlacementConfig;
336
+
337
+ type AgentMountStrategy = "body" | "selector" | "script-parent";
338
+ type AgentTabVariant = AgentPlacementConfig["variant"];
339
+ type AgentTabSide = AgentPlacementConfig["side"];
340
+ type AgentBrandingConfig = {
341
+ agentName?: string;
342
+ tabLabel?: string;
343
+ tabIconUrl?: string;
344
+ logoUrl?: string;
345
+ greeting?: string;
346
+ composerPlaceholder?: string;
347
+ poweredByLabel?: string;
348
+ fontFamily?: string;
349
+ colors?: {
350
+ primary?: string;
351
+ primarySoft?: string;
352
+ primaryForeground?: string;
353
+ surface?: string;
354
+ surfaceMuted?: string;
355
+ text?: string;
356
+ textMuted?: string;
357
+ border?: string;
358
+ };
359
+ };
360
+ type AgentTagManifest = {
361
+ customerId: string;
362
+ indexId: string;
363
+ runtimeOrigin?: string;
364
+ version?: AgentIndexVersion;
365
+ mount?: {
366
+ selector?: string;
367
+ strategy?: AgentMountStrategy;
368
+ };
369
+ placement?: Partial<AgentPlacementConfig>;
370
+ pageShift?: boolean;
371
+ colorScheme?: AgentColorScheme;
372
+ branding?: AgentBrandingConfig;
373
+ };
374
+
375
+ declare function normalizeAgentTagManifest(manifest: AgentTagManifest): {
376
+ branding?: AgentBrandingConfig | undefined;
377
+ customerId: string;
378
+ indexId: string;
379
+ runtimeOrigin: string;
380
+ version: AgentIndexVersion;
381
+ mount: {
382
+ selector: string | undefined;
383
+ strategy: AgentMountStrategy;
384
+ };
385
+ placement: AgentPlacementConfig;
386
+ pageShift: boolean;
387
+ colorScheme: AgentColorScheme;
388
+ };
389
+ type NormalizedAgentTagManifest = ReturnType<typeof normalizeAgentTagManifest>;
390
+
391
+ export { type AgentBrandingConfig as A, type VisitorBookingResultPresentation as B, type Citation as C, DEFAULT_AGENT_PLACEMENT as D, type VisitorToolInputResultPresentation as E, type FollowUpSuggestion as F, type VisitorToolResultLink as G, type VisitorToolResultPresentation as H, type VisitorToolResultPresenter as I, type JourneyContext as J, type VisitorToolResultPresenterOutput as K, type VisitorToolResultRegistry as L, builtInVisitorToolResultRegistry as M, type NormalizedAgentTagManifest as N, defaultAgentRailTheme as O, defaultDarkAgentRailTheme as P, normalizeAgentPlacement as Q, type ResolvedVisitorToolResultPresentation as R, normalizeAgentTagManifest as S, type ToolStep as T, presentVisitorToolResult as U, type VisitorBooking as V, type AgentColorScheme as a, type AgentIndexVersion as b, type AgentInputOption as c, type AgentInputRequest as d, type AgentInputResponse as e, type AgentMountStrategy as f, type AgentPlacementConfig as g, type AgentRailPhase as h, type AgentRailState as i, type AgentRailTheme as j, type AgentTabSide as k, type AgentTabVariant as l, type AgentTagManifest as m, type AgentToolResult as n, type AgentToolResultJsonValue as o, type AgentToolUiAction as p, type AgentToolUiField as q, type AgentToolUiFieldKind as r, type AgentToolUiOption as s, type AgentToolUiStep as t, type AgentToolUiSurface as u, AssistEdgeTab as v, type AssistTabSide as w, type AssistTabVariant as x, type ConversationMessage as y, type ToolStepState as z };