@korso/shepherd-ui 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- var Me = Object.defineProperty;
2
- var Le = (t, n, c) => n in t ? Me(t, n, { enumerable: !0, configurable: !0, writable: !0, value: c }) : t[n] = c;
3
- var ue = (t, n, c) => Le(t, typeof n != "symbol" ? n + "" : n, c);
4
- import { jsx as r, jsxs as m, Fragment as W } from "react/jsx-runtime";
1
+ var Le = Object.defineProperty;
2
+ var Me = (t, n, c) => n in t ? Le(t, n, { enumerable: !0, configurable: !0, writable: !0, value: c }) : t[n] = c;
3
+ var ue = (t, n, c) => Me(t, typeof n != "symbol" ? n + "" : n, c);
4
+ import { jsx as o, jsxs as m, Fragment as H } from "react/jsx-runtime";
5
5
  import { createContext as Pe, useContext as Oe, useState as N, useRef as P, useCallback as R, useEffect as se, Fragment as Ge, useLayoutEffect as Fe, useId as Se } from "react";
6
6
  import { z as e } from "zod";
7
- const E = e.string(), Y = e.number(), Ue = e.object({
7
+ const E = e.string(), Y = e.number(), We = e.object({
8
8
  agentName: e.string(),
9
9
  human: e.string(),
10
10
  branch: e.string(),
@@ -15,7 +15,7 @@ const E = e.string(), Y = e.number(), Ue = e.object({
15
15
  authorIsLive: e.boolean(),
16
16
  authorLastActiveAt: E,
17
17
  updatedAt: E
18
- }), He = e.object({
18
+ }), Ue = e.object({
19
19
  kind: e.enum(["committed", "uncommitted"]),
20
20
  // A git object id (lowercase hex, 4–64 chars) for `committed` entries, or null
21
21
  // for `uncommitted`. This value is forwarded by the hub to OTHER clients, which
@@ -36,7 +36,7 @@ const E = e.string(), Y = e.number(), Ue = e.object({
36
36
  // (100) committed entries + 1 uncommitted, so this ceiling is generous. If
37
37
  // MAX_COMMITS is ever raised above ~599, raise this in lockstep or the hub
38
38
  // will start 400-rejecting otherwise-valid reports.
39
- entries: e.array(He).max(600)
39
+ entries: e.array(Ue).max(600)
40
40
  }), Z = e.object({
41
41
  workItemId: e.string().uuid(),
42
42
  agentName: e.string(),
@@ -64,8 +64,8 @@ const E = e.string(), Y = e.number(), Ue = e.object({
64
64
  yourClaims: e.array(Z).default([]),
65
65
  announcements: e.array(V),
66
66
  // Per-agent change records for the workspace. Defaulted for version-skew safety.
67
- changeRecords: e.array(Ue).default([])
68
- }), We = e.object({
67
+ changeRecords: e.array(We).default([])
68
+ }), He = e.object({
69
69
  name: e.string(),
70
70
  human: e.string(),
71
71
  program: e.string(),
@@ -103,7 +103,7 @@ const E = e.string(), Y = e.number(), Ue = e.object({
103
103
  toAdmin: e.boolean().default(!1),
104
104
  createdAt: E
105
105
  }), me = e.object({
106
- agents: e.array(We),
106
+ agents: e.array(He),
107
107
  tasks: e.array(Be),
108
108
  announcements: e.array(Ke),
109
109
  // The server's clock, so the client computes "expires in / last seen" against
@@ -241,6 +241,8 @@ e.object({
241
241
  });
242
242
  const Xe = re, Ze = e.object({
243
243
  workspaces: e.array(re)
244
+ }), Je = e.object({
245
+ deleted: e.literal(!0)
244
246
  });
245
247
  e.object({
246
248
  name: e.string().min(1).optional()
@@ -249,7 +251,7 @@ const pe = e.object({
249
251
  // The raw shp_ token, shown once at creation and never returned again.
250
252
  token: e.string(),
251
253
  id: e.string()
252
- }), Je = e.object({
254
+ }), Qe = e.object({
253
255
  id: e.string(),
254
256
  name: e.string().nullable(),
255
257
  // ISO timestamp string (see IsoTimestamp note above) or null when unused / not revoked.
@@ -257,7 +259,7 @@ const pe = e.object({
257
259
  createdAt: E,
258
260
  revokedAt: E.nullable()
259
261
  }), ge = e.object({
260
- tokens: e.array(Je)
262
+ tokens: e.array(Qe)
261
263
  });
262
264
  e.object({
263
265
  expiresInDays: e.number().int().positive().optional(),
@@ -265,7 +267,7 @@ e.object({
265
267
  // integer to cap it instead.
266
268
  maxUses: e.number().int().positive().optional()
267
269
  });
268
- const Qe = e.object({
270
+ const et = e.object({
269
271
  code: e.string(),
270
272
  // ISO timestamp string, or null when the invite never expires.
271
273
  expiresAt: E.nullable(),
@@ -276,47 +278,47 @@ const Qe = e.object({
276
278
  e.object({
277
279
  email: e.string().email()
278
280
  });
279
- const et = e.object({
281
+ const tt = e.object({
280
282
  email: e.string(),
281
283
  sentAt: E
282
- }), tt = e.object({
284
+ }), nt = e.object({
283
285
  // The workspace the caller just joined.
284
286
  workspace: re
285
- }), nt = e.object({
287
+ }), st = e.object({
286
288
  accountId: e.string(),
287
289
  displayName: e.string().nullable(),
288
290
  githubLogin: e.string().nullable(),
289
291
  email: e.string().nullable(),
290
292
  avatarUrl: e.string().nullable(),
291
293
  role: Ce
292
- }), st = e.object({
293
- members: e.array(nt)
294
- }), at = e.enum(["bug", "suggestion", "other"]);
294
+ }), at = e.object({
295
+ members: e.array(st)
296
+ }), rt = e.enum(["bug", "suggestion", "other"]);
295
297
  e.object({
296
- type: at,
298
+ type: rt,
297
299
  body: e.string().trim().min(1).max(4e3)
298
300
  });
299
- const rt = e.object({
301
+ const ot = e.object({
300
302
  ok: e.literal(!0),
301
303
  // uuid PK (the feedback table, like workspaces, uses gen_random_uuid()).
302
304
  id: e.string()
303
- }), ot = 5e3;
304
- class H extends Error {
305
+ }), it = 5e3;
306
+ class U extends Error {
305
307
  /**
306
308
  * @param message - Human-readable failure description.
307
309
  * @param status - Upstream HTTP status, omitted for network/abort failures.
308
310
  */
309
- constructor(c, o) {
311
+ constructor(c, r) {
310
312
  super(c);
311
313
  /** Upstream HTTP status for a non-2xx response; absent for transport errors. */
312
314
  ue(this, "status");
313
- this.name = "ShepherdClientError", o !== void 0 && (this.status = o);
315
+ this.name = "ShepherdClientError", r !== void 0 && (this.status = r);
314
316
  }
315
317
  }
316
- function it(t) {
318
+ function ct(t) {
317
319
  return t instanceof Error ? t.message : "Something went wrong.";
318
320
  }
319
- async function ct(t) {
321
+ async function lt(t) {
320
322
  try {
321
323
  const n = await t.json();
322
324
  if (n !== null && typeof n == "object" && "error" in n && typeof n.error == "string")
@@ -325,33 +327,31 @@ async function ct(t) {
325
327
  }
326
328
  return "";
327
329
  }
328
- function Wt(t) {
329
- const n = t.baseUrl.replace(/\/$/, ""), c = t.timeoutMs ?? ot, o = encodeURIComponent;
330
+ function qt(t) {
331
+ const n = t.baseUrl.replace(/\/$/, ""), c = t.timeoutMs ?? it, r = encodeURIComponent;
330
332
  async function s(a, i, l = {}) {
331
- var f, y;
333
+ var f, k;
332
334
  const h = new AbortController(), u = setTimeout(() => h.abort(), c);
333
335
  let d;
334
336
  try {
335
- const v = {
336
- "Content-Type": "application/json"
337
- }, A = await ((f = t.getAuthHeader) == null ? void 0 : f.call(t)), S = {
337
+ const v = l.body !== void 0 ? { "Content-Type": "application/json" } : {}, A = await ((f = t.getAuthHeader) == null ? void 0 : f.call(t)), S = {
338
338
  method: a,
339
339
  headers: { ...v, ...typeof A == "string" ? { Authorization: A } : A ?? {} },
340
340
  signal: h.signal
341
341
  };
342
342
  l.body !== void 0 && (S.body = JSON.stringify(l.body)), d = await fetch(`${n}${i}`, S);
343
343
  } catch (v) {
344
- throw new H(
344
+ throw new U(
345
345
  v instanceof Error ? v.message : String(v)
346
346
  );
347
347
  } finally {
348
348
  clearTimeout(u);
349
349
  }
350
350
  if (d.status === 401)
351
- throw (y = t.onUnauthorized) == null || y.call(t), new H("Unauthorized", 401);
351
+ throw (k = t.onUnauthorized) == null || k.call(t), new U("Unauthorized", 401);
352
352
  if (!d.ok) {
353
- const v = await ct(d);
354
- throw new H(
353
+ const v = await lt(d);
354
+ throw new U(
355
355
  v !== "" ? `HTTP ${d.status}: ${v}` : `HTTP ${d.status}`,
356
356
  d.status
357
357
  );
@@ -365,7 +365,7 @@ function Wt(t) {
365
365
  }
366
366
  const b = l.schema.safeParse(await d.json());
367
367
  if (!b.success)
368
- throw new H("Invalid response schema");
368
+ throw new U("Invalid response schema");
369
369
  return b.data;
370
370
  }
371
371
  return {
@@ -382,21 +382,26 @@ function Wt(t) {
382
382
  schema: Xe
383
383
  });
384
384
  },
385
+ deleteWorkspace(a) {
386
+ return s("DELETE", `/workspaces/${r(a)}`, {
387
+ schema: Je
388
+ });
389
+ },
385
390
  mintToken(a, i) {
386
- return s("POST", `/workspaces/${o(a)}/tokens`, {
391
+ return s("POST", `/workspaces/${r(a)}/tokens`, {
387
392
  body: i,
388
393
  schema: pe
389
394
  });
390
395
  },
391
396
  listTokens(a) {
392
- return s("GET", `/workspaces/${o(a)}/tokens`, {
397
+ return s("GET", `/workspaces/${r(a)}/tokens`, {
393
398
  schema: ge
394
399
  });
395
400
  },
396
401
  revokeToken(a, i) {
397
402
  return s(
398
403
  "DELETE",
399
- `/workspaces/${o(a)}/tokens/${o(i)}`
404
+ `/workspaces/${r(a)}/tokens/${r(i)}`
400
405
  );
401
406
  },
402
407
  mintAccountToken(a) {
@@ -411,59 +416,59 @@ function Wt(t) {
411
416
  });
412
417
  },
413
418
  revokeAccountToken(a) {
414
- return s("DELETE", `/tokens/${o(a)}`);
419
+ return s("DELETE", `/tokens/${r(a)}`);
415
420
  },
416
421
  createInvite(a, i) {
417
- return s("POST", `/workspaces/${o(a)}/invites`, {
422
+ return s("POST", `/workspaces/${r(a)}/invites`, {
418
423
  body: i,
419
- schema: Qe
424
+ schema: et
420
425
  });
421
426
  },
422
427
  inviteByEmail(a, i) {
423
- return s("POST", `/workspaces/${o(a)}/invites/email`, {
428
+ return s("POST", `/workspaces/${r(a)}/invites/email`, {
424
429
  body: { email: i },
425
- schema: et
430
+ schema: tt
426
431
  });
427
432
  },
428
433
  revokeInvite(a, i) {
429
434
  return s(
430
435
  "POST",
431
- `/workspaces/${o(a)}/invites/${o(i)}/revoke`
436
+ `/workspaces/${r(a)}/invites/${r(i)}/revoke`
432
437
  );
433
438
  },
434
439
  redeemInvite(a) {
435
- return s("POST", `/invites/${o(a)}/redeem`, {
436
- schema: tt
440
+ return s("POST", `/invites/${r(a)}/redeem`, {
441
+ schema: nt
437
442
  });
438
443
  },
439
444
  listMembers(a) {
440
- return s("GET", `/workspaces/${o(a)}/members`, {
441
- schema: st
445
+ return s("GET", `/workspaces/${r(a)}/members`, {
446
+ schema: at
442
447
  });
443
448
  },
444
449
  removeMember(a, i) {
445
450
  return s(
446
451
  "DELETE",
447
- `/workspaces/${o(a)}/members/${o(i)}`
452
+ `/workspaces/${r(a)}/members/${r(i)}`
448
453
  );
449
454
  },
450
455
  leave(a) {
451
- return s("POST", `/workspaces/${o(a)}/leave`);
456
+ return s("POST", `/workspaces/${r(a)}/leave`);
452
457
  },
453
458
  landscape(a) {
454
- return s("GET", `/workspaces/${o(a)}/landscape`, {
459
+ return s("GET", `/workspaces/${r(a)}/landscape`, {
455
460
  schema: me
456
461
  });
457
462
  },
458
463
  announceTo(a, i) {
459
- return s("POST", `/workspaces/${o(a)}/announce`, {
464
+ return s("POST", `/workspaces/${r(a)}/announce`, {
460
465
  body: i,
461
466
  schema: he
462
467
  });
463
468
  },
464
469
  submitFeedback(a, i) {
465
- const l = i !== void 0 ? `/workspaces/${o(i)}/feedback` : "/feedback";
466
- return s("POST", l, { body: a, schema: rt });
470
+ const l = i !== void 0 ? `/workspaces/${r(i)}/feedback` : "/feedback";
471
+ return s("POST", l, { body: a, schema: ot });
467
472
  },
468
473
  // --- self-host singular aliases (implicit single workspace) -------------
469
474
  getLandscape() {
@@ -480,11 +485,11 @@ function Wt(t) {
480
485
  };
481
486
  }
482
487
  const $e = Pe(null);
483
- function qt({
488
+ function Bt({
484
489
  client: t,
485
490
  children: n
486
491
  }) {
487
- return /* @__PURE__ */ r($e.Provider, { value: t, children: n });
492
+ return /* @__PURE__ */ o($e.Provider, { value: t, children: n });
488
493
  }
489
494
  function oe() {
490
495
  const t = Oe($e);
@@ -494,50 +499,50 @@ function oe() {
494
499
  );
495
500
  return t;
496
501
  }
497
- const lt = 5e3, dt = 1e3;
498
- function ut(t) {
499
- const n = oe(), c = t == null ? void 0 : t.workspaceId, o = (t == null ? void 0 : t.pollMs) ?? lt, s = (t == null ? void 0 : t.enabled) ?? !0, [a, i] = N(
502
+ const dt = 5e3, ut = 1e3;
503
+ function mt(t) {
504
+ const n = oe(), c = t == null ? void 0 : t.workspaceId, r = (t == null ? void 0 : t.pollMs) ?? dt, s = (t == null ? void 0 : t.enabled) ?? !0, [a, i] = N(
500
505
  null
501
506
  ), [l, h] = N("live"), [u, d] = N(null), [, b] = N(0), f = P(n);
502
507
  f.current = n;
503
- const y = P(0), v = R(
508
+ const k = P(0), v = R(
504
509
  async ($) => {
505
510
  try {
506
511
  const S = c ? await f.current.landscape(c) : await f.current.getLandscape();
507
- if ($ !== y.current) return;
512
+ if ($ !== k.current) return;
508
513
  i(S), d(Date.now()), h("live");
509
514
  } catch (S) {
510
- if ($ !== y.current) return;
511
- S instanceof H && S.status === 401 ? h("unauthorized") : h("reconnecting");
515
+ if ($ !== k.current) return;
516
+ S instanceof U && S.status === 401 ? h("unauthorized") : h("reconnecting");
512
517
  }
513
518
  },
514
519
  [c]
515
520
  );
516
521
  se(() => {
517
522
  if (!s) return;
518
- const $ = ++y.current;
523
+ const $ = ++k.current;
519
524
  v($);
520
525
  const S = setInterval(() => {
521
526
  document.visibilityState !== "hidden" && v($);
522
- }, o), k = setInterval(() => {
527
+ }, r), y = setInterval(() => {
523
528
  b((T) => T + 1);
524
- }, dt), j = () => {
529
+ }, ut), j = () => {
525
530
  document.visibilityState === "visible" && v($);
526
531
  };
527
532
  return document.addEventListener("visibilitychange", j), () => {
528
- y.current++, clearInterval(S), clearInterval(k), document.removeEventListener("visibilitychange", j);
533
+ k.current++, clearInterval(S), clearInterval(y), document.removeEventListener("visibilitychange", j);
529
534
  };
530
- }, [v, o, s]);
531
- const A = R(() => v(y.current), [v]);
535
+ }, [v, r, s]);
536
+ const A = R(() => v(k.current), [v]);
532
537
  return { snapshot: a, status: l, lastUpdatedMs: u, refresh: A };
533
538
  }
534
539
  function K(t, n) {
535
540
  const c = Math.floor((n - Date.parse(t)) / 1e3);
536
541
  if (c < 5) return "just now";
537
542
  if (c < 60) return `${c}s ago`;
538
- const o = Math.floor(c / 60);
539
- if (o < 60) return `${o}m ago`;
540
- const s = Math.floor(o / 60);
543
+ const r = Math.floor(c / 60);
544
+ if (r < 60) return `${r}m ago`;
545
+ const s = Math.floor(r / 60);
541
546
  return s < 24 ? `${s}h ago` : `${Math.floor(s / 24)}d ago`;
542
547
  }
543
548
  function z(t) {
@@ -551,17 +556,17 @@ function ie(t) {
551
556
  return n && n.length >= 2 ? n[0] + n[1] : t.slice(0, 2).toUpperCase();
552
557
  }
553
558
  const Ee = "A-Za-z0-9_-";
554
- function mt(t, n) {
555
- const o = t.slice(0, n).match(new RegExp(`(?:^|\\s)@([${Ee}]*)$`));
556
- if (!o) return null;
557
- const s = o[1];
559
+ function ht(t, n) {
560
+ const r = t.slice(0, n).match(new RegExp(`(?:^|\\s)@([${Ee}]*)$`));
561
+ if (!r) return null;
562
+ const s = r[1];
558
563
  return { start: n - s.length - 1, end: n, query: s };
559
564
  }
560
- function ht(t, n) {
565
+ function pt(t, n) {
561
566
  const c = new RegExp(`(?:^|\\s)@([${Ee}]+)`, "g");
562
- let o;
563
- for (; (o = c.exec(t)) !== null; ) {
564
- const s = o[1].toLowerCase(), a = n.find((i) => i.toLowerCase() === s);
567
+ let r;
568
+ for (; (r = c.exec(t)) !== null; ) {
569
+ const s = r[1].toLowerCase(), a = n.find((i) => i.toLowerCase() === s);
565
570
  if (a) return a;
566
571
  }
567
572
  return null;
@@ -569,13 +574,13 @@ function ht(t, n) {
569
574
  function Re(t) {
570
575
  return [...new Set(t.map((n) => n.repo))].sort();
571
576
  }
572
- function L(t, n) {
577
+ function M(t, n) {
573
578
  return n === null || n === "__all__" || t.repo === n;
574
579
  }
575
- function pt(t, n) {
580
+ function gt(t, n) {
576
581
  return [
577
582
  ...new Set(
578
- t.filter((c) => c.presence === "live" && L(c, n)).map((c) => c.name)
583
+ t.filter((c) => c.presence === "live" && M(c, n)).map((c) => c.name)
579
584
  )
580
585
  ].sort();
581
586
  }
@@ -583,39 +588,39 @@ function fe(t) {
583
588
  const n = t.find((c) => c.status === "active");
584
589
  return n ? n.repo : t.length ? t[0].repo : null;
585
590
  }
586
- function gt(t) {
591
+ function ft(t) {
587
592
  return t === "dropped" ? "dropped" : "done";
588
593
  }
589
594
  function be(t, n) {
590
595
  if (!n) return "";
591
- const c = Math.floor((Date.parse(n) - Date.parse(t)) / 1e3), o = Math.floor(c / 60);
592
- return o < 60 ? `active ${o}m` : `active ${Math.floor(o / 60)}h`;
596
+ const c = Math.floor((Date.parse(n) - Date.parse(t)) / 1e3), r = Math.floor(c / 60);
597
+ return r < 60 ? `active ${r}m` : `active ${Math.floor(r / 60)}h`;
593
598
  }
594
- function ft(t, n) {
595
- const c = new Date(Date.parse(t)), o = new Date(n), s = (i) => new Date(i.getFullYear(), i.getMonth(), i.getDate()).getTime(), a = Math.round((s(o) - s(c)) / 864e5);
599
+ function bt(t, n) {
600
+ const c = new Date(Date.parse(t)), r = new Date(n), s = (i) => new Date(i.getFullYear(), i.getMonth(), i.getDate()).getTime(), a = Math.round((s(r) - s(c)) / 864e5);
596
601
  return a <= 0 ? "Today" : a === 1 ? "Yesterday" : c.toLocaleDateString(void 0, { month: "short", day: "numeric" });
597
602
  }
598
603
  function ve(t) {
599
604
  let n = t.toLowerCase().replace(/\\/g, "/");
600
605
  n.endsWith("/") && (n = n.replace(/\/+$/, "") + "/**");
601
606
  const c = [];
602
- for (const o of n.split("/"))
603
- if (!(o === "" || o === ".")) {
604
- if (o === "..") {
607
+ for (const r of n.split("/"))
608
+ if (!(r === "" || r === ".")) {
609
+ if (r === "..") {
605
610
  c.length && c.pop();
606
611
  continue;
607
612
  }
608
- c.push(o);
613
+ c.push(r);
609
614
  }
610
615
  return c;
611
616
  }
612
- const ye = /[*?{}[\]]/;
613
- function bt(t, n) {
614
- return t === "*" ? !0 : (ye.test(t) || !ye.test(n)) && t === n;
615
- }
617
+ const ke = /[*?{}[\]]/;
616
618
  function vt(t, n) {
619
+ return t === "*" ? !0 : (ke.test(t) || !ke.test(n)) && t === n;
620
+ }
621
+ function kt(t, n) {
617
622
  const c = /* @__PURE__ */ new Map();
618
- function o(s, a) {
623
+ function r(s, a) {
619
624
  if (n.length - a === 0) {
620
625
  for (let b = s; b < t.length; b++) if (t[b] !== "**") return !1;
621
626
  return !0;
@@ -625,30 +630,30 @@ function vt(t, n) {
625
630
  if (l !== void 0) return l;
626
631
  const h = t[s], u = n[a];
627
632
  let d;
628
- return h === "**" ? d = o(s + 1, a) || o(s, a + 1) : u === "**" ? d = !1 : d = bt(h, u) && o(s + 1, a + 1), c.set(i, d), d;
633
+ return h === "**" ? d = r(s + 1, a) || r(s, a + 1) : u === "**" ? d = !1 : d = vt(h, u) && r(s + 1, a + 1), c.set(i, d), d;
629
634
  }
630
- return o(0, 0);
635
+ return r(0, 0);
631
636
  }
632
- function ke(t, n) {
637
+ function ye(t, n) {
633
638
  if (n.length === 0) return !0;
634
639
  const c = t.map(ve);
635
- return n.every((o) => {
636
- const s = ve(o);
637
- return c.some((a) => vt(a, s));
640
+ return n.every((r) => {
641
+ const s = ve(r);
642
+ return c.some((a) => kt(a, s));
638
643
  });
639
644
  }
640
645
  function yt(t) {
641
646
  const n = /* @__PURE__ */ new Map();
642
647
  for (const s of t)
643
648
  n.has(s.agentName) || n.set(s.agentName, []), n.get(s.agentName).push(s);
644
- const c = (s, a) => a.createdAt.localeCompare(s.createdAt), o = [];
649
+ const c = (s, a) => a.createdAt.localeCompare(s.createdAt), r = [];
645
650
  for (const [s, a] of n) {
646
651
  const i = [...a].sort(c), l = i.map(
647
652
  (u) => i.some(
648
- (d) => d !== u && ke(d.pathGlobs, u.pathGlobs) && !ke(u.pathGlobs, d.pathGlobs)
653
+ (d) => d !== u && ye(d.pathGlobs, u.pathGlobs) && !ye(u.pathGlobs, d.pathGlobs)
649
654
  )
650
655
  ), h = i[0];
651
- o.push({
656
+ r.push({
652
657
  agentName: s,
653
658
  model: h.model,
654
659
  program: h.program,
@@ -657,17 +662,17 @@ function yt(t) {
657
662
  narrower: i.filter((u, d) => l[d])
658
663
  });
659
664
  }
660
- return o.sort((s, a) => {
665
+ return r.sort((s, a) => {
661
666
  const i = s.primaries.concat(s.narrower)[0].createdAt;
662
667
  return a.primaries.concat(a.narrower)[0].createdAt.localeCompare(i);
663
- }), o;
668
+ }), r;
664
669
  }
665
670
  const _e = { active: 0, done: 0 };
666
- function kt({
671
+ function _t({
667
672
  repos: t,
668
673
  counts: n,
669
674
  selected: c,
670
- onSelect: o
675
+ onSelect: r
671
676
  }) {
672
677
  const [s, a] = N(!1), i = P(null);
673
678
  if (se(() => {
@@ -679,20 +684,20 @@ function kt({
679
684
  b == null || b.focus();
680
685
  }, [s]), t.length < 2) return null;
681
686
  const l = c === null || c === "__all__", h = l ? "All repos" : c, u = (d, b) => {
682
- const f = d === null ? n.__all__ ?? _e : n[d] ?? _e, y = d === null ? l : c === d, v = "repo-mi" + (y ? " on" : "") + (d === null ? " all" : "");
687
+ const f = d === null ? n.__all__ ?? _e : n[d] ?? _e, k = d === null ? l : c === d, v = "repo-mi" + (k ? " on" : "") + (d === null ? " all" : "");
683
688
  return /* @__PURE__ */ m(
684
689
  "button",
685
690
  {
686
691
  type: "button",
687
692
  className: v,
688
693
  role: "option",
689
- "aria-selected": y,
694
+ "aria-selected": k,
690
695
  onClick: (A) => {
691
- A.stopPropagation(), a(!1), o(d);
696
+ A.stopPropagation(), a(!1), r(d);
692
697
  },
693
698
  children: [
694
- /* @__PURE__ */ r("span", { children: b }),
695
- /* @__PURE__ */ r("span", { className: "ct", children: `${f.active} active · ${f.done} done` })
699
+ /* @__PURE__ */ o("span", { children: b }),
700
+ /* @__PURE__ */ o("span", { className: "ct", children: `${f.active} active · ${f.done} done` })
696
701
  ]
697
702
  },
698
703
  d ?? "__all__"
@@ -719,9 +724,9 @@ function kt({
719
724
  d.stopPropagation(), a((b) => !b);
720
725
  },
721
726
  children: [
722
- /* @__PURE__ */ r("span", { className: "slash", children: "/" }),
727
+ /* @__PURE__ */ o("span", { className: "slash", children: "/" }),
723
728
  " " + h + " ",
724
- /* @__PURE__ */ r("span", { children: "▼" })
729
+ /* @__PURE__ */ o("span", { children: "▼" })
725
730
  ]
726
731
  }
727
732
  ),
@@ -733,22 +738,22 @@ function kt({
733
738
  }
734
739
  );
735
740
  }
736
- function _t({ agents: t, tasks: n, selectedRepo: c }) {
737
- const o = t.filter(
738
- (l) => l.presence === "live" && L({ repo: l.repo ?? "" }, c)
741
+ function Nt({ agents: t, tasks: n, selectedRepo: c }) {
742
+ const r = t.filter(
743
+ (l) => l.presence === "live" && M({ repo: l.repo ?? "" }, c)
739
744
  ), s = /* @__PURE__ */ new Set();
740
745
  for (const l of n) l.status === "active" && s.add(l.agentName);
741
- const a = (l) => s.has(l.name), i = [...o].sort((l, h) => {
746
+ const a = (l) => s.has(l.name), i = [...r].sort((l, h) => {
742
747
  const u = a(l), d = a(h);
743
748
  return u !== d ? u ? -1 : 1 : l.name.localeCompare(h.name);
744
749
  });
745
- return /* @__PURE__ */ r("div", { className: "crew", id: "crew", children: i.map((l) => /* @__PURE__ */ m(
750
+ return /* @__PURE__ */ o("div", { className: "crew", id: "crew", children: i.map((l) => /* @__PURE__ */ m(
746
751
  "div",
747
752
  {
748
753
  className: "person" + (a(l) ? "" : " person--idle"),
749
754
  children: [
750
- /* @__PURE__ */ r("div", { className: "avatar", style: { background: z(l.name) }, children: ie(l.name) }),
751
- /* @__PURE__ */ r("span", { className: "person__name", children: l.name })
755
+ /* @__PURE__ */ o("div", { className: "avatar", style: { background: z(l.name) }, children: ie(l.name) }),
756
+ /* @__PURE__ */ o("span", { className: "person__name", children: l.name })
752
757
  ]
753
758
  },
754
759
  l.name
@@ -756,141 +761,141 @@ function _t({ agents: t, tasks: n, selectedRepo: c }) {
756
761
  }
757
762
  function je({ globs: t }) {
758
763
  return t.length <= 1 ? /* @__PURE__ */ m("div", { className: "terr", children: [
759
- /* @__PURE__ */ r("span", { className: "terr__lbl", children: "territory" }),
760
- t.map((n) => /* @__PURE__ */ r("span", { className: "glob", children: n }, n))
764
+ /* @__PURE__ */ o("span", { className: "terr__lbl", children: "territory" }),
765
+ t.map((n) => /* @__PURE__ */ o("span", { className: "glob", children: n }, n))
761
766
  ] }) : /* @__PURE__ */ m("details", { className: "terrx", children: [
762
767
  /* @__PURE__ */ m("summary", { children: [
763
- /* @__PURE__ */ r("span", { className: "terr__lbl", children: "territory" }),
768
+ /* @__PURE__ */ o("span", { className: "terr__lbl", children: "territory" }),
764
769
  /* @__PURE__ */ m("span", { className: "glob glob--more", children: [
765
- /* @__PURE__ */ r("span", { className: "tw", children: "▶" }),
770
+ /* @__PURE__ */ o("span", { className: "tw", children: "▶" }),
766
771
  ` ${t.length} paths`
767
772
  ] })
768
773
  ] }),
769
- /* @__PURE__ */ r("div", { className: "terr terr--full", children: t.map((n) => /* @__PURE__ */ r("span", { className: "glob", children: n }, n)) })
774
+ /* @__PURE__ */ o("div", { className: "terr terr--full", children: t.map((n) => /* @__PURE__ */ o("span", { className: "glob", children: n }, n)) })
770
775
  ] });
771
776
  }
772
- const te = (t) => `${t.agentName}|${t.repo}|${t.createdAt}`, Nt = (t) => t === null || t === "__all__";
777
+ const te = (t) => `${t.agentName}|${t.repo}|${t.createdAt}`, wt = (t) => t === null || t === "__all__";
773
778
  function ne({
774
779
  task: t,
775
780
  nowMs: n
776
781
  }) {
777
- return /* @__PURE__ */ m(W, { children: [
778
- /* @__PURE__ */ r("div", { className: "task__intent", children: t.intent }),
779
- /* @__PURE__ */ r(je, { globs: t.pathGlobs }),
780
- /* @__PURE__ */ r("div", { className: "task__meta", children: `started ${K(t.createdAt, n)}` })
782
+ return /* @__PURE__ */ m(H, { children: [
783
+ /* @__PURE__ */ o("div", { className: "task__intent", children: t.intent }),
784
+ /* @__PURE__ */ o(je, { globs: t.pathGlobs }),
785
+ /* @__PURE__ */ o("div", { className: "task__meta", children: `started ${K(t.createdAt, n)}` })
781
786
  ] });
782
787
  }
783
- function wt({
788
+ function At({
784
789
  task: t,
785
790
  nowMs: n,
786
791
  allRepos: c
787
792
  }) {
788
- const o = t.model || t.program;
793
+ const r = t.model || t.program;
789
794
  return /* @__PURE__ */ m("div", { className: "task", children: [
790
795
  /* @__PURE__ */ m("div", { className: "task__r1", children: [
791
- /* @__PURE__ */ r("span", { className: "task__who", children: t.agentName }),
792
- c && /* @__PURE__ */ r("span", { className: "task__repo", children: t.repo }),
793
- o && /* @__PURE__ */ r("span", { className: "task__tag", children: o }),
794
- /* @__PURE__ */ r("span", { className: "livedot", title: "active" })
796
+ /* @__PURE__ */ o("span", { className: "task__who", children: t.agentName }),
797
+ c && /* @__PURE__ */ o("span", { className: "task__repo", children: t.repo }),
798
+ r && /* @__PURE__ */ o("span", { className: "task__tag", children: r }),
799
+ /* @__PURE__ */ o("span", { className: "livedot", title: "active" })
795
800
  ] }),
796
- /* @__PURE__ */ r(ne, { task: t, nowMs: n })
801
+ /* @__PURE__ */ o(ne, { task: t, nowMs: n })
797
802
  ] });
798
803
  }
799
- function At({
804
+ function St({
800
805
  group: t,
801
806
  nowMs: n,
802
807
  allRepos: c
803
808
  }) {
804
- const o = t.model || t.program, s = t.primaries.length + t.narrower.length, a = t.narrower.length;
809
+ const r = t.model || t.program, s = t.primaries.length + t.narrower.length, a = t.narrower.length;
805
810
  return /* @__PURE__ */ m("div", { className: "grp", children: [
806
811
  /* @__PURE__ */ m("div", { className: "grp__head", children: [
807
- /* @__PURE__ */ r("span", { className: "grp__who", children: t.agentName }),
808
- c && /* @__PURE__ */ r("span", { className: "task__repo", children: t.repo }),
809
- o && /* @__PURE__ */ r("span", { className: "grp__tag", children: o }),
810
- /* @__PURE__ */ r("span", { className: "grp__count", children: `· ${s} active` }),
811
- /* @__PURE__ */ r("span", { className: "grp__dot", title: "live" })
812
+ /* @__PURE__ */ o("span", { className: "grp__who", children: t.agentName }),
813
+ c && /* @__PURE__ */ o("span", { className: "task__repo", children: t.repo }),
814
+ r && /* @__PURE__ */ o("span", { className: "grp__tag", children: r }),
815
+ /* @__PURE__ */ o("span", { className: "grp__count", children: `· ${s} active` }),
816
+ /* @__PURE__ */ o("span", { className: "grp__dot", title: "live" })
812
817
  ] }),
813
- /* @__PURE__ */ r("div", { className: "claims", children: t.primaries.map((i) => /* @__PURE__ */ r("div", { className: "claim", children: /* @__PURE__ */ r(ne, { task: i, nowMs: n }) }, te(i))) }),
818
+ /* @__PURE__ */ o("div", { className: "claims", children: t.primaries.map((i) => /* @__PURE__ */ o("div", { className: "claim", children: /* @__PURE__ */ o(ne, { task: i, nowMs: n }) }, te(i))) }),
814
819
  a > 0 && /* @__PURE__ */ m("details", { className: "fold", children: [
815
820
  /* @__PURE__ */ m("summary", { children: [
816
- /* @__PURE__ */ r("span", { className: "tw", children: "▶" }),
821
+ /* @__PURE__ */ o("span", { className: "tw", children: "▶" }),
817
822
  ` +${a} narrower claim${a > 1 ? "s" : ""}`
818
823
  ] }),
819
- /* @__PURE__ */ r("div", { className: "fold__body", children: t.narrower.map((i) => /* @__PURE__ */ m("div", { className: "claim", children: [
820
- /* @__PURE__ */ r(ne, { task: i, nowMs: n }),
821
- /* @__PURE__ */ r("div", { className: "covered", children: "⊂ covered by a claim above" })
824
+ /* @__PURE__ */ o("div", { className: "fold__body", children: t.narrower.map((i) => /* @__PURE__ */ m("div", { className: "claim", children: [
825
+ /* @__PURE__ */ o(ne, { task: i, nowMs: n }),
826
+ /* @__PURE__ */ o("div", { className: "covered", children: "⊂ covered by a claim above" })
822
827
  ] }, te(i))) })
823
828
  ] })
824
829
  ] });
825
830
  }
826
- function St({
831
+ function Tt({
827
832
  tasks: t,
828
833
  nowMs: n,
829
834
  selectedRepo: c
830
835
  }) {
831
- const o = Nt(c), s = t.filter(
832
- (a) => a.status === "active" && L(a, c)
836
+ const r = wt(c), s = t.filter(
837
+ (a) => a.status === "active" && M(a, c)
833
838
  );
834
839
  if (s.length === 0) {
835
- const a = o ? "Nothing active right now." : `Nothing active in ${c}.`;
836
- return /* @__PURE__ */ r("div", { id: "active-list", children: /* @__PURE__ */ r("div", { className: "empty", children: a }) });
840
+ const a = r ? "Nothing active right now." : `Nothing active in ${c}.`;
841
+ return /* @__PURE__ */ o("div", { id: "active-list", children: /* @__PURE__ */ o("div", { className: "empty", children: a }) });
837
842
  }
838
- return /* @__PURE__ */ r("div", { id: "active-list", children: yt(s).map((a) => {
843
+ return /* @__PURE__ */ o("div", { id: "active-list", children: yt(s).map((a) => {
839
844
  const i = a.primaries.length === 1 && a.narrower.length === 0, l = te(a.primaries.concat(a.narrower)[0]);
840
- return i ? /* @__PURE__ */ r(
841
- wt,
845
+ return i ? /* @__PURE__ */ o(
846
+ At,
842
847
  {
843
848
  task: a.primaries[0],
844
849
  nowMs: n,
845
- allRepos: o
850
+ allRepos: r
846
851
  },
847
852
  l
848
- ) : /* @__PURE__ */ r(At, { group: a, nowMs: n, allRepos: o }, l);
853
+ ) : /* @__PURE__ */ o(St, { group: a, nowMs: n, allRepos: r }, l);
849
854
  }) });
850
855
  }
851
- const Tt = (t) => `${t.agentName}|${t.repo}|${t.createdAt}`, Ct = (t) => t === null || t === "__all__";
852
- function $t({
856
+ const Ct = (t) => `${t.agentName}|${t.repo}|${t.createdAt}`, $t = (t) => t === null || t === "__all__";
857
+ function Et({
853
858
  tasks: t,
854
859
  nowMs: n,
855
860
  selectedRepo: c,
856
- doneShown: o,
861
+ doneShown: r,
857
862
  onLoadMore: s
858
863
  }) {
859
- const a = Ct(c), i = t.filter(
860
- (u) => u.status !== "active" && L(u, c)
864
+ const a = $t(c), i = t.filter(
865
+ (u) => u.status !== "active" && M(u, c)
861
866
  );
862
867
  if (i.length === 0) {
863
868
  const u = a ? "No finished tasks yet." : `No finished tasks in ${c} yet.`;
864
- return /* @__PURE__ */ r("div", { id: "done-list", children: /* @__PURE__ */ r("div", { className: "empty", children: u }) });
869
+ return /* @__PURE__ */ o("div", { id: "done-list", children: /* @__PURE__ */ o("div", { className: "empty", children: u }) });
865
870
  }
866
- const l = i.slice(0, o);
871
+ const l = i.slice(0, r);
867
872
  let h = null;
868
873
  return /* @__PURE__ */ m("div", { id: "done-list", children: [
869
874
  l.map((u) => {
870
- const d = ft(u.endedAt ?? u.createdAt, n), b = d !== h ? d : null;
875
+ const d = bt(u.endedAt ?? u.createdAt, n), b = d !== h ? d : null;
871
876
  h = d;
872
- const f = u.status === "dropped", y = f ? `went offline ${K(u.endedAt ?? u.createdAt, n)} — no done signal` : `finished ${K(u.endedAt ?? u.createdAt, n)}${be(u.createdAt, u.endedAt) ? " · " + be(u.createdAt, u.endedAt) : ""}`;
877
+ const f = u.status === "dropped", k = f ? `went offline ${K(u.endedAt ?? u.createdAt, n)} — no done signal` : `finished ${K(u.endedAt ?? u.createdAt, n)}${be(u.createdAt, u.endedAt) ? " · " + be(u.createdAt, u.endedAt) : ""}`;
873
878
  return /* @__PURE__ */ m(Ge, { children: [
874
- b !== null && /* @__PURE__ */ r("div", { className: "day", children: b }),
879
+ b !== null && /* @__PURE__ */ o("div", { className: "day", children: b }),
875
880
  /* @__PURE__ */ m("div", { className: "task", children: [
876
881
  /* @__PURE__ */ m("div", { className: "task__r1", children: [
877
- /* @__PURE__ */ r("span", { className: "task__who", children: u.agentName }),
878
- a && /* @__PURE__ */ r("span", { className: "task__repo", children: u.repo }),
879
- /* @__PURE__ */ r(
882
+ /* @__PURE__ */ o("span", { className: "task__who", children: u.agentName }),
883
+ a && /* @__PURE__ */ o("span", { className: "task__repo", children: u.repo }),
884
+ /* @__PURE__ */ o(
880
885
  "span",
881
886
  {
882
887
  className: "task__stat" + (f ? " task__stat--drop" : ""),
883
- children: gt(u.status)
888
+ children: ft(u.status)
884
889
  }
885
890
  )
886
891
  ] }),
887
- /* @__PURE__ */ r("div", { className: "task__intent", children: u.intent }),
888
- /* @__PURE__ */ r(je, { globs: u.pathGlobs }),
889
- /* @__PURE__ */ r("div", { className: "task__meta", children: y })
892
+ /* @__PURE__ */ o("div", { className: "task__intent", children: u.intent }),
893
+ /* @__PURE__ */ o(je, { globs: u.pathGlobs }),
894
+ /* @__PURE__ */ o("div", { className: "task__meta", children: k })
890
895
  ] })
891
- ] }, Tt(u));
896
+ ] }, Ct(u));
892
897
  }),
893
- i.length > o && /* @__PURE__ */ r(
898
+ i.length > r && /* @__PURE__ */ o(
894
899
  "div",
895
900
  {
896
901
  className: "more",
@@ -900,25 +905,25 @@ function $t({
900
905
  onKeyDown: (u) => {
901
906
  (u.key === "Enter" || u.key === " ") && (u.preventDefault(), s());
902
907
  },
903
- children: `Load older · ${o} of ${i.length}`
908
+ children: `Load older · ${r} of ${i.length}`
904
909
  }
905
910
  )
906
911
  ] });
907
912
  }
908
- const Et = 80;
909
- function Rt({ announcements: t, selectedRepo: n, nowMs: c }) {
910
- const o = P(null), s = P(!0), a = o.current;
911
- a && (s.current = a.scrollHeight - a.scrollTop - a.clientHeight < Et);
912
- const i = [...t].filter((l) => L(l, n)).reverse();
913
+ const Rt = 80;
914
+ function jt({ announcements: t, selectedRepo: n, nowMs: c }) {
915
+ const r = P(null), s = P(!0), a = r.current;
916
+ a && (s.current = a.scrollHeight - a.scrollTop - a.clientHeight < Rt);
917
+ const i = [...t].filter((l) => M(l, n)).reverse();
913
918
  return Fe(() => {
914
- s.current && o.current && (o.current.scrollTop = o.current.scrollHeight);
915
- }, [i.length]), /* @__PURE__ */ r("div", { id: "chat", className: "chat", ref: o, children: i.length === 0 ? /* @__PURE__ */ r("div", { className: "empty", children: "No announcements yet — agents will post here as they coordinate." }) : i.map((l, h) => {
919
+ s.current && r.current && (r.current.scrollTop = r.current.scrollHeight);
920
+ }, [i.length]), /* @__PURE__ */ o("div", { id: "chat", className: "chat", ref: r, children: i.length === 0 ? /* @__PURE__ */ o("div", { className: "empty", children: "No announcements yet — agents will post here as they coordinate." }) : i.map((l, h) => {
916
921
  const d = "msg" + (l.targetAgentName !== null || l.toAdmin ? " msg--targeted" : "") + (l.fromAdmin ? " msg--me" : "");
917
922
  return (
918
923
  // The feed has no stable id; index is acceptable because the list is
919
924
  // append-only oldest->newest and rows are never reordered in place.
920
925
  /* @__PURE__ */ m("div", { className: d, children: [
921
- /* @__PURE__ */ r(
926
+ /* @__PURE__ */ o(
922
927
  "div",
923
928
  {
924
929
  className: "msg__avatar",
@@ -928,7 +933,7 @@ function Rt({ announcements: t, selectedRepo: n, nowMs: c }) {
928
933
  ),
929
934
  /* @__PURE__ */ m("div", { className: "msg__body", children: [
930
935
  /* @__PURE__ */ m("div", { className: "msg__head", children: [
931
- /* @__PURE__ */ r(
936
+ /* @__PURE__ */ o(
932
937
  "span",
933
938
  {
934
939
  className: "msg__who",
@@ -936,34 +941,34 @@ function Rt({ announcements: t, selectedRepo: n, nowMs: c }) {
936
941
  children: l.fromAgentName
937
942
  }
938
943
  ),
939
- l.fromHuman ? /* @__PURE__ */ r("span", { className: "msg__human", children: l.fromHuman }) : null,
940
- l.targetAgentName !== null ? /* @__PURE__ */ r("span", { className: "msg__to", children: `→ @${l.targetAgentName}` }) : l.toAdmin ? /* @__PURE__ */ r("span", { className: "msg__to", children: "→ admin" }) : null,
941
- /* @__PURE__ */ r("span", { className: "msg__time", children: K(l.createdAt, c) })
944
+ l.fromHuman ? /* @__PURE__ */ o("span", { className: "msg__human", children: l.fromHuman }) : null,
945
+ l.targetAgentName !== null ? /* @__PURE__ */ o("span", { className: "msg__to", children: `→ @${l.targetAgentName}` }) : l.toAdmin ? /* @__PURE__ */ o("span", { className: "msg__to", children: "→ admin" }) : null,
946
+ /* @__PURE__ */ o("span", { className: "msg__time", children: K(l.createdAt, c) })
942
947
  ] }),
943
- /* @__PURE__ */ r("div", { className: "msg__text", children: l.body })
948
+ /* @__PURE__ */ o("div", { className: "msg__text", children: l.body })
944
949
  ] })
945
950
  ] }, h)
946
951
  );
947
952
  }) });
948
953
  }
949
- const jt = 8;
950
- function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
951
- const s = oe(), a = P(null), [i, l] = N(""), [h, u] = N([]), [d, b] = N(0), [f, y] = N(null), [v, A] = N(!1), [$, S] = N(!1), k = pt(
954
+ const Dt = 8;
955
+ function It({ agents: t, selectedRepo: n, workspaceId: c, onSent: r }) {
956
+ const s = oe(), a = P(null), [i, l] = N(""), [h, u] = N([]), [d, b] = N(0), [f, k] = N(null), [v, A] = N(!1), [$, S] = N(!1), y = gt(
952
957
  t.map((p) => ({ name: p.name, presence: p.presence, repo: p.repo ?? "" })),
953
958
  n
954
959
  ), j = h.length > 0, T = R(() => {
955
- u([]), y(null);
960
+ u([]), k(null);
956
961
  }, []), q = R(
957
962
  (p, _) => {
958
- const C = mt(p, _);
963
+ const C = ht(p, _);
959
964
  if (!C) {
960
965
  T();
961
966
  return;
962
967
  }
963
- const D = C.query.toLowerCase(), I = k.filter((B) => B.toLowerCase().startsWith(D)).slice(0, jt);
964
- u(I), y({ start: C.start, end: C.end }), b(0);
968
+ const D = C.query.toLowerCase(), I = y.filter((B) => B.toLowerCase().startsWith(D)).slice(0, Dt);
969
+ u(I), k({ start: C.start, end: C.end }), b(0);
965
970
  },
966
- [k, T]
971
+ [y, T]
967
972
  ), G = R(
968
973
  (p) => {
969
974
  if (!f) return;
@@ -992,21 +997,21 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
992
997
  p.preventDefault();
993
998
  const _ = i.trim();
994
999
  if (!_) return;
995
- const C = ht(_, k), D = n === null || n === "__all__" ? null : n;
1000
+ const C = pt(_, y), D = n === null || n === "__all__" ? null : n;
996
1001
  A(!0), S(!1);
997
1002
  try {
998
1003
  const I = { body: _, targetAgentName: C, repo: D };
999
- await (c !== void 0 ? s.announceTo(c, I) : s.announce(I)), l(""), T(), await o();
1004
+ await (c !== void 0 ? s.announceTo(c, I) : s.announce(I)), l(""), T(), await r();
1000
1005
  } catch {
1001
1006
  S(!0);
1002
1007
  } finally {
1003
1008
  A(!1);
1004
1009
  }
1005
1010
  },
1006
- [i, k, n, c, s, T, o]
1011
+ [i, y, n, c, s, T, r]
1007
1012
  );
1008
1013
  return /* @__PURE__ */ m("div", { className: "composer", children: [
1009
- /* @__PURE__ */ r(
1014
+ /* @__PURE__ */ o(
1010
1015
  "div",
1011
1016
  {
1012
1017
  id: "mention-pop",
@@ -1026,8 +1031,8 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
1026
1031
  C.preventDefault(), G(p);
1027
1032
  },
1028
1033
  children: [
1029
- /* @__PURE__ */ r("div", { className: "ma", style: { background: z(p) }, children: ie(p) }),
1030
- /* @__PURE__ */ r("span", { children: p })
1034
+ /* @__PURE__ */ o("div", { className: "ma", style: { background: z(p) }, children: ie(p) }),
1035
+ /* @__PURE__ */ o("span", { children: p })
1031
1036
  ]
1032
1037
  },
1033
1038
  p
@@ -1043,7 +1048,7 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
1043
1048
  X(p);
1044
1049
  },
1045
1050
  children: [
1046
- /* @__PURE__ */ r(
1051
+ /* @__PURE__ */ o(
1047
1052
  "input",
1048
1053
  {
1049
1054
  id: "chat-input",
@@ -1063,35 +1068,35 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
1063
1068
  onKeyDown: F
1064
1069
  }
1065
1070
  ),
1066
- /* @__PURE__ */ r("button", { id: "chat-send", className: "chat-send", type: "submit", disabled: v, children: "Send" })
1071
+ /* @__PURE__ */ o("button", { id: "chat-send", className: "chat-send", type: "submit", disabled: v, children: "Send" })
1067
1072
  ]
1068
1073
  }
1069
1074
  ),
1070
- $ ? /* @__PURE__ */ r("div", { className: "chat__note", role: "status", children: "send failed — retry" }) : null
1075
+ $ ? /* @__PURE__ */ o("div", { className: "chat__note", role: "status", children: "send failed — retry" }) : null
1071
1076
  ] });
1072
1077
  }
1073
1078
  function Ne({
1074
1079
  title: t = "No workspace yet",
1075
1080
  children: n,
1076
1081
  onGetStarted: c,
1077
- ctaLabel: o = "Go to Config"
1082
+ ctaLabel: r = "Go to Config"
1078
1083
  }) {
1079
1084
  const s = Se();
1080
1085
  return /* @__PURE__ */ m("section", { className: "shepherd-empty-state", "aria-labelledby": s, children: [
1081
- /* @__PURE__ */ r("h2", { id: s, children: t }),
1082
- /* @__PURE__ */ r("p", { children: n ?? "Create a workspace or join one with an invite code to get started." }),
1083
- c && /* @__PURE__ */ r("button", { type: "button", onClick: c, children: o })
1086
+ /* @__PURE__ */ o("h2", { id: s, children: t }),
1087
+ /* @__PURE__ */ o("p", { children: n ?? "Create a workspace or join one with an invite code to get started." }),
1088
+ c && /* @__PURE__ */ o("button", { type: "button", onClick: c, children: r })
1084
1089
  ] });
1085
1090
  }
1086
- const It = [
1091
+ const xt = [
1087
1092
  { id: "bug", label: "Bug" },
1088
1093
  { id: "suggestion", label: "Suggestion" },
1089
1094
  { id: "other", label: "Other" }
1090
- ], xt = 1500;
1095
+ ], Lt = 1500;
1091
1096
  function Mt({ workspaceId: t }) {
1092
- const n = oe(), c = Se(), [o, s] = N(!1), [a, i] = N("bug"), [l, h] = N(""), [u, d] = N(!1), [b, f] = N(null), [y, v] = N(!1);
1097
+ const n = oe(), c = Se(), [r, s] = N(!1), [a, i] = N("bug"), [l, h] = N(""), [u, d] = N(!1), [b, f] = N(null), [k, v] = N(!1);
1093
1098
  function A() {
1094
- s((k) => !k);
1099
+ s((y) => !y);
1095
1100
  }
1096
1101
  function $() {
1097
1102
  i("bug"), h(""), f(null), v(!1);
@@ -1101,53 +1106,53 @@ function Mt({ workspaceId: t }) {
1101
1106
  try {
1102
1107
  await n.submitFeedback({ type: a, body: l.trim() }, t), v(!0), h(""), setTimeout(() => {
1103
1108
  s(!1), $();
1104
- }, xt);
1105
- } catch (k) {
1106
- f(it(k));
1109
+ }, Lt);
1110
+ } catch (y) {
1111
+ f(ct(y));
1107
1112
  } finally {
1108
1113
  d(!1);
1109
1114
  }
1110
1115
  }
1111
1116
  return /* @__PURE__ */ m("div", { className: "shepherd-feedback", children: [
1112
- /* @__PURE__ */ r(
1117
+ /* @__PURE__ */ o(
1113
1118
  "button",
1114
1119
  {
1115
1120
  type: "button",
1116
1121
  className: "shepherd-feedback__trigger",
1117
1122
  onClick: A,
1118
- "aria-expanded": o,
1123
+ "aria-expanded": r,
1119
1124
  children: "Feedback"
1120
1125
  }
1121
1126
  ),
1122
- o && /* @__PURE__ */ m(
1127
+ r && /* @__PURE__ */ m(
1123
1128
  "section",
1124
1129
  {
1125
1130
  className: "shepherd-feedback__panel",
1126
1131
  "aria-labelledby": c,
1127
1132
  children: [
1128
- /* @__PURE__ */ r("h3", { id: c, children: "Give feedback" }),
1129
- y ? /* @__PURE__ */ r("p", { role: "status", children: "Thanks! Your feedback was sent." }) : /* @__PURE__ */ m(W, { children: [
1130
- /* @__PURE__ */ r("div", { className: "shepherd-feedback__types", children: It.map((k) => /* @__PURE__ */ r(
1133
+ /* @__PURE__ */ o("h3", { id: c, children: "Give feedback" }),
1134
+ k ? /* @__PURE__ */ o("p", { role: "status", children: "Thanks! Your feedback was sent." }) : /* @__PURE__ */ m(H, { children: [
1135
+ /* @__PURE__ */ o("div", { className: "shepherd-feedback__types", children: xt.map((y) => /* @__PURE__ */ o(
1131
1136
  "button",
1132
1137
  {
1133
1138
  type: "button",
1134
- "aria-pressed": a === k.id,
1135
- onClick: () => i(k.id),
1136
- children: k.label
1139
+ "aria-pressed": a === y.id,
1140
+ onClick: () => i(y.id),
1141
+ children: y.label
1137
1142
  },
1138
- k.id
1143
+ y.id
1139
1144
  )) }),
1140
- /* @__PURE__ */ r(
1145
+ /* @__PURE__ */ o(
1141
1146
  "textarea",
1142
1147
  {
1143
1148
  "aria-label": "Feedback",
1144
1149
  placeholder: "What's on your mind?",
1145
1150
  value: l,
1146
- onChange: (k) => h(k.target.value)
1151
+ onChange: (y) => h(y.target.value)
1147
1152
  }
1148
1153
  ),
1149
- b && /* @__PURE__ */ r("p", { role: "alert", children: b }),
1150
- /* @__PURE__ */ r(
1154
+ b && /* @__PURE__ */ o("p", { role: "alert", children: b }),
1155
+ /* @__PURE__ */ o(
1151
1156
  "button",
1152
1157
  {
1153
1158
  type: "button",
@@ -1162,7 +1167,7 @@ function Mt({ workspaceId: t }) {
1162
1167
  )
1163
1168
  ] });
1164
1169
  }
1165
- const we = "shepherd.tab", J = "shepherd.repo", Q = 10, Lt = {
1170
+ const we = "shepherd.tab", J = "shepherd.repo", Q = 10, Pt = {
1166
1171
  live: { text: "live", kind: "ok" },
1167
1172
  reconnecting: { text: "reconnecting…", kind: "warn" },
1168
1173
  // app.js cleared the token and re-prompted on 401; in the auth-agnostic port
@@ -1183,10 +1188,10 @@ function ee(t, n) {
1183
1188
  } catch {
1184
1189
  }
1185
1190
  }
1186
- function Pt(t, n, c) {
1187
- const o = Re(n.tasks);
1191
+ function Ot(t, n, c) {
1192
+ const r = Re(n.tasks);
1188
1193
  let s = t;
1189
- if (s === null && o.length >= 2 && (s = fe(n.tasks)), s !== null && s !== "__all__" && !o.includes(s) && (s = "__all__"), c && s !== null && s !== "__all__") {
1194
+ if (s === null && r.length >= 2 && (s = fe(n.tasks)), s !== null && s !== "__all__" && !r.includes(s) && (s = "__all__"), c && s !== null && s !== "__all__") {
1190
1195
  const a = n.tasks.some(
1191
1196
  (l) => l.status === "active" && l.repo === s
1192
1197
  ), i = n.tasks.some((l) => l.status === "active");
@@ -1194,24 +1199,24 @@ function Pt(t, n, c) {
1194
1199
  }
1195
1200
  return s;
1196
1201
  }
1197
- function Ot(t) {
1198
- const n = {}, c = (o, s) => {
1199
- const a = n[o] ?? (n[o] = { active: 0, done: 0 });
1202
+ function Gt(t) {
1203
+ const n = {}, c = (r, s) => {
1204
+ const a = n[r] ?? (n[r] = { active: 0, done: 0 });
1200
1205
  a[s]++;
1201
1206
  };
1202
- for (const o of t.tasks) {
1203
- const s = o.status === "active" ? "active" : "done";
1204
- c(o.repo, s), c("__all__", s);
1207
+ for (const r of t.tasks) {
1208
+ const s = r.status === "active" ? "active" : "done";
1209
+ c(r.repo, s), c("__all__", s);
1205
1210
  }
1206
1211
  return n;
1207
1212
  }
1208
- function Bt({
1213
+ function Kt({
1209
1214
  workspaceId: t,
1210
1215
  config: n,
1211
1216
  switcher: c,
1212
- hasWorkspace: o
1217
+ hasWorkspace: r
1213
1218
  } = {}) {
1214
- const s = n != null, a = o === !1, { snapshot: i, status: l, lastUpdatedMs: h, refresh: u } = ut({
1219
+ const s = n != null, a = r === !1, { snapshot: i, status: l, lastUpdatedMs: h, refresh: u } = mt({
1215
1220
  workspaceId: t,
1216
1221
  // A no-workspace board has nothing to poll; keep it off the hub.
1217
1222
  enabled: !a
@@ -1226,17 +1231,17 @@ function Bt({
1226
1231
  ] : [
1227
1232
  { id: "tasks", label: "Tasks" },
1228
1233
  { id: "chat", label: "Chat" }
1229
- ], y = P([]), v = R(
1230
- (g, M) => {
1234
+ ], k = P([]), v = R(
1235
+ (g, L) => {
1231
1236
  var de;
1232
1237
  const O = f.length - 1;
1233
1238
  let x = null;
1234
1239
  switch (g.key) {
1235
1240
  case "ArrowRight":
1236
- x = M === O ? 0 : M + 1;
1241
+ x = L === O ? 0 : L + 1;
1237
1242
  break;
1238
1243
  case "ArrowLeft":
1239
- x = M === 0 ? O : M - 1;
1244
+ x = L === 0 ? O : L - 1;
1240
1245
  break;
1241
1246
  case "Home":
1242
1247
  x = 0;
@@ -1249,7 +1254,7 @@ function Bt({
1249
1254
  }
1250
1255
  g.preventDefault();
1251
1256
  const le = f[x];
1252
- le && (T(le.id), (de = y.current[x]) == null || de.focus());
1257
+ le && (T(le.id), (de = k.current[x]) == null || de.focus());
1253
1258
  },
1254
1259
  // `tabs` is rebuilt each render but its identity only matters by length,
1255
1260
  // which is stable for a given `hasConfig`; `onTab` is stable.
@@ -1257,31 +1262,31 @@ function Bt({
1257
1262
  [s]
1258
1263
  ), [A, $] = N(
1259
1264
  () => Ae(J)
1260
- ), [S, k] = N(Q), j = P(!0), T = R((g) => {
1265
+ ), [S, y] = N(Q), j = P(!0), T = R((g) => {
1261
1266
  b(g), ee(we, g);
1262
1267
  }, []), q = R((g) => {
1263
- const M = g === null ? "__all__" : g;
1264
- $(M), ee(J, M), k(Q);
1268
+ const L = g === null ? "__all__" : g;
1269
+ $(L), ee(J, L), y(Q);
1265
1270
  }, []), G = R(() => {
1266
- k((g) => g + Q);
1267
- }, []), w = i ? Pt(A, i, j.current) : A;
1271
+ y((g) => g + Q);
1272
+ }, []), w = i ? Ot(A, i, j.current) : A;
1268
1273
  se(() => {
1269
1274
  i && (j.current = !1, w !== A && ($(w), w !== null && w !== "__all__" && ee(J, w)));
1270
1275
  }, [i, w, A]);
1271
- const F = i ? Date.parse(i.serverTime) : Date.now(), X = i ? Re(i.tasks) : [], p = i ? Ot(i) : {}, _ = i ? i.agents.filter(
1272
- (g) => g.presence === "live" && L({ repo: g.repo ?? "" }, w)
1273
- ).length : 0, C = i ? i.tasks.filter((g) => g.status === "active" && L(g, w)).length : 0, D = Lt[l], I = h === null ? "" : `updated ${Math.floor((Date.now() - h) / 1e3)}s ago`, B = (i == null ? void 0 : i.agents) ?? [], U = (i == null ? void 0 : i.tasks) ?? [], De = (i == null ? void 0 : i.announcements) ?? [], Ie = U.filter(
1274
- (g) => g.status === "active" && L(g, w)
1275
- ).length, xe = U.filter(
1276
- (g) => g.status !== "active" && L(g, w)
1276
+ const F = i ? Date.parse(i.serverTime) : Date.now(), X = i ? Re(i.tasks) : [], p = i ? Gt(i) : {}, _ = i ? i.agents.filter(
1277
+ (g) => g.presence === "live" && M({ repo: g.repo ?? "" }, w)
1278
+ ).length : 0, C = i ? i.tasks.filter((g) => g.status === "active" && M(g, w)).length : 0, D = Pt[l], I = h === null ? "" : `updated ${Math.floor((Date.now() - h) / 1e3)}s ago`, B = (i == null ? void 0 : i.agents) ?? [], W = (i == null ? void 0 : i.tasks) ?? [], De = (i == null ? void 0 : i.announcements) ?? [], Ie = W.filter(
1279
+ (g) => g.status === "active" && M(g, w)
1280
+ ).length, xe = W.filter(
1281
+ (g) => g.status !== "active" && M(g, w)
1277
1282
  ).length, ce = !a && d !== "config";
1278
1283
  return /* @__PURE__ */ m("div", { id: "board", children: [
1279
1284
  /* @__PURE__ */ m("header", { children: [
1280
- /* @__PURE__ */ r("h1", { className: "brand", style: { margin: 0, font: "inherit" }, children: "Shepherd" }),
1285
+ /* @__PURE__ */ o("h1", { className: "brand", style: { margin: 0, font: "inherit" }, children: "Shepherd" }),
1281
1286
  c,
1282
- ce && /* @__PURE__ */ m(W, { children: [
1283
- /* @__PURE__ */ r(
1284
- kt,
1287
+ ce && /* @__PURE__ */ m(H, { children: [
1288
+ /* @__PURE__ */ o(
1289
+ _t,
1285
1290
  {
1286
1291
  repos: X,
1287
1292
  counts: p,
@@ -1290,15 +1295,15 @@ function Bt({
1290
1295
  }
1291
1296
  ),
1292
1297
  /* @__PURE__ */ m("span", { className: "vitals", children: [
1293
- /* @__PURE__ */ r("b", { id: "vitals-online", children: _ }),
1298
+ /* @__PURE__ */ o("b", { id: "vitals-online", children: _ }),
1294
1299
  " online · ",
1295
- /* @__PURE__ */ r("b", { id: "vitals-active", children: C }),
1300
+ /* @__PURE__ */ o("b", { id: "vitals-active", children: C }),
1296
1301
  " active"
1297
1302
  ] })
1298
1303
  ] }),
1299
- /* @__PURE__ */ r("span", { className: "grow" }),
1300
- ce && /* @__PURE__ */ m(W, { children: [
1301
- /* @__PURE__ */ r(
1304
+ /* @__PURE__ */ o("span", { className: "grow" }),
1305
+ ce && /* @__PURE__ */ m(H, { children: [
1306
+ /* @__PURE__ */ o(
1302
1307
  "span",
1303
1308
  {
1304
1309
  id: "status",
@@ -1306,13 +1311,13 @@ function Bt({
1306
1311
  children: D.text
1307
1312
  }
1308
1313
  ),
1309
- /* @__PURE__ */ r("span", { id: "freshness", className: "freshness", children: I })
1314
+ /* @__PURE__ */ o("span", { id: "freshness", className: "freshness", children: I })
1310
1315
  ] }),
1311
- /* @__PURE__ */ r("nav", { className: "tabs", role: "tablist", "aria-label": "Shepherd views", children: f.map(({ id: g, label: M }, O) => /* @__PURE__ */ r(
1316
+ /* @__PURE__ */ o("nav", { className: "tabs", role: "tablist", "aria-label": "Shepherd views", children: f.map(({ id: g, label: L }, O) => /* @__PURE__ */ o(
1312
1317
  "button",
1313
1318
  {
1314
1319
  ref: (x) => {
1315
- y.current[O] = x;
1320
+ k.current[O] = x;
1316
1321
  },
1317
1322
  className: "tab" + (d === g ? " tab--active" : ""),
1318
1323
  "data-tab": g,
@@ -1324,38 +1329,38 @@ function Bt({
1324
1329
  tabIndex: d === g ? 0 : -1,
1325
1330
  onClick: () => T(g),
1326
1331
  onKeyDown: (x) => v(x, O),
1327
- children: M
1332
+ children: L
1328
1333
  },
1329
1334
  g
1330
1335
  )) })
1331
1336
  ] }),
1332
- /* @__PURE__ */ r(
1337
+ /* @__PURE__ */ o(
1333
1338
  "section",
1334
1339
  {
1335
1340
  id: "panel-tasks",
1336
1341
  role: "tabpanel",
1337
1342
  "aria-labelledby": "tab-tasks",
1338
1343
  hidden: d !== "tasks",
1339
- children: a ? /* @__PURE__ */ r(Ne, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m(W, { children: [
1340
- /* @__PURE__ */ r(_t, { agents: B, tasks: U, selectedRepo: w }),
1344
+ children: a ? /* @__PURE__ */ o(Ne, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m(H, { children: [
1345
+ /* @__PURE__ */ o(Nt, { agents: B, tasks: W, selectedRepo: w }),
1341
1346
  /* @__PURE__ */ m("div", { className: "board", children: [
1342
1347
  /* @__PURE__ */ m("div", { className: "col", children: [
1343
1348
  /* @__PURE__ */ m("div", { className: "colhead", children: [
1344
- /* @__PURE__ */ r("h2", { children: "Active" }),
1345
- /* @__PURE__ */ r("span", { className: "n", id: "active-count", children: Ie })
1349
+ /* @__PURE__ */ o("h2", { children: "Active" }),
1350
+ /* @__PURE__ */ o("span", { className: "n", id: "active-count", children: Ie })
1346
1351
  ] }),
1347
- /* @__PURE__ */ r(St, { tasks: U, nowMs: F, selectedRepo: w })
1352
+ /* @__PURE__ */ o(Tt, { tasks: W, nowMs: F, selectedRepo: w })
1348
1353
  ] }),
1349
- /* @__PURE__ */ r("div", { className: "board__rule" }),
1354
+ /* @__PURE__ */ o("div", { className: "board__rule" }),
1350
1355
  /* @__PURE__ */ m("div", { className: "col", children: [
1351
1356
  /* @__PURE__ */ m("div", { className: "colhead", children: [
1352
- /* @__PURE__ */ r("h2", { children: "Done" }),
1353
- /* @__PURE__ */ r("span", { className: "n", id: "done-count", children: xe })
1357
+ /* @__PURE__ */ o("h2", { children: "Done" }),
1358
+ /* @__PURE__ */ o("span", { className: "n", id: "done-count", children: xe })
1354
1359
  ] }),
1355
- /* @__PURE__ */ r(
1356
- $t,
1360
+ /* @__PURE__ */ o(
1361
+ Et,
1357
1362
  {
1358
- tasks: U,
1363
+ tasks: W,
1359
1364
  nowMs: F,
1360
1365
  selectedRepo: w,
1361
1366
  doneShown: S,
@@ -1367,17 +1372,17 @@ function Bt({
1367
1372
  ] })
1368
1373
  }
1369
1374
  ),
1370
- /* @__PURE__ */ r(
1375
+ /* @__PURE__ */ o(
1371
1376
  "section",
1372
1377
  {
1373
1378
  id: "panel-chat",
1374
1379
  role: "tabpanel",
1375
1380
  "aria-labelledby": "tab-chat",
1376
1381
  hidden: d !== "chat",
1377
- children: a ? /* @__PURE__ */ r(Ne, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m("div", { className: "chat-wrap", children: [
1378
- /* @__PURE__ */ r(Rt, { announcements: De, selectedRepo: w, nowMs: F }),
1379
- /* @__PURE__ */ r(
1380
- Dt,
1382
+ children: a ? /* @__PURE__ */ o(Ne, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m("div", { className: "chat-wrap", children: [
1383
+ /* @__PURE__ */ o(jt, { announcements: De, selectedRepo: w, nowMs: F }),
1384
+ /* @__PURE__ */ o(
1385
+ It,
1381
1386
  {
1382
1387
  agents: B,
1383
1388
  selectedRepo: w,
@@ -1388,7 +1393,7 @@ function Bt({
1388
1393
  ] })
1389
1394
  }
1390
1395
  ),
1391
- s && /* @__PURE__ */ r(
1396
+ s && /* @__PURE__ */ o(
1392
1397
  "section",
1393
1398
  {
1394
1399
  id: "panel-config",
@@ -1398,16 +1403,16 @@ function Bt({
1398
1403
  children: n
1399
1404
  }
1400
1405
  ),
1401
- /* @__PURE__ */ r(Mt, { workspaceId: t })
1406
+ /* @__PURE__ */ o(Mt, { workspaceId: t })
1402
1407
  ] });
1403
1408
  }
1404
1409
  export {
1405
- Bt as D,
1410
+ Kt as D,
1406
1411
  Ne as E,
1407
- H as S,
1408
- qt as a,
1409
- Wt as c,
1410
- it as d,
1412
+ U as S,
1413
+ Bt as a,
1414
+ qt as c,
1415
+ ct as d,
1411
1416
  K as f,
1412
1417
  oe as u
1413
1418
  };