@pellux/goodvibes-sdk 0.27.1 → 0.27.2
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 +737 -1
- package/dist/_internal/contracts/generated/foundation-metadata.d.ts +1 -1
- package/dist/_internal/contracts/generated/foundation-metadata.js +1 -1
- package/dist/_internal/contracts/generated/operator-contract.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-contract.js +737 -1
- package/dist/_internal/daemon/knowledge-routes.d.ts.map +1 -1
- package/dist/_internal/daemon/knowledge-routes.js +27 -0
- package/dist/_internal/platform/control-plane/method-catalog-homegraph.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/method-catalog-homegraph.js +31 -1
- package/dist/_internal/platform/control-plane/method-catalog-knowledge.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/method-catalog-knowledge.js +15 -1
- 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 +21 -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 +43 -0
- package/dist/_internal/platform/knowledge/home-graph/extraction-quality.d.ts +2 -0
- package/dist/_internal/platform/knowledge/home-graph/extraction-quality.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/home-graph/extraction-quality.js +52 -0
- package/dist/_internal/platform/knowledge/home-graph/index.d.ts +1 -1
- package/dist/_internal/platform/knowledge/home-graph/index.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/rendering.d.ts +2 -5
- package/dist/_internal/platform/knowledge/home-graph/rendering.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/rendering.js +123 -1
- package/dist/_internal/platform/knowledge/home-graph/search.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/search.js +4 -6
- package/dist/_internal/platform/knowledge/home-graph/service.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/service.js +4 -3
- package/dist/_internal/platform/knowledge/home-graph/types.d.ts +30 -1
- 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/map-filters.d.ts +24 -0
- package/dist/_internal/platform/knowledge/map-filters.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/map-filters.js +199 -0
- package/dist/_internal/platform/knowledge/map.d.ts +16 -1
- package/dist/_internal/platform/knowledge/map.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/map.js +19 -8
- package/dist/_internal/platform/knowledge/service.d.ts +2 -6
- package/dist/_internal/platform/knowledge/service.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/types.d.ts +39 -1
- package/dist/_internal/platform/knowledge/types.d.ts.map +1 -1
- package/dist/_internal/platform/version.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-routes.d.ts","sourceRoot":"","sources":["../../../src/_internal/daemon/knowledge-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAQ3D,OAAO,KAAK,EAEV,2BAA2B,EAM5B,MAAM,4BAA4B,CAAC;AAIpC,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,2BAA2B,GACnC,IAAI,CACL,sBAAsB,EACpB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,uBAAuB,GACvB,6BAA6B,GAC7B,+BAA+B,GAC/B,iBAAiB,GACjB,2BAA2B,GAC3B,yBAAyB,GACzB,mBAAmB,GACnB,wBAAwB,GACxB,uBAAuB,GACvB,qBAAqB,GACrB,oBAAoB,GACpB,wBAAwB,GACxB,8BAA8B,GAC9B,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,GACtB,wBAAwB,GACxB,6BAA6B,GAC7B,iCAAiC,GACjC,8BAA8B,GAC9B,yBAAyB,GACzB,8BAA8B,GAC9B,qBAAqB,GACrB,qBAAqB,GACrB,0BAA0B,GAC1B,8BAA8B,GAC9B,qBAAqB,GACrB,mBAAmB,GACnB,sBAAsB,GACtB,2BAA2B,GAC3B,yBAAyB,GACzB,iCAAiC,GACjC,+BAA+B,GAC/B,oCAAoC,GACpC,yBAAyB,CAC5B,
|
|
1
|
+
{"version":3,"file":"knowledge-routes.d.ts","sourceRoot":"","sources":["../../../src/_internal/daemon/knowledge-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAQ3D,OAAO,KAAK,EAEV,2BAA2B,EAM5B,MAAM,4BAA4B,CAAC;AAIpC,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,2BAA2B,GACnC,IAAI,CACL,sBAAsB,EACpB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,uBAAuB,GACvB,6BAA6B,GAC7B,+BAA+B,GAC/B,iBAAiB,GACjB,2BAA2B,GAC3B,yBAAyB,GACzB,mBAAmB,GACnB,wBAAwB,GACxB,uBAAuB,GACvB,qBAAqB,GACrB,oBAAoB,GACpB,wBAAwB,GACxB,8BAA8B,GAC9B,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,GACtB,wBAAwB,GACxB,6BAA6B,GAC7B,iCAAiC,GACjC,8BAA8B,GAC9B,yBAAyB,GACzB,8BAA8B,GAC9B,qBAAqB,GACrB,qBAAqB,GACrB,0BAA0B,GAC1B,8BAA8B,GAC9B,qBAAqB,GACrB,mBAAmB,GACnB,sBAAsB,GACtB,2BAA2B,GAC3B,yBAAyB,GACzB,iCAAiC,GACjC,+BAA+B,GAC/B,oCAAoC,GACpC,yBAAyB,CAC5B,CAgJA"}
|
|
@@ -33,6 +33,7 @@ export function createDaemonKnowledgeRouteHandlers(context) {
|
|
|
33
33
|
includeSources: readBooleanQuery(url, 'includeSources'),
|
|
34
34
|
includeIssues: readBooleanQuery(url, 'includeIssues'),
|
|
35
35
|
includeGenerated: readBooleanQuery(url, 'includeGenerated'),
|
|
36
|
+
...readKnowledgeMapFilters(url),
|
|
36
37
|
})),
|
|
37
38
|
getKnowledgeGraphqlSchema: () => Response.json({
|
|
38
39
|
language: 'graphql',
|
|
@@ -158,6 +159,32 @@ function readBooleanQuery(url, key) {
|
|
|
158
159
|
return undefined;
|
|
159
160
|
return raw === '1' || raw.toLowerCase() === 'true' || raw.toLowerCase() === 'yes';
|
|
160
161
|
}
|
|
162
|
+
function readKnowledgeMapFilters(url) {
|
|
163
|
+
const minConfidence = Number(url.searchParams.get('minConfidence'));
|
|
164
|
+
return {
|
|
165
|
+
...(url.searchParams.get('query') ? { query: url.searchParams.get('query') } : {}),
|
|
166
|
+
...(Number.isFinite(minConfidence) ? { minConfidence } : {}),
|
|
167
|
+
recordKinds: readStringList(url, 'recordKinds', 'recordKind'),
|
|
168
|
+
ids: readStringList(url, 'ids', 'id'),
|
|
169
|
+
linkedToIds: readStringList(url, 'linkedToIds', 'linkedToId'),
|
|
170
|
+
nodeKinds: readStringList(url, 'nodeKinds', 'nodeKind'),
|
|
171
|
+
sourceTypes: readStringList(url, 'sourceTypes', 'sourceType'),
|
|
172
|
+
sourceStatuses: readStringList(url, 'sourceStatuses', 'sourceStatus'),
|
|
173
|
+
nodeStatuses: readStringList(url, 'nodeStatuses', 'nodeStatus'),
|
|
174
|
+
issueCodes: readStringList(url, 'issueCodes', 'issueCode'),
|
|
175
|
+
issueStatuses: readStringList(url, 'issueStatuses', 'issueStatus'),
|
|
176
|
+
issueSeverities: readStringList(url, 'issueSeverities', 'issueSeverity'),
|
|
177
|
+
edgeRelations: readStringList(url, 'edgeRelations', 'edgeRelation'),
|
|
178
|
+
tags: readStringList(url, 'tags', 'tag'),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function readStringList(url, ...names) {
|
|
182
|
+
return names
|
|
183
|
+
.flatMap((name) => url.searchParams.getAll(name))
|
|
184
|
+
.flatMap((value) => value.split(','))
|
|
185
|
+
.map((value) => value.trim())
|
|
186
|
+
.filter(Boolean);
|
|
187
|
+
}
|
|
161
188
|
function readKnowledgeProjectionRequest(body) {
|
|
162
189
|
const rawKind = typeof body.kind === 'string' ? body.kind.trim().toLowerCase() : '';
|
|
163
190
|
if (rawKind !== 'overview'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-catalog-homegraph.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/method-catalog-homegraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAiE1E,eAAO,MAAM,wCAAwC,EAAE,SAAS,uBAAuB,
|
|
1
|
+
{"version":3,"file":"method-catalog-homegraph.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/method-catalog-homegraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAiE1E,eAAO,MAAM,wCAAwC,EAAE,SAAS,uBAAuB,EAmPtF,CAAC"}
|
|
@@ -212,7 +212,37 @@ export const builtinGatewayHomeGraphMethodDescriptors = [
|
|
|
212
212
|
description: 'Return a visual Home Graph node/edge map with deterministic layout data and SVG.',
|
|
213
213
|
method: 'GET',
|
|
214
214
|
path: '/api/homeassistant/home-graph/map',
|
|
215
|
-
inputSchema: objectSchema({
|
|
215
|
+
inputSchema: objectSchema({
|
|
216
|
+
...SPACE_QUERY_PROPS,
|
|
217
|
+
includeSources: BOOLEAN_SCHEMA,
|
|
218
|
+
includeIssues: BOOLEAN_SCHEMA,
|
|
219
|
+
includeGenerated: BOOLEAN_SCHEMA,
|
|
220
|
+
query: STRING_SCHEMA,
|
|
221
|
+
recordKinds: STRING_LIST_SCHEMA,
|
|
222
|
+
ids: STRING_LIST_SCHEMA,
|
|
223
|
+
linkedToIds: STRING_LIST_SCHEMA,
|
|
224
|
+
nodeKinds: STRING_LIST_SCHEMA,
|
|
225
|
+
sourceTypes: STRING_LIST_SCHEMA,
|
|
226
|
+
sourceStatuses: STRING_LIST_SCHEMA,
|
|
227
|
+
nodeStatuses: STRING_LIST_SCHEMA,
|
|
228
|
+
issueCodes: STRING_LIST_SCHEMA,
|
|
229
|
+
issueStatuses: STRING_LIST_SCHEMA,
|
|
230
|
+
issueSeverities: STRING_LIST_SCHEMA,
|
|
231
|
+
edgeRelations: STRING_LIST_SCHEMA,
|
|
232
|
+
tags: STRING_LIST_SCHEMA,
|
|
233
|
+
minConfidence: NUMBER_SCHEMA,
|
|
234
|
+
ha: objectSchema({
|
|
235
|
+
objectKinds: STRING_LIST_SCHEMA,
|
|
236
|
+
entityIds: STRING_LIST_SCHEMA,
|
|
237
|
+
deviceIds: STRING_LIST_SCHEMA,
|
|
238
|
+
areaIds: STRING_LIST_SCHEMA,
|
|
239
|
+
integrationIds: STRING_LIST_SCHEMA,
|
|
240
|
+
integrationDomains: STRING_LIST_SCHEMA,
|
|
241
|
+
domains: STRING_LIST_SCHEMA,
|
|
242
|
+
deviceClasses: STRING_LIST_SCHEMA,
|
|
243
|
+
labels: STRING_LIST_SCHEMA,
|
|
244
|
+
}),
|
|
245
|
+
}),
|
|
216
246
|
outputSchema: HOME_GRAPH_MAP_OUTPUT_SCHEMA,
|
|
217
247
|
}),
|
|
218
248
|
homeGraphDescriptor({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-catalog-knowledge.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/method-catalog-knowledge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"method-catalog-knowledge.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/method-catalog-knowledge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AA8D1E,eAAO,MAAM,wCAAwC,EAAE,SAAS,uBAAuB,EA6oBtF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EMPTY_OBJECT_SCHEMA, STRING_SCHEMA, BOOLEAN_SCHEMA, NUMBER_SCHEMA, arraySchema, objectSchema, bodyEnvelopeSchema, methodDescriptor, runtimeEventId } from './method-catalog-shared.js';
|
|
2
2
|
import { builtinGatewayHomeGraphMethodDescriptors } from './method-catalog-homegraph.js';
|
|
3
|
-
import { GRAPHQL_VARIABLES_SCHEMA, JSON_RECORD_SCHEMA, METADATA_SCHEMA, } from './operator-contract-schemas-shared.js';
|
|
3
|
+
import { GRAPHQL_VARIABLES_SCHEMA, JSON_RECORD_SCHEMA, METADATA_SCHEMA, STRING_LIST_SCHEMA, } from './operator-contract-schemas-shared.js';
|
|
4
4
|
import { KNOWLEDGE_BATCH_INGEST_RESULT_SCHEMA, KNOWLEDGE_BROWSER_SYNC_RESULT_SCHEMA, KNOWLEDGE_CONSOLIDATION_DECISION_SCHEMA, KNOWLEDGE_CANDIDATE_OUTPUT_SCHEMA, KNOWLEDGE_CANDIDATES_OUTPUT_SCHEMA, KNOWLEDGE_CONNECTOR_INGEST_INPUT_SCHEMA, KNOWLEDGE_CONNECTOR_DOCTOR_OUTPUT_SCHEMA, KNOWLEDGE_CONNECTORS_OUTPUT_SCHEMA, KNOWLEDGE_CONNECTOR_ENTITY_OUTPUT_SCHEMA, KNOWLEDGE_EXTRACTION_OUTPUT_SCHEMA, KNOWLEDGE_EXTRACTIONS_OUTPUT_SCHEMA, KNOWLEDGE_GRAPHQL_EXECUTE_OUTPUT_SCHEMA, KNOWLEDGE_GRAPHQL_SCHEMA_OUTPUT_SCHEMA, KNOWLEDGE_INGEST_RESULT_SCHEMA, KNOWLEDGE_ITEM_ENTITY_OUTPUT_SCHEMA, KNOWLEDGE_JOB_OUTPUT_SCHEMA, KNOWLEDGE_JOB_RUN_OUTPUT_SCHEMA, KNOWLEDGE_JOB_RUN_REQUEST_SCHEMA, KNOWLEDGE_JOB_RUNS_OUTPUT_SCHEMA, KNOWLEDGE_JOBS_OUTPUT_SCHEMA, KNOWLEDGE_LINT_OUTPUT_SCHEMA, KNOWLEDGE_MAP_OUTPUT_SCHEMA, KNOWLEDGE_MATERIALIZED_PROJECTION_SCHEMA, KNOWLEDGE_NODES_OUTPUT_SCHEMA, KNOWLEDGE_PACKET_SCHEMA, KNOWLEDGE_PACKET_DETAIL_SCHEMA, KNOWLEDGE_PROJECTION_BUNDLE_SCHEMA, KNOWLEDGE_PROJECTION_TARGETS_OUTPUT_SCHEMA, KNOWLEDGE_REINDEX_OUTPUT_SCHEMA, KNOWLEDGE_REPORT_OUTPUT_SCHEMA, KNOWLEDGE_REPORTS_OUTPUT_SCHEMA, KNOWLEDGE_SCHEDULE_INPUT_SCHEMA, KNOWLEDGE_SCHEDULE_OUTPUT_SCHEMA, KNOWLEDGE_SCHEDULES_OUTPUT_SCHEMA, KNOWLEDGE_SEARCH_OUTPUT_SCHEMA, KNOWLEDGE_SOURCE_TYPE_SCHEMA, KNOWLEDGE_SOURCES_OUTPUT_SCHEMA, KNOWLEDGE_STATUS_SCHEMA, KNOWLEDGE_ISSUE_REVIEW_OUTPUT_SCHEMA, KNOWLEDGE_ISSUES_OUTPUT_SCHEMA, KNOWLEDGE_USAGE_OUTPUT_SCHEMA, } from './operator-contract-schemas-knowledge.js';
|
|
5
5
|
import { PROJECT_PLANNING_DECISION_OUTPUT_SCHEMA, PROJECT_PLANNING_DECISIONS_OUTPUT_SCHEMA, PROJECT_PLANNING_EVALUATION_SCHEMA, PROJECT_PLANNING_LANGUAGE_OUTPUT_SCHEMA, PROJECT_PLANNING_SPACE_INPUT_SCHEMA, PROJECT_PLANNING_STATE_OUTPUT_SCHEMA, PROJECT_PLANNING_STATUS_SCHEMA, } from './operator-contract-schemas-project-planning.js';
|
|
6
6
|
export const builtinGatewayKnowledgeMethodDescriptors = [
|
|
@@ -485,6 +485,20 @@ export const builtinGatewayKnowledgeMethodDescriptors = [
|
|
|
485
485
|
includeSources: BOOLEAN_SCHEMA,
|
|
486
486
|
includeIssues: BOOLEAN_SCHEMA,
|
|
487
487
|
includeGenerated: BOOLEAN_SCHEMA,
|
|
488
|
+
query: STRING_SCHEMA,
|
|
489
|
+
recordKinds: STRING_LIST_SCHEMA,
|
|
490
|
+
ids: STRING_LIST_SCHEMA,
|
|
491
|
+
linkedToIds: STRING_LIST_SCHEMA,
|
|
492
|
+
nodeKinds: STRING_LIST_SCHEMA,
|
|
493
|
+
sourceTypes: STRING_LIST_SCHEMA,
|
|
494
|
+
sourceStatuses: STRING_LIST_SCHEMA,
|
|
495
|
+
nodeStatuses: STRING_LIST_SCHEMA,
|
|
496
|
+
issueCodes: STRING_LIST_SCHEMA,
|
|
497
|
+
issueStatuses: STRING_LIST_SCHEMA,
|
|
498
|
+
issueSeverities: STRING_LIST_SCHEMA,
|
|
499
|
+
edgeRelations: STRING_LIST_SCHEMA,
|
|
500
|
+
tags: STRING_LIST_SCHEMA,
|
|
501
|
+
minConfidence: NUMBER_SCHEMA,
|
|
488
502
|
}),
|
|
489
503
|
outputSchema: KNOWLEDGE_MAP_OUTPUT_SCHEMA,
|
|
490
504
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-contract-schemas-knowledge.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/operator-contract-schemas-knowledge.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,qCAAqC,yBAA6C,CAAC;AAChG,eAAO,MAAM,iCAAiC,yBAAqC,CAAC;AACpF,eAAO,MAAM,oCAAoC,yBAA4B,CAAC;AAC9E,eAAO,MAAM,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AoC,yBAOE,CAAC;AACpD,eAAO,MAAM,kCAAkC,yBAA6D,CAAC;AAgB7G,eAAO,MAAM,uBAAuB,yBASsE,CAAC;AAsG3G,eAAO,MAAM,kCAAkC,yBAOsB,CAAC;AAEtE,eAAO,MAAM,wCAAwC,yBAMK,CAAC;
|
|
1
|
+
{"version":3,"file":"operator-contract-schemas-knowledge.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/operator-contract-schemas-knowledge.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,qCAAqC,yBAA6C,CAAC;AAChG,eAAO,MAAM,iCAAiC,yBAAqC,CAAC;AACpF,eAAO,MAAM,oCAAoC,yBAA4B,CAAC;AAC9E,eAAO,MAAM,sCAAsC,yBAAqE,CAAC;AACzH,eAAO,MAAM,4BAA4B,yBAWvC,CAAC;AACH,eAAO,MAAM,8BAA8B,yBAAkD,CAAC;AAC9F,eAAO,MAAM,yBAAyB,yBAAuC,CAAC;AAC9E,eAAO,MAAM,2BAA2B,yBAA2D,CAAC;AACpG,eAAO,MAAM,yBAAyB,yBASpC,CAAC;AACH,eAAO,MAAM,uCAAuC,yBAAgD,CAAC;AACrG,eAAO,MAAM,2CAA2C,yBAAmE,CAAC;AAC5H,eAAO,MAAM,6CAA6C,yBAQxD,CAAC;AACH,eAAO,MAAM,wCAAwC,yBAAuC,CAAC;AAwB7F,eAAO,MAAM,oCAAoC;;CAMvC,CAAC;AACX,eAAO,MAAM,+BAA+B;;CAOlC,CAAC;AA6BX,eAAO,MAAM,+BAA+B;;CAUlC,CAAC;AACX,eAAO,MAAM,gCAAgC,yBAIN,CAAC;AACxC,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB1C,CAAC;AACX,eAAO,MAAM,qCAAqC,yBAOM,CAAC;AACzD,eAAO,MAAM,0BAA0B,yBAY4H,CAAC;AACpK,eAAO,MAAM,iCAAiC,yBAGI,CAAC;AAEnD,eAAO,MAAM,uBAAuB,yBAoB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+BAA+B,yBAEjC,CAAC;AAEZ,eAAO,MAAM,iCAAiC,yBAE7B,CAAC;AAElB,eAAO,MAAM,gCAAgC,yBAE7B,CAAC;AAEjB,eAAO,MAAM,0CAA0C,yBAExC,CAAC;AAEhB,eAAO,MAAM,mCAAmC,yBAA6B,CAAC;AAC9E,eAAO,MAAM,wCAAwC,yBAA8D,CAAC;AACpH,eAAO,MAAM,wCAAwC,yBAAyE,CAAC;AAC/H,eAAO,MAAM,mCAAmC,yBAA+D,CAAC;AAChH,eAAO,MAAM,kCAAkC,yBAAgC,CAAC;AAEhF,eAAO,MAAM,6BAA6B,yBAGJ,CAAC;AAEvC,eAAO,MAAM,wBAAwB,yBAW4H,CAAC;AAElK,eAAO,MAAM,6BAA6B,yBAeiF,CAAC;AAE5H,eAAO,MAAM,+BAA+B,yBAOmB,CAAC;AAEhE,eAAO,MAAM,6BAA6B,yBAKmB,CAAC;AAE9D,eAAO,MAAM,4BAA4B,yBAM0C,CAAC;AAEpF,eAAO,MAAM,4BAA4B,yBAA8B,CAAC;AAExE,eAAO,MAAM,gCAAgC,yBAS2E,CAAC;AAEzH,eAAO,MAAM,mCAAmC,yBAQsC,CAAC;AAEvF,eAAO,MAAM,+BAA+B,yBAImB,CAAC;AAEhE,eAAO,MAAM,gCAAgC,yBAImB,CAAC;AAEjE,eAAO,MAAM,+BAA+B,yBAOgD,CAAC;AAE7F,eAAO,MAAM,+BAA+B,yBAMS,CAAC;AAEtD,eAAO,MAAM,+BAA+B,yBAUoG,CAAC;AAEjJ,eAAO,MAAM,+BAA+B,yBAIqB,CAAC"}
|
|
@@ -503,6 +503,24 @@ const KNOWLEDGE_MAP_EDGE_SCHEMA = objectSchema({
|
|
|
503
503
|
weight: NUMBER_SCHEMA,
|
|
504
504
|
metadata: METADATA_SCHEMA,
|
|
505
505
|
}, ['id', 'fromId', 'toId', 'relation', 'weight', 'metadata'], { additionalProperties: true });
|
|
506
|
+
const KNOWLEDGE_MAP_FACET_VALUE_SCHEMA = objectSchema({
|
|
507
|
+
value: STRING_SCHEMA,
|
|
508
|
+
count: NUMBER_SCHEMA,
|
|
509
|
+
label: STRING_SCHEMA,
|
|
510
|
+
}, ['value', 'count'], { additionalProperties: true });
|
|
511
|
+
const KNOWLEDGE_MAP_FACETS_SCHEMA = objectSchema({
|
|
512
|
+
recordKinds: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
513
|
+
nodeKinds: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
514
|
+
sourceTypes: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
515
|
+
sourceStatuses: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
516
|
+
nodeStatuses: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
517
|
+
issueCodes: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
518
|
+
issueStatuses: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
519
|
+
issueSeverities: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
520
|
+
edgeRelations: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
521
|
+
tags: arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA),
|
|
522
|
+
homeAssistant: recordSchema(arraySchema(KNOWLEDGE_MAP_FACET_VALUE_SCHEMA)),
|
|
523
|
+
}, [], { additionalProperties: true });
|
|
506
524
|
export const KNOWLEDGE_MAP_OUTPUT_SCHEMA = objectSchema({
|
|
507
525
|
ok: BOOLEAN_SCHEMA,
|
|
508
526
|
spaceId: STRING_SCHEMA,
|
|
@@ -512,6 +530,9 @@ export const KNOWLEDGE_MAP_OUTPUT_SCHEMA = objectSchema({
|
|
|
512
530
|
height: NUMBER_SCHEMA,
|
|
513
531
|
nodeCount: NUMBER_SCHEMA,
|
|
514
532
|
edgeCount: NUMBER_SCHEMA,
|
|
533
|
+
totalNodeCount: NUMBER_SCHEMA,
|
|
534
|
+
totalEdgeCount: NUMBER_SCHEMA,
|
|
535
|
+
facets: KNOWLEDGE_MAP_FACETS_SCHEMA,
|
|
515
536
|
nodes: arraySchema(KNOWLEDGE_MAP_NODE_SCHEMA),
|
|
516
537
|
edges: arraySchema(KNOWLEDGE_MAP_EDGE_SCHEMA),
|
|
517
538
|
svg: STRING_SCHEMA,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"home-graph-routes.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/daemon/http/home-graph-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,oCAAoC,CAAC;AAc5C,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,aAAa,EAAE,uBAAuB,CAAC;IAChD,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC;IACzE,QAAQ,CAAC,qBAAqB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;IACxF,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,QAAQ,GAAG,IAAI,CAAC;CAC1D;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,qBAAqB;IAErD,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"home-graph-routes.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/daemon/http/home-graph-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,oCAAoC,CAAC;AAc5C,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,aAAa,EAAE,uBAAuB,CAAC;IAChD,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC;IACzE,QAAQ,CAAC,qBAAqB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;IACxF,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,QAAQ,GAAG,IAAI,CAAC;CAC1D;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,qBAAqB;IAErD,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;YA2GtC,KAAK;YAML,QAAQ;YAMR,gBAAgB;CAK/B"}
|
|
@@ -38,9 +38,12 @@ export class HomeGraphRoutes {
|
|
|
38
38
|
const body = req.method === 'POST' ? await this.readOptionalBody(req) : {};
|
|
39
39
|
const result = await this.context.homeGraphService.map({
|
|
40
40
|
...readSpaceFromUrl(url),
|
|
41
|
+
...readMapFiltersFromUrl(url),
|
|
41
42
|
...body,
|
|
42
43
|
limit: readNumber(body.limit) ?? readLimit(url, 500),
|
|
43
44
|
includeSources: readBooleanValue(body.includeSources) ?? readBoolean(url, 'includeSources', true),
|
|
45
|
+
includeIssues: readBooleanValue(body.includeIssues) ?? readBoolean(url, 'includeIssues', false),
|
|
46
|
+
includeGenerated: readBooleanValue(body.includeGenerated) ?? readBoolean(url, 'includeGenerated', true),
|
|
44
47
|
});
|
|
45
48
|
if (url.searchParams.get('format') === 'svg') {
|
|
46
49
|
return new Response(result.svg, {
|
|
@@ -159,3 +162,43 @@ function readBooleanValue(value) {
|
|
|
159
162
|
return undefined;
|
|
160
163
|
return !['0', 'false', 'no', 'off'].includes(value.trim().toLowerCase());
|
|
161
164
|
}
|
|
165
|
+
function readMapFiltersFromUrl(url) {
|
|
166
|
+
const minConfidence = readNumber(url.searchParams.get('minConfidence'));
|
|
167
|
+
return {
|
|
168
|
+
...(url.searchParams.get('query') ? { query: url.searchParams.get('query') } : {}),
|
|
169
|
+
...(minConfidence !== undefined ? { minConfidence } : {}),
|
|
170
|
+
recordKinds: readRecordKinds(url, 'recordKinds', 'recordKind'),
|
|
171
|
+
ids: readList(url, 'ids', 'id'),
|
|
172
|
+
linkedToIds: readList(url, 'linkedToIds', 'linkedToId'),
|
|
173
|
+
nodeKinds: readList(url, 'nodeKinds', 'nodeKind'),
|
|
174
|
+
sourceTypes: readList(url, 'sourceTypes', 'sourceType'),
|
|
175
|
+
sourceStatuses: readList(url, 'sourceStatuses', 'sourceStatus'),
|
|
176
|
+
nodeStatuses: readList(url, 'nodeStatuses', 'nodeStatus'),
|
|
177
|
+
issueCodes: readList(url, 'issueCodes', 'issueCode'),
|
|
178
|
+
issueStatuses: readList(url, 'issueStatuses', 'issueStatus'),
|
|
179
|
+
issueSeverities: readList(url, 'issueSeverities', 'issueSeverity'),
|
|
180
|
+
edgeRelations: readList(url, 'edgeRelations', 'edgeRelation'),
|
|
181
|
+
tags: readList(url, 'tags', 'tag'),
|
|
182
|
+
ha: {
|
|
183
|
+
objectKinds: readList(url, 'haObjectKinds', 'haObjectKind', 'objectKind'),
|
|
184
|
+
entityIds: readList(url, 'entityIds', 'entityId'),
|
|
185
|
+
deviceIds: readList(url, 'deviceIds', 'deviceId'),
|
|
186
|
+
areaIds: readList(url, 'areaIds', 'areaId'),
|
|
187
|
+
integrationIds: readList(url, 'integrationIds', 'integrationId'),
|
|
188
|
+
integrationDomains: readList(url, 'integrationDomains', 'integrationDomain'),
|
|
189
|
+
domains: readList(url, 'domains', 'domain'),
|
|
190
|
+
deviceClasses: readList(url, 'deviceClasses', 'deviceClass'),
|
|
191
|
+
labels: readList(url, 'labels', 'label'),
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function readList(url, ...names) {
|
|
196
|
+
return names
|
|
197
|
+
.flatMap((name) => url.searchParams.getAll(name))
|
|
198
|
+
.flatMap((value) => value.split(','))
|
|
199
|
+
.map((value) => value.trim())
|
|
200
|
+
.filter(Boolean);
|
|
201
|
+
}
|
|
202
|
+
function readRecordKinds(url, ...names) {
|
|
203
|
+
return readList(url, ...names).filter((value) => (value === 'source' || value === 'node' || value === 'issue'));
|
|
204
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extraction-quality.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/extraction-quality.ts"],"names":[],"mappings":"AAAA,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAYpF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export function isUnusableHomeGraphExtractionText(value) {
|
|
2
|
+
const text = value?.trim() ?? '';
|
|
3
|
+
if (!text)
|
|
4
|
+
return true;
|
|
5
|
+
const normalized = text.toLowerCase();
|
|
6
|
+
if (normalized.includes('pdf extraction produced limited text')
|
|
7
|
+
|| normalized.includes('no readable text streams')
|
|
8
|
+
|| normalized.includes('no specialized extractor matched')
|
|
9
|
+
|| normalized.includes('has no specialized in-core extractor')) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (looksLikeRawPdfPayload(text))
|
|
13
|
+
return true;
|
|
14
|
+
return looksBinaryLike(text);
|
|
15
|
+
}
|
|
16
|
+
function looksLikeRawPdfPayload(value) {
|
|
17
|
+
const lower = value.toLowerCase();
|
|
18
|
+
return lower.includes('%pdf')
|
|
19
|
+
|| /\b\d+\s+\d+\s+obj\b/.test(lower)
|
|
20
|
+
|| (lower.includes(' endobj') && lower.includes(' stream'))
|
|
21
|
+
|| (lower.includes('/filter') && lower.includes('/flatedecode'));
|
|
22
|
+
}
|
|
23
|
+
function looksBinaryLike(value) {
|
|
24
|
+
const sample = value.slice(0, 4_096);
|
|
25
|
+
if (sample.length < 120)
|
|
26
|
+
return false;
|
|
27
|
+
let control = 0;
|
|
28
|
+
let extended = 0;
|
|
29
|
+
let letters = 0;
|
|
30
|
+
let whitespace = 0;
|
|
31
|
+
let punctuation = 0;
|
|
32
|
+
for (const char of sample) {
|
|
33
|
+
const code = char.charCodeAt(0);
|
|
34
|
+
if ((code < 32 && char !== '\n' && char !== '\r' && char !== '\t') || code === 65533)
|
|
35
|
+
control += 1;
|
|
36
|
+
if (code > 126)
|
|
37
|
+
extended += 1;
|
|
38
|
+
if (/[a-z0-9]/i.test(char))
|
|
39
|
+
letters += 1;
|
|
40
|
+
if (/\s/.test(char))
|
|
41
|
+
whitespace += 1;
|
|
42
|
+
if (/[^a-z0-9\s]/i.test(char))
|
|
43
|
+
punctuation += 1;
|
|
44
|
+
}
|
|
45
|
+
const length = sample.length;
|
|
46
|
+
const extendedRatio = extended / length;
|
|
47
|
+
const usefulRatio = (letters + whitespace) / length;
|
|
48
|
+
const punctuationRatio = punctuation / length;
|
|
49
|
+
return control > 0
|
|
50
|
+
|| (extendedRatio > 0.18 && usefulRatio < 0.78)
|
|
51
|
+
|| (punctuationRatio > 0.42 && whitespace / length < 0.08);
|
|
52
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { HomeGraphService } from './service.js';
|
|
2
2
|
export { HOME_GRAPH_NODE_KINDS, HOME_GRAPH_RELATIONS, } from './types.js';
|
|
3
|
-
export type { HomeGraphAskInput, HomeGraphAskResult, HomeGraphDevicePassportResult, HomeGraphExport, HomeGraphGeneratedPagesSummary, HomeGraphIngestArtifactInput, HomeGraphIngestNoteInput, HomeGraphIngestResult, HomeGraphIngestUrlInput, HomeGraphKnowledgeTarget, HomeGraphLinkInput, HomeGraphLinkResult, HomeGraphMapEdge, HomeGraphMapInput, HomeGraphMapNode, HomeGraphMapResult, HomeGraphNodeKind, HomeGraphObjectInput, HomeGraphObjectKind, HomeGraphPageAutomationOptions, HomeGraphProjectionInput, HomeGraphProjectionResult, HomeGraphReindexResult, HomeGraphRelation, HomeGraphReviewInput, HomeGraphSnapshotInput, HomeGraphStatus, HomeGraphSyncResult, } from './types.js';
|
|
3
|
+
export type { HomeGraphAskInput, HomeGraphAskResult, HomeGraphDevicePassportResult, HomeGraphExport, HomeGraphGeneratedPagesSummary, HomeGraphIngestArtifactInput, HomeGraphIngestNoteInput, HomeGraphIngestResult, HomeGraphIngestUrlInput, HomeGraphKnowledgeTarget, HomeGraphLinkInput, HomeGraphLinkResult, HomeGraphMapEdge, HomeGraphMapHaFilterInput, HomeGraphMapInput, HomeGraphMapNode, HomeGraphMapResult, HomeGraphNodeKind, HomeGraphObjectInput, HomeGraphObjectKind, HomeGraphPageAutomationOptions, HomeGraphProjectionInput, HomeGraphProjectionResult, HomeGraphReindexResult, HomeGraphRelation, HomeGraphReviewInput, HomeGraphSnapshotInput, HomeGraphStatus, HomeGraphSyncResult, } from './types.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,8BAA8B,EAC9B,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,8BAA8B,EAC9B,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KnowledgeEdgeRecord, KnowledgeIssueRecord, KnowledgeNodeRecord, KnowledgeSourceRecord } from '../types.js';
|
|
2
|
-
import type { HomeGraphMapResult } from './types.js';
|
|
2
|
+
import type { HomeGraphMapInput, HomeGraphMapResult } from './types.js';
|
|
3
3
|
export interface HomeGraphRenderState {
|
|
4
4
|
readonly spaceId: string;
|
|
5
5
|
readonly title: string;
|
|
@@ -23,8 +23,5 @@ export declare function renderPacketPage(state: HomeGraphRenderState, options?:
|
|
|
23
23
|
readonly includeFields?: readonly string[];
|
|
24
24
|
readonly excludeFields?: readonly string[];
|
|
25
25
|
}): string;
|
|
26
|
-
export declare function renderHomeGraphMap(state: HomeGraphRenderState, options?:
|
|
27
|
-
readonly limit?: number;
|
|
28
|
-
readonly includeSources?: boolean;
|
|
29
|
-
}): HomeGraphMapResult;
|
|
26
|
+
export declare function renderHomeGraphMap(state: HomeGraphRenderState, options?: HomeGraphMapInput): HomeGraphMapResult;
|
|
30
27
|
//# sourceMappingURL=rendering.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rendering.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"rendering.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EAEpB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAA6B,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEnG,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAClD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAuCnF;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACjD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C,GAAG,MAAM,CAoBT;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC,GAAG,MAAM,CAkBd;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE,iBAAsB,GAAG,kBAAkB,CAcnH"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { renderKnowledgeMap } from '../map.js';
|
|
2
|
+
import { countFacet, normalizeStringArray, readString } from '../map-filters.js';
|
|
2
3
|
import { edgeIsActive, isGeneratedPageSource } from './helpers.js';
|
|
3
4
|
export function renderRoomPage(state, areaId) {
|
|
4
5
|
const area = areaId
|
|
@@ -77,11 +78,132 @@ export function renderPacketPage(state, options = {}) {
|
|
|
77
78
|
].filter(Boolean).join('\n');
|
|
78
79
|
}
|
|
79
80
|
export function renderHomeGraphMap(state, options = {}) {
|
|
80
|
-
|
|
81
|
+
const filtered = applyHomeGraphMapFilters(state, options.ha);
|
|
82
|
+
const result = renderKnowledgeMap(filtered, {
|
|
81
83
|
...options,
|
|
82
84
|
title: state.title,
|
|
83
85
|
spaceId: state.spaceId,
|
|
84
86
|
});
|
|
87
|
+
return {
|
|
88
|
+
...result,
|
|
89
|
+
facets: {
|
|
90
|
+
...result.facets,
|
|
91
|
+
homeAssistant: buildHomeAssistantMapFacets(state),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function applyHomeGraphMapFilters(state, input) {
|
|
96
|
+
const filters = normalizeHomeGraphMapFilters(input);
|
|
97
|
+
if (!hasHomeGraphFilters(filters))
|
|
98
|
+
return state;
|
|
99
|
+
const nodes = state.nodes.filter((node) => matchesHomeGraphNode(node, state.edges, filters, state.nodes));
|
|
100
|
+
const nodeIds = new Set(nodes.map((node) => node.id));
|
|
101
|
+
const sourceIds = sourceIdsLinkedToNodes(state.edges, nodeIds);
|
|
102
|
+
const sources = state.sources.filter((source) => sourceIds.has(source.id) || matchesHomeGraphSource(source, filters));
|
|
103
|
+
const sourceSet = new Set(sources.map((source) => source.id));
|
|
104
|
+
const issues = state.issues.filter((issue) => ((issue.nodeId && nodeIds.has(issue.nodeId))
|
|
105
|
+
|| (issue.sourceId && sourceSet.has(issue.sourceId))));
|
|
106
|
+
const visibleIds = new Set([...nodeIds, ...sourceSet, ...issues.map((issue) => issue.id)]);
|
|
107
|
+
const edges = state.edges.filter((edge) => visibleIds.has(edge.fromId) && visibleIds.has(edge.toId));
|
|
108
|
+
return { ...state, nodes, sources, issues, edges };
|
|
109
|
+
}
|
|
110
|
+
function buildHomeAssistantMapFacets(state) {
|
|
111
|
+
return {
|
|
112
|
+
objectKinds: countFacet(state.nodes.map((node) => readHomeAssistantRecord(node).objectKind ?? node.kind)),
|
|
113
|
+
entityIds: countFacet(state.nodes.map((node) => readHomeAssistantRecord(node).entityId)),
|
|
114
|
+
deviceIds: countFacet(state.nodes.map((node) => readHomeAssistantRecord(node).deviceId)),
|
|
115
|
+
areaIds: countFacet(state.nodes.map((node) => readHomeAssistantRecord(node).areaId)),
|
|
116
|
+
integrationIds: countFacet(state.nodes.map((node) => readHomeAssistantRecord(node).integrationId)),
|
|
117
|
+
integrationDomains: countFacet(state.nodes.map((node) => readIntegrationDomain(node))),
|
|
118
|
+
domains: countFacet(state.nodes.map((node) => readEntityDomain(node))),
|
|
119
|
+
deviceClasses: countFacet(state.nodes.map((node) => readDeviceClass(node))),
|
|
120
|
+
labels: countFacet(state.nodes.flatMap((node) => normalizeStringArray(node.metadata.labels))),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function normalizeHomeGraphMapFilters(input) {
|
|
124
|
+
return {
|
|
125
|
+
objectKinds: normalizeStringArray(input?.objectKinds),
|
|
126
|
+
entityIds: normalizeStringArray(input?.entityIds),
|
|
127
|
+
deviceIds: normalizeStringArray(input?.deviceIds),
|
|
128
|
+
areaIds: normalizeStringArray(input?.areaIds),
|
|
129
|
+
integrationIds: normalizeStringArray(input?.integrationIds),
|
|
130
|
+
integrationDomains: normalizeStringArray(input?.integrationDomains),
|
|
131
|
+
domains: normalizeStringArray(input?.domains),
|
|
132
|
+
deviceClasses: normalizeStringArray(input?.deviceClasses),
|
|
133
|
+
labels: normalizeStringArray(input?.labels),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function hasHomeGraphFilters(filters) {
|
|
137
|
+
return Object.values(filters).some((value) => value.length > 0);
|
|
138
|
+
}
|
|
139
|
+
function matchesHomeGraphNode(node, edges, filters, nodes) {
|
|
140
|
+
const ha = readHomeAssistantRecord(node);
|
|
141
|
+
return matchesFilter(filters.objectKinds, String(ha.objectKind ?? node.kind), node.kind)
|
|
142
|
+
&& matchesFilter(filters.entityIds, readString(ha.entityId), readString(ha.objectId))
|
|
143
|
+
&& matchesFilter(filters.deviceIds, readString(ha.deviceId), node.kind === 'ha_device' ? readString(ha.objectId) : undefined)
|
|
144
|
+
&& matchesAreaFilter(filters.areaIds, node, edges, nodes)
|
|
145
|
+
&& matchesFilter(filters.integrationIds, readString(ha.integrationId), node.kind === 'ha_integration' ? readString(ha.objectId) : undefined)
|
|
146
|
+
&& matchesFilter(filters.integrationDomains, readIntegrationDomain(node))
|
|
147
|
+
&& matchesFilter(filters.domains, readEntityDomain(node))
|
|
148
|
+
&& matchesFilter(filters.deviceClasses, readDeviceClass(node))
|
|
149
|
+
&& matchesAny(filters.labels, normalizeStringArray(node.metadata.labels));
|
|
150
|
+
}
|
|
151
|
+
function matchesHomeGraphSource(source, filters) {
|
|
152
|
+
return matchesAny(filters.labels, [...source.tags, ...normalizeStringArray(source.metadata.labels)]);
|
|
153
|
+
}
|
|
154
|
+
function matchesAreaFilter(areaIds, node, edges, nodes) {
|
|
155
|
+
if (areaIds.length === 0)
|
|
156
|
+
return true;
|
|
157
|
+
const ha = readHomeAssistantRecord(node);
|
|
158
|
+
if (matchesFilter(areaIds, readString(ha.areaId), node.kind === 'ha_area' || node.kind === 'ha_room' ? readString(ha.objectId) : undefined)) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
const targetAreaNodeIds = new Set(nodes
|
|
162
|
+
.filter((candidate) => (candidate.kind === 'ha_area' || candidate.kind === 'ha_room')
|
|
163
|
+
&& matchesFilter(areaIds, readString(readHomeAssistantRecord(candidate).objectId), readString(readHomeAssistantRecord(candidate).areaId)))
|
|
164
|
+
.map((candidate) => candidate.id));
|
|
165
|
+
return edges.some((edge) => edgeIsActive(edge)
|
|
166
|
+
&& edge.fromId === node.id
|
|
167
|
+
&& edge.relation === 'located_in'
|
|
168
|
+
&& targetAreaNodeIds.has(edge.toId));
|
|
169
|
+
}
|
|
170
|
+
function sourceIdsLinkedToNodes(edges, nodeIds) {
|
|
171
|
+
const sourceIds = new Set();
|
|
172
|
+
for (const edge of edges) {
|
|
173
|
+
if (edge.fromKind === 'source' && edge.toKind === 'node' && nodeIds.has(edge.toId))
|
|
174
|
+
sourceIds.add(edge.fromId);
|
|
175
|
+
if (edge.fromKind === 'node' && nodeIds.has(edge.fromId) && edge.toKind === 'source')
|
|
176
|
+
sourceIds.add(edge.toId);
|
|
177
|
+
}
|
|
178
|
+
return sourceIds;
|
|
179
|
+
}
|
|
180
|
+
function readHomeAssistantRecord(node) {
|
|
181
|
+
const value = node.metadata.homeAssistant;
|
|
182
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
183
|
+
}
|
|
184
|
+
function readIntegrationDomain(node) {
|
|
185
|
+
const ha = readHomeAssistantRecord(node);
|
|
186
|
+
return readString(ha.integrationId)
|
|
187
|
+
?? readString(node.metadata.integrationDomain)
|
|
188
|
+
?? readString(node.metadata.platform)
|
|
189
|
+
?? readString(node.metadata.domain);
|
|
190
|
+
}
|
|
191
|
+
function readEntityDomain(node) {
|
|
192
|
+
const entityId = readString(readHomeAssistantRecord(node).entityId);
|
|
193
|
+
const fromEntity = entityId?.includes('.') ? entityId.split('.')[0] : undefined;
|
|
194
|
+
return fromEntity ?? readString(node.metadata.domain);
|
|
195
|
+
}
|
|
196
|
+
function readDeviceClass(node) {
|
|
197
|
+
const attributes = node.metadata.attributes && typeof node.metadata.attributes === 'object' && !Array.isArray(node.metadata.attributes)
|
|
198
|
+
? node.metadata.attributes
|
|
199
|
+
: {};
|
|
200
|
+
return readString(node.metadata.deviceClass) ?? readString(node.metadata.device_class) ?? readString(attributes.device_class);
|
|
201
|
+
}
|
|
202
|
+
function matchesFilter(allowed, ...values) {
|
|
203
|
+
return allowed.length === 0 || values.some((value) => value !== undefined && allowed.includes(value));
|
|
204
|
+
}
|
|
205
|
+
function matchesAny(allowed, values) {
|
|
206
|
+
return allowed.length === 0 || values.some((value) => allowed.includes(value));
|
|
85
207
|
}
|
|
86
208
|
function renderNodeList(title, nodes) {
|
|
87
209
|
if (nodes.length === 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAqGxD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;CAC/E;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,oBAAoB,CAuBrG;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,SAAS,qBAAqB,EAAE,EACzC,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,yBAAyB,GAAG,IAAI,GAAG,SAAS,EACxF,KAAK,EAAE,MAAM,GACZ,qBAAqB,EAAE,CAmFzB;AAED,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,SAAS,qBAAqB,EAAE,EACzC,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,yBAAyB,GAAG,IAAI,GAAG,SAAS,EACxF,KAAK,EAAE,MAAM,GACZ,qBAAqB,EAAE,CAoCzB;AAwMD,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,yBAAyB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAWhH"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { belongsToSpace, edgeIsActive, isGeneratedPageSource, readRecord } from './helpers.js';
|
|
2
|
+
import { isUnusableHomeGraphExtractionText } from './extraction-quality.js';
|
|
2
3
|
const MAX_FIELD_CHARS = 4_096;
|
|
3
4
|
const MAX_SECTION_COUNT = 32;
|
|
4
5
|
const MAX_SEARCH_TEXT_CHARS = 64 * 1024;
|
|
@@ -258,12 +259,13 @@ function readSearchText(extraction) {
|
|
|
258
259
|
return undefined;
|
|
259
260
|
const structure = readRecord(extraction.structure);
|
|
260
261
|
const metadata = readRecord(extraction.metadata);
|
|
261
|
-
|
|
262
|
+
const text = firstBoundedText([
|
|
262
263
|
structure.searchText,
|
|
263
264
|
structure.text,
|
|
264
265
|
structure.content,
|
|
265
266
|
metadata.searchText,
|
|
266
267
|
], MAX_SEARCH_TEXT_CHARS);
|
|
268
|
+
return isUnusableHomeGraphExtractionText(text) ? undefined : text;
|
|
267
269
|
}
|
|
268
270
|
function readNodeMetadataText(node) {
|
|
269
271
|
const homeAssistant = readRecord(node.metadata.homeAssistant);
|
|
@@ -520,11 +522,7 @@ function usefulExtractionSummary(extraction) {
|
|
|
520
522
|
return summary && !isLowInformationExtractionText(summary) ? summary : undefined;
|
|
521
523
|
}
|
|
522
524
|
function isLowInformationExtractionText(value) {
|
|
523
|
-
|
|
524
|
-
return normalized.includes('pdf extraction produced limited text')
|
|
525
|
-
|| normalized.includes('no readable text streams')
|
|
526
|
-
|| normalized.includes('no specialized extractor matched')
|
|
527
|
-
|| normalized.includes('has no specialized in-core extractor');
|
|
525
|
+
return isUnusableHomeGraphExtractionText(value);
|
|
528
526
|
}
|
|
529
527
|
function sentenceChunks(value) {
|
|
530
528
|
const text = cleanWhitespace(value ?? '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EAEnB,oBAAoB,EACpB,mBAAmB,EAEnB,qBAAqB,EAEtB,MAAM,aAAa,CAAC;AAmBrB,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EAEnB,oBAAoB,EACpB,mBAAmB,EAEnB,qBAAqB,EAEtB,MAAM,aAAa,CAAC;AAmBrB,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAwB9E,OAAO,KAAK,EACV,iBAAiB,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,eAAe,EACrF,4BAA4B,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,uBAAuB,EAC5E,kBAAkB,E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AAE,CAAC;QACnD,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;KAClD,CAAC;IAeI,GAAG,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAS/D,WAAW,CAAC,KAAK,GAAE,mBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC;IAiBtE,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC;QAC1F,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;QAClB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE;YAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;KACxJ,CAAC;YA+BY,qBAAqB;YA0CrB,eAAe;YAgCf,cAAc;YAmBd,qBAAqB;YAkDrB,2BAA2B;YAiB3B,WAAW;YAoBX,oBAAoB;IAIlC,OAAO,CAAC,iBAAiB;YAcX,YAAY;CAkC3B"}
|
|
@@ -7,6 +7,7 @@ import { collectLinkedObjects, inferHomeGraphSourceType, readHomeGraphState, ren
|
|
|
7
7
|
import { renderHomeGraphMap } from './rendering.js';
|
|
8
8
|
import { generateAutomaticHomeGraphPages, generateHomeGraphPacket, generateHomeGraphRoomPage, refreshHomeGraphDevicePassport, } from './generated-pages.js';
|
|
9
9
|
import { reindexHomeGraphSources } from './reindex.js';
|
|
10
|
+
import { isUnusableHomeGraphExtractionText } from './extraction-quality.js';
|
|
10
11
|
import { readHomeGraphSearchState, scoreHomeGraphResults, selectHomeGraphExtractionRepairCandidates, } from './search.js';
|
|
11
12
|
import { resolveReadableHomeGraphSpace } from './space-selection.js';
|
|
12
13
|
import { HOME_GRAPH_CAPABILITIES } from './types.js';
|
|
@@ -323,8 +324,8 @@ export class HomeGraphService {
|
|
|
323
324
|
await this.store.init();
|
|
324
325
|
const { spaceId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
325
326
|
return renderHomeGraphMap(renderHomeGraphState(this.store, spaceId, 'Home Graph Map'), {
|
|
326
|
-
|
|
327
|
-
|
|
327
|
+
...input,
|
|
328
|
+
knowledgeSpaceId: spaceId,
|
|
328
329
|
});
|
|
329
330
|
}
|
|
330
331
|
async exportSpace(input = {}) {
|
|
@@ -565,5 +566,5 @@ export class HomeGraphService {
|
|
|
565
566
|
}
|
|
566
567
|
function extractionHasSearchableText(extraction) {
|
|
567
568
|
const structure = readRecord(extraction.structure);
|
|
568
|
-
return typeof structure.searchText === 'string' && structure.searchText
|
|
569
|
+
return typeof structure.searchText === 'string' && !isUnusableHomeGraphExtractionText(structure.searchText);
|
|
569
570
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KnowledgeEdgeRecord, KnowledgeExtractionRecord, KnowledgeIssueRecord, KnowledgeMapEdge, KnowledgeMapNode, KnowledgeMapResult, KnowledgeNodeRecord, KnowledgeSourceRecord } from '../types.js';
|
|
1
|
+
import type { KnowledgeEdgeRecord, KnowledgeExtractionRecord, KnowledgeIssueRecord, KnowledgeMapFilterInput, KnowledgeMapEdge, KnowledgeMapNode, KnowledgeMapResult, KnowledgeNodeRecord, KnowledgeSourceRecord } from '../types.js';
|
|
2
2
|
export declare const HOME_GRAPH_NODE_KINDS: readonly ["ha_home", "ha_entity", "ha_device", "ha_area", "ha_automation", "ha_script", "ha_scene", "ha_label", "ha_integration", "ha_room", "ha_device_passport", "ha_maintenance_item", "ha_troubleshooting_case", "ha_purchase", "ha_network_node"];
|
|
3
3
|
export type HomeGraphNodeKind = typeof HOME_GRAPH_NODE_KINDS[number];
|
|
4
4
|
export declare const HOME_GRAPH_RELATIONS: readonly ["controls", "located_in", "belongs_to_device", "has_manual", "has_receipt", "has_warranty", "has_issue", "fixed_by", "uses_battery", "connected_via", "part_of_network", "mentioned_by", "source_for"];
|
|
@@ -169,6 +169,35 @@ export interface HomeGraphAskResult {
|
|
|
169
169
|
export interface HomeGraphMapInput extends HomeGraphSpaceInput {
|
|
170
170
|
readonly limit?: number;
|
|
171
171
|
readonly includeSources?: boolean;
|
|
172
|
+
readonly includeIssues?: boolean;
|
|
173
|
+
readonly includeGenerated?: boolean;
|
|
174
|
+
readonly filters?: KnowledgeMapFilterInput;
|
|
175
|
+
readonly query?: string;
|
|
176
|
+
readonly recordKinds?: readonly ('source' | 'node' | 'issue')[];
|
|
177
|
+
readonly ids?: readonly string[];
|
|
178
|
+
readonly linkedToIds?: readonly string[];
|
|
179
|
+
readonly nodeKinds?: readonly string[];
|
|
180
|
+
readonly sourceTypes?: readonly string[];
|
|
181
|
+
readonly sourceStatuses?: readonly string[];
|
|
182
|
+
readonly nodeStatuses?: readonly string[];
|
|
183
|
+
readonly issueCodes?: readonly string[];
|
|
184
|
+
readonly issueStatuses?: readonly string[];
|
|
185
|
+
readonly issueSeverities?: readonly string[];
|
|
186
|
+
readonly edgeRelations?: readonly string[];
|
|
187
|
+
readonly tags?: readonly string[];
|
|
188
|
+
readonly minConfidence?: number;
|
|
189
|
+
readonly ha?: HomeGraphMapHaFilterInput;
|
|
190
|
+
}
|
|
191
|
+
export interface HomeGraphMapHaFilterInput {
|
|
192
|
+
readonly objectKinds?: readonly string[];
|
|
193
|
+
readonly entityIds?: readonly string[];
|
|
194
|
+
readonly deviceIds?: readonly string[];
|
|
195
|
+
readonly areaIds?: readonly string[];
|
|
196
|
+
readonly integrationIds?: readonly string[];
|
|
197
|
+
readonly integrationDomains?: readonly string[];
|
|
198
|
+
readonly domains?: readonly string[];
|
|
199
|
+
readonly deviceClasses?: readonly string[];
|
|
200
|
+
readonly labels?: readonly string[];
|
|
172
201
|
}
|
|
173
202
|
export type HomeGraphMapNode = KnowledgeMapNode;
|
|
174
203
|
export type HomeGraphMapEdge = KnowledgeMapEdge;
|