omp-config-crypt 0.6.3 → 0.6.5
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 +66 -1
- package/bin/omp-sync.js +145 -43
- package/index.js +707 -507
- package/package.json +4 -1
- package/src/maintenance.js +31 -3
- package/src/prober.js +199 -166
- package/src/provider-menu.js +308 -0
- package/src/provider-models.js +223 -0
- package/src/provider-store.js +273 -43
- package/src/rehydrator.js +1 -1
- package/src/sync-files.js +621 -0
- package/src/sync-plan.js +1062 -0
- package/src/sync-policy.js +322 -0
- package/src/sync-resources.js +744 -0
- package/src/sync-transaction.js +522 -0
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Supports both **in-OMP slash commands** and an **independent standalone CLI (`om
|
|
|
17
17
|
3. **Comprehensive Asset Synchronization**:
|
|
18
18
|
- **Core Configs**: `config.yml`, `models.yml`, `mcp.json`, `AGENTS.md`, `STYLE.md`, `RULES.md`.
|
|
19
19
|
- **Credentials & Tokens**: Automatic discovery and encryption of `opc-mcp-token` and `*.token` files.
|
|
20
|
-
- **User Extensions**:
|
|
20
|
+
- **User Extensions**: Native `~/.omp/agent/extensions/**` plus supported legacy extension assets.
|
|
21
21
|
- **Skills & Knowledge**: Recursive sync of `managed-skills/**` and `memories/**`.
|
|
22
22
|
- **Plugins Manifest**: Syncs `plugins/omp-plugins.lock.json` for deterministic plugin tracking.
|
|
23
23
|
- **Strict Blacklist**: Automatically excludes SQLite runtime databases (`*.db`, `*.db-wal`, `*.db-shm`), session logs, and cache folders.
|
|
@@ -67,6 +67,10 @@ npx omp-config-crypt role set smol my-provider/gpt-4o-mini
|
|
|
67
67
|
|
|
68
68
|
Inside any `omp` session:
|
|
69
69
|
|
|
70
|
+
Tab completion preserves existing arguments for `/provider edit|test|rm|remove`, provider options, and `/role <role> <provider/model>`; selecting a provider after `/provider edit ` inserts its name without replacing `edit`.
|
|
71
|
+
|
|
72
|
+
Configuration exports include the installed `omp-config-crypt` source (excluding nested dependencies), preserving local provider/role fixes and sync-engine changes on restore. Native extensions and global tools are included as well. Restart OMP after restoring; a later npm/plugin upgrade can overwrite local plugin changes.
|
|
73
|
+
|
|
70
74
|
```text
|
|
71
75
|
/config-export [out.enc]
|
|
72
76
|
/config-import <file.enc> [--dry-run]
|
|
@@ -78,6 +82,57 @@ Inside any `omp` session:
|
|
|
78
82
|
/config-rollback
|
|
79
83
|
```
|
|
80
84
|
|
|
85
|
+
### Provider control menu
|
|
86
|
+
|
|
87
|
+
Run `/provider` in an interactive OMP session for the native keyboard menu (↑↓ / Enter / Esc).
|
|
88
|
+
Add selects OpenAI (`openai-completions` or `openai-responses`) or Anthropic (`anthropic-messages`),
|
|
89
|
+
then URL, masked Key and PRIVATE/PUBLIC scope. Models come from the endpoint catalog, local
|
|
90
|
+
registry/configuration hints, a fixed popular-candidate list, then manual IDs. Recommendations
|
|
91
|
+
are offline hints, not availability claims or a live ranking. Each stage tests every unique
|
|
92
|
+
candidate with the selected URL, Key and protocol before showing selectable models (two requests
|
|
93
|
+
at most concurrently, ten seconds per request, no automatic retries; requests may incur charges).
|
|
94
|
+
Only successful models appear in the native multi-select: Space toggles, Enter confirms the
|
|
95
|
+
checked subset, Esc returns to source actions. Other/manual IDs also require generation checks.
|
|
96
|
+
Progress and model rows show full short-generation latency in milliseconds, including the final
|
|
97
|
+
stream event. Esc during discovery or testing cancels acquisition. A supported native askDialog
|
|
98
|
+
host is required. The local registry is read without refreshing it or accessing other credentials.
|
|
99
|
+
Manage existing providers to view details, edit a draft, verify a selected model, or confirm deletion.
|
|
100
|
+
Role-bound providers must be rebound through `/role` before deletion (both in interactive UI and non-UI
|
|
101
|
+
slash command `/provider rm <name>`, preventing dangling role references in `config.yml`; `omp-sync provider rm`
|
|
102
|
+
requires `--force` if role-bound). Unbound providers remain fully compatible with headless script deletion.
|
|
103
|
+
|
|
104
|
+
`/provider ls|list` remains a text list. `/provider add|wizard`, `/provider edit <name>`,
|
|
105
|
+
`/provider test <name>`, and `/provider rm|remove <name>` open the relevant interactive flow.
|
|
106
|
+
Without UI, use `/provider add <name> <url> [key] [--api <type>] [--model <id>] [--private|--public]`.
|
|
107
|
+
Protocol defaults to `openai-completions`; flags never become the Key. Edit and test require UI.
|
|
108
|
+
|
|
109
|
+
Discovery alone does **not** verify generation. Interactive add and edit model acquisition are unified:
|
|
110
|
+
both require candidate verification via real short generations with clear billing/cost notice before multi-select.
|
|
111
|
+
Existing model custom parameters (e.g., `contextWindow`, `maxTokens`, `compat`, `reasoning`) are preserved when
|
|
112
|
+
re-selected. Cancelling acquisition performs zero writes to the draft. If protocol, Base URL, or Key is modified
|
|
113
|
+
in the draft, cached model checks are invalidated immediately, preventing unverified saves.
|
|
114
|
+
`filterChatModels` excludes non-chat image/video generation models (e.g. Sora, Kling, CogVideo, Runway, Luma,
|
|
115
|
+
Pika, Vidu, Wanx, SDXL, Imagen, Ideogram, Kolors, `*-image`, `*-video`) while strictly preserving vision chat models.
|
|
116
|
+
The summary supports rechecking all selected models; failed, cancelled or unstarted rechecks cannot inherit
|
|
117
|
+
previous successes. Check results, source labels and latency remain in memory and are not saved. `/provider test`
|
|
118
|
+
checks one model and reports its latency; it does not claim the entire provider is verified.
|
|
119
|
+
Draft cancellation does not write; saved changes load after restarting OMP.
|
|
120
|
+
PRIVATE is the default and is excluded by encrypted-sync filtering; PUBLIC includes credentials
|
|
121
|
+
in encrypted synchronization. Private providers remain mirrored in both existing stores.
|
|
122
|
+
Background maintenance preserves the active `models.local.json` store; only obsolete root-level
|
|
123
|
+
extension files remain eligible for legacy cleanup.
|
|
124
|
+
The generated private loader lives at `~/.omp/agent/extensions/local-models.js`; existing loaders
|
|
125
|
+
and legacy files are not overwritten or removed. Invalid private JSON and public YAML fields
|
|
126
|
+
unsupported by the fixed-field formatter reject writes rather than silently discard configuration.
|
|
127
|
+
|
|
128
|
+
Standalone Responses example:
|
|
129
|
+
`omp-sync provider add gateway --url https://example.com/v1 --key YOUR_KEY --api openai-responses --model MODEL_ID --private --non-interactive`.
|
|
130
|
+
If discovery fails, an explicit `--model` can still be saved, clearly marked unverified.
|
|
131
|
+
|
|
132
|
+
**Notice on Updates:** This installed package contains local fixes and patches. Upstream updates, running
|
|
133
|
+
`omp plugin upgrade`, `omp update`, or `npm update` can overwrite local installation patches. If updated,
|
|
134
|
+
re-verify or restore your configured extensions and sync scripts.
|
|
135
|
+
|
|
81
136
|
---
|
|
82
137
|
|
|
83
138
|
## Environment Variables
|
|
@@ -90,6 +145,16 @@ Inside any `omp` session:
|
|
|
90
145
|
| `OMP_CFG_ROOT` | Override path to agent directory (default: `~/.omp/agent`) |
|
|
91
146
|
| `OMP_HOME` | Override path to omp root (default: `~/.omp`) |
|
|
92
147
|
|
|
148
|
+
### Network troubleshooting
|
|
149
|
+
|
|
150
|
+
Gist/HTTP transports retry transient network failures (ECONNRESET, ETIMEDOUT, 429, 5xx) up to 3 times
|
|
151
|
+
with backoff; 4xx client errors fail immediately. Node's `fetch` ignores the OS proxy and `HTTPS_PROXY`
|
|
152
|
+
by default. On unstable routes to `api.github.com`, launch with:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
NODE_USE_ENV_PROXY=1 HTTPS_PROXY=http://127.0.0.1:<port> # local proxy (HTTP or mixed port)
|
|
156
|
+
```
|
|
157
|
+
|
|
93
158
|
---
|
|
94
159
|
|
|
95
160
|
## Security Specification
|
package/bin/omp-sync.js
CHANGED
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
* Operates independently of OMP runtime; zero external dependencies.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import os from "node:os";
|
|
10
|
+
import path from "node:path";
|
|
8
11
|
import readline from "node:readline";
|
|
9
12
|
import process from "node:process";
|
|
10
13
|
import {
|
|
14
|
+
adaptArchive,
|
|
11
15
|
configRoot,
|
|
12
16
|
exportEncrypted,
|
|
13
17
|
importEncrypted,
|
|
14
|
-
pushGist,
|
|
15
18
|
pullGist,
|
|
16
19
|
pushHttp,
|
|
17
20
|
pullHttp,
|
|
@@ -19,6 +22,7 @@ import {
|
|
|
19
22
|
parseSpec,
|
|
20
23
|
rehydratePlugins,
|
|
21
24
|
probeProvider,
|
|
25
|
+
inferModelCapabilities,
|
|
22
26
|
saveProvider,
|
|
23
27
|
removeProvider,
|
|
24
28
|
listProviders,
|
|
@@ -29,8 +33,13 @@ import {
|
|
|
29
33
|
getCronStatus,
|
|
30
34
|
installCron,
|
|
31
35
|
removeCron,
|
|
36
|
+
readSyncPolicy,
|
|
37
|
+
setResourceScope,
|
|
38
|
+
resolveResourceScope,
|
|
39
|
+
inventoryResources,
|
|
40
|
+
readSyncState,
|
|
41
|
+
formatSyncReport,
|
|
32
42
|
} from "../index.js";
|
|
33
|
-
|
|
34
43
|
function printHelp() {
|
|
35
44
|
console.log(`
|
|
36
45
|
Universal OMP Configuration Sync & Crypt Engine (Standalone CLI)
|
|
@@ -39,8 +48,11 @@ Usage:
|
|
|
39
48
|
omp-sync <command> [arguments] [options]
|
|
40
49
|
|
|
41
50
|
Commands:
|
|
51
|
+
scope ls / list List resources with classification, source and reason
|
|
52
|
+
scope set <id> <scope> Set resource classification (public or private)
|
|
42
53
|
export <outFile> Encrypt and export local OMP configs to a file
|
|
43
54
|
import <srcFile> Decrypt and restore OMP configs from an archive
|
|
55
|
+
adapt <srcFile> [out] Adapt legacy v1/v2 archive to current v3 specification
|
|
44
56
|
push <gist:id|url> Encrypt and push configs to GitHub Gist or HTTP URL
|
|
45
57
|
pull <gist:id|url> Download and restore configs from Gist or HTTP URL
|
|
46
58
|
rollback Revert the most recent config restore from its backup
|
|
@@ -52,18 +64,16 @@ Commands:
|
|
|
52
64
|
provider rm <name> Remove a provider from public or private store
|
|
53
65
|
role set <role> <ref> Bind role (default/smol/plan/slow/web) to provider/model
|
|
54
66
|
role ls / list List active model role mappings
|
|
55
|
-
|
|
56
67
|
Options:
|
|
57
68
|
-p, --pass <passphrase> Decryption/Encryption passphrase (or OMP_CONFIG_PASS)
|
|
58
69
|
-t, --token <token> Cloud token (or OMP_CFG_CLOUD_TOKEN / GITHUB_TOKEN)
|
|
59
70
|
-r, --root <path> Agent configuration root (default: ~/.omp/agent)
|
|
60
71
|
-d, --dry-run Simulate restore without modifying files
|
|
61
72
|
-h, --help Show this help message
|
|
62
|
-
|
|
63
|
-
--rehydrate Enforce plugin rehydration (default: true)
|
|
73
|
+
|
|
64
74
|
-u, --url <url> Endpoint URL for provider (e.g. https://api.openai.com/v1)
|
|
65
75
|
-k, --key <key> Provider API Key
|
|
66
|
-
--api <type> API type: openai-completions (default) | anthropic-messages
|
|
76
|
+
--api <type> API type: openai-completions (default) | openai-responses | anthropic-messages
|
|
67
77
|
-m, --model <id> Model ID to select/bind
|
|
68
78
|
--role <role> Auto-bind role upon adding (default, smol, plan, slow, web)
|
|
69
79
|
--private Save as private (local-only, unsynced, non-overwritten) [default]
|
|
@@ -90,7 +100,7 @@ function parseCliArgs(argv) {
|
|
|
90
100
|
token: process.env.OMP_CFG_CLOUD_TOKEN || process.env.GITHUB_TOKEN || null,
|
|
91
101
|
root: process.env.OMP_CFG_ROOT || null,
|
|
92
102
|
dryRun: false,
|
|
93
|
-
|
|
103
|
+
|
|
94
104
|
help: false,
|
|
95
105
|
url: null,
|
|
96
106
|
key: null,
|
|
@@ -113,10 +123,8 @@ function parseCliArgs(argv) {
|
|
|
113
123
|
options.dryRun = true;
|
|
114
124
|
} else if (a === "-p" || a === "--pass") {
|
|
115
125
|
options.pass = args[++i];
|
|
116
|
-
} else if (a === "--no-rehydrate") {
|
|
117
|
-
|
|
118
|
-
} else if (a === "--rehydrate") {
|
|
119
|
-
options.rehydrate = true;
|
|
126
|
+
} else if (a === "--no-rehydrate" || a === "--rehydrate") {
|
|
127
|
+
throw new Error(`Flag ${a} is not supported; use the independent 'rehydrate' command instead`);
|
|
120
128
|
} else if (a === "-t" || a === "--token") {
|
|
121
129
|
options.token = args[++i];
|
|
122
130
|
} else if (a === "-r" || a === "--root") {
|
|
@@ -211,13 +219,80 @@ async function main() {
|
|
|
211
219
|
: configRoot());
|
|
212
220
|
try {
|
|
213
221
|
switch (options.command) {
|
|
222
|
+
case "scope": {
|
|
223
|
+
const sub = (options.target || "list").toLowerCase();
|
|
224
|
+
if (sub === "list" || sub === "ls") {
|
|
225
|
+
const policy = readSyncPolicy(root);
|
|
226
|
+
const state = readSyncState(root);
|
|
227
|
+
const inventory = inventoryResources(root);
|
|
228
|
+
if (inventory.length === 0) {
|
|
229
|
+
console.log("No configuration resources found in current inventory.");
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
console.log("Config Scope Inventory:");
|
|
233
|
+
for (const item of inventory) {
|
|
234
|
+
const scopeInfo = resolveResourceScope(item.id, policy, state, item);
|
|
235
|
+
const badge =
|
|
236
|
+
scopeInfo.scope === "public"
|
|
237
|
+
? "\x1b[32m[PUBLIC]\x1b[0m"
|
|
238
|
+
: scopeInfo.scope === "private"
|
|
239
|
+
? "\x1b[33m[PRIVATE]\x1b[0m"
|
|
240
|
+
: "\x1b[36m[UNCLASSIFIED]\x1b[0m";
|
|
241
|
+
console.log(
|
|
242
|
+
` ${badge} ${item.id.padEnd(35)} (source: ${item.sourceRel}, reason: ${scopeInfo.reason})`
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
if (sub === "set") {
|
|
248
|
+
const id = options.positional[2];
|
|
249
|
+
const scope = options.positional[3]?.toLowerCase();
|
|
250
|
+
if (!id || !scope || (scope !== "public" && scope !== "private")) {
|
|
251
|
+
throw new Error(
|
|
252
|
+
"Usage: omp-sync scope set <resource-id> <public|private>"
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
const res = await setResourceScope(root, id, scope);
|
|
256
|
+
console.log(`[scope] ✓ Set scope for '${res.id}' to '${res.scope}'`);
|
|
257
|
+
if (res.warning) {
|
|
258
|
+
console.log(`[scope] Notice: ${res.warning}`);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
throw new Error(`Unknown scope subcommand: ${sub}. Allowed: list, set.`);
|
|
263
|
+
}
|
|
264
|
+
|
|
214
265
|
case "export": {
|
|
215
266
|
if (!options.target) {
|
|
216
267
|
throw new Error("Usage: omp-sync export <outFile> [options]");
|
|
217
268
|
}
|
|
218
269
|
const pass = await resolvePass(options.pass);
|
|
219
270
|
const res = exportEncrypted(options.target, pass, root);
|
|
220
|
-
console.log(`[export] Successfully exported ${res.files}
|
|
271
|
+
console.log(`[export] Successfully exported ${res.files} public resource(s) (${res.bytes} bytes) -> ${res.outFile}`);
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
case "adapt": {
|
|
276
|
+
if (!options.target) {
|
|
277
|
+
throw new Error("Usage: omp-sync adapt <srcFile> [outFile] [options]");
|
|
278
|
+
}
|
|
279
|
+
const srcFile = path.resolve(options.target);
|
|
280
|
+
const outFile = path.resolve(
|
|
281
|
+
options.positional[2] || `${options.target}.v3.enc`
|
|
282
|
+
);
|
|
283
|
+
if (srcFile === outFile) {
|
|
284
|
+
throw new Error("cannot overwrite source file");
|
|
285
|
+
}
|
|
286
|
+
if (fs.existsSync(outFile) && !options.force) {
|
|
287
|
+
throw new Error(`adapted archive already exists: ${outFile}`);
|
|
288
|
+
}
|
|
289
|
+
const pass = await resolvePass(options.pass);
|
|
290
|
+
const srcBlob = fs.readFileSync(srcFile);
|
|
291
|
+
const res = adaptArchive(srcBlob, pass);
|
|
292
|
+
fs.writeFileSync(outFile, res.blob, { mode: 0o600 });
|
|
293
|
+
console.log(
|
|
294
|
+
`[adapt] detected v${res.legacy.from}; wrote v3 archive -> ${outFile} (${res.payload.resources.length} resources, ${res.legacy.unmapped.length} unmapped)`
|
|
295
|
+
);
|
|
221
296
|
break;
|
|
222
297
|
}
|
|
223
298
|
|
|
@@ -228,26 +303,22 @@ async function main() {
|
|
|
228
303
|
const pass = await resolvePass(options.pass);
|
|
229
304
|
const res = importEncrypted(options.target, pass, root, {
|
|
230
305
|
dryRun: options.dryRun,
|
|
231
|
-
rehydrate: options.rehydrate,
|
|
232
306
|
});
|
|
307
|
+
if (res.adaptedFile) {
|
|
308
|
+
console.log(`[import] incompatible v${res.legacy?.from}; adapted -> ${res.adaptedFile}`);
|
|
309
|
+
}
|
|
310
|
+
|
|
233
311
|
if (options.dryRun) {
|
|
234
|
-
console.log(`[import-dry-run]
|
|
235
|
-
|
|
236
|
-
|
|
312
|
+
console.log(`[import-dry-run] Planned physical writes: ${res.files}`);
|
|
313
|
+
console.log(formatSyncReport(res));
|
|
314
|
+
if ((res.conflicts && res.conflicts.length > 0) || (res.blocked && res.blocked.length > 0)) {
|
|
315
|
+
process.exit(1);
|
|
237
316
|
}
|
|
238
317
|
} else {
|
|
239
|
-
console.log(`[import] Successfully
|
|
318
|
+
console.log(`[import] Successfully applied sync. Modified ${res.files} physical file(s) in ${root}.`);
|
|
240
319
|
if (res.backupDir) {
|
|
241
320
|
console.log(`[backup] Pre-existing files backed up to: ${res.backupDir}`);
|
|
242
321
|
}
|
|
243
|
-
if (res.rehydration) {
|
|
244
|
-
console.log(
|
|
245
|
-
`[rehydrate] Plugins processed: ${res.rehydration.rehydrated} rehydrated (installed: ${res.rehydration.npmInstalled.length}, links: ${res.rehydration.linksRepaired.length}).`
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
if (res.purged && res.purged.length > 0) {
|
|
249
|
-
console.log(`[cleanup] Automatically purged ${res.purged.length} obsolete file(s) (e.g. legacy agy.js).`);
|
|
250
|
-
}
|
|
251
322
|
}
|
|
252
323
|
break;
|
|
253
324
|
}
|
|
@@ -264,7 +335,7 @@ async function main() {
|
|
|
264
335
|
? await pushGist(target.id, pass, root, token)
|
|
265
336
|
: await pushHttp(target.url, pass, root, token);
|
|
266
337
|
|
|
267
|
-
console.log(`[push] Successfully pushed ${res.files}
|
|
338
|
+
console.log(`[push] Successfully pushed ${res.files} public resource(s) (${res.bytes} bytes).`);
|
|
268
339
|
if (res.url) {
|
|
269
340
|
console.log(`[url] Gist URL: ${res.url}`);
|
|
270
341
|
}
|
|
@@ -283,34 +354,50 @@ async function main() {
|
|
|
283
354
|
const token = await resolveToken(options.token, target.kind === "gist");
|
|
284
355
|
const res =
|
|
285
356
|
target.kind === "gist"
|
|
286
|
-
? await pullGist(target.id, pass, root, token, { dryRun: options.dryRun
|
|
287
|
-
: await pullHttp(target.url, pass, root, token, { dryRun: options.dryRun
|
|
357
|
+
? await pullGist(target.id, pass, root, token, { dryRun: options.dryRun })
|
|
358
|
+
: await pullHttp(target.url, pass, root, token, { dryRun: options.dryRun });
|
|
359
|
+
if (res.adaptedFile) {
|
|
360
|
+
console.log(`[pull] incompatible v${res.legacy?.from}; adapted -> ${res.adaptedFile}`);
|
|
361
|
+
}
|
|
288
362
|
|
|
289
363
|
if (options.dryRun) {
|
|
290
|
-
console.log(`[pull-dry-run]
|
|
364
|
+
console.log(`[pull-dry-run] Planned actions for ${res.actions.length} resource(s) (0 written to disk):`);
|
|
291
365
|
for (const act of res.actions) {
|
|
292
|
-
console.log(` - ${act.
|
|
366
|
+
console.log(` - [${act.action.toUpperCase()}] ${act.id} (${act.reason}) -> ${act.targetPath}`);
|
|
367
|
+
}
|
|
368
|
+
if (res.conflicts && res.conflicts.length > 0) {
|
|
369
|
+
console.error(`[pull-dry-run] Conflicts (${res.conflicts.length}):`);
|
|
370
|
+
for (const c of res.conflicts) {
|
|
371
|
+
console.error(` ! ${c.id}: ${c.reason} (${c.targetPath})`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (res.blocked && res.blocked.length > 0) {
|
|
375
|
+
console.error(`[pull-dry-run] Blocked actions (${res.blocked.length}):`);
|
|
376
|
+
for (const b of res.blocked) {
|
|
377
|
+
console.error(` X ${b.id}: ${b.reason}`);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (res.prerequisites && res.prerequisites.length > 0) {
|
|
381
|
+
console.log("[pull-dry-run] Prerequisites required before apply:");
|
|
382
|
+
for (const p of res.prerequisites) {
|
|
383
|
+
console.log(` * ${p}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (res.conflicts.length > 0 || res.blocked.length > 0) {
|
|
387
|
+
process.exit(1);
|
|
293
388
|
}
|
|
294
389
|
} else {
|
|
295
|
-
console.log(`[pull] Successfully restored ${res.files}
|
|
390
|
+
console.log(`[pull] Successfully restored ${res.files} physical file(s) in ${root}.`);
|
|
296
391
|
if (res.backupDir) {
|
|
297
392
|
console.log(`[backup] Pre-existing files backed up to: ${res.backupDir}`);
|
|
298
393
|
}
|
|
299
|
-
if (res.rehydration) {
|
|
300
|
-
console.log(
|
|
301
|
-
`[rehydrate] Plugins processed: ${res.rehydration.rehydrated} rehydrated (installed: ${res.rehydration.npmInstalled.length}, links: ${res.rehydration.linksRepaired.length}).`
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
if (res.purged && res.purged.length > 0) {
|
|
305
|
-
console.log(`[cleanup] Automatically purged ${res.purged.length} obsolete file(s) (e.g. legacy agy.js).`);
|
|
306
|
-
}
|
|
307
394
|
}
|
|
308
395
|
break;
|
|
309
396
|
}
|
|
310
397
|
|
|
311
398
|
case "rollback": {
|
|
312
399
|
const res = rollback(root);
|
|
313
|
-
console.log(`[rollback] Successfully rolled back ${res.files}
|
|
400
|
+
console.log(`[rollback] Successfully rolled back ${res.files} file(s) from snapshot ${res.rolledBackFrom}`);
|
|
314
401
|
break;
|
|
315
402
|
}
|
|
316
403
|
|
|
@@ -428,6 +515,12 @@ async function main() {
|
|
|
428
515
|
if (!name) {
|
|
429
516
|
throw new Error("Usage: omp-sync provider remove <name>");
|
|
430
517
|
}
|
|
518
|
+
const roles = Object.entries(getRoles(root))
|
|
519
|
+
.filter(([, ref]) => ref.startsWith(`${name}/`))
|
|
520
|
+
.map(([r]) => r);
|
|
521
|
+
if (roles.length && !options.force) {
|
|
522
|
+
throw new Error(`Provider '${name}' is bound to role(s): ${roles.join(", ")}. Rebind roles first or use --force.`);
|
|
523
|
+
}
|
|
431
524
|
const removed = removeProvider({ name, agentDir: root });
|
|
432
525
|
if (removed) {
|
|
433
526
|
console.log(`[provider] ✓ Removed provider '${name}'`);
|
|
@@ -475,7 +568,12 @@ async function main() {
|
|
|
475
568
|
isPrivate = true; // Default to private for safety
|
|
476
569
|
}
|
|
477
570
|
}
|
|
571
|
+
if (!["openai-completions", "openai-responses", "anthropic-messages"].includes(options.api)) {
|
|
572
|
+
// Reject unknown protocols even when an explicit model permits manual saving.
|
|
573
|
+
throw new Error(`Unknown API: ${options.api}`);
|
|
574
|
+
}
|
|
478
575
|
|
|
576
|
+
url = url.trim().replace(/\/+$/, "");
|
|
479
577
|
console.log(`[probe] Probing endpoint ${url}...`);
|
|
480
578
|
const probed = await probeProvider({
|
|
481
579
|
baseUrl: url,
|
|
@@ -490,8 +588,9 @@ async function main() {
|
|
|
490
588
|
if (!options.model) {
|
|
491
589
|
throw new Error("Probe failed and no fallback --model specified. Aborted.");
|
|
492
590
|
}
|
|
591
|
+
console.log("[probe] Saving explicit model without connection verification.");
|
|
493
592
|
} else {
|
|
494
|
-
console.log(`[probe] ✓
|
|
593
|
+
console.log(`[probe] ✓ Model catalog found (generation not verified): ${probed.normalizedBaseUrl} (${probed.api})`);
|
|
495
594
|
console.log(`[probe] ✓ Discovered ${probed.models.length} model(s)`);
|
|
496
595
|
}
|
|
497
596
|
|
|
@@ -535,12 +634,15 @@ async function main() {
|
|
|
535
634
|
|
|
536
635
|
const models = probed.ok && probed.models.length > 0
|
|
537
636
|
? probed.models
|
|
538
|
-
: [
|
|
637
|
+
: [inferModelCapabilities(options.model, name)];
|
|
638
|
+
if (options.model && !models.some(model => model.id === options.model)) {
|
|
639
|
+
models.push(inferModelCapabilities(options.model, name));
|
|
640
|
+
}
|
|
539
641
|
|
|
540
642
|
saveProvider({
|
|
541
643
|
name,
|
|
542
644
|
providerConfig: {
|
|
543
|
-
baseUrl: probed.ok ? probed.normalizedBaseUrl : url,
|
|
645
|
+
baseUrl: probed.ok ? probed.normalizedBaseUrl : options.api === "anthropic-messages" ? url.replace(/\/+$/, "").replace(/\/v1$/i, "") : url,
|
|
544
646
|
api: probed.ok ? probed.api : options.api,
|
|
545
647
|
apiKey: key,
|
|
546
648
|
models,
|