Files
iishko-public/iishko-ts
Vlad Gothbreach af292ff15d
checks / pytest (push) Has been cancelled
checks / moderation (push) Has been cancelled
checks / node (push) Has been cancelled
Harden entry safety, unify runtime config, bound document unpacking
Shared-IP safety: entry autoban and entry notifications default off, and a
shared IP is treated as review evidence only. ban_user/ban_cluster refuse
reason=entry_ip_collision (also with the legacy flag set to 1), so token status
and quota are never touched; explicit admin moderation still works.

Reproducible startup: new bot/runtime_config.py and scripts/run.py load the
repository .env (or --env-file) without shell interpolation, normalize
config/DB/upstream aliases, and make the bot, Mini App, gateway, econ cap,
account admin, mk_daemon, entry admin and key notifications resolve the same
paths. "run.py <target> --check" is an offline preflight that starts nothing
and reports placeholders, missing upstream DB and invalid data directories.

Resource limits: aggregate Office decompression, a 400 read-entry cap and a
per-row XLSX cell budget stop early; truncated or corrupt archives are
reported instead of raising.

Deploy and docs: only source-backed systemd units remain, and
deploy/runtime.env.example documents the environment contract including the
0600 session-secret file rules. Removed the destructive
"cp bot/iishko_bot.py bot/grok_bot.py" instruction, the unused generated site/
snapshot and the unsupported iishko-ts staging unit; corrected .env.example,
README, ARCHITECTURE, SECURITY, docs/native-gateway.md and iishko-ts/README.md.

Tests: entry safety, runtime bootstrap, economy paths, file intake, deploy
contract, abilities_guard CLI, and a startup smoke that launches all three
components through scripts/run.py with non-loopback network blocked. Every
config reader, selfcheck included, accepts a UTF-8 BOM.

Verified on this tree: pytest 716 passed + 322 subtests, node --test 73/73,
go test and go vet clean, selfcheck --source-only ok, gitleaks worktree and
history 0 findings. No production or live-split changes are included.
2026-10-31 00:39:35 +03:00
..
…

iishko-ts

Experimental TypeScript/grammY rewrite of the Python bot in this repository. The Python runtime already has a test suite; this prototype explores a different structure and is not a drop-in replacement.

Status

Skeleton / staging, not production-ready. Implemented handlers cover start, balance, existing-key lookup, and streaming chat with quota spend. Key creation, feature parity, and end-to-end integration are not established. The /key prototype can print an existing key into a private chat; do not use it with production credentials. Never run it alongside another polling process using the same bot token. No staging systemd unit is supplied.

Parity roadmap

  • Config (typed, env + config.json)
  • SQLite (WAL, busy_timeout) — users/tokens/ledger
  • Gateway client: OpenAI-compat, SSE streaming, native tools, fallback chain (content-policy 400 → next model)
  • /start (referral capture), /balance, existing-key lookup with KEYWAIT gate
  • Streaming chat with edit-throttle + quota spend
  • Key creation and a private reveal flow (not plaintext chat delivery)
  • Rank/tier system (MODEL_ALIASES + tier gating via sync_rank_limits equivalent)
  • Games/casino/quiz modules
  • Webapp (aiohttp → Hono/Fastify) + pricing showcase
  • Admin panel commands
  • Data migration script (bot.db Python → TS schema)
  • Test suite (vitest) + CI
  • Prod cutover (same token can't poll from two processes — hard switch with rollback unit)

Run

npm install
cp config.example.json config.json   # fill bot_token + main_key
npm run build && npm start           # or: npm run dev

Env overrides: IISHKO_BOT_TOKEN, IISHKO_MAIN_KEY, IISHKO_NEWAPI_URL, IISHKO_DB, IISHKO_ADMIN_ID, IISHKO_DEFAULT_MODEL, IISHKO_TS_CONFIG.

Layout

src/
  config.ts      typed config loader
  db.ts          sqlite schema (users/tokens/ledger)
  gateway.ts     OpenAI-compat client: stream + non-stream + native tools + fallback
  ctx.ts         grammY context with injected deps
  index.ts       bootstrap, session, error handler, signals
  modules/       start.ts | keys.ts | chat.ts | economy.ts