import { describe, it, expect } from 'vitest'
// Cross-package resolution smoke test: prove relay-run can bare-import the REAL exports of the
// relay packages it wires — including the term-relay data-plane DEEP imports (term-relay has no
// barrel index / exports map, so subpath `.js` specifiers resolve to the `.ts` sources).
import { onUpgrade, onReattach, issueCapabilityToken, configureVerifyKey } from 'relay-auth'
import { createClientHandshake, createHostHandshake, createE2ESession } from 'relay-e2e'
import { APP_SUBPROTOCOL, encodeTokenSubprotocol } from 'relay-contracts'
import { createRelayNode } from 'term-relay/data-plane/relay-node.js'
import { createAgentListener } from 'term-relay/data-plane/agent-listener.js'
import { authorizeUpgrade } from 'term-relay/data-plane/upgrade.js'
import { createMuxSession } from 'term-relay/mux/mux-session.js'

describe('relay-run cross-package import smoke', () => {
  it('resolves relay-auth / relay-e2e / relay-contracts + term-relay data-plane deep imports', () => {
    expect(typeof onUpgrade).toBe('function')
    expect(typeof onReattach).toBe('function')
    expect(typeof issueCapabilityToken).toBe('function')
    expect(typeof configureVerifyKey).toBe('function')
    expect(typeof createClientHandshake).toBe('function')
    expect(typeof createHostHandshake).toBe('function')
    expect(typeof createE2ESession).toBe('function')
    expect(APP_SUBPROTOCOL).toBe('term.relay.v1')
    expect(typeof encodeTokenSubprotocol).toBe('function')
    expect(typeof createRelayNode).toBe('function')
    expect(typeof createAgentListener).toBe('function')
    expect(typeof authorizeUpgrade).toBe('function')
    expect(typeof createMuxSession).toBe('function')
  })
})
