@xpert-ai/contracts 3.33.1 → 3.35.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 (68) hide show
  1. package/index.cjs.js +545 -168
  2. package/index.esm.js +517 -169
  3. package/package.json +2 -2
  4. package/src/ai/ai.model.d.ts +1 -1
  5. package/src/ai/chat-group-entity.model.d.ts +1 -1
  6. package/src/ai/chat-group.model.d.ts +116 -3
  7. package/src/ai/conversation-trail.model.d.ts +2 -2
  8. package/src/ai/evolution/baseline.d.ts +12 -0
  9. package/src/ai/evolution/candidate.d.ts +20 -0
  10. package/src/ai/evolution/capability-version.d.ts +12 -0
  11. package/src/ai/evolution/change.d.ts +40 -2
  12. package/src/ai/evolution/evaluation.d.ts +26 -0
  13. package/src/ai/evolution/example.d.ts +5 -0
  14. package/src/ai/evolution/experience.d.ts +3 -0
  15. package/src/ai/evolution/governance.d.ts +29 -3
  16. package/src/ai/evolution/index.d.ts +1 -0
  17. package/src/ai/evolution/learning-event.d.ts +13 -0
  18. package/src/ai/evolution/learning-review.d.ts +61 -0
  19. package/src/ai/evolution/persistence.d.ts +7 -2
  20. package/src/ai/evolution/provider.d.ts +38 -0
  21. package/src/ai/evolution/release.d.ts +24 -6
  22. package/src/ai/evolution/runtime.d.ts +19 -0
  23. package/src/ai/evolution/strategy.d.ts +10 -0
  24. package/src/ai/evolution/target.d.ts +34 -6
  25. package/src/ai/execution-control-evidence.schema.d.ts +46 -4
  26. package/src/ai/index.d.ts +4 -0
  27. package/src/ai/model-execution.model.d.ts +2 -0
  28. package/src/ai/project-configuration-view.model.d.ts +77 -0
  29. package/src/ai/project-pipeline/analytics.d.ts +5 -33
  30. package/src/ai/project-pipeline/budget.schema.d.ts +38 -0
  31. package/src/ai/project-pipeline/commands.schema.d.ts +10 -10
  32. package/src/ai/project-pipeline/configuration-form.d.ts +2 -2
  33. package/src/ai/project-pipeline/index.d.ts +1 -0
  34. package/src/ai/project-pipeline/model-usage-statistics.d.ts +6 -26
  35. package/src/ai/project-pipeline/operation.schema.d.ts +370 -40
  36. package/src/ai/project-pipeline/plugin-deployment.schema.d.ts +152 -0
  37. package/src/ai/project-pipeline/portfolio.schema.d.ts +14 -86
  38. package/src/ai/project-pipeline/provider-actions.schema.d.ts +12 -12
  39. package/src/ai/project-pipeline/runtime.schema.d.ts +2 -2
  40. package/src/ai/project-pipeline/statistics.d.ts +5 -33
  41. package/src/ai/project-task-runtime.model.d.ts +1329 -78
  42. package/src/ai/project-type-configuration.model.d.ts +48 -0
  43. package/src/ai/xpert-agent-execution.model.d.ts +16 -2
  44. package/src/ai/xpert-project-type.model.d.ts +3 -0
  45. package/src/ai/xpert-project.model.d.ts +3 -1
  46. package/src/ai/xpert-task.model.d.ts +16 -0
  47. package/src/ai/xpert.model.d.ts +2 -0
  48. package/src/app-platform.d.ts +36 -36
  49. package/src/artifact-group-reference.model.d.ts +71 -0
  50. package/src/artifact-use-grant-command.d.ts +54 -0
  51. package/src/artifact-use-grant.model.d.ts +62 -0
  52. package/src/content-resource.model.d.ts +3 -0
  53. package/src/conversation-resource.model.d.ts +63 -0
  54. package/src/desktop-shell.model.d.ts +13 -1
  55. package/src/icon-definition.schema.d.ts +24 -0
  56. package/src/index.d.ts +6 -0
  57. package/src/plugin-management.d.ts +13 -0
  58. package/src/plugin.d.ts +2 -0
  59. package/src/resource-analysis.model.d.ts +140 -0
  60. package/src/runtime-control.d.ts +6 -0
  61. package/src/types.d.ts +1 -2
  62. package/src/user-notification.schema.d.ts +29 -0
  63. package/src/user.model.d.ts +11 -0
  64. package/src/view-extension/client-commands.d.ts +176 -0
  65. package/src/view-extension/context-event.d.ts +66 -0
  66. package/src/view-extension/index.d.ts +2 -0
  67. package/src/view-extension/model.d.ts +2 -158
  68. package/src/view-extension/workbench-open.d.ts +17 -2
@@ -1,26 +1,32 @@
1
1
  import { CapabilityVersionBundle } from './capability-version';
2
2
  import { EvolutionProviderContext, EvolutionScope } from './target';
3
+ /** Fixed revision of one reference case, containing both the decision input and the expected outcome. */
3
4
  export interface GoldenCaseRevision {
4
5
  caseId: string;
5
6
  revision: number;
6
7
  input: Record<string, string | number | boolean>;
7
8
  expected: Record<string, string | number | boolean>;
9
+ /** Named subset for measuring behavior on a particular class of cases. */
8
10
  slice: string;
9
11
  risk: 'low' | 'medium' | 'high';
10
12
  evidenceRef: string;
11
13
  }
14
+ /** Frozen case revisions and scoring definitions used to compare runs on the same basis. */
12
15
  export interface DatasetSnapshot {
13
16
  snapshotId: string;
14
17
  datasetId: string;
15
18
  targetId?: string;
16
19
  scope?: EvolutionScope;
17
20
  name: string;
21
+ /** Version of the evaluator that interprets the cases. */
18
22
  evaluatorVersion: string;
23
+ /** Version of the metric definitions under which results are comparable. */
19
24
  metricDefinitionVersion: string;
20
25
  cases: GoldenCaseRevision[];
21
26
  snapshotHash: string;
22
27
  createdAt: string;
23
28
  }
29
+ /** Paired offline comparison of a single case revision against the specified baseline and candidate bundles. */
24
30
  export interface ReplayCaseRequest {
25
31
  context?: EvolutionProviderContext;
26
32
  evaluationRunId: string;
@@ -29,9 +35,19 @@ export interface ReplayCaseRequest {
29
35
  caseRevision: GoldenCaseRevision;
30
36
  baselineBundle: CapabilityVersionBundle;
31
37
  candidateBundle: CapabilityVersionBundle;
38
+ /** Optional artifact for the target's baseline bundle entry; its content hash must match that entry. */
39
+ baselineArtifact?: import('./target').EvolutionArtifactRef;
40
+ /** Optional artifact for the target's candidate bundle entry; its content hash must match that entry. */
41
+ candidateArtifact?: import('./target').EvolutionArtifactRef;
32
42
  randomSeed: number;
43
+ /** Evaluator version pinned by the dataset snapshot, when supplied. */
44
+ evaluatorVersion?: string;
45
+ /** Scoring definitions pinned by the dataset snapshot, when supplied. */
46
+ metricDefinitionVersion?: string;
47
+ /** Zero-based repetition of this case under the same evaluation run. */
33
48
  repeatIndex: number;
34
49
  }
50
+ /** Identity of a collection of reference cases; individual runs refer to a frozen snapshot of it. */
35
51
  export interface GoldenDataset {
36
52
  datasetId: string;
37
53
  targetId: string;
@@ -42,6 +58,7 @@ export interface GoldenDataset {
42
58
  createdAt: string;
43
59
  updatedAt: string;
44
60
  }
61
+ /** Paired outputs and pass judgments against the same expectation; preserves regressions even when aggregate accuracy improves. */
45
62
  export interface ReplayCaseResult {
46
63
  caseId: string;
47
64
  baselineOutput: Record<string, string | number | boolean>;
@@ -49,21 +66,28 @@ export interface ReplayCaseResult {
49
66
  expectedOutput: Record<string, string | number | boolean>;
50
67
  baselinePassed: boolean;
51
68
  candidatePassed: boolean;
69
+ /** Whether the candidate incurred a severe error under the evaluator's risk criteria. */
52
70
  severeError: boolean;
53
71
  latencyMs: number;
54
72
  cost: number;
73
+ /** Target-specific measurements for this comparison, in addition to the paired pass judgments. */
74
+ observations?: MetricObservation[];
55
75
  traceRef: string;
56
76
  }
77
+ /** One named measurement with an explicit unit and optional case subset. */
57
78
  export interface MetricObservation {
58
79
  metricKey: string;
59
80
  value: number;
60
81
  unit: 'ratio' | 'count' | 'milliseconds' | 'currency';
61
82
  slice?: string;
83
+ /** A violation reported by the evaluator that prevents promotion. */
62
84
  blocking: boolean;
63
85
  }
86
+ /** Aggregate outcomes for the baseline and candidate measured on the same replay cases. */
64
87
  export interface EvaluationMetrics {
65
88
  baselineAccuracy: number;
66
89
  candidateAccuracy: number;
90
+ /** Candidate accuracy minus baseline accuracy, expressed on the same ratio scale. */
67
91
  accuracyDelta: number;
68
92
  severeErrors: number;
69
93
  p95LatencyMs: number;
@@ -71,11 +95,13 @@ export interface EvaluationMetrics {
71
95
  totalCases: number;
72
96
  passedCases: number;
73
97
  }
98
+ /** Promotion recommendation from replay. Passing this gate does not grant release approval. */
74
99
  export interface EvaluationGateResult {
75
100
  passed: boolean;
76
101
  decision: 'promote' | 'hold' | 'reject';
77
102
  blockingReasons: string[];
78
103
  }
104
+ /** Result of a golden replay, binding the candidate and snapshot to both sets of version bindings. */
79
105
  export interface EvaluationRun {
80
106
  evaluatorKind: 'golden_replay';
81
107
  runId: string;
@@ -1,4 +1,6 @@
1
+ /** Persistence surfaces covered by the synthetic evolution example, not an exhaustive schema. */
1
2
  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';
3
+ /** Expected versus observed record identities for one table in a simulation. */
2
4
  export interface EvolutionPersistenceTableEvidence {
3
5
  table: EvolutionPersistenceTable;
4
6
  expectedCount: number;
@@ -6,17 +8,20 @@ export interface EvolutionPersistenceTableEvidence {
6
8
  recordIds: string[];
7
9
  missingRecordIds: string[];
8
10
  }
11
+ /** Evidence that the expected simulation records exist, distinct from the simulated release gate result. */
9
12
  export interface EvolutionPersistenceEvidence {
10
13
  verified: boolean;
11
14
  rowCount: number;
12
15
  tables: EvolutionPersistenceTableEvidence[];
13
16
  }
17
+ /** Identifies an example using synthetic evidence; its results do not represent live traffic. */
14
18
  export interface EvolutionExampleDescriptor {
15
19
  key: string;
16
20
  name: string;
17
21
  description: string;
18
22
  dataClassification: 'synthetic_test_fixture';
19
23
  }
24
+ /** Trace of the versions, decisions and persistence evidence produced by a single synthetic run. */
20
25
  export interface EvolutionSimulationResult {
21
26
  example: EvolutionExampleDescriptor;
22
27
  simulationId: string;
@@ -1,10 +1,12 @@
1
1
  import type { EvolutionScope } from './target';
2
+ /** Scoped lesson supported by a released candidate's production outcomes and its evaluation. */
2
3
  export interface EvolutionExperience {
3
4
  experienceId: string;
4
5
  targetId: string;
5
6
  scope: EvolutionScope;
6
7
  sourceReleasePackageId: string;
7
8
  sourceCandidateId: string;
9
+ /** Production observations and stability period supporting the lesson, alongside the originating evaluation. */
8
10
  evidence: {
9
11
  productionObservationCount: number;
10
12
  severeErrors: number;
@@ -16,6 +18,7 @@ export interface EvolutionExperience {
16
18
  createdAt: string;
17
19
  createdBy: string;
18
20
  }
21
+ /** Identifies the release whose observed production behavior is the basis of a lesson. */
19
22
  export interface CreateEvolutionExperienceRequest {
20
23
  releasePackageId: string;
21
24
  }
@@ -1,3 +1,4 @@
1
+ /** Filters and ordering within the caller's visible evolution records; these fields do not select an authorization scope. */
1
2
  export interface EvolutionPageQuery {
2
3
  page?: number;
3
4
  pageSize?: number;
@@ -7,23 +8,38 @@ export interface EvolutionPageQuery {
7
8
  sort?: 'createdAt' | 'updatedAt' | 'status';
8
9
  order?: 'ASC' | 'DESC';
9
10
  }
11
+ /** Filters runtime observations or audit events without widening the caller’s organization scope. */
12
+ export interface EvolutionReleaseEvidenceQuery extends EvolutionPageQuery {
13
+ /** Limits evidence to the named release package and its deployments. */
14
+ releasePackageId?: string;
15
+ }
16
+ /** Page of visible records and the total number matching the query across pages. */
10
17
  export interface EvolutionPage<T> {
11
18
  items: T[];
12
19
  total: number;
13
20
  page: number;
14
21
  pageSize: number;
15
22
  }
23
+ /** Sets the evidence review disposition; marking an event golden is distinct from freezing a dataset. */
16
24
  export interface ReviewLearningEventRequest {
17
25
  reviewStatus: 'pending' | 'ignored' | 'golden';
18
26
  }
19
- export interface DiagnoseLearningEventsRequest {
27
+ /** Selects either an explicit set of events or a seed for related evidence under the named strategy, never both. */
28
+ export type DiagnoseLearningEventsRequest = {
20
29
  strategyId: string;
30
+ } & ({
21
31
  eventIds: string[];
22
- }
32
+ seedEventId?: never;
33
+ } | {
34
+ seedEventId: string;
35
+ eventIds?: never;
36
+ });
37
+ /** Pairs proposed diagnoses with their evidence clusters; neither constitutes a candidate or approval. */
23
38
  export interface EvolutionAnalysisResult {
24
39
  diagnoses: import('./learning-event').EvolutionDiagnosis[];
25
40
  clusters: import('./learning-event').EvolutionEventCluster[];
26
41
  }
42
+ /** Records a scoped change hypothesis supported by selected events under the named strategy. */
27
43
  export interface CreateImprovementProposalRequest {
28
44
  strategyId: string;
29
45
  targetId: string;
@@ -35,11 +51,13 @@ export interface CreateImprovementProposalRequest {
35
51
  changeHypothesis: string;
36
52
  riskLevel: import('./target').EvolutionRiskLevel;
37
53
  }
54
+ /** Binds the requested changes to a specific proposal revision. */
38
55
  export interface BuildCandidateCommand {
39
56
  proposalId: string;
40
57
  proposalRevision: number;
41
58
  changeSet: Record<string, string | number | boolean | string[]>;
42
59
  }
60
+ /** Freezes reference cases with the evaluator and metric definitions for one target and scope. */
43
61
  export interface CreateDatasetSnapshotRequest {
44
62
  datasetId: string;
45
63
  targetId: string;
@@ -49,32 +67,40 @@ export interface CreateDatasetSnapshotRequest {
49
67
  metricDefinitionVersion: string;
50
68
  cases: import('./evaluation').GoldenCaseRevision[];
51
69
  }
70
+ /** Pairs a particular candidate with a frozen dataset for replay. */
52
71
  export interface EvaluateCandidateCommand {
53
72
  candidateId: string;
54
73
  datasetSnapshotId: string;
55
74
  }
75
+ /** Decision on a candidate evaluated in the specified run, with the signer's reason. */
56
76
  export interface DecideCandidateApprovalRequest {
57
77
  evaluationRunId: string;
58
78
  decision: 'approved' | 'rejected';
59
79
  reason: string;
60
80
  }
81
+ /** Identifies the candidate, evaluation and approvals that must agree for staged publication. */
61
82
  export interface CreateReleasePackageRequest {
62
83
  candidateId: string;
63
84
  evaluationRunId: string;
64
85
  approvalIds: string[];
65
86
  shadowMinimumSamples?: number;
66
87
  }
88
+ /** Selects a canary traffic stage within the staged release policy. */
67
89
  export interface StartDeploymentRequest {
68
90
  canaryPercent?: 5 | 25 | 50;
69
91
  }
92
+ /** Requests a single-use assignment for one subject in an eligible test deployment. */
70
93
  export interface CreateEvolutionCanaryTestOverrideRequest {
71
94
  subjectKey: string;
72
95
  reason: string;
73
- /** Defaults to 30 minutes and is capped by the server. */
96
+ /** Requested lifetime in minutes, subject to the release's test-assignment limits. */
74
97
  expiresInMinutes?: number;
75
98
  }
99
+ /** Governed background operation associated with an evolution resource. */
76
100
  export type EvolutionJobType = 'change_preparation' | 'evaluation' | 'install' | 'shadow' | 'canary' | 'rollback';
101
+ /** State of the background work, distinct from the governed resource's own state. */
77
102
  export type EvolutionJobStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
103
+ /** Identifies a single background operation and its outcome for the affected evolution resource. */
78
104
  export interface EvolutionJob {
79
105
  jobId: string;
80
106
  jobType: EvolutionJobType;
@@ -1,6 +1,7 @@
1
1
  export * from './target';
2
2
  export * from './capability-version';
3
3
  export * from './learning-event';
4
+ export * from './learning-review';
4
5
  export * from './candidate';
5
6
  export * from './evaluation';
6
7
  export * from './release';
@@ -1,10 +1,14 @@
1
1
  import { EvolutionScope } from './target';
2
+ /** Kind of observed evidence, independent of its trust or review status. */
2
3
  export type LearningEventType = 'prediction_reviewed' | 'execution_failed' | 'business_outcome';
4
+ /** Ordinal trust tier of the evidence source, distinct from numeric confidence in the observation. */
3
5
  export type LearningEventConfidence = 'L1' | 'L2' | 'L3' | 'L4';
6
+ /** Evidence about a target decision, tied to the version bundle under which the decision was made. */
4
7
  export interface LearningEventInput {
5
8
  eventId?: string;
6
9
  eventType: LearningEventType;
7
10
  schemaVersion: string;
11
+ /** Stable identity of the logical event across repeated submissions. */
8
12
  idempotencyKey: string;
9
13
  eventTime: string;
10
14
  scope: EvolutionScope;
@@ -13,23 +17,29 @@ export interface LearningEventInput {
13
17
  traceId?: string;
14
18
  targetId: string;
15
19
  decisionPoint: string;
20
+ /** Subject the decision concerns; multiple events may refer to the same subject. */
16
21
  subjectRef: string;
22
+ /** Identifies equivalent decision inputs without requiring their raw contents. */
17
23
  inputFingerprint: string;
18
24
  predictionSummary: string;
19
25
  finalOutcomeSummary: string;
20
26
  confidence: number;
21
27
  reasonCodes: string[];
22
28
  capabilityVersionBundleId: string;
29
+ /** Content hash of the cited capability bundle, not of the target artifact. */
23
30
  bundleHash: string;
24
31
  trustLevel: LearningEventConfidence;
25
32
  classification: 'public' | 'internal' | 'confidential';
33
+ /** Confidential evidence must be redacted before ingestion. */
26
34
  redactionStatus: 'not_required' | 'redacted';
27
35
  }
36
+ /** Recorded evidence and its review disposition. Inclusion as evidence does not itself authorize a change. */
28
37
  export interface LearningEvent extends LearningEventInput {
29
38
  eventId: string;
30
39
  createdAt: string;
31
40
  reviewStatus?: 'pending' | 'ignored' | 'golden';
32
41
  }
42
+ /** Proposed explanation for a set of related observations, retaining the underlying event identities. */
33
43
  export interface EvolutionDiagnosis {
34
44
  diagnosisId: string;
35
45
  targetId: string;
@@ -40,17 +50,20 @@ export interface EvolutionDiagnosis {
40
50
  confidence: number;
41
51
  createdAt: string;
42
52
  }
53
+ /** Evidence grouped by a shared correction signature for one target and scope. */
43
54
  export interface EvolutionEventCluster {
44
55
  clusterId: string;
45
56
  targetId: string;
46
57
  scope: EvolutionScope;
47
58
  correctionSignature: string;
48
59
  eventIds: string[];
60
+ /** Number of distinct subjects represented, which can be smaller than the event count. */
49
61
  caseCount: number;
50
62
  status: 'collecting' | 'proposal_ready' | 'closed';
51
63
  createdAt: string;
52
64
  updatedAt: string;
53
65
  }
66
+ /** Revisioned hypothesis that binds a change to its supporting events and the version it aims to improve. */
54
67
  export interface ImprovementProposal {
55
68
  sourceKind: import('./strategy').EvolutionInputKind;
56
69
  strategy: import('./strategy').EvolutionStrategySnapshot;
@@ -0,0 +1,61 @@
1
+ import type { EvolutionPage, EvolutionPageQuery } from './governance';
2
+ import type { ImprovementProposal, LearningEvent } from './learning-event';
3
+ import type { EvolutionStrategy } from './strategy';
4
+ /** Filters within the current tenant and organization. Citation filters refer to direct evidence membership. */
5
+ export interface EvolutionLearningQuery extends EvolutionPageQuery {
6
+ /** Includes provider test fixtures in the visible result set. */
7
+ includeFixtures?: boolean;
8
+ /** Matches feedback explicitly classified as a correction by the target provider. */
9
+ corrected?: boolean;
10
+ /** Matches feedback that belongs to a recorded diagnosis cluster. */
11
+ grouped?: boolean;
12
+ /** Exact feedback identity, or the evidence cited by the returned suggestions. */
13
+ eventId?: string;
14
+ /** Exact proposal identity, or the source of the returned evidence. */
15
+ proposalId?: string;
16
+ /** Restricts a proposal reference to its immutable revision. */
17
+ revision?: number;
18
+ }
19
+ /** Scope count precedes local filters; total is the number of filtered records across all pages. */
20
+ export interface EvolutionLearningPage<T> extends EvolutionPage<T> {
21
+ scopeTotal: number;
22
+ }
23
+ /** A feedback event and the number of proposal revisions citing it as evidence. */
24
+ export interface LearningReviewRow {
25
+ event: LearningEvent;
26
+ proposalCount: number;
27
+ }
28
+ /** Proposal revision and the isolated candidate actually built from it, if any. */
29
+ export interface LearningProposalRow {
30
+ proposal: ImprovementProposal;
31
+ candidateId?: string;
32
+ }
33
+ /** Confirms one reviewed evidence snapshot and supplies the text to store with the new suggestion. */
34
+ export interface ConfirmLearningProposalRequest {
35
+ /** Fingerprint of the eligible evidence and baseline reviewed by the caller. */
36
+ snapshot: string;
37
+ title: string;
38
+ /** Description of the observed decision and reviewed outcome. */
39
+ problemStatement?: string;
40
+ /** Proposed behavior change that remains subject to candidate evaluation. */
41
+ changeHypothesis: string;
42
+ }
43
+ /** Current evidence and governance requirements for a seed event under its target's feedback strategy. */
44
+ export interface LearningProposalCheck {
45
+ /** Immutable eligibility requirements, absent when the target has no supported feedback strategy. */
46
+ policy: Extract<EvolutionStrategy['learning'], {
47
+ mode: 'feedback';
48
+ }> | null;
49
+ /** Distinct eligible events sharing the seed's target, scope and correction signature. */
50
+ eventIds: string[];
51
+ /** Number of distinct evidence subjects, independent of event count. */
52
+ subjects: number;
53
+ /** Eligible events whose payload is marked as redacted. */
54
+ redacted: number;
55
+ /** Whether the seed itself is eligible to initiate a proposal. */
56
+ seedEligible: boolean;
57
+ /** Production baseline to which this review applies. */
58
+ baseVersionId: string | null;
59
+ /** Fingerprint of the checked evidence, strategy and baseline; present only when creation is permitted. */
60
+ snapshot: string | null;
61
+ }
@@ -4,7 +4,7 @@ import type { ImprovementProposal } from './learning-event';
4
4
  import type { ReleasePackage } from './release';
5
5
  import type { EvolutionScope } from './target';
6
6
  import type { EvolutionChangeCandidate, EvolutionChangeEvaluation, EvolutionEvidenceRef, EvolutionPublicationReceipt, EvolutionVersionRef } from './change';
7
- /** Evidence requests share Proposal persistence without fabricating trusted learning events. */
7
+ /** Proposal with a pinned baseline and evidence references. Evidence references and learning-event IDs are distinct inputs. */
8
8
  export interface EvidenceEvolutionProposal extends Pick<ImprovementProposal, 'problemStatement' | 'rootCause' | 'changeHypothesis' | 'riskLevel' | 'evidenceEventIds' | 'baseVersionId'> {
9
9
  executionContext?: import('./change').EvolutionExecutionContext;
10
10
  executionConversation?: import('./change').EvolutionExecutionConversation;
@@ -32,12 +32,14 @@ export interface EvidenceEvolutionProposal extends Pick<ImprovementProposal, 'pr
32
32
  updatedAt: string;
33
33
  createdBy: string;
34
34
  }
35
+ /** Persisted proposal in its learning or change-preparation shape; only the latter carries preparation state. */
35
36
  export type StoredEvolutionProposal = ImprovementProposal | EvidenceEvolutionProposal;
37
+ /** Candidate with reviewable baseline and delta information in addition to the immutable artifact. */
36
38
  export interface PreparedEvolutionCandidate extends EvolutionCandidate {
37
39
  definition: Omit<EvolutionChangeCandidate, 'artifact'>;
38
40
  evaluationRunId?: string;
39
41
  }
40
- /** Replay bundles remain required by Replay EvaluationRun, not by every evaluator. */
42
+ /** Strategy assessment carrying a change evaluation; its inputs need not include replay bundles. */
41
43
  export interface ProviderEvaluationRun {
42
44
  evaluatorKind: 'strategy_checks';
43
45
  runId: string;
@@ -49,6 +51,7 @@ export interface ProviderEvaluationRun {
49
51
  startedAt: string;
50
52
  completedAt: string;
51
53
  }
54
+ /** Evaluation record distinguished by evaluatorKind; only golden replay carries paired bundles and per-case outcomes. */
52
55
  export type StoredEvaluationRun = EvaluationRun | ProviderEvaluationRun;
53
56
  interface ProviderReleaseBase {
54
57
  publicationKind: 'provider_version';
@@ -66,6 +69,7 @@ interface ProviderReleaseBase {
66
69
  updatedAt: string;
67
70
  createdBy: string;
68
71
  }
72
+ /** Target-owned version write. A published record must identify the resulting version in its receipt. */
69
73
  export type ProviderReleasePackage = ProviderReleaseBase & ({
70
74
  status: 'approved' | 'publishing';
71
75
  receipt?: never;
@@ -73,6 +77,7 @@ export type ProviderReleasePackage = ProviderReleaseBase & ({
73
77
  status: 'published';
74
78
  receipt: EvolutionPublicationReceipt;
75
79
  });
80
+ /** Publication record distinguished by publicationKind: staged deployment or target-owned version write. */
76
81
  export type StoredReleasePackage = ReleasePackage | ProviderReleasePackage;
77
82
  export declare function isEvidenceProposal(value: StoredEvolutionProposal): value is EvidenceEvolutionProposal;
78
83
  export declare function isLearningProposal(value: StoredEvolutionProposal): value is ImprovementProposal;
@@ -2,33 +2,71 @@ import { BuildEvolutionCandidateRequest, CandidateBuildResult, CandidateValidati
2
2
  import { MetricObservation, ReplayCaseRequest, ReplayCaseResult } from './evaluation';
3
3
  import { ReleaseProviderReceipt, ReleaseProviderRequest } from './release';
4
4
  import { EvolutionTargetDescriptor } from './target';
5
+ /** Owns construction and structural validation of artifacts for a target; neither operation approves a release. */
5
6
  export interface EvolutionCandidateBuilder {
7
+ /** Produces a candidate from the specified baseline, proposal revision and change inputs. */
6
8
  buildCandidate(request: BuildEvolutionCandidateRequest): Promise<CandidateBuildResult>;
9
+ /** Checks artifact compatibility with the declared target, baseline and dependencies. */
7
10
  validateCandidate(request: ValidateEvolutionCandidateRequest): Promise<CandidateValidationResult>;
8
11
  }
12
+ /** Owns the representation of a target's baseline; inspection of source rules is an optional capability. */
9
13
  export interface EvolutionBaselineExporter extends Partial<import('./baseline').EvolutionBaselineReader> {
14
+ /** Returns the baseline artifact and its exact dependencies for the requested target and scope. */
10
15
  exportBaseline(request: ExportEvolutionBaselineRequest): Promise<ExportEvolutionBaselineResult>;
11
16
  }
17
+ /** Compares frozen baseline and candidate inputs under the same case without affecting live decisions. */
12
18
  export interface EvolutionReplayEvaluator {
19
+ /** Returns the baseline and candidate outcomes for the same case revision. */
13
20
  runReplayCase(request: ReplayCaseRequest): Promise<ReplayCaseResult>;
21
+ /** Reports target-defined measurements and blocking violations for that case result. */
14
22
  evaluateResult(request: ReplayCaseRequest, result: ReplayCaseResult): Promise<MetricObservation[]>;
15
23
  }
24
+ /** Owns the target-side effects of staged releases. A provider receipt attests only to the requested operation. */
16
25
  export interface EvolutionReleaseProvider {
26
+ /** Makes the specified version ready for use without declaring it active. */
17
27
  install(request: ReleaseProviderRequest): Promise<ReleaseProviderReceipt>;
28
+ /** Applies the requested version within the release scope. */
18
29
  activate(request: ReleaseProviderRequest): Promise<ReleaseProviderReceipt>;
30
+ /** Restores the version specified by the rollback request within the same scope. */
19
31
  rollback(request: ReleaseProviderRequest): Promise<ReleaseProviderReceipt>;
20
32
  }
33
+ /** Execution projection available for feedback. Outputs retain their target-specific shape and require validation. */
34
+ export type EvolutionFeedbackExecution = Pick<import('../xpert-agent-execution.model').IXpertAgentExecution, 'id' | 'threadId' | 'outputs' | 'completedAt' | 'createdAt'>;
35
+ /** Optional target adapter that defines the meaning of execution reviews and the cases derived from their evidence. */
36
+ export interface EvolutionFeedbackProvider {
37
+ /** Stable feedback route identifier; it must resolve unambiguously within the organization. */
38
+ readonly routeKey: string;
39
+ /** Discriminator of execution records this adapter can interpret. */
40
+ readonly executionType: string;
41
+ /** Validates untrusted review input against the scoped execution and returns the recorded learning event. */
42
+ review(identity: {
43
+ tenantId: string;
44
+ organizationId: string;
45
+ }, execution: EvolutionFeedbackExecution, input: unknown): Promise<import('./learning-event').LearningEvent>;
46
+ /** Defines replay cases and scoring versions from scoped evidence. Snapshot identity and scope are outside this contribution. */
47
+ dataset(events: import('./learning-event').LearningEvent[], executions: EvolutionFeedbackExecution[]): Pick<import('./evaluation').DatasetSnapshot, 'name' | 'evaluatorVersion' | 'metricDefinitionVersion' | 'cases'>;
48
+ }
49
+ /** Extension point for one target. Its declared strategies determine which optional builder, evaluator and publisher roles it must provide. */
21
50
  export interface EvolutionTargetProvider {
51
+ /** Opt-in review of target-specific executions. A target can support evolution without exposing execution feedback. */
52
+ readonly feedback?: EvolutionFeedbackProvider;
53
+ /** Declares the target's stable identity and the strategies this implementation supports. */
22
54
  readonly descriptor: EvolutionTargetDescriptor;
55
+ /** Prepares target-owned change drafts, distinct from building an artifact from a change set. */
23
56
  readonly draftBuilder?: Pick<import('./change').EvolutionChangeProvider, 'prepare'>;
57
+ /** Performs target-defined checks, distinct from replay against a golden dataset. */
24
58
  readonly checkEvaluator?: Pick<import('./change').EvolutionChangeProvider, 'evaluate'>;
59
+ /** Owns freshness, authorization and publication for strategies that write a target version directly. */
25
60
  readonly versionPublisher?: Pick<import('./change').EvolutionChangeProvider, 'validateCurrent' | 'authorizePublication' | 'publish'>;
61
+ /** Contributes domain explanations and effect information; presentation does not decide release eligibility. */
26
62
  readonly presenter?: Pick<import('./change').EvolutionChangeProvider, 'describe'>;
27
63
  readonly baselineExporter?: EvolutionBaselineExporter;
28
64
  readonly candidateBuilder?: EvolutionCandidateBuilder;
29
65
  readonly replayEvaluator?: EvolutionReplayEvaluator;
30
66
  readonly releaseProvider?: EvolutionReleaseProvider;
31
67
  }
68
+ /** Target provider that may additionally describe multiple evolution targets. */
32
69
  export interface EvolutionProvider extends EvolutionTargetProvider {
70
+ /** Returns the target descriptors advertised by this provider. */
33
71
  describeTargets?(): Promise<EvolutionTargetDescriptor[]> | EvolutionTargetDescriptor[];
34
72
  }
@@ -1,6 +1,9 @@
1
1
  import { EvolutionChannel, EvolutionProviderContext, EvolutionScope } from './target';
2
+ /** State of a staged release; installation, partial exposure and full activation are distinct states. */
2
3
  export type EvolutionReleaseStatus = 'draft' | 'pending_approval' | 'approved' | 'installed' | 'shadow' | 'canary' | 'active' | 'paused' | 'rolled_back' | 'superseded';
4
+ /** Authority under which a release decision was signed, separate from the actor's role label. */
3
5
  export type EvolutionApprovalAuthority = 'standard' | 'administrator';
6
+ /** Identifies the policy frozen into a release; manual_test is restricted to non-production. */
4
7
  export type EvolutionReleaseGateProfile = 'standard' | 'manual_test';
5
8
  /**
6
9
  * Frozen staged-release gates. `manual_test` is accepted only by a
@@ -12,31 +15,33 @@ export interface EvolutionReleaseGatePolicy {
12
15
  shadowMinimumDurationHours: number;
13
16
  canaryMinimumSamples: number;
14
17
  canaryMinimumDurationHours: number;
18
+ /** Minimum observations in the final canary stage before full activation. */
15
19
  productionCanaryMinimumSamples: number;
16
20
  productionCanaryMinimumDurationHours: number;
21
+ /** Minimum production observations before the release can be recorded as an experience. */
17
22
  experienceMinimumSamples: number;
18
23
  experienceMinimumDurationHours: number;
19
24
  }
25
+ /** Human decision bound to one candidate content hash, evaluation run and scope; it does not transfer to a changed candidate. */
20
26
  export interface ApprovalDecision {
21
27
  approvalId: string;
22
28
  candidateId: string;
23
29
  candidateHash: string;
24
30
  evaluationRunId: string;
31
+ /** Identifies the frozen strategy covered by this decision, when recorded. */
25
32
  strategyHash?: string;
26
33
  scope: EvolutionScope;
27
34
  decision: 'approved' | 'rejected';
28
35
  actorId: string;
29
36
  actorRole: string;
30
- /** Stable role name recorded at decision time for audit display. */
37
+ /** Role name at the time of the decision, independent of later role changes. */
31
38
  actorRoleName?: string;
32
- /**
33
- * Administrator approvals are a governed single-approver path. Missing values
34
- * are treated as `standard` for records created before this field existed.
35
- */
39
+ /** Authority of this decision; absence does not establish administrator authority. */
36
40
  approvalAuthority?: EvolutionApprovalAuthority;
37
41
  reason: string;
38
42
  decidedAt: string;
39
43
  }
44
+ /** Binds a staged rollout to the approved artifact, evaluation, scope and rollback version. */
40
45
  export interface ReleasePackage {
41
46
  publicationKind: 'staged_rollout';
42
47
  releasePackageId: string;
@@ -60,32 +65,40 @@ export interface ReleasePackage {
60
65
  createdAt: string;
61
66
  createdBy: string;
62
67
  }
68
+ /** One stage of a release in one channel, with measurements attributable to that stage. */
63
69
  export interface ReleaseDeployment {
64
70
  deploymentId: string;
65
71
  releasePackageId: string;
66
72
  channel: EvolutionChannel;
67
73
  scope: EvolutionScope;
68
74
  status: EvolutionReleaseStatus;
75
+ /** Distinguishes replay measurements from observations of actual executions. */
69
76
  dataSource: 'deterministic_replay' | 'runtime_telemetry';
70
77
  sampleCount: number;
71
78
  candidateAccuracy: number;
72
79
  severeErrors: number;
80
+ /** Share of eligible subjects intended to receive the candidate, not its observed success rate. */
73
81
  canaryPercent: number;
74
82
  observations: ReleaseRuntimeObservation[];
75
83
  startedAt: string;
76
84
  completedAt?: string;
77
85
  }
86
+ /** Cumulative measurements for a deployment as of this observation. */
78
87
  export interface ReleaseRuntimeObservation {
79
88
  observationId: string;
80
89
  observedAt: string;
81
90
  sequence: number;
82
91
  sampleCount: number;
83
- baselineAccuracy: number;
92
+ /** Accuracy on paired inputs with a known baseline outcome. Null means no baseline accuracy is available; zero is a measured result. */
93
+ baselineAccuracy: number | null;
94
+ /** Number of paired observations contributing to baseline accuracy, when reported; may be less than sampleCount. */
95
+ pairedBaselineSamples?: number;
84
96
  candidateAccuracy: number;
85
97
  severeErrors: number;
86
98
  p95LatencyMs: number;
87
99
  averageCost: number;
88
100
  }
101
+ /** Scoped release operation bound to a specific version and artifact hash. */
89
102
  export interface ReleaseProviderRequest {
90
103
  context?: EvolutionProviderContext;
91
104
  targetId: string;
@@ -94,8 +107,10 @@ export interface ReleaseProviderRequest {
94
107
  scope: EvolutionScope;
95
108
  releasePackageId: string;
96
109
  actorId: string;
110
+ /** Stable operation identity; retrying must not duplicate the release effect. */
97
111
  idempotencyKey: string;
98
112
  }
113
+ /** Evidence of a provider operation on the identified version, separate from the platform's active selection. */
99
114
  export interface ReleaseProviderReceipt {
100
115
  receiptId: string;
101
116
  versionId: string;
@@ -103,6 +118,7 @@ export interface ReleaseProviderReceipt {
103
118
  status: 'ready' | 'completed';
104
119
  providerTraceId: string;
105
120
  }
121
+ /** Attribution of a governance action to an actor and time, optionally tied to a candidate or release. */
106
122
  export interface EvolutionAuditEvent {
107
123
  auditId: string;
108
124
  releasePackageId?: string;
@@ -114,6 +130,7 @@ export interface EvolutionAuditEvent {
114
130
  metadata?: EvolutionAuditEventMetadata;
115
131
  occurredAt: string;
116
132
  }
133
+ /** Structured references for correlating a governance action with a deployment, subject or execution. */
117
134
  export interface EvolutionAuditEventMetadata {
118
135
  manualTestOverrideId?: string;
119
136
  deploymentId?: string;
@@ -122,6 +139,7 @@ export interface EvolutionAuditEventMetadata {
122
139
  reason?: string;
123
140
  overrideStatus?: EvolutionCanaryTestOverrideStatus;
124
141
  }
142
+ /** A pending test assignment can be consumed once or expire unused. */
125
143
  export type EvolutionCanaryTestOverrideStatus = 'pending' | 'consumed' | 'expired';
126
144
  /**
127
145
  * Administrator-created, single-use Candidate assignment for one Canary subject.