@webless/agent 0.7.4 → 0.8.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/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { e as AgentIndexVersion, k as AgentPlacementConfig, d as AgentColorScheme, c as AgentBrandingConfig, b as AgentAnalyticsConfig, S as VisitorToolResultRegistry, i as AgentMessageFeedback, T as ToolStep, m as AgentRailState, n as AgentRailTheme, F as ConversationMessage, h as AgentInputResponse, z as AgentToolUiSurface, t as AgentToolResultJsonValue, H as FollowUpSuggestion, l as AgentRailPhase, V as VisitorBooking } from './manifest-sR_C4rh_.js';
3
- export { A as AGENT_STRUCTURED_TOOL_INPUT_HEADER, a as AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, f as AgentInputOption, g as AgentInputRequest, o as AgentStructuredToolInput, s as AgentToolResult, u as AgentToolUiAction, v as AgentToolUiField, w as AgentToolUiFieldKind, x as AgentToolUiOption, y as AgentToolUiStep, B as AssistEdgeTab, C as AssistTabSide, D as AssistTabVariant, E as Citation, G as DEFAULT_AGENT_PLACEMENT, J as JourneyContext, R as ResolvedVisitorToolResultPresentation, I as ToolStepState, K as VisitorBookingResultPresentation, L as VisitorToolInputResultPresentation, M as VisitorToolResultLink, O as VisitorToolResultPresentation, P as VisitorToolResultPresenter, Q as VisitorToolResultPresenterOutput, U as builtInVisitorToolResultRegistry, W as defaultAgentRailTheme, X as defaultDarkAgentRailTheme, Y as formatAgentStructuredToolInput, Z as normalizeAgentPlacement, $ as presentVisitorToolResult } from './manifest-sR_C4rh_.js';
2
+ import { e as AgentIndexVersion, k as AgentPlacementConfig, d as AgentColorScheme, c as AgentBrandingConfig, b as AgentAnalyticsConfig, X as VisitorToolResultRegistry, i as AgentMessageFeedback, T as ToolStep, m as AgentRailState, n as AgentRailTheme, H as ConversationMessage, h as AgentInputResponse, C as AgentToolUiSurface, v as AgentToolResultJsonValue, J as FollowUpSuggestion, l as AgentRailPhase, V as VisitorBooking } from './manifest-DgjT8-tW.js';
3
+ export { A as AGENT_STRUCTURED_TOOL_INPUT_HEADER, a as AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, f as AgentInputOption, g as AgentInputRequest, o as AgentSearchReferences, p as AgentSearchSource, q as AgentStructuredToolInput, u as AgentToolResult, w as AgentToolUiAction, x as AgentToolUiField, y as AgentToolUiFieldKind, z as AgentToolUiOption, B as AgentToolUiStep, D as AssistEdgeTab, E as AssistTabSide, F as AssistTabVariant, G as Citation, I as DEFAULT_AGENT_PLACEMENT, K as JourneyContext, R as ResolvedVisitorToolResultPresentation, L as ToolStepState, M as VisitorBookingResultPresentation, O as VisitorSearchResultPresentation, P as VisitorToolInputResultPresentation, Q as VisitorToolResultLink, S as VisitorToolResultPresentation, U as VisitorToolResultPresenter, W as VisitorToolResultPresenterOutput, Y as builtInVisitorToolResultRegistry, Z as defaultAgentRailTheme, _ as defaultDarkAgentRailTheme, $ as formatAgentStructuredToolInput, a0 as normalizeAgentPlacement, a2 as presentVisitorToolResult } from './manifest-DgjT8-tW.js';
4
4
 
5
5
  type AgentWidgetProps = {
6
6
  indexId: string;
@@ -135,4 +135,16 @@ declare function buildAgentAnswerFeedbackEvent(input: {
135
135
  */
136
136
  declare function sendAgentAnswerFeedback(eventUrl: string, event: Record<string, unknown>): void;
137
137
 
138
- export { AGENT_ANSWER_FEEDBACK_EVENT_TYPE, AgentColorScheme, AgentInputResponse, AgentMessageFeedback, AgentPlacementConfig, AgentRail, AgentRailPhase, type AgentRailProps, AgentRailState, AgentRailTheme, AgentToolUiSurface, AgentWidget, type AgentWidgetProps, ConversationMessage, FollowUpSuggestion, MessageActions, ToolStep, type UseAgentChatOptions, VisitorToolResultRegistry, buildAgentAnswerFeedbackEvent, createIdleSuggestions, findPrecedingVisitorText, hasVisitorMessages, isAgentBusy, sendAgentAnswerFeedback, useAgentChat };
138
+ type AgentTranscriptProps = {
139
+ messages: readonly ConversationMessage[];
140
+ theme?: Partial<AgentRailTheme>;
141
+ colorScheme?: AgentColorScheme;
142
+ agentLabel?: string;
143
+ visitorLabel?: string;
144
+ label?: string;
145
+ formatTimestamp?: (createdAt: number) => string;
146
+ };
147
+ /** Renders a stored snapshot; never creates a session or exposes chat actions. */
148
+ declare function AgentTranscript({ messages, theme, colorScheme, agentLabel, visitorLabel, label, formatTimestamp, }: AgentTranscriptProps): react.JSX.Element;
149
+
150
+ export { AGENT_ANSWER_FEEDBACK_EVENT_TYPE, AgentColorScheme, AgentInputResponse, AgentMessageFeedback, AgentPlacementConfig, AgentRail, AgentRailPhase, type AgentRailProps, AgentRailState, AgentRailTheme, AgentToolUiSurface, AgentTranscript, type AgentTranscriptProps, AgentWidget, type AgentWidgetProps, ConversationMessage, FollowUpSuggestion, MessageActions, ToolStep, type UseAgentChatOptions, VisitorToolResultRegistry, buildAgentAnswerFeedbackEvent, createIdleSuggestions, findPrecedingVisitorText, hasVisitorMessages, isAgentBusy, sendAgentAnswerFeedback, useAgentChat };
package/dist/react.js CHANGED
@@ -8,6 +8,8 @@ import {
8
8
  AssistEdgeTab,
9
9
  DEFAULT_AGENT_PLACEMENT,
10
10
  MessageActions,
11
+ MessageBubble,
12
+ agentThemeStyle,
11
13
  buildAgentAnswerFeedbackEvent,
12
14
  builtInVisitorToolResultRegistry,
13
15
  createIdleSuggestions,
@@ -20,13 +22,73 @@ import {
20
22
  normalizeAgentPlacement,
21
23
  presentVisitorToolResult,
22
24
  sendAgentAnswerFeedback,
23
- useAgentChat
24
- } from "./chunk-GS65OJFL.js";
25
+ useAgentChat,
26
+ useAgentColorScheme
27
+ } from "./chunk-JZPXXG76.js";
28
+
29
+ // src/react/components/AgentTranscript/AgentTranscript.tsx
30
+ import { jsx, jsxs } from "react/jsx-runtime";
31
+ var timestampFormat = new Intl.DateTimeFormat("en-US", {
32
+ month: "short",
33
+ day: "numeric",
34
+ hour: "numeric",
35
+ minute: "2-digit",
36
+ timeZone: "UTC"
37
+ });
38
+ function defaultTimestamp(createdAt) {
39
+ return `${timestampFormat.format(createdAt)} UTC`;
40
+ }
41
+ function AgentTranscript({
42
+ messages,
43
+ theme,
44
+ colorScheme,
45
+ agentLabel = "Agent",
46
+ visitorLabel = "Visitor",
47
+ label = "Conversation transcript",
48
+ formatTimestamp = defaultTimestamp
49
+ }) {
50
+ const scheme = useAgentColorScheme(colorScheme);
51
+ return /* @__PURE__ */ jsx(
52
+ "ol",
53
+ {
54
+ className: "webless-agent-root agent-transcript not-typeset",
55
+ "data-not-typeset": "",
56
+ "data-color-scheme": scheme,
57
+ "aria-label": label,
58
+ style: agentThemeStyle(theme, scheme),
59
+ children: messages.map((message) => {
60
+ const date = new Date(message.createdAt);
61
+ const validTimestamp = Number.isFinite(date.getTime());
62
+ return /* @__PURE__ */ jsxs(
63
+ "li",
64
+ {
65
+ className: `agent-transcript__message agent-transcript__message--${message.role}`,
66
+ children: [
67
+ /* @__PURE__ */ jsxs("div", { className: "agent-transcript__meta", children: [
68
+ /* @__PURE__ */ jsx("span", { children: message.role === "visitor" ? visitorLabel : agentLabel }),
69
+ validTimestamp ? /* @__PURE__ */ jsx("time", { dateTime: date.toISOString(), children: formatTimestamp(message.createdAt) }) : null
70
+ ] }),
71
+ /* @__PURE__ */ jsx(
72
+ MessageBubble,
73
+ {
74
+ message: message.role === "agent" ? { ...message, streaming: false } : message,
75
+ bookingDisabled: true
76
+ }
77
+ )
78
+ ]
79
+ },
80
+ message.id
81
+ );
82
+ })
83
+ }
84
+ );
85
+ }
25
86
  export {
26
87
  AGENT_ANSWER_FEEDBACK_EVENT_TYPE,
27
88
  AGENT_STRUCTURED_TOOL_INPUT_HEADER,
28
89
  AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
29
90
  AgentRail,
91
+ AgentTranscript,
30
92
  AgentWidget,
31
93
  AssistEdgeTab,
32
94
  DEFAULT_AGENT_PLACEMENT,
package/dist/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/react/components/AgentTranscript/AgentTranscript.tsx"],"sourcesContent":["import type {\n ConversationMessage,\n AgentColorScheme,\n AgentRailTheme,\n} from \"../../types/conversation\";\nimport { useAgentColorScheme } from \"../../hooks/useAgentColorScheme\";\nimport { agentThemeStyle } from \"../../lib/agent-theme\";\nimport { MessageBubble } from \"../MessageBubble/MessageBubble\";\nimport \"./AgentTranscript.css\";\n\nexport type AgentTranscriptProps = {\n messages: readonly ConversationMessage[];\n theme?: Partial<AgentRailTheme>;\n colorScheme?: AgentColorScheme;\n agentLabel?: string;\n visitorLabel?: string;\n label?: string;\n formatTimestamp?: (createdAt: number) => string;\n};\n\nconst timestampFormat = new Intl.DateTimeFormat(\"en-US\", {\n month: \"short\",\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"2-digit\",\n timeZone: \"UTC\",\n});\nfunction defaultTimestamp(createdAt: number) {\n return `${timestampFormat.format(createdAt)} UTC`;\n}\n\n/** Renders a stored snapshot; never creates a session or exposes chat actions. */\nexport function AgentTranscript({\n messages,\n theme,\n colorScheme,\n agentLabel = \"Agent\",\n visitorLabel = \"Visitor\",\n label = \"Conversation transcript\",\n formatTimestamp = defaultTimestamp,\n}: AgentTranscriptProps) {\n const scheme = useAgentColorScheme(colorScheme);\n return (\n <ol\n className=\"webless-agent-root agent-transcript not-typeset\"\n data-not-typeset=\"\"\n data-color-scheme={scheme}\n aria-label={label}\n style={agentThemeStyle(theme, scheme)}\n >\n {messages.map((message) => {\n const date = new Date(message.createdAt);\n const validTimestamp = Number.isFinite(date.getTime());\n return (\n <li\n key={message.id}\n className={`agent-transcript__message agent-transcript__message--${message.role}`}\n >\n <div className=\"agent-transcript__meta\">\n <span>\n {message.role === \"visitor\" ? visitorLabel : agentLabel}\n </span>\n {validTimestamp ? (\n <time dateTime={date.toISOString()}>\n {formatTimestamp(message.createdAt)}\n </time>\n ) : null}\n </div>\n <MessageBubble\n message={\n message.role === \"agent\"\n ? { ...message, streaming: false }\n : message\n }\n bookingDisabled\n />\n </li>\n );\n })}\n </ol>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DY,SACE,KADF;AAtCZ,IAAM,kBAAkB,IAAI,KAAK,eAAe,SAAS;AAAA,EACvD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AACZ,CAAC;AACD,SAAS,iBAAiB,WAAmB;AAC3C,SAAO,GAAG,gBAAgB,OAAO,SAAS,CAAC;AAC7C;AAGO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,kBAAkB;AACpB,GAAyB;AACvB,QAAM,SAAS,oBAAoB,WAAW;AAC9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,oBAAiB;AAAA,MACjB,qBAAmB;AAAA,MACnB,cAAY;AAAA,MACZ,OAAO,gBAAgB,OAAO,MAAM;AAAA,MAEnC,mBAAS,IAAI,CAAC,YAAY;AACzB,cAAM,OAAO,IAAI,KAAK,QAAQ,SAAS;AACvC,cAAM,iBAAiB,OAAO,SAAS,KAAK,QAAQ,CAAC;AACrD,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,WAAW,wDAAwD,QAAQ,IAAI;AAAA,YAE/E;AAAA,mCAAC,SAAI,WAAU,0BACb;AAAA,oCAAC,UACE,kBAAQ,SAAS,YAAY,eAAe,YAC/C;AAAA,gBACC,iBACC,oBAAC,UAAK,UAAU,KAAK,YAAY,GAC9B,0BAAgB,QAAQ,SAAS,GACpC,IACE;AAAA,iBACN;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACC,SACE,QAAQ,SAAS,UACb,EAAE,GAAG,SAAS,WAAW,MAAM,IAC/B;AAAA,kBAEN,iBAAe;AAAA;AAAA,cACjB;AAAA;AAAA;AAAA,UApBK,QAAQ;AAAA,QAqBf;AAAA,MAEJ,CAAC;AAAA;AAAA,EACH;AAEJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webless/agent",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "Webless Agent SDK — Eve runtime client, React UI, and embed bundle.",
5
5
  "type": "module",
6
6
  "license": "MIT",