dashclaw 1.7.1 → 1.7.2
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 +94 -0
- package/dashclaw.js +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -608,6 +608,100 @@ Add an entry to an existing thread.
|
|
|
608
608
|
|
|
609
609
|
---
|
|
610
610
|
|
|
611
|
+
## Automation Snippets
|
|
612
|
+
|
|
613
|
+
Save, search, and reuse code snippets across agent sessions.
|
|
614
|
+
|
|
615
|
+
### claw.saveSnippet(snippet)
|
|
616
|
+
Save or update a reusable code snippet. Upserts on name.
|
|
617
|
+
|
|
618
|
+
**Parameters:**
|
|
619
|
+
| Parameter | Type | Required | Description |
|
|
620
|
+
|-----------|------|----------|-------------|
|
|
621
|
+
| name | string | Yes | Snippet name (unique per org) |
|
|
622
|
+
| code | string | Yes | The snippet code |
|
|
623
|
+
| description | string | No | What this snippet does |
|
|
624
|
+
| language | string | No | Programming language |
|
|
625
|
+
| tags | string[] | No | Tags for categorization |
|
|
626
|
+
|
|
627
|
+
**Returns:** `Promise<{snippet: Object, snippet_id: string}>`
|
|
628
|
+
|
|
629
|
+
**Example:**
|
|
630
|
+
```javascript
|
|
631
|
+
await claw.saveSnippet({
|
|
632
|
+
name: 'fetch-with-retry',
|
|
633
|
+
code: 'async function fetchRetry(url, n = 3) { ... }',
|
|
634
|
+
language: 'javascript',
|
|
635
|
+
tags: ['fetch', 'retry'],
|
|
636
|
+
});
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
### claw.getSnippet(snippetId)
|
|
640
|
+
Fetch a single snippet by ID.
|
|
641
|
+
|
|
642
|
+
**Parameters:**
|
|
643
|
+
| Parameter | Type | Required | Description |
|
|
644
|
+
|-----------|------|----------|-------------|
|
|
645
|
+
| snippetId | string | Yes | The snippet ID |
|
|
646
|
+
|
|
647
|
+
**Returns:** `Promise<{snippet: Object}>`
|
|
648
|
+
|
|
649
|
+
**Example:**
|
|
650
|
+
```javascript
|
|
651
|
+
const { snippet } = await claw.getSnippet('sn_abc123');
|
|
652
|
+
console.log(snippet.name, snippet.language);
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
### claw.getSnippets(filters?)
|
|
656
|
+
Search and list snippets.
|
|
657
|
+
|
|
658
|
+
**Parameters:**
|
|
659
|
+
| Parameter | Type | Required | Description |
|
|
660
|
+
|-----------|------|----------|-------------|
|
|
661
|
+
| search | string | No | Search name/description |
|
|
662
|
+
| tag | string | No | Filter by tag |
|
|
663
|
+
| language | string | No | Filter by language |
|
|
664
|
+
| limit | number | No | Max results |
|
|
665
|
+
|
|
666
|
+
**Returns:** `Promise<{snippets: Object[], total: number}>`
|
|
667
|
+
|
|
668
|
+
**Example:**
|
|
669
|
+
```javascript
|
|
670
|
+
const { snippets } = await claw.getSnippets({ language: 'javascript' });
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
### claw.useSnippet(snippetId)
|
|
674
|
+
Mark a snippet as used (increments use_count).
|
|
675
|
+
|
|
676
|
+
**Parameters:**
|
|
677
|
+
| Parameter | Type | Required | Description |
|
|
678
|
+
|-----------|------|----------|-------------|
|
|
679
|
+
| snippetId | string | Yes | Snippet ID |
|
|
680
|
+
|
|
681
|
+
**Returns:** `Promise<{snippet: Object}>`
|
|
682
|
+
|
|
683
|
+
**Example:**
|
|
684
|
+
```javascript
|
|
685
|
+
await claw.useSnippet('sn_abc123');
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
### claw.deleteSnippet(snippetId)
|
|
689
|
+
Delete a snippet.
|
|
690
|
+
|
|
691
|
+
**Parameters:**
|
|
692
|
+
| Parameter | Type | Required | Description |
|
|
693
|
+
|-----------|------|----------|-------------|
|
|
694
|
+
| snippetId | string | Yes | Snippet ID |
|
|
695
|
+
|
|
696
|
+
**Returns:** `Promise<{deleted: boolean, id: string}>`
|
|
697
|
+
|
|
698
|
+
**Example:**
|
|
699
|
+
```javascript
|
|
700
|
+
await claw.deleteSnippet('sn_abc123');
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
---
|
|
704
|
+
|
|
611
705
|
## Agent Messaging
|
|
612
706
|
|
|
613
707
|
### claw.sendMessage(params)
|
package/dashclaw.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - Dashboard Data (9)
|
|
11
11
|
* - Session Handoffs (3)
|
|
12
12
|
* - Context Manager (7)
|
|
13
|
-
* - Automation Snippets (
|
|
13
|
+
* - Automation Snippets (5)
|
|
14
14
|
* - User Preferences (6)
|
|
15
15
|
* - Daily Digest (1)
|
|
16
16
|
* - Security Scanning (2)
|
|
@@ -1138,7 +1138,7 @@ class DashClaw {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
|
|
1140
1140
|
// ══════════════════════════════════════════════
|
|
1141
|
-
// Category 7: Automation Snippets (
|
|
1141
|
+
// Category 7: Automation Snippets (5 methods)
|
|
1142
1142
|
// ══════════════════════════════════════════════
|
|
1143
1143
|
|
|
1144
1144
|
/**
|
|
@@ -1176,6 +1176,15 @@ class DashClaw {
|
|
|
1176
1176
|
return this._request(`/api/snippets?${params}`, 'GET');
|
|
1177
1177
|
}
|
|
1178
1178
|
|
|
1179
|
+
/**
|
|
1180
|
+
* Fetch a single snippet by ID.
|
|
1181
|
+
* @param {string} snippetId - The snippet ID
|
|
1182
|
+
* @returns {Promise<{snippet: Object}>}
|
|
1183
|
+
*/
|
|
1184
|
+
async getSnippet(snippetId) {
|
|
1185
|
+
return this._request(`/api/snippets/${snippetId}`, 'GET');
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1179
1188
|
/**
|
|
1180
1189
|
* Mark a snippet as used (increments use_count).
|
|
1181
1190
|
* @param {string} snippetId - The snippet ID
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dashclaw",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Full-featured agent toolkit for the DashClaw platform. 60+ methods for action recording, context management, session handoffs, security scanning, behavior guard, bulk sync, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|