@try-works/dsh-minimal-router 0.2.4 → 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/client/index.js +38 -99
- package/package.json +1 -1
package/client/index.js
CHANGED
|
@@ -65300,20 +65300,15 @@ var OverviewCss = [
|
|
|
65300
65300
|
".router-meter-tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--color-bg); }",
|
|
65301
65301
|
/* F-37-51: the session list reads like the recent-calls list - one row per
|
|
65302
65302
|
session, the kit checkbox first, the id reduced to its tail. */
|
|
65303
|
-
".router-sessions { display: flex; flex-direction: column; gap: 0;
|
|
65303
|
+
".router-sessions { display: flex; flex-direction: column; gap: 0; width: 100%; }",
|
|
65304
65304
|
".router-sessions-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--spacing-4); padding-bottom: var(--spacing-2); }",
|
|
65305
65305
|
".router-sessions-label { font-family: var(--font-mono); font-size: var(--text-caps); line-height: var(--leading-caps); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--color-meta); }",
|
|
65306
|
-
".router-
|
|
65306
|
+
".router-session-hint { padding-top: var(--spacing-2); font-family: var(--font-ui); font-size: var(--text-caption); line-height: var(--leading-caption); color: var(--color-meta); text-wrap: pretty; }",
|
|
65307
65307
|
".router-session-row { display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-4); border-top: 1px solid var(--color-line-rule); padding: 10px 0; transition-property: background-color; transition-duration: 120ms; transition-timing-function: ease; }",
|
|
65308
65308
|
".router-session-row:hover { background: var(--color-subtle); }",
|
|
65309
65309
|
".router-session-row:focus-within { background: var(--color-subtle); }",
|
|
65310
|
-
".router-session-control { display: flex; align-items: center; gap: var(--spacing-3); flex: 1 1 auto; min-width: 0; cursor: pointer; padding-block: 4px; }",
|
|
65311
|
-
".router-session-control:focus-within .router-session-check { outline: 2px solid var(--color-ink); outline-offset: 2px; }",
|
|
65312
|
-
".router-session-check { width: 15px; height: 15px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: transparent; border: 1px solid var(--color-line-field); border-radius: var(--radius-chip); color: transparent; }",
|
|
65313
|
-
'.router-session-check[aria-checked="true"] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-bg); }',
|
|
65314
|
-
".router-session-tick { font-family: var(--font-mono); font-size: var(--text-caps); line-height: var(--leading-caps); }",
|
|
65315
65310
|
".router-session-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-ui); font-size: var(--text-label); line-height: var(--leading-label); color: var(--color-ink); }",
|
|
65316
|
-
".router-session-state { font-family: var(--font-mono); font-size: var(--text-meta);
|
|
65311
|
+
".router-session-state { flex-shrink: 0; width: 72px; text-align: right; font-family: var(--font-mono); font-size: var(--text-meta); line-height: var(--leading-meta); color: var(--color-meta); }",
|
|
65317
65312
|
'.router-session-row[data-session-state="on"] .router-session-state { color: var(--color-ink); }',
|
|
65318
65313
|
".router-session-meta { flex-shrink: 0; font-family: var(--font-mono); font-size: var(--text-meta); line-height: var(--leading-meta); color: var(--color-meta); }",
|
|
65319
65314
|
".router-session-empty { border-top: 1px solid var(--color-line-rule); padding: 8px 0; font-family: var(--font-ui); font-size: var(--text-meta); color: var(--color-meta); }",
|
|
@@ -65409,21 +65404,7 @@ var OverviewMessage = UiSchema_exports.TaggedEnum({
|
|
|
65409
65404
|
field: Schema_exports.String,
|
|
65410
65405
|
message: Schema_exports.String
|
|
65411
65406
|
},
|
|
65412
|
-
RetryRoleSave: {}
|
|
65413
|
-
// F-37-51: the per-session routing toggle. It writes the same store the model
|
|
65414
|
-
// picker writes, so the two can never disagree.
|
|
65415
|
-
RequestedToggleSession: { sessionId: Schema_exports.String, enabled: Schema_exports.Boolean },
|
|
65416
|
-
SessionRoutingChanged: {
|
|
65417
|
-
sessions: Schema_exports.Array(
|
|
65418
|
-
Schema_exports.Struct({
|
|
65419
|
-
id: Schema_exports.String,
|
|
65420
|
-
title: Schema_exports.NullOr(Schema_exports.String),
|
|
65421
|
-
updatedAt: Schema_exports.NullOr(Schema_exports.String),
|
|
65422
|
-
live: Schema_exports.Boolean,
|
|
65423
|
-
enabled: Schema_exports.Boolean
|
|
65424
|
-
})
|
|
65425
|
-
)
|
|
65426
|
-
}
|
|
65407
|
+
RetryRoleSave: {}
|
|
65427
65408
|
});
|
|
65428
65409
|
var engineHost = (endpoint) => {
|
|
65429
65410
|
if (endpoint === null) return "the configured engine";
|
|
@@ -65590,48 +65571,8 @@ var SaveSettings = Command_exports.make(
|
|
|
65590
65571
|
)
|
|
65591
65572
|
)
|
|
65592
65573
|
);
|
|
65593
|
-
var ToggleSessionRouting = Command_exports.make(
|
|
65594
|
-
"ToggleSessionRouting",
|
|
65595
|
-
{ args: { sessionId: Schema_exports.String, enabled: Schema_exports.Boolean } },
|
|
65596
|
-
({ sessionId, enabled }) => Effect_exports.gen(function* () {
|
|
65597
|
-
const response = yield* Effect_exports.tryPromise({
|
|
65598
|
-
try: () => fetch("/api/router/session-routing", {
|
|
65599
|
-
method: "POST",
|
|
65600
|
-
credentials: "same-origin",
|
|
65601
|
-
headers: { "content-type": "application/json", accept: "application/json" },
|
|
65602
|
-
body: JSON.stringify({ sessionId, enabled })
|
|
65603
|
-
}),
|
|
65604
|
-
catch: () => "network"
|
|
65605
|
-
}).pipe(Effect_exports.catch(() => Effect_exports.succeed(null)));
|
|
65606
|
-
if (response === null || typeof response.json !== "function") {
|
|
65607
|
-
return OverviewMessage.SessionRoutingChanged({ sessions: [] });
|
|
65608
|
-
}
|
|
65609
|
-
const settled2 = yield* Effect_exports.tryPromise({
|
|
65610
|
-
try: () => response.json(),
|
|
65611
|
-
catch: () => null
|
|
65612
|
-
}).pipe(Effect_exports.catch(() => Effect_exports.succeed(null)));
|
|
65613
|
-
const listed = yield* Effect_exports.tryPromise({
|
|
65614
|
-
try: () => fetch("/api/router/session-routing", {
|
|
65615
|
-
credentials: "same-origin",
|
|
65616
|
-
cache: "no-store",
|
|
65617
|
-
headers: { accept: "application/json" }
|
|
65618
|
-
}).then((res) => res.json()),
|
|
65619
|
-
catch: () => null
|
|
65620
|
-
}).pipe(Effect_exports.catch(() => Effect_exports.succeed(null)));
|
|
65621
|
-
const rows = listed !== null && typeof listed === "object" && Array.isArray(listed.sessions) ? listed.sessions : [];
|
|
65622
|
-
return OverviewMessage.SessionRoutingChanged({
|
|
65623
|
-
sessions: rows.filter((row) => row !== null && typeof row === "object" && typeof row.id === "string").map((row) => ({
|
|
65624
|
-
id: row.id,
|
|
65625
|
-
title: typeof row.title === "string" ? row.title : null,
|
|
65626
|
-
updatedAt: typeof row.updatedAt === "string" ? row.updatedAt : null,
|
|
65627
|
-
live: row.live === true,
|
|
65628
|
-
enabled: row.enabled === true
|
|
65629
|
-
}))
|
|
65630
|
-
});
|
|
65631
|
-
})
|
|
65632
|
-
);
|
|
65633
|
-
var OverviewSessionLabel = (row) => row.title !== null && row.title.length > 0 ? row.title : OverviewSessionShortId(row.id);
|
|
65634
65574
|
var OverviewSessionShortId = (id2) => id2.length <= 8 ? id2 : "\u2026" + id2.slice(-8);
|
|
65575
|
+
var OverviewSessionLabel = (row) => row.title !== null && row.title.length > 0 ? row.title : OverviewSessionShortId(row.id);
|
|
65635
65576
|
var OverviewSessionMeta = (row) => {
|
|
65636
65577
|
const at = row.updatedAt === null ? "" : row.updatedAt.slice(11, 16);
|
|
65637
65578
|
const hasTitle = row.title !== null && row.title.length > 0;
|
|
@@ -65696,11 +65637,6 @@ var Overview = OverviewDef.make({
|
|
|
65696
65637
|
// document; there is nothing to preserve in place (Run 20 R-20-01 retired the
|
|
65697
65638
|
// editor that needed it).
|
|
65698
65639
|
update: {
|
|
65699
|
-
RequestedToggleSession: ($, { sessionId, enabled }) => {
|
|
65700
|
-
const flipped = $.model.sessions.map((row) => row.id === sessionId ? { ...row, enabled } : row);
|
|
65701
|
-
return $.evolve({ sessions: flipped }).run(ToggleSessionRouting.make({ sessionId, enabled }));
|
|
65702
|
-
},
|
|
65703
|
-
SessionRoutingChanged: ($, { sessions: sessions2 }) => $.model.sessions.length === 0 && sessions2.length === 0 ? $.model : $.evolve({ sessions: sessions2 }),
|
|
65704
65640
|
RequestedOpenSelect: ($, { path }) => $.evolve({ selectOpen: path }),
|
|
65705
65641
|
RequestedCloseSelect: ($, { path }) => $.model.selectOpen === path ? $.evolve({ selectOpen: null }) : $.model,
|
|
65706
65642
|
PickedRoleSetting: ($, { path, value: value3 }) => {
|
|
@@ -65785,28 +65721,23 @@ var Overview = OverviewDef.make({
|
|
|
65785
65721
|
const sessions2 = model.sessions;
|
|
65786
65722
|
const onCount = sessions2.filter((row) => row.enabled).length;
|
|
65787
65723
|
const sessionsCard = h3.div.class("router-sessions").attr("data-sessions-card", "").children(
|
|
65788
|
-
h3.div.class("router-
|
|
65789
|
-
h3.span.class("router-
|
|
65790
|
-
h3.span.class("router-
|
|
65791
|
-
sessions2.length === 0 ? "none" : `${onCount} of ${sessions2.length}
|
|
65724
|
+
h3.div.class("router-card-head").children(
|
|
65725
|
+
h3.span.class("router-caps-label").children("Sessions \xB7 routing"),
|
|
65726
|
+
h3.span.class("router-card-meta").children(
|
|
65727
|
+
sessions2.length === 0 ? "none" : `${onCount} of ${sessions2.length} routing`
|
|
65792
65728
|
)
|
|
65793
65729
|
),
|
|
65794
|
-
...sessions2.length === 0 ? [h3.
|
|
65730
|
+
...sessions2.length === 0 ? [h3.div.class("router-session-empty").children("No recent sessions")] : sessions2.map(
|
|
65795
65731
|
(row) => h3.div.class("router-session-row").attr("data-session-row", row.id).attr("data-session-state", row.enabled ? "on" : "off").children(
|
|
65796
|
-
|
|
65797
|
-
|
|
65798
|
-
|
|
65799
|
-
|
|
65800
|
-
|
|
65801
|
-
},
|
|
65802
|
-
view: (checkbox) => h3.label.class("router-session-control").children(
|
|
65803
|
-
checkbox.root(h3.button.class("router-session-check")).children(checkbox.indicator(h3.span.class("router-session-tick"))),
|
|
65804
|
-
h3.span.class("router-session-title").children(OverviewSessionLabel(row)),
|
|
65805
|
-
h3.span.class("router-session-state").children(row.enabled ? "on" : "off")
|
|
65806
|
-
)
|
|
65807
|
-
}),
|
|
65808
|
-
h3.span.class("router-session-meta").children(OverviewSessionMeta(row))
|
|
65732
|
+
h3.span.class("router-session-title").children(OverviewSessionLabel(row)),
|
|
65733
|
+
h3.span.class("router-session-meta").children(OverviewSessionMeta(row)),
|
|
65734
|
+
h3.span.class("router-session-state").children(
|
|
65735
|
+
row.enabled ? "routing" : "not routing"
|
|
65736
|
+
)
|
|
65809
65737
|
)
|
|
65738
|
+
),
|
|
65739
|
+
h3.p.class("router-session-hint").children(
|
|
65740
|
+
"Routing is turned on per session in the model picker."
|
|
65810
65741
|
)
|
|
65811
65742
|
);
|
|
65812
65743
|
const recent = model.overview === null ? [] : model.overview.recent;
|
|
@@ -65837,18 +65768,26 @@ var Overview = OverviewDef.make({
|
|
|
65837
65768
|
],
|
|
65838
65769
|
Separator(h3).class("router-rule"),
|
|
65839
65770
|
meter,
|
|
65840
|
-
|
|
65841
|
-
|
|
65842
|
-
|
|
65843
|
-
|
|
65844
|
-
|
|
65845
|
-
|
|
65846
|
-
h3.span.class("router-
|
|
65847
|
-
|
|
65848
|
-
|
|
65849
|
-
|
|
65850
|
-
h3.
|
|
65851
|
-
|
|
65771
|
+
// Owner review (2026-12-05): the session list and the recent-calls list
|
|
65772
|
+
// are two tables. Each is its own raised panel with its own heading, so
|
|
65773
|
+
// they can never read as one continuous list.
|
|
65774
|
+
h3.div.class("router-card router-panel").attr("data-surface", "raised").attr("data-table", "sessions").children(sessionsCard),
|
|
65775
|
+
h3.div.class("router-card router-panel").attr("data-surface", "raised").attr("data-table", "recent").children(
|
|
65776
|
+
h3.div.class("router-card-head").children(
|
|
65777
|
+
h3.span.class("router-caps-label").children("Recent calls"),
|
|
65778
|
+
h3.span.class("router-card-meta").children(recent.length === 0 ? "none" : String(recent.length))
|
|
65779
|
+
),
|
|
65780
|
+
...recent.length === 0 ? [
|
|
65781
|
+
h3.div.class("router-recent-empty").children("No calls yet")
|
|
65782
|
+
] : recent.map(
|
|
65783
|
+
(row) => h3.div.class("router-recent-row").children(
|
|
65784
|
+
h3.span.class("router-recent-time").children(
|
|
65785
|
+
row.at.length >= 16 ? row.at.slice(11, 16) : row.at
|
|
65786
|
+
),
|
|
65787
|
+
h3.span.class("router-recent-id").children(row.requestId),
|
|
65788
|
+
h3.span.class("router-recent-meta").children(
|
|
65789
|
+
row.decision + " \xB7 " + row.model + (row.gate === null ? "" : " \xB7 " + row.gate)
|
|
65790
|
+
)
|
|
65852
65791
|
)
|
|
65853
65792
|
)
|
|
65854
65793
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@try-works/dsh-minimal-router",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "DSH local router plugin: per-session auto-routing between a local engine and remote models, evidence pages, and a plugin-owned engine provider.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|