@pellux/goodvibes-sdk 0.26.11 → 0.27.1
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 +3110 -4
- package/dist/_internal/contracts/generated/foundation-metadata.d.ts +2 -2
- package/dist/_internal/contracts/generated/foundation-metadata.js +2 -2
- package/dist/_internal/contracts/generated/operator-contract.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-contract.js +3110 -4
- package/dist/_internal/contracts/generated/operator-method-ids.d.ts +1 -1
- package/dist/_internal/contracts/generated/operator-method-ids.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-method-ids.js +8 -0
- package/dist/_internal/platform/control-plane/method-catalog-knowledge.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/method-catalog-knowledge.js +101 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-knowledge.d.ts +1 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-knowledge.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/operator-contract-schemas-knowledge.js +1 -1
- package/dist/_internal/platform/control-plane/operator-contract-schemas-project-planning.d.ts +8 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-project-planning.d.ts.map +1 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-project-planning.js +135 -0
- package/dist/_internal/platform/daemon/facade-composition.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/facade-composition.js +2 -0
- package/dist/_internal/platform/daemon/facade-types.d.ts +2 -1
- package/dist/_internal/platform/daemon/facade-types.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/home-graph-routes.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/home-graph-routes.js +39 -22
- package/dist/_internal/platform/daemon/http/project-planning-routes.d.ts +18 -0
- package/dist/_internal/platform/daemon/http/project-planning-routes.d.ts.map +1 -0
- package/dist/_internal/platform/daemon/http/project-planning-routes.js +68 -0
- package/dist/_internal/platform/daemon/http/router.d.ts +4 -1
- package/dist/_internal/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/router.js +18 -0
- package/dist/_internal/platform/daemon/types.d.ts +2 -1
- package/dist/_internal/platform/daemon/types.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/helpers.d.ts +2 -0
- package/dist/_internal/platform/knowledge/home-graph/helpers.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/helpers.js +17 -2
- package/dist/_internal/platform/knowledge/home-graph/search.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/search.js +142 -14
- package/dist/_internal/platform/knowledge/home-graph/service.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/home-graph/service.js +10 -8
- package/dist/_internal/platform/knowledge/home-graph/space-selection.d.ts +7 -0
- package/dist/_internal/platform/knowledge/home-graph/space-selection.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/home-graph/space-selection.js +36 -0
- package/dist/_internal/platform/knowledge/index.d.ts +3 -1
- package/dist/_internal/platform/knowledge/index.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/index.js +2 -1
- package/dist/_internal/platform/knowledge/project-planning/helpers.d.ts +17 -0
- package/dist/_internal/platform/knowledge/project-planning/helpers.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/project-planning/helpers.js +65 -0
- package/dist/_internal/platform/knowledge/project-planning/index.d.ts +6 -0
- package/dist/_internal/platform/knowledge/project-planning/index.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/project-planning/index.js +3 -0
- package/dist/_internal/platform/knowledge/project-planning/readiness.d.ts +3 -0
- package/dist/_internal/platform/knowledge/project-planning/readiness.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/project-planning/readiness.js +124 -0
- package/dist/_internal/platform/knowledge/project-planning/service.d.ts +25 -0
- package/dist/_internal/platform/knowledge/project-planning/service.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/project-planning/service.js +259 -0
- package/dist/_internal/platform/knowledge/project-planning/types.d.ts +203 -0
- package/dist/_internal/platform/knowledge/project-planning/types.d.ts.map +1 -0
- package/dist/_internal/platform/knowledge/project-planning/types.js +1 -0
- package/dist/_internal/platform/knowledge/spaces.d.ts +4 -0
- package/dist/_internal/platform/knowledge/spaces.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/spaces.js +10 -0
- package/dist/_internal/platform/runtime/services.d.ts +2 -1
- package/dist/_internal/platform/runtime/services.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/services.js +5 -1
- package/dist/_internal/platform/version.js +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import { renderHomeGraphMap } from './rendering.js';
|
|
|
8
8
|
import { generateAutomaticHomeGraphPages, generateHomeGraphPacket, generateHomeGraphRoomPage, refreshHomeGraphDevicePassport, } from './generated-pages.js';
|
|
9
9
|
import { reindexHomeGraphSources } from './reindex.js';
|
|
10
10
|
import { readHomeGraphSearchState, scoreHomeGraphResults, selectHomeGraphExtractionRepairCandidates, } from './search.js';
|
|
11
|
+
import { resolveReadableHomeGraphSpace } from './space-selection.js';
|
|
11
12
|
import { HOME_GRAPH_CAPABILITIES } from './types.js';
|
|
12
13
|
export class HomeGraphService {
|
|
13
14
|
store;
|
|
@@ -18,7 +19,7 @@ export class HomeGraphService {
|
|
|
18
19
|
}
|
|
19
20
|
async status(input = {}) {
|
|
20
21
|
await this.store.init();
|
|
21
|
-
const { spaceId, installationId } =
|
|
22
|
+
const { spaceId, installationId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
22
23
|
const state = readHomeGraphState(this.store, spaceId);
|
|
23
24
|
const snapshotSources = state.sources
|
|
24
25
|
.filter((source) => source.metadata.homeGraphSourceKind === 'snapshot')
|
|
@@ -199,7 +200,7 @@ export class HomeGraphService {
|
|
|
199
200
|
}
|
|
200
201
|
async ask(input) {
|
|
201
202
|
await this.store.init();
|
|
202
|
-
const { spaceId, installationId } =
|
|
203
|
+
const { spaceId, installationId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
203
204
|
let state = readHomeGraphSearchState(this.store, spaceId);
|
|
204
205
|
if (await this.repairWeakExtractionsForAsk(spaceId, installationId, input.query, state) > 0) {
|
|
205
206
|
state = readHomeGraphSearchState(this.store, spaceId);
|
|
@@ -224,7 +225,7 @@ export class HomeGraphService {
|
|
|
224
225
|
}
|
|
225
226
|
async reindex(input = {}) {
|
|
226
227
|
await this.store.init();
|
|
227
|
-
const { spaceId, installationId } =
|
|
228
|
+
const { spaceId, installationId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
228
229
|
const state = readHomeGraphSearchState(this.store, spaceId);
|
|
229
230
|
return reindexHomeGraphSources({
|
|
230
231
|
spaceId,
|
|
@@ -284,7 +285,8 @@ export class HomeGraphService {
|
|
|
284
285
|
});
|
|
285
286
|
}
|
|
286
287
|
async listIssues(input) {
|
|
287
|
-
|
|
288
|
+
await this.store.init();
|
|
289
|
+
const { spaceId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
288
290
|
const limit = Math.max(1, input.limit ?? 100);
|
|
289
291
|
const issues = readHomeGraphState(this.store, spaceId).issues
|
|
290
292
|
.filter((issue) => !input.status || issue.status === input.status)
|
|
@@ -300,12 +302,12 @@ export class HomeGraphService {
|
|
|
300
302
|
}
|
|
301
303
|
async listSources(input = {}) {
|
|
302
304
|
await this.store.init();
|
|
303
|
-
const { spaceId } =
|
|
305
|
+
const { spaceId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
304
306
|
return { ok: true, spaceId, sources: readHomeGraphState(this.store, spaceId).sources.slice(0, Math.max(1, input.limit ?? 100)) };
|
|
305
307
|
}
|
|
306
308
|
async browse(input = {}) {
|
|
307
309
|
await this.store.init();
|
|
308
|
-
const { spaceId } =
|
|
310
|
+
const { spaceId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
309
311
|
const limit = Math.max(1, input.limit ?? 250);
|
|
310
312
|
const state = readHomeGraphState(this.store, spaceId);
|
|
311
313
|
return {
|
|
@@ -319,7 +321,7 @@ export class HomeGraphService {
|
|
|
319
321
|
}
|
|
320
322
|
async map(input = {}) {
|
|
321
323
|
await this.store.init();
|
|
322
|
-
const { spaceId } =
|
|
324
|
+
const { spaceId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
323
325
|
return renderHomeGraphMap(renderHomeGraphState(this.store, spaceId, 'Home Graph Map'), {
|
|
324
326
|
limit: input.limit,
|
|
325
327
|
includeSources: input.includeSources,
|
|
@@ -327,7 +329,7 @@ export class HomeGraphService {
|
|
|
327
329
|
}
|
|
328
330
|
async exportSpace(input = {}) {
|
|
329
331
|
await this.store.init();
|
|
330
|
-
const { spaceId, installationId } =
|
|
332
|
+
const { spaceId, installationId } = resolveReadableHomeGraphSpace(this.store, input);
|
|
331
333
|
const state = readHomeGraphState(this.store, spaceId);
|
|
332
334
|
return {
|
|
333
335
|
version: 1,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { KnowledgeStore } from '../store.js';
|
|
2
|
+
import type { HomeGraphSpaceInput } from './types.js';
|
|
3
|
+
export declare function resolveReadableHomeGraphSpace(store: KnowledgeStore, input?: HomeGraphSpaceInput): {
|
|
4
|
+
readonly spaceId: string;
|
|
5
|
+
readonly installationId: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=space-selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space-selection.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/home-graph/space-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,cAAc,EACrB,KAAK,GAAE,mBAAwB,GAC9B;IACD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC,CAQA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getKnowledgeSpaceId } from '../spaces.js';
|
|
2
|
+
import { homeAssistantSpaceComponent, resolveHomeGraphSpace, sameHomeAssistantSpace } from './helpers.js';
|
|
3
|
+
export function resolveReadableHomeGraphSpace(store, input = {}) {
|
|
4
|
+
const resolved = resolveHomeGraphSpace(input);
|
|
5
|
+
const inferred = inferHomeGraphSpace(store, resolved.spaceId, hasExplicitSpace(input));
|
|
6
|
+
if (!inferred)
|
|
7
|
+
return resolved;
|
|
8
|
+
return {
|
|
9
|
+
spaceId: inferred,
|
|
10
|
+
installationId: homeAssistantSpaceComponent(inferred) ?? resolved.installationId,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function hasExplicitSpace(input) {
|
|
14
|
+
return hasText(input.installationId) || hasText(input.knowledgeSpaceId);
|
|
15
|
+
}
|
|
16
|
+
function inferHomeGraphSpace(store, requestedSpaceId, requireRequestedSpaceMatch) {
|
|
17
|
+
const candidates = new Map();
|
|
18
|
+
for (const record of [
|
|
19
|
+
...store.listSources(10_000),
|
|
20
|
+
...store.listNodes(10_000),
|
|
21
|
+
...store.listIssues(10_000),
|
|
22
|
+
...store.listExtractions(10_000),
|
|
23
|
+
]) {
|
|
24
|
+
const spaceId = getKnowledgeSpaceId(record);
|
|
25
|
+
if (!homeAssistantSpaceComponent(spaceId))
|
|
26
|
+
continue;
|
|
27
|
+
if (requireRequestedSpaceMatch && !sameHomeAssistantSpace(spaceId, requestedSpaceId))
|
|
28
|
+
continue;
|
|
29
|
+
candidates.set(spaceId, Math.max(candidates.get(spaceId) ?? 0, record.updatedAt ?? record.createdAt ?? 0));
|
|
30
|
+
}
|
|
31
|
+
return [...candidates.entries()]
|
|
32
|
+
.sort((left, right) => right[1] - left[1] || left[0].localeCompare(right[0]))[0]?.[0];
|
|
33
|
+
}
|
|
34
|
+
function hasText(value) {
|
|
35
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
36
|
+
}
|
|
@@ -3,13 +3,15 @@ export { extractKnowledgeArtifact } from './extractors.js';
|
|
|
3
3
|
export { collectBrowserKnowledge, discoverBrowserKnowledgeProfiles, ingestBrowserKnowledge, listBrowserKinds, readBrowserKnowledgeProfile, } from './browser-history/index.js';
|
|
4
4
|
export { KnowledgeGraphqlService, getKnowledgeGraphqlSchemaText, inspectKnowledgeGraphqlAccess } from './graphql.js';
|
|
5
5
|
export type { KnowledgeGraphqlAccessProfile, KnowledgeGraphqlExecuteInput } from './graphql.js';
|
|
6
|
-
export { DEFAULT_KNOWLEDGE_SPACE_ID, HOME_ASSISTANT_KNOWLEDGE_SPACE_PREFIX, getKnowledgeSpaceId, homeAssistantKnowledgeSpaceId, isHomeAssistantKnowledgeSpace, isInKnowledgeSpace, knowledgeSpaceMetadata, normalizeHomeAssistantInstallationId, normalizeKnowledgeSpaceId, withKnowledgeSpace, } from './spaces.js';
|
|
6
|
+
export { DEFAULT_KNOWLEDGE_SPACE_ID, HOME_ASSISTANT_KNOWLEDGE_SPACE_PREFIX, PROJECT_KNOWLEDGE_SPACE_PREFIX, getKnowledgeSpaceId, homeAssistantKnowledgeSpaceId, isHomeAssistantKnowledgeSpace, isInKnowledgeSpace, isProjectKnowledgeSpace, knowledgeSpaceMetadata, normalizeProjectId, normalizeHomeAssistantInstallationId, normalizeKnowledgeSpaceId, projectKnowledgeSpaceId, withKnowledgeSpace, } from './spaces.js';
|
|
7
7
|
export type { KnowledgeSpaceId } from './spaces.js';
|
|
8
8
|
export { generatedKnowledgeCanonicalUri, generatedKnowledgeSourceId, isGeneratedKnowledgeSource, materializeGeneratedKnowledgeProjection, } from './generated-projections.js';
|
|
9
9
|
export type { GeneratedKnowledgeProjectionInput, GeneratedKnowledgeProjectionResult, } from './generated-projections.js';
|
|
10
10
|
export { renderKnowledgeMap } from './map.js';
|
|
11
11
|
export type { KnowledgeMapRenderOptions, KnowledgeMapRenderState } from './map.js';
|
|
12
12
|
export { HomeGraphService, HOME_GRAPH_NODE_KINDS, HOME_GRAPH_RELATIONS } from './home-graph/index.js';
|
|
13
|
+
export { ProjectPlanningService, evaluateProjectPlanningReadiness, projectPlanningCanonicalUri, projectPlanningProjectIdFromPath, projectPlanningSourceId, resolveProjectPlanningSpace, } from './project-planning/index.js';
|
|
14
|
+
export type { ProjectPlanningAgentAssignment, ProjectPlanningAmbiguity, ProjectPlanningDecision, ProjectPlanningDecisionRecordInput, ProjectPlanningDecisionResult, ProjectPlanningDecisionsResult, ProjectPlanningDecisionStatus, ProjectPlanningDependency, ProjectPlanningEvaluateInput, ProjectPlanningEvaluation, ProjectPlanningGap, ProjectPlanningGapKind, ProjectPlanningGapSeverity, ProjectPlanningGateStatus, ProjectPlanningLanguageArtifact, ProjectPlanningLanguageResult, ProjectPlanningLanguageUpsertInput, ProjectPlanningQuestion, ProjectPlanningQuestionStatus, ProjectPlanningReadiness, ProjectPlanningServiceOptions, ProjectPlanningSpaceInput, ProjectPlanningState, ProjectPlanningStateResult, ProjectPlanningStateUpsertInput, ProjectPlanningStatus, ProjectPlanningTask, ProjectPlanningTaskStatus, ProjectPlanningTerm, ProjectPlanningVerificationGate, } from './project-planning/index.js';
|
|
13
15
|
export type { HomeGraphAskInput, HomeGraphAskResult, HomeGraphDevicePassportResult, HomeGraphExport, HomeGraphGeneratedPagesSummary, HomeGraphIngestArtifactInput, HomeGraphIngestNoteInput, HomeGraphIngestResult, HomeGraphIngestUrlInput, HomeGraphKnowledgeTarget, HomeGraphLinkInput, HomeGraphLinkResult, HomeGraphMapEdge, HomeGraphMapInput, HomeGraphMapNode, HomeGraphMapResult, HomeGraphNodeKind, HomeGraphObjectInput, HomeGraphObjectKind, HomeGraphPageAutomationOptions, HomeGraphProjectionInput, HomeGraphProjectionResult, HomeGraphRelation, HomeGraphReviewInput, HomeGraphSnapshotInput, HomeGraphStatus, HomeGraphSyncResult, } from './home-graph/index.js';
|
|
14
16
|
export { createKnowledgeApi } from './knowledge-api.js';
|
|
15
17
|
export { createKnowledgeSchema, getKnowledgeSchemaStatements, knowledgeNowMs, loadKnowledgeStoreSnapshot, parseKnowledgeJsonValue, renderKnowledgeSchemaSql, resolveKnowledgeDbPathFromControlPlaneDir, stabilizeKnowledgeText, uniqKnowledgeValues, } from './persistence.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/knowledge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,uCAAuC,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AACrH,YAAY,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EACL,0BAA0B,EAC1B,qCAAqC,EACrC,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,kBAAkB,EAClB,sBAAsB,EACtB,oCAAoC,EACpC,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAC1B,uCAAuC,GACxC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,YAAY,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAu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AiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,+BAA+B,EAC/B,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/knowledge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,uCAAuC,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AACrH,YAAY,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EACL,0BAA0B,EAC1B,qCAAqC,EACrC,8BAA8B,EAC9B,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,oCAAoC,EACpC,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM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B,eAAe,EACf,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC"}
|
|
@@ -2,10 +2,11 @@ export { KnowledgeConnectorRegistry, createDefaultKnowledgeConnectorRegistry } f
|
|
|
2
2
|
export { extractKnowledgeArtifact } from './extractors.js';
|
|
3
3
|
export { collectBrowserKnowledge, discoverBrowserKnowledgeProfiles, ingestBrowserKnowledge, listBrowserKinds, readBrowserKnowledgeProfile, } from './browser-history/index.js';
|
|
4
4
|
export { KnowledgeGraphqlService, getKnowledgeGraphqlSchemaText, inspectKnowledgeGraphqlAccess } from './graphql.js';
|
|
5
|
-
export { DEFAULT_KNOWLEDGE_SPACE_ID, HOME_ASSISTANT_KNOWLEDGE_SPACE_PREFIX, getKnowledgeSpaceId, homeAssistantKnowledgeSpaceId, isHomeAssistantKnowledgeSpace, isInKnowledgeSpace, knowledgeSpaceMetadata, normalizeHomeAssistantInstallationId, normalizeKnowledgeSpaceId, withKnowledgeSpace, } from './spaces.js';
|
|
5
|
+
export { DEFAULT_KNOWLEDGE_SPACE_ID, HOME_ASSISTANT_KNOWLEDGE_SPACE_PREFIX, PROJECT_KNOWLEDGE_SPACE_PREFIX, getKnowledgeSpaceId, homeAssistantKnowledgeSpaceId, isHomeAssistantKnowledgeSpace, isInKnowledgeSpace, isProjectKnowledgeSpace, knowledgeSpaceMetadata, normalizeProjectId, normalizeHomeAssistantInstallationId, normalizeKnowledgeSpaceId, projectKnowledgeSpaceId, withKnowledgeSpace, } from './spaces.js';
|
|
6
6
|
export { generatedKnowledgeCanonicalUri, generatedKnowledgeSourceId, isGeneratedKnowledgeSource, materializeGeneratedKnowledgeProjection, } from './generated-projections.js';
|
|
7
7
|
export { renderKnowledgeMap } from './map.js';
|
|
8
8
|
export { HomeGraphService, HOME_GRAPH_NODE_KINDS, HOME_GRAPH_RELATIONS } from './home-graph/index.js';
|
|
9
|
+
export { ProjectPlanningService, evaluateProjectPlanningReadiness, projectPlanningCanonicalUri, projectPlanningProjectIdFromPath, projectPlanningSourceId, resolveProjectPlanningSpace, } from './project-planning/index.js';
|
|
9
10
|
export { createKnowledgeApi } from './knowledge-api.js';
|
|
10
11
|
export { createKnowledgeSchema, getKnowledgeSchemaStatements, knowledgeNowMs, loadKnowledgeStoreSnapshot, parseKnowledgeJsonValue, renderKnowledgeSchemaSql, resolveKnowledgeDbPathFromControlPlaneDir, stabilizeKnowledgeText, uniqKnowledgeValues, } from './persistence.js';
|
|
11
12
|
export { KnowledgeProjectionService } from './projections.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ProjectPlanningSpaceInput } from './types.js';
|
|
2
|
+
export declare const PROJECT_PLANNING_CONNECTOR_ID = "goodvibes-project-planning";
|
|
3
|
+
export declare const PROJECT_PLANNING_TAG = "project-planning";
|
|
4
|
+
export type ProjectPlanningArtifactKind = 'state' | 'decision' | 'language';
|
|
5
|
+
export interface ResolvedProjectPlanningSpace {
|
|
6
|
+
readonly projectId: string;
|
|
7
|
+
readonly knowledgeSpaceId: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function projectPlanningProjectIdFromPath(path: string): string;
|
|
10
|
+
export declare function resolveProjectPlanningSpace(input?: ProjectPlanningSpaceInput, defaultProjectId?: string): ResolvedProjectPlanningSpace;
|
|
11
|
+
export declare function projectIdFromSpace(spaceId: string): string;
|
|
12
|
+
export declare function projectPlanningCanonicalUri(spaceId: string, kind: ProjectPlanningArtifactKind, id: string): string;
|
|
13
|
+
export declare function projectPlanningSourceId(spaceId: string, kind: ProjectPlanningArtifactKind, id: string): string;
|
|
14
|
+
export declare function projectPlanningArtifactSummary(kind: ProjectPlanningArtifactKind, value: unknown): string;
|
|
15
|
+
export declare function stablePlanningId(prefix: string, value: string): string;
|
|
16
|
+
export declare function readPlanningMetadataObject(value: unknown): Record<string, unknown>;
|
|
17
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/project-planning/helpers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAGV,yBAAyB,EAE1B,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AAC1E,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAEvD,MAAM,MAAM,2BAA2B,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED,wBAAgB,2BAA2B,CACzC,KAAK,GAAE,yBAA8B,EACrC,gBAAgB,SAAY,GAC3B,4BAA4B,CAe9B;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,2BAA2B,EACjC,EAAE,EAAE,MAAM,GACT,MAAM,CAER;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,2BAA2B,EACjC,EAAE,EAAE,MAAM,GACT,MAAM,CAGR;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAWxG;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIlF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { basename, resolve } from 'node:path';
|
|
3
|
+
import { PROJECT_KNOWLEDGE_SPACE_PREFIX, isProjectKnowledgeSpace, normalizeKnowledgeSpaceId, normalizeProjectId, normalizeSpaceComponent, projectKnowledgeSpaceId, } from '../spaces.js';
|
|
4
|
+
export const PROJECT_PLANNING_CONNECTOR_ID = 'goodvibes-project-planning';
|
|
5
|
+
export const PROJECT_PLANNING_TAG = 'project-planning';
|
|
6
|
+
export function projectPlanningProjectIdFromPath(path) {
|
|
7
|
+
const resolved = resolve(path);
|
|
8
|
+
const name = normalizeSpaceComponent(basename(resolved) || 'project');
|
|
9
|
+
const digest = createHash('sha256').update(resolved).digest('hex').slice(0, 10);
|
|
10
|
+
return `${name}-${digest}`;
|
|
11
|
+
}
|
|
12
|
+
export function resolveProjectPlanningSpace(input = {}, defaultProjectId = 'default') {
|
|
13
|
+
const explicitSpace = typeof input.knowledgeSpaceId === 'string'
|
|
14
|
+
? normalizeKnowledgeSpaceId(input.knowledgeSpaceId)
|
|
15
|
+
: '';
|
|
16
|
+
if (explicitSpace && isProjectKnowledgeSpace(explicitSpace)) {
|
|
17
|
+
return {
|
|
18
|
+
knowledgeSpaceId: explicitSpace,
|
|
19
|
+
projectId: projectIdFromSpace(explicitSpace),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const projectId = normalizeProjectId(input.projectId ?? defaultProjectId);
|
|
23
|
+
return {
|
|
24
|
+
projectId,
|
|
25
|
+
knowledgeSpaceId: projectKnowledgeSpaceId(projectId),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function projectIdFromSpace(spaceId) {
|
|
29
|
+
const normalized = normalizeKnowledgeSpaceId(spaceId);
|
|
30
|
+
if (!normalized.startsWith(PROJECT_KNOWLEDGE_SPACE_PREFIX)) {
|
|
31
|
+
return normalizeProjectId(normalized);
|
|
32
|
+
}
|
|
33
|
+
return normalizeProjectId(normalized.slice(PROJECT_KNOWLEDGE_SPACE_PREFIX.length));
|
|
34
|
+
}
|
|
35
|
+
export function projectPlanningCanonicalUri(spaceId, kind, id) {
|
|
36
|
+
return `goodvibes://planning/${encodeURIComponent(spaceId)}/${kind}/${encodeURIComponent(id)}`;
|
|
37
|
+
}
|
|
38
|
+
export function projectPlanningSourceId(spaceId, kind, id) {
|
|
39
|
+
const digest = createHash('sha256').update(`${spaceId}:${kind}:${id}`).digest('hex').slice(0, 16);
|
|
40
|
+
return `project-planning-${kind}-${digest}`;
|
|
41
|
+
}
|
|
42
|
+
export function projectPlanningArtifactSummary(kind, value) {
|
|
43
|
+
if (kind === 'state') {
|
|
44
|
+
const state = value;
|
|
45
|
+
return state.goal ? `Planning state for ${state.goal}` : 'Project planning state.';
|
|
46
|
+
}
|
|
47
|
+
if (kind === 'decision') {
|
|
48
|
+
const decision = value;
|
|
49
|
+
return decision.decision ? `${decision.title ?? 'Decision'}: ${decision.decision}` : 'Project planning decision record.';
|
|
50
|
+
}
|
|
51
|
+
const language = value;
|
|
52
|
+
return `Project language artifact with ${language.terms?.length ?? 0} terms and ${language.ambiguities?.length ?? 0} resolved ambiguities.`;
|
|
53
|
+
}
|
|
54
|
+
export function stablePlanningId(prefix, value) {
|
|
55
|
+
const normalized = normalizeSpaceComponent(value);
|
|
56
|
+
if (normalized !== 'default')
|
|
57
|
+
return normalized;
|
|
58
|
+
const digest = createHash('sha256').update(value || prefix).digest('hex').slice(0, 10);
|
|
59
|
+
return `${prefix}-${digest}`;
|
|
60
|
+
}
|
|
61
|
+
export function readPlanningMetadataObject(value) {
|
|
62
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
63
|
+
? value
|
|
64
|
+
: {};
|
|
65
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ProjectPlanningService } from './service.js';
|
|
2
|
+
export type { ProjectPlanningServiceOptions } from './service.js';
|
|
3
|
+
export { PROJECT_PLANNING_CONNECTOR_ID, PROJECT_PLANNING_TAG, projectPlanningCanonicalUri, projectPlanningProjectIdFromPath, projectPlanningSourceId, resolveProjectPlanningSpace, } from './helpers.js';
|
|
4
|
+
export { evaluateProjectPlanningReadiness } from './readiness.js';
|
|
5
|
+
export type { ProjectPlanningAgentAssignment, ProjectPlanningAmbiguity, ProjectPlanningDecision, ProjectPlanningDecisionRecordInput, ProjectPlanningDecisionResult, ProjectPlanningDecisionsResult, ProjectPlanningDecisionStatus, ProjectPlanningDependency, ProjectPlanningEvaluateInput, ProjectPlanningEvaluation, ProjectPlanningGap, ProjectPlanningGapKind, ProjectPlanningGapSeverity, ProjectPlanningGateStatus, ProjectPlanningLanguageArtifact, ProjectPlanningLanguageResult, ProjectPlanningLanguageUpsertInput, ProjectPlanningQuestion, ProjectPlanningQuestionStatus, ProjectPlanningReadiness, ProjectPlanningSpaceInput, ProjectPlanningState, ProjectPlanningStateResult, ProjectPlanningStateUpsertInput, ProjectPlanningStatus, ProjectPlanningTask, ProjectPlanningTaskStatus, ProjectPlanningTerm, ProjectPlanningVerificationGate, } from './types.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/project-planning/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,YAAY,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,2BAA2B,EAC3B,gCAAgC,EAChC,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EACV,8BAA8B,EAC9B,wBAAwB,EACxB,uBAAuB,EACvB,kCAAkC,EAClC,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,+BAA+B,EAC/B,6BAA6B,EAC7B,kCAAkC,EAClC,uBAAuB,EACvB,6BAA6B,EAC7B,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,+BAA+B,EAC/B,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ProjectPlanningService } from './service.js';
|
|
2
|
+
export { PROJECT_PLANNING_CONNECTOR_ID, PROJECT_PLANNING_TAG, projectPlanningCanonicalUri, projectPlanningProjectIdFromPath, projectPlanningSourceId, resolveProjectPlanningSpace, } from './helpers.js';
|
|
3
|
+
export { evaluateProjectPlanningReadiness } from './readiness.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/project-planning/readiness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EAIzB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAiBpB,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,oBAAoB,GAAG,yBAAyB,CA2GvG"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const VAGUE_TERMS = [
|
|
2
|
+
'better',
|
|
3
|
+
'improve',
|
|
4
|
+
'improved',
|
|
5
|
+
'setup',
|
|
6
|
+
'integration',
|
|
7
|
+
'agent channel',
|
|
8
|
+
'remote',
|
|
9
|
+
'thing',
|
|
10
|
+
'stuff',
|
|
11
|
+
'etc',
|
|
12
|
+
'clean up',
|
|
13
|
+
'fix it',
|
|
14
|
+
];
|
|
15
|
+
export function evaluateProjectPlanningReadiness(state) {
|
|
16
|
+
const gaps = [];
|
|
17
|
+
const goal = state.goal.trim();
|
|
18
|
+
if (!goal) {
|
|
19
|
+
gaps.push(blockingQuestion('missing-goal', 'The plan needs a concrete goal before it can be executed.', 'What outcome should this plan produce?', 'A clear outcome lets the TUI inspect the right code and ask only relevant follow-up questions.', 'State the user-visible behavior or project change that should exist when the work is done.'));
|
|
20
|
+
}
|
|
21
|
+
if (!state.scope?.trim() && state.constraints.length === 0) {
|
|
22
|
+
gaps.push(blockingQuestion('missing-scope', 'The plan has no explicit boundary for what is included or excluded.', 'What is in scope, and what should be left out for this pass?', 'Scope boundaries prevent the planning loop from turning a focused change into unrelated work.', 'Define the first-pass scope and record do-later items separately.'));
|
|
23
|
+
}
|
|
24
|
+
for (const question of state.openQuestions) {
|
|
25
|
+
if ((question.status ?? 'open') === 'open') {
|
|
26
|
+
gaps.push({
|
|
27
|
+
id: `open-question:${question.id}`,
|
|
28
|
+
kind: 'open-question',
|
|
29
|
+
severity: 'blocking',
|
|
30
|
+
message: `Open planning question: ${question.prompt}`,
|
|
31
|
+
question,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const vagueTerm = firstVagueTerm(goal);
|
|
36
|
+
if (vagueTerm && state.answeredQuestions.length === 0 && state.decisions.length === 0) {
|
|
37
|
+
gaps.push(blockingQuestion('ambiguous-language', `The goal uses ambiguous language (${JSON.stringify(vagueTerm)}) without recorded clarification.`, `When you say ${JSON.stringify(vagueTerm)}, what concrete behavior should change?`, 'GoodVibes should challenge vague words before work starts so future agents do not implement the wrong thing.', 'Define the term in project language or replace it with concrete expected behavior.'));
|
|
38
|
+
}
|
|
39
|
+
if (goal && state.tasks.length === 0) {
|
|
40
|
+
gaps.push(blockingQuestion('missing-tasks', 'The plan has no decomposed tasks.', 'What are the smallest useful implementation tasks for this goal?', 'Task decomposition is what lets the TUI identify dependencies, parallel agent work, and verification gates.', 'Create task records with likely files, dependencies, and verification notes.'));
|
|
41
|
+
}
|
|
42
|
+
if (state.tasks.length > 1 && state.dependencies.length === 0) {
|
|
43
|
+
gaps.push({
|
|
44
|
+
id: 'missing-dependencies',
|
|
45
|
+
kind: 'missing-dependencies',
|
|
46
|
+
severity: 'advisory',
|
|
47
|
+
message: 'Multiple tasks exist but no dependency graph has been recorded.',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const tasksWithoutVerification = state.tasks
|
|
51
|
+
.filter((task) => (task.verification?.length ?? 0) === 0)
|
|
52
|
+
.map((task) => task.id);
|
|
53
|
+
const hasRequiredGate = state.verificationGates.some((gate) => gate.required !== false);
|
|
54
|
+
if (state.tasks.length > 0 && tasksWithoutVerification.length > 0 && !hasRequiredGate) {
|
|
55
|
+
gaps.push({
|
|
56
|
+
id: 'missing-verification',
|
|
57
|
+
kind: 'missing-verification',
|
|
58
|
+
severity: 'blocking',
|
|
59
|
+
message: 'The plan has tasks but no verification gates or per-task verification.',
|
|
60
|
+
question: {
|
|
61
|
+
id: 'verification-gates',
|
|
62
|
+
prompt: 'How should this plan prove that the work is correct?',
|
|
63
|
+
whyItMatters: 'Verification gates keep execution from ending at code changes that were never checked.',
|
|
64
|
+
recommendedAnswer: 'Record concrete tests, commands, manual checks, or release gates for the changed behavior.',
|
|
65
|
+
consequence: 'The plan should not be executable until verification exists.',
|
|
66
|
+
},
|
|
67
|
+
relatedTaskIds: tasksWithoutVerification,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const blocking = gaps.some((gap) => gap.severity === 'blocking');
|
|
71
|
+
if (!blocking && !state.executionApproved) {
|
|
72
|
+
gaps.push({
|
|
73
|
+
id: 'unapproved-execution',
|
|
74
|
+
kind: 'unapproved-execution',
|
|
75
|
+
severity: 'blocking',
|
|
76
|
+
message: 'The plan is structurally ready but has not been approved for execution.',
|
|
77
|
+
question: {
|
|
78
|
+
id: 'approve-execution',
|
|
79
|
+
prompt: 'Is this plan approved for execution?',
|
|
80
|
+
whyItMatters: 'The TUI owns user approval before local work or agent assignments begin.',
|
|
81
|
+
recommendedAnswer: 'Approve only after the goal, scope, tasks, dependencies, and verification gates look right.',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const readiness = readinessFromGaps(gaps);
|
|
86
|
+
return {
|
|
87
|
+
ok: true,
|
|
88
|
+
projectId: state.projectId,
|
|
89
|
+
knowledgeSpaceId: state.knowledgeSpaceId,
|
|
90
|
+
readiness,
|
|
91
|
+
gaps,
|
|
92
|
+
...(gaps[0]?.question ? { nextQuestion: gaps[0].question } : {}),
|
|
93
|
+
state: {
|
|
94
|
+
...state,
|
|
95
|
+
readiness,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function readinessFromGaps(gaps) {
|
|
100
|
+
if (gaps.length === 0)
|
|
101
|
+
return 'executable';
|
|
102
|
+
if (gaps.some((gap) => gap.severity === 'blocking'))
|
|
103
|
+
return 'needs-user-input';
|
|
104
|
+
return 'not-ready';
|
|
105
|
+
}
|
|
106
|
+
function firstVagueTerm(value) {
|
|
107
|
+
const normalized = value.toLowerCase();
|
|
108
|
+
return VAGUE_TERMS.find((term) => normalized.includes(term)) ?? null;
|
|
109
|
+
}
|
|
110
|
+
function blockingQuestion(kind, message, prompt, whyItMatters, recommendedAnswer) {
|
|
111
|
+
const question = {
|
|
112
|
+
id: kind,
|
|
113
|
+
prompt,
|
|
114
|
+
whyItMatters,
|
|
115
|
+
recommendedAnswer,
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
id: kind,
|
|
119
|
+
kind,
|
|
120
|
+
severity: 'blocking',
|
|
121
|
+
message,
|
|
122
|
+
question,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { KnowledgeStore } from '../store.js';
|
|
2
|
+
import type { ProjectPlanningDecisionRecordInput, ProjectPlanningDecisionResult, ProjectPlanningDecisionsResult, ProjectPlanningEvaluateInput, ProjectPlanningEvaluation, ProjectPlanningLanguageResult, ProjectPlanningLanguageUpsertInput, ProjectPlanningSpaceInput, ProjectPlanningStateResult, ProjectPlanningStateUpsertInput, ProjectPlanningStatus } from './types.js';
|
|
3
|
+
export interface ProjectPlanningServiceOptions {
|
|
4
|
+
readonly defaultProjectId?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class ProjectPlanningService {
|
|
7
|
+
private readonly store;
|
|
8
|
+
private readonly defaultProjectId;
|
|
9
|
+
constructor(store: KnowledgeStore, options?: ProjectPlanningServiceOptions);
|
|
10
|
+
status(input?: ProjectPlanningSpaceInput): Promise<ProjectPlanningStatus>;
|
|
11
|
+
getState(input?: ProjectPlanningSpaceInput & {
|
|
12
|
+
readonly planningId?: string;
|
|
13
|
+
}): Promise<ProjectPlanningStateResult>;
|
|
14
|
+
upsertState(input: ProjectPlanningStateUpsertInput): Promise<ProjectPlanningStateResult>;
|
|
15
|
+
evaluate(input?: ProjectPlanningEvaluateInput): Promise<ProjectPlanningEvaluation>;
|
|
16
|
+
listDecisions(input?: ProjectPlanningSpaceInput): Promise<ProjectPlanningDecisionsResult>;
|
|
17
|
+
recordDecision(input: ProjectPlanningDecisionRecordInput): Promise<ProjectPlanningDecisionResult>;
|
|
18
|
+
getLanguage(input?: ProjectPlanningSpaceInput): Promise<ProjectPlanningLanguageResult>;
|
|
19
|
+
upsertLanguage(input: ProjectPlanningLanguageUpsertInput): Promise<ProjectPlanningLanguageResult>;
|
|
20
|
+
private resolveSpace;
|
|
21
|
+
private sourcesForSpace;
|
|
22
|
+
private getArtifactSource;
|
|
23
|
+
private upsertArtifactSource;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/knowledge/project-planning/service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAa7C,OAAO,KAAK,EA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