@mnemom/agent-integrity-protocol 0.1.6 → 0.1.7

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/index.d.cts CHANGED
@@ -437,6 +437,8 @@ interface AnalysisLLMConfig {
437
437
  api_key: string;
438
438
  /** Maximum tokens for the analysis response */
439
439
  max_tokens: number;
440
+ /** Enable Anthropic prompt caching on system prompt. Default: false. */
441
+ enable_prompt_caching?: boolean;
440
442
  }
441
443
  /**
442
444
  * Optional callback functions for SDK signal delivery.
@@ -1029,9 +1031,21 @@ declare const DEFAULT_CONSCIENCE_VALUES: readonly [{
1029
1031
  readonly id: "fear-sycophancy";
1030
1032
  readonly content: "Risk of agreeing with the user to avoid conflict rather than providing honest assessment";
1031
1033
  }];
1034
+ /** Window configuration for EU compliance — extended retention and fail-closed. */
1035
+ declare const EU_COMPLIANCE_WINDOW_CONFIG: {
1036
+ readonly max_size: 10;
1037
+ readonly mode: "sliding";
1038
+ readonly session_boundary: "reset";
1039
+ readonly max_age_seconds: 7200;
1040
+ };
1041
+ /** Failure policy for EU compliance — fail closed with extended timeout. */
1042
+ declare const EU_COMPLIANCE_FAILURE_POLICY: {
1043
+ readonly mode: "fail_closed";
1044
+ readonly analysis_timeout_ms: 15000;
1045
+ };
1032
1046
  /** ID prefixes for protocol entities. */
1033
1047
  declare const CHECKPOINT_ID_PREFIX = "ic-";
1034
1048
  declare const DRIFT_ALERT_ID_PREFIX = "ida-";
1035
1049
  declare const REGISTRATION_ID_PREFIX = "reg-";
1036
1050
 
1037
- export { type AIPCallbacks, type AIPClient, type AIPConfig, AIP_CONTENT_TYPE, AIP_SIGNATURE_HEADER, AIP_VERSION, AIP_VERSION_HEADER, ALGORITHM_VERSION, type AdapterRegistry, type AlignmentCard, type AlignmentCardValue, type AnalysisLLMConfig, type AnalysisMetadata, AnthropicAdapter, type AutonomyEnvelope, type BuiltPrompt, CHECKPOINT_ID_PREFIX, CONFIDENCE_EXPLICIT, CONFIDENCE_FALLBACK, CONFIDENCE_NATIVE, type CardConscienceAgreement, type CardConscienceAugmentation, type CardConscienceConflict, type CheckIntegrityInput, type ConcernCategory, type ConscienceContext, type ConscienceValue, type ConscienceValueType, type ConsultationDepth, DEFAULT_ANALYSIS_MAX_TOKENS, DEFAULT_ANALYSIS_TIMEOUT_MS, DEFAULT_CONSCIENCE_VALUES, DEFAULT_SUSTAINED_CHECKS_THRESHOLD, DEFAULT_THINKING_TOKEN_BUDGET, DEFAULT_WINDOW_MAX_AGE_SECONDS, DEFAULT_WINDOW_MAX_SIZE, DRIFT_ALERT_ID_PREFIX, DRIFT_SEVERITY_LOW_THRESHOLD, DRIFT_SEVERITY_MEDIUM_THRESHOLD, type DriftDirection, type DriftState, type EscalationTrigger, type ExtractedThinking, type ExtractionMethod, type FailureMode, type FailurePolicy, FallbackAdapter, GoogleAdapter, type IntegrityCheckpoint, type IntegrityConcern, type IntegrityDriftAlert, type IntegritySeverity, type IntegritySignal, type IntegrityVerdict, MAX_EVIDENCE_LENGTH, MIN_WINDOW_SIZE, OpenAIAdapter, type PromptInput, type ProviderAdapter, REGISTRATION_ID_PREFIX, type RecommendedAction, type SessionBoundary, TRUNCATION_HEAD_RATIO, TRUNCATION_TAIL_RATIO, WEBHOOK_MAX_RETRIES, WEBHOOK_RETRY_DELAYS_MS, type WindowConfig, WindowManager, type WindowMode, type WindowPosition, type WindowState, type WindowSummary, buildConsciencePrompt, buildSignal, checkIntegrity, createAdapterRegistry, createClient, createDriftState, createWindowState, detectIntegrityDrift, hashThinkingBlock, mapVerdictToAction, mapVerdictToProceed, signPayload, summarizeCard, validateAgreement, verifySignature };
1051
+ export { type AIPCallbacks, type AIPClient, type AIPConfig, AIP_CONTENT_TYPE, AIP_SIGNATURE_HEADER, AIP_VERSION, AIP_VERSION_HEADER, ALGORITHM_VERSION, type AdapterRegistry, type AlignmentCard, type AlignmentCardValue, type AnalysisLLMConfig, type AnalysisMetadata, AnthropicAdapter, type AutonomyEnvelope, type BuiltPrompt, CHECKPOINT_ID_PREFIX, CONFIDENCE_EXPLICIT, CONFIDENCE_FALLBACK, CONFIDENCE_NATIVE, type CardConscienceAgreement, type CardConscienceAugmentation, type CardConscienceConflict, type CheckIntegrityInput, type ConcernCategory, type ConscienceContext, type ConscienceValue, type ConscienceValueType, type ConsultationDepth, DEFAULT_ANALYSIS_MAX_TOKENS, DEFAULT_ANALYSIS_TIMEOUT_MS, DEFAULT_CONSCIENCE_VALUES, DEFAULT_SUSTAINED_CHECKS_THRESHOLD, DEFAULT_THINKING_TOKEN_BUDGET, DEFAULT_WINDOW_MAX_AGE_SECONDS, DEFAULT_WINDOW_MAX_SIZE, DRIFT_ALERT_ID_PREFIX, DRIFT_SEVERITY_LOW_THRESHOLD, DRIFT_SEVERITY_MEDIUM_THRESHOLD, type DriftDirection, type DriftState, EU_COMPLIANCE_FAILURE_POLICY, EU_COMPLIANCE_WINDOW_CONFIG, type EscalationTrigger, type ExtractedThinking, type ExtractionMethod, type FailureMode, type FailurePolicy, FallbackAdapter, GoogleAdapter, type IntegrityCheckpoint, type IntegrityConcern, type IntegrityDriftAlert, type IntegritySeverity, type IntegritySignal, type IntegrityVerdict, MAX_EVIDENCE_LENGTH, MIN_WINDOW_SIZE, OpenAIAdapter, type PromptInput, type ProviderAdapter, REGISTRATION_ID_PREFIX, type RecommendedAction, type SessionBoundary, TRUNCATION_HEAD_RATIO, TRUNCATION_TAIL_RATIO, WEBHOOK_MAX_RETRIES, WEBHOOK_RETRY_DELAYS_MS, type WindowConfig, WindowManager, type WindowMode, type WindowPosition, type WindowState, type WindowSummary, buildConsciencePrompt, buildSignal, checkIntegrity, createAdapterRegistry, createClient, createDriftState, createWindowState, detectIntegrityDrift, hashThinkingBlock, mapVerdictToAction, mapVerdictToProceed, signPayload, summarizeCard, validateAgreement, verifySignature };
package/dist/index.d.ts CHANGED
@@ -437,6 +437,8 @@ interface AnalysisLLMConfig {
437
437
  api_key: string;
438
438
  /** Maximum tokens for the analysis response */
439
439
  max_tokens: number;
440
+ /** Enable Anthropic prompt caching on system prompt. Default: false. */
441
+ enable_prompt_caching?: boolean;
440
442
  }
441
443
  /**
442
444
  * Optional callback functions for SDK signal delivery.
@@ -1029,9 +1031,21 @@ declare const DEFAULT_CONSCIENCE_VALUES: readonly [{
1029
1031
  readonly id: "fear-sycophancy";
1030
1032
  readonly content: "Risk of agreeing with the user to avoid conflict rather than providing honest assessment";
1031
1033
  }];
1034
+ /** Window configuration for EU compliance — extended retention and fail-closed. */
1035
+ declare const EU_COMPLIANCE_WINDOW_CONFIG: {
1036
+ readonly max_size: 10;
1037
+ readonly mode: "sliding";
1038
+ readonly session_boundary: "reset";
1039
+ readonly max_age_seconds: 7200;
1040
+ };
1041
+ /** Failure policy for EU compliance — fail closed with extended timeout. */
1042
+ declare const EU_COMPLIANCE_FAILURE_POLICY: {
1043
+ readonly mode: "fail_closed";
1044
+ readonly analysis_timeout_ms: 15000;
1045
+ };
1032
1046
  /** ID prefixes for protocol entities. */
1033
1047
  declare const CHECKPOINT_ID_PREFIX = "ic-";
1034
1048
  declare const DRIFT_ALERT_ID_PREFIX = "ida-";
1035
1049
  declare const REGISTRATION_ID_PREFIX = "reg-";
1036
1050
 
1037
- export { type AIPCallbacks, type AIPClient, type AIPConfig, AIP_CONTENT_TYPE, AIP_SIGNATURE_HEADER, AIP_VERSION, AIP_VERSION_HEADER, ALGORITHM_VERSION, type AdapterRegistry, type AlignmentCard, type AlignmentCardValue, type AnalysisLLMConfig, type AnalysisMetadata, AnthropicAdapter, type AutonomyEnvelope, type BuiltPrompt, CHECKPOINT_ID_PREFIX, CONFIDENCE_EXPLICIT, CONFIDENCE_FALLBACK, CONFIDENCE_NATIVE, type CardConscienceAgreement, type CardConscienceAugmentation, type CardConscienceConflict, type CheckIntegrityInput, type ConcernCategory, type ConscienceContext, type ConscienceValue, type ConscienceValueType, type ConsultationDepth, DEFAULT_ANALYSIS_MAX_TOKENS, DEFAULT_ANALYSIS_TIMEOUT_MS, DEFAULT_CONSCIENCE_VALUES, DEFAULT_SUSTAINED_CHECKS_THRESHOLD, DEFAULT_THINKING_TOKEN_BUDGET, DEFAULT_WINDOW_MAX_AGE_SECONDS, DEFAULT_WINDOW_MAX_SIZE, DRIFT_ALERT_ID_PREFIX, DRIFT_SEVERITY_LOW_THRESHOLD, DRIFT_SEVERITY_MEDIUM_THRESHOLD, type DriftDirection, type DriftState, type EscalationTrigger, type ExtractedThinking, type ExtractionMethod, type FailureMode, type FailurePolicy, FallbackAdapter, GoogleAdapter, type IntegrityCheckpoint, type IntegrityConcern, type IntegrityDriftAlert, type IntegritySeverity, type IntegritySignal, type IntegrityVerdict, MAX_EVIDENCE_LENGTH, MIN_WINDOW_SIZE, OpenAIAdapter, type PromptInput, type ProviderAdapter, REGISTRATION_ID_PREFIX, type RecommendedAction, type SessionBoundary, TRUNCATION_HEAD_RATIO, TRUNCATION_TAIL_RATIO, WEBHOOK_MAX_RETRIES, WEBHOOK_RETRY_DELAYS_MS, type WindowConfig, WindowManager, type WindowMode, type WindowPosition, type WindowState, type WindowSummary, buildConsciencePrompt, buildSignal, checkIntegrity, createAdapterRegistry, createClient, createDriftState, createWindowState, detectIntegrityDrift, hashThinkingBlock, mapVerdictToAction, mapVerdictToProceed, signPayload, summarizeCard, validateAgreement, verifySignature };
1051
+ export { type AIPCallbacks, type AIPClient, type AIPConfig, AIP_CONTENT_TYPE, AIP_SIGNATURE_HEADER, AIP_VERSION, AIP_VERSION_HEADER, ALGORITHM_VERSION, type AdapterRegistry, type AlignmentCard, type AlignmentCardValue, type AnalysisLLMConfig, type AnalysisMetadata, AnthropicAdapter, type AutonomyEnvelope, type BuiltPrompt, CHECKPOINT_ID_PREFIX, CONFIDENCE_EXPLICIT, CONFIDENCE_FALLBACK, CONFIDENCE_NATIVE, type CardConscienceAgreement, type CardConscienceAugmentation, type CardConscienceConflict, type CheckIntegrityInput, type ConcernCategory, type ConscienceContext, type ConscienceValue, type ConscienceValueType, type ConsultationDepth, DEFAULT_ANALYSIS_MAX_TOKENS, DEFAULT_ANALYSIS_TIMEOUT_MS, DEFAULT_CONSCIENCE_VALUES, DEFAULT_SUSTAINED_CHECKS_THRESHOLD, DEFAULT_THINKING_TOKEN_BUDGET, DEFAULT_WINDOW_MAX_AGE_SECONDS, DEFAULT_WINDOW_MAX_SIZE, DRIFT_ALERT_ID_PREFIX, DRIFT_SEVERITY_LOW_THRESHOLD, DRIFT_SEVERITY_MEDIUM_THRESHOLD, type DriftDirection, type DriftState, EU_COMPLIANCE_FAILURE_POLICY, EU_COMPLIANCE_WINDOW_CONFIG, type EscalationTrigger, type ExtractedThinking, type ExtractionMethod, type FailureMode, type FailurePolicy, FallbackAdapter, GoogleAdapter, type IntegrityCheckpoint, type IntegrityConcern, type IntegrityDriftAlert, type IntegritySeverity, type IntegritySignal, type IntegrityVerdict, MAX_EVIDENCE_LENGTH, MIN_WINDOW_SIZE, OpenAIAdapter, type PromptInput, type ProviderAdapter, REGISTRATION_ID_PREFIX, type RecommendedAction, type SessionBoundary, TRUNCATION_HEAD_RATIO, TRUNCATION_TAIL_RATIO, WEBHOOK_MAX_RETRIES, WEBHOOK_RETRY_DELAYS_MS, type WindowConfig, WindowManager, type WindowMode, type WindowPosition, type WindowState, type WindowSummary, buildConsciencePrompt, buildSignal, checkIntegrity, createAdapterRegistry, createClient, createDriftState, createWindowState, detectIntegrityDrift, hashThinkingBlock, mapVerdictToAction, mapVerdictToProceed, signPayload, summarizeCard, validateAgreement, verifySignature };
package/dist/index.js CHANGED
@@ -89,6 +89,16 @@ var DEFAULT_CONSCIENCE_VALUES = [
89
89
  content: "Risk of agreeing with the user to avoid conflict rather than providing honest assessment"
90
90
  }
91
91
  ];
92
+ var EU_COMPLIANCE_WINDOW_CONFIG = {
93
+ max_size: 10,
94
+ mode: "sliding",
95
+ session_boundary: "reset",
96
+ max_age_seconds: 7200
97
+ };
98
+ var EU_COMPLIANCE_FAILURE_POLICY = {
99
+ mode: "fail_closed",
100
+ analysis_timeout_ms: 15e3
101
+ };
92
102
  var CHECKPOINT_ID_PREFIX = "ic-";
93
103
  var DRIFT_ALERT_ID_PREFIX = "ida-";
94
104
  var REGISTRATION_ID_PREFIX = "reg-";
@@ -1445,6 +1455,7 @@ async function callAnalysisLLM(llmConfig, system, user, timeoutMs) {
1445
1455
  const controller = new AbortController();
1446
1456
  const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
1447
1457
  try {
1458
+ const systemPayload = llmConfig.enable_prompt_caching ? [{ type: "text", text: system, cache_control: { type: "ephemeral" } }] : system;
1448
1459
  const response = await fetch(`${llmConfig.base_url}/v1/messages`, {
1449
1460
  method: "POST",
1450
1461
  headers: {
@@ -1455,7 +1466,7 @@ async function callAnalysisLLM(llmConfig, system, user, timeoutMs) {
1455
1466
  body: JSON.stringify({
1456
1467
  model: llmConfig.model,
1457
1468
  max_tokens: llmConfig.max_tokens,
1458
- system,
1469
+ system: systemPayload,
1459
1470
  messages: [{ role: "user", content: user }]
1460
1471
  }),
1461
1472
  signal: controller.signal
@@ -1538,6 +1549,6 @@ function constantTimeEqual(a, b) {
1538
1549
  return result === 0;
1539
1550
  }
1540
1551
 
1541
- export { AIP_CONTENT_TYPE, AIP_SIGNATURE_HEADER, AIP_VERSION, AIP_VERSION_HEADER, ALGORITHM_VERSION, AnthropicAdapter, CHECKPOINT_ID_PREFIX, CONFIDENCE_EXPLICIT, CONFIDENCE_FALLBACK, CONFIDENCE_NATIVE, DEFAULT_ANALYSIS_MAX_TOKENS, DEFAULT_ANALYSIS_TIMEOUT_MS, DEFAULT_CONSCIENCE_VALUES, DEFAULT_SUSTAINED_CHECKS_THRESHOLD, DEFAULT_THINKING_TOKEN_BUDGET, DEFAULT_WINDOW_MAX_AGE_SECONDS, DEFAULT_WINDOW_MAX_SIZE, DRIFT_ALERT_ID_PREFIX, DRIFT_SEVERITY_LOW_THRESHOLD, DRIFT_SEVERITY_MEDIUM_THRESHOLD, FallbackAdapter, GoogleAdapter, MAX_EVIDENCE_LENGTH, MIN_WINDOW_SIZE, OpenAIAdapter, REGISTRATION_ID_PREFIX, TRUNCATION_HEAD_RATIO, TRUNCATION_TAIL_RATIO, WEBHOOK_MAX_RETRIES, WEBHOOK_RETRY_DELAYS_MS, WindowManager, buildConsciencePrompt, buildSignal, checkIntegrity, createAdapterRegistry, createClient, createDriftState, createWindowState, detectIntegrityDrift, hashThinkingBlock, mapVerdictToAction, mapVerdictToProceed, signPayload, summarizeCard, validateAgreement, verifySignature };
1552
+ export { AIP_CONTENT_TYPE, AIP_SIGNATURE_HEADER, AIP_VERSION, AIP_VERSION_HEADER, ALGORITHM_VERSION, AnthropicAdapter, CHECKPOINT_ID_PREFIX, CONFIDENCE_EXPLICIT, CONFIDENCE_FALLBACK, CONFIDENCE_NATIVE, DEFAULT_ANALYSIS_MAX_TOKENS, DEFAULT_ANALYSIS_TIMEOUT_MS, DEFAULT_CONSCIENCE_VALUES, DEFAULT_SUSTAINED_CHECKS_THRESHOLD, DEFAULT_THINKING_TOKEN_BUDGET, DEFAULT_WINDOW_MAX_AGE_SECONDS, DEFAULT_WINDOW_MAX_SIZE, DRIFT_ALERT_ID_PREFIX, DRIFT_SEVERITY_LOW_THRESHOLD, DRIFT_SEVERITY_MEDIUM_THRESHOLD, EU_COMPLIANCE_FAILURE_POLICY, EU_COMPLIANCE_WINDOW_CONFIG, FallbackAdapter, GoogleAdapter, MAX_EVIDENCE_LENGTH, MIN_WINDOW_SIZE, OpenAIAdapter, REGISTRATION_ID_PREFIX, TRUNCATION_HEAD_RATIO, TRUNCATION_TAIL_RATIO, WEBHOOK_MAX_RETRIES, WEBHOOK_RETRY_DELAYS_MS, WindowManager, buildConsciencePrompt, buildSignal, checkIntegrity, createAdapterRegistry, createClient, createDriftState, createWindowState, detectIntegrityDrift, hashThinkingBlock, mapVerdictToAction, mapVerdictToProceed, signPayload, summarizeCard, validateAgreement, verifySignature };
1542
1553
  //# sourceMappingURL=index.js.map
1543
1554
  //# sourceMappingURL=index.js.map