@atbash/sdk 0.10.10-dev.0 → 0.10.12-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/README.md +12 -2
- package/dist/browser.d.mts +33 -7
- package/dist/browser.mjs +44 -16
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +33 -7
- package/dist/index.d.ts +33 -7
- package/dist/index.js +56 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -20
- package/dist/index.mjs.map +1 -1
- package/index.d.ts +0 -2
- package/index.js +0 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -274,6 +274,13 @@ interface AgentPolicy {
|
|
|
274
274
|
isCustom: boolean;
|
|
275
275
|
defaultPolicy: string;
|
|
276
276
|
}
|
|
277
|
+
/** Options for agent metadata and policy lookups. */
|
|
278
|
+
interface AgentLookupOptions {
|
|
279
|
+
/** Resolve the agent's network from this organization's active network. */
|
|
280
|
+
orgName?: string;
|
|
281
|
+
/** Explicit per-call chain override. `network` selects the dashboard chain. */
|
|
282
|
+
chainOpts?: ChainOpts;
|
|
283
|
+
}
|
|
277
284
|
/** Optional structured logger. */
|
|
278
285
|
interface AtbashLogger {
|
|
279
286
|
info?(...args: unknown[]): void;
|
|
@@ -521,8 +528,8 @@ declare class Atbash {
|
|
|
521
528
|
getOrgTierInfo(orgName: string): Promise<TierInfo | null>;
|
|
522
529
|
getPendingHeldActions(orgName: string, maxCount: number): Promise<HeldAction[]>;
|
|
523
530
|
getHeldActionReviews(orgName: string, maxCount: number): Promise<HeldActionReview[]>;
|
|
524
|
-
getAgentDetail(agentPubkey: string): Promise<Record<string, unknown>>;
|
|
525
|
-
getAgentPolicy(agentPubkey: string): Promise<AgentPolicy>;
|
|
531
|
+
getAgentDetail(agentPubkey: string, options?: AgentLookupOptions): Promise<Record<string, unknown>>;
|
|
532
|
+
getAgentPolicy(agentPubkey: string, options?: AgentLookupOptions): Promise<AgentPolicy>;
|
|
526
533
|
getSafetyStats(): Promise<Record<string, unknown>>;
|
|
527
534
|
/**
|
|
528
535
|
* Org's subscription on a specific chain. The `network` arg selects
|
|
@@ -573,6 +580,14 @@ declare class Atbash {
|
|
|
573
580
|
* chains; otherwise the client's default.
|
|
574
581
|
*/
|
|
575
582
|
private bridFromChainOpts;
|
|
583
|
+
/**
|
|
584
|
+
* Resolve the dashboard chain used by agent metadata/policy reads.
|
|
585
|
+
* Explicit per-call network overrides win; otherwise use the supplied org
|
|
586
|
+
* or the client's configured default org. A custom BRID is intentionally
|
|
587
|
+
* left untouched because it cannot be represented by the dashboard's
|
|
588
|
+
* public/private query selector.
|
|
589
|
+
*/
|
|
590
|
+
private resolveAgentLookupNetwork;
|
|
576
591
|
/**
|
|
577
592
|
* Get-or-create a Bearer token for dashboard reads. The token is a
|
|
578
593
|
* signed `log_tool_call` op (locally signed, never submitted) — the
|
|
@@ -1211,13 +1226,17 @@ declare function createMemoryGuardManager(opts: MemoryGuardManagerOptions): Memo
|
|
|
1211
1226
|
/**
|
|
1212
1227
|
* Atbash SDK Telemetry — OpenTelemetry metrics for usage tracking.
|
|
1213
1228
|
*
|
|
1214
|
-
*
|
|
1215
|
-
*
|
|
1229
|
+
* Metrics are POSTed to the Atbash-owned `/api/telemetry` proxy, which
|
|
1230
|
+
* verifies the bearer, injects the Honeycomb ingest key server-side, and
|
|
1231
|
+
* forwards to Honeycomb. The ingest credential never enters the SDK.
|
|
1232
|
+
*
|
|
1233
|
+
* Environment opt-out (recommended for air-gapped deployments):
|
|
1234
|
+
* ATBASH_TELEMETRY_DISABLED=1
|
|
1216
1235
|
*
|
|
1217
1236
|
* Opt-out: create ~/.config/atbash/telemetry.json with { "enabled": false }
|
|
1218
1237
|
* The file must be readable by the SDK process. If missing, corrupted, or
|
|
1219
|
-
* unreadable
|
|
1220
|
-
*
|
|
1238
|
+
* unreadable, telemetry remains eligible to start unless the environment
|
|
1239
|
+
* opt-out is set.
|
|
1221
1240
|
*/
|
|
1222
1241
|
type ClientSource = "cli" | "sdk" | "plugin:openclaw" | "plugin:langchain" | "plugin:langgraph" | "plugin:hermes" | "plugin:eliza" | "plugin:crewai" | "plugin:mcp" | "plugin:autogen" | "plugin:jeenai" | (string & {});
|
|
1223
1242
|
interface TelemetryConfig {
|
|
@@ -1227,6 +1246,13 @@ interface TelemetryConfig {
|
|
|
1227
1246
|
source?: ClientSource;
|
|
1228
1247
|
/** Flush interval in ms. Default: 60000 */
|
|
1229
1248
|
exportIntervalMs?: number;
|
|
1249
|
+
/** Atbash endpoint that hosts /api/telemetry. Required to actually export. */
|
|
1250
|
+
endpoint?: string;
|
|
1251
|
+
/**
|
|
1252
|
+
* Called on every export to obtain fresh auth headers (typically
|
|
1253
|
+
* `{ Authorization: "Bearer <hex>" }`). Required to actually export.
|
|
1254
|
+
*/
|
|
1255
|
+
getAuthHeaders?: () => Record<string, string>;
|
|
1230
1256
|
}
|
|
1231
1257
|
declare function setupTelemetry(config: TelemetryConfig): void;
|
|
1232
1258
|
/**
|
|
@@ -1346,4 +1372,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1346
1372
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1347
1373
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1348
1374
|
|
|
1349
|
-
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, BOOT_SYNC_HINT, 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, HttpClient, HttpTransportError, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, KEY_FILENAMES, 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, bootSyncFailureLine, buildAllowedJudgeHosts, chooseKeyPath, 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, keyPathCandidates, 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 };
|
|
1375
|
+
export { type ActionType, type AgentAuth, type AgentLookupOptions, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, BOOT_SYNC_HINT, 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, HttpClient, HttpTransportError, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, KEY_FILENAMES, 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, bootSyncFailureLine, buildAllowedJudgeHosts, chooseKeyPath, 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, keyPathCandidates, 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
|
@@ -274,6 +274,13 @@ interface AgentPolicy {
|
|
|
274
274
|
isCustom: boolean;
|
|
275
275
|
defaultPolicy: string;
|
|
276
276
|
}
|
|
277
|
+
/** Options for agent metadata and policy lookups. */
|
|
278
|
+
interface AgentLookupOptions {
|
|
279
|
+
/** Resolve the agent's network from this organization's active network. */
|
|
280
|
+
orgName?: string;
|
|
281
|
+
/** Explicit per-call chain override. `network` selects the dashboard chain. */
|
|
282
|
+
chainOpts?: ChainOpts;
|
|
283
|
+
}
|
|
277
284
|
/** Optional structured logger. */
|
|
278
285
|
interface AtbashLogger {
|
|
279
286
|
info?(...args: unknown[]): void;
|
|
@@ -521,8 +528,8 @@ declare class Atbash {
|
|
|
521
528
|
getOrgTierInfo(orgName: string): Promise<TierInfo | null>;
|
|
522
529
|
getPendingHeldActions(orgName: string, maxCount: number): Promise<HeldAction[]>;
|
|
523
530
|
getHeldActionReviews(orgName: string, maxCount: number): Promise<HeldActionReview[]>;
|
|
524
|
-
getAgentDetail(agentPubkey: string): Promise<Record<string, unknown>>;
|
|
525
|
-
getAgentPolicy(agentPubkey: string): Promise<AgentPolicy>;
|
|
531
|
+
getAgentDetail(agentPubkey: string, options?: AgentLookupOptions): Promise<Record<string, unknown>>;
|
|
532
|
+
getAgentPolicy(agentPubkey: string, options?: AgentLookupOptions): Promise<AgentPolicy>;
|
|
526
533
|
getSafetyStats(): Promise<Record<string, unknown>>;
|
|
527
534
|
/**
|
|
528
535
|
* Org's subscription on a specific chain. The `network` arg selects
|
|
@@ -573,6 +580,14 @@ declare class Atbash {
|
|
|
573
580
|
* chains; otherwise the client's default.
|
|
574
581
|
*/
|
|
575
582
|
private bridFromChainOpts;
|
|
583
|
+
/**
|
|
584
|
+
* Resolve the dashboard chain used by agent metadata/policy reads.
|
|
585
|
+
* Explicit per-call network overrides win; otherwise use the supplied org
|
|
586
|
+
* or the client's configured default org. A custom BRID is intentionally
|
|
587
|
+
* left untouched because it cannot be represented by the dashboard's
|
|
588
|
+
* public/private query selector.
|
|
589
|
+
*/
|
|
590
|
+
private resolveAgentLookupNetwork;
|
|
576
591
|
/**
|
|
577
592
|
* Get-or-create a Bearer token for dashboard reads. The token is a
|
|
578
593
|
* signed `log_tool_call` op (locally signed, never submitted) — the
|
|
@@ -1211,13 +1226,17 @@ declare function createMemoryGuardManager(opts: MemoryGuardManagerOptions): Memo
|
|
|
1211
1226
|
/**
|
|
1212
1227
|
* Atbash SDK Telemetry — OpenTelemetry metrics for usage tracking.
|
|
1213
1228
|
*
|
|
1214
|
-
*
|
|
1215
|
-
*
|
|
1229
|
+
* Metrics are POSTed to the Atbash-owned `/api/telemetry` proxy, which
|
|
1230
|
+
* verifies the bearer, injects the Honeycomb ingest key server-side, and
|
|
1231
|
+
* forwards to Honeycomb. The ingest credential never enters the SDK.
|
|
1232
|
+
*
|
|
1233
|
+
* Environment opt-out (recommended for air-gapped deployments):
|
|
1234
|
+
* ATBASH_TELEMETRY_DISABLED=1
|
|
1216
1235
|
*
|
|
1217
1236
|
* Opt-out: create ~/.config/atbash/telemetry.json with { "enabled": false }
|
|
1218
1237
|
* The file must be readable by the SDK process. If missing, corrupted, or
|
|
1219
|
-
* unreadable
|
|
1220
|
-
*
|
|
1238
|
+
* unreadable, telemetry remains eligible to start unless the environment
|
|
1239
|
+
* opt-out is set.
|
|
1221
1240
|
*/
|
|
1222
1241
|
type ClientSource = "cli" | "sdk" | "plugin:openclaw" | "plugin:langchain" | "plugin:langgraph" | "plugin:hermes" | "plugin:eliza" | "plugin:crewai" | "plugin:mcp" | "plugin:autogen" | "plugin:jeenai" | (string & {});
|
|
1223
1242
|
interface TelemetryConfig {
|
|
@@ -1227,6 +1246,13 @@ interface TelemetryConfig {
|
|
|
1227
1246
|
source?: ClientSource;
|
|
1228
1247
|
/** Flush interval in ms. Default: 60000 */
|
|
1229
1248
|
exportIntervalMs?: number;
|
|
1249
|
+
/** Atbash endpoint that hosts /api/telemetry. Required to actually export. */
|
|
1250
|
+
endpoint?: string;
|
|
1251
|
+
/**
|
|
1252
|
+
* Called on every export to obtain fresh auth headers (typically
|
|
1253
|
+
* `{ Authorization: "Bearer <hex>" }`). Required to actually export.
|
|
1254
|
+
*/
|
|
1255
|
+
getAuthHeaders?: () => Record<string, string>;
|
|
1230
1256
|
}
|
|
1231
1257
|
declare function setupTelemetry(config: TelemetryConfig): void;
|
|
1232
1258
|
/**
|
|
@@ -1346,4 +1372,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1346
1372
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1347
1373
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1348
1374
|
|
|
1349
|
-
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, BOOT_SYNC_HINT, 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, HttpClient, HttpTransportError, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, KEY_FILENAMES, 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, bootSyncFailureLine, buildAllowedJudgeHosts, chooseKeyPath, 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, keyPathCandidates, 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 };
|
|
1375
|
+
export { type ActionType, type AgentAuth, type AgentLookupOptions, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, BOOT_SYNC_HINT, 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, HttpClient, HttpTransportError, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, KEY_FILENAMES, 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, bootSyncFailureLine, buildAllowedJudgeHosts, chooseKeyPath, 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, keyPathCandidates, 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
|
@@ -3303,6 +3303,10 @@ var callCounter = null;
|
|
|
3303
3303
|
var durationHistogram = null;
|
|
3304
3304
|
var defaultSource = "sdk";
|
|
3305
3305
|
function isTelemetryOptedOut() {
|
|
3306
|
+
const disabled = process.env.ATBASH_TELEMETRY_DISABLED?.trim().toLowerCase();
|
|
3307
|
+
if (disabled && ["1", "true", "yes", "on"].includes(disabled)) {
|
|
3308
|
+
return true;
|
|
3309
|
+
}
|
|
3306
3310
|
try {
|
|
3307
3311
|
const home2 = process.env.HOME || (0, import_node_os2.homedir)() || "";
|
|
3308
3312
|
const filePath = (0, import_node_path2.join)(home2, ".config", "atbash", "telemetry.json");
|
|
@@ -3323,14 +3327,14 @@ function setupTelemetry(config2) {
|
|
|
3323
3327
|
if (!config2.enabled) return;
|
|
3324
3328
|
if (meterProvider) return;
|
|
3325
3329
|
if (isTelemetryOptedOut()) return;
|
|
3330
|
+
if (!config2.endpoint || !config2.getAuthHeaders) return;
|
|
3331
|
+
if (/^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0)(:|\/|$)/i.test(config2.endpoint)) return;
|
|
3326
3332
|
defaultSource = config2.source ?? "sdk";
|
|
3327
|
-
const
|
|
3328
|
-
|
|
3333
|
+
const proxyUrl = `${config2.endpoint.replace(/\/+$/, "")}/api/telemetry`;
|
|
3334
|
+
const getAuthHeaders = config2.getAuthHeaders;
|
|
3329
3335
|
const exporter = new import_exporter_metrics_otlp_http.OTLPMetricExporter({
|
|
3330
|
-
url:
|
|
3331
|
-
headers:
|
|
3332
|
-
"x-honeycomb-team": apiKey
|
|
3333
|
-
}
|
|
3336
|
+
url: proxyUrl,
|
|
3337
|
+
headers: async () => getAuthHeaders()
|
|
3334
3338
|
});
|
|
3335
3339
|
const reader = new import_sdk_metrics.PeriodicExportingMetricReader({
|
|
3336
3340
|
exporter,
|
|
@@ -3499,6 +3503,16 @@ var Atbash = class _Atbash {
|
|
|
3499
3503
|
verifying: this.verifyPubKey ? "with response-signature pubkey configured" : "without signature verification"
|
|
3500
3504
|
});
|
|
3501
3505
|
}
|
|
3506
|
+
try {
|
|
3507
|
+
setupTelemetry({
|
|
3508
|
+
enabled: true,
|
|
3509
|
+
source: "sdk",
|
|
3510
|
+
endpoint: this.endpoint,
|
|
3511
|
+
getAuthHeaders: () => this.authHeaders()
|
|
3512
|
+
});
|
|
3513
|
+
} catch (err) {
|
|
3514
|
+
this.logger.warn?.("[atbash] telemetry setup failed \u2014 continuing without metrics", { error: String(err) });
|
|
3515
|
+
}
|
|
3502
3516
|
}
|
|
3503
3517
|
/**
|
|
3504
3518
|
* Say which environment this build talks to, once per process.
|
|
@@ -4012,19 +4026,25 @@ var Atbash = class _Atbash {
|
|
|
4012
4026
|
});
|
|
4013
4027
|
}
|
|
4014
4028
|
/* ── risk-engine batched (action-dispatched POST) ──────────────────────── */
|
|
4015
|
-
getAgentDetail(agentPubkey) {
|
|
4016
|
-
return this.track(
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4029
|
+
async getAgentDetail(agentPubkey, options = {}) {
|
|
4030
|
+
return this.track("getAgentDetail", agentPubkey, async () => {
|
|
4031
|
+
const network = await this.resolveAgentLookupNetwork(options);
|
|
4032
|
+
return this.riskEnginePost(
|
|
4033
|
+
{ action: "agent-detail-batch", agent: agentPubkey },
|
|
4034
|
+
network
|
|
4035
|
+
);
|
|
4036
|
+
});
|
|
4021
4037
|
}
|
|
4022
|
-
async getAgentPolicy(agentPubkey) {
|
|
4038
|
+
async getAgentPolicy(agentPubkey, options = {}) {
|
|
4023
4039
|
return this.track("getAgentPolicy", agentPubkey, async () => {
|
|
4024
|
-
const
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4040
|
+
const network = await this.resolveAgentLookupNetwork(options);
|
|
4041
|
+
const raw2 = await this.riskEnginePost(
|
|
4042
|
+
{
|
|
4043
|
+
action: "agent-policy-batch",
|
|
4044
|
+
agent: agentPubkey
|
|
4045
|
+
},
|
|
4046
|
+
network
|
|
4047
|
+
);
|
|
4028
4048
|
return {
|
|
4029
4049
|
policy: String(raw2.policy ?? ""),
|
|
4030
4050
|
isJailed: Boolean(raw2.is_jailed),
|
|
@@ -4181,6 +4201,20 @@ var Atbash = class _Atbash {
|
|
|
4181
4201
|
if (chainOpts?.network === "public") return PUBLIC_CHAIN.blockchainRid;
|
|
4182
4202
|
return this.blockchainRid;
|
|
4183
4203
|
}
|
|
4204
|
+
/**
|
|
4205
|
+
* Resolve the dashboard chain used by agent metadata/policy reads.
|
|
4206
|
+
* Explicit per-call network overrides win; otherwise use the supplied org
|
|
4207
|
+
* or the client's configured default org. A custom BRID is intentionally
|
|
4208
|
+
* left untouched because it cannot be represented by the dashboard's
|
|
4209
|
+
* public/private query selector.
|
|
4210
|
+
*/
|
|
4211
|
+
async resolveAgentLookupNetwork(options) {
|
|
4212
|
+
if (options.chainOpts?.network) return options.chainOpts.network;
|
|
4213
|
+
if (options.chainOpts?.blockchainRid) return void 0;
|
|
4214
|
+
const orgName = options.orgName ?? this.orgName;
|
|
4215
|
+
if (!orgName) return void 0;
|
|
4216
|
+
return (await this.resolveChainForOrg(orgName)).network;
|
|
4217
|
+
}
|
|
4184
4218
|
/**
|
|
4185
4219
|
* Get-or-create a Bearer token for dashboard reads. The token is a
|
|
4186
4220
|
* signed `log_tool_call` op (locally signed, never submitted) — the
|
|
@@ -4223,10 +4257,11 @@ var Atbash = class _Atbash {
|
|
|
4223
4257
|
if (resp.status !== 200) throw await this.httpError(resp);
|
|
4224
4258
|
return this.json(resp);
|
|
4225
4259
|
}
|
|
4226
|
-
async riskEnginePost(body) {
|
|
4260
|
+
async riskEnginePost(body, network) {
|
|
4227
4261
|
let resp;
|
|
4228
4262
|
try {
|
|
4229
|
-
|
|
4263
|
+
const path7 = network ? `/api/risk-engine?network=${encodeURIComponent(network)}` : "/api/risk-engine";
|
|
4264
|
+
resp = await this.http.post(path7, body, this.authHeaders());
|
|
4230
4265
|
} catch (err) {
|
|
4231
4266
|
throw this.transportError(err);
|
|
4232
4267
|
}
|
|
@@ -4497,7 +4532,8 @@ async function scanMemory(entry, auth, opts) {
|
|
|
4497
4532
|
const result = await atbash.judgeAction(request.prompt, request.context, {
|
|
4498
4533
|
toolName: opts?.toolName ?? "memory_write",
|
|
4499
4534
|
toolArgsJson: opts?.toolArgsJson ?? JSON.stringify({ key: entry.key, source: entry.source }),
|
|
4500
|
-
mode: "memory-scan"
|
|
4535
|
+
mode: "memory-scan",
|
|
4536
|
+
orgName: opts?.orgName
|
|
4501
4537
|
});
|
|
4502
4538
|
if (result.verdict === "No verdict" && result.status !== "logged") {
|
|
4503
4539
|
throw new Error(
|