@korso/shepherd-ui 0.2.0 → 0.2.2

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