dsh-autotier 0.2.3 → 0.2.6
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/AGENTS.md +50 -21
- package/CHANGELOG.md +43 -0
- package/README-es.md +95 -13
- package/README-hi.md +94 -14
- package/README-pt.md +97 -16
- package/README-zh.md +84 -11
- package/README.md +111 -18
- package/cordis.patch.yml +2 -2
- package/lib/client.js +72 -40
- package/lib/client.js.map +1 -1
- package/lib/index.js +233 -66
- package/lib/typert.host.js +1 -1
- package/lib/types/client/TierSettingsCard.d.ts +14 -12
- package/lib/types/client/TierSettingsCard.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +5 -4
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/remote.d.ts +12 -12
- package/lib/types/config.d.ts +20 -9
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/index.d.ts +11 -8
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/judge.d.ts +17 -0
- package/lib/types/judge.d.ts.map +1 -1
- package/lib/types/preflight.d.ts +21 -1
- package/lib/types/preflight.d.ts.map +1 -1
- package/lib/types/routing.d.ts.map +1 -1
- package/lib/types/schema.d.ts +44 -2
- package/lib/types/schema.d.ts.map +1 -1
- package/lib/types/selection.d.ts +36 -10
- package/lib/types/selection.d.ts.map +1 -1
- package/lib/types/service.d.ts +16 -9
- package/lib/types/service.d.ts.map +1 -1
- package/lib/types/settings.d.ts +44 -0
- package/lib/types/settings.d.ts.map +1 -0
- package/lib/types/typert.host.d.ts +12 -12
- package/lib/types/wire.d.ts +24 -24
- package/lib/types/wire.d.ts.map +1 -1
- package/lib/{wire-BpKSOHgo.js → wire-BxsY8BiN.js} +22 -20
- package/package.json +58 -52
- package/src/client/TierSettingsCard.tsx +25 -12
- package/src/client/index.ts +29 -16
- package/src/config.ts +70 -12
- package/src/index.ts +23 -19
- package/src/judge.ts +30 -2
- package/src/preflight.ts +68 -1
- package/src/routing.ts +11 -0
- package/src/schema.ts +48 -9
- package/src/selection.ts +54 -20
- package/src/service.ts +20 -18
- package/src/settings.ts +80 -0
- package/src/wire.ts +19 -20
package/lib/client.js
CHANGED
|
@@ -206,20 +206,22 @@ window.__ModuleLoader__.load({
|
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/client/TierSettingsCard.tsx
|
|
208
208
|
/**
|
|
209
|
-
* The autotier
|
|
210
|
-
* selector, the read-only tier landings, the live session
|
|
211
|
-
* catalog dropdown fed by `tier/catalog`.
|
|
209
|
+
* The autotier card on the Plugins page (`plugins.item`, id `autotier`): the
|
|
210
|
+
* session routing-mode selector, the read-only tier landings, the live session
|
|
211
|
+
* state, and the model catalog dropdown fed by `tier/catalog`.
|
|
212
212
|
*
|
|
213
|
-
* The
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
213
|
+
* The Plugins page renders it in two views: `summary` (the one-liner under the
|
|
214
|
+
* card title) and `page` (the full panel). The selector writes the *session*
|
|
215
|
+
* override for the session currently open in the shell (resolved by the client
|
|
216
|
+
* entry through the sessions store face), so it stays non-persistent exactly
|
|
217
|
+
* like the pill and `/tier`. When no session is open the host answers with an
|
|
218
|
+
* empty session view and the selector is disabled with an explanation instead
|
|
219
|
+
* of failing silently.
|
|
218
220
|
*
|
|
219
221
|
* @module dsh-autotier/client/TierSettingsCard
|
|
220
222
|
*/
|
|
221
|
-
/** The
|
|
222
|
-
function TierSettingsCard({ status, catalog, setMode, t }) {
|
|
223
|
+
/** The Plugins-page card body. */
|
|
224
|
+
function TierSettingsCard({ status, catalog, setMode, t, view }) {
|
|
223
225
|
const [state, setState] = (0, react.useState)({ status: "loading" });
|
|
224
226
|
const [selected, setSelected] = (0, react.useState)("");
|
|
225
227
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
@@ -257,6 +259,28 @@ window.__ModuleLoader__.load({
|
|
|
257
259
|
setBusy(false);
|
|
258
260
|
}
|
|
259
261
|
};
|
|
262
|
+
if (view === "summary") {
|
|
263
|
+
if (state.status === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
264
|
+
className: "datr-meta",
|
|
265
|
+
"data-dsh-autotier": true,
|
|
266
|
+
children: t("loading")
|
|
267
|
+
});
|
|
268
|
+
if (state.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
269
|
+
className: "datr-meta",
|
|
270
|
+
"data-dsh-autotier": true,
|
|
271
|
+
children: [
|
|
272
|
+
t("error"),
|
|
273
|
+
" ",
|
|
274
|
+
state.message
|
|
275
|
+
]
|
|
276
|
+
});
|
|
277
|
+
const summary = landings(state.snapshot).map((entry) => `${entry.tier === "vision" ? t("tierVision") : t(tierKey(entry.tier))}: ${landingText(entry.route)}`).join(" · ");
|
|
278
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
279
|
+
className: "datr-meta",
|
|
280
|
+
"data-dsh-autotier": true,
|
|
281
|
+
children: `${t(modeKey(state.snapshot.session.mode))} · ${summary}`
|
|
282
|
+
});
|
|
283
|
+
}
|
|
260
284
|
if (state.status === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
261
285
|
className: "datr-status",
|
|
262
286
|
"data-dsh-autotier": true,
|
|
@@ -5579,24 +5603,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5579
5603
|
const TIER_AGENT_ID_SCHEMA = string().optional();
|
|
5580
5604
|
/** Strict wire schema for the routing mode parameter. */
|
|
5581
5605
|
const TIER_MODE_SCHEMA = _enum(ROUTING_MODES);
|
|
5606
|
+
/**
|
|
5607
|
+
* Strict codec, single-face.
|
|
5608
|
+
*
|
|
5609
|
+
* `TypertCodec`'s strict arm declares exactly one schema entry point,
|
|
5610
|
+
* `create(): TypertSchema`, and the typert-loader enforces it at registration
|
|
5611
|
+
* (`has no create() factory`). The `schema` property this used to carry as a
|
|
5612
|
+
* second face is gone from the protocol, so carrying it was dead weight — the
|
|
5613
|
+
* loader ignores it, and no published line reads it — while still looking like
|
|
5614
|
+
* a supported surface. The zod instance carries `.parse` natively, so the
|
|
5615
|
+
* factory hands the same object back on every call.
|
|
5616
|
+
*/
|
|
5617
|
+
function strictCodec(typeSymbol, schema) {
|
|
5618
|
+
return Object.freeze({
|
|
5619
|
+
mode: "strict",
|
|
5620
|
+
typeSymbol,
|
|
5621
|
+
create: () => schema
|
|
5622
|
+
});
|
|
5623
|
+
}
|
|
5582
5624
|
/** The optional trailing agent-id parameter both agent-addressed methods share. */
|
|
5583
5625
|
const AGENT_ID_PARAMETER = Object.freeze({
|
|
5584
5626
|
name: "agentId",
|
|
5585
5627
|
wire: "agentId",
|
|
5586
5628
|
source: "json",
|
|
5587
|
-
codec:
|
|
5588
|
-
mode: "strict",
|
|
5589
|
-
typeSymbol: "dsh-autotier/wire#TierAgentId",
|
|
5590
|
-
schema: TIER_AGENT_ID_SCHEMA
|
|
5591
|
-
}),
|
|
5629
|
+
codec: strictCodec("dsh-autotier/wire#TierAgentId", TIER_AGENT_ID_SCHEMA),
|
|
5592
5630
|
acceptsUndefined: true
|
|
5593
5631
|
});
|
|
5594
5632
|
/** The strict result codec every `tier` method returns. */
|
|
5595
|
-
const TIER_STATUS_RESULT =
|
|
5596
|
-
mode: "strict",
|
|
5597
|
-
typeSymbol: "dsh-autotier/wire#TierStatus",
|
|
5598
|
-
schema: TIER_STATUS_SCHEMA
|
|
5599
|
-
});
|
|
5633
|
+
const TIER_STATUS_RESULT = strictCodec("dsh-autotier/wire#TierStatus", TIER_STATUS_SCHEMA);
|
|
5600
5634
|
/** Diagnostics location shared by the hand-written descriptors below. */
|
|
5601
5635
|
const WIRE_LOCATION = Object.freeze({
|
|
5602
5636
|
file: "src/wire.ts",
|
|
@@ -5630,11 +5664,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5630
5664
|
method: "catalog",
|
|
5631
5665
|
invocation: Object.freeze({ kind: "direct" }),
|
|
5632
5666
|
parameters: Object.freeze([]),
|
|
5633
|
-
result: Object.freeze(
|
|
5634
|
-
mode: "strict",
|
|
5635
|
-
typeSymbol: "dsh-autotier/wire#TierCatalog",
|
|
5636
|
-
schema: TIER_CATALOG_SCHEMA
|
|
5637
|
-
}),
|
|
5667
|
+
result: Object.freeze(strictCodec("dsh-autotier/wire#TierCatalog", TIER_CATALOG_SCHEMA)),
|
|
5638
5668
|
sourceLocation: WIRE_LOCATION
|
|
5639
5669
|
});
|
|
5640
5670
|
/**
|
|
@@ -5652,11 +5682,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5652
5682
|
name: "mode",
|
|
5653
5683
|
wire: "mode",
|
|
5654
5684
|
source: "json",
|
|
5655
|
-
codec:
|
|
5656
|
-
mode: "strict",
|
|
5657
|
-
typeSymbol: "dsh-autotier/types#RoutingMode",
|
|
5658
|
-
schema: TIER_MODE_SCHEMA
|
|
5659
|
-
})
|
|
5685
|
+
codec: strictCodec("dsh-autotier/types#RoutingMode", TIER_MODE_SCHEMA)
|
|
5660
5686
|
}), AGENT_ID_PARAMETER]),
|
|
5661
5687
|
result: TIER_STATUS_RESULT,
|
|
5662
5688
|
sourceLocation: WIRE_LOCATION
|
|
@@ -5902,11 +5928,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5902
5928
|
setMode: async (mode) => setModeFor(mode, sessionId ?? "")
|
|
5903
5929
|
})
|
|
5904
5930
|
}, TierPill));
|
|
5905
|
-
slots.inject("
|
|
5906
|
-
name: "
|
|
5931
|
+
slots.inject("plugins.item", () => slots.register({
|
|
5932
|
+
name: "plugins.item",
|
|
5907
5933
|
id: "autotier",
|
|
5908
5934
|
order: 45,
|
|
5909
|
-
label: () =>
|
|
5935
|
+
label: () => "AutoTier",
|
|
5910
5936
|
locale: NS,
|
|
5911
5937
|
inject: () => ({
|
|
5912
5938
|
status: async () => statusFor(currentId()),
|
|
@@ -5919,17 +5945,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5919
5945
|
/**
|
|
5920
5946
|
* Read the session currently open in the shell from the sessions store face.
|
|
5921
5947
|
* Structural on purpose: the store shape differs across harness lines, so only
|
|
5922
|
-
* the
|
|
5923
|
-
* shows the read-only view and disables the
|
|
5948
|
+
* the leaves are read, and an unknown shape degrades to `undefined` (the card
|
|
5949
|
+
* then shows the read-only view with the no-session notice and disables the
|
|
5950
|
+
* selector).
|
|
5951
|
+
*
|
|
5952
|
+
* The 0.1.6 line removed `SessionListState.current`; the main-view session is
|
|
5953
|
+
* derived the way upstream does it (ui-session main-binding watch): the list
|
|
5954
|
+
* snapshot's `byId` entries carry `retainedBy.mainView`, and the entry the
|
|
5955
|
+
* shell retains in its main view is the current session.
|
|
5924
5956
|
*/
|
|
5925
5957
|
function currentSessionId(sessions) {
|
|
5926
5958
|
try {
|
|
5927
|
-
const
|
|
5928
|
-
if (typeof list !== "object" || list === null) return void 0;
|
|
5929
|
-
const getSnapshot = list.getSnapshot;
|
|
5959
|
+
const getSnapshot = sessions?.list?.getSnapshot;
|
|
5930
5960
|
if (typeof getSnapshot !== "function") return void 0;
|
|
5931
|
-
const
|
|
5932
|
-
|
|
5961
|
+
const byId = getSnapshot().byId;
|
|
5962
|
+
if (typeof byId !== "object" || byId === null) return void 0;
|
|
5963
|
+
const id = Object.values(byId).find((candidate) => (candidate?.retainedBy?.mainView ?? 0) > 0)?.id;
|
|
5964
|
+
return typeof id === "string" ? id : void 0;
|
|
5933
5965
|
} catch {
|
|
5934
5966
|
return;
|
|
5935
5967
|
}
|