Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

chore: merge origin dev into live entity change branch

Josué894fc3e8730b
diff --cc control-api/src/config.ts
index 4cda70275,ff868cf70..876723f74
--- a/control-api/src/config.ts
+++ b/control-api/src/config.ts
@@@ -1,11 -1,7 +1,12 @@@
import { createPublicKey } from 'node:crypto'
import { DEFAULT_ALLOWED_PLUGIN_IMAGE_PREFIXES } from '@clerum/image-policy'
+ import { REACTIVE_REFRESH_BUFFER_MS } from './oauth/tokenHelper.js'
+function boundedIntegerEnv(name: string, fallback: number, min: number, max: number): number {
+ const parsed = Number(process.env[name])
+ return Number.isSafeInteger(parsed) && parsed >= min && parsed <= max ? parsed : fallback
+}
+
type Config = {
port: number
jsonBodyLimit: string
diff --cc control-api/src/db.ts
index 300e22880,52e3870ae..39fcadb8c
--- a/control-api/src/db.ts
+++ b/control-api/src/db.ts
@@@ -6264,18 -6260,39 +6264,51 @@@ export const CONTROL_API_MIGRATIONS: Db
version: '0118_control_admin_replace_inviter_accept_guard',
apply: applyControlAdminReplaceInviterAcceptGuard,
},
+ {
+ // Renumbered twice while syncing onto dev: 0116 -> 0117 -> 0119. The first
+ // sync brought dev's 0116_mcp_secret_rollback_permits; this one brought
+ // dev's 0117/0118 control-admin replace-inviter pair, which already shipped
+ // in a release, so the oauth-19 dynamic-clients migrations move past them
+ // rather than claiming a version another migration already uses.
+ // Environments where this feature branch was already deployed (the oauth-19
+ // dev cluster) recorded it under one of the earlier names; legacyVersions
+ // lets the runner mark 0119 applied from that prior row instead of
+ // re-running the DDL and leaving an orphan schema_migrations entry. Both
+ // prior names are unique to this migration, so there is no false-skip.
+ version: '0119_dynamic_clients_table',
+ legacyVersions: ['0116_dynamic_clients_table', '0117_dynamic_clients_table'],
+ apply: applyDynamicClientsTable,
+ },
+ {
+ version: '0119_durable_entity_change_feed',
+ // This feature was deployed both before the two replace-inviter migrations
+ // and at its original 0117 slot. Preserve both identities so the sync does
+ // not rerun entity-change DDL in either previously deployed environment.
+ legacyVersions: ['0116_durable_entity_change_feed', '0117_durable_entity_change_feed'],
+ apply: applyEntityChangeSchema,
+ },
+ {
+ // Renumbered twice while syncing onto dev (0117 -> 0118 -> 0120), moving in
+ // lockstep with the table migration above. Same legacyVersions rationale:
+ // the prior names are unique to this migration.
+ version: '0120_dynamic_clients_runtime_access',
+ legacyVersions: ['0117_dynamic_clients_runtime_access', '0118_dynamic_clients_runtime_access'],
+ apply: applyDynamicClientsRuntimeAccess,
+ },
+ {
+ version: '0120_entity_change_checkpoint_cursor_convergence',
+ apply: applyEntityChangeCheckpointSchema,
+ },
+ {
+ // Install-identity columns for the DCR/OAuth state (install_id + cr_uid on
+ // dynamic_clients, cr_uid on oauth_grants). Renumbered 0119 -> 0121 while
+ // syncing onto dev (dev's 0117/0118 pushed the oauth-19 migrations down by
+ // two); the pre-renumber name is unique to this migration, so legacyVersions
+ // marks it applied on environments that already ran it.
+ version: '0121_oauth_install_identity',
+ legacyVersions: ['0119_oauth_install_identity'],
+ apply: applyOAuthInstallIdentity,
+ },
]
async function consolidateWorkflowAllowedUsersToTriggers(db: DbClient): Promise<void> {
diff --cc control-api/src/main.ts
index 1fe8ba9ba,df89438fe..725529ecc
--- a/control-api/src/main.ts
+++ b/control-api/src/main.ts
@@@ -305,12 -200,26 +310,28 @@@ async function main(): Promise<void>
)
}
+ if (config.oauthProactiveRefreshCronEnabled) {
+ startOauthProactiveRefreshCron(gateway, {
+ intervalMs: config.oauthProactiveRefreshIntervalMs,
+ proactiveBufferMs: config.oauthProactiveRefreshBufferMs,
+ reactiveBufferMs: REACTIVE_REFRESH_BUFFER_MS,
+ dcrWarnMs: config.oauthDcrSecretWarnMs,
+ })
+ console.log(
+ `[ControlAPI] OAuth proactive refresh cron enabled (interval=${config.oauthProactiveRefreshIntervalMs}ms, Bp=${config.oauthProactiveRefreshBufferMs}ms, Wc=${config.oauthDcrSecretWarnMs}ms)`
+ )
+ } else {
+ console.log(
+ '[ControlAPI] OAuth proactive refresh cron disabled (OAUTH_PROACTIVE_REFRESH_CRON_ENABLED not "true")'
+ )
+ }
+
const server = new ControlApiServer(gateway, config.port)
+ activeServer = server
await server.start()
- console.log('[ControlAPI] Running')
+ ensureStartupActive()
+ logger.info({ event: 'control_api_running' }, 'Control API running')
// Hosted member-registration self-enrollment (spec §8.4): degrade, never
// block. Fire-and-forget, and only AFTER the listener is up — the liveness
diff --cc control-api/src/routes/admin/index.ts
index 445e10caa,7e2748667..400960fc7
--- a/control-api/src/routes/admin/index.ts
+++ b/control-api/src/routes/admin/index.ts
@@@ -10,6 -10,8 +10,8 @@@ import { createAdminHostEnvRouter } fro
import { createAdminHostsOverviewRouter } from './hostsOverview.js'
import { createAdminLlmModelsRouter } from './llmModels.js'
import { createAdminLlmPricesRouter } from './llmPrices.js'
-import { createAdminOauthProvidersRouter } from './oauthProviders.js'
+ import { createAdminMcpServerOauthRouter } from './mcpServerOauth.js'
++import { createAdminOauthProvidersRouter } from './oauthProviders.js'
import { createAdminOutputsRouter } from './outputs.js'
import { createAdminPersonalizationRouter } from './personalization.js'
import { createAdminPluginWorkloadSdkRouter } from './pluginWorkloadSdk.js'
diff --cc control-api/test/db.oauthGrantsOwnerGeneralization.test.ts
index 61adb0e11,e40e3e861..7cb24dce4
--- a/control-api/test/db.oauthGrantsOwnerGeneralization.test.ts
+++ b/control-api/test/db.oauthGrantsOwnerGeneralization.test.ts
@@@ -35,10 -35,17 +35,21 @@@ describe('0101 oauth_grants owner gener
expect(versions.indexOf('0108_llm_provider_attempts_sdk_link_on_delete_set_null')).toBeLessThan(
versions.indexOf('0116_mcp_secret_rollback_permits')
)
+ // oauth-19 dynamic-clients pair, renumbered past dev's 0116-0118 over two
+ // syncs (table 0116->0117->0119, runtime-access 0117->0118->0120). Same liveness+ordering
+ // guard so a future re-number or drop fails here first.
+ expect(versions).toContain('0119_dynamic_clients_table')
+ expect(versions).toContain('0120_dynamic_clients_runtime_access')
+ expect(versions.indexOf('0116_mcp_secret_rollback_permits')).toBeLessThan(
+ versions.indexOf('0119_dynamic_clients_table')
+ )
+ expect(versions.indexOf('0119_dynamic_clients_table')).toBeLessThan(
+ versions.indexOf('0120_dynamic_clients_runtime_access')
+ )
+ expect(versions).toContain('0119_durable_entity_change_feed')
+ expect(versions.indexOf('0116_mcp_secret_rollback_permits')).toBeLessThan(
+ versions.indexOf('0119_durable_entity_change_feed')
+ )
expect(versions.indexOf('0100_seed_minimax_allowed_model')).toBeLessThan(
versions.indexOf('0106_oauth_grants_owner_generalization')
)
diff --cc control-ui/package-lock.json
index 375672083,55d17d3ac..9f394d2af
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "clerum-control-ui",
- "version": "0.1.665",
- "version": "0.1.662",
++ "version": "0.1.666",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.665",
- "version": "0.1.662",
++ "version": "0.1.666",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --cc control-ui/package.json
index d14ca7a0f,e75746e40..d782553c7
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-control-ui",
- "version": "0.1.665",
- "version": "0.1.662",
++ "version": "0.1.666",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --cc deploy/scripts/control-api-runtime-sequence-access-profiles.tsv
index a26bbb8c8,1bb0a48fc..dbc8d2518
--- a/deploy/scripts/control-api-runtime-sequence-access-profiles.tsv
+++ b/deploy/scripts/control-api-runtime-sequence-access-profiles.tsv
@@@ -1,7 -1,7 +1,8 @@@
# public sequence<TAB>control_api_runtime access profile
administrative_events_ingest_sequence_seq consume
agent_run_events_ingest_sequence_seq consume
+ dynamic_clients_id_seq legacy_rw
+entity_change_outbox_id_seq none
gfs_audit_sequence_no_seq legacy_rw
governed_event_stream_stream_sequence_seq consume
infrastructure_telemetry_events_ingest_sequence_seq consume
diff --cc external-rest-api/package-lock.json
index 9b5ee500c,81c281065..c7b44265d
--- a/external-rest-api/package-lock.json
+++ b/external-rest-api/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "clerum-external-rest-api",
- "version": "0.1.88",
- "version": "0.1.85",
++ "version": "0.1.89",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-external-rest-api",
- "version": "0.1.88",
- "version": "0.1.85",
++ "version": "0.1.89",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.21.2",
diff --cc external-rest-api/package.json
index 6215a84d3,ce716823a..df9e20b56
--- a/external-rest-api/package.json
+++ b/external-rest-api/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-external-rest-api",
- "version": "0.1.88",
- "version": "0.1.85",
++ "version": "0.1.89",
"description": "External REST API for profile, team management, and RPC token brokerage",
"main": "dist/main.js",
"engines": {
diff --cc external-rest-api/src/releaseManifest.ts
index 4995d2fad,e3f278777..3e150e3d8
--- a/external-rest-api/src/releaseManifest.ts
+++ b/external-rest-api/src/releaseManifest.ts
@@@ -8,7 -8,7 +8,7 @@@ export type ReleaseManifest =
export const releaseManifest: ReleaseManifest = {
releaseId: 'v0.10.0',
- externalRestApiVersion: '0.1.88',
- externalRestApiVersion: '0.1.85',
++ externalRestApiVersion: '0.1.89',
rpcProxyVersion: '0.1.89',
desktopVersion: '0.10.0',
minimumDesktopVersion: '0.1.252',
diff --cc host-context-controller/package-lock.json
index cf00311fa,cf00311fa..961897acb
--- a/host-context-controller/package-lock.json
+++ b/host-context-controller/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "clerum-host-context-controller",
-- "version": "0.1.351",
++ "version": "0.1.352",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
-- "version": "0.1.351",
++ "version": "0.1.352",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@clerum/codex-catalog-projection": "file:../packages/codex-catalog-projection",
diff --cc host-context-controller/package.json
index 73798aa7e,73798aa7e..e0a845ff6
--- a/host-context-controller/package.json
+++ b/host-context-controller/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-host-context-controller",
-- "version": "0.1.351",
++ "version": "0.1.352",
"description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API",
"main": "dist/main.js",
"engines": {
diff --cc mcp-host/src/contextMapperClient.test.ts
index e0e27a23f,df65caf98..a92445243
--- a/mcp-host/src/contextMapperClient.test.ts
+++ b/mcp-host/src/contextMapperClient.test.ts
@@@ -308,6 -308,126 +308,124 @@@ describe('ContextMapperClient Host-scop
)
})
+ it('projects a remote=true policy flag from the v2 inventory (mini-spec 19 §D-6)', async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi
+ .fn()
+ .mockResolvedValue(
+ new Response(
+ JSON.stringify(inventory([authorizedServer({ authKind: 'oauth-user', remote: true })])),
+ { status: 200 }
+ )
+ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ const result = await client.pollServers()
+ expect(result.servers[0].remote).toBe(true)
+ })
+
+ it('fail-safes an absent remote flag to local (undefined, not false)', async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn().mockResolvedValue(
+ new Response(JSON.stringify(inventory([authorizedServer({ authKind: 'oauth-user' })])), {
+ status: 200,
+ })
+ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ const result = await client.pollServers()
+ // HCC omits `remote` when false, so an absent flag must decode to undefined
+ // (treated as local everywhere downstream), never a spurious `false` object key.
+ expect(result.servers[0].remote).toBeUndefined()
+ })
+
+ it('rejects a present-but-non-boolean remote flag (decoder strictness)', async () => {
+ vi.stubGlobal(
+ 'fetch',
- vi
- .fn()
- .mockResolvedValue(
- new Response(JSON.stringify(inventory([authorizedServer({ remote: 'yes' })])), {
- status: 200,
- })
- )
++ vi.fn().mockResolvedValue(
++ new Response(JSON.stringify(inventory([authorizedServer({ remote: 'yes' })])), {
++ status: 200,
++ })
++ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ await expect(client.pollServers()).rejects.toThrow(
+ 'HCC inventory response contains an invalid remote flag'
+ )
+ })
+
+ it('projects a bearerInBody=true transport quirk from the v2 inventory (mini-spec 19 §D-8)', async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi
+ .fn()
+ .mockResolvedValue(
+ new Response(
+ JSON.stringify(
+ inventory([
+ authorizedServer({ authKind: 'oauth-user', remote: true, bearerInBody: true }),
+ ])
+ ),
+ { status: 200 }
+ )
+ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ const result = await client.pollServers()
+ expect(result.servers[0].bearerInBody).toBe(true)
+ })
+
+ it('fail-safes an absent bearerInBody flag to header (undefined, not false)', async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn().mockResolvedValue(
+ new Response(JSON.stringify(inventory([authorizedServer({ authKind: 'oauth-user' })])), {
+ status: 200,
+ })
+ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ const result = await client.pollServers()
+ // HCC omits `bearerInBody` when false, so an absent flag must decode to
+ // undefined (treated as header everywhere downstream), never a spurious key.
+ expect(result.servers[0].bearerInBody).toBeUndefined()
+ })
+
+ it('rejects a present-but-non-boolean bearerInBody flag (decoder strictness)', async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn().mockResolvedValue(
+ new Response(JSON.stringify(inventory([authorizedServer({ bearerInBody: 1 })])), {
+ status: 200,
+ })
+ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ await expect(client.pollServers()).rejects.toThrow(
+ 'HCC inventory response contains an invalid bearerInBody flag'
+ )
+ })
+
it('still rejects forbidden metadata even when a valid authKind is present (guard intact, I1)', async () => {
vi.stubGlobal(
'fetch',
diff --cc profile-ui/package-lock.json
index 33e4c55cd,33e4c55cd..07a1caded
--- a/profile-ui/package-lock.json
+++ b/profile-ui/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "clerum-profile-ui",
-- "version": "0.1.143",
++ "version": "0.1.144",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-profile-ui",
-- "version": "0.1.143",
++ "version": "0.1.144",
"dependencies": {
"@clerum/desktop-app-links": "file:../packages/desktop-app-links",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --cc profile-ui/package.json
index ded59f1aa,ded59f1aa..02f14aceb
--- a/profile-ui/package.json
+++ b/profile-ui/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-profile-ui",
-- "version": "0.1.143",
++ "version": "0.1.144",
"private": true,
"scripts": {
"dev": "next dev",