@atbash/sdk 0.9.0-dev.0 → 0.9.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/index.d.ts CHANGED
@@ -1,55 +1,305 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
12
+ export interface AddAgentMemoryArgsJs {
13
+ agent_pubkey: Buffer
14
+ content_cipher: Buffer
15
+ nonce: Buffer
16
+ score: number
17
+ file_path: string
18
+ }
19
+
20
+ export interface AgentAuthJs {
21
+ privkey: string
22
+ pubkey: string
23
+ }
24
+
25
+ export interface AgentPubkeyOnlyQueryJs {
26
+ agent_pubkey_hex: string
27
+ file_path?: string
28
+ }
29
+
30
+ export declare const ARG_AGENT_PUBKEY: string
31
+
32
+ export declare const ARG_FILE_PATH: string
33
+
34
+ export declare const ARG_ID: string
35
+
36
+ export declare function buildAddAgentMemoryArgs(agentPubkeyHex: string, contentCipher: Buffer, nonce: Buffer, score: number, filePath: string): AddAgentMemoryArgsJs
37
+
38
+ export declare function buildEncryptedToolcallArgs(toolCallId: string, action: string, context: string, toolName: string, toolArgsJson: string, orgEncryptionPubKeyHex: string): EncryptedToolCallArgsJs
39
+
40
+ export declare function buildGetActiveAgentMemoryQuery(agentPubkeyHex: string, filePath?: string | undefined | null): AgentPubkeyOnlyQueryJs
41
+
42
+ export declare function buildGetActiveMemoryIdQuery(agentPubkeyHex: string, filePath?: string | undefined | null): AgentPubkeyOnlyQueryJs
43
+
44
+ export declare function buildGetAgentMemoryByIdQuery(agentPubkeyHex: string, id: number): MemoryByIdQueryJs
45
+
46
+ export declare function buildGetAgentMemoryHistoryQuery(agentPubkeyHex: string, filePath?: string | undefined | null): AgentPubkeyOnlyQueryJs
47
+
48
+ export declare function buildGetAgentMemoryRollbackHistoryQuery(agentPubkeyHex: string, filePath?: string | undefined | null): AgentPubkeyOnlyQueryJs
49
+
50
+ export declare function buildGetRecentAgentMemoryQuery(agentPubkeyHex: string, filePath?: string | undefined | null): AgentPubkeyOnlyQueryJs
51
+
52
+ export declare function buildRollbackAgentMemoryArgs(agentPubkeyHex: string, toId: number, reason: string): RollbackAgentMemoryArgsJs
53
+
54
+ export declare function buildScanRequest(entry: MemoryEntryJs): ScanRequestJs
55
+
56
+ /**
57
+ * Named `claimHashHex` on the JS side to match the pure-TS name the
58
+ * dashboard's ported implementation uses.
59
+ */
60
+ export declare function claimHashHex(toolName: string, action: string, context: string, toolArgsJson: string): string
61
+
62
+ export declare function classifyMemoryRead(event: any, ctx: any, opts?: ClassifyReadOptionsJs | undefined | null): boolean
63
+
64
+ export declare function classifyMemoryWrite(event: any, ctx: any, opts?: ClassifyWriteOptionsJs | undefined | null): MemoryEntryJs | null
65
+
66
+ export interface ClassifyReadOptionsJs {
67
+ readToolNames?: Array<string>
68
+ patterns?: Array<string>
69
+ genericReadToolNames?: Array<string>
70
+ }
71
+
72
+ export interface ClassifyWriteOptionsJs {
73
+ patterns?: Array<string>
74
+ toolNames?: Array<string>
75
+ }
76
+
77
+ export declare function computeActionHash(action: string): string
78
+
3
79
  export declare function containsEvasionCharacters(s: string): boolean
4
80
 
5
81
  export declare function containsSecret(s: string): boolean
6
82
 
7
- export declare function createMemorySnapshot(entries: any, takenAt: number): any
83
+ export declare function createMemorySnapshot(entries: Array<MemoryEntryJs>, takenAt: number): MemorySnapshotJs
84
+
85
+ export declare function decryptForOrg(payload: Buffer, orgPrivKeyHex: string, aad: string, domain?: string | undefined | null): string
8
86
 
9
87
  export declare function decryptMemoryContent(ciphertext: Buffer, nonce: Buffer, key: Buffer): string
10
88
 
11
- export const DEFAULT_BLOCKCHAIN_RID: string
89
+ export declare const DEFAULT_BLOCKCHAIN_RID: string
12
90
 
13
- export const DEFAULT_ENDPOINT: string
91
+ export declare const DEFAULT_ENDPOINT: string
14
92
 
15
- export const DEFAULT_PRIVATE_BLOCKCHAIN_RID: string
93
+ export declare const DEFAULT_PRIVATE_BLOCKCHAIN_RID: string
16
94
 
17
95
  export declare function defaultChromiaNodeUrls(): Array<string>
18
96
 
97
+ export declare function defaultMemoryPathPatterns(): Array<string>
98
+
99
+ export declare function defaultMemoryReadToolNames(): Array<string>
100
+
101
+ export declare function defaultMemoryWriteToolNames(): Array<string>
102
+
19
103
  export declare function defaultPrivateNodeUrls(): Array<string>
20
104
 
105
+ export declare function defaultScoreForVerdict(verdict: string): number
106
+
21
107
  export declare function deriveMemoryKey(privkeyHex: string): Buffer
22
108
 
23
109
  export declare function derivePublicKey(s: string): string
24
110
 
25
- export declare function diffMemorySnapshots(before: any, after: any): any
111
+ export declare function diffMemorySnapshots(before: MemorySnapshotJs, after: MemorySnapshotJs): MemoryDiffResultJs
112
+
113
+ export declare const ECIES_FORMAT_VERSION: number
114
+
115
+ export declare function encryptedLength(plaintextByteLength: number): number
26
116
 
27
- /**
28
- * Encrypt UTF-8 plaintext with a 32-byte AES key. Returns
29
- * `{ ciphertext: Buffer, nonce: Buffer }` — ciphertext has the GCM
30
- * auth tag appended as the trailing 16 bytes.
31
- */
32
117
  export interface EncryptedMemoryJs {
33
118
  ciphertext: Buffer
34
119
  nonce: Buffer
35
120
  }
36
121
 
122
+ /** Columns of `log_tool_call` — `tool_name` stays readable for filtering. */
123
+ export interface EncryptedToolCallArgsJs {
124
+ tool_call_id: string
125
+ action_text: string
126
+ action_context: string
127
+ tool_name: string
128
+ tool_args_json: string
129
+ }
130
+
131
+ export declare function encryptForOrg(plaintext: string, orgPubKeyHex: string, aad: string, domain?: string | undefined | null): Buffer
132
+
37
133
  export declare function encryptMemoryContent(plaintext: string, key: Buffer): EncryptedMemoryJs
38
134
 
39
- export declare function generateKeypair(): any
135
+ export declare function formatEntryForScan(entry: MemoryEntryJs, hasEvasion: boolean): string
40
136
 
41
- export const HONEYCOMB_KEY: string
137
+ export declare function generateKeypair(): KeyPairJs
42
138
 
43
139
  export declare function isValidPrivateKey(s: string): boolean
44
140
 
45
- export declare function loadAgent(privkey: string): any
141
+ export interface JudgeSignatureCheckJs {
142
+ ok: boolean
143
+ reason?: string
144
+ }
145
+
146
+ export interface KeyPairJs {
147
+ priv_key: string
148
+ pub_key: string
149
+ }
150
+
151
+ export declare function loadAgent(privkey: string): AgentAuthJs
152
+
153
+ export declare function mapVerdict(actionType: string, confidence: number, threshold: number): string
154
+
155
+ export interface MemoryAnomalyJs {
156
+ /**
157
+ * Anomaly kind — see `AnomalyType` in the core. Emitted as `type` in JS
158
+ * to match the serde `#[serde(rename = "type")]` on the core struct.
159
+ */
160
+ type: string
161
+ severity: string
162
+ description: string
163
+ entries: Array<string>
164
+ }
165
+
166
+ export interface MemoryByIdQueryJs {
167
+ agent_pubkey_hex: string
168
+ id: number
169
+ }
170
+
171
+ export interface MemoryDiffResultJs {
172
+ safe: boolean
173
+ added: Array<MemoryEntryJs>
174
+ removed: Array<MemoryEntryJs>
175
+ modified: Array<ModifiedEntryJs>
176
+ anomalies: Array<MemoryAnomalyJs>
177
+ }
178
+
179
+ export interface MemoryEntryJs {
180
+ key: string
181
+ value: string
182
+ source?: string
183
+ timestamp?: number
184
+ }
185
+
186
+ export declare function memoryScanContext(): string
187
+
188
+ export interface MemorySnapshotJs {
189
+ entries: Array<MemoryEntryJs>
190
+ takenAt: number
191
+ }
192
+
193
+ export interface ModifiedEntryJs {
194
+ key: string
195
+ before: string
196
+ after: string
197
+ }
198
+
199
+ export declare function normalizeActionForHash(action: string): string
46
200
 
47
201
  export declare function normalizeForMatching(s: string): string
48
202
 
49
- export declare function redactSecrets(s: string): any
203
+ export declare const OP_ADD_AGENT_MEMORY: string
204
+
205
+ export declare const OP_LOG_TOOL_CALL: string
206
+
207
+ export declare const OP_ROLLBACK_AGENT_MEMORY: string
208
+
209
+ export declare function parseActiveMemoryId(value: any): number | null
210
+
211
+ export declare function parseByteArrayField(value: any): Buffer
212
+
213
+ export interface ParsedScoreJs {
214
+ score?: number
215
+ clean_reason: string
216
+ }
217
+
218
+ export declare function parseMemoryRow(value: any): RawMemoryRowJs
219
+
220
+ export declare function parseMemoryRows(value: any): Array<RawMemoryRowJs>
221
+
222
+ export declare function parseRollbackRow(value: any): RawRollbackRowJs
223
+
224
+ export declare function parseRollbackRows(value: any): Array<RawRollbackRowJs>
225
+
226
+ export declare function parseScoreFromReason(reason: string): ParsedScoreJs
227
+
228
+ export declare const QUERY_GET_ACTIVE_AGENT_MEMORY: string
229
+
230
+ export declare const QUERY_GET_ACTIVE_MEMORY_ID: string
231
+
232
+ export declare const QUERY_GET_AGENT_MEMORY_BY_ID: string
233
+
234
+ export declare const QUERY_GET_AGENT_MEMORY_HISTORY: string
235
+
236
+ export declare const QUERY_GET_AGENT_MEMORY_ROLLBACK_HISTORY: string
237
+
238
+ export declare const QUERY_GET_RECENT_AGENT_MEMORY: string
239
+
240
+ export interface RawMemoryRowJs {
241
+ id: number
242
+ file_path: string
243
+ content_cipher: Buffer
244
+ nonce: Buffer
245
+ score: number
246
+ is_active: boolean
247
+ created_at: number
248
+ updated_at: number
249
+ }
250
+
251
+ export interface RawRollbackRowJs {
252
+ from_id: number
253
+ to_id: number
254
+ file_path: string
255
+ reason: string
256
+ signer: Buffer
257
+ created_at: number
258
+ }
259
+
260
+ export interface RedactResultJs {
261
+ redacted: string
262
+ found: Array<SecretMatchJs>
263
+ }
264
+
265
+ export declare function redactSecrets(s: string): RedactResultJs
266
+
267
+ export interface RollbackAgentMemoryArgsJs {
268
+ agent_pubkey: Buffer
269
+ to_id: number
270
+ reason: string
271
+ }
272
+
273
+ export interface ScanRequestJs {
274
+ prompt: string
275
+ context: string
276
+ redaction: RedactResultJs
277
+ has_evasion: boolean
278
+ }
279
+
280
+ export interface SecretMatchJs {
281
+ kind: string
282
+ length: number
283
+ }
284
+
285
+ export declare function signEncryptedToolCall(toolCallId: string, action: string, context: string, toolName: string, toolArgsJson: string, orgEncryptionPubKeyHex: string, privkeyHex: string, blockchainRidHex: string): string
50
286
 
51
287
  export declare function signJudgeAction(judgmentId: string, action: string, context: string, extra: string, privkey: string, blockchainRid: string): string
52
288
 
53
289
  export declare function signLogToolCall(toolCallId: string, action: string, context: string, toolName: string, toolArgsJson: string, privkey: string, blockchainRid: string): string
54
290
 
291
+ export declare function validateAgentPubkeyHex(pubkeyHex: string): Buffer
292
+
293
+ export declare function validateFilePath(filePath: string): string
294
+
295
+ export declare function validateMemoryId(id: number): void
296
+
297
+ export declare function validateMemoryNonce(nonce: Buffer): void
298
+
299
+ export declare function validateRollbackReason(reason: string): void
300
+
301
+ export declare function validateScore(score: number): void
302
+
303
+ export declare function verifyJudgeResponseSignature(body: Buffer, signatureHex: string | undefined | null, pubkeyHex: string): JudgeSignatureCheckJs
304
+
55
305
  export declare function verifySignature(body: Buffer, signatureHex: string, pubkeyHex: string): boolean