Skip to content

Commit 3e2cde7

Browse files
authored
Merge pull request #5 from AelfScanProject/codex/skill-unified-upgrade-20260227
Codex/skill unified upgrade 20260227
2 parents 2777e52 + d96b42d commit 3e2cde7

8 files changed

Lines changed: 148 additions & 5 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ RUN_LIVE_TESTS=1 bun run test:e2e
120120
- `AELFSCAN_MCP_MAX_CHARS` (default: `60000`)
121121
- `AELFSCAN_MCP_INCLUDE_RAW` (default: `false`)
122122

123+
## Wallet Context Compatibility
124+
125+
- This skill is read-only and does not consume signer/private-key context for on-chain writes.
126+
- It is compatible with the shared wallet-context protocol (`~/.portkey/skill-wallet/context.v1.json`) used by write-capable skills.
127+
- `bun run deps:check` validates wallet-context schema version when a local context file exists.
128+
123129
## License
124130

125131
MIT

README.zh-CN.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ RUN_LIVE_TESTS=1 bun run test:e2e
120120
- `AELFSCAN_MCP_MAX_CHARS`(默认 `60000`
121121
- `AELFSCAN_MCP_INCLUDE_RAW`(默认 `false`
122122

123+
## 钱包上下文兼容性
124+
125+
- 本 skill 为只读,不消费 signer/private-key 上下文,也不执行链上写操作。
126+
- 兼容写能力 skill 使用的共享 wallet-context 协议(`~/.portkey/skill-wallet/context.v1.json`)。
127+
- 当本地存在 context 文件时,`bun run deps:check` 会校验 wallet-context schema 版本。
128+
123129
## License
124130

125131
MIT

SKILL.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ description: "AelfScan explorer data retrieval and analytics skill for agents."
1616

1717
## Safe usage rules
1818
- Never print private keys, mnemonics, or tokens in channel outputs.
19-
- For write operations, require explicit user confirmation and validate parameters before sending transactions.
20-
- Prefer `simulate` or read-only queries first when available.
19+
- This skill is read-only; do not attempt to execute chain writes via this package.
20+
- If user intent requires writes, route to wallet + domain write skills and keep this skill for analytics.
2121

2222
## Command recipes
2323
- Start MCP server: `bun run mcp`
@@ -28,5 +28,6 @@ description: "AelfScan explorer data retrieval and analytics skill for agents."
2828

2929
## Limits / Non-goals
3030
- This skill focuses on domain operations and adapters; it is not a full wallet custody system.
31+
- It does not consume signer context for transaction signing.
3132
- Do not hardcode environment secrets in source code or docs.
3233
- Avoid bypassing validation for external service calls.

bin/setup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bun
22
import { Command } from 'commander';
33
import * as fs from 'node:fs';
4+
import packageJson from '../package.json';
45
import {
56
LOG,
67
SERVER_NAME,
@@ -20,7 +21,7 @@ const program = new Command();
2021
program
2122
.name('aelfscan-setup')
2223
.description('Configure @aelfscan/agent-skills for Claude/Cursor/OpenClaw')
23-
.version('0.1.0');
24+
.version(packageJson.version);
2425

2526
const withCommonMcpOptions = (command: Command) =>
2627
command

bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aelfscan/agent-skills",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "AelfScan explorer skill toolkit for AI agents: MCP, CLI, and SDK interfaces.",
55
"type": "module",
66
"main": "index.ts",
@@ -70,6 +70,7 @@
7070
},
7171
"devDependencies": {
7272
"@types/bun": "latest",
73+
"ajv": "^8.17.1",
7374
"typescript": "^5.7.0"
7475
}
7576
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://github.com/AElfProject/aelf-skills/docs/schemas/wallet-context.v1.schema.json",
4+
"title": "WalletContextFileV1",
5+
"type": "object",
6+
"additionalProperties": false,
7+
"required": [
8+
"version",
9+
"activeProfileId",
10+
"profiles",
11+
"lastWriter"
12+
],
13+
"properties": {
14+
"version": {
15+
"type": "integer",
16+
"const": 1
17+
},
18+
"activeProfileId": {
19+
"type": "string",
20+
"minLength": 1
21+
},
22+
"profiles": {
23+
"type": "object",
24+
"minProperties": 0,
25+
"additionalProperties": {
26+
"$ref": "#/$defs/activeProfile"
27+
}
28+
},
29+
"lastWriter": {
30+
"$ref": "#/$defs/lastWriter"
31+
}
32+
},
33+
"$defs": {
34+
"activeProfile": {
35+
"type": "object",
36+
"additionalProperties": false,
37+
"required": [
38+
"walletType",
39+
"source",
40+
"updatedAt"
41+
],
42+
"properties": {
43+
"walletType": {
44+
"type": "string",
45+
"enum": [
46+
"EOA",
47+
"CA"
48+
]
49+
},
50+
"source": {
51+
"type": "string",
52+
"enum": [
53+
"eoa-local",
54+
"ca-keystore",
55+
"env"
56+
]
57+
},
58+
"network": {
59+
"type": "string"
60+
},
61+
"address": {
62+
"type": "string"
63+
},
64+
"caAddress": {
65+
"type": "string"
66+
},
67+
"caHash": {
68+
"type": "string"
69+
},
70+
"walletFile": {
71+
"type": "string"
72+
},
73+
"keystoreFile": {
74+
"type": "string"
75+
},
76+
"updatedAt": {
77+
"type": "string",
78+
"format": "date-time"
79+
}
80+
}
81+
},
82+
"lastWriter": {
83+
"type": "object",
84+
"additionalProperties": false,
85+
"required": [
86+
"skill",
87+
"version"
88+
],
89+
"properties": {
90+
"skill": {
91+
"type": "string",
92+
"minLength": 1
93+
},
94+
"version": {
95+
"type": "string",
96+
"minLength": 1
97+
}
98+
}
99+
}
100+
}
101+
}

scripts/check-deps-baseline.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bun
22
import { existsSync, readFileSync } from 'node:fs';
3+
import { homedir } from 'node:os';
34
import { resolve } from 'node:path';
5+
import Ajv from 'ajv';
46

57
type Baseline = {
68
dependencies: Record<string, string>;
@@ -14,6 +16,7 @@ function main() {
1416
const cwd = process.cwd();
1517
const baselinePath = resolve(cwd, 'deps-baseline.json');
1618
const packagePath = resolve(cwd, 'package.json');
19+
const contextSchemaPath = resolve(cwd, 'schemas', 'wallet-context.v1.schema.json');
1720

1821
if (!existsSync(baselinePath)) {
1922
console.error(`[deps:check] missing deps-baseline.json at ${baselinePath}`);
@@ -44,8 +47,31 @@ function main() {
4447
}
4548
}
4649

50+
const contextPath =
51+
process.env.PORTKEY_SKILL_WALLET_CONTEXT_PATH ||
52+
resolve(homedir(), '.portkey', 'skill-wallet', 'context.v1.json');
53+
if (!existsSync(contextSchemaPath)) {
54+
failures.push(`missing wallet-context schema: ${contextSchemaPath}`);
55+
} else if (existsSync(contextPath)) {
56+
try {
57+
const schema = readJson<Record<string, unknown>>(contextSchemaPath);
58+
const contextRaw = readJson<Record<string, unknown>>(contextPath);
59+
const ajv = new Ajv({ allErrors: true, strict: false });
60+
const validate = ajv.compile(schema);
61+
if (!validate(contextRaw)) {
62+
const details = (validate.errors || [])
63+
.map((err) => `${err.instancePath || '/'} ${err.message || 'invalid'}`)
64+
.join('; ');
65+
failures.push(`wallet-context schema validation failed (${contextPath}): ${details}`);
66+
}
67+
} catch (error) {
68+
const message = error instanceof Error ? error.message : String(error);
69+
failures.push(`wallet-context parse/validation failed: ${message}`);
70+
}
71+
}
72+
4773
if (failures.length > 0) {
48-
console.error('[deps:check] dependency baseline mismatch:');
74+
console.error('[deps:check] check failed:');
4975
for (const failure of failures) {
5076
console.error(`- ${failure}`);
5177
}

0 commit comments

Comments
 (0)