@claude-flow/plugin-agent-federation 1.0.2 → 1.0.4
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/README.md +1 -1
- package/dist/application/federation-coordinator.js +1 -1
- package/dist/application/federation-coordinator.js.map +1 -1
- package/dist/application/policy-engine.d.ts.map +1 -1
- package/dist/application/policy-engine.js +31 -0
- package/dist/application/policy-engine.js.map +1 -1
- package/dist/domain/services/discovery-service.d.ts.map +1 -1
- package/dist/domain/services/discovery-service.js +11 -1
- package/dist/domain/services/discovery-service.js.map +1 -1
- package/dist/domain/services/handshake-service.d.ts.map +1 -1
- package/dist/domain/services/handshake-service.js +16 -3
- package/dist/domain/services/handshake-service.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +17 -4
- package/dist/plugin.js.map +1 -1
- package/dist/transport/midstream-aware-loader.d.ts.map +1 -1
- package/dist/transport/midstream-aware-loader.js +3 -1
- package/dist/transport/midstream-aware-loader.js.map +1 -1
- package/package.json +1 -1
- package/dist/a2a/agent-card.d.ts +0 -130
- package/dist/a2a/consume.d.ts +0 -34
- package/dist/a2a/planner-descriptor.d.ts +0 -40
- package/dist/a2a/well-known.d.ts +0 -46
- package/dist/application/claim-checker.d.ts +0 -27
- package/dist/application/federation-breaker-service.d.ts +0 -192
- package/dist/application/federation-coordinator.d.ts +0 -211
- package/dist/application/inbound-dispatcher.d.ts +0 -113
- package/dist/application/policy-engine.d.ts +0 -41
- package/dist/application/spend-reporter.d.ts +0 -150
- package/dist/application/trust-evaluator.d.ts +0 -74
- package/dist/bin.d.ts +0 -13
- package/dist/cli-commands.d.ts +0 -7
- package/dist/domain/entities/federation-envelope.d.ts +0 -45
- package/dist/domain/entities/federation-node.d.ts +0 -104
- package/dist/domain/entities/federation-session.d.ts +0 -55
- package/dist/domain/entities/trust-level.d.ts +0 -17
- package/dist/domain/services/audit-service.d.ts +0 -69
- package/dist/domain/services/discovery-service.d.ts +0 -68
- package/dist/domain/services/handshake-service.d.ts +0 -58
- package/dist/domain/services/pii-pipeline-service.d.ts +0 -65
- package/dist/domain/services/routing-service.d.ts +0 -54
- package/dist/domain/services/wg-firewall-service.d.ts +0 -71
- package/dist/domain/services/wg-mesh-service.d.ts +0 -156
- package/dist/domain/services/wg-witness-service.d.ts +0 -98
- package/dist/domain/value-objects/federation-budget.d.ts +0 -89
- package/dist/domain/value-objects/federation-node-state.d.ts +0 -92
- package/dist/domain/value-objects/wg-config.d.ts +0 -70
- package/dist/index.d.ts +0 -24
- package/dist/mcp-tools.d.ts +0 -10
- package/dist/plugin.d.ts +0 -19
- package/dist/transport/midstream-aware-loader.d.ts +0 -72
- package/dist/version.d.ts +0 -3
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { TrustLevel } from './trust-level.js';
|
|
2
|
-
import { FederationNodeState, SuspensionReason, TransitionReason } from '../value-objects/federation-node-state.js';
|
|
3
|
-
export interface FederationNodeCapabilities {
|
|
4
|
-
readonly agentTypes: readonly string[];
|
|
5
|
-
readonly maxConcurrentSessions: number;
|
|
6
|
-
readonly supportedProtocols: readonly string[];
|
|
7
|
-
readonly complianceModes: readonly string[];
|
|
8
|
-
}
|
|
9
|
-
export interface FederationNodeMetadata {
|
|
10
|
-
readonly organizationId?: string;
|
|
11
|
-
readonly region?: string;
|
|
12
|
-
readonly version?: string;
|
|
13
|
-
readonly [key: string]: unknown;
|
|
14
|
-
}
|
|
15
|
-
/** Last-transition record kept on the entity for the audit trail. */
|
|
16
|
-
export interface FederationNodeStateRecord {
|
|
17
|
-
readonly state: FederationNodeState;
|
|
18
|
-
readonly changedAt: Date;
|
|
19
|
-
readonly reason?: SuspensionReason;
|
|
20
|
-
readonly correlationId?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface FederationNodeProps {
|
|
23
|
-
readonly nodeId: string;
|
|
24
|
-
readonly publicKey: string;
|
|
25
|
-
readonly endpoint: string;
|
|
26
|
-
readonly capabilities: FederationNodeCapabilities;
|
|
27
|
-
readonly trustLevel: TrustLevel;
|
|
28
|
-
readonly trustScore: number;
|
|
29
|
-
readonly lastSeen: Date;
|
|
30
|
-
readonly metadata: FederationNodeMetadata;
|
|
31
|
-
/** Phase 2: peer state. Defaults to ACTIVE if unset. */
|
|
32
|
-
readonly state?: FederationNodeState;
|
|
33
|
-
/** Phase 2: when the current state was entered. Defaults to now. */
|
|
34
|
-
readonly stateChangedAt?: Date;
|
|
35
|
-
/** Phase 2: why we entered the current non-ACTIVE state. */
|
|
36
|
-
readonly stateReason?: SuspensionReason;
|
|
37
|
-
/** Phase 2: caller correlation key for the last transition. */
|
|
38
|
-
readonly stateCorrelationId?: string;
|
|
39
|
-
}
|
|
40
|
-
export declare class FederationNode {
|
|
41
|
-
readonly nodeId: string;
|
|
42
|
-
readonly publicKey: string;
|
|
43
|
-
readonly endpoint: string;
|
|
44
|
-
readonly capabilities: FederationNodeCapabilities;
|
|
45
|
-
private _trustLevel;
|
|
46
|
-
private _trustScore;
|
|
47
|
-
private _lastSeen;
|
|
48
|
-
private readonly _metadata;
|
|
49
|
-
private _state;
|
|
50
|
-
private _stateChangedAt;
|
|
51
|
-
private _stateReason?;
|
|
52
|
-
private _stateCorrelationId?;
|
|
53
|
-
constructor(props: FederationNodeProps);
|
|
54
|
-
get trustLevel(): TrustLevel;
|
|
55
|
-
get trustScore(): number;
|
|
56
|
-
get lastSeen(): Date;
|
|
57
|
-
get metadata(): FederationNodeMetadata;
|
|
58
|
-
/** Current peer state (ADR-097 Phase 2). */
|
|
59
|
-
get state(): FederationNodeState;
|
|
60
|
-
/** When the current state was entered. */
|
|
61
|
-
get stateChangedAt(): Date;
|
|
62
|
-
/** Last-transition record for the audit trail. */
|
|
63
|
-
get stateRecord(): FederationNodeStateRecord;
|
|
64
|
-
/** Convenience predicate: is this peer accepting outbound sends? */
|
|
65
|
-
get isActive(): boolean;
|
|
66
|
-
/** Convenience predicate: is this peer terminally evicted? */
|
|
67
|
-
get isEvicted(): boolean;
|
|
68
|
-
updateTrustLevel(level: TrustLevel): void;
|
|
69
|
-
updateTrustScore(score: number): void;
|
|
70
|
-
markSeen(): void;
|
|
71
|
-
isStale(maxAgeMs: number): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Transition this peer to SUSPENDED. Legal from ACTIVE only — calling
|
|
74
|
-
* from SUSPENDED or EVICTED returns false (the entity is already at or
|
|
75
|
-
* past the breaker threshold, so a duplicate trip is a no-op).
|
|
76
|
-
*
|
|
77
|
-
* Returns true if the state changed, false if the call was rejected
|
|
78
|
-
* (illegal transition). The breaker treats false as "already handled."
|
|
79
|
-
*/
|
|
80
|
-
suspend(reason: TransitionReason, now?: Date): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Transition this peer to EVICTED. Legal from ACTIVE or SUSPENDED.
|
|
83
|
-
* EVICTED is terminal under normal flow — only `reactivate` (operator-
|
|
84
|
-
* initiated) can move the peer back to ACTIVE.
|
|
85
|
-
*/
|
|
86
|
-
evict(reason: TransitionReason, now?: Date): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Transition back to ACTIVE. Legal from SUSPENDED (after cooldown +
|
|
89
|
-
* probe success — the breaker is responsible for those checks; this
|
|
90
|
-
* entity does not gate on time) or from EVICTED (operator override).
|
|
91
|
-
*
|
|
92
|
-
* `correlationId` lets the caller record *why* they're reactivating
|
|
93
|
-
* (probe ID, operator ticket, etc.) for the audit trail.
|
|
94
|
-
*/
|
|
95
|
-
reactivate(correlationId?: string, now?: Date): boolean;
|
|
96
|
-
private _transition;
|
|
97
|
-
toProps(): FederationNodeProps;
|
|
98
|
-
static create(props: Omit<FederationNodeProps, 'trustLevel' | 'trustScore' | 'lastSeen'> & {
|
|
99
|
-
trustLevel?: TrustLevel;
|
|
100
|
-
trustScore?: number;
|
|
101
|
-
lastSeen?: Date;
|
|
102
|
-
}): FederationNode;
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=federation-node.d.ts.map
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { TrustLevel } from './trust-level.js';
|
|
2
|
-
export interface SessionMetrics {
|
|
3
|
-
messagesSent: number;
|
|
4
|
-
messagesReceived: number;
|
|
5
|
-
piiRedactions: number;
|
|
6
|
-
threatDetections: number;
|
|
7
|
-
hmacFailures: number;
|
|
8
|
-
totalInteractions: number;
|
|
9
|
-
}
|
|
10
|
-
export interface FederationSessionProps {
|
|
11
|
-
readonly sessionId: string;
|
|
12
|
-
readonly localNodeId: string;
|
|
13
|
-
readonly remoteNodeId: string;
|
|
14
|
-
readonly trustLevel: TrustLevel;
|
|
15
|
-
readonly negotiatedCapabilities: readonly string[];
|
|
16
|
-
readonly createdAt: Date;
|
|
17
|
-
readonly expiresAt: Date;
|
|
18
|
-
readonly heartbeatInterval: number;
|
|
19
|
-
readonly sessionToken: string;
|
|
20
|
-
readonly metrics: SessionMetrics;
|
|
21
|
-
}
|
|
22
|
-
export declare class FederationSession {
|
|
23
|
-
readonly sessionId: string;
|
|
24
|
-
readonly localNodeId: string;
|
|
25
|
-
readonly remoteNodeId: string;
|
|
26
|
-
readonly negotiatedCapabilities: readonly string[];
|
|
27
|
-
readonly createdAt: Date;
|
|
28
|
-
readonly heartbeatInterval: number;
|
|
29
|
-
readonly sessionToken: string;
|
|
30
|
-
private _trustLevel;
|
|
31
|
-
private _expiresAt;
|
|
32
|
-
private _lastHeartbeat;
|
|
33
|
-
private _metrics;
|
|
34
|
-
private _active;
|
|
35
|
-
constructor(props: FederationSessionProps);
|
|
36
|
-
get trustLevel(): TrustLevel;
|
|
37
|
-
get expiresAt(): Date;
|
|
38
|
-
get lastHeartbeat(): Date;
|
|
39
|
-
get metrics(): Readonly<SessionMetrics>;
|
|
40
|
-
get active(): boolean;
|
|
41
|
-
isExpired(): boolean;
|
|
42
|
-
isHeartbeatOverdue(): boolean;
|
|
43
|
-
recordHeartbeat(): void;
|
|
44
|
-
renew(newExpiresAt: Date): void;
|
|
45
|
-
updateTrustLevel(level: TrustLevel): void;
|
|
46
|
-
recordMessageSent(): void;
|
|
47
|
-
recordMessageReceived(): void;
|
|
48
|
-
recordPiiRedaction(): void;
|
|
49
|
-
recordThreatDetection(): void;
|
|
50
|
-
recordHmacFailure(): void;
|
|
51
|
-
terminate(): void;
|
|
52
|
-
toProps(): FederationSessionProps;
|
|
53
|
-
static createMetrics(): SessionMetrics;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=federation-session.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare enum TrustLevel {
|
|
2
|
-
UNTRUSTED = 0,
|
|
3
|
-
VERIFIED = 1,
|
|
4
|
-
ATTESTED = 2,
|
|
5
|
-
TRUSTED = 3,
|
|
6
|
-
PRIVILEGED = 4
|
|
7
|
-
}
|
|
8
|
-
export interface TrustTransitionThreshold {
|
|
9
|
-
upgradeScore: number;
|
|
10
|
-
downgradeScore: number;
|
|
11
|
-
minInteractions: number;
|
|
12
|
-
}
|
|
13
|
-
export declare const TRUST_TRANSITION_THRESHOLDS: Record<string, TrustTransitionThreshold>;
|
|
14
|
-
export declare const CAPABILITY_GATES: Record<TrustLevel, readonly string[]>;
|
|
15
|
-
export declare function isOperationAllowed(trustLevel: TrustLevel, operation: string): boolean;
|
|
16
|
-
export declare function getTrustLevelLabel(level: TrustLevel): string;
|
|
17
|
-
//# sourceMappingURL=trust-level.d.ts.map
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export type FederationAuditEventType = 'peer_discovered' | 'peer_manifest_published' | 'handshake_initiated' | 'handshake_completed' | 'handshake_failed' | 'handshake_rejected' | 'session_created' | 'session_renewed' | 'session_expired' | 'session_terminated' | 'message_sent' | 'message_received' | 'message_rejected' | 'message_timeout' | 'pii_detected' | 'pii_stripped' | 'pii_blocked' | 'threat_detected' | 'threat_blocked' | 'threat_learned' | 'claim_checked' | 'claim_denied' | 'trust_level_changed' | 'consensus_proposed' | 'consensus_voted' | 'consensus_reached' | 'consensus_failed';
|
|
2
|
-
export type AuditSeverity = 'info' | 'warn' | 'error' | 'critical';
|
|
3
|
-
export type AuditCategory = 'discovery' | 'handshake' | 'message' | 'pii' | 'security' | 'consensus';
|
|
4
|
-
export type ComplianceMode = 'hipaa' | 'soc2' | 'gdpr' | 'none';
|
|
5
|
-
export interface FederationAuditEvent {
|
|
6
|
-
readonly eventId: string;
|
|
7
|
-
readonly timestamp: string;
|
|
8
|
-
readonly nodeId: string;
|
|
9
|
-
readonly sessionId?: string;
|
|
10
|
-
readonly eventType: FederationAuditEventType;
|
|
11
|
-
readonly severity: AuditSeverity;
|
|
12
|
-
readonly category: AuditCategory;
|
|
13
|
-
readonly sourceNodeId?: string;
|
|
14
|
-
readonly targetNodeId?: string;
|
|
15
|
-
readonly agentId?: string;
|
|
16
|
-
readonly trustLevel?: number;
|
|
17
|
-
readonly piiDetected?: boolean;
|
|
18
|
-
readonly piiTypesFound?: string[];
|
|
19
|
-
readonly piiAction?: string;
|
|
20
|
-
readonly threatDetected?: boolean;
|
|
21
|
-
readonly threatTypes?: string[];
|
|
22
|
-
readonly claimsChecked?: string[];
|
|
23
|
-
readonly claimsResult?: 'granted' | 'denied';
|
|
24
|
-
readonly latencyMs?: number;
|
|
25
|
-
readonly messageSizeBytes?: number;
|
|
26
|
-
readonly complianceMode?: ComplianceMode;
|
|
27
|
-
readonly dataResidency?: string;
|
|
28
|
-
readonly metadata?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
export interface AuditQuery {
|
|
31
|
-
readonly eventType?: FederationAuditEventType;
|
|
32
|
-
readonly severity?: AuditSeverity;
|
|
33
|
-
readonly category?: AuditCategory;
|
|
34
|
-
readonly nodeId?: string;
|
|
35
|
-
readonly sessionId?: string;
|
|
36
|
-
readonly since?: Date;
|
|
37
|
-
readonly until?: Date;
|
|
38
|
-
readonly limit?: number;
|
|
39
|
-
readonly offset?: number;
|
|
40
|
-
}
|
|
41
|
-
export type AuditExportFormat = 'json' | 'csv' | 'ndjson';
|
|
42
|
-
export interface AuditServiceDeps {
|
|
43
|
-
generateEventId: () => string;
|
|
44
|
-
getLocalNodeId: () => string;
|
|
45
|
-
persistEvent: (event: FederationAuditEvent) => Promise<void>;
|
|
46
|
-
queryEvents: (query: AuditQuery) => Promise<FederationAuditEvent[]>;
|
|
47
|
-
onAuditEvent?: (event: FederationAuditEvent) => void;
|
|
48
|
-
}
|
|
49
|
-
export interface AuditServiceConfig {
|
|
50
|
-
readonly complianceMode: ComplianceMode;
|
|
51
|
-
readonly dataResidency?: string;
|
|
52
|
-
readonly retentionDays: number;
|
|
53
|
-
readonly batchSize: number;
|
|
54
|
-
}
|
|
55
|
-
export declare class AuditService {
|
|
56
|
-
private readonly deps;
|
|
57
|
-
private readonly config;
|
|
58
|
-
private readonly buffer;
|
|
59
|
-
constructor(deps: AuditServiceDeps, config?: Partial<AuditServiceConfig>);
|
|
60
|
-
log(eventType: FederationAuditEventType, details?: Partial<Omit<FederationAuditEvent, 'eventId' | 'timestamp' | 'nodeId' | 'eventType' | 'severity' | 'category' | 'complianceMode'>>): Promise<FederationAuditEvent>;
|
|
61
|
-
query(query: AuditQuery): Promise<FederationAuditEvent[]>;
|
|
62
|
-
export(query: AuditQuery, format: AuditExportFormat): Promise<string>;
|
|
63
|
-
flush(): Promise<void>;
|
|
64
|
-
getBufferSize(): number;
|
|
65
|
-
private buildEvent;
|
|
66
|
-
private applyHipaaCompliance;
|
|
67
|
-
private toCsv;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=audit-service.d.ts.map
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { FederationNode } from '../entities/federation-node.js';
|
|
2
|
-
import type { WgManifestSection } from '../value-objects/wg-config.js';
|
|
3
|
-
export type DiscoveryMechanism = 'static' | 'dns-sd' | 'ipfs-registry' | 'a2a-card';
|
|
4
|
-
export interface FederationManifest {
|
|
5
|
-
readonly nodeId: string;
|
|
6
|
-
readonly publicKey: string;
|
|
7
|
-
readonly endpoint: string;
|
|
8
|
-
readonly capabilities: {
|
|
9
|
-
readonly agentTypes: readonly string[];
|
|
10
|
-
readonly maxConcurrentSessions: number;
|
|
11
|
-
readonly supportedProtocols: readonly string[];
|
|
12
|
-
readonly complianceModes: readonly string[];
|
|
13
|
-
};
|
|
14
|
-
readonly version: string;
|
|
15
|
-
readonly signature: string;
|
|
16
|
-
readonly timestamp: string;
|
|
17
|
-
/**
|
|
18
|
-
* ADR-111 — optional WG mesh identity. Present only when the publishing
|
|
19
|
-
* node has opted into the in-tree WG layer (`config.wgMesh: true`).
|
|
20
|
-
* The Ed25519 manifest signature covers this block too — peers verifying
|
|
21
|
-
* the manifest also verify the WG-key binding.
|
|
22
|
-
*/
|
|
23
|
-
readonly wg?: WgManifestSection;
|
|
24
|
-
}
|
|
25
|
-
export interface DiscoveryServiceDeps {
|
|
26
|
-
signManifest: (manifest: Omit<FederationManifest, 'signature'>) => Promise<string>;
|
|
27
|
-
verifyManifest: (manifest: FederationManifest) => Promise<boolean>;
|
|
28
|
-
onPeerDiscovered?: (node: FederationNode) => void;
|
|
29
|
-
}
|
|
30
|
-
export interface DiscoveryConfig {
|
|
31
|
-
readonly staticPeers: readonly string[];
|
|
32
|
-
readonly enableDnsSd: boolean;
|
|
33
|
-
readonly enableIpfsRegistry: boolean;
|
|
34
|
-
readonly ipfsRegistryCid?: string;
|
|
35
|
-
readonly discoveryIntervalMs: number;
|
|
36
|
-
readonly staleThresholdMs: number;
|
|
37
|
-
}
|
|
38
|
-
export declare class DiscoveryService {
|
|
39
|
-
private readonly deps;
|
|
40
|
-
private readonly config;
|
|
41
|
-
private readonly knownPeers;
|
|
42
|
-
private localManifest;
|
|
43
|
-
private discoveryTimer;
|
|
44
|
-
constructor(deps: DiscoveryServiceDeps, config?: Partial<DiscoveryConfig>);
|
|
45
|
-
publishManifest(manifest: Omit<FederationManifest, 'signature'>): Promise<FederationManifest>;
|
|
46
|
-
getLocalManifest(): FederationManifest | null;
|
|
47
|
-
discoverPeers(): Promise<FederationNode[]>;
|
|
48
|
-
addStaticPeer(endpoint: string, manifest?: FederationManifest): Promise<FederationNode>;
|
|
49
|
-
/**
|
|
50
|
-
* Register an externally-discovered peer (e.g. mapped from an A2A Agent
|
|
51
|
-
* Card via `fromAgentCard`). Unlike `addStaticPeer` this takes a fully
|
|
52
|
-
* constructed node — the caller owns validation of the external format —
|
|
53
|
-
* and the node keeps whatever trust level it was constructed with
|
|
54
|
-
* (A2A-card peers arrive UNTRUSTED). Existing peers are refreshed, not
|
|
55
|
-
* replaced, so accumulated trust state survives re-discovery.
|
|
56
|
-
*/
|
|
57
|
-
registerExternalPeer(node: FederationNode): FederationNode;
|
|
58
|
-
removePeer(nodeId: string): boolean;
|
|
59
|
-
getPeer(nodeId: string): FederationNode | undefined;
|
|
60
|
-
listPeers(): FederationNode[];
|
|
61
|
-
listActivePeers(): FederationNode[];
|
|
62
|
-
pruneStale(): string[];
|
|
63
|
-
startPeriodicDiscovery(): void;
|
|
64
|
-
stopPeriodicDiscovery(): void;
|
|
65
|
-
private findByEndpoint;
|
|
66
|
-
private hashEndpoint;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=discovery-service.d.ts.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { FederationNode } from '../entities/federation-node.js';
|
|
2
|
-
import { FederationSession } from '../entities/federation-session.js';
|
|
3
|
-
export interface HandshakeChallenge {
|
|
4
|
-
readonly challengeId: string;
|
|
5
|
-
readonly nonce: string;
|
|
6
|
-
readonly timestamp: string;
|
|
7
|
-
readonly sourceNodeId: string;
|
|
8
|
-
readonly targetNodeId: string;
|
|
9
|
-
}
|
|
10
|
-
export interface HandshakeChallengeResponse {
|
|
11
|
-
readonly challengeId: string;
|
|
12
|
-
readonly signedNonce: string;
|
|
13
|
-
readonly publicKey: string;
|
|
14
|
-
readonly capabilities: readonly string[];
|
|
15
|
-
}
|
|
16
|
-
export interface HandshakeResult {
|
|
17
|
-
readonly success: boolean;
|
|
18
|
-
readonly session?: FederationSession;
|
|
19
|
-
readonly error?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface HandshakeServiceDeps {
|
|
22
|
-
generateSessionId: () => string;
|
|
23
|
-
generateSessionToken: () => string;
|
|
24
|
-
generateNonce: () => string;
|
|
25
|
-
signChallenge: (nonce: string) => Promise<string>;
|
|
26
|
-
verifySignature: (nonce: string, signature: string, publicKey: string) => Promise<boolean>;
|
|
27
|
-
getLocalNodeId: () => string;
|
|
28
|
-
getLocalPublicKey: () => string;
|
|
29
|
-
getLocalCapabilities: () => readonly string[];
|
|
30
|
-
}
|
|
31
|
-
export interface HandshakeConfig {
|
|
32
|
-
readonly sessionTtlMs: number;
|
|
33
|
-
readonly maxSessionTtlMs: number;
|
|
34
|
-
readonly heartbeatIntervalMs: number;
|
|
35
|
-
readonly challengeTimeoutMs: number;
|
|
36
|
-
}
|
|
37
|
-
export declare class HandshakeService {
|
|
38
|
-
private readonly deps;
|
|
39
|
-
private readonly config;
|
|
40
|
-
private readonly pendingChallenges;
|
|
41
|
-
constructor(deps: HandshakeServiceDeps, config?: Partial<HandshakeConfig>);
|
|
42
|
-
initiateHandshake(remoteNode: FederationNode): Promise<HandshakeChallenge>;
|
|
43
|
-
respondToHandshake(challenge: HandshakeChallenge): Promise<HandshakeChallengeResponse>;
|
|
44
|
-
verifyChallenge(response: HandshakeChallengeResponse, remoteNode: FederationNode): Promise<HandshakeResult>;
|
|
45
|
-
/**
|
|
46
|
-
* Establish a capability-limited session from discovery evidence.
|
|
47
|
-
*
|
|
48
|
-
* A signed manifest proves that the advertised key bound the protocol list;
|
|
49
|
-
* it does not prove live challenge response, so this path never elevates
|
|
50
|
-
* beyond VERIFIED. Endpoint-only peers remain UNTRUSTED with no negotiated
|
|
51
|
-
* optional capabilities. A future wire handshake may elevate either session
|
|
52
|
-
* after authenticating a response received from the remote process.
|
|
53
|
-
*/
|
|
54
|
-
establishDiscoverySession(remoteNode: FederationNode, verifiedManifest: boolean): FederationSession;
|
|
55
|
-
renewSession(session: FederationSession): FederationSession;
|
|
56
|
-
private cleanExpiredChallenges;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=handshake-service.d.ts.map
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { TrustLevel } from '../entities/trust-level.js';
|
|
2
|
-
export type PIIType = 'email' | 'ssn' | 'credit_card' | 'api_key' | 'password' | 'name' | 'address' | 'phone' | 'ip_address' | 'jwt' | 'aws_key' | 'private_key' | 'database_url' | 'github_token';
|
|
3
|
-
export type PIIAction = 'block' | 'redact' | 'hash' | 'pass';
|
|
4
|
-
export interface PIIDetection {
|
|
5
|
-
readonly type: PIIType;
|
|
6
|
-
readonly value: string;
|
|
7
|
-
readonly confidence: number;
|
|
8
|
-
readonly offset: number;
|
|
9
|
-
readonly context: string;
|
|
10
|
-
}
|
|
11
|
-
export interface PIIPolicyConfig {
|
|
12
|
-
defaultAction: PIIAction;
|
|
13
|
-
overrides: Partial<Record<PIIType, {
|
|
14
|
-
action: PIIAction;
|
|
15
|
-
trustLevelOverride?: Partial<Record<TrustLevel, PIIAction>>;
|
|
16
|
-
}>>;
|
|
17
|
-
hashAlgorithm: 'sha256' | 'blake3';
|
|
18
|
-
hashSalt: string;
|
|
19
|
-
redactionPlaceholder: string;
|
|
20
|
-
}
|
|
21
|
-
export interface PIICalibration {
|
|
22
|
-
type: PIIType;
|
|
23
|
-
falsePositiveRate: number;
|
|
24
|
-
falseNegativeRate: number;
|
|
25
|
-
adjustedThreshold: number;
|
|
26
|
-
totalOverrides: number;
|
|
27
|
-
lastCalibrated: string;
|
|
28
|
-
}
|
|
29
|
-
export interface PIITransformResult {
|
|
30
|
-
readonly originalText: string;
|
|
31
|
-
readonly transformedText: string;
|
|
32
|
-
readonly detections: readonly PIIDetection[];
|
|
33
|
-
readonly actionsApplied: readonly {
|
|
34
|
-
type: PIIType;
|
|
35
|
-
action: PIIAction;
|
|
36
|
-
}[];
|
|
37
|
-
readonly blocked: boolean;
|
|
38
|
-
}
|
|
39
|
-
export interface PIIConfidenceThresholds {
|
|
40
|
-
autoBlock: number;
|
|
41
|
-
autoRedact: number;
|
|
42
|
-
flagForReview: number;
|
|
43
|
-
ignore: number;
|
|
44
|
-
}
|
|
45
|
-
export interface PIIPipelineServiceDeps {
|
|
46
|
-
hashFunction: (value: string, salt: string) => string;
|
|
47
|
-
}
|
|
48
|
-
export declare class PIIPipelineService {
|
|
49
|
-
private readonly deps;
|
|
50
|
-
private readonly policy;
|
|
51
|
-
private readonly calibrations;
|
|
52
|
-
private readonly confidenceThresholds;
|
|
53
|
-
constructor(deps: PIIPipelineServiceDeps, policy?: Partial<PIIPolicyConfig>, confidenceThresholds?: Partial<PIIConfidenceThresholds>);
|
|
54
|
-
detect(text: string): PIIDetection[];
|
|
55
|
-
classify(detections: PIIDetection[]): Map<PIIType, PIIDetection[]>;
|
|
56
|
-
evaluate(detection: PIIDetection, trustLevel: TrustLevel): PIIAction;
|
|
57
|
-
transform(text: string, trustLevel: TrustLevel): PIITransformResult;
|
|
58
|
-
updateCalibration(type: PIIType, calibration: PIICalibration): void;
|
|
59
|
-
getCalibration(type: PIIType): PIICalibration | undefined;
|
|
60
|
-
private computeConfidence;
|
|
61
|
-
private getEffectiveThreshold;
|
|
62
|
-
static defaultPolicy(): PIIPolicyConfig;
|
|
63
|
-
static defaultPolicyMatrix(): Record<PIIType, Record<TrustLevel, PIIAction>>;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=pii-pipeline-service.d.ts.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { FederationEnvelope, type FederationEnvelopeProps, type FederationMessageType } from '../entities/federation-envelope.js';
|
|
2
|
-
import { FederationSession } from '../entities/federation-session.js';
|
|
3
|
-
import { TrustLevel } from '../entities/trust-level.js';
|
|
4
|
-
export type RoutingMode = 'direct' | 'broadcast' | 'consensus';
|
|
5
|
-
export interface RoutingResult {
|
|
6
|
-
readonly success: boolean;
|
|
7
|
-
readonly mode: RoutingMode;
|
|
8
|
-
readonly envelopeId: string;
|
|
9
|
-
readonly targetNodeIds: readonly string[];
|
|
10
|
-
readonly error?: string;
|
|
11
|
-
readonly latencyMs?: number;
|
|
12
|
-
}
|
|
13
|
-
export interface ConsensusProposal {
|
|
14
|
-
readonly proposalId: string;
|
|
15
|
-
readonly proposerNodeId: string;
|
|
16
|
-
readonly messageType: FederationMessageType;
|
|
17
|
-
readonly payload: unknown;
|
|
18
|
-
readonly quorumRequired: number;
|
|
19
|
-
readonly votes: Map<string, boolean>;
|
|
20
|
-
readonly createdAt: Date;
|
|
21
|
-
readonly expiresAt: Date;
|
|
22
|
-
}
|
|
23
|
-
export interface RoutingServiceDeps {
|
|
24
|
-
generateEnvelopeId: () => string;
|
|
25
|
-
generateNonce: () => string;
|
|
26
|
-
signEnvelope: (payload: string, sessionToken: string) => string;
|
|
27
|
-
verifyEnvelope: (payload: string, signature: string, sessionToken: string) => boolean;
|
|
28
|
-
scanPii: (text: string, trustLevel: number) => {
|
|
29
|
-
transformedText: string;
|
|
30
|
-
scanResult: FederationEnvelopeProps['piiScanResult'];
|
|
31
|
-
};
|
|
32
|
-
sendToNode: (nodeId: string, envelope: FederationEnvelope) => Promise<void>;
|
|
33
|
-
getActiveSessions: () => FederationSession[];
|
|
34
|
-
getLocalNodeId: () => string;
|
|
35
|
-
/** Current peer authority; absent peers/resolvers receive the untrusted PII policy. */
|
|
36
|
-
getPeerTrustLevel?: (nodeId: string) => TrustLevel | undefined;
|
|
37
|
-
}
|
|
38
|
-
export declare class RoutingService {
|
|
39
|
-
private readonly deps;
|
|
40
|
-
private readonly pendingProposals;
|
|
41
|
-
constructor(deps: RoutingServiceDeps);
|
|
42
|
-
selectMode(messageType: FederationMessageType): RoutingMode;
|
|
43
|
-
send<T>(session: FederationSession, messageType: FederationMessageType, payload: T): Promise<RoutingResult>;
|
|
44
|
-
broadcast<T>(messageType: FederationMessageType, payload: T): Promise<RoutingResult[]>;
|
|
45
|
-
propose<T>(messageType: FederationMessageType, payload: T, quorumFraction?: number): Promise<ConsensusProposal>;
|
|
46
|
-
recordVote(proposalId: string, nodeId: string, vote: boolean): boolean;
|
|
47
|
-
isConsensusReached(proposalId: string): {
|
|
48
|
-
reached: boolean;
|
|
49
|
-
approved: boolean;
|
|
50
|
-
};
|
|
51
|
-
verifyInboundEnvelope(envelope: FederationEnvelope, sessionToken: string): boolean;
|
|
52
|
-
cleanExpiredProposals(): void;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=routing-service.d.ts.map
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ADR-111 Phase 4 — Trust-graded firewall projection.
|
|
3
|
-
*
|
|
4
|
-
* Projects the WG_NETWORK_GATES table (defined in wg-mesh-service.ts) into
|
|
5
|
-
* concrete kernel-firewall rules. Two backends:
|
|
6
|
-
*
|
|
7
|
-
* - `nftables` for Linux — atomic `nft -f <file>` loader, family `inet`,
|
|
8
|
-
* hook `input` (interface-scoped to the WG iface).
|
|
9
|
-
* - `pf` for macOS — `pfctl -a ruflo-fed -f <file>`, anchor-scoped so
|
|
10
|
-
* ruflo's rules don't collide with the operator's main pf ruleset.
|
|
11
|
-
*
|
|
12
|
-
* Like Phase 2's WgMeshService this is a **pure-projection** service: it
|
|
13
|
-
* returns rule strings + the shell command the operator runs. It never
|
|
14
|
-
* shells out or modifies kernel state itself. Operator review is mandatory
|
|
15
|
-
* because `pf` / `nft` reloads atomically replace the active ruleset for
|
|
16
|
-
* the targeted scope — a typo here can drop ssh.
|
|
17
|
-
*
|
|
18
|
-
* v1 scope: the four trust levels VERIFIED/ATTESTED/TRUSTED/PRIVILEGED.
|
|
19
|
-
* UNTRUSTED peers are never in the mesh (excluded by WgMeshService) so
|
|
20
|
-
* they don't need a firewall rule either — implicit drop policy.
|
|
21
|
-
*/
|
|
22
|
-
import { FederationNode } from '../entities/federation-node.js';
|
|
23
|
-
export type WgFirewallPlatform = 'linux-nftables' | 'darwin-pf';
|
|
24
|
-
export interface WgFirewallServiceConfig {
|
|
25
|
-
/** Target platform. Default: auto-detect from process.platform. */
|
|
26
|
-
readonly platform?: WgFirewallPlatform;
|
|
27
|
-
/** WG interface name to scope rules to. Defaults to `ruflo-fed`. */
|
|
28
|
-
readonly interfaceName?: string;
|
|
29
|
-
/** Where the operator should write the rule file. Used for the load-command string. */
|
|
30
|
-
readonly rulePath?: string;
|
|
31
|
-
/** pf anchor (macOS only). Defaults to `ruflo-fed`. */
|
|
32
|
-
readonly pfAnchor?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface WgFirewallRuleSet {
|
|
35
|
-
/** The full rule-file content the operator writes to disk. */
|
|
36
|
-
readonly content: string;
|
|
37
|
-
/** The shell command the operator runs to load it. */
|
|
38
|
-
readonly loadCmd: string;
|
|
39
|
-
/** Recommended file path (informational — the operator decides). */
|
|
40
|
-
readonly rulePath: string;
|
|
41
|
-
/** Per-peer rule projections for audit/inspection. */
|
|
42
|
-
readonly peerProjections: ReadonlyArray<{
|
|
43
|
-
readonly nodeId: string;
|
|
44
|
-
readonly trustLabel: string;
|
|
45
|
-
readonly meshIP: string;
|
|
46
|
-
readonly rules: readonly string[];
|
|
47
|
-
}>;
|
|
48
|
-
}
|
|
49
|
-
export declare class WgFirewallService {
|
|
50
|
-
private readonly platform;
|
|
51
|
-
private readonly interfaceName;
|
|
52
|
-
private readonly rulePath;
|
|
53
|
-
private readonly pfAnchor;
|
|
54
|
-
constructor(config?: WgFirewallServiceConfig);
|
|
55
|
-
getPlatform(): WgFirewallPlatform;
|
|
56
|
-
/**
|
|
57
|
-
* Project the current peer set into a complete rule file (nftables or pf)
|
|
58
|
-
* scoped to the WG interface.
|
|
59
|
-
*
|
|
60
|
-
* Peers below WG_MIN_MESH_TRUST (UNTRUSTED) are dropped — they have no
|
|
61
|
-
* mesh IP and shouldn't appear in firewall allow rules anyway. Peers
|
|
62
|
-
* without `metadata.wgMeshIP` are skipped (a stale manifest with no WG
|
|
63
|
-
* block; the mesh layer already excludes them).
|
|
64
|
-
*/
|
|
65
|
-
projectRules(peers: readonly FederationNode[]): WgFirewallRuleSet;
|
|
66
|
-
private renderNftables;
|
|
67
|
-
private renderPf;
|
|
68
|
-
private defaultRulePath;
|
|
69
|
-
private trustLabel;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=wg-firewall-service.d.ts.map
|