@clawnch/clawtomaton 0.2.2 → 0.3.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/README.md +80 -8
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +12 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/prompt.d.ts +2 -0
- package/dist/agent/prompt.d.ts.map +1 -1
- package/dist/agent/prompt.js +43 -2
- package/dist/agent/prompt.js.map +1 -1
- package/dist/bunker/client.d.ts +113 -0
- package/dist/bunker/client.d.ts.map +1 -0
- package/dist/bunker/client.js +404 -0
- package/dist/bunker/client.js.map +1 -0
- package/dist/bunker/self-deploy.d.ts +54 -0
- package/dist/bunker/self-deploy.d.ts.map +1 -0
- package/dist/bunker/self-deploy.js +353 -0
- package/dist/bunker/self-deploy.js.map +1 -0
- package/dist/bunker/threat-monitor.d.ts +47 -0
- package/dist/bunker/threat-monitor.d.ts.map +1 -0
- package/dist/bunker/threat-monitor.js +173 -0
- package/dist/bunker/threat-monitor.js.map +1 -0
- package/dist/bunker/types.d.ts +320 -0
- package/dist/bunker/types.d.ts.map +1 -0
- package/dist/bunker/types.js +9 -0
- package/dist/bunker/types.js.map +1 -0
- package/dist/cli.js +207 -9
- package/dist/cli.js.map +1 -1
- package/dist/constants.d.ts +11 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -1
- package/dist/heartbeat/index.d.ts +10 -0
- package/dist/heartbeat/index.d.ts.map +1 -1
- package/dist/heartbeat/index.js +89 -11
- package/dist/heartbeat/index.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/market/index.d.ts +12 -0
- package/dist/market/index.d.ts.map +1 -1
- package/dist/market/index.js +48 -2
- package/dist/market/index.js.map +1 -1
- package/dist/skills/bunker.d.ts +29 -0
- package/dist/skills/bunker.d.ts.map +1 -0
- package/dist/skills/bunker.js +502 -0
- package/dist/skills/bunker.js.map +1 -0
- package/dist/skills/index.d.ts +2 -1
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +6 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +55 -0
- package/dist/state/index.js.map +1 -1
- package/dist/survival/index.d.ts.map +1 -1
- package/dist/survival/index.js +3 -0
- package/dist/survival/index.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MoltBunker API types — strict typings for all request/response payloads.
|
|
3
|
+
*
|
|
4
|
+
* API base: https://api.moltbunker.com/v1
|
|
5
|
+
* Auth: EIP-191 wallet session (challenge → sign → verify → wt_* token)
|
|
6
|
+
* Payments: BUNKER ERC-20 on Base mainnet
|
|
7
|
+
*/
|
|
8
|
+
export interface AuthChallengeRequest {
|
|
9
|
+
address: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AuthChallengeResponse {
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AuthVerifyRequest {
|
|
15
|
+
address: string;
|
|
16
|
+
message: string;
|
|
17
|
+
signature: string;
|
|
18
|
+
}
|
|
19
|
+
export interface AuthVerifyResponse {
|
|
20
|
+
access_token: string;
|
|
21
|
+
expires_in: number;
|
|
22
|
+
}
|
|
23
|
+
export interface BotResources {
|
|
24
|
+
cpu_shares: number;
|
|
25
|
+
memory_mb: number;
|
|
26
|
+
storage_mb: number;
|
|
27
|
+
network_mbps: number;
|
|
28
|
+
}
|
|
29
|
+
export type BunkerRegion = 'americas' | 'europe' | 'asia_pacific' | '';
|
|
30
|
+
export interface BotCreateRequest {
|
|
31
|
+
name: string;
|
|
32
|
+
image: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
resources: BotResources;
|
|
35
|
+
region: BunkerRegion;
|
|
36
|
+
metadata?: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
export interface Bot {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
image: string;
|
|
42
|
+
description: string;
|
|
43
|
+
resources: BotResources;
|
|
44
|
+
region: BunkerRegion;
|
|
45
|
+
metadata: Record<string, string>;
|
|
46
|
+
created_at: string;
|
|
47
|
+
}
|
|
48
|
+
export interface BotUpdateRequest {
|
|
49
|
+
name?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
metadata?: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
export interface BotStatus {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
status: ContainerStatusValue;
|
|
57
|
+
uptime_seconds: number;
|
|
58
|
+
clones: number;
|
|
59
|
+
threat_level: ThreatLevel;
|
|
60
|
+
region: BunkerRegion;
|
|
61
|
+
}
|
|
62
|
+
export interface CloningConfig {
|
|
63
|
+
enabled: boolean;
|
|
64
|
+
auto_clone_on_threat: boolean;
|
|
65
|
+
max_clones: number;
|
|
66
|
+
clone_delay_seconds: number;
|
|
67
|
+
sync_state: boolean;
|
|
68
|
+
sync_interval_seconds: number;
|
|
69
|
+
}
|
|
70
|
+
export interface RuntimeReserveRequest {
|
|
71
|
+
bot_id: string;
|
|
72
|
+
min_memory_mb: number;
|
|
73
|
+
min_cpu_shares: number;
|
|
74
|
+
duration_hours: number;
|
|
75
|
+
region: BunkerRegion;
|
|
76
|
+
}
|
|
77
|
+
export interface Runtime {
|
|
78
|
+
id: string;
|
|
79
|
+
bot_id: string;
|
|
80
|
+
node_id: string;
|
|
81
|
+
region: BunkerRegion;
|
|
82
|
+
resources: BotResources;
|
|
83
|
+
expires_at: string;
|
|
84
|
+
}
|
|
85
|
+
export interface RuntimeStatus {
|
|
86
|
+
id: string;
|
|
87
|
+
status: string;
|
|
88
|
+
remaining_hours: number;
|
|
89
|
+
expires_at: string;
|
|
90
|
+
}
|
|
91
|
+
export interface RuntimeExtendRequest {
|
|
92
|
+
duration_hours: number;
|
|
93
|
+
}
|
|
94
|
+
export interface DeploymentCreateRequest {
|
|
95
|
+
runtime_id: string;
|
|
96
|
+
env?: Record<string, string>;
|
|
97
|
+
cmd?: string[];
|
|
98
|
+
entrypoint?: string[];
|
|
99
|
+
}
|
|
100
|
+
export interface Deployment {
|
|
101
|
+
id: string;
|
|
102
|
+
bot_id: string;
|
|
103
|
+
runtime_id: string;
|
|
104
|
+
container_id: string;
|
|
105
|
+
status: ContainerStatusValue;
|
|
106
|
+
region: BunkerRegion;
|
|
107
|
+
node_id: string;
|
|
108
|
+
created_at: string;
|
|
109
|
+
started_at: string | null;
|
|
110
|
+
onion_address: string | null;
|
|
111
|
+
}
|
|
112
|
+
export type ProviderTier = 'confidential' | 'standard' | 'dev';
|
|
113
|
+
export interface DirectDeployRequest {
|
|
114
|
+
image: string;
|
|
115
|
+
resources: BotResources;
|
|
116
|
+
duration: string;
|
|
117
|
+
tor_only?: boolean;
|
|
118
|
+
onion_service?: boolean;
|
|
119
|
+
onion_port?: number;
|
|
120
|
+
wait_for_replicas?: boolean;
|
|
121
|
+
reservation_id?: string;
|
|
122
|
+
min_provider_tier?: ProviderTier;
|
|
123
|
+
env?: Record<string, string>;
|
|
124
|
+
}
|
|
125
|
+
export type ContainerStatusValue = 'pending' | 'starting' | 'running' | 'stopping' | 'stopped' | 'failed' | 'terminated';
|
|
126
|
+
export interface ContainerLocation {
|
|
127
|
+
region: BunkerRegion;
|
|
128
|
+
country: string;
|
|
129
|
+
country_name: string;
|
|
130
|
+
city: string;
|
|
131
|
+
}
|
|
132
|
+
export interface Container {
|
|
133
|
+
id: string;
|
|
134
|
+
image: string;
|
|
135
|
+
status: ContainerStatusValue;
|
|
136
|
+
created_at: string;
|
|
137
|
+
started_at: string | null;
|
|
138
|
+
stopped_at: string | null;
|
|
139
|
+
encrypted: boolean;
|
|
140
|
+
onion_address: string | null;
|
|
141
|
+
regions: BunkerRegion[];
|
|
142
|
+
locations: ContainerLocation[];
|
|
143
|
+
owner: string;
|
|
144
|
+
has_volume: boolean;
|
|
145
|
+
volume_expires_at: string | null;
|
|
146
|
+
}
|
|
147
|
+
export interface ContainerListParams {
|
|
148
|
+
status?: ContainerStatusValue;
|
|
149
|
+
owner?: string;
|
|
150
|
+
}
|
|
151
|
+
export interface ContainerLogsParams {
|
|
152
|
+
tail?: number;
|
|
153
|
+
follow?: boolean;
|
|
154
|
+
}
|
|
155
|
+
export type SnapshotType = 'full' | 'incremental' | 'checkpoint';
|
|
156
|
+
export interface SnapshotCreateRequest {
|
|
157
|
+
container_id: string;
|
|
158
|
+
type: SnapshotType;
|
|
159
|
+
metadata?: Record<string, string>;
|
|
160
|
+
}
|
|
161
|
+
export interface Snapshot {
|
|
162
|
+
id: string;
|
|
163
|
+
container_id: string;
|
|
164
|
+
type: SnapshotType;
|
|
165
|
+
size: number;
|
|
166
|
+
stored_size: number;
|
|
167
|
+
checksum: string;
|
|
168
|
+
compressed: boolean;
|
|
169
|
+
encrypted: boolean;
|
|
170
|
+
parent_id: string | null;
|
|
171
|
+
created_at: string;
|
|
172
|
+
metadata: Record<string, string>;
|
|
173
|
+
}
|
|
174
|
+
export interface SnapshotRestoreRequest {
|
|
175
|
+
snapshot_id: string;
|
|
176
|
+
target_region?: BunkerRegion;
|
|
177
|
+
new_container?: boolean;
|
|
178
|
+
}
|
|
179
|
+
export type CloneReason = 'manual_clone' | 'threat_response' | 'failover';
|
|
180
|
+
export type CloneStatus = 'pending' | 'preparing' | 'transferring' | 'deploying' | 'verifying' | 'complete' | 'failed' | 'cancelled';
|
|
181
|
+
export interface CloneCreateRequest {
|
|
182
|
+
source_id: string;
|
|
183
|
+
target_region: BunkerRegion;
|
|
184
|
+
priority?: number;
|
|
185
|
+
reason: CloneReason;
|
|
186
|
+
include_state: boolean;
|
|
187
|
+
}
|
|
188
|
+
export interface Clone {
|
|
189
|
+
clone_id: string;
|
|
190
|
+
source_id: string;
|
|
191
|
+
target_id: string;
|
|
192
|
+
target_node_id: string;
|
|
193
|
+
target_region: BunkerRegion;
|
|
194
|
+
status: CloneStatus;
|
|
195
|
+
priority: number;
|
|
196
|
+
reason: CloneReason;
|
|
197
|
+
snapshot_id: string | null;
|
|
198
|
+
created_at: string;
|
|
199
|
+
completed_at: string | null;
|
|
200
|
+
error: string | null;
|
|
201
|
+
}
|
|
202
|
+
export interface CloneListParams {
|
|
203
|
+
bot_id?: string;
|
|
204
|
+
active?: boolean;
|
|
205
|
+
limit?: number;
|
|
206
|
+
}
|
|
207
|
+
export type ThreatLevel = 'unknown' | 'low' | 'medium' | 'high' | 'critical';
|
|
208
|
+
export interface ThreatSignal {
|
|
209
|
+
type: string;
|
|
210
|
+
score: number;
|
|
211
|
+
confidence: number;
|
|
212
|
+
source: string;
|
|
213
|
+
details: string;
|
|
214
|
+
timestamp: string;
|
|
215
|
+
}
|
|
216
|
+
export interface ThreatAssessment {
|
|
217
|
+
score: number;
|
|
218
|
+
level: ThreatLevel;
|
|
219
|
+
recommendation: string;
|
|
220
|
+
active_signals: ThreatSignal[];
|
|
221
|
+
timestamp: string;
|
|
222
|
+
}
|
|
223
|
+
export interface MigrateRequest {
|
|
224
|
+
container_id: string;
|
|
225
|
+
target_region: BunkerRegion;
|
|
226
|
+
keep_original?: boolean;
|
|
227
|
+
}
|
|
228
|
+
export type MigrationStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
|
|
229
|
+
export interface Migration {
|
|
230
|
+
migration_id: string;
|
|
231
|
+
status: MigrationStatus;
|
|
232
|
+
source_region: BunkerRegion;
|
|
233
|
+
target_region: BunkerRegion;
|
|
234
|
+
started_at: string;
|
|
235
|
+
}
|
|
236
|
+
export interface CatalogPreset {
|
|
237
|
+
id: string;
|
|
238
|
+
name: string;
|
|
239
|
+
image: string;
|
|
240
|
+
description: string;
|
|
241
|
+
category_id: string;
|
|
242
|
+
default_tier: string;
|
|
243
|
+
tags: string[];
|
|
244
|
+
enabled: boolean;
|
|
245
|
+
sort_order: number;
|
|
246
|
+
}
|
|
247
|
+
export interface CatalogCategory {
|
|
248
|
+
id: string;
|
|
249
|
+
label: string;
|
|
250
|
+
enabled: boolean;
|
|
251
|
+
sort_order: number;
|
|
252
|
+
}
|
|
253
|
+
export interface CatalogTier {
|
|
254
|
+
id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
description: string;
|
|
257
|
+
cpu: string;
|
|
258
|
+
memory: string;
|
|
259
|
+
storage: string;
|
|
260
|
+
monthly: number;
|
|
261
|
+
enabled: boolean;
|
|
262
|
+
popular: boolean;
|
|
263
|
+
sort_order: number;
|
|
264
|
+
}
|
|
265
|
+
export interface CatalogResponse {
|
|
266
|
+
presets: CatalogPreset[];
|
|
267
|
+
categories: CatalogCategory[];
|
|
268
|
+
tiers: CatalogTier[];
|
|
269
|
+
updated_at: string;
|
|
270
|
+
version: number;
|
|
271
|
+
}
|
|
272
|
+
export interface BunkerBalance {
|
|
273
|
+
wallet_address: string;
|
|
274
|
+
bunker_balance: number;
|
|
275
|
+
eth_balance: number;
|
|
276
|
+
deposited: number;
|
|
277
|
+
reserved: number;
|
|
278
|
+
available: number;
|
|
279
|
+
}
|
|
280
|
+
export interface BunkerApiStatus {
|
|
281
|
+
status: string;
|
|
282
|
+
version?: string;
|
|
283
|
+
uptime?: number;
|
|
284
|
+
}
|
|
285
|
+
export interface BunkerErrorResponse {
|
|
286
|
+
error: string;
|
|
287
|
+
required?: number;
|
|
288
|
+
available?: number;
|
|
289
|
+
}
|
|
290
|
+
export interface BunkerState {
|
|
291
|
+
botId: string | null;
|
|
292
|
+
runtimeId: string | null;
|
|
293
|
+
deploymentId: string | null;
|
|
294
|
+
containerId: string | null;
|
|
295
|
+
/** Unix ms when the runtime expires */
|
|
296
|
+
expiresAt: number | null;
|
|
297
|
+
/** Unix ms of last threat check */
|
|
298
|
+
lastThreatCheck: number;
|
|
299
|
+
/** Last known threat level */
|
|
300
|
+
lastThreatLevel: ThreatLevel;
|
|
301
|
+
/** Active clone IDs */
|
|
302
|
+
cloneIds: string[];
|
|
303
|
+
}
|
|
304
|
+
export interface BunkerConfig {
|
|
305
|
+
/** MoltBunker API base URL (default: https://api.moltbunker.com/v1) */
|
|
306
|
+
apiUrl: string;
|
|
307
|
+
/** Preferred deployment region */
|
|
308
|
+
region: BunkerRegion;
|
|
309
|
+
/** Auto-clone when threat level rises to high/critical */
|
|
310
|
+
autoCloneOnThreat: boolean;
|
|
311
|
+
/** Maximum number of clones to maintain */
|
|
312
|
+
maxClones: number;
|
|
313
|
+
/** Threat check interval in ms (default: 300_000 = 5min) */
|
|
314
|
+
threatCheckIntervalMs: number;
|
|
315
|
+
/** Default runtime duration in hours (default: 720 = 30 days) */
|
|
316
|
+
defaultDurationHours: number;
|
|
317
|
+
/** Catalog tier ID for resource allocation (e.g. "standard") */
|
|
318
|
+
tier: string;
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bunker/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAMD,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MA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C;IAC7B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MoltBunker API types — strict typings for all request/response payloads.
|
|
3
|
+
*
|
|
4
|
+
* API base: https://api.moltbunker.com/v1
|
|
5
|
+
* Auth: EIP-191 wallet session (challenge → sign → verify → wt_* token)
|
|
6
|
+
* Payments: BUNKER ERC-20 on Base mainnet
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/bunker/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/dist/cli.js
CHANGED
|
@@ -15,11 +15,14 @@ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
|
15
15
|
import { join } from 'node:path';
|
|
16
16
|
import { createInterface } from 'node:readline';
|
|
17
17
|
import { StateStore } from './state/index.js';
|
|
18
|
-
import { generateIdentity, activate, syncTokenFromApi } from './identity/index.js';
|
|
18
|
+
import { generateIdentity, activate, syncTokenFromApi, buildClients } from './identity/index.js';
|
|
19
19
|
import { ClawtomatonAgent } from './agent/index.js';
|
|
20
20
|
import { Heartbeat } from './heartbeat/index.js';
|
|
21
21
|
import { SelfModAuditor } from './self-mod/index.js';
|
|
22
22
|
import { formatSurvivalStatus } from './survival/index.js';
|
|
23
|
+
import { BunkerClient } from './bunker/client.js';
|
|
24
|
+
import { selfDeploy, stopDeploy } from './bunker/self-deploy.js';
|
|
25
|
+
import { BUNKER_API_URL, BUNKER_DEFAULT_DURATION_HOURS } from './constants.js';
|
|
23
26
|
// ============================================================================
|
|
24
27
|
// Arg Parsing
|
|
25
28
|
// ============================================================================
|
|
@@ -56,6 +59,9 @@ async function main() {
|
|
|
56
59
|
case 'set-token':
|
|
57
60
|
await setToken();
|
|
58
61
|
break;
|
|
62
|
+
case 'bunker':
|
|
63
|
+
await bunkerCommand();
|
|
64
|
+
break;
|
|
59
65
|
case 'help':
|
|
60
66
|
default:
|
|
61
67
|
printHelp();
|
|
@@ -83,6 +89,24 @@ async function setupWizard() {
|
|
|
83
89
|
const fallbackModel = await ask(` Fallback model (for low compute) [${defaultFallback}]: `) || defaultFallback;
|
|
84
90
|
const heartbeatMinutes = await ask(' Heartbeat interval in minutes [30]: ') || '30';
|
|
85
91
|
const conwayApiKey = await ask(' Conway API key (optional, press enter to skip): ') || undefined;
|
|
92
|
+
// MoltBunker config
|
|
93
|
+
const enableBunker = (await ask(' Enable MoltBunker deployment? (y/N): ')).toLowerCase() === 'y';
|
|
94
|
+
let bunkerConfig;
|
|
95
|
+
if (enableBunker) {
|
|
96
|
+
const bunkerRegion = (await ask(' Preferred region (americas/europe/asia_pacific) [americas]: ') || 'americas');
|
|
97
|
+
const bunkerAutoClone = (await ask(' Auto-clone on threat? (Y/n): ')).toLowerCase() !== 'n';
|
|
98
|
+
const bunkerMaxClones = parseInt(await ask(' Max clones [3]: ') || '3', 10);
|
|
99
|
+
const bunkerTier = await ask(' Runtime tier (minimal/standard/performance/enterprise) [standard]: ') || 'standard';
|
|
100
|
+
bunkerConfig = {
|
|
101
|
+
apiUrl: BUNKER_API_URL,
|
|
102
|
+
region: bunkerRegion,
|
|
103
|
+
autoCloneOnThreat: bunkerAutoClone,
|
|
104
|
+
maxClones: bunkerMaxClones,
|
|
105
|
+
threatCheckIntervalMs: 300_000,
|
|
106
|
+
defaultDurationHours: BUNKER_DEFAULT_DURATION_HOURS,
|
|
107
|
+
tier: bunkerTier,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
86
110
|
const stateDir = await ask(` State directory [${DEFAULT_STATE_DIR}]: `) || DEFAULT_STATE_DIR;
|
|
87
111
|
rl.close();
|
|
88
112
|
const config = {
|
|
@@ -97,6 +121,7 @@ async function setupWizard() {
|
|
|
97
121
|
heartbeatIntervalMs: parseInt(heartbeatMinutes) * 60 * 1000,
|
|
98
122
|
maxHistoryTurns: 50,
|
|
99
123
|
conwayApiKey,
|
|
124
|
+
bunker: bunkerConfig,
|
|
100
125
|
};
|
|
101
126
|
// Save config
|
|
102
127
|
const { mkdirSync } = await import('node:fs');
|
|
@@ -160,6 +185,7 @@ async function activateAgent() {
|
|
|
160
185
|
}
|
|
161
186
|
async function runOnce() {
|
|
162
187
|
const config = loadConfig();
|
|
188
|
+
setBunkerEnvVars(config);
|
|
163
189
|
const state = new StateStore(config.stateDir);
|
|
164
190
|
if (!state.isActivated()) {
|
|
165
191
|
console.error(' Agent not activated. Run: clawtomaton activate');
|
|
@@ -190,6 +216,7 @@ async function runOnce() {
|
|
|
190
216
|
}
|
|
191
217
|
async function runDaemon() {
|
|
192
218
|
const config = loadConfig();
|
|
219
|
+
setBunkerEnvVars(config);
|
|
193
220
|
const state = new StateStore(config.stateDir);
|
|
194
221
|
if (!state.isActivated()) {
|
|
195
222
|
console.error(' Agent not activated. Run: clawtomaton activate');
|
|
@@ -324,19 +351,190 @@ async function setToken() {
|
|
|
324
351
|
state.close();
|
|
325
352
|
}
|
|
326
353
|
}
|
|
354
|
+
async function bunkerCommand() {
|
|
355
|
+
const subcommand = args[1] ?? 'status';
|
|
356
|
+
const config = loadConfig();
|
|
357
|
+
if (!config.bunker) {
|
|
358
|
+
console.error(' MoltBunker not configured. Run: clawtomaton setup (enable bunker)');
|
|
359
|
+
process.exit(1);
|
|
360
|
+
}
|
|
361
|
+
const state = new StateStore(config.stateDir);
|
|
362
|
+
try {
|
|
363
|
+
const identity = state.getIdentity();
|
|
364
|
+
if (!identity) {
|
|
365
|
+
console.error(' No identity found. Run: clawtomaton setup');
|
|
366
|
+
process.exit(1);
|
|
367
|
+
}
|
|
368
|
+
// Set env vars so bunker client/skill can read config
|
|
369
|
+
setBunkerEnvVars(config);
|
|
370
|
+
const { walletClient } = buildClients(identity, config.rpcUrl);
|
|
371
|
+
const client = new BunkerClient({
|
|
372
|
+
apiUrl: config.bunker.apiUrl,
|
|
373
|
+
walletClient: walletClient,
|
|
374
|
+
});
|
|
375
|
+
switch (subcommand) {
|
|
376
|
+
case 'status': {
|
|
377
|
+
const bunkerState = state.getBunkerState();
|
|
378
|
+
if (!bunkerState?.containerId) {
|
|
379
|
+
console.log(' No bunker deployment found.');
|
|
380
|
+
console.log(' Run: clawtomaton bunker deploy');
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
try {
|
|
384
|
+
const container = await client.getContainer(bunkerState.containerId);
|
|
385
|
+
const lines = [
|
|
386
|
+
`\n Bunker Deployment`,
|
|
387
|
+
` ${'─'.repeat(40)}`,
|
|
388
|
+
` Container: ${bunkerState.containerId} (${container.status})`,
|
|
389
|
+
` Bot: ${bunkerState.botId ?? 'none'}`,
|
|
390
|
+
];
|
|
391
|
+
if (container.onion_address) {
|
|
392
|
+
lines.push(` Onion: ${container.onion_address}`);
|
|
393
|
+
}
|
|
394
|
+
if (container.regions?.length) {
|
|
395
|
+
lines.push(` Regions: ${container.regions.join(', ')}`);
|
|
396
|
+
}
|
|
397
|
+
if (bunkerState.expiresAt) {
|
|
398
|
+
const hoursRemaining = Math.max(0, (bunkerState.expiresAt - Date.now()) / (1000 * 60 * 60));
|
|
399
|
+
lines.push(` Runtime: ${hoursRemaining.toFixed(1)}h remaining`);
|
|
400
|
+
lines.push(` Expires: ${new Date(bunkerState.expiresAt).toISOString()}`);
|
|
401
|
+
}
|
|
402
|
+
lines.push(` Threat: ${bunkerState.lastThreatLevel}`);
|
|
403
|
+
lines.push(` Clones: ${bunkerState.cloneIds.length}`);
|
|
404
|
+
lines.push(` Encrypted: ${container.encrypted ? 'yes' : 'no'}`);
|
|
405
|
+
console.log(lines.join('\n'));
|
|
406
|
+
}
|
|
407
|
+
catch (err) {
|
|
408
|
+
console.log(` Container ${bunkerState.containerId}: unreachable`);
|
|
409
|
+
console.log(` Last known threat: ${bunkerState.lastThreatLevel}`);
|
|
410
|
+
}
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
case 'deploy': {
|
|
414
|
+
console.log(`\n Deploying ${identity.name} to MoltBunker...`);
|
|
415
|
+
console.log(` Region: ${config.bunker.region || 'auto'}`);
|
|
416
|
+
console.log(` Tier: ${config.bunker.tier}`);
|
|
417
|
+
try {
|
|
418
|
+
const result = await selfDeploy(client, config, identity, state);
|
|
419
|
+
console.log(`\n Deployed!`);
|
|
420
|
+
console.log(` Container: ${result.containerId}`);
|
|
421
|
+
console.log(` Region: ${result.region}`);
|
|
422
|
+
console.log(` Expires: ${new Date(result.expiresAt).toISOString()}`);
|
|
423
|
+
if (result.onionAddress) {
|
|
424
|
+
console.log(` Onion: ${result.onionAddress}`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
catch (err) {
|
|
428
|
+
console.error(`\n Deploy failed: ${err instanceof Error ? err.message : err}`);
|
|
429
|
+
process.exit(1);
|
|
430
|
+
}
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
case 'logs': {
|
|
434
|
+
const bunkerState = state.getBunkerState();
|
|
435
|
+
if (!bunkerState?.containerId) {
|
|
436
|
+
console.error(' No bunker deployment found.');
|
|
437
|
+
process.exit(1);
|
|
438
|
+
}
|
|
439
|
+
const tail = parseInt(args[2] ?? '100', 10);
|
|
440
|
+
try {
|
|
441
|
+
const logs = await client.getContainerLogs(bunkerState.containerId, tail);
|
|
442
|
+
console.log(logs || ' (no output)');
|
|
443
|
+
}
|
|
444
|
+
catch (err) {
|
|
445
|
+
console.error(` Failed to fetch logs: ${err instanceof Error ? err.message : err}`);
|
|
446
|
+
}
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
case 'stop': {
|
|
450
|
+
console.log(`\n Stopping bunker deployment...`);
|
|
451
|
+
try {
|
|
452
|
+
await stopDeploy(client, state);
|
|
453
|
+
console.log(` Deployment stopped. Runtime released.`);
|
|
454
|
+
}
|
|
455
|
+
catch (err) {
|
|
456
|
+
console.error(` Stop failed: ${err instanceof Error ? err.message : err}`);
|
|
457
|
+
process.exit(1);
|
|
458
|
+
}
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
case 'extend': {
|
|
462
|
+
const bunkerState = state.getBunkerState();
|
|
463
|
+
if (!bunkerState?.runtimeId) {
|
|
464
|
+
console.error(' No bunker runtime found.');
|
|
465
|
+
process.exit(1);
|
|
466
|
+
}
|
|
467
|
+
const hours = parseInt(args[2] ?? '720', 10);
|
|
468
|
+
console.log(` Extending runtime by ${hours}h...`);
|
|
469
|
+
try {
|
|
470
|
+
await client.extendRuntime(bunkerState.runtimeId, { duration_hours: hours });
|
|
471
|
+
const rtStatus = await client.getRuntimeStatus(bunkerState.runtimeId);
|
|
472
|
+
console.log(` Extended. Expires: ${rtStatus.expires_at} (${rtStatus.remaining_hours.toFixed(1)}h remaining)`);
|
|
473
|
+
state.saveBunkerState({ ...bunkerState, expiresAt: new Date(rtStatus.expires_at).getTime() });
|
|
474
|
+
}
|
|
475
|
+
catch (err) {
|
|
476
|
+
console.error(` Extend failed: ${err instanceof Error ? err.message : err}`);
|
|
477
|
+
}
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
default:
|
|
481
|
+
console.log(`
|
|
482
|
+
Bunker subcommands:
|
|
483
|
+
clawtomaton bunker status Show bunker deployment status
|
|
484
|
+
clawtomaton bunker deploy Deploy self to MoltBunker
|
|
485
|
+
clawtomaton bunker logs [n] Show last n log lines (default: 100)
|
|
486
|
+
clawtomaton bunker stop Stop bunker deployment
|
|
487
|
+
clawtomaton bunker extend [h] Extend runtime by h hours (default: 720)
|
|
488
|
+
`);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
finally {
|
|
492
|
+
state.close();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Set env vars for bunker config so skills/modules can read them
|
|
497
|
+
* without needing direct config access.
|
|
498
|
+
*/
|
|
499
|
+
function setBunkerEnvVars(config) {
|
|
500
|
+
if (config.bunker) {
|
|
501
|
+
process.env.CLAWTOMATON_BUNKER_API_URL = config.bunker.apiUrl;
|
|
502
|
+
process.env.CLAWTOMATON_BUNKER_REGION = config.bunker.region;
|
|
503
|
+
process.env.CLAWTOMATON_BUNKER_TIER = config.bunker.tier;
|
|
504
|
+
process.env.CLAWTOMATON_BUNKER_AUTO_CLONE = String(config.bunker.autoCloneOnThreat);
|
|
505
|
+
process.env.CLAWTOMATON_BUNKER_MAX_CLONES = String(config.bunker.maxClones);
|
|
506
|
+
}
|
|
507
|
+
process.env.CLAWTOMATON_RPC_URL = config.rpcUrl;
|
|
508
|
+
process.env.CLAWTOMATON_STATE_DIR = config.stateDir;
|
|
509
|
+
process.env.CLAWTOMATON_HEARTBEAT_MS = String(config.heartbeatIntervalMs);
|
|
510
|
+
process.env.CLAWTOMATON_INFERENCE_PROVIDER = config.inference.provider;
|
|
511
|
+
process.env.CLAWTOMATON_INFERENCE_API_KEY = config.inference.apiKey;
|
|
512
|
+
process.env.CLAWTOMATON_INFERENCE_MODEL = config.inference.model;
|
|
513
|
+
process.env.CLAWTOMATON_INFERENCE_FALLBACK = config.inference.fallbackModel;
|
|
514
|
+
if (config.conwayApiKey) {
|
|
515
|
+
process.env.CONWAY_API_KEY = config.conwayApiKey;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
327
518
|
function printHelp() {
|
|
328
519
|
console.log(`
|
|
329
520
|
Clawtomaton — Autonomous AI agents on Base
|
|
330
521
|
|
|
331
522
|
Usage:
|
|
332
|
-
clawtomaton setup
|
|
333
|
-
clawtomaton activate
|
|
334
|
-
clawtomaton run
|
|
335
|
-
clawtomaton daemon
|
|
336
|
-
clawtomaton status
|
|
337
|
-
clawtomaton audit [n]
|
|
338
|
-
clawtomaton soul
|
|
339
|
-
clawtomaton set-token <addr>
|
|
523
|
+
clawtomaton setup Interactive setup wizard
|
|
524
|
+
clawtomaton activate Burn 1M $CLAWNCH to activate
|
|
525
|
+
clawtomaton run Start the agent (single run)
|
|
526
|
+
clawtomaton daemon Start with heartbeat (continuous)
|
|
527
|
+
clawtomaton status Show agent status
|
|
528
|
+
clawtomaton audit [n] Show last n audit entries (default: 50)
|
|
529
|
+
clawtomaton soul Print SOUL.md
|
|
530
|
+
clawtomaton set-token <addr> Manually link a deployed token
|
|
531
|
+
|
|
532
|
+
Bunker (MoltBunker decentralized hosting):
|
|
533
|
+
clawtomaton bunker status Show bunker deployment status
|
|
534
|
+
clawtomaton bunker deploy Deploy self to MoltBunker
|
|
535
|
+
clawtomaton bunker logs [n] Show container logs
|
|
536
|
+
clawtomaton bunker stop Stop bunker deployment
|
|
537
|
+
clawtomaton bunker extend [h] Extend runtime (default: 720h)
|
|
340
538
|
|
|
341
539
|
https://clawn.ch/er
|
|
342
540
|
`);
|