@xenon-device-management/xenon 2.10.0 → 2.11.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.
- package/lib/package.json +1 -1
- package/lib/public/assets/{AnnotationOverlay-LzfXiiZJ.js → AnnotationOverlay-BQPQ5bPF.js} +1 -1
- package/lib/public/assets/{ApiKeyGate-BzFDp4mK.js → ApiKeyGate-Bd7Pumwv.js} +1 -1
- package/lib/public/assets/{BugReportButton-BpgWvmZo.js → BugReportButton-iC7fxPxl.js} +1 -1
- package/lib/public/assets/{DeviceMosaicView-CCB-egSH.js → DeviceMosaicView-CNdES7nm.js} +1 -1
- package/lib/public/assets/{EmptyState-DkUVmANo.js → EmptyState-wZeJbGhN.js} +1 -1
- package/lib/public/assets/{FieldGroup-mbfnfTql.js → FieldGroup-tpRfmhlE.js} +1 -1
- package/lib/public/assets/{FilterMenu-BH5usz4Y.js → FilterMenu-BZwOppId.js} +1 -1
- package/lib/public/assets/{Menu-Cbo9mdTk.js → Menu-CahoAx8L.js} +1 -1
- package/lib/public/assets/{Modal-D6XfQHPr.js → Modal-mcM5W_Ji.js} +1 -1
- package/lib/public/assets/{RecordingPage-CmFPkWqH.js → RecordingPage-B4dFBndn.js} +1 -1
- package/lib/public/assets/{RecordingsPage-CSlKk2qC.js → RecordingsPage-BOez3f_9.js} +1 -1
- package/lib/public/assets/{SegmentedControl-BFW9Dlqd.js → SegmentedControl-qMSiMN1d.js} +1 -1
- package/lib/public/assets/{SettingCard-C4DioTTi.js → SettingCard-rcPtJ7HG.js} +1 -1
- package/lib/public/assets/{Table-DrKjlL00.js → Table-J3uognu0.js} +1 -1
- package/lib/public/assets/{activity-C9bE7Jm8.js → activity-_5pNSfKT.js} +1 -1
- package/lib/public/assets/{ai-settings-DRYic4oO.js → ai-settings-DTPRbkei.js} +1 -1
- package/lib/public/assets/{api-keys-CaQU0g7c.js → api-keys-CxkIUo76.js} +1 -1
- package/lib/public/assets/apps-BQKfuN3J.css +1 -0
- package/lib/public/assets/{apps-c1gUFmmK.js → apps-Bv0pAfxz.js} +2 -2
- package/lib/public/assets/{arrow-left-DMvAWA8r.js → arrow-left-uY7F6z1K.js} +1 -1
- package/lib/public/assets/{arrow-right-BEQgxmKT.js → arrow-right-BbAm_2Wa.js} +1 -1
- package/lib/public/assets/{arrow-up-right-Ba0e2GeU.js → arrow-up-right-x4H5NuvE.js} +1 -1
- package/lib/public/assets/{auth-shell-COODQnc7.js → auth-shell-CtMFhbnC.js} +2 -2
- package/lib/public/assets/{builds-page-DZQgWBUs.js → builds-page-B_O5uBSZ.js} +1 -1
- package/lib/public/assets/{button-WW9j43wR.js → button-CQoMQEj_.js} +1 -1
- package/lib/public/assets/{calendar-COUs9VxF.js → calendar-BZkpCqlL.js} +1 -1
- package/lib/public/assets/{check-D8ifHIJR.js → check-CAB6RYuc.js} +1 -1
- package/lib/public/assets/{chevron-right-BjKVUlB_.js → chevron-right-ec0unu3u.js} +1 -1
- package/lib/public/assets/{circle-check-CfP79QE2.js → circle-check-Dfg-gpjg.js} +1 -1
- package/lib/public/assets/{circle-x-BZbFCixZ.js → circle-x-cbPq6Btp.js} +1 -1
- package/lib/public/assets/{clock-BuTm35Qg.js → clock-DU9cBLi8.js} +1 -1
- package/lib/public/assets/{copy-W00zUBwN.js → copy-VM9kWPpE.js} +1 -1
- package/lib/public/assets/{device-explorer-BEpS-Y-_.js → device-explorer-ai0usQ8m.js} +1 -1
- package/lib/public/assets/{download-CGz-MS3y.js → download-WgW4AVid.js} +1 -1
- package/lib/public/assets/{forgot-password-DG7SqVgU.js → forgot-password-BGRpjTtt.js} +1 -1
- package/lib/public/assets/{index-EkaQM1DK.js → index-C33GjwPr.js} +2 -2
- package/lib/public/assets/{index-DWHTp1YP.js → index-DNDdHt3h.js} +1 -1
- package/lib/public/assets/{input-ChaTXeCq.js → input-DwiVcO3Q.js} +1 -1
- package/lib/public/assets/{keycodes-BhbgeW_r.js → keycodes-CvCtpVJD.js} +1 -1
- package/lib/public/assets/{line-chart-9P3RxScy.js → line-chart-PE5e9PeN.js} +1 -1
- package/lib/public/assets/{list-checks-_23IIEEL.js → list-checks-Bgn9GEEO.js} +1 -1
- package/lib/public/assets/{lock-B2JaqqRI.js → lock-Cb7My6hc.js} +1 -1
- package/lib/public/assets/{login-BEWIfLfC.js → login-CDmyzSpl.js} +1 -1
- package/lib/public/assets/{maintenance-settings-BGJIJQ-k.js → maintenance-settings-Bq6pKoBt.js} +1 -1
- package/lib/public/assets/{monitor-BrwMY4G0.js → monitor-BZSwrnPV.js} +1 -1
- package/lib/public/assets/{mouse-pointer-2-DsWDMyrY.js → mouse-pointer-2-BbFj8y8i.js} +1 -1
- package/lib/public/assets/{network-DfIhNVJv.js → network-DpwYGB0-.js} +1 -1
- package/lib/public/assets/{overview-B1mePY2_.js → overview-B4_IO-X8.js} +1 -1
- package/lib/public/assets/{page-header-DoD3TOzZ.js → page-header-BpLEuo7i.js} +1 -1
- package/lib/public/assets/{plus-BGvWvpBB.js → plus-DHZS0EGU.js} +1 -1
- package/lib/public/assets/{profile-page-CvV5aWvl.js → profile-page-DsHDIq-Y.js} +1 -1
- package/lib/public/assets/{reset-password-CGVd31LR.js → reset-password-DuUjhw_l.js} +1 -1
- package/lib/public/assets/{runbook-page-Bq2cvwb5.js → runbook-page-BI_ayvLd.js} +1 -1
- package/lib/public/assets/{select-CTcD4jWR.js → select-xiba9PSx.js} +1 -1
- package/lib/public/assets/selector-detail-redirect-Emz2obK_.js +1 -0
- package/lib/public/assets/selector-health-page-zpwrgalC.js +11 -0
- package/lib/public/assets/session-detail-page-BhlTJ1Oq.js +4 -0
- package/lib/public/assets/{settings-C-EnGIqs.js → settings-B-mabJFm.js} +1 -1
- package/lib/public/assets/{stat-tile-BY0RDTRm.js → stat-tile-lT8WcPgu.js} +1 -1
- package/lib/public/assets/{tablet-B4cFM-5B.js → tablet-DM8dp75P.js} +1 -1
- package/lib/public/assets/{teams-BFe-RpYd.js → teams-CRkb5-Fe.js} +1 -1
- package/lib/public/assets/{trash-2-CJCKBOP9.js → trash-2-Dxgryn4o.js} +1 -1
- package/lib/public/assets/{upload-DidWkbld.js → upload-Ci0vz0BP.js} +1 -1
- package/lib/public/assets/{use-builds-data-fnfxatOd.js → use-builds-data-DaaqMjjL.js} +1 -1
- package/lib/public/assets/{use-password-reset-mode-iPen3tmC.js → use-password-reset-mode-BvIyZtaF.js} +1 -1
- package/lib/public/assets/{users-CrcjmRdf.js → users-BT8qx3ea.js} +1 -1
- package/lib/public/assets/{users-DBUv0CJx.js → users-CWYHk75q.js} +1 -1
- package/lib/public/assets/{video-off-eh69-FKB.js → video-off-BvY08g6I.js} +1 -1
- package/lib/public/assets/view-state-83Z1gFME.js +1 -0
- package/lib/public/assets/{webhook-settings-CQoSshBn.js → webhook-settings-aHIlSJFP.js} +1 -1
- package/lib/public/assets/{zap-CICtWiLn.js → zap-qG2Li6rI.js} +1 -1
- package/lib/public/index.html +1 -1
- package/lib/src/app/index.js +2 -0
- package/lib/src/dashboard/event-manager.js +4 -6
- package/lib/src/gateway/nodeSessionMetrics.js +39 -0
- package/lib/src/gateway/nodeSessionStatus.js +32 -23
- package/lib/src/generated/client/edge.js +2 -2
- package/lib/src/generated/client/index.js +2 -2
- package/lib/src/generated/client/package.json +1 -1
- package/lib/src/generated/client/schema.prisma +6 -0
- package/lib/src/plugin.js +3 -0
- package/lib/src/services/SelectorVerificationJob.js +50 -5
- package/lib/src/services/SessionLifecycleService.js +16 -0
- package/lib/src/services/metrics/NodeMetricsCollector.js +114 -0
- package/lib/src/services/metrics/NodeMetricsStore.js +76 -0
- package/lib/src/services/metrics/SessionMetricsService.js +71 -14
- package/lib/src/services/metrics/nodeMetrics.js +92 -0
- package/lib/src/services/selector-health/selectorDetail.js +36 -20
- package/lib/src/sessions/RemoteSession.js +32 -0
- package/lib/src/sessions/SessionManager.js +63 -0
- package/lib/test/helpers/scratch-database.js +17 -3
- package/lib/test/unit/dashboard-events-metrics.spec.js +10 -0
- package/lib/test/unit/hub-node-session-metrics.spec.js +330 -0
- package/lib/test/unit/node-metrics-collector.spec.js +226 -0
- package/lib/test/unit/node-metrics-store.spec.js +70 -0
- package/lib/test/unit/node-session-metrics-route.spec.js +97 -0
- package/lib/test/unit/selector-health-detail.spec.js +57 -0
- package/lib/test/unit/selector-verification-job.spec.js +3 -0
- package/lib/test/unit/selector-verification-missed-regression.spec.js +132 -0
- package/lib/test/unit/session-log-indexes.spec.js +147 -0
- package/lib/test/unit/session-metrics-lifecycle.spec.js +55 -0
- package/lib/test/unit/session-metrics-service.spec.js +97 -0
- package/lib/test/unit/session-recovery-metrics.spec.js +94 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20261002180000_session_log_indexes/migration.sql +5 -0
- package/prisma/migrations/20261002190000_log_profiling_session_indexes/migration.sql +5 -0
- package/prisma/schema.prisma +6 -0
- package/lib/public/assets/apps-DMhpZuKd.css +0 -1
- package/lib/public/assets/selector-detail-redirect-19odlD4B.js +0 -1
- package/lib/public/assets/selector-health-page-LqIsLrjW.js +0 -11
- package/lib/public/assets/session-detail-page-DQzb8_fq.js +0 -4
- package/lib/public/assets/view-state-CP9dE1UI.js +0 -1
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -91,6 +91,8 @@ model SessionLog {
|
|
|
91
91
|
session Session @relation(fields: [session_id], references: [id])
|
|
92
92
|
|
|
93
93
|
@@index([original_strategy, original_selector, createdAt])
|
|
94
|
+
@@index([is_healed, createdAt])
|
|
95
|
+
@@index([session_id, createdAt])
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
model Log {
|
|
@@ -102,6 +104,8 @@ model Log {
|
|
|
102
104
|
createdAt DateTime @default(now())
|
|
103
105
|
updatedAt DateTime @updatedAt
|
|
104
106
|
session Session @relation(fields: [session_id], references: [id])
|
|
107
|
+
|
|
108
|
+
@@index([session_id, log_type, createdAt])
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
model Profiling {
|
|
@@ -117,6 +121,8 @@ model Profiling {
|
|
|
117
121
|
createdAt DateTime @default(now())
|
|
118
122
|
updatedAt DateTime @updatedAt
|
|
119
123
|
session Session @relation(fields: [session_id], references: [id])
|
|
124
|
+
|
|
125
|
+
@@index([session_id, timestamp])
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
/// CPU and memory sampled every 2 s while a session runs (SessionMetricsService).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.apps-container{display:flex;flex-direction:column;height:100%;width:100%}.apps-registry-content{flex:1;overflow-y:auto;padding:var(--space-4) 24px;background:var(--bg)}.registry-table-header{display:grid;grid-template-columns:3fr 1fr 1fr 1fr 1.5fr 2fr;padding:12px 24px;border-bottom:2px solid var(--border);color:var(--text-dim);font-size:11px;font-weight:700;background:rgb(var(--rgb-well) / calc(.2 * var(--well-k)))}.registry-list{display:flex;flex-direction:column}.artifact-row{display:grid;grid-template-columns:3fr 1fr 1fr 1fr 1.5fr 2fr;align-items:center;padding:12px 24px;background:rgb(var(--rgb-well) / calc(.1 * var(--well-k)));border-bottom:1px solid var(--border);transition:all .2s ease;position:relative}.artifact-row:hover{background:rgb(var(--rgb-fg) / .02)}.artifact-row.active{background:rgb(var(--rgb-accent) / .05);border-left:3px solid var(--color-accent)}.col-app-info{display:flex;align-items:center;gap:16px;min-width:0}.app-platform-badge{width:32px;height:32px;background:rgb(var(--rgb-well) / calc(.4 * var(--well-k)));border:1px solid var(--border);border-radius:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--text-dim)}.artifact-row.android .app-platform-badge{color:var(--color-accent);border-color:rgb(var(--rgb-accent) / .2)}.artifact-row.ios .app-platform-badge{color:var(--text);border-color:var(--border)}.app-text-block{display:flex;flex-direction:column;min-width:0}.app-display-name{font-size:13px;font-weight:700;color:var(--text);font-family:Outfit,sans-serif;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.app-package-id{font-family:JetBrains Mono,monospace;font-size:11px;color:var(--text-dim);opacity:.8;display:flex;align-items:center;gap:6px}.col-version{font-family:JetBrains Mono,monospace;font-size:11px;color:var(--color-accent);font-weight:600}.col-size{font-family:JetBrains Mono,monospace;font-size:11px;color:var(--text-muted)}.col-timestamp{font-size:11px;color:var(--text-dim)}.col-team{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--text-muted)}.app-move-name{margin:0 0 var(--space-3);font-weight:700;color:var(--text);overflow-wrap:anywhere}.col-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px}.instant-deploy-trigger{height:28px;background:rgb(var(--rgb-accent) / .05);border:1px solid var(--color-accent);border-radius:6px;padding:0 12px;display:flex;align-items:center;gap:8px;color:var(--color-accent);font-size:11px;font-weight:700;transition:all .2s;cursor:pointer}.instant-deploy-trigger:hover:not(:disabled){background:var(--color-accent);color:var(--bg);box-shadow:none}.utility-icon-btn{width:28px;height:28px;background:rgb(var(--rgb-well) / calc(.3 * var(--well-k)));border:1px solid var(--border);border-radius:6px;display:flex;align-items:center;justify-content:center;color:var(--text-dim);transition:all .2s}.utility-icon-btn:hover{border-color:var(--border);color:var(--text)}.utility-icon-btn.danger:hover{color:var(--status-error-fg)}.device-explorer-header-container{display:flex;justify-content:space-between;align-items:center;padding:12px 24px;background:#0f0f1a66;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border-bottom:1px solid var(--border);z-index:15;gap:16px;flex-wrap:wrap}.device-explorer-header-left-container{display:flex;align-items:center;gap:24px;flex:1;min-width:0;flex-wrap:wrap}.device-explorer-header-right-container{display:flex;align-items:center;gap:12px}.device-explorer-header-filter-count{margin-left:8px}@media (max-width: 900px){.device-explorer-header-container{flex-direction:column;align-items:stretch;padding:12px 16px}.device-explorer-header-left-container{flex-direction:column;align-items:stretch;gap:12px}.device-explorer-header-left-container>*{width:100%;min-width:0}.device-explorer-header-right-container{justify-content:flex-end;flex-wrap:wrap}}.icon-btn-secondary{width:32px;height:32px;background:rgb(var(--rgb-fg) / .03);border:1px solid var(--border);border-radius:6px;display:flex;align-items:center;justify-content:center;color:var(--text-dim);cursor:pointer;transition:all .2s ease}.icon-btn-secondary:hover{background:rgb(var(--rgb-fg) / .08);color:var(--text);border-color:var(--border)}.deployment-flyout{position:absolute;top:50%;padding:6px;right:180px;transform:translateY(-50%);background:var(--surface);border:1px solid var(--color-accent);border-radius:8px;box-shadow:0 10px 40px rgb(var(--rgb-black) / calc(.6 * var(--shadow-k)));z-index:110;display:flex;gap:4px;animation:slideInRight .2s cubic-bezier(.16,1,.3,1)}@keyframes slideInRight{0%{opacity:0;transform:translateY(-50%) translate(10px)}to{opacity:1;transform:translateY(-50%) translate(0)}}.target-device-select{height:32px;background:rgb(var(--rgb-well) / calc(.25 * var(--well-k)));border:1px solid var(--border);border-radius:6px;color:var(--text);font-size:11px;font-weight:600;padding:0 12px;min-width:280px;outline:none;cursor:pointer;transition:all .2s ease;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 8px center}.target-device-select:hover{border-color:var(--color-accent);background-color:rgb(var(--rgb-well) / calc(.4 * var(--well-k)))}.target-device-select option{background:var(--surface);color:var(--text);padding:8px}.target-device-select.empty{display:flex;align-items:center;justify-content:center;padding:0 20px;height:32px;font-style:italic;opacity:.5;font-size:11px}.deploy-actions-group{display:flex;align-items:center;gap:6px}.confirm-deploy-btn{width:32px;height:32px;background:var(--color-accent);border:none;border-radius:6px;display:flex;align-items:center;justify-content:center;color:var(--color-on-accent);cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1)}.confirm-deploy-btn:hover:not(:disabled){background:var(--color-accent-strong);transform:scale(1.05);box-shadow:none}.confirm-deploy-btn:disabled{background:rgb(var(--rgb-fg) / .1);color:rgb(var(--rgb-fg) / .2);cursor:not-allowed}.upload-overlay-technical{position:fixed;top:0;right:0;bottom:0;left:0;background:#020617d9;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);z-index:2000;display:flex;align-items:center;justify-content:center}.upload-card-technical{width:420px;background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:40px;text-align:center;box-shadow:0 30px 60px rgb(var(--rgb-black) / calc(.6 * var(--shadow-k)))}.processing-loader{width:40px;height:40px;border:2px solid rgb(var(--rgb-accent) / .1);border-top-color:var(--color-accent);border-radius:50%;margin:0 auto 20px;animation:spin 1s linear infinite}.empty-registry-technical{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:100px 20px;text-align:center;max-width:600px;margin:0 auto}.empty-icon-container{width:100px;height:100px;background:radial-gradient(circle,rgb(var(--rgb-blue) / .1) 0%,transparent 70%);display:flex;align-items:center;justify-content:center;border-radius:50%;margin-bottom:24px}.empty-title{font-size:28px;font-weight:800;color:var(--text);margin-bottom:16px;letter-spacing:-.02em}.empty-description{font-size:14px;line-height:1.6;color:var(--text-muted);margin-bottom:40px}.empty-description code{background:rgb(var(--rgb-blue) / .1);padding:2px 6px;border-radius:4px;font-weight:600}.upload-trigger-massive{cursor:pointer;display:block;border-radius:8px}.upload-trigger-massive:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:4px}.massive-upload-content{display:flex;flex-direction:column;align-items:center;padding:30px 60px;background:var(--surface);border:1px solid var(--color-accent);box-shadow:none;border-radius:8px;color:var(--color-accent);font-weight:700;font-size:16px;transition:all .3s cubic-bezier(.4,0,.2,1);box-shadow:0 0 0 transparent}.massive-upload-content:hover{background:rgb(var(--rgb-blue) / .05);transform:translateY(-4px);box-shadow:none;border-style:solid}.massive-upload-content svg{transition:transform .3s ease}.massive-upload-content:hover svg{transform:translateY(-4px) scale(1.1)}.copy-hint{cursor:pointer;opacity:.4;transition:opacity .2s}.copy-hint:hover{opacity:1}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (min-width: 1401px){.apps-registry-content{padding:0 24px 24px}}.device-explorer-container{display:flex;flex-direction:column;width:100%;gap:var(--space-4)}.device-explorer-header-entry{display:flex;flex-direction:column;gap:4px;min-width:0}.device-explorer-header-value{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.device-explorer-header-value>.device-explorer-header__platform-btn+.device-explorer-header__platform-btn{margin-left:4px}.device-explorer-header__platform-btn{display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:6px;background:rgb(var(--rgb-well) / calc(.4 * var(--well-k)));border:1px solid var(--border);color:var(--text-muted);font-size:12px;font-weight:600;cursor:pointer;transition:all .2s ease}.device-explorer-header__platform-btn:hover{background:rgb(var(--rgb-fg) / .03);color:var(--text);border-color:var(--border)}.device-explorer-header__platform-btn.selected{background:rgb(var(--rgb-accent) / .05);color:var(--color-accent);border-color:rgb(var(--rgb-accent) / .3);box-shadow:none}.device-explorer-search-wrapper{position:relative;width:320px}.device-explorer-search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);pointer-events:none;opacity:.5}.device-explorer-header-text-filter{width:100%;height:32px;padding:0 12px 0 36px;border-radius:6px;border:1px solid var(--border);background:rgb(var(--rgb-well) / calc(.4 * var(--well-k)));font-family:JetBrains Mono,monospace;font-size:12px;color:var(--text);transition:all .2s ease}.device-explorer-header-text-filter:focus{outline:none;border-color:var(--color-accent);background:rgb(var(--rgb-well) / calc(.6 * var(--well-k)));box-shadow:none}.device-explorer-header-text-filter::placeholder{color:var(--text-dim);font-size:11px}:root[data-theme=light] .device-explorer-header-container{background:rgb(var(--rgb-white) / .7)}.badge-base{display:inline-flex;align-items:center;gap:6px;border-radius:6px;border:1px solid transparent;padding:2px 8px;font-size:11px;font-weight:800;transition:all .2s ease;white-space:nowrap}.badge-variant-default{background:rgb(var(--rgb-well) / calc(.3 * var(--well-k)));color:var(--text-dim);border-color:var(--border)}.badge-variant-success{background:rgb(var(--rgb-success) / .05);color:var(--color-success);border-color:rgb(var(--rgb-success) / .2)}.badge-variant-warning{background:#ffc1070d;color:#ffc107;border-color:#ffc10733}.badge-variant-error{background:rgb(var(--rgb-red-alt) / .05);color:var(--red-alt);border-color:rgb(var(--rgb-red-alt) / .2)}.badge-variant-secondary{background:var(--surface);color:var(--text);border-color:var(--border)}.badge-variant-outline{background:transparent;color:var(--text-dim);border:1px solid var(--border)}.badge-variant-outline:hover{color:var(--text);border-color:var(--text-muted)}:root[data-theme=light] .badge-variant-warning{background:rgb(var(--rgb-amber) / .08);color:var(--amber);border-color:rgb(var(--rgb-amber) / .3)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as e,j as t,N as r}from"./index-EkaQM1DK.js";import{l as s}from"./view-state-CP9dE1UI.js";const i=()=>{const[a]=e();return t.jsx(r,{to:s(a),replace:!0})};export{i as SelectorDetailRedirect,i as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{c as ae,p as ne,u as pe,r as d,j as t,A as ve,v as re,z as ge,w as be,t as le,X as I,e as ye,E as je,b as Ne,K as Se}from"./index-EkaQM1DK.js";import{P as ke}from"./page-header-DoD3TOzZ.js";import{a as we}from"./SegmentedControl-BFW9Dlqd.js";import{B as N}from"./button-WW9j43wR.js";import{S as Ce}from"./stat-tile-BY0RDTRm.js";import{L as ie,n as Ae,C as $e}from"./line-chart-9P3RxScy.js";import{E as Me}from"./EmptyState-DkUVmANo.js";import{I as Ee}from"./input-ChaTXeCq.js";import{S as O}from"./select-CTcD4jWR.js";import{s as _,r as Y,w as Te,P as _e}from"./view-state-CP9dE1UI.js";import{p as Le}from"./labels-C21SA4JG.js";import{M as R}from"./Modal-D6XfQHPr.js";import{C as Ie}from"./check-D8ifHIJR.js";import{C as oe}from"./copy-W00zUBwN.js";import"./utils-CDN07tui.js";import"./index-DWHTp1YP.js";/**
|
|
2
|
-
* @license lucide-react v0.555.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const De=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Be=ae("link-2",De);/**
|
|
7
|
-
* @license lucide-react v0.555.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Pe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Re=ae("send",Pe),Fe=3e4,ze=5*6e4;function Oe(){const{on:e}=ne(),n=pe(),[s,r]=d.useState([]);if(d.useEffect(()=>{const o=e("selector_regressed",l=>{r(i=>{const u=Date.now()-ze;return[...i.filter(b=>b.receivedAt>=u),{selector:(l==null?void 0:l.original_selector)??"",receivedAt:Date.now()}]})});return()=>{o&&o()}},[e]),d.useEffect(()=>{if(s.length===0)return;const o=setTimeout(()=>r([]),Fe);return()=>clearTimeout(o)},[s]),s.length===0)return null;const c=s.length===1?s[0]:null;return t.jsxs("div",{role:"alert",className:"flex items-center gap-3 rounded-lg border border-[var(--color-warning)] bg-[var(--surface)] px-4 py-2.5 text-sm text-[var(--text)]",children:[t.jsx(ve,{size:14,className:"shrink-0 text-[var(--color-warning)]","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:c?t.jsxs(t.Fragment,{children:["A selector you fixed broke again:"," ",t.jsx("code",{className:"font-mono text-xs",title:c.selector,children:c.selector})]}):`${s.length} selectors you fixed broke again in the last 5 minutes.`}),t.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{n("/selector-health"),r([])},children:"Show selectors to fix"}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r([]),className:"rounded p-1 text-[var(--text-muted)] hover:text-[var(--text)]",children:t.jsx(re,{size:13})})]})}const He={"accessibility id":"Accessibility ID",xpath:"XPath",id:"ID",name:"Name","class name":"Class Name","-android uiautomator":"UiAutomator","-ios predicate string":"iOS Predicate","-ios class chain":"iOS Class Chain","xenon:visual":"Visual AI (coords)"};function Ue(e){return e?He[e]??e:"(unknown strategy)"}const Xe={fix:"To fix",verifying:"Being verified",fixed:"Fixed",muted:"Muted"},qe={heals:"Most heals",recent:"Most recent",time:"Most time spent healing"},Ve=["Resilio","Native","Fuzzy XML","OCR","Visual AI","LLM"],P={Resilio:"Found it from its saved fingerprint",Native:"Found it again with the original selector","Fuzzy XML":"Found the closest match in the screen's structure",OCR:"Found it by reading the text on screen","Visual AI":"Found it in a screenshot with AI",LLM:"Asked a language model to find it"},Ke=[{value:"android",label:"Android"},{value:"ios",label:"iOS"},{value:"tvos",label:"tvOS"}];function J(e){if(!(e>0))return"0 s";const n=e/1e3;if(n<1)return"<1 s";if(Math.round(n)<60)return`${Math.round(n)} s`;const s=n/60;if(Math.round(s)<60)return`${Math.round(s)} min`;const r=s/60;return`${r<10?r.toFixed(1):Math.round(r)} h`}function q(e,n=Date.now()){if(!e)return"—";const s=Date.parse(e);if(!Number.isFinite(s))return"—";const r=Math.floor(Math.max(0,n-s)/6e4);if(r<1)return"just now";if(r<60)return`${r} min ago`;const c=Math.floor(r/60);if(c<24)return`${c} h ago`;const o=Math.floor(c/24);return o===1?"yesterday":`${o} days ago`}function ce(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function V(e){if(!e)return"—";const n=Date.parse(e);return Number.isFinite(n)?new Date(n).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):"—"}function Ge(e,n,s,r){const c=`the ${s} days before`;if(e===n)return{text:`Same as ${c}`,tone:"neutral"};if(n===0)return{text:`None ${c}`,tone:"bad"};const o=e>n,l=o?"bad":"good";if(r==="count")return{text:`${Math.abs(e-n)} ${o?"more":"fewer"} than ${c}`,tone:l};if(r==="duration")return{text:`${J(Math.abs(e-n))} ${o?"more":"less"} than ${c}`,tone:l};const i=Math.round(Math.abs(e-n)/n*100);return i===0?{text:`About the same as ${c}`,tone:"neutral"}:{text:`${i}% ${o?"more":"fewer"} than ${c}`,tone:l}}function de(e){return`${Math.round(e*100)}% of heals`}function K(e){return e?Ue(e):"Unknown type"}function Je(e){switch(e==null?void 0:e.status){case"pending":return`Being verified, ${e.cleanBuilds} of 3 clean builds`;case"resolved":return"Fixed";case"muted":return"Muted";default:return"To fix"}}function G(e){return e!=null&&e.name?` by ${e.name}`:""}const We={marked_fixed:"Marked fixed",verification_cancelled:"Verification cancelled",verified:"Verified after 3 clean builds",broke_again:"Broke again",muted:"Muted",unmuted:"Unmuted"};function Ye(e){return`${We[e.action]??"Changed"}${G(e.by)}`}const H=e=>e.toLocaleString(),Qe=({summary:e,days:n})=>{const s=e==null?void 0:e.current,r=e==null?void 0:e.prior,c=[{label:"Selectors that needed healing",value:s==null?void 0:s.distinctSelectors,before:r==null?void 0:r.distinctSelectors,kind:"count",show:H},{label:"Heals",value:s==null?void 0:s.totalHeals,before:r==null?void 0:r.totalHeals,kind:"percent",show:H},{label:"Sessions affected",value:s==null?void 0:s.sessionsTouched,before:r==null?void 0:r.sessionsTouched,kind:"percent",show:H},{label:"Time spent healing",value:s==null?void 0:s.timeSpentMs,before:r==null?void 0:r.timeSpentMs,kind:"duration",show:J}];return t.jsx("div",{className:"grid grid-cols-4 gap-3",children:c.map(o=>{const l=o.value!==void 0&&o.before!==void 0?Ge(o.value,o.before,n,o.kind):null;return t.jsx(Ce,{label:o.label,value:o.value!==void 0?o.show(o.value):"—",note:l==null?void 0:l.text,noteTone:(l==null?void 0:l.tone)??"neutral"},o.label)})})},Q="var(--color-info)",Z="var(--color-warning)",ee=({color:e,label:n,total:s})=>t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"inline-block h-0.5 w-3",style:{background:e}}),t.jsx("span",{children:n}),t.jsx("span",{className:"tabular-nums text-[var(--text)]",children:s.toLocaleString()})]}),Ze=({trend:e,days:n,failed:s})=>{var h;const r=d.useMemo(()=>e??[],[e]),c=((h=r[0])==null?void 0:h.t)??0,o=r.reduce((m,y)=>m+y.heals,0),l=r.reduce((m,y)=>m+y.aiHeals,0),i=d.useMemo(()=>r.map(m=>m.t-c),[r,c]),u=d.useMemo(()=>[{key:"heals",label:"All heals",color:Q,values:r.map(m=>m.heals)},{key:"ai",label:"Heals that used AI",color:Z,values:r.map(m=>m.aiHeals)}],[r]),b=r.reduce((m,y)=>Math.max(m,y.heals),0);let f;return e===null&&s?f=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Couldn't load heals per day. Try again in a moment."}):e===null?f=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}):o===0?f=t.jsxs("div",{className:"text-xs text-[var(--text-dim)]",children:["No heals in the last ",n," days."]}):f=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-[var(--text-muted)]",children:[t.jsx(ee,{color:Q,label:"All heals",total:o}),t.jsx(ee,{color:Z,label:"Heals that used AI",total:l})]}),t.jsx(ie,{times:i,series:u,yMax:Ae(b),formatValue:m=>String(Math.round(m)),formatTime:m=>ce(c+m),ariaLabel:"Heals per day",height:120})]}),t.jsx($e,{header:"Heals per day",children:f})},D=({title:e,tone:n="neutral",children:s})=>t.jsx("span",{title:e,className:`inline-block max-w-full truncate rounded px-1.5 py-px text-[10px] font-medium ${n==="warning"?"border border-[var(--color-warning)] text-[var(--color-warning)]":"bg-[rgb(var(--rgb-fg)/0.06)] text-[var(--text-muted)]"}`,children:s}),te=({strategy:e,text:n,extra:s})=>t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-0.5 flex min-w-0 items-center gap-1.5",children:[t.jsx(D,{children:K(e)}),s]}),t.jsx("code",{className:"line-clamp-2 break-all font-mono text-[11px] leading-snug text-[var(--text)]",title:n,children:n})]}),et=300,tt=["fix","verifying","fixed","muted"],st=["heals","recent","time"],E=e=>t.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:e});function at(e,n,s){const r={key:"selector",label:"Selector",cell:l=>t.jsx(te,{strategy:l.strategy,text:l.selector,extra:e==="fix"&&l.state&&l.state.brokeAgain>0?t.jsx(D,{tone:"warning",children:"Broke again"}):null})},c=l=>({key:"heals",label:l,width:"96px",cell:i=>t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold tabular-nums text-[var(--text)]",children:i.heals.toLocaleString()}),t.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.sessions," ",i.sessions===1?"session":"sessions"]})]})}),o={key:"last",label:"Last healed",width:"104px",cell:l=>E(q(l.lastHealedAt))};switch(e){case"fix":return n?[r,c("Heals"),o]:[r,c("Heals"),o,{key:"method",label:"Healed by",width:"112px",cell:l=>l.topMethod?t.jsx(D,{title:P[l.topMethod],children:l.topMethod}):E("—")},{key:"fix",label:"Suggested fix",width:"34%",cell:l=>l.suggestion?t.jsx(te,{strategy:l.suggestion.strategy,text:l.suggestion.selector,extra:t.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:de(l.suggestion.share)})}):E("None yet")}];case"verifying":{const l={key:"progress",label:"Progress",width:"150px",cell:i=>{var u;return t.jsxs("span",{className:"text-xs text-[var(--text)]",children:[((u=i.state)==null?void 0:u.cleanBuilds)??0," of 3 clean builds"]})}};return n?[r,l]:[r,l,{key:"marked",label:"Marked fixed",width:"180px",cell:i=>{var u,b;return E(`${q(((u=i.state)==null?void 0:u.fixedAt)??null)}${G(((b=i.state)==null?void 0:b.fixedBy)??null)}`)}},c(`Heals, ${s} days`)]}case"fixed":{const l={key:"verified",label:"Verified",width:"140px",cell:i=>{var u;return E(V(((u=i.state)==null?void 0:u.resolvedAt)??null))}};return n?[r,l]:[r,l,c(`Heals, ${s} days`)]}case"muted":{const l={key:"muted",label:"Muted",width:"180px",cell:i=>{var u,b;return E(`${V(((u=i.state)==null?void 0:u.mutedAt)??null)}${G(((b=i.state)==null?void 0:b.mutedBy)??null)}`)}};return n?[r,l]:[r,l,{key:"reason",label:"Reason",width:"26%",cell:i=>{var u;return(u=i.state)!=null&&u.muteReason?t.jsx("span",{className:"line-clamp-2 text-xs text-[var(--text)]",children:i.state.muteReason}):E("No reason given")}},c(`Heals, ${s} days`)]}}}function nt(e,n,s){if(n)return{title:`No selectors match “${n}”`,description:"Try fewer or different words."};switch(e){case"fix":return{title:`Nothing to fix in the last ${s} days`,description:"Every selector your tests used was found without healing."};case"verifying":return{title:"Nothing being verified",description:"When you mark a selector fixed, Xenon watches its next 3 clean builds here."};case"fixed":return{title:`Nothing fixed in the last ${s} days`,description:"Selectors that pass 3 clean builds after being marked fixed show here."};case"muted":return{title:"Nothing muted",description:"A muted selector is left out of this list, the CI gate and the digest."}}}const rt=({view:e,data:n,loading:s,compact:r,selectedKey:c,onView:o,onOpen:l,error:i})=>{const[u,b]=d.useState(e.q);d.useEffect(()=>b(e.q),[e.q]),d.useEffect(()=>{if(u===e.q)return;const a=setTimeout(()=>o({q:u,page:1}),et);return()=>clearTimeout(a)},[u,e.q,o]);const f=at(e.tab,r,e.days),h=n&&n.tab===e.tab?n:null,m=(h==null?void 0:h.items)??[],y=(h==null?void 0:h.total)??0,k=(h==null?void 0:h.page)??e.page,w=(h==null?void 0:h.pageSize)??50,T=Math.max(1,Math.ceil(y/w)),A=y===0?0:(k-1)*w+1,C=Math.min(y,k*w),$=nt(e.tab,e.q,e.days);return t.jsxs("section",{"aria-label":"Selectors",className:"rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsx("div",{role:"tablist","aria-label":"Selector status",className:"flex gap-1 border-b border-[var(--border)] px-3",children:tt.map(a=>{var j;const g=e.tab===a,p=(j=n==null?void 0:n.counts)==null?void 0:j[a];return t.jsxs("button",{type:"button",role:"tab","aria-selected":g,onClick:()=>{g||o({tab:a,page:1})},className:`-mb-px flex items-center gap-2 border-b-2 px-3 py-2.5 text-sm ${g?"border-[var(--color-accent)] font-medium text-[var(--text)]":"border-transparent text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:[Xe[a],t.jsx("span",{className:"rounded-full bg-[rgb(var(--rgb-fg)/0.08)] px-1.5 text-[11px] tabular-nums",children:typeof p=="number"?p.toLocaleString():"–"})]},a)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--border)] px-3 py-2.5",children:[t.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[t.jsx(ge,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-dim)]"}),t.jsx(Ee,{type:"search","aria-label":"Search",value:u,onChange:a=>b(a.target.value),placeholder:e.tab==="fix"?"Search selectors and fixes":"Search selectors",className:"h-8 w-full pl-8 pr-2 text-xs"})]}),e.tab==="fix"&&t.jsxs(t.Fragment,{children:[t.jsxs(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Platform",value:e.platform,onChange:a=>o({platform:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All platforms"}),Ke.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))]}),t.jsxs(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Healing method",value:e.method,onChange:a=>o({method:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All healing methods"}),Ve.map(a=>t.jsx("option",{value:a,title:P[a],children:a},a))]}),t.jsx(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Sort",value:e.sort,onChange:a=>o({sort:a.target.value,page:1}),children:st.map(a=>t.jsx("option",{value:a,children:qe[a]},a))})]})]}),h?m.length===0?t.jsx(Me,{title:$.title,description:$.description}):t.jsxs("table",{className:"w-full table-fixed text-left",children:[t.jsx("colgroup",{children:f.map(a=>t.jsx("col",{style:a.width?{width:a.width}:void 0},a.key))}),t.jsx("thead",{children:t.jsx("tr",{children:f.map(a=>t.jsx("th",{scope:"col",className:"px-3 py-2 text-[11px] font-medium text-[var(--text-muted)]",children:a.label},a.key))})}),t.jsx("tbody",{children:m.map(a=>{const g=_(a),p=g===c,j=()=>l({strategy:a.strategy,selector:a.selector});return t.jsx("tr",{tabIndex:0,"data-selector-row":"","data-key":g,"aria-current":p?"true":void 0,onClick:j,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),j())},className:`cursor-pointer border-t border-[var(--border)] align-top outline-none hover:bg-[rgb(var(--rgb-fg)/0.03)] focus-visible:bg-[rgb(var(--rgb-fg)/0.05)] ${p?"bg-[rgb(var(--rgb-fg)/0.06)]":""}`,children:f.map(M=>t.jsx("td",{className:"px-3 py-2.5 text-xs",children:M.cell(a)},M.key))},g)})})]}):t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:i&&!s?"Couldn't load selectors. Try again in a moment.":"Loading selectors…"}),y>0&&t.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] px-3 py-2 text-xs text-[var(--text-muted)]",children:[t.jsxs("span",{className:"tabular-nums",children:[A,"–",C," of ",y.toLocaleString()]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{variant:"secondary",size:"sm",disabled:k<=1,onClick:()=>o({page:k-1}),children:"Previous"}),t.jsx(N,{variant:"secondary",size:"sm",disabled:k>=T,onClick:()=>o({page:k+1}),children:"Next"})]})]})]})},lt={javascript:{"accessibility id":e=>`await driver.findElement('accessibility id', '${e}')`,xpath:e=>`await driver.findElement('xpath', '${e}')`,id:e=>`await driver.findElement('id', '${e}')`,name:e=>`await driver.findElement('name', '${e}')`,"class name":e=>`await driver.findElement('class name', '${e}')`,"-android uiautomator":e=>`await driver.findElement('-android uiautomator', '${e}')`,"-ios predicate string":e=>`await driver.findElement('-ios predicate string', '${e}')`,"-ios class chain":e=>`await driver.findElement('-ios class chain', '${e}')`},java:{"accessibility id":e=>`driver.findElement(AppiumBy.accessibilityId("${e}"))`,xpath:e=>`driver.findElement(AppiumBy.xpath("${e}"))`,id:e=>`driver.findElement(AppiumBy.id("${e}"))`,name:e=>`driver.findElement(AppiumBy.name("${e}"))`,"class name":e=>`driver.findElement(AppiumBy.className("${e}"))`,"-android uiautomator":e=>`driver.findElement(AppiumBy.androidUIAutomator("${e}"))`,"-ios predicate string":e=>`driver.findElement(AppiumBy.iOSNsPredicateString("${e}"))`,"-ios class chain":e=>`driver.findElement(AppiumBy.iOSClassChain("${e}"))`},python:{"accessibility id":e=>`driver.find_element(AppiumBy.ACCESSIBILITY_ID, '${e}')`,xpath:e=>`driver.find_element(AppiumBy.XPATH, '${e}')`,id:e=>`driver.find_element(AppiumBy.ID, '${e}')`,name:e=>`driver.find_element(AppiumBy.NAME, '${e}')`,"class name":e=>`driver.find_element(AppiumBy.CLASS_NAME, '${e}')`,"-android uiautomator":e=>`driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, '${e}')`,"-ios predicate string":e=>`driver.find_element(AppiumBy.IOS_PREDICATE, '${e}')`,"-ios class chain":e=>`driver.find_element(AppiumBy.IOS_CLASS_CHAIN, '${e}')`},csharp:{"accessibility id":e=>`driver.FindElement(MobileBy.AccessibilityId("${e}"))`,xpath:e=>`driver.FindElement(By.XPath("${e}"))`,id:e=>`driver.FindElement(By.Id("${e}"))`,name:e=>`driver.FindElement(By.Name("${e}"))`,"class name":e=>`driver.FindElement(By.ClassName("${e}"))`},ruby:{"accessibility id":e=>`driver.find_element(:accessibility_id, '${e}')`,xpath:e=>`driver.find_element(:xpath, '${e}')`,id:e=>`driver.find_element(:id, '${e}')`,name:e=>`driver.find_element(:name, '${e}')`,"class name":e=>`driver.find_element(:class_name, '${e}')`}};function it(e,n){const s=e==="java"||e==="csharp",r=n.replace(/\\/g,"\\\\");return s?r.replace(/"/g,'\\"'):r.replace(/'/g,"\\'")}function ue(e,n,s){var c;if(n==="xenon:visual")return"/* Visual AI (coordinates) — no portable Appium snippet. Use snapshot view to find a stable native locator. */";const r=(c=lt[e])==null?void 0:c[n];return r?r(it(e,s)):`${(n??"").toString().toUpperCase()}: ${s}`}const W=[{value:"javascript",short:"JS",label:"JavaScript (WebdriverIO)"},{value:"java",short:"Java",label:"Java (Appium-Java)"},{value:"python",short:"Py",label:"Python (Appium-Python)"},{value:"csharp",short:"C#",label:"C# (.NET)"},{value:"ruby",short:"Rb",label:"Ruby"}],me="xenon.copyLang";function ot(){try{const e=localStorage.getItem(me);return e&&W.find(n=>n.value===e)?e:null}catch{return null}}function ct(e){try{localStorage.setItem(me,e)}catch{}}function xe(e){var n;return((n=W.find(s=>s.value===e))==null?void 0:n.short)??e}function dt({open:e,initialLang:n,strategy:s,value:r,onCopy:c,onClose:o}){const[l,i]=d.useState(n??"javascript"),[u,b]=d.useState(!0),f=ue(l,s,r),h=async()=>{try{await navigator.clipboard.writeText(f)}catch{}u&&ct(l),c(l,f),o()};return t.jsxs(R,{open:e,onClose:o,title:"Choose your default copy language",width:520,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:o,children:"Cancel"}),t.jsxs(N,{onClick:h,children:["Copy as ",xe(l)]})]}),children:[t.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"Snippets will be copied in this language until you change it."}),t.jsx("ul",{className:"mb-3 space-y-1",children:W.map(m=>t.jsx("li",{children:t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text)]",children:[t.jsx("input",{type:"radio",name:"copy-lang",value:m.value,checked:l===m.value,onChange:()=>i(m.value)}),m.label]})},m.value))}),t.jsx("div",{className:"mb-1 text-[11px] font-semibold text-[var(--text-dim)]",children:"Preview"}),t.jsx("pre",{className:"mb-3 overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--surface-sunken)] p-3 font-mono text-[11px] text-[var(--text)]",children:t.jsx("code",{children:f})}),t.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-muted)]",children:[t.jsx("input",{type:"checkbox",checked:u,onChange:m=>b(m.target.checked)}),"Remember my choice"]})]})}function ut({strategy:e,value:n,onCopied:s}){const[r,c]=d.useState(!1),[o,l]=d.useState(!1),i=ot(),u=e==="xenon:visual",b=async()=>{if(!i){c(!0);return}try{await navigator.clipboard.writeText(ue(i,e,n))}catch{}l(!0),s(i),setTimeout(()=>l(!1),1500)},f=i?`Copy as ${xe(i)}`:"Copy as code";return t.jsxs("span",{className:"inline-flex shrink-0",children:[t.jsxs(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-r-none",onClick:h=>{h.stopPropagation(),b()},disabled:u&&!n,"aria-label":f,title:u?"Found by its place on screen: there is no selector to copy":f,children:[o?t.jsx(Ie,{size:12}):t.jsx(oe,{size:12}),t.jsx("span",{children:o?"Copied":i?f:"Copy as…"})]}),t.jsx(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-l-none border-l-0 px-1.5",onClick:h=>{h.stopPropagation(),c(!0)},title:"Choose copy language","aria-label":"Choose copy language",children:t.jsx(be,{size:12})}),t.jsx(dt,{open:r,initialLang:i??void 0,strategy:e,value:n,onCopy:h=>{l(!0),s(h),setTimeout(()=>l(!1),1500)},onClose:()=>c(!1)})]})}const se=500,mt=({open:e,busy:n,onClose:s,onConfirm:r})=>t.jsx(R,{open:e,onClose:s,title:"Mark this selector fixed?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:r,disabled:n,children:"Mark fixed"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Xenon watches the next 3 clean builds. If this selector heals again, it goes back to To fix."})}),xt=({open:e,busy:n,onClose:s,onConfirm:r})=>t.jsx(R,{open:e,onClose:s,title:"Cancel verification?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Keep verifying"}),t.jsx(N,{onClick:r,disabled:n,children:"Cancel verification"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"The selector goes back to To fix, and its clean builds start again from zero."})}),ht=({open:e,busy:n,onClose:s,onConfirm:r})=>{const[c,o]=d.useState("");return d.useEffect(()=>{e&&o("")},[e]),t.jsxs(R,{open:e,onClose:s,title:"Mute this selector?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:()=>r(c.trim()),disabled:n,children:"Mute"})]}),children:[t.jsx("p",{className:"mb-3 text-sm text-[var(--text-muted)]",children:"A muted selector is left out of this list, the CI gate and the digest, for everyone, until someone unmutes it."}),t.jsx("label",{htmlFor:"mute-reason",className:"block text-xs font-medium text-[var(--text)]",children:"Reason (optional)"}),t.jsx("textarea",{id:"mute-reason",value:c,maxLength:se,rows:3,placeholder:"Screen being redesigned",onChange:l=>o(l.target.value),className:"mt-1 w-full rounded-md border border-[var(--border-strong)] bg-[var(--surface)] px-2 py-1.5 text-sm text-[var(--text)]"}),t.jsxs("div",{className:"mt-1 text-right text-[11px] tabular-nums text-[var(--text-dim)]",children:[c.length,"/",se]})]})},ft={mark_fixed:"Marked fixed. Xenon is watching the next 3 clean builds.",mute:"Muted.",unmute:"Unmuted.",cancel_verification:"Verification cancelled."},pt={pending:"border-[var(--color-info)] text-[var(--color-info)]",resolved:"border-[var(--color-success)] text-[var(--color-success)]",muted:"border-[var(--border-strong)] text-[var(--text-muted)]"},vt=({state:e})=>t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[11px] font-medium ${pt[(e==null?void 0:e.status)??""]??"border-[var(--color-danger)] text-[var(--color-danger)]"}`,children:Je(e)}),U=({label:e,onClick:n,children:s})=>t.jsx("button",{type:"button","aria-label":e,title:e,onClick:n,className:"rounded p-1.5 text-[var(--text-muted)] hover:bg-[rgb(var(--rgb-fg)/0.06)] hover:text-[var(--text)]",children:s}),L=({title:e,children:n})=>t.jsxs("section",{"aria-label":e,children:[t.jsx("h3",{className:"mb-2 text-xs font-semibold text-[var(--text)]",children:e}),n]}),X=({title:e,rows:n})=>n.length===0?null:t.jsxs("div",{className:"mb-3",children:[t.jsx("div",{className:"mb-1 text-[11px] text-[var(--text-dim)]",children:e}),n.map(s=>t.jsxs("div",{className:"flex justify-between gap-3 py-0.5 text-xs",children:[t.jsx("span",{className:"min-w-0 truncate text-[var(--text)]",title:s.label,children:s.label}),t.jsx("span",{className:"shrink-0 tabular-nums text-[var(--text-muted)]",children:s.count.toLocaleString()})]},s.key))]}),gt=({activity:e})=>t.jsx(L,{title:"Activity",children:e.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No changes recorded yet."}):t.jsx("ul",{children:e.map((n,s)=>t.jsxs("li",{className:"flex justify-between gap-3 py-1 text-[11px]",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"text-[var(--text)]",children:Ye(n)}),n.reason&&t.jsxs("span",{className:"text-[var(--text-muted)]",children:[": “",n.reason,"”"]})]}),t.jsx("span",{className:"shrink-0 text-[var(--text-dim)]",children:V(n.at)})]},`${n.at}-${s}`))})}),bt=({target:e,days:n,tz:s,refreshKey:r,onClose:c,onChanged:o})=>{var $;const{toast:l}=le(),[i,u]=d.useState(null),[b,f]=d.useState("loading"),[h,m]=d.useState(null),[y,k]=d.useState(!1);d.useEffect(()=>{u(null),f("loading")},[e.strategy,e.selector]),d.useEffect(()=>{let a=!0;return I.getSelectorPanel(e.strategy,e.selector,n,s).then(({status:g,body:p})=>{a&&(g===404?(u(null),f("missing")):g===200&&p?(u(p),f("ready")):f("failed"))}).catch(()=>{a&&f("failed")}),()=>{a=!1}},[e.strategy,e.selector,n,s,r]);const w=async(a,g)=>{k(!0);try{await I.postSelectorStateAction({original_strategy:e.strategy,original_selector:e.selector,action:a,...g?{reason:g}:{}}),l(ft[a],"success")}catch(p){const j=p.status;l(j===409?"Someone changed this selector just now. It has been refreshed.":j===404?"This selector isn't available any more.":"That didn't work. Try again.","error")}finally{k(!1),m(null),o()}},T=async(a,g)=>{try{await navigator.clipboard.writeText(a),l(g,"success")}catch{l("Couldn't copy: your browser blocked it.","error")}},A=(($=i==null?void 0:i.state)==null?void 0:$.status)??"active",C=d.useMemo(()=>{var p;const a=(i==null?void 0:i.daily)??[],g=((p=a[0])==null?void 0:p.t)??0;return{start:g,times:a.map(j=>j.t-g),values:a.map(j=>j.heals)}},[i]);return t.jsxs("aside",{"aria-label":"Selector details",className:"sticky top-4 flex max-h-[calc(100vh-7rem)] w-[480px] shrink-0 flex-col overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs("header",{className:"border-b border-[var(--border)] p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(D,{children:K(e.strategy)}),i&&t.jsx(vt,{state:i.state}),t.jsxs("span",{className:"ml-auto flex items-center gap-0.5",children:[t.jsx(U,{label:"Copy selector",onClick:()=>void T(e.selector,"Selector copied"),children:t.jsx(oe,{size:14})}),t.jsx(U,{label:"Copy link to this selector",onClick:()=>void T(window.location.href,"Link copied"),children:t.jsx(Be,{size:14})}),t.jsx(U,{label:"Close",onClick:c,children:t.jsx(re,{size:14})})]})]}),t.jsx("code",{className:"mt-2 block break-all font-mono text-xs leading-relaxed text-[var(--text)]",children:e.selector}),(i==null?void 0:i.canAct)&&t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[A==="active"&&e.strategy!==""&&t.jsx(N,{size:"sm",onClick:()=>m("mark_fixed"),children:"Mark fixed"}),A==="pending"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("cancel_verification"),children:"Cancel verification"}),A!=="muted"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("mute"),children:"Mute…"}),A==="muted"&&t.jsx(N,{size:"sm",variant:"secondary",disabled:y,onClick:()=>void w("unmute"),children:"Unmute"})]})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-4",children:[b==="loading"&&t.jsx("p",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}),b==="missing"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"This selector isn't available. It may belong to another team, or Xenon has no heals on record for it."}),b==="failed"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Couldn't load this selector. Try again in a moment."}),i&&i.heals===0&&t.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["No heals in the last ",n," days."]}),i&&i.heals>0&&t.jsxs(t.Fragment,{children:[t.jsx(L,{title:"Suggested fix",children:i.suggestions.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Xenon found the element without a selector it can suggest."}):t.jsx("ul",{className:"space-y-2",children:i.suggestions.map((a,g)=>t.jsx("li",{className:`rounded-md border p-2.5 ${g===0?"border-[var(--color-success)]":"border-[var(--border)]"}`,children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] text-[var(--text-muted)]",children:[t.jsx(D,{children:K(a.strategy)}),t.jsx("span",{children:de(a.share)}),a.methods.length>0&&t.jsxs("span",{title:a.methods.map(p=>P[p]??p).join(". "),children:["· ",a.methods.join(", ")]}),a.averageConfidence!==null&&t.jsxs("span",{children:["· ",Math.round(a.averageConfidence*100),"% confidence"]})]}),t.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--text)]",children:a.selector})]}),t.jsx(ut,{strategy:a.strategy??e.strategy,value:a.selector,onCopied:p=>l(`Copied as ${p}`,"success")})]})},`${a.strategy??""}\0${a.selector}`))})}),t.jsxs(L,{title:`In the last ${n} days`,children:[t.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:i.heals===1?"heal":"heals",value:i.heals.toLocaleString()},{label:i.sessions===1?"session":"sessions",value:i.sessions.toLocaleString()},{label:"spent healing",value:J(i.timeSpentMs)}].map(a=>t.jsxs("div",{className:"rounded-md bg-[rgb(var(--rgb-fg)/0.04)] px-2.5 py-2",children:[t.jsx("div",{className:"text-sm font-semibold tabular-nums text-[var(--text)]",children:a.value}),t.jsx("div",{className:"text-[11px] text-[var(--text-muted)]",children:a.label})]},a.label))}),C.times.length>1&&t.jsx("div",{className:"mt-3",children:t.jsx(ie,{times:C.times,series:[{key:"heals",label:"Heals",color:"var(--color-info)",values:C.values}],formatValue:a=>String(Math.round(a)),formatTime:a=>ce(C.start+a),ariaLabel:"Heals per day for this selector",height:56})})]}),t.jsxs(L,{title:"Where it happens",children:[t.jsx(X,{title:"Platforms",rows:i.platforms.map(a=>({key:a.name,label:Le(a.name),count:a.count}))}),t.jsx(X,{title:"Builds",rows:i.builds.map(a=>({key:a.id??"",label:a.name,count:a.count}))}),t.jsx(X,{title:"Devices",rows:i.devices.map(a=>({key:a.udid,label:a.name,count:a.count}))})]}),t.jsx(L,{title:"Recent heals",children:t.jsx("ul",{className:"divide-y divide-[var(--border)]",children:i.recent.map(a=>t.jsxs("li",{className:"py-2 text-[11px]",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[var(--text-muted)]",children:[t.jsx("span",{children:q(a.at)}),a.device&&t.jsxs("span",{className:"min-w-0 truncate",children:["· ",a.device]}),a.method&&t.jsxs("span",{title:P[a.method],children:["· ",a.method,a.confidence!==null?` ${Math.round(a.confidence*100)}%`:""]}),t.jsx(ye,{className:"ml-auto shrink-0 text-[var(--color-accent)] hover:underline",to:`/builds/${encodeURIComponent(a.buildId??"none")}/sessions/${encodeURIComponent(a.sessionId)}`,children:"Session"})]}),a.healedSelector&&t.jsx("code",{className:"mt-0.5 block truncate font-mono text-[var(--text)]",title:a.healedSelector,children:a.healedSelector})]},a.id))})})]}),i&&t.jsx(gt,{activity:i.activity})]}),t.jsx(mt,{open:h==="mark_fixed",busy:y,onClose:()=>m(null),onConfirm:()=>void w("mark_fixed")}),t.jsx(xt,{open:h==="cancel_verification",busy:y,onClose:()=>m(null),onConfirm:()=>void w("cancel_verification")}),t.jsx(ht,{open:h==="mute",busy:y,onClose:()=>m(null),onConfirm:a=>void w("mute",a||void 0)})]})},yt=1e3,jt=["healing_event","selector_fixed","selector_resolved","selector_regressed","selector_cancelled","selector_muted","selector_unmuted","selector_progress"],Nt=e=>!!e&&(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.isContentEditable),Ft=()=>{const[e,n]=je(),s=d.useMemo(()=>Y(e),[e]),r=d.useMemo(()=>-new Date().getTimezoneOffset(),[]),{on:c}=ne(),{toast:o}=le(),{me:l}=Ne(),i=!!l&&(l.role==="ADMIN"||l.role==="SUPER_ADMIN"||!!l.authDisabled),[u,b]=d.useState(null),[f,h]=d.useState(null),[m,y]=d.useState(!1),[k,w]=d.useState(!1),[T,A]=d.useState(!0),[C,$]=d.useState(0),[a,g]=d.useState(!1),p=d.useCallback((x,v=!1)=>n(Te({...Y(e),...x}),{replace:v}),[e,n]);d.useEffect(()=>{let x=!0;return I.getHealingSummary(s.days,r).then(v=>{x&&(b(v??null),w(!1))}).catch(()=>{x&&w(!0)}),()=>{x=!1}},[s.days,r,C]),d.useEffect(()=>{let x=!0;return A(!0),I.getHealingSelectors({tab:s.tab,days:s.days,q:s.q,platform:s.platform,method:s.method,sort:s.sort,page:s.page}).then(v=>{x&&(h(v??null),y(!1))}).catch(()=>{x&&y(!0)}).finally(()=>{x&&A(!1)}),()=>{x=!1}},[s.tab,s.days,s.q,s.platform,s.method,s.sort,s.page,C]);const j=d.useRef(null);d.useEffect(()=>{const x=()=>{j.current||(j.current=setTimeout(()=>{j.current=null,$(S=>S+1)},yt))},v=jt.map(S=>c(S,x));return()=>{v.forEach(S=>S&&S()),j.current&&clearTimeout(j.current),j.current=null}},[c]);const M=d.useCallback(x=>p({open:x}),[p]),F=d.useCallback(()=>{const x=s.open?_(s.open):null;p({open:null}),setTimeout(()=>{var S;(S=Array.from(document.querySelectorAll("[data-selector-row]")).find(B=>B.dataset.key===x))==null||S.focus()},0)},[s.open,p]),z=d.useCallback(x=>{const v=(f==null?void 0:f.items)??[];if(v.length===0)return;const S=s.open?v.findIndex(fe=>_(fe)===_(s.open)):-1,B=v[S<0?0:Math.min(v.length-1,Math.max(0,S+x))];p({open:{strategy:B.strategy,selector:B.selector}},!0)},[f,s.open,p]);d.useEffect(()=>{if(!s.open)return;const x=v=>{v.defaultPrevented||Nt(document.activeElement)||document.querySelector('[role="dialog"]')||(v.key==="Escape"?(v.preventDefault(),F()):v.key==="ArrowDown"?(v.preventDefault(),z(1)):v.key==="ArrowUp"&&(v.preventDefault(),z(-1)))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[s.open,F,z]);const he=async()=>{g(!0);try{const x=await I.sendHealingDigest({windowDays:s.days,limit:5,minHealCount:2}),v=(x==null?void 0:x.sent)??0;v===0?o("No webhook gets the digest yet. Add one in Notifications.","error"):o(`Digest sent to ${v} webhook${v===1?"":"s"}.`,"success")}catch{o("Couldn't send the digest. Try again.","error")}finally{g(!1)}};return t.jsxs("div",{children:[t.jsx(ke,{icon:Se,eyebrow:"Test quality",title:"Selector health",subtitle:"Selectors your tests could only find with self-healing. Fix the ones that heal most.",action:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(we,{size:"sm",label:"Period",value:String(s.days),onChange:x=>p({days:Number(x),page:1}),segments:_e.map(x=>({value:String(x),label:`${x} days`}))}),i&&t.jsxs(N,{variant:"secondary",size:"sm",onClick:()=>void he(),disabled:a,children:[t.jsx(Re,{size:14})," Send digest"]})]})}),t.jsxs("div",{className:"space-y-4 px-6 pb-8 pt-4",children:[t.jsx(Oe,{}),t.jsx(Qe,{summary:u,days:s.days}),t.jsx(Ze,{trend:u?u.trend??[]:null,days:s.days,failed:k&&!u}),t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(rt,{view:s,data:f,loading:T,compact:!!s.open,selectedKey:s.open?_(s.open):null,onView:p,onOpen:M,error:m})}),s.open&&t.jsx(bt,{target:s.open,days:s.days,tz:r,refreshKey:C,onClose:F,onChanged:()=>$(x=>x+1)})]})]})]})};export{yt as LIVE_REFRESH_MS,Ft as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{r as x,X as k,j as t,e as Q,f as Se,t as P,y as _e,R as Ce,p as Re,i as Te,u as $e}from"./index-EkaQM1DK.js";import{C as Ae,d as Me,p as ve,e as De,r as be,f as Ee,j as ge,k as V,c as Oe,h as Z,u as Le,b as Pe,q as Fe}from"./use-builds-data-fnfxatOd.js";import{A as Be}from"./arrow-left-DMvAWA8r.js";import{C as I}from"./chevron-right-BjKVUlB_.js";import{s as He}from"./labels-C21SA4JG.js";import{B as Ue,S as je,P as _}from"./BugReportButton-BpgWvmZo.js";import{C as Ie}from"./circle-x-BZbFCixZ.js";import{C as Je}from"./circle-check-CfP79QE2.js";import{S as E}from"./stat-tile-BY0RDTRm.js";import{C as z}from"./copy-W00zUBwN.js";import{A as Ve}from"./arrow-up-right-Ba0e2GeU.js";import{A as ze}from"./arrow-right-BEQgxmKT.js";import{f as Ke,a as ee,C as Ne,b as We,s as Xe,L as Ye,n as te}from"./line-chart-9P3RxScy.js";import{E as M}from"./EmptyState-DkUVmANo.js";import{A as qe}from"./activity-C9bE7Jm8.js";import{V as Ge}from"./video-off-eh69-FKB.js";import{D as ye}from"./download-CGz-MS3y.js";import{T as Qe,a as Ze,b as re,c as T,d as et,e as $}from"./Table-DrKjlL00.js";import{M as tt}from"./Modal-D6XfQHPr.js";import{N as rt}from"./network-DfIhNVJv.js";import"./time-D-gjmE1o.js";import"./index-DWHTp1YP.js";const st=4e3,se=e=>!!e&&typeof e=="object"&&typeof e.id=="string"&&typeof e.status=="string";function at(e){const[r,s]=x.useState(null),[a,n]=x.useState([]),[l,c]=x.useState([]),[i,d]=x.useState([]),[u,N]=x.useState([]),[p,v]=x.useState(!0),[g,j]=x.useState(null),[y,w]=x.useState(!1),[A,C]=x.useState(0),b=x.useRef(null);x.useEffect(()=>{if(!e){s(null),n([]),c([]),d([]),N([]),w(!1),v(!1);return}let m=!0;return b.current!==e&&v(!0),Promise.all([k.getSession(e),k.getSessionLogs(e),k.getDeviceLogs(e),k.getDebugLogs(e),k.getProfilingData(e).catch(()=>[])]).then(([f,h,R,D,q])=>{if(!m)return;const G=se(f);s(G?f:null),G?(b.current=e,w(!1),j(null)):(w(!!f&&typeof f=="object"&&(f.error===!0||typeof f.message=="string")),j(typeof(f==null?void 0:f.message)=="string"?f.message:"Session not found")),n(Array.isArray(h)?h:[]),c(Array.isArray(R)?R:[]),d(Array.isArray(D)?D:[]),N(Array.isArray(q)?q:[])}).catch(f=>{m&&j(f instanceof Error?f.message:String(f))}).finally(()=>{m&&v(!1)}),()=>{m=!1}},[e,A]);const o=(r==null?void 0:r.status)==="running";return x.useEffect(()=>{if(!e||!o)return;let m=!0;const f=setInterval(async()=>{try{const[h,R]=await Promise.all([k.getSession(e),k.getSessionLogs(e)]);if(!m||!se(h))return;s(h),Array.isArray(R)&&n(R),h.status!=="running"&&C(D=>D+1)}catch{}},st);return()=>{m=!1,clearInterval(f)}},[e,o]),{session:r,sessionLogs:a,deviceLogs:l,debugLogs:i,profiling:u,loading:p,error:g,notFound:y,refresh:()=>C(m=>m+1)}}const ae=({buildId:e,buildName:r,sessionId:s})=>t.jsxs("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-2 px-4 py-2 border-b border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs(Q,{to:"/builds",className:"inline-flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",children:[t.jsx(Be,{className:"h-3.5 w-3.5"}),"Sessions"]}),t.jsx(I,{className:"h-3 w-3 text-[var(--text-dim)]"}),r&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{to:`/builds/${e}`,className:"text-[11px] text-[var(--color-accent)] hover:underline",children:r}),t.jsx(I,{className:"h-3 w-3 text-[var(--text-dim)]"})]}),t.jsxs("span",{className:"font-mono text-[11px] text-[var(--text-muted)]",title:s,children:["#",s.slice(0,8)]})]}),nt={passed:{label:"Passed",Icon:Je,cls:"text-[var(--color-success)]"},failed:{label:"Failed",Icon:Ie,cls:"text-[var(--color-danger)]"},running:{label:"Running",Icon:Se,cls:"text-[var(--color-warning)]"},other:{Icon:Ae,cls:"text-[var(--text-dim)]"}};function K(e){const r=Oe(e),s=nt[r];return{bucket:r,...s,label:s.label??He(e||"unknown")}}const it=({session:e})=>{var l,c;const r=K(e.status),s=Me(e),a=[ve(e),e.device_version].filter(i=>i&&i!=="—").join(" "),n=[[De(e),a].filter(Boolean).join(" · "),be(e.ranOn),(l=e.owner)==null?void 0:l.name,Ee(e.startTime),ge(V(e))].filter(i=>i&&i!=="—");return t.jsxs("header",{className:"flex items-start justify-between gap-4 px-4 py-4 border-b border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium shrink-0 ${r.cls}`,children:[t.jsx(r.Icon,{className:`h-3.5 w-3.5 ${r.bucket==="running"?"animate-spin":""}`,"aria-hidden":"true"}),r.label]}),t.jsx("h1",{className:`text-lg font-semibold truncate ${s.source==="name"?"text-[var(--text)]":"text-[var(--text-muted)]"}`,title:s.source==="name"?s.text:`${s.text}
|
|
2
|
-
Unnamed session. Set xe:options.name in its capabilities to name it.`,children:s.text})]}),t.jsx("p",{"data-testid":"outcome-meta",className:"mt-1 text-xs text-[var(--text-muted)] tabular-nums truncate",title:((c=e.owner)==null?void 0:c.email)??void 0,children:n.join(" · ")})]}),t.jsx("div",{className:"shrink-0",children:t.jsx(Ue,{sessionId:e.id,mode:"full",variant:"inline"})})]})};function ot(e,r=8){if(!e)return[];const s=e.split(/\r?\n/),a=[];for(const n of s){const l=n.trim();if(/^at\s+/.test(l)&&(a.push(l),a.length>=r))break}return a}function W(e){return e?e.split(/[_\s]+/).filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "):""}function ne(e){if(!e)return{};try{const r=JSON.parse(e);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}function ie(e,r=200){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{const s=JSON.stringify(e);return s.length>r?s.slice(0,r)+"…":s}catch{return String(e)}}const F=e=>e.command_name||e.title||"command",J=e=>{const r=e.createdAt?Date.parse(e.createdAt):NaN;return Number.isFinite(r)?r:0},X=e=>[...e].sort((r,s)=>J(r)-J(s));function B(e){return e.is_success===!1||e.is_error===!0}function we(e){const r=[];let s=null;for(const a of X(e))a.is_healed&&a.healing_tier&&!r.includes(a.healing_tier)&&r.push(a.healing_tier),typeof a.duration=="number"&&(!s||a.duration>s.ms)&&(s={name:F(a),ms:a.duration});return{total:e.length,failed:e.filter(B).length,healed:e.filter(a=>a.is_healed).length,healedTiers:r,slowest:s,screenshots:e.filter(a=>a.screenshot).length}}const oe=(e,r)=>r?e?`${e}=${r}`:r:null;function lt(e){return X(e.filter(r=>r.is_healed)).map(r=>({id:r.id,command:F(r),original:oe(r.original_strategy,r.original_selector),healed:oe(r.healed_strategy,r.healed_selector),tier:r.healing_tier??null,confidence:typeof r.healing_confidence=="number"?Math.round(r.healing_confidence*100):null,at:r.createdAt}))}function ct(e){var r;if(!e.response)return null;try{const s=(r=JSON.parse(e.response))==null?void 0:r.value;if(!s||typeof s!="object")return null;const a=typeof s.message=="string"?s.message.trim():"";return a||(typeof s.error=="string"&&s.error?s.error:null)}catch{return null}}function dt(e){if(e.length===0)return{spanMs:0,bars:[]};const r=e.map(n=>{const l=J(n),c=typeof n.duration=="number"&&n.duration>0?n.duration:0;return{l:n,start:l-c,end:l,durationMs:c}}),s=Math.min(...r.map(n=>n.start)),a=Math.max(...r.map(n=>n.end));return{spanMs:Math.max(1,a-s),bars:r.sort((n,l)=>n.start-l.start).map(({l:n,start:l,durationMs:c})=>({id:n.id,label:F(n),startMs:l-s,durationMs:c,failed:B(n),healed:!!n.is_healed}))}}function xt(e){return X(e.filter(r=>r.screenshot)).map(r=>({id:r.id,path:r.screenshot,command:F(r),at:r.createdAt,failed:B(r)}))}function L(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const r=Math.round(e/1e3);return`${Math.floor(r/60)}m ${r%60}s`}const mt=({session:e,commands:r})=>{var c,i;const s=K(e.status),a=we(r),n=ge(V(e)),l=s.bucket==="failed"?W(e.failure_category)||"No category recorded":s.bucket==="running"?`Running for ${n}`:`Ran ${n}`;return t.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[t.jsx(E,{label:"Result",value:s.label,valueCls:s.cls,note:l,noteTone:s.bucket==="failed"?"bad":"neutral"}),t.jsx(E,{label:"Commands",value:a.total,note:a.failed>0?`${a.failed} failed`:"None failed",noteTone:a.failed>0?"bad":"neutral"}),t.jsx(E,{label:"Self-healing",value:a.healed>0?`${a.healed} healed`:"None",note:a.healed>0?a.healedTiers.join(", ")||"Tier not recorded":"No selector needed healing"}),t.jsx(E,{label:"Slowest command",value:L((c=a.slowest)==null?void 0:c.ms),note:((i=a.slowest)==null?void 0:i.name)??"No timings recorded"})]})};function ut(e){const r=e.filter(B),s=r[r.length-1];return s?{command:s.command_name||s.title||"command",message:ct(s)}:null}function ht(e,r,s,a,n){var u;const l=W(e.failure_category),c=((u=e.device_name)==null?void 0:u.trim())||"Unknown Device",i=e.device_version?` ${e.device_version}`:"",d=n?`${n.command}${n.message?`: ${n.message}`:""}`:"(no failed command recorded)";return[`**Session:** ${e.id}`,`**Build:** ${r} (#${s})`,`**Device:** ${c} (${e.node_id||"unknown-node"}) · ${e.device_platform||"unknown"}${i}`,`**Duration:** ${a}`,`**Failure category:** ${l||"(uncategorized)"}`,`**Failure reason:** ${e.failure_reason||"(not set)"}`,`**First failed command:** ${d}`,...e.ai_analysis?[`**AI analysis:** ${e.ai_analysis}`]:[]].join(`
|
|
3
|
-
`)}function ft({text:e}){return t.jsx(t.Fragment,{children:e.split(/(\*\*[^*]+\*\*|`[^`]+`)/g).map((r,s)=>/^\*\*[^*]+\*\*$/.test(r)?t.jsx("strong",{children:r.slice(2,-2)},s):/^`[^`]+`$/.test(r)?t.jsx("code",{className:"font-mono text-[11px] px-1 rounded bg-[var(--surface-2)]",children:r.slice(1,-1)},s):t.jsx(Ce.Fragment,{children:r},s))})}const O=({children:e})=>t.jsx("div",{className:"text-[11px] font-semibold text-[var(--text-dim)] mb-1",children:e}),pt=({session:e,buildName:r,buildId:s,commands:a,durationText:n})=>{var y;const{toast:l}=P(),[c,i]=x.useState(!1),d=W(e.failure_category),u=ut(a),N=ot(e.failure_reason),p=(y=e.ai_analysis)==null?void 0:y.trim(),v=!!p&&p.length>480,g=async()=>{const w=ht(e,r,s,n,u);try{await navigator.clipboard.writeText(w),l("Failure report copied","success")}catch{l("Clipboard unavailable","error")}},j=e.failure_category?`/xenon/runbooks/${encodeURIComponent(e.failure_category.toLowerCase())}`:void 0;return t.jsxs("section",{className:"rounded-lg border border-[var(--red)]/30 bg-[var(--surface)] overflow-hidden",children:[t.jsxs("header",{className:"flex items-center justify-between gap-4 px-4 py-3 border-b border-[var(--border)] bg-[var(--red)]/5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_e,{className:"h-4 w-4 text-[var(--red)]","aria-hidden":"true"}),t.jsx("h2",{className:"text-sm font-semibold text-[var(--red)]",children:"Why it failed"}),d&&t.jsx("span",{className:"text-[11px] text-[var(--text-dim)] ml-2",children:d})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border border-[var(--border)] text-xs text-[var(--text)] hover:border-[var(--border-strong)] hover:bg-[var(--surface-2)] transition-colors",children:[t.jsx(z,{className:"h-3 w-3"}),"Copy"]}),t.jsxs("a",{...j?{href:j,target:"_blank",rel:"noreferrer"}:{"aria-disabled":!0,onClick:w=>w.preventDefault()},className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border border-[var(--border)] text-xs text-[var(--text)] hover:border-[var(--border-strong)] hover:bg-[var(--surface-2)] transition-colors ${j?"":"opacity-50 cursor-not-allowed"}`,title:j?"Open runbook in new tab":"No runbook — failure category not set",children:[t.jsx(Ve,{className:"h-3 w-3"}),"Open runbook"]})]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsxs("div",{children:[t.jsx(O,{children:"Reason"}),t.jsx("div",{className:"text-sm text-[var(--text)] break-words",children:e.failure_reason||t.jsx("span",{className:"text-[var(--text-dim)]",children:"(not set)"})})]}),t.jsxs("div",{children:[t.jsx(O,{children:"First failed command"}),u?t.jsxs("div",{className:"flex items-baseline gap-2 min-w-0 text-sm",children:[t.jsx("span",{className:"font-mono text-xs text-[var(--color-danger)] shrink-0",children:u.command}),u.message&&t.jsx("span",{className:"text-[var(--text-muted)] break-words min-w-0",children:u.message})]}):t.jsx("span",{className:"text-sm text-[var(--text-dim)]",children:"No failed command recorded."})]}),p&&t.jsxs("div",{"data-testid":"ai-analysis",children:[t.jsx(O,{children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(je,{className:"h-3 w-3","aria-hidden":"true"}),"AI analysis"]})}),t.jsx("div",{className:`text-sm text-[var(--text)] whitespace-pre-wrap break-words ${v&&!c?"line-clamp-6":""}`,children:t.jsx(ft,{text:p})}),v&&t.jsx("button",{type:"button",onClick:()=>i(w=>!w),"aria-expanded":c,className:"mt-1 text-xs text-[var(--color-accent)] hover:underline",children:c?"Show less":"Show all"})]}),N.length>0&&t.jsxs("div",{children:[t.jsx(O,{children:"Stack trace"}),t.jsx("pre",{className:"rounded-md border border-[var(--border)] bg-[var(--bg)] p-3 font-mono text-[11px] leading-relaxed text-[var(--color-accent)] overflow-x-auto",children:N.join(`
|
|
4
|
-
`)})]})]})]})};function vt(e){return e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(e)}function H(e){const r=e.timestamp;if(!r){const c=e.createdAt;return c?H({timestamp:c}):"--:--:--"}const s=typeof r=="number"?new Date(r):new Date(String(r));if(Number.isNaN(s.getTime()))return"--:--:--";const a=String(s.getHours()).padStart(2,"0"),n=String(s.getMinutes()).padStart(2,"0"),l=String(s.getSeconds()).padStart(2,"0");return`${a}:${n}:${l}`}function bt(e){if(e.is_healed===!0)return{label:String(e.command_name||"healed"),tone:"amber"};if(e.is_success===!1||e.is_error===!0)return{label:String(e.command_name||e.title||"error"),tone:"red"};if(e.is_success===!0)return{label:String(e.command_name||e.title||"ok"),tone:"green"};const r=e.title||e.event||e.command_name;return typeof r=="string"?/stop|fail|error/i.test(r)?{label:r,tone:"red"}:/start|begin|init/i.test(r)?{label:r,tone:"green"}:{label:r,tone:"blue"}:{label:"log",tone:"neutral"}}function gt(e){if(e==null)return"";if(typeof e=="string")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}try{return JSON.stringify(e,null,2)}catch{return String(e)}}function jt(e){if(!e||typeof e!="string")return[{text:String(e??""),kind:"plain"}];const r=[],s=/("(?:\\.|[^"\\])*")(\s*:)|("(?:\\.|[^"\\])*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false)\b|\b(null)\b|([{}[\],])/g;let a=0,n;for(;(n=s.exec(e))!==null;)n.index>a&&r.push({text:e.slice(a,n.index),kind:"plain"}),n[1]&&n[2]!==void 0?(r.push({text:n[1],kind:"key"}),r.push({text:n[2],kind:"punct"})):n[3]?r.push({text:n[3],kind:"string"}):n[4]?r.push({text:n[4],kind:"number"}):n[5]?r.push({text:n[5],kind:"boolean"}):n[6]?r.push({text:n[6],kind:"null"}):n[7]&&r.push({text:n[7],kind:"punct"}),a=s.lastIndex;return a<e.length&&r.push({text:e.slice(a),kind:"plain"}),r}function Nt(e){const r=e,s=typeof r.title=="string"&&r.title.trim()?r.title.trim():null,a=typeof r.command_name=="string"&&r.command_name.trim()?r.command_name.trim():null;return s??a??"Command"}function le(e){const r=e.subtitle;return typeof r=="string"&&r.trim()?r.trim():null}function yt(e,r){return r?e.filter(s=>s.is_success===!1||s.is_error===!0):e}const wt=({commands:e})=>{const r=lt(e);return r.length===0?null:t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[t.jsxs("header",{className:"flex items-center gap-2 px-4 py-3 border-b border-[var(--border)]",children:[t.jsx(je,{className:"h-4 w-4 text-[var(--color-warning)]","aria-hidden":"true"}),t.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Self-healing"}),t.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[r.length," selector",r.length===1?"":"s"," healed. Update the test so the next run doesn't need to."]})]}),t.jsxs("table",{className:"w-full table-fixed text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] text-[var(--text-dim)]",children:[t.jsx("th",{className:"px-4 py-2 font-medium w-[88px]",children:"Time"}),t.jsx("th",{className:"px-3 py-2 font-medium w-[128px]",children:"Command"}),t.jsx("th",{className:"px-3 py-2 font-medium",children:"Asked for"}),t.jsx("th",{className:"w-[28px]",children:t.jsx("span",{className:"sr-only",children:"healed to"})}),t.jsx("th",{className:"px-3 py-2 font-medium",children:"Healed to"}),t.jsx("th",{className:"px-3 py-2 font-medium w-[112px]",children:"Tier"}),t.jsx("th",{className:"px-4 py-2 font-medium w-[96px] text-right",children:"Confidence"})]})}),t.jsx("tbody",{children:r.map((s,a)=>t.jsxs("tr",{className:"border-b border-[var(--border)] last:border-b-0 align-top",children:[t.jsx("td",{className:"px-4 py-2 text-xs text-[var(--text-muted)] tabular-nums",children:H({timestamp:s.at??null})}),t.jsx("td",{className:"px-3 py-2 text-xs text-[var(--text)] truncate",children:s.command}),t.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-[var(--text-muted)] break-all",children:s.original??"—"}),t.jsx("td",{className:"py-2 text-[var(--text-dim)]",children:t.jsx(ze,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),t.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-[var(--text)] break-all",children:s.healed??"—"}),t.jsx("td",{className:"px-3 py-2 text-xs text-[var(--text)]",children:s.tier??"—"}),t.jsx("td",{className:"px-4 py-2 text-xs text-[var(--text)] tabular-nums text-right",children:s.confidence===null?"—":`${s.confidence}%`})]},s.id??a))})]})]})},kt=1e4,ce="var(--color-info)",de="var(--color-accent)",St="var(--border-strong)";function xe(e){return e>=1024?te(e/1024)*1024:te(e)}const me=e=>{let r=0;for(const s of e)for(const a of s.values)a!==null&&a>r&&(r=a);return r},U=({title:e,series:r,times:s,yMax:a,format:n,ariaLabel:l})=>t.jsxs("section",{"aria-label":e,children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-baseline gap-x-4 gap-y-1",children:[t.jsx("h3",{className:"text-xs font-semibold text-[var(--text)]",children:e}),r.map(c=>{const i=Xe(c.values);return t.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[11px] tabular-nums text-[var(--text-muted)]",children:[t.jsx("span",{className:"inline-block h-0.5 w-3 shrink-0",style:{background:c.color}}),t.jsx("span",{className:"max-w-[16rem] truncate",title:c.label,children:c.label}),i&&(c.dashed?t.jsx("span",{children:n(i.peak)}):t.jsxs("span",{children:["peak ",n(i.peak)," · avg ",n(i.average)]}))]},c.key)})]}),t.jsx(Ye,{times:s,series:r,yMax:a,formatValue:n,ariaLabel:l})]}),_t=({sessionId:e,running:r,hasTrace:s})=>{const[a,n]=x.useState(null),[l,c]=x.useState(!1);x.useEffect(()=>{let o=!0;const m=()=>k.getSessionMetrics(e).then(h=>{o&&(n(We(h)),c(!0))}).catch(()=>{o&&c(!0)});if(m(),!r)return()=>{o=!1};const f=setInterval(()=>void m(),kt);return()=>{o=!1,clearInterval(f)}},[e,r]);const i=(a==null?void 0:a.samples)??[],d=x.useMemo(()=>i.map(o=>{var m;return o.t-(((m=i[0])==null?void 0:m.t)??0)}),[i]),u=new Set(i.map(o=>o.app).filter(o=>!!o)),N=u.size>1?"Foreground app":Array.from(u)[0]??(a==null?void 0:a.appId)??"App",p=i.map(o=>o.app??null),v=o=>o>0&&!!p[o]&&!!p[o-1]&&p[o]!==p[o-1],g=[],j=[],y=[];a&&(a.series.deviceCpu&&g.push({key:"deviceCpu",label:"Device",color:ce,values:i.map(o=>o.deviceCpu)}),a.series.appCpu&&g.push({key:"appCpu",label:N,color:de,values:i.map((o,m)=>v(m)?null:o.appCpu),pointLabels:p}),a.series.appMem&&j.push({key:"appMem",label:N,color:de,values:i.map((o,m)=>v(m)?null:o.appMemMb),pointLabels:p}),a.series.deviceMem&&(y.push({key:"deviceMem",label:"Device used",color:ce,values:i.map(o=>o.deviceMemMb)}),y.push({key:"deviceTotal",label:"Device total",color:St,values:i.map(o=>o.deviceMemTotalMb),dashed:!0})));const w=r&&(a==null?void 0:a.recording)==="off",A=(a==null?void 0:a.recording)==="stopped",C="Recording stopped: the device stopped responding.";let b;return l?w?b=t.jsx(M,{title:"Performance isn't recorded for this session",description:"CPU and memory are recorded for Android devices and iPhones connected to this server. This session runs on an iOS simulator or on a device connected to another machine, or recording is turned off."}):i.length===0&&!r?b=t.jsx(M,{title:"No performance data for this session",description:"CPU and memory are recorded for Android devices and iPhones connected to this server. This session ran on an iOS simulator or on a device connected to another machine, before recording was available, or with recording turned off."}):i.length<2?b=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:A?C:r?"Collecting… The first figures appear within 10 seconds.":"Too few figures were recorded to draw a chart."}):b=t.jsxs("div",{className:"space-y-4",children:[A&&t.jsxs("p",{className:"text-xs text-[var(--color-warning)]",children:[C," The data ends there."]}),(a==null?void 0:a.platform)==="ios"&&t.jsxs("p",{className:"text-xs text-[var(--text-dim)]",children:["On iPhones, only the device's overall CPU is recorded.",s?" For more detail, download the Performance trace under Details.":""]}),g.length>0&&t.jsx(U,{title:"CPU",series:g,times:d,yMax:100,format:Ke,ariaLabel:"CPU over the session"}),j.length>0&&t.jsx(U,{title:"App memory",series:j,times:d,yMax:xe(me(j)),format:ee,ariaLabel:"App memory over the session"}),y.length>0&&t.jsx(U,{title:"Device memory",series:y,times:d,yMax:xe(me(y)),format:ee,ariaLabel:"Device memory over the session"})]}):b=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Loading performance…"}),t.jsx(Ne,{header:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(qe,{size:14})," Performance"]}),children:b})},Ct=({session:e})=>{const r=e.status==="running",s=!!e.video_recording;return t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[t.jsxs("header",{className:"px-3 py-2 border-b border-[var(--border)] flex items-center justify-between",children:[t.jsx("span",{className:"text-[11px] font-semibold text-[var(--text-dim)]",children:"Recording"}),r&&t.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] text-[var(--red)]",children:[t.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--red)] pulse-dot"}),"Live"]})]}),t.jsx("div",{className:"aspect-video bg-[var(--bg)] flex items-center justify-center",children:r&&e.has_live_video?t.jsx("img",{src:k.getSessionLiveVideoUrl(e.id),alt:`Live view of session ${e.id}`,className:"w-full h-full object-contain"}):s?t.jsx("video",{controls:!0,src:k.getAssetUrl(e.video_recording),className:"w-full h-full object-contain"}):t.jsxs("div",{className:"flex flex-col items-center text-center px-6 py-8 gap-2",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-[var(--surface-2)] border border-[var(--border)] flex items-center justify-center",children:t.jsx(Ge,{className:"h-5 w-5 text-[var(--text-dim)]"})}),t.jsx("div",{className:"text-sm text-[var(--text)] font-medium",children:"No video available"}),t.jsx("div",{className:"text-xs text-[var(--text-dim)] max-w-xs",children:e.status==="failed"?"Session failed before recording started.":e.video_recording_enabled===!1?"Recording was disabled for this session.":"No recording was captured."})]})})]})},S=({label:e,children:r,title:s,mono:a})=>t.jsxs("div",{className:"flex items-baseline justify-between gap-3 px-3 py-2",children:[t.jsx("dt",{className:"text-xs text-[var(--text-muted)] shrink-0",children:e}),t.jsx("dd",{className:`text-xs text-[var(--text)] text-right min-w-0 break-all ${a?"font-mono text-[11px]":""}`,title:s,children:r})]}),Rt=({session:e,buildName:r})=>{var c,i;const{toast:s}=P(),a=be(e.ranOn),n=e.performance_trace?k.getAssetUrl(e.performance_trace):"",l=async()=>{try{await navigator.clipboard.writeText(e.id),s("Session ID copied","success")}catch{s("Clipboard unavailable","error")}};return t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[t.jsx("header",{className:"px-3 py-2 border-b border-[var(--border)]",children:t.jsx("h2",{className:"text-[11px] font-semibold text-[var(--text-dim)]",children:"Details"})}),t.jsxs("dl",{className:"divide-y divide-[var(--border)]",children:[t.jsx(S,{label:"Session ID",mono:!0,children:t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{children:e.id}),t.jsx("button",{type:"button",onClick:l,"aria-label":"Copy session ID",className:"p-0.5 rounded text-[var(--text-dim)] hover:text-[var(--text)]",children:t.jsx(z,{className:"h-3 w-3"})})]})}),r&&t.jsx(S,{label:"Build",children:r}),t.jsx(S,{label:"Device UDID",mono:!0,children:e.device_udid||"—"}),t.jsx(S,{label:"Platform",children:[ve(e),e.device_version].filter(d=>d&&d!=="—").join(" ")||"—"}),t.jsx(S,{label:"Ran on",title:e.node_id?`Node ${e.node_id}`:void 0,children:a??"Not known"}),t.jsx(S,{label:"Run by",title:(c=e.owner)==null?void 0:c.email,children:((i=e.owner)==null?void 0:i.name)??"Not recorded"}),t.jsx(S,{label:"Started",children:Z(e.startTime)}),t.jsx(S,{label:"Ended",children:e.endTime?Z(e.endTime):"—"}),e.tags&&t.jsx(S,{label:"Tags",children:e.tags}),n&&t.jsx(S,{label:"iOS trace",children:t.jsxs("a",{href:n,className:"inline-flex items-center gap-1 text-[var(--color-accent)] hover:underline",children:[t.jsx(ye,{className:"h-3 w-3","aria-hidden":"true"}),"Performance trace"]})})]})]})},ue={desired:"Requested",session:"Actual"},Tt=({session:e})=>{const[r,s]=x.useState("desired"),a=ne(e.desired_capabilities),n=ne(e.session_capabilities),c=Object.entries(r==="desired"?a:n);return t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[t.jsx("header",{className:"flex items-center border-b border-[var(--border)]",children:["desired","session"].map(i=>t.jsx("button",{type:"button",onClick:()=>s(i),"aria-pressed":r===i,className:`flex-1 h-9 text-[11px] font-semibold transition-colors border-b-2 ${r===i?"border-[var(--color-accent)] text-[var(--text)]":"border-transparent text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:ue[i]},i))}),c.length===0?t.jsxs("div",{className:"px-3 py-6 text-center text-xs text-[var(--text-dim)]",children:["No ",ue[r].toLowerCase()," capabilities recorded for this session."]}):t.jsx("dl",{className:"divide-y divide-[var(--border)]",children:c.map(([i,d])=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)] items-baseline gap-3 px-3 py-2",children:[t.jsx("dt",{className:"text-xs text-[var(--text-muted)] break-all",children:i}),t.jsx("dd",{className:"font-mono text-xs text-[var(--text)] truncate text-right min-w-0",title:ie(d,500),children:ie(d)})]},i))})]})},$t=({tabs:e,active:r,onChange:s,errorsOnly:a,onErrorsOnlyChange:n,showErrorsOnly:l=!0})=>{const c=e.filter(i=>!(i.hideWhenEmpty&&i.count===0));return t.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 border-b border-[var(--border)] bg-[var(--surface)]",children:[t.jsx("div",{className:"flex items-center gap-1 overflow-x-auto",children:c.map(i=>{const d=i.key===r;return t.jsxs("button",{type:"button",onClick:()=>s(i.key),"aria-pressed":d,"data-empty":i.count===0?"true":"false",className:`relative inline-flex items-center gap-1.5 h-9 px-3 text-xs whitespace-nowrap transition-colors ${d?"text-[var(--text)]":i.count===0?"text-[var(--text-dim)] hover:text-[var(--text-muted)]":"text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:[t.jsx("span",{children:i.label}),i.count>0&&t.jsx("span",{className:`text-[10px] tabular-nums ${d?"text-[var(--text-muted)]":"text-[var(--text-dim)]"}`,children:vt(i.count)}),d&&t.jsx("span",{className:"absolute left-2 right-2 bottom-0 h-[2px] bg-[var(--color-accent)] rounded-t"})]},i.key)})}),l&&t.jsxs("label",{className:"inline-flex items-center gap-2 text-[11px] text-[var(--text-muted)] cursor-pointer select-none whitespace-nowrap",children:[t.jsx("input",{type:"checkbox",checked:a,onChange:i=>n(i.target.checked),"aria-label":"Show only error rows"}),"Errors only"]})]})},At={key:"text-[var(--blue)]",string:"text-[var(--color-accent)]",number:"text-[var(--amber)]",boolean:"text-[var(--amber)]",null:"text-[var(--text-dim)] italic",punct:"text-[var(--text-muted)]",plain:"text-[var(--text)]"},Mt=({value:e,maxHeightPx:r})=>{const s=gt(e);if(!s)return t.jsx("span",{className:"text-[var(--text-dim)] text-xs",children:"(empty)"});let a;try{a=jt(s)}catch{a=[{text:s,kind:"plain"}]}return t.jsx("pre",{className:"font-mono text-[11px] leading-relaxed bg-[var(--bg)] border border-[var(--border)] rounded-md p-3 overflow-x-auto whitespace-pre",style:r?{maxHeight:r,overflowY:"auto"}:void 0,children:a.map((n,l)=>t.jsx("span",{className:At[n.kind],children:n.text},l))})},Dt={green:"bg-[var(--color-success)]",red:"bg-[var(--red)]",amber:"bg-[var(--amber)]",blue:"bg-[var(--blue)]",neutral:"bg-[var(--text-dim)]"},Et={green:"text-[var(--color-success)]",red:"text-[var(--red)]",amber:"text-[var(--amber)]",blue:"text-[var(--blue)]",neutral:"text-[var(--text-muted)]"},Ot=({log:e})=>{const[r,s]=x.useState(!1),{toast:a}=P(),n=H(e),l=bt(e),c=async i=>{i.stopPropagation();try{const d=e.body??e,u=typeof d=="string"?d:JSON.stringify(d,null,2);await navigator.clipboard.writeText(u),a("Log entry copied","success")}catch{a("Clipboard unavailable","error")}};return t.jsxs("div",{className:"border-b border-[var(--border)] last:border-b-0",children:[t.jsxs("button",{type:"button",onClick:()=>s(i=>!i),"aria-expanded":r,className:"group w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--surface-2)]/60 transition-colors",children:[t.jsx(I,{className:`h-3 w-3 text-[var(--text-dim)] transition-transform shrink-0 ${r?"rotate-90":""}`}),t.jsx("span",{className:"font-mono text-[11px] text-[var(--text-muted)] w-[64px] shrink-0",children:n}),t.jsx("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${Dt[l.tone]}`}),t.jsx("span",{className:`font-mono text-[11px] font-medium shrink-0 ${Et[l.tone]}`,children:l.label}),t.jsxs("span",{className:"min-w-0 flex-1 flex items-baseline gap-2 truncate",children:[t.jsx("span",{className:"text-[12px] text-[var(--text)] shrink-0",children:Nt(e)}),le(e)&&t.jsx("span",{className:"font-mono text-[11px] text-[var(--text-dim)] truncate min-w-0",children:le(e)})]}),typeof e.duration=="number"&&t.jsx("span",{className:"text-[11px] tabular-nums text-[var(--text-muted)] shrink-0",children:L(e.duration)}),t.jsx("span",{role:"button",tabIndex:0,onClick:c,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&c(i)},"aria-label":"Copy log entry",className:"opacity-0 group-hover:opacity-100 p-1 rounded text-[var(--text-dim)] hover:text-[var(--text)] transition-opacity shrink-0",children:t.jsx(z,{className:"h-3 w-3"})})]}),r&&t.jsx("div",{className:"px-3 pb-3 pl-9",children:t.jsx(Mt,{value:e.body??e,maxHeightPx:400})})]})},Lt=(e,r)=>e?"bg-[var(--color-danger)]":r?"bg-[var(--color-warning)]":"bg-[var(--color-success)]",Pt=({commands:e})=>{const{spanMs:r,bars:s}=dt(e);return s.length===0?t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:"No commands recorded for this session."}):t.jsxs("div",{className:"px-3 py-3",children:[t.jsxs("div",{className:"flex items-center justify-between pb-2 text-[11px] text-[var(--text-dim)] tabular-nums",children:[t.jsxs("span",{children:[s.length," command",s.length===1?"":"s"," over ",L(r)]}),t.jsxs("span",{className:"inline-flex items-center gap-3",children:[t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{className:"h-2 w-2 rounded-sm bg-[var(--color-danger)]"})," Failed"]}),t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{className:"h-2 w-2 rounded-sm bg-[var(--color-warning)]"})," Healed"]})]})]}),t.jsx("ol",{className:"space-y-1",children:s.map((a,n)=>t.jsxs("li",{"data-testid":"timeline-bar","data-command":a.label,"data-failed":a.failed?"true":"false",className:"grid grid-cols-[128px_minmax(0,1fr)_64px] items-center gap-2",children:[t.jsx("span",{className:"truncate text-[11px] font-mono text-[var(--text-muted)]",title:a.label,children:a.label}),t.jsx("span",{className:"relative h-3 rounded-sm bg-[rgb(var(--rgb-fg)/0.05)]",children:t.jsx("span",{className:`absolute inset-y-0 rounded-sm ${Lt(a.failed,a.healed)}`,style:{left:`${a.startMs/r*100}%`,width:`max(2px, ${a.durationMs/r*100}%)`}})}),t.jsx("span",{className:"text-right text-[11px] tabular-nums text-[var(--text-muted)]",children:a.durationMs>0?L(a.durationMs):"—"})]},a.id??n))})]})},Ft=({commands:e})=>{const r=xt(e);return r.length===0?t.jsxs("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:["No screenshots were kept. A failed command keeps one unless"," ",t.jsx("code",{className:"font-mono",children:"xe:options.screenshotOnFailure"})," is false; set"," ",t.jsx("code",{className:"font-mono",children:"xe:options.screenshotOnEveryCommand"})," to keep one for every command."]}):t.jsx("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-3 p-3",children:r.map((s,a)=>{const n=k.getAssetUrl(s.path),l=H({timestamp:s.at??null});return t.jsx("li",{children:t.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:`block rounded-md border overflow-hidden hover:border-[var(--border-strong)] ${s.failed?"border-[var(--color-danger)]":"border-[var(--border)]"}`,children:[t.jsx("img",{src:n,alt:`${s.command} at ${l}`,loading:"lazy",className:"block w-full aspect-[9/16] object-contain bg-[rgb(var(--rgb-fg)/0.03)]"}),t.jsxs("span",{className:"flex items-center justify-between gap-2 px-2 py-1 text-[11px]",children:[t.jsx("span",{className:`truncate font-mono ${s.failed?"text-[var(--color-danger)]":"text-[var(--text)]"}`,children:s.command}),t.jsx("span",{className:"tabular-nums text-[var(--text-dim)] shrink-0",children:l})]})]})},s.id??a)})})},he=["commands","device","debug","profiling"],Bt=({sessionLogs:e,deviceLogs:r,debugLogs:s,profiling:a})=>{const[n,l]=x.useState("commands"),[c,i]=x.useState(!1),d=e,u=x.useMemo(()=>we(d).screenshots,[d]),N=x.useMemo(()=>[{key:"commands",label:"Commands",count:e.length},{key:"timeline",label:"Timeline",count:e.length},{key:"screenshots",label:"Screenshots",count:u},{key:"device",label:"Device logs",count:r.length},{key:"debug",label:"Debug logs",count:s.length},{key:"profiling",label:"System profiling",count:a.length,hideWhenEmpty:!0}],[e.length,u,r.length,s.length,a.length]),p=x.useMemo(()=>{let v=[];return n==="commands"?v=e:n==="device"?v=r:n==="debug"?v=s:n==="profiling"&&(v=a),yt(v,c)},[n,e,r,s,a,c]);return t.jsxs("section",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] flex flex-col min-h-[280px] max-h-[640px]",children:[t.jsx($t,{tabs:N,active:n,onChange:l,errorsOnly:c,onErrorsOnlyChange:i,showErrorsOnly:he.includes(n)}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n==="timeline"&&t.jsx(Pt,{commands:d}),n==="screenshots"&&t.jsx(Ft,{commands:d}),he.includes(n)&&(p.length===0?t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:c?"No error rows in this tab.":"No log entries in this tab."}):p.map((v,g)=>t.jsx(Ot,{log:v},v.id??g)))]})]})};function ke(e){if(!e)return"failed";switch(e){case"HTTPS_CLIENT_ERROR":case"HTTPS_SERVER_ERROR":case"OPEN_HTTPS_SERVER_ERROR":case"ON_CONNECT_ERROR":return"tls";case"PROXY_TO_SERVER_REQUEST_ERROR":return"net";default:return"failed"}}const Y="/xenon/api/interceptor";async function Ht(e){const r=await fetch(`${Y}/sessions/${encodeURIComponent(e)}/requests`);if(r.status===404){const a=await r.json().catch(()=>({}));return{active:!1,error:a==null?void 0:a.error}}return r.ok?{active:!0,requests:(await r.json()).requests||[]}:{active:!1,error:`request failed (${r.status})`}}async function Ut(e,r){const s=await fetch(`${Y}/sessions/${encodeURIComponent(e)}/requests/${encodeURIComponent(r)}`);return s.ok?s.json():null}function It(e){return`${Y}/sessions/${encodeURIComponent(e)}/har`}function Jt(e){return e>=200&&e<300?"ready":e>=300&&e<400?"neutral":e>=400&&e<500?"busy":e>=500?"error":"neutral"}const fe=({headers:e})=>{const r=Object.entries(e||{});return r.length===0?t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"No headers"}):t.jsx("div",{className:"space-y-0.5 font-mono text-xs",children:r.map(([s,a])=>t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("span",{className:"text-[var(--text-dim)] shrink-0",children:[s,":"]}),t.jsx("span",{className:"break-all",children:a})]},s))})},pe=({body:e})=>{if(e==null||e==="")return t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"No body"});let r=e;try{r=JSON.stringify(JSON.parse(e),null,2)}catch{}return t.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all bg-[var(--surface-2,var(--surface))] rounded p-2 max-h-64 overflow-auto",children:r})},Vt=({request:e,onClose:r})=>{if(!e)return null;const s=t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx(_,{tone:"accent",children:e.method}),e.failed?t.jsx(_,{tone:"error",children:ke(e.failureKind)}):t.jsx(_,{tone:Jt(e.resStatus),children:e.resStatus||"—"}),t.jsx("span",{className:"font-mono text-xs truncate",title:e.url,children:e.url})]});return t.jsx(tt,{open:!!e,title:s,onClose:r,width:720,children:t.jsxs("div",{className:"space-y-4 text-xs",children:[e.failed&&t.jsxs("div",{className:"border border-[var(--red)] rounded p-2 bg-[rgb(var(--rgb-red-600)/0.08)]",children:[t.jsx("div",{className:"text-[var(--red)] text-[11px] mb-1",children:"Failure"}),t.jsx("div",{className:"text-xs",children:e.failureReason||"Request failed"}),e.failureKind&&t.jsx("div",{className:"font-mono text-[10px] text-[var(--text-dim)] mt-1",children:e.failureKind})]}),!e.failed&&t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Duration"}),t.jsxs("div",{className:"font-mono",children:[e.durationMs," ms"]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Flags"}),t.jsxs("div",{className:"flex gap-1",children:[e.mocked&&t.jsx(_,{tone:"accent",children:"mocked"}),e.modified&&t.jsx(_,{tone:"busy",children:"modified"}),!e.mocked&&!e.modified&&t.jsx("span",{className:"text-[var(--text-dim)]",children:"passthrough"})]})]})]}),e.commandHint&&t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Triggered by"}),t.jsx("div",{className:"font-mono",children:e.commandHint.commandName})]}),!e.failed&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Request Headers"}),t.jsx(fe,{headers:e.reqHeaders})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Request Body"}),t.jsx(pe,{body:e.reqBody})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Response Headers"}),t.jsx(fe,{headers:e.resHeaders})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[var(--text-dim)] text-[11px] mb-1",children:"Response Body"}),t.jsx(pe,{body:e.resBody})]})]})]})})};function zt(e){return e?new Date(e).toLocaleTimeString(void 0,{hour12:!1}):"—"}function Kt(e){return e>=200&&e<300?"ready":e>=300&&e<400?"neutral":e>=400&&e<500?"busy":e>=500?"error":"neutral"}const Wt=({sessionId:e,sessionEnded:r})=>{const[s,a]=x.useState(null),[n,l]=x.useState(null),[c,i]=x.useState([]),[d,u]=x.useState(!0),[N,p]=x.useState(null),v=x.useRef(new Set),{on:g,isConnected:j}=Re();x.useEffect(()=>{let o=!0;return u(!0),Ht(e).then(m=>{if(!o)return;a(m.active),l(m.error||null);const f=m.requests||[];i(f),v.current=new Set(f.map(h=>h.id))}).finally(()=>{o&&u(!1)}),()=>{o=!1}},[e]),x.useEffect(()=>{if(r)return;const o=g("interceptor_request",h=>{!h||h.sessionId!==e||v.current.has(h.id)||(v.current.add(h.id),i(R=>[h,...R]),a(!0))}),m=g("interceptor_session_started",h=>{(h==null?void 0:h.sessionId)===e&&a(!0)}),f=g("interceptor_session_stopped",h=>{(h==null?void 0:h.sessionId)===e&&a(!1)});return()=>{o(),m(),f()}},[g,e,r,j]);const y=x.useMemo(()=>[...c].sort((o,m)=>m.ts-o.ts),[c]),w=async o=>{if(p(o),s){const m=await Ut(e,o.id);m&&p(m)}},A=s&&c.length>0?t.jsxs("a",{href:It(e),className:"inline-flex items-center gap-1 text-xs text-[var(--text-dim)] hover:text-[var(--text)]",title:"Download HAR",children:[t.jsx(ye,{className:"h-3 w-3"}),"HAR"]}):null,C=t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(rt,{className:"h-3.5 w-3.5 text-[var(--text-dim)]"}),t.jsx("span",{children:"Network"}),s&&c.length>0&&t.jsxs("span",{className:"text-xs text-[var(--text-dim)]",children:["(",c.length,")"]})]});let b;return d?b=t.jsx("div",{className:"p-4 text-xs text-[var(--text-dim)]",children:"Loading…"}):s===!1&&r?b=t.jsx(M,{title:"No network capture",description:"Network interception was not enabled for this session."}):s===!1?b=t.jsx(M,{title:"Network interception disabled",description:"Enable interceptor.enabled in plugin config to capture requests for Android sessions."}):n?b=t.jsxs("div",{className:"p-4 text-xs text-[var(--red)]",children:["Failed to load requests: ",n]}):y.length===0?b=t.jsx(M,{title:"Waiting for requests",description:r?"No HTTP traffic was captured during this session.":"Captured requests will appear here as the device makes calls."}):b=t.jsx("div",{className:"overflow-auto max-h-96",children:t.jsxs(Qe,{children:[t.jsx(Ze,{children:t.jsxs(re,{children:[t.jsx(T,{style:{width:80},children:"Time"}),t.jsx(T,{style:{width:70},children:"Method"}),t.jsx(T,{style:{width:70},children:"Status"}),t.jsx(T,{children:"Host"}),t.jsx(T,{children:"Path"}),t.jsx(T,{style:{width:80},children:"Duration"}),t.jsx(T,{style:{width:90},children:"Flags"})]})}),t.jsx(et,{children:y.map(o=>t.jsxs(re,{onClick:()=>w(o),style:{cursor:"pointer"},title:o.failed?o.failureReason:void 0,children:[t.jsx($,{className:"font-mono text-[11px]",children:zt(o.ts)}),t.jsx($,{children:t.jsx(_,{tone:"accent",children:o.method})}),t.jsx($,{children:o.failed?t.jsx(_,{tone:"error",children:ke(o.failureKind)}):t.jsx(_,{tone:Kt(o.resStatus),children:o.resStatus||"—"})}),t.jsx($,{className:"font-mono text-[11px] truncate",title:o.host,children:o.host}),t.jsx($,{className:"font-mono text-[11px] truncate",title:o.path,children:o.failed?"—":o.path}),t.jsx($,{className:"font-mono text-[11px]",children:o.failed?"—":`${o.durationMs}ms`}),t.jsx($,{children:t.jsxs("div",{className:"flex gap-1",children:[o.mocked&&t.jsx(_,{tone:"accent",children:"mock"}),o.modified&&t.jsx(_,{tone:"busy",children:"mod"})]})})]},o.id))})]})}),t.jsxs(t.Fragment,{children:[t.jsx(Ne,{header:C,action:A,padded:!1,children:b}),t.jsx(Vt,{request:N,onClose:()=>p(null)})]})},pr=()=>{const{buildId:e="",sessionId:r=""}=Te(),{toast:s}=P(),a=$e(),n=Le(),l=at(r||null),c=x.useMemo(()=>n.builds.find(p=>p.id===e)??null,[n.builds,e]),i=c?Pe(c):"Build";if(x.useEffect(()=>{!l.loading&&l.notFound&&(s("Session not available — it may belong to a team you are not on.","info"),a("/builds",{replace:!0}))},[l.loading,l.notFound,a,s]),l.loading)return t.jsx("div",{className:"p-6 text-xs text-[var(--text-dim)]",children:"Loading session…"});if(l.error||!l.session)return t.jsxs("div",{className:"p-6 space-y-2",children:[t.jsx(ae,{buildId:e,buildName:c?i:null,sessionId:r}),t.jsx("div",{className:"mt-6 rounded-md border border-[var(--red)]/30 bg-[var(--surface)] p-4 text-xs text-[var(--red)]",children:l.error||"Session not found."})]});const d=l.session,u=l.sessionLogs,N=K(d.status).bucket==="failed";return t.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[t.jsx(ae,{buildId:e,buildName:c?i:null,sessionId:d.id}),t.jsx(it,{session:d}),t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsx(mt,{session:d,commands:u}),N&&t.jsx(pt,{session:d,buildName:i,buildId:e,commands:u,durationText:Fe(V(d))}),t.jsx(wt,{commands:u}),t.jsx(_t,{sessionId:d.id,running:d.status==="running",hasTrace:!!d.performance_trace}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[minmax(0,1fr)_340px] gap-4",children:[t.jsx("div",{className:"min-w-0",children:t.jsx(Bt,{sessionLogs:l.sessionLogs,deviceLogs:l.deviceLogs,debugLogs:l.debugLogs,profiling:l.profiling})}),t.jsxs("div",{className:"flex flex-col gap-4 min-w-0",children:[t.jsx(Ct,{session:d}),t.jsx(Rt,{session:d,buildName:c?i:null}),t.jsx(Tt,{session:d})]})]}),t.jsx(Wt,{sessionId:d.id,sessionEnded:d.status!=="running"})]})})]})};export{pr as SessionDetailPage,pr as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const c=[7,30,90],s={tab:"fix",days:30,q:"",platform:"",method:"",sort:"heals",page:1,open:null},l=["fix","verifying","fixed","muted"],d=["heals","recent","time"],f={active:"fix",pending:"verifying",resolved:"fixed",muted:"muted"},g=t=>c.find(e=>String(e)===t)??s.days;function y(t){const e=t.get("tab")??"",r=t.get("sort")??"",o=Number(t.get("page")),a=t.get("selector");return{tab:l.find(n=>n===e)??f[e]??s.tab,days:g(t.get("days")),q:t.get("q")??"",platform:t.get("platform")??"",method:t.get("method")??"",sort:d.find(n=>n===r)??s.sort,page:Number.isInteger(o)&&o>=1?o:1,open:a?{strategy:t.get("strategy")??"",selector:a}:null}}function i(t){const e=new URLSearchParams;return t.tab!==s.tab&&e.set("tab",t.tab),t.days!==s.days&&e.set("days",String(t.days)),t.q&&e.set("q",t.q),t.platform&&e.set("platform",t.platform),t.method&&e.set("method",t.method),t.sort!==s.sort&&e.set("sort",t.sort),t.page!==1&&e.set("page",String(t.page)),t.open&&(e.set("strategy",t.open.strategy),e.set("selector",t.open.selector)),e}function u(t){const e=t.get("value")??"",r=t.get("strategy"),o=g(t.get("windowDays")),a=e?r!==null?{...s,days:o,open:{strategy:r,selector:e}}:{...s,days:o,q:e}:{...s,days:o},n=i(a).toString();return n?`/selector-health?${n}`:"/selector-health"}const h=t=>`${t.strategy}\0${t.selector}`;export{c as P,u as l,y as r,h as s,i as w};
|