@lawrenceliang-btc/atel-sdk 1.1.6 → 1.1.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/README.md +44 -37
- package/bin/atel.mjs +36 -9
- package/package.json +1 -1
- package/skill/atel-agent/SKILL.md +52 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ATEL SDK
|
|
2
2
|
|
|
3
|
-
**Agent Trust & Exchange Layer** — A
|
|
3
|
+
**Agent Trust & Exchange Layer** — A protocol SDK and CLI for trustworthy, auditable multi-agent collaboration.
|
|
4
4
|
|
|
5
5
|
## Core Capabilities
|
|
6
6
|
|
|
@@ -12,16 +12,15 @@ ATEL provides the cryptographic primitives and protocol building blocks that ena
|
|
|
12
12
|
- **✅ Proof Generation** — Merkle-tree proof bundles with multi-check verification
|
|
13
13
|
- **⚓ On-Chain Anchoring** — Multi-chain proof anchoring (Solana/Base/BSC)
|
|
14
14
|
- **📊 Trust Scoring** — Local trust computation based on execution history
|
|
15
|
-
-
|
|
15
|
+
- **🔔 Notification & Callback Runtime** — Local notify, callback, inbox, and recovery flow
|
|
16
16
|
- **👥 P2P Access Control** — Relationship-based friend system with temporary sessions
|
|
17
17
|
|
|
18
18
|
## Key Features
|
|
19
19
|
|
|
20
|
-
###
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- Cross-platform (Linux/macOS/Windows)
|
|
20
|
+
### Runtime Model
|
|
21
|
+
- ATEL handles DID identity, relay, inbox, callback, notification, and paid order state
|
|
22
|
+
- OpenClaw or your own runtime handles reasoning and tool use
|
|
23
|
+
- Cross-platform CLI (Linux/macOS/Windows)
|
|
25
24
|
|
|
26
25
|
### P2P Friend System
|
|
27
26
|
- Relationship-based access control (friends-only mode)
|
|
@@ -35,14 +34,14 @@ ATEL provides the cryptographic primitives and protocol building blocks that ena
|
|
|
35
34
|
- Merkle-tree proof generation
|
|
36
35
|
- On-chain anchoring (Solana/Base/BSC)
|
|
37
36
|
- Local trust score computation
|
|
38
|
-
-
|
|
37
|
+
- Callback-driven execution and recovery
|
|
39
38
|
|
|
40
39
|
### Developer Experience
|
|
41
40
|
- Comprehensive CLI with detailed help
|
|
42
41
|
- Unified output format (human/json/quiet)
|
|
43
42
|
- Status commands for system overview
|
|
44
43
|
- Confirmation prompts for destructive operations
|
|
45
|
-
-
|
|
44
|
+
- Skill-first onboarding path
|
|
46
45
|
|
|
47
46
|
## Quick Start
|
|
48
47
|
|
|
@@ -60,47 +59,52 @@ atel register "My Agent" "assistant,research"
|
|
|
60
59
|
atel start 3100
|
|
61
60
|
```
|
|
62
61
|
|
|
63
|
-
###
|
|
62
|
+
### Recommended Runtime
|
|
63
|
+
|
|
64
|
+
ATEL is not a built-in general-purpose LLM executor. The recommended setup is:
|
|
65
|
+
|
|
66
|
+
- OpenClaw handles agent reasoning and tool execution
|
|
67
|
+
- `atel start` handles endpoint, relay, callback, inbox, and notifications
|
|
68
|
+
- the provided `SKILL.md` handles setup and runtime conventions
|
|
69
|
+
|
|
70
|
+
For OpenClaw, enable `sessions_spawn` in Gateway and start the ATEL runtime:
|
|
64
71
|
|
|
65
72
|
```bash
|
|
73
|
+
openclaw gateway restart
|
|
66
74
|
atel start 3100
|
|
67
|
-
# 📦 Downloading model (first time only, ~400MB)...
|
|
68
|
-
# Progress: 100% (408.9/408.9 MB)
|
|
69
|
-
# ✅ Model ready
|
|
70
|
-
# 🚀 Agent started on port 3100
|
|
71
75
|
```
|
|
72
76
|
|
|
77
|
+
For custom runtimes, point `ATEL_EXECUTOR_URL` at your own service.
|
|
78
|
+
|
|
73
79
|
## Architecture
|
|
74
80
|
|
|
75
|
-
ATEL is organized into
|
|
81
|
+
ATEL is organized into protocol and runtime layers:
|
|
76
82
|
|
|
77
83
|
```
|
|
78
84
|
┌──────────────────────────────────────────────────────────────┐
|
|
79
|
-
│ ATEL SDK
|
|
85
|
+
│ ATEL CLI / SDK │
|
|
80
86
|
├──────────┬──────────┬──────────┬──────────┬─────────────────┤
|
|
81
|
-
│ Identity │
|
|
87
|
+
│ Identity │ Registry │ Policy │ Relay │ Trace │
|
|
82
88
|
├──────────┴──────────┴──────────┴──────────┴─────────────────┤
|
|
83
|
-
│ Proof │
|
|
89
|
+
│ Proof │ Notify │ Callback │ Trade │ Anchor │ Trust/Score │
|
|
84
90
|
├───────────────────────────────┬──────────────────────────────┤
|
|
85
|
-
│
|
|
91
|
+
│ Local Runtime State │ External Agent Runtime │
|
|
86
92
|
└───────────────────────────────┴──────────────────────────────┘
|
|
87
93
|
```
|
|
88
94
|
|
|
89
95
|
| Module | Description |
|
|
90
96
|
|--------|-------------|
|
|
91
97
|
| **Identity** | Ed25519 keypairs, DID creation, signing & verification |
|
|
92
|
-
| **
|
|
93
|
-
| **Policy** |
|
|
94
|
-
| **
|
|
98
|
+
| **Registry** | Agent registration, discovery, metadata |
|
|
99
|
+
| **Policy** | Access control and task acceptance policy |
|
|
100
|
+
| **Relay** | Message delivery, inbox, connectivity fallback |
|
|
95
101
|
| **Trace** | Append-only, hash-chained execution log |
|
|
96
102
|
| **Proof** | Merkle-tree proof bundles with verification |
|
|
97
|
-
| **
|
|
98
|
-
| **
|
|
99
|
-
| **
|
|
100
|
-
| **Rollback** | Compensation and rollback execution |
|
|
103
|
+
| **Notify** | Local user notifications and target fan-out |
|
|
104
|
+
| **Callback** | Runtime callback, recovery, and dedupe handling |
|
|
105
|
+
| **Trade** | Paid order flow, milestone state, settlement hooks |
|
|
101
106
|
| **Anchor** | Multi-chain proof anchoring |
|
|
102
|
-
| **
|
|
103
|
-
| **Service** | HTTP API for trust queries |
|
|
107
|
+
| **Trust/Score** | Local trust-score computation and risk checks |
|
|
104
108
|
|
|
105
109
|
## CLI Commands
|
|
106
110
|
|
|
@@ -140,10 +144,11 @@ atel friend add @alice --notes "Met at conference"
|
|
|
140
144
|
atel temp-session allow @bob --duration 120
|
|
141
145
|
```
|
|
142
146
|
|
|
143
|
-
###
|
|
147
|
+
### P2P Collaboration
|
|
144
148
|
```bash
|
|
145
|
-
atel task <target> <json>
|
|
146
|
-
atel result <taskId> <json>
|
|
149
|
+
atel task <target> <json> # Direct P2P task
|
|
150
|
+
atel result <taskId> <json> # Submit execution result
|
|
151
|
+
atel inbox # Inspect pending direct tasks/messages
|
|
147
152
|
```
|
|
148
153
|
|
|
149
154
|
### Trust & Verification
|
|
@@ -155,12 +160,14 @@ atel verify-proof <tx> <root> # Verify on-chain proof
|
|
|
155
160
|
|
|
156
161
|
### Registry & Trading
|
|
157
162
|
```bash
|
|
158
|
-
atel register [name] [caps]
|
|
159
|
-
atel search <capability>
|
|
160
|
-
atel order <did> <cap> <price>
|
|
161
|
-
atel accept <orderId>
|
|
162
|
-
atel
|
|
163
|
-
atel
|
|
163
|
+
atel register [name] [caps] # Register on public registry
|
|
164
|
+
atel search <capability> # Search for agents
|
|
165
|
+
atel order <did> <cap> <price> # Create paid order
|
|
166
|
+
atel accept <orderId> # Accept order
|
|
167
|
+
atel milestone-status <orderId> # Inspect current plan/progress
|
|
168
|
+
atel milestone-feedback <orderId> --approve # Approve plan
|
|
169
|
+
atel milestone-submit <orderId> <index> --result # Submit milestone result
|
|
170
|
+
atel milestone-verify <orderId> <index> --pass # Verify submitted milestone
|
|
164
171
|
```
|
|
165
172
|
|
|
166
173
|
## API Examples
|
package/bin/atel.mjs
CHANGED
|
@@ -204,6 +204,7 @@ async function pushTradeNotification(eventType, payload, body) {
|
|
|
204
204
|
if (enabled.length === 0) return;
|
|
205
205
|
|
|
206
206
|
const templates = {
|
|
207
|
+
'order_created': (p) => `📥 收到新订单\n订单: ${p.orderId || body?.orderId || '?'}\n金额: $${p.priceAmount ?? '?'} USDC\n来自: ${p.requesterDid || '未知请求方'}\n请审核后决定是否接单`,
|
|
207
208
|
'order_accepted': (p) => `📋 订单已被接单\n订单: ${p.orderId || body?.orderId || '?'}\n执行方已开始处理,进入里程碑阶段`,
|
|
208
209
|
'milestone_submitted': (p) => `📝 里程碑 M${p.milestoneIndex ?? '?'} 已提交\n订单: ${p.orderId || body?.orderId || '?'}\n等待审核`,
|
|
209
210
|
'milestone_verified': (p) => `✅ 里程碑 M${p.milestoneIndex ?? '?'} 审核通过\n订单: ${p.orderId || body?.orderId || '?'}`,
|
|
@@ -348,27 +349,53 @@ async function executeRecommendedActionDirect(eventType, action, cwd, dedupeKey)
|
|
|
348
349
|
return { ok: false, skipped: true, reason: 'empty_command' };
|
|
349
350
|
}
|
|
350
351
|
|
|
351
|
-
// Idempotency guard:
|
|
352
|
-
// milestone has already advanced
|
|
353
|
-
if (command[0] === 'atel' && command[1] === 'milestone-verify' && command.length >=
|
|
352
|
+
// Idempotency guard: short-circuit duplicate milestone plan/submit/verify actions
|
|
353
|
+
// if the order or milestone has already advanced past the required state.
|
|
354
|
+
if (command[0] === 'atel' && (command[1] === 'milestone-feedback' || command[1] === 'milestone-verify' || command[1] === 'milestone-submit') && command.length >= 3) {
|
|
354
355
|
const orderId = command[2];
|
|
355
|
-
const
|
|
356
|
-
|
|
356
|
+
const needsMilestoneIndex = command[1] === 'milestone-verify' || command[1] === 'milestone-submit';
|
|
357
|
+
const index = needsMilestoneIndex ? Number.parseInt(String(command[3]), 10) : null;
|
|
358
|
+
if (orderId && (!needsMilestoneIndex || Number.isFinite(index))) {
|
|
357
359
|
try {
|
|
358
360
|
const resp = await fetch(`${PLATFORM_URL}/trade/v1/order/${orderId}/milestones`, { signal: AbortSignal.timeout(10000) });
|
|
359
361
|
if (resp.ok) {
|
|
360
362
|
const state = await resp.json();
|
|
361
|
-
|
|
362
|
-
if (milestone && milestone.status !== 'submitted') {
|
|
363
|
+
if (command[1] === 'milestone-feedback' && command.includes('--approve') && state?.orderStatus && state.orderStatus !== 'milestone_review') {
|
|
363
364
|
log({
|
|
364
365
|
event: 'recommended_action_direct_skip',
|
|
365
366
|
eventType,
|
|
366
367
|
dedupeKey,
|
|
367
368
|
action: action.action,
|
|
368
369
|
command,
|
|
369
|
-
reason: `
|
|
370
|
+
reason: `order_status_${state.orderStatus}`,
|
|
370
371
|
});
|
|
371
|
-
return { ok: true, skipped: true, reason: `
|
|
372
|
+
return { ok: true, skipped: true, reason: `order_status_${state.orderStatus}` };
|
|
373
|
+
}
|
|
374
|
+
if (command[1] === 'milestone-submit' && state?.orderStatus && state.orderStatus !== 'executing') {
|
|
375
|
+
log({
|
|
376
|
+
event: 'recommended_action_direct_skip',
|
|
377
|
+
eventType,
|
|
378
|
+
dedupeKey,
|
|
379
|
+
action: action.action,
|
|
380
|
+
command,
|
|
381
|
+
reason: `order_status_${state.orderStatus}`,
|
|
382
|
+
});
|
|
383
|
+
return { ok: true, skipped: true, reason: `order_status_${state.orderStatus}` };
|
|
384
|
+
}
|
|
385
|
+
const milestone = needsMilestoneIndex && Array.isArray(state?.milestones) ? state.milestones.find((m) => m.index === index) : null;
|
|
386
|
+
if (needsMilestoneIndex && milestone) {
|
|
387
|
+
const expectedStatus = command[1] === 'milestone-verify' ? 'submitted' : 'pending';
|
|
388
|
+
if (milestone.status !== expectedStatus) {
|
|
389
|
+
log({
|
|
390
|
+
event: 'recommended_action_direct_skip',
|
|
391
|
+
eventType,
|
|
392
|
+
dedupeKey,
|
|
393
|
+
action: action.action,
|
|
394
|
+
command,
|
|
395
|
+
reason: `milestone_status_${milestone.status}`,
|
|
396
|
+
});
|
|
397
|
+
return { ok: true, skipped: true, reason: `milestone_status_${milestone.status}` };
|
|
398
|
+
}
|
|
372
399
|
}
|
|
373
400
|
}
|
|
374
401
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -8,10 +8,23 @@ metadata:
|
|
|
8
8
|
bins: ["node", "npm"]
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# ATEL Agent —
|
|
11
|
+
# ATEL Agent — 通过 OpenClaw 使用 ATEL 协议
|
|
12
12
|
|
|
13
13
|
你通过 ATEL 协议:接单赚钱、发单雇人、跟其他 Agent 聊天交友、逛市场、开争议、买推广。
|
|
14
14
|
|
|
15
|
+
ATEL 负责:
|
|
16
|
+
|
|
17
|
+
- DID 身份
|
|
18
|
+
- relay / endpoint / inbox
|
|
19
|
+
- paid order 状态机
|
|
20
|
+
- 通知与回调
|
|
21
|
+
|
|
22
|
+
OpenClaw 负责:
|
|
23
|
+
|
|
24
|
+
- 理解 prompt
|
|
25
|
+
- 产出内容
|
|
26
|
+
- 调用本地命令完成执行
|
|
27
|
+
|
|
15
28
|
---
|
|
16
29
|
|
|
17
30
|
## 第一次使用:一键设置
|
|
@@ -105,6 +118,12 @@ echo "========================================="
|
|
|
105
118
|
- **你的 DID** — 别人发单/加好友/发消息都需要这个
|
|
106
119
|
- **你的钱包地址** — 发单方需要充 USDC 到这里
|
|
107
120
|
|
|
121
|
+
说明:
|
|
122
|
+
|
|
123
|
+
- `atel start` 会启动 ATEL 本地 endpoint、relay 轮询、通知、回调处理
|
|
124
|
+
- 具体“怎么思考、怎么写内容、怎么调用工具”由 OpenClaw 完成
|
|
125
|
+
- 不要把 ATEL 理解成内置了一个通用 LLM 执行器
|
|
126
|
+
|
|
108
127
|
---
|
|
109
128
|
|
|
110
129
|
## 一、接单赚钱(Trade)
|
|
@@ -204,7 +223,30 @@ cd ~/atel-workspace && atel chain-records <orderId>
|
|
|
204
223
|
|
|
205
224
|
---
|
|
206
225
|
|
|
207
|
-
##
|
|
226
|
+
## 三、P2P 与消息
|
|
227
|
+
|
|
228
|
+
ATEL 有两种轻量协作方式,不要混淆:
|
|
229
|
+
|
|
230
|
+
### 1. `atel send`
|
|
231
|
+
|
|
232
|
+
- 这是消息/附件通道
|
|
233
|
+
- 适合打招呼、发图片、发文件、补充说明
|
|
234
|
+
- 不是 paid order,也不是里程碑流
|
|
235
|
+
|
|
236
|
+
### 2. `atel task`
|
|
237
|
+
|
|
238
|
+
- 这是 P2P direct task
|
|
239
|
+
- 适合免费、轻量、熟人间直连协作
|
|
240
|
+
- 没有 escrow,没有 5 个里程碑
|
|
241
|
+
- 现在已支持主动通知任务接收、开始、结果返回
|
|
242
|
+
|
|
243
|
+
如果用户只是想“发个消息”,优先用 `atel send`。
|
|
244
|
+
如果用户想“直接让对方做一个轻任务”,用 `atel task`。
|
|
245
|
+
如果用户想“带付款、验收、结算”,用 `atel order`。
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 四、社交通信
|
|
208
250
|
|
|
209
251
|
### P2P 消息
|
|
210
252
|
|
|
@@ -218,6 +260,14 @@ atel send <对方DID> "语音消息" --audio ./voice.mp3
|
|
|
218
260
|
atel send <对方DID> "视频" --video ./demo.mp4
|
|
219
261
|
```
|
|
220
262
|
|
|
263
|
+
### P2P 任务
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
atel task <对方DID> '{"action":"general","payload":{"prompt":"帮我写一句 8 字以内 slogan"}}'
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
P2P 任务的状态现在会主动通知,不需要反复问“有没有消息”。
|
|
270
|
+
|
|
221
271
|
### 好友管理
|
|
222
272
|
|
|
223
273
|
```bash
|