omp-config-crypt 0.5.0 → 0.5.2
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/bin/omp-sync.js +52 -9
- package/index.js +53 -9
- package/package.json +1 -1
package/bin/omp-sync.js
CHANGED
|
@@ -353,15 +353,20 @@ async function main() {
|
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
if (sub === "add") {
|
|
356
|
-
|
|
356
|
+
let name = options.positional[2];
|
|
357
357
|
if (!name) {
|
|
358
|
-
|
|
358
|
+
if (process.stdin.isTTY && !options.nonInteractive) {
|
|
359
|
+
name = await promptText("Enter a unique provider name (e.g. my-private-llm): ");
|
|
360
|
+
}
|
|
361
|
+
if (!name) {
|
|
362
|
+
throw new Error("Usage: omp-sync provider add <name> [options]");
|
|
363
|
+
}
|
|
359
364
|
}
|
|
360
365
|
|
|
361
366
|
let url = options.url;
|
|
362
367
|
if (!url) {
|
|
363
368
|
if (process.stdin.isTTY && !options.nonInteractive) {
|
|
364
|
-
url = await promptText(
|
|
369
|
+
url = await promptText("Enter endpoint baseUrl (e.g. https://api.openai.com/v1): ");
|
|
365
370
|
} else {
|
|
366
371
|
throw new Error("Missing --url parameter for provider");
|
|
367
372
|
}
|
|
@@ -370,7 +375,7 @@ async function main() {
|
|
|
370
375
|
let key = options.key;
|
|
371
376
|
if (key === null) {
|
|
372
377
|
if (process.stdin.isTTY && !options.nonInteractive) {
|
|
373
|
-
key = await promptText(
|
|
378
|
+
key = await promptText("Enter API Key (press Enter if none): ");
|
|
374
379
|
} else {
|
|
375
380
|
key = "";
|
|
376
381
|
}
|
|
@@ -379,7 +384,7 @@ async function main() {
|
|
|
379
384
|
let isPrivate = options.isPrivate;
|
|
380
385
|
if (isPrivate === null) {
|
|
381
386
|
if (process.stdin.isTTY && !options.nonInteractive) {
|
|
382
|
-
const ans = await promptText(
|
|
387
|
+
const ans = await promptText("Is this provider private (local-only, unsynced)? [Y/n]: ");
|
|
383
388
|
isPrivate = !/^n/i.test(ans.trim());
|
|
384
389
|
} else {
|
|
385
390
|
isPrivate = true; // Default to private for safety
|
|
@@ -405,6 +410,44 @@ async function main() {
|
|
|
405
410
|
console.log(`[probe] ✓ Discovered ${probed.models.length} model(s)`);
|
|
406
411
|
}
|
|
407
412
|
|
|
413
|
+
let chosenModel = options.model;
|
|
414
|
+
if (!chosenModel && probed.ok && probed.models.length > 0 && process.stdin.isTTY && !options.nonInteractive) {
|
|
415
|
+
console.log("\nDiscovered models:");
|
|
416
|
+
const displayList = probed.models.slice(0, 8);
|
|
417
|
+
displayList.forEach((m, idx) => {
|
|
418
|
+
const flags = [
|
|
419
|
+
m.reasoning ? "reasoning" : null,
|
|
420
|
+
m.input?.includes("image") ? "vision" : null,
|
|
421
|
+
`${m.contextWindow / 1000}k ctx`,
|
|
422
|
+
]
|
|
423
|
+
.filter(Boolean)
|
|
424
|
+
.join(", ");
|
|
425
|
+
console.log(` [${idx + 1}] ${m.id} (${flags})`);
|
|
426
|
+
});
|
|
427
|
+
const sel = await promptText(`Select primary model [1-${displayList.length}, default 1]: `);
|
|
428
|
+
const selIdx = parseInt(sel, 10);
|
|
429
|
+
if (!isNaN(selIdx) && selIdx >= 1 && selIdx <= displayList.length) {
|
|
430
|
+
chosenModel = displayList[selIdx - 1].id;
|
|
431
|
+
} else {
|
|
432
|
+
chosenModel = displayList[0].id;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
let roleToBind = options.role;
|
|
437
|
+
if (!roleToBind && process.stdin.isTTY && !options.nonInteractive) {
|
|
438
|
+
console.log("\nBind this model to an OMP role? (optional)");
|
|
439
|
+
console.log(" [1] default (primary chat & orchestration)");
|
|
440
|
+
console.log(" [2] smol (fast/subagent & tool execution)");
|
|
441
|
+
console.log(" [3] plan (high-context architectural planning)");
|
|
442
|
+
console.log(" [4] slow (deep reasoning / hard debug)");
|
|
443
|
+
console.log(" [0] Skip (no binding)");
|
|
444
|
+
const roleAns = await promptText("Select role [0-4, default 0]: ");
|
|
445
|
+
const roleMap = { "1": "default", "2": "smol", "3": "plan", "4": "slow" };
|
|
446
|
+
if (roleMap[roleAns.trim()]) {
|
|
447
|
+
roleToBind = roleMap[roleAns.trim()];
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
408
451
|
const models = probed.ok && probed.models.length > 0
|
|
409
452
|
? probed.models
|
|
410
453
|
: [{ id: options.model || "custom-model", name: `${name} custom model`, contextWindow: 128000, maxTokens: 32000 }];
|
|
@@ -427,10 +470,10 @@ async function main() {
|
|
|
427
470
|
}`
|
|
428
471
|
);
|
|
429
472
|
|
|
430
|
-
if (
|
|
431
|
-
const modelToBind =
|
|
432
|
-
setRole(
|
|
433
|
-
console.log(`[role] ✓ Role '${
|
|
473
|
+
if (roleToBind) {
|
|
474
|
+
const modelToBind = chosenModel || models[0]?.id;
|
|
475
|
+
setRole(roleToBind, `${name}/${modelToBind}`, { agentDir: root, validate: false });
|
|
476
|
+
console.log(`[role] ✓ Role '${roleToBind}' bound to ${name}/${modelToBind}`);
|
|
434
477
|
}
|
|
435
478
|
break;
|
|
436
479
|
}
|
package/index.js
CHANGED
|
@@ -21,12 +21,12 @@ export {
|
|
|
21
21
|
savePluginLinks,
|
|
22
22
|
detectMissingPlugins,
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
import {
|
|
25
25
|
probeProvider,
|
|
26
26
|
inferModelCapabilities,
|
|
27
27
|
filterChatModels,
|
|
28
28
|
} from "./src/prober.js";
|
|
29
|
-
|
|
29
|
+
import {
|
|
30
30
|
saveProvider,
|
|
31
31
|
removeProvider,
|
|
32
32
|
listProviders,
|
|
@@ -37,7 +37,25 @@ export {
|
|
|
37
37
|
writePrivateProviders,
|
|
38
38
|
ensureLocalExtension,
|
|
39
39
|
} from "./src/provider-store.js";
|
|
40
|
-
|
|
40
|
+
import { getRoles, setRole, VALID_ROLES } from "./src/role-manager.js";
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
probeProvider,
|
|
44
|
+
inferModelCapabilities,
|
|
45
|
+
filterChatModels,
|
|
46
|
+
saveProvider,
|
|
47
|
+
removeProvider,
|
|
48
|
+
listProviders,
|
|
49
|
+
getProvider,
|
|
50
|
+
readPublicProviders,
|
|
51
|
+
writePublicProviders,
|
|
52
|
+
readPrivateProviders,
|
|
53
|
+
writePrivateProviders,
|
|
54
|
+
ensureLocalExtension,
|
|
55
|
+
getRoles,
|
|
56
|
+
setRole,
|
|
57
|
+
VALID_ROLES,
|
|
58
|
+
};
|
|
41
59
|
|
|
42
60
|
const MAGIC = Buffer.from("OMPCFG1\0", "latin1");
|
|
43
61
|
const HOME_PLACEHOLDER = "{{OMP_HOME}}";
|
|
@@ -670,16 +688,42 @@ export default function (pi) {
|
|
|
670
688
|
return;
|
|
671
689
|
}
|
|
672
690
|
|
|
673
|
-
if (sub === "add") {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
691
|
+
if (sub === "add" || sub === "wizard") {
|
|
692
|
+
let name = parts[1];
|
|
693
|
+
let url = parts[2];
|
|
694
|
+
let key = parts[3] || "";
|
|
695
|
+
let isPrivate = cleanArgs.includes("--private") || !cleanArgs.includes("--public");
|
|
696
|
+
|
|
697
|
+
if ((!name || !url) && typeof ctx?.ui?.input === "function") {
|
|
698
|
+
try {
|
|
699
|
+
if (!name) {
|
|
700
|
+
name = await ctx.ui.input({
|
|
701
|
+
title: "Provider Name",
|
|
702
|
+
prompt: "Enter unique provider name (e.g. my-private-llm):",
|
|
703
|
+
placeholder: "my-private-llm",
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
if (!url) {
|
|
707
|
+
url = await ctx.ui.input({
|
|
708
|
+
title: "Endpoint URL",
|
|
709
|
+
prompt: "Enter endpoint baseUrl (e.g. https://api.openai.com/v1):",
|
|
710
|
+
placeholder: "https://api.openai.com/v1",
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
if (!key) {
|
|
714
|
+
key = (await ctx.ui.input({
|
|
715
|
+
title: "API Key",
|
|
716
|
+
prompt: "Enter API Key (leave blank if none):",
|
|
717
|
+
placeholder: "sk-...",
|
|
718
|
+
})) || "";
|
|
719
|
+
}
|
|
720
|
+
} catch {}
|
|
721
|
+
}
|
|
722
|
+
|
|
678
723
|
if (!name || !url) {
|
|
679
724
|
ctx.ui.notify("Usage: /provider add <name> <url> [key] [--private|--public]", "error");
|
|
680
725
|
return;
|
|
681
726
|
}
|
|
682
|
-
|
|
683
727
|
ctx.ui.notify(`Probing endpoint ${url}...`, "info");
|
|
684
728
|
const probed = await probeProvider({
|
|
685
729
|
baseUrl: url,
|