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