@pellux/goodvibes-sdk 0.28.10 → 0.28.12
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 +17 -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 +17 -1
- package/dist/_internal/platform/control-plane/method-catalog-homegraph.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/method-catalog-homegraph.js +2 -2
- package/dist/_internal/platform/control-plane/operator-contract-schemas-homegraph.d.ts +1 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-homegraph.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/operator-contract-schemas-homegraph.js +10 -1
- package/dist/_internal/platform/knowledge/home-graph/ask.d.ts +1 -1
- package/dist/_internal/platform/knowledge/home-graph/ask.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/ask.js +87 -0
- package/dist/_internal/platform/knowledge/home-graph/generated-pages.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/generated-pages.js +39 -5
- 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/link-node.d.ts +21 -0
- package/dist/_internal/platform/knowledge/home-graph/link-node.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/home-graph/link-node.js +45 -0
- package/dist/_internal/platform/knowledge/home-graph/reset.d.ts +4 -0
- package/dist/_internal/platform/knowledge/home-graph/reset.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/home-graph/reset.js +8 -0
- package/dist/_internal/platform/knowledge/home-graph/service.d.ts +4 -3
- package/dist/_internal/platform/knowledge/home-graph/service.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/service.js +21 -31
- package/dist/_internal/platform/knowledge/home-graph/types.d.ts +7 -0
- package/dist/_internal/platform/knowledge/home-graph/types.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/index.d.ts +1 -1
- package/dist/_internal/platform/knowledge/index.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/map.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/map.js +3 -2
- package/dist/_internal/platform/knowledge/semantic/answer-quality.d.ts +10 -0
- package/dist/_internal/platform/knowledge/semantic/answer-quality.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/semantic/answer-quality.js +62 -0
- package/dist/_internal/platform/knowledge/semantic/answer-space.d.ts +8 -0
- package/dist/_internal/platform/knowledge/semantic/answer-space.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/semantic/answer-space.js +15 -0
- package/dist/_internal/platform/knowledge/semantic/answer.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/semantic/answer.js +19 -24
- package/dist/_internal/platform/knowledge/semantic/self-improvement.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/semantic/self-improvement.js +18 -1
- package/dist/_internal/platform/knowledge/semantic/service.d.ts +5 -0
- package/dist/_internal/platform/knowledge/semantic/service.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/semantic/service.js +41 -6
- package/dist/_internal/platform/knowledge/semantic/types.d.ts +1 -0
- package/dist/_internal/platform/knowledge/semantic/types.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/store-space-delete.d.ts +1 -0
- package/dist/_internal/platform/knowledge/store-space-delete.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/store-space-delete.js +44 -22
- package/dist/_internal/platform/knowledge/store.d.ts +5 -1
- package/dist/_internal/platform/knowledge/store.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/store.js +15 -6
- package/dist/_internal/platform/version.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"product": {
|
|
4
4
|
"id": "goodvibes",
|
|
5
5
|
"surface": "operator",
|
|
6
|
-
"version": "0.28.
|
|
6
|
+
"version": "0.28.12"
|
|
7
7
|
},
|
|
8
8
|
"auth": {
|
|
9
9
|
"modes": [
|
|
@@ -30072,6 +30072,9 @@
|
|
|
30072
30072
|
},
|
|
30073
30073
|
"knowledgeSpaceId": {
|
|
30074
30074
|
"type": "string"
|
|
30075
|
+
},
|
|
30076
|
+
"dryRun": {
|
|
30077
|
+
"type": "boolean"
|
|
30075
30078
|
}
|
|
30076
30079
|
},
|
|
30077
30080
|
"additionalProperties": true
|
|
@@ -30088,6 +30091,9 @@
|
|
|
30088
30091
|
"installationId": {
|
|
30089
30092
|
"type": "string"
|
|
30090
30093
|
},
|
|
30094
|
+
"dryRun": {
|
|
30095
|
+
"type": "boolean"
|
|
30096
|
+
},
|
|
30091
30097
|
"deleted": {
|
|
30092
30098
|
"type": "object",
|
|
30093
30099
|
"additionalProperties": {
|
|
@@ -30123,6 +30129,7 @@
|
|
|
30123
30129
|
"ok",
|
|
30124
30130
|
"spaceId",
|
|
30125
30131
|
"installationId",
|
|
30132
|
+
"dryRun",
|
|
30126
30133
|
"deleted",
|
|
30127
30134
|
"artifactsDeleted"
|
|
30128
30135
|
],
|
|
@@ -31319,6 +31326,15 @@
|
|
|
31319
31326
|
"sources": {
|
|
31320
31327
|
"type": "number"
|
|
31321
31328
|
},
|
|
31329
|
+
"deferredDevicePassports": {
|
|
31330
|
+
"type": "number"
|
|
31331
|
+
},
|
|
31332
|
+
"deferredRoomPages": {
|
|
31333
|
+
"type": "number"
|
|
31334
|
+
},
|
|
31335
|
+
"truncated": {
|
|
31336
|
+
"type": "boolean"
|
|
31337
|
+
},
|
|
31322
31338
|
"errors": {
|
|
31323
31339
|
"type": "array",
|
|
31324
31340
|
"items": {
|
|
@@ -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.
|
|
4
|
+
"productVersion": "0.28.12",
|
|
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,
|
|
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,wBAgrmEtB,CAAC"}
|
|
@@ -3,7 +3,7 @@ export const OPERATOR_CONTRACT = {
|
|
|
3
3
|
"product": {
|
|
4
4
|
"id": "goodvibes",
|
|
5
5
|
"surface": "operator",
|
|
6
|
-
"version": "0.28.
|
|
6
|
+
"version": "0.28.12"
|
|
7
7
|
},
|
|
8
8
|
"auth": {
|
|
9
9
|
"modes": [
|
|
@@ -30072,6 +30072,9 @@ export const OPERATOR_CONTRACT = {
|
|
|
30072
30072
|
},
|
|
30073
30073
|
"knowledgeSpaceId": {
|
|
30074
30074
|
"type": "string"
|
|
30075
|
+
},
|
|
30076
|
+
"dryRun": {
|
|
30077
|
+
"type": "boolean"
|
|
30075
30078
|
}
|
|
30076
30079
|
},
|
|
30077
30080
|
"additionalProperties": true
|
|
@@ -30088,6 +30091,9 @@ export const OPERATOR_CONTRACT = {
|
|
|
30088
30091
|
"installationId": {
|
|
30089
30092
|
"type": "string"
|
|
30090
30093
|
},
|
|
30094
|
+
"dryRun": {
|
|
30095
|
+
"type": "boolean"
|
|
30096
|
+
},
|
|
30091
30097
|
"deleted": {
|
|
30092
30098
|
"type": "object",
|
|
30093
30099
|
"additionalProperties": {
|
|
@@ -30123,6 +30129,7 @@ export const OPERATOR_CONTRACT = {
|
|
|
30123
30129
|
"ok",
|
|
30124
30130
|
"spaceId",
|
|
30125
30131
|
"installationId",
|
|
30132
|
+
"dryRun",
|
|
30126
30133
|
"deleted",
|
|
30127
30134
|
"artifactsDeleted"
|
|
30128
30135
|
],
|
|
@@ -31319,6 +31326,15 @@ export const OPERATOR_CONTRACT = {
|
|
|
31319
31326
|
"sources": {
|
|
31320
31327
|
"type": "number"
|
|
31321
31328
|
},
|
|
31329
|
+
"deferredDevicePassports": {
|
|
31330
|
+
"type": "number"
|
|
31331
|
+
},
|
|
31332
|
+
"deferredRoomPages": {
|
|
31333
|
+
"type": "number"
|
|
31334
|
+
},
|
|
31335
|
+
"truncated": {
|
|
31336
|
+
"type": "boolean"
|
|
31337
|
+
},
|
|
31322
31338
|
"errors": {
|
|
31323
31339
|
"type": "array",
|
|
31324
31340
|
"items": {
|
|
@@ -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;
|
|
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,EAoUtF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BOOLEAN_SCHEMA, NUMBER_SCHEMA, STRING_SCHEMA, bodyEnvelopeSchema, methodDescriptor, objectSchema, } from './method-catalog-shared.js';
|
|
2
2
|
import { GENERIC_LIST_SCHEMA, JSON_RECORD_SCHEMA, METADATA_SCHEMA, STRING_LIST_SCHEMA, } from './operator-contract-schemas-shared.js';
|
|
3
|
-
import { HOME_GRAPH_ASK_OUTPUT_SCHEMA, HOME_GRAPH_BROWSE_OUTPUT_SCHEMA, HOME_GRAPH_EXPORT_OUTPUT_SCHEMA, HOME_GRAPH_IMPORT_OUTPUT_SCHEMA, HOME_GRAPH_INGEST_OUTPUT_SCHEMA, HOME_GRAPH_ISSUES_OUTPUT_SCHEMA, HOME_GRAPH_LINK_OUTPUT_SCHEMA, HOME_GRAPH_MAP_OUTPUT_SCHEMA, HOME_GRAPH_PAGES_OUTPUT_SCHEMA, HOME_GRAPH_PROJECTION_OUTPUT_SCHEMA, HOME_GRAPH_REINDEX_OUTPUT_SCHEMA, HOME_GRAPH_REFINEMENT_RUN_OUTPUT_SCHEMA, HOME_GRAPH_REFINEMENT_TASK_OUTPUT_SCHEMA, HOME_GRAPH_REFINEMENT_TASKS_OUTPUT_SCHEMA, HOME_GRAPH_RESET_OUTPUT_SCHEMA, HOME_GRAPH_REVIEW_OUTPUT_SCHEMA, HOME_GRAPH_SOURCES_OUTPUT_SCHEMA, HOME_GRAPH_SPACE_INPUT_SCHEMA, HOME_GRAPH_STATUS_SCHEMA, HOME_GRAPH_SYNC_OUTPUT_SCHEMA, } from './operator-contract-schemas-homegraph.js';
|
|
3
|
+
import { HOME_GRAPH_ASK_OUTPUT_SCHEMA, HOME_GRAPH_BROWSE_OUTPUT_SCHEMA, HOME_GRAPH_EXPORT_OUTPUT_SCHEMA, HOME_GRAPH_IMPORT_OUTPUT_SCHEMA, HOME_GRAPH_INGEST_OUTPUT_SCHEMA, HOME_GRAPH_ISSUES_OUTPUT_SCHEMA, HOME_GRAPH_LINK_OUTPUT_SCHEMA, HOME_GRAPH_MAP_OUTPUT_SCHEMA, HOME_GRAPH_PAGES_OUTPUT_SCHEMA, HOME_GRAPH_PROJECTION_OUTPUT_SCHEMA, HOME_GRAPH_REINDEX_OUTPUT_SCHEMA, HOME_GRAPH_REFINEMENT_RUN_OUTPUT_SCHEMA, HOME_GRAPH_REFINEMENT_TASK_OUTPUT_SCHEMA, HOME_GRAPH_REFINEMENT_TASKS_OUTPUT_SCHEMA, HOME_GRAPH_RESET_INPUT_SCHEMA, HOME_GRAPH_RESET_OUTPUT_SCHEMA, HOME_GRAPH_REVIEW_OUTPUT_SCHEMA, HOME_GRAPH_SOURCES_OUTPUT_SCHEMA, HOME_GRAPH_SPACE_INPUT_SCHEMA, HOME_GRAPH_STATUS_SCHEMA, HOME_GRAPH_SYNC_OUTPUT_SCHEMA, } from './operator-contract-schemas-homegraph.js';
|
|
4
4
|
function homeGraphDescriptor(input) {
|
|
5
5
|
return methodDescriptor({
|
|
6
6
|
id: input.id,
|
|
@@ -343,7 +343,7 @@ export const builtinGatewayHomeGraphMethodDescriptors = [
|
|
|
343
343
|
path: '/api/homeassistant/home-graph/reset',
|
|
344
344
|
write: true,
|
|
345
345
|
dangerous: true,
|
|
346
|
-
inputSchema:
|
|
346
|
+
inputSchema: HOME_GRAPH_RESET_INPUT_SCHEMA,
|
|
347
347
|
outputSchema: HOME_GRAPH_RESET_OUTPUT_SCHEMA,
|
|
348
348
|
}),
|
|
349
349
|
];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const HOME_GRAPH_SPACE_INPUT_SCHEMA: Record<string, unknown>;
|
|
2
|
+
export declare const HOME_GRAPH_RESET_INPUT_SCHEMA: Record<string, unknown>;
|
|
2
3
|
export declare const HOME_GRAPH_STATUS_SCHEMA: Record<string, unknown>;
|
|
3
4
|
export declare const HOME_GRAPH_SYNC_OUTPUT_SCHEMA: Record<string, unknown>;
|
|
4
5
|
export declare const HOME_GRAPH_INGEST_OUTPUT_SCHEMA: Record<string, unknown>;
|
|
@@ -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,wBAAwB,yBAY4H,CAAC;AAElK,eAAO,MAAM,6BAA6B,
|
|
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"}
|
|
@@ -5,6 +5,11 @@ export const HOME_GRAPH_SPACE_INPUT_SCHEMA = objectSchema({
|
|
|
5
5
|
installationId: STRING_SCHEMA,
|
|
6
6
|
knowledgeSpaceId: STRING_SCHEMA,
|
|
7
7
|
}, [], { additionalProperties: true });
|
|
8
|
+
export const HOME_GRAPH_RESET_INPUT_SCHEMA = objectSchema({
|
|
9
|
+
installationId: STRING_SCHEMA,
|
|
10
|
+
knowledgeSpaceId: STRING_SCHEMA,
|
|
11
|
+
dryRun: BOOLEAN_SCHEMA,
|
|
12
|
+
}, [], { additionalProperties: true });
|
|
8
13
|
export const HOME_GRAPH_STATUS_SCHEMA = objectSchema({
|
|
9
14
|
ok: BOOLEAN_SCHEMA,
|
|
10
15
|
spaceId: STRING_SCHEMA,
|
|
@@ -30,6 +35,9 @@ export const HOME_GRAPH_SYNC_OUTPUT_SCHEMA = objectSchema({
|
|
|
30
35
|
roomPages: NUMBER_SCHEMA,
|
|
31
36
|
artifacts: NUMBER_SCHEMA,
|
|
32
37
|
sources: NUMBER_SCHEMA,
|
|
38
|
+
deferredDevicePassports: NUMBER_SCHEMA,
|
|
39
|
+
deferredRoomPages: NUMBER_SCHEMA,
|
|
40
|
+
truncated: BOOLEAN_SCHEMA,
|
|
33
41
|
errors: GENERIC_LIST_SCHEMA,
|
|
34
42
|
}, ['devicePassports', 'roomPages', 'artifacts', 'sources', 'errors'], { additionalProperties: true }),
|
|
35
43
|
counts: JSON_RECORD_SCHEMA,
|
|
@@ -151,6 +159,7 @@ export const HOME_GRAPH_RESET_OUTPUT_SCHEMA = objectSchema({
|
|
|
151
159
|
ok: BOOLEAN_SCHEMA,
|
|
152
160
|
spaceId: STRING_SCHEMA,
|
|
153
161
|
installationId: STRING_SCHEMA,
|
|
162
|
+
dryRun: BOOLEAN_SCHEMA,
|
|
154
163
|
deleted: JSON_RECORD_SCHEMA,
|
|
155
164
|
artifactsDeleted: BOOLEAN_SCHEMA,
|
|
156
|
-
}, ['ok', 'spaceId', 'installationId', 'deleted', 'artifactsDeleted'], { additionalProperties: true });
|
|
165
|
+
}, ['ok', 'spaceId', 'installationId', 'dryRun', 'deleted', 'artifactsDeleted'], { additionalProperties: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { KnowledgeSemanticService } from '../semantic/index.js';
|
|
2
2
|
import type { KnowledgeStore } from '../store.js';
|
|
3
3
|
import type { HomeGraphAskInput, HomeGraphAskResult, HomeGraphSearchResult } from './types.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type HomeGraphSearchState } from './search.js';
|
|
5
5
|
export declare function answerHomeGraphQuery(input: {
|
|
6
6
|
readonly store: KnowledgeStore;
|
|
7
7
|
readonly semanticService?: KnowledgeSemanticService;
|
|
@@ -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,
|
|
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,EAGL,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AAQrB,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,CAgD9B"}
|
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
import { collectLinkedObjects, renderAskAnswer } from './state.js';
|
|
2
|
+
import { readHomeGraphSearchState, scoreHomeGraphResults, } from './search.js';
|
|
2
3
|
import { inferHomeAssistantAnswerScopeForQuery, nodeInHomeAssistantAnswerScope, sourceInHomeAssistantAnswerScope, } from '../semantic/homeassistant-scope.js';
|
|
4
|
+
import { uniqueStrings } from '../semantic/utils.js';
|
|
3
5
|
export async function answerHomeGraphQuery(input) {
|
|
6
|
+
const answer = await answerHomeGraphQueryOnce(input);
|
|
7
|
+
if (!shouldRunForegroundRepair(input, answer))
|
|
8
|
+
return answer;
|
|
9
|
+
const refinement = await input.semanticService.repairAnswerGaps({
|
|
10
|
+
answer: {
|
|
11
|
+
ok: true,
|
|
12
|
+
spaceId: input.spaceId,
|
|
13
|
+
query: answer.query,
|
|
14
|
+
answer: {
|
|
15
|
+
...answer.answer,
|
|
16
|
+
facts: answer.answer.facts ?? [],
|
|
17
|
+
gaps: answer.answer.gaps ?? [],
|
|
18
|
+
synthesized: answer.answer.synthesized === true,
|
|
19
|
+
},
|
|
20
|
+
results: [],
|
|
21
|
+
},
|
|
22
|
+
limit: Math.max(1, answer.answer.gaps?.length ?? 1),
|
|
23
|
+
maxRunMs: 25_000,
|
|
24
|
+
}).catch(() => null);
|
|
25
|
+
if (!refinement)
|
|
26
|
+
return answer;
|
|
27
|
+
const repairedSources = refinement.ingestedSourceIds
|
|
28
|
+
.map((sourceId) => input.store.getSource(sourceId))
|
|
29
|
+
.filter((source) => Boolean(source));
|
|
30
|
+
if (repairedSources.length > 0) {
|
|
31
|
+
await input.semanticService.enrichSources(repairedSources, {
|
|
32
|
+
knowledgeSpaceId: input.spaceId,
|
|
33
|
+
force: true,
|
|
34
|
+
limit: Math.min(3, repairedSources.length),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (refinement.ingestedSourceIds.length === 0 && refinement.linkedRepairs === 0 && refinement.closedGaps === 0) {
|
|
38
|
+
return mergeRefinementTaskIds(answer, refinement.taskIds);
|
|
39
|
+
}
|
|
40
|
+
const state = readHomeGraphSearchState(input.store, input.spaceId);
|
|
41
|
+
const results = scoreHomeGraphResults(input.query.query, state.sources, state.nodes, state.edges, (sourceId) => state.extractionBySourceId.get(sourceId), input.query.limit ?? 8);
|
|
42
|
+
const repaired = await answerHomeGraphQueryOnce({ ...input, state, results });
|
|
43
|
+
return mergeRefinementTaskIds(repaired, [
|
|
44
|
+
...(answer.answer.refinementTaskIds ?? []),
|
|
45
|
+
...refinement.taskIds,
|
|
46
|
+
...taskIdsForGaps(input.store, input.spaceId, answer.answer.gaps?.map((gap) => gap.id) ?? []),
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
async function answerHomeGraphQueryOnce(input) {
|
|
4
50
|
const results = scopeHomeGraphAnswerResults(input.store, input.spaceId, input.query.query, input.results);
|
|
5
51
|
const sources = results.flatMap((result) => result.source ? [result.source] : []).map(withAnswerSourceAliases);
|
|
6
52
|
const linkedObjects = collectLinkedObjects(results, input.state);
|
|
@@ -18,6 +64,7 @@ export async function answerHomeGraphQuery(input) {
|
|
|
18
64
|
strictCandidates: true,
|
|
19
65
|
linkedObjects,
|
|
20
66
|
noMatchMessage: `No Home Graph knowledge matched "${input.query.query}".`,
|
|
67
|
+
autoRepairGaps: false,
|
|
21
68
|
});
|
|
22
69
|
setTimeout(() => {
|
|
23
70
|
void input.semanticService?.enrichSources(uniqueSources(sources), {
|
|
@@ -58,6 +105,46 @@ export async function answerHomeGraphQuery(input) {
|
|
|
58
105
|
results,
|
|
59
106
|
};
|
|
60
107
|
}
|
|
108
|
+
function shouldRunForegroundRepair(input, answer) {
|
|
109
|
+
if (!input.semanticService)
|
|
110
|
+
return false;
|
|
111
|
+
if (!hasFeatureOrSpecIntent(input.query.query))
|
|
112
|
+
return false;
|
|
113
|
+
if (!answer.answer.gaps || answer.answer.gaps.length === 0)
|
|
114
|
+
return false;
|
|
115
|
+
if (answer.answer.facts && answer.answer.facts.length >= 3 && answer.answer.confidence > 0)
|
|
116
|
+
return false;
|
|
117
|
+
return answer.answer.linkedObjects?.some(isConcreteHomeGraphSubject) === true;
|
|
118
|
+
}
|
|
119
|
+
function hasFeatureOrSpecIntent(query) {
|
|
120
|
+
return /\b(feature|features|capabilit(?:y|ies)|function|functions|spec|specs|specification|specifications|support|supports|supported)\b/i
|
|
121
|
+
.test(query);
|
|
122
|
+
}
|
|
123
|
+
function isConcreteHomeGraphSubject(node) {
|
|
124
|
+
if (node.kind === 'ha_device' || node.kind === 'ha_integration')
|
|
125
|
+
return true;
|
|
126
|
+
return typeof node.metadata.manufacturer === 'string' || typeof node.metadata.model === 'string';
|
|
127
|
+
}
|
|
128
|
+
function mergeRefinementTaskIds(answer, previousTaskIds) {
|
|
129
|
+
const ids = uniqueStrings([...(answer.answer.refinementTaskIds ?? []), ...(previousTaskIds ?? [])]);
|
|
130
|
+
if (ids.length === (answer.answer.refinementTaskIds?.length ?? 0))
|
|
131
|
+
return answer;
|
|
132
|
+
return {
|
|
133
|
+
...answer,
|
|
134
|
+
answer: {
|
|
135
|
+
...answer.answer,
|
|
136
|
+
refinementTaskIds: ids,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function taskIdsForGaps(store, spaceId, gapIds) {
|
|
141
|
+
const wanted = new Set(gapIds);
|
|
142
|
+
if (wanted.size === 0)
|
|
143
|
+
return [];
|
|
144
|
+
return store.listRefinementTasks(100, { spaceId })
|
|
145
|
+
.filter((task) => task.gapId && wanted.has(task.gapId))
|
|
146
|
+
.map((task) => task.id);
|
|
147
|
+
}
|
|
61
148
|
function scopeHomeGraphAnswerResults(store, spaceId, query, results) {
|
|
62
149
|
if (results.length === 0)
|
|
63
150
|
return results;
|
|
@@ -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,WAAW,oBAAoB;IACnC,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;CACjC;AAED,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;
|
|
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,WAAW,oBAAoB;IACnC,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;CACjC;AAED,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AAInE,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,oBAAoB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAA;CAAE,GACzE,OAAO,CAAC,8BAA8B,CAAC,CAMzC;AAED,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,8BAA8B,CAAC,CAEzC;AAgFD,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,oBAAoB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,GAC3E,OAAO,CAAC,6BAA6B,GAAG;IAAE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC,CA6EhF;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,oBAAoB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,GAC3E,OAAO,CAAC,yBAAyB,GAAG;IAAE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC,CAsC5E;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,oBAAoB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,GAC3E,OAAO,CAAC,yBAAyB,GAAG;IAAE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC,CAyB5E"}
|
|
@@ -6,8 +6,14 @@ import { issuesForScope, renderDevicePassportPage, renderPacketPage, renderRoomP
|
|
|
6
6
|
import { hasConcreteFeatureSignal, isLowValueFeatureOrSpecText, isUsefulHomeGraphSourceBackedNote, isUsefulHomeGraphPageFact, } from '../semantic/fact-quality.js';
|
|
7
7
|
import { normalizeWhitespace, sourceSemanticText } from '../semantic/utils.js';
|
|
8
8
|
export const HOME_GRAPH_PAGE_POLICY_VERSION = 'homegraph-pages-v7';
|
|
9
|
+
const DEFAULT_SYNC_DEVICE_PASSPORT_LIMIT = 32;
|
|
10
|
+
const DEFAULT_SYNC_ROOM_PAGE_LIMIT = 12;
|
|
9
11
|
export async function generateAutomaticHomeGraphPages(context) {
|
|
10
|
-
return generateHomeGraphPagesForCurrentState(context,
|
|
12
|
+
return generateHomeGraphPagesForCurrentState(context, {
|
|
13
|
+
maxDevicePassports: DEFAULT_SYNC_DEVICE_PASSPORT_LIMIT,
|
|
14
|
+
maxRoomPages: DEFAULT_SYNC_ROOM_PAGE_LIMIT,
|
|
15
|
+
...(context.input.pageAutomation ?? {}),
|
|
16
|
+
});
|
|
11
17
|
}
|
|
12
18
|
export async function refreshAutomaticHomeGraphPages(context) {
|
|
13
19
|
return generateHomeGraphPagesForCurrentState(context, {});
|
|
@@ -19,7 +25,9 @@ async function generateHomeGraphPagesForCurrentState(context, options) {
|
|
|
19
25
|
return summary;
|
|
20
26
|
const state = readHomeGraphState(context.store, context.spaceId);
|
|
21
27
|
if (effectiveOptions.devicePassports !== false) {
|
|
22
|
-
const
|
|
28
|
+
const allDevices = prioritizeNodesForGeneratedPages(state.nodes.filter((node) => node.kind === 'ha_device' && node.status !== 'stale'));
|
|
29
|
+
const devices = limitRecords(allDevices, effectiveOptions.maxDevicePassports);
|
|
30
|
+
summary.deferredDevicePassports += Math.max(0, allDevices.length - devices.length);
|
|
23
31
|
for (const [index, device] of devices.entries()) {
|
|
24
32
|
await yieldEvery(index, 2);
|
|
25
33
|
const deviceId = readHomeAssistantObjectId(device, 'objectId', 'deviceId') ?? device.id;
|
|
@@ -49,9 +57,9 @@ async function generateHomeGraphPagesForCurrentState(context, options) {
|
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
if (effectiveOptions.roomPages !== false) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
const allRooms = prioritizeNodesForGeneratedPages(state.nodes.filter((node) => (node.kind === 'ha_area' || node.kind === 'ha_room') && node.status !== 'stale'));
|
|
61
|
+
const rooms = limitRecords(allRooms, effectiveOptions.maxRoomPages);
|
|
62
|
+
summary.deferredRoomPages += Math.max(0, allRooms.length - rooms.length);
|
|
55
63
|
for (const [index, room] of rooms.entries()) {
|
|
56
64
|
await yieldEvery(index, 2);
|
|
57
65
|
const areaId = readHomeAssistantObjectId(room, 'objectId', 'areaId') ?? room.id;
|
|
@@ -81,6 +89,7 @@ async function generateHomeGraphPagesForCurrentState(context, options) {
|
|
|
81
89
|
await yieldToEventLoop();
|
|
82
90
|
}
|
|
83
91
|
}
|
|
92
|
+
summary.truncated = summary.deferredDevicePassports > 0 || summary.deferredRoomPages > 0;
|
|
84
93
|
return summary;
|
|
85
94
|
}
|
|
86
95
|
export async function refreshHomeGraphDevicePassport(context) {
|
|
@@ -284,12 +293,37 @@ function createGeneratedPagesSummary() {
|
|
|
284
293
|
roomPages: 0,
|
|
285
294
|
artifacts: 0,
|
|
286
295
|
sources: 0,
|
|
296
|
+
deferredDevicePassports: 0,
|
|
297
|
+
deferredRoomPages: 0,
|
|
298
|
+
truncated: false,
|
|
287
299
|
errors: [],
|
|
288
300
|
};
|
|
289
301
|
}
|
|
290
302
|
function compareByTitle(left, right) {
|
|
291
303
|
return left.title.localeCompare(right.title) || left.id.localeCompare(right.id);
|
|
292
304
|
}
|
|
305
|
+
function prioritizeNodesForGeneratedPages(nodes) {
|
|
306
|
+
return [...nodes].sort((left, right) => (generatedPagePriority(right) - generatedPagePriority(left)
|
|
307
|
+
|| compareByTitle(left, right)));
|
|
308
|
+
}
|
|
309
|
+
function generatedPagePriority(node) {
|
|
310
|
+
const metadata = readRecord(node.metadata.homeAssistant);
|
|
311
|
+
const objectKind = String(metadata.objectKind ?? '').toLowerCase();
|
|
312
|
+
const domain = String(metadata.domain ?? node.metadata.domain ?? '').toLowerCase();
|
|
313
|
+
const title = `${node.title} ${node.summary ?? ''}`.toLowerCase();
|
|
314
|
+
let score = 0;
|
|
315
|
+
if (objectKind === 'device')
|
|
316
|
+
score += 8;
|
|
317
|
+
if (domain === 'media_player' || domain === 'climate' || domain === 'lock' || domain === 'cover')
|
|
318
|
+
score += 8;
|
|
319
|
+
if (domain === 'sensor' || domain === 'binary_sensor')
|
|
320
|
+
score += 2;
|
|
321
|
+
if (/(tv|receiver|speaker|thermostat|lock|garage|camera|printer|router|iphone|espresso|appliance)/.test(title))
|
|
322
|
+
score += 6;
|
|
323
|
+
if (/(home assistant|plugin|add-on|addon|conversation|tts|stt|task|backup|hacs|theme|card)/.test(title))
|
|
324
|
+
score -= 8;
|
|
325
|
+
return score;
|
|
326
|
+
}
|
|
293
327
|
function semanticFactsLinkedToSources(sources, nodes, edges) {
|
|
294
328
|
const sourceIds = new Set(sources.map((source) => source.id));
|
|
295
329
|
const factIds = new Set(edges.filter((edge) => (edgeIsActive(edge)
|
|
@@ -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, HomeGraphMapHaFilterInput, HomeGraphMapInput, HomeGraphMapNode, HomeGraphMapResult, HomeGraphNodeKind, HomeGraphObjectInput, HomeGraphObjectKind, HomeGraphPageAutomationOptions, HomeGraphPageListResult, HomeGraphProjectionInput, HomeGraphProjectionResult, HomeGraphReindexResult, HomeGraphRelation, HomeGraphResetResult, 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, HomeGraphPageListResult, HomeGraphProjectionInput, HomeGraphProjectionResult, HomeGraphReindexResult, HomeGraphRelation, HomeGraphResetInput, HomeGraphResetResult, 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,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,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,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { KnowledgeStore } from '../store.js';
|
|
2
|
+
import type { KnowledgeNodeRecord } from '../types.js';
|
|
3
|
+
export declare function linkHomeGraphSnapshotObjectReferences(store: KnowledgeStore, input: {
|
|
4
|
+
readonly spaceId: string;
|
|
5
|
+
readonly installationId: string;
|
|
6
|
+
readonly node: KnowledgeNodeRecord;
|
|
7
|
+
readonly object: {
|
|
8
|
+
readonly deviceId?: string;
|
|
9
|
+
readonly areaId?: string;
|
|
10
|
+
readonly integrationId?: string;
|
|
11
|
+
};
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
export declare function linkHomeGraphNodeReference(store: KnowledgeStore, input: {
|
|
14
|
+
readonly spaceId: string;
|
|
15
|
+
readonly installationId: string;
|
|
16
|
+
readonly fromId: string;
|
|
17
|
+
readonly relation: string;
|
|
18
|
+
readonly toKind: string;
|
|
19
|
+
readonly toObjectId: string;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=link-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-node.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/link-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,wBAAsB,qCAAqC,CACzD,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE;IACL,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5G,GACA,OAAO,CAAC,IAAI,CAAC,CA4Bf;AAED,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE;IACL,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GACA,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { buildHomeGraphMetadata, homeGraphNodeId } from './helpers.js';
|
|
2
|
+
export async function linkHomeGraphSnapshotObjectReferences(store, input) {
|
|
3
|
+
if (input.object.deviceId && input.node.kind !== 'ha_device') {
|
|
4
|
+
await linkHomeGraphNodeReference(store, {
|
|
5
|
+
...input,
|
|
6
|
+
fromId: input.node.id,
|
|
7
|
+
relation: 'belongs_to_device',
|
|
8
|
+
toKind: 'ha_device',
|
|
9
|
+
toObjectId: input.object.deviceId,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
if (input.object.areaId) {
|
|
13
|
+
await linkHomeGraphNodeReference(store, {
|
|
14
|
+
...input,
|
|
15
|
+
fromId: input.node.id,
|
|
16
|
+
relation: 'located_in',
|
|
17
|
+
toKind: 'ha_area',
|
|
18
|
+
toObjectId: input.object.areaId,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (input.object.integrationId) {
|
|
22
|
+
await linkHomeGraphNodeReference(store, {
|
|
23
|
+
...input,
|
|
24
|
+
fromId: input.node.id,
|
|
25
|
+
relation: 'connected_via',
|
|
26
|
+
toKind: 'ha_integration',
|
|
27
|
+
toObjectId: input.object.integrationId,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export async function linkHomeGraphNodeReference(store, input) {
|
|
32
|
+
const toId = homeGraphNodeId(input.spaceId, input.toKind, input.toObjectId);
|
|
33
|
+
if (input.fromId === toId)
|
|
34
|
+
return;
|
|
35
|
+
if (!store.getNode(toId))
|
|
36
|
+
return;
|
|
37
|
+
await store.upsertEdge({
|
|
38
|
+
fromKind: 'node',
|
|
39
|
+
fromId: input.fromId,
|
|
40
|
+
toKind: 'node',
|
|
41
|
+
toId,
|
|
42
|
+
relation: input.relation,
|
|
43
|
+
metadata: buildHomeGraphMetadata(input.spaceId, input.installationId),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { KnowledgeStore } from '../store.js';
|
|
2
|
+
import type { HomeGraphResetInput, HomeGraphResetResult } from './types.js';
|
|
3
|
+
export declare function resetHomeGraphSpace(store: KnowledgeStore, input: HomeGraphResetInput): Promise<HomeGraphResetResult>;
|
|
4
|
+
//# sourceMappingURL=reset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/reset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE5E,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAM/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolveReadableHomeGraphSpace } from './space-selection.js';
|
|
2
|
+
export async function resetHomeGraphSpace(store, input) {
|
|
3
|
+
await store.init();
|
|
4
|
+
const { spaceId, installationId } = resolveReadableHomeGraphSpace(store, input);
|
|
5
|
+
const dryRun = input.dryRun === true;
|
|
6
|
+
const deleted = await store.deleteKnowledgeSpace(spaceId, { dryRun });
|
|
7
|
+
return { ok: true, spaceId, installationId, dryRun, deleted, artifactsDeleted: false };
|
|
8
|
+
}
|
|
@@ -3,12 +3,13 @@ import type { KnowledgeStore } from '../store.js';
|
|
|
3
3
|
import type { KnowledgeEdgeRecord, KnowledgeIssueRecord, KnowledgeNodeRecord, KnowledgeSourceRecord } from '../types.js';
|
|
4
4
|
import { type HomeGraphReviewResult } from './review.js';
|
|
5
5
|
import type { KnowledgeSemanticService } from '../semantic/index.js';
|
|
6
|
-
import type { HomeGraphAskInput, HomeGraphAskResult, HomeGraphDevicePassportResult, HomeGraphExport, HomeGraphIngestArtifactInput, HomeGraphIngestNoteInput, HomeGraphIngestResult, HomeGraphIngestUrlInput, HomeGraphLinkInput, HomeGraphLinkResult, HomeGraphMapInput, HomeGraphMapResult, HomeGraphProjectionInput, HomeGraphProjectionResult, HomeGraphPageListResult, HomeGraphReindexInput, HomeGraphReindexResult, HomeGraphResetResult, HomeGraphReviewInput, HomeGraphSpaceInput, HomeGraphSnapshotInput, HomeGraphStatus, HomeGraphSyncResult } from './types.js';
|
|
6
|
+
import type { HomeGraphAskInput, HomeGraphAskResult, HomeGraphDevicePassportResult, HomeGraphExport, HomeGraphIngestArtifactInput, HomeGraphIngestNoteInput, HomeGraphIngestResult, HomeGraphIngestUrlInput, HomeGraphLinkInput, HomeGraphLinkResult, HomeGraphMapInput, HomeGraphMapResult, HomeGraphProjectionInput, HomeGraphProjectionResult, HomeGraphPageListResult, HomeGraphReindexInput, HomeGraphReindexResult, HomeGraphResetInput, HomeGraphResetResult, HomeGraphReviewInput, HomeGraphSpaceInput, HomeGraphSnapshotInput, HomeGraphStatus, HomeGraphSyncResult } from './types.js';
|
|
7
7
|
export declare class HomeGraphService {
|
|
8
8
|
private readonly store;
|
|
9
9
|
private readonly artifactStore;
|
|
10
10
|
private readonly options;
|
|
11
11
|
private activeReindex;
|
|
12
|
+
private pendingSyncSelfImprove;
|
|
12
13
|
constructor(store: KnowledgeStore, artifactStore: ArtifactStore, options?: {
|
|
13
14
|
readonly semanticService?: KnowledgeSemanticService;
|
|
14
15
|
});
|
|
@@ -122,15 +123,15 @@ export declare class HomeGraphService {
|
|
|
122
123
|
readonly extractions: number;
|
|
123
124
|
};
|
|
124
125
|
}>;
|
|
125
|
-
resetSpace(input:
|
|
126
|
+
resetSpace(input: HomeGraphResetInput): Promise<HomeGraphResetResult>;
|
|
126
127
|
private ingestCreatedArtifact;
|
|
127
128
|
private extractArtifact;
|
|
128
129
|
private autoLinkExistingSources;
|
|
129
130
|
private upsertHomeNode;
|
|
130
131
|
private upsertSnapshotObjects;
|
|
131
132
|
private linkSnapshotObjectRelations;
|
|
132
|
-
private tryLinkNode;
|
|
133
133
|
private refreshQualityIssues;
|
|
134
|
+
private scheduleSyncSelfImprovement;
|
|
134
135
|
private enrichSpaceSources;
|
|
135
136
|
private enrichAndImproveSource;
|
|
136
137
|
private resolveLinkSource;
|
|
@@ -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;AAI9D,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;AAO9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,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;AAI9D,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;AAO9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAiCrE,OAAO,KAAK,EACV,iBAAiB,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,eAAe,EACrF,4BAA4B,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,uBAAuB,EAC5E,kBAAkB,EAAE,mBAAmB,EACjE,iBAAiB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,yBAAyB,EAC1F,uBAAuB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,mBAAmB,EAC5J,sBAAsB,EAAE,eAAe,EAAE,mBAAmB,EAC7D,MAAM,YAAY,CAAC;AAEpB,qBAAa,gBAA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