refactor(extension): 모듈 분리 + Hub 통합 테스트 #task-395
- extension.ts 3,446→1,289줄 (-63%) - step-probe.ts (1,435줄): setupMonitor, processResponseFile, tryApprovalStrategies - observer-script.ts (687줄): DOM observer script - ws-client.ts (390줄): WSBridgeClient - step-utils.ts (114줄): step 파싱 유틸 - auth.py (115줄): JWT + registration code - hub.py (581줄): WSHub + per-client queue - Hub WS 연동 테스트 통과 (auth, chat, register) - VSIX v0.4.0 빌드
This commit is contained in:
21
main.py
21
main.py
@@ -102,14 +102,29 @@ async def main():
|
||||
else:
|
||||
logger.info("Gateway mode — watcher disabled (data via HTTP API)")
|
||||
|
||||
# Start Gateway HTTP API (gateway mode)
|
||||
# Start Gateway HTTP API + WebSocket Hub (gateway mode)
|
||||
if Config.BOT_MODE == 'gateway':
|
||||
from gateway import GatewayAPI
|
||||
from hub import WSHub
|
||||
from auth import TokenManager
|
||||
|
||||
# Initialize Hub
|
||||
token_mgr = TokenManager(
|
||||
secret=Config.GRAVITY_HUB_SECRET,
|
||||
registration_code=Config.GRAVITY_REGISTRATION_CODE,
|
||||
)
|
||||
hub = WSHub(token_mgr)
|
||||
|
||||
gateway_port = int(os.environ.get('GATEWAY_PORT', '8585'))
|
||||
gateway = GatewayAPI(bot, port=gateway_port, api_key=Config.GATEWAY_API_KEY)
|
||||
gateway = GatewayAPI(
|
||||
bot, port=gateway_port,
|
||||
api_key=Config.GATEWAY_API_KEY,
|
||||
hub=hub,
|
||||
)
|
||||
bot.gateway = gateway # Enable _write_command → gateway.push_command
|
||||
bot.hub = hub # Enable Hub-based message routing
|
||||
await gateway.start()
|
||||
logger.info(f"Gateway API running on port {gateway_port}")
|
||||
logger.info(f"Gateway API + WS Hub running on port {gateway_port}")
|
||||
|
||||
# Run Discord bot (blocks until bot disconnects)
|
||||
await bot.start(Config.DISCORD_TOKEN)
|
||||
|
||||
Reference in New Issue
Block a user