@chatcode/cco-llm-chatcode-config 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- This plugin publishes user-defined, CodingPlan, and optional MAAS model catalogs, provides shared ChatCode account access, and reports committed ChatCode CLI Session activity to ChatCode. User-defined models live in the `llm-chatcode-config` settings section and appear in the conversation model selector. Runtime model credentials stay in the Host process, while the account grant stays in ChatCode CLI credential storage and never reaches Web or TUI clients. Reporting is enabled by default and can be disabled with `reporting.enabled: false`.
12
+ This plugin publishes user-defined, CodingPlan, and optional MAAS model catalogs in the selector order **Built-in models → Yuanjing → Custom models**, provides shared ChatCode account access, and reports committed ChatCode CLI Session activity to ChatCode. User-defined models live in the `llm-chatcode-config` settings section and appear in the conversation model selector. Runtime model credentials stay in the Host process, while the account grant stays in ChatCode CLI credential storage and never reaches Web or TUI clients. Reporting is enabled by default and can be disabled with `reporting.enabled: false`.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -64,7 +64,7 @@ The `llm-chatcode-config` section in `$CHATCODE_CLI_HOME/settings.yaml` is the r
64
64
 
65
65
  MAAS has a different response shape from CodingPlan: the catalog returns model IDs, and the plugin resolves each ID through its private runtime endpoint. `codingPlanEndpoint` and `catalogTimeoutMs` override the CodingPlan address and catalog timeout.
66
66
 
67
- The package also ships a browser client bundle. Its **Model configuration** card contains only the MAAS switch; it does not edit the `customModels` array or display CodingPlan and MAAS rows. Edit imported user-defined models in `$CHATCODE_CLI_HOME/settings.yaml`; valid file updates refresh the **自定义模型** conversation-selector group without restarting the Host.
67
+ The package also ships a browser client bundle. Its **Model configuration** card contains only the MAAS switch; it does not edit the `customModels` array or display CodingPlan and MAAS rows. The browser decodes only `enableMaas` from the redacted settings view and never needs custom-model API keys. Edit imported user-defined models in `$CHATCODE_CLI_HOME/settings.yaml`; valid file updates refresh the **自定义模型** conversation-selector group without restarting the Host.
68
68
 
69
69
  -----
70
70
 
package/README.zh.md CHANGED
@@ -12,7 +12,7 @@ kind: "package-bundle"
12
12
 
13
13
  此插件发布用户自定义模型、CodingPlan 与可选 MAAS 模型目录,提供共用 ChatCode 账号访问,并向 ChatCode 上报已提交的 ChatCode CLI Session 活动。用户自定义模型保存在 `llm-chatcode-config` 设置段,并出现在会话模型选择器中。运行时模型凭据只保存在 Host 进程中,账号 grant 保存在 ChatCode CLI 凭据存储中且不会进入 Web 或 TUI 客户端。上报默认开启,可通过 `reporting.enabled: false` 关闭。
14
14
 
15
- 启动时还会读取 Coding Plan 运行时模型接口,并在会话模型选择器中发布三个独立分组:`自定义模型`、`内置模型` 和(启用后)`Maas平台`。接口返回的 API Key 只保存在进程内的请求鉴权对象中;模型列表、日志和错误信息不会包含该值。
15
+ 启动时还会读取 Coding Plan 运行时模型接口,并在会话模型选择器中按 `内置模型`、(启用后)`元景`、`自定义模型` 的顺序发布三个独立分组。接口返回的 API Key 只保存在进程内的请求鉴权对象中;模型列表、日志和错误信息不会包含该值。
16
16
 
17
17
 
18
18
  ## 目录
@@ -73,7 +73,7 @@ MAAS 默认关闭。开启后,插件先读取 `https://chatcode.chinaunicom.cn
73
73
 
74
74
  MAAS 目录接口与 Coding Plan 接口的返回结构不同:目录接口返回模型 ID,插件会再按 ID 获取私有运行配置。可用 `codingPlanEndpoint` 和 `catalogTimeoutMs` 覆盖 Coding Plan 地址和读取超时。
75
75
 
76
- 本包同时发布浏览器 client bundle,在原生“模型”设置页增加“模型配置”卡片,仅保留 MAAS 开关,不展示 CodingPlan 或 MAAS 模型列表。MAAS 开关会持久化到插件 settings 命名空间,并刷新会话模型选择器中的对应分组。自定义模型的增删改查保留在原生模型页;CodingPlan 和 MAAS 模型列表仅在会话模型选择器中展示。
76
+ 本包同时发布浏览器 client bundle,在原生“模型”设置页增加“模型配置”卡片,仅保留 MAAS 开关,不展示 CodingPlan 或 MAAS 模型列表。浏览器只从脱敏设置视图中解析 `enableMaas`,无需获取自定义模型的 API key。MAAS 开关会持久化到插件 settings 命名空间,并刷新会话模型选择器中的对应分组。自定义模型的增删改查保留在原生模型页;CodingPlan 和 MAAS 模型列表仅在会话模型选择器中展示。
77
77
 
78
78
  -----
79
79
 
package/lib/client.js CHANGED
@@ -357,6 +357,20 @@ window.__ModuleLoader__.load({
357
357
  background: var(--dsw-alias-fill-secondary);
358
358
  }
359
359
  `;
360
+ //#endregion
361
+ //#region src/client/settings.ts
362
+ /**
363
+ * Decode only the non-secret field rendered by the browser card. The Host
364
+ * redacts custom-model API keys, so validating the complete Config schema in
365
+ * the browser would reject otherwise valid custom-model rows.
366
+ * @param section - redacted namespace value received from the Host.
367
+ * @returns the MAAS projection, or undefined when its field is invalid.
368
+ */
369
+ function decodeMaasSettings(section) {
370
+ if (typeof section !== "object" || section === null || Array.isArray(section)) return void 0;
371
+ const enableMaas = Reflect.get(section, "enableMaas");
372
+ return typeof enableMaas === "boolean" ? { enableMaas } : void 0;
373
+ }
360
374
  //#endregion
361
375
  //#region src/client/index.ts
362
376
  /** Browser extension rendering the MAAS availability switch in the native Models page. */
@@ -366,7 +380,7 @@ window.__ModuleLoader__.load({
366
380
  const en = {
367
381
  title: "Model configuration",
368
382
  description: "Custom models are managed by the native Models page. CodingPlan and MAAS models remain available in the conversation model selector.",
369
- maas: "MAAS platform",
383
+ maas: "Yuanjing",
370
384
  maasDescription: "Enable MAAS models for the conversation model selector.",
371
385
  maasToggle: "Enable MAAS models",
372
386
  maasUpdating: "Updating MAAS setting…",
@@ -375,7 +389,7 @@ window.__ModuleLoader__.load({
375
389
  const zh = {
376
390
  title: "模型配置",
377
391
  description: "自定义模型由原生模型页面管理;CodingPlan 与 MAAS 模型继续在对话模型选择中提供。",
378
- maas: "Maas平台",
392
+ maas: "元景",
379
393
  maasDescription: "开启后,MAAS 模型会出现在对话模型选择中。",
380
394
  maasToggle: "启用 MAAS 模型",
381
395
  maasUpdating: "正在更新 MAAS 设置…",
@@ -430,7 +444,10 @@ window.__ModuleLoader__.load({
430
444
  zh,
431
445
  en
432
446
  }), "chatcode-models: dictionaries");
433
- const scope = ctx.settingsScope.bind({ namespace: SETTINGS_NAMESPACE });
447
+ const scope = ctx.settingsScope.bind({
448
+ namespace: SETTINGS_NAMESPACE,
449
+ decode: decodeMaasSettings
450
+ });
434
451
  ctx.effect(() => {
435
452
  let previous = "";
436
453
  const report = () => {
package/lib/index.js CHANGED
@@ -2394,7 +2394,7 @@ const CODING_PLAN_PROVIDER = "chatcode-codingplan";
2394
2394
  const CODING_PLAN_PROVIDER_NAME = "内置模型";
2395
2395
  /** Provider route and selector group for opt-in MAAS models. */
2396
2396
  const MAAS_PROVIDER = "chatcode-maas";
2397
- const MAAS_PROVIDER_NAME = "Maas平台";
2397
+ const MAAS_PROVIDER_NAME = "元景";
2398
2398
  const DEEPSEEK_MODEL = /deepseek/i;
2399
2399
  function privateModelKey(route, model) {
2400
2400
  return `${route}\u0000${model}`;
@@ -4785,6 +4785,10 @@ async function apply(ctx, config) {
4785
4785
  throw error;
4786
4786
  }
4787
4787
  }));
4788
+ if (customRegistration !== void 0) {
4789
+ customRegistration();
4790
+ customRegistration = void 0;
4791
+ }
4788
4792
  for (const entry of loaded) {
4789
4793
  if (entry === void 0) continue;
4790
4794
  const registration = register(entry.catalog.provider, entry.catalog.name, entry.source);
@@ -4793,6 +4797,7 @@ async function apply(ctx, config) {
4793
4797
  managedSources.set(entry.catalog.provider, entry.source);
4794
4798
  }
4795
4799
  }
4800
+ refreshCustom();
4796
4801
  };
4797
4802
  const refreshManaged = () => {
4798
4803
  if (refreshInFlight !== void 0) return refreshInFlight;
@@ -4864,7 +4869,6 @@ async function apply(ctx, config) {
4864
4869
  ctx.logger.warn("chatcode-config: legacy settingsPath is unavailable or invalid; custom models were not imported and import will retry when the Host starts again");
4865
4870
  }
4866
4871
  });
4867
- refreshCustom();
4868
4872
  await refreshManaged();
4869
4873
  }
4870
4874
  //#endregion