@atbash/sdk 0.10.13-dev.0 → 0.11.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/LICENSE +202 -28
- package/NOTICE +10 -0
- package/README.md +172 -30
- package/THIRD-PARTY-NOTICES +10256 -0
- package/dist/browser.d.mts +695 -78
- package/dist/browser.mjs +1162 -635
- package/dist/index.d.mts +695 -78
- package/dist/index.d.ts +695 -78
- package/dist/index.js +2392 -41891
- package/dist/index.mjs +3205 -42740
- package/index.d.ts +56 -24
- package/index.js +177 -88
- package/package.json +18 -8
- package/dist/browser.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,28 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@atbash/sdk
|
|
2
|
+
Copyright 2026 Atbash Technologies Ltd.
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
Versions published before this change remain available under the license
|
|
6
|
+
they were released with.
|
|
7
|
+
|
|
8
|
+
This package bundles third-party components (the Rust crates in the native
|
|
9
|
+
addon and the npm packages inlined into dist/). They and their licenses are
|
|
10
|
+
listed in THIRD-PARTY-NOTICES.
|
package/README.md
CHANGED
|
@@ -29,18 +29,15 @@ const result = await atbash.judgeAction(
|
|
|
29
29
|
"Outbound AML check — new recipient, over threshold",
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
// 3.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
case "BLOCK":
|
|
42
|
-
// Refused — agent is jailed in Enforcement tier
|
|
43
|
-
throw new Error(`Blocked: ${result.reason}`);
|
|
32
|
+
// 3. Act on the decision. `allow` is the gate; `verdict` says why.
|
|
33
|
+
if (result.allow) {
|
|
34
|
+
// Proceed with the action
|
|
35
|
+
} else if (result.verdict === "HOLD") {
|
|
36
|
+
// Held — operator must approve in the dashboard
|
|
37
|
+
console.log("Held for review:", result.toolCallId);
|
|
38
|
+
} else {
|
|
39
|
+
// Refused — agent is jailed in Enforcement tier
|
|
40
|
+
throw new Error(`Blocked: ${result.reason}`);
|
|
44
41
|
}
|
|
45
42
|
```
|
|
46
43
|
|
|
@@ -63,15 +60,15 @@ Two ways to create an agent:
|
|
|
63
60
|
|
|
64
61
|
```ts
|
|
65
62
|
import { generateKeypair } from "@atbash/sdk";
|
|
66
|
-
const {
|
|
67
|
-
console.log("Save this private key somewhere safe:",
|
|
63
|
+
const { priv_key, pub_key } = generateKeypair();
|
|
64
|
+
console.log("Save this private key somewhere safe:", priv_key);
|
|
68
65
|
```
|
|
69
66
|
|
|
70
67
|
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`.
|
|
71
68
|
|
|
72
69
|
## Secret storage
|
|
73
70
|
|
|
74
|
-
-
|
|
71
|
+
- Keep the private key in the key file (`~/.config/atbash/guard-client-key`, or a file named by `keyPath`), in `ATBASH_AGENT_KEY`, or in a secret manager — never hardcode it. See [Which key signs](#which-key-signs).
|
|
75
72
|
- Never commit `.env` files containing the key.
|
|
76
73
|
- If a key leaks, stop using it and create a new agent in the dashboard.
|
|
77
74
|
|
|
@@ -85,6 +82,8 @@ Every `judgeAction` call returns one of three verdicts:
|
|
|
85
82
|
| `HOLD` | Requires operator review | Pause — poll `getJudgmentStatus` until resolved |
|
|
86
83
|
| `BLOCK` | Violates a red line | Abort — agent is jailed in Enforcement tier |
|
|
87
84
|
|
|
85
|
+
> **Gate on `allow`, not on `verdict`.** `allow` is the canonical permission the SDK computes from every signal in the response; `verdict` is one of those signals, and reads as the reason. The two differ when an organisation does not enforce an agent's verdicts — Shadow Mode on an agent, or org-wide Monitor mode — where the action is judged and recorded on chain but deliberately not applied. Branching on `verdict` re-derives a denial the organisation chose not to make.
|
|
86
|
+
|
|
88
87
|
> **NB:** If your org has no active subscription, the judge returns `"No verdict"` — actions are logged on-chain for the audit trail but not evaluated by an AI provider. Assign a plan at [atbash.ai/risk-engine/settings](https://atbash.ai/risk-engine/settings) for active verdicts.
|
|
89
88
|
|
|
90
89
|
## API
|
|
@@ -128,28 +127,71 @@ Standalone helpers for keypair handling.
|
|
|
128
127
|
| `isValidPrivateKey(hex)` | Validate a private-key string |
|
|
129
128
|
| `loadAgent(privkey)` | Validate the key + return `{ pubkey, privkey }` |
|
|
130
129
|
|
|
131
|
-
## Configuration
|
|
130
|
+
## Configuration resolution
|
|
132
131
|
|
|
133
|
-
|
|
132
|
+
`new Atbash(privkey, options)` takes everything explicitly. `Atbash.fromConfig(options)` fills in what you did not pass from the environment and then from `~/.config/atbash/config.json`, and finds the signing key for you.
|
|
134
133
|
|
|
135
134
|
```ts
|
|
136
135
|
import { Atbash } from "@atbash/sdk";
|
|
137
|
-
const atbash = Atbash.fromConfig(); //
|
|
136
|
+
const atbash = Atbash.fromConfig(); // key file + env + config.json
|
|
138
137
|
```
|
|
139
138
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
| `
|
|
147
|
-
|
|
139
|
+
### Settings: option, then env, then `config.json`
|
|
140
|
+
|
|
141
|
+
Each setting is read from the first place that has it: the `fromConfig` option, then the environment variable, then the key in `config.json`.
|
|
142
|
+
|
|
143
|
+
`judge` is taken whole. Pass it complete, or leave it out and use the environment or `config.json`: a `judge` with only an `endpoint` ignores `ATBASH_JUDGE_VERIFY_PUBKEY`, so a self-hosted host then fails the allowlist.
|
|
144
|
+
|
|
145
|
+
| `fromConfig` option | Env var | `config.json` key | Notes |
|
|
146
|
+
|---|---|---|---|
|
|
147
|
+
| `judge.endpoint` | `ATBASH_ENDPOINT` | `judgeEndpoint` | Must pass the endpoint rules below. |
|
|
148
|
+
| `judge.verifyPubKey` | `ATBASH_JUDGE_VERIFY_PUBKEY` | `judgeVerifyPubKey` | 66-hex response-signing key of a self-hosted judge. Set through the environment or `config.json` without an endpoint, it throws; passed in `judge` without an endpoint, the default endpoint is used. |
|
|
149
|
+
| `network` | `ATBASH_DEFAULT_CHAIN_NETWORK` | `defaultChainNetwork` | Only `"private"` is accepted; anything else throws. A client that names no chain is pinned to it, even for an org the dashboard places on another chain. |
|
|
150
|
+
| `debug` | `ATBASH_DEBUG` | `debug` | `1`, `true` or `yes` turns diagnostics on. |
|
|
151
|
+
| `orgName` | `ATBASH_ORG_NAME` | `orgName` | `fromConfig` reads the option only. The env var and file key are read by `resolve("orgName")`, which the CLI and plugins use. |
|
|
152
|
+
|
|
153
|
+
`agentKey` is not in this table on purpose: the signing key is never read from `config.json` (next section).
|
|
154
|
+
|
|
155
|
+
Helpers: `saveUserConfig(config)`, `loadUserConfig()`, `resolve(key, flagValue?)`, `getConfigPath()`.
|
|
156
|
+
|
|
157
|
+
### Which key signs
|
|
148
158
|
|
|
149
|
-
|
|
159
|
+
`fromConfig` picks the first of these that is set:
|
|
150
160
|
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
1. `agentKey` option (hex private key in code).
|
|
162
|
+
2. `keyPath` option. A path that does not exist throws; the SDK never falls through to another key when you named one.
|
|
163
|
+
3. `ATBASH_AGENT_KEY` environment variable.
|
|
164
|
+
4. `~/.config/atbash/guard-client-key`.
|
|
165
|
+
5. `~/.config/atbash/atbash-client-key`.
|
|
166
|
+
|
|
167
|
+
If none exists `fromConfig` throws `atbash key file not found. Looked for: <both default paths>`. The bare constructor never reads a key file.
|
|
168
|
+
|
|
169
|
+
An `agentKey` inside `config.json` is ignored. A settings file is writable by anything on the machine and is shared by every Atbash integration, so it is not allowed to choose who you sign as. When you pass a `logger`, `fromConfig` warns:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
[atbash] "agentKey" in config.json is ignored — settings do not choose the signing key. It holds <pubkey>; this client signs as the key file or ATBASH_AGENT_KEY instead. ...
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
and when no key file exists at all, the "not found" error names the pubkey stranded in `config.json` so you know where it went.
|
|
176
|
+
|
|
177
|
+
A key file is either `key=value` lines or JSON. Both fields must be present; the public key is re-derived from the private key, and a `0x` prefix is accepted.
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
privkey=<64 hex>
|
|
181
|
+
pubkey=<66 hex>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{ "privKey": "<64 hex>", "pubKey": "<66 hex>" }
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
For adapters and CI, keep the key in a file and point at it with `keyPath` (or let the default path be found). Passing the key on a command line puts it in shell history and process listings.
|
|
189
|
+
|
|
190
|
+
### What `orgName` does
|
|
191
|
+
|
|
192
|
+
`orgName` tells the SDK which chain to sign the call for: the org's network is looked up once through the dashboard, cached per client, and every judge and log call is signed for that chain. The SDK does not check that the name matches the org the agent was registered under; which org's policy judges the action is decided by the agent's registration, not by this string. On a deployment with a single chain a missing or different `orgName` therefore does not change the verdict. Org-scoped reads such as `getOrgTierInfo(orgName)` send the name as given; the dashboard answers an agent-authenticated call for the agent's own org, whatever name was passed.
|
|
193
|
+
|
|
194
|
+
Agent policy and detail reads can take the org, or an explicit chain:
|
|
153
195
|
|
|
154
196
|
```ts
|
|
155
197
|
await atbash.getAgentPolicy(atbash.pubkey, { orgName: "acme" });
|
|
@@ -158,6 +200,41 @@ await atbash.getAgentDetail(atbash.pubkey, {
|
|
|
158
200
|
});
|
|
159
201
|
```
|
|
160
202
|
|
|
203
|
+
### Judge endpoint rules
|
|
204
|
+
|
|
205
|
+
Both `fromConfig` and the constructor validate the endpoint before any request. `validateJudgeEndpoint(...)` exposes the same check.
|
|
206
|
+
|
|
207
|
+
- With no endpoint configured the SDK talks to the endpoint compiled into the build (`https://atbash.ai` for a release build).
|
|
208
|
+
- An `https://` endpoint is accepted without further setup only on the trusted hosts: `atbash.ai`, `www.atbash.ai` and the build's own default host.
|
|
209
|
+
- Any other `https://` endpoint is a self-hosted judge. It needs `policy: "self-hosted"` plus `verifyPubKey` (the judge's 66-hex compressed response-signing key), or `ATBASH_ENDPOINT` plus `ATBASH_JUDGE_VERIFY_PUBKEY`. Every judge response is then signature-checked against that key. Without the key the constructor throws `judge endpoint hostname "<host>" is not in the trusted allowlist`.
|
|
210
|
+
- Plain `http://` is accepted only for loopback (`localhost`, `127.0.0.1`, `::1`), for a dashboard running on the same machine. Any other `http://` endpoint throws.
|
|
211
|
+
- A URL with embedded credentials (`user:pass@host`) throws.
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
const atbash = Atbash.fromConfig({
|
|
215
|
+
judge: {
|
|
216
|
+
policy: "self-hosted",
|
|
217
|
+
endpoint: "https://judge.example.com",
|
|
218
|
+
verifyPubKey: "02…66 hex…",
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### From a key file to a first ALLOW
|
|
224
|
+
|
|
225
|
+
1. Download the key file the onboarding wizard offers at its Deploy step (it is in the `key=value` form above) and save it, for example as `./agent.key`.
|
|
226
|
+
2. Build the client from that file and judge an action:
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
import { Atbash } from "@atbash/sdk";
|
|
230
|
+
|
|
231
|
+
const atbash = Atbash.fromConfig({ keyPath: "./agent.key" });
|
|
232
|
+
const result = await atbash.judgeAction("read file", "list the files in ./src");
|
|
233
|
+
console.log(result.allow, result.enforced, result.reason);
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Dropping the same file at `~/.config/atbash/guard-client-key` lets `Atbash.fromConfig()` find it with no options at all.
|
|
237
|
+
|
|
161
238
|
## Error handling
|
|
162
239
|
|
|
163
240
|
The SDK throws standard `Error` objects. Known failure modes are enriched with a pointer to the dashboard page that fixes them:
|
|
@@ -191,4 +268,69 @@ Policy authoring, operator reviews, and agent management happen at [atbash.ai](h
|
|
|
191
268
|
|
|
192
269
|
## License
|
|
193
270
|
|
|
194
|
-
|
|
271
|
+
Licensed under the [Apache License, Version 2.0](LICENSE). See [NOTICE](NOTICE) for attribution. Versions published before this change remain available under the license they shipped with.
|
|
272
|
+
|
|
273
|
+
## Telemetry — what the SDK sends
|
|
274
|
+
|
|
275
|
+
The SDK reports how its own functions perform. It runs inside your agents and
|
|
276
|
+
the data leaves your network, so the payload is **metadata only** and the list
|
|
277
|
+
below is the whole of it.
|
|
278
|
+
|
|
279
|
+
**Sent**
|
|
280
|
+
|
|
281
|
+
| Field | Example |
|
|
282
|
+
| --- | --- |
|
|
283
|
+
| `function.name` | `judgeAction`, `memory.memory-add` |
|
|
284
|
+
| `status` / `outcome` | `success`, `error` |
|
|
285
|
+
| `duration_ms` | `142` |
|
|
286
|
+
| `error.class` | `AtbashAPIError` |
|
|
287
|
+
| `error.status` / `error.path` | `404`, `/api/v1/judge` — the route, never its query string |
|
|
288
|
+
| `sdk.version` | `0.18.0` |
|
|
289
|
+
| `sdk.language` | `node`, `python` — which binding sent it |
|
|
290
|
+
| `chain` | the blockchain RID — public infrastructure, and it names no customer |
|
|
291
|
+
| `agent.hash` | SHA-256 of the agent's **public** key, never the key itself |
|
|
292
|
+
| `source` | `sdk`, `cli`, `plugin:openclaw` |
|
|
293
|
+
|
|
294
|
+
**Never sent.** Action text, tool arguments, policy text, organisation names,
|
|
295
|
+
memory file paths, memory contents, response bodies, and keys of any kind.
|
|
296
|
+
`error.path` is the route alone — the query string is stripped where the error
|
|
297
|
+
is built, because it carries org names, tool call ids and the agent pubkey. These are not fields
|
|
298
|
+
that get emptied before sending — there is no field for them to go in.
|
|
299
|
+
|
|
300
|
+
`agent.hash` is de-identification, not anonymisation: agent public keys are
|
|
301
|
+
readable from the chain, so anyone holding that list can match a hash back to
|
|
302
|
+
an agent. Supply your own salted hasher to `setupTelemetry({ hashAgentKey })`
|
|
303
|
+
if you need it to be uncorrelatable.
|
|
304
|
+
|
|
305
|
+
### Turning it off
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
export ATBASH_TELEMETRY_DISABLED=1
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
or create `~/.config/atbash/telemetry.json` containing `{ "enabled": false }`.
|
|
312
|
+
|
|
313
|
+
**On a Private deployment, telemetry may already be off for everyone.** The operator disables collection by leaving `HONEYCOMB_API_KEY` unset on their Atbash service; the telemetry route then accepts the request and discards the payload, so nothing is forwarded and agents never see an error or retry. That is an operator setting on the deployment, not one you control from the agent — the switches above are yours.
|
|
314
|
+
|
|
315
|
+
To keep the operational counters but drop the richer per-operation events:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
export ATBASH_TELEMETRY_EVENTS_DISABLED=1
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Sending it to your own collector
|
|
322
|
+
|
|
323
|
+
Point the SDK at any OTLP endpoint you control. Atbash is then bypassed
|
|
324
|
+
entirely and **no Atbash credential is created or transmitted** — your headers
|
|
325
|
+
are the only ones sent.
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
export ATBASH_TELEMETRY_COLLECTOR_URL=https://otel.yourcompany.example
|
|
329
|
+
export ATBASH_TELEMETRY_COLLECTOR_HEADERS='{"x-api-key":"your-key"}'
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Metrics go to `/v1/metrics` and events to `/v1/logs` beneath that URL. `https`
|
|
333
|
+
is required; a collector on `localhost` additionally needs
|
|
334
|
+
`ATBASH_TELEMETRY_ALLOW_LOOPBACK=1`, so a mistyped URL cannot silently turn
|
|
335
|
+
exporting off. A URL that is refused raises at setup rather than quietly
|
|
336
|
+
falling back to Atbash.
|