@jeffusion/bungee-core 5.17.0 → 5.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config-storage/gateway-target-validation.d.ts +5 -0
- package/dist/gateway/contracts.d.ts +29 -2
- package/dist/gateway/dispatch-plugin.d.ts +7 -0
- package/dist/gateway/dispatch-targets.d.ts +4 -0
- package/dist/gateway/plugin.js +2 -0
- package/dist/gateway/routing-plugin.d.ts +3 -1
- package/dist/hooks/plugin-hooks.d.ts +3 -1
- package/dist/main.js +271 -82
- package/dist/plugin-extensions.d.ts +2 -0
- package/dist/plugin.types.d.ts +1 -1
- package/dist/plugins/ai-transformer/index.js.map +3 -3
- package/dist/plugins/anthropic-request-sanitizer/index.js.map +3 -3
- package/dist/plugins/anthropic-tool-name-transformer/index.js.map +3 -3
- package/dist/plugins/chatgpt-oauth/control.js.map +1 -1
- package/dist/plugins/chatgpt-oauth/index.js +7 -4
- package/dist/plugins/chatgpt-oauth/index.js.map +5 -5
- package/dist/plugins/codex-router/control.js +49 -0
- package/dist/plugins/codex-router/control.js.map +11 -0
- package/dist/plugins/codex-router/index.js +495 -0
- package/dist/plugins/codex-router/index.js.map +28 -0
- package/dist/plugins/codex-router/manifest.json +149 -0
- package/dist/plugins/deepseek-reasoning-fix/index.js.map +3 -3
- package/dist/plugins/key-access/control.js.map +2 -2
- package/dist/plugins/key-access/index.js +14 -10
- package/dist/plugins/key-access/index.js.map +5 -5
- package/dist/plugins/key-access/ingress.js +14 -10
- package/dist/plugins/key-access/ingress.js.map +4 -4
- package/dist/plugins/key-rate-limit/index.js.map +3 -3
- package/dist/plugins/local-accounts/control.js.map +1 -1
- package/dist/plugins/local-accounts/index.js.map +3 -3
- package/dist/plugins/model-mapping/control.js.map +1 -1
- package/dist/plugins/model-mapping/index.js.map +4 -4
- package/dist/plugins/models-dev/control.js +24 -1
- package/dist/plugins/models-dev/control.js.map +5 -5
- package/dist/plugins/models-dev/index.js +24 -1
- package/dist/plugins/models-dev/index.js.map +7 -7
- package/dist/plugins/models-dev/manifest.json +12 -0
- package/dist/plugins/openai-messages-to-chat/index.js.map +3 -3
- package/dist/plugins/signature-repair/index.js.map +3 -3
- package/dist/plugins/token-budget/control.js.map +1 -1
- package/dist/plugins/token-budget/index.js.map +3 -3
- package/dist/plugins/token-metering/index.js.map +3 -3
- package/dist/plugins/token-stats/control.js.map +2 -2
- package/dist/plugins/token-stats/index.js.map +4 -4
- package/dist/scoped-plugin-registry.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LogicalConfigurationV2 } from '@jeffusion/bungee-types';
|
|
2
|
+
import type { PluginSchemaCatalog } from './plugin-schema';
|
|
3
|
+
import type { ValidationContext } from './validation';
|
|
4
|
+
/** Only schema-declared references participate. Client JSON and headers never supply targets. */
|
|
5
|
+
export declare function validateGatewayTargets(config: LogicalConfigurationV2, schemas: PluginSchemaCatalog | undefined, context: ValidationContext): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Typed extension stages shared by built-in and project plugins. */
|
|
2
|
-
import type { AppConfig, RouteConfig, CorsConfig } from '@jeffusion/bungee-types';
|
|
2
|
+
import type { AppConfig, RouteConfig, CorsConfig, LLMProtocol } from '@jeffusion/bungee-types';
|
|
3
3
|
import type { ExpressionContext } from '../expression-engine';
|
|
4
4
|
import type { EffectiveRouteConfig, RuntimeUpstream, RequestSnapshot } from '../worker/types';
|
|
5
5
|
import type { HandleRequestRuntimeContext } from './request-plugin';
|
|
@@ -24,6 +24,33 @@ export type GatewayBodyRuleArguments = [body: Record<string, any>, rules: Modifi
|
|
|
24
24
|
export type GatewayHeaderRuleArguments = [headers: Headers, rules: ModificationRules['headers'], context: ExpressionContext];
|
|
25
25
|
export type GatewayCorsArguments = [response: Response, cors: CorsConfig | undefined, request: Request];
|
|
26
26
|
export type GatewayQueryRuleArguments = [params: URLSearchParams, rules: ModificationRules['query'], context: ExpressionContext, requestLog: any];
|
|
27
|
+
export interface GatewayDispatchTarget {
|
|
28
|
+
readonly type: 'route' | 'service';
|
|
29
|
+
readonly id: string;
|
|
30
|
+
}
|
|
31
|
+
export interface DispatchRequestInput {
|
|
32
|
+
readonly context: import('../hooks').MutableRequestContext;
|
|
33
|
+
readonly targets: readonly (GatewayDispatchTarget & {
|
|
34
|
+
readonly protocol?: LLMProtocol;
|
|
35
|
+
})[];
|
|
36
|
+
readonly principal?: import('../plugin-extensions').DataPrincipal;
|
|
37
|
+
readonly signal: AbortSignal;
|
|
38
|
+
readonly servingRevision?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface DispatchRequestDecision {
|
|
41
|
+
readonly target: GatewayDispatchTarget;
|
|
42
|
+
}
|
|
43
|
+
export interface GatewayDispatchInput extends Omit<DispatchRequestInput, 'targets'> {
|
|
44
|
+
readonly config: AppConfig;
|
|
45
|
+
readonly entry: RouteConfig;
|
|
46
|
+
}
|
|
47
|
+
export interface GatewayDispatchDecision {
|
|
48
|
+
readonly route: RouteConfig;
|
|
49
|
+
readonly effective: EffectiveRouteConfig;
|
|
50
|
+
readonly context: import('../hooks').MutableRequestContext;
|
|
51
|
+
readonly entryRouteId?: string;
|
|
52
|
+
readonly target?: GatewayDispatchTarget;
|
|
53
|
+
}
|
|
27
54
|
export interface GatewayRouteInput {
|
|
28
55
|
readonly request: Request;
|
|
29
56
|
readonly config: AppConfig;
|
|
@@ -107,4 +134,4 @@ export interface GatewayLogResult {
|
|
|
107
134
|
readonly logger?: RequestLogger;
|
|
108
135
|
}
|
|
109
136
|
/** Provider stages are fixed, required, and registered exactly once at startup. */
|
|
110
|
-
export declare const GATEWAY_PROVIDER_STAGES: readonly ["onGatewayWebSocket", "onGatewayBody", "onGatewayRequest", "onGatewayRoute", "onGatewayAdmission", "onGatewayAdmissionSession", "onGatewayAdmissionPrepare", "onGatewaySelect", "onGatewayFailover", "onGatewayRetry", "onGatewayForward", "onGatewayHeaderRules", "onGatewayCors", "onGatewayBodyRules", "onGatewayQueryRules", "onGatewayResponseRules", "onGatewayLog"];
|
|
137
|
+
export declare const GATEWAY_PROVIDER_STAGES: readonly ["onGatewayWebSocket", "onGatewayBody", "onGatewayRequest", "onGatewayRoute", "onGatewayDispatch", "onGatewayAdmission", "onGatewayAdmissionSession", "onGatewayAdmissionPrepare", "onGatewaySelect", "onGatewayFailover", "onGatewayRetry", "onGatewayForward", "onGatewayHeaderRules", "onGatewayCors", "onGatewayBodyRules", "onGatewayQueryRules", "onGatewayResponseRules", "onGatewayLog"];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PluginConfigField } from '../plugin.types';
|
|
2
|
+
import type { GatewayDispatchTarget } from './contracts';
|
|
3
|
+
/** Extract references only from the trusted schema, never from arbitrary request JSON. */
|
|
4
|
+
export declare function declaredDispatchTargets(options: Record<string, unknown>, fields: readonly PluginConfigField[]): GatewayDispatchTarget[];
|
package/dist/gateway/plugin.js
CHANGED
|
@@ -325,6 +325,8 @@ function createPluginHooks() {
|
|
|
325
325
|
onGatewayBody: new SyncBailHook("onGatewayBody"),
|
|
326
326
|
onGatewayRequest: new AsyncSeriesBailHook("onGatewayRequest"),
|
|
327
327
|
onGatewayRoute: new AsyncSeriesBailHook("onGatewayRoute"),
|
|
328
|
+
onGatewayDispatch: new AsyncSeriesBailHook("onGatewayDispatch"),
|
|
329
|
+
onDispatchRequest: new AsyncSeriesBailHook("onDispatchRequest"),
|
|
328
330
|
onGatewayAdmission: new AsyncSeriesBailHook("onGatewayAdmission"),
|
|
329
331
|
onGatewayAdmissionSession: new AsyncSeriesBailHook("onGatewayAdmissionSession"),
|
|
330
332
|
onGatewayAdmissionPrepare: new AsyncSeriesBailHook("onGatewayAdmissionPrepare"),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { CorsConfig } from '@jeffusion/bungee-types';
|
|
1
|
+
import type { AppConfig, RouteConfig, CorsConfig } from '@jeffusion/bungee-types';
|
|
2
|
+
import type { EffectiveRouteConfig } from '../worker/types';
|
|
2
3
|
import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
|
|
4
|
+
export declare function resolveEffectiveRoute(config: AppConfig, route: RouteConfig): EffectiveRouteConfig;
|
|
3
5
|
export declare function applyCorsHeaders(response: Response, cors: CorsConfig | undefined, request: Request): Response;
|
|
4
6
|
export declare class RoutingPlugin implements Plugin {
|
|
5
7
|
bodyRequirements(): {
|
|
@@ -11,7 +11,7 @@ import type { PluginServices } from '../plugin-services';
|
|
|
11
11
|
import type { PluginStorage, SSEEnvelope } from '../plugin.types';
|
|
12
12
|
import type { InterceptResult, PluginPhase } from '@jeffusion/bungee-types';
|
|
13
13
|
import type { RawResponseResult } from '../plugin-control/contracts';
|
|
14
|
-
import type { GatewayBodyArguments, GatewayRequestArguments, GatewayForwardArguments, GatewayResponseRuleArguments, GatewayBodyRuleArguments, GatewayQueryRuleArguments, GatewayHeaderRuleArguments, GatewayCorsArguments, GatewayRouteInput, GatewayRouteDecision, GatewayAdmissionInput, GatewayAdmissionDecision, GatewayAdmissionSessionInput, GatewayAdmissionPrepareInput, GatewaySelectInput, GatewaySelectDecision, GatewayFailoverInput, GatewayRetryInput, GatewayLogInput, GatewayLogResult } from '../gateway/contracts';
|
|
14
|
+
import type { GatewayBodyArguments, GatewayRequestArguments, GatewayForwardArguments, GatewayResponseRuleArguments, GatewayBodyRuleArguments, GatewayQueryRuleArguments, GatewayHeaderRuleArguments, GatewayCorsArguments, GatewayRouteInput, GatewayRouteDecision, GatewayDispatchInput, GatewayDispatchDecision, DispatchRequestInput, DispatchRequestDecision, GatewayAdmissionInput, GatewayAdmissionDecision, GatewayAdmissionSessionInput, GatewayAdmissionPrepareInput, GatewaySelectInput, GatewaySelectDecision, GatewayFailoverInput, GatewayRetryInput, GatewayLogInput, GatewayLogResult } from '../gateway/contracts';
|
|
15
15
|
import type { WorkerRequestAdmission, PreparedAdmissionAttempt } from '../data-admission/worker';
|
|
16
16
|
import type { FailoverCoordinator } from '../worker/upstream/failover-coordinator';
|
|
17
17
|
import type { ProxyRequestResult } from '../gateway/forward-plugin';
|
|
@@ -233,6 +233,8 @@ export interface PluginHooks {
|
|
|
233
233
|
onGatewayCors: AsyncSeriesBailHook<GatewayCorsArguments, Response>;
|
|
234
234
|
onGatewayRequest: AsyncSeriesBailHook<GatewayRequestArguments, Response>;
|
|
235
235
|
onGatewayRoute: AsyncSeriesBailHook<[GatewayRouteInput], GatewayRouteDecision>;
|
|
236
|
+
onGatewayDispatch: AsyncSeriesBailHook<[GatewayDispatchInput], GatewayDispatchDecision>;
|
|
237
|
+
onDispatchRequest: AsyncSeriesBailHook<[DispatchRequestInput], DispatchRequestDecision>;
|
|
236
238
|
onGatewayAdmission: AsyncSeriesBailHook<[GatewayAdmissionInput], GatewayAdmissionDecision>;
|
|
237
239
|
onGatewayAdmissionSession: AsyncSeriesBailHook<[GatewayAdmissionSessionInput], WorkerRequestAdmission>;
|
|
238
240
|
onGatewayAdmissionPrepare: AsyncSeriesBailHook<[GatewayAdmissionPrepareInput], PreparedAdmissionAttempt[]>;
|