team-anya 0.2.6 → 0.2.7

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.
@@ -243,6 +243,13 @@ export class CCBroker extends EventEmitter {
243
243
  get instanceCount() {
244
244
  return this.instances.size;
245
245
  }
246
+ maxInstances(role) {
247
+ if (role === 'loid')
248
+ return this.maxLoidInstances;
249
+ if (role === 'yor')
250
+ return this.maxYorInstances;
251
+ return this.maxFrankyInstances;
252
+ }
246
253
  // ── 私有 ──
247
254
  shutdownResolve = null;
248
255
  countByRole(role) {
@@ -32,7 +32,9 @@ const envSchema = z.object({
32
32
  SQLITE_PATH: z.string().optional(),
33
33
  ANYA_HOME: z.string().default(defaultAnyaHome).transform(resolveHome),
34
34
  WORKSPACE_PATH: z.string().optional(),
35
- MAX_YOR_CONCURRENCY: z.coerce.number().min(1).max(10).default(3),
35
+ MAX_LOID_CONCURRENCY: z.coerce.number().min(1).default(100),
36
+ MAX_YOR_CONCURRENCY: z.coerce.number().min(1).default(100),
37
+ MAX_FRANKY_CONCURRENCY: z.coerce.number().min(1).default(100),
36
38
  CLAUDE_CODE_BINARY: z.string().default('claude'),
37
39
  LOID_WORK_DIR: z.string().optional(),
38
40
  LOID_PROTOCOLS_DIR: z.string().default(resolve(PKG_ROOT, 'blueprint/protocols')),
@@ -150,6 +150,21 @@ export async function registerRoutes(app, deps) {
150
150
  const todayEventsCount = todayEventsResult?.count ?? 0;
151
151
  // 未处理机会
152
152
  const recentOpportunities = getOpenOpportunities(db);
153
+ // 各角色活跃 session 统计
154
+ const activeInstances = {
155
+ loid: {
156
+ active: slotStatus.filter(s => s.role === 'loid' && s.state !== 'disposed').length,
157
+ max: broker.maxInstances('loid'),
158
+ },
159
+ yor: {
160
+ active: slotStatus.filter(s => s.role === 'yor' && s.state !== 'disposed').length,
161
+ max: broker.maxInstances('yor'),
162
+ },
163
+ franky: {
164
+ active: slotStatus.filter(s => s.role === 'franky' && s.state !== 'disposed').length,
165
+ max: broker.maxInstances('franky'),
166
+ },
167
+ };
153
168
  return reply.send({
154
169
  statusCounts,
155
170
  totalTasks: allTasks.length,
@@ -159,6 +174,7 @@ export async function registerRoutes(app, deps) {
159
174
  busy: slotStatus.filter(s => s.role === 'yor' && s.state === 'executing').length,
160
175
  available: 0,
161
176
  },
177
+ activeInstances,
162
178
  recentTasks: allTasks.slice(-10).reverse(),
163
179
  // C3 新增字段
164
180
  overdueCommitments,
@@ -167,9 +167,9 @@ export async function buildServer() {
167
167
  });
168
168
  // CCBroker — 统一 CC 进程管理器
169
169
  const broker = new CCBroker({
170
- maxLoidInstances: 2,
170
+ maxLoidInstances: config.MAX_LOID_CONCURRENCY,
171
171
  maxYorInstances: config.MAX_YOR_CONCURRENCY,
172
- maxFrankyInstances: 2,
172
+ maxFrankyInstances: config.MAX_FRANKY_CONCURRENCY,
173
173
  logger: app.log,
174
174
  });
175
175
  // YorOrchestrator — 替代 Yor 子进程,通过 CCBroker 管理 Yor CC