suzi-cli 0.1.1 → 0.1.2

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.
@@ -0,0 +1,427 @@
1
+ "use strict";
2
+ // Shared suzi-guide content used by both skills.ts and create.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SUZI_GUIDE_CONTENT = void 0;
5
+ exports.SUZI_GUIDE_CONTENT = `---
6
+ name: suzi-guide
7
+ description: >
8
+ Comprehensive guide for the Suzi CLI and agent platform. Use this skill when
9
+ the user asks about Suzi commands, how to create/deploy/manage agents, available
10
+ protocols and actions, agent code patterns, or anything related to the Suzi
11
+ autonomous agent platform for blockchain protocols.
12
+ ---
13
+
14
+ # Suzi CLI & Agent Platform Guide
15
+
16
+ ## IMPORTANT: Always Use the CLI for Live Data
17
+
18
+ **NEVER rely on hardcoded data from this skill for questions about protocols, actions, balances, agents, or any runtime state.** Always run the appropriate \`suzi\` CLI command and use its output. This ensures the user gets up-to-date information.
19
+
20
+ | User asks about... | Run this command |
21
+ |---------------------|-----------------|
22
+ | Available protocols / actions | \`suzi list-tools --verbose\` |
23
+ | Actions for a specific protocol | \`suzi list-tools --protocol <name>\` |
24
+ | Their agents | \`suzi agents\` |
25
+ | Agent details / triggers / config | \`suzi agents view <id>\` |
26
+ | Agent logs | \`suzi agents logs <id>\` |
27
+ | Wallet addresses | \`suzi wallet address\` |
28
+ | Balances | \`suzi wallet balance\` |
29
+ | Portfolio | \`suzi portfolio --all\` |
30
+ | Transactions | \`suzi transactions\` |
31
+ | Current user / auth status | \`suzi whoami\` |
32
+
33
+ **Do NOT answer "what protocols are available?" or "what actions does polymarket have?" from memory. Run the CLI.**
34
+
35
+ ---
36
+
37
+ ## What is Suzi?
38
+
39
+ Suzi is an autonomous agent platform for creating and executing intelligent agents that interact with blockchain protocols. Users write TypeScript agents with triggers (manual, cron, event-based) that execute actions against protocols in a sandboxed environment.
40
+
41
+ ---
42
+
43
+ ## Installing the Suzi CLI
44
+
45
+ \\\`\\\`\\\`bash
46
+ pnpm add suzi
47
+
48
+ # Verify installation
49
+ suzi --version
50
+ \\\`\\\`\\\`
51
+
52
+ ### First-time setup
53
+
54
+ \\\`\\\`\\\`bash
55
+ # 1. Point to the Suzi API (production)
56
+ suzi login --api-url https://api-3ihwe.ondigitalocean.app
57
+
58
+ # 2. Browser opens for Google OAuth sign-in
59
+ # 3. After auth, CLI shows your wallet address + QR code
60
+ # 4. Send SOL to the displayed address to fund your wallet
61
+ # 5. CLI auto-detects the deposit and shows your portfolio
62
+ \\\`\\\`\\\`
63
+
64
+ ### Requirements
65
+
66
+ - Node.js 22.x
67
+ - pnpm 9.15.0
68
+
69
+ ---
70
+
71
+ ## CLI Commands Reference
72
+
73
+ ### Authentication
74
+
75
+ \`\`\`bash
76
+ suzi login # Sign in with Google (OAuth2.0). Shows QR code for wallet funding.
77
+ suzi login --api-url <url> # Override API endpoint
78
+ suzi login --web-url <url> # Override web app URL
79
+ suzi logout # Sign out and clear stored credentials
80
+ suzi whoami # Show current authenticated user, wallet addresses
81
+ \`\`\`
82
+
83
+ ### Wallet Management
84
+
85
+ \`\`\`bash
86
+ suzi wallet # Show wallet overview (SOL + EVM addresses)
87
+ suzi wallet address # Show full wallet addresses (for copying)
88
+ suzi wallet balance # Show balances (ALWAYS run this for balance questions)
89
+ suzi wallet fund # Show deposit instructions with full addresses
90
+ \`\`\`
91
+
92
+ ### Portfolio
93
+
94
+ \`\`\`bash
95
+ suzi portfolio # View SOL + top 3 assets across chains
96
+ suzi portfolio --all # Full portfolio including Hyperliquid perp positions
97
+ \`\`\`
98
+
99
+ ### Agent Management
100
+
101
+ \`\`\`bash
102
+ suzi agents # List all agents (ALWAYS run this for agent questions)
103
+ suzi agents view <id> # View agent details (spec, triggers, resources, config)
104
+ suzi agents activate <id> # Activate agent (allocates wallets, registers triggers)
105
+ suzi agents deactivate <id> # Deactivate agent
106
+ suzi agents execute <id> [trigger] # Manually execute a trigger (prompts if multiple)
107
+ suzi agents logs <id> # View agent logs (default: last 20)
108
+ suzi agents logs <id> -n 50 # View more log entries
109
+ suzi agents logs <id> --level error # Filter by level: info|warn|error|debug
110
+ suzi agents delete <id> # Delete agent (with confirmation)
111
+ suzi agents delete <id> -f # Delete without confirmation
112
+ \`\`\`
113
+
114
+ ### Agent Deployment
115
+
116
+ \`\`\`bash
117
+ suzi deploy # Deploy agent (auto-discovers agent.ts, src/agent.ts, index.ts)
118
+ suzi deploy ./path/to/agent.ts # Deploy specific file
119
+ suzi deploy -t "My Agent" # Set title
120
+ suzi deploy -d "Description here" # Set description
121
+ suzi deploy --activate # Activate immediately after deployment
122
+ suzi deploy --update <agentId> # Update existing agent's code
123
+ \`\`\`
124
+
125
+ ### Agent Templates & Validation
126
+
127
+ \`\`\`bash
128
+ suzi subagents # List agent.md and agent.ts files in current directory
129
+ suzi subagents init # Create template agent.md + agent.ts files
130
+ suzi subagents init --dir ./myagent # Create templates in specific directory
131
+ suzi subagents validate # Validate agent.md (checks Meta, Resources, Triggers sections)
132
+ suzi subagents validate ./agent.md # Validate specific file
133
+ \`\`\`
134
+
135
+ ### Agent Import (Sharing)
136
+
137
+ \`\`\`bash
138
+ suzi import <slug> # Clone a shared agent by its share slug
139
+ \`\`\`
140
+
141
+ ### Transactions
142
+
143
+ \`\`\`bash
144
+ suzi transactions # View recent transactions across all agents (alias: suzi txns)
145
+ suzi txns -n 30 # Show more entries
146
+ suzi txns --type order # Filter: order|cancel|transfer|swap|bridge|liquidity
147
+ suzi txns --protocol polymarket # Filter by protocol
148
+ suzi txns --agent <id> # Filter by specific agent
149
+ suzi tx-confirm <agentId> # Show latest execution details (input/output)
150
+ \`\`\`
151
+
152
+ ### Tools & Protocols
153
+
154
+ \`\`\`bash
155
+ suzi list-tools # List all protocols (ALWAYS run for protocol questions)
156
+ suzi list-tools --verbose # Show ALL actions per protocol with descriptions
157
+ suzi list-tools --protocol <name> # Show actions for a specific protocol
158
+ \`\`\`
159
+
160
+ ### Preferences
161
+
162
+ \`\`\`bash
163
+ suzi preferences # View current preferences (alias: suzi prefs)
164
+ suzi prefs set-username [name] # Set display username
165
+ suzi prefs telegram # Connect Telegram for notifications
166
+ suzi prefs api-url <url> # Set API server URL
167
+ \`\`\`
168
+
169
+ ### Help & Suggestions
170
+
171
+ \`\`\`bash
172
+ suzi suggest # Interactive command suggestions (alias: suzi help-me)
173
+ suzi --help # Show all commands
174
+ \`\`\`
175
+
176
+ ### Skills
177
+
178
+ \`\`\`bash
179
+ suzi skills # List available skills
180
+ suzi skills show <name> # Show skill details and sections
181
+ suzi skills add <name> # Install a skill to ~/.claude/skills/
182
+ suzi skills add --all # Install all available skills
183
+ \`\`\`
184
+
185
+ ---
186
+
187
+ ## Creating Agents
188
+
189
+ ### Quick Start
190
+
191
+ \`\`\`bash
192
+ # 1. Initialize a template
193
+ suzi subagents init
194
+
195
+ # 2. Edit agent.ts with your logic
196
+
197
+ # 3. Deploy
198
+ suzi deploy ./agent.ts
199
+
200
+ # 4. Activate
201
+ suzi agents activate <agent-id>
202
+
203
+ # 5. Execute manually
204
+ suzi agents execute <agent-id>
205
+ \`\`\`
206
+
207
+ ### Agent File Structure
208
+
209
+ Agent files must default-export a \`defineAgent()\` call. The file is self-contained — **no imports allowed** (the runtime provides \`defineAgent\`, \`on\`, \`resource\`, \`config\`, \`requirement\` as globals).
210
+
211
+ \`\`\`typescript
212
+ export default defineAgent({
213
+ meta: { ... }, // Required: name, version
214
+ resources: { ... }, // Optional: wallet requirements
215
+ config: { ... }, // Optional: user-configurable parameters
216
+ activationRequirements: { ... }, // Optional: balance checks before activation
217
+ lifecycle: { ... }, // Optional: onActivate, onDeactivate hooks
218
+ triggers: { ... }, // Required: at least one trigger
219
+ });
220
+ \`\`\`
221
+
222
+ ### Minimal Agent
223
+
224
+ \`\`\`typescript
225
+ export default defineAgent({
226
+ meta: {
227
+ name: 'My Agent',
228
+ version: '0.1.0',
229
+ },
230
+ triggers: {
231
+ manual: on.suzi.manual(async (ctx, input) => {
232
+ await ctx.actions.suzi.log({ message: 'Hello from my agent!' });
233
+ return { ok: true };
234
+ }),
235
+ },
236
+ });
237
+ \`\`\`
238
+
239
+ ### Full Agent Template
240
+
241
+ \`\`\`typescript
242
+ export default defineAgent({
243
+ meta: {
244
+ name: 'My Trading Agent',
245
+ version: '0.1.0',
246
+ description: 'Automated trading strategy',
247
+ tags: ['trading', 'solana'],
248
+ },
249
+
250
+ // Wallet resources the agent needs
251
+ resources: {
252
+ svmWallet: resource.wallet('svm'), // Solana wallet
253
+ evmWallet: resource.wallet('evm'), // Ethereum wallet (for Hyperliquid/Polymarket)
254
+ },
255
+
256
+ // User-configurable parameters (set during activation)
257
+ config: {
258
+ capital: config.number({
259
+ description: 'Initial capital in USDC',
260
+ min: 100,
261
+ max: 10000,
262
+ required: true,
263
+ default: 1000,
264
+ }),
265
+ },
266
+
267
+ // Balance checks before agent can activate
268
+ activationRequirements: {
269
+ __min_usdc: requirement.svmTokenBalance({
270
+ token: 'USDC',
271
+ minAmount: { $ref: 'config.capital' }, // References config value
272
+ description: 'Minimum USDC required',
273
+ }),
274
+ __min_sol: requirement.svmNativeBalance({
275
+ minAmount: 0.5,
276
+ description: 'Minimum SOL for transaction fees',
277
+ }),
278
+ },
279
+
280
+ // Lifecycle hooks
281
+ lifecycle: {
282
+ onActivate: async (ctx) => {
283
+ const { capital } = ctx.config as { capital: number };
284
+ await ctx.actions.suzi.log({ message: \`Activating with $\${capital} USDC\` });
285
+ const svmResult = await ctx.actions.suzi.get_svm_address({});
286
+ await ctx.actions.suzi.set_to_store({ key: 'initial_capital', value: capital });
287
+ },
288
+
289
+ onDeactivate: async (ctx) => {
290
+ await ctx.actions.suzi.log({ message: 'Deactivating — closing positions...' });
291
+ },
292
+ },
293
+
294
+ triggers: {
295
+ // Manual trigger — executed from dashboard or CLI
296
+ manual: on.suzi.manual(async (ctx, input) => {
297
+ await ctx.actions.suzi.log({ message: 'Manual execution' });
298
+ return { ok: true };
299
+ }),
300
+
301
+ // Cron trigger — runs on schedule
302
+ rebalance: on.suzi.cron(
303
+ { schedule: '*/5 * * * *' }, // Every 5 minutes (standard cron syntax)
304
+ async (ctx) => {
305
+ await ctx.actions.suzi.log({ message: 'Rebalancing...' });
306
+ return { ok: true, action: 'rebalanced' };
307
+ }
308
+ ),
309
+ },
310
+ });
311
+ \`\`\`
312
+
313
+ ### Agent Context (ctx)
314
+
315
+ Available in all trigger handlers and lifecycle hooks:
316
+
317
+ \`\`\`typescript
318
+ ctx.actions.<protocol>.<action>() // Call any protocol action
319
+ ctx.config // Access config values
320
+ \`\`\`
321
+
322
+ **To see what protocols and actions are available, run \`suzi list-tools --verbose\`.**
323
+ Actions are called as \`ctx.actions.<protocol>.<action_name>({ ...params })\`.
324
+
325
+ ### Validation Rules
326
+
327
+ - Agent **must** default-export via \`defineAgent({})\`
328
+ - **No imports/requires** — agent code must be self-contained
329
+ - \`triggers\` object is **required** with at least one trigger
330
+ - Each trigger must have a \`type\` (e.g., \`suzi.manual\`, \`suzi.cron\`)
331
+ - Config fields need \`type\` and \`description\`
332
+ - The file is transpiled from TypeScript to JavaScript and executed in a VM2 sandbox
333
+
334
+ ### Agent Statuses
335
+
336
+ | Status | Description |
337
+ |--------|-------------|
338
+ | \`draft\` | Created but not activated. No wallets allocated. |
339
+ | \`active\` | Running. Cron triggers fire on schedule, event triggers are subscribed. |
340
+ | \`inactive\` | Deactivated. Triggers stopped. Can be reactivated. |
341
+ | \`deleted\` | Soft-deleted. Not recoverable from CLI. |
342
+
343
+ ---
344
+
345
+ ## Trigger Types
346
+
347
+ | Trigger | Syntax | Description |
348
+ |---------|--------|-------------|
349
+ | Manual | \`on.suzi.manual(handler)\` | Triggered from dashboard or \`suzi agents execute\` |
350
+ | Cron | \`on.suzi.cron({ schedule }, handler)\` | Runs on cron schedule (e.g., \`'*/5 * * * *'\`) |
351
+ | Event | \`on.<protocol>.event(config, handler)\` | Triggered by realtime protocol events |
352
+
353
+ ### Cron Schedule Examples
354
+
355
+ | Schedule | Meaning |
356
+ |----------|---------|
357
+ | \`*/1 * * * *\` | Every minute |
358
+ | \`*/5 * * * *\` | Every 5 minutes |
359
+ | \`0 * * * *\` | Every hour |
360
+ | \`0 */4 * * *\` | Every 4 hours |
361
+ | \`0 0 * * *\` | Daily at midnight |
362
+
363
+ ---
364
+
365
+ ## Common Workflows
366
+
367
+ ### Deploy & Activate in One Command
368
+
369
+ \`\`\`bash
370
+ suzi deploy ./agent.ts --activate
371
+ \`\`\`
372
+
373
+ ### Update Running Agent Code
374
+
375
+ \`\`\`bash
376
+ suzi deploy ./agent.ts --update <agent-id>
377
+ \`\`\`
378
+
379
+ ### Monitor Agent
380
+
381
+ \`\`\`bash
382
+ suzi agents logs <id> # View recent logs
383
+ suzi agents logs <id> --level error # Check for errors
384
+ suzi txns --agent <id> # View transactions
385
+ \`\`\`
386
+
387
+ ### Typical Development Loop
388
+
389
+ \`\`\`bash
390
+ # 1. Create template
391
+ suzi subagents init --dir ./my-agent
392
+
393
+ # 2. Edit agent.ts — write your logic
394
+
395
+ # 3. Deploy as draft
396
+ suzi deploy ./my-agent/agent.ts
397
+
398
+ # 4. Review
399
+ suzi agents view <id>
400
+
401
+ # 5. Activate
402
+ suzi agents activate <id>
403
+
404
+ # 6. Test manually
405
+ suzi agents execute <id>
406
+
407
+ # 7. Check results
408
+ suzi agents logs <id>
409
+
410
+ # 8. Iterate — update code
411
+ suzi deploy ./my-agent/agent.ts --update <id>
412
+ \`\`\`
413
+
414
+ ---
415
+
416
+ ## Tips & Best Practices
417
+
418
+ 1. **Start simple** — begin with a manual trigger, test it, then add cron/event triggers
419
+ 2. **Use \`suzi.log\`** liberally — logs are your debugging tool since agents run in a sandbox
420
+ 3. **Use \`suzi.set_to_store / get_from_store\`** for state that persists across trigger executions
421
+ 4. **Activation requirements** prevent agents from starting without sufficient funds
422
+ 5. **Kill switches** — add a cron trigger that checks drawdown and calls \`request_deactivation\` if needed
423
+ 6. **No imports** — all code must be self-contained. Use \`ctx.actions\` for all external interactions
424
+ 7. **Test with manual triggers first**, then add cron schedules
425
+ 8. **Connect Telegram** (\`suzi prefs telegram\`) for \`suzi.notify\` alerts
426
+ `;
427
+ //# sourceMappingURL=suzi-guide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suzi-guide.js","sourceRoot":"","sources":["../../src/lib/suzi-guide.ts"],"names":[],"mappings":";AAAA,iEAAiE;;;AAEpD,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqajC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suzi-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Suzi CLI by SendAI",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -11,7 +11,14 @@
11
11
  "url": "https://github.com/sendaifun"
12
12
  },
13
13
  "homepage": "https://github.com/sendaifun",
14
- "keywords": ["suzi", "sendai", "cli", "blockchain", "agents", "autonomous"],
14
+ "keywords": [
15
+ "suzi",
16
+ "sendai",
17
+ "cli",
18
+ "blockchain",
19
+ "agents",
20
+ "autonomous"
21
+ ],
15
22
  "license": "MIT",
16
23
  "author": "SendAI",
17
24
  "scripts": {
@@ -31,13 +38,15 @@
31
38
  "inquirer": "^8.2.6",
32
39
  "open": "^8.4.2",
33
40
  "ora": "^5.4.1",
34
- "qrcode-terminal": "^0.12.0"
41
+ "qrcode-terminal": "^0.12.0",
42
+ "update-notifier": "^5.1.0"
35
43
  },
36
44
  "devDependencies": {
37
45
  "@types/express": "^4.17.21",
38
46
  "@types/inquirer": "^8.2.10",
39
47
  "@types/node": "^22.10.5",
40
48
  "@types/qrcode-terminal": "^0.12.2",
49
+ "@types/update-notifier": "^6.0.8",
41
50
  "eslint": "^9.18.0",
42
51
  "tsx": "^4.19.2",
43
52
  "typescript": "^5.7.3"