@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.
Files changed (131) hide show
  1. package/dist/canonical-json.d.ts +12 -0
  2. package/dist/canonical-json.d.ts.map +1 -0
  3. package/dist/canonical-json.js +151 -0
  4. package/dist/canonical-json.js.map +1 -0
  5. package/dist/document-authoring/adapters/canonical-markdown.d.ts +14 -0
  6. package/dist/document-authoring/adapters/canonical-markdown.d.ts.map +1 -0
  7. package/dist/document-authoring/adapters/canonical-markdown.js +354 -0
  8. package/dist/document-authoring/adapters/canonical-markdown.js.map +1 -0
  9. package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.d.ts +31 -0
  10. package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.d.ts.map +1 -0
  11. package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.js +47 -0
  12. package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.js.map +1 -0
  13. package/dist/document-authoring/adapters/node/node-authoring-profile-reader.d.ts.map +1 -1
  14. package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js +14 -36
  15. package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js.map +1 -1
  16. package/dist/document-authoring/adapters/node/node-document-contract-validator.d.ts +7 -0
  17. package/dist/document-authoring/adapters/node/node-document-contract-validator.d.ts.map +1 -0
  18. package/dist/document-authoring/adapters/node/node-document-contract-validator.js +179 -0
  19. package/dist/document-authoring/adapters/node/node-document-contract-validator.js.map +1 -0
  20. package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.d.ts +10 -0
  21. package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.d.ts.map +1 -0
  22. package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.js +72 -0
  23. package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.js.map +1 -0
  24. package/dist/document-authoring/adapters/node/node-document-planning-state-reader.d.ts +10 -0
  25. package/dist/document-authoring/adapters/node/node-document-planning-state-reader.d.ts.map +1 -0
  26. package/dist/document-authoring/adapters/node/node-document-planning-state-reader.js +164 -0
  27. package/dist/document-authoring/adapters/node/node-document-planning-state-reader.js.map +1 -0
  28. package/dist/document-authoring/adapters/node/node-document-template-reader.d.ts +10 -0
  29. package/dist/document-authoring/adapters/node/node-document-template-reader.d.ts.map +1 -0
  30. package/dist/document-authoring/adapters/node/node-document-template-reader.js +32 -0
  31. package/dist/document-authoring/adapters/node/node-document-template-reader.js.map +1 -0
  32. package/dist/document-authoring/adapters/node/read-document-authority-file.d.ts.map +1 -1
  33. package/dist/document-authoring/adapters/node/read-document-authority-file.js +3 -13
  34. package/dist/document-authoring/adapters/node/read-document-authority-file.js.map +1 -1
  35. package/dist/document-authoring/application/model/document-planning.d.ts +171 -0
  36. package/dist/document-authoring/application/model/document-planning.d.ts.map +1 -0
  37. package/dist/document-authoring/application/model/document-planning.js +2 -0
  38. package/dist/document-authoring/application/model/document-planning.js.map +1 -0
  39. package/dist/document-authoring/application/policies/authoring-profile-semantics.d.ts +38 -0
  40. package/dist/document-authoring/application/policies/authoring-profile-semantics.d.ts.map +1 -0
  41. package/dist/document-authoring/application/policies/authoring-profile-semantics.js +122 -0
  42. package/dist/document-authoring/application/policies/authoring-profile-semantics.js.map +1 -0
  43. package/dist/document-authoring/application/policies/document-contract-digests.d.ts +20 -0
  44. package/dist/document-authoring/application/policies/document-contract-digests.d.ts.map +1 -0
  45. package/dist/document-authoring/application/policies/document-contract-digests.js +275 -0
  46. package/dist/document-authoring/application/policies/document-contract-digests.js.map +1 -0
  47. package/dist/document-authoring/application/policies/document-logical-preimage.d.ts +14 -0
  48. package/dist/document-authoring/application/policies/document-logical-preimage.d.ts.map +1 -0
  49. package/dist/document-authoring/application/policies/document-logical-preimage.js +61 -0
  50. package/dist/document-authoring/application/policies/document-logical-preimage.js.map +1 -0
  51. package/dist/document-authoring/application/policies/document-planning-policy-error.d.ts +6 -0
  52. package/dist/document-authoring/application/policies/document-planning-policy-error.d.ts.map +1 -0
  53. package/dist/document-authoring/application/policies/document-planning-policy-error.js +9 -0
  54. package/dist/document-authoring/application/policies/document-planning-policy-error.js.map +1 -0
  55. package/dist/document-authoring/application/policies/document-repository-path.d.ts +1 -0
  56. package/dist/document-authoring/application/policies/document-repository-path.d.ts.map +1 -1
  57. package/dist/document-authoring/application/policies/document-repository-path.js +21 -2
  58. package/dist/document-authoring/application/policies/document-repository-path.js.map +1 -1
  59. package/dist/document-authoring/application/policies/document-temporary-path.d.ts +7 -0
  60. package/dist/document-authoring/application/policies/document-temporary-path.d.ts.map +1 -0
  61. package/dist/document-authoring/application/policies/document-temporary-path.js +34 -0
  62. package/dist/document-authoring/application/policies/document-temporary-path.js.map +1 -0
  63. package/dist/document-authoring/application/policies/normalize-document-intent.d.ts +3 -0
  64. package/dist/document-authoring/application/policies/normalize-document-intent.d.ts.map +1 -0
  65. package/dist/document-authoring/application/policies/normalize-document-intent.js +104 -0
  66. package/dist/document-authoring/application/policies/normalize-document-intent.js.map +1 -0
  67. package/dist/document-authoring/application/policies/resolve-document-authoring.d.ts +13 -0
  68. package/dist/document-authoring/application/policies/resolve-document-authoring.d.ts.map +1 -0
  69. package/dist/document-authoring/application/policies/resolve-document-authoring.js +154 -0
  70. package/dist/document-authoring/application/policies/resolve-document-authoring.js.map +1 -0
  71. package/dist/document-authoring/application/ports/canonical-document-renderer.d.ts +29 -0
  72. package/dist/document-authoring/application/ports/canonical-document-renderer.d.ts.map +1 -0
  73. package/dist/document-authoring/application/ports/canonical-document-renderer.js +2 -0
  74. package/dist/document-authoring/application/ports/canonical-document-renderer.js.map +1 -0
  75. package/dist/document-authoring/application/ports/document-contract-validator.d.ts +6 -0
  76. package/dist/document-authoring/application/ports/document-contract-validator.d.ts.map +1 -0
  77. package/dist/document-authoring/application/ports/document-contract-validator.js +2 -0
  78. package/dist/document-authoring/application/ports/document-contract-validator.js.map +1 -0
  79. package/dist/document-authoring/application/ports/document-planning-profile-reader.d.ts +9 -0
  80. package/dist/document-authoring/application/ports/document-planning-profile-reader.d.ts.map +1 -0
  81. package/dist/document-authoring/application/ports/document-planning-profile-reader.js +2 -0
  82. package/dist/document-authoring/application/ports/document-planning-profile-reader.js.map +1 -0
  83. package/dist/document-authoring/application/ports/document-planning-state-reader.d.ts +9 -0
  84. package/dist/document-authoring/application/ports/document-planning-state-reader.d.ts.map +1 -0
  85. package/dist/document-authoring/application/ports/document-planning-state-reader.js +2 -0
  86. package/dist/document-authoring/application/ports/document-planning-state-reader.js.map +1 -0
  87. package/dist/document-authoring/application/ports/document-template-reader.d.ts +9 -0
  88. package/dist/document-authoring/application/ports/document-template-reader.d.ts.map +1 -0
  89. package/dist/document-authoring/application/ports/document-template-reader.js +2 -0
  90. package/dist/document-authoring/application/ports/document-template-reader.js.map +1 -0
  91. package/dist/document-authoring/application/ports/documentation-catalog-reader.d.ts +11 -0
  92. package/dist/document-authoring/application/ports/documentation-catalog-reader.d.ts.map +1 -0
  93. package/dist/document-authoring/application/ports/documentation-catalog-reader.js +2 -0
  94. package/dist/document-authoring/application/ports/documentation-catalog-reader.js.map +1 -0
  95. package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts +2 -1
  96. package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts.map +1 -1
  97. package/dist/document-authoring/application/use-cases/build-documentation-catalog.js.map +1 -1
  98. package/dist/document-authoring/application/use-cases/compile-document-plan.d.ts +6 -0
  99. package/dist/document-authoring/application/use-cases/compile-document-plan.d.ts.map +1 -0
  100. package/dist/document-authoring/application/use-cases/compile-document-plan.js +156 -0
  101. package/dist/document-authoring/application/use-cases/compile-document-plan.js.map +1 -0
  102. package/dist/document-authoring/application/use-cases/plan-documentation-document.d.ts +66 -0
  103. package/dist/document-authoring/application/use-cases/plan-documentation-document.d.ts.map +1 -0
  104. package/dist/document-authoring/application/use-cases/plan-documentation-document.js +276 -0
  105. package/dist/document-authoring/application/use-cases/plan-documentation-document.js.map +1 -0
  106. package/dist/document-authoring/document-planning-error.d.ts +6 -0
  107. package/dist/document-authoring/document-planning-error.d.ts.map +1 -0
  108. package/dist/document-authoring/document-planning-error.js +9 -0
  109. package/dist/document-authoring/document-planning-error.js.map +1 -0
  110. package/dist/document-authoring/index.d.ts +10 -0
  111. package/dist/document-authoring/index.d.ts.map +1 -1
  112. package/dist/document-authoring/index.js +72 -0
  113. package/dist/document-authoring/index.js.map +1 -1
  114. package/dist/transaction-coordination/adapters/node/document-temporary-identity.d.ts +4 -0
  115. package/dist/transaction-coordination/adapters/node/document-temporary-identity.d.ts.map +1 -0
  116. package/dist/transaction-coordination/adapters/node/document-temporary-identity.js +30 -0
  117. package/dist/transaction-coordination/adapters/node/document-temporary-identity.js.map +1 -0
  118. package/dist/transaction-coordination/adapters/node/legacy-document-envelope-v2.d.ts +5 -0
  119. package/dist/transaction-coordination/adapters/node/legacy-document-envelope-v2.d.ts.map +1 -0
  120. package/dist/transaction-coordination/adapters/node/legacy-document-envelope-v2.js +212 -0
  121. package/dist/transaction-coordination/adapters/node/legacy-document-envelope-v2.js.map +1 -0
  122. package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.d.ts.map +1 -1
  123. package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js +47 -25
  124. package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js.map +1 -1
  125. package/package.json +1 -1
  126. package/schemas/document-authoring-profile/v1.schema.json +64 -15
  127. package/schemas/document-command-envelope/v1.schema.json +1 -1
  128. package/schemas/document-intent/v1.schema.json +48 -6
  129. package/schemas/document-plan/v1.schema.json +20 -4
  130. package/schemas/document-receipt/v1.schema.json +1 -1
  131. package/schemas/foundation-transaction-envelope/v2.schema.json +21 -3
@@ -0,0 +1,10 @@
1
+ import type { DocumentTemplateSnapshot } from "../../application/model/document-planning.js";
2
+ import type { DocumentTemplateReader } from "../../application/ports/document-template-reader.js";
3
+ export declare class NodeDocumentTemplateReader implements DocumentTemplateReader {
4
+ read(request: {
5
+ readonly consumerRoot: string;
6
+ readonly path: string;
7
+ readonly signal?: AbortSignal;
8
+ }): Promise<DocumentTemplateSnapshot>;
9
+ }
10
+ //# sourceMappingURL=node-document-template-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-document-template-reader.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-document-template-reader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAOlG,qBAAa,0BAA2B,YAAW,sBAAsB;IACjE,IAAI,CAAC,OAAO,EAAE;QAClB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC/B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA6BpC;CACF"}
@@ -0,0 +1,32 @@
1
+ import { assertNotCancelled } from "../../../cancellation.js";
2
+ import { CapabilityInputError } from "../../../capability-runtime.js";
3
+ import { DocumentCatalogError } from "../../document-catalog-error.js";
4
+ import { DocumentPlanningError } from "../../document-planning-error.js";
5
+ import { readDocumentAuthorityFile } from "./read-document-authority-file.js";
6
+ const MAX_TEMPLATE_BYTES = 256 * 1024;
7
+ export class NodeDocumentTemplateReader {
8
+ async read(request) {
9
+ assertNotCancelled(request.signal);
10
+ try {
11
+ const file = await readDocumentAuthorityFile({
12
+ consumerRoot: request.consumerRoot,
13
+ maxBytes: MAX_TEMPLATE_BYTES,
14
+ path: request.path
15
+ });
16
+ assertNotCancelled(request.signal);
17
+ return Object.freeze({ evidence: file.evidence, source: file.source });
18
+ }
19
+ catch (error) {
20
+ if (error instanceof CapabilityInputError || error instanceof DocumentPlanningError) {
21
+ throw error;
22
+ }
23
+ if (error instanceof DocumentCatalogError) {
24
+ throw new DocumentPlanningError(error.code === "DOCUMENT_CATALOG_INPUT_INVALID"
25
+ ? "DOCUMENT_PLANNING_INPUT_INVALID"
26
+ : "DOCUMENT_PLANNING_AUTHORITY_UNAVAILABLE", `Document template is unavailable or invalid: ${request.path}.`, { cause: error });
27
+ }
28
+ throw new DocumentPlanningError("DOCUMENT_PLANNING_AUTHORITY_UNAVAILABLE", `Document template is unavailable or invalid: ${request.path}.`, { cause: error });
29
+ }
30
+ }
31
+ }
32
+ //# sourceMappingURL=node-document-template-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-document-template-reader.js","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-document-template-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAGtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,MAAM,kBAAkB,GAAG,GAAG,GAAG,IAAI,CAAC;AAEtC,MAAM,OAAO,0BAA0B;IACrC,KAAK,CAAC,IAAI,CAAC,OAIV;QACC,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,yBAAyB,CAAC;gBAC3C,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC,CAAC;YACH,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACnC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACzE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,oBAAoB,IAAI,KAAK,YAAY,qBAAqB,EAAE,CAAC;gBACpF,MAAM,KAAK,CAAC;YACd,CAAC;YACD,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;gBAC1C,MAAM,IAAI,qBAAqB,CAC7B,KAAK,CAAC,IAAI,KAAK,gCAAgC;oBAC7C,CAAC,CAAC,iCAAiC;oBACnC,CAAC,CAAC,yCAAyC,EAC7C,gDAAgD,OAAO,CAAC,IAAI,GAAG,EAC/D,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,qBAAqB,CAC7B,yCAAyC,EACzC,gDAAgD,OAAO,CAAC,IAAI,GAAG,EAC/D,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"read-document-authority-file.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/read-document-authority-file.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,6CAA6C,CAAC;AAKrD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AA4ED,wBAAsB,yBAAyB,CAAC,OAAO,EAAE;IACvD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4BjC"}
1
+ {"version":3,"file":"read-document-authority-file.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/read-document-authority-file.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,6CAA6C,CAAC;AAIrD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AA6DD,wBAAsB,yBAAyB,CAAC,OAAO,EAAE;IACvD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4BjC"}
@@ -1,23 +1,13 @@
1
1
  import { createHash } from "node:crypto";
2
- import { isAbsolute, resolve } from "node:path";
2
+ import { resolve } from "node:path";
3
3
  import { ContainedFileReadError, readContainedRegularFile } from "../../../filesystem-path-safety.js";
4
+ import { isDocumentRepositoryPath } from "../../application/policies/document-repository-path.js";
4
5
  import { DocumentCatalogError } from "../../document-catalog-error.js";
5
- const WINDOWS_DEVICE_COMPONENT = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/iu;
6
6
  function inputInvalid(message, options) {
7
7
  throw new DocumentCatalogError("DOCUMENT_CATALOG_INPUT_INVALID", message, options);
8
8
  }
9
9
  function assertPortableDocumentAuthorityPath(path) {
10
- const segments = path.split("/");
11
- if (path.length === 0 ||
12
- path.length > 512 ||
13
- isAbsolute(path) ||
14
- path.includes("\\") ||
15
- !/^[A-Za-z0-9._@/-]+$/u.test(path) ||
16
- segments.some((segment) => segment.length === 0 ||
17
- segment === "." ||
18
- segment === ".." ||
19
- segment.endsWith(".") ||
20
- WINDOWS_DEVICE_COMPONENT.test(segment))) {
10
+ if (!isDocumentRepositoryPath(path)) {
21
11
  inputInvalid("Document authority paths must use the portable repository-relative path grammar.");
22
12
  }
23
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"read-document-authority-file.js","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/read-document-authority-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAK5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,wBAAwB,GAAG,kDAAkD,CAAC;AAQpF,SAAS,YAAY,CAAC,OAAe,EAAE,OAAsB;IAC3D,MAAM,IAAI,oBAAoB,CAC5B,gCAAgC,EAChC,OAAO,EACP,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,mCAAmC,CAAC,IAAY;IACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IACE,IAAI,CAAC,MAAM,KAAK,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,GAAG;QACjB,UAAU,CAAC,IAAI,CAAC;QAChB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACnB,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;QAClC,QAAQ,CAAC,IAAI,CACX,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,MAAM,KAAK,CAAC;YACpB,OAAO,KAAK,GAAG;YACf,OAAO,KAAK,IAAI;YAChB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;YACrB,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,CACzC,EACD,CAAC;QACD,YAAY,CACV,kFAAkF,CACnF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAa,EAAE,IAAY;IACxD,IACE,KAAK,CAAC,MAAM,IAAI,CAAC;QACjB,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;QACjB,KAAK,CAAC,CAAC,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,yBAAyB,CAAC,OAI/C;IACC,mCAAmC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,KAAa,CAAC;IAClB,IAAI,CAAC;QACH,KAAK,GAAG,MAAM,wBAAwB,CAAC;YACrC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC;YACtD,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,IAAI,EAAE,OAAO,CAAC,YAAY;SAC3B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,sBAAsB,EAAE,CAAC;YAC5C,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,YAAY,CAAC,yCAAyC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;YACtB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;YACrB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,KAAK,CAAC,UAAU;SACvB,CAAC;QACF,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"read-document-authority-file.js","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/read-document-authority-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,oCAA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AK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;YACtB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;YACrB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,KAAK,CAAC,UAAU;SACvB,CAAC;QACF,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,171 @@
1
+ import type { DocumentAuthorityDigest, DocumentAuthorityEvidence, DocumentIdentityProjectionEntry, DocumentationCatalogSnapshot } from "./document-catalog.js";
2
+ export type DocumentJsonPrimitive = boolean | null | number | string;
3
+ export interface DocumentJsonObject {
4
+ readonly [key: string]: DocumentJsonValue;
5
+ }
6
+ export type DocumentJsonValue = DocumentJsonPrimitive | readonly DocumentJsonValue[] | DocumentJsonObject;
7
+ export interface DocumentIntent {
8
+ readonly schemaVersion: 1;
9
+ readonly type: string;
10
+ readonly id: string;
11
+ readonly title: string;
12
+ readonly owner: string;
13
+ readonly summary: string;
14
+ readonly slug?: string;
15
+ readonly destination?: string;
16
+ readonly related?: readonly string[];
17
+ readonly additionalMetadata?: Readonly<Record<string, DocumentJsonValue>>;
18
+ }
19
+ export type DocumentIdentityStrategy = {
20
+ readonly kind: "explicit";
21
+ readonly format: "adr-four-digits" | "open-decision-three-digits";
22
+ } | {
23
+ readonly kind: "explicit";
24
+ readonly format: "qualified";
25
+ readonly grammar: {
26
+ readonly prefixSegments: readonly string[];
27
+ readonly minSuffixSegments: number;
28
+ readonly maxSuffixSegments: number;
29
+ };
30
+ };
31
+ export type DocumentPlacementStrategy = {
32
+ readonly kind: "collection";
33
+ readonly directory: string;
34
+ readonly filename: "numeric-id-slug" | "id-slug" | "slug" | "README.md";
35
+ } | {
36
+ readonly kind: "qualified-leaf-index";
37
+ readonly root: string;
38
+ readonly requiredBasename: "README.md";
39
+ } | {
40
+ readonly kind: "explicit";
41
+ readonly allowedRoots: readonly string[];
42
+ readonly requiredSegmentsInOrder: readonly string[];
43
+ readonly requiredBasename: "README.md";
44
+ readonly minimumSegmentsBeforeRequired: number;
45
+ readonly minimumSegmentsAfterRequired: number;
46
+ };
47
+ export interface DocumentArtifactType {
48
+ readonly type: string;
49
+ readonly initialStatus: string;
50
+ readonly identity: DocumentIdentityStrategy;
51
+ readonly placement: DocumentPlacementStrategy;
52
+ readonly template: {
53
+ readonly kind: "fenced-markdown-body";
54
+ readonly path: string;
55
+ };
56
+ readonly heading: {
57
+ readonly kind: "id-colon-title" | "title";
58
+ };
59
+ }
60
+ export type DocumentCatalogCollection = {
61
+ readonly kind: "frontmatter-readme";
62
+ readonly roots: readonly string[];
63
+ } | {
64
+ readonly kind: "markdown-tree";
65
+ readonly root: string;
66
+ };
67
+ export interface DocumentPlanningProfileSnapshot {
68
+ readonly artifactTypes: readonly DocumentArtifactType[];
69
+ readonly collections: readonly DocumentCatalogCollection[];
70
+ readonly evidence: DocumentAuthorityEvidence;
71
+ readonly excludedPrefixes: readonly string[];
72
+ readonly metadataSchemaPath: string;
73
+ readonly ownerCatalog: {
74
+ readonly contract: "foundation.owner-map/v1";
75
+ readonly path: string;
76
+ };
77
+ readonly projectId: string;
78
+ }
79
+ export interface DocumentTemplateSnapshot {
80
+ readonly evidence: DocumentAuthorityEvidence;
81
+ readonly source: string;
82
+ }
83
+ export interface DocumentCompilerIdentity {
84
+ readonly id: "@agent-teams/engineering-foundation";
85
+ readonly version: string;
86
+ readonly buildIdentity: DocumentAuthorityDigest;
87
+ }
88
+ type DocumentDestinationObservation = {
89
+ readonly state: "absent";
90
+ } | {
91
+ readonly state: "regular-file";
92
+ readonly bytes: Uint8Array;
93
+ } | {
94
+ readonly state: "conflict";
95
+ readonly kind: "directory" | "portable-name-collision" | "special-file";
96
+ };
97
+ export interface DocumentPlanningStateSnapshot {
98
+ readonly destination: DocumentDestinationObservation;
99
+ readonly expectedParent: {
100
+ readonly path: string;
101
+ readonly state: "directory";
102
+ readonly ancestry: "real-directories";
103
+ };
104
+ }
105
+ export interface DocumentPlanDiagnostic {
106
+ readonly ruleId: string;
107
+ readonly severity: "error" | "info" | "warning";
108
+ readonly phase: "authority" | "input" | "planning" | "policy";
109
+ readonly subject: string;
110
+ readonly message: string;
111
+ }
112
+ export interface DocumentPlan {
113
+ readonly schemaVersion: 1;
114
+ readonly protocolVersion: 1;
115
+ readonly compiler: DocumentCompilerIdentity;
116
+ readonly projectId: string;
117
+ readonly intent: DocumentIntent;
118
+ readonly intentDigest: DocumentAuthorityDigest;
119
+ readonly authority: {
120
+ readonly profile: DocumentAuthorityEvidence;
121
+ readonly metadataSchema: DocumentAuthorityEvidence;
122
+ readonly ownerCatalog: DocumentAuthorityEvidence;
123
+ readonly template: DocumentAuthorityEvidence;
124
+ };
125
+ readonly selectedOwner: {
126
+ readonly id: string;
127
+ readonly membershipDigest: DocumentAuthorityDigest;
128
+ };
129
+ readonly identityProjection: {
130
+ readonly entryCount: number;
131
+ readonly digest: DocumentAuthorityDigest;
132
+ };
133
+ readonly referencedDocuments: readonly {
134
+ readonly id: string;
135
+ readonly path: string;
136
+ readonly projectionDigest: DocumentAuthorityDigest;
137
+ }[];
138
+ readonly destination: string;
139
+ readonly expectedParent: {
140
+ readonly path: string;
141
+ readonly state: "directory";
142
+ readonly ancestry: "real-directories";
143
+ };
144
+ readonly destinationPrecondition: {
145
+ readonly state: "absent";
146
+ };
147
+ readonly output: {
148
+ readonly digest: DocumentAuthorityDigest;
149
+ readonly size: number;
150
+ readonly mode: "0644";
151
+ readonly mediaType: "text/markdown; charset=utf-8";
152
+ readonly contentBase64: string;
153
+ };
154
+ readonly requiredAdapterCapabilities: readonly ["create-file-no-replace/v1"];
155
+ readonly diagnostics: readonly DocumentPlanDiagnostic[];
156
+ readonly planDigest: DocumentAuthorityDigest;
157
+ }
158
+ export interface DocumentPlanningCompilationInput {
159
+ readonly catalog: DocumentationCatalogSnapshot;
160
+ readonly compiler: DocumentCompilerIdentity;
161
+ readonly identityProjection: readonly DocumentIdentityProjectionEntry[];
162
+ readonly intent: DocumentIntent;
163
+ readonly metadataSchema: DocumentAuthorityEvidence;
164
+ readonly ownerCatalog: DocumentAuthorityEvidence;
165
+ readonly profile: DocumentPlanningProfileSnapshot;
166
+ readonly state: DocumentPlanningStateSnapshot;
167
+ readonly template: DocumentTemplateSnapshot;
168
+ readonly output: string;
169
+ }
170
+ export {};
171
+ //# sourceMappingURL=document-planning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-planning.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/application/model/document-planning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,+BAA+B,EAC/B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AACrE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAC3C;AACD,MAAM,MAAM,iBAAiB,GACzB,qBAAqB,GACrB,SAAS,iBAAiB,EAAE,GAC5B,kBAAkB,CAAC;AAEvB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ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,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,SAAS,EAAE,8BAA8B,CAAC;QACnD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;KAChC,CAAC;IACF,QAAQ,CAAC,2BAA2B,EAAE,SAAS,CAAC,2BAA2B,CAAC,CAAC;IAC7E,QAAQ,CAAC,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACxD,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;CAC9C;AAED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,OAAO,EAAE,4BAA4B,CAAC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,SAAS,+BAA+B,EAAE,CAAC;IACxE,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,yBAAyB,CAAC;IACnD,QAAQ,CAAC,YAAY,EAAE,yBAAyB,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,+BAA+B,CAAC;IAClD,QAAQ,CAAC,KAAK,EAAE,6BAA6B,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=document-planning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-planning.js","sourceRoot":"","sources":["../../../../src/document-authoring/application/model/document-planning.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ interface PlacementSemantics {
2
+ readonly allowedRoots?: readonly string[];
3
+ readonly kind: string;
4
+ readonly filename?: string;
5
+ readonly minimumSegmentsAfterRequired?: number;
6
+ readonly minimumSegmentsBeforeRequired?: number;
7
+ readonly requiredBasename?: string;
8
+ readonly requiredSegmentsInOrder?: readonly string[];
9
+ readonly root?: string;
10
+ }
11
+ interface ArtifactTypeSemantics {
12
+ readonly identity?: {
13
+ readonly format?: string;
14
+ readonly grammar?: {
15
+ readonly maxSuffixSegments: number;
16
+ readonly minSuffixSegments: number;
17
+ readonly prefixSegments: readonly string[];
18
+ };
19
+ };
20
+ readonly placement: PlacementSemantics;
21
+ readonly type: string;
22
+ }
23
+ export interface AuthoringProfileSemantics {
24
+ readonly authoring: {
25
+ readonly artifactTypes: readonly ArtifactTypeSemantics[];
26
+ };
27
+ }
28
+ export type AuthoringProfileSemanticProblem = "duplicate-artifact-type" | "incompatible-identity-placement" | "invalid-qualified-grammar-range" | "overlapping-placement-roots" | "portable-root-collision";
29
+ export declare class AuthoringProfileSemanticError extends Error {
30
+ readonly problem: AuthoringProfileSemanticProblem;
31
+ constructor(problem: AuthoringProfileSemanticProblem);
32
+ }
33
+ export declare function assertAuthoringProfileSemantics(profile: AuthoringProfileSemantics): void;
34
+ export declare function matchingPlacementRoot(repositoryPath: string, allowedRoots: readonly string[]): string | undefined;
35
+ export declare function hasContiguousRequiredSegments(repositoryPath: string, requiredSegments: readonly string[], matchedRoot?: string): boolean;
36
+ export declare function isRepositoryPathAllowedByPlacement(repositoryPath: string, placement: PlacementSemantics): boolean;
37
+ export {};
38
+ //# sourceMappingURL=authoring-profile-semantics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-profile-semantics.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/application/policies/authoring-profile-semantics.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,6BAA6B,CAAC,EAAE,MAAM,CA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AC,EAAE,MAAM,GACnB,OAAO,CAkBT;AAED,wBAAgB,kCAAkC,CAChD,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAsCT"}
@@ -0,0 +1,122 @@
1
+ import { isDocumentRepositoryPath } from "./document-repository-path.js";
2
+ export class AuthoringProfileSemanticError extends Error {
3
+ problem;
4
+ constructor(problem) {
5
+ super(`Document authoring profile has invalid semantics: ${problem}.`);
6
+ this.name = "AuthoringProfileSemanticError";
7
+ this.problem = problem;
8
+ }
9
+ }
10
+ function portableAsciiIdentity(value) {
11
+ return value.replace(/[A-Z]/gu, (character) => character.toLowerCase());
12
+ }
13
+ function isSegmentBoundaryPrefix(prefix, candidate) {
14
+ return candidate === prefix || candidate.startsWith(`${prefix}/`);
15
+ }
16
+ function hasCompatibleIdentityPlacement(artifactType) {
17
+ const placement = artifactType.placement;
18
+ if (placement.kind === "qualified-leaf-index") {
19
+ return artifactType.identity?.format === "qualified";
20
+ }
21
+ if (placement.kind === "collection" && placement.filename === "numeric-id-slug") {
22
+ return artifactType.identity?.format === "adr-four-digits";
23
+ }
24
+ return true;
25
+ }
26
+ export function assertAuthoringProfileSemantics(profile) {
27
+ const types = new Set();
28
+ for (const artifactType of profile.authoring.artifactTypes) {
29
+ const typeIdentity = portableAsciiIdentity(artifactType.type);
30
+ if (types.has(typeIdentity)) {
31
+ throw new AuthoringProfileSemanticError("duplicate-artifact-type");
32
+ }
33
+ types.add(typeIdentity);
34
+ const grammar = artifactType.identity?.grammar;
35
+ if (grammar !== undefined &&
36
+ grammar.minSuffixSegments > grammar.maxSuffixSegments) {
37
+ throw new AuthoringProfileSemanticError("invalid-qualified-grammar-range");
38
+ }
39
+ const placement = artifactType.placement;
40
+ if (!hasCompatibleIdentityPlacement(artifactType)) {
41
+ throw new AuthoringProfileSemanticError("incompatible-identity-placement");
42
+ }
43
+ const roots = placement.kind === "qualified-leaf-index"
44
+ ? (placement.root === undefined ? [] : [placement.root])
45
+ : [...(placement.allowedRoots ?? [])];
46
+ const identities = roots.map(portableAsciiIdentity);
47
+ for (const [index, root] of roots.entries()) {
48
+ if (!isDocumentRepositoryPath(root)) {
49
+ throw new AuthoringProfileSemanticError("portable-root-collision");
50
+ }
51
+ for (let other = 0; other < index; other += 1) {
52
+ const previous = identities[other];
53
+ const current = identities[index];
54
+ if (previous === undefined || current === undefined) {
55
+ continue;
56
+ }
57
+ if (previous === current) {
58
+ throw new AuthoringProfileSemanticError("portable-root-collision");
59
+ }
60
+ if (isSegmentBoundaryPrefix(previous, current) ||
61
+ isSegmentBoundaryPrefix(current, previous)) {
62
+ throw new AuthoringProfileSemanticError("overlapping-placement-roots");
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ export function matchingPlacementRoot(repositoryPath, allowedRoots) {
69
+ const matches = allowedRoots.filter((root) => isSegmentBoundaryPrefix(root, repositoryPath));
70
+ return matches.length === 1 ? matches[0] : undefined;
71
+ }
72
+ export function hasContiguousRequiredSegments(repositoryPath, requiredSegments, matchedRoot) {
73
+ if (requiredSegments.length === 0) {
74
+ return true;
75
+ }
76
+ const rootIdentity = matchedRoot;
77
+ if (rootIdentity !== undefined &&
78
+ !isSegmentBoundaryPrefix(rootIdentity, repositoryPath)) {
79
+ return false;
80
+ }
81
+ const suffix = rootIdentity === undefined
82
+ ? repositoryPath
83
+ : repositoryPath.slice(rootIdentity.length).replace(/^\//u, "");
84
+ const segments = suffix.split("/");
85
+ return segments.some((_segment, start) => requiredSegments.every((segment, offset) => segments[start + offset] === segment));
86
+ }
87
+ export function isRepositoryPathAllowedByPlacement(repositoryPath, placement) {
88
+ if (!isDocumentRepositoryPath(repositoryPath)) {
89
+ return false;
90
+ }
91
+ const segments = repositoryPath.split("/");
92
+ const basename = segments.at(-1);
93
+ if (basename !== placement.requiredBasename) {
94
+ return false;
95
+ }
96
+ if (placement.kind === "qualified-leaf-index") {
97
+ if (placement.root === undefined) {
98
+ return false;
99
+ }
100
+ const rootSegments = placement.root.split("/");
101
+ return isSegmentBoundaryPrefix(placement.root, repositoryPath) &&
102
+ segments.length > rootSegments.length + 1;
103
+ }
104
+ if (placement.kind !== "explicit") {
105
+ return false;
106
+ }
107
+ const root = matchingPlacementRoot(repositoryPath, placement.allowedRoots ?? []);
108
+ const required = placement.requiredSegmentsInOrder ?? [];
109
+ if (root === undefined ||
110
+ required.length === 0 ||
111
+ placement.minimumSegmentsBeforeRequired === undefined ||
112
+ placement.minimumSegmentsAfterRequired === undefined) {
113
+ return false;
114
+ }
115
+ const suffix = repositoryPath.slice(root.length + 1).split("/");
116
+ const directories = suffix.slice(0, -1);
117
+ return directories.some((_segment, start) => start >= placement.minimumSegmentsBeforeRequired &&
118
+ directories.length - start - required.length >=
119
+ placement.minimumSegmentsAfterRequired &&
120
+ required.every((segment, offset) => directories[start + offset] === segment));
121
+ }
122
+ //# sourceMappingURL=authoring-profile-semantics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-profile-semantics.js","sourceRoot":"","sources":["../../../../src/document-authoring/application/policies/authoring-profile-semantics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAuCzE,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAC7C,OAAO,CAAkC;IAElD,YAAY,OAAwC;QAClD,KAAK,CAAC,qDAAqD,OAAO,GAAG,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,SAAS,qBAAqB,CAAC,KAAa;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAc,EAAE,SAAiB;IAChE,OAAO,SAAS,KAAK,MAAM,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG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xC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAC1C,KAAK,IAAI,SAAS,CAAC,6BAA8B;QACjD,WAAW,CAAC,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC,MAAM;YAC1C,SAAS,CAAC,4BAA6B;QACzC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,OAAO,CAAC,CAC7E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type CanonicalJsonValue } from "../../../canonical-json.js";
2
+ type Digest = `sha256:${string}`;
3
+ type JsonObject = Readonly<Record<string, CanonicalJsonValue>>;
4
+ export declare function documentIntentDigest(intent: JsonObject): Digest;
5
+ export declare function documentOwnerMembershipDigest(ownerCatalogDigest: string, ownerId: string): Digest;
6
+ export interface DocumentIdentityDigestEntry {
7
+ readonly id: string;
8
+ readonly repositoryPath: string;
9
+ }
10
+ export declare function documentIdentityProjectionDigest(entries: readonly DocumentIdentityDigestEntry[]): Digest;
11
+ export declare function documentReferencedDocumentDigest(document: {
12
+ readonly id: string;
13
+ readonly path: string;
14
+ }): Digest;
15
+ export declare function documentPlanDigest(plan: JsonObject): Digest;
16
+ export declare function documentReceiptDigest(receipt: JsonObject): Digest;
17
+ export declare function assertDocumentPlanDigests(value: unknown): void;
18
+ export declare function assertDocumentReceiptDigest(value: unknown, planValue?: unknown): void;
19
+ export {};
20
+ //# sourceMappingURL=document-contract-digests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-contract-digests.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/application/policies/document-contract-digests.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,4BAA4B,CAAC;AAIpC,KAAK,MAAM,GAAG,UAAU,MAAM,EAAE,CAAC;AACjC,KAAK,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAyC/D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAE/D;AAED,wBAAgB,6BAA6B,CAC3C,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,MAAM,GACd,MAAM,CAKR;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,SAAS,2BAA2B,EAAE,GAC9C,MAAM,CAcR;AAED,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE;IACzD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAST;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAK3D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAKjE;AAqOD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAU9D;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,OAAO,GAClB,IAAI,CAoCN"}