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