Skip to content

feat(studio): OpenAPI Converter for TS Capabilities#492

Open
steramae-nvidia wants to merge 2 commits into
mainfrom
steramae/sdk-capabilities
Open

feat(studio): OpenAPI Converter for TS Capabilities#492
steramae-nvidia wants to merge 2 commits into
mainfrom
steramae/sdk-capabilities

Conversation

@steramae-nvidia

@steramae-nvidia steramae-nvidia commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This PR adds a new script for generating capabilities and some gateway tool definitions (search, describe, read and run) to help with consuming said capabilities.

The idea here, is an agent/model will inveitably want to interact with nemo platform through the API. There already exists nemo skills that describe CLI commands which work well but only for CLI based AIs. In Studio, a web UI based app, we would want an agent to be able to interact with the platform similar to how a user would through publicly available web based APIs. This isn't meant as a replacement for the CLI skills but rather a new tool for web based interaction of agents and nemo platform. Since this is auto generated from the openapi yaml, it is the clearest connection from what is available on the API.

example capability

{
    "name": "access_secret_apis_secrets_v2_workspaces__workspace__secrets__name__access_get",
    "service": "platform",
    "method": "GET",
    "path": "/apis/secrets/v2/workspaces/{workspace}/secrets/{name}/access",
    "summary": "Access Secret",
    "description": "Access the value of a secret.",
    "tags": [
      "Secrets"
    ],
    "readOnly": true,
    "pathParams": [
      "name",
      "workspace"
    ],
    "queryParams": [],
    "hasBody": false,
    "bodyRequired": false,
    "inputSchema": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "workspace": {
          "type": "string",
          "title": "Workspace"
        }
      },
      "required": [
        "name",
        "workspace"
      ]
    }
  }

Summary by CodeRabbit

  • New Features
    • Added an SDK capabilities system to discover, describe, and run API operations via a ready-to-use gateway and bundled registry.
    • Introduced tool export support for OpenAI, Anthropic, and MCP-compatible formats.
    • Added capability metadata generation from service OpenAPI specs to keep the registry in sync.
  • Bug Fixes
    • Improved capability regeneration by expanding cache invalidation coverage and running capability generation during the generation pipeline.
  • Tests
    • Added unit tests covering capability search, invocation, gateway behavior, and adapter conversions.

Signed-off-by: Sean Teramae <steramae@nvidia.com>
@steramae-nvidia steramae-nvidia requested review from a team as code owners June 26, 2026 21:57
@github-actions github-actions Bot added the feat label Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The SDK adds capability generation, invocation, registry search, gateway tools, provider adapters, default fetchers, and Vitest coverage.

Changes

SDK capability pipeline

Layer / File(s) Summary
Registry generation and wiring
web/packages/sdk/orval/generate-capabilities.ts, web/packages/sdk/generateAll.ts, web/packages/sdk/package.json
Adds the capability registry generator, cache invalidation input, and the new npm script.
Model and lookup
web/packages/sdk/src/capabilities/types.ts, web/packages/sdk/src/capabilities/registry.ts, web/packages/sdk/src/capabilities/invoke.ts, web/packages/sdk/src/capabilities/fetchers.ts
Adds capability metadata types, summary/search helpers, request execution, and default service fetchers.
Gateway and entrypoint
web/packages/sdk/src/capabilities/gateway.ts, web/packages/sdk/src/capabilities/index.ts
Adds the search/describe/read/run gateway and the public capability entrypoint.
Tool adapters
web/packages/sdk/src/capabilities/adapters/*
Adds Anthropic, OpenAI, and MCP tool conversions.
Tests and Vitest setup
web/packages/sdk/src/capabilities/capabilities.test.ts, web/packages/sdk/tsconfig.json, web/packages/sdk/vitest.config.ts
Adds Vitest setup and coverage for invocation, search, gateway, and adapter behavior.

Possibly related PRs

Suggested reviewers

  • htolentino-nvidia
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the PR’s main change: generating TypeScript capabilities from OpenAPI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch steramae/sdk-capabilities

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/packages/sdk/src/capabilities/adapters/anthropic.ts`:
- Line 4: The import in anthropic.ts is using a relative path that violates the
SDK TypeScript import rule. Replace the `Capability` and `JsonSchema` import
from `../types` with the configured SDK alias path used elsewhere in the
package. Update the top-level import only, keeping the rest of the `anthropic`
adapter logic unchanged.

In `@web/packages/sdk/src/capabilities/adapters/openai.ts`:
- Line 4: The import in the openai adapter uses a relative path that violates
the SDK import rule. Update the import in the openai.ts module to use the
configured SDK absolute alias instead of ../types, keeping the same Capability
and JsonSchema symbols. Make sure all references in this file continue to
resolve through the tsconfig path-mapped alias and no relative TypeScript
imports remain here.

In `@web/packages/sdk/src/capabilities/capabilities.test.ts`:
- Around line 4-10: The test file is using relative imports that violate the
repository’s alias-import rule and will fail linting. Update the imports in
capabilities.test.ts to use the configured absolute alias paths instead of
./adapters/*, ./gateway, ./invoke, ./registry, and ./types, keeping the same
referenced symbols such as toAnthropicTools, callMcpTool, toMcpTools,
toOpenAITools, createGateway, invokeCapability, searchCapabilities, and the type
imports.

In `@web/packages/sdk/src/capabilities/fetchers.ts`:
- Around line 10-15: This module uses relative import paths for the generated
fetchers, which violates the web TypeScript import rule. Update the imports in
fetchers.ts to use the package alias form instead of ../../ paths, keeping the
same symbols such as customFetch as agentsFetch, dataDesignerFetch,
evaluatorFetch, platformFetch, and safeSynthesizerFetch, and ensure all
references continue to resolve through the tsconfig path mapping.

In `@web/packages/sdk/src/capabilities/gateway.ts`:
- Around line 87-91: The searchCapabilities call in gateway.ts currently
forwards args.limit directly, which allows 0 or negative values despite the
schema requiring a minimum of 1. Update the limit handling in the capability
search flow to clamp or validate args.limit as a positive integer before passing
it into searchCapabilities, and fall back to undefined for any non-integer,
zero, or negative input so the helper only receives safe limits.

In `@web/packages/sdk/src/capabilities/registry.ts`:
- Line 4: The import in registry.ts uses a relative path and violates the SDK
import rule enforced by no-relative-import-paths. Update the CapabilityMeta
import in the registry module to use the configured package alias path instead
of ./types, matching the project’s absolute import convention.
- Around line 61-78: The search logic in the capabilities registry accepts a raw
numeric limit and passes it directly to slice, so negative or invalid values can
produce unintended results. Update the search helper in registry.ts to validate
the limit before slicing, either by clamping it to a non-negative integer or by
rejecting invalid inputs. Keep the fix centered around the search_capabilities
flow that builds scored results and returns the sliced summaries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e2d68e96-e2a4-4575-a454-8a5bd7042ee3

📥 Commits

Reviewing files that changed from the base of the PR and between 470971a and c99459f.

⛔ Files ignored due to path filters (1)
  • web/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (15)
  • web/packages/sdk/generateAll.ts
  • web/packages/sdk/orval/generate-capabilities.ts
  • web/packages/sdk/package.json
  • web/packages/sdk/src/capabilities/adapters/anthropic.ts
  • web/packages/sdk/src/capabilities/adapters/mcp.ts
  • web/packages/sdk/src/capabilities/adapters/openai.ts
  • web/packages/sdk/src/capabilities/capabilities.test.ts
  • web/packages/sdk/src/capabilities/fetchers.ts
  • web/packages/sdk/src/capabilities/gateway.ts
  • web/packages/sdk/src/capabilities/index.ts
  • web/packages/sdk/src/capabilities/invoke.ts
  • web/packages/sdk/src/capabilities/registry.ts
  • web/packages/sdk/src/capabilities/types.ts
  • web/packages/sdk/tsconfig.json
  • web/packages/sdk/vitest.config.ts

Comment thread web/packages/sdk/src/capabilities/adapters/anthropic.ts
Comment thread web/packages/sdk/src/capabilities/adapters/openai.ts
Comment thread web/packages/sdk/src/capabilities/capabilities.test.ts
Comment thread web/packages/sdk/src/capabilities/fetchers.ts
Comment thread web/packages/sdk/src/capabilities/gateway.ts
Comment thread web/packages/sdk/src/capabilities/registry.ts
Comment thread web/packages/sdk/src/capabilities/registry.ts Outdated
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 21898/28725 76.2% 61.0%
Integration Tests 12583/27405 45.9% 19.2%

@steramae-nvidia steramae-nvidia changed the title feat(studio): SDK capabilities feat(studio): OpenAPI Converter for TS Capabilities Jun 26, 2026
Signed-off-by: Sean Teramae <steramae@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
web/packages/sdk/src/capabilities/registry.ts (1)

61-62: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

limit: 0 still expands to 25 results.

The truthy check folds 0 into the default path, so searchCapabilities(..., { limit: 0 }) returns up to 25 entries instead of none. Treat undefined separately.

Suggested fix
-  const { limit, service, readOnly } = options;
-  const safeLimit = limit && Number.isInteger(limit) && limit > 0 ? Math.floor(limit) : 25;
+  const { service, readOnly } = options;
+  const safeLimit =
+    options.limit === undefined
+      ? 25
+      : Number.isInteger(options.limit) && options.limit >= 0
+        ? options.limit
+        : 25;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/packages/sdk/src/capabilities/registry.ts` around lines 61 - 62, The
limit handling in registry.ts incorrectly treats 0 as missing because of the
truthy check, so searchCapabilities with limit: 0 falls back to 25. Update the
safeLimit logic in the registry helper that destructures { limit, service,
readOnly } so that undefined is the only value that uses the default, while 0
remains a valid explicit limit. Keep the existing positive-integer validation
and locate the fix in the capability registry code path that computes safeLimit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@web/packages/sdk/src/capabilities/registry.ts`:
- Around line 61-62: The limit handling in registry.ts incorrectly treats 0 as
missing because of the truthy check, so searchCapabilities with limit: 0 falls
back to 25. Update the safeLimit logic in the registry helper that destructures
{ limit, service, readOnly } so that undefined is the only value that uses the
default, while 0 remains a valid explicit limit. Keep the existing
positive-integer validation and locate the fix in the capability registry code
path that computes safeLimit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 22edf8e1-ec94-487d-9dfe-0aff09184be7

📥 Commits

Reviewing files that changed from the base of the PR and between c99459f and 5665295.

📒 Files selected for processing (3)
  • web/packages/sdk/src/capabilities/capabilities.test.ts
  • web/packages/sdk/src/capabilities/gateway.ts
  • web/packages/sdk/src/capabilities/registry.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/packages/sdk/src/capabilities/capabilities.test.ts
  • web/packages/sdk/src/capabilities/gateway.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant