feat: demote context startup priority
- cap contexts to 10 per account - align MCP and onboarding context guidance - keep contexts optional unless obviously relevant
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const { getDb } = require('./sqlite-client');
|
||||
const MAX_CONTEXTS_PER_ACCOUNT = 10;
|
||||
|
||||
function mapContext(row) {
|
||||
if (!row) return null;
|
||||
@@ -57,6 +58,10 @@ function createContext({ name, description = null, icon = null }) {
|
||||
if (!trimmedName) {
|
||||
throw new Error('Context name is required.');
|
||||
}
|
||||
const existingCount = Number(db.prepare('SELECT COUNT(*) AS count FROM contexts').get()?.count ?? 0);
|
||||
if (existingCount >= MAX_CONTEXTS_PER_ACCOUNT) {
|
||||
throw new Error(`Context limit reached. Maximum ${MAX_CONTEXTS_PER_ACCOUNT} contexts are allowed per account.`);
|
||||
}
|
||||
|
||||
const now = new Date().toISOString();
|
||||
const info = db.prepare(`
|
||||
@@ -126,6 +131,7 @@ function resolveContextId(input = {}) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
MAX_CONTEXTS_PER_ACCOUNT,
|
||||
listContexts,
|
||||
getContextById,
|
||||
getContextByName,
|
||||
|
||||
Reference in New Issue
Block a user