@trim21/personal-pi-extensions 0.0.408 → 0.0.409

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
@@ -386,7 +386,7 @@ read/edit/write 工具内置 LSP 诊断(写文件后等待并报告 ERROR 级
386
386
 
387
387
  内置默认服务器(typescript / pyright / ruff / clangd)始终存在;`servers` 以 key 为服务器 id 与默认合并——同 key 整体覆盖(整个配置替换默认)、新 key 新增、`"enabled": false` 移除(如 `"clangd": { "enabled": false }`)。executable 的发现逻辑(如 tsserver 路径、venv 里的 python)不内置,需要时用 `bin` / `args` / `settings` 自行表达。
388
388
 
389
- 旧的 `enabled`(白名单)/ `disabled`(排除)与全局超时字段(`initializeTimeoutMs` 等)继续可用。
389
+ 旧的 `enabled`(白名单)/ `disabled`(排除)与全局超时字段(`initializeTimeoutMs` 等)继续可用。`enabled` 里的 id 必须是已注册服务器,否则视为配置错误;`disabled` 里未注册的 id 直接忽略。
390
390
 
391
391
  ---
392
392
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trim21/personal-pi-extensions",
3
- "version": "0.0.408",
3
+ "version": "0.0.409",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
@@ -7,9 +7,10 @@
7
7
  * (本地覆盖全局):`servers` 按 id 合并(同名 id 整体覆盖、新增 id,全局
8
8
  * 其余服务器保留),`enabled`/`disabled` 白名单与各超时参数继续生效;
9
9
  * 没有内置默认服务器,所有服务器均须在配置里定义;
10
- * 配置在每个工具的调用 cwd 下惰性读取;enabled/disabled 引用不存在的
11
- * 服务器 id 是配置错误:全局配置在扩展加载(createLspService)时抛错,
12
- * 本地配置在 session 开始预加载时通知,工具调用时校验抛错兜底;
10
+ * 配置在每个工具的调用 cwd 下惰性读取;enabled 引用不存在的服务器 id
11
+ * 是配置错误:全局配置在扩展加载(createLspService)时抛错,本地配置在
12
+ * session 开始预加载时通知,工具调用时校验抛错兜底。disabled 中未注册
13
+ * 的 id 直接忽略;
13
14
  * - client 按 (root, serverID) 缓存,并发 spawn 去重,启动失败记入 broken
14
15
  * 集合(服务实例生命周期内不再重试);
15
16
  * - 工具只与 touchFile / diagnostics / lspDiagnosticsForFile 三个方法打交道;通知回调按请求传入。
@@ -114,20 +115,19 @@ function readConfigFileSync(filePath: string): LspConfig {
114
115
  }
115
116
 
116
117
  /**
117
- * enabled/disabled 引用的 id 必须存在于实际生效的服务器集合(注入的 adapters
118
- * 或默认 + 配置 servers),否则抛配置错误(避免静默失效)。
118
+ * enabled 引用的 id 必须存在于实际生效的服务器集合(注入的 adapters 或配置
119
+ * servers),否则抛配置错误(避免白名单静默失效)。disabled 中未注册的 id
120
+ * 直接忽略。
119
121
  */
120
122
  function validateConfig(config: LspConfig, adapters?: LspServerAdapter[]): void {
121
123
  const available = new Set(
122
124
  adapters ? adapters.map((adapter) => adapter.id) : Object.keys(config.servers ?? {}),
123
125
  );
124
- const unknown = [...(config.enabled ?? []), ...(config.disabled ?? [])].filter(
125
- (id) => !available.has(id),
126
- );
126
+ const unknown = (config.enabled ?? []).filter((id) => !available.has(id));
127
127
  if (unknown.length > 0) {
128
128
  const list = [...available].toSorted().join(", ") || "none";
129
129
  throw new Error(
130
- `lsp.json: unknown server id in enabled/disabled: ${unknown.join(", ")} (available: ${list})`,
130
+ `lsp.json: unknown server id in enabled: ${unknown.join(", ")} (available: ${list})`,
131
131
  );
132
132
  }
133
133
  }
@@ -155,8 +155,8 @@ export async function loadLspConfig(
155
155
  }
156
156
 
157
157
  /**
158
- * 按配置过滤 adapter 列表。enabled/disabled 引用了实际生效集合中不存在的
159
- * 服务器 id 时抛错(配置错误,避免静默失效)。
158
+ * 按配置过滤 adapter 列表。enabled 引用了实际生效集合中不存在的服务器 id
159
+ * 时抛错(配置错误,避免白名单静默失效);disabled 中未注册的 id 忽略。
160
160
  */
161
161
  export function filterAdapters(
162
162
  adapters: LspServerAdapter[],