@codelia/config 0.1.79 → 0.1.81

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.
package/dist/index.cjs CHANGED
@@ -23,12 +23,15 @@ __export(index_exports, {
23
23
  CONFIG_GROUP_DEFAULT_WRITE_SCOPE: () => CONFIG_GROUP_DEFAULT_WRITE_SCOPE,
24
24
  CONFIG_VERSION: () => CONFIG_VERSION,
25
25
  ConfigRegistry: () => ConfigRegistry,
26
+ SUBAGENT_MAX_CONCURRENT_LIMIT: () => SUBAGENT_MAX_CONCURRENT_LIMIT,
26
27
  configRegistry: () => configRegistry,
27
28
  parseConfig: () => parseConfig
28
29
  });
29
30
  module.exports = __toCommonJS(index_exports);
31
+ var SUBAGENT_MAX_CONCURRENT_LIMIT = 16;
30
32
  var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
31
33
  model: "global",
34
+ subagent: "global",
32
35
  experimental: "global",
33
36
  permissions: "project",
34
37
  mcp: "project",
@@ -312,6 +315,44 @@ var parseSearchConfig = (value) => {
312
315
  }
313
316
  return Object.keys(result).length > 0 ? result : void 0;
314
317
  };
318
+ var parseModelConfig = (value) => isRecord(value) ? {
319
+ provider: pickString(value.provider),
320
+ name: pickString(value.name),
321
+ reasoning: pickString(value.reasoning),
322
+ verbosity: pickString(value.verbosity),
323
+ fast: pickBoolean(value.fast)
324
+ } : void 0;
325
+ var parseSubagentConfig = (value, source) => {
326
+ if (!isRecord(value)) return void 0;
327
+ const maxConcurrent = value.max_concurrent;
328
+ if (maxConcurrent !== void 0 && (typeof maxConcurrent !== "number" || !Number.isInteger(maxConcurrent) || maxConcurrent < 1 || maxConcurrent > SUBAGENT_MAX_CONCURRENT_LIMIT)) {
329
+ throw new Error(
330
+ `${source}: subagent.max_concurrent must be an integer from 1 to ${SUBAGENT_MAX_CONCURRENT_LIMIT}`
331
+ );
332
+ }
333
+ const profiles = isRecord(value.profiles) ? Object.fromEntries(
334
+ Object.entries(value.profiles).map(([name, profile]) => {
335
+ const model = isRecord(profile) ? parseModelConfig(profile.model) : void 0;
336
+ if (!/^[a-zA-Z0-9_-]{1,64}$/.test(name) || !model?.name) {
337
+ throw new Error(
338
+ `${source}: subagent profile ${name} requires a valid profile name and model.name`
339
+ );
340
+ }
341
+ return [
342
+ name,
343
+ {
344
+ description: isRecord(profile) ? pickString(profile.description) : void 0,
345
+ model: { ...model, name: model.name }
346
+ }
347
+ ];
348
+ })
349
+ ) : void 0;
350
+ return {
351
+ max_concurrent: maxConcurrent,
352
+ default_profile: pickString(value.default_profile),
353
+ profiles
354
+ };
355
+ };
315
356
  var parseConfig = (value, sourceLabel) => {
316
357
  if (!isRecord(value)) {
317
358
  throw new Error(`${sourceLabel}: config must be an object`);
@@ -320,14 +361,8 @@ var parseConfig = (value, sourceLabel) => {
320
361
  if (version !== CONFIG_VERSION) {
321
362
  throw new Error(`${sourceLabel}: unsupported version ${String(version)}`);
322
363
  }
323
- const modelValue = value.model;
324
- const model = isRecord(modelValue) ? {
325
- provider: pickString(modelValue.provider),
326
- name: pickString(modelValue.name),
327
- reasoning: pickString(modelValue.reasoning),
328
- verbosity: pickString(modelValue.verbosity),
329
- fast: pickBoolean(modelValue.fast)
330
- } : void 0;
364
+ const model = parseModelConfig(value.model);
365
+ const subagent = parseSubagentConfig(value.subagent, sourceLabel);
331
366
  const permissionsValue = value.permissions;
332
367
  const permissions = isRecord(permissionsValue) ? {
333
368
  allow: parsePermissionRules(permissionsValue.allow),
@@ -345,6 +380,7 @@ var parseConfig = (value, sourceLabel) => {
345
380
  ...pickString(value.tui.theme) ? { theme: pickString(value.tui.theme) } : {}
346
381
  } : void 0;
347
382
  const result = { version, model };
383
+ if (subagent) result.subagent = subagent;
348
384
  if (hasPermissions) {
349
385
  result.permissions = hasPermissions;
350
386
  }
@@ -379,6 +415,16 @@ var ConfigRegistry = class {
379
415
  if (layer?.model) {
380
416
  merged.model = { ...merged.model, ...layer.model };
381
417
  }
418
+ if (layer?.subagent) {
419
+ merged.subagent = {
420
+ max_concurrent: layer.subagent.max_concurrent ?? merged.subagent?.max_concurrent,
421
+ default_profile: layer.subagent.default_profile ?? merged.subagent?.default_profile,
422
+ profiles: {
423
+ ...merged.subagent?.profiles,
424
+ ...layer.subagent.profiles
425
+ }
426
+ };
427
+ }
382
428
  if (layer?.experimental) {
383
429
  const nextExperimental = layer.experimental;
384
430
  merged.experimental ??= {};
@@ -502,6 +548,7 @@ var configRegistry = new ConfigRegistry();
502
548
  CONFIG_GROUP_DEFAULT_WRITE_SCOPE,
503
549
  CONFIG_VERSION,
504
550
  ConfigRegistry,
551
+ SUBAGENT_MAX_CONCURRENT_LIMIT,
505
552
  configRegistry,
506
553
  parseConfig
507
554
  });
package/dist/index.d.cts CHANGED
@@ -5,6 +5,17 @@ type ModelConfig = {
5
5
  verbosity?: string;
6
6
  fast?: boolean;
7
7
  };
8
+ declare const SUBAGENT_MAX_CONCURRENT_LIMIT = 16;
9
+ type SubagentConfig = {
10
+ max_concurrent?: number;
11
+ default_profile?: string;
12
+ profiles?: Record<string, {
13
+ description?: string;
14
+ model: ModelConfig & {
15
+ name: string;
16
+ };
17
+ }>;
18
+ };
8
19
  type OpenAiExperimentalConfig = {
9
20
  websocket_mode?: "off" | "auto" | "on";
10
21
  };
@@ -100,6 +111,7 @@ type TuiConfig = {
100
111
  type CodeliaConfig = {
101
112
  version: number;
102
113
  model?: ModelConfig;
114
+ subagent?: SubagentConfig;
103
115
  experimental?: ExperimentalConfig;
104
116
  permissions?: PermissionsConfig;
105
117
  mcp?: McpConfig;
@@ -115,6 +127,7 @@ declare const CONFIG_VERSION = 1;
115
127
  declare const parseConfig: (value: unknown, sourceLabel: string) => CodeliaConfig;
116
128
  type ConfigLayer = {
117
129
  model?: ModelConfig;
130
+ subagent?: SubagentConfig;
118
131
  experimental?: ExperimentalConfig;
119
132
  permissions?: PermissionsConfig;
120
133
  mcp?: McpConfig;
@@ -130,4 +143,4 @@ declare class ConfigRegistry {
130
143
  }
131
144
  declare const configRegistry: ConfigRegistry;
132
145
 
133
- export { CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, type McpConfig, type McpServerConfig, type ModelConfig, type OpenAiExperimentalConfig, type PermissionRule, type PermissionsConfig, type SearchConfig, type SearchMode, type SkillsConfig, type TuiConfig, configRegistry, parseConfig };
146
+ export { CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, type McpConfig, type McpServerConfig, type ModelConfig, type OpenAiExperimentalConfig, type PermissionRule, type PermissionsConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiConfig, configRegistry, parseConfig };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,17 @@ type ModelConfig = {
5
5
  verbosity?: string;
6
6
  fast?: boolean;
7
7
  };
8
+ declare const SUBAGENT_MAX_CONCURRENT_LIMIT = 16;
9
+ type SubagentConfig = {
10
+ max_concurrent?: number;
11
+ default_profile?: string;
12
+ profiles?: Record<string, {
13
+ description?: string;
14
+ model: ModelConfig & {
15
+ name: string;
16
+ };
17
+ }>;
18
+ };
8
19
  type OpenAiExperimentalConfig = {
9
20
  websocket_mode?: "off" | "auto" | "on";
10
21
  };
@@ -100,6 +111,7 @@ type TuiConfig = {
100
111
  type CodeliaConfig = {
101
112
  version: number;
102
113
  model?: ModelConfig;
114
+ subagent?: SubagentConfig;
103
115
  experimental?: ExperimentalConfig;
104
116
  permissions?: PermissionsConfig;
105
117
  mcp?: McpConfig;
@@ -115,6 +127,7 @@ declare const CONFIG_VERSION = 1;
115
127
  declare const parseConfig: (value: unknown, sourceLabel: string) => CodeliaConfig;
116
128
  type ConfigLayer = {
117
129
  model?: ModelConfig;
130
+ subagent?: SubagentConfig;
118
131
  experimental?: ExperimentalConfig;
119
132
  permissions?: PermissionsConfig;
120
133
  mcp?: McpConfig;
@@ -130,4 +143,4 @@ declare class ConfigRegistry {
130
143
  }
131
144
  declare const configRegistry: ConfigRegistry;
132
145
 
133
- export { CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, type McpConfig, type McpServerConfig, type ModelConfig, type OpenAiExperimentalConfig, type PermissionRule, type PermissionsConfig, type SearchConfig, type SearchMode, type SkillsConfig, type TuiConfig, configRegistry, parseConfig };
146
+ export { CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, type McpConfig, type McpServerConfig, type ModelConfig, type OpenAiExperimentalConfig, type PermissionRule, type PermissionsConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiConfig, configRegistry, parseConfig };
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // src/index.ts
2
+ var SUBAGENT_MAX_CONCURRENT_LIMIT = 16;
2
3
  var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
3
4
  model: "global",
5
+ subagent: "global",
4
6
  experimental: "global",
5
7
  permissions: "project",
6
8
  mcp: "project",
@@ -284,6 +286,44 @@ var parseSearchConfig = (value) => {
284
286
  }
285
287
  return Object.keys(result).length > 0 ? result : void 0;
286
288
  };
289
+ var parseModelConfig = (value) => isRecord(value) ? {
290
+ provider: pickString(value.provider),
291
+ name: pickString(value.name),
292
+ reasoning: pickString(value.reasoning),
293
+ verbosity: pickString(value.verbosity),
294
+ fast: pickBoolean(value.fast)
295
+ } : void 0;
296
+ var parseSubagentConfig = (value, source) => {
297
+ if (!isRecord(value)) return void 0;
298
+ const maxConcurrent = value.max_concurrent;
299
+ if (maxConcurrent !== void 0 && (typeof maxConcurrent !== "number" || !Number.isInteger(maxConcurrent) || maxConcurrent < 1 || maxConcurrent > SUBAGENT_MAX_CONCURRENT_LIMIT)) {
300
+ throw new Error(
301
+ `${source}: subagent.max_concurrent must be an integer from 1 to ${SUBAGENT_MAX_CONCURRENT_LIMIT}`
302
+ );
303
+ }
304
+ const profiles = isRecord(value.profiles) ? Object.fromEntries(
305
+ Object.entries(value.profiles).map(([name, profile]) => {
306
+ const model = isRecord(profile) ? parseModelConfig(profile.model) : void 0;
307
+ if (!/^[a-zA-Z0-9_-]{1,64}$/.test(name) || !model?.name) {
308
+ throw new Error(
309
+ `${source}: subagent profile ${name} requires a valid profile name and model.name`
310
+ );
311
+ }
312
+ return [
313
+ name,
314
+ {
315
+ description: isRecord(profile) ? pickString(profile.description) : void 0,
316
+ model: { ...model, name: model.name }
317
+ }
318
+ ];
319
+ })
320
+ ) : void 0;
321
+ return {
322
+ max_concurrent: maxConcurrent,
323
+ default_profile: pickString(value.default_profile),
324
+ profiles
325
+ };
326
+ };
287
327
  var parseConfig = (value, sourceLabel) => {
288
328
  if (!isRecord(value)) {
289
329
  throw new Error(`${sourceLabel}: config must be an object`);
@@ -292,14 +332,8 @@ var parseConfig = (value, sourceLabel) => {
292
332
  if (version !== CONFIG_VERSION) {
293
333
  throw new Error(`${sourceLabel}: unsupported version ${String(version)}`);
294
334
  }
295
- const modelValue = value.model;
296
- const model = isRecord(modelValue) ? {
297
- provider: pickString(modelValue.provider),
298
- name: pickString(modelValue.name),
299
- reasoning: pickString(modelValue.reasoning),
300
- verbosity: pickString(modelValue.verbosity),
301
- fast: pickBoolean(modelValue.fast)
302
- } : void 0;
335
+ const model = parseModelConfig(value.model);
336
+ const subagent = parseSubagentConfig(value.subagent, sourceLabel);
303
337
  const permissionsValue = value.permissions;
304
338
  const permissions = isRecord(permissionsValue) ? {
305
339
  allow: parsePermissionRules(permissionsValue.allow),
@@ -317,6 +351,7 @@ var parseConfig = (value, sourceLabel) => {
317
351
  ...pickString(value.tui.theme) ? { theme: pickString(value.tui.theme) } : {}
318
352
  } : void 0;
319
353
  const result = { version, model };
354
+ if (subagent) result.subagent = subagent;
320
355
  if (hasPermissions) {
321
356
  result.permissions = hasPermissions;
322
357
  }
@@ -351,6 +386,16 @@ var ConfigRegistry = class {
351
386
  if (layer?.model) {
352
387
  merged.model = { ...merged.model, ...layer.model };
353
388
  }
389
+ if (layer?.subagent) {
390
+ merged.subagent = {
391
+ max_concurrent: layer.subagent.max_concurrent ?? merged.subagent?.max_concurrent,
392
+ default_profile: layer.subagent.default_profile ?? merged.subagent?.default_profile,
393
+ profiles: {
394
+ ...merged.subagent?.profiles,
395
+ ...layer.subagent.profiles
396
+ }
397
+ };
398
+ }
354
399
  if (layer?.experimental) {
355
400
  const nextExperimental = layer.experimental;
356
401
  merged.experimental ??= {};
@@ -473,6 +518,7 @@ export {
473
518
  CONFIG_GROUP_DEFAULT_WRITE_SCOPE,
474
519
  CONFIG_VERSION,
475
520
  ConfigRegistry,
521
+ SUBAGENT_MAX_CONCURRENT_LIMIT,
476
522
  configRegistry,
477
523
  parseConfig
478
524
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/config",
3
- "version": "0.1.79",
3
+ "version": "0.1.81",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [