llm_meta_widget 0.7.1 → 0.7.2

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: d31a9eff714d507069705778f72423f8c95e6a89f54b3fc2ffcac0aaa5ee3f87
4
- data.tar.gz: 935d3e398c66fc17ffb7803f5aac9968c8440875b7ecc55b430d9679710ad5f4
3
+ metadata.gz: 59b4d4a0bbd1e56e7d120de12efc7b08a9d24f4727266d57b38ab9734ea590ad
4
+ data.tar.gz: 12da0bd0ca5d9ba992bc6ece49f14d9b5351edc41ce54a31fc12bb1d0cfc6440
5
5
  SHA512:
6
- metadata.gz: 648767e2345974f46bb27ef6512fbafb0c91308b62fcc978eed6d7df1282815842dc13b825ae739f97661b2ef8067d764efa2fcdeac0ed3d1145e3cbd7d93eb1
7
- data.tar.gz: b2f584221106fd4e96cabf612df56aafb84268d89aac07c5ebfcbb6f03c10d67196de2bf33e648e533c88e6992ef820c5b0fca60b3965250322e6ad15e511b6a
6
+ metadata.gz: fa75e94a1423da2e5d696bb79f4dc65976cac6e3e3254e9ddd04da497845319628094ec0d1f4920447f8639b8ad8bc874589b9cfe3c2b1a2913c7458ecde2c93
7
+ data.tar.gz: a23d46cf796b1e348683042341afa275fe677903fa0c8235172f929d54458ad24386a4d98e2f13079135025786959770624feeb245e422641bfa291722987078
@@ -50,8 +50,6 @@ const MARKUP = `
50
50
  </div>
51
51
  <div class="lmw-messages"></div>
52
52
  <div class="lmw-input-container">
53
- host MCP server actually offers one, so a tools-only server leaves
54
- the widget exactly as it was. %>
55
53
  <div class="lmw-prompts" style="display:none"></div>
56
54
  <form class="lmw-form">
57
55
  <div class="lmw-input-wrapper">
@@ -62,25 +60,19 @@ const MARKUP = `
62
60
  </svg>
63
61
  </button>
64
62
  </div>
65
- <% if enable_model_picker || enable_tool_picker %>
66
- <div class="lmw-input-controls">
67
- <% if enable_model_picker %>
68
- <select class="lmw-model-picker" title="Select model" aria-label="Select model" style="display:none">
69
- </select>
70
- <% end %>
71
- <% if enable_tool_picker %>
72
- <details class="lmw-tools-picker">
73
- <summary>
74
- 🔧 Tools
75
- <span class="lmw-tools-count lmw-tools-count-zero">0</span>
76
- </summary>
77
- <div class="lmw-tools-list">
78
- <div class="lmw-tools-empty">Loading…</div>
79
- </div>
80
- </details>
81
- <% end %>
82
- </div>
83
- <% end %>
63
+ <div class="lmw-input-controls">
64
+ <select class="lmw-model-picker" title="Select model" aria-label="Select model" style="display:none">
65
+ </select>
66
+ <details class="lmw-tools-picker">
67
+ <summary>
68
+ 🔧 Tools
69
+ <span class="lmw-tools-count lmw-tools-count-zero">0</span>
70
+ </summary>
71
+ <div class="lmw-tools-list">
72
+ <div class="lmw-tools-empty">Loading…</div>
73
+ </div>
74
+ </details>
75
+ </div>
84
76
  </form>
85
77
  </div>
86
78
  </div>
@@ -126,6 +118,11 @@ if (typeof customElements !== "undefined" && !customElements.get("llm-meta-widge
126
118
  // Everything below is the panel's original logic, moved verbatim from the ERB
127
119
  // template. The only change is the sixteen bindings above it, which the
128
120
  // template used to inject.
121
+ // Removes a node if it is there. Used to honour the picker flags: see boot().
122
+ function dropNode(node) {
123
+ if (node && node.parentNode) node.parentNode.removeChild(node);
124
+ }
125
+
129
126
  function boot(cfg) {
130
127
  var LLM_BASE = cfg.LLM_BASE;
131
128
  var TOOL_HUB_BASE = cfg.TOOL_HUB_BASE;
@@ -151,6 +148,14 @@ function boot(cfg) {
151
148
  var inputEl = root.querySelector(".lmw-input");
152
149
  var clearBtn = root.querySelector(".lmw-clear");
153
150
  var hideBtn = root.querySelector(".lmw-hide");
151
+ // The ERB partial omitted these nodes entirely when their flag was false.
152
+ // One static template cannot express that, so prune instead — otherwise a
153
+ // disabled Tools picker still renders, and the lookups below never return
154
+ // the null the rest of boot() is written against.
155
+ if (!ENABLE_MODEL_PICKER) dropNode(root.querySelector(".lmw-model-picker"));
156
+ if (!ENABLE_TOOL_PICKER) dropNode(root.querySelector(".lmw-tools-picker"));
157
+ if (!ENABLE_MODEL_PICKER && !ENABLE_TOOL_PICKER) dropNode(root.querySelector(".lmw-input-controls"));
158
+
154
159
  var modelPicker = root.querySelector(".lmw-model-picker"); // null when disabled
155
160
  var toolsPicker = root.querySelector(".lmw-tools-picker"); // null when disabled
156
161
  var toolsListEl = root.querySelector(".lmw-tools-list"); // null when disabled
@@ -3564,8 +3564,6 @@ var MARKUP = `
3564
3564
  </div>
3565
3565
  <div class="lmw-messages"></div>
3566
3566
  <div class="lmw-input-container">
3567
- host MCP server actually offers one, so a tools-only server leaves
3568
- the widget exactly as it was. %>
3569
3567
  <div class="lmw-prompts" style="display:none"></div>
3570
3568
  <form class="lmw-form">
3571
3569
  <div class="lmw-input-wrapper">
@@ -3576,25 +3574,19 @@ var MARKUP = `
3576
3574
  </svg>
3577
3575
  </button>
3578
3576
  </div>
3579
- <% if enable_model_picker || enable_tool_picker %>
3580
- <div class="lmw-input-controls">
3581
- <% if enable_model_picker %>
3582
- <select class="lmw-model-picker" title="Select model" aria-label="Select model" style="display:none">
3583
- </select>
3584
- <% end %>
3585
- <% if enable_tool_picker %>
3586
- <details class="lmw-tools-picker">
3587
- <summary>
3588
- \u{1F527} Tools
3589
- <span class="lmw-tools-count lmw-tools-count-zero">0</span>
3590
- </summary>
3591
- <div class="lmw-tools-list">
3592
- <div class="lmw-tools-empty">Loading\u2026</div>
3593
- </div>
3594
- </details>
3595
- <% end %>
3596
- </div>
3597
- <% end %>
3577
+ <div class="lmw-input-controls">
3578
+ <select class="lmw-model-picker" title="Select model" aria-label="Select model" style="display:none">
3579
+ </select>
3580
+ <details class="lmw-tools-picker">
3581
+ <summary>
3582
+ \u{1F527} Tools
3583
+ <span class="lmw-tools-count lmw-tools-count-zero">0</span>
3584
+ </summary>
3585
+ <div class="lmw-tools-list">
3586
+ <div class="lmw-tools-empty">Loading\u2026</div>
3587
+ </div>
3588
+ </details>
3589
+ </div>
3598
3590
  </form>
3599
3591
  </div>
3600
3592
  </div>
@@ -3628,6 +3620,9 @@ var LlmMetaWidgetElement = class extends HTMLElement {
3628
3620
  if (typeof customElements !== "undefined" && !customElements.get("llm-meta-widget")) {
3629
3621
  customElements.define("llm-meta-widget", LlmMetaWidgetElement);
3630
3622
  }
3623
+ function dropNode(node) {
3624
+ if (node && node.parentNode) node.parentNode.removeChild(node);
3625
+ }
3631
3626
  function boot(cfg) {
3632
3627
  var LLM_BASE = cfg.LLM_BASE;
3633
3628
  var TOOL_HUB_BASE = cfg.TOOL_HUB_BASE;
@@ -3652,6 +3647,9 @@ function boot(cfg) {
3652
3647
  var inputEl = root.querySelector(".lmw-input");
3653
3648
  var clearBtn = root.querySelector(".lmw-clear");
3654
3649
  var hideBtn = root.querySelector(".lmw-hide");
3650
+ if (!ENABLE_MODEL_PICKER) dropNode(root.querySelector(".lmw-model-picker"));
3651
+ if (!ENABLE_TOOL_PICKER) dropNode(root.querySelector(".lmw-tools-picker"));
3652
+ if (!ENABLE_MODEL_PICKER && !ENABLE_TOOL_PICKER) dropNode(root.querySelector(".lmw-input-controls"));
3655
3653
  var modelPicker = root.querySelector(".lmw-model-picker");
3656
3654
  var toolsPicker = root.querySelector(".lmw-tools-picker");
3657
3655
  var toolsListEl = root.querySelector(".lmw-tools-list");
@@ -1,3 +1,3 @@
1
1
  module LlmMetaWidget
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
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.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jdkim