@korso/shepherd-ui 0.4.0 → 0.5.1

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 Ie = Object.defineProperty;
2
- var xe = (t, n, c) => n in t ? Ie(t, n, { enumerable: !0, configurable: !0, writable: !0, value: c }) : t[n] = c;
3
- var ue = (t, n, c) => xe(t, typeof n != "symbol" ? n + "" : n, c);
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
4
  import { jsx as r, jsxs as m, Fragment as W } from "react/jsx-runtime";
5
- import { createContext as Me, useContext as Le, useState as N, useRef as P, useCallback as E, useEffect as se, Fragment as Pe, useLayoutEffect as Oe, useId as we } from "react";
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 R = e.string(), Y = e.number(), Ge = e.object({
7
+ const E = e.string(), Y = e.number(), Ue = e.object({
8
8
  agentName: e.string(),
9
9
  human: e.string(),
10
10
  branch: e.string(),
@@ -13,9 +13,9 @@ const R = e.string(), Y = e.number(), Ge = e.object({
13
13
  message: e.string().nullable(),
14
14
  paths: e.array(e.string()).min(1),
15
15
  authorIsLive: e.boolean(),
16
- authorLastActiveAt: R,
17
- updatedAt: R
18
- }), Fe = e.object({
16
+ authorLastActiveAt: E,
17
+ updatedAt: E
18
+ }), He = 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 R = e.string(), Y = e.number(), Ge = 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(Fe).max(600)
39
+ entries: e.array(He).max(600)
40
40
  }), Z = e.object({
41
41
  workItemId: e.string().uuid(),
42
42
  agentName: e.string(),
@@ -44,7 +44,7 @@ const R = e.string(), Y = e.number(), Ge = e.object({
44
44
  intent: e.string().min(1).max(2048),
45
45
  pathGlobs: e.array(e.string().min(1).max(512)).min(1).max(64),
46
46
  // ISO timestamp string; see IsoTimestamp note above
47
- expiresAt: R
47
+ expiresAt: E
48
48
  }), V = e.object({
49
49
  // bigint PK serialised as number; see DbId note above
50
50
  id: Y,
@@ -53,8 +53,8 @@ const R = e.string(), Y = e.number(), Ge = e.object({
53
53
  body: e.string().min(1).max(8192),
54
54
  targetAgentName: e.string().nullable(),
55
55
  // ISO timestamp string; see IsoTimestamp note above
56
- createdAt: R
57
- }), Ae = e.object({
56
+ createdAt: E
57
+ }), Te = e.object({
58
58
  conflicts: e.array(Z),
59
59
  activeClaims: e.array(Z),
60
60
  // The caller's OWN active claims. `activeClaims` deliberately excludes the
@@ -64,8 +64,8 @@ const R = e.string(), Y = e.number(), Ge = 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(Ge).default([])
68
- }), Ue = e.object({
67
+ changeRecords: e.array(Ue).default([])
68
+ }), We = e.object({
69
69
  name: e.string(),
70
70
  human: e.string(),
71
71
  program: e.string(),
@@ -75,19 +75,19 @@ const R = e.string(), Y = e.number(), Ge = e.object({
75
75
  // are null when the agent has no session yet.
76
76
  repo: e.string().nullable(),
77
77
  branch: e.string().nullable(),
78
- lastHeartbeatAt: R.nullable(),
78
+ lastHeartbeatAt: E.nullable(),
79
79
  presence: e.enum(["live", "offline"])
80
- }), He = e.enum(["active", "done", "dropped"]), We = e.object({
80
+ }), qe = e.enum(["active", "done", "dropped"]), Be = e.object({
81
81
  agentName: e.string(),
82
82
  program: e.string(),
83
83
  model: e.string().nullable(),
84
84
  repo: e.string(),
85
85
  intent: e.string(),
86
86
  pathGlobs: e.array(e.string()),
87
- status: He,
88
- createdAt: R,
89
- endedAt: R.nullable()
90
- }), qe = e.object({
87
+ status: qe,
88
+ createdAt: E,
89
+ endedAt: E.nullable()
90
+ }), Ke = e.object({
91
91
  fromAgentName: e.string(),
92
92
  fromHuman: e.string(),
93
93
  body: e.string(),
@@ -101,14 +101,14 @@ const R = e.string(), Y = e.number(), Ge = e.object({
101
101
  // fromAdmin). The dashboard renders these as "<agent> → admin". Not delivered
102
102
  // to other agents. Defaulted for version-skew safety with older hubs.
103
103
  toAdmin: e.boolean().default(!1),
104
- createdAt: R
104
+ createdAt: E
105
105
  }), me = e.object({
106
- agents: e.array(Ue),
107
- tasks: e.array(We),
108
- announcements: e.array(qe),
106
+ agents: e.array(We),
107
+ tasks: e.array(Be),
108
+ announcements: e.array(Ke),
109
109
  // The server's clock, so the client computes "expires in / last seen" against
110
110
  // the hub rather than the (possibly skewed) browser clock.
111
- serverTime: R
111
+ serverTime: E
112
112
  });
113
113
  e.object({
114
114
  body: e.string().min(1).max(8192),
@@ -138,7 +138,7 @@ e.object({
138
138
  agentName: e.string(),
139
139
  sessionId: e.string().uuid()
140
140
  });
141
- const Be = e.object({
141
+ const ze = e.object({
142
142
  sessionId: e.string().uuid(),
143
143
  intent: e.string().min(1).max(2048),
144
144
  pathGlobs: e.array(e.string().min(1).max(512)).min(1).max(64),
@@ -147,9 +147,9 @@ const Be = e.object({
147
147
  });
148
148
  e.object({
149
149
  workItemId: e.string().uuid(),
150
- landscape: Ae
150
+ landscape: Te
151
151
  });
152
- const Ke = e.object({
152
+ const Ye = e.object({
153
153
  sessionId: e.string().uuid(),
154
154
  workItemId: e.string().uuid()
155
155
  });
@@ -160,7 +160,7 @@ e.object({
160
160
  // their next work/sync). Defaulted for version-skew safety with older hubs.
161
161
  announcements: e.array(V).default([])
162
162
  });
163
- const ze = e.object({
163
+ const Ve = e.object({
164
164
  sessionId: e.string().uuid(),
165
165
  body: e.string().min(1).max(8192),
166
166
  // absent or null => broadcast to all agents in the workspace
@@ -186,11 +186,11 @@ e.object({
186
186
  changeReport: ae.optional()
187
187
  });
188
188
  e.object({
189
- landscape: Ae
189
+ landscape: Te
190
190
  });
191
- Be.omit({ sessionId: !0, changeReport: !0 });
192
- ze.omit({ sessionId: !0 });
193
- Ke.omit({ sessionId: !0 });
191
+ ze.omit({ sessionId: !0, changeReport: !0 });
192
+ Ve.omit({ sessionId: !0 });
193
+ Ye.omit({ sessionId: !0 });
194
194
  e.object({});
195
195
  e.object({});
196
196
  e.object({
@@ -230,34 +230,34 @@ e.object({
230
230
  e.object({
231
231
  ok: e.literal(!0)
232
232
  });
233
- const Se = e.enum(["admin", "member"]), re = e.object({
233
+ const Ce = e.enum(["admin", "member"]), re = e.object({
234
234
  id: e.string(),
235
235
  slug: e.string(),
236
236
  name: e.string(),
237
- role: Se
237
+ role: Ce
238
238
  });
239
239
  e.object({
240
240
  name: e.string().min(1)
241
241
  });
242
- const Ye = re, Ve = e.object({
242
+ const Xe = re, Ze = e.object({
243
243
  workspaces: e.array(re)
244
244
  });
245
245
  e.object({
246
246
  name: e.string().min(1).optional()
247
247
  });
248
- const Xe = e.object({
248
+ const pe = e.object({
249
249
  // The raw shp_ token, shown once at creation and never returned again.
250
250
  token: e.string(),
251
251
  id: e.string()
252
- }), Ze = e.object({
252
+ }), Je = e.object({
253
253
  id: e.string(),
254
254
  name: e.string().nullable(),
255
255
  // ISO timestamp string (see IsoTimestamp note above) or null when unused / not revoked.
256
- lastUsedAt: R.nullable(),
257
- createdAt: R,
258
- revokedAt: R.nullable()
259
- }), Je = e.object({
260
- tokens: e.array(Ze)
256
+ lastUsedAt: E.nullable(),
257
+ createdAt: E,
258
+ revokedAt: E.nullable()
259
+ }), ge = e.object({
260
+ tokens: e.array(Je)
261
261
  });
262
262
  e.object({
263
263
  expiresInDays: e.number().int().positive().optional(),
@@ -268,7 +268,7 @@ e.object({
268
268
  const Qe = e.object({
269
269
  code: e.string(),
270
270
  // ISO timestamp string, or null when the invite never expires.
271
- expiresAt: R.nullable(),
271
+ expiresAt: E.nullable(),
272
272
  // null = unlimited (redeemable until revoked).
273
273
  maxUses: e.number().int().positive().nullable(),
274
274
  useCount: e.number().int().nonnegative()
@@ -278,7 +278,7 @@ e.object({
278
278
  });
279
279
  const et = e.object({
280
280
  email: e.string(),
281
- sentAt: R
281
+ sentAt: E
282
282
  }), tt = e.object({
283
283
  // The workspace the caller just joined.
284
284
  workspace: re
@@ -286,8 +286,9 @@ const et = e.object({
286
286
  accountId: e.string(),
287
287
  displayName: e.string().nullable(),
288
288
  githubLogin: e.string().nullable(),
289
+ email: e.string().nullable(),
289
290
  avatarUrl: e.string().nullable(),
290
- role: Se
291
+ role: Ce
291
292
  }), st = e.object({
292
293
  members: e.array(nt)
293
294
  }), at = e.enum(["bug", "suggestion", "other"]);
@@ -372,24 +373,24 @@ function Wt(t) {
372
373
  // --- multi-workspace management surface ---------------------------------
373
374
  listWorkspaces() {
374
375
  return s("GET", "/workspaces", {
375
- schema: Ve
376
+ schema: Ze
376
377
  });
377
378
  },
378
379
  createWorkspace(a) {
379
380
  return s("POST", "/workspaces", {
380
381
  body: a,
381
- schema: Ye
382
+ schema: Xe
382
383
  });
383
384
  },
384
385
  mintToken(a, i) {
385
386
  return s("POST", `/workspaces/${o(a)}/tokens`, {
386
387
  body: i,
387
- schema: Xe
388
+ schema: pe
388
389
  });
389
390
  },
390
391
  listTokens(a) {
391
392
  return s("GET", `/workspaces/${o(a)}/tokens`, {
392
- schema: Je
393
+ schema: ge
393
394
  });
394
395
  },
395
396
  revokeToken(a, i) {
@@ -398,6 +399,20 @@ function Wt(t) {
398
399
  `/workspaces/${o(a)}/tokens/${o(i)}`
399
400
  );
400
401
  },
402
+ mintAccountToken(a) {
403
+ return s("POST", "/tokens", {
404
+ body: a,
405
+ schema: pe
406
+ });
407
+ },
408
+ listAccountTokens() {
409
+ return s("GET", "/tokens", {
410
+ schema: ge
411
+ });
412
+ },
413
+ revokeAccountToken(a) {
414
+ return s("DELETE", `/tokens/${o(a)}`);
415
+ },
401
416
  createInvite(a, i) {
402
417
  return s("POST", `/workspaces/${o(a)}/invites`, {
403
418
  body: i,
@@ -464,15 +479,15 @@ function Wt(t) {
464
479
  }
465
480
  };
466
481
  }
467
- const Te = Me(null);
482
+ const $e = Pe(null);
468
483
  function qt({
469
484
  client: t,
470
485
  children: n
471
486
  }) {
472
- return /* @__PURE__ */ r(Te.Provider, { value: t, children: n });
487
+ return /* @__PURE__ */ r($e.Provider, { value: t, children: n });
473
488
  }
474
489
  function oe() {
475
- const t = Le(Te);
490
+ const t = Oe($e);
476
491
  if (t === null)
477
492
  throw new Error(
478
493
  "useShepherdClient must be used within <ShepherdClientProvider>"
@@ -485,7 +500,7 @@ function ut(t) {
485
500
  null
486
501
  ), [l, h] = N("live"), [u, d] = N(null), [, b] = N(0), f = P(n);
487
502
  f.current = n;
488
- const y = P(0), v = E(
503
+ const y = P(0), v = R(
489
504
  async ($) => {
490
505
  try {
491
506
  const S = c ? await f.current.landscape(c) : await f.current.getLandscape();
@@ -513,7 +528,7 @@ function ut(t) {
513
528
  y.current++, clearInterval(S), clearInterval(k), document.removeEventListener("visibilitychange", j);
514
529
  };
515
530
  }, [v, o, s]);
516
- const A = E(() => v(y.current), [v]);
531
+ const A = R(() => v(y.current), [v]);
517
532
  return { snapshot: a, status: l, lastUpdatedMs: u, refresh: A };
518
533
  }
519
534
  function K(t, n) {
@@ -535,15 +550,15 @@ function ie(t) {
535
550
  const n = t.match(/[A-Z]/g);
536
551
  return n && n.length >= 2 ? n[0] + n[1] : t.slice(0, 2).toUpperCase();
537
552
  }
538
- const Ce = "A-Za-z0-9_-";
553
+ const Ee = "A-Za-z0-9_-";
539
554
  function mt(t, n) {
540
- const o = t.slice(0, n).match(new RegExp(`(?:^|\\s)@([${Ce}]*)$`));
555
+ const o = t.slice(0, n).match(new RegExp(`(?:^|\\s)@([${Ee}]*)$`));
541
556
  if (!o) return null;
542
557
  const s = o[1];
543
558
  return { start: n - s.length - 1, end: n, query: s };
544
559
  }
545
560
  function ht(t, n) {
546
- const c = new RegExp(`(?:^|\\s)@([${Ce}]+)`, "g");
561
+ const c = new RegExp(`(?:^|\\s)@([${Ee}]+)`, "g");
547
562
  let o;
548
563
  for (; (o = c.exec(t)) !== null; ) {
549
564
  const s = o[1].toLowerCase(), a = n.find((i) => i.toLowerCase() === s);
@@ -551,7 +566,7 @@ function ht(t, n) {
551
566
  }
552
567
  return null;
553
568
  }
554
- function $e(t) {
569
+ function Re(t) {
555
570
  return [...new Set(t.map((n) => n.repo))].sort();
556
571
  }
557
572
  function L(t, n) {
@@ -564,14 +579,14 @@ function pt(t, n) {
564
579
  )
565
580
  ].sort();
566
581
  }
567
- function pe(t) {
582
+ function fe(t) {
568
583
  const n = t.find((c) => c.status === "active");
569
584
  return n ? n.repo : t.length ? t[0].repo : null;
570
585
  }
571
586
  function gt(t) {
572
587
  return t === "dropped" ? "dropped" : "done";
573
588
  }
574
- function ge(t, n) {
589
+ function be(t, n) {
575
590
  if (!n) return "";
576
591
  const c = Math.floor((Date.parse(n) - Date.parse(t)) / 1e3), o = Math.floor(c / 60);
577
592
  return o < 60 ? `active ${o}m` : `active ${Math.floor(o / 60)}h`;
@@ -580,7 +595,7 @@ function ft(t, n) {
580
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);
581
596
  return a <= 0 ? "Today" : a === 1 ? "Yesterday" : c.toLocaleDateString(void 0, { month: "short", day: "numeric" });
582
597
  }
583
- function fe(t) {
598
+ function ve(t) {
584
599
  let n = t.toLowerCase().replace(/\\/g, "/");
585
600
  n.endsWith("/") && (n = n.replace(/\/+$/, "") + "/**");
586
601
  const c = [];
@@ -594,9 +609,9 @@ function fe(t) {
594
609
  }
595
610
  return c;
596
611
  }
597
- const be = /[*?{}[\]]/;
612
+ const ye = /[*?{}[\]]/;
598
613
  function bt(t, n) {
599
- return t === "*" ? !0 : (be.test(t) || !be.test(n)) && t === n;
614
+ return t === "*" ? !0 : (ye.test(t) || !ye.test(n)) && t === n;
600
615
  }
601
616
  function vt(t, n) {
602
617
  const c = /* @__PURE__ */ new Map();
@@ -614,11 +629,11 @@ function vt(t, n) {
614
629
  }
615
630
  return o(0, 0);
616
631
  }
617
- function ve(t, n) {
632
+ function ke(t, n) {
618
633
  if (n.length === 0) return !0;
619
- const c = t.map(fe);
634
+ const c = t.map(ve);
620
635
  return n.every((o) => {
621
- const s = fe(o);
636
+ const s = ve(o);
622
637
  return c.some((a) => vt(a, s));
623
638
  });
624
639
  }
@@ -630,7 +645,7 @@ function yt(t) {
630
645
  for (const [s, a] of n) {
631
646
  const i = [...a].sort(c), l = i.map(
632
647
  (u) => i.some(
633
- (d) => d !== u && ve(d.pathGlobs, u.pathGlobs) && !ve(u.pathGlobs, d.pathGlobs)
648
+ (d) => d !== u && ke(d.pathGlobs, u.pathGlobs) && !ke(u.pathGlobs, d.pathGlobs)
634
649
  )
635
650
  ), h = i[0];
636
651
  o.push({
@@ -647,7 +662,7 @@ function yt(t) {
647
662
  return a.primaries.concat(a.narrower)[0].createdAt.localeCompare(i);
648
663
  }), o;
649
664
  }
650
- const ye = { active: 0, done: 0 };
665
+ const _e = { active: 0, done: 0 };
651
666
  function kt({
652
667
  repos: t,
653
668
  counts: n,
@@ -664,7 +679,7 @@ function kt({
664
679
  b == null || b.focus();
665
680
  }, [s]), t.length < 2) return null;
666
681
  const l = c === null || c === "__all__", h = l ? "All repos" : c, u = (d, b) => {
667
- const f = d === null ? n.__all__ ?? ye : n[d] ?? ye, y = d === null ? l : c === d, v = "repo-mi" + (y ? " on" : "") + (d === null ? " all" : "");
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" : "");
668
683
  return /* @__PURE__ */ m(
669
684
  "button",
670
685
  {
@@ -739,7 +754,7 @@ function _t({ agents: t, tasks: n, selectedRepo: c }) {
739
754
  l.name
740
755
  )) });
741
756
  }
742
- function Re({ globs: t }) {
757
+ function je({ globs: t }) {
743
758
  return t.length <= 1 ? /* @__PURE__ */ m("div", { className: "terr", children: [
744
759
  /* @__PURE__ */ r("span", { className: "terr__lbl", children: "territory" }),
745
760
  t.map((n) => /* @__PURE__ */ r("span", { className: "glob", children: n }, n))
@@ -761,7 +776,7 @@ function ne({
761
776
  }) {
762
777
  return /* @__PURE__ */ m(W, { children: [
763
778
  /* @__PURE__ */ r("div", { className: "task__intent", children: t.intent }),
764
- /* @__PURE__ */ r(Re, { globs: t.pathGlobs }),
779
+ /* @__PURE__ */ r(je, { globs: t.pathGlobs }),
765
780
  /* @__PURE__ */ r("div", { className: "task__meta", children: `started ${K(t.createdAt, n)}` })
766
781
  ] });
767
782
  }
@@ -854,8 +869,8 @@ function $t({
854
869
  l.map((u) => {
855
870
  const d = ft(u.endedAt ?? u.createdAt, n), b = d !== h ? d : null;
856
871
  h = d;
857
- 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)}${ge(u.createdAt, u.endedAt) ? " · " + ge(u.createdAt, u.endedAt) : ""}`;
858
- return /* @__PURE__ */ m(Pe, { children: [
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) : ""}`;
873
+ return /* @__PURE__ */ m(Ge, { children: [
859
874
  b !== null && /* @__PURE__ */ r("div", { className: "day", children: b }),
860
875
  /* @__PURE__ */ m("div", { className: "task", children: [
861
876
  /* @__PURE__ */ m("div", { className: "task__r1", children: [
@@ -870,7 +885,7 @@ function $t({
870
885
  )
871
886
  ] }),
872
887
  /* @__PURE__ */ r("div", { className: "task__intent", children: u.intent }),
873
- /* @__PURE__ */ r(Re, { globs: u.pathGlobs }),
888
+ /* @__PURE__ */ r(je, { globs: u.pathGlobs }),
874
889
  /* @__PURE__ */ r("div", { className: "task__meta", children: y })
875
890
  ] })
876
891
  ] }, Tt(u));
@@ -890,12 +905,12 @@ function $t({
890
905
  )
891
906
  ] });
892
907
  }
893
- const Rt = 80;
894
- function Et({ announcements: t, selectedRepo: n, nowMs: c }) {
908
+ const Et = 80;
909
+ function Rt({ announcements: t, selectedRepo: n, nowMs: c }) {
895
910
  const o = P(null), s = P(!0), a = o.current;
896
- a && (s.current = a.scrollHeight - a.scrollTop - a.clientHeight < Rt);
911
+ a && (s.current = a.scrollHeight - a.scrollTop - a.clientHeight < Et);
897
912
  const i = [...t].filter((l) => L(l, n)).reverse();
898
- return Oe(() => {
913
+ return Fe(() => {
899
914
  s.current && o.current && (o.current.scrollTop = o.current.scrollHeight);
900
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) => {
901
916
  const d = "msg" + (l.targetAgentName !== null || l.toAdmin ? " msg--targeted" : "") + (l.fromAdmin ? " msg--me" : "");
@@ -936,9 +951,9 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
936
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(
937
952
  t.map((p) => ({ name: p.name, presence: p.presence, repo: p.repo ?? "" })),
938
953
  n
939
- ), j = h.length > 0, T = E(() => {
954
+ ), j = h.length > 0, T = R(() => {
940
955
  u([]), y(null);
941
- }, []), q = E(
956
+ }, []), q = R(
942
957
  (p, _) => {
943
958
  const C = mt(p, _);
944
959
  if (!C) {
@@ -949,7 +964,7 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
949
964
  u(I), y({ start: C.start, end: C.end }), b(0);
950
965
  },
951
966
  [k, T]
952
- ), G = E(
967
+ ), G = R(
953
968
  (p) => {
954
969
  if (!f) return;
955
970
  const _ = "@" + p + " ", C = i.slice(0, f.start) + _ + i.slice(f.end), D = f.start + _.length;
@@ -959,7 +974,7 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
959
974
  });
960
975
  },
961
976
  [f, i, T]
962
- ), w = E(
977
+ ), w = R(
963
978
  (p) => {
964
979
  var C;
965
980
  l(p);
@@ -967,12 +982,12 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
967
982
  q(p, _);
968
983
  },
969
984
  [q]
970
- ), F = E(
985
+ ), F = R(
971
986
  (p) => {
972
987
  j && (p.key === "ArrowDown" ? (p.preventDefault(), b((_) => (_ + 1) % h.length)) : p.key === "ArrowUp" ? (p.preventDefault(), b((_) => (_ - 1 + h.length) % h.length)) : p.key === "Enter" || p.key === "Tab" ? (p.preventDefault(), G(h[d])) : p.key === "Escape" && (p.preventDefault(), T()));
973
988
  },
974
989
  [j, h, d, G, T]
975
- ), X = E(
990
+ ), X = R(
976
991
  async (p) => {
977
992
  p.preventDefault();
978
993
  const _ = i.trim();
@@ -1055,13 +1070,13 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
1055
1070
  $ ? /* @__PURE__ */ r("div", { className: "chat__note", role: "status", children: "send failed — retry" }) : null
1056
1071
  ] });
1057
1072
  }
1058
- function ke({
1073
+ function Ne({
1059
1074
  title: t = "No workspace yet",
1060
1075
  children: n,
1061
1076
  onGetStarted: c,
1062
1077
  ctaLabel: o = "Go to Config"
1063
1078
  }) {
1064
- const s = we();
1079
+ const s = Se();
1065
1080
  return /* @__PURE__ */ m("section", { className: "shepherd-empty-state", "aria-labelledby": s, children: [
1066
1081
  /* @__PURE__ */ r("h2", { id: s, children: t }),
1067
1082
  /* @__PURE__ */ r("p", { children: n ?? "Create a workspace or join one with an invite code to get started." }),
@@ -1074,7 +1089,7 @@ const It = [
1074
1089
  { id: "other", label: "Other" }
1075
1090
  ], xt = 1500;
1076
1091
  function Mt({ workspaceId: t }) {
1077
- const n = oe(), c = we(), [o, s] = N(!1), [a, i] = N("bug"), [l, h] = N(""), [u, d] = N(!1), [b, f] = N(null), [y, v] = N(!1);
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);
1078
1093
  function A() {
1079
1094
  s((k) => !k);
1080
1095
  }
@@ -1147,7 +1162,7 @@ function Mt({ workspaceId: t }) {
1147
1162
  )
1148
1163
  ] });
1149
1164
  }
1150
- const _e = "shepherd.tab", J = "shepherd.repo", Q = 10, Lt = {
1165
+ const we = "shepherd.tab", J = "shepherd.repo", Q = 10, Lt = {
1151
1166
  live: { text: "live", kind: "ok" },
1152
1167
  reconnecting: { text: "reconnecting…", kind: "warn" },
1153
1168
  // app.js cleared the token and re-prompted on 401; in the auth-agnostic port
@@ -1155,7 +1170,7 @@ const _e = "shepherd.tab", J = "shepherd.repo", Q = 10, Lt = {
1155
1170
  // only surfaces the rejected state.
1156
1171
  unauthorized: { text: "token rejected", kind: "error" }
1157
1172
  };
1158
- function Ne(t) {
1173
+ function Ae(t) {
1159
1174
  try {
1160
1175
  return localStorage.getItem(t);
1161
1176
  } catch {
@@ -1169,13 +1184,13 @@ function ee(t, n) {
1169
1184
  }
1170
1185
  }
1171
1186
  function Pt(t, n, c) {
1172
- const o = $e(n.tasks);
1187
+ const o = Re(n.tasks);
1173
1188
  let s = t;
1174
- if (s === null && o.length >= 2 && (s = pe(n.tasks)), s !== null && s !== "__all__" && !o.includes(s) && (s = "__all__"), c && s !== null && s !== "__all__") {
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__") {
1175
1190
  const a = n.tasks.some(
1176
1191
  (l) => l.status === "active" && l.repo === s
1177
1192
  ), i = n.tasks.some((l) => l.status === "active");
1178
- !a && i && (s = pe(n.tasks));
1193
+ !a && i && (s = fe(n.tasks));
1179
1194
  }
1180
1195
  return s;
1181
1196
  }
@@ -1202,7 +1217,7 @@ function Bt({
1202
1217
  enabled: !a
1203
1218
  }), [d, b] = N(() => {
1204
1219
  if (s && a) return "config";
1205
- const g = Ne(_e);
1220
+ const g = Ae(we);
1206
1221
  return g === "chat" ? "chat" : g === "config" && s ? "config" : "tasks";
1207
1222
  }), f = s ? [
1208
1223
  { id: "tasks", label: "Tasks" },
@@ -1211,7 +1226,7 @@ function Bt({
1211
1226
  ] : [
1212
1227
  { id: "tasks", label: "Tasks" },
1213
1228
  { id: "chat", label: "Chat" }
1214
- ], y = P([]), v = E(
1229
+ ], y = P([]), v = R(
1215
1230
  (g, M) => {
1216
1231
  var de;
1217
1232
  const O = f.length - 1;
@@ -1241,23 +1256,23 @@ function Bt({
1241
1256
  // eslint-disable-next-line react-hooks/exhaustive-deps
1242
1257
  [s]
1243
1258
  ), [A, $] = N(
1244
- () => Ne(J)
1245
- ), [S, k] = N(Q), j = P(!0), T = E((g) => {
1246
- b(g), ee(_e, g);
1247
- }, []), q = E((g) => {
1259
+ () => Ae(J)
1260
+ ), [S, k] = N(Q), j = P(!0), T = R((g) => {
1261
+ b(g), ee(we, g);
1262
+ }, []), q = R((g) => {
1248
1263
  const M = g === null ? "__all__" : g;
1249
1264
  $(M), ee(J, M), k(Q);
1250
- }, []), G = E(() => {
1265
+ }, []), G = R(() => {
1251
1266
  k((g) => g + Q);
1252
1267
  }, []), w = i ? Pt(A, i, j.current) : A;
1253
1268
  se(() => {
1254
1269
  i && (j.current = !1, w !== A && ($(w), w !== null && w !== "__all__" && ee(J, w)));
1255
1270
  }, [i, w, A]);
1256
- const F = i ? Date.parse(i.serverTime) : Date.now(), X = i ? $e(i.tasks) : [], p = i ? Ot(i) : {}, _ = i ? i.agents.filter(
1271
+ const F = i ? Date.parse(i.serverTime) : Date.now(), X = i ? Re(i.tasks) : [], p = i ? Ot(i) : {}, _ = i ? i.agents.filter(
1257
1272
  (g) => g.presence === "live" && L({ repo: g.repo ?? "" }, w)
1258
- ).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) ?? [], Ee = (i == null ? void 0 : i.announcements) ?? [], je = U.filter(
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(
1259
1274
  (g) => g.status === "active" && L(g, w)
1260
- ).length, De = U.filter(
1275
+ ).length, xe = U.filter(
1261
1276
  (g) => g.status !== "active" && L(g, w)
1262
1277
  ).length, ce = !a && d !== "config";
1263
1278
  return /* @__PURE__ */ m("div", { id: "board", children: [
@@ -1321,13 +1336,13 @@ function Bt({
1321
1336
  role: "tabpanel",
1322
1337
  "aria-labelledby": "tab-tasks",
1323
1338
  hidden: d !== "tasks",
1324
- children: a ? /* @__PURE__ */ r(ke, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m(W, { children: [
1339
+ children: a ? /* @__PURE__ */ r(Ne, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m(W, { children: [
1325
1340
  /* @__PURE__ */ r(_t, { agents: B, tasks: U, selectedRepo: w }),
1326
1341
  /* @__PURE__ */ m("div", { className: "board", children: [
1327
1342
  /* @__PURE__ */ m("div", { className: "col", children: [
1328
1343
  /* @__PURE__ */ m("div", { className: "colhead", children: [
1329
1344
  /* @__PURE__ */ r("h2", { children: "Active" }),
1330
- /* @__PURE__ */ r("span", { className: "n", id: "active-count", children: je })
1345
+ /* @__PURE__ */ r("span", { className: "n", id: "active-count", children: Ie })
1331
1346
  ] }),
1332
1347
  /* @__PURE__ */ r(St, { tasks: U, nowMs: F, selectedRepo: w })
1333
1348
  ] }),
@@ -1335,7 +1350,7 @@ function Bt({
1335
1350
  /* @__PURE__ */ m("div", { className: "col", children: [
1336
1351
  /* @__PURE__ */ m("div", { className: "colhead", children: [
1337
1352
  /* @__PURE__ */ r("h2", { children: "Done" }),
1338
- /* @__PURE__ */ r("span", { className: "n", id: "done-count", children: De })
1353
+ /* @__PURE__ */ r("span", { className: "n", id: "done-count", children: xe })
1339
1354
  ] }),
1340
1355
  /* @__PURE__ */ r(
1341
1356
  $t,
@@ -1359,8 +1374,8 @@ function Bt({
1359
1374
  role: "tabpanel",
1360
1375
  "aria-labelledby": "tab-chat",
1361
1376
  hidden: d !== "chat",
1362
- children: a ? /* @__PURE__ */ r(ke, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m("div", { className: "chat-wrap", children: [
1363
- /* @__PURE__ */ r(Et, { announcements: Ee, selectedRepo: w, nowMs: F }),
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 }),
1364
1379
  /* @__PURE__ */ r(
1365
1380
  Dt,
1366
1381
  {
@@ -1388,7 +1403,7 @@ function Bt({
1388
1403
  }
1389
1404
  export {
1390
1405
  Bt as D,
1391
- ke as E,
1406
+ Ne as E,
1392
1407
  H as S,
1393
1408
  qt as a,
1394
1409
  Wt as c,