omp-config-crypt 0.9.8 → 0.9.10
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 +5 -5
- package/bin/omp-sync.js +8 -6
- package/index.js +10 -5
- package/package.json +1 -1
- package/src/provider-store.js +1 -26
package/README.md
CHANGED
|
@@ -58,9 +58,9 @@ npx omp-config-crypt pull gist:<id> --pass "mysecret" --token "$GITHUB_TOKEN"
|
|
|
58
58
|
|
|
59
59
|
# Conflict resolution: when local files differ from remote with no baseline
|
|
60
60
|
# (initial-conflict-both-exist-different), default behavior aborts. Auto-resolve:
|
|
61
|
-
# --
|
|
62
|
-
# --
|
|
63
|
-
npx omp-config-crypt pull gist:<id> --pass "mysecret" --token "$GITHUB_TOKEN" --
|
|
61
|
+
# --mode remote overwrite local with remote (typical fresh-machine pull)
|
|
62
|
+
# --mode local keep local files and adopt them as the new baseline
|
|
63
|
+
npx omp-config-crypt pull gist:<id> --pass "mysecret" --token "$GITHUB_TOKEN" --mode remote
|
|
64
64
|
|
|
65
65
|
# Keep every modelRoles leaf local (preset and top-level). Other conflicts still abort.
|
|
66
66
|
npx omp-config-crypt pull gist:<id> --pass "mysecret" --token "$GITHUB_TOKEN" --local
|
|
@@ -98,8 +98,8 @@ Configuration exports include the installed `omp-config-crypt` source (excluding
|
|
|
98
98
|
/config-push gist:new
|
|
99
99
|
/config-push gist:<id>
|
|
100
100
|
/config-push https://…
|
|
101
|
-
/config-pull gist:<id> [--dry-run] [--force] [--local]
|
|
102
|
-
/config-pull https://… [--dry-run] [--force] [--local]
|
|
101
|
+
/config-pull gist:<id> [--dry-run] [--force] [--mode remote|local] [--local]
|
|
102
|
+
/config-pull https://… [--dry-run] [--force] [--mode remote|local] [--local]
|
|
103
103
|
/config-rollback
|
|
104
104
|
/config-upgrade [--check]
|
|
105
105
|
/config-doctor [gist:<id> | https://…]
|
package/bin/omp-sync.js
CHANGED
|
@@ -60,7 +60,7 @@ Commands:
|
|
|
60
60
|
pull <gist:id|url> Download and restore configs from Gist or HTTP URL
|
|
61
61
|
(-f/--force adopts a differing remote namespace; local
|
|
62
62
|
policy/state are backed up to .bak first)
|
|
63
|
-
(--
|
|
63
|
+
(--mode remote|local auto-resolves
|
|
64
64
|
conflicts by taking remote or local side; default:
|
|
65
65
|
report conflicts and abort)
|
|
66
66
|
(--local keeps modelRoles leaves local and still
|
|
@@ -93,7 +93,7 @@ Options:
|
|
|
93
93
|
--public Save as public (synced across machines via models.yml)
|
|
94
94
|
-y, --yes Non-interactive mode (use defaults without prompting)
|
|
95
95
|
-f, --force Force operations (pull: adopt differing remote namespace)
|
|
96
|
-
--
|
|
96
|
+
--mode <mode> Conflict resolution for pull: remote | local
|
|
97
97
|
--local Keep modelRoles leaves local; other conflicts still abort
|
|
98
98
|
--profile <name> Target specific profile scene (e.g. dev, ops)
|
|
99
99
|
|
|
@@ -165,10 +165,12 @@ function parseCliArgs(argv) {
|
|
|
165
165
|
options.nonInteractive = true;
|
|
166
166
|
} else if (a === "-f" || a === "--force") {
|
|
167
167
|
options.force = true;
|
|
168
|
-
} else if (a === "--strategy") {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
} else if (a === "--mode" || a === "--strategy") {
|
|
169
|
+
const v = args[++i];
|
|
170
|
+
options.strategy = v === "remote" ? "prefer-remote" : v === "local" ? "prefer-local" : v;
|
|
171
|
+
} else if (a.startsWith("--mode=") || a.startsWith("--strategy=")) {
|
|
172
|
+
const v = a.startsWith("--mode=") ? a.slice(7) : a.slice(11);
|
|
173
|
+
options.strategy = v === "remote" ? "prefer-remote" : v === "local" ? "prefer-local" : v;
|
|
172
174
|
} else if (a === "--local") {
|
|
173
175
|
options.keepLocal = true;
|
|
174
176
|
} else if (a === "--check") {
|
package/index.js
CHANGED
|
@@ -918,12 +918,17 @@ export function extractDryRun(str) {
|
|
|
918
918
|
keepLocal = true;
|
|
919
919
|
continue;
|
|
920
920
|
}
|
|
921
|
-
if (token === "--strategy") {
|
|
921
|
+
if (token === "--mode" || token === "--strategy") {
|
|
922
922
|
const value = tokens[++i];
|
|
923
923
|
if (value === undefined || value.startsWith("-")) {
|
|
924
|
-
throw new Error("--strategy requires a value:
|
|
924
|
+
throw new Error((token === "--mode" ? "--mode" : "--strategy") + " requires a value: remote | local");
|
|
925
925
|
}
|
|
926
|
-
strategy = value;
|
|
926
|
+
strategy = value === "remote" ? "prefer-remote" : value === "local" ? "prefer-local" : value;
|
|
927
|
+
continue;
|
|
928
|
+
}
|
|
929
|
+
if (token.startsWith("--mode=")) {
|
|
930
|
+
const value = token.slice(7);
|
|
931
|
+
strategy = value === "remote" ? "prefer-remote" : value === "local" ? "prefer-local" : value;
|
|
927
932
|
continue;
|
|
928
933
|
}
|
|
929
934
|
if (token.startsWith("--strategy=")) {
|
|
@@ -1175,7 +1180,7 @@ export default function (pi) {
|
|
|
1175
1180
|
handler: async (args, ctx) => {
|
|
1176
1181
|
const { dryRun, strategy, keepLocal, clean: src } = extractDryRun(args || "");
|
|
1177
1182
|
if (!src) {
|
|
1178
|
-
ctx.ui.notify("usage: /config-import <file.enc> [--dry-run] [--
|
|
1183
|
+
ctx.ui.notify("usage: /config-import <file.enc> [--dry-run] [--mode remote|local]", "error");
|
|
1179
1184
|
return;
|
|
1180
1185
|
}
|
|
1181
1186
|
try {
|
|
@@ -1234,7 +1239,7 @@ export default function (pi) {
|
|
|
1234
1239
|
}
|
|
1235
1240
|
const { dryRun, force, strategy, keepLocal, clean: spec } = extractDryRun(args || "");
|
|
1236
1241
|
if (!spec) {
|
|
1237
|
-
ctx.ui.notify("usage: /config-pull gist:<id> | https://… [--dry-run] [--force] [--
|
|
1242
|
+
ctx.ui.notify("usage: /config-pull gist:<id> | https://… [--dry-run] [--force] [--mode remote|local] [--local]", "error");
|
|
1238
1243
|
return;
|
|
1239
1244
|
}
|
|
1240
1245
|
try {
|
package/package.json
CHANGED
package/src/provider-store.js
CHANGED
|
@@ -151,32 +151,7 @@ export default async function (pi) {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// 异步在后台静默刷新 OpenRouter 权威模型规格并落盘缓存
|
|
154
|
-
|
|
155
|
-
try {
|
|
156
|
-
const controller = new AbortController();
|
|
157
|
-
const timer = setTimeout(() => controller.abort(), 6000);
|
|
158
|
-
const res = await fetch("https://openrouter.ai/api/v1/models", { signal: controller.signal });
|
|
159
|
-
clearTimeout(timer);
|
|
160
|
-
if (!res.ok) return;
|
|
161
|
-
const json = await res.json();
|
|
162
|
-
const updatedSpecs = {};
|
|
163
|
-
for (const m of json.data || []) {
|
|
164
|
-
if (!m.id) continue;
|
|
165
|
-
const shortName = m.id.split("/").pop().toLowerCase();
|
|
166
|
-
const spec = {
|
|
167
|
-
contextWindow: m.context_length || DEFAULT_CONTEXT_WINDOW,
|
|
168
|
-
maxTokens: m.top_provider?.max_completion_tokens || DEFAULT_MAX_TOKENS,
|
|
169
|
-
hasImage: m.architecture?.modality?.includes("image") || false
|
|
170
|
-
};
|
|
171
|
-
updatedSpecs[shortName] = spec;
|
|
172
|
-
updatedSpecs[m.id.toLowerCase()] = spec;
|
|
173
|
-
}
|
|
174
|
-
if (!fs.existsSync(cacheDir)) {
|
|
175
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
176
|
-
}
|
|
177
|
-
fs.writeFileSync(cachePath, JSON.stringify(updatedSpecs, null, 2), "utf8");
|
|
178
|
-
} catch {}
|
|
179
|
-
})();
|
|
154
|
+
// 已移除:OpenRouter 规格改为添加 provider 时一次性查询并写死,启动不再联网刷新。
|
|
180
155
|
|
|
181
156
|
// 注册 /models-optimize 治理命令
|
|
182
157
|
pi.registerCommand("models-optimize", {
|