@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.
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-qipRa5MO.js";
2
+ import { E as ce, S as de, a as ue, c as he } from "./Dashboard-qipRa5MO.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.email ?? 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,99 @@ 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 = {
400
- claude: "claude mcp add shepherd -s user \\",
401
- codex: "codex mcp add shepherd \\",
402
- pi: "pi mcp add shepherd \\"
399
+ ], z = "shp_<paste-after-generating>", Q = {
400
+ claude: "claude mcp add shepherd -s user",
401
+ codex: "codex mcp add shepherd",
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} \\`,
425
- " -- npx -y @korso/shepherd"
426
- ].join(`
427
- `);
422
+ Q[i],
423
+ `-e HUB_URL=${t}`,
424
+ `-e SHEPHERD_TOKEN=${d}`,
425
+ "-- npx -y @korso/shepherd"
426
+ ].join(" ");
428
427
  }
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() {
428
+ function ee({ hubUrl: i }) {
429
+ 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);
430
+ async function T() {
432
431
  try {
433
- const u = await r.listTokens(t);
434
- g(u.tokens);
435
- } catch (u) {
436
- c(I(u));
432
+ const c = await t.listAccountTokens();
433
+ w(c.tokens);
434
+ } catch (c) {
435
+ N(I(c));
437
436
  } finally {
438
- L(!1);
437
+ x(!1);
439
438
  }
440
439
  }
441
- j(() => {
442
- L(!0), s();
443
- }, [r, t]), j(() => {
444
- b(null);
440
+ U(() => {
441
+ x(!0), T();
445
442
  }, [t]);
446
- async function R() {
447
- k(!0), c(null);
443
+ async function s() {
444
+ r(!0), N(null);
448
445
  try {
449
- const u = await r.mintToken(
450
- t,
446
+ const c = await t.mintAccountToken(
451
447
  m.trim() ? { name: m.trim() } : {}
452
448
  );
453
- b(u.token), l(""), await s();
454
- } catch (u) {
455
- c(I(u));
449
+ y(c.token), p(""), await T();
450
+ } catch (c) {
451
+ N(I(c));
456
452
  } finally {
457
- k(!1);
453
+ r(!1);
458
454
  }
459
455
  }
460
- async function B(u) {
461
- if (!y) {
462
- T(u), c(null), E(null);
456
+ async function R(c) {
457
+ if (!L) {
458
+ f(c), N(null), C(null);
463
459
  try {
464
- await r.revokeToken(t, u), g(($) => $.filter((G) => G.id !== u)), E("Token revoked");
465
- } catch ($) {
466
- c(I($));
460
+ await t.revokeAccountToken(c), w((j) => j.filter((W) => W.id !== c)), C("Token revoked");
461
+ } catch (j) {
462
+ N(I(j));
467
463
  } finally {
468
- T(null);
464
+ f(null);
469
465
  }
470
466
  }
471
467
  }
472
- const O = ee(h, p, f ?? Q);
473
- async function W() {
474
- await navigator.clipboard.writeText(O), S(!0), setTimeout(() => S(!1), 2e3);
468
+ const $ = M(o, d, l ?? z);
469
+ async function H() {
470
+ await navigator.clipboard.writeText($), _(!0), setTimeout(() => _(!1), 2e3);
475
471
  }
476
- return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby": o, children: [
472
+ return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby": v, children: [
477
473
  /* @__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." })
474
+ /* @__PURE__ */ e("h3", { id: v, children: "Connect your agent" }),
475
+ /* @__PURE__ */ e("p", { className: "card-sub", children: "Generate a token — it works across all your workspaces — then paste the command into your coding tool." }),
476
+ /* @__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
477
  ] }),
481
478
  /* @__PURE__ */ n("div", { className: "card-body", children: [
482
479
  /* @__PURE__ */ n("div", { className: "field", children: [
@@ -485,9 +482,9 @@ function ne({ workspaceId: t, hubUrl: i }) {
485
482
  "select",
486
483
  {
487
484
  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))
485
+ value: o,
486
+ onChange: (c) => h(c.target.value),
487
+ children: q.map((c) => /* @__PURE__ */ e("option", { value: c.id, children: c.label }, c.id))
491
488
  }
492
489
  )
493
490
  ] }),
@@ -500,27 +497,27 @@ function ne({ workspaceId: t, hubUrl: i }) {
500
497
  id: "token-name",
501
498
  type: "text",
502
499
  value: m,
503
- onChange: (u) => l(u.target.value),
500
+ onChange: (c) => p(c.target.value),
504
501
  placeholder: "e.g. laptop"
505
502
  }
506
503
  ),
507
- /* @__PURE__ */ e("button", { type: "button", onClick: () => void R(), disabled: d, children: "Generate token" })
504
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => void s(), disabled: E, children: "Generate token" })
508
505
  ] })
509
506
  ] }),
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." }),
507
+ g && /* @__PURE__ */ e("p", { role: "alert", children: g }),
508
+ u && /* @__PURE__ */ e("p", { role: "status", children: u }),
509
+ l && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
513
510
  /* @__PURE__ */ n("div", { className: "install-command", children: [
514
- /* @__PURE__ */ e("pre", { "data-testid": "install-command", children: O }),
511
+ /* @__PURE__ */ e("pre", { "data-testid": "install-command", children: $ }),
515
512
  /* @__PURE__ */ e(
516
513
  "button",
517
514
  {
518
515
  type: "button",
519
516
  className: "install-command__copy",
520
- "aria-label": _ ? "Copied" : "Copy command",
521
- title: _ ? "Copied" : "Copy",
522
- onClick: () => void W(),
523
- children: _ ? /* @__PURE__ */ e(
517
+ "aria-label": k ? "Copied" : "Copy command",
518
+ title: k ? "Copied" : "Copy",
519
+ onClick: () => void H(),
520
+ children: k ? /* @__PURE__ */ e(
524
521
  "svg",
525
522
  {
526
523
  width: "15",
@@ -556,110 +553,110 @@ function ne({ workspaceId: t, hubUrl: i }) {
556
553
  )
557
554
  ] }),
558
555
  /* @__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;
556
+ 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) => {
557
+ const j = c.name ?? c.id;
561
558
  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(
559
+ /* @__PURE__ */ e("span", { children: j }),
560
+ /* @__PURE__ */ e("span", { className: "token-meta", children: Z(c, Date.now()) }),
561
+ c.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
565
562
  "button",
566
563
  {
567
564
  type: "button",
568
- "aria-label": `Revoke token ${$}`,
569
- onClick: () => void B(u.id),
570
- disabled: y === u.id,
565
+ "aria-label": `Revoke token ${j}`,
566
+ onClick: () => void R(c.id),
567
+ disabled: L === c.id,
571
568
  children: "Revoke"
572
569
  }
573
570
  )
574
- ] }, u.id);
571
+ ] }, c.id);
575
572
  }) })
576
573
  ] })
577
574
  ] });
578
575
  }
579
- const te = [
576
+ const ne = [
580
577
  { id: "general", label: "General" },
581
578
  { id: "members", label: "Members" },
582
579
  { id: "agent", label: "Agent" }
583
580
  ];
584
- function ae({
585
- workspace: t,
586
- hubUrl: i,
587
- membersRefreshKey: r,
588
- onMembersChanged: p,
581
+ function te({
582
+ workspace: i,
583
+ hubUrl: t,
584
+ membersRefreshKey: d,
585
+ onMembersChanged: v,
589
586
  onLeft: o
590
587
  }) {
591
- const [h, v] = a("general"), m = t.role === "admin";
588
+ const [h, m] = a("general"), p = i.role === "admin";
592
589
  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(
590
+ /* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children: ne.map(({ id: l, label: y }) => /* @__PURE__ */ e(
594
591
  "button",
595
592
  {
596
593
  type: "button",
597
594
  className: "config-nav__item" + (h === l ? " config-nav__item--on" : ""),
598
595
  "aria-current": h === l ? "page" : void 0,
599
- onClick: () => v(l),
600
- children: f
596
+ onClick: () => m(l),
597
+ children: y
601
598
  },
602
599
  l
603
600
  )) }),
604
601
  /* @__PURE__ */ n("div", { className: "config-panel", children: [
605
- h === "general" && /* @__PURE__ */ e(V, { workspace: t, onLeft: o }),
606
- h === "members" && /* @__PURE__ */ n(H, { children: [
602
+ h === "general" && /* @__PURE__ */ e(J, { workspace: i, onLeft: o }),
603
+ h === "members" && /* @__PURE__ */ n(F, { children: [
607
604
  /* @__PURE__ */ e(
608
- X,
605
+ V,
609
606
  {
610
- workspaceId: t.id,
611
- refreshKey: r,
612
- canRemove: m
607
+ workspaceId: i.id,
608
+ refreshKey: d,
609
+ canRemove: p
613
610
  }
614
611
  ),
615
- m && /* @__PURE__ */ e(q, { workspaceId: t.id, onMembersChanged: p })
612
+ p && /* @__PURE__ */ e(X, { workspaceId: i.id, onMembersChanged: v })
616
613
  ] }),
617
- h === "agent" && /* @__PURE__ */ e(ne, { workspaceId: t.id, hubUrl: i })
614
+ h === "agent" && /* @__PURE__ */ e(ee, { hubUrl: t })
618
615
  ] })
619
616
  ] });
620
617
  }
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 () => {
618
+ function re({ hubUrl: i }) {
619
+ const t = A(), [d, v] = a({ status: "loading" }), [o, h] = a(null), [m, p] = a(0), l = K(async () => {
623
620
  try {
624
- const c = await i.listWorkspaces();
625
- p({ status: "ready", workspaces: c.workspaces }), h(
621
+ const u = await t.listWorkspaces();
622
+ v({ status: "ready", workspaces: u.workspaces }), h(
626
623
  (C) => {
627
624
  var E;
628
- return C && c.workspaces.some((d) => d.id === C) ? C : ((E = c.workspaces[0]) == null ? void 0 : E.id) ?? null;
625
+ return C && u.workspaces.some((r) => r.id === C) ? C : ((E = u.workspaces[0]) == null ? void 0 : E.id) ?? null;
629
626
  }
630
627
  );
631
- } catch (c) {
632
- p({ status: "error", message: I(c) });
628
+ } catch (u) {
629
+ v({ status: "error", message: I(u) });
633
630
  }
634
- }, [i]);
635
- j(() => {
631
+ }, [t]);
632
+ U(() => {
636
633
  l();
637
634
  }, [l]);
638
- const f = r.status === "ready" ? r.workspaces : [], b = f.find((c) => c.id === o) ?? null;
639
- if (r.status === "loading")
635
+ const y = d.status === "ready" ? d.workspaces : [], b = y.find((u) => u.id === o) ?? null;
636
+ if (d.status === "loading")
640
637
  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,
638
+ if (d.status === "error")
639
+ return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: d.message }) });
640
+ const w = y.length > 0, g = /* @__PURE__ */ e(
641
+ Y,
645
642
  {
646
- workspaces: f,
643
+ workspaces: y,
647
644
  selected: b,
648
645
  onSelect: h,
649
646
  onChanged: () => {
650
647
  l();
651
648
  },
652
- onMembersChanged: () => m((c) => c + 1)
649
+ onMembersChanged: () => p((u) => u + 1)
653
650
  }
654
- ), w = /* @__PURE__ */ n("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
651
+ ), N = /* @__PURE__ */ n("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
655
652
  /* @__PURE__ */ e("h2", { id: "config-heading", children: "Configuration" }),
656
653
  b ? /* @__PURE__ */ e(
657
- ae,
654
+ te,
658
655
  {
659
656
  workspace: b,
660
- hubUrl: t,
661
- membersRefreshKey: v,
662
- onMembersChanged: () => m((c) => c + 1),
657
+ hubUrl: i,
658
+ membersRefreshKey: m,
659
+ onMembersChanged: () => p((u) => u + 1),
663
660
  onLeft: () => void l()
664
661
  }
665
662
  ) : /* @__PURE__ */ n("p", { className: "config-none", children: [
@@ -669,28 +666,28 @@ function se({ hubUrl: t }) {
669
666
  ] })
670
667
  ] });
671
668
  return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e(
672
- P,
669
+ G,
673
670
  {
674
671
  workspaceId: b == null ? void 0 : b.id,
675
- config: w,
672
+ config: N,
676
673
  switcher: g,
677
- hasWorkspace: N
674
+ hasWorkspace: w
678
675
  }
679
676
  ) });
680
677
  }
681
678
  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,
679
+ te as ConfigPanel,
680
+ ee as ConnectAgent,
681
+ G as Dashboard,
682
+ ce as EmptyState,
683
+ J as GeneralSettings,
684
+ X as Invites,
685
+ V as Members,
686
+ de as ShepherdClientError,
687
+ ue as ShepherdClientProvider,
688
+ re as ShepherdRoot,
689
+ Y as WorkspaceSwitcher,
690
+ he as createShepherdClient,
694
691
  I as describeError,
695
692
  A as useShepherdClient
696
693
  };