omp-config-crypt 0.9.3 → 0.9.4

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
@@ -123,6 +123,11 @@ checked subset, Esc returns to source actions. Other/manual IDs also require gen
123
123
  Progress and model rows show full short-generation latency in milliseconds, including the final
124
124
  stream event. Esc during discovery or testing cancels acquisition. A supported native askDialog
125
125
  host is required. The local registry is read without refreshing it or accessing other credentials.
126
+ Managing an existing provider no longer re-tests configured models by default: the edit "模型"
127
+ entry first offers "保留已配置模型", which keeps every configured model checked and verified
128
+ without generation requests. "重新选择并测试模型" reopens the full acquisition flow, where
129
+ configured models are marked "已配置(默认保留)", skip candidate testing, and only new
130
+ candidates require generation checks.
126
131
  Manage existing providers to view details, edit a draft, verify a selected model, or confirm deletion.
127
132
  Role-bound providers must be rebound through `/role` before deletion (both in interactive UI and non-UI
128
133
  slash command `/provider rm <name>`, preventing dangling role references in `config.yml`; `omp-sync provider rm`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omp-config-crypt",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "Universal cross-platform encrypted portability for omp config, extensions, and instructions",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -71,7 +71,8 @@ async function verifyDraft(ctx, draft) {
71
71
  }
72
72
  const checkIdentity = config => JSON.stringify([config.api, config.baseUrl, config.apiKey || ""]);
73
73
  async function acquireDraftModels(ctx, draft, agentDir, seedIds = draft.config.models.map(model => model.id)) {
74
- const acquired = await acquireProviderModels(ctx, { name: draft.name, config: draft.config, agentDir, seedIds });
74
+ const acquired = await acquireProviderModels(ctx, { name: draft.name, config: draft.config, agentDir, seedIds,
75
+ preservedIds: draft.config.models.map(model => model.id) });
75
76
  if (!acquired) return false;
76
77
  draft.config.models = acquired.models;
77
78
  draft.config.baseUrl = acquired.baseUrl;
@@ -173,7 +174,18 @@ async function editDraft(ctx, name, agentDir, supplied) {
173
174
  } else if (field === "存储范围") {
174
175
  const scope = await chooseScope(ctx);
175
176
  if (scope !== undefined) draft.isPrivate = scope;
176
- } else if (field === "模型") await acquireDraftModels(ctx, draft, agentDir);
177
+ } else if (field === "模型") {
178
+ if (!draft.config.models.length) { await acquireDraftModels(ctx, draft, agentDir); continue; }
179
+ const operation = await select(ctx, `MODELS // ${name} · ${draft.config.models.length} 个已配置模型`,
180
+ ["保留已配置模型", "重新选择并测试模型", "返回"]);
181
+ if (operation === "保留已配置模型") {
182
+ // Default for edit: keep every configured model verified without re-testing.
183
+ draft.checks = new Map(draft.config.models.map(model => [model.id, { ok: true }]));
184
+ draft.checkIdentity = checkIdentity(draft.config);
185
+ draft.requireVerifiedModels = true;
186
+ ctx.ui.notify("已保留全部已配置模型,未重新测试", "info");
187
+ } else if (operation === "重新选择并测试模型") await acquireDraftModels(ctx, draft, agentDir);
188
+ }
177
189
  else if (field === "保存" && await saveSummary(ctx, draft, agentDir, false)) return;
178
190
  }
179
191
  }
@@ -116,12 +116,18 @@ async function showFailures(ctx, cache) {
116
116
  }
117
117
 
118
118
  /** Acquire a verified subset without mutating config, the registry, or either store. */
119
- export async function acquireProviderModels(ctx, { name, config, agentDir, seedIds = [] }) {
119
+ export async function acquireProviderModels(ctx, { name, config, agentDir, seedIds = [], preservedIds = [] }) {
120
120
  if (typeof ctx.ui.askDialog !== "function") {
121
121
  ctx.ui.notify("当前宿主不支持空格多选,请升级 OMP", "error");
122
122
  return;
123
123
  }
124
124
  const working = { ...config }, existing = new Map((config.models || []).map(model => [model.id, model]));
125
+ const cache = new Map(), sources = new Map();
126
+ // Already-configured models keep verified status without any generation test (edit flow).
127
+ for (const id of unique(preservedIds)) {
128
+ if (!cache.has(id)) cache.set(id, { ok: true, latencyMs: null, preserved: true });
129
+ if (!sources.has(id)) sources.set(id, "已配置");
130
+ }
125
131
  if (working.api === "anthropic-messages") working.baseUrl = working.baseUrl.trim().replace(/\/+$/, "").replace(/\/v1$/i, "");
126
132
  let configuredProviders;
127
133
  try { configuredProviders = listProviders({ agentDir }); }
@@ -132,7 +138,7 @@ export async function acquireProviderModels(ctx, { name, config, agentDir, seedI
132
138
  catalog = ctx.modelRegistry.getAll("chat");
133
139
  if (!Array.isArray(catalog)) throw new Error("Invalid registry");
134
140
  } catch { catalog = []; ctx.ui.notify("本机模型目录不可用", "warning"); }
135
- const cache = new Map(), sources = new Map(), stageIds = [[], [], [], []];
141
+ const stageIds = [[], [], [], []];
136
142
  let stage = 0, mode = "stage", retry = false;
137
143
  const available = () => [...sources.keys()].filter(id => cache.get(id)?.ok);
138
144
  const check = async (ids, source) => {
@@ -186,8 +192,11 @@ export async function acquireProviderModels(ctx, { name, config, agentDir, seedI
186
192
  const labels = new Map(available().map(id => [id, id]));
187
193
  const result = await ctx.ui.askDialog([{
188
194
  id: "provider-models", header: "MODELS", question: "选择已验证模型 · 空格勾选 · Enter 确认 · Esc 返回", multi: true,
189
- options: [...labels.keys()].map(id => ({ label: id,
190
- description: `可用 · ${cache.get(id).latencyMs} ms · 来源: ${sources.get(id)}` })),
195
+ options: [...labels.keys()].map(id => {
196
+ const entry = cache.get(id);
197
+ return { label: id,
198
+ description: entry.preserved ? "已配置(默认保留)" : `可用 · ${entry.latencyMs} ms · 来源: ${sources.get(id)}` };
199
+ }),
191
200
  }]);
192
201
  if (!result || result.kind !== "submit") { mode = "menu"; continue; }
193
202
  const answer = result.results?.find(item => item.id === "provider-models");