@aiassesstech/nole 0.1.9 → 0.2.0
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/CHANGELOG.md +8 -0
- package/README.md +149 -39
- package/agent/AGENTS.md +53 -0
- package/agent/IDENTITY.md +4 -2
- package/agent/SOUL.md +45 -4
- package/dist/cli/configure.d.ts +36 -0
- package/dist/cli/configure.d.ts.map +1 -0
- package/dist/cli/configure.js +243 -0
- package/dist/cli/configure.js.map +1 -0
- package/dist/cli/runner.d.ts +4 -3
- package/dist/cli/runner.d.ts.map +1 -1
- package/dist/cli/runner.js +81 -27
- package/dist/cli/runner.js.map +1 -1
- package/dist/compsi/api-client.d.ts +62 -0
- package/dist/compsi/api-client.d.ts.map +1 -0
- package/dist/compsi/api-client.js +147 -0
- package/dist/compsi/api-client.js.map +1 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +320 -38
- package/dist/plugin.js.map +1 -1
- package/dist/types/nole-config.d.ts +12 -3
- package/dist/types/nole-config.d.ts.map +1 -1
- package/dist/types/nole-config.js +6 -2
- package/dist/types/nole-config.js.map +1 -1
- package/dist/wallet/coinbase-adapter.d.ts +38 -0
- package/dist/wallet/coinbase-adapter.d.ts.map +1 -0
- package/dist/wallet/coinbase-adapter.js +191 -0
- package/dist/wallet/coinbase-adapter.js.map +1 -0
- package/dist/wallet/index.d.ts +20 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +34 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/wallet/mock-adapter.d.ts +23 -0
- package/dist/wallet/mock-adapter.d.ts.map +1 -0
- package/dist/wallet/mock-adapter.js +62 -0
- package/dist/wallet/mock-adapter.js.map +1 -0
- package/dist/wallet/types.d.ts +30 -0
- package/dist/wallet/types.d.ts.map +1 -0
- package/dist/wallet/types.js +8 -0
- package/dist/wallet/types.js.map +1 -0
- package/openclaw.plugin.json +19 -0
- package/package.json +10 -2
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive configuration wizard for Nole
|
|
3
|
+
*
|
|
4
|
+
* Handles credential collection, wallet creation, and env var generation.
|
|
5
|
+
* Runs as: `npx nole configure`
|
|
6
|
+
*
|
|
7
|
+
* Stores credentials at ~/.nole/credentials (chmod 600)
|
|
8
|
+
* Supports both first-time setup and reconfiguration.
|
|
9
|
+
*/
|
|
10
|
+
import { readFile, writeFile, mkdir, chmod } from 'node:fs/promises';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { existsSync } from 'node:fs';
|
|
13
|
+
import { homedir } from 'node:os';
|
|
14
|
+
import { createInterface } from 'node:readline';
|
|
15
|
+
// ─── Constants ───
|
|
16
|
+
const NOLE_DIR = join(homedir(), '.nole');
|
|
17
|
+
const CREDENTIALS_PATH = join(NOLE_DIR, 'credentials');
|
|
18
|
+
const CREDENTIALS_VERSION = 1;
|
|
19
|
+
const BASE_SEPOLIA_CONTRACT = '0x42C5D4b5ca0C0a63a57FA29B201749Dcf7888aF7';
|
|
20
|
+
const BASE_MAINNET_CONTRACT = ''; // Not deployed yet
|
|
21
|
+
// ─── Public API ───
|
|
22
|
+
export async function configure(options) {
|
|
23
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
24
|
+
const ask = (q) => new Promise(resolve => rl.question(q, resolve));
|
|
25
|
+
const askSecret = (q) => new Promise(resolve => rl.question(q, resolve));
|
|
26
|
+
try {
|
|
27
|
+
console.log('');
|
|
28
|
+
console.log('╔══════════════════════════════════════════════════════════╗');
|
|
29
|
+
console.log('║ NOLE — Configuration Wizard ║');
|
|
30
|
+
console.log('║ Autonomous Trust Evangelist Setup ║');
|
|
31
|
+
console.log('╚══════════════════════════════════════════════════════════╝');
|
|
32
|
+
console.log('');
|
|
33
|
+
const existing = await loadCredentials();
|
|
34
|
+
if (existing && !options.reconfigure) {
|
|
35
|
+
console.log(' Existing configuration found.');
|
|
36
|
+
console.log(` Wallet: ${existing.walletAddress || 'not created'}`);
|
|
37
|
+
console.log(` Network: ${existing.network || 'not set'}`);
|
|
38
|
+
console.log(` Configured: ${existing.configuredAt || 'unknown'}`);
|
|
39
|
+
console.log('');
|
|
40
|
+
const update = options.nonInteractive
|
|
41
|
+
? 'y'
|
|
42
|
+
: await ask(' Update existing configuration? (y/N): ');
|
|
43
|
+
if (!update.toLowerCase().startsWith('y')) {
|
|
44
|
+
console.log(' Configuration unchanged.');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
console.log('');
|
|
48
|
+
}
|
|
49
|
+
// Step 1: Network selection
|
|
50
|
+
console.log('─── Step 1: Network ───');
|
|
51
|
+
console.log('');
|
|
52
|
+
console.log(' [1] Base Sepolia (testnet) — free, for testing');
|
|
53
|
+
console.log(' [2] Base Mainnet — real money, for production');
|
|
54
|
+
console.log('');
|
|
55
|
+
let network = options.network;
|
|
56
|
+
if (!network) {
|
|
57
|
+
const choice = options.nonInteractive
|
|
58
|
+
? '1'
|
|
59
|
+
: await ask(' Select network (1 or 2) [1]: ');
|
|
60
|
+
network = choice === '2' ? 'base' : 'base-sepolia';
|
|
61
|
+
}
|
|
62
|
+
console.log(` Network: ${network}`);
|
|
63
|
+
console.log('');
|
|
64
|
+
// Step 2: CDP Credentials
|
|
65
|
+
console.log('─── Step 2: Coinbase Developer Platform Credentials ───');
|
|
66
|
+
console.log('');
|
|
67
|
+
console.log(' Get these from: https://portal.cdp.coinbase.com/');
|
|
68
|
+
console.log(' You need a Server Wallet API key with Export + Manage permissions.');
|
|
69
|
+
console.log('');
|
|
70
|
+
const cdpApiKeyId = options.cdpApiKeyId
|
|
71
|
+
|| existing?.cdpApiKeyId
|
|
72
|
+
|| await ask(' CDP API Key ID: ');
|
|
73
|
+
if (!cdpApiKeyId?.trim()) {
|
|
74
|
+
console.log('\n CDP API Key ID is required. Aborting.');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const cdpApiKeySecret = options.cdpApiKeySecret
|
|
78
|
+
|| existing?.cdpApiKeySecret
|
|
79
|
+
|| await askSecret(' CDP API Key Secret: ');
|
|
80
|
+
if (!cdpApiKeySecret?.trim()) {
|
|
81
|
+
console.log('\n CDP API Key Secret is required. Aborting.');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const cdpWalletSecret = options.cdpWalletSecret
|
|
85
|
+
|| existing?.cdpWalletSecret
|
|
86
|
+
|| await askSecret(' CDP Wallet Secret: ');
|
|
87
|
+
if (!cdpWalletSecret?.trim()) {
|
|
88
|
+
console.log('\n CDP Wallet Secret is required. Aborting.');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
console.log(' Credentials received.');
|
|
92
|
+
console.log('');
|
|
93
|
+
// Step 3: Create wallet
|
|
94
|
+
let walletAddress = existing?.walletAddress || '';
|
|
95
|
+
if (!options.skipWallet) {
|
|
96
|
+
console.log('─── Step 3: Creating Nole\'s Wallet ───');
|
|
97
|
+
console.log('');
|
|
98
|
+
try {
|
|
99
|
+
walletAddress = await createNoleWallet({
|
|
100
|
+
cdpApiKeyId: cdpApiKeyId.trim(),
|
|
101
|
+
cdpApiKeySecret: cdpApiKeySecret.trim(),
|
|
102
|
+
cdpWalletSecret: cdpWalletSecret.trim(),
|
|
103
|
+
network,
|
|
104
|
+
});
|
|
105
|
+
console.log(` Wallet address: ${walletAddress}`);
|
|
106
|
+
if (network === 'base-sepolia') {
|
|
107
|
+
console.log(' Requesting testnet ETH from faucet...');
|
|
108
|
+
try {
|
|
109
|
+
await fundFromFaucet({
|
|
110
|
+
cdpApiKeyId: cdpApiKeyId.trim(),
|
|
111
|
+
cdpApiKeySecret: cdpApiKeySecret.trim(),
|
|
112
|
+
cdpWalletSecret: cdpWalletSecret.trim(),
|
|
113
|
+
address: walletAddress,
|
|
114
|
+
});
|
|
115
|
+
console.log(' Testnet ETH funded.');
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
console.log(` Faucet: ${err instanceof Error ? err.message : err}`);
|
|
119
|
+
console.log(' (You can fund manually later)');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
console.error(` Wallet creation failed: ${err instanceof Error ? err.message : err}`);
|
|
125
|
+
console.log(' You can retry with: npx nole configure --reconfigure');
|
|
126
|
+
console.log('');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
console.log('─── Step 3: Wallet creation skipped ───');
|
|
131
|
+
}
|
|
132
|
+
console.log('');
|
|
133
|
+
// Step 4: CompSi API Key (optional)
|
|
134
|
+
console.log('─── Step 4: CompSi Platform (Optional) ───');
|
|
135
|
+
console.log('');
|
|
136
|
+
console.log(' If you already have a CompSi Agent API key (agk_...), enter it now.');
|
|
137
|
+
console.log(' Otherwise, Nole will obtain one when he subscribes.');
|
|
138
|
+
console.log('');
|
|
139
|
+
const compsiApiKey = existing?.compsiAgentApiKey
|
|
140
|
+
|| (options.nonInteractive ? '' : await ask(' CompSi Agent API Key (or press Enter to skip): '));
|
|
141
|
+
const compsiApiUrl = existing?.compsiApiUrl || 'https://aiassess.tech';
|
|
142
|
+
const contractAddress = network === 'base'
|
|
143
|
+
? BASE_MAINNET_CONTRACT
|
|
144
|
+
: BASE_SEPOLIA_CONTRACT;
|
|
145
|
+
// Step 5: Save credentials
|
|
146
|
+
console.log('');
|
|
147
|
+
console.log('─── Step 5: Saving Configuration ───');
|
|
148
|
+
const credentials = {
|
|
149
|
+
cdpApiKeyId: cdpApiKeyId.trim(),
|
|
150
|
+
cdpApiKeySecret: cdpApiKeySecret.trim(),
|
|
151
|
+
cdpWalletSecret: cdpWalletSecret.trim(),
|
|
152
|
+
compsiApiUrl,
|
|
153
|
+
compsiAgentApiKey: compsiApiKey?.trim() || undefined,
|
|
154
|
+
walletAddress,
|
|
155
|
+
network,
|
|
156
|
+
contractAddress,
|
|
157
|
+
configuredAt: new Date().toISOString(),
|
|
158
|
+
version: CREDENTIALS_VERSION,
|
|
159
|
+
};
|
|
160
|
+
await saveCredentials(credentials);
|
|
161
|
+
console.log(` Credentials saved to: ${CREDENTIALS_PATH}`);
|
|
162
|
+
console.log(' (File permissions: owner-only read/write)');
|
|
163
|
+
console.log('');
|
|
164
|
+
// Summary
|
|
165
|
+
console.log('╔══════════════════════════════════════════════════════════╗');
|
|
166
|
+
console.log('║ CONFIGURATION COMPLETE ║');
|
|
167
|
+
console.log('╚══════════════════════════════════════════════════════════╝');
|
|
168
|
+
console.log('');
|
|
169
|
+
console.log(` Network: ${network}`);
|
|
170
|
+
console.log(` Wallet: ${walletAddress || 'not created'}`);
|
|
171
|
+
console.log(` Contract: ${contractAddress || 'not deployed yet'}`);
|
|
172
|
+
console.log(` CompSi API Key: ${compsiApiKey ? 'configured' : 'not set (will obtain on subscribe)'}`);
|
|
173
|
+
console.log(` Credentials: ${CREDENTIALS_PATH}`);
|
|
174
|
+
console.log('');
|
|
175
|
+
if (walletAddress && network === 'base-sepolia') {
|
|
176
|
+
console.log(` Explorer: https://sepolia.basescan.org/address/${walletAddress}`);
|
|
177
|
+
}
|
|
178
|
+
else if (walletAddress) {
|
|
179
|
+
console.log(` Explorer: https://basescan.org/address/${walletAddress}`);
|
|
180
|
+
}
|
|
181
|
+
console.log('');
|
|
182
|
+
console.log(' Next steps:');
|
|
183
|
+
console.log(' 1. Run `npx nole setup` to register with OpenClaw (if not done)');
|
|
184
|
+
console.log(' 2. Restart the OpenClaw gateway to activate Nole');
|
|
185
|
+
console.log(' 3. Nole will use these credentials automatically');
|
|
186
|
+
console.log('');
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
rl.close();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// ─── Credential Storage ───
|
|
193
|
+
export async function loadCredentials() {
|
|
194
|
+
if (!existsSync(CREDENTIALS_PATH))
|
|
195
|
+
return null;
|
|
196
|
+
try {
|
|
197
|
+
const raw = await readFile(CREDENTIALS_PATH, 'utf-8');
|
|
198
|
+
return JSON.parse(raw);
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
export async function saveCredentials(creds) {
|
|
205
|
+
await mkdir(NOLE_DIR, { recursive: true });
|
|
206
|
+
await writeFile(CREDENTIALS_PATH, JSON.stringify(creds, null, 2), 'utf-8');
|
|
207
|
+
try {
|
|
208
|
+
await chmod(CREDENTIALS_PATH, 0o600);
|
|
209
|
+
await chmod(NOLE_DIR, 0o700);
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
// chmod may fail on Windows; non-critical
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
export function getCredentialsPath() {
|
|
216
|
+
return CREDENTIALS_PATH;
|
|
217
|
+
}
|
|
218
|
+
async function createNoleWallet(opts) {
|
|
219
|
+
const { CdpClient } = await import('@coinbase/cdp-sdk');
|
|
220
|
+
const client = new CdpClient({
|
|
221
|
+
apiKeyId: opts.cdpApiKeyId,
|
|
222
|
+
apiKeySecret: opts.cdpApiKeySecret,
|
|
223
|
+
walletSecret: opts.cdpWalletSecret,
|
|
224
|
+
});
|
|
225
|
+
const account = await client.evm.getOrCreateAccount({
|
|
226
|
+
name: 'nole-agent-wallet',
|
|
227
|
+
});
|
|
228
|
+
return account.address;
|
|
229
|
+
}
|
|
230
|
+
async function fundFromFaucet(opts) {
|
|
231
|
+
const { CdpClient } = await import('@coinbase/cdp-sdk');
|
|
232
|
+
const client = new CdpClient({
|
|
233
|
+
apiKeyId: opts.cdpApiKeyId,
|
|
234
|
+
apiKeySecret: opts.cdpApiKeySecret,
|
|
235
|
+
walletSecret: opts.cdpWalletSecret,
|
|
236
|
+
});
|
|
237
|
+
await client.evm.requestFaucet({
|
|
238
|
+
address: opts.address,
|
|
239
|
+
network: 'base-sepolia',
|
|
240
|
+
token: 'eth',
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=configure.js.map
|
|
@@ -0,0 +1 @@
|
|
|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OAAO,EAAE,cAAc;QACvB,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;AACL,CAAC"}
|
package/dist/cli/runner.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* CLI dispatcher for @aiassesstech/nole
|
|
3
3
|
*
|
|
4
4
|
* Usage:
|
|
5
|
-
* npx
|
|
6
|
-
*
|
|
7
|
-
* npx
|
|
5
|
+
* npx nole configure Interactive credential & wallet setup
|
|
6
|
+
* npx nole setup [options] Register Nole with OpenClaw + upgrade Commander
|
|
7
|
+
* npx nole status Show current configuration status
|
|
8
|
+
* npx nole --help Show help
|
|
8
9
|
*/
|
|
9
10
|
export declare function run(args: string[]): Promise<void>;
|
|
10
11
|
//# sourceMappingURL=runner.d.ts.map
|
package/dist/cli/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/cli/runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/cli/runner.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CvD"}
|
package/dist/cli/runner.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { setup } from './setup.js';
|
|
2
|
+
import { configure, loadCredentials, getCredentialsPath } from './configure.js';
|
|
2
3
|
/**
|
|
3
4
|
* CLI dispatcher for @aiassesstech/nole
|
|
4
5
|
*
|
|
5
6
|
* Usage:
|
|
6
|
-
* npx
|
|
7
|
-
*
|
|
8
|
-
* npx
|
|
7
|
+
* npx nole configure Interactive credential & wallet setup
|
|
8
|
+
* npx nole setup [options] Register Nole with OpenClaw + upgrade Commander
|
|
9
|
+
* npx nole status Show current configuration status
|
|
10
|
+
* npx nole --help Show help
|
|
9
11
|
*/
|
|
10
12
|
export async function run(args) {
|
|
11
13
|
const command = args[0];
|
|
@@ -13,6 +15,19 @@ export async function run(args) {
|
|
|
13
15
|
printHelp();
|
|
14
16
|
return;
|
|
15
17
|
}
|
|
18
|
+
if (command === 'configure' || command === 'config') {
|
|
19
|
+
const flags = parseFlags(args.slice(1));
|
|
20
|
+
await configure({
|
|
21
|
+
network: flags['network'],
|
|
22
|
+
nonInteractive: 'non-interactive' in flags || 'yes' in flags,
|
|
23
|
+
cdpApiKeyId: flags['cdp-api-key-id'],
|
|
24
|
+
cdpApiKeySecret: flags['cdp-api-key-secret'],
|
|
25
|
+
cdpWalletSecret: flags['cdp-wallet-secret'],
|
|
26
|
+
skipWallet: 'skip-wallet' in flags,
|
|
27
|
+
reconfigure: 'reconfigure' in flags || 'force' in flags,
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
16
31
|
if (command === 'setup') {
|
|
17
32
|
const flags = parseFlags(args.slice(1));
|
|
18
33
|
await setup({
|
|
@@ -25,42 +40,81 @@ export async function run(args) {
|
|
|
25
40
|
});
|
|
26
41
|
return;
|
|
27
42
|
}
|
|
43
|
+
if (command === 'status') {
|
|
44
|
+
await showStatus();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
28
47
|
console.error(`Unknown command: ${command}`);
|
|
29
48
|
printHelp();
|
|
30
49
|
process.exit(1);
|
|
31
50
|
}
|
|
51
|
+
async function showStatus() {
|
|
52
|
+
console.log('');
|
|
53
|
+
console.log('NOLE — Configuration Status');
|
|
54
|
+
console.log('─'.repeat(40));
|
|
55
|
+
const creds = await loadCredentials();
|
|
56
|
+
const credsPath = getCredentialsPath();
|
|
57
|
+
if (!creds) {
|
|
58
|
+
console.log(` Credentials: not configured`);
|
|
59
|
+
console.log(` Run \`npx nole configure\` to set up.`);
|
|
60
|
+
console.log('');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
console.log(` Credentials: ${credsPath}`);
|
|
64
|
+
console.log(` Network: ${creds.network || 'not set'}`);
|
|
65
|
+
console.log(` Wallet: ${creds.walletAddress || 'not created'}`);
|
|
66
|
+
console.log(` CDP API Key: ${creds.cdpApiKeyId ? maskKey(creds.cdpApiKeyId) : 'not set'}`);
|
|
67
|
+
console.log(` CDP Secret: ${creds.cdpApiKeySecret ? '••••••••' : 'not set'}`);
|
|
68
|
+
console.log(` Wallet Secret: ${creds.cdpWalletSecret ? '••••••••' : 'not set'}`);
|
|
69
|
+
console.log(` Contract: ${creds.contractAddress || 'not set'}`);
|
|
70
|
+
console.log(` CompSi API Key: ${creds.compsiAgentApiKey || 'not set'}`);
|
|
71
|
+
console.log(` Configured: ${creds.configuredAt || 'unknown'}`);
|
|
72
|
+
if (creds.walletAddress && creds.network === 'base-sepolia') {
|
|
73
|
+
console.log(` Explorer: https://sepolia.basescan.org/address/${creds.walletAddress}`);
|
|
74
|
+
}
|
|
75
|
+
else if (creds.walletAddress) {
|
|
76
|
+
console.log(` Explorer: https://basescan.org/address/${creds.walletAddress}`);
|
|
77
|
+
}
|
|
78
|
+
console.log('');
|
|
79
|
+
}
|
|
80
|
+
function maskKey(key) {
|
|
81
|
+
if (key.length <= 8)
|
|
82
|
+
return '••••••••';
|
|
83
|
+
return key.slice(0, 4) + '••••' + key.slice(-4);
|
|
84
|
+
}
|
|
32
85
|
function printHelp() {
|
|
33
86
|
console.log(`
|
|
34
|
-
@aiassesstech/nole — Autonomous Trust
|
|
87
|
+
@aiassesstech/nole — Autonomous Trust Evangelist
|
|
35
88
|
|
|
36
89
|
Usage:
|
|
37
|
-
nole
|
|
38
|
-
nole
|
|
90
|
+
nole configure [options] Set up CDP credentials, create wallet, save config
|
|
91
|
+
nole setup [options] Register Nole with OpenClaw + upgrade Commander
|
|
92
|
+
nole status Show current configuration status
|
|
93
|
+
nole --help Show this help message
|
|
94
|
+
|
|
95
|
+
Configure Options:
|
|
96
|
+
--network <network> Network: base-sepolia (default) or base
|
|
97
|
+
--cdp-api-key-id <id> CDP API Key ID (non-interactive)
|
|
98
|
+
--cdp-api-key-secret <s> CDP API Key Secret (non-interactive)
|
|
99
|
+
--cdp-wallet-secret <s> CDP Wallet Secret (non-interactive)
|
|
100
|
+
--skip-wallet Skip MPC wallet creation
|
|
101
|
+
--reconfigure Force reconfiguration even if already set up
|
|
102
|
+
--non-interactive Skip prompts (requires all credentials as flags)
|
|
39
103
|
|
|
40
104
|
Setup Options:
|
|
41
|
-
--model <model>
|
|
42
|
-
--hck <key>
|
|
43
|
-
--config <path>
|
|
44
|
-
--force
|
|
45
|
-
--skip-commander
|
|
46
|
-
--commander-id <id>
|
|
105
|
+
--model <model> Model to use (default: anthropic/claude-sonnet-4-5)
|
|
106
|
+
--hck <key> Health Check Key (hck_...)
|
|
107
|
+
--config <path> Path to openclaw.json (default: auto-detect)
|
|
108
|
+
--force Re-template agent workspace files
|
|
109
|
+
--skip-commander Skip Commander (Jessie) workspace upgrade
|
|
110
|
+
--commander-id <id> Commander agent ID (default: main)
|
|
47
111
|
|
|
48
|
-
|
|
49
|
-
1.
|
|
50
|
-
2.
|
|
51
|
-
3.
|
|
52
|
-
4. Upgrades the Commander (Jessie) with Commander role, tools, and rules
|
|
53
|
-
- Appends to SOUL.md (Commander section)
|
|
54
|
-
- Appends to AGENTS.md (Commander operating rules C1-C8)
|
|
55
|
-
- Updates IDENTITY.md (Commander role)
|
|
56
|
-
- Creates timestamped backups before any changes
|
|
57
|
-
- Idempotent: skips if Commander content already present
|
|
112
|
+
Getting Started:
|
|
113
|
+
1. npx nole configure Enter CDP credentials, create wallet
|
|
114
|
+
2. npx nole setup Register with OpenClaw
|
|
115
|
+
3. Restart OpenClaw gateway Nole is live
|
|
58
116
|
|
|
59
|
-
|
|
60
|
-
npx @aiassesstech/nole setup --model anthropic/claude-sonnet-4-5 --hck hck_your_key
|
|
61
|
-
npx @aiassesstech/nole setup --force
|
|
62
|
-
npx @aiassesstech/nole setup --skip-commander
|
|
63
|
-
npx @aiassesstech/nole setup --commander-id jessie
|
|
117
|
+
Get CDP credentials at: https://portal.cdp.coinbase.com/
|
|
64
118
|
`.trim());
|
|
65
119
|
}
|
|
66
120
|
function parseFlags(args) {
|
package/dist/cli/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/cli/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/cli/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAExB,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACzD,SAAS,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,IAAI,OAAO,KAAK,WAAW,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,SAAS,CAAC;YACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;YACzB,cAAc,EAAE,iBAAiB,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK;YAC5D,WAAW,EAAE,KAAK,CAAC,gBAAgB,CAAC;YACpC,eAAe,EAAE,KAAK,CAAC,oBAAoB,CAAC;YAC5C,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC;YAC3C,UAAU,EAAE,aAAa,IAAI,KAAK;YAClC,WAAW,EAAE,aAAa,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK;SACxD,CAAC,CAAC;QACH,OAA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|
|
5
|
+
* Handles recruitment, subscription management, commission tracking,
|
|
6
|
+
* and trust directory queries.
|
|
7
|
+
*
|
|
8
|
+
* @see SPEC-AGENT-CRYPTO-SUBSCRIPTIONS-1.0.md v1.1.1
|
|
9
|
+
*/
|
|
10
|
+
export interface CompSiClientConfig {
|
|
11
|
+
apiUrl: string;
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
walletAddress?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SubscribeRequest {
|
|
16
|
+
walletAddress: string;
|
|
17
|
+
tier: string;
|
|
18
|
+
agentName: string;
|
|
19
|
+
agentPlatform: string;
|
|
20
|
+
referralCode?: string;
|
|
21
|
+
recruiterWallet?: string;
|
|
22
|
+
signature?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface DirectoryOptions {
|
|
25
|
+
limit?: number;
|
|
26
|
+
offset?: number;
|
|
27
|
+
tier?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ApiResponse<T = unknown> {
|
|
30
|
+
ok: boolean;
|
|
31
|
+
status: number;
|
|
32
|
+
data?: T;
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare class CompSiApiClient {
|
|
36
|
+
private baseUrl;
|
|
37
|
+
private apiKey?;
|
|
38
|
+
private walletAddress?;
|
|
39
|
+
constructor(config: CompSiClientConfig);
|
|
40
|
+
get isConfigured(): boolean;
|
|
41
|
+
get configStatus(): {
|
|
42
|
+
apiKey: boolean;
|
|
43
|
+
wallet: boolean;
|
|
44
|
+
url: string;
|
|
45
|
+
};
|
|
46
|
+
private headers;
|
|
47
|
+
private request;
|
|
48
|
+
subscribe(req: SubscribeRequest): Promise<ApiResponse>;
|
|
49
|
+
getSubscription(wallet?: string): Promise<ApiResponse>;
|
|
50
|
+
upgrade(tier: string): Promise<ApiResponse>;
|
|
51
|
+
renew(): Promise<ApiResponse>;
|
|
52
|
+
triggerAssessment(targetAgentId: string, systemPrompt: string): Promise<ApiResponse>;
|
|
53
|
+
getScores(wallet?: string): Promise<ApiResponse>;
|
|
54
|
+
getCertification(wallet?: string): Promise<ApiResponse>;
|
|
55
|
+
generateReferralCode(): Promise<ApiResponse>;
|
|
56
|
+
validateReferralCode(code: string): Promise<ApiResponse>;
|
|
57
|
+
getCommissionStatus(wallet?: string): Promise<ApiResponse>;
|
|
58
|
+
claimCommission(): Promise<ApiResponse>;
|
|
59
|
+
getDirectory(options?: DirectoryOptions): Promise<ApiResponse>;
|
|
60
|
+
checkTrialEligibility(): Promise<ApiResponse>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/compsi/api-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;I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
/**
|
|
2
|
+
* CompSi Platform API Client
|
|
3
|
+
*
|
|
4
|
+
* Nole's interface to the AI Assess Tech agent subscription system.
|
|
5
|
+
* Handles recruitment, subscription management, commission tracking,
|
|
6
|
+
* and trust directory queries.
|
|
7
|
+
*
|
|
8
|
+
* @see SPEC-AGENT-CRYPTO-SUBSCRIPTIONS-1.0.md v1.1.1
|
|
9
|
+
*/
|
|
10
|
+
export class CompSiApiClient {
|
|
11
|
+
baseUrl;
|
|
12
|
+
apiKey;
|
|
13
|
+
walletAddress;
|
|
14
|
+
constructor(config) {
|
|
15
|
+
this.baseUrl = config.apiUrl.replace(/\/$/, '');
|
|
16
|
+
this.apiKey = config.apiKey;
|
|
17
|
+
this.walletAddress = config.walletAddress;
|
|
18
|
+
}
|
|
19
|
+
get isConfigured() {
|
|
20
|
+
return !!this.apiKey && !!this.walletAddress;
|
|
21
|
+
}
|
|
22
|
+
get configStatus() {
|
|
23
|
+
return {
|
|
24
|
+
apiKey: !!this.apiKey,
|
|
25
|
+
wallet: !!this.walletAddress,
|
|
26
|
+
url: this.baseUrl,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
headers(includeAuth = true) {
|
|
30
|
+
const h = {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
};
|
|
33
|
+
if (includeAuth && this.apiKey) {
|
|
34
|
+
h['X-API-Key'] = this.apiKey;
|
|
35
|
+
}
|
|
36
|
+
return h;
|
|
37
|
+
}
|
|
38
|
+
async request(method, path, body, auth = true) {
|
|
39
|
+
try {
|
|
40
|
+
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
41
|
+
method,
|
|
42
|
+
headers: this.headers(auth),
|
|
43
|
+
...(body ? { body: JSON.stringify(body) } : {}),
|
|
44
|
+
});
|
|
45
|
+
const data = await res.json().catch(() => null);
|
|
46
|
+
if (!res.ok) {
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
status: res.status,
|
|
50
|
+
error: data?.error || `HTTP ${res.status}`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return { ok: true, status: res.status, data: data };
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
57
|
+
return { ok: false, status: 0, error: `Network error: ${msg}` };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// =====================================================================
|
|
61
|
+
// Subscription Management
|
|
62
|
+
// =====================================================================
|
|
63
|
+
async subscribe(req) {
|
|
64
|
+
return this.request('POST', '/api/v1/agent/subscribe', req, false);
|
|
65
|
+
}
|
|
66
|
+
async getSubscription(wallet) {
|
|
67
|
+
const w = wallet || this.walletAddress;
|
|
68
|
+
if (!w)
|
|
69
|
+
return { ok: false, status: 0, error: 'No wallet address' };
|
|
70
|
+
return this.request('GET', `/api/v1/agent/subscription/${w}`, undefined, false);
|
|
71
|
+
}
|
|
72
|
+
async upgrade(tier) {
|
|
73
|
+
if (!this.walletAddress)
|
|
74
|
+
return { ok: false, status: 0, error: 'No wallet address' };
|
|
75
|
+
return this.request('POST', `/api/v1/agent/subscription/${this.walletAddress}/upgrade`, { tier });
|
|
76
|
+
}
|
|
77
|
+
async renew() {
|
|
78
|
+
if (!this.walletAddress)
|
|
79
|
+
return { ok: false, status: 0, error: 'No wallet address' };
|
|
80
|
+
return this.request('POST', `/api/v1/agent/subscription/${this.walletAddress}/renew`);
|
|
81
|
+
}
|
|
82
|
+
// =====================================================================
|
|
83
|
+
// Assessment
|
|
84
|
+
// =====================================================================
|
|
85
|
+
async triggerAssessment(targetAgentId, systemPrompt) {
|
|
86
|
+
return this.request('POST', '/api/v1/agent/assess', {
|
|
87
|
+
targetAgentId,
|
|
88
|
+
systemPrompt,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async getScores(wallet) {
|
|
92
|
+
const w = wallet || this.walletAddress;
|
|
93
|
+
if (!w)
|
|
94
|
+
return { ok: false, status: 0, error: 'No wallet address' };
|
|
95
|
+
return this.request('GET', `/api/v1/agent/scores/${w}`, undefined, false);
|
|
96
|
+
}
|
|
97
|
+
async getCertification(wallet) {
|
|
98
|
+
const w = wallet || this.walletAddress;
|
|
99
|
+
if (!w)
|
|
100
|
+
return { ok: false, status: 0, error: 'No wallet address' };
|
|
101
|
+
return this.request('GET', `/api/v1/agent/certification/${w}`, undefined, false);
|
|
102
|
+
}
|
|
103
|
+
// =====================================================================
|
|
104
|
+
// Recruitment & Referrals
|
|
105
|
+
// =====================================================================
|
|
106
|
+
async generateReferralCode() {
|
|
107
|
+
return this.request('POST', '/api/v1/agent/referral/generate');
|
|
108
|
+
}
|
|
109
|
+
async validateReferralCode(code) {
|
|
110
|
+
return this.request('GET', `/api/v1/agent/referral/validate?code=${encodeURIComponent(code)}`, undefined, false);
|
|
111
|
+
}
|
|
112
|
+
// =====================================================================
|
|
113
|
+
// Commission
|
|
114
|
+
// =====================================================================
|
|
115
|
+
async getCommissionStatus(wallet) {
|
|
116
|
+
const w = wallet || this.walletAddress;
|
|
117
|
+
if (!w)
|
|
118
|
+
return { ok: false, status: 0, error: 'No wallet address' };
|
|
119
|
+
return this.request('GET', `/api/v1/agent/commission/${w}`);
|
|
120
|
+
}
|
|
121
|
+
async claimCommission() {
|
|
122
|
+
if (!this.walletAddress)
|
|
123
|
+
return { ok: false, status: 0, error: 'No wallet address' };
|
|
124
|
+
return this.request('POST', `/api/v1/agent/commission/${this.walletAddress}/claim`);
|
|
125
|
+
}
|
|
126
|
+
// =====================================================================
|
|
127
|
+
// Trust Directory
|
|
128
|
+
// =====================================================================
|
|
129
|
+
async getDirectory(options) {
|
|
130
|
+
const params = new URLSearchParams();
|
|
131
|
+
if (options?.limit)
|
|
132
|
+
params.set('limit', String(options.limit));
|
|
133
|
+
if (options?.offset)
|
|
134
|
+
params.set('offset', String(options.offset));
|
|
135
|
+
if (options?.tier)
|
|
136
|
+
params.set('tier', options.tier);
|
|
137
|
+
const qs = params.toString();
|
|
138
|
+
return this.request('GET', `/api/v1/agent/directory${qs ? `?${qs}` : ''}`, undefined, false);
|
|
139
|
+
}
|
|
140
|
+
// =====================================================================
|
|
141
|
+
// Free Trial
|
|
142
|
+
// =====================================================================
|
|
143
|
+
async checkTrialEligibility() {
|
|
144
|
+
return this.request('GET', '/api/v1/agent/trial/status', undefined, false);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=api-client.js.map
|