@agent-teams/engineering-foundation 0.10.0 → 0.12.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 (126) hide show
  1. package/README.md +32 -0
  2. package/dist/cli-arguments.d.ts +5 -0
  3. package/dist/cli-arguments.d.ts.map +1 -1
  4. package/dist/cli-arguments.js +78 -15
  5. package/dist/cli-arguments.js.map +1 -1
  6. package/dist/cli.js +15 -1
  7. package/dist/cli.js.map +1 -1
  8. package/dist/document-authoring/adapters/node/node-authoring-profile-reader.d.ts +9 -0
  9. package/dist/document-authoring/adapters/node/node-authoring-profile-reader.d.ts.map +1 -0
  10. package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js +53 -0
  11. package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js.map +1 -0
  12. package/dist/document-authoring/adapters/node/node-metadata-instance-validator.d.ts +9 -0
  13. package/dist/document-authoring/adapters/node/node-metadata-instance-validator.d.ts.map +1 -0
  14. package/dist/document-authoring/adapters/node/node-metadata-instance-validator.js +84 -0
  15. package/dist/document-authoring/adapters/node/node-metadata-instance-validator.js.map +1 -0
  16. package/dist/document-authoring/adapters/node/node-owner-membership-reader.d.ts +10 -0
  17. package/dist/document-authoring/adapters/node/node-owner-membership-reader.d.ts.map +1 -0
  18. package/dist/document-authoring/adapters/node/node-owner-membership-reader.js +62 -0
  19. package/dist/document-authoring/adapters/node/node-owner-membership-reader.js.map +1 -0
  20. package/dist/document-authoring/adapters/node/read-document-authority-file.d.ts +12 -0
  21. package/dist/document-authoring/adapters/node/read-document-authority-file.d.ts.map +1 -0
  22. package/dist/document-authoring/adapters/node/read-document-authority-file.js +88 -0
  23. package/dist/document-authoring/adapters/node/read-document-authority-file.js.map +1 -0
  24. package/dist/document-authoring/application/model/document-catalog.d.ts +59 -0
  25. package/dist/document-authoring/application/model/document-catalog.d.ts.map +1 -0
  26. package/dist/document-authoring/application/model/document-catalog.js +2 -0
  27. package/dist/document-authoring/application/model/document-catalog.js.map +1 -0
  28. package/dist/document-authoring/application/model/document-find.d.ts +18 -0
  29. package/dist/document-authoring/application/model/document-find.d.ts.map +1 -0
  30. package/dist/document-authoring/application/model/document-find.js +2 -0
  31. package/dist/document-authoring/application/model/document-find.js.map +1 -0
  32. package/dist/document-authoring/application/policies/document-catalog-diagnostics.d.ts +8 -0
  33. package/dist/document-authoring/application/policies/document-catalog-diagnostics.d.ts.map +1 -0
  34. package/dist/document-authoring/application/policies/document-catalog-diagnostics.js +44 -0
  35. package/dist/document-authoring/application/policies/document-catalog-diagnostics.js.map +1 -0
  36. package/dist/document-authoring/application/policies/document-catalog-fields.d.ts +18 -0
  37. package/dist/document-authoring/application/policies/document-catalog-fields.d.ts.map +1 -0
  38. package/dist/document-authoring/application/policies/document-catalog-fields.js +62 -0
  39. package/dist/document-authoring/application/policies/document-catalog-fields.js.map +1 -0
  40. package/dist/document-authoring/application/policies/document-repository-path.d.ts +2 -0
  41. package/dist/document-authoring/application/policies/document-repository-path.d.ts.map +1 -0
  42. package/dist/document-authoring/application/policies/document-repository-path.js +5 -0
  43. package/dist/document-authoring/application/policies/document-repository-path.js.map +1 -0
  44. package/dist/document-authoring/application/policies/inspect-catalog-document.d.ts +11 -0
  45. package/dist/document-authoring/application/policies/inspect-catalog-document.d.ts.map +1 -0
  46. package/dist/document-authoring/application/policies/inspect-catalog-document.js +78 -0
  47. package/dist/document-authoring/application/policies/inspect-catalog-document.js.map +1 -0
  48. package/dist/document-authoring/application/ports/authoring-profile-reader.d.ts +27 -0
  49. package/dist/document-authoring/application/ports/authoring-profile-reader.d.ts.map +1 -0
  50. package/dist/document-authoring/application/ports/authoring-profile-reader.js +2 -0
  51. package/dist/document-authoring/application/ports/authoring-profile-reader.js.map +1 -0
  52. package/dist/document-authoring/application/ports/documentation-search-catalog-reader.d.ts +10 -0
  53. package/dist/document-authoring/application/ports/documentation-search-catalog-reader.d.ts.map +1 -0
  54. package/dist/document-authoring/application/ports/documentation-search-catalog-reader.js +2 -0
  55. package/dist/document-authoring/application/ports/documentation-search-catalog-reader.js.map +1 -0
  56. package/dist/document-authoring/application/ports/metadata-instance-validator.d.ts +17 -0
  57. package/dist/document-authoring/application/ports/metadata-instance-validator.d.ts.map +1 -0
  58. package/dist/document-authoring/application/ports/metadata-instance-validator.js +2 -0
  59. package/dist/document-authoring/application/ports/metadata-instance-validator.js.map +1 -0
  60. package/dist/document-authoring/application/ports/owner-membership-reader.d.ts +14 -0
  61. package/dist/document-authoring/application/ports/owner-membership-reader.d.ts.map +1 -0
  62. package/dist/document-authoring/application/ports/owner-membership-reader.js +2 -0
  63. package/dist/document-authoring/application/ports/owner-membership-reader.js.map +1 -0
  64. package/dist/document-authoring/application/projections/document-catalog-projections.d.ts +3 -0
  65. package/dist/document-authoring/application/projections/document-catalog-projections.d.ts.map +1 -0
  66. package/dist/document-authoring/application/projections/document-catalog-projections.js +24 -0
  67. package/dist/document-authoring/application/projections/document-catalog-projections.js.map +1 -0
  68. package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts +23 -0
  69. package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts.map +1 -0
  70. package/dist/document-authoring/application/use-cases/build-documentation-catalog.js +204 -0
  71. package/dist/document-authoring/application/use-cases/build-documentation-catalog.js.map +1 -0
  72. package/dist/document-authoring/application/use-cases/find-documents.d.ts +14 -0
  73. package/dist/document-authoring/application/use-cases/find-documents.d.ts.map +1 -0
  74. package/dist/document-authoring/application/use-cases/find-documents.js +95 -0
  75. package/dist/document-authoring/application/use-cases/find-documents.js.map +1 -0
  76. package/dist/document-authoring/document-catalog-error.d.ts +6 -0
  77. package/dist/document-authoring/document-catalog-error.d.ts.map +1 -0
  78. package/dist/document-authoring/document-catalog-error.js +9 -0
  79. package/dist/document-authoring/document-catalog-error.js.map +1 -0
  80. package/dist/document-authoring/find-command.d.ts +37 -0
  81. package/dist/document-authoring/find-command.d.ts.map +1 -0
  82. package/dist/document-authoring/find-command.js +180 -0
  83. package/dist/document-authoring/find-command.js.map +1 -0
  84. package/dist/document-authoring/index.d.ts +12 -0
  85. package/dist/document-authoring/index.d.ts.map +1 -0
  86. package/dist/document-authoring/index.js +27 -0
  87. package/dist/document-authoring/index.js.map +1 -0
  88. package/dist/document-command.d.ts +3 -0
  89. package/dist/document-command.d.ts.map +1 -0
  90. package/dist/document-command.js +44 -0
  91. package/dist/document-command.js.map +1 -0
  92. package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.d.ts +3 -0
  93. package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.d.ts.map +1 -1
  94. package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.js +18 -1
  95. package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.js.map +1 -1
  96. package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.d.ts.map +1 -1
  97. package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.js +29 -2
  98. package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.js.map +1 -1
  99. package/dist/documentation-observation/application/model/markdown-document.d.ts +1 -1
  100. package/dist/documentation-observation/application/model/markdown-document.d.ts.map +1 -1
  101. package/dist/documentation-observation/application/model/markdown-document.js.map +1 -1
  102. package/dist/documentation-observation/application/ports/markdown-repository.d.ts +1 -0
  103. package/dist/documentation-observation/application/ports/markdown-repository.d.ts.map +1 -1
  104. package/dist/package-self-check.d.ts +1 -1
  105. package/dist/package-self-check.d.ts.map +1 -1
  106. package/dist/package-self-check.js +37 -23
  107. package/dist/package-self-check.js.map +1 -1
  108. package/dist/public-api-surface.d.ts +1 -0
  109. package/dist/public-api-surface.d.ts.map +1 -1
  110. package/dist/public-api-surface.js +1 -0
  111. package/dist/public-api-surface.js.map +1 -1
  112. package/dist/schema-catalog.d.ts.map +1 -1
  113. package/dist/schema-catalog.js +12 -2
  114. package/dist/schema-catalog.js.map +1 -1
  115. package/dist/schema-ids.d.ts +1 -1
  116. package/dist/schema-ids.d.ts.map +1 -1
  117. package/dist/schema-ids.js +6 -0
  118. package/dist/schema-ids.js.map +1 -1
  119. package/package.json +11 -1
  120. package/schemas/document-authoring-profile/v1.schema.json +186 -0
  121. package/schemas/document-command-envelope/v1.schema.json +161 -0
  122. package/schemas/document-intent/v1.schema.json +60 -0
  123. package/schemas/document-plan/v1.schema.json +146 -0
  124. package/schemas/document-receipt/v1.schema.json +141 -0
  125. package/schemas/foundation-transaction-envelope/v2.schema.json +106 -0
  126. package/schemas/quality-executable-specification-catalog/v1.schema.json +1 -1
@@ -0,0 +1,60 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-teams.ai/schemas/document-intent/v1",
4
+ "title": "Document Intent",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "type", "id", "title", "owner", "summary"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "type": { "$ref": "#/$defs/lowerId" },
11
+ "id": { "$ref": "#/$defs/opaqueId" },
12
+ "title": { "$ref": "#/$defs/title" },
13
+ "owner": { "$ref": "#/$defs/opaqueId" },
14
+ "summary": { "type": "string", "minLength": 1, "maxLength": 1000 },
15
+ "related": {
16
+ "type": "array",
17
+ "maxItems": 128,
18
+ "uniqueItems": true,
19
+ "items": { "$ref": "#/$defs/opaqueId" }
20
+ },
21
+ "additionalMetadata": { "$ref": "#/$defs/jsonObject1" }
22
+ },
23
+ "$defs": {
24
+ "lowerId": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^[a-z0-9][a-z0-9._/-]*$" },
25
+ "opaqueId": { "type": "string", "minLength": 1, "maxLength": 214, "pattern": "^[A-Za-z0-9@][A-Za-z0-9@._/-]*$" },
26
+ "title": { "type": "string", "minLength": 1, "maxLength": 240, "pattern": "^[^\\u0000-\\u001F\\u007F]+$" },
27
+ "jsonScalar": {
28
+ "oneOf": [
29
+ { "type": "null" },
30
+ { "type": "boolean" },
31
+ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 },
32
+ { "type": "string", "maxLength": 4096 }
33
+ ]
34
+ },
35
+ "jsonObject1": { "type": "object", "maxProperties": 64, "additionalProperties": { "$ref": "#/$defs/jsonValue1" } },
36
+ "jsonValue1": {
37
+ "oneOf": [
38
+ { "$ref": "#/$defs/jsonScalar" },
39
+ { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/jsonValue2" } },
40
+ { "$ref": "#/$defs/jsonObject2" }
41
+ ]
42
+ },
43
+ "jsonObject2": { "type": "object", "maxProperties": 64, "additionalProperties": { "$ref": "#/$defs/jsonValue2" } },
44
+ "jsonValue2": {
45
+ "oneOf": [
46
+ { "$ref": "#/$defs/jsonScalar" },
47
+ { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/jsonValue3" } },
48
+ { "$ref": "#/$defs/jsonObject3" }
49
+ ]
50
+ },
51
+ "jsonObject3": { "type": "object", "maxProperties": 64, "additionalProperties": { "$ref": "#/$defs/jsonValue3" } },
52
+ "jsonValue3": {
53
+ "oneOf": [
54
+ { "$ref": "#/$defs/jsonScalar" },
55
+ { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/jsonScalar" } },
56
+ { "type": "object", "maxProperties": 64, "additionalProperties": { "$ref": "#/$defs/jsonScalar" } }
57
+ ]
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,146 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-teams.ai/schemas/document-plan/v1",
4
+ "title": "Document Plan",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "protocolVersion", "compiler", "projectId", "intent", "intentDigest", "authority", "selectedOwner", "identityProjection", "referencedDocuments", "destination", "expectedParent", "destinationPrecondition", "output", "requiredAdapterCapabilities", "diagnostics", "planDigest"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "protocolVersion": { "const": 1 },
11
+ "compiler": { "$ref": "#/$defs/compiler" },
12
+ "projectId": { "$ref": "#/$defs/lowerId" },
13
+ "intent": { "$ref": "https://agent-teams.ai/schemas/document-intent/v1" },
14
+ "intentDigest": { "$ref": "#/$defs/digest" },
15
+ "authority": { "$ref": "#/$defs/authority" },
16
+ "selectedOwner": { "$ref": "#/$defs/selectedOwner" },
17
+ "identityProjection": { "$ref": "#/$defs/identityProjection" },
18
+ "referencedDocuments": {
19
+ "type": "array",
20
+ "maxItems": 128,
21
+ "items": { "$ref": "#/$defs/referencedDocument" }
22
+ },
23
+ "destination": { "$ref": "#/$defs/repositoryPath" },
24
+ "expectedParent": { "$ref": "#/$defs/expectedParent" },
25
+ "destinationPrecondition": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "required": ["state"],
29
+ "properties": { "state": { "const": "absent" } }
30
+ },
31
+ "output": { "$ref": "#/$defs/output" },
32
+ "requiredAdapterCapabilities": {
33
+ "type": "array",
34
+ "prefixItems": [{ "const": "create-file-no-replace/v1" }],
35
+ "minItems": 1,
36
+ "maxItems": 1
37
+ },
38
+ "diagnostics": { "type": "array", "maxItems": 256, "items": { "$ref": "#/$defs/diagnostic" } },
39
+ "planDigest": { "$ref": "#/$defs/digest" }
40
+ },
41
+ "$defs": {
42
+ "lowerId": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^[a-z0-9][a-z0-9._/-]*$" },
43
+ "opaqueId": { "type": "string", "minLength": 1, "maxLength": 214, "pattern": "^[A-Za-z0-9@][A-Za-z0-9@._/-]*$" },
44
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
45
+ "semver": { "type": "string", "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$" },
46
+ "repositoryPath": {
47
+ "type": "string",
48
+ "minLength": 1,
49
+ "maxLength": 512,
50
+ "pattern": "^(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\.(?:/|$))(?!.*(?:^|/)(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|[Cc][Oo][Mm][1-9]|[Ll][Pp][Tt][1-9])(?:\\.[A-Za-z0-9._@-]*)?(?:/|$))[A-Za-z0-9._@-]+(?:/[A-Za-z0-9._@-]+)*$"
51
+ },
52
+ "compiler": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["id", "version", "buildIdentity"],
56
+ "properties": {
57
+ "id": { "const": "@agent-teams/engineering-foundation" },
58
+ "version": { "$ref": "#/$defs/semver" },
59
+ "buildIdentity": { "$ref": "#/$defs/digest" }
60
+ }
61
+ },
62
+ "authoritySource": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": ["path", "digest", "size"],
66
+ "properties": {
67
+ "path": { "$ref": "#/$defs/repositoryPath" },
68
+ "digest": { "$ref": "#/$defs/digest" },
69
+ "size": { "type": "integer", "minimum": 1, "maximum": 4194304 }
70
+ }
71
+ },
72
+ "authority": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "required": ["profile", "metadataSchema", "ownerCatalog", "template"],
76
+ "properties": {
77
+ "profile": { "$ref": "#/$defs/authoritySource" },
78
+ "metadataSchema": { "$ref": "#/$defs/authoritySource" },
79
+ "ownerCatalog": { "$ref": "#/$defs/authoritySource" },
80
+ "template": { "$ref": "#/$defs/authoritySource" }
81
+ }
82
+ },
83
+ "selectedOwner": {
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "required": ["id", "membershipDigest"],
87
+ "properties": {
88
+ "id": { "$ref": "#/$defs/opaqueId" },
89
+ "membershipDigest": { "$ref": "#/$defs/digest" }
90
+ }
91
+ },
92
+ "identityProjection": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": ["entryCount", "digest"],
96
+ "properties": {
97
+ "entryCount": { "type": "integer", "minimum": 0, "maximum": 100000 },
98
+ "digest": { "$ref": "#/$defs/digest" }
99
+ }
100
+ },
101
+ "referencedDocument": {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "required": ["id", "path", "projectionDigest"],
105
+ "properties": {
106
+ "id": { "$ref": "#/$defs/opaqueId" },
107
+ "path": { "$ref": "#/$defs/repositoryPath" },
108
+ "projectionDigest": { "$ref": "#/$defs/digest" }
109
+ }
110
+ },
111
+ "expectedParent": {
112
+ "type": "object",
113
+ "additionalProperties": false,
114
+ "required": ["path", "state", "ancestry"],
115
+ "properties": {
116
+ "path": { "$ref": "#/$defs/repositoryPath" },
117
+ "state": { "const": "directory" },
118
+ "ancestry": { "const": "real-directories" }
119
+ }
120
+ },
121
+ "output": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "required": ["digest", "size", "mode", "mediaType", "contentBase64"],
125
+ "properties": {
126
+ "digest": { "$ref": "#/$defs/digest" },
127
+ "size": { "type": "integer", "minimum": 1, "maximum": 1048576 },
128
+ "mode": { "const": "0644" },
129
+ "mediaType": { "const": "text/markdown; charset=utf-8" },
130
+ "contentBase64": { "type": "string", "minLength": 4, "maxLength": 1398104, "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" }
131
+ }
132
+ },
133
+ "diagnostic": {
134
+ "type": "object",
135
+ "additionalProperties": false,
136
+ "required": ["ruleId", "severity", "phase", "subject", "message"],
137
+ "properties": {
138
+ "ruleId": { "$ref": "#/$defs/opaqueId" },
139
+ "severity": { "enum": ["error", "info", "warning"] },
140
+ "phase": { "enum": ["authority", "input", "planning", "policy"] },
141
+ "subject": { "type": "string", "minLength": 1, "maxLength": 512 },
142
+ "message": { "type": "string", "minLength": 1, "maxLength": 1000 }
143
+ }
144
+ }
145
+ }
146
+ }
@@ -0,0 +1,141 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-teams.ai/schemas/document-receipt/v1",
4
+ "title": "Document Receipt",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "protocolVersion", "planDigest", "adapter", "destination", "outcome", "commit", "diagnostics", "receiptDigest"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "protocolVersion": { "const": 1 },
11
+ "planDigest": { "$ref": "#/$defs/digest" },
12
+ "adapter": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["id", "contractVersion"],
16
+ "properties": {
17
+ "id": { "const": "foundation.filesystem/v1" },
18
+ "contractVersion": { "const": 1 }
19
+ }
20
+ },
21
+ "destination": { "$ref": "#/$defs/repositoryPath" },
22
+ "outcome": { "enum": ["applied", "already-applied", "authority-stale", "rejected", "recovery-required", "manual-recovery-required", "failed-before-publication", "cancelled"] },
23
+ "resultDigest": { "$ref": "#/$defs/digest" },
24
+ "commit": { "$ref": "#/$defs/commitObservation" },
25
+ "diagnostics": { "type": "array", "maxItems": 256, "items": { "$ref": "#/$defs/diagnostic" } },
26
+ "receiptDigest": { "$ref": "#/$defs/digest" }
27
+ },
28
+ "allOf": [
29
+ { "$ref": "#/$defs/appliedContract" },
30
+ { "$ref": "#/$defs/alreadyAppliedContract" },
31
+ { "$ref": "#/$defs/noResultContract" },
32
+ { "$ref": "#/$defs/recoveryContract" }
33
+ ],
34
+ "$defs": {
35
+ "opaqueId": { "type": "string", "minLength": 1, "maxLength": 214, "pattern": "^[A-Za-z0-9@][A-Za-z0-9@._/-]*$" },
36
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
37
+ "repositoryPath": {
38
+ "type": "string",
39
+ "minLength": 1,
40
+ "maxLength": 512,
41
+ "pattern": "^(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\.(?:/|$))(?!.*(?:^|/)(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|[Cc][Oo][Mm][1-9]|[Ll][Pp][Tt][1-9])(?:\\.[A-Za-z0-9._@-]*)?(?:/|$))[A-Za-z0-9._@-]+(?:/[A-Za-z0-9._@-]+)*$"
42
+ },
43
+ "commitObservation": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": ["state", "publication", "atomicity", "recoverability"],
47
+ "properties": {
48
+ "state": { "enum": ["committed", "not-published", "preserved", "recovery-required", "manual-recovery-required"] },
49
+ "publication": { "enum": ["none", "preexisting-exact", "published", "unknown"] },
50
+ "atomicity": { "enum": ["not-applicable", "single-file-atomic-create"] },
51
+ "recoverability": { "enum": ["not-required", "journaled-recoverable", "preserved-for-recovery"] }
52
+ }
53
+ },
54
+ "appliedContract": {
55
+ "if": { "type": "object", "properties": { "outcome": { "const": "applied" } }, "required": ["outcome"] },
56
+ "then": {
57
+ "type": "object",
58
+ "required": ["resultDigest"],
59
+ "properties": {
60
+ "resultDigest": { "$ref": "#/$defs/digest" },
61
+ "commit": {
62
+ "type": "object",
63
+ "properties": {
64
+ "state": { "const": "committed" },
65
+ "publication": { "const": "published" },
66
+ "atomicity": { "const": "single-file-atomic-create" },
67
+ "recoverability": { "const": "not-required" }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "alreadyAppliedContract": {
74
+ "if": { "type": "object", "properties": { "outcome": { "const": "already-applied" } }, "required": ["outcome"] },
75
+ "then": {
76
+ "type": "object",
77
+ "required": ["resultDigest"],
78
+ "properties": {
79
+ "resultDigest": { "$ref": "#/$defs/digest" },
80
+ "commit": {
81
+ "type": "object",
82
+ "properties": {
83
+ "state": { "const": "committed" },
84
+ "publication": { "const": "preexisting-exact" },
85
+ "atomicity": { "const": "not-applicable" },
86
+ "recoverability": { "const": "not-required" }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ },
92
+ "noResultContract": {
93
+ "if": { "type": "object", "properties": { "outcome": { "enum": ["authority-stale", "rejected", "failed-before-publication", "cancelled"] } }, "required": ["outcome"] },
94
+ "then": {
95
+ "type": "object",
96
+ "properties": {
97
+ "resultDigest": false,
98
+ "commit": {
99
+ "type": "object",
100
+ "properties": {
101
+ "state": { "const": "not-published" },
102
+ "publication": { "const": "none" },
103
+ "atomicity": { "const": "not-applicable" },
104
+ "recoverability": { "const": "not-required" }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ },
110
+ "recoveryContract": {
111
+ "if": { "type": "object", "properties": { "outcome": { "enum": ["recovery-required", "manual-recovery-required"] } }, "required": ["outcome"] },
112
+ "then": {
113
+ "type": "object",
114
+ "properties": {
115
+ "resultDigest": false,
116
+ "commit": {
117
+ "type": "object",
118
+ "properties": {
119
+ "state": { "enum": ["preserved", "recovery-required", "manual-recovery-required"] },
120
+ "publication": { "enum": ["none", "published", "unknown"] },
121
+ "atomicity": { "enum": ["not-applicable", "single-file-atomic-create"] },
122
+ "recoverability": { "const": "preserved-for-recovery" }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ },
128
+ "diagnostic": {
129
+ "type": "object",
130
+ "additionalProperties": false,
131
+ "required": ["ruleId", "severity", "phase", "subject", "message"],
132
+ "properties": {
133
+ "ruleId": { "$ref": "#/$defs/opaqueId" },
134
+ "severity": { "enum": ["error", "info", "warning"] },
135
+ "phase": { "enum": ["apply", "authority", "input", "recovery"] },
136
+ "subject": { "type": "string", "minLength": 1, "maxLength": 512 },
137
+ "message": { "type": "string", "minLength": 1, "maxLength": 1000 }
138
+ }
139
+ }
140
+ }
141
+ }
@@ -0,0 +1,106 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-teams.ai/schemas/foundation-transaction-envelope/v2",
4
+ "title": "Foundation Transaction Envelope",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "operationKind", "recoveryHandler", "foundation", "adapterContractVersion", "payloadKind", "journal", "payloadDigest", "state", "envelopeDigest"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 2 },
10
+ "operationKind": { "enum": ["document-authoring", "scaffolding"] },
11
+ "recoveryHandler": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": ["id", "contractVersion"],
15
+ "properties": {
16
+ "id": { "enum": ["foundation.document-authoring", "foundation.scaffolding"] },
17
+ "contractVersion": { "const": 1 }
18
+ }
19
+ },
20
+ "foundation": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "required": ["version", "buildIdentity"],
24
+ "properties": {
25
+ "version": { "$ref": "#/$defs/semver" },
26
+ "buildIdentity": { "$ref": "#/$defs/digest" }
27
+ }
28
+ },
29
+ "adapterContractVersion": { "const": 1 },
30
+ "payloadKind": { "enum": ["document-authoring-journal/v1", "scaffold-recovery-journal/v1"] },
31
+ "journal": {},
32
+ "payloadDigest": { "$ref": "#/$defs/digest" },
33
+ "state": { "enum": ["PREPARED", "PUBLISHING", "PUBLISHED"] },
34
+ "envelopeDigest": { "$ref": "#/$defs/digest" }
35
+ },
36
+ "allOf": [
37
+ { "$ref": "#/$defs/documentAuthoringEnvelope" },
38
+ { "$ref": "#/$defs/scaffoldingEnvelope" }
39
+ ],
40
+ "$defs": {
41
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
42
+ "semver": { "type": "string", "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$" },
43
+ "repositoryPath": {
44
+ "type": "string",
45
+ "minLength": 1,
46
+ "maxLength": 512,
47
+ "pattern": "^(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\.(?:/|$))(?!.*(?:^|/)(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|[Cc][Oo][Mm][1-9]|[Ll][Pp][Tt][1-9])(?:\\.[A-Za-z0-9._@-]*)?(?:/|$))[A-Za-z0-9._@-]+(?:/[A-Za-z0-9._@-]+)*$"
48
+ },
49
+ "documentJournal": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["schemaVersion", "plan", "destination"],
53
+ "properties": {
54
+ "schemaVersion": { "const": 1 },
55
+ "plan": { "$ref": "https://agent-teams.ai/schemas/document-plan/v1" },
56
+ "destination": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": ["path", "state"],
60
+ "properties": {
61
+ "path": { "$ref": "#/$defs/repositoryPath" },
62
+ "state": { "enum": ["pending", "preexisting", "publishing", "published"] }
63
+ }
64
+ },
65
+ "ownedTemporary": {
66
+ "type": "object",
67
+ "additionalProperties": false,
68
+ "required": ["path", "digest"],
69
+ "properties": {
70
+ "path": { "$ref": "#/$defs/repositoryPath" },
71
+ "digest": { "$ref": "#/$defs/digest" }
72
+ }
73
+ }
74
+ }
75
+ },
76
+ "documentAuthoringEnvelope": {
77
+ "if": { "type": "object", "properties": { "operationKind": { "const": "document-authoring" } }, "required": ["operationKind"] },
78
+ "then": {
79
+ "type": "object",
80
+ "properties": {
81
+ "recoveryHandler": {
82
+ "type": "object",
83
+ "properties": { "id": { "const": "foundation.document-authoring" } }
84
+ },
85
+ "payloadKind": { "const": "document-authoring-journal/v1" },
86
+ "journal": { "$ref": "#/$defs/documentJournal" }
87
+ }
88
+ }
89
+ },
90
+ "scaffoldingEnvelope": {
91
+ "if": { "type": "object", "properties": { "operationKind": { "const": "scaffolding" } }, "required": ["operationKind"] },
92
+ "then": {
93
+ "type": "object",
94
+ "properties": {
95
+ "recoveryHandler": {
96
+ "type": "object",
97
+ "properties": { "id": { "const": "foundation.scaffolding" } }
98
+ },
99
+ "payloadKind": { "const": "scaffold-recovery-journal/v1" },
100
+ "journal": { "$ref": "https://agent-teams.ai/schemas/scaffold-recovery-journal/v1" },
101
+ "state": { "const": "PREPARED" }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
@@ -92,7 +92,7 @@
92
92
  "kind": { "const": "xstate" },
93
93
  "axes": {
94
94
  "type": "array",
95
- "minItems": 2,
95
+ "description": "A possibly empty list of opaque consumer-owned topology identifiers; Foundation does not infer their semantics or independence.",
96
96
  "maxItems": 32,
97
97
  "uniqueItems": true,
98
98
  "items": { "$ref": "#/$defs/identifier" }