@sanctuary-framework/mcp-server 1.2.0 → 1.2.2

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.
Files changed (36) hide show
  1. package/dist/cli.cjs +1952 -405
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/cli.js +1953 -406
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.cjs +1646 -305
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +105 -18
  8. package/dist/index.d.ts +105 -18
  9. package/dist/index.js +1646 -306
  10. package/dist/index.js.map +1 -1
  11. package/dist/templates/coding-assistant/commitments.json +14 -0
  12. package/dist/templates/coding-assistant/defaults.json +34 -0
  13. package/dist/templates/coding-assistant/onboarding.md +24 -0
  14. package/dist/templates/coding-assistant/policy.md +1 -0
  15. package/dist/templates/coding-assistant/template.json +23 -0
  16. package/dist/templates/handoff-coordinator/commitments.json +14 -0
  17. package/dist/templates/handoff-coordinator/defaults.json +10 -0
  18. package/dist/templates/handoff-coordinator/onboarding.md +23 -0
  19. package/dist/templates/handoff-coordinator/policy.md +1 -0
  20. package/dist/templates/handoff-coordinator/template.json +17 -0
  21. package/dist/templates/ops-runner/commitments.json +14 -0
  22. package/dist/templates/ops-runner/defaults.json +12 -0
  23. package/dist/templates/ops-runner/onboarding.md +25 -0
  24. package/dist/templates/ops-runner/policy.md +1 -0
  25. package/dist/templates/ops-runner/template.json +16 -0
  26. package/dist/templates/planner/commitments.json +9 -0
  27. package/dist/templates/planner/defaults.json +10 -0
  28. package/dist/templates/planner/onboarding.md +22 -0
  29. package/dist/templates/planner/policy.md +1 -0
  30. package/dist/templates/planner/template.json +8 -0
  31. package/dist/templates/research-assistant/commitments.json +9 -0
  32. package/dist/templates/research-assistant/defaults.json +25 -0
  33. package/dist/templates/research-assistant/onboarding.md +21 -0
  34. package/dist/templates/research-assistant/policy.md +1 -0
  35. package/dist/templates/research-assistant/template.json +8 -0
  36. package/package.json +4 -4
package/dist/index.d.cts CHANGED
@@ -1248,6 +1248,18 @@ declare class PolicyStore {
1248
1248
  private persist;
1249
1249
  }
1250
1250
 
1251
+ /**
1252
+ * Signature scheme identifier embedded in every AuditEntry and crypto-agility-bearing surface.
1253
+ *
1254
+ * v1.0: only "ed25519-v1" is valid.
1255
+ * v1.x post-quantum migration: "ed25519+ml-dsa-v1" hybrid will be introduced.
1256
+ * v1.0 verifiers MUST reject unknown schemes; the field exists so v1.x can add
1257
+ * hybrid signing without breaking v1.0 readers. Do not optimize this field away.
1258
+ *
1259
+ * Spec: §5.3 (Crypto-agility per thesis §3 L1 PQ note).
1260
+ */
1261
+ type SignatureScheme$1 = "ed25519-v1";
1262
+
1251
1263
  /**
1252
1264
  * Sanctuary MCP Server — Sovereignty Health Report (SHR) Types
1253
1265
  *
@@ -1258,6 +1270,7 @@ declare class PolicyStore {
1258
1270
  *
1259
1271
  * SHR version: 1.0
1260
1272
  */
1273
+
1261
1274
  type LayerStatus = "active" | "degraded" | "inactive";
1262
1275
  type DegradationSeverity = "info" | "warning" | "critical";
1263
1276
  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";
@@ -1337,6 +1350,7 @@ interface SHRBody {
1337
1350
  interface SignedSHR {
1338
1351
  body: SHRBody;
1339
1352
  signed_by: string;
1353
+ signature_scheme: SignatureScheme$1;
1340
1354
  signature: string;
1341
1355
  }
1342
1356
  interface SHRVerificationResult {
@@ -2925,13 +2939,13 @@ interface PrivacyRehydratedPayload extends PrivacyAuditPayloadHeader {
2925
2939
  type PrivacyAuditPayload = PrivacyFilteredPayload | PrivacyAllowedPayload | PrivacyDeniedPayload | PrivacyErrorPayload | PrivacyRehydratedPayload;
2926
2940
 
2927
2941
  /**
2928
- * Sanctuary v1.1 Operator Hub Event Contracts
2942
+ * Sanctuary v1.1 Operator Hub Event Contracts
2929
2943
  *
2930
2944
  * Shared shapes for the unified inbox, the activity feed, and the per-agent
2931
2945
  * status panels. The operator hub API workstream (Prompt 5) emits these; the
2932
2946
  * dashboard UI workstream (Prompt 8) consumes them. v1.2 mobile companion
2933
2947
  * planning will evaluate these shapes when it scopes a phone surface, but
2934
- * v1.1 does not commit to mobile compatibility these contracts are
2948
+ * v1.1 does not commit to mobile compatibility. These contracts are
2935
2949
  * tuned for the local dashboard surface only.
2936
2950
  *
2937
2951
  * Local-only invariant:
@@ -2952,7 +2966,7 @@ type PrivacyAuditPayload = PrivacyFilteredPayload | PrivacyAllowedPayload | Priv
2952
2966
  * accepted; the dashboard rejects rendering on any value outside this union.
2953
2967
  *
2954
2968
  * The renderer treats every value as data to interpolate into a fixed
2955
- * template registered under `template_id` never as raw content. This
2969
+ * template registered under `template_id`, never as raw content. This
2956
2970
  * defends against secrets, query text, file paths, and client names leaking
2957
2971
  * into inbox cards via stringly-typed display fields.
2958
2972
  */
@@ -3015,7 +3029,7 @@ interface HubInboxItemHeader {
3015
3029
  display_template_id: string;
3016
3030
  /**
3017
3031
  * Typed args interpolated into the template. Every value MUST be a
3018
- * `HubDisplayTemplateArg` instance no free-form strings. Renderers
3032
+ * `HubDisplayTemplateArg` instance, no free-form strings. Renderers
3019
3033
  * reject any arg outside this union, which structurally blocks secret
3020
3034
  * leakage via inbox copy.
3021
3035
  */
@@ -3100,7 +3114,7 @@ interface HubBudgetWarningItem extends HubInboxItemHeader {
3100
3114
  used_fraction: number;
3101
3115
  }
3102
3116
  /**
3103
- * Recovery prompt operator should run a recovery flow (passphrase reset,
3117
+ * Recovery prompt. Operator should run a recovery flow (passphrase reset,
3104
3118
  * keychain rebind, exit drill, etc.).
3105
3119
  */
3106
3120
  interface HubRecoveryPromptItem extends HubInboxItemHeader {
@@ -3146,12 +3160,32 @@ interface HubActivityFeedEntry {
3146
3160
  category: "policy_decision" | "approval" | "denial" | "egress" | "privacy" | "handoff" | "lifecycle" | "config" | "other";
3147
3161
  /**
3148
3162
  * Display template id. Resolved by the dashboard against the activity-feed
3149
- * template catalog. Backends MUST NOT emit raw summary text the template
3163
+ * template catalog. Backends MUST NOT emit raw summary text. The template
3150
3164
  * id plus typed args is the only legitimate channel.
3151
3165
  */
3152
3166
  display_template_id: string;
3153
3167
  /** Typed args. Same constraints as `HubInboxItemHeader.display_template_args`. */
3154
3168
  display_template_args: HubDisplayTemplateArg[];
3169
+ /**
3170
+ * Per-action attestation fragment for dashboard timeline rendering.
3171
+ *
3172
+ * Optional; absence means the row renders without a badge.
3173
+ *
3174
+ * `state` drives the `att-action` CSS class on the rendered badge.
3175
+ * `fragment` is a deterministic short hex string derived from the
3176
+ * audit-chain entry id; it gives operators a stable per-row visual hook
3177
+ * the same shape the Sprint Piece 2 attestation gallery shows.
3178
+ *
3179
+ * Important: the fragment is NOT a real per-event Ed25519 signature.
3180
+ * The audit chain itself is tamper-evident at the main-process boundary
3181
+ * (scope-lock §8); the fragment is the visible projection of the entry's
3182
+ * audit-chain identity. Real per-event signatures land post-v1.5+ in the
3183
+ * Crypto Agility Sprint.
3184
+ */
3185
+ attestation?: {
3186
+ state: "verified" | "degraded" | "unverified" | "neutral";
3187
+ fragment: string;
3188
+ };
3155
3189
  }
3156
3190
  /**
3157
3191
  * Per-agent status snapshot returned by the hub API. Mirrors the agent
@@ -3761,6 +3795,27 @@ declare class MemoryStorage implements StorageBackend {
3761
3795
  * - Secure deletion overwrites file content with random bytes before unlinking
3762
3796
  * - Directory creation uses restrictive permissions (0o700)
3763
3797
  * - File creation uses restrictive permissions (0o600)
3798
+ *
3799
+ * Path encoding (bijective, full-sweep #41):
3800
+ * Distinct (namespace, key) inputs MUST produce distinct on-disk paths;
3801
+ * otherwise an agent that can choose namespace/key strings within a tenant
3802
+ * could overwrite or read another namespace by colliding on the sanitized
3803
+ * form (multi-tenant isolation invariant). The encoder retains the safe
3804
+ * set [A-Za-z0-9_.-] (so internal namespaces such as `_audit`, `_bridge`,
3805
+ * etc. preserve their on-disk paths verbatim) and `!`-escapes every other
3806
+ * character as `!XX` where XX is the upper-hex byte. The escape character
3807
+ * `!` itself is NOT in the safe set, so a literal `!` in input encodes as
3808
+ * `!21` and decoding remains unambiguous.
3809
+ *
3810
+ * Legacy fallback (forward compatibility):
3811
+ * Pre-fix code used `replace(/[^a-zA-Z0-9_-]/g, "_")` for namespaces and
3812
+ * `replace(/[^a-zA-Z0-9_.-]/g, "_")` for keys; non-bijective. read(),
3813
+ * exists(), and delete() try the new path first; on ENOENT they fall back
3814
+ * to the legacy path so existing fortresses with operator-supplied
3815
+ * namespaces containing non-safe characters keep working. write() always
3816
+ * uses the new bijective path. list() and totalSize() walk on-disk
3817
+ * directory names directly and cannot disambiguate legacy collision-class
3818
+ * pairs; they are forward-only by design.
3764
3819
  */
3765
3820
 
3766
3821
  declare class FilesystemStorage implements StorageBackend {
@@ -3768,9 +3823,12 @@ declare class FilesystemStorage implements StorageBackend {
3768
3823
  constructor(basePath: string);
3769
3824
  private entryPath;
3770
3825
  private namespacePath;
3826
+ private legacyEntryPath;
3771
3827
  write(namespace: string, key: string, data: Uint8Array): Promise<void>;
3772
3828
  read(namespace: string, key: string): Promise<Uint8Array | null>;
3829
+ private readAtPath;
3773
3830
  delete(namespace: string, key: string, secureOverwrite?: boolean): Promise<boolean>;
3831
+ private deleteAtPath;
3774
3832
  list(namespace: string, prefix?: string): Promise<StorageEntryMeta[]>;
3775
3833
  exists(namespace: string, key: string): Promise<boolean>;
3776
3834
  totalSize(): Promise<number>;
@@ -3924,6 +3982,31 @@ interface ImportExitBundleOptions {
3924
3982
  sourceRecoveryKey?: string;
3925
3983
  sourceMasterKey?: Uint8Array;
3926
3984
  destinationSignerIdentityId?: string;
3985
+ /**
3986
+ * v1.0.2 (i) / full-sweep #54. When the destination fortress already has a
3987
+ * staged `public_identity` for the bundle's identity_id, activation is refused
3988
+ * unless the operator passes this flag. The CLI surfaces the flag as
3989
+ * `--force-rebind` and re-prompts Tier 1 confirmation. When `forceRebind` is
3990
+ * true and the rebind triggers, an `exit_bundle_force_rebind` L1 audit entry
3991
+ * records the explicit replacement.
3992
+ */
3993
+ forceRebind?: boolean;
3994
+ /**
3995
+ * v1.0.2 / full-sweep #55. Reputation attestations whose signer DID is not
3996
+ * present in the bundle's published identity material are marked
3997
+ * `unverifiable` by the verifier. By default the verdict is now strict and
3998
+ * an unverifiable attestation fails the bundle. Setting this flag opts the
3999
+ * operator in to an explicit relaxed verdict (Tier 1 confirmation in CLI).
4000
+ */
4001
+ acceptUnverifiableAttestations?: boolean;
4002
+ }
4003
+ /**
4004
+ * Structured error raised by `importExitBundle` for codes the CLI / hub want
4005
+ * to branch on without parsing free-text messages. v1.0.2 (i) / full-sweep #54.
4006
+ */
4007
+ declare class ExitBundleImportError extends Error {
4008
+ readonly code: string;
4009
+ constructor(code: string, message: string);
3927
4010
  }
3928
4011
  interface ExitBundleConflictReport {
3929
4012
  public_identity_exists: boolean;
@@ -3960,14 +4043,6 @@ declare function exportExitBundle(opts: ExportExitBundleOptions): Promise<Export
3960
4043
  declare function importExitBundle(opts: ImportExitBundleOptions): Promise<ImportExitBundleResult>;
3961
4044
  declare function exitBundleManifestShape(): Record<string, unknown>;
3962
4045
 
3963
- /**
3964
- * Sanctuary v1.1 exit-bundle verifier.
3965
- *
3966
- * Verifies the signed SANCTUARY_EXIT_BUNDLE_V1 manifest, every artifact hash,
3967
- * and the exported identity / reputation signatures that are independently
3968
- * verifiable from public material in the bundle.
3969
- */
3970
-
3971
4046
  interface ExitBundleDetailedVerifierResult extends ExitBundleVerifierResult {
3972
4047
  manifest_path: string;
3973
4048
  manifest_hash: string | null;
@@ -3998,7 +4073,19 @@ interface LoadedExitArtifact<T = unknown> {
3998
4073
  }
3999
4074
  declare function readManifest(bundleDir: string): Promise<ExitBundleManifest>;
4000
4075
  declare function loadExitArtifact<T = unknown>(bundleDir: string, manifest: ExitBundleManifest, kind: ExitBundleArtifactKind): Promise<LoadedExitArtifact<T> | null>;
4001
- declare function verifyExitBundle(bundleDir: string): Promise<ExitBundleDetailedVerifierResult>;
4076
+ /**
4077
+ * Caller-supplied verifier knobs. v1.0.2 / full-sweep #55.
4078
+ *
4079
+ * `acceptUnverifiableAttestations` flips the bundle verdict from strict-by-default
4080
+ * (any unverifiable attestation fails the bundle) to a relaxed verdict that
4081
+ * tolerates attestations whose signer DID is not in the bundle's published
4082
+ * identity material. Operators opt in explicitly through the CLI
4083
+ * `--accept-unverifiable-attestations` flag (Tier 1 confirmation).
4084
+ */
4085
+ interface VerifyExitBundleOptions {
4086
+ acceptUnverifiableAttestations?: boolean;
4087
+ }
4088
+ declare function verifyExitBundle(bundleDir: string, options?: VerifyExitBundleOptions): Promise<ExitBundleDetailedVerifierResult>;
4002
4089
 
4003
4090
  /**
4004
4091
  * `sanctuary exit` CLI.
@@ -4133,8 +4220,8 @@ type HubInboxAction = (typeof HUB_INBOX_ACTIONS)[number];
4133
4220
  declare const HUB_AGENT_CONTROL_ACTIONS: readonly ["pause", "resume", "restart", "unwrap", "lockdown"];
4134
4221
  type HubAgentControlAction = (typeof HUB_AGENT_CONTROL_ACTIONS)[number];
4135
4222
 
4136
- /** Channel-template identifiers per v1.2 design-canonical starter set. */
4137
- declare const CHANNEL_TEMPLATE_IDS: readonly ["request-approve-act", "read-then-report", "scheduled-digest", "plan-draft-only", "fortress-relay", "concierge-loop"];
4223
+ /** Channel-template identifiers per the five-template canonical starter set. */
4224
+ declare const CHANNEL_TEMPLATE_IDS: readonly ["request-approve-act", "read-then-report", "scheduled-digest", "plan-draft-only", "fortress-relay"];
4138
4225
  type ChannelTemplateId = (typeof CHANNEL_TEMPLATE_IDS)[number];
4139
4226
 
4140
4227
  /**
@@ -6682,4 +6769,4 @@ declare function createSanctuaryServer(options?: {
6682
6769
  storage?: StorageBackend;
6683
6770
  }): Promise<SanctuaryServer>;
6684
6771
 
6685
- 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 ExitAuditReceiptsArtifact, type ExitBundleDetailedVerifierResult, type ExitCommandArgs, type ExitCommitmentsArtifact, type ExitEncryptedStateBundle, type ExitPlaceholderVaultMetadataArtifact, type ExitPolicySetArtifact, type ExitPublicIdentityArtifact, type ExportExitBundleOptions, type ExportExitBundleResult, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, HERO_COPY, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, type ImportExitBundleOptions, type ImportExitBundleResult, InMemoryModelProvenanceStore, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, type L1Status, type L2Status, type L3Status, type L4Status, type LoadedExitArtifact, 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, exitBundleManifestShape, exportExitBundle, filterContext, generateAttestation, generateSHR, generateSystemPrompt, getProtectionSnapshot, getTemplate, importExitBundle, initiateHandshake, listTemplateIds, loadConfig, loadExitArtifact, loadPrincipalPolicy, readManifest, recommendPolicy, renderDashboardHTML, resolveTier, respondToHandshake, runExitCommand, signPayload, startDashboard, startDashboardServer, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyExitBundle, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
6772
+ 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 ExitAuditReceiptsArtifact, type ExitBundleDetailedVerifierResult, ExitBundleImportError, type ExitCommandArgs, type ExitCommitmentsArtifact, type ExitEncryptedStateBundle, type ExitPlaceholderVaultMetadataArtifact, type ExitPolicySetArtifact, type ExitPublicIdentityArtifact, type ExportExitBundleOptions, type ExportExitBundleResult, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, HERO_COPY, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, type ImportExitBundleOptions, type ImportExitBundleResult, InMemoryModelProvenanceStore, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, type L1Status, type L2Status, type L3Status, type L4Status, type LoadedExitArtifact, 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, type VerifyExitBundleOptions, WebhookApprovalChannel, type WebhookCallbackPayload, type WebhookConfig, type WebhookPayload, type ZKProofOfKnowledge, type ZKRangeProof, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createDefaultProfile, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, exitBundleManifestShape, exportExitBundle, filterContext, generateAttestation, generateSHR, generateSystemPrompt, getProtectionSnapshot, getTemplate, importExitBundle, initiateHandshake, listTemplateIds, loadConfig, loadExitArtifact, loadPrincipalPolicy, readManifest, recommendPolicy, renderDashboardHTML, resolveTier, respondToHandshake, runExitCommand, signPayload, startDashboard, startDashboardServer, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyExitBundle, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
package/dist/index.d.ts CHANGED
@@ -1248,6 +1248,18 @@ declare class PolicyStore {
1248
1248
  private persist;
1249
1249
  }
1250
1250
 
1251
+ /**
1252
+ * Signature scheme identifier embedded in every AuditEntry and crypto-agility-bearing surface.
1253
+ *
1254
+ * v1.0: only "ed25519-v1" is valid.
1255
+ * v1.x post-quantum migration: "ed25519+ml-dsa-v1" hybrid will be introduced.
1256
+ * v1.0 verifiers MUST reject unknown schemes; the field exists so v1.x can add
1257
+ * hybrid signing without breaking v1.0 readers. Do not optimize this field away.
1258
+ *
1259
+ * Spec: §5.3 (Crypto-agility per thesis §3 L1 PQ note).
1260
+ */
1261
+ type SignatureScheme$1 = "ed25519-v1";
1262
+
1251
1263
  /**
1252
1264
  * Sanctuary MCP Server — Sovereignty Health Report (SHR) Types
1253
1265
  *
@@ -1258,6 +1270,7 @@ declare class PolicyStore {
1258
1270
  *
1259
1271
  * SHR version: 1.0
1260
1272
  */
1273
+
1261
1274
  type LayerStatus = "active" | "degraded" | "inactive";
1262
1275
  type DegradationSeverity = "info" | "warning" | "critical";
1263
1276
  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";
@@ -1337,6 +1350,7 @@ interface SHRBody {
1337
1350
  interface SignedSHR {
1338
1351
  body: SHRBody;
1339
1352
  signed_by: string;
1353
+ signature_scheme: SignatureScheme$1;
1340
1354
  signature: string;
1341
1355
  }
1342
1356
  interface SHRVerificationResult {
@@ -2925,13 +2939,13 @@ interface PrivacyRehydratedPayload extends PrivacyAuditPayloadHeader {
2925
2939
  type PrivacyAuditPayload = PrivacyFilteredPayload | PrivacyAllowedPayload | PrivacyDeniedPayload | PrivacyErrorPayload | PrivacyRehydratedPayload;
2926
2940
 
2927
2941
  /**
2928
- * Sanctuary v1.1 Operator Hub Event Contracts
2942
+ * Sanctuary v1.1 Operator Hub Event Contracts
2929
2943
  *
2930
2944
  * Shared shapes for the unified inbox, the activity feed, and the per-agent
2931
2945
  * status panels. The operator hub API workstream (Prompt 5) emits these; the
2932
2946
  * dashboard UI workstream (Prompt 8) consumes them. v1.2 mobile companion
2933
2947
  * planning will evaluate these shapes when it scopes a phone surface, but
2934
- * v1.1 does not commit to mobile compatibility these contracts are
2948
+ * v1.1 does not commit to mobile compatibility. These contracts are
2935
2949
  * tuned for the local dashboard surface only.
2936
2950
  *
2937
2951
  * Local-only invariant:
@@ -2952,7 +2966,7 @@ type PrivacyAuditPayload = PrivacyFilteredPayload | PrivacyAllowedPayload | Priv
2952
2966
  * accepted; the dashboard rejects rendering on any value outside this union.
2953
2967
  *
2954
2968
  * The renderer treats every value as data to interpolate into a fixed
2955
- * template registered under `template_id` never as raw content. This
2969
+ * template registered under `template_id`, never as raw content. This
2956
2970
  * defends against secrets, query text, file paths, and client names leaking
2957
2971
  * into inbox cards via stringly-typed display fields.
2958
2972
  */
@@ -3015,7 +3029,7 @@ interface HubInboxItemHeader {
3015
3029
  display_template_id: string;
3016
3030
  /**
3017
3031
  * Typed args interpolated into the template. Every value MUST be a
3018
- * `HubDisplayTemplateArg` instance no free-form strings. Renderers
3032
+ * `HubDisplayTemplateArg` instance, no free-form strings. Renderers
3019
3033
  * reject any arg outside this union, which structurally blocks secret
3020
3034
  * leakage via inbox copy.
3021
3035
  */
@@ -3100,7 +3114,7 @@ interface HubBudgetWarningItem extends HubInboxItemHeader {
3100
3114
  used_fraction: number;
3101
3115
  }
3102
3116
  /**
3103
- * Recovery prompt operator should run a recovery flow (passphrase reset,
3117
+ * Recovery prompt. Operator should run a recovery flow (passphrase reset,
3104
3118
  * keychain rebind, exit drill, etc.).
3105
3119
  */
3106
3120
  interface HubRecoveryPromptItem extends HubInboxItemHeader {
@@ -3146,12 +3160,32 @@ interface HubActivityFeedEntry {
3146
3160
  category: "policy_decision" | "approval" | "denial" | "egress" | "privacy" | "handoff" | "lifecycle" | "config" | "other";
3147
3161
  /**
3148
3162
  * Display template id. Resolved by the dashboard against the activity-feed
3149
- * template catalog. Backends MUST NOT emit raw summary text the template
3163
+ * template catalog. Backends MUST NOT emit raw summary text. The template
3150
3164
  * id plus typed args is the only legitimate channel.
3151
3165
  */
3152
3166
  display_template_id: string;
3153
3167
  /** Typed args. Same constraints as `HubInboxItemHeader.display_template_args`. */
3154
3168
  display_template_args: HubDisplayTemplateArg[];
3169
+ /**
3170
+ * Per-action attestation fragment for dashboard timeline rendering.
3171
+ *
3172
+ * Optional; absence means the row renders without a badge.
3173
+ *
3174
+ * `state` drives the `att-action` CSS class on the rendered badge.
3175
+ * `fragment` is a deterministic short hex string derived from the
3176
+ * audit-chain entry id; it gives operators a stable per-row visual hook
3177
+ * the same shape the Sprint Piece 2 attestation gallery shows.
3178
+ *
3179
+ * Important: the fragment is NOT a real per-event Ed25519 signature.
3180
+ * The audit chain itself is tamper-evident at the main-process boundary
3181
+ * (scope-lock §8); the fragment is the visible projection of the entry's
3182
+ * audit-chain identity. Real per-event signatures land post-v1.5+ in the
3183
+ * Crypto Agility Sprint.
3184
+ */
3185
+ attestation?: {
3186
+ state: "verified" | "degraded" | "unverified" | "neutral";
3187
+ fragment: string;
3188
+ };
3155
3189
  }
3156
3190
  /**
3157
3191
  * Per-agent status snapshot returned by the hub API. Mirrors the agent
@@ -3761,6 +3795,27 @@ declare class MemoryStorage implements StorageBackend {
3761
3795
  * - Secure deletion overwrites file content with random bytes before unlinking
3762
3796
  * - Directory creation uses restrictive permissions (0o700)
3763
3797
  * - File creation uses restrictive permissions (0o600)
3798
+ *
3799
+ * Path encoding (bijective, full-sweep #41):
3800
+ * Distinct (namespace, key) inputs MUST produce distinct on-disk paths;
3801
+ * otherwise an agent that can choose namespace/key strings within a tenant
3802
+ * could overwrite or read another namespace by colliding on the sanitized
3803
+ * form (multi-tenant isolation invariant). The encoder retains the safe
3804
+ * set [A-Za-z0-9_.-] (so internal namespaces such as `_audit`, `_bridge`,
3805
+ * etc. preserve their on-disk paths verbatim) and `!`-escapes every other
3806
+ * character as `!XX` where XX is the upper-hex byte. The escape character
3807
+ * `!` itself is NOT in the safe set, so a literal `!` in input encodes as
3808
+ * `!21` and decoding remains unambiguous.
3809
+ *
3810
+ * Legacy fallback (forward compatibility):
3811
+ * Pre-fix code used `replace(/[^a-zA-Z0-9_-]/g, "_")` for namespaces and
3812
+ * `replace(/[^a-zA-Z0-9_.-]/g, "_")` for keys; non-bijective. read(),
3813
+ * exists(), and delete() try the new path first; on ENOENT they fall back
3814
+ * to the legacy path so existing fortresses with operator-supplied
3815
+ * namespaces containing non-safe characters keep working. write() always
3816
+ * uses the new bijective path. list() and totalSize() walk on-disk
3817
+ * directory names directly and cannot disambiguate legacy collision-class
3818
+ * pairs; they are forward-only by design.
3764
3819
  */
3765
3820
 
3766
3821
  declare class FilesystemStorage implements StorageBackend {
@@ -3768,9 +3823,12 @@ declare class FilesystemStorage implements StorageBackend {
3768
3823
  constructor(basePath: string);
3769
3824
  private entryPath;
3770
3825
  private namespacePath;
3826
+ private legacyEntryPath;
3771
3827
  write(namespace: string, key: string, data: Uint8Array): Promise<void>;
3772
3828
  read(namespace: string, key: string): Promise<Uint8Array | null>;
3829
+ private readAtPath;
3773
3830
  delete(namespace: string, key: string, secureOverwrite?: boolean): Promise<boolean>;
3831
+ private deleteAtPath;
3774
3832
  list(namespace: string, prefix?: string): Promise<StorageEntryMeta[]>;
3775
3833
  exists(namespace: string, key: string): Promise<boolean>;
3776
3834
  totalSize(): Promise<number>;
@@ -3924,6 +3982,31 @@ interface ImportExitBundleOptions {
3924
3982
  sourceRecoveryKey?: string;
3925
3983
  sourceMasterKey?: Uint8Array;
3926
3984
  destinationSignerIdentityId?: string;
3985
+ /**
3986
+ * v1.0.2 (i) / full-sweep #54. When the destination fortress already has a
3987
+ * staged `public_identity` for the bundle's identity_id, activation is refused
3988
+ * unless the operator passes this flag. The CLI surfaces the flag as
3989
+ * `--force-rebind` and re-prompts Tier 1 confirmation. When `forceRebind` is
3990
+ * true and the rebind triggers, an `exit_bundle_force_rebind` L1 audit entry
3991
+ * records the explicit replacement.
3992
+ */
3993
+ forceRebind?: boolean;
3994
+ /**
3995
+ * v1.0.2 / full-sweep #55. Reputation attestations whose signer DID is not
3996
+ * present in the bundle's published identity material are marked
3997
+ * `unverifiable` by the verifier. By default the verdict is now strict and
3998
+ * an unverifiable attestation fails the bundle. Setting this flag opts the
3999
+ * operator in to an explicit relaxed verdict (Tier 1 confirmation in CLI).
4000
+ */
4001
+ acceptUnverifiableAttestations?: boolean;
4002
+ }
4003
+ /**
4004
+ * Structured error raised by `importExitBundle` for codes the CLI / hub want
4005
+ * to branch on without parsing free-text messages. v1.0.2 (i) / full-sweep #54.
4006
+ */
4007
+ declare class ExitBundleImportError extends Error {
4008
+ readonly code: string;
4009
+ constructor(code: string, message: string);
3927
4010
  }
3928
4011
  interface ExitBundleConflictReport {
3929
4012
  public_identity_exists: boolean;
@@ -3960,14 +4043,6 @@ declare function exportExitBundle(opts: ExportExitBundleOptions): Promise<Export
3960
4043
  declare function importExitBundle(opts: ImportExitBundleOptions): Promise<ImportExitBundleResult>;
3961
4044
  declare function exitBundleManifestShape(): Record<string, unknown>;
3962
4045
 
3963
- /**
3964
- * Sanctuary v1.1 exit-bundle verifier.
3965
- *
3966
- * Verifies the signed SANCTUARY_EXIT_BUNDLE_V1 manifest, every artifact hash,
3967
- * and the exported identity / reputation signatures that are independently
3968
- * verifiable from public material in the bundle.
3969
- */
3970
-
3971
4046
  interface ExitBundleDetailedVerifierResult extends ExitBundleVerifierResult {
3972
4047
  manifest_path: string;
3973
4048
  manifest_hash: string | null;
@@ -3998,7 +4073,19 @@ interface LoadedExitArtifact<T = unknown> {
3998
4073
  }
3999
4074
  declare function readManifest(bundleDir: string): Promise<ExitBundleManifest>;
4000
4075
  declare function loadExitArtifact<T = unknown>(bundleDir: string, manifest: ExitBundleManifest, kind: ExitBundleArtifactKind): Promise<LoadedExitArtifact<T> | null>;
4001
- declare function verifyExitBundle(bundleDir: string): Promise<ExitBundleDetailedVerifierResult>;
4076
+ /**
4077
+ * Caller-supplied verifier knobs. v1.0.2 / full-sweep #55.
4078
+ *
4079
+ * `acceptUnverifiableAttestations` flips the bundle verdict from strict-by-default
4080
+ * (any unverifiable attestation fails the bundle) to a relaxed verdict that
4081
+ * tolerates attestations whose signer DID is not in the bundle's published
4082
+ * identity material. Operators opt in explicitly through the CLI
4083
+ * `--accept-unverifiable-attestations` flag (Tier 1 confirmation).
4084
+ */
4085
+ interface VerifyExitBundleOptions {
4086
+ acceptUnverifiableAttestations?: boolean;
4087
+ }
4088
+ declare function verifyExitBundle(bundleDir: string, options?: VerifyExitBundleOptions): Promise<ExitBundleDetailedVerifierResult>;
4002
4089
 
4003
4090
  /**
4004
4091
  * `sanctuary exit` CLI.
@@ -4133,8 +4220,8 @@ type HubInboxAction = (typeof HUB_INBOX_ACTIONS)[number];
4133
4220
  declare const HUB_AGENT_CONTROL_ACTIONS: readonly ["pause", "resume", "restart", "unwrap", "lockdown"];
4134
4221
  type HubAgentControlAction = (typeof HUB_AGENT_CONTROL_ACTIONS)[number];
4135
4222
 
4136
- /** Channel-template identifiers per v1.2 design-canonical starter set. */
4137
- declare const CHANNEL_TEMPLATE_IDS: readonly ["request-approve-act", "read-then-report", "scheduled-digest", "plan-draft-only", "fortress-relay", "concierge-loop"];
4223
+ /** Channel-template identifiers per the five-template canonical starter set. */
4224
+ declare const CHANNEL_TEMPLATE_IDS: readonly ["request-approve-act", "read-then-report", "scheduled-digest", "plan-draft-only", "fortress-relay"];
4138
4225
  type ChannelTemplateId = (typeof CHANNEL_TEMPLATE_IDS)[number];
4139
4226
 
4140
4227
  /**
@@ -6682,4 +6769,4 @@ declare function createSanctuaryServer(options?: {
6682
6769
  storage?: StorageBackend;
6683
6770
  }): Promise<SanctuaryServer>;
6684
6771
 
6685
- 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 ExitAuditReceiptsArtifact, type ExitBundleDetailedVerifierResult, type ExitCommandArgs, type ExitCommitmentsArtifact, type ExitEncryptedStateBundle, type ExitPlaceholderVaultMetadataArtifact, type ExitPolicySetArtifact, type ExitPublicIdentityArtifact, type ExportExitBundleOptions, type ExportExitBundleResult, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, HERO_COPY, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, type ImportExitBundleOptions, type ImportExitBundleResult, InMemoryModelProvenanceStore, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, type L1Status, type L2Status, type L3Status, type L4Status, type LoadedExitArtifact, 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, exitBundleManifestShape, exportExitBundle, filterContext, generateAttestation, generateSHR, generateSystemPrompt, getProtectionSnapshot, getTemplate, importExitBundle, initiateHandshake, listTemplateIds, loadConfig, loadExitArtifact, loadPrincipalPolicy, readManifest, recommendPolicy, renderDashboardHTML, resolveTier, respondToHandshake, runExitCommand, signPayload, startDashboard, startDashboardServer, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyExitBundle, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };
6772
+ 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 ExitAuditReceiptsArtifact, type ExitBundleDetailedVerifierResult, ExitBundleImportError, type ExitCommandArgs, type ExitCommitmentsArtifact, type ExitEncryptedStateBundle, type ExitPlaceholderVaultMetadataArtifact, type ExitPolicySetArtifact, type ExitPublicIdentityArtifact, type ExportExitBundleOptions, type ExportExitBundleResult, type FederationCapabilities, type FederationPeer, FederationRegistry, type FieldClassification, type FieldFilterResult, FilesystemStorage, type GateResult, HERO_COPY, type HandshakeChallenge, type HandshakeCompletion, type HandshakeResponse, type HandshakeResult, type ImportExitBundleOptions, type ImportExitBundleResult, InMemoryModelProvenanceStore, InjectionDetector, type InjectionDetectorConfig, type InjectionSignal, type L1Status, type L2Status, type L3Status, type L4Status, type LoadedExitArtifact, 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, type VerifyExitBundleOptions, WebhookApprovalChannel, type WebhookCallbackPayload, type WebhookConfig, type WebhookPayload, type ZKProofOfKnowledge, type ZKRangeProof, canonicalize, classifyField, completeHandshake, computeWeightedScore, createBridgeCommitment, createDefaultProfile, createPedersenCommitment, createProofOfKnowledge, createRangeProof, createSanctuaryServer, evaluateField, exitBundleManifestShape, exportExitBundle, filterContext, generateAttestation, generateSHR, generateSystemPrompt, getProtectionSnapshot, getTemplate, importExitBundle, initiateHandshake, listTemplateIds, loadConfig, loadExitArtifact, loadPrincipalPolicy, readManifest, recommendPolicy, renderDashboardHTML, resolveTier, respondToHandshake, runExitCommand, signPayload, startDashboard, startDashboardServer, tierDistribution, verifyAttestation, verifyBridgeCommitment, verifyCompletion, verifyExitBundle, verifyPedersenCommitment, verifyProofOfKnowledge, verifyRangeProof, verifySHR, verifySignature };