@featureflip/mcp 0.1.13 → 0.2.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.
@@ -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.1.13",
7
+ version: "0.2.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 o = /* @__PURE__ */ new Set([
73
+ var s = /* @__PURE__ */ new Set([
71
74
  502,
72
75
  503,
73
76
  504
74
- ]), s = /* @__PURE__ */ new Set([
77
+ ]), c = /* @__PURE__ */ new Set([
75
78
  "GET",
76
79
  "HEAD",
77
80
  "PUT",
78
81
  "DELETE"
79
- ]), c = [250, 1e3], l = class {
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 a = {
95
+ let o = {
90
96
  Authorization: `Bearer ${this.opts.token}`,
91
97
  Accept: "application/json"
92
- }, l;
93
- n.body !== void 0 && (a["Content-Type"] = "application/json", l = JSON.stringify(n.body)), n.idempotencyKey && (a["Idempotency-Key"] = n.idempotencyKey);
94
- let u = s.has(e) || n.idempotencyKey !== void 0, d;
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 < c.length;
102
+ let n = t < l.length;
97
103
  try {
98
- d = await this.fetchImpl(r.toString(), {
104
+ f = await this.fetchImpl(r.toString(), {
99
105
  method: e,
100
- headers: a,
101
- body: l
106
+ headers: o,
107
+ body: u
102
108
  });
103
109
  } catch (e) {
104
- if (!u || !n) throw e;
105
- await this.sleep(c[t]);
110
+ if (!d || !n) throw e;
111
+ await this.sleep(l[t]);
106
112
  continue;
107
113
  }
108
- if (!(u ? o.has(d.status) : d.status === 503) || !n) break;
109
- await d.body?.cancel(), await this.sleep(c[t]);
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
- if (d.status !== 204) {
112
- if (!d.ok) {
113
- let e;
114
- try {
115
- if (e = await d.json(), typeof e?.error != "string") throw Error("not an envelope");
116
- } catch {
117
- e = {
118
- error: `http_${d.status}`,
119
- message: `HTTP ${d.status} from ${r.pathname}`
120
- };
121
- }
122
- throw new i(d.status, e);
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
- return await d.json();
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 u(e) {
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 d(e) {
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 f(e) {
171
+ async function p(e) {
160
172
  try {
161
173
  return await e();
162
174
  } catch (e) {
163
- return d(e);
175
+ return f(e);
164
176
  }
165
177
  }
166
- var p = {
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
- }, m = p.$defs, h = p.endpoints, g = (e) => ({ type: [e, "null"] });
202
- function _(e) {
203
- if (!m[e]) throw Error(`no API schema named ${e}`);
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 v(e) {
207
- let t = h[e];
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 _(t);
221
+ return v(t);
210
222
  }
211
- function y(e, t = /* @__PURE__ */ new Set()) {
212
- if (Array.isArray(e)) for (let n of e) y(n, t);
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), y(m[e], t));
216
- } else y(r, t);
227
+ t.has(e) || (t.add(e), b(h[e], t));
228
+ } else b(r, t);
217
229
  return t;
218
230
  }
219
- function b(e) {
220
- let n = [...y(e)].sort(), r = {
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, m[e]]))), t(r);
236
+ return n.length && (r.$defs = Object.fromEntries(n.map((e) => [e, h[e]]))), t(r);
225
237
  }
226
- function x(e) {
227
- let t = h[e];
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 b({
230
- ...m[t],
241
+ return x({
242
+ ...h[t],
231
243
  type: "object"
232
244
  });
233
245
  }
234
- function ee(e, t) {
235
- let n = h[e];
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 = m[n];
238
- return b({
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 S(e, t = [], n) {
247
- return b({
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 C(...e) {
254
- return b({ anyOf: e });
265
+ function T(...e) {
266
+ return x({ anyOf: e });
255
267
  }
256
- function w(e, t = []) {
268
+ function E(e, t = []) {
257
269
  return {
258
270
  type: "object",
259
271
  properties: e,
@@ -262,54 +274,264 @@ function w(e, t = []) {
262
274
  }
263
275
  //#endregion
264
276
  //#region src/tools/params.ts
265
- var T = n.string().describe("Project key"), E = n.string().describe("Flag key or id"), D = n.string().describe("Environment key, e.g. production"), O = {
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 k(e, t) {
283
+ function j(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({ ...O }),
276
- outputSchema: x("GET /api/v1/orgs/{org}/projects"),
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 }) => f(async () => u(await t.api.request("GET", `/api/v1/orgs/${a(t.org)}/projects`, { query: {
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 A(e, t) {
375
+ function ee(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: T,
291
- ...O
380
+ project: D,
381
+ ...A
292
382
  }),
293
- outputSchema: x("GET /api/v1/orgs/{org}/projects/{project}/environments"),
383
+ outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/environments"),
294
384
  annotations: { readOnlyHint: !0 }
295
- }, async ({ project: e, limit: n, cursor: r }) => f(async () => u(await t.api.request("GET", `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/environments`, { query: {
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 te(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 N = {
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
+ };
513
+ function P(e) {
514
+ 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.`);
515
+ }
516
+ function F({ data: e, etag: t }) {
517
+ return t ? {
518
+ ...e,
519
+ etag: t
520
+ } : e;
299
521
  }
300
522
  //#endregion
301
523
  //#region src/tools/segments.ts
302
- function j(e, t) {
524
+ function ne(e, t) {
303
525
  e.registerTool("list_segments", {
304
526
  title: "List user segments",
305
527
  description: "List reusable user segments in a project. Segments are referenced from targeting rules via userSegmentId.",
306
528
  inputSchema: n.object({
307
529
  project: n.string().describe("Project key"),
308
- ...O
530
+ ...A
309
531
  }),
310
- outputSchema: x("GET /api/v1/orgs/{org}/projects/{project}/segments"),
532
+ outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/segments"),
311
533
  annotations: { readOnlyHint: !0 }
312
- }, async ({ project: e, limit: n, cursor: r }) => f(async () => u(await t.api.request("GET", `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/segments`, { query: {
534
+ }, 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
535
  limit: n,
314
536
  cursor: r
315
537
  } })))), e.registerTool("get_segment", {
@@ -319,14 +541,81 @@ function j(e, t) {
319
541
  project: n.string().describe("Project key"),
320
542
  segment: n.string().describe("Segment key or id")
321
543
  }),
322
- outputSchema: x("GET /api/v1/orgs/{org}/projects/{project}/segments/{segment}"),
544
+ outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/segments/{segment}", { etag: N }),
323
545
  annotations: { readOnlyHint: !0 }
324
- }, async ({ project: e, segment: n }) => f(async () => u(await t.api.request("GET", `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/segments/${a(n)}`))));
546
+ }, async ({ project: e, segment: n }) => p(async () => d(F(await t.api.requestWithEtag("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/segments/${o(n)}`)))));
547
+ let r = n.object({
548
+ attribute: n.string().describe("Context attribute name, e.g. plan, country, user_id"),
549
+ 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"),
550
+ values: n.array(n.string()).describe("Values compared against the attribute"),
551
+ negate: n.boolean().optional().default(!1).describe("Invert the match")
552
+ }), i = (e) => ({
553
+ attribute: e.attribute,
554
+ operator: e.operator,
555
+ values: e.values,
556
+ negate: e.negate
557
+ });
558
+ e.registerTool("manage_segment", {
559
+ title: "Create, update, or delete a user segment",
560
+ 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.",
561
+ inputSchema: n.object({
562
+ action: n.enum([
563
+ "create",
564
+ "update",
565
+ "delete"
566
+ ]).describe("create needs key + name; update and delete need segment"),
567
+ project: D,
568
+ segment: n.string().optional().describe("Segment key or id; required for update and delete"),
569
+ key: n.string().optional().describe("New segment key, required for create; immutable afterwards"),
570
+ name: n.string().optional().describe("Display name; required for create"),
571
+ description: n.string().optional().describe("What the segment means; \"\" clears it"),
572
+ conditions: n.array(r).optional().describe("Conditions a user must match to be in the segment; on update, replaces the whole list"),
573
+ ifMatch: P("get_segment")
574
+ }),
575
+ outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/segments"), E({
576
+ segment: { type: "string" },
577
+ updated: { type: "boolean" },
578
+ name: _("string"),
579
+ description: _("string"),
580
+ conditions: {
581
+ type: ["array", "null"],
582
+ items: { type: "object" }
583
+ }
584
+ }, ["segment", "updated"]), E({ deleted: { type: "string" } }, ["deleted"])),
585
+ annotations: { destructiveHint: !0 }
586
+ }, async ({ action: e, project: n, segment: r, key: a, name: s, description: c, conditions: l, ifMatch: u }) => p(async () => {
587
+ let p = `/api/v1/orgs/${o(t.org)}/projects/${o(n)}/segments`;
588
+ if (u !== void 0 && e !== "update") return f(/* @__PURE__ */ Error(`ifMatch is only supported on action=update; action=${e} cannot be made conditional`));
589
+ if (e === "create") return !a || !s ? f(/* @__PURE__ */ Error("action=create requires key and name")) : d(await t.api.request("POST", p, { body: {
590
+ key: a,
591
+ name: s,
592
+ description: c,
593
+ conditions: l ?? []
594
+ } }));
595
+ if (!r) return f(/* @__PURE__ */ Error(`action=${e} requires segment (see list_segments)`));
596
+ let m = `${p}/${o(r)}`;
597
+ if (e === "update") {
598
+ let { data: e, etag: n } = await t.api.requestWithEtag("GET", m), a = {
599
+ name: s ?? e.name,
600
+ description: c ?? e.description,
601
+ conditions: l ?? (e.conditions ?? []).map(i)
602
+ };
603
+ return await t.api.request("PUT", m, {
604
+ body: a,
605
+ ifMatch: u ?? n
606
+ }), d({
607
+ segment: r,
608
+ updated: !0,
609
+ ...a
610
+ });
611
+ }
612
+ return await t.api.request("DELETE", m), d({ deleted: r });
613
+ }));
325
614
  }
326
615
  //#endregion
327
616
  //#region src/tools/owner.ts
328
- var M = n.string().optional().describe("Only flags with this owner: an email, \"me\" for the token's own user, or \"none\" for unowned flags");
329
- async function N(e, t) {
617
+ var I = n.string().optional().describe("Only flags with this owner: an email, \"me\" for the token's own user, or \"none\" for unowned flags");
618
+ async function L(e, t) {
330
619
  let n = t?.trim();
331
620
  if (!n) return;
332
621
  if (n.toLowerCase() !== "me") return n;
@@ -336,48 +625,48 @@ async function N(e, t) {
336
625
  }
337
626
  //#endregion
338
627
  //#region src/tools/flags.ts
339
- var P = n.enum([
628
+ var R = n.enum([
340
629
  "Boolean",
341
630
  "String",
342
631
  "Number",
343
632
  "Json"
344
633
  ]);
345
- function F(e, t) {
346
- let r = (e) => `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/flags`;
634
+ function z(e, t) {
635
+ let r = (e) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags`;
347
636
  e.registerTool("list_flags", {
348
637
  title: "List feature flags",
349
638
  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
639
  inputSchema: n.object({
351
- project: T,
640
+ project: D,
352
641
  search: n.string().optional().describe("Substring of the flag key or name"),
353
642
  tag: n.string().optional().describe("Only flags carrying this tag"),
354
- type: P.optional().describe("Only flags of this type"),
643
+ type: R.optional().describe("Only flags of this type"),
355
644
  archived: n.boolean().optional().describe("true = only archived, false = only active"),
356
- owner: M,
357
- ...O
645
+ owner: I,
646
+ ...A
358
647
  }),
359
- outputSchema: x("GET /api/v1/orgs/{org}/projects/{project}/flags"),
648
+ outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/flags"),
360
649
  annotations: { readOnlyHint: !0 }
361
- }, async ({ project: e, owner: n, ...i }) => f(async () => u(await t.api.request("GET", r(e), { query: {
650
+ }, async ({ project: e, owner: n, ...i }) => p(async () => d(await t.api.request("GET", r(e), { query: {
362
651
  ...i,
363
- owner: await N(t, n)
652
+ owner: await L(t, n)
364
653
  } })))), e.registerTool("get_flag", {
365
654
  title: "Get feature flag",
366
655
  description: "Get one feature flag with its variations and metadata, including its owner (null when unowned). Address by flag key or id.",
367
656
  inputSchema: n.object({
368
- project: T,
369
- flag: E
657
+ project: D,
658
+ flag: O
370
659
  }),
371
- outputSchema: x("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}"),
660
+ outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}", { etag: N }),
372
661
  annotations: { readOnlyHint: !0 }
373
- }, async ({ project: e, flag: n }) => f(async () => u(await t.api.request("GET", `${r(e)}/${a(n)}`)))), e.registerTool("create_flag", {
662
+ }, async ({ project: e, flag: n }) => p(async () => d(F(await t.api.requestWithEtag("GET", `${r(e)}/${o(n)}`))))), e.registerTool("create_flag", {
374
663
  title: "Create feature flag",
375
664
  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
665
  inputSchema: n.object({
377
- project: T,
666
+ project: D,
378
667
  key: n.string().describe("Unique flag key, e.g. checkout-v2"),
379
668
  name: n.string().describe("Display name"),
380
- type: P.describe("Value type; Boolean gets true/false variations automatically"),
669
+ type: R.describe("Value type; Boolean gets true/false variations automatically"),
381
670
  description: n.string().optional().describe("What the flag controls"),
382
671
  tags: n.array(n.string()).optional().describe("Tags for filtering, e.g. team or area"),
383
672
  clientSideVisible: n.boolean().optional().describe("Expose to client-side SDKs (browser/mobile)"),
@@ -392,23 +681,24 @@ function F(e, t) {
392
681
  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
682
  idempotency_key: n.string().optional().describe("Idempotency-Key header for safe retries")
394
683
  }),
395
- outputSchema: x("POST /api/v1/orgs/{org}/projects/{project}/flags"),
684
+ outputSchema: S("POST /api/v1/orgs/{org}/projects/{project}/flags"),
396
685
  annotations: { destructiveHint: !1 }
397
- }, async ({ project: e, idempotency_key: n, ...i }) => f(async () => u(await t.api.request("POST", r(e), {
686
+ }, async ({ project: e, idempotency_key: n, ...i }) => p(async () => d(await t.api.request("POST", r(e), {
398
687
  body: i,
399
688
  idempotencyKey: n
400
689
  })))), e.registerTool("update_flag", {
401
690
  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.",
691
+ 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
692
  inputSchema: n.object({
404
- project: T,
405
- flag: E,
693
+ project: D,
694
+ flag: O,
406
695
  name: n.string().optional().describe("New display name"),
407
696
  description: n.string().optional().describe("New description; \"\" clears it"),
408
697
  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")
698
+ clientSideVisible: n.boolean().optional().describe("Expose to client-side SDKs (browser/mobile); false hides the flag from them entirely"),
699
+ ifMatch: P("get_flag")
410
700
  }),
411
- outputSchema: S({
701
+ outputSchema: w({
412
702
  project: { type: "string" },
413
703
  flag: { type: "string" },
414
704
  updated: { type: "boolean" }
@@ -418,14 +708,17 @@ function F(e, t) {
418
708
  "updated"
419
709
  ]),
420
710
  annotations: { destructiveHint: !0 }
421
- }, async ({ project: e, flag: n, name: i, description: o, tags: s, clientSideVisible: c }) => f(async () => {
422
- let l = `${r(e)}/${a(n)}`, d = i === void 0 || o === void 0 ? await t.api.request("GET", l) : void 0, f = {
423
- name: i ?? d?.name,
424
- description: o ?? d?.description,
711
+ }, async ({ project: e, flag: n, name: i, description: a, tags: s, clientSideVisible: c, ifMatch: l }) => p(async () => {
712
+ 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 = {
713
+ name: i ?? p?.name,
714
+ description: a ?? p?.description,
425
715
  tags: s,
426
716
  clientSideVisible: c
427
717
  };
428
- return await t.api.request("PUT", l, { body: f }), u({
718
+ return await t.api.request("PUT", u, {
719
+ body: m,
720
+ ifMatch: l ?? f?.etag
721
+ }), d({
429
722
  project: e,
430
723
  flag: n,
431
724
  updated: !0
@@ -434,14 +727,14 @@ function F(e, t) {
434
727
  title: "Set or clear flag expiry",
435
728
  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
729
  inputSchema: n.object({
437
- project: T,
438
- flag: E,
730
+ project: D,
731
+ flag: O,
439
732
  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
733
  }),
441
- outputSchema: S({
734
+ outputSchema: w({
442
735
  project: { type: "string" },
443
736
  flag: { type: "string" },
444
- expiresAtUtc: g("string")
737
+ expiresAtUtc: _("string")
445
738
  }, [
446
739
  "project",
447
740
  "flag",
@@ -451,9 +744,9 @@ function F(e, t) {
451
744
  destructiveHint: !1,
452
745
  idempotentHint: !0
453
746
  }
454
- }, async ({ project: e, flag: n, expiresAtUtc: i }) => f(async () => {
455
- let o = `${r(e)}/${a(n)}/expiry`;
456
- return i === null ? await t.api.request("DELETE", o) : await t.api.request("PUT", o, { body: { expiresAtUtc: i } }), u({
747
+ }, async ({ project: e, flag: n, expiresAtUtc: i }) => p(async () => {
748
+ let a = `${r(e)}/${o(n)}/expiry`;
749
+ return i === null ? await t.api.request("DELETE", a) : await t.api.request("PUT", a, { body: { expiresAtUtc: i } }), d({
457
750
  project: e,
458
751
  flag: n,
459
752
  expiresAtUtc: i
@@ -462,11 +755,11 @@ function F(e, t) {
462
755
  title: "Mark a flag permanent or temporary",
463
756
  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
757
  inputSchema: n.object({
465
- project: T,
466
- flag: E,
758
+ project: D,
759
+ flag: O,
467
760
  permanent: n.boolean().describe("true to mark the flag permanent, false to make it temporary")
468
761
  }),
469
- outputSchema: S({
762
+ outputSchema: w({
470
763
  project: { type: "string" },
471
764
  flag: { type: "string" },
472
765
  permanent: { type: "boolean" }
@@ -479,9 +772,9 @@ function F(e, t) {
479
772
  destructiveHint: !1,
480
773
  idempotentHint: !0
481
774
  }
482
- }, async ({ project: e, flag: n, permanent: i }) => f(async () => {
483
- let o = `${r(e)}/${a(n)}/permanent`;
484
- return await t.api.request(i ? "PUT" : "DELETE", o), u({
775
+ }, async ({ project: e, flag: n, permanent: i }) => p(async () => {
776
+ let a = `${r(e)}/${o(n)}/permanent`;
777
+ return await t.api.request(i ? "PUT" : "DELETE", a), d({
485
778
  project: e,
486
779
  flag: n,
487
780
  permanent: i
@@ -490,15 +783,15 @@ function F(e, t) {
490
783
  title: "Set or clear flag owner",
491
784
  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
785
  inputSchema: n.object({
493
- project: T,
494
- flag: E,
786
+ project: D,
787
+ flag: O,
495
788
  owner: n.string().nullable().describe("Owner email, \"me\" for the token's own user, or null (or \"none\") to clear the owner")
496
789
  }),
497
- outputSchema: S({
790
+ outputSchema: w({
498
791
  project: { type: "string" },
499
792
  flag: { type: "string" },
500
793
  owner: {
501
- ...g("string"),
794
+ ..._("string"),
502
795
  description: "Owner email now set, or null when unowned"
503
796
  }
504
797
  }, [
@@ -510,9 +803,9 @@ function F(e, t) {
510
803
  destructiveHint: !1,
511
804
  idempotentHint: !0
512
805
  }
513
- }, async ({ project: e, flag: n, owner: i }) => f(async () => {
514
- let o = `${r(e)}/${a(n)}/owner`, s = i?.trim().toLowerCase() === "none" ? void 0 : await N(t, i ?? void 0);
515
- return s === void 0 ? await t.api.request("DELETE", o) : await t.api.request("PUT", o, { body: { email: s } }), u({
806
+ }, async ({ project: e, flag: n, owner: i }) => p(async () => {
807
+ let a = `${r(e)}/${o(n)}/owner`, s = i?.trim().toLowerCase() === "none" ? void 0 : await L(t, i ?? void 0);
808
+ return s === void 0 ? await t.api.request("DELETE", a) : await t.api.request("PUT", a, { body: { email: s } }), d({
516
809
  project: e,
517
810
  flag: n,
518
811
  owner: s ?? null
@@ -521,63 +814,63 @@ function F(e, t) {
521
814
  title: "Delete feature flag",
522
815
  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
816
  inputSchema: n.object({
524
- project: T,
525
- flag: E
817
+ project: D,
818
+ flag: O
526
819
  }),
527
- outputSchema: S({ deleted: { type: "string" } }, ["deleted"]),
820
+ outputSchema: w({ deleted: { type: "string" } }, ["deleted"]),
528
821
  annotations: { destructiveHint: !0 }
529
- }, async ({ project: e, flag: n }) => f(async () => (await t.api.request("DELETE", `${r(e)}/${a(n)}`), u({ deleted: n })))), e.registerTool("archive_flag", {
822
+ }, async ({ project: e, flag: n }) => p(async () => (await t.api.request("DELETE", `${r(e)}/${o(n)}`), d({ deleted: n })))), e.registerTool("archive_flag", {
530
823
  title: "Archive feature flag",
531
824
  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
825
  inputSchema: n.object({
533
- project: T,
534
- flag: E,
826
+ project: D,
827
+ flag: O,
535
828
  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
829
  }),
537
- outputSchema: S({
830
+ outputSchema: w({
538
831
  flag: { type: "string" },
539
832
  archived: { type: "boolean" }
540
833
  }, ["flag", "archived"]),
541
834
  annotations: { destructiveHint: !0 }
542
- }, async ({ project: e, flag: n, force: i }) => f(async () => (await t.api.request("POST", `${r(e)}/${a(n)}/archive`, { query: i ? { force: !0 } : {} }), u({
835
+ }, 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
836
  flag: n,
544
837
  archived: !0
545
838
  })))), e.registerTool("restore_flag", {
546
839
  title: "Restore archived flag",
547
840
  description: "Restore a previously archived flag.",
548
841
  inputSchema: n.object({
549
- project: T,
550
- flag: E
842
+ project: D,
843
+ flag: O
551
844
  }),
552
- outputSchema: S({
845
+ outputSchema: w({
553
846
  flag: { type: "string" },
554
847
  archived: { type: "boolean" }
555
848
  }, ["flag", "archived"]),
556
849
  annotations: { destructiveHint: !1 }
557
- }, async ({ project: e, flag: n }) => f(async () => (await t.api.request("POST", `${r(e)}/${a(n)}/restore`), u({
850
+ }, async ({ project: e, flag: n }) => p(async () => (await t.api.request("POST", `${r(e)}/${o(n)}/restore`), d({
558
851
  flag: n,
559
852
  archived: !1
560
853
  }))));
561
854
  }
562
855
  //#endregion
563
856
  //#region src/tools/flag-environments.ts
564
- var I = n.enum([
857
+ var B = n.enum([
565
858
  "SingleVariation",
566
859
  "PercentageRollout",
567
860
  "TargetedRollout"
568
861
  ]);
569
- function te(e, t) {
570
- let r = (e, n) => `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/flags/${a(n)}`;
862
+ function V(e, t) {
863
+ let r = (e, n) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}`;
571
864
  e.registerTool("toggle_flag", {
572
865
  title: "Toggle flag in environment",
573
866
  description: "Enable or disable a flag in ONE environment. Affects live evaluation immediately — double-check the environment.",
574
867
  inputSchema: n.object({
575
- project: T,
576
- flag: E,
577
- environment: D,
868
+ project: D,
869
+ flag: O,
870
+ environment: k,
578
871
  enabled: n.boolean().describe("true to turn the flag on in this environment, false to turn it off")
579
872
  }),
580
- outputSchema: S({
873
+ outputSchema: w({
581
874
  project: { type: "string" },
582
875
  flag: { type: "string" },
583
876
  environment: { type: "string" },
@@ -589,26 +882,26 @@ function te(e, t) {
589
882
  "enabled"
590
883
  ]),
591
884
  annotations: { destructiveHint: !0 }
592
- }, async ({ project: e, flag: n, environment: i, enabled: o }) => f(async () => (await t.api.request("POST", `${r(e, n)}/environments/${a(i)}/toggle`, { body: { enabled: o } }), u({
885
+ }, 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
886
  project: e,
594
887
  flag: n,
595
888
  environment: i,
596
- enabled: o
889
+ enabled: a
597
890
  })))), e.registerTool("update_flag_environment_config", {
598
891
  title: "Update flag environment config",
599
892
  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
893
  inputSchema: n.object({
601
- project: T,
602
- flag: E,
603
- environment: D,
894
+ project: D,
895
+ flag: O,
896
+ environment: k,
604
897
  defaultVariationId: n.string().describe("Variation id to serve on fallthrough — required by the API"),
605
- strategy: I.optional().describe("Serving strategy; only SingleVariation is currently supported here"),
898
+ strategy: B.optional().describe("Serving strategy; only SingleVariation is currently supported here"),
606
899
  prerequisites: n.array(n.object({
607
900
  prerequisiteFlagKey: n.string(),
608
901
  expectedVariationKey: n.string()
609
902
  })).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
903
  }),
611
- outputSchema: S({
904
+ outputSchema: w({
612
905
  project: { type: "string" },
613
906
  flag: { type: "string" },
614
907
  environment: { type: "string" },
@@ -616,7 +909,7 @@ function te(e, t) {
616
909
  strategy: { type: "string" },
617
910
  prerequisites: {
618
911
  type: "array",
619
- items: w({
912
+ items: E({
620
913
  prerequisiteFlagKey: { type: "string" },
621
914
  expectedVariationKey: { type: "string" }
622
915
  })
@@ -628,32 +921,32 @@ function te(e, t) {
628
921
  "defaultVariationId"
629
922
  ]),
630
923
  annotations: { destructiveHint: !0 }
631
- }, async ({ project: e, flag: n, environment: i, ...o }) => f(async () => (await t.api.request("PUT", `${r(e, n)}/environments/${a(i)}`, { body: o }), u({
924
+ }, 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
925
  project: e,
633
926
  flag: n,
634
927
  environment: i,
635
- ...o
928
+ ...a
636
929
  })))), e.registerTool("flag_status", {
637
930
  title: "Flag status across environments",
638
931
  description: "Compact cross-environment view of one flag: enabled state, strategy, default variation, and prerequisites per environment.",
639
932
  inputSchema: n.object({
640
- project: T,
641
- flag: E
933
+ project: D,
934
+ flag: O
642
935
  }),
643
- outputSchema: S({
644
- key: g("string"),
645
- name: g("string"),
646
- type: g("string"),
936
+ outputSchema: w({
937
+ key: _("string"),
938
+ name: _("string"),
939
+ type: _("string"),
647
940
  archived: { type: "boolean" },
648
- updatedAt: g("string"),
941
+ updatedAt: _("string"),
649
942
  environments: {
650
943
  type: "array",
651
- items: w({
652
- environment: g("string"),
944
+ items: E({
945
+ environment: _("string"),
653
946
  enabled: { type: "boolean" },
654
- strategy: g("string"),
947
+ strategy: _("string"),
655
948
  defaultVariation: {
656
- ...g("string"),
949
+ ..._("string"),
657
950
  description: "Variation key served on fallthrough"
658
951
  },
659
952
  prerequisites: { type: "array" }
@@ -668,9 +961,9 @@ function te(e, t) {
668
961
  "environments"
669
962
  ]),
670
963
  annotations: { readOnlyHint: !0 }
671
- }, async ({ project: e, flag: n }) => f(async () => {
964
+ }, async ({ project: e, flag: n }) => p(async () => {
672
965
  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 u({
966
+ return d({
674
967
  key: i.key ?? null,
675
968
  name: i.name ?? null,
676
969
  type: i.type ?? null,
@@ -688,43 +981,47 @@ function te(e, t) {
688
981
  }
689
982
  //#endregion
690
983
  //#region src/tools/targeting.ts
691
- var ne = n.object({
984
+ var H = n.object({
692
985
  attribute: n.string().describe("Context attribute name, e.g. plan, country, user_id"),
693
986
  operator: n.string().describe("OperatorType member name, case-sensitive — e.g. Equals, NotEquals, Contains, In, GreaterThan"),
694
987
  values: n.array(n.string()),
695
988
  negate: n.boolean().optional().default(!1)
696
- }), L = n.object({
989
+ }), U = n.object({
697
990
  description: n.string().optional(),
698
991
  variationId: n.string().optional().describe("Variation served when the rule matches"),
699
992
  rolloutPercentage: n.number().int().min(0).max(100).optional().describe("Percentage rollout for this rule"),
700
993
  userSegmentId: n.string().optional().describe("Match users in this segment (see list_segments)"),
701
994
  conditionGroups: n.array(n.object({
702
995
  operator: n.enum(["And", "Or"]).describe("How conditions inside this group combine"),
703
- conditions: n.array(ne)
996
+ conditions: n.array(H)
704
997
  })).optional().describe("Groups are ANDed together; conditions inside a group use the group operator")
998
+ }), W = (e) => ({
999
+ ...e,
1000
+ conditionGroups: e.conditionGroups ?? []
705
1001
  });
706
- function R(e, t) {
707
- let r = (e, n, r) => `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/flags/${a(n)}/environments/${a(r)}/targeting`;
1002
+ function G(e, t) {
1003
+ let r = (e, n, r) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}/environments/${o(r)}/targeting`;
708
1004
  e.registerTool("get_targeting", {
709
1005
  title: "Get targeting rules",
710
1006
  description: "Get a flag's current targeting configuration (enabled flag + ordered rules) in one environment.",
711
1007
  inputSchema: n.object({
712
- project: T,
713
- flag: E,
714
- environment: D
1008
+ project: D,
1009
+ flag: O,
1010
+ environment: k
715
1011
  }),
716
- outputSchema: x("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/targeting"),
1012
+ outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/targeting", { etag: N }),
717
1013
  annotations: { readOnlyHint: !0 }
718
- }, async ({ project: e, flag: n, environment: i }) => f(async () => u(await t.api.request("GET", r(e, n, i))))), e.registerTool("update_targeting", {
1014
+ }, async ({ project: e, flag: n, environment: i }) => p(async () => d(F(await t.api.requestWithEtag("GET", r(e, n, i)))))), e.registerTool("update_targeting", {
719
1015
  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.",
1016
+ 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
1017
  inputSchema: n.object({
722
- project: T,
723
- flag: E,
724
- environment: D,
725
- rules: n.array(L).describe("The complete ordered rule list; rules left out are deleted")
1018
+ project: D,
1019
+ flag: O,
1020
+ environment: k,
1021
+ rules: n.array(U).describe("The complete ordered rule list; rules left out are deleted"),
1022
+ ifMatch: P("get_targeting")
726
1023
  }),
727
- outputSchema: S({
1024
+ outputSchema: w({
728
1025
  project: { type: "string" },
729
1026
  flag: { type: "string" },
730
1027
  environment: { type: "string" },
@@ -736,22 +1033,82 @@ function R(e, t) {
736
1033
  "rulesReplaced"
737
1034
  ]),
738
1035
  annotations: { destructiveHint: !0 }
739
- }, async ({ project: e, flag: n, environment: i, rules: a }) => f(async () => (await t.api.request("PUT", r(e, n, i), { body: { rules: a } }), u({
1036
+ }, async ({ project: e, flag: n, environment: i, rules: a, ifMatch: o }) => p(async () => (await t.api.request("PUT", r(e, n, i), {
1037
+ body: { rules: a.map(W) },
1038
+ ifMatch: o
1039
+ }), d({
740
1040
  project: e,
741
1041
  flag: n,
742
1042
  environment: i,
743
1043
  rulesReplaced: a.length
744
- }))));
1044
+ })))), e.registerTool("manage_targeting_rule", {
1045
+ title: "Add, update, remove, or reorder one targeting rule",
1046
+ 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.",
1047
+ inputSchema: n.object({
1048
+ action: n.enum([
1049
+ "add",
1050
+ "update",
1051
+ "remove",
1052
+ "reorder"
1053
+ ]).describe("add needs rule; update needs ruleId + rule; remove needs ruleId; reorder needs ruleIds"),
1054
+ project: D,
1055
+ flag: O,
1056
+ environment: k,
1057
+ ruleId: n.string().optional().describe("Rule id from get_targeting; required for update and remove"),
1058
+ rule: U.optional().describe("Rule fields; required for add and update"),
1059
+ ruleIds: n.array(n.string()).optional().describe("Every rule id exactly once, in evaluation order; required for reorder")
1060
+ }),
1061
+ outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/rules"), E({
1062
+ ruleId: { type: "string" },
1063
+ updated: { type: "boolean" }
1064
+ }, ["ruleId", "updated"]), E({ removed: { type: "string" } }, ["removed"]), E({ reordered: {
1065
+ type: "array",
1066
+ items: { type: "string" }
1067
+ } }, ["reordered"])),
1068
+ annotations: { destructiveHint: !0 }
1069
+ }, async ({ action: e, project: n, flag: r, environment: i, ruleId: a, rule: s, ruleIds: c }) => p(async () => {
1070
+ let l = `/api/v1/orgs/${o(t.org)}/projects/${o(n)}/flags/${o(r)}/environments/${o(i)}/rules`;
1071
+ if (e === "add") return s ? d(await t.api.request("POST", l, { body: W(s) })) : f(/* @__PURE__ */ Error("action=add requires rule"));
1072
+ 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)"));
1073
+ if (!a) return f(/* @__PURE__ */ Error(`action=${e} requires ruleId (see get_targeting)`));
1074
+ let u = `${l}/${o(a)}`;
1075
+ if (e === "update") {
1076
+ if (!s) return f(/* @__PURE__ */ Error("action=update requires rule"));
1077
+ let { data: e, etag: n } = await t.api.requestWithEtag("GET", u), r = {
1078
+ description: s.description ?? e.description,
1079
+ variationId: s.variationId ?? e.variationId,
1080
+ rolloutPercentage: s.rolloutPercentage ?? e.rolloutPercentage,
1081
+ userSegmentId: s.userSegmentId ?? e.userSegmentId,
1082
+ conditionGroups: s.conditionGroups ?? (e.conditionGroups ?? []).map((e) => ({
1083
+ operator: e.operator,
1084
+ conditions: e.conditions.map((e) => ({
1085
+ attribute: e.attribute,
1086
+ operator: e.operator,
1087
+ values: e.values,
1088
+ negate: e.negate
1089
+ }))
1090
+ }))
1091
+ };
1092
+ return await t.api.request("PUT", u, {
1093
+ body: r,
1094
+ ifMatch: n
1095
+ }), d({
1096
+ ruleId: a,
1097
+ updated: !0
1098
+ });
1099
+ }
1100
+ return await t.api.request("DELETE", u), d({ removed: a });
1101
+ }));
745
1102
  }
746
1103
  //#endregion
747
1104
  //#region src/tools/variations.ts
748
- function z(e, t) {
1105
+ function K(e, t) {
749
1106
  e.registerTool("manage_variation", {
750
1107
  title: "Add, update, or remove a variation",
751
1108
  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
1109
  inputSchema: n.object({
753
- project: T,
754
- flag: E,
1110
+ project: D,
1111
+ flag: O,
755
1112
  action: n.enum([
756
1113
  "add",
757
1114
  "update",
@@ -763,41 +1120,41 @@ function z(e, t) {
763
1120
  value: n.string().optional().describe("Variation value serialized as a string; required for add"),
764
1121
  description: n.string().optional().describe("What this variation means")
765
1122
  }),
766
- outputSchema: C(v("POST /api/v1/orgs/{org}/projects/{project}/flags/{flag}/variations"), w({ updated: {
1123
+ outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/flags/{flag}/variations"), E({ updated: {
767
1124
  type: "string",
768
1125
  description: "Id of the updated variation"
769
- } }, ["updated"]), w({ removed: {
1126
+ } }, ["updated"]), E({ removed: {
770
1127
  type: "string",
771
1128
  description: "Id of the removed variation"
772
1129
  } }, ["removed"])),
773
1130
  annotations: { destructiveHint: !0 }
774
- }, async ({ project: e, flag: n, action: r, variationId: i, key: o, name: s, value: c, description: l }) => f(async () => {
775
- let f = `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/flags/${a(n)}/variations`;
776
- return r === "add" ? !o || c === void 0 ? d(/* @__PURE__ */ Error("action=add requires key and value")) : u(await t.api.request("POST", f, { body: {
777
- key: o,
1131
+ }, async ({ project: e, flag: n, action: r, variationId: i, key: a, name: s, value: c, description: l }) => p(async () => {
1132
+ let u = `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}/variations`;
1133
+ return r === "add" ? !a || c === void 0 ? f(/* @__PURE__ */ Error("action=add requires key and value")) : d(await t.api.request("POST", u, { body: {
1134
+ key: a,
778
1135
  name: s,
779
1136
  value: c,
780
1137
  description: l
781
- } })) : i ? r === "update" ? (await t.api.request("PUT", `${f}/${a(i)}`, { body: {
1138
+ } })) : i ? r === "update" ? (await t.api.request("PUT", `${u}/${o(i)}`, { body: {
782
1139
  name: s,
783
1140
  value: c,
784
1141
  description: l
785
- } }), u({ updated: i })) : (await t.api.request("DELETE", `${f}/${a(i)}`), u({ removed: i })) : d(/* @__PURE__ */ Error(`action=${r} requires variationId (see get_flag for ids)`));
1142
+ } }), 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
1143
  }));
787
1144
  }
788
1145
  //#endregion
789
1146
  //#region src/tools/webhooks.ts
790
- var B = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, V = "Requires an Admin token. A 404 on every webhook call means webhooks are not enabled for the organization.";
791
- function H(e, t) {
792
- let r = `/api/v1/orgs/${a(t.org)}/webhooks`, i = (e) => `${r}/${a(e)}`;
793
- async function o(e) {
1147
+ var q = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, J = "Requires an Admin token. A 404 on every webhook call means webhooks are not enabled for the organization.";
1148
+ function re(e, t) {
1149
+ let r = `/api/v1/orgs/${o(t.org)}/webhooks`, i = (e) => `${r}/${o(e)}`;
1150
+ async function a(e) {
794
1151
  let n = [];
795
1152
  for (let r of e) {
796
- if (B.test(r)) {
1153
+ if (q.test(r)) {
797
1154
  n.push(r);
798
1155
  continue;
799
1156
  }
800
- let e = await t.api.request("GET", `/api/v1/orgs/${a(t.org)}/projects/${a(r)}`);
1157
+ let e = await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(r)}`);
801
1158
  if (!e?.id) throw Error(`Project "${r}" resolved without an id`);
802
1159
  n.push(e.id);
803
1160
  }
@@ -805,7 +1162,7 @@ function H(e, t) {
805
1162
  }
806
1163
  async function s(e) {
807
1164
  let n = e.map((e) => {
808
- if (B.test(e)) return { id: e };
1165
+ if (q.test(e)) return { id: e };
809
1166
  let t = e.indexOf("/"), n = e.slice(0, t), r = e.slice(t + 1);
810
1167
  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
1168
  return {
@@ -818,7 +1175,7 @@ function H(e, t) {
818
1175
  r.push(e.id);
819
1176
  continue;
820
1177
  }
821
- let n = await t.api.request("GET", `/api/v1/orgs/${a(t.org)}/projects/${a(e.project)}/environments/${a(e.env)}`);
1178
+ let n = await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e.project)}/environments/${o(e.env)}`);
822
1179
  if (!n?.id) throw Error(`Environment "${e.project}/${e.env}" resolved without an id`);
823
1180
  r.push(n.id);
824
1181
  }
@@ -826,38 +1183,38 @@ function H(e, t) {
826
1183
  }
827
1184
  e.registerTool("list_webhooks", {
828
1185
  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. " + V,
830
- inputSchema: n.object({ ...O }),
831
- outputSchema: ee("GET /api/v1/orgs/{org}/webhooks", { availableEventTypes: {
1186
+ 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. " + J,
1187
+ inputSchema: n.object({ ...A }),
1188
+ outputSchema: C("GET /api/v1/orgs/{org}/webhooks", { availableEventTypes: {
832
1189
  type: "array",
833
1190
  items: { type: "string" },
834
1191
  description: "Event types a subscription can filter on"
835
1192
  } }),
836
1193
  annotations: { readOnlyHint: !0 }
837
- }, async ({ limit: e, cursor: n }) => f(async () => {
1194
+ }, async ({ limit: e, cursor: n }) => p(async () => {
838
1195
  let [i, a] = await Promise.all([t.api.request("GET", r, { query: {
839
1196
  limit: e,
840
1197
  cursor: n
841
1198
  } }), t.api.request("GET", `${r}/event-types`)]);
842
- return u({
1199
+ return d({
843
1200
  ...i,
844
1201
  availableEventTypes: a
845
1202
  });
846
1203
  })), e.registerTool("list_webhook_deliveries", {
847
1204
  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. " + V,
1205
+ 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. " + J,
849
1206
  inputSchema: n.object({
850
1207
  id: n.string().describe("Subscription id (from list_webhooks)"),
851
- ...O
1208
+ ...A
852
1209
  }),
853
- outputSchema: x("GET /api/v1/orgs/{org}/webhooks/{id}/deliveries"),
1210
+ outputSchema: S("GET /api/v1/orgs/{org}/webhooks/{id}/deliveries"),
854
1211
  annotations: { readOnlyHint: !0 }
855
- }, async ({ id: e, limit: n, cursor: r }) => f(async () => u(await t.api.request("GET", `${i(e)}/deliveries`, { query: {
1212
+ }, async ({ id: e, limit: n, cursor: r }) => p(async () => d(await t.api.request("GET", `${i(e)}/deliveries`, { query: {
856
1213
  limit: n,
857
1214
  cursor: r
858
1215
  } })))), e.registerTool("manage_webhook", {
859
1216
  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. " + V,
1217
+ 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. " + J,
861
1218
  inputSchema: n.object({
862
1219
  action: n.enum([
863
1220
  "create",
@@ -876,11 +1233,11 @@ function H(e, t) {
876
1233
  secretId: n.string().optional().describe("Required for retire_secret"),
877
1234
  idempotency_key: n.string().optional().describe("Idempotency-Key header for create / rotate_secret")
878
1235
  }),
879
- outputSchema: C(v("POST /api/v1/orgs/{org}/webhooks"), w({
1236
+ outputSchema: T(y("POST /api/v1/orgs/{org}/webhooks"), E({
880
1237
  id: { type: "string" },
881
1238
  updated: { type: "boolean" },
882
- name: g("string"),
883
- url: g("string"),
1239
+ name: _("string"),
1240
+ url: _("string"),
884
1241
  eventTypes: {
885
1242
  type: ["array", "null"],
886
1243
  items: { type: "string" }
@@ -893,57 +1250,60 @@ function H(e, t) {
893
1250
  type: ["array", "null"],
894
1251
  items: { type: "string" }
895
1252
  },
896
- isEnabled: g("boolean")
897
- }, ["id", "updated"]), w({ deleted: { type: "string" } }, ["deleted"]), v("POST /api/v1/orgs/{org}/webhooks/{id}/secrets"), w({
1253
+ isEnabled: _("boolean")
1254
+ }, ["id", "updated"]), E({ deleted: { type: "string" } }, ["deleted"]), y("POST /api/v1/orgs/{org}/webhooks/{id}/secrets"), E({
898
1255
  id: { type: "string" },
899
1256
  retiredSecretId: { type: "string" }
900
1257
  }, ["id", "retiredSecretId"])),
901
1258
  annotations: { destructiveHint: !0 }
902
- }, async ({ action: e, id: n, name: c, url: l, eventTypes: p, projects: m, environments: h, enabled: g, secretId: _, idempotency_key: v }) => f(async () => {
1259
+ }, async ({ action: e, id: n, name: c, url: l, eventTypes: u, projects: m, environments: h, enabled: g, secretId: _, idempotency_key: v }) => p(async () => {
903
1260
  if (e === "create") {
904
- if (!c || !l) return d(/* @__PURE__ */ Error("action=create requires name and url"));
905
- let e = h && await s(h), n = m && await o(m);
906
- return u(await t.api.request("POST", r, {
1261
+ if (!c || !l) return f(/* @__PURE__ */ Error("action=create requires name and url"));
1262
+ let e = h && await s(h), n = m && await a(m);
1263
+ return d(await t.api.request("POST", r, {
907
1264
  body: {
908
1265
  name: c,
909
1266
  url: l,
910
1267
  provider: "GenericHttp",
911
- eventTypes: p,
1268
+ eventTypes: u,
912
1269
  projectIds: n,
913
1270
  environmentIds: e
914
1271
  },
915
1272
  idempotencyKey: v
916
1273
  }));
917
1274
  }
918
- if (!n) return d(/* @__PURE__ */ Error(`action=${e} requires id (see list_webhooks)`));
1275
+ if (!n) return f(/* @__PURE__ */ Error(`action=${e} requires id (see list_webhooks)`));
919
1276
  if (e === "update") {
920
- let e = h && await s(h), r = m && await o(m), a = await t.api.request("GET", i(n)), d = {
921
- name: c ?? a.name,
922
- url: l ?? a.url,
923
- eventTypes: p ?? a.eventTypes,
924
- projectIds: r ?? a.projectIds,
925
- environmentIds: e ?? a.environmentIds,
926
- isEnabled: g ?? a.isEnabled
1277
+ let e = h && await s(h), r = m && await a(m), { data: o, etag: f } = await t.api.requestWithEtag("GET", i(n)), p = {
1278
+ name: c ?? o.name,
1279
+ url: l ?? o.url,
1280
+ eventTypes: u ?? o.eventTypes,
1281
+ projectIds: r ?? o.projectIds,
1282
+ environmentIds: e ?? o.environmentIds,
1283
+ isEnabled: g ?? o.isEnabled
927
1284
  };
928
- return await t.api.request("PUT", i(n), { body: d }), u({
1285
+ return await t.api.request("PUT", i(n), {
1286
+ body: p,
1287
+ ifMatch: f
1288
+ }), d({
929
1289
  id: n,
930
1290
  updated: !0,
931
- ...d
1291
+ ...p
932
1292
  });
933
1293
  }
934
- return e === "delete" ? (await t.api.request("DELETE", i(n)), u({ deleted: n })) : e === "rotate_secret" ? u(await t.api.request("POST", `${i(n)}/secrets`, { idempotencyKey: v })) : _ ? (await t.api.request("DELETE", `${i(n)}/secrets/${a(_)}`), u({
1294
+ 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
1295
  id: n,
936
1296
  retiredSecretId: _
937
- })) : d(/* @__PURE__ */ Error("action=retire_secret requires secretId (see list_webhooks)"));
1297
+ })) : f(/* @__PURE__ */ Error("action=retire_secret requires secretId (see list_webhooks)"));
938
1298
  })), e.registerTool("deliver_webhook", {
939
1299
  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. " + V,
1300
+ 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. " + J,
941
1301
  inputSchema: n.object({
942
1302
  action: n.enum(["test", "redeliver"]).describe("test sends a synthetic event; redeliver re-sends deliveryId"),
943
1303
  id: n.string().describe("Subscription id (from list_webhooks)"),
944
1304
  deliveryId: n.string().optional().describe("Required for redeliver")
945
1305
  }),
946
- outputSchema: C(v("POST /api/v1/orgs/{org}/webhooks/{id}/test"), w({
1306
+ outputSchema: T(y("POST /api/v1/orgs/{org}/webhooks/{id}/test"), E({
947
1307
  id: { type: "string" },
948
1308
  redelivered: { type: "string" }
949
1309
  }, ["id", "redelivered"])),
@@ -951,24 +1311,24 @@ function H(e, t) {
951
1311
  destructiveHint: !1,
952
1312
  openWorldHint: !0
953
1313
  }
954
- }, async ({ action: e, id: n, deliveryId: r }) => f(async () => e === "test" ? u(await t.api.request("POST", `${i(n)}/test`)) : r ? (await t.api.request("POST", `${i(n)}/deliveries/${a(r)}/redeliver`), u({
1314
+ }, 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
1315
  id: n,
956
1316
  redelivered: r
957
- })) : d(/* @__PURE__ */ Error("action=redeliver requires deliveryId (see list_webhook_deliveries)"))));
1317
+ })) : f(/* @__PURE__ */ Error("action=redeliver requires deliveryId (see list_webhook_deliveries)"))));
958
1318
  }
959
1319
  //#endregion
960
1320
  //#region src/tools/workflows/stale-flags.ts
961
- var U = n.enum(["dead", "stale"]), W = 50;
962
- function G(e, t) {
1321
+ var ie = n.enum(["dead", "stale"]), Y = 50;
1322
+ function ae(e, t) {
963
1323
  e.registerTool("find_stale_flags", {
964
1324
  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 ${W} candidates per call, expired flags first.`,
1325
+ 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 ${Y} candidates per call, expired flags first.`,
966
1326
  inputSchema: n.object({
967
- project: T,
1327
+ project: D,
968
1328
  days: n.number().int().min(1).optional().default(30).describe("Minimum age in days since last update"),
969
- owner: M
1329
+ owner: I
970
1330
  }),
971
- outputSchema: S({
1331
+ outputSchema: w({
972
1332
  project: { type: "string" },
973
1333
  olderThanDays: { type: "integer" },
974
1334
  owner: { type: "string" },
@@ -978,18 +1338,18 @@ function G(e, t) {
978
1338
  blockedByNote: { type: "string" },
979
1339
  stale: {
980
1340
  type: "array",
981
- items: w({
1341
+ items: E({
982
1342
  key: { type: "string" },
983
1343
  name: { type: "string" },
984
1344
  updatedAt: { type: "string" },
985
- expiresAtUtc: g("string"),
986
- effectiveExpiresAtUtc: g("string"),
1345
+ expiresAtUtc: _("string"),
1346
+ effectiveExpiresAtUtc: _("string"),
987
1347
  expirySource: {
988
- ...g("string"),
1348
+ ..._("string"),
989
1349
  description: "explicit, project-default, or null"
990
1350
  },
991
1351
  expired: { type: "boolean" },
992
- owner: { anyOf: [_("PublicFlagOwner"), { type: "null" }] },
1352
+ owner: { anyOf: [v("PublicFlagOwner"), { type: "null" }] },
993
1353
  reason: {
994
1354
  type: "string",
995
1355
  description: "enabled-everywhere, disabled-everywhere or past-expiry"
@@ -1010,9 +1370,9 @@ function G(e, t) {
1010
1370
  "stale"
1011
1371
  ]),
1012
1372
  annotations: { readOnlyHint: !0 }
1013
- }, async ({ project: e, days: n, owner: r }) => f(async () => {
1014
- let o = await N(t, r), s = `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/flags`, c = Date.now(), l = c - n * 24 * 60 * 60 * 1e3, d = (e) => e.effectiveExpiresAtUtc ?? e.expiresAtUtc ?? null, f = (e) => e.expirySource ?? (e.expiresAtUtc ? "explicit" : null), p = (e) => {
1015
- let t = d(e);
1373
+ }, async ({ project: e, days: n, owner: r }) => p(async () => {
1374
+ let a = await L(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) => {
1375
+ let t = u(e);
1016
1376
  return !!t && new Date(t).getTime() <= c;
1017
1377
  }, m = [], h;
1018
1378
  do {
@@ -1020,27 +1380,27 @@ function G(e, t) {
1020
1380
  archived: !1,
1021
1381
  limit: 100,
1022
1382
  cursor: h,
1023
- owner: o,
1383
+ owner: a,
1024
1384
  permanent: !1
1025
1385
  } });
1026
1386
  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
1387
  } while (h);
1028
1388
  m.sort((e, t) => Number(p(t)) - Number(p(e)));
1029
- let g = m.length > W, _ = m.slice(0, W), v = [];
1389
+ let g = m.length > Y, _ = m.slice(0, Y), v = [];
1030
1390
  for (let e of _) {
1031
- let n = await t.api.request("GET", `${s}/${a(e.key)}/environments`);
1391
+ let n = await t.api.request("GET", `${s}/${o(e.key)}/environments`);
1032
1392
  if (n.length === 0) continue;
1033
- let r = p(e), i = n.every((e) => e.isEnabled), o = n.every((e) => !e.isEnabled);
1034
- (i || o || r) && v.push({
1393
+ let r = p(e), i = n.every((e) => e.isEnabled), a = n.every((e) => !e.isEnabled);
1394
+ (i || a || r) && v.push({
1035
1395
  key: e.key,
1036
1396
  name: e.name,
1037
1397
  updatedAt: e.updatedAt,
1038
1398
  expiresAtUtc: e.expiresAtUtc ?? null,
1039
- effectiveExpiresAtUtc: d(e),
1399
+ effectiveExpiresAtUtc: u(e),
1040
1400
  expirySource: f(e),
1041
1401
  expired: r,
1042
1402
  owner: e.owner ?? null,
1043
- reason: i ? "enabled-everywhere" : o ? "disabled-everywhere" : "past-expiry",
1403
+ reason: i ? "enabled-everywhere" : a ? "disabled-everywhere" : "past-expiry",
1044
1404
  environments: n.length,
1045
1405
  blockedBy: null
1046
1406
  });
@@ -1062,13 +1422,13 @@ function G(e, t) {
1062
1422
  if (!(e instanceof i)) throw e;
1063
1423
  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
1424
  }
1065
- return u({
1425
+ return d({
1066
1426
  project: e,
1067
1427
  olderThanDays: n,
1068
- ...o ? { owner: o } : {},
1428
+ ...a ? { owner: a } : {},
1069
1429
  checked: _.length,
1070
1430
  truncated: g,
1071
- ...g ? { note: `Only the first ${W} of ${m.length} candidates were checked.` } : {},
1431
+ ...g ? { note: `Only the first ${Y} of ${m.length} candidates were checked.` } : {},
1072
1432
  ...y ? { blockedByNote: y } : {},
1073
1433
  stale: v
1074
1434
  });
@@ -1076,17 +1436,17 @@ function G(e, t) {
1076
1436
  title: "List removal candidates",
1077
1437
  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
1438
  inputSchema: n.object({
1079
- project: T,
1080
- staleness: U.optional().describe("Minimum staleness tier: dead (default) or stale"),
1081
- ...O
1439
+ project: D,
1440
+ staleness: ie.optional().describe("Minimum staleness tier: dead (default) or stale"),
1441
+ ...A
1082
1442
  }),
1083
- outputSchema: x("GET /api/v1/orgs/{org}/projects/{project}/flags/removal-candidates"),
1443
+ outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/flags/removal-candidates"),
1084
1444
  annotations: { readOnlyHint: !0 }
1085
- }, async ({ project: e, ...n }) => f(async () => u(await t.api.request("GET", `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/flags/removal-candidates`, { query: n }))));
1445
+ }, 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
1446
  }
1087
1447
  //#endregion
1088
1448
  //#region src/tools/workflows/snippets.ts
1089
- var K = [
1449
+ var oe = [
1090
1450
  "js",
1091
1451
  "node",
1092
1452
  "browser",
@@ -1098,16 +1458,16 @@ var K = [
1098
1458
  "php",
1099
1459
  "ruby",
1100
1460
  "swift"
1101
- ], q = [
1461
+ ], se = [
1102
1462
  "browser",
1103
1463
  "react",
1104
1464
  "swift"
1105
1465
  ];
1106
- function J(e) {
1107
- return q.includes(e);
1466
+ function ce(e) {
1467
+ return se.includes(e);
1108
1468
  }
1109
- 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 re(e, t) {
1469
+ var X = "Uses a SERVER-side SDK key (Featureflip dashboard → environment → SDK keys).", Z = "Uses a CLIENT-side SDK key (safe to ship to browsers/apps).";
1470
+ function le(e, t) {
1111
1471
  switch (e) {
1112
1472
  case "js": return {
1113
1473
  install: "npm install @featureflip/js",
@@ -1122,7 +1482,7 @@ const enabled = client.boolVariation('${t}', { user_id: userId }, false);
1122
1482
  if (enabled) {
1123
1483
  // new code path
1124
1484
  }`,
1125
- notes: Y
1485
+ notes: X
1126
1486
  };
1127
1487
  case "node": return {
1128
1488
  install: "npm install @featureflip/node",
@@ -1133,7 +1493,7 @@ const enabled = client.boolVariation('${t}', { user_id: userId }, false);
1133
1493
  if (enabled) {
1134
1494
  // new code path
1135
1495
  }`,
1136
- notes: Y
1496
+ notes: X
1137
1497
  };
1138
1498
  case "browser": return {
1139
1499
  install: "npm install @featureflip/browser",
@@ -1145,7 +1505,7 @@ const enabled = client.boolVariation('${t}', false);
1145
1505
  if (enabled) {
1146
1506
  // new code path
1147
1507
  }`,
1148
- notes: X
1508
+ notes: Z
1149
1509
  };
1150
1510
  case "react": return {
1151
1511
  install: "npm install @featureflip/react @featureflip/browser",
@@ -1158,7 +1518,7 @@ function MyComponent() {
1158
1518
  const enabled = useFeatureFlag('${t}', false);
1159
1519
  return enabled ? <NewExperience /> : <CurrentExperience />;
1160
1520
  }`,
1161
- notes: X
1521
+ notes: Z
1162
1522
  };
1163
1523
  case "python": return {
1164
1524
  install: "pip install featureflip",
@@ -1169,7 +1529,7 @@ enabled = client.variation("${t}", {"user_id": user_id}, default=False)
1169
1529
  if enabled:
1170
1530
  # new code path
1171
1531
  ...`,
1172
- notes: Y
1532
+ notes: X
1173
1533
  };
1174
1534
  case "csharp": return {
1175
1535
  install: "dotnet add package Featureflip.Client",
@@ -1182,7 +1542,7 @@ if (enabled)
1182
1542
  {
1183
1543
  // new code path
1184
1544
  }`,
1185
- notes: Y
1545
+ notes: X
1186
1546
  };
1187
1547
  case "java": return {
1188
1548
  install: "implementation 'io.featureflip:featureflip-java:2.0.0'",
@@ -1196,7 +1556,7 @@ boolean enabled = client.boolVariation("${t}",
1196
1556
  if (enabled) {
1197
1557
  // new code path
1198
1558
  }`,
1199
- notes: Y
1559
+ notes: X
1200
1560
  };
1201
1561
  case "go": return {
1202
1562
  install: "go get github.com/canopy-labs/featureflip-go/v2",
@@ -1212,7 +1572,7 @@ ctx := featureflip.EvaluationContext{UserID: userID}
1212
1572
  if client.BoolVariation("${t}", ctx, false) {
1213
1573
  // new code path
1214
1574
  }`,
1215
- notes: Y
1575
+ notes: X
1216
1576
  };
1217
1577
  case "php": return {
1218
1578
  install: "composer require featureflip/featureflip-php",
@@ -1227,7 +1587,7 @@ $enabled = $client->boolVariation('${t}', ['user_id' => $userId], false);
1227
1587
  if ($enabled) {
1228
1588
  // new code path
1229
1589
  }`,
1230
- notes: Y + " Requires PSR-16 cache and PSR-18 HTTP implementations."
1590
+ notes: X + " Requires PSR-16 cache and PSR-18 HTTP implementations."
1231
1591
  };
1232
1592
  case "ruby": return {
1233
1593
  install: "gem \"featureflip\"",
@@ -1238,7 +1598,7 @@ enabled = client.bool_variation("${t}", { "user_id" => user_id }, false)
1238
1598
  if enabled
1239
1599
  # new code path
1240
1600
  end`,
1241
- notes: Y
1601
+ notes: X
1242
1602
  };
1243
1603
  case "swift": return {
1244
1604
  install: ".package(url: \"https://github.com/canopy-labs/featureflip-swift\", from: \"2.0.0\")",
@@ -1251,13 +1611,13 @@ let enabled = client.boolVariation("${t}", default: false)
1251
1611
  if enabled {
1252
1612
  // new code path
1253
1613
  }`,
1254
- notes: X
1614
+ notes: Z
1255
1615
  };
1256
1616
  }
1257
1617
  }
1258
1618
  //#endregion
1259
1619
  //#region src/tools/workflows/wrap-feature.ts
1260
- function ie(e, t) {
1620
+ function ue(e, t) {
1261
1621
  e.registerTool("wrap_feature", {
1262
1622
  title: "Wrap a feature in a new flag",
1263
1623
  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 +1627,12 @@ function ie(e, t) {
1267
1627
  name: n.string().optional().describe("Display name; defaults to the key"),
1268
1628
  description: n.string().optional().describe("What this flag guards"),
1269
1629
  tags: n.array(n.string()).optional().describe("Tags for filtering, e.g. team or area"),
1270
- language: n.enum(K).describe("SDK language of the codebase being edited"),
1630
+ language: n.enum(oe).describe("SDK language of the codebase being edited"),
1271
1631
  idempotency_key: n.string().optional().describe("Idempotency-Key header for safe retries")
1272
1632
  }),
1273
- outputSchema: S({
1274
- flag: v("POST /api/v1/orgs/{org}/projects/{project}/flags"),
1275
- integration: w({
1633
+ outputSchema: w({
1634
+ flag: y("POST /api/v1/orgs/{org}/projects/{project}/flags"),
1635
+ integration: E({
1276
1636
  language: { type: "string" },
1277
1637
  install: { type: "string" },
1278
1638
  code: { type: "string" },
@@ -1288,25 +1648,25 @@ function ie(e, t) {
1288
1648
  "next_steps"
1289
1649
  ]),
1290
1650
  annotations: { destructiveHint: !1 }
1291
- }, async ({ project: e, key: n, name: r, description: i, tags: o, language: s, idempotency_key: c }) => f(async () => {
1292
- let l = await t.api.request("POST", `/api/v1/orgs/${a(t.org)}/projects/${a(e)}/flags`, {
1651
+ }, async ({ project: e, key: n, name: r, description: i, tags: a, language: s, idempotency_key: c }) => p(async () => {
1652
+ let l = await t.api.request("POST", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags`, {
1293
1653
  body: {
1294
1654
  key: n,
1295
1655
  name: r ?? n,
1296
1656
  type: "Boolean",
1297
1657
  description: i,
1298
- tags: o,
1299
- ...J(s) ? { clientSideVisible: !0 } : {}
1658
+ tags: a,
1659
+ ...ce(s) ? { clientSideVisible: !0 } : {}
1300
1660
  },
1301
1661
  idempotencyKey: c
1302
- }), d = re(s, n);
1303
- return u({
1662
+ }), u = le(s, n);
1663
+ return d({
1304
1664
  flag: l,
1305
1665
  integration: {
1306
1666
  language: s,
1307
- install: d.install,
1308
- code: d.code,
1309
- notes: d.notes
1667
+ install: u.install,
1668
+ code: u.code,
1669
+ notes: u.notes
1310
1670
  },
1311
1671
  next_steps: [
1312
1672
  "Apply the snippet around the new code path.",
@@ -1318,12 +1678,12 @@ function ie(e, t) {
1318
1678
  }
1319
1679
  //#endregion
1320
1680
  //#region src/server.ts
1321
- function Z(t) {
1681
+ function de(t) {
1322
1682
  let n = new e({
1323
1683
  name: "featureflip",
1324
1684
  version: r
1325
1685
  });
1326
- return k(n, t), A(n, t), j(n, t), F(n, t), te(n, t), R(n, t), z(n, t), H(n, t), G(n, t), ie(n, t), n;
1686
+ return j(n, t), ee(n, t), te(n, t), ne(n, t), z(n, t), V(n, t), G(n, t), K(n, t), re(n, t), ae(n, t), ue(n, t), n;
1327
1687
  }
1328
1688
  //#endregion
1329
1689
  //#region src/config.ts
@@ -1336,14 +1696,14 @@ function $(e = process.env) {
1336
1696
  org: e.FEATUREFLIP_ORG?.trim() || void 0
1337
1697
  } : null;
1338
1698
  }
1339
- function ae(e = process.env) {
1699
+ function fe(e = process.env) {
1340
1700
  let t = $(e);
1341
1701
  if (!t) throw Error(Q);
1342
1702
  return t;
1343
1703
  }
1344
1704
  //#endregion
1345
1705
  //#region src/org.ts
1346
- async function oe(e, t) {
1706
+ async function pe(e, t) {
1347
1707
  if (t) return t;
1348
1708
  let n = (await e.request("GET", "/api/v1/orgs", { query: { limit: 100 } })).items ?? [];
1349
1709
  if (n.length === 1) {
@@ -1354,4 +1714,4 @@ async function oe(e, t) {
1354
1714
  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
1715
  }
1356
1716
  //#endregion
1357
- export { Z as a, r as c, $ as i, Q as n, i as o, ae as r, l as s, oe as t };
1717
+ export { de as a, r as c, $ as i, Q as n, i as o, fe as r, u as s, pe as t };