camox 0.38.0 → 0.40.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.
@@ -1,141 +0,0 @@
1
- import { c } from "react/compiler-runtime";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Button } from "@camox/ui/button";
4
- import { Check, CircleHelp, Loader2, Wrench, XCircle } from "lucide-react";
5
-
6
- //#region src/features/agent-chat/components/AgentToolCallCard.tsx
7
- function getStatus(part, requiresApprovalFallback, result) {
8
- if (part.approval?.approved === false) return "denied";
9
- if (result?.state === "error") return "error";
10
- if (result?.state === "complete") return "complete";
11
- if (part.output !== void 0) return "complete";
12
- if (part.approval?.needsApproval && part.approval.approved === void 0) return "approval";
13
- if (requiresApprovalFallback && part.state === "input-complete") return "approval";
14
- if (part.state === "complete") return "complete";
15
- if (part.state === "approval-responded") return "complete";
16
- return "running";
17
- }
18
- const AgentToolCallCard = (t0) => {
19
- const $ = c(30);
20
- if ($[0] !== "0558c22212ea82c1e7d2ad4ce6a5749c7979e2e1f04725121be94540507bca0e") {
21
- for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
22
- $[0] = "0558c22212ea82c1e7d2ad4ce6a5749c7979e2e1f04725121be94540507bca0e";
23
- }
24
- const { part, label, result, requiresApprovalFallback, onApprovalResponse } = t0;
25
- const t1 = requiresApprovalFallback ?? false;
26
- let t2;
27
- if ($[1] !== part || $[2] !== result || $[3] !== t1) {
28
- t2 = getStatus(part, t1, result);
29
- $[1] = part;
30
- $[2] = result;
31
- $[3] = t1;
32
- $[4] = t2;
33
- } else t2 = $[4];
34
- const status = t2;
35
- const needsApproval = status === "approval";
36
- let t3;
37
- if ($[5] !== status) {
38
- t3 = status === "running" && /* @__PURE__ */ jsx(Loader2, { className: "size-3 animate-spin justify-self-center" });
39
- $[5] = status;
40
- $[6] = t3;
41
- } else t3 = $[6];
42
- let t4;
43
- if ($[7] !== status) {
44
- t4 = status === "complete" && /* @__PURE__ */ jsx(Wrench, { className: "size-3 justify-self-center" });
45
- $[7] = status;
46
- $[8] = t4;
47
- } else t4 = $[8];
48
- let t5;
49
- if ($[9] !== status) {
50
- t5 = status === "approval" && /* @__PURE__ */ jsx(CircleHelp, { className: "size-3 justify-self-center" });
51
- $[9] = status;
52
- $[10] = t5;
53
- } else t5 = $[10];
54
- let t6;
55
- if ($[11] !== status) {
56
- t6 = status === "denied" && /* @__PURE__ */ jsx(XCircle, { className: "size-3 justify-self-center" });
57
- $[11] = status;
58
- $[12] = t6;
59
- } else t6 = $[12];
60
- let t7;
61
- if ($[13] !== status) {
62
- t7 = status === "error" && /* @__PURE__ */ jsx(XCircle, { className: "size-3 justify-self-center" });
63
- $[13] = status;
64
- $[14] = t7;
65
- } else t7 = $[14];
66
- let t8;
67
- if ($[15] !== label) {
68
- t8 = /* @__PURE__ */ jsx("span", {
69
- className: "text-sm",
70
- children: label
71
- });
72
- $[15] = label;
73
- $[16] = t8;
74
- } else t8 = $[16];
75
- let t9;
76
- if ($[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6 || $[21] !== t7 || $[22] !== t8) {
77
- t9 = /* @__PURE__ */ jsxs("span", {
78
- className: "text-muted-foreground grid grid-cols-[1rem_minmax(0,1fr)] items-center gap-2",
79
- children: [
80
- t3,
81
- t4,
82
- t5,
83
- t6,
84
- t7,
85
- t8
86
- ]
87
- });
88
- $[17] = t3;
89
- $[18] = t4;
90
- $[19] = t5;
91
- $[20] = t6;
92
- $[21] = t7;
93
- $[22] = t8;
94
- $[23] = t9;
95
- } else t9 = $[23];
96
- let t10;
97
- if ($[24] !== needsApproval || $[25] !== onApprovalResponse) {
98
- t10 = needsApproval && /* @__PURE__ */ jsxs("div", {
99
- className: "space-y-2 pl-6",
100
- children: [/* @__PURE__ */ jsx("p", {
101
- className: "text-sm",
102
- children: "This immediately impacts your live website"
103
- }), /* @__PURE__ */ jsxs("span", {
104
- className: "flex items-center gap-1",
105
- children: [/* @__PURE__ */ jsxs(Button, {
106
- type: "button",
107
- size: "sm",
108
- variant: "secondary",
109
- onClick: () => onApprovalResponse?.(true),
110
- children: [/* @__PURE__ */ jsx(Check, {
111
- "data-icon": "inline-start",
112
- className: "text-muted-foreground"
113
- }), "Approve"]
114
- }), /* @__PURE__ */ jsx(Button, {
115
- type: "button",
116
- size: "sm",
117
- variant: "ghost",
118
- onClick: () => onApprovalResponse?.(false),
119
- children: "Deny"
120
- })]
121
- })]
122
- });
123
- $[24] = needsApproval;
124
- $[25] = onApprovalResponse;
125
- $[26] = t10;
126
- } else t10 = $[26];
127
- let t11;
128
- if ($[27] !== t10 || $[28] !== t9) {
129
- t11 = /* @__PURE__ */ jsxs("div", {
130
- className: "flex flex-col gap-3",
131
- children: [t9, t10]
132
- });
133
- $[27] = t10;
134
- $[28] = t9;
135
- $[29] = t11;
136
- } else t11 = $[29];
137
- return t11;
138
- };
139
-
140
- //#endregion
141
- export { AgentToolCallCard };