semantic-atlas 0.3.0 → 1.0.0
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/.agents/skills/semantic-atlas/SKILL.md +134 -166
- package/.agents/skills/semantic-atlas/agents/openai.yaml +4 -0
- package/.agents/skills/semantic-atlas/references/observations.md +131 -0
- package/.agents/skills/semantic-atlas/scripts/query-context.mjs +110 -0
- package/.agents/skills/semantic-atlas-maintenance/SKILL.md +93 -0
- package/.agents/skills/semantic-atlas-maintenance/agents/openai.yaml +4 -0
- package/.agents/skills/semantic-atlas-maintenance/references/reconciliation.md +56 -0
- package/README.md +134 -239
- package/dist/application/map-application.d.ts +24 -0
- package/dist/application/map-application.d.ts.map +1 -0
- package/dist/application/map-application.js +134 -0
- package/dist/application/map-application.js.map +1 -0
- package/dist/cli/bin.js +6 -35
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/observation-commands.d.ts +16 -0
- package/dist/cli/observation-commands.d.ts.map +1 -0
- package/dist/cli/observation-commands.js +118 -0
- package/dist/cli/observation-commands.js.map +1 -0
- package/dist/cli/projection-writer.d.ts +2 -0
- package/dist/cli/projection-writer.d.ts.map +1 -0
- package/dist/cli/projection-writer.js +9 -0
- package/dist/cli/projection-writer.js.map +1 -0
- package/dist/cli/reconciliation-command.d.ts +7 -0
- package/dist/cli/reconciliation-command.d.ts.map +1 -0
- package/dist/cli/reconciliation-command.js +33 -0
- package/dist/cli/reconciliation-command.js.map +1 -0
- package/dist/cli/run-cli.d.ts +21 -0
- package/dist/cli/run-cli.d.ts.map +1 -0
- package/dist/cli/run-cli.js +299 -0
- package/dist/cli/run-cli.js.map +1 -0
- package/dist/contracts/cli.d.ts +166 -1211
- package/dist/contracts/cli.d.ts.map +1 -1
- package/dist/contracts/cli.js +2 -232
- package/dist/contracts/cli.js.map +1 -0
- package/dist/contracts/insights.d.ts +39 -1
- package/dist/contracts/insights.d.ts.map +1 -1
- package/dist/contracts/insights.js +2 -1
- package/dist/contracts/insights.js.map +1 -0
- package/dist/contracts/map.d.ts +154 -0
- package/dist/contracts/map.d.ts.map +1 -0
- package/dist/contracts/map.js +60 -0
- package/dist/contracts/map.js.map +1 -0
- package/dist/contracts/observation.d.ts +649 -0
- package/dist/contracts/observation.d.ts.map +1 -0
- package/dist/contracts/observation.js +140 -0
- package/dist/contracts/observation.js.map +1 -0
- package/dist/contracts/projection.d.ts +7 -0
- package/dist/contracts/projection.d.ts.map +1 -0
- package/dist/contracts/projection.js +2 -0
- package/dist/contracts/projection.js.map +1 -0
- package/dist/contracts/reconciliation.d.ts +40 -0
- package/dist/contracts/reconciliation.d.ts.map +1 -0
- package/dist/contracts/reconciliation.js +2 -0
- package/dist/contracts/reconciliation.js.map +1 -0
- package/dist/index.d.ts +7 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -9
- package/dist/index.js.map +1 -0
- package/dist/insights/insight-service.d.ts +14 -0
- package/dist/insights/insight-service.d.ts.map +1 -0
- package/dist/insights/insight-service.js +129 -0
- package/dist/insights/insight-service.js.map +1 -0
- package/dist/map/business-graph.d.ts +32 -0
- package/dist/map/business-graph.d.ts.map +1 -0
- package/dist/map/business-graph.js +122 -0
- package/dist/map/business-graph.js.map +1 -0
- package/dist/map/map-document-loader.d.ts +13 -0
- package/dist/map/map-document-loader.d.ts.map +1 -0
- package/dist/map/map-document-loader.js +86 -0
- package/dist/map/map-document-loader.js.map +1 -0
- package/dist/map/map-validator.d.ts +12 -0
- package/dist/map/map-validator.d.ts.map +1 -0
- package/dist/map/map-validator.js +322 -0
- package/dist/map/map-validator.js.map +1 -0
- package/dist/observations/observation-application.d.ts +23 -0
- package/dist/observations/observation-application.d.ts.map +1 -0
- package/dist/observations/observation-application.js +62 -0
- package/dist/observations/observation-application.js.map +1 -0
- package/dist/observations/observation-claim-manager.d.ts +13 -0
- package/dist/observations/observation-claim-manager.d.ts.map +1 -0
- package/dist/observations/observation-claim-manager.js +247 -0
- package/dist/observations/observation-claim-manager.js.map +1 -0
- package/dist/observations/observation-store.d.ts +43 -0
- package/dist/observations/observation-store.d.ts.map +1 -0
- package/dist/observations/observation-store.js +208 -0
- package/dist/observations/observation-store.js.map +1 -0
- package/dist/observations/repository-identity.d.ts +12 -0
- package/dist/observations/repository-identity.d.ts.map +1 -0
- package/dist/observations/repository-identity.js +108 -0
- package/dist/observations/repository-identity.js.map +1 -0
- package/dist/query/context-query-service.d.ts +15 -0
- package/dist/query/context-query-service.d.ts.map +1 -0
- package/dist/query/context-query-service.js +36 -0
- package/dist/query/context-query-service.js.map +1 -0
- package/dist/reconciliation/reconciliation-service.d.ts +10 -0
- package/dist/reconciliation/reconciliation-service.d.ts.map +1 -0
- package/dist/reconciliation/reconciliation-service.js +116 -0
- package/dist/reconciliation/reconciliation-service.js.map +1 -0
- package/dist/rendering/map-projector.d.ts +8 -0
- package/dist/rendering/map-projector.d.ts.map +1 -0
- package/dist/rendering/map-projector.js +386 -0
- package/dist/rendering/map-projector.js.map +1 -0
- package/dist/setup/managed-skill-installer.d.ts +60 -0
- package/dist/setup/managed-skill-installer.d.ts.map +1 -0
- package/dist/setup/managed-skill-installer.js +307 -0
- package/dist/setup/managed-skill-installer.js.map +1 -0
- package/dist/setup/package-identity.d.ts +6 -0
- package/dist/setup/package-identity.d.ts.map +1 -0
- package/dist/setup/package-identity.js +16 -0
- package/dist/setup/package-identity.js.map +1 -0
- package/dist/setup/package-upgrader.d.ts +10 -22
- package/dist/setup/package-upgrader.d.ts.map +1 -1
- package/dist/setup/package-upgrader.js +60 -76
- package/dist/setup/package-upgrader.js.map +1 -0
- package/docs/architecture.md +428 -0
- package/docs/evaluation.md +220 -174
- package/docs/index.md +27 -40
- package/docs/map-format.md +224 -0
- package/docs/observations.md +175 -0
- package/docs/product-contract.md +295 -137
- package/examples/commerce.yaml +204 -0
- package/package.json +31 -30
- package/.agents/skills/semantic-atlas/references/graph-patch.md +0 -190
- package/.agents/skills/semantic-atlas/references/product-feedback.md +0 -34
- package/.agents/skills/semantic-atlas/references/result-routing.md +0 -104
- package/.agents/skills/semantic-atlas/references/snapshot-bootstrap.md +0 -42
- package/.agents/skills/semantic-atlas-insights/SKILL.md +0 -55
- package/README.zh-CN.md +0 -273
- package/dist/business-flow/business-flow-derivation-service.d.ts +0 -11
- package/dist/business-flow/business-flow-derivation-service.d.ts.map +0 -1
- package/dist/business-flow/business-flow-derivation-service.js +0 -151
- package/dist/business-flow/business-flow-draft.d.ts +0 -16
- package/dist/business-flow/business-flow-draft.d.ts.map +0 -1
- package/dist/business-flow/business-flow-draft.js +0 -150
- package/dist/business-flow/framework-business-strategy.d.ts +0 -7
- package/dist/business-flow/framework-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/framework-business-strategy.js +0 -1
- package/dist/business-flow/strategies/bullmq-business-strategy.d.ts +0 -10
- package/dist/business-flow/strategies/bullmq-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/bullmq-business-strategy.js +0 -79
- package/dist/business-flow/strategies/called-operation-derivation.d.ts +0 -13
- package/dist/business-flow/strategies/called-operation-derivation.d.ts.map +0 -1
- package/dist/business-flow/strategies/called-operation-derivation.js +0 -32
- package/dist/business-flow/strategies/graphql-business-strategy.d.ts +0 -8
- package/dist/business-flow/strategies/graphql-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/graphql-business-strategy.js +0 -65
- package/dist/business-flow/strategies/nestjs-business-strategy.d.ts +0 -8
- package/dist/business-flow/strategies/nestjs-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/nestjs-business-strategy.js +0 -72
- package/dist/business-flow/strategies/strategy-helpers.d.ts +0 -32
- package/dist/business-flow/strategies/strategy-helpers.d.ts.map +0 -1
- package/dist/business-flow/strategies/strategy-helpers.js +0 -49
- package/dist/business-flow/strategies/typeorm-business-strategy.d.ts +0 -10
- package/dist/business-flow/strategies/typeorm-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/typeorm-business-strategy.js +0 -136
- package/dist/business-flow/strategies/verified-invariant-strategy.d.ts +0 -5
- package/dist/business-flow/strategies/verified-invariant-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/verified-invariant-strategy.js +0 -38
- package/dist/business-flow/strategies/verified-test-strategy.d.ts +0 -5
- package/dist/business-flow/strategies/verified-test-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/verified-test-strategy.js +0 -26
- package/dist/business-flow/structural-flow-catalog.d.ts +0 -21
- package/dist/business-flow/structural-flow-catalog.d.ts.map +0 -1
- package/dist/business-flow/structural-flow-catalog.js +0 -125
- package/dist/business-flow/types.d.ts +0 -51
- package/dist/business-flow/types.d.ts.map +0 -1
- package/dist/business-flow/types.js +0 -1
- package/dist/cli/argument-parser.d.ts +0 -3
- package/dist/cli/argument-parser.d.ts.map +0 -1
- package/dist/cli/argument-parser.js +0 -200
- package/dist/cli/cli-application.d.ts +0 -39
- package/dist/cli/cli-application.d.ts.map +0 -1
- package/dist/cli/cli-application.js +0 -571
- package/dist/cli/cli-error.d.ts +0 -12
- package/dist/cli/cli-error.d.ts.map +0 -1
- package/dist/cli/cli-error.js +0 -44
- package/dist/cli/cli-presenter.d.ts +0 -14
- package/dist/cli/cli-presenter.d.ts.map +0 -1
- package/dist/cli/cli-presenter.js +0 -36
- package/dist/cli/insights-cli.d.ts +0 -6
- package/dist/cli/insights-cli.d.ts.map +0 -1
- package/dist/cli/insights-cli.js +0 -236
- package/dist/cli/main.d.ts +0 -3
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -137
- package/dist/cli/standalone-cli.d.ts +0 -3
- package/dist/cli/standalone-cli.d.ts.map +0 -1
- package/dist/cli/standalone-cli.js +0 -96
- package/dist/cli/types.d.ts +0 -49
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/types.js +0 -1
- package/dist/contracts/graph.d.ts +0 -266
- package/dist/contracts/graph.d.ts.map +0 -1
- package/dist/contracts/graph.js +0 -182
- package/dist/contracts/identifiers.d.ts +0 -4
- package/dist/contracts/identifiers.d.ts.map +0 -1
- package/dist/contracts/identifiers.js +0 -7
- package/dist/contracts/public-contracts.d.ts +0 -5
- package/dist/contracts/public-contracts.d.ts.map +0 -1
- package/dist/contracts/public-contracts.js +0 -4
- package/dist/evaluation/comparison.d.ts +0 -30
- package/dist/evaluation/comparison.d.ts.map +0 -1
- package/dist/evaluation/comparison.js +0 -108
- package/dist/evaluation/contracts.d.ts +0 -301
- package/dist/evaluation/contracts.d.ts.map +0 -1
- package/dist/evaluation/contracts.js +0 -413
- package/dist/graph/graph-store.d.ts +0 -55
- package/dist/graph/graph-store.d.ts.map +0 -1
- package/dist/graph/graph-store.js +0 -912
- package/dist/graph/types.d.ts +0 -189
- package/dist/graph/types.d.ts.map +0 -1
- package/dist/graph/types.js +0 -1
- package/dist/insights/contracts.d.ts +0 -266
- package/dist/insights/contracts.d.ts.map +0 -1
- package/dist/insights/contracts.js +0 -124
- package/dist/insights/insights-store.d.ts +0 -73
- package/dist/insights/insights-store.d.ts.map +0 -1
- package/dist/insights/insights-store.js +0 -246
- package/dist/knowledge/business-knowledge-service.d.ts +0 -24
- package/dist/knowledge/business-knowledge-service.d.ts.map +0 -1
- package/dist/knowledge/business-knowledge-service.js +0 -200
- package/dist/knowledge/graph-patch-conflict-error.d.ts +0 -8
- package/dist/knowledge/graph-patch-conflict-error.d.ts.map +0 -1
- package/dist/knowledge/graph-patch-conflict-error.js +0 -12
- package/dist/knowledge/structural-target-binding.d.ts +0 -14
- package/dist/knowledge/structural-target-binding.d.ts.map +0 -1
- package/dist/knowledge/structural-target-binding.js +0 -11
- package/dist/package-metadata.d.ts +0 -2
- package/dist/package-metadata.d.ts.map +0 -1
- package/dist/package-metadata.js +0 -9
- package/dist/repository/git-command.d.ts +0 -3
- package/dist/repository/git-command.d.ts.map +0 -1
- package/dist/repository/git-command.js +0 -25
- package/dist/repository/repository-inspector.d.ts +0 -7
- package/dist/repository/repository-inspector.d.ts.map +0 -1
- package/dist/repository/repository-inspector.js +0 -84
- package/dist/repository/repository-language-support.d.ts +0 -14
- package/dist/repository/repository-language-support.d.ts.map +0 -1
- package/dist/repository/repository-language-support.js +0 -64
- package/dist/repository/types.d.ts +0 -9
- package/dist/repository/types.d.ts.map +0 -1
- package/dist/repository/types.js +0 -1
- package/dist/runtime/sqlite-compatibility-process.d.ts +0 -8
- package/dist/runtime/sqlite-compatibility-process.d.ts.map +0 -1
- package/dist/runtime/sqlite-compatibility-process.js +0 -20
- package/dist/setup/skill-installer.d.ts +0 -20
- package/dist/setup/skill-installer.d.ts.map +0 -1
- package/dist/setup/skill-installer.js +0 -187
- package/dist/snapshots/repository-snapshot.d.ts +0 -4
- package/dist/snapshots/repository-snapshot.d.ts.map +0 -1
- package/dist/snapshots/repository-snapshot.js +0 -119
- package/dist/snapshots/types.d.ts +0 -30
- package/dist/snapshots/types.d.ts.map +0 -1
- package/dist/snapshots/types.js +0 -1
- package/dist/storage/atlas-database.d.ts +0 -19
- package/dist/storage/atlas-database.d.ts.map +0 -1
- package/dist/storage/atlas-database.js +0 -433
- package/dist/storage/snapshot-store.d.ts +0 -19
- package/dist/storage/snapshot-store.d.ts.map +0 -1
- package/dist/storage/snapshot-store.js +0 -74
- package/dist/structural-backend/codegraph-backend.d.ts +0 -57
- package/dist/structural-backend/codegraph-backend.d.ts.map +0 -1
- package/dist/structural-backend/codegraph-backend.js +0 -1230
- package/dist/structural-backend/codegraph-worker-client.d.ts +0 -5
- package/dist/structural-backend/codegraph-worker-client.d.ts.map +0 -1
- package/dist/structural-backend/codegraph-worker-client.js +0 -118
- package/dist/structural-backend/codegraph-worker-protocol.d.ts +0 -35
- package/dist/structural-backend/codegraph-worker-protocol.d.ts.map +0 -1
- package/dist/structural-backend/codegraph-worker-protocol.js +0 -1
- package/dist/structural-backend/codegraph-worker.d.ts +0 -2
- package/dist/structural-backend/codegraph-worker.d.ts.map +0 -1
- package/dist/structural-backend/codegraph-worker.js +0 -131
- package/dist/structural-backend/process-instance.d.ts +0 -18
- package/dist/structural-backend/process-instance.d.ts.map +0 -1
- package/dist/structural-backend/process-instance.js +0 -207
- package/dist/structural-backend/structural-fact-changes.d.ts +0 -7
- package/dist/structural-backend/structural-fact-changes.d.ts.map +0 -1
- package/dist/structural-backend/structural-fact-changes.js +0 -78
- package/dist/structural-backend/structural-projection-bootstrapper.d.ts +0 -10
- package/dist/structural-backend/structural-projection-bootstrapper.d.ts.map +0 -1
- package/dist/structural-backend/structural-projection-bootstrapper.js +0 -295
- package/dist/structural-backend/structural-publication.d.ts +0 -13
- package/dist/structural-backend/structural-publication.d.ts.map +0 -1
- package/dist/structural-backend/structural-publication.js +0 -255
- package/dist/structural-backend/structural-write-lock.d.ts +0 -8
- package/dist/structural-backend/structural-write-lock.d.ts.map +0 -1
- package/dist/structural-backend/structural-write-lock.js +0 -415
- package/dist/structural-backend/types.d.ts +0 -144
- package/dist/structural-backend/types.d.ts.map +0 -1
- package/dist/structural-backend/types.js +0 -11
- package/dist/world/business-map-projector.d.ts +0 -14
- package/dist/world/business-map-projector.d.ts.map +0 -1
- package/dist/world/business-map-projector.js +0 -178
- package/dist/world/types.d.ts +0 -77
- package/dist/world/types.d.ts.map +0 -1
- package/dist/world/types.js +0 -1
- package/dist/world/world-graph-query.d.ts +0 -26
- package/dist/world/world-graph-query.d.ts.map +0 -1
- package/dist/world/world-graph-query.js +0 -250
- package/dist/world/world-model-service.d.ts +0 -21
- package/dist/world/world-model-service.d.ts.map +0 -1
- package/dist/world/world-model-service.js +0 -219
- package/dist/world/world-snapshot-store.d.ts +0 -40
- package/dist/world/world-snapshot-store.d.ts.map +0 -1
- package/dist/world/world-snapshot-store.js +0 -581
- package/docs/README.md +0 -30
- package/docs/architecture/codegraph-backend.md +0 -190
- package/docs/architecture/continuous-business-learning.md +0 -240
- package/docs/contracts/cli-v1.md +0 -164
- package/docs/contracts/graph-model.md +0 -106
- package/docs/contracts/graph-patch-v1.md +0 -105
- package/docs/contracts/insights-v1.md +0 -84
- package/docs/log.md +0 -80
- package/docs/mindmaps/semantic-atlas-overview.drawio +0 -255
- package/docs/mindmaps/semantic-atlas-overview.png +0 -0
- package/docs/mindmaps/semantic-atlas-overview.zh-CN.drawio +0 -255
- package/docs/mindmaps/semantic-atlas-overview.zh-CN.png +0 -0
- package/schemas/cli-envelope-v1.schema.json +0 -1244
- package/schemas/evaluation-plan-v1.schema.json +0 -211
- package/schemas/evaluation-run-v1.schema.json +0 -659
- package/schemas/graph-patch-v1.schema.json +0 -392
- package/schemas/insights-envelope-v1.schema.json +0 -428
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { resolveInsightsDatabasePath } from "../storage/atlas-database.js";
|
|
4
|
-
const require = createRequire(import.meta.url);
|
|
5
|
-
const INSIGHTS_SCHEMA_VERSION = 1;
|
|
6
|
-
export class InsightsStore {
|
|
7
|
-
databasePath;
|
|
8
|
-
connection;
|
|
9
|
-
#closed = false;
|
|
10
|
-
constructor(databasePath = resolveInsightsDatabasePath()) {
|
|
11
|
-
this.databasePath = databasePath;
|
|
12
|
-
const { DatabaseSync } = require("node:sqlite");
|
|
13
|
-
this.connection = new DatabaseSync(databasePath);
|
|
14
|
-
try {
|
|
15
|
-
this.connection.exec("PRAGMA foreign_keys = ON; PRAGMA journal_mode = WAL; PRAGMA busy_timeout = 5000;");
|
|
16
|
-
this.initializeSchema();
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
this.connection.close();
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
close() {
|
|
24
|
-
if (this.#closed)
|
|
25
|
-
return;
|
|
26
|
-
this.connection.close();
|
|
27
|
-
this.#closed = true;
|
|
28
|
-
}
|
|
29
|
-
[Symbol.dispose]() {
|
|
30
|
-
this.close();
|
|
31
|
-
}
|
|
32
|
-
recordCommand(input) {
|
|
33
|
-
const observation = {
|
|
34
|
-
...input,
|
|
35
|
-
id: randomUUID(),
|
|
36
|
-
occurredAt: new Date().toISOString(),
|
|
37
|
-
warningCodes: [...input.warningCodes],
|
|
38
|
-
durationMs: Math.max(0, Math.round(input.durationMs)),
|
|
39
|
-
};
|
|
40
|
-
this.connection.prepare(`
|
|
41
|
-
INSERT INTO insight_command_events (
|
|
42
|
-
id, repository_id, command, outcome, exit_code, warning_codes, duration_ms, snapshot_id, occurred_at
|
|
43
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
44
|
-
`).run(observation.id, observation.repositoryId, observation.command, observation.outcome, observation.exitCode, JSON.stringify(observation.warningCodes), observation.durationMs, observation.snapshotId, observation.occurredAt);
|
|
45
|
-
return observation;
|
|
46
|
-
}
|
|
47
|
-
recordFeedback(input) {
|
|
48
|
-
const now = new Date().toISOString();
|
|
49
|
-
const report = {
|
|
50
|
-
...input,
|
|
51
|
-
id: randomUUID(),
|
|
52
|
-
contextEventIds: this.recentCommandEventIds(input.repositoryId),
|
|
53
|
-
repositoryId: input.repositoryId,
|
|
54
|
-
snapshotId: input.snapshotId,
|
|
55
|
-
status: "new",
|
|
56
|
-
note: null,
|
|
57
|
-
createdAt: now,
|
|
58
|
-
updatedAt: now,
|
|
59
|
-
};
|
|
60
|
-
this.connection.prepare(`
|
|
61
|
-
INSERT INTO insight_feedback_reports (
|
|
62
|
-
id, repository_id, snapshot_id, kind, category, impact, observed, expected, suggestion,
|
|
63
|
-
source_confirmed, context_event_ids, status, note, created_at, updated_at
|
|
64
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
65
|
-
`).run(report.id, report.repositoryId, report.snapshotId, report.kind, report.category, report.impact, report.observed, report.expected, report.suggestion ?? null, Number(report.sourceConfirmed), JSON.stringify(report.contextEventIds), report.status, report.note, report.createdAt, report.updatedAt);
|
|
66
|
-
return report;
|
|
67
|
-
}
|
|
68
|
-
listFeedback(range, status) {
|
|
69
|
-
const rows = this.connection.prepare(`
|
|
70
|
-
SELECT *
|
|
71
|
-
FROM insight_feedback_reports
|
|
72
|
-
WHERE created_at >= ? AND created_at < ?
|
|
73
|
-
${status === undefined ? "" : "AND status = ?"}
|
|
74
|
-
ORDER BY created_at DESC, id DESC
|
|
75
|
-
`).all(range.from, range.to, ...(status === undefined ? [] : [status]));
|
|
76
|
-
return rows.map(presentFeedback);
|
|
77
|
-
}
|
|
78
|
-
updateFeedback(input) {
|
|
79
|
-
const updatedAt = new Date().toISOString();
|
|
80
|
-
const result = this.connection.prepare(`
|
|
81
|
-
UPDATE insight_feedback_reports
|
|
82
|
-
SET status = ?, note = ?, updated_at = ?
|
|
83
|
-
WHERE id = ?
|
|
84
|
-
`).run(input.status, input.note ?? null, updatedAt, input.id);
|
|
85
|
-
if (result.changes !== 1)
|
|
86
|
-
throw new Error(`Feedback report ${input.id} was not found`);
|
|
87
|
-
const row = this.connection.prepare(`
|
|
88
|
-
SELECT * FROM insight_feedback_reports WHERE id = ?
|
|
89
|
-
`).get(input.id);
|
|
90
|
-
return presentFeedback(row);
|
|
91
|
-
}
|
|
92
|
-
summary(range) {
|
|
93
|
-
const commandRows = this.connection.prepare(`
|
|
94
|
-
SELECT command, outcome, warning_codes
|
|
95
|
-
FROM insight_command_events
|
|
96
|
-
WHERE occurred_at >= ? AND occurred_at < ?
|
|
97
|
-
`).all(range.from, range.to);
|
|
98
|
-
const feedbackRows = this.connection.prepare(`
|
|
99
|
-
SELECT category
|
|
100
|
-
FROM insight_feedback_reports
|
|
101
|
-
WHERE created_at >= ? AND created_at < ?
|
|
102
|
-
`).all(range.from, range.to);
|
|
103
|
-
const outcomes = { ok: 0, partial: 0, error: 0 };
|
|
104
|
-
const commands = new Map();
|
|
105
|
-
const warnings = new Map();
|
|
106
|
-
for (const row of commandRows) {
|
|
107
|
-
outcomes[row.outcome] += 1;
|
|
108
|
-
commands.set(row.command, (commands.get(row.command) ?? 0) + 1);
|
|
109
|
-
for (const code of parseStringArray(row.warning_codes)) {
|
|
110
|
-
warnings.set(code, (warnings.get(code) ?? 0) + 1);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
const categories = new Map();
|
|
114
|
-
for (const row of feedbackRows) {
|
|
115
|
-
categories.set(row.category, (categories.get(row.category) ?? 0) + 1);
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
commands: {
|
|
119
|
-
total: commandRows.length,
|
|
120
|
-
outcomes,
|
|
121
|
-
byCommand: [...commands.entries()]
|
|
122
|
-
.map(([command, count]) => ({ command, count }))
|
|
123
|
-
.sort((left, right) => left.command.localeCompare(right.command)),
|
|
124
|
-
warningCodes: [...warnings.entries()]
|
|
125
|
-
.map(([code, count]) => ({ code, count }))
|
|
126
|
-
.sort((left, right) => left.code.localeCompare(right.code)),
|
|
127
|
-
},
|
|
128
|
-
feedback: {
|
|
129
|
-
total: feedbackRows.length,
|
|
130
|
-
byCategory: [...categories.entries()]
|
|
131
|
-
.map(([category, count]) => ({ category, count }))
|
|
132
|
-
.sort((left, right) => left.category.localeCompare(right.category)),
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
recentCommandEventIds(repositoryId) {
|
|
137
|
-
const rows = this.connection.prepare(`
|
|
138
|
-
SELECT id
|
|
139
|
-
FROM insight_command_events
|
|
140
|
-
WHERE repository_id = ?
|
|
141
|
-
ORDER BY occurred_at DESC, id DESC
|
|
142
|
-
LIMIT 5
|
|
143
|
-
`).all(repositoryId);
|
|
144
|
-
return rows.map((row) => row.id);
|
|
145
|
-
}
|
|
146
|
-
initializeSchema() {
|
|
147
|
-
const row = this.connection.prepare(`
|
|
148
|
-
SELECT name FROM sqlite_schema WHERE type = 'table' AND name = 'insights_schema'
|
|
149
|
-
`).get();
|
|
150
|
-
if (row !== undefined) {
|
|
151
|
-
const version = this.connection.prepare(`
|
|
152
|
-
SELECT version FROM insights_schema WHERE singleton = 1
|
|
153
|
-
`).get();
|
|
154
|
-
if (version.version !== INSIGHTS_SCHEMA_VERSION) {
|
|
155
|
-
throw new Error(`Insights database schema ${version.version} is not supported`);
|
|
156
|
-
}
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
this.connection.exec("BEGIN IMMEDIATE");
|
|
160
|
-
try {
|
|
161
|
-
this.connection.exec(INSIGHTS_SCHEMA);
|
|
162
|
-
this.connection.prepare(`
|
|
163
|
-
INSERT INTO insights_schema (singleton, version, created_at) VALUES (1, ?, ?)
|
|
164
|
-
`).run(INSIGHTS_SCHEMA_VERSION, new Date().toISOString());
|
|
165
|
-
this.connection.exec("COMMIT");
|
|
166
|
-
}
|
|
167
|
-
catch (error) {
|
|
168
|
-
this.connection.exec("ROLLBACK");
|
|
169
|
-
throw error;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
function presentFeedback(row) {
|
|
174
|
-
return {
|
|
175
|
-
id: row.id,
|
|
176
|
-
repositoryId: row.repository_id,
|
|
177
|
-
snapshotId: row.snapshot_id,
|
|
178
|
-
kind: row.kind,
|
|
179
|
-
category: row.category,
|
|
180
|
-
impact: row.impact,
|
|
181
|
-
observed: row.observed,
|
|
182
|
-
expected: row.expected,
|
|
183
|
-
...(row.suggestion === null ? {} : { suggestion: row.suggestion }),
|
|
184
|
-
sourceConfirmed: row.source_confirmed === 1,
|
|
185
|
-
contextEventIds: parseStringArray(row.context_event_ids),
|
|
186
|
-
status: row.status,
|
|
187
|
-
note: row.note,
|
|
188
|
-
createdAt: row.created_at,
|
|
189
|
-
updatedAt: row.updated_at,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
function parseStringArray(value) {
|
|
193
|
-
const parsed = JSON.parse(value);
|
|
194
|
-
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
195
|
-
throw new Error("Insights database contains an invalid string collection");
|
|
196
|
-
}
|
|
197
|
-
return [...parsed];
|
|
198
|
-
}
|
|
199
|
-
const INSIGHTS_SCHEMA = `
|
|
200
|
-
CREATE TABLE insights_schema (
|
|
201
|
-
singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
|
|
202
|
-
version INTEGER NOT NULL CHECK (version = 1),
|
|
203
|
-
created_at TEXT NOT NULL
|
|
204
|
-
) STRICT;
|
|
205
|
-
|
|
206
|
-
CREATE TABLE insight_command_events (
|
|
207
|
-
id TEXT PRIMARY KEY,
|
|
208
|
-
repository_id TEXT NOT NULL,
|
|
209
|
-
command TEXT NOT NULL,
|
|
210
|
-
outcome TEXT NOT NULL CHECK (outcome IN ('ok', 'partial', 'error')),
|
|
211
|
-
exit_code INTEGER NOT NULL,
|
|
212
|
-
warning_codes TEXT NOT NULL,
|
|
213
|
-
duration_ms INTEGER NOT NULL CHECK (duration_ms >= 0),
|
|
214
|
-
snapshot_id TEXT,
|
|
215
|
-
occurred_at TEXT NOT NULL
|
|
216
|
-
) STRICT;
|
|
217
|
-
|
|
218
|
-
CREATE INDEX insight_command_events_time_index
|
|
219
|
-
ON insight_command_events (occurred_at, command);
|
|
220
|
-
CREATE INDEX insight_command_events_repository_time_index
|
|
221
|
-
ON insight_command_events (repository_id, occurred_at DESC);
|
|
222
|
-
|
|
223
|
-
CREATE TABLE insight_feedback_reports (
|
|
224
|
-
id TEXT PRIMARY KEY,
|
|
225
|
-
repository_id TEXT NOT NULL,
|
|
226
|
-
snapshot_id TEXT,
|
|
227
|
-
kind TEXT NOT NULL CHECK (kind IN ('problem', 'suggestion')),
|
|
228
|
-
category TEXT NOT NULL CHECK (category IN (
|
|
229
|
-
'misleading-result', 'missing-knowledge', 'workflow-friction',
|
|
230
|
-
'performance', 'cli-error', 'skill-instruction'
|
|
231
|
-
)),
|
|
232
|
-
impact TEXT NOT NULL CHECK (impact IN ('blocked', 'slowed', 'minor')),
|
|
233
|
-
observed TEXT NOT NULL,
|
|
234
|
-
expected TEXT NOT NULL,
|
|
235
|
-
suggestion TEXT,
|
|
236
|
-
source_confirmed INTEGER NOT NULL CHECK (source_confirmed IN (0, 1)),
|
|
237
|
-
context_event_ids TEXT NOT NULL,
|
|
238
|
-
status TEXT NOT NULL CHECK (status IN ('new', 'triaged', 'resolved', 'dismissed')),
|
|
239
|
-
note TEXT,
|
|
240
|
-
created_at TEXT NOT NULL,
|
|
241
|
-
updated_at TEXT NOT NULL
|
|
242
|
-
) STRICT;
|
|
243
|
-
|
|
244
|
-
CREATE INDEX insight_feedback_reports_time_index
|
|
245
|
-
ON insight_feedback_reports (created_at DESC, status, category);
|
|
246
|
-
`;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { GraphStore } from "../graph/graph-store.js";
|
|
2
|
-
import type { GitRepository } from "../repository/types.js";
|
|
3
|
-
import type { StructuralIndexBackend } from "../structural-backend/types.js";
|
|
4
|
-
import type { WorldWriteCoordinator } from "../world/types.js";
|
|
5
|
-
export { GraphPatchConflictError } from "./graph-patch-conflict-error.js";
|
|
6
|
-
export interface AppliedGraphPatch {
|
|
7
|
-
readonly baseSnapshotId: string;
|
|
8
|
-
readonly snapshotId: string;
|
|
9
|
-
readonly applied: {
|
|
10
|
-
readonly nodeOperations: number;
|
|
11
|
-
readonly relationOperations: number;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare class BusinessKnowledgeService {
|
|
15
|
-
private readonly repository;
|
|
16
|
-
private readonly graph;
|
|
17
|
-
private readonly structural;
|
|
18
|
-
constructor(repository: GitRepository, graph: GraphStore, structural?: StructuralIndexBackend & WorldWriteCoordinator);
|
|
19
|
-
learn(input: unknown): Promise<AppliedGraphPatch>;
|
|
20
|
-
private learnLocked;
|
|
21
|
-
private requireCurrentBaseSnapshot;
|
|
22
|
-
private requireCurrentStructuralEvidence;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=business-knowledge-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"business-knowledge-service.d.ts","sourceRoot":"","sources":["../../src/knowledge/business-knowledge-service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAM1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAO5D,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;KACrC,CAAC;CACH;AAUD,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAFV,UAAU,EAAE,aAAa,EACzB,KAAK,EAAE,UAAU,EACjB,UAAU,GAAE,sBAAsB,GAAG,qBACV;IAGxC,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;YASzC,WAAW;IAkCzB,OAAO,CAAC,0BAA0B;IASlC,OAAO,CAAC,gCAAgC;CA0CzC"}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
-
if (value !== null && value !== void 0) {
|
|
3
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
-
var dispose, inner;
|
|
5
|
-
if (async) {
|
|
6
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
-
dispose = value[Symbol.asyncDispose];
|
|
8
|
-
}
|
|
9
|
-
if (dispose === void 0) {
|
|
10
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
-
dispose = value[Symbol.dispose];
|
|
12
|
-
if (async) inner = dispose;
|
|
13
|
-
}
|
|
14
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
-
}
|
|
18
|
-
else if (async) {
|
|
19
|
-
env.stack.push({ async: true });
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
-
return function (env) {
|
|
25
|
-
function fail(e) {
|
|
26
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
-
env.hasError = true;
|
|
28
|
-
}
|
|
29
|
-
var r, s = 0;
|
|
30
|
-
function next() {
|
|
31
|
-
while (r = env.stack.pop()) {
|
|
32
|
-
try {
|
|
33
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
-
if (r.dispose) {
|
|
35
|
-
var result = r.dispose.call(r.value);
|
|
36
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
-
}
|
|
38
|
-
else s |= 1;
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
fail(e);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
-
if (env.hasError) throw env.error;
|
|
46
|
-
}
|
|
47
|
-
return next();
|
|
48
|
-
};
|
|
49
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
-
var e = new Error(message);
|
|
51
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
-
});
|
|
53
|
-
import { graphPatchV1Schema, } from "../contracts/graph.js";
|
|
54
|
-
import { createRepositorySnapshot } from "../snapshots/repository-snapshot.js";
|
|
55
|
-
import { CodeGraphStructuralBackend } from "../structural-backend/codegraph-backend.js";
|
|
56
|
-
import { requiresBundledCodeGraphRuntime, runCodeGraphWorker, } from "../structural-backend/codegraph-worker-client.js";
|
|
57
|
-
import { WorldSnapshotStore } from "../world/world-snapshot-store.js";
|
|
58
|
-
import { bindStructuralTarget as attachStructuralTargetBinding, } from "./structural-target-binding.js";
|
|
59
|
-
import { GraphPatchConflictError } from "./graph-patch-conflict-error.js";
|
|
60
|
-
export { GraphPatchConflictError } from "./graph-patch-conflict-error.js";
|
|
61
|
-
export class BusinessKnowledgeService {
|
|
62
|
-
repository;
|
|
63
|
-
graph;
|
|
64
|
-
structural;
|
|
65
|
-
constructor(repository, graph, structural = new CodeGraphStructuralBackend(repository)) {
|
|
66
|
-
this.repository = repository;
|
|
67
|
-
this.graph = graph;
|
|
68
|
-
this.structural = structural;
|
|
69
|
-
}
|
|
70
|
-
async learn(input) {
|
|
71
|
-
if (requiresBundledCodeGraphRuntime()) {
|
|
72
|
-
return runCodeGraphWorker({ operation: "learn", repository: this.repository, input });
|
|
73
|
-
}
|
|
74
|
-
return this.structural.withWorldWriteLock((state, resolver) => (this.learnLocked(input, state, resolver)));
|
|
75
|
-
}
|
|
76
|
-
async learnLocked(input, structuralState, resolver) {
|
|
77
|
-
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
78
|
-
try {
|
|
79
|
-
const patch = graphPatchV1Schema.parse(input);
|
|
80
|
-
const currentSnapshot = await createRepositorySnapshot(this.repository);
|
|
81
|
-
this.requireCurrentBaseSnapshot(patch, currentSnapshot.snapshotId);
|
|
82
|
-
const world = __addDisposableResource(env_1, new WorldSnapshotStore(this.repository), false);
|
|
83
|
-
if (world.requireCurrentSnapshot().snapshotId !== patch.baseSnapshotId) {
|
|
84
|
-
throw new Error("GraphPatch base snapshot is not the current world snapshot");
|
|
85
|
-
}
|
|
86
|
-
const structuralNodes = this.requireCurrentStructuralEvidence(patch, resolver);
|
|
87
|
-
const verifiedSnapshot = await createRepositorySnapshot(this.repository);
|
|
88
|
-
this.requireCurrentBaseSnapshot(patch, verifiedSnapshot.snapshotId);
|
|
89
|
-
this.graph.mutateBusinessGraph(toBusinessGraphMutation(patch, structuralNodes, resolver, verifiedSnapshot.snapshotId, structuralState.backendVersion));
|
|
90
|
-
return {
|
|
91
|
-
baseSnapshotId: patch.baseSnapshotId,
|
|
92
|
-
snapshotId: verifiedSnapshot.snapshotId,
|
|
93
|
-
applied: {
|
|
94
|
-
nodeOperations: patch.nodeOperations.length,
|
|
95
|
-
relationOperations: patch.relationOperations.length,
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
catch (e_1) {
|
|
100
|
-
env_1.error = e_1;
|
|
101
|
-
env_1.hasError = true;
|
|
102
|
-
}
|
|
103
|
-
finally {
|
|
104
|
-
__disposeResources(env_1);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
requireCurrentBaseSnapshot(patch, currentSnapshotId) {
|
|
108
|
-
if (patch.baseSnapshotId !== currentSnapshotId) {
|
|
109
|
-
throw new GraphPatchConflictError(patch.baseSnapshotId, currentSnapshotId);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
requireCurrentStructuralEvidence(patch, resolver) {
|
|
113
|
-
const nodes = new Map();
|
|
114
|
-
const resolve = (id) => {
|
|
115
|
-
const known = nodes.get(id);
|
|
116
|
-
if (known !== undefined) {
|
|
117
|
-
return known;
|
|
118
|
-
}
|
|
119
|
-
const node = resolver.getNode(id);
|
|
120
|
-
if (node === undefined) {
|
|
121
|
-
throw new Error(`Structural reference ${id} does not resolve in the current index`);
|
|
122
|
-
}
|
|
123
|
-
nodes.set(id, node);
|
|
124
|
-
return node;
|
|
125
|
-
};
|
|
126
|
-
const evidence = [
|
|
127
|
-
...patch.nodeOperations.flatMap((operation) => (operation.op === "upsert" ? operation.node.evidence : [])),
|
|
128
|
-
...patch.relationOperations.flatMap((operation) => (operation.op === "upsert" ? operation.relation.evidence : [])),
|
|
129
|
-
];
|
|
130
|
-
for (const item of evidence) {
|
|
131
|
-
const node = resolve(item.symbolId);
|
|
132
|
-
if (node.path !== item.file || !sameRange(node, item.range)) {
|
|
133
|
-
throw new Error(`Evidence ${item.symbolId} at ${item.file} does not match the current structural index`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
for (const operation of patch.relationOperations) {
|
|
137
|
-
if (operation.op === "upsert" && operation.relation.to.domain === "structural") {
|
|
138
|
-
resolve(operation.relation.to.id);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return nodes;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function sameRange(node, range) {
|
|
145
|
-
return node.range.start.line === range.start.line
|
|
146
|
-
&& node.range.start.column === range.start.column
|
|
147
|
-
&& node.range.end.line === range.end.line
|
|
148
|
-
&& node.range.end.column === range.end.column;
|
|
149
|
-
}
|
|
150
|
-
function toBusinessGraphMutation(patch, structuralNodes, resolver, snapshotId, backendVersion) {
|
|
151
|
-
const bindEvidence = (evidence) => {
|
|
152
|
-
const node = structuralNodes.get(evidence.symbolId);
|
|
153
|
-
if (node === undefined) {
|
|
154
|
-
throw new Error(`Structural reference ${evidence.symbolId} was not verified`);
|
|
155
|
-
}
|
|
156
|
-
return {
|
|
157
|
-
...evidence,
|
|
158
|
-
qualifiedSymbol: node.qualifiedName,
|
|
159
|
-
structuralKind: node.kind,
|
|
160
|
-
atlasSnapshotId: snapshotId,
|
|
161
|
-
backendVersion,
|
|
162
|
-
backendLocator: resolver.backendLocator(node) ?? node.reference.id,
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
const createStructuralTargetBinding = (reference) => {
|
|
166
|
-
const node = structuralNodes.get(reference);
|
|
167
|
-
if (node === undefined) {
|
|
168
|
-
throw new Error(`Structural relation target ${reference} was not verified`);
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
structuralReference: reference,
|
|
172
|
-
file: node.path,
|
|
173
|
-
qualifiedSymbol: node.qualifiedName,
|
|
174
|
-
structuralKind: node.kind,
|
|
175
|
-
range: node.range,
|
|
176
|
-
atlasSnapshotId: snapshotId,
|
|
177
|
-
backendVersion,
|
|
178
|
-
backendLocator: resolver.backendLocator(node) ?? node.reference.id,
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
return {
|
|
182
|
-
baseSnapshotId: patch.baseSnapshotId,
|
|
183
|
-
upsertNodes: patch.nodeOperations.flatMap((operation) => (operation.op === "upsert"
|
|
184
|
-
? [{ ...operation.node, evidence: operation.node.evidence.map(bindEvidence) }]
|
|
185
|
-
: [])),
|
|
186
|
-
removeNodeKeys: patch.nodeOperations.flatMap((operation) => (operation.op === "remove" ? [operation.key] : [])),
|
|
187
|
-
upsertRelations: patch.relationOperations.flatMap((operation) => (operation.op === "upsert"
|
|
188
|
-
? [operation.relation.to.domain === "structural"
|
|
189
|
-
? attachStructuralTargetBinding({
|
|
190
|
-
...operation.relation,
|
|
191
|
-
evidence: operation.relation.evidence.map(bindEvidence),
|
|
192
|
-
}, createStructuralTargetBinding(operation.relation.to.id))
|
|
193
|
-
: {
|
|
194
|
-
...operation.relation,
|
|
195
|
-
evidence: operation.relation.evidence.map(bindEvidence),
|
|
196
|
-
}]
|
|
197
|
-
: [])),
|
|
198
|
-
removeRelations: patch.relationOperations.flatMap((operation) => (operation.op === "remove" ? [operation.relation] : [])),
|
|
199
|
-
};
|
|
200
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const GRAPH_PATCH_BASE_SNAPSHOT_MISMATCH = "BASE_SNAPSHOT_MISMATCH";
|
|
2
|
-
export declare class GraphPatchConflictError extends Error {
|
|
3
|
-
readonly baseSnapshotId: string;
|
|
4
|
-
readonly currentSnapshotId: string;
|
|
5
|
-
readonly code = "BASE_SNAPSHOT_MISMATCH";
|
|
6
|
-
constructor(baseSnapshotId: string, currentSnapshotId: string);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=graph-patch-conflict-error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-patch-conflict-error.d.ts","sourceRoot":"","sources":["../../src/knowledge/graph-patch-conflict-error.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kCAAkC,2BAA2B,CAAC;AAE3E,qBAAa,uBAAwB,SAAQ,KAAK;IAI9C,QAAQ,CAAC,cAAc,EAAE,MAAM;IAC/B,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IAJpC,QAAQ,CAAC,IAAI,4BAAsC;gBAGxC,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM;CAOrC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const GRAPH_PATCH_BASE_SNAPSHOT_MISMATCH = "BASE_SNAPSHOT_MISMATCH";
|
|
2
|
-
export class GraphPatchConflictError extends Error {
|
|
3
|
-
baseSnapshotId;
|
|
4
|
-
currentSnapshotId;
|
|
5
|
-
code = GRAPH_PATCH_BASE_SNAPSHOT_MISMATCH;
|
|
6
|
-
constructor(baseSnapshotId, currentSnapshotId) {
|
|
7
|
-
super(`GraphPatch base snapshot ${baseSnapshotId} does not match current snapshot ${currentSnapshotId}`);
|
|
8
|
-
this.baseSnapshotId = baseSnapshotId;
|
|
9
|
-
this.currentSnapshotId = currentSnapshotId;
|
|
10
|
-
this.name = "GraphPatchConflictError";
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { BusinessRelationInput, SourceRange, StructuralNodeKind } from "../graph/types.js";
|
|
2
|
-
export interface StructuralTargetBinding {
|
|
3
|
-
readonly structuralReference: string;
|
|
4
|
-
readonly file: string;
|
|
5
|
-
readonly qualifiedSymbol: string | null;
|
|
6
|
-
readonly structuralKind: Exclude<StructuralNodeKind, "UnknownBoundary"> | null;
|
|
7
|
-
readonly range: SourceRange;
|
|
8
|
-
readonly atlasSnapshotId: string;
|
|
9
|
-
readonly backendVersion: string | null;
|
|
10
|
-
readonly backendLocator: string | null;
|
|
11
|
-
}
|
|
12
|
-
export declare function bindStructuralTarget(relation: BusinessRelationInput, binding: StructuralTargetBinding): BusinessRelationInput;
|
|
13
|
-
export declare function readStructuralTargetBinding(relation: BusinessRelationInput): StructuralTargetBinding | undefined;
|
|
14
|
-
//# sourceMappingURL=structural-target-binding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"structural-target-binding.d.ts","sourceRoot":"","sources":["../../src/knowledge/structural-target-binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,GAAG,IAAI,CAAC;IAC/E,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;AAMD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,uBAAuB,GAC/B,qBAAqB,CAMvB;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,qBAAqB,GAC9B,uBAAuB,GAAG,SAAS,CAErC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const structuralTargetBinding = Symbol("structuralTargetBinding");
|
|
2
|
-
export function bindStructuralTarget(relation, binding) {
|
|
3
|
-
const boundRelation = {
|
|
4
|
-
...relation,
|
|
5
|
-
[structuralTargetBinding]: binding,
|
|
6
|
-
};
|
|
7
|
-
return boundRelation;
|
|
8
|
-
}
|
|
9
|
-
export function readStructuralTargetBinding(relation) {
|
|
10
|
-
return relation[structuralTargetBinding];
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-metadata.d.ts","sourceRoot":"","sources":["../src/package-metadata.ts"],"names":[],"mappings":"AAMA,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAO1D"}
|
package/dist/package-metadata.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
export async function readPackageVersion() {
|
|
3
|
-
const packagePath = new URL("../package.json", import.meta.url);
|
|
4
|
-
const document = JSON.parse(await readFile(packagePath, "utf8"));
|
|
5
|
-
if (typeof document.version !== "string" || document.version.length === 0) {
|
|
6
|
-
throw new Error("Semantic Atlas package metadata has no version");
|
|
7
|
-
}
|
|
8
|
-
return document.version;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-command.d.ts","sourceRoot":"","sources":["../../src/repository/git-command.ts"],"names":[],"mappings":"AAQA,wBAAsB,MAAM,CAC1B,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAsB,UAAU,CAC9B,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAAC,MAAM,CAAC,CAEjB"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
const READ_ONLY_GIT_ENVIRONMENT = {
|
|
3
|
-
...process.env,
|
|
4
|
-
// Git must not refresh the target repository's index during inspection.
|
|
5
|
-
GIT_OPTIONAL_LOCKS: "0",
|
|
6
|
-
};
|
|
7
|
-
export async function runGit(workingDirectory, arguments_) {
|
|
8
|
-
return new Promise((resolve, reject) => {
|
|
9
|
-
execFile("git", ["-C", workingDirectory, ...arguments_], {
|
|
10
|
-
encoding: "buffer",
|
|
11
|
-
env: READ_ONLY_GIT_ENVIRONMENT,
|
|
12
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
13
|
-
windowsHide: true,
|
|
14
|
-
}, (error, stdout) => {
|
|
15
|
-
if (error) {
|
|
16
|
-
reject(error);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
resolve(stdout);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
export async function runGitText(workingDirectory, arguments_) {
|
|
24
|
-
return (await runGit(workingDirectory, arguments_)).toString("utf8").trim();
|
|
25
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { GitRepository } from "./types.js";
|
|
2
|
-
export declare function isSupportedSource(path: string): boolean;
|
|
3
|
-
export declare function isTargetSource(path: string): boolean;
|
|
4
|
-
export declare function inspectGitRepository(startPath: string): Promise<GitRepository>;
|
|
5
|
-
export declare function discoverTargetSources(repository: GitRepository): Promise<string[]>;
|
|
6
|
-
export declare function readCurrentHead(repository: GitRepository): Promise<string>;
|
|
7
|
-
//# sourceMappingURL=repository-inspector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository-inspector.d.ts","sourceRoot":"","sources":["../../src/repository/repository-inspector.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA4ChD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMvD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOpD;AAED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAuBpF;AAED,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAcxF;AAED,wBAAsB,eAAe,CAAC,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhF"}
|