Architecture: How should embeddable-bridge components (gograb-ai-panel, go...

Documentation for Sessions

🏗️ Architecture: How should embeddable-bridge components (gograb-ai-panel, go...

Date: 2026-02-11
Time: 15:15:54 UTC
Session: gspace1-105.8
Agent: angular
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

How should embeddable-bridge components (gograb-ai-panel, gograb-observatory) determine the correct AI app port when embedded in different host apps across workspaces?

Task: Session 105.3: Workspace-aware port derivation for embeddable-bridge components


🎯 Decision Made

Chosen:

Created workspace-ports.ts utility with deriveAiPort() that infers the AI port from the host app's window.location.port using the convention: AI_PORT = workspaceBase + 400 (e.g., host on 6200 → AI on 6400). Components also accept an aiBaseUrl input for explicit overrides.

Options Considered:

  1. Use compile-time constant from environment.ts
  2. Read from a shared config API
  3. Derive port from host app's window.location.port using workspace convention
  4. Accept port as component input

💭 Reasoning

The workspace port convention is: each workspace has a base (editor2=5000, gspace1=6000) with fixed offsets per app (space=+200, admin=+100, dev=+300, ai=+400). When gograb-ai-panel is embedded in gograb-space at port 6200, we can derive AI port as floor(6200/1000)*1000+400=6400. This works for all workspaces without build-time configuration. The aiBaseUrl input provides an escape hatch for non-standard deployments. Fallback is 5400 (editor2 default) when port detection fails.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation