CI / validate (push) Failing after 1s
Complete rewrite of the pi Zulip extension as a standalone Node.js service with direct harness API calls. No longer depends on pi's session — survives pi shutdown and restart. Changes: - src/index.ts: Complete rewrite — standalone process, not a pi extension - Direct harness API calls (POST /v1/chat/completions) with conversation memory - Per-sender conversation history (up to 50 messages) - Placeholder->edit streaming for Zulip DMs - Typing indicators via Zulip API - Health endpoint on :9200 - Exponential backoff reconnection - Graceful shutdown on SIGINT/SIGTERM - abiba-zulip.service: systemd service unit file - README.md: Updated deployment instructions - package.json/tsconfig.json: Updated for standalone app Deploy: npm install -> npx tsc -> systemctl enable abiba-zulip Closes issue #24 (Hermes parity for pi)
72 lines
1.6 KiB
Markdown
72 lines
1.6 KiB
Markdown
# Abiba Zulip Gateway — Standalone Service
|
|
|
|
**Replaces** the old pi extension (`~/.pi/agent/extensions/zulip/`).
|
|
|
|
Instead of injecting messages into pi's session (which dies when pi exits), this
|
|
runs as an independent Node.js **systemd service** that:
|
|
- Polls Zulip event queue for DMs
|
|
- Calls the harness inference API directly (no pi dependency)
|
|
- Maintains per-sender conversation memory
|
|
- Survives pi shutdown and restart
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Zulip event queue → poll every 3s → DM detected
|
|
→ send typing indicator + placeholder
|
|
→ POST /v1/chat/completions with conversation history
|
|
→ edit placeholder with final response
|
|
```
|
|
|
|
## Requirements
|
|
|
|
- Node.js 22+
|
|
- `npm install` in this directory
|
|
|
|
## Config
|
|
|
|
All config via environment variables. Copy `abiba-zulip.service` to set up as a
|
|
systemd service, or run directly:
|
|
|
|
```bash
|
|
ZULIP_EMAIL=abiba-bot@chat.sysloggh.net \
|
|
ZULIP_API_KEY=your_key \
|
|
ZULIP_SITE=https://chat.sysloggh.net \
|
|
HARNESS_URL=http://192.168.68.116/v1/chat/completions \
|
|
HARNESS_API_KEY=sk-xxx \
|
|
HARNESS_MODEL=qwen3.6-35B-A3B \
|
|
node dist/index.js
|
|
```
|
|
|
|
## Deploy as a service
|
|
|
|
```bash
|
|
# 1. Install deps
|
|
cd /opt/abiba-zulip
|
|
npm install
|
|
|
|
# 2. Build
|
|
npx tsc
|
|
|
|
# 3. Install systemd service
|
|
cp abiba-zulip.service /etc/systemd/system/
|
|
systemctl daemon-reload
|
|
systemctl enable abiba-zulip
|
|
systemctl start abiba-zulip
|
|
|
|
# 4. Check status
|
|
systemctl status abiba-zulip
|
|
journalctl -u abiba-zulip -f
|
|
|
|
# 5. Health check
|
|
curl http://127.0.0.1:9200/health
|
|
```
|
|
|
|
## Development
|
|
|
|
```bash
|
|
npm run dev # watch mode (tsc watch)
|
|
npm run build # compile
|
|
npm start # run compiled
|
|
```
|