@semiont/core 0.4.7 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Subject, OperatorFunction } from 'rxjs';
2
- import { E as EnvironmentConfig, P as PlatformType$1 } from './config.types-D3ReOdqd.js';
3
- export { A as AnthropicProviderConfig, a as AppConfig, B as BackendServiceConfig, D as DatabaseServiceConfig, F as FrontendServiceConfig, G as GraphDatabaseType, b as GraphServiceConfig, I as InferenceProvidersConfig, M as McpServiceConfig, O as OllamaProviderConfig, c as ProxyServiceConfig, S as SemiontConfig, d as ServicePlatformConfig, e as ServicesConfig, f as SiteConfig } from './config.types-D3ReOdqd.js';
2
+ import { E as EnvironmentConfig, P as PlatformType$1 } from './config.types-CsLA0pTY.js';
3
+ export { A as AnthropicProviderConfig, a as AppConfig, B as BackendServiceConfig, D as DatabaseServiceConfig, F as FrontendServiceConfig, G as GraphDatabaseType, b as GraphServiceConfig, I as InferenceProvidersConfig, M as McpServiceConfig, O as OllamaProviderConfig, S as SemiontConfig, c as ServicePlatformConfig, d as ServicesConfig, e as SiteConfig } from './config.types-CsLA0pTY.js';
4
4
 
5
5
  /**
6
6
  * This file was auto-generated by openapi-typescript.
@@ -566,6 +566,58 @@ interface paths {
566
566
  patch?: never;
567
567
  trace?: never;
568
568
  };
569
+ "/api/tokens/media": {
570
+ parameters: {
571
+ query?: never;
572
+ header?: never;
573
+ path?: never;
574
+ cookie?: never;
575
+ };
576
+ get?: never;
577
+ put?: never;
578
+ /**
579
+ * Generate Media Token
580
+ * @description Generate a short-lived, resource-scoped media token for use as a ?token= query parameter on binary resource URLs (images, PDFs). Requires session authentication.
581
+ */
582
+ post: {
583
+ parameters: {
584
+ query?: never;
585
+ header?: never;
586
+ path?: never;
587
+ cookie?: never;
588
+ };
589
+ requestBody: {
590
+ content: {
591
+ "application/json": components["schemas"]["MediaTokenRequest"];
592
+ };
593
+ };
594
+ responses: {
595
+ /** @description Media token generated */
596
+ 200: {
597
+ headers: {
598
+ [name: string]: unknown;
599
+ };
600
+ content: {
601
+ "application/json": components["schemas"]["MediaTokenResponse"];
602
+ };
603
+ };
604
+ /** @description Unauthorized */
605
+ 401: {
606
+ headers: {
607
+ [name: string]: unknown;
608
+ };
609
+ content: {
610
+ "application/json": components["schemas"]["ErrorResponse"];
611
+ };
612
+ };
613
+ };
614
+ };
615
+ delete?: never;
616
+ options?: never;
617
+ head?: never;
618
+ patch?: never;
619
+ trace?: never;
620
+ };
569
621
  "/api/users/me": {
570
622
  parameters: {
571
623
  query?: never;
@@ -1781,6 +1833,73 @@ interface paths {
1781
1833
  patch?: never;
1782
1834
  trace?: never;
1783
1835
  };
1836
+ "/resources/{id}/match-search-stream": {
1837
+ parameters: {
1838
+ query?: never;
1839
+ header?: never;
1840
+ path?: never;
1841
+ cookie?: never;
1842
+ };
1843
+ get?: never;
1844
+ put?: never;
1845
+ /**
1846
+ * Match Search (SSE Stream)
1847
+ * @description Search for binding candidates for a reference annotation via Server-Sent Events. Delegates to the Matcher actor on the backend EventBus.
1848
+ */
1849
+ post: {
1850
+ parameters: {
1851
+ query?: never;
1852
+ header?: never;
1853
+ path: {
1854
+ /** @description Resource ID */
1855
+ id: string;
1856
+ };
1857
+ cookie?: never;
1858
+ };
1859
+ requestBody: {
1860
+ content: {
1861
+ "application/json": components["schemas"]["MatchSearchStreamRequest"];
1862
+ };
1863
+ };
1864
+ responses: {
1865
+ /** @description SSE stream opened successfully */
1866
+ 200: {
1867
+ headers: {
1868
+ [name: string]: unknown;
1869
+ };
1870
+ content: {
1871
+ "text/event-stream": components["schemas"]["EventStreamResponse"];
1872
+ };
1873
+ };
1874
+ /** @description referenceId and context are required */
1875
+ 400: {
1876
+ headers: {
1877
+ [name: string]: unknown;
1878
+ };
1879
+ content?: never;
1880
+ };
1881
+ /** @description Authentication required */
1882
+ 401: {
1883
+ headers: {
1884
+ [name: string]: unknown;
1885
+ };
1886
+ content?: never;
1887
+ };
1888
+ /** @description Resource not found */
1889
+ 404: {
1890
+ headers: {
1891
+ [name: string]: unknown;
1892
+ };
1893
+ content?: never;
1894
+ };
1895
+ };
1896
+ };
1897
+ delete?: never;
1898
+ options?: never;
1899
+ head?: never;
1900
+ patch?: never;
1901
+ trace?: never;
1902
+ };
1784
1903
  "/resources/{resourceId}/annotations/{annotationId}/gather-annotation-stream": {
1785
1904
  parameters: {
1786
1905
  query?: never;
@@ -3200,6 +3319,8 @@ interface components {
3200
3319
  includeDescriptiveReferences?: boolean;
3201
3320
  };
3202
3321
  GatherResourceStreamRequest: {
3322
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
3323
+ correlationId?: string;
3203
3324
  /** @description Graph traversal depth (default: 2) */
3204
3325
  depth?: number;
3205
3326
  /** @description Maximum related resources to include (default: 10) */
@@ -3210,6 +3331,8 @@ interface components {
3210
3331
  includeSummary?: boolean;
3211
3332
  };
3212
3333
  GatherAnnotationStreamRequest: {
3334
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
3335
+ correlationId?: string;
3213
3336
  /** @description Characters of surrounding text context (default: 1000) */
3214
3337
  contextWindow?: number;
3215
3338
  };
@@ -3741,6 +3864,7 @@ interface components {
3741
3864
  domain: string;
3742
3865
  provider: string;
3743
3866
  isAdmin: boolean;
3867
+ isModerator: boolean;
3744
3868
  isActive: boolean;
3745
3869
  termsAcceptedAt: string | null;
3746
3870
  lastLogin: string | null;
@@ -3774,6 +3898,14 @@ interface components {
3774
3898
  * @enum {string}
3775
3899
  */
3776
3900
  BodyPurpose: "assessing" | "bookmarking" | "classifying" | "commenting" | "describing" | "editing" | "highlighting" | "identifying" | "linking" | "moderating" | "questioning" | "replying" | "tagging";
3901
+ MediaTokenRequest: {
3902
+ /** @description The resource ID to generate a media token for */
3903
+ resourceId: string;
3904
+ };
3905
+ MediaTokenResponse: {
3906
+ /** @description Short-lived media token for use as ?token= query parameter on resource URLs */
3907
+ token: string;
3908
+ };
3777
3909
  /** @description Context gathered for an annotation. Includes source document excerpts, metadata, and graph-derived context. Used by both Find (bind) and Generate (yield) flows. */
3778
3910
  GatheredContext: {
3779
3911
  /** @description The annotation this context was gathered for */
@@ -3830,6 +3962,18 @@ interface components {
3830
3962
  inferredRelationshipSummary?: string;
3831
3963
  };
3832
3964
  };
3965
+ MatchSearchStreamRequest: {
3966
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
3967
+ correlationId?: string;
3968
+ /** @description Annotation ID of the reference to search candidates for */
3969
+ referenceId: string;
3970
+ /** @description Gathered context for the reference annotation */
3971
+ context: components["schemas"]["GatheredContext"];
3972
+ /** @description Maximum number of candidate results to return (default: 10) */
3973
+ limit?: number;
3974
+ /** @description Enable semantic similarity scoring in addition to keyword matching (default: true) */
3975
+ useSemanticScoring?: boolean;
3976
+ };
3833
3977
  };
3834
3978
  responses: never;
3835
3979
  parameters: never;
@@ -4259,6 +4403,27 @@ interface ResourceAnnotations {
4259
4403
  * No React dependencies - safe to use in any JavaScript environment.
4260
4404
  */
4261
4405
 
4406
+ /**
4407
+ * Minimal event shape accepted by event utility functions.
4408
+ * Compatible with both the internal `StoredEvent` type and the OpenAPI-derived
4409
+ * schema type (`GetEventsResponse['events'][number]`), which lacks `version`
4410
+ * on the inner event.
4411
+ */
4412
+ interface StoredEventLike {
4413
+ event: {
4414
+ id: string;
4415
+ type: string;
4416
+ timestamp: string;
4417
+ userId: string;
4418
+ resourceId?: string;
4419
+ payload?: unknown;
4420
+ };
4421
+ metadata: {
4422
+ sequenceNumber: number;
4423
+ prevEventHash?: string;
4424
+ checksum?: string;
4425
+ };
4426
+ }
4262
4427
  /**
4263
4428
  * Extract annotation ID from event payload
4264
4429
  * Returns null if event is not annotation-related
@@ -4266,11 +4431,11 @@ interface ResourceAnnotations {
4266
4431
  * For annotation.added: extracts full URI from payload.annotation.id
4267
4432
  * For annotation.removed/body.updated: constructs full URI from payload.annotationId (UUID) + resourceId
4268
4433
  */
4269
- declare function getAnnotationUriFromEvent(event: StoredEvent): AnnotationUri | null;
4434
+ declare function getAnnotationUriFromEvent(event: StoredEventLike): AnnotationUri | null;
4270
4435
  /**
4271
4436
  * Check if an event is related to a specific annotation
4272
4437
  */
4273
- declare function isEventRelatedToAnnotation(event: StoredEvent, annotationUri: AnnotationUri): boolean;
4438
+ declare function isEventRelatedToAnnotation(event: StoredEventLike, annotationUri: AnnotationUri): boolean;
4274
4439
  /**
4275
4440
  * Type guard to check if event is a resource event
4276
4441
  */
@@ -4373,7 +4538,11 @@ type EventMap = {
4373
4538
  'yield:progress': YieldProgress;
4374
4539
  'yield:finished': YieldProgress;
4375
4540
  'yield:failed': {
4376
- error: Error;
4541
+ error?: Error | string;
4542
+ status?: string;
4543
+ referenceId?: string;
4544
+ percentage?: number;
4545
+ message?: string;
4377
4546
  };
4378
4547
  'yield:representation-added': Extract<ResourceEvent, {
4379
4548
  type: 'representation.added';
@@ -4536,15 +4705,24 @@ type EventMap = {
4536
4705
  categories?: string[];
4537
4706
  };
4538
4707
  };
4539
- 'mark:progress': MarkProgress;
4708
+ 'mark:progress': MarkProgress & {
4709
+ resourceId?: ResourceId;
4710
+ };
4540
4711
  'mark:assist-finished': {
4541
4712
  motivation?: Motivation;
4542
4713
  resourceId?: ResourceId;
4714
+ status?: string;
4715
+ percentage?: number;
4716
+ foundCount?: number;
4717
+ createdCount?: number;
4718
+ byCategory?: Record<string, number>;
4719
+ message?: string;
4543
4720
  progress?: MarkProgress;
4544
4721
  };
4545
- 'mark:assist-failed': Extract<ResourceEvent, {
4546
- type: 'job.failed';
4547
- }>;
4722
+ 'mark:assist-failed': {
4723
+ resourceId?: ResourceId;
4724
+ message?: string;
4725
+ };
4548
4726
  'mark:assist-cancelled': void;
4549
4727
  'mark:progress-dismiss': void;
4550
4728
  'mark:mode-toggled': void;
@@ -4636,27 +4814,27 @@ type EventMap = {
4636
4814
  error: Error;
4637
4815
  };
4638
4816
  'match:search-requested': {
4639
- correlationId?: string;
4817
+ correlationId: string;
4640
4818
  referenceId: string;
4641
4819
  context: GatheredContext;
4642
4820
  limit?: number;
4643
4821
  useSemanticScoring?: boolean;
4644
4822
  };
4645
4823
  'match:search-results': {
4824
+ correlationId: string;
4646
4825
  referenceId: string;
4647
- results: Array<components['schemas']['ResourceDescriptor'] & {
4826
+ response: Array<components['schemas']['ResourceDescriptor'] & {
4648
4827
  score?: number;
4649
4828
  matchReason?: string;
4650
4829
  }>;
4651
- correlationId?: string;
4652
4830
  };
4653
4831
  'match:search-failed': {
4832
+ correlationId: string;
4654
4833
  referenceId: string;
4655
- error: Error;
4656
- correlationId?: string;
4834
+ error: string;
4657
4835
  };
4658
4836
  'gather:requested': {
4659
- correlationId?: string;
4837
+ correlationId: string;
4660
4838
  annotationId: AnnotationId;
4661
4839
  resourceId: ResourceId;
4662
4840
  options?: {
@@ -4666,12 +4844,12 @@ type EventMap = {
4666
4844
  };
4667
4845
  };
4668
4846
  'gather:complete': {
4669
- correlationId?: string;
4847
+ correlationId: string;
4670
4848
  annotationId: AnnotationId;
4671
4849
  response: components['schemas']['AnnotationLLMContextResponse'];
4672
4850
  };
4673
4851
  'gather:failed': {
4674
- correlationId?: string;
4852
+ correlationId: string;
4675
4853
  annotationId: AnnotationId;
4676
4854
  error: Error;
4677
4855
  };
@@ -4680,12 +4858,12 @@ type EventMap = {
4680
4858
  percentage?: number;
4681
4859
  };
4682
4860
  'gather:annotation-finished': {
4683
- correlationId?: string;
4861
+ correlationId: string;
4684
4862
  annotationId: AnnotationId;
4685
4863
  response: components['schemas']['AnnotationLLMContextResponse'];
4686
4864
  };
4687
4865
  'gather:resource-requested': {
4688
- correlationId?: string;
4866
+ correlationId: string;
4689
4867
  resourceId: ResourceId;
4690
4868
  options: {
4691
4869
  depth: number;
@@ -4695,12 +4873,12 @@ type EventMap = {
4695
4873
  };
4696
4874
  };
4697
4875
  'gather:resource-complete': {
4698
- correlationId?: string;
4876
+ correlationId: string;
4699
4877
  resourceId: ResourceId;
4700
- context: components['schemas']['ResourceLLMContextResponse'];
4878
+ response: components['schemas']['ResourceLLMContextResponse'];
4701
4879
  };
4702
4880
  'gather:resource-failed': {
4703
- correlationId?: string;
4881
+ correlationId: string;
4704
4882
  resourceId: ResourceId;
4705
4883
  error: Error;
4706
4884
  };
@@ -4709,9 +4887,9 @@ type EventMap = {
4709
4887
  percentage?: number;
4710
4888
  };
4711
4889
  'gather:finished': {
4712
- correlationId?: string;
4890
+ correlationId: string;
4713
4891
  resourceId: ResourceId;
4714
- context: components['schemas']['ResourceLLMContextResponse'];
4892
+ response: components['schemas']['ResourceLLMContextResponse'];
4715
4893
  };
4716
4894
  'browse:click': {
4717
4895
  annotationId: string;
@@ -4955,6 +5133,7 @@ type EventMap = {
4955
5133
  'settings:hover-delay-changed': {
4956
5134
  hoverDelayMs: number;
4957
5135
  };
5136
+ 'stream-connected': Record<string, never>;
4958
5137
  };
4959
5138
  /**
4960
5139
  * Union type of all valid event names
@@ -5482,13 +5661,13 @@ type TomlFileReader = {
5482
5661
  * @param reader - File reader abstraction
5483
5662
  * @param env - Environment variables for ${VAR} resolution
5484
5663
  */
5485
- declare function loadTomlConfig(projectRoot: string, environment: string, globalConfigPath: string, reader: TomlFileReader, env: Record<string, string | undefined>): EnvironmentConfig;
5664
+ declare function loadTomlConfig(projectRoot: string | null, environment: string, globalConfigPath: string, reader: TomlFileReader, env: Record<string, string | undefined>): EnvironmentConfig;
5486
5665
  /**
5487
5666
  * Create a TOML config loader backed by a file reader.
5488
5667
  * Drop-in replacement for createConfigLoader that reads TOML instead of JSON.
5489
5668
  * The caller must resolve globalConfigPath (e.g. expand '~' using process.env.HOME).
5490
5669
  */
5491
- declare function createTomlConfigLoader(reader: TomlFileReader, globalConfigPath: string, env: Record<string, string | undefined>): (projectRoot: string, environment: string) => EnvironmentConfig;
5670
+ declare function createTomlConfigLoader(reader: TomlFileReader, globalConfigPath: string, env: Record<string, string | undefined>): (projectRoot: string | null, environment: string) => EnvironmentConfig;
5492
5671
 
5493
5672
  /**
5494
5673
  * Environment validation utilities
@@ -5565,4 +5744,4 @@ declare function getAllPlatformTypes(): PlatformType[];
5565
5744
  declare const CORE_TYPES_VERSION = "0.1.0";
5566
5745
  declare const SDK_VERSION = "0.1.0";
5567
5746
 
5568
- export { APIError, type AccessToken, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationRemovedEvent, type AnnotationUri, type AssembledAnnotation, type AuthCode, type BaseEvent, type BaseUrl, type BodyItem, type BodyOperation, type BurstBufferOptions, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, ConfigurationError, ConflictError, type ContentFormat$1 as ContentFormat, type CreateAnnotationInternal, type CreationMethod, type Email, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityType, type EntityTypeStats, type Environment, EnvironmentConfig, EventBus, type EventMap, type EventMetadata, type EventName, type EventQuery, type EventSignature, type GatheredContext, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphPath, type JobCompletedEvent, type JobFailedEvent, type JobId, type JobProgressEvent, type JobStartedEvent, type Logger, type MCPToken, type MarkProgress, type Motivation$2 as Motivation, NotFoundError, type PlatformType, type RefreshToken, type RepresentationAddedEvent, type RepresentationRemovedEvent, type ResourceAnnotationUri, type ResourceAnnotations, type ResourceArchivedEvent, type ResourceClonedEvent, type ResourceCreatedEvent, type ResourceEvent, type ResourceEventType, type ResourceFilter, type ResourceId, type ResourceScopedEvent, type ResourceUnarchivedEvent, type ResourceUri, SDK_VERSION, ScopedEventBus, ScriptError, type SearchQuery, type SelectionData, type Selector, SemiontError, type StoredEvent, type SystemEvent, type ActorInferenceConfig as TomlActorInferenceConfig, type TomlFileReader, type InferenceConfig as TomlInferenceConfig, type WorkerInferenceConfig as TomlWorkerInferenceConfig, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type YieldProgress, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, type components, createTomlConfigLoader, didToAgent, email, entityType, findBodyItem, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getFragmentSelector, getSvgSelector, getTextPositionSelector, googleCredential, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent$1 as isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, loadTomlConfig, mcpToken, type operations, parseEnvironment, type paths, refreshToken, resourceAnnotationUri, resourceId, resourceUri, searchQuery, userDID, userId, userToAgent, userToDid, validateEnvironment, validateSvgMarkup };
5747
+ export { APIError, type AccessToken, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationRemovedEvent, type AnnotationUri, type AssembledAnnotation, type AuthCode, type BaseEvent, type BaseUrl, type BodyItem, type BodyOperation, type BurstBufferOptions, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, ConfigurationError, ConflictError, type ContentFormat$1 as ContentFormat, type CreateAnnotationInternal, type CreationMethod, type Email, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityType, type EntityTypeStats, type Environment, EnvironmentConfig, EventBus, type EventMap, type EventMetadata, type EventName, type EventQuery, type EventSignature, type GatheredContext, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphPath, type JobCompletedEvent, type JobFailedEvent, type JobId, type JobProgressEvent, type JobStartedEvent, type Logger, type MCPToken, type MarkProgress, type Motivation$2 as Motivation, NotFoundError, type PlatformType, type RefreshToken, type RepresentationAddedEvent, type RepresentationRemovedEvent, type ResourceAnnotationUri, type ResourceAnnotations, type ResourceArchivedEvent, type ResourceClonedEvent, type ResourceCreatedEvent, type ResourceEvent, type ResourceEventType, type ResourceFilter, type ResourceId, type ResourceScopedEvent, type ResourceUnarchivedEvent, type ResourceUri, SDK_VERSION, ScopedEventBus, ScriptError, type SearchQuery, type SelectionData, type Selector, SemiontError, type StoredEvent, type StoredEventLike, type SystemEvent, type ActorInferenceConfig as TomlActorInferenceConfig, type TomlFileReader, type InferenceConfig as TomlInferenceConfig, type WorkerInferenceConfig as TomlWorkerInferenceConfig, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type YieldProgress, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, type components, createTomlConfigLoader, didToAgent, email, entityType, findBodyItem, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getFragmentSelector, getSvgSelector, getTextPositionSelector, googleCredential, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent$1 as isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, loadTomlConfig, mcpToken, type operations, parseEnvironment, type paths, refreshToken, resourceAnnotationUri, resourceId, resourceUri, searchQuery, userDID, userId, userToAgent, userToDid, validateEnvironment, validateSvgMarkup };
package/dist/index.js CHANGED
@@ -111,15 +111,16 @@ function getEventType(event) {
111
111
  // src/event-utils.ts
112
112
  function getAnnotationUriFromEvent(event) {
113
113
  const eventData = event.event;
114
+ const payload = eventData.payload;
114
115
  if (eventData.type === "annotation.added") {
115
- return eventData.payload.annotation.id || null;
116
+ return payload?.annotation?.id || null;
116
117
  }
117
118
  if (eventData.type === "annotation.removed" || eventData.type === "annotation.body.updated") {
118
- if (eventData.payload.annotationId && eventData.resourceId) {
119
+ if (payload?.annotationId && eventData.resourceId) {
119
120
  try {
120
121
  const resourceUri2 = eventData.resourceId;
121
122
  const baseUrl2 = resourceUri2.substring(0, resourceUri2.lastIndexOf("/resources/"));
122
- return `${baseUrl2}/annotations/${eventData.payload.annotationId}`;
123
+ return `${baseUrl2}/annotations/${payload.annotationId}`;
123
124
  } catch (e) {
124
125
  return null;
125
126
  }
@@ -610,13 +611,15 @@ function requirePlatform(value, serviceName) {
610
611
  return value;
611
612
  }
612
613
  function loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env) {
613
- const projectConfigContent = reader.readIfExists(`${projectRoot}/.semiont/config`);
614
+ const projectConfigContent = projectRoot ? reader.readIfExists(`${projectRoot}/.semiont/config`) : null;
614
615
  let projectName = "semiont-project";
616
+ let projectVersion;
615
617
  let projectSite;
616
618
  let projectEnvSection = {};
617
619
  if (projectConfigContent) {
618
620
  const projectConfig = parse(projectConfigContent);
619
621
  projectName = projectConfig.project?.name ?? projectName;
622
+ projectVersion = projectConfig.project?.version;
620
623
  projectSite = projectConfig.site;
621
624
  projectEnvSection = projectConfig.environments?.[environment] ?? {};
622
625
  }
@@ -751,45 +754,46 @@ function loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env)
751
754
  topLevelActors["matcher"] = { inference: { type: makeMeaningSection.actors.matcher.inference.type, model: makeMeaningSection.actors.matcher.inference.model } };
752
755
  }
753
756
  const frontend = resolved.frontend;
754
- const proxy = resolved.proxy;
757
+ const services = {};
758
+ if (backend) {
759
+ services.backend = {
760
+ platform: { type: requirePlatform(backend.platform, "backend") },
761
+ port: backend.port ?? 4e3,
762
+ publicURL: backend.publicURL ?? `http://localhost:${backend.port ?? 4e3}`,
763
+ corsOrigin: backend.corsOrigin ?? backend.frontendURL ?? "http://localhost:3000"
764
+ };
765
+ }
766
+ if (frontend) {
767
+ services.frontend = {
768
+ platform: { type: requirePlatform(frontend.platform, "frontend") },
769
+ port: frontend.port ?? 3e3,
770
+ siteName: site?.siteName ?? "Semiont",
771
+ publicURL: frontend.publicURL
772
+ };
773
+ }
774
+ if (resolved.graph) {
775
+ services.graph = {
776
+ ...resolved.graph,
777
+ platform: { type: requirePlatform(resolved.graph.platform, "graph") },
778
+ type: resolved.graph.type ?? "neo4j"
779
+ };
780
+ } else if (makeMeaningSection?.graph) {
781
+ services.graph = makeMeaningSection.graph;
782
+ }
783
+ if (resolved.database) {
784
+ services.database = {
785
+ platform: { type: requirePlatform(resolved.database.platform, "database") },
786
+ type: "postgres",
787
+ image: resolved.database.image,
788
+ host: resolved.database.host ?? "localhost",
789
+ port: resolved.database.port ?? 5432,
790
+ name: resolved.database.name,
791
+ user: resolved.database.user,
792
+ password: resolved.database.password
793
+ };
794
+ }
755
795
  const config = {
756
- services: {
757
- backend: backend ? {
758
- platform: { type: requirePlatform(backend.platform, "backend") },
759
- port: backend.port ?? 4e3,
760
- publicURL: backend.publicURL ?? `http://localhost:${backend.port ?? 4e3}`,
761
- corsOrigin: backend.corsOrigin ?? backend.frontendURL ?? "http://localhost:3000"
762
- } : void 0,
763
- frontend: frontend ? {
764
- platform: { type: requirePlatform(frontend.platform, "frontend") },
765
- port: frontend.port ?? 3e3,
766
- siteName: site?.siteName ?? "Semiont",
767
- publicURL: frontend.publicURL
768
- } : void 0,
769
- proxy: proxy ? {
770
- platform: { type: requirePlatform(proxy.platform, "proxy") },
771
- type: "envoy",
772
- port: proxy.port ?? 8080,
773
- adminPort: proxy.adminPort ?? 9901,
774
- backendPort: backend?.port ?? 4e3,
775
- frontendPort: frontend?.port ?? 3e3
776
- } : void 0,
777
- graph: resolved.graph ? {
778
- ...resolved.graph,
779
- platform: { type: requirePlatform(resolved.graph.platform, "graph") },
780
- type: resolved.graph.type ?? "neo4j"
781
- } : makeMeaningSection?.graph,
782
- database: resolved.database ? {
783
- platform: { type: requirePlatform(resolved.database.platform, "database") },
784
- type: "postgres",
785
- image: resolved.database.image,
786
- host: resolved.database.host ?? "localhost",
787
- port: resolved.database.port ?? 5432,
788
- name: resolved.database.name,
789
- user: resolved.database.user,
790
- password: resolved.database.password
791
- } : void 0
792
- },
796
+ services,
793
797
  ...inferenceProviders ? { inference: inferenceProviders } : {},
794
798
  ...Object.keys(topLevelWorkers).length > 0 ? { workers: topLevelWorkers } : {},
795
799
  ...Object.keys(topLevelActors).length > 0 ? { actors: topLevelActors } : {},
@@ -804,6 +808,7 @@ function loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env)
804
808
  environment,
805
809
  projectRoot,
806
810
  projectName,
811
+ projectVersion,
807
812
  ...Object.keys(actors).length > 0 ? { actors } : {},
808
813
  ...Object.keys(workers).length > 0 ? { workers } : {}
809
814
  }