import { ContentItem } from '../content/content.type'; import { GovCostGroup, GovUsageWindow } from '../../common/constants/gov.constant'; export interface GovResourceProfile { cpu?: string; memory?: string; gpu?: string; pvcSize?: string; } export interface GovTaskSource { type: 'manual' | 'ado' | 'team'; config?: { /** manual */ tasks?: GovTaskItem[]; /** ado (required when type = 'ado') */ query?: string; /** team */ roomId?: string; }; } export interface GovMonitoringCheck { name: string; url: string; expectedStatus?: number; intervalSeconds?: number; } export type GovAgentData = { name: string; type: string; /** Chosen at create time, readonly afterwards. */ mode?: GovAgentMode; /** Worker-only — `true` (pod) | `false` (identity-only). */ runtime?: boolean; owner: string; model?: string; image?: string; /** * Instance-level config overrides — the input of `update_config`. * Rendered into the values file; the pod restarts with the new config * after the PR merges (see §5). */ overrides?: GovOverrides; project?: string; workspacePvcName?: string; helmValuesPath?: string; onboardingPrUrl?: string; /** Mirrored from the Worker CR status (`@:`) via worker_status. */ matrixUserId?: string; lastSyncedAt?: string; status?: string; }; export type GovAgent = ContentItem; export type GovAgentTypeData = { name: string; version: string; parentType?: string; inherits?: boolean; soulTemplate?: string; skillsTemplate?: string[]; image?: string; resourceProfile?: GovResourceProfile; defaultModel?: string; workspaceTemplate?: string; status?: string; }; export type GovAgentType = ContentItem; export type GovTeamData = { name: string; members: string[]; leader?: string; project?: string; taskSource?: GovTaskSource; matrixRoomId?: string; status?: string; }; export type GovTeam = ContentItem; export interface GovInfraConnection { type: string; name: string; secretRef: string; } export type GovProjectData = { name: string; description?: string; specRepoUrl?: string; codeRepoUrl?: string; branch?: string; agents?: string[]; infraConnections?: GovInfraConnection[]; taskSource?: GovTaskSource; monitoring?: { checks?: GovMonitoringCheck[]; }; status?: string; }; export type GovProject = ContentItem; export type GovGatewayProviderData = { name: string; /** Pricing join key — the gateway `ai_route` label (e.g. `ai-route-zai.internal`). */ routeName?: string; /** * McpBridge registry name (e.g. `llm-ZAI.internal`). When set, the provider * becomes a gateway upstream (domain taken from `apiEndpoint`); providers * without it are pricing-only and are skipped by `sync_provider`. */ serviceName?: string; apiEndpoint: string; /** Secret reference — the key lives in ai-proxy (`llm-secrets`), never committed. */ apiKeyRef: string; pricingCurrency?: string; pricingInputPer1kTokens?: number; pricingOutputPer1kTokens?: number; pricingUpdatedAt?: string; pricingUpdatedBy?: string; enabled?: boolean; status?: string; }; export type GovGatewayProvider = ContentItem; export interface GovRouteWeight { providerName: string; weight: number; /** Real provider model name — rewrites the tier alias (model-mapper WasmPlugin). */ model?: string; } export type GovGatewayRouteData = { name: string; modelPattern: string; routes: GovRouteWeight[]; /** Ingress hosts the route applies to (matchRules of the WasmPlugin). */ ingresses?: string[]; maxRetries?: number; failoverOn?: string[]; circuitBreakerThreshold?: number; circuitBreakerCooldownSeconds?: number; dailyTokenBudget?: number; dailyRequestBudget?: number; status?: string; }; export type GovGatewayRoute = ContentItem; export type GovGatewayConsumerData = { agent: string; consumerKey: string; rateLimitRpm?: number; rateLimitTpm?: number; dailySpendCap?: number; rateLimitRpd?: number; rateLimitTpd?: number; enabled?: boolean; status?: string; }; export type GovGatewayConsumer = ContentItem; export type GovContentPolicyData = { name: string; denyPatterns?: string[]; allowPatterns?: string[]; maxRequestLength?: number; maxPiiDensity?: number; enabled?: boolean; status?: string; }; export type GovContentPolicy = ContentItem; export type GovUsageRecordData = { agent: string; provider: string; model: string; inputTokens: number; outputTokens: number; cost?: string; latencyMs?: number; timestamp: string; requestId: string; status?: string; }; export type GovUsageRecord = ContentItem; export type GovCostReportData = { name: string; reportType: string; targetId: string; windowStart: string; windowEnd: string; totalTokens?: number; totalCost?: string; requestCount?: number; generatedAt?: string; }; export type GovCostReport = ContentItem; export type GovLifecycleEventData = { name: string; agent: string; eventType: string; prUrl?: string; argoSyncId?: string; actor: string; timestamp?: string; }; export type GovLifecycleEvent = ContentItem; /** CT `gov.alert` — portal-wide alert feed (§5). `firing —resolve→ resolved†`. */ export type GovAlertData = { /** Auto-generated `--`. */ name?: string; /** `spend_spike` · `crash_loop` · `provider_429` · `provider_5xx` · `agent_rate_limited` · … */ alertType: string; severity?: string; /** `agent` / `provider` / `consumer` / `route` / `fleet`. */ targetType?: string; targetId: string; /** Measured value that tripped the threshold (cost/h, error count, …). */ value?: number; threshold?: number; details?: Record; observedAt?: string; resolvedAt?: string; status?: string; }; export type GovAlert = ContentItem; /** * Gateway GitOps actions (`sync_provider`, `delete_provider`, `sync_route`, * `delete_route`, `sync_consumer_limits`, `publish_content_policy`) auto-merge * their PR by default (settings `gitops.auto_merge_pr: true`) so ArgoCD * applies immediately. Pass `autoMerge: false` to keep the PR open for * review. Their outputs then carry `merged: true | false`. Onboarding is * always a Draft PR. GitOps + Higress connections are read ONLY from pack * settings / env (`GITHUB_TOKEN`, `HIGRESS_USER`, `HIGRESS_PASS`) — no * connection params exist on any action. */ export interface GovAutoMergeParams { autoMerge?: boolean; } /** Instance overrides for `resolve_config` / `onboard`. */ export interface GovOverrides { model?: string; image?: string; env?: Record; resourceProfile?: GovResourceProfile; skills?: { add?: string[]; remove?: string[]; }; } /** Lifecycle modes — `mode` chooses how onboard/suspend/resume/decommission patch. */ export type GovAgentMode = 'worker' | 'standalone' | 'api-only'; export interface GovOnboardParams { /** Identity key. */ name?: string; owner?: string; type?: string; mode?: GovAgentMode; runtime?: boolean; project?: string; /** Resource requests/limits (plain strings — e.g. "2", "4Gi"). */ cpu?: string; memory?: string; /** Standalone/worker workspace volume size (e.g. "20Gi"). */ pvcSize?: string; /** Standalone only — UI host domain (default `gateway.default_agent_domain`). */ uiHost?: string; /** Resolved agent-type object — overrides the config resolution. */ resolvedType?: Record; /** Type registry fallback when the CMS lookup misses. */ types?: Record; } export interface GovOnboardOutput { agent: string; mode: GovAgentMode | string; branch: string; prUrl: string; prNumber: number; agentFile: string; /** Worker = null (controller owns `worker-`); standalone/api-only = real key. */ consumerKey: string | null; consumerOwner?: string; gatewayKeySecret?: string; consumerSecretYaml?: string; consumerSecretApply?: string; /** worker/standalone = `provisioning` · api-only = `active`. */ status: string; } export interface GovLifecycleParams { name?: string; /** Default `worker` — decides how the patch is applied. */ mode?: GovAgentMode; } export interface GovLifecycleOutput { agent: string; mode: GovAgentMode | string; prUrl: string; status: string; } /** * `update_config` — read-modify-write of only the portal-owned fields into * the current values file; operator-edited fields (image/env/dotfiles/ * backup/storageClass/tlsSecretName/…) are preserved (§5). Omitted fields * default to the row values. */ export interface GovUpdateConfigParams extends GovAutoMergeParams { name?: string; runtime?: boolean; project?: string; cpu?: string; memory?: string; pvcSize?: string; uiHost?: string; /** Row override wins; file without model (worker) backfills the type's * `default_model`; an operator-pinned model is never overwritten. */ model?: string; resolvedType?: Record; types?: Record; } export interface GovUpdateConfigOutput { agent: string; prUrl: string; branch: string; merged: boolean; status: string; } export interface GovWorkerRef { name?: string; namespace?: string; kind?: string; status?: Record; [key: string]: unknown; } export interface GovSyncStatusParams { workers?: GovWorkerRef[]; agentNames?: string[]; includeTeams?: boolean; workerUuids?: Record; } export interface GovSyncStatusAgent { name: string; namespace?: string; type?: string; model?: string; status: string; workspacePvcName?: string; persisted?: boolean; } export interface GovSyncStatusOutput { agents: GovSyncStatusAgent[]; persisted: number; } export interface GovResolveConfigParams { typeName?: string; name?: string; overrides?: GovOverrides; types?: Record; } export interface GovResolvedType { name: string; version: string; inheritanceChain: string[]; soulTemplate?: string; image?: string; defaultModel?: string; skillsTemplate: string[]; workspaceTemplate?: string; resourceProfile: GovResourceProfile; } export interface GovResolveConfigOutput { resolved: GovResolvedType; } export interface GovSeedsOutput { seeded: number; skipped: number; total: number; } export interface GovCreateConsumerParams { agentName: string; consumerKey?: string; } export interface GovCreateConsumerOutput { agent: string; consumerKey: string; response: Record; } export interface GovRevokeConsumerParams { consumerName: string; } export interface GovRevokeConsumerOutput { revoked: string; } /** * `sync_provider` — GitOps upsert of the McpBridge provider registry into * `gateway/mcpbridge-providers.yaml` (read-modify-write; foreign * registries untouched) + PR. Accepts a single provider row (fields spread * or `{provider: {...}}`) or a batch `{providers: [...]}`. Providers with a * `serviceName` become registry entries (domain from `apiEndpoint`); * pricing-only providers are skipped. API keys stay in ai-proxy * (`llm-secrets`) and never ride the PR. */ export interface GovSyncProviderParams extends GovAutoMergeParams { provider?: Record; providers?: Record[]; [key: string]: unknown; } /** * Output of `sync_provider` (api_references §5): the applied provider names * + PR fields. `providers[]` is authoritative; `provider` mirrors the first * entry for single-row syncs. */ export interface GovSyncProviderOutput { success?: boolean; providers: string[]; /** First synced provider name (single-provider calls). */ provider?: string; prUrl: string; branch: string; merged: boolean; } export interface GovDeleteProviderParams extends GovAutoMergeParams { /** Provider row spread, or `{provider: {...}}`. */ provider?: Record; name?: string; /** McpBridge registry to remove — absent/missing registry → `removed:false` no-op. */ serviceName?: string; } /** * Output of `delete_provider` — removes the registry entry from * `gateway/mcpbridge-providers.yaml`; no-op (`removed: false`, no PR) when * there is no `serviceName` or the registry does not exist. */ export interface GovDeleteProviderOutput { success?: boolean; provider: string; registry?: string; removed: boolean; prUrl?: string | null; branch?: string; merged?: boolean; } export interface GovSyncRouteParams extends GovAutoMergeParams { route?: Record; reader?: Record; [key: string]: unknown; } export interface GovSyncRouteOutput { route: string; prUrl: string; branch: string; /** Always present — gateway actions auto-merge by default (§8). */ merged: boolean; } export interface GovDeleteRouteParams extends GovAutoMergeParams { routeName: string; reader?: Record; } export interface GovDeleteRouteOutput { deleted: string; prUrl: string; branch: string; merged: boolean; } export interface GovSyncConsumerLimitsParams extends GovAutoMergeParams { consumer?: Record; [key: string]: unknown; } export interface GovSyncConsumerLimitsOutput { consumer: string; prUrl: string; branch: string; merged: boolean; } export interface GovPublishPolicyParams extends GovAutoMergeParams { policy?: Record; [key: string]: unknown; } export interface GovPiiRule { name: string; pattern: string; replacement: string; } export interface GovInjectionRule { name: string; pattern: string; } export interface GovWasmConfig { blockedCode: number; blockedMessage: string; checkSystemMessages: boolean; piiRules: GovPiiRule[]; promptInjectionRules: GovInjectionRule[]; contentPolicyPatterns: string[]; contentPolicyRejectMessage: string; } export interface GovPublishPolicyOutput { policy: string; wasmConfig: GovWasmConfig; prUrl: string; branch: string; merged: boolean; } export interface GovMatrixRow { agent: string; projects: string[]; projectCount: number; } export interface GovAssignmentMatrixParams { projects?: Record[]; agents?: (string | Record)[]; } export interface GovAssignmentMatrixOutput { matrix: GovMatrixRow[]; } export interface GovTaskItem { title: string; status: string; assignee?: string; source?: string; } export interface GovAggregateTasksParams { projects?: Record[]; [key: string]: unknown; } export interface GovProjectTasksOutput { project: string; tasks: GovTaskItem[]; } export interface GovProjectTasksError { project: string; error: string; } export type GovAggregateTasksOutput = { projects: Array; }; export interface GovRunMonitoringParams { project?: Record; timeout?: number; } export interface GovMonitoringCheckResult { name: string; url: string; expectedStatus: number; intervalSeconds: number; ok: boolean; statusCode: number; error?: string; } export interface GovMonitoringOutput { project: string; checks: GovMonitoringCheckResult[]; allOk: boolean; } export interface GovTeamParams { team?: Record; [key: string]: unknown; } /** * `create_team` / `archive_team` — renders the * `teams.agentteams.io/v1beta1 Team` CRD into `teams/.yaml` + Draft PR. */ export interface GovTeamOutput { applied: string; kind: 'Team'; prUrl: string; branch: string; } /** `ensure_coordinator` (setting.gov) — idempotent fleet-coordinator singleton. */ export interface GovEnsureCoordinatorOutput { coordinator: 'created' | 'exists'; key: string; /** uuid of the backing CT row. */ row: string; } export interface GovPricingEntry { pricingInputPer1kTokens: number; pricingOutputPer1kTokens: number; pricingCurrency?: string; } /** * Pricing override table for the cost actions. Keys join against * `gov.gateway_provider` rows via `routeName` | `name` (the Prometheus * `ai_route` label maps to the provider) — see api_references §11. */ export type GovPricingTable = Record; export interface GovUsageSample { provider: string; model: string; inputTokens: number; outputTokens: number; consumer?: string; latencyMs?: number; timestamp?: string; } export interface GovAggregateUsageParams { windowMinutes?: number; prometheusBaseUrl?: string; pricing?: GovPricingTable; hourlyBaselineCost?: number; /** Days of history for the baseline used by the spike detection. */ baselineWindowDays?: number; spikeMultiplier?: number; reportType?: string; targetId?: string; requestId?: string; } export interface GovAggregateUsageOutput { windowStart: string; windowEnd: string; usageRecords: number; totalCost: string; costReport: GovCostReportData; alert: 'spend_spike' | null; } export interface GovGenerateCostReportParams { usages: GovUsageSample[]; pricing: GovPricingTable; reportType?: string; targetId?: string; windowStart?: string; windowEnd?: string; } export interface GovComputeCostParams { usages: GovUsageSample[] | GovUsageSample; pricing: GovPricingTable; } export interface GovComputeCostItem { provider: string; model: string; consumer?: string; inputTokens: number; outputTokens: number; cost: string; } export interface GovComputeCostOutput { totalCost: string; currency: string; items: GovComputeCostItem[]; } export interface GovUsageGroupRow { group: string; cost: number | string; tokens: number | string; requests: number | string; } export interface GovUsageDashboardParams { window?: GovUsageWindow; records?: Record[]; requestsTotal?: number; errorsTotal?: number; latencySamples?: number[]; groupKey?: string; topN?: number; } export interface GovUsageDashboard { window: string; recordCount: number; topConsumers: GovUsageGroupRow[]; latencyPercentiles: { p50: number; p95: number; p99: number; }; errorRate: number; } export interface GovUsageExportParams { records?: Record[]; columns?: string[]; filename?: string; } export interface GovUsageExport { filename: string; contentType: 'text/csv'; content: string; } /** Query for `/usage/cost` + `/usage/dashboard` + `/usage/export`. */ export interface GovUsageQuery { group?: GovCostGroup; window?: GovUsageWindow; } export interface GovUsageCost { window: string; breakdown: GovUsageGroupRow[]; } /** Which CT + action manage a portal-governed plugin (absent for fleet plugins). */ export interface GovPortalEdit { contentType: string; action: string; } export interface GovPluginMatchRule { ingress?: string; service?: string; } export interface GovPluginFile { file: string; /** Present only when the YAML parses. */ kind?: string; name?: string; defaultConfigDisable?: boolean; matchRules?: GovPluginMatchRule[]; portalEdit?: GovPortalEdit; } export interface GovPluginsResponse { repo: string; /** Fixed `gateway/` directory of the gitops repo. */ path: string; plugins: GovPluginFile[]; } /** Envelopes of the portal REST endpoints. */ export interface IGovMatrixResponse { matrix: GovMatrixRow[]; } export interface IGovUsageCostResponse extends GovUsageCost { } export interface IGovUsageDashboardResponse extends GovUsageDashboard { } export interface IGovUsageExportResponse extends GovUsageExport { } /** Options accepted by every gov action wrapper. */ export interface GovActionOpts { intentionId?: string; expectedVersion?: number; } export interface GovWorkerStatusParams { /** Default: the engine's `deployment.namespace` setting. */ namespace?: string; } export interface GovWorkerCondition { type: string; status: string; reason?: string; message?: string; } export interface GovWorkerStatusOutput { found: boolean; agent: string; namespace: string; phase?: string; matrixUserId?: string; observedGeneration?: number; conditions?: GovWorkerCondition[]; /** Present when `found: false`. */ error?: string; } export interface GovWorkerGatewayKeyOutput { found: boolean; agent: string; consumer?: string; gatewayKey?: string; error?: string; } //# sourceMappingURL=gov.type.d.ts.map