@lawrenceliang-btc/atel-sdk 1.1.35 → 1.1.37
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 +55 -30
- package/package.json +1 -1
- package/skill/references/executor.md +13 -13
- package/skill/references/quickstart.md +16 -7
- package/skill/references/workflows.md +20 -9
package/bin/atel.mjs
CHANGED
|
@@ -311,9 +311,15 @@ async function pushTradeNotification(eventType, payload, body) {
|
|
|
311
311
|
const enabled = (targets.targets || []).filter(t => t.enabled !== false);
|
|
312
312
|
if (enabled.length === 0) return;
|
|
313
313
|
|
|
314
|
+
const chainLabel = (p) => {
|
|
315
|
+
const c = p?.chain || body?.chain || '';
|
|
316
|
+
if (c === 'fast-coop') return ' (Fast)';
|
|
317
|
+
if (c === 'bsc') return ' (BSC)';
|
|
318
|
+
return '';
|
|
319
|
+
};
|
|
314
320
|
const templates = {
|
|
315
|
-
'order_created': (p) => `📥 收到新订单\n订单: ${p.orderId || body?.orderId || '?'}\n金额: $${p.priceAmount ?? '?'} USDC\n来自: ${p.requesterDid || '未知请求方'}\n请审核后决定是否接单`,
|
|
316
|
-
'order_accepted': (p) => `📋 订单已被接单\n订单: ${p.orderId || body?.orderId || '?'}\n执行方已开始处理,进入里程碑阶段`,
|
|
321
|
+
'order_created': (p) => `📥 收到新订单\n订单: ${p.orderId || body?.orderId || '?'}\n金额: $${p.priceAmount ?? '?'} USDC${chainLabel(p)}\n来自: ${p.requesterDid || '未知请求方'}\n请审核后决定是否接单`,
|
|
322
|
+
'order_accepted': (p) => `📋 订单已被接单\n订单: ${p.orderId || body?.orderId || '?'}${chainLabel(p)}\n执行方已开始处理,进入里程碑阶段`,
|
|
317
323
|
'milestone_submitted': (p) => {
|
|
318
324
|
const desc = p.milestoneDescription ? `\n目标: ${p.milestoneDescription}` : '';
|
|
319
325
|
const content = p.resultSummary ? `\n提交内容: ${String(p.resultSummary).substring(0, 200)}` : '';
|
|
@@ -330,7 +336,7 @@ async function pushTradeNotification(eventType, payload, body) {
|
|
|
330
336
|
return `❌ 里程碑 M${p.milestoneIndex ?? '?'} 被拒绝\n订单: ${p.orderId || body?.orderId || '?'}${desc}\n原因: ${p.rejectReason || '未说明'}`;
|
|
331
337
|
},
|
|
332
338
|
'order_settled': (p) => {
|
|
333
|
-
const amount = p.priceAmount ? `\n金额: $${p.priceAmount} USDC` : '';
|
|
339
|
+
const amount = p.priceAmount ? `\n金额: $${p.priceAmount} USDC${chainLabel(p)}` : '';
|
|
334
340
|
return `💰 订单已结算完成\n订单: ${p.orderId || body?.orderId || '?'}${amount}\nUSDC 已支付`;
|
|
335
341
|
},
|
|
336
342
|
};
|
|
@@ -1971,8 +1977,19 @@ async function promptInput(question) {
|
|
|
1971
1977
|
// ─── Anchor Configuration ────────────────────────────────────────
|
|
1972
1978
|
|
|
1973
1979
|
async function configureAnchor() {
|
|
1974
|
-
console.log('\n🔗 Configure On-Chain Anchoring\n');
|
|
1975
|
-
|
|
1980
|
+
console.log('\n🔗 Configure On-Chain Anchoring (legacy V1 mode)\n');
|
|
1981
|
+
console.log('⚠️ In V2 the ATEL Platform anchors on behalf of agents using its own');
|
|
1982
|
+
console.log(' executor wallets — you do NOT need this for paid orders.');
|
|
1983
|
+
console.log(' Your smart wallet addresses (derived from your DID) already receive');
|
|
1984
|
+
console.log(' USDC and the platform pays gas for you. Only continue if you are');
|
|
1985
|
+
console.log(' running a legacy V1 self-anchoring agent.');
|
|
1986
|
+
console.log('');
|
|
1987
|
+
const go = await promptYesNo('Continue anyway?');
|
|
1988
|
+
if (!go) {
|
|
1989
|
+
console.log('Aborted. Your identity is unchanged.');
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1976
1993
|
// 1. Select chain
|
|
1977
1994
|
const chain = await promptChoice(
|
|
1978
1995
|
'Select blockchain for anchoring:',
|
|
@@ -2033,37 +2050,45 @@ async function cmdInit(agentId) {
|
|
|
2033
2050
|
const identity = new AgentIdentity({ agent_id: name });
|
|
2034
2051
|
saveIdentity(identity);
|
|
2035
2052
|
savePolicy(DEFAULT_POLICY);
|
|
2036
|
-
|
|
2053
|
+
|
|
2037
2054
|
// Create default agent-context.md for built-in executor
|
|
2038
2055
|
const ctxFile = resolve(ATEL_DIR, 'agent-context.md');
|
|
2039
2056
|
if (!existsSync(ctxFile)) {
|
|
2040
2057
|
writeFileSync(ctxFile, `# Agent Context\n\nYou are an ATEL agent (${name}) processing tasks from other agents via the ATEL protocol.\n\n## Guidelines\n- Complete the task accurately and concisely\n- Return only the requested result, no extra commentary\n- If the task is unclear, do your best interpretation\n- Do not access private files or sensitive data\n- Do not make external network requests unless the task requires it\n`);
|
|
2041
2058
|
}
|
|
2042
|
-
|
|
2043
|
-
//
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
)
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2059
|
+
|
|
2060
|
+
// NOTE (2026-04-09): We intentionally do NOT prompt for an on-chain anchor
|
|
2061
|
+
// private key here any more. That prompt is a V1 leftover — in V2 the
|
|
2062
|
+
// Platform handles all on-chain anchoring on behalf of agents using its own
|
|
2063
|
+
// registered executor wallets, and the user's USDC lives in a smart wallet
|
|
2064
|
+
// (AA) whose address is derived from the ATEL identity key. Asking users to
|
|
2065
|
+
// paste a raw Base/BSC/Solana private key at install time is both
|
|
2066
|
+
// unnecessary and intimidating. If someone genuinely needs legacy
|
|
2067
|
+
// self-anchoring they can opt in later via `atel anchor config`.
|
|
2068
|
+
|
|
2069
|
+
// Derive the smart-wallet addresses from the identity so the user can see
|
|
2070
|
+
// where to top up USDC for paid orders.
|
|
2071
|
+
let smartWallet = null;
|
|
2072
|
+
try {
|
|
2073
|
+
const info = identity.toJSON?.() || {};
|
|
2074
|
+
smartWallet = info.smart_wallet || info.wallet || null;
|
|
2075
|
+
} catch { /* best-effort */ }
|
|
2076
|
+
|
|
2077
|
+
const output = {
|
|
2078
|
+
status: 'created',
|
|
2079
|
+
agent_id: identity.agent_id,
|
|
2080
|
+
did: identity.did,
|
|
2063
2081
|
policy: POLICY_FILE,
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2082
|
+
nextSteps: [
|
|
2083
|
+
'atel start — bring the agent online (network + auto-register)',
|
|
2084
|
+
`atel register ${name} "<capability1>,<capability2>" — advertise what you can do`,
|
|
2085
|
+
'atel info — show your DID, wallets, and policy',
|
|
2086
|
+
'atel balance — check USDC balance on Base/BSC smart wallets',
|
|
2087
|
+
],
|
|
2088
|
+
note: 'Paid orders work out of the box in V2 — no on-chain private key needed. The Platform anchors on your behalf using its own executor wallets. If you specifically need legacy self-anchoring, run: atel anchor config',
|
|
2089
|
+
};
|
|
2090
|
+
if (smartWallet) output.smartWallet = smartWallet;
|
|
2091
|
+
console.log(JSON.stringify(output, null, 2));
|
|
2067
2092
|
|
|
2068
2093
|
// Auto-install SKILL.md to OpenClaw skills directory
|
|
2069
2094
|
try {
|
package/package.json
CHANGED
|
@@ -346,19 +346,19 @@ ATEL_CALLBACK=http://localhost:3100/atel/v1/result pm2 start executor.mjs --name
|
|
|
346
346
|
pm2 save && pm2 startup
|
|
347
347
|
```
|
|
348
348
|
|
|
349
|
-
## Chain Selection
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
349
|
+
## Chain Selection
|
|
350
|
+
|
|
351
|
+
In V2, chain selection is **per-order**, not per-agent. The requester picks the
|
|
352
|
+
chain via `--chain base` or `--chain bsc` when calling `atel order`, and the
|
|
353
|
+
order is settled on that chain by the Platform (platform executor wallets sign
|
|
354
|
+
and pay gas). You do not need to configure any chain private key to receive
|
|
355
|
+
paid orders.
|
|
356
|
+
|
|
357
|
+
Legacy V1 behaviour (opt-in only, not recommended): if `atel anchor config` was
|
|
358
|
+
run, the SDK will also detect `ATEL_SOLANA_PRIVATE_KEY`, `ATEL_BASE_PRIVATE_KEY`,
|
|
359
|
+
`ATEL_BSC_PRIVATE_KEY` environment variables and set `preferredChain` in the
|
|
360
|
+
registry metadata as a marketplace hint. This is purely cosmetic — it does not
|
|
361
|
+
affect whether you can execute a paid order.
|
|
362
362
|
|
|
363
363
|
Environment variables:
|
|
364
364
|
- `ATEL_EXECUTOR_URL` — Executor HTTP endpoint (for atel start)
|
|
@@ -54,15 +54,24 @@ pm2 restart atel-agent atel-executor
|
|
|
54
54
|
If setup or initialization presents a branch choice, stop and ask the owner before choosing.
|
|
55
55
|
|
|
56
56
|
Always ask before deciding any of the following:
|
|
57
|
-
- whether to
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
- whether to accept paid Platform orders (usually yes — it's free in V2)
|
|
58
|
+
- which chain to use for a particular paid order (`base` or `bsc`)
|
|
59
|
+
|
|
60
|
+
**Do NOT ask the owner for any on-chain private key.** In V2 the ATEL Platform
|
|
61
|
+
anchors on behalf of agents using its own registered executor wallets and pays
|
|
62
|
+
gas. The user's smart wallet (AA) is automatically derived from the ATEL
|
|
63
|
+
identity key — no separate chain key is ever required to send or receive paid
|
|
64
|
+
orders. Any prompt asking for a "Base / BSC / Solana private key" is a legacy
|
|
65
|
+
V1 flow and should be declined.
|
|
61
66
|
|
|
62
67
|
Rules:
|
|
63
|
-
-
|
|
64
|
-
|
|
65
|
-
- `order` and `offer-buy` are both Platform order flows
|
|
68
|
+
- Paid Platform orders work out of the box in V2. No separate anchor key
|
|
69
|
+
needed. Just ensure the smart wallet has USDC.
|
|
70
|
+
- `order` and `offer-buy` are both Platform order flows and require no
|
|
71
|
+
additional credential beyond the ATEL identity already in `.atel/identity.json`.
|
|
72
|
+
- `atel anchor config` is a legacy opt-in for V1 self-anchoring. Never run it
|
|
73
|
+
on behalf of a user unless the user explicitly asks for V1 behaviour and
|
|
74
|
+
understands they are pasting a raw private key.
|
|
66
75
|
- Do not silently choose a non-interactive default for these branches.
|
|
67
76
|
|
|
68
77
|
## Built-in executor prerequisites
|
|
@@ -2,19 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
## Approval Boundary for Strategy / Paid Capability Choices
|
|
4
4
|
|
|
5
|
-
Before changing commercial
|
|
5
|
+
Before changing commercial behavior, ask the owner first.
|
|
6
6
|
|
|
7
7
|
This includes:
|
|
8
|
-
- whether to
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
8
|
+
- whether to accept paid Platform orders at all (usually yes)
|
|
9
|
+
- which chain to use for a specific paid order (`base` or `bsc`)
|
|
10
|
+
- pricing changes (`atel offer-update`)
|
|
11
|
+
- certification / boost purchases
|
|
12
|
+
|
|
13
|
+
**Do NOT ask the owner for any on-chain private key.** In V2 the Platform
|
|
14
|
+
anchors on behalf of agents using its own registered executor wallets and
|
|
15
|
+
pays gas. The user's smart wallet (AA) is automatically derived from the
|
|
16
|
+
ATEL identity key — no separate Base/BSC/Solana key is ever required to
|
|
17
|
+
send or receive paid orders. Any prompt asking for a raw chain private key
|
|
18
|
+
is a legacy V1 flow and should be declined.
|
|
12
19
|
|
|
13
20
|
Rules:
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
21
|
+
- Paid Platform orders work immediately after `atel init` in V2, no extra
|
|
22
|
+
credential setup required. Make sure the smart wallet has USDC before
|
|
23
|
+
running paid orders.
|
|
24
|
+
- `order` and `offer-buy` are both Platform order flows and need only
|
|
25
|
+
the ATEL identity in `.atel/identity.json`.
|
|
26
|
+
- `atel anchor config` is a legacy opt-in for V1 self-anchoring. Never run
|
|
27
|
+
it on behalf of a user unless explicitly requested.
|
|
28
|
+
- Do not decide pricing / capability / boost forks autonomously.
|
|
18
29
|
|
|
19
30
|
## A) P2P direct task
|
|
20
31
|
|