initializing the files and the memory bank.

This commit is contained in:
Yusuf İpek
2025-10-05 04:42:47 +03:00
parent 2dddb27902
commit ddda9fb9dd
28 changed files with 467 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
{
"name": "backend",
"version": "0.1.0",
"private": true,
"description": "YouTube chat poller and realtime bridge.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"dev": "ts-node src/index.ts",
"build": "tsc -p tsconfig.build.json",
"start": "node dist/index.js",
"lint": "eslint 'src/**/*.{ts,tsx}'"
}
}
+12
View File
@@ -0,0 +1,12 @@
import { bootstrapInnertube, fetchChatBatch } from './ingestion/youtubei';
export async function startBackend() {
console.log('Starting backend worker (youtubei ingestion pending).');
const state = await bootstrapInnertube();
console.log('Initial continuation state', state);
await fetchChatBatch(state);
}
if (require.main === module) {
void startBackend();
}
@@ -0,0 +1,18 @@
export type ContinuationState = {
token: string | null;
apiKey?: string;
};
export async function bootstrapInnertube(): Promise<ContinuationState> {
// TODO: fetch initial visitor data and live chat continuation token via youtubei.js
return { token: null };
}
export async function fetchChatBatch(state: ContinuationState) {
// TODO: use youtubei.js to fetch messages with the provided continuation token
// return both normalized messages and the next continuation token
return {
messages: [],
next: state.token
};
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": false
}
}
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"module": "CommonJS",
"target": "ES2021",
"noEmit": false
},
"include": ["src"]
}