create-theokit 0.2.0 → 0.2.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-theokit",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Scaffold a new TheoKit project",
6
6
  "license": "Apache-2.0",
@@ -10,11 +10,12 @@
10
10
  "typecheck": "tsc --noEmit"
11
11
  },
12
12
  "dependencies": {
13
- "theokit": "^0.1.0-alpha.16",
13
+ "theokit": "^0.2.1",
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.1.0-alpha.16",
13
+ "theokit": "^0.2.1",
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"
@@ -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 ({ log }) => {
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: Awaited<ReturnType<typeof readdir>>
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
- log.info({ msg: 'No agents dir yet — first run', dir: root })
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
- log.info({ msg: 'cleanup-conversations complete', removed, kept, maxAgeDays: MAX_AGE_DAYS })
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
  })
@@ -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="model"
224
+ kind="tool-failure"
225
225
  title="Agent error"
226
- description={item.message}
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
- description="The connection to the agent endpoint was interrupted. Reset to try again."
244
- action={
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.1.0-alpha.16",
14
- "@usetheo/sdk": "^1.2.0",
15
- "@usetheo/ui": "^0.12.0-next.0",
13
+ "theokit": "^0.2.1",
14
+ "@usetheo/sdk": "^1.4.1",
15
+ "@usetheo/ui": "^0.13.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 ({ log }) => {
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: Awaited<ReturnType<typeof readdir>>
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
- log.info({ msg: 'No agents dir yet — first run', dir: root })
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
- log.info({ msg: 'cleanup-conversations complete', removed, kept, maxAgeDays: MAX_AGE_DAYS })
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
- // model id literal provider resolution NÃO depende de prefix inference.
52
- // Stranger pode trocar livremente sem mexer em routing.
53
- model: { id: 'gpt-4o-mini' },
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.1.0-alpha.16",
17
+ "theokit": "^0.2.1",
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.1.0-alpha.16",
18
- "@usetheo/ui": "^0.12.0-next.0",
17
+ "theokit": "^0.2.1",
18
+ "@usetheo/ui": "^0.13.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",
@@ -26,7 +26,7 @@ pnpm dev
26
26
 
27
27
  ## What is wired
28
28
 
29
- - Native fetch handler via Hono (works on Vercel, CF Workers Node-compat, TheoCloud, local)
29
+ - Native fetch handler via Hono (works on TheoCloud and local)
30
30
  - JSON-line stdout logs
31
31
  - W3C `traceparent` propagation from incoming headers
32
32
  - TheoKit injects `THEOKIT_SERVICE_NAME` + `THEOKIT_SERVICE_PORT` env vars
@@ -26,7 +26,7 @@ uv run uvicorn main:app --reload --port 8001
26
26
 
27
27
  ## What is wired
28
28
 
29
- - ASGI fetch-handler (works on Vercel Python runtime, TheoCloud K8s, local uvicorn)
29
+ - ASGI fetch-handler (works on TheoCloud K8s and local uvicorn)
30
30
  - JSON-line stdout logs
31
31
  - W3C `traceparent` propagation from incoming headers
32
32
  - TheoKit injects `THEOKIT_SERVICE_NAME` + `THEOKIT_SERVICE_PORT` env vars