@atbash/cli 0.3.9-dev.2 → 0.3.9-dev.21

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.
Files changed (41) hide show
  1. package/README.md +9 -7
  2. package/dist/bin/atbash.js +43 -7
  3. package/dist/bin/atbash.js.map +1 -1
  4. package/dist/commands/config-cmd.js +15 -1
  5. package/dist/commands/config-cmd.js.map +1 -1
  6. package/dist/commands/held.js +14 -10
  7. package/dist/commands/held.js.map +1 -1
  8. package/dist/commands/history.js +11 -1
  9. package/dist/commands/history.js.map +1 -1
  10. package/dist/commands/judge.js +25 -47
  11. package/dist/commands/judge.js.map +1 -1
  12. package/dist/commands/keygen.js +15 -8
  13. package/dist/commands/keygen.js.map +1 -1
  14. package/dist/commands/policy.js +8 -32
  15. package/dist/commands/policy.js.map +1 -1
  16. package/dist/commands/stats.js +2 -0
  17. package/dist/commands/stats.js.map +1 -1
  18. package/dist/commands/status.js +3 -1
  19. package/dist/commands/status.js.map +1 -1
  20. package/dist/commands/tier.js +16 -19
  21. package/dist/commands/tier.js.map +1 -1
  22. package/dist/commands/tools.js +15 -3
  23. package/dist/commands/tools.js.map +1 -1
  24. package/dist/commands/whoami.js +9 -4
  25. package/dist/commands/whoami.js.map +1 -1
  26. package/package.json +6 -4
  27. package/dist/client.d.ts +0 -118
  28. package/dist/client.js +0 -217
  29. package/dist/client.js.map +0 -1
  30. package/dist/commands/jail.d.ts +0 -6
  31. package/dist/commands/jail.js +0 -44
  32. package/dist/commands/jail.js.map +0 -1
  33. package/dist/commands/org.d.ts +0 -2
  34. package/dist/commands/org.js +0 -72
  35. package/dist/commands/org.js.map +0 -1
  36. package/dist/config.d.ts +0 -25
  37. package/dist/config.js +0 -94
  38. package/dist/config.js.map +0 -1
  39. package/dist/presets.d.ts +0 -14
  40. package/dist/presets.js +0 -73
  41. package/dist/presets.js.map +0 -1
package/dist/client.js DELETED
@@ -1,217 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_BLOCKCHAIN_RID = exports.DEFAULT_CHROMIA_NODE_URLS = exports.DEFAULT_ENDPOINT = void 0;
4
- exports.isValidPrivateKey = isValidPrivateKey;
5
- exports.derivePublicKey = derivePublicKey;
6
- exports.generateKeyPair = generateKeyPair;
7
- exports.toPubkeyHex = toPubkeyHex;
8
- exports.logToolCall = logToolCall;
9
- exports.judgeAction = judgeAction;
10
- exports.getJudgmentStatus = getJudgmentStatus;
11
- exports.getToolCalls = getToolCalls;
12
- exports.getOrgToolCalls = getOrgToolCalls;
13
- exports.getAgentToolCalls = getAgentToolCalls;
14
- exports.getToolCallCount = getToolCallCount;
15
- exports.getToolCallFull = getToolCallFull;
16
- exports.getOrgTierInfo = getOrgTierInfo;
17
- exports.getPendingHeldActions = getPendingHeldActions;
18
- exports.getHeldActionReviews = getHeldActionReviews;
19
- exports.getAgentDetail = getAgentDetail;
20
- exports.getAgentPolicy = getAgentPolicy;
21
- exports.getSafetyStats = getSafetyStats;
22
- const crypto_1 = require("crypto");
23
- const postchain_client_1 = require("postchain-client");
24
- exports.DEFAULT_ENDPOINT = "https://atbash.ai";
25
- exports.DEFAULT_CHROMIA_NODE_URLS = [
26
- "https://node6.testnet.chromia.com:7740",
27
- "https://node7.testnet.chromia.com:7740",
28
- "https://node8.testnet.chromia.com:7740",
29
- ];
30
- exports.DEFAULT_BLOCKCHAIN_RID = "25B41DF620C489349C54944496FF5C6E58CFCEFED0C51658780B67299D40E8ED";
31
- function isValidPrivateKey(hex) {
32
- return /^[0-9a-fA-F]{64}$/.test(hex);
33
- }
34
- function derivePublicKey(privKeyHex) {
35
- const ecdh = (0, crypto_1.createECDH)("secp256k1");
36
- ecdh.setPrivateKey(Buffer.from(privKeyHex, "hex"));
37
- return ecdh.getPublicKey("hex", "compressed");
38
- }
39
- function generateKeyPair() {
40
- const ecdh = (0, crypto_1.createECDH)("secp256k1");
41
- ecdh.generateKeys();
42
- return {
43
- privKey: ecdh.getPrivateKey("hex"),
44
- pubKey: ecdh.getPublicKey("hex", "compressed"),
45
- };
46
- }
47
- function toPubkeyHex(val) {
48
- if (!val)
49
- return "";
50
- if (typeof val === "string")
51
- return val;
52
- if (Buffer.isBuffer(val))
53
- return val.toString("hex");
54
- if (typeof val === "object" && val !== null && "data" in val) {
55
- return Buffer.from(val.data).toString("hex");
56
- }
57
- return "";
58
- }
59
- function baseUrl(opts) {
60
- return opts?.endpoint || exports.DEFAULT_ENDPOINT;
61
- }
62
- function generateToolCallId() {
63
- const ts = Date.now();
64
- const rand = (0, crypto_1.randomBytes)(4).toString("hex");
65
- return `tc-${ts}-${rand}`;
66
- }
67
- async function logToolCall(action, context, auth, extra, blockchainRid) {
68
- const rid = blockchainRid || exports.DEFAULT_BLOCKCHAIN_RID;
69
- const client = await (0, postchain_client_1.createClient)({
70
- nodeUrlPool: exports.DEFAULT_CHROMIA_NODE_URLS,
71
- blockchainRid: rid,
72
- });
73
- const privKeyBuf = Buffer.from(auth.privkey, "hex");
74
- const keyPair = postchain_client_1.encryption.makeKeyPair(privKeyBuf);
75
- const sigProvider = (0, postchain_client_1.newSignatureProvider)({
76
- privKey: keyPair.privKey,
77
- pubKey: keyPair.pubKey,
78
- });
79
- const toolCallId = generateToolCallId();
80
- await client.signAndSendUniqueTransaction({
81
- name: "log_tool_call",
82
- args: [
83
- toolCallId,
84
- action,
85
- context || "",
86
- extra?.toolName || "",
87
- extra?.toolArgsJson || "",
88
- ],
89
- }, sigProvider);
90
- return toolCallId;
91
- }
92
- async function postJson(url, body, opts) {
93
- const resp = await fetch(url, {
94
- method: "POST",
95
- headers: { "Content-Type": "application/json" },
96
- body: JSON.stringify(body),
97
- signal: opts?.timeout ? AbortSignal.timeout(opts.timeout) : undefined,
98
- });
99
- if (!resp.ok) {
100
- const text = await resp.text().catch(() => "");
101
- throw new Error(`API error ${resp.status}: ${text || resp.statusText}`);
102
- }
103
- const ct = resp.headers.get("content-type") || "";
104
- return ct.includes("application/json")
105
- ? resp.json()
106
- : {};
107
- }
108
- async function getJson(url, opts) {
109
- const resp = await fetch(url, {
110
- method: "GET",
111
- signal: opts?.timeout ? AbortSignal.timeout(opts.timeout) : undefined,
112
- });
113
- if (!resp.ok) {
114
- const text = await resp.text().catch(() => "");
115
- throw new Error(`API error ${resp.status}: ${text || resp.statusText}`);
116
- }
117
- return resp.json();
118
- }
119
- async function judgeAction(action, context, auth, opts) {
120
- // Step 1: Sign and broadcast log_tool_call to the Chromia chain.
121
- // The private key is used locally for signing — never sent over HTTP.
122
- const toolCallId = await logToolCall(action, context, auth, {
123
- toolName: opts?.toolName,
124
- toolArgsJson: opts?.toolArgsJson,
125
- }, opts?.blockchainRid);
126
- // Step 2: Request verdict from the judge API using only the tool_call_id.
127
- const url = `${baseUrl(opts)}/api/v1/judge`;
128
- const data = await postJson(url, {
129
- tool_call_id: toolCallId,
130
- agent_pubkey: auth.pubkey,
131
- action,
132
- context: context || "",
133
- provider: opts?.provider || "",
134
- tool_name: opts?.toolName || "",
135
- api_key: opts?.apiKey || "",
136
- endpoint_url: opts?.providerEndpoint || "",
137
- model: opts?.model || "",
138
- }, opts);
139
- return {
140
- verdict: String(data.verdict || "").toUpperCase(),
141
- action_type: String(data.action_type || ""),
142
- reason: String(data.reason || ""),
143
- confidence: Number(data.confidence ?? 0),
144
- provider: String(data.provider || ""),
145
- latency_ms: Number(data.latency_ms ?? 0),
146
- tool_call_id: String(data.tool_call_id || toolCallId),
147
- on_chain: Boolean(data.on_chain),
148
- };
149
- }
150
- async function getJudgmentStatus(judgmentId, opts) {
151
- const url = `${baseUrl(opts)}/api/v1/judge?tool_call_id=${encodeURIComponent(judgmentId)}`;
152
- const data = await getJson(url, opts);
153
- return {
154
- status: data.status || "error",
155
- verdict: String(data.verdict || ""),
156
- reason: String(data.reason || ""),
157
- judgmentId: String(data.judgmentId || judgmentId),
158
- onChain: Boolean(data.onChain),
159
- cached: Boolean(data.cached),
160
- responseTimeMs: Number(data.responseTimeMs ?? 0),
161
- };
162
- }
163
- function riskEngineUrl(action, params, opts) {
164
- const url = new URL(`${baseUrl(opts)}/api/risk-engine`);
165
- url.searchParams.set("action", action);
166
- for (const [k, v] of Object.entries(params)) {
167
- if (v)
168
- url.searchParams.set(k, v);
169
- }
170
- return url.toString();
171
- }
172
- async function getToolCalls(maxCount, opts) {
173
- return getJson(riskEngineUrl("tool-calls", { limit: String(maxCount) }, opts), opts);
174
- }
175
- async function getOrgToolCalls(orgName, maxCount, opts) {
176
- return getJson(riskEngineUrl("org-tool-calls", { org: orgName, limit: String(maxCount) }, opts), opts);
177
- }
178
- async function getAgentToolCalls(agentPubkey, maxCount, opts) {
179
- return getJson(riskEngineUrl("agent-tool-calls", { agent: agentPubkey, limit: String(maxCount) }, opts), opts);
180
- }
181
- async function getToolCallCount(opts) {
182
- const result = await getJson(riskEngineUrl("tool-call-count", {}, opts), opts);
183
- return typeof result === "number" ? result : Number(result ?? 0);
184
- }
185
- async function getToolCallFull(toolCallId, opts) {
186
- return getJson(riskEngineUrl("tool-call-full", { tool_call_id: toolCallId }, opts), opts);
187
- }
188
- async function getOrgTierInfo(orgName, opts) {
189
- return getJson(riskEngineUrl("org-tier-info", { org: orgName }, opts), opts);
190
- }
191
- async function getPendingHeldActions(orgName, maxCount, opts) {
192
- return getJson(riskEngineUrl("pending-held-actions", { org: orgName, limit: String(maxCount) }, opts), opts);
193
- }
194
- async function getHeldActionReviews(orgName, maxCount, opts) {
195
- return getJson(riskEngineUrl("held-action-reviews", { org: orgName, limit: String(maxCount) }, opts), opts);
196
- }
197
- function riskEnginePostUrl(opts) {
198
- return `${baseUrl(opts)}/api/risk-engine`;
199
- }
200
- async function getAgentDetail(agentPubkey, opts) {
201
- return postJson(riskEnginePostUrl(opts), {
202
- action: "agent-detail-batch",
203
- agent: agentPubkey,
204
- }, opts);
205
- }
206
- async function getAgentPolicy(agentPubkey, opts) {
207
- return postJson(riskEnginePostUrl(opts), {
208
- action: "agent-policy-batch",
209
- agent: agentPubkey,
210
- }, opts);
211
- }
212
- async function getSafetyStats(opts) {
213
- const url = `${baseUrl(opts)}/api/insurance?action=safety-stats`;
214
- const result = await getJson(url, opts);
215
- return (result?.data || result);
216
- }
217
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAcA,8CAEC;AAED,0CAIC;AAED,0CAOC;AAMD,kCAQC;AAiBD,kCAqCC;AAyHD,kCAyCC;AAED,8CAgBC;AAeD,oCAQC;AAED,0CAaC;AAED,8CAaC;AAED,4CAMC;AAED,0CAQC;AAED,wCAQC;AAED,sDAaC;AAED,oDAaC;AAMD,wCAYC;AAED,wCAiBC;AAED,wCAMC;AAnbD,mCAAiD;AACjD,uDAAkF;AAErE,QAAA,gBAAgB,GAC3B,mBAAmB,CAAC;AAET,QAAA,yBAAyB,GAAG;IACvC,wCAAwC;IACxC,wCAAwC;IACxC,wCAAwC;CACzC,CAAC;AACW,QAAA,sBAAsB,GACjC,kEAAkE,CAAC;AAErE,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,OAAO,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;AAED,SAAgB,eAAe,CAAC,UAAkB;IAChD,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,WAAW,CAAC,CAAC;IACrC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC;AAED,SAAgB,eAAe;IAC7B,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,WAAW,CAAC,CAAC;IACrC,IAAI,CAAC,YAAY,EAAE,CAAC;IACpB,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QAClC,MAAM,EAAE,IAAI,CAAC,YAAY,C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oBAAoB,CACxC,OAAe,EACf,QAAgB,EAChB,IAAiB;IAEjB,OAAO,OAAO,CACZ,aAAa,CACX,qBAAqB,EACrB,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,EACzC,IAAI,CACL,EACD,IAAI,CACL,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAiB;IAC1C,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC;AAC5C,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,WAAmB,EACnB,IAAiB;IAEjB,OAAO,QAAQ,CACb,iBAAiB,CAAC,IAAI,CAAC,EACvB;QACE,MAAM,EAAE,oBAAoB;QAC5B,KAAK,EAAE,WAAW;KACnB,EACD,IAAI,CACL,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,WAAmB,EACnB,IAAiB;IAOjB,OAAO,QAAQ,CACb,iBAAiB,CAAC,IAAI,CAAC,EACvB;QACE,MAAM,EAAE,oBAAoB;QAC5B,KAAK,EAAE,WAAW;KACnB,EACD,IAAI,CACL,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,IAAiB;IAEjB,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,oCAAoC,CAAC;IACjE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAqC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC5E,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,MAAM,CAA4B,CAAC;AAC7D,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * `atbash unjail` — Unjail an agent via POST /api/risk-engine action=unjail-agent.
3
- * Jail command removed — jailing happens automatically on RED verdict in Enforcement tier.
4
- */
5
- import { Command } from "commander";
6
- export declare function registerUnjailCommand(program: Command): void;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- /**
3
- * `atbash unjail` — Unjail an agent via POST /api/risk-engine action=unjail-agent.
4
- * Jail command removed — jailing happens automatically on RED verdict in Enforcement tier.
5
- */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.registerUnjailCommand = registerUnjailCommand;
11
- const chalk_1 = __importDefault(require("chalk"));
12
- const ora_1 = __importDefault(require("ora"));
13
- const client_1 = require("../client");
14
- const config_1 = require("../config");
15
- function registerUnjailCommand(program) {
16
- program
17
- .command("unjail")
18
- .description("Unjail an agent")
19
- .argument("<agent-pubkey>", "Agent public key to unjail (hex)")
20
- .option("--endpoint <url>", "API endpoint URL")
21
- .option("--json", "Output result as JSON")
22
- .action(async (agentPubkey, opts) => {
23
- const spinner = opts.json ? null : (0, ora_1.default)("Unjailing agent...").start();
24
- try {
25
- await (0, client_1.unjailAgent)(agentPubkey, {
26
- endpoint: (0, config_1.resolveEndpoint)(opts.endpoint),
27
- });
28
- spinner?.succeed("Agent unjailed");
29
- if (opts.json) {
30
- console.log(JSON.stringify({ agentPubkey, action: "unjailed" }, null, 2));
31
- return;
32
- }
33
- console.log();
34
- console.log(` Agent: ${chalk_1.default.dim(agentPubkey.slice(0, 8) + "..." + agentPubkey.slice(-6))}`);
35
- console.log(` Status: ${chalk_1.default.green.bold("ACTIVE")}`);
36
- }
37
- catch (err) {
38
- spinner?.fail("Failed to unjail agent");
39
- console.error(chalk_1.default.red(`\nError: ${err instanceof Error ? err.message : String(err)}`));
40
- process.exit(1);
41
- }
42
- });
43
- }
44
- //# sourceMappingURL=jail.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jail.js","sourceRoot":"","sources":["../../src/commands/jail.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAQH,sDA+BC;AApCD,kDAA0B;AAC1B,8CAAsB;AACtB,sCAAwC;AACxC,sCAA4C;AAE5C,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,QAAQ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AK,CAAC,eAAK,CAAC,GAAG,CAAC,YAAY,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,2 +0,0 @@
1
- import { Command } from "commander";
2
- export declare function registerOrgCommand(program: Command): void;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.registerOrgCommand = registerOrgCommand;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const ora_1 = __importDefault(require("ora"));
9
- const client_1 = require("../client");
10
- const config_1 = require("../config");
11
- function registerOrgCommand(program) {
12
- const org = program
13
- .command("org")
14
- .description("Manage org membership");
15
- org
16
- .command("join")
17
- .description("Add your agent to an org")
18
- .option("--org <name>", "Org name to join")
19
- .option("-k, --agent-key <key>", "Agent private key (to derive pubkey)")
20
- .option("--agent-pubkey <pubkey>", "Agent public key directly (66 hex chars)")
21
- .option("--endpoint <url>", "API endpoint URL")
22
- .option("--json", "Output result as JSON")
23
- .action(async (opts) => {
24
- const orgName = opts.org || (0, config_1.resolveOrgName)();
25
- if (!orgName) {
26
- console.error(chalk_1.default.red("Error: Org name required.\n") +
27
- "Provide via --org, ATBASH_ORG_NAME env var, or run " +
28
- chalk_1.default.cyan("atbash set org-name <name>"));
29
- process.exit(1);
30
- }
31
- let pubkey = opts.agentPubkey || "";
32
- if (!pubkey) {
33
- const agentKey = (0, config_1.resolveAgentKey)(opts.agentKey);
34
- if (!agentKey) {
35
- console.error(chalk_1.default.red("Error: Agent key or --agent-pubkey required.\n") +
36
- "Provide via --agent-key, --agent-pubkey, or run " +
37
- chalk_1.default.cyan("atbash set agent-key <key>"));
38
- process.exit(1);
39
- return;
40
- }
41
- const cleanKey = agentKey.replace(/^0x/, "").trim().toLowerCase();
42
- if (!(0, client_1.isValidPrivateKey)(cleanKey)) {
43
- console.error(chalk_1.default.red("Error: Invalid private key."));
44
- process.exit(1);
45
- }
46
- pubkey = (0, client_1.derivePublicKey)(cleanKey);
47
- }
48
- const spinner = opts.json
49
- ? null
50
- : (0, ora_1.default)(`Adding agent to ${orgName}...`).start();
51
- try {
52
- await (0, client_1.addAgentToOrg)(pubkey, orgName, {
53
- endpoint: (0, config_1.resolveEndpoint)(opts.endpoint),
54
- });
55
- spinner?.succeed(`Agent added to ${orgName}`);
56
- if (opts.json) {
57
- console.log(JSON.stringify({ agentPubkey: pubkey, orgName, status: "added" }, null, 2));
58
- return;
59
- }
60
- console.log();
61
- console.log(` Agent: ${chalk_1.default.cyan(pubkey)}`);
62
- console.log(` Org: ${chalk_1.default.white(orgName)}`);
63
- }
64
- catch (err) {
65
- spinner?.fail("Failed to add agent to org");
66
- const msg = err instanceof Error ? err.message : String(err);
67
- console.error(chalk_1.default.red(`\nError: ${err}`));
68
- process.exit(1);
69
- }
70
- });
71
- }
72
- //# sourceMappingURL=org.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"org.js","sourceRoot":"","sources":["../../src/commands/org.ts"],"names":[],"mappings":";;;;;AAMA,gDAyEC;AA9ED,kDAA0B;AAC1B,8CAAsB;AACtB,sCAA8E;AAC9E,sCAA6E;AAE7E,SAAgB,kBAAkB,CAAC,OAAgB;IACjD,MAAM,GAAG,GAAG,OAAO;SAChB,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAExC,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,0BAA0B,CAAC;SACvC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC;SAC1C,MAAM,CAAC,uBAAuB,EAAE,sCAAsC,CAAC;SACvE,MAAM,CA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C,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
package/dist/config.d.ts DELETED
@@ -1,25 +0,0 @@
1
- declare const CONFIG_FILE: string;
2
- export interface AtbashConfig {
3
- agentKey?: string;
4
- adminKey?: string;
5
- orgName?: string;
6
- judgeEndpoint?: string;
7
- blockchainRid?: string;
8
- provider?: string;
9
- providerApiKey?: string;
10
- providerEndpoint?: string;
11
- providerModel?: string;
12
- debug?: boolean;
13
- }
14
- export declare function loadConfig(): AtbashConfig;
15
- export declare function saveConfig(config: AtbashConfig): void;
16
- /** Resolve a config value with priority: flag > env > file */
17
- export declare function resolveAgentKey(flagValue?: string): string | undefined;
18
- export declare function resolveOrgName(flagValue?: string): string | undefined;
19
- export declare function resolveEndpoint(flagValue?: string): string | undefined;
20
- export declare function resolveProvider(flagValue?: string): string;
21
- export declare function resolveProviderApiKey(flagValue?: string): string;
22
- export declare function resolveProviderEndpoint(flagValue?: string): string;
23
- export declare function resolveProviderModel(flagValue?: string): string;
24
- export declare function resolveBlockchainRid(flagValue?: string): string;
25
- export { CONFIG_FILE };
package/dist/config.js DELETED
@@ -1,94 +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.CONFIG_FILE = void 0;
37
- exports.loadConfig = loadConfig;
38
- exports.saveConfig = saveConfig;
39
- exports.resolveAgentKey = resolveAgentKey;
40
- exports.resolveOrgName = resolveOrgName;
41
- exports.resolveEndpoint = resolveEndpoint;
42
- exports.resolveProvider = resolveProvider;
43
- exports.resolveProviderApiKey = resolveProviderApiKey;
44
- exports.resolveProviderEndpoint = resolveProviderEndpoint;
45
- exports.resolveProviderModel = resolveProviderModel;
46
- exports.resolveBlockchainRid = resolveBlockchainRid;
47
- const fs = __importStar(require("fs"));
48
- const path = __importStar(require("path"));
49
- const os = __importStar(require("os"));
50
- const CONFIG_FILE = path.join(os.homedir(), ".atbashrc.json");
51
- exports.CONFIG_FILE = CONFIG_FILE;
52
- function loadConfig() {
53
- try {
54
- if (fs.existsSync(CONFIG_FILE)) {
55
- const raw = fs.readFileSync(CONFIG_FILE, "utf-8");
56
- if (!raw.trim())
57
- return {};
58
- return JSON.parse(raw);
59
- }
60
- }
61
- catch (err) {
62
- console.error("Failed to load config file", err);
63
- }
64
- return {};
65
- }
66
- function saveConfig(config) {
67
- fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2) + "\n", "utf-8");
68
- }
69
- /** Resolve a config value with priority: flag > env > file */
70
- function resolveAgentKey(flagValue) {
71
- return flagValue || process.env.ATBASH_AGENT_KEY || loadConfig().agentKey;
72
- }
73
- function resolveOrgName(flagValue) {
74
- return flagValue || process.env.ATBASH_ORG_NAME || loadConfig().orgName;
75
- }
76
- function resolveEndpoint(flagValue) {
77
- return flagValue || process.env.ATBASH_ENDPOINT || loadConfig().judgeEndpoint;
78
- }
79
- function resolveProvider(flagValue) {
80
- return flagValue || process.env.ATBASH_PROVIDER || loadConfig().provider || "";
81
- }
82
- function resolveProviderApiKey(flagValue) {
83
- return flagValue || process.env.ATBASH_PROVIDER_API_KEY || loadConfig().providerApiKey || "";
84
- }
85
- function resolveProviderEndpoint(flagValue) {
86
- return flagValue || process.env.ATBASH_PROVIDER_ENDPOINT || loadConfig().providerEndpoint || "";
87
- }
88
- function resolveProviderModel(flagValue) {
89
- return flagValue || process.env.ATBASH_PROVIDER_MODEL || loadConfig().providerModel || "";
90
- }
91
- function resolveBlockchainRid(flagValue) {
92
- return flagValue || process.env.ATBASH_BLOCKCHAIN_RID || loadConfig().blockchainRid || "";
93
- }
94
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,gCAWC;AAED,gCAEC;AAGD,0CAEC;AAED,wCAEC;AAED,0CAEC;AAED,0CAEC;AAED,sDAEC;AAED,0DAEC;AAED,oDAEC;AAED,oDAEC;AAnED,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAiErD,kCAAW;AAlDpB,SAAgB,UAAU;IACxB,IAAI,CAAC;QACH,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAClD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;gBAAE,OAAO,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,KAAK,CAA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G,CAAC;AAED,SAAgB,oBAAoB,CAAC,SAAkB;IACrD,OAAO,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,UAAU,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC;AAC5F,CAAC;AAED,SAAgB,oBAAoB,CAAC,SAAkB;IACrD,OAAO,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,UAAU,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC;AAC5F,CAAC"}
package/dist/presets.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * Reference policy shapes for the Atbash CLI.
3
- *
4
- * These are reference packs — the starting points an operator might author
5
- * against. They match the format produced by the dashboard's
6
- * buildCompactPolicyText(). Production policies are authored, versioned, and
7
- * signed in the dashboard, not loaded from here.
8
- */
9
- export declare const PRESETS: Record<string, {
10
- name: string;
11
- description: string;
12
- policy: string;
13
- }>;
14
- export declare function listPresets(): string[];
package/dist/presets.js DELETED
@@ -1,73 +0,0 @@
1
- "use strict";
2
- /**
3
- * Reference policy shapes for the Atbash CLI.
4
- *
5
- * These are reference packs — the starting points an operator might author
6
- * against. They match the format produced by the dashboard's
7
- * buildCompactPolicyText(). Production policies are authored, versioned, and
8
- * signed in the dashboard, not loaded from here.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.PRESETS = void 0;
12
- exports.listPresets = listPresets;
13
- exports.PRESETS = {
14
- strict: {
15
- name: "Strict",
16
- description: "Reference shape for privileged-ops agents — blocks IAM elevation, credential export, and bulk exfil; holds every cross-border or over-threshold transfer",
17
- policy: `Agent Policy
18
- Risk: high
19
-
20
- Enabled rules:
21
- - [Financial] CRITICAL -> BLOCK when Transfers exceeding threshold to unwhitelisted addresses (threshold: $1,000) <!--f1-->
22
- - [Financial] HIGH -> HOLD when Cross-border transactions (threshold: All) <!--f2-->
23
- - [Financial] CRITICAL -> BLOCK when Cryptocurrency wallet transfers without 2FA confirmation (threshold: Any amount) <!--f3-->
24
- - [Financial] HIGH -> HOLD when Invoice generation or payment request above threshold (threshold: $5,000) <!--f5-->
25
- - [Financial] CRITICAL -> BLOCK when Access to payment gateway API keys or merchant credentials (threshold: Any) <!--f6-->
26
- - [Communication] HIGH -> BLOCK when Mass emails exceeding recipient threshold without approval (threshold: 50 recipients) <!--c2-->
27
- - [Communication] CRITICAL -> BLOCK when Outbound messages to domains on blocklist (threshold: Custom list) <!--c5-->
28
- - [Communication] CRITICAL -> BLOCK when Sending messages impersonating another user or agent (threshold: Any) <!--c7-->
29
- - [File system] CRITICAL -> BLOCK when Read/write to restricted directories (threshold: /etc, /var, ~/.ssh) <!--fs1-->
30
- - [File system] CRITICAL -> BLOCK when Access to credential or secret files (threshold: .env, config, secrets.*) <!--fs3-->
31
- - [Code execution] CRITICAL -> BLOCK when Elevated privilege commands (threshold: sudo, chmod, rm -rf) <!--ce1-->
32
- - [Code execution] CRITICAL -> BLOCK when Spawning reverse shells or outbound listeners (threshold: Any) <!--ce3-->
33
- - [Network] CRITICAL -> BLOCK when Connections to malicious or blacklisted domains (threshold: Threat intel feed) <!--nw1-->
34
- - [Network] CRITICAL -> BLOCK when Data exfiltration exceeding size (threshold: 10 MB) <!--nw4-->
35
- - [Accounts] CRITICAL -> BLOCK when Privilege escalation or admin scope requests (threshold: Any) <!--ai1-->
36
- - [Accounts] CRITICAL -> BLOCK when Password or credential reset attempts (threshold: Any) <!--ai4-->`,
37
- },
38
- moderate: {
39
- name: "Moderate",
40
- description: "Reference shape for business-ops agents — blocks clear red lines, holds mid-blast-radius actions for human review",
41
- policy: `Agent Policy
42
- Risk: medium
43
-
44
- Enabled rules:
45
- - [Financial] CRITICAL -> BLOCK when Transfers exceeding threshold to unwhitelisted addresses (threshold: $5,000) <!--f1-->
46
- - [Financial] HIGH -> HOLD when Cross-border transactions (threshold: All) <!--f2-->
47
- - [Financial] CRITICAL -> BLOCK when Cryptocurrency wallet transfers without 2FA (threshold: Any amount) <!--f3-->
48
- - [Financial] LOW -> PASS when Recurring payments to pre-approved vendors under threshold (threshold: $500) <!--f4-->
49
- - [Communication] MEDIUM -> HOLD when Emails to external domains with large attachments (threshold: 5 MB) <!--c1-->
50
- - [Communication] HIGH -> BLOCK when Mass emails exceeding recipient threshold (threshold: 50 recipients) <!--c2-->
51
- - [Communication] CRITICAL -> BLOCK when Outbound messages to domains on blocklist (threshold: Custom list) <!--c5-->
52
- - [Code execution] CRITICAL -> BLOCK when Elevated privilege commands (threshold: sudo, chmod, rm -rf) <!--ce1-->
53
- - [Code execution] CRITICAL -> BLOCK when Spawning reverse shells or outbound listeners (threshold: Any) <!--ce3-->
54
- - [Network] CRITICAL -> BLOCK when Connections to malicious or blacklisted domains (threshold: Threat intel feed) <!--nw1-->`,
55
- },
56
- minimal: {
57
- name: "Minimal",
58
- description: "Reference shape for audit-tier rollout — only the categorical red lines, intended for observation before enforcement is turned on",
59
- policy: `Agent Policy
60
- Risk: low
61
-
62
- Enabled rules:
63
- - [Financial] CRITICAL -> BLOCK when Transfers exceeding threshold to unwhitelisted addresses (threshold: $10,000) <!--f1-->
64
- - [Financial] CRITICAL -> BLOCK when Cryptocurrency wallet transfers without 2FA (threshold: Any amount) <!--f3-->
65
- - [Code execution] CRITICAL -> BLOCK when Spawning reverse shells or outbound listeners (threshold: Any) <!--ce3-->
66
- - [Network] CRITICAL -> BLOCK when Connections to malicious or blacklisted domains (threshold: Threat intel feed) <!--nw1-->
67
- - [Network] CRITICAL -> BLOCK when Data exfiltration exceeding size (threshold: 10 MB) <!--nw4-->`,
68
- },
69
- };
70
- function listPresets() {
71
- return Object.keys(exports.PRESETS);
72
- }
73
- //# sourceMappingURL=presets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"presets.js","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA8DH,kCAEC;AA9DY,QAAA,OAAO,GAA0E;IAC5F,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,0JAA0J;QACvK,MAAM,EAAE;;;;;;;;;;;;;;;;;;;sGAmB0F;KACnG;IAED,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,mHAAmH;QAChI,MAAM,EAAE;;;;;;;;;;;;;6HAaiH;KAC1H;IAED,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,mIAAmI;QAChJ,MAAM,EAAE;;;;;;;;kGAQsF;KAC/F;CACF,CAAC;AAEF,SAAgB,WAAW;IACzB,OAAO,MAAM,CAAC,IAAI,CAAC,eAAO,CAAC,CAAC;AAC9B,CAAC"}