dahrk-node 0.1.26 → 0.1.27
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/dist/main.js +25 -9
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1362,14 +1362,16 @@ async function defaultCreatePiSession(ctx) {
|
|
|
1362
1362
|
applyApiKeyAuth(hint2, ctx.runtimeEnv, authStorage);
|
|
1363
1363
|
const modelRegistry = ModelRegistry.create(authStorage, join4(configDir, "models.json"));
|
|
1364
1364
|
let model;
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1365
|
+
try {
|
|
1366
|
+
model = selectStageModel({
|
|
1367
|
+
stageModel: ctx.config.model,
|
|
1368
|
+
profileDefaultModel: hint2?.defaultModel,
|
|
1369
|
+
resolve: (id) => resolveCliModel({ cliModel: id, modelRegistry }),
|
|
1370
|
+
available: () => modelRegistry.getAvailable()
|
|
1371
|
+
});
|
|
1372
|
+
} catch (err) {
|
|
1373
|
+
cleanupStageConfigDir(configDir);
|
|
1374
|
+
throw err;
|
|
1373
1375
|
}
|
|
1374
1376
|
const stageComplete = defineTool({
|
|
1375
1377
|
name: PI_STAGE_COMPLETE_TOOL,
|
|
@@ -1465,6 +1467,20 @@ function modelFamily(id) {
|
|
|
1465
1467
|
const last = id.split(".").pop() ?? id;
|
|
1466
1468
|
return last.replace(/-v\d+:\d+$/, "").toLowerCase();
|
|
1467
1469
|
}
|
|
1470
|
+
function selectStageModel(args) {
|
|
1471
|
+
const requested = args.stageModel ?? args.profileDefaultModel;
|
|
1472
|
+
if (!requested) return void 0;
|
|
1473
|
+
const resolved = args.resolve(requested);
|
|
1474
|
+
if (resolved?.error || !resolved?.model) {
|
|
1475
|
+
const available = args.available() ?? [];
|
|
1476
|
+
const sample = available.slice(0, 12).map((m) => `${m.provider}/${m.id}`);
|
|
1477
|
+
const detail = resolved?.error ? resolved.error : "the model id is not recognised";
|
|
1478
|
+
throw new Error(
|
|
1479
|
+
`Pi cannot resolve the model '${requested}': ${detail}. ` + (available.length ? `Models this stage can authenticate to (${available.length}): ${sample.join(", ")}${available.length > sample.length ? ", ..." : ""}.` : "This stage has no authenticated models at all; check the auth profile bound to its node pool.") + " If the id is newer than this node's pinned Pi, upgrade dahrk-node."
|
|
1480
|
+
);
|
|
1481
|
+
}
|
|
1482
|
+
return pickAuthedModel(resolved.model, args.available(), args.stageModel ? args.profileDefaultModel : void 0);
|
|
1483
|
+
}
|
|
1468
1484
|
function pickAuthedModel(resolved, available, fallbackModel) {
|
|
1469
1485
|
if (!resolved || !available?.length) return resolved;
|
|
1470
1486
|
const providers = new Set(available.map((m) => m.provider));
|
|
@@ -7727,7 +7743,7 @@ async function runStatus(inputs, deps) {
|
|
|
7727
7743
|
}
|
|
7728
7744
|
|
|
7729
7745
|
// src/main.ts
|
|
7730
|
-
var CLIENT_VERSION = "0.1.
|
|
7746
|
+
var CLIENT_VERSION = "0.1.27";
|
|
7731
7747
|
var DEFAULT_HUB_URL = "wss://api.dahrk.ai";
|
|
7732
7748
|
var list = (v) => (v ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
7733
7749
|
var RUNTIMES2 = ["claude-code", "codex", "pi"];
|