@try-works/dsh-minimal-router 0.2.9 → 0.2.10

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 CHANGED
@@ -66593,7 +66593,7 @@ if (typeof document !== "undefined" && document.head !== null) {
66593
66593
  }
66594
66594
 
66595
66595
  // packages/plugin/client/build-id.ts
66596
- var clientBuildId = true ? "4a126a53d02583520651b76b4b49b45e5134698c4a06c6bba43972cb6e7cde36" : "";
66596
+ var clientBuildId = true ? "1dbd2458264821f73fdb071091ded379e8ee44725853e8bd4ca9d76816f7aaa0" : "";
66597
66597
  var compareBuildIds = (hostId, clientId) => {
66598
66598
  const host = typeof hostId === "string" && hostId.length > 0 ? hostId : null;
66599
66599
  const client = typeof clientId === "string" && clientId.length > 0 ? clientId : null;
package/lib/build-id.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // GENERATED by scripts/build-id.mjs - do not edit by hand.
2
2
  // sha256 over the canonical 19-file list (11 plugin lib + 8 domain contract
3
3
  // sources), so a domain-contract change moves the id too (DEC-30-01).
4
- export const buildId = "4a126a53d02583520651b76b4b49b45e5134698c4a06c6bba43972cb6e7cde36"
4
+ export const buildId = "1dbd2458264821f73fdb071091ded379e8ee44725853e8bd4ca9d76816f7aaa0"
package/lib/index.js CHANGED
@@ -1506,8 +1506,25 @@ export function apply(ctx, config = {}) {
1506
1506
  )
1507
1507
  } catch {}
1508
1508
  }
1509
+ // The live path first: DSH's own projection registry already holds the folded
1510
+ // title for an attached session, so it needs no file layout at all.
1511
+ const liveTitleOf = (sessionId) => {
1512
+ try {
1513
+ const sessions = typeof ctx.get === "function" ? ctx.get("sessions") : undefined
1514
+ const projections = typeof ctx.get === "function" ? ctx.get("sessionProjections") : undefined
1515
+ const session = typeof sessions?.get === "function" ? sessions.get(sessionId) : undefined
1516
+ if (session === undefined || session === null || typeof projections?.stateOf !== "function") return null
1517
+ const state = projections.stateOf(session, "title")
1518
+ const text = typeof state === "string" ? state.trim().replace(/\s+/gu, " ") : ""
1519
+ return text.length === 0 ? null : text.length > 72 ? text.slice(0, 72).trimEnd() + "…" : text
1520
+ } catch {
1521
+ return null
1522
+ }
1523
+ }
1509
1524
  const titleOfSession = (sessionId) => {
1510
1525
  if (typeof sessionId !== "string" || sessionId.length === 0) return null
1526
+ const live = liveTitleOf(sessionId)
1527
+ if (live !== null) return live
1511
1528
  const tried = []
1512
1529
  for (const root of storageRoots()) {
1513
1530
  const file = path.join(root, "session_projcache", "sessions", sessionId + ".json")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@try-works/dsh-minimal-router",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
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",