@cowork-trust/trust 0.1.0 → 0.1.1
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 +58 -0
- package/bin/trust.js +43 -0
- package/package.json +23 -2
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @cowork-trust/trust
|
|
2
|
+
|
|
3
|
+
CLI for the CoWork Trust Engine API.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @cowork-trust/trust --help
|
|
9
|
+
npm install -g @cowork-trust/trust
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Login
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
cowork-trust login --api-url https://cowork-hubspot-integration-staging.up.railway.app
|
|
16
|
+
cowork-trust whoami
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The CLI stores credentials in `~/.cowork/trust/config.json`. You can also pass `--api-url` and `--api-key`, or set `COWORK_API_URL` and `COWORK_API_KEY`.
|
|
20
|
+
|
|
21
|
+
## Smoke Test
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cowork-trust smoke
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Evaluate
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cowork-trust evaluate --category read --action resource.read --resource record:123
|
|
31
|
+
cowork-trust evaluate --category write --action resource.write --resource record:123
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Score And Feedback
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cowork-trust score --actor agent-1
|
|
38
|
+
cowork-trust feedback --evaluation <evaluation-id> --signal approved
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## API Keys
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cowork-trust keys create --name connector-prod --environment test
|
|
45
|
+
cowork-trust keys list
|
|
46
|
+
cowork-trust keys rotate <key-id>
|
|
47
|
+
cowork-trust keys revoke <key-id>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Evaluation History
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cowork-trust evaluations list
|
|
54
|
+
cowork-trust evaluations get <evaluation-id>
|
|
55
|
+
cowork-trust actors history agent-1
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
All commands print compact JSON by default.
|
package/bin/trust.js
CHANGED
|
@@ -49,6 +49,12 @@ async function main() {
|
|
|
49
49
|
case 'keys':
|
|
50
50
|
await keysCommand();
|
|
51
51
|
return;
|
|
52
|
+
case 'evaluations':
|
|
53
|
+
await evaluationsCommand();
|
|
54
|
+
return;
|
|
55
|
+
case 'actors':
|
|
56
|
+
await actorsCommand();
|
|
57
|
+
return;
|
|
52
58
|
default:
|
|
53
59
|
throw new Error(`Unknown command: ${command}`);
|
|
54
60
|
}
|
|
@@ -143,6 +149,40 @@ async function keysCommand() {
|
|
|
143
149
|
throw new Error('Usage: cowork-trust keys list | keys create --name <name> [--environment test|live] | keys revoke <key-id> | keys rotate <key-id>');
|
|
144
150
|
}
|
|
145
151
|
|
|
152
|
+
async function evaluationsCommand() {
|
|
153
|
+
const subcommand = process.argv[3];
|
|
154
|
+
if (subcommand === 'list') {
|
|
155
|
+
print(await get(`/api/trust/evaluations${queryString(['limit', 'cursor', 'actorExternalId', 'actionCategory', 'decision', 'from', 'to'])}`));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (subcommand === 'get') {
|
|
159
|
+
const id = process.argv[4] || args.id;
|
|
160
|
+
if (!id) throw new Error('Usage: cowork-trust evaluations get <evaluation-id>');
|
|
161
|
+
print(await get(`/api/trust/evaluations/${encodeURIComponent(id)}`));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
throw new Error('Usage: cowork-trust evaluations list | evaluations get <id>');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function actorsCommand() {
|
|
168
|
+
const subcommand = process.argv[3];
|
|
169
|
+
if (subcommand === 'history') {
|
|
170
|
+
const actor = process.argv[4] || required('actor');
|
|
171
|
+
print(await get(`/api/trust/actors/${encodeURIComponent(actor)}/signals${queryString(['limit', 'cursor', 'signalType', 'from', 'to'])}`));
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
throw new Error('Usage: cowork-trust actors history <actor>');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function queryString(names) {
|
|
178
|
+
const params = new URLSearchParams();
|
|
179
|
+
for (const name of names) {
|
|
180
|
+
if (args[name]) params.set(name, args[name]);
|
|
181
|
+
}
|
|
182
|
+
const raw = params.toString();
|
|
183
|
+
return raw ? `?${raw}` : '';
|
|
184
|
+
}
|
|
185
|
+
|
|
146
186
|
async function smoke() {
|
|
147
187
|
const now = Date.now();
|
|
148
188
|
const checks = [
|
|
@@ -337,6 +377,9 @@ function printHelp() {
|
|
|
337
377
|
cowork-trust keys create --name connector-prod [--environment test|live]
|
|
338
378
|
cowork-trust keys revoke <key-id>
|
|
339
379
|
cowork-trust keys rotate <key-id>
|
|
380
|
+
cowork-trust evaluations list
|
|
381
|
+
cowork-trust evaluations get <evaluation-id>
|
|
382
|
+
cowork-trust actors history <actor>
|
|
340
383
|
cowork-trust smoke [--api-url <url>] [--api-key <key>]
|
|
341
384
|
cowork-trust evaluate --category read --action resource.read --resource record:123
|
|
342
385
|
cowork-trust score --actor agent-1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowork-trust/trust",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,5 +13,26 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"bin"
|
|
16
|
-
]
|
|
16
|
+
],
|
|
17
|
+
"description": "CLI for the CoWork Trust Engine API.",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"cowork",
|
|
21
|
+
"trust-engine",
|
|
22
|
+
"ai-agents",
|
|
23
|
+
"audit",
|
|
24
|
+
"api"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://github.com/CoWork-Human-Agent-Protocol/cowork-hubspot-integration#readme",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/CoWork-Human-Agent-Protocol/cowork-hubspot-integration/issues"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/CoWork-Human-Agent-Protocol/cowork-hubspot-integration.git",
|
|
33
|
+
"directory": "packages/cli"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
}
|
|
17
38
|
}
|