@xpert-ai/contracts 3.18.2 → 3.18.5
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.
- package/index.cjs.js +614 -93
- package/index.esm.js +563 -94
- package/package.json +2 -2
- package/src/ai/context-compression.model.d.ts +2 -1
- package/src/ai/evolution/candidate.d.ts +3 -0
- package/src/ai/evolution/change.d.ts +221 -0
- package/src/ai/evolution/evaluation.d.ts +1 -0
- package/src/ai/evolution/governance.d.ts +3 -1
- package/src/ai/evolution/index.d.ts +3 -0
- package/src/ai/evolution/learning-event.d.ts +2 -0
- package/src/ai/evolution/persistence.d.ts +82 -0
- package/src/ai/evolution/provider.d.ts +4 -0
- package/src/ai/evolution/release.d.ts +2 -0
- package/src/ai/evolution/strategy.d.ts +62 -0
- package/src/ai/evolution/target.d.ts +8 -5
- package/src/ai/index.d.ts +11 -0
- package/src/ai/knowledge-chunking.model.d.ts +59 -0
- package/src/ai/knowledge-deletion.model.d.ts +25 -0
- package/src/ai/knowledge-doc-chunk.model.d.ts +23 -0
- package/src/ai/knowledge-doc.model.d.ts +61 -0
- package/src/ai/knowledge-filter.model.d.ts +3 -1
- package/src/ai/knowledge-graph.model.d.ts +22 -0
- package/src/ai/knowledge-identity.model.d.ts +42 -0
- package/src/ai/knowledge-parser-selection.d.ts +7 -0
- package/src/ai/knowledge-parser.model.d.ts +18 -0
- package/src/ai/knowledge-pipeline.d.ts +15 -0
- package/src/ai/knowledge-question.model.d.ts +26 -0
- package/src/ai/knowledge-table.model.d.ts +72 -0
- package/src/ai/knowledge-tag.model.d.ts +32 -0
- package/src/ai/knowledge-wiki-identity.model.d.ts +11 -0
- package/src/ai/knowledge-wiki-organization.model.d.ts +110 -0
- package/src/ai/knowledge-wiki.model.d.ts +202 -0
- package/src/ai/knowledgebase-task.model.d.ts +2 -0
- package/src/ai/knowledgebase.model.d.ts +65 -3
- package/src/ai/mcp-capability.model.d.ts +7 -0
- package/src/ai/mcp-publication.model.d.ts +9 -2
- package/src/ai/middleware.model.d.ts +2 -0
- package/src/ai/xpert-agent-execution.model.d.ts +1 -1
- package/src/ai/xpert-template.model.d.ts +20 -0
- package/src/ai/xpert.model.d.ts +5 -2
- package/src/tag-entity.model.d.ts +22 -0
- package/src/view-extension/model.d.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/contracts",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.5",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@octokit/types": "13.10.0",
|
|
23
23
|
"@types/json-schema": "^7.0.15",
|
|
24
|
-
"@xpert-ai/chatkit-types": "~0.5.
|
|
24
|
+
"@xpert-ai/chatkit-types": "~0.5.8",
|
|
25
25
|
"zod-to-json-schema": "^3.25.2"
|
|
26
26
|
},
|
|
27
27
|
"types": "./index.d.ts"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ContextCompressionReason } from '@xpert-ai/chatkit-types';
|
|
1
2
|
import type { I18nText } from '../i18n.model';
|
|
2
3
|
export declare const CONTEXT_COMPRESSION_COMPONENT_TYPE = "context-compression";
|
|
3
4
|
export type TContextCompressionComponentStatus = 'running' | 'success' | 'fail';
|
|
4
|
-
export type TContextCompressionComponentReason =
|
|
5
|
+
export type TContextCompressionComponentReason = ContextCompressionReason;
|
|
5
6
|
export type TContextCompressionComponentData = {
|
|
6
7
|
category: 'Tool';
|
|
7
8
|
type: typeof CONTEXT_COMPRESSION_COMPONENT_TYPE;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { EvolutionArtifactRef, EvolutionProviderContext, EvolutionScope } from './target';
|
|
2
2
|
export type EvolutionCandidateStatus = 'building' | 'ready' | 'evaluating' | 'evaluation_failed' | 'pending_approval' | 'approved' | 'rejected' | 'packaged' | 'expired';
|
|
3
3
|
export interface EvolutionCandidate {
|
|
4
|
+
definition?: Omit<import('./change').EvolutionChangeCandidate, 'artifact'>;
|
|
5
|
+
evaluationRunId?: string;
|
|
6
|
+
strategy: import('./strategy').EvolutionStrategySnapshot;
|
|
4
7
|
candidateId: string;
|
|
5
8
|
targetId: string;
|
|
6
9
|
baseVersionId: string;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import type { I18nText } from '../../i18n.model';
|
|
2
|
+
import type { ApprovalDecision } from './release';
|
|
3
|
+
import type { EvolutionArtifactRef, EvolutionProviderContext, EvolutionScope } from './target';
|
|
4
|
+
import type { EvolutionInputKind, EvolutionStrategySnapshot, EvolutionStageRecord } from './strategy';
|
|
5
|
+
export interface EvolutionVersionRef {
|
|
6
|
+
resourceId: string;
|
|
7
|
+
version: string;
|
|
8
|
+
hash: string;
|
|
9
|
+
}
|
|
10
|
+
export interface EvolutionEvidenceRef {
|
|
11
|
+
kind: 'document' | 'execution' | 'feedback' | 'evaluation' | 'artifact';
|
|
12
|
+
subjectKey: string;
|
|
13
|
+
uri: string;
|
|
14
|
+
version: string;
|
|
15
|
+
hash: string;
|
|
16
|
+
locator?: {
|
|
17
|
+
sourceId?: string;
|
|
18
|
+
fragmentId?: string;
|
|
19
|
+
quoteHash?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface EvolutionChangeDelta {
|
|
23
|
+
path: string;
|
|
24
|
+
operation: string;
|
|
25
|
+
summary: string;
|
|
26
|
+
before?: string;
|
|
27
|
+
after: string;
|
|
28
|
+
}
|
|
29
|
+
export interface EvolutionChangeCandidate {
|
|
30
|
+
artifact: EvolutionArtifactRef;
|
|
31
|
+
baseline: EvolutionVersionRef;
|
|
32
|
+
changes: EvolutionChangeDelta[];
|
|
33
|
+
warnings: string[];
|
|
34
|
+
summary: string;
|
|
35
|
+
}
|
|
36
|
+
export interface EvolutionCheck {
|
|
37
|
+
checkId: string;
|
|
38
|
+
title: string;
|
|
39
|
+
kind: string;
|
|
40
|
+
origin: string;
|
|
41
|
+
passed: boolean;
|
|
42
|
+
blocking: boolean;
|
|
43
|
+
details: string;
|
|
44
|
+
evidenceRefs: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface EvolutionReadiness {
|
|
47
|
+
key: string;
|
|
48
|
+
label: I18nText;
|
|
49
|
+
status: 'passed' | 'blocked' | 'unknown';
|
|
50
|
+
reasons: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface EvolutionChangeEvaluation {
|
|
53
|
+
runId: string;
|
|
54
|
+
candidateHash: string;
|
|
55
|
+
baselineHash: string;
|
|
56
|
+
evidenceHash: string;
|
|
57
|
+
datasetVersion: string;
|
|
58
|
+
datasetHash: string;
|
|
59
|
+
checks: EvolutionCheck[];
|
|
60
|
+
readiness: EvolutionReadiness[];
|
|
61
|
+
passed: boolean;
|
|
62
|
+
completedAt: string;
|
|
63
|
+
strategyHash?: string;
|
|
64
|
+
assessment?: 'tested' | 'not_applicable';
|
|
65
|
+
evaluationRuns?: Array<{
|
|
66
|
+
key: string;
|
|
67
|
+
kind: string;
|
|
68
|
+
runId: string;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
export interface EvolutionPublicationReceipt {
|
|
72
|
+
receiptId: string;
|
|
73
|
+
changeId: string;
|
|
74
|
+
candidateHash: string;
|
|
75
|
+
approvalId: string;
|
|
76
|
+
resource: EvolutionVersionRef;
|
|
77
|
+
completedAt: string;
|
|
78
|
+
}
|
|
79
|
+
export interface EvolutionWorkbenchLink {
|
|
80
|
+
xpertId: string;
|
|
81
|
+
viewKey: string;
|
|
82
|
+
selectionId: string;
|
|
83
|
+
parameters: Record<string, string>;
|
|
84
|
+
}
|
|
85
|
+
export interface EvolutionPresentationMetric {
|
|
86
|
+
key: string;
|
|
87
|
+
label: I18nText;
|
|
88
|
+
value: string | number | null;
|
|
89
|
+
total?: number;
|
|
90
|
+
}
|
|
91
|
+
export interface EvolutionChangePresentation {
|
|
92
|
+
title: string;
|
|
93
|
+
resourceLabel: string;
|
|
94
|
+
contextLabel?: string;
|
|
95
|
+
description?: I18nText;
|
|
96
|
+
metrics?: EvolutionPresentationMetric[];
|
|
97
|
+
effect?: {
|
|
98
|
+
status: 'pending' | 'partial' | 'active' | 'unknown';
|
|
99
|
+
label: I18nText;
|
|
100
|
+
description?: I18nText;
|
|
101
|
+
};
|
|
102
|
+
workbench?: EvolutionWorkbenchLink;
|
|
103
|
+
historyWorkbench?: EvolutionWorkbenchLink;
|
|
104
|
+
}
|
|
105
|
+
export type EvolutionChangeStatus = 'preparing' | 'testing' | 'test_failed' | 'pending_approval' | 'approved' | 'publishing' | 'published' | 'rejected' | 'stale' | 'failed';
|
|
106
|
+
export interface EvolutionChange {
|
|
107
|
+
contractVersion: 3;
|
|
108
|
+
strategy: EvolutionStrategySnapshot;
|
|
109
|
+
sourceKind: EvolutionInputKind;
|
|
110
|
+
learningEventIds: string[];
|
|
111
|
+
candidateInput: Record<string, string | number | boolean | string[]>;
|
|
112
|
+
datasetSnapshotIds: Record<string, string>;
|
|
113
|
+
stages: EvolutionStageRecord[];
|
|
114
|
+
changeId: string;
|
|
115
|
+
targetId: string;
|
|
116
|
+
requestId: string;
|
|
117
|
+
scope: EvolutionScope;
|
|
118
|
+
baseline: EvolutionVersionRef;
|
|
119
|
+
evidence: EvolutionEvidenceRef[];
|
|
120
|
+
evidenceHash: string;
|
|
121
|
+
status: EvolutionChangeStatus;
|
|
122
|
+
candidate?: EvolutionChangeCandidate;
|
|
123
|
+
evaluation?: EvolutionChangeEvaluation;
|
|
124
|
+
approval?: ApprovalDecision;
|
|
125
|
+
receipt?: EvolutionPublicationReceipt;
|
|
126
|
+
jobId: string;
|
|
127
|
+
createdBy: string;
|
|
128
|
+
createdAt: string;
|
|
129
|
+
updatedAt: string;
|
|
130
|
+
failureReasons?: string[];
|
|
131
|
+
presentation?: EvolutionChangePresentation;
|
|
132
|
+
presentationUnavailable?: boolean;
|
|
133
|
+
}
|
|
134
|
+
export interface EvolutionChangeOperation {
|
|
135
|
+
context: EvolutionProviderContext;
|
|
136
|
+
change: EvolutionChange;
|
|
137
|
+
evaluationStep?: import('./strategy').EvolutionEvaluationStep;
|
|
138
|
+
}
|
|
139
|
+
export interface EvolutionChangeProvider {
|
|
140
|
+
describe?(operation: EvolutionChangeOperation): Promise<EvolutionChangePresentation>;
|
|
141
|
+
prepare(operation: EvolutionChangeOperation): Promise<EvolutionChangeCandidate>;
|
|
142
|
+
evaluate(operation: EvolutionChangeOperation): Promise<EvolutionChangeEvaluation>;
|
|
143
|
+
validateCurrent(operation: EvolutionChangeOperation): Promise<{
|
|
144
|
+
valid: boolean;
|
|
145
|
+
reasons: string[];
|
|
146
|
+
}>;
|
|
147
|
+
authorizePublication(operation: EvolutionChangeOperation): Promise<void>;
|
|
148
|
+
publish(operation: EvolutionChangeOperation): Promise<EvolutionPublicationReceipt>;
|
|
149
|
+
}
|
|
150
|
+
export interface EvolutionChangeIdentity {
|
|
151
|
+
tenantId: string;
|
|
152
|
+
organizationId: string;
|
|
153
|
+
}
|
|
154
|
+
export interface SubmitEvolutionChange extends EvolutionChangeIdentity {
|
|
155
|
+
strategyId: string;
|
|
156
|
+
sourceKind: EvolutionInputKind;
|
|
157
|
+
learningEventIds?: string[];
|
|
158
|
+
candidateInput?: Record<string, string | number | boolean | string[]>;
|
|
159
|
+
datasetSnapshotIds?: Record<string, string>;
|
|
160
|
+
targetId: string;
|
|
161
|
+
requestId: string;
|
|
162
|
+
scope: EvolutionScope;
|
|
163
|
+
baseline: EvolutionVersionRef;
|
|
164
|
+
evidence: EvolutionEvidenceRef[];
|
|
165
|
+
}
|
|
166
|
+
export interface EvolutionChangeRuntimeApi {
|
|
167
|
+
prepare(input: SubmitEvolutionChange): Promise<EvolutionChange>;
|
|
168
|
+
get(input: EvolutionChangeIdentity & {
|
|
169
|
+
changeId: string;
|
|
170
|
+
}): Promise<EvolutionChange>;
|
|
171
|
+
list(input: EvolutionChangeIdentity & {
|
|
172
|
+
targetId?: string;
|
|
173
|
+
requestId?: string;
|
|
174
|
+
}): Promise<EvolutionChange[]>;
|
|
175
|
+
decide(input: EvolutionChangeIdentity & {
|
|
176
|
+
changeId: string;
|
|
177
|
+
candidateHash: string;
|
|
178
|
+
evaluationRunId: string;
|
|
179
|
+
decision: 'approved' | 'rejected';
|
|
180
|
+
reason: string;
|
|
181
|
+
}): Promise<EvolutionChange>;
|
|
182
|
+
publish(input: EvolutionChangeIdentity & {
|
|
183
|
+
changeId: string;
|
|
184
|
+
}): Promise<EvolutionChange>;
|
|
185
|
+
}
|
|
186
|
+
/** Assembled from canonical lifecycle entities; adapters retain their evaluation and release gates. */
|
|
187
|
+
export interface EvolutionLifecycleRecord {
|
|
188
|
+
id: string;
|
|
189
|
+
targetId: string;
|
|
190
|
+
title: string;
|
|
191
|
+
scope: EvolutionScope;
|
|
192
|
+
phase: 'preparation' | 'evaluation' | 'review' | 'publication' | 'effective' | 'blocked' | 'closed';
|
|
193
|
+
status: string;
|
|
194
|
+
createdAt: string;
|
|
195
|
+
updatedAt: string;
|
|
196
|
+
strategy: EvolutionStrategySnapshot;
|
|
197
|
+
stages: EvolutionStageRecord[];
|
|
198
|
+
sourceKind: EvolutionInputKind;
|
|
199
|
+
releasePackageId?: string;
|
|
200
|
+
publicationStatus: 'preparing' | 'review' | 'publishing' | 'published' | 'closed' | 'blocked';
|
|
201
|
+
effectStatus: 'pending' | 'partial' | 'active' | 'unknown';
|
|
202
|
+
baseline: EvolutionVersionRef;
|
|
203
|
+
candidate?: EvolutionChangeCandidate;
|
|
204
|
+
evaluation?: EvolutionChangeEvaluation;
|
|
205
|
+
approvals: ApprovalDecision[];
|
|
206
|
+
publication?: {
|
|
207
|
+
status: string;
|
|
208
|
+
version?: EvolutionVersionRef;
|
|
209
|
+
receipt?: EvolutionPublicationReceipt;
|
|
210
|
+
publishedAt?: string;
|
|
211
|
+
};
|
|
212
|
+
presentation?: EvolutionChangePresentation;
|
|
213
|
+
presentationUnavailable?: boolean;
|
|
214
|
+
job?: import('./governance').EvolutionJob;
|
|
215
|
+
capabilities: {
|
|
216
|
+
stagedRollout: boolean;
|
|
217
|
+
evaluate: boolean;
|
|
218
|
+
decide: boolean;
|
|
219
|
+
publish: boolean;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
@@ -17,6 +17,7 @@ export interface ReviewLearningEventRequest {
|
|
|
17
17
|
reviewStatus: 'pending' | 'ignored' | 'golden';
|
|
18
18
|
}
|
|
19
19
|
export interface DiagnoseLearningEventsRequest {
|
|
20
|
+
strategyId: string;
|
|
20
21
|
eventIds: string[];
|
|
21
22
|
}
|
|
22
23
|
export interface EvolutionAnalysisResult {
|
|
@@ -24,6 +25,7 @@ export interface EvolutionAnalysisResult {
|
|
|
24
25
|
clusters: import('./learning-event').EvolutionEventCluster[];
|
|
25
26
|
}
|
|
26
27
|
export interface CreateImprovementProposalRequest {
|
|
28
|
+
strategyId: string;
|
|
27
29
|
targetId: string;
|
|
28
30
|
scope: import('./target').EvolutionScope;
|
|
29
31
|
eventIds: string[];
|
|
@@ -71,7 +73,7 @@ export interface CreateEvolutionCanaryTestOverrideRequest {
|
|
|
71
73
|
/** Defaults to 30 minutes and is capped by the server. */
|
|
72
74
|
expiresInMinutes?: number;
|
|
73
75
|
}
|
|
74
|
-
export type EvolutionJobType = 'evaluation' | 'install' | 'shadow' | 'canary' | 'rollback';
|
|
76
|
+
export type EvolutionJobType = 'change_preparation' | 'evaluation' | 'install' | 'shadow' | 'canary' | 'rollback';
|
|
75
77
|
export type EvolutionJobStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
76
78
|
export interface EvolutionJob {
|
|
77
79
|
jobId: string;
|
|
@@ -52,6 +52,8 @@ export interface EvolutionEventCluster {
|
|
|
52
52
|
updatedAt: string;
|
|
53
53
|
}
|
|
54
54
|
export interface ImprovementProposal {
|
|
55
|
+
sourceKind: import('./strategy').EvolutionInputKind;
|
|
56
|
+
strategy: import('./strategy').EvolutionStrategySnapshot;
|
|
55
57
|
proposalId: string;
|
|
56
58
|
revision: number;
|
|
57
59
|
targetId: string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { EvolutionCandidate } from './candidate';
|
|
2
|
+
import type { EvaluationRun } from './evaluation';
|
|
3
|
+
import type { ImprovementProposal } from './learning-event';
|
|
4
|
+
import type { ReleasePackage } from './release';
|
|
5
|
+
import type { EvolutionScope } from './target';
|
|
6
|
+
import type { EvolutionChangeCandidate, EvolutionChangeEvaluation, EvolutionEvidenceRef, EvolutionPublicationReceipt, EvolutionVersionRef } from './change';
|
|
7
|
+
/** Evidence requests share Proposal persistence without fabricating trusted learning events. */
|
|
8
|
+
export interface EvidenceEvolutionProposal extends Pick<ImprovementProposal, 'problemStatement' | 'rootCause' | 'changeHypothesis' | 'riskLevel' | 'evidenceEventIds' | 'baseVersionId'> {
|
|
9
|
+
sourceKind: import('./strategy').EvolutionInputKind;
|
|
10
|
+
strategy: import('./strategy').EvolutionStrategySnapshot;
|
|
11
|
+
stages: import('./strategy').EvolutionStageRecord[];
|
|
12
|
+
learningEventIds: string[];
|
|
13
|
+
candidateInput: Record<string, string | number | boolean | string[]>;
|
|
14
|
+
datasetSnapshotIds: Record<string, string>;
|
|
15
|
+
proposalId: string;
|
|
16
|
+
revision: number;
|
|
17
|
+
targetId: string;
|
|
18
|
+
scope: EvolutionScope;
|
|
19
|
+
requestId: string;
|
|
20
|
+
candidateId: string;
|
|
21
|
+
title: string;
|
|
22
|
+
baseline: EvolutionVersionRef;
|
|
23
|
+
evidence: EvolutionEvidenceRef[];
|
|
24
|
+
evidenceHash: string;
|
|
25
|
+
status: 'draft' | 'ready' | 'candidate_built' | 'rejected';
|
|
26
|
+
preparation: 'queued' | 'completed' | 'failed';
|
|
27
|
+
failureReasons: string[];
|
|
28
|
+
jobId: string;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
createdBy: string;
|
|
32
|
+
}
|
|
33
|
+
export type StoredEvolutionProposal = ImprovementProposal | EvidenceEvolutionProposal;
|
|
34
|
+
export interface PreparedEvolutionCandidate extends EvolutionCandidate {
|
|
35
|
+
definition: Omit<EvolutionChangeCandidate, 'artifact'>;
|
|
36
|
+
evaluationRunId?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Replay bundles remain required by Replay EvaluationRun, not by every evaluator. */
|
|
39
|
+
export interface ProviderEvaluationRun {
|
|
40
|
+
evaluatorKind: 'strategy_checks';
|
|
41
|
+
runId: string;
|
|
42
|
+
candidateId: string;
|
|
43
|
+
targetId: string;
|
|
44
|
+
scope: EvolutionScope;
|
|
45
|
+
status: 'passed' | 'failed';
|
|
46
|
+
result: EvolutionChangeEvaluation;
|
|
47
|
+
startedAt: string;
|
|
48
|
+
completedAt: string;
|
|
49
|
+
}
|
|
50
|
+
export type StoredEvaluationRun = EvaluationRun | ProviderEvaluationRun;
|
|
51
|
+
interface ProviderReleaseBase {
|
|
52
|
+
publicationKind: 'provider_version';
|
|
53
|
+
releasePackageId: string;
|
|
54
|
+
candidateId: string;
|
|
55
|
+
candidateHash: string;
|
|
56
|
+
targetId: string;
|
|
57
|
+
evaluationRunId: string;
|
|
58
|
+
scope: EvolutionScope;
|
|
59
|
+
approvalIds: string[];
|
|
60
|
+
artifactHash: string;
|
|
61
|
+
providerKey: string;
|
|
62
|
+
providerVersion: string;
|
|
63
|
+
createdAt: string;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
createdBy: string;
|
|
66
|
+
}
|
|
67
|
+
export type ProviderReleasePackage = ProviderReleaseBase & ({
|
|
68
|
+
status: 'approved' | 'publishing';
|
|
69
|
+
receipt?: never;
|
|
70
|
+
} | {
|
|
71
|
+
status: 'published';
|
|
72
|
+
receipt: EvolutionPublicationReceipt;
|
|
73
|
+
});
|
|
74
|
+
export type StoredReleasePackage = ReleasePackage | ProviderReleasePackage;
|
|
75
|
+
export declare function isEvidenceProposal(value: StoredEvolutionProposal): value is EvidenceEvolutionProposal;
|
|
76
|
+
export declare function isLearningProposal(value: StoredEvolutionProposal): value is ImprovementProposal;
|
|
77
|
+
export declare function isPreparedCandidate(value: EvolutionCandidate): value is PreparedEvolutionCandidate;
|
|
78
|
+
export declare function isProviderEvaluation(value: StoredEvaluationRun): value is ProviderEvaluationRun;
|
|
79
|
+
export declare function isReplayEvaluation(value: StoredEvaluationRun): value is EvaluationRun;
|
|
80
|
+
export declare function isProviderRelease(value: StoredReleasePackage): value is ProviderReleasePackage;
|
|
81
|
+
export declare function isStagedRelease(value: StoredReleasePackage): value is ReleasePackage;
|
|
82
|
+
export {};
|
|
@@ -20,6 +20,10 @@ export interface EvolutionReleaseProvider {
|
|
|
20
20
|
}
|
|
21
21
|
export interface EvolutionTargetProvider {
|
|
22
22
|
readonly descriptor: EvolutionTargetDescriptor;
|
|
23
|
+
readonly draftBuilder?: Pick<import('./change').EvolutionChangeProvider, 'prepare'>;
|
|
24
|
+
readonly checkEvaluator?: Pick<import('./change').EvolutionChangeProvider, 'evaluate'>;
|
|
25
|
+
readonly versionPublisher?: Pick<import('./change').EvolutionChangeProvider, 'validateCurrent' | 'authorizePublication' | 'publish'>;
|
|
26
|
+
readonly presenter?: Pick<import('./change').EvolutionChangeProvider, 'describe'>;
|
|
23
27
|
readonly baselineExporter?: EvolutionBaselineExporter;
|
|
24
28
|
readonly candidateBuilder?: EvolutionCandidateBuilder;
|
|
25
29
|
readonly replayEvaluator?: EvolutionReplayEvaluator;
|
|
@@ -22,6 +22,7 @@ export interface ApprovalDecision {
|
|
|
22
22
|
candidateId: string;
|
|
23
23
|
candidateHash: string;
|
|
24
24
|
evaluationRunId: string;
|
|
25
|
+
strategyHash?: string;
|
|
25
26
|
scope: EvolutionScope;
|
|
26
27
|
decision: 'approved' | 'rejected';
|
|
27
28
|
actorId: string;
|
|
@@ -37,6 +38,7 @@ export interface ApprovalDecision {
|
|
|
37
38
|
decidedAt: string;
|
|
38
39
|
}
|
|
39
40
|
export interface ReleasePackage {
|
|
41
|
+
publicationKind: 'staged_rollout';
|
|
40
42
|
releasePackageId: string;
|
|
41
43
|
candidateId: string;
|
|
42
44
|
candidateHash: string;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { I18nText } from '../../i18n.model';
|
|
2
|
+
import type { EvolutionEvidenceRef } from './change';
|
|
3
|
+
import type { EvolutionRiskLevel } from './target';
|
|
4
|
+
export type EvolutionInputKind = 'learning_events' | 'business_evidence' | 'manual';
|
|
5
|
+
export type EvolutionStageKey = 'learning' | 'candidate' | 'evaluation' | 'approval' | 'publication' | 'effect';
|
|
6
|
+
export type EvolutionStageStatus = 'pending' | 'running' | 'passed' | 'failed' | 'not_applicable';
|
|
7
|
+
export interface EvolutionEvaluationStep {
|
|
8
|
+
key: string;
|
|
9
|
+
kind: 'target_checks' | 'golden_replay';
|
|
10
|
+
requiredChecks: Array<{
|
|
11
|
+
kind: string;
|
|
12
|
+
origin?: string;
|
|
13
|
+
blocking?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
/** Strategies compose stage capabilities; input origin never determines publication. */
|
|
17
|
+
export interface EvolutionStrategy {
|
|
18
|
+
id: string;
|
|
19
|
+
version: string;
|
|
20
|
+
label: I18nText;
|
|
21
|
+
inputs: EvolutionInputKind[];
|
|
22
|
+
learning: {
|
|
23
|
+
mode: 'none';
|
|
24
|
+
} | {
|
|
25
|
+
mode: 'feedback';
|
|
26
|
+
minimumEvents: number;
|
|
27
|
+
minimumSubjects: number;
|
|
28
|
+
maximumAgeDays: number;
|
|
29
|
+
trustLevels: Array<'L2' | 'L3' | 'L4'>;
|
|
30
|
+
};
|
|
31
|
+
evidenceKinds: EvolutionEvidenceRef['kind'][];
|
|
32
|
+
candidate: {
|
|
33
|
+
builder: 'change_set' | 'target_draft';
|
|
34
|
+
};
|
|
35
|
+
evaluations: EvolutionEvaluationStep[];
|
|
36
|
+
approval: 'human';
|
|
37
|
+
publication: {
|
|
38
|
+
mode: 'staged_rollout' | 'version_write';
|
|
39
|
+
effect: 'activation' | 'explicit_adoption';
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface EvolutionStrategySnapshot {
|
|
43
|
+
definition: EvolutionStrategy;
|
|
44
|
+
riskLevel: EvolutionRiskLevel;
|
|
45
|
+
hash: string;
|
|
46
|
+
providerKey: string;
|
|
47
|
+
providerVersion: string;
|
|
48
|
+
}
|
|
49
|
+
export interface EvolutionStageRecord {
|
|
50
|
+
key: EvolutionStageKey;
|
|
51
|
+
status: EvolutionStageStatus;
|
|
52
|
+
reason?: string;
|
|
53
|
+
runIds?: string[];
|
|
54
|
+
}
|
|
55
|
+
export declare const FEEDBACK_LEARNING_STRATEGY: EvolutionStrategy;
|
|
56
|
+
export declare function evidenceDrivenStrategy(input: {
|
|
57
|
+
version: string;
|
|
58
|
+
evidenceKinds: EvolutionEvidenceRef['kind'][];
|
|
59
|
+
requiredChecks: EvolutionEvaluationStep['requiredChecks'];
|
|
60
|
+
effect?: EvolutionStrategy['publication']['effect'];
|
|
61
|
+
}): EvolutionStrategy;
|
|
62
|
+
export declare const HUMAN_PROPOSAL_STRATEGY: EvolutionStrategy;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { I18nText } from '../../i18n.model';
|
|
2
|
-
export type EvolutionTargetType =
|
|
2
|
+
export type EvolutionTargetType = string;
|
|
3
3
|
export type EvolutionScopeType = 'tenant' | 'organization' | 'workspace' | 'project';
|
|
4
4
|
export type EvolutionExecutionMode = 'production' | 'replay' | 'shadow' | 'canary';
|
|
5
5
|
export type EvolutionChannel = 'production' | 'shadow' | 'canary';
|
|
6
6
|
export type EvolutionRiskLevel = 'R1' | 'R2' | 'R3' | 'R4';
|
|
7
|
+
/** Provider-owned scope dimensions; the platform compares the complete frozen map. */
|
|
7
8
|
export interface EvolutionScopeDimensions {
|
|
8
|
-
|
|
9
|
-
customerId?: string;
|
|
10
|
-
workspaceId?: string;
|
|
11
|
-
projectId?: string;
|
|
9
|
+
[key: string]: string | undefined;
|
|
12
10
|
}
|
|
13
11
|
export interface EvolutionScope {
|
|
14
12
|
type: EvolutionScopeType;
|
|
@@ -61,6 +59,11 @@ export interface EvolutionCandidateFormDescriptor {
|
|
|
61
59
|
fields: EvolutionCandidateChangeFieldDescriptor[];
|
|
62
60
|
}
|
|
63
61
|
export interface EvolutionTargetDescriptor {
|
|
62
|
+
strategies: import('./strategy').EvolutionStrategy[];
|
|
63
|
+
category?: {
|
|
64
|
+
key: string;
|
|
65
|
+
label: I18nText;
|
|
66
|
+
};
|
|
64
67
|
targetId: string;
|
|
65
68
|
targetType: EvolutionTargetType;
|
|
66
69
|
displayName: string;
|
package/src/ai/index.d.ts
CHANGED
|
@@ -32,7 +32,12 @@ export * from './model-usage.model';
|
|
|
32
32
|
export * from './rag';
|
|
33
33
|
export * from './rag-web';
|
|
34
34
|
export * from './knowledgebase.model';
|
|
35
|
+
export * from './knowledge-parser.model';
|
|
36
|
+
export * from './knowledge-table.model';
|
|
37
|
+
export * from './knowledge-chunking.model';
|
|
35
38
|
export * from './knowledge-faq.model';
|
|
39
|
+
export * from './knowledge-wiki.model';
|
|
40
|
+
export * from './knowledge-deletion.model';
|
|
36
41
|
export * from './knowledge-filter.model';
|
|
37
42
|
export * from './knowledge-doc.model';
|
|
38
43
|
export * from './knowledge-doc-page.model';
|
|
@@ -61,6 +66,8 @@ export * from './knowledgebase-task.model';
|
|
|
61
66
|
export * from './knowledge-pipeline';
|
|
62
67
|
export * from './knowledge-retrieval-log.model';
|
|
63
68
|
export * from './knowledge-doc-chunk.model';
|
|
69
|
+
export * from './knowledge-identity.model';
|
|
70
|
+
export * from './knowledge-wiki-identity.model';
|
|
64
71
|
export * from './knowledge-graph.model';
|
|
65
72
|
export * from './skill.model';
|
|
66
73
|
export * from './skill-install-command.model';
|
|
@@ -75,3 +82,7 @@ export * from './mcp-capability.model';
|
|
|
75
82
|
export * from './mcp-publication.model';
|
|
76
83
|
export * from './mcp-auth.model';
|
|
77
84
|
export * from './mcp-audit.model';
|
|
85
|
+
export * from './knowledge-wiki-organization.model';
|
|
86
|
+
export * from './knowledge-question.model';
|
|
87
|
+
export * from './knowledge-tag.model';
|
|
88
|
+
export * from './knowledge-parser-selection';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Shared fallback for ordinary documents without an explicitly configured strategy. */
|
|
2
|
+
export declare const DEFAULT_KNOWLEDGE_TEXT_SPLITTER = "auto";
|
|
3
|
+
/** Shared revision for structured execution diagnostics and cache invalidation. */
|
|
4
|
+
export declare const KNOWLEDGE_CHUNKING_ALGORITHM_VERSION = 5;
|
|
5
|
+
export type KnowledgeChunkingAlgorithmVersion = 1 | 2 | 3 | 4 | typeof KNOWLEDGE_CHUNKING_ALGORITHM_VERSION;
|
|
6
|
+
/** Built-in strategies that auto routing may select. External providers remain manually selectable. */
|
|
7
|
+
export type KnowledgeChunkingStrategy = 'recursive-character' | 'markdown-recursive' | 'structure-aware';
|
|
8
|
+
export type KnowledgeChunkingRequest = KnowledgeChunkingStrategy | 'auto';
|
|
9
|
+
export type KnowledgeChunkBlockType = 'heading' | 'paragraph' | 'table' | 'list' | 'code' | 'formula' | 'other';
|
|
10
|
+
export type KnowledgeChunkingReason = 'structured-blocks' | 'markdown-headings' | 'layout-headings' | 'plain-text' | 'missing-structure' | 'explicit-structure';
|
|
11
|
+
export type KnowledgeChunkingWarning = 'structure-split' | 'context-reduced' | 'coarse-provenance' | 'unsupported-structure' | 'missing-format';
|
|
12
|
+
/** Offsets are UTF-16 positions in the pre-split source fragment, never in an added heading prefix. */
|
|
13
|
+
export interface KnowledgeChunkSourceRange {
|
|
14
|
+
sourceIndex: number;
|
|
15
|
+
startOffset: number;
|
|
16
|
+
endOffset: number;
|
|
17
|
+
}
|
|
18
|
+
export interface KnowledgeChunkingDecision {
|
|
19
|
+
inputHash: string;
|
|
20
|
+
sourceIndexes: number[];
|
|
21
|
+
requestedStrategy: KnowledgeChunkingRequest;
|
|
22
|
+
resolvedStrategy: KnowledgeChunkingStrategy;
|
|
23
|
+
reason: KnowledgeChunkingReason;
|
|
24
|
+
algorithmVersion: KnowledgeChunkingAlgorithmVersion;
|
|
25
|
+
blockCounts: Partial<Record<KnowledgeChunkBlockType, number>>;
|
|
26
|
+
warnings: KnowledgeChunkingWarning[];
|
|
27
|
+
}
|
|
28
|
+
export interface KnowledgeChunkingMetadata {
|
|
29
|
+
inputHash: string;
|
|
30
|
+
requestedStrategy: KnowledgeChunkingRequest;
|
|
31
|
+
resolvedStrategy: KnowledgeChunkingStrategy;
|
|
32
|
+
reason: KnowledgeChunkingReason;
|
|
33
|
+
algorithmVersion: KnowledgeChunkingAlgorithmVersion;
|
|
34
|
+
headingPath: string[];
|
|
35
|
+
sourceRanges: KnowledgeChunkSourceRange[];
|
|
36
|
+
contextRanges?: KnowledgeChunkSourceRange[];
|
|
37
|
+
warnings: KnowledgeChunkingWarning[];
|
|
38
|
+
continued?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Common options accepted by the new built-in strategies; the token budget has a single execution owner. */
|
|
41
|
+
export interface KnowledgeStructuredChunkOptions {
|
|
42
|
+
chunkSize?: number;
|
|
43
|
+
chunkOverlap?: number;
|
|
44
|
+
separators?: string | string[];
|
|
45
|
+
}
|
|
46
|
+
/** Language affects natural text boundaries, never strategy selection. */
|
|
47
|
+
export type KnowledgeChunkLanguage = 'Chinese' | 'English' | 'Mixed';
|
|
48
|
+
export type KnowledgeChunkLanguageHint = 'auto' | Exclude<KnowledgeChunkLanguage, 'Mixed'>;
|
|
49
|
+
export interface KnowledgeChunkLanguageDetection {
|
|
50
|
+
/** Absent when the bounded sample contains no identifiable natural text. */
|
|
51
|
+
detectedLanguage?: KnowledgeChunkLanguage;
|
|
52
|
+
sampledCodeUnits: number;
|
|
53
|
+
naturalUnits: number;
|
|
54
|
+
}
|
|
55
|
+
export interface KnowledgeChunkLanguageDecision extends KnowledgeChunkLanguageDetection {
|
|
56
|
+
sourceIndexes: number[];
|
|
57
|
+
languageHint: KnowledgeChunkLanguageHint;
|
|
58
|
+
resolvedLanguage: KnowledgeChunkLanguage;
|
|
59
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type KnowledgeDeletionStatus = 'prepared' | 'quiescing' | 'retracting' | 'external_cleanup' | 'finalizing' | 'completed' | 'failed';
|
|
2
|
+
export type KnowledgeDeletionRecoveryAction = {
|
|
3
|
+
canRetry: boolean;
|
|
4
|
+
recommendedAction: 'wait' | 'retry';
|
|
5
|
+
};
|
|
6
|
+
export type KnowledgeDocumentDeletionReceipt = {
|
|
7
|
+
intentId: string;
|
|
8
|
+
documentId: string;
|
|
9
|
+
status: KnowledgeDeletionStatus;
|
|
10
|
+
acceptedAt: Date;
|
|
11
|
+
completedAt?: Date | null;
|
|
12
|
+
failedStage?: string | null;
|
|
13
|
+
errorCode?: string | null;
|
|
14
|
+
canRetry: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type KnowledgebaseDeletionReceipt = {
|
|
17
|
+
intentId: string;
|
|
18
|
+
knowledgebaseIdSnapshot: string;
|
|
19
|
+
status: KnowledgeDeletionStatus;
|
|
20
|
+
acceptedAt: Date;
|
|
21
|
+
completedAt?: Date | null;
|
|
22
|
+
failedStage?: string | null;
|
|
23
|
+
errorCode?: string | null;
|
|
24
|
+
canRetry: boolean;
|
|
25
|
+
};
|