@lawrenceliang-btc/atel-sdk 0.8.7
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/LICENSE +21 -0
- package/README.md +221 -0
- package/bin/atel.mjs +2692 -0
- package/bin/tunnel-manager.mjs +171 -0
- package/dist/anchor/base.d.ts +21 -0
- package/dist/anchor/base.js +26 -0
- package/dist/anchor/bsc.d.ts +20 -0
- package/dist/anchor/bsc.js +25 -0
- package/dist/anchor/evm.d.ts +99 -0
- package/dist/anchor/evm.js +262 -0
- package/dist/anchor/index.d.ts +173 -0
- package/dist/anchor/index.js +165 -0
- package/dist/anchor/mock.d.ts +43 -0
- package/dist/anchor/mock.js +100 -0
- package/dist/anchor/solana.d.ts +95 -0
- package/dist/anchor/solana.js +298 -0
- package/dist/auditor/index.d.ts +54 -0
- package/dist/auditor/index.js +141 -0
- package/dist/collaboration/index.d.ts +146 -0
- package/dist/collaboration/index.js +237 -0
- package/dist/crypto/index.d.ts +162 -0
- package/dist/crypto/index.js +231 -0
- package/dist/endpoint/index.d.ts +147 -0
- package/dist/endpoint/index.js +390 -0
- package/dist/envelope/index.d.ts +104 -0
- package/dist/envelope/index.js +156 -0
- package/dist/executor/index.d.ts +71 -0
- package/dist/executor/index.js +398 -0
- package/dist/gateway/index.d.ts +278 -0
- package/dist/gateway/index.js +520 -0
- package/dist/graph/index.d.ts +215 -0
- package/dist/graph/index.js +524 -0
- package/dist/handshake/index.d.ts +166 -0
- package/dist/handshake/index.js +287 -0
- package/dist/identity/index.d.ts +155 -0
- package/dist/identity/index.js +250 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +28 -0
- package/dist/negotiation/index.d.ts +133 -0
- package/dist/negotiation/index.js +160 -0
- package/dist/network/index.d.ts +78 -0
- package/dist/network/index.js +207 -0
- package/dist/orchestrator/index.d.ts +190 -0
- package/dist/orchestrator/index.js +297 -0
- package/dist/policy/index.d.ts +100 -0
- package/dist/policy/index.js +206 -0
- package/dist/proof/index.d.ts +220 -0
- package/dist/proof/index.js +541 -0
- package/dist/registry/index.d.ts +98 -0
- package/dist/registry/index.js +129 -0
- package/dist/rollback/index.d.ts +76 -0
- package/dist/rollback/index.js +91 -0
- package/dist/schema/capability-schema.json +52 -0
- package/dist/schema/index.d.ts +128 -0
- package/dist/schema/index.js +163 -0
- package/dist/schema/task-schema.json +69 -0
- package/dist/score/index.d.ts +174 -0
- package/dist/score/index.js +275 -0
- package/dist/service/index.d.ts +34 -0
- package/dist/service/index.js +273 -0
- package/dist/service/server.d.ts +7 -0
- package/dist/service/server.js +22 -0
- package/dist/trace/index.d.ts +217 -0
- package/dist/trace/index.js +446 -0
- package/dist/trust/index.d.ts +84 -0
- package/dist/trust/index.js +107 -0
- package/dist/trust-sync/index.d.ts +30 -0
- package/dist/trust-sync/index.js +57 -0
- package/package.json +71 -0
- package/skill/SKILL.md +363 -0
- package/skill/references/commercial.md +184 -0
- package/skill/references/executor.md +356 -0
- package/skill/references/networking.md +64 -0
- package/skill/references/onchain.md +73 -0
- package/skill/references/security.md +96 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ATEL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# ATEL SDK
|
|
2
|
+
|
|
3
|
+
**Agent Trust & Economics Layer** — a TypeScript protocol SDK for building trustworthy, auditable multi-agent systems.
|
|
4
|
+
|
|
5
|
+
ATEL provides the cryptographic primitives and protocol building blocks that let AI agents collaborate safely: identity verification, scoped consent, policy enforcement, tamper-evident execution traces, Merkle-tree proofs, and reputation scoring.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install dependencies
|
|
11
|
+
npm install
|
|
12
|
+
|
|
13
|
+
# Build
|
|
14
|
+
npm run build
|
|
15
|
+
|
|
16
|
+
# Run the end-to-end demo
|
|
17
|
+
npx tsx demo/full-demo.ts
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Phase 0.5 commands:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Real external API e2e demo
|
|
24
|
+
npm run demo:real
|
|
25
|
+
|
|
26
|
+
# Testnet anchoring smoke (requires chain env vars)
|
|
27
|
+
npm run smoke:anchor
|
|
28
|
+
|
|
29
|
+
# Performance baseline
|
|
30
|
+
npm run test:perf
|
|
31
|
+
|
|
32
|
+
# 5-10 agent continuous run (Phase 0.5)
|
|
33
|
+
npm run run:cluster
|
|
34
|
+
|
|
35
|
+
# deploy acceptance (service + sync + proof + anchor)
|
|
36
|
+
npm run acceptance:deploy
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The demo simulates two agents collaborating on a flight search task, exercising the end-to-end trust workflow.
|
|
40
|
+
|
|
41
|
+
## Architecture
|
|
42
|
+
|
|
43
|
+
ATEL is organized into 13 composable modules:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
47
|
+
│ ATEL SDK │
|
|
48
|
+
├──────────┬──────────┬──────────┬──────────┬─────────────────┤
|
|
49
|
+
│ Identity │ Schema │ Policy │ Gateway │ Trace │
|
|
50
|
+
├──────────┴──────────┴──────────┴──────────┴─────────────────┤
|
|
51
|
+
│ Proof │ Score │ Graph │ TrustManager │ Rollback │ Anchor │
|
|
52
|
+
├───────────────────────────────┬──────────────────────────────┤
|
|
53
|
+
│ Orchestrator │ Trust Score Service │
|
|
54
|
+
└───────────────────────────────┴──────────────────────────────┘
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
| Module | Description |
|
|
58
|
+
|--------|-------------|
|
|
59
|
+
| **Identity** | Ed25519 key pairs, DID creation (`did:atel:*`), signing & verification |
|
|
60
|
+
| **Schema** | Task and Capability JSON schemas, validation, factory functions, matching |
|
|
61
|
+
| **Policy** | Consent tokens (scoped, time-limited), policy engine with call tracking |
|
|
62
|
+
| **Gateway** | Central tool invocation gateway with policy enforcement and deterministic hashing |
|
|
63
|
+
| **Trace** | Append-only, hash-chained execution log with auto-checkpoints |
|
|
64
|
+
| **Proof** | Merkle-tree proof bundles with multi-check verification |
|
|
65
|
+
| **Score** | Local trust-score computation based on execution history |
|
|
66
|
+
| **Graph** | Multi-dimensional trust graph, direct/indirect/composite trust |
|
|
67
|
+
| **TrustManager** | Unified score + graph submission and trust query API |
|
|
68
|
+
| **Rollback** | Compensation and rollback execution manager |
|
|
69
|
+
| **Anchor** | Multi-chain proof anchoring (Base/BSC/Solana/Mock) |
|
|
70
|
+
| **Orchestrator** | High-level API wiring task delegation/execution/verify |
|
|
71
|
+
| **Service** | HTTP API for score + graph queries with JSON persistence |
|
|
72
|
+
|
|
73
|
+
## Trust Modes
|
|
74
|
+
|
|
75
|
+
ATEL supports two deployment modes that can coexist:
|
|
76
|
+
|
|
77
|
+
- `Local Mode` (default): execute, prove, verify, and score locally with no network dependency.
|
|
78
|
+
- `Network Mode` (optional): keep local trust updates, and additionally sync summaries to a shared trust service.
|
|
79
|
+
|
|
80
|
+
This means local capability is never removed when network trust is enabled.
|
|
81
|
+
|
|
82
|
+
## API Reference
|
|
83
|
+
|
|
84
|
+
Detailed API guide: `docs/API.md`
|
|
85
|
+
Start here (one-page onboarding): `docs/START-HERE.md`
|
|
86
|
+
5-minute quickstart: `docs/QUICKSTART-5MIN.md`
|
|
87
|
+
Phase 0.5 runbook: `docs/PHASE-0.5.md`
|
|
88
|
+
Service deployment: `docs/SERVICE-DEPLOY.md`
|
|
89
|
+
|
|
90
|
+
ATEL skill package: `skills/atel/SKILL.md`
|
|
91
|
+
|
|
92
|
+
### Module 1: Identity
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { AgentIdentity, generateKeyPair, createDID, sign, verify } from '@lawrenceliang-btc/atel-sdk';
|
|
96
|
+
|
|
97
|
+
const agent = new AgentIdentity();
|
|
98
|
+
console.log(agent.did); // "did:atel:..."
|
|
99
|
+
const sig = agent.sign(payload);
|
|
100
|
+
const ok = agent.verify(payload, sig);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Module 2: Schema
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { createTask, createCapability, matchTaskToCapability } from '@lawrenceliang-btc/atel-sdk';
|
|
107
|
+
|
|
108
|
+
const task = createTask({
|
|
109
|
+
issuer: agent.did,
|
|
110
|
+
intent: { type: 'flight_search', goal: 'Find flights SIN→HND' },
|
|
111
|
+
risk: { level: 'medium' },
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const cap = createCapability({
|
|
115
|
+
provider: executor.did,
|
|
116
|
+
capabilities: [{ type: 'flight_search', description: '...' }],
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const match = matchTaskToCapability(task, cap);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Module 3: Policy
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import { mintConsentToken, verifyConsentToken, PolicyEngine } from '@lawrenceliang-btc/atel-sdk';
|
|
126
|
+
|
|
127
|
+
const token = mintConsentToken(
|
|
128
|
+
issuer.did, executor.did,
|
|
129
|
+
['tool:http:get', 'data:public_web:read'],
|
|
130
|
+
{ max_calls: 10, ttl_sec: 3600 },
|
|
131
|
+
'medium',
|
|
132
|
+
issuer.secretKey,
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
verifyConsentToken(token, issuer.publicKey);
|
|
136
|
+
|
|
137
|
+
const engine = new PolicyEngine(token);
|
|
138
|
+
const decision = engine.evaluate(action); // 'allow' | 'deny' | 'needs_confirm'
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Module 4: Gateway
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { ToolGateway } from '@lawrenceliang-btc/atel-sdk';
|
|
145
|
+
|
|
146
|
+
const gateway = new ToolGateway(policyEngine);
|
|
147
|
+
gateway.registerTool('http.get', async (input) => { /* ... */ });
|
|
148
|
+
|
|
149
|
+
const result = await gateway.callTool({
|
|
150
|
+
tool: 'http.get',
|
|
151
|
+
input: { url: '...' },
|
|
152
|
+
consentToken: '...',
|
|
153
|
+
});
|
|
154
|
+
// result.output, result.input_hash, result.output_hash
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Module 5: Trace
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import { ExecutionTrace } from '@lawrenceliang-btc/atel-sdk';
|
|
161
|
+
|
|
162
|
+
const trace = new ExecutionTrace(taskId, agentIdentity);
|
|
163
|
+
trace.append('TASK_ACCEPTED', { ... });
|
|
164
|
+
trace.append('TOOL_CALL', { ... });
|
|
165
|
+
trace.finalize(result);
|
|
166
|
+
|
|
167
|
+
const { valid, errors } = trace.verify();
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Module 6: Proof
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
import { ProofGenerator, ProofVerifier } from '@lawrenceliang-btc/atel-sdk';
|
|
174
|
+
|
|
175
|
+
const gen = new ProofGenerator(trace, identity);
|
|
176
|
+
const bundle = gen.generate(policyRef, consentRef, resultRef);
|
|
177
|
+
|
|
178
|
+
const report = ProofVerifier.verify(bundle, { trace });
|
|
179
|
+
// report.valid, report.checks, report.summary
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Module 7: Score
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { TrustScoreClient } from '@lawrenceliang-btc/atel-sdk';
|
|
186
|
+
|
|
187
|
+
const client = new TrustScoreClient();
|
|
188
|
+
client.submitExecutionSummary({ executor: did, task_id, success: true, ... });
|
|
189
|
+
|
|
190
|
+
const report = client.getAgentScore(did);
|
|
191
|
+
// report.trust_score (0-100), report.risk_flags, etc.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Trust Score Formula
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
base = success_rate × 60
|
|
198
|
+
volume = min(total_tasks / 100, 1) × 15
|
|
199
|
+
risk_bonus = (high_risk_successes / total) × 15
|
|
200
|
+
consistency = (1 − violation_rate) × 10
|
|
201
|
+
─────────────────────────────────────────
|
|
202
|
+
score = base + volume + risk_bonus + consistency (clamped 0–100)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Current Status (2026-02-13)
|
|
206
|
+
|
|
207
|
+
- [x] **Phase 0 MVP complete** — 13 modules implemented, core trust workflow end-to-end
|
|
208
|
+
- [x] **241 tests in suite** — unit/integration coverage across modules
|
|
209
|
+
- [x] **Demo coverage** — success path + failure scenarios
|
|
210
|
+
- [ ] **Phase 0.5 validation** — real agents + real external tools + real testnet anchoring
|
|
211
|
+
|
|
212
|
+
## Roadmap
|
|
213
|
+
|
|
214
|
+
- [ ] **Phase 0.5** — Internal multi-agent cluster with real API/tool workloads
|
|
215
|
+
- [ ] **Phase 1** — Enterprise pilot + external integration hardening
|
|
216
|
+
- [ ] **Phase 2** — Open SDK access + Trust Score/Graph network rollout
|
|
217
|
+
- [ ] **Phase 3+** — Discovery/Directory and Router/Marketplace layers
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
MIT
|