@codelia/config 0.1.86 → 0.1.89

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
@@ -29,10 +29,12 @@ __export(index_exports, {
29
29
  OPENAI_IMAGE_MODELS: () => OPENAI_IMAGE_MODELS,
30
30
  SUBAGENT_MAX_CONCURRENT_LIMIT: () => SUBAGENT_MAX_CONCURRENT_LIMIT,
31
31
  configRegistry: () => configRegistry,
32
+ isValidUpdateChannel: () => isValidUpdateChannel,
32
33
  normalizePermissionRule: () => normalizePermissionRule,
33
34
  parseConfig: () => parseConfig,
34
35
  parseImageGenerationConfig: () => parseImageGenerationConfig,
35
- parseResponsesProviders: () => parseResponsesProviders
36
+ parseResponsesProviders: () => parseResponsesProviders,
37
+ parseUpdateMode: () => parseUpdateMode
36
38
  });
37
39
  module.exports = __toCommonJS(index_exports);
38
40
 
@@ -313,7 +315,12 @@ var parseImageGenerationConfig = (value) => {
313
315
 
314
316
  // src/index.ts
315
317
  var SUBAGENT_MAX_CONCURRENT_LIMIT = 16;
318
+ var UPDATE_CHANNEL_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/i;
319
+ var RESERVED_UPDATE_CHANNEL_PREFIX = "codelia-staging-";
320
+ var isValidUpdateChannel = (value) => UPDATE_CHANNEL_PATTERN.test(value) && !value.toLowerCase().startsWith(RESERVED_UPDATE_CHANNEL_PREFIX);
321
+ var parseUpdateMode = (value) => value === "auto" || value === "notify" || value === "off" ? value : void 0;
316
322
  var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
323
+ auth: "global",
317
324
  model: "global",
318
325
  providers: "global",
319
326
  subagent: "global",
@@ -324,7 +331,8 @@ var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
324
331
  execution_environment: "project",
325
332
  search: "project",
326
333
  image_generation: "global",
327
- tui: "global"
334
+ tui: "global",
335
+ update: "global"
328
336
  };
329
337
  var CONFIG_VERSION = 1;
330
338
  var MCP_SERVER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/;
@@ -645,6 +653,37 @@ var parseSubagentConfig = (value, source) => {
645
653
  profiles
646
654
  };
647
655
  };
656
+ var parseAuthConfig = (value, source) => {
657
+ if (!isRecord(value)) return void 0;
658
+ const storage = value.storage;
659
+ if (storage === void 0) return void 0;
660
+ if (storage === "auto" || storage === "keyring" || storage === "file") {
661
+ return { storage };
662
+ }
663
+ throw new Error(
664
+ `${source}: auth.storage must be "auto", "keyring", or "file"`
665
+ );
666
+ };
667
+ var parseUpdateConfig = (value, source) => {
668
+ if (!isRecord(value)) return void 0;
669
+ const result = {};
670
+ if (value.mode !== void 0) {
671
+ const mode = parseUpdateMode(value.mode);
672
+ if (!mode) {
673
+ throw new Error(
674
+ `${source}: update.mode must be "auto", "notify", or "off"`
675
+ );
676
+ }
677
+ result.mode = mode;
678
+ }
679
+ if (value.channel !== void 0) {
680
+ if (typeof value.channel !== "string" || !isValidUpdateChannel(value.channel)) {
681
+ throw new Error(`${source}: update.channel must be an npm dist-tag name`);
682
+ }
683
+ result.channel = value.channel;
684
+ }
685
+ return Object.keys(result).length > 0 ? result : void 0;
686
+ };
648
687
  var parseConfig = (value, sourceLabel) => {
649
688
  if (!isRecord(value)) {
650
689
  throw new Error(`${sourceLabel}: config must be an object`);
@@ -653,6 +692,8 @@ var parseConfig = (value, sourceLabel) => {
653
692
  if (version !== CONFIG_VERSION) {
654
693
  throw new Error(`${sourceLabel}: unsupported version ${String(version)}`);
655
694
  }
695
+ const auth = parseAuthConfig(value.auth, sourceLabel);
696
+ const update = parseUpdateConfig(value.update, sourceLabel);
656
697
  const model = parseModelConfig(value.model);
657
698
  const subagent = parseSubagentConfig(value.subagent, sourceLabel);
658
699
  const permissionsValue = value.permissions;
@@ -672,6 +713,7 @@ var parseConfig = (value, sourceLabel) => {
672
713
  ...pickString(value.tui.theme) ? { theme: pickString(value.tui.theme) } : {}
673
714
  } : void 0;
674
715
  const result = { version, model };
716
+ if (auth) result.auth = auth;
675
717
  if (value.providers !== void 0)
676
718
  result.providers = parseResponsesProviders(value.providers, sourceLabel);
677
719
  if (value.image_generation !== void 0)
@@ -700,6 +742,7 @@ var parseConfig = (value, sourceLabel) => {
700
742
  if (tui && Object.keys(tui).length > 0) {
701
743
  result.tui = tui;
702
744
  }
745
+ if (update) result.update = update;
703
746
  return result;
704
747
  };
705
748
  var ConfigRegistry = class {
@@ -710,6 +753,9 @@ var ConfigRegistry = class {
710
753
  resolve(layers) {
711
754
  const merged = { version: CONFIG_VERSION };
712
755
  for (const layer of [...this.defaults, ...layers]) {
756
+ if (layer?.auth) {
757
+ merged.auth = { ...merged.auth ?? {}, ...layer.auth };
758
+ }
713
759
  if (layer?.providers)
714
760
  merged.providers = { ...merged.providers, ...layer.providers };
715
761
  if (layer?.model) {
@@ -840,6 +886,9 @@ var ConfigRegistry = class {
840
886
  ...layer.tui
841
887
  };
842
888
  }
889
+ if (layer?.update) {
890
+ merged.update = { ...merged.update ?? {}, ...layer.update };
891
+ }
843
892
  }
844
893
  return merged;
845
894
  }
@@ -856,8 +905,10 @@ var configRegistry = new ConfigRegistry();
856
905
  OPENAI_IMAGE_MODELS,
857
906
  SUBAGENT_MAX_CONCURRENT_LIMIT,
858
907
  configRegistry,
908
+ isValidUpdateChannel,
859
909
  normalizePermissionRule,
860
910
  parseConfig,
861
911
  parseImageGenerationConfig,
862
- parseResponsesProviders
912
+ parseResponsesProviders,
913
+ parseUpdateMode
863
914
  });
package/dist/index.d.cts CHANGED
@@ -179,10 +179,24 @@ type SearchConfig = {
179
179
  type TuiConfig = {
180
180
  theme?: string;
181
181
  };
182
+ type AuthStorageMode = "auto" | "keyring" | "file";
183
+ type AuthConfig = {
184
+ storage?: AuthStorageMode;
185
+ };
186
+ type UpdateMode = "auto" | "notify" | "off";
187
+ /** Launcher-only self-update settings; read from the global config only. */
188
+ type UpdateConfig = {
189
+ mode?: UpdateMode;
190
+ /** npm dist-tag to follow; inferred from the running version when omitted. */
191
+ channel?: string;
192
+ };
193
+ declare const isValidUpdateChannel: (value: string) => boolean;
194
+ declare const parseUpdateMode: (value: unknown) => UpdateMode | undefined;
182
195
  type CodeliaConfig = {
183
196
  providers?: Record<string, ResponsesProviderConfig>;
184
197
  image_generation?: ImageGenerationConfig;
185
198
  version: number;
199
+ auth?: AuthConfig;
186
200
  model?: ModelConfig;
187
201
  subagent?: SubagentConfig;
188
202
  experimental?: ExperimentalConfig;
@@ -192,6 +206,7 @@ type CodeliaConfig = {
192
206
  execution_environment?: ExecutionEnvironmentConfig;
193
207
  search?: SearchConfig;
194
208
  tui?: TuiConfig;
209
+ update?: UpdateConfig;
195
210
  };
196
211
  type ConfigWriteScope = "global" | "project";
197
212
  type ConfigWriteGroup = Exclude<keyof CodeliaConfig, "version">;
@@ -201,6 +216,7 @@ declare const CONFIG_VERSION = 1;
201
216
  declare const normalizePermissionRule: (value: unknown) => PermissionRule | null;
202
217
  declare const parseConfig: (value: unknown, sourceLabel: string) => CodeliaConfig;
203
218
  type ConfigLayer = {
219
+ auth?: AuthConfig;
204
220
  providers?: Record<string, ResponsesProviderConfig>;
205
221
  image_generation?: ImageGenerationConfig;
206
222
  model?: ModelConfig;
@@ -212,6 +228,7 @@ type ConfigLayer = {
212
228
  execution_environment?: ExecutionEnvironmentConfig;
213
229
  search?: SearchConfig;
214
230
  tui?: TuiConfig;
231
+ update?: UpdateConfig;
215
232
  };
216
233
  declare class ConfigRegistry {
217
234
  private readonly defaults;
@@ -220,4 +237,4 @@ declare class ConfigRegistry {
220
237
  }
221
238
  declare const configRegistry: ConfigRegistry;
222
239
 
223
- export { BUILTIN_PROVIDER_NAMES, CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, GOOGLE_IMAGE_MODELS, type GoogleImageOptions, type ImageGenerationConfig, type ImageProviderOptions, type McpConfig, type McpServerConfig, type ModelConfig, OPENAI_CODEX_IMAGE_MODELS, OPENAI_IMAGE_MODELS, type OpenAiExperimentalConfig, type OpenAiImageOptions, type OpenRouterImageOptions, type PermissionRule, type PermissionsConfig, type ResponsesModelConfig, type ResponsesProviderConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiConfig, configRegistry, normalizePermissionRule, parseConfig, parseImageGenerationConfig, parseResponsesProviders };
240
+ export { type AuthConfig, type AuthStorageMode, BUILTIN_PROVIDER_NAMES, CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, GOOGLE_IMAGE_MODELS, type GoogleImageOptions, type ImageGenerationConfig, type ImageProviderOptions, type McpConfig, type McpServerConfig, type ModelConfig, OPENAI_CODEX_IMAGE_MODELS, OPENAI_IMAGE_MODELS, type OpenAiExperimentalConfig, type OpenAiImageOptions, type OpenRouterImageOptions, type PermissionRule, type PermissionsConfig, type ResponsesModelConfig, type ResponsesProviderConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiConfig, type UpdateConfig, type UpdateMode, configRegistry, isValidUpdateChannel, normalizePermissionRule, parseConfig, parseImageGenerationConfig, parseResponsesProviders, parseUpdateMode };
package/dist/index.d.ts CHANGED
@@ -179,10 +179,24 @@ type SearchConfig = {
179
179
  type TuiConfig = {
180
180
  theme?: string;
181
181
  };
182
+ type AuthStorageMode = "auto" | "keyring" | "file";
183
+ type AuthConfig = {
184
+ storage?: AuthStorageMode;
185
+ };
186
+ type UpdateMode = "auto" | "notify" | "off";
187
+ /** Launcher-only self-update settings; read from the global config only. */
188
+ type UpdateConfig = {
189
+ mode?: UpdateMode;
190
+ /** npm dist-tag to follow; inferred from the running version when omitted. */
191
+ channel?: string;
192
+ };
193
+ declare const isValidUpdateChannel: (value: string) => boolean;
194
+ declare const parseUpdateMode: (value: unknown) => UpdateMode | undefined;
182
195
  type CodeliaConfig = {
183
196
  providers?: Record<string, ResponsesProviderConfig>;
184
197
  image_generation?: ImageGenerationConfig;
185
198
  version: number;
199
+ auth?: AuthConfig;
186
200
  model?: ModelConfig;
187
201
  subagent?: SubagentConfig;
188
202
  experimental?: ExperimentalConfig;
@@ -192,6 +206,7 @@ type CodeliaConfig = {
192
206
  execution_environment?: ExecutionEnvironmentConfig;
193
207
  search?: SearchConfig;
194
208
  tui?: TuiConfig;
209
+ update?: UpdateConfig;
195
210
  };
196
211
  type ConfigWriteScope = "global" | "project";
197
212
  type ConfigWriteGroup = Exclude<keyof CodeliaConfig, "version">;
@@ -201,6 +216,7 @@ declare const CONFIG_VERSION = 1;
201
216
  declare const normalizePermissionRule: (value: unknown) => PermissionRule | null;
202
217
  declare const parseConfig: (value: unknown, sourceLabel: string) => CodeliaConfig;
203
218
  type ConfigLayer = {
219
+ auth?: AuthConfig;
204
220
  providers?: Record<string, ResponsesProviderConfig>;
205
221
  image_generation?: ImageGenerationConfig;
206
222
  model?: ModelConfig;
@@ -212,6 +228,7 @@ type ConfigLayer = {
212
228
  execution_environment?: ExecutionEnvironmentConfig;
213
229
  search?: SearchConfig;
214
230
  tui?: TuiConfig;
231
+ update?: UpdateConfig;
215
232
  };
216
233
  declare class ConfigRegistry {
217
234
  private readonly defaults;
@@ -220,4 +237,4 @@ declare class ConfigRegistry {
220
237
  }
221
238
  declare const configRegistry: ConfigRegistry;
222
239
 
223
- export { BUILTIN_PROVIDER_NAMES, CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, GOOGLE_IMAGE_MODELS, type GoogleImageOptions, type ImageGenerationConfig, type ImageProviderOptions, type McpConfig, type McpServerConfig, type ModelConfig, OPENAI_CODEX_IMAGE_MODELS, OPENAI_IMAGE_MODELS, type OpenAiExperimentalConfig, type OpenAiImageOptions, type OpenRouterImageOptions, type PermissionRule, type PermissionsConfig, type ResponsesModelConfig, type ResponsesProviderConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiConfig, configRegistry, normalizePermissionRule, parseConfig, parseImageGenerationConfig, parseResponsesProviders };
240
+ export { type AuthConfig, type AuthStorageMode, BUILTIN_PROVIDER_NAMES, CONFIG_GROUP_DEFAULT_WRITE_SCOPE, CONFIG_VERSION, type CodeliaConfig, ConfigRegistry, type ConfigWriteGroup, type ConfigWriteScope, type ExecutionEnvironmentConfig, type ExecutionEnvironmentStartupChecksConfig, type ExecutionEnvironmentStartupChecksMode, type ExperimentalConfig, GOOGLE_IMAGE_MODELS, type GoogleImageOptions, type ImageGenerationConfig, type ImageProviderOptions, type McpConfig, type McpServerConfig, type ModelConfig, OPENAI_CODEX_IMAGE_MODELS, OPENAI_IMAGE_MODELS, type OpenAiExperimentalConfig, type OpenAiImageOptions, type OpenRouterImageOptions, type PermissionRule, type PermissionsConfig, type ResponsesModelConfig, type ResponsesProviderConfig, SUBAGENT_MAX_CONCURRENT_LIMIT, type SearchConfig, type SearchMode, type SkillsConfig, type SubagentConfig, type TuiConfig, type UpdateConfig, type UpdateMode, configRegistry, isValidUpdateChannel, normalizePermissionRule, parseConfig, parseImageGenerationConfig, parseResponsesProviders, parseUpdateMode };
package/dist/index.js CHANGED
@@ -275,7 +275,12 @@ var parseImageGenerationConfig = (value) => {
275
275
 
276
276
  // src/index.ts
277
277
  var SUBAGENT_MAX_CONCURRENT_LIMIT = 16;
278
+ var UPDATE_CHANNEL_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/i;
279
+ var RESERVED_UPDATE_CHANNEL_PREFIX = "codelia-staging-";
280
+ var isValidUpdateChannel = (value) => UPDATE_CHANNEL_PATTERN.test(value) && !value.toLowerCase().startsWith(RESERVED_UPDATE_CHANNEL_PREFIX);
281
+ var parseUpdateMode = (value) => value === "auto" || value === "notify" || value === "off" ? value : void 0;
278
282
  var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
283
+ auth: "global",
279
284
  model: "global",
280
285
  providers: "global",
281
286
  subagent: "global",
@@ -286,7 +291,8 @@ var CONFIG_GROUP_DEFAULT_WRITE_SCOPE = {
286
291
  execution_environment: "project",
287
292
  search: "project",
288
293
  image_generation: "global",
289
- tui: "global"
294
+ tui: "global",
295
+ update: "global"
290
296
  };
291
297
  var CONFIG_VERSION = 1;
292
298
  var MCP_SERVER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/;
@@ -607,6 +613,37 @@ var parseSubagentConfig = (value, source) => {
607
613
  profiles
608
614
  };
609
615
  };
616
+ var parseAuthConfig = (value, source) => {
617
+ if (!isRecord(value)) return void 0;
618
+ const storage = value.storage;
619
+ if (storage === void 0) return void 0;
620
+ if (storage === "auto" || storage === "keyring" || storage === "file") {
621
+ return { storage };
622
+ }
623
+ throw new Error(
624
+ `${source}: auth.storage must be "auto", "keyring", or "file"`
625
+ );
626
+ };
627
+ var parseUpdateConfig = (value, source) => {
628
+ if (!isRecord(value)) return void 0;
629
+ const result = {};
630
+ if (value.mode !== void 0) {
631
+ const mode = parseUpdateMode(value.mode);
632
+ if (!mode) {
633
+ throw new Error(
634
+ `${source}: update.mode must be "auto", "notify", or "off"`
635
+ );
636
+ }
637
+ result.mode = mode;
638
+ }
639
+ if (value.channel !== void 0) {
640
+ if (typeof value.channel !== "string" || !isValidUpdateChannel(value.channel)) {
641
+ throw new Error(`${source}: update.channel must be an npm dist-tag name`);
642
+ }
643
+ result.channel = value.channel;
644
+ }
645
+ return Object.keys(result).length > 0 ? result : void 0;
646
+ };
610
647
  var parseConfig = (value, sourceLabel) => {
611
648
  if (!isRecord(value)) {
612
649
  throw new Error(`${sourceLabel}: config must be an object`);
@@ -615,6 +652,8 @@ var parseConfig = (value, sourceLabel) => {
615
652
  if (version !== CONFIG_VERSION) {
616
653
  throw new Error(`${sourceLabel}: unsupported version ${String(version)}`);
617
654
  }
655
+ const auth = parseAuthConfig(value.auth, sourceLabel);
656
+ const update = parseUpdateConfig(value.update, sourceLabel);
618
657
  const model = parseModelConfig(value.model);
619
658
  const subagent = parseSubagentConfig(value.subagent, sourceLabel);
620
659
  const permissionsValue = value.permissions;
@@ -634,6 +673,7 @@ var parseConfig = (value, sourceLabel) => {
634
673
  ...pickString(value.tui.theme) ? { theme: pickString(value.tui.theme) } : {}
635
674
  } : void 0;
636
675
  const result = { version, model };
676
+ if (auth) result.auth = auth;
637
677
  if (value.providers !== void 0)
638
678
  result.providers = parseResponsesProviders(value.providers, sourceLabel);
639
679
  if (value.image_generation !== void 0)
@@ -662,6 +702,7 @@ var parseConfig = (value, sourceLabel) => {
662
702
  if (tui && Object.keys(tui).length > 0) {
663
703
  result.tui = tui;
664
704
  }
705
+ if (update) result.update = update;
665
706
  return result;
666
707
  };
667
708
  var ConfigRegistry = class {
@@ -672,6 +713,9 @@ var ConfigRegistry = class {
672
713
  resolve(layers) {
673
714
  const merged = { version: CONFIG_VERSION };
674
715
  for (const layer of [...this.defaults, ...layers]) {
716
+ if (layer?.auth) {
717
+ merged.auth = { ...merged.auth ?? {}, ...layer.auth };
718
+ }
675
719
  if (layer?.providers)
676
720
  merged.providers = { ...merged.providers, ...layer.providers };
677
721
  if (layer?.model) {
@@ -802,6 +846,9 @@ var ConfigRegistry = class {
802
846
  ...layer.tui
803
847
  };
804
848
  }
849
+ if (layer?.update) {
850
+ merged.update = { ...merged.update ?? {}, ...layer.update };
851
+ }
805
852
  }
806
853
  return merged;
807
854
  }
@@ -817,8 +864,10 @@ export {
817
864
  OPENAI_IMAGE_MODELS,
818
865
  SUBAGENT_MAX_CONCURRENT_LIMIT,
819
866
  configRegistry,
867
+ isValidUpdateChannel,
820
868
  normalizePermissionRule,
821
869
  parseConfig,
822
870
  parseImageGenerationConfig,
823
- parseResponsesProviders
871
+ parseResponsesProviders,
872
+ parseUpdateMode
824
873
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/config",
3
- "version": "0.1.86",
3
+ "version": "0.1.89",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [