mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-10 02:16:45 +08:00
Two comments described rules the types do not enforce. ParseListingID is not the only way to build a ListingID, and decodeVersion returns more than ErrInvalidListing. Co-authored-by: klinsmaya <[email protected]>
108 lines
4.7 KiB
Go
108 lines
4.7 KiB
Go
package featureflags
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/multica-ai/multica/server/pkg/featureflag"
|
|
)
|
|
|
|
const (
|
|
// BillingWorkspaceSubscriptions gates the workspace-scoped entitlement,
|
|
// Stripe Checkout, seat reconcile, and Billing Portal proxy surface. It is
|
|
// deliberately off by default so the main repository can ship before the
|
|
// managed cloud enables its matching billing.subscriptions capability.
|
|
BillingWorkspaceSubscriptions = "billing_workspace_subscriptions"
|
|
// ComposioMCPApps gates the Composio app management UI and — together with
|
|
// the MUL-3963 permission_mode / invocation_targets access model it depends
|
|
// on — the aligned Private / Public-to picker in the agent create flow.
|
|
// The access model exists to gate Composio sharing, so the two ship on the
|
|
// same switch.
|
|
ComposioMCPApps = "composio_mcp_apps"
|
|
// PluginsV1 gates the user-facing Plugin catalog and lifecycle management
|
|
// APIs while the first product slice is dogfooded. It deliberately does not
|
|
// gate pinned Task/Run execution: disabling discovery and management must not
|
|
// mutate an immutable execution manifest that is already in flight.
|
|
PluginsV1 = "plugins_v1"
|
|
// TriageV1 gates the Triage inbox (MUL-7189): creating issues into Triage,
|
|
// triage runs, and the Triage page. It is a GLOBAL switch — per-workspace
|
|
// targeting has no production wiring — which is enough because a
|
|
// workspace with no triager configured and no Triage issues sees nothing
|
|
// either way. Turning it off stops new intake and triage runs but leaves
|
|
// existing Triage issues workable.
|
|
TriageV1 = "triage_v1"
|
|
// ProjectWorkflowsV1 gates project workflows (MUL-7420): creating a
|
|
// workflow and pointing a project at one, plus the Settings → Workflows
|
|
// and project workflow UI. Turning it off stops new adoption but leaves
|
|
// workflows already in use working, and a project can always switch back
|
|
// to the Default workflow.
|
|
ProjectWorkflowsV1 = "project_workflows_v1"
|
|
// LocalSearchIndex gates the sync endpoints behind Web/Desktop local search
|
|
// (MUL-7754). On by default. Turning it off (FF_LOCAL_SEARCH_INDEX=off)
|
|
// makes those endpoints answer 404, so clients stop syncing and search
|
|
// through the server again without a client release.
|
|
LocalSearchIndex = "local_search_index"
|
|
MarketV1 = "market_v1"
|
|
// agentBuilderCompat is no longer a release flag. Keep publishing the key
|
|
// as enabled so installed desktop clients that still gate the AI creation
|
|
// entry on this config decision receive the permanently enabled behavior.
|
|
agentBuilderCompat = "agents_agent_builder"
|
|
// agentSkillTogglesCompat is no longer a release flag. Keep publishing the
|
|
// key as enabled so installed v0.4.0 desktop clients, which still gate the
|
|
// switch on this config decision, receive the permanently enabled behavior.
|
|
agentSkillTogglesCompat = "agents_skill_toggles"
|
|
// resourceLabelsCompat is no longer a release flag. Keep publishing the key
|
|
// as enabled for installed desktop clients from v0.4.0 through at least
|
|
// v0.4.15, every release shipped before this change. Unlike the skill-toggle
|
|
// gate above, which was removed client-side in v0.4.1, the resource-label
|
|
// gate remained in every such client and fails closed (default false) if
|
|
// the key stops being published.
|
|
resourceLabelsCompat = "settings_resource_labels"
|
|
)
|
|
|
|
var frontendPublicFlags = []string{
|
|
BillingWorkspaceSubscriptions,
|
|
ComposioMCPApps,
|
|
PluginsV1,
|
|
ProjectWorkflowsV1,
|
|
MarketV1,
|
|
}
|
|
|
|
func BillingWorkspaceSubscriptionsEnabled(ctx context.Context, flags *featureflag.Service) bool {
|
|
return flags.IsEnabled(ctx, BillingWorkspaceSubscriptions, false)
|
|
}
|
|
|
|
func ComposioMCPAppsEnabled(ctx context.Context, flags *featureflag.Service) bool {
|
|
return flags.IsEnabled(ctx, ComposioMCPApps, false)
|
|
}
|
|
|
|
func PluginsV1Enabled(ctx context.Context, flags *featureflag.Service) bool {
|
|
return flags.IsEnabled(ctx, PluginsV1, false)
|
|
}
|
|
|
|
func TriageV1Enabled(ctx context.Context, flags *featureflag.Service) bool {
|
|
return flags.IsEnabled(ctx, TriageV1, false)
|
|
}
|
|
|
|
func LocalSearchIndexEnabled(ctx context.Context, flags *featureflag.Service) bool {
|
|
return flags.IsEnabled(ctx, LocalSearchIndex, true)
|
|
}
|
|
|
|
func EvaluateFrontendPublicFlags(ctx context.Context, flags *featureflag.Service) map[string]bool {
|
|
out := make(map[string]bool, len(frontendPublicFlags)+3)
|
|
for _, key := range frontendPublicFlags {
|
|
out[key] = flags.IsEnabled(ctx, key, false)
|
|
}
|
|
out[agentBuilderCompat] = true
|
|
out[agentSkillTogglesCompat] = true
|
|
out[resourceLabelsCompat] = true
|
|
return out
|
|
}
|
|
|
|
func ProjectWorkflowsV1Enabled(ctx context.Context, flags *featureflag.Service) bool {
|
|
return flags.IsEnabled(ctx, ProjectWorkflowsV1, false)
|
|
}
|
|
|
|
func MarketV1Enabled(ctx context.Context, flags *featureflag.Service) bool {
|
|
return flags.IsEnabled(ctx, MarketV1, false)
|
|
}
|