@xpert-ai/contracts 3.15.18 → 3.17.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.
Files changed (83) hide show
  1. package/index.cjs.js +301 -472
  2. package/index.esm.js +270 -465
  3. package/package.json +1 -1
  4. package/src/agent/ai-model.d.ts +4 -1
  5. package/src/agent/graph.d.ts +2 -0
  6. package/src/ai/ai-model.model.d.ts +2 -1
  7. package/src/ai/assistant-binding.model.d.ts +0 -1
  8. package/src/ai/evolution/candidate.d.ts +67 -0
  9. package/src/ai/evolution/capability-version.d.ts +45 -0
  10. package/src/ai/evolution/evaluation.d.ts +93 -0
  11. package/src/ai/evolution/example.d.ts +42 -0
  12. package/src/ai/evolution/experience.d.ts +21 -0
  13. package/src/ai/evolution/governance.d.ts +87 -0
  14. package/src/ai/evolution/index.d.ts +11 -0
  15. package/src/ai/evolution/learning-event.d.ts +69 -0
  16. package/src/ai/evolution/provider.d.ts +30 -0
  17. package/src/ai/evolution/release.d.ts +144 -0
  18. package/src/ai/evolution/runtime.d.ts +81 -0
  19. package/src/ai/evolution/target.d.ts +83 -0
  20. package/src/ai/feature.model.d.ts +3 -1
  21. package/src/ai/index.d.ts +5 -0
  22. package/src/ai/knowledge-doc-chunk.model.d.ts +143 -0
  23. package/src/ai/knowledge-doc.model.d.ts +53 -4
  24. package/src/ai/knowledge-filter.model.d.ts +92 -0
  25. package/src/ai/knowledge-retrieval-log.model.d.ts +18 -2
  26. package/src/ai/knowledgebase-task.model.d.ts +3 -1
  27. package/src/ai/knowledgebase.model.d.ts +6 -0
  28. package/src/ai/membership.model.d.ts +224 -7
  29. package/src/ai/model-access.model.d.ts +229 -0
  30. package/src/ai/model-gateway.model.d.ts +164 -0
  31. package/src/ai/model-usage.model.d.ts +163 -0
  32. package/src/ai/role-permissions.d.ts +11 -1
  33. package/src/ai/sandbox-terminal.model.d.ts +4 -0
  34. package/src/ai/xpert-agent-execution.model.d.ts +2 -0
  35. package/src/ai/xpert.model.d.ts +31 -11
  36. package/src/{analytics/data-source-type.d.ts → data-source-type.model.d.ts} +1 -1
  37. package/src/{analytics/data-source.d.ts → data-source.model.d.ts} +4 -7
  38. package/src/feature.model.d.ts +3 -1
  39. package/src/index.d.ts +4 -1
  40. package/src/plugin.d.ts +4 -0
  41. package/src/referral.model.d.ts +36 -0
  42. package/src/role-permission.model.d.ts +5 -3
  43. package/src/role.model.d.ts +0 -1
  44. package/src/tenant.model.d.ts +5 -0
  45. package/src/user.model.d.ts +1 -0
  46. package/src/utils.d.ts +5 -0
  47. package/src/view-extension/model.d.ts +12 -1
  48. package/src/analytics/ai.d.ts +0 -73
  49. package/src/analytics/approval-policy.model.d.ts +0 -30
  50. package/src/analytics/business-area-user.model.d.ts +0 -35
  51. package/src/analytics/business-area.d.ts +0 -17
  52. package/src/analytics/certification.model.d.ts +0 -11
  53. package/src/analytics/chatbi-conversation.model.d.ts +0 -15
  54. package/src/analytics/chatbi-model.model.d.ts +0 -18
  55. package/src/analytics/collection.model.d.ts +0 -6
  56. package/src/analytics/comment.model.d.ts +0 -10
  57. package/src/analytics/favorite.d.ts +0 -14
  58. package/src/analytics/features.d.ts +0 -23
  59. package/src/analytics/feed-model.d.ts +0 -13
  60. package/src/analytics/gateway.d.ts +0 -28
  61. package/src/analytics/index.d.ts +0 -38
  62. package/src/analytics/indicator-app.d.ts +0 -44
  63. package/src/analytics/indicator-market.d.ts +0 -4
  64. package/src/analytics/indicator.d.ts +0 -105
  65. package/src/analytics/model-query-log.model.d.ts +0 -41
  66. package/src/analytics/model-query.d.ts +0 -21
  67. package/src/analytics/notification-destination.d.ts +0 -10
  68. package/src/analytics/permission-approval-user.model.d.ts +0 -10
  69. package/src/analytics/permission-approval.model.d.ts +0 -47
  70. package/src/analytics/project.model.d.ts +0 -50
  71. package/src/analytics/role-permissions.d.ts +0 -28
  72. package/src/analytics/schema.d.ts +0 -262
  73. package/src/analytics/screenshot.model.d.ts +0 -24
  74. package/src/analytics/semantic-model-entity.d.ts +0 -38
  75. package/src/analytics/semantic-model-member.d.ts +0 -27
  76. package/src/analytics/semantic-model.d.ts +0 -183
  77. package/src/analytics/story-point.d.ts +0 -11
  78. package/src/analytics/story-template.model.d.ts +0 -28
  79. package/src/analytics/story-widget.d.ts +0 -12
  80. package/src/analytics/story.d.ts +0 -93
  81. package/src/analytics/subscription.d.ts +0 -38
  82. package/src/analytics/visit.model.d.ts +0 -34
  83. package/src/analytics/webSocket.d.ts +0 -48
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/contracts",
3
- "version": "3.15.18",
3
+ "version": "3.17.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -5,5 +5,8 @@ export declare enum AiModelTypeEnum {
5
5
  SPEECH2TEXT = "speech2text",
6
6
  MODERATION = "moderation",
7
7
  TTS = "tts",
8
- TEXT2IMG = "text2img"
8
+ IMAGE = "image",
9
+ /** @deprecated Use IMAGE for new image-generation model providers. */
10
+ TEXT2IMG = "text2img",
11
+ VIDEO = "video"
9
12
  }
@@ -96,6 +96,8 @@ export type TAgentRunnableConfigurable = {
96
96
  context?: Record<string, unknown> & {
97
97
  env?: Record<string, unknown>;
98
98
  };
99
+ /** Current graph state exposed to tools for resolving server-owned configuration variables. */
100
+ runtimeState?: Record<string, unknown>;
99
101
  copilotModel?: ICopilotModel;
100
102
  subscriber: Subscriber<any>;
101
103
  /**
@@ -2,6 +2,7 @@ import { AiModelTypeEnum } from '../agent/index';
2
2
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
3
3
  import { I18nObject } from '../types';
4
4
  import { ICopilot } from './copilot.model';
5
+ import type { ModelUsagePricingConfig } from './model-usage.model';
5
6
  export interface IAiModel extends IBasePerTenantAndOrganizationEntityModel {
6
7
  /**
7
8
  * Model name
@@ -181,7 +182,7 @@ export interface PriceConfig {
181
182
  }
182
183
  export interface AIModelEntity extends ProviderModel {
183
184
  parameter_rules?: ParameterRule[];
184
- pricing?: PriceConfig;
185
+ pricing?: PriceConfig | ModelUsagePricingConfig;
185
186
  }
186
187
  export interface FieldModelSchema {
187
188
  label: I18nObject;
@@ -3,7 +3,6 @@ import { IUser } from '../user.model';
3
3
  export declare enum AssistantCode {
4
4
  CHAT_COMMON = "chat_common",
5
5
  XPERT_SHARED = "xpert_shared",
6
- CHATBI = "chatbi",
7
6
  CLAWXPERT = "clawxpert"
8
7
  }
9
8
  export declare enum AssistantBindingScope {
@@ -0,0 +1,67 @@
1
+ import { EvolutionArtifactRef, EvolutionProviderContext, EvolutionScope } from './target';
2
+ export type EvolutionCandidateStatus = 'building' | 'ready' | 'evaluating' | 'evaluation_failed' | 'pending_approval' | 'approved' | 'rejected' | 'packaged' | 'expired';
3
+ export interface EvolutionCandidate {
4
+ candidateId: string;
5
+ targetId: string;
6
+ baseVersionId: string;
7
+ proposalId: string;
8
+ proposalRevision: number;
9
+ artifact: EvolutionArtifactRef;
10
+ providerKey: string;
11
+ providerVersion: string;
12
+ dependencyVersionIds: string[];
13
+ targetScope: EvolutionScope;
14
+ buildInputsHash: string;
15
+ status: EvolutionCandidateStatus;
16
+ createdBy: string;
17
+ createdAt: string;
18
+ }
19
+ export interface BuildEvolutionCandidateRequest {
20
+ context?: EvolutionProviderContext;
21
+ targetId: string;
22
+ scope: EvolutionScope;
23
+ proposalId: string;
24
+ proposalRevision: number;
25
+ baseVersionId: string;
26
+ baseArtifact?: EvolutionArtifactRef;
27
+ changeSet: Record<string, string | number | boolean | string[]>;
28
+ evidenceEventIds: string[];
29
+ dependencyVersionIds: string[];
30
+ actorId: string;
31
+ idempotencyKey: string;
32
+ }
33
+ export interface CandidateBuildResult {
34
+ artifact: EvolutionArtifactRef;
35
+ normalizedManifest: Record<string, string | number | boolean | string[]>;
36
+ dependencyVersionIds: string[];
37
+ validationSummary: string;
38
+ warnings: string[];
39
+ providerTraceId: string;
40
+ buildInputsHash: string;
41
+ }
42
+ export interface ValidateEvolutionCandidateRequest {
43
+ context?: EvolutionProviderContext;
44
+ targetId: string;
45
+ scope: EvolutionScope;
46
+ artifact: EvolutionArtifactRef;
47
+ baseVersionId: string;
48
+ baseArtifact?: EvolutionArtifactRef;
49
+ dependencyVersionIds: string[];
50
+ }
51
+ export interface ExportEvolutionBaselineRequest {
52
+ context: EvolutionProviderContext;
53
+ targetId: string;
54
+ scope: EvolutionScope;
55
+ requestedVersionId?: string;
56
+ }
57
+ export interface ExportEvolutionBaselineResult {
58
+ artifact: EvolutionArtifactRef;
59
+ dependencyVersionIds: string[];
60
+ semanticVersion: string;
61
+ providerTraceId: string;
62
+ }
63
+ export interface CandidateValidationResult {
64
+ valid: boolean;
65
+ failureCodes: string[];
66
+ warnings: string[];
67
+ }
@@ -0,0 +1,45 @@
1
+ import { EvolutionArtifactRef, EvolutionChannel, EvolutionExecutionMode, EvolutionScope } from './target';
2
+ export interface CapabilityVersion {
3
+ versionId: string;
4
+ targetId: string;
5
+ sequence: number;
6
+ semanticVersion: string;
7
+ artifact: EvolutionArtifactRef;
8
+ providerKey: string;
9
+ providerVersion: string;
10
+ dependencyVersionIds: string[];
11
+ sourceCandidateId?: string;
12
+ createdAt: string;
13
+ createdBy: string;
14
+ }
15
+ export interface CapabilityVersionBundleItem {
16
+ targetId: string;
17
+ versionId: string;
18
+ artifactHash: string;
19
+ providerKey: string;
20
+ providerVersion: string;
21
+ }
22
+ export interface CapabilityVersionBundle {
23
+ bundleId: string;
24
+ bundleHash: string;
25
+ executionMode: EvolutionExecutionMode;
26
+ items: CapabilityVersionBundleItem[];
27
+ createdAt: string;
28
+ }
29
+ export interface ActiveCapabilityPointer {
30
+ pointerId: string;
31
+ targetId: string;
32
+ scope: EvolutionScope;
33
+ channel: EvolutionChannel;
34
+ activeVersionId: string;
35
+ rollbackVersionId?: string;
36
+ releasePackageId?: string;
37
+ revision: number;
38
+ updatedAt: string;
39
+ updatedBy: string;
40
+ }
41
+ export interface ResolveCapabilityBundleRequest {
42
+ scope: EvolutionScope;
43
+ executionMode: EvolutionExecutionMode;
44
+ targetIds: string[];
45
+ }
@@ -0,0 +1,93 @@
1
+ import { CapabilityVersionBundle } from './capability-version';
2
+ import { EvolutionProviderContext, EvolutionScope } from './target';
3
+ export interface GoldenCaseRevision {
4
+ caseId: string;
5
+ revision: number;
6
+ input: Record<string, string | number | boolean>;
7
+ expected: Record<string, string | number | boolean>;
8
+ slice: string;
9
+ risk: 'low' | 'medium' | 'high';
10
+ evidenceRef: string;
11
+ }
12
+ export interface DatasetSnapshot {
13
+ snapshotId: string;
14
+ datasetId: string;
15
+ targetId?: string;
16
+ scope?: EvolutionScope;
17
+ name: string;
18
+ evaluatorVersion: string;
19
+ metricDefinitionVersion: string;
20
+ cases: GoldenCaseRevision[];
21
+ snapshotHash: string;
22
+ createdAt: string;
23
+ }
24
+ export interface ReplayCaseRequest {
25
+ context?: EvolutionProviderContext;
26
+ evaluationRunId: string;
27
+ candidateId: string;
28
+ datasetSnapshotId: string;
29
+ caseRevision: GoldenCaseRevision;
30
+ baselineBundle: CapabilityVersionBundle;
31
+ candidateBundle: CapabilityVersionBundle;
32
+ randomSeed: number;
33
+ repeatIndex: number;
34
+ }
35
+ export interface GoldenDataset {
36
+ datasetId: string;
37
+ targetId: string;
38
+ name: string;
39
+ description?: string;
40
+ caseCount: number;
41
+ status: 'draft' | 'ready' | 'archived';
42
+ createdAt: string;
43
+ updatedAt: string;
44
+ }
45
+ export interface ReplayCaseResult {
46
+ caseId: string;
47
+ baselineOutput: Record<string, string | number | boolean>;
48
+ candidateOutput: Record<string, string | number | boolean>;
49
+ expectedOutput: Record<string, string | number | boolean>;
50
+ baselinePassed: boolean;
51
+ candidatePassed: boolean;
52
+ severeError: boolean;
53
+ latencyMs: number;
54
+ cost: number;
55
+ traceRef: string;
56
+ }
57
+ export interface MetricObservation {
58
+ metricKey: string;
59
+ value: number;
60
+ unit: 'ratio' | 'count' | 'milliseconds' | 'currency';
61
+ slice?: string;
62
+ blocking: boolean;
63
+ }
64
+ export interface EvaluationMetrics {
65
+ baselineAccuracy: number;
66
+ candidateAccuracy: number;
67
+ accuracyDelta: number;
68
+ severeErrors: number;
69
+ p95LatencyMs: number;
70
+ averageCost: number;
71
+ totalCases: number;
72
+ passedCases: number;
73
+ }
74
+ export interface EvaluationGateResult {
75
+ passed: boolean;
76
+ decision: 'promote' | 'hold' | 'reject';
77
+ blockingReasons: string[];
78
+ }
79
+ export interface EvaluationRun {
80
+ runId: string;
81
+ targetId?: string;
82
+ scope?: EvolutionScope;
83
+ candidateId: string;
84
+ datasetSnapshotId: string;
85
+ baselineBundle: CapabilityVersionBundle;
86
+ candidateBundle: CapabilityVersionBundle;
87
+ status: 'running' | 'passed' | 'failed';
88
+ metrics: EvaluationMetrics;
89
+ gate: EvaluationGateResult;
90
+ caseResults: ReplayCaseResult[];
91
+ startedAt: string;
92
+ completedAt?: string;
93
+ }
@@ -0,0 +1,42 @@
1
+ export type EvolutionPersistenceTable = 'agent_evolution_target' | 'agent_evolution_capability_version' | 'agent_evolution_capability_bundle' | 'agent_evolution_active_pointer' | 'agent_evolution_learning_event' | 'agent_evolution_proposal' | 'agent_evolution_candidate' | 'agent_evolution_dataset_snapshot' | 'agent_evolution_evaluation_run' | 'agent_evolution_approval' | 'agent_evolution_release_package' | 'agent_evolution_release_deployment' | 'agent_evolution_audit_event';
2
+ export interface EvolutionPersistenceTableEvidence {
3
+ table: EvolutionPersistenceTable;
4
+ expectedCount: number;
5
+ actualCount: number;
6
+ recordIds: string[];
7
+ missingRecordIds: string[];
8
+ }
9
+ export interface EvolutionPersistenceEvidence {
10
+ verified: boolean;
11
+ rowCount: number;
12
+ tables: EvolutionPersistenceTableEvidence[];
13
+ }
14
+ export interface EvolutionExampleDescriptor {
15
+ key: string;
16
+ name: string;
17
+ description: string;
18
+ dataClassification: 'synthetic_test_fixture';
19
+ }
20
+ export interface EvolutionSimulationResult {
21
+ example: EvolutionExampleDescriptor;
22
+ simulationId: string;
23
+ targetId: string;
24
+ eventIds: string[];
25
+ proposalId: string;
26
+ candidateId: string;
27
+ datasetSnapshotId: string;
28
+ evaluationRunId: string;
29
+ approvalId: string;
30
+ releasePackageId: string;
31
+ deploymentIds: string[];
32
+ bundleIds: string[];
33
+ versionIds: string[];
34
+ pointerId: string;
35
+ previousVersionId: string;
36
+ activeVersionId: string;
37
+ pointerRevision: number;
38
+ gatePassed: boolean;
39
+ auditIds: string[];
40
+ auditActions: string[];
41
+ persistence: EvolutionPersistenceEvidence;
42
+ }
@@ -0,0 +1,21 @@
1
+ import type { EvolutionScope } from './target';
2
+ export interface EvolutionExperience {
3
+ experienceId: string;
4
+ targetId: string;
5
+ scope: EvolutionScope;
6
+ sourceReleasePackageId: string;
7
+ sourceCandidateId: string;
8
+ evidence: {
9
+ productionObservationCount: number;
10
+ severeErrors: number;
11
+ stableDays: number;
12
+ evaluationRunId: string;
13
+ };
14
+ summary: string;
15
+ status: 'active' | 'expired';
16
+ createdAt: string;
17
+ createdBy: string;
18
+ }
19
+ export interface CreateEvolutionExperienceRequest {
20
+ releasePackageId: string;
21
+ }
@@ -0,0 +1,87 @@
1
+ export interface EvolutionPageQuery {
2
+ page?: number;
3
+ pageSize?: number;
4
+ search?: string;
5
+ targetId?: string;
6
+ status?: string;
7
+ sort?: 'createdAt' | 'updatedAt' | 'status';
8
+ order?: 'ASC' | 'DESC';
9
+ }
10
+ export interface EvolutionPage<T> {
11
+ items: T[];
12
+ total: number;
13
+ page: number;
14
+ pageSize: number;
15
+ }
16
+ export interface ReviewLearningEventRequest {
17
+ reviewStatus: 'pending' | 'ignored' | 'golden';
18
+ }
19
+ export interface DiagnoseLearningEventsRequest {
20
+ eventIds: string[];
21
+ }
22
+ export interface EvolutionAnalysisResult {
23
+ diagnoses: import('./learning-event').EvolutionDiagnosis[];
24
+ clusters: import('./learning-event').EvolutionEventCluster[];
25
+ }
26
+ export interface CreateImprovementProposalRequest {
27
+ targetId: string;
28
+ scope: import('./target').EvolutionScope;
29
+ eventIds: string[];
30
+ title: string;
31
+ problemStatement: string;
32
+ rootCause: string;
33
+ changeHypothesis: string;
34
+ riskLevel: import('./target').EvolutionRiskLevel;
35
+ }
36
+ export interface BuildCandidateCommand {
37
+ proposalId: string;
38
+ proposalRevision: number;
39
+ changeSet: Record<string, string | number | boolean | string[]>;
40
+ }
41
+ export interface CreateDatasetSnapshotRequest {
42
+ datasetId: string;
43
+ targetId: string;
44
+ scope: import('./target').EvolutionScope;
45
+ name: string;
46
+ evaluatorVersion: string;
47
+ metricDefinitionVersion: string;
48
+ cases: import('./evaluation').GoldenCaseRevision[];
49
+ }
50
+ export interface EvaluateCandidateCommand {
51
+ candidateId: string;
52
+ datasetSnapshotId: string;
53
+ }
54
+ export interface DecideCandidateApprovalRequest {
55
+ evaluationRunId: string;
56
+ decision: 'approved' | 'rejected';
57
+ reason: string;
58
+ }
59
+ export interface CreateReleasePackageRequest {
60
+ candidateId: string;
61
+ evaluationRunId: string;
62
+ approvalIds: string[];
63
+ shadowMinimumSamples?: number;
64
+ }
65
+ export interface StartDeploymentRequest {
66
+ canaryPercent?: 5 | 25 | 50;
67
+ }
68
+ export interface CreateEvolutionCanaryTestOverrideRequest {
69
+ subjectKey: string;
70
+ reason: string;
71
+ /** Defaults to 30 minutes and is capped by the server. */
72
+ expiresInMinutes?: number;
73
+ }
74
+ export type EvolutionJobType = 'evaluation' | 'install' | 'shadow' | 'canary' | 'rollback';
75
+ export type EvolutionJobStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
76
+ export interface EvolutionJob {
77
+ jobId: string;
78
+ jobType: EvolutionJobType;
79
+ resourceId: string;
80
+ status: EvolutionJobStatus;
81
+ queueJobId?: string;
82
+ errorCode?: string;
83
+ errorMessage?: string;
84
+ createdAt: string;
85
+ startedAt?: string;
86
+ completedAt?: string;
87
+ }
@@ -0,0 +1,11 @@
1
+ export * from './target';
2
+ export * from './capability-version';
3
+ export * from './learning-event';
4
+ export * from './candidate';
5
+ export * from './evaluation';
6
+ export * from './release';
7
+ export * from './provider';
8
+ export * from './example';
9
+ export * from './runtime';
10
+ export * from './governance';
11
+ export * from './experience';
@@ -0,0 +1,69 @@
1
+ import { EvolutionScope } from './target';
2
+ export type LearningEventType = 'prediction_reviewed' | 'execution_failed' | 'business_outcome';
3
+ export type LearningEventConfidence = 'L1' | 'L2' | 'L3' | 'L4';
4
+ export interface LearningEventInput {
5
+ eventId?: string;
6
+ eventType: LearningEventType;
7
+ schemaVersion: string;
8
+ idempotencyKey: string;
9
+ eventTime: string;
10
+ scope: EvolutionScope;
11
+ executionId?: string;
12
+ threadId?: string;
13
+ traceId?: string;
14
+ targetId: string;
15
+ decisionPoint: string;
16
+ subjectRef: string;
17
+ inputFingerprint: string;
18
+ predictionSummary: string;
19
+ finalOutcomeSummary: string;
20
+ confidence: number;
21
+ reasonCodes: string[];
22
+ capabilityVersionBundleId: string;
23
+ bundleHash: string;
24
+ trustLevel: LearningEventConfidence;
25
+ classification: 'public' | 'internal' | 'confidential';
26
+ redactionStatus: 'not_required' | 'redacted';
27
+ }
28
+ export interface LearningEvent extends LearningEventInput {
29
+ eventId: string;
30
+ createdAt: string;
31
+ reviewStatus?: 'pending' | 'ignored' | 'golden';
32
+ }
33
+ export interface EvolutionDiagnosis {
34
+ diagnosisId: string;
35
+ targetId: string;
36
+ scope: EvolutionScope;
37
+ eventIds: string[];
38
+ rootCause: string;
39
+ correctionSignature: string;
40
+ confidence: number;
41
+ createdAt: string;
42
+ }
43
+ export interface EvolutionEventCluster {
44
+ clusterId: string;
45
+ targetId: string;
46
+ scope: EvolutionScope;
47
+ correctionSignature: string;
48
+ eventIds: string[];
49
+ caseCount: number;
50
+ status: 'collecting' | 'proposal_ready' | 'closed';
51
+ createdAt: string;
52
+ updatedAt: string;
53
+ }
54
+ export interface ImprovementProposal {
55
+ proposalId: string;
56
+ revision: number;
57
+ targetId: string;
58
+ scope: EvolutionScope;
59
+ title: string;
60
+ problemStatement: string;
61
+ rootCause: string;
62
+ changeHypothesis: string;
63
+ evidenceEventIds: string[];
64
+ baseVersionId: string;
65
+ riskLevel: 'R1' | 'R2' | 'R3' | 'R4';
66
+ status: 'draft' | 'ready' | 'candidate_built' | 'rejected';
67
+ createdAt: string;
68
+ createdBy: string;
69
+ }
@@ -0,0 +1,30 @@
1
+ import { BuildEvolutionCandidateRequest, CandidateBuildResult, CandidateValidationResult, ExportEvolutionBaselineRequest, ExportEvolutionBaselineResult, ValidateEvolutionCandidateRequest } from './candidate';
2
+ import { MetricObservation, ReplayCaseRequest, ReplayCaseResult } from './evaluation';
3
+ import { ReleaseProviderReceipt, ReleaseProviderRequest } from './release';
4
+ import { EvolutionTargetDescriptor } from './target';
5
+ export interface EvolutionCandidateBuilder {
6
+ buildCandidate(request: BuildEvolutionCandidateRequest): Promise<CandidateBuildResult>;
7
+ validateCandidate(request: ValidateEvolutionCandidateRequest): Promise<CandidateValidationResult>;
8
+ }
9
+ export interface EvolutionBaselineExporter {
10
+ exportBaseline(request: ExportEvolutionBaselineRequest): Promise<ExportEvolutionBaselineResult>;
11
+ }
12
+ export interface EvolutionReplayEvaluator {
13
+ runReplayCase(request: ReplayCaseRequest): Promise<ReplayCaseResult>;
14
+ evaluateResult(request: ReplayCaseRequest, result: ReplayCaseResult): Promise<MetricObservation[]>;
15
+ }
16
+ export interface EvolutionReleaseProvider {
17
+ install(request: ReleaseProviderRequest): Promise<ReleaseProviderReceipt>;
18
+ activate(request: ReleaseProviderRequest): Promise<ReleaseProviderReceipt>;
19
+ rollback(request: ReleaseProviderRequest): Promise<ReleaseProviderReceipt>;
20
+ }
21
+ export interface EvolutionTargetProvider {
22
+ readonly descriptor: EvolutionTargetDescriptor;
23
+ readonly baselineExporter?: EvolutionBaselineExporter;
24
+ readonly candidateBuilder?: EvolutionCandidateBuilder;
25
+ readonly replayEvaluator?: EvolutionReplayEvaluator;
26
+ readonly releaseProvider?: EvolutionReleaseProvider;
27
+ }
28
+ export interface EvolutionProvider extends EvolutionTargetProvider {
29
+ describeTargets?(): Promise<EvolutionTargetDescriptor[]> | EvolutionTargetDescriptor[];
30
+ }
@@ -0,0 +1,144 @@
1
+ import { EvolutionChannel, EvolutionProviderContext, EvolutionScope } from './target';
2
+ export type EvolutionReleaseStatus = 'draft' | 'pending_approval' | 'approved' | 'installed' | 'shadow' | 'canary' | 'active' | 'paused' | 'rolled_back' | 'superseded';
3
+ export type EvolutionApprovalAuthority = 'standard' | 'administrator';
4
+ export type EvolutionReleaseGateProfile = 'standard' | 'manual_test';
5
+ /**
6
+ * Frozen staged-release gates. `manual_test` is accepted only by a
7
+ * non-production server and requires an administrator for gated actions.
8
+ */
9
+ export interface EvolutionReleaseGatePolicy {
10
+ profile: EvolutionReleaseGateProfile;
11
+ shadowMinimumSamples: number;
12
+ shadowMinimumDurationHours: number;
13
+ canaryMinimumSamples: number;
14
+ canaryMinimumDurationHours: number;
15
+ productionCanaryMinimumSamples: number;
16
+ productionCanaryMinimumDurationHours: number;
17
+ experienceMinimumSamples: number;
18
+ experienceMinimumDurationHours: number;
19
+ }
20
+ export interface ApprovalDecision {
21
+ approvalId: string;
22
+ candidateId: string;
23
+ candidateHash: string;
24
+ evaluationRunId: string;
25
+ scope: EvolutionScope;
26
+ decision: 'approved' | 'rejected';
27
+ actorId: string;
28
+ actorRole: string;
29
+ /** Stable role name recorded at decision time for audit display. */
30
+ actorRoleName?: string;
31
+ /**
32
+ * Administrator approvals are a governed single-approver path. Missing values
33
+ * are treated as `standard` for records created before this field existed.
34
+ */
35
+ approvalAuthority?: EvolutionApprovalAuthority;
36
+ reason: string;
37
+ decidedAt: string;
38
+ }
39
+ export interface ReleasePackage {
40
+ releasePackageId: string;
41
+ candidateId: string;
42
+ candidateHash: string;
43
+ targetId: string;
44
+ targetVersionId: string;
45
+ rollbackVersionId: string;
46
+ evaluationRunId: string;
47
+ scope: EvolutionScope;
48
+ status: EvolutionReleaseStatus;
49
+ approvalIds: string[];
50
+ artifactHash: string;
51
+ providerKey: string;
52
+ providerVersion: string;
53
+ /** Missing only on release packages created before gate policies were frozen. */
54
+ gatePolicy?: EvolutionReleaseGatePolicy;
55
+ /** @deprecated Read `gatePolicy.shadowMinimumSamples` for new release packages. */
56
+ shadowMinimumSamples: number;
57
+ canaryPercent: number;
58
+ createdAt: string;
59
+ createdBy: string;
60
+ }
61
+ export interface ReleaseDeployment {
62
+ deploymentId: string;
63
+ releasePackageId: string;
64
+ channel: EvolutionChannel;
65
+ scope: EvolutionScope;
66
+ status: EvolutionReleaseStatus;
67
+ dataSource: 'deterministic_replay' | 'runtime_telemetry';
68
+ sampleCount: number;
69
+ candidateAccuracy: number;
70
+ severeErrors: number;
71
+ canaryPercent: number;
72
+ observations: ReleaseRuntimeObservation[];
73
+ startedAt: string;
74
+ completedAt?: string;
75
+ }
76
+ export interface ReleaseRuntimeObservation {
77
+ observationId: string;
78
+ observedAt: string;
79
+ sequence: number;
80
+ sampleCount: number;
81
+ baselineAccuracy: number;
82
+ candidateAccuracy: number;
83
+ severeErrors: number;
84
+ p95LatencyMs: number;
85
+ averageCost: number;
86
+ }
87
+ export interface ReleaseProviderRequest {
88
+ context?: EvolutionProviderContext;
89
+ targetId: string;
90
+ versionId: string;
91
+ artifactHash: string;
92
+ scope: EvolutionScope;
93
+ releasePackageId: string;
94
+ actorId: string;
95
+ idempotencyKey: string;
96
+ }
97
+ export interface ReleaseProviderReceipt {
98
+ receiptId: string;
99
+ versionId: string;
100
+ operation: 'install' | 'activate' | 'rollback';
101
+ status: 'ready' | 'completed';
102
+ providerTraceId: string;
103
+ }
104
+ export interface EvolutionAuditEvent {
105
+ auditId: string;
106
+ releasePackageId?: string;
107
+ candidateId?: string;
108
+ action: string;
109
+ actorId: string;
110
+ actorRole: string;
111
+ summary: string;
112
+ metadata?: EvolutionAuditEventMetadata;
113
+ occurredAt: string;
114
+ }
115
+ export interface EvolutionAuditEventMetadata {
116
+ manualTestOverrideId?: string;
117
+ deploymentId?: string;
118
+ subjectKey?: string;
119
+ executionId?: string;
120
+ reason?: string;
121
+ overrideStatus?: EvolutionCanaryTestOverrideStatus;
122
+ }
123
+ export type EvolutionCanaryTestOverrideStatus = 'pending' | 'consumed' | 'expired';
124
+ /**
125
+ * Administrator-created, single-use Candidate assignment for one Canary subject.
126
+ * It is available only to releases frozen with the non-production `manual_test` gate profile.
127
+ */
128
+ export interface EvolutionCanaryTestOverride {
129
+ overrideId: string;
130
+ releasePackageId: string;
131
+ candidateId: string;
132
+ deploymentId: string;
133
+ targetId: string;
134
+ scope: EvolutionScope;
135
+ subjectKey: string;
136
+ status: EvolutionCanaryTestOverrideStatus;
137
+ reason: string;
138
+ createdBy: string;
139
+ createdByRole: string;
140
+ createdAt: string;
141
+ expiresAt: string;
142
+ consumedAt?: string;
143
+ consumedByExecutionId?: string;
144
+ }