@atbash/sdk 0.10.0-dev.0 → 0.10.1-dev.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/dist/browser.d.mts +31 -27
- package/dist/browser.mjs +68 -19
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +31 -27
- package/dist/index.d.ts +31 -27
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -0
- package/dist/index.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/index.js +193 -80
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1049,35 +1049,16 @@ declare function flushTelemetry(): Promise<void>;
|
|
|
1049
1049
|
declare function shutdownTelemetry(): Promise<void>;
|
|
1050
1050
|
|
|
1051
1051
|
/**
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
* this module is a thin wrapper. Browser callers get the pure-TS shim
|
|
1055
|
-
* at `src-ts/browser/encrypted-toolcall.ts` (NAPI can't run in-browser).
|
|
1056
|
-
*/
|
|
1057
|
-
/** Plaintext fields of a tool call, sealed into a single ECIES payload. */
|
|
1058
|
-
interface ToolCallPlaintext {
|
|
1059
|
-
tool_name: string;
|
|
1060
|
-
action: string;
|
|
1061
|
-
context: string;
|
|
1062
|
-
tool_args_json: string;
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* Canonical form of an action for the retry-cache hash. Byte-identical to
|
|
1066
|
-
* the dashboard's `normalizeActionForHash` — diverging silently breaks
|
|
1067
|
-
* YELLOW-hold retry resolution.
|
|
1052
|
+
* Rust core does the work; `browser/encrypted-toolcall.ts` mirrors it for the
|
|
1053
|
+
* browser and must produce the same columns.
|
|
1068
1054
|
*/
|
|
1055
|
+
/** Must match `column_aad` in the core — the label binds a ciphertext to its column. */
|
|
1056
|
+
declare function columnAad(toolCallId: string, column: string): string;
|
|
1057
|
+
/** Byte-identical to the dashboard's copy — diverging breaks hold-retry resolution. */
|
|
1069
1058
|
declare function normalizeActionForHash(action: string): string;
|
|
1070
|
-
/**
|
|
1071
|
-
* Signed commitment to the plaintext claims the caller sends alongside the
|
|
1072
|
-
* ciphertext. The judge reads plaintext from the request body but holds no
|
|
1073
|
-
* org key; this hash lets it verify body-vs-ciphertext without decrypting.
|
|
1074
|
-
* Byte-identical to the dashboard's `claimHashHex`.
|
|
1075
|
-
*/
|
|
1059
|
+
/** Lets the judge check the request body against the ciphertext without an org key. */
|
|
1076
1060
|
declare function claimHashHex(toolName: string, action: string, context: string, toolArgsJson: string): string;
|
|
1077
|
-
/**
|
|
1078
|
-
* Build + sign a `log_encrypted_tool_call` transaction. Returns hex-encoded
|
|
1079
|
-
* signed tx, ready to POST as `signed_log_tool_call`.
|
|
1080
|
-
*/
|
|
1061
|
+
/** @returns hex-encoded signed tx, ready to POST as `signed_log_tool_call`. */
|
|
1081
1062
|
declare function signEncryptedToolCall(toolCallId: string, action: string, context: string, toolName: string, toolArgsJson: string, orgEncryptionPubKey: string, privkeyHex: string, blockchainRidHex: string): string;
|
|
1082
1063
|
|
|
1083
1064
|
/**
|
|
@@ -1126,6 +1107,29 @@ declare function decryptForOrg(payload: Uint8Array, orgPrivKeyHex: string, aad:
|
|
|
1126
1107
|
*/
|
|
1127
1108
|
declare function encryptedLength(plaintextByteLength: number): number;
|
|
1128
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* atb1.<key-fingerprint>.<claim-hash>.<base64 ciphertext>
|
|
1112
|
+
*
|
|
1113
|
+
* Normative spec: `core/src/crypto_envelope.rs`. This mirrors it for the browser.
|
|
1114
|
+
*/
|
|
1115
|
+
interface Envelope {
|
|
1116
|
+
/** First 8 bytes of the recipient public key, hex. May be empty. */
|
|
1117
|
+
keyFingerprint: string;
|
|
1118
|
+
/** Commitment to the accompanying plaintext claims. May be empty. */
|
|
1119
|
+
claimHash: string;
|
|
1120
|
+
/** Raw ECIES payload. */
|
|
1121
|
+
payload: Uint8Array;
|
|
1122
|
+
}
|
|
1123
|
+
declare function packEnvelope(payload: Uint8Array, keyFingerprint?: string, claimHash?: string): string;
|
|
1124
|
+
/**
|
|
1125
|
+
* Stays true for a truncated envelope that `parseEnvelope` rejects — a severed
|
|
1126
|
+
* ciphertext is not plaintext, so callers must show a placeholder.
|
|
1127
|
+
*/
|
|
1128
|
+
declare function isEnvelope(value: string): boolean;
|
|
1129
|
+
/** Null, not a throw — pre-encryption records are plaintext. */
|
|
1130
|
+
declare function parseEnvelope(value: string): Envelope | null;
|
|
1131
|
+
declare function keyFingerprintOf(pubKeyHex: string): string;
|
|
1132
|
+
|
|
1129
1133
|
declare function isValidPrivateKey(hex: string): boolean;
|
|
1130
1134
|
declare function derivePublicKey(privkey: string): string;
|
|
1131
1135
|
declare function generateKeypair(): KeyPair;
|
|
@@ -1141,4 +1145,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1141
1145
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1142
1146
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1143
1147
|
|
|
1144
|
-
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type
|
|
1148
|
+
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type Envelope, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveMemory, getActiveMemoryId, getAllAgentMemory, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeForMatching, normalizeStatus, normalizeVerdict, packEnvelope, parseEnvelope, pubkeyToHex, recordCall, recordDuration, redactJsonStrings, redactSecrets, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -1049,35 +1049,16 @@ declare function flushTelemetry(): Promise<void>;
|
|
|
1049
1049
|
declare function shutdownTelemetry(): Promise<void>;
|
|
1050
1050
|
|
|
1051
1051
|
/**
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
* this module is a thin wrapper. Browser callers get the pure-TS shim
|
|
1055
|
-
* at `src-ts/browser/encrypted-toolcall.ts` (NAPI can't run in-browser).
|
|
1056
|
-
*/
|
|
1057
|
-
/** Plaintext fields of a tool call, sealed into a single ECIES payload. */
|
|
1058
|
-
interface ToolCallPlaintext {
|
|
1059
|
-
tool_name: string;
|
|
1060
|
-
action: string;
|
|
1061
|
-
context: string;
|
|
1062
|
-
tool_args_json: string;
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* Canonical form of an action for the retry-cache hash. Byte-identical to
|
|
1066
|
-
* the dashboard's `normalizeActionForHash` — diverging silently breaks
|
|
1067
|
-
* YELLOW-hold retry resolution.
|
|
1052
|
+
* Rust core does the work; `browser/encrypted-toolcall.ts` mirrors it for the
|
|
1053
|
+
* browser and must produce the same columns.
|
|
1068
1054
|
*/
|
|
1055
|
+
/** Must match `column_aad` in the core — the label binds a ciphertext to its column. */
|
|
1056
|
+
declare function columnAad(toolCallId: string, column: string): string;
|
|
1057
|
+
/** Byte-identical to the dashboard's copy — diverging breaks hold-retry resolution. */
|
|
1069
1058
|
declare function normalizeActionForHash(action: string): string;
|
|
1070
|
-
/**
|
|
1071
|
-
* Signed commitment to the plaintext claims the caller sends alongside the
|
|
1072
|
-
* ciphertext. The judge reads plaintext from the request body but holds no
|
|
1073
|
-
* org key; this hash lets it verify body-vs-ciphertext without decrypting.
|
|
1074
|
-
* Byte-identical to the dashboard's `claimHashHex`.
|
|
1075
|
-
*/
|
|
1059
|
+
/** Lets the judge check the request body against the ciphertext without an org key. */
|
|
1076
1060
|
declare function claimHashHex(toolName: string, action: string, context: string, toolArgsJson: string): string;
|
|
1077
|
-
/**
|
|
1078
|
-
* Build + sign a `log_encrypted_tool_call` transaction. Returns hex-encoded
|
|
1079
|
-
* signed tx, ready to POST as `signed_log_tool_call`.
|
|
1080
|
-
*/
|
|
1061
|
+
/** @returns hex-encoded signed tx, ready to POST as `signed_log_tool_call`. */
|
|
1081
1062
|
declare function signEncryptedToolCall(toolCallId: string, action: string, context: string, toolName: string, toolArgsJson: string, orgEncryptionPubKey: string, privkeyHex: string, blockchainRidHex: string): string;
|
|
1082
1063
|
|
|
1083
1064
|
/**
|
|
@@ -1126,6 +1107,29 @@ declare function decryptForOrg(payload: Uint8Array, orgPrivKeyHex: string, aad:
|
|
|
1126
1107
|
*/
|
|
1127
1108
|
declare function encryptedLength(plaintextByteLength: number): number;
|
|
1128
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* atb1.<key-fingerprint>.<claim-hash>.<base64 ciphertext>
|
|
1112
|
+
*
|
|
1113
|
+
* Normative spec: `core/src/crypto_envelope.rs`. This mirrors it for the browser.
|
|
1114
|
+
*/
|
|
1115
|
+
interface Envelope {
|
|
1116
|
+
/** First 8 bytes of the recipient public key, hex. May be empty. */
|
|
1117
|
+
keyFingerprint: string;
|
|
1118
|
+
/** Commitment to the accompanying plaintext claims. May be empty. */
|
|
1119
|
+
claimHash: string;
|
|
1120
|
+
/** Raw ECIES payload. */
|
|
1121
|
+
payload: Uint8Array;
|
|
1122
|
+
}
|
|
1123
|
+
declare function packEnvelope(payload: Uint8Array, keyFingerprint?: string, claimHash?: string): string;
|
|
1124
|
+
/**
|
|
1125
|
+
* Stays true for a truncated envelope that `parseEnvelope` rejects — a severed
|
|
1126
|
+
* ciphertext is not plaintext, so callers must show a placeholder.
|
|
1127
|
+
*/
|
|
1128
|
+
declare function isEnvelope(value: string): boolean;
|
|
1129
|
+
/** Null, not a throw — pre-encryption records are plaintext. */
|
|
1130
|
+
declare function parseEnvelope(value: string): Envelope | null;
|
|
1131
|
+
declare function keyFingerprintOf(pubKeyHex: string): string;
|
|
1132
|
+
|
|
1129
1133
|
declare function isValidPrivateKey(hex: string): boolean;
|
|
1130
1134
|
declare function derivePublicKey(privkey: string): string;
|
|
1131
1135
|
declare function generateKeypair(): KeyPair;
|
|
@@ -1141,4 +1145,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1141
1145
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1142
1146
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1143
1147
|
|
|
1144
|
-
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type
|
|
1148
|
+
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type Envelope, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveMemory, getActiveMemoryId, getAllAgentMemory, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeForMatching, normalizeStatus, normalizeVerdict, packEnvelope, parseEnvelope, pubkeyToHex, recordCall, recordDuration, redactJsonStrings, redactSecrets, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
|
package/dist/index.js
CHANGED
|
@@ -2870,6 +2870,7 @@ __export(src_ts_exports, {
|
|
|
2870
2870
|
claimHashHex: () => claimHashHex,
|
|
2871
2871
|
classifyMemoryRead: () => classifyMemoryRead,
|
|
2872
2872
|
classifyMemoryWrite: () => classifyMemoryWrite,
|
|
2873
|
+
columnAad: () => columnAad,
|
|
2873
2874
|
commitMemoryVersion: () => commitMemoryVersion,
|
|
2874
2875
|
containsEvasionCharacters: () => containsEvasionCharacters,
|
|
2875
2876
|
containsSecret: () => containsSecret,
|
|
@@ -2897,7 +2898,9 @@ __export(src_ts_exports, {
|
|
|
2897
2898
|
getMemoryHistory: () => getMemoryHistory,
|
|
2898
2899
|
getRollbackHistory: () => getRollbackHistory,
|
|
2899
2900
|
guardMemoryWrite: () => guardMemoryWrite,
|
|
2901
|
+
isEnvelope: () => isEnvelope,
|
|
2900
2902
|
isValidPrivateKey: () => isValidPrivateKey,
|
|
2903
|
+
keyFingerprintOf: () => keyFingerprintOf,
|
|
2901
2904
|
loadAgent: () => loadAgent,
|
|
2902
2905
|
loadAgentFromFile: () => loadAgentFromFile,
|
|
2903
2906
|
loadUserConfig: () => loadUserConfig,
|
|
@@ -2905,6 +2908,8 @@ __export(src_ts_exports, {
|
|
|
2905
2908
|
normalizeForMatching: () => normalizeForMatching,
|
|
2906
2909
|
normalizeStatus: () => normalizeStatus,
|
|
2907
2910
|
normalizeVerdict: () => normalizeVerdict,
|
|
2911
|
+
packEnvelope: () => packEnvelope,
|
|
2912
|
+
parseEnvelope: () => parseEnvelope,
|
|
2908
2913
|
pubkeyToHex: () => pubkeyToHex,
|
|
2909
2914
|
recordCall: () => recordCall,
|
|
2910
2915
|
recordDuration: () => recordDuration,
|
|
@@ -2976,6 +2981,9 @@ function chainForNetwork(network) {
|
|
|
2976
2981
|
}
|
|
2977
2982
|
|
|
2978
2983
|
// src-ts/encrypted-toolcall.ts
|
|
2984
|
+
function columnAad(toolCallId, column) {
|
|
2985
|
+
return `${toolCallId}:${column}`;
|
|
2986
|
+
}
|
|
2979
2987
|
function normalizeActionForHash(action) {
|
|
2980
2988
|
return native.normalizeActionForHash(action);
|
|
2981
2989
|
}
|
|
@@ -43008,6 +43016,44 @@ function encryptedLength(plaintextByteLength) {
|
|
|
43008
43016
|
return native.encryptedLength(plaintextByteLength);
|
|
43009
43017
|
}
|
|
43010
43018
|
|
|
43019
|
+
// src-ts/crypto/envelope.ts
|
|
43020
|
+
var PREFIX = "atb1";
|
|
43021
|
+
var SEPARATOR = ".";
|
|
43022
|
+
function toBase64(bytes) {
|
|
43023
|
+
let binary = "";
|
|
43024
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
43025
|
+
return btoa(binary);
|
|
43026
|
+
}
|
|
43027
|
+
function fromBase64(text) {
|
|
43028
|
+
const binary = atob(text);
|
|
43029
|
+
const out = new Uint8Array(binary.length);
|
|
43030
|
+
for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
|
|
43031
|
+
return out;
|
|
43032
|
+
}
|
|
43033
|
+
function packEnvelope(payload, keyFingerprint = "", claimHash = "") {
|
|
43034
|
+
return [PREFIX, keyFingerprint, claimHash, toBase64(payload)].join(SEPARATOR);
|
|
43035
|
+
}
|
|
43036
|
+
function fieldWidthOk(value, hexChars) {
|
|
43037
|
+
return value.length === 0 ? true : value.length === hexChars && /^[0-9a-f]+$/.test(value);
|
|
43038
|
+
}
|
|
43039
|
+
function isEnvelope(value) {
|
|
43040
|
+
if (typeof value !== "string" || !value.startsWith(PREFIX + SEPARATOR)) return false;
|
|
43041
|
+
const parts = value.split(SEPARATOR);
|
|
43042
|
+
return parts.length >= 4 && fieldWidthOk(parts[1], 16) && fieldWidthOk(parts[2], 64);
|
|
43043
|
+
}
|
|
43044
|
+
function parseEnvelope(value) {
|
|
43045
|
+
if (!isEnvelope(value)) return null;
|
|
43046
|
+
const [, keyFingerprint, claimHash, ...rest] = value.split(SEPARATOR);
|
|
43047
|
+
try {
|
|
43048
|
+
return { keyFingerprint, claimHash, payload: fromBase64(rest.join(SEPARATOR)) };
|
|
43049
|
+
} catch {
|
|
43050
|
+
return null;
|
|
43051
|
+
}
|
|
43052
|
+
}
|
|
43053
|
+
function keyFingerprintOf(pubKeyHex) {
|
|
43054
|
+
return pubKeyHex.trim().replace(/^0x/i, "").toLowerCase().slice(0, 16);
|
|
43055
|
+
}
|
|
43056
|
+
|
|
43011
43057
|
// src-ts/index.ts
|
|
43012
43058
|
function isValidPrivateKey(hex) {
|
|
43013
43059
|
return native.isValidPrivateKey(hex);
|
|
@@ -43081,6 +43127,7 @@ function diffMemorySnapshots(before, after) {
|
|
|
43081
43127
|
claimHashHex,
|
|
43082
43128
|
classifyMemoryRead,
|
|
43083
43129
|
classifyMemoryWrite,
|
|
43130
|
+
columnAad,
|
|
43084
43131
|
commitMemoryVersion,
|
|
43085
43132
|
containsEvasionCharacters,
|
|
43086
43133
|
containsSecret,
|
|
@@ -43108,7 +43155,9 @@ function diffMemorySnapshots(before, after) {
|
|
|
43108
43155
|
getMemoryHistory,
|
|
43109
43156
|
getRollbackHistory,
|
|
43110
43157
|
guardMemoryWrite,
|
|
43158
|
+
isEnvelope,
|
|
43111
43159
|
isValidPrivateKey,
|
|
43160
|
+
keyFingerprintOf,
|
|
43112
43161
|
loadAgent,
|
|
43113
43162
|
loadAgentFromFile,
|
|
43114
43163
|
loadUserConfig,
|
|
@@ -43116,6 +43165,8 @@ function diffMemorySnapshots(before, after) {
|
|
|
43116
43165
|
normalizeForMatching,
|
|
43117
43166
|
normalizeStatus,
|
|
43118
43167
|
normalizeVerdict,
|
|
43168
|
+
packEnvelope,
|
|
43169
|
+
parseEnvelope,
|
|
43119
43170
|
pubkeyToHex,
|
|
43120
43171
|
recordCall,
|
|
43121
43172
|
recordDuration,
|