@semiont/core 0.2.2-build.11 → 0.2.2

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 (90) hide show
  1. package/dist/index.d.ts +1367 -27
  2. package/dist/index.js +1455 -78
  3. package/dist/index.js.map +1 -1
  4. package/package.json +18 -8
  5. package/dist/annotation-history-utils.d.ts +0 -42
  6. package/dist/annotation-history-utils.d.ts.map +0 -1
  7. package/dist/annotation-history-utils.js +0 -258
  8. package/dist/annotation-history-utils.js.map +0 -1
  9. package/dist/annotation-types.d.ts +0 -15
  10. package/dist/annotation-types.d.ts.map +0 -1
  11. package/dist/annotation-types.js +0 -6
  12. package/dist/annotation-types.js.map +0 -1
  13. package/dist/annotation-utils.d.ts +0 -18
  14. package/dist/annotation-utils.d.ts.map +0 -1
  15. package/dist/annotation-utils.js +0 -70
  16. package/dist/annotation-utils.js.map +0 -1
  17. package/dist/auth-types.d.ts +0 -8
  18. package/dist/auth-types.d.ts.map +0 -1
  19. package/dist/auth-types.js +0 -6
  20. package/dist/auth-types.js.map +0 -1
  21. package/dist/config/config-validator.d.ts +0 -25
  22. package/dist/config/config-validator.d.ts.map +0 -1
  23. package/dist/config/config-validator.js +0 -112
  24. package/dist/config/config-validator.js.map +0 -1
  25. package/dist/config/config.schema.json +0 -678
  26. package/dist/config/config.types.d.ts +0 -574
  27. package/dist/config/config.types.d.ts.map +0 -1
  28. package/dist/config/config.types.js +0 -4
  29. package/dist/config/config.types.js.map +0 -1
  30. package/dist/config/configuration-error.d.ts +0 -17
  31. package/dist/config/configuration-error.d.ts.map +0 -1
  32. package/dist/config/configuration-error.js +0 -36
  33. package/dist/config/configuration-error.js.map +0 -1
  34. package/dist/config/environment-loader.d.ts +0 -98
  35. package/dist/config/environment-loader.d.ts.map +0 -1
  36. package/dist/config/environment-loader.js +0 -229
  37. package/dist/config/environment-loader.js.map +0 -1
  38. package/dist/config/environment-validator.d.ts +0 -22
  39. package/dist/config/environment-validator.d.ts.map +0 -1
  40. package/dist/config/environment-validator.js +0 -50
  41. package/dist/config/environment-validator.js.map +0 -1
  42. package/dist/config/platform-types.d.ts +0 -26
  43. package/dist/config/platform-types.d.ts.map +0 -1
  44. package/dist/config/platform-types.js +0 -28
  45. package/dist/config/platform-types.js.map +0 -1
  46. package/dist/config/project-discovery.d.ts +0 -35
  47. package/dist/config/project-discovery.d.ts.map +0 -1
  48. package/dist/config/project-discovery.js +0 -99
  49. package/dist/config/project-discovery.js.map +0 -1
  50. package/dist/creation-methods.d.ts +0 -19
  51. package/dist/creation-methods.d.ts.map +0 -1
  52. package/dist/creation-methods.js +0 -18
  53. package/dist/creation-methods.js.map +0 -1
  54. package/dist/crypto.d.ts +0 -32
  55. package/dist/crypto.d.ts.map +0 -1
  56. package/dist/crypto.js +0 -52
  57. package/dist/crypto.js.map +0 -1
  58. package/dist/did-utils.d.ts +0 -51
  59. package/dist/did-utils.d.ts.map +0 -1
  60. package/dist/did-utils.js +0 -62
  61. package/dist/did-utils.js.map +0 -1
  62. package/dist/errors.d.ts +0 -51
  63. package/dist/errors.d.ts.map +0 -1
  64. package/dist/errors.js +0 -89
  65. package/dist/errors.js.map +0 -1
  66. package/dist/events.d.ts +0 -223
  67. package/dist/events.d.ts.map +0 -1
  68. package/dist/events.js +0 -45
  69. package/dist/events.js.map +0 -1
  70. package/dist/graph.d.ts +0 -31
  71. package/dist/graph.d.ts.map +0 -1
  72. package/dist/graph.js +0 -6
  73. package/dist/graph.js.map +0 -1
  74. package/dist/http-client.d.ts +0 -32
  75. package/dist/http-client.d.ts.map +0 -1
  76. package/dist/http-client.js +0 -56
  77. package/dist/http-client.js.map +0 -1
  78. package/dist/identifiers.d.ts +0 -24
  79. package/dist/identifiers.d.ts.map +0 -1
  80. package/dist/identifiers.js +0 -40
  81. package/dist/identifiers.js.map +0 -1
  82. package/dist/index.d.ts.map +0 -1
  83. package/dist/resource-types.d.ts +0 -15
  84. package/dist/resource-types.d.ts.map +0 -1
  85. package/dist/resource-types.js +0 -6
  86. package/dist/resource-types.js.map +0 -1
  87. package/dist/type-guards.d.ts +0 -44
  88. package/dist/type-guards.d.ts.map +0 -1
  89. package/dist/type-guards.js +0 -76
  90. package/dist/type-guards.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,33 +1,1373 @@
1
+ import { components, JobId, AnnotationUri } from '@semiont/api-client';
2
+ import { ErrorObject } from 'ajv';
3
+
4
+ /**
5
+ * Resource creation methods - How resources are created in the system
6
+ */
7
+ /**
8
+ * Enumeration of all possible resource creation methods
9
+ */
10
+ declare const CREATION_METHODS: {
11
+ readonly API: "api";
12
+ readonly UPLOAD: "upload";
13
+ readonly UI: "ui";
14
+ readonly REFERENCE: "reference";
15
+ readonly CLONE: "clone";
16
+ readonly GENERATED: "generated";
17
+ };
18
+ /**
19
+ * Type for resource creation methods
20
+ */
21
+ type CreationMethod = typeof CREATION_METHODS[keyof typeof CREATION_METHODS];
22
+
23
+ /**
24
+ * Branded identifier types for compile-time type safety.
25
+ *
26
+ * These types prevent mixing up resource IDs, annotation IDs, and user IDs
27
+ * at compile time while having zero runtime overhead.
28
+ *
29
+ * URI types (ResourceUri, AnnotationUri) are in @semiont/api-client
30
+ * since they deal with HTTP URIs returned by the API.
31
+ */
32
+ type ResourceId = string & {
33
+ readonly __brand: 'ResourceId';
34
+ };
35
+ type AnnotationId = string & {
36
+ readonly __brand: 'AnnotationId';
37
+ };
38
+ type UserId = string & {
39
+ readonly __brand: 'UserId';
40
+ };
41
+ declare function isResourceId(value: string): value is ResourceId;
42
+ declare function isAnnotationId(value: string): value is AnnotationId;
43
+ declare function resourceId(id: string): ResourceId;
44
+ declare function annotationId(id: string): AnnotationId;
45
+ declare function userId(id: string): UserId;
46
+
47
+ /**
48
+ * Graph types - Models for graph connections and relationships
49
+ */
50
+
51
+ type ResourceDescriptor = components['schemas']['ResourceDescriptor'];
52
+ type Annotation$4 = components['schemas']['Annotation'];
53
+ /**
54
+ * Represents a connection between resources through annotations
55
+ */
56
+ interface GraphConnection {
57
+ targetResource: ResourceDescriptor;
58
+ annotations: Annotation$4[];
59
+ relationshipType?: string;
60
+ bidirectional: boolean;
61
+ }
62
+ /**
63
+ * Represents a path through the graph
64
+ */
65
+ interface GraphPath {
66
+ resources: ResourceDescriptor[];
67
+ annotations: Annotation$4[];
68
+ }
69
+ /**
70
+ * Statistics about entity types in the graph
71
+ */
72
+ interface EntityTypeStats {
73
+ type: string;
74
+ count: number;
75
+ }
76
+
77
+ /**
78
+ * Resource Event Types
79
+ *
80
+ * Event-sourced architecture for resource state management
81
+ * Events are stored in an append-only log (JSONL format)
82
+ *
83
+ * Federation-ready design:
84
+ * - resourceId uses content hashes (doc-sha256:...)
85
+ * - userId uses DID format (did:web:org.com:users:alice)
86
+ * - prevEventHash creates tamper-evident chains
87
+ * - Optional signatures for cross-org verification
88
+ */
89
+
90
+ type Annotation$3 = components['schemas']['Annotation'];
91
+ type ContentFormat = components['schemas']['ContentFormat'];
92
+ interface BaseEvent {
93
+ id: string;
94
+ timestamp: string;
95
+ resourceId?: ResourceId;
96
+ userId: UserId;
97
+ version: number;
98
+ }
99
+ interface ResourceCreatedEvent extends BaseEvent {
100
+ type: 'resource.created';
101
+ payload: {
102
+ name: string;
103
+ format: ContentFormat;
104
+ contentChecksum: string;
105
+ contentByteSize?: number;
106
+ creationMethod: CreationMethod;
107
+ entityTypes?: string[];
108
+ language?: string;
109
+ isDraft?: boolean;
110
+ generatedFrom?: string;
111
+ generationPrompt?: string;
112
+ };
113
+ }
114
+ interface ResourceClonedEvent extends BaseEvent {
115
+ type: 'resource.cloned';
116
+ payload: {
117
+ name: string;
118
+ format: ContentFormat;
119
+ contentChecksum: string;
120
+ contentByteSize?: number;
121
+ parentResourceId: string;
122
+ creationMethod: CreationMethod;
123
+ entityTypes?: string[];
124
+ language?: string;
125
+ };
126
+ }
127
+ interface ResourceArchivedEvent extends BaseEvent {
128
+ type: 'resource.archived';
129
+ payload: {
130
+ reason?: string;
131
+ };
132
+ }
133
+ interface ResourceUnarchivedEvent extends BaseEvent {
134
+ type: 'resource.unarchived';
135
+ payload: Record<string, never>;
136
+ }
137
+ interface AnnotationAddedEvent extends BaseEvent {
138
+ type: 'annotation.added';
139
+ payload: {
140
+ annotation: Omit<Annotation$3, 'creator' | 'created'>;
141
+ };
142
+ }
143
+ interface AnnotationRemovedEvent extends BaseEvent {
144
+ type: 'annotation.removed';
145
+ payload: {
146
+ annotationId: AnnotationId;
147
+ };
148
+ }
149
+ type BodyItem = {
150
+ type: 'TextualBody';
151
+ value: string;
152
+ purpose: 'tagging' | 'commenting' | 'describing' | 'classifying';
153
+ format?: string;
154
+ language?: string;
155
+ } | {
156
+ type: 'SpecificResource';
157
+ source: string;
158
+ purpose: 'linking';
159
+ };
160
+ type BodyOperation = {
161
+ op: 'add';
162
+ item: BodyItem;
163
+ } | {
164
+ op: 'remove';
165
+ item: BodyItem;
166
+ } | {
167
+ op: 'replace';
168
+ oldItem: BodyItem;
169
+ newItem: BodyItem;
170
+ };
171
+ interface AnnotationBodyUpdatedEvent extends BaseEvent {
172
+ type: 'annotation.body.updated';
173
+ payload: {
174
+ annotationId: AnnotationId;
175
+ operations: BodyOperation[];
176
+ };
177
+ }
178
+ interface JobStartedEvent extends BaseEvent {
179
+ type: 'job.started';
180
+ resourceId: ResourceId;
181
+ payload: {
182
+ jobId: JobId;
183
+ jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
184
+ totalSteps?: number;
185
+ };
186
+ }
187
+ interface JobProgressEvent extends BaseEvent {
188
+ type: 'job.progress';
189
+ resourceId: ResourceId;
190
+ payload: {
191
+ jobId: JobId;
192
+ jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
193
+ percentage: number;
194
+ currentStep?: string;
195
+ processedSteps?: number;
196
+ totalSteps?: number;
197
+ foundCount?: number;
198
+ message?: string;
199
+ progress?: any;
200
+ };
201
+ }
202
+ interface JobCompletedEvent extends BaseEvent {
203
+ type: 'job.completed';
204
+ resourceId: ResourceId;
205
+ payload: {
206
+ jobId: JobId;
207
+ jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
208
+ totalSteps?: number;
209
+ foundCount?: number;
210
+ resultResourceId?: ResourceId;
211
+ annotationUri?: AnnotationUri;
212
+ message?: string;
213
+ result?: any;
214
+ };
215
+ }
216
+ interface JobFailedEvent extends BaseEvent {
217
+ type: 'job.failed';
218
+ resourceId: ResourceId;
219
+ payload: {
220
+ jobId: JobId;
221
+ jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
222
+ error: string;
223
+ details?: string;
224
+ };
225
+ }
226
+ interface EntityTagAddedEvent extends BaseEvent {
227
+ type: 'entitytag.added';
228
+ resourceId: ResourceId;
229
+ payload: {
230
+ entityType: string;
231
+ };
232
+ }
233
+ interface EntityTagRemovedEvent extends BaseEvent {
234
+ type: 'entitytag.removed';
235
+ resourceId: ResourceId;
236
+ payload: {
237
+ entityType: string;
238
+ };
239
+ }
240
+ interface EntityTypeAddedEvent extends BaseEvent {
241
+ type: 'entitytype.added';
242
+ resourceId?: undefined;
243
+ payload: {
244
+ entityType: string;
245
+ };
246
+ }
247
+ type ResourceEvent = ResourceCreatedEvent | ResourceClonedEvent | ResourceArchivedEvent | ResourceUnarchivedEvent | AnnotationAddedEvent | AnnotationRemovedEvent | AnnotationBodyUpdatedEvent | JobStartedEvent | JobProgressEvent | JobCompletedEvent | JobFailedEvent | EntityTagAddedEvent | EntityTagRemovedEvent | EntityTypeAddedEvent;
248
+ type ResourceEventType = ResourceEvent['type'];
249
+ type SystemEvent = EntityTypeAddedEvent;
250
+ type ResourceScopedEvent = Exclude<ResourceEvent, SystemEvent>;
251
+ declare function isResourceEvent(event: any): event is ResourceEvent;
252
+ /**
253
+ * Type guard: Check if event is system-level (no resourceId)
254
+ * System events affect global state, not individual resources
255
+ */
256
+ declare function isSystemEvent(event: ResourceEvent): event is SystemEvent;
257
+ /**
258
+ * Type guard: Check if event is resource-scoped (has resourceId)
259
+ * Resource events affect a specific resource's state
260
+ */
261
+ declare function isResourceScopedEvent(event: ResourceEvent): event is ResourceScopedEvent;
262
+ declare function getEventType<T extends ResourceEvent>(event: ResourceEvent): T['type'];
263
+ interface EventMetadata {
264
+ sequenceNumber: number;
265
+ streamPosition: number;
266
+ timestamp: string;
267
+ prevEventHash?: string;
268
+ checksum?: string;
269
+ }
270
+ interface EventSignature {
271
+ algorithm: 'ed25519';
272
+ publicKey: string;
273
+ signature: string;
274
+ keyId?: string;
275
+ }
276
+ interface StoredEvent<T extends ResourceEvent = ResourceEvent> {
277
+ event: T;
278
+ metadata: EventMetadata;
279
+ signature?: EventSignature;
280
+ }
281
+ interface EventQuery {
282
+ resourceId?: ResourceId;
283
+ userId?: string;
284
+ eventTypes?: ResourceEvent['type'][];
285
+ fromTimestamp?: string;
286
+ toTimestamp?: string;
287
+ fromSequence?: number;
288
+ limit?: number;
289
+ }
290
+ interface ResourceAnnotations {
291
+ resourceId: ResourceId;
292
+ annotations: Annotation$3[];
293
+ version: number;
294
+ updatedAt: string;
295
+ }
296
+
297
+ /**
298
+ * Backend-specific annotation utility functions
299
+ */
300
+
301
+ type Annotation$2 = components['schemas']['Annotation'];
302
+ /**
303
+ * Check if two body items match (for remove/replace operations)
304
+ * Matches by type, value/source, and purpose fields
305
+ */
306
+ declare function bodyItemsMatch(item1: BodyItem, item2: BodyItem): boolean;
307
+ /**
308
+ * Find a body item in an array
309
+ * Returns the index of the first matching item, or -1 if not found
310
+ */
311
+ declare function findBodyItem(body: Annotation$2['body'], targetItem: BodyItem): number;
312
+
313
+ /**
314
+ * Resource input/output types
315
+ */
316
+ interface UpdateResourceInput {
317
+ name?: string;
318
+ entityTypes?: string[];
319
+ archived?: boolean;
320
+ }
321
+ interface ResourceFilter {
322
+ entityTypes?: string[];
323
+ search?: string;
324
+ limit?: number;
325
+ offset?: number;
326
+ }
327
+
328
+ /**
329
+ * Annotation types
330
+ */
331
+
332
+ type Annotation$1 = components['schemas']['Annotation'];
333
+ type AnnotationCategory = 'highlight' | 'reference';
334
+ interface CreateAnnotationInternal {
335
+ id: string;
336
+ motivation: Annotation$1['motivation'];
337
+ target: Annotation$1['target'];
338
+ body: Annotation$1['body'];
339
+ creator: components['schemas']['Agent'];
340
+ }
341
+
342
+ /**
343
+ * Auth types
344
+ */
345
+ interface GoogleAuthRequest {
346
+ credential: string;
347
+ termsAccepted: boolean;
348
+ }
349
+
350
+ /**
351
+ * Common type guard utilities
352
+ */
353
+ /**
354
+ * Check if value is a string
355
+ */
356
+ declare function isString(value: unknown): value is string;
357
+ /**
358
+ * Check if value is a number (not NaN)
359
+ */
360
+ declare function isNumber(value: unknown): value is number;
361
+ /**
362
+ * Check if value is an object (not null, not array)
363
+ */
364
+ declare function isObject(value: unknown): value is Record<string, unknown>;
365
+ /**
366
+ * Check if value is an array
367
+ */
368
+ declare function isArray(value: unknown): value is unknown[];
369
+ /**
370
+ * Check if value is a boolean
371
+ */
372
+ declare function isBoolean(value: unknown): value is boolean;
373
+ /**
374
+ * Check if value is a function
375
+ */
376
+ declare function isFunction(value: unknown): value is Function;
377
+ /**
378
+ * Check if value is null
379
+ */
380
+ declare function isNull(value: unknown): value is null;
381
+ /**
382
+ * Check if value is undefined
383
+ */
384
+ declare function isUndefined(value: unknown): value is undefined;
385
+ /**
386
+ * Check if value is null or undefined
387
+ */
388
+ declare function isNullish(value: unknown): value is null | undefined;
389
+ /**
390
+ * Check if value is defined (not null or undefined)
391
+ */
392
+ declare function isDefined<T>(value: T | null | undefined): value is T;
393
+
394
+ /**
395
+ * Cryptographic utilities
396
+ */
397
+ /**
398
+ * Calculate SHA-256 checksum of content
399
+ * @param content The content to hash
400
+ * @returns Hex-encoded SHA-256 hash
401
+ */
402
+ declare function calculateChecksum(content: string | Buffer): string;
403
+ /**
404
+ * Verify content against a checksum
405
+ * @param content The content to verify
406
+ * @param checksum The expected checksum
407
+ * @returns True if content matches checksum
408
+ */
409
+ declare function verifyChecksum(content: string | Buffer, checksum: string): boolean;
410
+ /**
411
+ * Generate a random ID (12 character hex string)
412
+ * Similar to MongoDB ObjectId but simpler
413
+ */
414
+ declare function generateId(): string;
415
+ /**
416
+ * Generate a UUID v4-like ID (without dashes)
417
+ */
418
+ declare function generateUuid(): string;
419
+ /**
420
+ * Generate a secure random token
421
+ * @param bytes Number of random bytes (default 32)
422
+ * @returns Base64 encoded random token
423
+ */
424
+ declare function generateToken(bytes?: number): string;
425
+
426
+ /**
427
+ * Common error classes
428
+ */
429
+ /**
430
+ * Base error class for Semiont applications
431
+ */
432
+ declare class SemiontError extends Error {
433
+ code: string;
434
+ details?: Record<string, any> | undefined;
435
+ constructor(message: string, code: string, details?: Record<string, any> | undefined);
436
+ }
437
+ /**
438
+ * Error thrown when validation fails
439
+ */
440
+ declare class ValidationError extends SemiontError {
441
+ constructor(message: string, details?: Record<string, any>);
442
+ }
443
+ /**
444
+ * Error thrown by scripts
445
+ */
446
+ declare class ScriptError extends SemiontError {
447
+ constructor(message: string, code?: string, details?: Record<string, any>);
448
+ }
449
+ /**
450
+ * Error thrown when a resource is not found
451
+ */
452
+ declare class NotFoundError extends SemiontError {
453
+ constructor(resource: string, id?: string);
454
+ }
455
+ /**
456
+ * Error thrown when user is not authorized
457
+ */
458
+ declare class UnauthorizedError extends SemiontError {
459
+ constructor(message?: string, details?: Record<string, any>);
460
+ }
461
+ /**
462
+ * Error thrown when operation would conflict with existing data
463
+ */
464
+ declare class ConflictError extends SemiontError {
465
+ constructor(message: string, details?: Record<string, any>);
466
+ }
467
+ /**
468
+ * API Error class for handling HTTP errors
469
+ * Used by API clients to represent failed HTTP requests
470
+ */
471
+ declare class APIError extends Error {
472
+ status: number;
473
+ data: any;
474
+ constructor(status: number, data: any, message?: string);
475
+ }
476
+
477
+ /**
478
+ * HTTP Client Utilities
479
+ *
480
+ * Reusable fetch wrapper for making authenticated HTTP requests.
481
+ * Used by both frontend (via TanStack Query) and backend (direct calls).
482
+ */
483
+ /**
484
+ * Configuration for HTTP client
485
+ */
486
+ interface HttpClientConfig {
487
+ baseUrl: string;
488
+ token?: string;
489
+ }
490
+ /**
491
+ * Fetch helper with authentication and error handling
492
+ *
493
+ * @param endpoint - API endpoint (e.g., '/api/resources')
494
+ * @param options - Standard fetch options
495
+ * @param token - Optional authentication token
496
+ * @returns Typed response data
497
+ * @throws APIError on HTTP errors
498
+ */
499
+ declare function fetchAPI<T>(endpoint: string, options?: RequestInit, token?: string, baseUrl?: string): Promise<T>;
500
+ /**
501
+ * Create a configured fetch function with a base URL
502
+ * Useful for creating client-specific fetch instances
503
+ *
504
+ * @param baseUrl - Base URL for all requests (e.g., 'http://localhost:4000')
505
+ * @returns Configured fetch function
506
+ */
507
+ declare function createFetchAPI(baseUrl: string): <T>(endpoint: string, options?: RequestInit, token?: string) => Promise<T>;
508
+
509
+ /**
510
+ * Utility functions for AnnotationHistory component
511
+ * Extracted to reduce component complexity and improve testability
512
+ *
513
+ * NOTE: This file contains UI-specific logic and should eventually move to the frontend package.
514
+ * It has been updated to work with unified annotation events (annotation.added/removed/body.updated)
515
+ * instead of separate highlight/reference/assessment events.
516
+ */
517
+
518
+ type Annotation = components['schemas']['Annotation'];
519
+ type TranslateFn = (key: string, params?: Record<string, string | number>) => string;
520
+ declare function formatEventType(type: ResourceEventType, t: TranslateFn): string;
521
+ declare function getEventEmoji(type: ResourceEventType, event?: StoredEvent): string;
522
+ declare function formatRelativeTime(timestamp: string, t: TranslateFn): string;
523
+ declare function getEventDisplayContent(event: StoredEvent, _references: Annotation[], // underscore prefix to indicate intentionally unused for now
524
+ _highlights: Annotation[], // underscore prefix to indicate intentionally unused for now
525
+ allEvents: StoredEvent[]): {
526
+ exact: string;
527
+ isQuoted: boolean;
528
+ isTag: boolean;
529
+ } | null;
530
+ declare function getEventEntityTypes(event: StoredEvent): string[];
531
+ type ResourceCreatedDetails = {
532
+ type: 'created';
533
+ userId: string;
534
+ method: CreationMethod;
535
+ };
536
+ type ResourceClonedDetails = {
537
+ type: 'cloned';
538
+ userId: string;
539
+ method: CreationMethod;
540
+ sourceDocId: string;
541
+ };
542
+ type ResourceCreationDetails = ResourceCreatedDetails | ResourceClonedDetails;
543
+ declare function getResourceCreationDetails(event: StoredEvent): ResourceCreationDetails | null;
544
+ declare function getAnnotationIdFromEvent(event: StoredEvent): string | null;
545
+ declare function isEventRelatedToAnnotation(event: StoredEvent, annotationId: AnnotationId): boolean;
546
+
547
+ /**
548
+ * DID (Decentralized Identifier) and W3C Agent utilities
549
+ *
550
+ * Provides utilities for working with DID:WEB identifiers and converting
551
+ * between user representations and W3C Web Annotation Agent objects.
552
+ */
553
+
554
+ type Agent = components['schemas']['Agent'];
555
+ /**
556
+ * Convert a user object to a DID:WEB identifier
557
+ *
558
+ * Format: did:web:domain.com:users:userId
559
+ * Example: did:web:example.com:users:abc123
560
+ *
561
+ * This is used for W3C Web Annotation compliance and federation readiness.
562
+ *
563
+ * @param user - User object with id and domain
564
+ * @returns DID:WEB identifier string
565
+ */
566
+ declare function userToDid(user: {
567
+ id: string;
568
+ domain: string;
569
+ }): string;
570
+ /**
571
+ * Convert a user object to a W3C Agent object with DID:WEB identifier
572
+ *
573
+ * Creates a full Agent object for W3C Web Annotation compliance.
574
+ * Includes DID:WEB identifier, type, and name.
575
+ *
576
+ * @param user - User object with id, domain, name, and email
577
+ * @returns W3C Agent object
578
+ */
579
+ declare function userToAgent(user: {
580
+ id: string;
581
+ domain: string;
582
+ name: string | null;
583
+ email: string;
584
+ }): Agent;
585
+ /**
586
+ * Convert a DID string to a minimal W3C Agent object
587
+ *
588
+ * Used when reconstructing annotations from events where only the DID is available.
589
+ * Creates a minimal Agent with just the required fields (id, type).
590
+ * Name is derived from the DID for display purposes.
591
+ *
592
+ * @param did - DID:WEB identifier string
593
+ * @returns Minimal W3C Agent object
594
+ */
595
+ declare function didToAgent(did: string): Agent;
596
+
597
+ /**
598
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
599
+ * via the `definition` "PlatformType".
600
+ */
601
+ type PlatformType$1 = 'posix' | 'container' | 'aws' | 'external';
602
+ /**
603
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
604
+ * via the `definition` "GraphDatabaseType".
605
+ */
606
+ type GraphDatabaseType = 'neo4j' | 'janusgraph' | 'neptune' | 'memory';
607
+ /**
608
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
609
+ * via the `definition` "ServicePlatformConfig".
610
+ */
611
+ interface ServicePlatformConfig {
612
+ type: PlatformType$1;
613
+ [k: string]: unknown;
614
+ }
615
+ /**
616
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
617
+ * via the `definition` "ResourceRequirements".
618
+ */
619
+ interface ResourceRequirements {
620
+ cpu?: string;
621
+ memory?: string;
622
+ gpu?: number;
623
+ gpus?: number;
624
+ replicas?: number;
625
+ ephemeralStorage?: string;
626
+ memoryReservation?: string;
627
+ }
628
+ /**
629
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
630
+ * via the `definition` "SecurityRequirements".
631
+ */
632
+ interface SecurityRequirements {
633
+ readOnlyRootFilesystem?: boolean;
634
+ runAsNonRoot?: boolean;
635
+ runAsUser?: number;
636
+ runAsGroup?: number;
637
+ capabilities?: string[] | {
638
+ add?: string[];
639
+ drop?: string[];
640
+ [k: string]: unknown;
641
+ };
642
+ privileged?: boolean;
643
+ allowPrivilegeEscalation?: boolean;
644
+ }
645
+ /**
646
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
647
+ * via the `definition` "BuildRequirements".
648
+ */
649
+ interface BuildRequirements {
650
+ dockerfile?: string;
651
+ buildContext?: string;
652
+ buildArgs?: {
653
+ [k: string]: string;
654
+ };
655
+ buildTarget?: string;
656
+ prebuilt?: boolean;
657
+ noCache?: boolean;
658
+ }
659
+ /**
660
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
661
+ * via the `definition` "BackendServiceConfig".
662
+ */
663
+ interface BackendServiceConfig {
664
+ platform: ServicePlatformConfig;
665
+ devMode?: boolean;
666
+ command?: string;
667
+ port: number;
668
+ publicURL: string;
669
+ corsOrigin: string;
670
+ image?: string;
671
+ cpu?: string;
672
+ memory?: string;
673
+ semiontRepo?: string;
674
+ databaseUrl?: string;
675
+ projectRoot?: string;
676
+ timeout?: number;
677
+ wait?: number;
678
+ logsEndpoint?: string;
679
+ tag?: string;
680
+ resources?: ResourceRequirements;
681
+ security?: SecurityRequirements;
682
+ build?: boolean | BuildRequirements;
683
+ dockerfile?: string;
684
+ buildContext?: string;
685
+ buildArgs?: {
686
+ [k: string]: string;
687
+ };
688
+ buildTarget?: string;
689
+ prebuilt?: boolean;
690
+ noCache?: boolean;
691
+ secrets?: string[];
692
+ labels?: {
693
+ [k: string]: string;
694
+ };
695
+ annotations?: {
696
+ [k: string]: string;
697
+ };
698
+ dependencies?: string[];
699
+ externalDependencies?: (string | {
700
+ name?: string;
701
+ url?: string;
702
+ required?: boolean;
703
+ healthCheck?: string;
704
+ [k: string]: unknown;
705
+ })[];
706
+ redisUrl?: string;
707
+ environment?: {
708
+ [k: string]: string;
709
+ };
710
+ env?: {
711
+ [k: string]: string;
712
+ };
713
+ }
714
+ /**
715
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
716
+ * via the `definition` "FrontendServiceConfig".
717
+ */
718
+ interface FrontendServiceConfig {
719
+ platform: ServicePlatformConfig;
720
+ devMode?: boolean;
721
+ command?: string;
722
+ port: number;
723
+ url: string;
724
+ siteName: string;
725
+ image?: string;
726
+ semiontRepo?: string;
727
+ projectRoot?: string;
728
+ databaseUrl?: string;
729
+ timeout?: number;
730
+ wait?: number;
731
+ logsEndpoint?: string;
732
+ tag?: string;
733
+ resources?: ResourceRequirements;
734
+ security?: SecurityRequirements;
735
+ build?: boolean | BuildRequirements;
736
+ dockerfile?: string;
737
+ buildContext?: string;
738
+ buildArgs?: {
739
+ [k: string]: string;
740
+ };
741
+ buildTarget?: string;
742
+ prebuilt?: boolean;
743
+ noCache?: boolean;
744
+ secrets?: string[];
745
+ labels?: {
746
+ [k: string]: string;
747
+ };
748
+ annotations?: {
749
+ [k: string]: string;
750
+ };
751
+ dependencies?: string[];
752
+ externalDependencies?: (string | {
753
+ name?: string;
754
+ url?: string;
755
+ required?: boolean;
756
+ healthCheck?: string;
757
+ [k: string]: unknown;
758
+ })[];
759
+ environment?: {
760
+ [k: string]: string;
761
+ };
762
+ env?: {
763
+ [k: string]: string;
764
+ };
765
+ }
766
+ /**
767
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
768
+ * via the `definition` "DatabaseServiceConfig".
769
+ */
770
+ interface DatabaseServiceConfig {
771
+ platform: ServicePlatformConfig;
772
+ type: string;
773
+ name?: string;
774
+ host: string;
775
+ port: number;
776
+ environment?: {
777
+ [k: string]: string;
778
+ };
779
+ env?: {
780
+ [k: string]: string;
781
+ };
782
+ description?: string;
783
+ command?: string;
784
+ image?: string;
785
+ user?: string;
786
+ username?: string;
787
+ password?: string;
788
+ database?: string;
789
+ storageSize?: string;
790
+ timeout?: number;
791
+ wait?: number;
792
+ logsEndpoint?: string;
793
+ tag?: string;
794
+ resources?: ResourceRequirements;
795
+ security?: SecurityRequirements;
796
+ build?: boolean | BuildRequirements;
797
+ dockerfile?: string;
798
+ buildContext?: string;
799
+ buildArgs?: {
800
+ [k: string]: string;
801
+ };
802
+ buildTarget?: string;
803
+ prebuilt?: boolean;
804
+ noCache?: boolean;
805
+ secrets?: string[];
806
+ labels?: {
807
+ [k: string]: string;
808
+ };
809
+ annotations?: {
810
+ [k: string]: string;
811
+ };
812
+ dependencies?: string[];
813
+ externalDependencies?: (string | {
814
+ name?: string;
815
+ url?: string;
816
+ required?: boolean;
817
+ healthCheck?: string;
818
+ [k: string]: unknown;
819
+ })[];
820
+ }
821
+ /**
822
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
823
+ * via the `definition` "GraphServiceConfig".
824
+ */
825
+ interface GraphServiceConfig {
826
+ platform: ServicePlatformConfig;
827
+ type: GraphDatabaseType;
828
+ name?: string;
829
+ uri: string;
830
+ url?: string;
831
+ username: string;
832
+ password: string;
833
+ database: string;
834
+ host?: string;
835
+ port?: number;
836
+ storage?: string;
837
+ index?: string;
838
+ endpoint?: string;
839
+ region?: string;
840
+ command?: string;
841
+ image?: string;
842
+ janusgraphVersion?: string;
843
+ javaOptions?: string;
844
+ heapSize?: string;
845
+ pageCacheSize?: string;
846
+ noAuth?: boolean;
847
+ dataPath?: string;
848
+ timeout?: number;
849
+ wait?: number;
850
+ logsEndpoint?: string;
851
+ tag?: string;
852
+ resources?: ResourceRequirements;
853
+ security?: SecurityRequirements;
854
+ build?: boolean | BuildRequirements;
855
+ dockerfile?: string;
856
+ buildContext?: string;
857
+ buildArgs?: {
858
+ [k: string]: string;
859
+ };
860
+ buildTarget?: string;
861
+ prebuilt?: boolean;
862
+ noCache?: boolean;
863
+ secrets?: string[];
864
+ labels?: {
865
+ [k: string]: string;
866
+ };
867
+ annotations?: {
868
+ [k: string]: string;
869
+ };
870
+ dependencies?: string[];
871
+ externalDependencies?: (string | {
872
+ name?: string;
873
+ url?: string;
874
+ required?: boolean;
875
+ healthCheck?: string;
876
+ [k: string]: unknown;
877
+ })[];
878
+ environment?: {
879
+ [k: string]: string;
880
+ };
881
+ env?: {
882
+ [k: string]: string;
883
+ };
884
+ }
885
+ /**
886
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
887
+ * via the `definition` "FilesystemServiceConfig".
888
+ */
889
+ interface FilesystemServiceConfig {
890
+ platform: ServicePlatformConfig;
891
+ path: string;
892
+ description?: string;
893
+ command?: string;
894
+ image?: string;
895
+ port?: number;
896
+ timeout?: number;
897
+ wait?: number;
898
+ logsEndpoint?: string;
899
+ tag?: string;
900
+ resources?: ResourceRequirements;
901
+ security?: SecurityRequirements;
902
+ build?: boolean | BuildRequirements;
903
+ dockerfile?: string;
904
+ buildContext?: string;
905
+ buildArgs?: {
906
+ [k: string]: string;
907
+ };
908
+ buildTarget?: string;
909
+ prebuilt?: boolean;
910
+ noCache?: boolean;
911
+ secrets?: string[];
912
+ labels?: {
913
+ [k: string]: string;
914
+ };
915
+ annotations?: {
916
+ [k: string]: string;
917
+ };
918
+ dependencies?: string[];
919
+ externalDependencies?: (string | {
920
+ name?: string;
921
+ url?: string;
922
+ required?: boolean;
923
+ healthCheck?: string;
924
+ [k: string]: unknown;
925
+ })[];
926
+ environment?: {
927
+ [k: string]: string;
928
+ };
929
+ env?: {
930
+ [k: string]: string;
931
+ };
932
+ }
933
+ /**
934
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
935
+ * via the `definition` "InferenceServiceConfig".
936
+ */
937
+ interface InferenceServiceConfig {
938
+ platform: ServicePlatformConfig;
939
+ type: string;
940
+ model?: string;
941
+ maxTokens?: number;
942
+ endpoint?: string;
943
+ baseURL?: string;
944
+ apiKey: string;
945
+ command?: string;
946
+ image?: string;
947
+ port?: number;
948
+ organization?: string;
949
+ timeout?: number;
950
+ wait?: number;
951
+ logsEndpoint?: string;
952
+ tag?: string;
953
+ resources?: ResourceRequirements;
954
+ security?: SecurityRequirements;
955
+ build?: boolean | BuildRequirements;
956
+ dockerfile?: string;
957
+ buildContext?: string;
958
+ buildArgs?: {
959
+ [k: string]: string;
960
+ };
961
+ buildTarget?: string;
962
+ prebuilt?: boolean;
963
+ noCache?: boolean;
964
+ secrets?: string[];
965
+ labels?: {
966
+ [k: string]: string;
967
+ };
968
+ annotations?: {
969
+ [k: string]: string;
970
+ };
971
+ dependencies?: string[];
972
+ externalDependencies?: (string | {
973
+ name?: string;
974
+ url?: string;
975
+ required?: boolean;
976
+ healthCheck?: string;
977
+ [k: string]: unknown;
978
+ })[];
979
+ environment?: {
980
+ [k: string]: string;
981
+ };
982
+ env?: {
983
+ [k: string]: string;
984
+ };
985
+ }
986
+ /**
987
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
988
+ * via the `definition` "McpServiceConfig".
989
+ */
990
+ interface McpServiceConfig {
991
+ platform: ServicePlatformConfig;
992
+ command?: string;
993
+ image?: string;
994
+ port?: number;
995
+ dependsOn?: string[];
996
+ timeout?: number;
997
+ wait?: number;
998
+ logsEndpoint?: string;
999
+ tag?: string;
1000
+ resources?: ResourceRequirements;
1001
+ security?: SecurityRequirements;
1002
+ build?: boolean | BuildRequirements;
1003
+ dockerfile?: string;
1004
+ buildContext?: string;
1005
+ buildArgs?: {
1006
+ [k: string]: string;
1007
+ };
1008
+ buildTarget?: string;
1009
+ prebuilt?: boolean;
1010
+ noCache?: boolean;
1011
+ secrets?: string[];
1012
+ labels?: {
1013
+ [k: string]: string;
1014
+ };
1015
+ annotations?: {
1016
+ [k: string]: string;
1017
+ };
1018
+ dependencies?: string[];
1019
+ externalDependencies?: (string | {
1020
+ name?: string;
1021
+ url?: string;
1022
+ required?: boolean;
1023
+ healthCheck?: string;
1024
+ [k: string]: unknown;
1025
+ })[];
1026
+ environment?: {
1027
+ [k: string]: string;
1028
+ };
1029
+ env?: {
1030
+ [k: string]: string;
1031
+ };
1032
+ }
1033
+ /**
1034
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
1035
+ * via the `definition` "ServicesConfig".
1036
+ */
1037
+ interface ServicesConfig {
1038
+ backend?: BackendServiceConfig;
1039
+ frontend?: FrontendServiceConfig;
1040
+ database?: DatabaseServiceConfig;
1041
+ graph?: GraphServiceConfig;
1042
+ filesystem?: FilesystemServiceConfig;
1043
+ inference?: InferenceServiceConfig;
1044
+ mcp?: McpServiceConfig;
1045
+ [k: string]: unknown;
1046
+ }
1047
+ /**
1048
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
1049
+ * via the `definition` "SiteConfig".
1050
+ */
1051
+ interface SiteConfig {
1052
+ /**
1053
+ * Display name for the site
1054
+ */
1055
+ siteName?: string;
1056
+ /**
1057
+ * Primary domain for the site
1058
+ */
1059
+ domain: string;
1060
+ /**
1061
+ * Administrator email address
1062
+ */
1063
+ adminEmail?: string;
1064
+ /**
1065
+ * Support email address (optional)
1066
+ */
1067
+ supportEmail?: string;
1068
+ /**
1069
+ * Email domains allowed for OAuth authentication
1070
+ *
1071
+ * @minItems 1
1072
+ */
1073
+ oauthAllowedDomains?: [string, ...string[]];
1074
+ }
1075
+ /**
1076
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
1077
+ * via the `definition` "AppConfig".
1078
+ */
1079
+ interface AppConfig {
1080
+ features?: {
1081
+ enableAnalytics?: boolean;
1082
+ enableMaintenanceMode?: boolean;
1083
+ enableDebugLogging?: boolean;
1084
+ };
1085
+ security?: {
1086
+ /**
1087
+ * Session timeout in seconds
1088
+ */
1089
+ sessionTimeout?: number;
1090
+ /**
1091
+ * Maximum failed login attempts before lockout
1092
+ */
1093
+ maxLoginAttempts?: number;
1094
+ corsAllowedOrigins?: string[];
1095
+ /**
1096
+ * Enable local username/password authentication
1097
+ */
1098
+ enableLocalAuth?: boolean;
1099
+ /**
1100
+ * JWT signing secret (base64 encoded, 32+ bytes)
1101
+ */
1102
+ jwtSecret?: string;
1103
+ };
1104
+ performance?: {
1105
+ enableCaching?: boolean;
1106
+ /**
1107
+ * Cache timeout in seconds
1108
+ */
1109
+ cacheTimeout?: number;
1110
+ /**
1111
+ * Maximum request size (e.g., '10mb')
1112
+ */
1113
+ maxRequestSize?: string;
1114
+ };
1115
+ }
1116
+ /**
1117
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
1118
+ * via the `definition` "EnvironmentConfig".
1119
+ */
1120
+ interface EnvironmentConfig {
1121
+ /**
1122
+ * Optional comment for documentation
1123
+ */
1124
+ _comment?: string;
1125
+ _metadata?: {
1126
+ environment: string;
1127
+ projectRoot: string;
1128
+ [k: string]: unknown;
1129
+ };
1130
+ /**
1131
+ * Environment name
1132
+ */
1133
+ name?: string;
1134
+ platform?: {
1135
+ default?: PlatformType$1;
1136
+ [k: string]: unknown;
1137
+ };
1138
+ services: ServicesConfig;
1139
+ site?: SiteConfig;
1140
+ app?: AppConfig;
1141
+ env?: {
1142
+ NODE_ENV?: 'development' | 'production' | 'test';
1143
+ [k: string]: unknown;
1144
+ };
1145
+ deployment?: {
1146
+ imageTagStrategy?: 'mutable' | 'immutable' | 'git-hash';
1147
+ [k: string]: unknown;
1148
+ };
1149
+ }
1150
+ /**
1151
+ * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
1152
+ * via the `definition` "SemiontConfig".
1153
+ */
1154
+ interface SemiontConfig {
1155
+ /**
1156
+ * Config file version (semver)
1157
+ */
1158
+ version: string;
1159
+ /**
1160
+ * Project name
1161
+ */
1162
+ project: string;
1163
+ site: SiteConfig;
1164
+ app?: AppConfig;
1165
+ services?: ServicesConfig;
1166
+ }
1167
+
1168
+ /**
1169
+ * Platform Types Module
1170
+ *
1171
+ * Re-exports PlatformType from schema-generated types.
1172
+ * Platforms represent WHERE services run (infrastructure targets).
1173
+ */
1174
+
1175
+ /**
1176
+ * Platform type literals from JSON Schema
1177
+ * These represent the infrastructure targets where services can be deployed
1178
+ */
1179
+ type PlatformType = PlatformType$1;
1180
+ /**
1181
+ * Type guard to check if a string is a valid platform type
1182
+ *
1183
+ * @param value - Value to check
1184
+ * @returns True if value is a valid PlatformType
1185
+ */
1186
+ declare function isValidPlatformType(value: string): value is PlatformType;
1187
+ /**
1188
+ * Get all valid platform types
1189
+ *
1190
+ * @returns Array of all platform types
1191
+ */
1192
+ declare function getAllPlatformTypes(): PlatformType[];
1193
+
1194
+ /**
1195
+ * Environment Loader Module
1196
+ *
1197
+ * Responsible for loading and merging environment configurations.
1198
+ * Handles semiont.json base config and environment-specific overrides.
1199
+ */
1200
+
1201
+ /**
1202
+ * Generic service configuration
1203
+ * Platform-specific fields should be accessed through platform-specific interfaces
1204
+ */
1205
+ interface ServiceConfig {
1206
+ platform?: {
1207
+ type: PlatformType;
1208
+ };
1209
+ port?: number;
1210
+ name?: string;
1211
+ [key: string]: any;
1212
+ }
1213
+ interface AWSConfig {
1214
+ region: string;
1215
+ accountId: string;
1216
+ certificateArn?: string;
1217
+ hostedZoneId?: string;
1218
+ rootDomain?: string;
1219
+ stacks?: {
1220
+ data?: string;
1221
+ app?: string;
1222
+ };
1223
+ database?: {
1224
+ name?: string;
1225
+ instanceClass?: string;
1226
+ allocatedStorage?: number;
1227
+ backupRetentionDays?: number;
1228
+ multiAZ?: boolean;
1229
+ };
1230
+ ecs?: {
1231
+ desiredCount?: number;
1232
+ minCapacity?: number;
1233
+ maxCapacity?: number;
1234
+ };
1235
+ monitoring?: {
1236
+ enableDetailedMonitoring?: boolean;
1237
+ logRetentionDays?: number;
1238
+ };
1239
+ }
1240
+ /**
1241
+ * Load environment configuration
1242
+ * Merges semiont.json with environment-specific config
1243
+ *
1244
+ * @param projectRoot - Absolute path to project directory containing semiont.json
1245
+ * @param environment - Environment name (must match a file in environments/)
1246
+ * @returns Merged environment configuration
1247
+ * @throws ConfigurationError if files are missing or invalid
1248
+ */
1249
+ declare function loadEnvironmentConfig(projectRoot: string, environment: string): EnvironmentConfig;
1250
+ /**
1251
+ * Get NODE_ENV value from environment config
1252
+ *
1253
+ * @param config - Environment configuration
1254
+ * @returns NODE_ENV value (defaults to 'development' if not specified)
1255
+ */
1256
+ declare function getNodeEnvForEnvironment(config: EnvironmentConfig): 'development' | 'production' | 'test';
1257
+ /**
1258
+ * Get available environments by scanning environments directory
1259
+ *
1260
+ * @returns Array of environment names
1261
+ */
1262
+ declare function getAvailableEnvironments(): string[];
1263
+
1264
+ /**
1265
+ * Environment validation utilities
1266
+ */
1267
+ type Environment = string;
1268
+ /**
1269
+ * Type guard to check if a string is a valid Environment
1270
+ */
1271
+ declare function isValidEnvironment(value: string | undefined): value is Environment;
1272
+ /**
1273
+ * Parse environment string to Environment type
1274
+ * @param value - The environment string to parse
1275
+ * @returns Valid Environment type
1276
+ * @throws Error if environment is invalid or not provided
1277
+ */
1278
+ declare function parseEnvironment(value: string | undefined): Environment;
1279
+ /**
1280
+ * Validate and return environment or throw error
1281
+ * @param value - The environment string to validate
1282
+ * @throws Error if environment is invalid
1283
+ */
1284
+ declare function validateEnvironment(value: string | undefined): Environment;
1285
+
1286
+ /**
1287
+ * Configuration Error Class
1288
+ *
1289
+ * Custom error class for configuration validation and loading errors.
1290
+ * Provides structured error information with helpful suggestions.
1291
+ */
1292
+ declare class ConfigurationError extends Error {
1293
+ environment?: string | undefined;
1294
+ suggestion?: string | undefined;
1295
+ readonly cause?: Error;
1296
+ constructor(message: string, environment?: string | undefined, suggestion?: string | undefined, cause?: Error);
1297
+ /**
1298
+ * Format the error nicely for CLI output
1299
+ */
1300
+ toString(): string;
1301
+ }
1302
+
1303
+ /**
1304
+ * Project Discovery Module
1305
+ *
1306
+ * Responsible for finding the Semiont project root directory.
1307
+ * Looks for semiont.json or environments directory to identify a valid project.
1308
+ */
1309
+ /**
1310
+ * Find project root - returns SEMIONT_ROOT environment variable
1311
+ *
1312
+ * @returns The absolute path to the project root
1313
+ * @throws ConfigurationError if SEMIONT_ROOT is not set or invalid
1314
+ */
1315
+ declare function findProjectRoot(): string;
1316
+ /**
1317
+ * Check if a path looks like a Semiont project root
1318
+ *
1319
+ * @param projectPath - Path to check
1320
+ * @returns True if path contains semiont.json or environments directory
1321
+ */
1322
+ declare function isProjectRoot(projectPath: string): boolean;
1323
+ /**
1324
+ * Get the path to the environments directory
1325
+ *
1326
+ * @param projectRoot - Project root directory (optional, will find if not provided)
1327
+ * @returns Path to environments directory
1328
+ */
1329
+ declare function getEnvironmentsPath(projectRoot?: string): string;
1330
+ /**
1331
+ * Get the path to semiont.json
1332
+ *
1333
+ * @param projectRoot - Project root directory (optional, will find if not provided)
1334
+ * @returns Path to semiont.json
1335
+ */
1336
+ declare function getSemiontConfigPath(projectRoot?: string): string;
1337
+
1338
+ /**
1339
+ * Config Schema Validator
1340
+ *
1341
+ * Validates configuration data against JSON Schema using Ajv (JSON Schema validator).
1342
+ * Provides runtime validation for semiont.json and environment config files.
1343
+ */
1344
+
1345
+ interface ValidationResult {
1346
+ valid: boolean;
1347
+ errors: ErrorObject[] | null;
1348
+ errorMessage?: string;
1349
+ }
1350
+ /**
1351
+ * Validate semiont.json config
1352
+ */
1353
+ declare function validateSemiontConfig(data: unknown): ValidationResult;
1354
+ /**
1355
+ * Validate environment config (environments/*.json)
1356
+ */
1357
+ declare function validateEnvironmentConfig(data: unknown): ValidationResult;
1358
+ /**
1359
+ * Validate site config
1360
+ */
1361
+ declare function validateSiteConfig(data: unknown): ValidationResult;
1362
+
1
1363
  /**
2
1364
  * @semiont/core
3
1365
  *
4
1366
  * Core domain logic and utilities for the Semiont semantic knowledge platform.
5
1367
  * For OpenAPI types, import directly from @semiont/api-client.
6
1368
  */
7
- export { CREATION_METHODS } from './creation-methods';
8
- export type { CreationMethod } from './creation-methods';
9
- export type { ResourceId, AnnotationId, UserId } from './identifiers';
10
- export { resourceId, annotationId, userId, isResourceId, isAnnotationId, } from './identifiers';
11
- export type { GraphConnection, GraphPath, EntityTypeStats, } from './graph';
12
- export type { BaseEvent, ResourceEvent, ResourceEventType, SystemEvent, ResourceScopedEvent, ResourceCreatedEvent, ResourceClonedEvent, ResourceArchivedEvent, ResourceUnarchivedEvent, AnnotationAddedEvent, AnnotationRemovedEvent, AnnotationBodyUpdatedEvent, JobStartedEvent, JobProgressEvent, JobCompletedEvent, JobFailedEvent, BodyOperation, BodyItem, EntityTagAddedEvent, EntityTagRemovedEvent, EventMetadata, EventSignature, StoredEvent, EventQuery, ResourceAnnotations, } from './events';
13
- export { isResourceEvent, isSystemEvent, isResourceScopedEvent, getEventType, } from './events';
14
- export { bodyItemsMatch, findBodyItem } from './annotation-utils';
15
- export type { UpdateResourceInput, ResourceFilter } from './resource-types';
16
- export type { AnnotationCategory, CreateAnnotationInternal } from './annotation-types';
17
- export type { GoogleAuthRequest } from './auth-types';
18
- export * from './type-guards';
19
- export * from './crypto';
20
- export * from './errors';
21
- export * from './http-client';
22
- export * from './annotation-history-utils';
23
- export * from './did-utils';
24
- export { loadEnvironmentConfig, getAvailableEnvironments, getNodeEnvForEnvironment, type EnvironmentConfig, type ServiceConfig, type AWSConfig, type SiteConfig, type AppConfig, } from './config/environment-loader';
25
- export { isValidEnvironment, parseEnvironment, validateEnvironment, type Environment, } from './config/environment-validator';
26
- export { ConfigurationError } from './config/configuration-error';
27
- export { findProjectRoot, isProjectRoot, getEnvironmentsPath, getSemiontConfigPath, } from './config/project-discovery';
28
- export { type PlatformType, isValidPlatformType, getAllPlatformTypes, } from './config/platform-types';
29
- export type { BackendServiceConfig, FrontendServiceConfig, DatabaseServiceConfig, GraphServiceConfig, FilesystemServiceConfig, InferenceServiceConfig, McpServiceConfig, ServicesConfig, SemiontConfig, GraphDatabaseType, ServicePlatformConfig } from './config/config.types';
30
- export { validateSemiontConfig, validateEnvironmentConfig, validateSiteConfig, type ValidationResult, } from './config/config-validator';
31
- export declare const CORE_TYPES_VERSION = "0.1.0";
32
- export declare const SDK_VERSION = "0.1.0";
33
- //# sourceMappingURL=index.d.ts.map
1369
+
1370
+ declare const CORE_TYPES_VERSION = "0.1.0";
1371
+ declare const SDK_VERSION = "0.1.0";
1372
+
1373
+ export { APIError, type AWSConfig, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationRemovedEvent, type AppConfig, type BackendServiceConfig, type BaseEvent, type BodyItem, type BodyOperation, CORE_TYPES_VERSION, CREATION_METHODS, ConfigurationError, ConflictError, type CreateAnnotationInternal, type CreationMethod, type DatabaseServiceConfig, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityTypeStats, type Environment, type EnvironmentConfig, type EventMetadata, type EventQuery, type EventSignature, type FilesystemServiceConfig, type FrontendServiceConfig, type GoogleAuthRequest, type GraphConnection, type GraphDatabaseType, type GraphPath, type GraphServiceConfig, type HttpClientConfig, type InferenceServiceConfig, type JobCompletedEvent, type JobFailedEvent, type JobProgressEvent, type JobStartedEvent, type McpServiceConfig, NotFoundError, type PlatformType, type ResourceAnnotations, type ResourceArchivedEvent, type ResourceClonedEvent, type ResourceCreatedEvent, type ResourceCreationDetails, type ResourceEvent, type ResourceEventType, type ResourceFilter, type ResourceId, type ResourceScopedEvent, type ResourceUnarchivedEvent, SDK_VERSION, ScriptError, type SemiontConfig, SemiontError, type ServiceConfig, type ServicePlatformConfig, type ServicesConfig, type SiteConfig, type StoredEvent, type SystemEvent, UnauthorizedError, type UpdateResourceInput, type UserId, ValidationError, type ValidationResult, annotationId, bodyItemsMatch, calculateChecksum, createFetchAPI, didToAgent, fetchAPI, findBodyItem, findProjectRoot, formatEventType, formatRelativeTime, generateId, generateToken, generateUuid, getAllPlatformTypes, getAnnotationIdFromEvent, getAvailableEnvironments, getEnvironmentsPath, getEventDisplayContent, getEventEmoji, getEventEntityTypes, getEventType, getNodeEnvForEnvironment, getResourceCreationDetails, getSemiontConfigPath, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isProjectRoot, isResourceEvent, isResourceId, isResourceScopedEvent, isString, isSystemEvent, isUndefined, isValidEnvironment, isValidPlatformType, loadEnvironmentConfig, parseEnvironment, resourceId, userId, userToAgent, userToDid, validateEnvironment, validateEnvironmentConfig, validateSemiontConfig, validateSiteConfig, verifyChecksum };