hybrid 1.4.4 → 2.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.
Files changed (66) hide show
  1. package/README.md +234 -25
  2. package/dist/cli.cjs +1187 -0
  3. package/dist/cli.cjs.map +1 -0
  4. package/dist/cli.d.cts +2 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +1147 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/index.cjs +15 -1229
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +3 -238
  11. package/dist/index.d.ts +3 -238
  12. package/dist/index.js +1076 -1165
  13. package/dist/index.js.map +1 -1
  14. package/dist/server/index.cjs +44039 -0
  15. package/dist/xmtp.cjs +6122 -0
  16. package/package.json +43 -44
  17. package/skills/agent-browser/SKILL.md +567 -0
  18. package/skills/memory/SKILL.md +144 -0
  19. package/skills/scheduler/SKILL.md +151 -0
  20. package/skills/skills-manager/SKILL.md +95 -0
  21. package/skills/xmtp/SKILL.md +85 -0
  22. package/templates/agent/.env.example +10 -0
  23. package/templates/agent/AGENTS.md +225 -0
  24. package/templates/agent/BOOTSTRAP.md +55 -0
  25. package/templates/agent/HEARTBEAT.md +5 -0
  26. package/templates/agent/IDENTITY.md +23 -0
  27. package/templates/agent/SOUL.md +16 -0
  28. package/templates/agent/TOOLS.md +40 -0
  29. package/templates/agent/USER.md +17 -0
  30. package/templates/agent/package.json +12 -0
  31. package/dist/behaviors.cjs +0 -173
  32. package/dist/behaviors.cjs.map +0 -1
  33. package/dist/behaviors.d.cts +0 -33
  34. package/dist/behaviors.d.ts +0 -33
  35. package/dist/behaviors.js +0 -144
  36. package/dist/behaviors.js.map +0 -1
  37. package/dist/tools.cjs +0 -821
  38. package/dist/tools.cjs.map +0 -1
  39. package/dist/tools.d.cts +0 -1818
  40. package/dist/tools.d.ts +0 -1818
  41. package/dist/tools.js +0 -800
  42. package/dist/tools.js.map +0 -1
  43. package/dist/types.cjs +0 -25
  44. package/dist/types.cjs.map +0 -1
  45. package/dist/types.d.cts +0 -1
  46. package/dist/types.d.ts +0 -1
  47. package/dist/types.js +0 -3
  48. package/dist/types.js.map +0 -1
  49. package/src/behaviors/filter-messages.test.ts +0 -420
  50. package/src/behaviors/filter-messages.ts +0 -127
  51. package/src/behaviors/index.ts +0 -16
  52. package/src/behaviors/react-with.ts +0 -47
  53. package/src/behaviors/threaded-reply.test.ts +0 -41
  54. package/src/behaviors/threaded-reply.ts +0 -27
  55. package/src/core/agent.ts +0 -368
  56. package/src/core/plugin.ts +0 -149
  57. package/src/core/tool.ts +0 -104
  58. package/src/index.ts +0 -11
  59. package/src/lib/render.ts +0 -9
  60. package/src/server/listen.ts +0 -267
  61. package/src/server/listen.ts.old +0 -327
  62. package/src/server/processor.ts.old +0 -327
  63. package/src/tools/blockchain.ts +0 -604
  64. package/src/tools/index.ts +0 -50
  65. package/src/tools/xmtp.ts +0 -529
  66. package/src/types.ts +0 -1
package/README.md CHANGED
@@ -1,58 +1,267 @@
1
- # hybrid
1
+ # @hybrd/cli
2
2
 
3
- This package is part of the Hybrid monorepo.
3
+ The `hybrid` / `hy` command-line tool for building, developing, deploying, and managing Hybrid AI agents.
4
4
 
5
- Hybrid makes it easy for developers to create intelligent agents that can understand natural language, process messages, and respond through XMTP's decentralized messaging protocol.
5
+ ## Installation
6
6
 
7
- See [hybrid.dev](https://hybrid.dev) for more information.
7
+ ```bash
8
+ npm install -g @hybrd/cli
9
+ # or use directly via npx
10
+ npx hybrid <command>
11
+ ```
8
12
 
9
- ## 📦 Quickstart
13
+ ## Commands
10
14
 
11
- Getting started with Hybrid is simple:
15
+ ### `hybrid init [name]`
12
16
 
13
- ### 1. Initialize your project
17
+ Initialize a new agent project with an interactive setup:
14
18
 
15
19
  ```bash
16
- npm create hybrid my-agent
17
- cd my-agent
20
+ hybrid init # Interactive mode
21
+ hybrid init my-agent # Skip name prompt
18
22
  ```
19
23
 
20
- This creates all the necessary files and configuration for your agent.
24
+ The init command will ask:
25
+ 1. **Project name** - Directory name for the project
26
+ 2. **Agent display name** - Human-readable name for the agent
27
+ 3. **Deployment target** - Fly.io, Railway, Cloudflare, AWS, or GCP
28
+ 4. **Fly.io app name** - App identifier (lowercase, numbers, hyphens)
29
+ 5. **Primary region** - Closest region for deployment
30
+ 6. **VM size** - Resource allocation (shared/performance CPU, RAM)
31
+ 7. **Persistent storage** - Enable volume for data persistence
32
+ 8. **Storage size** - Volume size in GB (if enabled)
33
+
34
+ **Generated files:**
35
+ ```
36
+ my-agent/
37
+ ├── package.json # Project dependencies
38
+ ├── SOUL.md # Agent identity and behavior
39
+ ├── AGENTS.md # Repository guidelines
40
+ ├── .env.example # Environment variables template
41
+ ├── .gitignore # Git ignore rules
42
+ ├── Dockerfile # Container build instructions
43
+ ├── fly.toml # Fly.io deployment config
44
+ ├── start.sh # Start script
45
+ └── README.md # Project documentation
46
+ ```
21
47
 
22
- ### 2. Get your OpenRouter API key
23
-
24
- Visit [OpenRouter](https://openrouter.ai/keys), create an account and generate an API key
48
+ ### `hybrid build [--target]`
49
+
50
+ Build the agent bundle into `.hybrid/`:
51
+
52
+ ```bash
53
+ hybrid build # Default build
54
+ hybrid build --target fly # Fly.io target (default)
55
+ hybrid build --target railway # Railway target
56
+ hybrid build --target cf # Cloudflare Workers target
57
+ ```
25
58
 
26
- Add it to your `.env` file:
59
+ The build:
60
+ 1. Compiles `packages/agent` via `pnpm --filter hybrid/agent build`
61
+ 2. Creates `.hybrid/` directory structure
62
+ 3. Copies compiled `dist/` from the agent package
63
+ 4. Copies `SOUL.md`, `AGENTS.md`, and `agent.ts` from your project root
64
+ 5. Copies core skills from `packages/agent/skills/` → `.hybrid/skills/core/`
65
+ 6. Copies user skills from `./skills/` → `.hybrid/skills/ext/`
66
+ 7. Writes `skills/skills_lock.json` listing all installed skills
67
+ 8. Generates deployment files: `package.json`, `Dockerfile`, `fly.toml`, `start.sh`
27
68
 
28
- ```env
29
- OPENROUTER_API_KEY=your_openrouter_api_key_here
69
+ **Build output structure:**
30
70
  ```
71
+ .hybrid/
72
+ ├── dist/ # Compiled agent code
73
+ │ ├── server/index.cjs # Full Claude Code SDK server
74
+ │ ├── server/simple.cjs # Lightweight server
75
+ │ └── xmtp.cjs # XMTP sidecar
76
+ ├── skills/
77
+ │ ├── core/ # Built-in skills (memory, xmtp)
78
+ │ ├── ext/ # User-installed skills
79
+ │ └── skills_lock.json
80
+ ├── package.json
81
+ ├── Dockerfile
82
+ ├── fly.toml # (Fly.io targets only)
83
+ └── start.sh # Starts server + sidecar concurrently
84
+ ```
85
+
86
+ ### `hybrid dev`
31
87
 
32
- ### 3. Generate XMTP keys
88
+ Start the development server. Builds the agent then runs `pnpm dev` in the agent directory:
33
89
 
34
90
  ```bash
35
- hybrid keys
91
+ hybrid dev
36
92
  ```
37
93
 
38
- or automatically add it to your `.env` file:
94
+ ### `hybrid deploy [platform]`
95
+
96
+ Build then deploy to a platform:
39
97
 
40
98
  ```bash
41
- hybrid keys --write
99
+ hybrid deploy # Deploys to Fly.io (default)
100
+ hybrid deploy # Fly.io: runs `fly deploy` from .hybrid/
101
+ hybrid deploy cf # Cloudflare: builds packages/gateway, runs `wrangler deploy`
102
+ hybrid deploy railway # Railway (builds only, manual deploy)
42
103
  ```
43
104
 
44
- ### 4. Register your wallet with XMTP
105
+ ### `hybrid register`
106
+
107
+ Register the agent wallet on the XMTP network:
45
108
 
46
109
  ```bash
47
110
  hybrid register
48
111
  ```
49
112
 
50
- This generates secure wallet and encryption keys for your XMTP agent.
113
+ Delegates to `@hybrd/xmtp`'s register script via `pnpm --filter @hybrd/xmtp register`.
51
114
 
52
- ### 5. Start developing
115
+ ### `hybrid revoke <inboxId>`
116
+
117
+ Revoke XMTP installations for a specific inbox ID:
53
118
 
54
119
  ```bash
55
- hybrid dev
120
+ hybrid revoke 0xabc123...
121
+ ```
122
+
123
+ ### `hybrid revoke-all`
124
+
125
+ Auto-detect the inbox ID from the installation limit error and revoke all installations:
126
+
127
+ ```bash
128
+ hybrid revoke-all
129
+ ```
130
+
131
+ ### `hybrid install <source>`
132
+
133
+ Install a skill into your agent project:
134
+
135
+ ```bash
136
+ # From GitHub
137
+ hybrid install github:username/repo
138
+ hybrid install github:username/repo/path/to/skill
139
+
140
+ # From npm
141
+ hybrid install @scope/skill-package
142
+
143
+ # From local path
144
+ hybrid install ./path/to/skill
145
+ ```
146
+
147
+ Skills are directories containing a `SKILL.md` file with YAML frontmatter (`name`, `description`). Installed skills are copied to `./skills/` and tracked in `skills-lock.json`.
148
+
149
+ ### `hybrid uninstall <name>`
150
+
151
+ Remove an installed skill:
152
+
153
+ ```bash
154
+ hybrid uninstall my-skill-name
155
+ ```
156
+
157
+ ### `hybrid skills`
158
+
159
+ List all available skills:
160
+
161
+ ```bash
162
+ hybrid skills
163
+ ```
164
+
165
+ Shows core skills (from `packages/agent/skills/`) and installed extension skills (from `./skills/`), with name and description from each `SKILL.md`.
166
+
167
+ ## Generated Files
168
+
169
+ ### `Dockerfile` (Fly.io / Railway)
170
+
171
+ ```dockerfile
172
+ FROM node:20
173
+ WORKDIR /app
174
+ COPY dist/ ./dist/
175
+ COPY skills/ ./skills/
176
+ COPY package.json .
177
+ COPY start.sh .
178
+ COPY SOUL.md .
179
+ COPY AGENTS.md .
180
+ RUN npm install
181
+ CMD ["sh", "start.sh"]
56
182
  ```
57
183
 
58
- Your agent will start listening for XMTP messages and you're ready to build!
184
+ ### `start.sh`
185
+
186
+ Runs the agent server and XMTP sidecar concurrently:
187
+
188
+ ```bash
189
+ node dist/server/simple.cjs &
190
+ node dist/xmtp.cjs
191
+ ```
192
+
193
+ ### `fly.toml`
194
+
195
+ Generated for Fly.io targets with appropriate service configuration.
196
+
197
+ ## Skills System
198
+
199
+ Skills are markdown-based tool definitions. Each skill is a directory with:
200
+
201
+ ```
202
+ my-skill/
203
+ └── SKILL.md # Required: YAML frontmatter + markdown content
204
+ ```
205
+
206
+ **`SKILL.md` frontmatter:**
207
+ ```yaml
208
+ ---
209
+ name: my-skill
210
+ description: What this skill does
211
+ ---
212
+ ```
213
+
214
+ Skills are injected into the agent's system prompt, describing tools and capabilities the LLM can use.
215
+
216
+ **Skill sources:**
217
+
218
+ | Source | Format | Example |
219
+ |--------|--------|---------|
220
+ | GitHub | `github:user/repo[/path]` | `github:acme/skills/web-search` |
221
+ | npm | `@scope/pkg` or `pkg-name` | `@acme/weather-skill` |
222
+ | Local | `./relative/path` | `./skills/my-tool` |
223
+
224
+ ## Build Pipeline
225
+
226
+ ```
227
+ hybrid build
228
+
229
+ ├── pnpm --filter hybrid/agent build
230
+
231
+ ├── Create .hybrid/
232
+
233
+ ├── Copy dist/ → .hybrid/dist/
234
+
235
+ ├── Copy SOUL.md, AGENTS.md, agent.ts
236
+
237
+ ├── Copy core skills → .hybrid/skills/core/
238
+
239
+ ├── Copy ./skills/ → .hybrid/skills/ext/
240
+
241
+ ├── Write skills_lock.json
242
+
243
+ └── Generate: package.json, Dockerfile, fly.toml, start.sh
244
+
245
+ hybrid deploy
246
+
247
+ ├── hybrid build --target fly
248
+
249
+ └── fly deploy (from .hybrid/)
250
+
251
+ hybrid deploy cf
252
+
253
+ ├── pnpm --filter hybrid/gateway build
254
+
255
+ └── wrangler deploy (from packages/gateway/)
256
+ ```
257
+
258
+ ## Relation to Other Packages
259
+
260
+ - Builds `packages/agent` via `pnpm --filter`
261
+ - Deploys `packages/gateway` for Cloudflare Workers target
262
+ - Delegates `register`/`revoke` commands to `@hybrd/xmtp` scripts
263
+ - The output `.hybrid/` directory is what `packages/gateway` runs inside its Docker container
264
+
265
+ ## License
266
+
267
+ MIT