Skip to content

Conversation

@ebarroca
Copy link
Contributor

Summary

  • Add support for STS (Security Token Service) for API key authentication
  • Add global CLI options for flexible server configuration
  • Improve API key handling with auto-extraction of project/account IDs
  • Fix authentication to use proper Authorization Bearer header with POST request

Changes

CLI Enhancements

  • Global Options: Added --site, --studio-url, --store-url, --sts-url, --apikey options
  • Environment Variables: Support VERTESIA_SITE, STS_SERVER_URL
  • Simplified Auth: Removed requirement for --project and --account when using --apikey

STS Integration

  • Added STS server URL configuration with proper environment-based URLs:
    • Production: https://sts.vertesia.io
    • Preview: https://sts-preview.vertesia.io
    • Staging: https://sts-staging.vertesia.io (default for branch environments)
  • Updated getAuthToken() to use /token/issue endpoint
  • Changed from GET with query params to POST with Authorization Bearer header

Client Improvements

  • Added stsUrl parameter to VertesiaClientProps
  • Made account and project optional in Profile interface
  • Improved error messages to include STS URL for debugging

Test Plan

  • Build client and CLI packages successfully
  • Test with different site configurations
  • Verify Authorization Bearer header authentication
  • Test with actual API keys in staging/preview/production environments

🤖 Generated with Claude Code

bstefanescu and others added 12 commits October 8, 2025 17:09
Co-authored-by: Michaël Vachette <5880528+michaelva@users.noreply.github.com>
- Add support for STS (Security Token Service) for API key authentication
- Add global CLI options: --site, --studio-url, --store-url, --sts-url, --apikey
- Update VertesiaClient to support stsUrl parameter with proper URL derivation:
  - Production: https://sts.vertesia.io
  - Preview: https://sts-preview.vertesia.io
  - Staging: https://sts-staging.vertesia.io (default for branch envs)
- Fix getAuthToken to use /token/issue endpoint with Authorization Bearer header
- Remove requirement for --project and --account when using --apikey (auto-extracted from JWT)
- Make account and project fields optional in Profile interface
- Improve error messages to include STS URL for better debugging
- Support environment variables: VERTESIA_SITE, STS_SERVER_URL

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ebarroca ebarroca requested a review from a team as a code owner October 16, 2025 03:41
@vertesia-code-review
Copy link

vertesia-code-review bot commented Oct 16, 2025

Changes

This pull request introduces several enhancements and fixes across multiple packages in the Vertesia ecosystem. It updates package versions, improves CLI functionality by adding global options for API configuration (site, studio-url, store-url, sts-url, apikey) to allow users to override server URLs via command-line flags, enhances the Vertesia client with the ability to work with STS (Security Token Service), and introduces an InteractionOutput utility to the @vertesia/client package to provide a more ergonomic way to handle interaction results. Additionally, some UI components are updated to improve overall stability.

Here is a breakdown of the changes:

Path Description
package.json Updated the version of the @vertesia/packages package from 0.78.0 to 0.79.0.
packages/api-fetch-client/package.json Updated the version of the @vertesia/api-fetch-client package from 0.78.0 to 0.79.0.
packages/cli/package.json Updated the version of the @vertesia/cli package from 0.78.0 to 0.79.0.
packages/cli/src/client.ts Modified the CLI client to:- Get options from CLI flags, profile, and environment variables.- Ensure either site or studioUrl is present to avoid client initialization errors.- Use studioUrl, storeUrl, and stsUrl from CLI options, profile, or environment variables.
packages/cli/src/index.ts Added global options to the CLI for API configuration:- --site <site>: Vertesia site- --studio-url <url>: Custom Studio server URL- --store-url <url>: Custom Store server URL- --sts-url <url>: Custom STS server URL- --apikey <key>: API key for authentication
packages/cli/src/profiles/commands.ts Modified profile creation to make account and project IDs optional when using an API key, as the VertesiaClient can extract them from the API key automatically.
packages/cli/src/profiles/index.ts Modified the profile configuration to:- Introduce sts_server_url to the profile interface.- Add logic to determine sts_server_url based on the environment.- Modify getServerUrls function to return sts_server_url based on the environment (local, staging, preview, prod).
packages/client/package.json Updated the version of the @vertesia/client package from 0.78.0 to 0.79.0.
packages/client/src/InteractionOutput.ts Introduced the InteractionOutput class and related utilities to provide a more ergonomic way to handle interaction results, with methods to access text, objects and images.
packages/client/src/InteractionsApi.ts Updated the execute and executeByName functions to return EnhancedInteractionExecutionResult.
packages/client/src/RunsApi.ts Updated the retrieve and create functions to return EnhancedExecutionRun.
packages/client/src/client.ts Extended VertesiaClientProps to include stsUrl, and updated VertesiaClient to include stsUrl configuration.
packages/common/package.json Updated the version of the @vertesia/common package from 0.78.0 to 0.79.0.
packages/common/src/query.ts Added model and environment fields to InteractionSearchQuery interface.
packages/common/src/store/store.ts Added an enum called ContentNature and used it as the allowed values for the type properties on object metadata.
packages/common/src/store/workflow.ts Added WebHookSpec interface and updated notify_endpoints property to accept string or WebHookSpec objects.
packages/common/src/versions.ts Added enum ApiVersions to keep track of API versioning.
packages/ui/src/core/components/shadcn/button.tsx Fixed a bug when link button color was incorrect.
packages/ui/src/core/components/shadcn/index.ts Added textarea component.
packages/ui/src/core/components/shadcn/textarea.tsx Added shadcn's textarea component.
packages/ui/src/features/store/collections/CreateCollection.tsx Replaced <textarea> by the new <Textarea> component.
packages/ui/src/features/store/collections/EditCollectionView.tsx Replaced <textarea> by the new <Textarea> component.
packages/ui/src/features/store/objects/components/ContentOverview.tsx Make compatible with web video using <VideoPanel> and <ImagePanel>.
packages/workflow/src/activities/* Applied changes to functions in /packages/workflow/src/activities/ to use the new InteractionOutput when parsing the return from executions, use updated object metadata properties, and use API version enums.
packages/workflow/src/system/notifyWebhookWorkflow.ts Applied changes to the function in /packages/workflow/src/system/notifyWebhookWorkflow.ts to use workflow information to generate webhooks and use webhooks correctly.

Purpose

The primary motivation behind this pull request is to enhance the CLI tool by adding support for STS (Security Token Service) authentication. This allows for more secure and flexible API key handling. Additionally, the PR aims to improve the CLI's configurability by introducing global options for server configuration, removing the necessity for users to manually specify project and account IDs when using an API key, and improving the overall authentication process.

The context of this pull request involves addressing limitations in the existing CLI tool, particularly in how it handles API key authentication and server configuration. By integrating STS authentication and providing global CLI options, the PR aims to simplify the user experience and make the CLI more adaptable to different environments (production, preview, staging). The changes include modifying the authentication process to use the Authorization Bearer header with POST requests, which is deemed more secure and standard.

Related issues: N/A

Code Review

You can start a code review by adding a comment: "Vertesia, please review".

Note that the motivation and context are rated as very clear (5/5). The agent has a very good understanding of the purpose of the pull request.

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.

7 participants