veryfront 0.0.70 → 0.0.72
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/ai/components.js +117 -26
- package/dist/ai/components.js.map +2 -2
- package/dist/ai/dev.js +9 -3
- package/dist/ai/dev.js.map +2 -2
- package/dist/ai/index.js +191 -116
- package/dist/ai/index.js.map +2 -2
- package/dist/ai/primitives.js +24 -16
- package/dist/ai/primitives.js.map +2 -2
- package/dist/ai/production.js +14 -20
- package/dist/ai/production.js.map +1 -1
- package/dist/ai/react.js +84 -20
- package/dist/ai/react.js.map +2 -2
- package/dist/ai/workflow.js +36 -49
- package/dist/ai/workflow.js.map +2 -2
- package/dist/cli.js +1009 -596
- package/dist/components.js +4119 -252
- package/dist/components.js.map +4 -4
- package/dist/config.js +2 -1
- package/dist/config.js.map +2 -2
- package/dist/data.js +22 -27
- package/dist/data.js.map +2 -2
- package/dist/index.js +4162 -293
- package/dist/index.js.map +4 -4
- package/dist/oauth/handlers.js +6 -7
- package/dist/oauth/handlers.js.map +1 -1
- package/dist/oauth/index.js +6 -7
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/providers.js +0 -3
- package/dist/oauth/providers.js.map +1 -1
- package/dist/oauth/token-store.js +6 -4
- package/dist/oauth/token-store.js.map +1 -1
- package/package.json +1 -1
package/dist/ai/components.js
CHANGED
|
@@ -337,7 +337,7 @@ function formatStatus(status) {
|
|
|
337
337
|
// src/ai/react/primitives/tool-primitives.tsx
|
|
338
338
|
import * as React5 from "react";
|
|
339
339
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
340
|
-
var ToolInvocation = React5.forwardRef(({ className, name,
|
|
340
|
+
var ToolInvocation = React5.forwardRef(({ className, name, input, output: _output, state, errorText, dynamic, children, ...props }, ref) => {
|
|
341
341
|
return /* @__PURE__ */ jsxs2(
|
|
342
342
|
"div",
|
|
343
343
|
{
|
|
@@ -345,18 +345,21 @@ var ToolInvocation = React5.forwardRef(({ className, name, args, status, childre
|
|
|
345
345
|
className,
|
|
346
346
|
"data-tool-invocation": "",
|
|
347
347
|
"data-tool-name": name,
|
|
348
|
-
"data-
|
|
348
|
+
"data-state": state,
|
|
349
|
+
"data-dynamic": dynamic || void 0,
|
|
349
350
|
...props,
|
|
350
351
|
children: [
|
|
351
352
|
/* @__PURE__ */ jsxs2("div", { "data-tool-header": "", children: [
|
|
352
353
|
/* @__PURE__ */ jsx5("span", { "data-tool-name": "", children: name }),
|
|
353
|
-
|
|
354
|
+
state && /* @__PURE__ */ jsxs2("span", { "data-tool-state": "", children: [
|
|
354
355
|
"(",
|
|
355
|
-
|
|
356
|
+
state,
|
|
356
357
|
")"
|
|
357
|
-
] })
|
|
358
|
+
] }),
|
|
359
|
+
dynamic && /* @__PURE__ */ jsx5("span", { "data-tool-dynamic": "", children: "[dynamic]" })
|
|
358
360
|
] }),
|
|
359
|
-
|
|
361
|
+
input !== void 0 && /* @__PURE__ */ jsx5("div", { "data-tool-input": "", children: /* @__PURE__ */ jsx5("pre", { children: JSON.stringify(input, null, 2) }) }),
|
|
362
|
+
errorText && /* @__PURE__ */ jsx5("div", { "data-tool-error": "", children: errorText }),
|
|
360
363
|
children
|
|
361
364
|
]
|
|
362
365
|
}
|
|
@@ -364,8 +367,8 @@ var ToolInvocation = React5.forwardRef(({ className, name, args, status, childre
|
|
|
364
367
|
});
|
|
365
368
|
ToolInvocation.displayName = "ToolInvocation";
|
|
366
369
|
var ToolResult = React5.forwardRef(
|
|
367
|
-
({ className,
|
|
368
|
-
const content =
|
|
370
|
+
({ className, output, renderOutput, ...props }, ref) => {
|
|
371
|
+
const content = renderOutput ? renderOutput(output) : JSON.stringify(output, null, 2);
|
|
369
372
|
return /* @__PURE__ */ jsx5(
|
|
370
373
|
"div",
|
|
371
374
|
{
|
|
@@ -379,8 +382,11 @@ var ToolResult = React5.forwardRef(
|
|
|
379
382
|
}
|
|
380
383
|
);
|
|
381
384
|
ToolResult.displayName = "ToolResult";
|
|
385
|
+
function isDynamicTool(tool) {
|
|
386
|
+
return tool.type === "dynamic-tool";
|
|
387
|
+
}
|
|
382
388
|
var ToolList = React5.forwardRef(
|
|
383
|
-
({ className,
|
|
389
|
+
({ className, tools, renderTool, ...props }, ref) => {
|
|
384
390
|
return /* @__PURE__ */ jsx5(
|
|
385
391
|
"div",
|
|
386
392
|
{
|
|
@@ -388,16 +394,18 @@ var ToolList = React5.forwardRef(
|
|
|
388
394
|
className,
|
|
389
395
|
"data-tool-list": "",
|
|
390
396
|
...props,
|
|
391
|
-
children:
|
|
392
|
-
(tool) => renderTool ? /* @__PURE__ */ jsx5(React5.Fragment, { children: renderTool(tool) }, tool.
|
|
397
|
+
children: tools.map(
|
|
398
|
+
(tool) => renderTool ? /* @__PURE__ */ jsx5(React5.Fragment, { children: renderTool(tool) }, tool.toolCallId) : /* @__PURE__ */ jsx5(
|
|
393
399
|
ToolInvocation,
|
|
394
400
|
{
|
|
395
|
-
name: tool.
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
401
|
+
name: tool.toolName,
|
|
402
|
+
input: tool.input,
|
|
403
|
+
state: tool.state,
|
|
404
|
+
errorText: tool.errorText,
|
|
405
|
+
dynamic: isDynamicTool(tool),
|
|
406
|
+
children: tool.output !== void 0 && /* @__PURE__ */ jsx5(ToolResult, { output: tool.output })
|
|
399
407
|
},
|
|
400
|
-
tool.
|
|
408
|
+
tool.toolCallId
|
|
401
409
|
)
|
|
402
410
|
)
|
|
403
411
|
}
|
|
@@ -731,6 +739,11 @@ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
|
731
739
|
function getTextContent(message) {
|
|
732
740
|
return message.parts.filter((p) => p.type === "text").map((p) => p.text).join("");
|
|
733
741
|
}
|
|
742
|
+
function getToolParts(message) {
|
|
743
|
+
return message.parts.filter(
|
|
744
|
+
(p) => p.type.startsWith("tool-") || p.type === "dynamic-tool"
|
|
745
|
+
);
|
|
746
|
+
}
|
|
734
747
|
var Chat = React8.forwardRef(
|
|
735
748
|
({
|
|
736
749
|
messages,
|
|
@@ -750,7 +763,7 @@ var Chat = React8.forwardRef(
|
|
|
750
763
|
className,
|
|
751
764
|
theme: userTheme,
|
|
752
765
|
renderMessage,
|
|
753
|
-
renderTool
|
|
766
|
+
renderTool,
|
|
754
767
|
multiline = false
|
|
755
768
|
}, ref) => {
|
|
756
769
|
const theme = mergeThemes(defaultChatTheme, userTheme);
|
|
@@ -786,6 +799,7 @@ var Chat = React8.forwardRef(
|
|
|
786
799
|
/* @__PURE__ */ jsx7(MessageList, { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsxs4("div", { className: "max-w-2xl mx-auto px-4 py-4 space-y-2", children: [
|
|
787
800
|
messages.map((msg) => {
|
|
788
801
|
const content = getTextContent(msg);
|
|
802
|
+
const toolParts = getToolParts(msg);
|
|
789
803
|
return renderMessage ? /* @__PURE__ */ jsx7(React8.Fragment, { children: renderMessage(msg) }, msg.id) : /* @__PURE__ */ jsx7(
|
|
790
804
|
MessageItem,
|
|
791
805
|
{
|
|
@@ -794,7 +808,30 @@ var Chat = React8.forwardRef(
|
|
|
794
808
|
"flex",
|
|
795
809
|
msg.role === "user" ? "justify-end" : "justify-start"
|
|
796
810
|
),
|
|
797
|
-
children: /* @__PURE__ */
|
|
811
|
+
children: /* @__PURE__ */ jsxs4("div", { className: theme.message?.[msg.role] || theme.message?.assistant, children: [
|
|
812
|
+
msg.role === "user" ? /* @__PURE__ */ jsx7("p", { className: "whitespace-pre-wrap text-[15px] leading-relaxed", children: content }) : /* @__PURE__ */ jsx7(Markdown, { className: "text-[15px] leading-relaxed", children: content }),
|
|
813
|
+
toolParts.length > 0 && /* @__PURE__ */ jsx7("div", { className: "mt-2 space-y-1", children: toolParts.map(
|
|
814
|
+
(tool) => renderTool ? /* @__PURE__ */ jsx7(React8.Fragment, { children: renderTool(tool) }, tool.toolCallId) : /* @__PURE__ */ jsxs4(
|
|
815
|
+
"div",
|
|
816
|
+
{
|
|
817
|
+
className: cn(
|
|
818
|
+
"text-xs rounded px-2 py-1",
|
|
819
|
+
tool.type === "dynamic-tool" ? "bg-blue-50 dark:bg-blue-900/20" : "bg-neutral-100 dark:bg-neutral-800"
|
|
820
|
+
),
|
|
821
|
+
children: [
|
|
822
|
+
/* @__PURE__ */ jsx7("span", { className: "font-mono", children: tool.toolName }),
|
|
823
|
+
/* @__PURE__ */ jsxs4("span", { className: "ml-2 opacity-70", children: [
|
|
824
|
+
"[",
|
|
825
|
+
tool.state,
|
|
826
|
+
"]"
|
|
827
|
+
] }),
|
|
828
|
+
tool.errorText && /* @__PURE__ */ jsx7("div", { className: "text-red-600 dark:text-red-400 mt-1", children: tool.errorText })
|
|
829
|
+
]
|
|
830
|
+
},
|
|
831
|
+
tool.toolCallId
|
|
832
|
+
)
|
|
833
|
+
) })
|
|
834
|
+
] })
|
|
798
835
|
},
|
|
799
836
|
msg.id
|
|
800
837
|
);
|
|
@@ -992,8 +1029,20 @@ function getStatusColor(status) {
|
|
|
992
1029
|
// src/ai/react/components/message.tsx
|
|
993
1030
|
import * as React10 from "react";
|
|
994
1031
|
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1032
|
+
function getTextFromParts(parts) {
|
|
1033
|
+
return parts.filter((p) => p.type === "text").map((p) => p.text).join("");
|
|
1034
|
+
}
|
|
995
1035
|
var Message = React10.forwardRef(
|
|
996
|
-
({
|
|
1036
|
+
({
|
|
1037
|
+
message,
|
|
1038
|
+
className,
|
|
1039
|
+
theme: userTheme,
|
|
1040
|
+
showRole = false,
|
|
1041
|
+
showTimestamp = false,
|
|
1042
|
+
renderToolCall,
|
|
1043
|
+
renderDynamicTool,
|
|
1044
|
+
renderReasoning
|
|
1045
|
+
}, ref) => {
|
|
997
1046
|
const theme = mergeThemes(defaultChatTheme, userTheme);
|
|
998
1047
|
return /* @__PURE__ */ jsx9(
|
|
999
1048
|
MessageItem,
|
|
@@ -1007,16 +1056,58 @@ var Message = React10.forwardRef(
|
|
|
1007
1056
|
),
|
|
1008
1057
|
children: /* @__PURE__ */ jsxs6("div", { className: theme.message?.[message.role] || theme.message?.assistant, children: [
|
|
1009
1058
|
showRole && /* @__PURE__ */ jsx9(MessageRole, { className: "block text-xs font-semibold mb-1 opacity-75 uppercase", children: message.role }),
|
|
1010
|
-
|
|
1011
|
-
|
|
1059
|
+
message.parts.map((part, index) => {
|
|
1060
|
+
const key = `${message.id}-part-${index}`;
|
|
1061
|
+
switch (part.type) {
|
|
1062
|
+
case "text":
|
|
1063
|
+
return /* @__PURE__ */ jsx9(MessageContent, { children: part.text }, key);
|
|
1064
|
+
case "reasoning":
|
|
1065
|
+
if (renderReasoning) {
|
|
1066
|
+
return /* @__PURE__ */ jsx9(React10.Fragment, { children: renderReasoning(part) }, key);
|
|
1067
|
+
}
|
|
1068
|
+
return /* @__PURE__ */ jsx9("div", { className: "text-sm italic opacity-70 my-2 pl-2 border-l-2", children: part.text }, key);
|
|
1069
|
+
case "dynamic-tool":
|
|
1070
|
+
if (renderDynamicTool) {
|
|
1071
|
+
return /* @__PURE__ */ jsx9(React10.Fragment, { children: renderDynamicTool(part) }, key);
|
|
1072
|
+
}
|
|
1073
|
+
return /* @__PURE__ */ jsxs6("div", { className: "text-xs bg-blue-50 rounded p-2 my-2", children: [
|
|
1074
|
+
/* @__PURE__ */ jsx9("span", { className: "font-mono", children: part.toolName }),
|
|
1075
|
+
/* @__PURE__ */ jsxs6("span", { className: "ml-2 text-blue-500", children: [
|
|
1076
|
+
"[dynamic: ",
|
|
1077
|
+
part.state,
|
|
1078
|
+
"]"
|
|
1079
|
+
] }),
|
|
1080
|
+
part.errorText && /* @__PURE__ */ jsx9("div", { className: "text-red-600 mt-1", children: part.errorText })
|
|
1081
|
+
] }, key);
|
|
1082
|
+
default:
|
|
1083
|
+
if (part.type.startsWith("tool-") && "toolCallId" in part) {
|
|
1084
|
+
const toolPart = part;
|
|
1085
|
+
if (renderToolCall) {
|
|
1086
|
+
return /* @__PURE__ */ jsx9(React10.Fragment, { children: renderToolCall(toolPart) }, key);
|
|
1087
|
+
}
|
|
1088
|
+
return /* @__PURE__ */ jsxs6("div", { className: "text-xs bg-gray-100 rounded p-2 my-2", children: [
|
|
1089
|
+
/* @__PURE__ */ jsx9("span", { className: "font-mono", children: toolPart.toolName }),
|
|
1090
|
+
/* @__PURE__ */ jsxs6("span", { className: "ml-2 text-gray-500", children: [
|
|
1091
|
+
"[",
|
|
1092
|
+
toolPart.state,
|
|
1093
|
+
"]"
|
|
1094
|
+
] }),
|
|
1095
|
+
toolPart.errorText && /* @__PURE__ */ jsx9("div", { className: "text-red-600 mt-1", children: toolPart.errorText })
|
|
1096
|
+
] }, key);
|
|
1097
|
+
}
|
|
1098
|
+
return null;
|
|
1099
|
+
}
|
|
1100
|
+
}),
|
|
1101
|
+
showTimestamp && message.createdAt && /* @__PURE__ */ jsx9("div", { className: "text-xs opacity-60 mt-1", children: new Date(message.createdAt).toLocaleTimeString() })
|
|
1012
1102
|
] })
|
|
1013
1103
|
}
|
|
1014
1104
|
);
|
|
1015
1105
|
}
|
|
1016
1106
|
);
|
|
1017
1107
|
Message.displayName = "Message";
|
|
1018
|
-
var StreamingMessage = React10.forwardRef(({
|
|
1108
|
+
var StreamingMessage = React10.forwardRef(({ parts, showCursor = true, className, theme: userTheme }, ref) => {
|
|
1019
1109
|
const theme = mergeThemes(defaultChatTheme, userTheme);
|
|
1110
|
+
const textContent = getTextFromParts(parts);
|
|
1020
1111
|
return /* @__PURE__ */ jsx9(
|
|
1021
1112
|
MessageItem,
|
|
1022
1113
|
{
|
|
@@ -1024,7 +1115,7 @@ var StreamingMessage = React10.forwardRef(({ content, showCursor = true, classNa
|
|
|
1024
1115
|
role: "assistant",
|
|
1025
1116
|
className: cn("flex justify-start", className),
|
|
1026
1117
|
children: /* @__PURE__ */ jsx9("div", { className: theme.message?.assistant, children: /* @__PURE__ */ jsxs6(MessageContent, { children: [
|
|
1027
|
-
|
|
1118
|
+
textContent,
|
|
1028
1119
|
showCursor && /* @__PURE__ */ jsx9("span", { className: "inline-block w-1 h-4 bg-current ml-1 animate-pulse" })
|
|
1029
1120
|
] }) })
|
|
1030
1121
|
}
|
|
@@ -1038,6 +1129,9 @@ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
|
1038
1129
|
var AIErrorBoundary = class extends React11.Component {
|
|
1039
1130
|
constructor(props) {
|
|
1040
1131
|
super(props);
|
|
1132
|
+
this.reset = () => {
|
|
1133
|
+
this.setState({ hasError: false, error: null });
|
|
1134
|
+
};
|
|
1041
1135
|
this.state = { hasError: false, error: null };
|
|
1042
1136
|
}
|
|
1043
1137
|
static getDerivedStateFromError(error) {
|
|
@@ -1049,9 +1143,6 @@ var AIErrorBoundary = class extends React11.Component {
|
|
|
1049
1143
|
this.props.onError(error, errorInfo);
|
|
1050
1144
|
}
|
|
1051
1145
|
}
|
|
1052
|
-
reset = () => {
|
|
1053
|
-
this.setState({ hasError: false, error: null });
|
|
1054
|
-
};
|
|
1055
1146
|
render() {
|
|
1056
1147
|
if (this.state.hasError && this.state.error) {
|
|
1057
1148
|
if (this.props.fallback) {
|