fix(sdk): expose agent APIs and report missing event sources immediately

WI
3d ago
+477-49

Registered and reconnected SDK clients already expose actions, capabilities, and listeners at runtime, but their return type hides those members. This makes valid integrations fail to compile. RelayAgentClient now inherits the full runtime contract while preserving typed action and listener inference.

Workspace listeners with no agent source now report actionable guidance immediately through the existing error hook, including registration/reconnection and channel membership. The listener remains active so an agent registered later can start delivery. Direct agent-token and observer clients retain their working streams without a false missing-source warning.

Revalidation of #1359

Rechecked all three reports against main at 72d9858:

  • Section 2: reproduced and fixed. New strict consumer tests fail before the type change and pass after it, covering single/array registration, reconnect, capabilities, exact listener selectors, and generic actions.
  • Section 3: reproduced and fixed. The warning previously arrived after ten seconds. Regression tests cover synchronous reporting, deduplication, late registration, direct agent tokens, and observer mode.
  • Section 1: confirmed upstream. Locked @relaycast/sdk@8.16.0 drops blocks in transformServerLikeEvent before Relay normalization. Current Relaycast main still has the defect; the companion fix is https://github.com/AgentWorkforce/relaycast/pull/634. This PR does not claim to restore blocks or close the issue.

Refs #1359.

Validation

  • SDK runtime suite: 200 passed.
  • Strict SDK type tests: 11 passed; the missing-member groups fail before the fix, and negative workspace-operation assertions fail before narrowing.
  • SDK build and TypeScript check: passed.
  • Full repository npm run typecheck: passed using Git Bash for existing Unix build scripts on Windows.
  • Prettier and git diff --check: passed.
  • Two independent agent reviews: PASS, recorded as submitted COMMENT reviews on this PR.

No dependency versions changed. No merge, release, deployment, or production operations performed.

Cross-repository validation: the built Relaycast fix -> Relay adapter -> public listener preserved a 49 KB blocks payload and matched fixture REST readback.

Autofix pass: narrowed only returned-agent workspace operations, declared actual adapter event scope, recognized injected agentClient, and reused the root-token transport only when its exact credential binding is known. Added wrong-identity and duplicate-stream regressions; addressed automated review threads. GitHub build jobs remain queued.