Files
ruflo/plugins/ruflo-graph-intelligence/src/index.ts
T
ruv 3cec3bf94a feat(graph-intelligence): #2044 ADR-123 Phase 8 — federation distribution of signed PR vectors
Phase 8 (BEYOND-SOTA MOAT):
  domain/federation-protocol.ts — 4 wire message types over ADR-104:
    pr_artifact_request   — peer asks for a PR over (graphId, queryNode)
                            with lastKnownGraphHash + lastKnownResultHash
                            for stale-detection
    pr_artifact_response  — peer ships a Phase 7 signed envelope back
    pr_artifact_delta     — sparse delta over a known base resultHash
    pr_artifact_stale     — graph changed; consumer must recompute
    All Zod-validated, discriminated-union routable.
  application/federation-server.ts — receives requests, rate-limits per
    peer (default 60/min), computes via Phase 2-6 adapters + runPageRank,
    seals via Phase 7 sealArtifact. Returns stale rejects when graphHash
    mismatches or graphId unknown.
  application/federation-client.ts — sends requests via FederationTransport;
    verifies inbound envelopes against trusted-public-keys list; falls back
    to local compute (origin: 'peer' / 'stale-fallback' /
    'untrusted-fallback' / 'local-fallback') with reason.
  inProcessTransport() helper stitches a client to a server for in-process
    testing without spinning up real ADR-104 wiring.

104/104 tests passing (+6 for Phase 8):
  - phase8-federation.test.ts: 6 (verifiable peer artifact, untrusted-key
    fallback, stale graphHash, unknown graphId, rate limit per peer,
    unreachable-peer local fallback)

All 8 phases of ADR-123 are now feature-complete. Plugin builds clean,
ships at 0.1.0-alpha.1 with 104 passing tests across the eleven wedges
(W1-W11) + Wedge 12 streaming + the beyond-SOTA Phase 7+8 federation
artifact pipeline.

Next: publish ruflo-graph-intelligence to npm, open + merge PR, create
announcement gist with intro/features/usages (practical to exotic).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 22:05:31 -04:00

106 lines
2.7 KiB
TypeScript

/**
* ruflo-graph-intelligence — RuFlo Graph Intelligence Engine (ADR-123)
*
* Real-time relationship intelligence with complexity-aware execution.
*
* Three-layer architecture:
* Neural Layer — adaptive learning (existing — @claude-flow/neural)
* Graph Intelligence — relationship reasoning (this plugin)
* Complexity Layer — runtime governance (this plugin)
*
* Built on `sublinear-time-solver@1.7.0`.
*/
// Domain
export * from './domain/types.js';
export {
AdapterRegistry,
getRegistry,
resetRegistry,
noopUnsubscribe,
type SublinearAdapter,
} from './domain/adapter.js';
// Infrastructure
export {
coherenceScore,
checkCoherence,
singleEntryPageRank,
conjugateGradient,
neumann,
solveOnChange,
hashResult,
observedComplexity,
runPageRank,
runSolve,
runSolveOnChange,
} from './infrastructure/solver-bridge.js';
// MCP tools
export { graphIntelligenceTools, type MCPTool } from './mcp-tools/index.js';
// Adapters (per-wedge integrations)
export * from './adapters/index.js';
// JL embedding (ADR-121 follow-up)
export { jlEmbed, computeTargetDim, type JLEmbedOptions, type JLEmbedResult } from './infrastructure/jl-embed.js';
// Streaming bridge (Wedge 12)
export {
StreamingBridge,
type StreamingBridgeOptions,
type StreamingUpdate,
} from './application/streaming-bridge.js';
// Federation protocol (Phase 8 — beyond-SOTA)
export {
PrArtifactRequestSchema,
PrArtifactResponseSchema,
PrArtifactDeltaSchema,
PrArtifactStaleSchema,
FederationMessageSchema,
type PrArtifactRequest,
type PrArtifactResponse,
type PrArtifactDelta,
type PrArtifactStale,
type FederationMessage,
type FederationTransport,
} from './domain/federation-protocol.js';
export {
FederationServer,
type FederationServerOptions,
} from './application/federation-server.js';
export {
FederationClient,
inProcessTransport,
type FederationClientOptions,
type FetchPrResult,
} from './application/federation-client.js';
// Signed PR artifacts (Phase 7 — beyond-SOTA)
export {
ARTIFACT_ENVELOPE_VERSION,
ARTIFACT_ENVELOPE_KIND,
SignedPageRankEnvelopeSchema,
SignedPageRankPayloadSchema,
type SignedPageRankEnvelope,
type SignedPageRankPayload,
type ArtifactVerificationResult,
} from './domain/signed-artifact.js';
export {
generateWitnessKey,
loadWitnessKey,
resolveWitnessKey,
sealArtifact,
verifyArtifact,
canonicalJSON,
sha256Hex,
type WitnessKey,
type SealArtifactInput,
} from './infrastructure/witness-signer.js';
// Default export
import { graphIntelligenceTools } from './mcp-tools/index.js';
import { getRegistry } from './domain/adapter.js';
export default { tools: graphIntelligenceTools, registry: getRegistry };