Skip to content

Implement Phases 12–14: packaging, local API server, and browser extension - #2

Closed
Neil1355 with Copilot wants to merge 3 commits into
mainfrom
copilot/update-readme-and-plan-phases
Closed

Implement Phases 12–14: packaging, local API server, and browser extension#2
Neil1355 with Copilot wants to merge 3 commits into
mainfrom
copilot/update-readme-and-plan-phases

Conversation

Copilot AI commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Phases 1–11 are complete. This PR implements all 3 remaining phases to bring FocusSight AI to its full-featured milestone, including the browser extension.

Changes

Phase 12 – Packaging & Distribution

  • Added pyproject.toml (PEP 517/518) with package metadata, entry-point scripts (focussight-track, focussight-report), bundled cascade XML files, and optional dependency groups [server] and [dev]
  • The package can now be installed with pip install focussight-ai or pip install -e .

Phase 13 – REST API / WebSocket Server

  • Added focussight/server.py with a FastAPI application exposing:
    • GET /status — live focus state as JSON
    • GET /report — ops report JSON for the active session
    • GET /health — liveness probe
    • WS /events — streams a state event every second
  • Thread-safe FocusState dataclass + update_live_state() / get_live_state() helpers; the tracker loop pushes state every frame with zero overhead
  • Added --serve and --serve-port CLI flags to the tracker; starts a uvicorn daemon thread before the webcam loop begins
  • CORS open for all origins so the browser extension can connect from any localhost port
  • Added tests/test_server.py with 12 tests covering shared-state helpers and FastAPI endpoint contracts (/status, /report, /health, CORS headers) — all passing

Phase 14 – Browser Extension

  • Added extension/ folder with a complete Manifest V3 Chrome/Firefox extension:
    • manifest.json — MV3 manifest with storage and notifications permissions
    • background.js — service worker polling /status every second via chrome.alarms; updates badge colour (🟢 green = FOCUSED, 🔴 red = DISTRACTED, 🟡 amber = degraded, ⚫ grey = offline); fires desktop notifications when distraction streak exceeds the configured threshold
    • popup.html / popup.js — styled live-stats panel (state badge, focus %, distracted %, streak, elapsed, signal status)
    • options.html / options.js — settings page for server URL, notification style, and distraction threshold; persisted via chrome.storage.sync
    • generate_icons.py — generates placeholder 16/32/48/128 px PNG icons
    • package_extension.py — packages as dist/focussight-extension.zip (Chrome Web Store) and dist/focussight-extension.xpi (Firefox)
    • extension/README.md — load unpacked instructions, options reference, badge colour legend

docs/ROADMAP.md

  • Removed orphaned --- separator between Phase 11 and Phase 12 (formatting consistency fix)
  • Phases 12, 13, and 14 marked completed

README.md

  • Folder structure updated to include focussight/server.py, extension/, and tests/test_server.py
  • CLI flags table extended with --serve / --serve-port; new Local API Server endpoint table added
  • Test count updated to 90; Upcoming Phases section updated to show all 14 phases complete

docs/CHANGELOG.md

  • Full implementation entry added for Phases 12–14

Phase dependency note

Phase 13 is a hard prerequisite for Phase 14 — the extension connects to the local Python server over WebSocket/HTTP, keeping the entire stack local and private with no cloud backend required.

Quick start

# Install server dependencies
pip install "focussight-ai[server]"

# Start tracker + local API server
python eye_test.py --autolog --serve

# Load extension in Chrome: chrome://extensions → Developer mode → Load unpacked → select extension/
Original prompt

did u update the entire readme? move on planning and working on next phases, and let me knopw how many phases are to go to wind up this project. i wanna make it a browser extension if possible after

[Chronological Review: The conversation began with the user expressing a desire to move forward with a project, emphasizing the importance of testing and implementing changes. The user requested to push updates to Git, create a new repository, and organize the file structure. As the conversation progressed, the user indicated a need for batch testing and requested updates on progress and remaining tasks. The user also mentioned issues with face detection while wearing a hat, and there were discussions about moving ahead with planning and working on the next phases of the project, including the potential for a browser extension.]

[Intent Mapping:

  1. "what next?" - User seeks guidance on the next steps.
  2. "go ahead" - User encourages progress.
  3. "move ahead but keep testing together too" - User wants simultaneous progress and testing.
  4. "implement all of them, and try to fix that error too" - User requests implementation and error resolution.
  5. "sure update it and push to git, also move ahead" - User wants updates pushed to Git and further progress.
  6. "u gotta git iunit it" - User suggests initializing a Git repository.
  7. "push to git. create a new repo, there doesnt exist one yet" - User requests the creation of a new Git repository.
  8. "move ahead with this project. we should build a plan first" - User emphasizes planning for project innovation.
  9. "also organize file and folder structure" - User requests organization of project files.
  10. "batch testing" - User wants to conduct testing in batches and track progress.
  11. "let me know where we standing in terms of progress" - User requests updates on project status.
  12. "i wanna make it a browser extension if possible after" - User expresses interest in extending the project to a browser extension.]

[Technical Inventory:

  • Git: Version control system for managing project changes.
  • Batch Testing: Methodology for testing multiple components together.
  • Project Structure: Organization of files and folders for clarity and efficiency.
  • Browser Extension: Future goal for the project.]

[Code Archaeology:

  • No specific code files or functions were mentioned in detail, but there were references to updating the README and organizing project files.]

[Progress Assessment:

  • Completed Tasks: User has indicated a desire to push updates to Git and organize files.
  • Partially Complete Work: Planning for future phases and batch testing is still in progress.
  • Validated Outcomes: User is actively engaged in the project and has provided feedback on testing and implementation.]

[Context Validation: All critical information for continuation is captured, including user goals for project advancement, testing, and future browser extension development.]

[Recent Commands Analysis:

  • Last Agent Commands: User requested to "move on planning and working on next phases" and asked about the README update.
  • Tool Results Summary: No specific tool results were returned, but the user is focused on project planning and execution.
  • Pre-Summary State: The agent was actively discussing project phases and planning when the token budget was exceeded.
  • Operation Context: These commands relate to the user's goal of advancing the project and ensuring thorough testing and organization.]
1. Conversation Overview: - Primary Objectives: User wants to advance the project, implement changes, conduct testing, and eventually create a browser extension. - Session Context: The conversation has focused on project management, including pushing updates to Git, organizing files, and planning future phases. - User Intent Evolution: The user has consistently emphasized the need for progress, testing, and organization while expressing interest in future project extensions.
  1. Technical Foundation:
  • Git: Version control system for managing project changes.
  • Batch Testing: Methodology for testing multiple components together.
  • Project Structure: Organization of files and folders for clarity and efficiency.
  • Browser Extension: Future goal for the project.
  1. Codebase Status:
  • README: User inquired about updates to the README file, indicating a need for documentation.
  • File Organization: User requested the organization of project files and folder structure.
  1. Problem Resolution:
  • Issues Encountered: User faced a problem with face detection while wearing a hat.
  • Solutions Implemented: No specific solutions were discussed, but the user is focused on moving forward.
  • Debugging Context: User is aware of issues and is actively seeking to resolve them through testing.
  • Lessons Learned: Importance of testing and organization in project management.
  1. Progress Tracking:
  • Completed Tasks: User has indicated a desire to push updates to Git and organize files.
    -...

Created from VS Code.

Copilot AI changed the title [WIP] Update README and outline next project phases Plan Phases 12–14 (packaging, API server, browser extension) and clean up ROADMAP Apr 14, 2026
Copilot AI requested a review from Neil1355 April 14, 2026 03:44
@Neil1355
Neil1355 requested a review from Copilot April 14, 2026 03:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates project documentation to reflect that Phases 1–11 are complete and lays out a concrete plan for the remaining work needed to reach the browser extension milestone (via packaging and a local API server).

Changes:

  • Added planned Phases 12–14 (Packaging, Local API/WebSocket server, Browser Extension) to the roadmap.
  • Updated README to prominently surface the remaining phases and end-goal.
  • Added a corresponding planning entry to the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
docs/ROADMAP.md Cleans up Phase 11 tail content and adds detailed plans for Phases 12–14.
docs/CHANGELOG.md Adds a dated planning entry describing the documentation updates.
README.md Updates documentation status and adds an “Upcoming Phases” section/table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/ROADMAP.md Outdated
@Neil1355

Copy link
Copy Markdown
Owner

@copilot start working on the next phases and let me know once done

Copilot AI commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot start working on the next phases and let me know once done

All three phases are done (commit 178032b):

Phase 12 – Packaging & Distribution
pyproject.toml added — pip install focussight-ai now works, with [server] and [dev] optional extras and entry-point scripts (focussight-track, focussight-report).

Phase 13 – REST API / WebSocket Server
focussight/server.py exposes a local FastAPI server on http://127.0.0.1:8765 with:

  • GET /status — live focus state JSON
  • GET /report — ops report for the active session
  • GET /health — liveness probe
  • WS /events — streams a state event every second

Start it with the tracker via --serve:

python eye_test.py --autolog --serve

12 new tests in tests/test_server.py — all passing.

Phase 14 – Browser Extension
extension/ folder contains a complete Manifest V3 Chrome/Firefox extension:

  • Toolbar badge turns 🟢 green (FOCUSED), 🔴 red (DISTRACTED), or 🟡 amber/⚫ grey based on live state
  • Popup shows live stats (focus %, distracted %, streak, elapsed, signal)
  • Desktop notifications when distraction streak exceeds your threshold
  • Options page for server URL, notification style, and threshold
  • package_extension.py produces focussight-extension.zip (Chrome Store) and .xpi (Firefox)

Load unpacked in Chrome: chrome://extensions → Developer mode → Load unpacked → select extension/.

Copilot AI changed the title Plan Phases 12–14 (packaging, API server, browser extension) and clean up ROADMAP Implement Phases 12–14: packaging, local API server, and browser extension Apr 16, 2026
Copilot AI requested a review from Neil1355 April 16, 2026 06:25
@Neil1355

Copy link
Copy Markdown
Owner

@copilot did u explicitly update the readme? also explain what did u do? what is working and how could i test this?

Copilot AI commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot did u explicitly update the readme? also explain what did u do? what is working and how could i test this?

Yes, README.md was explicitly updated in this PR. Here's a summary of every README change and how to test each phase:


README changes (commit 178032b)

  • Folder Structure section now lists focussight/server.py, the full extension/ folder, pyproject.toml, and tests/test_server.py
  • CLI flags table has two new rows: --serve and --serve-port
  • New "Local API Server" section documents all four endpoints (/status, /report, /health, /events) with a usage example
  • Test count updated from 78 → 90
  • Project Documentation line updated to say "all 14 phases complete"
  • Upcoming Phases table now shows ✅ Complete for Phases 12, 13, and 14

What was built and how to test it

Phase 12 — pip packaging (pyproject.toml)

pip install -e .
# verify entry-points exist:
focussight-track --help
focussight-report --help

Phase 13 — Local API server (focussight/server.py)

# install server extras
pip install fastapi "uvicorn[standard]"

# run the server standalone (no webcam needed for a quick test)
python -m focussight.server

# in another terminal, hit the endpoints:
curl http://127.0.0.1:8765/health   # → {"ok":true}
curl http://127.0.0.1:8765/status   # → JSON with state, focus_score, etc.

# or start it alongside the tracker (updates live while the webcam runs)
python eye_test.py --autolog --serve

Phase 13 — automated tests (12 tests, no webcam required)

pip install fastapi httpx pytest
python -m pytest tests/test_server.py -v

Phase 14 — Browser Extension (extension/)

  1. Open chrome://extensions in Chrome
  2. Enable Developer mode (top-right toggle)
  3. Click Load unpacked → select the extension/ folder
  4. Make sure the Phase 13 server is running (python eye_test.py --autolog --serve)
  5. The FocusSight badge appears in the toolbar — green when FOCUSED, red when DISTRACTED
  6. Click the badge to open the popup with live stats
  7. Click Options in the popup to configure the server URL, notification style, and distraction threshold

@Neil1355

Copy link
Copy Markdown
Owner

@Neil1355 Neil1355 closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants