create-agentuity 0.0.5 ā 0.0.7
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/AGENTS.md +27 -27
- package/README.md +2 -2
- package/app.ts +1 -1
- package/package.json +13 -8
- package/setup.ts +1 -1
- package/src/agents/hello/agent.ts +1 -1
- package/src/agents/hello/route.ts +1 -1
- package/src/agents/registry.generated.ts +1 -1
- package/src/apis/status/route.ts +1 -1
- package/src/web/app.tsx +21 -8
- package/tsconfig.json +3 -2
package/AGENTS.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
- **Runtime**: Bun server runtime
|
|
12
12
|
- **Framework**: Hono (lightweight web framework)
|
|
13
|
-
- **Build tool**: `@agentuity/
|
|
13
|
+
- **Build tool**: `@agentuity/cli` compiles to `.agentuity/` directory
|
|
14
14
|
- **Frontend**: React with `@agentuity/react` hooks
|
|
15
15
|
|
|
16
16
|
## Project Structure
|
|
@@ -47,27 +47,27 @@ Each agent should be in its own folder under `src/agents/`:
|
|
|
47
47
|
|
|
48
48
|
```typescript
|
|
49
49
|
// src/agents/my-agent/agent.ts
|
|
50
|
-
import { type AgentContext, createAgent } from '@agentuity/
|
|
50
|
+
import { type AgentContext, createAgent } from '@agentuity/runtime';
|
|
51
51
|
import { z } from 'zod';
|
|
52
52
|
|
|
53
53
|
const agent = createAgent({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
71
|
});
|
|
72
72
|
|
|
73
73
|
export default agent;
|
|
@@ -79,7 +79,7 @@ Add custom HTTP routes for your agent:
|
|
|
79
79
|
|
|
80
80
|
```typescript
|
|
81
81
|
// src/agents/my-agent/route.ts
|
|
82
|
-
import { createRouter } from '@agentuity/
|
|
82
|
+
import { createRouter } from '@agentuity/runtime';
|
|
83
83
|
import { zValidator } from '@hono/zod-validator';
|
|
84
84
|
import agent from './agent';
|
|
85
85
|
|
|
@@ -87,15 +87,15 @@ const router = createRouter();
|
|
|
87
87
|
|
|
88
88
|
// GET endpoint
|
|
89
89
|
router.get('/', async (c) => {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
const result = await c.agent['my-agent'].run({ message: 'Hello!' });
|
|
91
|
+
return c.json(result);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// POST endpoint with validation
|
|
95
95
|
router.post('/', zValidator('json', agent.inputSchema!), async (c) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
const data = c.req.valid('json');
|
|
97
|
+
const result = await c.agent['my-agent'].run(data);
|
|
98
|
+
return c.json(result);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
export default router;
|
|
@@ -121,12 +121,12 @@ Create custom routes in `src/apis/`:
|
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
123
|
// src/apis/my-route/route.ts
|
|
124
|
-
import { createRouter } from '@agentuity/
|
|
124
|
+
import { createRouter } from '@agentuity/runtime';
|
|
125
125
|
|
|
126
126
|
const router = createRouter();
|
|
127
127
|
|
|
128
128
|
router.get('/', (c) => {
|
|
129
|
-
|
|
129
|
+
return c.json({ status: 'ok' });
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
export default router;
|
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Create a new agent by adding a folder in `src/agents/`:
|
|
|
77
77
|
|
|
78
78
|
```typescript
|
|
79
79
|
// src/agents/my-agent/agent.ts
|
|
80
|
-
import { type AgentContext, createAgent } from '@agentuity/
|
|
80
|
+
import { type AgentContext, createAgent } from '@agentuity/runtime';
|
|
81
81
|
import { z } from 'zod';
|
|
82
82
|
|
|
83
83
|
const agent = createAgent({
|
|
@@ -106,7 +106,7 @@ Create custom routes in `src/apis/` or add routes to an agent folder:
|
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
108
|
// src/agents/my-agent/route.ts
|
|
109
|
-
import { createRouter } from '@agentuity/
|
|
109
|
+
import { createRouter } from '@agentuity/runtime';
|
|
110
110
|
import { zValidator } from '@hono/zod-validator';
|
|
111
111
|
import agent from './agent';
|
|
112
112
|
|
package/app.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-agentuity",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"module": "index.ts",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-agentuity": "./setup.ts"
|
|
8
|
+
},
|
|
6
9
|
"files": [
|
|
7
10
|
"src",
|
|
8
11
|
"app.ts",
|
|
@@ -13,8 +16,8 @@
|
|
|
13
16
|
"setup.ts"
|
|
14
17
|
],
|
|
15
18
|
"scripts": {
|
|
16
|
-
"build": "
|
|
17
|
-
"dev": "
|
|
19
|
+
"build": "agentuity bundle --dir .",
|
|
20
|
+
"dev": "agentuity dev --dir .",
|
|
18
21
|
"typecheck": "bunx tsc --noEmit"
|
|
19
22
|
},
|
|
20
23
|
"keywords": [
|
|
@@ -27,24 +30,26 @@
|
|
|
27
30
|
"author": "Agentuity",
|
|
28
31
|
"license": "MIT",
|
|
29
32
|
"dependencies": {
|
|
30
|
-
"@agentuity/
|
|
31
|
-
"@agentuity/
|
|
32
|
-
"@agentuity/
|
|
33
|
-
"@agentuity/server": "0.0.1",
|
|
33
|
+
"@agentuity/core": "0.0.6",
|
|
34
|
+
"@agentuity/react": "0.0.6",
|
|
35
|
+
"@agentuity/runtime": "0.0.6",
|
|
34
36
|
"@hono/zod-validator": "^0.7.4",
|
|
35
37
|
"enquirer": "^2.4.1",
|
|
38
|
+
"hono": "^4.7.10",
|
|
36
39
|
"react": "^19.2.0",
|
|
37
40
|
"react-dom": "^19.2.0",
|
|
38
41
|
"zod": "^4.1.12"
|
|
39
42
|
},
|
|
40
43
|
"bun-create": {
|
|
44
|
+
"preinstall": "echo 'Preparing local dependencies...'",
|
|
41
45
|
"postinstall": [
|
|
42
|
-
"bun
|
|
46
|
+
"agentuity create --from-bun-create --no-log-prefix",
|
|
43
47
|
"bun run build"
|
|
44
48
|
],
|
|
45
49
|
"start": "bun run dev"
|
|
46
50
|
},
|
|
47
51
|
"devDependencies": {
|
|
52
|
+
"@agentuity/cli": "0.0.6",
|
|
48
53
|
"@types/bun": "latest",
|
|
49
54
|
"@types/react": "^19.0.0"
|
|
50
55
|
},
|
package/setup.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { basename } from 'path';
|
|
|
5
5
|
const projectDir = process.cwd();
|
|
6
6
|
const projectName = basename(projectDir);
|
|
7
7
|
|
|
8
|
-
console.log(
|
|
8
|
+
console.log(`š§ Setting up ${projectName}...\n`);
|
|
9
9
|
|
|
10
10
|
// Update package.json
|
|
11
11
|
const packageJsonPath = 'package.json';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Auto-generated by Agentuity - do not edit manually
|
|
2
2
|
import helloAgent from '../agents/hello/agent';
|
|
3
|
-
import type { AgentRunner, Logger } from '@agentuity/
|
|
3
|
+
import type { AgentRunner, Logger } from '@agentuity/runtime';
|
|
4
4
|
import type { KeyValueStorage, ObjectStorage, StreamStorage, VectorStorage } from '@agentuity/core';
|
|
5
5
|
|
|
6
6
|
export const agentRegistry = {
|
package/src/apis/status/route.ts
CHANGED
package/src/web/app.tsx
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
1
|
+
import React, { type ChangeEvent, useState } from 'react';
|
|
3
2
|
import { AgentuityProvider, useAgent } from '@agentuity/react';
|
|
4
3
|
|
|
5
4
|
export function App() {
|
|
6
5
|
const [name, setName] = useState('World');
|
|
7
|
-
const { run, data: greeting
|
|
6
|
+
const { run, running, data: greeting } = useAgent('hello');
|
|
8
7
|
|
|
9
8
|
return (
|
|
10
|
-
<div
|
|
9
|
+
<div
|
|
10
|
+
style={{ fontFamily: 'sans-serif', padding: '2rem', maxWidth: '600px', margin: '0 auto' }}
|
|
11
|
+
>
|
|
11
12
|
<AgentuityProvider>
|
|
12
13
|
<h1>Welcome to Agentuity</h1>
|
|
13
14
|
<p>Your new Agentuity project is ready to go!</p>
|
|
@@ -18,12 +19,17 @@ export function App() {
|
|
|
18
19
|
<input
|
|
19
20
|
type="text"
|
|
20
21
|
value={name}
|
|
21
|
-
|
|
22
|
+
disabled={running}
|
|
23
|
+
onChange={(e: ChangeEvent<HTMLInputElement>) => setName(e.currentTarget.value)}
|
|
22
24
|
placeholder="Enter your name"
|
|
23
25
|
style={{ padding: '0.5rem', flex: 1 }}
|
|
24
26
|
/>
|
|
25
|
-
<button
|
|
26
|
-
{
|
|
27
|
+
<button
|
|
28
|
+
disabled={running}
|
|
29
|
+
onClick={() => run({ name })}
|
|
30
|
+
style={{ padding: '0.5rem 1rem' }}
|
|
31
|
+
>
|
|
32
|
+
{running ? 'Running ...' : 'Say Hello'}
|
|
27
33
|
</button>
|
|
28
34
|
</div>
|
|
29
35
|
{greeting && (
|
|
@@ -40,7 +46,14 @@ export function App() {
|
|
|
40
46
|
)}
|
|
41
47
|
</div>
|
|
42
48
|
|
|
43
|
-
<div
|
|
49
|
+
<div
|
|
50
|
+
style={{
|
|
51
|
+
marginTop: '2rem',
|
|
52
|
+
padding: '1rem',
|
|
53
|
+
backgroundColor: '#e8f4f8',
|
|
54
|
+
borderRadius: '4px',
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
44
57
|
<h3>Next Steps:</h3>
|
|
45
58
|
<ul>
|
|
46
59
|
<li>
|
package/tsconfig.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"lib": ["ESNext"],
|
|
3
|
+
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
|
4
4
|
"target": "ESNext",
|
|
5
5
|
"module": "Preserve",
|
|
6
6
|
"moduleDetection": "force",
|
|
@@ -19,5 +19,6 @@
|
|
|
19
19
|
"noUnusedParameters": false,
|
|
20
20
|
"noPropertyAccessFromIndexSignature": false
|
|
21
21
|
},
|
|
22
|
-
"include": ["src/**/*", "app.ts"]
|
|
22
|
+
"include": ["src/**/*", "app.ts"],
|
|
23
|
+
"exclude": [".agentuity/**/*"]
|
|
23
24
|
}
|