@pellux/goodvibes-sdk 0.27.0 → 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.
Files changed (43) hide show
  1. package/dist/_internal/contracts/artifacts/operator-contract.json +737 -1
  2. package/dist/_internal/contracts/generated/foundation-metadata.d.ts +1 -1
  3. package/dist/_internal/contracts/generated/foundation-metadata.js +1 -1
  4. package/dist/_internal/contracts/generated/operator-contract.d.ts.map +1 -1
  5. package/dist/_internal/contracts/generated/operator-contract.js +737 -1
  6. package/dist/_internal/daemon/knowledge-routes.d.ts.map +1 -1
  7. package/dist/_internal/daemon/knowledge-routes.js +27 -0
  8. package/dist/_internal/platform/control-plane/method-catalog-homegraph.d.ts.map +1 -1
  9. package/dist/_internal/platform/control-plane/method-catalog-homegraph.js +31 -1
  10. package/dist/_internal/platform/control-plane/method-catalog-knowledge.d.ts.map +1 -1
  11. package/dist/_internal/platform/control-plane/method-catalog-knowledge.js +15 -1
  12. package/dist/_internal/platform/control-plane/operator-contract-schemas-knowledge.d.ts.map +1 -1
  13. package/dist/_internal/platform/control-plane/operator-contract-schemas-knowledge.js +21 -0
  14. package/dist/_internal/platform/daemon/http/home-graph-routes.d.ts.map +1 -1
  15. package/dist/_internal/platform/daemon/http/home-graph-routes.js +82 -22
  16. package/dist/_internal/platform/knowledge/home-graph/extraction-quality.d.ts +2 -0
  17. package/dist/_internal/platform/knowledge/home-graph/extraction-quality.d.ts.map +1 -0
  18. package/dist/_internal/platform/knowledge/home-graph/extraction-quality.js +52 -0
  19. package/dist/_internal/platform/knowledge/home-graph/index.d.ts +1 -1
  20. package/dist/_internal/platform/knowledge/home-graph/index.d.ts.map +1 -1
  21. package/dist/_internal/platform/knowledge/home-graph/rendering.d.ts +2 -5
  22. package/dist/_internal/platform/knowledge/home-graph/rendering.d.ts.map +1 -1
  23. package/dist/_internal/platform/knowledge/home-graph/rendering.js +123 -1
  24. package/dist/_internal/platform/knowledge/home-graph/search.d.ts.map +1 -1
  25. package/dist/_internal/platform/knowledge/home-graph/search.js +60 -18
  26. package/dist/_internal/platform/knowledge/home-graph/service.d.ts.map +1 -1
  27. package/dist/_internal/platform/knowledge/home-graph/service.js +4 -3
  28. package/dist/_internal/platform/knowledge/home-graph/types.d.ts +30 -1
  29. package/dist/_internal/platform/knowledge/home-graph/types.d.ts.map +1 -1
  30. package/dist/_internal/platform/knowledge/index.d.ts +1 -1
  31. package/dist/_internal/platform/knowledge/index.d.ts.map +1 -1
  32. package/dist/_internal/platform/knowledge/map-filters.d.ts +24 -0
  33. package/dist/_internal/platform/knowledge/map-filters.d.ts.map +1 -0
  34. package/dist/_internal/platform/knowledge/map-filters.js +199 -0
  35. package/dist/_internal/platform/knowledge/map.d.ts +16 -1
  36. package/dist/_internal/platform/knowledge/map.d.ts.map +1 -1
  37. package/dist/_internal/platform/knowledge/map.js +19 -8
  38. package/dist/_internal/platform/knowledge/service.d.ts +2 -6
  39. package/dist/_internal/platform/knowledge/service.d.ts.map +1 -1
  40. package/dist/_internal/platform/knowledge/types.d.ts +39 -1
  41. package/dist/_internal/platform/knowledge/types.d.ts.map +1 -1
  42. package/dist/_internal/platform/version.js +1 -1
  43. 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,CA+IA"}
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,EAqNtF,CAAC"}
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({ ...SPACE_QUERY_PROPS, includeSources: BOOLEAN_SCHEMA }),
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;AA6D1E,eAAO,MAAM,wCAAwC,EAAE,SAAS,uBAAuB,EA+nBtF,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,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,uCAAu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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,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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"}
@@ -6,13 +6,14 @@ export class HomeGraphRoutes {
6
6
  }
7
7
  async handle(req) {
8
8
  const url = new URL(req.url);
9
- if (!url.pathname.startsWith('/api/homeassistant/home-graph'))
9
+ const pathname = normalizeHomeGraphPath(url.pathname);
10
+ if (!pathname.startsWith('/api/homeassistant/home-graph'))
10
11
  return null;
11
12
  try {
12
- if (url.pathname === '/api/homeassistant/home-graph/status' && req.method === 'GET') {
13
+ if (pathname === '/api/homeassistant/home-graph/status' && req.method === 'GET') {
13
14
  return Response.json(await this.context.homeGraphService.status(readSpaceFromUrl(url)));
14
15
  }
15
- if (url.pathname === '/api/homeassistant/home-graph/issues' && req.method === 'GET') {
16
+ if (pathname === '/api/homeassistant/home-graph/issues' && req.method === 'GET') {
16
17
  return Response.json(await this.context.homeGraphService.listIssues({
17
18
  ...readSpaceFromUrl(url),
18
19
  status: url.searchParams.get('status') ?? undefined,
@@ -21,23 +22,28 @@ export class HomeGraphRoutes {
21
22
  limit: readLimit(url, 100),
22
23
  }));
23
24
  }
24
- if (url.pathname === '/api/homeassistant/home-graph/sources' && req.method === 'GET') {
25
+ if (pathname === '/api/homeassistant/home-graph/sources' && req.method === 'GET') {
25
26
  return Response.json(await this.context.homeGraphService.listSources({
26
27
  ...readSpaceFromUrl(url),
27
28
  limit: readLimit(url, 100),
28
29
  }));
29
30
  }
30
- if (url.pathname === '/api/homeassistant/home-graph/browse' && req.method === 'GET') {
31
+ if (pathname === '/api/homeassistant/home-graph/browse' && req.method === 'GET') {
31
32
  return Response.json(await this.context.homeGraphService.browse({
32
33
  ...readSpaceFromUrl(url),
33
34
  limit: readLimit(url, 250),
34
35
  }));
35
36
  }
36
- if (url.pathname === '/api/homeassistant/home-graph/map' && req.method === 'GET') {
37
+ if (pathname === '/api/homeassistant/home-graph/map' && (req.method === 'GET' || req.method === 'POST')) {
38
+ const body = req.method === 'POST' ? await this.readOptionalBody(req) : {};
37
39
  const result = await this.context.homeGraphService.map({
38
40
  ...readSpaceFromUrl(url),
39
- limit: readLimit(url, 500),
40
- includeSources: readBoolean(url, 'includeSources', true),
41
+ ...readMapFiltersFromUrl(url),
42
+ ...body,
43
+ limit: readNumber(body.limit) ?? readLimit(url, 500),
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),
41
47
  });
42
48
  if (url.searchParams.get('format') === 'svg') {
43
49
  return new Response(result.svg, {
@@ -48,25 +54,25 @@ export class HomeGraphRoutes {
48
54
  }
49
55
  return Response.json(result);
50
56
  }
51
- if (url.pathname === '/api/homeassistant/home-graph/export' && req.method === 'POST') {
57
+ if (pathname === '/api/homeassistant/home-graph/export' && req.method === 'POST') {
52
58
  return Response.json(await this.context.homeGraphService.exportSpace(await this.readOptionalBody(req)));
53
59
  }
54
- if (url.pathname === '/api/homeassistant/home-graph/ask' && req.method === 'POST') {
60
+ if (pathname === '/api/homeassistant/home-graph/ask' && req.method === 'POST') {
55
61
  return Response.json(await this.context.homeGraphService.ask(await this.readBody(req)));
56
62
  }
57
- if (url.pathname === '/api/homeassistant/home-graph/reindex' && req.method === 'POST') {
63
+ if (pathname === '/api/homeassistant/home-graph/reindex' && req.method === 'POST') {
58
64
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.reindex(await this.readOptionalBody(req))));
59
65
  }
60
- if (url.pathname === '/api/homeassistant/home-graph/sync' && req.method === 'POST') {
66
+ if (pathname === '/api/homeassistant/home-graph/sync' && req.method === 'POST') {
61
67
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.syncSnapshot(await this.readBody(req))));
62
68
  }
63
- if (url.pathname === '/api/homeassistant/home-graph/ingest/url' && req.method === 'POST') {
69
+ if (pathname === '/api/homeassistant/home-graph/ingest/url' && req.method === 'POST') {
64
70
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.ingestUrl(await this.readBody(req))));
65
71
  }
66
- if (url.pathname === '/api/homeassistant/home-graph/ingest/note' && req.method === 'POST') {
72
+ if (pathname === '/api/homeassistant/home-graph/ingest/note' && req.method === 'POST') {
67
73
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.ingestNote(await this.readBody(req))));
68
74
  }
69
- if (url.pathname === '/api/homeassistant/home-graph/ingest/artifact' && req.method === 'POST') {
75
+ if (pathname === '/api/homeassistant/home-graph/ingest/artifact' && req.method === 'POST') {
70
76
  return await this.admin(req, async () => {
71
77
  if (isArtifactUploadRequest(req)) {
72
78
  const uploaded = await createArtifactFromUploadRequest(this.context.artifactStore, req);
@@ -80,25 +86,25 @@ export class HomeGraphRoutes {
80
86
  return Response.json(await this.context.homeGraphService.ingestArtifact(await this.readBody(req)));
81
87
  });
82
88
  }
83
- if (url.pathname === '/api/homeassistant/home-graph/link' && req.method === 'POST') {
89
+ if (pathname === '/api/homeassistant/home-graph/link' && req.method === 'POST') {
84
90
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.linkKnowledge(await this.readBody(req))));
85
91
  }
86
- if (url.pathname === '/api/homeassistant/home-graph/unlink' && req.method === 'POST') {
92
+ if (pathname === '/api/homeassistant/home-graph/unlink' && req.method === 'POST') {
87
93
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.unlinkKnowledge(await this.readBody(req))));
88
94
  }
89
- if (url.pathname === '/api/homeassistant/home-graph/device-passport' && req.method === 'POST') {
95
+ if (pathname === '/api/homeassistant/home-graph/device-passport' && req.method === 'POST') {
90
96
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.refreshDevicePassport(await this.readBody(req))));
91
97
  }
92
- if (url.pathname === '/api/homeassistant/home-graph/room-page' && req.method === 'POST') {
98
+ if (pathname === '/api/homeassistant/home-graph/room-page' && req.method === 'POST') {
93
99
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.generateRoomPage(await this.readBody(req))));
94
100
  }
95
- if (url.pathname === '/api/homeassistant/home-graph/packet' && req.method === 'POST') {
101
+ if (pathname === '/api/homeassistant/home-graph/packet' && req.method === 'POST') {
96
102
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.generatePacket(await this.readBody(req))));
97
103
  }
98
- if (url.pathname === '/api/homeassistant/home-graph/facts/review' && req.method === 'POST') {
104
+ if (pathname === '/api/homeassistant/home-graph/facts/review' && req.method === 'POST') {
99
105
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.reviewFact(await this.readBody(req))));
100
106
  }
101
- if (url.pathname === '/api/homeassistant/home-graph/import' && req.method === 'POST') {
107
+ if (pathname === '/api/homeassistant/home-graph/import' && req.method === 'POST') {
102
108
  return await this.admin(req, async () => Response.json(await this.context.homeGraphService.importSpace(await this.readBody(req))));
103
109
  }
104
110
  return Response.json({ error: 'Unknown Home Graph route' }, { status: 404 });
@@ -126,6 +132,9 @@ export class HomeGraphRoutes {
126
132
  return body ?? {};
127
133
  }
128
134
  }
135
+ function normalizeHomeGraphPath(pathname) {
136
+ return pathname.length > 1 ? pathname.replace(/\/+$/g, '') : pathname;
137
+ }
129
138
  function readSpaceFromUrl(url) {
130
139
  return {
131
140
  ...(url.searchParams.get('installationId') ? { installationId: url.searchParams.get('installationId') } : {}),
@@ -142,3 +151,54 @@ function readBoolean(url, key, fallback) {
142
151
  return fallback;
143
152
  return !['0', 'false', 'no', 'off'].includes(value.trim().toLowerCase());
144
153
  }
154
+ function readNumber(value) {
155
+ const parsed = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : NaN;
156
+ return Number.isFinite(parsed) ? Math.max(1, Math.trunc(parsed)) : undefined;
157
+ }
158
+ function readBooleanValue(value) {
159
+ if (typeof value === 'boolean')
160
+ return value;
161
+ if (typeof value !== 'string')
162
+ return undefined;
163
+ return !['0', 'false', 'no', 'off'].includes(value.trim().toLowerCase());
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,2 @@
1
+ export declare function isUnusableHomeGraphExtractionText(value: string | undefined): boolean;
2
+ //# sourceMappingURL=extraction-quality.d.ts.map
@@ -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,EACpB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;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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
- return renderKnowledgeMap(state, {
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;AAErB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAA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