@thinkai/tai-api-contract 2.190.0 → 2.191.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.
@@ -833,6 +833,30 @@ export interface paths {
833
833
  patch?: never;
834
834
  trace?: never;
835
835
  };
836
+ "/workspaces/{workspaceId}/ai-model-policy": {
837
+ parameters: {
838
+ query?: never;
839
+ header?: never;
840
+ path?: never;
841
+ cookie?: never;
842
+ };
843
+ /**
844
+ * Get workspace AI model right-sizing policy and per-person overrides
845
+ * @description Returns the workspace default model-mix right-sizing policy plus optional per-person overrides used by Key Insights `model_right_sizing` (Cost-to-Value #2). `policy: null` means the server applies Phase A constants (40% threshold, fixed premium allowlist, sample gates). Member-level read access. Overrides affect coaching eligibility/copy only — they never rewrite spend rollups.
846
+ */
847
+ get: operations["getWorkspaceAiModelPolicy"];
848
+ /**
849
+ * Set workspace AI model right-sizing policy and per-person overrides
850
+ * @description Full-replace workspace model-mix policy and person overrides. `policy: null` clears the workspace default (Phase A constants). `overrides: {}` clears all person overrides. Max **200** override entries. Thresholds must be 1–100. Requires workspace **admin** (`403` `workspace_admin_required` for editors). On success the server writes activity `ai_model_policy.changed` with secret-free metadata (threshold, override count / modes). Does not mutate `model_daily` or spend KPIs.
851
+ */
852
+ put: operations["putWorkspaceAiModelPolicy"];
853
+ post?: never;
854
+ delete?: never;
855
+ options?: never;
856
+ head?: never;
857
+ patch?: never;
858
+ trace?: never;
859
+ };
836
860
  "/workspaces/{workspaceId}/productivity-targets": {
837
861
  parameters: {
838
862
  query?: never;
@@ -6375,6 +6399,43 @@ export interface components {
6375
6399
  [key: string]: components["schemas"]["RepoDeliveryOverrideDto"];
6376
6400
  };
6377
6401
  };
6402
+ /** @description Workspace default model-mix right-sizing policy (Cost-to-Value insight #2 Phase B). When the parent `policy` field is null, the server uses Phase A constants instead. */
6403
+ AiModelPolicyConfigDto: {
6404
+ /** @description Premium share of model spend threshold (%). Phase A default is 40. */
6405
+ premiumShareThresholdPct: number;
6406
+ /** @description Optional case-insensitive model-name globs that extend the Phase A premium allowlist (`*` wildcards). Unmatched names remain non-premium. */
6407
+ premiumModelPatterns?: string[];
6408
+ /** @description Min total model spend (cents) before the workspace card emits. Phase A default 5000. */
6409
+ minWorkspaceSpendCents?: number;
6410
+ /** @description Min distinct active model-spend days for a person card. Phase A default 5. */
6411
+ minPersonActiveDays?: number;
6412
+ /** @description Min personal model spend (cents) before a person card emits. Phase A default 1000. */
6413
+ minPersonSpendCents?: number;
6414
+ /** @description Optional coaching copy used for recommendedAction on model_right_sizing cards. */
6415
+ defaultGuidance?: string;
6416
+ };
6417
+ /** @description Per-person coaching override. `allow_premium` suppresses the person card; `coach_downgrade` flags at `thresholdPct` (default 25 when omitted). */
6418
+ AiModelPolicyPersonOverrideDto: {
6419
+ /** @enum {string} */
6420
+ mode: "allow_premium" | "coach_downgrade";
6421
+ /** @description Effective threshold for coach_downgrade (ignored for allow_premium). */
6422
+ thresholdPct?: number;
6423
+ /** @description Optional admin note (not shown as Key Insight evidence numbers). */
6424
+ note?: string;
6425
+ /** Format: date-time */
6426
+ updatedAt: string;
6427
+ /** Format: uuid */
6428
+ updatedByUserId: string;
6429
+ };
6430
+ /** @description Workspace AI model policy + per-person overrides for Key Insights model right-sizing. Overrides affect recommendation eligibility/copy only; spend KPIs and model_daily are unchanged. */
6431
+ AiModelPolicyDto: {
6432
+ /** @description Null clears / means Phase A constants on the key-insights engine. */
6433
+ policy: components["schemas"]["AiModelPolicyConfigDto"] | null;
6434
+ /** @description Map keyed by person_id (max 200 entries). Empty object clears all overrides. */
6435
+ overrides: {
6436
+ [key: string]: components["schemas"]["AiModelPolicyPersonOverrideDto"];
6437
+ };
6438
+ };
6378
6439
  /** @description Optional weekly per-engineer targets for Productivity Insights. Omitted or null fields mean no target for that metric. Additional properties are rejected. */
6379
6440
  ProductivityTargetsDto: {
6380
6441
  /** @description Floor — meet or exceed this many merged PRs per engineer per week. */
@@ -13081,6 +13142,9 @@ export type WorkspaceConfigDto = components['schemas']['WorkspaceConfigDto'];
13081
13142
  export type DeliveryRoleConfigDto = components['schemas']['DeliveryRoleConfigDto'];
13082
13143
  export type RepoDeliveryOverrideDto = components['schemas']['RepoDeliveryOverrideDto'];
13083
13144
  export type DeliveryTopologyDto = components['schemas']['DeliveryTopologyDto'];
13145
+ export type AiModelPolicyConfigDto = components['schemas']['AiModelPolicyConfigDto'];
13146
+ export type AiModelPolicyPersonOverrideDto = components['schemas']['AiModelPolicyPersonOverrideDto'];
13147
+ export type AiModelPolicyDto = components['schemas']['AiModelPolicyDto'];
13084
13148
  export type ProductivityTargetsDto = components['schemas']['ProductivityTargetsDto'];
13085
13149
  export type AiEmailAliasEntryDto = components['schemas']['AiEmailAliasEntryDto'];
13086
13150
  export type AiEmailAliasesDto = components['schemas']['AiEmailAliasesDto'];
@@ -16309,6 +16373,91 @@ export interface operations {
16309
16373
  };
16310
16374
  };
16311
16375
  };
16376
+ getWorkspaceAiModelPolicy: {
16377
+ parameters: {
16378
+ query?: never;
16379
+ header?: never;
16380
+ path: {
16381
+ workspaceId: components["parameters"]["WorkspaceId"];
16382
+ };
16383
+ cookie?: never;
16384
+ };
16385
+ requestBody?: never;
16386
+ responses: {
16387
+ /** @description Current policy (policy may be null; overrides may be empty) */
16388
+ 200: {
16389
+ headers: {
16390
+ [name: string]: unknown;
16391
+ };
16392
+ content: {
16393
+ "application/json": components["schemas"]["AiModelPolicyDto"];
16394
+ };
16395
+ };
16396
+ 401: components["responses"]["Unauthorized"];
16397
+ 403: components["responses"]["Forbidden"];
16398
+ /** @description Workspace does not exist or malformed workspaceId */
16399
+ 404: {
16400
+ headers: {
16401
+ [name: string]: unknown;
16402
+ };
16403
+ content: {
16404
+ "application/json": components["schemas"]["ErrorMessageDto"];
16405
+ };
16406
+ };
16407
+ };
16408
+ };
16409
+ putWorkspaceAiModelPolicy: {
16410
+ parameters: {
16411
+ query?: never;
16412
+ header?: never;
16413
+ path: {
16414
+ workspaceId: components["parameters"]["WorkspaceId"];
16415
+ };
16416
+ cookie?: never;
16417
+ };
16418
+ requestBody: {
16419
+ content: {
16420
+ "application/json": components["schemas"]["AiModelPolicyDto"];
16421
+ };
16422
+ };
16423
+ responses: {
16424
+ /** @description Policy persisted (or cleared). */
16425
+ 204: {
16426
+ headers: {
16427
+ [name: string]: unknown;
16428
+ };
16429
+ content?: never;
16430
+ };
16431
+ /** @description Invalid payload (unknown keys, out-of-range, or >200 overrides) */
16432
+ 400: {
16433
+ headers: {
16434
+ [name: string]: unknown;
16435
+ };
16436
+ content: {
16437
+ "application/json": components["schemas"]["ErrorMessageDto"];
16438
+ };
16439
+ };
16440
+ 401: components["responses"]["Unauthorized"];
16441
+ /** @description Forbidden — workspace admin required */
16442
+ 403: {
16443
+ headers: {
16444
+ [name: string]: unknown;
16445
+ };
16446
+ content: {
16447
+ "application/json": components["schemas"]["ErrorMessageDto"];
16448
+ };
16449
+ };
16450
+ /** @description Workspace does not exist or malformed workspaceId */
16451
+ 404: {
16452
+ headers: {
16453
+ [name: string]: unknown;
16454
+ };
16455
+ content: {
16456
+ "application/json": components["schemas"]["ErrorMessageDto"];
16457
+ };
16458
+ };
16459
+ };
16460
+ };
16312
16461
  getWorkspaceProductivityTargets: {
16313
16462
  parameters: {
16314
16463
  query?: never;