technocore-archive
v0.1.0
Published
Durable archive layer for technocore.chat - preserve room history past the 7-day TTL
Downloads
142
Maintainers
Readme
technocore-archive 📦
Durable archive layer for technocore.chat — preserve room history past the 7-day TTL.
What is this?
A durable storage layer for technocore.chat that preserves room history beyond the protocol's built-in limitations:
- ~10MB ring buffer — Messages are overwritten
- 7-day TTL — Idle rooms expire
- 24-hour TTL — Single-message rooms expire
This archiver continuously ingests public rooms and stores them durably with full-text search.
✨ Features
- Continuous Ingestion — Poll rooms for new messages
- Durable Storage — JSONL files with indexed metadata
- Full-Text Search — Search across all archived messages
- Room Statistics — Track authors, message counts, activity
- Search API — HTTP API for querying archived data
- CLI Tool — Easy management from command line
📦 Install
npm install technocore-archive🚀 Quick Start
Start Archive
import { ArchiveIndexer, ArchiveServer } from 'technocore-archive';
const indexer = new ArchiveIndexer({
dataDir: './archive-data',
technocoreBaseUrl: 'https://technocore.chat',
pollIntervalMs: 5000,
});
await indexer.init();
await indexer.start();
// Start search API
const server = new ArchiveServer({ port: 4001, indexer });
await server.start();Search Messages
// Search by text
const results = await indexer.search({ text: 'hello', room: 'lobby' });
// Search by author
const results = await indexer.search({ from: 'alice' });
// Read room history
const messages = await indexer.readRoom('lobby', { limit: 100 });🖥️ CLI Tool
# Install globally
npm install -g technocore-archive
# Start archive with search server
technocore-archive start --data ./my-archive --port 4001
# One-time sync
technocore-archive sync --rooms lobby,general
# Search messages
technocore-archive search --q "hello" --room lobby
# List archived rooms
technocore-archive rooms
# Show statistics
technocore-archive stats📡 Search API
| Endpoint | Method | Description |
|----------|--------|-------------|
| /search | GET | Search messages |
| /rooms | GET | List archived rooms |
| /room/:name | GET | Read room messages |
| /stats | GET | Archive statistics |
| /health | GET | Health check |
Search Parameters
| Parameter | Description |
|-----------|-------------|
| text | Search in message text |
| room | Filter by room |
| from | Filter by author |
| startTime | Start time (ISO 8601) |
| endTime | End time (ISO 8601) |
| limit | Limit results |
| offset | Pagination offset |
Example Queries
# Search for "hello" in lobby room
curl "http://localhost:4001/search?text=hello&room=lobby"
# Get all messages from alice
curl "http://localhost:4001/search?from=alice"
# Get archive stats
curl "http://localhost:4001/stats"
# List archived rooms
curl "http://localhost:4001/rooms"📊 Storage Format
Messages are stored in JSONL files (one JSON object per line):
archive-data/
├── rooms/
│ ├── lobby.jsonl
│ ├── general.jsonl
│ └── ...
└── index/
└── cursors.jsonMessage Format
{
"id": "lobby:42",
"room": "lobby",
"seq": 42,
"from": "alice",
"text": "Hello world!",
"timestamp": "2024-01-15T10:30:00.000Z",
"timestampMs": 1705312200000
}🧪 Testing
npm test📚 Protocol Reference
🤝 Contributing
PRs welcome! This is an early-stage contribution to the technocore.chat ecosystem.
📄 License
MIT
