artifact-graph 0.12.0 → 0.13.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/CHANGELOG.md +18 -0
- package/CONTRIBUTING.md +1 -1
- package/INSTALL.md +1 -1
- package/README.md +50 -2
- package/README.zh-CN.md +43 -2
- package/contracts/restructure-mapping/schema.json +263 -0
- package/contracts/restructure-plan/schema.json +112 -0
- package/contracts/restructure-request/schema.json +48 -0
- package/dist/cli.js +2038 -225
- package/dist/index.cjs +1906 -170
- package/dist/index.d.cts +480 -3
- package/dist/index.d.ts +480 -3
- package/dist/index.js +1857 -162
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { dirname, extname } from 'node:path';
|
|
2
|
+
import * as skill_family_harness_node from 'skill-family-harness-node';
|
|
3
|
+
import { FoundationFileSetResult, FoundationFileSetOutcome, FoundationFileSetValidation, FoundationFileSetPathResult, FoundationFileSetErrorKind, FoundationFileSetApplyRequest, FoundationFilesystemRootBinding, FoundationStateStoreRecoveryObservation } from 'skill-family-harness-node';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* packet-constants.ts
|
|
@@ -660,6 +662,7 @@ interface VersionLockRefreshOptions {
|
|
|
660
662
|
changedPaths?: string[];
|
|
661
663
|
all?: boolean;
|
|
662
664
|
removeOrphans?: boolean;
|
|
665
|
+
removeOrphanEdges?: string[];
|
|
663
666
|
}
|
|
664
667
|
interface VersionLockRefreshResult {
|
|
665
668
|
schemaVersion: '1.0';
|
|
@@ -746,6 +749,7 @@ interface NativeBindingSuccessDiagnostic {
|
|
|
746
749
|
}
|
|
747
750
|
type BindingLoader = () => unknown;
|
|
748
751
|
|
|
752
|
+
declare const REQUIRED_NODE_VERSION: ">=22.22.2 <23";
|
|
749
753
|
type ArtifactGraphCliSource = 'node_modules' | 'path' | 'legacy' | 'plugin-bundled';
|
|
750
754
|
interface ArtifactGraphCliCandidate {
|
|
751
755
|
source: ArtifactGraphCliSource;
|
|
@@ -770,7 +774,7 @@ interface ArtifactChainDoctorReport {
|
|
|
770
774
|
node: {
|
|
771
775
|
version: string;
|
|
772
776
|
compatible: boolean;
|
|
773
|
-
required:
|
|
777
|
+
required: typeof REQUIRED_NODE_VERSION;
|
|
774
778
|
};
|
|
775
779
|
config: {
|
|
776
780
|
path: string;
|
|
@@ -1308,6 +1312,471 @@ declare class ContractCatalog {
|
|
|
1308
1312
|
*/
|
|
1309
1313
|
declare function loadContractCatalog(contractsDir: string, options?: LoadContractOptions): Promise<ContractCatalog>;
|
|
1310
1314
|
|
|
1315
|
+
/**
|
|
1316
|
+
* Mechanism-only boundary for the adopted `foundation.harness.file-set-recovery`
|
|
1317
|
+
* capability. This file builds the frozen Foundation request from a plan 1.1 and
|
|
1318
|
+
* projects the closed mechanism result back into domain language. It owns no
|
|
1319
|
+
* plan semantics: every field it sends is a value the planner already froze.
|
|
1320
|
+
*/
|
|
1321
|
+
/** Fixed in-root recovery directory; Foundation never creates it. */
|
|
1322
|
+
declare const RESTRUCTURE_RECOVERY_REL_PATH = ".foundation-file-apply";
|
|
1323
|
+
/** Journal directory the maintenance observation must describe. */
|
|
1324
|
+
declare const RESTRUCTURE_RECOVERY_JOURNAL_REL_PATH = ".foundation-file-apply/journal";
|
|
1325
|
+
/** Real-directory mode Foundation requires for the mechanism root. */
|
|
1326
|
+
declare const RESTRUCTURE_RECOVERY_ROOT_MODE = 448;
|
|
1327
|
+
/** Runtime the qualification below is restricted to. */
|
|
1328
|
+
declare const RESTRUCTURE_QUALIFIED_PLATFORM = "darwin";
|
|
1329
|
+
declare const RESTRUCTURE_QUALIFIED_ARCH = "arm64";
|
|
1330
|
+
declare const RESTRUCTURE_QUALIFIED_FILESYSTEM = "apfs";
|
|
1331
|
+
declare const FOUNDATION_PACKAGE_NAME = "skill-family-harness-node";
|
|
1332
|
+
/** Published contracts package; the mechanism result is judged against it. */
|
|
1333
|
+
declare const CONTRACTS_PACKAGE_NAME = "skill-family-contracts";
|
|
1334
|
+
/** Published result object this adapter judges every returned document with. */
|
|
1335
|
+
declare const FILE_SET_RESULT_OBJECT = "file-set-result";
|
|
1336
|
+
type FoundationModule = typeof skill_family_harness_node;
|
|
1337
|
+
/**
|
|
1338
|
+
* Loaded through native asynchronous `import()` because the adopted package is
|
|
1339
|
+
* ESM-only. The module is never bundled into this project.
|
|
1340
|
+
*/
|
|
1341
|
+
declare function loadFoundationModule(): Promise<FoundationModule>;
|
|
1342
|
+
/**
|
|
1343
|
+
* Every mechanism result is judged against the published `file-set-result`
|
|
1344
|
+
* schema before it is read. The local declaration file only fixes the compile
|
|
1345
|
+
* boundary; this runtime check is what keeps it from becoming a second contract
|
|
1346
|
+
* or from silently widening what counts as a usable result.
|
|
1347
|
+
*/
|
|
1348
|
+
declare function verifyMechanismResult(result: unknown): Promise<RestructureResult<FoundationFileSetResult>>;
|
|
1349
|
+
/** Raw digest of a candidate's exact UTF-8 bytes; never a string substitution. */
|
|
1350
|
+
declare function candidateByteDigest(content: string | null): string;
|
|
1351
|
+
interface RestructureMechanismQualification {
|
|
1352
|
+
/** Canonical absolute real root used for both the binding and the request. */
|
|
1353
|
+
root: string;
|
|
1354
|
+
filesystem: typeof RESTRUCTURE_QUALIFIED_FILESYSTEM;
|
|
1355
|
+
}
|
|
1356
|
+
/** Canonical absolute real path of an existing real directory. */
|
|
1357
|
+
declare function resolveRealRoot(root: string): Promise<RestructureResult<string>>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Real-apply qualification. `inspect` and `plan` never call this, so an
|
|
1360
|
+
* unsupported host keeps its read-only capability.
|
|
1361
|
+
*/
|
|
1362
|
+
declare function qualifyRestructureMechanism(root: string): Promise<RestructureResult<RestructureMechanismQualification>>;
|
|
1363
|
+
interface RestructureMechanismRootOptions {
|
|
1364
|
+
/** `apply` may create the mechanism root; `recover`/`prune-recovery` only read it. */
|
|
1365
|
+
create: boolean;
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* The mechanism root is a real directory with mode 0700 that Foundation never
|
|
1369
|
+
* creates itself. An existing symlink, non-directory or differently masked
|
|
1370
|
+
* entry is refused instead of repaired.
|
|
1371
|
+
*/
|
|
1372
|
+
declare function ensureRestructureMechanismRoot(canonicalRoot: string, options: RestructureMechanismRootOptions): Promise<RestructureResult<string>>;
|
|
1373
|
+
declare function createRestructureRootBinding(canonicalRoot: string): Promise<RestructureResult<FoundationFilesystemRootBinding>>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Builds the frozen `applyFileSet` request from a plan 1.1. Fixed fields are
|
|
1376
|
+
* literal: the in-root recovery directory, adjacent staging, the APFS
|
|
1377
|
+
* filesystem, and the cooperative-writer premise.
|
|
1378
|
+
*/
|
|
1379
|
+
declare function buildFileSetApplyRequest(canonicalRoot: string, plan: RestructurePlan): Promise<RestructureResult<FoundationFileSetApplyRequest>>;
|
|
1380
|
+
/** Closed validation callback input; only `root`, `operationId` and `signal` are read. */
|
|
1381
|
+
type RestructureValidationCallback = (input: {
|
|
1382
|
+
root: string;
|
|
1383
|
+
operationId: string;
|
|
1384
|
+
signal: AbortSignal;
|
|
1385
|
+
}) => Promise<{
|
|
1386
|
+
passed: boolean;
|
|
1387
|
+
}> | {
|
|
1388
|
+
passed: boolean;
|
|
1389
|
+
};
|
|
1390
|
+
interface RestructureFileSetApplyOptions {
|
|
1391
|
+
validate: RestructureValidationCallback;
|
|
1392
|
+
}
|
|
1393
|
+
declare function applyRestructureFileSet(canonicalRoot: string, plan: RestructurePlan, options: RestructureFileSetApplyOptions): Promise<RestructureResult<FoundationFileSetResult>>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Reads the maintenance observation of the fixed in-root journal. The program
|
|
1396
|
+
* never assumes other participants have stopped: the operator's confirmations
|
|
1397
|
+
* are inputs, and this call only records what the journal currently shows.
|
|
1398
|
+
*/
|
|
1399
|
+
declare function observeRestructureJournal(canonicalRoot: string): Promise<RestructureResult<FoundationStateStoreRecoveryObservation>>;
|
|
1400
|
+
interface RestructureMaintenanceOptions {
|
|
1401
|
+
/** Stronger than the cooperative-writer premise; both are operator statements. */
|
|
1402
|
+
allParticipantsStopped: boolean;
|
|
1403
|
+
exclusiveMaintenance: boolean;
|
|
1404
|
+
}
|
|
1405
|
+
declare function recoverRestructureFileSet(canonicalRoot: string, plan: RestructurePlan, options: RestructureMaintenanceOptions): Promise<RestructureResult<FoundationFileSetResult>>;
|
|
1406
|
+
declare function pruneRestructureFileSet(canonicalRoot: string, plan: RestructurePlan, options: RestructureMaintenanceOptions): Promise<RestructureResult<FoundationFileSetResult>>;
|
|
1407
|
+
interface RestructureMechanismProjection {
|
|
1408
|
+
/** The mechanism result, reproduced field for field. */
|
|
1409
|
+
foundation: FoundationFileSetResult;
|
|
1410
|
+
/** Canonical absolute path of the persisted plan document this call consumed. */
|
|
1411
|
+
planPath: string;
|
|
1412
|
+
/** Digest of the exact plan document bytes; the document is never deleted here. */
|
|
1413
|
+
planDigest: string;
|
|
1414
|
+
operation: FoundationFileSetResult['operation'];
|
|
1415
|
+
outcome: FoundationFileSetOutcome;
|
|
1416
|
+
preflight: FoundationFileSetResult['preflight'];
|
|
1417
|
+
businessWrite: FoundationFileSetResult['businessWrite'];
|
|
1418
|
+
validation: FoundationFileSetValidation;
|
|
1419
|
+
/** Rendered exactly as the contract names it, e.g. `validation.incomplete/invalid-result`. */
|
|
1420
|
+
validationState: string;
|
|
1421
|
+
recovery: FoundationFileSetResult['recovery'];
|
|
1422
|
+
paths: FoundationFileSetPathResult[];
|
|
1423
|
+
errors: FoundationFileSetResult['errors'];
|
|
1424
|
+
materialPath: string;
|
|
1425
|
+
errorKinds: FoundationFileSetErrorKind[];
|
|
1426
|
+
/** Domain reading of the mechanism facts, added next to them. */
|
|
1427
|
+
code: string;
|
|
1428
|
+
message: string;
|
|
1429
|
+
/** Only the unconditional success described by the migration contract is `true`. */
|
|
1430
|
+
ok: boolean;
|
|
1431
|
+
/** Whether the same plan may still be sent to `apply`. */
|
|
1432
|
+
rerunApplyPermitted: boolean;
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Adds the domain reading to an untouched mechanism result. `commit-unconfirmed`,
|
|
1436
|
+
* `recovery-required` and per-path `unknown` are never flattened into success.
|
|
1437
|
+
*/
|
|
1438
|
+
declare function projectRestructureFileSetResult(result: FoundationFileSetResult, planPath?: string, planDigest?: string): RestructureMechanismProjection;
|
|
1439
|
+
|
|
1440
|
+
interface RestructureFinding {
|
|
1441
|
+
code: string;
|
|
1442
|
+
message: string;
|
|
1443
|
+
path?: string;
|
|
1444
|
+
line?: number;
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Plan document version accepted by apply, recover, and prune-recovery.
|
|
1448
|
+
* An older plan document is refused before any mechanism call.
|
|
1449
|
+
*/
|
|
1450
|
+
declare const RESTRUCTURE_PLAN_SCHEMA_VERSION = "1.1";
|
|
1451
|
+
/** Fixed write-then-verify budget that apply hands to the adopted mechanism. */
|
|
1452
|
+
declare const RESTRUCTURE_VALIDATION_TIMEOUT_MS = 30000;
|
|
1453
|
+
/** Maximum number of file operations in one plan. */
|
|
1454
|
+
declare const RESTRUCTURE_MAX_OPERATIONS = 1024;
|
|
1455
|
+
/** Maximum combined original and new bytes in one plan (256 MiB). */
|
|
1456
|
+
declare const RESTRUCTURE_MAX_TOTAL_BYTES: number;
|
|
1457
|
+
interface FileSnapshot {
|
|
1458
|
+
path: string;
|
|
1459
|
+
exists: boolean;
|
|
1460
|
+
sha256: string | null;
|
|
1461
|
+
size: number;
|
|
1462
|
+
/** POSIX permission bits of a regular file; null when the path does not exist. */
|
|
1463
|
+
mode: number | null;
|
|
1464
|
+
}
|
|
1465
|
+
interface RestructureRequestSource {
|
|
1466
|
+
type: string;
|
|
1467
|
+
id: string;
|
|
1468
|
+
path?: string;
|
|
1469
|
+
}
|
|
1470
|
+
interface RestructureRequest {
|
|
1471
|
+
schema_version: '1.0';
|
|
1472
|
+
operation: 'record-split' | 'identity-split' | 'move-renumber';
|
|
1473
|
+
sources: RestructureRequestSource[];
|
|
1474
|
+
allowed_output_paths: string[];
|
|
1475
|
+
numbering_policy?: {
|
|
1476
|
+
mode: 'explicit' | 'configured-next-available';
|
|
1477
|
+
range?: string;
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
interface SourceSpan {
|
|
1481
|
+
path: string;
|
|
1482
|
+
start_byte: number;
|
|
1483
|
+
end_byte: number;
|
|
1484
|
+
sha256: string;
|
|
1485
|
+
}
|
|
1486
|
+
interface RelationOccurrence {
|
|
1487
|
+
from: string;
|
|
1488
|
+
to: string;
|
|
1489
|
+
kind: string;
|
|
1490
|
+
source: string;
|
|
1491
|
+
source_path: string;
|
|
1492
|
+
source_line: number;
|
|
1493
|
+
occurrence: number;
|
|
1494
|
+
}
|
|
1495
|
+
interface RestructureInspectionSource {
|
|
1496
|
+
type: string;
|
|
1497
|
+
id: string;
|
|
1498
|
+
uid: string;
|
|
1499
|
+
path: string;
|
|
1500
|
+
title: string;
|
|
1501
|
+
snapshot: FileSnapshot;
|
|
1502
|
+
record_span?: SourceSpan;
|
|
1503
|
+
content?: string;
|
|
1504
|
+
surrounding_spans: Array<SourceSpan & {
|
|
1505
|
+
content: string;
|
|
1506
|
+
}>;
|
|
1507
|
+
acceptance_criteria: string[];
|
|
1508
|
+
incoming_relations: RelationOccurrence[];
|
|
1509
|
+
outgoing_relations: RelationOccurrence[];
|
|
1510
|
+
}
|
|
1511
|
+
interface RestructureInspection {
|
|
1512
|
+
schema_version: '1.0';
|
|
1513
|
+
request: RestructureRequest;
|
|
1514
|
+
request_digest: string;
|
|
1515
|
+
config_snapshot: FileSnapshot;
|
|
1516
|
+
sources: RestructureInspectionSource[];
|
|
1517
|
+
affected_files: FileSnapshot[];
|
|
1518
|
+
relation_occurrences: RelationOccurrence[];
|
|
1519
|
+
blockers: RestructureFinding[];
|
|
1520
|
+
unresolved: RestructureFinding[];
|
|
1521
|
+
mapping_template: Record<string, unknown>;
|
|
1522
|
+
}
|
|
1523
|
+
interface MappingSource {
|
|
1524
|
+
type: string;
|
|
1525
|
+
id: string;
|
|
1526
|
+
path: string;
|
|
1527
|
+
snapshot: FileSnapshot;
|
|
1528
|
+
disposition: 'preserved' | 'retired';
|
|
1529
|
+
}
|
|
1530
|
+
interface MappingTarget {
|
|
1531
|
+
key: string;
|
|
1532
|
+
type: string;
|
|
1533
|
+
id: string;
|
|
1534
|
+
path: string;
|
|
1535
|
+
snapshot: FileSnapshot;
|
|
1536
|
+
}
|
|
1537
|
+
interface ContentMove {
|
|
1538
|
+
id: string;
|
|
1539
|
+
source: SourceSpan;
|
|
1540
|
+
target: {
|
|
1541
|
+
path: string;
|
|
1542
|
+
order: number;
|
|
1543
|
+
mode: 'move' | 'copy';
|
|
1544
|
+
separator?: string;
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
interface IdentityMapEntry {
|
|
1548
|
+
source_type: string;
|
|
1549
|
+
source_id: string;
|
|
1550
|
+
target_keys: string[];
|
|
1551
|
+
source_disposition: 'preserved' | 'retired';
|
|
1552
|
+
}
|
|
1553
|
+
interface CriterionMapEntry {
|
|
1554
|
+
source_feature: string;
|
|
1555
|
+
source_criterion: string;
|
|
1556
|
+
targets: Array<{
|
|
1557
|
+
feature: string;
|
|
1558
|
+
criterion: string;
|
|
1559
|
+
}>;
|
|
1560
|
+
}
|
|
1561
|
+
interface RelationMapEntry {
|
|
1562
|
+
occurrence: RelationOccurrence;
|
|
1563
|
+
targets: Array<{
|
|
1564
|
+
from: string;
|
|
1565
|
+
to: string;
|
|
1566
|
+
kind: string;
|
|
1567
|
+
}>;
|
|
1568
|
+
basis: string;
|
|
1569
|
+
}
|
|
1570
|
+
interface ProseEdit {
|
|
1571
|
+
source: SourceSpan;
|
|
1572
|
+
target_path: string;
|
|
1573
|
+
old_text: string;
|
|
1574
|
+
new_text: string;
|
|
1575
|
+
reason: string;
|
|
1576
|
+
}
|
|
1577
|
+
interface FileHeader {
|
|
1578
|
+
path: string;
|
|
1579
|
+
content: string;
|
|
1580
|
+
affected_records: string[];
|
|
1581
|
+
}
|
|
1582
|
+
interface RestructureMapping {
|
|
1583
|
+
schema_version: '1.0';
|
|
1584
|
+
request: RestructureRequest;
|
|
1585
|
+
request_digest: string;
|
|
1586
|
+
config_snapshot: FileSnapshot;
|
|
1587
|
+
sources: MappingSource[];
|
|
1588
|
+
targets: MappingTarget[];
|
|
1589
|
+
content_moves: ContentMove[];
|
|
1590
|
+
identity_map: IdentityMapEntry[];
|
|
1591
|
+
criterion_map: CriterionMapEntry[];
|
|
1592
|
+
relation_map: RelationMapEntry[];
|
|
1593
|
+
prose_edits: ProseEdit[];
|
|
1594
|
+
file_headers: FileHeader[];
|
|
1595
|
+
unresolved: RestructureFinding[];
|
|
1596
|
+
}
|
|
1597
|
+
interface RestructureCandidate {
|
|
1598
|
+
path: string;
|
|
1599
|
+
action: 'create' | 'replace' | 'delete';
|
|
1600
|
+
content: string | null;
|
|
1601
|
+
sha256: string | null;
|
|
1602
|
+
/** replace keeps the original mode, delete is null, create uses the planning umask. */
|
|
1603
|
+
mode: number | null;
|
|
1604
|
+
original: FileSnapshot;
|
|
1605
|
+
diff: string;
|
|
1606
|
+
}
|
|
1607
|
+
interface RestructurePlan {
|
|
1608
|
+
schema_version: '1.1';
|
|
1609
|
+
/** Fresh UUID v4 for this planning run; one plan, one mechanism operation identity. */
|
|
1610
|
+
operation_id: string;
|
|
1611
|
+
/** Fixed domain validation budget forwarded by apply. */
|
|
1612
|
+
validation_timeout_ms: number;
|
|
1613
|
+
request_digest: string;
|
|
1614
|
+
mapping_digest: string;
|
|
1615
|
+
config_snapshot: FileSnapshot;
|
|
1616
|
+
input_snapshots: FileSnapshot[];
|
|
1617
|
+
candidates: RestructureCandidate[];
|
|
1618
|
+
graph_diff: {
|
|
1619
|
+
added_nodes: string[];
|
|
1620
|
+
removed_nodes: string[];
|
|
1621
|
+
added_edges: string[];
|
|
1622
|
+
removed_edges: string[];
|
|
1623
|
+
};
|
|
1624
|
+
validation: {
|
|
1625
|
+
blockers: RestructureFinding[];
|
|
1626
|
+
unresolved: RestructureFinding[];
|
|
1627
|
+
candidate_issues: ValidationIssue[];
|
|
1628
|
+
consumer_candidates: Array<{
|
|
1629
|
+
path: string;
|
|
1630
|
+
line: number;
|
|
1631
|
+
reference: string;
|
|
1632
|
+
}>;
|
|
1633
|
+
};
|
|
1634
|
+
applicable: boolean;
|
|
1635
|
+
}
|
|
1636
|
+
type RestructureResult<T> = {
|
|
1637
|
+
ok: true;
|
|
1638
|
+
data: T;
|
|
1639
|
+
} | {
|
|
1640
|
+
ok: false;
|
|
1641
|
+
error: {
|
|
1642
|
+
code: string;
|
|
1643
|
+
message: string;
|
|
1644
|
+
details?: unknown;
|
|
1645
|
+
};
|
|
1646
|
+
};
|
|
1647
|
+
declare function digestRestructureValue(value: unknown): string;
|
|
1648
|
+
declare function inspectRestructure(root: string, input: unknown): Promise<RestructureResult<RestructureInspection>>;
|
|
1649
|
+
/** Mode that a create operation freezes from the planning process umask. */
|
|
1650
|
+
declare function createModeForUmask(umask: number): number;
|
|
1651
|
+
/** Current planning process umask, limited to the POSIX permission bits. */
|
|
1652
|
+
declare function planningUmask(): number;
|
|
1653
|
+
/**
|
|
1654
|
+
* One file operation as the adopted mechanism sees it. Every field is a fact
|
|
1655
|
+
* already derived by the planner; the boundary rules below are their only
|
|
1656
|
+
* definition.
|
|
1657
|
+
*/
|
|
1658
|
+
interface RestructureOperationBoundary {
|
|
1659
|
+
path: string;
|
|
1660
|
+
action: 'create' | 'replace' | 'delete';
|
|
1661
|
+
original_exists: boolean;
|
|
1662
|
+
original_mode: number | null;
|
|
1663
|
+
original_bytes: number;
|
|
1664
|
+
new_bytes: number;
|
|
1665
|
+
mode: number | null;
|
|
1666
|
+
parent_exists: boolean;
|
|
1667
|
+
parent_device: number | null;
|
|
1668
|
+
root_device: number;
|
|
1669
|
+
}
|
|
1670
|
+
interface RestructureBoundaryLimits {
|
|
1671
|
+
max_operations: number;
|
|
1672
|
+
max_total_bytes: number;
|
|
1673
|
+
umask: number;
|
|
1674
|
+
/**
|
|
1675
|
+
* `plan` (default) checks the planning rule that a create carries exactly the
|
|
1676
|
+
* mode derived from the planning umask. `apply` checks the runtime rule
|
|
1677
|
+
* instead: the mode already frozen in the plan must stay usable by the
|
|
1678
|
+
* applying process, so it can only be required to keep the owner-read bit,
|
|
1679
|
+
* carry no setuid/setgid/sticky bits, and survive the current umask.
|
|
1680
|
+
*/
|
|
1681
|
+
mode_contract?: 'plan' | 'apply';
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* Foundation preconditions that a plan must satisfy before apply/recover/prune:
|
|
1685
|
+
* operation count, combined capacity, parent directory presence and filesystem,
|
|
1686
|
+
* and the frozen POSIX modes. Zero operations is a no-op plan and is blocked.
|
|
1687
|
+
*/
|
|
1688
|
+
declare function restructureBoundaryFindings(operations: RestructureOperationBoundary[], limits: RestructureBoundaryLimits): RestructureFinding[];
|
|
1689
|
+
declare function planRestructure(root: string, input: unknown): Promise<RestructureResult<RestructurePlan>>;
|
|
1690
|
+
type RestructurePlanOperation = 'apply' | 'recover' | 'prune-recovery';
|
|
1691
|
+
/**
|
|
1692
|
+
* Single acceptance gate for a persisted plan document. apply, recover, and
|
|
1693
|
+
* prune-recovery all consume the same plan contract, so a plan written before
|
|
1694
|
+
* 1.1 is refused here before any mechanism call.
|
|
1695
|
+
*/
|
|
1696
|
+
declare function gateRestructureOperationPlan(operation: RestructurePlanOperation, plan: unknown): Promise<RestructureResult<RestructurePlan>>;
|
|
1697
|
+
/**
|
|
1698
|
+
* A plan document that already exists on disk. Apply, recover, and
|
|
1699
|
+
* prune-recovery all read this same document, so one plan keeps one mechanism
|
|
1700
|
+
* operation identity. The document is never written, copied or deleted here.
|
|
1701
|
+
*/
|
|
1702
|
+
interface RestructurePlanDocument {
|
|
1703
|
+
/** Absolute path the operator supplied. */
|
|
1704
|
+
path: string;
|
|
1705
|
+
/** Canonical absolute real path of that document. */
|
|
1706
|
+
realPath: string;
|
|
1707
|
+
/** Digest of the exact bytes read from the document. */
|
|
1708
|
+
digest: string;
|
|
1709
|
+
root: string;
|
|
1710
|
+
plan: RestructurePlan;
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Read-only revalidation of the file set that Foundation has just written. The
|
|
1714
|
+
* callback consumes only `{ root, operationId, signal }` and returns only the
|
|
1715
|
+
* closed object `{ passed: true }` or `{ passed: false }`. It re-scans the
|
|
1716
|
+
* graph, compares the plan's frozen identity and edge differences, refuses any
|
|
1717
|
+
* graph error the reviewed candidate issues did not already contain, and
|
|
1718
|
+
* refuses consumer candidates the plan never listed. An unexpected failure is
|
|
1719
|
+
* left to propagate so Foundation keeps the original incomplete/exception
|
|
1720
|
+
* reason instead of reporting a plain validation failure.
|
|
1721
|
+
*
|
|
1722
|
+
* `excludedConsumerPaths` carries the root-relative path of the operation's own
|
|
1723
|
+
* persisted plan document. That document names the candidate paths verbatim, so
|
|
1724
|
+
* without this exclusion it would be counted as an unplanned consumer of every
|
|
1725
|
+
* reference the reviewed plan already carries, and a plan persisted anywhere
|
|
1726
|
+
* inside the project root except a scan-skipped directory would roll its own
|
|
1727
|
+
* apply back. The exclusion is exact: it removes that one path and no other.
|
|
1728
|
+
*/
|
|
1729
|
+
declare function createRestructureValidationCallback(plan: RestructurePlan, excludedConsumerPaths?: Iterable<string>): RestructureValidationCallback;
|
|
1730
|
+
interface RestructureApplyInput {
|
|
1731
|
+
root: string;
|
|
1732
|
+
/** Path of the plan document the operator already persisted. */
|
|
1733
|
+
planPath: string;
|
|
1734
|
+
/** Explicit cooperative-writer premise; this program never assumes it. */
|
|
1735
|
+
confirmCooperativeWriters: boolean;
|
|
1736
|
+
}
|
|
1737
|
+
declare function applyRestructure(input: RestructureApplyInput): Promise<RestructureResult<RestructureMechanismProjection>>;
|
|
1738
|
+
interface RestructureRecoveryInput {
|
|
1739
|
+
root: string;
|
|
1740
|
+
/** Path of the same plan document that the apply call consumed. */
|
|
1741
|
+
planPath: string;
|
|
1742
|
+
/** Operator statement that every other participant has stopped. */
|
|
1743
|
+
allParticipantsStopped: boolean;
|
|
1744
|
+
/** Operator statement that an exclusive maintenance interval is in force. */
|
|
1745
|
+
exclusiveMaintenance: boolean;
|
|
1746
|
+
}
|
|
1747
|
+
declare function recoverRestructure(input: RestructureRecoveryInput): Promise<RestructureResult<RestructureMechanismProjection>>;
|
|
1748
|
+
interface RestructurePruneInput {
|
|
1749
|
+
root: string;
|
|
1750
|
+
/** Path of the same plan document that the apply call consumed. */
|
|
1751
|
+
planPath: string;
|
|
1752
|
+
/** Explicit cooperative-writer premise for the ordinary cleanup path. */
|
|
1753
|
+
confirmCooperativeWriters: boolean;
|
|
1754
|
+
/** Required together with `exclusiveMaintenance` for a fault takeover. */
|
|
1755
|
+
allParticipantsStopped: boolean;
|
|
1756
|
+
exclusiveMaintenance: boolean;
|
|
1757
|
+
}
|
|
1758
|
+
declare function pruneRestructureRecovery(input: RestructurePruneInput): Promise<RestructureResult<RestructureMechanismProjection>>;
|
|
1759
|
+
|
|
1760
|
+
interface ByteRange {
|
|
1761
|
+
startByte: number;
|
|
1762
|
+
endByte: number;
|
|
1763
|
+
}
|
|
1764
|
+
interface RecordBoundaryResult {
|
|
1765
|
+
range?: ByteRange;
|
|
1766
|
+
blockers: Array<{
|
|
1767
|
+
code: string;
|
|
1768
|
+
message: string;
|
|
1769
|
+
path: string;
|
|
1770
|
+
line: number;
|
|
1771
|
+
}>;
|
|
1772
|
+
}
|
|
1773
|
+
declare function markdownRecordHeadings(raw: string, type: string): Array<{
|
|
1774
|
+
id: string;
|
|
1775
|
+
line: number;
|
|
1776
|
+
}>;
|
|
1777
|
+
declare function locateSoftwareRecord(raw: string, node: ArtifactNode, nodesInFile: ArtifactNode[]): RecordBoundaryResult;
|
|
1778
|
+
declare function replaceSoftwareHeader(raw: string, header: string): string;
|
|
1779
|
+
|
|
1311
1780
|
interface ArtifactNode {
|
|
1312
1781
|
uid: string;
|
|
1313
1782
|
type: string;
|
|
@@ -1549,7 +2018,15 @@ interface ContextOptions {
|
|
|
1549
2018
|
declare const DEFAULT_SCHEMA: ArtifactSchema;
|
|
1550
2019
|
declare function loadConfig(root: string): Promise<ArtifactSchema>;
|
|
1551
2020
|
declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[], root?: string): ArtifactGraph;
|
|
1552
|
-
|
|
2021
|
+
interface ScanArtifactsOptions {
|
|
2022
|
+
/**
|
|
2023
|
+
* Optional in-memory candidate contents keyed by project-relative path.
|
|
2024
|
+
* `null` removes a path from the candidate scan. Disk scanning remains the
|
|
2025
|
+
* default and is unchanged when this option is omitted.
|
|
2026
|
+
*/
|
|
2027
|
+
contents?: ReadonlyMap<string, string | null> | Readonly<Record<string, string | null>>;
|
|
2028
|
+
}
|
|
2029
|
+
declare function scanArtifacts(root: string, schema?: ArtifactSchema, options?: ScanArtifactsOptions): Promise<ArtifactGraph>;
|
|
1553
2030
|
/**
|
|
1554
2031
|
* Resolve traceability-matrix-v2 edges:
|
|
1555
2032
|
* 1. Edges pointing to matrix-row targets (traceability-matrix-v2:*) are kept as-is.
|
|
@@ -1678,4 +2155,4 @@ declare function discoverTargets(graph: ArtifactGraph, options?: DiscoverOptions
|
|
|
1678
2155
|
declare function resolveArtifactContext(graph: ArtifactGraph, opts: ContextOptions): ContextManifest;
|
|
1679
2156
|
declare function formatContextMarkdown(manifest: ContextManifest): string;
|
|
1680
2157
|
|
|
1681
|
-
export { ALWAYS_PRESENT_ITEMS as ALWAYS_PRESENT, type ArtifactChainDoctorReport, type ArtifactEdge, type ArtifactEdgeRule, type ArtifactExtraFieldSchema, type ArtifactGraph, type ArtifactGraphCliCandidate, type ArtifactGraphCliResolution, type ArtifactGraphCliSource, type ArtifactNode, type ArtifactSchema, type ArtifactTarget, type ArtifactTypeMetadata, type ArtifactTypeRole, type ArtifactTypeSchema, BASELINE_CONSTRAINTS, BASELINE_CONSTRAINTS_COUNT, BASELINE_ITEMS_COUNT, type BatchDefinition, CONTRACT_ERROR_CODES, type CanonicalIR, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, ContractCatalog, type ContractCatalogEntry, type ContractDefinition, ContractError, type ContractErrorCode, type ContractIdentity, ContractRegistry, type ContractRegistryEntry, type ContractSchema, type CoverageBoundaryReport, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DeclaredVerificationReference, type DiscoverOptions, E2E_NORMALIZER_CONFIG, type E2eCoverageStats, type E2eCoverageThresholds, type E2eRegistry, type E2eRegistryBatch, type E2eRunnerConfig, type E2eWaiver, type Evidence, type EvidenceObject, type ExecutorType, type ExternalEntryInfo, type Finding, type FindingLocation, type FindingSeverity, type FindingStatus, type GitChangeMode, type GitChangeResult, type GitHookName, type HookInstallResult, type ImpactEdgeRef, type ImpactMode, type ImpactNodeRef, type ImpactOptions, type ImpactReport, type ImplementationBlueprintDraft, type ImplementationPacket, type LegacyFieldMapping, type LoadContractOptions, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type NodeTimeView, type NormalizationResult, type NormalizerConfig, type PacketAuditEntry, type PacketAuditSummary, type PacketCategory, type PacketItem, type PacketOmittedItem, type PacketOptions, type PacketPromptError, type PacketPromptOptions, type PacketTarget, type PacketTargetType, type PacketValidationIssue, type PacketValidationResult, type PartialSupersedeAnnotation, type PolicyCompatibilityResult, type PreparedManagedHookBlock, type Producer, type ProjectPolicy, type PromptValidationIssue, type PromptValidationResult, type QueryOptions, type RelationSemanticsSpec, type RepairData, type RepairValidation, type ResolveArtifactGraphCliOptions, type ReviewData, type ReviewDecision, type ReviewMetrics, type ReviewOrderStep, type ReviewResult, type ReviewStatus, type RiskChecklistItem, type SchemaValidationResult, TARGET_ARTIFACT_TYPES, type TargetArtifactType, type TimeBucket, type TimeView, type TraceVersionResult, VALID_PACKET_TARGET_TYPES, VERSION_INDEX_SCHEMA_VERSION, VERSION_LOCK_PATH, VERSION_LOCK_SCHEMA_VERSION, type ValidationError, type ValidationIssue, type VersionEdgeKind, type VersionIndex, type VersionLockAuditMarkdownOptions, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockIssueSeverity, type VersionLockRef, type VersionLockRefreshOptions, type VersionLockRefreshResult, type VersionLockSourceRef, type VersionLockStatus, type VersionLockUpdateOptions, type VersionSourceKind, type VersionedEdge, type VersionedNode, type ViewExcludedNode, type ViewSelection, applyPreparedManagedHookBlocks, assemblePacket, auditPackets, auditVersionLock, bootstrapVersionLock, buildGraph, buildVersionIndex, collectChangedPaths, computeCoverageBoundary, computeE2eCoverageStats, computeImpact, computeRevisionDigest, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, filterGraphByView, formatContextMarkdown, generateE2eRegistry, getArtifactTypeMetadata, getExternalEntryInfo, getTargetArtifactTypes, installManagedHookBlock, isOfficialNamespace, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, isVersionLockIssueBlocking, loadConfig, loadContract, loadContractCatalog, loadContractsFromDirectory, matchesConfiguredArtifactPath, nextId, normalizeE2eLegacyArtifact, normalizeToCanonical, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderCoverageBoundaryMarkdown, renderDoctorMarkdown, renderImpactMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, resolveNodeTimeView, scanArtifacts, traceVersion, updateVersionLock, validateContractAgainstSchema, validateExecutableTraceability, validateGraph, validateNamespaceAuthority, validatePacket, validatePacketMarkdown, validatePacketPrompt, validatePolicyCompatibility, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, verifyDigest, versionLockIssueSeverity, writeGraphCache };
|
|
2158
|
+
export { ALWAYS_PRESENT_ITEMS as ALWAYS_PRESENT, type ArtifactChainDoctorReport, type ArtifactEdge, type ArtifactEdgeRule, type ArtifactExtraFieldSchema, type ArtifactGraph, type ArtifactGraphCliCandidate, type ArtifactGraphCliResolution, type ArtifactGraphCliSource, type ArtifactNode, type ArtifactSchema, type ArtifactTarget, type ArtifactTypeMetadata, type ArtifactTypeRole, type ArtifactTypeSchema, BASELINE_CONSTRAINTS, BASELINE_CONSTRAINTS_COUNT, BASELINE_ITEMS_COUNT, type BatchDefinition, type ByteRange, CONTRACTS_PACKAGE_NAME, CONTRACT_ERROR_CODES, type CanonicalIR, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, ContractCatalog, type ContractCatalogEntry, type ContractDefinition, ContractError, type ContractErrorCode, type ContractIdentity, ContractRegistry, type ContractRegistryEntry, type ContractSchema, type CoverageBoundaryReport, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DeclaredVerificationReference, type DiscoverOptions, E2E_NORMALIZER_CONFIG, type E2eCoverageStats, type E2eCoverageThresholds, type E2eRegistry, type E2eRegistryBatch, type E2eRunnerConfig, type E2eWaiver, type Evidence, type EvidenceObject, type ExecutorType, type ExternalEntryInfo, FILE_SET_RESULT_OBJECT, FOUNDATION_PACKAGE_NAME, type FileSnapshot, type Finding, type FindingLocation, type FindingSeverity, type FindingStatus, type FoundationModule, type GitChangeMode, type GitChangeResult, type GitHookName, type HookInstallResult, type ImpactEdgeRef, type ImpactMode, type ImpactNodeRef, type ImpactOptions, type ImpactReport, type ImplementationBlueprintDraft, type ImplementationPacket, type LegacyFieldMapping, type LoadContractOptions, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type NodeTimeView, type NormalizationResult, type NormalizerConfig, type PacketAuditEntry, type PacketAuditSummary, type PacketCategory, type PacketItem, type PacketOmittedItem, type PacketOptions, type PacketPromptError, type PacketPromptOptions, type PacketTarget, type PacketTargetType, type PacketValidationIssue, type PacketValidationResult, type PartialSupersedeAnnotation, type PolicyCompatibilityResult, type PreparedManagedHookBlock, type Producer, type ProjectPolicy, type PromptValidationIssue, type PromptValidationResult, type QueryOptions, RESTRUCTURE_MAX_OPERATIONS, RESTRUCTURE_MAX_TOTAL_BYTES, RESTRUCTURE_PLAN_SCHEMA_VERSION, RESTRUCTURE_QUALIFIED_ARCH, RESTRUCTURE_QUALIFIED_FILESYSTEM, RESTRUCTURE_QUALIFIED_PLATFORM, RESTRUCTURE_RECOVERY_JOURNAL_REL_PATH, RESTRUCTURE_RECOVERY_REL_PATH, RESTRUCTURE_RECOVERY_ROOT_MODE, RESTRUCTURE_VALIDATION_TIMEOUT_MS, type RecordBoundaryResult, type RelationSemanticsSpec, type RepairData, type RepairValidation, type ResolveArtifactGraphCliOptions, type RestructureApplyInput, type RestructureBoundaryLimits, type RestructureCandidate, type RestructureFileSetApplyOptions, type RestructureFinding, type RestructureInspection, type RestructureMaintenanceOptions, type RestructureMapping, type RestructureMechanismProjection, type RestructureMechanismQualification, type RestructureMechanismRootOptions, type RestructureOperationBoundary, type RestructurePlan, type RestructurePlanDocument, type RestructurePlanOperation, type RestructurePruneInput, type RestructureRecoveryInput, type RestructureRequest, type RestructureResult, type RestructureValidationCallback, type ReviewData, type ReviewDecision, type ReviewMetrics, type ReviewOrderStep, type ReviewResult, type ReviewStatus, type RiskChecklistItem, type ScanArtifactsOptions, type SchemaValidationResult, TARGET_ARTIFACT_TYPES, type TargetArtifactType, type TimeBucket, type TimeView, type TraceVersionResult, VALID_PACKET_TARGET_TYPES, VERSION_INDEX_SCHEMA_VERSION, VERSION_LOCK_PATH, VERSION_LOCK_SCHEMA_VERSION, type ValidationError, type ValidationIssue, type VersionEdgeKind, type VersionIndex, type VersionLockAuditMarkdownOptions, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockIssueSeverity, type VersionLockRef, type VersionLockRefreshOptions, type VersionLockRefreshResult, type VersionLockSourceRef, type VersionLockStatus, type VersionLockUpdateOptions, type VersionSourceKind, type VersionedEdge, type VersionedNode, type ViewExcludedNode, type ViewSelection, applyPreparedManagedHookBlocks, applyRestructure, applyRestructureFileSet, assemblePacket, auditPackets, auditVersionLock, bootstrapVersionLock, buildFileSetApplyRequest, buildGraph, buildVersionIndex, candidateByteDigest, collectChangedPaths, computeCoverageBoundary, computeE2eCoverageStats, computeImpact, computeRevisionDigest, createModeForUmask, createRestructureRootBinding, createRestructureValidationCallback, digestRestructureValue, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, ensureRestructureMechanismRoot, filterGraphByView, formatContextMarkdown, gateRestructureOperationPlan, generateE2eRegistry, getArtifactTypeMetadata, getExternalEntryInfo, getTargetArtifactTypes, inspectRestructure, installManagedHookBlock, isOfficialNamespace, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, isVersionLockIssueBlocking, loadConfig, loadContract, loadContractCatalog, loadContractsFromDirectory, loadFoundationModule, locateSoftwareRecord, markdownRecordHeadings, matchesConfiguredArtifactPath, nextId, normalizeE2eLegacyArtifact, normalizeToCanonical, observeRestructureJournal, parseTargetSelector, parseTargetsFile, planRestructure, planningUmask, prepareManagedHookBlock, projectRestructureFileSetResult, pruneRestructureFileSet, pruneRestructureRecovery, qualifyRestructureMechanism, queryGraph, recoverRestructure, recoverRestructureFileSet, refreshVersionLock, renderCoverageBoundaryMarkdown, renderDoctorMarkdown, renderImpactMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, replaceSoftwareHeader, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, resolveNodeTimeView, resolveRealRoot, restructureBoundaryFindings, scanArtifacts, traceVersion, updateVersionLock, validateContractAgainstSchema, validateExecutableTraceability, validateGraph, validateNamespaceAuthority, validatePacket, validatePacketMarkdown, validatePacketPrompt, validatePolicyCompatibility, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, verifyDigest, verifyMechanismResult, versionLockIssueSeverity, writeGraphCache };
|