@grindxp/cli 0.1.7 → 0.1.8
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/web/client/assets/Copy.es-Bs4NgJu-.js +1 -0
- package/dist/web/client/assets/Sword.es-2Xm7T3t2.js +1 -0
- package/dist/web/client/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- package/dist/web/client/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- package/dist/web/client/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- package/dist/web/client/assets/index-6XDcqRbL.js +42 -0
- package/dist/web/client/assets/index-BXM1N6tm.js +1 -0
- package/dist/web/client/assets/index-B_KMiE38.js +1 -0
- package/dist/web/client/assets/index-CGj2rOLm.js +1 -0
- package/dist/web/client/assets/index-CS5BuFbt.js +1 -0
- package/dist/web/client/assets/index-CYsASiu-.js +1 -0
- package/dist/web/client/assets/index-DAvwM0SX.js +1 -0
- package/dist/web/client/assets/index-DCBFp5DJ.js +1 -0
- package/dist/web/client/assets/index-DjKt1qNz.js +1 -0
- package/dist/web/client/assets/index-PIcFs1vr.js +1 -0
- package/dist/web/client/assets/instrument-serif-latin-400-italic-DKMiL14s.woff2 +0 -0
- package/dist/web/client/assets/instrument-serif-latin-400-italic-u__WvvIK.woff +0 -0
- package/dist/web/client/assets/instrument-serif-latin-400-normal-BVbkICAY.woff +0 -0
- package/dist/web/client/assets/instrument-serif-latin-400-normal-DnYpCC2O.woff2 +0 -0
- package/dist/web/client/assets/instrument-serif-latin-ext-400-italic-C9HzH3YL.woff2 +0 -0
- package/dist/web/client/assets/instrument-serif-latin-ext-400-italic-D7-lnxEk.woff +0 -0
- package/dist/web/client/assets/instrument-serif-latin-ext-400-normal-C2je3j2s.woff2 +0 -0
- package/dist/web/client/assets/instrument-serif-latin-ext-400-normal-CFCUzsTy.woff +0 -0
- package/dist/web/client/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/web/client/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/web/client/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/web/client/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/web/client/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/web/client/assets/main-BI1EOhmt.js +18 -0
- package/dist/web/client/assets/styles-7TpWqjrh.css +1 -0
- package/dist/web/client/favicon.ico +0 -0
- package/dist/web/server/assets/_tanstack-start-manifest_v-B_rvI8DG.js +4 -0
- package/dist/web/server/assets/agent.functions-zpMkBrG3.js +19144 -0
- package/dist/web/server/assets/data.functions-9hSsMFx_.js +285 -0
- package/dist/web/server/assets/index-4SxmUYH6.js +14 -0
- package/dist/web/server/assets/index-BDL7hA7T.js +5924 -0
- package/dist/web/server/assets/index-BL8u2X7w.js +14 -0
- package/dist/web/server/assets/index-BRRsXrOi.js +14 -0
- package/dist/web/server/assets/index-BiD7uOOh.js +14 -0
- package/dist/web/server/assets/index-C09LXa7Z.js +4587 -0
- package/dist/web/server/assets/index-CJ_-TSqN.js +1426 -0
- package/dist/web/server/assets/index-D2fMUSdJ.js +477 -0
- package/dist/web/server/assets/index-D2yaimYL.js +14 -0
- package/dist/web/server/assets/index-D31yYLCV.js +2275 -0
- package/dist/web/server/assets/index-D3RUqTdb.js +14 -0
- package/dist/web/server/assets/index-D7z4dRpK.js +66 -0
- package/dist/web/server/assets/index-b30aLTKp.js +66 -0
- package/dist/web/server/assets/router-1koL9I3U.js +589 -0
- package/dist/web/server/assets/sessions-DOkG47Ex.js +403 -0
- package/dist/web/server/assets/start-HYkvq4Ni.js +4 -0
- package/dist/web/server/assets/token-W0NPKas8.js +86 -0
- package/dist/web/server/assets/token-util-1cB5CD6M.js +30 -0
- package/dist/web/server/assets/token-util-DA5xS0pj.js +451 -0
- package/dist/web/server/assets/vault.server-Ndu49yTf.js +19356 -0
- package/dist/web/server/server.js +4889 -0
- package/package.json +53 -51
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { c as createServerRpc, l as listQuestsByUser, a as listSkillsByUser, b as listConversations, g as getCompanionByUserId, d as getPromptHistory, e as appendPromptHistory } from "./sessions-DOkG47Ex.js";
|
|
2
|
+
import { g as getVaultContext, a as getUserById } from "./vault.server-Ndu49yTf.js";
|
|
3
|
+
import { c as createServerFn, a as getCookie } from "../server.js";
|
|
4
|
+
import "node:fs";
|
|
5
|
+
import "node:os";
|
|
6
|
+
import "node:path";
|
|
7
|
+
import "path";
|
|
8
|
+
import "fs";
|
|
9
|
+
import "child_process";
|
|
10
|
+
import "node:buffer";
|
|
11
|
+
import "events";
|
|
12
|
+
import "https";
|
|
13
|
+
import "http";
|
|
14
|
+
import "net";
|
|
15
|
+
import "tls";
|
|
16
|
+
import "crypto";
|
|
17
|
+
import "stream";
|
|
18
|
+
import "url";
|
|
19
|
+
import "zlib";
|
|
20
|
+
import "buffer";
|
|
21
|
+
import "node:crypto";
|
|
22
|
+
import "node:async_hooks";
|
|
23
|
+
import "node:stream";
|
|
24
|
+
import "react/jsx-runtime";
|
|
25
|
+
import "@tanstack/react-router/ssr/server";
|
|
26
|
+
import "@tanstack/react-router";
|
|
27
|
+
const SIDEBAR_COOKIE = "grind@sidebar_open";
|
|
28
|
+
const getSidebarPref_createServerFn_handler = createServerRpc({
|
|
29
|
+
id: "5ae2bb0c4c003d915f9054a906ac04c5e5445504bc009ebe1b0909b118638f63",
|
|
30
|
+
name: "getSidebarPref",
|
|
31
|
+
filename: "src/server/data.functions.ts"
|
|
32
|
+
}, (opts) => getSidebarPref.__executeServer(opts));
|
|
33
|
+
const getSidebarPref = createServerFn({
|
|
34
|
+
method: "GET"
|
|
35
|
+
}).handler(getSidebarPref_createServerFn_handler, () => {
|
|
36
|
+
const val = getCookie(SIDEBAR_COOKIE);
|
|
37
|
+
return val !== "false";
|
|
38
|
+
});
|
|
39
|
+
function toSimpleObjectives(objectives) {
|
|
40
|
+
return objectives.map((o) => ({
|
|
41
|
+
id: o.id,
|
|
42
|
+
label: o.label,
|
|
43
|
+
completed: o.completed,
|
|
44
|
+
xpReward: o.xpReward
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
const getDashboardData_createServerFn_handler = createServerRpc({
|
|
48
|
+
id: "cbb2f7cdf3f3a605c4dfa620eb06a3cf071dae878f19986d68e6ef770b13f7fa",
|
|
49
|
+
name: "getDashboardData",
|
|
50
|
+
filename: "src/server/data.functions.ts"
|
|
51
|
+
}, (opts) => getDashboardData.__executeServer(opts));
|
|
52
|
+
const getDashboardData = createServerFn({
|
|
53
|
+
method: "GET"
|
|
54
|
+
}).handler(getDashboardData_createServerFn_handler, async () => {
|
|
55
|
+
const {
|
|
56
|
+
db,
|
|
57
|
+
userId
|
|
58
|
+
} = getVaultContext();
|
|
59
|
+
const user = await getUserById(db, userId);
|
|
60
|
+
if (!user) throw new Error("User not found");
|
|
61
|
+
const todayStart = /* @__PURE__ */ new Date();
|
|
62
|
+
todayStart.setHours(0, 0, 0, 0);
|
|
63
|
+
const todayTs = todayStart.getTime();
|
|
64
|
+
const [recentLogsRaw, todayLogsRaw, totalLogsRaw, activeQuestsRaw, allSkillsRaw] = await Promise.all([db.query.questLogs.findMany({
|
|
65
|
+
where: (ql, {
|
|
66
|
+
eq
|
|
67
|
+
}) => eq(ql.userId, userId),
|
|
68
|
+
orderBy: (ql, {
|
|
69
|
+
desc
|
|
70
|
+
}) => [desc(ql.completedAt)],
|
|
71
|
+
limit: 10,
|
|
72
|
+
with: {
|
|
73
|
+
quest: {
|
|
74
|
+
columns: {
|
|
75
|
+
title: true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}), db.query.questLogs.findMany({
|
|
80
|
+
where: (ql, {
|
|
81
|
+
eq,
|
|
82
|
+
and,
|
|
83
|
+
gte
|
|
84
|
+
}) => and(eq(ql.userId, userId), gte(ql.completedAt, todayTs)),
|
|
85
|
+
columns: {
|
|
86
|
+
xpEarned: true
|
|
87
|
+
}
|
|
88
|
+
}), db.query.questLogs.findMany({
|
|
89
|
+
where: (ql, {
|
|
90
|
+
eq
|
|
91
|
+
}) => eq(ql.userId, userId),
|
|
92
|
+
columns: {
|
|
93
|
+
id: true
|
|
94
|
+
}
|
|
95
|
+
}), listQuestsByUser(db, userId, ["active"]), listSkillsByUser(db, userId)]);
|
|
96
|
+
const xpToday = todayLogsRaw.reduce((sum, log) => sum + log.xpEarned, 0);
|
|
97
|
+
const bestStreak = activeQuestsRaw.reduce((max, q) => Math.max(max, q.streakCount), 0);
|
|
98
|
+
const activeQuests = activeQuestsRaw.map((q) => ({
|
|
99
|
+
id: q.id,
|
|
100
|
+
title: q.title,
|
|
101
|
+
type: q.type,
|
|
102
|
+
difficulty: q.difficulty,
|
|
103
|
+
status: q.status,
|
|
104
|
+
objectives: toSimpleObjectives(q.objectives),
|
|
105
|
+
skillTags: q.skillTags,
|
|
106
|
+
streakCount: q.streakCount,
|
|
107
|
+
baseXp: q.baseXp,
|
|
108
|
+
...q.completedAt !== void 0 ? {
|
|
109
|
+
completedAt: q.completedAt
|
|
110
|
+
} : {},
|
|
111
|
+
...q.deadlineAt !== void 0 ? {
|
|
112
|
+
deadlineAt: q.deadlineAt
|
|
113
|
+
} : {}
|
|
114
|
+
}));
|
|
115
|
+
const topSkills = allSkillsRaw.slice().sort((a, b) => b.xp - a.xp).slice(0, 6).map((s) => ({
|
|
116
|
+
id: s.id,
|
|
117
|
+
name: s.name,
|
|
118
|
+
category: s.category,
|
|
119
|
+
xp: s.xp,
|
|
120
|
+
level: s.level,
|
|
121
|
+
...s.parentId !== void 0 ? {
|
|
122
|
+
parentId: s.parentId
|
|
123
|
+
} : {}
|
|
124
|
+
}));
|
|
125
|
+
const recentActivity = recentLogsRaw.map((log) => ({
|
|
126
|
+
id: log.id,
|
|
127
|
+
questId: log.questId,
|
|
128
|
+
questTitle: log.quest?.title ?? "Quest",
|
|
129
|
+
completedAt: log.completedAt,
|
|
130
|
+
xpEarned: log.xpEarned,
|
|
131
|
+
proofType: log.proofType,
|
|
132
|
+
durationMinutes: log.durationMinutes ?? null,
|
|
133
|
+
streakDay: log.streakDay
|
|
134
|
+
}));
|
|
135
|
+
const result = {
|
|
136
|
+
user: {
|
|
137
|
+
id: user.id,
|
|
138
|
+
displayName: user.displayName,
|
|
139
|
+
level: user.level,
|
|
140
|
+
totalXp: user.totalXp
|
|
141
|
+
},
|
|
142
|
+
xpToday,
|
|
143
|
+
bestStreak,
|
|
144
|
+
questsCompletedTotal: totalLogsRaw.length,
|
|
145
|
+
activeQuests,
|
|
146
|
+
topSkills,
|
|
147
|
+
recentActivity
|
|
148
|
+
};
|
|
149
|
+
return result;
|
|
150
|
+
});
|
|
151
|
+
const getConversations_createServerFn_handler = createServerRpc({
|
|
152
|
+
id: "beec9fd37fa775f9a6fdc16dd643e042dbc9e24c2b45f88ddc7b529513bd4661",
|
|
153
|
+
name: "getConversations",
|
|
154
|
+
filename: "src/server/data.functions.ts"
|
|
155
|
+
}, (opts) => getConversations.__executeServer(opts));
|
|
156
|
+
const getConversations = createServerFn({
|
|
157
|
+
method: "GET"
|
|
158
|
+
}).handler(getConversations_createServerFn_handler, async () => {
|
|
159
|
+
const {
|
|
160
|
+
db,
|
|
161
|
+
userId
|
|
162
|
+
} = getVaultContext();
|
|
163
|
+
const convs = await listConversations(db, userId, 30);
|
|
164
|
+
const result = convs.map((c) => ({
|
|
165
|
+
id: c.id,
|
|
166
|
+
title: c.title,
|
|
167
|
+
createdAt: c.createdAt,
|
|
168
|
+
updatedAt: c.updatedAt
|
|
169
|
+
}));
|
|
170
|
+
return result;
|
|
171
|
+
});
|
|
172
|
+
function validateLoadConvInput(data) {
|
|
173
|
+
if (typeof data !== "object" || data === null) throw new Error("Invalid input");
|
|
174
|
+
const raw = data;
|
|
175
|
+
const conversationId = raw["conversationId"];
|
|
176
|
+
if (typeof conversationId !== "string") throw new Error("conversationId is required");
|
|
177
|
+
return {
|
|
178
|
+
conversationId
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const loadConversationMessages_createServerFn_handler = createServerRpc({
|
|
182
|
+
id: "ca03005c412458a0bc657c061b4f332f92b1ff4b8c19f40ffaf334bca75a0749",
|
|
183
|
+
name: "loadConversationMessages",
|
|
184
|
+
filename: "src/server/data.functions.ts"
|
|
185
|
+
}, (opts) => loadConversationMessages.__executeServer(opts));
|
|
186
|
+
const loadConversationMessages = createServerFn({
|
|
187
|
+
method: "POST"
|
|
188
|
+
}).inputValidator(validateLoadConvInput).handler(loadConversationMessages_createServerFn_handler, async ({
|
|
189
|
+
data
|
|
190
|
+
}) => {
|
|
191
|
+
const {
|
|
192
|
+
db,
|
|
193
|
+
userId
|
|
194
|
+
} = getVaultContext();
|
|
195
|
+
const conv = await db.query.conversations.findFirst({
|
|
196
|
+
where: (c, {
|
|
197
|
+
eq,
|
|
198
|
+
and
|
|
199
|
+
}) => and(eq(c.id, data.conversationId), eq(c.userId, userId))
|
|
200
|
+
});
|
|
201
|
+
if (!conv) return [];
|
|
202
|
+
const msgs = await db.query.messages.findMany({
|
|
203
|
+
where: (m, {
|
|
204
|
+
eq
|
|
205
|
+
}) => eq(m.conversationId, data.conversationId),
|
|
206
|
+
orderBy: (m, {
|
|
207
|
+
asc
|
|
208
|
+
}) => [asc(m.createdAt)],
|
|
209
|
+
limit: 100
|
|
210
|
+
});
|
|
211
|
+
return msgs.map((m) => ({
|
|
212
|
+
id: m.id,
|
|
213
|
+
role: m.role,
|
|
214
|
+
content: m.content,
|
|
215
|
+
toolCallsJson: m.toolCalls != null ? JSON.stringify(m.toolCalls) : null,
|
|
216
|
+
attachments: m.attachments ?? null,
|
|
217
|
+
createdAt: m.createdAt
|
|
218
|
+
}));
|
|
219
|
+
});
|
|
220
|
+
const getCompanionInfo_createServerFn_handler = createServerRpc({
|
|
221
|
+
id: "184ce16af80e6368f2fae4eb2360630a351114a8cc3ee5800b1a08e02b9dd7e9",
|
|
222
|
+
name: "getCompanionInfo",
|
|
223
|
+
filename: "src/server/data.functions.ts"
|
|
224
|
+
}, (opts) => getCompanionInfo.__executeServer(opts));
|
|
225
|
+
const getCompanionInfo = createServerFn({
|
|
226
|
+
method: "GET"
|
|
227
|
+
}).handler(getCompanionInfo_createServerFn_handler, async () => {
|
|
228
|
+
const {
|
|
229
|
+
db,
|
|
230
|
+
userId
|
|
231
|
+
} = getVaultContext();
|
|
232
|
+
const row = await getCompanionByUserId(db, userId);
|
|
233
|
+
return {
|
|
234
|
+
name: row?.name ?? null,
|
|
235
|
+
emoji: row?.emoji ?? null
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
const getPromptHistoryEntries_createServerFn_handler = createServerRpc({
|
|
239
|
+
id: "9a5dc52f000f13d22209e6a0728000f0667bc09e1ac65adb09228596aa34819b",
|
|
240
|
+
name: "getPromptHistoryEntries",
|
|
241
|
+
filename: "src/server/data.functions.ts"
|
|
242
|
+
}, (opts) => getPromptHistoryEntries.__executeServer(opts));
|
|
243
|
+
const getPromptHistoryEntries = createServerFn({
|
|
244
|
+
method: "GET"
|
|
245
|
+
}).handler(getPromptHistoryEntries_createServerFn_handler, async () => {
|
|
246
|
+
const {
|
|
247
|
+
db,
|
|
248
|
+
userId
|
|
249
|
+
} = getVaultContext();
|
|
250
|
+
return getPromptHistory(db, userId);
|
|
251
|
+
});
|
|
252
|
+
function validateAppendPromptInput(data) {
|
|
253
|
+
if (typeof data !== "object" || data === null) throw new Error("Invalid input");
|
|
254
|
+
const raw = data;
|
|
255
|
+
const content = raw["content"];
|
|
256
|
+
if (typeof content !== "string" || !content.trim()) throw new Error("content is required");
|
|
257
|
+
return {
|
|
258
|
+
content: content.trim()
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
const appendPromptHistoryEntry_createServerFn_handler = createServerRpc({
|
|
262
|
+
id: "0106759db375e1456f62d4c1efe7094c3733545535507409fcecd70d465fd501",
|
|
263
|
+
name: "appendPromptHistoryEntry",
|
|
264
|
+
filename: "src/server/data.functions.ts"
|
|
265
|
+
}, (opts) => appendPromptHistoryEntry.__executeServer(opts));
|
|
266
|
+
const appendPromptHistoryEntry = createServerFn({
|
|
267
|
+
method: "POST"
|
|
268
|
+
}).inputValidator(validateAppendPromptInput).handler(appendPromptHistoryEntry_createServerFn_handler, async ({
|
|
269
|
+
data
|
|
270
|
+
}) => {
|
|
271
|
+
const {
|
|
272
|
+
db,
|
|
273
|
+
userId
|
|
274
|
+
} = getVaultContext();
|
|
275
|
+
await appendPromptHistory(db, userId, data.content);
|
|
276
|
+
});
|
|
277
|
+
export {
|
|
278
|
+
appendPromptHistoryEntry_createServerFn_handler,
|
|
279
|
+
getCompanionInfo_createServerFn_handler,
|
|
280
|
+
getConversations_createServerFn_handler,
|
|
281
|
+
getDashboardData_createServerFn_handler,
|
|
282
|
+
getPromptHistoryEntries_createServerFn_handler,
|
|
283
|
+
getSidebarPref_createServerFn_handler,
|
|
284
|
+
loadConversationMessages_createServerFn_handler
|
|
285
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SwordIcon } from "@phosphor-icons/react";
|
|
3
|
+
function QuestsPage() {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-4 p-8 text-center", children: [
|
|
5
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full border border-border bg-card", children: /* @__PURE__ */ jsx(SwordIcon, { size: 28, className: "text-muted-foreground", "aria-hidden": "true" }) }),
|
|
6
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
7
|
+
/* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-foreground", children: "Quests" }),
|
|
8
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Coming soon…" })
|
|
9
|
+
] })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
QuestsPage as component
|
|
14
|
+
};
|