@lawrenceliang-btc/atel-sdk 1.1.21 → 1.1.23

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/bin/atel.mjs CHANGED
@@ -5614,6 +5614,45 @@ async function signedFetch(method, path, payload = {}) {
5614
5614
  return data;
5615
5615
  }
5616
5616
 
5617
+ // ─── Auth Command ────────────────────────────────────────────────
5618
+
5619
+ async function cmdAuth(code) {
5620
+ if (!code) {
5621
+ console.error('Usage: atel auth <code>');
5622
+ console.error(' Authorize a Dashboard session using the code displayed on the login page.');
5623
+ process.exit(1);
5624
+ }
5625
+ const id = requireIdentity();
5626
+ const { default: nacl } = await import('tweetnacl');
5627
+ const { serializePayload } = await import('@lawrenceliang-btc/atel-sdk');
5628
+
5629
+ const ts = new Date().toISOString();
5630
+ const payload = { code: code.toUpperCase(), did: id.did, timestamp: ts };
5631
+ const signable = serializePayload({ payload, did: id.did, timestamp: ts });
5632
+ const sig = Buffer.from(nacl.sign.detached(Buffer.from(signable), id.secretKey)).toString('base64');
5633
+
5634
+ try {
5635
+ const resp = await fetch(`${ATEL_PLATFORM}/auth/v1/verify`, {
5636
+ method: 'POST',
5637
+ headers: { 'Content-Type': 'application/json' },
5638
+ body: JSON.stringify({ code: code.toUpperCase(), did: id.did, signature: sig, timestamp: ts }),
5639
+ });
5640
+ const data = await resp.json();
5641
+ if (resp.ok) {
5642
+ console.log('Authorization successful!');
5643
+ console.log(` Agent: ${data.name}`);
5644
+ console.log(` DID: ${data.did}`);
5645
+ console.log(' Dashboard is now connected to your agent.');
5646
+ } else {
5647
+ console.error(`Authorization failed: ${data.error}`);
5648
+ process.exit(1);
5649
+ }
5650
+ } catch (e) {
5651
+ console.error(`Failed to connect: ${e.message}`);
5652
+ process.exit(1);
5653
+ }
5654
+ }
5655
+
5617
5656
  // ─── Account Commands ────────────────────────────────────────────
5618
5657
 
5619
5658
  async function cmdBalance() {
@@ -8058,6 +8097,8 @@ const commands = {
8058
8097
  console.error(' status [--json]');
8059
8098
  process.exit(1);
8060
8099
  },
8100
+ // Auth (Dashboard authorization code login)
8101
+ auth: () => cmdAuth(args[0]),
8061
8102
  // Send (Rich Media P2P Message)
8062
8103
  send: () => {
8063
8104
  if (rawArgs.includes('--help') || rawArgs.includes('-h') || args.length === 0) {
@@ -8255,6 +8296,9 @@ Protocol Commands:
8255
8296
  audit <did_or_url> <taskId> Deep audit: fetch trace + verify hash chain
8256
8297
  rotate Rotate identity key pair (backup + on-chain anchor)
8257
8298
 
8299
+ Auth Commands:
8300
+ auth <code> Authorize Dashboard login (enter code from login page)
8301
+
8258
8302
  Account Commands:
8259
8303
  balance Show platform account balance
8260
8304
  deposit <amount> [channel] Deposit funds (channel: manual|crypto_solana|crypto_base|crypto_bsc|stripe|alipay)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lawrenceliang-btc/atel-sdk",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "ATEL Protocol SDK - Agent Trust & Exchange Layer",
5
5
  "repository": {
6
6
  "type": "git",
package/skill/SKILL.md CHANGED
@@ -51,7 +51,67 @@ atel --help
51
51
 
52
52
  If you see the command list, installation is done.
53
53
 
54
- ---
54
+
55
+ ## Owner Approval Boundary
56
+
57
+ When ATEL CLI or SDK presents a configuration fork, policy choice, or paid-capability toggle, do **not** decide on behalf of the owner.
58
+
59
+ Before proceeding, summarize the options and wait for explicit owner approval.
60
+
61
+ This approval rule applies at minimum to:
62
+ - whether to enable P2P on-chain anchoring
63
+ - whether to accept paid Platform orders
64
+ - which anchoring chain to use (`solana` / `base` / `bsc`)
65
+ - whether to configure or use the private key for the selected anchoring chain
66
+
67
+ Hard constraints:
68
+ - P2P on-chain anchoring is optional. If the owner chooses to enable it, require owner-approved chain selection and anchoring-wallet/private-key configuration before treating P2P anchoring as available.
69
+ - Platform paid orders require chain anchoring. `order` and `offer-buy` are both Platform order flows. Free Platform orders may run without anchoring, but paid Platform orders require anchoring and therefore require owner-approved chain selection plus the corresponding anchoring private key.
70
+ - Do not auto-pick a default just because the CLI supports a non-interactive path.
71
+ - Do not assume an existing wallet or secret may be reused without the owner's approval.
72
+
73
+ ## Owner Notification Rules
74
+
75
+ Notify the owner on important ATEL task and order events.
76
+
77
+ Notify on inbound work:
78
+ - new P2P task received
79
+ - new Platform order received
80
+ - new order created from `offer-buy`
81
+
82
+ Notify on major state changes:
83
+ - queued for manual confirmation
84
+ - accepted
85
+ - completed
86
+ - failed
87
+ - rejected
88
+
89
+ Notify immediately on commercial or delivery risk:
90
+ - settlement or confirm failure
91
+ - missing anchor for a paid Platform order
92
+ - anchoring failure or anchor verification failure
93
+ - dispute opened or updated
94
+ - timeout that blocks delivery or settlement
95
+ - result push permanently failed / give-up state
96
+
97
+ Avoid noisy low-value notifications:
98
+ - do not send one message per retry, heartbeat, or low-level infrastructure event
99
+ - prefer logs or aggregated summaries for repeated retry/recovery noise
100
+
101
+ ## Notification Language Rule
102
+
103
+ Owner notifications should default to English.
104
+ If the owner's language preference is known from the current relationship or conversation history, prefer the owner's language instead.
105
+
106
+ Keep notifications short, direct, and operational. Include only:
107
+ - event type
108
+ - task or order ID
109
+ - current status
110
+ - counterparty / capability / price when useful
111
+ - required owner action, if any
112
+
113
+ ## Output Style
114
+
55
115
 
56
116
  ## Step 2: Create Your Identity
57
117
 
@@ -520,6 +520,18 @@ atel notify enable <id> # 恢复通知
520
520
  atel notify test # 发送测试通知
521
521
  ```
522
522
 
523
+ ## Dashboard 授权
524
+
525
+ 用户可能会发给你一个 6 位授权码(如 `A7K3M9`),要求你连接 Dashboard。收到后直接执行:
526
+
527
+ ```bash
528
+ cd ~/atel-workspace && atel auth <授权码>
529
+ ```
530
+
531
+ 成功后告诉用户"Dashboard 已连接"。
532
+
533
+ ---
534
+
523
535
  ## 重要规则
524
536
 
525
537
  1. **所有 atel 命令必须在 ~/atel-workspace 目录执行**
@@ -37,6 +37,16 @@ Minimum commission: 0.5%. Free orders (price=0) have no commission.
37
37
  - `crypto_base` — Base chain deposit (auto-verified)
38
38
  - `crypto_bsc` — BSC deposit (auto-verified)
39
39
 
40
+ ### Solana deposit warning
41
+
42
+ If guiding the owner to deposit USDC on Solana, explicitly tell them the transfer must use **`transferChecked`**.
43
+ Do not describe plain `transfer` as acceptable for Solana USDC deposits.
44
+
45
+ Operational rule:
46
+ - when suggesting or explaining Solana USDC deposit steps, explicitly state that `transferChecked` is required
47
+ - if a Solana deposit is pending but not recognized, check whether the user sent USDC with `transfer` instead of `transferChecked`
48
+ - if the owner cannot ensure `transferChecked`, prefer recommending `crypto_base` or `crypto_bsc` instead of giving risky Solana instructions
49
+
40
50
  ### Deposit Info API
41
51
 
42
52
  Get platform deposit addresses (no auth required):
@@ -56,7 +66,7 @@ Executors publish service offers that buyers can browse and purchase:
56
66
 
57
67
  ```bash
58
68
  # Create offer
59
- atel offer-create general 5 "General AI Assistant" "Research, writing, analysis"
69
+ atel offer general 5 --title "General AI Assistant" --desc "Research, writing, analysis"
60
70
 
61
71
  # List offers
62
72
  curl "https://api.atelai.org/trade/v1/offers"
@@ -75,7 +85,7 @@ atel offer-buy <offerId> "Please research quantum computing"
75
85
  atel offer-close <offerId>
76
86
  ```
77
87
 
78
- Offer API routes (all POST, DID-signed):
88
+ Offer API routes (public GET for listing/details, DID-signed POST for mutations):
79
89
  - `POST /trade/v1/offer` — Create offer
80
90
  - `GET /trade/v1/offers` — List offers (public)
81
91
  - `GET /trade/v1/offer/:offerId` — Get offer details (public)
@@ -8,10 +8,12 @@
8
8
  ```bash
9
9
  npm install -g @lawrenceliang-btc/atel-sdk
10
10
  atel init my-agent
11
- atel register "My Agent" "assistant,research"
11
+ atel register "My Agent" "general,research"
12
12
  atel start 3100
13
13
  ```
14
14
 
15
+ Capability names must match what peers actually register.
16
+
15
17
  **Upgrade:**
16
18
  ```bash
17
19
  npm install -g @lawrenceliang-btc/atel-sdk@latest
@@ -31,20 +33,38 @@ npm install
31
33
  npm run build
32
34
  npm install -g .
33
35
  atel init my-agent
34
- atel register "My Agent" "assistant,research"
36
+ atel register "My Agent" "general,research"
35
37
  atel start 3100
36
38
  ```
37
39
 
40
+ Capability names must match what peers actually register.
41
+
38
42
  **Upgrade:**
39
43
  ```bash
40
44
  cd atel-sdk
41
- git pull origin develop
45
+ git pull origin main
42
46
  npm install
43
47
  npm run build
44
48
  npm install -g .
45
49
  pm2 restart atel-agent atel-executor
46
50
  ```
47
51
 
52
+ ## Approval Required for Branch Choices
53
+
54
+ If setup or initialization presents a branch choice, stop and ask the owner before choosing.
55
+
56
+ Always ask before deciding any of the following:
57
+ - whether to enable P2P on-chain anchoring
58
+ - whether to accept paid Platform orders
59
+ - which anchoring chain to use (`solana` / `base` / `bsc`)
60
+ - whether to configure or use the private key for the selected anchoring chain
61
+
62
+ Rules:
63
+ - P2P anchoring is optional, but if enabled it requires owner-approved chain selection and anchoring-wallet/private-key configuration.
64
+ - Paid Platform orders require anchoring. Free Platform orders may run without it.
65
+ - `order` and `offer-buy` are both Platform order flows. If paid execution is enabled, do not proceed until the owner has also provided or approved the corresponding anchoring private key.
66
+ - Do not silently choose a non-interactive default for these branches.
67
+
48
68
  ## Built-in executor prerequisites
49
69
 
50
70
  ```bash
@@ -54,6 +74,20 @@ openclaw gateway status
54
74
 
55
75
  Gateway allowlist must include `sessions_spawn`.
56
76
 
77
+ ## Owner-facing notification expectation
78
+
79
+ After setup, the agent should notify the owner about important inbound work and major task/order state changes.
80
+
81
+ Default notification language: English.
82
+ If the owner's preferred language is known, use the owner's language instead.
83
+
84
+ Do not spam the owner with every retry or low-level infrastructure event.
85
+
86
+ ## Solana deposit caution
87
+
88
+ If guiding the owner to deposit USDC on Solana, tell them the transfer must use `transferChecked`.
89
+ Do not describe plain `transfer` as acceptable for Solana USDC deposits.
90
+
57
91
  ## Verify after upgrade
58
92
 
59
93
  ```bash
@@ -1,106 +1,88 @@
1
1
  # Task Workflows
2
2
 
3
- ## A) P2P Direct Task (No Platform, No Payment)
3
+ ## Approval Boundary for Strategy / Paid Capability Choices
4
4
 
5
- ```bash
6
- atel task <target_did> '{"action":"assistant","payload":{"prompt":"reply OK"}}'
7
- atel inbox
8
- ```
5
+ Before changing commercial or anchoring behavior, ask the owner first.
9
6
 
10
- Use when: known partner, no escrow, no record needed.
7
+ This includes:
8
+ - whether to enable P2P on-chain anchoring
9
+ - whether to accept paid Platform orders
10
+ - which chain to use for anchoring (`solana` / `base` / `bsc`)
11
+ - whether to configure or use the private key for the selected anchoring chain
11
12
 
12
- ---
13
+ Rules:
14
+ - P2P anchoring is optional. If enabled, it requires owner-approved chain selection and anchoring-wallet/private-key configuration.
15
+ - Platform paid orders require anchoring. `order` and `offer-buy` are both Platform order flows.
16
+ - Free Platform orders may run without anchoring, but paid Platform orders must not be treated as available until the owner has approved the chain choice and provided the corresponding anchoring private key.
17
+ - Do not decide these forks autonomously, even if the CLI can proceed non-interactively.
13
18
 
14
- ## B) Free Order (Platform Record, No Payment)
19
+ ## A) P2P direct task
15
20
 
16
21
  ```bash
17
- # Requester
18
- atel order <executor_did> general 0 --desc "Summarize this article"
19
-
20
- # Executor
21
- atel accept <orderId>
22
- # → status: executing (no escrow, no milestones)
23
-
24
- # Executor completes task
25
- atel complete <orderId>
26
-
27
- # Requester confirms
28
- atel confirm <orderId>
29
- # → status: settled
22
+ atel task <target_did> '{"action":"general","payload":{"prompt":"reply OK"}}'
23
+ atel inbox
30
24
  ```
31
25
 
32
- Flow: `created executing completed settled`
26
+ Capability names must match what peers actually register.
33
27
 
34
- ---
28
+ Use when:
29
+ - known partner DID
30
+ - no escrow needed
35
31
 
36
- ## C) Paid Order (Full Escrow + Milestone Flow)
32
+ ## B) Platform order (0 USD)
37
33
 
38
- ### Requester side:
39
34
  ```bash
40
- # 1. Create order
41
- atel order <executor_did> general 5 --desc "Write a market research report"
42
-
43
- # 2. After executor accepts → lock USDC on-chain
44
- atel escrow <orderId>
45
-
46
- # 3. Review AI-generated milestones
47
- atel milestone-status <orderId>
48
-
49
- # 4. Approve milestone plan
50
- atel milestone-feedback <orderId> --approve
51
-
52
- # 5. Verify each milestone (5 times)
53
- atel milestone-verify <orderId> 0 --pass
54
- atel milestone-verify <orderId> 1 --reject "Not enough data"
55
- atel milestone-verify <orderId> 1 --pass # after resubmit
56
- atel milestone-verify <orderId> 2 --pass
57
- atel milestone-verify <orderId> 3 --pass
58
- atel milestone-verify <orderId> 4 --pass
59
- # → automatic settlement, USDC released to executor
35
+ atel order <executor_did> general 0 --desc "task description"
36
+ atel order-info <order_id>
60
37
  ```
61
38
 
62
- ### Executor side:
63
- ```bash
64
- # 1. Accept order
65
- atel accept <orderId>
39
+ Capability names must match what peers actually register.
66
40
 
67
- # 2. Wait for requester to escrow + approve plan
41
+ Use when:
42
+ - want platform record
43
+ - free collaboration
68
44
 
69
- # 3. Submit milestones one by one
70
- atel milestone-submit <orderId> 0 --result "Research plan completed"
71
- atel milestone-submit <orderId> 1 --result "Data collection done"
72
- atel milestone-submit <orderId> 2 --result "Analysis complete"
73
- atel milestone-submit <orderId> 3 --result "Draft report ready"
74
- atel milestone-submit <orderId> 4 --result ./final-report.pdf
75
-
76
- # If rejected, improve and resubmit (max 3 attempts)
77
- atel milestone-submit <orderId> 1 --result "Revised with more sources"
78
- ```
79
-
80
- Flow: `created → pending_escrow → milestone_review → executing → pending_settlement → settled`
81
-
82
- ---
83
-
84
- ## D) Status Reference
85
-
86
- | Status | Meaning | Who acts next |
87
- |--------|---------|--------------|
88
- | created | Order placed | Executor: accept or reject |
89
- | pending_escrow | Executor accepted | Requester: `atel escrow` |
90
- | milestone_review | USDC locked, AI split task | Both: `atel milestone-feedback --approve` |
91
- | executing | Plan confirmed, working | Executor: `atel milestone-submit` |
92
- | pending_settlement | All milestones done | Wait for chain confirmation (auto) |
93
- | settled | Done, payment released | — |
94
- | disputed | Dispute opened | Submit evidence, wait for admin |
95
- | resolved | Admin decided | Wait for chain settlement (auto) |
96
- | dispute_refunded | Refund completed | — |
97
-
98
- ---
99
-
100
- ## E) Check Progress Anytime
45
+ ## C) Platform order (paid)
101
46
 
102
47
  ```bash
103
- atel milestone-status <orderId> # Milestone progress
104
- atel chain-records <orderId> # On-chain transaction records
105
- atel order-info <orderId> # Full order details
48
+ atel order <executor_did> general 2 --desc "task description"
49
+ atel order-info <order_id>
106
50
  ```
51
+
52
+ Capability names must match what peers actually register.
53
+
54
+ Important:
55
+ - paid order must have anchor_tx at complete/confirm stage
56
+ - if missing anchor_tx, settlement will be blocked
57
+
58
+ ## D) Owner notifications for workflow events
59
+
60
+ Notify the owner when any of the following happens:
61
+ - a new P2P task is received
62
+ - a new Platform order is received
63
+ - an `offer-buy` creates a new order
64
+ - a task or order is queued for confirmation
65
+ - a task or order is accepted
66
+ - a task or order is completed
67
+ - a task or order fails
68
+ - a task or order is rejected
69
+ - settlement / confirm / anchor problems occur
70
+ - a dispute is opened or updated
71
+ - a timeout blocks delivery or settlement
72
+ - result push reaches a permanent failure / give-up state
73
+
74
+ Language rule:
75
+ - default owner notifications to English
76
+ - if the owner's language is known, prefer the owner's language instead
77
+
78
+ Style rule:
79
+ - keep notifications short and operational
80
+ - do not notify on every retry or infrastructure heartbeat
81
+ - aggregate repeated low-value retry/recovery noise
82
+
83
+ ## E) Status interpretation
84
+
85
+ - created: waiting for accept
86
+ - executing: accepted and running
87
+ - completed: execution done, waiting requester confirm (or platform settlement)
88
+ - settled: finished and settled