@originals/sdk 1.4.3 → 1.5.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 (222) hide show
  1. package/dist/adapters/FeeOracleMock.d.ts +6 -0
  2. package/dist/adapters/FeeOracleMock.js +8 -0
  3. package/dist/adapters/index.d.ts +4 -0
  4. package/dist/adapters/index.js +4 -0
  5. package/dist/adapters/providers/OrdHttpProvider.d.ts +56 -0
  6. package/dist/adapters/providers/OrdHttpProvider.js +110 -0
  7. package/dist/adapters/providers/OrdMockProvider.d.ts +70 -0
  8. package/dist/adapters/providers/OrdMockProvider.js +75 -0
  9. package/dist/adapters/types.d.ts +71 -0
  10. package/dist/adapters/types.js +1 -0
  11. package/dist/bitcoin/BitcoinManager.d.ts +15 -0
  12. package/dist/bitcoin/BitcoinManager.js +262 -0
  13. package/dist/bitcoin/BroadcastClient.d.ts +30 -0
  14. package/dist/bitcoin/BroadcastClient.js +35 -0
  15. package/dist/bitcoin/OrdinalsClient.d.ts +21 -0
  16. package/dist/bitcoin/OrdinalsClient.js +105 -0
  17. package/dist/bitcoin/PSBTBuilder.d.ts +24 -0
  18. package/dist/bitcoin/PSBTBuilder.js +80 -0
  19. package/dist/bitcoin/fee-calculation.d.ts +14 -0
  20. package/dist/bitcoin/fee-calculation.js +31 -0
  21. package/dist/bitcoin/providers/OrdNodeProvider.d.ts +38 -0
  22. package/dist/bitcoin/providers/OrdNodeProvider.js +67 -0
  23. package/dist/bitcoin/providers/OrdinalsProvider.d.ts +33 -0
  24. package/dist/bitcoin/providers/OrdinalsProvider.js +50 -0
  25. package/dist/bitcoin/providers/types.d.ts +63 -0
  26. package/dist/bitcoin/providers/types.js +1 -0
  27. package/dist/bitcoin/transactions/commit.d.ts +89 -0
  28. package/dist/bitcoin/transactions/commit.js +311 -0
  29. package/dist/bitcoin/transactions/index.d.ts +7 -0
  30. package/dist/bitcoin/transactions/index.js +8 -0
  31. package/dist/bitcoin/transfer.d.ts +9 -0
  32. package/dist/bitcoin/transfer.js +26 -0
  33. package/dist/bitcoin/utxo-selection.d.ts +78 -0
  34. package/dist/bitcoin/utxo-selection.js +237 -0
  35. package/dist/bitcoin/utxo.d.ts +26 -0
  36. package/dist/bitcoin/utxo.js +78 -0
  37. package/dist/contexts/credentials-v1.json +195 -0
  38. package/dist/contexts/credentials-v2-examples.json +5 -0
  39. package/dist/contexts/credentials-v2.json +301 -0
  40. package/dist/contexts/credentials.json +195 -0
  41. package/dist/contexts/data-integrity-v2.json +81 -0
  42. package/dist/contexts/dids.json +57 -0
  43. package/dist/contexts/ed255192020.json +93 -0
  44. package/dist/contexts/ordinals-plus.json +23 -0
  45. package/dist/contexts/originals.json +22 -0
  46. package/dist/core/OriginalsSDK.d.ts +158 -0
  47. package/dist/core/OriginalsSDK.js +274 -0
  48. package/dist/crypto/Multikey.d.ts +30 -0
  49. package/dist/crypto/Multikey.js +149 -0
  50. package/dist/crypto/Signer.d.ts +21 -0
  51. package/dist/crypto/Signer.js +196 -0
  52. package/dist/crypto/noble-init.d.ts +18 -0
  53. package/dist/crypto/noble-init.js +106 -0
  54. package/dist/did/BtcoDidResolver.d.ts +57 -0
  55. package/dist/did/BtcoDidResolver.js +166 -0
  56. package/dist/did/DIDManager.d.ts +101 -0
  57. package/dist/did/DIDManager.js +493 -0
  58. package/dist/did/Ed25519Verifier.d.ts +30 -0
  59. package/dist/did/Ed25519Verifier.js +59 -0
  60. package/dist/did/KeyManager.d.ts +17 -0
  61. package/dist/did/KeyManager.js +207 -0
  62. package/dist/did/WebVHManager.d.ts +100 -0
  63. package/dist/did/WebVHManager.js +312 -0
  64. package/dist/did/createBtcoDidDocument.d.ts +10 -0
  65. package/dist/did/createBtcoDidDocument.js +42 -0
  66. package/dist/did/providers/OrdinalsClientProviderAdapter.d.ts +23 -0
  67. package/dist/did/providers/OrdinalsClientProviderAdapter.js +51 -0
  68. package/dist/events/EventEmitter.d.ts +115 -0
  69. package/dist/events/EventEmitter.js +198 -0
  70. package/dist/events/index.d.ts +7 -0
  71. package/dist/events/index.js +6 -0
  72. package/dist/events/types.d.ts +286 -0
  73. package/dist/events/types.js +9 -0
  74. package/dist/examples/basic-usage.d.ts +3 -0
  75. package/dist/examples/basic-usage.js +62 -0
  76. package/dist/examples/create-module-original.d.ts +32 -0
  77. package/dist/examples/create-module-original.js +376 -0
  78. package/dist/examples/full-lifecycle-flow.d.ts +56 -0
  79. package/dist/examples/full-lifecycle-flow.js +419 -0
  80. package/dist/examples/run.d.ts +12 -0
  81. package/dist/examples/run.js +51 -0
  82. package/dist/index.d.ts +43 -0
  83. package/dist/index.js +52 -0
  84. package/dist/kinds/KindRegistry.d.ts +76 -0
  85. package/dist/kinds/KindRegistry.js +216 -0
  86. package/dist/kinds/index.d.ts +33 -0
  87. package/dist/kinds/index.js +36 -0
  88. package/dist/kinds/types.d.ts +363 -0
  89. package/dist/kinds/types.js +25 -0
  90. package/dist/kinds/validators/AgentValidator.d.ts +14 -0
  91. package/dist/kinds/validators/AgentValidator.js +155 -0
  92. package/dist/kinds/validators/AppValidator.d.ts +14 -0
  93. package/dist/kinds/validators/AppValidator.js +135 -0
  94. package/dist/kinds/validators/DatasetValidator.d.ts +14 -0
  95. package/dist/kinds/validators/DatasetValidator.js +148 -0
  96. package/dist/kinds/validators/DocumentValidator.d.ts +14 -0
  97. package/dist/kinds/validators/DocumentValidator.js +180 -0
  98. package/dist/kinds/validators/MediaValidator.d.ts +14 -0
  99. package/dist/kinds/validators/MediaValidator.js +172 -0
  100. package/dist/kinds/validators/ModuleValidator.d.ts +14 -0
  101. package/dist/kinds/validators/ModuleValidator.js +140 -0
  102. package/dist/kinds/validators/base.d.ts +96 -0
  103. package/dist/kinds/validators/base.js +218 -0
  104. package/dist/kinds/validators/index.d.ts +10 -0
  105. package/dist/kinds/validators/index.js +10 -0
  106. package/dist/lifecycle/BatchOperations.d.ts +147 -0
  107. package/dist/lifecycle/BatchOperations.js +251 -0
  108. package/dist/lifecycle/LifecycleManager.d.ts +362 -0
  109. package/dist/lifecycle/LifecycleManager.js +1692 -0
  110. package/dist/lifecycle/OriginalsAsset.d.ts +164 -0
  111. package/dist/lifecycle/OriginalsAsset.js +380 -0
  112. package/dist/lifecycle/ProvenanceQuery.d.ts +126 -0
  113. package/dist/lifecycle/ProvenanceQuery.js +220 -0
  114. package/dist/lifecycle/ResourceVersioning.d.ts +73 -0
  115. package/dist/lifecycle/ResourceVersioning.js +127 -0
  116. package/dist/migration/MigrationManager.d.ts +86 -0
  117. package/dist/migration/MigrationManager.js +412 -0
  118. package/dist/migration/audit/AuditLogger.d.ts +51 -0
  119. package/dist/migration/audit/AuditLogger.js +156 -0
  120. package/dist/migration/checkpoint/CheckpointManager.d.ts +31 -0
  121. package/dist/migration/checkpoint/CheckpointManager.js +96 -0
  122. package/dist/migration/checkpoint/CheckpointStorage.d.ts +26 -0
  123. package/dist/migration/checkpoint/CheckpointStorage.js +89 -0
  124. package/dist/migration/index.d.ts +22 -0
  125. package/dist/migration/index.js +27 -0
  126. package/dist/migration/operations/BaseMigration.d.ts +48 -0
  127. package/dist/migration/operations/BaseMigration.js +83 -0
  128. package/dist/migration/operations/PeerToBtcoMigration.d.ts +25 -0
  129. package/dist/migration/operations/PeerToBtcoMigration.js +67 -0
  130. package/dist/migration/operations/PeerToWebvhMigration.d.ts +19 -0
  131. package/dist/migration/operations/PeerToWebvhMigration.js +46 -0
  132. package/dist/migration/operations/WebvhToBtcoMigration.d.ts +25 -0
  133. package/dist/migration/operations/WebvhToBtcoMigration.js +67 -0
  134. package/dist/migration/rollback/RollbackManager.d.ts +29 -0
  135. package/dist/migration/rollback/RollbackManager.js +146 -0
  136. package/dist/migration/state/StateMachine.d.ts +25 -0
  137. package/dist/migration/state/StateMachine.js +76 -0
  138. package/dist/migration/state/StateTracker.d.ts +36 -0
  139. package/dist/migration/state/StateTracker.js +123 -0
  140. package/dist/migration/types.d.ts +306 -0
  141. package/dist/migration/types.js +33 -0
  142. package/dist/migration/validation/BitcoinValidator.d.ts +13 -0
  143. package/dist/migration/validation/BitcoinValidator.js +83 -0
  144. package/dist/migration/validation/CredentialValidator.d.ts +13 -0
  145. package/dist/migration/validation/CredentialValidator.js +46 -0
  146. package/dist/migration/validation/DIDCompatibilityValidator.d.ts +16 -0
  147. package/dist/migration/validation/DIDCompatibilityValidator.js +127 -0
  148. package/dist/migration/validation/LifecycleValidator.d.ts +10 -0
  149. package/dist/migration/validation/LifecycleValidator.js +52 -0
  150. package/dist/migration/validation/StorageValidator.d.ts +10 -0
  151. package/dist/migration/validation/StorageValidator.js +65 -0
  152. package/dist/migration/validation/ValidationPipeline.d.ts +29 -0
  153. package/dist/migration/validation/ValidationPipeline.js +180 -0
  154. package/dist/resources/ResourceManager.d.ts +231 -0
  155. package/dist/resources/ResourceManager.js +573 -0
  156. package/dist/resources/index.d.ts +11 -0
  157. package/dist/resources/index.js +10 -0
  158. package/dist/resources/types.d.ts +93 -0
  159. package/dist/resources/types.js +80 -0
  160. package/dist/storage/LocalStorageAdapter.d.ts +11 -0
  161. package/dist/storage/LocalStorageAdapter.js +53 -0
  162. package/dist/storage/MemoryStorageAdapter.d.ts +6 -0
  163. package/dist/storage/MemoryStorageAdapter.js +21 -0
  164. package/dist/storage/StorageAdapter.d.ts +16 -0
  165. package/dist/storage/StorageAdapter.js +1 -0
  166. package/dist/storage/index.d.ts +2 -0
  167. package/dist/storage/index.js +2 -0
  168. package/dist/types/bitcoin.d.ts +84 -0
  169. package/dist/types/bitcoin.js +1 -0
  170. package/dist/types/common.d.ts +82 -0
  171. package/dist/types/common.js +1 -0
  172. package/dist/types/credentials.d.ts +75 -0
  173. package/dist/types/credentials.js +1 -0
  174. package/dist/types/did.d.ts +26 -0
  175. package/dist/types/did.js +1 -0
  176. package/dist/types/index.d.ts +5 -0
  177. package/dist/types/index.js +5 -0
  178. package/dist/types/network.d.ts +78 -0
  179. package/dist/types/network.js +145 -0
  180. package/dist/utils/EventLogger.d.ts +71 -0
  181. package/dist/utils/EventLogger.js +232 -0
  182. package/dist/utils/Logger.d.ts +106 -0
  183. package/dist/utils/Logger.js +257 -0
  184. package/dist/utils/MetricsCollector.d.ts +110 -0
  185. package/dist/utils/MetricsCollector.js +264 -0
  186. package/dist/utils/bitcoin-address.d.ts +38 -0
  187. package/dist/utils/bitcoin-address.js +113 -0
  188. package/dist/utils/cbor.d.ts +2 -0
  189. package/dist/utils/cbor.js +9 -0
  190. package/dist/utils/encoding.d.ts +37 -0
  191. package/dist/utils/encoding.js +120 -0
  192. package/dist/utils/hash.d.ts +1 -0
  193. package/dist/utils/hash.js +5 -0
  194. package/dist/utils/retry.d.ts +10 -0
  195. package/dist/utils/retry.js +35 -0
  196. package/dist/utils/satoshi-validation.d.ts +60 -0
  197. package/dist/utils/satoshi-validation.js +156 -0
  198. package/dist/utils/serialization.d.ts +14 -0
  199. package/dist/utils/serialization.js +76 -0
  200. package/dist/utils/telemetry.d.ts +17 -0
  201. package/dist/utils/telemetry.js +24 -0
  202. package/dist/utils/validation.d.ts +5 -0
  203. package/dist/utils/validation.js +98 -0
  204. package/dist/vc/CredentialManager.d.ts +329 -0
  205. package/dist/vc/CredentialManager.js +615 -0
  206. package/dist/vc/Issuer.d.ts +27 -0
  207. package/dist/vc/Issuer.js +70 -0
  208. package/dist/vc/Verifier.d.ts +16 -0
  209. package/dist/vc/Verifier.js +50 -0
  210. package/dist/vc/cryptosuites/bbs.d.ts +44 -0
  211. package/dist/vc/cryptosuites/bbs.js +213 -0
  212. package/dist/vc/cryptosuites/bbsSimple.d.ts +9 -0
  213. package/dist/vc/cryptosuites/bbsSimple.js +12 -0
  214. package/dist/vc/cryptosuites/eddsa.d.ts +30 -0
  215. package/dist/vc/cryptosuites/eddsa.js +81 -0
  216. package/dist/vc/documentLoader.d.ts +16 -0
  217. package/dist/vc/documentLoader.js +59 -0
  218. package/dist/vc/proofs/data-integrity.d.ts +21 -0
  219. package/dist/vc/proofs/data-integrity.js +15 -0
  220. package/dist/vc/utils/jsonld.d.ts +2 -0
  221. package/dist/vc/utils/jsonld.js +15 -0
  222. package/package.json +2 -1
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Agent Kind Validator
3
+ *
4
+ * Validates manifests for AI agents or autonomous systems with capabilities and model info.
5
+ */
6
+ import { OriginalKind } from '../types';
7
+ import { BaseKindValidator, ValidationUtils } from './base';
8
+ /**
9
+ * Known AI model providers
10
+ */
11
+ const KNOWN_PROVIDERS = [
12
+ 'openai', 'anthropic', 'google', 'meta', 'mistral', 'cohere',
13
+ 'huggingface', 'replicate', 'together', 'groq', 'perplexity',
14
+ 'fireworks', 'local', 'custom',
15
+ ];
16
+ /**
17
+ * Valid memory types
18
+ */
19
+ const VALID_MEMORY_TYPES = ['stateless', 'session', 'persistent'];
20
+ /**
21
+ * Validator for Agent Originals
22
+ */
23
+ export class AgentValidator extends BaseKindValidator {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.kind = OriginalKind.Agent;
27
+ }
28
+ validateKind(manifest) {
29
+ const errors = [];
30
+ const warnings = [];
31
+ const metadata = manifest.metadata;
32
+ // Validate metadata exists
33
+ if (!metadata || typeof metadata !== 'object') {
34
+ return ValidationUtils.failure([
35
+ ValidationUtils.error('MISSING_METADATA', 'Agent manifest must have metadata', 'metadata'),
36
+ ]);
37
+ }
38
+ // Validate capabilities (required)
39
+ if (!metadata.capabilities) {
40
+ errors.push(ValidationUtils.error('MISSING_CAPABILITIES', 'Agent must specify capabilities', 'metadata.capabilities'));
41
+ }
42
+ else if (!Array.isArray(metadata.capabilities)) {
43
+ errors.push(ValidationUtils.error('INVALID_CAPABILITIES', 'Capabilities must be an array of strings', 'metadata.capabilities'));
44
+ }
45
+ else if (metadata.capabilities.length === 0) {
46
+ errors.push(ValidationUtils.error('EMPTY_CAPABILITIES', 'Agent must have at least one capability', 'metadata.capabilities'));
47
+ }
48
+ else {
49
+ for (let i = 0; i < metadata.capabilities.length; i++) {
50
+ if (typeof metadata.capabilities[i] !== 'string') {
51
+ errors.push(ValidationUtils.error('INVALID_CAPABILITY', `Capability at index ${i} must be a string`, `metadata.capabilities[${i}]`));
52
+ }
53
+ else if (metadata.capabilities[i].length === 0) {
54
+ errors.push(ValidationUtils.error('EMPTY_CAPABILITY', `Capability at index ${i} cannot be empty`, `metadata.capabilities[${i}]`));
55
+ }
56
+ }
57
+ }
58
+ // Validate model if specified
59
+ if (metadata.model) {
60
+ if (typeof metadata.model !== 'object') {
61
+ errors.push(ValidationUtils.error('INVALID_MODEL', 'Model must be an object', 'metadata.model'));
62
+ }
63
+ else {
64
+ // Model name is required
65
+ if (!metadata.model.name || typeof metadata.model.name !== 'string') {
66
+ errors.push(ValidationUtils.error('MISSING_MODEL_NAME', 'Model must have a name', 'metadata.model.name'));
67
+ }
68
+ // Validate provider if specified
69
+ if (metadata.model.provider) {
70
+ const normalizedProvider = metadata.model.provider.toLowerCase();
71
+ if (!KNOWN_PROVIDERS.includes(normalizedProvider)) {
72
+ warnings.push(ValidationUtils.warning('UNKNOWN_PROVIDER', `Model provider "${metadata.model.provider}" is not a commonly recognized provider`, 'metadata.model.provider', `Consider using one of: ${KNOWN_PROVIDERS.join(', ')}`));
73
+ }
74
+ }
75
+ }
76
+ }
77
+ // Validate input/output types if specified
78
+ if (metadata.inputTypes) {
79
+ if (!Array.isArray(metadata.inputTypes)) {
80
+ errors.push(ValidationUtils.error('INVALID_INPUT_TYPES', 'Input types must be an array', 'metadata.inputTypes'));
81
+ }
82
+ }
83
+ if (metadata.outputTypes) {
84
+ if (!Array.isArray(metadata.outputTypes)) {
85
+ errors.push(ValidationUtils.error('INVALID_OUTPUT_TYPES', 'Output types must be an array', 'metadata.outputTypes'));
86
+ }
87
+ }
88
+ // Validate memory if specified
89
+ if (metadata.memory) {
90
+ if (typeof metadata.memory !== 'object') {
91
+ errors.push(ValidationUtils.error('INVALID_MEMORY', 'Memory must be an object', 'metadata.memory'));
92
+ }
93
+ else {
94
+ if (!metadata.memory.type || !VALID_MEMORY_TYPES.includes(metadata.memory.type)) {
95
+ errors.push(ValidationUtils.error('INVALID_MEMORY_TYPE', `Memory type must be one of: ${VALID_MEMORY_TYPES.join(', ')}`, 'metadata.memory.type', metadata.memory.type));
96
+ }
97
+ if (metadata.memory.maxSize !== undefined &&
98
+ (typeof metadata.memory.maxSize !== 'number' || metadata.memory.maxSize <= 0)) {
99
+ errors.push(ValidationUtils.error('INVALID_MEMORY_SIZE', 'Memory maxSize must be a positive number', 'metadata.memory.maxSize'));
100
+ }
101
+ }
102
+ }
103
+ // Validate tools if specified
104
+ if (metadata.tools) {
105
+ if (!Array.isArray(metadata.tools)) {
106
+ errors.push(ValidationUtils.error('INVALID_TOOLS', 'Tools must be an array', 'metadata.tools'));
107
+ }
108
+ else {
109
+ for (let i = 0; i < metadata.tools.length; i++) {
110
+ const tool = metadata.tools[i];
111
+ const toolPath = `metadata.tools[${i}]`;
112
+ if (!tool || typeof tool !== 'object') {
113
+ errors.push(ValidationUtils.error('INVALID_TOOL', `Tool at index ${i} must be an object`, toolPath));
114
+ continue;
115
+ }
116
+ if (!tool.name || typeof tool.name !== 'string') {
117
+ errors.push(ValidationUtils.error('MISSING_TOOL_NAME', `Tool at index ${i} must have a name`, `${toolPath}.name`));
118
+ }
119
+ if (!tool.description || typeof tool.description !== 'string') {
120
+ warnings.push(ValidationUtils.warning('MISSING_TOOL_DESC', `Tool "${tool.name || i}" should have a description`, `${toolPath}.description`));
121
+ }
122
+ }
123
+ }
124
+ }
125
+ // Validate rate limits if specified
126
+ if (metadata.rateLimit) {
127
+ if (typeof metadata.rateLimit !== 'object') {
128
+ errors.push(ValidationUtils.error('INVALID_RATE_LIMIT', 'Rate limit must be an object', 'metadata.rateLimit'));
129
+ }
130
+ else {
131
+ if (metadata.rateLimit.requestsPerMinute !== undefined &&
132
+ (typeof metadata.rateLimit.requestsPerMinute !== 'number' ||
133
+ metadata.rateLimit.requestsPerMinute <= 0)) {
134
+ errors.push(ValidationUtils.error('INVALID_RPM', 'requestsPerMinute must be a positive number', 'metadata.rateLimit.requestsPerMinute'));
135
+ }
136
+ if (metadata.rateLimit.tokensPerMinute !== undefined &&
137
+ (typeof metadata.rateLimit.tokensPerMinute !== 'number' ||
138
+ metadata.rateLimit.tokensPerMinute <= 0)) {
139
+ errors.push(ValidationUtils.error('INVALID_TPM', 'tokensPerMinute must be a positive number', 'metadata.rateLimit.tokensPerMinute'));
140
+ }
141
+ }
142
+ }
143
+ // Suggest adding model info for AI agents
144
+ if (!metadata.model) {
145
+ warnings.push(ValidationUtils.warning('MISSING_MODEL', 'Consider adding model information if this is an AI-based agent', 'metadata.model'));
146
+ }
147
+ // Suggest adding system prompt
148
+ if (!metadata.systemPrompt) {
149
+ warnings.push(ValidationUtils.warning('MISSING_SYSTEM_PROMPT', 'Consider adding a system prompt to define the agent\'s behavior', 'metadata.systemPrompt'));
150
+ }
151
+ return errors.length > 0
152
+ ? ValidationUtils.failure(errors, warnings)
153
+ : ValidationUtils.success(warnings);
154
+ }
155
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * App Kind Validator
3
+ *
4
+ * Validates manifests for executable applications with runtime and entrypoint.
5
+ */
6
+ import { OriginalKind, type OriginalManifest, type ValidationResult } from '../types';
7
+ import { BaseKindValidator } from './base';
8
+ /**
9
+ * Validator for App Originals
10
+ */
11
+ export declare class AppValidator extends BaseKindValidator<OriginalKind.App> {
12
+ readonly kind = OriginalKind.App;
13
+ protected validateKind(manifest: OriginalManifest<OriginalKind.App>): ValidationResult;
14
+ }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * App Kind Validator
3
+ *
4
+ * Validates manifests for executable applications with runtime and entrypoint.
5
+ */
6
+ import { OriginalKind } from '../types';
7
+ import { BaseKindValidator, ValidationUtils } from './base';
8
+ /**
9
+ * Valid runtime environments
10
+ */
11
+ const VALID_RUNTIMES = [
12
+ 'node', 'deno', 'bun', 'browser', 'electron',
13
+ 'react-native', 'python', 'ruby', 'go', 'rust',
14
+ 'java', 'dotnet', 'wasm',
15
+ ];
16
+ /**
17
+ * Valid platforms
18
+ */
19
+ const VALID_PLATFORMS = ['linux', 'darwin', 'windows', 'web'];
20
+ /**
21
+ * Validator for App Originals
22
+ */
23
+ export class AppValidator extends BaseKindValidator {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.kind = OriginalKind.App;
27
+ }
28
+ validateKind(manifest) {
29
+ const errors = [];
30
+ const warnings = [];
31
+ const metadata = manifest.metadata;
32
+ // Validate metadata exists
33
+ if (!metadata || typeof metadata !== 'object') {
34
+ return ValidationUtils.failure([
35
+ ValidationUtils.error('MISSING_METADATA', 'App manifest must have metadata', 'metadata'),
36
+ ]);
37
+ }
38
+ // Validate runtime (required)
39
+ if (!metadata.runtime || typeof metadata.runtime !== 'string') {
40
+ errors.push(ValidationUtils.error('MISSING_RUNTIME', 'App must specify a runtime environment', 'metadata.runtime'));
41
+ }
42
+ else if (!VALID_RUNTIMES.includes(metadata.runtime.toLowerCase())) {
43
+ warnings.push(ValidationUtils.warning('UNKNOWN_RUNTIME', `Runtime "${metadata.runtime}" is not a commonly recognized runtime`, 'metadata.runtime', `Consider using one of: ${VALID_RUNTIMES.join(', ')}`));
44
+ }
45
+ // Validate entrypoint (required)
46
+ if (!metadata.entrypoint || typeof metadata.entrypoint !== 'string') {
47
+ errors.push(ValidationUtils.error('MISSING_ENTRYPOINT', 'App must specify an entrypoint', 'metadata.entrypoint'));
48
+ }
49
+ else {
50
+ // Check if entrypoint references an existing resource
51
+ if (!ValidationUtils.resourceExists(metadata.entrypoint, manifest.resources)) {
52
+ // It might be a path within a resource, so just warn
53
+ warnings.push(ValidationUtils.warning('ENTRYPOINT_NOT_RESOURCE', `Entrypoint "${metadata.entrypoint}" does not match a resource ID`, 'metadata.entrypoint', 'Ensure the entrypoint is a valid resource ID or path within a resource'));
54
+ }
55
+ }
56
+ // Validate platforms if specified
57
+ if (metadata.platforms) {
58
+ if (!Array.isArray(metadata.platforms)) {
59
+ errors.push(ValidationUtils.error('INVALID_PLATFORMS', 'Platforms must be an array', 'metadata.platforms'));
60
+ }
61
+ else {
62
+ for (const platform of metadata.platforms) {
63
+ if (!VALID_PLATFORMS.includes(platform)) {
64
+ errors.push(ValidationUtils.error('INVALID_PLATFORM', `Invalid platform: "${platform}"`, 'metadata.platforms', platform));
65
+ }
66
+ }
67
+ }
68
+ }
69
+ // Validate permissions if specified
70
+ if (metadata.permissions) {
71
+ if (!Array.isArray(metadata.permissions)) {
72
+ errors.push(ValidationUtils.error('INVALID_PERMISSIONS', 'Permissions must be an array of strings', 'metadata.permissions'));
73
+ }
74
+ else {
75
+ for (let i = 0; i < metadata.permissions.length; i++) {
76
+ if (typeof metadata.permissions[i] !== 'string') {
77
+ errors.push(ValidationUtils.error('INVALID_PERMISSION', `Permission at index ${i} must be a string`, `metadata.permissions[${i}]`));
78
+ }
79
+ }
80
+ }
81
+ }
82
+ // Validate env if specified
83
+ if (metadata.env) {
84
+ if (typeof metadata.env !== 'object' || Array.isArray(metadata.env)) {
85
+ errors.push(ValidationUtils.error('INVALID_ENV', 'Env must be an object', 'metadata.env'));
86
+ }
87
+ else {
88
+ for (const [key, value] of Object.entries(metadata.env)) {
89
+ if (!/^[A-Z][A-Z0-9_]*$/.test(key)) {
90
+ warnings.push(ValidationUtils.warning('ENV_VAR_NAMING', `Environment variable "${key}" should use SCREAMING_SNAKE_CASE`, `metadata.env.${key}`));
91
+ }
92
+ if (typeof value !== 'object' || value === null) {
93
+ errors.push(ValidationUtils.error('INVALID_ENV_VALUE', `Env variable "${key}" must have an object value`, `metadata.env.${key}`));
94
+ }
95
+ }
96
+ }
97
+ }
98
+ // Validate icons if specified
99
+ if (metadata.icons) {
100
+ if (typeof metadata.icons !== 'object' || Array.isArray(metadata.icons)) {
101
+ errors.push(ValidationUtils.error('INVALID_ICONS', 'Icons must be an object mapping sizes to resource IDs', 'metadata.icons'));
102
+ }
103
+ else {
104
+ for (const [size, resourceId] of Object.entries(metadata.icons)) {
105
+ if (!/^\d+x\d+$/.test(size) && !/^\d+$/.test(size)) {
106
+ warnings.push(ValidationUtils.warning('ICON_SIZE_FORMAT', `Icon size "${size}" should be in format "WxH" or just "N"`, `metadata.icons.${size}`));
107
+ }
108
+ }
109
+ }
110
+ }
111
+ // Validate commands if specified
112
+ if (metadata.commands) {
113
+ if (typeof metadata.commands !== 'object' || Array.isArray(metadata.commands)) {
114
+ errors.push(ValidationUtils.error('INVALID_COMMANDS', 'Commands must be an object', 'metadata.commands'));
115
+ }
116
+ else {
117
+ for (const [name, cmd] of Object.entries(metadata.commands)) {
118
+ if (!cmd || typeof cmd !== 'object') {
119
+ errors.push(ValidationUtils.error('INVALID_COMMAND', `Command "${name}" must be an object`, `metadata.commands.${name}`));
120
+ }
121
+ else if (!cmd.description || typeof cmd.description !== 'string') {
122
+ warnings.push(ValidationUtils.warning('MISSING_COMMAND_DESC', `Command "${name}" should have a description`, `metadata.commands.${name}.description`));
123
+ }
124
+ }
125
+ }
126
+ }
127
+ // Suggest adding runtime version
128
+ if (!metadata.runtimeVersion && !metadata.minRuntimeVersion) {
129
+ warnings.push(ValidationUtils.warning('MISSING_RUNTIME_VERSION', 'Consider specifying runtimeVersion or minRuntimeVersion for compatibility', 'metadata.runtimeVersion'));
130
+ }
131
+ return errors.length > 0
132
+ ? ValidationUtils.failure(errors, warnings)
133
+ : ValidationUtils.success(warnings);
134
+ }
135
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Dataset Kind Validator
3
+ *
4
+ * Validates manifests for structured data collections with schema definitions.
5
+ */
6
+ import { OriginalKind, type OriginalManifest, type ValidationResult } from '../types';
7
+ import { BaseKindValidator } from './base';
8
+ /**
9
+ * Validator for Dataset Originals
10
+ */
11
+ export declare class DatasetValidator extends BaseKindValidator<OriginalKind.Dataset> {
12
+ readonly kind = OriginalKind.Dataset;
13
+ protected validateKind(manifest: OriginalManifest<OriginalKind.Dataset>): ValidationResult;
14
+ }
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Dataset Kind Validator
3
+ *
4
+ * Validates manifests for structured data collections with schema definitions.
5
+ */
6
+ import { OriginalKind } from '../types';
7
+ import { BaseKindValidator, ValidationUtils } from './base';
8
+ /**
9
+ * Common data formats
10
+ */
11
+ const KNOWN_FORMATS = [
12
+ 'csv', 'json', 'jsonl', 'ndjson', 'parquet', 'avro', 'orc',
13
+ 'xml', 'yaml', 'toml', 'tsv', 'excel', 'sqlite', 'arrow',
14
+ ];
15
+ /**
16
+ * Valid privacy classifications
17
+ */
18
+ const VALID_PRIVACY = ['public', 'internal', 'confidential', 'restricted'];
19
+ /**
20
+ * Valid update frequencies
21
+ */
22
+ const VALID_UPDATE_FREQUENCIES = ['realtime', 'hourly', 'daily', 'weekly', 'monthly', 'static'];
23
+ /**
24
+ * Validator for Dataset Originals
25
+ */
26
+ export class DatasetValidator extends BaseKindValidator {
27
+ constructor() {
28
+ super(...arguments);
29
+ this.kind = OriginalKind.Dataset;
30
+ }
31
+ validateKind(manifest) {
32
+ const errors = [];
33
+ const warnings = [];
34
+ const metadata = manifest.metadata;
35
+ // Validate metadata exists
36
+ if (!metadata || typeof metadata !== 'object') {
37
+ return ValidationUtils.failure([
38
+ ValidationUtils.error('MISSING_METADATA', 'Dataset manifest must have metadata', 'metadata'),
39
+ ]);
40
+ }
41
+ // Validate schema (required)
42
+ if (!metadata.schema) {
43
+ errors.push(ValidationUtils.error('MISSING_SCHEMA', 'Dataset must have a schema definition', 'metadata.schema'));
44
+ }
45
+ else if (typeof metadata.schema !== 'object' && typeof metadata.schema !== 'string') {
46
+ errors.push(ValidationUtils.error('INVALID_SCHEMA', 'Schema must be an object (JSON Schema) or string (URL)', 'metadata.schema'));
47
+ }
48
+ else if (typeof metadata.schema === 'string') {
49
+ // If it's a URL, validate it
50
+ if (!ValidationUtils.isValidURL(metadata.schema)) {
51
+ errors.push(ValidationUtils.error('INVALID_SCHEMA_URL', 'Schema URL is not a valid URL', 'metadata.schema', metadata.schema));
52
+ }
53
+ }
54
+ // Validate format (required)
55
+ if (!metadata.format || typeof metadata.format !== 'string') {
56
+ errors.push(ValidationUtils.error('MISSING_FORMAT', 'Dataset must specify a data format', 'metadata.format'));
57
+ }
58
+ else {
59
+ const normalizedFormat = metadata.format.toLowerCase();
60
+ if (!KNOWN_FORMATS.includes(normalizedFormat)) {
61
+ warnings.push(ValidationUtils.warning('UNKNOWN_FORMAT', `Data format "${metadata.format}" is not a commonly recognized format`, 'metadata.format', `Consider using one of: ${KNOWN_FORMATS.join(', ')}`));
62
+ }
63
+ }
64
+ // Validate recordCount if specified
65
+ if (metadata.recordCount !== undefined) {
66
+ if (typeof metadata.recordCount !== 'number' || metadata.recordCount < 0 || !Number.isInteger(metadata.recordCount)) {
67
+ errors.push(ValidationUtils.error('INVALID_RECORD_COUNT', 'Record count must be a non-negative integer', 'metadata.recordCount', metadata.recordCount));
68
+ }
69
+ }
70
+ else {
71
+ warnings.push(ValidationUtils.warning('MISSING_RECORD_COUNT', 'Consider specifying recordCount for better discoverability', 'metadata.recordCount'));
72
+ }
73
+ // Validate columns if specified
74
+ if (metadata.columns) {
75
+ if (!Array.isArray(metadata.columns)) {
76
+ errors.push(ValidationUtils.error('INVALID_COLUMNS', 'Columns must be an array', 'metadata.columns'));
77
+ }
78
+ else {
79
+ const columnNames = new Set();
80
+ for (let i = 0; i < metadata.columns.length; i++) {
81
+ const column = metadata.columns[i];
82
+ const columnPath = `metadata.columns[${i}]`;
83
+ if (!column || typeof column !== 'object') {
84
+ errors.push(ValidationUtils.error('INVALID_COLUMN', `Column at index ${i} must be an object`, columnPath));
85
+ continue;
86
+ }
87
+ if (!column.name || typeof column.name !== 'string') {
88
+ errors.push(ValidationUtils.error('MISSING_COLUMN_NAME', `Column at index ${i} must have a name`, `${columnPath}.name`));
89
+ }
90
+ else {
91
+ if (columnNames.has(column.name)) {
92
+ errors.push(ValidationUtils.error('DUPLICATE_COLUMN', `Duplicate column name: "${column.name}"`, `${columnPath}.name`));
93
+ }
94
+ columnNames.add(column.name);
95
+ }
96
+ if (!column.type || typeof column.type !== 'string') {
97
+ errors.push(ValidationUtils.error('MISSING_COLUMN_TYPE', `Column "${column.name || i}" must have a type`, `${columnPath}.type`));
98
+ }
99
+ }
100
+ }
101
+ }
102
+ // Validate source if specified
103
+ if (metadata.source) {
104
+ if (typeof metadata.source !== 'object') {
105
+ errors.push(ValidationUtils.error('INVALID_SOURCE', 'Source must be an object', 'metadata.source'));
106
+ }
107
+ }
108
+ // Validate statistics if specified
109
+ if (metadata.statistics) {
110
+ if (typeof metadata.statistics !== 'object') {
111
+ errors.push(ValidationUtils.error('INVALID_STATISTICS', 'Statistics must be an object', 'metadata.statistics'));
112
+ }
113
+ else {
114
+ if (metadata.statistics.sizeBytes !== undefined &&
115
+ (typeof metadata.statistics.sizeBytes !== 'number' || metadata.statistics.sizeBytes < 0)) {
116
+ errors.push(ValidationUtils.error('INVALID_SIZE_BYTES', 'sizeBytes must be a non-negative number', 'metadata.statistics.sizeBytes'));
117
+ }
118
+ }
119
+ }
120
+ // Validate privacy if specified
121
+ if (metadata.privacy) {
122
+ if (!VALID_PRIVACY.includes(metadata.privacy)) {
123
+ errors.push(ValidationUtils.error('INVALID_PRIVACY', `Privacy must be one of: ${VALID_PRIVACY.join(', ')}`, 'metadata.privacy', metadata.privacy));
124
+ }
125
+ }
126
+ else {
127
+ warnings.push(ValidationUtils.warning('MISSING_PRIVACY', 'Consider specifying a privacy classification for the dataset', 'metadata.privacy'));
128
+ }
129
+ // Validate updateFrequency if specified
130
+ if (metadata.updateFrequency) {
131
+ if (!VALID_UPDATE_FREQUENCIES.includes(metadata.updateFrequency)) {
132
+ errors.push(ValidationUtils.error('INVALID_UPDATE_FREQUENCY', `Update frequency must be one of: ${VALID_UPDATE_FREQUENCIES.join(', ')}`, 'metadata.updateFrequency', metadata.updateFrequency));
133
+ }
134
+ }
135
+ // Check that at least one data resource exists
136
+ const dataResources = manifest.resources.filter(r => r.type === 'data' ||
137
+ r.contentType.includes('csv') ||
138
+ r.contentType.includes('json') ||
139
+ r.contentType.includes('parquet') ||
140
+ r.contentType.includes('octet-stream'));
141
+ if (dataResources.length === 0) {
142
+ warnings.push(ValidationUtils.warning('NO_DATA_RESOURCES', 'No data resources found. Ensure resources have appropriate types', 'resources'));
143
+ }
144
+ return errors.length > 0
145
+ ? ValidationUtils.failure(errors, warnings)
146
+ : ValidationUtils.success(warnings);
147
+ }
148
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Document Kind Validator
3
+ *
4
+ * Validates manifests for text documents with formatting and sections.
5
+ */
6
+ import { OriginalKind, type OriginalManifest, type ValidationResult } from '../types';
7
+ import { BaseKindValidator } from './base';
8
+ /**
9
+ * Validator for Document Originals
10
+ */
11
+ export declare class DocumentValidator extends BaseKindValidator<OriginalKind.Document> {
12
+ readonly kind = OriginalKind.Document;
13
+ protected validateKind(manifest: OriginalManifest<OriginalKind.Document>): ValidationResult;
14
+ }
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Document Kind Validator
3
+ *
4
+ * Validates manifests for text documents with formatting and sections.
5
+ */
6
+ import { OriginalKind } from '../types';
7
+ import { BaseKindValidator, ValidationUtils } from './base';
8
+ /**
9
+ * Valid document formats
10
+ */
11
+ const VALID_FORMATS = ['markdown', 'html', 'pdf', 'docx', 'txt', 'asciidoc', 'rst', 'latex'];
12
+ /**
13
+ * Valid document statuses
14
+ */
15
+ const VALID_STATUSES = ['draft', 'review', 'published', 'archived'];
16
+ /**
17
+ * Validator for Document Originals
18
+ */
19
+ export class DocumentValidator extends BaseKindValidator {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.kind = OriginalKind.Document;
23
+ }
24
+ validateKind(manifest) {
25
+ const errors = [];
26
+ const warnings = [];
27
+ const metadata = manifest.metadata;
28
+ // Validate metadata exists
29
+ if (!metadata || typeof metadata !== 'object') {
30
+ return ValidationUtils.failure([
31
+ ValidationUtils.error('MISSING_METADATA', 'Document manifest must have metadata', 'metadata'),
32
+ ]);
33
+ }
34
+ // Validate format (required)
35
+ if (!metadata.format) {
36
+ errors.push(ValidationUtils.error('MISSING_FORMAT', 'Document must specify a format', 'metadata.format'));
37
+ }
38
+ else if (!VALID_FORMATS.includes(metadata.format)) {
39
+ errors.push(ValidationUtils.error('INVALID_FORMAT', `Invalid document format: "${metadata.format}". Must be one of: ${VALID_FORMATS.join(', ')}`, 'metadata.format', metadata.format));
40
+ }
41
+ // Validate content (required)
42
+ if (!metadata.content || typeof metadata.content !== 'string') {
43
+ errors.push(ValidationUtils.error('MISSING_CONTENT', 'Document must specify a content resource', 'metadata.content'));
44
+ }
45
+ else {
46
+ // Check if content references an existing resource
47
+ if (!ValidationUtils.resourceExists(metadata.content, manifest.resources)) {
48
+ warnings.push(ValidationUtils.warning('CONTENT_NOT_RESOURCE', `Content "${metadata.content}" does not match a resource ID`, 'metadata.content', 'Ensure the content field references a valid resource ID'));
49
+ }
50
+ }
51
+ // Validate language if specified
52
+ if (metadata.language) {
53
+ if (typeof metadata.language !== 'string') {
54
+ errors.push(ValidationUtils.error('INVALID_LANGUAGE', 'Language must be a string', 'metadata.language'));
55
+ }
56
+ else if (!ValidationUtils.isValidLanguageCode(metadata.language)) {
57
+ warnings.push(ValidationUtils.warning('INVALID_LANGUAGE_CODE', `Language "${metadata.language}" is not a valid ISO 639-1 code`, 'metadata.language', 'Use a 2-letter language code like "en", "es", "fr"'));
58
+ }
59
+ }
60
+ // Validate toc if specified
61
+ if (metadata.toc) {
62
+ if (!Array.isArray(metadata.toc)) {
63
+ errors.push(ValidationUtils.error('INVALID_TOC', 'Table of contents must be an array', 'metadata.toc'));
64
+ }
65
+ else {
66
+ for (let i = 0; i < metadata.toc.length; i++) {
67
+ const entry = metadata.toc[i];
68
+ const entryPath = `metadata.toc[${i}]`;
69
+ if (!entry || typeof entry !== 'object') {
70
+ errors.push(ValidationUtils.error('INVALID_TOC_ENTRY', `TOC entry at index ${i} must be an object`, entryPath));
71
+ continue;
72
+ }
73
+ if (!entry.title || typeof entry.title !== 'string') {
74
+ errors.push(ValidationUtils.error('MISSING_TOC_TITLE', `TOC entry at index ${i} must have a title`, `${entryPath}.title`));
75
+ }
76
+ if (typeof entry.level !== 'number' || entry.level < 1 || !Number.isInteger(entry.level)) {
77
+ errors.push(ValidationUtils.error('INVALID_TOC_LEVEL', `TOC entry at index ${i} must have a valid level (positive integer)`, `${entryPath}.level`));
78
+ }
79
+ }
80
+ }
81
+ }
82
+ // Validate pageCount if specified
83
+ if (metadata.pageCount !== undefined) {
84
+ if (typeof metadata.pageCount !== 'number' || metadata.pageCount <= 0 || !Number.isInteger(metadata.pageCount)) {
85
+ errors.push(ValidationUtils.error('INVALID_PAGE_COUNT', 'Page count must be a positive integer', 'metadata.pageCount'));
86
+ }
87
+ }
88
+ // Validate wordCount if specified
89
+ if (metadata.wordCount !== undefined) {
90
+ if (typeof metadata.wordCount !== 'number' || metadata.wordCount < 0 || !Number.isInteger(metadata.wordCount)) {
91
+ errors.push(ValidationUtils.error('INVALID_WORD_COUNT', 'Word count must be a non-negative integer', 'metadata.wordCount'));
92
+ }
93
+ }
94
+ // Validate readingTime if specified
95
+ if (metadata.readingTime !== undefined) {
96
+ if (typeof metadata.readingTime !== 'number' || metadata.readingTime <= 0) {
97
+ errors.push(ValidationUtils.error('INVALID_READING_TIME', 'Reading time must be a positive number (minutes)', 'metadata.readingTime'));
98
+ }
99
+ }
100
+ // Validate keywords if specified
101
+ if (metadata.keywords) {
102
+ if (!Array.isArray(metadata.keywords)) {
103
+ errors.push(ValidationUtils.error('INVALID_KEYWORDS', 'Keywords must be an array of strings', 'metadata.keywords'));
104
+ }
105
+ else {
106
+ for (let i = 0; i < metadata.keywords.length; i++) {
107
+ if (typeof metadata.keywords[i] !== 'string') {
108
+ errors.push(ValidationUtils.error('INVALID_KEYWORD', `Keyword at index ${i} must be a string`, `metadata.keywords[${i}]`));
109
+ }
110
+ }
111
+ }
112
+ }
113
+ // Validate references if specified
114
+ if (metadata.references) {
115
+ if (!Array.isArray(metadata.references)) {
116
+ errors.push(ValidationUtils.error('INVALID_REFERENCES', 'References must be an array', 'metadata.references'));
117
+ }
118
+ else {
119
+ const refIds = new Set();
120
+ for (let i = 0; i < metadata.references.length; i++) {
121
+ const ref = metadata.references[i];
122
+ const refPath = `metadata.references[${i}]`;
123
+ if (!ref || typeof ref !== 'object') {
124
+ errors.push(ValidationUtils.error('INVALID_REFERENCE', `Reference at index ${i} must be an object`, refPath));
125
+ continue;
126
+ }
127
+ if (!ref.id || typeof ref.id !== 'string') {
128
+ errors.push(ValidationUtils.error('MISSING_REFERENCE_ID', `Reference at index ${i} must have an id`, `${refPath}.id`));
129
+ }
130
+ else {
131
+ if (refIds.has(ref.id)) {
132
+ errors.push(ValidationUtils.error('DUPLICATE_REFERENCE_ID', `Duplicate reference id: "${ref.id}"`, `${refPath}.id`));
133
+ }
134
+ refIds.add(ref.id);
135
+ }
136
+ if (!ref.title || typeof ref.title !== 'string') {
137
+ errors.push(ValidationUtils.error('MISSING_REFERENCE_TITLE', `Reference at index ${i} must have a title`, `${refPath}.title`));
138
+ }
139
+ // Validate URL if present
140
+ if (ref.url && !ValidationUtils.isValidURL(ref.url)) {
141
+ warnings.push(ValidationUtils.warning('INVALID_REFERENCE_URL', `Reference "${ref.id}" has an invalid URL`, `${refPath}.url`));
142
+ }
143
+ }
144
+ }
145
+ }
146
+ // Validate status if specified
147
+ if (metadata.status) {
148
+ if (!VALID_STATUSES.includes(metadata.status)) {
149
+ errors.push(ValidationUtils.error('INVALID_STATUS', `Invalid document status: "${metadata.status}". Must be one of: ${VALID_STATUSES.join(', ')}`, 'metadata.status', metadata.status));
150
+ }
151
+ }
152
+ // Validate revision if specified
153
+ if (metadata.revision !== undefined) {
154
+ if (typeof metadata.revision !== 'number' || metadata.revision < 1 || !Number.isInteger(metadata.revision)) {
155
+ errors.push(ValidationUtils.error('INVALID_REVISION', 'Revision must be a positive integer', 'metadata.revision'));
156
+ }
157
+ }
158
+ // Suggest adding language
159
+ if (!metadata.language) {
160
+ warnings.push(ValidationUtils.warning('MISSING_LANGUAGE', 'Consider specifying the document language', 'metadata.language', 'Add a language code like "en" for English'));
161
+ }
162
+ // Suggest adding abstract
163
+ if (!metadata.abstract) {
164
+ warnings.push(ValidationUtils.warning('MISSING_ABSTRACT', 'Consider adding an abstract or summary', 'metadata.abstract'));
165
+ }
166
+ // Check that at least one document resource exists
167
+ const docResources = manifest.resources.filter(r => r.type === 'document' ||
168
+ r.type === 'text' ||
169
+ r.contentType.includes('text/') ||
170
+ r.contentType.includes('markdown') ||
171
+ r.contentType.includes('html') ||
172
+ r.contentType.includes('pdf'));
173
+ if (docResources.length === 0) {
174
+ warnings.push(ValidationUtils.warning('NO_DOCUMENT_RESOURCES', 'No document resources found. Ensure resources have appropriate types', 'resources'));
175
+ }
176
+ return errors.length > 0
177
+ ? ValidationUtils.failure(errors, warnings)
178
+ : ValidationUtils.success(warnings);
179
+ }
180
+ }