@heyamiko/amiko-cli 0.6.7 → 0.6.9

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 (3) hide show
  1. package/dist/index.js +374 -1091
  2. package/package.json +3 -2
  3. package/skills/SKILL.md +359 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyamiko/amiko-cli",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,8 @@
13
13
  "test": "bun test"
14
14
  },
15
15
  "files": [
16
- "dist"
16
+ "dist",
17
+ "skills"
17
18
  ],
18
19
  "keywords": [
19
20
  "amiko",
@@ -0,0 +1,359 @@
1
+ ---
2
+ name: amiko
3
+ description: Interact with amiko-new APIs using the twin token already configured in OpenClaw
4
+ homepage: https://platform.heyamiko.com
5
+ metadata: {"openclaw":{"emoji":"🤖","requires":{"bins":["node"]}}}
6
+ ---
7
+
8
+ # Amiko Skill
9
+
10
+ This skill talks to the current `amiko-new` API surface using the twin token already stored in OpenClaw.
11
+
12
+ It does not use `workspace/.amiko.json` or `.amiko.json`.
13
+
14
+ ## Configuration
15
+
16
+ Config is read from:
17
+
18
+ ```text
19
+ 1. $OPENCLAW_CONFIG_PATH
20
+ 2. $OPENCLAW_STATE_DIR/openclaw.json
21
+ 3. /data/.openclaw/openclaw.json
22
+ 4. ~/.openclaw/openclaw.json
23
+
24
+ Then read: channels.amiko
25
+ ```
26
+
27
+ Installed CLI path:
28
+
29
+ ```text
30
+ /openclaw/extensions/amiko/skills/amiko/cli.js
31
+ ```
32
+
33
+ If you are editing the plugin from a source checkout, the same file is:
34
+
35
+ ```text
36
+ ./skills/amiko/cli.js
37
+ ```
38
+
39
+ Recommended multi-account shape:
40
+
41
+ ```json5
42
+ {
43
+ "channels": {
44
+ "amiko": {
45
+ "defaultAccount": "main",
46
+ "accounts": {
47
+ "main": {
48
+ "twinId": "<primaryTwinId>",
49
+ "token": "clawd-...",
50
+ "platformApiBaseUrl": "https://platform.heyamiko.com",
51
+ "chatApiBaseUrl": "https://api.amiko.app"
52
+ },
53
+ "agent-foo": {
54
+ "twinId": "<fooTwinId>",
55
+ "token": "clawd-...",
56
+ "platformApiBaseUrl": "https://platform.heyamiko.com",
57
+ "chatApiBaseUrl": "https://api.amiko.app"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ Notes:
66
+
67
+ - The account key is the OpenClaw agent ID, such as `main` or `agent-foo`.
68
+ - `twinId` lives inside each account entry.
69
+ - The skill uses `platformApiBaseUrl` for `amiko-new` routes.
70
+ - The plugin channel uses `chatApiBaseUrl` for send/health routes.
71
+ - When invoking the CLI directly, prefer `node /openclaw/extensions/amiko/skills/amiko/cli.js ...` in an installed OpenClaw environment, or `node ./skills/amiko/cli.js ...` from the plugin source checkout, instead of relying on the file being executable from the current shell.
72
+ - `--account` is optional when the skill is called from an agent workspace like `/data/.openclaw/workspace` or `/data/.openclaw/workspace-<agentId>`. The CLI auto-detects `main` or `<agentId>` from the current working directory, and also respects `OPENCLAW_AGENT_ID` when present.
73
+ - If auto-detection does not work, use `--account <agentId>`.
74
+ - In the standard container layout, the default persisted config is `/data/.openclaw/openclaw.json`.
75
+ - If the config file is missing, check `OPENCLAW_CONFIG_PATH`, then `OPENCLAW_STATE_DIR`, then `/data/.openclaw/openclaw.json`, before assuming `~/.openclaw/openclaw.json` is the active location.
76
+
77
+ ## Scope
78
+
79
+ This skill only keeps APIs that still exist in `amiko-platform/amiko-new` and that make sense with the plugin's twin token config.
80
+
81
+ Removed from the old template:
82
+
83
+ - `.amiko.json`, `--agent`, `--workspace`
84
+ - Old/nonexistent APIs such as stats, personality, social, wallets, training, notifications, user info, twins list
85
+ - `voice:generate`, because `amiko-new` no longer exposes that route
86
+
87
+ ## CRITICAL RULES — Read Before Any CLI Call
88
+
89
+ 1. **NEVER retry a failed command.** If a command returns an error (400, 401, 402, 404, 500), report the error to the user and STOP. Do not try variations, do not loop. Every paid call costs tokens even if it fails.
90
+ 2. **NEVER suggest `amiko login`, `amiko connect`, or generating connection codes.** Auth comes from `.amiko.json` automatically. If auth fails, tell the user to re-init from the Amiko dashboard.
91
+ 3. **NEVER use `--task` flag.** Use chat endpoints only.
92
+ 4. **Check balance before expensive operations.** Run `amiko credits balance` first if unsure about funds.
93
+
94
+ ## Amiko CLI — Payments, Search, Image, Audio, Marketplace
95
+
96
+ The `amiko` CLI handles payments, search, image generation, audio, and MPP service calls. All services are paid with AMIKO tokens on Solana automatically. Auth is read from `.amiko.json` in the workspace — NOT from the skill's `channels.amiko` config.
97
+
98
+ ### When to use the Amiko CLI
99
+
100
+ Use the CLI when the user asks about:
101
+ - **Wallet addresses** or **balances** → `amiko credits balance`
102
+ - **Top up credits** → `amiko credits topup <amount> --token AMIKO --yes`
103
+ - **Search X/Twitter** → `amiko search "<query>"` (1 AMIKO)
104
+ - **Generate images** → `amiko image "<prompt>"` (5 AMIKO) — returns `{ images: [{ url }] }`
105
+ - **Sound effects** → `amiko service call POST /v1/sfx '{"text":"...","duration_seconds":5}'` ($0.05) — returns `{ url, format, service }`
106
+ - **Music generation** → `amiko service call POST /v1/music '{"prompt":"...","music_length_ms":30000}'` ($0.10) — returns `{ url, format, service }`
107
+ - **Text-to-speech** → `amiko service tts <voiceId> "<text>"` (1 AMIKO) — returns `{ url, format, service }`
108
+ - **Amazon search** → `amiko amazon search "<query>"` (1 AMIKO)
109
+ - **Amazon quote** → `amiko amazon quote <ASIN>` (free)
110
+ - **Swap tokens** → `amiko swap quote <amount> <from> <to>`
111
+ - **Who am I / identity** → `amiko whoami`
112
+ - **Any other MPP service** → `amiko service call <METHOD> <path> [body]`
113
+ - **List all services** → `amiko service list`
114
+
115
+ **IMPORTANT:** Music, SFX, TTS, and image generation are DIRECT services — always use `amiko service call` or the dedicated commands (`amiko image`, `amiko service tts`). These handle payment automatically via AMIKO tokens.
116
+
117
+ ### When NOT to use the CLI — use the filesystem instead
118
+
119
+ - **"Check my docs"** / **"what documents do I have"** → `ls /data/.openclaw/workspace/amiko-docs/`
120
+ - **"Read this doc"** / **"summarize my doc"** → `cat /data/.openclaw/workspace/amiko-docs/<file>.md`
121
+ - Documents are automatically synced to `/data/.openclaw/workspace/amiko-docs/` as markdown files. Always check there first — it's free and instant. Only fall back to the CLI if the files aren't there.
122
+
123
+ ### Quick Reference
124
+
125
+ ```bash
126
+ amiko whoami # identity + wallets
127
+ amiko credits balance # credits + wallet balances
128
+ amiko credits topup 10000 --token AMIKO --yes # top up credits
129
+ amiko search "AI agents" # X search (1 AMIKO)
130
+ amiko image "a sunset over mountains" # image gen (5 AMIKO)
131
+ amiko image "logo" --background transparent # transparent bg (gpt-image-1)
132
+ amiko service call POST /v1/sfx '{"text":"thunder","duration_seconds":5}' # SFX ($0.05)
133
+ amiko service call POST /v1/music '{"prompt":"lo-fi beat","music_length_ms":30000}' # music ($0.10)
134
+ amiko service call POST /v1/ai/openai/chat '{"message":"hi"}' # any service
135
+ amiko amazon search "usb c cable" # Amazon search (1 AMIKO)
136
+ amiko amazon quote B01GGKYKQM # Amazon price quote (free)
137
+ amiko swap quote 0.01 SOL USDC # swap quote
138
+ amiko swap send 0.01 SOL USDC --yes # execute swap
139
+ amiko service list # all MPP services + prices
140
+ amiko service list # all MPP services + prices
141
+ amiko --help # all commands
142
+ ```
143
+
144
+ ## Quick Commands
145
+
146
+ ### Accounts
147
+
148
+ ```bash
149
+ node /openclaw/extensions/amiko/skills/amiko/cli.js accounts
150
+ node /openclaw/extensions/amiko/skills/amiko/cli.js info
151
+ node /openclaw/extensions/amiko/skills/amiko/cli.js --account main info
152
+ ```
153
+
154
+ ### Twin
155
+
156
+ ```bash
157
+ node ./skills/amiko/cli.js info
158
+ node ./skills/amiko/cli.js twin:update --name "New Name"
159
+ node ./skills/amiko/cli.js twin:update --description "Updated profile"
160
+ node ./skills/amiko/cli.js twin:update --public
161
+ ```
162
+
163
+ ### Documents
164
+
165
+ **Reading documents:** Documents uploaded by the user are automatically synced to the workspace. Always check the local filesystem first before using the CLI:
166
+
167
+ ```bash
168
+ # PREFERRED: Read docs directly from workspace (free, instant, no auth needed)
169
+ ls /data/.openclaw/workspace/amiko-docs/
170
+ cat /data/.openclaw/workspace/amiko-docs/<docId>.md
171
+
172
+ # When asked "check my docs", "what docs do I have", etc:
173
+ # 1. First list local docs: ls /data/.openclaw/workspace/amiko-docs/
174
+ # 2. Read any doc: cat /data/.openclaw/workspace/amiko-docs/<filename>.md
175
+ # 3. Only use CLI if local files are missing or you need metadata
176
+ ```
177
+
178
+ **Managing documents via CLI** (for listing metadata, uploading, deleting):
179
+
180
+ ```bash
181
+ node ./skills/amiko/cli.js docs
182
+ node ./skills/amiko/cli.js docs --search handbook
183
+ node ./skills/amiko/cli.js docs:get --id <docId>
184
+
185
+ # High-level upload: upload file, then create the doc record
186
+ node ./skills/amiko/cli.js docs:upload --file ./notes.md --title "Notes"
187
+
188
+ # Raw file upload only
189
+ node ./skills/amiko/cli.js docs:upload-file --file ./notes.md
190
+
191
+ # Create doc record manually
192
+ node ./skills/amiko/cli.js docs:create \
193
+ --title "Notes" \
194
+ --filename "notes.md" \
195
+ --file-url "https://..." \
196
+ --file-type "text/markdown"
197
+
198
+ node ./skills/amiko/cli.js docs:presign --filename notes.md --content-type text/markdown
199
+ node ./skills/amiko/cli.js docs:check --id <docId>
200
+ node ./skills/amiko/cli.js docs:delete --id <docId>
201
+ ```
202
+
203
+ ### Voice
204
+
205
+ ```bash
206
+ node ./skills/amiko/cli.js voice
207
+ node ./skills/amiko/cli.js voice:update --description "Warm and natural"
208
+ node ./skills/amiko/cli.js voice:design --description "A calm, warm, natural speaking voice with gentle pacing"
209
+ node ./skills/amiko/cli.js voice:create --generated-voice-id <generatedVoiceId>
210
+ node ./skills/amiko/cli.js voice:clone --file ./sample.mp3
211
+ node ./skills/amiko/cli.js voice:reset
212
+ ```
213
+
214
+ ### Avatar
215
+
216
+ ```bash
217
+ node ./skills/amiko/cli.js avatar:update --file ./avatar.png
218
+ ```
219
+
220
+ ### Friends
221
+
222
+ ```bash
223
+ node ./skills/amiko/cli.js friends
224
+ node ./skills/amiko/cli.js friends --favorites
225
+ node ./skills/amiko/cli.js friends:search --query alice
226
+ node ./skills/amiko/cli.js friends:requests
227
+ node ./skills/amiko/cli.js friends:add --id <userId>
228
+ node ./skills/amiko/cli.js friends:accept --id <friendshipId>
229
+ node ./skills/amiko/cli.js friends:decline --id <friendshipId>
230
+ node ./skills/amiko/cli.js friends:remove --id <friendshipId>
231
+ ```
232
+
233
+ ### Feed
234
+
235
+ ```bash
236
+ node ./skills/amiko/cli.js feed
237
+ node ./skills/amiko/cli.js post --id <postId>
238
+ node ./skills/amiko/cli.js post:comment --id <postId> --comment "Nice post"
239
+ ```
240
+
241
+ ### Composio
242
+
243
+ ```bash
244
+ node ./skills/amiko/cli.js composio:connections
245
+ node ./skills/amiko/cli.js composio:connect --app gmail
246
+ node ./skills/amiko/cli.js composio:disconnect --id <connectionId>
247
+ ```
248
+
249
+ ## API Map
250
+
251
+ Twin:
252
+
253
+ - `GET /api/agents/:id`
254
+ - `PATCH /api/agents/:id`
255
+
256
+ Docs:
257
+
258
+ - `GET /api/agents/:id/docs`
259
+ - `POST /api/agents/:id/docs`
260
+ - `POST /api/agents/:id/docs/upload`
261
+ - `POST /api/agents/:id/docs/presigned-url`
262
+ - `POST /api/agents/:id/docs/check-processing`
263
+ - `GET /api/agents/:id/docs/:docId`
264
+ - `DELETE /api/agents/:id/docs/:docId`
265
+
266
+ Voice:
267
+
268
+ - `GET /api/agents/:id/voice`
269
+ - `POST /api/agents/:id/voice`
270
+ - `POST /api/agents/:id/voice/design`
271
+ - `POST /api/agents/:id/voice/create`
272
+ - `POST /api/agents/:id/voice/clone`
273
+ - `POST /api/agents/:id/voice/reset`
274
+
275
+ Avatar:
276
+
277
+ - `POST /api/agents/:id/avatar`
278
+
279
+ Friends:
280
+
281
+ - `GET /api/friends`
282
+ - `POST /api/friends`
283
+ - `GET /api/friends/search`
284
+ - `GET /api/friends/requests`
285
+ - `PATCH /api/friends/:id`
286
+ - `DELETE /api/friends/:id`
287
+
288
+ Feed:
289
+
290
+ - `GET /api/feed`
291
+ - `GET /api/posts/:id`
292
+ - `POST /api/posts/:id/comments`
293
+
294
+ Composio:
295
+
296
+ - `GET /api/agents/:id/composio/connections`
297
+ - `DELETE /api/agents/:id/composio/connections`
298
+ - `POST /api/agents/:id/composio/connect`
299
+
300
+ ## Library
301
+
302
+ ```js
303
+ import {
304
+ setAccountId,
305
+ detectCurrentAccountId,
306
+ getConfig,
307
+ listConfiguredAccounts,
308
+ getTwinInfo,
309
+ updateTwin,
310
+ listDocs,
311
+ getDoc,
312
+ createDoc,
313
+ createDocUploadUrl,
314
+ uploadDocFile,
315
+ uploadDoc,
316
+ uploadDocFromFile,
317
+ checkDocsProcessing,
318
+ deleteDoc,
319
+ getVoice,
320
+ updateVoice,
321
+ designVoice,
322
+ createVoice,
323
+ cloneVoice,
324
+ cloneVoiceFromFile,
325
+ resetVoice,
326
+ updateAvatar,
327
+ searchFriends,
328
+ listFriends,
329
+ listFriendRequests,
330
+ sendFriendRequest,
331
+ acceptFriendRequest,
332
+ declineFriendRequest,
333
+ removeFriendship,
334
+ getFeed,
335
+ getPost,
336
+ commentOnPost,
337
+ connectComposioApp,
338
+ listComposioConnections,
339
+ disconnectComposioConnection,
340
+ } from "./lib.js";
341
+ ```
342
+
343
+ Examples:
344
+
345
+ ```js
346
+ import { setAccountId, getTwinInfo, uploadDocFromFile } from "./lib.js";
347
+
348
+ setAccountId("main");
349
+ // or rely on auto-detection from the current workspace / OPENCLAW_AGENT_ID
350
+
351
+ const twin = await getTwinInfo();
352
+ console.log(twin.name);
353
+
354
+ const doc = await uploadDocFromFile("./notes.md", {
355
+ title: "Notes",
356
+ docType: "other",
357
+ });
358
+ console.log(doc.id);
359
+ ```