create-theokit 0.1.0-alpha.14 → 0.1.0-alpha.15

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.1.0-alpha.14",
3
+ "version": "0.1.0-alpha.15",
4
4
  "type": "module",
5
5
  "description": "Scaffold a new TheoKit project",
6
6
  "license": "Apache-2.0",
@@ -10,7 +10,7 @@
10
10
  "typecheck": "tsc --noEmit"
11
11
  },
12
12
  "dependencies": {
13
- "theokit": "^0.1.0-alpha.14",
13
+ "theokit": "^0.1.0-alpha.15",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0"
16
16
  },
@@ -10,7 +10,7 @@
10
10
  "typecheck": "tsc --noEmit"
11
11
  },
12
12
  "dependencies": {
13
- "theokit": "^0.1.0-alpha.14",
13
+ "theokit": "^0.1.0-alpha.15",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0"
16
16
  },
@@ -10,7 +10,7 @@
10
10
  "typecheck": "tsc --noEmit"
11
11
  },
12
12
  "dependencies": {
13
- "theokit": "^0.1.0-alpha.14",
13
+ "theokit": "^0.1.0-alpha.15",
14
14
  "@usetheo/sdk": "^1.2.0",
15
15
  "@usetheo/ui": "^0.12.0-next.0",
16
16
  "lucide-react": "^0.469.0",
@@ -39,19 +39,28 @@ export const POST = defineAgentEndpoint({
39
39
  // ANTHROPIC_API_KEY presente no env. Wire protocol: OpenAI Chat Completions
40
40
  // (universal — todos os providers implementam essa API). Consumer NÃO tem
41
41
  // conditionals sobre provider — é responsabilidade do framework.
42
- const { agent } = await createConversationHistory({
43
- request,
44
- response: { headers: cookieHeaders },
45
- options: {
46
- // model id literal — provider resolution NÃO depende de prefix inference.
47
- // Stranger pode trocar livremente sem mexer em routing.
48
- model: { id: 'gpt-4o-mini' },
49
- tools: [currentTime],
50
- },
51
- })
52
- const run = await agent.send(message, { signal })
53
- yield* streamAgentRun(run)
54
- // Intentionally NO agent.dispose() — the agent stays registered so the
55
- // next request from the same conversation resumes it (continuity).
42
+ // Wrap full agent lifecycle in try/catch — provider errors (invalid KEY,
43
+ // 401, rate-limit, model-not-found, 5xx) MUST surface as AgentEvent
44
+ // 'error' so the client renders an actionable message instead of a
45
+ // silent SSE closure. Dogfood chaos Phase 12 validates this contract.
46
+ try {
47
+ const { agent } = await createConversationHistory({
48
+ request,
49
+ response: { headers: cookieHeaders },
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' },
54
+ tools: [currentTime],
55
+ },
56
+ })
57
+ const run = await agent.send(message, { signal })
58
+ yield* streamAgentRun(run)
59
+ // Intentionally NO agent.dispose() — the agent stays registered so the
60
+ // next request from the same conversation resumes it (continuity).
61
+ } catch (err) {
62
+ const msg = err instanceof Error ? err.message : String(err)
63
+ yield { type: 'error', message: `Agent error: ${msg}` }
64
+ }
56
65
  },
57
66
  })
@@ -14,7 +14,7 @@
14
14
  "db:studio": "drizzle-kit studio"
15
15
  },
16
16
  "dependencies": {
17
- "theokit": "^0.1.0-alpha.14",
17
+ "theokit": "^0.1.0-alpha.15",
18
18
  "react": "^19.0.0",
19
19
  "react-dom": "^19.0.0",
20
20
  "drizzle-orm": "^0.45.0",
@@ -14,7 +14,7 @@
14
14
  "db:studio": "drizzle-kit studio"
15
15
  },
16
16
  "dependencies": {
17
- "theokit": "^0.1.0-alpha.14",
17
+ "theokit": "^0.1.0-alpha.15",
18
18
  "@usetheo/ui": "^0.12.0-next.0",
19
19
  "react": "^19.0.0",
20
20
  "react-dom": "^19.0.0",