@clawtrial/courtroom 1.0.3-c → 1.0.3-d

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawtrial/courtroom",
3
- "version": "1.0.3c",
3
+ "version": "1.0.3d",
4
4
  "description": "AI Courtroom - Autonomous behavioral oversight for OpenClaw agents",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -355,6 +355,7 @@ skill.initialize(mockAgent).then(() => {
355
355
  log(' Run "clawtrial diagnose" for details\n');
356
356
  }
357
357
 
358
+ }
358
359
  // Stop command - kill the daemon
359
360
  function stop() {
360
361
  const { getCourtroomStatus } = require('../src/daemon');
@@ -374,7 +375,6 @@ function stop() {
374
375
  log('⚠️ Could not stop process: ' + err.message + '\n');
375
376
  }
376
377
  }
377
- }
378
378
 
379
379
 
380
380
  // Revoke command
package/scripts/daemon.js CHANGED
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  const { skill } = require('../src/skill');
8
+ const { StatusManager } = require('../src/daemon');
8
9
  const fs = require('fs');
9
10
  const path = require('path');
10
11
 
@@ -17,23 +18,30 @@ const mockAgent = {
17
18
  send: async () => {}
18
19
  };
19
20
 
21
+ // Create status manager
22
+ const statusManager = new StatusManager();
23
+
20
24
  // Initialize skill
21
25
  skill.initialize(mockAgent).then(() => {
22
26
  const status = skill.getStatus();
23
27
  if (status.initialized) {
24
28
  console.log('🏛️ Courtroom daemon started, PID:', process.pid);
25
29
 
26
- // Write PID file
27
- const pidPath = path.join(process.env.HOME || '', '.clawdbot', 'courtroom_daemon.pid');
28
- fs.writeFileSync(pidPath, process.pid.toString());
30
+ // Update status file
31
+ statusManager.update({
32
+ running: true,
33
+ initialized: true,
34
+ agentType: 'standalone_daemon',
35
+ pid: process.pid,
36
+ startedAt: new Date().toISOString()
37
+ });
29
38
 
30
- // Keep process alive
39
+ // Keep process alive with heartbeat
31
40
  setInterval(() => {
32
- // Heartbeat - update status file
33
- if (skill.statusManager) {
34
- skill.statusManager.update({ lastCheck: new Date().toISOString() });
35
- }
41
+ statusManager.update({ lastCheck: new Date().toISOString() });
36
42
  }, 30000); // Every 30 seconds
43
+
44
+ console.log('🏛️ Courtroom is monitoring conversations');
37
45
  } else {
38
46
  console.error('❌ Skill failed to initialize');
39
47
  process.exit(1);
@@ -46,6 +54,7 @@ skill.initialize(mockAgent).then(() => {
46
54
  // Handle graceful shutdown
47
55
  process.on('SIGTERM', async () => {
48
56
  console.log('🏛️ Shutting down courtroom daemon...');
57
+ statusManager.update({ running: false });
49
58
  if (skill) {
50
59
  await skill.shutdown();
51
60
  }
@@ -54,6 +63,7 @@ process.on('SIGTERM', async () => {
54
63
 
55
64
  process.on('SIGINT', async () => {
56
65
  console.log('🏛️ Shutting down courtroom daemon...');
66
+ statusManager.update({ running: false });
57
67
  if (skill) {
58
68
  await skill.shutdown();
59
69
  }