agl 43.1.0 → 43.2.0

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 (123) hide show
  1. package/changelog.md +12 -0
  2. package/dist_serve/bundle.js +5329 -5116
  3. package/dist_serve/bundle.js.map +2 -2
  4. package/dist_serve/bundle.js.third-party-notices.json +30 -30
  5. package/dist_serve/bundle.js.third-party-notices.txt +30 -30
  6. package/dist_ts/00_commitinfo_data.js +1 -1
  7. package/dist_ts/aglapi/aglapisurface.document.js +325 -1
  8. package/dist_ts/aglapi/interfaces.d.ts +3 -0
  9. package/dist_ts/aglapi/interfaces.js +2 -1
  10. package/dist_ts/classes.authmodels.js +17 -4
  11. package/dist_ts/classes.authstore.js +16 -2
  12. package/dist_ts/classes.cli.d.ts +4 -2
  13. package/dist_ts/classes.cli.js +6 -3
  14. package/dist_ts/classes.controller.d.ts +10 -0
  15. package/dist_ts/classes.controller.js +119 -4
  16. package/dist_ts/classes.controllermanagement.d.ts +14 -4
  17. package/dist_ts/classes.controllermanagement.js +20 -2
  18. package/dist_ts/classes.gatewayclient.d.ts +115 -0
  19. package/dist_ts/classes.gatewayclient.js +336 -0
  20. package/dist_ts/classes.gatewayclientstore.d.ts +97 -0
  21. package/dist_ts/classes.gatewayclientstore.js +261 -0
  22. package/dist_ts/classes.inferencerouter.d.ts +9 -0
  23. package/dist_ts/classes.inferencerouter.js +11 -1
  24. package/dist_ts/classes.inferenceservice.d.ts +9 -0
  25. package/dist_ts/classes.inferenceservice.js +27 -1
  26. package/dist_ts/classes.mcpclient.d.ts +4 -1
  27. package/dist_ts/classes.mcpclient.js +19 -1
  28. package/dist_ts/classes.mcpcontrollerhost.d.ts +3 -1
  29. package/dist_ts/classes.mcpcontrollerhost.js +9 -1
  30. package/dist_ts/classes.mcptools.d.ts +3 -3
  31. package/dist_ts/classes.mcptools.js +26 -1
  32. package/dist_ts/classes.mcpvalidation.js +7 -1
  33. package/dist_ts/classes.proxycontrol.d.ts +11 -0
  34. package/dist_ts/classes.proxycontrol.js +7 -1
  35. package/dist_ts/classes.proxycontrolclient.d.ts +17 -0
  36. package/dist_ts/classes.proxycontrolclient.js +35 -1
  37. package/dist_ts/classes.proxydaemon.js +8 -1
  38. package/dist_ts/classes.proxymonitor.d.ts +7 -0
  39. package/dist_ts/classes.proxymonitor.js +13 -1
  40. package/dist_ts/classes.trustedproxysecrets.d.ts +2 -0
  41. package/dist_ts/classes.trustedproxysecrets.js +5 -1
  42. package/dist_ts/functions.controllermanagementsurface.d.ts +4 -0
  43. package/dist_ts/functions.controllermanagementsurface.js +15 -1
  44. package/dist_ts/functions.gatewaycli.d.ts +24 -0
  45. package/dist_ts/functions.gatewaycli.js +395 -0
  46. package/dist_ts/functions.gatewayroute.d.ts +135 -0
  47. package/dist_ts/functions.gatewayroute.js +366 -0
  48. package/dist_ts/functions.inferencecli.js +30 -1
  49. package/dist_ts/functions.inferencecliarguments.d.ts +8 -2
  50. package/dist_ts/functions.inferencecliarguments.js +31 -3
  51. package/dist_ts/functions.proxycapacity.d.ts +50 -0
  52. package/dist_ts/functions.proxycapacity.js +142 -0
  53. package/dist_ts/functions.proxycapacitycli.d.ts +30 -0
  54. package/dist_ts/functions.proxycapacitycli.js +65 -0
  55. package/dist_ts/functions.remotecli.d.ts +30 -3
  56. package/dist_ts/functions.remotecli.js +44 -18
  57. package/dist_ts/interfaces.auth.d.ts +25 -4
  58. package/dist_ts/interfaces.auth.js +7 -1
  59. package/dist_ts/plugins.d.ts +2 -0
  60. package/dist_ts/plugins.js +4 -1
  61. package/dist_ts_authswitch/authority-placement.js +3 -17
  62. package/dist_ts_authswitch/authority-usagelimit.d.ts +29 -0
  63. package/dist_ts_authswitch/authority-usagelimit.js +66 -2
  64. package/dist_ts_authswitch/authority-usagewindows.d.ts +6 -0
  65. package/dist_ts_authswitch/authority-usagewindows.js +15 -1
  66. package/dist_ts_interfaces/gateway.d.ts +151 -0
  67. package/dist_ts_interfaces/gateway.js +66 -0
  68. package/dist_ts_interfaces/index.d.ts +2 -0
  69. package/dist_ts_interfaces/index.js +3 -1
  70. package/dist_ts_interfaces/management.d.ts +4 -4
  71. package/dist_ts_interfaces/management.js +3 -2
  72. package/dist_ts_interfaces/mcprequests.d.ts +14 -2
  73. package/dist_ts_interfaces/mcprequests.js +2 -1
  74. package/dist_ts_interfaces/proxycapacity.d.ts +99 -0
  75. package/dist_ts_interfaces/proxycapacity.js +74 -0
  76. package/package.json +4 -3
  77. package/readme.md +79 -5
  78. package/ts/00_commitinfo_data.ts +1 -1
  79. package/ts/aglapi/aglapisurface.document.ts +324 -0
  80. package/ts/aglapi/interfaces.ts +1 -0
  81. package/ts/classes.authmodels.ts +22 -3
  82. package/ts/classes.authstore.ts +15 -1
  83. package/ts/classes.cli.ts +7 -3
  84. package/ts/classes.controller.ts +134 -3
  85. package/ts/classes.controllermanagement.ts +40 -7
  86. package/ts/classes.gatewayclient.ts +401 -0
  87. package/ts/classes.gatewayclientstore.ts +272 -0
  88. package/ts/classes.inferencerouter.ts +12 -0
  89. package/ts/classes.inferenceservice.ts +27 -0
  90. package/ts/classes.mcpclient.ts +18 -0
  91. package/ts/classes.mcpcontrollerhost.ts +13 -0
  92. package/ts/classes.mcptools.ts +30 -2
  93. package/ts/classes.mcpvalidation.ts +5 -0
  94. package/ts/classes.proxycontrol.ts +16 -0
  95. package/ts/classes.proxycontrolclient.ts +30 -0
  96. package/ts/classes.proxydaemon.ts +8 -0
  97. package/ts/classes.proxymonitor.ts +12 -0
  98. package/ts/classes.trustedproxysecrets.ts +5 -0
  99. package/ts/functions.controllermanagementsurface.ts +15 -0
  100. package/ts/functions.gatewaycli.ts +436 -0
  101. package/ts/functions.gatewayroute.ts +429 -0
  102. package/ts/functions.inferencecli.ts +24 -0
  103. package/ts/functions.inferencecliarguments.ts +30 -4
  104. package/ts/functions.proxycapacity.ts +191 -0
  105. package/ts/functions.proxycapacitycli.ts +104 -0
  106. package/ts/functions.remotecli.ts +56 -20
  107. package/ts/interfaces.auth.ts +28 -4
  108. package/ts/plugins.ts +5 -0
  109. package/ts_authswitch/authority-placement.ts +2 -15
  110. package/ts_authswitch/authority-usagelimit.ts +84 -1
  111. package/ts_authswitch/authority-usagewindows.ts +13 -0
  112. package/ts_interfaces/gateway.ts +242 -0
  113. package/ts_interfaces/index.ts +2 -0
  114. package/ts_interfaces/management.ts +6 -4
  115. package/ts_interfaces/mcprequests.ts +18 -0
  116. package/ts_interfaces/proxycapacity.ts +162 -0
  117. package/ts_web/00_commitinfo_data.ts +1 -1
  118. package/ts_web/classes.browserpresentation.ts +13 -5
  119. package/ts_web/elements.accounts.ts +40 -113
  120. package/ts_web/elements.configurationpane.ts +24 -37
  121. package/ts_web/elements.devices.ts +4 -17
  122. package/ts_web/elements.flexlimitstrip.ts +21 -70
  123. package/ts_web/elements.harnesscontrollerapp.ts +91 -185
@@ -214,7 +214,7 @@ export class ControllerBrowserPresentation {
214
214
  const paint = this.paint;
215
215
  if (paint && paint.response.paintId === eventArg.paintId) {
216
216
  void this.openVideoRoute(paint, eventArg.routeId).catch((errorArg) => {
217
- if (this.paint === paint) this.options.onError('Show the browser view\'s video', errorArg);
217
+ if (this.isCurrentPaint(paint)) this.options.onError('Show the browser view\'s video', errorArg);
218
218
  });
219
219
  return;
220
220
  }
@@ -330,7 +330,7 @@ export class ControllerBrowserPresentation {
330
330
  for (const pending of this.pendingVideoRoutes.splice(0)) {
331
331
  if (pending.paintId === opened.paintId) {
332
332
  void this.openVideoRoute(paint, pending.routeId).catch((errorArg) => {
333
- if (this.paint === paint) this.options.onError('Show the browser view\'s video', errorArg);
333
+ if (this.isCurrentPaint(paint)) this.options.onError('Show the browser view\'s video', errorArg);
334
334
  });
335
335
  }
336
336
  }
@@ -384,7 +384,15 @@ export class ControllerBrowserPresentation {
384
384
  if (failure !== undefined) this.fallBackToVideo({ kind: 'viewer-cannot-render', failure });
385
385
  }
386
386
 
387
+ /** Whether `paintArg` is the run this view presents: a stopping, replaced or closed run is not. */
388
+ private isCurrentPaint(paintArg: IPaintRun): boolean {
389
+ return this.paint === paintArg && !this.closed;
390
+ }
391
+
387
392
  private async stopPaint(paintArg: IPaintRun): Promise<void> {
393
+ // The run stops being current before its abort listeners run: they fire synchronously, and
394
+ // what they end belongs to the stopping run, never to the view.
395
+ if (this.paint === paintArg) this.paint = undefined;
388
396
  paintArg.abortController.abort(new Error('The Paint stream closed.'));
389
397
  paintArg.removeSessionEnd();
390
398
  this.closeVideoRoutes(paintArg);
@@ -392,7 +400,6 @@ export class ControllerBrowserPresentation {
392
400
  // Closes the controller's Paint stream exactly once and stops the renderer.
393
401
  await paintArg.presenter.close();
394
402
  } finally {
395
- if (this.paint === paintArg) this.paint = undefined;
396
403
  this.clearRenderer(paintArg.renderer);
397
404
  }
398
405
  }
@@ -427,10 +434,11 @@ export class ControllerBrowserPresentation {
427
434
  // The host ended the route on purpose (a source rebind or a closed subscription): the worker
428
435
  // keeps running and the next route mounts on it.
429
436
  onEnded: () => { paintArg.routes.delete(mount); },
430
- // A broken route closes only its own decoders; the renderer keeps running.
437
+ // A broken route closes only its own decoders; the renderer keeps running. A route of a
438
+ // stopping, replaced or closed run is not this view's fault.
431
439
  onFailure: (errorArg) => {
432
440
  paintArg.routes.delete(mount);
433
- this.options.onError('Show the browser view\'s video', errorArg);
441
+ if (this.isCurrentPaint(paintArg)) this.options.onError('Show the browser view\'s video', errorArg);
434
442
  },
435
443
  });
436
444
  paintArg.routes.add(mount);
@@ -91,6 +91,15 @@ export interface IAccountsOpenConfigurationDetail {
91
91
 
92
92
  /** The screen's three views: the accounts, the tools on this host, and the accounts service. */
93
93
  export type TAccountsTab = 'list' | 'host' | 'service';
94
+ const accountsTabs: readonly TAccountsTab[] = ['list', 'host', 'service'];
95
+
96
+ /** What new Claude terminals can run on, as the Host view offers it. */
97
+ const claudeTerminalsChoices = ['claude_code', 'chatgpt'] as const;
98
+ const claudeTerminalsOptions: plugins.deesCatalog.TRadiogroupOption[] = [
99
+ { key: 'claude_code', option: 'Claude Code\'s own configuration',
100
+ description: 'Route it through the AGL proxy in Configuration → Inference to give it AGL\'s accounts.' },
101
+ { key: 'chatgpt', option: 'ChatGPT models through the AGL proxy', description: 'Claude Code\'s terminal, answered by the ChatGPT accounts.' },
102
+ ];
94
103
 
95
104
  /**
96
105
  * The confirmation or sign-in in view, if any. It names what it acts on, never a copy of it: the dialog reads its
@@ -340,69 +349,13 @@ export class AglAccounts extends plugins.deesElement.DeesElement {
340
349
  gap: var(--dees-spacing-md);
341
350
  }
342
351
 
343
- .tabs {
344
- display: inline-flex;
345
- gap: 2px;
346
- padding: 2px;
347
- border-radius: var(--dees-radius-md);
348
- background: var(--dees-color-fill-tertiary, var(--dees-color-hover));
349
- }
350
-
351
- .tabs button {
352
- display: inline-flex;
353
- align-items: center;
354
- gap: var(--dees-spacing-xs);
355
- height: 26px;
356
- padding: 0 var(--dees-spacing-md);
357
- border: 0;
358
- border-radius: var(--dees-radius-sm);
359
- background: transparent;
360
- color: var(--dees-color-text-primary);
361
- font: inherit;
362
- font-size: var(--dees-font-footnote-size);
363
- font-weight: 500;
364
- cursor: pointer;
365
- }
366
-
367
- .tabs button[aria-pressed='true'] {
368
- background: var(--dees-color-bg-elevated, var(--dees-color-bg-primary));
369
- box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
370
- }
371
-
372
- .tabs button:focus-visible, .row:focus-visible, .back:focus-visible, .freshness:focus-visible {
352
+ .row:focus-visible {
373
353
  outline: var(--dees-line-width-focus-ring, 2px) solid var(--dees-color-focus-ring);
374
354
  outline-offset: 2px;
375
355
  }
376
356
 
377
- .count { color: var(--dees-color-text-muted); font-size: var(--dees-font-caption1-size); }
378
-
379
357
  .tools, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--dees-spacing-xs); }
380
358
 
381
- .freshness {
382
- display: inline-flex;
383
- align-items: center;
384
- gap: var(--dees-spacing-xs);
385
- height: 30px;
386
- padding: 0 var(--dees-spacing-sm);
387
- border: 0;
388
- border-radius: var(--dees-radius-md);
389
- background: transparent;
390
- color: var(--dees-color-text-secondary);
391
- font: inherit;
392
- font-size: var(--dees-font-caption1-size);
393
- cursor: pointer;
394
- }
395
-
396
- .serviceDot {
397
- width: 7px;
398
- height: 7px;
399
- flex: none;
400
- border-radius: 999px;
401
- background: var(--dees-color-accent-success);
402
- }
403
-
404
- .serviceDot.stale { background: var(--dees-color-accent-warning); }
405
-
406
359
  .reason {
407
360
  margin: 0;
408
361
  color: var(--dees-color-text-secondary);
@@ -561,19 +514,7 @@ export class AglAccounts extends plugins.deesElement.DeesElement {
561
514
 
562
515
  .page { display: grid; gap: var(--dees-spacing-lg); }
563
516
 
564
- .back {
565
- justify-self: start;
566
- display: inline-flex;
567
- align-items: center;
568
- gap: 2px;
569
- padding: 0;
570
- border: 0;
571
- background: none;
572
- color: var(--dees-color-accent-primary, var(--dees-color-text-link));
573
- font: inherit;
574
- font-size: var(--dees-font-footnote-size);
575
- cursor: pointer;
576
- }
517
+ .back { justify-self: start; }
577
518
 
578
519
  .pageHead {
579
520
  display: grid;
@@ -635,16 +576,7 @@ export class AglAccounts extends plugins.deesElement.DeesElement {
635
576
  overflow-wrap: anywhere;
636
577
  }
637
578
 
638
- .radio {
639
- display: grid;
640
- grid-template-columns: 18px minmax(0, 1fr);
641
- gap: var(--dees-spacing-sm);
642
- align-items: start;
643
- padding: var(--dees-spacing-md) var(--dees-spacing-lg);
644
- cursor: pointer;
645
- }
646
-
647
- .radio input { margin: 2px 0 0; accent-color: var(--dees-color-accent-primary); }
579
+ dees-input-radiogroup { padding: var(--dees-spacing-md) var(--dees-spacing-lg); }
648
580
 
649
581
  /* The one visual difference of a last-known screen: the service's accounts, and only those. */
650
582
  .dimmed .row, .dimmed .page { opacity: .62; }
@@ -1476,18 +1408,21 @@ export class AglAccounts extends plugins.deesElement.DeesElement {
1476
1408
  `;
1477
1409
  }
1478
1410
 
1411
+ /** The screen's three views as one segmented control; choosing the open view again closes an account's page. */
1479
1412
  private renderTabs(viewArg: IAccountsView): plugins.deesElement.TemplateResult {
1480
1413
  const count = viewArg.list.groups.reduce((sumArg, groupArg) => sumArg + groupArg.rows.length, 0);
1481
- const tab = (idArg: TAccountsTab, labelArg: string, countArg?: number) => plugins.deesElement.html`
1482
- <button type="button" data-tab=${idArg} aria-pressed=${String(this.tab === idArg)}
1483
- @click=${() => { this.tab = idArg; this.openKey = ''; }}>
1484
- ${labelArg}${countArg === undefined ? '' : plugins.deesElement.html` <span class="count">${countArg}</span>`}
1485
- </button>
1486
- `;
1414
+ const options: plugins.deesCatalog.TMultitoggleOption[] = [
1415
+ { key: 'list', label: 'Accounts', badge: count },
1416
+ { key: 'host', label: 'This host' },
1417
+ { key: 'service', label: 'Service' },
1418
+ ];
1487
1419
  return plugins.deesElement.html`
1488
- <div class="tabs" role="group" aria-label="Accounts views">
1489
- ${tab('list', 'Accounts', count)}${tab('host', 'This host')}${tab('service', 'Service')}
1490
- </div>
1420
+ <dees-input-multitoggle data-tabs size="sm" label="Accounts views" .labelPosition=${'none'} .options=${options}
1421
+ .selectedOption=${this.tab}
1422
+ @option-activate=${(eventArg: CustomEvent<{ selectedOption: string }>) => {
1423
+ this.tab = accountsTabs.find((tabArg) => tabArg === eventArg.detail.selectedOption) ?? this.tab;
1424
+ this.openKey = '';
1425
+ }}></dees-input-multitoggle>
1491
1426
  `;
1492
1427
  }
1493
1428
 
@@ -1730,9 +1665,8 @@ export class AglAccounts extends plugins.deesElement.DeesElement {
1730
1665
  const signInHead = rowArg.apiKey ? 'Key' : 'Sign-in';
1731
1666
  return plugins.deesElement.html`
1732
1667
  <section class="page" data-account-page=${rowArg.key} aria-label=${`Account ${rowArg.label}`}>
1733
- <button class="back" type="button" data-action="back" @click=${() => { this.openKey = ''; }}>
1734
- <dees-icon icon="lucide:ChevronLeft" aria-hidden="true"></dees-icon>Accounts
1735
- </button>
1668
+ <dees-button class="back" type="link" size="sm" icon="lucide:ChevronLeft" data-action="back"
1669
+ @clicked=${() => { this.openKey = ''; }}>Accounts</dees-button>
1736
1670
  <header class="pageHead">
1737
1671
  ${renderMark(rowArg)}
1738
1672
  <div>
@@ -1938,23 +1872,17 @@ export class AglAccounts extends plugins.deesElement.DeesElement {
1938
1872
  ? plugins.deesElement.html`<div class="card"><div class="item stacked" data-claude-terminals>
1939
1873
  <div class="statusText">${read.state === 'pending' ? 'Reading what new Claude terminals run on.' : read.reason}</div>
1940
1874
  </div></div>`
1941
- : plugins.deesElement.html`<div class="card" role="radiogroup" aria-label="New Claude terminals run on"
1942
- data-claude-terminals=${read.terminals}>
1943
- ${([
1944
- ['claude_code', 'Claude Code\'s own configuration',
1945
- 'Route it through the AGL proxy in Configuration → Inference to give it AGL\'s accounts.'],
1946
- ['chatgpt', 'ChatGPT models through the AGL proxy', 'Claude Code\'s terminal, answered by the ChatGPT accounts.'],
1947
- ] as const).map(([valueArg, labelArg, textArg]) => plugins.deesElement.html`
1948
- <label class="radio" data-terminals=${valueArg}>
1949
- <input type="radio" name="claudeTerminals" .checked=${read.terminals === valueArg}
1950
- ?disabled=${this.busyAction !== ''}
1951
- @click=${(eventArg: Event) => {
1952
- // The choice shows what the controller holds: it changes once the controller saved it.
1953
- eventArg.preventDefault();
1954
- if (valueArg !== read.terminals) void this.useClaudeTerminals(valueArg);
1955
- }}>
1956
- <span><span class="itemLabel">${labelArg}</span><div class="itemText">${textArg}</div></span>
1957
- </label>`)}
1875
+ : plugins.deesElement.html`<div class="card" data-claude-terminals=${read.terminals}>
1876
+ <dees-input-radiogroup aria-label="New Claude terminals run on" .options=${claudeTerminalsOptions}
1877
+ .selectedOption=${read.terminals} .disabled=${this.busyAction !== ''}
1878
+ @change=${(eventArg: Event) => {
1879
+ // The choice shows what the controller holds: the pick goes back at once, and the choice changes once
1880
+ // the controller saved it.
1881
+ const group = eventArg.currentTarget as plugins.deesCatalog.DeesInputRadiogroup;
1882
+ const picked = claudeTerminalsChoices.find((choiceArg) => choiceArg === group.selectedOption);
1883
+ group.selectedOption = read.terminals;
1884
+ if (picked && picked !== read.terminals) void this.useClaudeTerminals(picked);
1885
+ }}></dees-input-radiogroup>
1958
1886
  <div class="item stacked"><div class="statusText">${claudeTerminalsText(read.terminals)} Terminals already
1959
1887
  open keep what they run on.</div></div>
1960
1888
  </div>`}
@@ -2265,10 +2193,9 @@ export class AglAccounts extends plugins.deesElement.DeesElement {
2265
2193
  <div class="bar">
2266
2194
  ${this.renderTabs(view)}
2267
2195
  <div class="tools">
2268
- <button class="freshness" type="button" data-freshness @click=${() => { this.tab = 'service'; this.openKey = ''; }}>
2269
- <span class=${`serviceDot ${view.service.state === 'current' ? '' : 'stale'}`}></span>
2270
- Accounts service · ${view.service.freshness}
2271
- </button>
2196
+ <dees-button type="ghost" size="sm" data-freshness .badge=${''} .badgeDot=${true}
2197
+ .badgeVariant=${view.service.state === 'current' ? 'success' : 'warning'}
2198
+ @clicked=${() => { this.tab = 'service'; this.openKey = ''; }}>Accounts service · ${view.service.freshness}</dees-button>
2272
2199
  <dees-button size="sm" type="ghost" icon="lucide:RefreshCw" data-action="refresh" title="Read the accounts again"
2273
2200
  aria-label="Read the accounts again" .disabled=${this.reading}
2274
2201
  @clicked=${() => void this.refresh(true)}></dees-button>
@@ -432,8 +432,6 @@ export class AglConfigurationPane extends plugins.deesElement.DeesElement {
432
432
  [data-tone='ok'] { color: var(--dees-color-text-success); }
433
433
  [data-tone='warn'] { color: var(--dees-color-text-warning); }
434
434
  [data-tone='bad'] { color: var(--dees-color-text-error); }
435
- button.link { border: 0; padding: 0; background: transparent; color: var(--dees-color-link); cursor: pointer; font-size: inherit; }
436
- button.link:hover { color: var(--dees-color-link-hover); }
437
435
  .confirm {
438
436
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--dees-spacing-sm) var(--dees-spacing-md);
439
437
  padding: var(--dees-spacing-sm-plus) var(--dees-spacing-lg); background: var(--dees-color-badge-warning-bg);
@@ -577,18 +575,15 @@ export class AglConfigurationPane extends plugins.deesElement.DeesElement {
577
575
  .list .li .tag { margin-left: auto; white-space: nowrap; font-size: var(--dees-font-caption2-size); color: var(--dees-color-text-muted); }
578
576
  .list .empty { padding: var(--dees-spacing-md); color: var(--dees-color-text-muted); font-size: var(--dees-font-secondary-size); }
579
577
  .lab { display: block; margin-bottom: var(--dees-spacing-xs-plus); font-size: var(--dees-font-caption1-size); color: var(--dees-color-text-muted); }
578
+ /* The file tabs sit on the pane's own surface, one hairline under the tabs and the file actions. */
580
579
  .filetabs {
581
580
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--dees-spacing-2xs);
582
581
  border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
583
582
  }
584
- .filetabs .tab {
585
- min-height: var(--dees-control-height-lg); padding: 0 var(--dees-spacing-md); border: 0;
586
- border-bottom: var(--dees-line-width-focus-ring) solid transparent; background: transparent; cursor: pointer;
587
- font-family: var(--dees-font-family-mono); font-size: var(--dees-font-caption1-size); color: var(--dees-color-text-secondary);
583
+ .filetabs dees-appui-tabs {
584
+ flex: 1 1 240px; min-width: 0; margin-bottom: calc(-1 * var(--dees-line-width-hairline));
585
+ --dees-appui-row-height: 40px; --dees-appui-chrome-bg: var(--dees-color-bg-primary);
588
586
  }
589
- .filetabs .tab[aria-selected='true'] { color: var(--dees-color-text-primary); border-bottom-color: var(--dees-color-accent-primary); }
590
- .filetabs .tabs { display: flex; flex-wrap: wrap; gap: var(--dees-spacing-2xs); }
591
- .filetabs .spacer { flex: 1 1 auto; }
592
587
  .filepanel { display: flex; flex-direction: column; gap: var(--dees-spacing-md); }
593
588
 
594
589
  .note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--dees-spacing-sm-plus); padding: var(--dees-spacing-sm-plus) var(--dees-spacing-md); font-size: var(--dees-font-secondary-size); line-height: 1.45; }
@@ -632,10 +627,11 @@ export class AglConfigurationPane extends plugins.deesElement.DeesElement {
632
627
  }
633
628
  .applybar > div { flex: 1 1 var(--dees-content-width-sm); }
634
629
  .arow {
635
- display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--dees-spacing-sm-plus);
636
- padding: var(--dees-spacing-sm-plus) var(--dees-spacing-md); cursor: pointer;
630
+ display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--dees-spacing-sm-plus);
631
+ padding: var(--dees-spacing-sm-plus) var(--dees-spacing-md);
637
632
  }
638
- .arow input { margin: 0; accent-color: var(--dees-color-accent-primary); }
633
+ /* The files line under the checkbox's label, in line with it: the box is 18px wide, the gap the checkbox's own. */
634
+ .arow .sd { padding-left: calc(18px + var(--dees-spacing-sm)); }
639
635
  .afoot {
640
636
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--dees-spacing-sm) var(--dees-spacing-md);
641
637
  padding: var(--dees-spacing-sm-plus) var(--dees-spacing-md); font-size: var(--dees-font-caption1-size); color: var(--dees-color-text-muted);
@@ -678,6 +674,9 @@ export class AglConfigurationPane extends plugins.deesElement.DeesElement {
678
674
  if (changedArg.has('confirming') && this.confirming) {
679
675
  void this.shadowRoot?.querySelector<HTMLElement & { focus(): void }>('.confirm [data-keep]')?.focus();
680
676
  }
677
+ // The skill file tabs name the panel they control by element: an id reference cannot reach into their shadow root.
678
+ const fileTabs = this.shadowRoot?.querySelector<plugins.deesCatalog.DeesAppuiTabs>('dees-appui-tabs.skillfiles');
679
+ if (fileTabs) fileTabs.controlsElement = this.shadowRoot?.querySelector<HTMLElement>('.filepanel') ?? undefined;
681
680
  }
682
681
 
683
682
  /** Whether the master editor holds changes that are not saved yet. */
@@ -1140,8 +1139,8 @@ export class AglConfigurationPane extends plugins.deesElement.DeesElement {
1140
1139
  const status = this.harnessesStatus();
1141
1140
  return html`<span class="status" data-tone=${status.tone}>
1142
1141
  ${status.tone === 'ok' ? html`<dees-icon icon="lucide:Check" iconSize="14"></dees-icon>` : ''}${status.text}
1143
- ${status.toHistory && this.selection.kind !== 'history' ? html` · <button class="link" data-action="openHistory"
1144
- @click=${() => { this.selection = { kind: 'history' }; }}>Apply and history</button>` : ''}
1142
+ ${status.toHistory && this.selection.kind !== 'history' ? html` · <dees-button type="link" size="sm" data-action="openHistory"
1143
+ @clicked=${() => { this.selection = { kind: 'history' }; }}>Apply and history</dees-button>` : ''}
1145
1144
  </span>`;
1146
1145
  }
1147
1146
 
@@ -1545,32 +1544,20 @@ export class AglConfigurationPane extends plugins.deesElement.DeesElement {
1545
1544
  this.skillFile = fileIndexArg;
1546
1545
  this.renamingFile = false;
1547
1546
  };
1548
- // Arrow keys, Home and End move between the tabs, and the chosen tab takes the focus.
1549
- const keydown = async (eventArg: KeyboardEvent): Promise<void> => {
1550
- const count = skillArg.files.length;
1551
- const next = eventArg.key === 'ArrowRight' ? (index + 1) % count : eventArg.key === 'ArrowLeft' ? (index - 1 + count) % count
1552
- : eventArg.key === 'Home' ? 0 : eventArg.key === 'End' ? count - 1 : undefined;
1553
- if (next === undefined) return;
1554
- eventArg.preventDefault();
1555
- choose(next);
1556
- await this.updateComplete;
1557
- this.shadowRoot?.querySelector<HTMLButtonElement>('.filetabs [role="tab"][aria-selected="true"]')?.focus();
1558
- };
1547
+ // A tab's key is its file's index: renaming a file keeps its tab chosen.
1548
+ const tabs: plugins.deesCatalog.IMenuItem[] = skillArg.files.map((candidate, fileIndex) => ({
1549
+ key: String(fileIndex), label: candidate.path, action: () => choose(fileIndex),
1550
+ }));
1559
1551
  return html`
1560
1552
  <div class="filetabs">
1561
- <div class="tabs" role="tablist" aria-label="Skill files" @keydown=${keydown}>
1562
- ${skillArg.files.map((candidate, fileIndex) => html`<button class="tab" role="tab" id=${`skill-file-${fileIndex}`}
1563
- aria-selected=${String(fileIndex === index)} aria-controls="skill-file-panel" tabindex=${fileIndex === index ? '0' : '-1'}
1564
- @click=${() => choose(fileIndex)}>${candidate.path}</button>`)}
1565
- </div>
1553
+ <dees-appui-tabs class="skillfiles" .tabs=${tabs} .selectedTab=${tabs[index] ?? null} .labels=${{ tabsName: 'Skill files' }}></dees-appui-tabs>
1566
1554
  <dees-button size="sm" type="ghost" data-action="addFile" @clicked=${addFile}>+ Add file</dees-button>
1567
- <span class="spacer"></span>
1568
1555
  ${file ? html`
1569
1556
  <dees-button size="sm" type="ghost" data-action="renameFile" @clicked=${() => { this.renamingFile = !this.renamingFile; }}>${this.renamingFile ? 'Done' : 'Rename file'}</dees-button>
1570
1557
  <dees-button size="sm" type="ghost" data-action="removeFile" ?disabled=${skillArg.files.length < 2}
1571
1558
  @clicked=${() => { this.setField(filesPath, skillArg.files.filter((_, i) => i !== index)); choose(Math.max(0, index - 1)); }}>Remove file</dees-button>` : ''}
1572
1559
  </div>
1573
- ${file ? html`<div role="tabpanel" id="skill-file-panel" aria-labelledby=${`skill-file-${index}`} class="filepanel">
1560
+ ${file ? html`<div role="tabpanel" aria-label=${file.path} class="filepanel">
1574
1561
  ${this.renamingFile ? this.textField([...filesPath, index, 'path'], 'File path') : ''}
1575
1562
  ${plugins.deesElement.directives.keyed(JSON.stringify([this.editorEpoch, pathArg, index]), html`
1576
1563
  <dees-input-code key=${`file:${index}`} label="" aria-label="File contents" language=${codeLanguage(file.path)} height="400px"
@@ -1867,18 +1854,18 @@ export class AglConfigurationPane extends plugins.deesElement.DeesElement {
1867
1854
  : html`${pending.map((harness) => {
1868
1855
  const relative = this.relativeTo(harness);
1869
1856
  const replaced = this.replacedEdits(harness);
1870
- return html`<label class="arow" data-harness=${harness.targetId}>
1871
- <input type="checkbox" .checked=${this.applyTargets.includes(harness.targetId)}
1872
- @change=${(eventArg: Event) => toggle(harness.targetId, (eventArg.target as HTMLInputElement).checked)}>
1857
+ return html`<div class="arow" data-harness=${harness.targetId}>
1873
1858
  <span>
1874
- <div>${harnessLabels[harness.targetId]} · ${plural(harness.files.length, 'file')}</div>
1859
+ <dees-input-checkbox .label=${`${harnessLabels[harness.targetId]} · ${plural(harness.files.length, 'file')}`}
1860
+ .value=${this.applyTargets.includes(harness.targetId)}
1861
+ @newValue=${(eventArg: CustomEvent<boolean>) => toggle(harness.targetId, eventArg.detail)}></dees-input-checkbox>
1875
1862
  ${harness.state === 'drifted' || replaced.length
1876
1863
  ? html`<div class="sd warn">${replaced.length ? `Applying replaces the edits made outside AGL in ${joinNames(replaced)}.`
1877
1864
  : 'Its files were edited outside AGL; applying replaces those edits.'}</div>`
1878
1865
  : html`<div class="sd">${harness.files.map((file) => relative(file.path)).join(', ')}</div>`}
1879
1866
  </span>
1880
1867
  <dees-badge rounded dot type=${badgeTypes[stateTones[harness.state]]} text=${stateLabels[harness.state]}></dees-badge>
1881
- </label>`;
1868
+ </div>`;
1882
1869
  })}
1883
1870
  <div class="afoot">
1884
1871
  <span>A harness whose files changed since its review is refused and has to be reviewed again.</span>
@@ -155,7 +155,7 @@ export class AglDevices extends plugins.deesElement.DeesElement {
155
155
  .row:hover { background: var(--dees-color-hover); }
156
156
  .row:active { background: var(--dees-color-active); }
157
157
 
158
- .row:focus-visible, .back:focus-visible {
158
+ .row:focus-visible {
159
159
  outline: var(--dees-line-width-focus-ring, 2px) solid var(--dees-color-focus-ring);
160
160
  outline-offset: 2px;
161
161
  }
@@ -206,19 +206,7 @@ export class AglDevices extends plugins.deesElement.DeesElement {
206
206
 
207
207
  .page { display: grid; gap: var(--dees-spacing-lg); }
208
208
 
209
- .back {
210
- justify-self: start;
211
- display: inline-flex;
212
- align-items: center;
213
- gap: 2px;
214
- padding: 0;
215
- border: 0;
216
- background: none;
217
- color: var(--dees-color-accent-primary, var(--dees-color-text-link));
218
- font: inherit;
219
- font-size: var(--dees-font-footnote-size);
220
- cursor: pointer;
221
- }
209
+ .back { justify-self: start; }
222
210
 
223
211
  .pageHead {
224
212
  display: grid;
@@ -564,9 +552,8 @@ export class AglDevices extends plugins.deesElement.DeesElement {
564
552
  const status = deviceStatus(deviceArg);
565
553
  return plugins.deesElement.html`
566
554
  <div class="page" data-device-page=${deviceArg.id}>
567
- <button class="back" type="button" data-action="back" @click=${() => { this.openId = ''; }}>
568
- <dees-icon icon="lucide:ChevronLeft" iconSize="14" aria-hidden="true"></dees-icon> Devices
569
- </button>
555
+ <dees-button class="back" type="link" size="sm" icon="lucide:ChevronLeft" data-action="back"
556
+ @clicked=${() => { this.openId = ''; }}>Devices</dees-button>
570
557
  <div class="pageHead">
571
558
  <span class="glyph"><dees-icon icon="lucide:Smartphone" iconSize="16" aria-hidden="true"></dees-icon></span>
572
559
  <h3 class="pageTitle">${deviceArg.name}</h3>
@@ -140,54 +140,6 @@ export class AglFlexLimitStrip extends plugins.deesElement.DeesElement {
140
140
  gap: var(--dees-spacing-xs) var(--dees-spacing-sm);
141
141
  margin-left: auto;
142
142
  }
143
-
144
- label {
145
- display: inline-flex;
146
- align-items: center;
147
- gap: 4px;
148
- color: var(--dees-color-text-primary);
149
- cursor: pointer;
150
- }
151
-
152
- label:has(input:disabled) {
153
- opacity: .55;
154
- cursor: default;
155
- }
156
-
157
- input {
158
- margin: 0;
159
- accent-color: var(--dees-color-accent-primary);
160
- }
161
-
162
- button {
163
- min-height: 24px;
164
- padding: 1px 10px;
165
- border: 1px solid var(--dees-color-border-default);
166
- border-radius: var(--dees-radius-sm);
167
- background: transparent;
168
- color: var(--dees-color-text-primary);
169
- font: 600 12px/1.35 var(--dees-font-family);
170
- cursor: pointer;
171
- }
172
-
173
- button:hover:not(:disabled) {
174
- background: var(--dees-color-fill-secondary);
175
- }
176
-
177
- button:disabled {
178
- opacity: .5;
179
- cursor: default;
180
- }
181
-
182
- button:focus-visible,
183
- input:focus-visible {
184
- outline: 2px solid var(--dees-color-focus-ring);
185
- outline-offset: 1px;
186
- }
187
-
188
- @media (pointer: coarse) {
189
- button { min-height: 44px; }
190
- }
191
143
  `,
192
144
  ];
193
145
 
@@ -262,38 +214,37 @@ export class AglFlexLimitStrip extends plugins.deesElement.DeesElement {
262
214
  const { startAtReset, compactFirst } = this.resumeOptions;
263
215
  return plugins.deesElement.html`
264
216
  <div class="controls">
265
- <label title="Send the held prompts on their own once the limit has reset">
266
- <input type="checkbox" .checked=${startAtReset} ?disabled=${this.locked}
267
- @change=${(eventArg: Event) => this.requestLimitResume(eventArg, {
268
- startAtReset: !startAtReset,
269
- compactFirst,
270
- })}
271
- >Start at reset</label>
272
- <label title="Compact the conversation before the held prompts start at the reset">
273
- <input type="checkbox" .checked=${compactFirst} ?disabled=${this.locked || !startAtReset}
274
- @change=${(eventArg: Event) => this.requestLimitResume(eventArg, {
275
- startAtReset,
276
- compactFirst: !compactFirst,
277
- })}
278
- >Compact first</label>
279
- <button type="button" ?disabled=${this.locked} @click=${() => this.emitRelease('send_now')}
280
- title="Send the held prompts now, before the limit resets">Send now</button>
281
- <button type="button" ?disabled=${this.locked} @click=${() => this.emitRelease('cancel')}
282
- title="Drop the held prompts">Cancel</button>
217
+ <dees-input-checkbox data-option="startAtReset" .label=${'Start at reset'} .value=${startAtReset}
218
+ .disabled=${this.locked} title="Send the held prompts on their own once the limit has reset"
219
+ @newValue=${(eventArg: CustomEvent<boolean>) => this.requestLimitResume(eventArg, startAtReset, {
220
+ startAtReset: !startAtReset,
221
+ compactFirst,
222
+ })}></dees-input-checkbox>
223
+ <dees-input-checkbox data-option="compactFirst" .label=${'Compact first'} .value=${compactFirst}
224
+ .disabled=${this.locked || !startAtReset} title="Compact the conversation before the held prompts start at the reset"
225
+ @newValue=${(eventArg: CustomEvent<boolean>) => this.requestLimitResume(eventArg, compactFirst, {
226
+ startAtReset,
227
+ compactFirst: !compactFirst,
228
+ })}></dees-input-checkbox>
229
+ <dees-button size="sm" data-action="send_now" .disabled=${this.locked}
230
+ title="Send the held prompts now, before the limit resets" @clicked=${() => this.emitRelease('send_now')}>Send now</dees-button>
231
+ <dees-button size="sm" data-action="cancel" .disabled=${this.locked}
232
+ title="Drop the held prompts" @clicked=${() => this.emitRelease('cancel')}>Cancel</dees-button>
283
233
  </div>
284
234
  `;
285
235
  }
286
236
 
287
237
  /**
288
238
  * The boxes show what the conversation holds, never a click on its own: the click is only a
289
- * request, and the box follows once the host takes the change up.
239
+ * request, so the box goes back to the held value at once and follows once the host takes the
240
+ * change up.
290
241
  */
291
242
  private requestLimitResume(
292
- eventArg: Event,
243
+ eventArg: CustomEvent<boolean>,
244
+ heldArg: boolean,
293
245
  limitResumeArg: interfaces.IControllerLimitResumeOptions,
294
246
  ): void {
295
- const box = eventArg.currentTarget;
296
- if (box instanceof HTMLInputElement) box.checked = !box.checked;
247
+ (eventArg.currentTarget as plugins.deesCatalog.DeesInputCheckbox).value = heldArg;
297
248
  this.dispatchEvent(new CustomEvent<interfaces.IControllerLimitResumeOptions>(
298
249
  'limit-resume-change',
299
250
  { detail: limitResumeArg },