@sanctuary-framework/mcp-server 0.8.0 → 0.10.1
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 +6363 -1915
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +6368 -1920
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +1604 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +403 -4
- package/dist/index.d.ts +403 -4
- package/dist/index.js +1600 -73
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,6 @@ import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
|
6
6
|
interface SanctuaryConfig {
|
|
7
7
|
version: string;
|
|
8
8
|
storage_path: string;
|
|
9
|
-
principal_id?: string;
|
|
10
9
|
state: {
|
|
11
10
|
encryption: "aes-256-gcm";
|
|
12
11
|
key_protection: "passphrase" | "hardware-key" | "none";
|
|
@@ -146,17 +145,49 @@ interface AuditEntry {
|
|
|
146
145
|
result: "success" | "failure";
|
|
147
146
|
details?: Record<string, unknown>;
|
|
148
147
|
}
|
|
148
|
+
interface AuditLogConfig {
|
|
149
|
+
/** Maximum total size of stored audit entries in bytes. Default: 100 MB. */
|
|
150
|
+
maxTotalSizeBytes?: number;
|
|
151
|
+
/** Maximum number of stored audit entry files to retain. Default: 100_000. */
|
|
152
|
+
maxEntries?: number;
|
|
153
|
+
}
|
|
149
154
|
declare class AuditLog {
|
|
150
155
|
private storage;
|
|
151
156
|
private encryptionKey;
|
|
152
157
|
private entries;
|
|
153
158
|
private counter;
|
|
154
|
-
|
|
159
|
+
private readonly maxTotalSizeBytes;
|
|
160
|
+
private readonly maxEntries;
|
|
161
|
+
private rotationInFlight;
|
|
162
|
+
private readonly pendingWrites;
|
|
163
|
+
constructor(storage: StorageBackend, masterKey: Uint8Array, config?: AuditLogConfig);
|
|
155
164
|
/**
|
|
156
165
|
* Append an audit entry.
|
|
166
|
+
*
|
|
167
|
+
* The on-disk persist is async and tracked via `pendingWrites`. Long-lived
|
|
168
|
+
* callers (the main MCP server) can ignore that tracking and let writes
|
|
169
|
+
* drain naturally. Short-lived callers — the `sanctuary secrets` CLI which
|
|
170
|
+
* `process.exit()`s immediately after returning from a broker mutation —
|
|
171
|
+
* MUST await `flush()` before exiting, or in-flight writes get killed
|
|
172
|
+
* with the event loop and the entry is silently lost. That was the
|
|
173
|
+
* v0.10.0-rc.2 soak failure mode where `secrets audit` returned empty
|
|
174
|
+
* after a clean 7-verb lifecycle.
|
|
157
175
|
*/
|
|
158
176
|
append(layer: AuditEntry["layer"], operation: string, identityId: string, details?: Record<string, unknown>, result?: "success" | "failure"): void;
|
|
177
|
+
/**
|
|
178
|
+
* Wait for every in-flight `append()` persist (and its rotation pass) to
|
|
179
|
+
* settle. Safe to call multiple times — newly-appended entries during a
|
|
180
|
+
* flush are also awaited. Re-entrant only at the granularity of "drain
|
|
181
|
+
* everything queued so far". Short-lived CLIs MUST call this before
|
|
182
|
+
* `process.exit()` to keep audit writes durable.
|
|
183
|
+
*/
|
|
184
|
+
flush(): Promise<void>;
|
|
159
185
|
private persistEntry;
|
|
186
|
+
/**
|
|
187
|
+
* Prune oldest audit entries when storage exceeds configured limits.
|
|
188
|
+
* Entries are sorted by key (timestamp-based) so oldest are pruned first.
|
|
189
|
+
*/
|
|
190
|
+
private maybeRotate;
|
|
160
191
|
/**
|
|
161
192
|
* Query the audit log with filtering.
|
|
162
193
|
*/
|
|
@@ -762,7 +793,18 @@ declare class StateStore {
|
|
|
762
793
|
private masterKey;
|
|
763
794
|
private versionCache;
|
|
764
795
|
private contentHashes;
|
|
796
|
+
private namespaceKeyCache;
|
|
797
|
+
private static readonly KEY_CACHE_TTL_MS;
|
|
798
|
+
private static readonly KEY_CACHE_MAX_ENTRIES;
|
|
765
799
|
constructor(storage: StorageBackend, masterKey: Uint8Array);
|
|
800
|
+
/**
|
|
801
|
+
* Get or derive a namespace encryption key, with caching.
|
|
802
|
+
* Cache entries expire after 15 minutes and are evicted LRU when
|
|
803
|
+
* the cache exceeds 128 entries.
|
|
804
|
+
*/
|
|
805
|
+
private getNamespaceKey;
|
|
806
|
+
/** Invalidate all cached namespace keys (call on master key rotation). */
|
|
807
|
+
invalidateKeyCache(): void;
|
|
766
808
|
private versionKey;
|
|
767
809
|
/**
|
|
768
810
|
* Get or initialize the content hash map for a namespace.
|
|
@@ -906,6 +948,10 @@ declare class IdentityManager {
|
|
|
906
948
|
getDefault(): StoredIdentity | undefined;
|
|
907
949
|
getPrimaryIdentityId(): string | null;
|
|
908
950
|
list(): PublicIdentity[];
|
|
951
|
+
/** List identities with rotation count (for dashboard display). */
|
|
952
|
+
listWithRotationCount(): Array<PublicIdentity & {
|
|
953
|
+
rotation_count: number;
|
|
954
|
+
}>;
|
|
909
955
|
}
|
|
910
956
|
|
|
911
957
|
/**
|
|
@@ -1185,7 +1231,7 @@ declare class PolicyStore {
|
|
|
1185
1231
|
*/
|
|
1186
1232
|
type LayerStatus = "active" | "degraded" | "inactive";
|
|
1187
1233
|
type DegradationSeverity = "info" | "warning" | "critical";
|
|
1188
|
-
type DegradationCode = "NO_TEE" | "PROCESS_ISOLATION_ONLY" | "COMMITMENT_ONLY" | "NO_ZK_PROOFS" | "SELF_REPORTED_ATTESTATION" | "NO_SELECTIVE_DISCLOSURE" | "BASIC_SYBIL_ONLY";
|
|
1234
|
+
type DegradationCode = "NO_TEE" | "PROCESS_ISOLATION_ONLY" | "COMMITMENT_ONLY" | "NO_ZK_PROOFS" | "SELF_REPORTED_ATTESTATION" | "NO_SELECTIVE_DISCLOSURE" | "BASIC_SYBIL_ONLY" | "NO_REPUTATION_HISTORY" | "LOW_TIER_DOMINANCE" | "STALE_REPUTATION" | "DISPUTE_ON_RECORD" | "NO_VERASCORE_LINK";
|
|
1189
1235
|
interface SHRLayerL1 {
|
|
1190
1236
|
status: LayerStatus;
|
|
1191
1237
|
encryption: string;
|
|
@@ -1478,6 +1524,23 @@ interface ReputationSummary {
|
|
|
1478
1524
|
};
|
|
1479
1525
|
aggregate_metrics: Record<string, MetricAggregate>;
|
|
1480
1526
|
}
|
|
1527
|
+
/**
|
|
1528
|
+
* L4 attestation evidence summary for the SHR degradation emitter and the
|
|
1529
|
+
* dashboard evidence widget. Derived from the stored attestations; does not
|
|
1530
|
+
* include Verascore-link state (tracked separately via audit log).
|
|
1531
|
+
*/
|
|
1532
|
+
interface L4AttestationSummary {
|
|
1533
|
+
/** Total number of attestations covered by the summary */
|
|
1534
|
+
attestation_count: number;
|
|
1535
|
+
/** Count of attestations at each sovereignty tier */
|
|
1536
|
+
tier_distribution: Record<SovereigntyTier, number>;
|
|
1537
|
+
/** ISO timestamp of the most recent attestation, or null if none */
|
|
1538
|
+
most_recent_attestation_at: string | null;
|
|
1539
|
+
/** Count of attestations with outcome_result === "disputed" */
|
|
1540
|
+
dispute_count: number;
|
|
1541
|
+
/** Count of attestations per context label */
|
|
1542
|
+
context_breakdown: Record<string, number>;
|
|
1543
|
+
}
|
|
1481
1544
|
/** Portable reputation bundle */
|
|
1482
1545
|
interface ReputationBundle {
|
|
1483
1546
|
version: "SANCTUARY_REP_V1";
|
|
@@ -1557,6 +1620,20 @@ declare class ReputationStore {
|
|
|
1557
1620
|
* Create a principal's guarantee for a new agent.
|
|
1558
1621
|
*/
|
|
1559
1622
|
createGuarantee(principalIdentity: StoredIdentity, agentDid: string, scope: string, durationSeconds: number, identityEncryptionKey: Uint8Array, maxLiability?: number): Promise<Guarantee>;
|
|
1623
|
+
/**
|
|
1624
|
+
* Summarize attestations for the L4 degradation emitter and dashboard widget.
|
|
1625
|
+
*
|
|
1626
|
+
* Returns aggregate evidence about the identity's reputation state —
|
|
1627
|
+
* counts, tier distribution, recency, dispute counts, context coverage —
|
|
1628
|
+
* without exposing raw attestations. The caller combines this with an
|
|
1629
|
+
* audit-log check for Verascore link state to produce the final
|
|
1630
|
+
* `L4Evidence` struct consumed by the SHR generator.
|
|
1631
|
+
*
|
|
1632
|
+
* @param participantDid - If provided, only count attestations where the
|
|
1633
|
+
* `participant_did` matches. If omitted, covers all attestations in the
|
|
1634
|
+
* store.
|
|
1635
|
+
*/
|
|
1636
|
+
summarizeForSHR(participantDid?: string): Promise<L4AttestationSummary>;
|
|
1560
1637
|
/**
|
|
1561
1638
|
* Load attestations for tier-weighted scoring.
|
|
1562
1639
|
* Applies basic context/counterparty filtering, returns full StoredAttestations
|
|
@@ -1567,6 +1644,11 @@ declare class ReputationStore {
|
|
|
1567
1644
|
counterparty_did?: string;
|
|
1568
1645
|
}): Promise<StoredAttestation[]>;
|
|
1569
1646
|
private loadAll;
|
|
1647
|
+
/**
|
|
1648
|
+
* Cursor-based async iterator that loads attestations in pages.
|
|
1649
|
+
* Prevents OOM at 100K+ records by reading and decrypting in batches.
|
|
1650
|
+
*/
|
|
1651
|
+
loadAllPaginated(pageSize?: number): AsyncGenerator<StoredAttestation[]>;
|
|
1570
1652
|
}
|
|
1571
1653
|
|
|
1572
1654
|
/**
|
|
@@ -2664,12 +2746,56 @@ declare function loadPrincipalPolicy(storagePath: string): Promise<PrincipalPoli
|
|
|
2664
2746
|
* signs it with a specified identity, and returns the complete signed SHR.
|
|
2665
2747
|
*/
|
|
2666
2748
|
|
|
2749
|
+
/**
|
|
2750
|
+
* Observed L4 reputation state used by the emitter. Callers gather these
|
|
2751
|
+
* facts from the reputation store + audit log; the emitter derives
|
|
2752
|
+
* degradations from them. Keeping evidence as plain data keeps the
|
|
2753
|
+
* generator synchronous and easy to test.
|
|
2754
|
+
*/
|
|
2755
|
+
interface L4Evidence {
|
|
2756
|
+
/** Total attestations attributed to the signing identity */
|
|
2757
|
+
attestation_count: number;
|
|
2758
|
+
/** Count of attestations at each sovereignty tier */
|
|
2759
|
+
tier_distribution: Record<SovereigntyTier, number>;
|
|
2760
|
+
/** ISO timestamp of most recent attestation, or null when none exist */
|
|
2761
|
+
most_recent_attestation_at: string | null;
|
|
2762
|
+
/** Count of attestations with outcome_result === "disputed" */
|
|
2763
|
+
dispute_count: number;
|
|
2764
|
+
/** Attestation count per context label (optional; used by dashboard) */
|
|
2765
|
+
context_breakdown?: Record<string, number>;
|
|
2766
|
+
/**
|
|
2767
|
+
* True iff the `reputation_publish` tool has been successfully invoked
|
|
2768
|
+
* for this identity (i.e., there is at least one success audit entry).
|
|
2769
|
+
*/
|
|
2770
|
+
verascore_linked: boolean;
|
|
2771
|
+
/**
|
|
2772
|
+
* Optional overrides for the emitter thresholds. Defaults apply when
|
|
2773
|
+
* omitted or when a field is missing.
|
|
2774
|
+
*/
|
|
2775
|
+
thresholds?: {
|
|
2776
|
+
freshness_window_days?: number;
|
|
2777
|
+
low_tier_dominance_threshold?: number;
|
|
2778
|
+
};
|
|
2779
|
+
}
|
|
2667
2780
|
interface SHRGeneratorOptions {
|
|
2668
2781
|
config: SanctuaryConfig;
|
|
2669
2782
|
identityManager: IdentityManager;
|
|
2670
2783
|
masterKey: Uint8Array;
|
|
2671
2784
|
/** Override validity window (milliseconds). Default: 1 hour. */
|
|
2672
2785
|
validityMs?: number;
|
|
2786
|
+
/**
|
|
2787
|
+
* Optional L4 reputation evidence. When provided, the generator emits
|
|
2788
|
+
* L4 degradations (NO_REPUTATION_HISTORY, LOW_TIER_DOMINANCE,
|
|
2789
|
+
* STALE_REPUTATION, DISPUTE_ON_RECORD, NO_VERASCORE_LINK) accordingly
|
|
2790
|
+
* and downgrades `layers.l4.status` to `degraded` when any fire.
|
|
2791
|
+
* When omitted, L4 is left at "active" (backward-compatible).
|
|
2792
|
+
*/
|
|
2793
|
+
l4Evidence?: L4Evidence;
|
|
2794
|
+
/**
|
|
2795
|
+
* Clock override for deterministic testing of staleness behavior.
|
|
2796
|
+
* Defaults to the current wall clock.
|
|
2797
|
+
*/
|
|
2798
|
+
now?: Date;
|
|
2673
2799
|
}
|
|
2674
2800
|
/**
|
|
2675
2801
|
* Generate and sign a Sovereignty Health Report.
|
|
@@ -3364,6 +3490,279 @@ declare function createBridgeCommitment(outcome: ConcordiaOutcome, identity: Sto
|
|
|
3364
3490
|
*/
|
|
3365
3491
|
declare function verifyBridgeCommitment(commitment: BridgeCommitment, outcome: ConcordiaOutcome, committerPublicKey: Uint8Array): BridgeVerificationResult;
|
|
3366
3492
|
|
|
3493
|
+
/**
|
|
3494
|
+
* Sanctuary Dashboard — Protection Snapshot Aggregator
|
|
3495
|
+
*
|
|
3496
|
+
* Pulls unified protection state from the existing subsystems
|
|
3497
|
+
* (IdentityManager, AuditLog, ClientManager, BaselineTracker, policy)
|
|
3498
|
+
* and returns a single typed snapshot consumed by the API + HTML.
|
|
3499
|
+
*
|
|
3500
|
+
* The aggregator is the single source of truth for dashboard state.
|
|
3501
|
+
* It is pure (no I/O beyond what the injected sources already do) and
|
|
3502
|
+
* safe to call repeatedly — callers control freshness.
|
|
3503
|
+
*/
|
|
3504
|
+
|
|
3505
|
+
type LayerState = "full" | "degraded" | "compromised";
|
|
3506
|
+
type OverallStatus = "healthy" | "degraded" | "compromised";
|
|
3507
|
+
interface AgentInfo {
|
|
3508
|
+
display_name: string;
|
|
3509
|
+
did: string | null;
|
|
3510
|
+
did_fingerprint: string | null;
|
|
3511
|
+
identity_count: number;
|
|
3512
|
+
primary_identity_id: string | null;
|
|
3513
|
+
}
|
|
3514
|
+
interface L1Status {
|
|
3515
|
+
label: string;
|
|
3516
|
+
state: LayerState;
|
|
3517
|
+
headline: string;
|
|
3518
|
+
encryption: string;
|
|
3519
|
+
injection_blocked_today: number;
|
|
3520
|
+
memory_attest_ready: boolean;
|
|
3521
|
+
}
|
|
3522
|
+
interface L2Status {
|
|
3523
|
+
label: string;
|
|
3524
|
+
state: LayerState;
|
|
3525
|
+
headline: string;
|
|
3526
|
+
isolation_type: string;
|
|
3527
|
+
tee_available: boolean;
|
|
3528
|
+
tee_status: string;
|
|
3529
|
+
sandbox_status: string;
|
|
3530
|
+
}
|
|
3531
|
+
interface L3Status {
|
|
3532
|
+
label: string;
|
|
3533
|
+
state: LayerState;
|
|
3534
|
+
headline: string;
|
|
3535
|
+
did_active: boolean;
|
|
3536
|
+
vc_count: number;
|
|
3537
|
+
proofs_today: number;
|
|
3538
|
+
}
|
|
3539
|
+
/** A single L4 degradation surfaced to the dashboard widget. */
|
|
3540
|
+
interface L4ActiveDegradation {
|
|
3541
|
+
code: string;
|
|
3542
|
+
severity: "info" | "warning" | "critical";
|
|
3543
|
+
description: string;
|
|
3544
|
+
mitigation?: string;
|
|
3545
|
+
}
|
|
3546
|
+
interface L4Status {
|
|
3547
|
+
label: string;
|
|
3548
|
+
state: LayerState;
|
|
3549
|
+
headline: string;
|
|
3550
|
+
score: number | null;
|
|
3551
|
+
profile_url: string | null;
|
|
3552
|
+
claim_cta: string | null;
|
|
3553
|
+
/**
|
|
3554
|
+
* Evidence surfaced under the L4 tile so users can tell what underlies
|
|
3555
|
+
* the reputation state. Null when no reputation store is wired in
|
|
3556
|
+
* (standalone mode, some tests).
|
|
3557
|
+
*/
|
|
3558
|
+
evidence?: {
|
|
3559
|
+
attestation_count: number;
|
|
3560
|
+
tier_distribution: Record<SovereigntyTier, number>;
|
|
3561
|
+
most_recent_attestation_at: string | null;
|
|
3562
|
+
dispute_count: number;
|
|
3563
|
+
context_breakdown: Record<string, number>;
|
|
3564
|
+
verascore_linked: boolean;
|
|
3565
|
+
};
|
|
3566
|
+
/**
|
|
3567
|
+
* SHR-aligned L4 layer score (0-100) when evidence is available.
|
|
3568
|
+
* Computed with the same scoring model the gateway adapter uses so
|
|
3569
|
+
* counterparties and the dashboard agree on the number.
|
|
3570
|
+
*/
|
|
3571
|
+
layer_score?: number;
|
|
3572
|
+
/** Active L4 degradations rendered under the widget. */
|
|
3573
|
+
active_degradations?: L4ActiveDegradation[];
|
|
3574
|
+
}
|
|
3575
|
+
interface ActivityEntry {
|
|
3576
|
+
timestamp: string;
|
|
3577
|
+
tool: string;
|
|
3578
|
+
server: string;
|
|
3579
|
+
tier: 1 | 2 | 3;
|
|
3580
|
+
result: "allowed" | "denied" | "approved" | "pending";
|
|
3581
|
+
}
|
|
3582
|
+
interface PendingApproval {
|
|
3583
|
+
id: string;
|
|
3584
|
+
operation: string;
|
|
3585
|
+
tier: 1 | 2;
|
|
3586
|
+
reason: string;
|
|
3587
|
+
created_at: string;
|
|
3588
|
+
}
|
|
3589
|
+
interface UpstreamServerStatus {
|
|
3590
|
+
name: string;
|
|
3591
|
+
state: string;
|
|
3592
|
+
tool_count: number;
|
|
3593
|
+
error?: string;
|
|
3594
|
+
}
|
|
3595
|
+
interface ProtectionSnapshot {
|
|
3596
|
+
overall: {
|
|
3597
|
+
status: OverallStatus;
|
|
3598
|
+
light: "green" | "yellow" | "red";
|
|
3599
|
+
headline: string;
|
|
3600
|
+
};
|
|
3601
|
+
agent: AgentInfo;
|
|
3602
|
+
layers: {
|
|
3603
|
+
l1: L1Status;
|
|
3604
|
+
l2: L2Status;
|
|
3605
|
+
l3: L3Status;
|
|
3606
|
+
l4: L4Status;
|
|
3607
|
+
};
|
|
3608
|
+
activity: ActivityEntry[];
|
|
3609
|
+
pending_approvals: PendingApproval[];
|
|
3610
|
+
audit: AuditEntry[];
|
|
3611
|
+
upstream_servers: UpstreamServerStatus[];
|
|
3612
|
+
mode: "co-located" | "standalone";
|
|
3613
|
+
server_version: string;
|
|
3614
|
+
generated_at: string;
|
|
3615
|
+
}
|
|
3616
|
+
interface ReputationLookup {
|
|
3617
|
+
score: number | null;
|
|
3618
|
+
profile_url: string | null;
|
|
3619
|
+
}
|
|
3620
|
+
interface AggregatorSources {
|
|
3621
|
+
mode: "co-located" | "standalone";
|
|
3622
|
+
server_version: string;
|
|
3623
|
+
identityManager?: IdentityManager;
|
|
3624
|
+
auditLog?: AuditLog;
|
|
3625
|
+
clientManager?: ClientManager;
|
|
3626
|
+
baseline?: BaselineTracker;
|
|
3627
|
+
policy?: PrincipalPolicy;
|
|
3628
|
+
activity?: ActivityEntry[];
|
|
3629
|
+
pendingApprovals?: PendingApproval[];
|
|
3630
|
+
reputation?: ReputationLookup;
|
|
3631
|
+
teeAvailable?: boolean;
|
|
3632
|
+
/**
|
|
3633
|
+
* Pre-computed L4 reputation evidence for the primary identity. When
|
|
3634
|
+
* present the dashboard renders the evidence widget under the L4 tile
|
|
3635
|
+
* and computes an SHR-aligned L4 layer score. Providers build this
|
|
3636
|
+
* via `gatherL4Evidence` from `shr/tools.ts`.
|
|
3637
|
+
*/
|
|
3638
|
+
l4Evidence?: L4Evidence;
|
|
3639
|
+
/** Clock override for deterministic staleness rendering in tests. */
|
|
3640
|
+
l4Now?: Date;
|
|
3641
|
+
}
|
|
3642
|
+
/**
|
|
3643
|
+
* Pull a unified protection snapshot from the injected sources.
|
|
3644
|
+
*
|
|
3645
|
+
* Any missing source degrades gracefully — standalone mode may have
|
|
3646
|
+
* no ClientManager or live activity feed, for example, and the
|
|
3647
|
+
* aggregator returns a coherent snapshot with empty arrays rather
|
|
3648
|
+
* than throwing.
|
|
3649
|
+
*/
|
|
3650
|
+
declare function getProtectionSnapshot(sources: AggregatorSources): Promise<ProtectionSnapshot>;
|
|
3651
|
+
|
|
3652
|
+
/**
|
|
3653
|
+
* Sanctuary Dashboard — HTTP API + SSE
|
|
3654
|
+
*
|
|
3655
|
+
* Request router for the unified dashboard. Pure functions that
|
|
3656
|
+
* take a request + sources and produce a response so the transport
|
|
3657
|
+
* layer (node:http) and tests can exercise the same code paths.
|
|
3658
|
+
*/
|
|
3659
|
+
|
|
3660
|
+
interface ApprovalHandlers {
|
|
3661
|
+
allow: (id: string) => Promise<boolean>;
|
|
3662
|
+
deny: (id: string) => Promise<boolean>;
|
|
3663
|
+
}
|
|
3664
|
+
interface StreamEvent {
|
|
3665
|
+
type: "snapshot" | "activity" | "approval";
|
|
3666
|
+
data: unknown;
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
/**
|
|
3670
|
+
* Sanctuary Dashboard — HTTP Server
|
|
3671
|
+
*
|
|
3672
|
+
* Thin wrapper around node:http that wires the request handler
|
|
3673
|
+
* from api.ts. No Express. Listens on 127.0.0.1 by default.
|
|
3674
|
+
*
|
|
3675
|
+
* Exposes a minimal event emitter (publish / subscribe) so callers
|
|
3676
|
+
* can push live activity + approval events to SSE clients without
|
|
3677
|
+
* the server layer needing to know about aggregator internals.
|
|
3678
|
+
*/
|
|
3679
|
+
|
|
3680
|
+
interface DashboardServerOptions {
|
|
3681
|
+
port?: number;
|
|
3682
|
+
host?: string;
|
|
3683
|
+
authToken?: string;
|
|
3684
|
+
mode: "co-located" | "standalone";
|
|
3685
|
+
sources: AggregatorSources;
|
|
3686
|
+
approvals?: ApprovalHandlers;
|
|
3687
|
+
}
|
|
3688
|
+
interface DashboardHandle {
|
|
3689
|
+
url: string;
|
|
3690
|
+
port: number;
|
|
3691
|
+
host: string;
|
|
3692
|
+
stop: () => Promise<void>;
|
|
3693
|
+
/** Push an event to all connected SSE clients. */
|
|
3694
|
+
publish: (event: StreamEvent) => void;
|
|
3695
|
+
/**
|
|
3696
|
+
* Push a fresh activity entry. Exposes a simple shortcut so callers
|
|
3697
|
+
* (e.g. the Sanctuary proxy / upstream clients) can report tool calls
|
|
3698
|
+
* without constructing a StreamEvent themselves.
|
|
3699
|
+
*/
|
|
3700
|
+
publishActivity: (entry: ActivityEntry) => void;
|
|
3701
|
+
/** Push a new pending approval (already added by the approval channel). */
|
|
3702
|
+
publishApproval: (approval: PendingApproval) => void;
|
|
3703
|
+
}
|
|
3704
|
+
declare function startDashboardServer(options: DashboardServerOptions): Promise<DashboardHandle>;
|
|
3705
|
+
|
|
3706
|
+
/**
|
|
3707
|
+
* Sanctuary Dashboard — Single-Page HTML
|
|
3708
|
+
*
|
|
3709
|
+
* Hero shield + four layer cards + live activity feed + approval queue +
|
|
3710
|
+
* audit trail. Vanilla HTML/CSS/JS in one string, matching the convention
|
|
3711
|
+
* established by server/src/cocoon/fortress-view.ts.
|
|
3712
|
+
*
|
|
3713
|
+
* The initial snapshot is embedded server-side so the page renders
|
|
3714
|
+
* correctly without JavaScript. Live updates layer on via SSE + REST.
|
|
3715
|
+
*/
|
|
3716
|
+
|
|
3717
|
+
/** Hero copy. Change here if we ever A/B test. */
|
|
3718
|
+
declare const HERO_COPY = "Your agent is protected.";
|
|
3719
|
+
interface DashboardHTMLOptions {
|
|
3720
|
+
snapshot: ProtectionSnapshot;
|
|
3721
|
+
authToken?: string;
|
|
3722
|
+
}
|
|
3723
|
+
declare function renderDashboardHTML(options: DashboardHTMLOptions): string;
|
|
3724
|
+
|
|
3725
|
+
/**
|
|
3726
|
+
* Sanctuary Sovereignty Dashboard — public surface.
|
|
3727
|
+
*
|
|
3728
|
+
* Consumers import `startDashboard` to bring up the hero-shield UI
|
|
3729
|
+
* on port 3501 (default). The rest of the exports are types + utilities
|
|
3730
|
+
* for tests and callers that want to wire in live events.
|
|
3731
|
+
*/
|
|
3732
|
+
|
|
3733
|
+
interface StartDashboardOptions {
|
|
3734
|
+
port?: number;
|
|
3735
|
+
host?: string;
|
|
3736
|
+
authToken?: string;
|
|
3737
|
+
mode: "co-located" | "standalone";
|
|
3738
|
+
serverVersion: string;
|
|
3739
|
+
auditLog?: AuditLog;
|
|
3740
|
+
identityManager?: IdentityManager;
|
|
3741
|
+
clientManager?: ClientManager;
|
|
3742
|
+
baseline?: BaselineTracker;
|
|
3743
|
+
policy?: PrincipalPolicy;
|
|
3744
|
+
reputation?: ReputationLookup;
|
|
3745
|
+
teeAvailable?: boolean;
|
|
3746
|
+
approvals?: ApprovalHandlers;
|
|
3747
|
+
/** Seed activity entries (most recent first). Runtime entries arrive via publishActivity. */
|
|
3748
|
+
initialActivity?: ActivityEntry[];
|
|
3749
|
+
/** Seed pending approvals. Runtime approvals arrive via publishApproval. */
|
|
3750
|
+
initialPendingApprovals?: PendingApproval[];
|
|
3751
|
+
/**
|
|
3752
|
+
* Pre-computed L4 reputation evidence. When provided the dashboard
|
|
3753
|
+
* renders the L4 evidence widget (attestation count, tier distribution,
|
|
3754
|
+
* disputes, freshness, active degradations). Typically supplied by the
|
|
3755
|
+
* server after L4 tools are constructed.
|
|
3756
|
+
*/
|
|
3757
|
+
l4Evidence?: L4Evidence;
|
|
3758
|
+
}
|
|
3759
|
+
/**
|
|
3760
|
+
* High-level entry point used by callers (CLI, standalone service).
|
|
3761
|
+
* Returns a DashboardHandle that exposes `stop()` and `publish*`
|
|
3762
|
+
* helpers for driving live updates.
|
|
3763
|
+
*/
|
|
3764
|
+
declare function startDashboard(options: StartDashboardOptions): Promise<DashboardHandle>;
|
|
3765
|
+
|
|
3367
3766
|
/**
|
|
3368
3767
|
* Sanctuary MCP Server — Main Entry Point
|
|
3369
3768
|
*
|
|
@@ -3397,4 +3796,4 @@ declare function createSanctuaryServer(options?: {
|
|
|
3397
3796
|
storage?: StorageBackend;
|
|
3398
3797
|
}): Promise<SanctuaryServer>;
|
|
3399
3798
|
|
|
3400
|
-
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, ClientManager, CommitmentStore, type ConcordiaOutcome, type ConnectionState, 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, ProxyRouter, type ProxyRouterOptions, ReputationStore, type SHRBody, type SHRGeneratorOptions, type SHRVerificationResult, type SanctuaryConfig, type SanctuaryServer, type SignedAttestation, type SignedSHR, type SovereigntyProfile, SovereigntyProfileStore, type SovereigntyProfileUpdate, type SovereigntyTier, StateStore, StderrApprovalChannel, TIER_WEIGHTS, type TierMetadata, type TieredAttestation, type UpstreamConnection, type UpstreamServer, type UpstreamTool, WebhookApprovalChannel, type WebhookCallbackPayload, type WebhookConfig, type WebhookPayload, type ZKProofOfKnowledge, type ZKRangeProof, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createDefaultProfile, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, filterContext, generateAttestation, generateSHR, generateSystemPrompt, getTemplate, initiateHandshake, listTemplateIds, loadConfig, loadPrincipalPolicy, recommendPolicy, resolveTier, respondToHandshake, signPayload, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
|
|
3799
|
+
export { ATTESTATION_VERSION, type ActivityEntry, type AggregatorSources, ApprovalGate, type ApprovalHandlers, type AttestationBody, type AttestationVerificationResult, AuditLog, AutoApproveChannel, BaselineTracker, type BridgeAttestationRequest, type BridgeAttestationResult, type BridgeCommitment, type BridgeVerificationResult, TEMPLATES as CONTEXT_GATE_TEMPLATES, CallbackApprovalChannel, ClientManager, CommitmentStore, type ConcordiaOutcome, type ConnectionState, type ContextAction, type ContextFilterResult, ContextGateEnforcer, type ContextGatePolicy, ContextGatePolicyStore, type ContextGateRule, type ContextGateTemplate, DashboardApprovalChannel, type DashboardConfig, type DashboardHandle, type DashboardServerOptions, type DetectionResult, type EnforcerConfig, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, HERO_COPY, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, InMemoryModelProvenanceStore, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, type L1Status, type L2Status, type L3Status, type L4Status, MODEL_PRESETS, MemoryStorage, type ModelProvenance, type ModelProvenanceStore, type PedersenCommitment, type PeerTrustEvaluation, type PendingApproval, type PolicyRecommendation, PolicyStore, type PrincipalPolicy, type ProtectionSnapshot, type ProviderCategory, ProxyRouter, type ProxyRouterOptions, type ReputationLookup, ReputationStore, type SHRBody, type SHRGeneratorOptions, type SHRVerificationResult, type SanctuaryConfig, type SanctuaryServer, type SignedAttestation, type SignedSHR, type SovereigntyProfile, SovereigntyProfileStore, type SovereigntyProfileUpdate, type SovereigntyTier, type StartDashboardOptions, StateStore, StderrApprovalChannel, type StreamEvent, TIER_WEIGHTS, type TierMetadata, type TieredAttestation, type UpstreamConnection, type UpstreamServer, type UpstreamTool, WebhookApprovalChannel, type WebhookCallbackPayload, type WebhookConfig, type WebhookPayload, type ZKProofOfKnowledge, type ZKRangeProof, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createDefaultProfile, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, filterContext, generateAttestation, generateSHR, generateSystemPrompt, getProtectionSnapshot, getTemplate, initiateHandshake, listTemplateIds, loadConfig, loadPrincipalPolicy, recommendPolicy, renderDashboardHTML, resolveTier, respondToHandshake, signPayload, startDashboard, startDashboardServer, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
|