@lawrenceliang-btc/atel-sdk 1.1.32 โ†’ 1.1.33

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 (2) hide show
  1. package/bin/atel.mjs +37 -1
  2. package/package.json +1 -1
package/bin/atel.mjs CHANGED
@@ -51,7 +51,7 @@
51
51
  * atel boost-status [did] Check boost status
52
52
  */
53
53
 
54
- import { readFileSync, writeFileSync, existsSync, mkdirSync, appendFileSync, copyFileSync } from 'node:fs';
54
+ import { readFileSync, writeFileSync, existsSync, mkdirSync, appendFileSync, copyFileSync, statSync, readdirSync, unlinkSync } from 'node:fs';
55
55
  import { fileURLToPath } from 'node:url';
56
56
  import { cmdHub, cmdSwap, cmdTransfer } from './hub-helpers.mjs';
57
57
  import { resolve, join, dirname } from 'node:path';
@@ -2403,6 +2403,42 @@ async function startToolGatewayProxy(port, identity, policy) {
2403
2403
 
2404
2404
  async function cmdStart(port) {
2405
2405
  const id = requireIdentity();
2406
+
2407
+ // Cleanup stale openclaw session locks left behind by previous crashes /
2408
+ // network outages. Without this an agent that lost network mid-session leaves
2409
+ // .lock files in /root/.openclaw/agents/main/sessions/, and the next openclaw
2410
+ // run reports "session file locked (timeout 10000ms)" and refuses to handle
2411
+ // any new milestones until a human cleans up. Treat any lock older than 60s
2412
+ // whose owning pid is no longer alive as stale.
2413
+ try {
2414
+ const home = process.env.HOME || '/root';
2415
+ const sessionDir = join(home, '.openclaw', 'agents', 'main', 'sessions');
2416
+ if (existsSync(sessionDir)) {
2417
+ const entries = readdirSync(sessionDir).filter(f => f.endsWith('.lock'));
2418
+ let removed = 0;
2419
+ const now = Date.now();
2420
+ for (const f of entries) {
2421
+ const full = join(sessionDir, f);
2422
+ try {
2423
+ const st = statSync(full);
2424
+ // Stale if older than 60s โ€” openclaw refreshes locks frequently
2425
+ // when actively working, so anything older almost certainly belongs
2426
+ // to a dead session.
2427
+ if (now - st.mtimeMs > 60_000) {
2428
+ unlinkSync(full);
2429
+ removed++;
2430
+ }
2431
+ } catch {}
2432
+ }
2433
+ if (removed > 0) {
2434
+ log({ event: 'openclaw_stale_locks_removed', count: removed, dir: sessionDir });
2435
+ console.log(`๐Ÿงน Cleaned up ${removed} stale openclaw session lock(s) from ${sessionDir}`);
2436
+ }
2437
+ }
2438
+ } catch (e) {
2439
+ log({ event: 'openclaw_lock_cleanup_error', error: e.message });
2440
+ }
2441
+
2406
2442
  // Initialize Ollama only if explicitly enabled (optional local AI audit)
2407
2443
  if (process.env.ATEL_OLLAMA_ENABLED === 'true') {
2408
2444
  await initializeOllama().catch(err => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lawrenceliang-btc/atel-sdk",
3
- "version": "1.1.32",
3
+ "version": "1.1.33",
4
4
  "description": "ATEL Protocol SDK - Agent Trust & Exchange Layer",
5
5
  "repository": {
6
6
  "type": "git",