@holmes-lab/holmes-kit 0.19.6 → 0.20.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/CHANGELOG.md +143 -0
- package/README.md +9 -2
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/approve-status.d.ts +24 -0
- package/dist/holmes/cli/approve-status.js +166 -0
- package/dist/holmes/cli/approve-watch.d.ts +6 -0
- package/dist/holmes/cli/approve-watch.js +6 -0
- package/dist/holmes/cli/approve.d.ts +27 -0
- package/dist/holmes/cli/approve.js +68 -7
- package/dist/holmes/cli/cli-execution.d.ts +2 -0
- package/dist/holmes/cli/cli-execution.js +24 -0
- package/dist/holmes/cli/doctor-check.d.ts +15 -0
- package/dist/holmes/cli/doctor-check.js +2 -0
- package/dist/holmes/cli/doctor.d.ts +2 -8
- package/dist/holmes/cli/doctor.js +12 -3
- package/dist/holmes/cli/gitignore-merge.d.ts +0 -5
- package/dist/holmes/cli/gitignore-merge.js +6 -2
- package/dist/holmes/cli/index.js +176 -139
- package/dist/holmes/cli/npx-cache-check.d.ts +16 -0
- package/dist/holmes/cli/npx-cache-check.js +130 -0
- package/dist/holmes/cli/playbook-skills.d.ts +2 -22
- package/dist/holmes/cli/playbook-skills.js +10 -54
- package/dist/holmes/cli/probe-process.d.ts +17 -2
- package/dist/holmes/cli/probe-process.js +44 -11
- package/dist/holmes/governance/approval-grants.d.ts +22 -0
- package/dist/holmes/governance/approval-grants.js +55 -1
- package/dist/holmes/governance/approval-queue.d.ts +43 -4
- package/dist/holmes/governance/approval-queue.js +91 -13
- package/dist/holmes/governance/display-id-aliases.d.ts +29 -0
- package/dist/holmes/governance/display-id-aliases.js +86 -0
- package/dist/holmes/governance/ledger-store.d.ts +42 -14
- package/dist/holmes/governance/ledger-store.js +49 -3
- package/dist/holmes/governance/ledger-timeline.d.ts +3 -1
- package/dist/holmes/governance/ledger-timeline.js +11 -1
- package/dist/holmes/governance/provenance-chain.d.ts +2 -0
- package/dist/holmes/governance/provenance-chain.js +13 -2
- package/dist/holmes/governance/provenance-ledger.d.ts +28 -0
- package/dist/holmes/governance/provenance-ledger.js +69 -16
- package/dist/holmes/governance/session-context.d.ts +3 -0
- package/dist/holmes/governance/session-context.js +26 -8
- package/dist/holmes/guardrail/risk-classifier.js +2 -2
- package/dist/holmes/guardrail/write-target.js +2 -1
- package/dist/holmes/hooks/pre-tool-use.js +12 -1
- package/dist/holmes/hooks/stop.js +14 -3
- package/dist/holmes/mcp/handlers/adoption.d.ts +118 -0
- package/dist/holmes/mcp/handlers/adoption.js +186 -0
- package/dist/holmes/mcp/handlers/entity-integration.d.ts +100 -0
- package/dist/holmes/mcp/handlers/entity-integration.js +324 -0
- package/dist/holmes/mcp/handlers/entity-renumber.d.ts +137 -0
- package/dist/holmes/mcp/handlers/entity-renumber.js +228 -0
- package/dist/holmes/mcp/handlers/entity-store.d.ts +78 -0
- package/dist/holmes/mcp/handlers/entity-store.js +212 -0
- package/dist/holmes/mcp/handlers/graph-operations.d.ts +90 -0
- package/dist/holmes/mcp/handlers/graph-operations.js +260 -0
- package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +34 -0
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +288 -0
- package/dist/holmes/mcp/handlers/maintenance-evidence.d.ts +40 -0
- package/dist/holmes/mcp/handlers/maintenance-evidence.js +104 -0
- package/dist/holmes/mcp/handlers/operator-inspection.d.ts +167 -0
- package/dist/holmes/mcp/handlers/operator-inspection.js +284 -0
- package/dist/holmes/mcp/handlers/phase-queries.d.ts +34 -0
- package/dist/holmes/mcp/handlers/phase-queries.js +86 -0
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +47 -0
- package/dist/holmes/mcp/handlers/review-evidence.js +370 -0
- package/dist/holmes/mcp/handlers/review-queries.d.ts +68 -0
- package/dist/holmes/mcp/handlers/review-queries.js +79 -0
- package/dist/holmes/mcp/handlers/risk-assessment.d.ts +25 -0
- package/dist/holmes/mcp/handlers/risk-assessment.js +181 -0
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +72 -0
- package/dist/holmes/mcp/handlers/slice-orchestration.js +373 -0
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +105 -0
- package/dist/holmes/mcp/handlers/spec-approval.js +504 -0
- package/dist/holmes/mcp/handlers/spec-authoring.d.ts +57 -0
- package/dist/holmes/mcp/handlers/spec-authoring.js +326 -0
- package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +122 -0
- package/dist/holmes/mcp/handlers/spec-lifecycle.js +339 -0
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +30 -0
- package/dist/holmes/mcp/handlers/spec-queries.js +74 -0
- package/dist/holmes/mcp/handlers/taint-screening.d.ts +48 -0
- package/dist/holmes/mcp/handlers/taint-screening.js +183 -0
- package/dist/holmes/mcp/handlers/test-execution.d.ts +63 -0
- package/dist/holmes/mcp/handlers/test-execution.js +210 -0
- package/dist/holmes/mcp/handlers/workspace-identity.d.ts +30 -0
- package/dist/holmes/mcp/handlers/workspace-identity.js +68 -0
- package/dist/holmes/mcp/handlers/workspace-queries.d.ts +77 -0
- package/dist/holmes/mcp/handlers/workspace-queries.js +193 -0
- package/dist/holmes/mcp/handlers.d.ts +661 -424
- package/dist/holmes/mcp/handlers.js +270 -3251
- package/dist/holmes/mcp/server-specs-dir.d.ts +2 -0
- package/dist/holmes/mcp/server-specs-dir.js +71 -0
- package/dist/holmes/mcp/server.js +12 -2
- package/dist/holmes/mcp/tool-schemas.js +43 -2
- package/dist/holmes/project/execution-context.d.ts +17 -0
- package/dist/holmes/project/execution-context.js +121 -0
- package/dist/holmes/project/installer-markers.d.ts +34 -0
- package/dist/holmes/project/installer-markers.js +65 -0
- package/dist/holmes/project/root.d.ts +12 -1
- package/dist/holmes/project/root.js +22 -3
- package/dist/holmes/project/workspace-identity.d.ts +29 -0
- package/dist/holmes/project/workspace-identity.js +181 -0
- package/dist/holmes/review/test-outcomes.d.ts +6 -1
- package/dist/holmes/review/test-outcomes.js +23 -5
- package/dist/holmes/review/test-runner.d.ts +18 -0
- package/dist/holmes/review/test-runner.js +136 -5
- package/dist/holmes/rtm/graph-store.d.ts +50 -1
- package/dist/holmes/rtm/graph-store.js +244 -3
- package/dist/holmes/rtm/incremental.d.ts +1 -0
- package/dist/holmes/rtm/incremental.js +12 -3
- package/dist/holmes/rtm/localize.js +7 -0
- package/dist/holmes/rtm/rtm-graph.d.ts +9 -0
- package/dist/holmes/rtm/rtm-graph.js +13 -0
- package/dist/holmes/rtm/test-scope.js +4 -1
- package/dist/holmes/semantic/vector-cache.d.ts +16 -1
- package/dist/holmes/semantic/vector-cache.js +155 -19
- package/dist/holmes/spec/approval-status.d.ts +10 -0
- package/dist/holmes/spec/approval-status.js +7 -3
- package/dist/holmes/spec/entity-git-snapshot.d.ts +50 -0
- package/dist/holmes/spec/entity-git-snapshot.js +276 -0
- package/dist/holmes/spec/entity-integration-discharge.d.ts +73 -0
- package/dist/holmes/spec/entity-integration-discharge.js +233 -0
- package/dist/holmes/spec/entity-integration-transaction.d.ts +179 -0
- package/dist/holmes/spec/entity-integration-transaction.js +1221 -0
- package/dist/holmes/spec/entity-integration.d.ts +216 -0
- package/dist/holmes/spec/entity-integration.js +760 -0
- package/dist/holmes/spec/entity-renumber-transaction.d.ts +82 -0
- package/dist/holmes/spec/entity-renumber-transaction.js +711 -0
- package/dist/holmes/spec/entity-renumber.d.ts +32 -0
- package/dist/holmes/spec/entity-renumber.js +156 -0
- package/dist/holmes/spec/entity-store.d.ts +135 -0
- package/dist/holmes/spec/entity-store.js +1053 -0
- package/dist/holmes/spec/entity-transaction.d.ts +105 -0
- package/dist/holmes/spec/entity-transaction.js +741 -0
- package/dist/holmes/spec/renumber.d.ts +58 -0
- package/dist/holmes/spec/renumber.js +200 -1
- package/dist/holmes/spec/spec-store.d.ts +3 -2
- package/dist/holmes/spec/spec-store.js +23 -2
- package/dist/holmes/spec/transition-policy.d.ts +36 -0
- package/dist/holmes/spec/transition-policy.js +135 -0
- package/package.json +5 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Spec } from './spec-parser';
|
|
2
|
+
export interface EntityRenumberEntry {
|
|
3
|
+
entityId: string;
|
|
4
|
+
documentLocator: string;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
export interface EntityRenumberChange {
|
|
8
|
+
entityId: string;
|
|
9
|
+
newDisplayId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface EntityRenumberProposal {
|
|
12
|
+
ok: boolean;
|
|
13
|
+
conflicts: string[];
|
|
14
|
+
entries: Array<{
|
|
15
|
+
entityId: string;
|
|
16
|
+
oldId: string;
|
|
17
|
+
newId: string;
|
|
18
|
+
documentLocator: string;
|
|
19
|
+
newDocumentLocator: string;
|
|
20
|
+
before: string;
|
|
21
|
+
beforeVersion: string;
|
|
22
|
+
after: string;
|
|
23
|
+
}>;
|
|
24
|
+
contentChanged: string[];
|
|
25
|
+
parentSnapshotsChanged: string[];
|
|
26
|
+
unsealOrder: string[];
|
|
27
|
+
approveOrder: string[];
|
|
28
|
+
}
|
|
29
|
+
/** Rebuild structured metadata while retaining the exact original body, including CRLF/preamble. */
|
|
30
|
+
export declare function replaceFrontmatter(original: string, candidate: Spec): string;
|
|
31
|
+
/** Pure proposal only. Seal transitions and source publication require the authorized executor. */
|
|
32
|
+
export declare function planEntityRenumber(entries: EntityRenumberEntry[], changes: EntityRenumberChange[]): EntityRenumberProposal;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.replaceFrontmatter = replaceFrontmatter;
|
|
37
|
+
exports.planEntityRenumber = planEntityRenumber;
|
|
38
|
+
// @implements A-SPEC-628
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const node_crypto_1 = require("node:crypto");
|
|
41
|
+
const spec_parser_1 = require("./spec-parser");
|
|
42
|
+
const spec_digest_1 = require("./spec-digest");
|
|
43
|
+
const spec_types_1 = require("./spec-types");
|
|
44
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
45
|
+
const HEADER = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/;
|
|
46
|
+
const safeLocator = (value) => value.length > 0 && !/[\\:\x00]/.test(value) && value.split('/').every(p => p !== '' && p !== '.' && p !== '..') && value.endsWith('.md');
|
|
47
|
+
/** Rebuild structured metadata while retaining the exact original body, including CRLF/preamble. */
|
|
48
|
+
function replaceFrontmatter(original, candidate) {
|
|
49
|
+
const prefix = HEADER.exec(original)[0];
|
|
50
|
+
const generated = HEADER.exec((0, spec_parser_1.serializeSpec)(candidate))[0];
|
|
51
|
+
return (prefix.startsWith('---\r\n') ? generated.replace(/\n/g, '\r\n') : generated) + original.slice(prefix.length);
|
|
52
|
+
}
|
|
53
|
+
/** Pure proposal only. Seal transitions and source publication require the authorized executor. */
|
|
54
|
+
function planEntityRenumber(entries, changes) {
|
|
55
|
+
const empty = (conflicts) => ({ ok: false, conflicts: [...conflicts].sort(), entries: [], contentChanged: [], parentSnapshotsChanged: [], unsealOrder: [], approveOrder: [] });
|
|
56
|
+
const ordered = [...entries].sort((a, b) => a.entityId < b.entityId ? -1 : a.entityId > b.entityId ? 1 : 0);
|
|
57
|
+
const byEntity = new Map();
|
|
58
|
+
const byId = new Map(), locations = new Set();
|
|
59
|
+
for (const entry of ordered) {
|
|
60
|
+
if (!UUID.test(entry.entityId) || byEntity.has(entry.entityId) || !safeLocator(entry.documentLocator) || locations.has(entry.documentLocator) || !HEADER.test(entry.text))
|
|
61
|
+
return empty(['Invalid or duplicate entity identity/document locator: ' + entry.entityId]);
|
|
62
|
+
let spec;
|
|
63
|
+
try {
|
|
64
|
+
spec = (0, spec_parser_1.parseSpec)(entry.text);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return empty(['Unparseable document: ' + entry.documentLocator]);
|
|
68
|
+
}
|
|
69
|
+
if (!(0, spec_types_1.specTypeDef)(spec.type)?.idRegex.test(spec.id) || !Array.isArray(spec.dependsOn) || spec.dependsOn.some(p => typeof p !== 'string') || byId.has(spec.id))
|
|
70
|
+
return empty(['Invalid or duplicate display ID: ' + spec.id]);
|
|
71
|
+
byEntity.set(entry.entityId, { entry, spec });
|
|
72
|
+
byId.set(spec.id, entry.entityId);
|
|
73
|
+
locations.add(entry.documentLocator);
|
|
74
|
+
}
|
|
75
|
+
const requested = new Map();
|
|
76
|
+
for (const change of changes) {
|
|
77
|
+
const prior = byEntity.get(change.entityId);
|
|
78
|
+
if (!prior || requested.has(change.entityId) || !(0, spec_types_1.specTypeDef)(prior.spec.type).idRegex.test(change.newDisplayId))
|
|
79
|
+
return empty(['Invalid or duplicate requested move: ' + change.entityId]);
|
|
80
|
+
requested.set(change.entityId, change.newDisplayId);
|
|
81
|
+
}
|
|
82
|
+
const newIds = new Map(), destinations = new Set();
|
|
83
|
+
for (const [entityId, { spec }] of byEntity) {
|
|
84
|
+
const id = requested.get(entityId) ?? spec.id;
|
|
85
|
+
if (destinations.has(id))
|
|
86
|
+
return empty(['Occupied destination display ID: ' + id]);
|
|
87
|
+
destinations.add(id);
|
|
88
|
+
newIds.set(spec.id, id);
|
|
89
|
+
}
|
|
90
|
+
const parents = new Map(), children = new Map();
|
|
91
|
+
for (const id of byEntity.keys())
|
|
92
|
+
children.set(id, new Set());
|
|
93
|
+
for (const [entityId, { spec }] of byEntity) {
|
|
94
|
+
const deps = new Set();
|
|
95
|
+
for (const parent of spec.dependsOn) {
|
|
96
|
+
const parentEntity = byId.get(parent);
|
|
97
|
+
if (!parentEntity)
|
|
98
|
+
return empty(['Unresolved dependency: ' + spec.id + ' -> ' + parent]);
|
|
99
|
+
deps.add(parentEntity);
|
|
100
|
+
children.get(parentEntity).add(entityId);
|
|
101
|
+
// Preserve only a proven existing mirror, not a repository-specific numbering convention.
|
|
102
|
+
if (spec.type === 'T-SPEC' && parent.startsWith('A-SPEC-') && spec.id.slice(7) === parent.slice(7) && newIds.get(spec.id).slice(7) !== newIds.get(parent).slice(7))
|
|
103
|
+
return empty(['Moving this mirrored A/T pair requires matching final suffixes: ' + spec.id]);
|
|
104
|
+
}
|
|
105
|
+
parents.set(entityId, deps);
|
|
106
|
+
}
|
|
107
|
+
const degrees = new Map([...parents].map(([id, deps]) => [id, deps.size]));
|
|
108
|
+
const ready = [...degrees].filter(([, degree]) => degree === 0).map(([id]) => id).sort(), topo = [];
|
|
109
|
+
while (ready.length) {
|
|
110
|
+
const id = ready.shift();
|
|
111
|
+
topo.push(id);
|
|
112
|
+
for (const child of children.get(id)) {
|
|
113
|
+
degrees.set(child, degrees.get(child) - 1);
|
|
114
|
+
if (degrees.get(child) === 0) {
|
|
115
|
+
ready.push(child);
|
|
116
|
+
ready.sort();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (topo.length !== byEntity.size)
|
|
121
|
+
return empty(['Cyclic specification dependencies prevent an approval order.']);
|
|
122
|
+
const candidates = new Map(), contentChanged = [], parentSnapshotsChanged = [];
|
|
123
|
+
const changedDigests = new Set();
|
|
124
|
+
for (const [entityId, { spec }] of byEntity) {
|
|
125
|
+
const candidate = { ...spec, id: newIds.get(spec.id), dependsOn: spec.dependsOn.map(id => newIds.get(id)), frontmatter: { ...spec.frontmatter } };
|
|
126
|
+
candidates.set(entityId, candidate);
|
|
127
|
+
if ((0, spec_digest_1.specDigest)(candidate) !== (0, spec_digest_1.specDigest)(spec)) {
|
|
128
|
+
contentChanged.push(entityId);
|
|
129
|
+
changedDigests.add(entityId);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (const [entityId, { spec }] of byEntity) {
|
|
133
|
+
if (spec.dependsOn.some(parent => newIds.get(parent) !== parent || changedDigests.has(byId.get(parent))))
|
|
134
|
+
parentSnapshotsChanged.push(entityId);
|
|
135
|
+
}
|
|
136
|
+
const affected = new Set([...contentChanged, ...parentSnapshotsChanged]);
|
|
137
|
+
// Any approved descendant can block an official unseal, even when its own digest is unchanged.
|
|
138
|
+
for (const id of topo)
|
|
139
|
+
if (affected.has(id))
|
|
140
|
+
for (const child of children.get(id))
|
|
141
|
+
affected.add(child);
|
|
142
|
+
const approvalEntities = topo.filter(id => affected.has(id) && byEntity.get(id).spec.status === 'approved');
|
|
143
|
+
const proposed = [], finalPaths = new Set();
|
|
144
|
+
for (const [entityId, { entry, spec }] of byEntity) {
|
|
145
|
+
const candidate = candidates.get(entityId);
|
|
146
|
+
const newDocumentLocator = candidate.id === spec.id ? entry.documentLocator : path.posix.join(path.posix.dirname(entry.documentLocator), candidate.id + '.md');
|
|
147
|
+
if (finalPaths.has(newDocumentLocator))
|
|
148
|
+
return empty(['Occupied destination document: ' + newDocumentLocator]);
|
|
149
|
+
finalPaths.add(newDocumentLocator);
|
|
150
|
+
const structuredChange = candidate.id !== spec.id || candidate.dependsOn.some((id, i) => id !== spec.dependsOn[i]);
|
|
151
|
+
proposed.push({ entityId, oldId: spec.id, newId: candidate.id, documentLocator: entry.documentLocator, newDocumentLocator,
|
|
152
|
+
before: entry.text, beforeVersion: 'sha256:' + (0, node_crypto_1.createHash)('sha256').update(entry.text).digest('hex'), after: structuredChange ? replaceFrontmatter(entry.text, candidate) : entry.text });
|
|
153
|
+
}
|
|
154
|
+
return { ok: true, conflicts: [], entries: proposed, contentChanged, parentSnapshotsChanged,
|
|
155
|
+
unsealOrder: [...approvalEntities].reverse().map(id => byEntity.get(id).spec.id), approveOrder: approvalEntities.map(id => candidates.get(id).id) };
|
|
156
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Spec } from './spec-parser';
|
|
2
|
+
export { EntityStoreError, entityContentVersion } from './entity-transaction';
|
|
3
|
+
export interface EntityAdoptionPlan {
|
|
4
|
+
schema: 'holmes-entity-adoption/1';
|
|
5
|
+
operationId: string;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
storeId: string;
|
|
8
|
+
storeLocator: string;
|
|
9
|
+
entries: Array<{
|
|
10
|
+
entityId: string;
|
|
11
|
+
displayId: string;
|
|
12
|
+
documentLocator: string;
|
|
13
|
+
version: string;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare function entityStoreBinding(storeRoot: string): {
|
|
17
|
+
root: string;
|
|
18
|
+
store: string;
|
|
19
|
+
locator: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function validateEntityAdoptionPlan(value: unknown): EntityAdoptionPlan;
|
|
22
|
+
export declare function entityAdoptionTarget(plan: EntityAdoptionPlan): string;
|
|
23
|
+
/** @implements A-SPEC-638 — the raw legacy renumber's rollback journal: the original bytes of every file it touches. */
|
|
24
|
+
export declare const LEGACY_RENUMBER_JOURNAL_SCHEMA = "holmes-legacy-renumber-journal/1";
|
|
25
|
+
export interface LegacyRenumberJournal {
|
|
26
|
+
schema: typeof LEGACY_RENUMBER_JOURNAL_SCHEMA;
|
|
27
|
+
operationId: string;
|
|
28
|
+
workspaceId: string;
|
|
29
|
+
storeLocator: string;
|
|
30
|
+
oldBase: string;
|
|
31
|
+
newBase: string;
|
|
32
|
+
changes: Array<{
|
|
33
|
+
locator: string;
|
|
34
|
+
before: string | null;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/** Inspection may use committed identity before local replica registration; pending writes still block it. */
|
|
38
|
+
export declare function assertNoPendingEntityPublication(storeRoot: string): void;
|
|
39
|
+
export declare function inspectEntityStore(storeRoot: string): {
|
|
40
|
+
ok: true;
|
|
41
|
+
state: "active";
|
|
42
|
+
storeLocator: string;
|
|
43
|
+
storeId: string;
|
|
44
|
+
} | {
|
|
45
|
+
ok: true;
|
|
46
|
+
state: "legacy";
|
|
47
|
+
storeLocator: string;
|
|
48
|
+
storeId?: undefined;
|
|
49
|
+
};
|
|
50
|
+
export declare function planEntityAdoption(storeRoot: string): EntityAdoptionPlan;
|
|
51
|
+
/** Read barrier for the real repository. Legacy stores without an entity subsystem remain untouched. */
|
|
52
|
+
export declare function assertEntityRepositoryReadable(storeRoot: string): void;
|
|
53
|
+
export declare function readEntityRepositorySnapshot(storeRoot: string): Array<{
|
|
54
|
+
spec: Spec;
|
|
55
|
+
version: string;
|
|
56
|
+
}> | undefined;
|
|
57
|
+
/** A raw, UUID-bound snapshot for renumber planning; no identity allocation or canonical writes. */
|
|
58
|
+
export declare function readEntityRenumberSnapshot(storeRoot: string): {
|
|
59
|
+
workspaceId: string;
|
|
60
|
+
storeId: string;
|
|
61
|
+
storeLocator: string;
|
|
62
|
+
registrationVersion: string;
|
|
63
|
+
entries: {
|
|
64
|
+
entityId: string;
|
|
65
|
+
documentLocator: string;
|
|
66
|
+
text: string;
|
|
67
|
+
mapping: string;
|
|
68
|
+
mappingVersion: string;
|
|
69
|
+
}[];
|
|
70
|
+
referenceNamespaces: {
|
|
71
|
+
entityId: string;
|
|
72
|
+
displayId: string;
|
|
73
|
+
storeId: string;
|
|
74
|
+
workspaceId: string;
|
|
75
|
+
}[];
|
|
76
|
+
};
|
|
77
|
+
/** Supply a validated snapshot while retaining the same store ownership through publication. */
|
|
78
|
+
export declare function withEntityRenumberSnapshot<T>(storeRoot: string, act: (snapshot: ReturnType<typeof readEntityRenumberSnapshot>, assertCurrent: () => void) => T | Promise<T>): Promise<T>;
|
|
79
|
+
export declare function writeEntityRepository(storeRoot: string, spec: Spec, targetPath: string, expectedVersion: string | undefined, legacyWrite: () => Promise<{
|
|
80
|
+
version: string;
|
|
81
|
+
}>): Promise<{
|
|
82
|
+
version: string;
|
|
83
|
+
}>;
|
|
84
|
+
/** Inspection is not authorization to execute a journal or remove its lock. */
|
|
85
|
+
export declare function planEntityRecovery(storeRoot: string): {
|
|
86
|
+
sourceOwner?: {
|
|
87
|
+
token: string;
|
|
88
|
+
version: string;
|
|
89
|
+
} | undefined;
|
|
90
|
+
lockOwner?: {
|
|
91
|
+
token: string;
|
|
92
|
+
version: string;
|
|
93
|
+
} | undefined;
|
|
94
|
+
schema: "holmes-entity-recovery/1";
|
|
95
|
+
workspaceId: string;
|
|
96
|
+
storeLocator: string;
|
|
97
|
+
operations: ({
|
|
98
|
+
operationId: string;
|
|
99
|
+
kind: "aborted";
|
|
100
|
+
storeId: string;
|
|
101
|
+
journalVersion: null;
|
|
102
|
+
state: "empty";
|
|
103
|
+
targets: Array<{
|
|
104
|
+
locator: string;
|
|
105
|
+
beforeVersion: string | null;
|
|
106
|
+
afterVersion: string | null;
|
|
107
|
+
currentVersion: string | null;
|
|
108
|
+
state: "unchanged" | "applied" | "unapplied" | "conflict";
|
|
109
|
+
}>;
|
|
110
|
+
inventoryConflicts: string[];
|
|
111
|
+
leftovers: string[];
|
|
112
|
+
} | {
|
|
113
|
+
retired?: true | undefined;
|
|
114
|
+
operationId: string;
|
|
115
|
+
kind: "adoption" | "write" | "legacy-renumber";
|
|
116
|
+
storeId: string | null;
|
|
117
|
+
journalVersion: string;
|
|
118
|
+
state: string;
|
|
119
|
+
targets: {
|
|
120
|
+
locator: string;
|
|
121
|
+
beforeVersion: string | null;
|
|
122
|
+
afterVersion: string | null;
|
|
123
|
+
currentVersion: string | null;
|
|
124
|
+
state: string;
|
|
125
|
+
}[];
|
|
126
|
+
inventoryConflicts: string[];
|
|
127
|
+
leftovers?: undefined;
|
|
128
|
+
})[];
|
|
129
|
+
};
|
|
130
|
+
type EntityRecoveryPlan = ReturnType<typeof planEntityRecovery>;
|
|
131
|
+
export type RecoverySpecPolicy = (before: Spec | null, after: Spec, inventory: Spec[]) => () => void;
|
|
132
|
+
export declare function validateEntityRecoveryPlan(value: unknown): EntityRecoveryPlan;
|
|
133
|
+
export declare function entityRecoveryTarget(plan: EntityRecoveryPlan): string;
|
|
134
|
+
export declare function recoverEntityStore(storeRoot: string, plan: EntityRecoveryPlan, policy?: RecoverySpecPolicy, onComplete?: () => void): ReturnType<typeof inspectEntityStore>;
|
|
135
|
+
export declare function adoptEntityStore(storeRoot: string, plan: EntityAdoptionPlan): ReturnType<typeof inspectEntityStore>;
|