feat(studio): OpenAPI Converter for TS Capabilities#492
feat(studio): OpenAPI Converter for TS Capabilities#492steramae-nvidia wants to merge 2 commits into
Conversation
Signed-off-by: Sean Teramae <steramae@nvidia.com>
📝 WalkthroughWalkthroughThe SDK adds capability generation, invocation, registry search, gateway tools, provider adapters, default fetchers, and Vitest coverage. ChangesSDK capability pipeline
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
web/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (15)
web/packages/sdk/generateAll.tsweb/packages/sdk/orval/generate-capabilities.tsweb/packages/sdk/package.jsonweb/packages/sdk/src/capabilities/adapters/anthropic.tsweb/packages/sdk/src/capabilities/adapters/mcp.tsweb/packages/sdk/src/capabilities/adapters/openai.tsweb/packages/sdk/src/capabilities/capabilities.test.tsweb/packages/sdk/src/capabilities/fetchers.tsweb/packages/sdk/src/capabilities/gateway.tsweb/packages/sdk/src/capabilities/index.tsweb/packages/sdk/src/capabilities/invoke.tsweb/packages/sdk/src/capabilities/registry.tsweb/packages/sdk/src/capabilities/types.tsweb/packages/sdk/tsconfig.jsonweb/packages/sdk/vitest.config.ts
|
Signed-off-by: Sean Teramae <steramae@nvidia.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
web/packages/sdk/src/capabilities/registry.ts (1)
61-62: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
limit: 0still expands to 25 results.The truthy check folds
0into the default path, sosearchCapabilities(..., { limit: 0 })returns up to 25 entries instead of none. Treatundefinedseparately.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
📒 Files selected for processing (3)
web/packages/sdk/src/capabilities/capabilities.test.tsweb/packages/sdk/src/capabilities/gateway.tsweb/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
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
Summary by CodeRabbit