dashclaw 1.7.2 → 1.8.1
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/README.md +867 -1
- package/dashclaw.js +530 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Full reference for the DashClaw SDK (Node.js). For Python, see the [Python SDK docs](../sdk-python/README.md).
|
|
4
4
|
|
|
5
|
-
Install, configure, and instrument your AI agents with
|
|
5
|
+
Install, configure, and instrument your AI agents with 95+ methods across 21+ categories including action recording, behavior guard, context management, session handoffs, security scanning, agent messaging, agent pairing, identity binding, organization management, webhooks, policy testing, compliance, task routing, and more.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -239,6 +239,54 @@ Stream actions live to the dashboard as they happen.
|
|
|
239
239
|
|
|
240
240
|
---
|
|
241
241
|
|
|
242
|
+
## Real-Time Events
|
|
243
|
+
|
|
244
|
+
Subscribe to server-sent events (SSE) for instant push notifications. Eliminates polling for approvals, policy changes, and task assignments.
|
|
245
|
+
|
|
246
|
+
### claw.events()
|
|
247
|
+
|
|
248
|
+
Open a persistent SSE connection. Returns a chainable handle with `.on(event, callback)` and `.close()`.
|
|
249
|
+
|
|
250
|
+
**Supported events:** `action.created`, `action.updated`, `message.created`, `policy.updated`, `task.assigned`, `task.completed`
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
const stream = claw.events();
|
|
254
|
+
|
|
255
|
+
stream
|
|
256
|
+
.on('action.created', (data) => console.log('New action:', data.action_id))
|
|
257
|
+
.on('action.updated', (data) => {
|
|
258
|
+
if (data.status === 'running') console.log('Approved:', data.action_id);
|
|
259
|
+
})
|
|
260
|
+
.on('policy.updated', (data) => console.log('Policy changed:', data.change_type))
|
|
261
|
+
.on('task.assigned', (data) => console.log('Task routed:', data.task?.title))
|
|
262
|
+
.on('task.completed', (data) => console.log('Task done:', data.task?.task_id))
|
|
263
|
+
.on('error', (err) => console.error('Stream error:', err));
|
|
264
|
+
|
|
265
|
+
// When done:
|
|
266
|
+
stream.close();
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### claw.waitForApproval(actionId, { useEvents: true })
|
|
270
|
+
|
|
271
|
+
SSE-powered approval waiting — resolves instantly when the operator approves/denies instead of polling every 5 seconds.
|
|
272
|
+
|
|
273
|
+
```javascript
|
|
274
|
+
// SSE mode (instant, recommended)
|
|
275
|
+
const { action } = await claw.waitForApproval('act_abc', { useEvents: true });
|
|
276
|
+
|
|
277
|
+
// Polling mode (default, backward-compatible)
|
|
278
|
+
const { action } = await claw.waitForApproval('act_abc');
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
| Parameter | Type | Default | Description |
|
|
282
|
+
|-----------|------|---------|-------------|
|
|
283
|
+
| actionId | string | — | Action ID to watch |
|
|
284
|
+
| options.timeout | number | 300000 | Max wait time (ms) |
|
|
285
|
+
| options.interval | number | 5000 | Poll interval (polling mode only) |
|
|
286
|
+
| options.useEvents | boolean | false | Use SSE instead of polling |
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
242
290
|
## Token & Cost Analytics
|
|
243
291
|
|
|
244
292
|
Track token usage and estimated costs for every action. DashClaw automatically aggregates these into "Cost per Goal" metrics.
|
|
@@ -412,6 +460,20 @@ Retrieve recent guard evaluation decisions for audit and review.
|
|
|
412
460
|
|
|
413
461
|
Push data from your agent directly to the DashClaw dashboard. All methods auto-attach the agent's agentId.
|
|
414
462
|
|
|
463
|
+
### claw.reportTokenUsage(usage)
|
|
464
|
+
Report a token usage snapshot for this agent.
|
|
465
|
+
|
|
466
|
+
**Parameters:**
|
|
467
|
+
| Parameter | Type | Required | Description |
|
|
468
|
+
|-----------|------|----------|-------------|
|
|
469
|
+
| tokens_in | number | Yes | Input tokens consumed |
|
|
470
|
+
| tokens_out | number | Yes | Output tokens generated |
|
|
471
|
+
| context_used | number | No | Context window tokens used |
|
|
472
|
+
| context_max | number | No | Context window max capacity |
|
|
473
|
+
| model | string | No | Model name |
|
|
474
|
+
|
|
475
|
+
**Returns:** `Promise<{snapshot: Object}>`
|
|
476
|
+
|
|
415
477
|
### claw.recordDecision(entry)
|
|
416
478
|
Record a decision for the learning database. Track what your agent decides and why.
|
|
417
479
|
|
|
@@ -543,6 +605,47 @@ Report active connections/integrations for this agent.
|
|
|
543
605
|
|
|
544
606
|
**Returns:** `Promise<{ connections: Object[], created: number }>`
|
|
545
607
|
|
|
608
|
+
### claw.createCalendarEvent(event)
|
|
609
|
+
Create a calendar event.
|
|
610
|
+
|
|
611
|
+
**Parameters:**
|
|
612
|
+
| Parameter | Type | Required | Description |
|
|
613
|
+
|-----------|------|----------|-------------|
|
|
614
|
+
| summary | string | Yes | Event title/summary |
|
|
615
|
+
| start_time | string | Yes | Start time (ISO string) |
|
|
616
|
+
| end_time | string | No | End time (ISO string) |
|
|
617
|
+
| location | string | No | Event location |
|
|
618
|
+
| description | string | No | Event description |
|
|
619
|
+
|
|
620
|
+
**Returns:** `Promise<{event: Object}>`
|
|
621
|
+
|
|
622
|
+
### claw.recordIdea(idea)
|
|
623
|
+
Record an idea or inspiration for later review.
|
|
624
|
+
|
|
625
|
+
**Parameters:**
|
|
626
|
+
| Parameter | Type | Required | Description |
|
|
627
|
+
|-----------|------|----------|-------------|
|
|
628
|
+
| title | string | Yes | Idea title |
|
|
629
|
+
| description | string | No | Detailed description |
|
|
630
|
+
| category | string | No | Category |
|
|
631
|
+
| score | number | No | Priority/quality score 0-100 |
|
|
632
|
+
| status | string | No | "pending", "in_progress", "shipped", "rejected" |
|
|
633
|
+
| source | string | No | Where this idea came from |
|
|
634
|
+
|
|
635
|
+
**Returns:** `Promise<{idea: Object}>`
|
|
636
|
+
|
|
637
|
+
### claw.reportMemoryHealth(report)
|
|
638
|
+
Report a memory health snapshot with entities and topics.
|
|
639
|
+
|
|
640
|
+
**Parameters:**
|
|
641
|
+
| Parameter | Type | Required | Description |
|
|
642
|
+
|-----------|------|----------|-------------|
|
|
643
|
+
| health | Object | Yes | Health metrics (must include `score` 0-100) |
|
|
644
|
+
| entities | Object[] | No | Key entities found in memory |
|
|
645
|
+
| topics | Object[] | No | Topics/themes found in memory |
|
|
646
|
+
|
|
647
|
+
**Returns:** `Promise<{snapshot: Object, entities_count: number, topics_count: number}>`
|
|
648
|
+
|
|
546
649
|
---
|
|
547
650
|
|
|
548
651
|
## Session Handoffs
|
|
@@ -573,6 +676,20 @@ Get handoffs for this agent with optional date and limit filters.
|
|
|
573
676
|
|
|
574
677
|
**Returns:** `Promise<{handoffs: Object[], total: number}>`
|
|
575
678
|
|
|
679
|
+
### claw.getLatestHandoff()
|
|
680
|
+
Get the most recent handoff for this agent. Useful for resuming context at the start of a new session.
|
|
681
|
+
|
|
682
|
+
**Returns:** `Promise<{handoff: Object|null}>`
|
|
683
|
+
|
|
684
|
+
**Example:**
|
|
685
|
+
```javascript
|
|
686
|
+
const { handoff } = await claw.getLatestHandoff();
|
|
687
|
+
if (handoff) {
|
|
688
|
+
console.log('Last session:', handoff.summary);
|
|
689
|
+
console.log('Next priorities:', handoff.next_priorities);
|
|
690
|
+
}
|
|
691
|
+
```
|
|
692
|
+
|
|
576
693
|
---
|
|
577
694
|
|
|
578
695
|
## Context Manager
|
|
@@ -603,9 +720,63 @@ Create a context thread for tracking a topic across multiple entries.
|
|
|
603
720
|
|
|
604
721
|
**Returns:** `Promise<{thread: Object, thread_id: string}>`
|
|
605
722
|
|
|
723
|
+
### claw.getKeyPoints(filters?)
|
|
724
|
+
Get key points with optional filters.
|
|
725
|
+
|
|
726
|
+
**Parameters:**
|
|
727
|
+
| Parameter | Type | Required | Description |
|
|
728
|
+
|-----------|------|----------|-------------|
|
|
729
|
+
| category | string | No | Filter by category: decision, task, insight, question, general |
|
|
730
|
+
| session_date | string | No | Filter by date (YYYY-MM-DD) |
|
|
731
|
+
| limit | number | No | Max results |
|
|
732
|
+
|
|
733
|
+
**Returns:** `Promise<{points: Object[], total: number}>`
|
|
734
|
+
|
|
606
735
|
### claw.addThreadEntry(threadId, content, entryType?)
|
|
607
736
|
Add an entry to an existing thread.
|
|
608
737
|
|
|
738
|
+
**Parameters:**
|
|
739
|
+
| Parameter | Type | Required | Description |
|
|
740
|
+
|-----------|------|----------|-------------|
|
|
741
|
+
| threadId | string | Yes | The thread ID |
|
|
742
|
+
| content | string | Yes | Entry content |
|
|
743
|
+
| entryType | string | No | Entry type (default: "note") |
|
|
744
|
+
|
|
745
|
+
**Returns:** `Promise<{entry: Object, entry_id: string}>`
|
|
746
|
+
|
|
747
|
+
### claw.closeThread(threadId, summary?)
|
|
748
|
+
Close a context thread with an optional final summary.
|
|
749
|
+
|
|
750
|
+
**Parameters:**
|
|
751
|
+
| Parameter | Type | Required | Description |
|
|
752
|
+
|-----------|------|----------|-------------|
|
|
753
|
+
| threadId | string | Yes | The thread ID to close |
|
|
754
|
+
| summary | string | No | Final summary for the thread |
|
|
755
|
+
|
|
756
|
+
**Returns:** `Promise<{thread: Object}>`
|
|
757
|
+
|
|
758
|
+
### claw.getThreads(filters?)
|
|
759
|
+
Get context threads with optional filters.
|
|
760
|
+
|
|
761
|
+
**Parameters:**
|
|
762
|
+
| Parameter | Type | Required | Description |
|
|
763
|
+
|-----------|------|----------|-------------|
|
|
764
|
+
| status | string | No | Filter by status: active, closed |
|
|
765
|
+
| limit | number | No | Max results |
|
|
766
|
+
|
|
767
|
+
**Returns:** `Promise<{threads: Object[], total: number}>`
|
|
768
|
+
|
|
769
|
+
### claw.getContextSummary()
|
|
770
|
+
Get a combined context summary containing today's key points and all active threads. Convenience method that calls `getKeyPoints()` and `getThreads()` in parallel.
|
|
771
|
+
|
|
772
|
+
**Returns:** `Promise<{points: Object[], threads: Object[]}>`
|
|
773
|
+
|
|
774
|
+
**Example:**
|
|
775
|
+
```javascript
|
|
776
|
+
const { points, threads } = await claw.getContextSummary();
|
|
777
|
+
console.log(`${points.length} key points today, ${threads.length} active threads`);
|
|
778
|
+
```
|
|
779
|
+
|
|
609
780
|
---
|
|
610
781
|
|
|
611
782
|
## Automation Snippets
|
|
@@ -702,6 +873,144 @@ await claw.deleteSnippet('sn_abc123');
|
|
|
702
873
|
|
|
703
874
|
---
|
|
704
875
|
|
|
876
|
+
## User Preferences
|
|
877
|
+
|
|
878
|
+
Track user observations, learned preferences, mood/energy, and approach effectiveness across sessions.
|
|
879
|
+
|
|
880
|
+
### claw.logObservation(obs)
|
|
881
|
+
Log a user observation (what you noticed about the user's behavior or preferences).
|
|
882
|
+
|
|
883
|
+
**Parameters:**
|
|
884
|
+
| Parameter | Type | Required | Description |
|
|
885
|
+
|-----------|------|----------|-------------|
|
|
886
|
+
| observation | string | Yes | The observation text |
|
|
887
|
+
| category | string | No | Category tag |
|
|
888
|
+
| importance | number | No | Importance 1-10 |
|
|
889
|
+
|
|
890
|
+
**Returns:** `Promise<{observation: Object, observation_id: string}>`
|
|
891
|
+
|
|
892
|
+
**Example:**
|
|
893
|
+
```javascript
|
|
894
|
+
await claw.logObservation({
|
|
895
|
+
observation: 'User prefers concise responses over detailed explanations',
|
|
896
|
+
category: 'communication',
|
|
897
|
+
importance: 8,
|
|
898
|
+
});
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
### claw.setPreference(pref)
|
|
902
|
+
Set a learned user preference. Use this to record patterns you detect about how the user likes to work.
|
|
903
|
+
|
|
904
|
+
**Parameters:**
|
|
905
|
+
| Parameter | Type | Required | Description |
|
|
906
|
+
|-----------|------|----------|-------------|
|
|
907
|
+
| preference | string | Yes | The preference description |
|
|
908
|
+
| category | string | No | Category tag |
|
|
909
|
+
| confidence | number | No | Confidence 0-100 |
|
|
910
|
+
|
|
911
|
+
**Returns:** `Promise<{preference: Object, preference_id: string}>`
|
|
912
|
+
|
|
913
|
+
### claw.logMood(entry)
|
|
914
|
+
Log user mood/energy for a session. Helps track patterns in productivity and satisfaction.
|
|
915
|
+
|
|
916
|
+
**Parameters:**
|
|
917
|
+
| Parameter | Type | Required | Description |
|
|
918
|
+
|-----------|------|----------|-------------|
|
|
919
|
+
| mood | string | Yes | Mood description (e.g., "focused", "frustrated") |
|
|
920
|
+
| energy | string | No | Energy level (e.g., "high", "low") |
|
|
921
|
+
| notes | string | No | Additional notes |
|
|
922
|
+
|
|
923
|
+
**Returns:** `Promise<{mood: Object, mood_id: string}>`
|
|
924
|
+
|
|
925
|
+
### claw.trackApproach(entry)
|
|
926
|
+
Track an approach and whether it succeeded or failed. Builds a knowledge base of what works.
|
|
927
|
+
|
|
928
|
+
**Parameters:**
|
|
929
|
+
| Parameter | Type | Required | Description |
|
|
930
|
+
|-----------|------|----------|-------------|
|
|
931
|
+
| approach | string | Yes | The approach description |
|
|
932
|
+
| context | string | No | Context for when to use this approach |
|
|
933
|
+
| success | boolean | No | true = worked, false = failed, undefined = just recording |
|
|
934
|
+
|
|
935
|
+
**Returns:** `Promise<{approach: Object, approach_id: string}>`
|
|
936
|
+
|
|
937
|
+
### claw.getPreferenceSummary()
|
|
938
|
+
Get a summary of all user preference data including observations, preferences, moods, and approaches.
|
|
939
|
+
|
|
940
|
+
**Returns:** `Promise<{summary: Object}>`
|
|
941
|
+
|
|
942
|
+
### claw.getApproaches(filters?)
|
|
943
|
+
Get tracked approaches with success/fail counts.
|
|
944
|
+
|
|
945
|
+
**Parameters:**
|
|
946
|
+
| Parameter | Type | Required | Description |
|
|
947
|
+
|-----------|------|----------|-------------|
|
|
948
|
+
| limit | number | No | Max results |
|
|
949
|
+
|
|
950
|
+
**Returns:** `Promise<{approaches: Object[], total: number}>`
|
|
951
|
+
|
|
952
|
+
---
|
|
953
|
+
|
|
954
|
+
## Daily Digest
|
|
955
|
+
|
|
956
|
+
### claw.getDailyDigest(date?)
|
|
957
|
+
Get a daily activity digest aggregated from all data sources (actions, decisions, handoffs, context, etc.).
|
|
958
|
+
|
|
959
|
+
**Parameters:**
|
|
960
|
+
| Parameter | Type | Required | Description |
|
|
961
|
+
|-----------|------|----------|-------------|
|
|
962
|
+
| date | string | No | Date string YYYY-MM-DD (defaults to today) |
|
|
963
|
+
|
|
964
|
+
**Returns:** `Promise<{date: string, digest: Object, summary: Object}>`
|
|
965
|
+
|
|
966
|
+
**Example:**
|
|
967
|
+
```javascript
|
|
968
|
+
const { digest, summary } = await claw.getDailyDigest('2025-01-15');
|
|
969
|
+
console.log(`Actions: ${summary.actions_count}, Decisions: ${summary.decisions_count}`);
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
---
|
|
973
|
+
|
|
974
|
+
## Security Scanning
|
|
975
|
+
|
|
976
|
+
Scan text for sensitive data before sending it anywhere. The scanner detects API keys, tokens, PII, and other secrets.
|
|
977
|
+
|
|
978
|
+
### claw.scanContent(text, destination?)
|
|
979
|
+
Scan text for sensitive data. Returns findings and redacted text. Does NOT store the original content.
|
|
980
|
+
|
|
981
|
+
**Parameters:**
|
|
982
|
+
| Parameter | Type | Required | Description |
|
|
983
|
+
|-----------|------|----------|-------------|
|
|
984
|
+
| text | string | Yes | Text to scan |
|
|
985
|
+
| destination | string | No | Where this text is headed (for context) |
|
|
986
|
+
|
|
987
|
+
**Returns:** `Promise<{clean: boolean, findings_count: number, findings: Object[], redacted_text: string}>`
|
|
988
|
+
|
|
989
|
+
**Example:**
|
|
990
|
+
```javascript
|
|
991
|
+
const result = await claw.scanContent(
|
|
992
|
+
'Deploy with key sk-abc123xyz to production',
|
|
993
|
+
'slack'
|
|
994
|
+
);
|
|
995
|
+
if (!result.clean) {
|
|
996
|
+
console.log(`Found ${result.findings_count} issues`);
|
|
997
|
+
console.log('Safe version:', result.redacted_text);
|
|
998
|
+
}
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
### claw.reportSecurityFinding(text, destination?)
|
|
1002
|
+
Scan text and store finding metadata for audit trails. The original content is never stored, only the finding metadata.
|
|
1003
|
+
|
|
1004
|
+
**Parameters:**
|
|
1005
|
+
| Parameter | Type | Required | Description |
|
|
1006
|
+
|-----------|------|----------|-------------|
|
|
1007
|
+
| text | string | Yes | Text to scan |
|
|
1008
|
+
| destination | string | No | Where this text is headed |
|
|
1009
|
+
|
|
1010
|
+
**Returns:** `Promise<{clean: boolean, findings_count: number, findings: Object[], redacted_text: string}>`
|
|
1011
|
+
|
|
1012
|
+
---
|
|
1013
|
+
|
|
705
1014
|
## Agent Messaging
|
|
706
1015
|
|
|
707
1016
|
### claw.sendMessage(params)
|
|
@@ -720,9 +1029,298 @@ Send a message to another agent or broadcast.
|
|
|
720
1029
|
|
|
721
1030
|
**Returns:** `Promise<{message: Object, message_id: string}>`
|
|
722
1031
|
|
|
1032
|
+
### claw.getInbox(params?)
|
|
1033
|
+
Get inbox messages for this agent.
|
|
1034
|
+
|
|
1035
|
+
**Parameters:**
|
|
1036
|
+
| Parameter | Type | Required | Description |
|
|
1037
|
+
|-----------|------|----------|-------------|
|
|
1038
|
+
| type | string | No | Filter by message type |
|
|
1039
|
+
| unread | boolean | No | Only unread messages |
|
|
1040
|
+
| threadId | string | No | Filter by thread |
|
|
1041
|
+
| limit | number | No | Max messages to return (default: 50) |
|
|
1042
|
+
|
|
1043
|
+
**Returns:** `Promise<{messages: Object[], total: number, unread_count: number}>`
|
|
1044
|
+
|
|
1045
|
+
### claw.markRead(messageIds)
|
|
1046
|
+
Mark messages as read.
|
|
1047
|
+
|
|
1048
|
+
**Parameters:**
|
|
1049
|
+
| Parameter | Type | Required | Description |
|
|
1050
|
+
|-----------|------|----------|-------------|
|
|
1051
|
+
| messageIds | string[] | Yes | Array of message IDs to mark read |
|
|
1052
|
+
|
|
1053
|
+
**Returns:** `Promise<{updated: number}>`
|
|
1054
|
+
|
|
1055
|
+
### claw.archiveMessages(messageIds)
|
|
1056
|
+
Archive messages.
|
|
1057
|
+
|
|
1058
|
+
**Parameters:**
|
|
1059
|
+
| Parameter | Type | Required | Description |
|
|
1060
|
+
|-----------|------|----------|-------------|
|
|
1061
|
+
| messageIds | string[] | Yes | Array of message IDs to archive |
|
|
1062
|
+
|
|
1063
|
+
**Returns:** `Promise<{updated: number}>`
|
|
1064
|
+
|
|
1065
|
+
### claw.broadcast(params)
|
|
1066
|
+
Broadcast a message to all agents in the organization.
|
|
1067
|
+
|
|
1068
|
+
**Parameters:**
|
|
1069
|
+
| Parameter | Type | Required | Description |
|
|
1070
|
+
|-----------|------|----------|-------------|
|
|
1071
|
+
| type | string | No | Message type (default: "info") |
|
|
1072
|
+
| subject | string | No | Subject line |
|
|
1073
|
+
| body | string | Yes | Message body |
|
|
1074
|
+
| threadId | string | No | Thread ID |
|
|
1075
|
+
|
|
1076
|
+
**Returns:** `Promise<{message: Object, message_id: string}>`
|
|
1077
|
+
|
|
1078
|
+
### claw.createMessageThread(params)
|
|
1079
|
+
Create a new message thread for multi-turn conversations between agents.
|
|
1080
|
+
|
|
1081
|
+
**Parameters:**
|
|
1082
|
+
| Parameter | Type | Required | Description |
|
|
1083
|
+
|-----------|------|----------|-------------|
|
|
1084
|
+
| name | string | Yes | Thread name |
|
|
1085
|
+
| participants | string[] | No | Agent IDs (null = open to all) |
|
|
1086
|
+
|
|
1087
|
+
**Returns:** `Promise<{thread: Object, thread_id: string}>`
|
|
1088
|
+
|
|
1089
|
+
### claw.getMessageThreads(params?)
|
|
1090
|
+
List message threads.
|
|
1091
|
+
|
|
1092
|
+
**Parameters:**
|
|
1093
|
+
| Parameter | Type | Required | Description |
|
|
1094
|
+
|-----------|------|----------|-------------|
|
|
1095
|
+
| status | string | No | Filter by status: open, resolved, archived |
|
|
1096
|
+
| limit | number | No | Max threads to return (default: 20) |
|
|
1097
|
+
|
|
1098
|
+
**Returns:** `Promise<{threads: Object[], total: number}>`
|
|
1099
|
+
|
|
1100
|
+
### claw.resolveMessageThread(threadId, summary?)
|
|
1101
|
+
Resolve (close) a message thread with an optional summary.
|
|
1102
|
+
|
|
1103
|
+
**Parameters:**
|
|
1104
|
+
| Parameter | Type | Required | Description |
|
|
1105
|
+
|-----------|------|----------|-------------|
|
|
1106
|
+
| threadId | string | Yes | Thread ID to resolve |
|
|
1107
|
+
| summary | string | No | Resolution summary |
|
|
1108
|
+
|
|
1109
|
+
**Returns:** `Promise<{thread: Object}>`
|
|
1110
|
+
|
|
723
1111
|
### claw.saveSharedDoc(params)
|
|
724
1112
|
Create or update a shared workspace document. Upserts by name.
|
|
725
1113
|
|
|
1114
|
+
**Parameters:**
|
|
1115
|
+
| Parameter | Type | Required | Description |
|
|
1116
|
+
|-----------|------|----------|-------------|
|
|
1117
|
+
| name | string | Yes | Document name (unique per org) |
|
|
1118
|
+
| content | string | Yes | Document content |
|
|
1119
|
+
|
|
1120
|
+
**Returns:** `Promise<{doc: Object, doc_id: string}>`
|
|
1121
|
+
|
|
1122
|
+
---
|
|
1123
|
+
|
|
1124
|
+
## Agent Pairing
|
|
1125
|
+
|
|
1126
|
+
Pair agents with user accounts via public key registration and approval flow.
|
|
1127
|
+
|
|
1128
|
+
### claw.createPairing(options)
|
|
1129
|
+
Create an agent pairing request. Returns a link the user can click to approve the pairing.
|
|
1130
|
+
|
|
1131
|
+
**Parameters:**
|
|
1132
|
+
| Parameter | Type | Required | Description |
|
|
1133
|
+
|-----------|------|----------|-------------|
|
|
1134
|
+
| publicKeyPem | string | Yes | PEM public key (SPKI format) to register for this agent |
|
|
1135
|
+
| algorithm | string | No | Signing algorithm (default: "RSASSA-PKCS1-v1_5") |
|
|
1136
|
+
| agentName | string | No | Agent name override |
|
|
1137
|
+
|
|
1138
|
+
**Returns:** `Promise<{pairing: Object, pairing_url: string}>`
|
|
1139
|
+
|
|
1140
|
+
### claw.createPairingFromPrivateJwk(privateJwk, options?)
|
|
1141
|
+
Convenience method that derives the public PEM from a private JWK and creates a pairing request.
|
|
1142
|
+
|
|
1143
|
+
**Parameters:**
|
|
1144
|
+
| Parameter | Type | Required | Description |
|
|
1145
|
+
|-----------|------|----------|-------------|
|
|
1146
|
+
| privateJwk | Object | Yes | Private key in JWK format |
|
|
1147
|
+
| options.agentName | string | No | Agent name override |
|
|
1148
|
+
|
|
1149
|
+
**Returns:** `Promise<{pairing: Object, pairing_url: string}>`
|
|
1150
|
+
|
|
1151
|
+
### claw.waitForPairing(pairingId, options?)
|
|
1152
|
+
Poll a pairing request until it is approved or expired.
|
|
1153
|
+
|
|
1154
|
+
**Parameters:**
|
|
1155
|
+
| Parameter | Type | Required | Description |
|
|
1156
|
+
|-----------|------|----------|-------------|
|
|
1157
|
+
| pairingId | string | Yes | The pairing ID to poll |
|
|
1158
|
+
| options.timeout | number | No | Max wait time in ms (default: 300000 / 5 min) |
|
|
1159
|
+
| options.interval | number | No | Poll interval in ms (default: 2000) |
|
|
1160
|
+
|
|
1161
|
+
**Returns:** `Promise<Object>` (the approved pairing object)
|
|
1162
|
+
|
|
1163
|
+
**Throws:** `Error` if pairing expires or times out.
|
|
1164
|
+
|
|
1165
|
+
**Example:**
|
|
1166
|
+
```javascript
|
|
1167
|
+
const { pairing, pairing_url } = await claw.createPairing({
|
|
1168
|
+
publicKeyPem: myPublicKeyPem,
|
|
1169
|
+
});
|
|
1170
|
+
console.log('Approve pairing at:', pairing_url);
|
|
1171
|
+
|
|
1172
|
+
const approved = await claw.waitForPairing(pairing.id);
|
|
1173
|
+
console.log('Pairing approved!', approved.status);
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1176
|
+
---
|
|
1177
|
+
|
|
1178
|
+
## Identity Binding
|
|
1179
|
+
|
|
1180
|
+
Register and manage agent public keys for cryptographic identity verification.
|
|
1181
|
+
|
|
1182
|
+
### claw.registerIdentity(identity)
|
|
1183
|
+
Register or update an agent's public key for identity verification. Requires admin API key.
|
|
1184
|
+
|
|
1185
|
+
**Parameters:**
|
|
1186
|
+
| Parameter | Type | Required | Description |
|
|
1187
|
+
|-----------|------|----------|-------------|
|
|
1188
|
+
| agent_id | string | Yes | Agent ID to register |
|
|
1189
|
+
| public_key | string | Yes | PEM public key (SPKI format) |
|
|
1190
|
+
| algorithm | string | No | Signing algorithm (default: "RSASSA-PKCS1-v1_5") |
|
|
1191
|
+
|
|
1192
|
+
**Returns:** `Promise<{identity: Object}>`
|
|
1193
|
+
|
|
1194
|
+
### claw.getIdentities()
|
|
1195
|
+
List all registered agent identities for this organization.
|
|
1196
|
+
|
|
1197
|
+
**Returns:** `Promise<{identities: Object[]}>`
|
|
1198
|
+
|
|
1199
|
+
---
|
|
1200
|
+
|
|
1201
|
+
## Organization Management
|
|
1202
|
+
|
|
1203
|
+
Manage organizations and API keys. All methods require admin API key.
|
|
1204
|
+
|
|
1205
|
+
### claw.getOrg()
|
|
1206
|
+
Get the current organization's details.
|
|
1207
|
+
|
|
1208
|
+
**Returns:** `Promise<{organizations: Object[]}>`
|
|
1209
|
+
|
|
1210
|
+
### claw.createOrg(org)
|
|
1211
|
+
Create a new organization with an initial admin API key.
|
|
1212
|
+
|
|
1213
|
+
**Parameters:**
|
|
1214
|
+
| Parameter | Type | Required | Description |
|
|
1215
|
+
|-----------|------|----------|-------------|
|
|
1216
|
+
| name | string | Yes | Organization name |
|
|
1217
|
+
| slug | string | Yes | URL-safe slug (lowercase alphanumeric + hyphens) |
|
|
1218
|
+
|
|
1219
|
+
**Returns:** `Promise<{organization: Object, api_key: Object}>`
|
|
1220
|
+
|
|
1221
|
+
### claw.getOrgById(orgId)
|
|
1222
|
+
Get organization details by ID.
|
|
1223
|
+
|
|
1224
|
+
**Parameters:**
|
|
1225
|
+
| Parameter | Type | Required | Description |
|
|
1226
|
+
|-----------|------|----------|-------------|
|
|
1227
|
+
| orgId | string | Yes | Organization ID |
|
|
1228
|
+
|
|
1229
|
+
**Returns:** `Promise<{organization: Object}>`
|
|
1230
|
+
|
|
1231
|
+
### claw.updateOrg(orgId, updates)
|
|
1232
|
+
Update organization details.
|
|
1233
|
+
|
|
1234
|
+
**Parameters:**
|
|
1235
|
+
| Parameter | Type | Required | Description |
|
|
1236
|
+
|-----------|------|----------|-------------|
|
|
1237
|
+
| orgId | string | Yes | Organization ID |
|
|
1238
|
+
| updates | Object | Yes | Fields to update (name, slug) |
|
|
1239
|
+
|
|
1240
|
+
**Returns:** `Promise<{organization: Object}>`
|
|
1241
|
+
|
|
1242
|
+
### claw.getOrgKeys(orgId)
|
|
1243
|
+
List API keys for an organization.
|
|
1244
|
+
|
|
1245
|
+
**Parameters:**
|
|
1246
|
+
| Parameter | Type | Required | Description |
|
|
1247
|
+
|-----------|------|----------|-------------|
|
|
1248
|
+
| orgId | string | Yes | Organization ID |
|
|
1249
|
+
|
|
1250
|
+
**Returns:** `Promise<{keys: Object[]}>`
|
|
1251
|
+
|
|
1252
|
+
---
|
|
1253
|
+
|
|
1254
|
+
## Activity Logs
|
|
1255
|
+
|
|
1256
|
+
### claw.getActivityLogs(filters?)
|
|
1257
|
+
Get activity/audit logs for the organization.
|
|
1258
|
+
|
|
1259
|
+
**Parameters:**
|
|
1260
|
+
| Parameter | Type | Required | Description |
|
|
1261
|
+
|-----------|------|----------|-------------|
|
|
1262
|
+
| action | string | No | Filter by action type |
|
|
1263
|
+
| actor_id | string | No | Filter by actor |
|
|
1264
|
+
| resource_type | string | No | Filter by resource type |
|
|
1265
|
+
| before | string | No | Before timestamp (ISO string) |
|
|
1266
|
+
| after | string | No | After timestamp (ISO string) |
|
|
1267
|
+
| limit | number | No | Max results (default: 50, max: 200) |
|
|
1268
|
+
| offset | number | No | Pagination offset |
|
|
1269
|
+
|
|
1270
|
+
**Returns:** `Promise<{logs: Object[], stats: Object, pagination: Object}>`
|
|
1271
|
+
|
|
1272
|
+
---
|
|
1273
|
+
|
|
1274
|
+
## Webhooks
|
|
1275
|
+
|
|
1276
|
+
Subscribe to DashClaw events and receive real-time notifications.
|
|
1277
|
+
|
|
1278
|
+
### claw.getWebhooks()
|
|
1279
|
+
List all webhooks for this organization.
|
|
1280
|
+
|
|
1281
|
+
**Returns:** `Promise<{webhooks: Object[]}>`
|
|
1282
|
+
|
|
1283
|
+
### claw.createWebhook(webhook)
|
|
1284
|
+
Create a new webhook subscription.
|
|
1285
|
+
|
|
1286
|
+
**Parameters:**
|
|
1287
|
+
| Parameter | Type | Required | Description |
|
|
1288
|
+
|-----------|------|----------|-------------|
|
|
1289
|
+
| url | string | Yes | Webhook endpoint URL |
|
|
1290
|
+
| events | string[] | No | Event types to subscribe to |
|
|
1291
|
+
|
|
1292
|
+
**Returns:** `Promise<{webhook: Object}>`
|
|
1293
|
+
|
|
1294
|
+
### claw.deleteWebhook(webhookId)
|
|
1295
|
+
Delete a webhook.
|
|
1296
|
+
|
|
1297
|
+
**Parameters:**
|
|
1298
|
+
| Parameter | Type | Required | Description |
|
|
1299
|
+
|-----------|------|----------|-------------|
|
|
1300
|
+
| webhookId | string | Yes | Webhook ID |
|
|
1301
|
+
|
|
1302
|
+
**Returns:** `Promise<{deleted: boolean}>`
|
|
1303
|
+
|
|
1304
|
+
### claw.testWebhook(webhookId)
|
|
1305
|
+
Send a test event to a webhook to verify connectivity.
|
|
1306
|
+
|
|
1307
|
+
**Parameters:**
|
|
1308
|
+
| Parameter | Type | Required | Description |
|
|
1309
|
+
|-----------|------|----------|-------------|
|
|
1310
|
+
| webhookId | string | Yes | Webhook ID |
|
|
1311
|
+
|
|
1312
|
+
**Returns:** `Promise<{delivery: Object}>`
|
|
1313
|
+
|
|
1314
|
+
### claw.getWebhookDeliveries(webhookId)
|
|
1315
|
+
Get delivery history for a webhook.
|
|
1316
|
+
|
|
1317
|
+
**Parameters:**
|
|
1318
|
+
| Parameter | Type | Required | Description |
|
|
1319
|
+
|-----------|------|----------|-------------|
|
|
1320
|
+
| webhookId | string | Yes | Webhook ID |
|
|
1321
|
+
|
|
1322
|
+
**Returns:** `Promise<{deliveries: Object[]}>`
|
|
1323
|
+
|
|
726
1324
|
---
|
|
727
1325
|
|
|
728
1326
|
## Bulk Sync
|
|
@@ -734,6 +1332,274 @@ Push multiple data categories in a single request. Accepts connections, memory,
|
|
|
734
1332
|
|
|
735
1333
|
---
|
|
736
1334
|
|
|
1335
|
+
## Policy Testing
|
|
1336
|
+
|
|
1337
|
+
Run guardrails tests, generate compliance proof reports, and import policy packs.
|
|
1338
|
+
|
|
1339
|
+
### claw.testPolicies()
|
|
1340
|
+
Run guardrails tests against all active policies. Returns pass/fail results per policy.
|
|
1341
|
+
|
|
1342
|
+
**Returns:** `Promise<{ results: Object[], total: number, passed: number, failed: number }>`
|
|
1343
|
+
|
|
1344
|
+
**Example:**
|
|
1345
|
+
```javascript
|
|
1346
|
+
const report = await claw.testPolicies();
|
|
1347
|
+
console.log(`${report.passed}/${report.total} policies passed`);
|
|
1348
|
+
for (const r of report.results.filter(r => !r.passed)) {
|
|
1349
|
+
console.log(`FAIL: ${r.policy} — ${r.reason}`);
|
|
1350
|
+
}
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
### claw.getProofReport(options?)
|
|
1354
|
+
Generate a compliance proof report summarizing guard decisions, policy evaluations, and audit evidence.
|
|
1355
|
+
|
|
1356
|
+
**Parameters:**
|
|
1357
|
+
| Parameter | Type | Required | Description |
|
|
1358
|
+
|-----------|------|----------|-------------|
|
|
1359
|
+
| format | string | No | Output format: "json" (default) or "md" |
|
|
1360
|
+
|
|
1361
|
+
**Returns:** `Promise<{ report: Object|string }>`
|
|
1362
|
+
|
|
1363
|
+
### claw.importPolicies({ pack?, yaml? })
|
|
1364
|
+
Import a policy pack or raw YAML. Admin only. Replaces or merges into active policies.
|
|
1365
|
+
|
|
1366
|
+
**Parameters:**
|
|
1367
|
+
| Parameter | Type | Required | Description |
|
|
1368
|
+
|-----------|------|----------|-------------|
|
|
1369
|
+
| pack | string | No | Named policy pack: enterprise-strict, smb-safe, startup-growth, development |
|
|
1370
|
+
| yaml | string | No | Raw YAML policy definition |
|
|
1371
|
+
|
|
1372
|
+
**Returns:** `Promise<{ imported: number, policies: Object[] }>`
|
|
1373
|
+
|
|
1374
|
+
---
|
|
1375
|
+
|
|
1376
|
+
## Compliance Engine
|
|
1377
|
+
|
|
1378
|
+
Map policies to regulatory frameworks, run gap analysis, and generate compliance reports.
|
|
1379
|
+
|
|
1380
|
+
### claw.mapCompliance(framework)
|
|
1381
|
+
Map active policies to framework controls. Returns a control-by-control coverage matrix.
|
|
1382
|
+
|
|
1383
|
+
**Parameters:**
|
|
1384
|
+
| Parameter | Type | Required | Description |
|
|
1385
|
+
|-----------|------|----------|-------------|
|
|
1386
|
+
| framework | string | Yes | Target framework: soc2, iso27001, gdpr, nist-ai-rmf, imda-agentic |
|
|
1387
|
+
|
|
1388
|
+
**Returns:** `Promise<{ framework: string, controls: Object[], coverage_pct: number }>`
|
|
1389
|
+
|
|
1390
|
+
**Example:**
|
|
1391
|
+
```javascript
|
|
1392
|
+
const { controls, coverage_pct } = await claw.mapCompliance('soc2');
|
|
1393
|
+
console.log(`SOC 2 coverage: ${coverage_pct}%`);
|
|
1394
|
+
for (const ctrl of controls.filter(c => !c.covered)) {
|
|
1395
|
+
console.log(`Gap: ${ctrl.id} — ${ctrl.name}`);
|
|
1396
|
+
}
|
|
1397
|
+
```
|
|
1398
|
+
|
|
1399
|
+
### claw.analyzeGaps(framework)
|
|
1400
|
+
Run gap analysis with remediation plan. Identifies missing controls and suggests policy changes.
|
|
1401
|
+
|
|
1402
|
+
**Parameters:**
|
|
1403
|
+
| Parameter | Type | Required | Description |
|
|
1404
|
+
|-----------|------|----------|-------------|
|
|
1405
|
+
| framework | string | Yes | Target framework: soc2, iso27001, gdpr, nist-ai-rmf, imda-agentic |
|
|
1406
|
+
|
|
1407
|
+
**Returns:** `Promise<{ framework: string, gaps: Object[], remediation_plan: Object[] }>`
|
|
1408
|
+
|
|
1409
|
+
### claw.getComplianceReport(framework, options?)
|
|
1410
|
+
Generate a full compliance report and save a point-in-time snapshot.
|
|
1411
|
+
|
|
1412
|
+
**Parameters:**
|
|
1413
|
+
| Parameter | Type | Required | Description |
|
|
1414
|
+
|-----------|------|----------|-------------|
|
|
1415
|
+
| framework | string | Yes | Target framework |
|
|
1416
|
+
| options.format | string | No | Output format: "json" (default) or "md" |
|
|
1417
|
+
|
|
1418
|
+
**Returns:** `Promise<{ report: Object|string, snapshot_id: string }>`
|
|
1419
|
+
|
|
1420
|
+
### claw.listFrameworks()
|
|
1421
|
+
List all available compliance frameworks with metadata.
|
|
1422
|
+
|
|
1423
|
+
**Returns:** `Promise<{ frameworks: Object[] }>`
|
|
1424
|
+
|
|
1425
|
+
### claw.getComplianceEvidence(options?)
|
|
1426
|
+
Get live guard decision evidence for compliance audits. Returns timestamped decision records.
|
|
1427
|
+
|
|
1428
|
+
**Parameters:**
|
|
1429
|
+
| Parameter | Type | Required | Description |
|
|
1430
|
+
|-----------|------|----------|-------------|
|
|
1431
|
+
| options.window | string | No | Time window: "7d" (default), "30d", "90d" |
|
|
1432
|
+
|
|
1433
|
+
**Returns:** `Promise<{ evidence: Object[], window: string, total: number }>`
|
|
1434
|
+
|
|
1435
|
+
---
|
|
1436
|
+
|
|
1437
|
+
## Task Routing
|
|
1438
|
+
|
|
1439
|
+
Route tasks to agents based on capabilities, availability, and workload. Manage the agent pool and monitor routing health.
|
|
1440
|
+
|
|
1441
|
+
### claw.listRoutingAgents(filters?)
|
|
1442
|
+
List registered routing agents with optional status filter.
|
|
1443
|
+
|
|
1444
|
+
**Parameters:**
|
|
1445
|
+
| Parameter | Type | Required | Description |
|
|
1446
|
+
|-----------|------|----------|-------------|
|
|
1447
|
+
| filters.status | string | No | Filter by status: available, busy, offline |
|
|
1448
|
+
|
|
1449
|
+
**Returns:** `Promise<{ agents: Object[], total: number }>`
|
|
1450
|
+
|
|
1451
|
+
### claw.registerRoutingAgent(agent)
|
|
1452
|
+
Register a new agent in the routing pool.
|
|
1453
|
+
|
|
1454
|
+
**Parameters:**
|
|
1455
|
+
| Parameter | Type | Required | Description |
|
|
1456
|
+
|-----------|------|----------|-------------|
|
|
1457
|
+
| name | string | Yes | Agent display name |
|
|
1458
|
+
| capabilities | string[] | No | List of skills/capabilities |
|
|
1459
|
+
| maxConcurrent | number | No | Max concurrent tasks (default: 1) |
|
|
1460
|
+
| endpoint | string | No | Agent callback endpoint URL |
|
|
1461
|
+
|
|
1462
|
+
**Returns:** `Promise<{ agent: Object, agent_id: string }>`
|
|
1463
|
+
|
|
1464
|
+
### claw.getRoutingAgent(agentId)
|
|
1465
|
+
Get a single routing agent with current metrics.
|
|
1466
|
+
|
|
1467
|
+
**Parameters:**
|
|
1468
|
+
| Parameter | Type | Required | Description |
|
|
1469
|
+
|-----------|------|----------|-------------|
|
|
1470
|
+
| agentId | string | Yes | The routing agent ID |
|
|
1471
|
+
|
|
1472
|
+
**Returns:** `Promise<{ agent: Object, metrics: Object }>`
|
|
1473
|
+
|
|
1474
|
+
### claw.updateRoutingAgentStatus(agentId, status)
|
|
1475
|
+
Update a routing agent's availability status.
|
|
1476
|
+
|
|
1477
|
+
**Parameters:**
|
|
1478
|
+
| Parameter | Type | Required | Description |
|
|
1479
|
+
|-----------|------|----------|-------------|
|
|
1480
|
+
| agentId | string | Yes | The routing agent ID |
|
|
1481
|
+
| status | string | Yes | New status: available, busy, offline |
|
|
1482
|
+
|
|
1483
|
+
**Returns:** `Promise<{ agent: Object }>`
|
|
1484
|
+
|
|
1485
|
+
### claw.deleteRoutingAgent(agentId)
|
|
1486
|
+
Remove an agent from the routing pool.
|
|
1487
|
+
|
|
1488
|
+
**Parameters:**
|
|
1489
|
+
| Parameter | Type | Required | Description |
|
|
1490
|
+
|-----------|------|----------|-------------|
|
|
1491
|
+
| agentId | string | Yes | The routing agent ID |
|
|
1492
|
+
|
|
1493
|
+
**Returns:** `Promise<{ deleted: boolean, id: string }>`
|
|
1494
|
+
|
|
1495
|
+
### claw.listRoutingTasks(filters?)
|
|
1496
|
+
List routing tasks with optional filters.
|
|
1497
|
+
|
|
1498
|
+
**Parameters:**
|
|
1499
|
+
| Parameter | Type | Required | Description |
|
|
1500
|
+
|-----------|------|----------|-------------|
|
|
1501
|
+
| filters.status | string | No | Filter by status: pending, assigned, completed, failed |
|
|
1502
|
+
| filters.agent_id | string | No | Filter by assigned agent |
|
|
1503
|
+
| filters.limit | number | No | Max results (default: 50) |
|
|
1504
|
+
| filters.offset | number | No | Pagination offset |
|
|
1505
|
+
|
|
1506
|
+
**Returns:** `Promise<{ tasks: Object[], total: number }>`
|
|
1507
|
+
|
|
1508
|
+
### claw.submitRoutingTask(task)
|
|
1509
|
+
Submit a task for automatic routing to the best available agent.
|
|
1510
|
+
|
|
1511
|
+
**Parameters:**
|
|
1512
|
+
| Parameter | Type | Required | Description |
|
|
1513
|
+
|-----------|------|----------|-------------|
|
|
1514
|
+
| title | string | Yes | Task title |
|
|
1515
|
+
| description | string | No | Detailed description |
|
|
1516
|
+
| requiredSkills | string[] | No | Skills needed to handle this task |
|
|
1517
|
+
| urgency | string | No | low, medium, high, critical (default: medium) |
|
|
1518
|
+
| timeoutSeconds | number | No | Task timeout in seconds |
|
|
1519
|
+
| maxRetries | number | No | Max retry attempts on failure |
|
|
1520
|
+
| callbackUrl | string | No | URL to notify on completion |
|
|
1521
|
+
|
|
1522
|
+
**Returns:** `Promise<{ task: Object, task_id: string, assigned_agent: Object|null }>`
|
|
1523
|
+
|
|
1524
|
+
**Example:**
|
|
1525
|
+
```javascript
|
|
1526
|
+
const { task_id, assigned_agent } = await claw.submitRoutingTask({
|
|
1527
|
+
title: 'Analyze quarterly metrics',
|
|
1528
|
+
description: 'Pull Q4 data and generate summary report',
|
|
1529
|
+
requiredSkills: ['data-analysis', 'reporting'],
|
|
1530
|
+
urgency: 'high',
|
|
1531
|
+
timeoutSeconds: 600,
|
|
1532
|
+
callbackUrl: 'https://hooks.example.com/task-done',
|
|
1533
|
+
});
|
|
1534
|
+
console.log(`Task ${task_id} assigned to ${assigned_agent?.name ?? 'queue'}`);
|
|
1535
|
+
```
|
|
1536
|
+
|
|
1537
|
+
### claw.completeRoutingTask(taskId, result?)
|
|
1538
|
+
Mark a routing task as completed with optional result payload.
|
|
1539
|
+
|
|
1540
|
+
**Parameters:**
|
|
1541
|
+
| Parameter | Type | Required | Description |
|
|
1542
|
+
|-----------|------|----------|-------------|
|
|
1543
|
+
| taskId | string | Yes | The task ID |
|
|
1544
|
+
| result | Object | No | Task result data |
|
|
1545
|
+
|
|
1546
|
+
**Returns:** `Promise<{ task: Object }>`
|
|
1547
|
+
|
|
1548
|
+
### claw.getRoutingStats()
|
|
1549
|
+
Get aggregate routing statistics (throughput, latency, agent utilization).
|
|
1550
|
+
|
|
1551
|
+
**Returns:** `Promise<{ stats: Object }>`
|
|
1552
|
+
|
|
1553
|
+
### claw.getRoutingHealth()
|
|
1554
|
+
Get routing system health status and diagnostics.
|
|
1555
|
+
|
|
1556
|
+
**Returns:** `Promise<{ healthy: boolean, agents: Object, tasks: Object, latency: Object }>`
|
|
1557
|
+
|
|
1558
|
+
---
|
|
1559
|
+
|
|
1560
|
+
## Agent Schedules
|
|
1561
|
+
|
|
1562
|
+
Define recurring tasks and cron-based schedules for agents.
|
|
1563
|
+
|
|
1564
|
+
### claw.listAgentSchedules(filters?)
|
|
1565
|
+
List agent schedules, optionally filtered by agent.
|
|
1566
|
+
|
|
1567
|
+
```javascript
|
|
1568
|
+
const { schedules } = await claw.listAgentSchedules({ agent_id: 'forge' });
|
|
1569
|
+
```
|
|
1570
|
+
|
|
1571
|
+
**Parameters:**
|
|
1572
|
+
| Parameter | Type | Required | Description |
|
|
1573
|
+
|-----------|------|----------|-------------|
|
|
1574
|
+
| filters.agent_id | string | No | Filter by agent ID |
|
|
1575
|
+
|
|
1576
|
+
**Returns:** `Promise<{ schedules: Object[] }>`
|
|
1577
|
+
|
|
1578
|
+
### claw.createAgentSchedule(schedule)
|
|
1579
|
+
Create a new agent schedule entry.
|
|
1580
|
+
|
|
1581
|
+
```javascript
|
|
1582
|
+
const { schedule } = await claw.createAgentSchedule({
|
|
1583
|
+
agent_id: 'forge',
|
|
1584
|
+
name: 'Build projects',
|
|
1585
|
+
cron_expression: '0 */6 * * *',
|
|
1586
|
+
description: 'Check for pending builds every 6 hours'
|
|
1587
|
+
});
|
|
1588
|
+
```
|
|
1589
|
+
|
|
1590
|
+
**Parameters:**
|
|
1591
|
+
| Parameter | Type | Required | Description |
|
|
1592
|
+
|-----------|------|----------|-------------|
|
|
1593
|
+
| schedule.agent_id | string | Yes | Agent this schedule belongs to |
|
|
1594
|
+
| schedule.name | string | Yes | Schedule name |
|
|
1595
|
+
| schedule.cron_expression | string | Yes | Cron expression (e.g. `0 */6 * * *`) |
|
|
1596
|
+
| schedule.description | string | No | Human-readable description |
|
|
1597
|
+
| schedule.enabled | boolean | No | Whether schedule is active (default: true) |
|
|
1598
|
+
|
|
1599
|
+
**Returns:** `Promise<{ schedule: Object }>`
|
|
1600
|
+
|
|
1601
|
+
---
|
|
1602
|
+
|
|
737
1603
|
## Error Handling
|
|
738
1604
|
|
|
739
1605
|
All SDK methods throw on non-2xx responses. Errors include `status` (HTTP code) and `details` (when available).
|