@moltos/sdk 0.4.4
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 +67 -0
- package/dist/index.d.ts +149 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +260 -0
- package/dist/index.js.map +1 -0
- package/dist/protocols/arbitra/voting.d.ts +43 -0
- package/dist/protocols/arbitra/voting.d.ts.map +1 -0
- package/dist/protocols/arbitra/voting.js +42 -0
- package/dist/protocols/arbitra/voting.js.map +1 -0
- package/dist/protocols/clawforge/control-plane.d.ts +4 -0
- package/dist/protocols/clawforge/control-plane.d.ts.map +1 -0
- package/dist/protocols/clawforge/control-plane.js +11 -0
- package/dist/protocols/clawforge/control-plane.js.map +1 -0
- package/dist/protocols/clawid/clawid-token.d.ts +9 -0
- package/dist/protocols/clawid/clawid-token.d.ts.map +1 -0
- package/dist/protocols/clawid/clawid-token.js +20 -0
- package/dist/protocols/clawid/clawid-token.js.map +1 -0
- package/dist/protocols/clawkernel/kernel.d.ts +4 -0
- package/dist/protocols/clawkernel/kernel.d.ts.map +1 -0
- package/dist/protocols/clawkernel/kernel.js +11 -0
- package/dist/protocols/clawkernel/kernel.js.map +1 -0
- package/dist/protocols/clawlink/handoff.d.ts +64 -0
- package/dist/protocols/clawlink/handoff.d.ts.map +1 -0
- package/dist/protocols/clawlink/handoff.js +31 -0
- package/dist/protocols/clawlink/handoff.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +27 -0
- package/dist/types.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# TAP Protocol SDK
|
|
2
|
+
|
|
3
|
+
Official TypeScript SDK for the Trust Audit Protocol (TAP) — the first cross-agent attestation network for verified AgentCommerce.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @tap-protocol/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { TAPClient } from '@tap-protocol/sdk';
|
|
15
|
+
|
|
16
|
+
const client = new TAPClient({
|
|
17
|
+
privateKey: process.env.TAP_PRIVATE_KEY,
|
|
18
|
+
agentId: 'agent-007',
|
|
19
|
+
stakeAmount: 750 // ALPHA
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Generate boot audit
|
|
23
|
+
const bootAudit = await client.generateBootAudit({
|
|
24
|
+
'AGENTS.md': '...',
|
|
25
|
+
'SOUL.md': '...',
|
|
26
|
+
'USER.md': '...',
|
|
27
|
+
'TOOLS.md': '...',
|
|
28
|
+
'MEMORY.md': '...',
|
|
29
|
+
'HEARTBEAT.md': '...'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Create a claim
|
|
33
|
+
const claim = await client.createClaim({
|
|
34
|
+
claimId: 'claim-001',
|
|
35
|
+
statement: 'I respond within 30 seconds',
|
|
36
|
+
metric: 'response_time_ms',
|
|
37
|
+
threshold: 30000
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Attest another agent's claim
|
|
41
|
+
const attestation = await client.attest({
|
|
42
|
+
claimId: 'claim-001',
|
|
43
|
+
targetAgent: 'agent-042',
|
|
44
|
+
testRequests: 3
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
console.log(attestation.result); // 'CONFIRMED' | 'REJECTED' | 'TIMEOUT'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- ✅ **Boot Audit Generation** — SHA256 workspace hashing
|
|
53
|
+
- ✅ **Trust Ledger Management** — Create and manage claims
|
|
54
|
+
- ✅ **Cross-Attestation** — Verify other agents' claims
|
|
55
|
+
- ✅ **BLS Aggregation** — Batch attestations for efficiency
|
|
56
|
+
- ✅ **x402 Integration** — Pre-payment verification
|
|
57
|
+
- ✅ **OpenClaw Skill** — Native integration with OpenClaw
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
- [Protocol Specification](https://github.com/Shepherd217/trust-audit-framework)
|
|
62
|
+
- [API Reference](https://docs.tap.live)
|
|
63
|
+
- [Dashboard](https://tap.live)
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TAP Protocol SDK
|
|
3
|
+
*
|
|
4
|
+
* Official SDK for Trust Audit Protocol integration
|
|
5
|
+
* Enables agents to perform cross-attestation, manage claims,
|
|
6
|
+
* and participate in the verified agent economy.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { TAPClient } from '@tap-protocol/sdk';
|
|
11
|
+
*
|
|
12
|
+
* const client = new TAPClient({
|
|
13
|
+
* privateKey: process.env.TAP_PRIVATE_KEY,
|
|
14
|
+
* agentId: 'agent-007'
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Perform attestation
|
|
18
|
+
* const result = await client.attest({
|
|
19
|
+
* claimId: 'claim-123',
|
|
20
|
+
* targetAgent: 'agent-042'
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface TAPConfig {
|
|
25
|
+
privateKey: string;
|
|
26
|
+
agentId: string;
|
|
27
|
+
apiUrl?: string;
|
|
28
|
+
stakeAmount?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface AttestationClaim {
|
|
31
|
+
claimId: string;
|
|
32
|
+
statement: string;
|
|
33
|
+
metric: 'response_time_ms' | 'uptime_percent' | 'availability' | 'accuracy_percent' | 'custom';
|
|
34
|
+
threshold: number;
|
|
35
|
+
stakeAmount: number;
|
|
36
|
+
}
|
|
37
|
+
export interface AttestationResult {
|
|
38
|
+
claimId: string;
|
|
39
|
+
result: 'CONFIRMED' | 'REJECTED' | 'TIMEOUT';
|
|
40
|
+
measuredValue: number;
|
|
41
|
+
threshold: number;
|
|
42
|
+
timestamp: string;
|
|
43
|
+
signature: string;
|
|
44
|
+
}
|
|
45
|
+
export interface BootAudit {
|
|
46
|
+
agentId: string;
|
|
47
|
+
timestamp: string;
|
|
48
|
+
workspaceHash: string;
|
|
49
|
+
configFiles: Record<string, string>;
|
|
50
|
+
complianceStatus: 'FULL' | 'PARTIAL' | 'FAILED';
|
|
51
|
+
signature: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class TAPClient {
|
|
54
|
+
privateKey: Uint8Array;
|
|
55
|
+
publicKey: Uint8Array;
|
|
56
|
+
agentId: string;
|
|
57
|
+
apiUrl: string;
|
|
58
|
+
private stakeAmount;
|
|
59
|
+
constructor(config: TAPConfig);
|
|
60
|
+
/**
|
|
61
|
+
* Generate a boot audit hash for workspace verification
|
|
62
|
+
*/
|
|
63
|
+
generateBootAudit(configFiles: Record<string, string>): Promise<BootAudit>;
|
|
64
|
+
/**
|
|
65
|
+
* Create a claim for the Trust Ledger
|
|
66
|
+
*/
|
|
67
|
+
createClaim(claim: Omit<AttestationClaim, 'stakeAmount'>): Promise<AttestationClaim>;
|
|
68
|
+
/**
|
|
69
|
+
* Perform attestation on another agent's claim
|
|
70
|
+
*/
|
|
71
|
+
attest(options: {
|
|
72
|
+
claimId: string;
|
|
73
|
+
targetAgent: string;
|
|
74
|
+
testRequests?: number;
|
|
75
|
+
}): Promise<AttestationResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Batch attest multiple claims with BLS aggregation
|
|
78
|
+
*/
|
|
79
|
+
attestBatch(claims: Array<{
|
|
80
|
+
claimId: string;
|
|
81
|
+
targetAgent: string;
|
|
82
|
+
}>): Promise<{
|
|
83
|
+
aggregatedSignature: string;
|
|
84
|
+
results: AttestationResult[];
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Verify another agent's attestation
|
|
88
|
+
*/
|
|
89
|
+
verifyAttestation(attestation: AttestationResult, attestorPublicKey: string): Promise<boolean>;
|
|
90
|
+
/**
|
|
91
|
+
* Get agent's attestation history
|
|
92
|
+
*/
|
|
93
|
+
getAttestationHistory(agentId?: string): Promise<AttestationResult[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Get live network stats
|
|
96
|
+
*/
|
|
97
|
+
getNetworkStats(): Promise<{
|
|
98
|
+
agents: number;
|
|
99
|
+
pairs: number;
|
|
100
|
+
alphaDistributed: number;
|
|
101
|
+
claimsToday: number;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* OpenClaw Skill Integration
|
|
106
|
+
*
|
|
107
|
+
* Usage: Drop this into ~/.openclaw/skills/tap/skill.js
|
|
108
|
+
*/
|
|
109
|
+
export declare const tapSkill: {
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
execute(input: {
|
|
113
|
+
privateKey: string;
|
|
114
|
+
agentId: string;
|
|
115
|
+
claimId: string;
|
|
116
|
+
targetAgent: string;
|
|
117
|
+
}): Promise<AttestationResult>;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* x402 + TAP Integration
|
|
121
|
+
*
|
|
122
|
+
* Combines payment settlement with pre-payment verification
|
|
123
|
+
*/
|
|
124
|
+
export declare class TAPx402Client extends TAPClient {
|
|
125
|
+
/**
|
|
126
|
+
* Pay for verified service (TAP attestation + x402 payment)
|
|
127
|
+
*/
|
|
128
|
+
payForVerifiedService(options: {
|
|
129
|
+
endpoint: string;
|
|
130
|
+
amount: string;
|
|
131
|
+
claimId: string;
|
|
132
|
+
x402Config: {
|
|
133
|
+
token: string;
|
|
134
|
+
network: string;
|
|
135
|
+
};
|
|
136
|
+
}): Promise<{
|
|
137
|
+
attestationHash: string;
|
|
138
|
+
paymentReceipt: any;
|
|
139
|
+
}>;
|
|
140
|
+
private resolveAgentFromEndpoint;
|
|
141
|
+
private executeX402Payment;
|
|
142
|
+
}
|
|
143
|
+
export * from './types';
|
|
144
|
+
export * from './protocols/arbitra/voting';
|
|
145
|
+
export * from './protocols/clawlink/handoff';
|
|
146
|
+
export * from './protocols/clawid/clawid-token';
|
|
147
|
+
export * from './protocols/clawforge/control-plane';
|
|
148
|
+
export * from './protocols/clawkernel/kernel';
|
|
149
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,GAAG,cAAc,GAAG,kBAAkB,GAAG,QAAQ,CAAC;IAC/F,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IAChD,SAAS,EAAE,M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;CAIH;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;mBAIE;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB;CAWF,CAAC;AAEF;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C;;OAEG;IACG,qBAAqB,CAAC,OAAO,EAAE;QACnC,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE;YACV,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,GAAG,OAAO,CAAC;QACV,eAAe,EAAE,MAAM,CAAC;QACxB,cAAc,EAAE,GAAG,CAAC;KACrB,CAAC;YAmCY,wBAAwB;YAOxB,kBAAkB;CAKjC;AAGD,cAAc,SAAS,CAAC;AAGxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.TAPx402Client = exports.tapSkill = exports.TAPClient = void 0;
|
|
18
|
+
const ed25519_1 = require("@noble/ed25519");
|
|
19
|
+
const bls12_381_1 = require("@noble/bls12-381");
|
|
20
|
+
const sha256_1 = require("@noble/hashes/sha256");
|
|
21
|
+
const utils_1 = require("@noble/hashes/utils");
|
|
22
|
+
const sha512_1 = require("@noble/hashes/sha512");
|
|
23
|
+
// Fix sha512Sync for @noble/ed25519 v2.x - provide sync wrapper using noble-hashes
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
ed25519_1.etc.sha512Sync = (...msgs) => (0, sha512_1.sha512)(ed25519_1.etc.concatBytes(...msgs));
|
|
26
|
+
class TAPClient {
|
|
27
|
+
constructor(config) {
|
|
28
|
+
this.privateKey = (0, utils_1.hexToBytes)(config.privateKey);
|
|
29
|
+
this.agentId = config.agentId;
|
|
30
|
+
this.apiUrl = config.apiUrl || 'https://api.tap.live';
|
|
31
|
+
this.stakeAmount = config.stakeAmount || 750;
|
|
32
|
+
// Derive public key
|
|
33
|
+
this.publicKey = (0, ed25519_1.getPublicKey)(this.privateKey);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Generate a boot audit hash for workspace verification
|
|
37
|
+
*/
|
|
38
|
+
async generateBootAudit(configFiles) {
|
|
39
|
+
// Hash each config file
|
|
40
|
+
const fileHashes = {};
|
|
41
|
+
let combinedHash = '';
|
|
42
|
+
for (const [filename, content] of Object.entries(configFiles)) {
|
|
43
|
+
const hash = (0, sha256_1.sha256)(new TextEncoder().encode(content));
|
|
44
|
+
fileHashes[filename] = 'sha256:' + (0, utils_1.bytesToHex)(hash);
|
|
45
|
+
combinedHash += (0, utils_1.bytesToHex)(hash);
|
|
46
|
+
}
|
|
47
|
+
// Generate workspace hash
|
|
48
|
+
const workspaceHash = (0, sha256_1.sha256)(new TextEncoder().encode(combinedHash));
|
|
49
|
+
const timestamp = new Date().toISOString();
|
|
50
|
+
// Sign the audit
|
|
51
|
+
const message = `TAP_BOOT|${this.agentId}|${timestamp}|${(0, utils_1.bytesToHex)(workspaceHash)}`;
|
|
52
|
+
const signature = await (0, ed25519_1.sign)(new TextEncoder().encode(message), this.privateKey);
|
|
53
|
+
return {
|
|
54
|
+
agentId: this.agentId,
|
|
55
|
+
timestamp,
|
|
56
|
+
workspaceHash: 'sha256:' + (0, utils_1.bytesToHex)(workspaceHash),
|
|
57
|
+
configFiles: fileHashes,
|
|
58
|
+
complianceStatus: 'FULL',
|
|
59
|
+
signature: 'ed25519:' + (0, utils_1.bytesToHex)(signature)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a claim for the Trust Ledger
|
|
64
|
+
*/
|
|
65
|
+
async createClaim(claim) {
|
|
66
|
+
const fullClaim = {
|
|
67
|
+
...claim,
|
|
68
|
+
stakeAmount: this.stakeAmount
|
|
69
|
+
};
|
|
70
|
+
// Sign the claim
|
|
71
|
+
const message = `TAP_CLAIM|${claim.claimId}|${claim.statement}|${claim.threshold}|${this.stakeAmount}`;
|
|
72
|
+
const signature = await (0, ed25519_1.sign)(new TextEncoder().encode(message), this.privateKey);
|
|
73
|
+
// Submit to TAP network
|
|
74
|
+
const response = await fetch(`${this.apiUrl}/claims`, {
|
|
75
|
+
method: 'POST',
|
|
76
|
+
headers: { 'Content-Type': 'application/json' },
|
|
77
|
+
body: JSON.stringify({
|
|
78
|
+
...fullClaim,
|
|
79
|
+
agentId: this.agentId,
|
|
80
|
+
signature: (0, utils_1.bytesToHex)(signature)
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
if (!response.ok) {
|
|
84
|
+
throw new Error(`Failed to create claim: ${response.statusText}`);
|
|
85
|
+
}
|
|
86
|
+
return fullClaim;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Perform attestation on another agent's claim
|
|
90
|
+
*/
|
|
91
|
+
async attest(options) {
|
|
92
|
+
const { claimId, targetAgent, testRequests = 3 } = options;
|
|
93
|
+
// Fetch claim details
|
|
94
|
+
const claimResponse = await fetch(`${this.apiUrl}/claims/${claimId}`);
|
|
95
|
+
if (!claimResponse.ok) {
|
|
96
|
+
throw new Error('Claim not found');
|
|
97
|
+
}
|
|
98
|
+
const claim = await claimResponse.json();
|
|
99
|
+
// Perform verification tests
|
|
100
|
+
const measurements = [];
|
|
101
|
+
for (let i = 0; i < testRequests; i++) {
|
|
102
|
+
const start = Date.now();
|
|
103
|
+
// Call target agent's endpoint
|
|
104
|
+
const testResponse = await fetch(`${this.apiUrl}/agents/${targetAgent}/test`, {
|
|
105
|
+
method: 'POST',
|
|
106
|
+
body: JSON.stringify({ claimId })
|
|
107
|
+
});
|
|
108
|
+
const elapsed = Date.now() - start;
|
|
109
|
+
measurements.push(elapsed);
|
|
110
|
+
}
|
|
111
|
+
// Calculate result
|
|
112
|
+
const average = measurements.reduce((a, b) => a + b, 0) / measurements.length;
|
|
113
|
+
const result = average <= claim.threshold ? 'CONFIRMED' : 'REJECTED';
|
|
114
|
+
// Sign attestation
|
|
115
|
+
const timestamp = new Date().toISOString();
|
|
116
|
+
const message = `TAP_ATTEST|${claimId}|${result}|${average}|${timestamp}|${this.agentId}`;
|
|
117
|
+
const signature = await (0, ed25519_1.sign)(new TextEncoder().encode(message), this.privateKey);
|
|
118
|
+
const attestationResult = {
|
|
119
|
+
claimId,
|
|
120
|
+
result,
|
|
121
|
+
measuredValue: average,
|
|
122
|
+
threshold: claim.threshold,
|
|
123
|
+
timestamp,
|
|
124
|
+
signature: (0, utils_1.bytesToHex)(signature)
|
|
125
|
+
};
|
|
126
|
+
// Submit attestation
|
|
127
|
+
await fetch(`${this.apiUrl}/attestations`, {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
headers: { 'Content-Type': 'application/json' },
|
|
130
|
+
body: JSON.stringify({
|
|
131
|
+
...attestationResult,
|
|
132
|
+
attestorId: this.agentId,
|
|
133
|
+
targetAgent
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
return attestationResult;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Batch attest multiple claims with BLS aggregation
|
|
140
|
+
*/
|
|
141
|
+
async attestBatch(claims) {
|
|
142
|
+
const results = [];
|
|
143
|
+
const signatures = [];
|
|
144
|
+
for (const claim of claims) {
|
|
145
|
+
const result = await this.attest(claim);
|
|
146
|
+
results.push(result);
|
|
147
|
+
signatures.push((0, utils_1.hexToBytes)(result.signature));
|
|
148
|
+
}
|
|
149
|
+
// Aggregate signatures
|
|
150
|
+
const aggregated = (0, bls12_381_1.aggregateSignatures)(signatures);
|
|
151
|
+
return {
|
|
152
|
+
aggregatedSignature: (0, utils_1.bytesToHex)(aggregated),
|
|
153
|
+
results
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Verify another agent's attestation
|
|
158
|
+
*/
|
|
159
|
+
async verifyAttestation(attestation, attestorPublicKey) {
|
|
160
|
+
const message = `TAP_ATTEST|${attestation.claimId}|${attestation.result}|${attestation.measuredValue}|${attestation.timestamp}|${attestorPublicKey}`;
|
|
161
|
+
return (0, ed25519_1.verify)((0, utils_1.hexToBytes)(attestation.signature), new TextEncoder().encode(message), (0, utils_1.hexToBytes)(attestorPublicKey));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get agent's attestation history
|
|
165
|
+
*/
|
|
166
|
+
async getAttestationHistory(agentId) {
|
|
167
|
+
const targetAgent = agentId || this.agentId;
|
|
168
|
+
const response = await fetch(`${this.apiUrl}/agents/${targetAgent}/attestations`);
|
|
169
|
+
if (!response.ok) {
|
|
170
|
+
throw new Error('Failed to fetch attestation history');
|
|
171
|
+
}
|
|
172
|
+
return response.json();
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Get live network stats
|
|
176
|
+
*/
|
|
177
|
+
async getNetworkStats() {
|
|
178
|
+
const response = await fetch(`${this.apiUrl}/stats`);
|
|
179
|
+
return response.json();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.TAPClient = TAPClient;
|
|
183
|
+
/**
|
|
184
|
+
* OpenClaw Skill Integration
|
|
185
|
+
*
|
|
186
|
+
* Usage: Drop this into ~/.openclaw/skills/tap/skill.js
|
|
187
|
+
*/
|
|
188
|
+
exports.tapSkill = {
|
|
189
|
+
name: 'tap_verify',
|
|
190
|
+
description: 'Run TAP cross-attestation before x402 payment',
|
|
191
|
+
async execute(input) {
|
|
192
|
+
const client = new TAPClient({
|
|
193
|
+
privateKey: input.privateKey,
|
|
194
|
+
agentId: input.agentId
|
|
195
|
+
});
|
|
196
|
+
return client.attest({
|
|
197
|
+
claimId: input.claimId,
|
|
198
|
+
targetAgent: input.targetAgent
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* x402 + TAP Integration
|
|
204
|
+
*
|
|
205
|
+
* Combines payment settlement with pre-payment verification
|
|
206
|
+
*/
|
|
207
|
+
class TAPx402Client extends TAPClient {
|
|
208
|
+
/**
|
|
209
|
+
* Pay for verified service (TAP attestation + x402 payment)
|
|
210
|
+
*/
|
|
211
|
+
async payForVerifiedService(options) {
|
|
212
|
+
const { endpoint, amount, claimId, x402Config } = options;
|
|
213
|
+
// Step 1: Extract target agent from endpoint
|
|
214
|
+
const targetAgent = await this.resolveAgentFromEndpoint(endpoint);
|
|
215
|
+
// Step 2: Run TAP attestation
|
|
216
|
+
const attestation = await this.attest({
|
|
217
|
+
claimId,
|
|
218
|
+
targetAgent
|
|
219
|
+
});
|
|
220
|
+
if (attestation.result !== 'CONFIRMED') {
|
|
221
|
+
throw new Error(`Attestation failed: ${attestation.result}`);
|
|
222
|
+
}
|
|
223
|
+
// Step 3: Include attestation in x402 payment
|
|
224
|
+
const attestationHash = (0, sha256_1.sha256)(new TextEncoder().encode(JSON.stringify(attestation)));
|
|
225
|
+
// Step 4: Execute x402 payment (placeholder - integrate with actual x402 SDK)
|
|
226
|
+
const paymentReceipt = await this.executeX402Payment({
|
|
227
|
+
endpoint,
|
|
228
|
+
amount,
|
|
229
|
+
extensions: {
|
|
230
|
+
tapAttestation: (0, utils_1.bytesToHex)(attestationHash),
|
|
231
|
+
attestorId: this.agentId
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
return {
|
|
235
|
+
attestationHash: (0, utils_1.bytesToHex)(attestationHash),
|
|
236
|
+
paymentReceipt
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
async resolveAgentFromEndpoint(endpoint) {
|
|
240
|
+
// Resolve agent ID from service endpoint
|
|
241
|
+
const response = await fetch(`${this.apiUrl}/resolve?endpoint=${encodeURIComponent(endpoint)}`);
|
|
242
|
+
const data = await response.json();
|
|
243
|
+
return data.agentId;
|
|
244
|
+
}
|
|
245
|
+
async executeX402Payment(options) {
|
|
246
|
+
// Integrate with x402 SDK
|
|
247
|
+
// This is a placeholder - actual implementation uses @x402/core
|
|
248
|
+
return { status: 'completed', txHash: '0x...' };
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
exports.TAPx402Client = TAPx402Client;
|
|
252
|
+
// Export types
|
|
253
|
+
__exportStar(require("./types"), exports);
|
|
254
|
+
// Export full 6-layer OS
|
|
255
|
+
__exportStar(require("./protocols/arbitra/voting"), exports);
|
|
256
|
+
__exportStar(require("./protocols/clawlink/handoff"), exports);
|
|
257
|
+
__exportStar(require("./protocols/clawid/clawid-token"), exports);
|
|
258
|
+
__exportStar(require("./protocols/clawforge/control-plane"), exports);
|
|
259
|
+
__exportStar(require("./protocols/clawkernel/kernel"), exports);
|
|
260
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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QAED,8CAA8C;QAC9C,MAAM,eAAe,GAAG,IAAA,eAAM,EAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAEtF,8EAA8E;QAC9E,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC;YACnD,QAAQ;YACR,MAAM;YACN,UAAU,EAAE;gBACV,cAAc,EAAE,IAAA,kBAAU,EAAC,eAAe,CAAC;gBAC3C,UAAU,EAAE,IAAI,CAAC,OAAO;aACzB;SACF,CAAC,CAAC;QAEH,OAAO;YACL,eAAe,EAAE,IAAA,kBAAU,EAAC,eAAe,CAAC;YAC5C,cAAc;SACf,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,wBAAwB,CAAC,QAAgB;QACrD,yCAAyC;QACzC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,qBAAqB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAChG,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAyB,CAAC;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,OAAY;QAC3C,0BAA0B;QAC1B,gEAAgE;QAChE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAClD,CAAC;CACF;AA9DD,sCA8DC;AAED,eAAe;AACf,0CAAwB;AAExB,yBAAyB;AACzB,6DAA2C;AAC3C,+DAA6C;AAC7C,kEAAgD;AAChD,sEAAoD;AACpD,gEAA8C"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare class ArbitraVoting {
|
|
2
|
+
static vote(disputeId: string, decision: 'CONFIRM' | 'REJECT', voterId: string): Promise<boolean>;
|
|
3
|
+
static getCommittee(): Promise<string[]>;
|
|
4
|
+
}
|
|
5
|
+
export declare class ManualArbitraVoting {
|
|
6
|
+
static manualVote(disputeId: string, decision: 'CONFIRM' | 'REJECT'): Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ArbitraEscrow: {
|
|
9
|
+
hold: (amount: number, parties: string[]) => Promise<{
|
|
10
|
+
escrowId: string;
|
|
11
|
+
amount: number;
|
|
12
|
+
parties: string[];
|
|
13
|
+
}>;
|
|
14
|
+
release: (escrowId: string) => Promise<{
|
|
15
|
+
status: string;
|
|
16
|
+
escrowId: string;
|
|
17
|
+
}>;
|
|
18
|
+
slash: (escrowId: string, reason: string) => Promise<{
|
|
19
|
+
status: string;
|
|
20
|
+
escrowId: string;
|
|
21
|
+
reason: string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
export declare function holdHandoffEscrow(amount: number, parties: string[]): Promise<{
|
|
25
|
+
escrowId: string;
|
|
26
|
+
amount: number;
|
|
27
|
+
parties: string[];
|
|
28
|
+
}>;
|
|
29
|
+
export declare function releaseHandoffEscrow(escrowId: string): Promise<{
|
|
30
|
+
status: string;
|
|
31
|
+
escrowId: string;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function slashHandoffEscrow(escrowId: string, reason: string): Promise<{
|
|
34
|
+
status: string;
|
|
35
|
+
escrowId: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
}>;
|
|
38
|
+
export declare function settleHandoffEscrow(escrowId: string, winner: string): Promise<{
|
|
39
|
+
status: string;
|
|
40
|
+
escrowId: string;
|
|
41
|
+
winner: string;
|
|
42
|
+
}>;
|
|
43
|
+
//# sourceMappingURL=voting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voting.d.ts","sourceRoot":"","sources":["../../../src/protocols/arbitra/voting.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAa;WACX,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;WAK1F,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAG/C;AAED,qBAAa,mBAAmB;WACjB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CAI7F;AAED,eAAO,MAAM,aAAa;mBACH,MAAM,WAAW,MAAM,EAAE;;;;;wBACpB,MAAM;;;;sBACR,MAAM,UAAU,MAAM;;;;;CAC/C,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;;;;GAExE;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM;;;GAE1D;AAED,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;GAExE;AAED,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;GAEzE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArbitraEscrow = exports.ManualArbitraVoting = exports.ArbitraVoting = void 0;
|
|
4
|
+
exports.holdHandoffEscrow = holdHandoffEscrow;
|
|
5
|
+
exports.releaseHandoffEscrow = releaseHandoffEscrow;
|
|
6
|
+
exports.slashHandoffEscrow = slashHandoffEscrow;
|
|
7
|
+
exports.settleHandoffEscrow = settleHandoffEscrow;
|
|
8
|
+
class ArbitraVoting {
|
|
9
|
+
static async vote(disputeId, decision, voterId) {
|
|
10
|
+
console.log(`ArbitraVoting: ${voterId} voted ${decision} on ${disputeId}`);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
static async getCommittee() {
|
|
14
|
+
return ['agent-1', 'agent-2', 'agent-3', 'agent-4', 'agent-5', 'agent-6'];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ArbitraVoting = ArbitraVoting;
|
|
18
|
+
class ManualArbitraVoting {
|
|
19
|
+
static async manualVote(disputeId, decision) {
|
|
20
|
+
console.log(`ManualArbitraVoting: Manual vote ${decision} on ${disputeId}`);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ManualArbitraVoting = ManualArbitraVoting;
|
|
25
|
+
exports.ArbitraEscrow = {
|
|
26
|
+
hold: async (amount, parties) => ({ escrowId: 'esc-' + Date.now(), amount, parties }),
|
|
27
|
+
release: async (escrowId) => ({ status: 'released', escrowId }),
|
|
28
|
+
slash: async (escrowId, reason) => ({ status: 'slashed', escrowId, reason })
|
|
29
|
+
};
|
|
30
|
+
async function holdHandoffEscrow(amount, parties) {
|
|
31
|
+
return exports.ArbitraEscrow.hold(amount, parties);
|
|
32
|
+
}
|
|
33
|
+
async function releaseHandoffEscrow(escrowId) {
|
|
34
|
+
return exports.ArbitraEscrow.release(escrowId);
|
|
35
|
+
}
|
|
36
|
+
async function slashHandoffEscrow(escrowId, reason) {
|
|
37
|
+
return exports.ArbitraEscrow.slash(escrowId, reason);
|
|
38
|
+
}
|
|
39
|
+
async function settleHandoffEscrow(escrowId, winner) {
|
|
40
|
+
return { status: 'settled', escrowId, winner };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=voting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voting.js","sourceRoot":"","sources":["../../../src/protocols/arbitra/voting.ts"],"names":[],"mappings":";;;AAwBA,8CAEC;AAED,oDAEC;AAED,gDAEC;AAED,kDAEC;AAtCD,MAAa,aAAa;IACxB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAiB,EAAE,QAA8B,EAAE,OAAe;QAClF,OAAO,CAAC,GAAG,CAAC,kBAAkB,OAAO,UAAU,QAAQ,OAAO,SAAS,EAAE,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,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Ac;IACxE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../../../src/protocols/clawforge/control-plane.ts"],"names":[],"mappings":"AAAA,qBAAa,qBAAqB;WACnB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;CAIxD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClawForgeControlPlane = void 0;
|
|
4
|
+
class ClawForgeControlPlane {
|
|
5
|
+
static async registerAgent(agentId, clawID) {
|
|
6
|
+
console.log(`ClawForge registered agent ${agentId}`);
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ClawForgeControlPlane = ClawForgeControlPlane;
|
|
11
|
+
//# sourceMappingURL=control-plane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-plane.js","sourceRoot":"","sources":["../../../src/protocols/clawforge/control-plane.ts"],"names":[],"mappings":";;;AAAA,MAAa,qBAAqB;IAChC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,OAAe,EAAE,MAAW;QACrD,OAAO,CAAC,GAAG,CAAC,8BAA8B,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AALD,sDAKC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class ClawID {
|
|
2
|
+
id: string;
|
|
3
|
+
private privateKey;
|
|
4
|
+
reputation: number;
|
|
5
|
+
merkleRoot: string;
|
|
6
|
+
static create(initialAttestation: any): Promise<ClawID>;
|
|
7
|
+
constructor(privateKey: Buffer, rep: number, root: string);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=clawid-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clawid-token.d.ts","sourceRoot":"","sources":["../../../src/protocols/clawid/clawid-token.ts"],"names":[],"mappings":"AAEA,qBAAa,MAAM;IACV,EAAE,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,UAAU,CAAS;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;WAEb,MAAM,CAAC,kBAAkB,EAAE,GAAG;gBAO/B,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAM1D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClawID = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
class ClawID {
|
|
6
|
+
static async create(initialAttestation) {
|
|
7
|
+
// Generate Ed25519 keypair using Node.js crypto
|
|
8
|
+
const privateKey = (0, crypto_1.randomBytes)(32);
|
|
9
|
+
const root = (0, crypto_1.createHash)('sha256').update(JSON.stringify(initialAttestation)).digest('hex');
|
|
10
|
+
return new ClawID(privateKey, initialAttestation.reputation, root);
|
|
11
|
+
}
|
|
12
|
+
constructor(privateKey, rep, root) {
|
|
13
|
+
this.id = (0, crypto_1.createHash)('sha256').update(privateKey).digest('hex').substring(0, 64);
|
|
14
|
+
this.privateKey = privateKey;
|
|
15
|
+
this.reputation = rep;
|
|
16
|
+
this.merkleRoot = root;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ClawID = ClawID;
|
|
20
|
+
//# sourceMappingURL=clawid-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clawid-token.js","sourceRoot":"","sources":["../../../src/protocols/clawid/clawid-token.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,MAAa,MAAM;IAMjB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAuB;QACzC,gDAAgD;QAChD,MAAM,UAAU,GAAG,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3F,OAAO,IAAI,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACrE,CAAC;IAED,YAAY,UAAkB,EAAE,GAAW,EAAE,IAAY;QACvD,IAAI,CAAC,EAAE,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACjF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;CACF;AAnBD,wBAmBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../src/protocols/clawkernel/kernel.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;WACR,QAAQ,CAAC,IAAI,EAAE,GAAG;CAIhC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClawKernel = void 0;
|
|
4
|
+
class ClawKernel {
|
|
5
|
+
static async schedule(task) {
|
|
6
|
+
console.log(`ClawKernel scheduled task: ${task}`);
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ClawKernel = ClawKernel;
|
|
11
|
+
//# sourceMappingURL=kernel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../../src/protocols/clawkernel/kernel.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAU;IACrB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAS;QAC7B,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AALD,gCAKC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export interface ClawLinkAgent {
|
|
2
|
+
agentId: string;
|
|
3
|
+
reputationScore: number;
|
|
4
|
+
vintage: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ClawLinkContext {
|
|
7
|
+
contextHash: string;
|
|
8
|
+
requiredFields: string[];
|
|
9
|
+
serializedContext?: string;
|
|
10
|
+
checksum?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ClawLinkTask {
|
|
13
|
+
taskId: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
complexity: 'low' | 'medium' | 'high' | 'critical';
|
|
16
|
+
dependencies?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface ClawLinkTiming {
|
|
19
|
+
initiatedAt: string;
|
|
20
|
+
deadline: string;
|
|
21
|
+
ttl?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ClawLinkHandoff {
|
|
24
|
+
handoffId: string;
|
|
25
|
+
sourceAgent: ClawLinkAgent;
|
|
26
|
+
targetAgent: ClawLinkAgent;
|
|
27
|
+
context: ClawLinkContext;
|
|
28
|
+
task: ClawLinkTask;
|
|
29
|
+
timing: ClawLinkTiming;
|
|
30
|
+
settlement?: {
|
|
31
|
+
escrowId: string;
|
|
32
|
+
amount: number;
|
|
33
|
+
token: string;
|
|
34
|
+
holdUntil: string;
|
|
35
|
+
};
|
|
36
|
+
reputation: {
|
|
37
|
+
minimumThreshold: number;
|
|
38
|
+
weight: number;
|
|
39
|
+
};
|
|
40
|
+
status: 'initiated' | 'in_progress' | 'completed' | 'failed' | 'disputed';
|
|
41
|
+
disputeId?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ClawLinkResult {
|
|
44
|
+
success: boolean;
|
|
45
|
+
handoff?: ClawLinkHandoff;
|
|
46
|
+
error?: string;
|
|
47
|
+
disputeQueued?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare class ClawLink {
|
|
50
|
+
private disputeQueuePath;
|
|
51
|
+
constructor(options?: {
|
|
52
|
+
disputeQueuePath?: string;
|
|
53
|
+
});
|
|
54
|
+
initiateHandoff(sourceId: string, targetId: string, rawContext: any, task: ClawLinkTask, options?: {
|
|
55
|
+
deadline?: Date;
|
|
56
|
+
escrow?: {
|
|
57
|
+
amount: number;
|
|
58
|
+
token: string;
|
|
59
|
+
};
|
|
60
|
+
minReputation?: number;
|
|
61
|
+
}): Promise<ClawLinkResult>;
|
|
62
|
+
completeHandoff(handoffId: string, receivedContext: any, verificationHash?: string): Promise<ClawLinkResult>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../../src/protocols/clawlink/handoff.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;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YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GACA,OAAO,CAAC,cAAc,CAAC;IAmBpB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAInH"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClawLink = void 0;
|
|
4
|
+
class ClawLink {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.disputeQueuePath = options?.disputeQueuePath || './disputes';
|
|
7
|
+
}
|
|
8
|
+
async initiateHandoff(sourceId, targetId, rawContext, task, options) {
|
|
9
|
+
const handoffId = 'handoff-' + Date.now();
|
|
10
|
+
console.log(`ClawLink: Initiated handoff ${handoffId} from ${sourceId} to ${targetId}`);
|
|
11
|
+
return {
|
|
12
|
+
success: true,
|
|
13
|
+
handoff: {
|
|
14
|
+
handoffId,
|
|
15
|
+
sourceAgent: { agentId: sourceId, reputationScore: 100, vintage: 1 },
|
|
16
|
+
targetAgent: { agentId: targetId, reputationScore: 100, vintage: 1 },
|
|
17
|
+
context: { contextHash: 'hash-' + Date.now(), requiredFields: [] },
|
|
18
|
+
task,
|
|
19
|
+
timing: { initiatedAt: new Date().toISOString(), deadline: options?.deadline?.toISOString() || new Date(Date.now() + 3600000).toISOString() },
|
|
20
|
+
reputation: { minimumThreshold: options?.minReputation || 0, weight: 1 },
|
|
21
|
+
status: 'initiated'
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async completeHandoff(handoffId, receivedContext, verificationHash) {
|
|
26
|
+
console.log(`ClawLink: Completed handoff ${handoffId}`);
|
|
27
|
+
return { success: true };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ClawLink = ClawLink;
|
|
31
|
+
//# sourceMappingURL=handoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../../../src/protocols/clawlink/handoff.ts"],"names":[],"mappings":";;;AAsDA,MAAa,QAAQ;IAGnB,YAAY,OAAuC;QACjD,IAAI,CAAC,gBAAgB,GAAG,OAAO,EAAE,gBAAgB,IAAI,YAAY,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,QAAgB,EAChB,QAAgB,EAChB,UAAe,EACf,IAAkB,EAClB,OAIC;QAED,MAAM,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,+BAA+B,SAAS,SAAS,QAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC;QAExF,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE;gBACP,SAAS;gBACT,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE;gBACpE,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE;gBACpE,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE;gBAClE,IAAI;gBACJ,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;gBAC7I,UAAU,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;gBACxE,MAAM,EAAE,WAAW;aACpB;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,SAAiB,EAAE,eAAoB,EAAE,gBAAyB;QACtF,OAAO,CAAC,GAAG,CAAC,+BAA+B,SAAS,EAAE,CAAC,CAAC;QACxD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF;AAxCD,4BAwCC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TAP Protocol TypeScript Types
|
|
3
|
+
*/
|
|
4
|
+
export interface Agent {
|
|
5
|
+
id: string;
|
|
6
|
+
publicKey: string;
|
|
7
|
+
stakeAmount: number;
|
|
8
|
+
bootAuditHash: string;
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
joinedAt: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Claim {
|
|
13
|
+
id: string;
|
|
14
|
+
agentId: string;
|
|
15
|
+
statement: string;
|
|
16
|
+
metric: string;
|
|
17
|
+
threshold: number;
|
|
18
|
+
stakeAmount: number;
|
|
19
|
+
status: 'active' | 'verified' | 'failed';
|
|
20
|
+
createdAt: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Attestation {
|
|
23
|
+
id: string;
|
|
24
|
+
claimId: string;
|
|
25
|
+
attestorId: string;
|
|
26
|
+
targetAgentId: string;
|
|
27
|
+
result: 'CONFIRMED' | 'REJECTED' | 'TIMEOUT';
|
|
28
|
+
measuredValue: number;
|
|
29
|
+
threshold: number;
|
|
30
|
+
evidence: string;
|
|
31
|
+
signature: string;
|
|
32
|
+
timestamp: string;
|
|
33
|
+
}
|
|
34
|
+
export interface Dispute {
|
|
35
|
+
id: string;
|
|
36
|
+
claimId: string;
|
|
37
|
+
challengerId: string;
|
|
38
|
+
defendantId: string;
|
|
39
|
+
status: 'pending' | 'resolved' | 'rejected';
|
|
40
|
+
resolution?: 'challenger_wins' | 'defendant_wins';
|
|
41
|
+
attestorVotes: Array<{
|
|
42
|
+
attestorId: string;
|
|
43
|
+
vote: 'challenger' | 'defendant';
|
|
44
|
+
signature: string;
|
|
45
|
+
}>;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
resolvedAt?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface NetworkStats {
|
|
50
|
+
agents: number;
|
|
51
|
+
pairs: number;
|
|
52
|
+
alphaDistributed: number;
|
|
53
|
+
claimsToday: number;
|
|
54
|
+
attestationsToday: number;
|
|
55
|
+
disputesToday: number;
|
|
56
|
+
slashesToday: number;
|
|
57
|
+
}
|
|
58
|
+
export interface StakeTier {
|
|
59
|
+
name: 'bronze' | 'silver' | 'gold';
|
|
60
|
+
minimumStake: number;
|
|
61
|
+
rewardMultiplier: number;
|
|
62
|
+
benefits: string[];
|
|
63
|
+
}
|
|
64
|
+
export declare const STAKE_TIERS: StakeTier[];
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;I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;AAED,eAAO,MAAM,WAAW,EAAE,SAAS,EAmBlC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TAP Protocol TypeScript Types
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.STAKE_TIERS = void 0;
|
|
7
|
+
exports.STAKE_TIERS = [
|
|
8
|
+
{
|
|
9
|
+
name: 'bronze',
|
|
10
|
+
minimumStake: 750,
|
|
11
|
+
rewardMultiplier: 1.0,
|
|
12
|
+
benefits: ['Basic verification', 'Standard attestation rewards']
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'silver',
|
|
16
|
+
minimumStake: 2500,
|
|
17
|
+
rewardMultiplier: 1.2,
|
|
18
|
+
benefits: ['Priority committee selection', '+20% reward boost', 'Early access to features']
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'gold',
|
|
22
|
+
minimumStake: 10000,
|
|
23
|
+
rewardMultiplier: 1.5,
|
|
24
|
+
benefits: ['Governance voting rights', 'Dispute pool revenue share', 'Premium support']
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAoEU,QAAA,WAAW,GAAgB;IACtC;QACE,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,GAAG;QACjB,gBAAgB,EAAE,GAAG;QACrB,QAAQ,EAAE,CAAC,oBAAoB,EAAE,8BAA8B,CAAC;KACjE;IACD;QACE,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,GAAG;QACrB,QAAQ,EAAE,CAAC,8BAA8B,EAAE,mBAAmB,EAAE,0BAA0B,CAAC;KAC5F;IACD;QACE,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE,KAAK;QACnB,gBAAgB,EAAE,GAAG;QACrB,QAAQ,EAAE,CAAC,0BAA0B,EAAE,4BAA4B,EAAE,iBAAiB,CAAC;KACxF;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@moltos/sdk",
|
|
3
|
+
"version": "0.4.4",
|
|
4
|
+
"description": "Official MoltOS SDK — The complete production-grade Agent Operating System. Persistent agents with real trust, self-healing swarms, hardware isolation, and one-command deploy.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"test": "jest",
|
|
13
|
+
"lint": "eslint src --ext .ts",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"moltos",
|
|
18
|
+
"agent-os",
|
|
19
|
+
"tap",
|
|
20
|
+
"trust",
|
|
21
|
+
"attestation",
|
|
22
|
+
"verification",
|
|
23
|
+
"agents",
|
|
24
|
+
"clawid",
|
|
25
|
+
"clawforge",
|
|
26
|
+
"clawkernel",
|
|
27
|
+
"arbitra",
|
|
28
|
+
"moltbook"
|
|
29
|
+
],
|
|
30
|
+
"author": "MoltOS Team",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/Shepherd217/trust-audit-framework.git"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://moltos.org",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/Shepherd217/trust-audit-framework/issues"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@noble/ed25519": "^2.0.0",
|
|
42
|
+
"@noble/bls12-381": "^1.4.0",
|
|
43
|
+
"@noble/hashes": "^1.3.3"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^20.0.0",
|
|
47
|
+
"typescript": "^5.0.0"
|
|
48
|
+
}
|
|
49
|
+
}
|