@app-vitals/agent-lib 1.119.0 → 1.120.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 (2) hide show
  1. package/package.json +1 -1
  2. package/web/toolbar.ts +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-lib",
3
- "version": "1.119.0",
3
+ "version": "1.120.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
package/web/toolbar.ts CHANGED
@@ -60,6 +60,18 @@ export interface ShipwrightToolbarOptions {
60
60
  adminBaseUrl?: string;
61
61
  /** Public task board URL, used only for the public audience. Defaults to "/public/tasks". */
62
62
  tasksUrl?: string;
63
+ /**
64
+ * Optional logo rendered beside the wordmark. Must be a same-origin path
65
+ * (starts with a single "/"); anything else is ignored. Unset = no logo.
66
+ */
67
+ logoUrl?: string;
68
+ }
69
+
70
+ /** Returns an escaped <img> for a same-origin logo path, or "" if unset/unsafe. */
71
+ export function renderToolbarLogo(logoUrl: string | undefined): string {
72
+ if (!logoUrl) return "";
73
+ if (!/^\/(?![/\\])[^\s\\]*$/.test(logoUrl)) return "";
74
+ return `<img src="${escapeHtml(logoUrl)}" alt="" class="vos-logo" width="20" height="20" />`;
63
75
  }
64
76
 
65
77
  /** localStorage key holding the visitor's saved theme: "light" or "dark". */
@@ -220,6 +232,7 @@ export function baseStyles(): string {
220
232
  letter-spacing: -0.3px;
221
233
  flex-shrink: 0;
222
234
  }
235
+ .vos-logo { vertical-align: middle; margin-right: 8px; border-radius: 4px; }
223
236
  .vos-wordmark:hover { color: var(--vos-brand); }
224
237
  .vos-nav {
225
238
  display: flex;
@@ -437,7 +450,7 @@ export function renderShipwrightToolbar(
437
450
 
438
451
  return `<input type="checkbox" id="vos-nav-toggle" class="vos-nav-toggle" aria-hidden="true">
439
452
  <nav class="vos-toolbar" aria-label="Site navigation">
440
- <a href="${adminBase}/admin/agents" class="vos-wordmark">Shipwright</a>
453
+ <a href="${adminBase}/admin/agents" class="vos-wordmark">${renderToolbarLogo(opts.logoUrl)}Shipwright</a>
441
454
  <div id="vos-nav-content" class="vos-nav">
442
455
  ${links}
443
456
  </div>