mirror of
https://github.com/larchanka/manbot.git
synced 2026-05-13 21:42:08 +00:00
Fix typescript unused variables
This commit is contained in:
committed by
Mikhail Larchanka
parent
df307937c1
commit
e987a1082a
@@ -30,4 +30,6 @@ To ensure a structured and consistent development process, ManBot must follow th
|
||||
- Clear any specific status tags or update them as appropriate for the completed state.
|
||||
|
||||
## 7. Iteration
|
||||
- Verify `_BOARD.md` is correctly updated.
|
||||
- Read `_board/INSTRUCTIONS.md`.
|
||||
- Proceed to the next task in the `## To Do` column and repeat the process.
|
||||
|
||||
113
_board/PLAN.md
113
_board/PLAN.md
@@ -1,102 +1,23 @@
|
||||
# 🗂️ File Processing Pipeline — Implementation Plan
|
||||
# Architecture Overhaul: Autonomous AI & Robust Supervision
|
||||
|
||||
## Overview
|
||||
Add file processing capabilities to ManBot. Users can send text documents, photos, and audio messages via Telegram. The system processes each file type independently: text is read and injected into context (or indexed into RAG if large), images are OCR'd or described using Ollama vision (`glm-ocr:q8_0`), and audio is transcribed using Whisper (`nodejs-whisper` + `ffmpeg-static`). All processing happens in a new independent `file-processor` process, consistent with the existing process-isolation architecture.
|
||||
This plan describes the transition to an "Advanced" architecture where human and scheduled inputs are unified, and the system becomes more resilient through active process supervision.
|
||||
|
||||
---
|
||||
## Phase 1: Infrastructure & Supervisor (AO-01 to AO-03)
|
||||
We will standardize the lifecycle of all independent processes and implement a Supervisor in the Orchestrator to monitor and auto-restart crashed components.
|
||||
|
||||
## Architecture Decisions
|
||||
## Phase 2: Autonomous Cron Queries (AO-04 to AO-06)
|
||||
We will turn existing cron-based notifications into full AI tasks.
|
||||
- **Data Reuse**: The existing `reminderMessage` field in the `cron_schedules` table will store the AI query.
|
||||
- **Workflow**: When a cron job fires, it will emit a `synthetic_goal` event.
|
||||
- **Statefulness**: Each run is assigned a unique `UUID` (taskId) to reuse existing storage/memory structures.
|
||||
|
||||
| Decision | Choice | Rationale |
|
||||
|---|---|---|
|
||||
| Audio format conversion | `ffmpeg-static` (npm) | No system ffmpeg installed; bundled binary is self-contained |
|
||||
| Audio transcription | `nodejs-whisper` (base.en) | ~200MB, runs locally, no cloud dependency |
|
||||
| Image model | `glm-ocr:q8_0` via Ollama | Already connected to local Ollama; on-demand |
|
||||
| Image behaviour | Auto OCR + describe | Model decides: text → extract verbatim, no text → describe |
|
||||
| Long text handling | Chunk → Summarize → RAG | Preserves content accessible via semantic search |
|
||||
| Large file failures | Warn user, continue | Partial failures don't block the task pipeline |
|
||||
| File cleanup | Delete after processing | Stateless processor; no persistent upload storage |
|
||||
## Phase 3: Concurrency & Lifecycle (AO-07 to AO-09)
|
||||
Establish a robust execution environment.
|
||||
- **Configurable Concurrency**: A new setting in `config.json` to limit parallel tasks (1-N, with 0 as infinite).
|
||||
- **History Anchoring**: Ensure cron-triggered tasks have consistent conversation history.
|
||||
|
||||
---
|
||||
## Phase 4: Monitoring & DashBoard (AO-10 to AO-12)
|
||||
Upgrade the dashboard to provide real-time process health status, live IPC log viewing, and a dedicated UI for managing the new autonomous AI queries.
|
||||
|
||||
## Phases
|
||||
|
||||
### Phase 1 — Foundation (Tasks FP-01 to FP-03)
|
||||
Set up infrastructure: new npm packages, config types, TypeScript interfaces.
|
||||
No runtime changes — pure setup.
|
||||
|
||||
### Phase 2 — Core Services (Tasks FP-04 to FP-06)
|
||||
Build the three low-level utilities:
|
||||
- `OllamaAdapter.chatWithImage()` for vision
|
||||
- `convertToWav()` for audio conversion
|
||||
- `transcribeAudio()` for Whisper transcription
|
||||
|
||||
Each utility is independently testable and has no dependency on the new process.
|
||||
|
||||
### Phase 3 — File Processor Process (Tasks FP-07 to FP-08)
|
||||
Build the `file-processor` service as a new `BaseProcess` subprocess and register it in the Orchestrator. At this point the service exists and responds to `file.process` envelopes.
|
||||
|
||||
### Phase 4 — Telegram Integration (Tasks FP-09 to FP-11)
|
||||
Wire the Telegram side: file detection, download, `file.ingest` emission, and the Orchestrator handler that calls `file-processor`, collects results, handles warnings, and builds the enriched goal. Long-text RAG indexing pipeline implemented here.
|
||||
|
||||
### Phase 5 — Planner Integration + Cleanup (Tasks FP-12 to FP-13)
|
||||
Update the planner prompt to handle enriched goals and indexed file references. Set up upload directory lifecycle (init + orphan cleanup).
|
||||
|
||||
### Phase 6 — Documentation and Verification (Tasks FP-14 to FP-15)
|
||||
Update all docs to reflect the new subsystem, then perform end-to-end manual verification across all file types and edge cases.
|
||||
|
||||
---
|
||||
|
||||
## Data Flow
|
||||
|
||||
```
|
||||
User sends file on Telegram
|
||||
↓
|
||||
[telegram-adapter]
|
||||
Detect attachment → download → classify → emit file.ingest
|
||||
↓
|
||||
[core / Orchestrator]
|
||||
file.ingest handler
|
||||
↓ (parallel)
|
||||
┌─ text → [file-processor] → inline or text_long
|
||||
│ └─ text_long → chunk → summarize (model-router) → insert (rag-service)
|
||||
├─ image → [file-processor] → OllamaAdapter.chatWithImage → OCR/description
|
||||
└─ audio → [file-processor] → convertToWav → transcribeAudio → transcript
|
||||
↓
|
||||
Build enrichedGoal
|
||||
↓
|
||||
runTaskPipeline → Planner → Executor → ...
|
||||
↓
|
||||
[telegram-adapter] → User
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## New Files
|
||||
- `src/services/file-processor.ts` — new independent service process
|
||||
- `src/utils/audio-converter.ts` — ffmpeg-static conversion utility
|
||||
- `src/utils/whisper-transcriber.ts` — nodejs-whisper transcription utility
|
||||
|
||||
## Modified Files
|
||||
- `src/services/ollama-adapter.ts` — add `chatWithImage()`
|
||||
- `src/adapters/telegram-adapter.ts` — file detection, download, `file.ingest`
|
||||
- `src/core/orchestrator.ts` — register file-processor, add `file.ingest` handler, long-text pipeline
|
||||
- `src/agents/prompts/planner.ts` — file context instructions + examples
|
||||
- `src/shared/config.ts` — `WhisperConfig`, `FileProcessorConfig`
|
||||
- `config.json`, `config.json.example` — new config sections
|
||||
- `_docs/COMPONENTS.md`, `_docs/TECH.md`, `_docs/MESSAGE PROTOCOL SPEC.md`, `README.md`
|
||||
|
||||
---
|
||||
|
||||
## New npm Dependencies
|
||||
| Package | Type | Purpose |
|
||||
|---|---|---|
|
||||
| `nodejs-whisper` | runtime | Speech-to-text transcription |
|
||||
| `ffmpeg-static` | runtime | Audio format conversion (ogg → wav) |
|
||||
|
||||
---
|
||||
|
||||
## Risk Notes
|
||||
- **Whisper model download**: ~200MB on first audio request. User will see a delay and a descriptive error on first attempt. Subsequent uses are fast.
|
||||
- **OCR model availability**: `glm-ocr:q8_0` must be pulled in Ollama before use (`ollama pull glm-ocr:q8_0`). If missing, image processing returns an Ollama error — the Orchestrator warns the user and skips.
|
||||
- **Context length**: Inline file content is capped to prevent planner prompt overflow. Long files go through RAG instead.
|
||||
## Phase 5: Verification (AO-13 to AO-15)
|
||||
Final validation of autonomous flows and supervisor behavior.
|
||||
|
||||
168
_board/TASKS.md
168
_board/TASKS.md
@@ -1,135 +1,75 @@
|
||||
# 📋 Tasks — File Processing Pipeline
|
||||
# 📋 Tasks — Architecture Overhaul (AO)
|
||||
|
||||
All tasks are prefixed `FP-` (File Processing). They are ordered by implementation dependency.
|
||||
All tasks are prefixed `AO-` (Architecture Overhaul).
|
||||
|
||||
---
|
||||
|
||||
## Phase 1 — Foundation
|
||||
## Phase 1 — Infrastructure & Supervision
|
||||
|
||||
### FP-01 Add npm Dependencies
|
||||
**File**: `package.json`
|
||||
**Deps**: None
|
||||
Install `nodejs-whisper` and `ffmpeg-static` runtime packages.
|
||||
→ [FP-01_ADD_DEPENDENCIES.md](./TASKS/FP-01_ADD_DEPENDENCIES.md)
|
||||
### AO-01 Standardize BaseProcess Lifecycle
|
||||
Add heartbeats and health reporting to the common process base class.
|
||||
→ [AO-01_BASE_PROCESS_LIFECYCLE.md](./TASKS/AO-01_BASE_PROCESS_LIFECYCLE.md)
|
||||
|
||||
### AO-02 Implement Process Supervisor
|
||||
Add auto-restart and crash tracking to Orchestrator.
|
||||
→ [AO-02_PROCESS_SUPERVISOR.md](./TASKS/AO-02_PROCESS_SUPERVISOR.md)
|
||||
|
||||
### AO-03 CLI Interactive Mode
|
||||
Enable direct stdin testing for all services.
|
||||
→ [AO-03_CLI_INTERACTIVE_MODE.md](./TASKS/AO-03_CLI_INTERACTIVE_MODE.md)
|
||||
|
||||
---
|
||||
|
||||
### FP-02 Add Config Types and Defaults
|
||||
**File**: `src/shared/config.ts`, `config.json`
|
||||
**Deps**: None
|
||||
Add `WhisperConfig` and `FileProcessorConfig` interfaces, defaults, and env var overrides.
|
||||
→ [FP-02_CONFIG_TYPES.md](./TASKS/FP-02_CONFIG_TYPES.md)
|
||||
## Phase 2 — Autonomous AI Queries
|
||||
|
||||
### AO-04 CronManager AI Query Support
|
||||
Trigger `event.cron.ai_query` using the `reminderMessage` as the query text.
|
||||
→ [AO-04_CRON_AI_QUERY.md](./TASKS/AO-04_CRON_AI_QUERY.md)
|
||||
|
||||
### AO-05 Synthetic Goal Ingestion (Stateful)
|
||||
Implement Orchestrator handler for cron events. Assign unique `taskId` for each run.
|
||||
→ [AO-05_SYNTHETIC_GOAL_INGESTION.md](./TASKS/AO-05_SYNTHETIC_GOAL_INGESTION.md)
|
||||
|
||||
### AO-06 History Anchoring for Synthetic Tasks
|
||||
Ensure cron-triggered tasks have access to relevant historical context.
|
||||
→ [AO-06_HISTORY_ANCHORING.md](./TASKS/AO-06_HISTORY_ANCHORING.md)
|
||||
|
||||
---
|
||||
|
||||
### FP-03 Define File Processing Protocol Types
|
||||
**File**: `src/shared/protocol.ts`
|
||||
**Deps**: FP-02
|
||||
Define `FileDescriptor`, `FileIngestPayload`, `FileProcessRequest`, `ProcessedFile` interfaces.
|
||||
→ [FP-03_PROTOCOL_TYPES.md](./TASKS/FP-03_PROTOCOL_TYPES.md)
|
||||
## Phase 3 — Concurrency & Performance
|
||||
|
||||
### AO-07 Configurable Concurrency Management
|
||||
Implement a task queue and concurrency pool in Orchestrator.
|
||||
→ [AO-07_CONCURRENCY_MANAGEMENT.md](./TASKS/AO-07_CONCURRENCY_MANAGEMENT.md)
|
||||
|
||||
### AO-08 Dashboard Health View
|
||||
Show real-time status of all child processes in the dashboard.
|
||||
→ [AO-08_DASHBOARD_HEALTH.md](./TASKS/AO-08_DASHBOARD_HEALTH.md)
|
||||
|
||||
---
|
||||
|
||||
## Phase 2 — Core Services
|
||||
## Phase 4 — Monitoring & UI
|
||||
|
||||
### FP-04 Extend OllamaAdapter with Vision Support
|
||||
**File**: `src/services/ollama-adapter.ts`
|
||||
**Deps**: FP-02, FP-03
|
||||
Add `chatWithImage(messages, model, imagePath)` method using Ollama multimodal API.
|
||||
→ [FP-04_OLLAMA_VISION.md](./TASKS/FP-04_OLLAMA_VISION.md)
|
||||
### AO-09 Live IPC Log Streamer
|
||||
Implement live internal bus traffic monitoring.
|
||||
→ [AO-09_IPC_LOG_STREAMER.md](./TASKS/AO-09_IPC_LOG_STREAMER.md)
|
||||
|
||||
### AO-10 Cron management UI
|
||||
Manage AI query cron jobs from the UI.
|
||||
→ [AO-10_CRON_MGMT_UI.md](./TASKS/AO-10_CRON_MGMT_UI.md)
|
||||
|
||||
---
|
||||
|
||||
### FP-05 Implement Audio Conversion Utility
|
||||
**File**: `src/utils/audio-converter.ts`
|
||||
**Deps**: FP-01, FP-02
|
||||
`convertToWav(inputPath, outputPath)` — wraps `ffmpeg-static` to produce 16kHz mono WAV.
|
||||
→ [FP-05_AUDIO_CONVERTER.md](./TASKS/FP-05_AUDIO_CONVERTER.md)
|
||||
## Phase 5 — Verification
|
||||
|
||||
---
|
||||
### AO-11 Test: Auto-Restart logic
|
||||
Automated tests for process recovery.
|
||||
→ [AO-11_TEST_AUTO_RESTART.md](./TASKS/AO-11_TEST_AUTO_RESTART.md)
|
||||
|
||||
### FP-06 Implement Whisper Transcription Utility
|
||||
**File**: `src/utils/whisper-transcriber.ts`
|
||||
**Deps**: FP-01, FP-02, FP-05
|
||||
`transcribeAudio(wavPath)` — calls `nodejs-whisper` with configured model and language.
|
||||
→ [FP-06_WHISPER_TRANSCRIBER.md](./TASKS/FP-06_WHISPER_TRANSCRIBER.md)
|
||||
### AO-12 Test: Cron-to-AI E2E
|
||||
Integration test for autonomous query execution.
|
||||
→ [AO-12_TEST_CRON_AI_FLOW.md](./TASKS/AO-12_TEST_CRON_AI_FLOW.md)
|
||||
|
||||
---
|
||||
|
||||
## Phase 3 — File Processor Process
|
||||
|
||||
### FP-07 Build the File Processor Service
|
||||
**File**: `src/services/file-processor.ts`
|
||||
**Deps**: FP-03, FP-04, FP-05, FP-06
|
||||
New `BaseProcess` subprocess. Routes files by category: text read, image OCR, audio transcription, unknown ignored. Deletes files after processing.
|
||||
→ [FP-07_FILE_PROCESSOR_SERVICE.md](./TASKS/FP-07_FILE_PROCESSOR_SERVICE.md)
|
||||
|
||||
---
|
||||
|
||||
### FP-08 Register File Processor in Orchestrator
|
||||
**File**: `src/core/orchestrator.ts`
|
||||
**Deps**: FP-07
|
||||
Add `file-processor` to `PROCESS_SCRIPTS` and spawn it at startup.
|
||||
→ [FP-08_REGISTER_FILE_PROCESSOR.md](./TASKS/FP-08_REGISTER_FILE_PROCESSOR.md)
|
||||
|
||||
---
|
||||
|
||||
## Phase 4 — Telegram Integration
|
||||
|
||||
### FP-09 Telegram Adapter — File Detection and Download
|
||||
**File**: `src/adapters/telegram-adapter.ts`
|
||||
**Deps**: FP-02, FP-03
|
||||
Detect photo/document/voice/audio, download to sandbox, classify MIME type, emit `file.ingest`.
|
||||
→ [FP-09_TELEGRAM_FILE_DOWNLOAD.md](./TASKS/FP-09_TELEGRAM_FILE_DOWNLOAD.md)
|
||||
|
||||
---
|
||||
|
||||
### FP-10 Orchestrator — file.ingest Handler and Context Building
|
||||
**File**: `src/core/orchestrator.ts`
|
||||
**Deps**: FP-08, FP-09
|
||||
Handle `file.ingest`: dispatch to file-processor in parallel, collect results, warn on failures, build enrichedGoal, call `runTaskPipeline`.
|
||||
→ [FP-10_ORCHESTRATOR_FILE_INGEST.md](./TASKS/FP-10_ORCHESTRATOR_FILE_INGEST.md)
|
||||
|
||||
---
|
||||
|
||||
### FP-11 Long Text Chunking, Summarization, and RAG Indexing
|
||||
**File**: `src/core/orchestrator.ts`
|
||||
**Deps**: FP-10, rag-service
|
||||
Chunk long text → summarize each chunk via model-router → insert summaries into rag-service with file metadata.
|
||||
→ [FP-11_LONG_TEXT_RAG_INDEXING.md](./TASKS/FP-11_LONG_TEXT_RAG_INDEXING.md)
|
||||
|
||||
---
|
||||
|
||||
## Phase 5 — Planner Integration and Cleanup
|
||||
|
||||
### FP-12 Update Planner Prompt for File Context Awareness
|
||||
**File**: `src/agents/prompts/planner.ts`
|
||||
**Deps**: FP-10
|
||||
Add `<file_context_instructions>` section and two new few-shot examples (inline context, indexed file).
|
||||
→ [FP-12_PLANNER_PROMPT_FILE_CONTEXT.md](./TASKS/FP-12_PLANNER_PROMPT_FILE_CONTEXT.md)
|
||||
|
||||
---
|
||||
|
||||
### FP-13 Upload Directory Initialization and Cleanup
|
||||
**File**: `src/core/orchestrator.ts`
|
||||
**Deps**: FP-02, FP-07
|
||||
Create upload dir at startup; clear orphaned files (older than 1h) at startup.
|
||||
→ [FP-13_UPLOAD_DIR_CLEANUP.md](./TASKS/FP-13_UPLOAD_DIR_CLEANUP.md)
|
||||
|
||||
---
|
||||
|
||||
## Phase 6 — Documentation and Verification
|
||||
|
||||
### FP-14 Update Documentation
|
||||
**Files**: `_docs/COMPONENTS.md`, `_docs/TECH.md`, `_docs/MESSAGE PROTOCOL SPEC.md`, `README.md`
|
||||
**Deps**: FP-07, FP-09, FP-10
|
||||
Document the new subsystem in all architecture and user-facing docs.
|
||||
→ [FP-14_UPDATE_DOCS.md](./TASKS/FP-14_UPDATE_DOCS.md)
|
||||
|
||||
---
|
||||
|
||||
### FP-15 End-to-End Verification
|
||||
**Files**: Manual testing
|
||||
**Deps**: FP-01 through FP-14
|
||||
Manual verification of all file types: text (short + long), image (OCR + description), audio (voice + mp3), mixed, and edge/failure cases.
|
||||
→ [FP-15_E2E_VERIFICATION.md](./TASKS/FP-15_E2E_VERIFICATION.md)
|
||||
### AO-13 Final Verification Walkthrough
|
||||
Manual E2E check of all features.
|
||||
→ [AO-13_E2E_VERIFICATION.md](./TASKS/AO-13_E2E_VERIFICATION.md)
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# AO-01 Standardize BaseProcess Lifecycle
|
||||
|
||||
## Context
|
||||
Every child process should follow a strict lifecycle protocol to ensure the Supervisor can monitor health.
|
||||
Independent processes need a standardized way to report health to the supervisor.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Implement `status` enum in `BaseProcess`.
|
||||
- [ ] Add `heartbeat` mechanism (emit `event.system.heartbeat` periodically).
|
||||
- [ ] Add `getMetrics()` method to report memory/resource usage.
|
||||
- [ ] Ensure all existing services benefit from these changes.
|
||||
- [ ] Implement `status` enum: `starting`, `ready`, `degraded`, `stopping`.
|
||||
- [ ] Add `heartbeat()` method in `BaseProcess` that emits `event.system.heartbeat` periodically.
|
||||
- [ ] Add basic resource reporting (memory usage) in the heartbeat.
|
||||
|
||||
## Verification
|
||||
- Unit tests for lifecycle transitions.
|
||||
- Verify heartbeat events in logs.
|
||||
- Run a service and observe heartbeat events on the IPC bus.
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# AO-02 Implement Process Supervisor
|
||||
|
||||
## Context
|
||||
The Orchestrator currently spawns processes but doesn't actively manage their lifecycle or recover from crashes.
|
||||
Orchestrator needs to ensure system uptime by monitoring and restarting child processes.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Implement a `Supervisor` module within the Orchestrator.
|
||||
- [ ] Track child process uptime and exit codes.
|
||||
- [ ] Implement auto-restart logic (with backoff).
|
||||
- [ ] Emit `event.system.process_restart` for observability.
|
||||
- [ ] Enhance child process tracking to include spawn time and restart counts.
|
||||
- [ ] Detect unexpected process exits and trigger auto-restart.
|
||||
- [ ] Implement exponential backoff for processes that fail repeatedly.
|
||||
|
||||
## Verification
|
||||
- Kill a child process (e.g., `model-router`) and verify it restarts automatically.
|
||||
- Check logs for restart events.
|
||||
- sigkill a service process and verify Orchestrator restarts it.
|
||||
- Observe restart events in the debug logs.
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# AO-03 CLI Interactive Mode
|
||||
|
||||
## Context
|
||||
Debugging IPC is hard. Services should be testable via direct stdin.
|
||||
Enable easy manual testing of any service without running the full orchestrator.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Detect `--interactive` flag in `main()` of services.
|
||||
- [ ] When in interactive mode, use a simpler `readline` interface for manual input.
|
||||
- [ ] Pretty-print outgoing envelopes to stderr for human readability.
|
||||
- [ ] Add `--interactive` flag support to `BaseProcess`.
|
||||
- [ ] When active, provide a prompt for manual JSONL input.
|
||||
- [ ] Enable colorful, human-readable output to stderr for responses.
|
||||
|
||||
## Verification
|
||||
- Run `node dist/services/rag-service.js --interactive` and manually type a JSON envelope.
|
||||
- Verify response is printed correctly.
|
||||
- Run `node dist/services/rag-service.js --interactive` and manually test semantic search.
|
||||
|
||||
12
_board/TASKS/AO-04_CRON_AI_QUERY.md
Normal file
12
_board/TASKS/AO-04_CRON_AI_QUERY.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# AO-04 CronManager AI Query Support
|
||||
|
||||
## Context
|
||||
Reusing existing logic to trigger autonomous AI workflows.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Support `task_type === "ai_query"`.
|
||||
- [ ] When triggered, use the `reminderMessage` as the input query.
|
||||
- [ ] Emit `event.cron.ai_query` with target `chatId`.
|
||||
|
||||
## Verification
|
||||
- Log inspection: ensure correct event is emitted with the query as payload.
|
||||
@@ -1,12 +0,0 @@
|
||||
# AO-04 Standalone Router Service
|
||||
|
||||
## Context
|
||||
Orchestrator is doing too much. Routing should be a dumb, high-speed pipe.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Create `src/core/router-service.ts`.
|
||||
- [ ] Implement simple routing logic: read from any child, write to the target named in `to`.
|
||||
- [ ] Standardize the "Hub and Spoke" IPC model.
|
||||
|
||||
## Verification
|
||||
- Test routing between two mock processes via the Router.
|
||||
@@ -1,11 +0,0 @@
|
||||
# AO-05 Integrate Router in Orchestrator
|
||||
|
||||
## Context
|
||||
Move routing logic out of `orchestrator.ts` and into the new Router service.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Refactor `Orchestrator.handleLine` to delegate to Router where appropriate.
|
||||
- [ ] Ensure all services are connected to the central Router bus.
|
||||
|
||||
## Verification
|
||||
- Full system smoke test: original Telegram task pipeline should still work.
|
||||
13
_board/TASKS/AO-05_SYNTHETIC_GOAL_INGESTION.md
Normal file
13
_board/TASKS/AO-05_SYNTHETIC_GOAL_INGESTION.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# AO-05 Synthetic Goal Ingestion (Stateful)
|
||||
|
||||
## Context
|
||||
Unify human and autonomous inputs while ensuring each autonomous run is uniquely identifiable.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Handle `event.cron.ai_query` in `Orchestrator.handleLine`.
|
||||
- [ ] **Generate a unique `taskId` (UUID)** for each autonomous run.
|
||||
- [ ] Route the query into the existing `runTaskPipeline` using the new `taskId`.
|
||||
- [ ] Ensure results are stored in `task_memory` indexed by this `taskId`.
|
||||
|
||||
## Verification
|
||||
- Verify that multiple runs of the same cron job result in separate entries in the `task_memory` database with unique IDs.
|
||||
@@ -1,12 +0,0 @@
|
||||
# AO-06 Dashboard Process Health Monitoring
|
||||
|
||||
## Context
|
||||
The dashboard should show the status of all child processes managed by the supervisor.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Add "Process Status" table to dashboard.
|
||||
- [ ] Display: Process Name, Status (Running/Restarting), Restarts Count, Uptime.
|
||||
- [ ] Use `heartbeat` events to update status in real-time.
|
||||
|
||||
## Verification
|
||||
- Open dashboard and verify process list matches actual running system.
|
||||
@@ -1,12 +0,0 @@
|
||||
# AO-07 Real-time IPC Log Viewer
|
||||
|
||||
## Context
|
||||
Debugging cross-process flows is currently dependent on console logs.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Implement a WebSocket-based (or polling) live log viewer in the dashboard.
|
||||
- [ ] Show envelopes as they pass through the Router.
|
||||
- [ ] Add filtering by process name and message type.
|
||||
|
||||
## Verification
|
||||
- Send a message in Telegram and watch the log entries appear in the dashboard.
|
||||
@@ -1,12 +0,0 @@
|
||||
# AO-08 SQLite Schema Update for Cron
|
||||
|
||||
## Context
|
||||
Prepare the cron database for AI-driven tasks.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Update `SCHEMA` in `cron-manager.ts`.
|
||||
- [ ] Add migration/check for `task_type` field and ensures `ai_query` is a valid option.
|
||||
- [ ] Update types and interfaces.
|
||||
|
||||
## Verification
|
||||
- Check `cron.sqlite` schema after restart.
|
||||
12
_board/TASKS/AO-08_DASHBOARD_HEALTH.md
Normal file
12
_board/TASKS/AO-08_DASHBOARD_HEALTH.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# AO-08 Dashboard Health View
|
||||
|
||||
## Context
|
||||
Real-time visibility into the health of the process-isolated architecture.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Add a "Processes" section to the ManBot Dashboard.
|
||||
- [ ] Subscribe to `event.system.heartbeat` and `event.system.process_restart` events.
|
||||
- [ ] Display status pills, uptime, and restart frequency.
|
||||
|
||||
## Verification
|
||||
- Dashboard visual check: verify all services appear and update their status.
|
||||
@@ -1,11 +0,0 @@
|
||||
# AO-09 CronManager AI Query Support
|
||||
|
||||
## Context
|
||||
Enable CronManager to handle AI query tasks.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Implement trigger logic for `task_type === 'ai_query'`.
|
||||
- [ ] Emit `event.cron.ai_query` with the prompt and context.
|
||||
|
||||
## Verification
|
||||
- Verify `event.cron.ai_query` is emitted when a scheduled job fires.
|
||||
12
_board/TASKS/AO-09_IPC_LOG_STREAMER.md
Normal file
12
_board/TASKS/AO-09_IPC_LOG_STREAMER.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# AO-09 Live IPC Log Streamer
|
||||
|
||||
## Context
|
||||
Improve debuggability of the process-isolated architecture.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Implement a polling or WebSocket endpoint in `dashboard-service.ts` to expose the IPC log buffer.
|
||||
- [ ] Add a "Log Stream" UI component to the dashboard.
|
||||
- [ ] Support color-coded message types and process filtering.
|
||||
|
||||
## Verification
|
||||
- Dashboard check: verify messages appear in the stream when Telegram tasks are running.
|
||||
@@ -1,13 +0,0 @@
|
||||
# AO-10 Orchestrator Synthetic Task Pipeline
|
||||
|
||||
## Context
|
||||
Bridge cron events to the AI Agent reasoning pipeline.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Implement `handleCronAiQuery()` in Orchestrator.
|
||||
- [ ] This should wrap the `ai_query` prompt and inject it into `runTaskPipeline`.
|
||||
- [ ] Map the cron task result back to the specific Telegram `chatId`.
|
||||
|
||||
## Verification
|
||||
- Create an `ai_query` cron job.
|
||||
- Verify the agent plans and executes the task, then sends the result to Telegram.
|
||||
@@ -1,13 +0,0 @@
|
||||
# AO-11 Cron Job Management UI
|
||||
|
||||
## Context
|
||||
Provide a user-friendly way to schedule AI queries.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Add "Schedules" tab to dashboard.
|
||||
- [ ] List current cron jobs with their type (`reminder` vs `ai_query`).
|
||||
- [ ] Add "New AI Query" form: Input prompt + Cron expression.
|
||||
- [ ] Implement deletion of cron jobs from the UI.
|
||||
|
||||
## Verification
|
||||
- Add a job via the UI and verify it appears in the `cron.sqlite` database.
|
||||
12
_board/TASKS/AO-11_TEST_AUTO_RESTART.md
Normal file
12
_board/TASKS/AO-11_TEST_AUTO_RESTART.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# AO-11 Test: Auto-Restart logic
|
||||
|
||||
## Context
|
||||
Verify the robustness of the new supervisor.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Create `src/tests/supervisor.test.ts`.
|
||||
- [ ] Test case: Kill process, verify restart.
|
||||
- [ ] Test case: Verify backoff limits.
|
||||
|
||||
## Verification
|
||||
- Run `npm test src/tests/supervisor.test.ts`.
|
||||
@@ -1,12 +0,0 @@
|
||||
# AO-12 Test: Supervisor Auto-Restart
|
||||
|
||||
## Context
|
||||
Automated verification of the Supervisor's ability to maintain system uptime.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Create `src/tests/supervisor.test.ts`.
|
||||
- [ ] Test case: Spawn child, sigkill child, wait for supervisor to restart it.
|
||||
- [ ] Test case: Verify backoff strategy if child keeps crashing.
|
||||
|
||||
## Verification
|
||||
- Run `npm test src/tests/supervisor.test.ts`.
|
||||
11
_board/TASKS/AO-12_TEST_CRON_AI_FLOW.md
Normal file
11
_board/TASKS/AO-12_TEST_CRON_AI_FLOW.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# AO-12 Test: Cron-to-AI E2E
|
||||
|
||||
## Context
|
||||
Automated validation of the fundamental autonomous query flow.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Create `src/tests/cron-ai.test.ts`.
|
||||
- [ ] Mock cron triggers and verify full agent reasoning loop completion.
|
||||
|
||||
## Verification
|
||||
- Run `npm test src/tests/cron-ai.test.ts`.
|
||||
12
_board/TASKS/AO-13_E2E_VERIFICATION.md
Normal file
12
_board/TASKS/AO-13_E2E_VERIFICATION.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# AO-13 Final Verification Walkthrough
|
||||
|
||||
## Context
|
||||
Final quality assurance for the "Advanced Architecture" release.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Systematic manual check of supervisor stability.
|
||||
- [ ] E2E check of autonomous query flow via dashboard creation.
|
||||
- [ ] Verification of dashboard health/log displays.
|
||||
|
||||
## Verification
|
||||
- Signed-off walkthrough report.
|
||||
@@ -1,14 +0,0 @@
|
||||
# AO-13 Test: Cron-Driven AI Task
|
||||
|
||||
## Context
|
||||
End-to-end integration test for the autonomous cron-to-ai flow.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Create `src/tests/cron-ai.test.ts`.
|
||||
- [ ] Mock a cron-fire event.
|
||||
- [ ] Verify Orchestrator starts the pipeline.
|
||||
- [ ] Mock tool-host/model-router responses.
|
||||
- [ ] Verify final event emission.
|
||||
|
||||
## Verification
|
||||
- Run `npm test src/tests/cron-ai.test.ts`.
|
||||
@@ -1,13 +0,0 @@
|
||||
# AO-14 E2E Verification
|
||||
|
||||
## Context
|
||||
Manual end-to-end testing of the fully integrated advanced architecture.
|
||||
|
||||
## Proposed Changes
|
||||
- [ ] Verify process dashboard health reporting.
|
||||
- [ ] Verify live log stream.
|
||||
- [ ] Verify manual cron job addition via dashboard and subsequent AI execution.
|
||||
- [ ] Verify system stability under simulated failures.
|
||||
|
||||
## Verification
|
||||
- Comprehensive manual walkthrough documented with screenshots/logs.
|
||||
@@ -3,47 +3,6 @@
|
||||
## To Do
|
||||
|
||||
|
||||
|
||||
### AO-08 Dashboard Health View
|
||||
- tags: [todo, dashboard]
|
||||
- defaultExpanded: false
|
||||
```md
|
||||
Show real-time status of all child processes.
|
||||
Source: _board/TASKS/AO-08_DASHBOARD_HEALTH.md
|
||||
```
|
||||
|
||||
### AO-09 Live IPC Log Streamer
|
||||
- tags: [todo, dashboard, debug]
|
||||
- defaultExpanded: false
|
||||
```md
|
||||
Implement live internal bus traffic monitoring.
|
||||
Source: _board/TASKS/AO-09_IPC_LOG_STREAMER.md
|
||||
```
|
||||
|
||||
### AO-10 Cron management UI
|
||||
- tags: [todo, dashboard, cron]
|
||||
- defaultExpanded: false
|
||||
```md
|
||||
Manage AI query cron jobs from the UI.
|
||||
Source: _board/TASKS/AO-10_CRON_MGMT_UI.md
|
||||
```
|
||||
|
||||
### AO-11 Test: Auto-Restart logic
|
||||
- tags: [todo, testing, qa]
|
||||
- defaultExpanded: false
|
||||
```md
|
||||
Verify process recovery and backoff.
|
||||
Source: _board/TASKS/AO-11_TEST_AUTO_RESTART.md
|
||||
```
|
||||
|
||||
### AO-12 Test: Cron-to-AI E2E
|
||||
- tags: [todo, testing, integration]
|
||||
- defaultExpanded: false
|
||||
```md
|
||||
E2E integration for scheduled AI tasks.
|
||||
Source: _board/TASKS/AO-12_TEST_CRON_AI_FLOW.md
|
||||
```
|
||||
|
||||
### AO-13 Final Verification Walkthrough
|
||||
- tags: [todo, testing, e2e]
|
||||
- defaultExpanded: false
|
||||
@@ -56,6 +15,26 @@
|
||||
|
||||
## Done
|
||||
|
||||
### AO-12 Test: Cron-to-AI E2E
|
||||
- Status: Completed
|
||||
- Commit: 5e2ab2c
|
||||
- Date: 2026-02-22
|
||||
|
||||
### AO-11 Test: Auto-Restart logic
|
||||
- Status: Completed
|
||||
- Commit: f147bb7
|
||||
- Date: 2026-02-22
|
||||
|
||||
### AO-09 Live IPC Log Streamer
|
||||
- Status: Completed
|
||||
- Commit: dbe54c2
|
||||
- Date: 2026-02-22
|
||||
|
||||
### AO-08 Dashboard Health View
|
||||
- Status: Completed
|
||||
- Commit: dac2aeb
|
||||
- Date: 2026-02-22
|
||||
|
||||
### AO-03 CLI Interactive Mode
|
||||
- Status: Completed
|
||||
- Commit: 9c04821
|
||||
|
||||
@@ -34,7 +34,7 @@ describe("Cron-to-AI Flow (E2E Mocked)", () => {
|
||||
orchestrator = new Orchestrator();
|
||||
|
||||
// Mock child processes for PIPELINE
|
||||
const mockChild = (name: string) => ({
|
||||
const mockChild = (_name: string) => ({
|
||||
stdin: { writable: true, write: vi.fn() },
|
||||
cp: { pid: randomUUID() },
|
||||
scriptPath: "mock.js",
|
||||
@@ -50,7 +50,7 @@ describe("Cron-to-AI Flow (E2E Mocked)", () => {
|
||||
orchestrator.children.set("model-router", mockChild("model-router"));
|
||||
|
||||
// Mock sendAndWait to return successful responses from these mock processes
|
||||
orchestrator.sendAndWait = vi.fn().mockImplementation((target: any, type: string, payload: any) => {
|
||||
orchestrator.sendAndWait = vi.fn().mockImplementation((_target: any, type: string, _payload: any) => {
|
||||
if (type === "plan.create") {
|
||||
return Promise.resolve({
|
||||
payload: {
|
||||
|
||||
Reference in New Issue
Block a user