pi-browser-taskbar-rails 0.4.1 → 0.4.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: b48992e512d8a718a1b618173f3b2a5dfd9a72f70df0394d278833eb3e056081
4
- data.tar.gz: fb8ac8964d65d32f56b3f728534cbcbc2ae1ee78d52488f394d01f52d53c8f98
3
+ metadata.gz: ac211fa1e202d18d6e06311a3485d4c531fe560816467e6e4a9c092aba90e78c
4
+ data.tar.gz: 0f86c50dc60bbdc70e772ce5c901215d9ee3399142fbfbf39c29a7d4a44619d5
5
5
  SHA512:
6
- metadata.gz: 0e7b78edcc43e4a15b0fed7d0d6350803e49ddf26677956df9cdcb13153b544fbc53a8484a5ea06d5e3cefb18a885d8df7de7e92b92febaae7dddbca8d5d30b5
7
- data.tar.gz: 9d169c7f0f0e6c2ac861517c5316124e1b55a78de6dd227edf810bc013123a547225922cd3f7758416e672069532a13ab7c6867104a08470850a79b544d33c3c
6
+ metadata.gz: 2964a1c32e64e1ed522a2f525180dd028ddac917145f7d8b1a9facd97f2dea1e19b7be0bf12f5ec6804bb864d694dc9a3d6a918fbaf12e020636193a71fcd45d
7
+ data.tar.gz: b3a7e54048a1ae8c11cc288d965484751d029c72ed9c80d54e3561f14f82130b237dd892ca02ace605d3ba0682f42f5825666bc09b673b8d2d1082f96572dfd9
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Rails adapter changelog
2
2
 
3
- ## 0.4.1 - Unreleased
3
+ ## 0.4.2 - Unreleased
4
+
5
+ - Keep marked prompts compact by prioritizing selected element details over broad page surroundings.
6
+
7
+ ## 0.4.1 - 2026-08-04
4
8
 
5
9
  - Fall back to the browser's user-gesture copy path when the modern Clipboard API is unavailable or denied.
6
10
 
data/README.md CHANGED
@@ -12,7 +12,7 @@ Add the matching product version to the development group:
12
12
 
13
13
  ```ruby
14
14
  group :development do
15
- gem "pi-browser-taskbar-rails", "~> 0.4.1", require: "pi/browser/taskbar/rails"
15
+ gem "pi-browser-taskbar-rails", "~> 0.4.2", require: "pi/browser/taskbar/rails"
16
16
  end
17
17
  ```
18
18
 
@@ -106,6 +106,6 @@ ERB/Turbo example.
106
106
 
107
107
  ## Matching-version contract
108
108
 
109
- This adapter version is `0.4.1`. Use the same product version shown by the Phoenix adapter and the
109
+ This adapter version is `0.4.2`. Use the same product version shown by the Phoenix adapter and the
110
110
  root `VERSION`; the packaged [Conformance Contract](contract/docs/index.md) is the offline normative
111
111
  reference for both adapters.
@@ -164,12 +164,14 @@ with `template` precision and no line or element-origin claim. An invalid, overl
164
164
  missing, or browser-displaced inner boundary is classified rather than replaced with a surrounding
165
165
  layout hint. Cached and helper-generated markup may retain its enclosing template-level hint.
166
166
 
167
- Normalized lengths are measured in UTF-8 bytes: request 128 KiB, context 96 KiB, prompt 4,000,
168
- page snapshot 48 KiB/750 nodes/depth 12, and combined focus detail 48 KiB. Focus subtrees are
169
- limited to 100 nodes/depth 6. Focus selectors and complete source hints are reserved before detail;
170
- the remaining focus allocation is shared evenly in mark order, then the page receives the remaining
171
- context allocation up to its own bound. Strings use the bounds encoded by `x-maxUtf8Bytes` in the
172
- schema. Truncation occurs only at Unicode code-point boundaries, retains page and focused subtree
167
+ Normalized adapter limits are measured in UTF-8 bytes: request 128 KiB, context 96 KiB, prompt 4,000,
168
+ page snapshot 48 KiB/750 nodes/depth 12, and combined focus detail 48 KiB. The Browser Client uses
169
+ those page limits only when no marks select the whole page. With one or more marks it targets at most
170
+ 12 KiB of context, shares 8 KiB across focused detail, and keeps at most 2 KiB of page surroundings.
171
+ Focus subtrees are limited to 100 nodes/depth 6. Focus selectors and complete source hints are reserved
172
+ before detail; the remaining focus allocation is shared evenly in mark order, then the page receives
173
+ the remaining context allocation up to its active bound. Strings use the bounds encoded by
174
+ `x-maxUtf8Bytes` in the schema. Truncation occurs only at Unicode code-point boundaries, retains page and focused subtree
173
175
  nodes breadth-first, and reports affected page or `focus:1` through `focus:8` sections with canonical
174
176
  `bytes`, `nodes`, `depth`, and `string` reasons.
175
177
 
@@ -597,10 +597,17 @@
597
597
  const maximumContextBytes = 96 * 1024;
598
598
  const maximumFocusBytes = 48 * 1024;
599
599
  const maximumPageBytes = 48 * 1024;
600
+ const maximumMarkedContextBytes = 12 * 1024;
601
+ const maximumMarkedFocusBytes = 8 * 1024;
602
+ const maximumMarkedPageBytes = 2 * 1024;
600
603
 
601
604
  function browserContext(document, location, taskbarHost, route, marks, contextProvider, projectApp) {
605
+ const marked = marks.length > 0;
606
+ const contextBytes = marked ? maximumMarkedContextBytes : maximumContextBytes;
607
+ const focusBytes = marked ? maximumMarkedFocusBytes : maximumFocusBytes;
608
+ const pageBytes = marked ? maximumMarkedPageBytes : maximumPageBytes;
602
609
  const sharedState = { reasons: [] };
603
- const focus = captureFocusPoints(marks, taskbarHost, document, location, contextProvider, projectApp);
610
+ const focus = captureFocusPoints(marks, taskbarHost, document, location, contextProvider, projectApp, focusBytes);
604
611
  const pageState = { nodes: 0, reasons: sharedState.reasons };
605
612
  const snapshot = captureSnapshot(
606
613
  document.body,
@@ -613,7 +620,7 @@
613
620
  750,
614
621
  12,
615
622
  );
616
- enforceSnapshotBytes(snapshot, pageState, maximumPageBytes);
623
+ enforceSnapshotBytes(snapshot, pageState, pageBytes);
617
624
  const context = {
618
625
  contract_version: 1,
619
626
  location: sanitizedLocation(location, sharedState) || {
@@ -628,17 +635,17 @@
628
635
  };
629
636
 
630
637
  context.truncation = truncationEntries(pageState, focus.states);
631
- while (utf8Size(JSON.stringify(context)) > maximumContextBytes && trimSnapshot(snapshot)) {
638
+ while (utf8Size(JSON.stringify(context)) > contextBytes && trimSnapshot(snapshot)) {
632
639
  pageState.reasons.push("bytes");
633
640
  context.truncation = truncationEntries(pageState, focus.states);
634
641
  }
635
642
  return context;
636
643
  }
637
644
 
638
- function captureFocusPoints(marks, taskbarHost, document, location, contextProvider, projectApp) {
645
+ function captureFocusPoints(marks, taskbarHost, document, location, contextProvider, projectApp, maximumBytes) {
639
646
  if (marks.length === 0) return { points: [], states: [] };
640
- const baseAllocation = Math.floor((maximumFocusBytes - 2 - (marks.length - 1)) / marks.length);
641
- const remainder = maximumFocusBytes - 2 - (marks.length - 1) - (baseAllocation * marks.length);
647
+ const baseAllocation = Math.floor((maximumBytes - 2 - (marks.length - 1)) / marks.length);
648
+ const remainder = maximumBytes - 2 - (marks.length - 1) - (baseAllocation * marks.length);
642
649
  const states = [];
643
650
  const points = marks.map((mark, index) => {
644
651
  const state = { nodes: 0, reasons: [] };
@@ -1386,7 +1393,7 @@ function hint(status, references = []) {
1386
1393
  contractVersion: 1,
1387
1394
  contextProvider,
1388
1395
  framework: "rails",
1389
- productVersion: "0.4.1",
1396
+ productVersion: "0.4.2",
1390
1397
  refreshOnCompletion: true,
1391
1398
  });
1392
1399
 
@@ -1394,7 +1401,7 @@ function hint(status, references = []) {
1394
1401
  contractVersion: 1,
1395
1402
  framework: "rails",
1396
1403
  mount: client.mount,
1397
- productVersion: "0.4.1",
1404
+ productVersion: "0.4.2",
1398
1405
  });
1399
1406
 
1400
1407
  const bootstrap = globalThis.document?.querySelector?.("[data-pi-browser-taskbar-bootstrap]");
@@ -4,7 +4,7 @@ module Pi
4
4
  module Browser
5
5
  module Taskbar
6
6
  module Rails
7
- VERSION = "0.4.1"
7
+ VERSION = "0.4.2"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pi-browser-taskbar-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Lens
@@ -60,8 +60,8 @@ licenses:
60
60
  - MIT
61
61
  metadata:
62
62
  homepage_uri: https://github.com/davelens/pi-browser-taskbar
63
- source_code_uri: https://github.com/davelens/pi-browser-taskbar/tree/v0.4.1
64
- changelog_uri: https://github.com/davelens/pi-browser-taskbar/blob/v0.4.1/packages/rails/CHANGELOG.md
63
+ source_code_uri: https://github.com/davelens/pi-browser-taskbar/tree/v0.4.2
64
+ changelog_uri: https://github.com/davelens/pi-browser-taskbar/blob/v0.4.2/packages/rails/CHANGELOG.md
65
65
  post_install_message:
66
66
  rdoc_options: []
67
67
  require_paths: