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