Skip to content

feat: Remote Access, MCP Server, and Architecture Refactor#60

Open
sgaabdu4 wants to merge 7 commits into4regab:mainfrom
sgaabdu4:feature/remote-access
Open

feat: Remote Access, MCP Server, and Architecture Refactor#60
sgaabdu4 wants to merge 7 commits into4regab:mainfrom
sgaabdu4:feature/remote-access

Conversation

@sgaabdu4
Copy link
Contributor

Summary

This PR adds Remote Access, an MCP server, and a full architecture refactor to TaskSync.

Remote Access

  • WebSocket-based remote server with PIN authentication and TLS support
  • Mobile-friendly web UI for managing prompts from any device on your LAN
  • Rate-limited auth with IP-based lockout
  • Git integration for remote file browsing and diff viewing

MCP Server Integration

  • Streamable HTTP transport with /sse backward-compatible routing
  • Auto-registers with Kiro and Antigravity on activation
  • Manual config support for Cursor and any MCP-compatible client
  • Exposes ask_user and get_response tools

Architecture Refactor

  • Extracted monolithic webviewProvider.ts (3,800+ lines) into 13 focused handler modules
  • Shared debugLog() utility gated behind tasksync.debugLogging config
  • Shared mergeAndDedup() for history merge deduplication
  • satisfies ToWebviewMessage used consistently for compile-time type safety
  • All console.log replaced with debugLog() — zero console.log in production

Testing

  • Vitest test infrastructure with 14 test files and 381 passing tests
  • Comprehensive tests for queue handlers, settings, auth, server utilities, choice parsing
  • E2E scaffold with Playwright for remote auth flows

Other Improvements

  • # autocomplete now searches tools, terminal output, and VS Code problems
  • Interactive choice/approval parsing with UI buttons
  • Per-workspace storage isolation with global fallback
  • Autopilot cycling prompts (autopilotPrompts array)
  • Session timer with configurable warning
  • Human-like delay (2-6s default)
  • Notification sound on ask_user

Documentation

  • Rewrote AGENTS.md with full module tree and conventions
  • Updated both READMEs with accurate feature descriptions and configuration

Code Quality

  • TypeScript strict mode, Biome linting (tabs, double quotes)
  • Build: node esbuild.jsdist/extension.js + media/webview.js + web/shared-constants.js
  • All type checks pass, all 381 tests pass, zero lint errors

85 files changed | ~32K insertions | ~13K deletions

- Implemented webview utilities in `webviewUtils.ts` for handling queue management, logging, and file link parsing.
- Added Vitest configuration for testing in `vitest.config.ts`.
- Created SVG icons for the application in `icon-192.svg` and `icon-512.svg`.
- Developed the login page structure in `index.html` with associated styles in `login.css`.
- Implemented login functionality in `login.js`, including WebSocket authentication and session management.
- Added a manifest file for PWA support in `manifest.json`.
- Created an offline page in `offline.html` to handle network disconnections.
- Introduced shared constants in `shared-constants.js` for consistent usage across the frontend.
- Implemented a service worker in `sw.js` for caching and offline capabilities.
Copilot AI review requested due to automatic review settings March 23, 2026 21:38
Copy link
Contributor

Copilot AI left a comment

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 introduces LAN Remote Access + MCP server support and refactors the TaskSync extension into smaller modules with shared utilities and expanded test infrastructure.

Changes:

  • Added remote server utilities/handlers (auth, git, settings) and a remote-friendly web UI/PWA.
  • Refactored the webview provider into focused handler modules (queue/session/lifecycle/message routing/persistence).
  • Added/expanded Vitest + Playwright scaffolding; updated shared constants and build tooling.

Reviewed changes

Copilot reviewed 64 out of 85 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
tasksync-chat/src/webview/sessionManager.ts Extracted session timer/human-delay/system-sound logic into its own module.
tasksync-chat/src/webview/remoteApiHandlers.ts Added remote server-facing API surface for queue/settings/state and file/tool search.
tasksync-chat/src/webview/queueHandlers.ts Centralized queue operations + auto-respond behavior for pending tool calls.
tasksync-chat/src/webview/queueHandlers.test.ts Added unit tests for queue edit/remove/reorder/clear.
tasksync-chat/src/webview/queueHandlers.comprehensive.test.ts Added broader behavior tests including auto-respond paths and history helpers.
tasksync-chat/src/webview/persistence.ts Added workspace-aware persistence for queue + persisted history.
tasksync-chat/src/webview/messageRouter.ts Added webview message dispatcher + submit/webviewReady logic.
tasksync-chat/src/webview/lifecycleHandlers.ts Added webview HTML generation + lifecycle/dispose/new-session logic.
tasksync-chat/src/webview-ui/state.js Added/normalized UI state and shared-constant fallbacks for remote mode.
tasksync-chat/src/webview-ui/slashCommands.js Added client-side slash command expansion + dropdown interactions.
tasksync-chat/src/webview-ui/queue.js Added queue UI editing + attachment badges + approval modal actions.
tasksync-chat/src/webview-ui/messageHandler.js Added webview message handling for queue/session/settings/attachments + pending tool call rendering.
tasksync-chat/src/webview-ui/markdownUtils.js Added table/list markdown processing with safety/perf limits.
tasksync-chat/src/webview-ui/history.js Added history modal controls and mode card selection behavior.
tasksync-chat/src/webview-ui/events.js Added UI event wiring (copy/contextmenu, settings toggles, dropdowns).
tasksync-chat/src/webview-ui/constants.js Added shared-constant fallbacks for remote mode (WS protocol, session keys, reconnect).
tasksync-chat/src/webview-ui/approval.js Added multi-choice toolbar + approval modal behavior.
tasksync-chat/src/utils/imageUtils.ts Normalized MIME detection formatting and string style.
tasksync-chat/src/utils/imageUtils.test.ts Added tests for getImageMimeType behavior.
tasksync-chat/src/utils/generateId.ts Added shared ID generator utility.
tasksync-chat/src/utils/generateId.test.ts Added tests for generateId format/uniqueness.
tasksync-chat/src/tools.ts Extended ask_user to accept summary + improved logging/result parts handling.
tasksync-chat/src/server/serverUtils.ts Added security headers, origin checks, attachment normalization, TLS helpers/port utilities.
tasksync-chat/src/server/remoteSettingsHandler.ts Added WS settings message router for remote clients.
tasksync-chat/src/server/remoteGitHandlers.ts Added WS git handlers with validation + broadcast hooks.
tasksync-chat/src/server/remoteAuthService.ts Added PIN/session-token auth with lockouts/timing-safe comparison + cleanup timers.
tasksync-chat/src/server/gitService.ts Added VS Code Git extension integration + safe path validation + basic git operations.
tasksync-chat/src/server/gitService.test.ts Added tests for isValidFilePath validation behavior.
tasksync-chat/src/context/terminalContext.ts Improved terminal execution tracking + output size limiting + ID generation.
tasksync-chat/src/context/problemsContext.ts Added problem IDs via generateId + normalized string types/formatting.
tasksync-chat/src/context/index.ts Added shared ContextManager improvements + generateId usage.
tasksync-chat/src/constants/remoteConstants.ts Added remote/MCP constants, limits, error codes, queue ID validation, diff truncation.
tasksync-chat/src/constants/remoteConstants.test.ts Added unit tests for remote constants + helpers.
tasksync-chat/src/constants/fileExclusions.ts Normalized exclusion glob constants and formatter.
tasksync-chat/src/constants/fileExclusions.test.ts Added tests for file exclusion constants and formatter output.
tasksync-chat/src/mocks/vscode.ts Added minimal VS Code API mock for unit tests.
tasksync-chat/package.json Updated engine requirement, added remote settings/commands, and added deps/scripts.
tasksync-chat/media/webview-body.html Added shared HTML body template for faster/single-source webview rendering.
tasksync-chat/media/remote-fallback.css Added CSS variable fallback theme for standalone remote browser mode.
tasksync-chat/media/main.css Added UI styles for remote chat stream + summary rendering + session/idle notices.
tasksync-chat/esbuild.js Added shared-constants generation + webview JS concatenation + watch support.
tasksync-chat/e2e/tests/remote-auth.spec.mjs Added Playwright smoke tests for remote auth/login behavior.
tasksync-chat/e2e/playwright.config.mjs Added Playwright config for remote E2E scaffolding.
tasksync-chat/e2e/.env.example Added example env vars for remote E2E runs.
tasksync-chat/README.md Documented remote access, MCP, and updated feature descriptions/settings.
tasksync-chat/.gitignore Ignored Playwright artifacts and test outputs.
README.md Updated top-level feature list to include remote/MCP/context references.
AGENTS.md Updated architecture/module tree + conventions + testing/build notes.
Files not reviewed (1)
  • tasksync-chat/package-lock.json: Language not supported

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

@sgaabdu4
Copy link
Contributor Author

@4regab sorry for the behemoth!

- Remove leftover console.log statements from webview-ui messageHandler
- Fix queue.json backward compat (enabled defaults to true when missing)
- Fix queueHandlers: missing resolver falls through to queue instead of
  dropping the prompt; set _aiTurnActive after auto-respond resolve
- Fix serverUtils cert SAN: detect IP vs DNS hostname for correct type
- Fix gitService: normalize backslashes for Windows path validation
- Fix messageRouter: preserve attachments in queue fallback path
- Fix remoteAuthService: implement query-param PIN support (matches docs)
- Fix incomplete test in queueHandlers.test.ts (add assertion)
- Update tests to match new behavior
- Install mermaid@10.9.3 as a dependency
- Copy mermaid.min.js to media/ during build (esbuild.js)
- Load mermaid from local webview URI instead of CDN
- Remove cdn.jsdelivr.net from all CSP directives (both webview and remote)
- Inject mermaid source path via window.__MERMAID_SRC__ global
- Add media/mermaid.min.js to .gitignore (build artifact)
@sgaabdu4 sgaabdu4 requested a review from Copilot March 23, 2026 22:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 68 out of 85 changed files in this pull request and generated 9 comments.


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

- handleSubmit: queue user input when no pending tool call (prevent silent drop)
- gitService: reject absolute paths outside workspace root (security hardening)
- serverUtils: import AttachmentInfo from webviewTypes (reduce coupling)
- remoteSettingsHandler: use named WebSocket import for consistency
- sessionManager: route sound errors through debugLog (reduce noise)
- package.json: align engines.vscode with @types/vscode (^1.90.0)
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.

2 participants