@linxin666/dsh-remote-bridge 0.4.7 → 0.4.9

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 (78) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +93 -26
  3. package/README.zh.md +91 -26
  4. package/icon.svg +3 -0
  5. package/lib/client.js +274 -253
  6. package/lib/client.js.map +1 -1
  7. package/lib/index.js +8891 -2433
  8. package/lib/types/client/PairEntry.d.ts +2 -2
  9. package/lib/types/client/PairPanel.d.ts +10 -2
  10. package/lib/types/client/icons.d.ts +5 -13
  11. package/lib/types/client/locales.d.ts +10 -14
  12. package/lib/types/client/semantic.d.ts +9 -5
  13. package/lib/types/core/approvals.d.ts +24 -0
  14. package/lib/types/core/commands.d.ts +59 -0
  15. package/lib/types/core/connection.d.ts +124 -5
  16. package/lib/types/core/delta.d.ts +101 -0
  17. package/lib/types/core/devices.d.ts +98 -2
  18. package/lib/types/core/dsh-frames.d.ts +155 -4
  19. package/lib/types/core/envelope.d.ts +34 -0
  20. package/lib/types/core/extension.d.ts +144 -0
  21. package/lib/types/core/hub.d.ts +96 -20
  22. package/lib/types/core/jobs.d.ts +204 -0
  23. package/lib/types/core/liveactivity.d.ts +324 -0
  24. package/lib/types/core/protocol.d.ts +491 -2
  25. package/lib/types/core/push.d.ts +178 -0
  26. package/lib/types/core/questions.d.ts +109 -9
  27. package/lib/types/core/session-meta.d.ts +55 -1
  28. package/lib/types/core/squads.d.ts +130 -0
  29. package/lib/types/core/usage-stats.d.ts +160 -0
  30. package/lib/types/core/usage.d.ts +294 -0
  31. package/lib/types/core/wire.d.ts +1 -1
  32. package/lib/types/core/ws-frames.d.ts +11 -0
  33. package/lib/types/host/apns.d.ts +151 -0
  34. package/lib/types/host/squads-ledger.d.ts +39 -0
  35. package/lib/types/host/squads.d.ts +77 -0
  36. package/lib/types/host/usage-stats.d.ts +75 -0
  37. package/lib/types/host/watchers.d.ts +88 -0
  38. package/lib/types/host/websocket.d.ts +8 -1
  39. package/lib/types/index.d.ts +34 -3
  40. package/lib/types/mount-once.d.ts +55 -0
  41. package/locale/en.json +6 -0
  42. package/locale/ru.json +6 -0
  43. package/locale/zh.json +6 -0
  44. package/package.json +20 -14
  45. package/src/client/PairEntry.tsx +58 -31
  46. package/src/client/PairPanel.tsx +181 -97
  47. package/src/client/icons.tsx +17 -60
  48. package/src/client/locales.ts +15 -23
  49. package/src/client/panel.module.css +239 -186
  50. package/src/client/semantic.ts +10 -6
  51. package/src/core/approvals.ts +32 -1
  52. package/src/core/commands.ts +95 -0
  53. package/src/core/connection.ts +1483 -31
  54. package/src/core/delta.ts +204 -0
  55. package/src/core/devices.ts +221 -3
  56. package/src/core/dsh-frames.ts +365 -8
  57. package/src/core/envelope.ts +46 -0
  58. package/src/core/extension.ts +197 -0
  59. package/src/core/hub.ts +441 -49
  60. package/src/core/jobs.ts +372 -0
  61. package/src/core/liveactivity.ts +833 -0
  62. package/src/core/protocol.ts +556 -2
  63. package/src/core/push.ts +354 -0
  64. package/src/core/questions.ts +264 -17
  65. package/src/core/session-meta.ts +73 -1
  66. package/src/core/squads.ts +345 -0
  67. package/src/core/usage-stats.ts +424 -0
  68. package/src/core/usage.ts +937 -0
  69. package/src/core/wire.ts +13 -1
  70. package/src/core/ws-frames.ts +14 -0
  71. package/src/host/apns.ts +320 -0
  72. package/src/host/squads-ledger.ts +105 -0
  73. package/src/host/squads.ts +206 -0
  74. package/src/host/usage-stats.ts +155 -0
  75. package/src/host/watchers.ts +272 -0
  76. package/src/host/websocket.ts +37 -3
  77. package/src/index.ts +310 -9
  78. package/src/mount-once.ts +142 -0
@@ -1,8 +1,45 @@
1
- /* Protocol v1 pairing panel: the sidebar-foot trigger plus the QR modal.
2
- Design tokens only — no literal colors. The modal follows the family's
3
- centered overlay + card contract (mask, 24px radius, layer-2 surface). */
4
-
5
- /* ── Sidebar foot trigger ── */
1
+ /* Protocol v1 pairing panel: the sidebar-foot seat plus the QR modal card.
2
+ Colour comes only from the theme's semantic aliases. Geometry, spacing and
3
+ type resolve through the scale below, so no element carries a one-off literal
4
+ (KFL R4 centralizes the value; A3 keeps one spacing rhythm; H5 holds the view
5
+ to three type sizes: 15 title / 13 body / 12 status). */
6
+
7
+ /* ── One geometry scale for the seat and the card ──
8
+
9
+ Four spacing tiers, one type tier per hierarchy level, the symbol's fixed
10
+ module, and the two hit areas. The rule below repeats the selector for each
11
+ root that needs the scale: the seat and the card are siblings in different
12
+ trees, so custom properties cannot be inherited from one shared ancestor. */
13
+ .panel,
14
+ .trigger,
15
+ .dialog {
16
+ --pair-space-1: 4px;
17
+ --pair-space-2: 8px;
18
+ --pair-space-3: 12px;
19
+ --pair-space-4: 24px;
20
+ --pair-title-size: 15px;
21
+ --pair-title-line: 24px;
22
+ --pair-text-size: 13px;
23
+ --pair-text-line: 20px;
24
+ --pair-state-size: 12px;
25
+ --pair-state-line: 18px;
26
+ --pair-qr: 184px;
27
+ --pair-bar: 4px;
28
+ --pair-seat: 36px;
29
+ --pair-close: 28px;
30
+ --pair-hit: 44px;
31
+ --pair-width: 460px;
32
+ --pair-faded: 0.35;
33
+ --pair-focus-offset: 2px;
34
+ /* The live status row's whole box: one text line, its gap and the bar. The
35
+ expired sentence occupies the same box, so the flip moves nothing. */
36
+ --pair-status: calc(var(--pair-state-line) + var(--pair-space-1) + var(--pair-bar));
37
+ /* The address line's reserved box: the located line and the missing-address
38
+ warning each fill it, so neither the hint nor the action row below moves. */
39
+ --pair-address: calc(var(--pair-text-line) * 2);
40
+ }
41
+
42
+ /* ── Sidebar foot seat ── */
6
43
 
7
44
  .trigger {
8
45
  position: relative;
@@ -10,8 +47,8 @@
10
47
  display: inline-flex;
11
48
  align-items: center;
12
49
  justify-content: center;
13
- width: 36px;
14
- height: 36px;
50
+ width: var(--pair-seat);
51
+ height: var(--pair-seat);
15
52
  border: none;
16
53
  border-radius: 50%;
17
54
  padding: 0;
@@ -20,7 +57,16 @@
20
57
  cursor: pointer;
21
58
  /* Ahead of the update/remote stack in the shared footer-action seat. */
22
59
  order: -1;
23
- transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
60
+ transition: background-color var(--ds-transition-duration) ease, color var(--ds-transition-duration) ease;
61
+ }
62
+
63
+ /* The 36px visual keeps its size; the negative inset grows the pointer and
64
+ touch target to var(--pair-hit) without touching the seat's geometry (I3). */
65
+ .trigger::after {
66
+ content: '';
67
+ position: absolute;
68
+ inset: calc((var(--pair-hit) - var(--pair-seat)) / -2);
69
+ border-radius: 50%;
24
70
  }
25
71
 
26
72
  .trigger:hover:not(:disabled) {
@@ -32,9 +78,14 @@
32
78
  background: var(--dsw-alias-interactive-bg-active);
33
79
  }
34
80
 
81
+ /* The seat is the one control this package still draws itself (see icons.tsx for
82
+ the QR exception): the official Button has no circular seat variant, and the
83
+ seat's geometry belongs to the shell's footer row. Its states therefore read
84
+ the very slots the library's ghost variant reads — hover, active and the
85
+ family's declared focus ring — so the two never diverge in behaviour. */
35
86
  .trigger:focus-visible {
36
- outline: none;
37
- box-shadow: 0 0 0 2px var(--dsw-alias-bg-layer-2), 0 0 0 4px var(--dsw-alias-brand-primary);
87
+ outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
88
+ outline-offset: var(--pair-focus-offset);
38
89
  }
39
90
 
40
91
  /* ── Rail seat geometry (official-shell compatibility) ──
@@ -44,55 +95,83 @@
44
95
  rail mode stack the seat vertically, keeping every occupant in the 36px
45
96
  column the shell uses elsewhere. The selector carries no class names (they
46
97
  stay global under CSS Modules) and matches only a seat that actually holds
47
- this trigger. */
98
+ this trigger. The gap keeps a fallback literal because this rule targets the
99
+ seat element itself, which is outside this plugin's token scope. */
48
100
  [class*='footerActions']:has([data-dsh-plugin='remote-bridge'][data-wide='rail']) {
49
101
  flex-direction: column;
50
102
  align-items: center;
51
- gap: 4px;
103
+ gap: var(--pair-space-1, 4px);
52
104
  }
53
105
 
54
- /* ── Centered modal ── */
106
+ /* ── The headless card the official Modal renders ──
55
107
 
56
- .overlay {
57
- position: fixed;
58
- inset: 0;
59
- z-index: 1000;
60
- display: flex;
61
- align-items: center;
62
- justify-content: center;
108
+ The library owns the overlay, the mask, the radius, the elevation and the
109
+ card's own fade-in; this class only sizes the card for the 184px symbol and
110
+ pads it. Both declarations repeat the class so they win over the library's
111
+ own .dialog rule whichever order the two stylesheets are injected in. */
112
+ .dialog.dialog {
113
+ width: min(var(--pair-width), 100%);
114
+ max-height: 100%;
115
+ padding: var(--pair-space-4);
116
+ overflow: auto;
63
117
  }
64
118
 
65
- .mask {
66
- position: absolute;
67
- inset: 0;
68
- background: var(--dsw-alias-bg-mask-1);
69
- backdrop-filter: var(--dsw-mask-blur);
70
- }
119
+ /* ── Panel ── */
71
120
 
72
121
  .panel {
73
- position: relative;
74
- z-index: 1;
75
122
  display: flex;
76
123
  flex-direction: column;
77
- gap: 14px;
124
+ gap: var(--pair-space-3);
78
125
  box-sizing: border-box;
79
- width: 460px;
80
- max-width: calc(100vw - 48px);
81
- max-height: calc(100vh - 48px);
82
- overflow: auto;
83
- padding: 24px;
84
- border-radius: 24px;
85
- background: var(--dsw-alias-bg-layer-2);
86
- box-shadow: var(--dsw-shadow-lv3);
126
+ width: 100%;
127
+ max-width: 100%;
87
128
  color: var(--dsw-alias-label-primary);
88
- font-size: 14px;
89
- line-height: 22px;
90
- }
129
+ font-size: var(--pair-text-size);
130
+ line-height: var(--pair-text-line);
131
+ /* The leave leg's second shape: a fade that needs no keyframe name. It is
132
+ what the reduced-motion path runs, and what a browser that cannot report
133
+ the dialog's keyframe name falls back to. */
134
+ transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out);
135
+ }
136
+
137
+ /* ── Leave leg (M1/M2) ──
138
+
139
+ The library animates the card in with its own opacity-only `modalEnter` and
140
+ returns null the instant `open` goes false, so the exit is this plugin's: the
141
+ panel stays mounted and plays that same keyframe backwards — same name, same
142
+ duration, same curve, direction reversed — which is the enter path read in the
143
+ opposite direction. `--pair-exit-name` carries that name because the bundler
144
+ scopes the library's keyframes, so the name cannot be written here; PairPanel
145
+ reads it off the mounted dialog when closing starts and clears it on reopen.
146
+ With no name the declaration resolves to `none` and the card falls back to the
147
+ transition on .panel, which is also what reduced motion runs.
148
+
149
+ Known limitation, recorded rather than hidden: the mask's own fade-in belongs
150
+ to the library's .mask::after and its name is scoped the same way, so the
151
+ overlay behind this reverse fade cannot be reversed and clears with the node.
152
+ Reusing a scoped keyframe from outside the library's stylesheet is not
153
+ possible, and duplicating the mask to animate it would fork the primitive. */
154
+ .panel[data-closing] {
155
+ opacity: 0;
156
+ animation: var(--pair-exit-name, none) var(--ds-transition-duration) var(--ds-ease-in-out) reverse both;
157
+ }
158
+
159
+ /* Reduced motion (M5): the library drops its own animation, so the leave leg
160
+ keeps the lifecycle with one short opacity fade instead of no motion at all.
161
+ No travel, no size change, no focus move: the layout is identical to the
162
+ settled state while the fade runs, and the dialog stays mounted until it ends. */
163
+ @media (prefers-reduced-motion: reduce) {
164
+ .panel[data-closing] {
165
+ animation: none;
166
+ }
167
+ }
168
+
169
+ /* ── Header ── */
91
170
 
92
171
  .header {
93
172
  display: flex;
94
173
  align-items: flex-start;
95
- gap: 12px;
174
+ gap: var(--pair-space-3);
96
175
  }
97
176
 
98
177
  .heading {
@@ -102,243 +181,217 @@
102
181
 
103
182
  .title {
104
183
  margin: 0;
105
- font-size: 18px;
184
+ font-size: var(--pair-title-size);
106
185
  font-weight: 600;
107
- line-height: 26px;
186
+ line-height: var(--pair-title-line);
108
187
  }
109
188
 
110
189
  .subtitle {
111
- margin: 4px 0 0;
190
+ margin: var(--pair-space-1) 0 0;
112
191
  color: var(--dsw-alias-label-secondary);
113
- font-size: 13px;
114
- line-height: 20px;
192
+ font-size: var(--pair-text-size);
193
+ line-height: var(--pair-text-line);
115
194
  }
116
195
 
117
- .closeButton {
196
+ /* Official ghost/sm control: the library owns hover, focus and disabled, and
197
+ the negative inset below restores the 44px target around its 28px box (I3). */
198
+ .close {
199
+ position: relative;
118
200
  flex: none;
119
- display: inline-flex;
120
- align-items: center;
121
- justify-content: center;
122
- width: 28px;
123
- height: 28px;
124
- border: none;
125
- border-radius: 8px;
201
+ width: var(--pair-close);
126
202
  padding: 0;
127
- background: transparent;
128
203
  color: var(--dsw-alias-label-secondary);
129
- cursor: pointer;
130
- transition: background-color 120ms ease, color 120ms ease;
131
204
  }
132
205
 
133
- .closeButton:hover {
134
- background: var(--dsw-alias-interactive-bg-hover);
135
- color: var(--dsw-alias-label-primary);
206
+ .close::after {
207
+ content: '';
208
+ position: absolute;
209
+ inset: calc((var(--pair-hit) - var(--pair-close)) / -2);
210
+ border-radius: 50%;
136
211
  }
137
212
 
138
- .closeButton:focus-visible {
139
- outline: none;
140
- box-shadow: 0 0 0 2px var(--dsw-alias-bg-layer-2), 0 0 0 4px var(--dsw-alias-brand-primary);
213
+ /* ── Body ── */
214
+
215
+ .body {
216
+ display: flex;
217
+ flex-direction: column;
218
+ gap: var(--pair-space-2);
141
219
  }
142
220
 
143
- /* ── QR card ── */
221
+ /* ── QR card ──
144
222
 
223
+ The symbol's box is a fixed module, so the card the read leaves behind and
224
+ the card the code arrives in are the same height (A4), and the status row's
225
+ height is fixed too: the countdown and the expiry sentence share one box. */
145
226
  .qrCard {
146
227
  display: flex;
147
228
  flex-direction: column;
148
229
  align-items: center;
149
- gap: 10px;
150
- padding: 18px;
230
+ gap: var(--pair-space-2);
231
+ padding: var(--pair-space-3);
151
232
  border: 1px solid var(--dsw-alias-border-l2);
152
- border-radius: 16px;
233
+ border-radius: var(--dsw-radius-lg);
153
234
  background: var(--dsw-alias-bg-layer-1);
154
235
  }
155
236
 
156
237
  /* No background of its own: QRCodeSVG paints its full-size white quiet zone
157
- itself (its default bgColor), so the symbol keeps scanner contrast in either
158
- theme and this wrapper adds no literal colour. */
159
- .qrWrap {
238
+ itself, so the symbol keeps scanner contrast in either theme and this box
239
+ adds no literal colour. */
240
+ .qrSlot {
160
241
  display: flex;
161
242
  align-items: center;
162
243
  justify-content: center;
244
+ width: var(--pair-qr);
245
+ height: var(--pair-qr);
246
+ }
247
+
248
+ /* An expired code stops looking scannable without moving or resizing: the
249
+ symbol keeps its box and only loses contrast. */
250
+ .qrSlot[data-expired] {
251
+ opacity: var(--pair-faded);
163
252
  }
164
253
 
165
- .qr {
254
+ .skeleton {
166
255
  display: block;
167
- width: 184px;
168
- height: 184px;
256
+ width: var(--pair-qr);
257
+ height: var(--pair-qr);
258
+ border-radius: var(--dsw-radius-md);
259
+ background: var(--dsw-alias-interactive-bg-hover);
169
260
  }
170
261
 
171
- .countdown {
262
+ .status {
172
263
  display: flex;
173
264
  flex-direction: column;
174
265
  align-items: center;
175
- gap: 6px;
266
+ justify-content: center;
267
+ gap: var(--pair-space-1);
268
+ box-sizing: border-box;
176
269
  width: 100%;
270
+ height: var(--pair-status);
177
271
  }
178
272
 
179
- .countdownText {
273
+ .statusText {
274
+ margin: 0;
180
275
  color: var(--dsw-alias-label-secondary);
181
- font-size: 13px;
182
- line-height: 18px;
276
+ font-size: var(--pair-state-size);
277
+ line-height: var(--pair-state-line);
183
278
  font-variant-numeric: tabular-nums;
184
279
  }
185
280
 
186
281
  .bar {
187
282
  display: block;
188
283
  width: 100%;
189
- height: 4px;
284
+ height: var(--pair-bar);
190
285
  overflow: hidden;
191
- border-radius: 999px;
286
+ border-radius: var(--dsw-radius-xs);
192
287
  background: var(--dsw-alias-interactive-bg-hover);
193
288
  }
194
289
 
195
290
  .barFill {
196
291
  display: block;
197
292
  height: 100%;
198
- border-radius: 999px;
293
+ border-radius: var(--dsw-radius-xs);
199
294
  background: var(--dsw-alias-brand-primary);
200
- transition: width 1s linear;
295
+ transition: width var(--ds-transition-duration) linear;
201
296
  }
202
297
 
203
- /* ── Plaintext code ── */
298
+ /* ── Supporting group under the card ── */
204
299
 
205
- .tokenRow {
300
+ .address {
206
301
  display: flex;
207
- flex-direction: column;
208
- gap: 4px;
209
- min-width: 0;
302
+ align-items: center;
303
+ min-height: var(--pair-address);
304
+ margin: 0;
305
+ color: var(--dsw-alias-label-secondary);
306
+ font-size: var(--pair-text-size);
307
+ line-height: var(--pair-text-line);
210
308
  }
211
309
 
212
- .tokenLabel {
213
- color: var(--dsw-alias-label-secondary);
214
- font-size: 13px;
215
- line-height: 18px;
310
+ /* The warn state slot is the shell's own text colour for a warning line; there
311
+ is no label-warning alias in the theme, and inventing one here would put a
312
+ literal hue outside the declared palette. */
313
+ .address[data-tone='warning'] {
314
+ color: var(--dsw-alias-state-warn-primary);
216
315
  }
217
316
 
218
- .token {
219
- display: block;
220
- padding: 8px 10px;
221
- border: 1px solid var(--dsw-alias-border-l2);
222
- border-radius: 8px;
223
- background: var(--dsw-alias-bg-layer-1);
224
- color: var(--dsw-alias-label-primary);
225
- font-family: var(--dsw-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
226
- font-size: 12px;
227
- line-height: 18px;
228
- word-break: break-all;
229
- user-select: all;
317
+ .hint {
318
+ margin: 0;
319
+ color: var(--dsw-alias-label-tertiary);
320
+ font-size: var(--pair-text-size);
321
+ line-height: var(--pair-text-line);
230
322
  }
231
323
 
232
- /* ── Notices ── */
324
+ /* ── Refusals ── */
233
325
 
234
326
  .notice {
235
- padding: 10px 12px;
236
- border: 1px solid var(--dsw-alias-border-l2);
237
- border-radius: 12px;
327
+ display: flex;
328
+ align-items: flex-start;
329
+ gap: var(--pair-space-2);
330
+ padding: var(--pair-space-3);
331
+ border: 1px solid var(--dsw-alias-state-error-primary);
332
+ border-radius: var(--dsw-radius-md);
238
333
  background: var(--dsw-alias-bg-layer-1);
239
334
  }
240
335
 
241
- .notice[data-tone='alert'] {
242
- border-color: var(--dsw-alias-state-error-primary);
336
+ .noticeIcon {
337
+ flex: none;
338
+ display: inline-flex;
339
+ color: var(--dsw-alias-state-error-primary);
243
340
  }
244
341
 
245
- .notice[data-tone='warning'] {
246
- border-color: var(--dsw-alias-state-warn-primary);
342
+ .noticeCopy {
343
+ min-width: 0;
247
344
  }
248
345
 
249
346
  .noticeTitle {
250
347
  margin: 0;
348
+ font-size: var(--pair-text-size);
251
349
  font-weight: 600;
252
- line-height: 20px;
350
+ line-height: var(--pair-text-line);
253
351
  }
254
352
 
255
- .noticeBody {
256
- margin: 4px 0 0;
353
+ .noticeText {
354
+ margin: var(--pair-space-1) 0 0;
257
355
  color: var(--dsw-alias-label-secondary);
258
- font-size: 13px;
259
- line-height: 20px;
356
+ font-size: var(--pair-text-size);
357
+ line-height: var(--pair-text-line);
260
358
  }
261
359
 
262
- .hint {
263
- margin: 0;
264
- color: var(--dsw-alias-label-tertiary);
265
- font-size: 12px;
266
- line-height: 18px;
267
- }
268
-
269
- /* ── Actions ── */
360
+ /* ── Action row ── */
270
361
 
271
362
  .actions {
272
363
  display: flex;
273
- justify-content: flex-end;
274
- gap: 8px;
275
- }
276
-
277
- /* The panel's one primary action: a filled button over the primary-action
278
- token trio, so a skin's light and dark sets both keep readable contrast.
279
- brand-primary must not be a fill colour (it equals the foreground). */
280
- .refresh {
281
- display: inline-flex;
282
- align-items: center;
283
- gap: 6px;
284
- height: 32px;
285
- border: none;
286
- border-radius: 16px;
287
- padding: 0 16px;
288
- background: var(--dsw-alias-button-primary-fill);
289
- color: var(--dsw-alias-label-primary-foreground);
290
- font-size: 14px;
291
- line-height: 20px;
292
- cursor: pointer;
293
- transition: background-color 120ms ease;
294
- }
295
-
296
- .refresh:hover:not(:disabled) {
297
- background: var(--dsw-alias-button-primary-hover);
298
- }
299
-
300
- .refresh:disabled {
301
- opacity: 0.5;
302
- cursor: default;
303
- }
304
-
305
- .refresh:focus-visible {
306
- outline: none;
307
- box-shadow: 0 0 0 2px var(--dsw-alias-bg-layer-2), 0 0 0 4px var(--dsw-alias-brand-primary);
308
- }
309
-
310
- .copyButton {
311
- display: inline-flex;
312
364
  align-items: center;
313
- justify-content: center;
314
- gap: 4px;
315
- align-self: flex-start;
316
- height: 28px;
317
- border: none;
318
- border-radius: 8px;
319
- padding: 0 10px;
320
- background: transparent;
321
- color: var(--dsw-alias-label-secondary);
322
- font-size: 12px;
323
- line-height: 18px;
324
- cursor: pointer;
325
- transition: background-color 120ms ease, color 120ms ease;
365
+ justify-content: flex-end;
366
+ gap: var(--pair-space-2);
326
367
  }
327
368
 
328
- .copyButton:hover {
329
- background: var(--dsw-alias-interactive-bg-hover);
330
- color: var(--dsw-alias-label-primary);
369
+ /* The copy control's three labels share one grid cell, so the button keeps one
370
+ width and the row keeps its gaps while the label changes (A4/M3). Only the
371
+ active label is exposed to assistive technology. */
372
+ .labels {
373
+ display: grid;
331
374
  }
332
375
 
333
- .copyButton[data-copied='true'] {
334
- color: var(--dsw-alias-brand-primary);
376
+ .label {
377
+ grid-area: 1 / 1;
335
378
  }
336
379
 
337
- .copyButton[data-failed='true'] {
338
- color: var(--dsw-alias-state-error-primary);
380
+ .label[data-visible='false'] {
381
+ visibility: hidden;
339
382
  }
340
383
 
341
- .copyButton:focus-visible {
342
- outline: none;
343
- box-shadow: 0 0 0 2px var(--dsw-alias-bg-layer-2), 0 0 0 4px var(--dsw-alias-brand-primary);
384
+ /* The copy outcome as a live region. The label swap above confirms the result
385
+ on screen, but a control's name is spoken when focus lands on it, so the
386
+ change itself can pass unheard; this region says it instead. It takes no part
387
+ in the row: out of flow, no box, clipped away, with no type, colour or length
388
+ of its own, so the action row keeps the geometry it had. */
389
+ .announce {
390
+ position: absolute;
391
+ width: 0;
392
+ height: 0;
393
+ margin: 0;
394
+ overflow: hidden;
395
+ clip: rect(0, 0, 0, 0);
396
+ clip-path: inset(0);
344
397
  }
@@ -14,13 +14,10 @@ export const PART_ENTRY = 'entry'
14
14
  /** The modal panel root. */
15
15
  export const PART_PANEL = 'panel'
16
16
 
17
- /** The QR symbol's wrapper — it also mirrors the encoded string. */
17
+ /** The QR symbol's box — it also mirrors the encoded string. */
18
18
  export const PART_QR = 'qr'
19
19
 
20
- /** The plaintext pairing code row. */
21
- export const PART_TOKEN = 'token'
22
-
23
- /** A state notice: the origin warning, or a refusal the host raised. */
20
+ /** A refusal the host raised. */
24
21
  export const PART_NOTICE = 'notice'
25
22
 
26
23
  /** The mint-again button. */
@@ -32,6 +29,13 @@ export const PART_COPY = 'copy'
32
29
  /**
33
30
  * Attribute carrying the exact string the QR symbol encodes, so the operator
34
31
  * (and a UI check) can compare it against the host route's answer without
35
- * decoding the symbol. The same string is already on screen in plaintext.
32
+ * decoding the symbol. It is the only machine trace the panel renders.
36
33
  */
37
34
  export const QR_VALUE_ATTR = 'data-dsh-qr-value'
35
+
36
+ /**
37
+ * Marks the QR part of a code that has run out of time. Expiry is state on the
38
+ * existing part, not a new part value: the cross-repository part enum is frozen
39
+ * and a plugin may not extend it for one visual state.
40
+ */
41
+ export const EXPIRED_ATTR = 'data-expired'
@@ -39,8 +39,25 @@ export interface ApprovalPrompt {
39
39
  readonly answer: Promise<ApprovalAnswer>
40
40
  }
41
41
 
42
+ /**
43
+ * One live question as a second delivery publishes it.
44
+ *
45
+ * The same four fields the first broadcast carries, so a card a phone was shown
46
+ * and the same card handed to it again after a reconnect cannot be spelled
47
+ * differently.
48
+ */
49
+ export interface PendingPromptView {
50
+ readonly id: string
51
+ readonly sessionId: string
52
+ readonly toolName: string
53
+ readonly summary: string
54
+ }
55
+
42
56
  /** One live question. */
43
57
  interface PendingPrompt {
58
+ readonly sessionId: string
59
+ readonly toolName: string
60
+ readonly summary: string
44
61
  readonly settle: (answer: ApprovalAnswer) => void
45
62
  readonly timer: NodeJS.Timeout
46
63
  readonly detached: () => void
@@ -74,6 +91,20 @@ export class ApprovalRegistry {
74
91
  return this.#pending.size
75
92
  }
76
93
 
94
+ /**
95
+ * Every question still waiting for a phone, in claim order.
96
+ *
97
+ * Only a live claim can be named here: {@link #settle} is the single path out
98
+ * of the pending map, and an answer, the bridge's own timeout, the agent's
99
+ * cancellation and every withdrawal all pass through it before this reads the
100
+ * map again. A question this bridge released therefore cannot come back to a
101
+ * client that reconnects.
102
+ * @returns the fields a second delivery republishes, oldest claim first.
103
+ */
104
+ openPrompts(): readonly PendingPromptView[] {
105
+ return [...this.#pending].map(([id, entry]) => ({ id, sessionId: entry.sessionId, toolName: entry.toolName, summary: entry.summary }))
106
+ }
107
+
77
108
  /**
78
109
  * Claim one question.
79
110
  * @param input - session identity, tool name, presentation summary, and the agent's own lifetime.
@@ -89,7 +120,7 @@ export class ApprovalRegistry {
89
120
  const signal = input.signal
90
121
  const detached = signal === undefined ? (): void => undefined : (): void => { signal.removeEventListener('abort', withdraw) }
91
122
  signal?.addEventListener('abort', withdraw, { once: true })
92
- this.#pending.set(id, { settle, timer, detached })
123
+ this.#pending.set(id, { sessionId: input.sessionId, toolName: input.toolName, summary: input.summary, settle, timer, detached })
93
124
  return { id, sessionId: input.sessionId, toolName: input.toolName, summary: input.summary, answer }
94
125
  }
95
126