@d86e/hive-panel 0.3.7 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/public/panel.js CHANGED
@@ -14,23 +14,26 @@ const QUEEN_DISMISS_KEY = "hive.queenNoticeDismissed";
14
14
  const DEFAULT_INTERVAL_MS = 3000;
15
15
 
16
16
  const CARD_ACTIONS = Object.freeze({
17
- pending: Object.freeze(["claim"]),
18
- claimed: Object.freeze(["done", "fail"]),
19
- done: Object.freeze([]),
20
- blocked: Object.freeze(["retry"]),
21
- failed: Object.freeze(["retry"]),
17
+ // remove is available in every stored state; the drawer renders it as a
18
+ // danger button, disabled with an explanation while the card is claimed
19
+ // (the panel never sends --force, so the CLI would refuse).
20
+ pending: Object.freeze(["claim", "remove"]),
21
+ claimed: Object.freeze(["done", "fail", "remove"]),
22
+ done: Object.freeze(["remove"]),
23
+ blocked: Object.freeze(["retry", "remove"]),
24
+ failed: Object.freeze(["retry", "remove"]),
22
25
  });
23
26
 
24
27
  const ACTION_META = Object.freeze({
25
- freeze: { labelKey: "action.freeze", helpKey: "help.action.freeze", paramsKey: "help.params.mode" },
26
- unfreeze: { labelKey: "action.unfreeze", helpKey: "help.action.unfreeze", paramsKey: "help.params.mode" },
27
- add: { labelKey: "action.add", helpKey: "help.action.add", paramsKey: "help.params.add" },
28
- plan: { labelKey: "action.plan", helpKey: "help.action.plan", paramsKey: "help.params.plan" },
29
- commit: { labelKey: "action.commit", helpKey: "help.action.commit", paramsKey: "help.params.commit" },
30
- claim: { labelKey: "action.claim", helpKey: "help.action.claim", paramsKey: "help.params.claim" },
31
- done: { labelKey: "action.done", helpKey: "help.action.done", paramsKey: "help.params.done" },
32
- fail: { labelKey: "action.fail", helpKey: "help.action.fail", paramsKey: "help.params.fail" },
33
- retry: { labelKey: "action.retry", helpKey: "help.action.retry", paramsKey: "help.params.retry" },
28
+ freeze: { labelKey: "action.freeze", helpKey: "help.action.freeze" },
29
+ unfreeze: { labelKey: "action.unfreeze", helpKey: "help.action.unfreeze" },
30
+ add: { labelKey: "action.add", helpKey: "help.action.add" },
31
+ plan: { labelKey: "action.plan", helpKey: "help.action.plan" },
32
+ claim: { labelKey: "action.claim", helpKey: "help.action.claim" },
33
+ done: { labelKey: "action.done", helpKey: "help.action.done" },
34
+ fail: { labelKey: "action.fail", helpKey: "help.action.fail" },
35
+ retry: { labelKey: "action.retry", helpKey: "help.action.retry" },
36
+ remove: { labelKey: "action.remove", helpKey: "help.action.remove" },
34
37
  });
35
38
 
36
39
  const MIN_PLAN_CARDS = 1;
@@ -103,6 +106,23 @@ const PANEL_STYLES = `.hive { position: relative; }
103
106
  font-weight: 700;
104
107
  }
105
108
 
109
+ /* Destructive card action: the drawer's delete control. */
110
+ .hive-btn-danger {
111
+ border-color: color-mix(in srgb, var(--hive-danger) 55%, var(--hive-line, #232b38));
112
+ background: color-mix(in srgb, var(--hive-danger) 12%, transparent);
113
+ color: color-mix(in srgb, var(--hive-danger) 88%, var(--hive-fg, #e6edf3));
114
+ }
115
+
116
+ .hive-btn-danger:hover:not(:disabled) {
117
+ border-color: color-mix(in srgb, var(--hive-danger) 75%, var(--hive-line, #232b38));
118
+ background: color-mix(in srgb, var(--hive-danger) 22%, transparent);
119
+ }
120
+
121
+ .hive-btn-danger:disabled {
122
+ opacity: 0.5;
123
+ cursor: not-allowed;
124
+ }
125
+
106
126
  .hive-overlay { position: absolute; inset: 0; z-index: 2147483000; }
107
127
  .hive-help-scrim { background: transparent; }
108
128
  .hive-dialog-scrim {
@@ -110,7 +130,9 @@ const PANEL_STYLES = `.hive { position: relative; }
110
130
  align-items: center;
111
131
  justify-content: center;
112
132
  padding: 12px;
113
- background: rgb(0 0 0 / 45%);
133
+ background: transparent;
134
+ backdrop-filter: none;
135
+ -webkit-backdrop-filter: none;
114
136
  }
115
137
 
116
138
  .hive-help {
@@ -911,7 +933,7 @@ const PANEL_STYLES = `.hive { position: relative; }
911
933
 
912
934
  .hive-limits-row {
913
935
  display: grid;
914
- grid-template-columns: minmax(0, 1fr) 72px 48px 48px;
936
+ grid-template-columns: minmax(0, 1fr) 96px 48px 48px;
915
937
  align-items: center;
916
938
  gap: 6px;
917
939
  min-width: 0;
@@ -1007,6 +1029,95 @@ const PANEL_STYLES = `.hive { position: relative; }
1007
1029
  overflow-wrap: anywhere;
1008
1030
  }
1009
1031
 
1032
+ .hive-supervisor-inline {
1033
+ display: inline-flex;
1034
+ flex-wrap: wrap;
1035
+ align-items: center;
1036
+ gap: 5px;
1037
+ min-width: 0;
1038
+ padding: 1px 8px;
1039
+ border: 1px solid var(--hive-line, #232b38);
1040
+ border-radius: 999px;
1041
+ background: var(--hive-surface);
1042
+ color: var(--hive-fg-soft);
1043
+ font-size: 10px;
1044
+ line-height: 1.6;
1045
+ }
1046
+
1047
+ .hive-supervisor-inline.is-hidden { display: none; }
1048
+
1049
+ .hive-supervisor-inline-label {
1050
+ color: var(--hive-fg-faint);
1051
+ font-size: 9.5px;
1052
+ font-weight: 650;
1053
+ letter-spacing: 0.1em;
1054
+ text-transform: uppercase;
1055
+ }
1056
+
1057
+ .hive-supervisor-inline-state {
1058
+ color: var(--hive-fg-soft);
1059
+ font-weight: 600;
1060
+ white-space: nowrap;
1061
+ }
1062
+
1063
+ .hive-supervisor-inline-state.is-running { color: var(--hive-ok); }
1064
+ .hive-supervisor-inline-state.is-idle { color: var(--hive-fg-soft); }
1065
+ .hive-supervisor-inline-state.is-backoff { color: var(--hive-warn); }
1066
+ .hive-supervisor-inline-state.is-paused { color: var(--hive-danger); }
1067
+
1068
+ .hive-supervisor-inline-resume {
1069
+ padding: 1px 6px;
1070
+ font-size: 9.5px;
1071
+ line-height: 1.3;
1072
+ }
1073
+
1074
+ .hive-supervisor-inline-resume.is-hidden { display: none; }
1075
+
1076
+ .hive-settings-trigger {
1077
+ flex: 0 0 auto;
1078
+ min-width: 28px;
1079
+ padding-inline: 8px;
1080
+ font-size: 14px;
1081
+ line-height: 1.2;
1082
+ }
1083
+
1084
+ .hive-settings-section {
1085
+ display: flex;
1086
+ flex-direction: column;
1087
+ gap: 8px;
1088
+ min-width: 0;
1089
+ padding-top: 12px;
1090
+ border-top: 1px solid color-mix(in srgb, var(--hive-line, #232b38) 70%, transparent);
1091
+ }
1092
+
1093
+ .hive-settings-section:first-of-type { padding-top: 0; border-top: 0; }
1094
+
1095
+ .hive-settings-section-title {
1096
+ color: var(--hive-fg, #e6edf3);
1097
+ font-size: 11px;
1098
+ font-weight: 650;
1099
+ letter-spacing: 0.08em;
1100
+ text-transform: uppercase;
1101
+ }
1102
+
1103
+ .hive-settings-role-form { align-items: flex-end; }
1104
+
1105
+ .hive-settings-role-description { width: 100%; }
1106
+
1107
+ .hive-settings-role-description .hive-textarea { width: 100%; }
1108
+
1109
+ .hive-settings-role-form .hive-field:first-child { flex: 1 1 200px; }
1110
+
1111
+ .hive-settings-note {
1112
+ padding: 8px 10px;
1113
+ border: 1px solid color-mix(in srgb, var(--hive-warn) 38%, var(--hive-line, #232b38));
1114
+ border-radius: 6px;
1115
+ background: color-mix(in srgb, var(--hive-warn) 9%, transparent);
1116
+ color: var(--hive-warn);
1117
+ font-size: 10.5px;
1118
+ line-height: 1.55;
1119
+ }
1120
+
1010
1121
  /* -------------------------------------------------------------------- spacing */
1011
1122
  .hive {
1012
1123
  gap: 8px;
@@ -1080,6 +1191,46 @@ const PANEL_STYLES = `.hive { position: relative; }
1080
1191
  line-height: 1.55;
1081
1192
  }
1082
1193
 
1194
+ .hive-icon-button {
1195
+ display: inline-flex;
1196
+ flex: 0 0 28px;
1197
+ align-items: center;
1198
+ justify-content: center;
1199
+ width: 28px;
1200
+ min-width: 28px;
1201
+ height: 28px;
1202
+ padding: 0;
1203
+ border: 0;
1204
+ border-color: transparent;
1205
+ background: transparent;
1206
+ color: color-mix(in srgb, var(--hive-fg, #e6edf3) 80%, transparent);
1207
+ font-size: 0;
1208
+ line-height: 1;
1209
+ box-shadow: none;
1210
+ cursor: pointer;
1211
+ }
1212
+
1213
+ .hive-icon-button:hover {
1214
+ border: 0;
1215
+ border-color: transparent;
1216
+ background: transparent;
1217
+ color: var(--hive-fg, #e6edf3);
1218
+ }
1219
+
1220
+ .hive-icon-button:active { transform: none; }
1221
+
1222
+ .hive-icon-button:focus-visible {
1223
+ outline: 2px solid var(--hive-accent, #58c4dc);
1224
+ outline-offset: 1px;
1225
+ }
1226
+
1227
+ .hive-icon-button svg {
1228
+ display: block;
1229
+ width: 16px;
1230
+ height: 16px;
1231
+ pointer-events: none;
1232
+ }
1233
+
1083
1234
  @media (max-width: 520px) {
1084
1235
  .hive { gap: 6px; padding: 12px; }
1085
1236
  .hive-bar,
@@ -1104,7 +1255,222 @@ const PANEL_STYLES = `.hive { position: relative; }
1104
1255
  .hive-dialog-foot .hive-btn { flex: 1 1 auto; }
1105
1256
  .hive-help { right: 8px; width: calc(100% - 16px); max-height: 66vh; }
1106
1257
  .hive-toast { right: 8px; bottom: 8px; width: calc(100% - 16px); }
1107
- }`;
1258
+ }
1259
+
1260
+
1261
+ .hive-settings-dialog { max-height: 80vh; }
1262
+
1263
+ .hive-settings-dialog .hive-dialog-body { overflow: auto; }
1264
+
1265
+ .hive-settings-tabs {
1266
+ display: flex;
1267
+ align-items: center;
1268
+ gap: 4px;
1269
+ border-bottom: 1px solid var(--hive-line, #232b38);
1270
+ }
1271
+
1272
+ .hive-settings-tab {
1273
+ flex: 0 0 auto;
1274
+ padding: 7px 10px 8px;
1275
+ border: 0;
1276
+ border-bottom: 2px solid transparent;
1277
+ background: transparent;
1278
+ color: var(--hive-fg-soft);
1279
+ font-size: 11.5px;
1280
+ line-height: 1.3;
1281
+ cursor: pointer;
1282
+ }
1283
+
1284
+ .hive-settings-tab:hover { color: var(--hive-fg, #e6edf3); }
1285
+
1286
+ .hive-settings-tab[aria-selected="true"] {
1287
+ border-bottom-color: var(--hive-accent, #58c4dc);
1288
+ color: var(--hive-fg, #e6edf3);
1289
+ }
1290
+
1291
+ .hive-settings-tab:focus-visible {
1292
+ outline: 2px solid var(--hive-accent, #58c4dc);
1293
+ outline-offset: -2px;
1294
+ }
1295
+
1296
+ .hive-settings-tabpanel[hidden] { display: none; }
1297
+
1298
+ .hive-settings-tabpanel .hive-settings-section {
1299
+ padding-top: 0;
1300
+ border-top: 0;
1301
+ }
1302
+
1303
+ .hive-settings-form-actions {
1304
+ display: flex;
1305
+ align-items: center;
1306
+ justify-content: flex-end;
1307
+ gap: 8px;
1308
+ width: 100%;
1309
+ margin-top: 2px;
1310
+ }
1311
+
1312
+ .hive-settings-form-actions .hive-btn {
1313
+ display: inline-flex;
1314
+ flex: 0 0 auto;
1315
+ align-items: center;
1316
+ justify-content: center;
1317
+ height: 28px;
1318
+ min-height: 28px;
1319
+ padding: 0 14px;
1320
+ border-radius: 7px;
1321
+ font-size: 11.5px;
1322
+ line-height: 1;
1323
+ }
1324
+
1325
+ .hive-settings-form-actions .hive-btn:disabled {
1326
+ opacity: 0.55;
1327
+ cursor: not-allowed;
1328
+ }
1329
+
1330
+ .hive-settings-primary {
1331
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1332
+ background: var(--hive-accent, #58c4dc);
1333
+ color: var(--hive-bg, #0b0f17);
1334
+ }
1335
+
1336
+ .hive-settings-primary:hover {
1337
+ border-color: var(--hive-accent, #58c4dc);
1338
+ background: color-mix(in srgb, var(--hive-accent, #58c4dc) 86%, white);
1339
+ color: var(--hive-bg, #0b0f17);
1340
+ }
1341
+
1342
+ .hive-settings-secondary {
1343
+ border-color: var(--hive-line, #232b38);
1344
+ background: var(--hive-surface-strong);
1345
+ color: var(--hive-fg, #e6edf3);
1346
+ }
1347
+
1348
+ .hive-settings-secondary:hover {
1349
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 40%, var(--hive-line, #232b38));
1350
+ background: var(--hive-surface-hover);
1351
+ color: var(--hive-fg, #e6edf3);
1352
+ }
1353
+
1354
+ .hive-settings-form-actions .hive-btn:disabled {
1355
+ opacity: 0.55;
1356
+ cursor: not-allowed;
1357
+ }
1358
+
1359
+ .hive-card-scrim { padding: 12px; }
1360
+
1361
+ .hive-card-dialog {
1362
+ position: relative;
1363
+ inset: auto;
1364
+ width: min(720px, 92vw);
1365
+ max-width: 92vw;
1366
+ height: auto;
1367
+ max-height: 80vh;
1368
+ border: 1px solid var(--hive-line, #232b38);
1369
+ border-radius: 12px;
1370
+ background: color-mix(in srgb, var(--hive-bg, #0b0f17) 97%, var(--hive-fg, #e6edf3) 3%);
1371
+ box-shadow: 0 24px 70px rgb(0 0 0 / 52%);
1372
+ overflow: hidden;
1373
+ }
1374
+
1375
+ .hive-card-dialog .hive-dialog-head { align-items: flex-start; }
1376
+
1377
+ .hive-card-subline {
1378
+ margin-top: 3px;
1379
+ overflow-wrap: anywhere;
1380
+ color: var(--hive-fg-soft);
1381
+ font-family: var(--hive-mono);
1382
+ font-size: 10.5px;
1383
+ line-height: 1.5;
1384
+ }
1385
+
1386
+ .hive-card-close {
1387
+ min-width: 28px;
1388
+ height: 28px;
1389
+ padding: 0 6px;
1390
+ color: var(--hive-fg-soft);
1391
+ font-size: 18px;
1392
+ line-height: 1;
1393
+ }
1394
+
1395
+ .hive-card-body {
1396
+ display: flex;
1397
+ flex-direction: column;
1398
+ gap: 12px;
1399
+ min-height: 0;
1400
+ overflow: auto;
1401
+ }
1402
+
1403
+ .hive-card-json {
1404
+ border: 1px solid var(--hive-line, #232b38);
1405
+ border-radius: 8px;
1406
+ background: var(--hive-surface);
1407
+ overflow: hidden;
1408
+ }
1409
+
1410
+ .hive-card-json-summary {
1411
+ padding: 8px 10px;
1412
+ color: var(--hive-fg-soft);
1413
+ font-size: 10px;
1414
+ font-weight: 650;
1415
+ letter-spacing: 0.08em;
1416
+ line-height: 1.5;
1417
+ text-transform: uppercase;
1418
+ cursor: pointer;
1419
+ user-select: none;
1420
+ }
1421
+
1422
+ .hive-card-json .hive-json {
1423
+ max-height: 300px;
1424
+ margin: 0;
1425
+ padding: 10px;
1426
+ overflow: auto;
1427
+ border-top: 1px solid var(--hive-line, #232b38);
1428
+ font-family: var(--hive-mono);
1429
+ font-size: 10.5px;
1430
+ line-height: 1.5;
1431
+ white-space: pre-wrap;
1432
+ }
1433
+
1434
+ .hive-card-actions {
1435
+ justify-content: flex-end;
1436
+ gap: 8px;
1437
+ flex-wrap: wrap;
1438
+ }
1439
+
1440
+ .hive-add-dialog {
1441
+ width: min(560px, 92vw);
1442
+ max-width: 92vw;
1443
+ max-height: 80vh;
1444
+ }
1445
+
1446
+ .hive-add-body {
1447
+ display: flex;
1448
+ flex-direction: column;
1449
+ gap: 10px;
1450
+ min-height: 0;
1451
+ overflow: auto;
1452
+ }
1453
+
1454
+ .hive-add-body .hive-field { width: 100%; }
1455
+
1456
+ .hive-add-body .hive-input,
1457
+ .hive-add-body .hive-textarea { width: 100%; }
1458
+
1459
+ .hive-add-acceptance { min-height: 70px; }
1460
+
1461
+ .hive-add-submit {
1462
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1463
+ background: var(--hive-accent, #58c4dc);
1464
+ color: var(--hive-bg, #0b0f17);
1465
+ }
1466
+
1467
+ .hive-add-submit:hover:not(:disabled) {
1468
+ border-color: var(--hive-accent, #58c4dc);
1469
+ background: color-mix(in srgb, var(--hive-accent, #58c4dc) 86%, white);
1470
+ color: var(--hive-bg, #0b0f17);
1471
+ }
1472
+
1473
+ `;
1108
1474
 
1109
1475
  const LANE_LABEL_KEYS = Object.freeze({
1110
1476
  pending: "lane.pending",
@@ -1125,13 +1491,13 @@ export const messages = Object.freeze({
1125
1491
  "actions.aria": "board actions",
1126
1492
  "action.add": "New task",
1127
1493
  "action.claim": "claim",
1128
- "action.commit": "commit",
1129
1494
  "action.done": "done",
1130
1495
  "action.fail": "fail",
1131
- "action.freeze": "freeze",
1496
+ "action.freeze": "Pause",
1132
1497
  "action.modeTitle": "Toggle board mode",
1498
+ "action.remove": "Delete task",
1133
1499
  "action.retry": "retry",
1134
- "action.unfreeze": "unfreeze",
1500
+ "action.unfreeze": "Resume",
1135
1501
  "pane.agents": "agents",
1136
1502
  "pane.board": "board",
1137
1503
  "pane.events": "events",
@@ -1150,7 +1516,7 @@ export const messages = Object.freeze({
1150
1516
  "mode.freeze": "freeze",
1151
1517
  "mode.free.help": "Free: anyone can claim tasks.",
1152
1518
  "mode.freeze.help": "Freeze: only tasks tagged fix can be claimed; use this while the pipeline is red.",
1153
- "mode.freeze.banner": "Frozen: only tasks tagged fix can be claimed.",
1519
+ "mode.freeze.banner": "Paused: only tasks tagged fix can be claimed.",
1154
1520
  "mode.title": "mode:",
1155
1521
  "stats.cards": "tasks",
1156
1522
  "stats.oldest": "oldest",
@@ -1181,6 +1547,7 @@ export const messages = Object.freeze({
1181
1547
  "drawer.cardActions": "task actions",
1182
1548
  "drawer.noActions": "No actions for this state.",
1183
1549
  "drawer.readOnly": "Read-only: writable=false.",
1550
+ "drawer.removeClaimed": "A claimed task must be released or reopened before it can be deleted.",
1184
1551
  "drawer.rawJson": "raw json",
1185
1552
  "events.empty": "No events yet.",
1186
1553
  "events.showAll": "Show all events",
@@ -1196,45 +1563,88 @@ export const messages = Object.freeze({
1196
1563
  "supervisor.resumeAria": "Resume the supervisor for {repo}",
1197
1564
  "supervisor.resumeFailed": "Could not resume the supervisor",
1198
1565
  "limits.open": "Settings",
1199
- "limits.openAria": "Configure bee counts for this repository",
1200
- "limits.title": "Bee counts",
1201
- "limits.aria": "Bee counts for this repository",
1202
- "limits.description": "Concurrency limit per role. 0 pauses that role. Default 5.",
1566
+ "limits.openAria": "Open agent concurrency settings",
1567
+ "limits.title": "Agent concurrency",
1568
+ "limits.aria": "Agent concurrency for this repository",
1569
+ "limits.description": "Max agents working at the same time, per role; 0 pauses the role",
1203
1570
  "limits.role": "Role",
1204
- "limits.limit": "Limit",
1571
+ "limits.limit": "Concurrency limit",
1205
1572
  "limits.inFlight": "In flight",
1206
1573
  "limits.queued": "Queued",
1207
1574
  "limits.defaultHint": "0-999, default 5",
1208
1575
  "limits.limitAria": "Concurrency limit for {role}",
1209
1576
  "limits.save": "Save",
1210
- "limits.saveAria": "Save bee counts for {repo}",
1577
+ "limits.saveAria": "Save agent concurrency for {repo}",
1211
1578
  "limits.saving": "Saving...",
1212
- "limits.saved": "Bee counts saved.",
1213
- "limits.failed": "Could not save bee counts",
1579
+ "limits.saved": "Agent concurrency saved.",
1580
+ "limits.failed": "Could not save agent concurrency",
1214
1581
  "limits.invalid": "Every limit must be an integer from 0 to 999.",
1215
1582
  "limits.none": "No role data for this repository.",
1216
1583
  "limits.close": "Close",
1217
- "limits.closeAria": "Close bee count settings",
1584
+ "limits.closeAria": "Close agent concurrency settings",
1585
+ "settings.openAria": "Open settings for this repository",
1586
+ "settings.title": "Settings",
1587
+ "settings.tabLimits": "Concurrency limit",
1588
+ "settings.tabRole": "Add role",
1589
+ "settings.tabsAria": "Settings sections",
1590
+ "settings.aria": "Settings for this repository",
1591
+ "settings.addRole": "Add role",
1592
+ "settings.roleName": "Role name",
1593
+ "settings.roleNameHint": "start with a lowercase letter; 2-32 characters; lowercase letters, digits and hyphens only",
1594
+ "settings.roleNameAria": "New role name",
1595
+ "settings.roleNameExample": "e.g. reviewer",
1596
+ "settings.roleDescription": "Responsibilities",
1597
+ "settings.roleDescriptionAria": "Responsibilities for the new role (optional)",
1598
+ "settings.roleDescriptionHint": "Written to .hive/roles/<name>.md; the agent reads it when it starts.",
1599
+ "settings.roleDescriptionMax": "optional, up to 2000 characters",
1600
+ "settings.descriptionTooLong": "Responsibilities must be at most 2000 characters.",
1601
+ "settings.adapter": "Adapter",
1602
+ "settings.adapterAria": "Adapter for the new role",
1603
+ "settings.model": "Model",
1604
+ "settings.modelOptional": "optional",
1605
+ "settings.modelAria": "Optional model for the new role",
1606
+ "settings.addRoleButton": "Add role",
1607
+ "settings.addRoleAria": "Add this role",
1608
+ "settings.addingRole": "Adding...",
1609
+ "settings.roleInvalid": "Role name must start with a lowercase letter, be 2-32 characters, and use lowercase letters, digits and hyphens only.",
1610
+ "settings.modelInvalid": "Model may use letters, digits, dot, underscore, colon and hyphen (max 64).",
1611
+ "settings.roleExists": "Role already exists.",
1612
+ "settings.roleAdded": "Role added.",
1613
+ "settings.roleFailed": "Could not add role",
1614
+ "settings.readOnly": "Read-only: roles and limits cannot be changed.",
1615
+ "settings.supervisorUnavailable": "Supervisor unavailable; role limits cannot load.",
1616
+ "settings.saveLimits": "Save limits",
1617
+ "settings.close": "Close",
1618
+ "settings.closeAria": "Close settings",
1218
1619
  "event.unknown": "event",
1620
+ "add.dialogTitle": "New task",
1621
+ "add.title": "Title",
1622
+ "add.titleAria": "New task title",
1623
+ "add.role": "Role",
1624
+ "add.roleAria": "Role for the new task",
1625
+ "add.scope": "Scope (comma separated, optional)",
1626
+ "add.scopeAria": "File scope for the new task",
1627
+ "add.after": "After task ids (comma separated, optional)",
1628
+ "add.afterAria": "Tasks that must finish first",
1629
+ "add.acceptance": "Acceptance criteria (optional)",
1630
+ "add.acceptanceAria": "Acceptance criteria for the new task",
1631
+ "add.cancel": "Cancel",
1632
+ "add.submit": "Add task",
1633
+ "add.submitting": "Adding…",
1634
+ "add.required": "A title is required.",
1219
1635
  "prompt.newTitle": "New task title",
1220
1636
  "prompt.role": "Role",
1221
1637
  "prompt.scope": "Scope (comma separated, optional)",
1222
1638
  "prompt.after": "After task ids (comma separated, optional)",
1223
- "prompt.commitMessage": "Commit message",
1224
- "prompt.paths": "Paths (comma separated, optional)",
1225
1639
  "prompt.claimAgent": "Claim as agent",
1226
1640
  "prompt.commitSha": "Commit sha (optional)",
1227
1641
  "prompt.failReason": "Failure reason",
1228
- "action.plan": "Give the Queen a goal",
1229
- "help.open": "What these buttons do",
1642
+ "action.plan": "Set the Queen a goal",
1230
1643
  "menu.open": "More actions and help",
1231
- "help.title": "Button guide",
1232
- "help.aria": "Action guide",
1644
+ "help.title": "Menu",
1645
+ "help.aria": "Menu",
1233
1646
  "help.close": "close",
1234
- "help.closeAria": "Close the button guide",
1235
- "help.board": "board actions",
1236
- "help.tasks": "task actions",
1237
- "help.params": "Parameters: ",
1647
+ "help.closeAria": "Close the menu",
1238
1648
  "help.readOnly": "The panel started read-only; add --write to show the write-action buttons.",
1239
1649
  "help.uninitialised": "Initialise Hive with the button in the main area before using board actions.",
1240
1650
  "init.repo": "repository",
@@ -1264,29 +1674,20 @@ export const messages = Object.freeze({
1264
1674
  "queen.takeover": "Let the Queen take over",
1265
1675
  "queen.takeoverAria": "Let the Queen take over this session",
1266
1676
  "queen.takeoverBusy": "Taking over...",
1267
- "help.hint": "Open a task to see the actions for that task.",
1268
- "help.action.freeze": "Freeze: nobody can claim new tasks except tasks tagged fix.",
1269
- "help.action.unfreeze": "Unfreeze: agents can claim pending tasks again.",
1677
+ "help.action.freeze": "Pause: only tasks tagged fix can be claimed.",
1678
+ "help.action.unfreeze": "Resume: agents can claim pending tasks again.",
1270
1679
  "help.action.add": "New task: create a pending task with a role and file scope.",
1271
- "help.action.plan": "Give the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
1272
- "help.action.commit": "Commit: commit the selected paths with a message.",
1680
+ "help.action.plan": "Set the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
1273
1681
  "help.action.claim": "Claim: lease a pending task for an agent.",
1274
1682
  "help.action.done": "Done: mark a claimed task complete, optionally with a commit sha.",
1275
1683
  "help.action.fail": "Fail: mark a claimed task failed and record the reason.",
1276
1684
  "help.action.retry": "Retry: put a failed or blocked task back in the queue.",
1277
- "help.params.mode": "mode, reason",
1278
- "help.params.add": "title, role, scope[], after[]",
1279
- "help.params.plan": "goal, maxCards",
1280
- "help.params.commit": "message, set[]",
1281
- "help.params.claim": "id, agent",
1282
- "help.params.done": "id, sha?",
1283
- "help.params.fail": "id, reason",
1284
- "help.params.retry": "id",
1285
- "plan.dialogTitle": "Give the Queen a goal",
1685
+ "help.action.remove": "Delete this task card permanently. A claimed task has to be released or reopened first.",
1686
+ "plan.dialogTitle": "Set the Queen a goal",
1286
1687
  "plan.dialogAria": "Plan tasks from a goal",
1287
1688
  "plan.goal": "Goal",
1288
1689
  "plan.goalHint": "Describe the outcome; the Queen will split it into tasks.",
1289
- "plan.maxCards": "Max cards",
1690
+ "plan.maxCards": "Max tasks",
1290
1691
  "plan.maxCardsHint": "1+",
1291
1692
  "plan.preview": "Preview plan",
1292
1693
  "plan.previewAria": "Ask the Queen to draft a task plan without writing it",
@@ -1307,14 +1708,16 @@ export const messages = Object.freeze({
1307
1708
  "plan.deps": "deps",
1308
1709
  "plan.none": "—",
1309
1710
  "plan.goalRequired": "Enter a goal first.",
1310
- "plan.maxInvalid": "Max cards must be a positive whole number.",
1711
+ "plan.maxInvalid": "Max tasks must be a positive whole number.",
1311
1712
  "plan.previewFirst": "Preview the plan before writing tasks.",
1312
1713
  "plan.previewFailed": "Could not read the plan.",
1313
1714
  "plan.applyHint": "The preview is read-only; writing calls plan again with apply=true.",
1314
- "plan.stale": "The goal or max cards changed; preview the plan again.",
1715
+ "plan.stale": "The goal or max tasks changed; preview the plan again.",
1315
1716
  "plan.error": "Plan failed",
1717
+ "confirm.remove": "Delete task \"{title}\" permanently? This cannot be undone.",
1316
1718
  "toast.dismiss": "Dismiss",
1317
1719
  "toast.planWritten": "Tasks written",
1720
+ "toast.taskRemoved": "Task deleted",
1318
1721
  "toast.pickupHint": "The supervisor will pick them up automatically.",
1319
1722
  }),
1320
1723
  zh: Object.freeze({
@@ -1322,13 +1725,13 @@ export const messages = Object.freeze({
1322
1725
  "actions.aria": "看板操作",
1323
1726
  "action.add": "新建任务",
1324
1727
  "action.claim": "认领",
1325
- "action.commit": "提交",
1326
1728
  "action.done": "完成",
1327
1729
  "action.fail": "标记失败",
1328
- "action.freeze": "冻结",
1730
+ "action.freeze": "暂停",
1329
1731
  "action.modeTitle": "切换看板模式",
1732
+ "action.remove": "删除任务",
1330
1733
  "action.retry": "重试",
1331
- "action.unfreeze": "解冻",
1734
+ "action.unfreeze": "恢复",
1332
1735
  "pane.agents": "智能体",
1333
1736
  "pane.board": "任务",
1334
1737
  "pane.events": "事件",
@@ -1347,7 +1750,7 @@ export const messages = Object.freeze({
1347
1750
  "mode.freeze": "冻结",
1348
1751
  "mode.free.help": "正常:任何人都可以认领任务。",
1349
1752
  "mode.freeze.help": "冻结:只有带 fix 标签的任务能被认领;流水线红时使用。",
1350
- "mode.freeze.banner": "已冻结:只有带 fix 标签的任务能被认领",
1753
+ "mode.freeze.banner": "已暂停:只有带 fix 标签的任务能被认领",
1351
1754
  "mode.title": "模式:",
1352
1755
  "stats.cards": "个任务",
1353
1756
  "stats.oldest": "最久待办",
@@ -1378,6 +1781,7 @@ export const messages = Object.freeze({
1378
1781
  "drawer.cardActions": "任务操作",
1379
1782
  "drawer.noActions": "该状态没有可用操作。",
1380
1783
  "drawer.readOnly": "只读:writable=false。",
1784
+ "drawer.removeClaimed": "已认领的任务必须先释放或重开才能删除。",
1381
1785
  "drawer.rawJson": "原始 JSON",
1382
1786
  "events.empty": "暂无事件。",
1383
1787
  "events.showAll": "展开全部事件",
@@ -1393,45 +1797,88 @@ export const messages = Object.freeze({
1393
1797
  "supervisor.resumeAria": "恢复 {repo} 的 supervisor",
1394
1798
  "supervisor.resumeFailed": "恢复 supervisor 失败",
1395
1799
  "limits.open": "设置",
1396
- "limits.openAria": "设置这个仓库的蜂的数量",
1397
- "limits.title": "蜂的数量",
1398
- "limits.aria": "按仓库设置蜂的数量",
1399
- "limits.description": "每个角色的并发上限。0 表示暂停该角色,默认 5。",
1800
+ "limits.openAria": "打开智能体并发上限设置",
1801
+ "limits.title": "智能体的并发上限",
1802
+ "limits.aria": "这个仓库的智能体并发上限",
1803
+ "limits.description": "同时干活的智能体数量上限,按角色分别设置;0 表示暂停该角色",
1400
1804
  "limits.role": "角色",
1401
- "limits.limit": "上限",
1805
+ "limits.limit": "并发上限",
1402
1806
  "limits.inFlight": "在飞",
1403
1807
  "limits.queued": "排队",
1404
1808
  "limits.defaultHint": "0–999,默认 5",
1405
1809
  "limits.limitAria": "{role} 的并发上限",
1406
1810
  "limits.save": "保存",
1407
- "limits.saveAria": "保存 {repo} 的蜂的数量",
1811
+ "limits.saveAria": "保存 {repo} 的智能体并发上限",
1408
1812
  "limits.saving": "正在保存…",
1409
- "limits.saved": "蜂的数量已保存。",
1410
- "limits.failed": "保存蜂的数量失败",
1813
+ "limits.saved": "智能体的并发上限已保存。",
1814
+ "limits.failed": "保存智能体的并发上限失败",
1411
1815
  "limits.invalid": "每个上限都必须是 0–999 的整数。",
1412
1816
  "limits.none": "这个仓库没有角色数据。",
1413
1817
  "limits.close": "关闭",
1414
- "limits.closeAria": "关闭蜂的数量设置",
1818
+ "limits.closeAria": "关闭智能体的并发上限设置",
1819
+ "settings.openAria": "打开这个仓库的设置",
1820
+ "settings.title": "设置",
1821
+ "settings.tabLimits": "并发上限",
1822
+ "settings.tabRole": "添加角色",
1823
+ "settings.tabsAria": "设置分区",
1824
+ "settings.aria": "这个仓库的设置",
1825
+ "settings.addRole": "新增角色",
1826
+ "settings.roleName": "角色名",
1827
+ "settings.roleNameHint": "以小写字母开头,2–32 个字符,只能包含小写字母、数字和连字符",
1828
+ "settings.roleNameAria": "新角色名",
1829
+ "settings.roleNameExample": "例如 reviewer",
1830
+ "settings.roleDescription": "职责描述",
1831
+ "settings.roleDescriptionAria": "新角色的职责描述(可空)",
1832
+ "settings.roleDescriptionHint": "会写进 .hive/roles/<name>.md,agent 开工时读它",
1833
+ "settings.roleDescriptionMax": "可空,最多 2000 字",
1834
+ "settings.descriptionTooLong": "职责描述不能超过 2000 字。",
1835
+ "settings.adapter": "适配器",
1836
+ "settings.adapterAria": "新角色的适配器",
1837
+ "settings.model": "模型",
1838
+ "settings.modelOptional": "可空",
1839
+ "settings.modelAria": "新角色的可选模型",
1840
+ "settings.addRoleButton": "新增角色",
1841
+ "settings.addRoleAria": "新增这个角色",
1842
+ "settings.addingRole": "正在新增…",
1843
+ "settings.roleInvalid": "角色名必须以小写字母开头,2–32 个字符,只能包含小写字母、数字和连字符。",
1844
+ "settings.modelInvalid": "模型只能包含字母、数字、点、下划线、冒号和连字符,最长 64 位。",
1845
+ "settings.roleExists": "角色已存在。",
1846
+ "settings.roleAdded": "角色已新增。",
1847
+ "settings.roleFailed": "新增角色失败",
1848
+ "settings.readOnly": "只读模式:无法修改角色和限额。",
1849
+ "settings.supervisorUnavailable": "取不到 supervisor,无法读取角色限额。",
1850
+ "settings.saveLimits": "保存限额",
1851
+ "settings.close": "关闭",
1852
+ "settings.closeAria": "关闭设置",
1415
1853
  "event.unknown": "事件",
1854
+ "add.dialogTitle": "新建任务",
1855
+ "add.title": "标题",
1856
+ "add.titleAria": "新任务标题",
1857
+ "add.role": "角色",
1858
+ "add.roleAria": "新任务角色",
1859
+ "add.scope": "范围(逗号分隔,可选)",
1860
+ "add.scopeAria": "新任务的文件范围",
1861
+ "add.after": "依赖任务(任务 ID,逗号分隔,可选)",
1862
+ "add.afterAria": "需要先完成的任务",
1863
+ "add.acceptance": "验收标准(可选)",
1864
+ "add.acceptanceAria": "新任务的验收标准",
1865
+ "add.cancel": "取消",
1866
+ "add.submit": "新建任务",
1867
+ "add.submitting": "正在新建…",
1868
+ "add.required": "标题不能为空。",
1416
1869
  "prompt.newTitle": "新任务标题",
1417
1870
  "prompt.role": "角色",
1418
1871
  "prompt.scope": "范围(逗号分隔,可选)",
1419
1872
  "prompt.after": "排在哪些任务之后(任务 ID,逗号分隔,可选)",
1420
- "prompt.commitMessage": "提交信息",
1421
- "prompt.paths": "路径(逗号分隔,可选)",
1422
1873
  "prompt.claimAgent": "以哪个智能体认领",
1423
1874
  "prompt.commitSha": "提交 SHA(可选)",
1424
1875
  "prompt.failReason": "失败原因",
1425
- "action.plan": "给女王下目标",
1426
- "help.open": "这些按钮是做什么的",
1876
+ "action.plan": "给女王设目标",
1427
1877
  "menu.open": "更多操作与说明",
1428
- "help.title": "按钮说明",
1429
- "help.aria": "操作说明",
1878
+ "help.title": "菜单",
1879
+ "help.aria": "菜单",
1430
1880
  "help.close": "关闭",
1431
- "help.closeAria": "关闭按钮说明",
1432
- "help.board": "看板操作",
1433
- "help.tasks": "任务操作",
1434
- "help.params": "参数:",
1881
+ "help.closeAria": "关闭菜单",
1435
1882
  "help.readOnly": "面板以只读启动,加 --write 才有写操作按钮。",
1436
1883
  "help.uninitialised": "请先用主区的按钮初始化 Hive,再使用看板操作。",
1437
1884
  "init.repo": "仓库",
@@ -1461,29 +1908,20 @@ export const messages = Object.freeze({
1461
1908
  "queen.takeover": "让女王接管",
1462
1909
  "queen.takeoverAria": "让女王接管本会话",
1463
1910
  "queen.takeoverBusy": "正在接管…",
1464
- "help.hint": "点开任务可查看该任务自己的操作。",
1465
- "help.action.freeze": "冻结:除带 fix 标签的任务外,任何人都不再能认领新任务。",
1466
- "help.action.unfreeze": "解冻:恢复认领,智能体可以继续接取待办任务。",
1911
+ "help.action.freeze": "暂停:只有带 fix 标签的任务能被认领。",
1912
+ "help.action.unfreeze": "恢复:恢复认领,智能体可以继续接取待办任务。",
1467
1913
  "help.action.add": "新建任务:添加一条带角色和文件范围的待办任务。",
1468
- "help.action.plan": "给女王下目标:让女王把目标拆成任务计划,预览后再写入看板。",
1469
- "help.action.commit": "提交:按提交信息提交选中的路径。",
1914
+ "help.action.plan": "给女王设目标:让女王把目标拆成任务计划,预览后再写入看板。",
1470
1915
  "help.action.claim": "认领:以某个智能体的名义短期租下这条待办任务。",
1471
1916
  "help.action.done": "完成:把已认领的任务标为完成,可选填写提交 SHA。",
1472
1917
  "help.action.fail": "标记失败:把已认领的任务标为失败,并写明原因。",
1473
1918
  "help.action.retry": "重试:把失败或受阻的任务放回队列。",
1474
- "help.params.mode": "mode、reason",
1475
- "help.params.add": "title、role、scope[]、after[]",
1476
- "help.params.plan": "goal、maxCards",
1477
- "help.params.commit": "message、set[]",
1478
- "help.params.claim": "id、智能体",
1479
- "help.params.done": "id、sha?",
1480
- "help.params.fail": "id、reason",
1481
- "help.params.retry": "id",
1482
- "plan.dialogTitle": "给女王下目标",
1919
+ "help.action.remove": "永久删除这张任务卡;已认领的任务需要先释放或重开。",
1920
+ "plan.dialogTitle": "给女王设目标",
1483
1921
  "plan.dialogAria": "按目标规划任务",
1484
1922
  "plan.goal": "目标",
1485
1923
  "plan.goalHint": "描述想达成的结果,女王会把它拆成任务。",
1486
- "plan.maxCards": "最大卡数",
1924
+ "plan.maxCards": "最大任务数",
1487
1925
  "plan.maxCardsHint": "至少 1",
1488
1926
  "plan.preview": "预览计划",
1489
1927
  "plan.previewAria": "让女王先给出任务计划,不写入看板",
@@ -1504,14 +1942,16 @@ export const messages = Object.freeze({
1504
1942
  "plan.deps": "依赖",
1505
1943
  "plan.none": "—",
1506
1944
  "plan.goalRequired": "请先填写目标。",
1507
- "plan.maxInvalid": "最大卡数必须是正整数。",
1945
+ "plan.maxInvalid": "最大任务数必须是正整数。",
1508
1946
  "plan.previewFirst": "请先预览计划,再写入任务。",
1509
1947
  "plan.previewFailed": "无法解析计划。",
1510
1948
  "plan.applyHint": "预览不会写入;写入时会带 apply=true 再调用一次 plan。",
1511
- "plan.stale": "目标或最大卡数已修改,请重新预览计划。",
1949
+ "plan.stale": "目标或最大任务数已修改,请重新预览计划。",
1512
1950
  "plan.error": "计划失败",
1951
+ "confirm.remove": "确定永久删除任务「{title}」?此操作不可撤销。",
1513
1952
  "toast.dismiss": "关闭",
1514
1953
  "toast.planWritten": "任务已写入",
1954
+ "toast.taskRemoved": "任务已删除",
1515
1955
  "toast.pickupHint": "supervisor 会自动接卡。",
1516
1956
  }),
1517
1957
  });
@@ -1680,22 +2120,12 @@ function modeAction(mode) {
1680
2120
  return { name: "mode", ...meta, body: { mode: nextMode, reason: "panel" } };
1681
2121
  }
1682
2122
 
1683
- function toolbarActions(writable) {
2123
+ function toolbarActions(writable, mode) {
1684
2124
  if (!writable) return [];
1685
2125
  return [
1686
2126
  { name: "add", ...ACTION_META.add },
1687
2127
  { name: "plan", ...ACTION_META.plan },
1688
- { name: "commit", ...ACTION_META.commit },
1689
- ];
1690
- }
1691
-
1692
- function helpGroups(mode) {
1693
- return [
1694
- { titleKey: "help.board", actions: [modeAction(mode), ...toolbarActions(true)] },
1695
- {
1696
- titleKey: "help.tasks",
1697
- actions: ["claim", "done", "fail", "retry"].map((name) => ({ name, ...ACTION_META[name] })),
1698
- },
2128
+ modeAction(mode),
1699
2129
  ];
1700
2130
  }
1701
2131
 
@@ -1706,6 +2136,7 @@ function helpGroups(mode) {
1706
2136
  * @returns {{
1707
2137
  * at: string, repo: string, mode: string, initialised: boolean, writable: boolean,
1708
2138
  * queen: {active:boolean, source:"auto"|"manual"|null, repo:string}|null,
2139
+ * roles: {list:Array<{name:string,adapter:string|null,model:string|null,prompt:string|null,promptExists:boolean,limit:number|null}>, limits:Record<string,number>, error:string|null},
1709
2140
  * lanes: Record<string, Array<{id:string,title:string,role:string,owner:string,scope:string[],reason:string}>>,
1710
2141
  * laneOrder: string[],
1711
2142
  * stats: {total:number, byState:Record<string,number>, byRole:Record<string,number>, oldestPending:{id:string,createdAt:string}|null},
@@ -1749,6 +2180,32 @@ export function renderModel(snapshot) {
1749
2180
  : null,
1750
2181
  repo: typeof rawQueen.repo === "string" ? rawQueen.repo : "",
1751
2182
  };
2183
+ const rawRoles = isRecord(source.roles) ? source.roles : null;
2184
+ const rolesLimits = {};
2185
+ if (rawRoles && isRecord(rawRoles.limits)) {
2186
+ for (const [name, value] of Object.entries(rawRoles.limits)) {
2187
+ const number = Number(value);
2188
+ if (name && Number.isFinite(number)) rolesLimits[name] = number;
2189
+ }
2190
+ }
2191
+ const roles = {
2192
+ list:
2193
+ rawRoles && Array.isArray(rawRoles.list)
2194
+ ? rawRoles.list
2195
+ .filter(isRecord)
2196
+ .map((entry) => ({
2197
+ name: asString(entry.name),
2198
+ adapter: typeof entry.adapter === "string" ? entry.adapter : null,
2199
+ model: typeof entry.model === "string" ? entry.model : null,
2200
+ prompt: typeof entry.prompt === "string" ? entry.prompt : null,
2201
+ promptExists: entry.promptExists === true,
2202
+ limit: typeof entry.limit === "number" && Number.isFinite(entry.limit) ? entry.limit : null,
2203
+ }))
2204
+ .filter((entry) => entry.name)
2205
+ : [],
2206
+ limits: rolesLimits,
2207
+ error: rawRoles ? asString(rawRoles.error) || null : null,
2208
+ };
1752
2209
 
1753
2210
  return {
1754
2211
  at: asString(source.at),
@@ -1756,13 +2213,14 @@ export function renderModel(snapshot) {
1756
2213
  mode,
1757
2214
  initialised,
1758
2215
  queen,
2216
+ roles,
1759
2217
  writable,
1760
2218
  lanes,
1761
2219
  laneOrder: [...LANE_ORDER],
1762
2220
  stats: normalizeStats(source.stats, tasks),
1763
2221
  agents: normalizeAgents(source.board),
1764
2222
  events: normalizeEvents(source.events),
1765
- actions: initialised ? toolbarActions(writable) : [],
2223
+ actions: initialised ? toolbarActions(writable, mode) : [],
1766
2224
  };
1767
2225
  }
1768
2226
 
@@ -1944,6 +2402,62 @@ function element(doc, tag, className, text) {
1944
2402
  return node;
1945
2403
  }
1946
2404
 
2405
+ function svgNode(doc, tag) {
2406
+ const node =
2407
+ typeof doc.createElementNS === "function"
2408
+ ? doc.createElementNS("http://www.w3.org/2000/svg", tag)
2409
+ : doc.createElement(tag);
2410
+ return node;
2411
+ }
2412
+
2413
+ function makeHiveIcon(doc, kind) {
2414
+ const svg = svgNode(doc, "svg");
2415
+ setAttr(svg, "viewBox", "0 0 24 24");
2416
+ setAttr(svg, "width", "16");
2417
+ setAttr(svg, "height", "16");
2418
+ setAttr(svg, "aria-hidden", "true");
2419
+ setAttr(svg, "focusable", "false");
2420
+ if (kind === "menu") {
2421
+ for (const cx of [5, 12, 19]) {
2422
+ const dot = svgNode(doc, "circle");
2423
+ setAttr(dot, "cx", String(cx));
2424
+ setAttr(dot, "cy", "12");
2425
+ setAttr(dot, "r", "1.25");
2426
+ setAttr(dot, "fill", "currentColor");
2427
+ svg.appendChild(dot);
2428
+ }
2429
+ return svg;
2430
+ }
2431
+ setAttr(svg, "fill", "none");
2432
+ setAttr(svg, "stroke", "currentColor");
2433
+ setAttr(svg, "stroke-width", "1.75");
2434
+ setAttr(svg, "stroke-linecap", "round");
2435
+ setAttr(svg, "stroke-linejoin", "round");
2436
+ const center = svgNode(doc, "circle");
2437
+ setAttr(center, "cx", "12");
2438
+ setAttr(center, "cy", "12");
2439
+ setAttr(center, "r", "3");
2440
+ svg.appendChild(center);
2441
+ const path = svgNode(doc, "path");
2442
+ setAttr(
2443
+ path,
2444
+ "d",
2445
+ "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z",
2446
+ );
2447
+ svg.appendChild(path);
2448
+ return svg;
2449
+ }
2450
+
2451
+ function setHidden(node, hidden) {
2452
+ if (!node) return;
2453
+ if (hidden) {
2454
+ setAttr(node, "hidden", "");
2455
+ return;
2456
+ }
2457
+ if (typeof node.removeAttribute === "function") node.removeAttribute("hidden");
2458
+ else if (node.attributes) delete node.attributes.hidden;
2459
+ }
2460
+
1947
2461
  function setAttr(node, name, value) {
1948
2462
  if (node && typeof node.setAttribute === "function") {
1949
2463
  node.setAttribute(name, value === null || value === undefined ? "" : String(value));
@@ -2022,22 +2536,6 @@ function formatTime(value) {
2022
2536
  }
2023
2537
  }
2024
2538
 
2025
- function formatStamp(value) {
2026
- const date = parseDate(value);
2027
- if (!date) return asString(value);
2028
- try {
2029
- return date.toLocaleString([], {
2030
- month: "short",
2031
- day: "2-digit",
2032
- hour: "2-digit",
2033
- minute: "2-digit",
2034
- second: "2-digit",
2035
- });
2036
- } catch {
2037
- return date.toISOString();
2038
- }
2039
- }
2040
-
2041
2539
  function safeClassToken(value) {
2042
2540
  const token = asString(value).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
2043
2541
  return token || "unknown";
@@ -2150,6 +2648,7 @@ function extractPlan(payload) {
2150
2648
  * intervalMs?: number,
2151
2649
  * onError?: (error: Error) => void,
2152
2650
  * fetch?: typeof fetch,
2651
+ * confirm?: (message: string) => boolean,
2153
2652
  * t?: (key: string) => string,
2154
2653
  * subscribeLocale?: (listener: () => void) => (() => void)
2155
2654
  * }} [options]
@@ -2203,6 +2702,18 @@ export function mount(root, options = {}) {
2203
2702
  ? globalThis.prompt.bind(globalThis)
2204
2703
  : null;
2205
2704
 
2705
+ // Destructive actions ask through the host's confirm when it provides one
2706
+ // (tests, embedded hosts), then the global confirm. Without either, a
2707
+ // destructive action is refused rather than run unconfirmed.
2708
+ const confirmImpl =
2709
+ typeof opts.confirm === "function"
2710
+ ? opts.confirm
2711
+ : typeof view.confirm === "function"
2712
+ ? view.confirm.bind(view)
2713
+ : typeof globalThis.confirm === "function"
2714
+ ? globalThis.confirm.bind(globalThis)
2715
+ : null;
2716
+
2206
2717
  const schedule =
2207
2718
  typeof view.setInterval === "function" ? view.setInterval.bind(view) : globalThis.setInterval.bind(globalThis);
2208
2719
  const unschedule =
@@ -2240,6 +2751,7 @@ export function mount(root, options = {}) {
2240
2751
  let lastModel = null;
2241
2752
  let drawerNode = null;
2242
2753
  let drawerState = null;
2754
+ let drawerTrigger = null;
2243
2755
  let unsubscribeLocale = null;
2244
2756
  let statusKey = null;
2245
2757
  let statusKind = "info";
@@ -2252,6 +2764,11 @@ export function mount(root, options = {}) {
2252
2764
  let planState = null;
2253
2765
  let planTriggerButton = null;
2254
2766
  let planFocusables = [];
2767
+ let addOverlay = null;
2768
+ let addDialogNode = null;
2769
+ let addState = null;
2770
+ let addTriggerButton = null;
2771
+ let addFocusables = [];
2255
2772
  let toastNode = null;
2256
2773
  let stageFilter = "all";
2257
2774
  let stageChipEntries = [];
@@ -2265,11 +2782,13 @@ export function mount(root, options = {}) {
2265
2782
  const queenDismissedFallback = new Set();
2266
2783
  let supervisorData = [];
2267
2784
  let supervisorRequest = null;
2785
+ let supervisorInlineRow = null;
2268
2786
  let limitsOverlay = null;
2269
2787
  let limitsDialogNode = null;
2270
2788
  let limitsState = null;
2271
2789
  let limitsTriggerButton = null;
2272
2790
  let limitsFocusables = [];
2791
+ let settingsActiveTab = "limits";
2273
2792
 
2274
2793
  // --- shell ---------------------------------------------------------------
2275
2794
 
@@ -2282,8 +2801,19 @@ export function mount(root, options = {}) {
2282
2801
  ident.appendChild(repoNode);
2283
2802
  bar.appendChild(ident);
2284
2803
 
2285
- const timeNode = element(doc, "time", "hive-time", "");
2286
- bar.appendChild(timeNode);
2804
+ const supervisorInline = element(doc, "span", "hive-supervisor-inline is-hidden");
2805
+ setAttr(supervisorInline, "aria-label", translate("supervisor.aria"));
2806
+ const supervisorInlineLabel = element(doc, "span", "hive-supervisor-inline-label", translate("supervisor.label"));
2807
+ const supervisorInlineState = element(doc, "span", "hive-supervisor-inline-state", "");
2808
+ const supervisorInlineResume = element(doc, "button", "hive-btn hive-supervisor-inline-resume is-hidden", translate("supervisor.resume"));
2809
+ setAttr(supervisorInlineResume, "type", "button");
2810
+ supervisorInlineResume.addEventListener("click", () => {
2811
+ if (supervisorInlineRow) void resumeSupervisor(supervisorInlineRow, supervisorInlineResume);
2812
+ });
2813
+ supervisorInline.appendChild(supervisorInlineLabel);
2814
+ supervisorInline.appendChild(supervisorInlineState);
2815
+ supervisorInline.appendChild(supervisorInlineResume);
2816
+ bar.appendChild(supervisorInline);
2287
2817
 
2288
2818
  const statsNode = element(doc, "div", "hive-stats");
2289
2819
  bar.appendChild(statsNode);
@@ -2298,8 +2828,9 @@ export function mount(root, options = {}) {
2298
2828
  const actionsNode = element(doc, "div", "hive-actions");
2299
2829
  actionGroup.appendChild(actionsNode);
2300
2830
 
2301
- const helpButton = element(doc, "button", "hive-btn hive-help-trigger hive-menu-trigger", "⋯");
2831
+ const helpButton = element(doc, "button", "hive-btn hive-btn-ghost hive-icon-button hive-help-trigger hive-menu-trigger");
2302
2832
  setAttr(helpButton, "type", "button");
2833
+ helpButton.appendChild(makeHiveIcon(doc, "menu"));
2303
2834
  setAttr(helpButton, "aria-haspopup", "dialog");
2304
2835
  setAttr(helpButton, "aria-expanded", "false");
2305
2836
  setAttr(helpButton, "title", translate("menu.open"));
@@ -2307,23 +2838,17 @@ export function mount(root, options = {}) {
2307
2838
  helpButton.addEventListener("click", () => {
2308
2839
  toggleHelp();
2309
2840
  });
2310
- actionGroup.appendChild(helpButton);
2311
- bar.appendChild(actionGroup);
2312
-
2313
- const supervisorBar = element(doc, "section", "hive-supervisor is-hidden");
2314
- setAttr(supervisorBar, "aria-label", translate("supervisor.aria"));
2315
- const supervisorLabel = element(doc, "span", "hive-supervisor-label", "");
2316
- const supervisorRepos = element(doc, "div", "hive-supervisor-repos");
2317
- const supervisorLimitsButton = element(doc, "button", "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden", translate("limits.open"));
2318
- setAttr(supervisorLimitsButton, "type", "button");
2319
- setAttr(supervisorLimitsButton, "title", translate("limits.openAria"));
2320
- setAttr(supervisorLimitsButton, "aria-label", translate("limits.openAria"));
2321
- supervisorLimitsButton.addEventListener("click", () => {
2322
- openLimitsDialog(supervisorLimitsButton);
2841
+ // The previous "⋯" action menu has no entries left; settings carries the Queen section.
2842
+ const settingsButton = element(doc, "button", "hive-btn hive-btn-ghost hive-icon-button hive-settings-trigger");
2843
+ setAttr(settingsButton, "type", "button");
2844
+ settingsButton.appendChild(makeHiveIcon(doc, "gear"));
2845
+ setAttr(settingsButton, "title", translate("settings.openAria"));
2846
+ setAttr(settingsButton, "aria-label", translate("settings.openAria"));
2847
+ settingsButton.addEventListener("click", () => {
2848
+ openLimitsDialog(settingsButton);
2323
2849
  });
2324
- supervisorBar.appendChild(supervisorLabel);
2325
- supervisorBar.appendChild(supervisorRepos);
2326
- supervisorBar.appendChild(supervisorLimitsButton);
2850
+ actionGroup.appendChild(settingsButton);
2851
+ bar.appendChild(actionGroup);
2327
2852
 
2328
2853
  const freezeSlot = element(doc, "div", "hive-freeze-slot");
2329
2854
 
@@ -2452,7 +2977,6 @@ export function mount(root, options = {}) {
2452
2977
  });
2453
2978
 
2454
2979
  frame.appendChild(bar);
2455
- frame.appendChild(supervisorBar);
2456
2980
  frame.appendChild(freezeSlot);
2457
2981
  frame.appendChild(queenHint);
2458
2982
  frame.appendChild(agentsStrip);
@@ -2509,6 +3033,15 @@ export function mount(root, options = {}) {
2509
3033
  return answer === null || answer === undefined ? null : String(answer);
2510
3034
  }
2511
3035
 
3036
+ function askConfirm(message) {
3037
+ if (!confirmImpl) return false;
3038
+ try {
3039
+ return confirmImpl(message) === true;
3040
+ } catch {
3041
+ return false;
3042
+ }
3043
+ }
3044
+
2512
3045
  function emptyState(text) {
2513
3046
  return element(doc, "div", "hive-empty", text);
2514
3047
  }
@@ -2576,36 +3109,22 @@ export function mount(root, options = {}) {
2576
3109
  if (!model || !model.writable) {
2577
3110
  body.appendChild(element(doc, "div", "hive-help-note", translate("help.readOnly")));
2578
3111
  }
2579
- const groups = helpGroups(model ? model.mode : "free");
2580
- for (const group of groups) {
2581
- body.appendChild(element(doc, "div", "hive-help-section", translate(group.titleKey)));
2582
- for (const action of group.actions) {
2583
- const item = element(doc, "div", "hive-help-action");
2584
- item.appendChild(element(doc, "div", "hive-help-name", translate(action.labelKey)));
2585
- item.appendChild(element(doc, "div", "hive-help-desc", translate(action.helpKey)));
2586
- const params = action.paramsKey ? translate(action.paramsKey) : "";
2587
- if (params) {
2588
- item.appendChild(element(doc, "div", "hive-help-params", translate("help.params") + params));
2589
- }
2590
- if (action.name === "mode" && model && model.writable && model.initialised !== false) {
2591
- const row = element(doc, "div", "hive-help-actionrow");
2592
- const button = element(doc, "button", "hive-btn hive-help-mode-action", translate(action.labelKey));
2593
- setAttr(button, "type", "button");
2594
- setAttr(button, "title", translate(action.helpKey));
2595
- setAttr(button, "aria-label", translate(action.helpKey));
2596
- button.addEventListener("click", () => {
2597
- closeHelp();
2598
- void postAction("mode", action.body || { mode: "freeze", reason: "panel" });
2599
- });
2600
- row.appendChild(button);
2601
- item.appendChild(row);
2602
- }
2603
- body.appendChild(item);
2604
- }
3112
+ if (model && model.writable && model.initialised !== false) {
3113
+ const action = modeAction(model.mode);
3114
+ const row = element(doc, "div", "hive-help-actionrow");
3115
+ const button = element(doc, "button", "hive-btn hive-help-mode-action", translate(action.labelKey));
3116
+ setAttr(button, "type", "button");
3117
+ setAttr(button, "title", translate(action.helpKey));
3118
+ setAttr(button, "aria-label", translate(action.helpKey));
3119
+ button.addEventListener("click", () => {
3120
+ closeHelp();
3121
+ void postAction("mode", action.body || { mode: "freeze", reason: "panel" });
3122
+ });
3123
+ row.appendChild(button);
3124
+ body.appendChild(row);
2605
3125
  }
2606
3126
  body.appendChild(element(doc, "div", "hive-help-section", translate("help.queen")));
2607
3127
  body.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
2608
- body.appendChild(element(doc, "div", "hive-help-hint", translate("help.hint")));
2609
3128
  }
2610
3129
 
2611
3130
  function positionHelp(panel) {
@@ -2852,6 +3371,7 @@ export function mount(root, options = {}) {
2852
3371
  function openPlanDialog(trigger) {
2853
3372
  if (destroyed || !lastModel || !lastModel.writable) return;
2854
3373
  closeHelp(false);
3374
+ closeAddDialog(false);
2855
3375
  closeDrawer();
2856
3376
  planTriggerButton = trigger || planTriggerButton || null;
2857
3377
 
@@ -2978,7 +3498,7 @@ export function mount(root, options = {}) {
2978
3498
  focusNode(goalInput);
2979
3499
  }
2980
3500
 
2981
- // --- bee count settings -------------------------------------------------
3501
+ // --- agent concurrency settings -----------------------------------------
2982
3502
 
2983
3503
  function currentSupervisorRow() {
2984
3504
  if (!lastModel) return null;
@@ -2986,14 +3506,42 @@ export function mount(root, options = {}) {
2986
3506
  }
2987
3507
 
2988
3508
  function roleRowsForCurrentRepo(row) {
2989
- const roles = new Map();
3509
+ const supervisorRoles = new Map();
2990
3510
  if (row && Array.isArray(row.roles)) {
2991
3511
  for (const role of row.roles) {
2992
3512
  if (!isRecord(role)) continue;
2993
3513
  const name = asString(role.role);
2994
- if (name) roles.set(name, { ...role, role: name });
3514
+ if (name) supervisorRoles.set(name, role);
2995
3515
  }
2996
3516
  }
3517
+ const modelRoles = lastModel && lastModel.roles && Array.isArray(lastModel.roles.list) ? lastModel.roles.list : [];
3518
+ if (modelRoles.length > 0) {
3519
+ return modelRoles
3520
+ .map((entry) => {
3521
+ const name = asString(entry.name);
3522
+ if (!name) return null;
3523
+ const savedLimit = lastModel.roles.limits[name];
3524
+ const limit = Number.isFinite(savedLimit)
3525
+ ? savedLimit
3526
+ : Number.isFinite(entry.limit)
3527
+ ? entry.limit
3528
+ : null;
3529
+ const effective = supervisorRoles.get(name);
3530
+ return {
3531
+ role: name,
3532
+ adapter: entry.adapter,
3533
+ model: entry.model,
3534
+ limit,
3535
+ inFlight: effective ? effective.inFlight : null,
3536
+ queued: effective ? effective.queued : null,
3537
+ };
3538
+ })
3539
+ .filter(Boolean)
3540
+ .sort((left, right) => left.role.localeCompare(right.role));
3541
+ }
3542
+
3543
+ const roles = new Map();
3544
+ for (const [name, role] of supervisorRoles) roles.set(name, { ...role, role: name });
2997
3545
  if (roles.size === 0 && lastModel) {
2998
3546
  for (const cards of Object.values(lastModel.lanes)) {
2999
3547
  for (const card of cards) {
@@ -3060,34 +3608,37 @@ export function mount(root, options = {}) {
3060
3608
  }
3061
3609
 
3062
3610
  function openLimitsDialog(trigger) {
3063
- if (destroyed || !lastModel || !lastModel.writable || supervisorData.length === 0) return;
3611
+ if (destroyed || !lastModel) return;
3064
3612
  closeHelp(false);
3065
3613
  closePlanDialog(false);
3614
+ closeAddDialog(false);
3066
3615
  closeDrawer();
3067
3616
  closeToast();
3068
3617
  if (limitsDialogNode) closeLimitsDialog(false);
3069
- limitsTriggerButton = trigger || supervisorLimitsButton;
3618
+ limitsTriggerButton = trigger || settingsButton;
3070
3619
 
3071
3620
  const repo = lastModel.repo || "";
3621
+ const writable = Boolean(lastModel.writable);
3622
+ const supervisorAvailable = supervisorData.length > 0;
3072
3623
  const rows = roleRowsForCurrentRepo(currentSupervisorRow());
3073
3624
  const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim");
3074
3625
  overlay.addEventListener("click", (event) => {
3075
3626
  if (!event || !event.target || event.target === overlay) closeLimitsDialog();
3076
3627
  });
3077
3628
 
3078
- const dialog = element(doc, "div", "hive-dialog");
3629
+ const dialog = element(doc, "div", "hive-dialog hive-settings-dialog");
3079
3630
  setAttr(dialog, "role", "dialog");
3080
3631
  setAttr(dialog, "aria-modal", "true");
3081
- setAttr(dialog, "aria-label", translate("limits.aria"));
3632
+ setAttr(dialog, "aria-label", translate("settings.aria"));
3082
3633
 
3083
3634
  const head = element(doc, "div", "hive-dialog-head");
3084
3635
  const titleBox = element(doc, "div", "hive-dialog-head-title");
3085
- titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("limits.title")));
3636
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("settings.title")));
3086
3637
  head.appendChild(titleBox);
3087
- const closeButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("limits.close"));
3638
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("settings.close"));
3088
3639
  setAttr(closeButton, "type", "button");
3089
- setAttr(closeButton, "title", translate("limits.closeAria"));
3090
- setAttr(closeButton, "aria-label", translate("limits.closeAria"));
3640
+ setAttr(closeButton, "title", translate("settings.closeAria"));
3641
+ setAttr(closeButton, "aria-label", translate("settings.closeAria"));
3091
3642
  closeButton.addEventListener("click", () => {
3092
3643
  closeLimitsDialog();
3093
3644
  });
@@ -3101,11 +3652,97 @@ export function mount(root, options = {}) {
3101
3652
  setAttr(repoPath, "title", repo);
3102
3653
  repoLine.appendChild(repoPath);
3103
3654
  body.appendChild(repoLine);
3104
- body.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3655
+ if (!writable) {
3656
+ body.appendChild(element(doc, "div", "hive-settings-note", translate("settings.readOnly")));
3657
+ }
3105
3658
 
3659
+ const roleSection = element(doc, "section", "hive-settings-section");
3660
+ const roleForm = element(doc, "div", "hive-field-row hive-settings-role-form");
3661
+ const roleNameField = element(doc, "label", "hive-field");
3662
+ roleNameField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleName")));
3663
+ const roleNameInput = element(doc, "input", "hive-input hive-settings-role-name");
3664
+ setAttr(roleNameInput, "type", "text");
3665
+ setAttr(roleNameInput, "autocomplete", "off");
3666
+ setAttr(roleNameInput, "placeholder", translate("settings.roleNameExample"));
3667
+ setAttr(roleNameInput, "aria-label", translate("settings.roleNameAria"));
3668
+ setAttr(roleNameInput, "pattern", "[a-z0-9]+(?:-[a-z0-9]+)*");
3669
+ roleNameField.appendChild(roleNameInput);
3670
+ roleNameField.appendChild(element(doc, "span", "hive-field-hint", translate("settings.roleNameHint")));
3671
+ roleForm.appendChild(roleNameField);
3672
+
3673
+ const adapterField = element(doc, "label", "hive-field is-narrow");
3674
+ adapterField.appendChild(element(doc, "span", "hive-field-label", translate("settings.adapter")));
3675
+ const adapterInput = element(doc, "select", "hive-input hive-settings-role-adapter");
3676
+ setAttr(adapterInput, "aria-label", translate("settings.adapterAria"));
3677
+ for (const adapter of ["dsh", "claude", "codex"]) {
3678
+ const option = element(doc, "option", null, adapter);
3679
+ setAttr(option, "value", adapter);
3680
+ adapterInput.appendChild(option);
3681
+ }
3682
+ adapterInput.value = "dsh";
3683
+ adapterField.appendChild(adapterInput);
3684
+ roleForm.appendChild(adapterField);
3685
+
3686
+ const modelField = element(doc, "label", "hive-field is-narrow");
3687
+ modelField.appendChild(element(doc, "span", "hive-field-label", translate("settings.model")));
3688
+ const modelInput = element(doc, "input", "hive-input hive-settings-role-model");
3689
+ setAttr(modelInput, "type", "text");
3690
+ setAttr(modelInput, "autocomplete", "off");
3691
+ setAttr(modelInput, "placeholder", translate("settings.modelOptional"));
3692
+ setAttr(modelInput, "aria-label", translate("settings.modelAria"));
3693
+ modelField.appendChild(modelInput);
3694
+ roleForm.appendChild(modelField);
3695
+ roleSection.appendChild(roleForm);
3696
+
3697
+ const roleDescriptionField = element(doc, "label", "hive-field hive-settings-role-description");
3698
+ roleDescriptionField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleDescription")));
3699
+ const roleDescriptionInput = element(doc, "textarea", "hive-textarea hive-settings-role-description-input");
3700
+ setAttr(roleDescriptionInput, "maxlength", "2000");
3701
+ setAttr(roleDescriptionInput, "rows", "3");
3702
+ setAttr(roleDescriptionInput, "aria-label", translate("settings.roleDescriptionAria"));
3703
+ roleDescriptionField.appendChild(roleDescriptionInput);
3704
+ roleDescriptionField.appendChild(
3705
+ element(
3706
+ doc,
3707
+ "span",
3708
+ "hive-field-hint",
3709
+ translate("settings.roleDescriptionHint") + " · " + translate("settings.roleDescriptionMax"),
3710
+ ),
3711
+ );
3712
+ roleSection.appendChild(roleDescriptionField);
3713
+
3714
+ const roleErrorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3715
+ roleSection.appendChild(roleErrorNode);
3716
+ const addRoleButton = element(
3717
+ doc,
3718
+ "button",
3719
+ "hive-btn hive-settings-add-role hive-settings-secondary",
3720
+ translate("settings.addRoleButton"),
3721
+ );
3722
+ setAttr(addRoleButton, "type", "button");
3723
+ setAttr(addRoleButton, "title", translate("settings.addRoleAria"));
3724
+ setAttr(addRoleButton, "aria-label", translate("settings.addRoleAria"));
3725
+ addRoleButton.disabled = !writable;
3726
+ addRoleButton.addEventListener("click", () => {
3727
+ void saveRole();
3728
+ });
3729
+ const roleActions = element(doc, "div", "hive-settings-form-actions hive-settings-role-actions");
3730
+ roleActions.appendChild(addRoleButton);
3731
+ roleSection.appendChild(roleActions);
3732
+ if (!writable) {
3733
+ roleNameInput.disabled = true;
3734
+ adapterInput.disabled = true;
3735
+ modelInput.disabled = true;
3736
+ roleDescriptionInput.disabled = true;
3737
+ }
3738
+ const limitsSection = element(doc, "section", "hive-settings-section");
3739
+ limitsSection.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3106
3740
  const rowNodes = [];
3741
+ if (!supervisorAvailable) {
3742
+ limitsSection.appendChild(element(doc, "div", "hive-settings-note", translate("settings.supervisorUnavailable")));
3743
+ }
3107
3744
  if (rows.length === 0) {
3108
- body.appendChild(element(doc, "div", "hive-limits-empty", translate("limits.none")));
3745
+ limitsSection.appendChild(element(doc, "div", "hive-limits-empty", translate("limits.none")));
3109
3746
  } else {
3110
3747
  const table = element(doc, "div", "hive-limits-table");
3111
3748
  const header = element(doc, "div", "hive-limits-row is-head");
@@ -3126,31 +3763,108 @@ export function mount(root, options = {}) {
3126
3763
  setAttr(input, "inputmode", "numeric");
3127
3764
  setAttr(input, "aria-label", translate("limits.limitAria").replace("{role}", role.role));
3128
3765
  input.value = supervisorNumber(role.limit) === null ? "5" : String(supervisorNumber(role.limit));
3766
+ input.disabled = !writable || !supervisorAvailable;
3129
3767
  roleRow.appendChild(input);
3130
3768
  roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.inFlight)));
3131
3769
  roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.queued)));
3132
3770
  table.appendChild(roleRow);
3133
3771
  rowNodes.push({ role: role.role, input });
3134
3772
  }
3135
- body.appendChild(table);
3136
- body.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
3773
+ limitsSection.appendChild(table);
3774
+ limitsSection.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
3137
3775
  }
3138
3776
 
3139
3777
  const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3140
- body.appendChild(errorNode);
3141
- dialog.appendChild(body);
3142
-
3143
- const foot = element(doc, "div", "hive-dialog-foot");
3144
- const saveButton = element(doc, "button", "hive-btn", translate("limits.save"));
3778
+ limitsSection.appendChild(errorNode);
3779
+ const saveButton = element(
3780
+ doc,
3781
+ "button",
3782
+ "hive-btn hive-settings-save hive-settings-primary",
3783
+ translate("settings.saveLimits"),
3784
+ );
3145
3785
  setAttr(saveButton, "type", "button");
3146
3786
  setAttr(saveButton, "title", translate("limits.saveAria").replace("{repo}", repo));
3147
3787
  setAttr(saveButton, "aria-label", translate("limits.saveAria").replace("{repo}", repo));
3148
- saveButton.disabled = rows.length === 0;
3788
+ saveButton.disabled = !writable || !supervisorAvailable || rows.length === 0;
3149
3789
  saveButton.addEventListener("click", () => {
3150
3790
  void saveBeeCounts();
3151
3791
  });
3152
- foot.appendChild(saveButton);
3153
- dialog.appendChild(foot);
3792
+ const limitsActions = element(doc, "div", "hive-settings-form-actions hive-settings-limits-actions");
3793
+ limitsActions.appendChild(saveButton);
3794
+ limitsSection.appendChild(limitsActions);
3795
+
3796
+ const queenSection = element(doc, "section", "hive-settings-section");
3797
+ queenSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("help.queen")));
3798
+ queenSection.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
3799
+ const tabs = element(doc, "div", "hive-settings-tabs");
3800
+ setAttr(tabs, "role", "tablist");
3801
+ setAttr(tabs, "aria-label", translate("settings.tabsAria"));
3802
+ const panelWrap = element(doc, "div", "hive-settings-panels");
3803
+ const tabEntries = [
3804
+ { id: "limits", labelKey: "settings.tabLimits", section: limitsSection },
3805
+ { id: "role", labelKey: "settings.tabRole", section: roleSection },
3806
+ ];
3807
+ const tabNodes = new Map();
3808
+ const panelNodes = new Map();
3809
+
3810
+ function selectSettingsTab(name, focusTab) {
3811
+ const active = name === "role" ? "role" : "limits";
3812
+ settingsActiveTab = active;
3813
+ for (const entry of tabEntries) {
3814
+ const selected = entry.id === active;
3815
+ const tab = tabNodes.get(entry.id);
3816
+ const panel = panelNodes.get(entry.id);
3817
+ setAttr(tab, "aria-selected", selected ? "true" : "false");
3818
+ setAttr(tab, "tabindex", selected ? "0" : "-1");
3819
+ setHidden(panel, !selected);
3820
+ }
3821
+ if (focusTab) focusNode(tabNodes.get(active));
3822
+ }
3823
+
3824
+ function onSettingsTabKeydown(event, current) {
3825
+ if (!event) return;
3826
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight" && event.key !== "Home" && event.key !== "End") {
3827
+ return;
3828
+ }
3829
+ if (typeof event.preventDefault === "function") event.preventDefault();
3830
+ const index = tabEntries.findIndex((entry) => entry.id === current);
3831
+ let next = index;
3832
+ if (event.key === "ArrowLeft") next = index === 0 ? tabEntries.length - 1 : index - 1;
3833
+ else if (event.key === "ArrowRight") next = index === tabEntries.length - 1 ? 0 : index + 1;
3834
+ else if (event.key === "Home") next = 0;
3835
+ else if (event.key === "End") next = tabEntries.length - 1;
3836
+ selectSettingsTab(tabEntries[next].id, true);
3837
+ }
3838
+
3839
+ for (const entry of tabEntries) {
3840
+ const tabId = "hive-settings-tab-" + entry.id;
3841
+ const panelId = "hive-settings-panel-" + entry.id;
3842
+ const tab = element(doc, "button", "hive-settings-tab", translate(entry.labelKey));
3843
+ setAttr(tab, "type", "button");
3844
+ setAttr(tab, "role", "tab");
3845
+ setAttr(tab, "id", tabId);
3846
+ setAttr(tab, "aria-controls", panelId);
3847
+ setAttr(tab, "aria-selected", "false");
3848
+ setAttr(tab, "tabindex", "-1");
3849
+ tab.addEventListener("click", () => selectSettingsTab(entry.id, true));
3850
+ tab.addEventListener("keydown", (event) => onSettingsTabKeydown(event, entry.id));
3851
+ tabs.appendChild(tab);
3852
+ tabNodes.set(entry.id, tab);
3853
+
3854
+ const panel = element(doc, "div", "hive-settings-tabpanel");
3855
+ setAttr(panel, "role", "tabpanel");
3856
+ setAttr(panel, "id", panelId);
3857
+ setAttr(panel, "aria-labelledby", tabId);
3858
+ setHidden(panel, true);
3859
+ panel.appendChild(entry.section);
3860
+ panelWrap.appendChild(panel);
3861
+ panelNodes.set(entry.id, panel);
3862
+ }
3863
+ body.appendChild(tabs);
3864
+ body.appendChild(panelWrap);
3865
+ selectSettingsTab(settingsActiveTab, false);
3866
+ body.appendChild(queenSection);
3867
+ dialog.appendChild(body);
3154
3868
 
3155
3869
  overlay.appendChild(dialog);
3156
3870
  frame.appendChild(overlay);
@@ -3162,17 +3876,105 @@ export function mount(root, options = {}) {
3162
3876
  errorNode,
3163
3877
  saveButton,
3164
3878
  busy: false,
3879
+ writable,
3880
+ supervisorAvailable,
3881
+ roleName: roleNameInput,
3882
+ roleAdapter: adapterInput,
3883
+ roleModel: modelInput,
3884
+ roleDescription: roleDescriptionInput,
3885
+ roleButton: addRoleButton,
3886
+ roleErrorNode,
3887
+ roleBusy: false,
3165
3888
  };
3166
- limitsFocusables = [closeButton, ...rowNodes.map((entry) => entry.input), saveButton];
3889
+ limitsFocusables = [
3890
+ closeButton,
3891
+ roleNameInput,
3892
+ adapterInput,
3893
+ modelInput,
3894
+ roleDescriptionInput,
3895
+ addRoleButton,
3896
+ ...rowNodes.map((entry) => entry.input),
3897
+ saveButton,
3898
+ ];
3167
3899
  if (typeof doc.addEventListener === "function") {
3168
3900
  doc.addEventListener("keydown", onLimitsKeydown);
3169
3901
  }
3170
- focusNode(rowNodes[0] ? rowNodes[0].input : closeButton);
3902
+ focusNode(writable ? roleNameInput : closeButton);
3903
+ }
3904
+
3905
+ function setRoleError(message) {
3906
+ if (!limitsState) return;
3907
+ limitsState.roleErrorNode.textContent = message || "";
3908
+ limitsState.roleErrorNode.className = "hive-limits-error" + (message ? "" : " is-hidden");
3909
+ }
3910
+
3911
+ async function saveRole() {
3912
+ const state = limitsState;
3913
+ if (!state || state.roleBusy || !state.writable) return;
3914
+ const name = String(state.roleName.value === null || state.roleName.value === undefined ? "" : state.roleName.value).trim();
3915
+ if (!/^[a-z][a-z0-9-]{1,31}$/.test(name)) {
3916
+ setRoleError(translate("settings.roleInvalid"));
3917
+ focusNode(state.roleName);
3918
+ return;
3919
+ }
3920
+ const adapter = ["dsh", "claude", "codex"].includes(String(state.roleAdapter.value || "dsh"))
3921
+ ? String(state.roleAdapter.value || "dsh")
3922
+ : "dsh";
3923
+ const model = String(state.roleModel.value === null || state.roleModel.value === undefined ? "" : state.roleModel.value).trim();
3924
+ if (model && !/^[A-Za-z0-9._:-]{1,64}$/.test(model)) {
3925
+ setRoleError(translate("settings.modelInvalid"));
3926
+ focusNode(state.roleModel);
3927
+ return;
3928
+ }
3929
+ const description = String(
3930
+ state.roleDescription.value === null || state.roleDescription.value === undefined ? "" : state.roleDescription.value,
3931
+ ).trim();
3932
+ if (description.length > 2000) {
3933
+ setRoleError(translate("settings.descriptionTooLong"));
3934
+ focusNode(state.roleDescription);
3935
+ return;
3936
+ }
3937
+
3938
+ state.roleBusy = true;
3939
+ state.roleName.disabled = true;
3940
+ state.roleAdapter.disabled = true;
3941
+ state.roleModel.disabled = true;
3942
+ state.roleDescription.disabled = true;
3943
+ state.roleButton.disabled = true;
3944
+ state.roleButton.textContent = translate("settings.addingRole");
3945
+ setRoleError("");
3946
+ try {
3947
+ const body = { name, adapter, description };
3948
+ if (model) body.model = model;
3949
+ const result = await requestAction("roles-add", body);
3950
+ if (!result.ok) {
3951
+ const detail = actionErrorDetail(result.error) || translate("settings.roleFailed");
3952
+ setRoleError(/already exists/i.test(detail) ? translate("settings.roleExists") : detail);
3953
+ return;
3954
+ }
3955
+ await refresh();
3956
+ await refreshSupervisor(true);
3957
+ if (destroyed) return;
3958
+ const trigger = limitsTriggerButton;
3959
+ closeLimitsDialog(false);
3960
+ openLimitsDialog(trigger);
3961
+ showToast("success", translate("settings.roleAdded"), name);
3962
+ } finally {
3963
+ if (!destroyed && limitsState === state) {
3964
+ state.roleBusy = false;
3965
+ state.roleName.disabled = false;
3966
+ state.roleAdapter.disabled = false;
3967
+ state.roleModel.disabled = false;
3968
+ state.roleDescription.disabled = false;
3969
+ state.roleButton.disabled = false;
3970
+ state.roleButton.textContent = translate("settings.addRoleButton");
3971
+ }
3972
+ }
3171
3973
  }
3172
3974
 
3173
3975
  async function saveBeeCounts() {
3174
3976
  const state = limitsState;
3175
- if (!state || state.busy) return;
3977
+ if (!state || state.busy || !state.writable || !state.supervisorAvailable) return;
3176
3978
  const roleLimits = {};
3177
3979
  let invalid = false;
3178
3980
  for (const entry of state.rows) {
@@ -3319,25 +4121,212 @@ export function mount(root, options = {}) {
3319
4121
  if (!destroyed) showToast("success", translate("toast.planWritten"), translate("toast.pickupHint"));
3320
4122
  }
3321
4123
 
4124
+
4125
+ // --- new task dialog -----------------------------------------------------
4126
+
4127
+ function onAddKeydown(event) {
4128
+ if (event && (event.key === "Escape" || event.key === "Esc")) closeAddDialog();
4129
+ }
4130
+
4131
+ function closeAddDialog(restoreFocus = true) {
4132
+ if (addOverlay && addOverlay.parentNode) addOverlay.parentNode.removeChild(addOverlay);
4133
+ addOverlay = null;
4134
+ addDialogNode = null;
4135
+ addState = null;
4136
+ addFocusables = [];
4137
+ if (typeof doc.removeEventListener === "function") {
4138
+ doc.removeEventListener("keydown", onAddKeydown);
4139
+ }
4140
+ if (restoreFocus && !destroyed) focusNode(addTriggerButton);
4141
+ addTriggerButton = null;
4142
+ }
4143
+
4144
+ function setAddError(message) {
4145
+ if (!addState) return;
4146
+ addState.error.textContent = message || "";
4147
+ addState.error.className = message ? "hive-limits-error" : "hive-limits-error is-hidden";
4148
+ }
4149
+
4150
+ function addField(labelKey, input, hintKey) {
4151
+ const field = element(doc, "label", "hive-field");
4152
+ field.appendChild(element(doc, "span", "hive-field-label", translate(labelKey)));
4153
+ field.appendChild(input);
4154
+ if (hintKey) field.appendChild(element(doc, "span", "hive-field-hint", translate(hintKey)));
4155
+ return field;
4156
+ }
4157
+
4158
+ function openAddDialog(trigger) {
4159
+ if (destroyed || !lastModel || !lastModel.writable) return;
4160
+ closeHelp(false);
4161
+ closePlanDialog(false);
4162
+ closeLimitsDialog(false);
4163
+ closeDrawer(false);
4164
+ closeAddDialog(false);
4165
+ addTriggerButton = trigger || null;
4166
+
4167
+ const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim");
4168
+ overlay.addEventListener("click", (event) => {
4169
+ if (!event || !event.target || event.target === overlay) closeAddDialog();
4170
+ });
4171
+
4172
+ const dialog = element(doc, "div", "hive-dialog hive-add-dialog");
4173
+ setAttr(dialog, "role", "dialog");
4174
+ setAttr(dialog, "aria-modal", "true");
4175
+ setAttr(dialog, "aria-label", translate("add.dialogTitle"));
4176
+
4177
+ const head = element(doc, "div", "hive-dialog-head");
4178
+ const titleBox = element(doc, "div", "hive-dialog-head-title");
4179
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("add.dialogTitle")));
4180
+ head.appendChild(titleBox);
4181
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost hive-add-close", "×");
4182
+ setAttr(closeButton, "type", "button");
4183
+ setAttr(closeButton, "title", translate("settings.closeAria"));
4184
+ setAttr(closeButton, "aria-label", translate("settings.closeAria"));
4185
+ closeButton.addEventListener("click", () => {
4186
+ closeAddDialog();
4187
+ });
4188
+ head.appendChild(closeButton);
4189
+ dialog.appendChild(head);
4190
+
4191
+ const body = element(doc, "div", "hive-dialog-body hive-add-body");
4192
+ const titleInput = element(doc, "input", "hive-input hive-add-title");
4193
+ setAttr(titleInput, "type", "text");
4194
+ setAttr(titleInput, "maxlength", "2000");
4195
+ setAttr(titleInput, "autocomplete", "off");
4196
+ setAttr(titleInput, "aria-label", translate("add.titleAria"));
4197
+ body.appendChild(addField("add.title", titleInput));
4198
+
4199
+ const roleInput = element(doc, "input", "hive-input hive-add-role");
4200
+ setAttr(roleInput, "type", "text");
4201
+ setAttr(roleInput, "autocomplete", "off");
4202
+ setAttr(roleInput, "aria-label", translate("add.roleAria"));
4203
+ roleInput.value = "coder";
4204
+ body.appendChild(addField("add.role", roleInput));
4205
+
4206
+ const scopeInput = element(doc, "input", "hive-input hive-add-scope");
4207
+ setAttr(scopeInput, "type", "text");
4208
+ setAttr(scopeInput, "autocomplete", "off");
4209
+ setAttr(scopeInput, "aria-label", translate("add.scopeAria"));
4210
+ body.appendChild(addField("add.scope", scopeInput));
4211
+
4212
+ const afterInput = element(doc, "input", "hive-input hive-add-after");
4213
+ setAttr(afterInput, "type", "text");
4214
+ setAttr(afterInput, "autocomplete", "off");
4215
+ setAttr(afterInput, "aria-label", translate("add.afterAria"));
4216
+ body.appendChild(addField("add.after", afterInput));
4217
+
4218
+ const acceptanceInput = element(doc, "textarea", "hive-textarea hive-add-acceptance");
4219
+ setAttr(acceptanceInput, "maxlength", "2000");
4220
+ setAttr(acceptanceInput, "rows", "3");
4221
+ setAttr(acceptanceInput, "aria-label", translate("add.acceptanceAria"));
4222
+ body.appendChild(addField("add.acceptance", acceptanceInput));
4223
+
4224
+ const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
4225
+ body.appendChild(errorNode);
4226
+ dialog.appendChild(body);
4227
+
4228
+ const foot = element(doc, "div", "hive-dialog-foot");
4229
+ const cancelButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("add.cancel"));
4230
+ setAttr(cancelButton, "type", "button");
4231
+ cancelButton.addEventListener("click", () => {
4232
+ closeAddDialog();
4233
+ });
4234
+ const submitButton = element(doc, "button", "hive-btn hive-add-submit", translate("add.submit"));
4235
+ setAttr(submitButton, "type", "button");
4236
+ submitButton.addEventListener("click", () => {
4237
+ void submitAdd();
4238
+ });
4239
+ foot.appendChild(cancelButton);
4240
+ foot.appendChild(submitButton);
4241
+ dialog.appendChild(foot);
4242
+
4243
+ overlay.appendChild(dialog);
4244
+ frame.appendChild(overlay);
4245
+ addOverlay = overlay;
4246
+ addDialogNode = dialog;
4247
+ addState = {
4248
+ overlay,
4249
+ dialog,
4250
+ title: titleInput,
4251
+ role: roleInput,
4252
+ scope: scopeInput,
4253
+ after: afterInput,
4254
+ acceptance: acceptanceInput,
4255
+ error: errorNode,
4256
+ submit: submitButton,
4257
+ cancel: cancelButton,
4258
+ busy: false,
4259
+ };
4260
+ addFocusables = [closeButton, titleInput, roleInput, scopeInput, afterInput, acceptanceInput, cancelButton, submitButton];
4261
+ if (typeof doc.addEventListener === "function") {
4262
+ doc.addEventListener("keydown", onAddKeydown);
4263
+ }
4264
+ focusNode(titleInput);
4265
+ }
4266
+
4267
+ function setAddBusy(busy) {
4268
+ if (!addState) return;
4269
+ addState.busy = busy;
4270
+ addState.title.disabled = busy;
4271
+ addState.role.disabled = busy;
4272
+ addState.scope.disabled = busy;
4273
+ addState.after.disabled = busy;
4274
+ addState.acceptance.disabled = busy;
4275
+ addState.cancel.disabled = busy;
4276
+ addState.submit.disabled = busy;
4277
+ addState.submit.textContent = busy ? translate("add.submitting") : translate("add.submit");
4278
+ }
4279
+
4280
+ async function submitAdd() {
4281
+ if (!addState || addState.busy) return;
4282
+ const title = String(addState.title.value || "").trim();
4283
+ if (!title) {
4284
+ setAddError(translate("add.required"));
4285
+ focusNode(addState.title);
4286
+ return;
4287
+ }
4288
+ const role = String(addState.role.value || "").trim() || "coder";
4289
+ const body = {
4290
+ title,
4291
+ role,
4292
+ scope: splitList(String(addState.scope.value || "")),
4293
+ after: splitList(String(addState.after.value || "")),
4294
+ acceptance: String(addState.acceptance.value || "").trim(),
4295
+ };
4296
+ setAddError("");
4297
+ setAddBusy(true);
4298
+ const result = await postAction("add", body);
4299
+ if (destroyed || !addState) return;
4300
+ if (result) {
4301
+ closeAddDialog();
4302
+ return;
4303
+ }
4304
+ setAddBusy(false);
4305
+ setAddError(translate("status.actionFailed"));
4306
+ }
4307
+
3322
4308
  // --- drawer --------------------------------------------------------------
3323
4309
 
3324
4310
  function onDrawerKeydown(event) {
3325
4311
  if (event && (event.key === "Escape" || event.key === "Esc")) closeDrawer();
3326
4312
  }
3327
4313
 
3328
- function closeDrawer() {
4314
+ function closeDrawer(restoreFocus = true) {
3329
4315
  if (drawerNode && drawerNode.parentNode) drawerNode.parentNode.removeChild(drawerNode);
3330
4316
  drawerNode = null;
3331
4317
  drawerState = null;
3332
4318
  if (typeof doc.removeEventListener === "function") {
3333
4319
  doc.removeEventListener("keydown", onDrawerKeydown);
3334
4320
  }
4321
+ if (restoreFocus && !destroyed) focusNode(drawerTrigger);
4322
+ drawerTrigger = null;
3335
4323
  }
3336
4324
 
3337
4325
  function mountDrawer(eyebrow, title, ariaLabel) {
3338
4326
  closeHelp(false);
3339
4327
  closePlanDialog(false);
3340
- closeDrawer();
4328
+ closeAddDialog(false);
4329
+ closeDrawer(false);
3341
4330
 
3342
4331
  const panel = element(doc, "aside", "hive-drawer");
3343
4332
  setAttr(panel, "role", "dialog");
@@ -3382,45 +4371,108 @@ export function mount(root, options = {}) {
3382
4371
  body.appendChild(element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2)));
3383
4372
  }
3384
4373
 
3385
- function openDrawer(card, lane) {
4374
+ function openDrawer(card, lane, trigger) {
4375
+ closeHelp(false);
4376
+ closePlanDialog(false);
4377
+ closeAddDialog(false);
4378
+ closeDrawer(false);
4379
+ drawerTrigger = trigger || null;
4380
+
3386
4381
  const raw = findRawTask(card) || { ...card, state: lane };
3387
4382
  const title = card.title || translate("card.untitled");
3388
- const body = mountDrawer(
3389
- laneLabel(lane) + " · " + (card.id || translate("card.noId")),
3390
- title,
3391
- translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled")),
3392
- );
3393
- drawerState = { kind: "card", card, lane };
3394
- const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
4383
+ const id = card.id || translate("card.noId");
4384
+ const role = asString(card.role) || "—";
4385
+ const status = laneLabel(lane);
4386
+ const repo = lastModel ? lastModel.repo : "";
4387
+ const ariaLabel = translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled"));
4388
+
4389
+ const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim hive-card-scrim");
4390
+ overlay.addEventListener("click", (event) => {
4391
+ if (!event || !event.target || event.target === overlay) closeDrawer();
4392
+ });
3395
4393
 
4394
+ const dialog = element(doc, "div", "hive-dialog hive-card-dialog hive-drawer");
4395
+ setAttr(dialog, "role", "dialog");
4396
+ setAttr(dialog, "aria-modal", "true");
4397
+ setAttr(dialog, "aria-label", ariaLabel);
4398
+
4399
+ const head = element(doc, "div", "hive-dialog-head");
4400
+ const titleBox = element(doc, "div", "hive-dialog-head-title");
4401
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", title));
4402
+ const subline = element(doc, "div", "hive-card-subline");
4403
+ const sublineText = [id, role, status, repo].filter(Boolean).join(" · ");
4404
+ subline.textContent = sublineText;
4405
+ setAttr(subline, "title", sublineText);
4406
+ titleBox.appendChild(subline);
4407
+ head.appendChild(titleBox);
4408
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost hive-card-close", "×");
4409
+ setAttr(closeButton, "type", "button");
4410
+ setAttr(closeButton, "title", translate("drawer.closeAria"));
4411
+ setAttr(closeButton, "aria-label", translate("drawer.closeAria"));
4412
+ closeButton.addEventListener("click", () => {
4413
+ closeDrawer();
4414
+ });
4415
+ head.appendChild(closeButton);
4416
+ dialog.appendChild(head);
4417
+
4418
+ const body = element(doc, "div", "hive-dialog-body hive-card-body");
4419
+ const details = element(doc, "details", "hive-card-json");
4420
+ const summary = element(doc, "summary", "hive-card-json-summary", translate("drawer.rawJson"));
4421
+ const pre = element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2));
4422
+ details.appendChild(summary);
4423
+ details.appendChild(pre);
4424
+ body.appendChild(details);
4425
+ dialog.appendChild(body);
4426
+
4427
+ const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
4428
+ if (actions.length === 0) {
4429
+ body.appendChild(
4430
+ element(
4431
+ doc,
4432
+ "div",
4433
+ "hive-note",
4434
+ lastModel && lastModel.writable ? translate("drawer.noActions") : translate("drawer.readOnly"),
4435
+ ),
4436
+ );
4437
+ }
3396
4438
  if (actions.length > 0) {
3397
- const actionRow = element(doc, "div", "hive-actions-row");
3398
- setAttr(actionRow, "aria-label", translate("drawer.cardActions"));
4439
+ const foot = element(doc, "div", "hive-dialog-foot hive-card-actions");
4440
+ setAttr(foot, "aria-label", translate("drawer.cardActions"));
4441
+ const claimed = asString(card.state || lane) === "claimed";
3399
4442
  for (const action of actions) {
3400
- const button = element(doc, "button", "hive-btn", translate(action.labelKey));
4443
+ const destructive = action.name === "remove";
4444
+ const button = element(
4445
+ doc,
4446
+ "button",
4447
+ "hive-btn" + (destructive ? " hive-btn-danger" : ""),
4448
+ translate(action.labelKey),
4449
+ );
3401
4450
  setAttr(button, "type", "button");
3402
- setAttr(button, "title", translate(action.helpKey));
3403
- setAttr(button, "aria-label", translate(action.helpKey));
4451
+ // The panel never sends --force, so a claimed card's delete control is
4452
+ // rendered but disabled, with the release/reopen reason in its title.
4453
+ const hint = destructive && claimed ? translate("drawer.removeClaimed") : translate(action.helpKey);
4454
+ setAttr(button, "title", hint);
4455
+ setAttr(button, "aria-label", hint);
4456
+ if (destructive && claimed) {
4457
+ button.disabled = true;
4458
+ setAttr(button, "aria-disabled", "true");
4459
+ }
3404
4460
  button.addEventListener("click", () => {
3405
4461
  void runCardAction(action.name, card, lane);
3406
4462
  });
3407
- actionRow.appendChild(button);
4463
+ foot.appendChild(button);
3408
4464
  }
3409
- body.appendChild(actionRow);
3410
- } else {
3411
- const note = element(
3412
- doc,
3413
- "div",
3414
- "hive-note",
3415
- lastModel && lastModel.writable ? translate("drawer.noActions") : translate("drawer.readOnly"),
3416
- );
3417
- body.appendChild(note);
4465
+ dialog.appendChild(foot);
3418
4466
  }
3419
4467
 
3420
- const label = element(doc, "div", "hive-section-label", translate("drawer.rawJson"));
3421
- body.appendChild(label);
3422
- const pre = element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2));
3423
- body.appendChild(pre);
4468
+ overlay.appendChild(dialog);
4469
+ frame.appendChild(overlay);
4470
+ drawerNode = overlay;
4471
+ drawerState = { kind: "card", card, lane };
4472
+ if (typeof doc.addEventListener === "function") {
4473
+ doc.addEventListener("keydown", onDrawerKeydown);
4474
+ }
4475
+ focusNode(closeButton);
3424
4476
  }
3425
4477
 
3426
4478
  // --- actions -------------------------------------------------------------
@@ -3569,34 +4621,12 @@ export function mount(root, options = {}) {
3569
4621
  case "mode":
3570
4622
  await postAction("mode", action.body || { mode: "free", reason: "panel" });
3571
4623
  break;
3572
- case "add": {
3573
- const title = ask(translate("prompt.newTitle"), "");
3574
- if (title === null || !title.trim()) return;
3575
- const role = ask(translate("prompt.role"), "coder");
3576
- if (role === null) return;
3577
- const scope = ask(translate("prompt.scope"), "");
3578
- if (scope === null) return;
3579
- const after = ask(translate("prompt.after"), "");
3580
- if (after === null) return;
3581
- await postAction("add", {
3582
- title: title.trim(),
3583
- role: role.trim() || "coder",
3584
- scope: splitList(scope),
3585
- after: splitList(after),
3586
- });
4624
+ case "add":
4625
+ openAddDialog(triggerButton);
3587
4626
  break;
3588
- }
3589
4627
  case "plan":
3590
4628
  openPlanDialog(triggerButton);
3591
4629
  break;
3592
- case "commit": {
3593
- const message = ask(translate("prompt.commitMessage"), "panel commit");
3594
- if (message === null) return;
3595
- const paths = ask(translate("prompt.paths"), "");
3596
- if (paths === null) return;
3597
- await postAction("commit", { message: message.trim() || "panel commit", set: splitList(paths) });
3598
- break;
3599
- }
3600
4630
  default:
3601
4631
  break;
3602
4632
  }
@@ -3629,10 +4659,18 @@ export function mount(root, options = {}) {
3629
4659
  case "retry":
3630
4660
  ok = await postAction("retry", { id: card.id });
3631
4661
  break;
4662
+ case "remove": {
4663
+ const name = card.title || card.id || translate("card.untitled");
4664
+ const message = translate("confirm.remove").replace("{title}", name);
4665
+ if (!askConfirm(message)) return;
4666
+ ok = await postAction("remove", { id: card.id });
4667
+ break;
4668
+ }
3632
4669
  default:
3633
4670
  break;
3634
4671
  }
3635
4672
  if (ok && !destroyed) {
4673
+ if (name === "remove") showToast("success", translate("toast.taskRemoved"), "");
3636
4674
  closeDrawer();
3637
4675
  void refresh();
3638
4676
  }
@@ -3781,10 +4819,9 @@ export function mount(root, options = {}) {
3781
4819
  renderSupervisorContent();
3782
4820
  } catch {
3783
4821
  supervisorData = [];
4822
+ supervisorInlineRow = null;
3784
4823
  try {
3785
- supervisorBar.className = "hive-supervisor is-hidden";
3786
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden";
3787
- if (limitsDialogNode) closeLimitsDialog(false);
4824
+ supervisorInline.className = "hive-supervisor-inline is-hidden";
3788
4825
  } catch {
3789
4826
  // Supervisor rendering is optional; never let it break the panel.
3790
4827
  }
@@ -3792,53 +4829,38 @@ export function mount(root, options = {}) {
3792
4829
  }
3793
4830
 
3794
4831
  function renderSupervisorContent() {
3795
- clearNode(supervisorRepos);
3796
- supervisorLabel.textContent = translate("supervisor.label");
3797
- setAttr(supervisorBar, "aria-label", translate("supervisor.aria"));
3798
- if (!Array.isArray(supervisorData) || supervisorData.length === 0) {
3799
- supervisorBar.className = "hive-supervisor is-hidden";
3800
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden";
3801
- if (limitsDialogNode) closeLimitsDialog(false);
3802
- return;
3803
- }
3804
- supervisorBar.className = "hive-supervisor";
3805
- const canConfigure = Boolean(lastModel && lastModel.writable);
3806
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits" + (canConfigure ? "" : " is-hidden");
3807
- supervisorLimitsButton.textContent = translate("limits.open");
3808
- setAttr(supervisorLimitsButton, "title", translate("limits.openAria"));
3809
- setAttr(supervisorLimitsButton, "aria-label", translate("limits.openAria"));
3810
- if (!canConfigure && limitsDialogNode) closeLimitsDialog(false);
3811
- for (const row of supervisorData) {
3812
- const item = element(doc, "span", "hive-supervisor-item");
3813
- const path = element(doc, "code", "hive-supervisor-path", row.repo);
3814
- setAttr(path, "title", row.repo);
3815
- item.appendChild(path);
3816
-
3817
- let stateLabel = translate("supervisor.idle");
3818
- if (row.state === "running") {
3819
- stateLabel =
3820
- row.running === null || row.running === undefined
3821
- ? translate("supervisor.running")
3822
- : translate("supervisor.runningCount").replace("{count}", String(row.running));
3823
- } else if (row.state === "backoff") {
3824
- stateLabel = translate("supervisor.backoff");
3825
- } else if (row.state === "paused") {
3826
- stateLabel = translate("supervisor.paused");
3827
- }
3828
- item.appendChild(element(doc, "span", "hive-supervisor-state is-" + row.state, stateLabel));
4832
+ supervisorInlineRow = null;
4833
+ supervisorInline.className = "hive-supervisor-inline is-hidden";
4834
+ supervisorInlineState.className = "hive-supervisor-inline-state";
4835
+ supervisorInlineState.textContent = "";
4836
+ supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume is-hidden";
4837
+ setAttr(supervisorInline, "aria-label", translate("supervisor.aria"));
4838
+ supervisorInlineLabel.textContent = translate("supervisor.label");
4839
+ if (!lastModel || !Array.isArray(supervisorData) || supervisorData.length === 0) return;
4840
+ const row = supervisorData.find((entry) => entry.repo === lastModel.repo);
4841
+ if (!row) return;
3829
4842
 
3830
- if (row.state === "paused") {
3831
- const button = element(doc, "button", "hive-btn hive-supervisor-resume", translate("supervisor.resume"));
3832
- setAttr(button, "type", "button");
3833
- const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
3834
- setAttr(button, "title", aria);
3835
- setAttr(button, "aria-label", aria);
3836
- button.addEventListener("click", () => {
3837
- void resumeSupervisor(row, button);
3838
- });
3839
- item.appendChild(button);
3840
- }
3841
- supervisorRepos.appendChild(item);
4843
+ supervisorInlineRow = row;
4844
+ supervisorInline.className = "hive-supervisor-inline";
4845
+ let stateLabel = translate("supervisor.idle");
4846
+ if (row.state === "running") {
4847
+ stateLabel =
4848
+ row.running === null || row.running === undefined
4849
+ ? translate("supervisor.running")
4850
+ : translate("supervisor.runningCount").replace("{count}", String(row.running));
4851
+ } else if (row.state === "backoff") {
4852
+ stateLabel = translate("supervisor.backoff");
4853
+ } else if (row.state === "paused") {
4854
+ stateLabel = translate("supervisor.paused");
4855
+ }
4856
+ supervisorInlineState.className = "hive-supervisor-inline-state is-" + row.state;
4857
+ supervisorInlineState.textContent = stateLabel;
4858
+
4859
+ if (row.state === "paused") {
4860
+ const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
4861
+ supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume";
4862
+ setAttr(supervisorInlineResume, "title", aria);
4863
+ setAttr(supervisorInlineResume, "aria-label", aria);
3842
4864
  }
3843
4865
  }
3844
4866
 
@@ -4076,11 +5098,11 @@ export function mount(root, options = {}) {
4076
5098
  foot.appendChild(element(doc, "span", "hive-card-state", laneLabel(lane)));
4077
5099
  node.appendChild(foot);
4078
5100
 
4079
- node.addEventListener("click", () => openDrawer(card, lane));
5101
+ node.addEventListener("click", () => openDrawer(card, lane, node));
4080
5102
  node.addEventListener("keydown", (event) => {
4081
5103
  if (!event || (event.key !== "Enter" && event.key !== " ")) return;
4082
5104
  if (typeof event.preventDefault === "function") event.preventDefault();
4083
- openDrawer(card, lane);
5105
+ openDrawer(card, lane, node);
4084
5106
  });
4085
5107
  return node;
4086
5108
  }
@@ -4206,8 +5228,6 @@ export function mount(root, options = {}) {
4206
5228
  function render(model) {
4207
5229
  repoNode.textContent = model.repo || "—";
4208
5230
  setAttr(repoNode, "title", model.repo);
4209
- timeNode.textContent = model.at ? formatStamp(model.at) : "—";
4210
- setAttr(timeNode, "datetime", model.at);
4211
5231
 
4212
5232
  renderInit(model);
4213
5233
  renderQueenHint(model);
@@ -4230,6 +5250,7 @@ export function mount(root, options = {}) {
4230
5250
  if (helpWasOpen) closeHelp(false);
4231
5251
  if (planDialogNode) closePlanDialog(false);
4232
5252
  if (limitsDialogNode) closeLimitsDialog(false);
5253
+ if (addDialogNode) closeAddDialog(false);
4233
5254
  try {
4234
5255
  applyChrome();
4235
5256
  if (lastModel) render(lastModel);
@@ -4354,6 +5375,7 @@ export function mount(root, options = {}) {
4354
5375
  closeHelp(false);
4355
5376
  closePlanDialog(false);
4356
5377
  closeLimitsDialog(false);
5378
+ closeAddDialog(false);
4357
5379
  closeToast();
4358
5380
  closeDrawer();
4359
5381
  if (frame.parentNode) frame.parentNode.removeChild(frame);