@atbash/sdk 0.7.2-dev.0 → 0.8.0

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 CHANGED
@@ -63,8 +63,8 @@ Two ways to create an agent:
63
63
 
64
64
  ```ts
65
65
  import { generateKeypair } from "@atbash/sdk";
66
- const { privKey, pubKey } = generateKeypair();
67
- console.log("Save this private key somewhere safe:", privKey);
66
+ const { priv_key, pub_key } = generateKeypair();
67
+ console.log("Save this private key somewhere safe:", priv_key);
68
68
  ```
69
69
 
70
70
  Paste the public key into the **Onboard agent** form on the dashboard, assign it to an org, and attach a policy pack before calling `judgeAction`.
@@ -111,8 +111,8 @@ Read-only methods that read from the Chromia blockchain and dashboard.
111
111
  | `getToolCallCount()` | Total number of tool calls on-chain |
112
112
  | `getToolCallFull(toolCallId)` | Full details of a single tool call |
113
113
  | `getOrgTierInfo(orgName)` | Check an org's tier and whether verdicts are enabled |
114
- | `getAgentDetail(pubkey)` | Get agent metadata (org, status, creation date) |
115
- | `getAgentPolicy(pubkey)` | Check the agent's policy pack and jail status |
114
+ | `getAgentDetail(pubkey, options?)` | Get agent metadata (org, status, creation date) |
115
+ | `getAgentPolicy(pubkey, options?)` | Check the agent's policy pack and jail status |
116
116
  | `getPendingHeldActions(orgName, maxCount)` | List actions waiting for operator approval |
117
117
  | `getHeldActionReviews(orgName, maxCount)` | List completed operator reviews |
118
118
  | `getSafetyStats()` | Chain-wide safety statistics |
@@ -142,12 +142,27 @@ const atbash = Atbash.fromConfig(); // reads env + config file
142
142
  | `agentKey` | `ATBASH_AGENT_KEY` |
143
143
  | `orgName` | `ATBASH_ORG_NAME` |
144
144
  | `judgeEndpoint` | `ATBASH_ENDPOINT` |
145
+ | `judgeVerifyPubKey` | `ATBASH_JUDGE_VERIFY_PUBKEY` (self-hosted judge response-signing key; selects the self-hosted policy) |
145
146
  | `blockchainRid` | `ATBASH_BLOCKCHAIN_RID` |
146
147
  | `provider` | `ATBASH_PROVIDER` |
147
148
  | `providerModel` | `ATBASH_PROVIDER_MODEL` |
148
149
 
149
150
  Persistent config helpers: `saveUserConfig(config)`, `loadUserConfig()`, `resolve(key, flagValue?)`, `getConfigPath()`.
150
151
 
152
+ ### Judge endpoint policy
153
+
154
+ Both `Atbash.fromConfig()` and the direct constructor validate the judge endpoint before any request is made. `new Atbash(privkey, { endpoint })` accepts only an `https://` allowlisted judge host, or a self-hosted judge when `verifyPubKey` is also given (the 66-hex response-signing key, which then verifies every judge response). Plaintext `http://` is accepted only for loopback (`localhost`, `127.0.0.1`, `::1`) local development. Anything else throws at construction, so a misconfigured or injected endpoint can no longer receive the agent's signed actions or return unsigned verdicts. `validateJudgeEndpoint(...)` exposes the same check.
155
+
156
+ Agent policy and detail reads can resolve the organization's active network, or
157
+ accept an explicit network override:
158
+
159
+ ```ts
160
+ await atbash.getAgentPolicy(atbash.pubkey, { orgName: "acme" });
161
+ await atbash.getAgentDetail(atbash.pubkey, {
162
+ chainOpts: { network: "private" },
163
+ });
164
+ ```
165
+
151
166
  ## Error handling
152
167
 
153
168
  The SDK throws standard `Error` objects. Known failure modes are enriched with a pointer to the dashboard page that fixes them: