dsh-hive-panel 0.1.3 → 0.1.5

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
@@ -37,26 +37,30 @@ const MAX_EVENTS = 80;
37
37
  const DEFAULT_SNAPSHOT_URL = "/api/snapshot";
38
38
  const DEFAULT_ACTIONS_URL = "/api/actions";
39
39
  const DEFAULT_SUPERVISOR_URL = "/api/hive-runner";
40
+ const QUEEN_DISMISS_KEY = "hive.queenNoticeDismissed";
40
41
  const DEFAULT_INTERVAL_MS = 3000;
41
42
 
42
43
  const CARD_ACTIONS = Object.freeze({
43
- pending: Object.freeze(["claim"]),
44
- claimed: Object.freeze(["done", "fail"]),
45
- done: Object.freeze([]),
46
- blocked: Object.freeze(["retry"]),
47
- 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"]),
48
52
  });
49
53
 
50
54
  const ACTION_META = Object.freeze({
51
- freeze: { labelKey: "action.freeze", helpKey: "help.action.freeze", paramsKey: "help.params.mode" },
52
- unfreeze: { labelKey: "action.unfreeze", helpKey: "help.action.unfreeze", paramsKey: "help.params.mode" },
53
- add: { labelKey: "action.add", helpKey: "help.action.add", paramsKey: "help.params.add" },
54
- plan: { labelKey: "action.plan", helpKey: "help.action.plan", paramsKey: "help.params.plan" },
55
- commit: { labelKey: "action.commit", helpKey: "help.action.commit", paramsKey: "help.params.commit" },
56
- claim: { labelKey: "action.claim", helpKey: "help.action.claim", paramsKey: "help.params.claim" },
57
- done: { labelKey: "action.done", helpKey: "help.action.done", paramsKey: "help.params.done" },
58
- fail: { labelKey: "action.fail", helpKey: "help.action.fail", paramsKey: "help.params.fail" },
59
- 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" },
60
64
  });
61
65
 
62
66
  const MIN_PLAN_CARDS = 1;
@@ -129,6 +133,23 @@ const PANEL_STYLES = `.hive { position: relative; }
129
133
  font-weight: 700;
130
134
  }
131
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
+
132
153
  .hive-overlay { position: absolute; inset: 0; z-index: 2147483000; }
133
154
  .hive-help-scrim { background: transparent; }
134
155
  .hive-dialog-scrim {
@@ -719,8 +740,9 @@ const PANEL_STYLES = `.hive { position: relative; }
719
740
  .hive-queen-hint {
720
741
  display: none;
721
742
  flex: 0 0 auto;
722
- flex-direction: column;
723
- gap: 4px;
743
+ align-items: flex-start;
744
+ flex-direction: row;
745
+ gap: 8px;
724
746
  padding: 10px 16px;
725
747
  border-bottom: 1px solid color-mix(in srgb, var(--hive-accent, #58c4dc) 32%, var(--hive-line, #232b38));
726
748
  background: var(--hive-accent-soft);
@@ -762,6 +784,14 @@ const PANEL_STYLES = `.hive { position: relative; }
762
784
  color: var(--hive-fg-soft);
763
785
  }
764
786
 
787
+ .hive-queen-body {
788
+ display: flex;
789
+ flex: 1 1 auto;
790
+ flex-direction: column;
791
+ gap: 4px;
792
+ min-width: 0;
793
+ }
794
+
765
795
  .hive-queen-offer {
766
796
  display: flex;
767
797
  flex-wrap: wrap;
@@ -770,8 +800,18 @@ const PANEL_STYLES = `.hive { position: relative; }
770
800
  max-width: 76ch;
771
801
  }
772
802
 
773
- .hive-queen-offer.is-hidden,
774
- .hive-queen-exit.is-hidden { display: none; }
803
+ .hive-queen-offer.is-hidden { display: none; }
804
+
805
+ .hive-queen-dismiss {
806
+ flex: 0 0 auto;
807
+ min-width: 24px;
808
+ padding: 0 6px;
809
+ color: var(--hive-fg-soft);
810
+ font-size: 16px;
811
+ line-height: 1.4;
812
+ }
813
+
814
+ .hive-queen-dismiss.is-hidden { display: none; }
775
815
 
776
816
  .hive-queen-takeover {
777
817
  border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 45%, var(--hive-line, #232b38));
@@ -791,28 +831,6 @@ const PANEL_STYLES = `.hive { position: relative; }
791
831
  overflow-wrap: anywhere;
792
832
  }
793
833
 
794
- .hive-queen-exit {
795
- display: flex;
796
- flex-wrap: wrap;
797
- align-items: baseline;
798
- gap: 5px;
799
- max-width: 76ch;
800
- color: color-mix(in srgb, var(--hive-accent, #58c4dc) 80%, var(--hive-fg, #e6edf3));
801
- }
802
-
803
- .hive-queen-command {
804
- padding: 1px 6px;
805
- border: 1px solid color-mix(in srgb, var(--hive-accent, #58c4dc) 30%, var(--hive-line, #232b38));
806
- border-radius: 4px;
807
- background: color-mix(in srgb, var(--hive-fg, #e6edf3) 10%, transparent);
808
- color: var(--hive-fg, #e6edf3);
809
- font-family: var(--hive-mono);
810
- font-size: 10px;
811
- line-height: 1.5;
812
- cursor: text;
813
- user-select: text;
814
- }
815
-
816
834
  .hive-queen-output {
817
835
  margin-top: 6px;
818
836
  border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 32%, var(--hive-line, #232b38));
@@ -940,7 +958,7 @@ const PANEL_STYLES = `.hive { position: relative; }
940
958
 
941
959
  .hive-limits-row {
942
960
  display: grid;
943
- grid-template-columns: minmax(0, 1fr) 72px 48px 48px;
961
+ grid-template-columns: minmax(0, 1fr) 96px 48px 48px;
944
962
  align-items: center;
945
963
  gap: 6px;
946
964
  min-width: 0;
@@ -1036,6 +1054,95 @@ const PANEL_STYLES = `.hive { position: relative; }
1036
1054
  overflow-wrap: anywhere;
1037
1055
  }
1038
1056
 
1057
+ .hive-supervisor-inline {
1058
+ display: inline-flex;
1059
+ flex-wrap: wrap;
1060
+ align-items: center;
1061
+ gap: 5px;
1062
+ min-width: 0;
1063
+ padding: 1px 8px;
1064
+ border: 1px solid var(--hive-line, #232b38);
1065
+ border-radius: 999px;
1066
+ background: var(--hive-surface);
1067
+ color: var(--hive-fg-soft);
1068
+ font-size: 10px;
1069
+ line-height: 1.6;
1070
+ }
1071
+
1072
+ .hive-supervisor-inline.is-hidden { display: none; }
1073
+
1074
+ .hive-supervisor-inline-label {
1075
+ color: var(--hive-fg-faint);
1076
+ font-size: 9.5px;
1077
+ font-weight: 650;
1078
+ letter-spacing: 0.1em;
1079
+ text-transform: uppercase;
1080
+ }
1081
+
1082
+ .hive-supervisor-inline-state {
1083
+ color: var(--hive-fg-soft);
1084
+ font-weight: 600;
1085
+ white-space: nowrap;
1086
+ }
1087
+
1088
+ .hive-supervisor-inline-state.is-running { color: var(--hive-ok); }
1089
+ .hive-supervisor-inline-state.is-idle { color: var(--hive-fg-soft); }
1090
+ .hive-supervisor-inline-state.is-backoff { color: var(--hive-warn); }
1091
+ .hive-supervisor-inline-state.is-paused { color: var(--hive-danger); }
1092
+
1093
+ .hive-supervisor-inline-resume {
1094
+ padding: 1px 6px;
1095
+ font-size: 9.5px;
1096
+ line-height: 1.3;
1097
+ }
1098
+
1099
+ .hive-supervisor-inline-resume.is-hidden { display: none; }
1100
+
1101
+ .hive-settings-trigger {
1102
+ flex: 0 0 auto;
1103
+ min-width: 28px;
1104
+ padding-inline: 8px;
1105
+ font-size: 14px;
1106
+ line-height: 1.2;
1107
+ }
1108
+
1109
+ .hive-settings-section {
1110
+ display: flex;
1111
+ flex-direction: column;
1112
+ gap: 8px;
1113
+ min-width: 0;
1114
+ padding-top: 12px;
1115
+ border-top: 1px solid color-mix(in srgb, var(--hive-line, #232b38) 70%, transparent);
1116
+ }
1117
+
1118
+ .hive-settings-section:first-of-type { padding-top: 0; border-top: 0; }
1119
+
1120
+ .hive-settings-section-title {
1121
+ color: var(--hive-fg, #e6edf3);
1122
+ font-size: 11px;
1123
+ font-weight: 650;
1124
+ letter-spacing: 0.08em;
1125
+ text-transform: uppercase;
1126
+ }
1127
+
1128
+ .hive-settings-role-form { align-items: flex-end; }
1129
+
1130
+ .hive-settings-role-description { width: 100%; }
1131
+
1132
+ .hive-settings-role-description .hive-textarea { width: 100%; }
1133
+
1134
+ .hive-settings-role-form .hive-field:first-child { flex: 1 1 200px; }
1135
+
1136
+ .hive-settings-note {
1137
+ padding: 8px 10px;
1138
+ border: 1px solid color-mix(in srgb, var(--hive-warn) 38%, var(--hive-line, #232b38));
1139
+ border-radius: 6px;
1140
+ background: color-mix(in srgb, var(--hive-warn) 9%, transparent);
1141
+ color: var(--hive-warn);
1142
+ font-size: 10.5px;
1143
+ line-height: 1.55;
1144
+ }
1145
+
1039
1146
  /* -------------------------------------------------------------------- spacing */
1040
1147
  .hive {
1041
1148
  gap: 8px;
@@ -1072,8 +1179,7 @@ const PANEL_STYLES = `.hive { position: relative; }
1072
1179
  .hive-plan-hint,
1073
1180
  .hive-limits-description,
1074
1181
  .hive-limits-hint,
1075
- .hive-queen-text,
1076
- .hive-queen-exit { max-width: 76ch; line-height: 1.55; }
1182
+ .hive-queen-text { max-width: 76ch; line-height: 1.55; }
1077
1183
 
1078
1184
  .hive-empty,
1079
1185
  .hive-filter-empty,
@@ -1110,6 +1216,46 @@ const PANEL_STYLES = `.hive { position: relative; }
1110
1216
  line-height: 1.55;
1111
1217
  }
1112
1218
 
1219
+ .hive-icon-button {
1220
+ display: inline-flex;
1221
+ flex: 0 0 28px;
1222
+ align-items: center;
1223
+ justify-content: center;
1224
+ width: 28px;
1225
+ min-width: 28px;
1226
+ height: 28px;
1227
+ padding: 0;
1228
+ border: 0;
1229
+ border-color: transparent;
1230
+ background: transparent;
1231
+ color: color-mix(in srgb, var(--hive-fg, #e6edf3) 80%, transparent);
1232
+ font-size: 0;
1233
+ line-height: 1;
1234
+ box-shadow: none;
1235
+ cursor: pointer;
1236
+ }
1237
+
1238
+ .hive-icon-button:hover {
1239
+ border: 0;
1240
+ border-color: transparent;
1241
+ background: transparent;
1242
+ color: var(--hive-fg, #e6edf3);
1243
+ }
1244
+
1245
+ .hive-icon-button:active { transform: none; }
1246
+
1247
+ .hive-icon-button:focus-visible {
1248
+ outline: 2px solid var(--hive-accent, #58c4dc);
1249
+ outline-offset: 1px;
1250
+ }
1251
+
1252
+ .hive-icon-button svg {
1253
+ display: block;
1254
+ width: 16px;
1255
+ height: 16px;
1256
+ pointer-events: none;
1257
+ }
1258
+
1113
1259
  @media (max-width: 520px) {
1114
1260
  .hive { gap: 6px; padding: 12px; }
1115
1261
  .hive-bar,
@@ -1134,7 +1280,183 @@ const PANEL_STYLES = `.hive { position: relative; }
1134
1280
  .hive-dialog-foot .hive-btn { flex: 1 1 auto; }
1135
1281
  .hive-help { right: 8px; width: calc(100% - 16px); max-height: 66vh; }
1136
1282
  .hive-toast { right: 8px; bottom: 8px; width: calc(100% - 16px); }
1137
- }`;
1283
+ }
1284
+
1285
+ .hive-settings-actions {
1286
+ display: flex;
1287
+ align-items: center;
1288
+ justify-content: flex-end;
1289
+ gap: 8px;
1290
+ width: 100%;
1291
+ }
1292
+
1293
+ .hive-settings-actions .hive-btn {
1294
+ display: inline-flex;
1295
+ flex: 0 0 auto;
1296
+ align-items: center;
1297
+ justify-content: center;
1298
+ height: 28px;
1299
+ min-height: 28px;
1300
+ padding: 0 14px;
1301
+ border-radius: 7px;
1302
+ font-size: 11.5px;
1303
+ line-height: 1;
1304
+ }
1305
+
1306
+ .hive-settings-primary {
1307
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1308
+ background: var(--hive-accent, #58c4dc);
1309
+ color: var(--hive-bg, #0b0f17);
1310
+ }
1311
+
1312
+ .hive-settings-primary:hover {
1313
+ border-color: var(--hive-accent, #58c4dc);
1314
+ background: color-mix(in srgb, var(--hive-accent, #58c4dc) 86%, white);
1315
+ color: var(--hive-bg, #0b0f17);
1316
+ }
1317
+
1318
+ .hive-settings-secondary {
1319
+ border-color: var(--hive-line, #232b38);
1320
+ background: var(--hive-surface-strong);
1321
+ color: var(--hive-fg, #e6edf3);
1322
+ }
1323
+
1324
+ .hive-settings-secondary:hover {
1325
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 40%, var(--hive-line, #232b38));
1326
+ background: var(--hive-surface-hover);
1327
+ color: var(--hive-fg, #e6edf3);
1328
+ }
1329
+
1330
+ .hive-settings-actions .hive-btn:disabled {
1331
+ opacity: 0.55;
1332
+ cursor: not-allowed;
1333
+ }
1334
+
1335
+ @media (max-width: 420px) {
1336
+ .hive-settings-actions { justify-content: stretch; }
1337
+ .hive-settings-actions .hive-btn { flex: 1 1 0; }
1338
+ }
1339
+
1340
+ @container hiveboard (max-width: 419px) {
1341
+ .hive-settings-actions { justify-content: stretch; }
1342
+ .hive-settings-actions .hive-btn { flex: 1 1 0; }
1343
+ }
1344
+
1345
+ .hive-card-scrim { padding: 12px; }
1346
+
1347
+ .hive-card-dialog {
1348
+ position: relative;
1349
+ inset: auto;
1350
+ width: min(720px, 92vw);
1351
+ max-width: 92vw;
1352
+ height: auto;
1353
+ max-height: 80vh;
1354
+ border: 1px solid var(--hive-line, #232b38);
1355
+ border-radius: 12px;
1356
+ background: color-mix(in srgb, var(--hive-bg, #0b0f17) 97%, var(--hive-fg, #e6edf3) 3%);
1357
+ box-shadow: 0 24px 70px rgb(0 0 0 / 52%);
1358
+ overflow: hidden;
1359
+ }
1360
+
1361
+ .hive-card-dialog .hive-dialog-head { align-items: flex-start; }
1362
+
1363
+ .hive-card-subline {
1364
+ margin-top: 3px;
1365
+ overflow-wrap: anywhere;
1366
+ color: var(--hive-fg-soft);
1367
+ font-family: var(--hive-mono);
1368
+ font-size: 10.5px;
1369
+ line-height: 1.5;
1370
+ }
1371
+
1372
+ .hive-card-close {
1373
+ min-width: 28px;
1374
+ height: 28px;
1375
+ padding: 0 6px;
1376
+ color: var(--hive-fg-soft);
1377
+ font-size: 18px;
1378
+ line-height: 1;
1379
+ }
1380
+
1381
+ .hive-card-body {
1382
+ display: flex;
1383
+ flex-direction: column;
1384
+ gap: 12px;
1385
+ min-height: 0;
1386
+ overflow: auto;
1387
+ }
1388
+
1389
+ .hive-card-json {
1390
+ border: 1px solid var(--hive-line, #232b38);
1391
+ border-radius: 8px;
1392
+ background: var(--hive-surface);
1393
+ overflow: hidden;
1394
+ }
1395
+
1396
+ .hive-card-json-summary {
1397
+ padding: 8px 10px;
1398
+ color: var(--hive-fg-soft);
1399
+ font-size: 10px;
1400
+ font-weight: 650;
1401
+ letter-spacing: 0.08em;
1402
+ line-height: 1.5;
1403
+ text-transform: uppercase;
1404
+ cursor: pointer;
1405
+ user-select: none;
1406
+ }
1407
+
1408
+ .hive-card-json .hive-json {
1409
+ max-height: 300px;
1410
+ margin: 0;
1411
+ padding: 10px;
1412
+ overflow: auto;
1413
+ border-top: 1px solid var(--hive-line, #232b38);
1414
+ font-family: var(--hive-mono);
1415
+ font-size: 10.5px;
1416
+ line-height: 1.5;
1417
+ white-space: pre-wrap;
1418
+ }
1419
+
1420
+ .hive-card-actions {
1421
+ justify-content: flex-end;
1422
+ gap: 8px;
1423
+ flex-wrap: wrap;
1424
+ }
1425
+
1426
+ .hive-add-dialog {
1427
+ width: min(560px, 92vw);
1428
+ max-width: 92vw;
1429
+ max-height: 80vh;
1430
+ }
1431
+
1432
+ .hive-add-body {
1433
+ display: flex;
1434
+ flex-direction: column;
1435
+ gap: 10px;
1436
+ min-height: 0;
1437
+ overflow: auto;
1438
+ }
1439
+
1440
+ .hive-add-body .hive-field { width: 100%; }
1441
+
1442
+ .hive-add-body .hive-input,
1443
+ .hive-add-body .hive-textarea { width: 100%; }
1444
+
1445
+ .hive-add-acceptance { min-height: 70px; }
1446
+
1447
+ .hive-add-submit {
1448
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1449
+ background: var(--hive-accent, #58c4dc);
1450
+ color: var(--hive-bg, #0b0f17);
1451
+ }
1452
+
1453
+ .hive-add-submit:hover:not(:disabled) {
1454
+ border-color: var(--hive-accent, #58c4dc);
1455
+ background: color-mix(in srgb, var(--hive-accent, #58c4dc) 86%, white);
1456
+ color: var(--hive-bg, #0b0f17);
1457
+ }
1458
+
1459
+ `;
1138
1460
 
1139
1461
  const LANE_LABEL_KEYS = Object.freeze({
1140
1462
  pending: "lane.pending",
@@ -1155,13 +1477,13 @@ const messages = Object.freeze({
1155
1477
  "actions.aria": "board actions",
1156
1478
  "action.add": "New task",
1157
1479
  "action.claim": "claim",
1158
- "action.commit": "commit",
1159
1480
  "action.done": "done",
1160
1481
  "action.fail": "fail",
1161
- "action.freeze": "freeze",
1482
+ "action.freeze": "Pause",
1162
1483
  "action.modeTitle": "Toggle board mode",
1484
+ "action.remove": "Delete task",
1163
1485
  "action.retry": "retry",
1164
- "action.unfreeze": "unfreeze",
1486
+ "action.unfreeze": "Resume",
1165
1487
  "pane.agents": "agents",
1166
1488
  "pane.board": "board",
1167
1489
  "pane.events": "events",
@@ -1180,7 +1502,7 @@ const messages = Object.freeze({
1180
1502
  "mode.freeze": "freeze",
1181
1503
  "mode.free.help": "Free: anyone can claim tasks.",
1182
1504
  "mode.freeze.help": "Freeze: only tasks tagged fix can be claimed; use this while the pipeline is red.",
1183
- "mode.freeze.banner": "Frozen: only tasks tagged fix can be claimed.",
1505
+ "mode.freeze.banner": "Paused: only tasks tagged fix can be claimed.",
1184
1506
  "mode.title": "mode:",
1185
1507
  "stats.cards": "tasks",
1186
1508
  "stats.oldest": "oldest",
@@ -1211,6 +1533,7 @@ const messages = Object.freeze({
1211
1533
  "drawer.cardActions": "task actions",
1212
1534
  "drawer.noActions": "No actions for this state.",
1213
1535
  "drawer.readOnly": "Read-only: writable=false.",
1536
+ "drawer.removeClaimed": "A claimed task must be released or reopened before it can be deleted.",
1214
1537
  "drawer.rawJson": "raw json",
1215
1538
  "events.empty": "No events yet.",
1216
1539
  "events.showAll": "Show all events",
@@ -1226,45 +1549,85 @@ const messages = Object.freeze({
1226
1549
  "supervisor.resumeAria": "Resume the supervisor for {repo}",
1227
1550
  "supervisor.resumeFailed": "Could not resume the supervisor",
1228
1551
  "limits.open": "Settings",
1229
- "limits.openAria": "Configure bee counts for this repository",
1230
- "limits.title": "Bee counts",
1231
- "limits.aria": "Bee counts for this repository",
1232
- "limits.description": "Concurrency limit per role. 0 pauses that role. Default 5.",
1552
+ "limits.openAria": "Open agent concurrency settings",
1553
+ "limits.title": "Agent concurrency",
1554
+ "limits.aria": "Agent concurrency for this repository",
1555
+ "limits.description": "Max agents working at the same time, per role; 0 pauses the role",
1233
1556
  "limits.role": "Role",
1234
- "limits.limit": "Limit",
1557
+ "limits.limit": "Concurrency limit",
1235
1558
  "limits.inFlight": "In flight",
1236
1559
  "limits.queued": "Queued",
1237
1560
  "limits.defaultHint": "0-999, default 5",
1238
1561
  "limits.limitAria": "Concurrency limit for {role}",
1239
1562
  "limits.save": "Save",
1240
- "limits.saveAria": "Save bee counts for {repo}",
1563
+ "limits.saveAria": "Save agent concurrency for {repo}",
1241
1564
  "limits.saving": "Saving...",
1242
- "limits.saved": "Bee counts saved.",
1243
- "limits.failed": "Could not save bee counts",
1565
+ "limits.saved": "Agent concurrency saved.",
1566
+ "limits.failed": "Could not save agent concurrency",
1244
1567
  "limits.invalid": "Every limit must be an integer from 0 to 999.",
1245
1568
  "limits.none": "No role data for this repository.",
1246
1569
  "limits.close": "Close",
1247
- "limits.closeAria": "Close bee count settings",
1570
+ "limits.closeAria": "Close agent concurrency settings",
1571
+ "settings.openAria": "Open settings for this repository",
1572
+ "settings.title": "Settings",
1573
+ "settings.aria": "Settings for this repository",
1574
+ "settings.addRole": "Add role",
1575
+ "settings.roleName": "Role name",
1576
+ "settings.roleNameHint": "start with a lowercase letter; 2-32 characters; lowercase letters, digits and hyphens only",
1577
+ "settings.roleNameAria": "New role name",
1578
+ "settings.roleNameExample": "e.g. reviewer",
1579
+ "settings.roleDescription": "Responsibilities",
1580
+ "settings.roleDescriptionAria": "Responsibilities for the new role (optional)",
1581
+ "settings.roleDescriptionHint": "Written to .hive/roles/<name>.md; the agent reads it when it starts.",
1582
+ "settings.roleDescriptionMax": "optional, up to 2000 characters",
1583
+ "settings.descriptionTooLong": "Responsibilities must be at most 2000 characters.",
1584
+ "settings.adapter": "Adapter",
1585
+ "settings.adapterAria": "Adapter for the new role",
1586
+ "settings.model": "Model",
1587
+ "settings.modelOptional": "optional",
1588
+ "settings.modelAria": "Optional model for the new role",
1589
+ "settings.addRoleButton": "Add role",
1590
+ "settings.addRoleAria": "Add this role",
1591
+ "settings.addingRole": "Adding...",
1592
+ "settings.roleInvalid": "Role name must start with a lowercase letter, be 2-32 characters, and use lowercase letters, digits and hyphens only.",
1593
+ "settings.modelInvalid": "Model may use letters, digits, dot, underscore, colon and hyphen (max 64).",
1594
+ "settings.roleExists": "Role already exists.",
1595
+ "settings.roleAdded": "Role added.",
1596
+ "settings.roleFailed": "Could not add role",
1597
+ "settings.readOnly": "Read-only: roles and limits cannot be changed.",
1598
+ "settings.supervisorUnavailable": "Supervisor unavailable; role limits cannot load.",
1599
+ "settings.saveLimits": "Save limits",
1600
+ "settings.close": "Close",
1601
+ "settings.closeAria": "Close settings",
1248
1602
  "event.unknown": "event",
1603
+ "add.dialogTitle": "New task",
1604
+ "add.title": "Title",
1605
+ "add.titleAria": "New task title",
1606
+ "add.role": "Role",
1607
+ "add.roleAria": "Role for the new task",
1608
+ "add.scope": "Scope (comma separated, optional)",
1609
+ "add.scopeAria": "File scope for the new task",
1610
+ "add.after": "After task ids (comma separated, optional)",
1611
+ "add.afterAria": "Tasks that must finish first",
1612
+ "add.acceptance": "Acceptance criteria (optional)",
1613
+ "add.acceptanceAria": "Acceptance criteria for the new task",
1614
+ "add.cancel": "Cancel",
1615
+ "add.submit": "Add task",
1616
+ "add.submitting": "Adding…",
1617
+ "add.required": "A title is required.",
1249
1618
  "prompt.newTitle": "New task title",
1250
1619
  "prompt.role": "Role",
1251
1620
  "prompt.scope": "Scope (comma separated, optional)",
1252
1621
  "prompt.after": "After task ids (comma separated, optional)",
1253
- "prompt.commitMessage": "Commit message",
1254
- "prompt.paths": "Paths (comma separated, optional)",
1255
1622
  "prompt.claimAgent": "Claim as agent",
1256
1623
  "prompt.commitSha": "Commit sha (optional)",
1257
1624
  "prompt.failReason": "Failure reason",
1258
- "action.plan": "Give the Queen a goal",
1259
- "help.open": "What these buttons do",
1625
+ "action.plan": "Set the Queen a goal",
1260
1626
  "menu.open": "More actions and help",
1261
- "help.title": "Button guide",
1262
- "help.aria": "Action guide",
1627
+ "help.title": "Menu",
1628
+ "help.aria": "Menu",
1263
1629
  "help.close": "close",
1264
- "help.closeAria": "Close the button guide",
1265
- "help.board": "board actions",
1266
- "help.tasks": "task actions",
1267
- "help.params": "Parameters: ",
1630
+ "help.closeAria": "Close the menu",
1268
1631
  "help.readOnly": "The panel started read-only; add --write to show the write-action buttons.",
1269
1632
  "help.uninitialised": "Initialise Hive with the button in the main area before using board actions.",
1270
1633
  "init.repo": "repository",
@@ -1279,9 +1642,11 @@ const messages = Object.freeze({
1279
1642
  "init.output": "stdout",
1280
1643
  "init.noOutput": "(no output)",
1281
1644
  "init.queen": "This session's input now routes to the Queen (it splits tasks, it does not do the work).",
1282
- "init.queenExit": "Exit from the chat window:",
1283
- "init.queenCommand": "/queen off",
1284
1645
  "init.queenOutput": "Initialisation output",
1646
+ "queen.dismiss": "Dismiss",
1647
+ "queen.dismissAria": "Dismiss the Queen notice for this repository",
1648
+ "help.queen": "Queen mode",
1649
+ "help.queenDesc": "Type /queen off to exit. After exiting, this session returns to normal coding mode. Hiding the notice does not change Queen mode.",
1285
1650
  "queen.status.active": "Queen active",
1286
1651
  "queen.status.inactive": "Queen not active",
1287
1652
  "queen.source.auto": "auto",
@@ -1292,29 +1657,20 @@ const messages = Object.freeze({
1292
1657
  "queen.takeover": "Let the Queen take over",
1293
1658
  "queen.takeoverAria": "Let the Queen take over this session",
1294
1659
  "queen.takeoverBusy": "Taking over...",
1295
- "help.hint": "Open a task to see the actions for that task.",
1296
- "help.action.freeze": "Freeze: nobody can claim new tasks except tasks tagged fix.",
1297
- "help.action.unfreeze": "Unfreeze: agents can claim pending tasks again.",
1660
+ "help.action.freeze": "Pause: only tasks tagged fix can be claimed.",
1661
+ "help.action.unfreeze": "Resume: agents can claim pending tasks again.",
1298
1662
  "help.action.add": "New task: create a pending task with a role and file scope.",
1299
- "help.action.plan": "Give the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
1300
- "help.action.commit": "Commit: commit the selected paths with a message.",
1663
+ "help.action.plan": "Set the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
1301
1664
  "help.action.claim": "Claim: lease a pending task for an agent.",
1302
1665
  "help.action.done": "Done: mark a claimed task complete, optionally with a commit sha.",
1303
1666
  "help.action.fail": "Fail: mark a claimed task failed and record the reason.",
1304
1667
  "help.action.retry": "Retry: put a failed or blocked task back in the queue.",
1305
- "help.params.mode": "mode, reason",
1306
- "help.params.add": "title, role, scope[], after[]",
1307
- "help.params.plan": "goal, maxCards",
1308
- "help.params.commit": "message, set[]",
1309
- "help.params.claim": "id, agent",
1310
- "help.params.done": "id, sha?",
1311
- "help.params.fail": "id, reason",
1312
- "help.params.retry": "id",
1313
- "plan.dialogTitle": "Give the Queen a goal",
1668
+ "help.action.remove": "Delete this task card permanently. A claimed task has to be released or reopened first.",
1669
+ "plan.dialogTitle": "Set the Queen a goal",
1314
1670
  "plan.dialogAria": "Plan tasks from a goal",
1315
1671
  "plan.goal": "Goal",
1316
1672
  "plan.goalHint": "Describe the outcome; the Queen will split it into tasks.",
1317
- "plan.maxCards": "Max cards",
1673
+ "plan.maxCards": "Max tasks",
1318
1674
  "plan.maxCardsHint": "1+",
1319
1675
  "plan.preview": "Preview plan",
1320
1676
  "plan.previewAria": "Ask the Queen to draft a task plan without writing it",
@@ -1335,14 +1691,16 @@ const messages = Object.freeze({
1335
1691
  "plan.deps": "deps",
1336
1692
  "plan.none": "—",
1337
1693
  "plan.goalRequired": "Enter a goal first.",
1338
- "plan.maxInvalid": "Max cards must be a positive whole number.",
1694
+ "plan.maxInvalid": "Max tasks must be a positive whole number.",
1339
1695
  "plan.previewFirst": "Preview the plan before writing tasks.",
1340
1696
  "plan.previewFailed": "Could not read the plan.",
1341
1697
  "plan.applyHint": "The preview is read-only; writing calls plan again with apply=true.",
1342
- "plan.stale": "The goal or max cards changed; preview the plan again.",
1698
+ "plan.stale": "The goal or max tasks changed; preview the plan again.",
1343
1699
  "plan.error": "Plan failed",
1700
+ "confirm.remove": "Delete task \"{title}\" permanently? This cannot be undone.",
1344
1701
  "toast.dismiss": "Dismiss",
1345
1702
  "toast.planWritten": "Tasks written",
1703
+ "toast.taskRemoved": "Task deleted",
1346
1704
  "toast.pickupHint": "The supervisor will pick them up automatically.",
1347
1705
  }),
1348
1706
  zh: Object.freeze({
@@ -1350,13 +1708,13 @@ const messages = Object.freeze({
1350
1708
  "actions.aria": "看板操作",
1351
1709
  "action.add": "新建任务",
1352
1710
  "action.claim": "认领",
1353
- "action.commit": "提交",
1354
1711
  "action.done": "完成",
1355
1712
  "action.fail": "标记失败",
1356
- "action.freeze": "冻结",
1713
+ "action.freeze": "暂停",
1357
1714
  "action.modeTitle": "切换看板模式",
1715
+ "action.remove": "删除任务",
1358
1716
  "action.retry": "重试",
1359
- "action.unfreeze": "解冻",
1717
+ "action.unfreeze": "恢复",
1360
1718
  "pane.agents": "智能体",
1361
1719
  "pane.board": "任务",
1362
1720
  "pane.events": "事件",
@@ -1375,7 +1733,7 @@ const messages = Object.freeze({
1375
1733
  "mode.freeze": "冻结",
1376
1734
  "mode.free.help": "正常:任何人都可以认领任务。",
1377
1735
  "mode.freeze.help": "冻结:只有带 fix 标签的任务能被认领;流水线红时使用。",
1378
- "mode.freeze.banner": "已冻结:只有带 fix 标签的任务能被认领",
1736
+ "mode.freeze.banner": "已暂停:只有带 fix 标签的任务能被认领",
1379
1737
  "mode.title": "模式:",
1380
1738
  "stats.cards": "个任务",
1381
1739
  "stats.oldest": "最久待办",
@@ -1406,6 +1764,7 @@ const messages = Object.freeze({
1406
1764
  "drawer.cardActions": "任务操作",
1407
1765
  "drawer.noActions": "该状态没有可用操作。",
1408
1766
  "drawer.readOnly": "只读:writable=false。",
1767
+ "drawer.removeClaimed": "已认领的任务必须先释放或重开才能删除。",
1409
1768
  "drawer.rawJson": "原始 JSON",
1410
1769
  "events.empty": "暂无事件。",
1411
1770
  "events.showAll": "展开全部事件",
@@ -1421,45 +1780,85 @@ const messages = Object.freeze({
1421
1780
  "supervisor.resumeAria": "恢复 {repo} 的 supervisor",
1422
1781
  "supervisor.resumeFailed": "恢复 supervisor 失败",
1423
1782
  "limits.open": "设置",
1424
- "limits.openAria": "设置这个仓库的蜂的数量",
1425
- "limits.title": "蜂的数量",
1426
- "limits.aria": "按仓库设置蜂的数量",
1427
- "limits.description": "每个角色的并发上限。0 表示暂停该角色,默认 5。",
1783
+ "limits.openAria": "打开智能体并发上限设置",
1784
+ "limits.title": "智能体的并发上限",
1785
+ "limits.aria": "这个仓库的智能体并发上限",
1786
+ "limits.description": "同时干活的智能体数量上限,按角色分别设置;0 表示暂停该角色",
1428
1787
  "limits.role": "角色",
1429
- "limits.limit": "上限",
1788
+ "limits.limit": "并发上限",
1430
1789
  "limits.inFlight": "在飞",
1431
1790
  "limits.queued": "排队",
1432
1791
  "limits.defaultHint": "0–999,默认 5",
1433
1792
  "limits.limitAria": "{role} 的并发上限",
1434
1793
  "limits.save": "保存",
1435
- "limits.saveAria": "保存 {repo} 的蜂的数量",
1794
+ "limits.saveAria": "保存 {repo} 的智能体并发上限",
1436
1795
  "limits.saving": "正在保存…",
1437
- "limits.saved": "蜂的数量已保存。",
1438
- "limits.failed": "保存蜂的数量失败",
1796
+ "limits.saved": "智能体的并发上限已保存。",
1797
+ "limits.failed": "保存智能体的并发上限失败",
1439
1798
  "limits.invalid": "每个上限都必须是 0–999 的整数。",
1440
1799
  "limits.none": "这个仓库没有角色数据。",
1441
1800
  "limits.close": "关闭",
1442
- "limits.closeAria": "关闭蜂的数量设置",
1801
+ "limits.closeAria": "关闭智能体的并发上限设置",
1802
+ "settings.openAria": "打开这个仓库的设置",
1803
+ "settings.title": "设置",
1804
+ "settings.aria": "这个仓库的设置",
1805
+ "settings.addRole": "新增角色",
1806
+ "settings.roleName": "角色名",
1807
+ "settings.roleNameHint": "以小写字母开头,2–32 个字符,只能包含小写字母、数字和连字符",
1808
+ "settings.roleNameAria": "新角色名",
1809
+ "settings.roleNameExample": "例如 reviewer",
1810
+ "settings.roleDescription": "职责描述",
1811
+ "settings.roleDescriptionAria": "新角色的职责描述(可空)",
1812
+ "settings.roleDescriptionHint": "会写进 .hive/roles/<name>.md,agent 开工时读它",
1813
+ "settings.roleDescriptionMax": "可空,最多 2000 字",
1814
+ "settings.descriptionTooLong": "职责描述不能超过 2000 字。",
1815
+ "settings.adapter": "适配器",
1816
+ "settings.adapterAria": "新角色的适配器",
1817
+ "settings.model": "模型",
1818
+ "settings.modelOptional": "可空",
1819
+ "settings.modelAria": "新角色的可选模型",
1820
+ "settings.addRoleButton": "新增角色",
1821
+ "settings.addRoleAria": "新增这个角色",
1822
+ "settings.addingRole": "正在新增…",
1823
+ "settings.roleInvalid": "角色名必须以小写字母开头,2–32 个字符,只能包含小写字母、数字和连字符。",
1824
+ "settings.modelInvalid": "模型只能包含字母、数字、点、下划线、冒号和连字符,最长 64 位。",
1825
+ "settings.roleExists": "角色已存在。",
1826
+ "settings.roleAdded": "角色已新增。",
1827
+ "settings.roleFailed": "新增角色失败",
1828
+ "settings.readOnly": "只读模式:无法修改角色和限额。",
1829
+ "settings.supervisorUnavailable": "取不到 supervisor,无法读取角色限额。",
1830
+ "settings.saveLimits": "保存限额",
1831
+ "settings.close": "关闭",
1832
+ "settings.closeAria": "关闭设置",
1443
1833
  "event.unknown": "事件",
1834
+ "add.dialogTitle": "新建任务",
1835
+ "add.title": "标题",
1836
+ "add.titleAria": "新任务标题",
1837
+ "add.role": "角色",
1838
+ "add.roleAria": "新任务角色",
1839
+ "add.scope": "范围(逗号分隔,可选)",
1840
+ "add.scopeAria": "新任务的文件范围",
1841
+ "add.after": "依赖任务(任务 ID,逗号分隔,可选)",
1842
+ "add.afterAria": "需要先完成的任务",
1843
+ "add.acceptance": "验收标准(可选)",
1844
+ "add.acceptanceAria": "新任务的验收标准",
1845
+ "add.cancel": "取消",
1846
+ "add.submit": "新建任务",
1847
+ "add.submitting": "正在新建…",
1848
+ "add.required": "标题不能为空。",
1444
1849
  "prompt.newTitle": "新任务标题",
1445
1850
  "prompt.role": "角色",
1446
1851
  "prompt.scope": "范围(逗号分隔,可选)",
1447
1852
  "prompt.after": "排在哪些任务之后(任务 ID,逗号分隔,可选)",
1448
- "prompt.commitMessage": "提交信息",
1449
- "prompt.paths": "路径(逗号分隔,可选)",
1450
1853
  "prompt.claimAgent": "以哪个智能体认领",
1451
1854
  "prompt.commitSha": "提交 SHA(可选)",
1452
1855
  "prompt.failReason": "失败原因",
1453
- "action.plan": "给女王下目标",
1454
- "help.open": "这些按钮是做什么的",
1856
+ "action.plan": "给女王设目标",
1455
1857
  "menu.open": "更多操作与说明",
1456
- "help.title": "按钮说明",
1457
- "help.aria": "操作说明",
1858
+ "help.title": "菜单",
1859
+ "help.aria": "菜单",
1458
1860
  "help.close": "关闭",
1459
- "help.closeAria": "关闭按钮说明",
1460
- "help.board": "看板操作",
1461
- "help.tasks": "任务操作",
1462
- "help.params": "参数:",
1861
+ "help.closeAria": "关闭菜单",
1463
1862
  "help.readOnly": "面板以只读启动,加 --write 才有写操作按钮。",
1464
1863
  "help.uninitialised": "请先用主区的按钮初始化 Hive,再使用看板操作。",
1465
1864
  "init.repo": "仓库",
@@ -1474,9 +1873,11 @@ const messages = Object.freeze({
1474
1873
  "init.output": "标准输出",
1475
1874
  "init.noOutput": "(无输出)",
1476
1875
  "init.queen": "本会话输入框已接入女王模式(女王只拆解任务,不亲自干活)。",
1477
- "init.queenExit": "退出请在聊天窗口输入:",
1478
- "init.queenCommand": "/queen off",
1479
1876
  "init.queenOutput": "初始化输出",
1877
+ "queen.dismiss": "关闭提示",
1878
+ "queen.dismissAria": "关闭这个仓库的女王提示",
1879
+ "help.queen": "女王模式",
1880
+ "help.queenDesc": "输入 /queen off 退出,退出后本会话恢复普通编码模式;关闭提示不影响女王状态。",
1480
1881
  "queen.status.active": "女王已接管",
1481
1882
  "queen.status.inactive": "女王未接管",
1482
1883
  "queen.source.auto": "自动",
@@ -1487,29 +1888,20 @@ const messages = Object.freeze({
1487
1888
  "queen.takeover": "让女王接管",
1488
1889
  "queen.takeoverAria": "让女王接管本会话",
1489
1890
  "queen.takeoverBusy": "正在接管…",
1490
- "help.hint": "点开任务可查看该任务自己的操作。",
1491
- "help.action.freeze": "冻结:除带 fix 标签的任务外,任何人都不再能认领新任务。",
1492
- "help.action.unfreeze": "解冻:恢复认领,智能体可以继续接取待办任务。",
1891
+ "help.action.freeze": "暂停:只有带 fix 标签的任务能被认领。",
1892
+ "help.action.unfreeze": "恢复:恢复认领,智能体可以继续接取待办任务。",
1493
1893
  "help.action.add": "新建任务:添加一条带角色和文件范围的待办任务。",
1494
- "help.action.plan": "给女王下目标:让女王把目标拆成任务计划,预览后再写入看板。",
1495
- "help.action.commit": "提交:按提交信息提交选中的路径。",
1894
+ "help.action.plan": "给女王设目标:让女王把目标拆成任务计划,预览后再写入看板。",
1496
1895
  "help.action.claim": "认领:以某个智能体的名义短期租下这条待办任务。",
1497
1896
  "help.action.done": "完成:把已认领的任务标为完成,可选填写提交 SHA。",
1498
1897
  "help.action.fail": "标记失败:把已认领的任务标为失败,并写明原因。",
1499
1898
  "help.action.retry": "重试:把失败或受阻的任务放回队列。",
1500
- "help.params.mode": "mode、reason",
1501
- "help.params.add": "title、role、scope[]、after[]",
1502
- "help.params.plan": "goal、maxCards",
1503
- "help.params.commit": "message、set[]",
1504
- "help.params.claim": "id、智能体",
1505
- "help.params.done": "id、sha?",
1506
- "help.params.fail": "id、reason",
1507
- "help.params.retry": "id",
1508
- "plan.dialogTitle": "给女王下目标",
1899
+ "help.action.remove": "永久删除这张任务卡;已认领的任务需要先释放或重开。",
1900
+ "plan.dialogTitle": "给女王设目标",
1509
1901
  "plan.dialogAria": "按目标规划任务",
1510
1902
  "plan.goal": "目标",
1511
1903
  "plan.goalHint": "描述想达成的结果,女王会把它拆成任务。",
1512
- "plan.maxCards": "最大卡数",
1904
+ "plan.maxCards": "最大任务数",
1513
1905
  "plan.maxCardsHint": "至少 1",
1514
1906
  "plan.preview": "预览计划",
1515
1907
  "plan.previewAria": "让女王先给出任务计划,不写入看板",
@@ -1530,14 +1922,16 @@ const messages = Object.freeze({
1530
1922
  "plan.deps": "依赖",
1531
1923
  "plan.none": "—",
1532
1924
  "plan.goalRequired": "请先填写目标。",
1533
- "plan.maxInvalid": "最大卡数必须是正整数。",
1925
+ "plan.maxInvalid": "最大任务数必须是正整数。",
1534
1926
  "plan.previewFirst": "请先预览计划,再写入任务。",
1535
1927
  "plan.previewFailed": "无法解析计划。",
1536
1928
  "plan.applyHint": "预览不会写入;写入时会带 apply=true 再调用一次 plan。",
1537
- "plan.stale": "目标或最大卡数已修改,请重新预览计划。",
1929
+ "plan.stale": "目标或最大任务数已修改,请重新预览计划。",
1538
1930
  "plan.error": "计划失败",
1931
+ "confirm.remove": "确定永久删除任务「{title}」?此操作不可撤销。",
1539
1932
  "toast.dismiss": "关闭",
1540
1933
  "toast.planWritten": "任务已写入",
1934
+ "toast.taskRemoved": "任务已删除",
1541
1935
  "toast.pickupHint": "supervisor 会自动接卡。",
1542
1936
  }),
1543
1937
  });
@@ -1706,22 +2100,12 @@ function modeAction(mode) {
1706
2100
  return { name: "mode", ...meta, body: { mode: nextMode, reason: "panel" } };
1707
2101
  }
1708
2102
 
1709
- function toolbarActions(writable) {
2103
+ function toolbarActions(writable, mode) {
1710
2104
  if (!writable) return [];
1711
2105
  return [
1712
2106
  { name: "add", ...ACTION_META.add },
1713
2107
  { name: "plan", ...ACTION_META.plan },
1714
- { name: "commit", ...ACTION_META.commit },
1715
- ];
1716
- }
1717
-
1718
- function helpGroups(mode) {
1719
- return [
1720
- { titleKey: "help.board", actions: [modeAction(mode), ...toolbarActions(true)] },
1721
- {
1722
- titleKey: "help.tasks",
1723
- actions: ["claim", "done", "fail", "retry"].map((name) => ({ name, ...ACTION_META[name] })),
1724
- },
2108
+ modeAction(mode),
1725
2109
  ];
1726
2110
  }
1727
2111
 
@@ -1732,6 +2116,7 @@ function helpGroups(mode) {
1732
2116
  * @returns {{
1733
2117
  * at: string, repo: string, mode: string, initialised: boolean, writable: boolean,
1734
2118
  * queen: {active:boolean, source:"auto"|"manual"|null, repo:string}|null,
2119
+ * 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},
1735
2120
  * lanes: Record<string, Array<{id:string,title:string,role:string,owner:string,scope:string[],reason:string}>>,
1736
2121
  * laneOrder: string[],
1737
2122
  * stats: {total:number, byState:Record<string,number>, byRole:Record<string,number>, oldestPending:{id:string,createdAt:string}|null},
@@ -1775,6 +2160,32 @@ function renderModel(snapshot) {
1775
2160
  : null,
1776
2161
  repo: typeof rawQueen.repo === "string" ? rawQueen.repo : "",
1777
2162
  };
2163
+ const rawRoles = isRecord(source.roles) ? source.roles : null;
2164
+ const rolesLimits = {};
2165
+ if (rawRoles && isRecord(rawRoles.limits)) {
2166
+ for (const [name, value] of Object.entries(rawRoles.limits)) {
2167
+ const number = Number(value);
2168
+ if (name && Number.isFinite(number)) rolesLimits[name] = number;
2169
+ }
2170
+ }
2171
+ const roles = {
2172
+ list:
2173
+ rawRoles && Array.isArray(rawRoles.list)
2174
+ ? rawRoles.list
2175
+ .filter(isRecord)
2176
+ .map((entry) => ({
2177
+ name: asString(entry.name),
2178
+ adapter: typeof entry.adapter === "string" ? entry.adapter : null,
2179
+ model: typeof entry.model === "string" ? entry.model : null,
2180
+ prompt: typeof entry.prompt === "string" ? entry.prompt : null,
2181
+ promptExists: entry.promptExists === true,
2182
+ limit: typeof entry.limit === "number" && Number.isFinite(entry.limit) ? entry.limit : null,
2183
+ }))
2184
+ .filter((entry) => entry.name)
2185
+ : [],
2186
+ limits: rolesLimits,
2187
+ error: rawRoles ? asString(rawRoles.error) || null : null,
2188
+ };
1778
2189
 
1779
2190
  return {
1780
2191
  at: asString(source.at),
@@ -1782,13 +2193,14 @@ function renderModel(snapshot) {
1782
2193
  mode,
1783
2194
  initialised,
1784
2195
  queen,
2196
+ roles,
1785
2197
  writable,
1786
2198
  lanes,
1787
2199
  laneOrder: [...LANE_ORDER],
1788
2200
  stats: normalizeStats(source.stats, tasks),
1789
2201
  agents: normalizeAgents(source.board),
1790
2202
  events: normalizeEvents(source.events),
1791
- actions: initialised ? toolbarActions(writable) : [],
2203
+ actions: initialised ? toolbarActions(writable, mode) : [],
1792
2204
  };
1793
2205
  }
1794
2206
 
@@ -1970,6 +2382,52 @@ function element(doc, tag, className, text) {
1970
2382
  return node;
1971
2383
  }
1972
2384
 
2385
+ function svgNode(doc, tag) {
2386
+ const node =
2387
+ typeof doc.createElementNS === "function"
2388
+ ? doc.createElementNS("http://www.w3.org/2000/svg", tag)
2389
+ : doc.createElement(tag);
2390
+ return node;
2391
+ }
2392
+
2393
+ function makeHiveIcon(doc, kind) {
2394
+ const svg = svgNode(doc, "svg");
2395
+ setAttr(svg, "viewBox", "0 0 24 24");
2396
+ setAttr(svg, "width", "16");
2397
+ setAttr(svg, "height", "16");
2398
+ setAttr(svg, "aria-hidden", "true");
2399
+ setAttr(svg, "focusable", "false");
2400
+ if (kind === "menu") {
2401
+ for (const cx of [5, 12, 19]) {
2402
+ const dot = svgNode(doc, "circle");
2403
+ setAttr(dot, "cx", String(cx));
2404
+ setAttr(dot, "cy", "12");
2405
+ setAttr(dot, "r", "1.25");
2406
+ setAttr(dot, "fill", "currentColor");
2407
+ svg.appendChild(dot);
2408
+ }
2409
+ return svg;
2410
+ }
2411
+ setAttr(svg, "fill", "none");
2412
+ setAttr(svg, "stroke", "currentColor");
2413
+ setAttr(svg, "stroke-width", "1.75");
2414
+ setAttr(svg, "stroke-linecap", "round");
2415
+ setAttr(svg, "stroke-linejoin", "round");
2416
+ const center = svgNode(doc, "circle");
2417
+ setAttr(center, "cx", "12");
2418
+ setAttr(center, "cy", "12");
2419
+ setAttr(center, "r", "3");
2420
+ svg.appendChild(center);
2421
+ const path = svgNode(doc, "path");
2422
+ setAttr(
2423
+ path,
2424
+ "d",
2425
+ "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",
2426
+ );
2427
+ svg.appendChild(path);
2428
+ return svg;
2429
+ }
2430
+
1973
2431
  function setAttr(node, name, value) {
1974
2432
  if (node && typeof node.setAttribute === "function") {
1975
2433
  node.setAttribute(name, value === null || value === undefined ? "" : String(value));
@@ -2048,22 +2506,6 @@ function formatTime(value) {
2048
2506
  }
2049
2507
  }
2050
2508
 
2051
- function formatStamp(value) {
2052
- const date = parseDate(value);
2053
- if (!date) return asString(value);
2054
- try {
2055
- return date.toLocaleString([], {
2056
- month: "short",
2057
- day: "2-digit",
2058
- hour: "2-digit",
2059
- minute: "2-digit",
2060
- second: "2-digit",
2061
- });
2062
- } catch {
2063
- return date.toISOString();
2064
- }
2065
- }
2066
-
2067
2509
  function safeClassToken(value) {
2068
2510
  const token = asString(value).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
2069
2511
  return token || "unknown";
@@ -2176,6 +2618,7 @@ function extractPlan(payload) {
2176
2618
  * intervalMs?: number,
2177
2619
  * onError?: (error: Error) => void,
2178
2620
  * fetch?: typeof fetch,
2621
+ * confirm?: (message: string) => boolean,
2179
2622
  * t?: (key: string) => string,
2180
2623
  * subscribeLocale?: (listener: () => void) => (() => void)
2181
2624
  * }} [options]
@@ -2229,6 +2672,18 @@ function mount(root, options = {}) {
2229
2672
  ? globalThis.prompt.bind(globalThis)
2230
2673
  : null;
2231
2674
 
2675
+ // Destructive actions ask through the host's confirm when it provides one
2676
+ // (tests, embedded hosts), then the global confirm. Without either, a
2677
+ // destructive action is refused rather than run unconfirmed.
2678
+ const confirmImpl =
2679
+ typeof opts.confirm === "function"
2680
+ ? opts.confirm
2681
+ : typeof view.confirm === "function"
2682
+ ? view.confirm.bind(view)
2683
+ : typeof globalThis.confirm === "function"
2684
+ ? globalThis.confirm.bind(globalThis)
2685
+ : null;
2686
+
2232
2687
  const schedule =
2233
2688
  typeof view.setInterval === "function" ? view.setInterval.bind(view) : globalThis.setInterval.bind(globalThis);
2234
2689
  const unschedule =
@@ -2266,6 +2721,7 @@ function mount(root, options = {}) {
2266
2721
  let lastModel = null;
2267
2722
  let drawerNode = null;
2268
2723
  let drawerState = null;
2724
+ let drawerTrigger = null;
2269
2725
  let unsubscribeLocale = null;
2270
2726
  let statusKey = null;
2271
2727
  let statusKind = "info";
@@ -2278,6 +2734,11 @@ function mount(root, options = {}) {
2278
2734
  let planState = null;
2279
2735
  let planTriggerButton = null;
2280
2736
  let planFocusables = [];
2737
+ let addOverlay = null;
2738
+ let addDialogNode = null;
2739
+ let addState = null;
2740
+ let addTriggerButton = null;
2741
+ let addFocusables = [];
2281
2742
  let toastNode = null;
2282
2743
  let stageFilter = "all";
2283
2744
  let stageChipEntries = [];
@@ -2288,8 +2749,10 @@ function mount(root, options = {}) {
2288
2749
  let initRequestSeq = 0;
2289
2750
  let queenNotice = false;
2290
2751
  let queenBusy = false;
2752
+ const queenDismissedFallback = new Set();
2291
2753
  let supervisorData = [];
2292
2754
  let supervisorRequest = null;
2755
+ let supervisorInlineRow = null;
2293
2756
  let limitsOverlay = null;
2294
2757
  let limitsDialogNode = null;
2295
2758
  let limitsState = null;
@@ -2307,8 +2770,19 @@ function mount(root, options = {}) {
2307
2770
  ident.appendChild(repoNode);
2308
2771
  bar.appendChild(ident);
2309
2772
 
2310
- const timeNode = element(doc, "time", "hive-time", "");
2311
- bar.appendChild(timeNode);
2773
+ const supervisorInline = element(doc, "span", "hive-supervisor-inline is-hidden");
2774
+ setAttr(supervisorInline, "aria-label", translate("supervisor.aria"));
2775
+ const supervisorInlineLabel = element(doc, "span", "hive-supervisor-inline-label", translate("supervisor.label"));
2776
+ const supervisorInlineState = element(doc, "span", "hive-supervisor-inline-state", "");
2777
+ const supervisorInlineResume = element(doc, "button", "hive-btn hive-supervisor-inline-resume is-hidden", translate("supervisor.resume"));
2778
+ setAttr(supervisorInlineResume, "type", "button");
2779
+ supervisorInlineResume.addEventListener("click", () => {
2780
+ if (supervisorInlineRow) void resumeSupervisor(supervisorInlineRow, supervisorInlineResume);
2781
+ });
2782
+ supervisorInline.appendChild(supervisorInlineLabel);
2783
+ supervisorInline.appendChild(supervisorInlineState);
2784
+ supervisorInline.appendChild(supervisorInlineResume);
2785
+ bar.appendChild(supervisorInline);
2312
2786
 
2313
2787
  const statsNode = element(doc, "div", "hive-stats");
2314
2788
  bar.appendChild(statsNode);
@@ -2323,8 +2797,9 @@ function mount(root, options = {}) {
2323
2797
  const actionsNode = element(doc, "div", "hive-actions");
2324
2798
  actionGroup.appendChild(actionsNode);
2325
2799
 
2326
- const helpButton = element(doc, "button", "hive-btn hive-help-trigger hive-menu-trigger", "⋯");
2800
+ const helpButton = element(doc, "button", "hive-btn hive-btn-ghost hive-icon-button hive-help-trigger hive-menu-trigger");
2327
2801
  setAttr(helpButton, "type", "button");
2802
+ helpButton.appendChild(makeHiveIcon(doc, "menu"));
2328
2803
  setAttr(helpButton, "aria-haspopup", "dialog");
2329
2804
  setAttr(helpButton, "aria-expanded", "false");
2330
2805
  setAttr(helpButton, "title", translate("menu.open"));
@@ -2332,35 +2807,25 @@ function mount(root, options = {}) {
2332
2807
  helpButton.addEventListener("click", () => {
2333
2808
  toggleHelp();
2334
2809
  });
2335
- actionGroup.appendChild(helpButton);
2336
- bar.appendChild(actionGroup);
2337
-
2338
- const supervisorBar = element(doc, "section", "hive-supervisor is-hidden");
2339
- setAttr(supervisorBar, "aria-label", translate("supervisor.aria"));
2340
- const supervisorLabel = element(doc, "span", "hive-supervisor-label", "");
2341
- const supervisorRepos = element(doc, "div", "hive-supervisor-repos");
2342
- const supervisorLimitsButton = element(doc, "button", "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden", translate("limits.open"));
2343
- setAttr(supervisorLimitsButton, "type", "button");
2344
- setAttr(supervisorLimitsButton, "title", translate("limits.openAria"));
2345
- setAttr(supervisorLimitsButton, "aria-label", translate("limits.openAria"));
2346
- supervisorLimitsButton.addEventListener("click", () => {
2347
- openLimitsDialog(supervisorLimitsButton);
2810
+ // The previous "⋯" action menu has no entries left; settings carries the Queen section.
2811
+ const settingsButton = element(doc, "button", "hive-btn hive-btn-ghost hive-icon-button hive-settings-trigger");
2812
+ setAttr(settingsButton, "type", "button");
2813
+ settingsButton.appendChild(makeHiveIcon(doc, "gear"));
2814
+ setAttr(settingsButton, "title", translate("settings.openAria"));
2815
+ setAttr(settingsButton, "aria-label", translate("settings.openAria"));
2816
+ settingsButton.addEventListener("click", () => {
2817
+ openLimitsDialog(settingsButton);
2348
2818
  });
2349
- supervisorBar.appendChild(supervisorLabel);
2350
- supervisorBar.appendChild(supervisorRepos);
2351
- supervisorBar.appendChild(supervisorLimitsButton);
2819
+ actionGroup.appendChild(settingsButton);
2820
+ bar.appendChild(actionGroup);
2352
2821
 
2353
2822
  const freezeSlot = element(doc, "div", "hive-freeze-slot");
2354
2823
 
2355
- // Queen-mode notice, shown only after a successful init in this mount.
2824
+ // Queen-mode notice, driven by snapshot.queen.
2356
2825
  const queenHint = element(doc, "section", "hive-queen-hint");
2357
2826
  setAttr(queenHint, "role", "status");
2827
+ const queenBody = element(doc, "div", "hive-queen-body");
2358
2828
  const queenHintText = element(doc, "div", "hive-queen-text", "");
2359
- const queenExit = element(doc, "div", "hive-queen-exit");
2360
- const queenExitText = element(doc, "span", "hive-queen-exit-text", "");
2361
- const queenCommand = element(doc, "code", "hive-queen-command", "");
2362
- queenExit.appendChild(queenExitText);
2363
- queenExit.appendChild(queenCommand);
2364
2829
  const queenOffer = element(doc, "div", "hive-queen-offer is-hidden");
2365
2830
  const queenTakeoverButton = element(doc, "button", "hive-btn hive-queen-takeover", translate("queen.takeover"));
2366
2831
  setAttr(queenTakeoverButton, "type", "button");
@@ -2375,10 +2840,18 @@ function mount(root, options = {}) {
2375
2840
  const queenOutputPre = element(doc, "pre", "hive-output-pre", "");
2376
2841
  queenOutputDetails.appendChild(queenOutputSummary);
2377
2842
  queenOutputDetails.appendChild(queenOutputPre);
2378
- queenHint.appendChild(queenHintText);
2379
- queenHint.appendChild(queenOffer);
2380
- queenHint.appendChild(queenExit);
2381
- queenHint.appendChild(queenOutputDetails);
2843
+ queenBody.appendChild(queenHintText);
2844
+ queenBody.appendChild(queenOffer);
2845
+ queenBody.appendChild(queenOutputDetails);
2846
+ const queenDismissButton = element(doc, "button", "hive-btn hive-btn-ghost hive-queen-dismiss is-hidden", "×");
2847
+ setAttr(queenDismissButton, "type", "button");
2848
+ setAttr(queenDismissButton, "title", translate("queen.dismissAria"));
2849
+ setAttr(queenDismissButton, "aria-label", translate("queen.dismissAria"));
2850
+ queenDismissButton.addEventListener("click", () => {
2851
+ dismissQueenNotice();
2852
+ });
2853
+ queenHint.appendChild(queenBody);
2854
+ queenHint.appendChild(queenDismissButton);
2382
2855
 
2383
2856
  const main = element(doc, "main", "hive-main");
2384
2857
 
@@ -2473,7 +2946,6 @@ function mount(root, options = {}) {
2473
2946
  });
2474
2947
 
2475
2948
  frame.appendChild(bar);
2476
- frame.appendChild(supervisorBar);
2477
2949
  frame.appendChild(freezeSlot);
2478
2950
  frame.appendChild(queenHint);
2479
2951
  frame.appendChild(agentsStrip);
@@ -2530,6 +3002,15 @@ function mount(root, options = {}) {
2530
3002
  return answer === null || answer === undefined ? null : String(answer);
2531
3003
  }
2532
3004
 
3005
+ function askConfirm(message) {
3006
+ if (!confirmImpl) return false;
3007
+ try {
3008
+ return confirmImpl(message) === true;
3009
+ } catch {
3010
+ return false;
3011
+ }
3012
+ }
3013
+
2533
3014
  function emptyState(text) {
2534
3015
  return element(doc, "div", "hive-empty", text);
2535
3016
  }
@@ -2597,34 +3078,22 @@ function mount(root, options = {}) {
2597
3078
  if (!model || !model.writable) {
2598
3079
  body.appendChild(element(doc, "div", "hive-help-note", translate("help.readOnly")));
2599
3080
  }
2600
- const groups = helpGroups(model ? model.mode : "free");
2601
- for (const group of groups) {
2602
- body.appendChild(element(doc, "div", "hive-help-section", translate(group.titleKey)));
2603
- for (const action of group.actions) {
2604
- const item = element(doc, "div", "hive-help-action");
2605
- item.appendChild(element(doc, "div", "hive-help-name", translate(action.labelKey)));
2606
- item.appendChild(element(doc, "div", "hive-help-desc", translate(action.helpKey)));
2607
- const params = action.paramsKey ? translate(action.paramsKey) : "";
2608
- if (params) {
2609
- item.appendChild(element(doc, "div", "hive-help-params", translate("help.params") + params));
2610
- }
2611
- if (action.name === "mode" && model && model.writable && model.initialised !== false) {
2612
- const row = element(doc, "div", "hive-help-actionrow");
2613
- const button = element(doc, "button", "hive-btn hive-help-mode-action", translate(action.labelKey));
2614
- setAttr(button, "type", "button");
2615
- setAttr(button, "title", translate(action.helpKey));
2616
- setAttr(button, "aria-label", translate(action.helpKey));
2617
- button.addEventListener("click", () => {
2618
- closeHelp();
2619
- void postAction("mode", action.body || { mode: "freeze", reason: "panel" });
2620
- });
2621
- row.appendChild(button);
2622
- item.appendChild(row);
2623
- }
2624
- body.appendChild(item);
2625
- }
3081
+ if (model && model.writable && model.initialised !== false) {
3082
+ const action = modeAction(model.mode);
3083
+ const row = element(doc, "div", "hive-help-actionrow");
3084
+ const button = element(doc, "button", "hive-btn hive-help-mode-action", translate(action.labelKey));
3085
+ setAttr(button, "type", "button");
3086
+ setAttr(button, "title", translate(action.helpKey));
3087
+ setAttr(button, "aria-label", translate(action.helpKey));
3088
+ button.addEventListener("click", () => {
3089
+ closeHelp();
3090
+ void postAction("mode", action.body || { mode: "freeze", reason: "panel" });
3091
+ });
3092
+ row.appendChild(button);
3093
+ body.appendChild(row);
2626
3094
  }
2627
- body.appendChild(element(doc, "div", "hive-help-hint", translate("help.hint")));
3095
+ body.appendChild(element(doc, "div", "hive-help-section", translate("help.queen")));
3096
+ body.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
2628
3097
  }
2629
3098
 
2630
3099
  function positionHelp(panel) {
@@ -2871,6 +3340,7 @@ function mount(root, options = {}) {
2871
3340
  function openPlanDialog(trigger) {
2872
3341
  if (destroyed || !lastModel || !lastModel.writable) return;
2873
3342
  closeHelp(false);
3343
+ closeAddDialog(false);
2874
3344
  closeDrawer();
2875
3345
  planTriggerButton = trigger || planTriggerButton || null;
2876
3346
 
@@ -2997,7 +3467,7 @@ function mount(root, options = {}) {
2997
3467
  focusNode(goalInput);
2998
3468
  }
2999
3469
 
3000
- // --- bee count settings -------------------------------------------------
3470
+ // --- agent concurrency settings -----------------------------------------
3001
3471
 
3002
3472
  function currentSupervisorRow() {
3003
3473
  if (!lastModel) return null;
@@ -3005,14 +3475,42 @@ function mount(root, options = {}) {
3005
3475
  }
3006
3476
 
3007
3477
  function roleRowsForCurrentRepo(row) {
3008
- const roles = new Map();
3478
+ const supervisorRoles = new Map();
3009
3479
  if (row && Array.isArray(row.roles)) {
3010
3480
  for (const role of row.roles) {
3011
3481
  if (!isRecord(role)) continue;
3012
3482
  const name = asString(role.role);
3013
- if (name) roles.set(name, { ...role, role: name });
3483
+ if (name) supervisorRoles.set(name, role);
3014
3484
  }
3015
3485
  }
3486
+ const modelRoles = lastModel && lastModel.roles && Array.isArray(lastModel.roles.list) ? lastModel.roles.list : [];
3487
+ if (modelRoles.length > 0) {
3488
+ return modelRoles
3489
+ .map((entry) => {
3490
+ const name = asString(entry.name);
3491
+ if (!name) return null;
3492
+ const savedLimit = lastModel.roles.limits[name];
3493
+ const limit = Number.isFinite(savedLimit)
3494
+ ? savedLimit
3495
+ : Number.isFinite(entry.limit)
3496
+ ? entry.limit
3497
+ : null;
3498
+ const effective = supervisorRoles.get(name);
3499
+ return {
3500
+ role: name,
3501
+ adapter: entry.adapter,
3502
+ model: entry.model,
3503
+ limit,
3504
+ inFlight: effective ? effective.inFlight : null,
3505
+ queued: effective ? effective.queued : null,
3506
+ };
3507
+ })
3508
+ .filter(Boolean)
3509
+ .sort((left, right) => left.role.localeCompare(right.role));
3510
+ }
3511
+
3512
+ const roles = new Map();
3513
+ for (const [name, role] of supervisorRoles) roles.set(name, { ...role, role: name });
3016
3514
  if (roles.size === 0 && lastModel) {
3017
3515
  for (const cards of Object.values(lastModel.lanes)) {
3018
3516
  for (const card of cards) {
@@ -3079,15 +3577,18 @@ function mount(root, options = {}) {
3079
3577
  }
3080
3578
 
3081
3579
  function openLimitsDialog(trigger) {
3082
- if (destroyed || !lastModel || !lastModel.writable || supervisorData.length === 0) return;
3580
+ if (destroyed || !lastModel) return;
3083
3581
  closeHelp(false);
3084
3582
  closePlanDialog(false);
3583
+ closeAddDialog(false);
3085
3584
  closeDrawer();
3086
3585
  closeToast();
3087
3586
  if (limitsDialogNode) closeLimitsDialog(false);
3088
- limitsTriggerButton = trigger || supervisorLimitsButton;
3587
+ limitsTriggerButton = trigger || settingsButton;
3089
3588
 
3090
3589
  const repo = lastModel.repo || "";
3590
+ const writable = Boolean(lastModel.writable);
3591
+ const supervisorAvailable = supervisorData.length > 0;
3091
3592
  const rows = roleRowsForCurrentRepo(currentSupervisorRow());
3092
3593
  const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim");
3093
3594
  overlay.addEventListener("click", (event) => {
@@ -3097,16 +3598,16 @@ function mount(root, options = {}) {
3097
3598
  const dialog = element(doc, "div", "hive-dialog");
3098
3599
  setAttr(dialog, "role", "dialog");
3099
3600
  setAttr(dialog, "aria-modal", "true");
3100
- setAttr(dialog, "aria-label", translate("limits.aria"));
3601
+ setAttr(dialog, "aria-label", translate("settings.aria"));
3101
3602
 
3102
3603
  const head = element(doc, "div", "hive-dialog-head");
3103
3604
  const titleBox = element(doc, "div", "hive-dialog-head-title");
3104
- titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("limits.title")));
3605
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("settings.title")));
3105
3606
  head.appendChild(titleBox);
3106
- const closeButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("limits.close"));
3607
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("settings.close"));
3107
3608
  setAttr(closeButton, "type", "button");
3108
- setAttr(closeButton, "title", translate("limits.closeAria"));
3109
- setAttr(closeButton, "aria-label", translate("limits.closeAria"));
3609
+ setAttr(closeButton, "title", translate("settings.closeAria"));
3610
+ setAttr(closeButton, "aria-label", translate("settings.closeAria"));
3110
3611
  closeButton.addEventListener("click", () => {
3111
3612
  closeLimitsDialog();
3112
3613
  });
@@ -3120,11 +3621,93 @@ function mount(root, options = {}) {
3120
3621
  setAttr(repoPath, "title", repo);
3121
3622
  repoLine.appendChild(repoPath);
3122
3623
  body.appendChild(repoLine);
3123
- body.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3624
+ if (!writable) {
3625
+ body.appendChild(element(doc, "div", "hive-settings-note", translate("settings.readOnly")));
3626
+ }
3627
+
3628
+ const roleSection = element(doc, "section", "hive-settings-section");
3629
+ roleSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("settings.addRole")));
3630
+ const roleForm = element(doc, "div", "hive-field-row hive-settings-role-form");
3631
+ const roleNameField = element(doc, "label", "hive-field");
3632
+ roleNameField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleName")));
3633
+ const roleNameInput = element(doc, "input", "hive-input hive-settings-role-name");
3634
+ setAttr(roleNameInput, "type", "text");
3635
+ setAttr(roleNameInput, "autocomplete", "off");
3636
+ setAttr(roleNameInput, "placeholder", translate("settings.roleNameExample"));
3637
+ setAttr(roleNameInput, "aria-label", translate("settings.roleNameAria"));
3638
+ setAttr(roleNameInput, "pattern", "[a-z0-9]+(?:-[a-z0-9]+)*");
3639
+ roleNameField.appendChild(roleNameInput);
3640
+ roleNameField.appendChild(element(doc, "span", "hive-field-hint", translate("settings.roleNameHint")));
3641
+ roleForm.appendChild(roleNameField);
3642
+
3643
+ const adapterField = element(doc, "label", "hive-field is-narrow");
3644
+ adapterField.appendChild(element(doc, "span", "hive-field-label", translate("settings.adapter")));
3645
+ const adapterInput = element(doc, "select", "hive-input hive-settings-role-adapter");
3646
+ setAttr(adapterInput, "aria-label", translate("settings.adapterAria"));
3647
+ for (const adapter of ["dsh", "claude", "codex"]) {
3648
+ const option = element(doc, "option", null, adapter);
3649
+ setAttr(option, "value", adapter);
3650
+ adapterInput.appendChild(option);
3651
+ }
3652
+ adapterInput.value = "dsh";
3653
+ adapterField.appendChild(adapterInput);
3654
+ roleForm.appendChild(adapterField);
3655
+
3656
+ const modelField = element(doc, "label", "hive-field is-narrow");
3657
+ modelField.appendChild(element(doc, "span", "hive-field-label", translate("settings.model")));
3658
+ const modelInput = element(doc, "input", "hive-input hive-settings-role-model");
3659
+ setAttr(modelInput, "type", "text");
3660
+ setAttr(modelInput, "autocomplete", "off");
3661
+ setAttr(modelInput, "placeholder", translate("settings.modelOptional"));
3662
+ setAttr(modelInput, "aria-label", translate("settings.modelAria"));
3663
+ modelField.appendChild(modelInput);
3664
+ roleForm.appendChild(modelField);
3665
+ roleSection.appendChild(roleForm);
3666
+
3667
+ const roleDescriptionField = element(doc, "label", "hive-field hive-settings-role-description");
3668
+ roleDescriptionField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleDescription")));
3669
+ const roleDescriptionInput = element(doc, "textarea", "hive-textarea hive-settings-role-description-input");
3670
+ setAttr(roleDescriptionInput, "maxlength", "2000");
3671
+ setAttr(roleDescriptionInput, "rows", "3");
3672
+ setAttr(roleDescriptionInput, "aria-label", translate("settings.roleDescriptionAria"));
3673
+ roleDescriptionField.appendChild(roleDescriptionInput);
3674
+ roleDescriptionField.appendChild(
3675
+ element(
3676
+ doc,
3677
+ "span",
3678
+ "hive-field-hint",
3679
+ translate("settings.roleDescriptionHint") + " · " + translate("settings.roleDescriptionMax"),
3680
+ ),
3681
+ );
3682
+ roleSection.appendChild(roleDescriptionField);
3683
+
3684
+ const roleErrorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3685
+ roleSection.appendChild(roleErrorNode);
3686
+ const addRoleButton = element(doc, "button", "hive-btn hive-settings-add-role", translate("settings.addRoleButton"));
3687
+ setAttr(addRoleButton, "type", "button");
3688
+ setAttr(addRoleButton, "title", translate("settings.addRoleAria"));
3689
+ setAttr(addRoleButton, "aria-label", translate("settings.addRoleAria"));
3690
+ addRoleButton.disabled = !writable;
3691
+ addRoleButton.addEventListener("click", () => {
3692
+ void saveRole();
3693
+ });
3694
+ if (!writable) {
3695
+ roleNameInput.disabled = true;
3696
+ adapterInput.disabled = true;
3697
+ modelInput.disabled = true;
3698
+ roleDescriptionInput.disabled = true;
3699
+ }
3700
+ body.appendChild(roleSection);
3124
3701
 
3702
+ const limitsSection = element(doc, "section", "hive-settings-section");
3703
+ limitsSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("limits.title")));
3704
+ limitsSection.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3125
3705
  const rowNodes = [];
3706
+ if (!supervisorAvailable) {
3707
+ limitsSection.appendChild(element(doc, "div", "hive-settings-note", translate("settings.supervisorUnavailable")));
3708
+ }
3126
3709
  if (rows.length === 0) {
3127
- body.appendChild(element(doc, "div", "hive-limits-empty", translate("limits.none")));
3710
+ limitsSection.appendChild(element(doc, "div", "hive-limits-empty", translate("limits.none")));
3128
3711
  } else {
3129
3712
  const table = element(doc, "div", "hive-limits-table");
3130
3713
  const header = element(doc, "div", "hive-limits-row is-head");
@@ -3145,30 +3728,41 @@ function mount(root, options = {}) {
3145
3728
  setAttr(input, "inputmode", "numeric");
3146
3729
  setAttr(input, "aria-label", translate("limits.limitAria").replace("{role}", role.role));
3147
3730
  input.value = supervisorNumber(role.limit) === null ? "5" : String(supervisorNumber(role.limit));
3731
+ input.disabled = !writable || !supervisorAvailable;
3148
3732
  roleRow.appendChild(input);
3149
3733
  roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.inFlight)));
3150
3734
  roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.queued)));
3151
3735
  table.appendChild(roleRow);
3152
3736
  rowNodes.push({ role: role.role, input });
3153
3737
  }
3154
- body.appendChild(table);
3155
- body.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
3738
+ limitsSection.appendChild(table);
3739
+ limitsSection.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
3156
3740
  }
3157
3741
 
3158
3742
  const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3159
- body.appendChild(errorNode);
3743
+ limitsSection.appendChild(errorNode);
3744
+ body.appendChild(limitsSection);
3745
+
3746
+ const queenSection = element(doc, "section", "hive-settings-section");
3747
+ queenSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("help.queen")));
3748
+ queenSection.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
3749
+ body.appendChild(queenSection);
3160
3750
  dialog.appendChild(body);
3161
3751
 
3162
3752
  const foot = element(doc, "div", "hive-dialog-foot");
3163
- const saveButton = element(doc, "button", "hive-btn", translate("limits.save"));
3753
+ const settingsActions = element(doc, "div", "hive-settings-actions");
3754
+ addRoleButton.className = "hive-btn hive-settings-add-role hive-settings-secondary";
3755
+ const saveButton = element(doc, "button", "hive-btn hive-settings-save hive-settings-primary", translate("settings.saveLimits"));
3164
3756
  setAttr(saveButton, "type", "button");
3165
3757
  setAttr(saveButton, "title", translate("limits.saveAria").replace("{repo}", repo));
3166
3758
  setAttr(saveButton, "aria-label", translate("limits.saveAria").replace("{repo}", repo));
3167
- saveButton.disabled = rows.length === 0;
3759
+ saveButton.disabled = !writable || !supervisorAvailable || rows.length === 0;
3168
3760
  saveButton.addEventListener("click", () => {
3169
3761
  void saveBeeCounts();
3170
3762
  });
3171
- foot.appendChild(saveButton);
3763
+ settingsActions.appendChild(addRoleButton);
3764
+ settingsActions.appendChild(saveButton);
3765
+ foot.appendChild(settingsActions);
3172
3766
  dialog.appendChild(foot);
3173
3767
 
3174
3768
  overlay.appendChild(dialog);
@@ -3181,17 +3775,105 @@ function mount(root, options = {}) {
3181
3775
  errorNode,
3182
3776
  saveButton,
3183
3777
  busy: false,
3778
+ writable,
3779
+ supervisorAvailable,
3780
+ roleName: roleNameInput,
3781
+ roleAdapter: adapterInput,
3782
+ roleModel: modelInput,
3783
+ roleDescription: roleDescriptionInput,
3784
+ roleButton: addRoleButton,
3785
+ roleErrorNode,
3786
+ roleBusy: false,
3184
3787
  };
3185
- limitsFocusables = [closeButton, ...rowNodes.map((entry) => entry.input), saveButton];
3788
+ limitsFocusables = [
3789
+ closeButton,
3790
+ roleNameInput,
3791
+ adapterInput,
3792
+ modelInput,
3793
+ roleDescriptionInput,
3794
+ addRoleButton,
3795
+ ...rowNodes.map((entry) => entry.input),
3796
+ saveButton,
3797
+ ];
3186
3798
  if (typeof doc.addEventListener === "function") {
3187
3799
  doc.addEventListener("keydown", onLimitsKeydown);
3188
3800
  }
3189
- focusNode(rowNodes[0] ? rowNodes[0].input : closeButton);
3801
+ focusNode(writable ? roleNameInput : closeButton);
3802
+ }
3803
+
3804
+ function setRoleError(message) {
3805
+ if (!limitsState) return;
3806
+ limitsState.roleErrorNode.textContent = message || "";
3807
+ limitsState.roleErrorNode.className = "hive-limits-error" + (message ? "" : " is-hidden");
3808
+ }
3809
+
3810
+ async function saveRole() {
3811
+ const state = limitsState;
3812
+ if (!state || state.roleBusy || !state.writable) return;
3813
+ const name = String(state.roleName.value === null || state.roleName.value === undefined ? "" : state.roleName.value).trim();
3814
+ if (!/^[a-z][a-z0-9-]{1,31}$/.test(name)) {
3815
+ setRoleError(translate("settings.roleInvalid"));
3816
+ focusNode(state.roleName);
3817
+ return;
3818
+ }
3819
+ const adapter = ["dsh", "claude", "codex"].includes(String(state.roleAdapter.value || "dsh"))
3820
+ ? String(state.roleAdapter.value || "dsh")
3821
+ : "dsh";
3822
+ const model = String(state.roleModel.value === null || state.roleModel.value === undefined ? "" : state.roleModel.value).trim();
3823
+ if (model && !/^[A-Za-z0-9._:-]{1,64}$/.test(model)) {
3824
+ setRoleError(translate("settings.modelInvalid"));
3825
+ focusNode(state.roleModel);
3826
+ return;
3827
+ }
3828
+ const description = String(
3829
+ state.roleDescription.value === null || state.roleDescription.value === undefined ? "" : state.roleDescription.value,
3830
+ ).trim();
3831
+ if (description.length > 2000) {
3832
+ setRoleError(translate("settings.descriptionTooLong"));
3833
+ focusNode(state.roleDescription);
3834
+ return;
3835
+ }
3836
+
3837
+ state.roleBusy = true;
3838
+ state.roleName.disabled = true;
3839
+ state.roleAdapter.disabled = true;
3840
+ state.roleModel.disabled = true;
3841
+ state.roleDescription.disabled = true;
3842
+ state.roleButton.disabled = true;
3843
+ state.roleButton.textContent = translate("settings.addingRole");
3844
+ setRoleError("");
3845
+ try {
3846
+ const body = { name, adapter, description };
3847
+ if (model) body.model = model;
3848
+ const result = await requestAction("roles-add", body);
3849
+ if (!result.ok) {
3850
+ const detail = actionErrorDetail(result.error) || translate("settings.roleFailed");
3851
+ setRoleError(/already exists/i.test(detail) ? translate("settings.roleExists") : detail);
3852
+ return;
3853
+ }
3854
+ await refresh();
3855
+ await refreshSupervisor(true);
3856
+ if (destroyed) return;
3857
+ const trigger = limitsTriggerButton;
3858
+ closeLimitsDialog(false);
3859
+ openLimitsDialog(trigger);
3860
+ showToast("success", translate("settings.roleAdded"), name);
3861
+ } finally {
3862
+ if (!destroyed && limitsState === state) {
3863
+ state.roleBusy = false;
3864
+ state.roleName.disabled = false;
3865
+ state.roleAdapter.disabled = false;
3866
+ state.roleModel.disabled = false;
3867
+ state.roleDescription.disabled = false;
3868
+ state.roleButton.disabled = false;
3869
+ state.roleButton.textContent = translate("settings.addRoleButton");
3870
+ }
3871
+ }
3190
3872
  }
3191
3873
 
3192
3874
  async function saveBeeCounts() {
3193
3875
  const state = limitsState;
3194
- if (!state || state.busy) return;
3876
+ if (!state || state.busy || !state.writable || !state.supervisorAvailable) return;
3195
3877
  const roleLimits = {};
3196
3878
  let invalid = false;
3197
3879
  for (const entry of state.rows) {
@@ -3338,25 +4020,212 @@ function mount(root, options = {}) {
3338
4020
  if (!destroyed) showToast("success", translate("toast.planWritten"), translate("toast.pickupHint"));
3339
4021
  }
3340
4022
 
4023
+
4024
+ // --- new task dialog -----------------------------------------------------
4025
+
4026
+ function onAddKeydown(event) {
4027
+ if (event && (event.key === "Escape" || event.key === "Esc")) closeAddDialog();
4028
+ }
4029
+
4030
+ function closeAddDialog(restoreFocus = true) {
4031
+ if (addOverlay && addOverlay.parentNode) addOverlay.parentNode.removeChild(addOverlay);
4032
+ addOverlay = null;
4033
+ addDialogNode = null;
4034
+ addState = null;
4035
+ addFocusables = [];
4036
+ if (typeof doc.removeEventListener === "function") {
4037
+ doc.removeEventListener("keydown", onAddKeydown);
4038
+ }
4039
+ if (restoreFocus && !destroyed) focusNode(addTriggerButton);
4040
+ addTriggerButton = null;
4041
+ }
4042
+
4043
+ function setAddError(message) {
4044
+ if (!addState) return;
4045
+ addState.error.textContent = message || "";
4046
+ addState.error.className = message ? "hive-limits-error" : "hive-limits-error is-hidden";
4047
+ }
4048
+
4049
+ function addField(labelKey, input, hintKey) {
4050
+ const field = element(doc, "label", "hive-field");
4051
+ field.appendChild(element(doc, "span", "hive-field-label", translate(labelKey)));
4052
+ field.appendChild(input);
4053
+ if (hintKey) field.appendChild(element(doc, "span", "hive-field-hint", translate(hintKey)));
4054
+ return field;
4055
+ }
4056
+
4057
+ function openAddDialog(trigger) {
4058
+ if (destroyed || !lastModel || !lastModel.writable) return;
4059
+ closeHelp(false);
4060
+ closePlanDialog(false);
4061
+ closeLimitsDialog(false);
4062
+ closeDrawer(false);
4063
+ closeAddDialog(false);
4064
+ addTriggerButton = trigger || null;
4065
+
4066
+ const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim");
4067
+ overlay.addEventListener("click", (event) => {
4068
+ if (!event || !event.target || event.target === overlay) closeAddDialog();
4069
+ });
4070
+
4071
+ const dialog = element(doc, "div", "hive-dialog hive-add-dialog");
4072
+ setAttr(dialog, "role", "dialog");
4073
+ setAttr(dialog, "aria-modal", "true");
4074
+ setAttr(dialog, "aria-label", translate("add.dialogTitle"));
4075
+
4076
+ const head = element(doc, "div", "hive-dialog-head");
4077
+ const titleBox = element(doc, "div", "hive-dialog-head-title");
4078
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("add.dialogTitle")));
4079
+ head.appendChild(titleBox);
4080
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost hive-add-close", "×");
4081
+ setAttr(closeButton, "type", "button");
4082
+ setAttr(closeButton, "title", translate("settings.closeAria"));
4083
+ setAttr(closeButton, "aria-label", translate("settings.closeAria"));
4084
+ closeButton.addEventListener("click", () => {
4085
+ closeAddDialog();
4086
+ });
4087
+ head.appendChild(closeButton);
4088
+ dialog.appendChild(head);
4089
+
4090
+ const body = element(doc, "div", "hive-dialog-body hive-add-body");
4091
+ const titleInput = element(doc, "input", "hive-input hive-add-title");
4092
+ setAttr(titleInput, "type", "text");
4093
+ setAttr(titleInput, "maxlength", "2000");
4094
+ setAttr(titleInput, "autocomplete", "off");
4095
+ setAttr(titleInput, "aria-label", translate("add.titleAria"));
4096
+ body.appendChild(addField("add.title", titleInput));
4097
+
4098
+ const roleInput = element(doc, "input", "hive-input hive-add-role");
4099
+ setAttr(roleInput, "type", "text");
4100
+ setAttr(roleInput, "autocomplete", "off");
4101
+ setAttr(roleInput, "aria-label", translate("add.roleAria"));
4102
+ roleInput.value = "coder";
4103
+ body.appendChild(addField("add.role", roleInput));
4104
+
4105
+ const scopeInput = element(doc, "input", "hive-input hive-add-scope");
4106
+ setAttr(scopeInput, "type", "text");
4107
+ setAttr(scopeInput, "autocomplete", "off");
4108
+ setAttr(scopeInput, "aria-label", translate("add.scopeAria"));
4109
+ body.appendChild(addField("add.scope", scopeInput));
4110
+
4111
+ const afterInput = element(doc, "input", "hive-input hive-add-after");
4112
+ setAttr(afterInput, "type", "text");
4113
+ setAttr(afterInput, "autocomplete", "off");
4114
+ setAttr(afterInput, "aria-label", translate("add.afterAria"));
4115
+ body.appendChild(addField("add.after", afterInput));
4116
+
4117
+ const acceptanceInput = element(doc, "textarea", "hive-textarea hive-add-acceptance");
4118
+ setAttr(acceptanceInput, "maxlength", "2000");
4119
+ setAttr(acceptanceInput, "rows", "3");
4120
+ setAttr(acceptanceInput, "aria-label", translate("add.acceptanceAria"));
4121
+ body.appendChild(addField("add.acceptance", acceptanceInput));
4122
+
4123
+ const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
4124
+ body.appendChild(errorNode);
4125
+ dialog.appendChild(body);
4126
+
4127
+ const foot = element(doc, "div", "hive-dialog-foot");
4128
+ const cancelButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("add.cancel"));
4129
+ setAttr(cancelButton, "type", "button");
4130
+ cancelButton.addEventListener("click", () => {
4131
+ closeAddDialog();
4132
+ });
4133
+ const submitButton = element(doc, "button", "hive-btn hive-add-submit", translate("add.submit"));
4134
+ setAttr(submitButton, "type", "button");
4135
+ submitButton.addEventListener("click", () => {
4136
+ void submitAdd();
4137
+ });
4138
+ foot.appendChild(cancelButton);
4139
+ foot.appendChild(submitButton);
4140
+ dialog.appendChild(foot);
4141
+
4142
+ overlay.appendChild(dialog);
4143
+ frame.appendChild(overlay);
4144
+ addOverlay = overlay;
4145
+ addDialogNode = dialog;
4146
+ addState = {
4147
+ overlay,
4148
+ dialog,
4149
+ title: titleInput,
4150
+ role: roleInput,
4151
+ scope: scopeInput,
4152
+ after: afterInput,
4153
+ acceptance: acceptanceInput,
4154
+ error: errorNode,
4155
+ submit: submitButton,
4156
+ cancel: cancelButton,
4157
+ busy: false,
4158
+ };
4159
+ addFocusables = [closeButton, titleInput, roleInput, scopeInput, afterInput, acceptanceInput, cancelButton, submitButton];
4160
+ if (typeof doc.addEventListener === "function") {
4161
+ doc.addEventListener("keydown", onAddKeydown);
4162
+ }
4163
+ focusNode(titleInput);
4164
+ }
4165
+
4166
+ function setAddBusy(busy) {
4167
+ if (!addState) return;
4168
+ addState.busy = busy;
4169
+ addState.title.disabled = busy;
4170
+ addState.role.disabled = busy;
4171
+ addState.scope.disabled = busy;
4172
+ addState.after.disabled = busy;
4173
+ addState.acceptance.disabled = busy;
4174
+ addState.cancel.disabled = busy;
4175
+ addState.submit.disabled = busy;
4176
+ addState.submit.textContent = busy ? translate("add.submitting") : translate("add.submit");
4177
+ }
4178
+
4179
+ async function submitAdd() {
4180
+ if (!addState || addState.busy) return;
4181
+ const title = String(addState.title.value || "").trim();
4182
+ if (!title) {
4183
+ setAddError(translate("add.required"));
4184
+ focusNode(addState.title);
4185
+ return;
4186
+ }
4187
+ const role = String(addState.role.value || "").trim() || "coder";
4188
+ const body = {
4189
+ title,
4190
+ role,
4191
+ scope: splitList(String(addState.scope.value || "")),
4192
+ after: splitList(String(addState.after.value || "")),
4193
+ acceptance: String(addState.acceptance.value || "").trim(),
4194
+ };
4195
+ setAddError("");
4196
+ setAddBusy(true);
4197
+ const result = await postAction("add", body);
4198
+ if (destroyed || !addState) return;
4199
+ if (result) {
4200
+ closeAddDialog();
4201
+ return;
4202
+ }
4203
+ setAddBusy(false);
4204
+ setAddError(translate("status.actionFailed"));
4205
+ }
4206
+
3341
4207
  // --- drawer --------------------------------------------------------------
3342
4208
 
3343
4209
  function onDrawerKeydown(event) {
3344
4210
  if (event && (event.key === "Escape" || event.key === "Esc")) closeDrawer();
3345
4211
  }
3346
4212
 
3347
- function closeDrawer() {
4213
+ function closeDrawer(restoreFocus = true) {
3348
4214
  if (drawerNode && drawerNode.parentNode) drawerNode.parentNode.removeChild(drawerNode);
3349
4215
  drawerNode = null;
3350
4216
  drawerState = null;
3351
4217
  if (typeof doc.removeEventListener === "function") {
3352
4218
  doc.removeEventListener("keydown", onDrawerKeydown);
3353
4219
  }
4220
+ if (restoreFocus && !destroyed) focusNode(drawerTrigger);
4221
+ drawerTrigger = null;
3354
4222
  }
3355
4223
 
3356
4224
  function mountDrawer(eyebrow, title, ariaLabel) {
3357
4225
  closeHelp(false);
3358
4226
  closePlanDialog(false);
3359
- closeDrawer();
4227
+ closeAddDialog(false);
4228
+ closeDrawer(false);
3360
4229
 
3361
4230
  const panel = element(doc, "aside", "hive-drawer");
3362
4231
  setAttr(panel, "role", "dialog");
@@ -3401,45 +4270,108 @@ function mount(root, options = {}) {
3401
4270
  body.appendChild(element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2)));
3402
4271
  }
3403
4272
 
3404
- function openDrawer(card, lane) {
4273
+ function openDrawer(card, lane, trigger) {
4274
+ closeHelp(false);
4275
+ closePlanDialog(false);
4276
+ closeAddDialog(false);
4277
+ closeDrawer(false);
4278
+ drawerTrigger = trigger || null;
4279
+
3405
4280
  const raw = findRawTask(card) || { ...card, state: lane };
3406
4281
  const title = card.title || translate("card.untitled");
3407
- const body = mountDrawer(
3408
- laneLabel(lane) + " · " + (card.id || translate("card.noId")),
3409
- title,
3410
- translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled")),
3411
- );
3412
- drawerState = { kind: "card", card, lane };
3413
- const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
4282
+ const id = card.id || translate("card.noId");
4283
+ const role = asString(card.role) || "—";
4284
+ const status = laneLabel(lane);
4285
+ const repo = lastModel ? lastModel.repo : "";
4286
+ const ariaLabel = translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled"));
4287
+
4288
+ const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim hive-card-scrim");
4289
+ overlay.addEventListener("click", (event) => {
4290
+ if (!event || !event.target || event.target === overlay) closeDrawer();
4291
+ });
4292
+
4293
+ const dialog = element(doc, "div", "hive-dialog hive-card-dialog hive-drawer");
4294
+ setAttr(dialog, "role", "dialog");
4295
+ setAttr(dialog, "aria-modal", "true");
4296
+ setAttr(dialog, "aria-label", ariaLabel);
4297
+
4298
+ const head = element(doc, "div", "hive-dialog-head");
4299
+ const titleBox = element(doc, "div", "hive-dialog-head-title");
4300
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", title));
4301
+ const subline = element(doc, "div", "hive-card-subline");
4302
+ const sublineText = [id, role, status, repo].filter(Boolean).join(" · ");
4303
+ subline.textContent = sublineText;
4304
+ setAttr(subline, "title", sublineText);
4305
+ titleBox.appendChild(subline);
4306
+ head.appendChild(titleBox);
4307
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost hive-card-close", "×");
4308
+ setAttr(closeButton, "type", "button");
4309
+ setAttr(closeButton, "title", translate("drawer.closeAria"));
4310
+ setAttr(closeButton, "aria-label", translate("drawer.closeAria"));
4311
+ closeButton.addEventListener("click", () => {
4312
+ closeDrawer();
4313
+ });
4314
+ head.appendChild(closeButton);
4315
+ dialog.appendChild(head);
4316
+
4317
+ const body = element(doc, "div", "hive-dialog-body hive-card-body");
4318
+ const details = element(doc, "details", "hive-card-json");
4319
+ const summary = element(doc, "summary", "hive-card-json-summary", translate("drawer.rawJson"));
4320
+ const pre = element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2));
4321
+ details.appendChild(summary);
4322
+ details.appendChild(pre);
4323
+ body.appendChild(details);
4324
+ dialog.appendChild(body);
3414
4325
 
4326
+ const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
4327
+ if (actions.length === 0) {
4328
+ body.appendChild(
4329
+ element(
4330
+ doc,
4331
+ "div",
4332
+ "hive-note",
4333
+ lastModel && lastModel.writable ? translate("drawer.noActions") : translate("drawer.readOnly"),
4334
+ ),
4335
+ );
4336
+ }
3415
4337
  if (actions.length > 0) {
3416
- const actionRow = element(doc, "div", "hive-actions-row");
3417
- setAttr(actionRow, "aria-label", translate("drawer.cardActions"));
4338
+ const foot = element(doc, "div", "hive-dialog-foot hive-card-actions");
4339
+ setAttr(foot, "aria-label", translate("drawer.cardActions"));
4340
+ const claimed = asString(card.state || lane) === "claimed";
3418
4341
  for (const action of actions) {
3419
- const button = element(doc, "button", "hive-btn", translate(action.labelKey));
4342
+ const destructive = action.name === "remove";
4343
+ const button = element(
4344
+ doc,
4345
+ "button",
4346
+ "hive-btn" + (destructive ? " hive-btn-danger" : ""),
4347
+ translate(action.labelKey),
4348
+ );
3420
4349
  setAttr(button, "type", "button");
3421
- setAttr(button, "title", translate(action.helpKey));
3422
- setAttr(button, "aria-label", translate(action.helpKey));
4350
+ // The panel never sends --force, so a claimed card's delete control is
4351
+ // rendered but disabled, with the release/reopen reason in its title.
4352
+ const hint = destructive && claimed ? translate("drawer.removeClaimed") : translate(action.helpKey);
4353
+ setAttr(button, "title", hint);
4354
+ setAttr(button, "aria-label", hint);
4355
+ if (destructive && claimed) {
4356
+ button.disabled = true;
4357
+ setAttr(button, "aria-disabled", "true");
4358
+ }
3423
4359
  button.addEventListener("click", () => {
3424
4360
  void runCardAction(action.name, card, lane);
3425
4361
  });
3426
- actionRow.appendChild(button);
4362
+ foot.appendChild(button);
3427
4363
  }
3428
- body.appendChild(actionRow);
3429
- } else {
3430
- const note = element(
3431
- doc,
3432
- "div",
3433
- "hive-note",
3434
- lastModel && lastModel.writable ? translate("drawer.noActions") : translate("drawer.readOnly"),
3435
- );
3436
- body.appendChild(note);
4364
+ dialog.appendChild(foot);
3437
4365
  }
3438
4366
 
3439
- const label = element(doc, "div", "hive-section-label", translate("drawer.rawJson"));
3440
- body.appendChild(label);
3441
- const pre = element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2));
3442
- body.appendChild(pre);
4367
+ overlay.appendChild(dialog);
4368
+ frame.appendChild(overlay);
4369
+ drawerNode = overlay;
4370
+ drawerState = { kind: "card", card, lane };
4371
+ if (typeof doc.addEventListener === "function") {
4372
+ doc.addEventListener("keydown", onDrawerKeydown);
4373
+ }
4374
+ focusNode(closeButton);
3443
4375
  }
3444
4376
 
3445
4377
  // --- actions -------------------------------------------------------------
@@ -3588,34 +4520,12 @@ function mount(root, options = {}) {
3588
4520
  case "mode":
3589
4521
  await postAction("mode", action.body || { mode: "free", reason: "panel" });
3590
4522
  break;
3591
- case "add": {
3592
- const title = ask(translate("prompt.newTitle"), "");
3593
- if (title === null || !title.trim()) return;
3594
- const role = ask(translate("prompt.role"), "coder");
3595
- if (role === null) return;
3596
- const scope = ask(translate("prompt.scope"), "");
3597
- if (scope === null) return;
3598
- const after = ask(translate("prompt.after"), "");
3599
- if (after === null) return;
3600
- await postAction("add", {
3601
- title: title.trim(),
3602
- role: role.trim() || "coder",
3603
- scope: splitList(scope),
3604
- after: splitList(after),
3605
- });
4523
+ case "add":
4524
+ openAddDialog(triggerButton);
3606
4525
  break;
3607
- }
3608
4526
  case "plan":
3609
4527
  openPlanDialog(triggerButton);
3610
4528
  break;
3611
- case "commit": {
3612
- const message = ask(translate("prompt.commitMessage"), "panel commit");
3613
- if (message === null) return;
3614
- const paths = ask(translate("prompt.paths"), "");
3615
- if (paths === null) return;
3616
- await postAction("commit", { message: message.trim() || "panel commit", set: splitList(paths) });
3617
- break;
3618
- }
3619
4529
  default:
3620
4530
  break;
3621
4531
  }
@@ -3648,10 +4558,18 @@ function mount(root, options = {}) {
3648
4558
  case "retry":
3649
4559
  ok = await postAction("retry", { id: card.id });
3650
4560
  break;
4561
+ case "remove": {
4562
+ const name = card.title || card.id || translate("card.untitled");
4563
+ const message = translate("confirm.remove").replace("{title}", name);
4564
+ if (!askConfirm(message)) return;
4565
+ ok = await postAction("remove", { id: card.id });
4566
+ break;
4567
+ }
3651
4568
  default:
3652
4569
  break;
3653
4570
  }
3654
4571
  if (ok && !destroyed) {
4572
+ if (name === "remove") showToast("success", translate("toast.taskRemoved"), "");
3655
4573
  closeDrawer();
3656
4574
  void refresh();
3657
4575
  }
@@ -3692,11 +4610,57 @@ function mount(root, options = {}) {
3692
4610
  initOutputPre.textContent = initOutput && initOutput.stdout ? initOutput.stdout : translate("init.noOutput");
3693
4611
  }
3694
4612
 
4613
+ function queenStorage() {
4614
+ try {
4615
+ const storage = view && view.localStorage;
4616
+ if (storage && typeof storage.getItem === "function" && typeof storage.setItem === "function") {
4617
+ return storage;
4618
+ }
4619
+ } catch {
4620
+ // A blocked localStorage must not break the panel.
4621
+ }
4622
+ return null;
4623
+ }
4624
+
4625
+ function queenDismissStorageKey(repo) {
4626
+ return QUEEN_DISMISS_KEY + "=" + repo;
4627
+ }
4628
+
4629
+ function isQueenNoticeDismissed(repo) {
4630
+ if (!repo) return false;
4631
+ if (queenDismissedFallback.has(repo)) return true;
4632
+ const storage = queenStorage();
4633
+ if (!storage) return false;
4634
+ try {
4635
+ if (storage.getItem(queenDismissStorageKey(repo)) !== null) return true;
4636
+ return storage.getItem(QUEEN_DISMISS_KEY) === repo;
4637
+ } catch {
4638
+ return false;
4639
+ }
4640
+ }
4641
+
4642
+ function dismissQueenNotice() {
4643
+ const repo = lastModel ? lastModel.repo : "";
4644
+ if (!repo) return;
4645
+ queenDismissedFallback.add(repo);
4646
+ const storage = queenStorage();
4647
+ if (storage) {
4648
+ try {
4649
+ storage.setItem(queenDismissStorageKey(repo), "1");
4650
+ storage.setItem(QUEEN_DISMISS_KEY, repo);
4651
+ } catch {
4652
+ // The in-memory fallback above still hides it for this mount.
4653
+ }
4654
+ }
4655
+ if (!destroyed && lastModel) renderQueenHint(lastModel);
4656
+ }
4657
+
3695
4658
  function renderQueenHint(model) {
3696
4659
  const initialised = Boolean(model && model.initialised !== false);
3697
4660
  const state = model && isRecord(model.queen) ? model.queen : null;
3698
4661
  const active = state ? state.active === true : Boolean(queenNotice);
3699
- const show = initialised && Boolean(state || queenNotice);
4662
+ const dismissed = active && isQueenNoticeDismissed(model ? model.repo : "");
4663
+ const show = initialised && Boolean(state || queenNotice) && !dismissed;
3700
4664
  const offer = show && !active;
3701
4665
 
3702
4666
  if (initialised && state) {
@@ -3725,15 +4689,16 @@ function mount(root, options = {}) {
3725
4689
  queenHint.className = "hive-queen-hint" + (show ? " is-visible" : "") + (offer ? " is-offer" : "");
3726
4690
  queenHintText.textContent = active ? translate("init.queen") : translate("queen.offer");
3727
4691
  queenOffer.className = "hive-queen-offer" + (offer ? "" : " is-hidden");
4692
+ queenDismissButton.className =
4693
+ "hive-btn hive-btn-ghost hive-queen-dismiss" + (active && show ? "" : " is-hidden");
4694
+ setAttr(queenDismissButton, "title", translate("queen.dismissAria"));
4695
+ setAttr(queenDismissButton, "aria-label", translate("queen.dismissAria"));
3728
4696
  queenTakeoverButton.disabled = queenBusy;
3729
4697
  queenTakeoverButton.textContent = queenBusy ? translate("queen.takeoverBusy") : translate("queen.takeover");
3730
4698
  const takeoverAria = queenBusy ? translate("queen.takeoverBusy") : translate("queen.takeoverAria");
3731
4699
  setAttr(queenTakeoverButton, "title", takeoverAria);
3732
4700
  setAttr(queenTakeoverButton, "aria-label", takeoverAria);
3733
4701
 
3734
- queenExit.className = "hive-queen-exit" + (active ? "" : " is-hidden");
3735
- queenExitText.textContent = translate("init.queenExit");
3736
- queenCommand.textContent = translate("init.queenCommand");
3737
4702
  queenOutputSummary.textContent = translate("init.queenOutput");
3738
4703
  setAttr(queenOutputSummary, "title", translate("init.queenOutput"));
3739
4704
  const output = initOutput && initOutput.stdout ? initOutput.stdout : translate("init.noOutput");
@@ -3753,10 +4718,9 @@ function mount(root, options = {}) {
3753
4718
  renderSupervisorContent();
3754
4719
  } catch {
3755
4720
  supervisorData = [];
4721
+ supervisorInlineRow = null;
3756
4722
  try {
3757
- supervisorBar.className = "hive-supervisor is-hidden";
3758
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden";
3759
- if (limitsDialogNode) closeLimitsDialog(false);
4723
+ supervisorInline.className = "hive-supervisor-inline is-hidden";
3760
4724
  } catch {
3761
4725
  // Supervisor rendering is optional; never let it break the panel.
3762
4726
  }
@@ -3764,53 +4728,38 @@ function mount(root, options = {}) {
3764
4728
  }
3765
4729
 
3766
4730
  function renderSupervisorContent() {
3767
- clearNode(supervisorRepos);
3768
- supervisorLabel.textContent = translate("supervisor.label");
3769
- setAttr(supervisorBar, "aria-label", translate("supervisor.aria"));
3770
- if (!Array.isArray(supervisorData) || supervisorData.length === 0) {
3771
- supervisorBar.className = "hive-supervisor is-hidden";
3772
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden";
3773
- if (limitsDialogNode) closeLimitsDialog(false);
3774
- return;
3775
- }
3776
- supervisorBar.className = "hive-supervisor";
3777
- const canConfigure = Boolean(lastModel && lastModel.writable);
3778
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits" + (canConfigure ? "" : " is-hidden");
3779
- supervisorLimitsButton.textContent = translate("limits.open");
3780
- setAttr(supervisorLimitsButton, "title", translate("limits.openAria"));
3781
- setAttr(supervisorLimitsButton, "aria-label", translate("limits.openAria"));
3782
- if (!canConfigure && limitsDialogNode) closeLimitsDialog(false);
3783
- for (const row of supervisorData) {
3784
- const item = element(doc, "span", "hive-supervisor-item");
3785
- const path = element(doc, "code", "hive-supervisor-path", row.repo);
3786
- setAttr(path, "title", row.repo);
3787
- item.appendChild(path);
3788
-
3789
- let stateLabel = translate("supervisor.idle");
3790
- if (row.state === "running") {
3791
- stateLabel =
3792
- row.running === null || row.running === undefined
3793
- ? translate("supervisor.running")
3794
- : translate("supervisor.runningCount").replace("{count}", String(row.running));
3795
- } else if (row.state === "backoff") {
3796
- stateLabel = translate("supervisor.backoff");
3797
- } else if (row.state === "paused") {
3798
- stateLabel = translate("supervisor.paused");
3799
- }
3800
- item.appendChild(element(doc, "span", "hive-supervisor-state is-" + row.state, stateLabel));
4731
+ supervisorInlineRow = null;
4732
+ supervisorInline.className = "hive-supervisor-inline is-hidden";
4733
+ supervisorInlineState.className = "hive-supervisor-inline-state";
4734
+ supervisorInlineState.textContent = "";
4735
+ supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume is-hidden";
4736
+ setAttr(supervisorInline, "aria-label", translate("supervisor.aria"));
4737
+ supervisorInlineLabel.textContent = translate("supervisor.label");
4738
+ if (!lastModel || !Array.isArray(supervisorData) || supervisorData.length === 0) return;
4739
+ const row = supervisorData.find((entry) => entry.repo === lastModel.repo);
4740
+ if (!row) return;
3801
4741
 
3802
- if (row.state === "paused") {
3803
- const button = element(doc, "button", "hive-btn hive-supervisor-resume", translate("supervisor.resume"));
3804
- setAttr(button, "type", "button");
3805
- const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
3806
- setAttr(button, "title", aria);
3807
- setAttr(button, "aria-label", aria);
3808
- button.addEventListener("click", () => {
3809
- void resumeSupervisor(row, button);
3810
- });
3811
- item.appendChild(button);
3812
- }
3813
- supervisorRepos.appendChild(item);
4742
+ supervisorInlineRow = row;
4743
+ supervisorInline.className = "hive-supervisor-inline";
4744
+ let stateLabel = translate("supervisor.idle");
4745
+ if (row.state === "running") {
4746
+ stateLabel =
4747
+ row.running === null || row.running === undefined
4748
+ ? translate("supervisor.running")
4749
+ : translate("supervisor.runningCount").replace("{count}", String(row.running));
4750
+ } else if (row.state === "backoff") {
4751
+ stateLabel = translate("supervisor.backoff");
4752
+ } else if (row.state === "paused") {
4753
+ stateLabel = translate("supervisor.paused");
4754
+ }
4755
+ supervisorInlineState.className = "hive-supervisor-inline-state is-" + row.state;
4756
+ supervisorInlineState.textContent = stateLabel;
4757
+
4758
+ if (row.state === "paused") {
4759
+ const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
4760
+ supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume";
4761
+ setAttr(supervisorInlineResume, "title", aria);
4762
+ setAttr(supervisorInlineResume, "aria-label", aria);
3814
4763
  }
3815
4764
  }
3816
4765
 
@@ -4048,11 +4997,11 @@ function mount(root, options = {}) {
4048
4997
  foot.appendChild(element(doc, "span", "hive-card-state", laneLabel(lane)));
4049
4998
  node.appendChild(foot);
4050
4999
 
4051
- node.addEventListener("click", () => openDrawer(card, lane));
5000
+ node.addEventListener("click", () => openDrawer(card, lane, node));
4052
5001
  node.addEventListener("keydown", (event) => {
4053
5002
  if (!event || (event.key !== "Enter" && event.key !== " ")) return;
4054
5003
  if (typeof event.preventDefault === "function") event.preventDefault();
4055
- openDrawer(card, lane);
5004
+ openDrawer(card, lane, node);
4056
5005
  });
4057
5006
  return node;
4058
5007
  }
@@ -4178,8 +5127,6 @@ function mount(root, options = {}) {
4178
5127
  function render(model) {
4179
5128
  repoNode.textContent = model.repo || "—";
4180
5129
  setAttr(repoNode, "title", model.repo);
4181
- timeNode.textContent = model.at ? formatStamp(model.at) : "—";
4182
- setAttr(timeNode, "datetime", model.at);
4183
5130
 
4184
5131
  renderInit(model);
4185
5132
  renderQueenHint(model);
@@ -4202,6 +5149,7 @@ function mount(root, options = {}) {
4202
5149
  if (helpWasOpen) closeHelp(false);
4203
5150
  if (planDialogNode) closePlanDialog(false);
4204
5151
  if (limitsDialogNode) closeLimitsDialog(false);
5152
+ if (addDialogNode) closeAddDialog(false);
4205
5153
  try {
4206
5154
  applyChrome();
4207
5155
  if (lastModel) render(lastModel);
@@ -4326,6 +5274,7 @@ function mount(root, options = {}) {
4326
5274
  closeHelp(false);
4327
5275
  closePlanDialog(false);
4328
5276
  closeLimitsDialog(false);
5277
+ closeAddDialog(false);
4329
5278
  closeToast();
4330
5279
  closeDrawer();
4331
5280
  if (frame.parentNode) frame.parentNode.removeChild(frame);