@kasenri/dsh-orbit 0.5.1 → 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/lib/client.js +167 -80
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -18,10 +18,47 @@ window.__ModuleLoader__.load({
|
|
|
18
18
|
for (const model of group.models) if (model.id === route.model) return model;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* UI-only fallback ladder for models whose catalog entry declares no reasoning
|
|
23
|
+
* metadata. The DSH catalog is never modified: this only fills the Orbit
|
|
24
|
+
* picker, and a provider that rejects an effort still fails through the normal
|
|
25
|
+
* selection error path.
|
|
26
|
+
*/
|
|
27
|
+
const FALLBACK_REASONING_EFFORTS = [
|
|
28
|
+
"low",
|
|
29
|
+
"medium",
|
|
30
|
+
"high",
|
|
31
|
+
"xhigh",
|
|
32
|
+
"max"
|
|
33
|
+
];
|
|
34
|
+
const FALLBACK_EFFORT_LABELS = {
|
|
35
|
+
low: "Low",
|
|
36
|
+
medium: "Medium",
|
|
37
|
+
high: "High",
|
|
38
|
+
xhigh: "XHigh",
|
|
39
|
+
max: "Max"
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Effort options for one model: the adapter's explicit list when the catalog
|
|
43
|
+
* declares one, otherwise the Orbit UI fallback ladder.
|
|
44
|
+
*/
|
|
45
|
+
function effortsOf(model) {
|
|
46
|
+
const explicit = model?.reasoning?.efforts ?? [];
|
|
47
|
+
if (explicit.length > 0) return explicit.map((effort) => ({
|
|
48
|
+
id: effort.id,
|
|
49
|
+
name: effort.name
|
|
50
|
+
}));
|
|
51
|
+
return FALLBACK_REASONING_EFFORTS.map((id) => ({
|
|
52
|
+
id,
|
|
53
|
+
name: FALLBACK_EFFORT_LABELS[id] ?? id
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
21
56
|
/** Human effort label for a stored effort id; falls back to the raw id. */
|
|
22
57
|
function effortLabelOf(model, effort) {
|
|
23
58
|
if (effort === void 0 || effort === "") return void 0;
|
|
24
|
-
|
|
59
|
+
const explicit = model?.reasoning?.efforts.find((entry) => entry.id === effort);
|
|
60
|
+
if (explicit !== void 0) return explicit.name;
|
|
61
|
+
return FALLBACK_EFFORT_LABELS[effort] ?? effort;
|
|
25
62
|
}
|
|
26
63
|
/** Display name for a stored route: catalog name, then its model id. */
|
|
27
64
|
function routeLabelOf(state, route) {
|
|
@@ -53,22 +90,20 @@ window.__ModuleLoader__.load({
|
|
|
53
90
|
...effort === void 0 ? {} : { reasoningEffort: effort }
|
|
54
91
|
};
|
|
55
92
|
}
|
|
56
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Effort rows for one model: Provider default (an undefined effort) first,
|
|
95
|
+
* then the model's explicit ladder or the Orbit UI fallback.
|
|
96
|
+
*/
|
|
57
97
|
function effortChoicesOf(model, providerDefaultLabel) {
|
|
58
|
-
|
|
59
|
-
if (reasoning === void 0) return [];
|
|
60
|
-
const choices = [];
|
|
61
|
-
if (reasoning.defaultEffort !== void 0) choices.push({
|
|
98
|
+
return [{
|
|
62
99
|
id: "provider-default",
|
|
63
100
|
label: providerDefaultLabel,
|
|
64
101
|
effort: void 0
|
|
65
|
-
})
|
|
66
|
-
for (const effort of reasoning.efforts) choices.push({
|
|
102
|
+
}, ...effortsOf(model).map((effort) => ({
|
|
67
103
|
id: `effort:${effort.id}`,
|
|
68
104
|
label: effort.name,
|
|
69
105
|
effort: effort.id
|
|
70
|
-
});
|
|
71
|
-
return choices;
|
|
106
|
+
}))];
|
|
72
107
|
}
|
|
73
108
|
/** Normalize one settings wire value into a complete route. */
|
|
74
109
|
function routeFromSettingsValue(value) {
|
|
@@ -97,20 +132,20 @@ window.__ModuleLoader__.load({
|
|
|
97
132
|
document.head.appendChild(tag);
|
|
98
133
|
}
|
|
99
134
|
var OrbitModelSelect_module_css_default = {
|
|
135
|
+
"hint": "f77nca_hint",
|
|
136
|
+
"back": "f77nca_back",
|
|
100
137
|
"rowValue": "f77nca_rowValue",
|
|
101
138
|
"rowValueActive": "f77nca_rowValueActive",
|
|
102
|
-
"row": "f77nca_row",
|
|
103
|
-
"hint": "f77nca_hint",
|
|
104
139
|
"title": "f77nca_title",
|
|
105
|
-
"group": "f77nca_group",
|
|
106
|
-
"chevron": "f77nca_chevron",
|
|
107
|
-
"error": "f77nca_error",
|
|
108
140
|
"panel": "f77nca_panel",
|
|
109
|
-
"
|
|
110
|
-
"rowLabel": "f77nca_rowLabel",
|
|
141
|
+
"row": "f77nca_row",
|
|
111
142
|
"rowDetail": "f77nca_rowDetail",
|
|
143
|
+
"separator": "f77nca_separator",
|
|
144
|
+
"error": "f77nca_error",
|
|
145
|
+
"group": "f77nca_group",
|
|
146
|
+
"rowLabel": "f77nca_rowLabel",
|
|
112
147
|
"check": "f77nca_check",
|
|
113
|
-
"
|
|
148
|
+
"chevron": "f77nca_chevron"
|
|
114
149
|
};
|
|
115
150
|
//#endregion
|
|
116
151
|
//#region client/OrbitModelSelect.tsx
|
|
@@ -197,25 +232,31 @@ window.__ModuleLoader__.load({
|
|
|
197
232
|
if (ok) setOpen(false);
|
|
198
233
|
};
|
|
199
234
|
const currentRouteOf = (role) => role === "commander" ? config.commander : role === "watchdog" ? config.watchdog : executorRoute;
|
|
235
|
+
const roleLabelOf = (role) => role === "commander" ? commanderLabel : role === "watchdog" ? watchdogLabel : executorLabel;
|
|
236
|
+
const roleEffortLabelOf = (role) => role === "commander" ? commanderEffort : role === "watchdog" ? watchdogEffort : executorEffort;
|
|
237
|
+
const commitEffort = async (role, route, effort) => {
|
|
238
|
+
const next = {
|
|
239
|
+
provider: route.provider,
|
|
240
|
+
model: route.model,
|
|
241
|
+
...effort === void 0 ? {} : { reasoningEffort: effort }
|
|
242
|
+
};
|
|
243
|
+
if (role === "executor") {
|
|
244
|
+
await commitExecutor(next);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
await commitRole(role, next);
|
|
248
|
+
};
|
|
200
249
|
const modelRow = (role, provider, providerName, model) => {
|
|
201
250
|
const current = currentRouteOf(role);
|
|
202
251
|
const active = current?.provider === provider && current.model === model.id;
|
|
203
|
-
const reasoning = model.reasoning;
|
|
204
252
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
205
253
|
type: "button",
|
|
206
254
|
role: "menuitem",
|
|
207
255
|
className: OrbitModelSelect_module_css_default.row,
|
|
208
256
|
disabled: busy,
|
|
209
257
|
onClick: () => {
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
setPane({
|
|
213
|
-
kind: "efforts",
|
|
214
|
-
role,
|
|
215
|
-
provider,
|
|
216
|
-
modelId: model.id,
|
|
217
|
-
effort
|
|
218
|
-
});
|
|
258
|
+
if (active) {
|
|
259
|
+
setOpen(false);
|
|
219
260
|
return;
|
|
220
261
|
}
|
|
221
262
|
if (role === "executor") {
|
|
@@ -236,38 +277,9 @@ window.__ModuleLoader__.load({
|
|
|
236
277
|
}) : null]
|
|
237
278
|
}, `${provider}/${model.id}`);
|
|
238
279
|
};
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
243
|
-
type: "button",
|
|
244
|
-
role: "menuitem",
|
|
245
|
-
className: OrbitModelSelect_module_css_default.row,
|
|
246
|
-
disabled: busy,
|
|
247
|
-
onClick: () => {
|
|
248
|
-
if (role === "executor") {
|
|
249
|
-
commitExecutor({
|
|
250
|
-
provider,
|
|
251
|
-
model: modelId,
|
|
252
|
-
...effort === void 0 ? {} : { reasoningEffort: effort }
|
|
253
|
-
});
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
commitRole(role, {
|
|
257
|
-
provider,
|
|
258
|
-
model: modelId,
|
|
259
|
-
...effort === void 0 ? {} : { reasoningEffort: effort }
|
|
260
|
-
});
|
|
261
|
-
},
|
|
262
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
263
|
-
className: OrbitModelSelect_module_css_default.rowLabel,
|
|
264
|
-
children: label
|
|
265
|
-
}), active ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
266
|
-
className: OrbitModelSelect_module_css_default.check,
|
|
267
|
-
children: "✓"
|
|
268
|
-
}) : null]
|
|
269
|
-
}, id);
|
|
270
|
-
};
|
|
280
|
+
const effortPaneRoute = pane.kind === "efforts" ? currentRouteOf(pane.role) : void 0;
|
|
281
|
+
const effortPaneModel = modelOf(dir, effortPaneRoute);
|
|
282
|
+
const effortPaneChoices = pane.kind === "efforts" ? effortChoicesOf(effortPaneModel, t("providerDefault")) : [];
|
|
271
283
|
const settingsError = config.error;
|
|
272
284
|
const modelError = dir.status === "error" ? dir.error ?? t("loadFailed") : void 0;
|
|
273
285
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -302,16 +314,19 @@ window.__ModuleLoader__.load({
|
|
|
302
314
|
},
|
|
303
315
|
role: "menu",
|
|
304
316
|
children: [
|
|
305
|
-
pane.kind
|
|
317
|
+
pane.kind === "root" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
318
|
+
className: OrbitModelSelect_module_css_default.title,
|
|
319
|
+
children: t("title")
|
|
320
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
306
321
|
type: "button",
|
|
307
322
|
className: OrbitModelSelect_module_css_default.back,
|
|
308
323
|
onClick: () => {
|
|
309
|
-
setPane({ kind: "root" }
|
|
324
|
+
setPane(pane.kind === "role" ? { kind: "root" } : {
|
|
325
|
+
kind: "role",
|
|
326
|
+
role: pane.role
|
|
327
|
+
});
|
|
310
328
|
},
|
|
311
|
-
children: `${BACK} ${t("back")}`
|
|
312
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
313
|
-
className: OrbitModelSelect_module_css_default.title,
|
|
314
|
-
children: t("title")
|
|
329
|
+
children: `${BACK} ${pane.kind === "role" ? t("back") : t(pane.role)}`
|
|
315
330
|
}),
|
|
316
331
|
settingsError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
317
332
|
className: OrbitModelSelect_module_css_default.error,
|
|
@@ -343,7 +358,7 @@ window.__ModuleLoader__.load({
|
|
|
343
358
|
disabled: busy,
|
|
344
359
|
onClick: () => {
|
|
345
360
|
setPane({
|
|
346
|
-
kind: "
|
|
361
|
+
kind: "role",
|
|
347
362
|
role: "commander"
|
|
348
363
|
});
|
|
349
364
|
},
|
|
@@ -369,7 +384,7 @@ window.__ModuleLoader__.load({
|
|
|
369
384
|
disabled: busy,
|
|
370
385
|
onClick: () => {
|
|
371
386
|
setPane({
|
|
372
|
-
kind: "
|
|
387
|
+
kind: "role",
|
|
373
388
|
role: "executor"
|
|
374
389
|
});
|
|
375
390
|
},
|
|
@@ -399,7 +414,7 @@ window.__ModuleLoader__.load({
|
|
|
399
414
|
disabled: busy,
|
|
400
415
|
onClick: () => {
|
|
401
416
|
setPane({
|
|
402
|
-
kind: "
|
|
417
|
+
kind: "role",
|
|
403
418
|
role: "watchdog"
|
|
404
419
|
});
|
|
405
420
|
},
|
|
@@ -419,10 +434,72 @@ window.__ModuleLoader__.load({
|
|
|
419
434
|
]
|
|
420
435
|
})
|
|
421
436
|
] }) : null,
|
|
437
|
+
pane.kind === "role" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
438
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
439
|
+
className: OrbitModelSelect_module_css_default.group,
|
|
440
|
+
children: t(pane.role)
|
|
441
|
+
}),
|
|
442
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
443
|
+
type: "button",
|
|
444
|
+
role: "menuitem",
|
|
445
|
+
className: OrbitModelSelect_module_css_default.row,
|
|
446
|
+
disabled: busy,
|
|
447
|
+
onClick: () => {
|
|
448
|
+
setPane({
|
|
449
|
+
kind: "models",
|
|
450
|
+
role: pane.role
|
|
451
|
+
});
|
|
452
|
+
},
|
|
453
|
+
children: [
|
|
454
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
455
|
+
className: OrbitModelSelect_module_css_default.rowLabel,
|
|
456
|
+
children: t("models")
|
|
457
|
+
}),
|
|
458
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
459
|
+
className: OrbitModelSelect_module_css_default.rowValue,
|
|
460
|
+
children: roleLabelOf(pane.role) ?? t("triggerFallback")
|
|
461
|
+
}),
|
|
462
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
463
|
+
className: OrbitModelSelect_module_css_default.chevron,
|
|
464
|
+
children: CHEVRON
|
|
465
|
+
})
|
|
466
|
+
]
|
|
467
|
+
}),
|
|
468
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
469
|
+
type: "button",
|
|
470
|
+
role: "menuitem",
|
|
471
|
+
className: OrbitModelSelect_module_css_default.row,
|
|
472
|
+
disabled: busy,
|
|
473
|
+
onClick: () => {
|
|
474
|
+
setPane({
|
|
475
|
+
kind: "efforts",
|
|
476
|
+
role: pane.role
|
|
477
|
+
});
|
|
478
|
+
},
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
481
|
+
className: OrbitModelSelect_module_css_default.rowLabel,
|
|
482
|
+
children: t("effort")
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
485
|
+
className: OrbitModelSelect_module_css_default.rowValue,
|
|
486
|
+
children: roleEffortLabelOf(pane.role) ?? t("providerDefault")
|
|
487
|
+
}),
|
|
488
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
489
|
+
className: OrbitModelSelect_module_css_default.chevron,
|
|
490
|
+
children: CHEVRON
|
|
491
|
+
})
|
|
492
|
+
]
|
|
493
|
+
}),
|
|
494
|
+
pane.role === "executor" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
495
|
+
className: OrbitModelSelect_module_css_default.hint,
|
|
496
|
+
children: t("followsSession")
|
|
497
|
+
}) : null
|
|
498
|
+
] }) : null,
|
|
422
499
|
pane.kind === "models" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
423
500
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
424
501
|
className: OrbitModelSelect_module_css_default.group,
|
|
425
|
-
children:
|
|
502
|
+
children: t("models")
|
|
426
503
|
}),
|
|
427
504
|
dir.groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
428
505
|
className: OrbitModelSelect_module_css_default.group,
|
|
@@ -433,15 +510,25 @@ window.__ModuleLoader__.load({
|
|
|
433
510
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: `${failure.name}: ${failure.message}` })
|
|
434
511
|
}, failure.id))
|
|
435
512
|
] }) : null,
|
|
436
|
-
pane.kind === "efforts" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
513
|
+
pane.kind === "efforts" && effortPaneRoute !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
437
514
|
className: OrbitModelSelect_module_css_default.group,
|
|
438
|
-
children:
|
|
439
|
-
}),
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
515
|
+
children: t("effort")
|
|
516
|
+
}), effortPaneChoices.map((choice) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
517
|
+
type: "button",
|
|
518
|
+
role: "menuitem",
|
|
519
|
+
className: OrbitModelSelect_module_css_default.row,
|
|
520
|
+
disabled: busy,
|
|
521
|
+
onClick: () => {
|
|
522
|
+
commitEffort(pane.role, effortPaneRoute, choice.effort);
|
|
523
|
+
},
|
|
524
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
525
|
+
className: OrbitModelSelect_module_css_default.rowLabel,
|
|
526
|
+
children: choice.label
|
|
527
|
+
}), effortPaneRoute.reasoningEffort === choice.effort ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
528
|
+
className: OrbitModelSelect_module_css_default.check,
|
|
529
|
+
children: "✓"
|
|
530
|
+
}) : null]
|
|
531
|
+
}, choice.id))] }) : null,
|
|
445
532
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: OrbitModelSelect_module_css_default.separator }),
|
|
446
533
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
447
534
|
className: OrbitModelSelect_module_css_default.hint,
|
|
@@ -462,7 +549,7 @@ window.__ModuleLoader__.load({
|
|
|
462
549
|
executor: "Executor",
|
|
463
550
|
watchdog: "Watchdog",
|
|
464
551
|
followsSession: "Follows current session model",
|
|
465
|
-
models: "
|
|
552
|
+
models: "Model",
|
|
466
553
|
effort: "Reasoning effort",
|
|
467
554
|
providerDefault: "Provider default",
|
|
468
555
|
back: "Back",
|
|
@@ -482,7 +569,7 @@ window.__ModuleLoader__.load({
|
|
|
482
569
|
watchdog: "监控模型",
|
|
483
570
|
followsSession: "跟随当前会话模型",
|
|
484
571
|
models: "模型",
|
|
485
|
-
effort: "
|
|
572
|
+
effort: "推理等级",
|
|
486
573
|
providerDefault: "提供方默认",
|
|
487
574
|
back: "返回",
|
|
488
575
|
retry: "重试",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kasenri/dsh-orbit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deterministic engineering orchestration for DeepSeek Harness with Commander, Executor, Smart Watchdog, bounded recovery and durable execution state.",
|
|
6
6
|
"license": "MIT",
|