@featureflip/mcp 0.1.13 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/cli.mjs +1 -1
- package/dist/client.d.ts +6 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/generated/api-types.d.ts +542 -228
- package/dist/generated/api-types.d.ts.map +1 -1
- package/dist/generated/output-schemas.json.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{org-D-y_4-WG.js → org-DFNWkYpr.js} +685 -307
- package/dist/server.d.ts.map +1 -1
- package/dist/tools/environments.d.ts.map +1 -1
- package/dist/tools/etag.d.ts +18 -0
- package/dist/tools/etag.d.ts.map +1 -0
- package/dist/tools/flags.d.ts.map +1 -1
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/sdk-keys.d.ts +4 -0
- package/dist/tools/sdk-keys.d.ts.map +1 -0
- package/dist/tools/segments.d.ts.map +1 -1
- package/dist/tools/targeting.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import * as n from "zod/v4";
|
|
|
4
4
|
//#region src/version.ts
|
|
5
5
|
var r = {
|
|
6
6
|
name: "@featureflip/mcp",
|
|
7
|
-
version: "0.
|
|
7
|
+
version: "0.3.0",
|
|
8
8
|
mcpName: "io.github.canopy-labs/featureflip",
|
|
9
9
|
description: "MCP server for managing Featureflip feature flags from AI agents and editors",
|
|
10
10
|
keywords: [
|
|
@@ -65,18 +65,21 @@ var r = {
|
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
function a(e) {
|
|
68
|
+
return /^(W\/)?".*"$/.test(e) ? e : `"${e}"`;
|
|
69
|
+
}
|
|
70
|
+
function o(e) {
|
|
68
71
|
return encodeURIComponent(e);
|
|
69
72
|
}
|
|
70
|
-
var
|
|
73
|
+
var s = /* @__PURE__ */ new Set([
|
|
71
74
|
502,
|
|
72
75
|
503,
|
|
73
76
|
504
|
|
74
|
-
]),
|
|
77
|
+
]), c = /* @__PURE__ */ new Set([
|
|
75
78
|
"GET",
|
|
76
79
|
"HEAD",
|
|
77
80
|
"PUT",
|
|
78
81
|
"DELETE"
|
|
79
|
-
]),
|
|
82
|
+
]), l = [250, 1e3], u = class {
|
|
80
83
|
opts;
|
|
81
84
|
fetchImpl;
|
|
82
85
|
sleep;
|
|
@@ -84,50 +87,59 @@ var o = /* @__PURE__ */ new Set([
|
|
|
84
87
|
this.opts = e, this.fetchImpl = e.fetchImpl ?? fetch, this.sleep = e.sleep ?? ((e) => new Promise((t) => setTimeout(t, e)));
|
|
85
88
|
}
|
|
86
89
|
async request(e, t, n = {}) {
|
|
90
|
+
return (await this.requestWithEtag(e, t, n)).data;
|
|
91
|
+
}
|
|
92
|
+
async requestWithEtag(e, t, n = {}) {
|
|
87
93
|
let r = new URL(this.opts.baseUrl + t);
|
|
88
94
|
for (let [e, t] of Object.entries(n.query ?? {})) t !== void 0 && r.searchParams.set(e, String(t));
|
|
89
|
-
let
|
|
95
|
+
let o = {
|
|
90
96
|
Authorization: `Bearer ${this.opts.token}`,
|
|
91
97
|
Accept: "application/json"
|
|
92
|
-
},
|
|
93
|
-
n.body !== void 0 && (
|
|
94
|
-
let
|
|
98
|
+
}, u;
|
|
99
|
+
n.body !== void 0 && (o["Content-Type"] = "application/json", u = JSON.stringify(n.body)), n.idempotencyKey && (o["Idempotency-Key"] = n.idempotencyKey), n.ifMatch && (o["If-Match"] = a(n.ifMatch));
|
|
100
|
+
let d = c.has(e) && !n.ifMatch || n.idempotencyKey !== void 0, f;
|
|
95
101
|
for (let t = 0;; t++) {
|
|
96
|
-
let n = t <
|
|
102
|
+
let n = t < l.length;
|
|
97
103
|
try {
|
|
98
|
-
|
|
104
|
+
f = await this.fetchImpl(r.toString(), {
|
|
99
105
|
method: e,
|
|
100
|
-
headers:
|
|
101
|
-
body:
|
|
106
|
+
headers: o,
|
|
107
|
+
body: u
|
|
102
108
|
});
|
|
103
109
|
} catch (e) {
|
|
104
|
-
if (!
|
|
105
|
-
await this.sleep(
|
|
110
|
+
if (!d || !n) throw e;
|
|
111
|
+
await this.sleep(l[t]);
|
|
106
112
|
continue;
|
|
107
113
|
}
|
|
108
|
-
if (!(
|
|
109
|
-
await
|
|
114
|
+
if (!(d ? s.has(f.status) : f.status === 503) || !n) break;
|
|
115
|
+
await f.body?.cancel(), await this.sleep(l[t]);
|
|
110
116
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
let p = f.headers.get("etag") ?? void 0;
|
|
118
|
+
if (f.status === 204) return {
|
|
119
|
+
data: void 0,
|
|
120
|
+
etag: p
|
|
121
|
+
};
|
|
122
|
+
if (!f.ok) {
|
|
123
|
+
let e;
|
|
124
|
+
try {
|
|
125
|
+
if (e = await f.json(), typeof e?.error != "string") throw Error("not an envelope");
|
|
126
|
+
} catch {
|
|
127
|
+
e = {
|
|
128
|
+
error: `http_${f.status}`,
|
|
129
|
+
message: `HTTP ${f.status} from ${r.pathname}`
|
|
130
|
+
};
|
|
123
131
|
}
|
|
124
|
-
|
|
132
|
+
throw new i(f.status, e);
|
|
125
133
|
}
|
|
134
|
+
return {
|
|
135
|
+
data: await f.json(),
|
|
136
|
+
etag: p
|
|
137
|
+
};
|
|
126
138
|
}
|
|
127
139
|
};
|
|
128
140
|
//#endregion
|
|
129
141
|
//#region src/errors.ts
|
|
130
|
-
function
|
|
142
|
+
function d(e) {
|
|
131
143
|
let t = [{
|
|
132
144
|
type: "text",
|
|
133
145
|
text: JSON.stringify(e, null, 2)
|
|
@@ -137,10 +149,10 @@ function u(e) {
|
|
|
137
149
|
structuredContent: e
|
|
138
150
|
} : { content: t };
|
|
139
151
|
}
|
|
140
|
-
function
|
|
152
|
+
function f(e) {
|
|
141
153
|
if (e instanceof i) {
|
|
142
154
|
let t = e.envelope, n = [`Featureflip API error ${e.status} (${t.error}): ${t.message}`];
|
|
143
|
-
return t.fields && n.push(`Field errors: ${JSON.stringify(t.fields)}`), t.did_you_mean?.length && n.push(`Did you mean: ${t.did_you_mean.join(", ")}`), t.next_actions?.length && n.push(`Next actions: ${t.next_actions.map((e) => `${e.method} ${e.path}`).join("; ")}`), t.retry_after != null && n.push(`Rate limited — retry after ${t.retry_after}s.`), e.status === 404 && n.push("Note: 404 can also mean the public Management API is not enabled for this organization yet, or a service token does not include this project."), t.docs_url && n.push(`Docs: ${t.docs_url}`), {
|
|
155
|
+
return t.fields && n.push(`Field errors: ${JSON.stringify(t.fields)}`), t.did_you_mean?.length && n.push(`Did you mean: ${t.did_you_mean.join(", ")}`), t.next_actions?.length && n.push(`Next actions: ${t.next_actions.map((e) => `${e.method} ${e.path}`).join("; ")}`), t.retry_after != null && n.push(`Rate limited — retry after ${t.retry_after}s.`), e.status === 404 && n.push("Note: 404 can also mean the public Management API is not enabled for this organization yet, or a service token does not include this project."), e.status === 412 && n.push("The resource changed since it was read. If you passed ifMatch, re-read it (get_flag / get_targeting / get_segment), re-apply your change to what you read, and retry with the new etag. Otherwise the tool read it itself and lost a race: call it again."), t.docs_url && n.push(`Docs: ${t.docs_url}`), {
|
|
144
156
|
content: [{
|
|
145
157
|
type: "text",
|
|
146
158
|
text: n.join("\n")
|
|
@@ -156,14 +168,14 @@ function d(e) {
|
|
|
156
168
|
isError: !0
|
|
157
169
|
};
|
|
158
170
|
}
|
|
159
|
-
async function
|
|
171
|
+
async function p(e) {
|
|
160
172
|
try {
|
|
161
173
|
return await e();
|
|
162
174
|
} catch (e) {
|
|
163
|
-
return
|
|
175
|
+
return f(e);
|
|
164
176
|
}
|
|
165
177
|
}
|
|
166
|
-
var
|
|
178
|
+
var m = {
|
|
167
179
|
endpoints: {
|
|
168
180
|
"POST /api/v1/orgs/{org}/projects/{project}/environments": "PublicEnvironmentResponse",
|
|
169
181
|
"GET /api/v1/orgs/{org}/projects/{project}/environments": "PublicEnvironmentResponsePagedResult",
|
|
@@ -197,45 +209,45 @@ var p = {
|
|
|
197
209
|
"POST /api/v1/orgs/{org}/webhooks/{id}/test": "PublicTestWebhookSubscriptionResponse",
|
|
198
210
|
"GET /api/v1/orgs/{org}/webhooks/{id}/deliveries": "PublicWebhookDeliveryResponsePagedResult"
|
|
199
211
|
},
|
|
200
|
-
$defs: /* @__PURE__ */ JSON.parse("{\"ActionCapability\":{\"type\":[\"object\",\"null\"],\"properties\":{\"allowed\":{\"type\":[\"boolean\",\"null\"]},\"reason\":{\"type\":[\"string\",\"null\"]}},\"description\":\"One entry in a resource's `_actions` block: may the caller perform it, and if not, why.\"},\"MeResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"type\":{\"type\":[\"string\",\"null\"]},\"id\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"email\":{\"type\":[\"string\",\"null\"]},\"emailVerified\":{\"type\":[\"boolean\",\"null\"]},\"organizationId\":{\"type\":[\"string\",\"null\"]},\"role\":{\"type\":[\"string\",\"null\"]},\"projectScope\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"description\":\"The authenticated caller's identity, returned by `GET /api/v1/me`. The public API\\nauthenticates two kinds of principal, so this is a `type`-discriminated shape.\\nA `\\\"user\\\"` caller (a session/JWT user or a personal access token, `ffp_...`) carries\\n`email` + `emailVerified`. A `\\\"service_token\\\"` caller (`ffs_...`) has no\\nbacking user row, so it carries `organizationId` + `role` + `projectScope` (the\\ntoken's org, its role in that org, and its project allowlist) instead. The type-inapplicable\\nfields are omitted from the response body. `projectScope` is omitted for an unrestricted\\nservice token (access to every project), never an empty list.\"},\"NextAction\":{\"type\":[\"object\",\"null\"],\"properties\":{\"method\":{\"type\":[\"string\",\"null\"]},\"path\":{\"type\":[\"string\",\"null\"]}}},\"OrganizationResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"slug\":{\"type\":[\"string\",\"null\"]},\"plan\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Solo, Team, Pro, Business, Enterprise.\"},\"isActive\":{\"type\":[\"boolean\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Public representation of an organization, returned by both `GET /api/v1/orgs` (list) and\\n`GET /api/v1/orgs/{org}` (detail). Drops dashboard-only fields (`BillingEmail` is\\nbilling-contact PII, `UpdatedAt` is dashboard audit trivia) from the dashboard's\\nOrganizationDto/OrganizationListItemDto.\"},\"OrganizationResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/OrganizationResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"ProjectResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"defaultFlagLifetimeDays\":{\"type\":[\"integer\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of a project, returned by `GET /api/v1/orgs/{org}/projects` (list),\\n`GET .../projects/{project}` (detail), and the body of a successful create/update. Drops\\nthe dashboard-only nested `Environments` collection from ProjectDto — the\\npublic API surfaces environments via their own endpoint (Task 6), not embedded here.\\nUpdatedAt is only populated from ProjectDto (the detail/create\\nshape); ProjectListItemDto doesn't carry it, so list rows leave it `null`.\\nDefaultFlagLifetimeDays is the project's default flag lifetime in days, or null (#3194).\"},\"ProjectResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/ProjectResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicAddVariationRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"value\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for\\n`POST /api/v1/orgs/{org}/projects/{project}/flags/{flag}/variations`. Named distinctly\\nfrom the dashboard's own `AddVariationRequest` —\\nsee PublicCreateEnvironmentRequest for the schemaId-collision rationale (both\\ncontrollers share one Swagger document).\"},\"PublicApiErrorEnvelope\":{\"type\":[\"object\",\"null\"],\"properties\":{\"error\":{\"type\":[\"string\",\"null\"]},\"message\":{\"type\":[\"string\",\"null\"]},\"docs_url\":{\"type\":[\"string\",\"null\"]},\"fields\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"retry_after\":{\"type\":[\"integer\",\"null\"]},\"did_you_mean\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"next_actions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/NextAction\"},{\"type\":\"null\"}]}},\"connection_id\":{\"type\":[\"string\",\"null\"]}},\"description\":\"The frozen public-API error contract. `error` codes are stable snake_case strings. Wire keys\\nare frozen snake_case too (`error`, `message`, `docs_url`, `fields`,\\n`retry_after`) — the global camelCase naming policy would otherwise emit\\n`docsUrl`/`retryAfter`, breaking the published spec. !:JsonPropertyName\\nalways wins over the policy, so these are pinned explicitly rather than relying on the\\nproperty names already being lowercase for the single-word ones.\\n`did_you_mean`, `next_actions` and `connection_id` are ADDITIVE optional keys\\n(null → omitted via the global `DefaultIgnoreCondition = WhenWritingNull`), so\\npre-existing error bodies are byte-for-byte unchanged when they're absent.\\n\\n`connection_id` is present only on the `sso_required` error: the organization\\nrequires single sign-on, and this credential didn't come through its identity provider.\\n`connection_id` identifies which SSO connection to sign in with.\"},\"PublicConditionGroupRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: And, Or.\"},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionRequest\"},{\"type\":\"null\"}]}}},\"description\":\"Request-side condition group, symmetric with PublicConditionGroupResponse.\"},\"PublicConditionGroupResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: And, Or.\"},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionResponse\"},{\"type\":\"null\"}]}}},\"description\":\"A condition group within a PublicTargetingRuleResponse. Maps 1:1 onto\\nConditionGroupDto. Operator is a bare wire string naming one of\\nthe `ConditionGroupOperator` members (`\\\"And\\\"`/`\\\"Or\\\"`) —\\ngroups are ANDed together at the rule level; within a group, its conditions combine using\\nthis operator.\"},\"PublicConditionRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"attribute\":{\"type\":[\"string\",\"null\"]},\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Equals, NotEquals, Contains, NotContains, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, In, NotIn, MatchesRegex, StartsWith, EndsWith, Before, After, SemverEquals, SemverGreaterThan, SemverGreaterThanOrEqual, SemverLessThan, SemverLessThanOrEqual.\"},\"values\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"negate\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Request-side condition, symmetric with PublicConditionResponse.\"},\"PublicConditionResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"attribute\":{\"type\":[\"string\",\"null\"]},\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Equals, NotEquals, Contains, NotContains, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, In, NotIn, MatchesRegex, StartsWith, EndsWith, Before, After, SemverEquals, SemverGreaterThan, SemverGreaterThanOrEqual, SemverLessThan, SemverLessThanOrEqual.\"},\"values\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"negate\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"A single condition within a PublicConditionGroupResponse. Maps 1:1 onto\\nConditionDto. Operator is a bare wire string naming one of the\\n`OperatorType` members (e.g. `\\\"Equals\\\"`, `\\\"In\\\"`).\"},\"PublicCreateEnvironmentRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"color\":{\"type\":[\"string\",\"null\"]},\"sortOrder\":{\"type\":[\"integer\",\"null\"]}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects/{project}/environments`. Named\\ndistinctly from the dashboard's own `CreateEnvironmentRequest`\\n— both controllers share one Swagger document (see `Program.cs`'s `AddSwaggerGen``DocInclusionPredicate` override), and Swashbuckle's default schemaId is the bare type\\nname, so an identical name in either namespace throws a schemaId collision at\\n`--export-openapi` time.\"},\"PublicCreateFeatureFlagRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Boolean, String, Number, Json.\"},\"description\":{\"type\":[\"string\",\"null\"]},\"tags\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"initialVariations\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicCreateVariationDto\"},{\"type\":\"null\"}]}},\"clientSideVisible\":{\"type\":[\"boolean\",\"null\"]},\"expiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"ownerEmail\":{\"type\":[\"string\",\"null\"]},\"isPermanent\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects/{project}/flags`. Named distinctly\\nfrom the dashboard's own `CreateFeatureFlagRequest`\\n— see PublicCreateEnvironmentRequest for the\\nschemaId-collision rationale (both controllers share one Swagger document). Type\\nis passed through verbatim to Type, which itself takes a\\nbare string (Boolean/String/Number/Json) rather than the domain enum — invalid values surface\\nas the handler's own validation failure, not a controller-level 400. ExpiresAtUtc is\\noptional and advisory; a bare date (`2026-12-01`) means the end of that day in UTC, and a full\\ntimestamp is stored exactly. It must be in the future and requires the flag-expiration feature\\n(400 `EXPIRY_IN_PAST` / `FEATURE_NOT_ENABLED`). OwnerEmail optionally names\\nthe owner (an active member, matched case-insensitively; requires the flag-ownership feature —\\n400 `OWNER_NOT_MEMBER` / `FEATURE_NOT_ENABLED`). Omitted, the owner is the caller when\\nthe caller is a member, so a service token creates an unowned flag. IsPermanent marks\\nthe flag permanent (a kill switch, ops toggle or entitlement that is meant to stay; never reported for\\ncleanup). It requires the flag-permanence feature and can't be combined with ExpiresAtUtc\\n(400 `FEATURE_NOT_ENABLED` / `PERMANENT_FLAG_HAS_EXPIRY`).\"},\"PublicCreateProjectRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects`. Named distinctly from the\\ndashboard's own `CreateProjectRequest` — both\\ncontrollers share one Swagger document (see `Program.cs`'s `AddSwaggerGen``DocInclusionPredicate` override), and Swashbuckle's default schemaId is the bare type\\nname, so an identical name in either namespace throws a schemaId collision at\\n`--export-openapi` time.\"},\"PublicCreateSdkKeyRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: ClientSide, ServerSide.\"}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects/{project}/environments/{env}/sdk-keys`.\\nType is a bare string (\\\"ClientSide\\\" or \\\"ServerSide\\\") — the controller parses it\\nagainst a NAME allowlist (not a bare TryParse``1(ReadOnlySpan{Char},Boolean,``0@), which would\\nsilently accept a numeric string like `\\\"0\\\"`) before dispatching. Named distinctly from\\nthe dashboard's own `CreateSdkKeyRequest` — both\\ncontrollers share one Swagger document, and an identical type name in either namespace throws\\na schemaId collision at `--export-openapi` time.\"},\"PublicCreateSdkKeyResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"lastFourCharacters\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: ClientSide, ServerSide.\"},\"name\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"warning\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Response body for a successful `POST .../sdk-keys`. The ONLY place the plaintext\\nKey is ever returned — PublicSdkKeyResponse (list/get) carries just\\n`LastFourCharacters`. Built directly from CreateSdkKeyResult rather than a\\nre-fetch (unlike `FeatureFlagsController.Create`'s re-fetch pattern) because the\\nplaintext key only ever exists on the create result — a subsequent\\nGetSdkKeyQuery can't recover it.\"},\"PublicCreateSegmentRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSegmentConditionDto\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects/{project}/segments`. Named distinctly\\nfrom the dashboard's own `CreateUserSegmentRequest` — see\\nPublicCreateEnvironmentRequest for the schemaId-collision rationale (both\\ncontrollers share one Swagger document).\"},\"PublicCreateTargetingRuleRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"description\":{\"type\":[\"string\",\"null\"]},\"variationId\":{\"type\":[\"string\",\"null\"]},\"rolloutPercentage\":{\"type\":[\"integer\",\"null\"]},\"userSegmentId\":{\"type\":[\"string\",\"null\"]},\"conditionGroups\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionGroupRequest\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `POST .../rules`. The Application-side\\n`CreateTargetingRuleDto`/`CreateConditionGroupDto`/`CreateConditionDto` all take\\ntheir `Operator` as a bare string, re-parsed CASE-SENSITIVELY inside\\n`CreateTargetingRuleCommandHandler` — `FlagTargetingController`'s mapping helpers\\nvalidate every operator against the enum's member-name allowlist AND canonicalize the casing\\n(e.g. `\\\"in\\\"` → `\\\"In\\\"`) before building the command DTO, so a valid\\ncase-insensitive match never trips the handler's strict re-parse.\"},\"PublicCreateVariationDto\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"value\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A variation supplied at flag-creation time. Maps 1:1 onto\\nCreateVariationDto.\"},\"PublicCreateWebhookSubscriptionRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"url\":{\"type\":[\"string\",\"null\"]},\"provider\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: GenericHttp.\"},\"eventTypes\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"projectIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"environmentIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"description\":\"Creates a webhook subscription. `provider` is `GenericHttp`. Omit `eventTypes`,\\n`projectIds` or `environmentIds` (or send an empty list) to receive every event,\\nproject or environment. A token restricted to specific projects must list at least one project,\\nall of them within its allowlist.\"},\"PublicCreateWebhookSubscriptionResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"secret\":{\"type\":[\"string\",\"null\"]},\"warning\":{\"type\":[\"string\",\"null\"]}},\"description\":\"The created subscription's id and its signing secret. The secret is shown only here.\"},\"PublicDefaultFlagLifetimeImpact\":{\"type\":[\"object\",\"null\"],\"properties\":{\"newlyPastExpiry\":{\"type\":[\"integer\",\"null\"]},\"noLongerPastExpiry\":{\"type\":[\"integer\",\"null\"]}},\"description\":\"Response of `GET .../default-flag-lifetime/impact`: how many temporary flags with no expiry\\ndate of their own would newly be past expiry, and how many would stop being past it.\"},\"PublicEnvironmentResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"color\":{\"type\":[\"string\",\"null\"]},\"sortOrder\":{\"type\":[\"integer\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of an environment, returned by\\n`GET /api/v1/orgs/{org}/projects/{project}/environments` (list),\\n`GET .../environments/{env}` (detail), and the body of a successful create/update. Drops\\ninternal fields (e.g. `ProjectId` is implicit in the route) — mirrors\\n`ProjectResponse`'s minimal shape. Named `PublicEnvironmentResponse` rather than\\n`EnvironmentResponse` (unlike the sibling `ProjectResponse`, which didn't collide)\\nbecause the dashboard already has its own\\n`EnvironmentResponse` — see\\nPublicCreateEnvironmentRequest for the schemaId-collision rationale.\"},\"PublicEnvironmentResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicEnvironmentResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicFlagEnvConfigResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"environmentId\":{\"type\":[\"string\",\"null\"]},\"environmentKey\":{\"type\":[\"string\",\"null\"]},\"isEnabled\":{\"type\":[\"boolean\",\"null\"]},\"defaultVariationId\":{\"type\":[\"string\",\"null\"]},\"strategy\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: SingleVariation, PercentageRollout, TargetedRollout.\"},\"prerequisites\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicPrerequisiteDto\"},{\"type\":\"null\"}]}},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of a flag's config within a single environment, returned by\\n`GET .../flags/{flag}/environments` and `GET .../flags/{flag}/environments/{env}`.\\nDrops internal/dashboard-only fields present on FlagEnvironmentConfigurationDto\\n— Id (an internal row id, not part of the public\\ncontract; EnvironmentId is the addressable key), `FeatureFlagId` (implicit\\nin the route), the environment's name/color/sort-order (dashboard display fields — the public\\ncontract only needs the addressable EnvironmentKey), and `Staleness` (an\\ninternal analytics signal).\"},\"PublicFlagListItem\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Boolean, String, Number, Json.\"},\"isArchived\":{\"type\":[\"boolean\",\"null\"]},\"clientSideVisible\":{\"type\":[\"boolean\",\"null\"]},\"tags\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"expiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"owner\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicFlagOwner\"},{\"type\":\"null\"}]},\"removalPrUrl\":{\"type\":[\"string\",\"null\"]},\"isPermanent\":{\"type\":[\"boolean\",\"null\"]},\"effectiveExpiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"expirySource\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Public list-item representation of a feature flag, returned by\\n`GET .../flags`. Narrower than PublicFlagResponse — drops\\nVariations (a summary-only shape upstream) and\\nStaleness, matching the \\\"list is narrower than detail\\\"\\nsplit already present on the Application-layer DTOs.\\nEffectiveExpiresAtUtc is when the flag counts as past expiry, from its own ExpiresAtUtc\\nor its project's default lifetime; ExpirySource says which (`explicit` / `project-default`),\\nboth null when neither applies.\"},\"PublicFlagListItemPagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicFlagListItem\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicFlagOwner\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"email\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A flag's owner as returned on flag reads. Null means the flag is unowned.\"},\"PublicFlagRemovalCandidate\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"reason\":{\"type\":[\"string\",\"null\"]},\"treatment\":{\"type\":[\"boolean\",\"null\"]},\"status\":{\"type\":[\"string\",\"null\"]},\"blockedBy\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"description\":\"One dead flag the Featureflip Flag Cleanup Action should remove, returned by\\n`GET .../flags/removal-candidates`. `Treatment` is the kill decision: true → keep the\\nflag's on-branch, false → keep the off-branch. `Status` is the flag's staleness tier\\n(`\\\"Stale\\\"` or `\\\"Dead\\\"`, never `\\\"Active\\\"`) — lets a caller distinguish the two when\\n`?staleness=stale` widens the response to include both tiers. This is the ONLY public\\nprojection of staleness — PublicFlagResponse and PublicFlagListItem\\nstill omit it by design. `BlockedBy` names the live flags that still list this one as a\\nprerequisite, sorted by key; while it is non-empty the flag cannot be archived\\n(`FLAG_HAS_DEPENDENTS`), so a caller should remove those dependents first.\"},\"PublicFlagRemovalCandidatePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicFlagRemovalCandidate\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicFlagResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Boolean, String, Number, Json.\"},\"isArchived\":{\"type\":[\"boolean\",\"null\"]},\"clientSideVisible\":{\"type\":[\"boolean\",\"null\"]},\"tags\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"variations\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicVariationResponse\"},{\"type\":\"null\"}]}},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"expiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"owner\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicFlagOwner\"},{\"type\":\"null\"}]},\"removalPrUrl\":{\"type\":[\"string\",\"null\"]},\"isPermanent\":{\"type\":[\"boolean\",\"null\"]},\"effectiveExpiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"expirySource\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public detail representation of a feature flag, returned by\\n`GET .../flags/{flag}` and the body of a successful create. Drops internal/dashboard-only\\nfields present on FeatureFlagDto — notably `ProjectId` (implicit in the\\nroute) and `Staleness` (an internal analytics signal, not part of the public contract).\\nEffectiveExpiresAtUtc is when the flag counts as past expiry, from its own ExpiresAtUtc\\nor its project's default lifetime; ExpirySource says which (`explicit` / `project-default`),\\nboth null when neither applies.\"},\"PublicPrerequisiteDto\":{\"type\":[\"object\",\"null\"],\"properties\":{\"prerequisiteFlagKey\":{\"type\":[\"string\",\"null\"]},\"expectedVariationKey\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A single prerequisite entry on a flag's per-environment config. Maps 1:1 onto\\nPrerequisiteDto (read side) and PrerequisiteInput (write side).\"},\"PublicPutTargetingRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"rules\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicCreateTargetingRuleRequest\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `PUT .../targeting` — a declarative full replace of the environment's\\nordered targeting rule set. Rules are applied in array order (index = priority, so the array\\norder IS the evaluation order). Rules is nullable so that an OMITTED `rules`\\nfield (a body of `{}`) binds successfully instead of failing ASP.NET Core's implicit\\nrequired-property check on non-nullable reference types — both an omitted `rules` field\\nand an explicit empty list (`{ \\\"rules\\\": [] }`) clear all targeting rules for the\\nenvironment. Each element is a PublicCreateTargetingRuleRequest (identical to the\\n`POST .../rules` body), so `UserSegmentId` is supported — segment-scoped rules can be\\nsubmitted through this endpoint. The replace is atomic (all-or-nothing): the whole rule set is\\nswapped in one transaction, or nothing changes.\"},\"PublicReorderRulesRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"ruleIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"description\":\"Request body for `PUT .../rules/reorder`. Must include every existing rule id exactly\\nonce — `ReorderTargetingRulesCommandHandler` rejects duplicate, omitted, or unknown rule\\nids with `BadRequestException`, surfaced as an HTTP 400 `bad_request` envelope\\ncarrying the handler's message.\"},\"PublicRotateWebhookSecretResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"secretId\":{\"type\":[\"string\",\"null\"]},\"secret\":{\"type\":[\"string\",\"null\"]},\"warning\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A newly added signing secret. The secret is shown only here.\"},\"PublicSdkKeyResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: ClientSide, ServerSide.\"},\"lastFourCharacters\":{\"type\":[\"string\",\"null\"]},\"isActive\":{\"type\":[\"boolean\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"lastUsedAt\":{\"type\":[\"string\",\"null\"]},\"revokedAt\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of an SDK key, returned by\\n`GET /api/v1/orgs/{org}/projects/{project}/environments/{env}/sdk-keys` (list) and\\n`GET .../sdk-keys/{sdkKey}` (detail). Deliberately narrower than\\nSdkKeyDto — drops `RevokedBy` (an internal user id) and\\n`EnvironmentId` (implicit in the route), and carries no plaintext key field: only\\nLastFourCharacters is ever exposed once the key has been created. The plaintext\\nkey is a one-time value that appears solely in PublicCreateSdkKeyResponse.\"},\"PublicSdkKeyResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSdkKeyResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicSegmentConditionDto\":{\"type\":[\"object\",\"null\"],\"properties\":{\"attribute\":{\"type\":[\"string\",\"null\"]},\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Equals, NotEquals, Contains, NotContains, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, In, NotIn, MatchesRegex, StartsWith, EndsWith, Before, After, SemverEquals, SemverGreaterThan, SemverGreaterThanOrEqual, SemverLessThan, SemverLessThanOrEqual.\"},\"values\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"negate\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"A single targeting condition on a segment, used both as input (create/update) and output\\n(Conditions). Operator is a bare string on\\nboth sides of the wire — on write it's parsed to\\nOperatorType by `SegmentsController` (an unknown\\nvalue fails closed with a 400, never silently dropped or defaulted); on read it's mapped\\nstraight through from Operator, which is already a string.\"},\"PublicSegmentResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSegmentConditionDto\"},{\"type\":\"null\"}]}},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of a user segment, returned by `GET .../segments`,\\n`GET .../segments/{segment}`, and the body of a successful create.\"},\"PublicSegmentResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSegmentResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicSetDefaultFlagLifetimeRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"days\":{\"type\":[\"integer\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/default-flag-lifetime`. `days`\\nis 1–3650; null (or an empty body) removes the default.\"},\"PublicSetFlagExpiryRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"expiresAtUtc\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/expiry`. Expiry is a\\ndedicated sub-resource, deliberately NOT a field on PublicUpdateFeatureFlagRequest: that\\nPUT is a full replace, so a new nullable field there would let any client that doesn't know about\\nexpiry (the Terraform provider included) wipe it on every update. A bare date means the end of that\\nUTC day; a full timestamp is stored exactly.\"},\"PublicSetFlagOwnerRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"email\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/owner`. A dedicated\\nsub-resource for the same reason as expiry: the main flag PUT is a full replace, so an owner field\\nthere would let every client that doesn't know about owners wipe one. `email` must belong\\nto an active member of the organization (case-insensitive).\"},\"PublicSetFlagRemovalPrRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"url\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/removal-pr`: the\\npull request that removes this flag from code, as opened by the Featureflip Flag Cleanup Action.\\nA dedicated sub-resource for the same reason as expiry and owner. `url` must be an https\\npull request URL (`https://{host}/{owner}/{repo}/pull/{number}`).\"},\"PublicTargetingConfigResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"isEnabled\":{\"type\":[\"boolean\",\"null\"]},\"rules\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicTargetingRuleResponse\"},{\"type\":\"null\"}]}},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"The full targeting configuration for a flag in a single environment, returned by\\n`GET .../targeting`. Maps 1:1 onto TargetingConfigurationDto — including\\nits IsEnabled field, which reflects the parent\\n`FlagEnvironmentConfiguration.IsEnabled` (whether the flag is on in this environment at\\nall), not anything specific to targeting itself.\"},\"PublicTargetingRuleResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"priority\":{\"type\":[\"integer\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"variationId\":{\"type\":[\"string\",\"null\"]},\"rolloutPercentage\":{\"type\":[\"integer\",\"null\"]},\"userSegmentId\":{\"type\":[\"string\",\"null\"]},\"conditionGroups\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionGroupResponse\"},{\"type\":\"null\"}]}},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A single targeting rule, returned by `GET .../rules/{ruleId}`,\\n`POST .../rules` (201 body), and nested within PublicTargetingConfigResponse.\\nMaps 1:1 onto TargetingRuleDto, dropping nothing — every field on the\\nApplication DTO is part of the public contract.\"},\"PublicTestWebhookSubscriptionResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"webhookEventId\":{\"type\":[\"string\",\"null\"]},\"webhookDeliveryId\":{\"type\":[\"string\",\"null\"]}},\"description\":\"The queued test event and its delivery. Poll the delivery log for the outcome.\"},\"PublicToggleFlagRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"enabled\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Request body for `POST .../flags/{flag}/environments/{env}/toggle`. Named distinctly from\\nthe dashboard's own `ToggleFlagInEnvironmentRequest`\\n(which uses `IsEnabled`) — the public field is named Enabled per the phase-3c\\ncontract. Enabled is a NULLABLE `bool?` deliberately: a non-nullable value\\ntype would bind an omitted/empty body to `false` with no validation error (ASP.NET's\\nimplicit-required only covers non-nullable reference types, not value types), silently disabling\\nthe flag. The controller rejects a null Enabled with a `validation_failed` 400\\nso the intent is never ambiguous (#1806).\"},\"PublicUpdateEnvironmentRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"color\":{\"type\":[\"string\",\"null\"]},\"sortOrder\":{\"type\":[\"integer\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/environments/{env}`. See\\nPublicCreateEnvironmentRequest for why this is named distinctly from the\\ndashboard's `UpdateEnvironmentRequest`.\"},\"PublicUpdateFeatureFlagRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"tags\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"clientSideVisible\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}`. See\\nPublicCreateFeatureFlagRequest for why this is named distinctly from the\\ndashboard's `UpdateFeatureFlagRequest`. The flag's key and type are immutable via this\\nendpoint (mirrors `UpdateFeatureFlagCommand`, which has no `Key`/`Type`).\"},\"PublicUpdateFlagEnvConfigRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"defaultVariationId\":{\"type\":[\"string\",\"null\"]},\"strategy\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: SingleVariation, PercentageRollout, TargetedRollout.\"},\"prerequisites\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicPrerequisiteDto\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `PUT .../flags/{flag}/environments/{env}`. Named distinctly from the\\ndashboard's own `UpdateFlagEnvironmentConfigurationRequest`\\n— see PublicCreateEnvironmentRequest for the schemaId-collision rationale (both\\ncontrollers share one Swagger document). Strategy is passed through verbatim to\\nStrategy\\n— the existing command validator name-allowlists it (SingleVariation/PercentageRollout/\\nTargetedRollout or null), so an invalid value surfaces as the handler's own 400, not a\\ncontroller-level guard. A null Prerequisites leaves prerequisites untouched; a\\nnon-null list replaces them wholesale (mirrors UpdateFlagPrerequisitesCommand's\\nreplace-all semantics).\"},\"PublicUpdateProjectRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}`. See\\nPublicCreateProjectRequest for why this is named distinctly from the\\ndashboard's `UpdateProjectRequest`.\"},\"PublicUpdateSdkKeyRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/environments/{env}/sdk-keys/{sdkKey}`.\\nType and key material are immutable via this endpoint (mirrors\\nUpdateSdkKeyCommand, which\\ncarries no `Type`).\"},\"PublicUpdateSegmentRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSegmentConditionDto\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/segments/{segment}`. The\\nsegment's key is immutable via this endpoint (mirrors `UpdateUserSegmentCommand`, which\\ncarries no `Key`).\"},\"PublicUpdateTargetingRuleRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"description\":{\"type\":[\"string\",\"null\"]},\"variationId\":{\"type\":[\"string\",\"null\"]},\"rolloutPercentage\":{\"type\":[\"integer\",\"null\"]},\"userSegmentId\":{\"type\":[\"string\",\"null\"]},\"conditionGroups\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionGroupRequest\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `PUT .../rules/{ruleId}`. Same shape as\\nPublicCreateTargetingRuleRequest — see its remarks on operator\\nvalidation/canonicalization, which applies identically here.\"},\"PublicUpdateVariationRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"value\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for\\n`PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/variations/{variationId}`. The\\nvariation's key is immutable via this endpoint (mirrors\\n`UpdateVariationCommand`, which\\ncarries no `Key`).\"},\"PublicUpdateWebhookSubscriptionRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"url\":{\"type\":[\"string\",\"null\"]},\"eventTypes\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"projectIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"environmentIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"isEnabled\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Replaces a subscription's configuration (full replace — omitted lists become empty, meaning\\n\\\"all\\\"). `isEnabled` is required. The provider cannot be changed.\"},\"PublicVariationResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"value\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A single variation on a flag, as returned in Variations.\"},\"PublicWebhookDeliveryResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"webhookEventId\":{\"type\":[\"string\",\"null\"]},\"status\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Pending, Succeeded, DeadLettered.\"},\"attemptCount\":{\"type\":[\"integer\",\"null\"]},\"nextAttemptAt\":{\"type\":[\"string\",\"null\"]},\"lastResponseStatusCode\":{\"type\":[\"integer\",\"null\"]},\"lastError\":{\"type\":[\"string\",\"null\"]},\"completedAt\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]}},\"description\":\"One delivery attempt record. `status` is `Pending` (awaiting its first attempt,\\nbacking off, or in flight), `Succeeded` or `DeadLettered`.\"},\"PublicWebhookDeliveryResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicWebhookDeliveryResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicWebhookSecretResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"retiredAt\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A signing secret's id and lifecycle. A secret with no `retiredAt` is active and signs every delivery.\"},\"PublicWebhookSubscriptionResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"url\":{\"type\":[\"string\",\"null\"]},\"provider\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: GenericHttp.\"},\"isEnabled\":{\"type\":[\"boolean\",\"null\"]},\"eventTypes\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"projectIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"environmentIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"consecutiveFailureCount\":{\"type\":[\"integer\",\"null\"]},\"autoDisabledAt\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"secrets\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicWebhookSecretResponse\"},{\"type\":\"null\"}]}},\"overPlanLimit\":{\"type\":[\"boolean\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A webhook subscription. Never carries secret material: signing secrets are listed by id and\\nlifecycle only — the value itself is returned once, when it is created or rotated.\\n`overPlanLimit` is true when the organization has more subscriptions than its plan\\nallows, which happens after a downgrade. The oldest subscriptions up to the limit keep\\ndelivering. The rest receive nothing and cannot be re-enabled, tested or redelivered to until\\nthe plan is upgraded or older subscriptions are deleted.\"},\"PublicWebhookSubscriptionResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicWebhookSubscriptionResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"}}")
|
|
201
|
-
},
|
|
202
|
-
function
|
|
203
|
-
if (!
|
|
212
|
+
$defs: /* @__PURE__ */ JSON.parse("{\"ActionCapability\":{\"type\":[\"object\",\"null\"],\"properties\":{\"allowed\":{\"type\":[\"boolean\",\"null\"]},\"reason\":{\"type\":[\"string\",\"null\"]}},\"description\":\"One entry in a resource's `_actions` block: may the caller perform it, and if not, why.\"},\"MeResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"type\":{\"type\":[\"string\",\"null\"]},\"id\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"email\":{\"type\":[\"string\",\"null\"]},\"emailVerified\":{\"type\":[\"boolean\",\"null\"]},\"organizationId\":{\"type\":[\"string\",\"null\"]},\"role\":{\"type\":[\"string\",\"null\"]},\"projectScope\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"description\":\"The authenticated caller's identity, returned by `GET /api/v1/me`. The public API\\nauthenticates two kinds of principal, so this is a `type`-discriminated shape.\\nA `\\\"user\\\"` caller (a session/JWT user or a personal access token, `ffp_...`) carries\\n`email` + `emailVerified`. A `\\\"service_token\\\"` caller (`ffs_...`) has no\\nbacking user row, so it carries `organizationId` + `role` + `projectScope` (the\\ntoken's org, its role in that org, and its project allowlist) instead. The type-inapplicable\\nfields are omitted from the response body. `projectScope` is omitted for an unrestricted\\nservice token (access to every project), never an empty list.\"},\"NextAction\":{\"type\":[\"object\",\"null\"],\"properties\":{\"method\":{\"type\":[\"string\",\"null\"]},\"path\":{\"type\":[\"string\",\"null\"]}}},\"OrganizationResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"slug\":{\"type\":[\"string\",\"null\"]},\"plan\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Solo, Team, Pro, Business, Enterprise.\"},\"isActive\":{\"type\":[\"boolean\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Public representation of an organization, returned by both `GET /api/v1/orgs` (list) and\\n`GET /api/v1/orgs/{org}` (detail). Drops dashboard-only fields (`BillingEmail` is\\nbilling-contact PII, `UpdatedAt` is dashboard audit trivia) from the dashboard's\\nOrganizationDto/OrganizationListItemDto.\"},\"OrganizationResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/OrganizationResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"ProjectResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"defaultFlagLifetimeDays\":{\"type\":[\"integer\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of a project, returned by `GET /api/v1/orgs/{org}/projects` (list),\\n`GET .../projects/{project}` (detail), and the body of a successful create/update. Drops\\nthe dashboard-only nested `Environments` collection from ProjectDto — the\\npublic API surfaces environments via their own endpoint (Task 6), not embedded here.\\nUpdatedAt is only populated from ProjectDto (the detail/create\\nshape); ProjectListItemDto doesn't carry it, so list rows leave it `null`.\\nDefaultFlagLifetimeDays is the project's default flag lifetime in days, or null (#3194).\"},\"ProjectResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/ProjectResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicAddVariationRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"value\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for\\n`POST /api/v1/orgs/{org}/projects/{project}/flags/{flag}/variations`. Named distinctly\\nfrom the dashboard's own `AddVariationRequest` —\\nsee PublicCreateEnvironmentRequest for the schemaId-collision rationale (both\\ncontrollers share one Swagger document).\"},\"PublicApiErrorEnvelope\":{\"type\":[\"object\",\"null\"],\"properties\":{\"error\":{\"type\":[\"string\",\"null\"]},\"message\":{\"type\":[\"string\",\"null\"]},\"docs_url\":{\"type\":[\"string\",\"null\"]},\"fields\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"retry_after\":{\"type\":[\"integer\",\"null\"]},\"did_you_mean\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"next_actions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/NextAction\"},{\"type\":\"null\"}]}},\"connection_id\":{\"type\":[\"string\",\"null\"]}},\"description\":\"The frozen public-API error contract. `error` codes are stable snake_case strings. Wire keys\\nare frozen snake_case too (`error`, `message`, `docs_url`, `fields`,\\n`retry_after`) — the global camelCase naming policy would otherwise emit\\n`docsUrl`/`retryAfter`, breaking the published spec. !:JsonPropertyName\\nalways wins over the policy, so these are pinned explicitly rather than relying on the\\nproperty names already being lowercase for the single-word ones.\\n`did_you_mean`, `next_actions` and `connection_id` are ADDITIVE optional keys\\n(null → omitted via the global `DefaultIgnoreCondition = WhenWritingNull`), so\\npre-existing error bodies are byte-for-byte unchanged when they're absent.\\n\\n`connection_id` is present only on the `sso_required` error: the organization\\nrequires single sign-on, and this credential didn't come through its identity provider.\\n`connection_id` identifies which SSO connection to sign in with.\"},\"PublicConditionGroupRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: And, Or.\"},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionRequest\"},{\"type\":\"null\"}]}}},\"description\":\"Request-side condition group, symmetric with PublicConditionGroupResponse.\"},\"PublicConditionGroupResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: And, Or.\"},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionResponse\"},{\"type\":\"null\"}]}}},\"description\":\"A condition group within a PublicTargetingRuleResponse. Maps 1:1 onto\\nConditionGroupDto. Operator is a bare wire string naming one of\\nthe `ConditionGroupOperator` members (`\\\"And\\\"`/`\\\"Or\\\"`) —\\ngroups are ANDed together at the rule level; within a group, its conditions combine using\\nthis operator.\"},\"PublicConditionRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"attribute\":{\"type\":[\"string\",\"null\"]},\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Equals, NotEquals, Contains, NotContains, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, In, NotIn, MatchesRegex, StartsWith, EndsWith, Before, After, SemverEquals, SemverGreaterThan, SemverGreaterThanOrEqual, SemverLessThan, SemverLessThanOrEqual.\"},\"values\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"negate\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Request-side condition, symmetric with PublicConditionResponse.\"},\"PublicConditionResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"attribute\":{\"type\":[\"string\",\"null\"]},\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Equals, NotEquals, Contains, NotContains, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, In, NotIn, MatchesRegex, StartsWith, EndsWith, Before, After, SemverEquals, SemverGreaterThan, SemverGreaterThanOrEqual, SemverLessThan, SemverLessThanOrEqual.\"},\"values\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"negate\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"A single condition within a PublicConditionGroupResponse. Maps 1:1 onto\\nConditionDto. Operator is a bare wire string naming one of the\\n`OperatorType` members (e.g. `\\\"Equals\\\"`, `\\\"In\\\"`).\"},\"PublicCreateEnvironmentRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"color\":{\"type\":[\"string\",\"null\"]},\"sortOrder\":{\"type\":[\"integer\",\"null\"]}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects/{project}/environments`. Named\\ndistinctly from the dashboard's own `CreateEnvironmentRequest`\\n— both controllers share one Swagger document (see `Program.cs`'s `AddSwaggerGen``DocInclusionPredicate` override), and Swashbuckle's default schemaId is the bare type\\nname, so an identical name in either namespace throws a schemaId collision at\\n`--export-openapi` time.\"},\"PublicCreateFeatureFlagRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Boolean, String, Number, Json.\"},\"description\":{\"type\":[\"string\",\"null\"]},\"tags\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"initialVariations\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicCreateVariationDto\"},{\"type\":\"null\"}]}},\"clientSideVisible\":{\"type\":[\"boolean\",\"null\"]},\"expiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"ownerEmail\":{\"type\":[\"string\",\"null\"]},\"isPermanent\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects/{project}/flags`. Named distinctly\\nfrom the dashboard's own `CreateFeatureFlagRequest`\\n— see PublicCreateEnvironmentRequest for the\\nschemaId-collision rationale (both controllers share one Swagger document). Type\\nis passed through verbatim to Type, which itself takes a\\nbare string (Boolean/String/Number/Json) rather than the domain enum — invalid values surface\\nas the handler's own validation failure, not a controller-level 400. ExpiresAtUtc is\\noptional and advisory; a bare date (`2026-12-01`) means the end of that day in UTC, and a full\\ntimestamp is stored exactly. It must be in the future and requires the flag-expiration feature\\n(400 `EXPIRY_IN_PAST` / `FEATURE_NOT_ENABLED`). OwnerEmail optionally names\\nthe owner (an active member, matched case-insensitively; requires the flag-ownership feature —\\n400 `OWNER_NOT_MEMBER` / `FEATURE_NOT_ENABLED`). Omitted, the owner is the caller when\\nthe caller is a member, so a service token creates an unowned flag. IsPermanent marks\\nthe flag permanent (a kill switch, ops toggle or entitlement that is meant to stay; never reported for\\ncleanup). It requires the flag-permanence feature and can't be combined with ExpiresAtUtc\\n(400 `FEATURE_NOT_ENABLED` / `PERMANENT_FLAG_HAS_EXPIRY`).\"},\"PublicCreateProjectRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects`. Named distinctly from the\\ndashboard's own `CreateProjectRequest` — both\\ncontrollers share one Swagger document (see `Program.cs`'s `AddSwaggerGen``DocInclusionPredicate` override), and Swashbuckle's default schemaId is the bare type\\nname, so an identical name in either namespace throws a schemaId collision at\\n`--export-openapi` time.\"},\"PublicCreateSdkKeyRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: ClientSide, ServerSide.\"}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects/{project}/environments/{env}/sdk-keys`.\\nType is a bare string (\\\"ClientSide\\\" or \\\"ServerSide\\\") — the controller parses it\\nagainst a NAME allowlist (not a bare TryParse``1(ReadOnlySpan{Char},Boolean,``0@), which would\\nsilently accept a numeric string like `\\\"0\\\"`) before dispatching. Named distinctly from\\nthe dashboard's own `CreateSdkKeyRequest` — both\\ncontrollers share one Swagger document, and an identical type name in either namespace throws\\na schemaId collision at `--export-openapi` time.\"},\"PublicCreateSdkKeyResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"lastFourCharacters\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: ClientSide, ServerSide.\"},\"name\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"warning\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Response body for a successful `POST .../sdk-keys`. The ONLY place the plaintext\\nKey is ever returned — PublicSdkKeyResponse (list/get) carries just\\n`LastFourCharacters`. Built directly from CreateSdkKeyResult rather than a\\nre-fetch (unlike `FeatureFlagsController.Create`'s re-fetch pattern) because the\\nplaintext key only ever exists on the create result — a subsequent\\nGetSdkKeyQuery can't recover it.\"},\"PublicCreateSegmentRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSegmentConditionDto\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `POST /api/v1/orgs/{org}/projects/{project}/segments`. Named distinctly\\nfrom the dashboard's own `CreateUserSegmentRequest` — see\\nPublicCreateEnvironmentRequest for the schemaId-collision rationale (both\\ncontrollers share one Swagger document).\"},\"PublicCreateTargetingRuleRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"description\":{\"type\":[\"string\",\"null\"]},\"variationId\":{\"type\":[\"string\",\"null\"]},\"rolloutPercentage\":{\"type\":[\"integer\",\"null\"]},\"userSegmentId\":{\"type\":[\"string\",\"null\"]},\"conditionGroups\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionGroupRequest\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `POST .../rules`. The Application-side\\n`CreateTargetingRuleDto`/`CreateConditionGroupDto`/`CreateConditionDto` all take\\ntheir `Operator` as a bare string, re-parsed CASE-SENSITIVELY inside\\n`CreateTargetingRuleCommandHandler` — `FlagTargetingController`'s mapping helpers\\nvalidate every operator against the enum's member-name allowlist AND canonicalize the casing\\n(e.g. `\\\"in\\\"` → `\\\"In\\\"`) before building the command DTO, so a valid\\ncase-insensitive match never trips the handler's strict re-parse.\"},\"PublicCreateVariationDto\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"value\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A variation supplied at flag-creation time. Maps 1:1 onto\\nCreateVariationDto.\"},\"PublicCreateWebhookSubscriptionRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"url\":{\"type\":[\"string\",\"null\"]},\"provider\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: GenericHttp.\"},\"eventTypes\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"projectIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"environmentIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"description\":\"Creates a webhook subscription. `provider` is `GenericHttp`. Omit `eventTypes`,\\n`projectIds` or `environmentIds` (or send an empty list) to receive every event,\\nproject or environment. A token restricted to specific projects must list at least one project,\\nall of them within its allowlist.\"},\"PublicCreateWebhookSubscriptionResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"secret\":{\"type\":[\"string\",\"null\"]},\"warning\":{\"type\":[\"string\",\"null\"]}},\"description\":\"The created subscription's id and its signing secret. The secret is shown only here.\"},\"PublicDefaultFlagLifetimeImpact\":{\"type\":[\"object\",\"null\"],\"properties\":{\"newlyPastExpiry\":{\"type\":[\"integer\",\"null\"]},\"noLongerPastExpiry\":{\"type\":[\"integer\",\"null\"]}},\"description\":\"Response of `GET .../default-flag-lifetime/impact`: how many temporary flags with no expiry\\ndate of their own would newly be past expiry, and how many would stop being past it.\"},\"PublicEnvironmentResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"color\":{\"type\":[\"string\",\"null\"]},\"sortOrder\":{\"type\":[\"integer\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of an environment, returned by\\n`GET /api/v1/orgs/{org}/projects/{project}/environments` (list),\\n`GET .../environments/{env}` (detail), and the body of a successful create/update. Drops\\ninternal fields (e.g. `ProjectId` is implicit in the route) — mirrors\\n`ProjectResponse`'s minimal shape. Named `PublicEnvironmentResponse` rather than\\n`EnvironmentResponse` (unlike the sibling `ProjectResponse`, which didn't collide)\\nbecause the dashboard already has its own\\n`EnvironmentResponse` — see\\nPublicCreateEnvironmentRequest for the schemaId-collision rationale.\"},\"PublicEnvironmentResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicEnvironmentResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicFlagEnvConfigResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"environmentId\":{\"type\":[\"string\",\"null\"]},\"environmentKey\":{\"type\":[\"string\",\"null\"]},\"isEnabled\":{\"type\":[\"boolean\",\"null\"]},\"defaultVariationId\":{\"type\":[\"string\",\"null\"]},\"strategy\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: SingleVariation, PercentageRollout, TargetedRollout.\"},\"prerequisites\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicPrerequisiteDto\"},{\"type\":\"null\"}]}},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of a flag's config within a single environment, returned by\\n`GET .../flags/{flag}/environments` and `GET .../flags/{flag}/environments/{env}`.\\nDrops internal/dashboard-only fields present on FlagEnvironmentConfigurationDto\\n— Id (an internal row id, not part of the public\\ncontract; EnvironmentId is the addressable key), `FeatureFlagId` (implicit\\nin the route), the environment's name/color/sort-order (dashboard display fields — the public\\ncontract only needs the addressable EnvironmentKey), and `Staleness` (an\\ninternal analytics signal).\"},\"PublicFlagListItem\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Boolean, String, Number, Json.\"},\"isArchived\":{\"type\":[\"boolean\",\"null\"]},\"clientSideVisible\":{\"type\":[\"boolean\",\"null\"]},\"tags\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"expiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"owner\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicFlagOwner\"},{\"type\":\"null\"}]},\"removalPrUrl\":{\"type\":[\"string\",\"null\"]},\"isPermanent\":{\"type\":[\"boolean\",\"null\"]},\"effectiveExpiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"expirySource\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Public list-item representation of a feature flag, returned by\\n`GET .../flags`. Narrower than PublicFlagResponse — drops\\nVariations (a summary-only shape upstream) and\\nStaleness, matching the \\\"list is narrower than detail\\\"\\nsplit already present on the Application-layer DTOs.\\nEffectiveExpiresAtUtc is when the flag counts as past expiry, from its own ExpiresAtUtc\\nor its project's default lifetime; ExpirySource says which (`explicit` / `project-default`),\\nboth null when neither applies.\"},\"PublicFlagListItemPagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicFlagListItem\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicFlagOwner\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"email\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A flag's owner as returned on flag reads. Null means the flag is unowned.\"},\"PublicFlagRemovalCandidate\":{\"type\":[\"object\",\"null\"],\"properties\":{\"key\":{\"type\":[\"string\",\"null\"]},\"reason\":{\"type\":[\"string\",\"null\"]},\"treatment\":{\"type\":[\"boolean\",\"null\"]},\"status\":{\"type\":[\"string\",\"null\"]},\"blockedBy\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"description\":\"One dead flag the Featureflip Flag Cleanup Action should remove, returned by\\n`GET .../flags/removal-candidates`. `Treatment` is the kill decision: true → keep the\\nflag's on-branch, false → keep the off-branch. `Status` is the flag's staleness tier\\n(`\\\"Stale\\\"` or `\\\"Dead\\\"`, never `\\\"Active\\\"`) — lets a caller distinguish the two when\\n`?staleness=stale` widens the response to include both tiers. This is the ONLY public\\nprojection of staleness — PublicFlagResponse and PublicFlagListItem\\nstill omit it by design. `BlockedBy` names the live flags that still list this one as a\\nprerequisite, sorted by key; while it is non-empty the flag cannot be archived\\n(`FLAG_HAS_DEPENDENTS`), so a caller should remove those dependents first.\"},\"PublicFlagRemovalCandidatePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicFlagRemovalCandidate\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicFlagResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Boolean, String, Number, Json.\"},\"isArchived\":{\"type\":[\"boolean\",\"null\"]},\"clientSideVisible\":{\"type\":[\"boolean\",\"null\"]},\"tags\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"variations\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicVariationResponse\"},{\"type\":\"null\"}]}},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"expiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"owner\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicFlagOwner\"},{\"type\":\"null\"}]},\"removalPrUrl\":{\"type\":[\"string\",\"null\"]},\"isPermanent\":{\"type\":[\"boolean\",\"null\"]},\"effectiveExpiresAtUtc\":{\"type\":[\"string\",\"null\"]},\"expirySource\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public detail representation of a feature flag, returned by\\n`GET .../flags/{flag}` and the body of a successful create. Drops internal/dashboard-only\\nfields present on FeatureFlagDto — notably `ProjectId` (implicit in the\\nroute) and `Staleness` (an internal analytics signal, not part of the public contract).\\nEffectiveExpiresAtUtc is when the flag counts as past expiry, from its own ExpiresAtUtc\\nor its project's default lifetime; ExpirySource says which (`explicit` / `project-default`),\\nboth null when neither applies.\"},\"PublicPrerequisiteDto\":{\"type\":[\"object\",\"null\"],\"properties\":{\"prerequisiteFlagKey\":{\"type\":[\"string\",\"null\"]},\"expectedVariationKey\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A single prerequisite entry on a flag's per-environment config. Maps 1:1 onto\\nPrerequisiteDto (read side) and PrerequisiteInput (write side).\"},\"PublicPutTargetingRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"rules\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicCreateTargetingRuleRequest\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `PUT .../targeting` — a declarative full replace of the environment's\\nordered targeting rule set. Rules are applied in array order (index = priority, so the array\\norder IS the evaluation order). Rules is nullable so that an OMITTED `rules`\\nfield (a body of `{}`) binds successfully instead of failing ASP.NET Core's implicit\\nrequired-property check on non-nullable reference types — both an omitted `rules` field\\nand an explicit empty list (`{ \\\"rules\\\": [] }`) clear all targeting rules for the\\nenvironment. Each element is a PublicCreateTargetingRuleRequest (identical to the\\n`POST .../rules` body), so `UserSegmentId` is supported — segment-scoped rules can be\\nsubmitted through this endpoint. The replace is atomic (all-or-nothing): the whole rule set is\\nswapped in one transaction, or nothing changes.\"},\"PublicReorderRulesRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"ruleIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}}},\"description\":\"Request body for `PUT .../rules/reorder`. Must include every existing rule id exactly\\nonce — `ReorderTargetingRulesCommandHandler` rejects duplicate, omitted, or unknown rule\\nids with `BadRequestException`, surfaced as an HTTP 400 `bad_request` envelope\\ncarrying the handler's message.\"},\"PublicRotateWebhookSecretResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"secretId\":{\"type\":[\"string\",\"null\"]},\"secret\":{\"type\":[\"string\",\"null\"]},\"warning\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A newly added signing secret. The secret is shown only here.\"},\"PublicSdkKeyResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"type\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: ClientSide, ServerSide.\"},\"lastFourCharacters\":{\"type\":[\"string\",\"null\"]},\"isActive\":{\"type\":[\"boolean\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"lastUsedAt\":{\"type\":[\"string\",\"null\"]},\"revokedAt\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of an SDK key, returned by\\n`GET /api/v1/orgs/{org}/projects/{project}/environments/{env}/sdk-keys` (list) and\\n`GET .../sdk-keys/{sdkKey}` (detail). Deliberately narrower than\\nSdkKeyDto — drops `RevokedBy` (an internal user id) and\\n`EnvironmentId` (implicit in the route), and carries no plaintext key field: only\\nLastFourCharacters is ever exposed once the key has been created. The plaintext\\nkey is a one-time value that appears solely in PublicCreateSdkKeyResponse.\"},\"PublicSdkKeyResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSdkKeyResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicSegmentConditionDto\":{\"type\":[\"object\",\"null\"],\"properties\":{\"attribute\":{\"type\":[\"string\",\"null\"]},\"operator\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Equals, NotEquals, Contains, NotContains, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, In, NotIn, MatchesRegex, StartsWith, EndsWith, Before, After, SemverEquals, SemverGreaterThan, SemverGreaterThanOrEqual, SemverLessThan, SemverLessThanOrEqual.\"},\"values\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"negate\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"A single targeting condition on a segment, used both as input (create/update) and output\\n(Conditions). Operator is a bare string on\\nboth sides of the wire — on write it's parsed to\\nOperatorType by `SegmentsController` (an unknown\\nvalue fails closed with a 400, never silently dropped or defaulted); on read it's mapped\\nstraight through from Operator, which is already a string.\"},\"PublicSegmentResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSegmentConditionDto\"},{\"type\":\"null\"}]}},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"Public representation of a user segment, returned by `GET .../segments`,\\n`GET .../segments/{segment}`, and the body of a successful create.\"},\"PublicSegmentResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSegmentResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicSetDefaultFlagLifetimeRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"days\":{\"type\":[\"integer\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/default-flag-lifetime`. `days`\\nis 1–3650, or an explicit null to remove the default. `days` is required: a body without it\\n(`{}`, or a misspelled field) is a `validation_failed` 400, never a removal, so a typo\\ncan't silently wipe the setting (#3788). A request with no body is rejected too.\"},\"PublicSetFlagExpiryRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"expiresAtUtc\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/expiry`. Expiry is a\\ndedicated sub-resource, deliberately NOT a field on PublicUpdateFeatureFlagRequest: that\\nPUT is a full replace, so a new nullable field there would let any client that doesn't know about\\nexpiry (the Terraform provider included) wipe it on every update. A bare date means the end of that\\nUTC day; a full timestamp is stored exactly.\"},\"PublicSetFlagOwnerRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"email\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/owner`. A dedicated\\nsub-resource for the same reason as expiry: the main flag PUT is a full replace, so an owner field\\nthere would let every client that doesn't know about owners wipe one. `email` must belong\\nto an active member of the organization (case-insensitive).\"},\"PublicSetFlagRemovalPrRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"url\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/removal-pr`: the\\npull request that removes this flag from code, as opened by the Featureflip Flag Cleanup Action.\\nA dedicated sub-resource for the same reason as expiry and owner. `url` must be an https\\npull request URL (`https://{host}/{owner}/{repo}/pull/{number}`).\"},\"PublicTargetingConfigResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"isEnabled\":{\"type\":[\"boolean\",\"null\"]},\"rules\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicTargetingRuleResponse\"},{\"type\":\"null\"}]}},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"The full targeting configuration for a flag in a single environment, returned by\\n`GET .../targeting`. Maps 1:1 onto TargetingConfigurationDto — including\\nits IsEnabled field, which reflects the parent\\n`FlagEnvironmentConfiguration.IsEnabled` (whether the flag is on in this environment at\\nall), not anything specific to targeting itself.\"},\"PublicTargetingRuleResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"priority\":{\"type\":[\"integer\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"variationId\":{\"type\":[\"string\",\"null\"]},\"rolloutPercentage\":{\"type\":[\"integer\",\"null\"]},\"userSegmentId\":{\"type\":[\"string\",\"null\"]},\"conditionGroups\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionGroupResponse\"},{\"type\":\"null\"}]}},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A single targeting rule, returned by `GET .../rules/{ruleId}`,\\n`POST .../rules` (201 body), and nested within PublicTargetingConfigResponse.\\nMaps 1:1 onto TargetingRuleDto, dropping nothing — every field on the\\nApplication DTO is part of the public contract.\"},\"PublicTestWebhookSubscriptionResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"webhookEventId\":{\"type\":[\"string\",\"null\"]},\"webhookDeliveryId\":{\"type\":[\"string\",\"null\"]}},\"description\":\"The queued test event and its delivery. Poll the delivery log for the outcome.\"},\"PublicToggleFlagRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"enabled\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Request body for `POST .../flags/{flag}/environments/{env}/toggle`. Named distinctly from\\nthe dashboard's own `ToggleFlagInEnvironmentRequest`\\n(which uses `IsEnabled`) — the public field is named Enabled per the phase-3c\\ncontract. Enabled is a NULLABLE `bool?` deliberately: a non-nullable value\\ntype would bind an omitted/empty body to `false` with no validation error (ASP.NET's\\nimplicit-required only covers non-nullable reference types, not value types), silently disabling\\nthe flag. The controller rejects a null Enabled with a `validation_failed` 400\\nso the intent is never ambiguous (#1806).\"},\"PublicUpdateEnvironmentRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"color\":{\"type\":[\"string\",\"null\"]},\"sortOrder\":{\"type\":[\"integer\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/environments/{env}`. See\\nPublicCreateEnvironmentRequest for why this is named distinctly from the\\ndashboard's `UpdateEnvironmentRequest`.\"},\"PublicUpdateFeatureFlagRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"tags\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"clientSideVisible\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}`. See\\nPublicCreateFeatureFlagRequest for why this is named distinctly from the\\ndashboard's `UpdateFeatureFlagRequest`. The flag's key and type are immutable via this\\nendpoint (mirrors `UpdateFeatureFlagCommand`, which has no `Key`/`Type`).\"},\"PublicUpdateFlagEnvConfigRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"defaultVariationId\":{\"type\":[\"string\",\"null\"]},\"strategy\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: SingleVariation, PercentageRollout, TargetedRollout.\"},\"prerequisites\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicPrerequisiteDto\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `PUT .../flags/{flag}/environments/{env}`. Named distinctly from the\\ndashboard's own `UpdateFlagEnvironmentConfigurationRequest`\\n— see PublicCreateEnvironmentRequest for the schemaId-collision rationale (both\\ncontrollers share one Swagger document). Strategy is passed through verbatim to\\nStrategy\\n— the existing command validator name-allowlists it (SingleVariation/PercentageRollout/\\nTargetedRollout or null), so an invalid value surfaces as the handler's own 400, not a\\ncontroller-level guard. A null Prerequisites leaves prerequisites untouched; a\\nnon-null list replaces them wholesale (mirrors UpdateFlagPrerequisitesCommand's\\nreplace-all semantics).\"},\"PublicUpdateProjectRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}`. See\\nPublicCreateProjectRequest for why this is named distinctly from the\\ndashboard's `UpdateProjectRequest`.\"},\"PublicUpdateSdkKeyRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/environments/{env}/sdk-keys/{sdkKey}`.\\nType and key material are immutable via this endpoint (mirrors\\nUpdateSdkKeyCommand, which\\ncarries no `Type`).\"},\"PublicUpdateSegmentRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"conditions\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicSegmentConditionDto\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `PUT /api/v1/orgs/{org}/projects/{project}/segments/{segment}`. The\\nsegment's key is immutable via this endpoint (mirrors `UpdateUserSegmentCommand`, which\\ncarries no `Key`).\"},\"PublicUpdateTargetingRuleRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"description\":{\"type\":[\"string\",\"null\"]},\"variationId\":{\"type\":[\"string\",\"null\"]},\"rolloutPercentage\":{\"type\":[\"integer\",\"null\"]},\"userSegmentId\":{\"type\":[\"string\",\"null\"]},\"conditionGroups\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicConditionGroupRequest\"},{\"type\":\"null\"}]}}},\"description\":\"Request body for `PUT .../rules/{ruleId}`. Same shape as\\nPublicCreateTargetingRuleRequest — see its remarks on operator\\nvalidation/canonicalization, which applies identically here.\"},\"PublicUpdateVariationRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"value\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]}},\"description\":\"Request body for\\n`PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/variations/{variationId}`. The\\nvariation's key is immutable via this endpoint (mirrors\\n`UpdateVariationCommand`, which\\ncarries no `Key`).\"},\"PublicUpdateWebhookSubscriptionRequest\":{\"type\":[\"object\",\"null\"],\"properties\":{\"name\":{\"type\":[\"string\",\"null\"]},\"url\":{\"type\":[\"string\",\"null\"]},\"eventTypes\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"projectIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"environmentIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"isEnabled\":{\"type\":[\"boolean\",\"null\"]}},\"description\":\"Replaces a subscription's configuration (full replace — omitted lists become empty, meaning\\n\\\"all\\\"). `isEnabled` is required. The provider cannot be changed.\"},\"PublicVariationResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"key\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"value\":{\"type\":[\"string\",\"null\"]},\"description\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A single variation on a flag, as returned in Variations.\"},\"PublicWebhookDeliveryResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"webhookEventId\":{\"type\":[\"string\",\"null\"]},\"status\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: Pending, Succeeded, DeadLettered.\"},\"attemptCount\":{\"type\":[\"integer\",\"null\"]},\"nextAttemptAt\":{\"type\":[\"string\",\"null\"]},\"lastResponseStatusCode\":{\"type\":[\"integer\",\"null\"]},\"lastError\":{\"type\":[\"string\",\"null\"]},\"completedAt\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]}},\"description\":\"One delivery attempt record. `status` is `Pending` (awaiting its first attempt,\\nbacking off, or in flight), `Succeeded` or `DeadLettered`.\"},\"PublicWebhookDeliveryResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicWebhookDeliveryResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"},\"PublicWebhookSecretResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"retiredAt\":{\"type\":[\"string\",\"null\"]}},\"description\":\"A signing secret's id and lifecycle. A secret with no `retiredAt` is active and signs every delivery.\"},\"PublicWebhookSubscriptionResponse\":{\"type\":[\"object\",\"null\"],\"properties\":{\"id\":{\"type\":[\"string\",\"null\"]},\"name\":{\"type\":[\"string\",\"null\"]},\"url\":{\"type\":[\"string\",\"null\"]},\"provider\":{\"type\":[\"string\",\"null\"],\"description\":\"Allowed values: GenericHttp.\"},\"isEnabled\":{\"type\":[\"boolean\",\"null\"]},\"eventTypes\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"projectIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"environmentIds\":{\"type\":[\"array\",\"null\"],\"items\":{\"type\":[\"string\",\"null\"]}},\"consecutiveFailureCount\":{\"type\":[\"integer\",\"null\"]},\"autoDisabledAt\":{\"type\":[\"string\",\"null\"]},\"createdAt\":{\"type\":[\"string\",\"null\"]},\"updatedAt\":{\"type\":[\"string\",\"null\"]},\"secrets\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicWebhookSecretResponse\"},{\"type\":\"null\"}]}},\"overPlanLimit\":{\"type\":[\"boolean\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A webhook subscription. Never carries secret material: signing secrets are listed by id and\\nlifecycle only — the value itself is returned once, when it is created or rotated.\\n`overPlanLimit` is true when the organization has more subscriptions than its plan\\nallows, which happens after a downgrade. The oldest subscriptions up to the limit keep\\ndelivering. The rest receive nothing and cannot be re-enabled, tested or redelivered to until\\nthe plan is upgraded or older subscriptions are deleted.\"},\"PublicWebhookSubscriptionResponsePagedResult\":{\"type\":[\"object\",\"null\"],\"properties\":{\"items\":{\"type\":[\"array\",\"null\"],\"items\":{\"anyOf\":[{\"$ref\":\"#/$defs/PublicWebhookSubscriptionResponse\"},{\"type\":\"null\"}]}},\"next_cursor\":{\"type\":[\"string\",\"null\"]},\"_actions\":{\"type\":[\"object\",\"null\"],\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/$defs/ActionCapability\"},{\"type\":\"null\"}]},\"description\":\"Capability hints: which operations the authenticated caller may perform on this resource, each with allowed + optional reason. Computed from the caller's role and the resource's state. Injected at runtime; safe to ignore. Present only on top-level resource responses — nested occurrences (e.g. a rule inside a targeting-config response) do not carry it.\"}},\"description\":\"A page of results plus an opaque cursor for the next page, or null when this is the last\\npage. Wire keys are frozen: `items` (already lowercase under the camelCase policy) and\\n`next_cursor` (pinned explicitly — the policy alone would emit `nextCursor`).\"}}")
|
|
213
|
+
}, h = m.$defs, g = m.endpoints, _ = (e) => ({ type: [e, "null"] });
|
|
214
|
+
function v(e) {
|
|
215
|
+
if (!h[e]) throw Error(`no API schema named ${e}`);
|
|
204
216
|
return { $ref: `#/$defs/${e}` };
|
|
205
217
|
}
|
|
206
|
-
function
|
|
207
|
-
let t =
|
|
218
|
+
function y(e) {
|
|
219
|
+
let t = g[e];
|
|
208
220
|
if (!t) throw Error(`the public API spec has no JSON response for ${e}`);
|
|
209
|
-
return
|
|
221
|
+
return v(t);
|
|
210
222
|
}
|
|
211
|
-
function
|
|
212
|
-
if (Array.isArray(e)) for (let n of e)
|
|
223
|
+
function b(e, t = /* @__PURE__ */ new Set()) {
|
|
224
|
+
if (Array.isArray(e)) for (let n of e) b(n, t);
|
|
213
225
|
else if (e && typeof e == "object") for (let [n, r] of Object.entries(e)) if (n === "$ref" && typeof r == "string" && r.startsWith("#/$defs/")) {
|
|
214
226
|
let e = r.slice(8);
|
|
215
|
-
t.has(e) || (t.add(e),
|
|
216
|
-
} else
|
|
227
|
+
t.has(e) || (t.add(e), b(h[e], t));
|
|
228
|
+
} else b(r, t);
|
|
217
229
|
return t;
|
|
218
230
|
}
|
|
219
|
-
function
|
|
220
|
-
let n = [...
|
|
231
|
+
function x(e) {
|
|
232
|
+
let n = [...b(e)].sort(), r = {
|
|
221
233
|
...e,
|
|
222
234
|
type: "object"
|
|
223
235
|
};
|
|
224
|
-
return n.length && (r.$defs = Object.fromEntries(n.map((e) => [e,
|
|
236
|
+
return n.length && (r.$defs = Object.fromEntries(n.map((e) => [e, h[e]]))), t(r);
|
|
225
237
|
}
|
|
226
|
-
function
|
|
227
|
-
let t =
|
|
238
|
+
function S(e) {
|
|
239
|
+
let t = g[e];
|
|
228
240
|
if (!t) throw Error(`the public API spec has no JSON response for ${e}`);
|
|
229
|
-
return
|
|
230
|
-
...
|
|
241
|
+
return x({
|
|
242
|
+
...h[t],
|
|
231
243
|
type: "object"
|
|
232
244
|
});
|
|
233
245
|
}
|
|
234
|
-
function
|
|
235
|
-
let n =
|
|
246
|
+
function C(e, t) {
|
|
247
|
+
let n = g[e];
|
|
236
248
|
if (!n) throw Error(`the public API spec has no JSON response for ${e}`);
|
|
237
|
-
let r =
|
|
238
|
-
return
|
|
249
|
+
let r = h[n];
|
|
250
|
+
return x({
|
|
239
251
|
...r,
|
|
240
252
|
properties: {
|
|
241
253
|
...r.properties,
|
|
@@ -243,17 +255,17 @@ function ee(e, t) {
|
|
|
243
255
|
}
|
|
244
256
|
});
|
|
245
257
|
}
|
|
246
|
-
function
|
|
247
|
-
return
|
|
258
|
+
function w(e, t = [], n) {
|
|
259
|
+
return x({
|
|
248
260
|
properties: e,
|
|
249
261
|
...t.length ? { required: t } : {},
|
|
250
262
|
...n ? { description: n } : {}
|
|
251
263
|
});
|
|
252
264
|
}
|
|
253
|
-
function
|
|
254
|
-
return
|
|
265
|
+
function T(...e) {
|
|
266
|
+
return x({ anyOf: e });
|
|
255
267
|
}
|
|
256
|
-
function
|
|
268
|
+
function E(e, t = []) {
|
|
257
269
|
return {
|
|
258
270
|
type: "object",
|
|
259
271
|
properties: e,
|
|
@@ -262,54 +274,267 @@ function w(e, t = []) {
|
|
|
262
274
|
}
|
|
263
275
|
//#endregion
|
|
264
276
|
//#region src/tools/params.ts
|
|
265
|
-
var
|
|
277
|
+
var D = n.string().describe("Project key"), O = n.string().describe("Flag key or id"), k = n.string().describe("Environment key, e.g. production"), A = {
|
|
266
278
|
limit: n.number().int().min(1).max(100).optional().describe("Page size (default 20)"),
|
|
267
279
|
cursor: n.string().optional().describe("next_cursor from a previous response")
|
|
268
280
|
};
|
|
269
281
|
//#endregion
|
|
270
282
|
//#region src/tools/projects.ts
|
|
271
|
-
function
|
|
283
|
+
function ee(e, t) {
|
|
272
284
|
e.registerTool("list_projects", {
|
|
273
285
|
title: "List projects",
|
|
274
286
|
description: "List projects in the Featureflip organization. Paginated: pass cursor from next_cursor to continue.",
|
|
275
|
-
inputSchema: n.object({ ...
|
|
276
|
-
outputSchema:
|
|
287
|
+
inputSchema: n.object({ ...A }),
|
|
288
|
+
outputSchema: S("GET /api/v1/orgs/{org}/projects"),
|
|
277
289
|
annotations: { readOnlyHint: !0 }
|
|
278
|
-
}, async ({ limit: e, cursor: n }) =>
|
|
290
|
+
}, async ({ limit: e, cursor: n }) => p(async () => d(await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects`, { query: {
|
|
279
291
|
limit: e,
|
|
280
292
|
cursor: n
|
|
281
293
|
} }))));
|
|
294
|
+
let r = `/api/v1/orgs/${o(t.org)}/projects`;
|
|
295
|
+
e.registerTool("manage_project", {
|
|
296
|
+
title: "Create or update a project",
|
|
297
|
+
description: "Create a project, or change its name/description. action=create needs key + name; action=update needs project and changes only the fields you pass (description: \"\" clears it). The key is immutable. Projects cannot be deleted from here.",
|
|
298
|
+
inputSchema: n.object({
|
|
299
|
+
action: n.enum(["create", "update"]).describe("create needs key + name; update needs project"),
|
|
300
|
+
project: D.optional().describe("Project key to update; required for update"),
|
|
301
|
+
key: n.string().optional().describe("New project key, required for create; immutable afterwards"),
|
|
302
|
+
name: n.string().optional().describe("Display name; required for create"),
|
|
303
|
+
description: n.string().optional().describe("What the project is for; \"\" clears it")
|
|
304
|
+
}),
|
|
305
|
+
outputSchema: T(y("POST /api/v1/orgs/{org}/projects"), E({
|
|
306
|
+
project: { type: "string" },
|
|
307
|
+
updated: { type: "boolean" },
|
|
308
|
+
name: _("string"),
|
|
309
|
+
description: _("string")
|
|
310
|
+
}, ["project", "updated"])),
|
|
311
|
+
annotations: { destructiveHint: !0 }
|
|
312
|
+
}, async ({ action: e, project: n, key: i, name: a, description: s }) => p(async () => {
|
|
313
|
+
if (e === "create") return !i || !a ? f(/* @__PURE__ */ Error("action=create requires key and name")) : d(await t.api.request("POST", r, { body: {
|
|
314
|
+
key: i,
|
|
315
|
+
name: a,
|
|
316
|
+
description: s
|
|
317
|
+
} }));
|
|
318
|
+
if (!n) return f(/* @__PURE__ */ Error("action=update requires project (see list_projects)"));
|
|
319
|
+
let c = `${r}/${o(n)}`, l = await t.api.request("GET", c), u = {
|
|
320
|
+
name: a ?? l.name,
|
|
321
|
+
description: s ?? l.description
|
|
322
|
+
};
|
|
323
|
+
return await t.api.request("PUT", c, { body: u }), d({
|
|
324
|
+
project: n,
|
|
325
|
+
updated: !0,
|
|
326
|
+
...u
|
|
327
|
+
});
|
|
328
|
+
})), e.registerTool("set_default_flag_lifetime", {
|
|
329
|
+
title: "Set or remove a project's default flag lifetime",
|
|
330
|
+
description: "Set how many days a temporary flag with no expiry date of its own lives before it counts as expired, or pass days: null to remove the default. Advisory only: evaluation never changes. Pass preview: true first to see how many flags would newly be, or stop being, past expiry without changing anything. Setting a value is refused with FEATURE_NOT_ENABLED when the organization's plan lacks it; removal is always allowed. The current value is defaultFlagLifetimeDays in list_projects.",
|
|
331
|
+
inputSchema: n.object({
|
|
332
|
+
project: D,
|
|
333
|
+
days: n.number().int().min(1).max(3650).nullable().describe("Lifetime in days (1–3650), or null to remove the default"),
|
|
334
|
+
preview: n.boolean().optional().default(!1).describe("true: only report the impact; nothing is changed")
|
|
335
|
+
}),
|
|
336
|
+
outputSchema: w({
|
|
337
|
+
project: { type: "string" },
|
|
338
|
+
defaultFlagLifetimeDays: _("integer"),
|
|
339
|
+
applied: {
|
|
340
|
+
type: "boolean",
|
|
341
|
+
description: "false for a preview"
|
|
342
|
+
},
|
|
343
|
+
newlyPastExpiry: {
|
|
344
|
+
type: "integer",
|
|
345
|
+
description: "Flags this would put past expiry"
|
|
346
|
+
},
|
|
347
|
+
noLongerPastExpiry: {
|
|
348
|
+
type: "integer",
|
|
349
|
+
description: "Flags this would take back out of expiry"
|
|
350
|
+
}
|
|
351
|
+
}, [
|
|
352
|
+
"project",
|
|
353
|
+
"defaultFlagLifetimeDays",
|
|
354
|
+
"applied",
|
|
355
|
+
"newlyPastExpiry",
|
|
356
|
+
"noLongerPastExpiry"
|
|
357
|
+
]),
|
|
358
|
+
annotations: {
|
|
359
|
+
destructiveHint: !1,
|
|
360
|
+
idempotentHint: !0
|
|
361
|
+
}
|
|
362
|
+
}, async ({ project: e, days: n, preview: i }) => p(async () => {
|
|
363
|
+
let a = `${r}/${o(e)}/default-flag-lifetime`, s = await t.api.request("GET", `${a}/impact`, { query: { days: n ?? void 0 } });
|
|
364
|
+
return i || await t.api.request("PUT", a, { body: { days: n } }), d({
|
|
365
|
+
project: e,
|
|
366
|
+
defaultFlagLifetimeDays: n,
|
|
367
|
+
applied: !i,
|
|
368
|
+
newlyPastExpiry: s.newlyPastExpiry,
|
|
369
|
+
noLongerPastExpiry: s.noLongerPastExpiry
|
|
370
|
+
});
|
|
371
|
+
}));
|
|
282
372
|
}
|
|
283
373
|
//#endregion
|
|
284
374
|
//#region src/tools/environments.ts
|
|
285
|
-
function
|
|
375
|
+
function j(e, t) {
|
|
286
376
|
e.registerTool("list_environments", {
|
|
287
377
|
title: "List environments",
|
|
288
378
|
description: "List the environments of a project (e.g. development, staging, production).",
|
|
289
379
|
inputSchema: n.object({
|
|
290
|
-
project:
|
|
291
|
-
...
|
|
380
|
+
project: D,
|
|
381
|
+
...A
|
|
292
382
|
}),
|
|
293
|
-
outputSchema:
|
|
383
|
+
outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/environments"),
|
|
294
384
|
annotations: { readOnlyHint: !0 }
|
|
295
|
-
}, async ({ project: e, limit: n, cursor: r }) =>
|
|
385
|
+
}, async ({ project: e, limit: n, cursor: r }) => p(async () => d(await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/environments`, { query: {
|
|
296
386
|
limit: n,
|
|
297
387
|
cursor: r
|
|
298
|
-
} }))))
|
|
388
|
+
} })))), e.registerTool("manage_environment", {
|
|
389
|
+
title: "Create or update an environment",
|
|
390
|
+
description: "Create an environment in a project, or change its name, color or sort order. action=create needs key + name; action=update needs environment and changes only the fields you pass. The key is immutable. Environments cannot be deleted from here. A new environment needs an SDK key before apps can use it (manage_sdk_key).",
|
|
391
|
+
inputSchema: n.object({
|
|
392
|
+
action: n.enum(["create", "update"]).describe("create needs key + name; update needs environment"),
|
|
393
|
+
project: D,
|
|
394
|
+
environment: k.optional().describe("Environment key to update; required for update"),
|
|
395
|
+
key: n.string().optional().describe("New environment key, required for create; immutable afterwards"),
|
|
396
|
+
name: n.string().optional().describe("Display name; required for create"),
|
|
397
|
+
color: n.string().optional().describe("Hex color shown in the dashboard, e.g. #22c55e"),
|
|
398
|
+
sortOrder: n.number().int().optional().describe("Position in environment lists, lowest first")
|
|
399
|
+
}),
|
|
400
|
+
outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/environments"), E({
|
|
401
|
+
environment: { type: "string" },
|
|
402
|
+
updated: { type: "boolean" },
|
|
403
|
+
name: _("string"),
|
|
404
|
+
color: _("string"),
|
|
405
|
+
sortOrder: _("integer")
|
|
406
|
+
}, ["environment", "updated"])),
|
|
407
|
+
annotations: { destructiveHint: !0 }
|
|
408
|
+
}, async ({ action: e, project: n, environment: r, key: i, name: a, color: s, sortOrder: c }) => p(async () => {
|
|
409
|
+
let l = `/api/v1/orgs/${o(t.org)}/projects/${o(n)}/environments`;
|
|
410
|
+
if (e === "create") return !i || !a ? f(/* @__PURE__ */ Error("action=create requires key and name")) : d(await t.api.request("POST", l, { body: {
|
|
411
|
+
key: i,
|
|
412
|
+
name: a,
|
|
413
|
+
color: s,
|
|
414
|
+
sortOrder: c
|
|
415
|
+
} }));
|
|
416
|
+
if (!r) return f(/* @__PURE__ */ Error("action=update requires environment (see list_environments)"));
|
|
417
|
+
let u = `${l}/${o(r)}`, { data: p, etag: m } = await t.api.requestWithEtag("GET", u), h = {
|
|
418
|
+
name: a ?? p.name,
|
|
419
|
+
color: s ?? p.color,
|
|
420
|
+
sortOrder: c ?? p.sortOrder
|
|
421
|
+
};
|
|
422
|
+
return await t.api.request("PUT", u, {
|
|
423
|
+
body: h,
|
|
424
|
+
ifMatch: m
|
|
425
|
+
}), d({
|
|
426
|
+
environment: r,
|
|
427
|
+
updated: !0,
|
|
428
|
+
...h
|
|
429
|
+
});
|
|
430
|
+
}));
|
|
431
|
+
}
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/tools/sdk-keys.ts
|
|
434
|
+
var M = "This is the only time the full key is returned; it cannot be shown again. Store it in a secret or an untracked .env file, never in source control or a chat log.";
|
|
435
|
+
function N(e, t) {
|
|
436
|
+
let r = (e, n) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/environments/${o(n)}/sdk-keys`;
|
|
437
|
+
e.registerTool("list_sdk_keys", {
|
|
438
|
+
title: "List SDK keys",
|
|
439
|
+
description: "List the SDK keys of one environment: id, name, type, last four characters, and whether each is active. The full key is never listed; it is shown once, when manage_sdk_key creates it.",
|
|
440
|
+
inputSchema: n.object({
|
|
441
|
+
project: D,
|
|
442
|
+
environment: k,
|
|
443
|
+
...A
|
|
444
|
+
}),
|
|
445
|
+
outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/environments/{env}/sdk-keys"),
|
|
446
|
+
annotations: { readOnlyHint: !0 }
|
|
447
|
+
}, async ({ project: e, environment: n, limit: i, cursor: a }) => p(async () => d(await t.api.request("GET", r(e, n), { query: {
|
|
448
|
+
limit: i,
|
|
449
|
+
cursor: a
|
|
450
|
+
} })))), e.registerTool("manage_sdk_key", {
|
|
451
|
+
title: "Create, rename, or revoke an SDK key",
|
|
452
|
+
description: "Manage an environment's SDK keys. action=create needs name + type and returns the full key ONCE (ServerSide for backend SDKs, ClientSide for browser/mobile). action=rename needs sdkKey and changes only the fields you pass. action=revoke needs sdkKey and stops the key working immediately; apps still using it lose flag updates. To rotate: create a new key, deploy it, then revoke the old one.",
|
|
453
|
+
inputSchema: n.object({
|
|
454
|
+
action: n.enum([
|
|
455
|
+
"create",
|
|
456
|
+
"rename",
|
|
457
|
+
"revoke"
|
|
458
|
+
]).describe("create needs name + type; rename and revoke need sdkKey"),
|
|
459
|
+
project: D,
|
|
460
|
+
environment: k,
|
|
461
|
+
sdkKey: n.string().optional().describe("SDK key id (see list_sdk_keys); required for rename and revoke"),
|
|
462
|
+
name: n.string().optional().describe("Key name; required for create"),
|
|
463
|
+
description: n.string().optional().describe("What the key is used for; \"\" clears it"),
|
|
464
|
+
type: n.enum(["ServerSide", "ClientSide"]).optional().describe("Required for create: ServerSide for backend SDKs, ClientSide for browser/mobile SDKs")
|
|
465
|
+
}),
|
|
466
|
+
outputSchema: T(E({
|
|
467
|
+
id: { type: "string" },
|
|
468
|
+
key: _("string"),
|
|
469
|
+
warning: { type: "string" }
|
|
470
|
+
}, ["warning"]), E({
|
|
471
|
+
sdkKey: { type: "string" },
|
|
472
|
+
renamed: { type: "boolean" },
|
|
473
|
+
name: _("string"),
|
|
474
|
+
description: _("string")
|
|
475
|
+
}, ["sdkKey", "renamed"]), E({ revoked: { type: "string" } }, ["revoked"])),
|
|
476
|
+
annotations: { destructiveHint: !0 }
|
|
477
|
+
}, async ({ action: e, project: n, environment: i, sdkKey: a, name: s, description: c, type: l }) => p(async () => {
|
|
478
|
+
let u = r(n, i);
|
|
479
|
+
if (e === "create") {
|
|
480
|
+
if (!s || !l) return f(/* @__PURE__ */ Error("action=create requires name and type"));
|
|
481
|
+
let e = await t.api.request("POST", u, { body: {
|
|
482
|
+
name: s,
|
|
483
|
+
description: c,
|
|
484
|
+
type: l
|
|
485
|
+
} });
|
|
486
|
+
return d({
|
|
487
|
+
...e,
|
|
488
|
+
warning: e.warning ? `${e.warning} ${M}` : M
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
if (!a) return f(/* @__PURE__ */ Error(`action=${e} requires sdkKey (see list_sdk_keys)`));
|
|
492
|
+
let p = `${u}/${o(a)}`;
|
|
493
|
+
if (e === "rename") {
|
|
494
|
+
let e = await t.api.request("GET", p), n = {
|
|
495
|
+
name: s ?? e.name,
|
|
496
|
+
description: c ?? e.description
|
|
497
|
+
};
|
|
498
|
+
return await t.api.request("PUT", p, { body: n }), d({
|
|
499
|
+
sdkKey: a,
|
|
500
|
+
renamed: !0,
|
|
501
|
+
...n
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
return await t.api.request("POST", `${p}/revoke`), d({ revoked: a });
|
|
505
|
+
}));
|
|
506
|
+
}
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region src/tools/etag.ts
|
|
509
|
+
var P = {
|
|
510
|
+
type: "string",
|
|
511
|
+
description: "ETag of what was read. Pass it as ifMatch on the matching update so the write is refused (412) instead of overwriting a change made since."
|
|
512
|
+
}, F = {
|
|
513
|
+
type: "string",
|
|
514
|
+
description: "ETag of what this write left behind. Pass it as ifMatch on the next update to chain writes without re-reading. Absent when the API sent none; read the resource again before the next conditional write."
|
|
515
|
+
};
|
|
516
|
+
function I(e) {
|
|
517
|
+
return n.string().optional().describe(`etag from ${e}. The write is refused with 412 if the resource changed since that read; re-read and re-apply. Omit to write unconditionally.`);
|
|
518
|
+
}
|
|
519
|
+
function L({ data: e, etag: t }) {
|
|
520
|
+
return t ? {
|
|
521
|
+
...e,
|
|
522
|
+
etag: t
|
|
523
|
+
} : e;
|
|
299
524
|
}
|
|
300
525
|
//#endregion
|
|
301
526
|
//#region src/tools/segments.ts
|
|
302
|
-
function
|
|
527
|
+
function te(e, t) {
|
|
303
528
|
e.registerTool("list_segments", {
|
|
304
529
|
title: "List user segments",
|
|
305
530
|
description: "List reusable user segments in a project. Segments are referenced from targeting rules via userSegmentId.",
|
|
306
531
|
inputSchema: n.object({
|
|
307
532
|
project: n.string().describe("Project key"),
|
|
308
|
-
...
|
|
533
|
+
...A
|
|
309
534
|
}),
|
|
310
|
-
outputSchema:
|
|
535
|
+
outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/segments"),
|
|
311
536
|
annotations: { readOnlyHint: !0 }
|
|
312
|
-
}, async ({ project: e, limit: n, cursor: r }) =>
|
|
537
|
+
}, async ({ project: e, limit: n, cursor: r }) => p(async () => d(await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/segments`, { query: {
|
|
313
538
|
limit: n,
|
|
314
539
|
cursor: r
|
|
315
540
|
} })))), e.registerTool("get_segment", {
|
|
@@ -319,14 +544,85 @@ function j(e, t) {
|
|
|
319
544
|
project: n.string().describe("Project key"),
|
|
320
545
|
segment: n.string().describe("Segment key or id")
|
|
321
546
|
}),
|
|
322
|
-
outputSchema:
|
|
547
|
+
outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/segments/{segment}", { etag: P }),
|
|
323
548
|
annotations: { readOnlyHint: !0 }
|
|
324
|
-
}, async ({ project: e, segment: n }) =>
|
|
549
|
+
}, async ({ project: e, segment: n }) => p(async () => d(L(await t.api.requestWithEtag("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/segments/${o(n)}`)))));
|
|
550
|
+
let r = n.object({
|
|
551
|
+
attribute: n.string().describe("Context attribute name, e.g. plan, country, user_id"),
|
|
552
|
+
operator: n.string().describe("Case-sensitive: Equals, NotEquals, Contains, NotContains, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, In, NotIn, MatchesRegex, StartsWith, EndsWith, Before, After, SemverEquals, SemverGreaterThan, SemverGreaterThanOrEqual, SemverLessThan, SemverLessThanOrEqual"),
|
|
553
|
+
values: n.array(n.string()).describe("Values compared against the attribute"),
|
|
554
|
+
negate: n.boolean().optional().default(!1).describe("Invert the match")
|
|
555
|
+
}), i = (e) => ({
|
|
556
|
+
attribute: e.attribute,
|
|
557
|
+
operator: e.operator,
|
|
558
|
+
values: e.values,
|
|
559
|
+
negate: e.negate
|
|
560
|
+
});
|
|
561
|
+
e.registerTool("manage_segment", {
|
|
562
|
+
title: "Create, update, or delete a user segment",
|
|
563
|
+
description: "Manage reusable user segments, which targeting rules reference by userSegmentId. action=create needs key + name (+ conditions); action=update needs segment and changes only the fields you pass (conditions replaces the whole list; description: \"\" clears it); action=delete needs segment. On update, pass ifMatch (the etag from get_segment) so a change someone made since you read it is not overwritten. ifMatch is rejected on create and delete: the API cannot make those conditional.",
|
|
564
|
+
inputSchema: n.object({
|
|
565
|
+
action: n.enum([
|
|
566
|
+
"create",
|
|
567
|
+
"update",
|
|
568
|
+
"delete"
|
|
569
|
+
]).describe("create needs key + name; update and delete need segment"),
|
|
570
|
+
project: D,
|
|
571
|
+
segment: n.string().optional().describe("Segment key or id; required for update and delete"),
|
|
572
|
+
key: n.string().optional().describe("New segment key, required for create; immutable afterwards"),
|
|
573
|
+
name: n.string().optional().describe("Display name; required for create"),
|
|
574
|
+
description: n.string().optional().describe("What the segment means; \"\" clears it"),
|
|
575
|
+
conditions: n.array(r).optional().describe("Conditions a user must match to be in the segment; on update, replaces the whole list"),
|
|
576
|
+
ifMatch: I("get_segment")
|
|
577
|
+
}),
|
|
578
|
+
outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/segments"), E({
|
|
579
|
+
segment: { type: "string" },
|
|
580
|
+
updated: { type: "boolean" },
|
|
581
|
+
name: _("string"),
|
|
582
|
+
description: _("string"),
|
|
583
|
+
conditions: {
|
|
584
|
+
type: ["array", "null"],
|
|
585
|
+
items: { type: "object" }
|
|
586
|
+
},
|
|
587
|
+
etag: F
|
|
588
|
+
}, ["segment", "updated"]), E({ deleted: { type: "string" } }, ["deleted"])),
|
|
589
|
+
annotations: { destructiveHint: !0 }
|
|
590
|
+
}, async ({ action: e, project: n, segment: r, key: a, name: s, description: c, conditions: l, ifMatch: u }) => p(async () => {
|
|
591
|
+
let p = `/api/v1/orgs/${o(t.org)}/projects/${o(n)}/segments`;
|
|
592
|
+
if (u !== void 0 && e !== "update") return f(/* @__PURE__ */ Error(`ifMatch is only supported on action=update; action=${e} cannot be made conditional`));
|
|
593
|
+
if (e === "create") return !a || !s ? f(/* @__PURE__ */ Error("action=create requires key and name")) : d(await t.api.request("POST", p, { body: {
|
|
594
|
+
key: a,
|
|
595
|
+
name: s,
|
|
596
|
+
description: c,
|
|
597
|
+
conditions: l ?? []
|
|
598
|
+
} }));
|
|
599
|
+
if (!r) return f(/* @__PURE__ */ Error(`action=${e} requires segment (see list_segments)`));
|
|
600
|
+
let m = `${p}/${o(r)}`;
|
|
601
|
+
if (e === "update") {
|
|
602
|
+
let { data: e, etag: n } = await t.api.requestWithEtag("GET", m), a = {
|
|
603
|
+
name: s ?? e.name,
|
|
604
|
+
description: c ?? e.description,
|
|
605
|
+
conditions: l ?? (e.conditions ?? []).map(i)
|
|
606
|
+
}, { etag: o } = await t.api.requestWithEtag("PUT", m, {
|
|
607
|
+
body: a,
|
|
608
|
+
ifMatch: u ?? n
|
|
609
|
+
});
|
|
610
|
+
return d(L({
|
|
611
|
+
data: {
|
|
612
|
+
segment: r,
|
|
613
|
+
updated: !0,
|
|
614
|
+
...a
|
|
615
|
+
},
|
|
616
|
+
etag: o
|
|
617
|
+
}));
|
|
618
|
+
}
|
|
619
|
+
return await t.api.request("DELETE", m), d({ deleted: r });
|
|
620
|
+
}));
|
|
325
621
|
}
|
|
326
622
|
//#endregion
|
|
327
623
|
//#region src/tools/owner.ts
|
|
328
|
-
var
|
|
329
|
-
async function
|
|
624
|
+
var R = n.string().optional().describe("Only flags with this owner: an email, \"me\" for the token's own user, or \"none\" for unowned flags");
|
|
625
|
+
async function z(e, t) {
|
|
330
626
|
let n = t?.trim();
|
|
331
627
|
if (!n) return;
|
|
332
628
|
if (n.toLowerCase() !== "me") return n;
|
|
@@ -336,48 +632,48 @@ async function N(e, t) {
|
|
|
336
632
|
}
|
|
337
633
|
//#endregion
|
|
338
634
|
//#region src/tools/flags.ts
|
|
339
|
-
var
|
|
635
|
+
var B = n.enum([
|
|
340
636
|
"Boolean",
|
|
341
637
|
"String",
|
|
342
638
|
"Number",
|
|
343
639
|
"Json"
|
|
344
640
|
]);
|
|
345
|
-
function
|
|
346
|
-
let r = (e) => `/api/v1/orgs/${
|
|
641
|
+
function ne(e, t) {
|
|
642
|
+
let r = (e) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags`;
|
|
347
643
|
e.registerTool("list_flags", {
|
|
348
644
|
title: "List feature flags",
|
|
349
645
|
description: "List feature flags in a project. Filter with search (key/name substring), tag, type, archived, owner. Each flag carries its owner ({id, email, name}, or null when unowned). Paginated via cursor.",
|
|
350
646
|
inputSchema: n.object({
|
|
351
|
-
project:
|
|
647
|
+
project: D,
|
|
352
648
|
search: n.string().optional().describe("Substring of the flag key or name"),
|
|
353
649
|
tag: n.string().optional().describe("Only flags carrying this tag"),
|
|
354
|
-
type:
|
|
650
|
+
type: B.optional().describe("Only flags of this type"),
|
|
355
651
|
archived: n.boolean().optional().describe("true = only archived, false = only active"),
|
|
356
|
-
owner:
|
|
357
|
-
...
|
|
652
|
+
owner: R,
|
|
653
|
+
...A
|
|
358
654
|
}),
|
|
359
|
-
outputSchema:
|
|
655
|
+
outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/flags"),
|
|
360
656
|
annotations: { readOnlyHint: !0 }
|
|
361
|
-
}, async ({ project: e, owner: n, ...i }) =>
|
|
657
|
+
}, async ({ project: e, owner: n, ...i }) => p(async () => d(await t.api.request("GET", r(e), { query: {
|
|
362
658
|
...i,
|
|
363
|
-
owner: await
|
|
659
|
+
owner: await z(t, n)
|
|
364
660
|
} })))), e.registerTool("get_flag", {
|
|
365
661
|
title: "Get feature flag",
|
|
366
662
|
description: "Get one feature flag with its variations and metadata, including its owner (null when unowned). Address by flag key or id.",
|
|
367
663
|
inputSchema: n.object({
|
|
368
|
-
project:
|
|
369
|
-
flag:
|
|
664
|
+
project: D,
|
|
665
|
+
flag: O
|
|
370
666
|
}),
|
|
371
|
-
outputSchema:
|
|
667
|
+
outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}", { etag: P }),
|
|
372
668
|
annotations: { readOnlyHint: !0 }
|
|
373
|
-
}, async ({ project: e, flag: n }) =>
|
|
669
|
+
}, async ({ project: e, flag: n }) => p(async () => d(L(await t.api.requestWithEtag("GET", `${r(e)}/${o(n)}`))))), e.registerTool("create_flag", {
|
|
374
670
|
title: "Create feature flag",
|
|
375
671
|
description: "Create a feature flag. type is one of Boolean|String|Number|Json. Boolean flags get true/false variations automatically; for other types pass initialVariations. The flag is created in every environment of the project (disabled).",
|
|
376
672
|
inputSchema: n.object({
|
|
377
|
-
project:
|
|
673
|
+
project: D,
|
|
378
674
|
key: n.string().describe("Unique flag key, e.g. checkout-v2"),
|
|
379
675
|
name: n.string().describe("Display name"),
|
|
380
|
-
type:
|
|
676
|
+
type: B.describe("Value type; Boolean gets true/false variations automatically"),
|
|
381
677
|
description: n.string().optional().describe("What the flag controls"),
|
|
382
678
|
tags: n.array(n.string()).optional().describe("Tags for filtering, e.g. team or area"),
|
|
383
679
|
clientSideVisible: n.boolean().optional().describe("Expose to client-side SDKs (browser/mobile)"),
|
|
@@ -392,56 +688,64 @@ function F(e, t) {
|
|
|
392
688
|
isPermanent: n.boolean().optional().describe("Mark the flag permanent: a kill switch, ops toggle or entitlement gate that is meant to stay. Permanent flags are never listed as removal candidates or by find_stale_flags. Cannot be combined with expiresAtUtc"),
|
|
393
689
|
idempotency_key: n.string().optional().describe("Idempotency-Key header for safe retries")
|
|
394
690
|
}),
|
|
395
|
-
outputSchema:
|
|
691
|
+
outputSchema: S("POST /api/v1/orgs/{org}/projects/{project}/flags"),
|
|
396
692
|
annotations: { destructiveHint: !1 }
|
|
397
|
-
}, async ({ project: e, idempotency_key: n, ...i }) =>
|
|
693
|
+
}, async ({ project: e, idempotency_key: n, ...i }) => p(async () => d(await t.api.request("POST", r(e), {
|
|
398
694
|
body: i,
|
|
399
695
|
idempotencyKey: n
|
|
400
696
|
})))), e.registerTool("update_flag", {
|
|
401
697
|
title: "Update feature flag metadata",
|
|
402
|
-
description: "Update flag name/description/tags/clientSideVisible. Changes only the fields you pass and keeps the rest; pass description: \"\" to clear it. Key and type are immutable. Use toggle_flag / update_targeting for behavior changes.",
|
|
698
|
+
description: "Update flag name/description/tags/clientSideVisible. Changes only the fields you pass and keeps the rest; pass description: \"\" to clear it. Key and type are immutable. Use toggle_flag / update_targeting for behavior changes. Pass ifMatch (the etag from get_flag) to refuse the write if the flag changed since you read it.",
|
|
403
699
|
inputSchema: n.object({
|
|
404
|
-
project:
|
|
405
|
-
flag:
|
|
700
|
+
project: D,
|
|
701
|
+
flag: O,
|
|
406
702
|
name: n.string().optional().describe("New display name"),
|
|
407
703
|
description: n.string().optional().describe("New description; \"\" clears it"),
|
|
408
704
|
tags: n.array(n.string()).optional().describe("Replaces the whole tag list"),
|
|
409
|
-
clientSideVisible: n.boolean().optional().describe("Expose to client-side SDKs (browser/mobile); false hides the flag from them entirely")
|
|
705
|
+
clientSideVisible: n.boolean().optional().describe("Expose to client-side SDKs (browser/mobile); false hides the flag from them entirely"),
|
|
706
|
+
ifMatch: I("get_flag")
|
|
410
707
|
}),
|
|
411
|
-
outputSchema:
|
|
708
|
+
outputSchema: w({
|
|
412
709
|
project: { type: "string" },
|
|
413
710
|
flag: { type: "string" },
|
|
414
|
-
updated: { type: "boolean" }
|
|
711
|
+
updated: { type: "boolean" },
|
|
712
|
+
etag: F
|
|
415
713
|
}, [
|
|
416
714
|
"project",
|
|
417
715
|
"flag",
|
|
418
716
|
"updated"
|
|
419
717
|
]),
|
|
420
718
|
annotations: { destructiveHint: !0 }
|
|
421
|
-
}, async ({ project: e, flag: n, name: i, description:
|
|
422
|
-
let
|
|
423
|
-
name: i ??
|
|
424
|
-
description:
|
|
719
|
+
}, async ({ project: e, flag: n, name: i, description: a, tags: s, clientSideVisible: c, ifMatch: l }) => p(async () => {
|
|
720
|
+
let u = `${r(e)}/${o(n)}`, f = i === void 0 || a === void 0 ? await t.api.requestWithEtag("GET", u) : void 0, p = f?.data, m = {
|
|
721
|
+
name: i ?? p?.name,
|
|
722
|
+
description: a ?? p?.description,
|
|
425
723
|
tags: s,
|
|
426
724
|
clientSideVisible: c
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
flag: n,
|
|
431
|
-
updated: !0
|
|
725
|
+
}, { etag: h } = await t.api.requestWithEtag("PUT", u, {
|
|
726
|
+
body: m,
|
|
727
|
+
ifMatch: l ?? f?.etag
|
|
432
728
|
});
|
|
729
|
+
return d(L({
|
|
730
|
+
data: {
|
|
731
|
+
project: e,
|
|
732
|
+
flag: n,
|
|
733
|
+
updated: !0
|
|
734
|
+
},
|
|
735
|
+
etag: h
|
|
736
|
+
}));
|
|
433
737
|
})), e.registerTool("set_flag_expiry", {
|
|
434
738
|
title: "Set or clear flag expiry",
|
|
435
739
|
description: "Set the date a flag is expected to be removed by, or pass expiresAtUtc: null to clear it. Expiry is advisory: evaluation never changes. Once the date passes, find_stale_flags reports the flag as expired. expiresAtUtc takes a date (2026-12-31), which means the end of that day in UTC, the same as picking it in the dashboard, or a full ISO-8601 timestamp, which is stored exactly. Refused with EXPIRY_IN_PAST for a time that has already passed (today's date is allowed), with FEATURE_NOT_ENABLED while flag expiration is not enabled for the organization, and with PERMANENT_FLAG_HAS_EXPIRY on a permanent flag (make it temporary first with set_flag_permanent). Clearing is always allowed.",
|
|
436
740
|
inputSchema: n.object({
|
|
437
|
-
project:
|
|
438
|
-
flag:
|
|
741
|
+
project: D,
|
|
742
|
+
flag: O,
|
|
439
743
|
expiresAtUtc: n.string().nullable().describe("Date (YYYY-MM-DD, end of that UTC day) or ISO-8601 timestamp, or null to clear the expiry")
|
|
440
744
|
}),
|
|
441
|
-
outputSchema:
|
|
745
|
+
outputSchema: w({
|
|
442
746
|
project: { type: "string" },
|
|
443
747
|
flag: { type: "string" },
|
|
444
|
-
expiresAtUtc:
|
|
748
|
+
expiresAtUtc: _("string")
|
|
445
749
|
}, [
|
|
446
750
|
"project",
|
|
447
751
|
"flag",
|
|
@@ -451,9 +755,9 @@ function F(e, t) {
|
|
|
451
755
|
destructiveHint: !1,
|
|
452
756
|
idempotentHint: !0
|
|
453
757
|
}
|
|
454
|
-
}, async ({ project: e, flag: n, expiresAtUtc: i }) =>
|
|
455
|
-
let
|
|
456
|
-
return i === null ? await t.api.request("DELETE",
|
|
758
|
+
}, async ({ project: e, flag: n, expiresAtUtc: i }) => p(async () => {
|
|
759
|
+
let a = `${r(e)}/${o(n)}/expiry`;
|
|
760
|
+
return i === null ? await t.api.request("DELETE", a) : await t.api.request("PUT", a, { body: { expiresAtUtc: i } }), d({
|
|
457
761
|
project: e,
|
|
458
762
|
flag: n,
|
|
459
763
|
expiresAtUtc: i
|
|
@@ -462,11 +766,11 @@ function F(e, t) {
|
|
|
462
766
|
title: "Mark a flag permanent or temporary",
|
|
463
767
|
description: "Mark a flag permanent (a kill switch, ops toggle or entitlement gate that is meant to stay), or pass permanent: false to make it temporary again. Permanent flags are never listed as removal candidates or by find_stale_flags; evaluation never changes. Marking is refused with PERMANENT_FLAG_HAS_EXPIRY while the flag has an expiry date (clear it first with set_flag_expiry and expiresAtUtc: null), with FEATURE_NOT_ENABLED while permanent flags are not enabled for the organization, and on an archived flag. Making a flag temporary is always allowed.",
|
|
464
768
|
inputSchema: n.object({
|
|
465
|
-
project:
|
|
466
|
-
flag:
|
|
769
|
+
project: D,
|
|
770
|
+
flag: O,
|
|
467
771
|
permanent: n.boolean().describe("true to mark the flag permanent, false to make it temporary")
|
|
468
772
|
}),
|
|
469
|
-
outputSchema:
|
|
773
|
+
outputSchema: w({
|
|
470
774
|
project: { type: "string" },
|
|
471
775
|
flag: { type: "string" },
|
|
472
776
|
permanent: { type: "boolean" }
|
|
@@ -479,9 +783,9 @@ function F(e, t) {
|
|
|
479
783
|
destructiveHint: !1,
|
|
480
784
|
idempotentHint: !0
|
|
481
785
|
}
|
|
482
|
-
}, async ({ project: e, flag: n, permanent: i }) =>
|
|
483
|
-
let
|
|
484
|
-
return await t.api.request(i ? "PUT" : "DELETE",
|
|
786
|
+
}, async ({ project: e, flag: n, permanent: i }) => p(async () => {
|
|
787
|
+
let a = `${r(e)}/${o(n)}/permanent`;
|
|
788
|
+
return await t.api.request(i ? "PUT" : "DELETE", a), d({
|
|
485
789
|
project: e,
|
|
486
790
|
flag: n,
|
|
487
791
|
permanent: i
|
|
@@ -490,15 +794,15 @@ function F(e, t) {
|
|
|
490
794
|
title: "Set or clear flag owner",
|
|
491
795
|
description: "Name the person responsible for a flag, or pass owner: null to leave it unowned. owner is the email of an active member of the organization, or \"me\" for the token's own user (needs a personal access token). The owner gets the flag's cleanup notices; evaluation never changes. Refused with OWNER_NOT_MEMBER for an email that is not an active member, and with PLAN_FEATURE_UNAVAILABLE below the Pro plan. Clearing is always allowed.",
|
|
492
796
|
inputSchema: n.object({
|
|
493
|
-
project:
|
|
494
|
-
flag:
|
|
797
|
+
project: D,
|
|
798
|
+
flag: O,
|
|
495
799
|
owner: n.string().nullable().describe("Owner email, \"me\" for the token's own user, or null (or \"none\") to clear the owner")
|
|
496
800
|
}),
|
|
497
|
-
outputSchema:
|
|
801
|
+
outputSchema: w({
|
|
498
802
|
project: { type: "string" },
|
|
499
803
|
flag: { type: "string" },
|
|
500
804
|
owner: {
|
|
501
|
-
...
|
|
805
|
+
..._("string"),
|
|
502
806
|
description: "Owner email now set, or null when unowned"
|
|
503
807
|
}
|
|
504
808
|
}, [
|
|
@@ -510,9 +814,9 @@ function F(e, t) {
|
|
|
510
814
|
destructiveHint: !1,
|
|
511
815
|
idempotentHint: !0
|
|
512
816
|
}
|
|
513
|
-
}, async ({ project: e, flag: n, owner: i }) =>
|
|
514
|
-
let
|
|
515
|
-
return s === void 0 ? await t.api.request("DELETE",
|
|
817
|
+
}, async ({ project: e, flag: n, owner: i }) => p(async () => {
|
|
818
|
+
let a = `${r(e)}/${o(n)}/owner`, s = i?.trim().toLowerCase() === "none" ? void 0 : await z(t, i ?? void 0);
|
|
819
|
+
return s === void 0 ? await t.api.request("DELETE", a) : await t.api.request("PUT", a, { body: { email: s } }), d({
|
|
516
820
|
project: e,
|
|
517
821
|
flag: n,
|
|
518
822
|
owner: s ?? null
|
|
@@ -521,63 +825,63 @@ function F(e, t) {
|
|
|
521
825
|
title: "Delete feature flag",
|
|
522
826
|
description: "PERMANENTLY delete a flag across all environments. Fails with FLAG_HAS_DEPENDENTS if other flags use it as a prerequisite. Prefer archive_flag unless the flag must be fully removed.",
|
|
523
827
|
inputSchema: n.object({
|
|
524
|
-
project:
|
|
525
|
-
flag:
|
|
828
|
+
project: D,
|
|
829
|
+
flag: O
|
|
526
830
|
}),
|
|
527
|
-
outputSchema:
|
|
831
|
+
outputSchema: w({ deleted: { type: "string" } }, ["deleted"]),
|
|
528
832
|
annotations: { destructiveHint: !0 }
|
|
529
|
-
}, async ({ project: e, flag: n }) =>
|
|
833
|
+
}, async ({ project: e, flag: n }) => p(async () => (await t.api.request("DELETE", `${r(e)}/${o(n)}`), d({ deleted: n })))), e.registerTool("archive_flag", {
|
|
530
834
|
title: "Archive feature flag",
|
|
531
835
|
description: "Archive a flag (soft-hide, evaluation stops serving it). Reversible with restore_flag. Archive dependents first: refused with FLAG_HAS_DEPENDENTS while another live flag lists this one as a prerequisite, so archive those flags (blockedBy in find_stale_flags / list_removal_candidates) first. Refused with FLAG_RECENTLY_EVALUATED while live traffic is still evaluating the flag, because archiving makes every caller fall back to its own hardcoded default — normally that means the code removal has merged but not deployed yet, and the refusal clears itself once it has.",
|
|
532
836
|
inputSchema: n.object({
|
|
533
|
-
project:
|
|
534
|
-
flag:
|
|
837
|
+
project: D,
|
|
838
|
+
flag: O,
|
|
535
839
|
force: n.boolean().optional().describe("Archive even though traffic is still evaluating the flag. Only for clients that can never be updated (old mobile app versions), where traffic will never drain on its own.")
|
|
536
840
|
}),
|
|
537
|
-
outputSchema:
|
|
841
|
+
outputSchema: w({
|
|
538
842
|
flag: { type: "string" },
|
|
539
843
|
archived: { type: "boolean" }
|
|
540
844
|
}, ["flag", "archived"]),
|
|
541
845
|
annotations: { destructiveHint: !0 }
|
|
542
|
-
}, async ({ project: e, flag: n, force: i }) =>
|
|
846
|
+
}, async ({ project: e, flag: n, force: i }) => p(async () => (await t.api.request("POST", `${r(e)}/${o(n)}/archive`, { query: i ? { force: !0 } : {} }), d({
|
|
543
847
|
flag: n,
|
|
544
848
|
archived: !0
|
|
545
849
|
})))), e.registerTool("restore_flag", {
|
|
546
850
|
title: "Restore archived flag",
|
|
547
851
|
description: "Restore a previously archived flag.",
|
|
548
852
|
inputSchema: n.object({
|
|
549
|
-
project:
|
|
550
|
-
flag:
|
|
853
|
+
project: D,
|
|
854
|
+
flag: O
|
|
551
855
|
}),
|
|
552
|
-
outputSchema:
|
|
856
|
+
outputSchema: w({
|
|
553
857
|
flag: { type: "string" },
|
|
554
858
|
archived: { type: "boolean" }
|
|
555
859
|
}, ["flag", "archived"]),
|
|
556
860
|
annotations: { destructiveHint: !1 }
|
|
557
|
-
}, async ({ project: e, flag: n }) =>
|
|
861
|
+
}, async ({ project: e, flag: n }) => p(async () => (await t.api.request("POST", `${r(e)}/${o(n)}/restore`), d({
|
|
558
862
|
flag: n,
|
|
559
863
|
archived: !1
|
|
560
864
|
}))));
|
|
561
865
|
}
|
|
562
866
|
//#endregion
|
|
563
867
|
//#region src/tools/flag-environments.ts
|
|
564
|
-
var
|
|
868
|
+
var re = n.enum([
|
|
565
869
|
"SingleVariation",
|
|
566
870
|
"PercentageRollout",
|
|
567
871
|
"TargetedRollout"
|
|
568
872
|
]);
|
|
569
|
-
function
|
|
570
|
-
let r = (e, n) => `/api/v1/orgs/${
|
|
873
|
+
function ie(e, t) {
|
|
874
|
+
let r = (e, n) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}`;
|
|
571
875
|
e.registerTool("toggle_flag", {
|
|
572
876
|
title: "Toggle flag in environment",
|
|
573
877
|
description: "Enable or disable a flag in ONE environment. Affects live evaluation immediately — double-check the environment.",
|
|
574
878
|
inputSchema: n.object({
|
|
575
|
-
project:
|
|
576
|
-
flag:
|
|
577
|
-
environment:
|
|
879
|
+
project: D,
|
|
880
|
+
flag: O,
|
|
881
|
+
environment: k,
|
|
578
882
|
enabled: n.boolean().describe("true to turn the flag on in this environment, false to turn it off")
|
|
579
883
|
}),
|
|
580
|
-
outputSchema:
|
|
884
|
+
outputSchema: w({
|
|
581
885
|
project: { type: "string" },
|
|
582
886
|
flag: { type: "string" },
|
|
583
887
|
environment: { type: "string" },
|
|
@@ -589,26 +893,26 @@ function te(e, t) {
|
|
|
589
893
|
"enabled"
|
|
590
894
|
]),
|
|
591
895
|
annotations: { destructiveHint: !0 }
|
|
592
|
-
}, async ({ project: e, flag: n, environment: i, enabled:
|
|
896
|
+
}, async ({ project: e, flag: n, environment: i, enabled: a }) => p(async () => (await t.api.request("POST", `${r(e, n)}/environments/${o(i)}/toggle`, { body: { enabled: a } }), d({
|
|
593
897
|
project: e,
|
|
594
898
|
flag: n,
|
|
595
899
|
environment: i,
|
|
596
|
-
enabled:
|
|
900
|
+
enabled: a
|
|
597
901
|
})))), e.registerTool("update_flag_environment_config", {
|
|
598
902
|
title: "Update flag environment config",
|
|
599
903
|
description: "Update a flag's per-environment serving config: defaultVariationId (served on fallthrough, required), strategy (SingleVariation | PercentageRollout | TargetedRollout — only SingleVariation is currently supported at the environment level), and prerequisites. Percentage rollouts are configured on targeting rules via update_targeting.",
|
|
600
904
|
inputSchema: n.object({
|
|
601
|
-
project:
|
|
602
|
-
flag:
|
|
603
|
-
environment:
|
|
905
|
+
project: D,
|
|
906
|
+
flag: O,
|
|
907
|
+
environment: k,
|
|
604
908
|
defaultVariationId: n.string().describe("Variation id to serve on fallthrough — required by the API"),
|
|
605
|
-
strategy:
|
|
909
|
+
strategy: re.optional().describe("Serving strategy; only SingleVariation is currently supported here"),
|
|
606
910
|
prerequisites: n.array(n.object({
|
|
607
911
|
prerequisiteFlagKey: n.string(),
|
|
608
912
|
expectedVariationKey: n.string()
|
|
609
913
|
})).optional().describe("Flags that must evaluate to the expected variation before this flag serves. Omit to leave existing prerequisites untouched; pass a list (possibly empty) to replace them wholesale.")
|
|
610
914
|
}),
|
|
611
|
-
outputSchema:
|
|
915
|
+
outputSchema: w({
|
|
612
916
|
project: { type: "string" },
|
|
613
917
|
flag: { type: "string" },
|
|
614
918
|
environment: { type: "string" },
|
|
@@ -616,7 +920,7 @@ function te(e, t) {
|
|
|
616
920
|
strategy: { type: "string" },
|
|
617
921
|
prerequisites: {
|
|
618
922
|
type: "array",
|
|
619
|
-
items:
|
|
923
|
+
items: E({
|
|
620
924
|
prerequisiteFlagKey: { type: "string" },
|
|
621
925
|
expectedVariationKey: { type: "string" }
|
|
622
926
|
})
|
|
@@ -628,32 +932,32 @@ function te(e, t) {
|
|
|
628
932
|
"defaultVariationId"
|
|
629
933
|
]),
|
|
630
934
|
annotations: { destructiveHint: !0 }
|
|
631
|
-
}, async ({ project: e, flag: n, environment: i, ...
|
|
935
|
+
}, async ({ project: e, flag: n, environment: i, ...a }) => p(async () => (await t.api.request("PUT", `${r(e, n)}/environments/${o(i)}`, { body: a }), d({
|
|
632
936
|
project: e,
|
|
633
937
|
flag: n,
|
|
634
938
|
environment: i,
|
|
635
|
-
...
|
|
939
|
+
...a
|
|
636
940
|
})))), e.registerTool("flag_status", {
|
|
637
941
|
title: "Flag status across environments",
|
|
638
942
|
description: "Compact cross-environment view of one flag: enabled state, strategy, default variation, and prerequisites per environment.",
|
|
639
943
|
inputSchema: n.object({
|
|
640
|
-
project:
|
|
641
|
-
flag:
|
|
944
|
+
project: D,
|
|
945
|
+
flag: O
|
|
642
946
|
}),
|
|
643
|
-
outputSchema:
|
|
644
|
-
key:
|
|
645
|
-
name:
|
|
646
|
-
type:
|
|
947
|
+
outputSchema: w({
|
|
948
|
+
key: _("string"),
|
|
949
|
+
name: _("string"),
|
|
950
|
+
type: _("string"),
|
|
647
951
|
archived: { type: "boolean" },
|
|
648
|
-
updatedAt:
|
|
952
|
+
updatedAt: _("string"),
|
|
649
953
|
environments: {
|
|
650
954
|
type: "array",
|
|
651
|
-
items:
|
|
652
|
-
environment:
|
|
955
|
+
items: E({
|
|
956
|
+
environment: _("string"),
|
|
653
957
|
enabled: { type: "boolean" },
|
|
654
|
-
strategy:
|
|
958
|
+
strategy: _("string"),
|
|
655
959
|
defaultVariation: {
|
|
656
|
-
...
|
|
960
|
+
..._("string"),
|
|
657
961
|
description: "Variation key served on fallthrough"
|
|
658
962
|
},
|
|
659
963
|
prerequisites: { type: "array" }
|
|
@@ -668,9 +972,9 @@ function te(e, t) {
|
|
|
668
972
|
"environments"
|
|
669
973
|
]),
|
|
670
974
|
annotations: { readOnlyHint: !0 }
|
|
671
|
-
}, async ({ project: e, flag: n }) =>
|
|
975
|
+
}, async ({ project: e, flag: n }) => p(async () => {
|
|
672
976
|
let [i, a] = await Promise.all([t.api.request("GET", r(e, n)), t.api.request("GET", `${r(e, n)}/environments`)]), o = (e) => (i.variations ?? []).find((t) => t.id === e)?.key ?? e ?? null;
|
|
673
|
-
return
|
|
977
|
+
return d({
|
|
674
978
|
key: i.key ?? null,
|
|
675
979
|
name: i.name ?? null,
|
|
676
980
|
type: i.type ?? null,
|
|
@@ -688,47 +992,52 @@ function te(e, t) {
|
|
|
688
992
|
}
|
|
689
993
|
//#endregion
|
|
690
994
|
//#region src/tools/targeting.ts
|
|
691
|
-
var
|
|
995
|
+
var ae = n.object({
|
|
692
996
|
attribute: n.string().describe("Context attribute name, e.g. plan, country, user_id"),
|
|
693
997
|
operator: n.string().describe("OperatorType member name, case-sensitive — e.g. Equals, NotEquals, Contains, In, GreaterThan"),
|
|
694
998
|
values: n.array(n.string()),
|
|
695
999
|
negate: n.boolean().optional().default(!1)
|
|
696
|
-
}),
|
|
1000
|
+
}), V = n.object({
|
|
697
1001
|
description: n.string().optional(),
|
|
698
1002
|
variationId: n.string().optional().describe("Variation served when the rule matches"),
|
|
699
1003
|
rolloutPercentage: n.number().int().min(0).max(100).optional().describe("Percentage rollout for this rule"),
|
|
700
1004
|
userSegmentId: n.string().optional().describe("Match users in this segment (see list_segments)"),
|
|
701
1005
|
conditionGroups: n.array(n.object({
|
|
702
1006
|
operator: n.enum(["And", "Or"]).describe("How conditions inside this group combine"),
|
|
703
|
-
conditions: n.array(
|
|
1007
|
+
conditions: n.array(ae)
|
|
704
1008
|
})).optional().describe("Groups are ANDed together; conditions inside a group use the group operator")
|
|
1009
|
+
}), H = (e) => ({
|
|
1010
|
+
...e,
|
|
1011
|
+
conditionGroups: e.conditionGroups ?? []
|
|
705
1012
|
});
|
|
706
|
-
function
|
|
707
|
-
let r = (e, n, r) => `/api/v1/orgs/${
|
|
1013
|
+
function U(e, t) {
|
|
1014
|
+
let r = (e, n, r) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}/environments/${o(r)}/targeting`;
|
|
708
1015
|
e.registerTool("get_targeting", {
|
|
709
1016
|
title: "Get targeting rules",
|
|
710
1017
|
description: "Get a flag's current targeting configuration (enabled flag + ordered rules) in one environment.",
|
|
711
1018
|
inputSchema: n.object({
|
|
712
|
-
project:
|
|
713
|
-
flag:
|
|
714
|
-
environment:
|
|
1019
|
+
project: D,
|
|
1020
|
+
flag: O,
|
|
1021
|
+
environment: k
|
|
715
1022
|
}),
|
|
716
|
-
outputSchema:
|
|
1023
|
+
outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/targeting", { etag: P }),
|
|
717
1024
|
annotations: { readOnlyHint: !0 }
|
|
718
|
-
}, async ({ project: e, flag: n, environment: i }) =>
|
|
1025
|
+
}, async ({ project: e, flag: n, environment: i }) => p(async () => d(L(await t.api.requestWithEtag("GET", r(e, n, i)))))), e.registerTool("update_targeting", {
|
|
719
1026
|
title: "Replace targeting rules",
|
|
720
|
-
description: "REPLACE all targeting rules of a flag in one environment (full PUT — rules not included are removed). Rules are evaluated in order. Get the current rules first with get_targeting.",
|
|
1027
|
+
description: "REPLACE all targeting rules of a flag in one environment (full PUT — rules not included are removed). Rules are evaluated in order. Get the current rules first with get_targeting. Pass ifMatch (the etag from get_targeting) so rules someone else changed meanwhile are not overwritten.",
|
|
721
1028
|
inputSchema: n.object({
|
|
722
|
-
project:
|
|
723
|
-
flag:
|
|
724
|
-
environment:
|
|
725
|
-
rules: n.array(
|
|
1029
|
+
project: D,
|
|
1030
|
+
flag: O,
|
|
1031
|
+
environment: k,
|
|
1032
|
+
rules: n.array(V).describe("The complete ordered rule list; rules left out are deleted"),
|
|
1033
|
+
ifMatch: I("get_targeting")
|
|
726
1034
|
}),
|
|
727
|
-
outputSchema:
|
|
1035
|
+
outputSchema: w({
|
|
728
1036
|
project: { type: "string" },
|
|
729
1037
|
flag: { type: "string" },
|
|
730
1038
|
environment: { type: "string" },
|
|
731
|
-
rulesReplaced: { type: "integer" }
|
|
1039
|
+
rulesReplaced: { type: "integer" },
|
|
1040
|
+
etag: F
|
|
732
1041
|
}, [
|
|
733
1042
|
"project",
|
|
734
1043
|
"flag",
|
|
@@ -736,22 +1045,88 @@ function R(e, t) {
|
|
|
736
1045
|
"rulesReplaced"
|
|
737
1046
|
]),
|
|
738
1047
|
annotations: { destructiveHint: !0 }
|
|
739
|
-
}, async ({ project: e, flag: n, environment: i, rules: a }) =>
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
1048
|
+
}, async ({ project: e, flag: n, environment: i, rules: a, ifMatch: o }) => p(async () => {
|
|
1049
|
+
let { etag: s } = await t.api.requestWithEtag("PUT", r(e, n, i), {
|
|
1050
|
+
body: { rules: a.map(H) },
|
|
1051
|
+
ifMatch: o
|
|
1052
|
+
});
|
|
1053
|
+
return d(L({
|
|
1054
|
+
data: {
|
|
1055
|
+
project: e,
|
|
1056
|
+
flag: n,
|
|
1057
|
+
environment: i,
|
|
1058
|
+
rulesReplaced: a.length
|
|
1059
|
+
},
|
|
1060
|
+
etag: s
|
|
1061
|
+
}));
|
|
1062
|
+
})), e.registerTool("manage_targeting_rule", {
|
|
1063
|
+
title: "Add, update, remove, or reorder one targeting rule",
|
|
1064
|
+
description: "Edit a single targeting rule instead of replacing them all with update_targeting. action=add needs rule (appended last); action=update needs ruleId + rule and changes only the fields you pass (conditionGroups replaces the rule's groups; to clear rolloutPercentage or userSegmentId use update_targeting); action=remove needs ruleId; action=reorder needs ruleIds, every existing rule id exactly once, in the new order. Rule ids come from get_targeting.",
|
|
1065
|
+
inputSchema: n.object({
|
|
1066
|
+
action: n.enum([
|
|
1067
|
+
"add",
|
|
1068
|
+
"update",
|
|
1069
|
+
"remove",
|
|
1070
|
+
"reorder"
|
|
1071
|
+
]).describe("add needs rule; update needs ruleId + rule; remove needs ruleId; reorder needs ruleIds"),
|
|
1072
|
+
project: D,
|
|
1073
|
+
flag: O,
|
|
1074
|
+
environment: k,
|
|
1075
|
+
ruleId: n.string().optional().describe("Rule id from get_targeting; required for update and remove"),
|
|
1076
|
+
rule: V.optional().describe("Rule fields; required for add and update"),
|
|
1077
|
+
ruleIds: n.array(n.string()).optional().describe("Every rule id exactly once, in evaluation order; required for reorder")
|
|
1078
|
+
}),
|
|
1079
|
+
outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/rules"), E({
|
|
1080
|
+
ruleId: { type: "string" },
|
|
1081
|
+
updated: { type: "boolean" }
|
|
1082
|
+
}, ["ruleId", "updated"]), E({ removed: { type: "string" } }, ["removed"]), E({ reordered: {
|
|
1083
|
+
type: "array",
|
|
1084
|
+
items: { type: "string" }
|
|
1085
|
+
} }, ["reordered"])),
|
|
1086
|
+
annotations: { destructiveHint: !0 }
|
|
1087
|
+
}, async ({ action: e, project: n, flag: r, environment: i, ruleId: a, rule: s, ruleIds: c }) => p(async () => {
|
|
1088
|
+
let l = `/api/v1/orgs/${o(t.org)}/projects/${o(n)}/flags/${o(r)}/environments/${o(i)}/rules`;
|
|
1089
|
+
if (e === "add") return s ? d(await t.api.request("POST", l, { body: H(s) })) : f(/* @__PURE__ */ Error("action=add requires rule"));
|
|
1090
|
+
if (e === "reorder") return c ? (await t.api.request("PUT", `${l}/reorder`, { body: { ruleIds: c } }), d({ reordered: c })) : f(/* @__PURE__ */ Error("action=reorder requires ruleIds (see get_targeting)"));
|
|
1091
|
+
if (!a) return f(/* @__PURE__ */ Error(`action=${e} requires ruleId (see get_targeting)`));
|
|
1092
|
+
let u = `${l}/${o(a)}`;
|
|
1093
|
+
if (e === "update") {
|
|
1094
|
+
if (!s) return f(/* @__PURE__ */ Error("action=update requires rule"));
|
|
1095
|
+
let { data: e, etag: n } = await t.api.requestWithEtag("GET", u), r = {
|
|
1096
|
+
description: s.description ?? e.description,
|
|
1097
|
+
variationId: s.variationId ?? e.variationId,
|
|
1098
|
+
rolloutPercentage: s.rolloutPercentage ?? e.rolloutPercentage,
|
|
1099
|
+
userSegmentId: s.userSegmentId ?? e.userSegmentId,
|
|
1100
|
+
conditionGroups: s.conditionGroups ?? (e.conditionGroups ?? []).map((e) => ({
|
|
1101
|
+
operator: e.operator,
|
|
1102
|
+
conditions: (e.conditions ?? []).map((e) => ({
|
|
1103
|
+
attribute: e.attribute,
|
|
1104
|
+
operator: e.operator,
|
|
1105
|
+
values: e.values,
|
|
1106
|
+
negate: e.negate
|
|
1107
|
+
}))
|
|
1108
|
+
}))
|
|
1109
|
+
};
|
|
1110
|
+
return await t.api.request("PUT", u, {
|
|
1111
|
+
body: r,
|
|
1112
|
+
ifMatch: n
|
|
1113
|
+
}), d({
|
|
1114
|
+
ruleId: a,
|
|
1115
|
+
updated: !0
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
return await t.api.request("DELETE", u), d({ removed: a });
|
|
1119
|
+
}));
|
|
745
1120
|
}
|
|
746
1121
|
//#endregion
|
|
747
1122
|
//#region src/tools/variations.ts
|
|
748
|
-
function
|
|
1123
|
+
function W(e, t) {
|
|
749
1124
|
e.registerTool("manage_variation", {
|
|
750
1125
|
title: "Add, update, or remove a variation",
|
|
751
1126
|
description: "Manage a flag's variations. action=add requires key + value; action=update/remove require variationId (get ids via get_flag). Removing a variation fails with VARIATION_HAS_DEPENDENTS if other flags depend on it.",
|
|
752
1127
|
inputSchema: n.object({
|
|
753
|
-
project:
|
|
754
|
-
flag:
|
|
1128
|
+
project: D,
|
|
1129
|
+
flag: O,
|
|
755
1130
|
action: n.enum([
|
|
756
1131
|
"add",
|
|
757
1132
|
"update",
|
|
@@ -763,41 +1138,41 @@ function z(e, t) {
|
|
|
763
1138
|
value: n.string().optional().describe("Variation value serialized as a string; required for add"),
|
|
764
1139
|
description: n.string().optional().describe("What this variation means")
|
|
765
1140
|
}),
|
|
766
|
-
outputSchema:
|
|
1141
|
+
outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/flags/{flag}/variations"), E({ updated: {
|
|
767
1142
|
type: "string",
|
|
768
1143
|
description: "Id of the updated variation"
|
|
769
|
-
} }, ["updated"]),
|
|
1144
|
+
} }, ["updated"]), E({ removed: {
|
|
770
1145
|
type: "string",
|
|
771
1146
|
description: "Id of the removed variation"
|
|
772
1147
|
} }, ["removed"])),
|
|
773
1148
|
annotations: { destructiveHint: !0 }
|
|
774
|
-
}, async ({ project: e, flag: n, action: r, variationId: i, key:
|
|
775
|
-
let
|
|
776
|
-
return r === "add" ? !
|
|
777
|
-
key:
|
|
1149
|
+
}, async ({ project: e, flag: n, action: r, variationId: i, key: a, name: s, value: c, description: l }) => p(async () => {
|
|
1150
|
+
let u = `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}/variations`;
|
|
1151
|
+
return r === "add" ? !a || c === void 0 ? f(/* @__PURE__ */ Error("action=add requires key and value")) : d(await t.api.request("POST", u, { body: {
|
|
1152
|
+
key: a,
|
|
778
1153
|
name: s,
|
|
779
1154
|
value: c,
|
|
780
1155
|
description: l
|
|
781
|
-
} })) : i ? r === "update" ? (await t.api.request("PUT", `${
|
|
1156
|
+
} })) : i ? r === "update" ? (await t.api.request("PUT", `${u}/${o(i)}`, { body: {
|
|
782
1157
|
name: s,
|
|
783
1158
|
value: c,
|
|
784
1159
|
description: l
|
|
785
|
-
} }),
|
|
1160
|
+
} }), d({ updated: i })) : (await t.api.request("DELETE", `${u}/${o(i)}`), d({ removed: i })) : f(/* @__PURE__ */ Error(`action=${r} requires variationId (see get_flag for ids)`));
|
|
786
1161
|
}));
|
|
787
1162
|
}
|
|
788
1163
|
//#endregion
|
|
789
1164
|
//#region src/tools/webhooks.ts
|
|
790
|
-
var
|
|
791
|
-
function
|
|
792
|
-
let r = `/api/v1/orgs/${
|
|
793
|
-
async function
|
|
1165
|
+
var G = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, K = "Requires an Admin token. A 404 on every webhook call means webhooks are not enabled for the organization.";
|
|
1166
|
+
function q(e, t) {
|
|
1167
|
+
let r = `/api/v1/orgs/${o(t.org)}/webhooks`, i = (e) => `${r}/${o(e)}`;
|
|
1168
|
+
async function a(e) {
|
|
794
1169
|
let n = [];
|
|
795
1170
|
for (let r of e) {
|
|
796
|
-
if (
|
|
1171
|
+
if (G.test(r)) {
|
|
797
1172
|
n.push(r);
|
|
798
1173
|
continue;
|
|
799
1174
|
}
|
|
800
|
-
let e = await t.api.request("GET", `/api/v1/orgs/${
|
|
1175
|
+
let e = await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(r)}`);
|
|
801
1176
|
if (!e?.id) throw Error(`Project "${r}" resolved without an id`);
|
|
802
1177
|
n.push(e.id);
|
|
803
1178
|
}
|
|
@@ -805,7 +1180,7 @@ function H(e, t) {
|
|
|
805
1180
|
}
|
|
806
1181
|
async function s(e) {
|
|
807
1182
|
let n = e.map((e) => {
|
|
808
|
-
if (
|
|
1183
|
+
if (G.test(e)) return { id: e };
|
|
809
1184
|
let t = e.indexOf("/"), n = e.slice(0, t), r = e.slice(t + 1);
|
|
810
1185
|
if (t < 0 || !n || !r) throw Error(`Environment "${e}" needs its project: pass "<project>/<environment>", e.g. "web/production", or the environment's id.`);
|
|
811
1186
|
return {
|
|
@@ -818,7 +1193,7 @@ function H(e, t) {
|
|
|
818
1193
|
r.push(e.id);
|
|
819
1194
|
continue;
|
|
820
1195
|
}
|
|
821
|
-
let n = await t.api.request("GET", `/api/v1/orgs/${
|
|
1196
|
+
let n = await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e.project)}/environments/${o(e.env)}`);
|
|
822
1197
|
if (!n?.id) throw Error(`Environment "${e.project}/${e.env}" resolved without an id`);
|
|
823
1198
|
r.push(n.id);
|
|
824
1199
|
}
|
|
@@ -826,38 +1201,38 @@ function H(e, t) {
|
|
|
826
1201
|
}
|
|
827
1202
|
e.registerTool("list_webhooks", {
|
|
828
1203
|
title: "List webhook subscriptions",
|
|
829
|
-
description: "List the organization's outbound webhook subscriptions (url, event/project/environment filters, enabled state, failure count, signing secret ids — never secret values), plus availableEventTypes: the event types a subscription can filter on. Empty filter lists mean \"all\". Paginated via cursor. " +
|
|
830
|
-
inputSchema: n.object({ ...
|
|
831
|
-
outputSchema:
|
|
1204
|
+
description: "List the organization's outbound webhook subscriptions (url, event/project/environment filters, enabled state, failure count, signing secret ids — never secret values), plus availableEventTypes: the event types a subscription can filter on. Empty filter lists mean \"all\". Paginated via cursor. " + K,
|
|
1205
|
+
inputSchema: n.object({ ...A }),
|
|
1206
|
+
outputSchema: C("GET /api/v1/orgs/{org}/webhooks", { availableEventTypes: {
|
|
832
1207
|
type: "array",
|
|
833
1208
|
items: { type: "string" },
|
|
834
1209
|
description: "Event types a subscription can filter on"
|
|
835
1210
|
} }),
|
|
836
1211
|
annotations: { readOnlyHint: !0 }
|
|
837
|
-
}, async ({ limit: e, cursor: n }) =>
|
|
1212
|
+
}, async ({ limit: e, cursor: n }) => p(async () => {
|
|
838
1213
|
let [i, a] = await Promise.all([t.api.request("GET", r, { query: {
|
|
839
1214
|
limit: e,
|
|
840
1215
|
cursor: n
|
|
841
1216
|
} }), t.api.request("GET", `${r}/event-types`)]);
|
|
842
|
-
return
|
|
1217
|
+
return d({
|
|
843
1218
|
...i,
|
|
844
1219
|
availableEventTypes: a
|
|
845
1220
|
});
|
|
846
1221
|
})), e.registerTool("list_webhook_deliveries", {
|
|
847
1222
|
title: "List webhook deliveries",
|
|
848
|
-
description: "List one subscription's delivery attempts, most recent first. status is Pending (awaiting an attempt, backing off, or in flight), Succeeded or DeadLettered; lastResponseStatusCode and lastError explain a failure. Paginated via cursor. " +
|
|
1223
|
+
description: "List one subscription's delivery attempts, most recent first. status is Pending (awaiting an attempt, backing off, or in flight), Succeeded or DeadLettered; lastResponseStatusCode and lastError explain a failure. Paginated via cursor. " + K,
|
|
849
1224
|
inputSchema: n.object({
|
|
850
1225
|
id: n.string().describe("Subscription id (from list_webhooks)"),
|
|
851
|
-
...
|
|
1226
|
+
...A
|
|
852
1227
|
}),
|
|
853
|
-
outputSchema:
|
|
1228
|
+
outputSchema: S("GET /api/v1/orgs/{org}/webhooks/{id}/deliveries"),
|
|
854
1229
|
annotations: { readOnlyHint: !0 }
|
|
855
|
-
}, async ({ id: e, limit: n, cursor: r }) =>
|
|
1230
|
+
}, async ({ id: e, limit: n, cursor: r }) => p(async () => d(await t.api.request("GET", `${i(e)}/deliveries`, { query: {
|
|
856
1231
|
limit: n,
|
|
857
1232
|
cursor: r
|
|
858
1233
|
} })))), e.registerTool("manage_webhook", {
|
|
859
1234
|
title: "Create, update, or delete a webhook subscription, or rotate its secret",
|
|
860
|
-
description: "action=create requires name + url and returns the signing secret. action=update/delete/rotate_secret/retire_secret require id. update changes only the fields you pass and keeps the rest; pass an empty list to widen that filter back to \"all\". projects take project keys or ids; environments take \"<project>/<environment>\" keys (e.g. \"web/production\") or ids. eventTypes come from list_webhooks → availableEventTypes. create and rotate_secret return a secret that is NEVER shown again: relay it to the user verbatim so they can store it. rotate_secret adds a new active secret while the old one keeps signing; retire_secret (secretId from list_webhooks) removes one and is refused for the last active secret. A project-restricted service token must list at least one project, all in its scope. " +
|
|
1235
|
+
description: "action=create requires name + url and returns the signing secret. action=update/delete/rotate_secret/retire_secret require id. update changes only the fields you pass and keeps the rest; pass an empty list to widen that filter back to \"all\". projects take project keys or ids; environments take \"<project>/<environment>\" keys (e.g. \"web/production\") or ids. eventTypes come from list_webhooks → availableEventTypes. create and rotate_secret return a secret that is NEVER shown again: relay it to the user verbatim so they can store it. rotate_secret adds a new active secret while the old one keeps signing; retire_secret (secretId from list_webhooks) removes one and is refused for the last active secret. A project-restricted service token must list at least one project, all in its scope. " + K,
|
|
861
1236
|
inputSchema: n.object({
|
|
862
1237
|
action: n.enum([
|
|
863
1238
|
"create",
|
|
@@ -876,11 +1251,11 @@ function H(e, t) {
|
|
|
876
1251
|
secretId: n.string().optional().describe("Required for retire_secret"),
|
|
877
1252
|
idempotency_key: n.string().optional().describe("Idempotency-Key header for create / rotate_secret")
|
|
878
1253
|
}),
|
|
879
|
-
outputSchema:
|
|
1254
|
+
outputSchema: T(y("POST /api/v1/orgs/{org}/webhooks"), E({
|
|
880
1255
|
id: { type: "string" },
|
|
881
1256
|
updated: { type: "boolean" },
|
|
882
|
-
name:
|
|
883
|
-
url:
|
|
1257
|
+
name: _("string"),
|
|
1258
|
+
url: _("string"),
|
|
884
1259
|
eventTypes: {
|
|
885
1260
|
type: ["array", "null"],
|
|
886
1261
|
items: { type: "string" }
|
|
@@ -893,57 +1268,60 @@ function H(e, t) {
|
|
|
893
1268
|
type: ["array", "null"],
|
|
894
1269
|
items: { type: "string" }
|
|
895
1270
|
},
|
|
896
|
-
isEnabled:
|
|
897
|
-
}, ["id", "updated"]),
|
|
1271
|
+
isEnabled: _("boolean")
|
|
1272
|
+
}, ["id", "updated"]), E({ deleted: { type: "string" } }, ["deleted"]), y("POST /api/v1/orgs/{org}/webhooks/{id}/secrets"), E({
|
|
898
1273
|
id: { type: "string" },
|
|
899
1274
|
retiredSecretId: { type: "string" }
|
|
900
1275
|
}, ["id", "retiredSecretId"])),
|
|
901
1276
|
annotations: { destructiveHint: !0 }
|
|
902
|
-
}, async ({ action: e, id: n, name: c, url: l, eventTypes:
|
|
1277
|
+
}, async ({ action: e, id: n, name: c, url: l, eventTypes: u, projects: m, environments: h, enabled: g, secretId: _, idempotency_key: v }) => p(async () => {
|
|
903
1278
|
if (e === "create") {
|
|
904
|
-
if (!c || !l) return
|
|
905
|
-
let e = h && await s(h), n = m && await
|
|
906
|
-
return
|
|
1279
|
+
if (!c || !l) return f(/* @__PURE__ */ Error("action=create requires name and url"));
|
|
1280
|
+
let e = h && await s(h), n = m && await a(m);
|
|
1281
|
+
return d(await t.api.request("POST", r, {
|
|
907
1282
|
body: {
|
|
908
1283
|
name: c,
|
|
909
1284
|
url: l,
|
|
910
1285
|
provider: "GenericHttp",
|
|
911
|
-
eventTypes:
|
|
1286
|
+
eventTypes: u,
|
|
912
1287
|
projectIds: n,
|
|
913
1288
|
environmentIds: e
|
|
914
1289
|
},
|
|
915
1290
|
idempotencyKey: v
|
|
916
1291
|
}));
|
|
917
1292
|
}
|
|
918
|
-
if (!n) return
|
|
1293
|
+
if (!n) return f(/* @__PURE__ */ Error(`action=${e} requires id (see list_webhooks)`));
|
|
919
1294
|
if (e === "update") {
|
|
920
|
-
let e = h && await s(h), r = m && await
|
|
921
|
-
name: c ??
|
|
922
|
-
url: l ??
|
|
923
|
-
eventTypes:
|
|
924
|
-
projectIds: r ??
|
|
925
|
-
environmentIds: e ??
|
|
926
|
-
isEnabled: g ??
|
|
1295
|
+
let e = h && await s(h), r = m && await a(m), { data: o, etag: f } = await t.api.requestWithEtag("GET", i(n)), p = {
|
|
1296
|
+
name: c ?? o.name,
|
|
1297
|
+
url: l ?? o.url,
|
|
1298
|
+
eventTypes: u ?? o.eventTypes,
|
|
1299
|
+
projectIds: r ?? o.projectIds,
|
|
1300
|
+
environmentIds: e ?? o.environmentIds,
|
|
1301
|
+
isEnabled: g ?? o.isEnabled
|
|
927
1302
|
};
|
|
928
|
-
return await t.api.request("PUT", i(n), {
|
|
1303
|
+
return await t.api.request("PUT", i(n), {
|
|
1304
|
+
body: p,
|
|
1305
|
+
ifMatch: f
|
|
1306
|
+
}), d({
|
|
929
1307
|
id: n,
|
|
930
1308
|
updated: !0,
|
|
931
|
-
...
|
|
1309
|
+
...p
|
|
932
1310
|
});
|
|
933
1311
|
}
|
|
934
|
-
return e === "delete" ? (await t.api.request("DELETE", i(n)),
|
|
1312
|
+
return e === "delete" ? (await t.api.request("DELETE", i(n)), d({ deleted: n })) : e === "rotate_secret" ? d(await t.api.request("POST", `${i(n)}/secrets`, { idempotencyKey: v })) : _ ? (await t.api.request("DELETE", `${i(n)}/secrets/${o(_)}`), d({
|
|
935
1313
|
id: n,
|
|
936
1314
|
retiredSecretId: _
|
|
937
|
-
})) :
|
|
1315
|
+
})) : f(/* @__PURE__ */ Error("action=retire_secret requires secretId (see list_webhooks)"));
|
|
938
1316
|
})), e.registerTool("deliver_webhook", {
|
|
939
1317
|
title: "Send a test event or redeliver",
|
|
940
|
-
description: "action=test queues one synthetic flag.toggled event to this subscription alone; action=redeliver (deliveryId from list_webhook_deliveries) re-sends a finished delivery, restarting its retry schedule. Delivery is asynchronous: read list_webhook_deliveries for the outcome. Both are refused for a disabled subscription, and redeliver for a delivery that is still Pending. " +
|
|
1318
|
+
description: "action=test queues one synthetic flag.toggled event to this subscription alone; action=redeliver (deliveryId from list_webhook_deliveries) re-sends a finished delivery, restarting its retry schedule. Delivery is asynchronous: read list_webhook_deliveries for the outcome. Both are refused for a disabled subscription, and redeliver for a delivery that is still Pending. " + K,
|
|
941
1319
|
inputSchema: n.object({
|
|
942
1320
|
action: n.enum(["test", "redeliver"]).describe("test sends a synthetic event; redeliver re-sends deliveryId"),
|
|
943
1321
|
id: n.string().describe("Subscription id (from list_webhooks)"),
|
|
944
1322
|
deliveryId: n.string().optional().describe("Required for redeliver")
|
|
945
1323
|
}),
|
|
946
|
-
outputSchema:
|
|
1324
|
+
outputSchema: T(y("POST /api/v1/orgs/{org}/webhooks/{id}/test"), E({
|
|
947
1325
|
id: { type: "string" },
|
|
948
1326
|
redelivered: { type: "string" }
|
|
949
1327
|
}, ["id", "redelivered"])),
|
|
@@ -951,24 +1329,24 @@ function H(e, t) {
|
|
|
951
1329
|
destructiveHint: !1,
|
|
952
1330
|
openWorldHint: !0
|
|
953
1331
|
}
|
|
954
|
-
}, async ({ action: e, id: n, deliveryId: r }) =>
|
|
1332
|
+
}, async ({ action: e, id: n, deliveryId: r }) => p(async () => e === "test" ? d(await t.api.request("POST", `${i(n)}/test`)) : r ? (await t.api.request("POST", `${i(n)}/deliveries/${o(r)}/redeliver`), d({
|
|
955
1333
|
id: n,
|
|
956
1334
|
redelivered: r
|
|
957
|
-
})) :
|
|
1335
|
+
})) : f(/* @__PURE__ */ Error("action=redeliver requires deliveryId (see list_webhook_deliveries)"))));
|
|
958
1336
|
}
|
|
959
1337
|
//#endregion
|
|
960
1338
|
//#region src/tools/workflows/stale-flags.ts
|
|
961
|
-
var
|
|
962
|
-
function
|
|
1339
|
+
var oe = n.enum(["dead", "stale"]), J = 50;
|
|
1340
|
+
function se(e, t) {
|
|
963
1341
|
e.registerTool("find_stale_flags", {
|
|
964
1342
|
title: "Find stale flags",
|
|
965
|
-
description: `Find flags that look ready for code cleanup: not updated in N days AND either enabled in every environment (verify rollout is complete before removing — per-rule percentage ramps are not inspected) or disabled in every environment (dead — remove flag and code path). A flag whose expiry date (set_flag_expiry) has passed is always a candidate, however recently it was edited; if it is on in some environments and off in others its reason is past-expiry, meaning the owner has to decide which way to fold it. A project can give its temporary flags a default lifetime, so a flag with no date of its own can still be past expiry. Every result carries expiresAtUtc (the date set on the flag), effectiveExpiresAtUtc (the date in effect, from the flag or its project default), expirySource (explicit, project-default, or null), expired and owner (null when unowned). Flags marked permanent (kill switches, ops toggles) are never listed. Pass owner to see one person's stale flags ("me" for your own) or "none" for the unowned ones. Every result also carries blockedBy: the live flags that still list it as a prerequisite, which have to be removed and archived before it ([] when none). blockedBy is null when the server did not classify the flag as a removal candidate, which means unknown, not unblocked. A flag that other live flags list as a prerequisite has to be removed LAST, dependents first: archiving it while a dependent still names it makes that dependent fail its prerequisite check and serve its off variation, so archive_flag refuses it with FLAG_HAS_DEPENDENTS. Checks at most ${
|
|
1343
|
+
description: `Find flags that look ready for code cleanup: not updated in N days AND either enabled in every environment (verify rollout is complete before removing — per-rule percentage ramps are not inspected) or disabled in every environment (dead — remove flag and code path). A flag whose expiry date (set_flag_expiry) has passed is always a candidate, however recently it was edited; if it is on in some environments and off in others its reason is past-expiry, meaning the owner has to decide which way to fold it. A project can give its temporary flags a default lifetime, so a flag with no date of its own can still be past expiry. Every result carries expiresAtUtc (the date set on the flag), effectiveExpiresAtUtc (the date in effect, from the flag or its project default), expirySource (explicit, project-default, or null), expired and owner (null when unowned). Flags marked permanent (kill switches, ops toggles) are never listed. Pass owner to see one person's stale flags ("me" for your own) or "none" for the unowned ones. Every result also carries blockedBy: the live flags that still list it as a prerequisite, which have to be removed and archived before it ([] when none). blockedBy is null when the server did not classify the flag as a removal candidate, which means unknown, not unblocked. A flag that other live flags list as a prerequisite has to be removed LAST, dependents first: archiving it while a dependent still names it makes that dependent fail its prerequisite check and serve its off variation, so archive_flag refuses it with FLAG_HAS_DEPENDENTS. Checks at most ${J} candidates per call, expired flags first.`,
|
|
966
1344
|
inputSchema: n.object({
|
|
967
|
-
project:
|
|
1345
|
+
project: D,
|
|
968
1346
|
days: n.number().int().min(1).optional().default(30).describe("Minimum age in days since last update"),
|
|
969
|
-
owner:
|
|
1347
|
+
owner: R
|
|
970
1348
|
}),
|
|
971
|
-
outputSchema:
|
|
1349
|
+
outputSchema: w({
|
|
972
1350
|
project: { type: "string" },
|
|
973
1351
|
olderThanDays: { type: "integer" },
|
|
974
1352
|
owner: { type: "string" },
|
|
@@ -978,18 +1356,18 @@ function G(e, t) {
|
|
|
978
1356
|
blockedByNote: { type: "string" },
|
|
979
1357
|
stale: {
|
|
980
1358
|
type: "array",
|
|
981
|
-
items:
|
|
1359
|
+
items: E({
|
|
982
1360
|
key: { type: "string" },
|
|
983
1361
|
name: { type: "string" },
|
|
984
1362
|
updatedAt: { type: "string" },
|
|
985
|
-
expiresAtUtc:
|
|
986
|
-
effectiveExpiresAtUtc:
|
|
1363
|
+
expiresAtUtc: _("string"),
|
|
1364
|
+
effectiveExpiresAtUtc: _("string"),
|
|
987
1365
|
expirySource: {
|
|
988
|
-
...
|
|
1366
|
+
..._("string"),
|
|
989
1367
|
description: "explicit, project-default, or null"
|
|
990
1368
|
},
|
|
991
1369
|
expired: { type: "boolean" },
|
|
992
|
-
owner: { anyOf: [
|
|
1370
|
+
owner: { anyOf: [v("PublicFlagOwner"), { type: "null" }] },
|
|
993
1371
|
reason: {
|
|
994
1372
|
type: "string",
|
|
995
1373
|
description: "enabled-everywhere, disabled-everywhere or past-expiry"
|
|
@@ -1010,9 +1388,9 @@ function G(e, t) {
|
|
|
1010
1388
|
"stale"
|
|
1011
1389
|
]),
|
|
1012
1390
|
annotations: { readOnlyHint: !0 }
|
|
1013
|
-
}, async ({ project: e, days: n, owner: r }) =>
|
|
1014
|
-
let
|
|
1015
|
-
let t =
|
|
1391
|
+
}, async ({ project: e, days: n, owner: r }) => p(async () => {
|
|
1392
|
+
let a = await z(t, r), s = `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags`, c = Date.now(), l = c - n * 24 * 60 * 60 * 1e3, u = (e) => e.effectiveExpiresAtUtc ?? e.expiresAtUtc ?? null, f = (e) => e.expirySource ?? (e.expiresAtUtc ? "explicit" : null), p = (e) => {
|
|
1393
|
+
let t = u(e);
|
|
1016
1394
|
return !!t && new Date(t).getTime() <= c;
|
|
1017
1395
|
}, m = [], h;
|
|
1018
1396
|
do {
|
|
@@ -1020,27 +1398,27 @@ function G(e, t) {
|
|
|
1020
1398
|
archived: !1,
|
|
1021
1399
|
limit: 100,
|
|
1022
1400
|
cursor: h,
|
|
1023
|
-
owner:
|
|
1401
|
+
owner: a,
|
|
1024
1402
|
permanent: !1
|
|
1025
1403
|
} });
|
|
1026
1404
|
m.push(...(e.items ?? []).filter((e) => !!e.key && !!e.name && !!e.updatedAt && (new Date(e.updatedAt).getTime() < l || p(e)))), h = e.next_cursor ?? void 0;
|
|
1027
1405
|
} while (h);
|
|
1028
1406
|
m.sort((e, t) => Number(p(t)) - Number(p(e)));
|
|
1029
|
-
let g = m.length >
|
|
1407
|
+
let g = m.length > J, _ = m.slice(0, J), v = [];
|
|
1030
1408
|
for (let e of _) {
|
|
1031
|
-
let n = await t.api.request("GET", `${s}/${
|
|
1409
|
+
let n = await t.api.request("GET", `${s}/${o(e.key)}/environments`);
|
|
1032
1410
|
if (n.length === 0) continue;
|
|
1033
|
-
let r = p(e), i = n.every((e) => e.isEnabled),
|
|
1034
|
-
(i ||
|
|
1411
|
+
let r = p(e), i = n.every((e) => e.isEnabled), a = n.every((e) => !e.isEnabled);
|
|
1412
|
+
(i || a || r) && v.push({
|
|
1035
1413
|
key: e.key,
|
|
1036
1414
|
name: e.name,
|
|
1037
1415
|
updatedAt: e.updatedAt,
|
|
1038
1416
|
expiresAtUtc: e.expiresAtUtc ?? null,
|
|
1039
|
-
effectiveExpiresAtUtc:
|
|
1417
|
+
effectiveExpiresAtUtc: u(e),
|
|
1040
1418
|
expirySource: f(e),
|
|
1041
1419
|
expired: r,
|
|
1042
1420
|
owner: e.owner ?? null,
|
|
1043
|
-
reason: i ? "enabled-everywhere" :
|
|
1421
|
+
reason: i ? "enabled-everywhere" : a ? "disabled-everywhere" : "past-expiry",
|
|
1044
1422
|
environments: n.length,
|
|
1045
1423
|
blockedBy: null
|
|
1046
1424
|
});
|
|
@@ -1062,13 +1440,13 @@ function G(e, t) {
|
|
|
1062
1440
|
if (!(e instanceof i)) throw e;
|
|
1063
1441
|
y = `Could not read removal-candidates (${e.status} ${e.envelope.error}), so blockedBy is unknown for every flag. archive_flag still refuses any flag that a live flag depends on (FLAG_HAS_DEPENDENTS).`;
|
|
1064
1442
|
}
|
|
1065
|
-
return
|
|
1443
|
+
return d({
|
|
1066
1444
|
project: e,
|
|
1067
1445
|
olderThanDays: n,
|
|
1068
|
-
...
|
|
1446
|
+
...a ? { owner: a } : {},
|
|
1069
1447
|
checked: _.length,
|
|
1070
1448
|
truncated: g,
|
|
1071
|
-
...g ? { note: `Only the first ${
|
|
1449
|
+
...g ? { note: `Only the first ${J} of ${m.length} candidates were checked.` } : {},
|
|
1072
1450
|
...y ? { blockedByNote: y } : {},
|
|
1073
1451
|
stale: v
|
|
1074
1452
|
});
|
|
@@ -1076,17 +1454,17 @@ function G(e, t) {
|
|
|
1076
1454
|
title: "List removal candidates",
|
|
1077
1455
|
description: "List the flags the server is confident can be removed from code, the same list the Featureflip flag cleanup GitHub Action works from. Each item has key, reason, status (Dead or Stale), treatment (true = keep the on-branch, false = keep the off-branch) and blockedBy: the live flags that still list it as a prerequisite. Only remove a flag whose blockedBy is empty. A flag that other live flags list as a prerequisite has to be removed LAST, dependents first: archiving it while a dependent still names it makes that dependent fail its prerequisite check and serve its off variation, so archive_flag refuses it with FLAG_HAS_DEPENDENTS. staleness \"dead\" (the default) returns only dead flags, \"stale\" adds stale ones. Paginated via cursor.",
|
|
1078
1456
|
inputSchema: n.object({
|
|
1079
|
-
project:
|
|
1080
|
-
staleness:
|
|
1081
|
-
...
|
|
1457
|
+
project: D,
|
|
1458
|
+
staleness: oe.optional().describe("Minimum staleness tier: dead (default) or stale"),
|
|
1459
|
+
...A
|
|
1082
1460
|
}),
|
|
1083
|
-
outputSchema:
|
|
1461
|
+
outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/flags/removal-candidates"),
|
|
1084
1462
|
annotations: { readOnlyHint: !0 }
|
|
1085
|
-
}, async ({ project: e, ...n }) =>
|
|
1463
|
+
}, async ({ project: e, ...n }) => p(async () => d(await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/removal-candidates`, { query: n }))));
|
|
1086
1464
|
}
|
|
1087
1465
|
//#endregion
|
|
1088
1466
|
//#region src/tools/workflows/snippets.ts
|
|
1089
|
-
var
|
|
1467
|
+
var ce = [
|
|
1090
1468
|
"js",
|
|
1091
1469
|
"node",
|
|
1092
1470
|
"browser",
|
|
@@ -1098,16 +1476,16 @@ var K = [
|
|
|
1098
1476
|
"php",
|
|
1099
1477
|
"ruby",
|
|
1100
1478
|
"swift"
|
|
1101
|
-
],
|
|
1479
|
+
], le = [
|
|
1102
1480
|
"browser",
|
|
1103
1481
|
"react",
|
|
1104
1482
|
"swift"
|
|
1105
1483
|
];
|
|
1106
|
-
function
|
|
1107
|
-
return
|
|
1484
|
+
function ue(e) {
|
|
1485
|
+
return le.includes(e);
|
|
1108
1486
|
}
|
|
1109
1487
|
var Y = "Uses a SERVER-side SDK key (Featureflip dashboard → environment → SDK keys).", X = "Uses a CLIENT-side SDK key (safe to ship to browsers/apps).";
|
|
1110
|
-
function
|
|
1488
|
+
function de(e, t) {
|
|
1111
1489
|
switch (e) {
|
|
1112
1490
|
case "js": return {
|
|
1113
1491
|
install: "npm install @featureflip/js",
|
|
@@ -1257,7 +1635,7 @@ if enabled {
|
|
|
1257
1635
|
}
|
|
1258
1636
|
//#endregion
|
|
1259
1637
|
//#region src/tools/workflows/wrap-feature.ts
|
|
1260
|
-
function
|
|
1638
|
+
function Z(e, t) {
|
|
1261
1639
|
e.registerTool("wrap_feature", {
|
|
1262
1640
|
title: "Wrap a feature in a new flag",
|
|
1263
1641
|
description: "Create a Boolean feature flag and get back the SDK code snippet to guard the new code path with it. Returns the snippet only — apply the edit yourself. The flag starts DISABLED in every environment; enable it with toggle_flag when ready.",
|
|
@@ -1267,12 +1645,12 @@ function ie(e, t) {
|
|
|
1267
1645
|
name: n.string().optional().describe("Display name; defaults to the key"),
|
|
1268
1646
|
description: n.string().optional().describe("What this flag guards"),
|
|
1269
1647
|
tags: n.array(n.string()).optional().describe("Tags for filtering, e.g. team or area"),
|
|
1270
|
-
language: n.enum(
|
|
1648
|
+
language: n.enum(ce).describe("SDK language of the codebase being edited"),
|
|
1271
1649
|
idempotency_key: n.string().optional().describe("Idempotency-Key header for safe retries")
|
|
1272
1650
|
}),
|
|
1273
|
-
outputSchema:
|
|
1274
|
-
flag:
|
|
1275
|
-
integration:
|
|
1651
|
+
outputSchema: w({
|
|
1652
|
+
flag: y("POST /api/v1/orgs/{org}/projects/{project}/flags"),
|
|
1653
|
+
integration: E({
|
|
1276
1654
|
language: { type: "string" },
|
|
1277
1655
|
install: { type: "string" },
|
|
1278
1656
|
code: { type: "string" },
|
|
@@ -1288,25 +1666,25 @@ function ie(e, t) {
|
|
|
1288
1666
|
"next_steps"
|
|
1289
1667
|
]),
|
|
1290
1668
|
annotations: { destructiveHint: !1 }
|
|
1291
|
-
}, async ({ project: e, key: n, name: r, description: i, tags:
|
|
1292
|
-
let l = await t.api.request("POST", `/api/v1/orgs/${
|
|
1669
|
+
}, async ({ project: e, key: n, name: r, description: i, tags: a, language: s, idempotency_key: c }) => p(async () => {
|
|
1670
|
+
let l = await t.api.request("POST", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags`, {
|
|
1293
1671
|
body: {
|
|
1294
1672
|
key: n,
|
|
1295
1673
|
name: r ?? n,
|
|
1296
1674
|
type: "Boolean",
|
|
1297
1675
|
description: i,
|
|
1298
|
-
tags:
|
|
1299
|
-
...
|
|
1676
|
+
tags: a,
|
|
1677
|
+
...ue(s) ? { clientSideVisible: !0 } : {}
|
|
1300
1678
|
},
|
|
1301
1679
|
idempotencyKey: c
|
|
1302
|
-
}),
|
|
1303
|
-
return
|
|
1680
|
+
}), u = de(s, n);
|
|
1681
|
+
return d({
|
|
1304
1682
|
flag: l,
|
|
1305
1683
|
integration: {
|
|
1306
1684
|
language: s,
|
|
1307
|
-
install:
|
|
1308
|
-
code:
|
|
1309
|
-
notes:
|
|
1685
|
+
install: u.install,
|
|
1686
|
+
code: u.code,
|
|
1687
|
+
notes: u.notes
|
|
1310
1688
|
},
|
|
1311
1689
|
next_steps: [
|
|
1312
1690
|
"Apply the snippet around the new code path.",
|
|
@@ -1318,12 +1696,12 @@ function ie(e, t) {
|
|
|
1318
1696
|
}
|
|
1319
1697
|
//#endregion
|
|
1320
1698
|
//#region src/server.ts
|
|
1321
|
-
function
|
|
1699
|
+
function fe(t) {
|
|
1322
1700
|
let n = new e({
|
|
1323
1701
|
name: "featureflip",
|
|
1324
1702
|
version: r
|
|
1325
1703
|
});
|
|
1326
|
-
return
|
|
1704
|
+
return ee(n, t), j(n, t), N(n, t), te(n, t), ne(n, t), ie(n, t), U(n, t), W(n, t), q(n, t), se(n, t), Z(n, t), n;
|
|
1327
1705
|
}
|
|
1328
1706
|
//#endregion
|
|
1329
1707
|
//#region src/config.ts
|
|
@@ -1336,14 +1714,14 @@ function $(e = process.env) {
|
|
|
1336
1714
|
org: e.FEATUREFLIP_ORG?.trim() || void 0
|
|
1337
1715
|
} : null;
|
|
1338
1716
|
}
|
|
1339
|
-
function
|
|
1717
|
+
function pe(e = process.env) {
|
|
1340
1718
|
let t = $(e);
|
|
1341
1719
|
if (!t) throw Error(Q);
|
|
1342
1720
|
return t;
|
|
1343
1721
|
}
|
|
1344
1722
|
//#endregion
|
|
1345
1723
|
//#region src/org.ts
|
|
1346
|
-
async function
|
|
1724
|
+
async function me(e, t) {
|
|
1347
1725
|
if (t) return t;
|
|
1348
1726
|
let n = (await e.request("GET", "/api/v1/orgs", { query: { limit: 100 } })).items ?? [];
|
|
1349
1727
|
if (n.length === 1) {
|
|
@@ -1354,4 +1732,4 @@ async function oe(e, t) {
|
|
|
1354
1732
|
throw n.length === 0 ? Error("The token can see no organizations. Check the token in the Featureflip dashboard.") : Error(`The token can see ${n.length} organizations — set FEATUREFLIP_ORG to one of: ` + n.map((e) => e.slug ?? "?").join(", "));
|
|
1355
1733
|
}
|
|
1356
1734
|
//#endregion
|
|
1357
|
-
export {
|
|
1735
|
+
export { fe as a, r as c, $ as i, Q as n, i as o, pe as r, u as s, me as t };
|