feat(engine): add background project engine reconciliation + global concurrency setting
- ProjectEngineManager.startReconciliation() polls for newly registered projects every 30s and starts their engines without requiring UI access - Expose global concurrency limit in dashboard settings - Fix SettingsModal test cleanup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,8 +38,6 @@ vi.mock("../../api", () => ({
|
||||
fetchSettings: vi.fn(() => Promise.resolve({ ...defaultSettings })),
|
||||
updateSettings: vi.fn(() => Promise.resolve({ ...defaultSettings })),
|
||||
updateGlobalSettings: vi.fn(() => Promise.resolve({ ...defaultSettings })),
|
||||
fetchGlobalConcurrency: vi.fn(() => Promise.resolve({ globalMaxConcurrent: 4, currentlyActive: 0, queuedCount: 0, projectsActive: {} })),
|
||||
updateGlobalConcurrency: vi.fn(() => Promise.resolve({ globalMaxConcurrent: 4, currentlyActive: 0, queuedCount: 0, projectsActive: {} })),
|
||||
fetchAuthStatus: vi.fn(() => Promise.resolve({ providers: [{ id: "anthropic", name: "Anthropic", authenticated: false }] })),
|
||||
loginProvider: vi.fn(() => Promise.resolve({ url: "https://auth.example.com/login" })),
|
||||
logoutProvider: vi.fn(() => Promise.resolve({ success: true })),
|
||||
@@ -66,8 +64,6 @@ vi.mock("../../api", () => ({
|
||||
fetchPluginSettings: vi.fn(() => Promise.resolve({})),
|
||||
updatePluginSettings: vi.fn(() => Promise.resolve({})),
|
||||
reloadPlugin: vi.fn(() => Promise.resolve({ id: "test-plugin", name: "Test Plugin", version: "1.0.0", state: "started" as const, enabled: true, settings: {}, settingsSchema: {} })),
|
||||
fetchGlobalConcurrency: vi.fn(() => Promise.resolve({ globalMaxConcurrent: 4, currentlyActive: 0, queuedCount: 0, projectsActive: {} })),
|
||||
updateGlobalConcurrency: vi.fn(() => Promise.resolve({ globalMaxConcurrent: 4, currentlyActive: 0, queuedCount: 0, projectsActive: {} })),
|
||||
fetchBackups: vi.fn(() => Promise.resolve({ backups: [], totalSize: 0 })),
|
||||
createBackup: vi.fn(() => Promise.resolve({ success: true })),
|
||||
exportSettings: vi.fn(() => Promise.resolve({ version: 1, exportedAt: new Date().toISOString(), global: undefined, project: {} })),
|
||||
|
||||
@@ -37,7 +37,6 @@ vi.mock("../../api", () => ({
|
||||
fetchSettings: vi.fn(() => Promise.resolve({ ...defaultSettings })),
|
||||
updateSettings: vi.fn(() => Promise.resolve({ ...defaultSettings })),
|
||||
updateGlobalSettings: vi.fn(() => Promise.resolve({ ...defaultSettings })),
|
||||
fetchGlobalConcurrency: vi.fn(() => Promise.resolve({ globalMaxConcurrent: 4, currentlyActive: 0, queuedCount: 0, projectsActive: {} })),
|
||||
fetchAuthStatus: vi.fn(() => Promise.resolve({ providers: [{ id: "anthropic", name: "Anthropic", authenticated: false }] })),
|
||||
loginProvider: vi.fn(() => Promise.resolve({ url: "https://auth.example.com/login" })),
|
||||
logoutProvider: vi.fn(() => Promise.resolve({ success: true })),
|
||||
|
||||
@@ -145,8 +145,14 @@ export interface ServerOptions {
|
||||
chatManager?: import("./chat.js").ChatManager;
|
||||
/**
|
||||
* Called once when a secondary project (identified by projectId query param)
|
||||
* is first accessed via a project-scoped API or SSE request. Use this to
|
||||
* lazily start an engine for that project.
|
||||
* is first accessed via a project-scoped API or SSE request.
|
||||
*
|
||||
* @deprecated This callback is a fast-path fallback for immediate engine
|
||||
* startup on project access. ProjectEngineManager.startReconciliation() is
|
||||
* the primary mechanism for ensuring all registered projects have engines
|
||||
* started — it runs without requiring any UI or API access. This callback
|
||||
* is NOT required for correctness; it only provides a potential optimization
|
||||
* for projects that are accessed before the next reconciliation tick.
|
||||
*/
|
||||
onProjectFirstAccessed?: (projectId: string) => void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user