@d86e/hive-panel 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/public/panel.js CHANGED
@@ -10,26 +10,30 @@ const MAX_EVENTS = 80;
10
10
  const DEFAULT_SNAPSHOT_URL = "/api/snapshot";
11
11
  const DEFAULT_ACTIONS_URL = "/api/actions";
12
12
  const DEFAULT_SUPERVISOR_URL = "/api/hive-runner";
13
+ const QUEEN_DISMISS_KEY = "hive.queenNoticeDismissed";
13
14
  const DEFAULT_INTERVAL_MS = 3000;
14
15
 
15
16
  const CARD_ACTIONS = Object.freeze({
16
- pending: Object.freeze(["claim"]),
17
- claimed: Object.freeze(["done", "fail"]),
18
- done: Object.freeze([]),
19
- blocked: Object.freeze(["retry"]),
20
- failed: Object.freeze(["retry"]),
17
+ // remove is available in every stored state; the drawer renders it as a
18
+ // danger button, disabled with an explanation while the card is claimed
19
+ // (the panel never sends --force, so the CLI would refuse).
20
+ pending: Object.freeze(["claim", "remove"]),
21
+ claimed: Object.freeze(["done", "fail", "remove"]),
22
+ done: Object.freeze(["remove"]),
23
+ blocked: Object.freeze(["retry", "remove"]),
24
+ failed: Object.freeze(["retry", "remove"]),
21
25
  });
22
26
 
23
27
  const ACTION_META = Object.freeze({
24
- freeze: { labelKey: "action.freeze", helpKey: "help.action.freeze", paramsKey: "help.params.mode" },
25
- unfreeze: { labelKey: "action.unfreeze", helpKey: "help.action.unfreeze", paramsKey: "help.params.mode" },
26
- add: { labelKey: "action.add", helpKey: "help.action.add", paramsKey: "help.params.add" },
27
- plan: { labelKey: "action.plan", helpKey: "help.action.plan", paramsKey: "help.params.plan" },
28
- commit: { labelKey: "action.commit", helpKey: "help.action.commit", paramsKey: "help.params.commit" },
29
- claim: { labelKey: "action.claim", helpKey: "help.action.claim", paramsKey: "help.params.claim" },
30
- done: { labelKey: "action.done", helpKey: "help.action.done", paramsKey: "help.params.done" },
31
- fail: { labelKey: "action.fail", helpKey: "help.action.fail", paramsKey: "help.params.fail" },
32
- retry: { labelKey: "action.retry", helpKey: "help.action.retry", paramsKey: "help.params.retry" },
28
+ freeze: { labelKey: "action.freeze", helpKey: "help.action.freeze" },
29
+ unfreeze: { labelKey: "action.unfreeze", helpKey: "help.action.unfreeze" },
30
+ add: { labelKey: "action.add", helpKey: "help.action.add" },
31
+ plan: { labelKey: "action.plan", helpKey: "help.action.plan" },
32
+ claim: { labelKey: "action.claim", helpKey: "help.action.claim" },
33
+ done: { labelKey: "action.done", helpKey: "help.action.done" },
34
+ fail: { labelKey: "action.fail", helpKey: "help.action.fail" },
35
+ retry: { labelKey: "action.retry", helpKey: "help.action.retry" },
36
+ remove: { labelKey: "action.remove", helpKey: "help.action.remove" },
33
37
  });
34
38
 
35
39
  const MIN_PLAN_CARDS = 1;
@@ -102,6 +106,23 @@ const PANEL_STYLES = `.hive { position: relative; }
102
106
  font-weight: 700;
103
107
  }
104
108
 
109
+ /* Destructive card action: the drawer's delete control. */
110
+ .hive-btn-danger {
111
+ border-color: color-mix(in srgb, var(--hive-danger) 55%, var(--hive-line, #232b38));
112
+ background: color-mix(in srgb, var(--hive-danger) 12%, transparent);
113
+ color: color-mix(in srgb, var(--hive-danger) 88%, var(--hive-fg, #e6edf3));
114
+ }
115
+
116
+ .hive-btn-danger:hover:not(:disabled) {
117
+ border-color: color-mix(in srgb, var(--hive-danger) 75%, var(--hive-line, #232b38));
118
+ background: color-mix(in srgb, var(--hive-danger) 22%, transparent);
119
+ }
120
+
121
+ .hive-btn-danger:disabled {
122
+ opacity: 0.5;
123
+ cursor: not-allowed;
124
+ }
125
+
105
126
  .hive-overlay { position: absolute; inset: 0; z-index: 2147483000; }
106
127
  .hive-help-scrim { background: transparent; }
107
128
  .hive-dialog-scrim {
@@ -692,8 +713,9 @@ const PANEL_STYLES = `.hive { position: relative; }
692
713
  .hive-queen-hint {
693
714
  display: none;
694
715
  flex: 0 0 auto;
695
- flex-direction: column;
696
- gap: 4px;
716
+ align-items: flex-start;
717
+ flex-direction: row;
718
+ gap: 8px;
697
719
  padding: 10px 16px;
698
720
  border-bottom: 1px solid color-mix(in srgb, var(--hive-accent, #58c4dc) 32%, var(--hive-line, #232b38));
699
721
  background: var(--hive-accent-soft);
@@ -735,6 +757,14 @@ const PANEL_STYLES = `.hive { position: relative; }
735
757
  color: var(--hive-fg-soft);
736
758
  }
737
759
 
760
+ .hive-queen-body {
761
+ display: flex;
762
+ flex: 1 1 auto;
763
+ flex-direction: column;
764
+ gap: 4px;
765
+ min-width: 0;
766
+ }
767
+
738
768
  .hive-queen-offer {
739
769
  display: flex;
740
770
  flex-wrap: wrap;
@@ -743,8 +773,18 @@ const PANEL_STYLES = `.hive { position: relative; }
743
773
  max-width: 76ch;
744
774
  }
745
775
 
746
- .hive-queen-offer.is-hidden,
747
- .hive-queen-exit.is-hidden { display: none; }
776
+ .hive-queen-offer.is-hidden { display: none; }
777
+
778
+ .hive-queen-dismiss {
779
+ flex: 0 0 auto;
780
+ min-width: 24px;
781
+ padding: 0 6px;
782
+ color: var(--hive-fg-soft);
783
+ font-size: 16px;
784
+ line-height: 1.4;
785
+ }
786
+
787
+ .hive-queen-dismiss.is-hidden { display: none; }
748
788
 
749
789
  .hive-queen-takeover {
750
790
  border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 45%, var(--hive-line, #232b38));
@@ -764,28 +804,6 @@ const PANEL_STYLES = `.hive { position: relative; }
764
804
  overflow-wrap: anywhere;
765
805
  }
766
806
 
767
- .hive-queen-exit {
768
- display: flex;
769
- flex-wrap: wrap;
770
- align-items: baseline;
771
- gap: 5px;
772
- max-width: 76ch;
773
- color: color-mix(in srgb, var(--hive-accent, #58c4dc) 80%, var(--hive-fg, #e6edf3));
774
- }
775
-
776
- .hive-queen-command {
777
- padding: 1px 6px;
778
- border: 1px solid color-mix(in srgb, var(--hive-accent, #58c4dc) 30%, var(--hive-line, #232b38));
779
- border-radius: 4px;
780
- background: color-mix(in srgb, var(--hive-fg, #e6edf3) 10%, transparent);
781
- color: var(--hive-fg, #e6edf3);
782
- font-family: var(--hive-mono);
783
- font-size: 10px;
784
- line-height: 1.5;
785
- cursor: text;
786
- user-select: text;
787
- }
788
-
789
807
  .hive-queen-output {
790
808
  margin-top: 6px;
791
809
  border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 32%, var(--hive-line, #232b38));
@@ -913,7 +931,7 @@ const PANEL_STYLES = `.hive { position: relative; }
913
931
 
914
932
  .hive-limits-row {
915
933
  display: grid;
916
- grid-template-columns: minmax(0, 1fr) 72px 48px 48px;
934
+ grid-template-columns: minmax(0, 1fr) 96px 48px 48px;
917
935
  align-items: center;
918
936
  gap: 6px;
919
937
  min-width: 0;
@@ -1009,6 +1027,95 @@ const PANEL_STYLES = `.hive { position: relative; }
1009
1027
  overflow-wrap: anywhere;
1010
1028
  }
1011
1029
 
1030
+ .hive-supervisor-inline {
1031
+ display: inline-flex;
1032
+ flex-wrap: wrap;
1033
+ align-items: center;
1034
+ gap: 5px;
1035
+ min-width: 0;
1036
+ padding: 1px 8px;
1037
+ border: 1px solid var(--hive-line, #232b38);
1038
+ border-radius: 999px;
1039
+ background: var(--hive-surface);
1040
+ color: var(--hive-fg-soft);
1041
+ font-size: 10px;
1042
+ line-height: 1.6;
1043
+ }
1044
+
1045
+ .hive-supervisor-inline.is-hidden { display: none; }
1046
+
1047
+ .hive-supervisor-inline-label {
1048
+ color: var(--hive-fg-faint);
1049
+ font-size: 9.5px;
1050
+ font-weight: 650;
1051
+ letter-spacing: 0.1em;
1052
+ text-transform: uppercase;
1053
+ }
1054
+
1055
+ .hive-supervisor-inline-state {
1056
+ color: var(--hive-fg-soft);
1057
+ font-weight: 600;
1058
+ white-space: nowrap;
1059
+ }
1060
+
1061
+ .hive-supervisor-inline-state.is-running { color: var(--hive-ok); }
1062
+ .hive-supervisor-inline-state.is-idle { color: var(--hive-fg-soft); }
1063
+ .hive-supervisor-inline-state.is-backoff { color: var(--hive-warn); }
1064
+ .hive-supervisor-inline-state.is-paused { color: var(--hive-danger); }
1065
+
1066
+ .hive-supervisor-inline-resume {
1067
+ padding: 1px 6px;
1068
+ font-size: 9.5px;
1069
+ line-height: 1.3;
1070
+ }
1071
+
1072
+ .hive-supervisor-inline-resume.is-hidden { display: none; }
1073
+
1074
+ .hive-settings-trigger {
1075
+ flex: 0 0 auto;
1076
+ min-width: 28px;
1077
+ padding-inline: 8px;
1078
+ font-size: 14px;
1079
+ line-height: 1.2;
1080
+ }
1081
+
1082
+ .hive-settings-section {
1083
+ display: flex;
1084
+ flex-direction: column;
1085
+ gap: 8px;
1086
+ min-width: 0;
1087
+ padding-top: 12px;
1088
+ border-top: 1px solid color-mix(in srgb, var(--hive-line, #232b38) 70%, transparent);
1089
+ }
1090
+
1091
+ .hive-settings-section:first-of-type { padding-top: 0; border-top: 0; }
1092
+
1093
+ .hive-settings-section-title {
1094
+ color: var(--hive-fg, #e6edf3);
1095
+ font-size: 11px;
1096
+ font-weight: 650;
1097
+ letter-spacing: 0.08em;
1098
+ text-transform: uppercase;
1099
+ }
1100
+
1101
+ .hive-settings-role-form { align-items: flex-end; }
1102
+
1103
+ .hive-settings-role-description { width: 100%; }
1104
+
1105
+ .hive-settings-role-description .hive-textarea { width: 100%; }
1106
+
1107
+ .hive-settings-role-form .hive-field:first-child { flex: 1 1 200px; }
1108
+
1109
+ .hive-settings-note {
1110
+ padding: 8px 10px;
1111
+ border: 1px solid color-mix(in srgb, var(--hive-warn) 38%, var(--hive-line, #232b38));
1112
+ border-radius: 6px;
1113
+ background: color-mix(in srgb, var(--hive-warn) 9%, transparent);
1114
+ color: var(--hive-warn);
1115
+ font-size: 10.5px;
1116
+ line-height: 1.55;
1117
+ }
1118
+
1012
1119
  /* -------------------------------------------------------------------- spacing */
1013
1120
  .hive {
1014
1121
  gap: 8px;
@@ -1045,8 +1152,7 @@ const PANEL_STYLES = `.hive { position: relative; }
1045
1152
  .hive-plan-hint,
1046
1153
  .hive-limits-description,
1047
1154
  .hive-limits-hint,
1048
- .hive-queen-text,
1049
- .hive-queen-exit { max-width: 76ch; line-height: 1.55; }
1155
+ .hive-queen-text { max-width: 76ch; line-height: 1.55; }
1050
1156
 
1051
1157
  .hive-empty,
1052
1158
  .hive-filter-empty,
@@ -1083,6 +1189,46 @@ const PANEL_STYLES = `.hive { position: relative; }
1083
1189
  line-height: 1.55;
1084
1190
  }
1085
1191
 
1192
+ .hive-icon-button {
1193
+ display: inline-flex;
1194
+ flex: 0 0 28px;
1195
+ align-items: center;
1196
+ justify-content: center;
1197
+ width: 28px;
1198
+ min-width: 28px;
1199
+ height: 28px;
1200
+ padding: 0;
1201
+ border: 0;
1202
+ border-color: transparent;
1203
+ background: transparent;
1204
+ color: color-mix(in srgb, var(--hive-fg, #e6edf3) 80%, transparent);
1205
+ font-size: 0;
1206
+ line-height: 1;
1207
+ box-shadow: none;
1208
+ cursor: pointer;
1209
+ }
1210
+
1211
+ .hive-icon-button:hover {
1212
+ border: 0;
1213
+ border-color: transparent;
1214
+ background: transparent;
1215
+ color: var(--hive-fg, #e6edf3);
1216
+ }
1217
+
1218
+ .hive-icon-button:active { transform: none; }
1219
+
1220
+ .hive-icon-button:focus-visible {
1221
+ outline: 2px solid var(--hive-accent, #58c4dc);
1222
+ outline-offset: 1px;
1223
+ }
1224
+
1225
+ .hive-icon-button svg {
1226
+ display: block;
1227
+ width: 16px;
1228
+ height: 16px;
1229
+ pointer-events: none;
1230
+ }
1231
+
1086
1232
  @media (max-width: 520px) {
1087
1233
  .hive { gap: 6px; padding: 12px; }
1088
1234
  .hive-bar,
@@ -1107,7 +1253,183 @@ const PANEL_STYLES = `.hive { position: relative; }
1107
1253
  .hive-dialog-foot .hive-btn { flex: 1 1 auto; }
1108
1254
  .hive-help { right: 8px; width: calc(100% - 16px); max-height: 66vh; }
1109
1255
  .hive-toast { right: 8px; bottom: 8px; width: calc(100% - 16px); }
1110
- }`;
1256
+ }
1257
+
1258
+ .hive-settings-actions {
1259
+ display: flex;
1260
+ align-items: center;
1261
+ justify-content: flex-end;
1262
+ gap: 8px;
1263
+ width: 100%;
1264
+ }
1265
+
1266
+ .hive-settings-actions .hive-btn {
1267
+ display: inline-flex;
1268
+ flex: 0 0 auto;
1269
+ align-items: center;
1270
+ justify-content: center;
1271
+ height: 28px;
1272
+ min-height: 28px;
1273
+ padding: 0 14px;
1274
+ border-radius: 7px;
1275
+ font-size: 11.5px;
1276
+ line-height: 1;
1277
+ }
1278
+
1279
+ .hive-settings-primary {
1280
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1281
+ background: var(--hive-accent, #58c4dc);
1282
+ color: var(--hive-bg, #0b0f17);
1283
+ }
1284
+
1285
+ .hive-settings-primary:hover {
1286
+ border-color: var(--hive-accent, #58c4dc);
1287
+ background: color-mix(in srgb, var(--hive-accent, #58c4dc) 86%, white);
1288
+ color: var(--hive-bg, #0b0f17);
1289
+ }
1290
+
1291
+ .hive-settings-secondary {
1292
+ border-color: var(--hive-line, #232b38);
1293
+ background: var(--hive-surface-strong);
1294
+ color: var(--hive-fg, #e6edf3);
1295
+ }
1296
+
1297
+ .hive-settings-secondary:hover {
1298
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 40%, var(--hive-line, #232b38));
1299
+ background: var(--hive-surface-hover);
1300
+ color: var(--hive-fg, #e6edf3);
1301
+ }
1302
+
1303
+ .hive-settings-actions .hive-btn:disabled {
1304
+ opacity: 0.55;
1305
+ cursor: not-allowed;
1306
+ }
1307
+
1308
+ @media (max-width: 420px) {
1309
+ .hive-settings-actions { justify-content: stretch; }
1310
+ .hive-settings-actions .hive-btn { flex: 1 1 0; }
1311
+ }
1312
+
1313
+ @container hiveboard (max-width: 419px) {
1314
+ .hive-settings-actions { justify-content: stretch; }
1315
+ .hive-settings-actions .hive-btn { flex: 1 1 0; }
1316
+ }
1317
+
1318
+ .hive-card-scrim { padding: 12px; }
1319
+
1320
+ .hive-card-dialog {
1321
+ position: relative;
1322
+ inset: auto;
1323
+ width: min(720px, 92vw);
1324
+ max-width: 92vw;
1325
+ height: auto;
1326
+ max-height: 80vh;
1327
+ border: 1px solid var(--hive-line, #232b38);
1328
+ border-radius: 12px;
1329
+ background: color-mix(in srgb, var(--hive-bg, #0b0f17) 97%, var(--hive-fg, #e6edf3) 3%);
1330
+ box-shadow: 0 24px 70px rgb(0 0 0 / 52%);
1331
+ overflow: hidden;
1332
+ }
1333
+
1334
+ .hive-card-dialog .hive-dialog-head { align-items: flex-start; }
1335
+
1336
+ .hive-card-subline {
1337
+ margin-top: 3px;
1338
+ overflow-wrap: anywhere;
1339
+ color: var(--hive-fg-soft);
1340
+ font-family: var(--hive-mono);
1341
+ font-size: 10.5px;
1342
+ line-height: 1.5;
1343
+ }
1344
+
1345
+ .hive-card-close {
1346
+ min-width: 28px;
1347
+ height: 28px;
1348
+ padding: 0 6px;
1349
+ color: var(--hive-fg-soft);
1350
+ font-size: 18px;
1351
+ line-height: 1;
1352
+ }
1353
+
1354
+ .hive-card-body {
1355
+ display: flex;
1356
+ flex-direction: column;
1357
+ gap: 12px;
1358
+ min-height: 0;
1359
+ overflow: auto;
1360
+ }
1361
+
1362
+ .hive-card-json {
1363
+ border: 1px solid var(--hive-line, #232b38);
1364
+ border-radius: 8px;
1365
+ background: var(--hive-surface);
1366
+ overflow: hidden;
1367
+ }
1368
+
1369
+ .hive-card-json-summary {
1370
+ padding: 8px 10px;
1371
+ color: var(--hive-fg-soft);
1372
+ font-size: 10px;
1373
+ font-weight: 650;
1374
+ letter-spacing: 0.08em;
1375
+ line-height: 1.5;
1376
+ text-transform: uppercase;
1377
+ cursor: pointer;
1378
+ user-select: none;
1379
+ }
1380
+
1381
+ .hive-card-json .hive-json {
1382
+ max-height: 300px;
1383
+ margin: 0;
1384
+ padding: 10px;
1385
+ overflow: auto;
1386
+ border-top: 1px solid var(--hive-line, #232b38);
1387
+ font-family: var(--hive-mono);
1388
+ font-size: 10.5px;
1389
+ line-height: 1.5;
1390
+ white-space: pre-wrap;
1391
+ }
1392
+
1393
+ .hive-card-actions {
1394
+ justify-content: flex-end;
1395
+ gap: 8px;
1396
+ flex-wrap: wrap;
1397
+ }
1398
+
1399
+ .hive-add-dialog {
1400
+ width: min(560px, 92vw);
1401
+ max-width: 92vw;
1402
+ max-height: 80vh;
1403
+ }
1404
+
1405
+ .hive-add-body {
1406
+ display: flex;
1407
+ flex-direction: column;
1408
+ gap: 10px;
1409
+ min-height: 0;
1410
+ overflow: auto;
1411
+ }
1412
+
1413
+ .hive-add-body .hive-field { width: 100%; }
1414
+
1415
+ .hive-add-body .hive-input,
1416
+ .hive-add-body .hive-textarea { width: 100%; }
1417
+
1418
+ .hive-add-acceptance { min-height: 70px; }
1419
+
1420
+ .hive-add-submit {
1421
+ border-color: color-mix(in srgb, var(--hive-accent, #58c4dc) 70%, var(--hive-line, #232b38));
1422
+ background: var(--hive-accent, #58c4dc);
1423
+ color: var(--hive-bg, #0b0f17);
1424
+ }
1425
+
1426
+ .hive-add-submit:hover:not(:disabled) {
1427
+ border-color: var(--hive-accent, #58c4dc);
1428
+ background: color-mix(in srgb, var(--hive-accent, #58c4dc) 86%, white);
1429
+ color: var(--hive-bg, #0b0f17);
1430
+ }
1431
+
1432
+ `;
1111
1433
 
1112
1434
  const LANE_LABEL_KEYS = Object.freeze({
1113
1435
  pending: "lane.pending",
@@ -1128,13 +1450,13 @@ export const messages = Object.freeze({
1128
1450
  "actions.aria": "board actions",
1129
1451
  "action.add": "New task",
1130
1452
  "action.claim": "claim",
1131
- "action.commit": "commit",
1132
1453
  "action.done": "done",
1133
1454
  "action.fail": "fail",
1134
- "action.freeze": "freeze",
1455
+ "action.freeze": "Pause",
1135
1456
  "action.modeTitle": "Toggle board mode",
1457
+ "action.remove": "Delete task",
1136
1458
  "action.retry": "retry",
1137
- "action.unfreeze": "unfreeze",
1459
+ "action.unfreeze": "Resume",
1138
1460
  "pane.agents": "agents",
1139
1461
  "pane.board": "board",
1140
1462
  "pane.events": "events",
@@ -1153,7 +1475,7 @@ export const messages = Object.freeze({
1153
1475
  "mode.freeze": "freeze",
1154
1476
  "mode.free.help": "Free: anyone can claim tasks.",
1155
1477
  "mode.freeze.help": "Freeze: only tasks tagged fix can be claimed; use this while the pipeline is red.",
1156
- "mode.freeze.banner": "Frozen: only tasks tagged fix can be claimed.",
1478
+ "mode.freeze.banner": "Paused: only tasks tagged fix can be claimed.",
1157
1479
  "mode.title": "mode:",
1158
1480
  "stats.cards": "tasks",
1159
1481
  "stats.oldest": "oldest",
@@ -1184,6 +1506,7 @@ export const messages = Object.freeze({
1184
1506
  "drawer.cardActions": "task actions",
1185
1507
  "drawer.noActions": "No actions for this state.",
1186
1508
  "drawer.readOnly": "Read-only: writable=false.",
1509
+ "drawer.removeClaimed": "A claimed task must be released or reopened before it can be deleted.",
1187
1510
  "drawer.rawJson": "raw json",
1188
1511
  "events.empty": "No events yet.",
1189
1512
  "events.showAll": "Show all events",
@@ -1199,45 +1522,85 @@ export const messages = Object.freeze({
1199
1522
  "supervisor.resumeAria": "Resume the supervisor for {repo}",
1200
1523
  "supervisor.resumeFailed": "Could not resume the supervisor",
1201
1524
  "limits.open": "Settings",
1202
- "limits.openAria": "Configure bee counts for this repository",
1203
- "limits.title": "Bee counts",
1204
- "limits.aria": "Bee counts for this repository",
1205
- "limits.description": "Concurrency limit per role. 0 pauses that role. Default 5.",
1525
+ "limits.openAria": "Open agent concurrency settings",
1526
+ "limits.title": "Agent concurrency",
1527
+ "limits.aria": "Agent concurrency for this repository",
1528
+ "limits.description": "Max agents working at the same time, per role; 0 pauses the role",
1206
1529
  "limits.role": "Role",
1207
- "limits.limit": "Limit",
1530
+ "limits.limit": "Concurrency limit",
1208
1531
  "limits.inFlight": "In flight",
1209
1532
  "limits.queued": "Queued",
1210
1533
  "limits.defaultHint": "0-999, default 5",
1211
1534
  "limits.limitAria": "Concurrency limit for {role}",
1212
1535
  "limits.save": "Save",
1213
- "limits.saveAria": "Save bee counts for {repo}",
1536
+ "limits.saveAria": "Save agent concurrency for {repo}",
1214
1537
  "limits.saving": "Saving...",
1215
- "limits.saved": "Bee counts saved.",
1216
- "limits.failed": "Could not save bee counts",
1538
+ "limits.saved": "Agent concurrency saved.",
1539
+ "limits.failed": "Could not save agent concurrency",
1217
1540
  "limits.invalid": "Every limit must be an integer from 0 to 999.",
1218
1541
  "limits.none": "No role data for this repository.",
1219
1542
  "limits.close": "Close",
1220
- "limits.closeAria": "Close bee count settings",
1543
+ "limits.closeAria": "Close agent concurrency settings",
1544
+ "settings.openAria": "Open settings for this repository",
1545
+ "settings.title": "Settings",
1546
+ "settings.aria": "Settings for this repository",
1547
+ "settings.addRole": "Add role",
1548
+ "settings.roleName": "Role name",
1549
+ "settings.roleNameHint": "start with a lowercase letter; 2-32 characters; lowercase letters, digits and hyphens only",
1550
+ "settings.roleNameAria": "New role name",
1551
+ "settings.roleNameExample": "e.g. reviewer",
1552
+ "settings.roleDescription": "Responsibilities",
1553
+ "settings.roleDescriptionAria": "Responsibilities for the new role (optional)",
1554
+ "settings.roleDescriptionHint": "Written to .hive/roles/<name>.md; the agent reads it when it starts.",
1555
+ "settings.roleDescriptionMax": "optional, up to 2000 characters",
1556
+ "settings.descriptionTooLong": "Responsibilities must be at most 2000 characters.",
1557
+ "settings.adapter": "Adapter",
1558
+ "settings.adapterAria": "Adapter for the new role",
1559
+ "settings.model": "Model",
1560
+ "settings.modelOptional": "optional",
1561
+ "settings.modelAria": "Optional model for the new role",
1562
+ "settings.addRoleButton": "Add role",
1563
+ "settings.addRoleAria": "Add this role",
1564
+ "settings.addingRole": "Adding...",
1565
+ "settings.roleInvalid": "Role name must start with a lowercase letter, be 2-32 characters, and use lowercase letters, digits and hyphens only.",
1566
+ "settings.modelInvalid": "Model may use letters, digits, dot, underscore, colon and hyphen (max 64).",
1567
+ "settings.roleExists": "Role already exists.",
1568
+ "settings.roleAdded": "Role added.",
1569
+ "settings.roleFailed": "Could not add role",
1570
+ "settings.readOnly": "Read-only: roles and limits cannot be changed.",
1571
+ "settings.supervisorUnavailable": "Supervisor unavailable; role limits cannot load.",
1572
+ "settings.saveLimits": "Save limits",
1573
+ "settings.close": "Close",
1574
+ "settings.closeAria": "Close settings",
1221
1575
  "event.unknown": "event",
1576
+ "add.dialogTitle": "New task",
1577
+ "add.title": "Title",
1578
+ "add.titleAria": "New task title",
1579
+ "add.role": "Role",
1580
+ "add.roleAria": "Role for the new task",
1581
+ "add.scope": "Scope (comma separated, optional)",
1582
+ "add.scopeAria": "File scope for the new task",
1583
+ "add.after": "After task ids (comma separated, optional)",
1584
+ "add.afterAria": "Tasks that must finish first",
1585
+ "add.acceptance": "Acceptance criteria (optional)",
1586
+ "add.acceptanceAria": "Acceptance criteria for the new task",
1587
+ "add.cancel": "Cancel",
1588
+ "add.submit": "Add task",
1589
+ "add.submitting": "Adding…",
1590
+ "add.required": "A title is required.",
1222
1591
  "prompt.newTitle": "New task title",
1223
1592
  "prompt.role": "Role",
1224
1593
  "prompt.scope": "Scope (comma separated, optional)",
1225
1594
  "prompt.after": "After task ids (comma separated, optional)",
1226
- "prompt.commitMessage": "Commit message",
1227
- "prompt.paths": "Paths (comma separated, optional)",
1228
1595
  "prompt.claimAgent": "Claim as agent",
1229
1596
  "prompt.commitSha": "Commit sha (optional)",
1230
1597
  "prompt.failReason": "Failure reason",
1231
- "action.plan": "Give the Queen a goal",
1232
- "help.open": "What these buttons do",
1598
+ "action.plan": "Set the Queen a goal",
1233
1599
  "menu.open": "More actions and help",
1234
- "help.title": "Button guide",
1235
- "help.aria": "Action guide",
1600
+ "help.title": "Menu",
1601
+ "help.aria": "Menu",
1236
1602
  "help.close": "close",
1237
- "help.closeAria": "Close the button guide",
1238
- "help.board": "board actions",
1239
- "help.tasks": "task actions",
1240
- "help.params": "Parameters: ",
1603
+ "help.closeAria": "Close the menu",
1241
1604
  "help.readOnly": "The panel started read-only; add --write to show the write-action buttons.",
1242
1605
  "help.uninitialised": "Initialise Hive with the button in the main area before using board actions.",
1243
1606
  "init.repo": "repository",
@@ -1252,9 +1615,11 @@ export const messages = Object.freeze({
1252
1615
  "init.output": "stdout",
1253
1616
  "init.noOutput": "(no output)",
1254
1617
  "init.queen": "This session's input now routes to the Queen (it splits tasks, it does not do the work).",
1255
- "init.queenExit": "Exit from the chat window:",
1256
- "init.queenCommand": "/queen off",
1257
1618
  "init.queenOutput": "Initialisation output",
1619
+ "queen.dismiss": "Dismiss",
1620
+ "queen.dismissAria": "Dismiss the Queen notice for this repository",
1621
+ "help.queen": "Queen mode",
1622
+ "help.queenDesc": "Type /queen off to exit. After exiting, this session returns to normal coding mode. Hiding the notice does not change Queen mode.",
1258
1623
  "queen.status.active": "Queen active",
1259
1624
  "queen.status.inactive": "Queen not active",
1260
1625
  "queen.source.auto": "auto",
@@ -1265,29 +1630,20 @@ export const messages = Object.freeze({
1265
1630
  "queen.takeover": "Let the Queen take over",
1266
1631
  "queen.takeoverAria": "Let the Queen take over this session",
1267
1632
  "queen.takeoverBusy": "Taking over...",
1268
- "help.hint": "Open a task to see the actions for that task.",
1269
- "help.action.freeze": "Freeze: nobody can claim new tasks except tasks tagged fix.",
1270
- "help.action.unfreeze": "Unfreeze: agents can claim pending tasks again.",
1633
+ "help.action.freeze": "Pause: only tasks tagged fix can be claimed.",
1634
+ "help.action.unfreeze": "Resume: agents can claim pending tasks again.",
1271
1635
  "help.action.add": "New task: create a pending task with a role and file scope.",
1272
- "help.action.plan": "Give the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
1273
- "help.action.commit": "Commit: commit the selected paths with a message.",
1636
+ "help.action.plan": "Set the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
1274
1637
  "help.action.claim": "Claim: lease a pending task for an agent.",
1275
1638
  "help.action.done": "Done: mark a claimed task complete, optionally with a commit sha.",
1276
1639
  "help.action.fail": "Fail: mark a claimed task failed and record the reason.",
1277
1640
  "help.action.retry": "Retry: put a failed or blocked task back in the queue.",
1278
- "help.params.mode": "mode, reason",
1279
- "help.params.add": "title, role, scope[], after[]",
1280
- "help.params.plan": "goal, maxCards",
1281
- "help.params.commit": "message, set[]",
1282
- "help.params.claim": "id, agent",
1283
- "help.params.done": "id, sha?",
1284
- "help.params.fail": "id, reason",
1285
- "help.params.retry": "id",
1286
- "plan.dialogTitle": "Give the Queen a goal",
1641
+ "help.action.remove": "Delete this task card permanently. A claimed task has to be released or reopened first.",
1642
+ "plan.dialogTitle": "Set the Queen a goal",
1287
1643
  "plan.dialogAria": "Plan tasks from a goal",
1288
1644
  "plan.goal": "Goal",
1289
1645
  "plan.goalHint": "Describe the outcome; the Queen will split it into tasks.",
1290
- "plan.maxCards": "Max cards",
1646
+ "plan.maxCards": "Max tasks",
1291
1647
  "plan.maxCardsHint": "1+",
1292
1648
  "plan.preview": "Preview plan",
1293
1649
  "plan.previewAria": "Ask the Queen to draft a task plan without writing it",
@@ -1308,14 +1664,16 @@ export const messages = Object.freeze({
1308
1664
  "plan.deps": "deps",
1309
1665
  "plan.none": "—",
1310
1666
  "plan.goalRequired": "Enter a goal first.",
1311
- "plan.maxInvalid": "Max cards must be a positive whole number.",
1667
+ "plan.maxInvalid": "Max tasks must be a positive whole number.",
1312
1668
  "plan.previewFirst": "Preview the plan before writing tasks.",
1313
1669
  "plan.previewFailed": "Could not read the plan.",
1314
1670
  "plan.applyHint": "The preview is read-only; writing calls plan again with apply=true.",
1315
- "plan.stale": "The goal or max cards changed; preview the plan again.",
1671
+ "plan.stale": "The goal or max tasks changed; preview the plan again.",
1316
1672
  "plan.error": "Plan failed",
1673
+ "confirm.remove": "Delete task \"{title}\" permanently? This cannot be undone.",
1317
1674
  "toast.dismiss": "Dismiss",
1318
1675
  "toast.planWritten": "Tasks written",
1676
+ "toast.taskRemoved": "Task deleted",
1319
1677
  "toast.pickupHint": "The supervisor will pick them up automatically.",
1320
1678
  }),
1321
1679
  zh: Object.freeze({
@@ -1323,13 +1681,13 @@ export const messages = Object.freeze({
1323
1681
  "actions.aria": "看板操作",
1324
1682
  "action.add": "新建任务",
1325
1683
  "action.claim": "认领",
1326
- "action.commit": "提交",
1327
1684
  "action.done": "完成",
1328
1685
  "action.fail": "标记失败",
1329
- "action.freeze": "冻结",
1686
+ "action.freeze": "暂停",
1330
1687
  "action.modeTitle": "切换看板模式",
1688
+ "action.remove": "删除任务",
1331
1689
  "action.retry": "重试",
1332
- "action.unfreeze": "解冻",
1690
+ "action.unfreeze": "恢复",
1333
1691
  "pane.agents": "智能体",
1334
1692
  "pane.board": "任务",
1335
1693
  "pane.events": "事件",
@@ -1348,7 +1706,7 @@ export const messages = Object.freeze({
1348
1706
  "mode.freeze": "冻结",
1349
1707
  "mode.free.help": "正常:任何人都可以认领任务。",
1350
1708
  "mode.freeze.help": "冻结:只有带 fix 标签的任务能被认领;流水线红时使用。",
1351
- "mode.freeze.banner": "已冻结:只有带 fix 标签的任务能被认领",
1709
+ "mode.freeze.banner": "已暂停:只有带 fix 标签的任务能被认领",
1352
1710
  "mode.title": "模式:",
1353
1711
  "stats.cards": "个任务",
1354
1712
  "stats.oldest": "最久待办",
@@ -1379,6 +1737,7 @@ export const messages = Object.freeze({
1379
1737
  "drawer.cardActions": "任务操作",
1380
1738
  "drawer.noActions": "该状态没有可用操作。",
1381
1739
  "drawer.readOnly": "只读:writable=false。",
1740
+ "drawer.removeClaimed": "已认领的任务必须先释放或重开才能删除。",
1382
1741
  "drawer.rawJson": "原始 JSON",
1383
1742
  "events.empty": "暂无事件。",
1384
1743
  "events.showAll": "展开全部事件",
@@ -1394,45 +1753,85 @@ export const messages = Object.freeze({
1394
1753
  "supervisor.resumeAria": "恢复 {repo} 的 supervisor",
1395
1754
  "supervisor.resumeFailed": "恢复 supervisor 失败",
1396
1755
  "limits.open": "设置",
1397
- "limits.openAria": "设置这个仓库的蜂的数量",
1398
- "limits.title": "蜂的数量",
1399
- "limits.aria": "按仓库设置蜂的数量",
1400
- "limits.description": "每个角色的并发上限。0 表示暂停该角色,默认 5。",
1756
+ "limits.openAria": "打开智能体并发上限设置",
1757
+ "limits.title": "智能体的并发上限",
1758
+ "limits.aria": "这个仓库的智能体并发上限",
1759
+ "limits.description": "同时干活的智能体数量上限,按角色分别设置;0 表示暂停该角色",
1401
1760
  "limits.role": "角色",
1402
- "limits.limit": "上限",
1761
+ "limits.limit": "并发上限",
1403
1762
  "limits.inFlight": "在飞",
1404
1763
  "limits.queued": "排队",
1405
1764
  "limits.defaultHint": "0–999,默认 5",
1406
1765
  "limits.limitAria": "{role} 的并发上限",
1407
1766
  "limits.save": "保存",
1408
- "limits.saveAria": "保存 {repo} 的蜂的数量",
1767
+ "limits.saveAria": "保存 {repo} 的智能体并发上限",
1409
1768
  "limits.saving": "正在保存…",
1410
- "limits.saved": "蜂的数量已保存。",
1411
- "limits.failed": "保存蜂的数量失败",
1769
+ "limits.saved": "智能体的并发上限已保存。",
1770
+ "limits.failed": "保存智能体的并发上限失败",
1412
1771
  "limits.invalid": "每个上限都必须是 0–999 的整数。",
1413
1772
  "limits.none": "这个仓库没有角色数据。",
1414
1773
  "limits.close": "关闭",
1415
- "limits.closeAria": "关闭蜂的数量设置",
1774
+ "limits.closeAria": "关闭智能体的并发上限设置",
1775
+ "settings.openAria": "打开这个仓库的设置",
1776
+ "settings.title": "设置",
1777
+ "settings.aria": "这个仓库的设置",
1778
+ "settings.addRole": "新增角色",
1779
+ "settings.roleName": "角色名",
1780
+ "settings.roleNameHint": "以小写字母开头,2–32 个字符,只能包含小写字母、数字和连字符",
1781
+ "settings.roleNameAria": "新角色名",
1782
+ "settings.roleNameExample": "例如 reviewer",
1783
+ "settings.roleDescription": "职责描述",
1784
+ "settings.roleDescriptionAria": "新角色的职责描述(可空)",
1785
+ "settings.roleDescriptionHint": "会写进 .hive/roles/<name>.md,agent 开工时读它",
1786
+ "settings.roleDescriptionMax": "可空,最多 2000 字",
1787
+ "settings.descriptionTooLong": "职责描述不能超过 2000 字。",
1788
+ "settings.adapter": "适配器",
1789
+ "settings.adapterAria": "新角色的适配器",
1790
+ "settings.model": "模型",
1791
+ "settings.modelOptional": "可空",
1792
+ "settings.modelAria": "新角色的可选模型",
1793
+ "settings.addRoleButton": "新增角色",
1794
+ "settings.addRoleAria": "新增这个角色",
1795
+ "settings.addingRole": "正在新增…",
1796
+ "settings.roleInvalid": "角色名必须以小写字母开头,2–32 个字符,只能包含小写字母、数字和连字符。",
1797
+ "settings.modelInvalid": "模型只能包含字母、数字、点、下划线、冒号和连字符,最长 64 位。",
1798
+ "settings.roleExists": "角色已存在。",
1799
+ "settings.roleAdded": "角色已新增。",
1800
+ "settings.roleFailed": "新增角色失败",
1801
+ "settings.readOnly": "只读模式:无法修改角色和限额。",
1802
+ "settings.supervisorUnavailable": "取不到 supervisor,无法读取角色限额。",
1803
+ "settings.saveLimits": "保存限额",
1804
+ "settings.close": "关闭",
1805
+ "settings.closeAria": "关闭设置",
1416
1806
  "event.unknown": "事件",
1807
+ "add.dialogTitle": "新建任务",
1808
+ "add.title": "标题",
1809
+ "add.titleAria": "新任务标题",
1810
+ "add.role": "角色",
1811
+ "add.roleAria": "新任务角色",
1812
+ "add.scope": "范围(逗号分隔,可选)",
1813
+ "add.scopeAria": "新任务的文件范围",
1814
+ "add.after": "依赖任务(任务 ID,逗号分隔,可选)",
1815
+ "add.afterAria": "需要先完成的任务",
1816
+ "add.acceptance": "验收标准(可选)",
1817
+ "add.acceptanceAria": "新任务的验收标准",
1818
+ "add.cancel": "取消",
1819
+ "add.submit": "新建任务",
1820
+ "add.submitting": "正在新建…",
1821
+ "add.required": "标题不能为空。",
1417
1822
  "prompt.newTitle": "新任务标题",
1418
1823
  "prompt.role": "角色",
1419
1824
  "prompt.scope": "范围(逗号分隔,可选)",
1420
1825
  "prompt.after": "排在哪些任务之后(任务 ID,逗号分隔,可选)",
1421
- "prompt.commitMessage": "提交信息",
1422
- "prompt.paths": "路径(逗号分隔,可选)",
1423
1826
  "prompt.claimAgent": "以哪个智能体认领",
1424
1827
  "prompt.commitSha": "提交 SHA(可选)",
1425
1828
  "prompt.failReason": "失败原因",
1426
- "action.plan": "给女王下目标",
1427
- "help.open": "这些按钮是做什么的",
1829
+ "action.plan": "给女王设目标",
1428
1830
  "menu.open": "更多操作与说明",
1429
- "help.title": "按钮说明",
1430
- "help.aria": "操作说明",
1831
+ "help.title": "菜单",
1832
+ "help.aria": "菜单",
1431
1833
  "help.close": "关闭",
1432
- "help.closeAria": "关闭按钮说明",
1433
- "help.board": "看板操作",
1434
- "help.tasks": "任务操作",
1435
- "help.params": "参数:",
1834
+ "help.closeAria": "关闭菜单",
1436
1835
  "help.readOnly": "面板以只读启动,加 --write 才有写操作按钮。",
1437
1836
  "help.uninitialised": "请先用主区的按钮初始化 Hive,再使用看板操作。",
1438
1837
  "init.repo": "仓库",
@@ -1447,9 +1846,11 @@ export const messages = Object.freeze({
1447
1846
  "init.output": "标准输出",
1448
1847
  "init.noOutput": "(无输出)",
1449
1848
  "init.queen": "本会话输入框已接入女王模式(女王只拆解任务,不亲自干活)。",
1450
- "init.queenExit": "退出请在聊天窗口输入:",
1451
- "init.queenCommand": "/queen off",
1452
1849
  "init.queenOutput": "初始化输出",
1850
+ "queen.dismiss": "关闭提示",
1851
+ "queen.dismissAria": "关闭这个仓库的女王提示",
1852
+ "help.queen": "女王模式",
1853
+ "help.queenDesc": "输入 /queen off 退出,退出后本会话恢复普通编码模式;关闭提示不影响女王状态。",
1453
1854
  "queen.status.active": "女王已接管",
1454
1855
  "queen.status.inactive": "女王未接管",
1455
1856
  "queen.source.auto": "自动",
@@ -1460,29 +1861,20 @@ export const messages = Object.freeze({
1460
1861
  "queen.takeover": "让女王接管",
1461
1862
  "queen.takeoverAria": "让女王接管本会话",
1462
1863
  "queen.takeoverBusy": "正在接管…",
1463
- "help.hint": "点开任务可查看该任务自己的操作。",
1464
- "help.action.freeze": "冻结:除带 fix 标签的任务外,任何人都不再能认领新任务。",
1465
- "help.action.unfreeze": "解冻:恢复认领,智能体可以继续接取待办任务。",
1864
+ "help.action.freeze": "暂停:只有带 fix 标签的任务能被认领。",
1865
+ "help.action.unfreeze": "恢复:恢复认领,智能体可以继续接取待办任务。",
1466
1866
  "help.action.add": "新建任务:添加一条带角色和文件范围的待办任务。",
1467
- "help.action.plan": "给女王下目标:让女王把目标拆成任务计划,预览后再写入看板。",
1468
- "help.action.commit": "提交:按提交信息提交选中的路径。",
1867
+ "help.action.plan": "给女王设目标:让女王把目标拆成任务计划,预览后再写入看板。",
1469
1868
  "help.action.claim": "认领:以某个智能体的名义短期租下这条待办任务。",
1470
1869
  "help.action.done": "完成:把已认领的任务标为完成,可选填写提交 SHA。",
1471
1870
  "help.action.fail": "标记失败:把已认领的任务标为失败,并写明原因。",
1472
1871
  "help.action.retry": "重试:把失败或受阻的任务放回队列。",
1473
- "help.params.mode": "mode、reason",
1474
- "help.params.add": "title、role、scope[]、after[]",
1475
- "help.params.plan": "goal、maxCards",
1476
- "help.params.commit": "message、set[]",
1477
- "help.params.claim": "id、智能体",
1478
- "help.params.done": "id、sha?",
1479
- "help.params.fail": "id、reason",
1480
- "help.params.retry": "id",
1481
- "plan.dialogTitle": "给女王下目标",
1872
+ "help.action.remove": "永久删除这张任务卡;已认领的任务需要先释放或重开。",
1873
+ "plan.dialogTitle": "给女王设目标",
1482
1874
  "plan.dialogAria": "按目标规划任务",
1483
1875
  "plan.goal": "目标",
1484
1876
  "plan.goalHint": "描述想达成的结果,女王会把它拆成任务。",
1485
- "plan.maxCards": "最大卡数",
1877
+ "plan.maxCards": "最大任务数",
1486
1878
  "plan.maxCardsHint": "至少 1",
1487
1879
  "plan.preview": "预览计划",
1488
1880
  "plan.previewAria": "让女王先给出任务计划,不写入看板",
@@ -1503,14 +1895,16 @@ export const messages = Object.freeze({
1503
1895
  "plan.deps": "依赖",
1504
1896
  "plan.none": "—",
1505
1897
  "plan.goalRequired": "请先填写目标。",
1506
- "plan.maxInvalid": "最大卡数必须是正整数。",
1898
+ "plan.maxInvalid": "最大任务数必须是正整数。",
1507
1899
  "plan.previewFirst": "请先预览计划,再写入任务。",
1508
1900
  "plan.previewFailed": "无法解析计划。",
1509
1901
  "plan.applyHint": "预览不会写入;写入时会带 apply=true 再调用一次 plan。",
1510
- "plan.stale": "目标或最大卡数已修改,请重新预览计划。",
1902
+ "plan.stale": "目标或最大任务数已修改,请重新预览计划。",
1511
1903
  "plan.error": "计划失败",
1904
+ "confirm.remove": "确定永久删除任务「{title}」?此操作不可撤销。",
1512
1905
  "toast.dismiss": "关闭",
1513
1906
  "toast.planWritten": "任务已写入",
1907
+ "toast.taskRemoved": "任务已删除",
1514
1908
  "toast.pickupHint": "supervisor 会自动接卡。",
1515
1909
  }),
1516
1910
  });
@@ -1679,22 +2073,12 @@ function modeAction(mode) {
1679
2073
  return { name: "mode", ...meta, body: { mode: nextMode, reason: "panel" } };
1680
2074
  }
1681
2075
 
1682
- function toolbarActions(writable) {
2076
+ function toolbarActions(writable, mode) {
1683
2077
  if (!writable) return [];
1684
2078
  return [
1685
2079
  { name: "add", ...ACTION_META.add },
1686
2080
  { name: "plan", ...ACTION_META.plan },
1687
- { name: "commit", ...ACTION_META.commit },
1688
- ];
1689
- }
1690
-
1691
- function helpGroups(mode) {
1692
- return [
1693
- { titleKey: "help.board", actions: [modeAction(mode), ...toolbarActions(true)] },
1694
- {
1695
- titleKey: "help.tasks",
1696
- actions: ["claim", "done", "fail", "retry"].map((name) => ({ name, ...ACTION_META[name] })),
1697
- },
2081
+ modeAction(mode),
1698
2082
  ];
1699
2083
  }
1700
2084
 
@@ -1705,6 +2089,7 @@ function helpGroups(mode) {
1705
2089
  * @returns {{
1706
2090
  * at: string, repo: string, mode: string, initialised: boolean, writable: boolean,
1707
2091
  * queen: {active:boolean, source:"auto"|"manual"|null, repo:string}|null,
2092
+ * 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},
1708
2093
  * lanes: Record<string, Array<{id:string,title:string,role:string,owner:string,scope:string[],reason:string}>>,
1709
2094
  * laneOrder: string[],
1710
2095
  * stats: {total:number, byState:Record<string,number>, byRole:Record<string,number>, oldestPending:{id:string,createdAt:string}|null},
@@ -1748,6 +2133,32 @@ export function renderModel(snapshot) {
1748
2133
  : null,
1749
2134
  repo: typeof rawQueen.repo === "string" ? rawQueen.repo : "",
1750
2135
  };
2136
+ const rawRoles = isRecord(source.roles) ? source.roles : null;
2137
+ const rolesLimits = {};
2138
+ if (rawRoles && isRecord(rawRoles.limits)) {
2139
+ for (const [name, value] of Object.entries(rawRoles.limits)) {
2140
+ const number = Number(value);
2141
+ if (name && Number.isFinite(number)) rolesLimits[name] = number;
2142
+ }
2143
+ }
2144
+ const roles = {
2145
+ list:
2146
+ rawRoles && Array.isArray(rawRoles.list)
2147
+ ? rawRoles.list
2148
+ .filter(isRecord)
2149
+ .map((entry) => ({
2150
+ name: asString(entry.name),
2151
+ adapter: typeof entry.adapter === "string" ? entry.adapter : null,
2152
+ model: typeof entry.model === "string" ? entry.model : null,
2153
+ prompt: typeof entry.prompt === "string" ? entry.prompt : null,
2154
+ promptExists: entry.promptExists === true,
2155
+ limit: typeof entry.limit === "number" && Number.isFinite(entry.limit) ? entry.limit : null,
2156
+ }))
2157
+ .filter((entry) => entry.name)
2158
+ : [],
2159
+ limits: rolesLimits,
2160
+ error: rawRoles ? asString(rawRoles.error) || null : null,
2161
+ };
1751
2162
 
1752
2163
  return {
1753
2164
  at: asString(source.at),
@@ -1755,13 +2166,14 @@ export function renderModel(snapshot) {
1755
2166
  mode,
1756
2167
  initialised,
1757
2168
  queen,
2169
+ roles,
1758
2170
  writable,
1759
2171
  lanes,
1760
2172
  laneOrder: [...LANE_ORDER],
1761
2173
  stats: normalizeStats(source.stats, tasks),
1762
2174
  agents: normalizeAgents(source.board),
1763
2175
  events: normalizeEvents(source.events),
1764
- actions: initialised ? toolbarActions(writable) : [],
2176
+ actions: initialised ? toolbarActions(writable, mode) : [],
1765
2177
  };
1766
2178
  }
1767
2179
 
@@ -1943,6 +2355,52 @@ function element(doc, tag, className, text) {
1943
2355
  return node;
1944
2356
  }
1945
2357
 
2358
+ function svgNode(doc, tag) {
2359
+ const node =
2360
+ typeof doc.createElementNS === "function"
2361
+ ? doc.createElementNS("http://www.w3.org/2000/svg", tag)
2362
+ : doc.createElement(tag);
2363
+ return node;
2364
+ }
2365
+
2366
+ function makeHiveIcon(doc, kind) {
2367
+ const svg = svgNode(doc, "svg");
2368
+ setAttr(svg, "viewBox", "0 0 24 24");
2369
+ setAttr(svg, "width", "16");
2370
+ setAttr(svg, "height", "16");
2371
+ setAttr(svg, "aria-hidden", "true");
2372
+ setAttr(svg, "focusable", "false");
2373
+ if (kind === "menu") {
2374
+ for (const cx of [5, 12, 19]) {
2375
+ const dot = svgNode(doc, "circle");
2376
+ setAttr(dot, "cx", String(cx));
2377
+ setAttr(dot, "cy", "12");
2378
+ setAttr(dot, "r", "1.25");
2379
+ setAttr(dot, "fill", "currentColor");
2380
+ svg.appendChild(dot);
2381
+ }
2382
+ return svg;
2383
+ }
2384
+ setAttr(svg, "fill", "none");
2385
+ setAttr(svg, "stroke", "currentColor");
2386
+ setAttr(svg, "stroke-width", "1.75");
2387
+ setAttr(svg, "stroke-linecap", "round");
2388
+ setAttr(svg, "stroke-linejoin", "round");
2389
+ const center = svgNode(doc, "circle");
2390
+ setAttr(center, "cx", "12");
2391
+ setAttr(center, "cy", "12");
2392
+ setAttr(center, "r", "3");
2393
+ svg.appendChild(center);
2394
+ const path = svgNode(doc, "path");
2395
+ setAttr(
2396
+ path,
2397
+ "d",
2398
+ "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",
2399
+ );
2400
+ svg.appendChild(path);
2401
+ return svg;
2402
+ }
2403
+
1946
2404
  function setAttr(node, name, value) {
1947
2405
  if (node && typeof node.setAttribute === "function") {
1948
2406
  node.setAttribute(name, value === null || value === undefined ? "" : String(value));
@@ -2021,22 +2479,6 @@ function formatTime(value) {
2021
2479
  }
2022
2480
  }
2023
2481
 
2024
- function formatStamp(value) {
2025
- const date = parseDate(value);
2026
- if (!date) return asString(value);
2027
- try {
2028
- return date.toLocaleString([], {
2029
- month: "short",
2030
- day: "2-digit",
2031
- hour: "2-digit",
2032
- minute: "2-digit",
2033
- second: "2-digit",
2034
- });
2035
- } catch {
2036
- return date.toISOString();
2037
- }
2038
- }
2039
-
2040
2482
  function safeClassToken(value) {
2041
2483
  const token = asString(value).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
2042
2484
  return token || "unknown";
@@ -2149,6 +2591,7 @@ function extractPlan(payload) {
2149
2591
  * intervalMs?: number,
2150
2592
  * onError?: (error: Error) => void,
2151
2593
  * fetch?: typeof fetch,
2594
+ * confirm?: (message: string) => boolean,
2152
2595
  * t?: (key: string) => string,
2153
2596
  * subscribeLocale?: (listener: () => void) => (() => void)
2154
2597
  * }} [options]
@@ -2202,6 +2645,18 @@ export function mount(root, options = {}) {
2202
2645
  ? globalThis.prompt.bind(globalThis)
2203
2646
  : null;
2204
2647
 
2648
+ // Destructive actions ask through the host's confirm when it provides one
2649
+ // (tests, embedded hosts), then the global confirm. Without either, a
2650
+ // destructive action is refused rather than run unconfirmed.
2651
+ const confirmImpl =
2652
+ typeof opts.confirm === "function"
2653
+ ? opts.confirm
2654
+ : typeof view.confirm === "function"
2655
+ ? view.confirm.bind(view)
2656
+ : typeof globalThis.confirm === "function"
2657
+ ? globalThis.confirm.bind(globalThis)
2658
+ : null;
2659
+
2205
2660
  const schedule =
2206
2661
  typeof view.setInterval === "function" ? view.setInterval.bind(view) : globalThis.setInterval.bind(globalThis);
2207
2662
  const unschedule =
@@ -2239,6 +2694,7 @@ export function mount(root, options = {}) {
2239
2694
  let lastModel = null;
2240
2695
  let drawerNode = null;
2241
2696
  let drawerState = null;
2697
+ let drawerTrigger = null;
2242
2698
  let unsubscribeLocale = null;
2243
2699
  let statusKey = null;
2244
2700
  let statusKind = "info";
@@ -2251,6 +2707,11 @@ export function mount(root, options = {}) {
2251
2707
  let planState = null;
2252
2708
  let planTriggerButton = null;
2253
2709
  let planFocusables = [];
2710
+ let addOverlay = null;
2711
+ let addDialogNode = null;
2712
+ let addState = null;
2713
+ let addTriggerButton = null;
2714
+ let addFocusables = [];
2254
2715
  let toastNode = null;
2255
2716
  let stageFilter = "all";
2256
2717
  let stageChipEntries = [];
@@ -2261,8 +2722,10 @@ export function mount(root, options = {}) {
2261
2722
  let initRequestSeq = 0;
2262
2723
  let queenNotice = false;
2263
2724
  let queenBusy = false;
2725
+ const queenDismissedFallback = new Set();
2264
2726
  let supervisorData = [];
2265
2727
  let supervisorRequest = null;
2728
+ let supervisorInlineRow = null;
2266
2729
  let limitsOverlay = null;
2267
2730
  let limitsDialogNode = null;
2268
2731
  let limitsState = null;
@@ -2280,8 +2743,19 @@ export function mount(root, options = {}) {
2280
2743
  ident.appendChild(repoNode);
2281
2744
  bar.appendChild(ident);
2282
2745
 
2283
- const timeNode = element(doc, "time", "hive-time", "");
2284
- bar.appendChild(timeNode);
2746
+ const supervisorInline = element(doc, "span", "hive-supervisor-inline is-hidden");
2747
+ setAttr(supervisorInline, "aria-label", translate("supervisor.aria"));
2748
+ const supervisorInlineLabel = element(doc, "span", "hive-supervisor-inline-label", translate("supervisor.label"));
2749
+ const supervisorInlineState = element(doc, "span", "hive-supervisor-inline-state", "");
2750
+ const supervisorInlineResume = element(doc, "button", "hive-btn hive-supervisor-inline-resume is-hidden", translate("supervisor.resume"));
2751
+ setAttr(supervisorInlineResume, "type", "button");
2752
+ supervisorInlineResume.addEventListener("click", () => {
2753
+ if (supervisorInlineRow) void resumeSupervisor(supervisorInlineRow, supervisorInlineResume);
2754
+ });
2755
+ supervisorInline.appendChild(supervisorInlineLabel);
2756
+ supervisorInline.appendChild(supervisorInlineState);
2757
+ supervisorInline.appendChild(supervisorInlineResume);
2758
+ bar.appendChild(supervisorInline);
2285
2759
 
2286
2760
  const statsNode = element(doc, "div", "hive-stats");
2287
2761
  bar.appendChild(statsNode);
@@ -2296,8 +2770,9 @@ export function mount(root, options = {}) {
2296
2770
  const actionsNode = element(doc, "div", "hive-actions");
2297
2771
  actionGroup.appendChild(actionsNode);
2298
2772
 
2299
- const helpButton = element(doc, "button", "hive-btn hive-help-trigger hive-menu-trigger", "⋯");
2773
+ const helpButton = element(doc, "button", "hive-btn hive-btn-ghost hive-icon-button hive-help-trigger hive-menu-trigger");
2300
2774
  setAttr(helpButton, "type", "button");
2775
+ helpButton.appendChild(makeHiveIcon(doc, "menu"));
2301
2776
  setAttr(helpButton, "aria-haspopup", "dialog");
2302
2777
  setAttr(helpButton, "aria-expanded", "false");
2303
2778
  setAttr(helpButton, "title", translate("menu.open"));
@@ -2305,35 +2780,25 @@ export function mount(root, options = {}) {
2305
2780
  helpButton.addEventListener("click", () => {
2306
2781
  toggleHelp();
2307
2782
  });
2308
- actionGroup.appendChild(helpButton);
2309
- bar.appendChild(actionGroup);
2310
-
2311
- const supervisorBar = element(doc, "section", "hive-supervisor is-hidden");
2312
- setAttr(supervisorBar, "aria-label", translate("supervisor.aria"));
2313
- const supervisorLabel = element(doc, "span", "hive-supervisor-label", "");
2314
- const supervisorRepos = element(doc, "div", "hive-supervisor-repos");
2315
- const supervisorLimitsButton = element(doc, "button", "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden", translate("limits.open"));
2316
- setAttr(supervisorLimitsButton, "type", "button");
2317
- setAttr(supervisorLimitsButton, "title", translate("limits.openAria"));
2318
- setAttr(supervisorLimitsButton, "aria-label", translate("limits.openAria"));
2319
- supervisorLimitsButton.addEventListener("click", () => {
2320
- openLimitsDialog(supervisorLimitsButton);
2783
+ // The previous "⋯" action menu has no entries left; settings carries the Queen section.
2784
+ const settingsButton = element(doc, "button", "hive-btn hive-btn-ghost hive-icon-button hive-settings-trigger");
2785
+ setAttr(settingsButton, "type", "button");
2786
+ settingsButton.appendChild(makeHiveIcon(doc, "gear"));
2787
+ setAttr(settingsButton, "title", translate("settings.openAria"));
2788
+ setAttr(settingsButton, "aria-label", translate("settings.openAria"));
2789
+ settingsButton.addEventListener("click", () => {
2790
+ openLimitsDialog(settingsButton);
2321
2791
  });
2322
- supervisorBar.appendChild(supervisorLabel);
2323
- supervisorBar.appendChild(supervisorRepos);
2324
- supervisorBar.appendChild(supervisorLimitsButton);
2792
+ actionGroup.appendChild(settingsButton);
2793
+ bar.appendChild(actionGroup);
2325
2794
 
2326
2795
  const freezeSlot = element(doc, "div", "hive-freeze-slot");
2327
2796
 
2328
- // Queen-mode notice, shown only after a successful init in this mount.
2797
+ // Queen-mode notice, driven by snapshot.queen.
2329
2798
  const queenHint = element(doc, "section", "hive-queen-hint");
2330
2799
  setAttr(queenHint, "role", "status");
2800
+ const queenBody = element(doc, "div", "hive-queen-body");
2331
2801
  const queenHintText = element(doc, "div", "hive-queen-text", "");
2332
- const queenExit = element(doc, "div", "hive-queen-exit");
2333
- const queenExitText = element(doc, "span", "hive-queen-exit-text", "");
2334
- const queenCommand = element(doc, "code", "hive-queen-command", "");
2335
- queenExit.appendChild(queenExitText);
2336
- queenExit.appendChild(queenCommand);
2337
2802
  const queenOffer = element(doc, "div", "hive-queen-offer is-hidden");
2338
2803
  const queenTakeoverButton = element(doc, "button", "hive-btn hive-queen-takeover", translate("queen.takeover"));
2339
2804
  setAttr(queenTakeoverButton, "type", "button");
@@ -2348,10 +2813,18 @@ export function mount(root, options = {}) {
2348
2813
  const queenOutputPre = element(doc, "pre", "hive-output-pre", "");
2349
2814
  queenOutputDetails.appendChild(queenOutputSummary);
2350
2815
  queenOutputDetails.appendChild(queenOutputPre);
2351
- queenHint.appendChild(queenHintText);
2352
- queenHint.appendChild(queenOffer);
2353
- queenHint.appendChild(queenExit);
2354
- queenHint.appendChild(queenOutputDetails);
2816
+ queenBody.appendChild(queenHintText);
2817
+ queenBody.appendChild(queenOffer);
2818
+ queenBody.appendChild(queenOutputDetails);
2819
+ const queenDismissButton = element(doc, "button", "hive-btn hive-btn-ghost hive-queen-dismiss is-hidden", "×");
2820
+ setAttr(queenDismissButton, "type", "button");
2821
+ setAttr(queenDismissButton, "title", translate("queen.dismissAria"));
2822
+ setAttr(queenDismissButton, "aria-label", translate("queen.dismissAria"));
2823
+ queenDismissButton.addEventListener("click", () => {
2824
+ dismissQueenNotice();
2825
+ });
2826
+ queenHint.appendChild(queenBody);
2827
+ queenHint.appendChild(queenDismissButton);
2355
2828
 
2356
2829
  const main = element(doc, "main", "hive-main");
2357
2830
 
@@ -2446,7 +2919,6 @@ export function mount(root, options = {}) {
2446
2919
  });
2447
2920
 
2448
2921
  frame.appendChild(bar);
2449
- frame.appendChild(supervisorBar);
2450
2922
  frame.appendChild(freezeSlot);
2451
2923
  frame.appendChild(queenHint);
2452
2924
  frame.appendChild(agentsStrip);
@@ -2503,6 +2975,15 @@ export function mount(root, options = {}) {
2503
2975
  return answer === null || answer === undefined ? null : String(answer);
2504
2976
  }
2505
2977
 
2978
+ function askConfirm(message) {
2979
+ if (!confirmImpl) return false;
2980
+ try {
2981
+ return confirmImpl(message) === true;
2982
+ } catch {
2983
+ return false;
2984
+ }
2985
+ }
2986
+
2506
2987
  function emptyState(text) {
2507
2988
  return element(doc, "div", "hive-empty", text);
2508
2989
  }
@@ -2570,34 +3051,22 @@ export function mount(root, options = {}) {
2570
3051
  if (!model || !model.writable) {
2571
3052
  body.appendChild(element(doc, "div", "hive-help-note", translate("help.readOnly")));
2572
3053
  }
2573
- const groups = helpGroups(model ? model.mode : "free");
2574
- for (const group of groups) {
2575
- body.appendChild(element(doc, "div", "hive-help-section", translate(group.titleKey)));
2576
- for (const action of group.actions) {
2577
- const item = element(doc, "div", "hive-help-action");
2578
- item.appendChild(element(doc, "div", "hive-help-name", translate(action.labelKey)));
2579
- item.appendChild(element(doc, "div", "hive-help-desc", translate(action.helpKey)));
2580
- const params = action.paramsKey ? translate(action.paramsKey) : "";
2581
- if (params) {
2582
- item.appendChild(element(doc, "div", "hive-help-params", translate("help.params") + params));
2583
- }
2584
- if (action.name === "mode" && model && model.writable && model.initialised !== false) {
2585
- const row = element(doc, "div", "hive-help-actionrow");
2586
- const button = element(doc, "button", "hive-btn hive-help-mode-action", translate(action.labelKey));
2587
- setAttr(button, "type", "button");
2588
- setAttr(button, "title", translate(action.helpKey));
2589
- setAttr(button, "aria-label", translate(action.helpKey));
2590
- button.addEventListener("click", () => {
2591
- closeHelp();
2592
- void postAction("mode", action.body || { mode: "freeze", reason: "panel" });
2593
- });
2594
- row.appendChild(button);
2595
- item.appendChild(row);
2596
- }
2597
- body.appendChild(item);
2598
- }
3054
+ if (model && model.writable && model.initialised !== false) {
3055
+ const action = modeAction(model.mode);
3056
+ const row = element(doc, "div", "hive-help-actionrow");
3057
+ const button = element(doc, "button", "hive-btn hive-help-mode-action", translate(action.labelKey));
3058
+ setAttr(button, "type", "button");
3059
+ setAttr(button, "title", translate(action.helpKey));
3060
+ setAttr(button, "aria-label", translate(action.helpKey));
3061
+ button.addEventListener("click", () => {
3062
+ closeHelp();
3063
+ void postAction("mode", action.body || { mode: "freeze", reason: "panel" });
3064
+ });
3065
+ row.appendChild(button);
3066
+ body.appendChild(row);
2599
3067
  }
2600
- body.appendChild(element(doc, "div", "hive-help-hint", translate("help.hint")));
3068
+ body.appendChild(element(doc, "div", "hive-help-section", translate("help.queen")));
3069
+ body.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
2601
3070
  }
2602
3071
 
2603
3072
  function positionHelp(panel) {
@@ -2844,6 +3313,7 @@ export function mount(root, options = {}) {
2844
3313
  function openPlanDialog(trigger) {
2845
3314
  if (destroyed || !lastModel || !lastModel.writable) return;
2846
3315
  closeHelp(false);
3316
+ closeAddDialog(false);
2847
3317
  closeDrawer();
2848
3318
  planTriggerButton = trigger || planTriggerButton || null;
2849
3319
 
@@ -2970,7 +3440,7 @@ export function mount(root, options = {}) {
2970
3440
  focusNode(goalInput);
2971
3441
  }
2972
3442
 
2973
- // --- bee count settings -------------------------------------------------
3443
+ // --- agent concurrency settings -----------------------------------------
2974
3444
 
2975
3445
  function currentSupervisorRow() {
2976
3446
  if (!lastModel) return null;
@@ -2978,14 +3448,42 @@ export function mount(root, options = {}) {
2978
3448
  }
2979
3449
 
2980
3450
  function roleRowsForCurrentRepo(row) {
2981
- const roles = new Map();
3451
+ const supervisorRoles = new Map();
2982
3452
  if (row && Array.isArray(row.roles)) {
2983
3453
  for (const role of row.roles) {
2984
3454
  if (!isRecord(role)) continue;
2985
3455
  const name = asString(role.role);
2986
- if (name) roles.set(name, { ...role, role: name });
3456
+ if (name) supervisorRoles.set(name, role);
2987
3457
  }
2988
3458
  }
3459
+ const modelRoles = lastModel && lastModel.roles && Array.isArray(lastModel.roles.list) ? lastModel.roles.list : [];
3460
+ if (modelRoles.length > 0) {
3461
+ return modelRoles
3462
+ .map((entry) => {
3463
+ const name = asString(entry.name);
3464
+ if (!name) return null;
3465
+ const savedLimit = lastModel.roles.limits[name];
3466
+ const limit = Number.isFinite(savedLimit)
3467
+ ? savedLimit
3468
+ : Number.isFinite(entry.limit)
3469
+ ? entry.limit
3470
+ : null;
3471
+ const effective = supervisorRoles.get(name);
3472
+ return {
3473
+ role: name,
3474
+ adapter: entry.adapter,
3475
+ model: entry.model,
3476
+ limit,
3477
+ inFlight: effective ? effective.inFlight : null,
3478
+ queued: effective ? effective.queued : null,
3479
+ };
3480
+ })
3481
+ .filter(Boolean)
3482
+ .sort((left, right) => left.role.localeCompare(right.role));
3483
+ }
3484
+
3485
+ const roles = new Map();
3486
+ for (const [name, role] of supervisorRoles) roles.set(name, { ...role, role: name });
2989
3487
  if (roles.size === 0 && lastModel) {
2990
3488
  for (const cards of Object.values(lastModel.lanes)) {
2991
3489
  for (const card of cards) {
@@ -3052,15 +3550,18 @@ export function mount(root, options = {}) {
3052
3550
  }
3053
3551
 
3054
3552
  function openLimitsDialog(trigger) {
3055
- if (destroyed || !lastModel || !lastModel.writable || supervisorData.length === 0) return;
3553
+ if (destroyed || !lastModel) return;
3056
3554
  closeHelp(false);
3057
3555
  closePlanDialog(false);
3556
+ closeAddDialog(false);
3058
3557
  closeDrawer();
3059
3558
  closeToast();
3060
3559
  if (limitsDialogNode) closeLimitsDialog(false);
3061
- limitsTriggerButton = trigger || supervisorLimitsButton;
3560
+ limitsTriggerButton = trigger || settingsButton;
3062
3561
 
3063
3562
  const repo = lastModel.repo || "";
3563
+ const writable = Boolean(lastModel.writable);
3564
+ const supervisorAvailable = supervisorData.length > 0;
3064
3565
  const rows = roleRowsForCurrentRepo(currentSupervisorRow());
3065
3566
  const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim");
3066
3567
  overlay.addEventListener("click", (event) => {
@@ -3070,16 +3571,16 @@ export function mount(root, options = {}) {
3070
3571
  const dialog = element(doc, "div", "hive-dialog");
3071
3572
  setAttr(dialog, "role", "dialog");
3072
3573
  setAttr(dialog, "aria-modal", "true");
3073
- setAttr(dialog, "aria-label", translate("limits.aria"));
3574
+ setAttr(dialog, "aria-label", translate("settings.aria"));
3074
3575
 
3075
3576
  const head = element(doc, "div", "hive-dialog-head");
3076
3577
  const titleBox = element(doc, "div", "hive-dialog-head-title");
3077
- titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("limits.title")));
3578
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("settings.title")));
3078
3579
  head.appendChild(titleBox);
3079
- const closeButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("limits.close"));
3580
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("settings.close"));
3080
3581
  setAttr(closeButton, "type", "button");
3081
- setAttr(closeButton, "title", translate("limits.closeAria"));
3082
- setAttr(closeButton, "aria-label", translate("limits.closeAria"));
3582
+ setAttr(closeButton, "title", translate("settings.closeAria"));
3583
+ setAttr(closeButton, "aria-label", translate("settings.closeAria"));
3083
3584
  closeButton.addEventListener("click", () => {
3084
3585
  closeLimitsDialog();
3085
3586
  });
@@ -3093,11 +3594,93 @@ export function mount(root, options = {}) {
3093
3594
  setAttr(repoPath, "title", repo);
3094
3595
  repoLine.appendChild(repoPath);
3095
3596
  body.appendChild(repoLine);
3096
- body.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3597
+ if (!writable) {
3598
+ body.appendChild(element(doc, "div", "hive-settings-note", translate("settings.readOnly")));
3599
+ }
3600
+
3601
+ const roleSection = element(doc, "section", "hive-settings-section");
3602
+ roleSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("settings.addRole")));
3603
+ const roleForm = element(doc, "div", "hive-field-row hive-settings-role-form");
3604
+ const roleNameField = element(doc, "label", "hive-field");
3605
+ roleNameField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleName")));
3606
+ const roleNameInput = element(doc, "input", "hive-input hive-settings-role-name");
3607
+ setAttr(roleNameInput, "type", "text");
3608
+ setAttr(roleNameInput, "autocomplete", "off");
3609
+ setAttr(roleNameInput, "placeholder", translate("settings.roleNameExample"));
3610
+ setAttr(roleNameInput, "aria-label", translate("settings.roleNameAria"));
3611
+ setAttr(roleNameInput, "pattern", "[a-z0-9]+(?:-[a-z0-9]+)*");
3612
+ roleNameField.appendChild(roleNameInput);
3613
+ roleNameField.appendChild(element(doc, "span", "hive-field-hint", translate("settings.roleNameHint")));
3614
+ roleForm.appendChild(roleNameField);
3615
+
3616
+ const adapterField = element(doc, "label", "hive-field is-narrow");
3617
+ adapterField.appendChild(element(doc, "span", "hive-field-label", translate("settings.adapter")));
3618
+ const adapterInput = element(doc, "select", "hive-input hive-settings-role-adapter");
3619
+ setAttr(adapterInput, "aria-label", translate("settings.adapterAria"));
3620
+ for (const adapter of ["dsh", "claude", "codex"]) {
3621
+ const option = element(doc, "option", null, adapter);
3622
+ setAttr(option, "value", adapter);
3623
+ adapterInput.appendChild(option);
3624
+ }
3625
+ adapterInput.value = "dsh";
3626
+ adapterField.appendChild(adapterInput);
3627
+ roleForm.appendChild(adapterField);
3628
+
3629
+ const modelField = element(doc, "label", "hive-field is-narrow");
3630
+ modelField.appendChild(element(doc, "span", "hive-field-label", translate("settings.model")));
3631
+ const modelInput = element(doc, "input", "hive-input hive-settings-role-model");
3632
+ setAttr(modelInput, "type", "text");
3633
+ setAttr(modelInput, "autocomplete", "off");
3634
+ setAttr(modelInput, "placeholder", translate("settings.modelOptional"));
3635
+ setAttr(modelInput, "aria-label", translate("settings.modelAria"));
3636
+ modelField.appendChild(modelInput);
3637
+ roleForm.appendChild(modelField);
3638
+ roleSection.appendChild(roleForm);
3639
+
3640
+ const roleDescriptionField = element(doc, "label", "hive-field hive-settings-role-description");
3641
+ roleDescriptionField.appendChild(element(doc, "span", "hive-field-label", translate("settings.roleDescription")));
3642
+ const roleDescriptionInput = element(doc, "textarea", "hive-textarea hive-settings-role-description-input");
3643
+ setAttr(roleDescriptionInput, "maxlength", "2000");
3644
+ setAttr(roleDescriptionInput, "rows", "3");
3645
+ setAttr(roleDescriptionInput, "aria-label", translate("settings.roleDescriptionAria"));
3646
+ roleDescriptionField.appendChild(roleDescriptionInput);
3647
+ roleDescriptionField.appendChild(
3648
+ element(
3649
+ doc,
3650
+ "span",
3651
+ "hive-field-hint",
3652
+ translate("settings.roleDescriptionHint") + " · " + translate("settings.roleDescriptionMax"),
3653
+ ),
3654
+ );
3655
+ roleSection.appendChild(roleDescriptionField);
3656
+
3657
+ const roleErrorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3658
+ roleSection.appendChild(roleErrorNode);
3659
+ const addRoleButton = element(doc, "button", "hive-btn hive-settings-add-role", translate("settings.addRoleButton"));
3660
+ setAttr(addRoleButton, "type", "button");
3661
+ setAttr(addRoleButton, "title", translate("settings.addRoleAria"));
3662
+ setAttr(addRoleButton, "aria-label", translate("settings.addRoleAria"));
3663
+ addRoleButton.disabled = !writable;
3664
+ addRoleButton.addEventListener("click", () => {
3665
+ void saveRole();
3666
+ });
3667
+ if (!writable) {
3668
+ roleNameInput.disabled = true;
3669
+ adapterInput.disabled = true;
3670
+ modelInput.disabled = true;
3671
+ roleDescriptionInput.disabled = true;
3672
+ }
3673
+ body.appendChild(roleSection);
3097
3674
 
3675
+ const limitsSection = element(doc, "section", "hive-settings-section");
3676
+ limitsSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("limits.title")));
3677
+ limitsSection.appendChild(element(doc, "div", "hive-limits-description", translate("limits.description")));
3098
3678
  const rowNodes = [];
3679
+ if (!supervisorAvailable) {
3680
+ limitsSection.appendChild(element(doc, "div", "hive-settings-note", translate("settings.supervisorUnavailable")));
3681
+ }
3099
3682
  if (rows.length === 0) {
3100
- body.appendChild(element(doc, "div", "hive-limits-empty", translate("limits.none")));
3683
+ limitsSection.appendChild(element(doc, "div", "hive-limits-empty", translate("limits.none")));
3101
3684
  } else {
3102
3685
  const table = element(doc, "div", "hive-limits-table");
3103
3686
  const header = element(doc, "div", "hive-limits-row is-head");
@@ -3118,30 +3701,41 @@ export function mount(root, options = {}) {
3118
3701
  setAttr(input, "inputmode", "numeric");
3119
3702
  setAttr(input, "aria-label", translate("limits.limitAria").replace("{role}", role.role));
3120
3703
  input.value = supervisorNumber(role.limit) === null ? "5" : String(supervisorNumber(role.limit));
3704
+ input.disabled = !writable || !supervisorAvailable;
3121
3705
  roleRow.appendChild(input);
3122
3706
  roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.inFlight)));
3123
3707
  roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.queued)));
3124
3708
  table.appendChild(roleRow);
3125
3709
  rowNodes.push({ role: role.role, input });
3126
3710
  }
3127
- body.appendChild(table);
3128
- body.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
3711
+ limitsSection.appendChild(table);
3712
+ limitsSection.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
3129
3713
  }
3130
3714
 
3131
3715
  const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
3132
- body.appendChild(errorNode);
3716
+ limitsSection.appendChild(errorNode);
3717
+ body.appendChild(limitsSection);
3718
+
3719
+ const queenSection = element(doc, "section", "hive-settings-section");
3720
+ queenSection.appendChild(element(doc, "div", "hive-settings-section-title", translate("help.queen")));
3721
+ queenSection.appendChild(element(doc, "div", "hive-help-desc hive-help-queen", translate("help.queenDesc")));
3722
+ body.appendChild(queenSection);
3133
3723
  dialog.appendChild(body);
3134
3724
 
3135
3725
  const foot = element(doc, "div", "hive-dialog-foot");
3136
- const saveButton = element(doc, "button", "hive-btn", translate("limits.save"));
3726
+ const settingsActions = element(doc, "div", "hive-settings-actions");
3727
+ addRoleButton.className = "hive-btn hive-settings-add-role hive-settings-secondary";
3728
+ const saveButton = element(doc, "button", "hive-btn hive-settings-save hive-settings-primary", translate("settings.saveLimits"));
3137
3729
  setAttr(saveButton, "type", "button");
3138
3730
  setAttr(saveButton, "title", translate("limits.saveAria").replace("{repo}", repo));
3139
3731
  setAttr(saveButton, "aria-label", translate("limits.saveAria").replace("{repo}", repo));
3140
- saveButton.disabled = rows.length === 0;
3732
+ saveButton.disabled = !writable || !supervisorAvailable || rows.length === 0;
3141
3733
  saveButton.addEventListener("click", () => {
3142
3734
  void saveBeeCounts();
3143
3735
  });
3144
- foot.appendChild(saveButton);
3736
+ settingsActions.appendChild(addRoleButton);
3737
+ settingsActions.appendChild(saveButton);
3738
+ foot.appendChild(settingsActions);
3145
3739
  dialog.appendChild(foot);
3146
3740
 
3147
3741
  overlay.appendChild(dialog);
@@ -3154,17 +3748,105 @@ export function mount(root, options = {}) {
3154
3748
  errorNode,
3155
3749
  saveButton,
3156
3750
  busy: false,
3751
+ writable,
3752
+ supervisorAvailable,
3753
+ roleName: roleNameInput,
3754
+ roleAdapter: adapterInput,
3755
+ roleModel: modelInput,
3756
+ roleDescription: roleDescriptionInput,
3757
+ roleButton: addRoleButton,
3758
+ roleErrorNode,
3759
+ roleBusy: false,
3157
3760
  };
3158
- limitsFocusables = [closeButton, ...rowNodes.map((entry) => entry.input), saveButton];
3761
+ limitsFocusables = [
3762
+ closeButton,
3763
+ roleNameInput,
3764
+ adapterInput,
3765
+ modelInput,
3766
+ roleDescriptionInput,
3767
+ addRoleButton,
3768
+ ...rowNodes.map((entry) => entry.input),
3769
+ saveButton,
3770
+ ];
3159
3771
  if (typeof doc.addEventListener === "function") {
3160
3772
  doc.addEventListener("keydown", onLimitsKeydown);
3161
3773
  }
3162
- focusNode(rowNodes[0] ? rowNodes[0].input : closeButton);
3774
+ focusNode(writable ? roleNameInput : closeButton);
3775
+ }
3776
+
3777
+ function setRoleError(message) {
3778
+ if (!limitsState) return;
3779
+ limitsState.roleErrorNode.textContent = message || "";
3780
+ limitsState.roleErrorNode.className = "hive-limits-error" + (message ? "" : " is-hidden");
3781
+ }
3782
+
3783
+ async function saveRole() {
3784
+ const state = limitsState;
3785
+ if (!state || state.roleBusy || !state.writable) return;
3786
+ const name = String(state.roleName.value === null || state.roleName.value === undefined ? "" : state.roleName.value).trim();
3787
+ if (!/^[a-z][a-z0-9-]{1,31}$/.test(name)) {
3788
+ setRoleError(translate("settings.roleInvalid"));
3789
+ focusNode(state.roleName);
3790
+ return;
3791
+ }
3792
+ const adapter = ["dsh", "claude", "codex"].includes(String(state.roleAdapter.value || "dsh"))
3793
+ ? String(state.roleAdapter.value || "dsh")
3794
+ : "dsh";
3795
+ const model = String(state.roleModel.value === null || state.roleModel.value === undefined ? "" : state.roleModel.value).trim();
3796
+ if (model && !/^[A-Za-z0-9._:-]{1,64}$/.test(model)) {
3797
+ setRoleError(translate("settings.modelInvalid"));
3798
+ focusNode(state.roleModel);
3799
+ return;
3800
+ }
3801
+ const description = String(
3802
+ state.roleDescription.value === null || state.roleDescription.value === undefined ? "" : state.roleDescription.value,
3803
+ ).trim();
3804
+ if (description.length > 2000) {
3805
+ setRoleError(translate("settings.descriptionTooLong"));
3806
+ focusNode(state.roleDescription);
3807
+ return;
3808
+ }
3809
+
3810
+ state.roleBusy = true;
3811
+ state.roleName.disabled = true;
3812
+ state.roleAdapter.disabled = true;
3813
+ state.roleModel.disabled = true;
3814
+ state.roleDescription.disabled = true;
3815
+ state.roleButton.disabled = true;
3816
+ state.roleButton.textContent = translate("settings.addingRole");
3817
+ setRoleError("");
3818
+ try {
3819
+ const body = { name, adapter, description };
3820
+ if (model) body.model = model;
3821
+ const result = await requestAction("roles-add", body);
3822
+ if (!result.ok) {
3823
+ const detail = actionErrorDetail(result.error) || translate("settings.roleFailed");
3824
+ setRoleError(/already exists/i.test(detail) ? translate("settings.roleExists") : detail);
3825
+ return;
3826
+ }
3827
+ await refresh();
3828
+ await refreshSupervisor(true);
3829
+ if (destroyed) return;
3830
+ const trigger = limitsTriggerButton;
3831
+ closeLimitsDialog(false);
3832
+ openLimitsDialog(trigger);
3833
+ showToast("success", translate("settings.roleAdded"), name);
3834
+ } finally {
3835
+ if (!destroyed && limitsState === state) {
3836
+ state.roleBusy = false;
3837
+ state.roleName.disabled = false;
3838
+ state.roleAdapter.disabled = false;
3839
+ state.roleModel.disabled = false;
3840
+ state.roleDescription.disabled = false;
3841
+ state.roleButton.disabled = false;
3842
+ state.roleButton.textContent = translate("settings.addRoleButton");
3843
+ }
3844
+ }
3163
3845
  }
3164
3846
 
3165
3847
  async function saveBeeCounts() {
3166
3848
  const state = limitsState;
3167
- if (!state || state.busy) return;
3849
+ if (!state || state.busy || !state.writable || !state.supervisorAvailable) return;
3168
3850
  const roleLimits = {};
3169
3851
  let invalid = false;
3170
3852
  for (const entry of state.rows) {
@@ -3311,25 +3993,212 @@ export function mount(root, options = {}) {
3311
3993
  if (!destroyed) showToast("success", translate("toast.planWritten"), translate("toast.pickupHint"));
3312
3994
  }
3313
3995
 
3996
+
3997
+ // --- new task dialog -----------------------------------------------------
3998
+
3999
+ function onAddKeydown(event) {
4000
+ if (event && (event.key === "Escape" || event.key === "Esc")) closeAddDialog();
4001
+ }
4002
+
4003
+ function closeAddDialog(restoreFocus = true) {
4004
+ if (addOverlay && addOverlay.parentNode) addOverlay.parentNode.removeChild(addOverlay);
4005
+ addOverlay = null;
4006
+ addDialogNode = null;
4007
+ addState = null;
4008
+ addFocusables = [];
4009
+ if (typeof doc.removeEventListener === "function") {
4010
+ doc.removeEventListener("keydown", onAddKeydown);
4011
+ }
4012
+ if (restoreFocus && !destroyed) focusNode(addTriggerButton);
4013
+ addTriggerButton = null;
4014
+ }
4015
+
4016
+ function setAddError(message) {
4017
+ if (!addState) return;
4018
+ addState.error.textContent = message || "";
4019
+ addState.error.className = message ? "hive-limits-error" : "hive-limits-error is-hidden";
4020
+ }
4021
+
4022
+ function addField(labelKey, input, hintKey) {
4023
+ const field = element(doc, "label", "hive-field");
4024
+ field.appendChild(element(doc, "span", "hive-field-label", translate(labelKey)));
4025
+ field.appendChild(input);
4026
+ if (hintKey) field.appendChild(element(doc, "span", "hive-field-hint", translate(hintKey)));
4027
+ return field;
4028
+ }
4029
+
4030
+ function openAddDialog(trigger) {
4031
+ if (destroyed || !lastModel || !lastModel.writable) return;
4032
+ closeHelp(false);
4033
+ closePlanDialog(false);
4034
+ closeLimitsDialog(false);
4035
+ closeDrawer(false);
4036
+ closeAddDialog(false);
4037
+ addTriggerButton = trigger || null;
4038
+
4039
+ const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim");
4040
+ overlay.addEventListener("click", (event) => {
4041
+ if (!event || !event.target || event.target === overlay) closeAddDialog();
4042
+ });
4043
+
4044
+ const dialog = element(doc, "div", "hive-dialog hive-add-dialog");
4045
+ setAttr(dialog, "role", "dialog");
4046
+ setAttr(dialog, "aria-modal", "true");
4047
+ setAttr(dialog, "aria-label", translate("add.dialogTitle"));
4048
+
4049
+ const head = element(doc, "div", "hive-dialog-head");
4050
+ const titleBox = element(doc, "div", "hive-dialog-head-title");
4051
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("add.dialogTitle")));
4052
+ head.appendChild(titleBox);
4053
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost hive-add-close", "×");
4054
+ setAttr(closeButton, "type", "button");
4055
+ setAttr(closeButton, "title", translate("settings.closeAria"));
4056
+ setAttr(closeButton, "aria-label", translate("settings.closeAria"));
4057
+ closeButton.addEventListener("click", () => {
4058
+ closeAddDialog();
4059
+ });
4060
+ head.appendChild(closeButton);
4061
+ dialog.appendChild(head);
4062
+
4063
+ const body = element(doc, "div", "hive-dialog-body hive-add-body");
4064
+ const titleInput = element(doc, "input", "hive-input hive-add-title");
4065
+ setAttr(titleInput, "type", "text");
4066
+ setAttr(titleInput, "maxlength", "2000");
4067
+ setAttr(titleInput, "autocomplete", "off");
4068
+ setAttr(titleInput, "aria-label", translate("add.titleAria"));
4069
+ body.appendChild(addField("add.title", titleInput));
4070
+
4071
+ const roleInput = element(doc, "input", "hive-input hive-add-role");
4072
+ setAttr(roleInput, "type", "text");
4073
+ setAttr(roleInput, "autocomplete", "off");
4074
+ setAttr(roleInput, "aria-label", translate("add.roleAria"));
4075
+ roleInput.value = "coder";
4076
+ body.appendChild(addField("add.role", roleInput));
4077
+
4078
+ const scopeInput = element(doc, "input", "hive-input hive-add-scope");
4079
+ setAttr(scopeInput, "type", "text");
4080
+ setAttr(scopeInput, "autocomplete", "off");
4081
+ setAttr(scopeInput, "aria-label", translate("add.scopeAria"));
4082
+ body.appendChild(addField("add.scope", scopeInput));
4083
+
4084
+ const afterInput = element(doc, "input", "hive-input hive-add-after");
4085
+ setAttr(afterInput, "type", "text");
4086
+ setAttr(afterInput, "autocomplete", "off");
4087
+ setAttr(afterInput, "aria-label", translate("add.afterAria"));
4088
+ body.appendChild(addField("add.after", afterInput));
4089
+
4090
+ const acceptanceInput = element(doc, "textarea", "hive-textarea hive-add-acceptance");
4091
+ setAttr(acceptanceInput, "maxlength", "2000");
4092
+ setAttr(acceptanceInput, "rows", "3");
4093
+ setAttr(acceptanceInput, "aria-label", translate("add.acceptanceAria"));
4094
+ body.appendChild(addField("add.acceptance", acceptanceInput));
4095
+
4096
+ const errorNode = element(doc, "div", "hive-limits-error is-hidden", "");
4097
+ body.appendChild(errorNode);
4098
+ dialog.appendChild(body);
4099
+
4100
+ const foot = element(doc, "div", "hive-dialog-foot");
4101
+ const cancelButton = element(doc, "button", "hive-btn hive-btn-ghost", translate("add.cancel"));
4102
+ setAttr(cancelButton, "type", "button");
4103
+ cancelButton.addEventListener("click", () => {
4104
+ closeAddDialog();
4105
+ });
4106
+ const submitButton = element(doc, "button", "hive-btn hive-add-submit", translate("add.submit"));
4107
+ setAttr(submitButton, "type", "button");
4108
+ submitButton.addEventListener("click", () => {
4109
+ void submitAdd();
4110
+ });
4111
+ foot.appendChild(cancelButton);
4112
+ foot.appendChild(submitButton);
4113
+ dialog.appendChild(foot);
4114
+
4115
+ overlay.appendChild(dialog);
4116
+ frame.appendChild(overlay);
4117
+ addOverlay = overlay;
4118
+ addDialogNode = dialog;
4119
+ addState = {
4120
+ overlay,
4121
+ dialog,
4122
+ title: titleInput,
4123
+ role: roleInput,
4124
+ scope: scopeInput,
4125
+ after: afterInput,
4126
+ acceptance: acceptanceInput,
4127
+ error: errorNode,
4128
+ submit: submitButton,
4129
+ cancel: cancelButton,
4130
+ busy: false,
4131
+ };
4132
+ addFocusables = [closeButton, titleInput, roleInput, scopeInput, afterInput, acceptanceInput, cancelButton, submitButton];
4133
+ if (typeof doc.addEventListener === "function") {
4134
+ doc.addEventListener("keydown", onAddKeydown);
4135
+ }
4136
+ focusNode(titleInput);
4137
+ }
4138
+
4139
+ function setAddBusy(busy) {
4140
+ if (!addState) return;
4141
+ addState.busy = busy;
4142
+ addState.title.disabled = busy;
4143
+ addState.role.disabled = busy;
4144
+ addState.scope.disabled = busy;
4145
+ addState.after.disabled = busy;
4146
+ addState.acceptance.disabled = busy;
4147
+ addState.cancel.disabled = busy;
4148
+ addState.submit.disabled = busy;
4149
+ addState.submit.textContent = busy ? translate("add.submitting") : translate("add.submit");
4150
+ }
4151
+
4152
+ async function submitAdd() {
4153
+ if (!addState || addState.busy) return;
4154
+ const title = String(addState.title.value || "").trim();
4155
+ if (!title) {
4156
+ setAddError(translate("add.required"));
4157
+ focusNode(addState.title);
4158
+ return;
4159
+ }
4160
+ const role = String(addState.role.value || "").trim() || "coder";
4161
+ const body = {
4162
+ title,
4163
+ role,
4164
+ scope: splitList(String(addState.scope.value || "")),
4165
+ after: splitList(String(addState.after.value || "")),
4166
+ acceptance: String(addState.acceptance.value || "").trim(),
4167
+ };
4168
+ setAddError("");
4169
+ setAddBusy(true);
4170
+ const result = await postAction("add", body);
4171
+ if (destroyed || !addState) return;
4172
+ if (result) {
4173
+ closeAddDialog();
4174
+ return;
4175
+ }
4176
+ setAddBusy(false);
4177
+ setAddError(translate("status.actionFailed"));
4178
+ }
4179
+
3314
4180
  // --- drawer --------------------------------------------------------------
3315
4181
 
3316
4182
  function onDrawerKeydown(event) {
3317
4183
  if (event && (event.key === "Escape" || event.key === "Esc")) closeDrawer();
3318
4184
  }
3319
4185
 
3320
- function closeDrawer() {
4186
+ function closeDrawer(restoreFocus = true) {
3321
4187
  if (drawerNode && drawerNode.parentNode) drawerNode.parentNode.removeChild(drawerNode);
3322
4188
  drawerNode = null;
3323
4189
  drawerState = null;
3324
4190
  if (typeof doc.removeEventListener === "function") {
3325
4191
  doc.removeEventListener("keydown", onDrawerKeydown);
3326
4192
  }
4193
+ if (restoreFocus && !destroyed) focusNode(drawerTrigger);
4194
+ drawerTrigger = null;
3327
4195
  }
3328
4196
 
3329
4197
  function mountDrawer(eyebrow, title, ariaLabel) {
3330
4198
  closeHelp(false);
3331
4199
  closePlanDialog(false);
3332
- closeDrawer();
4200
+ closeAddDialog(false);
4201
+ closeDrawer(false);
3333
4202
 
3334
4203
  const panel = element(doc, "aside", "hive-drawer");
3335
4204
  setAttr(panel, "role", "dialog");
@@ -3374,45 +4243,108 @@ export function mount(root, options = {}) {
3374
4243
  body.appendChild(element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2)));
3375
4244
  }
3376
4245
 
3377
- function openDrawer(card, lane) {
4246
+ function openDrawer(card, lane, trigger) {
4247
+ closeHelp(false);
4248
+ closePlanDialog(false);
4249
+ closeAddDialog(false);
4250
+ closeDrawer(false);
4251
+ drawerTrigger = trigger || null;
4252
+
3378
4253
  const raw = findRawTask(card) || { ...card, state: lane };
3379
4254
  const title = card.title || translate("card.untitled");
3380
- const body = mountDrawer(
3381
- laneLabel(lane) + " · " + (card.id || translate("card.noId")),
3382
- title,
3383
- translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled")),
3384
- );
3385
- drawerState = { kind: "card", card, lane };
3386
- const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
4255
+ const id = card.id || translate("card.noId");
4256
+ const role = asString(card.role) || "—";
4257
+ const status = laneLabel(lane);
4258
+ const repo = lastModel ? lastModel.repo : "";
4259
+ const ariaLabel = translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled"));
4260
+
4261
+ const overlay = element(doc, "div", "hive-overlay hive-dialog-scrim hive-card-scrim");
4262
+ overlay.addEventListener("click", (event) => {
4263
+ if (!event || !event.target || event.target === overlay) closeDrawer();
4264
+ });
4265
+
4266
+ const dialog = element(doc, "div", "hive-dialog hive-card-dialog hive-drawer");
4267
+ setAttr(dialog, "role", "dialog");
4268
+ setAttr(dialog, "aria-modal", "true");
4269
+ setAttr(dialog, "aria-label", ariaLabel);
4270
+
4271
+ const head = element(doc, "div", "hive-dialog-head");
4272
+ const titleBox = element(doc, "div", "hive-dialog-head-title");
4273
+ titleBox.appendChild(element(doc, "h2", "hive-dialog-title", title));
4274
+ const subline = element(doc, "div", "hive-card-subline");
4275
+ const sublineText = [id, role, status, repo].filter(Boolean).join(" · ");
4276
+ subline.textContent = sublineText;
4277
+ setAttr(subline, "title", sublineText);
4278
+ titleBox.appendChild(subline);
4279
+ head.appendChild(titleBox);
4280
+ const closeButton = element(doc, "button", "hive-btn hive-btn-ghost hive-card-close", "×");
4281
+ setAttr(closeButton, "type", "button");
4282
+ setAttr(closeButton, "title", translate("drawer.closeAria"));
4283
+ setAttr(closeButton, "aria-label", translate("drawer.closeAria"));
4284
+ closeButton.addEventListener("click", () => {
4285
+ closeDrawer();
4286
+ });
4287
+ head.appendChild(closeButton);
4288
+ dialog.appendChild(head);
4289
+
4290
+ const body = element(doc, "div", "hive-dialog-body hive-card-body");
4291
+ const details = element(doc, "details", "hive-card-json");
4292
+ const summary = element(doc, "summary", "hive-card-json-summary", translate("drawer.rawJson"));
4293
+ const pre = element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2));
4294
+ details.appendChild(summary);
4295
+ details.appendChild(pre);
4296
+ body.appendChild(details);
4297
+ dialog.appendChild(body);
3387
4298
 
4299
+ const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
4300
+ if (actions.length === 0) {
4301
+ body.appendChild(
4302
+ element(
4303
+ doc,
4304
+ "div",
4305
+ "hive-note",
4306
+ lastModel && lastModel.writable ? translate("drawer.noActions") : translate("drawer.readOnly"),
4307
+ ),
4308
+ );
4309
+ }
3388
4310
  if (actions.length > 0) {
3389
- const actionRow = element(doc, "div", "hive-actions-row");
3390
- setAttr(actionRow, "aria-label", translate("drawer.cardActions"));
4311
+ const foot = element(doc, "div", "hive-dialog-foot hive-card-actions");
4312
+ setAttr(foot, "aria-label", translate("drawer.cardActions"));
4313
+ const claimed = asString(card.state || lane) === "claimed";
3391
4314
  for (const action of actions) {
3392
- const button = element(doc, "button", "hive-btn", translate(action.labelKey));
4315
+ const destructive = action.name === "remove";
4316
+ const button = element(
4317
+ doc,
4318
+ "button",
4319
+ "hive-btn" + (destructive ? " hive-btn-danger" : ""),
4320
+ translate(action.labelKey),
4321
+ );
3393
4322
  setAttr(button, "type", "button");
3394
- setAttr(button, "title", translate(action.helpKey));
3395
- setAttr(button, "aria-label", translate(action.helpKey));
4323
+ // The panel never sends --force, so a claimed card's delete control is
4324
+ // rendered but disabled, with the release/reopen reason in its title.
4325
+ const hint = destructive && claimed ? translate("drawer.removeClaimed") : translate(action.helpKey);
4326
+ setAttr(button, "title", hint);
4327
+ setAttr(button, "aria-label", hint);
4328
+ if (destructive && claimed) {
4329
+ button.disabled = true;
4330
+ setAttr(button, "aria-disabled", "true");
4331
+ }
3396
4332
  button.addEventListener("click", () => {
3397
4333
  void runCardAction(action.name, card, lane);
3398
4334
  });
3399
- actionRow.appendChild(button);
4335
+ foot.appendChild(button);
3400
4336
  }
3401
- body.appendChild(actionRow);
3402
- } else {
3403
- const note = element(
3404
- doc,
3405
- "div",
3406
- "hive-note",
3407
- lastModel && lastModel.writable ? translate("drawer.noActions") : translate("drawer.readOnly"),
3408
- );
3409
- body.appendChild(note);
4337
+ dialog.appendChild(foot);
3410
4338
  }
3411
4339
 
3412
- const label = element(doc, "div", "hive-section-label", translate("drawer.rawJson"));
3413
- body.appendChild(label);
3414
- const pre = element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2));
3415
- body.appendChild(pre);
4340
+ overlay.appendChild(dialog);
4341
+ frame.appendChild(overlay);
4342
+ drawerNode = overlay;
4343
+ drawerState = { kind: "card", card, lane };
4344
+ if (typeof doc.addEventListener === "function") {
4345
+ doc.addEventListener("keydown", onDrawerKeydown);
4346
+ }
4347
+ focusNode(closeButton);
3416
4348
  }
3417
4349
 
3418
4350
  // --- actions -------------------------------------------------------------
@@ -3561,34 +4493,12 @@ export function mount(root, options = {}) {
3561
4493
  case "mode":
3562
4494
  await postAction("mode", action.body || { mode: "free", reason: "panel" });
3563
4495
  break;
3564
- case "add": {
3565
- const title = ask(translate("prompt.newTitle"), "");
3566
- if (title === null || !title.trim()) return;
3567
- const role = ask(translate("prompt.role"), "coder");
3568
- if (role === null) return;
3569
- const scope = ask(translate("prompt.scope"), "");
3570
- if (scope === null) return;
3571
- const after = ask(translate("prompt.after"), "");
3572
- if (after === null) return;
3573
- await postAction("add", {
3574
- title: title.trim(),
3575
- role: role.trim() || "coder",
3576
- scope: splitList(scope),
3577
- after: splitList(after),
3578
- });
4496
+ case "add":
4497
+ openAddDialog(triggerButton);
3579
4498
  break;
3580
- }
3581
4499
  case "plan":
3582
4500
  openPlanDialog(triggerButton);
3583
4501
  break;
3584
- case "commit": {
3585
- const message = ask(translate("prompt.commitMessage"), "panel commit");
3586
- if (message === null) return;
3587
- const paths = ask(translate("prompt.paths"), "");
3588
- if (paths === null) return;
3589
- await postAction("commit", { message: message.trim() || "panel commit", set: splitList(paths) });
3590
- break;
3591
- }
3592
4502
  default:
3593
4503
  break;
3594
4504
  }
@@ -3621,10 +4531,18 @@ export function mount(root, options = {}) {
3621
4531
  case "retry":
3622
4532
  ok = await postAction("retry", { id: card.id });
3623
4533
  break;
4534
+ case "remove": {
4535
+ const name = card.title || card.id || translate("card.untitled");
4536
+ const message = translate("confirm.remove").replace("{title}", name);
4537
+ if (!askConfirm(message)) return;
4538
+ ok = await postAction("remove", { id: card.id });
4539
+ break;
4540
+ }
3624
4541
  default:
3625
4542
  break;
3626
4543
  }
3627
4544
  if (ok && !destroyed) {
4545
+ if (name === "remove") showToast("success", translate("toast.taskRemoved"), "");
3628
4546
  closeDrawer();
3629
4547
  void refresh();
3630
4548
  }
@@ -3665,11 +4583,57 @@ export function mount(root, options = {}) {
3665
4583
  initOutputPre.textContent = initOutput && initOutput.stdout ? initOutput.stdout : translate("init.noOutput");
3666
4584
  }
3667
4585
 
4586
+ function queenStorage() {
4587
+ try {
4588
+ const storage = view && view.localStorage;
4589
+ if (storage && typeof storage.getItem === "function" && typeof storage.setItem === "function") {
4590
+ return storage;
4591
+ }
4592
+ } catch {
4593
+ // A blocked localStorage must not break the panel.
4594
+ }
4595
+ return null;
4596
+ }
4597
+
4598
+ function queenDismissStorageKey(repo) {
4599
+ return QUEEN_DISMISS_KEY + "=" + repo;
4600
+ }
4601
+
4602
+ function isQueenNoticeDismissed(repo) {
4603
+ if (!repo) return false;
4604
+ if (queenDismissedFallback.has(repo)) return true;
4605
+ const storage = queenStorage();
4606
+ if (!storage) return false;
4607
+ try {
4608
+ if (storage.getItem(queenDismissStorageKey(repo)) !== null) return true;
4609
+ return storage.getItem(QUEEN_DISMISS_KEY) === repo;
4610
+ } catch {
4611
+ return false;
4612
+ }
4613
+ }
4614
+
4615
+ function dismissQueenNotice() {
4616
+ const repo = lastModel ? lastModel.repo : "";
4617
+ if (!repo) return;
4618
+ queenDismissedFallback.add(repo);
4619
+ const storage = queenStorage();
4620
+ if (storage) {
4621
+ try {
4622
+ storage.setItem(queenDismissStorageKey(repo), "1");
4623
+ storage.setItem(QUEEN_DISMISS_KEY, repo);
4624
+ } catch {
4625
+ // The in-memory fallback above still hides it for this mount.
4626
+ }
4627
+ }
4628
+ if (!destroyed && lastModel) renderQueenHint(lastModel);
4629
+ }
4630
+
3668
4631
  function renderQueenHint(model) {
3669
4632
  const initialised = Boolean(model && model.initialised !== false);
3670
4633
  const state = model && isRecord(model.queen) ? model.queen : null;
3671
4634
  const active = state ? state.active === true : Boolean(queenNotice);
3672
- const show = initialised && Boolean(state || queenNotice);
4635
+ const dismissed = active && isQueenNoticeDismissed(model ? model.repo : "");
4636
+ const show = initialised && Boolean(state || queenNotice) && !dismissed;
3673
4637
  const offer = show && !active;
3674
4638
 
3675
4639
  if (initialised && state) {
@@ -3698,15 +4662,16 @@ export function mount(root, options = {}) {
3698
4662
  queenHint.className = "hive-queen-hint" + (show ? " is-visible" : "") + (offer ? " is-offer" : "");
3699
4663
  queenHintText.textContent = active ? translate("init.queen") : translate("queen.offer");
3700
4664
  queenOffer.className = "hive-queen-offer" + (offer ? "" : " is-hidden");
4665
+ queenDismissButton.className =
4666
+ "hive-btn hive-btn-ghost hive-queen-dismiss" + (active && show ? "" : " is-hidden");
4667
+ setAttr(queenDismissButton, "title", translate("queen.dismissAria"));
4668
+ setAttr(queenDismissButton, "aria-label", translate("queen.dismissAria"));
3701
4669
  queenTakeoverButton.disabled = queenBusy;
3702
4670
  queenTakeoverButton.textContent = queenBusy ? translate("queen.takeoverBusy") : translate("queen.takeover");
3703
4671
  const takeoverAria = queenBusy ? translate("queen.takeoverBusy") : translate("queen.takeoverAria");
3704
4672
  setAttr(queenTakeoverButton, "title", takeoverAria);
3705
4673
  setAttr(queenTakeoverButton, "aria-label", takeoverAria);
3706
4674
 
3707
- queenExit.className = "hive-queen-exit" + (active ? "" : " is-hidden");
3708
- queenExitText.textContent = translate("init.queenExit");
3709
- queenCommand.textContent = translate("init.queenCommand");
3710
4675
  queenOutputSummary.textContent = translate("init.queenOutput");
3711
4676
  setAttr(queenOutputSummary, "title", translate("init.queenOutput"));
3712
4677
  const output = initOutput && initOutput.stdout ? initOutput.stdout : translate("init.noOutput");
@@ -3726,10 +4691,9 @@ export function mount(root, options = {}) {
3726
4691
  renderSupervisorContent();
3727
4692
  } catch {
3728
4693
  supervisorData = [];
4694
+ supervisorInlineRow = null;
3729
4695
  try {
3730
- supervisorBar.className = "hive-supervisor is-hidden";
3731
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden";
3732
- if (limitsDialogNode) closeLimitsDialog(false);
4696
+ supervisorInline.className = "hive-supervisor-inline is-hidden";
3733
4697
  } catch {
3734
4698
  // Supervisor rendering is optional; never let it break the panel.
3735
4699
  }
@@ -3737,53 +4701,38 @@ export function mount(root, options = {}) {
3737
4701
  }
3738
4702
 
3739
4703
  function renderSupervisorContent() {
3740
- clearNode(supervisorRepos);
3741
- supervisorLabel.textContent = translate("supervisor.label");
3742
- setAttr(supervisorBar, "aria-label", translate("supervisor.aria"));
3743
- if (!Array.isArray(supervisorData) || supervisorData.length === 0) {
3744
- supervisorBar.className = "hive-supervisor is-hidden";
3745
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits is-hidden";
3746
- if (limitsDialogNode) closeLimitsDialog(false);
3747
- return;
3748
- }
3749
- supervisorBar.className = "hive-supervisor";
3750
- const canConfigure = Boolean(lastModel && lastModel.writable);
3751
- supervisorLimitsButton.className = "hive-btn hive-btn-ghost hive-supervisor-limits" + (canConfigure ? "" : " is-hidden");
3752
- supervisorLimitsButton.textContent = translate("limits.open");
3753
- setAttr(supervisorLimitsButton, "title", translate("limits.openAria"));
3754
- setAttr(supervisorLimitsButton, "aria-label", translate("limits.openAria"));
3755
- if (!canConfigure && limitsDialogNode) closeLimitsDialog(false);
3756
- for (const row of supervisorData) {
3757
- const item = element(doc, "span", "hive-supervisor-item");
3758
- const path = element(doc, "code", "hive-supervisor-path", row.repo);
3759
- setAttr(path, "title", row.repo);
3760
- item.appendChild(path);
3761
-
3762
- let stateLabel = translate("supervisor.idle");
3763
- if (row.state === "running") {
3764
- stateLabel =
3765
- row.running === null || row.running === undefined
3766
- ? translate("supervisor.running")
3767
- : translate("supervisor.runningCount").replace("{count}", String(row.running));
3768
- } else if (row.state === "backoff") {
3769
- stateLabel = translate("supervisor.backoff");
3770
- } else if (row.state === "paused") {
3771
- stateLabel = translate("supervisor.paused");
3772
- }
3773
- item.appendChild(element(doc, "span", "hive-supervisor-state is-" + row.state, stateLabel));
4704
+ supervisorInlineRow = null;
4705
+ supervisorInline.className = "hive-supervisor-inline is-hidden";
4706
+ supervisorInlineState.className = "hive-supervisor-inline-state";
4707
+ supervisorInlineState.textContent = "";
4708
+ supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume is-hidden";
4709
+ setAttr(supervisorInline, "aria-label", translate("supervisor.aria"));
4710
+ supervisorInlineLabel.textContent = translate("supervisor.label");
4711
+ if (!lastModel || !Array.isArray(supervisorData) || supervisorData.length === 0) return;
4712
+ const row = supervisorData.find((entry) => entry.repo === lastModel.repo);
4713
+ if (!row) return;
3774
4714
 
3775
- if (row.state === "paused") {
3776
- const button = element(doc, "button", "hive-btn hive-supervisor-resume", translate("supervisor.resume"));
3777
- setAttr(button, "type", "button");
3778
- const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
3779
- setAttr(button, "title", aria);
3780
- setAttr(button, "aria-label", aria);
3781
- button.addEventListener("click", () => {
3782
- void resumeSupervisor(row, button);
3783
- });
3784
- item.appendChild(button);
3785
- }
3786
- supervisorRepos.appendChild(item);
4715
+ supervisorInlineRow = row;
4716
+ supervisorInline.className = "hive-supervisor-inline";
4717
+ let stateLabel = translate("supervisor.idle");
4718
+ if (row.state === "running") {
4719
+ stateLabel =
4720
+ row.running === null || row.running === undefined
4721
+ ? translate("supervisor.running")
4722
+ : translate("supervisor.runningCount").replace("{count}", String(row.running));
4723
+ } else if (row.state === "backoff") {
4724
+ stateLabel = translate("supervisor.backoff");
4725
+ } else if (row.state === "paused") {
4726
+ stateLabel = translate("supervisor.paused");
4727
+ }
4728
+ supervisorInlineState.className = "hive-supervisor-inline-state is-" + row.state;
4729
+ supervisorInlineState.textContent = stateLabel;
4730
+
4731
+ if (row.state === "paused") {
4732
+ const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
4733
+ supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume";
4734
+ setAttr(supervisorInlineResume, "title", aria);
4735
+ setAttr(supervisorInlineResume, "aria-label", aria);
3787
4736
  }
3788
4737
  }
3789
4738
 
@@ -4021,11 +4970,11 @@ export function mount(root, options = {}) {
4021
4970
  foot.appendChild(element(doc, "span", "hive-card-state", laneLabel(lane)));
4022
4971
  node.appendChild(foot);
4023
4972
 
4024
- node.addEventListener("click", () => openDrawer(card, lane));
4973
+ node.addEventListener("click", () => openDrawer(card, lane, node));
4025
4974
  node.addEventListener("keydown", (event) => {
4026
4975
  if (!event || (event.key !== "Enter" && event.key !== " ")) return;
4027
4976
  if (typeof event.preventDefault === "function") event.preventDefault();
4028
- openDrawer(card, lane);
4977
+ openDrawer(card, lane, node);
4029
4978
  });
4030
4979
  return node;
4031
4980
  }
@@ -4151,8 +5100,6 @@ export function mount(root, options = {}) {
4151
5100
  function render(model) {
4152
5101
  repoNode.textContent = model.repo || "—";
4153
5102
  setAttr(repoNode, "title", model.repo);
4154
- timeNode.textContent = model.at ? formatStamp(model.at) : "—";
4155
- setAttr(timeNode, "datetime", model.at);
4156
5103
 
4157
5104
  renderInit(model);
4158
5105
  renderQueenHint(model);
@@ -4175,6 +5122,7 @@ export function mount(root, options = {}) {
4175
5122
  if (helpWasOpen) closeHelp(false);
4176
5123
  if (planDialogNode) closePlanDialog(false);
4177
5124
  if (limitsDialogNode) closeLimitsDialog(false);
5125
+ if (addDialogNode) closeAddDialog(false);
4178
5126
  try {
4179
5127
  applyChrome();
4180
5128
  if (lastModel) render(lastModel);
@@ -4299,6 +5247,7 @@ export function mount(root, options = {}) {
4299
5247
  closeHelp(false);
4300
5248
  closePlanDialog(false);
4301
5249
  closeLimitsDialog(false);
5250
+ closeAddDialog(false);
4302
5251
  closeToast();
4303
5252
  closeDrawer();
4304
5253
  if (frame.parentNode) frame.parentNode.removeChild(frame);