@agent-teams/engineering-foundation 0.13.1 → 0.15.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/dist/canonical-json.d.ts +12 -0
- package/dist/canonical-json.d.ts.map +1 -0
- package/dist/canonical-json.js +151 -0
- package/dist/canonical-json.js.map +1 -0
- package/dist/document-authoring/adapters/canonical-markdown.d.ts +14 -0
- package/dist/document-authoring/adapters/canonical-markdown.d.ts.map +1 -0
- package/dist/document-authoring/adapters/canonical-markdown.js +354 -0
- package/dist/document-authoring/adapters/canonical-markdown.js.map +1 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.d.ts +31 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.js +47 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js +14 -36
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-contract-validator.d.ts +7 -0
- package/dist/document-authoring/adapters/node/node-document-contract-validator.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-contract-validator.js +179 -0
- package/dist/document-authoring/adapters/node/node-document-contract-validator.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.d.ts +10 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.js +72 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.d.ts +10 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.js +164 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-template-reader.d.ts +10 -0
- package/dist/document-authoring/adapters/node/node-document-template-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-template-reader.js +32 -0
- package/dist/document-authoring/adapters/node/node-document-template-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/read-document-authority-file.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/read-document-authority-file.js +3 -13
- package/dist/document-authoring/adapters/node/read-document-authority-file.js.map +1 -1
- package/dist/document-authoring/application/model/document-planning.d.ts +171 -0
- package/dist/document-authoring/application/model/document-planning.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-planning.js +2 -0
- package/dist/document-authoring/application/model/document-planning.js.map +1 -0
- package/dist/document-authoring/application/policies/authoring-profile-semantics.d.ts +38 -0
- package/dist/document-authoring/application/policies/authoring-profile-semantics.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/authoring-profile-semantics.js +122 -0
- package/dist/document-authoring/application/policies/authoring-profile-semantics.js.map +1 -0
- package/dist/document-authoring/application/policies/document-contract-digests.d.ts +20 -0
- package/dist/document-authoring/application/policies/document-contract-digests.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-contract-digests.js +275 -0
- package/dist/document-authoring/application/policies/document-contract-digests.js.map +1 -0
- package/dist/document-authoring/application/policies/document-logical-preimage.d.ts +14 -0
- package/dist/document-authoring/application/policies/document-logical-preimage.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-logical-preimage.js +61 -0
- package/dist/document-authoring/application/policies/document-logical-preimage.js.map +1 -0
- package/dist/document-authoring/application/policies/document-planning-policy-error.d.ts +6 -0
- package/dist/document-authoring/application/policies/document-planning-policy-error.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-planning-policy-error.js +9 -0
- package/dist/document-authoring/application/policies/document-planning-policy-error.js.map +1 -0
- package/dist/document-authoring/application/policies/document-repository-path.d.ts +1 -0
- package/dist/document-authoring/application/policies/document-repository-path.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/document-repository-path.js +21 -2
- package/dist/document-authoring/application/policies/document-repository-path.js.map +1 -1
- package/dist/document-authoring/application/policies/document-temporary-path.d.ts +7 -0
- package/dist/document-authoring/application/policies/document-temporary-path.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-temporary-path.js +34 -0
- package/dist/document-authoring/application/policies/document-temporary-path.js.map +1 -0
- package/dist/document-authoring/application/policies/normalize-document-intent.d.ts +3 -0
- package/dist/document-authoring/application/policies/normalize-document-intent.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/normalize-document-intent.js +104 -0
- package/dist/document-authoring/application/policies/normalize-document-intent.js.map +1 -0
- package/dist/document-authoring/application/policies/resolve-document-authoring.d.ts +13 -0
- package/dist/document-authoring/application/policies/resolve-document-authoring.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/resolve-document-authoring.js +154 -0
- package/dist/document-authoring/application/policies/resolve-document-authoring.js.map +1 -0
- package/dist/document-authoring/application/ports/canonical-document-renderer.d.ts +29 -0
- package/dist/document-authoring/application/ports/canonical-document-renderer.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/canonical-document-renderer.js +2 -0
- package/dist/document-authoring/application/ports/canonical-document-renderer.js.map +1 -0
- package/dist/document-authoring/application/ports/document-contract-validator.d.ts +6 -0
- package/dist/document-authoring/application/ports/document-contract-validator.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-contract-validator.js +2 -0
- package/dist/document-authoring/application/ports/document-contract-validator.js.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-profile-reader.d.ts +9 -0
- package/dist/document-authoring/application/ports/document-planning-profile-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-profile-reader.js +2 -0
- package/dist/document-authoring/application/ports/document-planning-profile-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.d.ts +9 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.js +2 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/document-template-reader.d.ts +9 -0
- package/dist/document-authoring/application/ports/document-template-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-template-reader.js +2 -0
- package/dist/document-authoring/application/ports/document-template-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.d.ts +11 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.js +2 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.js.map +1 -0
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts +2 -1
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.js.map +1 -1
- package/dist/document-authoring/application/use-cases/compile-document-plan.d.ts +6 -0
- package/dist/document-authoring/application/use-cases/compile-document-plan.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/compile-document-plan.js +156 -0
- package/dist/document-authoring/application/use-cases/compile-document-plan.js.map +1 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.d.ts +66 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.js +276 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.js.map +1 -0
- package/dist/document-authoring/document-planning-error.d.ts +6 -0
- package/dist/document-authoring/document-planning-error.d.ts.map +1 -0
- package/dist/document-authoring/document-planning-error.js +9 -0
- package/dist/document-authoring/document-planning-error.js.map +1 -0
- package/dist/document-authoring/index.d.ts +10 -0
- package/dist/document-authoring/index.d.ts.map +1 -1
- package/dist/document-authoring/index.js +72 -0
- package/dist/document-authoring/index.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.d.ts +4 -0
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.js +30 -0
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/legacy-document-envelope-v2.d.ts +5 -0
- package/dist/transaction-coordination/adapters/node/legacy-document-envelope-v2.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/legacy-document-envelope-v2.js +212 -0
- package/dist/transaction-coordination/adapters/node/legacy-document-envelope-v2.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js +47 -25
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js.map +1 -1
- package/package.json +1 -1
- package/schemas/document-authoring-profile/v1.schema.json +64 -15
- package/schemas/document-command-envelope/v1.schema.json +1 -1
- package/schemas/document-intent/v1.schema.json +48 -6
- package/schemas/document-plan/v1.schema.json +20 -4
- package/schemas/document-receipt/v1.schema.json +1 -1
- package/schemas/foundation-transaction-envelope/v2.schema.json +21 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { DocumentIdentityProjectionEntry, DocumentationCatalogSnapshot } from "../model/document-catalog.js";
|
|
2
|
+
import type { DocumentArtifactType, DocumentIntent, DocumentPlan, DocumentPlanningProfileSnapshot } from "../model/document-planning.js";
|
|
3
|
+
import type { CanonicalDocumentRenderer } from "../ports/canonical-document-renderer.js";
|
|
4
|
+
import type { DocumentContractValidator } from "../ports/document-contract-validator.js";
|
|
5
|
+
import type { DocumentPlanningProfileReader } from "../ports/document-planning-profile-reader.js";
|
|
6
|
+
import type { DocumentPlanningStateReader } from "../ports/document-planning-state-reader.js";
|
|
7
|
+
import type { DocumentTemplateReader } from "../ports/document-template-reader.js";
|
|
8
|
+
import type { DocumentationCatalogReader } from "../ports/documentation-catalog-reader.js";
|
|
9
|
+
import type { MetadataInstanceValidator } from "../ports/metadata-instance-validator.js";
|
|
10
|
+
import type { OwnerMembershipReader } from "../ports/owner-membership-reader.js";
|
|
11
|
+
interface ResolvedDocumentAuthoring {
|
|
12
|
+
readonly artifact: DocumentArtifactType;
|
|
13
|
+
readonly slug?: string;
|
|
14
|
+
readonly destination: string;
|
|
15
|
+
readonly heading: string;
|
|
16
|
+
}
|
|
17
|
+
interface DocumentLogicalPreimage {
|
|
18
|
+
readonly identityProjection: readonly DocumentIdentityProjectionEntry[];
|
|
19
|
+
readonly isExactSelf: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Closed pure policy surface consumed by the read-only orchestration use case.
|
|
23
|
+
* Implementations live in the policy layer; consumer code cannot supply it from
|
|
24
|
+
* the public composition root.
|
|
25
|
+
*/
|
|
26
|
+
interface DocumentPlanningPolicies {
|
|
27
|
+
normalizeDocumentIntent(input: DocumentIntent): DocumentIntent;
|
|
28
|
+
selectDocumentArtifact(profile: DocumentPlanningProfileSnapshot, type: string): DocumentArtifactType;
|
|
29
|
+
resolveDocumentAuthoring(input: {
|
|
30
|
+
readonly artifact: DocumentArtifactType;
|
|
31
|
+
readonly intent: DocumentIntent;
|
|
32
|
+
}): ResolvedDocumentAuthoring;
|
|
33
|
+
isDestinationCoveredByCatalog(destination: string, collections: DocumentPlanningProfileSnapshot["collections"], excludedPrefixes: readonly string[]): boolean;
|
|
34
|
+
classifyDocumentLogicalPreimage(input: {
|
|
35
|
+
readonly catalog: DocumentationCatalogSnapshot;
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly destination: string;
|
|
38
|
+
readonly observedBytes?: Uint8Array;
|
|
39
|
+
readonly expectedBytes: Uint8Array;
|
|
40
|
+
}): DocumentLogicalPreimage;
|
|
41
|
+
}
|
|
42
|
+
export interface PlanDocumentationDocumentRequest {
|
|
43
|
+
readonly consumerRoot: string;
|
|
44
|
+
readonly profilePath: string;
|
|
45
|
+
readonly intent: unknown;
|
|
46
|
+
readonly signal?: AbortSignal;
|
|
47
|
+
}
|
|
48
|
+
interface Dependencies {
|
|
49
|
+
readonly catalog: DocumentationCatalogReader;
|
|
50
|
+
readonly compiler: DocumentPlan["compiler"];
|
|
51
|
+
readonly contracts: DocumentContractValidator;
|
|
52
|
+
readonly metadata: MetadataInstanceValidator;
|
|
53
|
+
readonly owners: OwnerMembershipReader;
|
|
54
|
+
readonly policies: DocumentPlanningPolicies;
|
|
55
|
+
readonly profile: DocumentPlanningProfileReader;
|
|
56
|
+
readonly renderer: CanonicalDocumentRenderer;
|
|
57
|
+
readonly state: DocumentPlanningStateReader;
|
|
58
|
+
readonly templates: DocumentTemplateReader;
|
|
59
|
+
}
|
|
60
|
+
export declare class PlanDocumentationDocument {
|
|
61
|
+
#private;
|
|
62
|
+
constructor(dependencies: Dependencies);
|
|
63
|
+
execute(request: PlanDocumentationDocumentRequest): Promise<DocumentPlan>;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=plan-documentation-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-documentation-document.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/application/use-cases/plan-documentation-document.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,+BAA+B,EAC/B,4BAA4B,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,+BAA+B,EAEhC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAC9F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,C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AAa,EAAE,UAAU,CAAC;KACpC,GAAG,uBAAuB,CAAC;CAC7B;AAED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,UAAU,YAAY;IACpB,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,6BAA6B,CAAC;IAChD,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;CAC5C;AA0RD,qBAAa,yBAAyB;;IAGpC,YAAY,YAAY,EAAE,YAAY,EAErC;IAEK,OAAO,CACX,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,YAAY,CAAC,CA4IvB;CACF"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { assertNotCancelled } from "../../../cancellation.js";
|
|
2
|
+
import { assertDocumentPlanDigests } from "../policies/document-contract-digests.js";
|
|
3
|
+
import { DocumentPlanningError } from "../../document-planning-error.js";
|
|
4
|
+
import { compileDocumentPlan } from "./compile-document-plan.js";
|
|
5
|
+
function signalOption(signal) {
|
|
6
|
+
return signal === undefined ? {} : { signal };
|
|
7
|
+
}
|
|
8
|
+
function sameEvidence(left, right) {
|
|
9
|
+
return (left.path === right.path &&
|
|
10
|
+
left.digest === right.digest &&
|
|
11
|
+
left.size === right.size);
|
|
12
|
+
}
|
|
13
|
+
function assertStableEvidence(name, before, after) {
|
|
14
|
+
if (!sameEvidence(before, after)) {
|
|
15
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_AUTHORITY_CHANGED", `${name} changed while the document Plan was compiled.`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function outputBytes(output) {
|
|
19
|
+
return new TextEncoder().encode(output);
|
|
20
|
+
}
|
|
21
|
+
function sameBytes(left, right) {
|
|
22
|
+
return left.length === right.length &&
|
|
23
|
+
left.every((value, index) => value === right[index]);
|
|
24
|
+
}
|
|
25
|
+
function samePlanningState(left, right) {
|
|
26
|
+
if (left.expectedParent.path !== right.expectedParent.path ||
|
|
27
|
+
left.destination.state !== right.destination.state) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (left.destination.state === "absent" || right.destination.state === "absent") {
|
|
31
|
+
return left.destination.state === right.destination.state;
|
|
32
|
+
}
|
|
33
|
+
if (left.destination.state === "conflict" || right.destination.state === "conflict") {
|
|
34
|
+
return left.destination.state === "conflict" &&
|
|
35
|
+
right.destination.state === "conflict" &&
|
|
36
|
+
left.destination.kind === right.destination.kind;
|
|
37
|
+
}
|
|
38
|
+
return sameBytes(left.destination.bytes, right.destination.bytes);
|
|
39
|
+
}
|
|
40
|
+
function assertStablePlanningState(before, after) {
|
|
41
|
+
if (!samePlanningState(before, after)) {
|
|
42
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_AUTHORITY_CHANGED", "Document destination or parent changed while the Plan was compiled.");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function assertStableCatalog(before, after) {
|
|
46
|
+
if (!sameCatalogSnapshot(before, after)) {
|
|
47
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_AUTHORITY_CHANGED", "Document catalog changed while the Plan was compiled.");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function sameEvidenceList(left, right) {
|
|
51
|
+
return left.length === right.length &&
|
|
52
|
+
left.every((entry, index) => sameEvidence(entry, right[index]));
|
|
53
|
+
}
|
|
54
|
+
function sameCatalogSnapshot(left, right) {
|
|
55
|
+
const leftAuthority = [
|
|
56
|
+
left.authority.profile,
|
|
57
|
+
left.authority.metadataSchema,
|
|
58
|
+
left.authority.ownerCatalog
|
|
59
|
+
];
|
|
60
|
+
const rightAuthority = [
|
|
61
|
+
right.authority.profile,
|
|
62
|
+
right.authority.metadataSchema,
|
|
63
|
+
right.authority.ownerCatalog
|
|
64
|
+
];
|
|
65
|
+
return left.status === right.status &&
|
|
66
|
+
left.projectId === right.projectId &&
|
|
67
|
+
sameEvidenceList(leftAuthority, rightAuthority) &&
|
|
68
|
+
JSON.stringify(left.diagnostics) === JSON.stringify(right.diagnostics) &&
|
|
69
|
+
JSON.stringify(left.documents) === JSON.stringify(right.documents) &&
|
|
70
|
+
JSON.stringify(left.identityProjection) === JSON.stringify(right.identityProjection) &&
|
|
71
|
+
JSON.stringify(left.ownerIds) === JSON.stringify(right.ownerIds);
|
|
72
|
+
}
|
|
73
|
+
async function loadPlanningAuthority(dependencies, request, profile, templatePath) {
|
|
74
|
+
const options = signalOption(request.signal);
|
|
75
|
+
const [catalog, metadata, owners, template] = await Promise.all([
|
|
76
|
+
dependencies.catalog.execute({
|
|
77
|
+
consumerRoot: request.consumerRoot,
|
|
78
|
+
profilePath: request.profilePath,
|
|
79
|
+
...options
|
|
80
|
+
}),
|
|
81
|
+
dependencies.metadata.load({
|
|
82
|
+
consumerRoot: request.consumerRoot,
|
|
83
|
+
path: profile.metadataSchemaPath,
|
|
84
|
+
...options
|
|
85
|
+
}),
|
|
86
|
+
dependencies.owners.read({
|
|
87
|
+
consumerRoot: request.consumerRoot,
|
|
88
|
+
contract: profile.ownerCatalog.contract,
|
|
89
|
+
path: profile.ownerCatalog.path,
|
|
90
|
+
...options
|
|
91
|
+
}),
|
|
92
|
+
dependencies.templates.read({
|
|
93
|
+
consumerRoot: request.consumerRoot,
|
|
94
|
+
path: templatePath,
|
|
95
|
+
...options
|
|
96
|
+
})
|
|
97
|
+
]);
|
|
98
|
+
return { catalog, metadata, owners, template };
|
|
99
|
+
}
|
|
100
|
+
function assertCatalogAuthority(profile, intent, authority) {
|
|
101
|
+
if (authority.catalog.status !== "complete") {
|
|
102
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_CATALOG_PARTIAL", "Document planning requires a complete rebuilt catalog.");
|
|
103
|
+
}
|
|
104
|
+
assertStableEvidence("Document profile", profile.evidence, authority.catalog.authority.profile);
|
|
105
|
+
assertStableEvidence("Document metadata schema", authority.metadata.evidence, authority.catalog.authority.metadataSchema);
|
|
106
|
+
assertStableEvidence("Document owner catalog", authority.owners.evidence, authority.catalog.authority.ownerCatalog);
|
|
107
|
+
if (!authority.owners.ids.includes(intent.owner)) {
|
|
108
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_INPUT_INVALID", `Document owner ${intent.owner} is not present in the owner catalog.`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function recaptureAuthority(input) {
|
|
112
|
+
const { authority, dependencies, destination, profile, request, state, templatePath } = input;
|
|
113
|
+
const options = signalOption(request.signal);
|
|
114
|
+
const [profileAfter, metadataAfter, ownersAfter, templateAfter] = await Promise.all([
|
|
115
|
+
dependencies.profile.read({
|
|
116
|
+
consumerRoot: request.consumerRoot,
|
|
117
|
+
path: request.profilePath,
|
|
118
|
+
...options
|
|
119
|
+
}),
|
|
120
|
+
dependencies.metadata.load({
|
|
121
|
+
consumerRoot: request.consumerRoot,
|
|
122
|
+
path: profile.metadataSchemaPath,
|
|
123
|
+
...options
|
|
124
|
+
}),
|
|
125
|
+
dependencies.owners.read({
|
|
126
|
+
consumerRoot: request.consumerRoot,
|
|
127
|
+
contract: profile.ownerCatalog.contract,
|
|
128
|
+
path: profile.ownerCatalog.path,
|
|
129
|
+
...options
|
|
130
|
+
}),
|
|
131
|
+
dependencies.templates.read({
|
|
132
|
+
consumerRoot: request.consumerRoot,
|
|
133
|
+
path: templatePath,
|
|
134
|
+
...options
|
|
135
|
+
})
|
|
136
|
+
]);
|
|
137
|
+
assertStableEvidence("Document profile", profile.evidence, profileAfter.evidence);
|
|
138
|
+
assertStableEvidence("Document metadata schema", authority.metadata.evidence, metadataAfter.evidence);
|
|
139
|
+
assertStableEvidence("Document owner catalog", authority.owners.evidence, ownersAfter.evidence);
|
|
140
|
+
assertStableEvidence("Document template", authority.template.evidence, templateAfter.evidence);
|
|
141
|
+
const stateBeforeCatalog = await dependencies.state.observe({
|
|
142
|
+
consumerRoot: request.consumerRoot,
|
|
143
|
+
destination,
|
|
144
|
+
...options
|
|
145
|
+
});
|
|
146
|
+
assertStablePlanningState(state, stateBeforeCatalog);
|
|
147
|
+
const catalogAfter = await dependencies.catalog.execute({
|
|
148
|
+
consumerRoot: request.consumerRoot,
|
|
149
|
+
profilePath: request.profilePath,
|
|
150
|
+
...options
|
|
151
|
+
});
|
|
152
|
+
assertStableCatalog(authority.catalog, catalogAfter);
|
|
153
|
+
const [stateAfterCatalog, templateAfterCatalog] = await Promise.all([
|
|
154
|
+
dependencies.state.observe({
|
|
155
|
+
consumerRoot: request.consumerRoot,
|
|
156
|
+
destination,
|
|
157
|
+
...options
|
|
158
|
+
}),
|
|
159
|
+
dependencies.templates.read({
|
|
160
|
+
consumerRoot: request.consumerRoot,
|
|
161
|
+
path: templatePath,
|
|
162
|
+
...options
|
|
163
|
+
})
|
|
164
|
+
]);
|
|
165
|
+
assertStablePlanningState(state, stateAfterCatalog);
|
|
166
|
+
assertStableEvidence("Document template", authority.template.evidence, templateAfterCatalog.evidence);
|
|
167
|
+
}
|
|
168
|
+
export class PlanDocumentationDocument {
|
|
169
|
+
#dependencies;
|
|
170
|
+
constructor(dependencies) {
|
|
171
|
+
this.#dependencies = dependencies;
|
|
172
|
+
}
|
|
173
|
+
async execute(request) {
|
|
174
|
+
assertNotCancelled(request.signal);
|
|
175
|
+
const options = signalOption(request.signal);
|
|
176
|
+
const validatedIntent = await this.#dependencies.contracts.validateIntent(request.intent);
|
|
177
|
+
assertNotCancelled(request.signal);
|
|
178
|
+
const intent = this.#dependencies.policies.normalizeDocumentIntent(validatedIntent);
|
|
179
|
+
const profile = await this.#dependencies.profile.read({
|
|
180
|
+
consumerRoot: request.consumerRoot,
|
|
181
|
+
path: request.profilePath,
|
|
182
|
+
...options
|
|
183
|
+
});
|
|
184
|
+
const artifact = this.#dependencies.policies.selectDocumentArtifact(profile, intent.type);
|
|
185
|
+
const resolved = this.#dependencies.policies.resolveDocumentAuthoring({
|
|
186
|
+
artifact,
|
|
187
|
+
intent
|
|
188
|
+
});
|
|
189
|
+
if (!this.#dependencies.policies.isDestinationCoveredByCatalog(resolved.destination, profile.collections, profile.excludedPrefixes)) {
|
|
190
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_INPUT_INVALID", "Planned destination is outside the complete documentation catalog.");
|
|
191
|
+
}
|
|
192
|
+
const authority = await loadPlanningAuthority(this.#dependencies, request, profile, resolved.artifact.template.path);
|
|
193
|
+
assertCatalogAuthority(profile, intent, authority);
|
|
194
|
+
if (authority.template.evidence.path !== resolved.artifact.template.path) {
|
|
195
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_AUTHORITY_CHANGED", "Document template evidence does not match the selected artifact authority.");
|
|
196
|
+
}
|
|
197
|
+
const skeleton = this.#dependencies.renderer.parseTemplate(authority.template.source);
|
|
198
|
+
const frontmatter = Object.freeze({
|
|
199
|
+
id: intent.id,
|
|
200
|
+
type: intent.type,
|
|
201
|
+
status: resolved.artifact.initialStatus,
|
|
202
|
+
owner: intent.owner,
|
|
203
|
+
summary: intent.summary,
|
|
204
|
+
...(intent.related === undefined ? {} : { related: intent.related }),
|
|
205
|
+
...(intent.additionalMetadata === undefined
|
|
206
|
+
? {}
|
|
207
|
+
: { additionalMetadata: intent.additionalMetadata })
|
|
208
|
+
});
|
|
209
|
+
const validation = authority.metadata.validate({
|
|
210
|
+
id: frontmatter.id,
|
|
211
|
+
type: frontmatter.type,
|
|
212
|
+
status: frontmatter.status,
|
|
213
|
+
owner: frontmatter.owner,
|
|
214
|
+
summary: frontmatter.summary,
|
|
215
|
+
...(frontmatter.related === undefined ? {} : { related: frontmatter.related }),
|
|
216
|
+
...(frontmatter.additionalMetadata === undefined
|
|
217
|
+
? {}
|
|
218
|
+
: frontmatter.additionalMetadata)
|
|
219
|
+
});
|
|
220
|
+
if (!validation.valid) {
|
|
221
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_OUTPUT_INVALID", `Compiled document metadata is invalid: ${validation.messages.join("; ")}`);
|
|
222
|
+
}
|
|
223
|
+
const output = this.#dependencies.renderer.render({
|
|
224
|
+
frontmatter,
|
|
225
|
+
heading: resolved.heading,
|
|
226
|
+
template: skeleton
|
|
227
|
+
});
|
|
228
|
+
const expectedBytes = outputBytes(output);
|
|
229
|
+
const state = await this.#dependencies.state.observe({
|
|
230
|
+
consumerRoot: request.consumerRoot,
|
|
231
|
+
destination: resolved.destination,
|
|
232
|
+
...options
|
|
233
|
+
});
|
|
234
|
+
const logicalPreimage = this.#dependencies.policies.classifyDocumentLogicalPreimage({
|
|
235
|
+
catalog: authority.catalog,
|
|
236
|
+
id: intent.id,
|
|
237
|
+
destination: resolved.destination,
|
|
238
|
+
...(state.destination.state === "regular-file"
|
|
239
|
+
? { observedBytes: state.destination.bytes }
|
|
240
|
+
: {}),
|
|
241
|
+
expectedBytes
|
|
242
|
+
});
|
|
243
|
+
if ((state.destination.state === "regular-file") !==
|
|
244
|
+
logicalPreimage.isExactSelf) {
|
|
245
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_CONFLICT", "Existing destination is not the exact logical document self.");
|
|
246
|
+
}
|
|
247
|
+
await recaptureAuthority({
|
|
248
|
+
authority,
|
|
249
|
+
dependencies: this.#dependencies,
|
|
250
|
+
destination: resolved.destination,
|
|
251
|
+
profile,
|
|
252
|
+
request,
|
|
253
|
+
state,
|
|
254
|
+
templatePath: resolved.artifact.template.path
|
|
255
|
+
});
|
|
256
|
+
assertNotCancelled(request.signal);
|
|
257
|
+
const plan = compileDocumentPlan({
|
|
258
|
+
catalog: authority.catalog,
|
|
259
|
+
compiler: this.#dependencies.compiler,
|
|
260
|
+
destination: resolved.destination,
|
|
261
|
+
identityProjection: logicalPreimage.identityProjection,
|
|
262
|
+
intent,
|
|
263
|
+
metadataSchema: authority.metadata.evidence,
|
|
264
|
+
ownerCatalog: authority.owners.evidence,
|
|
265
|
+
output,
|
|
266
|
+
profile,
|
|
267
|
+
state,
|
|
268
|
+
template: authority.template
|
|
269
|
+
});
|
|
270
|
+
const validatedPlan = await this.#dependencies.contracts.validatePlan(plan);
|
|
271
|
+
assertDocumentPlanDigests(validatedPlan);
|
|
272
|
+
assertNotCancelled(request.signal);
|
|
273
|
+
return validatedPlan;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=plan-documentation-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-documentation-document.js","sourceRoot":"","sources":["../../../../src/document-authoring/application/use-cases/plan-documentation-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAqB9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAsEjE,SAAS,YAAY,CAAC,MAA+B;IAGnD,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,YAAY,CACnB,IAA+B,EAC/B,KAAgC;IAEhC,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;QACxB,I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T_PLANNING_INPUT_INVALID" | "DOCUMENT_PLANNING_OUTPUT_INVALID" | "DOCUMENT_PLANNING_PARENT_UNAVAILABLE";
|
|
2
|
+
export declare class DocumentPlanningError extends Error {
|
|
3
|
+
readonly code: DocumentPlanningErrorCode;
|
|
4
|
+
constructor(code: DocumentPlanningErrorCode, message: string, options?: ErrorOptions);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=document-planning-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-planning-error.d.ts","sourceRoot":"","sources":["../../src/document-authoring/document-planning-error.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GACjC,qCAAqC,GACrC,yCAAyC,GACzC,mCAAmC,GACnC,4BAA4B,GAC5B,iCAAiC,GACjC,kCAAkC,GAClC,sCAAsC,CAAC;AAE3C,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IAEzC,YACE,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EAKvB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-planning-error.js","sourceRoot":"","sources":["../../src/document-authoring/document-planning-error.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,IAAI,CAA4B;IAEzC,YACE,IAA+B,EAC/B,OAAe,EACf,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { type BuildDocumentationCatalogRequest } from "./application/use-cases/build-documentation-catalog.js";
|
|
2
2
|
import { type FindDocumentsRequest } from "./application/use-cases/find-documents.js";
|
|
3
|
+
import { type PlanDocumentationDocumentRequest } from "./application/use-cases/plan-documentation-document.js";
|
|
3
4
|
export type { DocumentAuthorityDigest, DocumentAuthorityEvidence, DocumentDescriptor, DocumentIdentityProjectionEntry, DocumentationCatalogAuthority, DocumentationCatalogDiagnostic, DocumentationCatalogSnapshot, ReferencedDocumentProjection, ReferencedDocumentProjectionResult } from "./application/model/document-catalog.js";
|
|
4
5
|
export type { DocumentFindFilters, DocumentFindQuery, DocumentFindResult } from "./application/model/document-find.js";
|
|
6
|
+
export type { DocumentCompilerIdentity, DocumentIntent, DocumentJsonObject, DocumentJsonPrimitive, DocumentJsonValue, DocumentPlan, DocumentPlanDiagnostic } from "./application/model/document-planning.js";
|
|
5
7
|
export type { BuildDocumentationCatalogRequest } from "./application/use-cases/build-documentation-catalog.js";
|
|
6
8
|
export type { FindDocumentsRequest } from "./application/use-cases/find-documents.js";
|
|
9
|
+
export type { PlanDocumentationDocumentRequest } from "./application/use-cases/plan-documentation-document.js";
|
|
7
10
|
export { projectReferencedDocuments } from "./application/projections/document-catalog-projections.js";
|
|
8
11
|
export { DocumentCatalogError } from "./document-catalog-error.js";
|
|
9
12
|
export type { DocumentCatalogErrorCode } from "./document-catalog-error.js";
|
|
13
|
+
export { DocumentPlanningError } from "./document-planning-error.js";
|
|
14
|
+
export type { DocumentPlanningErrorCode } from "./document-planning-error.js";
|
|
10
15
|
export declare function buildDocumentationCatalog(request: BuildDocumentationCatalogRequest): Promise<import("./application/model/document-catalog.js").DocumentationCatalogSnapshot>;
|
|
11
16
|
export declare function findDocumentationDocuments(request: FindDocumentsRequest): Promise<import("./application/model/document-find.js").DocumentFindResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Compiles a deterministic Document Plan without reserving an identity or
|
|
19
|
+
* mutating the consumer repository.
|
|
20
|
+
*/
|
|
21
|
+
export declare function planDocumentationDocument(request: PlanDocumentationDocumentRequest): Promise<import("./application/model/document-planning.js").DocumentPlan>;
|
|
12
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document-authoring/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document-authoring/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,wDAAwD,CAAC;AAGhE,YAAY,EACV,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,+BAA+B,EAC/B,6BAA6B,EAC7B,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EACnC,MAAM,yCAAyC,CAAC;AACjD,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EACV,wBAAwB,EACxB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACvB,MAAM,0CAA0C,CAAC;AAClD,YAAY,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAC;AAC/G,YAAY,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACtF,YAAY,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAC;AAC/G,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,YAAY,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAE9E,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,gCAAgC,2FAS1C;AAED,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,oBAAoB,8EAQ7E;AAWD;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,gCAAgC,4EAiD1C"}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { FilesystemMarkdownRepository } from "../documentation-observation/adapters/outbound/filesystem/filesystem-markdown-repository.js";
|
|
2
|
+
import { installedFoundationVersion } from "../package-version.js";
|
|
3
|
+
import { installedFoundationBuildIdentity } from "../transaction-coordination/adapters/node/installed-foundation-build-identity.js";
|
|
4
|
+
import { CanonicalMarkdownError, YamlCanonicalDocumentRenderer } from "./adapters/canonical-markdown.js";
|
|
2
5
|
import { NodeAuthoringProfileReader } from "./adapters/node/node-authoring-profile-reader.js";
|
|
6
|
+
import { NodeDocumentContractValidator } from "./adapters/node/node-document-contract-validator.js";
|
|
7
|
+
import { NodeDocumentPlanningProfileReader } from "./adapters/node/node-document-planning-profile-reader.js";
|
|
8
|
+
import { NodeDocumentPlanningStateReader } from "./adapters/node/node-document-planning-state-reader.js";
|
|
9
|
+
import { NodeDocumentTemplateReader } from "./adapters/node/node-document-template-reader.js";
|
|
3
10
|
import { NodeMetadataInstanceValidator } from "./adapters/node/node-metadata-instance-validator.js";
|
|
4
11
|
import { NodeOwnerMembershipReader } from "./adapters/node/node-owner-membership-reader.js";
|
|
12
|
+
import { DocumentPlanningPolicyError } from "./application/policies/document-planning-policy-error.js";
|
|
13
|
+
import { classifyDocumentLogicalPreimage, isDestinationCoveredByCatalog } from "./application/policies/document-logical-preimage.js";
|
|
14
|
+
import { normalizeDocumentIntent } from "./application/policies/normalize-document-intent.js";
|
|
15
|
+
import { resolveDocumentAuthoring, selectDocumentArtifact } from "./application/policies/resolve-document-authoring.js";
|
|
5
16
|
import { BuildDocumentationCatalog } from "./application/use-cases/build-documentation-catalog.js";
|
|
6
17
|
import { FindDocuments } from "./application/use-cases/find-documents.js";
|
|
18
|
+
import { PlanDocumentationDocument } from "./application/use-cases/plan-documentation-document.js";
|
|
19
|
+
import { DocumentPlanningError } from "./document-planning-error.js";
|
|
7
20
|
export { projectReferencedDocuments } from "./application/projections/document-catalog-projections.js";
|
|
8
21
|
export { DocumentCatalogError } from "./document-catalog-error.js";
|
|
22
|
+
export { DocumentPlanningError } from "./document-planning-error.js";
|
|
9
23
|
export async function buildDocumentationCatalog(request) {
|
|
10
24
|
const builder = new BuildDocumentationCatalog({
|
|
11
25
|
metadata: new NodeMetadataInstanceValidator(),
|
|
@@ -24,4 +38,62 @@ export async function findDocumentationDocuments(request) {
|
|
|
24
38
|
});
|
|
25
39
|
return new FindDocuments(catalog).execute(request);
|
|
26
40
|
}
|
|
41
|
+
function planningPolicyFailure(error) {
|
|
42
|
+
const code = error.problem === "catalog-incomplete"
|
|
43
|
+
? "DOCUMENT_PLANNING_CATALOG_PARTIAL"
|
|
44
|
+
: ["catalog-collision", "destination-conflict"].includes(error.problem)
|
|
45
|
+
? "DOCUMENT_PLANNING_CONFLICT"
|
|
46
|
+
: "DOCUMENT_PLANNING_INPUT_INVALID";
|
|
47
|
+
throw new DocumentPlanningError(code, error.message, { cause: error });
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Compiles a deterministic Document Plan without reserving an identity or
|
|
51
|
+
* mutating the consumer repository.
|
|
52
|
+
*/
|
|
53
|
+
export async function planDocumentationDocument(request) {
|
|
54
|
+
const catalog = new BuildDocumentationCatalog({
|
|
55
|
+
metadata: new NodeMetadataInstanceValidator(),
|
|
56
|
+
owners: new NodeOwnerMembershipReader(),
|
|
57
|
+
profile: new NodeAuthoringProfileReader(),
|
|
58
|
+
repository: new FilesystemMarkdownRepository()
|
|
59
|
+
});
|
|
60
|
+
const [version, buildIdentity] = await Promise.all([
|
|
61
|
+
installedFoundationVersion(),
|
|
62
|
+
installedFoundationBuildIdentity()
|
|
63
|
+
]);
|
|
64
|
+
const planner = new PlanDocumentationDocument({
|
|
65
|
+
catalog,
|
|
66
|
+
compiler: {
|
|
67
|
+
id: "@agent-teams/engineering-foundation",
|
|
68
|
+
version,
|
|
69
|
+
buildIdentity
|
|
70
|
+
},
|
|
71
|
+
contracts: new NodeDocumentContractValidator(),
|
|
72
|
+
metadata: new NodeMetadataInstanceValidator(),
|
|
73
|
+
owners: new NodeOwnerMembershipReader(),
|
|
74
|
+
policies: {
|
|
75
|
+
classifyDocumentLogicalPreimage,
|
|
76
|
+
isDestinationCoveredByCatalog,
|
|
77
|
+
normalizeDocumentIntent,
|
|
78
|
+
resolveDocumentAuthoring,
|
|
79
|
+
selectDocumentArtifact
|
|
80
|
+
},
|
|
81
|
+
profile: new NodeDocumentPlanningProfileReader(),
|
|
82
|
+
renderer: new YamlCanonicalDocumentRenderer(),
|
|
83
|
+
state: new NodeDocumentPlanningStateReader(),
|
|
84
|
+
templates: new NodeDocumentTemplateReader()
|
|
85
|
+
});
|
|
86
|
+
try {
|
|
87
|
+
return await planner.execute(request);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (error instanceof DocumentPlanningPolicyError) {
|
|
91
|
+
planningPolicyFailure(error);
|
|
92
|
+
}
|
|
93
|
+
if (error instanceof CanonicalMarkdownError) {
|
|
94
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_AUTHORITY_UNAVAILABLE", `Document template authority is invalid: ${error.message}`, { cause: error });
|
|
95
|
+
}
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
27
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/document-authoring/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6FAA6F,CAAC;AAC3I,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,iD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AsB,EAAE,CAAC;YAC5C,MAAM,IAAI,qBAAqB,CAC7B,yCAAyC,EACzC,2CAA2C,KAAK,CAAC,OAAO,EAAE,EAC1D,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FoundationTransactionStatus } from "../../application/model/transaction-status.js";
|
|
2
|
+
export declare function classifyNodeTemporaryIdentity(value: unknown): "invalid" | "unverifiable" | "verifiable";
|
|
3
|
+
export declare function unverifiableDocumentTemporaryStatus(foundation: Record<string, unknown>): FoundationTransactionStatus;
|
|
4
|
+
//# sourceMappingURL=document-temporary-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-temporary-identity.d.ts","sourceRoot":"","sources":["../../../../src/transaction-coordination/adapters/node/document-temporary-identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAMjG,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,GACb,SAAS,GAAG,cAAc,GAAG,YAAY,CAa3C;AAED,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,2BAA2B,CAW7B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function isRecord(value) {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
export function classifyNodeTemporaryIdentity(value) {
|
|
5
|
+
if (!isRecord(value)) {
|
|
6
|
+
return "invalid";
|
|
7
|
+
}
|
|
8
|
+
const decimal = /^(?:0|[1-9][0-9]{0,31})$/u;
|
|
9
|
+
if (value["adapter"] !== "node-filesystem" || value["version"] !== 1 ||
|
|
10
|
+
typeof value["dev"] !== "string" || !decimal.test(value["dev"]) ||
|
|
11
|
+
typeof value["ino"] !== "string" || !decimal.test(value["ino"]) ||
|
|
12
|
+
typeof value["birthtimeNs"] !== "string" || !decimal.test(value["birthtimeNs"])) {
|
|
13
|
+
return "invalid";
|
|
14
|
+
}
|
|
15
|
+
return value["dev"] === "0" || value["ino"] === "0" ||
|
|
16
|
+
value["birthtimeNs"] === "0" ? "unverifiable" : "verifiable";
|
|
17
|
+
}
|
|
18
|
+
export function unverifiableDocumentTemporaryStatus(foundation) {
|
|
19
|
+
return {
|
|
20
|
+
state: "manual-recovery-required", reason: "recovery-handler-unavailable",
|
|
21
|
+
operationKind: "document-authoring", format: "envelope-v2",
|
|
22
|
+
foundationVersion: String(foundation["version"]),
|
|
23
|
+
foundationBuildIdentity: String(foundation["buildIdentity"]),
|
|
24
|
+
diagnostics: [{
|
|
25
|
+
code: "FOUNDATION_TRANSACTION_MANUAL_RECOVERY_REQUIRED",
|
|
26
|
+
message: "The preserved Document transaction temporary has an adapter-reported zero physical identity and cannot authorize automatic recovery or publication."
|
|
27
|
+
}]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=document-temporary-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-temporary-identity.js","sourceRoot":"","sources":["../../../../src/transaction-coordination/adapters/node/document-temporary-identity.ts"],"names":[],"mappings":"AAEA,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAc;IAEd,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,2BAA2B,CAAC;IAC5C,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,iBAAiB,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;QAClE,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/D,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/D,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QAClF,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG;QACjD,KAAK,CAAC,aAAa,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,UAAmC;IAEnC,OAAO;QACL,KAAK,EAAE,0BAA0B,EAAE,MAAM,EAAE,8BAA8B;QACzE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAE,aAAa;QAC1D,iBAAiB,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAChD,uBAAuB,EAAE,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QAC5D,WAAW,EAAE,CAAC;gBACZ,IAAI,EAAE,iDAAiD;gBACvD,OAAO,EAAE,qJAAqJ;aAC/J,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Selects legacy semantics before any corrected schema or digest code runs. */
|
|
2
|
+
export declare function isKnownLegacyDocumentEnvelope(value: unknown): boolean;
|
|
3
|
+
/** Replays the exact document hash semantics shipped by 0.13.0 and 0.13.1. */
|
|
4
|
+
export declare function assertLegacyDocumentEnvelope(envelope: Record<string, unknown>): void;
|
|
5
|
+
//# sourceMappingURL=legacy-document-envelope-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-document-envelope-v2.d.ts","sourceRoot":"","sources":["../../../../src/transaction-coordination/adapters/node/legacy-document-envelope-v2.ts"],"names":[],"mappings":"AA2KA,gFAAgF;AAChF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAErE;AAcD,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CAiEN"}
|