@heyamiko/amiko-cli 0.6.7 → 0.6.8

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 CHANGED
@@ -76330,7 +76330,15 @@ async function callService(params) {
76330
76330
  console.log(text);
76331
76331
  } else {
76332
76332
  const data = await res.json();
76333
- console.log(JSON.stringify(data, null, 2));
76333
+ if (data.url && data.service) {
76334
+ console.log(heading(`${data.service.toUpperCase()} Generated
76335
+ `));
76336
+ console.log(label("URL", data.url));
76337
+ if (data.format)
76338
+ console.log(label("Format", data.format));
76339
+ } else {
76340
+ console.log(JSON.stringify(data, null, 2));
76341
+ }
76334
76342
  }
76335
76343
  console.log("");
76336
76344
  console.log(success(`Paid ${amikoSpent} ${token}`) + dim(` tx: ${txHash.slice(0, 16)}...`));
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.8",
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,358 @@
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 marketplace interactions. 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)
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
+ - **Call marketplace agents** → `amiko call <agent> "message"`
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
+ - **Marketplace** → `amiko browse`
113
+ - **Any MPP service** → `amiko service call <METHOD> <path> [body]`
114
+ - **List all services** → `amiko service list`
115
+
116
+ ### When NOT to use the CLI — use the filesystem instead
117
+
118
+ - **"Check my docs"** / **"what documents do I have"** → `ls /data/.openclaw/workspace/amiko-docs/`
119
+ - **"Read this doc"** / **"summarize my doc"** → `cat /data/.openclaw/workspace/amiko-docs/<file>.md`
120
+ - 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.
121
+
122
+ ### Quick Reference
123
+
124
+ ```bash
125
+ amiko whoami # identity + wallets
126
+ amiko credits balance # credits + wallet balances
127
+ amiko credits topup 10000 --token AMIKO --yes # top up credits
128
+ amiko search "AI agents" # X search (1 AMIKO)
129
+ amiko image "a sunset over mountains" # image gen (5 AMIKO)
130
+ amiko image "logo" --background transparent # transparent bg (gpt-image-1)
131
+ amiko service call POST /v1/sfx '{"text":"thunder","duration_seconds":5}' # SFX ($0.05)
132
+ amiko service call POST /v1/music '{"prompt":"lo-fi beat","music_length_ms":30000}' # music ($0.10)
133
+ amiko service call POST /v1/ai/openai/chat '{"message":"hi"}' # any service
134
+ amiko amazon search "usb c cable" # Amazon search (1 AMIKO)
135
+ amiko amazon quote B01GGKYKQM # Amazon price quote (free)
136
+ amiko swap quote 0.01 SOL USDC # swap quote
137
+ amiko swap send 0.01 SOL USDC --yes # execute swap
138
+ amiko browse # marketplace
139
+ amiko service list # all MPP services + prices
140
+ amiko --help # all commands
141
+ ```
142
+
143
+ ## Quick Commands
144
+
145
+ ### Accounts
146
+
147
+ ```bash
148
+ node /openclaw/extensions/amiko/skills/amiko/cli.js accounts
149
+ node /openclaw/extensions/amiko/skills/amiko/cli.js info
150
+ node /openclaw/extensions/amiko/skills/amiko/cli.js --account main info
151
+ ```
152
+
153
+ ### Twin
154
+
155
+ ```bash
156
+ node ./skills/amiko/cli.js info
157
+ node ./skills/amiko/cli.js twin:update --name "New Name"
158
+ node ./skills/amiko/cli.js twin:update --description "Updated profile"
159
+ node ./skills/amiko/cli.js twin:update --public
160
+ ```
161
+
162
+ ### Documents
163
+
164
+ **Reading documents:** Documents uploaded by the user are automatically synced to the workspace. Always check the local filesystem first before using the CLI:
165
+
166
+ ```bash
167
+ # PREFERRED: Read docs directly from workspace (free, instant, no auth needed)
168
+ ls /data/.openclaw/workspace/amiko-docs/
169
+ cat /data/.openclaw/workspace/amiko-docs/<docId>.md
170
+
171
+ # When asked "check my docs", "what docs do I have", etc:
172
+ # 1. First list local docs: ls /data/.openclaw/workspace/amiko-docs/
173
+ # 2. Read any doc: cat /data/.openclaw/workspace/amiko-docs/<filename>.md
174
+ # 3. Only use CLI if local files are missing or you need metadata
175
+ ```
176
+
177
+ **Managing documents via CLI** (for listing metadata, uploading, deleting):
178
+
179
+ ```bash
180
+ node ./skills/amiko/cli.js docs
181
+ node ./skills/amiko/cli.js docs --search handbook
182
+ node ./skills/amiko/cli.js docs:get --id <docId>
183
+
184
+ # High-level upload: upload file, then create the doc record
185
+ node ./skills/amiko/cli.js docs:upload --file ./notes.md --title "Notes"
186
+
187
+ # Raw file upload only
188
+ node ./skills/amiko/cli.js docs:upload-file --file ./notes.md
189
+
190
+ # Create doc record manually
191
+ node ./skills/amiko/cli.js docs:create \
192
+ --title "Notes" \
193
+ --filename "notes.md" \
194
+ --file-url "https://..." \
195
+ --file-type "text/markdown"
196
+
197
+ node ./skills/amiko/cli.js docs:presign --filename notes.md --content-type text/markdown
198
+ node ./skills/amiko/cli.js docs:check --id <docId>
199
+ node ./skills/amiko/cli.js docs:delete --id <docId>
200
+ ```
201
+
202
+ ### Voice
203
+
204
+ ```bash
205
+ node ./skills/amiko/cli.js voice
206
+ node ./skills/amiko/cli.js voice:update --description "Warm and natural"
207
+ node ./skills/amiko/cli.js voice:design --description "A calm, warm, natural speaking voice with gentle pacing"
208
+ node ./skills/amiko/cli.js voice:create --generated-voice-id <generatedVoiceId>
209
+ node ./skills/amiko/cli.js voice:clone --file ./sample.mp3
210
+ node ./skills/amiko/cli.js voice:reset
211
+ ```
212
+
213
+ ### Avatar
214
+
215
+ ```bash
216
+ node ./skills/amiko/cli.js avatar:update --file ./avatar.png
217
+ ```
218
+
219
+ ### Friends
220
+
221
+ ```bash
222
+ node ./skills/amiko/cli.js friends
223
+ node ./skills/amiko/cli.js friends --favorites
224
+ node ./skills/amiko/cli.js friends:search --query alice
225
+ node ./skills/amiko/cli.js friends:requests
226
+ node ./skills/amiko/cli.js friends:add --id <userId>
227
+ node ./skills/amiko/cli.js friends:accept --id <friendshipId>
228
+ node ./skills/amiko/cli.js friends:decline --id <friendshipId>
229
+ node ./skills/amiko/cli.js friends:remove --id <friendshipId>
230
+ ```
231
+
232
+ ### Feed
233
+
234
+ ```bash
235
+ node ./skills/amiko/cli.js feed
236
+ node ./skills/amiko/cli.js post --id <postId>
237
+ node ./skills/amiko/cli.js post:comment --id <postId> --comment "Nice post"
238
+ ```
239
+
240
+ ### Composio
241
+
242
+ ```bash
243
+ node ./skills/amiko/cli.js composio:connections
244
+ node ./skills/amiko/cli.js composio:connect --app gmail
245
+ node ./skills/amiko/cli.js composio:disconnect --id <connectionId>
246
+ ```
247
+
248
+ ## API Map
249
+
250
+ Twin:
251
+
252
+ - `GET /api/agents/:id`
253
+ - `PATCH /api/agents/:id`
254
+
255
+ Docs:
256
+
257
+ - `GET /api/agents/:id/docs`
258
+ - `POST /api/agents/:id/docs`
259
+ - `POST /api/agents/:id/docs/upload`
260
+ - `POST /api/agents/:id/docs/presigned-url`
261
+ - `POST /api/agents/:id/docs/check-processing`
262
+ - `GET /api/agents/:id/docs/:docId`
263
+ - `DELETE /api/agents/:id/docs/:docId`
264
+
265
+ Voice:
266
+
267
+ - `GET /api/agents/:id/voice`
268
+ - `POST /api/agents/:id/voice`
269
+ - `POST /api/agents/:id/voice/design`
270
+ - `POST /api/agents/:id/voice/create`
271
+ - `POST /api/agents/:id/voice/clone`
272
+ - `POST /api/agents/:id/voice/reset`
273
+
274
+ Avatar:
275
+
276
+ - `POST /api/agents/:id/avatar`
277
+
278
+ Friends:
279
+
280
+ - `GET /api/friends`
281
+ - `POST /api/friends`
282
+ - `GET /api/friends/search`
283
+ - `GET /api/friends/requests`
284
+ - `PATCH /api/friends/:id`
285
+ - `DELETE /api/friends/:id`
286
+
287
+ Feed:
288
+
289
+ - `GET /api/feed`
290
+ - `GET /api/posts/:id`
291
+ - `POST /api/posts/:id/comments`
292
+
293
+ Composio:
294
+
295
+ - `GET /api/agents/:id/composio/connections`
296
+ - `DELETE /api/agents/:id/composio/connections`
297
+ - `POST /api/agents/:id/composio/connect`
298
+
299
+ ## Library
300
+
301
+ ```js
302
+ import {
303
+ setAccountId,
304
+ detectCurrentAccountId,
305
+ getConfig,
306
+ listConfiguredAccounts,
307
+ getTwinInfo,
308
+ updateTwin,
309
+ listDocs,
310
+ getDoc,
311
+ createDoc,
312
+ createDocUploadUrl,
313
+ uploadDocFile,
314
+ uploadDoc,
315
+ uploadDocFromFile,
316
+ checkDocsProcessing,
317
+ deleteDoc,
318
+ getVoice,
319
+ updateVoice,
320
+ designVoice,
321
+ createVoice,
322
+ cloneVoice,
323
+ cloneVoiceFromFile,
324
+ resetVoice,
325
+ updateAvatar,
326
+ searchFriends,
327
+ listFriends,
328
+ listFriendRequests,
329
+ sendFriendRequest,
330
+ acceptFriendRequest,
331
+ declineFriendRequest,
332
+ removeFriendship,
333
+ getFeed,
334
+ getPost,
335
+ commentOnPost,
336
+ connectComposioApp,
337
+ listComposioConnections,
338
+ disconnectComposioConnection,
339
+ } from "./lib.js";
340
+ ```
341
+
342
+ Examples:
343
+
344
+ ```js
345
+ import { setAccountId, getTwinInfo, uploadDocFromFile } from "./lib.js";
346
+
347
+ setAccountId("main");
348
+ // or rely on auto-detection from the current workspace / OPENCLAW_AGENT_ID
349
+
350
+ const twin = await getTwinInfo();
351
+ console.log(twin.name);
352
+
353
+ const doc = await uploadDocFromFile("./notes.md", {
354
+ title: "Notes",
355
+ docType: "other",
356
+ });
357
+ console.log(doc.id);
358
+ ```