calabasas 0.19.4 → 0.19.7

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,160 @@
1
+ import {
2
+ build_default,
3
+ relativeTime
4
+ } from "./index-8gymgyxd.js";
5
+ import"./index-tre7d3f1.js";
6
+ import {
7
+ __toESM
8
+ } from "./index-sdksp5px.js";
9
+ import {
10
+ Box_default,
11
+ Text
12
+ } from "./index-4rn9k8et.js";
13
+ import {
14
+ cliApi,
15
+ require_jsx_dev_runtime,
16
+ useQuery
17
+ } from "./convex-v82j0a6z.js";
18
+ import"./index-vmy4gfe1.js";
19
+
20
+ // src/components/StatusBadge.tsx
21
+ var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
22
+ var STATUS_CONFIG = {
23
+ connected: { color: "green", dot: "●" },
24
+ connecting: { color: "yellow", dot: "●" },
25
+ error: { color: "red", dot: "●" },
26
+ disconnected: { color: "gray", dot: "●" }
27
+ };
28
+ function StatusBadge({ status, width = 0 }) {
29
+ const config = STATUS_CONFIG[status];
30
+ const label = `${config.dot} ${status}`;
31
+ const padded = width > 0 ? label.padEnd(width) : label;
32
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
33
+ children: [
34
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
35
+ color: config.color,
36
+ children: config.dot
37
+ }, undefined, false, undefined, this),
38
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
39
+ children: padded.slice(1)
40
+ }, undefined, false, undefined, this)
41
+ ]
42
+ }, undefined, true, undefined, this);
43
+ }
44
+
45
+ // src/components/BotList.tsx
46
+ var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
47
+ function BotList({
48
+ apiKey,
49
+ selectedIndex,
50
+ onSelect
51
+ }) {
52
+ const bots = useQuery(cliApi.listBots, { apiKey });
53
+ if (bots === undefined) {
54
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
55
+ children: [
56
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
57
+ color: "cyan",
58
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(build_default, {
59
+ type: "dots"
60
+ }, undefined, false, undefined, this)
61
+ }, undefined, false, undefined, this),
62
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
63
+ children: " Loading bots..."
64
+ }, undefined, false, undefined, this)
65
+ ]
66
+ }, undefined, true, undefined, this);
67
+ }
68
+ if (bots.length === 0) {
69
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
70
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
71
+ dimColor: true,
72
+ children: "No bots found. Run `calabasas bot add` to create one."
73
+ }, undefined, false, undefined, this)
74
+ }, undefined, false, undefined, this);
75
+ }
76
+ const COL = { name: 30, status: 16, appId: 22, last: 16 };
77
+ function truncate(str, max) {
78
+ if (str.length <= max)
79
+ return str.padEnd(max);
80
+ return str.slice(0, max - 1) + "…";
81
+ }
82
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
83
+ flexDirection: "column",
84
+ children: [
85
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
86
+ marginBottom: 1,
87
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
88
+ bold: true,
89
+ children: [
90
+ " ",
91
+ "Name".padEnd(COL.name),
92
+ "Status".padEnd(COL.status),
93
+ "Discord App ID".padEnd(COL.appId),
94
+ "Last Connected"
95
+ ]
96
+ }, undefined, true, undefined, this)
97
+ }, undefined, false, undefined, this),
98
+ bots.map((bot, i) => {
99
+ const isSelected = selectedIndex === i;
100
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
101
+ flexDirection: "column",
102
+ children: [
103
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
104
+ children: [
105
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
106
+ color: isSelected ? "cyan" : undefined,
107
+ children: isSelected ? "→ " : " "
108
+ }, undefined, false, undefined, this),
109
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
110
+ bold: isSelected,
111
+ children: truncate(bot.name, COL.name)
112
+ }, undefined, false, undefined, this),
113
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(StatusBadge, {
114
+ status: bot.status,
115
+ width: COL.status
116
+ }, undefined, false, undefined, this),
117
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
118
+ dimColor: true,
119
+ children: bot.discordAppId.padEnd(COL.appId)
120
+ }, undefined, false, undefined, this),
121
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
122
+ dimColor: true,
123
+ children: relativeTime(bot.lastConnectedAt)
124
+ }, undefined, false, undefined, this)
125
+ ]
126
+ }, undefined, true, undefined, this),
127
+ bot.errorMessage && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
128
+ marginLeft: 4,
129
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
130
+ color: "red",
131
+ dimColor: true,
132
+ children: [
133
+ "└",
134
+ " ",
135
+ bot.errorMessage
136
+ ]
137
+ }, undefined, true, undefined, this)
138
+ }, undefined, false, undefined, this),
139
+ !bot.errorMessage && bot.disconnectReason && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
140
+ marginLeft: 4,
141
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
142
+ dimColor: true,
143
+ children: [
144
+ "└",
145
+ " ",
146
+ bot.disconnectReason
147
+ ]
148
+ }, undefined, true, undefined, this)
149
+ }, undefined, false, undefined, this)
150
+ ]
151
+ }, bot._id, true, undefined, this);
152
+ })
153
+ ]
154
+ }, undefined, true, undefined, this);
155
+ }
156
+ export {
157
+ BotList
158
+ };
159
+
160
+ ;