dashclaw 1.9.2 → 1.9.4

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 +42 -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
@@ -681,6 +681,48 @@ class DashClaw {
681
681
  return handle;
682
682
  }
683
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
+
684
726
  /**
685
727
  * Update the outcome of an existing action.
686
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.2",
3
+ "version": "1.9.4",
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": {