dashclaw 2.9.0 → 2.10.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 +118 -3
- package/dashclaw.js +185 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# DashClaw SDK (v2.
|
|
1
|
+
# DashClaw SDK (v2.10.0)
|
|
2
2
|
|
|
3
3
|
**Minimal governance runtime for AI agents.**
|
|
4
4
|
|
|
@@ -70,9 +70,9 @@ claw.update_outcome(action_id, status="completed")
|
|
|
70
70
|
|
|
71
71
|
---
|
|
72
72
|
|
|
73
|
-
## SDK Surface Area (v2.
|
|
73
|
+
## SDK Surface Area (v2.10.0)
|
|
74
74
|
|
|
75
|
-
The v2 SDK exposes **
|
|
75
|
+
The v2 SDK exposes **67 methods** optimized for stability and zero-overhead governance:
|
|
76
76
|
|
|
77
77
|
### Core Runtime
|
|
78
78
|
- `guard(context)` -- Policy evaluation ("Can I do X?"). Returns `risk_score` (server-computed) and `agent_risk_score` (raw agent value)
|
|
@@ -387,5 +387,120 @@ Methods moved to v1 only: `createWebhook`, `getActivityLogs`, `mapCompliance`, `
|
|
|
387
387
|
|
|
388
388
|
---
|
|
389
389
|
|
|
390
|
+
## Execution Studio
|
|
391
|
+
|
|
392
|
+
Governance packaging and discovery — workflow templates, model strategies, knowledge collections, a capability registry, and a read-only execution graph. Added in v2.10.0.
|
|
393
|
+
|
|
394
|
+
### Execution Graph
|
|
395
|
+
|
|
396
|
+
```javascript
|
|
397
|
+
// Fetch the execution graph for any action (reuses existing trace data)
|
|
398
|
+
const { rootActionId, nodes, edges } = await claw.getActionGraph(actionId);
|
|
399
|
+
// nodes: action:<id>, assumption:<id>, loop:<id>
|
|
400
|
+
// edges: parent_child | related | assumption_of | loop_from
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Workflow Templates
|
|
404
|
+
|
|
405
|
+
```javascript
|
|
406
|
+
// List templates
|
|
407
|
+
const { templates } = await claw.listWorkflowTemplates({ status: 'active' });
|
|
408
|
+
|
|
409
|
+
// Create a template
|
|
410
|
+
const { template } = await claw.createWorkflowTemplate({
|
|
411
|
+
name: 'Release Hotfix',
|
|
412
|
+
description: 'Ship urgent production patches safely',
|
|
413
|
+
objective: 'Deploy with full policy + approval coverage',
|
|
414
|
+
linked_policy_ids: ['pol_prod_deploy'],
|
|
415
|
+
linked_capability_tags: ['deploy'],
|
|
416
|
+
model_strategy_id: 'mst_balanced_default'
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// Get / update / duplicate
|
|
420
|
+
const detail = await claw.getWorkflowTemplate(templateId);
|
|
421
|
+
await claw.updateWorkflowTemplate(templateId, {
|
|
422
|
+
steps: [{ id: 'plan' }, { id: 'test' }, { id: 'deploy' }]
|
|
423
|
+
}); // bumps version when steps change
|
|
424
|
+
await claw.duplicateWorkflowTemplate(templateId);
|
|
425
|
+
|
|
426
|
+
// Launch — creates a traceable action_records row with workflow metadata.
|
|
427
|
+
// If the template links a model_strategy_id, the resolved config is snapshotted.
|
|
428
|
+
const { launch } = await claw.launchWorkflowTemplate(templateId, { agent_id: 'deploy-bot' });
|
|
429
|
+
console.log(launch.action_id); // act_... — view it in /decisions/<action_id>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Model Strategies
|
|
433
|
+
|
|
434
|
+
```javascript
|
|
435
|
+
// List and create
|
|
436
|
+
const { strategies } = await claw.listModelStrategies();
|
|
437
|
+
const { strategy } = await claw.createModelStrategy({
|
|
438
|
+
name: 'Balanced Default',
|
|
439
|
+
description: 'GPT-4.1 primary, Claude Sonnet 4 fallback',
|
|
440
|
+
config: {
|
|
441
|
+
primary: { provider: 'openai', model: 'gpt-4.1' },
|
|
442
|
+
fallback: [{ provider: 'anthropic', model: 'claude-sonnet-4' }],
|
|
443
|
+
costSensitivity: 'balanced', // 'low' | 'balanced' | 'high-quality'
|
|
444
|
+
latencySensitivity: 'medium', // 'low' | 'medium' | 'high'
|
|
445
|
+
maxBudgetUsd: 0.5,
|
|
446
|
+
maxRetries: 2,
|
|
447
|
+
allowedProviders: ['openai', 'anthropic']
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// Update (config patches merge over existing config)
|
|
452
|
+
await claw.updateModelStrategy(strategyId, { config: { maxBudgetUsd: 1.0 } });
|
|
453
|
+
|
|
454
|
+
// Delete (soft references on linked workflow_templates are nulled out)
|
|
455
|
+
await claw.deleteModelStrategy(strategyId);
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Knowledge Collections
|
|
459
|
+
|
|
460
|
+
Metadata-only layer — no embedding or retrieval yet. Ingestion execution is planned for Phase 2b.
|
|
461
|
+
|
|
462
|
+
```javascript
|
|
463
|
+
// Create a collection
|
|
464
|
+
const { collection } = await claw.createKnowledgeCollection({
|
|
465
|
+
name: 'Runbook Library',
|
|
466
|
+
description: 'Incident response runbooks',
|
|
467
|
+
source_type: 'files', // 'files' | 'urls' | 'external' | 'notes'
|
|
468
|
+
tags: ['ops', 'oncall']
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// Add items (bumps parent doc_count; transitions ingestion_status from empty → pending)
|
|
472
|
+
await claw.addKnowledgeCollectionItem(collection.collection_id, {
|
|
473
|
+
source_uri: 'https://docs.example.com/runbook.md',
|
|
474
|
+
title: 'Deploy runbook',
|
|
475
|
+
mime_type: 'text/markdown'
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// List items
|
|
479
|
+
const { items } = await claw.listKnowledgeCollectionItems(collection.collection_id);
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Capability Registry
|
|
483
|
+
|
|
484
|
+
```javascript
|
|
485
|
+
// Search the registry (category, risk_level, and search are combinable)
|
|
486
|
+
const { capabilities } = await claw.listCapabilities({ risk_level: 'medium', search: 'slack' });
|
|
487
|
+
|
|
488
|
+
// Register a capability
|
|
489
|
+
await claw.createCapability({
|
|
490
|
+
name: 'Send Slack Message',
|
|
491
|
+
description: 'Posts to a configured Slack channel',
|
|
492
|
+
category: 'messaging',
|
|
493
|
+
source_type: 'http_api', // 'internal_sdk' | 'http_api' | 'webhook' | 'human_approval' | 'external_marketplace'
|
|
494
|
+
auth_type: 'oauth',
|
|
495
|
+
risk_level: 'medium', // 'low' | 'medium' | 'high' | 'critical'
|
|
496
|
+
requires_approval: false,
|
|
497
|
+
tags: ['notify', 'slack'],
|
|
498
|
+
health_status: 'healthy',
|
|
499
|
+
docs_url: 'https://docs.example.com/slack'
|
|
500
|
+
});
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
390
505
|
## License
|
|
391
506
|
MIT
|
package/dashclaw.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DashClaw SDK v2.
|
|
2
|
+
* DashClaw SDK v2.10.0 (Stable Runtime API)
|
|
3
3
|
* Focused governance runtime client for AI agents.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -643,6 +643,190 @@ class DashClaw {
|
|
|
643
643
|
async getSessionEvents(sessionId) {
|
|
644
644
|
return this._request(`/api/sessions/${sessionId}/events`, 'GET');
|
|
645
645
|
}
|
|
646
|
+
|
|
647
|
+
// ---------------------------------------------------------------------------
|
|
648
|
+
// Execution Studio — Execution Graph
|
|
649
|
+
// ---------------------------------------------------------------------------
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* GET /api/actions/:id/graph — Read-only execution graph (nodes + edges).
|
|
653
|
+
*/
|
|
654
|
+
async getActionGraph(actionId) {
|
|
655
|
+
return this._request(`/api/actions/${actionId}/graph`, 'GET');
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// ---------------------------------------------------------------------------
|
|
659
|
+
// Execution Studio — Workflow Templates
|
|
660
|
+
// ---------------------------------------------------------------------------
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* GET /api/workflows/templates — List workflow templates.
|
|
664
|
+
* @param {Object} [filters={}] - { status, limit, offset }
|
|
665
|
+
*/
|
|
666
|
+
async listWorkflowTemplates(filters = {}) {
|
|
667
|
+
return this._request('/api/workflows/templates', 'GET', null, filters);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* POST /api/workflows/templates — Create a workflow template.
|
|
672
|
+
*/
|
|
673
|
+
async createWorkflowTemplate(data) {
|
|
674
|
+
return this._request('/api/workflows/templates', 'POST', data);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* GET /api/workflows/templates/:id — Fetch a single template.
|
|
679
|
+
*/
|
|
680
|
+
async getWorkflowTemplate(templateId) {
|
|
681
|
+
return this._request(`/api/workflows/templates/${templateId}`, 'GET');
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* PATCH /api/workflows/templates/:id — Partial update. Bumps version when steps change.
|
|
686
|
+
*/
|
|
687
|
+
async updateWorkflowTemplate(templateId, patch) {
|
|
688
|
+
return this._request(`/api/workflows/templates/${templateId}`, 'PATCH', patch);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* POST /api/workflows/templates/:id/duplicate — Clone as a new draft.
|
|
693
|
+
*/
|
|
694
|
+
async duplicateWorkflowTemplate(templateId, overrides = {}) {
|
|
695
|
+
return this._request(`/api/workflows/templates/${templateId}/duplicate`, 'POST', overrides);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* POST /api/workflows/templates/:id/launch — Create a traceable action record.
|
|
700
|
+
* Resolves any linked model strategy into a snapshot at launch time.
|
|
701
|
+
*/
|
|
702
|
+
async launchWorkflowTemplate(templateId, options = {}) {
|
|
703
|
+
return this._request(`/api/workflows/templates/${templateId}/launch`, 'POST', options);
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// ---------------------------------------------------------------------------
|
|
707
|
+
// Execution Studio — Model Strategies
|
|
708
|
+
// ---------------------------------------------------------------------------
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* GET /api/model-strategies — List model strategies.
|
|
712
|
+
*/
|
|
713
|
+
async listModelStrategies() {
|
|
714
|
+
return this._request('/api/model-strategies', 'GET');
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* POST /api/model-strategies — Create a model strategy.
|
|
719
|
+
* @param {Object} data - { name, description, config: { primary, fallback, costSensitivity, ... } }
|
|
720
|
+
*/
|
|
721
|
+
async createModelStrategy(data) {
|
|
722
|
+
return this._request('/api/model-strategies', 'POST', data);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* GET /api/model-strategies/:id — Fetch a single strategy.
|
|
727
|
+
*/
|
|
728
|
+
async getModelStrategy(strategyId) {
|
|
729
|
+
return this._request(`/api/model-strategies/${strategyId}`, 'GET');
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* PATCH /api/model-strategies/:id — Partial update. Config patches merge over existing.
|
|
734
|
+
*/
|
|
735
|
+
async updateModelStrategy(strategyId, patch) {
|
|
736
|
+
return this._request(`/api/model-strategies/${strategyId}`, 'PATCH', patch);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* DELETE /api/model-strategies/:id — Delete. Nulls soft refs on linked templates.
|
|
741
|
+
*/
|
|
742
|
+
async deleteModelStrategy(strategyId) {
|
|
743
|
+
return this._request(`/api/model-strategies/${strategyId}`, 'DELETE');
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// ---------------------------------------------------------------------------
|
|
747
|
+
// Execution Studio — Knowledge Collections
|
|
748
|
+
// ---------------------------------------------------------------------------
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* GET /api/knowledge/collections — List knowledge collections.
|
|
752
|
+
* @param {Object} [filters={}] - { sourceType, limit, offset }
|
|
753
|
+
*/
|
|
754
|
+
async listKnowledgeCollections(filters = {}) {
|
|
755
|
+
const params = {};
|
|
756
|
+
if (filters.sourceType) params.source_type = filters.sourceType;
|
|
757
|
+
if (filters.limit) params.limit = filters.limit;
|
|
758
|
+
if (filters.offset) params.offset = filters.offset;
|
|
759
|
+
return this._request('/api/knowledge/collections', 'GET', null, params);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* POST /api/knowledge/collections — Create a knowledge collection.
|
|
764
|
+
*/
|
|
765
|
+
async createKnowledgeCollection(data) {
|
|
766
|
+
return this._request('/api/knowledge/collections', 'POST', data);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* GET /api/knowledge/collections/:id — Fetch a single collection.
|
|
771
|
+
*/
|
|
772
|
+
async getKnowledgeCollection(collectionId) {
|
|
773
|
+
return this._request(`/api/knowledge/collections/${collectionId}`, 'GET');
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* PATCH /api/knowledge/collections/:id — Update collection metadata.
|
|
778
|
+
*/
|
|
779
|
+
async updateKnowledgeCollection(collectionId, patch) {
|
|
780
|
+
return this._request(`/api/knowledge/collections/${collectionId}`, 'PATCH', patch);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* GET /api/knowledge/collections/:id/items — List items in a collection.
|
|
785
|
+
* @param {Object} [filters={}] - { limit, offset }
|
|
786
|
+
*/
|
|
787
|
+
async listKnowledgeCollectionItems(collectionId, filters = {}) {
|
|
788
|
+
return this._request(`/api/knowledge/collections/${collectionId}/items`, 'GET', null, filters);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* POST /api/knowledge/collections/:id/items — Add an item. Bumps parent doc_count.
|
|
793
|
+
*/
|
|
794
|
+
async addKnowledgeCollectionItem(collectionId, data) {
|
|
795
|
+
return this._request(`/api/knowledge/collections/${collectionId}/items`, 'POST', data);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// ---------------------------------------------------------------------------
|
|
799
|
+
// Execution Studio — Capability Registry
|
|
800
|
+
// ---------------------------------------------------------------------------
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* GET /api/capabilities — Search the capability registry.
|
|
804
|
+
* @param {Object} [filters={}] - { category, risk_level, search, limit, offset }
|
|
805
|
+
*/
|
|
806
|
+
async listCapabilities(filters = {}) {
|
|
807
|
+
return this._request('/api/capabilities', 'GET', null, filters);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* POST /api/capabilities — Register a capability.
|
|
812
|
+
*/
|
|
813
|
+
async createCapability(data) {
|
|
814
|
+
return this._request('/api/capabilities', 'POST', data);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* GET /api/capabilities/:id — Fetch a single capability.
|
|
819
|
+
*/
|
|
820
|
+
async getCapability(capabilityId) {
|
|
821
|
+
return this._request(`/api/capabilities/${capabilityId}`, 'GET');
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* PATCH /api/capabilities/:id — Update a capability.
|
|
826
|
+
*/
|
|
827
|
+
async updateCapability(capabilityId, patch) {
|
|
828
|
+
return this._request(`/api/capabilities/${capabilityId}`, 'PATCH', patch);
|
|
829
|
+
}
|
|
646
830
|
}
|
|
647
831
|
|
|
648
832
|
export { DashClaw, ApprovalDeniedError, GuardBlockedError };
|