create-theokit 1.0.12 → 1.0.14
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
|
@@ -82,6 +82,19 @@ npx drizzle-kit push # Apply schema changes (dev)
|
|
|
82
82
|
npx drizzle-kit generate # Generate migration files (prod)
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
## SDK Ecosystem
|
|
86
|
+
|
|
87
|
+
| Package | Purpose | Install separately? |
|
|
88
|
+
|---------|---------|-------------------|
|
|
89
|
+
| `theokit` | Framework (routes, SSR, client, CLI) | Already installed |
|
|
90
|
+
| `@theokit/sdk` | Agent runtime (Agent.create, defineTool primitive) | Already installed |
|
|
91
|
+
| `@theokit/sdk-tools` | Ready-made tools (readFile, writeFile, search, shell) | Yes — `npm install @theokit/sdk-tools` |
|
|
92
|
+
| `@theokit/agents` | Decorator surface (@Agent, @Tool, @Toolbox) | Already installed |
|
|
93
|
+
| `@theokit/ui` | AI chat UI components (ChatThread, ChatComposer, CodeBlock) | Yes — `npm install @theokit/ui` |
|
|
94
|
+
| `@theokit/di-agent` | DI-powered agent pattern | Yes — when using DI |
|
|
95
|
+
|
|
96
|
+
**Before writing custom tools, check `@theokit/sdk-tools`** — it likely has what you need.
|
|
97
|
+
|
|
85
98
|
## Don't
|
|
86
99
|
|
|
87
100
|
- Don't use `any` — use Zod schemas + `z.infer<>`
|
|
@@ -89,3 +102,5 @@ npx drizzle-kit generate # Generate migration files (prod)
|
|
|
89
102
|
- Don't parse request body manually — use `body: z.object(...)` in defineRoute
|
|
90
103
|
- Don't import from `theokit/dist/...` or `theokit/src/...` — use public exports only
|
|
91
104
|
- Don't call LLM APIs directly — use @Agent + @Tool decorators
|
|
105
|
+
- Don't reimplement file/search/shell tools — use `@theokit/sdk-tools`
|
|
106
|
+
- Don't use `npm link` for `@theokit/ui` — causes dual-React; use tarball or npm registry
|
|
@@ -114,6 +114,19 @@ for await (const event of stream) {
|
|
|
114
114
|
}
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
## SDK Ecosystem — "you are here" map
|
|
118
|
+
|
|
119
|
+
Before writing custom tools, check if they already exist:
|
|
120
|
+
|
|
121
|
+
| Package | What it provides | When to use |
|
|
122
|
+
|---------|-----------------|-------------|
|
|
123
|
+
| `@theokit/sdk` | `Agent.create()`, `defineTool()` (primitive), `Run.stream()` | Core agent runtime — always installed |
|
|
124
|
+
| `@theokit/sdk-tools` | Ready-made tools: `createReadFileTool`, `createWriteFileTool`, `createSearchTool`, etc. | **Check here FIRST** before writing custom tools for coding agents |
|
|
125
|
+
| `@theokit/di-agent` | DI-powered agent with decorator injection | When using dependency injection pattern |
|
|
126
|
+
| `@theokit/di` | Core DI container (`@Injectable`, `@Inject`) | When `@theokit/di-agent` needs explicit bindings |
|
|
127
|
+
|
|
128
|
+
**`defineTool()` in `@theokit/sdk` is the primitive API.** For coding agents, `@theokit/sdk-tools` has batteries-included tools that wrap `defineTool()` with file system access, search, shell execution, etc. Don't reimplement what `sdk-tools` already provides.
|
|
129
|
+
|
|
117
130
|
## Rules
|
|
118
131
|
|
|
119
132
|
- Tool `name` and `description` are ALWAYS explicit — never inferred from method names (G4)
|
|
@@ -122,11 +135,13 @@ for await (const event of stream) {
|
|
|
122
135
|
- `@UseInterceptors()` and `@UseFilters()` on agents are metadata-only (emit warnings)
|
|
123
136
|
- Agent runtime is `@theokit/sdk` — NEVER call LLM APIs directly via fetch
|
|
124
137
|
- Pick ONE surface per endpoint — don't mix defineAgentEndpoint with @Agent for the same route
|
|
138
|
+
- Check `@theokit/sdk-tools` BEFORE writing custom tools — it may already exist
|
|
125
139
|
|
|
126
140
|
## Anti-patterns
|
|
127
141
|
|
|
128
142
|
- NEVER call OpenAI/Anthropic/OpenRouter APIs directly — use @Agent or defineAgentEndpoint
|
|
129
143
|
- NEVER reimplement tool calling loop — the SDK handles it
|
|
144
|
+
- NEVER reimplement file/search/shell tools — use `@theokit/sdk-tools` (readFile, writeFile, search, etc.)
|
|
130
145
|
- NEVER store conversations manually — use @Memory (decorator) or SDK persistence
|
|
131
146
|
- NEVER infer tool capability from method name — always provide explicit `name` + `description`
|
|
132
147
|
- NEVER mix both surfaces for the same endpoint — pick manual OR decorator
|
|
@@ -21,13 +21,16 @@ paths:
|
|
|
21
21
|
The published package is `@theokit/ui` (NOT `@usetheo/ui` — that was the old name).
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
# Install from npm
|
|
24
|
+
# Install from npm (preferred)
|
|
25
25
|
npm install @theokit/ui
|
|
26
26
|
|
|
27
|
-
# Or
|
|
28
|
-
|
|
27
|
+
# Or from local tarball (when using source repo)
|
|
28
|
+
cd ../theo-ui && npm pack # produces theokit-ui-X.Y.Z.tgz
|
|
29
|
+
cd ../my-app && npm install ../theo-ui/theokit-ui-X.Y.Z.tgz
|
|
29
30
|
```
|
|
30
31
|
|
|
32
|
+
**WARNING: NEVER use `npm link ../theo-ui` or `file:../theo-ui`.** The symlink exposes the sibling's nested `node_modules/react` (typically a different version), causing dual-React: "React Element from an older version" errors, broken hooks (`useState` null), and silent render failures. `resolve.dedupe` in Vite does NOT fix this — the pnpm structure physically has two React copies. Use tarball (`npm pack` → `npm install .tgz`) instead.
|
|
33
|
+
|
|
31
34
|
## Provider Setup (required before using any component)
|
|
32
35
|
|
|
33
36
|
```typescript
|
|
@@ -153,5 +156,6 @@ const myTheme = defineTheme({
|
|
|
153
156
|
- NEVER build a custom markdown renderer — `ChatMessageContent` handles it (including streaming partial fences)
|
|
154
157
|
- NEVER build a custom code highlighter — `CodeBlock` uses shiki (lazy-loaded)
|
|
155
158
|
- NEVER import from `@usetheo/ui` — that's the deprecated package name; use `@theokit/ui`
|
|
159
|
+
- NEVER use `npm link` or `file:../theo-ui` to install — causes dual-React (use tarball or npm registry)
|
|
156
160
|
- NEVER install ALL peer deps — only install the peers for components you actually use
|
|
157
161
|
- NEVER use components without wrapping in `TheoUIProvider` + `ThemeProvider` first
|