refactor(core): split index.ts and config-handler.ts into focused modules

Main entry point:
- create-hooks.ts, create-tools.ts, create-managers.ts
- plugin-interface.ts: plugin interface types
- plugin/ directory: plugin lifecycle modules

Config handler:
- agent-config-handler.ts, command-config-handler.ts
- tool-config-handler.ts, mcp-config-handler.ts
- provider-config-handler.ts, category-config-resolver.ts
- agent-priority-order.ts, prometheus-agent-config-builder.ts
- plugin-components-loader.ts
This commit is contained in:
YeonGyu-Kim
2026-02-08 16:25:25 +09:00
parent d525958a9d
commit 598a4389d1
33 changed files with 2305 additions and 1443 deletions
@@ -0,0 +1,36 @@
import type { ModelCacheState } from "../plugin-state";
type ProviderConfig = {
options?: { headers?: Record<string, string> };
models?: Record<string, { limit?: { context?: number } }>;
};
export function applyProviderConfig(params: {
config: Record<string, unknown>;
modelCacheState: ModelCacheState;
}): void {
const providers = params.config.provider as
| Record<string, ProviderConfig>
| undefined;
const anthropicBeta = providers?.anthropic?.options?.headers?.["anthropic-beta"];
params.modelCacheState.anthropicContext1MEnabled =
anthropicBeta?.includes("context-1m") ?? false;
if (!providers) return;
for (const [providerID, providerConfig] of Object.entries(providers)) {
const models = providerConfig?.models;
if (!models) continue;
for (const [modelID, modelConfig] of Object.entries(models)) {
const contextLimit = modelConfig?.limit?.context;
if (!contextLimit) continue;
params.modelCacheState.modelContextLimitsCache.set(
`${providerID}/${modelID}`,
contextLimit,
);
}
}
}