Skip to content

feat: Phase 1 — Native gRPC integration replacing CLI scraping#3

Draft
mafueee wants to merge 10 commits intofeat/multi-claw-managementfrom
feat/grpc-native-integration
Draft

feat: Phase 1 — Native gRPC integration replacing CLI scraping#3
mafueee wants to merge 10 commits intofeat/multi-claw-managementfrom
feat/grpc-native-integration

Conversation

@mafueee
Copy link
Copy Markdown
Owner

@mafueee mafueee commented Mar 25, 2026

Phase 1: Native gRPC Integration

Replaces CLI-scraping (execSync + ANSI parsing) with direct gRPC/HTTP API calls to the OpenShell gateway. All API routes now use gRPC as the primary transport with automatic CLI fallback.

New Modules

  • gui/server/lib/grpcClient.js — Core gRPC client with mTLS credential loading, connection pooling, and async methods for all gateway operations (sandbox CRUD, watch streams, providers, inference, policies, logs)
  • gui/server/lib/gatewayHealth.js — Health monitoring via gRPC Health RPC and HTTP /readyz endpoint

Refactored Files

  • gui/server/services/clawManager.jsgetLiveSandboxes(), getSandboxDetail(), listClaws(), getClaw(), syncWithOpenShell() are now async with gRPC-first queries
  • gui/server/routes/claws.js — All 8 route handlers updated to async/await, sandbox deletion uses gRPC DeleteSandbox, log streaming tries gRPC WatchSandbox before CLI fallback
  • gui/server/index.jsGET /api/sandboxes, GET /api/sandboxes/:name/status, GET /api/gateway/status migrated to gRPC; WebSocket polling loop upgraded to gRPC-first

Proto Files

  • gui/server/proto/openshell.proto
  • gui/server/proto/datamodel.proto
  • gui/server/proto/inference.proto
  • gui/server/proto/sandbox.proto

Tests

  • test/grpc-client.test.js — 10 tests for mapPhaseToStatus() and sandboxToDto()
  • test/gateway-health.test.js — 5 tests for isGatewayConfigured()

Architecture

  • All routes use gRPC-first with CLI fallback — graceful degradation during migration
  • mTLS credentials reused from ~/.config/openshell/clusters/<name>/mtls/
  • Proto files loaded via @grpc/proto-loader (dynamic loading, no codegen step)

Note: gui/server/index.js, gui/server/routes/claws.js, and README.md changes require local sync to complete the push.

mafueee added 10 commits March 25, 2026 21:07
…ssion gRPC wrappers\n\nExtend grpcClient.js with missing gRPC wrapper functions needed\nfor the full CLI-to-gRPC migration.
… runCli(), parseSandboxList(), listGateways() and all\nexecSync/child_process usage with gRPC-only operations via\ngrpcClient.js. getGateways() now uses checkConnection().
…PC\n\nSandbox creation uses createProvider -> setClusterInference -> createSandbox\n-> watchSandbox SSE streaming. Deletion uses deleteSandbox. Log streaming\nuses watchSandbox(followLogs). All child_process imports removed.\n\nAlso update grpc-client tests to cover new wrapper function exports.
Replace ALL execSync/spawn subprocess calls with native gRPC:
- Sandbox CRUD: gRPC only, no CLI fallback
- Log streaming: WatchSandbox replaces spawn('openshell logs')
- Chat: ExecSandbox replaces spawn('openshell sandbox connect')
- Onboard: createProvider + setClusterInference + createSandbox + watchSandbox
- Inference: getClusterInference/setClusterInference
- Providers: full CRUD routes
- Policy: updateConfig/getSandboxConfig
- Preflight: gRPC health + listProviders
- WebSocket: gRPC-only polling
…dpoints

- Architecture section now emphasizes zero CLI subprocess calls
- Native API Integration table lists all gRPC RPCs by operation
- Dashboard Backend Components lists key server modules
- Onboard Wizard, Agent Chat, and Log Viewer descriptions updated
- Provider CRUD API endpoints added to Claw API table
- Server now explicitly binds to 0.0.0.0 instead of implicit localhost
- Adds draft policy routes, image builder routes, and Docker gateway service
- Adds DenialDashboard, CustomImageBuilder, and RoutingPanel components
- Adds inference routing transparency endpoint
- Updates PolicyEditor with YAML editor and OPA validation tabs
- Updates client API with new endpoint types and interfaces
- Updates App.tsx with new route entries for images and denials
- Updates README with new API documentation
mafueee pushed a commit that referenced this pull request Mar 28, 2026
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.

1 participant