dashclaw 2.2.0 → 2.3.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.
Files changed (3) hide show
  1. package/README.md +18 -2
  2. package/dashclaw.js +116 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -75,7 +75,7 @@ claw.update_outcome(action_id, status="completed")
75
75
  The v2.1.5 SDK is optimized for stability and zero-overhead governance:
76
76
 
77
77
  ### Core Runtime
78
- - `guard(context)` -- Policy evaluation ("Can I do X?")
78
+ - `guard(context)` -- Policy evaluation ("Can I do X?"). Returns `risk_score` (server-computed) and `agent_risk_score` (raw agent value)
79
79
  - `createAction(action)` -- Lifecycle tracking ("I am doing X")
80
80
  - `updateOutcome(id, outcome)` -- Result recording ("X finished with Y")
81
81
  - `recordAssumption(assumption)` -- Integrity tracking ("I believe Z while doing X")
@@ -99,7 +99,23 @@ The v2.1.5 SDK is optimized for stability and zero-overhead governance:
99
99
 
100
100
  ### Compliance & Audit
101
101
  - `createScorer(name, type, config)` -- Define automated evaluations.
102
- - `createScoringProfile(profile)` -- Weighted quality scoring.
102
+ - `createScoringProfile(profile)` -- Create a weighted multi-dimensional scoring profile.
103
+ - `listScoringProfiles(filters)` -- List all scoring profiles.
104
+ - `getScoringProfile(profileId)` -- Get a profile with its dimensions.
105
+ - `updateScoringProfile(profileId, updates)` -- Update profile metadata or composite method.
106
+ - `deleteScoringProfile(profileId)` -- Delete a scoring profile.
107
+ - `addScoringDimension(profileId, dimension)` -- Add a dimension to a profile.
108
+ - `updateScoringDimension(profileId, dimensionId, updates)` -- Update a dimension's scale or weight.
109
+ - `deleteScoringDimension(profileId, dimensionId)` -- Remove a dimension from a profile.
110
+ - `scoreWithProfile(profileId, action)` -- Score a single action; returns composite + per-dimension breakdown.
111
+ - `batchScoreWithProfile(profileId, actions)` -- Score multiple actions; returns results + summary stats.
112
+ - `getProfileScores(filters)` -- List stored profile scores (filter by profile_id, agent_id, action_id).
113
+ - `getProfileScoreStats(profileId)` -- Aggregate stats: avg, min, max, stddev for a profile.
114
+ - `createRiskTemplate(template)` -- Define rules for automatic risk score computation.
115
+ - `listRiskTemplates(filters)` -- List all risk templates.
116
+ - `updateRiskTemplate(templateId, updates)` -- Update a risk template's rules or base_risk.
117
+ - `deleteRiskTemplate(templateId)` -- Delete a risk template.
118
+ - `autoCalibrate(options)` -- Analyze historical actions and suggest percentile-based scoring scales.
103
119
  - `mapCompliance(framework)` -- Map behavior to regulatory controls.
104
120
  - `getProofReport(format)` -- Generate audit-ready evidence exports.
105
121
  - `getActivityLogs(filters)` -- Query the immutable audit trail.
package/dashclaw.js CHANGED
@@ -57,6 +57,10 @@ class DashClaw {
57
57
  const data = await res.json();
58
58
 
59
59
  if (!res.ok) {
60
+ if (res.status === 403 && data.decision && data.decision.decision === 'block') {
61
+ throw new GuardBlockedError(data.decision);
62
+ }
63
+
60
64
  // Prioritize reason (from governance blocks) over generic error field
61
65
  const errorMessage = data.reason || data.error || `Request failed with status ${res.status}`;
62
66
  const err = new Error(errorMessage);
@@ -309,6 +313,118 @@ class DashClaw {
309
313
  return this._request('/api/scoring/profiles', 'POST', profile);
310
314
  }
311
315
 
316
+ /**
317
+ * GET /api/scoring/profiles
318
+ */
319
+ async listScoringProfiles(filters = {}) {
320
+ return this._request('/api/scoring/profiles', 'GET', null, filters);
321
+ }
322
+
323
+ /**
324
+ * GET /api/scoring/profiles/:id
325
+ */
326
+ async getScoringProfile(profileId) {
327
+ return this._request(`/api/scoring/profiles/${profileId}`, 'GET');
328
+ }
329
+
330
+ /**
331
+ * PATCH /api/scoring/profiles/:id
332
+ */
333
+ async updateScoringProfile(profileId, updates) {
334
+ return this._request(`/api/scoring/profiles/${profileId}`, 'PATCH', updates);
335
+ }
336
+
337
+ /**
338
+ * DELETE /api/scoring/profiles/:id
339
+ */
340
+ async deleteScoringProfile(profileId) {
341
+ return this._request(`/api/scoring/profiles/${profileId}`, 'DELETE');
342
+ }
343
+
344
+ /**
345
+ * POST /api/scoring/profiles/:id/dimensions
346
+ */
347
+ async addScoringDimension(profileId, dimension) {
348
+ return this._request(`/api/scoring/profiles/${profileId}/dimensions`, 'POST', dimension);
349
+ }
350
+
351
+ /**
352
+ * PATCH /api/scoring/profiles/:id/dimensions/:dimId
353
+ */
354
+ async updateScoringDimension(profileId, dimensionId, updates) {
355
+ return this._request(`/api/scoring/profiles/${profileId}/dimensions/${dimensionId}`, 'PATCH', updates);
356
+ }
357
+
358
+ /**
359
+ * DELETE /api/scoring/profiles/:id/dimensions/:dimId
360
+ */
361
+ async deleteScoringDimension(profileId, dimensionId) {
362
+ return this._request(`/api/scoring/profiles/${profileId}/dimensions/${dimensionId}`, 'DELETE');
363
+ }
364
+
365
+ /**
366
+ * POST /api/scoring/score — score a single action against a profile
367
+ */
368
+ async scoreWithProfile(profileId, action) {
369
+ return this._request('/api/scoring/score', 'POST', { profile_id: profileId, action });
370
+ }
371
+
372
+ /**
373
+ * POST /api/scoring/score — batch score multiple actions against a profile
374
+ */
375
+ async batchScoreWithProfile(profileId, actions) {
376
+ return this._request('/api/scoring/score', 'POST', { profile_id: profileId, actions });
377
+ }
378
+
379
+ /**
380
+ * GET /api/scoring/score — list stored profile scores
381
+ */
382
+ async getProfileScores(filters = {}) {
383
+ return this._request('/api/scoring/score', 'GET', null, filters);
384
+ }
385
+
386
+ /**
387
+ * GET /api/scoring/score?view=stats — aggregate stats for a profile
388
+ */
389
+ async getProfileScoreStats(profileId) {
390
+ return this._request('/api/scoring/score', 'GET', null, { profile_id: profileId, view: 'stats' });
391
+ }
392
+
393
+ /**
394
+ * POST /api/scoring/risk-templates
395
+ */
396
+ async createRiskTemplate(template) {
397
+ return this._request('/api/scoring/risk-templates', 'POST', template);
398
+ }
399
+
400
+ /**
401
+ * GET /api/scoring/risk-templates
402
+ */
403
+ async listRiskTemplates(filters = {}) {
404
+ return this._request('/api/scoring/risk-templates', 'GET', null, filters);
405
+ }
406
+
407
+ /**
408
+ * PATCH /api/scoring/risk-templates/:id
409
+ */
410
+ async updateRiskTemplate(templateId, updates) {
411
+ return this._request(`/api/scoring/risk-templates/${templateId}`, 'PATCH', updates);
412
+ }
413
+
414
+ /**
415
+ * DELETE /api/scoring/risk-templates/:id
416
+ */
417
+ async deleteRiskTemplate(templateId) {
418
+ return this._request(`/api/scoring/risk-templates/${templateId}`, 'DELETE');
419
+ }
420
+
421
+ /**
422
+ * POST /api/scoring/calibrate — analyze historical data and suggest dimension thresholds
423
+ */
424
+ async autoCalibrate(options = {}) {
425
+ return this._request('/api/scoring/calibrate', 'POST', options);
426
+ }
427
+
312
428
  /**
313
429
  * GET /api/compliance/map
314
430
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashclaw",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Minimal governance runtime for AI agents. Intercept, govern, and verify agent actions.",
5
5
  "type": "module",
6
6
  "publishConfig": {