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