@pellux/goodvibes-sdk 0.28.16 → 0.28.18

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 (70) hide show
  1. package/dist/_internal/contracts/artifacts/operator-contract.json +70 -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 +70 -1
  6. package/dist/_internal/platform/artifacts/store.d.ts +2 -0
  7. package/dist/_internal/platform/artifacts/store.d.ts.map +1 -1
  8. package/dist/_internal/platform/artifacts/store.js +20 -0
  9. package/dist/_internal/platform/control-plane/method-catalog-homegraph.d.ts.map +1 -1
  10. package/dist/_internal/platform/control-plane/method-catalog-homegraph.js +9 -0
  11. package/dist/_internal/platform/control-plane/operator-contract-schemas-homegraph.d.ts.map +1 -1
  12. package/dist/_internal/platform/control-plane/operator-contract-schemas-homegraph.js +15 -1
  13. package/dist/_internal/platform/knowledge/home-graph/ask-page-refresh.d.ts +11 -0
  14. package/dist/_internal/platform/knowledge/home-graph/ask-page-refresh.d.ts.map +1 -0
  15. package/dist/_internal/platform/knowledge/home-graph/ask-page-refresh.js +31 -0
  16. package/dist/_internal/platform/knowledge/home-graph/ask.d.ts.map +1 -1
  17. package/dist/_internal/platform/knowledge/home-graph/ask.js +24 -1
  18. package/dist/_internal/platform/knowledge/home-graph/generated-pages.d.ts.map +1 -1
  19. package/dist/_internal/platform/knowledge/home-graph/generated-pages.js +92 -20
  20. package/dist/_internal/platform/knowledge/home-graph/map-view.d.ts.map +1 -1
  21. package/dist/_internal/platform/knowledge/home-graph/map-view.js +14 -0
  22. package/dist/_internal/platform/knowledge/home-graph/pages.d.ts +3 -1
  23. package/dist/_internal/platform/knowledge/home-graph/pages.d.ts.map +1 -1
  24. package/dist/_internal/platform/knowledge/home-graph/pages.js +104 -1
  25. package/dist/_internal/platform/knowledge/home-graph/rendering.d.ts +0 -1
  26. package/dist/_internal/platform/knowledge/home-graph/rendering.d.ts.map +1 -1
  27. package/dist/_internal/platform/knowledge/home-graph/rendering.js +0 -12
  28. package/dist/_internal/platform/knowledge/home-graph/reset.d.ts +2 -1
  29. package/dist/_internal/platform/knowledge/home-graph/reset.d.ts.map +1 -1
  30. package/dist/_internal/platform/knowledge/home-graph/reset.js +35 -2
  31. package/dist/_internal/platform/knowledge/home-graph/search.d.ts.map +1 -1
  32. package/dist/_internal/platform/knowledge/home-graph/search.js +2 -18
  33. package/dist/_internal/platform/knowledge/home-graph/service.d.ts +1 -1
  34. package/dist/_internal/platform/knowledge/home-graph/service.d.ts.map +1 -1
  35. package/dist/_internal/platform/knowledge/home-graph/service.js +17 -5
  36. package/dist/_internal/platform/knowledge/home-graph/source-links.d.ts +3 -0
  37. package/dist/_internal/platform/knowledge/home-graph/source-links.d.ts.map +1 -0
  38. package/dist/_internal/platform/knowledge/home-graph/source-links.js +30 -0
  39. package/dist/_internal/platform/knowledge/home-graph/state.d.ts.map +1 -1
  40. package/dist/_internal/platform/knowledge/home-graph/state.js +43 -1
  41. package/dist/_internal/platform/knowledge/home-graph/types.d.ts +39 -1
  42. package/dist/_internal/platform/knowledge/home-graph/types.d.ts.map +1 -1
  43. package/dist/_internal/platform/knowledge/ingest-compile.js +1 -1
  44. package/dist/_internal/platform/knowledge/pdf-extractor.d.ts.map +1 -1
  45. package/dist/_internal/platform/knowledge/pdf-extractor.js +8 -3
  46. package/dist/_internal/platform/knowledge/semantic/answer-fallback.d.ts.map +1 -1
  47. package/dist/_internal/platform/knowledge/semantic/answer-fallback.js +21 -16
  48. package/dist/_internal/platform/knowledge/semantic/answer-source-ranking.d.ts +7 -0
  49. package/dist/_internal/platform/knowledge/semantic/answer-source-ranking.d.ts.map +1 -0
  50. package/dist/_internal/platform/knowledge/semantic/answer-source-ranking.js +57 -0
  51. package/dist/_internal/platform/knowledge/semantic/answer.d.ts.map +1 -1
  52. package/dist/_internal/platform/knowledge/semantic/answer.js +76 -9
  53. package/dist/_internal/platform/knowledge/semantic/fact-quality.d.ts +0 -1
  54. package/dist/_internal/platform/knowledge/semantic/fact-quality.d.ts.map +1 -1
  55. package/dist/_internal/platform/knowledge/semantic/fact-quality.js +18 -18
  56. package/dist/_internal/platform/knowledge/semantic/homeassistant-scope.d.ts.map +1 -1
  57. package/dist/_internal/platform/knowledge/semantic/homeassistant-scope.js +63 -5
  58. package/dist/_internal/platform/knowledge/semantic/repair-profile.d.ts +16 -0
  59. package/dist/_internal/platform/knowledge/semantic/repair-profile.d.ts.map +1 -0
  60. package/dist/_internal/platform/knowledge/semantic/repair-profile.js +152 -0
  61. package/dist/_internal/platform/knowledge/semantic/repair-subjects.d.ts +16 -0
  62. package/dist/_internal/platform/knowledge/semantic/repair-subjects.d.ts.map +1 -0
  63. package/dist/_internal/platform/knowledge/semantic/repair-subjects.js +52 -0
  64. package/dist/_internal/platform/knowledge/semantic/self-improvement-promotion.d.ts.map +1 -1
  65. package/dist/_internal/platform/knowledge/semantic/self-improvement-promotion.js +122 -57
  66. package/dist/_internal/platform/knowledge/semantic/self-improvement.d.ts.map +1 -1
  67. package/dist/_internal/platform/knowledge/semantic/self-improvement.js +40 -13
  68. package/dist/_internal/platform/knowledge/semantic/service.js +1 -1
  69. package/dist/_internal/platform/version.js +1 -1
  70. package/package.json +2 -1
@@ -3,7 +3,7 @@
3
3
  "product": {
4
4
  "id": "goodvibes",
5
5
  "surface": "operator",
6
- "version": "0.28.16"
6
+ "version": "0.28.17"
7
7
  },
8
8
  "auth": {
9
9
  "modes": [
@@ -28012,6 +28012,60 @@
28012
28012
  "minConfidence": {
28013
28013
  "type": "number"
28014
28014
  },
28015
+ "objectKinds": {
28016
+ "type": "array",
28017
+ "items": {
28018
+ "type": "string"
28019
+ }
28020
+ },
28021
+ "entityIds": {
28022
+ "type": "array",
28023
+ "items": {
28024
+ "type": "string"
28025
+ }
28026
+ },
28027
+ "deviceIds": {
28028
+ "type": "array",
28029
+ "items": {
28030
+ "type": "string"
28031
+ }
28032
+ },
28033
+ "areaIds": {
28034
+ "type": "array",
28035
+ "items": {
28036
+ "type": "string"
28037
+ }
28038
+ },
28039
+ "integrationIds": {
28040
+ "type": "array",
28041
+ "items": {
28042
+ "type": "string"
28043
+ }
28044
+ },
28045
+ "integrationDomains": {
28046
+ "type": "array",
28047
+ "items": {
28048
+ "type": "string"
28049
+ }
28050
+ },
28051
+ "domains": {
28052
+ "type": "array",
28053
+ "items": {
28054
+ "type": "string"
28055
+ }
28056
+ },
28057
+ "deviceClasses": {
28058
+ "type": "array",
28059
+ "items": {
28060
+ "type": "string"
28061
+ }
28062
+ },
28063
+ "labels": {
28064
+ "type": "array",
28065
+ "items": {
28066
+ "type": "string"
28067
+ }
28068
+ },
28015
28069
  "ha": {
28016
28070
  "type": "object",
28017
28071
  "properties": {
@@ -30087,6 +30141,9 @@
30087
30141
  },
30088
30142
  "dryRun": {
30089
30143
  "type": "boolean"
30144
+ },
30145
+ "preserveArtifacts": {
30146
+ "type": "boolean"
30090
30147
  }
30091
30148
  },
30092
30149
  "additionalProperties": true
@@ -30133,6 +30190,15 @@
30133
30190
  ]
30134
30191
  }
30135
30192
  },
30193
+ "artifactDeleteCandidates": {
30194
+ "type": "number"
30195
+ },
30196
+ "deletedArtifacts": {
30197
+ "type": "number"
30198
+ },
30199
+ "preservedArtifacts": {
30200
+ "type": "number"
30201
+ },
30136
30202
  "artifactsDeleted": {
30137
30203
  "type": "boolean"
30138
30204
  }
@@ -30143,6 +30209,9 @@
30143
30209
  "installationId",
30144
30210
  "dryRun",
30145
30211
  "deleted",
30212
+ "artifactDeleteCandidates",
30213
+ "deletedArtifacts",
30214
+ "preservedArtifacts",
30146
30215
  "artifactsDeleted"
30147
30216
  ],
30148
30217
  "additionalProperties": true
@@ -1,6 +1,6 @@
1
1
  export declare const FOUNDATION_METADATA: {
2
2
  readonly productId: "goodvibes";
3
- readonly productVersion: "0.28.16";
3
+ readonly productVersion: "0.28.17";
4
4
  readonly operatorMethodCount: 265;
5
5
  readonly operatorEventCount: 30;
6
6
  readonly peerEndpointCount: 6;
@@ -1,7 +1,7 @@
1
1
  // Synced from packages/contracts/src/generated/foundation-metadata.ts
2
2
  export const FOUNDATION_METADATA = {
3
3
  "productId": "goodvibes",
4
- "productVersion": "0.28.16",
4
+ "productVersion": "0.28.17",
5
5
  "operatorMethodCount": 265,
6
6
  "operatorEventCount": 30,
7
7
  "peerEndpointCount": 6
@@ -1 +1 @@
1
- {"version":3,"file":"operator-contract.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/generated/operator-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,eAAO,MAAM,iBAAiB,EAAE,wBAwsmEtB,CAAC"}
1
+ {"version":3,"file":"operator-contract.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/generated/operator-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,eAAO,MAAM,iBAAiB,EAAE,wBA6wmEtB,CAAC"}
@@ -3,7 +3,7 @@ export const OPERATOR_CONTRACT = {
3
3
  "product": {
4
4
  "id": "goodvibes",
5
5
  "surface": "operator",
6
- "version": "0.28.16"
6
+ "version": "0.28.17"
7
7
  },
8
8
  "auth": {
9
9
  "modes": [
@@ -28012,6 +28012,60 @@ export const OPERATOR_CONTRACT = {
28012
28012
  "minConfidence": {
28013
28013
  "type": "number"
28014
28014
  },
28015
+ "objectKinds": {
28016
+ "type": "array",
28017
+ "items": {
28018
+ "type": "string"
28019
+ }
28020
+ },
28021
+ "entityIds": {
28022
+ "type": "array",
28023
+ "items": {
28024
+ "type": "string"
28025
+ }
28026
+ },
28027
+ "deviceIds": {
28028
+ "type": "array",
28029
+ "items": {
28030
+ "type": "string"
28031
+ }
28032
+ },
28033
+ "areaIds": {
28034
+ "type": "array",
28035
+ "items": {
28036
+ "type": "string"
28037
+ }
28038
+ },
28039
+ "integrationIds": {
28040
+ "type": "array",
28041
+ "items": {
28042
+ "type": "string"
28043
+ }
28044
+ },
28045
+ "integrationDomains": {
28046
+ "type": "array",
28047
+ "items": {
28048
+ "type": "string"
28049
+ }
28050
+ },
28051
+ "domains": {
28052
+ "type": "array",
28053
+ "items": {
28054
+ "type": "string"
28055
+ }
28056
+ },
28057
+ "deviceClasses": {
28058
+ "type": "array",
28059
+ "items": {
28060
+ "type": "string"
28061
+ }
28062
+ },
28063
+ "labels": {
28064
+ "type": "array",
28065
+ "items": {
28066
+ "type": "string"
28067
+ }
28068
+ },
28015
28069
  "ha": {
28016
28070
  "type": "object",
28017
28071
  "properties": {
@@ -30087,6 +30141,9 @@ export const OPERATOR_CONTRACT = {
30087
30141
  },
30088
30142
  "dryRun": {
30089
30143
  "type": "boolean"
30144
+ },
30145
+ "preserveArtifacts": {
30146
+ "type": "boolean"
30090
30147
  }
30091
30148
  },
30092
30149
  "additionalProperties": true
@@ -30133,6 +30190,15 @@ export const OPERATOR_CONTRACT = {
30133
30190
  ]
30134
30191
  }
30135
30192
  },
30193
+ "artifactDeleteCandidates": {
30194
+ "type": "number"
30195
+ },
30196
+ "deletedArtifacts": {
30197
+ "type": "number"
30198
+ },
30199
+ "preservedArtifacts": {
30200
+ "type": "number"
30201
+ },
30136
30202
  "artifactsDeleted": {
30137
30203
  "type": "boolean"
30138
30204
  }
@@ -30143,6 +30209,9 @@ export const OPERATOR_CONTRACT = {
30143
30209
  "installationId",
30144
30210
  "dryRun",
30145
30211
  "deleted",
30212
+ "artifactDeleteCandidates",
30213
+ "deletedArtifacts",
30214
+ "preservedArtifacts",
30146
30215
  "artifactsDeleted"
30147
30216
  ],
30148
30217
  "additionalProperties": true
@@ -28,6 +28,8 @@ export declare class ArtifactStore {
28
28
  list(limit?: number): ArtifactDescriptor[];
29
29
  get(id: string): ArtifactDescriptor | null;
30
30
  getRecord(id: string): ArtifactRecord | null;
31
+ delete(id: string): boolean;
32
+ deleteMany(ids: Iterable<string>): number;
31
33
  readContent(id: string): Promise<{
32
34
  record: ArtifactRecord;
33
35
  buffer: Buffer;
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/artifacts/store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAEV,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAQpB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE;QACvB,wBAAwB,CAAC,EAAE,MAAM,MAAM,CAAC;QACxC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC;KACnC,CAAC;IACF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAC5C;AAkND,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC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C,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI;IAM1C,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAK5C,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAQ3B,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM;IAWnC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAU5E,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAM/D,gBAAgB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAiCvE,qBAAqB;YA+BrB,kBAAkB;IAkC1B,YAAY,CAChB,SAAS,EAAE,iBAAiB,EAC5B,OAAO,GAAE;QACP,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;KACzC,GACL,OAAO,CAAC,kBAAkB,CAAC;IAoC9B,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,iBAAiB;YAaX,YAAY;YAoDZ,kBAAkB;IA6DhC,OAAO,CAAC,8BAA8B;IAWtC,OAAO,CAAC,uBAAuB;CAchC"}
@@ -228,6 +228,26 @@ export class ArtifactStore {
228
228
  this.pruneExpired();
229
229
  return this.records.get(id) ?? null;
230
230
  }
231
+ delete(id) {
232
+ this.pruneExpired();
233
+ const record = this.records.get(id);
234
+ if (!record)
235
+ return false;
236
+ this.removeRecordFiles(record);
237
+ return true;
238
+ }
239
+ deleteMany(ids) {
240
+ let deleted = 0;
241
+ const seen = new Set();
242
+ for (const id of ids) {
243
+ if (seen.has(id))
244
+ continue;
245
+ seen.add(id);
246
+ if (this.delete(id))
247
+ deleted += 1;
248
+ }
249
+ return deleted;
250
+ }
231
251
  async readContent(id) {
232
252
  this.pruneExpired();
233
253
  const record = this.records.get(id);
@@ -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;AAyE1E,eAAO,MAAM,wCAAwC,EAAE,SAAS,uBAAuB,EAqUtF,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;AAyE1E,eAAO,MAAM,wCAAwC,EAAE,SAAS,uBAAuB,EA8UtF,CAAC"}
@@ -303,6 +303,15 @@ export const builtinGatewayHomeGraphMethodDescriptors = [
303
303
  edgeRelations: STRING_LIST_SCHEMA,
304
304
  tags: STRING_LIST_SCHEMA,
305
305
  minConfidence: NUMBER_SCHEMA,
306
+ objectKinds: STRING_LIST_SCHEMA,
307
+ entityIds: STRING_LIST_SCHEMA,
308
+ deviceIds: STRING_LIST_SCHEMA,
309
+ areaIds: STRING_LIST_SCHEMA,
310
+ integrationIds: STRING_LIST_SCHEMA,
311
+ integrationDomains: STRING_LIST_SCHEMA,
312
+ domains: STRING_LIST_SCHEMA,
313
+ deviceClasses: STRING_LIST_SCHEMA,
314
+ labels: STRING_LIST_SCHEMA,
306
315
  ha: objectSchema({
307
316
  objectKinds: STRING_LIST_SCHEMA,
308
317
  entityIds: STRING_LIST_SCHEMA,
@@ -1 +1 @@
1
- {"version":3,"file":"operator-contract-schemas-homegraph.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/operator-contract-schemas-homegraph.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,6BAA6B,yBAGJ,CAAC;AAEvC,eAAO,MAAM,6BAA6B,yBAIJ,CAAC;AAEvC,eAAO,MAAM,wBAAwB,yBAY4H,CAAC;AAElK,eAAO,MAAM,6BAA6B,yBAkBiF,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,yBAoB2E,CAAC;AAEzH,eAAO,MAAM,mCAAmC,yBAQsC,CAAC;AAEvF,eAAO,MAAM,+BAA+B,yBAImB,CAAC;AAEhE,eAAO,MAAM,gCAAgC,yBAImB,CAAC;AAEjE,eAAO,MAAM,8BAA8B,yBAImB,CAAC;AAE/D,eAAO,MAAM,+BAA+B,yBAOgD,CAAC;AAE7F,eAAO,MAAM,+BAA+B,yBAMS,CAAC;AAEtD,eAAO,MAAM,yCAAyC,yBAIQ,CAAC;AAE/D,eAAO,MAAM,wCAAwC,yBAIQ,CAAC;AAE9D,eAAO,MAAM,uCAAuC,yBAIW,CAAC;AAEhE,eAAO,MAAM,+BAA+B,yBAUoG,CAAC;AAEjJ,eAAO,MAAM,+BAA+B,yBAIqB,CAAC;AAElE,eAAO,MAAM,8BAA8B,yBAOqE,CAAC"}
1
+ {"version":3,"file":"operator-contract-schemas-homegraph.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/operator-contract-schemas-homegraph.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,6BAA6B,yBAGJ,CAAC;AAEvC,eAAO,MAAM,6BAA6B,yBAKJ,CAAC;AAEvC,eAAO,MAAM,wBAAwB,yBAY4H,CAAC;AAElK,eAAO,MAAM,6BAA6B,yBAkBiF,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,yBAoB2E,CAAC;AAEzH,eAAO,MAAM,mCAAmC,yBAQsC,CAAC;AAEvF,eAAO,MAAM,+BAA+B,yBAImB,CAAC;AAEhE,eAAO,MAAM,gCAAgC,yBAImB,CAAC;AAEjE,eAAO,MAAM,8BAA8B,yBAImB,CAAC;AAE/D,eAAO,MAAM,+BAA+B,yBAOgD,CAAC;AAE7F,eAAO,MAAM,+BAA+B,yBAMS,CAAC;AAEtD,eAAO,MAAM,yCAAyC,yBAIQ,CAAC;AAE/D,eAAO,MAAM,wCAAwC,yBAIQ,CAAC;AAE9D,eAAO,MAAM,uCAAuC,yBAIW,CAAC;AAEhE,eAAO,MAAM,+BAA+B,yBAUoG,CAAC;AAEjJ,eAAO,MAAM,+BAA+B,yBAIqB,CAAC;AAElE,eAAO,MAAM,8BAA8B,yBAoBT,CAAC"}
@@ -9,6 +9,7 @@ export const HOME_GRAPH_RESET_INPUT_SCHEMA = objectSchema({
9
9
  installationId: STRING_SCHEMA,
10
10
  knowledgeSpaceId: STRING_SCHEMA,
11
11
  dryRun: BOOLEAN_SCHEMA,
12
+ preserveArtifacts: BOOLEAN_SCHEMA,
12
13
  }, [], { additionalProperties: true });
13
14
  export const HOME_GRAPH_STATUS_SCHEMA = objectSchema({
14
15
  ok: BOOLEAN_SCHEMA,
@@ -161,5 +162,18 @@ export const HOME_GRAPH_RESET_OUTPUT_SCHEMA = objectSchema({
161
162
  installationId: STRING_SCHEMA,
162
163
  dryRun: BOOLEAN_SCHEMA,
163
164
  deleted: JSON_RECORD_SCHEMA,
165
+ artifactDeleteCandidates: NUMBER_SCHEMA,
166
+ deletedArtifacts: NUMBER_SCHEMA,
167
+ preservedArtifacts: NUMBER_SCHEMA,
164
168
  artifactsDeleted: BOOLEAN_SCHEMA,
165
- }, ['ok', 'spaceId', 'installationId', 'dryRun', 'deleted', 'artifactsDeleted'], { additionalProperties: true });
169
+ }, [
170
+ 'ok',
171
+ 'spaceId',
172
+ 'installationId',
173
+ 'dryRun',
174
+ 'deleted',
175
+ 'artifactDeleteCandidates',
176
+ 'deletedArtifacts',
177
+ 'preservedArtifacts',
178
+ 'artifactsDeleted',
179
+ ], { additionalProperties: true });
@@ -0,0 +1,11 @@
1
+ import type { ArtifactStore } from '../../artifacts/index.js';
2
+ import type { KnowledgeStore } from '../store.js';
3
+ import type { HomeGraphAskResult } from './types.js';
4
+ export declare function refreshDevicePagesForHomeGraphAsk(input: {
5
+ readonly store: KnowledgeStore;
6
+ readonly artifactStore: ArtifactStore;
7
+ readonly spaceId: string;
8
+ readonly installationId: string;
9
+ readonly answer: HomeGraphAskResult;
10
+ }): Promise<void>;
11
+ //# sourceMappingURL=ask-page-refresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-page-refresh.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/ask-page-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAsB,iCAAiC,CAAC,KAAK,EAAE;IAC7D,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;CACrC,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBhB"}
@@ -0,0 +1,31 @@
1
+ import { readRecord } from './helpers.js';
2
+ import { refreshHomeGraphDevicePassport } from './generated-pages.js';
3
+ export async function refreshDevicePagesForHomeGraphAsk(input) {
4
+ if ((input.answer.answer.facts?.length ?? 0) === 0 && input.answer.answer.sources.length === 0)
5
+ return;
6
+ const devices = input.answer.answer.linkedObjects.filter((node) => node.kind === 'ha_device').slice(0, 2);
7
+ for (const device of devices) {
8
+ const deviceId = readHomeAssistantObjectId(device) ?? device.id;
9
+ try {
10
+ await refreshHomeGraphDevicePassport({
11
+ store: input.store,
12
+ artifactStore: input.artifactStore,
13
+ spaceId: input.spaceId,
14
+ installationId: input.installationId,
15
+ input: {
16
+ knowledgeSpaceId: input.spaceId,
17
+ deviceId,
18
+ metadata: { automation: 'ask-refresh' },
19
+ },
20
+ });
21
+ }
22
+ catch {
23
+ // Ask should never fail solely because a generated page refresh failed.
24
+ }
25
+ }
26
+ }
27
+ function readHomeAssistantObjectId(node) {
28
+ const homeAssistant = readRecord(node.metadata.homeAssistant);
29
+ const value = homeAssistant.objectId ?? homeAssistant.deviceId;
30
+ return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
31
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/ask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAQxD,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,eAAe,CAAC,EAAE,wBAAwB,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACpD,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE9B"}
1
+ {"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/ask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AASxD,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,eAAe,CAAC,EAAE,wBAAwB,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACpD,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE9B"}
@@ -1,13 +1,14 @@
1
1
  import { collectLinkedObjects, renderAskAnswer } from './state.js';
2
2
  import { inferHomeAssistantAnswerScopeForQuery, nodeInHomeAssistantAnswerScope, sourceInHomeAssistantAnswerScope, } from '../semantic/homeassistant-scope.js';
3
3
  import { uniqueStrings } from '../semantic/utils.js';
4
+ import { canonicalRepairSubjectNodes } from '../semantic/repair-subjects.js';
4
5
  export async function answerHomeGraphQuery(input) {
5
6
  return answerHomeGraphQueryOnce(input);
6
7
  }
7
8
  async function answerHomeGraphQueryOnce(input) {
8
9
  const results = scopeHomeGraphAnswerResults(input.store, input.spaceId, input.query.query, input.results);
9
10
  const sources = results.flatMap((result) => result.source ? [result.source] : []).map(withAnswerSourceAliases);
10
- const linkedObjects = collectLinkedObjects(results, input.state);
11
+ const linkedObjects = filterHomeGraphAnswerLinkedObjects(input.query.query, collectLinkedObjects(results, input.state));
11
12
  if (input.semanticService) {
12
13
  const answer = await input.semanticService.answer({
13
14
  query: input.query.query,
@@ -99,3 +100,25 @@ function withAnswerSourceAliases(source) {
99
100
  url: source.sourceUri ?? source.canonicalUri,
100
101
  };
101
102
  }
103
+ function filterHomeGraphAnswerLinkedObjects(query, nodes) {
104
+ const canonical = canonicalRepairSubjectNodes({ nodes, text: query });
105
+ if (canonical.length > 0)
106
+ return canonical;
107
+ const integrationIntent = /\b(integration|platform|add-?on|addon|plugin|service|api|setup|configure|configuration|auth|credential|rate limit)\b/i.test(query);
108
+ return uniqueNodes(nodes)
109
+ .filter((node) => node.status !== 'stale')
110
+ .filter((node) => !node.metadata.semanticKind)
111
+ .filter((node) => !['fact', 'wiki_page', 'knowledge_gap', 'ha_device_passport'].includes(node.kind))
112
+ .filter((node) => integrationIntent || node.kind !== 'ha_integration');
113
+ }
114
+ function uniqueNodes(nodes) {
115
+ const seen = new Set();
116
+ const result = [];
117
+ for (const node of nodes) {
118
+ if (seen.has(node.id))
119
+ continue;
120
+ seen.add(node.id);
121
+ result.push(node);
122
+ }
123
+ return result;
124
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"generated-pages.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/generated-pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAM9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAsClD,OAAO,KAAK,EACV,6BAA6B,EAC7B,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,WA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,CAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC,CAyB5E"}
@@ -3,8 +3,9 @@ import { yieldEvery, yieldToEventLoop } from '../cooperative.js';
3
3
  import { HOME_GRAPH_CONNECTOR_ID, buildHomeGraphMetadata, edgeIsActive, homeGraphNodeId, homeGraphSourceId, isGeneratedPageSource, namespacedCanonicalUri, readRecord, uniqueStrings, } from './helpers.js';
4
4
  import { findHomeAssistantNode, missingDevicePassportFields, readHomeGraphState, renderHomeGraphState, safeHomeGraphFilename, sourcesLinkedToNode, } from './state.js';
5
5
  import { issuesForScope, renderDevicePassportPage, renderPacketPage, renderRoomPage, } from './rendering.js';
6
- import { hasConcreteFeatureSignal, isLowValueFeatureOrSpecText, isUsefulHomeGraphSourceBackedNote, isUsefulHomeGraphPageFact, } from '../semantic/fact-quality.js';
7
- import { normalizeWhitespace, sourceSemanticText } from '../semantic/utils.js';
6
+ import { isUsefulHomeGraphPageFact } from '../semantic/fact-quality.js';
7
+ import { deriveRepairProfileFacts } from '../semantic/repair-profile.js';
8
+ import { semanticHash, semanticSlug, sourceSemanticText } from '../semantic/utils.js';
8
9
  export const HOME_GRAPH_PAGE_POLICY_VERSION = 'homegraph-pages-v7';
9
10
  const DEFAULT_SYNC_DEVICE_PASSPORT_LIMIT = 32;
10
11
  const DEFAULT_SYNC_ROOM_PAGE_LIMIT = 12;
@@ -126,9 +127,13 @@ export async function refreshHomeGraphDevicePassport(context) {
126
127
  && edge.toKind === 'node'
127
128
  && edge.toId === device.id
128
129
  && edge.relation === 'belongs_to_device'))));
129
- const sources = sourcesLinkedToNode(device.id, state).filter((source) => !isGeneratedPageSource(source));
130
- const semanticFacts = semanticFactsLinkedToSources(sources, state.nodes, state.edges);
131
- const sourceBackedNotes = sourceBackedNotesFromLinkedSources(store, sources);
130
+ const sources = sourcesLinkedToNode(device.id, state)
131
+ .filter((source) => !isGeneratedPageSource(source));
132
+ const pageProfileFacts = await upsertDevicePageProfileFacts({ store, spaceId, installationId, device, sources });
133
+ const semanticFacts = uniqueNodesById([
134
+ ...semanticFactsForNode(device.id, sources, state.nodes, state.edges),
135
+ ...pageProfileFacts,
136
+ ]);
132
137
  const scopedNodeIds = new Set([device.id, ...entities.map((node) => node.id)]);
133
138
  const issues = issuesForScope(state.issues, state.edges, scopedNodeIds, sources);
134
139
  const missingFields = missingDevicePassportFields(device, sources);
@@ -155,7 +160,7 @@ export async function refreshHomeGraphDevicePassport(context) {
155
160
  relation: 'source_for',
156
161
  metadata: buildHomeGraphMetadata(spaceId, installationId),
157
162
  });
158
- const markdown = renderDevicePassportPage({ spaceId, device, entities, sources, issues, missingFields, semanticFacts, sourceBackedNotes });
163
+ const markdown = renderDevicePassportPage({ spaceId, device, entities, sources, issues, missingFields, semanticFacts });
159
164
  const generated = await materializeGeneratedMarkdown({
160
165
  store,
161
166
  artifactStore,
@@ -353,22 +358,89 @@ function semanticFactsLinkedToSources(sources, nodes, edges) {
353
358
  && edge.relation === 'supports_fact')).map((edge) => edge.toId));
354
359
  return nodes.filter((node) => factIds.has(node.id) && isUsefulHomeGraphPageFact(node));
355
360
  }
356
- function sourceBackedNotesFromLinkedSources(store, sources) {
357
- const notes = [];
358
- for (const source of sources) {
359
- const extraction = store.getExtractionBySourceId(source.id);
360
- notes.push(...extractSourceBackedNotes(sourceSemanticText(source, extraction)));
361
+ function semanticFactsForNode(nodeId, sources, nodes, edges) {
362
+ const factIds = new Set();
363
+ for (const edge of edges) {
364
+ if (edgeIsActive(edge)
365
+ && edge.fromKind === 'node'
366
+ && edge.toKind === 'node'
367
+ && edge.toId === nodeId
368
+ && edge.relation === 'describes') {
369
+ factIds.add(edge.fromId);
370
+ }
371
+ }
372
+ for (const fact of semanticFactsLinkedToSources(sources, nodes, edges)) {
373
+ factIds.add(fact.id);
374
+ }
375
+ return nodes.filter((node) => factIds.has(node.id) && isUsefulHomeGraphPageFact(node));
376
+ }
377
+ async function upsertDevicePageProfileFacts(input) {
378
+ const facts = [];
379
+ for (const source of input.sources.slice(0, 8)) {
380
+ const extraction = input.store.getExtractionBySourceId(source.id);
381
+ const profileFacts = deriveRepairProfileFacts({
382
+ query: `complete features specifications ${input.device.title}`,
383
+ source,
384
+ text: sourceSemanticText(source, extraction),
385
+ });
386
+ for (const profileFact of profileFacts) {
387
+ const fact = await input.store.upsertNode({
388
+ id: `sem-fact-${semanticHash(input.spaceId, source.id, input.device.id, profileFact.title, profileFact.value ?? profileFact.summary)}`,
389
+ kind: 'fact',
390
+ slug: semanticSlug(`${input.spaceId}-${input.device.title}-${profileFact.title}-${source.id}`),
391
+ title: profileFact.title,
392
+ summary: profileFact.summary,
393
+ aliases: profileFact.aliases,
394
+ status: 'active',
395
+ confidence: 72,
396
+ sourceId: source.id,
397
+ metadata: buildHomeGraphMetadata(input.spaceId, input.installationId, {
398
+ semanticKind: 'fact',
399
+ factKind: profileFact.kind,
400
+ value: profileFact.value,
401
+ evidence: profileFact.evidence,
402
+ labels: profileFact.labels,
403
+ sourceId: source.id,
404
+ subject: input.device.title,
405
+ subjectIds: [input.device.id],
406
+ targetHints: [{ id: input.device.id, kind: input.device.kind, title: input.device.title }],
407
+ linkedObjectIds: [input.device.id],
408
+ extractor: 'page-profile',
409
+ }),
410
+ });
411
+ await input.store.upsertEdge({
412
+ fromKind: 'source',
413
+ fromId: source.id,
414
+ toKind: 'node',
415
+ toId: fact.id,
416
+ relation: 'supports_fact',
417
+ weight: 0.78,
418
+ metadata: buildHomeGraphMetadata(input.spaceId, input.installationId, {
419
+ linkedBy: 'generated-page-profile',
420
+ }),
421
+ });
422
+ await input.store.upsertEdge({
423
+ fromKind: 'node',
424
+ fromId: fact.id,
425
+ toKind: 'node',
426
+ toId: input.device.id,
427
+ relation: 'describes',
428
+ weight: 0.76,
429
+ metadata: buildHomeGraphMetadata(input.spaceId, input.installationId, {
430
+ linkedBy: 'generated-page-profile',
431
+ sourceId: source.id,
432
+ }),
433
+ });
434
+ facts.push(fact);
435
+ }
361
436
  }
362
- return uniqueStrings(notes).slice(0, 24);
437
+ return facts;
363
438
  }
364
- function extractSourceBackedNotes(text) {
365
- return normalizeWhitespace(text)
366
- .split(/(?:[.!?]\s+|\n+)/)
367
- .map((part) => normalizeWhitespace(part.replace(/^[-*•]\s*/, '')))
368
- .filter((part) => part.length >= 24 && part.length <= 420)
369
- .filter((part) => hasConcreteFeatureSignal(part))
370
- .filter((part) => isUsefulHomeGraphSourceBackedNote(part))
371
- .filter((part) => !isLowValueFeatureOrSpecText(part));
439
+ function uniqueNodesById(nodes) {
440
+ const byId = new Map();
441
+ for (const node of nodes)
442
+ byId.set(node.id, node);
443
+ return [...byId.values()];
372
444
  }
373
445
  function limitRecords(records, limit) {
374
446
  if (typeof limit !== 'number')
@@ -1 +1 @@
1
- {"version":3,"file":"map-view.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/map-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAExE,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG;IAC5D,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;CAChC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAO9B"}
1
+ {"version":3,"file":"map-view.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/map-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAExE,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG;IAC5D,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;CAChC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAkB9B"}
@@ -6,6 +6,20 @@ export async function mapHomeGraph(input) {
6
6
  const { spaceId } = resolveReadableHomeGraphSpace(input.store, input);
7
7
  return renderHomeGraphMap(renderHomeGraphState(input.store, spaceId, 'Home Graph Map'), {
8
8
  ...input,
9
+ ha: {
10
+ objectKinds: preferNonEmpty(input.ha?.objectKinds, input.objectKinds),
11
+ entityIds: preferNonEmpty(input.ha?.entityIds, input.entityIds),
12
+ deviceIds: preferNonEmpty(input.ha?.deviceIds, input.deviceIds),
13
+ areaIds: preferNonEmpty(input.ha?.areaIds, input.areaIds),
14
+ integrationIds: preferNonEmpty(input.ha?.integrationIds, input.integrationIds),
15
+ integrationDomains: preferNonEmpty(input.ha?.integrationDomains, input.integrationDomains),
16
+ domains: preferNonEmpty(input.ha?.domains, input.domains),
17
+ deviceClasses: preferNonEmpty(input.ha?.deviceClasses, input.deviceClasses),
18
+ labels: preferNonEmpty(input.ha?.labels, input.labels),
19
+ },
9
20
  knowledgeSpaceId: spaceId,
10
21
  });
11
22
  }
23
+ function preferNonEmpty(primary, fallback) {
24
+ return primary && primary.length > 0 ? primary : fallback;
25
+ }
@@ -1,10 +1,12 @@
1
1
  import type { ArtifactStore } from '../../artifacts/index.js';
2
- import type { KnowledgeSourceRecord } from '../types.js';
2
+ import type { KnowledgeEdgeRecord, KnowledgeNodeRecord, KnowledgeSourceRecord } from '../types.js';
3
3
  import type { HomeGraphPageListResult } from './types.js';
4
4
  export declare function listHomeGraphPages(input: {
5
5
  readonly artifactStore: ArtifactStore;
6
6
  readonly spaceId: string;
7
7
  readonly sources: readonly KnowledgeSourceRecord[];
8
+ readonly nodes: readonly KnowledgeNodeRecord[];
9
+ readonly edges: readonly KnowledgeEdgeRecord[];
8
10
  readonly limit: number;
9
11
  readonly includeMarkdown: boolean;
10
12
  }): Promise<HomeGraphPageListResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BA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