@coda-console/plugin-check 0.4.8 → 0.4.9

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
@@ -97,7 +97,11 @@ Claude、Codex 与 OpenCode 各有一项设置「模型服务」(`claude.model
97
97
  勾了别的接口的服务(旧设置留下的),入口只在标准错误记一行,不列它的模型。
98
98
  - **Claude / Codex 模型**:会话打开时从每个服务的「地址/models」列出模型(各服务同时问),问法同 Coda 的「检查可用模型」(Claude 带 `x-api-key`,Codex 带 `Authorization: Bearer`),
99
99
  按勾选的先后排在 Agent 自己的模型后面:ID 是 `<服务>/<模型>`(如 `magpie/anthropic/deepseek/deepseek-v4-pro`),名字只是模型(如 `deepseek/deepseek-v4-pro`),
100
- 在服务那一组里,没有推理强度可选。哪个服务列不出来就没有它那一组,其他的照旧。Codex 的分组在 codex-acp 生成模型配置项的地方打补丁做。
100
+ 在服务那一组里,没有推理强度可选。Codex 的分组在 codex-acp 生成模型配置项的地方打补丁做。
101
+ - **列不出来时**(三个插件一样):每个服务列出的模型记在插件状态目录(`CODA_PLUGIN_STATE`)的 `service-models/` 下(文件名是服务名,`/` 换成 `.`),
102
+ 有变化才重写;某次问不到(那台机器在重启、网络暂时不通、超时)就沿用上次列出的,在标准错误记一行,那一组照常出现,
103
+ 选它的模型时请求照常失败。从没列出过、或后端没有状态目录的,这次就没有它那一组,其他的照旧。
104
+ 这样 Coda 的模型目录(读到后保留一小时)不会因为一次没问到就整整一小时缺这一组。
101
105
  - **Claude / Codex 何时换**:选模型只是记下(Coda 读模型目录时会把每个模型都选一遍,不该因此启动什么);下一轮开始前,所选模型的服务与会话正在用的不同(换到另一个服务、或回到自己的),才把会话换过去。
102
106
  - **Claude**:以 `resume` 新起一个 SDK 会话(还没说过话的会话用同一个会话 ID 新起),flag settings 的 `env` 设 `ANTHROPIC_BASE_URL`、
103
107
  `ANTHROPIC_AUTH_TOKEN`(服务的 Key,没有 Key 写 `none`)与 `ANTHROPIC_MODEL`、`ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU}_MODEL`、
@@ -118,7 +122,7 @@ Claude、Codex 与 OpenCode 各有一项设置「模型服务」(`claude.model
118
122
  切模型不用重启;服务的标题作为 Provider 名。入口把 OpenCode 报给 Coda 的模型配置项按 Provider 分组(OpenCode 写作「Provider ID/模型名」,
119
123
  组内去掉前缀):服务的组名是它完整的标题,OpenCode 自己的 Provider 各成一组,组名是 Provider ID(OpenCode 只报这个);模型 ID 不变。Chat 用 `@ai-sdk/openai-compatible`,Responses 用 `@ai-sdk/openai`,Anthropic 用 `@ai-sdk/anthropic`,
120
124
  都是 OpenCode 自带的 SDK。Anthropic 请求模型列表用服务给的地址,生成请求的地址若未以 `/v1` 结尾则补上。
121
- Key 只用服务的;无 Key 时显式传 `none`,避免 SDK 回退到机器自己的环境变量凭据。哪个服务列不出模型、接口不支持或 Key 文件读不到,就不添加那一个,其他的与原来的模型照旧。
125
+ Key 只用服务的;无 Key 时显式传 `none`,避免 SDK 回退到机器自己的环境变量凭据。接口不支持或 Key 文件读不到,就不添加那一个;列不出模型时同上沿用上次列出的,从没列出过的才不添加。其他的与原来的模型照旧。
122
126
  已有的 inline 配置支持 JSONC(注释、尾逗号),合并时保留用户自己的变量与字符串转义;服务生成片段中的 `{` 在 JSON 字符串内编码成 `\u007b`,
123
127
  防止模型 ID、标题等服务数据触发 OpenCode 的 `{env:…}` / `{file:…}` 展开。真正无效的配置仍明确报错。机器与项目的 Provider 启停限制也仍然有效。
124
128
  用户未加引号的布尔值、数字等变量节点在解析时暂用等长占位节点,合并后原样还原,由 OpenCode 自己展开;合并器不读取它们引用的环境变量或文件。
@@ -310,7 +314,8 @@ gh workflow run publish.yml --repo coda-console/coda-plugins --ref main
310
314
  ## 契约检查
311
315
 
312
316
  扮演 Coda 去读一个插件目录:清单照 Coda 的规则读,Agent 照 Coda 的样子启动、说 Coda 说的话,面板照 Coda 的样子读一次。
313
- **权威校验仍是 Coda 的「读取来源」**(「从仓库添加…」里的读取):检查包的规则抄自 Coda,抄的是哪个提交写在 `check/coda.mjs`,两边不一致时以 Coda 为准。
317
+ **权威校验仍是 Coda 的「读取来源」**(「从仓库添加…」里的读取):检查包的规则抄自 Coda,抄的是哪个提交写在 `check/coda.mjs`,两边不一致时以 Coda 为准;
318
+ `contributes` 里检查不认识的键(写错的,或 Coda 新加、这里还没抄过来的)只提醒,不判失败。
314
319
 
315
320
  ```sh
316
321
  npm ci
package/check/coda.mjs CHANGED
@@ -111,7 +111,7 @@ export const CAPABILITY = /^[a-z][a-z0-9-]{0,63}$/;
111
111
  export const CONTRIBUTES = ['configuration', 'capabilities', 'instructions', 'agents', 'extensionPoints', 'extensions', 'groups', 'events', 'commands', 'gitCredentials',
112
112
  'repositories', 'services', 'setup', 'skills', 'environment', 'path', 'endpoints', 'mcpServers', 'views', 'modelProviders', 'executors'];
113
113
  // The keys of `contributes` points of the plugins Coda ships take (Coda's docs/plugins.md「写在 contributes 里的扩展点」): the
114
- // resources plugin's `panels`. Anything else is refused.
114
+ // resources plugin's `panels`. Anything else is said, not refused: Coda may have added it since this copy.
115
115
  export const POINT_KEYS = ['panels'];
116
116
  // What only a plugin Coda ships may contribute, one installed from a repository or npm being refused it
117
117
  // (backend/src/components/plugins/plugin-source-rules.mjs catalogProblem): the clients do not show these in the confirmation yet.
@@ -290,8 +290,9 @@ export function checkManifest(dir, say) {
290
290
  const contributes = part('manifest.contributes', () => {
291
291
  check(manifest.contributes && typeof manifest.contributes === 'object' && !Array.isArray(manifest.contributes),
292
292
  'contributes 须为对象(Coda 只把带 contributes 的目录当插件)');
293
+ // A kind this copy does not know may be one Coda added since: said, for Coda's reading of the source to decide.
293
294
  const unknown = Object.keys(manifest.contributes).filter(k => !CONTRIBUTES.includes(k) && !POINT_KEYS.includes(k));
294
- check(!unknown.length, `contributes 里有 Coda 不支持的贡献:${unknown.join('、')}`);
295
+ if (unknown.length) say.warn('manifest.contributes-unknown', `contributes 里有检查不认识的贡献:${unknown.join('、')}:可能是写错,或是 Coda 新加的;以 Coda「从仓库添加…」的读取为准`);
295
296
  // What is checked here is installed from a repository or npm, never as a copy Coda ships.
296
297
  for (const [key, refusal] of Object.entries(BUILTIN_ONLY)) check(manifest.contributes[key] === undefined, `contributes.${key}:${refusal}`);
297
298
  return manifest.contributes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coda-console/plugin-check",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Coda 插件的契约检查:扮演 Coda 读清单、启动 Agent 讲 ACP 与 _coda/wait、读面板。",
5
5
  "license": "MIT",
6
6
  "repository": {