Skip to content

feat(cloud): expose connectProvider() in @agent-relay/cloud SDK#798

Merged
khaliqgant merged 3 commits intomainfrom
feat/cloud-connect-sdk
Apr 29, 2026
Merged

feat(cloud): expose connectProvider() in @agent-relay/cloud SDK#798
khaliqgant merged 3 commits intomainfrom
feat/cloud-connect-sdk

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Apr 28, 2026

Summary

Lifts the Daytona-brokered provider auth flow out of the relay CLI and into the published @agent-relay/cloud package so other CLIs (ricky, future tools) can drive it directly via import { connectProvider } from '@agent-relay/cloud' instead of shelling out to agent-relay cloud connect.

  • New SDK exports: connectProvider, getProviderHelpText, normalizeProvider, runInteractiveSession, formatShellInvocation, wrapWithLaunchCheckpoint, loadSSH2, createAskpassScript, buildSystemSshArgs, DEFAULT_SSH_RUNTIME, plus SSH-related types
  • ssh2 is now an optionalDependency of @agent-relay/cloud — when missing, the existing system-ssh fallback path is used (behavior unchanged, just newly visible to consumers)
  • @agent-relay/cloud bumped 6.0.2 → 6.1.0 (additive)
  • The agent-relay cloud connect command body shrinks from ~150 LOC to a thin wrapper around connectProvider() that keeps telemetry attribution
  • src/cli/lib/{ssh-interactive,auth-ssh}.ts now re-export the SDK helpers (rather than redefining them) so the existing auth command path is unchanged
  • ssh-interactive.test.ts moved to packages/cloud/src/lib/ alongside the implementation

Net diff: ~1000 lines deleted (deduped to the SDK), ~600 added in the new package files.

Why

Other tools in the AgentWorkforce family (ricky in particular) want a <tool> connect <provider> UX that uses the same Daytona-brokered auth flow. Today they'd have to either shell out to agent-relay cloud connect or copy the SSH/PTY code. Extracting it into the published cloud package gives them a clean import boundary.

Test plan

  • vitest run in packages/cloud (32 passed — includes the moved ssh-interactive tests + new connect unit tests for normalizeProvider/getProviderHelpText)
  • vitest run src/cli/commands/{cloud,auth}.test.ts src/cli/bootstrap.test.ts (14 passed — confirms CLI wiring still resolves through the SDK)
  • tsc --noEmit at repo root — clean
  • Smoke agent-relay cloud connect claude end-to-end against staging cloud (not run from this branch — needs a cloud account)
  • Once merged + published, ricky imports connectProvider and ships ricky connect <claude|codex|opencode> (follow-up PR in the ricky repo)

Compatibility

  • @agent-relay/cloud 6.0.x consumers see only additive surface — no removed exports
  • Relay CLI's auth command (agent-relay auth <provider>) is unchanged — same SSH path, just imported from the cloud package
  • ssh2 moves from a regular dep (at the relay repo root, where it stays) to an optionalDependency of @agent-relay/cloud so SDK consumers get it on a clean install but can npm install --no-optional if they want to skip the native build

🤖 Generated with Claude Code


Open in Devin Review

Lifts the Daytona-brokered provider auth flow out of the relay CLI and into
@agent-relay/cloud so other CLIs (ricky, future tools) can drive it directly
via `import { connectProvider } from '@agent-relay/cloud'` instead of shelling
out to `agent-relay cloud connect`.

- New exports: connectProvider, getProviderHelpText, normalizeProvider,
  runInteractiveSession, formatShellInvocation, wrapWithLaunchCheckpoint,
  loadSSH2, createAskpassScript, buildSystemSshArgs, plus SSH-related types.
- ssh2 is now an optionalDependency of @agent-relay/cloud — the package falls
  back to system ssh when ssh2 isn't installed (existing behavior, just newly
  exposed to consumers).
- Cloud SDK bumped 6.0.2 → 6.1.0.
- The `agent-relay cloud connect` command body shrinks from ~150 LOC to a
  thin wrapper around connectProvider() that keeps telemetry attribution.
- src/cli/lib/{ssh-interactive,auth-ssh}.ts now re-export the SDK helpers
  (rather than redefining them) so the existing `auth` command path is
  unchanged. ssh-interactive.test.ts moved to packages/cloud alongside
  the implementation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@barryollama barryollama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Review from Barry (barryollama)

Thanks for the review request! I took a look at this refactoring PR and overall it looks like a solid architectural improvement. Here are my thoughts:

What I like:

  1. Clean SDK extraction — Moving connectProvider(), runInteractiveSession(), and the SSH runtime helpers into @agent-relay/cloud (6.1.0) creates a proper import boundary for other CLIs like ricky. The cloud package now owns the SSH implementation details.

  2. Backward compatibility — The existing CLI commands still work by re-exporting from the SDK, which is important for existing users.

  3. Optional dependency — Making ssh2 an optionalDependency is the right call. It allows consumers without the native module to fall back to system ssh seamlessly.

  4. Type safety — The exported types give consumers a clear API contract.

A couple of observations:

  • The CLI command shrinks from ~150 LOC to a thin wrapper — excellent deduplication.
  • The moved ssh-interactive.test.ts plus new connect.test.ts shows the test coverage is being preserved.
  • The CHANGELOG.md entry is comprehensive and follows the project's format.

Overall assessment:

  • This is a well-structured refactoring.
  • The extraction reduces duplication while maintaining backward compatibility.
  • The test plan in the PR description covers the right surface area.

LGTM! 🚀

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

Resolves CHANGELOG.md by keeping both 6.1.0 entries (cloud connect SDK
and sdk/workflows script runner). Other files auto-merged.
@khaliqgant khaliqgant merged commit d3937fd into main Apr 29, 2026
45 checks passed
@khaliqgant khaliqgant deleted the feat/cloud-connect-sdk branch April 29, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants