@pellux/goodvibes-sdk 0.27.11 → 0.28.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.
- package/dist/_internal/contracts/artifacts/operator-contract.json +7534 -5938
- package/dist/_internal/contracts/generated/foundation-metadata.d.ts +2 -2
- package/dist/_internal/contracts/generated/foundation-metadata.js +2 -2
- package/dist/_internal/contracts/generated/operator-contract.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-contract.js +7534 -5938
- package/dist/_internal/contracts/generated/operator-method-ids.d.ts +1 -1
- package/dist/_internal/contracts/generated/operator-method-ids.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-method-ids.js +8 -0
- package/dist/_internal/daemon/context.d.ts +4 -0
- package/dist/_internal/daemon/context.d.ts.map +1 -1
- package/dist/_internal/daemon/index.d.ts +1 -0
- package/dist/_internal/daemon/index.d.ts.map +1 -1
- package/dist/_internal/daemon/index.js +1 -0
- package/dist/_internal/daemon/knowledge-refinement-routes.d.ts +4 -0
- package/dist/_internal/daemon/knowledge-refinement-routes.d.ts.map +1 -0
- package/dist/_internal/daemon/knowledge-refinement-routes.js +57 -0
- package/dist/_internal/daemon/knowledge-route-types.d.ts +4 -0
- package/dist/_internal/daemon/knowledge-route-types.d.ts.map +1 -1
- package/dist/_internal/daemon/knowledge-routes.d.ts +1 -1
- package/dist/_internal/daemon/knowledge-routes.d.ts.map +1 -1
- package/dist/_internal/daemon/knowledge-routes.js +2 -0
- package/dist/_internal/daemon/operator.d.ts +1 -1
- package/dist/_internal/daemon/operator.d.ts.map +1 -1
- package/dist/_internal/daemon/operator.js +10 -0
- package/dist/_internal/platform/config/schema-domain-runtime.d.ts +4 -0
- package/dist/_internal/platform/config/schema-domain-runtime.d.ts.map +1 -1
- package/dist/_internal/platform/config/schema-domain-runtime.js +17 -0
- package/dist/_internal/platform/config/schema-types.d.ts +6 -2
- package/dist/_internal/platform/config/schema-types.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/method-catalog-homegraph.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/method-catalog-homegraph.js +52 -2
- package/dist/_internal/platform/control-plane/method-catalog-knowledge.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/method-catalog-knowledge.js +58 -1
- package/dist/_internal/platform/control-plane/operator-contract-schemas-homegraph.d.ts +20 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-homegraph.d.ts.map +1 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-homegraph.js +140 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-knowledge.d.ts +11 -16
- package/dist/_internal/platform/control-plane/operator-contract-schemas-knowledge.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/operator-contract-schemas-knowledge.js +78 -127
- package/dist/_internal/platform/control-plane/routes/operator.d.ts +1 -1
- package/dist/_internal/platform/control-plane/routes/operator.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/routes/operator.js +10 -0
- package/dist/_internal/platform/daemon/http/home-graph-routes.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/home-graph-routes.js +32 -0
- package/dist/_internal/platform/daemon/http/openai-compatible-routes.d.ts +10 -0
- package/dist/_internal/platform/daemon/http/openai-compatible-routes.d.ts.map +1 -0
- package/dist/_internal/platform/daemon/http/openai-compatible-routes.js +445 -0
- package/dist/_internal/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/router-route-contexts.js +4 -0
- package/dist/_internal/platform/daemon/http/router.d.ts +1 -0
- package/dist/_internal/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/router.js +16 -0
- package/dist/_internal/platform/knowledge/home-graph/ask.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/ask.js +1 -0
- package/dist/_internal/platform/knowledge/home-graph/generated-pages.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/generated-pages.js +24 -5
- package/dist/_internal/platform/knowledge/home-graph/inventory.d.ts +23 -0
- package/dist/_internal/platform/knowledge/home-graph/inventory.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/home-graph/inventory.js +21 -0
- package/dist/_internal/platform/knowledge/home-graph/map-view.d.ts +6 -0
- package/dist/_internal/platform/knowledge/home-graph/map-view.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/home-graph/map-view.js +11 -0
- package/dist/_internal/platform/knowledge/home-graph/refinement.d.ts +56 -0
- package/dist/_internal/platform/knowledge/home-graph/refinement.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/home-graph/refinement.js +62 -0
- package/dist/_internal/platform/knowledge/home-graph/rendering.d.ts +3 -3
- package/dist/_internal/platform/knowledge/home-graph/rendering.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/rendering.js +52 -136
- package/dist/_internal/platform/knowledge/home-graph/service.d.ts +46 -0
- package/dist/_internal/platform/knowledge/home-graph/service.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/service.js +25 -46
- package/dist/_internal/platform/knowledge/home-graph/state.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/state.js +20 -1
- package/dist/_internal/platform/knowledge/home-graph/status.d.ts +4 -0
- package/dist/_internal/platform/knowledge/home-graph/status.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/home-graph/status.js +43 -0
- package/dist/_internal/platform/knowledge/home-graph/types.d.ts +8 -0
- package/dist/_internal/platform/knowledge/home-graph/types.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/index.d.ts +1 -1
- package/dist/_internal/platform/knowledge/index.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/scheduling.js +1 -1
- package/dist/_internal/platform/knowledge/semantic/answer.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/semantic/answer.js +69 -9
- package/dist/_internal/platform/knowledge/semantic/fact-quality.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/semantic/fact-quality.js +12 -0
- package/dist/_internal/platform/knowledge/semantic/gap-repair.d.ts +1 -0
- package/dist/_internal/platform/knowledge/semantic/gap-repair.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/semantic/gap-repair.js +146 -5
- package/dist/_internal/platform/knowledge/semantic/self-improvement.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/semantic/self-improvement.js +126 -6
- package/dist/_internal/platform/knowledge/semantic/service.d.ts +1 -2
- package/dist/_internal/platform/knowledge/semantic/service.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/semantic/service.js +51 -54
- package/dist/_internal/platform/knowledge/semantic/types.d.ts +17 -0
- package/dist/_internal/platform/knowledge/semantic/types.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/service-jobs.d.ts +34 -0
- package/dist/_internal/platform/knowledge/service-jobs.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/service-jobs.js +64 -0
- package/dist/_internal/platform/knowledge/service.d.ts +17 -1
- package/dist/_internal/platform/knowledge/service.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/service.js +52 -69
- package/dist/_internal/platform/knowledge/store-config.d.ts +8 -0
- package/dist/_internal/platform/knowledge/store-config.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/store-config.js +10 -0
- package/dist/_internal/platform/knowledge/store-load.d.ts +2 -1
- package/dist/_internal/platform/knowledge/store-load.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/store-load.js +2 -1
- package/dist/_internal/platform/knowledge/store-read.d.ts +10 -1
- package/dist/_internal/platform/knowledge/store-read.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/store-read.js +14 -0
- package/dist/_internal/platform/knowledge/store-refinement.d.ts +4 -0
- package/dist/_internal/platform/knowledge/store-refinement.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/store-refinement.js +69 -0
- package/dist/_internal/platform/knowledge/store-schema.d.ts +2 -1
- package/dist/_internal/platform/knowledge/store-schema.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/store-schema.js +48 -0
- package/dist/_internal/platform/knowledge/store.d.ts +6 -7
- package/dist/_internal/platform/knowledge/store.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/store.js +18 -13
- package/dist/_internal/platform/knowledge/types.d.ts +56 -0
- package/dist/_internal/platform/knowledge/types.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/turn.d.ts +6 -2
- package/dist/_internal/platform/runtime/emitters/turn.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/turn.js +4 -4
- package/dist/_internal/platform/runtime/events/turn.d.ts +12 -2
- package/dist/_internal/platform/runtime/events/turn.d.ts.map +1 -1
- package/dist/_internal/platform/version.js +1 -1
- package/package.json +1 -1
|
@@ -39,13 +39,14 @@ async function repairKnowledgeGapsWithWeb(request, options) {
|
|
|
39
39
|
canonicalizeUri(source.canonicalUri ?? ''),
|
|
40
40
|
canonicalizeUri(source.sourceUri ?? ''),
|
|
41
41
|
].filter((value) => Boolean(value))));
|
|
42
|
-
const candidates = selectGapRepairCandidates(response.results, existing, options, query);
|
|
42
|
+
const candidates = selectGapRepairCandidates(response.results, existing, options, query, request);
|
|
43
43
|
if (candidates.length < Math.max(2, options.minDistinctDomains ?? 2)) {
|
|
44
44
|
return {
|
|
45
45
|
searched: true,
|
|
46
46
|
query,
|
|
47
47
|
ingestedSourceIds: [],
|
|
48
48
|
skippedUrls: response.results.map((result) => result.url),
|
|
49
|
+
sourceAssessments: buildSourceAssessments(response.results, candidates, existing, options, query, request),
|
|
49
50
|
reason: 'Fewer than two distinct external sources were found for source-backed gap repair.',
|
|
50
51
|
};
|
|
51
52
|
}
|
|
@@ -69,6 +70,13 @@ async function repairKnowledgeGapsWithWeb(request, options) {
|
|
|
69
70
|
gapQuestions: request.gaps.map((gap) => gap.title),
|
|
70
71
|
originalSourceIds: request.sources.map((source) => source.id),
|
|
71
72
|
linkedObjectIds: request.linkedObjects.map((node) => node.id),
|
|
73
|
+
confidence: result.confidence,
|
|
74
|
+
confidenceReasons: result.reasons,
|
|
75
|
+
sourceRank: result.rank,
|
|
76
|
+
sourceDomain: result.domain ?? safeDomain(result.url),
|
|
77
|
+
trustReason: result.reasons.join(', '),
|
|
78
|
+
agreementSourceCount: candidates.length,
|
|
79
|
+
selectedUrl: result.url,
|
|
72
80
|
searchedAt: Date.now(),
|
|
73
81
|
},
|
|
74
82
|
},
|
|
@@ -86,6 +94,7 @@ async function repairKnowledgeGapsWithWeb(request, options) {
|
|
|
86
94
|
query,
|
|
87
95
|
ingestedSourceIds,
|
|
88
96
|
skippedUrls,
|
|
97
|
+
sourceAssessments: buildSourceAssessments(response.results, candidates, existing, options, query, request),
|
|
89
98
|
...(ingestedSourceIds.length < 2 ? { reason: 'Gap repair searched but fewer than two sources were ingested.' } : {}),
|
|
90
99
|
};
|
|
91
100
|
}
|
|
@@ -108,15 +117,20 @@ function bestSubject(request) {
|
|
|
108
117
|
const linked = request.linkedObjects[0];
|
|
109
118
|
const source = request.sources[0];
|
|
110
119
|
const metadata = linked?.metadata ?? {};
|
|
111
|
-
|
|
120
|
+
const identity = uniqueStrings([
|
|
112
121
|
readString(metadata.manufacturer),
|
|
113
122
|
readString(metadata.model),
|
|
123
|
+
]).join(' ');
|
|
124
|
+
if (identity)
|
|
125
|
+
return identity;
|
|
126
|
+
return uniqueStrings([
|
|
114
127
|
linked?.title,
|
|
115
128
|
source?.title,
|
|
116
129
|
]).join(' ') || null;
|
|
117
130
|
}
|
|
118
|
-
function selectGapRepairCandidates(results, existingCanonicalUris, options, query) {
|
|
131
|
+
function selectGapRepairCandidates(results, existingCanonicalUris, options, query, request) {
|
|
119
132
|
const tokens = tokenizeSemanticQuery(query);
|
|
133
|
+
const minimumConfidence = Math.max(1, Math.min(100, options.minConfidence ?? 70));
|
|
120
134
|
const byDomain = new Map();
|
|
121
135
|
for (const result of results) {
|
|
122
136
|
const canonical = canonicalizeUri(result.url);
|
|
@@ -128,9 +142,136 @@ function selectGapRepairCandidates(results, existingCanonicalUris, options, quer
|
|
|
128
142
|
const domain = result.domain ?? safeDomain(result.url);
|
|
129
143
|
if (!domain || byDomain.has(domain))
|
|
130
144
|
continue;
|
|
131
|
-
|
|
145
|
+
const assessment = assessGapRepairSource(result, query, request);
|
|
146
|
+
if (assessment.confidence < minimumConfidence)
|
|
147
|
+
continue;
|
|
148
|
+
byDomain.set(domain, { ...result, confidence: assessment.confidence, reasons: assessment.reasons });
|
|
149
|
+
}
|
|
150
|
+
return [...byDomain.values()]
|
|
151
|
+
.sort((left, right) => right.confidence - left.confidence || left.rank - right.rank)
|
|
152
|
+
.slice(0, Math.max(2, Math.min(8, options.maxResults ?? 6)));
|
|
153
|
+
}
|
|
154
|
+
function assessGapRepairSource(result, query, request) {
|
|
155
|
+
const searchable = [result.title, result.snippet, result.url, result.domain].filter(Boolean).join(' ').toLowerCase();
|
|
156
|
+
const reasons = [];
|
|
157
|
+
let score = Math.max(0, 12 - result.rank);
|
|
158
|
+
const identities = sourceIdentityHints(request);
|
|
159
|
+
for (const model of identities.models) {
|
|
160
|
+
if (hasIdentity(searchable, model)) {
|
|
161
|
+
score += model.length >= 8 ? 42 : 28;
|
|
162
|
+
reasons.push(`model:${model}`);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (const manufacturer of identities.manufacturers) {
|
|
167
|
+
if (hasIdentity(searchable, manufacturer)) {
|
|
168
|
+
score += 14;
|
|
169
|
+
reasons.push(`manufacturer:${manufacturer}`);
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
for (const subject of identities.subjects) {
|
|
174
|
+
if (subject.length >= 4 && hasIdentity(searchable, subject)) {
|
|
175
|
+
score += 30;
|
|
176
|
+
reasons.push(`subject:${subject}`);
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const queryScore = scoreSemanticText(searchable, tokenizeSemanticQuery(query));
|
|
181
|
+
if (queryScore > 0) {
|
|
182
|
+
score += Math.min(18, queryScore);
|
|
183
|
+
reasons.push('query-match');
|
|
184
|
+
}
|
|
185
|
+
const gapScore = scoreSemanticText(searchable, tokenizeSemanticQuery(request.gaps.map((gap) => `${gap.title} ${gap.summary ?? ''}`).join(' ')));
|
|
186
|
+
if (gapScore > 0) {
|
|
187
|
+
score += Math.min(14, gapScore);
|
|
188
|
+
reasons.push('gap-match');
|
|
189
|
+
}
|
|
190
|
+
const domain = (result.domain ?? safeDomain(result.url) ?? '').toLowerCase();
|
|
191
|
+
if (/\b(specifications?|features?|manual|support|product|documentation|datasheet)\b/.test(searchable)) {
|
|
192
|
+
score += 10;
|
|
193
|
+
reasons.push('source-purpose');
|
|
194
|
+
}
|
|
195
|
+
if (domain && identities.manufacturers.some((manufacturer) => manufacturer.length >= 2 && domain.includes(manufacturer.toLowerCase()))) {
|
|
196
|
+
score += 10;
|
|
197
|
+
reasons.push('manufacturer-domain');
|
|
132
198
|
}
|
|
133
|
-
return
|
|
199
|
+
return {
|
|
200
|
+
url: result.url,
|
|
201
|
+
...(result.title ? { title: result.title } : {}),
|
|
202
|
+
...(domain ? { domain } : {}),
|
|
203
|
+
rank: result.rank,
|
|
204
|
+
confidence: Math.max(0, Math.min(100, score)),
|
|
205
|
+
reasons,
|
|
206
|
+
...(reasons.length > 0 ? { trustReason: reasons.join(', ') } : {}),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function buildSourceAssessments(results, candidates, existingCanonicalUris, options, query, request) {
|
|
210
|
+
const accepted = new Set(candidates.map((candidate) => canonicalizeUri(candidate.url)));
|
|
211
|
+
const acceptedDomains = new Set(candidates.map((candidate) => candidate.domain ?? safeDomain(candidate.url)).filter(Boolean));
|
|
212
|
+
const minimumConfidence = Math.max(1, Math.min(100, options.minConfidence ?? 70));
|
|
213
|
+
const tokens = tokenizeSemanticQuery(query);
|
|
214
|
+
return results.map((result) => {
|
|
215
|
+
const assessment = assessGapRepairSource(result, query, request);
|
|
216
|
+
const canonical = canonicalizeUri(result.url);
|
|
217
|
+
const domain = result.domain ?? safeDomain(result.url);
|
|
218
|
+
const isAccepted = Boolean(canonical && accepted.has(canonical));
|
|
219
|
+
let rejectionReason;
|
|
220
|
+
if (!isAccepted) {
|
|
221
|
+
if (canonical && existingCanonicalUris.has(canonical))
|
|
222
|
+
rejectionReason = 'already-indexed';
|
|
223
|
+
else if (tokens.length > 0 && scoreSemanticText([result.title, result.snippet, result.url, domain].filter(Boolean).join(' '), tokens) === 0)
|
|
224
|
+
rejectionReason = 'query-mismatch';
|
|
225
|
+
else if (assessment.confidence < minimumConfidence)
|
|
226
|
+
rejectionReason = 'below-confidence-threshold';
|
|
227
|
+
else if (domain && acceptedDomains.has(domain))
|
|
228
|
+
rejectionReason = 'duplicate-domain';
|
|
229
|
+
else
|
|
230
|
+
rejectionReason = 'not-selected';
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
...assessment,
|
|
234
|
+
accepted: isAccepted,
|
|
235
|
+
...(rejectionReason ? { rejectionReason } : {}),
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function sourceIdentityHints(request) {
|
|
240
|
+
const subjects = uniqueStrings([
|
|
241
|
+
...request.linkedObjects.flatMap((node) => [node.title, ...node.aliases]),
|
|
242
|
+
...request.sources.flatMap((source) => [source.title, source.summary]),
|
|
243
|
+
]).filter((subject) => !isGenericSubject(subject));
|
|
244
|
+
const models = uniqueStrings(request.linkedObjects.flatMap((node) => [
|
|
245
|
+
readString(node.metadata.model),
|
|
246
|
+
readString(node.metadata.modelId),
|
|
247
|
+
readString(node.metadata.model_id),
|
|
248
|
+
...modelLikeTokens(`${node.title} ${node.aliases.join(' ')}`),
|
|
249
|
+
]).concat(request.sources.flatMap((source) => modelLikeTokens(`${source.title ?? ''} ${source.sourceUri ?? ''} ${source.canonicalUri ?? ''}`))));
|
|
250
|
+
const manufacturers = uniqueStrings(request.linkedObjects.flatMap((node) => [
|
|
251
|
+
readString(node.metadata.manufacturer),
|
|
252
|
+
readString(node.metadata.vendor),
|
|
253
|
+
]).concat(request.sources.flatMap((source) => manufacturerHints(`${source.title ?? ''} ${source.sourceUri ?? ''} ${source.canonicalUri ?? ''}`))));
|
|
254
|
+
return { models, manufacturers, subjects };
|
|
255
|
+
}
|
|
256
|
+
function isGenericSubject(value) {
|
|
257
|
+
return /^(tv|television|device|manual|user guide|owner manual|home assistant|service|provider|integration)$/i.test(value.trim());
|
|
258
|
+
}
|
|
259
|
+
function modelLikeTokens(value) {
|
|
260
|
+
return uniqueStrings(value.match(/\b[A-Z]{2,}[-_ ]?[0-9][A-Z0-9._-]{2,}\b/g) ?? []);
|
|
261
|
+
}
|
|
262
|
+
function manufacturerHints(value) {
|
|
263
|
+
const hints = value.match(/\b(lg|samsung|sony|vizio|tcl|hisense|philips|panasonic|kasa|tp-link|ecobee|honeywell|ring|arlo|nest|eufy|aqara|sonoff|shelly|lutron|leviton|ikea|bosch|ge|whirlpool|frigidaire|apple|espressif|esp32|nabu casa|home assistant)\b/gi) ?? [];
|
|
264
|
+
return uniqueStrings(hints.map((hint) => hint.toLowerCase()));
|
|
265
|
+
}
|
|
266
|
+
function hasIdentity(searchable, value) {
|
|
267
|
+
const normalized = value.trim().toLowerCase();
|
|
268
|
+
if (!normalized)
|
|
269
|
+
return false;
|
|
270
|
+
const compact = normalized.replace(/[\s_-]+/g, '');
|
|
271
|
+
const searchableCompact = searchable.replace(/[\s_-]+/g, '');
|
|
272
|
+
if (compact.length >= 4 && searchableCompact.includes(compact))
|
|
273
|
+
return true;
|
|
274
|
+
return searchable.includes(normalized);
|
|
134
275
|
}
|
|
135
276
|
function safeDomain(url) {
|
|
136
277
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-improvement.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/semantic/self-improvement.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"self-improvement.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/semantic/self-improvement.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAUlD,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,YAAY,CAAC;AAapB,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxC;AAUD,wBAAsB,mCAAmC,CACvD,OAAO,EAAE,kBAAkB,EAC3B,KAAK,GAAE,iCAAsC,GAC5C,OAAO,CAAC,kCAAkC,CAAC,CAwI7C"}
|
|
@@ -13,44 +13,68 @@ export async function runKnowledgeSemanticSelfImprovement(context, input = {}) {
|
|
|
13
13
|
let repairableGaps = 0;
|
|
14
14
|
let suppressedGaps = 0;
|
|
15
15
|
let skippedGaps = 0;
|
|
16
|
+
let blockedGaps = 0;
|
|
17
|
+
let closedGaps = 0;
|
|
18
|
+
let queuedTasks = 0;
|
|
16
19
|
let searched = 0;
|
|
17
20
|
let ingestedSources = 0;
|
|
18
21
|
let linkedRepairs = 0;
|
|
22
|
+
const taskIds = [];
|
|
23
|
+
const ingestedSourceIds = [];
|
|
19
24
|
const errors = [];
|
|
25
|
+
const trigger = input.reason ?? 'manual';
|
|
20
26
|
for (const gap of gaps) {
|
|
21
27
|
const gapContext = buildGapContext(context.store, spaceId, gap);
|
|
28
|
+
let task = await upsertRefinementTaskForGap(context.store, spaceId, gapContext, trigger, 'detected', 'Gap was detected for semantic refinement.');
|
|
29
|
+
taskIds.push(task.id);
|
|
22
30
|
const classification = classifyGap(gapContext, input.force === true);
|
|
23
31
|
if (classification.action === 'suppress') {
|
|
24
32
|
await suppressGap(context.store, gap, classification.reason, spaceId);
|
|
33
|
+
await updateRefinementTask(context.store, task, 'suppressed', classification.reason ?? 'Gap was classified as not applicable.');
|
|
25
34
|
suppressedGaps += 1;
|
|
26
35
|
continue;
|
|
27
36
|
}
|
|
28
37
|
if (classification.action === 'skip') {
|
|
29
|
-
|
|
38
|
+
if (classification.status === 'repaired' || classification.status === 'already_repaired') {
|
|
39
|
+
closedGaps += 1;
|
|
40
|
+
await updateRefinementTask(context.store, task, 'closed', classification.reason ?? 'Gap is already repaired.');
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (classification.status === 'active') {
|
|
44
|
+
skippedGaps += 1;
|
|
45
|
+
await updateRefinementTask(context.store, task, 'queued', classification.reason ?? 'Gap repair is already active.');
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
blockedGaps += 1;
|
|
30
49
|
if (classification.markAttempt) {
|
|
31
50
|
await markGapRepairAttempt(context.store, gap, spaceId, {
|
|
32
51
|
status: classification.status ?? 'skipped',
|
|
33
52
|
reason: classification.reason,
|
|
34
53
|
});
|
|
35
54
|
}
|
|
55
|
+
await updateRefinementTask(context.store, task, 'blocked', classification.reason ?? 'Gap is not currently repairable.');
|
|
36
56
|
continue;
|
|
37
57
|
}
|
|
38
|
-
repairableGaps += 1;
|
|
39
58
|
if (!context.gapRepairer) {
|
|
40
|
-
|
|
59
|
+
blockedGaps += 1;
|
|
41
60
|
await markGapRepairAttempt(context.store, gap, spaceId, {
|
|
42
61
|
status: 'no_repairer',
|
|
43
62
|
reason: 'No semantic gap repairer is configured.',
|
|
44
63
|
});
|
|
64
|
+
await updateRefinementTask(context.store, task, 'blocked', 'No semantic gap repairer is configured.');
|
|
45
65
|
continue;
|
|
46
66
|
}
|
|
47
67
|
const repairKey = `${spaceId}:${gap.id}`;
|
|
48
68
|
if (context.activeGapRepairs.has(repairKey)) {
|
|
49
69
|
skippedGaps += 1;
|
|
70
|
+
await updateRefinementTask(context.store, task, 'queued', 'Gap repair is already active.');
|
|
50
71
|
continue;
|
|
51
72
|
}
|
|
73
|
+
repairableGaps += 1;
|
|
74
|
+
queuedTasks += 1;
|
|
52
75
|
context.activeGapRepairs.add(repairKey);
|
|
53
76
|
try {
|
|
77
|
+
task = await updateRefinementTask(context.store, task, 'searching', 'Searching for source-backed repair evidence.', { query: gap.title });
|
|
54
78
|
const result = await context.gapRepairer({
|
|
55
79
|
spaceId,
|
|
56
80
|
query: gap.title,
|
|
@@ -62,12 +86,31 @@ export async function runKnowledgeSemanticSelfImprovement(context, input = {}) {
|
|
|
62
86
|
if (result?.searched)
|
|
63
87
|
searched += 1;
|
|
64
88
|
ingestedSources += result?.ingestedSourceIds.length ?? 0;
|
|
89
|
+
ingestedSourceIds.push(...(result?.ingestedSourceIds ?? []));
|
|
90
|
+
task = await updateRefinementTask(context.store, task, 'evaluating', result?.reason ?? 'Source discovery completed.', {
|
|
91
|
+
query: result?.query ?? gap.title,
|
|
92
|
+
sourceAssessments: result?.sourceAssessments ?? [],
|
|
93
|
+
ingestedSourceIds: result?.ingestedSourceIds ?? [],
|
|
94
|
+
skippedUrls: result?.skippedUrls ?? [],
|
|
95
|
+
});
|
|
96
|
+
if (result?.ingestedSourceIds.length) {
|
|
97
|
+
task = await updateRefinementTask(context.store, task, 'applying', 'Linking accepted repair sources into the graph.');
|
|
98
|
+
}
|
|
65
99
|
linkedRepairs += await linkRepairSources(context.store, spaceId, gap, result?.ingestedSourceIds ?? [], result?.query ?? gap.title);
|
|
66
100
|
await markGapRepairAttempt(context.store, gap, spaceId, {
|
|
67
101
|
status: result?.ingestedSourceIds.length ? 'repaired' : 'searched_no_sources',
|
|
68
102
|
reason: result?.reason,
|
|
69
103
|
query: result?.query,
|
|
70
104
|
});
|
|
105
|
+
if (result?.ingestedSourceIds.length) {
|
|
106
|
+
await updateRefinementTask(context.store, task, 'closed', 'Repair sources were accepted and linked to the gap.', {
|
|
107
|
+
ingestedSourceIds: result.ingestedSourceIds,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
blockedGaps += 1;
|
|
112
|
+
await updateRefinementTask(context.store, task, 'blocked', result?.reason ?? 'No acceptable repair sources were found.');
|
|
113
|
+
}
|
|
71
114
|
}
|
|
72
115
|
catch (error) {
|
|
73
116
|
errors.push({ gapId: gap.id, error: error instanceof Error ? error.message : String(error) });
|
|
@@ -75,6 +118,7 @@ export async function runKnowledgeSemanticSelfImprovement(context, input = {}) {
|
|
|
75
118
|
status: 'failed',
|
|
76
119
|
reason: error instanceof Error ? error.message : String(error),
|
|
77
120
|
});
|
|
121
|
+
await updateRefinementTask(context.store, task, 'failed', error instanceof Error ? error.message : String(error));
|
|
78
122
|
}
|
|
79
123
|
finally {
|
|
80
124
|
context.activeGapRepairs.delete(repairKey);
|
|
@@ -89,6 +133,11 @@ export async function runKnowledgeSemanticSelfImprovement(context, input = {}) {
|
|
|
89
133
|
searched,
|
|
90
134
|
ingestedSources,
|
|
91
135
|
linkedRepairs,
|
|
136
|
+
blockedGaps,
|
|
137
|
+
closedGaps,
|
|
138
|
+
queuedTasks,
|
|
139
|
+
taskIds: uniqueStrings(taskIds),
|
|
140
|
+
ingestedSourceIds: uniqueStrings(ingestedSourceIds),
|
|
92
141
|
errors,
|
|
93
142
|
};
|
|
94
143
|
}
|
|
@@ -264,11 +313,11 @@ function classifyGap(context, force) {
|
|
|
264
313
|
const status = readString(context.gap.metadata.repairStatus);
|
|
265
314
|
const nextAttemptAt = readNumber(context.gap.metadata.nextRepairAttemptAt);
|
|
266
315
|
if (!force && status === 'repaired')
|
|
267
|
-
return { action: 'skip', reason: 'Gap already has linked repair sources.' };
|
|
316
|
+
return { action: 'skip', reason: 'Gap already has linked repair sources.', status: 'repaired' };
|
|
268
317
|
if (!force && nextAttemptAt && nextAttemptAt > Date.now())
|
|
269
|
-
return { action: 'skip', reason: 'Gap repair retry window has not elapsed.' };
|
|
318
|
+
return { action: 'skip', reason: 'Gap repair retry window has not elapsed.', status: 'retry_wait', markAttempt: true };
|
|
270
319
|
if (hasRepairEdge(context))
|
|
271
|
-
return { action: 'skip', reason: 'Gap already has a repair source.' };
|
|
320
|
+
return { action: 'skip', reason: 'Gap already has a repair source.', status: 'already_repaired' };
|
|
272
321
|
if (isNotApplicableGap(context))
|
|
273
322
|
return { action: 'suppress', reason: 'The gap is not applicable to the linked subject.' };
|
|
274
323
|
if (!hasConcreteSubject(context)) {
|
|
@@ -279,6 +328,77 @@ function classifyGap(context, force) {
|
|
|
279
328
|
}
|
|
280
329
|
return { action: 'repair' };
|
|
281
330
|
}
|
|
331
|
+
async function upsertRefinementTaskForGap(store, spaceId, context, trigger, state, message, data = {}) {
|
|
332
|
+
const subject = context.linkedObjects[0];
|
|
333
|
+
const id = `kref-${semanticHash(spaceId, context.gap.id, subject?.id ?? 'unscoped')}`;
|
|
334
|
+
const existing = store.getRefinementTask(id);
|
|
335
|
+
const attemptCount = existing?.attemptCount ?? 0;
|
|
336
|
+
return store.upsertRefinementTask({
|
|
337
|
+
id,
|
|
338
|
+
spaceId,
|
|
339
|
+
...(subject ? {
|
|
340
|
+
subjectKind: 'node',
|
|
341
|
+
subjectId: subject.id,
|
|
342
|
+
subjectTitle: subjectTitle(subject),
|
|
343
|
+
subjectType: subject.kind,
|
|
344
|
+
} : {}),
|
|
345
|
+
gapId: context.gap.id,
|
|
346
|
+
state,
|
|
347
|
+
trigger,
|
|
348
|
+
priority: refinementPriority(context.gap),
|
|
349
|
+
budget: {
|
|
350
|
+
maxSearches: 1,
|
|
351
|
+
maxSources: 3,
|
|
352
|
+
maxLlmCalls: 1,
|
|
353
|
+
},
|
|
354
|
+
attemptCount,
|
|
355
|
+
appendTrace: [trace(state, message, data)],
|
|
356
|
+
metadata: semanticMetadata(spaceId, {
|
|
357
|
+
gapTitle: context.gap.title,
|
|
358
|
+
gapKind: readString(context.gap.metadata.gapKind) ?? 'unknown',
|
|
359
|
+
sourceIds: context.sources.map((source) => source.id),
|
|
360
|
+
linkedObjectIds: context.linkedObjects.map((node) => node.id),
|
|
361
|
+
policyVersion: 'knowledge-refinement-v1',
|
|
362
|
+
}),
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
async function updateRefinementTask(store, task, state, message, data = {}) {
|
|
366
|
+
return store.upsertRefinementTask({
|
|
367
|
+
id: task.id,
|
|
368
|
+
spaceId: task.spaceId,
|
|
369
|
+
subjectKind: task.subjectKind,
|
|
370
|
+
subjectId: task.subjectId,
|
|
371
|
+
subjectTitle: task.subjectTitle,
|
|
372
|
+
subjectType: task.subjectType,
|
|
373
|
+
gapId: task.gapId,
|
|
374
|
+
issueId: task.issueId,
|
|
375
|
+
state,
|
|
376
|
+
priority: task.priority,
|
|
377
|
+
trigger: task.trigger,
|
|
378
|
+
budget: task.budget,
|
|
379
|
+
attemptCount: state === 'searching' ? task.attemptCount + 1 : task.attemptCount,
|
|
380
|
+
...(state === 'blocked' || state === 'failed' ? { blockedReason: message } : {}),
|
|
381
|
+
appendTrace: [trace(state, message, data)],
|
|
382
|
+
metadata: task.metadata,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function trace(state, message, data = {}) {
|
|
386
|
+
return {
|
|
387
|
+
at: Date.now(),
|
|
388
|
+
state,
|
|
389
|
+
message,
|
|
390
|
+
...(Object.keys(data).length > 0 ? { data } : {}),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function refinementPriority(gap) {
|
|
394
|
+
const severity = readString(gap.metadata.severity);
|
|
395
|
+
const kind = readString(gap.metadata.gapKind);
|
|
396
|
+
if (severity === 'error')
|
|
397
|
+
return 'urgent';
|
|
398
|
+
if (severity === 'warning' || kind === 'intrinsic_features')
|
|
399
|
+
return 'high';
|
|
400
|
+
return 'normal';
|
|
401
|
+
}
|
|
282
402
|
function hasRepairEdge(context) {
|
|
283
403
|
return context.repairSourceIds.length > 0;
|
|
284
404
|
}
|
|
@@ -39,7 +39,6 @@ export declare class KnowledgeSemanticService {
|
|
|
39
39
|
}>;
|
|
40
40
|
answer(input: KnowledgeSemanticAnswerInput): Promise<KnowledgeSemanticAnswerResult>;
|
|
41
41
|
selfImprove(input?: KnowledgeSemanticSelfImproveInput): Promise<KnowledgeSemanticSelfImproveResult>;
|
|
42
|
-
private
|
|
43
|
-
private hasGapRepairSource;
|
|
42
|
+
private taskIdsForGaps;
|
|
44
43
|
}
|
|
45
44
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/semantic/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAIzD,OAAO,KAAK,EACV,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EACjC,4BAA4B,EAC5B,oBAAoB,EACpB,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,YAAY,CAAC;AAKpB,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,4BAA4B,GAAG,IAAI,CAAC;CAC5D;AAED,qBAAa,wBAAwB;IAIjC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,OAAO;IAJjB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;gBAGnC,KAAK,EAAE,cAAc,EAC9B,OAAO,GAAE,+BAAoC;IAGvD,cAAc,CAAC,WAAW,EAAE,4BAA4B,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;IAO5E,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAO,GAC3E,OAAO,CAA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C,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC/B,GAAG,OAAO,CAAC;QACf,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,MAAM,EAAE,SAAS;YAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAClF,QAAQ,CAAC,eAAe,EAAE,kCAAkC,CAAC;KAC9D,CAAC;IAqCI,MAAM,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAsCnF,WAAW,CAAC,KAAK,GAAE,iCAAsC,GAAG,OAAO,CAAC,kCAAkC,CAAC;IAyB7G,OAAO,CAAC,cAAc;CAOvB"}
|
|
@@ -39,6 +39,7 @@ export class KnowledgeSemanticService {
|
|
|
39
39
|
const allowed = input.sourceIds?.length ? new Set(input.sourceIds) : null;
|
|
40
40
|
const sources = this.store.listSources(10_000)
|
|
41
41
|
.filter((source) => !allowed || allowed.has(source.id))
|
|
42
|
+
.filter((source) => !input.knowledgeSpaceId || getKnowledgeSpaceId(source) === input.knowledgeSpaceId)
|
|
42
43
|
.slice(0, Math.max(1, input.limit ?? 10_000));
|
|
43
44
|
const maxLlmSources = Math.max(0, this.options.maxLlmSourcesPerReindex ?? 3);
|
|
44
45
|
let llmAttempts = 0;
|
|
@@ -75,8 +76,39 @@ export class KnowledgeSemanticService {
|
|
|
75
76
|
}
|
|
76
77
|
async answer(input) {
|
|
77
78
|
await this.store.init();
|
|
78
|
-
|
|
79
|
-
this.
|
|
79
|
+
let answer = await answerKnowledgeQuery({ store: this.store, llm: this.options.llm }, input);
|
|
80
|
+
if (this.options.gapRepairer && answer.answer.gaps.length > 0) {
|
|
81
|
+
const refinement = await this.selfImprove({
|
|
82
|
+
knowledgeSpaceId: answer.spaceId,
|
|
83
|
+
gapIds: answer.answer.gaps.map((gap) => gap.id),
|
|
84
|
+
reason: 'answer',
|
|
85
|
+
limit: Math.max(1, answer.answer.gaps.length),
|
|
86
|
+
});
|
|
87
|
+
if (refinement.ingestedSourceIds.length > 0) {
|
|
88
|
+
const sources = refinement.ingestedSourceIds
|
|
89
|
+
.map((sourceId) => this.store.getSource(sourceId))
|
|
90
|
+
.filter((source) => Boolean(source));
|
|
91
|
+
await this.enrichSources(sources, {
|
|
92
|
+
knowledgeSpaceId: answer.spaceId,
|
|
93
|
+
force: true,
|
|
94
|
+
limit: sources.length,
|
|
95
|
+
});
|
|
96
|
+
answer = await answerKnowledgeQuery({ store: this.store, llm: this.options.llm }, input);
|
|
97
|
+
}
|
|
98
|
+
const taskIds = uniqueStrings([
|
|
99
|
+
...refinement.taskIds,
|
|
100
|
+
...this.taskIdsForGaps(answer.spaceId, answer.answer.gaps.map((gap) => gap.id)),
|
|
101
|
+
]);
|
|
102
|
+
if (taskIds.length > 0) {
|
|
103
|
+
return {
|
|
104
|
+
...answer,
|
|
105
|
+
answer: {
|
|
106
|
+
...answer.answer,
|
|
107
|
+
refinementTaskIds: taskIds,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
80
112
|
return answer;
|
|
81
113
|
}
|
|
82
114
|
async selfImprove(input = {}) {
|
|
@@ -103,58 +135,13 @@ export class KnowledgeSemanticService {
|
|
|
103
135
|
activeGapRepairs: this.activeGapRepairs,
|
|
104
136
|
}, input);
|
|
105
137
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (this.activeGapRepairs.has(repairKey))
|
|
114
|
-
return;
|
|
115
|
-
this.activeGapRepairs.add(repairKey);
|
|
116
|
-
const repairer = this.options.gapRepairer;
|
|
117
|
-
void repairer({
|
|
118
|
-
spaceId: answer.spaceId,
|
|
119
|
-
query: answer.query,
|
|
120
|
-
gaps,
|
|
121
|
-
sources: answer.answer.sources,
|
|
122
|
-
linkedObjects: answer.answer.linkedObjects,
|
|
123
|
-
facts: answer.answer.facts,
|
|
124
|
-
})
|
|
125
|
-
.then(async (result) => {
|
|
126
|
-
if (!result?.ingestedSourceIds.length)
|
|
127
|
-
return;
|
|
128
|
-
for (const sourceId of result.ingestedSourceIds) {
|
|
129
|
-
for (const gap of gaps) {
|
|
130
|
-
await this.store.upsertEdge({
|
|
131
|
-
fromKind: 'source',
|
|
132
|
-
fromId: sourceId,
|
|
133
|
-
toKind: 'node',
|
|
134
|
-
toId: gap.id,
|
|
135
|
-
relation: 'repairs_gap',
|
|
136
|
-
weight: 0.8,
|
|
137
|
-
metadata: {
|
|
138
|
-
semantic: true,
|
|
139
|
-
knowledgeSpaceId: answer.spaceId,
|
|
140
|
-
query: result.query ?? answer.query,
|
|
141
|
-
repairedAt: Date.now(),
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
})
|
|
147
|
-
.catch(() => { })
|
|
148
|
-
.finally(() => {
|
|
149
|
-
this.activeGapRepairs.delete(repairKey);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
hasGapRepairSource(spaceId, gapId) {
|
|
153
|
-
return this.store.listEdges().some((edge) => (edge.relation === 'repairs_gap'
|
|
154
|
-
&& edge.toKind === 'node'
|
|
155
|
-
&& edge.toId === gapId
|
|
156
|
-
&& edge.fromKind === 'source'
|
|
157
|
-
&& readString(edge.metadata.knowledgeSpaceId) === spaceId));
|
|
138
|
+
taskIdsForGaps(spaceId, gapIds) {
|
|
139
|
+
const wanted = new Set(gapIds);
|
|
140
|
+
if (wanted.size === 0)
|
|
141
|
+
return [];
|
|
142
|
+
return this.store.listRefinementTasks(100, { spaceId })
|
|
143
|
+
.filter((task) => task.gapId && wanted.has(task.gapId))
|
|
144
|
+
.map((task) => task.id);
|
|
158
145
|
}
|
|
159
146
|
}
|
|
160
147
|
function sourceCanUseLlmUpgrade(store, source) {
|
|
@@ -176,6 +163,11 @@ function emptySelfImproveResult() {
|
|
|
176
163
|
searched: 0,
|
|
177
164
|
ingestedSources: 0,
|
|
178
165
|
linkedRepairs: 0,
|
|
166
|
+
blockedGaps: 0,
|
|
167
|
+
closedGaps: 0,
|
|
168
|
+
queuedTasks: 0,
|
|
169
|
+
taskIds: [],
|
|
170
|
+
ingestedSourceIds: [],
|
|
179
171
|
errors: [],
|
|
180
172
|
};
|
|
181
173
|
}
|
|
@@ -189,6 +181,11 @@ function mergeSelfImproveResults(left, right) {
|
|
|
189
181
|
searched: left.searched + right.searched,
|
|
190
182
|
ingestedSources: left.ingestedSources + right.ingestedSources,
|
|
191
183
|
linkedRepairs: left.linkedRepairs + right.linkedRepairs,
|
|
184
|
+
blockedGaps: left.blockedGaps + right.blockedGaps,
|
|
185
|
+
closedGaps: left.closedGaps + right.closedGaps,
|
|
186
|
+
queuedTasks: left.queuedTasks + right.queuedTasks,
|
|
187
|
+
taskIds: uniqueStrings([...left.taskIds, ...right.taskIds]),
|
|
188
|
+
ingestedSourceIds: uniqueStrings([...left.ingestedSourceIds, ...right.ingestedSourceIds]),
|
|
192
189
|
errors: [...left.errors, ...right.errors],
|
|
193
190
|
};
|
|
194
191
|
}
|
|
@@ -93,6 +93,7 @@ export interface KnowledgeSemanticAnswer {
|
|
|
93
93
|
readonly linkedObjects: readonly KnowledgeNodeRecord[];
|
|
94
94
|
readonly facts: readonly KnowledgeNodeRecord[];
|
|
95
95
|
readonly gaps: readonly KnowledgeNodeRecord[];
|
|
96
|
+
readonly refinementTaskIds?: readonly string[];
|
|
96
97
|
readonly synthesized: boolean;
|
|
97
98
|
}
|
|
98
99
|
export interface KnowledgeSemanticAnswerResult {
|
|
@@ -122,6 +123,17 @@ export interface KnowledgeSemanticGapRepairResult {
|
|
|
122
123
|
readonly query?: string;
|
|
123
124
|
readonly ingestedSourceIds: readonly string[];
|
|
124
125
|
readonly skippedUrls: readonly string[];
|
|
126
|
+
readonly sourceAssessments?: readonly {
|
|
127
|
+
readonly url: string;
|
|
128
|
+
readonly title?: string;
|
|
129
|
+
readonly domain?: string;
|
|
130
|
+
readonly rank?: number;
|
|
131
|
+
readonly accepted?: boolean;
|
|
132
|
+
readonly confidence: number;
|
|
133
|
+
readonly reasons: readonly string[];
|
|
134
|
+
readonly trustReason?: string;
|
|
135
|
+
readonly rejectionReason?: string;
|
|
136
|
+
}[];
|
|
125
137
|
readonly reason?: string;
|
|
126
138
|
}
|
|
127
139
|
export type KnowledgeSemanticGapRepairer = (request: KnowledgeSemanticGapRepairRequest) => Promise<KnowledgeSemanticGapRepairResult | void>;
|
|
@@ -142,6 +154,11 @@ export interface KnowledgeSemanticSelfImproveResult {
|
|
|
142
154
|
readonly searched: number;
|
|
143
155
|
readonly ingestedSources: number;
|
|
144
156
|
readonly linkedRepairs: number;
|
|
157
|
+
readonly blockedGaps: number;
|
|
158
|
+
readonly closedGaps: number;
|
|
159
|
+
readonly queuedTasks: number;
|
|
160
|
+
readonly taskIds: readonly string[];
|
|
161
|
+
readonly ingestedSourceIds: readonly string[];
|
|
145
162
|
readonly errors: readonly {
|
|
146
163
|
readonly gapId: string;
|
|
147
164
|
readonly error: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/semantic/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,yBAAyB,GACjC,SAAS,GACT,YAAY,GACZ,eAAe,GACf,UAAU,GACV,WAAW,GACX,SAAS,GACT,aAAa,GACb,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,MAAM,CAAC;AAEX,MAAM,WAAW,0BAA0B;IACzC,QAAQ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