@thinkai/tai-api-contract 2.189.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.
@@ -834,6 +834,30 @@ export interface paths {
834
834
  patch?: never;
835
835
  trace?: never;
836
836
  };
837
+ "/workspaces/{workspaceId}/ai-model-policy": {
838
+ parameters: {
839
+ query?: never;
840
+ header?: never;
841
+ path?: never;
842
+ cookie?: never;
843
+ };
844
+ /**
845
+ * Get workspace AI model right-sizing policy and per-person overrides
846
+ * @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.
847
+ */
848
+ get: operations["getWorkspaceAiModelPolicy"];
849
+ /**
850
+ * Set workspace AI model right-sizing policy and per-person overrides
851
+ * @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.
852
+ */
853
+ put: operations["putWorkspaceAiModelPolicy"];
854
+ post?: never;
855
+ delete?: never;
856
+ options?: never;
857
+ head?: never;
858
+ patch?: never;
859
+ trace?: never;
860
+ };
837
861
  "/workspaces/{workspaceId}/productivity-targets": {
838
862
  parameters: {
839
863
  query?: never;
@@ -3364,6 +3388,26 @@ export interface paths {
3364
3388
  patch?: never;
3365
3389
  trace?: never;
3366
3390
  };
3391
+ "/workspaces/{workspaceId}/rules-skills/create": {
3392
+ parameters: {
3393
+ query?: never;
3394
+ header?: never;
3395
+ path?: never;
3396
+ cookie?: never;
3397
+ };
3398
+ get?: never;
3399
+ put?: never;
3400
+ /**
3401
+ * Draft Rules & Skills via agent execution
3402
+ * @description Generates hub (≥1 of `AGENTS.md` / `CLAUDE.md` per assessed tools) plus ≥1 rule and ≥1 skill with correct stack paths using workspace **agent execution** (`ThinkAiAgent` / same credential path as the fix processor — not Fix Processor enqueue). Runs the shared soft-quality gate from the validate engine. Soft failures block Open PR unless `overrideSoftQuality` + `overrideReason` (audited). Structural failures are never overridable. Requires workspace editor or admin. Assessed tools come from the latest succeeded readiness scan.
3403
+ */
3404
+ post: operations["postRulesSkillsCreate"];
3405
+ delete?: never;
3406
+ options?: never;
3407
+ head?: never;
3408
+ patch?: never;
3409
+ trace?: never;
3410
+ };
3367
3411
  "/workspaces/{workspaceId}/rules-skills/pull-requests": {
3368
3412
  parameters: {
3369
3413
  query?: never;
@@ -3375,7 +3419,7 @@ export interface paths {
3375
3419
  put?: never;
3376
3420
  /**
3377
3421
  * Open a Rules & Skills remediation pull request
3378
- * @description Applies `proposedFiles` (or a future create-mode session) onto a non-default branch via the Automations GitHub App installation and opens a pull request. Never pushes to the default branch. PR title/body identify the change as platform-generated and link back to `/agentic-foundation/rules-skills`. Requires workspace editor or admin. Same write-permission gate as readiness fixes.
3422
+ * @description Applies `proposedFiles` (from validate or create drafts) onto a non-default branch via the Automations GitHub App installation and opens a pull request. Never pushes to the default branch. PR title/body identify the change as platform-generated and link back to `/agentic-foundation/rules-skills`. Requires workspace editor or admin. Same write-permission gate as readiness fixes. For create mode, pass the `drafts` returned by `POST .../rules-skills/create` as `proposedFiles` after soft-quality passes or a logged override.
3379
3423
  */
3380
3424
  post: operations["postRulesSkillsPullRequest"];
3381
3425
  delete?: never;
@@ -6356,6 +6400,43 @@ export interface components {
6356
6400
  [key: string]: components["schemas"]["RepoDeliveryOverrideDto"];
6357
6401
  };
6358
6402
  };
6403
+ /** @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. */
6404
+ AiModelPolicyConfigDto: {
6405
+ /** @description Premium share of model spend threshold (%). Phase A default is 40. */
6406
+ premiumShareThresholdPct: number;
6407
+ /** @description Optional case-insensitive model-name globs that extend the Phase A premium allowlist (`*` wildcards). Unmatched names remain non-premium. */
6408
+ premiumModelPatterns?: string[];
6409
+ /** @description Min total model spend (cents) before the workspace card emits. Phase A default 5000. */
6410
+ minWorkspaceSpendCents?: number;
6411
+ /** @description Min distinct active model-spend days for a person card. Phase A default 5. */
6412
+ minPersonActiveDays?: number;
6413
+ /** @description Min personal model spend (cents) before a person card emits. Phase A default 1000. */
6414
+ minPersonSpendCents?: number;
6415
+ /** @description Optional coaching copy used for recommendedAction on model_right_sizing cards. */
6416
+ defaultGuidance?: string;
6417
+ };
6418
+ /** @description Per-person coaching override. `allow_premium` suppresses the person card; `coach_downgrade` flags at `thresholdPct` (default 25 when omitted). */
6419
+ AiModelPolicyPersonOverrideDto: {
6420
+ /** @enum {string} */
6421
+ mode: "allow_premium" | "coach_downgrade";
6422
+ /** @description Effective threshold for coach_downgrade (ignored for allow_premium). */
6423
+ thresholdPct?: number;
6424
+ /** @description Optional admin note (not shown as Key Insight evidence numbers). */
6425
+ note?: string;
6426
+ /** Format: date-time */
6427
+ updatedAt: string;
6428
+ /** Format: uuid */
6429
+ updatedByUserId: string;
6430
+ };
6431
+ /** @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. */
6432
+ AiModelPolicyDto: {
6433
+ /** @description Null clears / means Phase A constants on the key-insights engine. */
6434
+ policy: components["schemas"]["AiModelPolicyConfigDto"] | null;
6435
+ /** @description Map keyed by person_id (max 200 entries). Empty object clears all overrides. */
6436
+ overrides: {
6437
+ [key: string]: components["schemas"]["AiModelPolicyPersonOverrideDto"];
6438
+ };
6439
+ };
6359
6440
  /** @description Optional weekly per-engineer targets for Productivity Insights. Omitted or null fields mean no target for that metric. Additional properties are rejected. */
6360
6441
  ProductivityTargetsDto: {
6361
6442
  /** @description Floor — meet or exceed this many merged PRs per engineer per week. */
@@ -9367,6 +9448,29 @@ export interface components {
9367
9448
  /** @description Quiet-case note (e.g. empty tree under pathPrefixes). */
9368
9449
  note?: string;
9369
9450
  };
9451
+ RulesSkillsCreateRequestDto: {
9452
+ /** Format: uuid */
9453
+ repoId: string;
9454
+ /** @description Optional criterion targets. At least one of `intent` or non-empty `criterionIds` is required. */
9455
+ criterionIds?: ("A1" | "A2" | "A3" | "A3a" | "A3b" | "A3c" | "A11")[];
9456
+ /** @description Free-text create intent (required when criterionIds is empty). */
9457
+ intent?: string;
9458
+ notes?: string;
9459
+ /** @description When true, soft-quality fails are omitted from `blockingFailures` (structural fails always remain). Requires `overrideReason`; audited. */
9460
+ overrideSoftQuality?: boolean;
9461
+ /** @description Required when overrideSoftQuality is true. */
9462
+ overrideReason?: string;
9463
+ };
9464
+ RulesSkillsCreateResponseDto: {
9465
+ assessedTools: components["schemas"]["RulesSkillsAssessedTools"];
9466
+ /** @description Draft patches for review; pass to open-PR as proposedFiles. */
9467
+ drafts: components["schemas"]["RulesSkillsProposedFileDto"][];
9468
+ softQuality: components["schemas"]["RulesSkillsSoftQualitySummaryDto"];
9469
+ /** @description Structural fails always; soft fails unless softQualityOverridden. Open PR should wait until empty (or soft override was logged). */
9470
+ blockingFailures: components["schemas"]["RulesSkillsFindingDto"][];
9471
+ softQualityOverridden: boolean;
9472
+ note?: string;
9473
+ };
9370
9474
  RulesSkillsOpenPullRequestRequestDto: {
9371
9475
  /** Format: uuid */
9372
9476
  repoId: string;
@@ -9374,7 +9478,7 @@ export interface components {
9374
9478
  mode: "validate" | "create";
9375
9479
  /**
9376
9480
  * Format: uuid
9377
- * @description Reserved for Create-mode sessions; validate mode uses proposedFiles.
9481
+ * @description Reserved for persisted create sessions; currently pass proposedFiles.
9378
9482
  */
9379
9483
  sessionId?: string;
9380
9484
  proposedFiles?: components["schemas"]["RulesSkillsProposedFileDto"][];
@@ -9942,7 +10046,7 @@ export interface components {
9942
10046
  * @description Type of workspace lifecycle event.
9943
10047
  * @enum {string}
9944
10048
  */
9945
- ActivityLogEventTypeDto: "repo.added" | "repo.removed" | "repo.readded" | "integration.github.added" | "integration.github.updated" | "integration.github.removed" | "integration.github.permissions_changed" | "integration.github.suspended" | "integration.github.unsuspended" | "integration.github.repo_added" | "integration.github.repo_removed" | "fix.requested" | "fix.generating" | "fix.pr_created" | "fix.merged" | "fix.failed" | "readiness.scan_started" | "readiness.scan_completed" | "readiness.scan_failed" | "readiness.scan_partial" | "code_insights.design_run_started" | "integrations.agent_execution.provider_changed" | "integrations.repo_eligibility.overrides_changed" | "integrations.repo_eligibility.languages_refresh_requested" | "integrations.cursor.platform_key_enabled" | "integrations.cursor.platform_key_disabled" | "member.invited" | "member.invite_accepted" | "member.invite_rejected" | "member.role_changed" | "member.removed" | "hris.personio.sync_started" | "hris.personio.sync_completed" | "hris.personio.sync_failed" | "hris.zenhr.sync_started" | "hris.zenhr.sync_completed" | "hris.zenhr.sync_failed" | "hris.zelt.sync_started" | "hris.zelt.sync_completed" | "hris.zelt.sync_failed" | "hris.hibob.sync_started" | "hris.hibob.sync_completed" | "hris.hibob.sync_failed" | "hris.sync_started" | "hris.sync_completed" | "hris.sync_failed" | "repo.sync_skipped" | "integrations.cursor.execution_key.added" | "integrations.cursor.execution_key.updated" | "integrations.cursor.execution_key.removed" | "integrations.cursor.execution_key.check_failed" | "integrations.cursor.admin_key.added" | "integrations.cursor.admin_key.updated" | "integrations.cursor.admin_key.removed" | "integrations.claude.execution_key.added" | "integrations.claude.execution_key.updated" | "integrations.claude.execution_key.removed" | "integrations.claude.execution_key.check_failed" | "integrations.claude.admin_key.added" | "integrations.claude.admin_key.updated" | "integrations.claude.admin_key.removed" | "integrations.claude.analytics_key.added" | "integrations.claude.analytics_key.updated" | "integrations.claude.analytics_key.removed" | "integrations.code_intelligence.settings_changed" | "integrations.code_intelligence.execution_key.added" | "integrations.code_intelligence.execution_key.updated" | "integrations.code_intelligence.execution_key.removed" | "integrations.code_intelligence.execution_key.check_failed" | "readiness.scan_precheck_failed" | "productivity.ingest.completed" | "productivity.ingest.failed" | "productivity.ingest.skipped" | "productivity.ingest.repo_skipped" | "productivity.ingest.coverage_gap_detected" | "integrations.newrelic.added" | "integrations.newrelic.removed" | "integrations.newrelic.sync_completed" | "integrations.newrelic.sync_failed" | "integrations.prometheus.added" | "integrations.prometheus.removed" | "integrations.prometheus.sync_completed" | "integrations.prometheus.sync_failed" | "integrations.grafana.added" | "integrations.grafana.removed" | "integrations.grafana.sync_completed" | "integrations.grafana.sync_failed" | "integrations.datadog.added" | "integrations.datadog.removed" | "integrations.datadog.sync_completed" | "integrations.datadog.sync_failed" | "integrations.zelt.added" | "integrations.zelt.removed" | "report.exported" | "report.assessment_stored" | "report.assessment_link_sent" | "report.assessment_link_revoked" | "report.assessment_downloaded" | "report.assessment_hidden" | "report.assessment_restored" | "workspace.aggregate_use.changed" | "workspace.assessment_rollout.changed";
10049
+ ActivityLogEventTypeDto: "repo.added" | "repo.removed" | "repo.readded" | "integration.github.added" | "integration.github.updated" | "integration.github.removed" | "integration.github.permissions_changed" | "integration.github.suspended" | "integration.github.unsuspended" | "integration.github.repo_added" | "integration.github.repo_removed" | "fix.requested" | "fix.generating" | "fix.pr_created" | "fix.merged" | "fix.failed" | "readiness.scan_started" | "readiness.scan_completed" | "readiness.scan_failed" | "readiness.scan_partial" | "code_insights.design_run_started" | "integrations.agent_execution.provider_changed" | "integrations.repo_eligibility.overrides_changed" | "integrations.repo_eligibility.languages_refresh_requested" | "rules_skills.soft_quality.override" | "integrations.cursor.platform_key_enabled" | "integrations.cursor.platform_key_disabled" | "member.invited" | "member.invite_accepted" | "member.invite_rejected" | "member.role_changed" | "member.removed" | "hris.personio.sync_started" | "hris.personio.sync_completed" | "hris.personio.sync_failed" | "hris.zenhr.sync_started" | "hris.zenhr.sync_completed" | "hris.zenhr.sync_failed" | "hris.zelt.sync_started" | "hris.zelt.sync_completed" | "hris.zelt.sync_failed" | "hris.hibob.sync_started" | "hris.hibob.sync_completed" | "hris.hibob.sync_failed" | "hris.sync_started" | "hris.sync_completed" | "hris.sync_failed" | "repo.sync_skipped" | "integrations.cursor.execution_key.added" | "integrations.cursor.execution_key.updated" | "integrations.cursor.execution_key.removed" | "integrations.cursor.execution_key.check_failed" | "integrations.cursor.admin_key.added" | "integrations.cursor.admin_key.updated" | "integrations.cursor.admin_key.removed" | "integrations.claude.execution_key.added" | "integrations.claude.execution_key.updated" | "integrations.claude.execution_key.removed" | "integrations.claude.execution_key.check_failed" | "integrations.claude.admin_key.added" | "integrations.claude.admin_key.updated" | "integrations.claude.admin_key.removed" | "integrations.claude.analytics_key.added" | "integrations.claude.analytics_key.updated" | "integrations.claude.analytics_key.removed" | "integrations.code_intelligence.settings_changed" | "integrations.code_intelligence.execution_key.added" | "integrations.code_intelligence.execution_key.updated" | "integrations.code_intelligence.execution_key.removed" | "integrations.code_intelligence.execution_key.check_failed" | "readiness.scan_precheck_failed" | "productivity.ingest.completed" | "productivity.ingest.failed" | "productivity.ingest.skipped" | "productivity.ingest.repo_skipped" | "productivity.ingest.coverage_gap_detected" | "integrations.newrelic.added" | "integrations.newrelic.removed" | "integrations.newrelic.sync_completed" | "integrations.newrelic.sync_failed" | "integrations.prometheus.added" | "integrations.prometheus.removed" | "integrations.prometheus.sync_completed" | "integrations.prometheus.sync_failed" | "integrations.grafana.added" | "integrations.grafana.removed" | "integrations.grafana.sync_completed" | "integrations.grafana.sync_failed" | "integrations.datadog.added" | "integrations.datadog.removed" | "integrations.datadog.sync_completed" | "integrations.datadog.sync_failed" | "integrations.zelt.added" | "integrations.zelt.removed" | "report.exported" | "report.assessment_stored" | "report.assessment_link_sent" | "report.assessment_link_revoked" | "report.assessment_downloaded" | "report.assessment_hidden" | "report.assessment_restored" | "workspace.aggregate_use.changed" | "workspace.assessment_rollout.changed";
9946
10050
  /** @description Current legal-approved opt-in notice, or `unset` while opt-in is unavailable. */
9947
10051
  AggregateUseNoticeStatusDto: {
9948
10052
  /** @enum {string} */
@@ -13039,6 +13143,9 @@ export type WorkspaceConfigDto = components['schemas']['WorkspaceConfigDto'];
13039
13143
  export type DeliveryRoleConfigDto = components['schemas']['DeliveryRoleConfigDto'];
13040
13144
  export type RepoDeliveryOverrideDto = components['schemas']['RepoDeliveryOverrideDto'];
13041
13145
  export type DeliveryTopologyDto = components['schemas']['DeliveryTopologyDto'];
13146
+ export type AiModelPolicyConfigDto = components['schemas']['AiModelPolicyConfigDto'];
13147
+ export type AiModelPolicyPersonOverrideDto = components['schemas']['AiModelPolicyPersonOverrideDto'];
13148
+ export type AiModelPolicyDto = components['schemas']['AiModelPolicyDto'];
13042
13149
  export type ProductivityTargetsDto = components['schemas']['ProductivityTargetsDto'];
13043
13150
  export type AiEmailAliasEntryDto = components['schemas']['AiEmailAliasEntryDto'];
13044
13151
  export type AiEmailAliasesDto = components['schemas']['AiEmailAliasesDto'];
@@ -13285,6 +13392,8 @@ export type RulesSkillsSoftQualityCheckDto = components['schemas']['RulesSkillsS
13285
13392
  export type RulesSkillsSoftQualitySummaryDto = components['schemas']['RulesSkillsSoftQualitySummaryDto'];
13286
13393
  export type RulesSkillsProposedFileDto = components['schemas']['RulesSkillsProposedFileDto'];
13287
13394
  export type RulesSkillsValidateResponseDto = components['schemas']['RulesSkillsValidateResponseDto'];
13395
+ export type RulesSkillsCreateRequestDto = components['schemas']['RulesSkillsCreateRequestDto'];
13396
+ export type RulesSkillsCreateResponseDto = components['schemas']['RulesSkillsCreateResponseDto'];
13288
13397
  export type RulesSkillsOpenPullRequestRequestDto = components['schemas']['RulesSkillsOpenPullRequestRequestDto'];
13289
13398
  export type RulesSkillsOpenPullRequestResponseDto = components['schemas']['RulesSkillsOpenPullRequestResponseDto'];
13290
13399
  export type PhaseRoleDto = components['schemas']['PhaseRoleDto'];
@@ -16265,6 +16374,91 @@ export interface operations {
16265
16374
  };
16266
16375
  };
16267
16376
  };
16377
+ getWorkspaceAiModelPolicy: {
16378
+ parameters: {
16379
+ query?: never;
16380
+ header?: never;
16381
+ path: {
16382
+ workspaceId: components["parameters"]["WorkspaceId"];
16383
+ };
16384
+ cookie?: never;
16385
+ };
16386
+ requestBody?: never;
16387
+ responses: {
16388
+ /** @description Current policy (policy may be null; overrides may be empty) */
16389
+ 200: {
16390
+ headers: {
16391
+ [name: string]: unknown;
16392
+ };
16393
+ content: {
16394
+ "application/json": components["schemas"]["AiModelPolicyDto"];
16395
+ };
16396
+ };
16397
+ 401: components["responses"]["Unauthorized"];
16398
+ 403: components["responses"]["Forbidden"];
16399
+ /** @description Workspace does not exist or malformed workspaceId */
16400
+ 404: {
16401
+ headers: {
16402
+ [name: string]: unknown;
16403
+ };
16404
+ content: {
16405
+ "application/json": components["schemas"]["ErrorMessageDto"];
16406
+ };
16407
+ };
16408
+ };
16409
+ };
16410
+ putWorkspaceAiModelPolicy: {
16411
+ parameters: {
16412
+ query?: never;
16413
+ header?: never;
16414
+ path: {
16415
+ workspaceId: components["parameters"]["WorkspaceId"];
16416
+ };
16417
+ cookie?: never;
16418
+ };
16419
+ requestBody: {
16420
+ content: {
16421
+ "application/json": components["schemas"]["AiModelPolicyDto"];
16422
+ };
16423
+ };
16424
+ responses: {
16425
+ /** @description Policy persisted (or cleared). */
16426
+ 204: {
16427
+ headers: {
16428
+ [name: string]: unknown;
16429
+ };
16430
+ content?: never;
16431
+ };
16432
+ /** @description Invalid payload (unknown keys, out-of-range, or >200 overrides) */
16433
+ 400: {
16434
+ headers: {
16435
+ [name: string]: unknown;
16436
+ };
16437
+ content: {
16438
+ "application/json": components["schemas"]["ErrorMessageDto"];
16439
+ };
16440
+ };
16441
+ 401: components["responses"]["Unauthorized"];
16442
+ /** @description Forbidden — workspace admin required */
16443
+ 403: {
16444
+ headers: {
16445
+ [name: string]: unknown;
16446
+ };
16447
+ content: {
16448
+ "application/json": components["schemas"]["ErrorMessageDto"];
16449
+ };
16450
+ };
16451
+ /** @description Workspace does not exist or malformed workspaceId */
16452
+ 404: {
16453
+ headers: {
16454
+ [name: string]: unknown;
16455
+ };
16456
+ content: {
16457
+ "application/json": components["schemas"]["ErrorMessageDto"];
16458
+ };
16459
+ };
16460
+ };
16461
+ };
16268
16462
  getWorkspaceProductivityTargets: {
16269
16463
  parameters: {
16270
16464
  query?: never;
@@ -23087,6 +23281,79 @@ export interface operations {
23087
23281
  };
23088
23282
  };
23089
23283
  };
23284
+ postRulesSkillsCreate: {
23285
+ parameters: {
23286
+ query?: never;
23287
+ header?: never;
23288
+ path: {
23289
+ workspaceId: components["parameters"]["WorkspaceId"];
23290
+ };
23291
+ cookie?: never;
23292
+ };
23293
+ requestBody: {
23294
+ content: {
23295
+ "application/json": components["schemas"]["RulesSkillsCreateRequestDto"];
23296
+ };
23297
+ };
23298
+ responses: {
23299
+ /** @description Drafts generated (may include soft-quality blockingFailures) */
23300
+ 200: {
23301
+ headers: {
23302
+ [name: string]: unknown;
23303
+ };
23304
+ content: {
23305
+ "application/json": components["schemas"]["RulesSkillsCreateResponseDto"];
23306
+ };
23307
+ };
23308
+ /** @description Missing intent and criterionIds, or override without reason (`code: intent_or_criterion_required` | `override_reason_required`) */
23309
+ 400: {
23310
+ headers: {
23311
+ [name: string]: unknown;
23312
+ };
23313
+ content: {
23314
+ "application/json": components["schemas"]["ErrorMessageDto"];
23315
+ };
23316
+ };
23317
+ 401: components["responses"]["Unauthorized"];
23318
+ 403: components["responses"]["Forbidden"];
23319
+ /** @description Workspace, repository, or GitHub installation not found */
23320
+ 404: {
23321
+ headers: {
23322
+ [name: string]: unknown;
23323
+ };
23324
+ content: {
23325
+ "application/json": components["schemas"]["ErrorMessageDto"];
23326
+ };
23327
+ };
23328
+ /** @description No succeeded readiness scan (`readiness_scan_required`), non-GitHub repo, or agent drafts missing required hub/rule/skill coverage (`rules_skills_create_incomplete`) */
23329
+ 422: {
23330
+ headers: {
23331
+ [name: string]: unknown;
23332
+ };
23333
+ content: {
23334
+ "application/json": components["schemas"]["ErrorMessageDto"];
23335
+ };
23336
+ };
23337
+ /** @description Create rate limit exceeded */
23338
+ 429: {
23339
+ headers: {
23340
+ [name: string]: unknown;
23341
+ };
23342
+ content: {
23343
+ "application/json": components["schemas"]["ErrorMessageDto"];
23344
+ };
23345
+ };
23346
+ /** @description Agent execution credential missing (`agent_execution_unavailable`) or clone/agent run failed (`rules_skills_create_failed`) */
23347
+ 503: {
23348
+ headers: {
23349
+ [name: string]: unknown;
23350
+ };
23351
+ content: {
23352
+ "application/json": components["schemas"]["ErrorMessageDto"];
23353
+ };
23354
+ };
23355
+ };
23356
+ };
23090
23357
  postRulesSkillsPullRequest: {
23091
23358
  parameters: {
23092
23359
  query?: never;
package/src/index.ts CHANGED
@@ -934,6 +934,45 @@ export interface AiUsageSpendKeyInsightsDto {
934
934
  items: AiUsageSpendKeyInsightItemDto[];
935
935
  }
936
936
 
937
+ /** Workspace default model-mix right-sizing policy (Phase B). Null on GET → Phase A constants. */
938
+ export interface AiModelPolicyConfigDto {
939
+ /** Premium share of model spend threshold (%); 1–100. */
940
+ premiumShareThresholdPct: number;
941
+ /** Optional extra premium model-name globs (case-insensitive); extends Phase A allowlist. */
942
+ premiumModelPatterns?: string[];
943
+ /** Min total model spend (cents) before workspace card emits. */
944
+ minWorkspaceSpendCents?: number;
945
+ /** Min distinct active model-spend days for a person card. */
946
+ minPersonActiveDays?: number;
947
+ /** Min personal model spend (cents) before a person card emits. */
948
+ minPersonSpendCents?: number;
949
+ /** Optional coaching copy override for recommendedAction. */
950
+ defaultGuidance?: string;
951
+ }
952
+
953
+ /** Per-person override for model-mix coaching (keyed by person_id). */
954
+ export type AiModelPolicyOverrideMode = "allow_premium" | "coach_downgrade";
955
+
956
+ export interface AiModelPolicyPersonOverrideDto {
957
+ mode: AiModelPolicyOverrideMode;
958
+ /** Effective threshold for coach_downgrade (default 25 when omitted). */
959
+ thresholdPct?: number;
960
+ note?: string;
961
+ updatedAt: string;
962
+ updatedByUserId: string;
963
+ }
964
+
965
+ /**
966
+ * GET/PUT /workspaces/:workspaceId/ai-model-policy body/response.
967
+ * Overrides must not change spend rollups — read-path coaching only.
968
+ */
969
+ export interface AiModelPolicyDto {
970
+ /** Null clears / means Phase A constants on the key-insights engine. */
971
+ policy: AiModelPolicyConfigDto | null;
972
+ /** Map keyed by person_id; max 200 entries. */
973
+ overrides: Record<string, AiModelPolicyPersonOverrideDto>;
974
+ }
975
+
937
976
  /** Whether AI-assisted code % is from ingest or token heuristics. */
938
977
  export type AiAssistedCodeDataQuality = "estimated" | "measured";
939
978