@kasenri/dsh-orbit 0.5.10 → 0.6.1

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 CHANGED
@@ -83,8 +83,8 @@ window.__ModuleLoader__.load({
83
83
  };
84
84
  }
85
85
  //#endregion
86
- //#region \0dsh-css:/root/code/dsh-pi-parity/packages/orbit/client/OrbitModelSelect.module.css.mjs
87
- const css = ".f77nca_panel{z-index:60;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-specific-menu);min-width:260px;max-width:420px;max-height:min(55vh,420px);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);border-radius:12px;flex-direction:column;padding:6px;font-size:13px;line-height:1.4;display:flex;position:fixed;overflow:auto}.f77nca_title{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;padding:6px 8px 2px;font-size:11px;overflow:hidden}.f77nca_group{color:var(--dsw-alias-label-tertiary);padding:8px 8px 2px;font-size:11px}.f77nca_row{width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:8px;align-items:center;gap:8px;padding:7px 8px;display:flex}.f77nca_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.f77nca_switchRow{align-items:center;gap:8px;padding:4px 8px 6px;display:flex}.f77nca_switchControl{margin-left:auto}.f77nca_rowLabel{flex:none}.f77nca_rowValue{max-width:190px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;margin-left:auto;overflow:hidden}.f77nca_rowValueActive{color:var(--dsw-alias-label-primary)}.f77nca_rowDetail{color:var(--dsw-alias-label-tertiary);margin-left:auto;font-size:11px}.f77nca_check{color:var(--dsw-alias-state-business-primary);flex:none;margin-left:6px}.f77nca_chevron{color:var(--dsw-alias-label-tertiary);flex:none;margin-left:6px}.f77nca_separator{background:var(--dsw-alias-border-l1);height:1px;margin:6px 4px}.f77nca_hint{color:var(--dsw-alias-label-tertiary);padding:6px 8px;font-size:11px}.f77nca_error{color:var(--dsw-alias-state-error-primary);align-items:center;gap:8px;padding:8px;font-size:12px;display:flex}.f77nca_back{width:100%;color:var(--dsw-alias-label-tertiary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:center;gap:6px;padding:6px 8px 8px;font-size:12px;display:flex}";
86
+ //#region \0dsh-css:/root/.devspace/worktrees/dsh-pi-parity-b411f55f/packages/orbit/client/OrbitModelSelect.module.css.mjs
87
+ const css = ".f77nca_panel{z-index:60;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-specific-menu);min-width:260px;max-width:420px;max-height:min(55vh,420px);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);border-radius:12px;flex-direction:column;padding:6px;font-size:13px;line-height:1.4;display:flex;position:fixed;overflow:auto}.f77nca_title{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;padding:6px 8px 2px;font-size:11px;overflow:hidden}.f77nca_group{color:var(--dsw-alias-label-tertiary);padding:8px 8px 2px;font-size:11px}.f77nca_row{width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:8px;align-items:center;gap:8px;padding:7px 8px;display:flex}.f77nca_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.f77nca_switchRow{align-items:center;gap:8px;padding:4px 8px 6px;display:flex}.f77nca_switchNavRow{align-items:center;gap:6px;padding:2px 4px 2px 8px;display:flex}.f77nca_switchNavLabel{min-width:0;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;flex:1;padding:5px 0}.f77nca_chevronButton{width:26px;height:26px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;padding:0;display:inline-flex}.f77nca_switchNavLabel:hover,.f77nca_chevronButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.f77nca_switchControl{margin-left:auto}.f77nca_rowLabel{flex:none}.f77nca_rowValue{max-width:190px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;margin-left:auto;overflow:hidden}.f77nca_rowValueActive{color:var(--dsw-alias-label-primary)}.f77nca_rowDetail{color:var(--dsw-alias-label-tertiary);margin-left:auto;font-size:11px}.f77nca_check{color:var(--dsw-alias-state-business-primary);flex:none;margin-left:6px}.f77nca_chevron{color:var(--dsw-alias-label-tertiary);flex:none;margin-left:6px}.f77nca_separator{background:var(--dsw-alias-border-l1);height:1px;margin:6px 4px}.f77nca_hint{color:var(--dsw-alias-label-tertiary);padding:6px 8px;font-size:11px}.f77nca_error{color:var(--dsw-alias-state-error-primary);align-items:center;gap:8px;padding:8px;font-size:12px;display:flex}.f77nca_navHeader{grid-template-columns:auto 1fr auto;align-items:center;min-height:32px;display:grid}.f77nca_back{color:var(--dsw-alias-label-tertiary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:center;gap:6px;padding:6px 8px 8px;font-size:12px;display:flex}.f77nca_navTitle{color:var(--dsw-alias-label-primary);text-align:center;text-overflow:ellipsis;white-space:nowrap;grid-column:2;font-size:12px;font-weight:600;overflow:hidden}.f77nca_choiceMark{width:16px;color:var(--dsw-alias-label-tertiary);text-align:center;flex:none}";
88
88
  const tagId = "@kasenri/dsh-orbit/OrbitModelSelect.module.css";
89
89
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
90
90
  const tag = document.createElement("style");
@@ -94,22 +94,28 @@ window.__ModuleLoader__.load({
94
94
  document.head.appendChild(tag);
95
95
  }
96
96
  var OrbitModelSelect_module_css_default = {
97
- "check": "f77nca_check",
98
- "chevron": "f77nca_chevron",
97
+ "error": "f77nca_error",
98
+ "switchRow": "f77nca_switchRow",
99
99
  "rowDetail": "f77nca_rowDetail",
100
- "title": "f77nca_title",
101
- "separator": "f77nca_separator",
102
- "row": "f77nca_row",
103
- "group": "f77nca_group",
104
- "panel": "f77nca_panel",
105
100
  "rowLabel": "f77nca_rowLabel",
101
+ "switchControl": "f77nca_switchControl",
102
+ "rowValueActive": "f77nca_rowValueActive",
103
+ "check": "f77nca_check",
104
+ "panel": "f77nca_panel",
105
+ "row": "f77nca_row",
106
+ "title": "f77nca_title",
107
+ "switchNavRow": "f77nca_switchNavRow",
106
108
  "rowValue": "f77nca_rowValue",
109
+ "group": "f77nca_group",
110
+ "switchNavLabel": "f77nca_switchNavLabel",
111
+ "chevron": "f77nca_chevron",
107
112
  "hint": "f77nca_hint",
108
113
  "back": "f77nca_back",
109
- "switchControl": "f77nca_switchControl",
110
- "switchRow": "f77nca_switchRow",
111
- "error": "f77nca_error",
112
- "rowValueActive": "f77nca_rowValueActive"
114
+ "navTitle": "f77nca_navTitle",
115
+ "choiceMark": "f77nca_choiceMark",
116
+ "chevronButton": "f77nca_chevronButton",
117
+ "separator": "f77nca_separator",
118
+ "navHeader": "f77nca_navHeader"
113
119
  };
114
120
  //#endregion
115
121
  //#region client/OrbitModelSelect.tsx
@@ -142,7 +148,7 @@ window.__ModuleLoader__.load({
142
148
  * @param props - injected directory/settings faces plus the locale seat.
143
149
  * @returns the trigger and, while open, the panel.
144
150
  */
145
- function OrbitModelSelect({ t, available, directory, settings, loadModels, selectModel, writeRole, setOrbitEnabled, reloadSettings, useProjection }) {
151
+ function OrbitModelSelect({ t, available, directory, settings, loadModels, selectModel, writeRole, writeMoaPolicy, setOrbitEnabled, reloadSettings, useProjection }) {
146
152
  const dir = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
147
153
  const config = (0, react.useSyncExternalStore)((listener) => settings.subscribe(listener), () => settings.getSnapshot());
148
154
  const orbitSession = useProjection("orbitSession");
@@ -198,6 +204,12 @@ window.__ModuleLoader__.load({
198
204
  const watchdogModel = modelOf(dir, watchdogRoute);
199
205
  const watchdogLabel = watchdogRoute === void 0 ? void 0 : routeLabelOf(dir, watchdogRoute) ?? watchdogRoute.model;
200
206
  const watchdogEffort = effortLabelOf(watchdogModel, watchdogRoute?.reasoningEffort);
207
+ const moaRouteOf = (role) => {
208
+ if (role === "moa-judge") return config.moa.judge;
209
+ if (!role.startsWith("moa-candidate-")) return void 0;
210
+ const index = Number(role.slice(14)) - 1;
211
+ return Number.isInteger(index) ? config.moa.candidates[index] : void 0;
212
+ };
201
213
  const commitRole = async (role, route) => {
202
214
  if (submitting.current || config.status !== "ready") return;
203
215
  submitting.current = true;
@@ -209,6 +221,17 @@ window.__ModuleLoader__.load({
209
221
  setBusy(false);
210
222
  }
211
223
  };
224
+ const commitMoaPolicy = async (patch) => {
225
+ if (submitting.current || config.status !== "ready") return false;
226
+ submitting.current = true;
227
+ setBusy(true);
228
+ try {
229
+ return await writeMoaPolicy(patch);
230
+ } finally {
231
+ submitting.current = false;
232
+ setBusy(false);
233
+ }
234
+ };
212
235
  const commitExecutor = async (selection) => {
213
236
  if (submitting.current) return;
214
237
  submitting.current = true;
@@ -220,10 +243,51 @@ window.__ModuleLoader__.load({
220
243
  setBusy(false);
221
244
  }
222
245
  };
223
- const currentRouteOf = (role) => role === "commander" ? config.commander : role === "watchdog" ? config.watchdog : executorRoute;
224
- const roleLabelOf = (role) => role === "commander" ? commanderLabel : role === "watchdog" ? watchdogLabel : executorLabel;
225
- const roleModelLabelOf = (role) => t(role === "commander" ? "commanderModel" : role === "executor" ? "executorModel" : "watchdogModel");
226
- const roleEffortLabelOf = (role) => role === "commander" ? commanderEffort : role === "watchdog" ? watchdogEffort : executorEffort;
246
+ const currentRouteOf = (role) => role === "commander" ? config.commander : role === "watchdog" ? config.watchdog : role === "executor" ? executorRoute : moaRouteOf(role);
247
+ const roleLabelOf = (role) => {
248
+ const route = currentRouteOf(role);
249
+ if (role === "commander") return commanderLabel;
250
+ if (role === "watchdog") return watchdogLabel;
251
+ if (role === "executor") return executorLabel;
252
+ return route === void 0 ? void 0 : routeLabelOf(dir, route) ?? route.model;
253
+ };
254
+ const roleTitleOf = (role) => {
255
+ if (role === "commander") return t("commander");
256
+ if (role === "executor") return t("executor");
257
+ if (role === "watchdog") return t("watchdog");
258
+ if (role === "moa-judge") return t("moaJudge");
259
+ return `${t("moaCandidate")} ${role.slice(14)}`;
260
+ };
261
+ const isMoaRole = (role) => role === "moa-judge" || role.startsWith("moa-candidate-");
262
+ const paneTitle = () => {
263
+ if (pane.kind === "moa") return t("moa");
264
+ if (pane.kind === "moa-candidate-count") return t("moaCandidateCount");
265
+ if (pane.kind === "moa-max-steps") return t("moaMaxSteps");
266
+ if (pane.kind === "role" || pane.kind === "models" || pane.kind === "efforts") return roleTitleOf(pane.role);
267
+ return "";
268
+ };
269
+ const parentPane = () => {
270
+ if (pane.kind === "moa" || pane.kind === "moa-candidate-count" || pane.kind === "moa-max-steps") return pane.kind === "moa" ? { kind: "root" } : { kind: "moa" };
271
+ if (pane.kind === "role") return isMoaRole(pane.role) ? { kind: "moa" } : { kind: "root" };
272
+ if (pane.kind === "models" || pane.kind === "efforts") return {
273
+ kind: "role",
274
+ role: pane.role
275
+ };
276
+ return { kind: "root" };
277
+ };
278
+ const roleModelLabelOf = (role) => {
279
+ if (role === "commander") return t("commanderModel");
280
+ if (role === "executor") return t("executorModel");
281
+ if (role === "watchdog") return t("watchdogModel");
282
+ return t("models");
283
+ };
284
+ const roleEffortLabelOf = (role) => {
285
+ if (role === "commander") return commanderEffort;
286
+ if (role === "watchdog") return watchdogEffort;
287
+ if (role === "executor") return executorEffort;
288
+ const route = moaRouteOf(role);
289
+ return effortLabelOf(modelOf(dir, route), route?.reasoningEffort);
290
+ };
227
291
  const commitEffort = async (role, route, effort) => {
228
292
  const next = {
229
293
  provider: route.provider,
@@ -300,19 +364,19 @@ window.__ModuleLoader__.load({
300
364
  },
301
365
  role: "menu",
302
366
  children: [
303
- pane.kind === "root" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
304
- className: OrbitModelSelect_module_css_default.title,
305
- children: t("title")
306
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
307
- type: "button",
308
- className: OrbitModelSelect_module_css_default.back,
309
- onClick: () => {
310
- setPane(pane.kind === "role" ? { kind: "root" } : {
311
- kind: "role",
312
- role: pane.role
313
- });
314
- },
315
- children: `${BACK} ${pane.kind === "role" ? t("back") : t(pane.role)}`
367
+ pane.kind === "root" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
368
+ className: OrbitModelSelect_module_css_default.navHeader,
369
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
370
+ type: "button",
371
+ className: OrbitModelSelect_module_css_default.back,
372
+ onClick: () => {
373
+ setPane(parentPane());
374
+ },
375
+ children: `${BACK} ${t("back")}`
376
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
377
+ className: OrbitModelSelect_module_css_default.navTitle,
378
+ children: paneTitle()
379
+ })]
316
380
  }),
317
381
  settingsError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
318
382
  className: OrbitModelSelect_module_css_default.error,
@@ -434,8 +498,225 @@ window.__ModuleLoader__.load({
434
498
  children: CHEVRON
435
499
  })
436
500
  ]
501
+ }),
502
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: OrbitModelSelect_module_css_default.separator }),
503
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
504
+ className: OrbitModelSelect_module_css_default.switchNavRow,
505
+ children: [
506
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
507
+ type: "button",
508
+ role: "menuitem",
509
+ className: OrbitModelSelect_module_css_default.switchNavLabel,
510
+ disabled: busy,
511
+ onClick: () => {
512
+ setPane({ kind: "moa" });
513
+ },
514
+ children: t("moa")
515
+ }),
516
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
517
+ className: OrbitModelSelect_module_css_default.switchControl,
518
+ checked: config.moa.enabled,
519
+ disabled: busy,
520
+ label: t("moaEnable"),
521
+ onChange: (next) => {
522
+ commitMoaPolicy({ enabled: next });
523
+ }
524
+ }),
525
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
526
+ type: "button",
527
+ className: OrbitModelSelect_module_css_default.chevronButton,
528
+ "aria-label": t("moaOpenSettings"),
529
+ disabled: busy,
530
+ onClick: () => {
531
+ setPane({ kind: "moa" });
532
+ },
533
+ children: CHEVRON
534
+ })
535
+ ]
437
536
  })
438
537
  ] }) : null,
538
+ pane.kind === "moa" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
539
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
540
+ className: OrbitModelSelect_module_css_default.switchRow,
541
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
542
+ className: OrbitModelSelect_module_css_default.rowLabel,
543
+ children: t("moaEnable")
544
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
545
+ className: OrbitModelSelect_module_css_default.switchControl,
546
+ checked: config.moa.enabled,
547
+ disabled: busy,
548
+ label: t("moaEnable"),
549
+ onChange: (next) => {
550
+ commitMoaPolicy({ enabled: next });
551
+ }
552
+ })]
553
+ }),
554
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
555
+ type: "button",
556
+ role: "menuitem",
557
+ className: OrbitModelSelect_module_css_default.row,
558
+ disabled: busy,
559
+ onClick: () => {
560
+ setPane({ kind: "moa-candidate-count" });
561
+ },
562
+ children: [
563
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
564
+ className: OrbitModelSelect_module_css_default.rowLabel,
565
+ children: t("moaCandidateCount")
566
+ }),
567
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
568
+ className: OrbitModelSelect_module_css_default.rowValue,
569
+ children: config.moa.candidateCount
570
+ }),
571
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
572
+ className: OrbitModelSelect_module_css_default.chevron,
573
+ children: CHEVRON
574
+ })
575
+ ]
576
+ }),
577
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
578
+ className: OrbitModelSelect_module_css_default.switchRow,
579
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
580
+ className: OrbitModelSelect_module_css_default.rowLabel,
581
+ children: t("moaPeerCritique")
582
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
583
+ className: OrbitModelSelect_module_css_default.switchControl,
584
+ checked: config.moa.peerCritique,
585
+ disabled: busy,
586
+ label: t("moaPeerCritique"),
587
+ onChange: (next) => {
588
+ commitMoaPolicy({ peerCritique: next });
589
+ }
590
+ })]
591
+ }),
592
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
593
+ type: "button",
594
+ role: "menuitem",
595
+ className: OrbitModelSelect_module_css_default.row,
596
+ disabled: busy,
597
+ onClick: () => {
598
+ setPane({ kind: "moa-max-steps" });
599
+ },
600
+ children: [
601
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
602
+ className: OrbitModelSelect_module_css_default.rowLabel,
603
+ children: t("moaMaxSteps")
604
+ }),
605
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
606
+ className: OrbitModelSelect_module_css_default.rowValue,
607
+ children: config.moa.maxMoaSteps
608
+ }),
609
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
610
+ className: OrbitModelSelect_module_css_default.chevron,
611
+ children: CHEVRON
612
+ })
613
+ ]
614
+ }),
615
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: OrbitModelSelect_module_css_default.separator }),
616
+ Array.from({ length: config.moa.candidateCount }, (_, offset) => {
617
+ const role = `moa-candidate-${offset + 1}`;
618
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
619
+ type: "button",
620
+ role: "menuitem",
621
+ className: OrbitModelSelect_module_css_default.row,
622
+ disabled: busy,
623
+ onClick: () => {
624
+ setPane({
625
+ kind: "role",
626
+ role
627
+ });
628
+ },
629
+ children: [
630
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
631
+ className: OrbitModelSelect_module_css_default.rowLabel,
632
+ children: `${t("moaCandidate")} ${offset + 1}`
633
+ }),
634
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
635
+ className: OrbitModelSelect_module_css_default.rowValue,
636
+ children: roleLabelOf(role) ?? t("triggerFallback")
637
+ }),
638
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
639
+ className: OrbitModelSelect_module_css_default.chevron,
640
+ children: CHEVRON
641
+ })
642
+ ]
643
+ }, role);
644
+ }),
645
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
646
+ type: "button",
647
+ role: "menuitem",
648
+ className: OrbitModelSelect_module_css_default.row,
649
+ disabled: busy,
650
+ onClick: () => {
651
+ setPane({
652
+ kind: "role",
653
+ role: "moa-judge"
654
+ });
655
+ },
656
+ children: [
657
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
658
+ className: OrbitModelSelect_module_css_default.rowLabel,
659
+ children: t("moaJudge")
660
+ }),
661
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
662
+ className: OrbitModelSelect_module_css_default.rowValue,
663
+ children: roleLabelOf("moa-judge") ?? t("triggerFallback")
664
+ }),
665
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
666
+ className: OrbitModelSelect_module_css_default.chevron,
667
+ children: CHEVRON
668
+ })
669
+ ]
670
+ })
671
+ ] }) : null,
672
+ pane.kind === "moa-candidate-count" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: [
673
+ 2,
674
+ 3,
675
+ 4
676
+ ].map((count) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
677
+ type: "button",
678
+ role: "menuitemradio",
679
+ "aria-checked": config.moa.candidateCount === count,
680
+ className: OrbitModelSelect_module_css_default.row,
681
+ disabled: busy,
682
+ onClick: () => {
683
+ commitMoaPolicy({ candidateCount: count }).then((ok) => {
684
+ if (ok) setPane({ kind: "moa" });
685
+ });
686
+ },
687
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
688
+ className: OrbitModelSelect_module_css_default.choiceMark,
689
+ children: config.moa.candidateCount === count ? "●" : "○"
690
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
691
+ className: OrbitModelSelect_module_css_default.rowLabel,
692
+ children: `${count} ${t("moaCandidatesUnit")}`
693
+ })]
694
+ }, count)) }) : null,
695
+ pane.kind === "moa-max-steps" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: [
696
+ 1,
697
+ 2,
698
+ 3,
699
+ 4,
700
+ 5
701
+ ].map((count) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
702
+ type: "button",
703
+ role: "menuitemradio",
704
+ "aria-checked": config.moa.maxMoaSteps === count,
705
+ className: OrbitModelSelect_module_css_default.row,
706
+ disabled: busy,
707
+ onClick: () => {
708
+ commitMoaPolicy({ maxMoaSteps: count }).then((ok) => {
709
+ if (ok) setPane({ kind: "moa" });
710
+ });
711
+ },
712
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
713
+ className: OrbitModelSelect_module_css_default.choiceMark,
714
+ children: config.moa.maxMoaSteps === count ? "●" : "○"
715
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
716
+ className: OrbitModelSelect_module_css_default.rowLabel,
717
+ children: count
718
+ })]
719
+ }, count)) }) : null,
439
720
  pane.kind === "role" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
440
721
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
441
722
  type: "button",
@@ -527,11 +808,10 @@ window.__ModuleLoader__.load({
527
808
  children: "✓"
528
809
  }) : null]
529
810
  }, choice.id))] }) : null,
530
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: OrbitModelSelect_module_css_default.separator }),
531
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
811
+ pane.kind === "root" || pane.kind === "moa" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: OrbitModelSelect_module_css_default.separator }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
532
812
  className: OrbitModelSelect_module_css_default.hint,
533
813
  children: t("applyOnNextSend")
534
- })
814
+ })] }) : null
535
815
  ]
536
816
  }), document.body) : null] });
537
817
  }
@@ -552,6 +832,21 @@ window.__ModuleLoader__.load({
552
832
  commanderModel: "Commander model",
553
833
  executorModel: "Executor model",
554
834
  watchdogModel: "Watchdog model",
835
+ moa: "MoA",
836
+ moaEnable: "Enable MoA",
837
+ moaOpenSettings: "Open MoA settings",
838
+ moaCandidate: "Candidate",
839
+ moaCandidatesUnit: "candidates",
840
+ moaCandidateCount: "Candidate count",
841
+ moaJudge: "Judge",
842
+ moaPeerCritique: "Peer critique",
843
+ moaMaxSteps: "Max MoA steps per run",
844
+ runtime: "Current run",
845
+ moaRuntimePhase: "MoA phase",
846
+ moaTokens: "tokens",
847
+ moaTotalUsage: "MoA total",
848
+ moaCostUnavailable: "cost unavailable",
849
+ moaWaiting: "Waiting",
555
850
  followsSession: "Follows current session model",
556
851
  models: "Model",
557
852
  effort: "Reasoning effort",
@@ -577,6 +872,21 @@ window.__ModuleLoader__.load({
577
872
  commanderModel: "指挥官模型",
578
873
  executorModel: "执行员模型",
579
874
  watchdogModel: "监控模型",
875
+ moa: "MoA 多候选模式",
876
+ moaEnable: "启用 MoA",
877
+ moaOpenSettings: "打开 MoA 设置",
878
+ moaCandidate: "候选模型",
879
+ moaCandidatesUnit: "个候选",
880
+ moaCandidateCount: "候选数量",
881
+ moaJudge: "Judge 评审模型",
882
+ moaPeerCritique: "候选互评",
883
+ moaMaxSteps: "每个 Run 最多 MoA 步骤",
884
+ runtime: "当前运行",
885
+ moaRuntimePhase: "MoA 阶段",
886
+ moaTokens: "Token",
887
+ moaTotalUsage: "MoA 总计",
888
+ moaCostUnavailable: "未配置价格,无法计算成本",
889
+ moaWaiting: "等待中",
580
890
  followsSession: "跟随当前会话模型",
581
891
  models: "模型",
582
892
  effort: "推理等级",
@@ -617,13 +927,33 @@ window.__ModuleLoader__.load({
617
927
  zh,
618
928
  en
619
929
  }), "dsh-orbit: model control dictionaries");
620
- const settings = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({ status: "loading" });
930
+ const settings = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({
931
+ status: "loading",
932
+ moa: {
933
+ enabled: false,
934
+ candidateCount: 3,
935
+ peerCritique: false,
936
+ maxMoaSteps: 2,
937
+ candidates: []
938
+ }
939
+ });
621
940
  const adoptView = (view) => {
622
941
  const value = view.value;
942
+ const rawMoa = value?.moa;
943
+ const rawCandidates = Array.isArray(rawMoa?.["candidates"]) ? rawMoa?.["candidates"] : [];
944
+ const moa = {
945
+ enabled: rawMoa?.["enabled"] === true,
946
+ candidateCount: typeof rawMoa?.["candidateCount"] === "number" ? rawMoa["candidateCount"] : 3,
947
+ peerCritique: rawMoa?.["peerCritique"] === true,
948
+ maxMoaSteps: typeof rawMoa?.["maxMoaSteps"] === "number" ? rawMoa["maxMoaSteps"] : 2,
949
+ candidates: rawCandidates.map(routeFromSettingsValue).filter((route) => route !== void 0),
950
+ judge: routeFromSettingsValue(rawMoa?.["judge"])
951
+ };
623
952
  settings.set({
624
953
  status: "ready",
625
954
  commander: routeFromSettingsValue(value?.commander),
626
955
  watchdog: routeFromSettingsValue(value?.watchdog),
956
+ moa,
627
957
  revision: view.revision
628
958
  });
629
959
  };
@@ -664,15 +994,28 @@ window.__ModuleLoader__.load({
664
994
  reloadSettings();
665
995
  });
666
996
  }, "dsh-orbit: settings mirror");
667
- const writeRole = async (role, route) => {
997
+ const wireRoute = (route) => ({
998
+ provider: route.provider,
999
+ model: route.model,
1000
+ reasoningEffort: route.reasoningEffort ?? ""
1001
+ });
1002
+ const moaWire = (moa) => ({
1003
+ enabled: moa.enabled,
1004
+ candidateCount: moa.candidateCount,
1005
+ peerCritique: moa.peerCritique,
1006
+ maxMoaSteps: moa.maxMoaSteps,
1007
+ candidates: moa.candidates.map((route) => wireRoute(route)),
1008
+ judge: moa.judge ? wireRoute(moa.judge) : {
1009
+ provider: "",
1010
+ model: "",
1011
+ reasoningEffort: ""
1012
+ }
1013
+ });
1014
+ const updateSettings = async (patch) => {
668
1015
  const snapshot = settings.getSnapshot();
669
1016
  if (snapshot.status !== "ready" || snapshot.revision === void 0) return false;
670
1017
  try {
671
- const response = await ctx.remote.settings.update(ORBIT_SETTINGS_NS, { [role]: {
672
- provider: route.provider,
673
- model: route.model,
674
- reasoningEffort: route.reasoningEffort ?? ""
675
- } }, snapshot.revision);
1018
+ const response = await ctx.remote.settings.update(ORBIT_SETTINGS_NS, patch, snapshot.revision);
676
1019
  if (!response.ok) {
677
1020
  settings.update((draft) => {
678
1021
  draft.error = response.error.message;
@@ -690,6 +1033,34 @@ window.__ModuleLoader__.load({
690
1033
  return false;
691
1034
  }
692
1035
  };
1036
+ const writeRole = async (role, route) => {
1037
+ const snapshot = settings.getSnapshot();
1038
+ if (role === "commander" || role === "watchdog") return updateSettings({ [role]: wireRoute(route) });
1039
+ const nextMoa = {
1040
+ ...snapshot.moa,
1041
+ candidates: [...snapshot.moa.candidates]
1042
+ };
1043
+ if (role === "moa-judge") nextMoa.judge = route;
1044
+ else {
1045
+ const index = Number(role.slice(14)) - 1;
1046
+ if (!Number.isInteger(index) || index < 0 || index > 3) return false;
1047
+ while (nextMoa.candidates.length <= index) nextMoa.candidates.push({
1048
+ provider: "",
1049
+ model: ""
1050
+ });
1051
+ nextMoa.candidates[index] = route;
1052
+ }
1053
+ return updateSettings({ moa: moaWire(nextMoa) });
1054
+ };
1055
+ const writeMoaPolicy = async (patch) => {
1056
+ const snapshot = settings.getSnapshot();
1057
+ const nextMoa = {
1058
+ ...snapshot.moa,
1059
+ ...patch,
1060
+ candidates: [...snapshot.moa.candidates]
1061
+ };
1062
+ return updateSettings({ moa: moaWire(nextMoa) });
1063
+ };
693
1064
  ctx.inject([
694
1065
  "slots",
695
1066
  "modelDirectories",
@@ -709,6 +1080,7 @@ window.__ModuleLoader__.load({
709
1080
  },
710
1081
  selectModel: (selection) => available ? directory.select(selection).then(() => true, () => false) : Promise.resolve(false),
711
1082
  writeRole,
1083
+ writeMoaPolicy,
712
1084
  setOrbitEnabled: async (enabled) => {
713
1085
  const session = sessions.binding(sessionId)?.session;
714
1086
  if (session === void 0) return false;
package/lib/decisions.js CHANGED
@@ -26,6 +26,7 @@ export const COMMANDER_PLAN_SCHEMA = {
26
26
  id: { type: 'string', description: '稳定标识,例如 P0。' },
27
27
  goal: { type: 'string' },
28
28
  capabilities: { type: 'array', items: { type: 'string', enum: CAPABILITY_ENUM } },
29
+ execution_mode: { type: 'string', enum: ['SINGLE', 'MOA'] },
29
30
  },
30
31
  },
31
32
  },
@@ -40,6 +41,7 @@ export const COMMANDER_STEP_EVALUATE_SCHEMA = {
40
41
  reason: { type: 'string' },
41
42
  next_step_goal: { type: 'string' },
42
43
  next_step_capabilities: { type: 'array', items: { type: 'string', enum: CAPABILITY_ENUM } },
44
+ next_step_execution_mode: { type: 'string', enum: ['SINGLE', 'MOA'] },
43
45
  },
44
46
  };
45
47
  export const COMMANDER_FINAL_EVALUATE_SCHEMA = {
@@ -51,6 +53,7 @@ export const COMMANDER_FINAL_EVALUATE_SCHEMA = {
51
53
  summary: { type: 'string' },
52
54
  next_step_goal: { type: 'string' },
53
55
  next_step_capabilities: { type: 'array', items: { type: 'string', enum: CAPABILITY_ENUM } },
56
+ next_step_execution_mode: { type: 'string', enum: ['SINGLE', 'MOA'] },
54
57
  next_steps: {
55
58
  type: 'array',
56
59
  items: {
@@ -63,6 +66,7 @@ export const COMMANDER_FINAL_EVALUATE_SCHEMA = {
63
66
  properties: {
64
67
  goal: { type: 'string' },
65
68
  capabilities: { type: 'array', items: { type: 'string', enum: CAPABILITY_ENUM } },
69
+ execution_mode: { type: 'string', enum: ['SINGLE', 'MOA'] },
66
70
  },
67
71
  },
68
72
  ],