dashclaw 1.9.1 → 1.9.3

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 +39 -0
  2. package/dashclaw.js +46 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -314,6 +314,45 @@ Get root-cause trace for an action, including its assumptions, open loops, paren
314
314
 
315
315
  ---
316
316
 
317
+ ## Agent Presence & Health
318
+
319
+ Monitor agent uptime and status in real-time. Use heartbeats to detect when an agent crashes or loses network connectivity.
320
+
321
+ ### claw.heartbeat(options?)
322
+ Report agent presence and health to the dashboard.
323
+
324
+ **Parameters:**
325
+ | Parameter | Type | Required | Description |
326
+ |-----------|------|----------|-------------|
327
+ | options.status | string | No | Agent status: 'online', 'busy', 'error' (default: 'online') |
328
+ | options.currentTaskId | string | No | The ID of the task currently being executed |
329
+ | options.metadata | Object | No | Optional key-value pairs for additional context |
330
+
331
+ **Returns:** `Promise<{ status: string, timestamp: string }>`
332
+
333
+ ### claw.startHeartbeat(options?)
334
+ Start an automatic heartbeat timer that reports 'online' every minute.
335
+
336
+ **Parameters:**
337
+ | Parameter | Type | Required | Description |
338
+ |-----------|------|----------|-------------|
339
+ | options.interval | number | No | Heartbeat interval in milliseconds (default: 60000 / 1 min) |
340
+ | options.status | string | No | Status to report |
341
+
342
+ **Example:**
343
+ ```javascript
344
+ // Start reporting presence automatically
345
+ claw.startHeartbeat();
346
+
347
+ // Later, stop it
348
+ claw.stopHeartbeat();
349
+ ```
350
+
351
+ ### claw.stopHeartbeat()
352
+ Stop the automatic heartbeat timer.
353
+
354
+ ---
355
+
317
356
  ## Real-Time Flight Recorder
318
357
 
319
358
  Stream actions live to the dashboard as they happen.
package/dashclaw.js CHANGED
@@ -553,6 +553,10 @@ class DashClaw {
553
553
  * stream
554
554
  * .on('action.created', (data) => console.log('New action:', data))
555
555
  * .on('action.updated', (data) => console.log('Action updated:', data))
556
+ * .on('loop.created', (data) => console.log('New loop:', data))
557
+ * .on('loop.updated', (data) => console.log('Loop updated:', data))
558
+ * .on('goal.created', (data) => console.log('New goal:', data))
559
+ * .on('goal.updated', (data) => console.log('Goal updated:', data))
556
560
  * .on('policy.updated', (data) => console.log('Policy changed:', data))
557
561
  * .on('task.assigned', (data) => console.log('Task assigned:', data))
558
562
  * .on('task.completed', (data) => console.log('Task done:', data))
@@ -677,6 +681,48 @@ class DashClaw {
677
681
  return handle;
678
682
  }
679
683
 
684
+ /**
685
+ * Report agent presence and health.
686
+ * @param {Object} [options]
687
+ * @param {'online'|'busy'|'error'} [options.status='online']
688
+ * @param {string} [options.currentTaskId]
689
+ * @param {Object} [options.metadata]
690
+ * @returns {Promise<{status: string, timestamp: string}>}
691
+ */
692
+ async heartbeat({ status = 'online', currentTaskId, metadata } = {}) {
693
+ return this._request('/api/agents/heartbeat', 'POST', {
694
+ agent_id: this.agentId,
695
+ agent_name: this.agentName,
696
+ status,
697
+ current_task_id: currentTaskId,
698
+ metadata,
699
+ });
700
+ }
701
+
702
+ /**
703
+ * Start an automatic heartbeat timer.
704
+ * @param {Object} [options]
705
+ * @param {number} [options.interval=60000] - Interval in ms
706
+ */
707
+ startHeartbeat(options = {}) {
708
+ if (this._heartbeatTimer) return;
709
+ const interval = options.interval || 60000;
710
+ this.heartbeat(options).catch(() => {}); // Initial heartbeat
711
+ this._heartbeatTimer = setInterval(() => {
712
+ this.heartbeat(options).catch(() => {});
713
+ }, interval);
714
+ }
715
+
716
+ /**
717
+ * Stop the automatic heartbeat timer.
718
+ */
719
+ stopHeartbeat() {
720
+ if (this._heartbeatTimer) {
721
+ clearInterval(this._heartbeatTimer);
722
+ this._heartbeatTimer = null;
723
+ }
724
+ }
725
+
680
726
  /**
681
727
  * Update the outcome of an existing action.
682
728
  * @param {string} actionId - The action_id to update
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashclaw",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "Full-featured agent toolkit for the DashClaw platform. 96+ methods across 22+ categories for action recording, context management, session handoffs, security scanning, behavior guard, compliance, task routing, identity binding, organization management, webhooks, bulk sync, and more.",
5
5
  "type": "module",
6
6
  "publishConfig": {