@atbash/cli 0.5.15-dev.8 → 0.6.0-dev.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 +287 -26
- package/dist/bin/atbash.js +31 -5
- package/dist/bin/atbash.js.map +1 -1
- package/dist/commands/connect.d.ts +40 -50
- package/dist/commands/connect.js +60 -108
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/github-scan.d.ts +104 -0
- package/dist/commands/github-scan.js +1054 -0
- package/dist/commands/github-scan.js.map +1 -0
- package/dist/commands/held.js +7 -2
- package/dist/commands/held.js.map +1 -1
- package/dist/commands/history.js +4 -1
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/judge-options.d.ts +21 -0
- package/dist/commands/judge-options.js +24 -0
- package/dist/commands/judge-options.js.map +1 -0
- package/dist/commands/judge.js +4 -1
- package/dist/commands/judge.js.map +1 -1
- package/dist/commands/policy.js +4 -1
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/scan.d.ts +45 -0
- package/dist/commands/scan.js +301 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/setup.d.ts +1 -209
- package/dist/commands/setup.js +128 -947
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/stats.js +3 -1
- package/dist/commands/stats.js.map +1 -1
- package/dist/commands/status.js +4 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/tier.js +4 -1
- package/dist/commands/tier.js.map +1 -1
- package/dist/commands/tools.js +11 -4
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/whoami.js +4 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/lib/grade-llm.d.ts +38 -0
- package/dist/lib/grade-llm.js +64 -0
- package/dist/lib/grade-llm.js.map +1 -0
- package/dist/lib/llm.d.ts +34 -0
- package/dist/lib/llm.js +101 -0
- package/dist/lib/llm.js.map +1 -0
- package/dist/lib/policy.d.ts +40 -0
- package/dist/lib/policy.js +94 -0
- package/dist/lib/policy.js.map +1 -0
- package/dist/lib/risk.d.ts +112 -0
- package/dist/lib/risk.js +288 -0
- package/dist/lib/risk.js.map +1 -0
- package/dist/lib/threats-llm.d.ts +39 -0
- package/dist/lib/threats-llm.js +72 -0
- package/dist/lib/threats-llm.js.map +1 -0
- package/package.json +4 -4
- package/dist/commands/mcp-cmd.d.ts +0 -13
- package/dist/commands/mcp-cmd.js +0 -216
- package/dist/commands/mcp-cmd.js.map +0 -1
- package/dist/shared/atbash-targets.d.ts +0 -49
- package/dist/shared/atbash-targets.js +0 -63
- package/dist/shared/atbash-targets.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk.js","sourceRoot":"","sources":["../../src/lib/risk.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;;;AAmBH,0BAEC;AAoID,gDAEC;AAqED,wCAiBC;AAGD,gCAOC;AAmBD,wDA4BC;AAhSD;;;;;;;;GAQG;AACH,SAAgB,OAAO,CAAC,MAA0B,EAAE,IAAY;IAC9D,OAAO,GAAG,MAAM,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;AACpC,CAAC;AAmCD,oEAAoE;AACpE,gEAAgE;AAChE,EAAE;AACF,+EAA+E;AAC/E,iFAAiF;AACjF,iFAAiF;AACjF,kFAAkF;AAClF,8EAA8E;AAC9E,4EAA4E;AAC5E,iFAAiF;AACjF,6EAA6E;AAC7E,oFAAoF;AACpF,MAAM,KAAK,GAAW;IACpB;QACE,IAAI,EAAE,4HAA4H;QAClI,QAAQ,EAAE,iCAAiC;QAC3C,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,4DAA4D;KAC1E;IACD;QACE,IAAI,EAAE,mFAAmF;QACzF,QAAQ,EAAE,oBAAoB;QAC9B,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,uCAAuC;KACrD;IACD;QACE,IAAI,EAAE,sG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C,CAAC,MAAM,KAAK,QAAQ;gBACnB,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,MAAM,KAAK,KAAK;oBAChB,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,SAAS,CAAC;QACpB,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC3B,MAAM,EAAE,CAAC;QACT,OAAO;YACL,GAAG,IAAI;YACP,QAAQ;YACR,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,QAAQ;YACpD,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,WAAW;SACtD,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAC3B,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional LLM pass enumerating CROSS-TOOL threat chains.
|
|
3
|
+
*
|
|
4
|
+
* The deterministic engine grades one tool at a time, which is exactly what it
|
|
5
|
+
* can defend: a rule sees a name and a description. It cannot see that "read CRM"
|
|
6
|
+
* plus "send email" is an exfiltration path, because neither tool is dangerous
|
|
7
|
+
* alone. That combination is what this pass is for, and it is the analysis Koray
|
|
8
|
+
* described the hosted backend as doing.
|
|
9
|
+
*
|
|
10
|
+
* ADDITIVE ONLY. Threats never replace the deterministic paths and never move the
|
|
11
|
+
* risk score: the score gates CI through --fail-on, and a number that moved
|
|
12
|
+
* because a model phrased things differently this run would make that gate flaky.
|
|
13
|
+
* The dashboard rescores on threats; a terminal that exits non-zero must not.
|
|
14
|
+
*
|
|
15
|
+
* Spends the user's own key. One request, bounded, hard timeout; any failure
|
|
16
|
+
* returns no threats and the scan keeps its deterministic report.
|
|
17
|
+
*/
|
|
18
|
+
import type { ScanTool, Severity, Verdict } from "./risk";
|
|
19
|
+
export interface Threat {
|
|
20
|
+
/** The bad OUTCOME in plain English, not a tool name. */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Which capabilities combine to enable it, e.g. "CRM read + browser". */
|
|
23
|
+
enabledBy?: string;
|
|
24
|
+
category: string;
|
|
25
|
+
severity: Severity;
|
|
26
|
+
recommendedVerdict: Verdict;
|
|
27
|
+
consequence: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ThreatOutcome {
|
|
30
|
+
threats: Threat[];
|
|
31
|
+
requests: number;
|
|
32
|
+
skipped: number;
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function deriveThreats(tools: ScanTool[], options: {
|
|
36
|
+
apiKey: string;
|
|
37
|
+
model?: string;
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
}): Promise<ThreatOutcome>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveThreats = deriveThreats;
|
|
4
|
+
const llm_1 = require("./llm");
|
|
5
|
+
/** Matches the dashboard's ceiling, so the two passes see the same surface. */
|
|
6
|
+
const MAX_TOOLS = 200;
|
|
7
|
+
const DESC_CAP = 240;
|
|
8
|
+
const SYSTEM_PROMPT = `You are an AI-agent security analyst. Given an agent's tools, enumerate the most consequential risk paths — including CROSS-TOOL chains (e.g. read sensitive data + external send = exfiltration).
|
|
9
|
+
|
|
10
|
+
Frame each as a THREAT a non-technical manager understands — the bad OUTCOME, not the tool name. Good titles: "Infer sensitive personal characteristics", "Leak CRM data into external tools", "Issue unauthorized or excessive refunds", "Weaken its own policy or authority". Bad titles: raw tool names like "deletePet".
|
|
11
|
+
|
|
12
|
+
Return ONLY a JSON object of the form {"threats":[ ... ]}, no prose. Each entry:
|
|
13
|
+
{"title":"<the threat, plain English>","enabledBy":"<which capabilities enable it, e.g. 'CRM read + browser'>","category":"<one category from the list below>","severity":"low|medium|high","recommendedVerdict":"allow|hold|block|jail","consequence":"<concrete harm in plain words>"}
|
|
14
|
+
|
|
15
|
+
"category" MUST be EXACTLY one of these protection categories (pick the closest):
|
|
16
|
+
Financial, Communication, File system, Code execution, Network & web, Accounts & identity, Calendar, Self-modification, Cross-agent, Behavioral anomaly.
|
|
17
|
+
|
|
18
|
+
Rules:
|
|
19
|
+
- recommendedVerdict: block = must never run; jail = attempts to weaken its own authority; hold = needs human approval; allow = low-consequence.
|
|
20
|
+
- Judge the exposure the tools ALLOW, not intent. Never invent capabilities not implied by the tools.
|
|
21
|
+
- Return AT MOST 6 entries, the most consequential ones. Fewer is better than padding with near-duplicates.
|
|
22
|
+
- Keep every field short: "title" at most 8 words, "consequence" at most 15 words, "enabledBy" at most 8 words. Do not restate the title in the consequence.`;
|
|
23
|
+
const SEVERITIES = ["low", "medium", "high"];
|
|
24
|
+
const VERDICTS = ["allow", "hold", "block", "jail"];
|
|
25
|
+
async function deriveThreats(tools, options) {
|
|
26
|
+
const batch = tools.slice(0, MAX_TOOLS);
|
|
27
|
+
const skipped = Math.max(0, tools.length - batch.length);
|
|
28
|
+
if (batch.length === 0)
|
|
29
|
+
return { threats: [], requests: 0, skipped: 0 };
|
|
30
|
+
const catalog = batch.map((t) => ({ name: t.name, description: (t.description ?? "").slice(0, DESC_CAP) }));
|
|
31
|
+
const res = await (0, llm_1.chatJson)({
|
|
32
|
+
apiKey: options.apiKey,
|
|
33
|
+
model: options.model,
|
|
34
|
+
timeoutMs: options.timeoutMs,
|
|
35
|
+
system: SYSTEM_PROMPT,
|
|
36
|
+
user: JSON.stringify(catalog),
|
|
37
|
+
maxTokens: 2000,
|
|
38
|
+
});
|
|
39
|
+
if (!res.data)
|
|
40
|
+
return { threats: [], requests: res.requests, skipped, error: res.error };
|
|
41
|
+
// Accept the {"threats":[...]} wrapper or a bare array, since models drop the
|
|
42
|
+
// wrapper often enough that rejecting it would lose whole runs.
|
|
43
|
+
const raw = Array.isArray(res.data)
|
|
44
|
+
? res.data
|
|
45
|
+
: Array.isArray(res.data.threats)
|
|
46
|
+
? (res.data.threats)
|
|
47
|
+
: [];
|
|
48
|
+
const threats = [];
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
for (const entry of raw) {
|
|
51
|
+
if (!entry || typeof entry !== "object")
|
|
52
|
+
continue;
|
|
53
|
+
const p = entry;
|
|
54
|
+
const title = (0, llm_1.coerceStr)(p.title, 140).trim();
|
|
55
|
+
if (!title || seen.has(title.toLowerCase()))
|
|
56
|
+
continue;
|
|
57
|
+
seen.add(title.toLowerCase());
|
|
58
|
+
const severity = SEVERITIES.find((s) => s === (0, llm_1.coerceStr)(p.severity, 12).trim().toLowerCase()) ?? "medium";
|
|
59
|
+
const verdict = VERDICTS.find((v) => v === (0, llm_1.coerceStr)(p.recommendedVerdict, 12).trim().toLowerCase()) ?? "hold";
|
|
60
|
+
const enabledBy = (0, llm_1.coerceStr)(p.enabledBy, 140).trim();
|
|
61
|
+
threats.push({
|
|
62
|
+
title,
|
|
63
|
+
...(enabledBy ? { enabledBy } : {}),
|
|
64
|
+
category: (0, llm_1.coerceStr)(p.category, 60).trim() || "Behavioral anomaly",
|
|
65
|
+
severity,
|
|
66
|
+
recommendedVerdict: verdict,
|
|
67
|
+
consequence: (0, llm_1.coerceStr)(p.consequence, 200).trim(),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return { threats, requests: res.requests, skipped };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=threats-llm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threats-llm.js","sourceRoot":"","sources":["../../src/lib/threats-llm.ts"],"names":[],"mappings":";;AA6DA,sCAgDC;AA3FD,+BAA4C;AAE5C,+EAA+E;AAC/E,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,QAAQ,GAAG,GAAG,CAAC;AAoBrB,MAAM,aAAa,GAAG;;;;;;;;;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WAAW,EAAE,CAAC,IAAI,MAAM,CAAC;QAC/G,MAAM,SAAS,GAAG,IAAA,eAAS,EAAC,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC;YACX,KAAK;YACL,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnC,QAAQ,EAAE,IAAA,eAAS,EAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,oBAAoB;YAClE,QAAQ;YACR,kBAAkB,EAAE,OAAO;YAC3B,WAAW,EAAE,IAAA,eAAS,EAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE;SAClD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;AACtD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atbash/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Atbash CLI
|
|
3
|
+
"version": "0.6.0-dev.1",
|
|
4
|
+
"description": "Atbash CLI — control boundary before the last irreversible step in an agent workflow",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://atbash.ai",
|
|
7
7
|
"repository": {
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
28
28
|
"build": "npm run clean && tsc",
|
|
29
|
-
"test": "node -
|
|
29
|
+
"test": "node scripts/run-tests.mjs",
|
|
30
30
|
"dev": "ts-node src/bin/atbash.ts",
|
|
31
31
|
"release": "npm version patch --no-git-tag-version && npm run build && npx npm@10 publish --access public",
|
|
32
32
|
"release:dev": "npm version prerelease --preid dev --no-git-tag-version && npm run build && npx npm@10 publish --tag dev --access public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atbash/sdk": "
|
|
35
|
+
"@atbash/sdk": "0.12.0-dev.0",
|
|
36
36
|
"@iarna/toml": "2.2.5",
|
|
37
37
|
"chalk": "^4.1.2",
|
|
38
38
|
"commander": "^12.0.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* Where the launcher gets the key, in order.
|
|
4
|
-
*
|
|
5
|
-
* An `ATBASH_AGENT_PRIVKEY` already in the environment wins, so an operator who
|
|
6
|
-
* deliberately injects the key at launch time keeps working exactly as before —
|
|
7
|
-
* this command adds a safer default, it does not take the existing path away.
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolveLauncherKey(keyPathOverride?: string): {
|
|
10
|
-
privkey: string;
|
|
11
|
-
from: string;
|
|
12
|
-
} | null;
|
|
13
|
-
export declare function registerMcpCommand(program: Command): void;
|
package/dist/commands/mcp-cmd.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.resolveLauncherKey = resolveLauncherKey;
|
|
37
|
-
exports.registerMcpCommand = registerMcpCommand;
|
|
38
|
-
const fs = __importStar(require("fs"));
|
|
39
|
-
const child_process_1 = require("child_process");
|
|
40
|
-
const sdk_1 = require("@atbash/sdk");
|
|
41
|
-
/**
|
|
42
|
-
* `atbash mcp` — run the Atbash MCP server without putting a private key in a
|
|
43
|
-
* config file.
|
|
44
|
-
*
|
|
45
|
-
* THE PROBLEM THIS SOLVES
|
|
46
|
-
*
|
|
47
|
-
* `@atbash/mcp` reads its agent identity from `ATBASH_AGENT_PRIVKEY` and has no
|
|
48
|
-
* key-file fallback (verified against the published 0.1.3). The documented wiring
|
|
49
|
-
* therefore asks the operator to paste a raw private key into their MCP client's
|
|
50
|
-
* own config:
|
|
51
|
-
*
|
|
52
|
-
* { "mcpServers": { "atbash": { "command": "npx", "args": ["-y", "@atbash/mcp"],
|
|
53
|
-
* "env": { "ATBASH_AGENT_PRIVKEY": "<the key>" } } } }
|
|
54
|
-
*
|
|
55
|
-
* That file is `claude_desktop_config.json` and its equivalents — files people
|
|
56
|
-
* sync between machines, paste into issues, and screenshot when asking for help.
|
|
57
|
-
* It made "wire up MCP for me" impossible to automate honestly: the automation's
|
|
58
|
-
* whole job would have been to plant a secret somewhere worse than where it
|
|
59
|
-
* already was.
|
|
60
|
-
*
|
|
61
|
-
* This command is the indirection that removes the problem. The client spawns
|
|
62
|
-
* `atbash mcp`, which reads the key from the 0600 file Atbash already manages and
|
|
63
|
-
* passes it to the server through the CHILD PROCESS ENVIRONMENT ONLY. Nothing
|
|
64
|
-
* secret is ever written to a config file, so the client entry is:
|
|
65
|
-
*
|
|
66
|
-
* { "mcpServers": { "atbash": { "command": "npx", "args": ["-y", "@atbash/cli", "mcp"] } } }
|
|
67
|
-
*
|
|
68
|
-
* — which contains no credential at all, and is safe for `atbash setup` to write.
|
|
69
|
-
*
|
|
70
|
-
* STDOUT IS THE PROTOCOL. MCP speaks JSON-RPC over stdio, so a single stray
|
|
71
|
-
* `console.log` here corrupts the stream and the client reports a broken server.
|
|
72
|
-
* Every diagnostic in this file goes to stderr. Do not change that.
|
|
73
|
-
*/
|
|
74
|
-
/**
|
|
75
|
-
* The server this launcher runs, and the SDK it is run WITH.
|
|
76
|
-
*
|
|
77
|
-
* ⚠️ BOTH PINS ARE LOAD-BEARING. DO NOT LOOSEN THEM.
|
|
78
|
-
*
|
|
79
|
-
* `@atbash/mcp` declares `@atbash/sdk: ^0.3.19` and imports `getOrgTierInfo` as a
|
|
80
|
-
* named export. `@atbash/sdk@0.3.24` REMOVED that export, so `^0.3.19` now
|
|
81
|
-
* resolves to 0.3.25 and the server dies at import time:
|
|
82
|
-
*
|
|
83
|
-
* SyntaxError: The requested module '@atbash/sdk' does not provide an
|
|
84
|
-
* export named 'getOrgTierInfo'
|
|
85
|
-
*
|
|
86
|
-
* That breaks EVERY published `@atbash/mcp` (0.1.0 through 0.1.3) — a plain
|
|
87
|
-
* `npm install @atbash/mcp` cannot start at all, which is why the documented
|
|
88
|
-
* hand-wiring produces a client reporting a failed server. Naming an SDK version
|
|
89
|
-
* from before the removal is what makes it run; 0.3.23 is the newest that works.
|
|
90
|
-
*
|
|
91
|
-
* ⚠️ AND THE PIN ITSELF IS A STOPGAP. `@atbash/sdk@0.3.23` is DEPRECATED:
|
|
92
|
-
*
|
|
93
|
-
* npm warn deprecated @atbash/sdk@0.3.23: Old architecture with legacy chain
|
|
94
|
-
* structure. Please upgrade to stable version @atbash/sdk@^0.5.0
|
|
95
|
-
*
|
|
96
|
-
* So this runs the MCP server on a legacy chain architecture. It is verified to
|
|
97
|
-
* work — a real `atbash_check_agent` tool call round-trips against the live
|
|
98
|
-
* deployment and returns the correct answer — but it is the newest thing that
|
|
99
|
-
* works, not a thing that is right.
|
|
100
|
-
*
|
|
101
|
-
* THE REAL FIX is republishing `@atbash/mcp` against `@atbash/sdk@^0.7`, which
|
|
102
|
-
* moves `getOrgTierInfo` onto the `Atbash` class rather than exporting it. Until
|
|
103
|
-
* that ships, this pin is the only thing between an operator and a dead MCP
|
|
104
|
-
* server, so treat a "dependency update" here as a regression unless the
|
|
105
|
-
* republished package is verified to both START and serve a tool call.
|
|
106
|
-
*
|
|
107
|
-
* Cold start is ~12s while npx populates its cache, ~1s warm. A client with a
|
|
108
|
-
* short startup timeout may fail its very first launch and succeed on retry.
|
|
109
|
-
*/
|
|
110
|
-
const MCP_PKG = "@atbash/mcp";
|
|
111
|
-
const MCP_VERSION = "0.1.3";
|
|
112
|
-
const MCP_SDK_VERSION = "0.3.23";
|
|
113
|
-
/** Read `privkey=` out of the agent key file, or null if it is not usable. */
|
|
114
|
-
function privkeyFromKeyFile(keyPath) {
|
|
115
|
-
let text;
|
|
116
|
-
try {
|
|
117
|
-
text = fs.readFileSync(keyPath, "utf8");
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
if (text.trim().startsWith("{")) {
|
|
123
|
-
try {
|
|
124
|
-
const o = JSON.parse(text);
|
|
125
|
-
const value = String(o.privKey ?? o.privkey ?? o.privateKey ?? "").replace(/^0x/i, "").trim();
|
|
126
|
-
return /^[0-9a-fA-F]{64}$/.test(value) ? value.toLowerCase() : null;
|
|
127
|
-
}
|
|
128
|
-
catch {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
for (const line of text.split(/\r?\n/)) {
|
|
133
|
-
const match = line.trim().match(/^privkey\s*[:=]\s*(.+)$/i);
|
|
134
|
-
if (match) {
|
|
135
|
-
const value = match[1].replace(/^0x/i, "").trim();
|
|
136
|
-
if (/^[0-9a-fA-F]{64}$/.test(value))
|
|
137
|
-
return value.toLowerCase();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Where the launcher gets the key, in order.
|
|
144
|
-
*
|
|
145
|
-
* An `ATBASH_AGENT_PRIVKEY` already in the environment wins, so an operator who
|
|
146
|
-
* deliberately injects the key at launch time keeps working exactly as before —
|
|
147
|
-
* this command adds a safer default, it does not take the existing path away.
|
|
148
|
-
*/
|
|
149
|
-
function resolveLauncherKey(keyPathOverride) {
|
|
150
|
-
const fromEnv = process.env.ATBASH_AGENT_PRIVKEY?.replace(/^0x/i, "").trim();
|
|
151
|
-
if (fromEnv && /^[0-9a-fA-F]{64}$/.test(fromEnv))
|
|
152
|
-
return { privkey: fromEnv.toLowerCase(), from: "ATBASH_AGENT_PRIVKEY" };
|
|
153
|
-
const keyPath = (0, sdk_1.resolveKeyPath)(keyPathOverride);
|
|
154
|
-
const fromFile = privkeyFromKeyFile(keyPath);
|
|
155
|
-
if (fromFile)
|
|
156
|
-
return { privkey: fromFile, from: keyPath };
|
|
157
|
-
const fromConfig = (0, sdk_1.loadUserConfig)().agentKey?.replace(/^0x/i, "").trim();
|
|
158
|
-
if (fromConfig && /^[0-9a-fA-F]{64}$/.test(fromConfig))
|
|
159
|
-
return { privkey: fromConfig.toLowerCase(), from: "atbash config" };
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
function registerMcpCommand(program) {
|
|
163
|
-
program
|
|
164
|
-
.command("mcp")
|
|
165
|
-
.description("Run the Atbash MCP server, reading the agent key from ~/.config/atbash/guard-client-key instead of a config file (used as the `command` in an MCP client's server list)")
|
|
166
|
-
.option("--key-file <path>", "Agent key file to read (default: ~/.config/atbash/guard-client-key)")
|
|
167
|
-
.option("--endpoint <url>", "Atbash endpoint the server should use")
|
|
168
|
-
.action((opts) => {
|
|
169
|
-
const resolved = resolveLauncherKey(opts.keyFile);
|
|
170
|
-
if (!resolved) {
|
|
171
|
-
// stderr: stdout belongs to the JSON-RPC stream.
|
|
172
|
-
process.stderr.write("atbash mcp: no agent key found.\n" +
|
|
173
|
-
`Looked at ATBASH_AGENT_PRIVKEY, ${(0, sdk_1.resolveKeyPath)(opts.keyFile)}, and the atbash config.\n` +
|
|
174
|
-
"Run `atbash setup` on this machine first, or pass --key-file.\n");
|
|
175
|
-
process.exit(1);
|
|
176
|
-
}
|
|
177
|
-
const endpoint = opts.endpoint || process.env.ATBASH_ENDPOINT;
|
|
178
|
-
// The key goes to the CHILD ONLY. It is never written to disk here and
|
|
179
|
-
// never echoed — the parent's own environment is left untouched.
|
|
180
|
-
const env = {
|
|
181
|
-
...process.env,
|
|
182
|
-
ATBASH_AGENT_PRIVKEY: resolved.privkey,
|
|
183
|
-
...(endpoint ? { ATBASH_ENDPOINT: endpoint } : {}),
|
|
184
|
-
};
|
|
185
|
-
// Both packages are placed in ONE npx tree so the compatible SDK sits at its
|
|
186
|
-
// root and satisfies @atbash/mcp's own `^0.3.19` range — which is what stops
|
|
187
|
-
// npm installing the broken 0.3.25 underneath it. Installing @atbash/mcp
|
|
188
|
-
// alone (as a dependency of this CLI, or via a bare npx) reintroduces the
|
|
189
|
-
// crash, so this shape is deliberate, not incidental.
|
|
190
|
-
const command = "npx";
|
|
191
|
-
const args = [
|
|
192
|
-
"--yes",
|
|
193
|
-
"-p", `${MCP_PKG}@${MCP_VERSION}`,
|
|
194
|
-
"-p", `@atbash/sdk@${MCP_SDK_VERSION}`,
|
|
195
|
-
"atbash-mcp",
|
|
196
|
-
];
|
|
197
|
-
process.stderr.write(`atbash mcp: starting ${MCP_PKG}@${MCP_VERSION} with @atbash/sdk@${MCP_SDK_VERSION} (key from ${resolved.from})\n`);
|
|
198
|
-
// stdio inherit: the server talks JSON-RPC directly to the client that
|
|
199
|
-
// spawned us. Proxying it through here would add a failure point for no gain.
|
|
200
|
-
const child = (0, child_process_1.spawn)(command, args, { env, stdio: "inherit", shell: false });
|
|
201
|
-
child.on("error", (err) => {
|
|
202
|
-
process.stderr.write(`atbash mcp: could not start ${MCP_PKG}: ${err.message}\n`);
|
|
203
|
-
process.exit(1);
|
|
204
|
-
});
|
|
205
|
-
// Forward termination so the client's own shutdown reaches the server
|
|
206
|
-
// rather than orphaning it.
|
|
207
|
-
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
208
|
-
process.on(signal, () => { if (!child.killed)
|
|
209
|
-
child.kill(signal); });
|
|
210
|
-
}
|
|
211
|
-
child.on("exit", (code, signal) => {
|
|
212
|
-
process.exit(signal ? 1 : (code ?? 0));
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
//# sourceMappingURL=mcp-cmd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-cmd.js","sourceRoot":"","sources":["../../src/commands/mcp-cmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2GA,gDAYC;AAED,gDA6DC;AAtLD,uCAAyB;AACzB,iDAAsC;AAEtC,qCAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,GAAG,aAAa,CAAC;AAC9B,MAAM,WAAW,G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CAAC,KAAK,CAAC,+BAA+B,OAAO,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC;YACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,sEAAsE;QACtE,4BAA4B;QAC5B,KAAK,MAAM,MAAM,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAU,EAAE,CAAC;YACpD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM;gBAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YAChC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Facts about WHERE Atbash lives — the deployments it trusts, and the on-disk
|
|
3
|
-
* locations it knows about.
|
|
4
|
-
*
|
|
5
|
-
* These are shared by the read-only connector (`atbash connect`) and the
|
|
6
|
-
* write-capable configurator (`atbash setup`). They live here rather than in
|
|
7
|
-
* either command because both must agree:
|
|
8
|
-
*
|
|
9
|
-
* - A host the connector will relay to must be a host setup will verify
|
|
10
|
-
* registration against. Two different allowlists would mean a deployment that
|
|
11
|
-
* can receive a scan but cannot confirm the agent it scanned.
|
|
12
|
-
* - A config path the scan reports must be a path setup can find. A client that
|
|
13
|
-
* shows up in the dashboard but not in `setup` reads as a bug in whichever of
|
|
14
|
-
* the two the operator happened to trust first.
|
|
15
|
-
*
|
|
16
|
-
* When they lived in connect.ts and setup imported them from there, a refactor of
|
|
17
|
-
* the connector could silently change the configurator's behaviour. Adding a
|
|
18
|
-
* client here updates both callers at once, which is the point.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Official Atbash deployments that legitimately serve the onboarding flow.
|
|
22
|
-
*
|
|
23
|
-
* The pairing screen builds `--host` from the page you opened, so every origin
|
|
24
|
-
* that can host onboarding must appear here. If production were missing, the real
|
|
25
|
-
* atbash.ai would be flagged "unrecognized destination" — a false alarm on the
|
|
26
|
-
* genuine article, which is worse than silence: it teaches people and agents to
|
|
27
|
-
* wave through the one warning that actually catches a swapped host.
|
|
28
|
-
*
|
|
29
|
-
* Matched on EXACT hostname, never a suffix — "atbash.ai.evil.com" must not pass.
|
|
30
|
-
* Deliberately not a *.vercel.app wildcard: that would bless anyone's preview.
|
|
31
|
-
*/
|
|
32
|
-
export declare const KNOWN_HOSTS: Set<string>;
|
|
33
|
-
/**
|
|
34
|
-
* Used when neither --host nor ATBASH_HOST is given. Still the dev deployment,
|
|
35
|
-
* because it is the one running the current connector API; switch this to
|
|
36
|
-
* https://atbash.ai once production serves it (KNOWN_HOSTS already allows it).
|
|
37
|
-
*/
|
|
38
|
-
export declare const DEFAULT_HOST = "https://chromia-verified-ai-dev-two.vercel.app";
|
|
39
|
-
/**
|
|
40
|
-
* MCP client config locations, relative to the user's home directory.
|
|
41
|
-
*
|
|
42
|
-
* Claude Code (`~/.claude.json`) and Codex (`~/.codex/config.toml`) are NOT here
|
|
43
|
-
* on purpose: each needs bespoke handling (per-project server maps, and TOML
|
|
44
|
-
* respectively) and both callers special-case them.
|
|
45
|
-
*/
|
|
46
|
-
export declare const MCP_CONFIGS: {
|
|
47
|
-
label: string;
|
|
48
|
-
segs: string[];
|
|
49
|
-
}[];
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Facts about WHERE Atbash lives — the deployments it trusts, and the on-disk
|
|
4
|
-
* locations it knows about.
|
|
5
|
-
*
|
|
6
|
-
* These are shared by the read-only connector (`atbash connect`) and the
|
|
7
|
-
* write-capable configurator (`atbash setup`). They live here rather than in
|
|
8
|
-
* either command because both must agree:
|
|
9
|
-
*
|
|
10
|
-
* - A host the connector will relay to must be a host setup will verify
|
|
11
|
-
* registration against. Two different allowlists would mean a deployment that
|
|
12
|
-
* can receive a scan but cannot confirm the agent it scanned.
|
|
13
|
-
* - A config path the scan reports must be a path setup can find. A client that
|
|
14
|
-
* shows up in the dashboard but not in `setup` reads as a bug in whichever of
|
|
15
|
-
* the two the operator happened to trust first.
|
|
16
|
-
*
|
|
17
|
-
* When they lived in connect.ts and setup imported them from there, a refactor of
|
|
18
|
-
* the connector could silently change the configurator's behaviour. Adding a
|
|
19
|
-
* client here updates both callers at once, which is the point.
|
|
20
|
-
*/
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.MCP_CONFIGS = exports.DEFAULT_HOST = exports.KNOWN_HOSTS = void 0;
|
|
23
|
-
/**
|
|
24
|
-
* Official Atbash deployments that legitimately serve the onboarding flow.
|
|
25
|
-
*
|
|
26
|
-
* The pairing screen builds `--host` from the page you opened, so every origin
|
|
27
|
-
* that can host onboarding must appear here. If production were missing, the real
|
|
28
|
-
* atbash.ai would be flagged "unrecognized destination" — a false alarm on the
|
|
29
|
-
* genuine article, which is worse than silence: it teaches people and agents to
|
|
30
|
-
* wave through the one warning that actually catches a swapped host.
|
|
31
|
-
*
|
|
32
|
-
* Matched on EXACT hostname, never a suffix — "atbash.ai.evil.com" must not pass.
|
|
33
|
-
* Deliberately not a *.vercel.app wildcard: that would bless anyone's preview.
|
|
34
|
-
*/
|
|
35
|
-
exports.KNOWN_HOSTS = new Set([
|
|
36
|
-
"atbash.ai",
|
|
37
|
-
"www.atbash.ai",
|
|
38
|
-
"chromia-verified-ai-dev-two.vercel.app",
|
|
39
|
-
"chromia-verified-ai-agent-scan.vercel.app",
|
|
40
|
-
]);
|
|
41
|
-
/**
|
|
42
|
-
* Used when neither --host nor ATBASH_HOST is given. Still the dev deployment,
|
|
43
|
-
* because it is the one running the current connector API; switch this to
|
|
44
|
-
* https://atbash.ai once production serves it (KNOWN_HOSTS already allows it).
|
|
45
|
-
*/
|
|
46
|
-
exports.DEFAULT_HOST = "https://chromia-verified-ai-dev-two.vercel.app";
|
|
47
|
-
/**
|
|
48
|
-
* MCP client config locations, relative to the user's home directory.
|
|
49
|
-
*
|
|
50
|
-
* Claude Code (`~/.claude.json`) and Codex (`~/.codex/config.toml`) are NOT here
|
|
51
|
-
* on purpose: each needs bespoke handling (per-project server maps, and TOML
|
|
52
|
-
* respectively) and both callers special-case them.
|
|
53
|
-
*/
|
|
54
|
-
exports.MCP_CONFIGS = [
|
|
55
|
-
{ label: "Claude Desktop", segs: ["Library", "Application Support", "Claude", "claude_desktop_config.json"] },
|
|
56
|
-
{ label: "Claude Desktop", segs: [".config", "Claude", "claude_desktop_config.json"] },
|
|
57
|
-
{ label: "Cursor", segs: [".cursor", "mcp.json"] },
|
|
58
|
-
{ label: "Windsurf", segs: [".codeium", "windsurf", "mcp_config.json"] },
|
|
59
|
-
{ label: "VS Code (MCP)", segs: [".vscode", "mcp.json"] },
|
|
60
|
-
{ label: "Gemini CLI", segs: [".gemini", "settings.json"] },
|
|
61
|
-
{ label: "Continue", segs: [".continue", "config.json"] },
|
|
62
|
-
];
|
|
63
|
-
//# sourceMappingURL=atbash-targets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"atbash-targets.js","sourceRoot":"","sources":["../../src/shared/atbash-targets.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH;;;;;;;;;;;GAWG;AACU,QAAA,WAAW,GAAG,IAAI,GAAG,CAAC;IACjC,WAAW;IACX,eAAe;IACf,wCAAwC;IACxC,2CAA2C;CAC5C,CAAC,CAAC;AAEH;;;;GAIG;AACU,QAAA,YAAY,GAAG,gDAAgD,CAAC;AAE7E;;;;;;GAMG;AACU,QAAA,WAAW,GAAwC;IAC9D,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B,CAAC,EAAE;IAC7G,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,4BAA4B,CAAC,EAAE;IACtF,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE;IAClD,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB,CAAC,EAAE;IACxE,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE;IACzD,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC,EAAE;IAC3D,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC,EAAE;CAC1D,CAAC"}
|