Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Checkpoint: File edits

rUv5dfe341ba0a5
diff --git a/v3/@claude-flow/cli/src/transfer/ipfs/client.ts b/v3/@claude-flow/cli/src/transfer/ipfs/client.ts
new file mode 100644
index 0000000000..f048759765
--- /dev/null
+++ b/v3/@claude-flow/cli/src/transfer/ipfs/client.ts
@@ -0,0 +1,92 @@
+/**
+ * IPFS Client Module
+ * Low-level IPFS operations for discovery and fetching
+ */
+
+import * as crypto from 'crypto';
+
+/**
+ * Resolve IPNS name to CID
+ * In production: Use ipfs-http-client or similar
+ */
+export async function resolveIPNS(
+ ipnsName: string,
+ gateway: string = 'https://ipfs.io'
+): Promise<string | null> {
+ console.log(`[IPFS] Resolving IPNS: ${ipnsName}`);
+
+ // In production: Use IPNS resolution
+ // For demo: Return null to trigger fallback to demo registry
+ try {
+ // Simulate IPNS resolution delay
+ await new Promise(resolve => setTimeout(resolve, 100));
+
+ // For demo purposes, return null to use local demo data
+ // In production, this would do actual IPNS resolution
+ return null;
+ } catch (error) {
+ console.warn(`[IPFS] IPNS resolution failed:`, error);
+ return null;
+ }
+}
+
+/**
+ * Fetch content from IPFS by CID
+ * In production: Use ipfs-http-client or gateway fetch
+ */
+export async function fetchFromIPFS<T>(
+ cid: string,
+ gateway: string = 'https://ipfs.io'
+): Promise<T | null> {
+ console.log(`[IPFS] Fetching CID: ${cid}`);
+
+ try {
+ // Simulate fetch delay
+ await new Promise(resolve => setTimeout(resolve, 100));
+
+ // For demo purposes, return null to use local demo data
+ // In production, this would fetch from IPFS gateway
+ // const url = `${gateway}/ipfs/${cid}`;
+ // const response = await fetch(url);
+ // return await response.json();
+
+ return null;
+ } catch (error) {
+ console.warn(`[IPFS] Fetch failed:`, error);
+ return null;
+ }
+}
+
+/**
+ * Check if CID is pinned
+ */
+export async function isPinned(
+ cid: string,
+ gateway: string = 'https://ipfs.io'
+): Promise<boolean> {
+ // In production: Check with pinning service
+ return false;
+}
+
+/**
+ * Get IPFS gateway URL for a CID
+ */
+export function getGatewayUrl(cid: string, gateway: string = 'https://ipfs.io'): string {
+ return `${gateway}/ipfs/${cid}`;
+}
+
+/**
+ * Validate CID format
+ */
+export function isValidCID(cid: string): boolean {
+ // CIDv0 starts with 'Qm' and is 46 characters
+ // CIDv1 starts with 'b' (base32) and varies in length
+ return /^(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{58,})$/.test(cid);
+}
+
+/**
+ * Generate content hash for verification
+ */
+export function hashContent(content: Buffer): string {
+ return crypto.createHash('sha256').update(content).digest('hex');
+}