feat(background-agent): add ConcurrencyManager for model-based limits

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2026-01-06 11:34:01 +09:00
parent 8394926fe1
commit 580d4bb0a1

View File

@@ -10,20 +10,14 @@ export class ConcurrencyManager {
}
getConcurrencyLimit(model: string): number {
const modelLimit = this.config?.modelConcurrency?.[model]
if (modelLimit !== undefined) {
return modelLimit === 0 ? Infinity : modelLimit
if (this.config?.modelConcurrency?.[model]) {
return this.config.modelConcurrency[model]
}
const provider = model.split('/')[0]
const providerLimit = this.config?.providerConcurrency?.[provider]
if (providerLimit !== undefined) {
return providerLimit === 0 ? Infinity : providerLimit
if (this.config?.providerConcurrency?.[provider]) {
return this.config.providerConcurrency[provider]
}
const defaultLimit = this.config?.defaultConcurrency
if (defaultLimit !== undefined) {
return defaultLimit === 0 ? Infinity : defaultLimit
}
return 5
return this.config?.defaultConcurrency ?? Infinity
}
async acquire(model: string): Promise<void> {