Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: add enterprise feature for aibridge#19976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deansheather merged 1 commit intomainfromdean/aibridge-feature
Sep 26, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletionscodersdk/deployment.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -90,6 +90,7 @@ const (
// enterprise/coderd/license/license.go for the license format.
FeatureManagedAgentLimitFeatureName="managed_agent_limit"
FeatureWorkspaceExternalAgentFeatureName="workspace_external_agent"
FeatureAIBridgeFeatureName="aibridge"
)

var (
Expand DownExpand Up@@ -117,6 +118,7 @@ var (
FeatureWorkspacePrebuilds,
FeatureManagedAgentLimit,
FeatureWorkspaceExternalAgent,
FeatureAIBridge,
}

// FeatureNamesMap is a map of all feature names for quick lookups.
Expand All@@ -136,6 +138,8 @@ func (n FeatureName) Humanize() string {
return"Template RBAC"
caseFeatureSCIM:
return"SCIM"
caseFeatureAIBridge:
return"AI Bridge"
default:
returnstrings.Title(strings.ReplaceAll(string(n),"_"," "))
}
Expand Down
16 changes: 16 additions & 0 deletionsenterprise/cli/exp_aibridge_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,6 +16,7 @@ import (
"github.com/coder/coder/v2/coderd/database/dbtime"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/enterprise/coderd/coderdenttest"
"github.com/coder/coder/v2/enterprise/coderd/license"
"github.com/coder/coder/v2/testutil"
)

Expand All@@ -31,6 +32,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
memberClient,member:=coderdtest.CreateAnotherUser(t,client,owner.OrganizationID)
now:=dbtime.Now()
Expand DownExpand Up@@ -77,6 +83,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
memberClient,member:=coderdtest.CreateAnotherUser(t,client,owner.OrganizationID)

Expand DownExpand Up@@ -158,6 +169,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
memberClient,member:=coderdtest.CreateAnotherUser(t,client,owner.OrganizationID)

Expand Down
6 changes: 5 additions & 1 deletionenterprise/cli/server.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -148,8 +148,12 @@ func (r *RootCmd) Server(_ func()) *serpent.Command {

experiments:=agplcoderd.ReadExperiments(options.Logger,options.DeploymentValues.Experiments.Value())

varaibridgeDaemon*aibridged.Server
// In-memory aibridge daemon.
// TODO(@deansheather): the lifecycle of the aibridged server is
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add an issue for this rather, please?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

// probably better managed by the enterprise API type itself. Managing
// it in the API type means we can avoid starting it up when the license
// is not entitled to the feature.
varaibridgeDaemon*aibridged.Server
ifoptions.DeploymentValues.AI.BridgeConfig.Enabled {
ifexperiments.Enabled(codersdk.ExperimentAIBridge) {
aibridgeDaemon,err=newAIBridgeDaemon(api)
Expand Down
56 changes: 56 additions & 0 deletionsenterprise/coderd/aibridge_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
package coderd_test

import (
"net/http"
"testing"
"time"

Expand All@@ -15,12 +16,37 @@ import (
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/cryptorand"
"github.com/coder/coder/v2/enterprise/coderd/coderdenttest"
"github.com/coder/coder/v2/enterprise/coderd/license"
"github.com/coder/coder/v2/testutil"
)

funcTestAIBridgeListInterceptions(t*testing.T) {
t.Parallel()

t.Run("RequiresLicenseFeature",func(t*testing.T) {
t.Parallel()

dv:=coderdtest.DeploymentValues(t)
dv.Experiments= []string{string(codersdk.ExperimentAIBridge)}
client,_:=coderdenttest.New(t,&coderdenttest.Options{
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
// No aibridge feature
Features: license.Features{},
},
})
experimentalClient:=codersdk.NewExperimentalClient(client)

ctx:=testutil.Context(t,testutil.WaitLong)
_,err:=experimentalClient.AIBridgeListInterceptions(ctx, codersdk.AIBridgeListInterceptionsFilter{})
varsdkErr*codersdk.Error
require.ErrorAs(t,err,&sdkErr)
require.Equal(t,http.StatusForbidden,sdkErr.StatusCode())
require.Equal(t,"AI Bridge is a Premium feature. Contact sales!",sdkErr.Message)
})

t.Run("EmptyDB",func(t*testing.T) {
t.Parallel()
dv:=coderdtest.DeploymentValues(t)
Expand All@@ -29,6 +55,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
experimentalClient:=codersdk.NewExperimentalClient(client)
ctx:=testutil.Context(t,testutil.WaitLong)
Expand All@@ -45,6 +76,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
experimentalClient:=codersdk.NewExperimentalClient(client)
ctx:=testutil.Context(t,testutil.WaitLong)
Expand DownExpand Up@@ -126,6 +162,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
experimentalClient:=codersdk.NewExperimentalClient(client)
ctx:=testutil.Context(t,testutil.WaitLong)
Expand DownExpand Up@@ -210,6 +251,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
adminExperimentalClient:=codersdk.NewExperimentalClient(adminClient)
ctx:=testutil.Context(t,testutil.WaitLong)
Expand DownExpand Up@@ -249,6 +295,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
experimentalClient:=codersdk.NewExperimentalClient(client)
_,secondUser:=coderdtest.CreateAnotherUser(t,client,firstUser.OrganizationID)
Expand DownExpand Up@@ -407,6 +458,11 @@ func TestAIBridgeListInterceptions(t *testing.T) {
Options:&coderdtest.Options{
DeploymentValues:dv,
},
LicenseOptions:&coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureAIBridge:1,
},
},
})
experimentalClient:=codersdk.NewExperimentalClient(client)

Expand Down
2 changes: 2 additions & 0 deletionsenterprise/coderd/coderd.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,6 +229,7 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
api.AGPL.ExperimentalHandler.Group(func(r chi.Router) {
r.Route("/aibridge",func(r chi.Router) {
r.Use(
api.RequireFeatureMW(codersdk.FeatureAIBridge),
httpmw.RequireExperimentWithDevBypass(api.AGPL.Experiments,codersdk.ExperimentAIBridge),
)
r.Group(func(r chi.Router) {
Expand DownExpand Up@@ -770,6 +771,7 @@ func (api *API) updateEntitlements(ctx context.Context) error {
codersdk.FeatureUserRoleManagement:true,
codersdk.FeatureAccessControl:true,
codersdk.FeatureControlSharedPorts:true,
codersdk.FeatureAIBridge:true,
})
iferr!=nil {
return codersdk.Entitlements{},err
Expand Down
1 change: 1 addition & 0 deletionsenterprise/coderd/license/license_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,7 @@ func TestLicenseEntitlements(t *testing.T) {
codersdk.FeatureAccessControl:true,
codersdk.FeatureControlSharedPorts:true,
codersdk.FeatureWorkspaceExternalAgent:true,
codersdk.FeatureAIBridge:true,
}

legacyLicense:=func()*coderdenttest.LicenseOptions {
Expand Down
2 changes: 2 additions & 0 deletionssite/src/api/typesGenerated.ts
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

Loading

[8]ページ先頭

©2009-2025 Movatter.jp