@semiont/core 0.3.4 → 0.3.6

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,5 +1,6 @@
1
1
  import { Subject, OperatorFunction } from 'rxjs';
2
- import { ErrorObject } from 'ajv';
2
+ import { E as EnvironmentConfig, P as PlatformType$1 } from './config.types-Cas714K0.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-Cas714K0.js';
3
4
 
4
5
  /**
5
6
  * This file was auto-generated by openapi-typescript.
@@ -4987,775 +4988,63 @@ declare function userToAgent(user: {
4987
4988
  declare function didToAgent(did: string): Agent;
4988
4989
 
4989
4990
  /**
4990
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
4991
- * via the `definition` "PlatformType".
4992
- */
4993
- type PlatformType$1 = 'posix' | 'container' | 'aws' | 'external';
4994
- /**
4995
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
4996
- * via the `definition` "GraphDatabaseType".
4997
- */
4998
- type GraphDatabaseType = 'neo4j' | 'janusgraph' | 'neptune' | 'memory';
4999
- /**
5000
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5001
- * via the `definition` "GraphServiceConfig".
5002
- */
5003
- type GraphServiceConfig = {
5004
- [k: string]: unknown;
5005
- } & {
5006
- platform: ServicePlatformConfig;
5007
- type: GraphDatabaseType;
5008
- name?: string;
5009
- uri?: string;
5010
- url?: string;
5011
- username?: string;
5012
- password?: string;
5013
- database?: string;
5014
- host?: string;
5015
- port?: number;
5016
- storage?: string;
5017
- index?: string;
5018
- endpoint?: string;
5019
- region?: string;
5020
- command?: string;
5021
- image?: string;
5022
- janusgraphVersion?: string;
5023
- javaOptions?: string;
5024
- heapSize?: string;
5025
- pageCacheSize?: string;
5026
- noAuth?: boolean;
5027
- dataPath?: string;
5028
- timeout?: number;
5029
- wait?: number;
5030
- logsEndpoint?: string;
5031
- tag?: string;
5032
- resources?: ResourceRequirements;
5033
- security?: SecurityRequirements;
5034
- build?: boolean | BuildRequirements;
5035
- dockerfile?: string;
5036
- buildContext?: string;
5037
- buildArgs?: {
5038
- [k: string]: string;
5039
- };
5040
- buildTarget?: string;
5041
- prebuilt?: boolean;
5042
- noCache?: boolean;
5043
- secrets?: string[];
5044
- labels?: {
5045
- [k: string]: string;
5046
- };
5047
- annotations?: {
5048
- [k: string]: string;
5049
- };
5050
- dependencies?: string[];
5051
- externalDependencies?: (string | {
5052
- name?: string;
5053
- url?: string;
5054
- required?: boolean;
5055
- healthCheck?: string;
5056
- [k: string]: unknown;
5057
- })[];
5058
- environment?: {
5059
- [k: string]: string;
5060
- };
5061
- env?: {
5062
- [k: string]: string;
5063
- };
5064
- };
5065
- /**
5066
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5067
- * via the `definition` "ServicePlatformConfig".
5068
- */
5069
- interface ServicePlatformConfig {
5070
- type: PlatformType$1;
5071
- [k: string]: unknown;
5072
- }
5073
- /**
5074
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5075
- * via the `definition` "ResourceRequirements".
5076
- */
5077
- interface ResourceRequirements {
5078
- cpu?: string;
5079
- memory?: string;
5080
- gpu?: number;
5081
- gpus?: number;
5082
- replicas?: number;
5083
- ephemeralStorage?: string;
5084
- memoryReservation?: string;
5085
- }
5086
- /**
5087
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5088
- * via the `definition` "SecurityRequirements".
5089
- */
5090
- interface SecurityRequirements {
5091
- readOnlyRootFilesystem?: boolean;
5092
- runAsNonRoot?: boolean;
5093
- runAsUser?: number;
5094
- runAsGroup?: number;
5095
- capabilities?: string[] | {
5096
- add?: string[];
5097
- drop?: string[];
5098
- [k: string]: unknown;
5099
- };
5100
- privileged?: boolean;
5101
- allowPrivilegeEscalation?: boolean;
5102
- }
5103
- /**
5104
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5105
- * via the `definition` "BuildRequirements".
5106
- */
5107
- interface BuildRequirements {
5108
- dockerfile?: string;
5109
- buildContext?: string;
5110
- buildArgs?: {
5111
- [k: string]: string;
5112
- };
5113
- buildTarget?: string;
5114
- prebuilt?: boolean;
5115
- noCache?: boolean;
5116
- }
5117
- /**
5118
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5119
- * via the `definition` "BackendServiceConfig".
5120
- */
5121
- interface BackendServiceConfig {
5122
- platform: ServicePlatformConfig;
5123
- devMode?: boolean;
5124
- command?: string;
5125
- port: number;
5126
- publicURL: string;
5127
- corsOrigin: string;
5128
- image?: string;
5129
- cpu?: string;
5130
- memory?: string;
5131
- semiontRepo?: string;
5132
- databaseUrl?: string;
5133
- projectRoot?: string;
5134
- timeout?: number;
5135
- wait?: number;
5136
- logsEndpoint?: string;
5137
- tag?: string;
5138
- resources?: ResourceRequirements;
5139
- security?: SecurityRequirements;
5140
- build?: boolean | BuildRequirements;
5141
- dockerfile?: string;
5142
- buildContext?: string;
5143
- buildArgs?: {
5144
- [k: string]: string;
5145
- };
5146
- buildTarget?: string;
5147
- prebuilt?: boolean;
5148
- noCache?: boolean;
5149
- secrets?: string[];
5150
- labels?: {
5151
- [k: string]: string;
5152
- };
5153
- annotations?: {
5154
- [k: string]: string;
5155
- };
5156
- dependencies?: string[];
5157
- externalDependencies?: (string | {
5158
- name?: string;
5159
- url?: string;
5160
- required?: boolean;
5161
- healthCheck?: string;
5162
- [k: string]: unknown;
5163
- })[];
5164
- redisUrl?: string;
5165
- environment?: {
5166
- [k: string]: string;
5167
- };
5168
- env?: {
5169
- [k: string]: string;
5170
- };
5171
- }
5172
- /**
5173
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5174
- * via the `definition` "FrontendServiceConfig".
5175
- */
5176
- interface FrontendServiceConfig {
5177
- platform: ServicePlatformConfig;
5178
- devMode?: boolean;
5179
- command?: string;
5180
- port: number;
5181
- siteName: string;
5182
- image?: string;
5183
- semiontRepo?: string;
5184
- projectRoot?: string;
5185
- databaseUrl?: string;
5186
- timeout?: number;
5187
- wait?: number;
5188
- logsEndpoint?: string;
5189
- tag?: string;
5190
- resources?: ResourceRequirements;
5191
- security?: SecurityRequirements;
5192
- build?: boolean | BuildRequirements;
5193
- dockerfile?: string;
5194
- buildContext?: string;
5195
- buildArgs?: {
5196
- [k: string]: string;
5197
- };
5198
- buildTarget?: string;
5199
- prebuilt?: boolean;
5200
- noCache?: boolean;
5201
- secrets?: string[];
5202
- labels?: {
5203
- [k: string]: string;
5204
- };
5205
- annotations?: {
5206
- [k: string]: string;
5207
- };
5208
- dependencies?: string[];
5209
- externalDependencies?: (string | {
5210
- name?: string;
5211
- url?: string;
5212
- required?: boolean;
5213
- healthCheck?: string;
5214
- [k: string]: unknown;
5215
- })[];
5216
- environment?: {
5217
- [k: string]: string;
5218
- };
5219
- env?: {
5220
- [k: string]: string;
5221
- };
5222
- publicURL?: string;
5223
- allowedOrigins?: string[];
5224
- }
5225
- /**
5226
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5227
- * via the `definition` "ProxyServiceConfig".
5228
- */
5229
- interface ProxyServiceConfig {
5230
- platform: ServicePlatformConfig;
5231
- type: 'envoy' | 'nginx' | 'haproxy';
5232
- port: number;
5233
- adminPort?: number;
5234
- backendPort?: number;
5235
- frontendPort?: number;
5236
- image?: string;
5237
- configPath?: string;
5238
- timeout?: number;
5239
- wait?: number;
5240
- logsEndpoint?: string;
5241
- tag?: string;
5242
- resources?: ResourceRequirements;
5243
- security?: SecurityRequirements;
5244
- environment?: {
5245
- [k: string]: string;
5246
- };
5247
- env?: {
5248
- [k: string]: string;
5249
- };
5250
- }
5251
- /**
5252
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5253
- * via the `definition` "DatabaseServiceConfig".
5254
- */
5255
- interface DatabaseServiceConfig {
5256
- platform: ServicePlatformConfig;
5257
- type: string;
5258
- name?: string;
5259
- host: string;
5260
- port: number;
5261
- environment?: {
5262
- [k: string]: string;
5263
- };
5264
- env?: {
5265
- [k: string]: string;
5266
- };
5267
- description?: string;
5268
- command?: string;
5269
- image?: string;
5270
- user?: string;
5271
- username?: string;
5272
- password?: string;
5273
- database?: string;
5274
- storageSize?: string;
5275
- timeout?: number;
5276
- wait?: number;
5277
- logsEndpoint?: string;
5278
- tag?: string;
5279
- resources?: ResourceRequirements;
5280
- security?: SecurityRequirements;
5281
- build?: boolean | BuildRequirements;
5282
- dockerfile?: string;
5283
- buildContext?: string;
5284
- buildArgs?: {
5285
- [k: string]: string;
5286
- };
5287
- buildTarget?: string;
5288
- prebuilt?: boolean;
5289
- noCache?: boolean;
5290
- secrets?: string[];
5291
- labels?: {
5292
- [k: string]: string;
5293
- };
5294
- annotations?: {
5295
- [k: string]: string;
5296
- };
5297
- dependencies?: string[];
5298
- externalDependencies?: (string | {
5299
- name?: string;
5300
- url?: string;
5301
- required?: boolean;
5302
- healthCheck?: string;
5303
- [k: string]: unknown;
5304
- })[];
5305
- }
5306
- /**
5307
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5308
- * via the `definition` "FilesystemServiceConfig".
5309
- */
5310
- interface FilesystemServiceConfig {
5311
- platform: ServicePlatformConfig;
5312
- path: string;
5313
- description?: string;
5314
- command?: string;
5315
- image?: string;
5316
- port?: number;
5317
- timeout?: number;
5318
- wait?: number;
5319
- logsEndpoint?: string;
5320
- tag?: string;
5321
- resources?: ResourceRequirements;
5322
- security?: SecurityRequirements;
5323
- build?: boolean | BuildRequirements;
5324
- dockerfile?: string;
5325
- buildContext?: string;
5326
- buildArgs?: {
5327
- [k: string]: string;
5328
- };
5329
- buildTarget?: string;
5330
- prebuilt?: boolean;
5331
- noCache?: boolean;
5332
- secrets?: string[];
5333
- labels?: {
5334
- [k: string]: string;
5335
- };
5336
- annotations?: {
5337
- [k: string]: string;
5338
- };
5339
- dependencies?: string[];
5340
- externalDependencies?: (string | {
5341
- name?: string;
5342
- url?: string;
5343
- required?: boolean;
5344
- healthCheck?: string;
5345
- [k: string]: unknown;
5346
- })[];
5347
- environment?: {
5348
- [k: string]: string;
5349
- };
5350
- env?: {
5351
- [k: string]: string;
5352
- };
5353
- }
5354
- /**
5355
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5356
- * via the `definition` "InferenceServiceConfig".
5357
- */
5358
- interface InferenceServiceConfig {
5359
- platform: ServicePlatformConfig;
5360
- type: string;
5361
- model?: string;
5362
- maxTokens?: number;
5363
- endpoint?: string;
5364
- baseURL?: string;
5365
- apiKey: string;
5366
- command?: string;
5367
- image?: string;
5368
- port?: number;
5369
- organization?: string;
5370
- timeout?: number;
5371
- wait?: number;
5372
- logsEndpoint?: string;
5373
- tag?: string;
5374
- resources?: ResourceRequirements;
5375
- security?: SecurityRequirements;
5376
- build?: boolean | BuildRequirements;
5377
- dockerfile?: string;
5378
- buildContext?: string;
5379
- buildArgs?: {
5380
- [k: string]: string;
5381
- };
5382
- buildTarget?: string;
5383
- prebuilt?: boolean;
5384
- noCache?: boolean;
5385
- secrets?: string[];
5386
- labels?: {
5387
- [k: string]: string;
5388
- };
5389
- annotations?: {
5390
- [k: string]: string;
5391
- };
5392
- dependencies?: string[];
5393
- externalDependencies?: (string | {
5394
- name?: string;
5395
- url?: string;
5396
- required?: boolean;
5397
- healthCheck?: string;
5398
- [k: string]: unknown;
5399
- })[];
5400
- environment?: {
5401
- [k: string]: string;
5402
- };
5403
- env?: {
5404
- [k: string]: string;
5405
- };
5406
- }
5407
- /**
5408
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5409
- * via the `definition` "McpServiceConfig".
5410
- */
5411
- interface McpServiceConfig {
5412
- platform: ServicePlatformConfig;
5413
- command?: string;
5414
- image?: string;
5415
- port?: number;
5416
- dependsOn?: string[];
5417
- timeout?: number;
5418
- wait?: number;
5419
- logsEndpoint?: string;
5420
- tag?: string;
5421
- resources?: ResourceRequirements;
5422
- security?: SecurityRequirements;
5423
- build?: boolean | BuildRequirements;
5424
- dockerfile?: string;
5425
- buildContext?: string;
5426
- buildArgs?: {
5427
- [k: string]: string;
5428
- };
5429
- buildTarget?: string;
5430
- prebuilt?: boolean;
5431
- noCache?: boolean;
5432
- secrets?: string[];
5433
- labels?: {
5434
- [k: string]: string;
5435
- };
5436
- annotations?: {
5437
- [k: string]: string;
5438
- };
5439
- dependencies?: string[];
5440
- externalDependencies?: (string | {
5441
- name?: string;
5442
- url?: string;
5443
- required?: boolean;
5444
- healthCheck?: string;
5445
- [k: string]: unknown;
5446
- })[];
5447
- environment?: {
5448
- [k: string]: string;
5449
- };
5450
- env?: {
5451
- [k: string]: string;
5452
- };
5453
- }
5454
- /**
5455
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5456
- * via the `definition` "ServicesConfig".
5457
- */
5458
- interface ServicesConfig {
5459
- backend?: BackendServiceConfig;
5460
- frontend?: FrontendServiceConfig;
5461
- database?: DatabaseServiceConfig;
5462
- graph?: GraphServiceConfig;
5463
- filesystem?: FilesystemServiceConfig;
5464
- inference?: InferenceServiceConfig;
5465
- mcp?: McpServiceConfig;
5466
- proxy?: ProxyServiceConfig;
5467
- [k: string]: unknown;
5468
- }
5469
- /**
5470
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5471
- * via the `definition` "SiteConfig".
5472
- */
5473
- interface SiteConfig {
5474
- /**
5475
- * Display name for the site
5476
- */
5477
- siteName?: string;
5478
- /**
5479
- * Primary domain for the site
5480
- */
5481
- domain: string;
5482
- /**
5483
- * Administrator email address
5484
- */
5485
- adminEmail?: string;
5486
- /**
5487
- * Support email address (optional)
5488
- */
5489
- supportEmail?: string;
5490
- /**
5491
- * Email domains allowed for OAuth authentication
5492
- *
5493
- * @minItems 1
5494
- */
5495
- oauthAllowedDomains?: [string, ...string[]];
5496
- }
5497
- /**
5498
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5499
- * via the `definition` "AppConfig".
5500
- */
5501
- interface AppConfig {
5502
- features?: {
5503
- enableAnalytics?: boolean;
5504
- enableMaintenanceMode?: boolean;
5505
- enableDebugLogging?: boolean;
5506
- };
5507
- security?: {
5508
- /**
5509
- * Session timeout in seconds
5510
- */
5511
- sessionTimeout?: number;
5512
- /**
5513
- * Maximum failed login attempts before lockout
5514
- */
5515
- maxLoginAttempts?: number;
5516
- corsAllowedOrigins?: string[];
5517
- /**
5518
- * Enable local username/password authentication
5519
- */
5520
- enableLocalAuth?: boolean;
5521
- /**
5522
- * JWT signing secret (base64 encoded, 32+ bytes)
5523
- */
5524
- jwtSecret?: string;
5525
- };
5526
- performance?: {
5527
- enableCaching?: boolean;
5528
- /**
5529
- * Cache timeout in seconds
5530
- */
5531
- cacheTimeout?: number;
5532
- /**
5533
- * Maximum request size (e.g., '10mb')
5534
- */
5535
- maxRequestSize?: string;
5536
- };
5537
- }
5538
- /**
5539
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5540
- * via the `definition` "EnvironmentConfig".
5541
- */
5542
- interface EnvironmentConfig {
5543
- /**
5544
- * Optional comment for documentation
5545
- */
5546
- _comment?: string;
5547
- _metadata?: {
5548
- environment: string;
5549
- projectRoot: string;
5550
- [k: string]: unknown;
5551
- };
5552
- /**
5553
- * Environment name
5554
- */
5555
- name?: string;
5556
- platform?: {
5557
- default?: PlatformType$1;
5558
- [k: string]: unknown;
5559
- };
5560
- services: ServicesConfig;
5561
- site?: SiteConfig;
5562
- app?: AppConfig;
5563
- env?: {
5564
- NODE_ENV?: 'development' | 'production' | 'test';
5565
- [k: string]: unknown;
5566
- };
5567
- /**
5568
- * Logging verbosity level
5569
- */
5570
- logLevel?: 'error' | 'warn' | 'info' | 'http' | 'debug';
5571
- deployment?: {
5572
- imageTagStrategy?: 'mutable' | 'immutable' | 'git-hash';
5573
- [k: string]: unknown;
5574
- };
5575
- }
5576
- /**
5577
- * This interface was referenced by `HttpsSemiontOrgSchemasConfigJson`'s JSON-Schema
5578
- * via the `definition` "SemiontConfig".
5579
- */
5580
- interface SemiontConfig {
5581
- /**
5582
- * Config file version (semver)
5583
- */
5584
- version: string;
5585
- /**
5586
- * Project name
5587
- */
5588
- project: string;
5589
- site: SiteConfig;
5590
- app?: AppConfig;
5591
- services?: ServicesConfig;
5592
- }
5593
-
5594
- /**
5595
- * Platform Types Module
4991
+ * TOML Config Loader
5596
4992
  *
5597
- * Re-exports PlatformType from schema-generated types.
5598
- * Platforms represent WHERE services run (infrastructure targets).
5599
- */
5600
-
5601
- /**
5602
- * Platform type literals from JSON Schema
5603
- * These represent the infrastructure targets where services can be deployed
5604
- */
5605
- type PlatformType = PlatformType$1;
5606
- /**
5607
- * Type guard to check if a string is a valid platform type
4993
+ * Reads ~/.semiontconfig (TOML) and .semiont/config (TOML) and produces
4994
+ * an EnvironmentConfig for the requested environment.
5608
4995
  *
5609
- * @param value - Value to check
5610
- * @returns True if value is a valid PlatformType
5611
- */
5612
- declare function isValidPlatformType(value: string): value is PlatformType;
5613
- /**
5614
- * Get all valid platform types
5615
- *
5616
- * @returns Array of all platform types
5617
- */
5618
- declare function getAllPlatformTypes(): PlatformType[];
5619
-
5620
- /**
5621
- * Environment Loader Module
4996
+ * File format: see TOML-XDG-CONFIG.md
5622
4997
  *
5623
- * Responsible for parsing and merging environment configurations.
5624
- * Pure functions only - callers handle filesystem I/O.
4998
+ * Loading sequence:
4999
+ * 1. Read .semiont/config → projectName, site, environments.<env>.* (project base)
5000
+ * 2. Read ~/.semiontconfig → defaults, environments.<env>.* (user overrides)
5001
+ * 3. Deep-merge: project base ← user overrides (user wins on conflicts)
5002
+ * Any environment name is valid (local, staging, production, custom, ...)
5003
+ * 4. Resolve ${VAR} references from process.env
5004
+ * 5. Apply inheritance: workers.<name> → workers.default → error
5005
+ * 6. Map to EnvironmentConfig shape
5625
5006
  */
5626
5007
 
5627
- /**
5628
- * Generic service configuration
5629
- * Platform-specific fields should be accessed through platform-specific interfaces
5630
- */
5631
- interface ServiceConfig {
5632
- platform?: {
5633
- type: PlatformType;
5634
- };
5635
- port?: number;
5636
- name?: string;
5637
- [key: string]: any;
5008
+ interface InferenceConfig {
5009
+ type: 'anthropic' | 'ollama';
5010
+ model: string;
5011
+ maxTokens?: number;
5012
+ apiKey?: string;
5013
+ endpoint?: string;
5014
+ baseURL?: string;
5638
5015
  }
5639
- interface AWSConfig {
5640
- region: string;
5641
- accountId: string;
5642
- certificateArn?: string;
5643
- hostedZoneId?: string;
5644
- rootDomain?: string;
5645
- stacks?: {
5646
- data?: string;
5647
- app?: string;
5648
- };
5649
- database?: {
5650
- name?: string;
5651
- instanceClass?: string;
5652
- allocatedStorage?: number;
5653
- backupRetentionDays?: number;
5654
- multiAZ?: boolean;
5655
- };
5656
- ecs?: {
5657
- desiredCount?: number;
5658
- minCapacity?: number;
5659
- maxCapacity?: number;
5660
- };
5661
- monitoring?: {
5662
- enableDetailedMonitoring?: boolean;
5663
- logRetentionDays?: number;
5664
- };
5016
+ interface ActorInferenceConfig {
5017
+ gatherer?: InferenceConfig;
5018
+ matcher?: InferenceConfig;
5665
5019
  }
5666
- /**
5667
- * Deep merge utility for configuration objects
5668
- * Pure function - no side effects
5669
- */
5670
- declare function deepMerge(target: any, ...sources: any[]): any;
5671
- /**
5672
- * Recursively resolve environment variable placeholders in configuration
5673
- * Replaces ${VAR_NAME} with the value from the provided env object
5674
- * Pure function - accepts env as parameter instead of using process.env
5675
- *
5676
- * @param obj - Configuration object to process
5677
- * @param env - Environment variables object
5678
- * @returns Configuration with resolved environment variables
5679
- */
5680
- declare function resolveEnvVars(obj: any, env: Record<string, string | undefined>): any;
5681
- /**
5682
- * Parse and merge configuration files
5683
- * Pure function - accepts file contents as strings instead of reading from filesystem
5684
- *
5685
- * @param baseContent - Contents of semiont.json (null if file doesn't exist)
5686
- * @param envContent - Contents of environment-specific JSON file
5687
- * @param env - Environment variables object
5688
- * @param environment - Environment name
5689
- * @param projectRoot - Project root path (for metadata only)
5690
- * @returns Merged and validated environment configuration
5691
- * @throws ConfigurationError if parsing or validation fails
5692
- */
5693
- declare function parseAndMergeConfigs(baseContent: string | null, envContent: string, env: Record<string, string | undefined>, environment: string, projectRoot: string): EnvironmentConfig;
5694
- /**
5695
- * Get NODE_ENV value from environment config
5696
- *
5697
- * @param config - Environment configuration
5698
- * @returns NODE_ENV value (defaults to 'development' if not specified)
5699
- */
5700
- declare function getNodeEnvForEnvironment(config: EnvironmentConfig): 'development' | 'production' | 'test';
5701
- /**
5702
- * List environment names from filenames
5703
- * Pure function - accepts array of filenames instead of reading from filesystem
5704
- *
5705
- * @param files - Array of filenames from environments directory
5706
- * @returns Sorted array of environment names
5707
- */
5708
- declare function listEnvironmentNames(files: string[]): string[];
5709
- /**
5710
- * Type guard to check if config has AWS settings
5711
- *
5712
- * @param config - Environment configuration
5713
- * @returns True if AWS configuration is present
5714
- */
5715
- declare function hasAWSConfig(config: EnvironmentConfig): config is EnvironmentConfig & {
5716
- aws: AWSConfig;
5020
+ interface WorkerInferenceConfig {
5021
+ default?: InferenceConfig;
5022
+ 'reference-annotation'?: InferenceConfig;
5023
+ 'highlight-annotation'?: InferenceConfig;
5024
+ 'assessment-annotation'?: InferenceConfig;
5025
+ 'comment-annotation'?: InferenceConfig;
5026
+ 'tag-annotation'?: InferenceConfig;
5027
+ 'generation'?: InferenceConfig;
5028
+ }
5029
+ type TomlFileReader = {
5030
+ readIfExists: (path: string) => string | null;
5717
5031
  };
5718
5032
  /**
5719
- * Display configuration for debugging
5033
+ * Parse ~/.semiontconfig and .semiont/config and return EnvironmentConfig.
5720
5034
  *
5721
- * @param config - Configuration to display
5035
+ * @param projectRoot - Path to the project root (contains .semiont/config)
5036
+ * @param environment - Environment name (e.g. 'local', 'production')
5037
+ * @param globalConfigPath - Path to ~/.semiontconfig (caller resolves ~ expansion)
5038
+ * @param reader - File reader abstraction
5039
+ * @param env - Environment variables for ${VAR} resolution
5722
5040
  */
5723
- declare function displayConfiguration(config: EnvironmentConfig): void;
5041
+ declare function loadTomlConfig(projectRoot: string, environment: string, globalConfigPath: string, reader: TomlFileReader, env: Record<string, string | undefined>): EnvironmentConfig;
5724
5042
  /**
5725
- * File reader abstraction for platform-agnostic config loading
5726
- * Implementations provide platform-specific file I/O (Node.js, Deno, Bun, etc.)
5727
- */
5728
- type ConfigFileReader = {
5729
- /** Read file if it exists, return null otherwise */
5730
- readIfExists: (path: string) => string | null;
5731
- /** Read file, throw error if it doesn't exist */
5732
- readRequired: (path: string) => string;
5733
- };
5734
- /**
5735
- * Create a config loader with a specific file reader implementation
5736
- * Higher-order function that returns a platform-specific config loader
5737
- *
5738
- * @param reader - Platform-specific file reader implementation
5739
- * @returns Function to load environment config from filesystem
5740
- *
5741
- * @example
5742
- * ```typescript
5743
- * import * as fs from 'fs';
5744
- * import { createConfigLoader } from '@semiont/core';
5745
- *
5746
- * const nodeReader = {
5747
- * readIfExists: (path) => fs.existsSync(path) ? fs.readFileSync(path, 'utf-8') : null,
5748
- * readRequired: (path) => {
5749
- * if (!fs.existsSync(path)) throw new Error(`File not found: ${path}`);
5750
- * return fs.readFileSync(path, 'utf-8');
5751
- * },
5752
- * };
5753
- *
5754
- * const loadConfig = createConfigLoader(nodeReader);
5755
- * const config = loadConfig('/project/root', 'production');
5756
- * ```
5043
+ * Create a TOML config loader backed by a file reader.
5044
+ * Drop-in replacement for createConfigLoader that reads TOML instead of JSON.
5045
+ * The caller must resolve globalConfigPath (e.g. expand '~' using process.env.HOME).
5757
5046
  */
5758
- declare function createConfigLoader(reader: ConfigFileReader): (projectRoot: string, environment: string) => EnvironmentConfig;
5047
+ declare function createTomlConfigLoader(reader: TomlFileReader, globalConfigPath: string, env: Record<string, string | undefined>): (projectRoot: string, environment: string) => EnvironmentConfig;
5759
5048
 
5760
5049
  /**
5761
5050
  * Environment validation utilities
@@ -5779,35 +5068,6 @@ declare function parseEnvironment(value: string | undefined, availableEnvironmen
5779
5068
  */
5780
5069
  declare function validateEnvironment(value: string | undefined, availableEnvironments: string[]): Environment;
5781
5070
 
5782
- /**
5783
- * Config Schema Validator
5784
- *
5785
- * Validates configuration data against JSON Schema using Ajv (JSON Schema validator).
5786
- * Provides runtime validation for semiont.json and environment config files.
5787
- */
5788
-
5789
- interface ValidationResult {
5790
- valid: boolean;
5791
- errors: ErrorObject[] | null;
5792
- errorMessage?: string;
5793
- }
5794
- /**
5795
- * Validate semiont.json config
5796
- */
5797
- declare function validateSemiontConfig(data: unknown): ValidationResult;
5798
- /**
5799
- * Validate environment config (environments/*.json)
5800
- */
5801
- declare function validateEnvironmentConfig(data: unknown): ValidationResult;
5802
- /**
5803
- * Validate site config
5804
- */
5805
- declare function validateSiteConfig(data: unknown): ValidationResult;
5806
- /**
5807
- * Format validation errors into human-readable message
5808
- */
5809
- declare function formatErrors(errors: ErrorObject[]): string;
5810
-
5811
5071
  /**
5812
5072
  * Configuration Error Class
5813
5073
  *
@@ -5825,6 +5085,32 @@ declare class ConfigurationError extends Error {
5825
5085
  toString(): string;
5826
5086
  }
5827
5087
 
5088
+ /**
5089
+ * Platform Types Module
5090
+ *
5091
+ * Re-exports PlatformType from schema-generated types.
5092
+ * Platforms represent WHERE services run (infrastructure targets).
5093
+ */
5094
+
5095
+ /**
5096
+ * Platform type literals from JSON Schema
5097
+ * These represent the infrastructure targets where services can be deployed
5098
+ */
5099
+ type PlatformType = PlatformType$1;
5100
+ /**
5101
+ * Type guard to check if a string is a valid platform type
5102
+ *
5103
+ * @param value - Value to check
5104
+ * @returns True if value is a valid PlatformType
5105
+ */
5106
+ declare function isValidPlatformType(value: string): value is PlatformType;
5107
+ /**
5108
+ * Get all valid platform types
5109
+ *
5110
+ * @returns Array of all platform types
5111
+ */
5112
+ declare function getAllPlatformTypes(): PlatformType[];
5113
+
5828
5114
  /**
5829
5115
  * @semiont/core
5830
5116
  *
@@ -5835,4 +5121,4 @@ declare class ConfigurationError extends Error {
5835
5121
  declare const CORE_TYPES_VERSION = "0.1.0";
5836
5122
  declare const SDK_VERSION = "0.1.0";
5837
5123
 
5838
- export { APIError, type AWSConfig, type AccessToken, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationRemovedEvent, type AnnotationUri, type AppConfig, type AssembledAnnotation, type AuthCode, type BackendServiceConfig, type BaseEvent, type BaseUrl, type BodyItem, type BodyOperation, type BurstBufferOptions, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, type ConfigFileReader, ConfigurationError, ConflictError, type ContentFormat$1 as ContentFormat, type CreateAnnotationInternal, type CreationMethod, type DatabaseServiceConfig, type Email, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityType, type EntityTypeStats, type Environment, type EnvironmentConfig, EventBus, type EventMap, type EventMetadata, type EventName, type EventQuery, type EventSignature, type FilesystemServiceConfig, type FrontendServiceConfig, type GatheredContext, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphDatabaseType, type GraphPath, type GraphServiceConfig, type InferenceServiceConfig, type JobCompletedEvent, type JobFailedEvent, type JobId, type JobProgressEvent, type JobStartedEvent, type Logger, type MCPToken, type MarkProgress, type McpServiceConfig, type Motivation$2 as Motivation, NotFoundError, type PlatformType, type ProxyServiceConfig, 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, type SemiontConfig, SemiontError, type ServiceConfig, type ServicePlatformConfig, type ServicesConfig, type SiteConfig, type StoredEvent, type SystemEvent, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type ValidationResult, type YieldProgress, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, type components, createConfigLoader, deepMerge, didToAgent, displayConfiguration, email, entityType, findBodyItem, formatErrors, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getFragmentSelector, getNodeEnvForEnvironment, getSvgSelector, getTextPositionSelector, googleCredential, hasAWSConfig, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent$1 as isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, listEnvironmentNames, mcpToken, type operations, parseAndMergeConfigs, parseEnvironment, type paths, refreshToken, resolveEnvVars, resourceAnnotationUri, resourceId, resourceUri, searchQuery, userDID, userId, userToAgent, userToDid, validateEnvironment, validateEnvironmentConfig, validateSemiontConfig, validateSiteConfig, validateSvgMarkup };
5124
+ 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 };