@try-works/dsh-minimal-router 0.2.5 → 0.2.7

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.
Files changed (2) hide show
  1. package/client/index.js +21 -101
  2. package/package.json +1 -1
package/client/index.js CHANGED
@@ -65301,22 +65301,9 @@ var OverviewCss = [
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
65303
  ".router-sessions { display: flex; flex-direction: column; gap: 0; width: 100%; }",
65304
- ".router-sessions-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--spacing-4); padding-bottom: var(--spacing-2); }",
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-sessions-count { font-family: var(--font-mono); font-size: var(--text-meta); line-height: var(--leading-meta); color: var(--color-meta); }",
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
- ".router-session-row:hover { background: var(--color-subtle); }",
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
- ".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); color: var(--color-meta); flex-shrink: 0; }",
65317
- '.router-session-row[data-session-state="on"] .router-session-state { color: var(--color-ink); }',
65318
- ".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
- ".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); }",
65304
+ ,
65305
+ ,
65306
+ ".router-session-hint { padding: var(--spacing-3) 0 0; font-family: var(--font-ui); font-size: var(--text-caption); line-height: var(--leading-caption); color: var(--color-meta); text-wrap: pretty; }",
65320
65307
  ".router-meter-status { font-family: var(--font-mono); font-size: var(--text-meta); line-height: var(--leading-meta); color: var(--color-meta); overflow-wrap: anywhere; }",
65321
65308
  /* The page's own error line (the one error role) and the recent-calls list:
65322
65309
  classes, not inline styles (F-34-15). The two remaining inline values are
@@ -65330,6 +65317,7 @@ var OverviewCss = [
65330
65317
  /* P8 (ui-review finding 14 + §5): 166P-0/175S-0 the id is Inter 13/18. */
65331
65318
  ".router-recent-id { flex: 1 1 auto; min-width: 0; font-size: var(--text-label); line-height: var(--leading-label); color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; }",
65332
65319
  ".router-recent-meta { font-family: var(--font-mono); color: var(--color-meta); }",
65320
+ '.router-recent-row[data-session-state="on"] .router-recent-meta { color: var(--color-ink); }',
65333
65321
  /* P8 (ui-review finding 14): 175Q-0 stacks the 390 recent row — time + id on
65334
65322
  the first line, the meta on its own full-width second line — so a request id
65335
65323
  can no longer wrap mid-token. 1756-0's meter block tightens to gap 8 / pad 20. */
@@ -65409,21 +65397,7 @@ var OverviewMessage = UiSchema_exports.TaggedEnum({
65409
65397
  field: Schema_exports.String,
65410
65398
  message: Schema_exports.String
65411
65399
  },
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
- }
65400
+ RetryRoleSave: {}
65427
65401
  });
65428
65402
  var engineHost = (endpoint) => {
65429
65403
  if (endpoint === null) return "the configured engine";
@@ -65590,53 +65564,9 @@ var SaveSettings = Command_exports.make(
65590
65564
  )
65591
65565
  )
65592
65566
  );
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
65567
  var OverviewSessionShortId = (id2) => id2.length <= 8 ? id2 : "\u2026" + id2.slice(-8);
65635
- var OverviewSessionMeta = (row) => {
65636
- const at = row.updatedAt === null ? "" : row.updatedAt.slice(11, 16);
65637
- const hasTitle = row.title !== null && row.title.length > 0;
65638
- return [row.live ? "live" : null, at.length === 0 ? null : at, hasTitle ? OverviewSessionShortId(row.id) : null].filter((part) => part !== null).join(" \xB7 ");
65639
- };
65568
+ var OverviewSessionLabel = (row) => row.title !== null && row.title.length > 0 ? row.title : OverviewSessionShortId(row.id);
65569
+ var OverviewSessionTime = (row) => row.updatedAt === null ? "" : row.updatedAt.slice(11, 16);
65640
65570
  var OverviewDef = Html_exports.component({
65641
65571
  name: "Overview",
65642
65572
  props: Schema_exports.Struct({
@@ -65696,11 +65626,6 @@ var Overview = OverviewDef.make({
65696
65626
  // document; there is nothing to preserve in place (Run 20 R-20-01 retired the
65697
65627
  // editor that needed it).
65698
65628
  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
65629
  RequestedOpenSelect: ($, { path }) => $.evolve({ selectOpen: path }),
65705
65630
  RequestedCloseSelect: ($, { path }) => $.model.selectOpen === path ? $.evolve({ selectOpen: null }) : $.model,
65706
65631
  PickedRoleSetting: ($, { path, value: value3 }) => {
@@ -65785,28 +65710,23 @@ var Overview = OverviewDef.make({
65785
65710
  const sessions2 = model.sessions;
65786
65711
  const onCount = sessions2.filter((row) => row.enabled).length;
65787
65712
  const sessionsCard = h3.div.class("router-sessions").attr("data-sessions-card", "").children(
65788
- h3.div.class("router-sessions-head").children(
65789
- h3.span.class("router-sessions-label").children("Sessions \xB7 routing"),
65790
- h3.span.class("router-sessions-count").children(
65791
- sessions2.length === 0 ? "none" : `${onCount} of ${sessions2.length} on`
65713
+ h3.div.class("router-card-head").children(
65714
+ h3.span.class("router-caps-label").children("Sessions \xB7 routing"),
65715
+ h3.span.class("router-card-meta").children(
65716
+ sessions2.length === 0 ? "none" : `${onCount} of ${sessions2.length} routing`
65792
65717
  )
65793
65718
  ),
65794
- ...sessions2.length === 0 ? [h3.p.class("router-session-empty").children("No recent sessions")] : sessions2.map(
65795
- (row) => h3.div.class("router-session-row").attr("data-session-row", row.id).attr("data-session-state", row.enabled ? "on" : "off").children(
65796
- Checkbox(h3, {
65797
- key: "session-routing-" + row.id,
65798
- props: { checked: row.enabled, id: "session-routing-" + row.id },
65799
- onEmit: {
65800
- Toggled: ({ checked: checked2 }) => OverviewMessage.RequestedToggleSession({ sessionId: row.id, enabled: checked2 })
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))
65719
+ ...sessions2.length === 0 ? [h3.div.class("router-recent-empty").children("No recent sessions")] : sessions2.map(
65720
+ (row) => h3.div.class("router-recent-row").attr("data-session-row", row.id).attr("data-session-state", row.enabled ? "on" : "off").children(
65721
+ h3.span.class("router-recent-time").children(OverviewSessionTime(row)),
65722
+ h3.span.class("router-recent-id").children(OverviewSessionLabel(row)),
65723
+ h3.span.class("router-recent-meta").children(
65724
+ (row.live ? "live \xB7 " : "") + (row.enabled ? "routing" : "not routing")
65725
+ )
65809
65726
  )
65727
+ ),
65728
+ h3.p.class("router-session-hint").children(
65729
+ "Routing is turned on per session in the model picker."
65810
65730
  )
65811
65731
  );
65812
65732
  const recent = model.overview === null ? [] : model.overview.recent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@try-works/dsh-minimal-router",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
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",