@semiont/core 0.5.28 → 0.5.30
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/README.md +9 -9
- package/dist/{chunk-CUPZGI7I.js → chunk-EWOITHBH.js} +24 -4
- package/dist/chunk-EWOITHBH.js.map +1 -0
- package/dist/{chunk-PPUO5IPX.js → chunk-IQGH6UJN.js} +7 -7
- package/dist/{chunk-PPUO5IPX.js.map → chunk-IQGH6UJN.js.map} +1 -1
- package/dist/{chunk-JWTQJVKM.js → chunk-UGI6IOOX.js} +35 -17
- package/dist/chunk-UGI6IOOX.js.map +1 -0
- package/dist/config/node-config-loader.d.ts +147 -93
- package/dist/config/node-config-loader.js +77 -50
- package/dist/config/node-config-loader.js.map +1 -1
- package/dist/index.d.ts +390 -746
- package/dist/index.js +68 -6
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts +21 -0
- package/dist/openapi.js +3002 -1373
- package/dist/openapi.js.map +1 -1
- package/dist/testing/axioms.js +2 -2
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +2 -2
- package/package.json +4 -4
- package/dist/chunk-CUPZGI7I.js.map +0 -1
- package/dist/chunk-JWTQJVKM.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,9 +12,9 @@ Core types and domain logic for the Semiont semantic knowledge platform. This pa
|
|
|
12
12
|
|
|
13
13
|
## Who Should Use This
|
|
14
14
|
|
|
15
|
-
- ✅ **
|
|
15
|
+
- ✅ **Gateway** (`apps/gateway`) - Server implementation, imports types from core
|
|
16
16
|
- ✅ **Packages** - Other monorepo packages that need OpenAPI types, the EventBus, or the transport contract
|
|
17
|
-
- ✅ **
|
|
17
|
+
- ✅ **Browser / Browser** - Types and pure utilities (the main barrel is browser-safe)
|
|
18
18
|
|
|
19
19
|
## Who Should Use `@semiont/core/node` Instead
|
|
20
20
|
|
|
@@ -31,7 +31,7 @@ import { SemiontProject, loadEnvironmentConfig } from '@semiont/core/node';
|
|
|
31
31
|
|
|
32
32
|
## Who Should Use `@semiont/sdk` Instead
|
|
33
33
|
|
|
34
|
-
Application code talking to a Semiont
|
|
34
|
+
Application code talking to a Semiont gateway should use [`@semiont/sdk`](../sdk/), which provides `SemiontClient`, the verb-oriented namespaces, and the session layer. The SDK consumes the `ITransport` / `IContentTransport` contracts defined here; the HTTP implementations of those contracts live in [`@semiont/http-transport`](../http-transport/) and are re-exported by the SDK for convenience.
|
|
35
35
|
|
|
36
36
|
**Rule of thumb**: If you are making API calls, use `@semiont/sdk`. If you only need types and domain logic, use `@semiont/core`. Import from `@semiont/http-transport` directly only when constructing a transport stack by hand.
|
|
37
37
|
|
|
@@ -110,7 +110,7 @@ function handle(event: PersistedEvent) {
|
|
|
110
110
|
|
|
111
111
|
### EventBus
|
|
112
112
|
|
|
113
|
-
The RxJS-based event bus shared by
|
|
113
|
+
The RxJS-based event bus shared by gateway and clients, with a typed channel protocol:
|
|
114
114
|
|
|
115
115
|
```typescript
|
|
116
116
|
import { EventBus, ScopedEventBus, burstBuffer, serializePerKey } from '@semiont/core';
|
|
@@ -128,7 +128,7 @@ import type { EventMap, EventName } from '@semiont/core';
|
|
|
128
128
|
The interfaces every concrete transport must satisfy, plus the channel set transports bridge into a client's bus:
|
|
129
129
|
|
|
130
130
|
```typescript
|
|
131
|
-
import type { ITransport, IContentTransport,
|
|
131
|
+
import type { ITransport, IContentTransport, IGatewayOperations, ConnectionState } from '@semiont/core';
|
|
132
132
|
import { BRIDGED_CHANNELS } from '@semiont/core';
|
|
133
133
|
```
|
|
134
134
|
|
|
@@ -292,7 +292,7 @@ import type { SemiontConfig, EnvironmentConfig, ServicesConfig } from '@semiont/
|
|
|
292
292
|
|
|
293
293
|
Filesystem-backed loading (`SemiontProject`, `loadEnvironmentConfig`) is in `@semiont/core/node` — see above.
|
|
294
294
|
|
|
295
|
-
###
|
|
295
|
+
### Gateway Internal Types
|
|
296
296
|
|
|
297
297
|
Types not in the OpenAPI spec:
|
|
298
298
|
|
|
@@ -315,7 +315,7 @@ Semiont follows a **spec-first architecture**:
|
|
|
315
315
|
|
|
316
316
|
1. **OpenAPI Specification** ([specs/src/](../../specs/src/)) is the source of truth
|
|
317
317
|
2. **@semiont/core** generates types from OpenAPI and provides domain utilities
|
|
318
|
-
3. Every other package imports types from `@semiont/core`; application code talks to the
|
|
318
|
+
3. Every other package imports types from `@semiont/core`; application code talks to the gateway through `@semiont/sdk`, whose transports implement core's `ITransport` contract
|
|
319
319
|
|
|
320
320
|
**Type Yield Flow**: OpenAPI spec → `@semiont/core/src/types.ts` (via `openapi-typescript`) → imported across the monorepo. This ensures no circular dependencies and clear build order.
|
|
321
321
|
|
|
@@ -340,8 +340,8 @@ Apache-2.0
|
|
|
340
340
|
|
|
341
341
|
- [`@semiont/sdk`](../sdk/) - The Semiont SDK (`SemiontClient`) - use this for application development
|
|
342
342
|
- [`@semiont/http-transport`](../http-transport/) - HTTP implementations of core's transport contract
|
|
343
|
-
- [`@semiont/
|
|
344
|
-
- [`@semiont/
|
|
343
|
+
- [`@semiont/gateway`](../../apps/gateway/) - Gateway API server
|
|
344
|
+
- [`@semiont/browser`](../../apps/browser/) - Web application
|
|
345
345
|
|
|
346
346
|
## Learn More
|
|
347
347
|
|
|
@@ -66,6 +66,7 @@ var BUS_OPERATIONS = {
|
|
|
66
66
|
// ── BROWSE (reads) ──────────────────────────────────────────────
|
|
67
67
|
"browse:resource-requested": { result: "browse:resource-result", failure: "browse:resource-failed" },
|
|
68
68
|
"browse:anchored-text-requested": { result: "browse:anchored-text-result", failure: "browse:anchored-text-failed" },
|
|
69
|
+
"browse:anchored-text-by-checksum-requested": { result: "browse:anchored-text-by-checksum-result", failure: "browse:anchored-text-by-checksum-failed" },
|
|
69
70
|
"browse:resources-requested": { result: "browse:resources-result", failure: "browse:resources-failed" },
|
|
70
71
|
"browse:annotation-requested": { result: "browse:annotation-result", failure: "browse:annotation-failed" },
|
|
71
72
|
"browse:annotations-requested": { result: "browse:annotations-result", failure: "browse:annotations-failed" },
|
|
@@ -76,7 +77,7 @@ var BUS_OPERATIONS = {
|
|
|
76
77
|
"browse:tag-schemas-requested": { result: "browse:tag-schemas-result", failure: "browse:tag-schemas-failed" },
|
|
77
78
|
"browse:agents-requested": { result: "browse:agents-result", failure: "browse:agents-failed" },
|
|
78
79
|
"browse:directory-requested": { result: "browse:directory-result", failure: "browse:directory-failed" },
|
|
79
|
-
// dormant —
|
|
80
|
+
// dormant — gateway handler complete, no client caller yet (annotation-detail capability)
|
|
80
81
|
"browse:annotation-context-requested": { result: "browse:annotation-context-result", failure: "browse:annotation-context-failed" },
|
|
81
82
|
// ── FRAME (KB schema writes) ────────────────────────────────────
|
|
82
83
|
"frame:add-entity-type": { result: "frame:entity-type-add-ok", failure: "frame:entity-type-add-failed" },
|
|
@@ -85,7 +86,7 @@ var BUS_OPERATIONS = {
|
|
|
85
86
|
// streaming: take-1 result + failure plus an intermediate progress channel
|
|
86
87
|
"gather:requested": { result: "gather:complete", failure: "gather:failed", progress: "gather:annotation-progress" },
|
|
87
88
|
"gather:resource-requested": { result: "gather:resource-complete", failure: "gather:resource-failed" },
|
|
88
|
-
// dormant —
|
|
89
|
+
// dormant — gateway handler complete, no client caller yet (annotation summary)
|
|
89
90
|
"gather:summary-requested": { result: "gather:summary-result", failure: "gather:summary-failed" },
|
|
90
91
|
// ── JOB ─────────────────────────────────────────────────────────
|
|
91
92
|
"job:create": { result: "job:created", failure: "job:create-failed" },
|
|
@@ -95,6 +96,7 @@ var BUS_OPERATIONS = {
|
|
|
95
96
|
"job:claim": { result: "job:claimed", failure: "job:claim-failed" },
|
|
96
97
|
// ── MARK ────────────────────────────────────────────────────────
|
|
97
98
|
"mark:create-request": { result: "mark:create-ok", failure: "mark:create-failed" },
|
|
99
|
+
"mark:commit": { result: "mark:commit-ok", failure: "mark:commit-failed" },
|
|
98
100
|
"mark:delete": { result: "mark:delete-ok", failure: "mark:delete-failed" },
|
|
99
101
|
"mark:archive": { result: "mark:archive-ok", failure: "mark:archive-failed" },
|
|
100
102
|
"mark:unarchive": { result: "mark:unarchive-ok", failure: "mark:unarchive-failed" },
|
|
@@ -112,6 +114,7 @@ var BUS_OPERATIONS = {
|
|
|
112
114
|
// live in-process (resource-operations.ts emits + awaits via race()); the
|
|
113
115
|
// client also .on()-subscribes -ok for cache invalidation
|
|
114
116
|
"yield:create": { result: "yield:create-ok", failure: "yield:create-failed" },
|
|
117
|
+
"yield:clone-persist": { result: "yield:clone-persist-ok", failure: "yield:clone-persist-failed" },
|
|
115
118
|
// dormant — handler in stower exists, no request emitter; client pre-subscribes -ok
|
|
116
119
|
"yield:update": { result: "yield:update-ok", failure: "yield:update-failed" },
|
|
117
120
|
"yield:clone-create": { result: "yield:clone-created", failure: "yield:clone-create-failed" },
|
|
@@ -126,6 +129,10 @@ var BRIDGED_BROADCASTS = [
|
|
|
126
129
|
"job:fail",
|
|
127
130
|
"frame:entity-type-added",
|
|
128
131
|
"frame:tag-schema-added",
|
|
132
|
+
"yield:created",
|
|
133
|
+
"yield:updated",
|
|
134
|
+
"yield:cloned",
|
|
135
|
+
"yield:moved",
|
|
129
136
|
"beckon:focus",
|
|
130
137
|
"beckon:sparkle",
|
|
131
138
|
"bus:resume-gap",
|
|
@@ -248,6 +255,19 @@ var EventBus = class {
|
|
|
248
255
|
getDomainEvent(eventType) {
|
|
249
256
|
return this.get(eventType);
|
|
250
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Channel names with at least one live observer right now. Introspection
|
|
260
|
+
* for composition-parity gates: `get()` creates subjects lazily, so mere
|
|
261
|
+
* access does not count — only real subscriptions do. Scoped channels
|
|
262
|
+
* appear under their namespaced key (`<scope>:<channel>`).
|
|
263
|
+
*/
|
|
264
|
+
observedChannels() {
|
|
265
|
+
const out = [];
|
|
266
|
+
for (const [name, subject] of this.subjects) {
|
|
267
|
+
if (subject.observed) out.push(String(name));
|
|
268
|
+
}
|
|
269
|
+
return out;
|
|
270
|
+
}
|
|
251
271
|
/**
|
|
252
272
|
* Destroy the event bus and complete all subjects
|
|
253
273
|
*
|
|
@@ -335,5 +355,5 @@ var ScopedEventBus = class _ScopedEventBus {
|
|
|
335
355
|
};
|
|
336
356
|
|
|
337
357
|
export { BRIDGED_CHANNELS, BUS_OPERATIONS, EventBus, ScopedEventBus, accessToken, annotationUri, authCode, baseUrl, busLog, busLogEnabled, cloneToken, email, entityType, googleCredential, jobId, mcpToken, refreshToken, resourceAnnotationUri, resourceUri, searchQuery, setBusLogTraceIdProvider, userDID };
|
|
338
|
-
//# sourceMappingURL=chunk-
|
|
339
|
-
//# sourceMappingURL=chunk-
|
|
358
|
+
//# sourceMappingURL=chunk-EWOITHBH.js.map
|
|
359
|
+
//# sourceMappingURL=chunk-EWOITHBH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/branded-types.ts","../src/bus-operations.ts","../src/bridged-channels.ts","../src/bus-log.ts","../src/event-bus.ts"],"names":[],"mappings":";;;AA0CO,SAAS,MAAM,KAAA,EAAsB;AAAE,EAAA,OAAO,KAAA;AAAgB;AAC9D,SAAS,SAAS,KAAA,EAAyB;AAAE,EAAA,OAAO,KAAA;AAAmB;AACvE,SAAS,iBAAiB,KAAA,EAAiC;AAAE,EAAA,OAAO,KAAA;AAA2B;AAC/F,SAAS,YAAY,KAAA,EAA4B;AAAE,EAAA,OAAO,KAAA;AAAsB;AAChF,SAAS,aAAa,KAAA,EAA6B;AAAE,EAAA,OAAO,KAAA;AAAuB;AACnF,SAAS,SAAS,KAAA,EAAyB;AAAE,EAAA,OAAO,KAAA;AAAmB;AACvE,SAAS,WAAW,KAAA,EAA2B;AAAE,EAAA,OAAO,KAAA;AAAqB;AAC7E,SAAS,MAAM,KAAA,EAAsB;AAAE,EAAA,OAAO,KAAA;AAAgB;AAC9D,SAAS,QAAQ,KAAA,EAAwB;AAAE,EAAA,OAAO,KAAA;AAAkB;AACpE,SAAS,WAAW,KAAA,EAA2B;AAAE,EAAA,OAAO,KAAA;AAAqB;AAC7E,SAA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A,MAAM,cAAA,GAAkB,KAAK,MAAA,CAAe,QAAA;AAE5C,IAAA,IAAI,CAAC,cAAA,CAAe,GAAA,CAAI,SAAS,CAAA,EAAG;AAClC,MAAA,cAAA,CAAe,GAAA,CAAI,SAAA,EAAW,IAAI,OAAA,EAAsB,CAAA;AAAA,IAC1D;AACA,IAAA,OAAO,cAAA,CAAe,IAAI,SAAS,CAAA;AAAA,EACrC;AAAA;AAAA,EAGA,eAAe,SAAA,EAAqD;AAClE,IAAA,OAAO,IAAA,CAAK,IAAI,SAA2B,CAAA;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,QAAA,EAAkC;AACtC,IAAA,OAAO,IAAI,gBAAe,IAAA,CAAK,MAAA,EAAQ,GAAG,IAAA,CAAK,WAAW,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAE,CAAA;AAAA,EAC1E;AACF","file":"chunk-EWOITHBH.js","sourcesContent":["/**\n * Branded string types for compile-time type safety\n *\n * These types are zero-cost at runtime but prevent mixing\n * different string types at compile time.\n */\n\nimport type { components } from './types';\n\n// ============================================================================\n// OPENAPI-GENERATED TYPES (use directly from spec)\n// ============================================================================\n\nexport type Motivation = components['schemas']['Motivation'];\nexport type ContentFormat = components['schemas']['ContentFormat'];\n\n// ============================================================================\n// AUTHENTICATION & TOKENS\n// ============================================================================\n\nexport type Email = string & { readonly __brand: 'Email' };\nexport type AuthCode = string & { readonly __brand: 'AuthCode' };\nexport type GoogleCredential = string & { readonly __brand: 'GoogleCredential' };\nexport type AccessToken = string & { readonly __brand: 'AccessToken' };\nexport type RefreshToken = string & { readonly __brand: 'RefreshToken' };\nexport type MCPToken = string & { readonly __brand: 'MCPToken' };\nexport type CloneToken = string & { readonly __brand: 'CloneToken' };\n\n// ============================================================================\n// SYSTEM IDENTIFIERS\n// ============================================================================\n\nexport type JobId = string & { readonly __brand: 'JobId' };\nexport type UserDID = string & { readonly __brand: 'UserDID' };\nexport type EntityType = string & { readonly __brand: 'EntityType' };\nexport type SearchQuery = string & { readonly __brand: 'SearchQuery' };\nexport type BaseUrl = string & { readonly __brand: 'BaseUrl' };\n\n// ============================================================================\n// HELPER FUNCTIONS (minimal validation, just branding)\n// ============================================================================\n\nexport function email(value: string): Email { return value as Email; }\nexport function authCode(value: string): AuthCode { return value as AuthCode; }\nexport function googleCredential(value: string): GoogleCredential { return value as GoogleCredential; }\nexport function accessToken(value: string): AccessToken { return value as AccessToken; }\nexport function refreshToken(value: string): RefreshToken { return value as RefreshToken; }\nexport function mcpToken(value: string): MCPToken { return value as MCPToken; }\nexport function cloneToken(value: string): CloneToken { return value as CloneToken; }\nexport function jobId(value: string): JobId { return value as JobId; }\nexport function userDID(value: string): UserDID { return value as UserDID; }\nexport function entityType(value: string): EntityType { return value as EntityType; }\nexport function searchQuery(value: string): SearchQuery { return value as SearchQuery; }\nexport function baseUrl(value: string): BaseUrl { return value as BaseUrl; }\n\n// Motivation is an OpenAPI enum — use its values directly, no helper needed.\n// ContentFormat is a free-form MIME string whose base type must be a\n// SupportedMediaType; validation lives in media-types.ts, not in a brand.\n\n// ============================================================================\n// HTTP URI TYPES\n// ============================================================================\n\n// Branded type definitions for HTTP URIs returned by the API\nexport type ResourceUri = string & { readonly __brand: 'ResourceUri' };\n\n// W3C flat format for content negotiation: http://localhost:4000/annotations/{id}\nexport type AnnotationUri = string & { readonly __brand: 'AnnotationUri' };\n\n// Nested format for CRUD operations: http://localhost:4000/resources/{resourceId}/annotations/{annotationId}\nexport type ResourceAnnotationUri = string & { readonly __brand: 'ResourceAnnotationUri' };\n\n// Factory functions with runtime validation\nexport function resourceUri(uri: string): ResourceUri {\n if (!uri.startsWith('http://') && !uri.startsWith('https://')) {\n throw new TypeError(`Expected ResourceUri, got: ${uri}`);\n }\n return uri as ResourceUri;\n}\n\nexport function annotationUri(uri: string): AnnotationUri {\n if (!uri.startsWith('http://') && !uri.startsWith('https://')) {\n throw new TypeError(`Expected AnnotationUri, got: ${uri}`);\n }\n return uri as AnnotationUri;\n}\n\nexport function resourceAnnotationUri(uri: string): ResourceAnnotationUri {\n if (!uri.startsWith('http://') && !uri.startsWith('https://')) {\n throw new TypeError(`Expected ResourceAnnotationUri, got: ${uri}`);\n }\n // Additional validation: must contain /resources/ and /annotations/\n if (!uri.includes('/resources/') || !uri.includes('/annotations/')) {\n throw new TypeError(`Expected nested ResourceAnnotationUri format, got: ${uri}`);\n }\n return uri as ResourceAnnotationUri;\n}\n","// ⚠ GENERATED FILE — do not edit.\n//\n// Authority: specs/src/bus/registry.json (channels, payloads, operations)\n// Regenerate: node scripts/bus/generate-ts.mjs\n// Go counterpart: node scripts/bus/generate-go.mjs → packages/sdk-go/bus\n//\n// Payload schemas themselves live in the OpenAPI components; the registry\n// names which one each channel carries. Add or change a channel THERE.\n\nimport type { EventName, EmittableChannel } from './bus-protocol';\n\n/**\n * BUS_OPERATIONS — the request/reply operations registry (Tier 1).\n *\n * Each entry declares ONE operation as the triple that was previously three\n * loose, independently-maintained facts spread across call sites:\n * - the request channel (the key — an `EmittableChannel`),\n * - the `result` channel (success reply),\n * - the `failure` channel,\n * - and, for a streaming op, an optional `progress` channel.\n *\n * `BridgedChannel` / `BRIDGED_CHANNELS` are DERIVED from this map\n * (bridged-channels.ts): every reply lands in the bridged fan-in set by\n * construction, so \"a reply channel forgotten from BRIDGED_CHANNELS\" — the\n * recurring bug class (gather:resource-complete, frame:*-add-failed) — is no\n * longer representable. See .plans/BUS-OPERATIONS-REGISTRY.md.\n *\n * `Partial<Record<EmittableChannel, …>>` enforces that every key is a real\n * emittable request. `result`/`failure`/`progress` stay `EventName` rather than\n * `BridgedChannel` to avoid a circular reference (BridgedChannel derives from\n * this map); the derivation closes the loop instead.\n */\nexport interface BusOperationSpec {\n result: EventName;\n failure: EventName;\n /** Streaming ops only: an intermediate channel that also bridges. */\n progress?: EventName;\n}\n\nexport const BUS_OPERATIONS = {\n // ── BIND ────────────────────────────────────────────────────────\n 'bind:update-body': { result: 'bind:body-updated', failure: 'bind:body-update-failed' },\n\n // ── BROWSE (reads) ──────────────────────────────────────────────\n 'browse:resource-requested': { result: 'browse:resource-result', failure: 'browse:resource-failed' },\n 'browse:anchored-text-requested': { result: 'browse:anchored-text-result', failure: 'browse:anchored-text-failed' },\n 'browse:anchored-text-by-checksum-requested': { result: 'browse:anchored-text-by-checksum-result', failure: 'browse:anchored-text-by-checksum-failed' },\n 'browse:resources-requested': { result: 'browse:resources-result', failure: 'browse:resources-failed' },\n 'browse:annotation-requested': { result: 'browse:annotation-result', failure: 'browse:annotation-failed' },\n 'browse:annotations-requested': { result: 'browse:annotations-result', failure: 'browse:annotations-failed' },\n 'browse:annotation-history-requested': { result: 'browse:annotation-history-result', failure: 'browse:annotation-history-failed' },\n 'browse:events-requested': { result: 'browse:events-result', failure: 'browse:events-failed' },\n 'browse:referenced-by-requested': { result: 'browse:referenced-by-result', failure: 'browse:referenced-by-failed' },\n 'browse:entity-types-requested': { result: 'browse:entity-types-result', failure: 'browse:entity-types-failed' },\n 'browse:tag-schemas-requested': { result: 'browse:tag-schemas-result', failure: 'browse:tag-schemas-failed' },\n 'browse:agents-requested': { result: 'browse:agents-result', failure: 'browse:agents-failed' },\n 'browse:directory-requested': { result: 'browse:directory-result', failure: 'browse:directory-failed' },\n // dormant — gateway handler complete, no client caller yet (annotation-detail capability)\n 'browse:annotation-context-requested': { result: 'browse:annotation-context-result', failure: 'browse:annotation-context-failed' },\n\n // ── FRAME (KB schema writes) ────────────────────────────────────\n 'frame:add-entity-type': { result: 'frame:entity-type-add-ok', failure: 'frame:entity-type-add-failed' },\n 'frame:add-tag-schema': { result: 'frame:tag-schema-add-ok', failure: 'frame:tag-schema-add-failed' },\n\n // ── GATHER ──────────────────────────────────────────────────────\n // streaming: take-1 result + failure plus an intermediate progress channel\n 'gather:requested': { result: 'gather:complete', failure: 'gather:failed', progress: 'gather:annotation-progress' },\n 'gather:resource-requested': { result: 'gather:resource-complete', failure: 'gather:resource-failed' },\n // dormant — gateway handler complete, no client caller yet (annotation summary)\n 'gather:summary-requested': { result: 'gather:summary-result', failure: 'gather:summary-failed' },\n\n // ── JOB ─────────────────────────────────────────────────────────\n 'job:create': { result: 'job:created', failure: 'job:create-failed' },\n 'job:status-requested': { result: 'job:status-result', failure: 'job:status-failed' },\n 'job:cancel-requested': { result: 'job:cancel-ok', failure: 'job:cancel-failed' },\n // worker-side: the worker claims a queued job (not an SDK call)\n 'job:claim': { result: 'job:claimed', failure: 'job:claim-failed' },\n\n // ── MARK ────────────────────────────────────────────────────────\n 'mark:create-request': { result: 'mark:create-ok', failure: 'mark:create-failed' },\n 'mark:commit': { result: 'mark:commit-ok', failure: 'mark:commit-failed' },\n 'mark:delete': { result: 'mark:delete-ok', failure: 'mark:delete-failed' },\n 'mark:archive': { result: 'mark:archive-ok', failure: 'mark:archive-failed' },\n 'mark:unarchive': { result: 'mark:unarchive-ok', failure: 'mark:unarchive-failed' },\n 'mark:update-entity-types': { result: 'mark:update-entity-types-ok', failure: 'mark:update-entity-types-failed' },\n\n // ── MATCH ───────────────────────────────────────────────────────\n // take-1 dressed as an Observable in the SDK; no progress channel\n 'match:search-requested': { result: 'match:search-results', failure: 'match:search-failed' },\n\n // ── WEAVE ───────────────────────────────────────────────────────\n // Graph-projection rebuild, served by the Weaver (WEAVER-ISOLATION D3)\n 'weave:rebuild': { result: 'weave:rebuild-ok', failure: 'weave:rebuild-failed' },\n\n // ── SMELT ────────────────────────────────────────────\n // Anchored-text rebuild, served by the Smelter (PERSIST-ANCHORS P0)\n 'smelt:rebuild-anchors': { result: 'smelt:rebuild-anchors-ok', failure: 'smelt:rebuild-anchors-failed' },\n\n // ── YIELD ───────────────────────────────────────────────────────\n // live in-process (resource-operations.ts emits + awaits via race()); the\n // client also .on()-subscribes -ok for cache invalidation\n 'yield:create': { result: 'yield:create-ok', failure: 'yield:create-failed' },\n 'yield:clone-persist': { result: 'yield:clone-persist-ok', failure: 'yield:clone-persist-failed' },\n // dormant — handler in stower exists, no request emitter; client pre-subscribes -ok\n 'yield:update': { result: 'yield:update-ok', failure: 'yield:update-failed' },\n 'yield:clone-create': { result: 'yield:clone-created', failure: 'yield:clone-create-failed' },\n 'yield:clone-resource-requested': { result: 'yield:clone-resource-result', failure: 'yield:clone-resource-failed' },\n 'yield:clone-token-requested': { result: 'yield:clone-token-generated', failure: 'yield:clone-token-failed' },\n} as const satisfies Partial<Record<EmittableChannel, BusOperationSpec>>;\n\n/** The request-channel key of a registered operation — what `busRequest` takes. */\nexport type BusOperationKey = keyof typeof BUS_OPERATIONS;\n","// ⚠ GENERATED FILE — do not edit.\n//\n// Authority: specs/src/bus/registry.json (channels, payloads, operations)\n// Regenerate: node scripts/bus/generate-ts.mjs\n// Go counterpart: node scripts/bus/generate-go.mjs → packages/sdk-go/bus\n//\n// Payload schemas themselves live in the OpenAPI components; the registry\n// names which one each channel carries. Add or change a channel THERE.\n\nimport type { EventName } from './bus-protocol';\nimport { BUS_OPERATIONS } from './bus-operations';\n\n/**\n * BRIDGED_CHANNELS\n *\n * The set of bus channels that any concrete transport bridges into the\n * caller-supplied bus via `bridgeInto`. Transport-neutral: every concrete\n * `ITransport` shares the same set; HTTP delivers them via SSE, in-process\n * transports forward them directly from the local actor bus.\n *\n * This is the *fan-in* set — channels for events the transport receives and\n * pushes onto the client's bus. It is not the same as the channels the client\n * emits (which is open-ended).\n *\n * It is DERIVED, not hand-listed: the request/reply replies come from\n * `BUS_OPERATIONS` (bus-operations.ts), so no operation's reply can be\n * forgotten here — that was the recurring unbridged-reply bug class. The only\n * hand-maintained part is `BRIDGED_BROADCASTS`: the genuine non-request/reply\n * minority (lifecycle events and UI/infra signals that no single requester\n * owns). See .plans/BUS-OPERATIONS-REGISTRY.md.\n *\n * Resource-scoped channels (joined/left via `subscribeToResource`) are tracked\n * separately by transports that care about scope (HTTP).\n */\n\n/**\n * Bridged channels with no owning operation: job-lifecycle events (multi-viewer,\n * no single requester owns the reply), KB-global frame domain events, UI signals,\n * and SSE infrastructure. A reply channel must NOT go here — declare its\n * operation in `BUS_OPERATIONS` instead.\n */\nexport const BRIDGED_BROADCASTS = [\n 'job:report-progress',\n 'job:complete',\n 'job:fail',\n 'frame:entity-type-added',\n 'frame:tag-schema-added',\n 'yield:created',\n 'yield:updated',\n 'yield:cloned',\n 'yield:moved',\n 'beckon:focus',\n 'beckon:sparkle',\n 'bus:resume-gap',\n 'browse:resource-open',\n 'browse:resource-viewed',\n 'session:joined',\n 'session:left',\n 'browse:click',\n] as const satisfies readonly EventName[];\n\n// ── Derivation ──────────────────────────────────────────────────────────────\n// Every operation's result + failure (+ progress) channel bridges, by\n// construction. Type and runtime are derived from the same `BUS_OPERATIONS`.\n\ntype OpSpecs = (typeof BUS_OPERATIONS)[keyof typeof BUS_OPERATIONS];\n\n// Generic wrapper so the conditional distributes over each union member (a bare\n// `OpSpecs extends …` would test the whole union at once and collapse to never\n// because only the streaming ops carry `progress`).\ntype ProgressChannel<O> = O extends { progress: infer P extends EventName } ? P : never;\n\n/** The union of every reply channel declared in the registry. */\ntype RegistryReply = OpSpecs['result'] | OpSpecs['failure'] | ProgressChannel<OpSpecs>;\n\n// Iterate by typed key so each op's literal reply types survive — the element\n// type stays `RegistryReply` (no widening to `EventName`), so the composed\n// array is `BridgedChannel[]` with no narrowing assertion. The runtime proof\n// that this derived set is exactly the intended one is the equality test in\n// __tests__/bus-invariants.test.ts.\nconst REGISTRY_REPLIES = (Object.keys(BUS_OPERATIONS) as (keyof typeof BUS_OPERATIONS)[]).flatMap(\n (key) => {\n const op = BUS_OPERATIONS[key];\n return 'progress' in op ? [op.result, op.failure, op.progress] : [op.result, op.failure];\n },\n);\n\nexport const BRIDGED_CHANNELS: readonly BridgedChannel[] = [\n ...REGISTRY_REPLIES,\n ...BRIDGED_BROADCASTS,\n];\n\n/**\n * The SUBSCRIBE-side subset of `EventName` — the channels a client can receive\n * over a concrete transport. See the family note on `EventName` in\n * bus-protocol.ts (emit on an `EmittableChannel`, subscribe on a `BridgedChannel`).\n */\nexport type BridgedChannel = RegistryReply | (typeof BRIDGED_BROADCASTS)[number];\n","/**\n * Bus logging — runtime-toggleable cross-wire visibility.\n *\n * One line per event that crosses a process boundary, in a grep-able\n * format that's symmetric across frontend and gateway:\n *\n * [bus EMIT] <channel> [scope=X] [cid=<first8>] <payload>\n * [bus RECV] <channel> [scope=X] [cid=<first8>] <payload>\n * [bus SSE] <channel> [scope=X] [cid=<first8>] <payload>\n *\n * Tier 1 of `.plans/OBSERVABILITY.md`. Forward-compatible with Tier 2:\n * the `cid` printed here is exactly the prefix of the W3C trace-id we\n * adopt later.\n *\n * Cost when disabled: one property read per call, zero allocations.\n *\n * Enable:\n * - Browser: `window.__SEMIONT_BUS_LOG__ = true` (DevTools or e2e init)\n * - Node: `SEMIONT_BUS_LOG=1` in the process env (read at module load)\n */\n\nimport { BRIDGED_CHANNELS } from './bridged-channels';\n\nconst NODE_BUS_LOG =\n typeof process !== 'undefined' && !!process.env?.SEMIONT_BUS_LOG;\n\nconst IS_NODE =\n typeof process !== 'undefined' && !!process.versions?.node;\n\nexport type BusOp = 'EMIT' | 'RECV' | 'SSE' | 'PUT' | 'GET';\n\nexport function busLogEnabled(): boolean {\n const g = globalThis as { __SEMIONT_BUS_LOG__?: boolean };\n if (g.__SEMIONT_BUS_LOG__) return true;\n return NODE_BUS_LOG;\n}\n\n/**\n * Optional active-span trace-id provider. When a Tier 2 OTel SDK is\n * initialized, `@semiont/observability` registers a provider here that\n * returns the active span's W3C `trace_id`. busLog appends it to each\n * emitted line so the grep-timeline correlates with the span tree in\n * an APM UI.\n *\n * Decoupling: `@semiont/core` does not depend on `@opentelemetry/api`.\n * If no provider is registered (Tier 1-only deployments, or before\n * `initObservabilityNode` runs), the field is omitted from the line —\n * same shape as before this hook existed.\n */\nlet traceIdProvider: (() => string | undefined) | undefined;\n\nexport function setBusLogTraceIdProvider(fn: (() => string | undefined) | undefined): void {\n traceIdProvider = fn;\n}\n\nexport function busLog(\n op: BusOp,\n channel: string,\n payload: unknown,\n scope?: string,\n): void {\n if (!busLogEnabled()) return;\n const cidRaw = (payload as { correlationId?: unknown } | null | undefined)?.correlationId;\n const cid = typeof cidRaw === 'string' ? cidRaw.slice(0, 8) : undefined;\n let traceId: string | undefined;\n if (traceIdProvider) {\n try { traceId = traceIdProvider(); } catch { /* noop */ }\n }\n const tag =\n `[bus ${op}] ${channel}` +\n (scope ? ` scope=${scope}` : '') +\n (cid ? ` cid=${cid}` : '') +\n (traceId ? ` trace=${traceId.slice(0, 8)}` : '');\n // eslint-disable-next-line no-console\n console.debug(tag, payload);\n}\n\n/**\n * Whether to run the unobserved-reply check on every local emit.\n *\n * On in Node (gateway + worker + smelter), where a dropped reply is a real\n * delivery bug; off in the browser, where a 0-observer bridged reply just\n * means the awaiting `busRequest` already resolved/timed out (benign).\n *\n * Always-on (no env flag) by design: the failure it catches is rare and\n * high-signal, and the whole point is that it fires with zero setup — the\n * incident that motivated it (.plans/bugs/gather-resource-complete-not-bridged.md)\n * ran with bus-logging off, so a flag-gated check would have stayed silent.\n */\nexport function warnUnobservedRepliesEnabled(): boolean {\n return IS_NODE;\n}\n\n/** One line per channel per process — a missing fan-in wiring is a config\n * bug, so the first dropped reply is enough; we don't spam on retries. */\nconst unobservedReplyWarned = new Set<string>();\n\n/**\n * The silent-dropped-reply detector.\n *\n * A correlation-bearing payload is a request/reply *reply* (`*-result`,\n * `*-complete`, `*-failed`, …). If one is emitted on the gateway bus with\n * **zero local observers**, nothing forwards it — no SSE subscription, no\n * in-process consumer — so the awaiting client never receives it and times\n * out 30 s later with no error logged anywhere. That is exactly how\n * `gather:resource-complete` failed when it was missing from\n * `BRIDGED_CHANNELS` (.plans/bugs/gather-resource-complete-not-bridged.md).\n *\n * Emits one WARN per channel naming the likely fix. Ignored (no warning):\n * non-reply emits (no `correlationId`), emits with observers, and — crucially —\n * channels already in `BRIDGED_CHANNELS`: a 0-observer emit there is a redundant\n * copy, not a gap (see .plans/bugs/BRIDGE-GAPS.md). So the detector fires only\n * for a genuine missing forwarder, and its remediation text is always correct.\n */\nexport function warnIfUnobservedReply(\n channel: string,\n payload: unknown,\n observerCount: number,\n): void {\n if (observerCount > 0) return;\n const cidRaw = (payload as { correlationId?: unknown } | null | undefined)?.correlationId;\n if (typeof cidRaw !== 'string' || cidRaw.length === 0) return;\n // A 0-observer emit on a *bridged* channel is a redundant copy (a global +\n // resource-scoped dual-emit, or an SSE reconnect replay), not a missing\n // forwarder — the first copy already reached the awaiting `take(1)`\n // subscriber. Only a NOT-bridged channel is a genuine drop. (`busRequest` now\n // types its reply channels `BridgedChannel`, so an unbridged reply is a\n // compile error; this runtime check covers non-`busRequest` correlation\n // emits.) See .plans/bugs/BRIDGE-GAPS.md.\n if ((BRIDGED_CHANNELS as readonly string[]).includes(channel)) return;\n if (unobservedReplyWarned.has(channel)) return;\n unobservedReplyWarned.add(channel);\n // eslint-disable-next-line no-console\n console.warn(\n `[bus DROP] ${channel} cid=${cidRaw.slice(0, 8)} emitted with 0 subscribers and not in ` +\n `BRIDGED_CHANNELS — a correlation reply with no forwarder is dropped, so the awaiting ` +\n `client times out (no error). Bridge it by declaring its operation in BUS_OPERATIONS ` +\n `(packages/core/src/bus-operations.ts) — or, if it is a non-reply broadcast, add it to ` +\n `BRIDGED_BROADCASTS (packages/core/src/bridged-channels.ts) — so transports subscribe to it.`,\n );\n}\n","/**\n * RxJS-based Event Bus\n *\n * Framework-agnostic event bus providing direct access to typed RxJS Subjects.\n *\n * Can be used in Node.js, browser, workers, CLI - anywhere RxJS runs.\n */\n\nimport { Subject } from 'rxjs';\nimport { busLog, busLogEnabled, warnIfUnobservedReply, warnUnobservedRepliesEnabled } from './bus-log';\nimport type { EventMap } from './bus-protocol';\nimport type { StoredEvent } from './event-base';\nimport type { PersistedEventType } from './persisted-events';\n\n/**\n * RxJS-based event bus\n *\n * Provides direct access to RxJS Subjects for each event type.\n * Use standard RxJS patterns for emitting and subscribing.\n *\n * @example\n * ```typescript\n * const eventBus = new EventBus();\n *\n * // Emit events\n * eventBus.get('beckon:hover').next({ annotationId: 'ann-1' });\n *\n * // Subscribe to events\n * const subscription = eventBus.get('beckon:hover').subscribe(({ annotationId }) => {\n * console.log('Hover:', annotationId);\n * });\n *\n * // Use RxJS operators\n * import { debounceTime } from 'rxjs/operators';\n * eventBus.get('beckon:hover')\n * .pipe(debounceTime(100))\n * .subscribe(handleHover);\n *\n * // Cleanup\n * subscription.unsubscribe();\n * eventBus.destroy();\n * ```\n */\nexport class EventBus {\n private subjects: Map<keyof EventMap, Subject<any>>;\n private isDestroyed: boolean;\n\n constructor() {\n this.subjects = new Map();\n this.isDestroyed = false;\n }\n\n /**\n * Get the RxJS Subject for an event\n *\n * Returns a typed Subject that can be used with all RxJS operators.\n * Subjects are created lazily on first access.\n *\n * @param eventName - The event name\n * @returns The RxJS Subject for this event\n *\n * @example\n * ```typescript\n * // Emit\n * eventBus.get('beckon:hover').next({ annotationId: 'ann-1' });\n *\n * // Subscribe\n * const sub = eventBus.get('beckon:hover').subscribe(handleHover);\n *\n * // With operators\n * eventBus.get('beckon:hover')\n * .pipe(debounceTime(100), distinctUntilChanged())\n * .subscribe(handleHover);\n * ```\n */\n get<K extends keyof EventMap>(eventName: K): Subject<EventMap[K]> {\n if (this.isDestroyed) {\n throw new Error(`Cannot access event '${String(eventName)}' on destroyed bus`);\n }\n\n if (!this.subjects.has(eventName)) {\n const subject = new Subject<EventMap[K]>();\n // When bus-log is enabled (`SEMIONT_BUS_LOG=1` or\n // `window.__SEMIONT_BUS_LOG__ = true`), wrap `.next()` so every\n // local emit on this channel produces a `[bus EMIT] <channel> ...`\n // line on `console.debug` — same shape as cross-wire emits from\n // HttpTransport. This is what makes local-only fan-out signals\n // (`beckon.hover`, `beckon.sparkle`, `mark.request`, etc.)\n // visible to the e2e bus capture and to a developer's DevTools.\n // The `busLogEnabled()` check is at first-`get` time per channel;\n // setting the flag after channels are constructed won't\n // retroactively wrap them. The bus capture fixture uses\n // `addInitScript` so the flag is set before any namespace\n // construction, which is when `get()` is first called.\n //\n // Independently, on Node we wrap `.next()` to catch *dropped replies*:\n // a correlation-bearing payload emitted with zero observers (see\n // `warnIfUnobservedReply`). This needs no flag — it's how the\n // `gather:resource-complete` bridge gap stayed invisible until a 30 s\n // timeout. The two wraps share one closure when both are active.\n const wantBusLog = busLogEnabled();\n const wantDropCheck = warnUnobservedRepliesEnabled();\n if (wantBusLog || wantDropCheck) {\n const wrapped = subject;\n const originalNext = subject.next.bind(subject);\n subject.next = (value: EventMap[K]): void => {\n if (wantBusLog) busLog('EMIT', String(eventName), value as object);\n if (wantDropCheck) warnIfUnobservedReply(String(eventName), value, wrapped.observers.length);\n originalNext(value);\n };\n }\n this.subjects.set(eventName, subject);\n }\n return this.subjects.get(eventName)!;\n }\n\n /**\n * Get the RxJS Subject for a domain event type (PersistedEventType).\n *\n * Domain event channels carry `StoredEvent`. This method avoids the need\n * for `as keyof EventMap` casts when subscribing to domain event channels\n * using runtime `PersistedEventType` strings.\n */\n getDomainEvent(eventType: PersistedEventType): Subject<StoredEvent> {\n return this.get(eventType as keyof EventMap) as unknown as Subject<StoredEvent>;\n }\n\n /**\n * Channel names with at least one live observer right now. Introspection\n * for composition-parity gates: `get()` creates subjects lazily, so mere\n * access does not count — only real subscriptions do. Scoped channels\n * appear under their namespaced key (`<scope>:<channel>`).\n */\n observedChannels(): string[] {\n const out: string[] = [];\n for (const [name, subject] of this.subjects) {\n if (subject.observed) out.push(String(name));\n }\n return out;\n }\n\n /**\n * Destroy the event bus and complete all subjects\n *\n * After calling destroy(), no new events can be emitted or subscribed to.\n * All active subscriptions will be completed.\n */\n destroy(): void {\n if (this.isDestroyed) {\n return;\n }\n\n for (const subject of this.subjects.values()) {\n subject.complete();\n }\n\n this.subjects.clear();\n this.isDestroyed = true;\n }\n\n /**\n * Check if the event bus has been destroyed\n */\n get destroyed(): boolean {\n return this.isDestroyed;\n }\n\n /**\n * Create a resource-scoped event bus\n *\n * Events emitted or subscribed through the scoped bus are isolated to that resource.\n * Internally, events are namespaced but the API remains identical to the parent bus.\n *\n * @param resourceId - Resource identifier to scope events to\n * @returns A scoped event bus for this resource\n *\n * @example\n * ```typescript\n * const eventBus = new EventBus();\n * const resource1 = eventBus.scope('resource-1');\n * const resource2 = eventBus.scope('resource-2');\n *\n * // These are isolated - only resource1 subscribers will fire\n * resource1.get('detection:progress').next({ status: 'started' });\n * ```\n */\n scope(resourceId: string): ScopedEventBus {\n return new ScopedEventBus(this, resourceId);\n }\n}\n\n/**\n * Resource-scoped event bus\n *\n * Provides isolated event streams per resource while maintaining the same API\n * as the parent EventBus. Events are internally namespaced by resourceId.\n */\nexport class ScopedEventBus {\n constructor(\n private parent: EventBus,\n private scopePrefix: string\n ) {}\n\n /**\n * Get the RxJS Subject for a scoped event\n *\n * Returns the same type as the parent bus, but events are isolated to this scope.\n * Internally uses namespaced keys but preserves type safety.\n *\n * @param event - The event name\n * @returns The RxJS Subject for this scoped event\n */\n get<E extends keyof EventMap>(event: E): Subject<EventMap[E]> {\n // Internally namespace the event key, but preserve return type\n const scopedKey = `${this.scopePrefix}:${event as string}`;\n\n // Access parent's subjects map directly (needs cast for private access)\n const parentSubjects = (this.parent as any).subjects as Map<string, Subject<any>>;\n\n if (!parentSubjects.has(scopedKey)) {\n parentSubjects.set(scopedKey, new Subject<EventMap[E]>());\n }\n return parentSubjects.get(scopedKey)!;\n }\n\n /** Get the RxJS Subject for a domain event type on this scoped bus. */\n getDomainEvent(eventType: PersistedEventType): Subject<StoredEvent> {\n return this.get(eventType as keyof EventMap) as unknown as Subject<StoredEvent>;\n }\n\n /**\n * Create a nested scope\n *\n * Allows hierarchical scoping like `resource-1:subsystem-a`\n *\n * @param subScope - Additional scope level\n * @returns A nested scoped event bus\n */\n scope(subScope: string): ScopedEventBus {\n return new ScopedEventBus(this.parent, `${this.scopePrefix}:${subScope}`);\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { baseUrl, EventBus, BRIDGED_CHANNELS, BUS_OPERATIONS } from './chunk-
|
|
1
|
+
import { baseUrl, EventBus, BRIDGED_CHANNELS, BUS_OPERATIONS } from './chunk-EWOITHBH.js';
|
|
2
2
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
3
3
|
|
|
4
4
|
function isOperation(channel) {
|
|
@@ -28,13 +28,13 @@ var FaultyTransport = class {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Queue responses for `op`, consumed FIFO — one per request that reaches
|
|
31
|
-
* the simulated
|
|
32
|
-
* (SDK-TESTING-DOUBLE.md, gap 2). The queue scripts the
|
|
31
|
+
* the simulated gateway — before falling back to `makeResponse`
|
|
32
|
+
* (SDK-TESTING-DOUBLE.md, gap 2). The queue scripts the GATEWAY; the fault
|
|
33
33
|
* schedule scripts the WIRE. Consequences, deliberately: `duplicate-reply`
|
|
34
34
|
* replays one entry's body twice, and a `drop-reply` still consumes its
|
|
35
|
-
* entry (the
|
|
35
|
+
* entry (the gateway answered; the wire ate it) — so "first reply lost,
|
|
36
36
|
* the retry sees the NEXT page" is expressible. `reject-emit` consumes
|
|
37
|
-
* nothing: that request never reached the
|
|
37
|
+
* nothing: that request never reached the gateway.
|
|
38
38
|
*/
|
|
39
39
|
queueReply(op, ...responses) {
|
|
40
40
|
const q = this.replyQueues.get(op) ?? [];
|
|
@@ -140,5 +140,5 @@ var FaultyTransport = class {
|
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
export { FaultyTransport, retryKeyOf };
|
|
143
|
-
//# sourceMappingURL=chunk-
|
|
144
|
-
//# sourceMappingURL=chunk-
|
|
143
|
+
//# sourceMappingURL=chunk-IQGH6UJN.js.map
|
|
144
|
+
//# sourceMappingURL=chunk-IQGH6UJN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/faulty-transport.ts"],"names":[],"mappings":";;;AA6EA,SAAS,YAAY,OAAA,EAA6C;AAChE,EAAA,OAAO,OAAA,IAAW,cAAA;AACpB;AAGO,SAAS,UA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A;AAAA,EAIA,OAAA,GAAgB;AACd,IAAA,IAAI,KAAK,QAAA,EAAU;AACnB,IAAA,IAAA,CAAK,QAAA,GAAW,IAAA;AAChB,IAAA,KAAA,MAAW,CAAA,IAAK,IAAA,CAAK,MAAA,EAAQ,YAAA,CAAa,CAAC,CAAA;AAC3C,IAAA,IAAA,CAAK,OAAO,KAAA,EAAM;AAClB,IAAA,IAAA,CAAK,MAAA,CAAO,KAAK,QAAQ,CAAA;AACzB,IAAA,IAAA,CAAK,OAAO,QAAA,EAAS;AACrB,IAAA,IAAA,CAAK,cAAc,QAAA,EAAS;AAE5B,IAAA,IAAA,CAAK,IAAI,OAAA,EAAQ;AAAA,EACnB;AACF","file":"chunk-PPUO5IPX.js","sourcesContent":["/**\n * FaultyTransport — a seeded, scriptable `ITransport` simulator for the\n * liveness axioms (`.plans/LIVENESS-AXIOMS.md`). fast-check draws a fault\n * schedule; the transport applies one `FaultAction` per request-channel emit\n * and synthesizes replies from the `BUS_OPERATIONS` registry, so real\n * compositions (`busRequest`, SWR caches, live queries) run unmodified against\n * generated wire behavior no hand-written test names.\n *\n * Home is core (not sdk/test-utils) for the same reason as\n * `assertStateUnitAxioms`: it needs only core types, and every layer —\n * including `http-transport`, below sdk — can consume it via\n * `@semiont/core/testing` without a dependency cycle.\n *\n * Deterministic-by-construction: no `Date.now`, no randomness of its own —\n * all variation comes in through the schedule (fast-check owns the seed).\n * Time is real `setTimeout` at millisecond scale; properties pass a small\n * explicit `timeoutMs` to `busRequest`, so nothing waits 30 s.\n */\n\nimport { BehaviorSubject, Subject, type Observable } from 'rxjs';\nimport type { SemiontError } from './errors';\nimport type { BaseUrl } from './branded-types';\nimport { baseUrl as makeBaseUrl } from './branded-types';\nimport type { ResourceId } from './identifiers';\nimport type { EventMap } from './bus-protocol';\nimport type { ConnectionState, ITransport } from './transport';\nimport { EventBus } from './event-bus';\nimport { BRIDGED_CHANNELS } from './bridged-channels';\nimport { BUS_OPERATIONS, type BusOperationKey } from './bus-operations';\n\n/** One wire behavior, applied to a single request-channel emit. */\nexport type FaultAction =\n | { kind: 'deliver' }\n | { kind: 'drop-reply' }\n | { kind: 'delay'; ms: number }\n | { kind: 'duplicate-reply' }\n | { kind: 'reject-emit' };\n\n/** requestLog entry — one per request-channel emit, in arrival order. */\nexport interface RequestLogEntry {\n channel: BusOperationKey;\n /** The action the schedule assigned to this emit. */\n action: FaultAction;\n correlationId: string | undefined;\n /**\n * Request identity for retry accounting: channel + payload minus the\n * per-issue fields (`correlationId`, `_trace`, `_userId`). Two emits with\n * the same key are the same logical request re-issued.\n */\n retryKey: string;\n /**\n * The payload as emitted — envelope, options, params, `correlationId` and\n * all. This is the surface for \"assert what my orchestrator actually SENT\"\n * (SDK-TESTING-DOUBLE gap 6): without it every consumer harness re-invented\n * a per-channel `transport.on(...)` wire recorder alongside this log.\n *\n * SHALLOW snapshot: the top level is copied at emit time, so a caller that\n * mutates its own payload object afterwards cannot rewrite history. Nested\n * objects are shared by reference — deep-freeze is not worth the cost in a\n * double, and no in-repo caller mutates nested request payloads.\n */\n payload: Record<string, unknown>;\n}\n\nexport interface FaultyTransportConfig {\n /**\n * The i-th request-channel emit applies `schedule[i % schedule.length]`.\n * Empty/omitted → every request delivers.\n */\n schedule?: readonly FaultAction[];\n /**\n * Synthesize the `response` value for a delivered reply. Return `undefined`\n * for a void ack (`{ correlationId }` only). Default: `{}` for every op.\n */\n makeResponse?: (operation: BusOperationKey, payload: Record<string, unknown>) => unknown;\n}\n\nfunction isOperation(channel: string): channel is BusOperationKey {\n return channel in BUS_OPERATIONS;\n}\n\n/** Stable request identity: channel + sorted payload minus per-issue fields. */\nexport function retryKeyOf(channel: string, payload: Record<string, unknown>): string {\n const entries = Object.entries(payload)\n .filter(([k]) => k !== 'correlationId' && k !== '_trace' && k !== '_userId')\n .sort(([a], [b]) => (a < b ? -1 : 1));\n return `${channel} ${JSON.stringify(entries)}`;\n}\n\nexport class FaultyTransport implements ITransport {\n readonly baseUrl: BaseUrl = makeBaseUrl('faulty://simulator');\n readonly state$ = new BehaviorSubject<ConnectionState>('open');\n private readonly errorsSubject = new Subject<SemiontError>();\n readonly errors$: Observable<SemiontError> = this.errorsSubject.asObservable();\n\n /** Every request-channel emit, in order — the L2 accounting surface. */\n readonly requestLog: RequestLogEntry[] = [];\n\n private readonly bus = new EventBus();\n private readonly schedule: readonly FaultAction[];\n private readonly makeResponse: (op: BusOperationKey, payload: Record<string, unknown>) => unknown;\n private readonly replyQueues = new Map<BusOperationKey, unknown[]>();\n private requestCount = 0;\n private readonly timers = new Set<ReturnType<typeof setTimeout>>();\n private disposed = false;\n\n constructor(cfg: FaultyTransportConfig = {}) {\n this.schedule = cfg.schedule ?? [];\n this.makeResponse = cfg.makeResponse ?? (() => ({}));\n }\n\n /**\n * Queue responses for `op`, consumed FIFO — one per request that reaches\n * the simulated backend — before falling back to `makeResponse`\n * (SDK-TESTING-DOUBLE.md, gap 2). The queue scripts the BACKEND; the fault\n * schedule scripts the WIRE. Consequences, deliberately: `duplicate-reply`\n * replays one entry's body twice, and a `drop-reply` still consumes its\n * entry (the backend answered; the wire ate it) — so \"first reply lost,\n * the retry sees the NEXT page\" is expressible. `reject-emit` consumes\n * nothing: that request never reached the backend.\n */\n queueReply(op: BusOperationKey, ...responses: unknown[]): void {\n const q = this.replyQueues.get(op) ?? [];\n q.push(...responses);\n this.replyQueues.set(op, q);\n }\n\n // ── Bus primitives ──────────────────────────────────────────────────────\n\n async emit<K extends keyof EventMap>(\n channel: K,\n payload: EventMap[K],\n resourceScope?: ResourceId,\n ): Promise<number> {\n // The double models exactly one connected participant, so a delivered\n // emit reports `1`; post-dispose it is inert and reports the `-1`\n // \"count unknown\" sentinel.\n if (this.disposed) return -1;\n const name = channel as string;\n if (!isOperation(name)) {\n // Non-request channel: forward as-is (scoped or global).\n const target = resourceScope === undefined\n ? this.bus.get(channel)\n : this.bus.scope(resourceScope as string).get(channel);\n target.next(payload);\n return 1;\n }\n\n const record = payload as Record<string, unknown>;\n const action: FaultAction = this.schedule.length === 0\n ? { kind: 'deliver' }\n : this.schedule[this.requestCount % this.schedule.length]!;\n this.requestCount += 1;\n this.requestLog.push({\n channel: name,\n action,\n correlationId: typeof record.correlationId === 'string' ? record.correlationId : undefined,\n retryKey: retryKeyOf(name, record),\n payload: { ...record },\n });\n\n if (action.kind === 'reject-emit') {\n // Models a /bus/emit 4xx: the request never reaches the bus.\n throw new Error(`FaultyTransport: emit rejected by schedule (reject-emit) on ${name}`);\n }\n\n // The request itself is observable (handlers-eye view), then the\n // simulator plays backend: synthesize the registry reply per the action.\n this.bus.get(channel).next(payload);\n\n // The backend's answer is computed ONCE per request that reaches it —\n // the reply QUEUE scripts the backend, the fault schedule scripts the\n // wire (SDK-TESTING-DOUBLE.md Phase 2). So `duplicate-reply` replays the\n // same body twice, and a `drop-reply` still consumes its queue entry:\n // the backend answered, the wire ate it.\n const queue = this.replyQueues.get(name);\n const response = queue && queue.length > 0 ? queue.shift() : this.makeResponse(name, record);\n\n const reply = (): void => {\n if (this.disposed) return;\n const replyPayload = response === undefined\n ? { correlationId: record.correlationId }\n : { correlationId: record.correlationId, response };\n const resultChannel = BUS_OPERATIONS[name].result as keyof EventMap;\n this.bus.get(resultChannel).next(replyPayload as EventMap[keyof EventMap]);\n };\n\n switch (action.kind) {\n case 'deliver':\n queueMicrotask(reply);\n break;\n case 'duplicate-reply':\n queueMicrotask(reply);\n queueMicrotask(reply);\n break;\n case 'delay': {\n const t = setTimeout(() => { this.timers.delete(t); reply(); }, action.ms);\n this.timers.add(t);\n break;\n }\n case 'drop-reply':\n break;\n }\n return 1;\n }\n\n on<K extends keyof EventMap>(channel: K, handler: (payload: EventMap[K]) => void): () => void {\n const sub = this.bus.get(channel).subscribe(handler);\n return () => sub.unsubscribe();\n }\n\n stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]> {\n return this.bus.get(channel);\n }\n\n subscribeToResource(_rid: ResourceId): () => void {\n // Mirrors the real HttpTransport: distinct scopes COMPOSE\n // (MULTI-RESOURCE-SCOPE). Delivery here is bus-direct and never\n // scope-gated, so acquisition needs no bookkeeping and release\n // (idempotent by construction) is a no-op.\n return () => {};\n }\n\n /**\n * Correlated-reply tracking (BUS-RESUMPTION.md Phase 2 / SDK-DEBT S1),\n * exposed for assertions: `busRequest` registers each cid here before its\n * emit and releases on settle, so a test can pin the tracked set at any\n * point of a request's lifecycle. Delivery in this double is bus-direct\n * (nothing to replay), so tracking has no behavioral effect.\n */\n readonly pendingReplies = new Set<string>();\n\n trackReply(correlationId: string): () => void {\n this.pendingReplies.add(correlationId);\n let released = false;\n return () => {\n if (released) return;\n released = true;\n this.pendingReplies.delete(correlationId);\n };\n }\n\n bridgeInto(bus: EventBus): void {\n for (const channel of BRIDGED_CHANNELS) {\n this.bus.get(channel as keyof EventMap).subscribe((payload) => {\n bus.get(channel as keyof EventMap).next(payload as EventMap[keyof EventMap]);\n });\n }\n }\n\n // ── Lifecycle ───────────────────────────────────────────────────────────\n\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n for (const t of this.timers) clearTimeout(t);\n this.timers.clear();\n this.state$.next('closed');\n this.state$.complete();\n this.errorsSubject.complete();\n // Completes every subject: in-flight busRequests resolve `bus.closed`.\n this.bus.destroy();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/faulty-transport.ts"],"names":[],"mappings":";;;AA6EA,SAAS,YAAY,OAAA,EAA6C;AAChE,EAAA,OAAO,OAAA,IAAW,cAAA;AACpB;AAGO,SAAS,UAAA,CAAW,SAAiB,OAAA,EAA0C;AACpF,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAA,CACnC,MAAA,CAAO,CAAC,CAAC,CAAC,CAAA,KAAM,CAAA,KAAM,eAAA,IAAmB,CAAA,KAAM,QAAA,IAAY,CAAA,KAAM,SAAS,CAAA,CAC1E,IAAA,CAAK,CAAC,CAAC,CAAC,CAAA,EAAG,CAAC,CAAC,CAAA,KAAO,CAAA,GAAI,C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,CAAK,OAAO,QAAA,EAAS;AACrB,IAAA,IAAA,CAAK,cAAc,QAAA,EAAS;AAE5B,IAAA,IAAA,CAAK,IAAI,OAAA,EAAQ;AAAA,EACnB;AACF","file":"chunk-IQGH6UJN.js","sourcesContent":["/**\n * FaultyTransport — a seeded, scriptable `ITransport` simulator for the\n * liveness axioms (`.plans/LIVENESS-AXIOMS.md`). fast-check draws a fault\n * schedule; the transport applies one `FaultAction` per request-channel emit\n * and synthesizes replies from the `BUS_OPERATIONS` registry, so real\n * compositions (`busRequest`, SWR caches, live queries) run unmodified against\n * generated wire behavior no hand-written test names.\n *\n * Home is core (not sdk/test-utils) for the same reason as\n * `assertStateUnitAxioms`: it needs only core types, and every layer —\n * including `http-transport`, below sdk — can consume it via\n * `@semiont/core/testing` without a dependency cycle.\n *\n * Deterministic-by-construction: no `Date.now`, no randomness of its own —\n * all variation comes in through the schedule (fast-check owns the seed).\n * Time is real `setTimeout` at millisecond scale; properties pass a small\n * explicit `timeoutMs` to `busRequest`, so nothing waits 30 s.\n */\n\nimport { BehaviorSubject, Subject, type Observable } from 'rxjs';\nimport type { SemiontError } from './errors';\nimport type { BaseUrl } from './branded-types';\nimport { baseUrl as makeBaseUrl } from './branded-types';\nimport type { ResourceId } from './identifiers';\nimport type { EventMap } from './bus-protocol';\nimport type { ConnectionState, ITransport } from './transport';\nimport { EventBus } from './event-bus';\nimport { BRIDGED_CHANNELS } from './bridged-channels';\nimport { BUS_OPERATIONS, type BusOperationKey } from './bus-operations';\n\n/** One wire behavior, applied to a single request-channel emit. */\nexport type FaultAction =\n | { kind: 'deliver' }\n | { kind: 'drop-reply' }\n | { kind: 'delay'; ms: number }\n | { kind: 'duplicate-reply' }\n | { kind: 'reject-emit' };\n\n/** requestLog entry — one per request-channel emit, in arrival order. */\nexport interface RequestLogEntry {\n channel: BusOperationKey;\n /** The action the schedule assigned to this emit. */\n action: FaultAction;\n correlationId: string | undefined;\n /**\n * Request identity for retry accounting: channel + payload minus the\n * per-issue fields (`correlationId`, `_trace`, `_userId`). Two emits with\n * the same key are the same logical request re-issued.\n */\n retryKey: string;\n /**\n * The payload as emitted — envelope, options, params, `correlationId` and\n * all. This is the surface for \"assert what my orchestrator actually SENT\"\n * (SDK-TESTING-DOUBLE gap 6): without it every consumer harness re-invented\n * a per-channel `transport.on(...)` wire recorder alongside this log.\n *\n * SHALLOW snapshot: the top level is copied at emit time, so a caller that\n * mutates its own payload object afterwards cannot rewrite history. Nested\n * objects are shared by reference — deep-freeze is not worth the cost in a\n * double, and no in-repo caller mutates nested request payloads.\n */\n payload: Record<string, unknown>;\n}\n\nexport interface FaultyTransportConfig {\n /**\n * The i-th request-channel emit applies `schedule[i % schedule.length]`.\n * Empty/omitted → every request delivers.\n */\n schedule?: readonly FaultAction[];\n /**\n * Synthesize the `response` value for a delivered reply. Return `undefined`\n * for a void ack (`{ correlationId }` only). Default: `{}` for every op.\n */\n makeResponse?: (operation: BusOperationKey, payload: Record<string, unknown>) => unknown;\n}\n\nfunction isOperation(channel: string): channel is BusOperationKey {\n return channel in BUS_OPERATIONS;\n}\n\n/** Stable request identity: channel + sorted payload minus per-issue fields. */\nexport function retryKeyOf(channel: string, payload: Record<string, unknown>): string {\n const entries = Object.entries(payload)\n .filter(([k]) => k !== 'correlationId' && k !== '_trace' && k !== '_userId')\n .sort(([a], [b]) => (a < b ? -1 : 1));\n return `${channel} ${JSON.stringify(entries)}`;\n}\n\nexport class FaultyTransport implements ITransport {\n readonly baseUrl: BaseUrl = makeBaseUrl('faulty://simulator');\n readonly state$ = new BehaviorSubject<ConnectionState>('open');\n private readonly errorsSubject = new Subject<SemiontError>();\n readonly errors$: Observable<SemiontError> = this.errorsSubject.asObservable();\n\n /** Every request-channel emit, in order — the L2 accounting surface. */\n readonly requestLog: RequestLogEntry[] = [];\n\n private readonly bus = new EventBus();\n private readonly schedule: readonly FaultAction[];\n private readonly makeResponse: (op: BusOperationKey, payload: Record<string, unknown>) => unknown;\n private readonly replyQueues = new Map<BusOperationKey, unknown[]>();\n private requestCount = 0;\n private readonly timers = new Set<ReturnType<typeof setTimeout>>();\n private disposed = false;\n\n constructor(cfg: FaultyTransportConfig = {}) {\n this.schedule = cfg.schedule ?? [];\n this.makeResponse = cfg.makeResponse ?? (() => ({}));\n }\n\n /**\n * Queue responses for `op`, consumed FIFO — one per request that reaches\n * the simulated gateway — before falling back to `makeResponse`\n * (SDK-TESTING-DOUBLE.md, gap 2). The queue scripts the GATEWAY; the fault\n * schedule scripts the WIRE. Consequences, deliberately: `duplicate-reply`\n * replays one entry's body twice, and a `drop-reply` still consumes its\n * entry (the gateway answered; the wire ate it) — so \"first reply lost,\n * the retry sees the NEXT page\" is expressible. `reject-emit` consumes\n * nothing: that request never reached the gateway.\n */\n queueReply(op: BusOperationKey, ...responses: unknown[]): void {\n const q = this.replyQueues.get(op) ?? [];\n q.push(...responses);\n this.replyQueues.set(op, q);\n }\n\n // ── Bus primitives ──────────────────────────────────────────────────────\n\n async emit<K extends keyof EventMap>(\n channel: K,\n payload: EventMap[K],\n resourceScope?: ResourceId,\n ): Promise<number> {\n // The double models exactly one connected participant, so a delivered\n // emit reports `1`; post-dispose it is inert and reports the `-1`\n // \"count unknown\" sentinel.\n if (this.disposed) return -1;\n const name = channel as string;\n if (!isOperation(name)) {\n // Non-request channel: forward as-is (scoped or global).\n const target = resourceScope === undefined\n ? this.bus.get(channel)\n : this.bus.scope(resourceScope as string).get(channel);\n target.next(payload);\n return 1;\n }\n\n const record = payload as Record<string, unknown>;\n const action: FaultAction = this.schedule.length === 0\n ? { kind: 'deliver' }\n : this.schedule[this.requestCount % this.schedule.length]!;\n this.requestCount += 1;\n this.requestLog.push({\n channel: name,\n action,\n correlationId: typeof record.correlationId === 'string' ? record.correlationId : undefined,\n retryKey: retryKeyOf(name, record),\n payload: { ...record },\n });\n\n if (action.kind === 'reject-emit') {\n // Models a /bus/emit 4xx: the request never reaches the bus.\n throw new Error(`FaultyTransport: emit rejected by schedule (reject-emit) on ${name}`);\n }\n\n // The request itself is observable (handlers-eye view), then the\n // simulator plays gateway: synthesize the registry reply per the action.\n this.bus.get(channel).next(payload);\n\n // The gateway's answer is computed ONCE per request that reaches it —\n // the reply QUEUE scripts the gateway, the fault schedule scripts the\n // wire (SDK-TESTING-DOUBLE.md Phase 2). So `duplicate-reply` replays the\n // same body twice, and a `drop-reply` still consumes its queue entry:\n // the gateway answered, the wire ate it.\n const queue = this.replyQueues.get(name);\n const response = queue && queue.length > 0 ? queue.shift() : this.makeResponse(name, record);\n\n const reply = (): void => {\n if (this.disposed) return;\n const replyPayload = response === undefined\n ? { correlationId: record.correlationId }\n : { correlationId: record.correlationId, response };\n const resultChannel = BUS_OPERATIONS[name].result as keyof EventMap;\n this.bus.get(resultChannel).next(replyPayload as EventMap[keyof EventMap]);\n };\n\n switch (action.kind) {\n case 'deliver':\n queueMicrotask(reply);\n break;\n case 'duplicate-reply':\n queueMicrotask(reply);\n queueMicrotask(reply);\n break;\n case 'delay': {\n const t = setTimeout(() => { this.timers.delete(t); reply(); }, action.ms);\n this.timers.add(t);\n break;\n }\n case 'drop-reply':\n break;\n }\n return 1;\n }\n\n on<K extends keyof EventMap>(channel: K, handler: (payload: EventMap[K]) => void): () => void {\n const sub = this.bus.get(channel).subscribe(handler);\n return () => sub.unsubscribe();\n }\n\n stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]> {\n return this.bus.get(channel);\n }\n\n subscribeToResource(_rid: ResourceId): () => void {\n // Mirrors the real HttpTransport: distinct scopes COMPOSE\n // (MULTI-RESOURCE-SCOPE). Delivery here is bus-direct and never\n // scope-gated, so acquisition needs no bookkeeping and release\n // (idempotent by construction) is a no-op.\n return () => {};\n }\n\n /**\n * Correlated-reply tracking (BUS-RESUMPTION.md Phase 2 / SDK-DEBT S1),\n * exposed for assertions: `busRequest` registers each cid here before its\n * emit and releases on settle, so a test can pin the tracked set at any\n * point of a request's lifecycle. Delivery in this double is bus-direct\n * (nothing to replay), so tracking has no behavioral effect.\n */\n readonly pendingReplies = new Set<string>();\n\n trackReply(correlationId: string): () => void {\n this.pendingReplies.add(correlationId);\n let released = false;\n return () => {\n if (released) return;\n released = true;\n this.pendingReplies.delete(correlationId);\n };\n }\n\n bridgeInto(bus: EventBus): void {\n for (const channel of BRIDGED_CHANNELS) {\n this.bus.get(channel as keyof EventMap).subscribe((payload) => {\n bus.get(channel as keyof EventMap).next(payload as EventMap[keyof EventMap]);\n });\n }\n }\n\n // ── Lifecycle ───────────────────────────────────────────────────────────\n\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n for (const t of this.timers) clearTimeout(t);\n this.timers.clear();\n this.state$.next('closed');\n this.state$.complete();\n this.errorsSubject.complete();\n // Completes every subject: in-flight busRequests resolve `bus.closed`.\n this.bus.destroy();\n }\n}\n"]}
|
|
@@ -38,6 +38,7 @@ function resolveEnvVars(obj, env) {
|
|
|
38
38
|
}
|
|
39
39
|
return obj;
|
|
40
40
|
}
|
|
41
|
+
var DEFAULT_ARCHIVIST_PORT = 24103;
|
|
41
42
|
function requirePlatform(value, serviceName) {
|
|
42
43
|
if (!value) {
|
|
43
44
|
throw new Error(`platform is required for service '${serviceName}' \u2014 add 'platform = "posix"|"container"|"external"' to its config section`);
|
|
@@ -141,7 +142,12 @@ function loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env)
|
|
|
141
142
|
workers[wt] = mergeWithFlatInference(specific);
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
|
-
|
|
145
|
+
if (resolved.gateway && resolved.backend) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
`Environment '${resolvedEnvironment}' declares both [gateway] and [backend]. They are one section under two spellings; keep [gateway] and delete [backend].`
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
const gateway = resolved.gateway ?? resolved.backend;
|
|
145
151
|
const site = resolved.site ?? projectSite;
|
|
146
152
|
const inferenceSection = resolved.inference;
|
|
147
153
|
let inferenceProviders;
|
|
@@ -194,7 +200,6 @@ function loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env)
|
|
|
194
200
|
if (makeMeaningSection?.actors?.matcher?.inference) {
|
|
195
201
|
topLevelActors["matcher"] = { inference: { type: makeMeaningSection.actors.matcher.inference.type, model: makeMeaningSection.actors.matcher.inference.model } };
|
|
196
202
|
}
|
|
197
|
-
const frontend = resolved.frontend;
|
|
198
203
|
if (!resolved.vectors?.type) {
|
|
199
204
|
throw new Error(
|
|
200
205
|
`[environments.${resolvedEnvironment}] names no vector store \u2014 add [environments.${resolvedEnvironment}.vectors] with type = "qdrant" or "memory". Semiont requires a vector store; nothing is defaulted.`
|
|
@@ -226,19 +231,18 @@ function loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env)
|
|
|
226
231
|
} : void 0
|
|
227
232
|
}
|
|
228
233
|
};
|
|
229
|
-
if (
|
|
230
|
-
services.
|
|
231
|
-
platform: { type: requirePlatform(
|
|
232
|
-
port:
|
|
233
|
-
publicURL:
|
|
234
|
+
if (gateway) {
|
|
235
|
+
services.gateway = {
|
|
236
|
+
platform: { type: requirePlatform(gateway.platform, "gateway") },
|
|
237
|
+
port: gateway.port ?? 4e3,
|
|
238
|
+
publicURL: gateway.publicURL ?? `http://localhost:${gateway.port ?? 4e3}`
|
|
234
239
|
};
|
|
235
240
|
}
|
|
236
|
-
if (
|
|
237
|
-
services.
|
|
238
|
-
platform: { type:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
publicURL: frontend.publicURL
|
|
241
|
+
if (resolved.archivist?.host) {
|
|
242
|
+
services.archivist = {
|
|
243
|
+
platform: { type: "external" },
|
|
244
|
+
host: resolved.archivist.host,
|
|
245
|
+
port: resolved.archivist.port ?? DEFAULT_ARCHIVIST_PORT
|
|
242
246
|
};
|
|
243
247
|
}
|
|
244
248
|
if (resolved.graph) {
|
|
@@ -264,11 +268,25 @@ function loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env)
|
|
|
264
268
|
}
|
|
265
269
|
const config = {
|
|
266
270
|
services,
|
|
271
|
+
// From the GLOBAL file's root only — an [environments.X.kb] section is
|
|
272
|
+
// inert by construction, which is what "not overridable" means here.
|
|
273
|
+
...raw.kb?.name ? { kb: {
|
|
274
|
+
name: raw.kb.name,
|
|
275
|
+
...raw.kb.domain ? { domain: raw.kb.domain } : {},
|
|
276
|
+
...raw.kb.oauthAllowedDomains ? { oauthAllowedDomains: raw.kb.oauthAllowedDomains } : {}
|
|
277
|
+
} } : {},
|
|
267
278
|
...inferenceProviders ? { inference: inferenceProviders } : {},
|
|
268
279
|
...Object.keys(topLevelWorkers).length > 0 ? { workers: topLevelWorkers } : {},
|
|
269
280
|
...Object.keys(topLevelActors).length > 0 ? { actors: topLevelActors } : {},
|
|
270
281
|
site: site ? {
|
|
271
|
-
|
|
282
|
+
// NO 'localhost' default. A `[site]` section is routinely added for an
|
|
283
|
+
// unrelated key — `oauthAllowedDomains` is the usual one — and
|
|
284
|
+
// manufacturing a domain for it silently renamed the KB's agents to
|
|
285
|
+
// `did:web:localhost`, an identity that collides with every other
|
|
286
|
+
// domain-less KB on the machine. Absent now means absent, so a consumer
|
|
287
|
+
// either falls back to the committed `[kb] domain` or refuses; neither
|
|
288
|
+
// can be done on top of a fabricated value.
|
|
289
|
+
...site.domain ? { domain: site.domain } : {},
|
|
272
290
|
siteName: site.siteName,
|
|
273
291
|
adminEmail: site.adminEmail,
|
|
274
292
|
oauthAllowedDomains: site.oauthAllowedDomains
|
|
@@ -296,6 +314,6 @@ function createTomlConfigLoader(reader, globalConfigPath, env) {
|
|
|
296
314
|
};
|
|
297
315
|
}
|
|
298
316
|
|
|
299
|
-
export { createTomlConfigLoader, loadTomlConfig };
|
|
300
|
-
//# sourceMappingURL=chunk-
|
|
301
|
-
//# sourceMappingURL=chunk-
|
|
317
|
+
export { DEFAULT_ARCHIVIST_PORT, createTomlConfigLoader, loadTomlConfig };
|
|
318
|
+
//# sourceMappingURL=chunk-UGI6IOOX.js.map
|
|
319
|
+
//# sourceMappingURL=chunk-UGI6IOOX.js.map
|
|
@@ -0,0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,CAAO,IAAA,CAAK,OAAO,CAAA,CAAE,SAAS,CAAA,GAAI,EAAE,OAAA,EAAQ,GAAI,EAAC;AAAA;AAAA;AAAA;AAAA,MAIrD,QAAQ,EAAE,eAAA,EAAiB,kBAAA,EAAoB,MAAA,EAAQ,mBAAmB,IAAA,EAAO;AAAA,MACjF,QAAQ,EAAE,aAAA,EAAe,kBAAA,EAAoB,MAAA,EAAQ,iBAAiB,GAAA;AAAI;AAC5E,GACF;AAEA,EAAA,OAAO,MAAA;AACT;AAOO,SAAS,sBAAA,CACd,MAAA,EACA,gBAAA,EACA,GAAA,EACA;AACA,EAAA,OAAO,CAAC,aAA4B,WAAA,KAA4C;AAC9E,IAAA,OAAO,cAAA,CAAe,WAAA,EAAa,WAAA,EAAa,gBAAA,EAAkB,QAAQ,GAAG,CAAA;AAAA,EAC/E,CAAA;AACF","file":"chunk-UGI6IOOX.js","sourcesContent":["/**\n * TOML Config Loader\n *\n * Reads ~/.semiontconfig (TOML) and .semiont/config (TOML) and produces\n * an EnvironmentConfig for the requested environment.\n *\n * File format: see TOML-XDG-CONFIG.md\n *\n * Loading sequence:\n * 1. Read .semiont/config → projectName, site, environments.<env>.* (project base)\n * 2. Read ~/.semiontconfig → defaults, environments.<env>.* (user overrides)\n * 3. Deep-merge: project base ← user overrides (user wins on conflicts)\n * Any environment name is valid (local, staging, production, custom, ...)\n * 4. Resolve ${VAR} references from process.env\n * 5. Apply inheritance: workers.<name> → workers.default → error\n * 6. Map to EnvironmentConfig shape\n */\n\nimport { parse as parseToml } from 'smol-toml';\nimport type { EnvironmentConfig, OllamaProviderConfig, AnthropicProviderConfig } from './config.types';\nimport type { PlatformType } from './config.types';\n\n/**\n * Deep merge two plain objects. Arrays and primitives in `override` replace those in `base`.\n * Nested objects are merged recursively. `override` takes precedence on conflicts.\n */\nfunction deepMerge<T extends Record<string, unknown>>(base: T, override: Partial<T>): T {\n const result = { ...base } as Record<string, unknown>;\n for (const key of Object.keys(override)) {\n const b = base[key];\n const o = override[key];\n if (o !== undefined && o !== null && typeof o === 'object' && !Array.isArray(o) &&\n b !== undefined && b !== null && typeof b === 'object' && !Array.isArray(b)) {\n result[key] = deepMerge(b as Record<string, unknown>, o as Record<string, unknown>);\n } else if (o !== undefined) {\n result[key] = o;\n }\n }\n return result as T;\n}\n\nfunction resolveEnvVars(obj: unknown, env: Record<string, string | undefined>): unknown {\n if (typeof obj === 'string') {\n return obj.replace(/\\$\\{([^}]+)\\}/g, (match, expr: string) => {\n const sepIdx = expr.indexOf(':-');\n const varName = sepIdx >= 0 ? expr.slice(0, sepIdx) : expr;\n const defaultValue = sepIdx >= 0 ? expr.slice(sepIdx + 2) : undefined;\n const value = env[varName];\n if (value !== undefined) return value;\n if (defaultValue !== undefined) return defaultValue;\n throw new Error(`Environment variable ${varName} is not set (referenced in config as ${match})`);\n });\n }\n if (Array.isArray(obj)) {\n return obj.map(item => resolveEnvVars(item, env));\n }\n if (obj !== null && typeof obj === 'object') {\n const resolved: Record<string, unknown> = {};\n for (const key in obj as Record<string, unknown>) {\n resolved[key] = resolveEnvVars((obj as Record<string, unknown>)[key], env);\n }\n return resolved;\n }\n return obj;\n}\n\n// ── Inference config types (mirrored from packages/make-meaning/src/config.ts) ─\n// Kept here to avoid a circular dependency: core cannot import make-meaning.\n\nexport interface InferenceConfig {\n type: 'anthropic' | 'ollama';\n model: string;\n maxTokens?: number;\n apiKey?: string;\n endpoint?: string;\n baseURL?: string;\n}\n\nexport interface ActorInferenceConfig {\n gatherer?: InferenceConfig;\n matcher?: InferenceConfig;\n}\n\nexport interface WorkerInferenceConfig {\n default?: InferenceConfig;\n 'reference-annotation'?: InferenceConfig;\n 'highlight-annotation'?: InferenceConfig;\n 'assessment-annotation'?: InferenceConfig;\n 'comment-annotation'?: InferenceConfig;\n 'tag-annotation'?: InferenceConfig;\n 'generation'?: InferenceConfig;\n}\n\n// ── Types for ~/.semiontconfig ────────────────────────────────────────────────\n\n/** The archivist's default port — the ONE home; node-config-loader imports it. */\nexport const DEFAULT_ARCHIVIST_PORT = 24103;\n\ninterface SemiontConfigFile {\n user?: {\n name?: string;\n email?: string;\n };\n defaults?: {\n environment?: string;\n platform?: string;\n };\n // The KB's committed identity, staged by the launcher (SINGLE-KB-MOUNT D4).\n // Top-level DELIBERATELY: [site] lives inside environment sections, where an\n // override can report an identity the KB never declared; [kb] sits beside\n // [defaults] in the file root, out of any environment section's reach.\n kb?: {\n name?: string;\n domain?: string;\n oauthAllowedDomains?: string[];\n };\n environments?: Record<string, EnvironmentSection>;\n}\n\ninterface GraphSection {\n platform?: string;\n type?: string;\n name?: string;\n uri?: string;\n username?: string;\n password?: string;\n database?: string;\n [key: string]: unknown;\n}\n\ninterface InferenceFlatSection {\n // Flat (single-provider) format: type = \"anthropic\"|\"ollama\" at this level\n type?: 'anthropic' | 'ollama';\n platform?: string;\n model?: string;\n maxTokens?: number;\n apiKey?: string;\n endpoint?: string;\n baseURL?: string;\n // Keyed (multi-provider) format: [inference.anthropic] / [inference.ollama]\n anthropic?: { platform?: string; apiKey?: string; endpoint?: string };\n ollama?: { platform?: string; baseURL?: string; port?: number };\n}\n\ninterface GatewaySection {\n platform?: string;\n port?: number;\n publicURL?: string;\n}\n\ninterface EnvironmentSection {\n gateway?: GatewaySection;\n /**\n * The pre-rename spelling of `gateway`. Accepted so the KB fleet — whose\n * TOMLs live in repos this build cannot reach — keeps loading across the\n * rename. Retires when every fleet repo says `gateway`; that trigger is a\n * release-checklist item, not something CI here can observe.\n */\n backend?: GatewaySection;\n archivist?: {\n host?: string;\n port?: number;\n };\n site?: {\n domain?: string;\n siteName?: string;\n adminEmail?: string;\n oauthAllowedDomains?: string[];\n enableLocalAuth?: boolean;\n };\n database?: {\n platform?: string;\n image?: string;\n host?: string;\n port?: number;\n name?: string;\n user?: string;\n password?: string;\n };\n graph?: GraphSection;\n vectors?: {\n type?: 'qdrant' | 'memory';\n host?: string;\n port?: number;\n // Legacy: embedding nested under vectors (migrated to top-level)\n embedding?: {\n type?: 'voyage' | 'ollama';\n model?: string;\n apiKey?: string;\n baseURL?: string;\n endpoint?: string;\n };\n chunking?: {\n chunkSize?: number;\n overlap?: number;\n };\n };\n embedding?: {\n type?: 'voyage' | 'ollama';\n model?: string;\n apiKey?: string;\n baseURL?: string;\n endpoint?: string;\n chunking?: {\n chunkSize?: number;\n overlap?: number;\n };\n };\n inference?: InferenceFlatSection;\n 'make-meaning'?: {\n graph?: Record<string, unknown>;\n actors?: {\n gatherer?: { inference?: InferenceConfig };\n matcher?: { inference?: InferenceConfig };\n };\n default?: { inference?: InferenceConfig };\n /**\n * Resource-gather knobs. `settleTimeoutMs` bounds the semanticContext\n * read-your-writes barrier (SMELTER-INDEX-SYNC D3/D5) — how long a gather\n * waits for the vector projection to settle before degrading to an absent\n * semanticContext. Must nest INSIDE downstream watchdogs (job-worker\n * liveness, client stall watchdogs) — see SMELTER-INDEX-SYNC A4.\n */\n gather?: { settleTimeoutMs?: number };\n /**\n * Search knobs. `semanticFloor` is the minimum cosine score a vector hit\n * needs to appear in the semantic fallback (SEMANTIC-FALLBACK decision\n * #1) — fired only when a lexical search returns nothing. The loader is\n * the ONE home of the default: 0.6, midway between the Matcher's\n * recall-oriented 0.4 (which feeds a composite scorer) and a\n * precision-strict 0.8 — a guess to be tuned from the fallback's own\n * score-distribution debug line, revisable here in one line.\n */\n search?: { semanticFloor?: number };\n };\n workers?: Record<string, { inference?: InferenceConfig }>;\n actors?: Record<string, { inference?: InferenceConfig }>;\n logLevel?: 'error' | 'warn' | 'info' | 'http' | 'debug';\n}\n\n// ── File reader abstraction (same pattern as createConfigLoader) ──────────────\n\nexport type TomlFileReader = {\n readIfExists: (path: string) => string | null;\n};\n\nfunction requirePlatform(value: string | undefined, serviceName: string): PlatformType {\n if (!value) {\n throw new Error(`platform is required for service '${serviceName}' — add 'platform = \"posix\"|\"container\"|\"external\"' to its config section`);\n }\n return value as PlatformType;\n}\n\n// ── Main loader function ──────────────────────────────────────────────────────\n\n/**\n * Parse ~/.semiontconfig and .semiont/config and return EnvironmentConfig.\n *\n * @param projectRoot - Path to the project root (contains .semiont/config)\n * @param environment - Environment name (e.g. 'local', 'production'); when\n * undefined, resolved from `[defaults] environment`\n * @param globalConfigPath - Path to ~/.semiontconfig (caller resolves ~ expansion)\n * @param reader - File reader abstraction\n * @param env - Environment variables for ${VAR} resolution\n */\nexport function loadTomlConfig(\n projectRoot: string | null,\n environment: string | undefined,\n globalConfigPath: string,\n reader: TomlFileReader,\n env: Record<string, string | undefined>\n): EnvironmentConfig {\n // 1. Read + parse project config from .semiont/config (skipped when no project root)\n const projectConfigContent = projectRoot ? reader.readIfExists(`${projectRoot}/.semiont/config`) : null;\n const projectConfig = projectConfigContent\n ? (parseToml(projectConfigContent) as {\n project?: { name?: string; version?: string };\n site?: EnvironmentSection['site'];\n environments?: Record<string, EnvironmentSection>;\n })\n : undefined;\n const projectName = projectConfig?.project?.name ?? 'semiont-project';\n const projectVersion = projectConfig?.project?.version;\n const projectSite = projectConfig?.site;\n\n // 2. Read global config (optional — missing config yields empty environments)\n const globalContent = reader.readIfExists(globalConfigPath);\n const raw = globalContent ? (parseToml(globalContent) as SemiontConfigFile) : ({} as SemiontConfigFile);\n\n // 3. Resolve WHICH environment to load. `[defaults] environment` is the key the\n // launcher selects from (config.go: cfg.Defaults.Environment); the gateway\n // resolves from the SAME key so one config selects the environment for both\n // halves. TWO inputs only — an explicit argument (tests pass one) and the\n // committed config — and they cannot contradict each other, because the\n // explicit one is legible at the call site. There is deliberately NO ambient\n // environment variable in this chain: `SEMIONT_ENV` was removed because an\n // invisible input that can disagree with the staged config is precisely the\n // bug shape #1108 fixed. And no silent 'local'/'development' fallback — an\n // unselected environment is a config error, not a default.\n const resolvedEnvironment = environment ?? raw.defaults?.environment;\n if (!resolvedEnvironment) {\n throw new Error(\n 'No environment selected: pass one explicitly, or declare ' +\n '`[defaults] environment` in ~/.semiontconfig.',\n );\n }\n\n // 4. A named environment with no [environments.X] section ANYWHERE is a config\n // error, not a silent empty {}. The silent {} is what let a KB declaring\n // `environment = \"staging\"` (with no [environments.staging]) load nothing and\n // let every downstream default fire, back when a domain-less [site]\n // still resolved to 'localhost',\n // the fabricated colliding did:web:localhost identity. Fail loud instead.\n const projectHasSection =\n projectConfig?.environments != null && resolvedEnvironment in projectConfig.environments;\n const globalHasSection = raw.environments != null && resolvedEnvironment in raw.environments;\n if (!projectHasSection && !globalHasSection) {\n throw new Error(\n `Environment \"${resolvedEnvironment}\" is selected but no [environments.${resolvedEnvironment}] ` +\n 'section exists in the project (.semiont/config) or global (~/.semiontconfig) config. ' +\n 'Declare the section, or select an environment that exists.',\n );\n }\n\n // 5. Deep-merge: project base + user overrides (user wins on conflicts)\n const projectEnvSection: EnvironmentSection = projectConfig?.environments?.[resolvedEnvironment] ?? {};\n const userEnvSection: EnvironmentSection = raw.environments?.[resolvedEnvironment] ?? {};\n const envSection: EnvironmentSection = deepMerge(\n projectEnvSection as Record<string, unknown>,\n userEnvSection as Record<string, unknown>\n ) as EnvironmentSection;\n\n // 4. Resolve ${VAR} references\n const resolved = resolveEnvVars(envSection, env) as EnvironmentSection;\n\n // 5. Build make-meaning actor/worker inference config with inheritance\n // The flat [inference] section provides defaults (apiKey, maxTokens, endpoint/baseURL).\n // Actor/worker sections only need to specify type and model; missing fields fall back\n // to the flat inference section.\n const flatInference = resolved.inference;\n const makeMeaningSection = resolved['make-meaning'];\n const workersSection = resolved.workers ?? {};\n const actorsSection = resolved.actors ?? {};\n const defaultWorkerInference = workersSection['default']?.inference;\n const defaultMakeMeaningInference = makeMeaningSection?.default?.inference;\n\n function mergeWithFlatInference(specific: InferenceConfig): InferenceConfig {\n if (!flatInference) return specific;\n // For keyed sub-sections, inherit credentials from the matching provider sub-section.\n // For flat (legacy) format, flatInference.type is required to know which fields apply.\n const providerDefaults: Partial<InferenceConfig> = {};\n if (specific.type === 'anthropic') {\n const a = flatInference.anthropic;\n if (a) {\n providerDefaults.apiKey = a.apiKey;\n providerDefaults.endpoint = a.endpoint;\n } else {\n if (!flatInference.type) {\n throw new Error(\n `[environments.${resolvedEnvironment}.inference] is missing 'type'. ` +\n `Add type = \"anthropic\" or use [inference.anthropic] sub-section.`\n );\n }\n providerDefaults.apiKey = flatInference.apiKey;\n providerDefaults.endpoint = flatInference.endpoint;\n }\n } else if (specific.type === 'ollama') {\n const o = flatInference.ollama;\n if (o) {\n providerDefaults.baseURL = o.baseURL;\n } else {\n if (!flatInference.type) {\n throw new Error(\n `[environments.${resolvedEnvironment}.inference] is missing 'type'. ` +\n `Add type = \"ollama\" or use [inference.ollama] sub-section.`\n );\n }\n providerDefaults.baseURL = flatInference.baseURL;\n }\n }\n return {\n maxTokens: flatInference.maxTokens,\n ...providerDefaults,\n ...specific,\n };\n }\n\n function resolveActorInference(fromMakeMeaning?: InferenceConfig, fromActors?: InferenceConfig): InferenceConfig | undefined {\n const base = fromMakeMeaning ?? fromActors ?? defaultMakeMeaningInference;\n if (!base) return undefined;\n return mergeWithFlatInference(base);\n }\n\n const actors: ActorInferenceConfig = {};\n const gathererInference = resolveActorInference(\n makeMeaningSection?.actors?.gatherer?.inference,\n actorsSection['gatherer']?.inference\n );\n if (gathererInference) actors.gatherer = gathererInference;\n\n const matcherInference = resolveActorInference(\n makeMeaningSection?.actors?.matcher?.inference,\n actorsSection['matcher']?.inference\n );\n if (matcherInference) actors.matcher = matcherInference;\n\n const workers: WorkerInferenceConfig = {};\n const workerTypes = ['reference-annotation', 'highlight-annotation', 'assessment-annotation', 'comment-annotation', 'tag-annotation', 'generation'] as const;\n if (defaultWorkerInference) {\n workers.default = mergeWithFlatInference(defaultWorkerInference);\n }\n for (const wt of workerTypes) {\n const specific = workersSection[wt]?.inference;\n if (specific) {\n (workers as Record<string, InferenceConfig>)[wt] = mergeWithFlatInference(specific);\n }\n }\n\n // 6. Map to EnvironmentConfig\n // `gateway` is the current spelling; `backend` is the pre-rename one, still\n // accepted for the fleet. A file carrying BOTH is half-migrated — a mistake\n // someone just made, not a state worth supporting — so it fails loudly here\n // instead of picking a winner the next reader cannot identify.\n if (resolved.gateway && resolved.backend) {\n throw new Error(\n `Environment '${resolvedEnvironment}' declares both [gateway] and [backend]. ` +\n `They are one section under two spellings; keep [gateway] and delete [backend].`\n );\n }\n const gateway = resolved.gateway ?? resolved.backend;\n const site = resolved.site ?? projectSite;\n const inferenceSection = resolved.inference;\n\n // Build inference providers config.\n // Supports two formats:\n // Flat: [environments.local.inference] type = \"anthropic\"|\"ollama\" (single provider)\n // Keyed: [environments.local.inference.anthropic] / [environments.local.inference.ollama] (multi-provider)\n let inferenceProviders: EnvironmentConfig['inference'] | undefined;\n if (inferenceSection) {\n inferenceProviders = {};\n // Keyed sub-sections take priority\n if (inferenceSection.anthropic) {\n const a = inferenceSection.anthropic;\n inferenceProviders.anthropic = {\n platform: requirePlatform(a.platform, 'inference.anthropic'),\n endpoint: a.endpoint ?? 'https://api.anthropic.com',\n apiKey: a.apiKey ?? '',\n } as AnthropicProviderConfig;\n } else if (inferenceSection.type === 'anthropic') {\n inferenceProviders.anthropic = {\n platform: requirePlatform(inferenceSection.platform, 'inference'),\n endpoint: inferenceSection.endpoint ?? 'https://api.anthropic.com',\n apiKey: inferenceSection.apiKey ?? '',\n } as AnthropicProviderConfig;\n }\n if (inferenceSection.ollama) {\n const o = inferenceSection.ollama;\n inferenceProviders.ollama = {\n platform: { type: requirePlatform(o.platform, 'inference.ollama') },\n baseURL: o.baseURL,\n port: o.baseURL ? undefined : (o.port ?? 11434),\n } as OllamaProviderConfig;\n } else if (inferenceSection.type === 'ollama') {\n inferenceProviders.ollama = {\n platform: { type: requirePlatform(inferenceSection.platform, 'inference') },\n baseURL: inferenceSection.baseURL,\n port: inferenceSection.baseURL ? undefined : 11434,\n } as OllamaProviderConfig;\n }\n }\n\n // Build top-level workers/actors maps for EnvironmentConfig\n const topLevelWorkers: EnvironmentConfig['workers'] = {};\n for (const [name, w] of Object.entries(workersSection)) {\n if (w.inference) {\n topLevelWorkers[name] = { inference: { type: w.inference.type, model: w.inference.model } };\n }\n }\n const topLevelActors: EnvironmentConfig['actors'] = {};\n for (const [name, a] of Object.entries(actorsSection)) {\n if (a.inference) {\n topLevelActors[name] = { inference: { type: a.inference.type, model: a.inference.model } };\n }\n }\n // Also include make-meaning actors\n if (makeMeaningSection?.actors?.gatherer?.inference) {\n topLevelActors['gatherer'] = { inference: { type: makeMeaningSection.actors.gatherer.inference.type, model: makeMeaningSection.actors.gatherer.inference.model } };\n }\n if (makeMeaningSection?.actors?.matcher?.inference) {\n topLevelActors['matcher'] = { inference: { type: makeMeaningSection.actors.matcher.inference.type, model: makeMeaningSection.actors.matcher.inference.model } };\n }\n\n // Semantic search is always available, so a config must NAME both a vector\n // store and an embedding provider — nothing is defaulted, and absence\n // refuses the load with a config-actionable message (MANDATORY-EMBEDDING\n // D0+D1: explicit opt-in; `memory` is a first-class choice, not a fallback).\n if (!resolved.vectors?.type) {\n throw new Error(\n `[environments.${resolvedEnvironment}] names no vector store — add [environments.${resolvedEnvironment}.vectors] with type = \"qdrant\" or \"memory\". Semiont requires a vector store; nothing is defaulted.`,\n );\n }\n const embeddingSource = resolved.embedding ?? resolved.vectors?.embedding;\n if (!embeddingSource?.type || !embeddingSource.model) {\n throw new Error(\n `[environments.${resolvedEnvironment}] names no embedding provider — add [environments.${resolvedEnvironment}.embedding] with type = \"voyage\" or \"ollama\" and a model. Semiont requires an embedding provider; nothing is defaulted.`,\n );\n }\n\n const services: EnvironmentConfig['services'] = {\n vectors: {\n platform: { type: 'external' as PlatformType },\n type: resolved.vectors.type,\n host: resolved.vectors.host,\n port: resolved.vectors.port ?? 6333,\n } as EnvironmentConfig['services']['vectors'],\n embedding: {\n platform: { type: 'external' as PlatformType },\n type: embeddingSource.type,\n model: embeddingSource.model,\n apiKey: embeddingSource.apiKey,\n baseURL: embeddingSource.baseURL,\n endpoint: embeddingSource.endpoint,\n chunking: (resolved.embedding?.chunking ?? resolved.vectors?.chunking) ? {\n chunkSize: (resolved.embedding?.chunking ?? resolved.vectors?.chunking)?.chunkSize ?? 512,\n overlap: (resolved.embedding?.chunking ?? resolved.vectors?.chunking)?.overlap ?? 64,\n } : undefined,\n } as EnvironmentConfig['services']['embedding'],\n };\n\n if (gateway) {\n services.gateway = {\n platform: { type: requirePlatform(gateway.platform, 'gateway') },\n port: gateway.port ?? 4000,\n publicURL: gateway.publicURL ?? `http://localhost:${gateway.port ?? 4000}`,\n };\n }\n\n // The Archivist's D1 read path: the gateway replays SSE resumes from it\n // (EXTRACT-ARCHIVIST P3). Internal host:port like vectors — never a\n // publicURL; the Archivist is not public. Without this mapping the\n // section parses and then VANISHES: fetchArchivistReplay reads\n // services.archivist, finds nothing, and every resume silently degrades\n // to a gap — the exact failure D1's gate exists to catch. (The cutover\n // added the schema and the consumer; this mapping is the missing middle.)\n if (resolved.archivist?.host) {\n services.archivist = {\n platform: { type: 'external' as PlatformType },\n host: resolved.archivist.host,\n port: resolved.archivist.port ?? DEFAULT_ARCHIVIST_PORT,\n } as EnvironmentConfig['services']['archivist'];\n }\n\n // No browser service is emitted. The Browser is machine-level — one Browser\n // serves many KBs — so a KB neither knows nor affects its port or publicURL\n // (FRONTEND-IS-THE-BROWSER D5). `[browser]` and the older `[frontend]` are\n // inert unknown sections: tolerated, never read, never refused.\n\n if (resolved.graph) {\n services.graph = {\n ...resolved.graph,\n platform: { type: requirePlatform(resolved.graph.platform as string | undefined, 'graph') },\n type: (resolved.graph.type ?? 'neo4j') as import('./config.types').GraphDatabaseType,\n } as EnvironmentConfig['services']['graph'];\n } else if (makeMeaningSection?.graph) {\n services.graph = makeMeaningSection.graph as EnvironmentConfig['services']['graph'];\n }\n\n if (resolved.database) {\n services.database = {\n platform: { type: requirePlatform(resolved.database.platform, 'database') },\n type: 'postgres',\n image: resolved.database.image,\n host: resolved.database.host ?? 'localhost',\n port: resolved.database.port ?? 5432,\n name: resolved.database.name,\n user: resolved.database.user,\n password: resolved.database.password,\n } as EnvironmentConfig['services']['database'];\n }\n\n const config: EnvironmentConfig = {\n services,\n // From the GLOBAL file's root only — an [environments.X.kb] section is\n // inert by construction, which is what \"not overridable\" means here.\n ...(raw.kb?.name\n ? { kb: {\n name: raw.kb.name,\n ...(raw.kb.domain ? { domain: raw.kb.domain } : {}),\n ...(raw.kb.oauthAllowedDomains ? { oauthAllowedDomains: raw.kb.oauthAllowedDomains } : {}),\n } }\n : {}),\n ...(inferenceProviders ? { inference: inferenceProviders } : {}),\n ...(Object.keys(topLevelWorkers).length > 0 ? { workers: topLevelWorkers } : {}),\n ...(Object.keys(topLevelActors).length > 0 ? { actors: topLevelActors } : {}),\n site: site ? {\n // NO 'localhost' default. A `[site]` section is routinely added for an\n // unrelated key — `oauthAllowedDomains` is the usual one — and\n // manufacturing a domain for it silently renamed the KB's agents to\n // `did:web:localhost`, an identity that collides with every other\n // domain-less KB on the machine. Absent now means absent, so a consumer\n // either falls back to the committed `[kb] domain` or refuses; neither\n // can be done on top of a fabricated value.\n ...(site.domain ? { domain: site.domain } : {}),\n siteName: site.siteName,\n adminEmail: site.adminEmail,\n oauthAllowedDomains: site.oauthAllowedDomains as [string, ...string[]] | undefined,\n } : undefined,\n logLevel: resolved.logLevel,\n _metadata: {\n environment: resolvedEnvironment,\n projectRoot,\n projectName,\n projectVersion,\n ...(Object.keys(actors).length > 0 ? { actors } : {}),\n ...(Object.keys(workers).length > 0 ? { workers } : {}),\n // Always set — the loader is the ONE home of this default (D5).\n // Consuming code (make-meaning's gather path) receives a required\n // value and defaults nothing.\n gather: { settleTimeoutMs: makeMeaningSection?.gather?.settleTimeoutMs ?? 15_000 },\n search: { semanticFloor: makeMeaningSection?.search?.semanticFloor ?? 0.6 },\n },\n };\n\n return config;\n}\n\n/**\n * Create a TOML config loader backed by a file reader.\n * Drop-in replacement for createConfigLoader that reads TOML instead of JSON.\n * The caller must resolve globalConfigPath (e.g. expand '~' using process.env.HOME).\n */\nexport function createTomlConfigLoader(\n reader: TomlFileReader,\n globalConfigPath: string,\n env: Record<string, string | undefined>\n) {\n return (projectRoot: string | null, environment?: string): EnvironmentConfig => {\n return loadTomlConfig(projectRoot, environment, globalConfigPath, reader, env);\n };\n}\n"]}
|