dashclaw 1.9.4 → 2.0.0
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 +264 -2
- package/dashclaw.js +474 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
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
|
-
DashClaw treats every agent action as a governed decision. The SDK provides decision recording, policy enforcement,
|
|
5
|
+
DashClaw treats every agent action as a governed decision. The SDK provides decision recording, policy enforcement, evaluation, and compliance mapping. It proves what your agents decided and why.
|
|
6
6
|
|
|
7
|
-
Install, configure, and govern your AI agents with
|
|
7
|
+
Install, configure, and govern your AI agents with 178+ methods across 30+ categories including action recording, behavior guard, evaluation framework, scoring profiles, learning analytics, prompt management, feedback loops, behavioral drift, compliance exports, and more. Native adapters for **OpenClaw**, **CrewAI**, **AutoGen**, and **LangChain**.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -314,6 +314,268 @@ Get root-cause trace for an action, including its assumptions, open loops, paren
|
|
|
314
314
|
|
|
315
315
|
---
|
|
316
316
|
|
|
317
|
+
## Evaluation Framework
|
|
318
|
+
|
|
319
|
+
Track output quality automatically with 5 built-in scorer types. No LLM required for most scorers.
|
|
320
|
+
|
|
321
|
+
### claw.createScorer({ name, scorerType, config, description })
|
|
322
|
+
Create a new evaluation scorer.
|
|
323
|
+
|
|
324
|
+
**Parameters:**
|
|
325
|
+
| Parameter | Type | Required | Description |
|
|
326
|
+
|-----------|------|----------|-------------|
|
|
327
|
+
| name | string | Yes | Scorer name |
|
|
328
|
+
| scorerType | string | Yes | regex, keywords, numeric_range, custom_function, or llm_judge |
|
|
329
|
+
| config | Object | Yes | Configuration for the scorer |
|
|
330
|
+
| description | string | No | Purpose of this scorer |
|
|
331
|
+
|
|
332
|
+
**Returns:** `Promise<Object>`
|
|
333
|
+
|
|
334
|
+
**Example:**
|
|
335
|
+
```javascript
|
|
336
|
+
await claw.createScorer({
|
|
337
|
+
name: 'JSON Validator',
|
|
338
|
+
scorerType: 'regex',
|
|
339
|
+
config: { pattern: '^\\{.*\\}$' },
|
|
340
|
+
});
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### claw.getScorers()
|
|
344
|
+
List all available scorers.
|
|
345
|
+
|
|
346
|
+
**Returns:** `Promise<{ scorers: Object[], llm_available: boolean }>`
|
|
347
|
+
|
|
348
|
+
### claw.getEvalRuns(filters?)
|
|
349
|
+
List evaluation runs with status and result summaries.
|
|
350
|
+
|
|
351
|
+
**Parameters:**
|
|
352
|
+
| Parameter | Type | Required | Description |
|
|
353
|
+
|-----------|------|----------|-------------|
|
|
354
|
+
| status | string | No | running, completed, failed |
|
|
355
|
+
| limit | number | No | Max results |
|
|
356
|
+
|
|
357
|
+
**Returns:** `Promise<{ runs: Object[] }>`
|
|
358
|
+
|
|
359
|
+
### claw.getEvalStats(filters?)
|
|
360
|
+
Get aggregate evaluation statistics across scorers and agents.
|
|
361
|
+
|
|
362
|
+
**Parameters:**
|
|
363
|
+
| Parameter | Type | Required | Description |
|
|
364
|
+
|-----------|------|----------|-------------|
|
|
365
|
+
| agent_id | string | No | Filter by agent |
|
|
366
|
+
| scorer_name | string | No | Filter by scorer |
|
|
367
|
+
| days | number | No | Lookback period |
|
|
368
|
+
|
|
369
|
+
**Returns:** `Promise<Object>`
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Prompt Management
|
|
374
|
+
|
|
375
|
+
Version-controlled prompt templates with mustache variable rendering.
|
|
376
|
+
|
|
377
|
+
### claw.createPromptTemplate({ name, content, category })
|
|
378
|
+
Create a new prompt template.
|
|
379
|
+
|
|
380
|
+
**Parameters:**
|
|
381
|
+
| Parameter | Type | Required | Description |
|
|
382
|
+
|-----------|------|----------|-------------|
|
|
383
|
+
| name | string | Yes | Template name |
|
|
384
|
+
| content | string | Yes | Template content with {{variables}} |
|
|
385
|
+
| category | string | No | Optional grouping category |
|
|
386
|
+
|
|
387
|
+
**Returns:** `Promise<Object>`
|
|
388
|
+
|
|
389
|
+
### claw.getPromptTemplate(templateId)
|
|
390
|
+
Get a template by ID, including its current active version.
|
|
391
|
+
|
|
392
|
+
**Returns:** `Promise<Object>`
|
|
393
|
+
|
|
394
|
+
### claw.renderPrompt({ template_id, variables, action_id })
|
|
395
|
+
Render a template with variables on the server. Optionally link to an action for usage tracking.
|
|
396
|
+
|
|
397
|
+
**Parameters:**
|
|
398
|
+
| Parameter | Type | Required | Description |
|
|
399
|
+
|-----------|------|----------|-------------|
|
|
400
|
+
| template_id | string | Yes | Template ID |
|
|
401
|
+
| variables | Object | Yes | Mustache variables |
|
|
402
|
+
| action_id | string | No | Link to an action |
|
|
403
|
+
|
|
404
|
+
**Returns:** `Promise<{ rendered: string }>`
|
|
405
|
+
|
|
406
|
+
### claw.listPromptVersions(templateId)
|
|
407
|
+
List all versions of a prompt template.
|
|
408
|
+
|
|
409
|
+
**Returns:** `Promise<Object[]>`
|
|
410
|
+
|
|
411
|
+
### claw.activatePromptVersion(templateId, versionId)
|
|
412
|
+
Set a specific version as the active one for a template.
|
|
413
|
+
|
|
414
|
+
**Returns:** `Promise<Object>`
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## User Feedback
|
|
419
|
+
|
|
420
|
+
Collect and analyze human feedback on agent actions.
|
|
421
|
+
|
|
422
|
+
### claw.submitFeedback({ action_id, agent_id, rating, comment, category, tags })
|
|
423
|
+
Submit feedback for a specific action.
|
|
424
|
+
|
|
425
|
+
**Parameters:**
|
|
426
|
+
| Parameter | Type | Required | Description |
|
|
427
|
+
|-----------|------|----------|-------------|
|
|
428
|
+
| action_id | string | Yes | Action ID |
|
|
429
|
+
| agent_id | string | No | Agent ID |
|
|
430
|
+
| rating | number | Yes | Rating 1-5 |
|
|
431
|
+
| comment | string | No | Optional text feedback |
|
|
432
|
+
| category | string | No | Optional category |
|
|
433
|
+
| tags | string[] | No | Optional tags |
|
|
434
|
+
|
|
435
|
+
**Returns:** `Promise<Object>`
|
|
436
|
+
|
|
437
|
+
### claw.getFeedback(feedbackId)
|
|
438
|
+
Retrieve a single feedback entry.
|
|
439
|
+
|
|
440
|
+
**Returns:** `Promise<Object>`
|
|
441
|
+
|
|
442
|
+
### claw.getFeedbackStats({ agent_id })
|
|
443
|
+
Get feedback statistics, including average rating and sentiment trends.
|
|
444
|
+
|
|
445
|
+
**Returns:** `Promise<Object>`
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## Behavioral Drift
|
|
450
|
+
|
|
451
|
+
Monitor agent behavior deviations from statistical baselines using z-scores.
|
|
452
|
+
|
|
453
|
+
### claw.computeDriftBaselines({ agent_id, lookback_days })
|
|
454
|
+
Establish statistical baselines for an agent's behavior metrics.
|
|
455
|
+
|
|
456
|
+
**Returns:** `Promise<Object>`
|
|
457
|
+
|
|
458
|
+
### claw.detectDrift({ agent_id, window_days })
|
|
459
|
+
Run drift detection against the established baselines.
|
|
460
|
+
|
|
461
|
+
**Returns:** `Promise<Object>`
|
|
462
|
+
|
|
463
|
+
### claw.listDriftAlerts(filters?)
|
|
464
|
+
List behavioral drift alerts with severity and status.
|
|
465
|
+
|
|
466
|
+
**Returns:** `Promise<Object[]>`
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## Compliance Exports
|
|
471
|
+
|
|
472
|
+
Generate evidence packages for SOC 2, NIST AI RMF, EU AI Act, and ISO 42001.
|
|
473
|
+
|
|
474
|
+
### claw.createComplianceExport({ name, frameworks, format, window_days })
|
|
475
|
+
Generate a compliance export bundle.
|
|
476
|
+
|
|
477
|
+
**Returns:** `Promise<Object>`
|
|
478
|
+
|
|
479
|
+
### claw.getComplianceExport(exportId)
|
|
480
|
+
Get the status and details of a compliance export.
|
|
481
|
+
|
|
482
|
+
**Returns:** `Promise<Object>`
|
|
483
|
+
|
|
484
|
+
### claw.listComplianceExports({ limit })
|
|
485
|
+
List recent compliance exports.
|
|
486
|
+
|
|
487
|
+
**Returns:** `Promise<Object[]>`
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## Learning Analytics
|
|
492
|
+
|
|
493
|
+
Track agent improvement velocity, maturity levels, and learning curves per skill.
|
|
494
|
+
|
|
495
|
+
### claw.getLearningVelocity({ agent_id })
|
|
496
|
+
Get agent improvement rate over time.
|
|
497
|
+
|
|
498
|
+
**Returns:** `Promise<Object>`
|
|
499
|
+
|
|
500
|
+
### claw.getMaturityLevels()
|
|
501
|
+
Get the 6-level maturity model distribution for the agent.
|
|
502
|
+
|
|
503
|
+
**Returns:** `Promise<Object>`
|
|
504
|
+
|
|
505
|
+
### claw.getLearningCurves({ agent_id, action_type })
|
|
506
|
+
Get performance improvement curves for a specific skill/action type.
|
|
507
|
+
|
|
508
|
+
**Returns:** `Promise<Object>`
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
## Scoring Profiles
|
|
513
|
+
|
|
514
|
+
User-defined weighted quality scoring with 3 composite methods, 8 data sources, risk templates, and auto-calibration. Zero LLM required.
|
|
515
|
+
|
|
516
|
+
### claw.createScoringProfile({ name, action_type, composite_method, dimensions })
|
|
517
|
+
Create a scoring profile with optional inline dimensions.
|
|
518
|
+
|
|
519
|
+
**Parameters:**
|
|
520
|
+
| Parameter | Type | Required | Description |
|
|
521
|
+
|-----------|------|----------|-------------|
|
|
522
|
+
| name | string | Yes | Profile name |
|
|
523
|
+
| action_type | string | No | Filter to specific action type (null = all) |
|
|
524
|
+
| composite_method | string | No | weighted_average (default), minimum, or geometric_mean |
|
|
525
|
+
| dimensions | Array | No | Inline dimension definitions (name, data_source, weight, scale) |
|
|
526
|
+
|
|
527
|
+
**Returns:** `Promise<Object>`
|
|
528
|
+
|
|
529
|
+
**Example:**
|
|
530
|
+
```javascript
|
|
531
|
+
const profile = await dc.createScoringProfile({
|
|
532
|
+
name: 'deploy-quality',
|
|
533
|
+
action_type: 'deploy',
|
|
534
|
+
composite_method: 'weighted_average',
|
|
535
|
+
dimensions: [
|
|
536
|
+
{ name: 'Speed', data_source: 'duration_ms', weight: 0.3,
|
|
537
|
+
scale: [
|
|
538
|
+
{ label: 'excellent', operator: 'lt', value: 30000, score: 100 },
|
|
539
|
+
{ label: 'good', operator: 'lt', value: 60000, score: 75 },
|
|
540
|
+
{ label: 'poor', operator: 'gte', value: 60000, score: 20 },
|
|
541
|
+
]},
|
|
542
|
+
{ name: 'Reliability', data_source: 'confidence', weight: 0.7,
|
|
543
|
+
scale: [
|
|
544
|
+
{ label: 'excellent', operator: 'gte', value: 0.9, score: 100 },
|
|
545
|
+
{ label: 'poor', operator: 'lt', value: 0.7, score: 25 },
|
|
546
|
+
]},
|
|
547
|
+
],
|
|
548
|
+
});
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### claw.scoreWithProfile(profile_id, action)
|
|
552
|
+
Score a single action against a profile. Returns composite score + per-dimension breakdown.
|
|
553
|
+
|
|
554
|
+
**Parameters:**
|
|
555
|
+
| Parameter | Type | Required | Description |
|
|
556
|
+
|-----------|------|----------|-------------|
|
|
557
|
+
| profile_id | string | Yes | Profile to score against |
|
|
558
|
+
| action | Object | Yes | Action data object |
|
|
559
|
+
|
|
560
|
+
**Returns:** `Promise<Object>`
|
|
561
|
+
|
|
562
|
+
### claw.batchScoreWithProfile(profile_id, actions)
|
|
563
|
+
Score multiple actions at once. Returns per-action results + summary.
|
|
564
|
+
|
|
565
|
+
**Returns:** `Promise<Object>`
|
|
566
|
+
|
|
567
|
+
### claw.createRiskTemplate({ name, base_risk, rules })
|
|
568
|
+
Create a rule-based risk template. Replaces hardcoded agent risk numbers.
|
|
569
|
+
|
|
570
|
+
**Returns:** `Promise<Object>`
|
|
571
|
+
|
|
572
|
+
### claw.autoCalibrate({ action_type, lookback_days })
|
|
573
|
+
Analyze historical action data to suggest scoring thresholds from percentile distribution.
|
|
574
|
+
|
|
575
|
+
**Returns:** `Promise<Object>`
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
317
579
|
## Agent Presence & Health
|
|
318
580
|
|
|
319
581
|
Monitor agent uptime and status in real-time. Use heartbeats to detect when an agent crashes or loses network connectivity.
|
package/dashclaw.js
CHANGED
|
@@ -112,7 +112,27 @@ class DashClaw {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
async _request(
|
|
115
|
+
async _request(pathOrMethod, methodOrPath, body, params) {
|
|
116
|
+
let path, method;
|
|
117
|
+
if (typeof pathOrMethod === 'string' && pathOrMethod.startsWith('/')) {
|
|
118
|
+
path = pathOrMethod;
|
|
119
|
+
method = methodOrPath || 'GET';
|
|
120
|
+
} else {
|
|
121
|
+
method = pathOrMethod;
|
|
122
|
+
path = methodOrPath;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (params) {
|
|
126
|
+
const qs = new URLSearchParams();
|
|
127
|
+
for (const [k, v] of Object.entries(params)) {
|
|
128
|
+
if (v !== undefined && v !== null) qs.append(k, String(v));
|
|
129
|
+
}
|
|
130
|
+
const qsStr = qs.toString();
|
|
131
|
+
if (qsStr) {
|
|
132
|
+
path += (path.includes('?') ? '&' : '?') + qsStr;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
116
136
|
const url = `${this.baseUrl}${path}`;
|
|
117
137
|
const headers = {
|
|
118
138
|
'Content-Type': 'application/json',
|
|
@@ -2277,6 +2297,459 @@ class DashClaw {
|
|
|
2277
2297
|
...state,
|
|
2278
2298
|
});
|
|
2279
2299
|
}
|
|
2300
|
+
|
|
2301
|
+
// ----------------------------------------------
|
|
2302
|
+
// Category: Evaluations
|
|
2303
|
+
// ----------------------------------------------
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* Create an evaluation score for an action.
|
|
2307
|
+
* @param {Object} params
|
|
2308
|
+
* @param {string} params.actionId - Action record ID
|
|
2309
|
+
* @param {string} params.scorerName - Name of the scorer
|
|
2310
|
+
* @param {number} params.score - Score between 0.0 and 1.0
|
|
2311
|
+
* @param {string} [params.label] - Category label (e.g., 'correct', 'incorrect')
|
|
2312
|
+
* @param {string} [params.reasoning] - Explanation of the score
|
|
2313
|
+
* @param {string} [params.evaluatedBy] - 'auto', 'human', or 'llm_judge'
|
|
2314
|
+
* @param {Object} [params.metadata] - Additional metadata
|
|
2315
|
+
* @returns {Promise<Object>}
|
|
2316
|
+
*/
|
|
2317
|
+
async createScore({ actionId, scorerName, score, label, reasoning, evaluatedBy, metadata }) {
|
|
2318
|
+
return this._request('/api/evaluations', 'POST', {
|
|
2319
|
+
action_id: actionId,
|
|
2320
|
+
scorer_name: scorerName,
|
|
2321
|
+
score,
|
|
2322
|
+
label,
|
|
2323
|
+
reasoning,
|
|
2324
|
+
evaluated_by: evaluatedBy,
|
|
2325
|
+
metadata,
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
/**
|
|
2330
|
+
* List evaluation scores with optional filters.
|
|
2331
|
+
* @param {Object} [filters] - { action_id, scorer_name, evaluated_by, min_score, max_score, limit, offset, agent_id }
|
|
2332
|
+
* @returns {Promise<{ scores: Object[], total: number }>}
|
|
2333
|
+
*/
|
|
2334
|
+
async getScores(filters = {}) {
|
|
2335
|
+
const params = new URLSearchParams();
|
|
2336
|
+
for (const [key, value] of Object.entries(filters)) {
|
|
2337
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
2338
|
+
params.set(key, String(value));
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
return this._request(`/api/evaluations?${params}`, 'GET');
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
/**
|
|
2345
|
+
* Create a reusable scorer definition.
|
|
2346
|
+
* @param {Object} params
|
|
2347
|
+
* @param {string} params.name - Scorer name (unique per org)
|
|
2348
|
+
* @param {string} params.scorerType - 'regex', 'contains', 'numeric_range', 'custom_function', or 'llm_judge'
|
|
2349
|
+
* @param {Object} params.config - Scorer configuration
|
|
2350
|
+
* @param {string} [params.description] - Description
|
|
2351
|
+
* @returns {Promise<Object>}
|
|
2352
|
+
*/
|
|
2353
|
+
async createScorer({ name, scorerType, config, description }) {
|
|
2354
|
+
return this._request('/api/evaluations/scorers', 'POST', {
|
|
2355
|
+
name,
|
|
2356
|
+
scorer_type: scorerType,
|
|
2357
|
+
config,
|
|
2358
|
+
description,
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
/**
|
|
2363
|
+
* List all scorers for this org.
|
|
2364
|
+
* @returns {Promise<{ scorers: Object[], llm_available: boolean }>}
|
|
2365
|
+
*/
|
|
2366
|
+
async getScorers() {
|
|
2367
|
+
return this._request('/api/evaluations/scorers', 'GET');
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
/**
|
|
2371
|
+
* Update a scorer.
|
|
2372
|
+
* @param {string} scorerId
|
|
2373
|
+
* @param {Object} updates - { name?, description?, config? }
|
|
2374
|
+
* @returns {Promise<Object>}
|
|
2375
|
+
*/
|
|
2376
|
+
async updateScorer(scorerId, updates) {
|
|
2377
|
+
return this._request(`/api/evaluations/scorers/${scorerId}`, 'PATCH', updates);
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
/**
|
|
2381
|
+
* Delete a scorer.
|
|
2382
|
+
* @param {string} scorerId
|
|
2383
|
+
* @returns {Promise<Object>}
|
|
2384
|
+
*/
|
|
2385
|
+
async deleteScorer(scorerId) {
|
|
2386
|
+
return this._request(`/api/evaluations/scorers/${scorerId}`, 'DELETE');
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
/**
|
|
2390
|
+
* Create and start an evaluation run.
|
|
2391
|
+
* @param {Object} params
|
|
2392
|
+
* @param {string} params.name - Run name
|
|
2393
|
+
* @param {string} params.scorerId - Scorer to use
|
|
2394
|
+
* @param {Object} [params.actionFilters] - Filters for which actions to evaluate
|
|
2395
|
+
* @returns {Promise<Object>}
|
|
2396
|
+
*/
|
|
2397
|
+
async createEvalRun({ name, scorerId, actionFilters }) {
|
|
2398
|
+
return this._request('/api/evaluations/runs', 'POST', {
|
|
2399
|
+
name,
|
|
2400
|
+
scorer_id: scorerId,
|
|
2401
|
+
action_filters: actionFilters,
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* List evaluation runs.
|
|
2407
|
+
* @param {Object} [filters] - { status, limit, offset }
|
|
2408
|
+
* @returns {Promise<{ runs: Object[] }>}
|
|
2409
|
+
*/
|
|
2410
|
+
async getEvalRuns(filters = {}) {
|
|
2411
|
+
const params = new URLSearchParams();
|
|
2412
|
+
for (const [key, value] of Object.entries(filters)) {
|
|
2413
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
2414
|
+
params.set(key, String(value));
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
return this._request(`/api/evaluations/runs?${params}`, 'GET');
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
/**
|
|
2421
|
+
* Get details of an evaluation run.
|
|
2422
|
+
* @param {string} runId
|
|
2423
|
+
* @returns {Promise<{ run: Object, distribution: Object[] }>}
|
|
2424
|
+
*/
|
|
2425
|
+
async getEvalRun(runId) {
|
|
2426
|
+
return this._request(`/api/evaluations/runs/${runId}`, 'GET');
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
/**
|
|
2430
|
+
* Get aggregate evaluation statistics.
|
|
2431
|
+
* @param {Object} [filters] - { agent_id, scorer_name, days }
|
|
2432
|
+
* @returns {Promise<Object>}
|
|
2433
|
+
*/
|
|
2434
|
+
async getEvalStats(filters = {}) {
|
|
2435
|
+
const params = new URLSearchParams();
|
|
2436
|
+
for (const [key, value] of Object.entries(filters)) {
|
|
2437
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
2438
|
+
params.set(key, String(value));
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
return this._request(`/api/evaluations/stats?${params}`, 'GET');
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
// -----------------------------------------------
|
|
2445
|
+
// Prompt Management
|
|
2446
|
+
// -----------------------------------------------
|
|
2447
|
+
|
|
2448
|
+
async listPromptTemplates({ category } = {}) {
|
|
2449
|
+
const params = category ? `?category=${encodeURIComponent(category)}` : '';
|
|
2450
|
+
return this._request(`/api/prompts/templates${params}`, 'GET');
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
async createPromptTemplate({ name, description, category }) {
|
|
2454
|
+
return this._request('/api/prompts/templates', 'POST', { name, description, category });
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
async getPromptTemplate(templateId) {
|
|
2458
|
+
return this._request(`/api/prompts/templates/${templateId}`, 'GET');
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
async updatePromptTemplate(templateId, fields) {
|
|
2462
|
+
return this._request(`/api/prompts/templates/${templateId}`, 'PATCH', fields);
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
async deletePromptTemplate(templateId) {
|
|
2466
|
+
return this._request(`/api/prompts/templates/${templateId}`, 'DELETE');
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
async listPromptVersions(templateId) {
|
|
2470
|
+
return this._request(`/api/prompts/templates/${templateId}/versions`, 'GET');
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
async createPromptVersion(templateId, { content, model_hint, parameters, changelog }) {
|
|
2474
|
+
return this._request(`/api/prompts/templates/${templateId}/versions`, 'POST', { content, model_hint, parameters, changelog });
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
async getPromptVersion(templateId, versionId) {
|
|
2478
|
+
return this._request(`/api/prompts/templates/${templateId}/versions/${versionId}`, 'GET');
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
async activatePromptVersion(templateId, versionId) {
|
|
2482
|
+
return this._request(`/api/prompts/templates/${templateId}/versions/${versionId}`, 'POST');
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
async renderPrompt({ template_id, version_id, variables, action_id, agent_id, record }) {
|
|
2486
|
+
return this._request('/api/prompts/render', 'POST', { template_id, version_id, variables, action_id, agent_id, record });
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
async listPromptRuns({ template_id, version_id, limit } = {}) {
|
|
2490
|
+
const params = new URLSearchParams();
|
|
2491
|
+
if (template_id) params.set('template_id', template_id);
|
|
2492
|
+
if (version_id) params.set('version_id', version_id);
|
|
2493
|
+
if (limit) params.set('limit', String(limit));
|
|
2494
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
2495
|
+
return this._request(`/api/prompts/runs${qs}`, 'GET');
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
async getPromptStats({ template_id } = {}) {
|
|
2499
|
+
const params = template_id ? `?template_id=${encodeURIComponent(template_id)}` : '';
|
|
2500
|
+
return this._request(`/api/prompts/stats${params}`, 'GET');
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
// -----------------------------------------------
|
|
2504
|
+
// User Feedback
|
|
2505
|
+
// -----------------------------------------------
|
|
2506
|
+
|
|
2507
|
+
async submitFeedback({ action_id, agent_id, rating, comment, category, tags, metadata }) {
|
|
2508
|
+
return this._request('/api/feedback', 'POST', { action_id, agent_id, rating, comment, category, tags, metadata, source: 'sdk' });
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
async listFeedback({ action_id, agent_id, category, sentiment, resolved, limit, offset } = {}) {
|
|
2512
|
+
const params = new URLSearchParams();
|
|
2513
|
+
if (action_id) params.set('action_id', action_id);
|
|
2514
|
+
if (agent_id) params.set('agent_id', agent_id);
|
|
2515
|
+
if (category) params.set('category', category);
|
|
2516
|
+
if (sentiment) params.set('sentiment', sentiment);
|
|
2517
|
+
if (resolved !== undefined) params.set('resolved', String(resolved));
|
|
2518
|
+
if (limit) params.set('limit', String(limit));
|
|
2519
|
+
if (offset) params.set('offset', String(offset));
|
|
2520
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
2521
|
+
return this._request(`/api/feedback${qs}`, 'GET');
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
async getFeedback(feedbackId) {
|
|
2525
|
+
return this._request(`/api/feedback/${feedbackId}`, 'GET');
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
async resolveFeedback(feedbackId) {
|
|
2529
|
+
return this._request(`/api/feedback/${feedbackId}`, 'PATCH', { resolved_by: 'sdk' });
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
async deleteFeedback(feedbackId) {
|
|
2533
|
+
return this._request(`/api/feedback/${feedbackId}`, 'DELETE');
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
async getFeedbackStats({ agent_id } = {}) {
|
|
2537
|
+
const params = agent_id ? `?agent_id=${encodeURIComponent(agent_id)}` : '';
|
|
2538
|
+
return this._request(`/api/feedback/stats${params}`, 'GET');
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
// -----------------------------------------------
|
|
2542
|
+
// Compliance Export
|
|
2543
|
+
// -----------------------------------------------
|
|
2544
|
+
|
|
2545
|
+
async createComplianceExport({ name, frameworks, format, window_days, include_evidence, include_remediation, include_trends }) {
|
|
2546
|
+
return this._request('/api/compliance/exports', 'POST', { name, frameworks, format, window_days, include_evidence, include_remediation, include_trends });
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
async listComplianceExports({ limit } = {}) {
|
|
2550
|
+
const params = limit ? `?limit=${limit}` : '';
|
|
2551
|
+
return this._request(`/api/compliance/exports${params}`, 'GET');
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
async getComplianceExport(exportId) {
|
|
2555
|
+
return this._request(`/api/compliance/exports/${exportId}`, 'GET');
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
async downloadComplianceExport(exportId) {
|
|
2559
|
+
return this._request(`/api/compliance/exports/${exportId}/download`, 'GET');
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
async deleteComplianceExport(exportId) {
|
|
2563
|
+
return this._request(`/api/compliance/exports/${exportId}`, 'DELETE');
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
async createComplianceSchedule({ name, frameworks, format, window_days, cron_expression, include_evidence, include_remediation, include_trends }) {
|
|
2567
|
+
return this._request('/api/compliance/schedules', 'POST', { name, frameworks, format, window_days, cron_expression, include_evidence, include_remediation, include_trends });
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
async listComplianceSchedules() {
|
|
2571
|
+
return this._request('/api/compliance/schedules', 'GET');
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
async updateComplianceSchedule(scheduleId, fields) {
|
|
2575
|
+
return this._request(`/api/compliance/schedules/${scheduleId}`, 'PATCH', fields);
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
async deleteComplianceSchedule(scheduleId) {
|
|
2579
|
+
return this._request(`/api/compliance/schedules/${scheduleId}`, 'DELETE');
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
async getComplianceTrends({ framework, limit } = {}) {
|
|
2583
|
+
const params = new URLSearchParams();
|
|
2584
|
+
if (framework) params.set('framework', framework);
|
|
2585
|
+
if (limit) params.set('limit', String(limit));
|
|
2586
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
2587
|
+
return this._request(`/api/compliance/trends${qs}`, 'GET');
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
// -----------------------------------------------
|
|
2591
|
+
// Drift Detection
|
|
2592
|
+
// -----------------------------------------------
|
|
2593
|
+
|
|
2594
|
+
async computeDriftBaselines({ agent_id, lookback_days } = {}) {
|
|
2595
|
+
return this._request('/api/drift/alerts', 'POST', { action: 'compute_baselines', agent_id, lookback_days });
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
async detectDrift({ agent_id, window_days } = {}) {
|
|
2599
|
+
return this._request('/api/drift/alerts', 'POST', { action: 'detect', agent_id, window_days });
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
async recordDriftSnapshots() {
|
|
2603
|
+
return this._request('/api/drift/alerts', 'POST', { action: 'record_snapshots' });
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
async listDriftAlerts({ agent_id, severity, acknowledged, limit } = {}) {
|
|
2607
|
+
const params = new URLSearchParams();
|
|
2608
|
+
if (agent_id) params.set('agent_id', agent_id);
|
|
2609
|
+
if (severity) params.set('severity', severity);
|
|
2610
|
+
if (acknowledged !== undefined) params.set('acknowledged', String(acknowledged));
|
|
2611
|
+
if (limit) params.set('limit', String(limit));
|
|
2612
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
2613
|
+
return this._request(`/api/drift/alerts${qs}`, 'GET');
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
async acknowledgeDriftAlert(alertId) {
|
|
2617
|
+
return this._request(`/api/drift/alerts/${alertId}`, 'PATCH');
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
async deleteDriftAlert(alertId) {
|
|
2621
|
+
return this._request(`/api/drift/alerts/${alertId}`, 'DELETE');
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
async getDriftStats({ agent_id } = {}) {
|
|
2625
|
+
const params = agent_id ? `?agent_id=${encodeURIComponent(agent_id)}` : '';
|
|
2626
|
+
return this._request(`/api/drift/stats${params}`, 'GET');
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
async getDriftSnapshots({ agent_id, metric, limit } = {}) {
|
|
2630
|
+
const params = new URLSearchParams();
|
|
2631
|
+
if (agent_id) params.set('agent_id', agent_id);
|
|
2632
|
+
if (metric) params.set('metric', metric);
|
|
2633
|
+
if (limit) params.set('limit', String(limit));
|
|
2634
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
2635
|
+
return this._request(`/api/drift/snapshots${qs}`, 'GET');
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
async getDriftMetrics() {
|
|
2639
|
+
return this._request('/api/drift/metrics', 'GET');
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
// -----------------------------------------------
|
|
2643
|
+
// Learning Analytics
|
|
2644
|
+
// -----------------------------------------------
|
|
2645
|
+
|
|
2646
|
+
async computeLearningVelocity({ agent_id, lookback_days, period } = {}) {
|
|
2647
|
+
return this._request('/api/learning/analytics/velocity', 'POST', { agent_id, lookback_days, period });
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
async getLearningVelocity({ agent_id, limit } = {}) {
|
|
2651
|
+
const params = new URLSearchParams();
|
|
2652
|
+
if (agent_id) params.set('agent_id', agent_id);
|
|
2653
|
+
if (limit) params.set('limit', String(limit));
|
|
2654
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
2655
|
+
return this._request(`/api/learning/analytics/velocity${qs}`, 'GET');
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
async computeLearningCurves({ agent_id, lookback_days } = {}) {
|
|
2659
|
+
return this._request('/api/learning/analytics/curves', 'POST', { agent_id, lookback_days });
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
async getLearningCurves({ agent_id, action_type, limit } = {}) {
|
|
2663
|
+
const params = new URLSearchParams();
|
|
2664
|
+
if (agent_id) params.set('agent_id', agent_id);
|
|
2665
|
+
if (action_type) params.set('action_type', action_type);
|
|
2666
|
+
if (limit) params.set('limit', String(limit));
|
|
2667
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
2668
|
+
return this._request(`/api/learning/analytics/curves${qs}`, 'GET');
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
async getLearningAnalyticsSummary({ agent_id } = {}) {
|
|
2672
|
+
const params = agent_id ? `?agent_id=${encodeURIComponent(agent_id)}` : '';
|
|
2673
|
+
return this._request(`/api/learning/analytics/summary${params}`, 'GET');
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
async getMaturityLevels() {
|
|
2677
|
+
return this._request('/api/learning/analytics/maturity', 'GET');
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
// --- Scoring Profiles -----------------------------------
|
|
2681
|
+
|
|
2682
|
+
async createScoringProfile(data) {
|
|
2683
|
+
return this._request('POST', '/api/scoring/profiles', data);
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
async listScoringProfiles(params = {}) {
|
|
2687
|
+
return this._request('GET', '/api/scoring/profiles', null, params);
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
async getScoringProfile(profileId) {
|
|
2691
|
+
return this._request('GET', `/api/scoring/profiles/${profileId}`);
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
async updateScoringProfile(profileId, data) {
|
|
2695
|
+
return this._request('PATCH', `/api/scoring/profiles/${profileId}`, data);
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
async deleteScoringProfile(profileId) {
|
|
2699
|
+
return this._request('DELETE', `/api/scoring/profiles/${profileId}`);
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
async addScoringDimension(profileId, data) {
|
|
2703
|
+
return this._request('POST', `/api/scoring/profiles/${profileId}/dimensions`, data);
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
async updateScoringDimension(profileId, dimensionId, data) {
|
|
2707
|
+
return this._request('PATCH', `/api/scoring/profiles/${profileId}/dimensions/${dimensionId}`, data);
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
async deleteScoringDimension(profileId, dimensionId) {
|
|
2711
|
+
return this._request('DELETE', `/api/scoring/profiles/${profileId}/dimensions/${dimensionId}`);
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
async scoreWithProfile(profileId, action) {
|
|
2715
|
+
return this._request('POST', '/api/scoring/score', { profile_id: profileId, action });
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
async batchScoreWithProfile(profileId, actions) {
|
|
2719
|
+
return this._request('POST', '/api/scoring/score', { profile_id: profileId, actions });
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
async getProfileScores(params = {}) {
|
|
2723
|
+
return this._request('GET', '/api/scoring/score', null, params);
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
async getProfileScoreStats(profileId) {
|
|
2727
|
+
return this._request('GET', '/api/scoring/score', null, { profile_id: profileId, view: 'stats' });
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
// --- Risk Templates ------------------------------------
|
|
2731
|
+
|
|
2732
|
+
async createRiskTemplate(data) {
|
|
2733
|
+
return this._request('POST', '/api/scoring/risk-templates', data);
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
async listRiskTemplates(params = {}) {
|
|
2737
|
+
return this._request('GET', '/api/scoring/risk-templates', null, params);
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
async updateRiskTemplate(templateId, data) {
|
|
2741
|
+
return this._request('PATCH', `/api/scoring/risk-templates/${templateId}`, data);
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
async deleteRiskTemplate(templateId) {
|
|
2745
|
+
return this._request('DELETE', `/api/scoring/risk-templates/${templateId}`);
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
// --- Auto-Calibration ----------------------------------
|
|
2749
|
+
|
|
2750
|
+
async autoCalibrate(options = {}) {
|
|
2751
|
+
return this._request('POST', '/api/scoring/calibrate', options);
|
|
2752
|
+
}
|
|
2280
2753
|
}
|
|
2281
2754
|
|
|
2282
2755
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dashclaw",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Full-featured agent toolkit for the DashClaw platform.
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Full-featured agent toolkit for the DashClaw platform. 178+ methods across 30+ 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": {
|
|
7
7
|
"access": "public"
|