@3ns/cli 1.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/README.md +459 -0
- package/SKILL.md +154 -0
- package/dist/apiClient.d.ts +16 -0
- package/dist/apiClient.d.ts.map +1 -0
- package/dist/apiClient.js +115 -0
- package/dist/apiClient.js.map +1 -0
- package/dist/commands/agents.d.ts +3 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +74 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +66 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/chats.d.ts +3 -0
- package/dist/commands/chats.d.ts.map +1 -0
- package/dist/commands/chats.js +73 -0
- package/dist/commands/chats.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +117 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/exportImport.d.ts +3 -0
- package/dist/commands/exportImport.d.ts.map +1 -0
- package/dist/commands/exportImport.js +84 -0
- package/dist/commands/exportImport.js.map +1 -0
- package/dist/commands/files.d.ts +3 -0
- package/dist/commands/files.d.ts.map +1 -0
- package/dist/commands/files.js +110 -0
- package/dist/commands/files.js.map +1 -0
- package/dist/commands/links.d.ts +3 -0
- package/dist/commands/links.d.ts.map +1 -0
- package/dist/commands/links.js +91 -0
- package/dist/commands/links.js.map +1 -0
- package/dist/commands/models.d.ts +3 -0
- package/dist/commands/models.d.ts.map +1 -0
- package/dist/commands/models.js +32 -0
- package/dist/commands/models.js.map +1 -0
- package/dist/commands/openclaw.d.ts +3 -0
- package/dist/commands/openclaw.d.ts.map +1 -0
- package/dist/commands/openclaw.js +63 -0
- package/dist/commands/openclaw.js.map +1 -0
- package/dist/commands/skins.d.ts +3 -0
- package/dist/commands/skins.d.ts.map +1 -0
- package/dist/commands/skins.js +169 -0
- package/dist/commands/skins.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
# 3NS CLI
|
|
2
|
+
|
|
3
|
+
**Your AI agent, your website, your links, your data -- controlled from the command line.**
|
|
4
|
+
|
|
5
|
+
The 3NS CLI gives you full control over your [3NS agent domain](https://3ns.domains) without opening a browser. Build a Linktree-style link page, customise your website's look and feel, manage the AI instruction files that power your agent, browse chat history, upload files, discover other agents on the network, and back everything up -- all from your terminal.
|
|
6
|
+
|
|
7
|
+
Designed for developers, power users, and AI assistants (OpenClaw, Cursor, LobeHub, and any tool that can run shell commands).
|
|
8
|
+
|
|
9
|
+
## What You Can Do
|
|
10
|
+
|
|
11
|
+
| Feature | What it does |
|
|
12
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| **Links** | Build a Linktree-style page with custom links, icons, labels, ordering, and visibility toggles |
|
|
14
|
+
| **Website Skins** | Customise every colour, font, chat bubble style, and background image on your 3NS website |
|
|
15
|
+
| **Agent Config** | Read, write, and create the Markdown instruction files that define your AI agent's personality, knowledge, and capabilities |
|
|
16
|
+
| **Chat History** | Browse conversations, read full message threads, send new messages, and clean up old chats |
|
|
17
|
+
| **Files** | Upload documents (PDF, images, anything up to 10 MB), download them, and manage your file library |
|
|
18
|
+
| **Agent Discovery** | Search for other agents on the 3NS network, view their capability cards, and send them messages (A2A protocol) |
|
|
19
|
+
| **Export / Import** | Full backup and restore of your entire agent -- config, chats, files, everything |
|
|
20
|
+
| **Setup Prompt** | Generate a personalised AI instruction prompt you can paste into any LLM to connect it to your 3NS agent |
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g 3ns-cli
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or use without installing:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx 3ns-cli --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Get Your API Key
|
|
35
|
+
|
|
36
|
+
1. Sign in at [3ns.domains](https://3ns.domains)
|
|
37
|
+
2. Open the **Export** menu and select **Export to OpenClaw**
|
|
38
|
+
3. Click **Generate API Key**
|
|
39
|
+
4. Copy the key (you'll only see it once)
|
|
40
|
+
|
|
41
|
+
### Authenticate
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
3ns auth login YOUR_API_KEY
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The CLI verifies your key immediately and shows your agent name. Credentials are stored in `~/.3nsrc` with restricted file permissions (0600).
|
|
48
|
+
|
|
49
|
+
### Verify
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
3ns auth whoami
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Commands
|
|
58
|
+
|
|
59
|
+
### `3ns auth` -- Authentication
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
3ns auth login <api-key> # Store API key and verify it
|
|
63
|
+
3ns auth login <key> --base-url URL # Use a custom API endpoint
|
|
64
|
+
3ns auth whoami # Show current agent name and key prefix
|
|
65
|
+
3ns auth logout # Remove stored credentials
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### `3ns links` -- Linktree-Style Link Page
|
|
71
|
+
|
|
72
|
+
Manage the links that appear on your 3NS website. Each link has a URL, title, description, icon, platform tag, display order, and active/inactive toggle.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# List all your links
|
|
76
|
+
3ns links list
|
|
77
|
+
3ns links list --json
|
|
78
|
+
|
|
79
|
+
# Add a link with full details
|
|
80
|
+
3ns links add --url https://twitter.com/myhandle --title "Follow me on X" --platform twitter --username myhandle
|
|
81
|
+
|
|
82
|
+
# Add a simple link
|
|
83
|
+
3ns links add --url https://myportfolio.com --title "My Portfolio"
|
|
84
|
+
|
|
85
|
+
# Update a link's title and order
|
|
86
|
+
3ns links update LINK_ID --title "Updated Title" --order 1
|
|
87
|
+
|
|
88
|
+
# Toggle a link's visibility
|
|
89
|
+
3ns links update LINK_ID --active false
|
|
90
|
+
|
|
91
|
+
# Remove a link
|
|
92
|
+
3ns links remove LINK_ID
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**All options for `add` and `update`:**
|
|
96
|
+
|
|
97
|
+
| Option | Description | Example |
|
|
98
|
+
| --------------- | --------------------------- | --------------------------------------------------------------------------- |
|
|
99
|
+
| `--url` | Link URL (required for add) | `https://youtube.com/@me` |
|
|
100
|
+
| `--title` | Display title | `"My YouTube Channel"` |
|
|
101
|
+
| `--description` | Short description | `"Weekly tech videos"` |
|
|
102
|
+
| `--icon` | Icon URL or emoji | `"https://example.com/icon.png"` |
|
|
103
|
+
| `--platform` | Platform key | `twitter`, `instagram`, `youtube`, `github`, `linkedin`, `tiktok`, `custom` |
|
|
104
|
+
| `--username` | Username for the platform | `myhandle` |
|
|
105
|
+
| `--order` | Display order (integer) | `1` |
|
|
106
|
+
| `--active` | Visible on site | `true` or `false` |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### `3ns models` -- Available AI Models
|
|
111
|
+
|
|
112
|
+
List all AI models you can use with your agent. Filter by provider, or use `--json` for scripting.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# List all available models
|
|
116
|
+
3ns models
|
|
117
|
+
|
|
118
|
+
# Filter by provider
|
|
119
|
+
3ns models --provider openai
|
|
120
|
+
3ns models --provider google
|
|
121
|
+
3ns models --provider anthropic
|
|
122
|
+
3ns models --provider xai
|
|
123
|
+
|
|
124
|
+
# JSON output for scripting
|
|
125
|
+
3ns models --json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Output includes model name (for use with `--model`), display label, provider, and context window size.
|
|
129
|
+
|
|
130
|
+
**Currently available (21 models):**
|
|
131
|
+
|
|
132
|
+
| Provider | Models |
|
|
133
|
+
|---|---|
|
|
134
|
+
| Google (Vertex AI) | Gemini 2.0 Flash, 2.5 Flash, 2.5 Pro, 3 Flash, 3 Pro |
|
|
135
|
+
| OpenAI | GPT-4o, GPT-4o Mini, GPT-4.1, GPT-4.1 Mini, GPT-5 Mini, GPT-5.1, GPT-5.2, O3 |
|
|
136
|
+
| Anthropic | Claude 4.5 Haiku, Claude 4.5 Sonnet, Claude 4 Opus, Claude Sonnet 4.6, Claude Opus 4.6 |
|
|
137
|
+
| xAI | Grok 4, Grok 4 Fast, Grok 4.1 Fast |
|
|
138
|
+
| Self-hosted | Any Ollama model (configured separately via the dashboard) |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### `3ns skins` -- Website Appearance
|
|
143
|
+
|
|
144
|
+
Full control over your 3NS website's visual design. Change colours, fonts, background images, chat bubble styles, button appearance, and more.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# View your current skin
|
|
148
|
+
3ns skins get
|
|
149
|
+
3ns skins get --json
|
|
150
|
+
|
|
151
|
+
# Update individual properties
|
|
152
|
+
3ns skins update --theme "midnight" --bg-color "#0a0a2e" --font-color "#e0e0ff"
|
|
153
|
+
|
|
154
|
+
# Set chat bubble colours
|
|
155
|
+
3ns skins update --chat-bubble-color "#1a1a3e" --user-bubble-color "#2a2a5e" \
|
|
156
|
+
--chat-bubble-font "#ffffff" --user-bubble-font "#ffffff"
|
|
157
|
+
|
|
158
|
+
# Style buttons
|
|
159
|
+
3ns skins update --button-color "#4a90d9" --button-font-color "#ffffff" \
|
|
160
|
+
--button-border "#6ab0ff" --button-bg "#2a2a5e"
|
|
161
|
+
|
|
162
|
+
# Change the font
|
|
163
|
+
3ns skins update --font-family "Inter"
|
|
164
|
+
|
|
165
|
+
# Upload a background image (jpg, png, gif, webp -- max 10 MB)
|
|
166
|
+
3ns skins upload-bg ./my-background.jpg
|
|
167
|
+
3ns skins upload-bg ./desktop-bg.png --target desktop
|
|
168
|
+
|
|
169
|
+
# Browse preset themes
|
|
170
|
+
3ns skins presets
|
|
171
|
+
3ns skins presets --json
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**All skin properties:**
|
|
175
|
+
|
|
176
|
+
| Option | Description |
|
|
177
|
+
| --------------------- | --------------------------------- |
|
|
178
|
+
| `--theme` | Theme preset name |
|
|
179
|
+
| `--bg-color` | Background colour (hex) |
|
|
180
|
+
| `--bg-image` | Background image URL |
|
|
181
|
+
| `--bg-image-desktop` | Desktop-only background image URL |
|
|
182
|
+
| `--video` | Background video URL |
|
|
183
|
+
| `--font-color` | Main text colour |
|
|
184
|
+
| `--font-family` | Font family name |
|
|
185
|
+
| `--button-color` | Button colour |
|
|
186
|
+
| `--button-font-color` | Button font colour |
|
|
187
|
+
| `--button-border` | Button border colour |
|
|
188
|
+
| `--button-bg` | Button background colour |
|
|
189
|
+
| `--hover-color` | Hover state colour |
|
|
190
|
+
| `--chat-bubble-color` | Agent chat bubble background |
|
|
191
|
+
| `--user-bubble-color` | User chat bubble background |
|
|
192
|
+
| `--chat-bubble-font` | Agent chat bubble text colour |
|
|
193
|
+
| `--user-bubble-font` | User chat bubble text colour |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### `3ns config` -- Agent Instruction Files
|
|
198
|
+
|
|
199
|
+
Your agent's brain lives in Markdown files. These instruction files control your agent's personality, knowledge, capabilities, and behaviour. Edit them to shape how your AI responds.
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# List all folders containing instruction files
|
|
203
|
+
3ns config folders
|
|
204
|
+
3ns config folders --json
|
|
205
|
+
|
|
206
|
+
# Read a document
|
|
207
|
+
3ns config read DOC_ID
|
|
208
|
+
3ns config read DOC_ID --json
|
|
209
|
+
|
|
210
|
+
# Update a document from a local file
|
|
211
|
+
3ns config write DOC_ID --file ./my-new-instructions.md
|
|
212
|
+
|
|
213
|
+
# Update with inline content
|
|
214
|
+
3ns config write DOC_ID --content "# Updated Instructions\nYou are a helpful cooking assistant."
|
|
215
|
+
|
|
216
|
+
# Create a new document in a folder (skips if it already exists)
|
|
217
|
+
3ns config ensure FOLDER_ID --name capabilities.md --content "# My Agent's Skills"
|
|
218
|
+
3ns config ensure FOLDER_ID --name personality.md --file ./personality.md
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**What to put in instruction files:**
|
|
222
|
+
|
|
223
|
+
- **Instructions** -- How your agent should behave, its tone, personality, and rules
|
|
224
|
+
- **Knowledge** -- Facts, product information, company details your agent should know
|
|
225
|
+
- **Capabilities** -- What your agent can do, tools it has access to
|
|
226
|
+
- **Permissions** -- What topics your agent should avoid or handle carefully
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### `3ns chats` -- Chat History
|
|
231
|
+
|
|
232
|
+
Browse and manage your agent's conversation history.
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# List all conversations (most recent first)
|
|
236
|
+
3ns chats list
|
|
237
|
+
3ns chats list --json
|
|
238
|
+
|
|
239
|
+
# View full messages in a chat
|
|
240
|
+
3ns chats history CHAT_ID
|
|
241
|
+
3ns chats history CHAT_ID --json
|
|
242
|
+
|
|
243
|
+
# Send a message to start or continue a conversation
|
|
244
|
+
3ns chats send --folder FOLDER_ID "What can you help me with?"
|
|
245
|
+
3ns chats send --folder FOLDER_ID "Tell me about cooking" --agent-type NORM
|
|
246
|
+
|
|
247
|
+
# Specify which AI model to use for this message
|
|
248
|
+
3ns chats send --folder FOLDER_ID "Summarise this document" --model openai/gpt-5.2
|
|
249
|
+
3ns chats send --folder FOLDER_ID "Write a poem" --model anthropic/claude-4-opus
|
|
250
|
+
|
|
251
|
+
# Delete a chat and all its messages
|
|
252
|
+
3ns chats delete CHAT_ID
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Agent types: `NORM` (standard), `AMPS` (amplified), `CUST` (custom).
|
|
256
|
+
|
|
257
|
+
Use `--model` to override the default model for a single message. Run `3ns models` to see all valid model names. Ollama models are also supported with `ollamadynamic/MODEL_NAME`.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
### `3ns files` -- File Management
|
|
262
|
+
|
|
263
|
+
Upload, download, and manage files attached to your agent (PDFs, images, documents -- up to 10 MB each).
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# List all uploaded files
|
|
267
|
+
3ns files list
|
|
268
|
+
3ns files list --json
|
|
269
|
+
|
|
270
|
+
# Upload a file to a specific folder
|
|
271
|
+
3ns files upload ./report.pdf --folder FOLDER_ID
|
|
272
|
+
3ns files upload ./photo.jpg --folder FOLDER_ID --name "team-photo.jpg"
|
|
273
|
+
3ns files upload ./data.csv --folder FOLDER_ID --type "text/csv"
|
|
274
|
+
|
|
275
|
+
# Download a file
|
|
276
|
+
3ns files download FILE_ID -o ./downloaded-report.pdf
|
|
277
|
+
|
|
278
|
+
# Delete a file
|
|
279
|
+
3ns files delete FILE_ID
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### `3ns agents` -- Discovery & Communication
|
|
285
|
+
|
|
286
|
+
Find other agents on the 3NS network and communicate with them using the Agent-to-Agent (A2A) protocol.
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# Search for agents by keyword
|
|
290
|
+
3ns agents search "cooking"
|
|
291
|
+
3ns agents search "finance" --json
|
|
292
|
+
|
|
293
|
+
# View an agent's full capability card
|
|
294
|
+
3ns agents card SPACE_ID
|
|
295
|
+
3ns agents card SPACE_ID --json
|
|
296
|
+
|
|
297
|
+
# Send a message to another agent
|
|
298
|
+
3ns agents chat SPACE_ID "Can you help me plan a dinner menu?"
|
|
299
|
+
|
|
300
|
+
# List your own agent spaces
|
|
301
|
+
3ns agents list
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### `3ns export` / `3ns import` -- Backup & Restore
|
|
307
|
+
|
|
308
|
+
Back up your entire agent (config, chats, files) to a single JSON file, or restore from a backup. Migrate between accounts or keep local snapshots.
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Full backup
|
|
312
|
+
3ns export -o my-agent-backup.json
|
|
313
|
+
|
|
314
|
+
# Backup without chat history
|
|
315
|
+
3ns export --no-chats -o config-only.json
|
|
316
|
+
|
|
317
|
+
# Backup without files
|
|
318
|
+
3ns export --no-files -o lightweight-backup.json
|
|
319
|
+
|
|
320
|
+
# Restore from backup
|
|
321
|
+
3ns import my-agent-backup.json
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
### `3ns openclaw` -- Setup Prompt
|
|
327
|
+
|
|
328
|
+
Get your personalised AI setup prompt to connect any AI assistant to your 3NS agent.
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# Get your setup prompt (formatted)
|
|
332
|
+
3ns openclaw setup-prompt
|
|
333
|
+
|
|
334
|
+
# Get raw prompt text (pipe to clipboard)
|
|
335
|
+
3ns openclaw setup-prompt --raw
|
|
336
|
+
3ns openclaw setup-prompt --raw | pbcopy # macOS
|
|
337
|
+
3ns openclaw setup-prompt --raw | clip # Windows
|
|
338
|
+
3ns openclaw setup-prompt --raw | xclip -sel c # Linux
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## JSON Output
|
|
344
|
+
|
|
345
|
+
Every list command supports `--json` for machine-readable output, making the CLI easy to pipe into other tools:
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
3ns links list --json | jq '.[0].url'
|
|
349
|
+
3ns agents search "finance" --json | jq '.[] | .name'
|
|
350
|
+
3ns skins get --json | jq '.themeName'
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Full API Coverage
|
|
356
|
+
|
|
357
|
+
The CLI provides complete parity with the 3NS web dashboard. Everything you can do on the website, you can do from the command line.
|
|
358
|
+
|
|
359
|
+
| Feature | CLI Command | API Endpoint | Method |
|
|
360
|
+
| ---------------------- | --------------------------- | ---------------------------- | ------------------------- |
|
|
361
|
+
| Profile & metadata | `3ns auth whoami` (GET) | `/openclaw/profile` | GET / PUT (PUT via API) |
|
|
362
|
+
| Default AI model | via API | `/openclaw/model` | GET / PUT |
|
|
363
|
+
| Website passcode | via API | `/openclaw/passcode` | GET / PUT |
|
|
364
|
+
| Links (CRUD) | `3ns links` | `/openclaw/links` | GET / POST / PUT / DELETE |
|
|
365
|
+
| Website skin | `3ns skins` | `/openclaw/skins` | GET / PUT |
|
|
366
|
+
| Skin background upload | `3ns skins upload-bg` | `/openclaw/skins/upload` | POST |
|
|
367
|
+
| Skin presets | `3ns skins presets` | `/openclaw/skins/presets` | GET |
|
|
368
|
+
| Config folders | `3ns config folders` | `/openclaw/config/folders` | GET |
|
|
369
|
+
| Config documents | `3ns config read/write` | `/openclaw/config/documents` | GET / PUT / POST |
|
|
370
|
+
| Available AI models | `3ns models` | `/openclaw/models` | GET |
|
|
371
|
+
| Chat conversations | `3ns chats` | `/openclaw/chats` | GET / POST / DELETE |
|
|
372
|
+
| File management | `3ns files` | `/openclaw/files` | GET / POST / DELETE |
|
|
373
|
+
| Agent search | `3ns agents search` | `/openclaw/agents/search` | GET |
|
|
374
|
+
| Agent card | `3ns agents card` | `/openclaw/agents/:id/card` | GET |
|
|
375
|
+
| A2A messaging | `3ns agents chat` | `/openclaw/agents/:id/chat` | POST |
|
|
376
|
+
| Export | `3ns export` | `/openclaw/export` | POST |
|
|
377
|
+
| Import | `3ns import` | `/openclaw/import` | POST |
|
|
378
|
+
| Setup prompt | `3ns openclaw setup-prompt` | `/openclaw/setup-prompt` | GET |
|
|
379
|
+
| Payment settings | via API | `/openclaw/profile` | PUT |
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Security
|
|
384
|
+
|
|
385
|
+
- **Per-user API keys** -- Your key is SHA-256 hashed before storage. The plaintext is shown once at generation time and cannot be retrieved.
|
|
386
|
+
- **User isolation** -- Your key can only access your own data. One user cannot view or modify another user's links, config, chats, files, or skins.
|
|
387
|
+
- **Folder ownership** -- Document and file operations verify that the target folder belongs to you.
|
|
388
|
+
- **Upload limits** -- Max 10 MB per file. Skin background uploads accept images only (jpeg, png, gif, webp). Filenames are sanitized automatically.
|
|
389
|
+
- **Secure storage** -- Credentials in `~/.3nsrc` are written with 0600 permissions (owner-only read/write).
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Configuration
|
|
394
|
+
|
|
395
|
+
### Credentials file
|
|
396
|
+
|
|
397
|
+
Stored at `~/.3nsrc`:
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{
|
|
401
|
+
"apiKey": "your-api-key",
|
|
402
|
+
"baseUrl": "https://us-central1-prod3ns.cloudfunctions.net/openclaw/openclaw"
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Custom API endpoint
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
3ns auth login YOUR_KEY --base-url https://your-custom-endpoint/openclaw
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Environment variable override
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
export THREENS_API_URL=https://us-central1-prod3ns.cloudfunctions.net/openclaw/openclaw
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Default: `https://us-central1-prod3ns.cloudfunctions.net/openclaw/openclaw`
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## For AI Agents
|
|
423
|
+
|
|
424
|
+
This CLI is built to be used by AI assistants. Generate a complete instruction prompt and paste it into any LLM:
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
# Copy setup prompt to clipboard
|
|
428
|
+
3ns openclaw setup-prompt --raw | pbcopy # macOS
|
|
429
|
+
3ns openclaw setup-prompt --raw | clip # Windows
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
The prompt includes your agent name, API key prefix, base URL, and every available endpoint with usage examples. Paste it into OpenClaw, Cursor, LobeHub, ChatGPT, Claude, or any AI assistant to give it full access to your 3NS agent.
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## Requirements
|
|
437
|
+
|
|
438
|
+
- Node.js 18+
|
|
439
|
+
- A 3NS account with a domain at [3ns.domains](https://3ns.domains)
|
|
440
|
+
|
|
441
|
+
## Development
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
git clone https://github.com/AshleyTuring/3ns-cli.git
|
|
445
|
+
cd 3ns-cli
|
|
446
|
+
npm install
|
|
447
|
+
npm run build
|
|
448
|
+
node dist/index.js --help
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
## Links
|
|
452
|
+
|
|
453
|
+
- **Website:** [3ns.domains](https://3ns.domains)
|
|
454
|
+
- **FAQ:** [3ns.domains/faq](https://3ns.domains/faq)
|
|
455
|
+
- **GitHub:** [github.com/AshleyTuring/3ns-cli](https://github.com/AshleyTuring/3ns-cli)
|
|
456
|
+
|
|
457
|
+
## License
|
|
458
|
+
|
|
459
|
+
MIT
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# 3NS Agent Domain CLI -- AI Skill
|
|
2
|
+
|
|
3
|
+
> This skill allows an AI agent to control a 3NS agent domain. Use the 3NS CLI to manage links, website appearance, agent instruction files, chat history, files, agent discovery, and full backup/restore.
|
|
4
|
+
|
|
5
|
+
## Quick Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx 3ns-cli auth login YOUR_API_KEY
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install globally:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g 3ns-cli
|
|
15
|
+
3ns auth login YOUR_API_KEY
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Get Your API Key
|
|
19
|
+
|
|
20
|
+
1. Go to https://3ns.domains and sign in
|
|
21
|
+
2. Open the Export menu > "Export to OpenClaw"
|
|
22
|
+
3. Click "Generate API Key"
|
|
23
|
+
4. Copy and use with `3ns auth login`
|
|
24
|
+
|
|
25
|
+
## Authentication
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
3ns auth login <key> # Store API key
|
|
29
|
+
3ns auth login <key> --base-url URL # Custom API endpoint
|
|
30
|
+
3ns auth whoami # Check identity
|
|
31
|
+
3ns auth logout # Remove credentials
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Links (Linktree-Style Page)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
3ns links list [--json]
|
|
38
|
+
3ns links add --url URL --title "Title" [--platform twitter] [--username handle] [--icon URL] [--description "text"] [--order N] [--active true|false]
|
|
39
|
+
3ns links update LINK_ID [--url URL] [--title "New"] [--order N] [--active false]
|
|
40
|
+
3ns links remove LINK_ID
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Platforms: `twitter`, `instagram`, `youtube`, `github`, `linkedin`, `tiktok`, `custom`.
|
|
44
|
+
|
|
45
|
+
## Website Skins
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
3ns skins get [--json]
|
|
49
|
+
3ns skins update [options]
|
|
50
|
+
3ns skins upload-bg FILE [--target both|desktop]
|
|
51
|
+
3ns skins presets [--json]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Update options:** `--theme`, `--bg-color`, `--bg-image`, `--bg-image-desktop`, `--video`, `--font-color`, `--font-family`, `--button-color`, `--button-font-color`, `--button-border`, `--button-bg`, `--hover-color`, `--chat-bubble-color`, `--user-bubble-color`, `--chat-bubble-font`, `--user-bubble-font`.
|
|
55
|
+
|
|
56
|
+
Upload accepts: jpg, png, gif, webp (max 10 MB).
|
|
57
|
+
|
|
58
|
+
## Agent Config (Instruction Files)
|
|
59
|
+
|
|
60
|
+
These Markdown files define your agent's personality, knowledge, capabilities, and rules.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
3ns config folders [--json]
|
|
64
|
+
3ns config read DOC_ID [--json]
|
|
65
|
+
3ns config write DOC_ID --file ./instructions.md
|
|
66
|
+
3ns config write DOC_ID --content "# New content"
|
|
67
|
+
3ns config ensure FOLDER_ID --name capabilities.md --content "# Skills"
|
|
68
|
+
3ns config ensure FOLDER_ID --name personality.md --file ./personality.md
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Available AI Models
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
3ns models # List all 21 available models
|
|
75
|
+
3ns models --provider openai # Filter by provider (openai, google, anthropic, xai)
|
|
76
|
+
3ns models --json # Machine-readable output
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Chat History
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
3ns chats list [--json]
|
|
83
|
+
3ns chats history CHAT_ID [--json]
|
|
84
|
+
3ns chats send --folder FOLDER_ID "message" [--agent-type NORM|AMPS|CUST]
|
|
85
|
+
3ns chats send --folder FOLDER_ID "message" --model openai/gpt-5.2
|
|
86
|
+
3ns chats delete CHAT_ID
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Use `--model` to override the default AI model for a single message. Run `3ns models` to see valid names. Ollama models: `ollamadynamic/MODEL_NAME`.
|
|
90
|
+
|
|
91
|
+
## File Management
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
3ns files list [--json]
|
|
95
|
+
3ns files upload FILE --folder FOLDER_ID [--name "custom-name.pdf"] [--type mime/type]
|
|
96
|
+
3ns files download FILE_ID -o ./local-file.pdf
|
|
97
|
+
3ns files delete FILE_ID
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Max upload: 10 MB. Filenames are sanitized automatically.
|
|
101
|
+
|
|
102
|
+
## Agent Discovery & A2A Communication
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
3ns agents search "query" [--json]
|
|
106
|
+
3ns agents card SPACE_ID [--json]
|
|
107
|
+
3ns agents chat SPACE_ID "message"
|
|
108
|
+
3ns agents list [--json]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Export / Import (Full Backup)
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
3ns export -o backup.json
|
|
115
|
+
3ns export --no-chats -o config-only.json
|
|
116
|
+
3ns export --no-files -o lightweight.json
|
|
117
|
+
3ns import backup.json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Setup Prompt
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
3ns openclaw setup-prompt # Formatted output
|
|
124
|
+
3ns openclaw setup-prompt --raw # Raw text for piping to clipboard
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## JSON Output
|
|
128
|
+
|
|
129
|
+
All list commands support `--json` for machine-readable output:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
3ns links list --json
|
|
133
|
+
3ns agents search "finance" --json
|
|
134
|
+
3ns skins get --json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## API Base URL
|
|
138
|
+
|
|
139
|
+
Default: `https://us-central1-prod3ns.cloudfunctions.net/openclaw/openclaw`
|
|
140
|
+
|
|
141
|
+
Override: `3ns auth login <key> --base-url URL` or set `THREENS_API_URL` env var.
|
|
142
|
+
|
|
143
|
+
## Security
|
|
144
|
+
|
|
145
|
+
- Per-user API keys are SHA-256 hashed. Plaintext shown once only.
|
|
146
|
+
- User isolation: your key can only access your data.
|
|
147
|
+
- Folder ownership is verified on all document and file operations.
|
|
148
|
+
- Uploads are capped at 10 MB, image types validated, filenames sanitized.
|
|
149
|
+
|
|
150
|
+
## Links
|
|
151
|
+
|
|
152
|
+
- Website: https://3ns.domains
|
|
153
|
+
- FAQ: https://3ns.domains/faq
|
|
154
|
+
- GitHub: https://github.com/AshleyTuring/3ns-cli
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Config {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function loadConfig(): Config | null;
|
|
6
|
+
export declare function saveConfig(config: Config): void;
|
|
7
|
+
export declare function getApiKey(): string;
|
|
8
|
+
export declare function getBaseUrl(): string;
|
|
9
|
+
export declare function api<T = any>(method: string, endpoint: string, body?: any): Promise<{
|
|
10
|
+
status: number;
|
|
11
|
+
data: T;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function printJson(data: any): void;
|
|
14
|
+
export declare function printTable(rows: Record<string, any>[], columns?: string[]): void;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=apiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../src/apiClient.ts"],"names":[],"mappings":"AASA,UAAU,MAAM;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAQ1C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG/C;AAED,wBAAgB,SAAS,IAAI,MAAM,CAOlC;AAED,wBAAgB,UAAU,IAAI,MAAM,CAGnC;AAED,wBAAsB,GAAG,CAAC,CAAC,GAAG,GAAG,EAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAwBtC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAEzC;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAgBhF"}
|