dashclaw 2.0.3 → 2.1.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 +56 -2120
- package/dashclaw.js +137 -2885
- package/index.cjs +48 -69
- package/legacy/dashclaw-v1.js +2887 -0
- package/legacy/index-v1.cjs +91 -0
- package/package.json +49 -46
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DashClaw SDK: CommonJS compatibility wrapper.
|
|
3
|
+
* For ESM: import { DashClaw } from 'dashclaw'
|
|
4
|
+
* For CJS: const { DashClaw } = require('dashclaw')
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
let _module;
|
|
8
|
+
|
|
9
|
+
async function loadModule() {
|
|
10
|
+
if (!_module) {
|
|
11
|
+
_module = await import('./dashclaw.js');
|
|
12
|
+
}
|
|
13
|
+
return _module;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Re-export via dynamic import (CJS → ESM bridge)
|
|
17
|
+
module.exports = new Proxy({}, {
|
|
18
|
+
get(target, prop) {
|
|
19
|
+
if (prop === '__esModule') return true;
|
|
20
|
+
if (prop === 'then') return undefined; // Prevent Promise-like behavior
|
|
21
|
+
|
|
22
|
+
// Return a lazy-loading constructor wrapper
|
|
23
|
+
if (prop === 'GuardBlockedError') {
|
|
24
|
+
const Placeholder = class GuardBlockedError extends Error {
|
|
25
|
+
constructor(decision) {
|
|
26
|
+
const reasons = (decision.reasons || []).join('; ') || 'no reason';
|
|
27
|
+
super(`Guard blocked action: ${decision.decision}. Reasons: ${reasons}`);
|
|
28
|
+
this.name = 'GuardBlockedError';
|
|
29
|
+
this.decision = decision.decision;
|
|
30
|
+
this.reasons = decision.reasons || [];
|
|
31
|
+
this.warnings = decision.warnings || [];
|
|
32
|
+
this.matchedPolicies = decision.matched_policies || [];
|
|
33
|
+
this.riskScore = decision.risk_score ?? null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Support instanceof across ESM/CJS boundary
|
|
38
|
+
loadModule().then(m => {
|
|
39
|
+
if (m.GuardBlockedError) {
|
|
40
|
+
Object.defineProperty(Placeholder, Symbol.hasInstance, {
|
|
41
|
+
value: (instance) => instance && (instance.name === 'GuardBlockedError' || instance instanceof m.GuardBlockedError)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return Placeholder;
|
|
47
|
+
}
|
|
48
|
+
if (prop === 'DashClaw' || prop === 'OpenClawAgent' || prop === 'default') {
|
|
49
|
+
return class DashClawProxy {
|
|
50
|
+
constructor(opts) {
|
|
51
|
+
this._opts = opts;
|
|
52
|
+
this._ready = loadModule().then(m => {
|
|
53
|
+
const Cls = m.DashClaw || m.default;
|
|
54
|
+
this._instance = new Cls(opts);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Return a proxy that forwards all method calls to the async instance
|
|
58
|
+
return new Proxy(this, {
|
|
59
|
+
get(target, prop) {
|
|
60
|
+
if (prop in target) return target[prop];
|
|
61
|
+
if (prop === 'then') return undefined;
|
|
62
|
+
|
|
63
|
+
return async (...args) => {
|
|
64
|
+
await target._ready;
|
|
65
|
+
if (!target._instance[prop]) {
|
|
66
|
+
throw new Error(`Method ${String(prop)} does not exist on DashClaw`);
|
|
67
|
+
}
|
|
68
|
+
return target._instance[prop](...args);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// For synchronous construction, use DashClaw.create()
|
|
75
|
+
static async create(opts) {
|
|
76
|
+
const mod = await loadModule();
|
|
77
|
+
const Cls = mod.DashClaw || mod.default;
|
|
78
|
+
return new Cls(opts);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Preferred: async factory
|
|
87
|
+
module.exports.create = async function create(opts) {
|
|
88
|
+
const mod = await loadModule();
|
|
89
|
+
const Cls = mod.DashClaw || mod.default;
|
|
90
|
+
return new Cls(opts);
|
|
91
|
+
};
|
package/package.json
CHANGED
|
@@ -1,46 +1,49 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dashclaw",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"description": "
|
|
5
|
-
"type": "module",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
|
-
"main": "./index.cjs",
|
|
10
|
-
"module": "./dashclaw.js",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./dashclaw.js",
|
|
14
|
-
"require": "./index.cjs"
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dashclaw",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Minimal governance runtime for AI agents. Intercept, govern, and verify agent actions.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"main": "./index.cjs",
|
|
10
|
+
"module": "./dashclaw.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dashclaw.js",
|
|
14
|
+
"require": "./index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./legacy": {
|
|
17
|
+
"import": "./legacy/dashclaw-v1.js",
|
|
18
|
+
"require": "./legacy/index-v1.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dashclaw.js",
|
|
23
|
+
"index.cjs",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md",
|
|
26
|
+
"legacy/"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"ai-agent",
|
|
30
|
+
"decision-infrastructure",
|
|
31
|
+
"agent-governance",
|
|
32
|
+
"guardrails",
|
|
33
|
+
"dashclaw"
|
|
34
|
+
],
|
|
35
|
+
"author": "DashClaw",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/ucsandman/DashClaw.git",
|
|
40
|
+
"directory": "sdk"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {},
|
|
46
|
+
"devDependencies": {},
|
|
47
|
+
"scripts": {},
|
|
48
|
+
"sideEffects": false
|
|
49
|
+
}
|