You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add branded core and Alliance ServerConfig types (#179)
* Add branded CoreServerConfig / AllianceServerConfig to prevent cross-setup misuse
* - Added hasConfig() and getConfigIfSet() on ServerContext
- In the context branch, when no opts.config and !ctx.hasConfig(), call resolveAllianceConfig({}) before tool registration
- Added test: unconfigured context + PINECONE_API_KEY env → Alliance gate defaults applied
- ServerContext<T> generic + CoreServerContext = ServerContext<CoreServerConfig>
- SetupCoreServerOptions.context is now CoreServerContext only
- createServer / createIsolatedContext overloaded by config brand
- Alliance uses internal setupCoreServerOnContext(ctx) (not exported from the public barrel) instead of setupCoreServer({ context })
* - Added AllianceServerContext = ServerContext<AllianceServerConfig> and exported it from core/alliance barrels
- Narrowed SetupAllianceServerOptions.context to AllianceServerContext
- Extended config-branding.compile-test.ts with context-path @ts-expect-error cases (both directions)
* addressed ai reviews
* addressed review
Updated to #unreleased-branded-serverconfig-types (matches GitHub’s anchor for that heading, same pattern as other unreleased sections).
setup.ts — when opts.context is passed without opts.config, validate getConfigIfSet() via assertCoreServerConfig.
alliance/setup.ts — symmetric check with assertAllianceServerConfig when the context already has config.
---------
Co-authored-by: zho <jornathanm910923@gmail.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,10 @@ Tagged releases are published to npm from GitHub Actions when a **GitHub Release
8
8
9
9
## [Unreleased]
10
10
11
+
### Changed
12
+
13
+
-**Library:**`resolveConfig()` returns `CoreServerConfig`; `resolveAllianceConfig()` returns `AllianceServerConfig`. `setupCoreServer` / `setupAllianceServer` accept only their respective branded config and context types (`CoreServerContext` / `AllianceServerContext`). `ServerConfig` remains an alias for `ServerConfigBase` on read paths (`ctx.getConfig()`). See [MIGRATION.md](docs/MIGRATION.md#unreleased-branded-serverconfig-types).
Copy file name to clipboardExpand all lines: docs/MIGRATION.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -352,6 +352,37 @@ Core `resolveConfig` throws `Missing Pinecone index name: …` when the index is
352
352
353
353
---
354
354
355
+
## Unreleased: Branded ServerConfig types
356
+
357
+
**Rationale:**`resolveConfig()` and `resolveAllianceConfig()` produced structurally identical configs. Passing Alliance-resolved config or context into `setupCoreServer()` compiled but silently changed suggest-flow gate behavior (and related defaults).
358
+
359
+
**Who is affected:** Library embedders typing resolver returns or setup arguments as `ServerConfig` instead of the branded types.
360
+
361
+
**Migration:**
362
+
363
+
Use branded resolver outputs with matching setup entry points and context factories:
0 commit comments