@korso/shepherd-ui 0.2.0 → 0.2.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.
Files changed (61) hide show
  1. package/README.md +47 -47
  2. package/dist/ShepherdRoot.js +15 -57
  3. package/dist/components/Dashboard.d.ts +16 -2
  4. package/dist/components/Dashboard.js +76 -5
  5. package/dist/config/EmptyState.js +5 -1
  6. package/dist/lib/{Dashboard-CG6KeFQ3.js → Dashboard-B7nioe5N.js} +529 -457
  7. package/dist/lib/index.d.ts +15 -1
  8. package/dist/lib/index.js +196 -279
  9. package/dist/lib/selfhost.js +1 -1
  10. package/dist/lib/styles.css +217 -209
  11. package/dist/selfhost/assets/index-D6rTsbVM.js +40 -0
  12. package/dist/selfhost/assets/{index-BZmImfYZ.css → index-DnhlP_lc.css} +1 -1
  13. package/dist/selfhost/index.html +13 -13
  14. package/dist/useLandscapePolling.d.ts +7 -0
  15. package/dist/useLandscapePolling.js +6 -1
  16. package/package.json +67 -67
  17. package/dist/ShepherdProvider.d.ts +0 -12
  18. package/dist/ShepherdProvider.js +0 -33
  19. package/dist/ShepherdProvider.test.d.ts +0 -1
  20. package/dist/ShepherdProvider.test.js +0 -47
  21. package/dist/ShepherdRoot.routing.test.d.ts +0 -1
  22. package/dist/ShepherdRoot.routing.test.js +0 -61
  23. package/dist/ShepherdRoot.test.d.ts +0 -1
  24. package/dist/ShepherdRoot.test.js +0 -37
  25. package/dist/app/assets/index-CDOCIg6s.js +0 -11
  26. package/dist/app/index.html +0 -12
  27. package/dist/client.test.d.ts +0 -1
  28. package/dist/client.test.js +0 -298
  29. package/dist/config/ConnectAgent.test.d.ts +0 -1
  30. package/dist/config/ConnectAgent.test.js +0 -92
  31. package/dist/config/EmptyState.test.d.ts +0 -1
  32. package/dist/config/EmptyState.test.js +0 -32
  33. package/dist/config/Members.test.d.ts +0 -1
  34. package/dist/config/Members.test.js +0 -66
  35. package/dist/config/Workspaces.test.d.ts +0 -1
  36. package/dist/config/Workspaces.test.js +0 -90
  37. package/dist/index.cjs +0 -5289
  38. package/dist/index.cjs.map +0 -1
  39. package/dist/index.d.cts +0 -149
  40. package/dist/index.js.map +0 -1
  41. package/dist/selfhost/assets/index-CS268KSw.js +0 -40
  42. package/dist/test/setup.d.ts +0 -1
  43. package/dist/test/setup.js +0 -2
  44. package/dist/views/Chat.d.ts +0 -5
  45. package/dist/views/Chat.js +0 -60
  46. package/dist/views/Chat.test.d.ts +0 -1
  47. package/dist/views/Chat.test.js +0 -92
  48. package/dist/views/Config.d.ts +0 -12
  49. package/dist/views/Config.js +0 -6
  50. package/dist/views/Tasks.d.ts +0 -5
  51. package/dist/views/Tasks.js +0 -75
  52. package/dist/views/Tasks.test.d.ts +0 -1
  53. package/dist/views/Tasks.test.js +0 -115
  54. package/dist/views/useLandscape.d.ts +0 -14
  55. package/dist/views/useLandscape.js +0 -74
  56. package/dist/views/useLandscape.test.d.ts +0 -1
  57. package/dist/views/useLandscape.test.js +0 -101
  58. package/dist/views/wallboard.d.ts +0 -46
  59. package/dist/views/wallboard.js +0 -209
  60. package/dist/views/wallboard.test.d.ts +0 -1
  61. package/dist/views/wallboard.test.js +0 -143
package/dist/lib/index.js CHANGED
@@ -1,130 +1,130 @@
1
- import { u as $, d as I, D as U } from "./Dashboard-CG6KeFQ3.js";
2
- import { S as ne, a as te, c as ae } from "./Dashboard-CG6KeFQ3.js";
3
- import { jsxs as b, jsx as e } from "react/jsx-runtime";
4
- import { useId as O, useState as i, useEffect as H, useRef as _, useCallback as D } from "react";
5
- function F({ workspaceId: c, refreshKey: t = 0, canRemove: l = !1, onLeft: k }) {
6
- const f = $(), R = O(), [w, v] = i([]), [N, y] = i(null), [p, C] = i(null), [E, d] = i(!0), [u, n] = i(null), [o, m] = i(!1);
7
- async function s({ keepError: h = !1 } = {}) {
8
- h || y(null);
1
+ import { u as O, d as N, D as $ } from "./Dashboard-B7nioe5N.js";
2
+ import { E as Y, S as Z, a as ee, c as ne } from "./Dashboard-B7nioe5N.js";
3
+ import { jsxs as y, jsx as e } from "react/jsx-runtime";
4
+ import { useId as U, useState as a, useEffect as H, useCallback as F } from "react";
5
+ function K({ workspaceId: c, refreshKey: t = 0, canRemove: i = !1, onLeft: k }) {
6
+ const m = O(), C = U(), [g, b] = a([]), [u, p] = a(null), [h, o] = a(null), [w, d] = a(!0), [s, v] = a(null), [R, S] = a(!1);
7
+ async function I({ keepError: l = !1 } = {}) {
8
+ l || p(null);
9
9
  try {
10
- const g = await f.listMembers(c);
11
- v(g.members);
12
- } catch (g) {
13
- y(I(g));
10
+ const f = await m.listMembers(c);
11
+ b(f.members);
12
+ } catch (f) {
13
+ p(N(f));
14
14
  } finally {
15
15
  d(!1);
16
16
  }
17
17
  }
18
18
  H(() => {
19
- d(!0), s();
20
- }, [f, c, t]);
21
- async function S(h, g) {
22
- if (!u) {
23
- n(h), y(null), C(null), v((T) => T.filter((r) => r.accountId !== h));
19
+ d(!0), I();
20
+ }, [m, c, t]);
21
+ async function L(l, f) {
22
+ if (!s) {
23
+ v(l), p(null), o(null), b((E) => E.filter((r) => r.accountId !== l));
24
24
  try {
25
- await f.removeMember(c, h), C(`Removed ${g}`);
26
- } catch (T) {
27
- y(I(T)), s({ keepError: !0 });
25
+ await m.removeMember(c, l), o(`Removed ${f}`);
26
+ } catch (E) {
27
+ p(N(E)), I({ keepError: !0 });
28
28
  } finally {
29
- n(null);
29
+ v(null);
30
30
  }
31
31
  }
32
32
  }
33
33
  async function x() {
34
- if (!o) {
35
- m(!0), y(null), C(null);
34
+ if (!R) {
35
+ S(!0), p(null), o(null);
36
36
  try {
37
- await f.leave(c), C("Left workspace"), k == null || k();
38
- } catch (h) {
39
- y(I(h));
37
+ await m.leave(c), o("Left workspace"), k == null || k();
38
+ } catch (l) {
39
+ p(N(l));
40
40
  } finally {
41
- m(!1);
41
+ S(!1);
42
42
  }
43
43
  }
44
44
  }
45
- return /* @__PURE__ */ b("section", { className: "shepherd-members", "aria-labelledby": R, children: [
46
- /* @__PURE__ */ e("h3", { id: R, children: "Members" }),
47
- N && /* @__PURE__ */ e("p", { role: "alert", children: N }),
48
- p && /* @__PURE__ */ e("p", { role: "status", children: p }),
49
- E ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ e("p", { children: "No members." }) : /* @__PURE__ */ e("ul", { children: w.map((h) => {
50
- const g = h.displayName ?? h.githubLogin ?? h.accountId;
51
- return /* @__PURE__ */ b("li", { children: [
52
- /* @__PURE__ */ e("span", { children: g }),
53
- /* @__PURE__ */ e("span", { className: "role", children: h.role }),
54
- l && /* @__PURE__ */ e(
45
+ return /* @__PURE__ */ y("section", { className: "shepherd-members", "aria-labelledby": C, children: [
46
+ /* @__PURE__ */ e("h3", { id: C, children: "Members" }),
47
+ u && /* @__PURE__ */ e("p", { role: "alert", children: u }),
48
+ h && /* @__PURE__ */ e("p", { role: "status", children: h }),
49
+ w ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : g.length === 0 ? /* @__PURE__ */ e("p", { children: "No members." }) : /* @__PURE__ */ e("ul", { children: g.map((l) => {
50
+ const f = l.displayName ?? l.githubLogin ?? l.accountId;
51
+ return /* @__PURE__ */ y("li", { children: [
52
+ /* @__PURE__ */ e("span", { children: f }),
53
+ /* @__PURE__ */ e("span", { className: "role", children: l.role }),
54
+ i && /* @__PURE__ */ e(
55
55
  "button",
56
56
  {
57
57
  type: "button",
58
- "aria-label": `Remove ${g}`,
59
- onClick: () => void S(h.accountId, g),
60
- disabled: u === h.accountId,
58
+ "aria-label": `Remove ${f}`,
59
+ onClick: () => void L(l.accountId, f),
60
+ disabled: s === l.accountId,
61
61
  children: "Remove"
62
62
  }
63
63
  )
64
- ] }, h.accountId);
64
+ ] }, l.accountId);
65
65
  }) }),
66
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void x(), disabled: o, children: "Leave workspace" })
66
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void x(), disabled: R, children: "Leave workspace" })
67
67
  ] });
68
68
  }
69
- function M({ workspaces: c, selected: t, onChanged: l, onSelect: k }) {
70
- const f = $(), R = O(), [w, v] = i(""), [N, y] = i(""), [p, C] = i(null), [E, d] = i(null), [u, n] = i(!1), [o, m] = i(0), s = (t == null ? void 0 : t.role) === "admin";
71
- async function S() {
72
- if (!(!w.trim() || u)) {
73
- n(!0), d(null);
69
+ function M({ workspaces: c, selected: t, onChanged: i, onSelect: k }) {
70
+ const m = O(), C = U(), [g, b] = a(""), [u, p] = a(""), [h, o] = a(null), [w, d] = a(null), [s, v] = a(!1), [R, S] = a(0), I = (t == null ? void 0 : t.role) === "admin";
71
+ async function L() {
72
+ if (!(!g.trim() || s)) {
73
+ v(!0), d(null);
74
74
  try {
75
- await f.createWorkspace({ name: w.trim() }), v(""), l();
75
+ await m.createWorkspace({ name: g.trim() }), b(""), i();
76
76
  } catch (r) {
77
- d(I(r));
77
+ d(N(r));
78
78
  } finally {
79
- n(!1);
79
+ v(!1);
80
80
  }
81
81
  }
82
82
  }
83
83
  async function x() {
84
- if (!(!N.trim() || u)) {
85
- n(!0), d(null);
84
+ if (!(!u.trim() || s)) {
85
+ v(!0), d(null);
86
86
  try {
87
- await f.redeemInvite(N.trim()), y(""), l(), m((r) => r + 1);
87
+ await m.redeemInvite(u.trim()), p(""), i(), S((r) => r + 1);
88
88
  } catch (r) {
89
- d(I(r));
89
+ d(N(r));
90
90
  } finally {
91
- n(!1);
91
+ v(!1);
92
92
  }
93
93
  }
94
94
  }
95
- async function h() {
96
- if (!(!t || u)) {
97
- n(!0), d(null);
95
+ async function l() {
96
+ if (!(!t || s)) {
97
+ v(!0), d(null);
98
98
  try {
99
- const r = await f.createInvite(t.id, {});
100
- C(r), m((j) => j + 1);
99
+ const r = await m.createInvite(t.id, {});
100
+ o(r), S((j) => j + 1);
101
101
  } catch (r) {
102
- d(I(r));
102
+ d(N(r));
103
103
  } finally {
104
- n(!1);
104
+ v(!1);
105
105
  }
106
106
  }
107
107
  }
108
- async function g() {
109
- if (!(!t || !p || u)) {
110
- n(!0), d(null);
108
+ async function f() {
109
+ if (!(!t || !h || s)) {
110
+ v(!0), d(null);
111
111
  try {
112
- await f.revokeInvite(t.id, p.code), C(null);
112
+ await m.revokeInvite(t.id, h.code), o(null);
113
113
  } catch (r) {
114
- d(I(r));
114
+ d(N(r));
115
115
  } finally {
116
- n(!1);
116
+ v(!1);
117
117
  }
118
118
  }
119
119
  }
120
120
  H(() => {
121
- C(null);
121
+ o(null);
122
122
  }, [t == null ? void 0 : t.id]);
123
- const T = p ? `${window.location.origin}/join/${encodeURIComponent(p.code)}` : null;
124
- return /* @__PURE__ */ b("section", { className: "shepherd-workspaces", "aria-labelledby": R, children: [
125
- /* @__PURE__ */ e("h3", { id: R, children: "Workspace management" }),
126
- E && /* @__PURE__ */ e("p", { role: "alert", children: E }),
127
- c.length > 1 && k && /* @__PURE__ */ b("div", { className: "switcher", children: [
123
+ const E = h ? `${window.location.origin}/join/${encodeURIComponent(h.code)}` : null;
124
+ return /* @__PURE__ */ y("section", { className: "shepherd-workspaces", "aria-labelledby": C, children: [
125
+ /* @__PURE__ */ e("h3", { id: C, children: "Workspace management" }),
126
+ w && /* @__PURE__ */ e("p", { role: "alert", children: w }),
127
+ c.length > 1 && k && /* @__PURE__ */ y("div", { className: "switcher", children: [
128
128
  /* @__PURE__ */ e("label", { htmlFor: "ws-switcher", children: "Active workspace" }),
129
129
  /* @__PURE__ */ e(
130
130
  "select",
@@ -136,53 +136,53 @@ function M({ workspaces: c, selected: t, onChanged: l, onSelect: k }) {
136
136
  }
137
137
  )
138
138
  ] }),
139
- /* @__PURE__ */ b("div", { className: "create", children: [
139
+ /* @__PURE__ */ y("div", { className: "create", children: [
140
140
  /* @__PURE__ */ e("label", { htmlFor: "ws-name", children: "Workspace name" }),
141
141
  /* @__PURE__ */ e(
142
142
  "input",
143
143
  {
144
144
  id: "ws-name",
145
145
  type: "text",
146
- value: w,
147
- onChange: (r) => v(r.target.value)
146
+ value: g,
147
+ onChange: (r) => b(r.target.value)
148
148
  }
149
149
  ),
150
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void S(), disabled: u, children: "Create workspace" })
150
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void L(), disabled: s, children: "Create workspace" })
151
151
  ] }),
152
- /* @__PURE__ */ b("div", { className: "join", children: [
152
+ /* @__PURE__ */ y("div", { className: "join", children: [
153
153
  /* @__PURE__ */ e("label", { htmlFor: "invite-code", children: "Invite code" }),
154
154
  /* @__PURE__ */ e(
155
155
  "input",
156
156
  {
157
157
  id: "invite-code",
158
158
  type: "text",
159
- value: N,
160
- onChange: (r) => y(r.target.value)
159
+ value: u,
160
+ onChange: (r) => p(r.target.value)
161
161
  }
162
162
  ),
163
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void x(), disabled: u, children: "Join" })
163
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void x(), disabled: s, children: "Join" })
164
164
  ] }),
165
- s && t && /* @__PURE__ */ b("div", { className: "admin", children: [
166
- /* @__PURE__ */ b("div", { className: "invites", children: [
167
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void h(), disabled: u, children: "Create invite" }),
168
- p && /* @__PURE__ */ b("div", { className: "invite-result", children: [
169
- /* @__PURE__ */ e("code", { children: p.code }),
170
- /* @__PURE__ */ e("a", { href: T ?? void 0, children: T }),
171
- /* @__PURE__ */ b("span", { className: "invite-uses", children: [
172
- p.useCount,
165
+ I && t && /* @__PURE__ */ y("div", { className: "admin", children: [
166
+ /* @__PURE__ */ y("div", { className: "invites", children: [
167
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void l(), disabled: s, children: "Create invite" }),
168
+ h && /* @__PURE__ */ y("div", { className: "invite-result", children: [
169
+ /* @__PURE__ */ e("code", { children: h.code }),
170
+ /* @__PURE__ */ e("a", { href: E ?? void 0, children: E }),
171
+ /* @__PURE__ */ y("span", { className: "invite-uses", children: [
172
+ h.useCount,
173
173
  " / ",
174
- p.maxUses,
174
+ h.maxUses,
175
175
  " uses"
176
176
  ] }),
177
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void g(), disabled: u, children: "Revoke invite" })
177
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void f(), disabled: s, children: "Revoke invite" })
178
178
  ] })
179
179
  ] }),
180
180
  /* @__PURE__ */ e(
181
- F,
181
+ K,
182
182
  {
183
183
  workspaceId: t.id,
184
- refreshKey: o,
185
- onLeft: l,
184
+ refreshKey: R,
185
+ onLeft: i,
186
186
  canRemove: !0
187
187
  }
188
188
  )
@@ -194,264 +194,181 @@ const P = [
194
194
  { id: "codex", label: "Codex" },
195
195
  { id: "pi", label: "Pi" },
196
196
  { id: "generic", label: "Generic (JSON)" }
197
- ], B = "shp_<paste-after-generating>", G = {
197
+ ], A = "shp_<paste-after-generating>", D = {
198
198
  claude: "claude mcp add shepherd -s user \\",
199
199
  codex: "codex mcp add shepherd \\",
200
200
  pi: "pi mcp add shepherd \\"
201
201
  };
202
- function J(c, t, l) {
202
+ function B(c, t, i) {
203
203
  return c === "generic" ? JSON.stringify(
204
204
  {
205
205
  mcpServers: {
206
206
  shepherd: {
207
207
  command: "npx",
208
208
  args: ["-y", "@korso/shepherd"],
209
- env: { HUB_URL: t, SHEPHERD_TOKEN: l }
209
+ env: { HUB_URL: t, SHEPHERD_TOKEN: i }
210
210
  }
211
211
  }
212
212
  },
213
213
  null,
214
214
  2
215
215
  ) : [
216
- G[c],
216
+ D[c],
217
217
  ` -e HUB_URL=${t} \\`,
218
- ` -e SHEPHERD_TOKEN=${l} \\`,
218
+ ` -e SHEPHERD_TOKEN=${i} \\`,
219
219
  " -- npx -y @korso/shepherd"
220
220
  ].join(`
221
221
  `);
222
222
  }
223
- function V({ workspaceId: c, hubUrl: t }) {
224
- const l = $(), k = t ?? l.baseUrl, f = O(), [R, w] = i("claude"), [v, N] = i(""), [y, p] = i(null), [C, E] = i([]), [d, u] = i(null), [n, o] = i(null), [m, s] = i(!1), [S, x] = i(!0), [h, g] = i(null);
225
- async function T() {
223
+ function J({ workspaceId: c, hubUrl: t }) {
224
+ const i = O(), k = t ?? i.baseUrl, m = U(), [C, g] = a("claude"), [b, u] = a(""), [p, h] = a(null), [o, w] = a([]), [d, s] = a(null), [v, R] = a(null), [S, I] = a(!1), [L, x] = a(!0), [l, f] = a(null);
225
+ async function E() {
226
226
  try {
227
- const a = await l.listTokens(c);
228
- E(a.tokens);
229
- } catch (a) {
230
- u(I(a));
227
+ const n = await i.listTokens(c);
228
+ w(n.tokens);
229
+ } catch (n) {
230
+ s(N(n));
231
231
  } finally {
232
232
  x(!1);
233
233
  }
234
234
  }
235
235
  H(() => {
236
- x(!0), T();
237
- }, [l, c]), H(() => {
238
- p(null);
236
+ x(!0), E();
237
+ }, [i, c]), H(() => {
238
+ h(null);
239
239
  }, [c]);
240
240
  async function r() {
241
- s(!0), u(null);
241
+ I(!0), s(null);
242
242
  try {
243
- const a = await l.mintToken(
243
+ const n = await i.mintToken(
244
244
  c,
245
- v.trim() ? { name: v.trim() } : {}
245
+ b.trim() ? { name: b.trim() } : {}
246
246
  );
247
- p(a.token), N(""), await T();
248
- } catch (a) {
249
- u(I(a));
247
+ h(n.token), u(""), await E();
248
+ } catch (n) {
249
+ s(N(n));
250
250
  } finally {
251
- s(!1);
251
+ I(!1);
252
252
  }
253
253
  }
254
- async function j(a) {
255
- if (!h) {
256
- g(a), u(null), o(null);
254
+ async function j(n) {
255
+ if (!l) {
256
+ f(n), s(null), R(null);
257
257
  try {
258
- await l.revokeToken(c, a), E((L) => L.filter((A) => A.id !== a)), o("Token revoked");
259
- } catch (L) {
260
- u(I(L));
258
+ await i.revokeToken(c, n), w((T) => T.filter((_) => _.id !== n)), R("Token revoked");
259
+ } catch (T) {
260
+ s(N(T));
261
261
  } finally {
262
- g(null);
262
+ f(null);
263
263
  }
264
264
  }
265
265
  }
266
- const W = J(R, k, y ?? B);
267
- return /* @__PURE__ */ b("section", { className: "shepherd-connect-agent", "aria-labelledby": f, children: [
268
- /* @__PURE__ */ e("h3", { id: f, children: "Connect your agent" }),
266
+ const W = B(C, k, p ?? A);
267
+ return /* @__PURE__ */ y("section", { className: "shepherd-connect-agent", "aria-labelledby": m, children: [
268
+ /* @__PURE__ */ e("h3", { id: m, children: "Connect your agent" }),
269
269
  /* @__PURE__ */ e("label", { htmlFor: "connect-tool", children: "Tool" }),
270
270
  /* @__PURE__ */ e(
271
271
  "select",
272
272
  {
273
273
  id: "connect-tool",
274
- value: R,
275
- onChange: (a) => w(a.target.value),
276
- children: P.map((a) => /* @__PURE__ */ e("option", { value: a.id, children: a.label }, a.id))
274
+ value: C,
275
+ onChange: (n) => g(n.target.value),
276
+ children: P.map((n) => /* @__PURE__ */ e("option", { value: n.id, children: n.label }, n.id))
277
277
  }
278
278
  ),
279
- /* @__PURE__ */ b("div", { className: "generate", children: [
279
+ /* @__PURE__ */ y("div", { className: "generate", children: [
280
280
  /* @__PURE__ */ e("label", { htmlFor: "token-name", children: "Token name (optional)" }),
281
281
  /* @__PURE__ */ e(
282
282
  "input",
283
283
  {
284
284
  id: "token-name",
285
285
  type: "text",
286
- value: v,
287
- onChange: (a) => N(a.target.value),
286
+ value: b,
287
+ onChange: (n) => u(n.target.value),
288
288
  placeholder: "e.g. laptop"
289
289
  }
290
290
  ),
291
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void r(), disabled: m, children: "Generate token" })
291
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void r(), disabled: S, children: "Generate token" })
292
292
  ] }),
293
293
  d && /* @__PURE__ */ e("p", { role: "alert", children: d }),
294
- n && /* @__PURE__ */ e("p", { role: "status", children: n }),
295
- y && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
294
+ v && /* @__PURE__ */ e("p", { role: "status", children: v }),
295
+ p && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
296
296
  /* @__PURE__ */ e("pre", { "data-testid": "install-command", children: W }),
297
297
  /* @__PURE__ */ e("h4", { children: "Existing tokens" }),
298
- S ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : C.length === 0 ? /* @__PURE__ */ e("p", { children: "No tokens yet." }) : /* @__PURE__ */ e("ul", { children: C.map((a) => {
299
- const L = a.name ?? a.id;
300
- return /* @__PURE__ */ b("li", { children: [
301
- /* @__PURE__ */ e("span", { children: L }),
302
- a.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
298
+ L ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : o.length === 0 ? /* @__PURE__ */ e("p", { children: "No tokens yet." }) : /* @__PURE__ */ e("ul", { children: o.map((n) => {
299
+ const T = n.name ?? n.id;
300
+ return /* @__PURE__ */ y("li", { children: [
301
+ /* @__PURE__ */ e("span", { children: T }),
302
+ n.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
303
303
  "button",
304
304
  {
305
305
  type: "button",
306
- "aria-label": `Revoke token ${L}`,
307
- onClick: () => void j(a.id),
308
- disabled: h === a.id,
306
+ "aria-label": `Revoke token ${T}`,
307
+ onClick: () => void j(n.id),
308
+ disabled: l === n.id,
309
309
  children: "Revoke"
310
310
  }
311
311
  )
312
- ] }, a.id);
312
+ ] }, n.id);
313
313
  }) })
314
314
  ] });
315
315
  }
316
- function X({
317
- title: c = "No workspace yet",
318
- children: t,
319
- onGetStarted: l,
320
- ctaLabel: k = "Go to Config"
321
- }) {
322
- return /* @__PURE__ */ b("section", { className: "shepherd-empty-state", "aria-labelledby": "empty-state-heading", children: [
323
- /* @__PURE__ */ e("h2", { id: "empty-state-heading", children: c }),
324
- /* @__PURE__ */ e("p", { children: t ?? "Create a workspace or join one with an invite code to get started." }),
325
- l && /* @__PURE__ */ e("button", { type: "button", onClick: l, children: k })
326
- ] });
327
- }
328
- const K = [
329
- { id: "board", label: "Board" },
330
- { id: "config", label: "Config" }
331
- ];
332
- function Y({ hubUrl: c }) {
333
- const t = $(), [l, k] = i({ status: "loading" }), [f, R] = i(null), [w, v] = i("board"), N = _([]), y = D(
334
- (n, o) => {
335
- var S;
336
- const m = K.length - 1;
337
- let s = null;
338
- switch (n.key) {
339
- case "ArrowRight":
340
- s = o === m ? 0 : o + 1;
341
- break;
342
- case "ArrowLeft":
343
- s = o === 0 ? m : o - 1;
344
- break;
345
- case "Home":
346
- s = 0;
347
- break;
348
- case "End":
349
- s = m;
350
- break;
351
- default:
352
- return;
353
- }
354
- n.preventDefault(), v(K[s].id), (S = N.current[s]) == null || S.focus();
355
- },
356
- []
357
- ), p = D(
358
- async (n) => {
359
- try {
360
- const o = await t.listWorkspaces();
361
- k({ status: "ready", workspaces: o.workspaces }), R(
362
- (m) => {
363
- var s;
364
- return m && o.workspaces.some((S) => S.id === m) ? m : ((s = o.workspaces[0]) == null ? void 0 : s.id) ?? null;
365
- }
366
- ), n && v(o.workspaces.length === 0 ? "config" : "board");
367
- } catch (o) {
368
- k({
369
- status: "error",
370
- message: I(o)
371
- });
372
- }
373
- },
374
- [t]
375
- );
316
+ function z({ hubUrl: c }) {
317
+ const t = O(), [i, k] = a({ status: "loading" }), [m, C] = a(null), g = F(async () => {
318
+ try {
319
+ const o = await t.listWorkspaces();
320
+ k({ status: "ready", workspaces: o.workspaces }), C(
321
+ (w) => {
322
+ var d;
323
+ return w && o.workspaces.some((s) => s.id === w) ? w : ((d = o.workspaces[0]) == null ? void 0 : d.id) ?? null;
324
+ }
325
+ );
326
+ } catch (o) {
327
+ k({ status: "error", message: N(o) });
328
+ }
329
+ }, [t]);
376
330
  H(() => {
377
- p(!0);
378
- }, []);
379
- const C = D(() => p(!1), [p]), E = l.status === "ready" ? l.workspaces : [], d = E.find((n) => n.id === f) ?? null;
380
- if (l.status === "loading")
331
+ g();
332
+ }, [g]);
333
+ const b = i.status === "ready" ? i.workspaces : [], u = b.find((o) => o.id === m) ?? null;
334
+ if (i.status === "loading")
381
335
  return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) });
382
- if (l.status === "error")
383
- return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: l.message }) });
384
- const u = E.length > 0;
385
- return /* @__PURE__ */ b("div", { className: "shepherd-root", children: [
386
- /* @__PURE__ */ b("header", { children: [
387
- /* @__PURE__ */ e("h1", { className: "brand", style: { margin: 0, font: "inherit" }, children: "Shepherd" }),
388
- /* @__PURE__ */ e("nav", { className: "tabs", role: "tablist", "aria-label": "Shepherd views", children: K.map(({ id: n, label: o }, m) => /* @__PURE__ */ e(
389
- "button",
390
- {
391
- ref: (s) => {
392
- N.current[m] = s;
393
- },
394
- type: "button",
395
- role: "tab",
396
- id: `tab-${n}`,
397
- "aria-controls": `panel-${n}`,
398
- "aria-selected": w === n,
399
- tabIndex: w === n ? 0 : -1,
400
- onClick: () => v(n),
401
- onKeyDown: (s) => y(s, m),
402
- children: o
336
+ if (i.status === "error")
337
+ return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: i.message }) });
338
+ const p = b.length > 0, h = /* @__PURE__ */ y("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
339
+ /* @__PURE__ */ e("h2", { id: "config-heading", children: "Configuration" }),
340
+ /* @__PURE__ */ e(
341
+ M,
342
+ {
343
+ workspaces: b,
344
+ selected: u,
345
+ onChanged: () => {
346
+ g();
403
347
  },
404
- n
405
- )) })
406
- ] }),
407
- /* @__PURE__ */ b("main", { children: [
408
- w === "board" && /* @__PURE__ */ e(
409
- "div",
410
- {
411
- role: "tabpanel",
412
- id: "panel-board",
413
- "aria-labelledby": "tab-board",
414
- tabIndex: 0,
415
- children: u && d ? /* @__PURE__ */ e(U, { workspaceId: d.id }) : /* @__PURE__ */ e(X, { onGetStarted: () => v("config") })
416
- }
417
- ),
418
- w === "config" && /* @__PURE__ */ e(
419
- "div",
420
- {
421
- role: "tabpanel",
422
- id: "panel-config",
423
- "aria-labelledby": "tab-config",
424
- tabIndex: 0,
425
- children: /* @__PURE__ */ b("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
426
- /* @__PURE__ */ e("h2", { id: "config-heading", children: "Configuration" }),
427
- /* @__PURE__ */ e(
428
- M,
429
- {
430
- workspaces: E,
431
- selected: d,
432
- onChanged: () => {
433
- C();
434
- },
435
- onSelect: R
436
- }
437
- ),
438
- d && /* @__PURE__ */ e(V, { workspaceId: d.id, hubUrl: c })
439
- ] })
440
- }
441
- )
442
- ] })
348
+ onSelect: C
349
+ }
350
+ ),
351
+ u && /* @__PURE__ */ e(J, { workspaceId: u.id, hubUrl: c })
443
352
  ] });
353
+ return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e(
354
+ $,
355
+ {
356
+ workspaceId: u == null ? void 0 : u.id,
357
+ config: h,
358
+ hasWorkspace: p
359
+ }
360
+ ) });
444
361
  }
445
362
  export {
446
- V as ConnectAgent,
447
- U as Dashboard,
448
- X as EmptyState,
449
- F as Members,
450
- ne as ShepherdClientError,
451
- te as ShepherdClientProvider,
452
- Y as ShepherdRoot,
363
+ J as ConnectAgent,
364
+ $ as Dashboard,
365
+ Y as EmptyState,
366
+ K as Members,
367
+ Z as ShepherdClientError,
368
+ ee as ShepherdClientProvider,
369
+ z as ShepherdRoot,
453
370
  M as Workspaces,
454
- ae as createShepherdClient,
455
- I as describeError,
456
- $ as useShepherdClient
371
+ ne as createShepherdClient,
372
+ N as describeError,
373
+ O as useShepherdClient
457
374
  };