@sanctuary-framework/mcp-server 0.5.9 → 0.5.11
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 +87 -35
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +87 -35
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +184 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +115 -1
- package/dist/index.d.ts +115 -1
- package/dist/index.js +183 -36
- 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
|
*
|
|
@@ -2673,4 +2787,4 @@ declare function createSanctuaryServer(options?: {
|
|
|
2673
2787
|
storage?: StorageBackend;
|
|
2674
2788
|
}): Promise<SanctuaryServer>;
|
|
2675
2789
|
|
|
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 };
|
|
2790
|
+
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
|
*
|
|
@@ -2673,4 +2787,4 @@ declare function createSanctuaryServer(options?: {
|
|
|
2673
2787
|
storage?: StorageBackend;
|
|
2674
2788
|
}): Promise<SanctuaryServer>;
|
|
2675
2789
|
|
|
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 };
|
|
2790
|
+
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
|
@@ -5690,11 +5690,12 @@ function generateDashboardHTML(options) {
|
|
|
5690
5690
|
// API Updates
|
|
5691
5691
|
async function updateSovereignty() {
|
|
5692
5692
|
const data = await fetchAPI('/api/sovereignty');
|
|
5693
|
-
if (!data) return;
|
|
5693
|
+
if (!data || data.error) return;
|
|
5694
5694
|
|
|
5695
5695
|
apiState.sovereignty = data;
|
|
5696
5696
|
|
|
5697
|
-
|
|
5697
|
+
// API returns { score, overall_level, layers: { l1, l2, l3, l4 }, ... }
|
|
5698
|
+
const score = data.score ?? 0;
|
|
5698
5699
|
const badge = document.getElementById('sovereignty-badge');
|
|
5699
5700
|
const scoreEl = document.getElementById('sovereignty-score');
|
|
5700
5701
|
|
|
@@ -5704,18 +5705,18 @@ function generateDashboardHTML(options) {
|
|
|
5704
5705
|
if (score < 70) badge.classList.add('degraded');
|
|
5705
5706
|
if (score < 40) badge.classList.add('inactive');
|
|
5706
5707
|
|
|
5707
|
-
updateLayerCards(data
|
|
5708
|
+
updateLayerCards(data);
|
|
5708
5709
|
}
|
|
5709
5710
|
|
|
5710
|
-
function updateLayerCards(
|
|
5711
|
-
if (!
|
|
5711
|
+
function updateLayerCards(data) {
|
|
5712
|
+
if (!data || !data.layers) return;
|
|
5712
5713
|
|
|
5713
|
-
const layers =
|
|
5714
|
+
const layers = data.layers;
|
|
5714
5715
|
|
|
5715
|
-
updateLayerCard('l1', layers.l1, layers.l1?.
|
|
5716
|
-
updateLayerCard('l2', layers.l2, layers.l2?.
|
|
5717
|
-
updateLayerCard('l3', layers.l3, layers.l3?.
|
|
5718
|
-
updateLayerCard('l4', layers.l4, layers.l4?.
|
|
5716
|
+
updateLayerCard('l1', layers.l1, layers.l1?.detail || 'AES-256-GCM');
|
|
5717
|
+
updateLayerCard('l2', layers.l2, layers.l2?.detail || 'Process-level');
|
|
5718
|
+
updateLayerCard('l3', layers.l3, layers.l3?.detail || 'Schnorr-Pedersen');
|
|
5719
|
+
updateLayerCard('l4', layers.l4, layers.l4?.detail || 'Weighted');
|
|
5719
5720
|
}
|
|
5720
5721
|
|
|
5721
5722
|
function updateLayerCard(layer, layerData, detail) {
|
|
@@ -5743,14 +5744,16 @@ function generateDashboardHTML(options) {
|
|
|
5743
5744
|
|
|
5744
5745
|
apiState.identity = data;
|
|
5745
5746
|
|
|
5746
|
-
|
|
5747
|
+
// API returns { identities: [...], count, primary_id }
|
|
5748
|
+
// Find the primary identity from the array
|
|
5749
|
+
const primary = (data.identities || []).find(id => id.identity_id === data.primary_id) || {};
|
|
5747
5750
|
document.getElementById('identity-label').textContent = primary.label || '\u2014';
|
|
5748
5751
|
document.getElementById('identity-did').textContent = truncate(primary.did, 24);
|
|
5749
5752
|
document.getElementById('identity-did').title = primary.did || '';
|
|
5750
|
-
document.getElementById('identity-pubkey').textContent = truncate(primary.
|
|
5751
|
-
document.getElementById('identity-pubkey').title = primary.
|
|
5752
|
-
document.getElementById('identity-created').textContent = formatTime(primary.
|
|
5753
|
-
document.getElementById('identity-count').textContent = data.
|
|
5753
|
+
document.getElementById('identity-pubkey').textContent = truncate(primary.public_key, 24);
|
|
5754
|
+
document.getElementById('identity-pubkey').title = primary.public_key || '';
|
|
5755
|
+
document.getElementById('identity-created').textContent = formatTime(primary.created_at);
|
|
5756
|
+
document.getElementById('identity-count').textContent = data.count || '\u2014';
|
|
5754
5757
|
}
|
|
5755
5758
|
|
|
5756
5759
|
async function updateHandshakes() {
|
|
@@ -5759,14 +5762,14 @@ function generateDashboardHTML(options) {
|
|
|
5759
5762
|
|
|
5760
5763
|
apiState.handshakes = data.handshakes || [];
|
|
5761
5764
|
|
|
5762
|
-
document.getElementById('handshake-count').textContent = data.
|
|
5765
|
+
document.getElementById('handshake-count').textContent = data.count || '0';
|
|
5763
5766
|
|
|
5764
5767
|
if (data.handshakes && data.handshakes.length > 0) {
|
|
5765
5768
|
const latest = data.handshakes[0];
|
|
5766
|
-
document.getElementById('handshake-latest').textContent = truncate(latest.
|
|
5767
|
-
document.getElementById('handshake-latest').title = latest.
|
|
5768
|
-
document.getElementById('handshake-tier').textContent = (latest.
|
|
5769
|
-
document.getElementById('handshake-time').textContent = formatTime(latest.
|
|
5769
|
+
document.getElementById('handshake-latest').textContent = truncate(latest.counterparty_id, 20);
|
|
5770
|
+
document.getElementById('handshake-latest').title = latest.counterparty_id || '';
|
|
5771
|
+
document.getElementById('handshake-tier').textContent = (latest.trust_tier || 'Unverified').toUpperCase();
|
|
5772
|
+
document.getElementById('handshake-time').textContent = formatTime(latest.completed_at);
|
|
5770
5773
|
} else {
|
|
5771
5774
|
document.getElementById('handshake-latest').textContent = '\u2014';
|
|
5772
5775
|
document.getElementById('handshake-tier').textContent = 'Unverified';
|
|
@@ -5788,12 +5791,12 @@ function generateDashboardHTML(options) {
|
|
|
5788
5791
|
.map(
|
|
5789
5792
|
(hs) => \`
|
|
5790
5793
|
<div class="table-row">
|
|
5791
|
-
<div class="table-cell strong">\${esc(truncate(hs.
|
|
5792
|
-
<div class="table-cell">\${esc(hs.
|
|
5793
|
-
<div class="table-cell">\${esc(hs.
|
|
5794
|
+
<div class="table-cell strong">\${esc(truncate(hs.counterparty_id, 24))}</div>
|
|
5795
|
+
<div class="table-cell">\${esc(hs.trust_tier || 'Unverified')}</div>
|
|
5796
|
+
<div class="table-cell">\${esc(hs.sovereignty_level || '\u2014')}</div>
|
|
5794
5797
|
<div class="table-cell">\${hs.verified ? 'Yes' : 'No'}</div>
|
|
5795
|
-
<div class="table-cell">\${formatTime(hs.
|
|
5796
|
-
<div class="table-cell">\${formatTime(hs.
|
|
5798
|
+
<div class="table-cell">\${formatTime(hs.completed_at)}</div>
|
|
5799
|
+
<div class="table-cell">\${formatTime(hs.expires_at)}</div>
|
|
5797
5800
|
</div>
|
|
5798
5801
|
\`
|
|
5799
5802
|
)
|
|
@@ -5811,11 +5814,14 @@ function generateDashboardHTML(options) {
|
|
|
5811
5814
|
function renderSHRViewer(shr) {
|
|
5812
5815
|
const viewer = document.getElementById('shr-viewer');
|
|
5813
5816
|
|
|
5814
|
-
if (!shr) {
|
|
5817
|
+
if (!shr || shr.error) {
|
|
5815
5818
|
viewer.innerHTML = '<div class="empty-state">No SHR available</div>';
|
|
5816
5819
|
return;
|
|
5817
5820
|
}
|
|
5818
5821
|
|
|
5822
|
+
// SignedSHR shape: { body: { implementation, instance_id, layers, ... }, signed_by, signature }
|
|
5823
|
+
const body = shr.body || shr;
|
|
5824
|
+
|
|
5819
5825
|
let html = '';
|
|
5820
5826
|
|
|
5821
5827
|
// Implementation
|
|
@@ -5828,15 +5834,15 @@ function generateDashboardHTML(options) {
|
|
|
5828
5834
|
<div class="shr-section-content">
|
|
5829
5835
|
<div class="shr-item">
|
|
5830
5836
|
<div class="shr-key">sanctuary_version:</div>
|
|
5831
|
-
<div class="shr-value">\${esc(
|
|
5837
|
+
<div class="shr-value">\${esc(body.implementation?.sanctuary_version || '\u2014')}</div>
|
|
5832
5838
|
</div>
|
|
5833
5839
|
<div class="shr-item">
|
|
5834
5840
|
<div class="shr-key">node_version:</div>
|
|
5835
|
-
<div class="shr-value">\${esc(
|
|
5841
|
+
<div class="shr-value">\${esc(body.implementation?.node_version || '\u2014')}</div>
|
|
5836
5842
|
</div>
|
|
5837
5843
|
<div class="shr-item">
|
|
5838
5844
|
<div class="shr-key">generated_by:</div>
|
|
5839
|
-
<div class="shr-value">\${esc(
|
|
5845
|
+
<div class="shr-value">\${esc(body.implementation?.generated_by || '\u2014')}</div>
|
|
5840
5846
|
</div>
|
|
5841
5847
|
</div>
|
|
5842
5848
|
</div>
|
|
@@ -5852,22 +5858,22 @@ function generateDashboardHTML(options) {
|
|
|
5852
5858
|
<div class="shr-section-content">
|
|
5853
5859
|
<div class="shr-item">
|
|
5854
5860
|
<div class="shr-key">instance_id:</div>
|
|
5855
|
-
<div class="shr-value">\${esc(truncate(
|
|
5861
|
+
<div class="shr-value">\${esc(truncate(body.instance_id, 20))}</div>
|
|
5856
5862
|
</div>
|
|
5857
5863
|
<div class="shr-item">
|
|
5858
5864
|
<div class="shr-key">generated_at:</div>
|
|
5859
|
-
<div class="shr-value">\${formatTime(
|
|
5865
|
+
<div class="shr-value">\${formatTime(body.generated_at)}</div>
|
|
5860
5866
|
</div>
|
|
5861
5867
|
<div class="shr-item">
|
|
5862
5868
|
<div class="shr-key">expires_at:</div>
|
|
5863
|
-
<div class="shr-value">\${formatTime(
|
|
5869
|
+
<div class="shr-value">\${formatTime(body.expires_at)}</div>
|
|
5864
5870
|
</div>
|
|
5865
5871
|
</div>
|
|
5866
5872
|
</div>
|
|
5867
5873
|
\`;
|
|
5868
5874
|
|
|
5869
5875
|
// Layers
|
|
5870
|
-
if (
|
|
5876
|
+
if (body.layers) {
|
|
5871
5877
|
html += \`<div class="shr-section">
|
|
5872
5878
|
<div class="shr-section-header">
|
|
5873
5879
|
<div class="shr-toggle">\u25BC</div>
|
|
@@ -5876,7 +5882,7 @@ function generateDashboardHTML(options) {
|
|
|
5876
5882
|
<div class="shr-section-content">
|
|
5877
5883
|
\`;
|
|
5878
5884
|
|
|
5879
|
-
for (const [key, layer] of Object.entries(
|
|
5885
|
+
for (const [key, layer] of Object.entries(body.layers)) {
|
|
5880
5886
|
html += \`
|
|
5881
5887
|
<div style="margin-bottom: 12px;">
|
|
5882
5888
|
<div style="color: var(--blue); font-weight: 600; margin-bottom: 4px;">\${esc(key)}</div>
|
|
@@ -11075,11 +11081,57 @@ var TOOL_API_SCOPED = {
|
|
|
11075
11081
|
],
|
|
11076
11082
|
default_action: "redact"
|
|
11077
11083
|
};
|
|
11084
|
+
var REMOTE_INFERENCE_SANITIZE = {
|
|
11085
|
+
id: "remote-inference-sanitize",
|
|
11086
|
+
name: "Remote Inference Sanitization",
|
|
11087
|
+
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.",
|
|
11088
|
+
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.",
|
|
11089
|
+
rules: [
|
|
11090
|
+
{
|
|
11091
|
+
provider: "inference",
|
|
11092
|
+
allow: [
|
|
11093
|
+
"task",
|
|
11094
|
+
"task_description",
|
|
11095
|
+
"current_query",
|
|
11096
|
+
"query",
|
|
11097
|
+
"prompt",
|
|
11098
|
+
"question",
|
|
11099
|
+
"instruction",
|
|
11100
|
+
"output_format",
|
|
11101
|
+
"format",
|
|
11102
|
+
"language",
|
|
11103
|
+
"code_context",
|
|
11104
|
+
// Stripped code snippets for coding tasks
|
|
11105
|
+
"error_message"
|
|
11106
|
+
// For debugging help
|
|
11107
|
+
],
|
|
11108
|
+
redact: [
|
|
11109
|
+
...ALWAYS_REDACT_SECRETS,
|
|
11110
|
+
...PII_PATTERNS,
|
|
11111
|
+
...INTERNAL_STATE_PATTERNS,
|
|
11112
|
+
...HISTORY_PATTERNS,
|
|
11113
|
+
"tool_results",
|
|
11114
|
+
"previous_results",
|
|
11115
|
+
// Additional redactions for remote inference
|
|
11116
|
+
"model_data",
|
|
11117
|
+
"agent_state",
|
|
11118
|
+
"runtime_config",
|
|
11119
|
+
"capabilities",
|
|
11120
|
+
"tool_list"
|
|
11121
|
+
],
|
|
11122
|
+
// Deny patterns — these must NEVER reach the remote model, not even redacted
|
|
11123
|
+
hash: [],
|
|
11124
|
+
summarize: []
|
|
11125
|
+
}
|
|
11126
|
+
],
|
|
11127
|
+
default_action: "deny"
|
|
11128
|
+
};
|
|
11078
11129
|
var TEMPLATES = {
|
|
11079
11130
|
"inference-minimal": INFERENCE_MINIMAL,
|
|
11080
11131
|
"inference-standard": INFERENCE_STANDARD,
|
|
11081
11132
|
"logging-strict": LOGGING_STRICT,
|
|
11082
|
-
"tool-api-scoped": TOOL_API_SCOPED
|
|
11133
|
+
"tool-api-scoped": TOOL_API_SCOPED,
|
|
11134
|
+
"remote-inference-sanitize": REMOTE_INFERENCE_SANITIZE
|
|
11083
11135
|
};
|
|
11084
11136
|
function listTemplateIds() {
|
|
11085
11137
|
return Object.keys(TEMPLATES);
|
|
@@ -12567,6 +12619,101 @@ function createL2HardeningTools(storagePath, auditLog) {
|
|
|
12567
12619
|
// src/index.ts
|
|
12568
12620
|
init_encoding();
|
|
12569
12621
|
|
|
12622
|
+
// src/l2-operational/model-provenance.ts
|
|
12623
|
+
var InMemoryModelProvenanceStore = class {
|
|
12624
|
+
models = /* @__PURE__ */ new Map();
|
|
12625
|
+
primaryModelId = null;
|
|
12626
|
+
declare(provenance) {
|
|
12627
|
+
if (!provenance.model_id) {
|
|
12628
|
+
throw new Error("ModelProvenance requires a model_id");
|
|
12629
|
+
}
|
|
12630
|
+
if (!provenance.model_name) {
|
|
12631
|
+
throw new Error("ModelProvenance requires a model_name");
|
|
12632
|
+
}
|
|
12633
|
+
if (!provenance.provider) {
|
|
12634
|
+
throw new Error("ModelProvenance requires a provider");
|
|
12635
|
+
}
|
|
12636
|
+
this.models.set(provenance.model_id, provenance);
|
|
12637
|
+
if (this.primaryModelId === null) {
|
|
12638
|
+
this.primaryModelId = provenance.model_id;
|
|
12639
|
+
}
|
|
12640
|
+
}
|
|
12641
|
+
get(model_id) {
|
|
12642
|
+
return this.models.get(model_id);
|
|
12643
|
+
}
|
|
12644
|
+
list() {
|
|
12645
|
+
return Array.from(this.models.values());
|
|
12646
|
+
}
|
|
12647
|
+
primary() {
|
|
12648
|
+
if (!this.primaryModelId) return void 0;
|
|
12649
|
+
return this.models.get(this.primaryModelId);
|
|
12650
|
+
}
|
|
12651
|
+
setPrimary(model_id) {
|
|
12652
|
+
if (!this.models.has(model_id)) {
|
|
12653
|
+
throw new Error(`Model ${model_id} not found in store`);
|
|
12654
|
+
}
|
|
12655
|
+
this.primaryModelId = model_id;
|
|
12656
|
+
}
|
|
12657
|
+
};
|
|
12658
|
+
var MODEL_PRESETS = {
|
|
12659
|
+
/**
|
|
12660
|
+
* Claude Opus 4 via Anthropic API (cloud inference, closed weights/source)
|
|
12661
|
+
*/
|
|
12662
|
+
claudeOpus4: () => ({
|
|
12663
|
+
model_id: "claude-opus-4",
|
|
12664
|
+
model_name: "Claude Opus 4",
|
|
12665
|
+
model_version: "4.0",
|
|
12666
|
+
provider: "Anthropic",
|
|
12667
|
+
license: "proprietary",
|
|
12668
|
+
open_weights: false,
|
|
12669
|
+
open_source: false,
|
|
12670
|
+
local_inference: false,
|
|
12671
|
+
declared_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12672
|
+
}),
|
|
12673
|
+
/**
|
|
12674
|
+
* Qwen 3.5 via local inference (open weights, proprietary training)
|
|
12675
|
+
*/
|
|
12676
|
+
qwen35Local: () => ({
|
|
12677
|
+
model_id: "qwen-3.5-35b",
|
|
12678
|
+
model_name: "Qwen 3.5 35B",
|
|
12679
|
+
model_version: "3.5",
|
|
12680
|
+
provider: "Alibaba Cloud",
|
|
12681
|
+
license: "Apache-2.0",
|
|
12682
|
+
open_weights: true,
|
|
12683
|
+
open_source: false,
|
|
12684
|
+
local_inference: true,
|
|
12685
|
+
declared_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12686
|
+
}),
|
|
12687
|
+
/**
|
|
12688
|
+
* Llama 3.3 70B via local inference (open weights and code)
|
|
12689
|
+
*/
|
|
12690
|
+
llama33Local: () => ({
|
|
12691
|
+
model_id: "llama-3.3-70b-instruct",
|
|
12692
|
+
model_name: "Llama 3.3 70B Instruct",
|
|
12693
|
+
model_version: "3.3",
|
|
12694
|
+
provider: "Meta",
|
|
12695
|
+
license: "Apache-2.0",
|
|
12696
|
+
open_weights: true,
|
|
12697
|
+
open_source: true,
|
|
12698
|
+
local_inference: true,
|
|
12699
|
+
declared_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12700
|
+
}),
|
|
12701
|
+
/**
|
|
12702
|
+
* Mistral 7B (open weights, open code, local inference)
|
|
12703
|
+
*/
|
|
12704
|
+
mistral7bLocal: () => ({
|
|
12705
|
+
model_id: "mistral-7b-instruct",
|
|
12706
|
+
model_name: "Mistral 7B Instruct",
|
|
12707
|
+
model_version: "7",
|
|
12708
|
+
provider: "Mistral AI",
|
|
12709
|
+
license: "Apache-2.0",
|
|
12710
|
+
open_weights: true,
|
|
12711
|
+
open_source: true,
|
|
12712
|
+
local_inference: true,
|
|
12713
|
+
declared_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12714
|
+
})
|
|
12715
|
+
};
|
|
12716
|
+
|
|
12570
12717
|
// src/storage/memory.ts
|
|
12571
12718
|
var MemoryStorage = class {
|
|
12572
12719
|
store = /* @__PURE__ */ new Map();
|
|
@@ -13088,6 +13235,6 @@ async function createSanctuaryServer(options) {
|
|
|
13088
13235
|
return { server, config };
|
|
13089
13236
|
}
|
|
13090
13237
|
|
|
13091
|
-
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 };
|
|
13238
|
+
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 };
|
|
13092
13239
|
//# sourceMappingURL=index.js.map
|
|
13093
13240
|
//# sourceMappingURL=index.js.map
|