@cleocode/contracts 2026.9.16 → 2026.9.17
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/agent-registry.d.ts +11 -1
- package/dist/agent-registry.d.ts.map +1 -1
- package/dist/config.d.ts +42 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/credential-transfer.d.ts +103 -0
- package/dist/credential-transfer.d.ts.map +1 -0
- package/dist/credential-transfer.js +21 -0
- package/dist/credential-transfer.js.map +1 -0
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +7 -2
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/doctor.d.ts +103 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -1
- package/dist/errors.js.map +1 -1
- package/dist/graph.d.ts +118 -1
- package/dist/graph.d.ts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/operations/nexus-scope-map.d.ts +16 -0
- package/dist/operations/nexus-scope-map.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.js +16 -0
- package/dist/operations/nexus-scope-map.js.map +1 -1
- package/dist/operations/nexus-scope.d.ts +8 -0
- package/dist/operations/nexus-scope.d.ts.map +1 -1
- package/dist/operations/nexus.d.ts +77 -5
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/portable-bundle.d.ts +436 -0
- package/dist/portable-bundle.d.ts.map +1 -0
- package/dist/portable-bundle.js +17 -0
- package/dist/portable-bundle.js.map +1 -0
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/agent-registry.ts +11 -1
- package/src/config.ts +44 -0
- package/src/credential-transfer.ts +112 -0
- package/src/dispatch/operations-registry.ts +8 -2
- package/src/doctor.ts +115 -0
- package/src/errors.ts +7 -1
- package/src/graph.ts +122 -1
- package/src/index.ts +50 -0
- package/src/operations/nexus-scope-map.ts +16 -0
- package/src/operations/nexus-scope.ts +9 -0
- package/src/operations/nexus.ts +87 -5
- package/src/portable-bundle.ts +476 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable bundle (manifest v2) — contract types for lossless machine migration.
|
|
3
|
+
*
|
|
4
|
+
* The v1 `.cleobundle` format (see `backup-manifest.ts`) snapshots a fixed list
|
|
5
|
+
* of pre-E6 database filenames. After the E6 cutover (ADR-068) none of those
|
|
6
|
+
* files is the live store any more, so a v1 export of a healthy project
|
|
7
|
+
* captured nothing but three JSON files and reported success. Manifest v2
|
|
8
|
+
* records what was actually exported, what was deliberately excluded (with its
|
|
9
|
+
* size), which secrets were omitted, and the per-table row counts that the
|
|
10
|
+
* import side re-counts to prove the restore is lossless.
|
|
11
|
+
*
|
|
12
|
+
* @task T12318
|
|
13
|
+
* @epic T12317
|
|
14
|
+
* @module portable-bundle
|
|
15
|
+
*/
|
|
16
|
+
import type { CredentialDescriptor, CredentialReentry } from './credential-transfer.js';
|
|
17
|
+
/**
|
|
18
|
+
* Export scope for a portable bundle.
|
|
19
|
+
*
|
|
20
|
+
* - `project` — one project's `.cleo/` tree.
|
|
21
|
+
* - `global` — the global CLEO home (and config home).
|
|
22
|
+
* - `all` — `project` + `global`.
|
|
23
|
+
* - `machine` — `global` + every registered project that still exists and
|
|
24
|
+
* holds a live store (temp and test-fixture paths are skipped).
|
|
25
|
+
*/
|
|
26
|
+
export type PortableBundleScope = 'project' | 'global' | 'all' | 'machine';
|
|
27
|
+
/**
|
|
28
|
+
* Role of a SQLite database inside a bundle section.
|
|
29
|
+
*
|
|
30
|
+
* - `primary` — the live consolidated store (`cleo.db`) for that scope.
|
|
31
|
+
* - `legacy` — a pre-E6 per-domain file (`tasks.db`, `brain.db`, …) that
|
|
32
|
+
* still exists on disk. Kept for provenance; nothing reads it after E6.
|
|
33
|
+
* - `auxiliary` — any other SQLite file found in the tree (e.g. the llmtxt or
|
|
34
|
+
* blob-manifest stores, `*.bak` snapshots).
|
|
35
|
+
*/
|
|
36
|
+
export type PortableDatabaseRole = 'primary' | 'legacy' | 'auxiliary';
|
|
37
|
+
/** A SQLite database captured with `VACUUM INTO` (consistent under WAL). */
|
|
38
|
+
export interface PortableDatabaseEntry {
|
|
39
|
+
/** Path relative to the section root, POSIX separators (e.g. `cleo.db`). */
|
|
40
|
+
relPath: string;
|
|
41
|
+
/** Path inside the archive. */
|
|
42
|
+
bundlePath: string;
|
|
43
|
+
/** Primary / legacy / auxiliary classification. */
|
|
44
|
+
role: PortableDatabaseRole;
|
|
45
|
+
/** Byte size of the snapshot. */
|
|
46
|
+
size: number;
|
|
47
|
+
/** SHA-256 hex of the snapshot bytes. */
|
|
48
|
+
sha256: string;
|
|
49
|
+
/** Row count of every ordinary table, keyed by table name. */
|
|
50
|
+
rowCounts: Record<string, number>;
|
|
51
|
+
/**
|
|
52
|
+
* Tables that could not be counted, with the reason. Virtual tables are
|
|
53
|
+
* listed here (their data lives in shadow tables, which ARE counted).
|
|
54
|
+
*/
|
|
55
|
+
uncountedTables: Record<string, string>;
|
|
56
|
+
}
|
|
57
|
+
/** A regular file captured byte-for-byte. */
|
|
58
|
+
export interface PortableFileEntry {
|
|
59
|
+
/** Path relative to the section root, POSIX separators. */
|
|
60
|
+
relPath: string;
|
|
61
|
+
/** Path inside the archive. */
|
|
62
|
+
bundlePath: string;
|
|
63
|
+
/** Byte size. */
|
|
64
|
+
size: number;
|
|
65
|
+
/** SHA-256 hex of the file bytes. */
|
|
66
|
+
sha256: string;
|
|
67
|
+
/** True when the file was classified as a secret (only present in encrypted bundles). */
|
|
68
|
+
secret: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** A symbolic link inside the root whose target also stays inside the root. */
|
|
71
|
+
export interface PortableSymlinkEntry {
|
|
72
|
+
/** Link path relative to the section root. */
|
|
73
|
+
relPath: string;
|
|
74
|
+
/** Link target exactly as stored (relative targets stay relative). */
|
|
75
|
+
target: string;
|
|
76
|
+
}
|
|
77
|
+
/** Material deliberately left out of the bundle. */
|
|
78
|
+
export interface PortableExclusion {
|
|
79
|
+
/** Path relative to the section root (a directory or a file). */
|
|
80
|
+
relPath: string;
|
|
81
|
+
/** Why it was excluded. */
|
|
82
|
+
reason: string;
|
|
83
|
+
/** Bytes measured under this path (a lower bound when `sizeComplete` is false). */
|
|
84
|
+
bytes: number;
|
|
85
|
+
/** Files measured under this path (a lower bound when `sizeComplete` is false). */
|
|
86
|
+
fileCount: number;
|
|
87
|
+
/** False when measurement stopped at its entry budget; `bytes` is then a lower bound. */
|
|
88
|
+
sizeComplete: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Credential material (`portable-secret`, ADR-093) that an UNENCRYPTED bundle
|
|
92
|
+
* left out, and what the user must re-enter on the target machine.
|
|
93
|
+
*
|
|
94
|
+
* - a whole secret file: `relPath` is the file, `table`/`columns` are absent;
|
|
95
|
+
* - credential COLUMNS inside a database: `relPath` is the database, and the
|
|
96
|
+
* listed columns were cleared (set to NULL/empty) in `rows` rows of `table`.
|
|
97
|
+
* The rows themselves (identities, sessions) are kept.
|
|
98
|
+
*/
|
|
99
|
+
export interface PortableReentryItem {
|
|
100
|
+
/** Secret file, or the database holding the redacted columns (relative to the section root). */
|
|
101
|
+
relPath: string;
|
|
102
|
+
/** Table whose credential columns were cleared (column redaction only). */
|
|
103
|
+
table?: string;
|
|
104
|
+
/** Cleared columns (column redaction only). */
|
|
105
|
+
columns?: string[];
|
|
106
|
+
/** Rows whose credential columns were cleared (column redaction only). */
|
|
107
|
+
rows?: number;
|
|
108
|
+
/** What must be redone on the target machine. */
|
|
109
|
+
remedy: string;
|
|
110
|
+
/**
|
|
111
|
+
* The individual credentials behind this item, each with the one command
|
|
112
|
+
* that re-enters it (T12326). Present when the store's credentials are
|
|
113
|
+
* enumerable; absent for opaque secret files and tables with no re-entry
|
|
114
|
+
* command.
|
|
115
|
+
*/
|
|
116
|
+
credentials?: CredentialReentry[];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Credentials sealed under the bundle passphrase for one section (encrypted
|
|
120
|
+
* bundles only, T12326). The payload holds the credential VALUES, never the
|
|
121
|
+
* machine-key: the importing device re-encrypts them under its own key.
|
|
122
|
+
*/
|
|
123
|
+
export interface PortableSealedCredentials {
|
|
124
|
+
/** Archive path of the sealed payload. */
|
|
125
|
+
bundlePath: string;
|
|
126
|
+
/** Payload size in bytes. */
|
|
127
|
+
size: number;
|
|
128
|
+
/** SHA-256 of the payload. */
|
|
129
|
+
sha256: string;
|
|
130
|
+
/** Credentials carried (identities only). */
|
|
131
|
+
credentials: CredentialDescriptor[];
|
|
132
|
+
/** Credentials the exporting device could not decrypt; the target must re-enter them. */
|
|
133
|
+
reentry: CredentialReentry[];
|
|
134
|
+
}
|
|
135
|
+
/** Common shape of one exported root (a project `.cleo/`, the CLEO home, the config home). */
|
|
136
|
+
export interface PortableSectionBase {
|
|
137
|
+
/** Absolute path of the root on the source machine. */
|
|
138
|
+
originalRoot: string;
|
|
139
|
+
/** Archive directory holding this section's files. */
|
|
140
|
+
bundlePrefix: string;
|
|
141
|
+
/** SQLite snapshots. */
|
|
142
|
+
databases: PortableDatabaseEntry[];
|
|
143
|
+
/** Byte-for-byte files. */
|
|
144
|
+
files: PortableFileEntry[];
|
|
145
|
+
/** Symlinks recreated on import (targets inside the root only). */
|
|
146
|
+
symlinks: PortableSymlinkEntry[];
|
|
147
|
+
/** Deliberately excluded material, with sizes. */
|
|
148
|
+
excluded: PortableExclusion[];
|
|
149
|
+
/** Credentials left out because the bundle is not encrypted (empty for encrypted bundles). */
|
|
150
|
+
requiresReentry: PortableReentryItem[];
|
|
151
|
+
/** Credentials sealed under the passphrase (encrypted bundles with credentials only). */
|
|
152
|
+
sealedCredentials?: PortableSealedCredentials;
|
|
153
|
+
}
|
|
154
|
+
/** One legacy table that holds more rows than its consolidated counterpart. */
|
|
155
|
+
export interface PortableLegacyEvidence {
|
|
156
|
+
/** Legacy database (relative path, e.g. `tasks.db`). */
|
|
157
|
+
database: string;
|
|
158
|
+
/** Table in the legacy database. */
|
|
159
|
+
table: string;
|
|
160
|
+
/** Rows in the legacy table. */
|
|
161
|
+
legacyRows: number;
|
|
162
|
+
/** Consolidated table it maps to in the primary store. */
|
|
163
|
+
primaryTable: string;
|
|
164
|
+
/** Rows in the primary table (0 when the primary store or table is absent). */
|
|
165
|
+
primaryRows: number;
|
|
166
|
+
/**
|
|
167
|
+
* Rows in a same-named UNPREFIXED table inside the primary store (e.g. a
|
|
168
|
+
* bare `tasks` table in `cleo.db`), when it exists and differs from
|
|
169
|
+
* `primaryTable`. Pre-cutover data sometimes lives there instead.
|
|
170
|
+
*/
|
|
171
|
+
primaryUnprefixedRows?: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Whether a root holds data that exists ONLY in pre-E6 legacy files (never
|
|
175
|
+
* migrated into `cleo.db`). Export preserves those files losslessly; it does
|
|
176
|
+
* not migrate them.
|
|
177
|
+
*/
|
|
178
|
+
export interface PortableUnmigratedLegacyReport {
|
|
179
|
+
/** True when any legacy table holds more rows than its consolidated counterpart. */
|
|
180
|
+
detected: boolean;
|
|
181
|
+
/** Per-table evidence. */
|
|
182
|
+
evidence: PortableLegacyEvidence[];
|
|
183
|
+
}
|
|
184
|
+
/** The key per-project record counts surfaced in results (subset of `rowCounts`). */
|
|
185
|
+
export type PortableKeyCounts = Record<string, number>;
|
|
186
|
+
/** One project's `.cleo/` directory. */
|
|
187
|
+
export interface PortableProjectSection extends PortableSectionBase {
|
|
188
|
+
/** Absolute project root on the source machine (parent of `.cleo/`). */
|
|
189
|
+
originalPath: string;
|
|
190
|
+
/** `projectId` from `.cleo/project-info.json`, else the registry row's id (machine scope), else null. */
|
|
191
|
+
projectId: string | null;
|
|
192
|
+
/** Project name (project-info.json `name`, else the directory basename). */
|
|
193
|
+
name: string;
|
|
194
|
+
/** Counts of the key tables (tasks, sessions, brain records) in the primary store. */
|
|
195
|
+
keyCounts: PortableKeyCounts;
|
|
196
|
+
/** Data present only in legacy per-domain files. */
|
|
197
|
+
unmigratedLegacyData: PortableUnmigratedLegacyReport;
|
|
198
|
+
}
|
|
199
|
+
/** The global CLEO home plus the config home. */
|
|
200
|
+
export interface PortableGlobalSection {
|
|
201
|
+
/** `<cleoHome>` content. */
|
|
202
|
+
home: PortableSectionBase;
|
|
203
|
+
/** `<configHome>` content, or null when the directory does not exist. */
|
|
204
|
+
config: PortableSectionBase | null;
|
|
205
|
+
/** Counts of the key tables in the global primary store. */
|
|
206
|
+
keyCounts: PortableKeyCounts;
|
|
207
|
+
/** Data present only in legacy per-domain files of the CLEO home. */
|
|
208
|
+
unmigratedLegacyData: PortableUnmigratedLegacyReport;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Why `machine` scope skipped a registered project.
|
|
212
|
+
*
|
|
213
|
+
* - `path-missing` — the registered directory no longer exists.
|
|
214
|
+
* - `no-live-store` — `.cleo/` has neither `cleo.db` nor any legacy per-domain store.
|
|
215
|
+
* - `temp-path` — the path is a temp or test-fixture directory.
|
|
216
|
+
* - `duplicate-path` — resolves to a project already included.
|
|
217
|
+
* - `is-global-home` — its `.cleo/` resolves to the global CLEO home (exported as the global section).
|
|
218
|
+
*/
|
|
219
|
+
export type PortableSkipReason = 'path-missing' | 'no-live-store' | 'temp-path' | 'duplicate-path' | 'is-global-home';
|
|
220
|
+
/** A registered project that `machine` scope did not export, and why. */
|
|
221
|
+
export interface PortableSkippedProject {
|
|
222
|
+
/** Registered absolute path. */
|
|
223
|
+
path: string;
|
|
224
|
+
/** Registered projectId (may be empty for malformed rows). */
|
|
225
|
+
projectId: string;
|
|
226
|
+
/** Reason code. */
|
|
227
|
+
reason: PortableSkipReason;
|
|
228
|
+
}
|
|
229
|
+
/** Root of `manifest.json` in a v2 portable bundle. */
|
|
230
|
+
export interface PortableBundleManifest {
|
|
231
|
+
/** Format marker. */
|
|
232
|
+
format: 'cleo-portable-bundle';
|
|
233
|
+
/** Manifest version; major 2 distinguishes it from v1 `.cleobundle` manifests. */
|
|
234
|
+
manifestVersion: '2.0.0';
|
|
235
|
+
/** Provenance. */
|
|
236
|
+
backup: {
|
|
237
|
+
/** ISO-8601 creation time. */
|
|
238
|
+
createdAt: string;
|
|
239
|
+
/** CLEO version that wrote the bundle. */
|
|
240
|
+
cleoVersion: string;
|
|
241
|
+
/** Export scope. */
|
|
242
|
+
scope: PortableBundleScope;
|
|
243
|
+
/** Advisory label (the export name). */
|
|
244
|
+
label: string;
|
|
245
|
+
/** Host name of the source machine (advisory). */
|
|
246
|
+
sourceHost: string;
|
|
247
|
+
/** Whether the archive is encrypted. */
|
|
248
|
+
encrypted: boolean;
|
|
249
|
+
/** Whether secrets are present in the archive (true only when encrypted). */
|
|
250
|
+
secretsIncluded: boolean;
|
|
251
|
+
/** Memory tables are always included (ADR-093); recorded so readers need not infer it. */
|
|
252
|
+
memoriesIncluded: true;
|
|
253
|
+
};
|
|
254
|
+
/** Global section, present for `global` / `all` / `machine`. */
|
|
255
|
+
global: PortableGlobalSection | null;
|
|
256
|
+
/** Project sections. */
|
|
257
|
+
projects: PortableProjectSection[];
|
|
258
|
+
/** Registered projects skipped by `machine` scope. */
|
|
259
|
+
skippedProjects: PortableSkippedProject[];
|
|
260
|
+
/** Integrity block. */
|
|
261
|
+
integrity: {
|
|
262
|
+
/** Always sha256. */
|
|
263
|
+
algorithm: 'sha256';
|
|
264
|
+
/** SHA-256 of this manifest serialised with `manifestHash` set to "". */
|
|
265
|
+
manifestHash: string;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
/** Result of exporting a portable bundle. */
|
|
269
|
+
export interface PortableExportResult {
|
|
270
|
+
/** Absolute path of the written bundle. */
|
|
271
|
+
bundlePath: string;
|
|
272
|
+
/** Bundle size in bytes. */
|
|
273
|
+
size: number;
|
|
274
|
+
/** Export scope. */
|
|
275
|
+
scope: PortableBundleScope;
|
|
276
|
+
/** Whether the bundle is encrypted. */
|
|
277
|
+
encrypted: boolean;
|
|
278
|
+
/** Whether secrets were included. */
|
|
279
|
+
secretsIncluded: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Memory disclosure (ADR-093): memories are always exported, encrypted or
|
|
282
|
+
* not. `counts` sums the memory tables across every database in the bundle.
|
|
283
|
+
*/
|
|
284
|
+
memory: {
|
|
285
|
+
/** Always true. */
|
|
286
|
+
included: true;
|
|
287
|
+
/** Whether they are protected by bundle encryption. */
|
|
288
|
+
encrypted: boolean;
|
|
289
|
+
/** Summed row counts per memory table. */
|
|
290
|
+
counts: Record<string, number>;
|
|
291
|
+
/** Plain-language notice (recommends `--encrypt` when unencrypted). */
|
|
292
|
+
notice: string;
|
|
293
|
+
};
|
|
294
|
+
/** Per-section summary. */
|
|
295
|
+
sections: Array<{
|
|
296
|
+
/** `global-home`, `global-config`, or `project`. */
|
|
297
|
+
kind: 'global-home' | 'global-config' | 'project';
|
|
298
|
+
/** Source root. */
|
|
299
|
+
root: string;
|
|
300
|
+
/** Project name (projects only). */
|
|
301
|
+
name?: string;
|
|
302
|
+
/** Number of databases captured. */
|
|
303
|
+
databases: number;
|
|
304
|
+
/** Number of files captured. */
|
|
305
|
+
files: number;
|
|
306
|
+
/** Key table counts. */
|
|
307
|
+
keyCounts?: PortableKeyCounts;
|
|
308
|
+
/** Legacy-only data report (global home and projects). */
|
|
309
|
+
unmigratedLegacyData?: PortableUnmigratedLegacyReport;
|
|
310
|
+
/** Excluded material with sizes. */
|
|
311
|
+
excluded: PortableExclusion[];
|
|
312
|
+
/** Credentials left out (unencrypted bundles). */
|
|
313
|
+
requiresReentry: PortableReentryItem[];
|
|
314
|
+
}>;
|
|
315
|
+
/** Machine scope: included/skipped tallies. */
|
|
316
|
+
machine?: {
|
|
317
|
+
/** Registered projects considered. */
|
|
318
|
+
registered: number;
|
|
319
|
+
/** Projects exported. */
|
|
320
|
+
included: number;
|
|
321
|
+
/** Skipped projects grouped by reason. */
|
|
322
|
+
skippedByReason: Partial<Record<PortableSkipReason, number>>;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/** Per-table comparison of manifest vs restored row counts. */
|
|
326
|
+
export interface PortableTableComparison {
|
|
327
|
+
/** Table name. */
|
|
328
|
+
table: string;
|
|
329
|
+
/** Row count recorded at export. */
|
|
330
|
+
expected: number;
|
|
331
|
+
/** Row count re-counted after restore (null when uncountable). */
|
|
332
|
+
actual: number | null;
|
|
333
|
+
}
|
|
334
|
+
/** An absolute path encountered while relocating, reported by location. */
|
|
335
|
+
export interface PortablePathFinding {
|
|
336
|
+
/** Where it was found: `<db relPath>:<table>.<column>` or a file relPath. */
|
|
337
|
+
location: string;
|
|
338
|
+
/** Number of values (rows or occurrences) affected. */
|
|
339
|
+
count: number;
|
|
340
|
+
/** Example value (truncated). */
|
|
341
|
+
example?: string;
|
|
342
|
+
}
|
|
343
|
+
/** Relocation report for one project. */
|
|
344
|
+
export interface PortableRelocationReport {
|
|
345
|
+
/** Original project root. */
|
|
346
|
+
fromRoot: string;
|
|
347
|
+
/** New project root. */
|
|
348
|
+
toRoot: string;
|
|
349
|
+
/** Values rewritten from the old root to the new one. */
|
|
350
|
+
rewritten: PortablePathFinding[];
|
|
351
|
+
/** Values that still reference the old root and were deliberately left (historical record). */
|
|
352
|
+
leftUnderOldRoot: PortablePathFinding[];
|
|
353
|
+
/** Absolute paths outside the old root, left unchanged. */
|
|
354
|
+
leftOutsideRoot: PortablePathFinding[];
|
|
355
|
+
/**
|
|
356
|
+
* Rewritten locators whose new target does not exist on this machine at
|
|
357
|
+
* import time (e.g. the repository has not been cloned there yet, or the
|
|
358
|
+
* project was re-rooted into a subdirectory that does not contain it).
|
|
359
|
+
*/
|
|
360
|
+
rewrittenTargetMissing: PortablePathFinding[];
|
|
361
|
+
}
|
|
362
|
+
/** Restore outcome for one section. */
|
|
363
|
+
export interface PortableImportSectionResult {
|
|
364
|
+
/** Section kind. */
|
|
365
|
+
kind: 'global-home' | 'global-config' | 'project';
|
|
366
|
+
/** Source root recorded in the bundle. */
|
|
367
|
+
originalRoot: string;
|
|
368
|
+
/** Destination root written. */
|
|
369
|
+
destinationRoot: string;
|
|
370
|
+
/** Project name (projects only). */
|
|
371
|
+
name?: string;
|
|
372
|
+
/** projectId (projects only). */
|
|
373
|
+
projectId?: string | null;
|
|
374
|
+
/** Files written. */
|
|
375
|
+
filesWritten: number;
|
|
376
|
+
/** Databases written. */
|
|
377
|
+
databasesWritten: number;
|
|
378
|
+
/** Tables compared across all databases in the section. */
|
|
379
|
+
tablesCompared: number;
|
|
380
|
+
/**
|
|
381
|
+
* Files and databases whose placed SHA-256 was compared with the manifest.
|
|
382
|
+
* Entries rewritten by relocation are excluded (listed in `hashSkipped`).
|
|
383
|
+
*/
|
|
384
|
+
hashesCompared: number;
|
|
385
|
+
/** Placed entries whose SHA-256 differs from the manifest (empty = byte-identical). */
|
|
386
|
+
hashMismatches: string[];
|
|
387
|
+
/** Entries not hash-compared because relocation rewrote them by design. */
|
|
388
|
+
hashSkipped: string[];
|
|
389
|
+
/** Tables whose restored count differs from the manifest (empty = lossless). */
|
|
390
|
+
mismatches: Array<PortableTableComparison & {
|
|
391
|
+
database: string;
|
|
392
|
+
}>;
|
|
393
|
+
/** Key counts, expected vs actual. */
|
|
394
|
+
keyCounts: Array<PortableTableComparison>;
|
|
395
|
+
/** Relocation report (projects placed at a different root only). */
|
|
396
|
+
relocation?: PortableRelocationReport;
|
|
397
|
+
/** Legacy-only data carried over unmigrated (projects only). */
|
|
398
|
+
unmigratedLegacyData?: PortableUnmigratedLegacyReport;
|
|
399
|
+
/** Global registry update for this project (projects only). */
|
|
400
|
+
registry?: {
|
|
401
|
+
/** Outcome. */
|
|
402
|
+
status: 'updated' | 'registered' | 'unchanged' | 'not-in-registry' | 'skipped' | 'failed';
|
|
403
|
+
/** Detail. */
|
|
404
|
+
detail: string;
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
/** Result of importing a portable bundle. */
|
|
408
|
+
export interface PortableImportResult {
|
|
409
|
+
/** Bundle imported. */
|
|
410
|
+
bundlePath: string;
|
|
411
|
+
/** Scope recorded in the bundle. */
|
|
412
|
+
scope: PortableBundleScope;
|
|
413
|
+
/** Per-section outcomes. */
|
|
414
|
+
sections: PortableImportSectionResult[];
|
|
415
|
+
/** True when every table count matched and every non-relocated entry is byte-identical. */
|
|
416
|
+
lossless: boolean;
|
|
417
|
+
/** Whether secrets were present in the bundle. */
|
|
418
|
+
secretsIncluded: boolean;
|
|
419
|
+
/** Credentials the user must re-enter (unencrypted bundles). */
|
|
420
|
+
requiresReentry: Array<PortableReentryItem & {
|
|
421
|
+
section: string;
|
|
422
|
+
}>;
|
|
423
|
+
/**
|
|
424
|
+
* Sealed credentials re-encrypted under the target machine-key, and those
|
|
425
|
+
* that could not be (each with its re-entry command). Encrypted bundles only.
|
|
426
|
+
*/
|
|
427
|
+
credentials?: {
|
|
428
|
+
restored: Array<CredentialDescriptor & {
|
|
429
|
+
section: string;
|
|
430
|
+
}>;
|
|
431
|
+
reentry: Array<CredentialReentry & {
|
|
432
|
+
section: string;
|
|
433
|
+
}>;
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
//# sourceMappingURL=portable-bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-bundle.d.ts","sourceRoot":"","sources":["../src/portable-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAMxF;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAM3E;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEtE,4EAA4E;AAC5E,MAAM,WAAW,qBAAqB;IAC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f,MAAM,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;QAC1F,cAAc;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,4BAA4B;IAC5B,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,2FAA2F;IAC3F,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,eAAe,EAAE,OAAO,CAAC;IACzB,gEAAgE;IAChE,eAAe,EAAE,KAAK,CAAC,mBAAmB,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClE;;;OAGG;IACH,WAAW,CAAC,EAAE;QACZ,QAAQ,EAAE,KAAK,CAAC,oBAAoB,GAAG;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC5D,OAAO,EAAE,KAAK,CAAC,iBAAiB,GAAG;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACzD,CAAC;CACH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable bundle (manifest v2) — contract types for lossless machine migration.
|
|
3
|
+
*
|
|
4
|
+
* The v1 `.cleobundle` format (see `backup-manifest.ts`) snapshots a fixed list
|
|
5
|
+
* of pre-E6 database filenames. After the E6 cutover (ADR-068) none of those
|
|
6
|
+
* files is the live store any more, so a v1 export of a healthy project
|
|
7
|
+
* captured nothing but three JSON files and reported success. Manifest v2
|
|
8
|
+
* records what was actually exported, what was deliberately excluded (with its
|
|
9
|
+
* size), which secrets were omitted, and the per-table row counts that the
|
|
10
|
+
* import side re-counts to prove the restore is lossless.
|
|
11
|
+
*
|
|
12
|
+
* @task T12318
|
|
13
|
+
* @epic T12317
|
|
14
|
+
* @module portable-bundle
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=portable-bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-bundle.js","sourceRoot":"","sources":["../src/portable-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/contracts",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.17",
|
|
4
4
|
"description": "Domain types, interfaces, and contracts for the CLEO ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
"dependencies": {
|
|
195
195
|
"zod": "^4.3.6",
|
|
196
196
|
"zod-to-json-schema": "^3.25.2",
|
|
197
|
-
"@cleocode/lafs": "2026.9.
|
|
197
|
+
"@cleocode/lafs": "2026.9.17"
|
|
198
198
|
},
|
|
199
199
|
"scripts": {
|
|
200
200
|
"build": "tsc -b --force && node scripts/copy-assets.mjs && node scripts/emit-schemas.mjs",
|