create-agentuity 0.0.10 → 0.0.12
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 +13 -2
- package/bin.js +6 -0
- package/package.json +10 -37
- package/.gitignore +0 -39
- package/AGENTS.md +0 -200
- package/app.ts +0 -8
- package/setup.ts +0 -65
- package/src/agents/hello/agent.ts +0 -14
- package/src/agents/hello/route.ts +0 -18
- package/src/agents/registry.generated.ts +0 -30
- package/src/agents/types.generated.d.ts +0 -10
- package/src/apis/status/route.ts +0 -13
- package/src/web/app.tsx +0 -73
- package/src/web/client.generated.js +0 -7
- package/src/web/public/.gitkeep +0 -0
- package/tsconfig.json +0 -24
package/README.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# {{PROJECT_NAME}}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# create-agentuity
|
|
4
|
+
|
|
5
|
+
Create a new Agentuity project with one command.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun create agentuity my-project
|
|
11
|
+
cd my-project
|
|
12
|
+
bun run dev
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Templates are automatically downloaded from the latest version in the GitHub repository.
|
|
4
16
|
|
|
5
17
|
## What You Get
|
|
6
18
|
|
|
@@ -27,7 +39,6 @@ my-app/
|
|
|
27
39
|
│ └── web/ # React web application
|
|
28
40
|
│ └── app.tsx # Main React component
|
|
29
41
|
├── app.ts # Application entry point
|
|
30
|
-
├── setup.ts # Initial setup script
|
|
31
42
|
├── tsconfig.json # TypeScript configuration
|
|
32
43
|
├── package.json # Dependencies and scripts
|
|
33
44
|
└── README.md # Project documentation
|
package/bin.js
ADDED
package/package.json
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-agentuity",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.0.12",
|
|
4
|
+
"description": "Create a new Agentuity project",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"AGENTS.md",
|
|
10
|
-
"tsconfig.json",
|
|
11
|
-
".gitignore",
|
|
12
|
-
"README.md",
|
|
13
|
-
"setup.ts"
|
|
14
|
-
],
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-agentuity": "./bin.js"
|
|
8
|
+
},
|
|
15
9
|
"scripts": {
|
|
16
|
-
"build": "
|
|
17
|
-
"dev": "agentuity dev --dir .",
|
|
18
|
-
"typecheck": "bunx tsc --noEmit"
|
|
10
|
+
"build": "echo 'No build required'"
|
|
19
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin.js"
|
|
14
|
+
],
|
|
20
15
|
"keywords": [
|
|
21
16
|
"agentuity",
|
|
22
17
|
"create",
|
|
@@ -27,29 +22,7 @@
|
|
|
27
22
|
"author": "Agentuity",
|
|
28
23
|
"license": "MIT",
|
|
29
24
|
"dependencies": {
|
|
30
|
-
"@agentuity/cli": "
|
|
31
|
-
"@agentuity/core": "0.0.9",
|
|
32
|
-
"@agentuity/react": "0.0.9",
|
|
33
|
-
"@agentuity/runtime": "0.0.9",
|
|
34
|
-
"@hono/zod-validator": "^0.7.4",
|
|
35
|
-
"enquirer": "^2.4.1",
|
|
36
|
-
"hono": "^4.7.10",
|
|
37
|
-
"react": "^19.2.0",
|
|
38
|
-
"react-dom": "^19.2.0",
|
|
39
|
-
"zod": "^4.1.12"
|
|
40
|
-
},
|
|
41
|
-
"bun-create": {
|
|
42
|
-
"postinstall": [
|
|
43
|
-
"./setup.ts"
|
|
44
|
-
],
|
|
45
|
-
"start": "bun run dev"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@types/bun": "latest",
|
|
49
|
-
"@types/react": "^19.0.0"
|
|
50
|
-
},
|
|
51
|
-
"peerDependencies": {
|
|
52
|
-
"typescript": "^5"
|
|
25
|
+
"@agentuity/cli": "latest"
|
|
53
26
|
},
|
|
54
27
|
"publishConfig": {
|
|
55
28
|
"access": "public"
|
package/.gitignore
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# dependencies (bun install)
|
|
2
|
-
node_modules
|
|
3
|
-
|
|
4
|
-
# output
|
|
5
|
-
out
|
|
6
|
-
dist
|
|
7
|
-
*.tgz
|
|
8
|
-
|
|
9
|
-
# code coverage
|
|
10
|
-
coverage
|
|
11
|
-
*.lcov
|
|
12
|
-
|
|
13
|
-
# logs
|
|
14
|
-
logs
|
|
15
|
-
*.log
|
|
16
|
-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
17
|
-
|
|
18
|
-
# dotenv environment variable files
|
|
19
|
-
.env
|
|
20
|
-
.env.development.local
|
|
21
|
-
.env.test.local
|
|
22
|
-
.env.production.local
|
|
23
|
-
.env.local
|
|
24
|
-
.env.template
|
|
25
|
-
|
|
26
|
-
# caches
|
|
27
|
-
.eslintcache
|
|
28
|
-
.cache
|
|
29
|
-
*.tsbuildinfo
|
|
30
|
-
|
|
31
|
-
# IntelliJ based IDEs
|
|
32
|
-
.idea
|
|
33
|
-
|
|
34
|
-
# Finder (MacOS) folder config
|
|
35
|
-
.DS_Store
|
|
36
|
-
|
|
37
|
-
# Agentuity build files
|
|
38
|
-
.agentuity
|
|
39
|
-
**/*.generated.*
|
package/AGENTS.md
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
# Agent Guidelines for {{PROJECT_NAME}}
|
|
2
|
-
|
|
3
|
-
## Commands
|
|
4
|
-
|
|
5
|
-
- **Build**: `bun run build` (compiles your application)
|
|
6
|
-
- **Dev**: `bun run dev` (starts development server)
|
|
7
|
-
- **Typecheck**: `bun run typecheck` (runs TypeScript type checking)
|
|
8
|
-
|
|
9
|
-
## Architecture
|
|
10
|
-
|
|
11
|
-
- **Runtime**: Bun server runtime
|
|
12
|
-
- **Framework**: Hono (lightweight web framework)
|
|
13
|
-
- **Build tool**: `@agentuity/cli` compiles to `.agentuity/` directory
|
|
14
|
-
- **Frontend**: React with `@agentuity/react` hooks
|
|
15
|
-
|
|
16
|
-
## Project Structure
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
{{PROJECT_NAME}}/
|
|
20
|
-
├── src/
|
|
21
|
-
│ ├── agents/ # Agent definitions
|
|
22
|
-
│ │ └── hello/ # Example "hello" agent
|
|
23
|
-
│ │ ├── agent.ts # Agent handler
|
|
24
|
-
│ │ └── route.ts # Agent HTTP routes
|
|
25
|
-
│ ├── apis/ # Custom API routes
|
|
26
|
-
│ │ └── status/ # Example status endpoint
|
|
27
|
-
│ └── web/ # React web application
|
|
28
|
-
│ └── app.tsx # Main React component
|
|
29
|
-
├── app.ts # Application entry point
|
|
30
|
-
├── tsconfig.json # TypeScript configuration
|
|
31
|
-
└── package.json # Dependencies and scripts
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Code Style
|
|
35
|
-
|
|
36
|
-
- **TypeScript-first** - All code is TypeScript
|
|
37
|
-
- **Async/await** - All agent handlers are async
|
|
38
|
-
- **Zod schemas** - Use Zod for input/output validation
|
|
39
|
-
- **Functional** - Prefer functional patterns over classes
|
|
40
|
-
- **Type-safe** - Leverage TypeScript generics and inference
|
|
41
|
-
|
|
42
|
-
## Creating Agents
|
|
43
|
-
|
|
44
|
-
### Agent Structure
|
|
45
|
-
|
|
46
|
-
Each agent should be in its own folder under `src/agents/`:
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
// src/agents/my-agent/agent.ts
|
|
50
|
-
import { type AgentContext, createAgent } from '@agentuity/runtime';
|
|
51
|
-
import { z } from 'zod';
|
|
52
|
-
|
|
53
|
-
const agent = createAgent({
|
|
54
|
-
schema: {
|
|
55
|
-
input: z.object({
|
|
56
|
-
message: z.string(),
|
|
57
|
-
}),
|
|
58
|
-
output: z.object({
|
|
59
|
-
response: z.string(),
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
handler: async (ctx: AgentContext, input) => {
|
|
63
|
-
// Use ctx.logger for logging (not console.log)
|
|
64
|
-
ctx.logger.info('Processing message:', input.message);
|
|
65
|
-
|
|
66
|
-
// Access storage
|
|
67
|
-
await ctx.kv.set('last-message', input.message);
|
|
68
|
-
|
|
69
|
-
return { response: `Processed: ${input.message}` };
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
export default agent;
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Agent Routes (Optional)
|
|
77
|
-
|
|
78
|
-
Add custom HTTP routes for your agent:
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
// src/agents/my-agent/route.ts
|
|
82
|
-
import { createRouter } from '@agentuity/runtime';
|
|
83
|
-
import { zValidator } from '@hono/zod-validator';
|
|
84
|
-
import agent from './agent';
|
|
85
|
-
|
|
86
|
-
const router = createRouter();
|
|
87
|
-
|
|
88
|
-
// GET endpoint
|
|
89
|
-
router.get('/', async (c) => {
|
|
90
|
-
const result = await c.agent['my-agent'].run({ message: 'Hello!' });
|
|
91
|
-
return c.json(result);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// POST endpoint with validation
|
|
95
|
-
router.post('/', zValidator('json', agent.inputSchema!), async (c) => {
|
|
96
|
-
const data = c.req.valid('json');
|
|
97
|
-
const result = await c.agent['my-agent'].run(data);
|
|
98
|
-
return c.json(result);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
export default router;
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Agent Context API
|
|
105
|
-
|
|
106
|
-
Every agent handler receives an `AgentContext` with:
|
|
107
|
-
|
|
108
|
-
- `ctx.logger` - Structured logger (use instead of console.log)
|
|
109
|
-
- `ctx.tracer` - OpenTelemetry tracer for distributed tracing
|
|
110
|
-
- `ctx.sessionId` - Unique session identifier
|
|
111
|
-
- `ctx.kv` - Key-value storage interface
|
|
112
|
-
- `ctx.objectstore` - Object/blob storage
|
|
113
|
-
- `ctx.stream` - Stream storage
|
|
114
|
-
- `ctx.vector` - Vector embeddings storage
|
|
115
|
-
- `ctx.agent` - Access to other agents
|
|
116
|
-
- `ctx.waitUntil()` - Defer cleanup tasks
|
|
117
|
-
|
|
118
|
-
## Adding API Routes
|
|
119
|
-
|
|
120
|
-
Create custom routes in `src/apis/`:
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
// src/apis/my-route/route.ts
|
|
124
|
-
import { createRouter } from '@agentuity/runtime';
|
|
125
|
-
|
|
126
|
-
const router = createRouter();
|
|
127
|
-
|
|
128
|
-
router.get('/', (c) => {
|
|
129
|
-
return c.json({ status: 'ok' });
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export default router;
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Frontend Development
|
|
136
|
-
|
|
137
|
-
Use `@agentuity/react` hooks to call agents from your React components:
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
// src/web/app.tsx
|
|
141
|
-
import { useAgent } from '@agentuity/react';
|
|
142
|
-
|
|
143
|
-
function MyComponent() {
|
|
144
|
-
const { data, run } = useAgent('hello');
|
|
145
|
-
|
|
146
|
-
const handleClick = async () => {
|
|
147
|
-
const result = await run({ name: 'World' });
|
|
148
|
-
console.log(result);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
return (
|
|
152
|
-
<div>
|
|
153
|
-
<button onClick={handleClick}>Call Agent</button>
|
|
154
|
-
{data && <div>{data}</div>}
|
|
155
|
-
</div>
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## Best Practices
|
|
161
|
-
|
|
162
|
-
- **Use structured logging** - Always use `ctx.logger`, never `console.log`
|
|
163
|
-
- **Validate inputs** - Define Zod schemas for all agent inputs/outputs
|
|
164
|
-
- **Handle errors** - Use try/catch and return meaningful error messages
|
|
165
|
-
- **Type everything** - Leverage TypeScript for type safety
|
|
166
|
-
- **Keep agents focused** - One agent should do one thing well
|
|
167
|
-
- **Use storage abstractions** - Use `ctx.kv`, `ctx.objectstore`, etc. instead of direct database access
|
|
168
|
-
|
|
169
|
-
## Environment Variables
|
|
170
|
-
|
|
171
|
-
Create a `.env` file in the project root:
|
|
172
|
-
|
|
173
|
-
```env
|
|
174
|
-
# Example environment variables
|
|
175
|
-
API_KEY=your-api-key
|
|
176
|
-
DATABASE_URL=your-database-url
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
Access them in your code:
|
|
180
|
-
|
|
181
|
-
```typescript
|
|
182
|
-
const apiKey = process.env.API_KEY;
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
## Deployment
|
|
186
|
-
|
|
187
|
-
Build for production:
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
bun run build
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
The compiled application will be in `.agentuity/`. Deploy this directory to your hosting provider.
|
|
194
|
-
|
|
195
|
-
## Learn More
|
|
196
|
-
|
|
197
|
-
- [Agentuity Documentation](https://agentuity.dev)
|
|
198
|
-
- [Bun Documentation](https://bun.sh/docs)
|
|
199
|
-
- [Hono Documentation](https://hono.dev/)
|
|
200
|
-
- [Zod Documentation](https://zod.dev/)
|
package/app.ts
DELETED
package/setup.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync, rmSync } from 'fs';
|
|
3
|
-
import { basename } from 'path';
|
|
4
|
-
|
|
5
|
-
const projectDir = process.cwd();
|
|
6
|
-
const projectName = basename(projectDir);
|
|
7
|
-
|
|
8
|
-
console.log(`🔧 Setting up your project...\n`);
|
|
9
|
-
|
|
10
|
-
// Update package.json
|
|
11
|
-
const packageJsonPath = 'package.json';
|
|
12
|
-
if (existsSync(packageJsonPath)) {
|
|
13
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
14
|
-
|
|
15
|
-
packageJson.name = projectName;
|
|
16
|
-
delete packageJson['bun-create'];
|
|
17
|
-
delete packageJson.bin;
|
|
18
|
-
packageJson.private = true;
|
|
19
|
-
delete packageJson.files;
|
|
20
|
-
delete packageJson.keywords;
|
|
21
|
-
delete packageJson.author;
|
|
22
|
-
delete packageJson.license;
|
|
23
|
-
delete packageJson.publishConfig;
|
|
24
|
-
packageJson.description = undefined;
|
|
25
|
-
|
|
26
|
-
// Remove enquirer from dependencies (only needed for setup)
|
|
27
|
-
if (packageJson.dependencies) {
|
|
28
|
-
delete packageJson.dependencies.enquirer;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, '\t'));
|
|
32
|
-
console.log('✓ Updated package.json');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Update README.md
|
|
36
|
-
const readmePath = 'README.md';
|
|
37
|
-
if (existsSync(readmePath)) {
|
|
38
|
-
let readme = readFileSync(readmePath, 'utf-8');
|
|
39
|
-
readme = readme.replace(/\{\{PROJECT_NAME\}\}/g, projectName);
|
|
40
|
-
writeFileSync(readmePath, readme);
|
|
41
|
-
console.log('✓ Updated README.md');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Update AGENTS.md
|
|
45
|
-
const agentsMdPath = 'AGENTS.md';
|
|
46
|
-
if (existsSync(agentsMdPath)) {
|
|
47
|
-
let agentsMd = readFileSync(agentsMdPath, 'utf-8');
|
|
48
|
-
agentsMd = agentsMd.replace(/\{\{PROJECT_NAME\}\}/g, projectName);
|
|
49
|
-
writeFileSync(agentsMdPath, agentsMd);
|
|
50
|
-
console.log('✓ Updated AGENTS.md');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Remove setup files
|
|
54
|
-
const filesToRemove = ['setup.ts'];
|
|
55
|
-
for (const file of filesToRemove) {
|
|
56
|
-
if (existsSync(file)) {
|
|
57
|
-
rmSync(file);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
console.log('\n✨ Setup complete!\n');
|
|
62
|
-
console.log(` Next steps:`);
|
|
63
|
-
console.log(` 1. cd ./${projectName}`);
|
|
64
|
-
console.log(` 2. bun run dev`);
|
|
65
|
-
console.log(`\n Your agents will be running at http://localhost:3000\n`);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type AgentContext, createAgent } from '@agentuity/runtime';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
const agent = createAgent({
|
|
5
|
-
schema: {
|
|
6
|
-
input: z.object({ name: z.string() }),
|
|
7
|
-
output: z.string(),
|
|
8
|
-
},
|
|
9
|
-
handler: async (_c: AgentContext, { name }) => {
|
|
10
|
-
return `Hello, ${name}! Welcome to Agentuity.`;
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export default agent;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { createRouter } from '@agentuity/runtime';
|
|
2
|
-
import { zValidator } from '@hono/zod-validator';
|
|
3
|
-
import agent from './agent';
|
|
4
|
-
|
|
5
|
-
const router = createRouter();
|
|
6
|
-
|
|
7
|
-
router.get('/', async (c) => {
|
|
8
|
-
const text = await c.agent.hello.run({ name: 'World' });
|
|
9
|
-
return c.text(text);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
router.post('/', zValidator('json', agent.inputSchema!), async (c) => {
|
|
13
|
-
const data = c.req.valid('json');
|
|
14
|
-
const text = await c.agent.hello.run(data);
|
|
15
|
-
return c.text(text);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export default router;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Auto-generated by Agentuity - do not edit manually
|
|
2
|
-
import helloAgent from '../agents/hello/agent';
|
|
3
|
-
import type { AgentRunner, Logger } from '@agentuity/runtime';
|
|
4
|
-
import type { KeyValueStorage, ObjectStorage, StreamStorage, VectorStorage } from '@agentuity/core';
|
|
5
|
-
|
|
6
|
-
export const agentRegistry = {
|
|
7
|
-
hello: helloAgent,
|
|
8
|
-
} as const;
|
|
9
|
-
|
|
10
|
-
export type AgentName = keyof typeof agentRegistry;
|
|
11
|
-
export type AgentRegistry = typeof agentRegistry;
|
|
12
|
-
|
|
13
|
-
// Typed runners for each agent
|
|
14
|
-
export type HelloAgentRunner = AgentRunner<typeof helloAgent['inputSchema'], typeof helloAgent['outputSchema'], typeof helloAgent['stream'] extends true ? true : false>;
|
|
15
|
-
|
|
16
|
-
// Augment Context to provide strongly-typed agents
|
|
17
|
-
declare module "hono" {
|
|
18
|
-
interface Context {
|
|
19
|
-
agentName: AgentName;
|
|
20
|
-
agent: {
|
|
21
|
-
[K in AgentName]: AgentRunner<AgentRegistry[K]['inputSchema'], AgentRegistry[K]['outputSchema'], AgentRegistry[K]['stream'] extends true ? true : false>;
|
|
22
|
-
};
|
|
23
|
-
waitUntil: (promise: Promise<void> | (() => void | Promise<void>)) => void;
|
|
24
|
-
logger: Logger;
|
|
25
|
-
kv: KeyValueStorage;
|
|
26
|
-
objectstore: ObjectStorage;
|
|
27
|
-
stream: StreamStorage;
|
|
28
|
-
vector: VectorStorage;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Auto-generated by Agentuity - do not edit manually
|
|
2
|
-
// This file augments @agentuity/react with your project's agent types
|
|
3
|
-
import type helloAgent from '../agents/hello/agent';
|
|
4
|
-
import type { Agent } from '@agentuity/react';
|
|
5
|
-
|
|
6
|
-
declare module '@agentuity/react' {
|
|
7
|
-
interface AgentRegistry {
|
|
8
|
-
'hello': Agent<typeof helloAgent['inputSchema'], typeof helloAgent['outputSchema']>;
|
|
9
|
-
}
|
|
10
|
-
}
|
package/src/apis/status/route.ts
DELETED
package/src/web/app.tsx
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React, { type ChangeEvent, useState } from 'react';
|
|
2
|
-
import { AgentuityProvider, useAgent } from '@agentuity/react';
|
|
3
|
-
|
|
4
|
-
export function App() {
|
|
5
|
-
const [name, setName] = useState('World');
|
|
6
|
-
const { run, running, data: greeting } = useAgent('hello');
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<div
|
|
10
|
-
style={{ fontFamily: 'sans-serif', padding: '2rem', maxWidth: '600px', margin: '0 auto' }}
|
|
11
|
-
>
|
|
12
|
-
<AgentuityProvider>
|
|
13
|
-
<h1>Welcome to Agentuity</h1>
|
|
14
|
-
<p>Your new Agentuity project is ready to go!</p>
|
|
15
|
-
|
|
16
|
-
<div style={{ marginTop: '2rem' }}>
|
|
17
|
-
<h2>Try the Hello Agent</h2>
|
|
18
|
-
<div style={{ display: 'flex', gap: '0.5rem', marginBottom: '1rem' }}>
|
|
19
|
-
<input
|
|
20
|
-
type="text"
|
|
21
|
-
value={name}
|
|
22
|
-
disabled={running}
|
|
23
|
-
onChange={(e: ChangeEvent<HTMLInputElement>) => setName(e.currentTarget.value)}
|
|
24
|
-
placeholder="Enter your name"
|
|
25
|
-
style={{ padding: '0.5rem', flex: 1 }}
|
|
26
|
-
/>
|
|
27
|
-
<button
|
|
28
|
-
disabled={running}
|
|
29
|
-
onClick={() => run({ name })}
|
|
30
|
-
style={{ padding: '0.5rem 1rem' }}
|
|
31
|
-
>
|
|
32
|
-
{running ? 'Running ...' : 'Say Hello'}
|
|
33
|
-
</button>
|
|
34
|
-
</div>
|
|
35
|
-
{greeting && (
|
|
36
|
-
<div
|
|
37
|
-
style={{
|
|
38
|
-
padding: '1rem',
|
|
39
|
-
backgroundColor: '#f0f0f0',
|
|
40
|
-
borderRadius: '4px',
|
|
41
|
-
marginTop: '1rem',
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
{greeting}
|
|
45
|
-
</div>
|
|
46
|
-
)}
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<div
|
|
50
|
-
style={{
|
|
51
|
-
marginTop: '2rem',
|
|
52
|
-
padding: '1rem',
|
|
53
|
-
backgroundColor: '#e8f4f8',
|
|
54
|
-
borderRadius: '4px',
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
<h3>Next Steps:</h3>
|
|
58
|
-
<ul>
|
|
59
|
-
<li>
|
|
60
|
-
Edit <code>src/agents/hello/agent.ts</code> to customize your agent
|
|
61
|
-
</li>
|
|
62
|
-
<li>
|
|
63
|
-
Add new routes in <code>src/apis/</code>
|
|
64
|
-
</li>
|
|
65
|
-
<li>
|
|
66
|
-
Customize this page in <code>src/web/app.tsx</code>
|
|
67
|
-
</li>
|
|
68
|
-
</ul>
|
|
69
|
-
</div>
|
|
70
|
-
</AgentuityProvider>
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
}
|
package/src/web/public/.gitkeep
DELETED
|
File without changes
|
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"module": "Preserve",
|
|
6
|
-
"moduleDetection": "force",
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"allowJs": true,
|
|
9
|
-
"moduleResolution": "bundler",
|
|
10
|
-
"allowImportingTsExtensions": true,
|
|
11
|
-
"verbatimModuleSyntax": true,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"strict": true,
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"noFallthroughCasesInSwitch": true,
|
|
16
|
-
"noUncheckedIndexedAccess": true,
|
|
17
|
-
"noImplicitOverride": true,
|
|
18
|
-
"noUnusedLocals": false,
|
|
19
|
-
"noUnusedParameters": false,
|
|
20
|
-
"noPropertyAccessFromIndexSignature": false
|
|
21
|
-
},
|
|
22
|
-
"include": ["src/**/*", "app.ts"],
|
|
23
|
-
"exclude": [".agentuity/**/*"]
|
|
24
|
-
}
|