@korso/shepherd-ui 0.4.0 → 0.5.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.
package/dist/lib/index.js CHANGED
@@ -1,28 +1,28 @@
1
- import { u as A, d as I, f as D, D as P } from "./Dashboard-CTXdGRxM.js";
2
- import { E as de, S as ue, a as he, c as me } from "./Dashboard-CTXdGRxM.js";
3
- import { jsxs as n, jsx as e, Fragment as H } from "react/jsx-runtime";
4
- import { useId as U, useRef as K, useState as a, useEffect as j, useCallback as Y } from "react";
5
- function F(t) {
6
- return (t.trim()[0] ?? "?").toUpperCase();
1
+ import { u as A, d as I, f as O, D as G } from "./Dashboard-C48qY8R2.js";
2
+ import { E as ce, S as de, a as ue, c as he } from "./Dashboard-C48qY8R2.js";
3
+ import { jsxs as n, jsx as e, Fragment as F } from "react/jsx-runtime";
4
+ import { useId as B, useRef as P, useState as a, useEffect as U, useCallback as K } from "react";
5
+ function D(i) {
6
+ return (i.trim()[0] ?? "?").toUpperCase();
7
7
  }
8
- function J({
9
- workspaces: t,
10
- selected: i,
11
- onSelect: r,
12
- onChanged: p,
8
+ function Y({
9
+ workspaces: i,
10
+ selected: t,
11
+ onSelect: d,
12
+ onChanged: v,
13
13
  onMembersChanged: o
14
14
  }) {
15
- const h = A(), v = U(), m = K(null), [l, f] = a(!1), [b, N] = a("menu"), [g, w] = a(""), [c, C] = a(""), [E, d] = a(null), [k, _] = a(!1);
15
+ const h = A(), m = B(), p = P(null), [l, y] = a(!1), [b, w] = a("menu"), [g, N] = a(""), [u, C] = a(""), [E, r] = a(null), [k, _] = a(!1);
16
16
  function S() {
17
- f(!1), N("menu"), w(""), C(""), d(null);
17
+ y(!1), w("menu"), N(""), C(""), r(null);
18
18
  }
19
- j(() => {
19
+ U(() => {
20
20
  if (!l) return;
21
- function s(B) {
22
- m.current && !m.current.contains(B.target) && S();
21
+ function s($) {
22
+ p.current && !p.current.contains($.target) && S();
23
23
  }
24
- function R(B) {
25
- B.key === "Escape" && S();
24
+ function R($) {
25
+ $.key === "Escape" && S();
26
26
  }
27
27
  return document.addEventListener("mousedown", s), document.addEventListener("keydown", R), () => {
28
28
  document.removeEventListener("mousedown", s), document.removeEventListener("keydown", R);
@@ -30,53 +30,53 @@ function J({
30
30
  }, [l]);
31
31
  async function x() {
32
32
  if (!(!g.trim() || k)) {
33
- _(!0), d(null);
33
+ _(!0), r(null);
34
34
  try {
35
35
  const s = await h.createWorkspace({ name: g.trim() });
36
- r(s.id), p(), S();
36
+ d(s.id), v(), S();
37
37
  } catch (s) {
38
- d(I(s));
38
+ r(I(s));
39
39
  } finally {
40
40
  _(!1);
41
41
  }
42
42
  }
43
43
  }
44
44
  async function L() {
45
- if (!(!c.trim() || k)) {
46
- _(!0), d(null);
45
+ if (!(!u.trim() || k)) {
46
+ _(!0), r(null);
47
47
  try {
48
- const s = await h.redeemInvite(c.trim());
49
- r(s.workspace.id), p(), o == null || o(), S();
48
+ const s = await h.redeemInvite(u.trim());
49
+ d(s.workspace.id), v(), o == null || o(), S();
50
50
  } catch (s) {
51
- d(I(s));
51
+ r(I(s));
52
52
  } finally {
53
53
  _(!1);
54
54
  }
55
55
  }
56
56
  }
57
- const y = i !== null, T = i ? i.name : "Get started";
58
- return /* @__PURE__ */ n("div", { className: "ws-switcher", ref: m, children: [
57
+ const f = t !== null, T = t ? t.name : "Get started";
58
+ return /* @__PURE__ */ n("div", { className: "ws-switcher", ref: p, children: [
59
59
  /* @__PURE__ */ n(
60
60
  "button",
61
61
  {
62
62
  type: "button",
63
- className: "ws-trig" + (y ? "" : " ws-trig--empty"),
63
+ className: "ws-trig" + (f ? "" : " ws-trig--empty"),
64
64
  "aria-haspopup": "menu",
65
65
  "aria-expanded": l,
66
- "aria-controls": l ? v : void 0,
67
- onClick: () => l ? S() : f(!0),
66
+ "aria-controls": l ? m : void 0,
67
+ onClick: () => l ? S() : y(!0),
68
68
  children: [
69
- y ? /* @__PURE__ */ e("span", { className: "ws-avatar", "aria-hidden": "true", children: F(T) }) : /* @__PURE__ */ e("span", { className: "ws-plus", "aria-hidden": "true", children: "+" }),
69
+ f ? /* @__PURE__ */ e("span", { className: "ws-avatar", "aria-hidden": "true", children: D(T) }) : /* @__PURE__ */ e("span", { className: "ws-plus", "aria-hidden": "true", children: "+" }),
70
70
  /* @__PURE__ */ e("span", { className: "ws-name", children: T }),
71
71
  /* @__PURE__ */ e("span", { className: "ws-caret", "aria-hidden": "true", children: "▾" })
72
72
  ]
73
73
  }
74
74
  ),
75
- l && /* @__PURE__ */ n("div", { className: "ws-menu", id: v, role: "menu", children: [
76
- b === "menu" && /* @__PURE__ */ n(H, { children: [
77
- /* @__PURE__ */ e("p", { className: "ws-menu__head", children: y ? "Switch workspace" : "Your workspaces" }),
78
- t.length === 0 ? /* @__PURE__ */ e("p", { className: "ws-menu__none", children: "None yet" }) : /* @__PURE__ */ e("ul", { className: "ws-menu__list", children: t.map((s) => {
79
- const R = s.id === (i == null ? void 0 : i.id);
75
+ l && /* @__PURE__ */ n("div", { className: "ws-menu", id: m, role: "menu", children: [
76
+ b === "menu" && /* @__PURE__ */ n(F, { children: [
77
+ /* @__PURE__ */ e("p", { className: "ws-menu__head", children: f ? "Switch workspace" : "Your workspaces" }),
78
+ i.length === 0 ? /* @__PURE__ */ e("p", { className: "ws-menu__none", children: "None yet" }) : /* @__PURE__ */ e("ul", { className: "ws-menu__list", children: i.map((s) => {
79
+ const R = s.id === (t == null ? void 0 : t.id);
80
80
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
81
81
  "button",
82
82
  {
@@ -85,10 +85,10 @@ function J({
85
85
  "aria-checked": R,
86
86
  className: "ws-mi" + (R ? " ws-mi--on" : ""),
87
87
  onClick: () => {
88
- r(s.id), S();
88
+ d(s.id), S();
89
89
  },
90
90
  children: [
91
- /* @__PURE__ */ e("span", { className: "ws-avatar ws-avatar--sm", "aria-hidden": "true", children: F(s.name) }),
91
+ /* @__PURE__ */ e("span", { className: "ws-avatar ws-avatar--sm", "aria-hidden": "true", children: D(s.name) }),
92
92
  /* @__PURE__ */ e("span", { className: "ws-mi__name", children: s.name }),
93
93
  R && /* @__PURE__ */ e("span", { className: "ws-mi__check", "aria-hidden": "true", children: "✓" })
94
94
  ]
@@ -103,7 +103,7 @@ function J({
103
103
  role: "menuitem",
104
104
  className: "ws-action",
105
105
  onClick: () => {
106
- d(null), N("create");
106
+ r(null), w("create");
107
107
  },
108
108
  children: "+ Create workspace"
109
109
  }
@@ -115,7 +115,7 @@ function J({
115
115
  role: "menuitem",
116
116
  className: "ws-action",
117
117
  onClick: () => {
118
- d(null), N("join");
118
+ r(null), w("join");
119
119
  },
120
120
  children: "⎘ Join with a code"
121
121
  }
@@ -130,20 +130,20 @@ function J({
130
130
  s.preventDefault(), x();
131
131
  },
132
132
  children: [
133
- /* @__PURE__ */ e("label", { htmlFor: `${v}-name`, children: "New workspace name" }),
133
+ /* @__PURE__ */ e("label", { htmlFor: `${m}-name`, children: "New workspace name" }),
134
134
  /* @__PURE__ */ e(
135
135
  "input",
136
136
  {
137
- id: `${v}-name`,
137
+ id: `${m}-name`,
138
138
  type: "text",
139
139
  placeholder: "e.g. Acme Engineering",
140
140
  value: g,
141
141
  autoFocus: !0,
142
- onChange: (s) => w(s.target.value)
142
+ onChange: (s) => N(s.target.value)
143
143
  }
144
144
  ),
145
145
  /* @__PURE__ */ n("div", { className: "ws-form__row", children: [
146
- /* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => N("menu"), children: "Back" }),
146
+ /* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => w("menu"), children: "Back" }),
147
147
  /* @__PURE__ */ e("button", { type: "submit", disabled: k || !g.trim(), children: "Create" })
148
148
  ] })
149
149
  ]
@@ -157,21 +157,21 @@ function J({
157
157
  s.preventDefault(), L();
158
158
  },
159
159
  children: [
160
- /* @__PURE__ */ e("label", { htmlFor: `${v}-code`, children: "Invite code" }),
160
+ /* @__PURE__ */ e("label", { htmlFor: `${m}-code`, children: "Invite code" }),
161
161
  /* @__PURE__ */ e(
162
162
  "input",
163
163
  {
164
- id: `${v}-code`,
164
+ id: `${m}-code`,
165
165
  type: "text",
166
166
  placeholder: "Paste an invite code",
167
- value: c,
167
+ value: u,
168
168
  autoFocus: !0,
169
169
  onChange: (s) => C(s.target.value)
170
170
  }
171
171
  ),
172
172
  /* @__PURE__ */ n("div", { className: "ws-form__row", children: [
173
- /* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => N("menu"), children: "Back" }),
174
- /* @__PURE__ */ e("button", { type: "submit", disabled: k || !c.trim(), children: "Join" })
173
+ /* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => w("menu"), children: "Back" }),
174
+ /* @__PURE__ */ e("button", { type: "submit", disabled: k || !u.trim(), children: "Join" })
175
175
  ] })
176
176
  ]
177
177
  }
@@ -180,150 +180,150 @@ function J({
180
180
  ] })
181
181
  ] });
182
182
  }
183
- function V({ workspace: t, onLeft: i }) {
184
- const r = A(), p = U(), [o, h] = a(null), [v, m] = a(!1);
183
+ function J({ workspace: i, onLeft: t }) {
184
+ const d = A(), v = B(), [o, h] = a(null), [m, p] = a(!1);
185
185
  async function l() {
186
- if (!v) {
187
- m(!0), h(null);
186
+ if (!m) {
187
+ p(!0), h(null);
188
188
  try {
189
- await r.leave(t.id), i == null || i();
190
- } catch (f) {
191
- h(I(f));
189
+ await d.leave(i.id), t == null || t();
190
+ } catch (y) {
191
+ h(I(y));
192
192
  } finally {
193
- m(!1);
193
+ p(!1);
194
194
  }
195
195
  }
196
196
  }
197
- return /* @__PURE__ */ n("section", { className: "shepherd-general", "aria-labelledby": p, children: [
197
+ return /* @__PURE__ */ n("section", { className: "shepherd-general", "aria-labelledby": v, children: [
198
198
  /* @__PURE__ */ n("div", { className: "card-head", children: [
199
- /* @__PURE__ */ e("h3", { id: p, children: "General" }),
199
+ /* @__PURE__ */ e("h3", { id: v, children: "General" }),
200
200
  /* @__PURE__ */ e("p", { className: "card-sub", children: "Your active workspace and its settings." })
201
201
  ] }),
202
202
  /* @__PURE__ */ n("div", { className: "card-body", children: [
203
203
  o && /* @__PURE__ */ e("p", { role: "alert", children: o }),
204
204
  /* @__PURE__ */ n("div", { className: "field", children: [
205
205
  /* @__PURE__ */ e("label", { children: "Workspace name" }),
206
- /* @__PURE__ */ e("p", { className: "readonly-value", children: t.name })
206
+ /* @__PURE__ */ e("p", { className: "readonly-value", children: i.name })
207
207
  ] }),
208
208
  /* @__PURE__ */ n("div", { className: "field", children: [
209
209
  /* @__PURE__ */ e("label", { children: "Your role" }),
210
- /* @__PURE__ */ e("p", { className: "readonly-value", children: t.role })
210
+ /* @__PURE__ */ e("p", { className: "readonly-value", children: i.role })
211
211
  ] }),
212
212
  /* @__PURE__ */ n("div", { className: "field leave", children: [
213
213
  /* @__PURE__ */ e("label", { children: "Leave workspace" }),
214
214
  /* @__PURE__ */ e("p", { className: "helper", children: "Remove yourself from this workspace. You'll need a new invite to rejoin." }),
215
- /* @__PURE__ */ e("button", { type: "button", className: "danger", onClick: () => void l(), disabled: v, children: "Leave workspace" })
215
+ /* @__PURE__ */ e("button", { type: "button", className: "danger", onClick: () => void l(), disabled: m, children: "Leave workspace" })
216
216
  ] })
217
217
  ] })
218
218
  ] });
219
219
  }
220
- function X({ workspaceId: t, refreshKey: i = 0, canRemove: r = !1 }) {
221
- const p = A(), o = U(), [h, v] = a([]), [m, l] = a(null), [f, b] = a(null), [N, g] = a(!0), [w, c] = a(null);
222
- async function C({ keepError: d = !1 } = {}) {
223
- d || l(null);
220
+ function V({ workspaceId: i, refreshKey: t = 0, canRemove: d = !1 }) {
221
+ const v = A(), o = B(), [h, m] = a([]), [p, l] = a(null), [y, b] = a(null), [w, g] = a(!0), [N, u] = a(null);
222
+ async function C({ keepError: r = !1 } = {}) {
223
+ r || l(null);
224
224
  try {
225
- const k = await p.listMembers(t);
226
- v(k.members);
225
+ const k = await v.listMembers(i);
226
+ m(k.members);
227
227
  } catch (k) {
228
228
  l(I(k));
229
229
  } finally {
230
230
  g(!1);
231
231
  }
232
232
  }
233
- j(() => {
233
+ U(() => {
234
234
  g(!0), C();
235
- }, [p, t, i]);
236
- async function E(d, k) {
237
- if (!w) {
238
- c(d), l(null), b(null), v((_) => _.filter((S) => S.accountId !== d));
235
+ }, [v, i, t]);
236
+ async function E(r, k) {
237
+ if (!N) {
238
+ u(r), l(null), b(null), m((_) => _.filter((S) => S.accountId !== r));
239
239
  try {
240
- await p.removeMember(t, d), b(`Removed ${k}`);
240
+ await v.removeMember(i, r), b(`Removed ${k}`);
241
241
  } catch (_) {
242
242
  l(I(_)), C({ keepError: !0 });
243
243
  } finally {
244
- c(null);
244
+ u(null);
245
245
  }
246
246
  }
247
247
  }
248
248
  return /* @__PURE__ */ n("section", { className: "shepherd-members", "aria-labelledby": o, children: [
249
249
  /* @__PURE__ */ e("div", { className: "card-head", children: /* @__PURE__ */ e("h3", { id: o, children: "Members" }) }),
250
250
  /* @__PURE__ */ n("div", { className: "card-body", children: [
251
- m && /* @__PURE__ */ e("p", { role: "alert", children: m }),
252
- f && /* @__PURE__ */ e("p", { role: "status", children: f }),
253
- N ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ e("p", { children: "No members." }) : /* @__PURE__ */ e("ul", { children: h.map((d) => {
254
- const k = d.displayName ?? d.githubLogin ?? d.accountId;
251
+ p && /* @__PURE__ */ e("p", { role: "alert", children: p }),
252
+ y && /* @__PURE__ */ e("p", { role: "status", children: y }),
253
+ w ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ e("p", { children: "No members." }) : /* @__PURE__ */ e("ul", { children: h.map((r) => {
254
+ const k = r.displayName ?? r.githubLogin ?? r.accountId;
255
255
  return /* @__PURE__ */ n("li", { children: [
256
256
  /* @__PURE__ */ e("span", { children: k }),
257
- /* @__PURE__ */ e("span", { className: "role", children: d.role }),
258
- r && /* @__PURE__ */ e(
257
+ /* @__PURE__ */ e("span", { className: "role", children: r.role }),
258
+ d && /* @__PURE__ */ e(
259
259
  "button",
260
260
  {
261
261
  type: "button",
262
262
  "aria-label": `Remove ${k}`,
263
- onClick: () => void E(d.accountId, k),
264
- disabled: w === d.accountId,
263
+ onClick: () => void E(r.accountId, k),
264
+ disabled: N === r.accountId,
265
265
  children: "Remove"
266
266
  }
267
267
  )
268
- ] }, d.accountId);
268
+ ] }, r.accountId);
269
269
  }) })
270
270
  ] })
271
271
  ] });
272
272
  }
273
- function q({ workspaceId: t, onMembersChanged: i }) {
274
- const r = A(), p = U(), [o, h] = a(null), [v, m] = a(null), [l, f] = a(!1), [b, N] = a(""), [g, w] = a(null), [c, C] = a(!1), [E, d] = a(null);
275
- j(() => {
276
- h(null), w(null);
277
- }, [t]);
273
+ function X({ workspaceId: i, onMembersChanged: t }) {
274
+ const d = A(), v = B(), [o, h] = a(null), [m, p] = a(null), [l, y] = a(!1), [b, w] = a(""), [g, N] = a(null), [u, C] = a(!1), [E, r] = a(null);
275
+ U(() => {
276
+ h(null), N(null);
277
+ }, [i]);
278
278
  async function k() {
279
279
  if (!l) {
280
- f(!0), m(null);
280
+ y(!0), p(null);
281
281
  try {
282
- const y = await r.createInvite(t, {});
283
- h(y), i == null || i();
284
- } catch (y) {
285
- m(I(y));
282
+ const f = await d.createInvite(i, {});
283
+ h(f), t == null || t();
284
+ } catch (f) {
285
+ p(I(f));
286
286
  } finally {
287
- f(!1);
287
+ y(!1);
288
288
  }
289
289
  }
290
290
  }
291
291
  async function _() {
292
292
  if (!(!o || l)) {
293
- f(!0), m(null);
293
+ y(!0), p(null);
294
294
  try {
295
- await r.revokeInvite(t, o.code), h(null);
296
- } catch (y) {
297
- m(I(y));
295
+ await d.revokeInvite(i, o.code), h(null);
296
+ } catch (f) {
297
+ p(I(f));
298
298
  } finally {
299
- f(!1);
299
+ y(!1);
300
300
  }
301
301
  }
302
302
  }
303
303
  async function S() {
304
- if (!(!b.trim() || c)) {
305
- C(!0), w(null);
304
+ if (!(!b.trim() || u)) {
305
+ C(!0), N(null);
306
306
  try {
307
- const y = await r.inviteByEmail(t, b.trim());
308
- w(`Invite sent to ${y.email}.`), N(""), i == null || i();
309
- } catch (y) {
310
- w(I(y));
307
+ const f = await d.inviteByEmail(i, b.trim());
308
+ N(`Invite sent to ${f.email}.`), w(""), t == null || t();
309
+ } catch (f) {
310
+ N(I(f));
311
311
  } finally {
312
312
  C(!1);
313
313
  }
314
314
  }
315
315
  }
316
316
  const x = o ? `${window.location.origin}/shepherd/join/${encodeURIComponent(o.code)}` : null;
317
- async function L(y, T) {
318
- await navigator.clipboard.writeText(T), d(y), setTimeout(() => d((s) => s === y ? null : s), 2e3);
317
+ async function L(f, T) {
318
+ await navigator.clipboard.writeText(T), r(f), setTimeout(() => r((s) => s === f ? null : s), 2e3);
319
319
  }
320
- return /* @__PURE__ */ n("section", { className: "shepherd-invites", "aria-labelledby": p, children: [
320
+ return /* @__PURE__ */ n("section", { className: "shepherd-invites", "aria-labelledby": v, children: [
321
321
  /* @__PURE__ */ n("div", { className: "card-head", children: [
322
- /* @__PURE__ */ e("h3", { id: p, children: "Invite people" }),
322
+ /* @__PURE__ */ e("h3", { id: v, children: "Invite people" }),
323
323
  /* @__PURE__ */ e("p", { className: "card-sub", children: "Share a code, or send a one-time join link by email." })
324
324
  ] }),
325
325
  /* @__PURE__ */ n("div", { className: "card-body", children: [
326
- v && /* @__PURE__ */ e("p", { role: "alert", children: v }),
326
+ m && /* @__PURE__ */ e("p", { role: "alert", children: m }),
327
327
  /* @__PURE__ */ n("div", { className: "field invites", children: [
328
328
  /* @__PURE__ */ e("label", { children: "Invite by code" }),
329
329
  /* @__PURE__ */ e("p", { className: "helper", children: "Anyone with the code can join this workspace." }),
@@ -381,102 +381,100 @@ function q({ workspaceId: t, onMembersChanged: i }) {
381
381
  type: "email",
382
382
  placeholder: "name@example.com",
383
383
  value: b,
384
- onChange: (y) => N(y.target.value)
384
+ onChange: (f) => w(f.target.value)
385
385
  }
386
386
  ),
387
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void S(), disabled: c, children: "Send invite" })
387
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void S(), disabled: u, children: "Send invite" })
388
388
  ] }),
389
389
  g && /* @__PURE__ */ e("p", { className: "email-invite__status", children: g })
390
390
  ] })
391
391
  ] })
392
392
  ] });
393
393
  }
394
- const z = [
394
+ const q = [
395
395
  { id: "claude", label: "Claude Code" },
396
396
  { id: "codex", label: "Codex" },
397
397
  { id: "pi", label: "Pi" },
398
398
  { id: "generic", label: "Generic (JSON)" }
399
- ], Q = "shp_<paste-after-generating>", Z = {
399
+ ], z = "shp_<paste-after-generating>", Q = {
400
400
  claude: "claude mcp add shepherd -s user \\",
401
401
  codex: "codex mcp add shepherd \\",
402
402
  pi: "pi mcp add shepherd \\"
403
403
  };
404
- function M(t, i) {
405
- const r = `created ${D(t.createdAt, i)}`, p = t.lastUsedAt ? `last used ${D(t.lastUsedAt, i)}` : "never used";
406
- return `${r} · ${p}`;
404
+ function Z(i, t) {
405
+ const d = `created ${O(i.createdAt, t)}`, v = i.lastUsedAt ? `last used ${O(i.lastUsedAt, t)}` : "never used";
406
+ return `${d} · ${v}`;
407
407
  }
408
- function ee(t, i, r) {
409
- return t === "generic" ? JSON.stringify(
408
+ function M(i, t, d) {
409
+ return i === "generic" ? JSON.stringify(
410
410
  {
411
411
  mcpServers: {
412
412
  shepherd: {
413
413
  command: "npx",
414
414
  args: ["-y", "@korso/shepherd"],
415
- env: { HUB_URL: i, SHEPHERD_TOKEN: r }
415
+ env: { HUB_URL: t, SHEPHERD_TOKEN: d }
416
416
  }
417
417
  }
418
418
  },
419
419
  null,
420
420
  2
421
421
  ) : [
422
- Z[t],
423
- ` -e HUB_URL=${i} \\`,
424
- ` -e SHEPHERD_TOKEN=${r} \\`,
422
+ Q[i],
423
+ ` -e HUB_URL=${t} \\`,
424
+ ` -e SHEPHERD_TOKEN=${d} \\`,
425
425
  " -- npx -y @korso/shepherd"
426
426
  ].join(`
427
427
  `);
428
428
  }
429
- function ne({ workspaceId: t, hubUrl: i }) {
430
- const r = A(), p = i ?? r.baseUrl, o = U(), [h, v] = a("claude"), [m, l] = a(""), [f, b] = a(null), [N, g] = a([]), [w, c] = a(null), [C, E] = a(null), [d, k] = a(!1), [_, S] = a(!1), [x, L] = a(!0), [y, T] = a(null);
431
- async function s() {
429
+ function ee({ hubUrl: i }) {
430
+ const t = A(), d = i ?? t.baseUrl, v = B(), [o, h] = a("claude"), [m, p] = a(""), [l, y] = a(null), [b, w] = a([]), [g, N] = a(null), [u, C] = a(null), [E, r] = a(!1), [k, _] = a(!1), [S, x] = a(!0), [L, f] = a(null);
431
+ async function T() {
432
432
  try {
433
- const u = await r.listTokens(t);
434
- g(u.tokens);
435
- } catch (u) {
436
- c(I(u));
433
+ const c = await t.listAccountTokens();
434
+ w(c.tokens);
435
+ } catch (c) {
436
+ N(I(c));
437
437
  } finally {
438
- L(!1);
438
+ x(!1);
439
439
  }
440
440
  }
441
- j(() => {
442
- L(!0), s();
443
- }, [r, t]), j(() => {
444
- b(null);
441
+ U(() => {
442
+ x(!0), T();
445
443
  }, [t]);
446
- async function R() {
447
- k(!0), c(null);
444
+ async function s() {
445
+ r(!0), N(null);
448
446
  try {
449
- const u = await r.mintToken(
450
- t,
447
+ const c = await t.mintAccountToken(
451
448
  m.trim() ? { name: m.trim() } : {}
452
449
  );
453
- b(u.token), l(""), await s();
454
- } catch (u) {
455
- c(I(u));
450
+ y(c.token), p(""), await T();
451
+ } catch (c) {
452
+ N(I(c));
456
453
  } finally {
457
- k(!1);
454
+ r(!1);
458
455
  }
459
456
  }
460
- async function B(u) {
461
- if (!y) {
462
- T(u), c(null), E(null);
457
+ async function R(c) {
458
+ if (!L) {
459
+ f(c), N(null), C(null);
463
460
  try {
464
- await r.revokeToken(t, u), g(($) => $.filter((G) => G.id !== u)), E("Token revoked");
465
- } catch ($) {
466
- c(I($));
461
+ await t.revokeAccountToken(c), w((j) => j.filter((W) => W.id !== c)), C("Token revoked");
462
+ } catch (j) {
463
+ N(I(j));
467
464
  } finally {
468
- T(null);
465
+ f(null);
469
466
  }
470
467
  }
471
468
  }
472
- const O = ee(h, p, f ?? Q);
473
- async function W() {
474
- await navigator.clipboard.writeText(O), S(!0), setTimeout(() => S(!1), 2e3);
469
+ const $ = M(o, d, l ?? z);
470
+ async function H() {
471
+ await navigator.clipboard.writeText($), _(!0), setTimeout(() => _(!1), 2e3);
475
472
  }
476
- return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby": o, children: [
473
+ return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby": v, children: [
477
474
  /* @__PURE__ */ n("div", { className: "card-head", children: [
478
- /* @__PURE__ */ e("h3", { id: o, children: "Connect your agent" }),
479
- /* @__PURE__ */ e("p", { className: "card-sub", children: "Generate a token, then paste the command into your coding tool." })
475
+ /* @__PURE__ */ e("h3", { id: v, children: "Connect your agent" }),
476
+ /* @__PURE__ */ e("p", { className: "card-sub", children: "Generate a token — it works across all your workspaces — then paste the command into your coding tool." }),
477
+ /* @__PURE__ */ e("p", { className: "card-sub", children: "The first time the agent opens a repo, it'll ask which workspace to coordinate that repo with." })
480
478
  ] }),
481
479
  /* @__PURE__ */ n("div", { className: "card-body", children: [
482
480
  /* @__PURE__ */ n("div", { className: "field", children: [
@@ -485,9 +483,9 @@ function ne({ workspaceId: t, hubUrl: i }) {
485
483
  "select",
486
484
  {
487
485
  id: "connect-tool",
488
- value: h,
489
- onChange: (u) => v(u.target.value),
490
- children: z.map((u) => /* @__PURE__ */ e("option", { value: u.id, children: u.label }, u.id))
486
+ value: o,
487
+ onChange: (c) => h(c.target.value),
488
+ children: q.map((c) => /* @__PURE__ */ e("option", { value: c.id, children: c.label }, c.id))
491
489
  }
492
490
  )
493
491
  ] }),
@@ -500,27 +498,27 @@ function ne({ workspaceId: t, hubUrl: i }) {
500
498
  id: "token-name",
501
499
  type: "text",
502
500
  value: m,
503
- onChange: (u) => l(u.target.value),
501
+ onChange: (c) => p(c.target.value),
504
502
  placeholder: "e.g. laptop"
505
503
  }
506
504
  ),
507
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void R(), disabled: d, children: "Generate token" })
505
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void s(), disabled: E, children: "Generate token" })
508
506
  ] })
509
507
  ] }),
510
- w && /* @__PURE__ */ e("p", { role: "alert", children: w }),
511
- C && /* @__PURE__ */ e("p", { role: "status", children: C }),
512
- f && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
508
+ g && /* @__PURE__ */ e("p", { role: "alert", children: g }),
509
+ u && /* @__PURE__ */ e("p", { role: "status", children: u }),
510
+ l && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
513
511
  /* @__PURE__ */ n("div", { className: "install-command", children: [
514
- /* @__PURE__ */ e("pre", { "data-testid": "install-command", children: O }),
512
+ /* @__PURE__ */ e("pre", { "data-testid": "install-command", children: $ }),
515
513
  /* @__PURE__ */ e(
516
514
  "button",
517
515
  {
518
516
  type: "button",
519
517
  className: "install-command__copy",
520
- "aria-label": _ ? "Copied" : "Copy command",
521
- title: _ ? "Copied" : "Copy",
522
- onClick: () => void W(),
523
- children: _ ? /* @__PURE__ */ e(
518
+ "aria-label": k ? "Copied" : "Copy command",
519
+ title: k ? "Copied" : "Copy",
520
+ onClick: () => void H(),
521
+ children: k ? /* @__PURE__ */ e(
524
522
  "svg",
525
523
  {
526
524
  width: "15",
@@ -556,110 +554,110 @@ function ne({ workspaceId: t, hubUrl: i }) {
556
554
  )
557
555
  ] }),
558
556
  /* @__PURE__ */ e("h4", { children: "Existing tokens" }),
559
- x ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : N.length === 0 ? /* @__PURE__ */ e("p", { children: "No tokens yet." }) : /* @__PURE__ */ e("ul", { children: N.map((u) => {
560
- const $ = u.name ?? u.id;
557
+ S ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : b.length === 0 ? /* @__PURE__ */ e("p", { children: "No tokens yet." }) : /* @__PURE__ */ e("ul", { children: b.map((c) => {
558
+ const j = c.name ?? c.id;
561
559
  return /* @__PURE__ */ n("li", { children: [
562
- /* @__PURE__ */ e("span", { children: $ }),
563
- /* @__PURE__ */ e("span", { className: "token-meta", children: M(u, Date.now()) }),
564
- u.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
560
+ /* @__PURE__ */ e("span", { children: j }),
561
+ /* @__PURE__ */ e("span", { className: "token-meta", children: Z(c, Date.now()) }),
562
+ c.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
565
563
  "button",
566
564
  {
567
565
  type: "button",
568
- "aria-label": `Revoke token ${$}`,
569
- onClick: () => void B(u.id),
570
- disabled: y === u.id,
566
+ "aria-label": `Revoke token ${j}`,
567
+ onClick: () => void R(c.id),
568
+ disabled: L === c.id,
571
569
  children: "Revoke"
572
570
  }
573
571
  )
574
- ] }, u.id);
572
+ ] }, c.id);
575
573
  }) })
576
574
  ] })
577
575
  ] });
578
576
  }
579
- const te = [
577
+ const ne = [
580
578
  { id: "general", label: "General" },
581
579
  { id: "members", label: "Members" },
582
580
  { id: "agent", label: "Agent" }
583
581
  ];
584
- function ae({
585
- workspace: t,
586
- hubUrl: i,
587
- membersRefreshKey: r,
588
- onMembersChanged: p,
582
+ function te({
583
+ workspace: i,
584
+ hubUrl: t,
585
+ membersRefreshKey: d,
586
+ onMembersChanged: v,
589
587
  onLeft: o
590
588
  }) {
591
- const [h, v] = a("general"), m = t.role === "admin";
589
+ const [h, m] = a("general"), p = i.role === "admin";
592
590
  return /* @__PURE__ */ n("div", { className: "config-layout", children: [
593
- /* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children: te.map(({ id: l, label: f }) => /* @__PURE__ */ e(
591
+ /* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children: ne.map(({ id: l, label: y }) => /* @__PURE__ */ e(
594
592
  "button",
595
593
  {
596
594
  type: "button",
597
595
  className: "config-nav__item" + (h === l ? " config-nav__item--on" : ""),
598
596
  "aria-current": h === l ? "page" : void 0,
599
- onClick: () => v(l),
600
- children: f
597
+ onClick: () => m(l),
598
+ children: y
601
599
  },
602
600
  l
603
601
  )) }),
604
602
  /* @__PURE__ */ n("div", { className: "config-panel", children: [
605
- h === "general" && /* @__PURE__ */ e(V, { workspace: t, onLeft: o }),
606
- h === "members" && /* @__PURE__ */ n(H, { children: [
603
+ h === "general" && /* @__PURE__ */ e(J, { workspace: i, onLeft: o }),
604
+ h === "members" && /* @__PURE__ */ n(F, { children: [
607
605
  /* @__PURE__ */ e(
608
- X,
606
+ V,
609
607
  {
610
- workspaceId: t.id,
611
- refreshKey: r,
612
- canRemove: m
608
+ workspaceId: i.id,
609
+ refreshKey: d,
610
+ canRemove: p
613
611
  }
614
612
  ),
615
- m && /* @__PURE__ */ e(q, { workspaceId: t.id, onMembersChanged: p })
613
+ p && /* @__PURE__ */ e(X, { workspaceId: i.id, onMembersChanged: v })
616
614
  ] }),
617
- h === "agent" && /* @__PURE__ */ e(ne, { workspaceId: t.id, hubUrl: i })
615
+ h === "agent" && /* @__PURE__ */ e(ee, { hubUrl: t })
618
616
  ] })
619
617
  ] });
620
618
  }
621
- function se({ hubUrl: t }) {
622
- const i = A(), [r, p] = a({ status: "loading" }), [o, h] = a(null), [v, m] = a(0), l = Y(async () => {
619
+ function re({ hubUrl: i }) {
620
+ const t = A(), [d, v] = a({ status: "loading" }), [o, h] = a(null), [m, p] = a(0), l = K(async () => {
623
621
  try {
624
- const c = await i.listWorkspaces();
625
- p({ status: "ready", workspaces: c.workspaces }), h(
622
+ const u = await t.listWorkspaces();
623
+ v({ status: "ready", workspaces: u.workspaces }), h(
626
624
  (C) => {
627
625
  var E;
628
- return C && c.workspaces.some((d) => d.id === C) ? C : ((E = c.workspaces[0]) == null ? void 0 : E.id) ?? null;
626
+ return C && u.workspaces.some((r) => r.id === C) ? C : ((E = u.workspaces[0]) == null ? void 0 : E.id) ?? null;
629
627
  }
630
628
  );
631
- } catch (c) {
632
- p({ status: "error", message: I(c) });
629
+ } catch (u) {
630
+ v({ status: "error", message: I(u) });
633
631
  }
634
- }, [i]);
635
- j(() => {
632
+ }, [t]);
633
+ U(() => {
636
634
  l();
637
635
  }, [l]);
638
- const f = r.status === "ready" ? r.workspaces : [], b = f.find((c) => c.id === o) ?? null;
639
- if (r.status === "loading")
636
+ const y = d.status === "ready" ? d.workspaces : [], b = y.find((u) => u.id === o) ?? null;
637
+ if (d.status === "loading")
640
638
  return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) });
641
- if (r.status === "error")
642
- return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: r.message }) });
643
- const N = f.length > 0, g = /* @__PURE__ */ e(
644
- J,
639
+ if (d.status === "error")
640
+ return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: d.message }) });
641
+ const w = y.length > 0, g = /* @__PURE__ */ e(
642
+ Y,
645
643
  {
646
- workspaces: f,
644
+ workspaces: y,
647
645
  selected: b,
648
646
  onSelect: h,
649
647
  onChanged: () => {
650
648
  l();
651
649
  },
652
- onMembersChanged: () => m((c) => c + 1)
650
+ onMembersChanged: () => p((u) => u + 1)
653
651
  }
654
- ), w = /* @__PURE__ */ n("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
652
+ ), N = /* @__PURE__ */ n("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
655
653
  /* @__PURE__ */ e("h2", { id: "config-heading", children: "Configuration" }),
656
654
  b ? /* @__PURE__ */ e(
657
- ae,
655
+ te,
658
656
  {
659
657
  workspace: b,
660
- hubUrl: t,
661
- membersRefreshKey: v,
662
- onMembersChanged: () => m((c) => c + 1),
658
+ hubUrl: i,
659
+ membersRefreshKey: m,
660
+ onMembersChanged: () => p((u) => u + 1),
663
661
  onLeft: () => void l()
664
662
  }
665
663
  ) : /* @__PURE__ */ n("p", { className: "config-none", children: [
@@ -669,28 +667,28 @@ function se({ hubUrl: t }) {
669
667
  ] })
670
668
  ] });
671
669
  return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e(
672
- P,
670
+ G,
673
671
  {
674
672
  workspaceId: b == null ? void 0 : b.id,
675
- config: w,
673
+ config: N,
676
674
  switcher: g,
677
- hasWorkspace: N
675
+ hasWorkspace: w
678
676
  }
679
677
  ) });
680
678
  }
681
679
  export {
682
- ae as ConfigPanel,
683
- ne as ConnectAgent,
684
- P as Dashboard,
685
- de as EmptyState,
686
- V as GeneralSettings,
687
- q as Invites,
688
- X as Members,
689
- ue as ShepherdClientError,
690
- he as ShepherdClientProvider,
691
- se as ShepherdRoot,
692
- J as WorkspaceSwitcher,
693
- me as createShepherdClient,
680
+ te as ConfigPanel,
681
+ ee as ConnectAgent,
682
+ G as Dashboard,
683
+ ce as EmptyState,
684
+ J as GeneralSettings,
685
+ X as Invites,
686
+ V as Members,
687
+ de as ShepherdClientError,
688
+ ue as ShepherdClientProvider,
689
+ re as ShepherdRoot,
690
+ Y as WorkspaceSwitcher,
691
+ he as createShepherdClient,
694
692
  I as describeError,
695
693
  A as useShepherdClient
696
694
  };