towns-agent 3.4.0 → 4.0.0
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/dist/index.js +38 -21
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/templates/quickstart/AGENTS.md +2 -2
- package/templates/quickstart/README.md +3 -3
- package/templates/quickstart/package.json +1 -1
- package/templates/quickstart/src/commands.ts +1 -1
- package/templates/quickstart/src/index.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "towns-agent",
|
|
3
3
|
"description": "CLI for creating and managing Towns Protocol bot projects",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"author": "Towns Protocol",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsup",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@towns-labs/contracts": "^
|
|
33
|
-
"@towns-labs/encryption": "^
|
|
34
|
-
"@towns-labs/proto": "^
|
|
35
|
-
"@towns-labs/relayer-client": "^
|
|
36
|
-
"@towns-labs/sdk": "^
|
|
37
|
-
"@towns-labs/sdk-crypto": "^
|
|
38
|
-
"@towns-labs/utils": "^
|
|
32
|
+
"@towns-labs/contracts": "^4.0.0",
|
|
33
|
+
"@towns-labs/encryption": "^4.0.0",
|
|
34
|
+
"@towns-labs/proto": "^4.0.0",
|
|
35
|
+
"@towns-labs/relayer-client": "^4.0.0",
|
|
36
|
+
"@towns-labs/sdk": "^4.0.0",
|
|
37
|
+
"@towns-labs/sdk-crypto": "^4.0.0",
|
|
38
|
+
"@towns-labs/utils": "^4.0.0",
|
|
39
39
|
"@types/cross-spawn": "^6.0.6",
|
|
40
40
|
"@types/minimist": "^1.2.5",
|
|
41
41
|
"@types/node": "^20.14.8",
|
|
@@ -102,14 +102,14 @@ bot.onMessage(async (handler, event) => {
|
|
|
102
102
|
**Setup:**
|
|
103
103
|
```typescript
|
|
104
104
|
// 1. src/commands.ts
|
|
105
|
-
import type { AgentCommand } from '@towns-labs/
|
|
105
|
+
import type { AgentCommand } from '@towns-labs/app-framework'
|
|
106
106
|
|
|
107
107
|
export const commands = [
|
|
108
108
|
{ name: "help", description: "Show help" }
|
|
109
109
|
] as const satisfies AgentCommand[]
|
|
110
110
|
|
|
111
111
|
// 2. Initialize
|
|
112
|
-
const bot = await
|
|
112
|
+
const bot = await makeTownsApp(privateData, { commands })
|
|
113
113
|
|
|
114
114
|
// 3. Register
|
|
115
115
|
bot.onSlashCommand("help", async (handler, event) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Towns Agent
|
|
2
2
|
|
|
3
|
-
A [Towns Protocol](https://towns.com) agent built with [`@towns-labs/
|
|
3
|
+
A [Towns Protocol](https://towns.com) agent built with [`@towns-labs/app-framework`](https://www.npmjs.com/package/@towns-labs/app-framework).
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
|
|
@@ -70,7 +70,7 @@ src/
|
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
- **`commands.ts`** — Define slash commands that appear in autocomplete.
|
|
73
|
-
- **`index.ts`** — Initialize the agent with `
|
|
73
|
+
- **`index.ts`** — Initialize the agent with `makeTownsApp` and register event handlers (`onMessage`, `onSlashCommand`, etc.).
|
|
74
74
|
|
|
75
75
|
## Scripts
|
|
76
76
|
|
|
@@ -92,4 +92,4 @@ bunx towns-agent update
|
|
|
92
92
|
## Resources
|
|
93
93
|
|
|
94
94
|
- [AGENTS.md](./AGENTS.md) — API reference for event handlers, payloads, and handler methods
|
|
95
|
-
- [@towns-labs/
|
|
95
|
+
- [@towns-labs/app-framework on npm](https://www.npmjs.com/package/@towns-labs/app-framework)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "dotenv/config"
|
|
2
|
-
import {
|
|
2
|
+
import { makeTownsApp } from "@towns-labs/app-framework"
|
|
3
3
|
import commands from "./commands"
|
|
4
4
|
|
|
5
|
-
const bot = await
|
|
5
|
+
const bot = await makeTownsApp(
|
|
6
6
|
process.env.APP_PRIVATE_DATA!,
|
|
7
7
|
{ jwtSecret: process.env.JWT_SECRET, commands },
|
|
8
8
|
)
|