@soverenia/agent-guard 1.0.0 → 1.0.2
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/dist/index.d.ts +3 -1
- package/dist/index.js +22 -5
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export interface McpTransport {
|
|
|
12
12
|
}>>;
|
|
13
13
|
}
|
|
14
14
|
export declare class HttpMcpTransport implements McpTransport {
|
|
15
|
+
constructor(baseUrl?: string, apiKey?: string);
|
|
15
16
|
private baseUrl;
|
|
16
17
|
private apiKey;
|
|
17
|
-
constructor(baseUrl: string, apiKey?: string);
|
|
18
18
|
/** Anti-replay (REQ-122): každý request fresh timestamp + unikátní nonce + Bearer key */
|
|
19
19
|
private headers;
|
|
20
20
|
listTools(): Promise<{
|
|
@@ -46,6 +46,8 @@ export declare class AgentGuard {
|
|
|
46
46
|
*/
|
|
47
47
|
setAiSummary(summary: string): void;
|
|
48
48
|
getLocalContext(): LocalContext;
|
|
49
|
+
/** Lokální Ed25519 verifikace podpisu proti veřejnému JWKS (REQ-062) */
|
|
50
|
+
verify(res: Pick<CheckPackageResponse, "authoritative" | "signature" | "key_id">): Promise<boolean>;
|
|
49
51
|
/**
|
|
50
52
|
* Sestaví finální odpověď pro vývojáře: authoritative (frozen) + lokální kontext agenta
|
|
51
53
|
*/
|
package/dist/index.js
CHANGED
|
@@ -5,14 +5,27 @@
|
|
|
5
5
|
// NIKDY nemůže měnit authoritative blok — ani přes typy, ani přes API.
|
|
6
6
|
// Typy to vynucují: AuthoritativeBlock je readonly, response je frozen.
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
import { homedir } from "node:os";
|
|
11
|
+
// Konfigurace: 1) SOVEREENIA_API_KEY env, 2) ~/.soverenia.json {"apiKey":"sov_…","baseUrl":"…"}
|
|
12
|
+
function loadConfig() {
|
|
13
|
+
try {
|
|
14
|
+
const cfg = JSON.parse(readFileSync(join(homedir(), ".soverenia.json"), "utf8"));
|
|
15
|
+
return { apiKey: typeof cfg.apiKey === "string" ? cfg.apiKey : "", baseUrl: typeof cfg.baseUrl === "string" ? cfg.baseUrl : undefined };
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return { apiKey: "" };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
8
21
|
export class HttpMcpTransport {
|
|
22
|
+
constructor(baseUrl, apiKey) {
|
|
23
|
+
const cfg = loadConfig();
|
|
24
|
+
this.baseUrl = (baseUrl ?? process.env.SOVEREENIA_BASE_URL ?? cfg.baseUrl ?? "https://www.soverenia.com").replace(/\/$/, "");
|
|
25
|
+
this.apiKey = apiKey ?? process.env.SOVEREENIA_API_KEY ?? cfg.apiKey;
|
|
26
|
+
}
|
|
9
27
|
baseUrl;
|
|
10
28
|
apiKey;
|
|
11
|
-
constructor(baseUrl, apiKey = process.env.SOVEREENIA_API_KEY ?? "") {
|
|
12
|
-
this.baseUrl = baseUrl;
|
|
13
|
-
this.apiKey = apiKey;
|
|
14
|
-
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
15
|
-
}
|
|
16
29
|
/** Anti-replay (REQ-122): každý request fresh timestamp + unikátní nonce + Bearer key */
|
|
17
30
|
headers() {
|
|
18
31
|
const h = { "Content-Type": "application/json" };
|
|
@@ -84,6 +97,10 @@ export class AgentGuard {
|
|
|
84
97
|
getLocalContext() {
|
|
85
98
|
return { ...this.localContext };
|
|
86
99
|
}
|
|
100
|
+
/** Lokální Ed25519 verifikace podpisu proti veřejnému JWKS (REQ-062) */
|
|
101
|
+
async verify(res) {
|
|
102
|
+
return verifyResponse(res, await fetchJwks(this.baseUrl));
|
|
103
|
+
}
|
|
87
104
|
/**
|
|
88
105
|
* Sestaví finální odpověď pro vývojáře: authoritative (frozen) + lokální kontext agenta
|
|
89
106
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soverenia/agent-guard",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Agent Guard for Soverenia
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Agent Guard for Soverenia \u2014 deterministic SAFE/UPGRADE/AVOID verdicts for every package your AI agent installs (MCP stdio server + SDK + lockfile scanner)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|