create-theokit 0.2.0 → 0.2.1
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/package.json +1 -1
- package/templates/api-only/package.json.tmpl +2 -1
- package/templates/dashboard/package.json.tmpl +2 -1
- package/templates/default/app/page.tsx +5 -5
- package/templates/default/package.json.tmpl +4 -3
- package/templates/default/server/crons/cleanup-conversations.ts +15 -6
- package/templates/default/server/routes/chat.ts +6 -3
- package/templates/postgres/package.json.tmpl +2 -1
- package/templates/saas/package.json.tmpl +3 -2
package/package.json
CHANGED
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"theokit": "^0.
|
|
13
|
+
"theokit": "^0.2.0",
|
|
14
14
|
"react": "^19.0.0",
|
|
15
15
|
"react-dom": "^19.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.10.0",
|
|
18
19
|
"typescript": "^5.7.0",
|
|
19
20
|
"@types/react": "^19.0.0",
|
|
20
21
|
"@types/react-dom": "^19.0.0"
|
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"theokit": "^0.
|
|
13
|
+
"theokit": "^0.2.0",
|
|
14
14
|
"react": "^19.0.0",
|
|
15
15
|
"react-dom": "^19.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.10.0",
|
|
18
19
|
"typescript": "^5.7.0",
|
|
19
20
|
"@types/react": "^19.0.0",
|
|
20
21
|
"@types/react-dom": "^19.0.0"
|
|
@@ -160,7 +160,7 @@ export default function Page() {
|
|
|
160
160
|
return
|
|
161
161
|
}
|
|
162
162
|
const action = QUICK_ACTIONS.find((a) => a.id === id)
|
|
163
|
-
if (action) handleSubmit(action.label)
|
|
163
|
+
if (action) handleSubmit(typeof action.label === 'string' ? action.label : '')
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
const isStreaming = status === 'streaming'
|
|
@@ -221,9 +221,9 @@ export default function Page() {
|
|
|
221
221
|
return (
|
|
222
222
|
<AgentErrorCard
|
|
223
223
|
key={item.id}
|
|
224
|
-
kind="
|
|
224
|
+
kind="tool-failure"
|
|
225
225
|
title="Agent error"
|
|
226
|
-
|
|
226
|
+
detail={item.message}
|
|
227
227
|
/>
|
|
228
228
|
)
|
|
229
229
|
})}
|
|
@@ -240,8 +240,8 @@ export default function Page() {
|
|
|
240
240
|
<AgentErrorCard
|
|
241
241
|
kind="network"
|
|
242
242
|
title="Stream ended with an error"
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
detail="The connection to the agent endpoint was interrupted. Reset to try again."
|
|
244
|
+
actions={
|
|
245
245
|
<Button variant="ghost" size="sm" onClick={() => reset()}>
|
|
246
246
|
Reset
|
|
247
247
|
</Button>
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"theokit": "^0.
|
|
14
|
-
"@usetheo/sdk": "^1.
|
|
15
|
-
"@usetheo/ui": "^0.12.0
|
|
13
|
+
"theokit": "^0.2.0",
|
|
14
|
+
"@usetheo/sdk": "^1.3.0",
|
|
15
|
+
"@usetheo/ui": "^0.12.0",
|
|
16
16
|
"lucide-react": "^0.469.0",
|
|
17
17
|
"react": "^19.0.0",
|
|
18
18
|
"react-dom": "^19.0.0",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"zod": "^3.24.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.10.0",
|
|
23
24
|
"typescript": "^5.7.0",
|
|
24
25
|
"@types/react": "^19.0.0",
|
|
25
26
|
"@types/react-dom": "^19.0.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineCron } from 'theokit/server/cron'
|
|
2
2
|
import { readdir, stat, rm } from 'node:fs/promises'
|
|
3
|
+
import type { Dirent } from 'node:fs'
|
|
3
4
|
import { join, resolve } from 'node:path'
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -15,21 +16,21 @@ const AGENTS_DIR = '.theokit/agents'
|
|
|
15
16
|
|
|
16
17
|
export default defineCron('cleanup-conversations', {
|
|
17
18
|
schedule: '0 4 * * *', // Daily 04:00 UTC
|
|
18
|
-
handler: async ({
|
|
19
|
+
handler: async ({ traceId }) => {
|
|
19
20
|
const root = resolve(process.cwd(), AGENTS_DIR)
|
|
20
21
|
const cutoff = Date.now() - MAX_AGE_DAYS * 24 * 60 * 60 * 1000
|
|
21
22
|
let removed = 0
|
|
22
23
|
let kept = 0
|
|
23
|
-
let entries:
|
|
24
|
+
let entries: Dirent[]
|
|
24
25
|
try {
|
|
25
|
-
entries = await readdir(root, { withFileTypes: true })
|
|
26
|
+
entries = (await readdir(root, { withFileTypes: true })) as unknown as Dirent[]
|
|
26
27
|
} catch {
|
|
27
|
-
|
|
28
|
+
console.info(JSON.stringify({ msg: 'No agents dir yet — first run', dir: root, traceId }))
|
|
28
29
|
return
|
|
29
30
|
}
|
|
30
31
|
for (const entry of entries) {
|
|
31
32
|
if (!entry.isDirectory()) continue
|
|
32
|
-
const agentDir = join(root, entry.name)
|
|
33
|
+
const agentDir = join(root, String(entry.name))
|
|
33
34
|
const messagesFile = join(agentDir, 'messages.jsonl')
|
|
34
35
|
try {
|
|
35
36
|
const s = await stat(messagesFile)
|
|
@@ -45,6 +46,14 @@ export default defineCron('cleanup-conversations', {
|
|
|
45
46
|
removed++
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
console.info(
|
|
50
|
+
JSON.stringify({
|
|
51
|
+
msg: 'cleanup-conversations complete',
|
|
52
|
+
removed,
|
|
53
|
+
kept,
|
|
54
|
+
maxAgeDays: MAX_AGE_DAYS,
|
|
55
|
+
traceId,
|
|
56
|
+
}),
|
|
57
|
+
)
|
|
49
58
|
},
|
|
50
59
|
})
|
|
@@ -48,9 +48,12 @@ export const POST = defineAgentEndpoint({
|
|
|
48
48
|
request,
|
|
49
49
|
response: { headers: cookieHeaders },
|
|
50
50
|
options: {
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
|
|
51
|
+
// Model id is prefixed with the provider namespace. When using
|
|
52
|
+
// OPENROUTER_API_KEY (default), prefixes route to the correct
|
|
53
|
+
// upstream — `openai/`, `anthropic/`, `google/`, `meta-llama/`,
|
|
54
|
+
// `mistralai/`, `groq/`, etc. See https://openrouter.ai/models.
|
|
55
|
+
// Without the prefix the SDK falls back to a stub response.
|
|
56
|
+
model: { id: 'openai/gpt-4o-mini' },
|
|
54
57
|
tools: [currentTime],
|
|
55
58
|
},
|
|
56
59
|
})
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"db:studio": "drizzle-kit studio"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"theokit": "^0.
|
|
17
|
+
"theokit": "^0.2.0",
|
|
18
18
|
"react": "^19.0.0",
|
|
19
19
|
"react-dom": "^19.0.0",
|
|
20
20
|
"drizzle-orm": "^0.45.0",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"zod": "^3.24.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@types/node": "^22.10.0",
|
|
25
26
|
"typescript": "^5.7.0",
|
|
26
27
|
"@types/react": "^19.0.0",
|
|
27
28
|
"@types/react-dom": "^19.0.0",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"db:studio": "drizzle-kit studio"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"theokit": "^0.
|
|
18
|
-
"@usetheo/ui": "^0.12.0
|
|
17
|
+
"theokit": "^0.2.0",
|
|
18
|
+
"@usetheo/ui": "^0.12.0",
|
|
19
19
|
"react": "^19.0.0",
|
|
20
20
|
"react-dom": "^19.0.0",
|
|
21
21
|
"react-router": "^7.0.0",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"zod": "^3.24.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
+
"@types/node": "^22.10.0",
|
|
27
28
|
"typescript": "^5.7.0",
|
|
28
29
|
"@types/react": "^19.0.0",
|
|
29
30
|
"@types/react-dom": "^19.0.0",
|