dsh-hive-panel 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -41,23 +41,26 @@ const QUEEN_DISMISS_KEY = "hive.queenNoticeDismissed";
41
41
  const DEFAULT_INTERVAL_MS = 3000;
42
42
 
43
43
  const CARD_ACTIONS = Object.freeze({
44
- pending: Object.freeze(["claim"]),
45
- claimed: Object.freeze(["done", "fail"]),
46
- done: Object.freeze([]),
47
- blocked: Object.freeze(["retry"]),
48
- failed: Object.freeze(["retry"]),
44
+ // remove is available in every stored state; the drawer renders it as a
45
+ // danger button, disabled with an explanation while the card is claimed
46
+ // (the panel never sends --force, so the CLI would refuse).
47
+ pending: Object.freeze(["claim", "remove"]),
48
+ claimed: Object.freeze(["done", "fail", "remove"]),
49
+ done: Object.freeze(["remove"]),
50
+ blocked: Object.freeze(["retry", "remove"]),
51
+ failed: Object.freeze(["retry", "remove"]),
49
52
  });
50
53
 
51
54
  const ACTION_META = Object.freeze({
52
- freeze: { labelKey: "action.freeze", helpKey: "help.action.freeze", paramsKey: "help.params.mode" },
53
- unfreeze: { labelKey: "action.unfreeze", helpKey: "help.action.unfreeze", paramsKey: "help.params.mode" },
54
- add: { labelKey: "action.add", helpKey: "help.action.add", paramsKey: "help.params.add" },
55
- plan: { labelKey: "action.plan", helpKey: "help.action.plan", paramsKey: "help.params.plan" },
56
- commit: { labelKey: "action.commit", helpKey: "help.action.commit", paramsKey: "help.params.commit" },
57
- claim: { labelKey: "action.claim", helpKey: "help.action.claim", paramsKey: "help.params.claim" },
58
- done: { labelKey: "action.done", helpKey: "help.action.done", paramsKey: "help.params.done" },
59
- fail: { labelKey: "action.fail", helpKey: "help.action.fail", paramsKey: "help.params.fail" },
60
- retry: { labelKey: "action.retry", helpKey: "help.action.retry", paramsKey: "help.params.retry" },
55
+ freeze: { labelKey: "action.freeze", helpKey: "help.action.freeze" },
56
+ unfreeze: { labelKey: "action.unfreeze", helpKey: "help.action.unfreeze" },
57
+ add: { labelKey: "action.add", helpKey: "help.action.add" },
58
+ plan: { labelKey: "action.plan", helpKey: "help.action.plan" },
59
+ claim: { labelKey: "action.claim", helpKey: "help.action.claim" },
60
+ done: { labelKey: "action.done", helpKey: "help.action.done" },
61
+ fail: { labelKey: "action.fail", helpKey: "help.action.fail" },
62
+ retry: { labelKey: "action.retry", helpKey: "help.action.retry" },
63
+ remove: { labelKey: "action.remove", helpKey: "help.action.remove" },
61
64
  });
62
65
 
63
66
  const MIN_PLAN_CARDS = 1;
@@ -130,6 +133,23 @@ const PANEL_STYLES = `.hive { position: relative; }
130
133
  font-weight: 700;
131
134
  }
132
135
 
136
+ /* Destructive card action: the drawer's delete control. */
137
+ .hive-btn-danger {
138
+ border-color: color-mix(in srgb, var(--hive-danger) 55%, var(--hive-line, #232b38));
139
+ background: color-mix(in srgb, var(--hive-danger) 12%, transparent);
140
+ color: color-mix(in srgb, var(--hive-danger) 88%, var(--hive-fg, #e6edf3));
141
+ }
142
+
143
+ .hive-btn-danger:hover:not(:disabled) {
144
+ border-color: color-mix(in srgb, var(--hive-danger) 75%, var(--hive-line, #232b38));
145
+ background: color-mix(in srgb, var(--hive-danger) 22%, transparent);
146
+ }
147
+
148
+ .hive-btn-danger:disabled {
149
+ opacity: 0.5;
150
+ cursor: not-allowed;
151
+ }
152
+
133
153
  .hive-overlay { position: absolute; inset: 0; z-index: 2147483000; }
134
154
  .hive-help-scrim { background: transparent; }
135
155
  .hive-dialog-scrim {
@@ -137,7 +157,9 @@ const PANEL_STYLES = `.hive { position: relative; }
137
157
  align-items: center;
138
158
  justify-content: center;
139
159
  padding: 12px;
140
- background: rgb(0 0 0 / 45%);
160
+ background: transparent;
161
+ backdrop-filter: none;
162
+ -webkit-backdrop-filter: none;
141
163
  }
142
164
 
143
165
  .hive-help {
@@ -938,7 +960,7 @@ const PANEL_STYLES = `.hive { position: relative; }
938
960
 
939
961
  .hive-limits-row {
940
962
  display: grid;
941
- grid-template-columns: minmax(0, 1fr) 72px 48px 48px;
963
+ grid-template-columns: minmax(0, 1fr) 96px 48px 48px;
942
964
  align-items: center;
943
965
  gap: 6px;
944
966
  min-width: 0;
@@ -1034,6 +1056,95 @@ const PANEL_STYLES = `.hive { position: relative; }
1034
1056
  overflow-wrap: anywhere;
1035
1057
  }
1036
1058
 
1059
+ .hive-supervisor-inline {
1060
+ display: inline-flex;
1061
+ flex-wrap: wrap;
1062
+ align-items: center;
1063
+ gap: 5px;
1064
+ min-width: 0;
1065
+ padding: 1px 8px;
1066
+ border: 1px solid var(--hive-line, #232b38);
1067
+ border-radius: 999px;
1068
+ background: var(--hive-surface);
1069
+ color: var(--hive-fg-soft);
1070
+ font-size: 10px;
1071
+ line-height: 1.6;
1072
+ }
1073
+
1074
+ .hive-supervisor-inline.is-hidden { display: none; }
1075
+
1076
+ .hive-supervisor-inline-label {
1077
+ color: var(--hive-fg-faint);
1078
+ font-size: 9.5px;
1079
+ font-weight: 650;
1080
+ letter-spacing: 0.1em;
1081
+ text-transform: uppercase;
1082
+ }
1083
+
1084
+ .hive-supervisor-inline-state {
1085
+ color: var(--hive-fg-soft);
1086
+ font-weight: 600;
1087
+ white-space: nowrap;
1088
+ }
1089
+
1090
+ .hive-supervisor-inline-state.is-running { color: var(--hive-ok); }
1091
+ .hive-supervisor-inline-state.is-idle { color: var(--hive-fg-soft); }
1092
+ .hive-supervisor-inline-state.is-backoff { color: var(--hive-warn); }
1093
+ .hive-supervisor-inline-state.is-paused { color: var(--hive-danger); }
1094
+
1095
+ .hive-supervisor-inline-resume {
1096
+ padding: 1px 6px;
1097
+ font-size: 9.5px;
1098
+ line-height: 1.3;
1099
+ }
1100
+
1101
+ .hive-supervisor-inline-resume.is-hidden { display: none; }
1102
+
1103
+ .hive-settings-trigger {
1104
+ flex: 0 0 auto;
1105
+ min-width: 28px;
1106
+ padding-inline: 8px;
1107
+ font-size: 14px;
1108
+ line-height: 1.2;
1109
+ }
1110
+
1111
+ .hive-settings-section {
1112
+ display: flex;
1113
+ flex-direction: column;
1114
+ gap: 8px;
1115
+ min-width: 0;
1116
+ padding-top: 12px;
1117
+ border-top: 1px solid color-mix(in srgb, var(--hive-line, #232b38) 70%, transparent);
1118
+ }
1119
+
1120
+ .hive-settings-section:first-of-type { padding-top: 0; border-top: 0; }
1121
+
1122
+ .hive-settings-section-title {
1123
+ color: var(--hive-fg, #e6edf3);
1124
+ font-size: 11px;
1125
+ font-weight: 650;
1126
+ letter-spacing: 0.08em;
1127
+ text-transform: uppercase;
1128
+ }
1129
+
1130
+ .hive-settings-role-form { align-items: flex-end; }
1131
+
1132
+ .hive-settings-role-description { width: 100%; }
1133
+
1134
+ .hive-settings-role-description .hive-textarea { width: 100%; }
1135
+
1136
+ .hive-settings-role-form .hive-field:first-child { flex: 1 1 200px; }
1137
+
1138
+ .hive-settings-note {
1139
+ padding: 8px 10px;
1140
+ border: 1px solid color-mix(in srgb, var(--hive-warn) 38%, var(--hive-line, #232b38));
1141
+ border-radius: 6px;
1142
+ background: color-mix(in srgb, var(--hive-warn) 9%, transparent);
1143
+ color: var(--hive-warn);
1144
+ font-size: 10.5px;
1145
+ line-height: 1.55;
1146
+ }
1147
+
1037
1148
  /* -------------------------------------------------------------------- spacing */
1038
1149
  .hive {
1039
1150
  gap: 8px;
@@ -1107,6 +1218,46 @@ const PANEL_STYLES = `.hive { position: relative; }
1107
1218
  line-height: 1.55;
1108
1219
  }
1109
1220
 
1221
+ .hive-icon-button {
1222
+ display: inline-flex;
1223
+ flex: 0 0 28px;
1224
+ align-items: center;
1225
+ justify-content: center;
1226
+ width: 28px;
1227
+ min-width: 28px;
1228
+ height: 28px;
1229
+ padding: 0;
1230
+ border: 0;
1231
+ border-color: transparent;
1232
+ background: transparent;
1233
+ color: color-mix(in srgb, var(--hive-fg, #e6edf3) 80%, transparent);
1234
+ font-size: 0;
1235
+ line-height: 1;
1236
+ box-shadow: none;
1237
+ cursor: pointer;
1238
+ }
1239
+
1240
+ .hive-icon-button:hover {
1241
+ border: 0;
1242
+ border-color: transparent;
1243
+ background: transparent;
1244
+ color: var(--hive-fg, #e6edf3);
1245
+ }
1246
+
1247
+ .hive-icon-button:active { transform: none; }
1248
+
1249
+ .hive-icon-button:focus-visible {
1250
+ outline: 2px solid var(--hive-accent, #58c4dc);
1251
+ outline-offset: 1px;
1252
+ }
1253
+
1254
+ .hive-icon-button svg {
1255
+ display: block;
1256
+ width: 16px;
1257
+ height: 16px;
1258
+ pointer-events: none;
1259
+ }
1260
+
1110
1261
  @media (max-width: 520px) {
1111
1262
  .hive { gap: 6px; padding: 12px; }
1112
1263
  .hive-bar,
@@ -1131,7 +1282,222 @@ const PANEL_STYLES = `.hive { position: relative; }
1131
1282
  .hive-dialog-foot .hive-btn { flex: 1 1 auto; }
1132
1283
  .hive-help { right: 8px; width: calc(100% - 16px); max-height: 66vh; }
1133
1284
  .hive-toast { right: 8px; bottom: 8px; width: calc(100% - 16px); }
1134
- }`;
1285
+ }
1286
+
1287
+
1288
+ .hive-settings-dialog { max-height: 80vh; }
1289
+
1290
+ .hive-settings-dialog .hive-dialog-body { overflow: auto; }
1291
+
1292
+ .hive-settings-tabs {
1293
+ display: flex;
1294
+ align-items: center;
1295
+ gap: 4px;
1296
+ border-bottom: 1px solid var(--hive-line, #232b38);
1297
+ }
1298
+
1299
+ .hive-settings-tab {
1300
+ flex: 0 0 auto;
1301
+ padding: 7px 10px 8px;
1302
+ border: 0;
1303
+ border-bottom: 2px solid transparent;
1304
+ background: transparent;
1305
+ color: var(--hive-fg-soft);
1306
+ font-size: 11.5px;
1307
+ line-height: 1.3;
1308
+ cursor: pointer;
1309
+ }
1310
+
1311
+ .hive-settings-tab:hover { color: var(--hive-fg, #e6edf3); }
1312
+
1313
+ .hive-settings-tab[aria-selected="true"] {
1314
+ border-bottom-color: var(--hive-accent, #58c4dc);
1315
+ color: var(--hive-fg, #e6edf3);
1316
+ }
1317
+
1318
+ .hive-settings-tab:focus-visible {
1319
+ outline: 2px solid var(--hive-accent, #58c4dc);
1320
+ outline-offset: -2px;
1321
+ }
1322
+
1323
+ .hive-settings-tabpanel[hidden] { display: none; }
1324
+
1325
+ .hive-settings-tabpanel .hive-settings-section {
1326
+ padding-top: 0;
1327
+ border-top: 0;
1328
+ }
1329
+
1330
+ .hive-settings-form-actions {
1331
+ display: flex;
1332
+ align-items: center;
1333
+ justify-content: flex-end;
1334
+ gap: 8px;
1335
+ width: 100%;
1336
+ margin-top: 2px;
1337
+ }
1338
+
1339
+ .hive-settings-form-actions .hive-btn {
1340
+ display: inline-flex;
1341
+ flex: 0 0 auto;
1342
+ align-items: center;
1343
+ justify-content: center;
1344
+ height: 28px;
1345
+ min-height: 28px;
1346
+ padding: 0 14px;
1347
+ border-radius: 7px;
1348
+ font-size: 11.5px;
1349
+ line-height: 1;
1350
+ }
1351
+
1352
+ .hive-settings-form-actions .hive-btn:disabled {
1353
+ opacity: 0.55;
1354
+ cursor: not-allowed;
1355
+ }
1356
+
1357
+ .hive-settings-primary {
1358
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1359
+ background: var(--hive-accent, #58c4dc);
1360
+ color: var(--hive-bg, #0b0f17);
1361
+ }
1362
+
1363
+ .hive-settings-primary:hover {
1364
+ border-color: var(--hive-accent, #58c4dc);
1365
+ background: color-mix(in srgb, var(--hive-accent, #58c4dc) 86%, white);
1366
+ color: var(--hive-bg, #0b0f17);
1367
+ }
1368
+
1369
+ .hive-settings-secondary {
1370
+ border-color: var(--hive-line, #232b38);
1371
+ background: var(--hive-surface-strong);
1372
+ color: var(--hive-fg, #e6edf3);
1373
+ }
1374
+
1375
+ .hive-settings-secondary:hover {
1376
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 40%, var(--hive-line, #232b38));
1377
+ background: var(--hive-surface-hover);
1378
+ color: var(--hive-fg, #e6edf3);
1379
+ }
1380
+
1381
+ .hive-settings-form-actions .hive-btn:disabled {
1382
+ opacity: 0.55;
1383
+ cursor: not-allowed;
1384
+ }
1385
+
1386
+ .hive-card-scrim { padding: 12px; }
1387
+
1388
+ .hive-card-dialog {
1389
+ position: relative;
1390
+ inset: auto;
1391
+ width: min(720px, 92vw);
1392
+ max-width: 92vw;
1393
+ height: auto;
1394
+ max-height: 80vh;
1395
+ border: 1px solid var(--hive-line, #232b38);
1396
+ border-radius: 12px;
1397
+ background: color-mix(in srgb, var(--hive-bg, #0b0f17) 97%, var(--hive-fg, #e6edf3) 3%);
1398
+ box-shadow: 0 24px 70px rgb(0 0 0 / 52%);
1399
+ overflow: hidden;
1400
+ }
1401
+
1402
+ .hive-card-dialog .hive-dialog-head { align-items: flex-start; }
1403
+
1404
+ .hive-card-subline {
1405
+ margin-top: 3px;
1406
+ overflow-wrap: anywhere;
1407
+ color: var(--hive-fg-soft);
1408
+ font-family: var(--hive-mono);
1409
+ font-size: 10.5px;
1410
+ line-height: 1.5;
1411
+ }
1412
+
1413
+ .hive-card-close {
1414
+ min-width: 28px;
1415
+ height: 28px;
1416
+ padding: 0 6px;
1417
+ color: var(--hive-fg-soft);
1418
+ font-size: 18px;
1419
+ line-height: 1;
1420
+ }
1421
+
1422
+ .hive-card-body {
1423
+ display: flex;
1424
+ flex-direction: column;
1425
+ gap: 12px;
1426
+ min-height: 0;
1427
+ overflow: auto;
1428
+ }
1429
+
1430
+ .hive-card-json {
1431
+ border: 1px solid var(--hive-line, #232b38);
1432
+ border-radius: 8px;
1433
+ background: var(--hive-surface);
1434
+ overflow: hidden;
1435
+ }
1436
+
1437
+ .hive-card-json-summary {
1438
+ padding: 8px 10px;
1439
+ color: var(--hive-fg-soft);
1440
+ font-size: 10px;
1441
+ font-weight: 650;
1442
+ letter-spacing: 0.08em;
1443
+ line-height: 1.5;
1444
+ text-transform: uppercase;
1445
+ cursor: pointer;
1446
+ user-select: none;
1447
+ }
1448
+
1449
+ .hive-card-json .hive-json {
1450
+ max-height: 300px;
1451
+ margin: 0;
1452
+ padding: 10px;
1453
+ overflow: auto;
1454
+ border-top: 1px solid var(--hive-line, #232b38);
1455
+ font-family: var(--hive-mono);
1456
+ font-size: 10.5px;
1457
+ line-height: 1.5;
1458
+ white-space: pre-wrap;
1459
+ }
1460
+
1461
+ .hive-card-actions {
1462
+ justify-content: flex-end;
1463
+ gap: 8px;
1464
+ flex-wrap: wrap;
1465
+ }
1466
+
1467
+ .hive-add-dialog {
1468
+ width: min(560px, 92vw);
1469
+ max-width: 92vw;
1470
+ max-height: 80vh;
1471
+ }
1472
+
1473
+ .hive-add-body {
1474
+ display: flex;
1475
+ flex-direction: column;
1476
+ gap: 10px;
1477
+ min-height: 0;
1478
+ overflow: auto;
1479
+ }
1480
+
1481
+ .hive-add-body .hive-field { width: 100%; }
1482
+
1483
+ .hive-add-body .hive-input,
1484
+ .hive-add-body .hive-textarea { width: 100%; }
1485
+
1486
+ .hive-add-acceptance { min-height: 70px; }
1487
+
1488
+ .hive-add-submit {
1489
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1490
+ background: var(--hive-accent, #58c4dc);
1491
+ color: var(--hive-bg, #0b0f17);
1492
+ }
1493
+
1494
+ .hive-add-submit:hover:not(:disabled) {
1495
+ border-color: var(--hive-accent, #58c4dc);
1496
+ background: color-mix(in srgb, var(--hive-accent, #58c4dc) 86%, white);
1497
+ color: var(--hive-bg, #0b0f17);
1498
+ }
1499
+
1500
+ `;
1135
1501
 
1136
1502
  const LANE_LABEL_KEYS = Object.freeze({
1137
1503
  pending: "lane.pending",
@@ -1152,13 +1518,13 @@ const messages = Object.freeze({
1152
1518
  "actions.aria": "board actions",
1153
1519
  "action.add": "New task",
1154
1520
  "action.claim": "claim",
1155
- "action.commit": "commit",
1156
1521
  "action.done": "done",
1157
1522
  "action.fail": "fail",
1158
- "action.freeze": "freeze",
1523
+ "action.freeze": "Pause",
1159
1524
  "action.modeTitle": "Toggle board mode",
1525
+ "action.remove": "Delete task",
1160
1526
  "action.retry": "retry",
1161
- "action.unfreeze": "unfreeze",
1527
+ "action.unfreeze": "Resume",
1162
1528
  "pane.agents": "agents",
1163
1529
  "pane.board": "board",
1164
1530
  "pane.events": "events",
@@ -1177,7 +1543,7 @@ const messages = Object.freeze({
1177
1543
  "mode.freeze": "freeze",
1178
1544
  "mode.free.help": "Free: anyone can claim tasks.",
1179
1545
  "mode.freeze.help": "Freeze: only tasks tagged fix can be claimed; use this while the pipeline is red.",
1180
- "mode.freeze.banner": "Frozen: only tasks tagged fix can be claimed.",
1546
+ "mode.freeze.banner": "Paused: only tasks tagged fix can be claimed.",
1181
1547
  "mode.title": "mode:",
1182
1548
  "stats.cards": "tasks",
1183
1549
  "stats.oldest": "oldest",
@@ -1208,6 +1574,7 @@ const messages = Object.freeze({
1208
1574
  "drawer.cardActions": "task actions",
1209
1575
  "drawer.noActions": "No actions for this state.",
1210
1576
  "drawer.readOnly": "Read-only: writable=false.",
1577
+ "drawer.removeClaimed": "A claimed task must be released or reopened before it can be deleted.",
1211
1578
  "drawer.rawJson": "raw json",
1212
1579
  "events.empty": "No events yet.",
1213
1580
  "events.showAll": "Show all events",
@@ -1223,45 +1590,88 @@ const messages = Object.freeze({
1223
1590
  "supervisor.resumeAria": "Resume the supervisor for {repo}",
1224
1591
  "supervisor.resumeFailed": "Could not resume the supervisor",
1225
1592
  "limits.open": "Settings",
1226
- "limits.openAria": "Configure bee counts for this repository",
1227
- "limits.title": "Bee counts",
1228
- "limits.aria": "Bee counts for this repository",
1229
- "limits.description": "Concurrency limit per role. 0 pauses that role. Default 5.",
1593
+ "limits.openAria": "Open agent concurrency settings",
1594
+ "limits.title": "Agent concurrency",
1595
+ "limits.aria": "Agent concurrency for this repository",
1596
+ "limits.description": "Max agents working at the same time, per role; 0 pauses the role",
1230
1597
  "limits.role": "Role",
1231
- "limits.limit": "Limit",
1598
+ "limits.limit": "Concurrency limit",
1232
1599
  "limits.inFlight": "In flight",
1233
1600
  "limits.queued": "Queued",
1234
1601
  "limits.defaultHint": "0-999, default 5",
1235
1602
  "limits.limitAria": "Concurrency limit for {role}",
1236
1603
  "limits.save": "Save",
1237
- "limits.saveAria": "Save bee counts for {repo}",
1604
+ "limits.saveAria": "Save agent concurrency for {repo}",
1238
1605
  "limits.saving": "Saving...",
1239
- "limits.saved": "Bee counts saved.",
1240
- "limits.failed": "Could not save bee counts",
1606
+ "limits.saved": "Agent concurrency saved.",
1607
+ "limits.failed": "Could not save agent concurrency",
1241
1608
  "limits.invalid": "Every limit must be an integer from 0 to 999.",
1242
1609
  "limits.none": "No role data for this repository.",
1243
1610
  "limits.close": "Close",
1244
- "limits.closeAria": "Close bee count settings",
1611
+ "limits.closeAria": "Close agent concurrency settings",
1612
+ "settings.openAria": "Open settings for this repository",
1613
+ "settings.title": "Settings",
1614
+ "settings.tabLimits": "Concurrency limit",
1615
+ "settings.tabRole": "Add role",
1616
+ "settings.tabsAria": "Settings sections",
1617
+ "settings.aria": "Settings for this repository",
1618
+ "settings.addRole": "Add role",
1619
+ "settings.roleName": "Role name",
1620
+ "settings.roleNameHint": "start with a lowercase letter; 2-32 characters; lowercase letters, digits and hyphens only",
1621
+ "settings.roleNameAria": "New role name",
1622
+ "settings.roleNameExample": "e.g. reviewer",
1623
+ "settings.roleDescription": "Responsibilities",
1624
+ "settings.roleDescriptionAria": "Responsibilities for the new role (optional)",
1625
+ "settings.roleDescriptionHint": "Written to .hive/roles/<name>.md; the agent reads it when it starts.",
1626
+ "settings.roleDescriptionMax": "optional, up to 2000 characters",
1627
+ "settings.descriptionTooLong": "Responsibilities must be at most 2000 characters.",
1628
+ "settings.adapter": "Adapter",
1629
+ "settings.adapterAria": "Adapter for the new role",
1630
+ "settings.model": "Model",
1631
+ "settings.modelOptional": "optional",
1632
+ "settings.modelAria": "Optional model for the new role",
1633
+ "settings.addRoleButton": "Add role",
1634
+ "settings.addRoleAria": "Add this role",
1635
+ "settings.addingRole": "Adding...",
1636
+ "settings.roleInvalid": "Role name must start with a lowercase letter, be 2-32 characters, and use lowercase letters, digits and hyphens only.",
1637
+ "settings.modelInvalid": "Model may use letters, digits, dot, underscore, colon and hyphen (max 64).",
1638
+ "settings.roleExists": "Role already exists.",
1639
+ "settings.roleAdded": "Role added.",
1640
+ "settings.roleFailed": "Could not add role",
1641
+ "settings.readOnly": "Read-only: roles and limits cannot be changed.",
1642
+ "settings.supervisorUnavailable": "Supervisor unavailable; role limits cannot load.",
1643
+ "settings.saveLimits": "Save limits",
1644
+ "settings.close": "Close",
1645
+ "settings.closeAria": "Close settings",
1245
1646
  "event.unknown": "event",
1647
+ "add.dialogTitle": "New task",
1648
+ "add.title": "Title",
1649
+ "add.titleAria": "New task title",
1650
+ "add.role": "Role",
1651
+ "add.roleAria": "Role for the new task",
1652
+ "add.scope": "Scope (comma separated, optional)",
1653
+ "add.scopeAria": "File scope for the new task",
1654
+ "add.after": "After task ids (comma separated, optional)",
1655
+ "add.afterAria": "Tasks that must finish first",
1656
+ "add.acceptance": "Acceptance criteria (optional)",
1657
+ "add.acceptanceAria": "Acceptance criteria for the new task",
1658
+ "add.cancel": "Cancel",
1659
+ "add.submit": "Add task",
1660
+ "add.submitting": "Adding…",
1661
+ "add.required": "A title is required.",
1246
1662
  "prompt.newTitle": "New task title",
1247
1663
  "prompt.role": "Role",
1248
1664
  "prompt.scope": "Scope (comma separated, optional)",
1249
1665
  "prompt.after": "After task ids (comma separated, optional)",
1250
- "prompt.commitMessage": "Commit message",
1251
- "prompt.paths": "Paths (comma separated, optional)",
1252
1666
  "prompt.claimAgent": "Claim as agent",
1253
1667
  "prompt.commitSha": "Commit sha (optional)",
1254
1668
  "prompt.failReason": "Failure reason",
1255
- "action.plan": "Give the Queen a goal",
1256
- "help.open": "What these buttons do",
1669
+ "action.plan": "Set the Queen a goal",
1257
1670
  "menu.open": "More actions and help",
1258
- "help.title": "Button guide",
1259
- "help.aria": "Action guide",
1671
+ "help.title": "Menu",
1672
+ "help.aria": "Menu",
1260
1673
  "help.close": "close",
1261
- "help.closeAria": "Close the button guide",
1262
- "help.board": "board actions",
1263
- "help.tasks": "task actions",
1264
- "help.params": "Parameters: ",
1674
+ "help.closeAria": "Close the menu",
1265
1675
  "help.readOnly": "The panel started read-only; add --write to show the write-action buttons.",
1266
1676
  "help.uninitialised": "Initialise Hive with the button in the main area before using board actions.",
1267
1677
  "init.repo": "repository",
@@ -1291,29 +1701,20 @@ const messages = Object.freeze({
1291
1701
  "queen.takeover": "Let the Queen take over",
1292
1702
  "queen.takeoverAria": "Let the Queen take over this session",
1293
1703
  "queen.takeoverBusy": "Taking over...",
1294
- "help.hint": "Open a task to see the actions for that task.",
1295
- "help.action.freeze": "Freeze: nobody can claim new tasks except tasks tagged fix.",
1296
- "help.action.unfreeze": "Unfreeze: agents can claim pending tasks again.",
1704
+ "help.action.freeze": "Pause: only tasks tagged fix can be claimed.",
1705
+ "help.action.unfreeze": "Resume: agents can claim pending tasks again.",
1297
1706
  "help.action.add": "New task: create a pending task with a role and file scope.",
1298
- "help.action.plan": "Give the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
1299
- "help.action.commit": "Commit: commit the selected paths with a message.",
1707
+ "help.action.plan": "Set the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
1300
1708
  "help.action.claim": "Claim: lease a pending task for an agent.",
1301
1709
  "help.action.done": "Done: mark a claimed task complete, optionally with a commit sha.",
1302
1710
  "help.action.fail": "Fail: mark a claimed task failed and record the reason.",
1303
1711
  "help.action.retry": "Retry: put a failed or blocked task back in the queue.",
1304
- "help.params.mode": "mode, reason",
1305
- "help.params.add": "title, role, scope[], after[]",
1306
- "help.params.plan": "goal, maxCards",
1307
- "help.params.commit": "message, set[]",
1308
- "help.params.claim": "id, agent",
1309
- "help.params.done": "id, sha?",
1310
- "help.params.fail": "id, reason",
1311
- "help.params.retry": "id",
1312
- "plan.dialogTitle": "Give the Queen a goal",
1712
+ "help.action.remove": "Delete this task card permanently. A claimed task has to be released or reopened first.",
1713
+ "plan.dialogTitle": "Set the Queen a goal",
1313
1714
  "plan.dialogAria": "Plan tasks from a goal",
1314
1715
  "plan.goal": "Goal",
1315
1716
  "plan.goalHint": "Describe the outcome; the Queen will split it into tasks.",
1316
- "plan.maxCards": "Max cards",
1717
+ "plan.maxCards": "Max tasks",
1317
1718
  "plan.maxCardsHint": "1+",
1318
1719
  "plan.preview": "Preview plan",
1319
1720
  "plan.previewAria": "Ask the Queen to draft a task plan without writing it",
@@ -1334,14 +1735,16 @@ const messages = Object.freeze({
1334
1735
  "plan.deps": "deps",
1335
1736
  "plan.none": "—",
1336
1737
  "plan.goalRequired": "Enter a goal first.",
1337
- "plan.maxInvalid": "Max cards must be a positive whole number.",
1738
+ "plan.maxInvalid": "Max tasks must be a positive whole number.",
1338
1739
  "plan.previewFirst": "Preview the plan before writing tasks.",
1339
1740
  "plan.previewFailed": "Could not read the plan.",
1340
1741
  "plan.applyHint": "The preview is read-only; writing calls plan again with apply=true.",
1341
- "plan.stale": "The goal or max cards changed; preview the plan again.",
1742
+ "plan.stale": "The goal or max tasks changed; preview the plan again.",
1342
1743
  "plan.error": "Plan failed",
1744
+ "confirm.remove": "Delete task \"{title}\" permanently? This cannot be undone.",
1343
1745
  "toast.dismiss": "Dismiss",
1344
1746
  "toast.planWritten": "Tasks written",
1747
+ "toast.taskRemoved": "Task deleted",
1345
1748
  "toast.pickupHint": "The supervisor will pick them up automatically.",
1346
1749
  }),
1347
1750
  zh: Object.freeze({
@@ -1349,13 +1752,13 @@ const messages = Object.freeze({
1349
1752
  "actions.aria": "看板操作",
1350
1753
  "action.add": "新建任务",
1351
1754
  "action.claim": "认领",
1352
- "action.commit": "提交",
1353
1755
  "action.done": "完成",
1354
1756
  "action.fail": "标记失败",
1355
- "action.freeze": "冻结",
1757
+ "action.freeze": "暂停",
1356
1758
  "action.modeTitle": "切换看板模式",
1759
+ "action.remove": "删除任务",
1357
1760
  "action.retry": "重试",
1358
- "action.unfreeze": "解冻",
1761
+ "action.unfreeze": "恢复",
1359
1762
  "pane.agents": "智能体",
1360
1763
  "pane.board": "任务",
1361
1764
  "pane.events": "事件",
@@ -1374,7 +1777,7 @@ const messages = Object.freeze({
1374
1777
  "mode.freeze": "冻结",
1375
1778
  "mode.free.help": "正常:任何人都可以认领任务。",
1376
1779
  "mode.freeze.help": "冻结:只有带 fix 标签的任务能被认领;流水线红时使用。",
1377
- "mode.freeze.banner": "已冻结:只有带 fix 标签的任务能被认领",
1780
+ "mode.freeze.banner": "已暂停:只有带 fix 标签的任务能被认领",
1378
1781
  "mode.title": "模式:",
1379
1782
  "stats.cards": "个任务",
1380
1783
  "stats.oldest": "最久待办",
@@ -1405,6 +1808,7 @@ const messages = Object.freeze({
1405
1808
  "drawer.cardActions": "任务操作",
1406
1809
  "drawer.noActions": "该状态没有可用操作。",
1407
1810
  "drawer.readOnly": "只读:writable=false。",
1811
+ "drawer.removeClaimed": "已认领的任务必须先释放或重开才能删除。",
1408
1812
  "drawer.rawJson": "原始 JSON",
1409
1813
  "events.empty": "暂无事件。",
1410
1814
  "events.showAll": "展开全部事件",
@@ -1420,45 +1824,88 @@ const messages = Object.freeze({
1420
1824
  "supervisor.resumeAria": "恢复 {repo} 的 supervisor",
1421
1825
  "supervisor.resumeFailed": "恢复 supervisor 失败",
1422
1826
  "limits.open": "设置",
1423
- "limits.openAria": "设置这个仓库的蜂的数量",
1424
- "limits.title": "蜂的数量",
1425
- "limits.aria": "按仓库设置蜂的数量",
1426
- "limits.description": "每个角色的并发上限。0 表示暂停该角色,默认 5。",
1827
+ "limits.openAria": "打开智能体并发上限设置",
1828
+ "limits.title": "智能体的并发上限",
1829
+ "limits.aria": "这个仓库的智能体并发上限",
1830
+ "limits.description": "同时干活的智能体数量上限,按角色分别设置;0 表示暂停该角色",
1427
1831
  "limits.role": "角色",
1428
- "limits.limit": "上限",
1832
+ "limits.limit": "并发上限",
1429
1833
  "limits.inFlight": "在飞",
1430
1834
  "limits.queued": "排队",
1431
1835
  "limits.defaultHint": "0–999,默认 5",
1432
1836
  "limits.limitAria": "{role} 的并发上限",
1433
1837
  "limits.save": "保存",
1434
- "limits.saveAria": "保存 {repo} 的蜂的数量",
1838
+ "limits.saveAria": "保存 {repo} 的智能体并发上限",
1435
1839
  "limits.saving": "正在保存…",
1436
- "limits.saved": "蜂的数量已保存。",
1437
- "limits.failed": "保存蜂的数量失败",
1840
+ "limits.saved": "智能体的并发上限已保存。",
1841
+ "limits.failed": "保存智能体的并发上限失败",
1438
1842
  "limits.invalid": "每个上限都必须是 0–999 的整数。",
1439
1843
  "limits.none": "这个仓库没有角色数据。",
1440
1844
  "limits.close": "关闭",
1441
- "limits.closeAria": "关闭蜂的数量设置",
1845
+ "limits.closeAria": "关闭智能体的并发上限设置",
1846
+ "settings.openAria": "打开这个仓库的设置",
1847
+ "settings.title": "设置",
1848
+ "settings.tabLimits": "并发上限",
1849
+ "settings.tabRole": "添加角色",
1850
+ "settings.tabsAria": "设置分区",
1851
+ "settings.aria": "这个仓库的设置",
1852
+ "settings.addRole": "新增角色",
1853
+ "settings.roleName": "角色名",
1854
+ "settings.roleNameHint": "以小写字母开头,2–32 个字符,只能包含小写字母、数字和连字符",
1855
+ "settings.roleNameAria": "新角色名",
1856
+ "settings.roleNameExample": "例如 reviewer",
1857
+ "settings.roleDescription": "职责描述",
1858
+ "settings.roleDescriptionAria": "新角色的职责描述(可空)",
1859
+ "settings.roleDescriptionHint": "会写进 .hive/roles/<name>.md,agent 开工时读它",
1860
+ "settings.roleDescriptionMax": "可空,最多 2000 字",
1861
+ "settings.descriptionTooLong": "职责描述不能超过 2000 字。",
1862
+ "settings.adapter": "适配器",
1863
+ "settings.adapterAria": "新角色的适配器",
1864
+ "settings.model": "模型",
1865
+ "settings.modelOptional": "可空",
1866
+ "settings.modelAria": "新角色的可选模型",
1867
+ "settings.addRoleButton": "新增角色",
1868
+ "settings.addRoleAria": "新增这个角色",
1869
+ "settings.addingRole": "正在新增…",
1870
+ "settings.roleInvalid": "角色名必须以小写字母开头,2–32 个字符,只能包含小写字母、数字和连字符。",
1871
+ "settings.modelInvalid": "模型只能包含字母、数字、点、下划线、冒号和连字符,最长 64 位。",
1872
+ "settings.roleExists": "角色已存在。",
1873
+ "settings.roleAdded": "角色已新增。",
1874
+ "settings.roleFailed": "新增角色失败",
1875
+ "settings.readOnly": "只读模式:无法修改角色和限额。",
1876
+ "settings.supervisorUnavailable": "取不到 supervisor,无法读取角色限额。",
1877
+ "settings.saveLimits": "保存限额",
1878
+ "settings.close": "关闭",
1879
+ "settings.closeAria": "关闭设置",
1442
1880
  "event.unknown": "事件",
1881
+ "add.dialogTitle": "新建任务",
1882
+ "add.title": "标题",
1883
+ "add.titleAria": "新任务标题",
1884
+ "add.role": "角色",
1885
+ "add.roleAria": "新任务角色",
1886
+ "add.scope": "范围(逗号分隔,可选)",
1887
+ "add.scopeAria": "新任务的文件范围",
1888
+ "add.after": "依赖任务(任务 ID,逗号分隔,可选)",
1889
+ "add.afterAria": "需要先完成的任务",
1890
+ "add.acceptance": "验收标准(可选)",
1891
+ "add.acceptanceAria": "新任务的验收标准",
1892
+ "add.cancel": "取消",
1893
+ "add.submit": "新建任务",
1894
+ "add.submitting": "正在新建…",
1895
+ "add.required": "标题不能为空。",
1443
1896
  "prompt.newTitle": "新任务标题",
1444
1897
  "prompt.role": "角色",
1445
1898
  "prompt.scope": "范围(逗号分隔,可选)",
1446
1899
  "prompt.after": "排在哪些任务之后(任务 ID,逗号分隔,可选)",
1447
- "prompt.commitMessage": "提交信息",
1448
- "prompt.paths": "路径(逗号分隔,可选)",
1449
1900
  "prompt.claimAgent": "以哪个智能体认领",
1450
1901
  "prompt.commitSha": "提交 SHA(可选)",
1451
1902
  "prompt.failReason": "失败原因",
1452
- "action.plan": "给女王下目标",
1453
- "help.open": "这些按钮是做什么的",
1903
+ "action.plan": "给女王设目标",
1454
1904
  "menu.open": "更多操作与说明",
1455
- "help.title": "按钮说明",
1456
- "help.aria": "操作说明",
1905
+ "help.title": "菜单",
1906
+ "help.aria": "菜单",
1457
1907
  "help.close": "关闭",
1458
- "help.closeAria": "关闭按钮说明",
1459
- "help.board": "看板操作",
1460
- "help.tasks": "任务操作",
1461
- "help.params": "参数:",
1908
+ "help.closeAria": "关闭菜单",
1462
1909
  "help.readOnly": "面板以只读启动,加 --write 才有写操作按钮。",
1463
1910
  "help.uninitialised": "请先用主区的按钮初始化 Hive,再使用看板操作。",
1464
1911
  "init.repo": "仓库",
@@ -1488,29 +1935,20 @@ const messages = Object.freeze({
1488
1935
  "queen.takeover": "让女王接管",
1489
1936
  "queen.takeoverAria": "让女王接管本会话",
1490
1937
  "queen.takeoverBusy": "正在接管…",
1491
- "help.hint": "点开任务可查看该任务自己的操作。",
1492
- "help.action.freeze": "冻结:除带 fix 标签的任务外,任何人都不再能认领新任务。",
1493
- "help.action.unfreeze": "解冻:恢复认领,智能体可以继续接取待办任务。",
1938
+ "help.action.freeze": "暂停:只有带 fix 标签的任务能被认领。",
1939
+ "help.action.unfreeze": "恢复:恢复认领,智能体可以继续接取待办任务。",
1494
1940
  "help.action.add": "新建任务:添加一条带角色和文件范围的待办任务。",
1495
- "help.action.plan": "给女王下目标:让女王把目标拆成任务计划,预览后再写入看板。",
1496
- "help.action.commit": "提交:按提交信息提交选中的路径。",
1941
+ "help.action.plan": "给女王设目标:让女王把目标拆成任务计划,预览后再写入看板。",
1497
1942
  "help.action.claim": "认领:以某个智能体的名义短期租下这条待办任务。",
1498
1943
  "help.action.done": "完成:把已认领的任务标为完成,可选填写提交 SHA。",
1499
1944
  "help.action.fail": "标记失败:把已认领的任务标为失败,并写明原因。",
1500
1945
  "help.action.retry": "重试:把失败或受阻的任务放回队列。",
1501
- "help.params.mode": "mode、reason",
1502
- "help.params.add": "title、role、scope[]、after[]",
1503
- "help.params.plan": "goal、maxCards",
1504
- "help.params.commit": "message、set[]",
1505
- "help.params.claim": "id、智能体",
1506
- "help.params.done": "id、sha?",
1507
- "help.params.fail": "id、reason",
1508
- "help.params.retry": "id",
1509
- "plan.dialogTitle": "给女王下目标",
1946
+ "help.action.remove": "永久删除这张任务卡;已认领的任务需要先释放或重开。",
1947
+ "plan.dialogTitle": "给女王设目标",
1510
1948
  "plan.dialogAria": "按目标规划任务",
1511
1949
  "plan.goal": "目标",
1512
1950
  "plan.goalHint": "描述想达成的结果,女王会把它拆成任务。",
1513
- "plan.maxCards": "最大卡数",
1951
+ "plan.maxCards": "最大任务数",
1514
1952
  "plan.maxCardsHint": "至少 1",
1515
1953
  "plan.preview": "预览计划",
1516
1954
  "plan.previewAria": "让女王先给出任务计划,不写入看板",
@@ -1531,14 +1969,16 @@ const messages = Object.freeze({
1531
1969
  "plan.deps": "依赖",
1532
1970
  "plan.none": "—",
1533
1971
  "plan.goalRequired": "请先填写目标。",
1534
- "plan.maxInvalid": "最大卡数必须是正整数。",
1972
+ "plan.maxInvalid": "最大任务数必须是正整数。",
1535
1973
  "plan.previewFirst": "请先预览计划,再写入任务。",
1536
1974
  "plan.previewFailed": "无法解析计划。",
1537
1975
  "plan.applyHint": "预览不会写入;写入时会带 apply=true 再调用一次 plan。",
1538
- "plan.stale": "目标或最大卡数已修改,请重新预览计划。",
1976
+ "plan.stale": "目标或最大任务数已修改,请重新预览计划。",
1539
1977
  "plan.error": "计划失败",
1978
+ "confirm.remove": "确定永久删除任务「{title}」?此操作不可撤销。",
1540
1979
  "toast.dismiss": "关闭",
1541
1980
  "toast.planWritten": "任务已写入",
1981
+ "toast.taskRemoved": "任务已删除",
1542
1982
  "toast.pickupHint": "supervisor 会自动接卡。",
1543
1983
  }),
1544
1984
  });
@@ -1707,22 +2147,12 @@ function modeAction(mode) {
1707
2147
  return { name: "mode", ...meta, body: { mode: nextMode, reason: "panel" } };
1708
2148
  }
1709
2149
 
1710
- function toolbarActions(writable) {
2150
+ function toolbarActions(writable, mode) {
1711
2151
  if (!writable) return [];
1712
2152
  return [
1713
2153
  { name: "add", ...ACTION_META.add },
1714
2154
  { name: "plan", ...ACTION_META.plan },
1715
- { name: "commit", ...ACTION_META.commit },
1716
- ];
1717
- }
1718
-
1719
- function helpGroups(mode) {
1720
- return [
1721
- { titleKey: "help.board", actions: [modeAction(mode), ...toolbarActions(true)] },
1722
- {
1723
- titleKey: "help.tasks",
1724
- actions: ["claim", "done", "fail", "retry"].map((name) => ({ name, ...ACTION_META[name] })),
1725
- },
2155
+ modeAction(mode),
1726
2156
  ];
1727
2157
  }
1728
2158
 
@@ -1733,6 +2163,7 @@ function helpGroups(mode) {
1733
2163
  * @returns {{
1734
2164
  * at: string, repo: string, mode: string, initialised: boolean, writable: boolean,
1735
2165
  * queen: {active:boolean, source:"auto"|"manual"|null, repo:string}|null,
2166
+ * 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},
1736
2167
  * lanes: Record<string, Array<{id:string,title:string,role:string,owner:string,scope:string[],reason:string}>>,
1737
2168
  * laneOrder: string[],
1738
2169
  * stats: {total:number, byState:Record<string,number>, byRole:Record<string,number>, oldestPending:{id:string,createdAt:string}|null},
@@ -1776,6 +2207,32 @@ function renderModel(snapshot) {
1776
2207
  : null,
1777
2208
  repo: typeof rawQueen.repo === "string" ? rawQueen.repo : "",
1778
2209
  };
2210
+ const rawRoles = isRecord(source.roles) ? source.roles : null;
2211
+ const rolesLimits = {};
2212
+ if (rawRoles && isRecord(rawRoles.limits)) {
2213
+ for (const [name, value] of Object.entries(rawRoles.limits)) {
2214
+ const number = Number(value);
2215
+ if (name && Number.isFinite(number)) rolesLimits[name] = number;
2216
+ }
2217
+ }
2218
+ const roles = {
2219
+ list:
2220
+ rawRoles && Array.isArray(rawRoles.list)
2221
+ ? rawRoles.list
2222
+ .filter(isRecord)
2223
+ .map((entry) => ({
2224
+ name: asString(entry.name),
2225
+ adapter: typeof entry.adapter === "string" ? entry.adapter : null,
2226
+ model: typeof entry.model === "string" ? entry.model : null,
2227
+ prompt: typeof entry.prompt === "string" ? entry.prompt : null,
2228
+ promptExists: entry.promptExists === true,
2229
+ limit: typeof entry.limit === "number" && Number.isFinite(entry.limit) ? entry.limit : null,
2230
+ }))
2231
+ .filter((entry) => entry.name)
2232
+ : [],
2233
+ limits: rolesLimits,
2234
+ error: rawRoles ? asString(rawRoles.error) || null : null,
2235
+ };
1779
2236
 
1780
2237
  return {
1781
2238
  at: asString(source.at),
@@ -1783,13 +2240,14 @@ function renderModel(snapshot) {
1783
2240
  mode,
1784
2241
  initialised,
1785
2242
  queen,
2243
+ roles,
1786
2244
  writable,
1787
2245
  lanes,
1788
2246
  laneOrder: [...LANE_ORDER],
1789
2247
  stats: normalizeStats(source.stats, tasks),
1790
2248
  agents: normalizeAgents(source.board),
1791
2249
  events: normalizeEvents(source.events),
1792
- actions: initialised ? toolbarActions(writable) : [],
2250
+ actions: initialised ? toolbarActions(writable, mode) : [],
1793
2251
  };
1794
2252
  }
1795
2253
 
@@ -1971,6 +2429,62 @@ function element(doc, tag, className, text) {
1971
2429
  return node;
1972
2430
  }
1973
2431
 
2432
+ function svgNode(doc, tag) {
2433
+ const node =
2434
+ typeof doc.createElementNS === "function"
2435
+ ? doc.createElementNS("http://www.w3.org/2000/svg", tag)
2436
+ : doc.createElement(tag);
2437
+ return node;
2438
+ }
2439
+
2440
+ function makeHiveIcon(doc, kind) {
2441
+ const svg = svgNode(doc, "svg");
2442
+ setAttr(svg, "viewBox", "0 0 24 24");
2443
+ setAttr(svg, "width", "16");
2444
+ setAttr(svg, "height", "16");
2445
+ setAttr(svg, "aria-hidden", "true");
2446
+ setAttr(svg, "focusable", "false");
2447
+ if (kind === "menu") {
2448
+ for (const cx of [5, 12, 19]) {
2449
+ const dot = svgNode(doc, "circle");
2450
+ setAttr(dot, "cx", String(cx));
2451
+ setAttr(dot, "cy", "12");
2452
+ setAttr(dot, "r", "1.25");
2453
+ setAttr(dot, "fill", "currentColor");
2454
+ svg.appendChild(dot);
2455
+ }
2456
+ return svg;
2457
+ }
2458
+ setAttr(svg, "fill", "none");
2459
+ setAttr(svg, "stroke", "currentColor");
2460
+ setAttr(svg, "stroke-width", "1.75");
2461
+ setAttr(svg, "stroke-linecap", "round");
2462
+ setAttr(svg, "stroke-linejoin", "round");
2463
+ const center = svgNode(doc, "circle");
2464
+ setAttr(center, "cx", "12");
2465
+ setAttr(center, "cy", "12");
2466
+ setAttr(center, "r", "3");
2467
+ svg.appendChild(center);
2468
+ const path = svgNode(doc, "path");
2469
+ setAttr(
2470
+ path,
2471
+ "d",
2472
+ "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",
2473
+ );
2474
+ svg.appendChild(path);
2475
+ return svg;
2476
+ }
2477
+
2478
+ function setHidden(node, hidden) {
2479
+ if (!node) return;
2480
+ if (hidden) {
2481
+ setAttr(node, "hidden", "");
2482
+ return;
2483
+ }
2484
+ if (typeof node.removeAttribute === "function") node.removeAttribute("hidden");
2485
+ else if (node.attributes) delete node.attributes.hidden;
2486
+ }
2487
+
1974
2488
  function setAttr(node, name, value) {
1975
2489
  if (node && typeof node.setAttribute === "function") {
1976
2490
  node.setAttribute(name, value === null || value === undefined ? "" : String(value));
@@ -2049,22 +2563,6 @@ function formatTime(value) {
2049
2563
  }
2050
2564
  }
2051
2565
 
2052
- function formatStamp(value) {
2053
- const date = parseDate(value);
2054
- if (!date) return asString(value);
2055
- try {
2056
- return date.toLocaleString([], {
2057
- month: "short",
2058
- day: "2-digit",
2059
- hour: "2-digit",
2060
- minute: "2-digit",
2061
- second: "2-digit",
2062
- });
2063
- } catch {
2064
- return date.toISOString();
2065
- }
2066
- }
2067
-
2068
2566
  function safeClassToken(value) {
2069
2567
  const token = asString(value).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
2070
2568
  return token || "unknown";
@@ -2177,6 +2675,7 @@ function extractPlan(payload) {
2177
2675
  * intervalMs?: number,
2178
2676
  * onError?: (error: Error) => void,
2179
2677
  * fetch?: typeof fetch,
2678
+ * confirm?: (message: string) => boolean,
2180
2679
  * t?: (key: string) => string,
2181
2680
  * subscribeLocale?: (listener: () => void) => (() => void)
2182
2681
  * }} [options]
@@ -2230,6 +2729,18 @@ function mount(root, options = {}) {
2230
2729
  ? globalThis.prompt.bind(globalThis)
2231
2730
  : null;
2232
2731
 
2732
+ // Destructive actions ask through the host's confirm when it provides one
2733
+ // (tests, embedded hosts), then the global confirm. Without either, a
2734
+ // destructive action is refused rather than run unconfirmed.
2735
+ const confirmImpl =
2736
+ typeof opts.confirm === "function"
2737
+ ? opts.confirm
2738
+ : typeof view.confirm === "function"
2739
+ ? view.confirm.bind(view)
2740
+ : typeof globalThis.confirm === "function"
2741
+ ? globalThis.confirm.bind(globalThis)
2742
+ : null;
2743
+
2233
2744
  const schedule =
2234
2745
  typeof view.setInterval === "function" ? view.setInterval.bind(view) : globalThis.setInterval.bind(globalThis);
2235
2746
  const unschedule =
@@ -2267,6 +2778,7 @@ function mount(root, options = {}) {
2267
2778
  let lastModel = null;
2268
2779
  let drawerNode = null;
2269
2780
  let drawerState = null;
2781
+ let drawerTrigger = null;
2270
2782
  let unsubscribeLocale = null;
2271
2783
  let statusKey = null;
2272
2784
  let statusKind = "info";
@@ -2279,6 +2791,11 @@ function mount(root, options = {}) {
2279
2791
  let planState = null;
2280
2792
  let planTriggerButton = null;
2281
2793
  let planFocusables = [];
2794
+ let addOverlay = null;
2795
+ let addDialogNode = null;
2796
+ let addState = null;
2797
+ let addTriggerButton = null;
2798
+ let addFocusables = [];
2282
2799
  let toastNode = null;
2283
2800
  let stageFilter = "all";
2284
2801
  let stageChipEntries = [];
@@ -2292,11 +2809,13 @@ function mount(root, options = {}) {
2292
2809
  const queenDismissedFallback = new Set();
2293
2810
  let supervisorData = [];
2294
2811
  let supervisorRequest = null;
2812
+ let supervisorInlineRow = null;
2295
2813
  let limitsOverlay = null;
2296
2814
  let limitsDialogNode = null;
2297
2815
  let limitsState = null;
2298
2816
  let limitsTriggerButton = null;
2299
2817
  let limitsFocusables = [];
2818
+ let settingsActiveTab = "limits";
2300
2819
 
2301
2820
  // --- shell ---------------------------------------------------------------
2302
2821
 
@@ -2309,8 +2828,19 @@ function mount(root, options = {}) {
2309
2828
  ident.appendChild(repoNode);
2310
2829
  bar.appendChild(ident);
2311
2830
 
2312
- const timeNode = element(doc, "time", "hive-time", "");
2313
- bar.appendChild(timeNode);
2831
+ const supervisorInline = element(doc, "span", "hive-supervisor-inline is-hidden");
2832
+ setAttr(supervisorInline, "aria-label", translate("supervisor.aria"));
2833
+ const supervisorInlineLabel = element(doc, "span", "hive-supervisor-inline-label", translate("supervisor.label"));
2834
+ const supervisorInlineState = element(doc, "span", "hive-supervisor-inline-state", "");
2835
+ const supervisorInlineResume = element(doc, "button", "hive-btn hive-supervisor-inline-resume is-hidden", translate("supervisor.resume"));
2836
+ setAttr(supervisorInlineResume, "type", "button");
2837
+ supervisorInlineResume.addEventListener("click", () => {
2838
+ if (supervisorInlineRow) void resumeSupervisor(supervisorInlineRow, supervisorInlineResume);
2839
+ });
2840
+ supervisorInline.appendChild(supervisorInlineLabel);
2841
+ supervisorInline.appendChild(supervisorInlineState);
2842
+ supervisorInline.appendChild(supervisorInlineResume);
2843
+ bar.appendChild(supervisorInline);
2314
2844
 
2315
2845
  const statsNode = element(doc, "div", "hive-stats");
2316
2846
  bar.appendChild(statsNode);
@@ -2325,8 +2855,9 @@ function mount(root, options = {}) {
2325
2855
  const actionsNode = element(doc, "div", "hive-actions");
2326
2856
  actionGroup.appendChild(actionsNode);
2327
2857
 
2328
- const helpButton = element(doc, "button", "hive-btn hive-help-trigger hive-menu-trigger", "⋯");
2858
+ const helpButton = element(doc, "button", "hive-btn hive-btn-ghost hive-icon-button hive-help-trigger hive-menu-trigger");
2329
2859
  setAttr(helpButton, "type", "button");
2860
+ helpButton.appendChild(makeHiveIcon(doc, "menu"));
2330
2861
  setAttr(helpButton, "aria-haspopup", "dialog");
2331
2862
  setAttr(helpButton, "aria-expanded", "false");
2332
2863
  setAttr(helpButton, "title", translate("menu.open"));
@@ -2334,23 +2865,17 @@ function mount(root, options = {}) {
2334
2865
  helpButton.addEventListener("click", () => {
2335
2866
  toggleHelp();
2336
2867
  });
2337
- actionGroup.appendChild(helpButton);
2338
- bar.appendChild(actionGroup);
2339
-
2340
- const supervisorBar = element(doc, "section", "hive-supervisor is-hidden");
2341
- setAttr(supervisorBar, "aria-label", translate("supervisor.aria"));
2342
- const supervisorLabel = element(doc, "span", "hive-supervisor-label", "");
2343
- const supervisorRepos = element(doc, "div", "hive-supervisor-repos");
2344
- const supervisorLimitsButton = element(doc, "button", "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden", translate("limits.open"));
2345
- setAttr(supervisorLimitsButton, "type", "button");
2346
- setAttr(supervisorLimitsButton, "title", translate("limits.openAria"));
2347
- setAttr(supervisorLimitsButton, "aria-label", translate("limits.openAria"));
2348
- supervisorLimitsButton.addEventListener("click", () => {
2349
- openLimitsDialog(supervisorLimitsButton);
2868
+ // The previous "⋯" action menu has no entries left; settings carries the Queen section.
2869
+ const settingsButton = element(doc, "button", "hive-btn hive-btn-ghost hive-icon-button hive-settings-trigger");
2870
+ setAttr(settingsButton, "type", "button");
2871
+ settingsButton.appendChild(makeHiveIcon(doc, "gear"));
2872
+ setAttr(settingsButton, "title", translate("settings.openAria"));
2873
+ setAttr(settingsButton, "aria-label", translate("settings.openAria"));
2874
+ settingsButton.addEventListener("click", () => {
2875
+ openLimitsDialog(settingsButton);
2350
2876
  });
2351
- supervisorBar.appendChild(supervisorLabel);
2352
- supervisorBar.appendChild(supervisorRepos);
2353
- supervisorBar.appendChild(supervisorLimitsButton);
2877
+ actionGroup.appendChild(settingsButton);
2878
+ bar.appendChild(actionGroup);
2354
2879
 
2355
2880
  const freezeSlot = element(doc, "div", "hive-freeze-slot");
2356
2881
 
@@ -2479,7 +3004,6 @@ function mount(root, options = {}) {
2479
3004
  });
2480
3005
 
2481
3006
  frame.appendChild(bar);
2482
- frame.appendChild(supervisorBar);
2483
3007
  frame.appendChild(freezeSlot);
2484
3008
  frame.appendChild(queenHint);
2485
3009
  frame.appendChild(agentsStrip);
@@ -2536,6 +3060,15 @@ function mount(root, options = {}) {
2536
3060
  return answer === null || answer === undefined ? null : String(answer);
2537
3061
  }
2538
3062
 
3063
+ function askConfirm(message) {
3064
+ if (!confirmImpl) return false;
3065
+ try {
3066
+ return confirmImpl(message) === true;
3067
+ } catch {
3068
+ return false;
3069
+ }
3070
+ }
3071
+
2539
3072
  function emptyState(text) {
2540
3073
  return element(doc, "div", "hive-empty", text);
2541
3074
  }
@@ -2603,36 +3136,22 @@ function mount(root, options = {}) {
2603
3136
  if (!model || !model.writable) {
2604
3137
  body.appendChild(element(doc, "div", "hive-help-note", translate("help.readOnly")));
2605
3138
  }
2606
- const groups = helpGroups(model ? model.mode : "free");
2607
- for (const group of groups) {
2608
- body.appendChild(element(doc, "div", "hive-help-section", translate(group.titleKey)));
2609
- for (const action of group.actions) {
2610
- const item = element(doc, "div", "hive-help-action");
2611
- item.appendChild(element(doc, "div", "hive-help-name", translate(action.labelKey)));
2612
- item.appendChild(element(doc, "div", "hive-help-desc", translate(action.helpKey)));
2613
- const params = action.paramsKey ? translate(action.paramsKey) : "";
2614
- if (params) {
2615
- item.appendChild(element(doc, "div", "hive-help-params", translate("help.params") + params));
2616
- }
2617
- if (action.name === "mode" && model && model.writable && model.initialised !== false) {
2618
- const row = element(doc, "div", "hive-help-actionrow");
2619
- const button = element(doc, "button", "hive-btn hive-help-mode-action", translate(action.labelKey));
2620
- setAttr(button, "type", "button");
2621
- setAttr(button, "title", translate(action.helpKey));
2622
- setAttr(button, "aria-label", translate(action.helpKey));
2623
- button.addEventListener("click", () => {
2624
- closeHelp();
2625
- void postAction("mode", action.body || { mode: "freeze", reason: "panel" });
2626
- });
2627
- row.appendChild(button);
2628
- item.appendChild(row);
2629
- }
2630
- body.appendChild(item);
2631
- }
3139
+ if (model && model.writable && model.initialised !== false) {
3140
+ const action = modeAction(model.mode);
3141
+ const row = element(doc, "div", "hive-help-actionrow");
3142
+ const button = element(doc, "button", "hive-btn hive-help-mode-action", translate(action.labelKey));
3143
+ setAttr(button, "type", "button");
3144
+ setAttr(button, "title", translate(action.helpKey));
3145
+ setAttr(button, "aria-label", translate(action.helpKey));
3146
+ button.addEventListener("click", () => {
3147
+ closeHelp();
3148
+ void postAction("mode", action.body || { mode: "freeze", reason: "panel" });
3149
+ });
3150
+ row.appendChild(button);
3151
+ body.appendChild(row);
2632
3152
  }
2633
3153
  body.appendChild(element(doc, "div", "hive-help-section", translate("help.queen")));
2634
3154
  body.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
2635
- body.appendChild(element(doc, "div", "hive-help-hint", translate("help.hint")));
2636
3155
  }
2637
3156
 
2638
3157
  function positionHelp(panel) {
@@ -2879,6 +3398,7 @@ function mount(root, options = {}) {
2879
3398
  function openPlanDialog(trigger) {
2880
3399
  if (destroyed || !lastModel || !lastModel.writable) return;
2881
3400
  closeHelp(false);
3401
+ closeAddDialog(false);
2882
3402
  closeDrawer();
2883
3403
  planTriggerButton = trigger || planTriggerButton || null;
2884
3404
 
@@ -3005,7 +3525,7 @@ function mount(root, options = {}) {
3005
3525
  focusNode(goalInput);
3006
3526
  }
3007
3527
 
3008
- // --- bee count settings -------------------------------------------------
3528
+ // --- agent concurrency settings -----------------------------------------
3009
3529
 
3010
3530
  function currentSupervisorRow() {
3011
3531
  if (!lastModel) return null;
@@ -3013,14 +3533,42 @@ function mount(root, options = {}) {
3013
3533
  }
3014
3534
 
3015
3535
  function roleRowsForCurrentRepo(row) {
3016
- const roles = new Map();
3536
+ const supervisorRoles = new Map();
3017
3537
  if (row && Array.isArray(row.roles)) {
3018
3538
  for (const role of row.roles) {
3019
3539
  if (!isRecord(role)) continue;
3020
3540
  const name = asString(role.role);
3021
- if (name) roles.set(name, { ...role, role: name });
3541
+ if (name) supervisorRoles.set(name, role);
3022
3542
  }
3023
3543
  }
3544
+ const modelRoles = lastModel && lastModel.roles && Array.isArray(lastModel.roles.list) ? lastModel.roles.list : [];
3545
+ if (modelRoles.length > 0) {
3546
+ return modelRoles
3547
+ .map((entry) => {
3548
+ const name = asString(entry.name);
3549
+ if (!name) return null;
3550
+ const savedLimit = lastModel.roles.limits[name];
3551
+ const limit = Number.isFinite(savedLimit)
3552
+ ? savedLimit
3553
+ : Number.isFinite(entry.limit)
3554
+ ? entry.limit
3555
+ : null;
3556
+ const effective = supervisorRoles.get(name);
3557
+ return {
3558
+ role: name,
3559
+ adapter: entry.adapter,
3560
+ model: entry.model,
3561
+ limit,
3562
+ inFlight: effective ? effective.inFlight : null,
3563
+ queued: effective ? effective.queued : null,
3564
+ };
3565
+ })
3566
+ .filter(Boolean)
3567
+ .sort((left, right) => left.role.localeCompare(right.role));
3568
+ }
3569
+
3570
+ const roles = new Map();
3571
+ for (const [name, role] of supervisorRoles) roles.set(name, { ...role, role: name });
3024
3572
  if (roles.size === 0 && lastModel) {
3025
3573
  for (const cards of Object.values(lastModel.lanes)) {
3026
3574
  for (const card of cards) {
@@ -3087,34 +3635,37 @@ function mount(root, options = {}) {
3087
3635
  }
3088
3636
 
3089
3637
  function openLimitsDialog(trigger) {
3090
- if (destroyed || !lastModel || !lastModel.writable || supervisorData.length === 0) return;
3638
+ if (destroyed || !lastModel) return;
3091
3639
  closeHelp(false);
3092
3640
  closePlanDialog(false);
3641
+ closeAddDialog(false);
3093
3642
  closeDrawer();
3094
3643
  closeToast();
3095
3644
  if (limitsDialogNode) closeLimitsDialog(false);
3096
- limitsTriggerButton = trigger || supervisorLimitsButton;
3645
+ limitsTriggerButton = trigger || settingsButton;
3097
3646
 
3098
3647
  const repo = lastModel.repo || "";
3648
+ const writable = Boolean(lastModel.writable);
3649
+ const supervisorAvailable = supervisorData.length > 0;
3099
3650
  const rows = roleRowsForCurrentRepo(currentSupervisorRow());
3100
3651
  const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim");
3101
3652
  overlay.addEventListener("click", (event) => {
3102
3653
  if (!event || !event.target || event.target === overlay) closeLimitsDialog();
3103
3654
  });
3104
3655
 
3105
- const dialog = element(doc, "div", "hive-dialog");
3656
+ const dialog = element(doc, "div", "hive-dialog hive-settings-dialog");
3106
3657
  setAttr(dialog, "role", "dialog");
3107
3658
  setAttr(dialog, "aria-modal", "true");
3108
- setAttr(dialog, "aria-label", translate("limits.aria"));
3659
+ setAttr(dialog, "aria-label", translate("settings.aria"));
3109
3660
 
3110
3661
  const head = element(doc, "div", "hive-dialog-head");
3111
3662
  const titleBox = element(doc, "div", "hive-dialog-head-title");
3112
- titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("limits.title")));
3663
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("settings.title")));
3113
3664
  head.appendChild(titleBox);
3114
- const closeButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("limits.close"));
3665
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("settings.close"));
3115
3666
  setAttr(closeButton, "type", "button");
3116
- setAttr(closeButton, "title", translate("limits.closeAria"));
3117
- setAttr(closeButton, "aria-label", translate("limits.closeAria"));
3667
+ setAttr(closeButton, "title", translate("settings.closeAria"));
3668
+ setAttr(closeButton, "aria-label", translate("settings.closeAria"));
3118
3669
  closeButton.addEventListener("click", () => {
3119
3670
  closeLimitsDialog();
3120
3671
  });
@@ -3128,11 +3679,97 @@ function mount(root, options = {}) {
3128
3679
  setAttr(repoPath, "title", repo);
3129
3680
  repoLine.appendChild(repoPath);
3130
3681
  body.appendChild(repoLine);
3131
- body.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3682
+ if (!writable) {
3683
+ body.appendChild(element(doc, "div", "hive-settings-note", translate("settings.readOnly")));
3684
+ }
3132
3685
 
3686
+ const roleSection = element(doc, "section", "hive-settings-section");
3687
+ const roleForm = element(doc, "div", "hive-field-row hive-settings-role-form");
3688
+ const roleNameField = element(doc, "label", "hive-field");
3689
+ roleNameField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleName")));
3690
+ const roleNameInput = element(doc, "input", "hive-input hive-settings-role-name");
3691
+ setAttr(roleNameInput, "type", "text");
3692
+ setAttr(roleNameInput, "autocomplete", "off");
3693
+ setAttr(roleNameInput, "placeholder", translate("settings.roleNameExample"));
3694
+ setAttr(roleNameInput, "aria-label", translate("settings.roleNameAria"));
3695
+ setAttr(roleNameInput, "pattern", "[a-z0-9]+(?:-[a-z0-9]+)*");
3696
+ roleNameField.appendChild(roleNameInput);
3697
+ roleNameField.appendChild(element(doc, "span", "hive-field-hint", translate("settings.roleNameHint")));
3698
+ roleForm.appendChild(roleNameField);
3699
+
3700
+ const adapterField = element(doc, "label", "hive-field is-narrow");
3701
+ adapterField.appendChild(element(doc, "span", "hive-field-label", translate("settings.adapter")));
3702
+ const adapterInput = element(doc, "select", "hive-input hive-settings-role-adapter");
3703
+ setAttr(adapterInput, "aria-label", translate("settings.adapterAria"));
3704
+ for (const adapter of ["dsh", "claude", "codex"]) {
3705
+ const option = element(doc, "option", null, adapter);
3706
+ setAttr(option, "value", adapter);
3707
+ adapterInput.appendChild(option);
3708
+ }
3709
+ adapterInput.value = "dsh";
3710
+ adapterField.appendChild(adapterInput);
3711
+ roleForm.appendChild(adapterField);
3712
+
3713
+ const modelField = element(doc, "label", "hive-field is-narrow");
3714
+ modelField.appendChild(element(doc, "span", "hive-field-label", translate("settings.model")));
3715
+ const modelInput = element(doc, "input", "hive-input hive-settings-role-model");
3716
+ setAttr(modelInput, "type", "text");
3717
+ setAttr(modelInput, "autocomplete", "off");
3718
+ setAttr(modelInput, "placeholder", translate("settings.modelOptional"));
3719
+ setAttr(modelInput, "aria-label", translate("settings.modelAria"));
3720
+ modelField.appendChild(modelInput);
3721
+ roleForm.appendChild(modelField);
3722
+ roleSection.appendChild(roleForm);
3723
+
3724
+ const roleDescriptionField = element(doc, "label", "hive-field hive-settings-role-description");
3725
+ roleDescriptionField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleDescription")));
3726
+ const roleDescriptionInput = element(doc, "textarea", "hive-textarea hive-settings-role-description-input");
3727
+ setAttr(roleDescriptionInput, "maxlength", "2000");
3728
+ setAttr(roleDescriptionInput, "rows", "3");
3729
+ setAttr(roleDescriptionInput, "aria-label", translate("settings.roleDescriptionAria"));
3730
+ roleDescriptionField.appendChild(roleDescriptionInput);
3731
+ roleDescriptionField.appendChild(
3732
+ element(
3733
+ doc,
3734
+ "span",
3735
+ "hive-field-hint",
3736
+ translate("settings.roleDescriptionHint") + " · " + translate("settings.roleDescriptionMax"),
3737
+ ),
3738
+ );
3739
+ roleSection.appendChild(roleDescriptionField);
3740
+
3741
+ const roleErrorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3742
+ roleSection.appendChild(roleErrorNode);
3743
+ const addRoleButton = element(
3744
+ doc,
3745
+ "button",
3746
+ "hive-btn hive-settings-add-role hive-settings-secondary",
3747
+ translate("settings.addRoleButton"),
3748
+ );
3749
+ setAttr(addRoleButton, "type", "button");
3750
+ setAttr(addRoleButton, "title", translate("settings.addRoleAria"));
3751
+ setAttr(addRoleButton, "aria-label", translate("settings.addRoleAria"));
3752
+ addRoleButton.disabled = !writable;
3753
+ addRoleButton.addEventListener("click", () => {
3754
+ void saveRole();
3755
+ });
3756
+ const roleActions = element(doc, "div", "hive-settings-form-actions hive-settings-role-actions");
3757
+ roleActions.appendChild(addRoleButton);
3758
+ roleSection.appendChild(roleActions);
3759
+ if (!writable) {
3760
+ roleNameInput.disabled = true;
3761
+ adapterInput.disabled = true;
3762
+ modelInput.disabled = true;
3763
+ roleDescriptionInput.disabled = true;
3764
+ }
3765
+ const limitsSection = element(doc, "section", "hive-settings-section");
3766
+ limitsSection.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3133
3767
  const rowNodes = [];
3768
+ if (!supervisorAvailable) {
3769
+ limitsSection.appendChild(element(doc, "div", "hive-settings-note", translate("settings.supervisorUnavailable")));
3770
+ }
3134
3771
  if (rows.length === 0) {
3135
- body.appendChild(element(doc, "div", "hive-limits-empty", translate("limits.none")));
3772
+ limitsSection.appendChild(element(doc, "div", "hive-limits-empty", translate("limits.none")));
3136
3773
  } else {
3137
3774
  const table = element(doc, "div", "hive-limits-table");
3138
3775
  const header = element(doc, "div", "hive-limits-row is-head");
@@ -3153,31 +3790,108 @@ function mount(root, options = {}) {
3153
3790
  setAttr(input, "inputmode", "numeric");
3154
3791
  setAttr(input, "aria-label", translate("limits.limitAria").replace("{role}", role.role));
3155
3792
  input.value = supervisorNumber(role.limit) === null ? "5" : String(supervisorNumber(role.limit));
3793
+ input.disabled = !writable || !supervisorAvailable;
3156
3794
  roleRow.appendChild(input);
3157
3795
  roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.inFlight)));
3158
3796
  roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.queued)));
3159
3797
  table.appendChild(roleRow);
3160
3798
  rowNodes.push({ role: role.role, input });
3161
3799
  }
3162
- body.appendChild(table);
3163
- body.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
3800
+ limitsSection.appendChild(table);
3801
+ limitsSection.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
3164
3802
  }
3165
3803
 
3166
3804
  const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3167
- body.appendChild(errorNode);
3168
- dialog.appendChild(body);
3169
-
3170
- const foot = element(doc, "div", "hive-dialog-foot");
3171
- const saveButton = element(doc, "button", "hive-btn", translate("limits.save"));
3805
+ limitsSection.appendChild(errorNode);
3806
+ const saveButton = element(
3807
+ doc,
3808
+ "button",
3809
+ "hive-btn hive-settings-save hive-settings-primary",
3810
+ translate("settings.saveLimits"),
3811
+ );
3172
3812
  setAttr(saveButton, "type", "button");
3173
3813
  setAttr(saveButton, "title", translate("limits.saveAria").replace("{repo}", repo));
3174
3814
  setAttr(saveButton, "aria-label", translate("limits.saveAria").replace("{repo}", repo));
3175
- saveButton.disabled = rows.length === 0;
3815
+ saveButton.disabled = !writable || !supervisorAvailable || rows.length === 0;
3176
3816
  saveButton.addEventListener("click", () => {
3177
3817
  void saveBeeCounts();
3178
3818
  });
3179
- foot.appendChild(saveButton);
3180
- dialog.appendChild(foot);
3819
+ const limitsActions = element(doc, "div", "hive-settings-form-actions hive-settings-limits-actions");
3820
+ limitsActions.appendChild(saveButton);
3821
+ limitsSection.appendChild(limitsActions);
3822
+
3823
+ const queenSection = element(doc, "section", "hive-settings-section");
3824
+ queenSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("help.queen")));
3825
+ queenSection.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
3826
+ const tabs = element(doc, "div", "hive-settings-tabs");
3827
+ setAttr(tabs, "role", "tablist");
3828
+ setAttr(tabs, "aria-label", translate("settings.tabsAria"));
3829
+ const panelWrap = element(doc, "div", "hive-settings-panels");
3830
+ const tabEntries = [
3831
+ { id: "limits", labelKey: "settings.tabLimits", section: limitsSection },
3832
+ { id: "role", labelKey: "settings.tabRole", section: roleSection },
3833
+ ];
3834
+ const tabNodes = new Map();
3835
+ const panelNodes = new Map();
3836
+
3837
+ function selectSettingsTab(name, focusTab) {
3838
+ const active = name === "role" ? "role" : "limits";
3839
+ settingsActiveTab = active;
3840
+ for (const entry of tabEntries) {
3841
+ const selected = entry.id === active;
3842
+ const tab = tabNodes.get(entry.id);
3843
+ const panel = panelNodes.get(entry.id);
3844
+ setAttr(tab, "aria-selected", selected ? "true" : "false");
3845
+ setAttr(tab, "tabindex", selected ? "0" : "-1");
3846
+ setHidden(panel, !selected);
3847
+ }
3848
+ if (focusTab) focusNode(tabNodes.get(active));
3849
+ }
3850
+
3851
+ function onSettingsTabKeydown(event, current) {
3852
+ if (!event) return;
3853
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight" && event.key !== "Home" && event.key !== "End") {
3854
+ return;
3855
+ }
3856
+ if (typeof event.preventDefault === "function") event.preventDefault();
3857
+ const index = tabEntries.findIndex((entry) => entry.id === current);
3858
+ let next = index;
3859
+ if (event.key === "ArrowLeft") next = index === 0 ? tabEntries.length - 1 : index - 1;
3860
+ else if (event.key === "ArrowRight") next = index === tabEntries.length - 1 ? 0 : index + 1;
3861
+ else if (event.key === "Home") next = 0;
3862
+ else if (event.key === "End") next = tabEntries.length - 1;
3863
+ selectSettingsTab(tabEntries[next].id, true);
3864
+ }
3865
+
3866
+ for (const entry of tabEntries) {
3867
+ const tabId = "hive-settings-tab-" + entry.id;
3868
+ const panelId = "hive-settings-panel-" + entry.id;
3869
+ const tab = element(doc, "button", "hive-settings-tab", translate(entry.labelKey));
3870
+ setAttr(tab, "type", "button");
3871
+ setAttr(tab, "role", "tab");
3872
+ setAttr(tab, "id", tabId);
3873
+ setAttr(tab, "aria-controls", panelId);
3874
+ setAttr(tab, "aria-selected", "false");
3875
+ setAttr(tab, "tabindex", "-1");
3876
+ tab.addEventListener("click", () => selectSettingsTab(entry.id, true));
3877
+ tab.addEventListener("keydown", (event) => onSettingsTabKeydown(event, entry.id));
3878
+ tabs.appendChild(tab);
3879
+ tabNodes.set(entry.id, tab);
3880
+
3881
+ const panel = element(doc, "div", "hive-settings-tabpanel");
3882
+ setAttr(panel, "role", "tabpanel");
3883
+ setAttr(panel, "id", panelId);
3884
+ setAttr(panel, "aria-labelledby", tabId);
3885
+ setHidden(panel, true);
3886
+ panel.appendChild(entry.section);
3887
+ panelWrap.appendChild(panel);
3888
+ panelNodes.set(entry.id, panel);
3889
+ }
3890
+ body.appendChild(tabs);
3891
+ body.appendChild(panelWrap);
3892
+ selectSettingsTab(settingsActiveTab, false);
3893
+ body.appendChild(queenSection);
3894
+ dialog.appendChild(body);
3181
3895
 
3182
3896
  overlay.appendChild(dialog);
3183
3897
  frame.appendChild(overlay);
@@ -3189,17 +3903,105 @@ function mount(root, options = {}) {
3189
3903
  errorNode,
3190
3904
  saveButton,
3191
3905
  busy: false,
3906
+ writable,
3907
+ supervisorAvailable,
3908
+ roleName: roleNameInput,
3909
+ roleAdapter: adapterInput,
3910
+ roleModel: modelInput,
3911
+ roleDescription: roleDescriptionInput,
3912
+ roleButton: addRoleButton,
3913
+ roleErrorNode,
3914
+ roleBusy: false,
3192
3915
  };
3193
- limitsFocusables = [closeButton, ...rowNodes.map((entry) => entry.input), saveButton];
3916
+ limitsFocusables = [
3917
+ closeButton,
3918
+ roleNameInput,
3919
+ adapterInput,
3920
+ modelInput,
3921
+ roleDescriptionInput,
3922
+ addRoleButton,
3923
+ ...rowNodes.map((entry) => entry.input),
3924
+ saveButton,
3925
+ ];
3194
3926
  if (typeof doc.addEventListener === "function") {
3195
3927
  doc.addEventListener("keydown", onLimitsKeydown);
3196
3928
  }
3197
- focusNode(rowNodes[0] ? rowNodes[0].input : closeButton);
3929
+ focusNode(writable ? roleNameInput : closeButton);
3930
+ }
3931
+
3932
+ function setRoleError(message) {
3933
+ if (!limitsState) return;
3934
+ limitsState.roleErrorNode.textContent = message || "";
3935
+ limitsState.roleErrorNode.className = "hive-limits-error" + (message ? "" : " is-hidden");
3936
+ }
3937
+
3938
+ async function saveRole() {
3939
+ const state = limitsState;
3940
+ if (!state || state.roleBusy || !state.writable) return;
3941
+ const name = String(state.roleName.value === null || state.roleName.value === undefined ? "" : state.roleName.value).trim();
3942
+ if (!/^[a-z][a-z0-9-]{1,31}$/.test(name)) {
3943
+ setRoleError(translate("settings.roleInvalid"));
3944
+ focusNode(state.roleName);
3945
+ return;
3946
+ }
3947
+ const adapter = ["dsh", "claude", "codex"].includes(String(state.roleAdapter.value || "dsh"))
3948
+ ? String(state.roleAdapter.value || "dsh")
3949
+ : "dsh";
3950
+ const model = String(state.roleModel.value === null || state.roleModel.value === undefined ? "" : state.roleModel.value).trim();
3951
+ if (model && !/^[A-Za-z0-9._:-]{1,64}$/.test(model)) {
3952
+ setRoleError(translate("settings.modelInvalid"));
3953
+ focusNode(state.roleModel);
3954
+ return;
3955
+ }
3956
+ const description = String(
3957
+ state.roleDescription.value === null || state.roleDescription.value === undefined ? "" : state.roleDescription.value,
3958
+ ).trim();
3959
+ if (description.length > 2000) {
3960
+ setRoleError(translate("settings.descriptionTooLong"));
3961
+ focusNode(state.roleDescription);
3962
+ return;
3963
+ }
3964
+
3965
+ state.roleBusy = true;
3966
+ state.roleName.disabled = true;
3967
+ state.roleAdapter.disabled = true;
3968
+ state.roleModel.disabled = true;
3969
+ state.roleDescription.disabled = true;
3970
+ state.roleButton.disabled = true;
3971
+ state.roleButton.textContent = translate("settings.addingRole");
3972
+ setRoleError("");
3973
+ try {
3974
+ const body = { name, adapter, description };
3975
+ if (model) body.model = model;
3976
+ const result = await requestAction("roles-add", body);
3977
+ if (!result.ok) {
3978
+ const detail = actionErrorDetail(result.error) || translate("settings.roleFailed");
3979
+ setRoleError(/already exists/i.test(detail) ? translate("settings.roleExists") : detail);
3980
+ return;
3981
+ }
3982
+ await refresh();
3983
+ await refreshSupervisor(true);
3984
+ if (destroyed) return;
3985
+ const trigger = limitsTriggerButton;
3986
+ closeLimitsDialog(false);
3987
+ openLimitsDialog(trigger);
3988
+ showToast("success", translate("settings.roleAdded"), name);
3989
+ } finally {
3990
+ if (!destroyed && limitsState === state) {
3991
+ state.roleBusy = false;
3992
+ state.roleName.disabled = false;
3993
+ state.roleAdapter.disabled = false;
3994
+ state.roleModel.disabled = false;
3995
+ state.roleDescription.disabled = false;
3996
+ state.roleButton.disabled = false;
3997
+ state.roleButton.textContent = translate("settings.addRoleButton");
3998
+ }
3999
+ }
3198
4000
  }
3199
4001
 
3200
4002
  async function saveBeeCounts() {
3201
4003
  const state = limitsState;
3202
- if (!state || state.busy) return;
4004
+ if (!state || state.busy || !state.writable || !state.supervisorAvailable) return;
3203
4005
  const roleLimits = {};
3204
4006
  let invalid = false;
3205
4007
  for (const entry of state.rows) {
@@ -3346,25 +4148,212 @@ function mount(root, options = {}) {
3346
4148
  if (!destroyed) showToast("success", translate("toast.planWritten"), translate("toast.pickupHint"));
3347
4149
  }
3348
4150
 
4151
+
4152
+ // --- new task dialog -----------------------------------------------------
4153
+
4154
+ function onAddKeydown(event) {
4155
+ if (event && (event.key === "Escape" || event.key === "Esc")) closeAddDialog();
4156
+ }
4157
+
4158
+ function closeAddDialog(restoreFocus = true) {
4159
+ if (addOverlay && addOverlay.parentNode) addOverlay.parentNode.removeChild(addOverlay);
4160
+ addOverlay = null;
4161
+ addDialogNode = null;
4162
+ addState = null;
4163
+ addFocusables = [];
4164
+ if (typeof doc.removeEventListener === "function") {
4165
+ doc.removeEventListener("keydown", onAddKeydown);
4166
+ }
4167
+ if (restoreFocus && !destroyed) focusNode(addTriggerButton);
4168
+ addTriggerButton = null;
4169
+ }
4170
+
4171
+ function setAddError(message) {
4172
+ if (!addState) return;
4173
+ addState.error.textContent = message || "";
4174
+ addState.error.className = message ? "hive-limits-error" : "hive-limits-error is-hidden";
4175
+ }
4176
+
4177
+ function addField(labelKey, input, hintKey) {
4178
+ const field = element(doc, "label", "hive-field");
4179
+ field.appendChild(element(doc, "span", "hive-field-label", translate(labelKey)));
4180
+ field.appendChild(input);
4181
+ if (hintKey) field.appendChild(element(doc, "span", "hive-field-hint", translate(hintKey)));
4182
+ return field;
4183
+ }
4184
+
4185
+ function openAddDialog(trigger) {
4186
+ if (destroyed || !lastModel || !lastModel.writable) return;
4187
+ closeHelp(false);
4188
+ closePlanDialog(false);
4189
+ closeLimitsDialog(false);
4190
+ closeDrawer(false);
4191
+ closeAddDialog(false);
4192
+ addTriggerButton = trigger || null;
4193
+
4194
+ const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim");
4195
+ overlay.addEventListener("click", (event) => {
4196
+ if (!event || !event.target || event.target === overlay) closeAddDialog();
4197
+ });
4198
+
4199
+ const dialog = element(doc, "div", "hive-dialog hive-add-dialog");
4200
+ setAttr(dialog, "role", "dialog");
4201
+ setAttr(dialog, "aria-modal", "true");
4202
+ setAttr(dialog, "aria-label", translate("add.dialogTitle"));
4203
+
4204
+ const head = element(doc, "div", "hive-dialog-head");
4205
+ const titleBox = element(doc, "div", "hive-dialog-head-title");
4206
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("add.dialogTitle")));
4207
+ head.appendChild(titleBox);
4208
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost hive-add-close", "×");
4209
+ setAttr(closeButton, "type", "button");
4210
+ setAttr(closeButton, "title", translate("settings.closeAria"));
4211
+ setAttr(closeButton, "aria-label", translate("settings.closeAria"));
4212
+ closeButton.addEventListener("click", () => {
4213
+ closeAddDialog();
4214
+ });
4215
+ head.appendChild(closeButton);
4216
+ dialog.appendChild(head);
4217
+
4218
+ const body = element(doc, "div", "hive-dialog-body hive-add-body");
4219
+ const titleInput = element(doc, "input", "hive-input hive-add-title");
4220
+ setAttr(titleInput, "type", "text");
4221
+ setAttr(titleInput, "maxlength", "2000");
4222
+ setAttr(titleInput, "autocomplete", "off");
4223
+ setAttr(titleInput, "aria-label", translate("add.titleAria"));
4224
+ body.appendChild(addField("add.title", titleInput));
4225
+
4226
+ const roleInput = element(doc, "input", "hive-input hive-add-role");
4227
+ setAttr(roleInput, "type", "text");
4228
+ setAttr(roleInput, "autocomplete", "off");
4229
+ setAttr(roleInput, "aria-label", translate("add.roleAria"));
4230
+ roleInput.value = "coder";
4231
+ body.appendChild(addField("add.role", roleInput));
4232
+
4233
+ const scopeInput = element(doc, "input", "hive-input hive-add-scope");
4234
+ setAttr(scopeInput, "type", "text");
4235
+ setAttr(scopeInput, "autocomplete", "off");
4236
+ setAttr(scopeInput, "aria-label", translate("add.scopeAria"));
4237
+ body.appendChild(addField("add.scope", scopeInput));
4238
+
4239
+ const afterInput = element(doc, "input", "hive-input hive-add-after");
4240
+ setAttr(afterInput, "type", "text");
4241
+ setAttr(afterInput, "autocomplete", "off");
4242
+ setAttr(afterInput, "aria-label", translate("add.afterAria"));
4243
+ body.appendChild(addField("add.after", afterInput));
4244
+
4245
+ const acceptanceInput = element(doc, "textarea", "hive-textarea hive-add-acceptance");
4246
+ setAttr(acceptanceInput, "maxlength", "2000");
4247
+ setAttr(acceptanceInput, "rows", "3");
4248
+ setAttr(acceptanceInput, "aria-label", translate("add.acceptanceAria"));
4249
+ body.appendChild(addField("add.acceptance", acceptanceInput));
4250
+
4251
+ const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
4252
+ body.appendChild(errorNode);
4253
+ dialog.appendChild(body);
4254
+
4255
+ const foot = element(doc, "div", "hive-dialog-foot");
4256
+ const cancelButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("add.cancel"));
4257
+ setAttr(cancelButton, "type", "button");
4258
+ cancelButton.addEventListener("click", () => {
4259
+ closeAddDialog();
4260
+ });
4261
+ const submitButton = element(doc, "button", "hive-btn hive-add-submit", translate("add.submit"));
4262
+ setAttr(submitButton, "type", "button");
4263
+ submitButton.addEventListener("click", () => {
4264
+ void submitAdd();
4265
+ });
4266
+ foot.appendChild(cancelButton);
4267
+ foot.appendChild(submitButton);
4268
+ dialog.appendChild(foot);
4269
+
4270
+ overlay.appendChild(dialog);
4271
+ frame.appendChild(overlay);
4272
+ addOverlay = overlay;
4273
+ addDialogNode = dialog;
4274
+ addState = {
4275
+ overlay,
4276
+ dialog,
4277
+ title: titleInput,
4278
+ role: roleInput,
4279
+ scope: scopeInput,
4280
+ after: afterInput,
4281
+ acceptance: acceptanceInput,
4282
+ error: errorNode,
4283
+ submit: submitButton,
4284
+ cancel: cancelButton,
4285
+ busy: false,
4286
+ };
4287
+ addFocusables = [closeButton, titleInput, roleInput, scopeInput, afterInput, acceptanceInput, cancelButton, submitButton];
4288
+ if (typeof doc.addEventListener === "function") {
4289
+ doc.addEventListener("keydown", onAddKeydown);
4290
+ }
4291
+ focusNode(titleInput);
4292
+ }
4293
+
4294
+ function setAddBusy(busy) {
4295
+ if (!addState) return;
4296
+ addState.busy = busy;
4297
+ addState.title.disabled = busy;
4298
+ addState.role.disabled = busy;
4299
+ addState.scope.disabled = busy;
4300
+ addState.after.disabled = busy;
4301
+ addState.acceptance.disabled = busy;
4302
+ addState.cancel.disabled = busy;
4303
+ addState.submit.disabled = busy;
4304
+ addState.submit.textContent = busy ? translate("add.submitting") : translate("add.submit");
4305
+ }
4306
+
4307
+ async function submitAdd() {
4308
+ if (!addState || addState.busy) return;
4309
+ const title = String(addState.title.value || "").trim();
4310
+ if (!title) {
4311
+ setAddError(translate("add.required"));
4312
+ focusNode(addState.title);
4313
+ return;
4314
+ }
4315
+ const role = String(addState.role.value || "").trim() || "coder";
4316
+ const body = {
4317
+ title,
4318
+ role,
4319
+ scope: splitList(String(addState.scope.value || "")),
4320
+ after: splitList(String(addState.after.value || "")),
4321
+ acceptance: String(addState.acceptance.value || "").trim(),
4322
+ };
4323
+ setAddError("");
4324
+ setAddBusy(true);
4325
+ const result = await postAction("add", body);
4326
+ if (destroyed || !addState) return;
4327
+ if (result) {
4328
+ closeAddDialog();
4329
+ return;
4330
+ }
4331
+ setAddBusy(false);
4332
+ setAddError(translate("status.actionFailed"));
4333
+ }
4334
+
3349
4335
  // --- drawer --------------------------------------------------------------
3350
4336
 
3351
4337
  function onDrawerKeydown(event) {
3352
4338
  if (event && (event.key === "Escape" || event.key === "Esc")) closeDrawer();
3353
4339
  }
3354
4340
 
3355
- function closeDrawer() {
4341
+ function closeDrawer(restoreFocus = true) {
3356
4342
  if (drawerNode && drawerNode.parentNode) drawerNode.parentNode.removeChild(drawerNode);
3357
4343
  drawerNode = null;
3358
4344
  drawerState = null;
3359
4345
  if (typeof doc.removeEventListener === "function") {
3360
4346
  doc.removeEventListener("keydown", onDrawerKeydown);
3361
4347
  }
4348
+ if (restoreFocus && !destroyed) focusNode(drawerTrigger);
4349
+ drawerTrigger = null;
3362
4350
  }
3363
4351
 
3364
4352
  function mountDrawer(eyebrow, title, ariaLabel) {
3365
4353
  closeHelp(false);
3366
4354
  closePlanDialog(false);
3367
- closeDrawer();
4355
+ closeAddDialog(false);
4356
+ closeDrawer(false);
3368
4357
 
3369
4358
  const panel = element(doc, "aside", "hive-drawer");
3370
4359
  setAttr(panel, "role", "dialog");
@@ -3409,45 +4398,108 @@ function mount(root, options = {}) {
3409
4398
  body.appendChild(element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2)));
3410
4399
  }
3411
4400
 
3412
- function openDrawer(card, lane) {
4401
+ function openDrawer(card, lane, trigger) {
4402
+ closeHelp(false);
4403
+ closePlanDialog(false);
4404
+ closeAddDialog(false);
4405
+ closeDrawer(false);
4406
+ drawerTrigger = trigger || null;
4407
+
3413
4408
  const raw = findRawTask(card) || { ...card, state: lane };
3414
4409
  const title = card.title || translate("card.untitled");
3415
- const body = mountDrawer(
3416
- laneLabel(lane) + " · " + (card.id || translate("card.noId")),
3417
- title,
3418
- translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled")),
3419
- );
3420
- drawerState = { kind: "card", card, lane };
3421
- const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
4410
+ const id = card.id || translate("card.noId");
4411
+ const role = asString(card.role) || "—";
4412
+ const status = laneLabel(lane);
4413
+ const repo = lastModel ? lastModel.repo : "";
4414
+ const ariaLabel = translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled"));
4415
+
4416
+ const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim hive-card-scrim");
4417
+ overlay.addEventListener("click", (event) => {
4418
+ if (!event || !event.target || event.target === overlay) closeDrawer();
4419
+ });
3422
4420
 
4421
+ const dialog = element(doc, "div", "hive-dialog hive-card-dialog hive-drawer");
4422
+ setAttr(dialog, "role", "dialog");
4423
+ setAttr(dialog, "aria-modal", "true");
4424
+ setAttr(dialog, "aria-label", ariaLabel);
4425
+
4426
+ const head = element(doc, "div", "hive-dialog-head");
4427
+ const titleBox = element(doc, "div", "hive-dialog-head-title");
4428
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", title));
4429
+ const subline = element(doc, "div", "hive-card-subline");
4430
+ const sublineText = [id, role, status, repo].filter(Boolean).join(" · ");
4431
+ subline.textContent = sublineText;
4432
+ setAttr(subline, "title", sublineText);
4433
+ titleBox.appendChild(subline);
4434
+ head.appendChild(titleBox);
4435
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost hive-card-close", "×");
4436
+ setAttr(closeButton, "type", "button");
4437
+ setAttr(closeButton, "title", translate("drawer.closeAria"));
4438
+ setAttr(closeButton, "aria-label", translate("drawer.closeAria"));
4439
+ closeButton.addEventListener("click", () => {
4440
+ closeDrawer();
4441
+ });
4442
+ head.appendChild(closeButton);
4443
+ dialog.appendChild(head);
4444
+
4445
+ const body = element(doc, "div", "hive-dialog-body hive-card-body");
4446
+ const details = element(doc, "details", "hive-card-json");
4447
+ const summary = element(doc, "summary", "hive-card-json-summary", translate("drawer.rawJson"));
4448
+ const pre = element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2));
4449
+ details.appendChild(summary);
4450
+ details.appendChild(pre);
4451
+ body.appendChild(details);
4452
+ dialog.appendChild(body);
4453
+
4454
+ const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
4455
+ if (actions.length === 0) {
4456
+ body.appendChild(
4457
+ element(
4458
+ doc,
4459
+ "div",
4460
+ "hive-note",
4461
+ lastModel && lastModel.writable ? translate("drawer.noActions") : translate("drawer.readOnly"),
4462
+ ),
4463
+ );
4464
+ }
3423
4465
  if (actions.length > 0) {
3424
- const actionRow = element(doc, "div", "hive-actions-row");
3425
- setAttr(actionRow, "aria-label", translate("drawer.cardActions"));
4466
+ const foot = element(doc, "div", "hive-dialog-foot hive-card-actions");
4467
+ setAttr(foot, "aria-label", translate("drawer.cardActions"));
4468
+ const claimed = asString(card.state || lane) === "claimed";
3426
4469
  for (const action of actions) {
3427
- const button = element(doc, "button", "hive-btn", translate(action.labelKey));
4470
+ const destructive = action.name === "remove";
4471
+ const button = element(
4472
+ doc,
4473
+ "button",
4474
+ "hive-btn" + (destructive ? " hive-btn-danger" : ""),
4475
+ translate(action.labelKey),
4476
+ );
3428
4477
  setAttr(button, "type", "button");
3429
- setAttr(button, "title", translate(action.helpKey));
3430
- setAttr(button, "aria-label", translate(action.helpKey));
4478
+ // The panel never sends --force, so a claimed card's delete control is
4479
+ // rendered but disabled, with the release/reopen reason in its title.
4480
+ const hint = destructive && claimed ? translate("drawer.removeClaimed") : translate(action.helpKey);
4481
+ setAttr(button, "title", hint);
4482
+ setAttr(button, "aria-label", hint);
4483
+ if (destructive && claimed) {
4484
+ button.disabled = true;
4485
+ setAttr(button, "aria-disabled", "true");
4486
+ }
3431
4487
  button.addEventListener("click", () => {
3432
4488
  void runCardAction(action.name, card, lane);
3433
4489
  });
3434
- actionRow.appendChild(button);
4490
+ foot.appendChild(button);
3435
4491
  }
3436
- body.appendChild(actionRow);
3437
- } else {
3438
- const note = element(
3439
- doc,
3440
- "div",
3441
- "hive-note",
3442
- lastModel && lastModel.writable ? translate("drawer.noActions") : translate("drawer.readOnly"),
3443
- );
3444
- body.appendChild(note);
4492
+ dialog.appendChild(foot);
3445
4493
  }
3446
4494
 
3447
- const label = element(doc, "div", "hive-section-label", translate("drawer.rawJson"));
3448
- body.appendChild(label);
3449
- const pre = element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2));
3450
- body.appendChild(pre);
4495
+ overlay.appendChild(dialog);
4496
+ frame.appendChild(overlay);
4497
+ drawerNode = overlay;
4498
+ drawerState = { kind: "card", card, lane };
4499
+ if (typeof doc.addEventListener === "function") {
4500
+ doc.addEventListener("keydown", onDrawerKeydown);
4501
+ }
4502
+ focusNode(closeButton);
3451
4503
  }
3452
4504
 
3453
4505
  // --- actions -------------------------------------------------------------
@@ -3596,34 +4648,12 @@ function mount(root, options = {}) {
3596
4648
  case "mode":
3597
4649
  await postAction("mode", action.body || { mode: "free", reason: "panel" });
3598
4650
  break;
3599
- case "add": {
3600
- const title = ask(translate("prompt.newTitle"), "");
3601
- if (title === null || !title.trim()) return;
3602
- const role = ask(translate("prompt.role"), "coder");
3603
- if (role === null) return;
3604
- const scope = ask(translate("prompt.scope"), "");
3605
- if (scope === null) return;
3606
- const after = ask(translate("prompt.after"), "");
3607
- if (after === null) return;
3608
- await postAction("add", {
3609
- title: title.trim(),
3610
- role: role.trim() || "coder",
3611
- scope: splitList(scope),
3612
- after: splitList(after),
3613
- });
4651
+ case "add":
4652
+ openAddDialog(triggerButton);
3614
4653
  break;
3615
- }
3616
4654
  case "plan":
3617
4655
  openPlanDialog(triggerButton);
3618
4656
  break;
3619
- case "commit": {
3620
- const message = ask(translate("prompt.commitMessage"), "panel commit");
3621
- if (message === null) return;
3622
- const paths = ask(translate("prompt.paths"), "");
3623
- if (paths === null) return;
3624
- await postAction("commit", { message: message.trim() || "panel commit", set: splitList(paths) });
3625
- break;
3626
- }
3627
4657
  default:
3628
4658
  break;
3629
4659
  }
@@ -3656,10 +4686,18 @@ function mount(root, options = {}) {
3656
4686
  case "retry":
3657
4687
  ok = await postAction("retry", { id: card.id });
3658
4688
  break;
4689
+ case "remove": {
4690
+ const name = card.title || card.id || translate("card.untitled");
4691
+ const message = translate("confirm.remove").replace("{title}", name);
4692
+ if (!askConfirm(message)) return;
4693
+ ok = await postAction("remove", { id: card.id });
4694
+ break;
4695
+ }
3659
4696
  default:
3660
4697
  break;
3661
4698
  }
3662
4699
  if (ok && !destroyed) {
4700
+ if (name === "remove") showToast("success", translate("toast.taskRemoved"), "");
3663
4701
  closeDrawer();
3664
4702
  void refresh();
3665
4703
  }
@@ -3808,10 +4846,9 @@ function mount(root, options = {}) {
3808
4846
  renderSupervisorContent();
3809
4847
  } catch {
3810
4848
  supervisorData = [];
4849
+ supervisorInlineRow = null;
3811
4850
  try {
3812
- supervisorBar.className = "hive-supervisor is-hidden";
3813
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden";
3814
- if (limitsDialogNode) closeLimitsDialog(false);
4851
+ supervisorInline.className = "hive-supervisor-inline is-hidden";
3815
4852
  } catch {
3816
4853
  // Supervisor rendering is optional; never let it break the panel.
3817
4854
  }
@@ -3819,53 +4856,38 @@ function mount(root, options = {}) {
3819
4856
  }
3820
4857
 
3821
4858
  function renderSupervisorContent() {
3822
- clearNode(supervisorRepos);
3823
- supervisorLabel.textContent = translate("supervisor.label");
3824
- setAttr(supervisorBar, "aria-label", translate("supervisor.aria"));
3825
- if (!Array.isArray(supervisorData) || supervisorData.length === 0) {
3826
- supervisorBar.className = "hive-supervisor is-hidden";
3827
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden";
3828
- if (limitsDialogNode) closeLimitsDialog(false);
3829
- return;
3830
- }
3831
- supervisorBar.className = "hive-supervisor";
3832
- const canConfigure = Boolean(lastModel && lastModel.writable);
3833
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits" + (canConfigure ? "" : " is-hidden");
3834
- supervisorLimitsButton.textContent = translate("limits.open");
3835
- setAttr(supervisorLimitsButton, "title", translate("limits.openAria"));
3836
- setAttr(supervisorLimitsButton, "aria-label", translate("limits.openAria"));
3837
- if (!canConfigure && limitsDialogNode) closeLimitsDialog(false);
3838
- for (const row of supervisorData) {
3839
- const item = element(doc, "span", "hive-supervisor-item");
3840
- const path = element(doc, "code", "hive-supervisor-path", row.repo);
3841
- setAttr(path, "title", row.repo);
3842
- item.appendChild(path);
3843
-
3844
- let stateLabel = translate("supervisor.idle");
3845
- if (row.state === "running") {
3846
- stateLabel =
3847
- row.running === null || row.running === undefined
3848
- ? translate("supervisor.running")
3849
- : translate("supervisor.runningCount").replace("{count}", String(row.running));
3850
- } else if (row.state === "backoff") {
3851
- stateLabel = translate("supervisor.backoff");
3852
- } else if (row.state === "paused") {
3853
- stateLabel = translate("supervisor.paused");
3854
- }
3855
- item.appendChild(element(doc, "span", "hive-supervisor-state is-" + row.state, stateLabel));
4859
+ supervisorInlineRow = null;
4860
+ supervisorInline.className = "hive-supervisor-inline is-hidden";
4861
+ supervisorInlineState.className = "hive-supervisor-inline-state";
4862
+ supervisorInlineState.textContent = "";
4863
+ supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume is-hidden";
4864
+ setAttr(supervisorInline, "aria-label", translate("supervisor.aria"));
4865
+ supervisorInlineLabel.textContent = translate("supervisor.label");
4866
+ if (!lastModel || !Array.isArray(supervisorData) || supervisorData.length === 0) return;
4867
+ const row = supervisorData.find((entry) => entry.repo === lastModel.repo);
4868
+ if (!row) return;
3856
4869
 
3857
- if (row.state === "paused") {
3858
- const button = element(doc, "button", "hive-btn hive-supervisor-resume", translate("supervisor.resume"));
3859
- setAttr(button, "type", "button");
3860
- const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
3861
- setAttr(button, "title", aria);
3862
- setAttr(button, "aria-label", aria);
3863
- button.addEventListener("click", () => {
3864
- void resumeSupervisor(row, button);
3865
- });
3866
- item.appendChild(button);
3867
- }
3868
- supervisorRepos.appendChild(item);
4870
+ supervisorInlineRow = row;
4871
+ supervisorInline.className = "hive-supervisor-inline";
4872
+ let stateLabel = translate("supervisor.idle");
4873
+ if (row.state === "running") {
4874
+ stateLabel =
4875
+ row.running === null || row.running === undefined
4876
+ ? translate("supervisor.running")
4877
+ : translate("supervisor.runningCount").replace("{count}", String(row.running));
4878
+ } else if (row.state === "backoff") {
4879
+ stateLabel = translate("supervisor.backoff");
4880
+ } else if (row.state === "paused") {
4881
+ stateLabel = translate("supervisor.paused");
4882
+ }
4883
+ supervisorInlineState.className = "hive-supervisor-inline-state is-" + row.state;
4884
+ supervisorInlineState.textContent = stateLabel;
4885
+
4886
+ if (row.state === "paused") {
4887
+ const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
4888
+ supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume";
4889
+ setAttr(supervisorInlineResume, "title", aria);
4890
+ setAttr(supervisorInlineResume, "aria-label", aria);
3869
4891
  }
3870
4892
  }
3871
4893
 
@@ -4103,11 +5125,11 @@ function mount(root, options = {}) {
4103
5125
  foot.appendChild(element(doc, "span", "hive-card-state", laneLabel(lane)));
4104
5126
  node.appendChild(foot);
4105
5127
 
4106
- node.addEventListener("click", () => openDrawer(card, lane));
5128
+ node.addEventListener("click", () => openDrawer(card, lane, node));
4107
5129
  node.addEventListener("keydown", (event) => {
4108
5130
  if (!event || (event.key !== "Enter" && event.key !== " ")) return;
4109
5131
  if (typeof event.preventDefault === "function") event.preventDefault();
4110
- openDrawer(card, lane);
5132
+ openDrawer(card, lane, node);
4111
5133
  });
4112
5134
  return node;
4113
5135
  }
@@ -4233,8 +5255,6 @@ function mount(root, options = {}) {
4233
5255
  function render(model) {
4234
5256
  repoNode.textContent = model.repo || "—";
4235
5257
  setAttr(repoNode, "title", model.repo);
4236
- timeNode.textContent = model.at ? formatStamp(model.at) : "—";
4237
- setAttr(timeNode, "datetime", model.at);
4238
5258
 
4239
5259
  renderInit(model);
4240
5260
  renderQueenHint(model);
@@ -4257,6 +5277,7 @@ function mount(root, options = {}) {
4257
5277
  if (helpWasOpen) closeHelp(false);
4258
5278
  if (planDialogNode) closePlanDialog(false);
4259
5279
  if (limitsDialogNode) closeLimitsDialog(false);
5280
+ if (addDialogNode) closeAddDialog(false);
4260
5281
  try {
4261
5282
  applyChrome();
4262
5283
  if (lastModel) render(lastModel);
@@ -4381,6 +5402,7 @@ function mount(root, options = {}) {
4381
5402
  closeHelp(false);
4382
5403
  closePlanDialog(false);
4383
5404
  closeLimitsDialog(false);
5405
+ closeAddDialog(false);
4384
5406
  closeToast();
4385
5407
  closeDrawer();
4386
5408
  if (frame.parentNode) frame.parentNode.removeChild(frame);