# Wearable HUD + GDO/IDC Integration Spec

## Goals

1. Wearable DHD HUD can control nearby gates when within local range.
2. HUD can optionally call external API for address book and identity context.
3. Optional gate security mode using GDO/IDC.
4. Gate display indicates:
- do not proceed when iris or shield is engaged
- IDC accepted proceed when access is granted
5. Gate owner can manage access list for other users.

## Components

1. Wearable HUD script: stargate_wearable_dhd_hud_v1.lsl
2. Gate-side access controller: stargate_gdo_idc_controller_v1.lsl
3. Gate controller skeleton: stargate_gate_controller_skeleton_v1.lsl
4. Gate status display: stargate_status_display_controller_v1.lsl

## Local Channels

1. apiChannelRecv -708005
- Existing gate command ingress.
- HUD uses this for local gate actions.

2. gdoChannel -708006
- Optional secure channel for IDC interactions.
- HUD sends IDC request payloads.
- Gate-side GDO script responds with result payloads.

## HUD Local Control Flow

1. User taps HUD and picks Discover Gate.
2. HUD scans nearby objects within configured range.
3. User selects target gate.
4. HUD sends local commands:
- DHD|DIAL|manual|csv_route
- DHD|ADDRESS_BOOK|FETCH
- GDO|IDC_REQUEST|avatar_key|idc_code|gate_address

## Optional API Flow

1. HUD can request address suggestions and user profile from API.
2. API request should include avatar key and auth token.
3. API response can be cached in HUD for short TTL.

## GDO/IDC Gate Security Flow

1. Incoming wormhole starts.
2. If security mode enabled, gate holds iris/shield closed.
3. HUD user sends IDC request.
4. Gate validates using:
- owner allow list
- optional static IDC code
- optional API authorization callback
5. Gate returns:
- IDC|RESULT|ACCEPT|avatar_key|reason
- IDC|RESULT|DENY|avatar_key|reason
6. On accept:
- gate opens iris or drops shield
- status display shows IDC accepted proceed
7. On deny:
- gate keeps barrier active
- status display shows do not proceed

## Owner Access Management

Owner commands (chat channel -779902):

1. security on
2. security off
3. idc code <value>
4. allow add <avatar_uuid>
5. allow remove <avatar_uuid>
6. allow list
7. allow clear
8. idc status

## Display Messaging

Recommended SG_STATUS payloads:

1. SECURITY_BLOCK|iris_engaged
2. SECURITY_BLOCK|shield_engaged
3. IDC_ACCEPTED|avatar_name_or_key

## Persistence Recommendation

1. Current starter script keeps access list in memory.
2. Production should persist to backend API and sync on startup.
3. Optional local notecard export/import can be added later.
