veryfront 0.0.4 → 0.0.6
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/README.md +168 -2
- package/bin/veryfront.js +7 -0
- package/dist/ai/client.js +7 -0
- package/dist/ai/client.js.map +7 -0
- package/dist/ai/components.js +713 -0
- package/dist/ai/components.js.map +7 -0
- package/dist/ai/dev.js +839 -0
- package/dist/ai/dev.js.map +7 -0
- package/dist/ai/index.js +7398 -0
- package/dist/ai/index.js.map +7 -0
- package/dist/ai/primitives.js +314 -0
- package/dist/ai/primitives.js.map +7 -0
- package/dist/ai/production.js +934 -0
- package/dist/ai/production.js.map +7 -0
- package/dist/ai/react.js +455 -0
- package/dist/ai/react.js.map +7 -0
- package/dist/cli.js +38365 -0
- package/dist/components.js +9403 -0
- package/dist/components.js.map +7 -0
- package/dist/config.js +654 -0
- package/dist/config.js.map +7 -0
- package/dist/data.js +1131 -0
- package/dist/data.js.map +7 -0
- package/dist/index.js +11441 -0
- package/dist/index.js.map +7 -0
- package/package.json +95 -30
- package/bin/veryfront +0 -0
- package/scripts/postinstall.js +0 -109
package/README.md
CHANGED
|
@@ -1,7 +1,173 @@
|
|
|
1
1
|
# Veryfront
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Veryfront is a **zero-config React framework** for building **agentic applications**. Automatically discovers agents, tools, and routes through file-based conventions.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Project Structure
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
my-ai-app/
|
|
10
|
+
├── .env
|
|
11
|
+
├── app/
|
|
12
|
+
│ ├── chat/page.tsx
|
|
13
|
+
│ └── api/chat/route.ts
|
|
14
|
+
└── ai/
|
|
15
|
+
├── agents/assistant.ts # Auto-registered
|
|
16
|
+
├── tools/calculator.ts # Auto-discovered
|
|
17
|
+
└── resources/users/profile.ts # MCP resources
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The `ai/` directory auto-enables AI features. No config required.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
**1. Install**
|
|
27
|
+
```bash
|
|
28
|
+
deno add npm:veryfront npm:ai npm:zod
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**2. Create an agent**
|
|
32
|
+
|
|
33
|
+
`ai/agents/assistant.ts`:
|
|
34
|
+
```typescript
|
|
35
|
+
import { agent } from 'veryfront/ai';
|
|
36
|
+
|
|
37
|
+
export default agent({
|
|
38
|
+
model: 'openai/gpt-4',
|
|
39
|
+
system: 'You are a helpful assistant.',
|
|
40
|
+
tools: { calculator: true },
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**3. Add a tool**
|
|
45
|
+
|
|
46
|
+
`ai/tools/calculator.ts`:
|
|
47
|
+
```typescript
|
|
48
|
+
import { tool } from 'veryfront/ai';
|
|
49
|
+
import { z } from 'zod';
|
|
50
|
+
|
|
51
|
+
export default tool({
|
|
52
|
+
description: 'Perform calculations',
|
|
53
|
+
inputSchema: z.object({ expression: z.string() }),
|
|
54
|
+
execute: async ({ expression }) => ({ result: eval(expression) }),
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**4. Create the API endpoint**
|
|
59
|
+
|
|
60
|
+
`app/api/chat/route.ts`:
|
|
61
|
+
```typescript
|
|
62
|
+
import { agents } from '../../../ai/agents';
|
|
63
|
+
|
|
64
|
+
export async function POST(req: Request) {
|
|
65
|
+
return agents.assistant.respond(req);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**5. Add the UI**
|
|
70
|
+
|
|
71
|
+
`app/chat/page.tsx`:
|
|
72
|
+
```tsx
|
|
73
|
+
'use client';
|
|
74
|
+
import { Chat } from 'veryfront/ai/components';
|
|
75
|
+
import { useChat } from 'veryfront/ai/react';
|
|
76
|
+
|
|
77
|
+
export default function ChatPage() {
|
|
78
|
+
return <Chat {...useChat({ api: '/api/chat' })} />;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**6. Run**
|
|
83
|
+
```bash
|
|
84
|
+
echo "OPENAI_API_KEY=sk-..." > .env
|
|
85
|
+
deno task dev
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Visit `localhost:3000/chat` - your agent can now use the calculator tool.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## UI Customization
|
|
93
|
+
|
|
94
|
+
**Styled components** (production-ready):
|
|
95
|
+
```tsx
|
|
96
|
+
import { Chat } from 'veryfront/ai/components';
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Primitives** (bring your own styles):
|
|
100
|
+
```tsx
|
|
101
|
+
import { ChatContainer, MessageList, MessageItem } from 'veryfront/ai/primitives';
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Headless hooks** (total control):
|
|
105
|
+
```tsx
|
|
106
|
+
import { useChat } from 'veryfront/ai/react';
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Model Context Protocol
|
|
112
|
+
|
|
113
|
+
MCP exposes your tools and resources to external AI applications. Enabled by default when `ai/` directory exists.
|
|
114
|
+
|
|
115
|
+
**Add a resource:**
|
|
116
|
+
|
|
117
|
+
`ai/resources/users/profile.ts`:
|
|
118
|
+
```typescript
|
|
119
|
+
import { resource } from 'veryfront/ai';
|
|
120
|
+
import { z } from 'zod';
|
|
121
|
+
|
|
122
|
+
export default resource({
|
|
123
|
+
description: 'Get user profile',
|
|
124
|
+
paramsSchema: z.object({ userId: z.string() }),
|
|
125
|
+
async load({ userId }) {
|
|
126
|
+
return await db.users.findUnique({ where: { id: userId } });
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Run MCP server:**
|
|
132
|
+
```bash
|
|
133
|
+
deno task dev --mcp # Port 3001 by default
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Features
|
|
139
|
+
|
|
140
|
+
- **Zero config** - Auto-discovery from file structure
|
|
141
|
+
- **Multi-runtime** - Deno, Node.js, Bun, Cloudflare Workers
|
|
142
|
+
- **Full-stack React** - SSR, SSG, ISR, JIT rendering
|
|
143
|
+
- **MCP built-in** - Model Context Protocol server
|
|
144
|
+
- **Production-ready** - Rate limiting, caching, cost tracking, security
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Documentation
|
|
149
|
+
|
|
150
|
+
- [Quick Start Tutorial](./docs/learn/quickstart.md)
|
|
151
|
+
- [AI Getting Started](./docs/ai/getting-started.md)
|
|
152
|
+
- [Routing Guide](./docs/guides/routing/README.md)
|
|
153
|
+
- [Deployment Guide](./docs/guides/deployment/README.md)
|
|
154
|
+
- [API Reference](./docs/reference/ai/README.md)
|
|
155
|
+
|
|
156
|
+
[Browse all docs →](./docs/README.md)
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Examples
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
cd examples/ai-basic
|
|
164
|
+
deno run --allow-all demo.ts
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
See [examples/](./examples/) for more.
|
|
168
|
+
|
|
169
|
+
---
|
|
4
170
|
|
|
5
171
|
## License
|
|
6
172
|
|
|
7
|
-
MIT
|
|
173
|
+
MIT - see [LICENSE](./LICENSE)
|
package/bin/veryfront.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ai/client.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Client-only AI SDK exports\n *\n * This module exports React hooks from AI SDK that can only be used in browser environments.\n * These hooks require browser-specific APIs and should not be bundled for server-side code.\n *\n * @module ai/client\n */\n\n// Re-export AI SDK React hooks (battle-tested, proven in production)\n// These are client-only and require browser environment\nexport { useChat, useCompletion } from \"ai/react\";\n\n// Re-export core types that are useful on the client\nexport type { UseChatOptions, UseCompletionOptions } from \"ai/react\";\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,SAAS,qBAAqB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|