ai-trust 0.2.3 → 0.2.5
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 +7 -4
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +13 -38
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +12 -35
- package/dist/commands/check.js.map +1 -1
- package/dist/telemetry/contribute.d.ts +38 -13
- package/dist/telemetry/contribute.d.ts.map +1 -1
- package/dist/telemetry/contribute.js +119 -78
- package/dist/telemetry/contribute.js.map +1 -1
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +2 -2
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/opt-in.d.ts +20 -13
- package/dist/telemetry/opt-in.d.ts.map +1 -1
- package/dist/telemetry/opt-in.js +87 -112
- package/dist/telemetry/opt-in.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
> **[OpenA2A](https://github.com/opena2a-org/opena2a)**: [CLI](https://github.com/opena2a-org/opena2a) · [HackMyAgent](https://github.com/opena2a-org/hackmyagent) · [Secretless](https://github.com/opena2a-org/secretless-ai) · [AIM](https://github.com/opena2a-org/agent-identity-management) · [Browser Guard](https://github.com/opena2a-org/AI-BrowserGuard) · [DVAA](https://github.com/opena2a-org/damn-vulnerable-ai-agent)
|
|
2
|
-
|
|
1
|
+
> **[OpenA2A](https://github.com/opena2a-org/opena2a)**: [CLI](https://github.com/opena2a-org/opena2a) · [HackMyAgent](https://github.com/opena2a-org/hackmyagent) · [Secretless](https://github.com/opena2a-org/secretless-ai) · [AIM](https://github.com/opena2a-org/agent-identity-management) · [Browser Guard](https://github.com/opena2a-org/AI-BrowserGuard) · [DVAA](https://github.com/opena2a-org/damn-vulnerable-ai-agent)
|
|
3
2
|
# ai-trust
|
|
4
3
|
|
|
5
4
|
Trust verification CLI for AI packages. Queries the OpenA2A Registry trust graph for security scans, community consensus, dependency risk, and known advisories.
|
|
@@ -47,6 +46,8 @@ Expected output:
|
|
|
47
46
|
Findings: 0 critical, 0 high, 2 medium
|
|
48
47
|
```
|
|
49
48
|
|
|
49
|
+

|
|
50
|
+
|
|
50
51
|
## Built-in Help
|
|
51
52
|
|
|
52
53
|
```bash
|
|
@@ -198,8 +199,10 @@ See [docs/USE-CASES.md](docs/USE-CASES.md) for the full index.
|
|
|
198
199
|
|
|
199
200
|
## Links
|
|
200
201
|
|
|
201
|
-
- [OpenA2A](https://opena2a.org)
|
|
202
|
-
- [OpenA2A
|
|
202
|
+
- [OpenA2A Registry](https://registry.opena2a.org) — trust scores and scan data
|
|
203
|
+
- [OpenA2A CLI](https://github.com/opena2a-org/opena2a) — unified security CLI
|
|
204
|
+
- [HackMyAgent](https://github.com/opena2a-org/hackmyagent) — local scanning for unverified packages
|
|
205
|
+
- [opena2a.org](https://opena2a.org) — full platform
|
|
203
206
|
|
|
204
207
|
## License
|
|
205
208
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuH3D"}
|
package/dist/commands/audit.js
CHANGED
|
@@ -8,7 +8,7 @@ import { parseDependencyFile } from "../utils/parser.js";
|
|
|
8
8
|
import { formatBatchResults, formatJson, } from "../output/formatter.js";
|
|
9
9
|
import { isHmaAvailable, scanPackage } from "../scanner/index.js";
|
|
10
10
|
import { confirm } from "../utils/prompt.js";
|
|
11
|
-
import { isContributeEnabled,
|
|
11
|
+
import { isContributeEnabled, queueScanResult, flushQueue, recordScanAndMaybeShowTip, } from "../telemetry/index.js";
|
|
12
12
|
export function registerAuditCommand(program) {
|
|
13
13
|
program
|
|
14
14
|
.command("audit <file>")
|
|
@@ -130,49 +130,24 @@ async function scanMissingPackages(notFound, allResults, opts, registryUrl) {
|
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Handle community contribution after audit scanning.
|
|
133
|
-
* Follows the same opt-in flow as check:
|
|
133
|
+
* Follows the same opt-in flow as check: queue + flush.
|
|
134
134
|
*/
|
|
135
135
|
async function handleAuditContribution(scannedResults, opts, registryUrl) {
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
// Show tip after 3rd scan (non-blocking, replaces old interactive prompt)
|
|
137
|
+
const tip = recordScanAndMaybeShowTip();
|
|
138
|
+
if (tip) {
|
|
139
|
+
process.stderr.write(tip + "\n");
|
|
139
140
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
await submitAnonymizedTelemetry(name, scanResult, registryUrl);
|
|
143
|
-
}
|
|
141
|
+
const shouldContribute = opts.contribute || isContributeEnabled() === true;
|
|
142
|
+
if (!shouldContribute)
|
|
144
143
|
return;
|
|
145
|
-
|
|
146
|
-
const configEnabled = isContributeEnabled();
|
|
147
|
-
if (configEnabled === true) {
|
|
148
|
-
// Already opted in: auto-contribute anonymized telemetry
|
|
144
|
+
try {
|
|
149
145
|
for (const { name, scanResult } of scannedResults) {
|
|
150
|
-
|
|
146
|
+
queueScanResult(name, scanResult.scan.findings);
|
|
151
147
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
// Not yet configured: check if we should prompt
|
|
158
|
-
if (shouldPromptContribute()) {
|
|
159
|
-
const enabled = await showContributePrompt();
|
|
160
|
-
if (enabled) {
|
|
161
|
-
for (const { name, scanResult } of scannedResults) {
|
|
162
|
-
await submitAnonymizedTelemetry(name, scanResult, registryUrl);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Submit anonymized telemetry to the registry (opt-in contribution).
|
|
169
|
-
*/
|
|
170
|
-
async function submitAnonymizedTelemetry(name, scanResult, registryUrl) {
|
|
171
|
-
try {
|
|
172
|
-
const payload = buildContributionPayload(name, scanResult.scan.findings);
|
|
173
|
-
const result = await submitContribution(payload, registryUrl);
|
|
174
|
-
if (result.success) {
|
|
175
|
-
console.error(chalk.green(` Anonymized scan data shared: ${name}`));
|
|
148
|
+
const ok = await flushQueue(registryUrl);
|
|
149
|
+
if (ok) {
|
|
150
|
+
console.error(chalk.green(` Anonymized scan data shared: ${scannedResults.length} package(s)`));
|
|
176
151
|
}
|
|
177
152
|
}
|
|
178
153
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,kBAAkB,EAClB,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OA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ACP,YAAY;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2BzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2E3D"}
|
package/dist/commands/check.js
CHANGED
|
@@ -10,7 +10,7 @@ import { formatCheckResult, formatScanResult, formatJson, } from "../output/form
|
|
|
10
10
|
import { resolveAndLog } from "../utils/resolve.js";
|
|
11
11
|
import { isHmaAvailable, scanPackage } from "../scanner/index.js";
|
|
12
12
|
import { confirm } from "../utils/prompt.js";
|
|
13
|
-
import { isContributeEnabled,
|
|
13
|
+
import { isContributeEnabled, queueScanResult, flushQueue, recordScanAndMaybeShowTip, } from "../telemetry/index.js";
|
|
14
14
|
export function registerCheckCommand(program) {
|
|
15
15
|
program
|
|
16
16
|
.command("check <name>")
|
|
@@ -123,47 +123,24 @@ async function handleScanFlow(name, client, globalOpts, opts, statusMessage) {
|
|
|
123
123
|
await handleContribute(name, scanResult, globalOpts, opts);
|
|
124
124
|
}
|
|
125
125
|
async function handleContribute(name, scanResult, globalOpts, opts) {
|
|
126
|
-
//
|
|
127
|
-
|
|
126
|
+
// Show tip after 3rd scan (non-blocking, replaces old interactive prompt)
|
|
127
|
+
const tip = recordScanAndMaybeShowTip();
|
|
128
|
+
if (tip) {
|
|
129
|
+
process.stderr.write(tip + "\n");
|
|
130
|
+
}
|
|
128
131
|
// Determine contribution mode:
|
|
129
132
|
// 1. --contribute flag: always contribute anonymized telemetry
|
|
130
133
|
// 2. Config enabled: auto-contribute anonymized telemetry
|
|
131
|
-
// 3. Not configured:
|
|
132
|
-
|
|
133
|
-
if (
|
|
134
|
-
await submitAnonymizedTelemetry(name, scanResult, globalOpts.registryUrl);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const configEnabled = isContributeEnabled();
|
|
138
|
-
if (configEnabled === true) {
|
|
139
|
-
// Already opted in: auto-contribute anonymized telemetry
|
|
140
|
-
await submitAnonymizedTelemetry(name, scanResult, globalOpts.registryUrl);
|
|
134
|
+
// 3. Not configured or disabled: skip
|
|
135
|
+
const shouldContribute = opts.contribute || isContributeEnabled() === true;
|
|
136
|
+
if (!shouldContribute)
|
|
141
137
|
return;
|
|
142
|
-
}
|
|
143
|
-
if (configEnabled === false) {
|
|
144
|
-
// Explicitly opted out: skip
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
// Not yet configured: check if we should prompt
|
|
148
|
-
if (shouldPromptContribute()) {
|
|
149
|
-
const enabled = await showContributePrompt();
|
|
150
|
-
if (enabled) {
|
|
151
|
-
await submitAnonymizedTelemetry(name, scanResult, globalOpts.registryUrl);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Submit anonymized telemetry to the registry (opt-in contribution).
|
|
157
|
-
* Only sends checkId, pass/fail, and severity. No file paths, descriptions, or code.
|
|
158
|
-
*/
|
|
159
|
-
async function submitAnonymizedTelemetry(name, scanResult, registryUrl) {
|
|
160
138
|
try {
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
139
|
+
queueScanResult(name, scanResult.scan.findings);
|
|
140
|
+
const ok = await flushQueue(globalOpts.registryUrl);
|
|
141
|
+
if (ok) {
|
|
164
142
|
console.error(chalk.green("Anonymized scan data shared with the community."));
|
|
165
143
|
}
|
|
166
|
-
// Silent on failure -- non-blocking
|
|
167
144
|
}
|
|
168
145
|
catch {
|
|
169
146
|
// Non-fatal: telemetry submission should never crash the scan
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAW/B,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,gDAAgD,CAAC;SAC7D,MAAM,CACL,mBAAmB,EACnB,4DAA4D,CAC7D;SACA,MAAM,CACL,mBAAmB,EACnB,sDAAsD,CACvD;SACA,MAAM,CACL,cAAc,E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AAO,CAAC,KAAK,CACX,KAAK,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAC/D,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;IAChE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa;IAC1B,MAAM,SAAS,GAAG,MAAM,cAAc,EAAE,CAAC;IACzC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,8DAA8D,CAC/D,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAC9C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Community Contribution Module
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Delegates to @opena2a/contribute for queue management and batch submission.
|
|
5
|
+
*
|
|
6
|
+
* Queue file: ~/.opena2a/contribute-queue.json
|
|
7
|
+
* Endpoint: POST api.oa2a.org/api/v1/contribute
|
|
8
|
+
*
|
|
9
|
+
* PRIVACY: Only summary statistics are sent (totalChecks, passed,
|
|
10
|
+
* severity counts, score, verdict). No file paths, no source code,
|
|
11
|
+
* no raw finding descriptions, no PII.
|
|
6
12
|
*/
|
|
13
|
+
import { getContributorToken, type ContributionEvent as SharedContributionEvent, type ContributionBatch as SharedContributionBatch } from "@opena2a/contribute";
|
|
7
14
|
import type { HmaFinding } from "../scanner/hma.js";
|
|
8
15
|
/** Anonymized finding sent to the registry. Only check ID, result, and severity. */
|
|
9
16
|
export interface ContributionFinding {
|
|
@@ -11,7 +18,7 @@ export interface ContributionFinding {
|
|
|
11
18
|
result: "pass" | "fail";
|
|
12
19
|
severity: string;
|
|
13
20
|
}
|
|
14
|
-
/**
|
|
21
|
+
/** Legacy payload type. Callers should migrate to queueScanResult(). */
|
|
15
22
|
export interface ContributionPayload {
|
|
16
23
|
contributorToken: string;
|
|
17
24
|
packageName: string;
|
|
@@ -28,27 +35,45 @@ export interface ContributionResult {
|
|
|
28
35
|
scanId?: string;
|
|
29
36
|
error?: string;
|
|
30
37
|
}
|
|
38
|
+
/** Re-export ContributionEvent from the shared library. */
|
|
39
|
+
export type ContributionEvent = SharedContributionEvent;
|
|
40
|
+
/** Re-export ContributionBatch from the shared library. */
|
|
41
|
+
export type ContributionBatch = SharedContributionBatch;
|
|
31
42
|
/**
|
|
32
43
|
* Generate a stable per-device contributor token.
|
|
44
|
+
* Delegates to @opena2a/contribute. SHA256(hostname + username + random salt
|
|
45
|
+
* stored at ~/.opena2a/contributor-salt).
|
|
46
|
+
*/
|
|
47
|
+
export { getContributorToken as generateContributorToken };
|
|
48
|
+
/**
|
|
49
|
+
* Queue a scan result as a ContributionEvent.
|
|
33
50
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
51
|
+
* Delegates to @opena2a/contribute for queue management and batch
|
|
52
|
+
* submission. Converts the detailed finding list into an anonymized
|
|
53
|
+
* summary: only counts and severity distribution, no file paths or
|
|
54
|
+
* descriptions.
|
|
55
|
+
*/
|
|
56
|
+
export declare function queueScanResult(packageName: string, findings: HmaFinding[], durationMs?: number): void;
|
|
57
|
+
/**
|
|
58
|
+
* Flush queued events to the OpenA2A Registry.
|
|
59
|
+
* Returns true if submission succeeded (or queue was empty).
|
|
60
|
+
* Delegates to @opena2a/contribute.
|
|
37
61
|
*/
|
|
38
|
-
export declare function
|
|
62
|
+
export declare function flushQueue(registryUrl?: string, verbose?: boolean): Promise<boolean>;
|
|
39
63
|
/**
|
|
40
64
|
* Build an anonymized contribution payload from scan findings.
|
|
41
65
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
66
|
+
* @deprecated Use queueScanResult() + flushQueue() instead. Kept for
|
|
67
|
+
* backward compatibility. The per-finding payload format is superseded
|
|
68
|
+
* by the summary-based ContributionEvent format.
|
|
45
69
|
*/
|
|
46
70
|
export declare function buildContributionPayload(packageName: string, findings: HmaFinding[]): ContributionPayload;
|
|
47
71
|
/**
|
|
48
|
-
* Submit
|
|
72
|
+
* Submit a contribution payload to the registry.
|
|
49
73
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
74
|
+
* @deprecated Use queueScanResult() + flushQueue() instead. This legacy
|
|
75
|
+
* function now queues the event internally and flushes, rather than
|
|
76
|
+
* posting per-finding payloads directly.
|
|
52
77
|
*/
|
|
53
78
|
export declare function submitContribution(payload: ContributionPayload, registryUrl?: string): Promise<ContributionResult>;
|
|
54
79
|
//# sourceMappingURL=contribute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribute.d.ts","sourceRoot":"","sources":["../../src/telemetry/contribute.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"contribute.d.ts","sourceRoot":"","sources":["../../src/telemetry/contribute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,mBAAmB,EAEnB,KAAK,iBAAiB,IAAI,uBAAuB,EACjD,KAAK,iBAAiB,IAAI,uBAAuB,EAClD,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAUpD,oFAAoF;AACpF,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wEAAwE;AACxE,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;CACvC;AAED,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAExD,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAMxD;;;;GAIG;AACH,OAAO,EAAE,mBAAmB,IAAI,wBAAwB,EAAE,CAAC;AAiC3D;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,UAAU,EAAE,EACtB,UAAU,SAAI,GACb,IAAI,CA+BN;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,CAAC,CAElB;AAMD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,UAAU,EAAE,GACrB,mBAAmB,CAiBrB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,mBAAmB,EAC5B,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAyC7B"}
|
|
@@ -1,49 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Community Contribution Module
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Delegates to @opena2a/contribute for queue management and batch submission.
|
|
5
|
+
*
|
|
6
|
+
* Queue file: ~/.opena2a/contribute-queue.json
|
|
7
|
+
* Endpoint: POST api.oa2a.org/api/v1/contribute
|
|
8
|
+
*
|
|
9
|
+
* PRIVACY: Only summary statistics are sent (totalChecks, passed,
|
|
10
|
+
* severity counts, score, verdict). No file paths, no source code,
|
|
11
|
+
* no raw finding descriptions, no PII.
|
|
6
12
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { hostname, type as osType, userInfo } from "os";
|
|
10
|
-
import { join } from "path";
|
|
13
|
+
import { contribute, getContributorToken, queueEvent, } from "@opena2a/contribute";
|
|
14
|
+
import { type as osType } from "os";
|
|
11
15
|
import { createRequire } from "node:module";
|
|
12
16
|
const require = createRequire(import.meta.url);
|
|
13
17
|
const pkg = require("../../package.json");
|
|
14
18
|
const VERSION = pkg.version;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
function getOpena2aHome() {
|
|
20
|
-
return (process.env.OPENA2A_HOME || join(require("os").homedir(), ".opena2a"));
|
|
21
|
-
}
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Contributor token (delegated to @opena2a/contribute)
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
22
|
/**
|
|
23
23
|
* Generate a stable per-device contributor token.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* The salt is generated once on first call and persisted locally.
|
|
27
|
-
* Shared with hackmyagent so the same device gets the same token.
|
|
28
|
-
*/
|
|
29
|
-
export function generateContributorToken() {
|
|
30
|
-
const home = getOpena2aHome();
|
|
31
|
-
const saltPath = join(home, "contributor-salt");
|
|
32
|
-
let salt;
|
|
33
|
-
if (existsSync(saltPath)) {
|
|
34
|
-
salt = readFileSync(saltPath, "utf-8").trim();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
salt = randomBytes(32).toString("hex");
|
|
38
|
-
mkdirSync(home, { recursive: true });
|
|
39
|
-
writeFileSync(saltPath, salt, { mode: 0o600 });
|
|
40
|
-
}
|
|
41
|
-
const input = `${hostname()}|${userInfo().username}|${salt}`;
|
|
42
|
-
return createHash("sha256").update(input).digest("hex");
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Map the Node.js os.type() value to the server-accepted osType enum.
|
|
24
|
+
* Delegates to @opena2a/contribute. SHA256(hostname + username + random salt
|
|
25
|
+
* stored at ~/.opena2a/contributor-salt).
|
|
46
26
|
*/
|
|
27
|
+
export { getContributorToken as generateContributorToken };
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// OS type resolution
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
47
31
|
function resolveOsType() {
|
|
48
32
|
const t = osType();
|
|
49
33
|
if (t === "Darwin")
|
|
@@ -52,12 +36,76 @@ function resolveOsType() {
|
|
|
52
36
|
return "windows";
|
|
53
37
|
return "linux";
|
|
54
38
|
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Verdict computation
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
function computeVerdict(findings) {
|
|
43
|
+
const critical = findings.filter((f) => !f.passed && f.severity === "critical").length;
|
|
44
|
+
const high = findings.filter((f) => !f.passed && f.severity === "high").length;
|
|
45
|
+
if (critical > 0)
|
|
46
|
+
return "fail";
|
|
47
|
+
if (high > 0)
|
|
48
|
+
return "warn";
|
|
49
|
+
return "pass";
|
|
50
|
+
}
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Queue a scan result (delegates to @opena2a/contribute)
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
/**
|
|
55
|
+
* Queue a scan result as a ContributionEvent.
|
|
56
|
+
*
|
|
57
|
+
* Delegates to @opena2a/contribute for queue management and batch
|
|
58
|
+
* submission. Converts the detailed finding list into an anonymized
|
|
59
|
+
* summary: only counts and severity distribution, no file paths or
|
|
60
|
+
* descriptions.
|
|
61
|
+
*/
|
|
62
|
+
export function queueScanResult(packageName, findings, durationMs = 0) {
|
|
63
|
+
const total = findings.length;
|
|
64
|
+
const passed = findings.filter((f) => f.passed).length;
|
|
65
|
+
const failed = findings.filter((f) => !f.passed);
|
|
66
|
+
const critical = failed.filter((f) => f.severity === "critical").length;
|
|
67
|
+
const high = failed.filter((f) => f.severity === "high").length;
|
|
68
|
+
const medium = failed.filter((f) => f.severity === "medium").length;
|
|
69
|
+
const low = failed.filter((f) => f.severity === "low").length;
|
|
70
|
+
const score = total > 0 ? Math.round((passed / total) * 100) : 0;
|
|
71
|
+
const verdict = computeVerdict(findings);
|
|
72
|
+
// Delegate to @opena2a/contribute -- fire-and-forget since the
|
|
73
|
+
// shared library handles queue persistence internally.
|
|
74
|
+
contribute.scanResult({
|
|
75
|
+
tool: "ai-trust",
|
|
76
|
+
toolVersion: VERSION,
|
|
77
|
+
packageName,
|
|
78
|
+
ecosystem: "npm",
|
|
79
|
+
totalChecks: total,
|
|
80
|
+
passed,
|
|
81
|
+
critical,
|
|
82
|
+
high,
|
|
83
|
+
medium,
|
|
84
|
+
low,
|
|
85
|
+
score,
|
|
86
|
+
verdict,
|
|
87
|
+
durationMs,
|
|
88
|
+
}).catch(() => {
|
|
89
|
+
// Non-fatal: contribution should never crash the scan
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Flush queued events to the OpenA2A Registry.
|
|
94
|
+
* Returns true if submission succeeded (or queue was empty).
|
|
95
|
+
* Delegates to @opena2a/contribute.
|
|
96
|
+
*/
|
|
97
|
+
export async function flushQueue(registryUrl, verbose) {
|
|
98
|
+
return contribute.flush(registryUrl, verbose);
|
|
99
|
+
}
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Legacy API (kept for backward compatibility with existing callers/tests)
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
55
103
|
/**
|
|
56
104
|
* Build an anonymized contribution payload from scan findings.
|
|
57
105
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
106
|
+
* @deprecated Use queueScanResult() + flushQueue() instead. Kept for
|
|
107
|
+
* backward compatibility. The per-finding payload format is superseded
|
|
108
|
+
* by the summary-based ContributionEvent format.
|
|
61
109
|
*/
|
|
62
110
|
export function buildContributionPayload(packageName, findings) {
|
|
63
111
|
const contributionFindings = findings.map((f) => ({
|
|
@@ -66,7 +114,7 @@ export function buildContributionPayload(packageName, findings) {
|
|
|
66
114
|
severity: f.severity,
|
|
67
115
|
}));
|
|
68
116
|
return {
|
|
69
|
-
contributorToken:
|
|
117
|
+
contributorToken: getContributorToken(),
|
|
70
118
|
packageName,
|
|
71
119
|
packageVersion: "",
|
|
72
120
|
ecosystem: "npm",
|
|
@@ -77,47 +125,40 @@ export function buildContributionPayload(packageName, findings) {
|
|
|
77
125
|
};
|
|
78
126
|
}
|
|
79
127
|
/**
|
|
80
|
-
* Submit
|
|
128
|
+
* Submit a contribution payload to the registry.
|
|
81
129
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
130
|
+
* @deprecated Use queueScanResult() + flushQueue() instead. This legacy
|
|
131
|
+
* function now queues the event internally and flushes, rather than
|
|
132
|
+
* posting per-finding payloads directly.
|
|
84
133
|
*/
|
|
85
134
|
export async function submitContribution(payload, registryUrl) {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
catch (err) {
|
|
115
|
-
const message = err instanceof Error ? err.message : "Unknown error";
|
|
116
|
-
// AbortError means timeout
|
|
117
|
-
if (message.includes("abort") || message.includes("Abort")) {
|
|
118
|
-
return { success: false, error: "Request timed out (10s)" };
|
|
119
|
-
}
|
|
120
|
-
return { success: false, error: message };
|
|
121
|
-
}
|
|
135
|
+
const event = {
|
|
136
|
+
type: "scan_result",
|
|
137
|
+
tool: "ai-trust",
|
|
138
|
+
toolVersion: payload.aiTrustVersion,
|
|
139
|
+
timestamp: payload.scanTimestamp,
|
|
140
|
+
package: {
|
|
141
|
+
name: payload.packageName,
|
|
142
|
+
ecosystem: payload.ecosystem,
|
|
143
|
+
},
|
|
144
|
+
scanSummary: {
|
|
145
|
+
totalChecks: payload.findings.length,
|
|
146
|
+
passed: payload.findings.filter((f) => f.result === "pass").length,
|
|
147
|
+
critical: payload.findings.filter((f) => f.result === "fail" && f.severity === "critical").length,
|
|
148
|
+
high: payload.findings.filter((f) => f.result === "fail" && f.severity === "high").length,
|
|
149
|
+
medium: payload.findings.filter((f) => f.result === "fail" && f.severity === "medium").length,
|
|
150
|
+
low: payload.findings.filter((f) => f.result === "fail" && f.severity === "low").length,
|
|
151
|
+
score: payload.findings.length > 0
|
|
152
|
+
? Math.round((payload.findings.filter((f) => f.result === "pass").length /
|
|
153
|
+
payload.findings.length) *
|
|
154
|
+
100)
|
|
155
|
+
: 0,
|
|
156
|
+
verdict: "pass",
|
|
157
|
+
durationMs: 0,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
queueEvent(event);
|
|
161
|
+
const ok = await flushQueue(registryUrl);
|
|
162
|
+
return { success: ok };
|
|
122
163
|
}
|
|
123
164
|
//# sourceMappingURL=contribute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribute.js","sourceRoot":"","sources":["../../src/telemetry/contribute.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"contribute.js","sourceRoot":"","sources":["../../src/telemetry/contribute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,UAAU,GAGX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,IAAI,CAAC;AACpC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,MAAM;oBACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;oBACxB,GAAG,CACN;gBACH,CAAC,CAAC,CAAC;YACP,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,CAAC;SACd;KACF,CAAC;IAEF,UAAU,CAAC,KAAK,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC;IACzC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Telemetry module -- community contribution of anonymized scan findings.
|
|
3
3
|
*/
|
|
4
|
-
export { generateContributorToken, buildContributionPayload, submitContribution, type ContributionFinding, type ContributionPayload, type ContributionResult, } from "./contribute.js";
|
|
5
|
-
export { isContributeEnabled, shouldPromptContribute, incrementScanCount, saveContributeChoice, showContributePrompt, } from "./opt-in.js";
|
|
4
|
+
export { generateContributorToken, buildContributionPayload, submitContribution, queueScanResult, flushQueue, type ContributionFinding, type ContributionPayload, type ContributionResult, type ContributionEvent, type ContributionBatch, } from "./contribute.js";
|
|
5
|
+
export { isContributeEnabled, shouldPromptContribute, incrementScanCount, saveContributeChoice, showContributePrompt, recordScanAndMaybeShowTip, } from "./opt-in.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,aAAa,CAAC"}
|
package/dist/telemetry/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Telemetry module -- community contribution of anonymized scan findings.
|
|
3
3
|
*/
|
|
4
|
-
export { generateContributorToken, buildContributionPayload, submitContribution, } from "./contribute.js";
|
|
5
|
-
export { isContributeEnabled, shouldPromptContribute, incrementScanCount, saveContributeChoice, showContributePrompt, } from "./opt-in.js";
|
|
4
|
+
export { generateContributorToken, buildContributionPayload, submitContribution, queueScanResult, flushQueue, } from "./contribute.js";
|
|
5
|
+
export { isContributeEnabled, shouldPromptContribute, incrementScanCount, saveContributeChoice, showContributePrompt, recordScanAndMaybeShowTip, } from "./opt-in.js";
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EACf,UAAU,GAMX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,aAAa,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contribution
|
|
2
|
+
* Contribution Consent and Scan Counting
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* with the OpenA2A Registry.
|
|
4
|
+
* Manages the user's consent to share anonymized scan findings
|
|
5
|
+
* with the OpenA2A Registry. Uses a delayed consent tip shown
|
|
6
|
+
* after the 3rd scan (non-interactive, no blocking prompts).
|
|
6
7
|
*
|
|
7
8
|
* Config/counting is delegated to @opena2a/shared (the canonical
|
|
8
9
|
* source for ~/.opena2a/config.json). If @opena2a/shared is not
|
|
@@ -14,33 +15,39 @@
|
|
|
14
15
|
* Returns:
|
|
15
16
|
* true - user explicitly opted in
|
|
16
17
|
* false - user explicitly opted out (or default in shared backend)
|
|
17
|
-
* undefined - not yet configured
|
|
18
|
-
* defaults to false, so callers should rely on
|
|
19
|
-
* shouldPromptContribute() for prompt logic)
|
|
18
|
+
* undefined - not yet configured
|
|
20
19
|
*/
|
|
21
20
|
export declare function isContributeEnabled(): boolean | undefined;
|
|
22
21
|
/**
|
|
23
|
-
* Check whether we should show the contribution
|
|
22
|
+
* Check whether we should show the contribution tip.
|
|
24
23
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* and cooldown/dismiss logic.
|
|
24
|
+
* Returns true after the 3rd scan if the user hasn't opted in,
|
|
25
|
+
* opted out, or dismissed the tip within the last 30 days.
|
|
28
26
|
*/
|
|
29
27
|
export declare function shouldPromptContribute(): boolean;
|
|
30
28
|
/**
|
|
31
29
|
* Increment the scan count. Called after each scan completes,
|
|
32
30
|
* regardless of contribution setting.
|
|
33
31
|
*/
|
|
34
|
-
export declare function incrementScanCount():
|
|
32
|
+
export declare function incrementScanCount(): number;
|
|
35
33
|
/**
|
|
36
34
|
* Save the user's contribution choice to the config file.
|
|
37
35
|
*/
|
|
38
36
|
export declare function saveContributeChoice(enabled: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Record a scan and return a consent tip string if the threshold is reached.
|
|
39
|
+
*
|
|
40
|
+
* After the 3rd scan, returns a non-interactive tip encouraging the user
|
|
41
|
+
* to enable contribution. Returns null if tip should not be shown.
|
|
42
|
+
* This replaces the previous interactive Y/N prompt.
|
|
43
|
+
*/
|
|
44
|
+
export declare function recordScanAndMaybeShowTip(): string | null;
|
|
39
45
|
/**
|
|
40
46
|
* Display the contribution opt-in prompt and return the user's choice.
|
|
41
47
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
48
|
+
* @deprecated Use recordScanAndMaybeShowTip() instead. This is kept
|
|
49
|
+
* for backward compatibility but now shows a non-interactive tip
|
|
50
|
+
* rather than blocking for input.
|
|
44
51
|
*/
|
|
45
52
|
export declare function showContributePrompt(): Promise<boolean>;
|
|
46
53
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opt-in.d.ts","sourceRoot":"","sources":["../../src/telemetry/opt-in.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"opt-in.d.ts","sourceRoot":"","sources":["../../src/telemetry/opt-in.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAoKH;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,GAAG,SAAS,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAK3D;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAezD;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAM7D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,UAAQ,GAAG,IAAI,CAKtD"}
|
package/dist/telemetry/opt-in.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contribution
|
|
2
|
+
* Contribution Consent and Scan Counting
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* with the OpenA2A Registry.
|
|
4
|
+
* Manages the user's consent to share anonymized scan findings
|
|
5
|
+
* with the OpenA2A Registry. Uses a delayed consent tip shown
|
|
6
|
+
* after the 3rd scan (non-interactive, no blocking prompts).
|
|
6
7
|
*
|
|
7
8
|
* Config/counting is delegated to @opena2a/shared (the canonical
|
|
8
9
|
* source for ~/.opena2a/config.json). If @opena2a/shared is not
|
|
@@ -15,30 +16,31 @@ let _backend;
|
|
|
15
16
|
function resolveBackend() {
|
|
16
17
|
if (_backend)
|
|
17
18
|
return _backend;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
typeof shared.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
// When OPENA2A_HOME is set, always use local backend so the custom
|
|
20
|
+
// home directory is respected (important for testing and isolation).
|
|
21
|
+
if (!process.env.OPENA2A_HOME) {
|
|
22
|
+
try {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
24
|
+
const shared = require("@opena2a/shared");
|
|
25
|
+
if (typeof shared.isContributeEnabled === "function" &&
|
|
26
|
+
typeof shared.setContributeEnabled === "function" &&
|
|
27
|
+
typeof shared.incrementScanCount === "function" &&
|
|
28
|
+
typeof shared.shouldPromptContribute === "function" &&
|
|
29
|
+
typeof shared.dismissContributePrompt === "function") {
|
|
30
|
+
_backend = {
|
|
31
|
+
isContributeEnabled: shared.isContributeEnabled,
|
|
32
|
+
setContributeEnabled: shared.setContributeEnabled,
|
|
33
|
+
incrementScanCount: shared.incrementScanCount,
|
|
34
|
+
getScanCount: shared.getScanCount || (() => 0),
|
|
35
|
+
shouldPromptContribute: shared.shouldPromptContribute,
|
|
36
|
+
dismissContributePrompt: shared.dismissContributePrompt,
|
|
37
|
+
};
|
|
38
|
+
return _backend;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// @opena2a/shared not installed -- fall through to local backend
|
|
38
43
|
}
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
// @opena2a/shared not installed -- fall through to local backend
|
|
42
44
|
}
|
|
43
45
|
_backend = createLocalBackend();
|
|
44
46
|
return _backend;
|
|
@@ -67,58 +69,63 @@ function writeConfig(config) {
|
|
|
67
69
|
mode: 0o600,
|
|
68
70
|
});
|
|
69
71
|
}
|
|
72
|
+
/** Cooldown for the consent tip: 30 days after dismissal. */
|
|
73
|
+
const TIP_COOLDOWN_MS = 30 * 24 * 60 * 60 * 1000;
|
|
70
74
|
function createLocalBackend() {
|
|
71
75
|
return {
|
|
72
76
|
isContributeEnabled() {
|
|
73
77
|
const config = readConfig();
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
if (config.contribute?.enabled === false)
|
|
77
|
-
return false;
|
|
78
|
-
return undefined;
|
|
78
|
+
return config.contribute?.enabled === true;
|
|
79
79
|
},
|
|
80
80
|
setContributeEnabled(enabled) {
|
|
81
81
|
const config = readConfig();
|
|
82
82
|
if (!config.contribute)
|
|
83
83
|
config.contribute = {};
|
|
84
84
|
config.contribute.enabled = enabled;
|
|
85
|
-
const scanCount = config.contribute.scanCount ?? 0;
|
|
86
|
-
if (scanCount >= 9)
|
|
87
|
-
config.contribute.promptedAtTen = true;
|
|
88
85
|
writeConfig(config);
|
|
89
86
|
},
|
|
90
87
|
incrementScanCount() {
|
|
91
88
|
const config = readConfig();
|
|
92
|
-
if (!config.
|
|
93
|
-
config.
|
|
94
|
-
config.
|
|
89
|
+
if (!config.telemetry)
|
|
90
|
+
config.telemetry = {};
|
|
91
|
+
config.telemetry.scanCount = (config.telemetry.scanCount ?? 0) + 1;
|
|
95
92
|
writeConfig(config);
|
|
96
|
-
return config.
|
|
93
|
+
return config.telemetry.scanCount;
|
|
94
|
+
},
|
|
95
|
+
getScanCount() {
|
|
96
|
+
const config = readConfig();
|
|
97
|
+
return config.telemetry?.scanCount ?? 0;
|
|
97
98
|
},
|
|
98
99
|
shouldPromptContribute() {
|
|
99
100
|
const config = readConfig();
|
|
101
|
+
// Already decided -- do not prompt
|
|
100
102
|
if (config.contribute?.enabled === true ||
|
|
101
103
|
config.contribute?.enabled === false) {
|
|
102
104
|
return false;
|
|
103
105
|
}
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
const count = config.telemetry?.scanCount ?? 0;
|
|
107
|
+
if (count < 3)
|
|
108
|
+
return false;
|
|
109
|
+
// Check cooldown
|
|
110
|
+
const dismissed = config.telemetry?.contributePromptDismissedAt;
|
|
111
|
+
if (dismissed) {
|
|
112
|
+
const dismissedMs = new Date(dismissed).getTime();
|
|
113
|
+
if (Date.now() - dismissedMs < TIP_COOLDOWN_MS)
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
110
117
|
},
|
|
111
118
|
dismissContributePrompt() {
|
|
112
119
|
const config = readConfig();
|
|
113
|
-
if (!config.
|
|
114
|
-
config.
|
|
115
|
-
config.
|
|
120
|
+
if (!config.telemetry)
|
|
121
|
+
config.telemetry = {};
|
|
122
|
+
config.telemetry.contributePromptDismissedAt = new Date().toISOString();
|
|
116
123
|
writeConfig(config);
|
|
117
124
|
},
|
|
118
125
|
};
|
|
119
126
|
}
|
|
120
127
|
// ---------------------------------------------------------------------------
|
|
121
|
-
// Public API
|
|
128
|
+
// Public API
|
|
122
129
|
// ---------------------------------------------------------------------------
|
|
123
130
|
/**
|
|
124
131
|
* Check whether the contribution setting is enabled.
|
|
@@ -126,23 +133,18 @@ function createLocalBackend() {
|
|
|
126
133
|
* Returns:
|
|
127
134
|
* true - user explicitly opted in
|
|
128
135
|
* false - user explicitly opted out (or default in shared backend)
|
|
129
|
-
* undefined - not yet configured
|
|
130
|
-
* defaults to false, so callers should rely on
|
|
131
|
-
* shouldPromptContribute() for prompt logic)
|
|
136
|
+
* undefined - not yet configured
|
|
132
137
|
*/
|
|
133
138
|
export function isContributeEnabled() {
|
|
134
|
-
return resolveBackend().isContributeEnabled();
|
|
139
|
+
return resolveBackend().isContributeEnabled() || undefined;
|
|
135
140
|
}
|
|
136
141
|
/**
|
|
137
|
-
* Check whether we should show the contribution
|
|
142
|
+
* Check whether we should show the contribution tip.
|
|
138
143
|
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* and cooldown/dismiss logic.
|
|
144
|
+
* Returns true after the 3rd scan if the user hasn't opted in,
|
|
145
|
+
* opted out, or dismissed the tip within the last 30 days.
|
|
142
146
|
*/
|
|
143
147
|
export function shouldPromptContribute() {
|
|
144
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
145
|
-
return false;
|
|
146
148
|
return resolveBackend().shouldPromptContribute();
|
|
147
149
|
}
|
|
148
150
|
/**
|
|
@@ -150,7 +152,7 @@ export function shouldPromptContribute() {
|
|
|
150
152
|
* regardless of contribution setting.
|
|
151
153
|
*/
|
|
152
154
|
export function incrementScanCount() {
|
|
153
|
-
resolveBackend().incrementScanCount();
|
|
155
|
+
return resolveBackend().incrementScanCount();
|
|
154
156
|
}
|
|
155
157
|
/**
|
|
156
158
|
* Save the user's contribution choice to the config file.
|
|
@@ -162,66 +164,39 @@ export function saveContributeChoice(enabled) {
|
|
|
162
164
|
}
|
|
163
165
|
}
|
|
164
166
|
/**
|
|
165
|
-
*
|
|
167
|
+
* Record a scan and return a consent tip string if the threshold is reached.
|
|
166
168
|
*
|
|
167
|
-
*
|
|
168
|
-
* Returns
|
|
169
|
+
* After the 3rd scan, returns a non-interactive tip encouraging the user
|
|
170
|
+
* to enable contribution. Returns null if tip should not be shown.
|
|
171
|
+
* This replaces the previous interactive Y/N prompt.
|
|
169
172
|
*/
|
|
170
|
-
export
|
|
171
|
-
|
|
173
|
+
export function recordScanAndMaybeShowTip() {
|
|
174
|
+
incrementScanCount();
|
|
175
|
+
if (!shouldPromptContribute())
|
|
176
|
+
return null;
|
|
177
|
+
// Mark as shown so we respect the 30-day cooldown
|
|
178
|
+
resolveBackend().dismissContributePrompt();
|
|
179
|
+
return [
|
|
172
180
|
"",
|
|
173
|
-
"
|
|
181
|
+
" Tip: Your scans help build community trust data for MCP servers and AI agents.",
|
|
182
|
+
" Share anonymized results so other developers can make informed security decisions.",
|
|
183
|
+
" Enable: npx ai-trust check --contribute (or: opena2a config contribute on)",
|
|
174
184
|
"",
|
|
175
|
-
|
|
176
|
-
"No personal data. No source code. Only check pass/fail results.",
|
|
177
|
-
"You can opt out anytime: opena2a config set contribute false",
|
|
178
|
-
"",
|
|
179
|
-
"[Y] Yes, contribute [N] No thanks",
|
|
180
|
-
];
|
|
181
|
-
for (const line of lines) {
|
|
182
|
-
process.stderr.write(line + "\n");
|
|
183
|
-
}
|
|
184
|
-
const answer = await readSingleKey();
|
|
185
|
-
const enabled = answer.toLowerCase() === "y";
|
|
186
|
-
saveContributeChoice(enabled);
|
|
187
|
-
if (enabled) {
|
|
188
|
-
process.stderr.write("\nContribution enabled. Thank you.\n");
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
process.stderr.write("\nContribution disabled. You can enable it later: opena2a config set contribute true\n");
|
|
192
|
-
}
|
|
193
|
-
return enabled;
|
|
185
|
+
].join("\n");
|
|
194
186
|
}
|
|
195
187
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
188
|
+
* Display the contribution opt-in prompt and return the user's choice.
|
|
189
|
+
*
|
|
190
|
+
* @deprecated Use recordScanAndMaybeShowTip() instead. This is kept
|
|
191
|
+
* for backward compatibility but now shows a non-interactive tip
|
|
192
|
+
* rather than blocking for input.
|
|
198
193
|
*/
|
|
199
|
-
function
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
cleanup();
|
|
206
|
-
resolve("n");
|
|
207
|
-
}, 30_000);
|
|
208
|
-
function cleanup() {
|
|
209
|
-
clearTimeout(timer);
|
|
210
|
-
stdin.removeListener("data", onData);
|
|
211
|
-
if (stdin.isRaw !== wasRaw) {
|
|
212
|
-
stdin.setRawMode(wasRaw ?? false);
|
|
213
|
-
}
|
|
214
|
-
stdin.pause();
|
|
215
|
-
}
|
|
216
|
-
function onData(data) {
|
|
217
|
-
const char = data.toString().trim().toLowerCase();
|
|
218
|
-
cleanup();
|
|
219
|
-
resolve(char || "n");
|
|
220
|
-
}
|
|
221
|
-
stdin.setRawMode(true);
|
|
222
|
-
stdin.resume();
|
|
223
|
-
stdin.once("data", onData);
|
|
224
|
-
});
|
|
194
|
+
export async function showContributePrompt() {
|
|
195
|
+
const tip = recordScanAndMaybeShowTip();
|
|
196
|
+
if (tip) {
|
|
197
|
+
process.stdout.write(tip + "\n");
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
225
200
|
}
|
|
226
201
|
/**
|
|
227
202
|
* Reset the backend (for testing).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opt-in.js","sourceRoot":"","sources":["../../src/telemetry/opt-in.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"opt-in.js","sourceRoot":"","sources":["../../src/telemetry/opt-in.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAe5B,0DAA0D;AAC1D,IAAI,QAAmC,CAAC;AAExC,SAAS,cAAc;IACrB,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAE9B,mEAAmE;IACnE,qEAAqE;IACrE,IAAI,CAAC,O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AAa,CAAC,UAAU,GAAG,KAAK;IAC9C,QAAQ,GAAG,SAAS,CAAC;IACrB,IAAI,UAAU,EAAE,CAAC;QACf,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IAClC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-trust",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Trust verification CLI for AI packages — check MCP servers, A2A agents, and AI tools before you install",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"author": "OpenA2A",
|
|
38
38
|
"license": "Apache-2.0",
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@opena2a/contribute": "^0.1.0",
|
|
40
41
|
"@opena2a/shared": "^0.1.0",
|
|
41
42
|
"chalk": "^5.3.0",
|
|
42
43
|
"commander": "^12.1.0"
|