@sanctuary-framework/mcp-server 0.5.10 → 0.5.12
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/cli.cjs +102 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +102 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +174 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +124 -3
- package/dist/index.d.ts +124 -3
- package/dist/index.js +173 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -639,6 +639,16 @@ interface SHRLayerL2 {
|
|
|
639
639
|
status: LayerStatus;
|
|
640
640
|
isolation_type: string;
|
|
641
641
|
attestation_available: boolean;
|
|
642
|
+
/** Model provenance: what inference model(s) power this agent */
|
|
643
|
+
model_provenance?: {
|
|
644
|
+
model_id: string;
|
|
645
|
+
model_name: string;
|
|
646
|
+
provider: string;
|
|
647
|
+
open_weights: boolean;
|
|
648
|
+
open_source: boolean;
|
|
649
|
+
local_inference: boolean;
|
|
650
|
+
weights_hash?: string;
|
|
651
|
+
};
|
|
642
652
|
}
|
|
643
653
|
interface SHRLayerL3 {
|
|
644
654
|
status: LayerStatus;
|
|
@@ -1367,6 +1377,110 @@ declare function classifyField(fieldName: string): FieldClassification;
|
|
|
1367
1377
|
*/
|
|
1368
1378
|
declare function recommendPolicy(context: Record<string, unknown>, provider?: string): PolicyRecommendation;
|
|
1369
1379
|
|
|
1380
|
+
/**
|
|
1381
|
+
* Sanctuary MCP Server — L2 Model Provenance
|
|
1382
|
+
*
|
|
1383
|
+
* Declares and attests to the model(s) powering this agent.
|
|
1384
|
+
*
|
|
1385
|
+
* Vitalik Buterin's "Secure LLM" post (April 2026) identified a critical gap:
|
|
1386
|
+
* open-weights-but-not-open-source models can have trained-in backdoors. Model
|
|
1387
|
+
* provenance declaration lets agents and their operators verify the integrity
|
|
1388
|
+
* of the inference backbone.
|
|
1389
|
+
*
|
|
1390
|
+
* Tracks: model name, version, weights hash, license, open-source status,
|
|
1391
|
+
* training data hash (if available). Included in SHR L2 section.
|
|
1392
|
+
*
|
|
1393
|
+
* This sits in L2 (Operational Isolation) because it's part of the runtime
|
|
1394
|
+
* attestation surface — the agent declares what model(s) it's actually running.
|
|
1395
|
+
*/
|
|
1396
|
+
/**
|
|
1397
|
+
* Metadata about a single model powering this agent.
|
|
1398
|
+
*/
|
|
1399
|
+
interface ModelProvenance {
|
|
1400
|
+
/** Machine-readable model ID (e.g., "qwen3.5-35b", "claude-opus-4", "llama-3.3-70b-instruct") */
|
|
1401
|
+
model_id: string;
|
|
1402
|
+
/** Human-readable model name (e.g., "Qwen 3.5", "Claude Opus 4", "Llama 3.3 70B Instruct") */
|
|
1403
|
+
model_name: string;
|
|
1404
|
+
/** Semantic version (e.g., "3.5", "4.0", "3.3") */
|
|
1405
|
+
model_version: string;
|
|
1406
|
+
/** Provider/vendor (e.g., "Alibaba Cloud", "Anthropic", "Meta", "local") */
|
|
1407
|
+
provider: string;
|
|
1408
|
+
/** SHA-256 of model weights file, if available and verifiable */
|
|
1409
|
+
weights_hash?: string;
|
|
1410
|
+
/** SHA-256 of training data manifest or metadata, if available */
|
|
1411
|
+
training_data_hash?: string;
|
|
1412
|
+
/** License identifier (e.g., "Apache-2.0", "CC-BY-4.0", "proprietary", "unknown") */
|
|
1413
|
+
license: string;
|
|
1414
|
+
/** True if model weights are publicly available (even if training is proprietary) */
|
|
1415
|
+
open_weights: boolean;
|
|
1416
|
+
/** True if full training code, data, and methodology are publicly available */
|
|
1417
|
+
open_source: boolean;
|
|
1418
|
+
/** True if inference runs on the local agent's hardware (not delegated to cloud API) */
|
|
1419
|
+
local_inference: boolean;
|
|
1420
|
+
/** ISO 8601 timestamp when this provenance was declared */
|
|
1421
|
+
declared_at: string;
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* In-memory and persistent store for model provenance declarations.
|
|
1425
|
+
* Declarations are encrypted under L1 sovereignty.
|
|
1426
|
+
*/
|
|
1427
|
+
interface ModelProvenanceStore {
|
|
1428
|
+
/**
|
|
1429
|
+
* Declare a model's provenance and add it to the store.
|
|
1430
|
+
*/
|
|
1431
|
+
declare(provenance: ModelProvenance): void;
|
|
1432
|
+
/**
|
|
1433
|
+
* Retrieve a model's provenance by ID.
|
|
1434
|
+
*/
|
|
1435
|
+
get(model_id: string): ModelProvenance | undefined;
|
|
1436
|
+
/**
|
|
1437
|
+
* List all declared models.
|
|
1438
|
+
*/
|
|
1439
|
+
list(): ModelProvenance[];
|
|
1440
|
+
/**
|
|
1441
|
+
* Get the primary/main model (the one the agent uses by default for inference).
|
|
1442
|
+
*/
|
|
1443
|
+
primary(): ModelProvenance | undefined;
|
|
1444
|
+
/**
|
|
1445
|
+
* Set which model is the primary.
|
|
1446
|
+
*/
|
|
1447
|
+
setPrimary(model_id: string): void;
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* In-memory implementation of ModelProvenanceStore.
|
|
1451
|
+
* Suitable for most use cases. For encrypted persistence, integrate with L1 state store.
|
|
1452
|
+
*/
|
|
1453
|
+
declare class InMemoryModelProvenanceStore implements ModelProvenanceStore {
|
|
1454
|
+
private models;
|
|
1455
|
+
private primaryModelId;
|
|
1456
|
+
declare(provenance: ModelProvenance): void;
|
|
1457
|
+
get(model_id: string): ModelProvenance | undefined;
|
|
1458
|
+
list(): ModelProvenance[];
|
|
1459
|
+
primary(): ModelProvenance | undefined;
|
|
1460
|
+
setPrimary(model_id: string): void;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Common model provenance presets for quick initialization.
|
|
1464
|
+
*/
|
|
1465
|
+
declare const MODEL_PRESETS: {
|
|
1466
|
+
/**
|
|
1467
|
+
* Claude Opus 4 via Anthropic API (cloud inference, closed weights/source)
|
|
1468
|
+
*/
|
|
1469
|
+
claudeOpus4: () => ModelProvenance;
|
|
1470
|
+
/**
|
|
1471
|
+
* Qwen 3.5 via local inference (open weights, proprietary training)
|
|
1472
|
+
*/
|
|
1473
|
+
qwen35Local: () => ModelProvenance;
|
|
1474
|
+
/**
|
|
1475
|
+
* Llama 3.3 70B via local inference (open weights and code)
|
|
1476
|
+
*/
|
|
1477
|
+
llama33Local: () => ModelProvenance;
|
|
1478
|
+
/**
|
|
1479
|
+
* Mistral 7B (open weights, open code, local inference)
|
|
1480
|
+
*/
|
|
1481
|
+
mistral7bLocal: () => ModelProvenance;
|
|
1482
|
+
};
|
|
1483
|
+
|
|
1370
1484
|
/**
|
|
1371
1485
|
* Sanctuary MCP Server — Prompt Injection Detection Layer
|
|
1372
1486
|
*
|
|
@@ -1969,8 +2083,15 @@ declare class IdentityManager {
|
|
|
1969
2083
|
private primaryIdentityId;
|
|
1970
2084
|
constructor(storage: StorageBackend, masterKey: Uint8Array);
|
|
1971
2085
|
private get encryptionKey();
|
|
1972
|
-
/** Load identities from storage on startup
|
|
1973
|
-
|
|
2086
|
+
/** Load identities from storage on startup.
|
|
2087
|
+
* Returns { total: number of encrypted files found, loaded: number successfully decrypted }.
|
|
2088
|
+
* A mismatch (total > 0, loaded === 0) indicates a wrong master key / missing passphrase.
|
|
2089
|
+
*/
|
|
2090
|
+
load(): Promise<{
|
|
2091
|
+
total: number;
|
|
2092
|
+
loaded: number;
|
|
2093
|
+
failed: number;
|
|
2094
|
+
}>;
|
|
1974
2095
|
/** Save an identity to storage */
|
|
1975
2096
|
save(identity: StoredIdentity): Promise<void>;
|
|
1976
2097
|
get(id: string): StoredIdentity | undefined;
|
|
@@ -2673,4 +2794,4 @@ declare function createSanctuaryServer(options?: {
|
|
|
2673
2794
|
storage?: StorageBackend;
|
|
2674
2795
|
}): Promise<SanctuaryServer>;
|
|
2675
2796
|
|
|
2676
|
-
export { ATTESTATION_VERSION, ApprovalGate, type AttestationBody, type AttestationVerificationResult, AuditLog, AutoApproveChannel, BaselineTracker, type BridgeAttestationRequest, type BridgeAttestationResult, type BridgeCommitment, type BridgeVerificationResult, TEMPLATES as CONTEXT_GATE_TEMPLATES, CallbackApprovalChannel, CommitmentStore, type ConcordiaOutcome, type ContextAction, type ContextFilterResult, ContextGateEnforcer, type ContextGatePolicy, ContextGatePolicyStore, type ContextGateRule, type ContextGateTemplate, DashboardApprovalChannel, type DashboardConfig, type DetectionResult, type EnforcerConfig, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, MemoryStorage, type PedersenCommitment, type PeerTrustEvaluation, type PolicyRecommendation, PolicyStore, type PrincipalPolicy, type ProviderCategory, ReputationStore, type SHRBody, type SHRGeneratorOptions, type SHRVerificationResult, type SanctuaryConfig, type SanctuaryServer, type SignedAttestation, type SignedSHR, type SovereigntyTier, StateStore, StderrApprovalChannel, TIER_WEIGHTS, type TierMetadata, type TieredAttestation, WebhookApprovalChannel, type WebhookCallbackPayload, type WebhookConfig, type WebhookPayload, type ZKProofOfKnowledge, type ZKRangeProof, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, filterContext, generateAttestation, generateSHR, getTemplate, initiateHandshake, listTemplateIds, loadConfig, loadPrincipalPolicy, recommendPolicy, resolveTier, respondToHandshake, signPayload, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
|
|
2797
|
+
export { ATTESTATION_VERSION, ApprovalGate, type AttestationBody, type AttestationVerificationResult, AuditLog, AutoApproveChannel, BaselineTracker, type BridgeAttestationRequest, type BridgeAttestationResult, type BridgeCommitment, type BridgeVerificationResult, TEMPLATES as CONTEXT_GATE_TEMPLATES, CallbackApprovalChannel, CommitmentStore, type ConcordiaOutcome, type ContextAction, type ContextFilterResult, ContextGateEnforcer, type ContextGatePolicy, ContextGatePolicyStore, type ContextGateRule, type ContextGateTemplate, DashboardApprovalChannel, type DashboardConfig, type DetectionResult, type EnforcerConfig, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, InMemoryModelProvenanceStore, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, MODEL_PRESETS, MemoryStorage, type ModelProvenance, type ModelProvenanceStore, type PedersenCommitment, type PeerTrustEvaluation, type PolicyRecommendation, PolicyStore, type PrincipalPolicy, type ProviderCategory, ReputationStore, type SHRBody, type SHRGeneratorOptions, type SHRVerificationResult, type SanctuaryConfig, type SanctuaryServer, type SignedAttestation, type SignedSHR, type SovereigntyTier, StateStore, StderrApprovalChannel, TIER_WEIGHTS, type TierMetadata, type TieredAttestation, WebhookApprovalChannel, type WebhookCallbackPayload, type WebhookConfig, type WebhookPayload, type ZKProofOfKnowledge, type ZKRangeProof, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, filterContext, generateAttestation, generateSHR, getTemplate, initiateHandshake, listTemplateIds, loadConfig, loadPrincipalPolicy, recommendPolicy, resolveTier, respondToHandshake, signPayload, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -639,6 +639,16 @@ interface SHRLayerL2 {
|
|
|
639
639
|
status: LayerStatus;
|
|
640
640
|
isolation_type: string;
|
|
641
641
|
attestation_available: boolean;
|
|
642
|
+
/** Model provenance: what inference model(s) power this agent */
|
|
643
|
+
model_provenance?: {
|
|
644
|
+
model_id: string;
|
|
645
|
+
model_name: string;
|
|
646
|
+
provider: string;
|
|
647
|
+
open_weights: boolean;
|
|
648
|
+
open_source: boolean;
|
|
649
|
+
local_inference: boolean;
|
|
650
|
+
weights_hash?: string;
|
|
651
|
+
};
|
|
642
652
|
}
|
|
643
653
|
interface SHRLayerL3 {
|
|
644
654
|
status: LayerStatus;
|
|
@@ -1367,6 +1377,110 @@ declare function classifyField(fieldName: string): FieldClassification;
|
|
|
1367
1377
|
*/
|
|
1368
1378
|
declare function recommendPolicy(context: Record<string, unknown>, provider?: string): PolicyRecommendation;
|
|
1369
1379
|
|
|
1380
|
+
/**
|
|
1381
|
+
* Sanctuary MCP Server — L2 Model Provenance
|
|
1382
|
+
*
|
|
1383
|
+
* Declares and attests to the model(s) powering this agent.
|
|
1384
|
+
*
|
|
1385
|
+
* Vitalik Buterin's "Secure LLM" post (April 2026) identified a critical gap:
|
|
1386
|
+
* open-weights-but-not-open-source models can have trained-in backdoors. Model
|
|
1387
|
+
* provenance declaration lets agents and their operators verify the integrity
|
|
1388
|
+
* of the inference backbone.
|
|
1389
|
+
*
|
|
1390
|
+
* Tracks: model name, version, weights hash, license, open-source status,
|
|
1391
|
+
* training data hash (if available). Included in SHR L2 section.
|
|
1392
|
+
*
|
|
1393
|
+
* This sits in L2 (Operational Isolation) because it's part of the runtime
|
|
1394
|
+
* attestation surface — the agent declares what model(s) it's actually running.
|
|
1395
|
+
*/
|
|
1396
|
+
/**
|
|
1397
|
+
* Metadata about a single model powering this agent.
|
|
1398
|
+
*/
|
|
1399
|
+
interface ModelProvenance {
|
|
1400
|
+
/** Machine-readable model ID (e.g., "qwen3.5-35b", "claude-opus-4", "llama-3.3-70b-instruct") */
|
|
1401
|
+
model_id: string;
|
|
1402
|
+
/** Human-readable model name (e.g., "Qwen 3.5", "Claude Opus 4", "Llama 3.3 70B Instruct") */
|
|
1403
|
+
model_name: string;
|
|
1404
|
+
/** Semantic version (e.g., "3.5", "4.0", "3.3") */
|
|
1405
|
+
model_version: string;
|
|
1406
|
+
/** Provider/vendor (e.g., "Alibaba Cloud", "Anthropic", "Meta", "local") */
|
|
1407
|
+
provider: string;
|
|
1408
|
+
/** SHA-256 of model weights file, if available and verifiable */
|
|
1409
|
+
weights_hash?: string;
|
|
1410
|
+
/** SHA-256 of training data manifest or metadata, if available */
|
|
1411
|
+
training_data_hash?: string;
|
|
1412
|
+
/** License identifier (e.g., "Apache-2.0", "CC-BY-4.0", "proprietary", "unknown") */
|
|
1413
|
+
license: string;
|
|
1414
|
+
/** True if model weights are publicly available (even if training is proprietary) */
|
|
1415
|
+
open_weights: boolean;
|
|
1416
|
+
/** True if full training code, data, and methodology are publicly available */
|
|
1417
|
+
open_source: boolean;
|
|
1418
|
+
/** True if inference runs on the local agent's hardware (not delegated to cloud API) */
|
|
1419
|
+
local_inference: boolean;
|
|
1420
|
+
/** ISO 8601 timestamp when this provenance was declared */
|
|
1421
|
+
declared_at: string;
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* In-memory and persistent store for model provenance declarations.
|
|
1425
|
+
* Declarations are encrypted under L1 sovereignty.
|
|
1426
|
+
*/
|
|
1427
|
+
interface ModelProvenanceStore {
|
|
1428
|
+
/**
|
|
1429
|
+
* Declare a model's provenance and add it to the store.
|
|
1430
|
+
*/
|
|
1431
|
+
declare(provenance: ModelProvenance): void;
|
|
1432
|
+
/**
|
|
1433
|
+
* Retrieve a model's provenance by ID.
|
|
1434
|
+
*/
|
|
1435
|
+
get(model_id: string): ModelProvenance | undefined;
|
|
1436
|
+
/**
|
|
1437
|
+
* List all declared models.
|
|
1438
|
+
*/
|
|
1439
|
+
list(): ModelProvenance[];
|
|
1440
|
+
/**
|
|
1441
|
+
* Get the primary/main model (the one the agent uses by default for inference).
|
|
1442
|
+
*/
|
|
1443
|
+
primary(): ModelProvenance | undefined;
|
|
1444
|
+
/**
|
|
1445
|
+
* Set which model is the primary.
|
|
1446
|
+
*/
|
|
1447
|
+
setPrimary(model_id: string): void;
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* In-memory implementation of ModelProvenanceStore.
|
|
1451
|
+
* Suitable for most use cases. For encrypted persistence, integrate with L1 state store.
|
|
1452
|
+
*/
|
|
1453
|
+
declare class InMemoryModelProvenanceStore implements ModelProvenanceStore {
|
|
1454
|
+
private models;
|
|
1455
|
+
private primaryModelId;
|
|
1456
|
+
declare(provenance: ModelProvenance): void;
|
|
1457
|
+
get(model_id: string): ModelProvenance | undefined;
|
|
1458
|
+
list(): ModelProvenance[];
|
|
1459
|
+
primary(): ModelProvenance | undefined;
|
|
1460
|
+
setPrimary(model_id: string): void;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Common model provenance presets for quick initialization.
|
|
1464
|
+
*/
|
|
1465
|
+
declare const MODEL_PRESETS: {
|
|
1466
|
+
/**
|
|
1467
|
+
* Claude Opus 4 via Anthropic API (cloud inference, closed weights/source)
|
|
1468
|
+
*/
|
|
1469
|
+
claudeOpus4: () => ModelProvenance;
|
|
1470
|
+
/**
|
|
1471
|
+
* Qwen 3.5 via local inference (open weights, proprietary training)
|
|
1472
|
+
*/
|
|
1473
|
+
qwen35Local: () => ModelProvenance;
|
|
1474
|
+
/**
|
|
1475
|
+
* Llama 3.3 70B via local inference (open weights and code)
|
|
1476
|
+
*/
|
|
1477
|
+
llama33Local: () => ModelProvenance;
|
|
1478
|
+
/**
|
|
1479
|
+
* Mistral 7B (open weights, open code, local inference)
|
|
1480
|
+
*/
|
|
1481
|
+
mistral7bLocal: () => ModelProvenance;
|
|
1482
|
+
};
|
|
1483
|
+
|
|
1370
1484
|
/**
|
|
1371
1485
|
* Sanctuary MCP Server — Prompt Injection Detection Layer
|
|
1372
1486
|
*
|
|
@@ -1969,8 +2083,15 @@ declare class IdentityManager {
|
|
|
1969
2083
|
private primaryIdentityId;
|
|
1970
2084
|
constructor(storage: StorageBackend, masterKey: Uint8Array);
|
|
1971
2085
|
private get encryptionKey();
|
|
1972
|
-
/** Load identities from storage on startup
|
|
1973
|
-
|
|
2086
|
+
/** Load identities from storage on startup.
|
|
2087
|
+
* Returns { total: number of encrypted files found, loaded: number successfully decrypted }.
|
|
2088
|
+
* A mismatch (total > 0, loaded === 0) indicates a wrong master key / missing passphrase.
|
|
2089
|
+
*/
|
|
2090
|
+
load(): Promise<{
|
|
2091
|
+
total: number;
|
|
2092
|
+
loaded: number;
|
|
2093
|
+
failed: number;
|
|
2094
|
+
}>;
|
|
1974
2095
|
/** Save an identity to storage */
|
|
1975
2096
|
save(identity: StoredIdentity): Promise<void>;
|
|
1976
2097
|
get(id: string): StoredIdentity | undefined;
|
|
@@ -2673,4 +2794,4 @@ declare function createSanctuaryServer(options?: {
|
|
|
2673
2794
|
storage?: StorageBackend;
|
|
2674
2795
|
}): Promise<SanctuaryServer>;
|
|
2675
2796
|
|
|
2676
|
-
export { ATTESTATION_VERSION, ApprovalGate, type AttestationBody, type AttestationVerificationResult, AuditLog, AutoApproveChannel, BaselineTracker, type BridgeAttestationRequest, type BridgeAttestationResult, type BridgeCommitment, type BridgeVerificationResult, TEMPLATES as CONTEXT_GATE_TEMPLATES, CallbackApprovalChannel, CommitmentStore, type ConcordiaOutcome, type ContextAction, type ContextFilterResult, ContextGateEnforcer, type ContextGatePolicy, ContextGatePolicyStore, type ContextGateRule, type ContextGateTemplate, DashboardApprovalChannel, type DashboardConfig, type DetectionResult, type EnforcerConfig, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, MemoryStorage, type PedersenCommitment, type PeerTrustEvaluation, type PolicyRecommendation, PolicyStore, type PrincipalPolicy, type ProviderCategory, ReputationStore, type SHRBody, type SHRGeneratorOptions, type SHRVerificationResult, type SanctuaryConfig, type SanctuaryServer, type SignedAttestation, type SignedSHR, type SovereigntyTier, StateStore, StderrApprovalChannel, TIER_WEIGHTS, type TierMetadata, type TieredAttestation, WebhookApprovalChannel, type WebhookCallbackPayload, type WebhookConfig, type WebhookPayload, type ZKProofOfKnowledge, type ZKRangeProof, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, filterContext, generateAttestation, generateSHR, getTemplate, initiateHandshake, listTemplateIds, loadConfig, loadPrincipalPolicy, recommendPolicy, resolveTier, respondToHandshake, signPayload, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
|
|
2797
|
+
export { ATTESTATION_VERSION, ApprovalGate, type AttestationBody, type AttestationVerificationResult, AuditLog, AutoApproveChannel, BaselineTracker, type BridgeAttestationRequest, type BridgeAttestationResult, type BridgeCommitment, type BridgeVerificationResult, TEMPLATES as CONTEXT_GATE_TEMPLATES, CallbackApprovalChannel, CommitmentStore, type ConcordiaOutcome, type ContextAction, type ContextFilterResult, ContextGateEnforcer, type ContextGatePolicy, ContextGatePolicyStore, type ContextGateRule, type ContextGateTemplate, DashboardApprovalChannel, type DashboardConfig, type DetectionResult, type EnforcerConfig, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, InMemoryModelProvenanceStore, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, MODEL_PRESETS, MemoryStorage, type ModelProvenance, type ModelProvenanceStore, type PedersenCommitment, type PeerTrustEvaluation, type PolicyRecommendation, PolicyStore, type PrincipalPolicy, type ProviderCategory, ReputationStore, type SHRBody, type SHRGeneratorOptions, type SHRVerificationResult, type SanctuaryConfig, type SanctuaryServer, type SignedAttestation, type SignedSHR, type SovereigntyTier, StateStore, StderrApprovalChannel, TIER_WEIGHTS, type TierMetadata, type TieredAttestation, WebhookApprovalChannel, type WebhookCallbackPayload, type WebhookConfig, type WebhookPayload, type ZKProofOfKnowledge, type ZKRangeProof, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, filterContext, generateAttestation, generateSHR, getTemplate, initiateHandshake, listTemplateIds, loadConfig, loadPrincipalPolicy, recommendPolicy, resolveTier, respondToHandshake, signPayload, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
|
package/dist/index.js
CHANGED
|
@@ -1275,9 +1275,13 @@ var IdentityManager = class {
|
|
|
1275
1275
|
get encryptionKey() {
|
|
1276
1276
|
return derivePurposeKey(this.masterKey, "identity-encryption");
|
|
1277
1277
|
}
|
|
1278
|
-
/** Load identities from storage on startup
|
|
1278
|
+
/** Load identities from storage on startup.
|
|
1279
|
+
* Returns { total: number of encrypted files found, loaded: number successfully decrypted }.
|
|
1280
|
+
* A mismatch (total > 0, loaded === 0) indicates a wrong master key / missing passphrase.
|
|
1281
|
+
*/
|
|
1279
1282
|
async load() {
|
|
1280
1283
|
const entries = await this.storage.list("_identities");
|
|
1284
|
+
let failed = 0;
|
|
1281
1285
|
for (const entry of entries) {
|
|
1282
1286
|
const raw = await this.storage.read("_identities", entry.key);
|
|
1283
1287
|
if (!raw) continue;
|
|
@@ -1290,8 +1294,10 @@ var IdentityManager = class {
|
|
|
1290
1294
|
this.primaryIdentityId = identity.identity_id;
|
|
1291
1295
|
}
|
|
1292
1296
|
} catch {
|
|
1297
|
+
failed++;
|
|
1293
1298
|
}
|
|
1294
1299
|
}
|
|
1300
|
+
return { total: entries.length, loaded: this.identities.size, failed };
|
|
1295
1301
|
}
|
|
1296
1302
|
/** Save an identity to storage */
|
|
1297
1303
|
async save(identity) {
|
|
@@ -11081,11 +11087,57 @@ var TOOL_API_SCOPED = {
|
|
|
11081
11087
|
],
|
|
11082
11088
|
default_action: "redact"
|
|
11083
11089
|
};
|
|
11090
|
+
var REMOTE_INFERENCE_SANITIZE = {
|
|
11091
|
+
id: "remote-inference-sanitize",
|
|
11092
|
+
name: "Remote Inference Sanitization",
|
|
11093
|
+
description: "Maximum privacy for remote/cloud LLM calls. Strips all identity, financial, location, and personal data before passing queries to external models. Inspired by Vitalik Buterin's 2-of-2 sovereignty model.",
|
|
11094
|
+
use_when: "Your local agent needs to call a remote LLM for tasks beyond local model capability (complex coding, deep research) and you want to minimize data leakage to the remote provider. The remote model gets only the task, query, format requirements, and stripped code context.",
|
|
11095
|
+
rules: [
|
|
11096
|
+
{
|
|
11097
|
+
provider: "inference",
|
|
11098
|
+
allow: [
|
|
11099
|
+
"task",
|
|
11100
|
+
"task_description",
|
|
11101
|
+
"current_query",
|
|
11102
|
+
"query",
|
|
11103
|
+
"prompt",
|
|
11104
|
+
"question",
|
|
11105
|
+
"instruction",
|
|
11106
|
+
"output_format",
|
|
11107
|
+
"format",
|
|
11108
|
+
"language",
|
|
11109
|
+
"code_context",
|
|
11110
|
+
// Stripped code snippets for coding tasks
|
|
11111
|
+
"error_message"
|
|
11112
|
+
// For debugging help
|
|
11113
|
+
],
|
|
11114
|
+
redact: [
|
|
11115
|
+
...ALWAYS_REDACT_SECRETS,
|
|
11116
|
+
...PII_PATTERNS,
|
|
11117
|
+
...INTERNAL_STATE_PATTERNS,
|
|
11118
|
+
...HISTORY_PATTERNS,
|
|
11119
|
+
"tool_results",
|
|
11120
|
+
"previous_results",
|
|
11121
|
+
// Additional redactions for remote inference
|
|
11122
|
+
"model_data",
|
|
11123
|
+
"agent_state",
|
|
11124
|
+
"runtime_config",
|
|
11125
|
+
"capabilities",
|
|
11126
|
+
"tool_list"
|
|
11127
|
+
],
|
|
11128
|
+
// Deny patterns — these must NEVER reach the remote model, not even redacted
|
|
11129
|
+
hash: [],
|
|
11130
|
+
summarize: []
|
|
11131
|
+
}
|
|
11132
|
+
],
|
|
11133
|
+
default_action: "deny"
|
|
11134
|
+
};
|
|
11084
11135
|
var TEMPLATES = {
|
|
11085
11136
|
"inference-minimal": INFERENCE_MINIMAL,
|
|
11086
11137
|
"inference-standard": INFERENCE_STANDARD,
|
|
11087
11138
|
"logging-strict": LOGGING_STRICT,
|
|
11088
|
-
"tool-api-scoped": TOOL_API_SCOPED
|
|
11139
|
+
"tool-api-scoped": TOOL_API_SCOPED,
|
|
11140
|
+
"remote-inference-sanitize": REMOTE_INFERENCE_SANITIZE
|
|
11089
11141
|
};
|
|
11090
11142
|
function listTemplateIds() {
|
|
11091
11143
|
return Object.keys(TEMPLATES);
|
|
@@ -12573,6 +12625,101 @@ function createL2HardeningTools(storagePath, auditLog) {
|
|
|
12573
12625
|
// src/index.ts
|
|
12574
12626
|
init_encoding();
|
|
12575
12627
|
|
|
12628
|
+
// src/l2-operational/model-provenance.ts
|
|
12629
|
+
var InMemoryModelProvenanceStore = class {
|
|
12630
|
+
models = /* @__PURE__ */ new Map();
|
|
12631
|
+
primaryModelId = null;
|
|
12632
|
+
declare(provenance) {
|
|
12633
|
+
if (!provenance.model_id) {
|
|
12634
|
+
throw new Error("ModelProvenance requires a model_id");
|
|
12635
|
+
}
|
|
12636
|
+
if (!provenance.model_name) {
|
|
12637
|
+
throw new Error("ModelProvenance requires a model_name");
|
|
12638
|
+
}
|
|
12639
|
+
if (!provenance.provider) {
|
|
12640
|
+
throw new Error("ModelProvenance requires a provider");
|
|
12641
|
+
}
|
|
12642
|
+
this.models.set(provenance.model_id, provenance);
|
|
12643
|
+
if (this.primaryModelId === null) {
|
|
12644
|
+
this.primaryModelId = provenance.model_id;
|
|
12645
|
+
}
|
|
12646
|
+
}
|
|
12647
|
+
get(model_id) {
|
|
12648
|
+
return this.models.get(model_id);
|
|
12649
|
+
}
|
|
12650
|
+
list() {
|
|
12651
|
+
return Array.from(this.models.values());
|
|
12652
|
+
}
|
|
12653
|
+
primary() {
|
|
12654
|
+
if (!this.primaryModelId) return void 0;
|
|
12655
|
+
return this.models.get(this.primaryModelId);
|
|
12656
|
+
}
|
|
12657
|
+
setPrimary(model_id) {
|
|
12658
|
+
if (!this.models.has(model_id)) {
|
|
12659
|
+
throw new Error(`Model ${model_id} not found in store`);
|
|
12660
|
+
}
|
|
12661
|
+
this.primaryModelId = model_id;
|
|
12662
|
+
}
|
|
12663
|
+
};
|
|
12664
|
+
var MODEL_PRESETS = {
|
|
12665
|
+
/**
|
|
12666
|
+
* Claude Opus 4 via Anthropic API (cloud inference, closed weights/source)
|
|
12667
|
+
*/
|
|
12668
|
+
claudeOpus4: () => ({
|
|
12669
|
+
model_id: "claude-opus-4",
|
|
12670
|
+
model_name: "Claude Opus 4",
|
|
12671
|
+
model_version: "4.0",
|
|
12672
|
+
provider: "Anthropic",
|
|
12673
|
+
license: "proprietary",
|
|
12674
|
+
open_weights: false,
|
|
12675
|
+
open_source: false,
|
|
12676
|
+
local_inference: false,
|
|
12677
|
+
declared_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12678
|
+
}),
|
|
12679
|
+
/**
|
|
12680
|
+
* Qwen 3.5 via local inference (open weights, proprietary training)
|
|
12681
|
+
*/
|
|
12682
|
+
qwen35Local: () => ({
|
|
12683
|
+
model_id: "qwen-3.5-35b",
|
|
12684
|
+
model_name: "Qwen 3.5 35B",
|
|
12685
|
+
model_version: "3.5",
|
|
12686
|
+
provider: "Alibaba Cloud",
|
|
12687
|
+
license: "Apache-2.0",
|
|
12688
|
+
open_weights: true,
|
|
12689
|
+
open_source: false,
|
|
12690
|
+
local_inference: true,
|
|
12691
|
+
declared_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12692
|
+
}),
|
|
12693
|
+
/**
|
|
12694
|
+
* Llama 3.3 70B via local inference (open weights and code)
|
|
12695
|
+
*/
|
|
12696
|
+
llama33Local: () => ({
|
|
12697
|
+
model_id: "llama-3.3-70b-instruct",
|
|
12698
|
+
model_name: "Llama 3.3 70B Instruct",
|
|
12699
|
+
model_version: "3.3",
|
|
12700
|
+
provider: "Meta",
|
|
12701
|
+
license: "Apache-2.0",
|
|
12702
|
+
open_weights: true,
|
|
12703
|
+
open_source: true,
|
|
12704
|
+
local_inference: true,
|
|
12705
|
+
declared_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12706
|
+
}),
|
|
12707
|
+
/**
|
|
12708
|
+
* Mistral 7B (open weights, open code, local inference)
|
|
12709
|
+
*/
|
|
12710
|
+
mistral7bLocal: () => ({
|
|
12711
|
+
model_id: "mistral-7b-instruct",
|
|
12712
|
+
model_name: "Mistral 7B Instruct",
|
|
12713
|
+
model_version: "7",
|
|
12714
|
+
provider: "Mistral AI",
|
|
12715
|
+
license: "Apache-2.0",
|
|
12716
|
+
open_weights: true,
|
|
12717
|
+
open_source: true,
|
|
12718
|
+
local_inference: true,
|
|
12719
|
+
declared_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12720
|
+
})
|
|
12721
|
+
};
|
|
12722
|
+
|
|
12576
12723
|
// src/storage/memory.ts
|
|
12577
12724
|
var MemoryStorage = class {
|
|
12578
12725
|
store = /* @__PURE__ */ new Map();
|
|
@@ -12722,7 +12869,29 @@ async function createSanctuaryServer(options) {
|
|
|
12722
12869
|
keyProtection,
|
|
12723
12870
|
auditLog
|
|
12724
12871
|
);
|
|
12725
|
-
await identityManager.load();
|
|
12872
|
+
const loadResult = await identityManager.load();
|
|
12873
|
+
if (loadResult.total > 0 && loadResult.loaded === 0) {
|
|
12874
|
+
console.error(
|
|
12875
|
+
`
|
|
12876
|
+
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
12877
|
+
\u2551 \u26A0 WARNING: Encrypted identities found but NONE loaded \u2551
|
|
12878
|
+
\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563
|
|
12879
|
+
\u2551 ${loadResult.total} encrypted identity file(s) found on disk \u2551
|
|
12880
|
+
\u2551 0 could be decrypted with the current master key \u2551
|
|
12881
|
+
\u2551 \u2551
|
|
12882
|
+
\u2551 This usually means SANCTUARY_PASSPHRASE is missing or \u2551
|
|
12883
|
+
\u2551 incorrect. The server will start but with NO identity data. \u2551
|
|
12884
|
+
\u2551 \u2551
|
|
12885
|
+
\u2551 To fix: set SANCTUARY_PASSPHRASE to the passphrase used \u2551
|
|
12886
|
+
\u2551 when this Sanctuary instance was first configured. \u2551
|
|
12887
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
12888
|
+
`
|
|
12889
|
+
);
|
|
12890
|
+
} else if (loadResult.failed > 0) {
|
|
12891
|
+
console.error(
|
|
12892
|
+
`Warning: ${loadResult.failed} of ${loadResult.total} identity files could not be decrypted (possibly corrupted).`
|
|
12893
|
+
);
|
|
12894
|
+
}
|
|
12726
12895
|
const l2Tools = [
|
|
12727
12896
|
{
|
|
12728
12897
|
name: "sanctuary/exec_attest",
|
|
@@ -13094,6 +13263,6 @@ async function createSanctuaryServer(options) {
|
|
|
13094
13263
|
return { server, config };
|
|
13095
13264
|
}
|
|
13096
13265
|
|
|
13097
|
-
export { ATTESTATION_VERSION, ApprovalGate, AuditLog, AutoApproveChannel, BaselineTracker, TEMPLATES as CONTEXT_GATE_TEMPLATES, CallbackApprovalChannel, CommitmentStore, ContextGateEnforcer, ContextGatePolicyStore, DashboardApprovalChannel, FederationRegistry, FilesystemStorage, InjectionDetector, MemoryStorage, PolicyStore, ReputationStore, StateStore, StderrApprovalChannel, TIER_WEIGHTS, WebhookApprovalChannel, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, filterContext, generateAttestation, generateSHR, getTemplate, initiateHandshake, listTemplateIds, loadConfig, loadPrincipalPolicy, recommendPolicy, resolveTier, respondToHandshake, signPayload, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
|
|
13266
|
+
export { ATTESTATION_VERSION, ApprovalGate, AuditLog, AutoApproveChannel, BaselineTracker, TEMPLATES as CONTEXT_GATE_TEMPLATES, CallbackApprovalChannel, CommitmentStore, ContextGateEnforcer, ContextGatePolicyStore, DashboardApprovalChannel, FederationRegistry, FilesystemStorage, InMemoryModelProvenanceStore, InjectionDetector, MODEL_PRESETS, MemoryStorage, PolicyStore, ReputationStore, StateStore, StderrApprovalChannel, TIER_WEIGHTS, WebhookApprovalChannel, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, filterContext, generateAttestation, generateSHR, getTemplate, initiateHandshake, listTemplateIds, loadConfig, loadPrincipalPolicy, recommendPolicy, resolveTier, respondToHandshake, signPayload, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
|
|
13098
13267
|
//# sourceMappingURL=index.js.map
|
|
13099
13268
|
//# sourceMappingURL=index.js.map
|