@moltbankhq/openclaw 0.1.13 → 0.1.14

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/index.ts +38 -92
  3. package/package.json +37 -2
package/README.md CHANGED
@@ -32,11 +32,11 @@ openclaw plugins install @moltbankhq/openclaw
32
32
 
33
33
  This package connects your OpenClaw agent to MoltBank's stablecoin treasury infrastructure. During setup, it:
34
34
 
35
- - Downloads and configures the MoltBank skill (`skill.md` + scripts)
35
+ - Downloads and configures the MoltBank skill (`SKILL.md` + scripts)
36
36
  - Installs and registers [mcporter](https://www.npmjs.com/package/mcporter) for MCP server connectivity
37
37
  - Handles OAuth device-code authentication to link your agent to your MoltBank account
38
38
  - Configures sandbox (Docker) or host mode automatically based on your OpenClaw setup
39
- - Injects required environment variables (`MOLTBANK`, `SIGNER`, `ACTIVE_ORG_OVERRIDE`)
39
+ - Injects the sandbox auth path (`MOLTBANK_CREDENTIALS_PATH`) plus `ACTIVE_ORG_OVERRIDE`, while keeping tokens and signer keys in a skill-local credentials file
40
40
 
41
41
  Once set up, your agent can manage treasury operations, set per-agent spending limits, handle x402 payments, and interact with MoltBank's MCP server — all within OpenClaw.
42
42
 
package/index.ts CHANGED
@@ -1974,6 +1974,42 @@ export function ensureMcporterConfig(skillDir: string, appBaseUrl: string, api:
1974
1974
  api.logger.info('[moltbank] ✓ MoltBank will use skill-local mcporter config only');
1975
1975
  }
1976
1976
 
1977
+ function runHostReadinessCheck(skillDir: string, api: LoggerApi): boolean {
1978
+ const active = parseActiveTokenFromCredentials();
1979
+ if (!active.ok || !active.activeOrg) {
1980
+ api.logger.warn('[moltbank] host setup incomplete: active organization could not be resolved for readiness verification');
1981
+ return false;
1982
+ }
1983
+
1984
+ const wrapperPath = IS_WIN ? join(skillDir, 'scripts', 'moltbank.ps1') : join(skillDir, 'scripts', 'moltbank.sh');
1985
+ const readinessArgs = ['call', 'MoltBank.get_balance', `organizationName=${active.activeOrg}`, 'date=today'];
1986
+ const readinessTimeoutMs = IS_WIN ? 30000 : 25000;
1987
+
1988
+ api.logger.info(`[moltbank] verifying readiness with authenticated balance read (org: ${active.activeOrg})...`);
1989
+
1990
+ const readiness = runCommand(wrapperPath, readinessArgs, {
1991
+ cwd: skillDir,
1992
+ silent: true,
1993
+ timeoutMs: readinessTimeoutMs,
1994
+ env: {
1995
+ ACTIVE_ORG_OVERRIDE: active.activeOrg
1996
+ }
1997
+ });
1998
+
1999
+ if (!readiness.ok) {
2000
+ const combined = `${readiness.stderr}\n${readiness.stdout}`.trim();
2001
+ const detail = lastNonEmptyLine(combined);
2002
+ if (detail) {
2003
+ api.logger.warn(`[moltbank] readiness detail: ${detail}`);
2004
+ }
2005
+ api.logger.warn('[moltbank] host setup incomplete: authenticated balance-read verification failed');
2006
+ return false;
2007
+ }
2008
+
2009
+ api.logger.info('[moltbank] host readiness verified (`MoltBank.get_balance`)');
2010
+ return true;
2011
+ }
2012
+
1977
2013
  // ─── sandbox env vars ────────────────────────────────────────────────────────
1978
2014
 
1979
2015
  export function injectSandboxEnv(skillDir: string, api: LoggerApi): boolean {
@@ -2338,98 +2374,8 @@ export async function runSetup(
2338
2374
  api.logger.info('[moltbank] [host 7/8] writing/registering mcporter config...');
2339
2375
  ensureMcporterConfig(skillDir, appBaseUrl, api);
2340
2376
 
2341
- api.logger.info('[moltbank] [host 8/8] running wrapper smoke test...');
2342
- const smokeTimeoutMs = IS_WIN ? 15000 : 20000;
2343
- let smokeOk = false;
2344
-
2345
- if (IS_WIN) {
2346
- const mcporterConfigPath = join(skillDir, 'assets', 'mcporter.json');
2347
- const active = parseActiveTokenFromCredentials();
2348
- const mcpSmoke = runCommand('mcporter', ['--config', mcporterConfigPath, 'list', 'MoltBank'], {
2349
- cwd: skillDir,
2350
- silent: true,
2351
- timeoutMs: smokeTimeoutMs,
2352
- env: {
2353
- MOLTBANK: active.token ?? '__MOLTBANK_PLACEHOLDER__'
2354
- }
2355
- });
2356
-
2357
- if (mcpSmoke.ok) {
2358
- api.logger.info('[moltbank] host smoke test passed (`mcporter list MoltBank`)');
2359
- smokeOk = true;
2360
- } else {
2361
- const mcpCombined = `${mcpSmoke.stderr}\n${mcpSmoke.stdout}`.trim();
2362
- const mcpCombinedLower = mcpCombined.toLowerCase();
2363
- const mcpDetail = lastNonEmptyLine(mcpCombined);
2364
- if (mcpDetail) {
2365
- api.logger.warn(`[moltbank] smoke detail: ${mcpDetail}`);
2366
- }
2367
-
2368
- const timedOut = mcpSmoke.stderr.includes('ETIMEDOUT') || mcpCombinedLower.includes('timed out');
2369
- if (timedOut) {
2370
- api.logger.warn(
2371
- `[moltbank] host MCP smoke timed out after ${Math.floor(smokeTimeoutMs / 1000)}s; running local fallback checks`
2372
- );
2373
-
2374
- const ps1Path = join(skillDir, 'scripts', 'moltbank.ps1');
2375
- const fallback = runCommand(
2376
- 'powershell',
2377
- [
2378
- '-NoProfile',
2379
- '-NonInteractive',
2380
- '-ExecutionPolicy',
2381
- 'Bypass',
2382
- '-Command',
2383
- "$ErrorActionPreference = 'Stop'; if (-not (Test-Path -LiteralPath $env:MOLTBANK_WRAPPER_PATH)) { throw 'moltbank.ps1 not found' }; if (-not (Get-Command bash -ErrorAction SilentlyContinue)) { throw 'bash is not installed or not on PATH' }; if (-not (Get-Command mcporter -ErrorAction SilentlyContinue)) { throw 'mcporter is not installed or not on PATH' }; Write-Output 'ok'"
2384
- ],
2385
- {
2386
- cwd: skillDir,
2387
- silent: true,
2388
- timeoutMs: 10000,
2389
- env: { MOLTBANK_WRAPPER_PATH: ps1Path }
2390
- }
2391
- );
2392
-
2393
- if (fallback.ok) {
2394
- api.logger.warn('[moltbank] host smoke fallback passed (wrapper prerequisites available), but MCP endpoint was not verified');
2395
- smokeOk = true;
2396
- } else {
2397
- const fallbackCombined = `${fallback.stderr}\n${fallback.stdout}`.trim();
2398
- const fallbackDetail = lastNonEmptyLine(fallbackCombined);
2399
- if (fallbackDetail) {
2400
- api.logger.warn(`[moltbank] fallback detail: ${fallbackDetail}`);
2401
- }
2402
- api.logger.warn('[moltbank] host setup incomplete: MCP smoke timed out and fallback checks failed');
2403
- }
2404
- } else if (
2405
- mcpCombinedLower.includes('mcporter') &&
2406
- (mcpCombinedLower.includes('not recognized') || mcpCombinedLower.includes('not found'))
2407
- ) {
2408
- api.logger.warn('[moltbank] mcporter binary not found in PATH during smoke test');
2409
- } else {
2410
- api.logger.warn('[moltbank] host setup incomplete: smoke test failed (`mcporter list MoltBank`)');
2411
- }
2412
- }
2413
- } else {
2414
- const smoke = runCommand(join(skillDir, 'scripts', 'moltbank.sh'), ['list', 'MoltBank'], {
2415
- cwd: skillDir,
2416
- silent: true,
2417
- timeoutMs: smokeTimeoutMs
2418
- });
2419
- if (!smoke.ok) {
2420
- const smokeCombined = `${smoke.stderr}\n${smoke.stdout}`.trim();
2421
- const smokeDetail = lastNonEmptyLine(smokeCombined);
2422
- if (smokeDetail) {
2423
- api.logger.warn(`[moltbank] smoke detail: ${smokeDetail}`);
2424
- }
2425
- api.logger.warn('[moltbank] host setup incomplete: smoke test failed (`moltbank list MoltBank` via platform script)');
2426
- } else {
2427
- api.logger.info('[moltbank] host smoke test passed (`moltbank list MoltBank`)');
2428
- smokeOk = true;
2429
- }
2430
- }
2431
-
2432
- hostReady = smokeOk;
2377
+ api.logger.info('[moltbank] [host 8/8] running readiness balance check...');
2378
+ hostReady = runHostReadinessCheck(skillDir, api);
2433
2379
 
2434
2380
  api.logger.info('[moltbank] host mode — setup completed with onboarding flow');
2435
2381
 
package/package.json CHANGED
@@ -1,20 +1,55 @@
1
1
  {
2
2
  "name": "@moltbankhq/openclaw",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "MoltBank stablecoin treasury CLI and OpenClaw plugin",
5
+ "homepage": "https://github.com/moltbankhq/openclaw-plugin#readme",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/moltbankhq/openclaw-plugin.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/moltbankhq/openclaw-plugin/issues"
12
+ },
5
13
  "main": "index.ts",
14
+ "types": "index.ts",
15
+ "exports": {
16
+ ".": "./index.ts",
17
+ "./cli": "./cli.ts",
18
+ "./package.json": "./package.json"
19
+ },
6
20
  "bin": {
7
21
  "moltbank": "./bin/moltbank.mjs"
8
22
  },
23
+ "files": [
24
+ "README.md",
25
+ "bin/",
26
+ "cli.ts",
27
+ "index.ts",
28
+ "openclaw.plugin.json"
29
+ ],
9
30
  "openclaw": {
10
31
  "extensions": [
11
32
  "./index.ts"
12
33
  ]
13
34
  },
14
- "keywords": [],
35
+ "keywords": [
36
+ "moltbank",
37
+ "openclaw",
38
+ "treasury",
39
+ "mcp",
40
+ "cli",
41
+ "stablecoin",
42
+ "x402"
43
+ ],
15
44
  "author": "",
16
45
  "license": "ISC",
17
46
  "type": "module",
47
+ "engines": {
48
+ "node": ">=22"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
18
53
  "dependencies": {
19
54
  "tsx": "^4.20.6"
20
55
  },