Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
9e3a4fa
Fix TypeScript errors and setup Node.js test environment
julesl23 Jul 11, 2025
6c8db14
Fix TypeScript errors and setup Node.js test environment
julesl23 Jul 11, 2025
645a66d
feat: implement CBOR serialization layer for S5 compatibility
julesl23 Jul 12, 2025
2817d9d
feat: update implementation progress for CBOR dependencies and DirV1 …
julesl23 Jul 15, 2025
1304b99
feat: improve DirV1 format for S5 v1 compatibility
julesl23 Jul 16, 2025
8e3e9f0
feat: DirV1 format for S5 v1 compatibility
julesl23 Jul 16, 2025
13338cc
feat: complete Phase 1 - CBOR serialisation with Rust compatibility
julesl23 Jul 16, 2025
8c5b092
feat: implement Phase 2 - Path-Based API
julesl23 Jul 16, 2025
c13022b
feat: complete Phase 2.2 - Cursor-based pagination
julesl23 Jul 17, 2025
1f0d4ec
docs: add API documentation and project README
julesl23 Jul 17, 2025
c28b653
test: add comprehensive test coverage for Phase 2 (132 tests)
julesl23 Jul 18, 2025
9347dfa
docs: update API documentation
julesl23 Jul 18, 2025
54d2051
fix: add ES module support for Node.js compatibility
julesl23 Jul 18, 2025
d939f14
feat: complete Phase 2.4 metadata extraction implementation
julesl23 Jul 20, 2025
c743284
feat(hamt): implement Week 1 core HAMT functionality
julesl23 Jul 20, 2025
c5d89f6
feat(hamt): implement Week 2 functionality - splitting, iteration, an…
julesl23 Jul 20, 2025
3902d92
fix(hamt): resolve cursor iteration and improve test coverage
julesl23 Jul 20, 2025
b9148b1
feat(hamt): complete Week 3 FS5/HAMT directory integration
julesl23 Jul 20, 2025
614d0ef
feat: implement Phase 4 utility functions
julesl23 Jul 20, 2025
daf32df
docs: update API.md to include Phase 4 directory utilities
julesl23 Jul 21, 2025
d882204
docs: update README to reflect Phase 3 and 4 completion
julesl23 Jul 23, 2025
4972a2e
feat: add minimal HTTP test server for integration testing
julesl23 Jul 23, 2025
051e02a
fix: resolve TypeScript compilation errors for build
julesl23 Jul 23, 2025
2972d68
fix: update test server routes for Express v5 compatibility
julesl23 Jul 23, 2025
ad06620
fix: replace FS5 with simple KV storage to avoid directory requirements
julesl23 Jul 23, 2025
5265f52
feat: add CID field to test server PUT response
julesl23 Jul 23, 2025
e3b6802
chore: add Node.js v20 support and update S5 connectivity test
julesl23 Jul 25, 2025
73a77ed
feat: integrate enhanced s5.js with real S5 portal (s5.vup.cx)
julesl23 Jul 29, 2025
ddbbf81
feat: successful S5 portal integration with 100% test pass rate
julesl23 Jul 30, 2025
05deda5
Update README
julesl23 Jul 30, 2025
9184ea0
docs: update progress tracking to reflect accelerated development
julesl23 Jul 30, 2025
5152892
test: fix test suite to use fresh identities and clean up obsolete tests
julesl23 Jul 30, 2025
8b29f40
test: add local HAMT performance benchmarks (mock implementation)
julesl23 Aug 1, 2025
4e9eac2
refactor: reorganise test files and add benchmark documentation
julesl23 Aug 1, 2025
eabaf6d
refactor: consolidate tests/ into test/integration/
julesl23 Aug 1, 2025
eda1e98
docs: comprehensive documentation update for completed milestones
julesl23 Aug 1, 2025
405a95c
feat: add Docker support for test server integration
julesl23 Aug 2, 2025
b260160
Add Node.js server wrapper for Vector DB integration
julesl23 Aug 6, 2025
e53c14d
docs: fix API documentation and update README
julesl23 Aug 7, 2025
f02a6ef
docs: update README.md
julesl23 Aug 17, 2025
5b7ea5a
Add Fabstir LLM Marketplace integration - Real S5 server connecting t…
julesl23 Aug 17, 2025
dec67e8
feat: implement S5 standard protocol endpoints
julesl23 Aug 17, 2025
782788b
fix: Express middleware order for binary data handling
julesl23 Aug 17, 2025
be488c3
🎉 S5 server fully operational - all tests passing!
julesl23 Aug 17, 2025
9764c7f
🎉 S5 server 100% production ready - all tests passing!
julesl23 Aug 17, 2025
aeb02de
🚀 Production Ready: S5 server with real network storage
julesl23 Aug 17, 2025
ac41ba7
feat: Add production Docker setup with persistent S5 identity
julesl23 Aug 18, 2025
1067f8c
refactor: Separate mock tests from real implementation tests
julesl23 Aug 30, 2025
67b32d2
refactor: Reorganize test structure to separate mock and real tests
julesl23 Aug 30, 2025
010cd4d
test: Add real S5 portal integration tests for pagination and walker
julesl23 Sep 2, 2025
4d1305a
refactor: add environment-aware HTTP client for Node.js and browser c…
julesl23 Sep 17, 2025
b74d95f
feat: implement Phase 5.1 media processing foundation
julesl23 Sep 23, 2025
d73e89a
feat: Implement Phase 5.2 - Advanced WASM features for media processing
julesl23 Sep 23, 2025
0ebba8c
feat: Implement Sub-phase 5.3 - Enhanced Canvas fallback features
julesl23 Sep 23, 2025
aa55d22
feat(media): implement browser compatibility detection and strategy s…
julesl23 Sep 23, 2025
4a949a9
feat(media): implement real WASM module for image metadata extraction
julesl23 Sep 23, 2025
2a668b1
feat(media): complete MediaProcessor production implementation
julesl23 Sep 23, 2025
3cc9161
feat: implement production-ready WASM media processing (Phase 5.5)
julesl23 Sep 23, 2025
996b553
refactor: production-ready Canvas implementation cleanup
julesl23 Sep 23, 2025
5f7ae2d
docs: update IMPLEMENTATION.md with progress
Sep 23, 2025
342cffa
test: add real image fixtures and validation tests
Sep 23, 2025
8043d2f
feat: implement bundle size optimization and code-splitting
Sep 23, 2025
135887d
docs: Update API.md and README.md for Phase 5 Media Processing comple…
Sep 24, 2025
b070546
feat: complete Phase 5 Media Processing with comprehensive demos and …
Sep 26, 2025
b3c781c
docs: clarify demo UX and add Phase 5 test report
Oct 1, 2025
98054b1
Merge feature/phase5-media-processing: Complete Phase 5 Media Processing
Oct 1, 2025
1eadfab
docs: document Phase 5 WASM input validation edge cases
Oct 1, 2025
285fd2a
fix(media): add input validation for WASM metadata extraction
Oct 1, 2025
6d3b72e
feat(fs): add batch operations integration test and fix copy method
Oct 1, 2025
835ec40
docs: update README.md: document batch operations test in integration…
Oct 1, 2025
271b008
fix: add TypeScript to devDependencies and resolve type errors
Oct 8, 2025
396324c
fix: resolve remaining TypeScript 5.8 BlobPart and IDBKey type errors
Oct 8, 2025
c9f1cfe
docs: add platform-specific notes for media processing tests
Oct 8, 2025
c059870
refactor: suppress verbose WASM fallback error messages
Oct 8, 2025
adc4854
docs: missing instructions for code-splitting demo server setup
Oct 8, 2025
01fecfd
feat: add XChaCha20-Poly1305 encryption
Oct 17, 2025
637ed66
docs: add encryption section to README
Oct 17, 2025
c6657d1
docs: reposition encryption in README
Oct 17, 2025
da52c1f
feat: implement thumbnail generation for Phase 6.1
Oct 17, 2025
d3760c2
feat: implement progressive loading for Phase 6.2
Oct 17, 2025
a7c6ddc
feat: implement Phase 6.3 - FS5 Media Extensions with comprehensive t…
Oct 17, 2025
3648464
feat: implement Phase 6.4 - Bundle Optimisation with comprehensive an…
Oct 17, 2025
f12538a
feat: implement Phase 6.5 - Advanced CID API with comprehensive test …
Oct 17, 2025
64628e8
docs: complete Phase 6.5.6 - Advanced CID API documentation
Oct 17, 2025
f851d0c
docs: add Advanced CID API test command to README
Oct 17, 2025
63a0b67
fix: resolve Advanced CID API integration issues
Oct 17, 2025
17b3995
docs: clarify Advanced CID API testing documentation
Oct 17, 2025
bf354b3
fix: resolve 0×0 dimensions in Image Metadata Extraction Demo
Oct 18, 2025
ede116a
docs: update IMPLEMENTATION.md to reflect Phase 6-7 completion
Oct 20, 2025
a1335c9
docs: update README project status to reflect Phase 6-7 completion
Oct 20, 2025
950795e
docs: remove obsolete integration directory
Oct 20, 2025
a09b43d
chore: bump version to 0.3.0 and rename package to s5js
Oct 21, 2025
fc36794
refactor: streamline FS5Advanced API to 4 essential methods
Oct 23, 2025
4872725
docs: advanced media processing evidence package
Oct 23, 2025
78d7ee0
docs: add Grant Milestone 5 Deliverables section to README
Oct 23, 2025
8ba765a
fix: complete WebP dimension parsing (6/6 images working)
Oct 25, 2025
a4943b5
docs: update MILESTONE5_TESTING_GUIDE with correct test counts
Oct 25, 2025
12cc5c4
chore: adopt dual MIT/Apache-2.0 licensing matching s5-rs ecosystem
Oct 26, 2025
ba6cb95
docs: add Safari browser testing results to Milestone 5 evidence
Oct 26, 2025
679e890
fix: include all core functionality in s5/advanced export
Oct 27, 2025
450ed53
fix: complete bundle export architecture for all entry points
Oct 27, 2025
d65c60f
chore: prepare v0.9.0-beta release
Oct 31, 2025
c1e1a07
fix: replace undici with native fetch for universal compatibility
Nov 3, 2025
8e80705
docs: polish demo scripts for Milestone 8
Nov 9, 2025
4028607
docs: create mdBook documentation for S5 docs integration
Nov 9, 2025
8975fbd
docs: update documentation to use official s5-dev namespace
Nov 10, 2025
80a8c03
docs: fix GitHub repository references in mdBook config
Nov 10, 2025
46d7e50
docs: update contact information to S5 Community Discord
Nov 10, 2025
990add9
chore: reorganize docs and remove testing infrastructure
Nov 12, 2025
086b995
chore: prepare repository for upstream PR to s5-dev/s5.js
Nov 12, 2025
5bc5e95
Merge pull request #1 from julesl23/feature/phase8
julesl23 Nov 12, 2025
ab513b4
docs: add comprehensive CHANGELOG for grant milestones
Nov 12, 2025
1d39722
fix: restore undici for Node.js portal upload compatibility
Nov 14, 2025
239fc51
fix: await registry database write to prevent race condition
Nov 15, 2025
f5a2e70
chore: bump to v0.9.0-beta.3 with registry fix
Nov 15, 2025
337f2a5
chore: cleanup verbose console logging (#2)
julesl23 Dec 6, 2025
eeb1764
feat: add Connection API for mobile WebSocket handling (#3)
julesl23 Dec 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 71 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,71 @@
node_modules
# Dependencies
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build outputs
dist/
build/
*.tgz
out/
.next/

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage/
*.lcov
.nyc_output/

# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.env.*.local

# IDE files
.vscode/settings.json
.idea/
*.swp
*.swo
*~

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Temporary files
*.tmp
*.temp
*.backup
debug_*.js
.cache/

# Logs
logs
*.log

# Miscellaneous
docs/design/
docs/grant/
screenshots/

# Docker
.dockerignore
docker-compose.override.yml

demos/media/baseline-performance.json
demos/media/metadata-report.html
tmp/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
144 changes: 144 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Changelog

All notable changes to Enhanced s5.js will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.0-beta.1] - 2025-10-31

### Major Features - Sia Foundation Grant Implementation

This release represents the culmination of an 8-month Sia Foundation grant to enhance s5.js with a comprehensive set of features for decentralized storage applications.

#### Path-based API (Phases 2-3)
- **Added** simplified filesystem API with `get()`, `put()`, `delete()`, `list()`, and `getMetadata()` operations
- **Added** automatic path normalization and Unicode support
- **Added** CBOR-based DirV1 directory format for deterministic serialization
- **Added** DAG-CBOR encoding for cross-implementation compatibility
- **Added** cursor-based pagination for efficient large directory iteration
- **Added** directory creation and management utilities

#### HAMT Sharding (Phase 3)
- **Added** Hash Array Mapped Trie (HAMT) for scalable directory storage
- **Added** automatic sharding at 1000+ entries per directory
- **Added** 32-way branching with xxhash64 distribution
- **Added** transparent fallback between flat and sharded directories
- **Added** O(log n) performance for directories with millions of entries

#### Directory Utilities (Phase 4)
- **Added** `DirectoryWalker` class for recursive directory traversal
- **Added** configurable depth limits and filtering options
- **Added** resumable traversal with cursor support
- **Added** `BatchOperations` class for high-level copy/delete operations
- **Added** progress tracking and error handling for batch operations

#### Media Processing (Phases 5-6)
- **Added** `MediaProcessor` for image metadata extraction
- **Added** WebAssembly (WASM) based image processing with Canvas fallback
- **Added** automatic browser capability detection
- **Added** support for JPEG, PNG, WebP formats
- **Added** thumbnail generation with smart cropping
- **Added** dominant color extraction and color palette generation
- **Added** progressive image loading support
- **Added** FS5 integration: `putImage()`, `getThumbnail()`, `getImageMetadata()`, `createImageGallery()`

#### Advanced CID API (Phase 6)
- **Added** `FS5Advanced` class for content-addressed operations
- **Added** `pathToCID()` - convert filesystem paths to CIDs
- **Added** `cidToPath()` - resolve CIDs to filesystem paths
- **Added** `getByCID()` - retrieve data directly by CID
- **Added** `putByCID()` - store data with explicit CID
- **Added** CID utility functions: `formatCID()`, `parseCID()`, `verifyCID()`, `cidToString()`
- **Added** 74 comprehensive tests for CID operations

#### Bundle Optimization (Phase 6)
- **Added** modular exports for code-splitting
- **Added** `@s5-dev/s5js` - full bundle (61 KB brotli)
- **Added** `@s5-dev/s5js/core` - core functionality without media (60 KB)
- **Added** `@s5-dev/s5js/media` - media processing standalone (10 KB)
- **Added** `@s5-dev/s5js/advanced` - core + CID utilities (61 KB)
- **Achievement**: 61 KB compressed - **10× under the 700 KB grant requirement**

#### Testing & Documentation (Phases 7-8)
- **Added** 437 comprehensive tests across all features
- **Added** real S5 portal integration testing (s5.vup.cx)
- **Added** browser compatibility testing (Chrome, Firefox, Safari)
- **Added** performance benchmarks for HAMT operations
- **Added** comprehensive API documentation
- **Added** getting-started tutorial and demo scripts
- **Added** mdBook documentation for docs.sfive.net integration

### Core Improvements

#### Compatibility
- **Fixed** browser bundling by removing Node.js-specific dependencies
- **Fixed** replaced undici with native `globalThis.fetch` for universal compatibility
- **Added** support for Node.js 18+ native fetch API
- **Added** dual browser/Node.js environment support

#### Architecture
- **Added** dual MIT/Apache-2.0 licensing matching s5-rs ecosystem
- **Improved** TypeScript type definitions and IDE support
- **Improved** error handling and validation across all APIs
- **Improved** test coverage to 437 tests passing

#### Bundle Exports
- **Fixed** export architecture to properly include all functionality
- **Fixed** advanced bundle now correctly includes core features
- **Fixed** media bundle can be used standalone or lazy-loaded

### Breaking Changes

- **Path API**: New primary interface for file operations (legacy CID-based API still available)
- **Directory Format**: Uses DirV1 CBOR format (not compatible with old MessagePack format)
- **Package Name**: Published as `@s5-dev/s5js` (replaces `s5-js`)
- **Node.js**: Requires Node.js 20+ (for native fetch support)

### Grant Context

This release fulfills Milestones 2-8 of the Sia Foundation grant for Enhanced s5.js:
- **Month 2-3**: Path-based API and HAMT integration
- **Month 4**: Directory utilities (walker, batch operations)
- **Month 5**: Media processing foundation
- **Month 6**: Advanced media features and CID API
- **Month 7**: Testing and performance validation
- **Month 8**: Documentation and upstream integration

**Total Grant Value**: $49,600 USD (8 months × $6,200/month)

### Performance

- **HAMT Sharding**: O(log n) operations on directories with millions of entries
- **Bundle Size**: 61 KB (brotli) - 10× under budget
- **Cursor Pagination**: Memory-efficient iteration over large directories
- **Media Processing**: Thumbnail generation in ~50ms (WASM) or ~100ms (Canvas)

### Known Limitations

- Browser tests require Python 3 for local HTTP server
- WebAssembly media processing requires modern browser support
- HAMT sharding threshold set at 1000 entries (configurable)

### Contributors

- **Jules Lai (julesl23)** - Grant implementation
- **redsolver** - Original s5.js architecture and guidance
- **Lume Web** - S5 protocol development

### Links

- **Grant Proposal**: [Sia Foundation Grant - Enhanced s5.js](docs/grant/Sia%20Standard%20Grant%20-%20Enhanced%20s5_js.md)
- **API Documentation**: [docs/API.md](docs/API.md)
- **Design Documents**:
- [Enhanced S5.js - Revised Code Design](docs/design/Enhanced%20S5_js%20-%20Revised%20Code%20Design.md)
- [Enhanced S5.js - Revised Code Design - Part II](docs/design/Enhanced%20S5_js%20-%20Revised%20Code%20Design%20-%20part%20II.md)
- **Testing Guide**: [docs/testing/MILESTONE5_TESTING_GUIDE.md](docs/testing/MILESTONE5_TESTING_GUIDE.md)
- **Bundle Analysis**: [docs/BUNDLE_ANALYSIS.md](docs/BUNDLE_ANALYSIS.md)
- **Benchmarks**: [docs/BENCHMARKS.md](docs/BENCHMARKS.md)

---

## Pre-Grant History

For changes prior to the Enhanced s5.js grant project, see the original s5.js repository history.
59 changes: 59 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM ubuntu:22.04

# Set environment variables to prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC

# Update and install essential packages (excluding nodejs/npm for now)
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
build-essential \
sudo \
python3 \
python3-pip \
vim \
nano \
&& rm -rf /var/lib/apt/lists/*

# Install Node.js 20.x (LTS) from NodeSource
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*

# Install global npm packages for TypeScript development
RUN npm install -g \
typescript \
ts-node \
@types/node \
npm@latest

# Create developer user with sudo privileges
RUN useradd -m -s /bin/bash developer && \
echo "developer:developer" | chpasswd && \
usermod -aG sudo developer && \
echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Switch to developer user
USER developer
WORKDIR /home/developer

# Create project directory
RUN mkdir -p /home/developer/s5.js

# Set up npm global directory for the developer user
RUN mkdir -p /home/developer/.npm-global && \
npm config set prefix '/home/developer/.npm-global' && \
echo 'export PATH=/home/developer/.npm-global/bin:$PATH' >> /home/developer/.bashrc

# Expose ports
# 5522 for Enhanced s5.js
# 5523 for external access
EXPOSE 5522 5523

# Set the working directory
WORKDIR /home/developer/s5.js

# Keep container running
CMD ["/bin/bash"]
9 changes: 9 additions & 0 deletions Dockerfile.mock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
COPY test/integration/test-server.js ./test/integration/
COPY dist ./dist
RUN npm install express
EXPOSE 5524
ENV PORT=5524
CMD ["node", "test/integration/test-server.js"]
49 changes: 49 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Production Dockerfile for S5.js Server
FROM node:20-alpine

# Install required system dependencies
RUN apk add --no-cache \
python3 \
make \
g++ \
&& rm -rf /var/cache/apk/*

# Create app directory
WORKDIR /app

# Copy package files
COPY package*.json ./

# Install production dependencies only
RUN npm ci --only=production && \
npm cache clean --force

# Copy only necessary production files
COPY dist/ ./dist/
COPY server-real-s5.js ./

# Create a non-root user to run the app
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001

# Create directory for seed file mount
RUN mkdir -p /home/nodejs/.s5 && \
chown -R nodejs:nodejs /home/nodejs/.s5

# Switch to non-root user
USER nodejs

# Expose the S5 server port
EXPOSE 5522

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:5522/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"

# Default to real mode, can be overridden
ENV S5_MODE=real
ENV PORT=5522
ENV NODE_ENV=production

# Start the server
CMD ["node", "server-real-s5.js"]
27 changes: 27 additions & 0 deletions Dockerfile.s5js-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:20-alpine

# Install minimal dependencies
RUN apk add --no-cache curl

# Create app directory
WORKDIR /app

# Copy necessary files
COPY server-real-s5.js .
COPY package.json .
COPY package-lock.json .

# Copy source directory (contains the actual S5 implementation)
COPY src ./src

# Copy node_modules
COPY node_modules ./node_modules

# Create directory for seed file
RUN mkdir -p /app/config

# Expose port
EXPOSE 5522

# Run server
CMD ["node", "server-real-s5.js"]
Loading