llm_meta_widget 0.15.0 → 0.15.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8797cb824bc5421990348a5de7fabd7eb95a0ec0c10f8e2d579d29d3483e7b29
4
- data.tar.gz: 8151a9ab5e27e0e1bd1f46d62750e2a41137660d65c501713e9a10e94269858f
3
+ metadata.gz: 5b7d8d8ce878a102002639b418702b741535fb67a23002ed74a6bb8382b4791f
4
+ data.tar.gz: 9f2482cef0da260962f8fa2ff5d78952d6bdf6d6ae9bdbab2b3abe9348d8b2b9
5
5
  SHA512:
6
- metadata.gz: 12d33498cb17917ebc7f6a5950185b003267c52eab06f50e9632d36e5fd7e9c1bfe54d18134be7bc5e9082ff4c5e087769b0235983ff72aa6ec3dbd8461641af
7
- data.tar.gz: 0f2975b8f85714bb11e64b43192755e26b61f90a9a80e6f20871895a76e292bfbb3f245c7e7f679e81331f1ab9be7d0362e91b8ce4e32b96d16ac10ce9eb8ded
6
+ metadata.gz: dc3ad442ac618dd9f8fa74af526a2d6e5a4d042a318af9492da7a5482dcb92f7fdcc1b22e004cdb5c6ce8d1b226ae81d9d425535d714ccac188fed1e6a6522e5
7
+ data.tar.gz: aa0875cbba4e0af9d92588db27718bf846143b019510418209c5146972a245223e6f92e7e5927cdd9f8a0de2a884b14f76db8fb885b276c4873b1c01b35f5956
data/CHANGELOG.md CHANGED
@@ -3,6 +3,32 @@
3
3
  This file starts at 0.8.0, the first release with a breaking change worth
4
4
  calling out. Earlier releases are in the git history (`git log --oneline v0.7.6`).
5
5
 
6
+ ## 0.15.1
7
+
8
+ ### A repeat visit no longer loses the model's context window or the hub tools
9
+
10
+ The hub answers `/api/llms` and `/api/mcp_servers` with an ETag and
11
+ `must-revalidate`, so a browser revalidated them on the second page load and
12
+ got `304 Not Modified`. `Response.ok` is false for a 304, and both handlers
13
+ turned that into an empty payload.
14
+
15
+ Nothing announced it. Without the model's context window the resource budget
16
+ fell to its 8 KB floor, so a page's reference data was reported as skipped even
17
+ when it would have fitted; and tool-result truncation and oldest-result
18
+ eviction both stood down, because each returns its input unchanged when it has
19
+ no window to spend. An empty hub list meanwhile showed as "No hub-registered
20
+ tools available". It all worked on a first load and stopped on every one after,
21
+ which is why a hard reload always looked fine.
22
+
23
+ Both requests now set `cache: "no-store"`, so no conditional request is sent
24
+ and the answer always carries a body. A response that is not ok is reported in
25
+ the browser console, naming what is lost, rather than being treated as an empty
26
+ result.
27
+
28
+ The hub stopped sending those ETags as well, so this release is not required to
29
+ fix a page served by an up-to-date hub. It matters for any other server that
30
+ does send them, and for making the next failure audible.
31
+
6
32
  ## 0.15.0
7
33
 
8
34
  ### The declared global is resolved when a handler is needed, not at startup
data/README.md CHANGED
@@ -61,7 +61,7 @@ Option 3 if it does not.
61
61
 
62
62
  ```ruby
63
63
  # Gemfile
64
- gem "llm_meta_widget", "~> 0.15.0"
64
+ gem "llm_meta_widget", "~> 0.15.1"
65
65
  ```
66
66
 
67
67
  ```bash
@@ -503,8 +503,21 @@ function boot(cfg) {
503
503
  if (flat.length > 1) modelPicker.style.display = "";
504
504
  }));
505
505
  } else if (ENABLE_MODEL_PICKER && modelPicker) {
506
- tasks.push(fetch(LLM_BASE + "/api/llms", { headers: { "Accept": "application/json" } })
507
- .then(function(r) { return r.ok ? r.json() : { llms: [] }; })
506
+ // cache: "no-store" so the browser never sends a conditional request. The
507
+ // hub answers /api/llms with an ETag and must-revalidate, so a REPEAT visit
508
+ // got 304 Not Modified — and Response.ok is false for a 304, which became
509
+ // an empty payload here. The model's context window was then unknown, so
510
+ // the resource budget fell to its 8 KB floor and BOTH tool-result
511
+ // truncation and eviction stood down, each returning unchanged without a
512
+ // window. It worked on a first load and quietly stopped on every one after.
513
+ tasks.push(fetch(LLM_BASE + "/api/llms", { headers: { "Accept": "application/json" }, cache: "no-store" })
514
+ .then(function(r) {
515
+ if (r.ok) return r.json();
516
+ console.warn("[llm-meta-widget] /api/llms answered " + r.status +
517
+ "; the model context window is unknown, so reference data is" +
518
+ " budgeted at the floor and oversized tool results are not trimmed");
519
+ return { llms: [] };
520
+ })
508
521
  .then(function(payload) {
509
522
  // /api/llms is heterogeneous per family:
510
523
  // - OpenAI/Anthropic/Google: `models: [{ name, display_name, ... }]`
@@ -551,8 +564,16 @@ function boot(cfg) {
551
564
  }
552
565
 
553
566
  if (ENABLE_TOOL_PICKER && toolsListEl) {
554
- tasks.push(fetch(TOOL_HUB_BASE + "/api/mcp_servers", { headers: { "Accept": "application/json" } })
555
- .then(function(r) { return r.ok ? r.json() : { mcp_servers: [] }; })
567
+ // Same reason as /api/llms above: a 304 on a repeat visit emptied this, and
568
+ // the panel then said "No hub-registered tools available" although the hub
569
+ // had them.
570
+ tasks.push(fetch(TOOL_HUB_BASE + "/api/mcp_servers", { headers: { "Accept": "application/json" }, cache: "no-store" })
571
+ .then(function(r) {
572
+ if (r.ok) return r.json();
573
+ console.warn("[llm-meta-widget] /api/mcp_servers answered " + r.status +
574
+ "; hub-registered tools will be listed as unavailable");
575
+ return { mcp_servers: [] };
576
+ })
556
577
  .then(function(payload) {
557
578
  hubMcpServers = (payload.mcp_servers || []).filter(function(s) {
558
579
  return anyAllowedByAllowlist(s.name, HUB_TOOLS_ALLOWLIST);
@@ -4270,8 +4270,10 @@ function boot(cfg) {
4270
4270
  if (flat.length > 1) modelPicker.style.display = "";
4271
4271
  }));
4272
4272
  } else if (ENABLE_MODEL_PICKER && modelPicker) {
4273
- tasks.push(fetch(LLM_BASE + "/api/llms", { headers: { "Accept": "application/json" } }).then(function(r) {
4274
- return r.ok ? r.json() : { llms: [] };
4273
+ tasks.push(fetch(LLM_BASE + "/api/llms", { headers: { "Accept": "application/json" }, cache: "no-store" }).then(function(r) {
4274
+ if (r.ok) return r.json();
4275
+ console.warn("[llm-meta-widget] /api/llms answered " + r.status + "; the model context window is unknown, so reference data is budgeted at the floor and oversized tool results are not trimmed");
4276
+ return { llms: [] };
4275
4277
  }).then(function(payload) {
4276
4278
  llmsPayload = payload;
4277
4279
  modelWindow = modelWindowFrom(payload, MODEL);
@@ -4304,8 +4306,10 @@ function boot(cfg) {
4304
4306
  }));
4305
4307
  }
4306
4308
  if (ENABLE_TOOL_PICKER && toolsListEl) {
4307
- tasks.push(fetch(TOOL_HUB_BASE + "/api/mcp_servers", { headers: { "Accept": "application/json" } }).then(function(r) {
4308
- return r.ok ? r.json() : { mcp_servers: [] };
4309
+ tasks.push(fetch(TOOL_HUB_BASE + "/api/mcp_servers", { headers: { "Accept": "application/json" }, cache: "no-store" }).then(function(r) {
4310
+ if (r.ok) return r.json();
4311
+ console.warn("[llm-meta-widget] /api/mcp_servers answered " + r.status + "; hub-registered tools will be listed as unavailable");
4312
+ return { mcp_servers: [] };
4309
4313
  }).then(function(payload) {
4310
4314
  hubMcpServers = (payload.mcp_servers || []).filter(function(s) {
4311
4315
  return anyAllowedByAllowlist(s.name, HUB_TOOLS_ALLOWLIST);
@@ -1,3 +1,3 @@
1
1
  module LlmMetaWidget
2
- VERSION = "0.15.0"
2
+ VERSION = "0.15.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm_meta_widget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jdkim