@korso/shepherd-ui 0.5.0 → 0.6.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 +1 -1
- package/dist/client.d.ts +3 -1
- package/dist/client.js +13 -4
- package/dist/config/ConfigPanel.d.ts +3 -1
- package/dist/config/ConfigPanel.js +2 -2
- package/dist/config/ConfirmDeleteWorkspace.d.ts +13 -0
- package/dist/config/ConfirmDeleteWorkspace.js +28 -0
- package/dist/config/ConnectAgent.js +13 -10
- package/dist/config/GeneralSettings.d.ts +3 -1
- package/dist/config/GeneralSettings.js +41 -3
- package/dist/config/Members.js +1 -1
- package/dist/lib/{Dashboard-C48qY8R2.js → Dashboard-D7tbhMwK.js} +313 -307
- package/dist/lib/index.d.ts +26 -2
- package/dist/lib/index.js +426 -306
- package/dist/lib/selfhost.js +1 -1
- package/dist/lib/styles.css +35 -3
- package/dist/preview.js +7 -3
- package/dist/selfhost/assets/{index-adPvx18g.js → index-B_B7vc7a.js} +7 -7
- package/dist/selfhost/assets/{index-CK7qrsNo.css → index-C78oV7tm.css} +1 -1
- package/dist/selfhost/index.html +2 -2
- package/dist/test/mockClient.js +1 -0
- package/package.json +1 -1
package/dist/lib/index.js
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { E as
|
|
3
|
-
import { jsxs as n, jsx as e, Fragment as
|
|
4
|
-
import { useId as
|
|
5
|
-
function
|
|
6
|
-
return (
|
|
1
|
+
import { u as B, d as S, S as G, f as O, D as K } from "./Dashboard-D7tbhMwK.js";
|
|
2
|
+
import { E as ue, a as he, c as me } from "./Dashboard-D7tbhMwK.js";
|
|
3
|
+
import { jsxs as n, jsx as e, Fragment as W } from "react/jsx-runtime";
|
|
4
|
+
import { useId as $, useRef as F, useState as i, useEffect as A, useCallback as Y } from "react";
|
|
5
|
+
function U(a) {
|
|
6
|
+
return (a.trim()[0] ?? "?").toUpperCase();
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
workspaces:
|
|
8
|
+
function J({
|
|
9
|
+
workspaces: a,
|
|
10
10
|
selected: t,
|
|
11
|
-
onSelect:
|
|
12
|
-
onChanged:
|
|
13
|
-
onMembersChanged:
|
|
11
|
+
onSelect: o,
|
|
12
|
+
onChanged: y,
|
|
13
|
+
onMembersChanged: l
|
|
14
14
|
}) {
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
|
|
15
|
+
const b = B(), c = $(), f = F(null), [r, v] = i(!1), [h, m] = i("menu"), [g, k] = i(""), [u, _] = i(""), [E, s] = i(null), [N, I] = i(!1);
|
|
16
|
+
function C() {
|
|
17
|
+
v(!1), m("menu"), k(""), _(""), s(null);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
if (!
|
|
21
|
-
function
|
|
22
|
-
|
|
19
|
+
A(() => {
|
|
20
|
+
if (!r) return;
|
|
21
|
+
function d(j) {
|
|
22
|
+
f.current && !f.current.contains(j.target) && C();
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
24
|
+
function x(j) {
|
|
25
|
+
j.key === "Escape" && C();
|
|
26
26
|
}
|
|
27
|
-
return document.addEventListener("mousedown",
|
|
28
|
-
document.removeEventListener("mousedown",
|
|
27
|
+
return document.addEventListener("mousedown", d), document.addEventListener("keydown", x), () => {
|
|
28
|
+
document.removeEventListener("mousedown", d), document.removeEventListener("keydown", x);
|
|
29
29
|
};
|
|
30
|
-
}, [
|
|
31
|
-
async function
|
|
32
|
-
if (!(!g.trim() ||
|
|
33
|
-
|
|
30
|
+
}, [r]);
|
|
31
|
+
async function T() {
|
|
32
|
+
if (!(!g.trim() || N)) {
|
|
33
|
+
I(!0), s(null);
|
|
34
34
|
try {
|
|
35
|
-
const
|
|
36
|
-
d
|
|
37
|
-
} catch (
|
|
38
|
-
|
|
35
|
+
const d = await b.createWorkspace({ name: g.trim() });
|
|
36
|
+
o(d.id), y(), C();
|
|
37
|
+
} catch (d) {
|
|
38
|
+
s(S(d));
|
|
39
39
|
} finally {
|
|
40
|
-
|
|
40
|
+
I(!1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
async function
|
|
45
|
-
if (!(!u.trim() ||
|
|
46
|
-
|
|
44
|
+
async function R() {
|
|
45
|
+
if (!(!u.trim() || N)) {
|
|
46
|
+
I(!0), s(null);
|
|
47
47
|
try {
|
|
48
|
-
const
|
|
49
|
-
d
|
|
50
|
-
} catch (
|
|
51
|
-
|
|
48
|
+
const d = await b.redeemInvite(u.trim());
|
|
49
|
+
o(d.workspace.id), y(), l == null || l(), C();
|
|
50
|
+
} catch (d) {
|
|
51
|
+
s(S(d));
|
|
52
52
|
} finally {
|
|
53
|
-
|
|
53
|
+
I(!1);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */ n("div", { className: "ws-switcher", ref:
|
|
57
|
+
const w = t !== null, L = t ? t.name : "Get started";
|
|
58
|
+
return /* @__PURE__ */ n("div", { className: "ws-switcher", ref: f, children: [
|
|
59
59
|
/* @__PURE__ */ n(
|
|
60
60
|
"button",
|
|
61
61
|
{
|
|
62
62
|
type: "button",
|
|
63
|
-
className: "ws-trig" + (
|
|
63
|
+
className: "ws-trig" + (w ? "" : " ws-trig--empty"),
|
|
64
64
|
"aria-haspopup": "menu",
|
|
65
|
-
"aria-expanded":
|
|
66
|
-
"aria-controls":
|
|
67
|
-
onClick: () =>
|
|
65
|
+
"aria-expanded": r,
|
|
66
|
+
"aria-controls": r ? c : void 0,
|
|
67
|
+
onClick: () => r ? C() : v(!0),
|
|
68
68
|
children: [
|
|
69
|
-
|
|
70
|
-
/* @__PURE__ */ e("span", { className: "ws-name", children:
|
|
69
|
+
w ? /* @__PURE__ */ e("span", { className: "ws-avatar", "aria-hidden": "true", children: U(L) }) : /* @__PURE__ */ e("span", { className: "ws-plus", "aria-hidden": "true", children: "+" }),
|
|
70
|
+
/* @__PURE__ */ e("span", { className: "ws-name", children: L }),
|
|
71
71
|
/* @__PURE__ */ e("span", { className: "ws-caret", "aria-hidden": "true", children: "▾" })
|
|
72
72
|
]
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/* @__PURE__ */ e("p", { className: "ws-menu__head", children:
|
|
78
|
-
|
|
79
|
-
const
|
|
75
|
+
r && /* @__PURE__ */ n("div", { className: "ws-menu", id: c, role: "menu", children: [
|
|
76
|
+
h === "menu" && /* @__PURE__ */ n(W, { children: [
|
|
77
|
+
/* @__PURE__ */ e("p", { className: "ws-menu__head", children: w ? "Switch workspace" : "Your workspaces" }),
|
|
78
|
+
a.length === 0 ? /* @__PURE__ */ e("p", { className: "ws-menu__none", children: "None yet" }) : /* @__PURE__ */ e("ul", { className: "ws-menu__list", children: a.map((d) => {
|
|
79
|
+
const x = d.id === (t == null ? void 0 : t.id);
|
|
80
80
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
|
|
81
81
|
"button",
|
|
82
82
|
{
|
|
83
83
|
type: "button",
|
|
84
84
|
role: "menuitemradio",
|
|
85
|
-
"aria-checked":
|
|
86
|
-
className: "ws-mi" + (
|
|
85
|
+
"aria-checked": x,
|
|
86
|
+
className: "ws-mi" + (x ? " ws-mi--on" : ""),
|
|
87
87
|
onClick: () => {
|
|
88
|
-
d
|
|
88
|
+
o(d.id), C();
|
|
89
89
|
},
|
|
90
90
|
children: [
|
|
91
|
-
/* @__PURE__ */ e("span", { className: "ws-avatar ws-avatar--sm", "aria-hidden": "true", children:
|
|
92
|
-
/* @__PURE__ */ e("span", { className: "ws-mi__name", children:
|
|
93
|
-
|
|
91
|
+
/* @__PURE__ */ e("span", { className: "ws-avatar ws-avatar--sm", "aria-hidden": "true", children: U(d.name) }),
|
|
92
|
+
/* @__PURE__ */ e("span", { className: "ws-mi__name", children: d.name }),
|
|
93
|
+
x && /* @__PURE__ */ e("span", { className: "ws-mi__check", "aria-hidden": "true", children: "✓" })
|
|
94
94
|
]
|
|
95
95
|
}
|
|
96
|
-
) },
|
|
96
|
+
) }, d.id);
|
|
97
97
|
}) }),
|
|
98
98
|
/* @__PURE__ */ n("div", { className: "ws-menu__actions", children: [
|
|
99
99
|
/* @__PURE__ */ e(
|
|
@@ -103,7 +103,7 @@ function Y({
|
|
|
103
103
|
role: "menuitem",
|
|
104
104
|
className: "ws-action",
|
|
105
105
|
onClick: () => {
|
|
106
|
-
|
|
106
|
+
s(null), m("create");
|
|
107
107
|
},
|
|
108
108
|
children: "+ Create workspace"
|
|
109
109
|
}
|
|
@@ -115,63 +115,63 @@ function Y({
|
|
|
115
115
|
role: "menuitem",
|
|
116
116
|
className: "ws-action",
|
|
117
117
|
onClick: () => {
|
|
118
|
-
|
|
118
|
+
s(null), m("join");
|
|
119
119
|
},
|
|
120
120
|
children: "⎘ Join with a code"
|
|
121
121
|
}
|
|
122
122
|
)
|
|
123
123
|
] })
|
|
124
124
|
] }),
|
|
125
|
-
|
|
125
|
+
h === "create" && /* @__PURE__ */ n(
|
|
126
126
|
"form",
|
|
127
127
|
{
|
|
128
128
|
className: "ws-form",
|
|
129
|
-
onSubmit: (
|
|
130
|
-
|
|
129
|
+
onSubmit: (d) => {
|
|
130
|
+
d.preventDefault(), T();
|
|
131
131
|
},
|
|
132
132
|
children: [
|
|
133
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
133
|
+
/* @__PURE__ */ e("label", { htmlFor: `${c}-name`, children: "New workspace name" }),
|
|
134
134
|
/* @__PURE__ */ e(
|
|
135
135
|
"input",
|
|
136
136
|
{
|
|
137
|
-
id: `${
|
|
137
|
+
id: `${c}-name`,
|
|
138
138
|
type: "text",
|
|
139
139
|
placeholder: "e.g. Acme Engineering",
|
|
140
140
|
value: g,
|
|
141
141
|
autoFocus: !0,
|
|
142
|
-
onChange: (
|
|
142
|
+
onChange: (d) => k(d.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: () =>
|
|
147
|
-
/* @__PURE__ */ e("button", { type: "submit", disabled:
|
|
146
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => m("menu"), children: "Back" }),
|
|
147
|
+
/* @__PURE__ */ e("button", { type: "submit", disabled: N || !g.trim(), children: "Create" })
|
|
148
148
|
] })
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
151
|
),
|
|
152
|
-
|
|
152
|
+
h === "join" && /* @__PURE__ */ n(
|
|
153
153
|
"form",
|
|
154
154
|
{
|
|
155
155
|
className: "ws-form",
|
|
156
|
-
onSubmit: (
|
|
157
|
-
|
|
156
|
+
onSubmit: (d) => {
|
|
157
|
+
d.preventDefault(), R();
|
|
158
158
|
},
|
|
159
159
|
children: [
|
|
160
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
160
|
+
/* @__PURE__ */ e("label", { htmlFor: `${c}-code`, children: "Invite code" }),
|
|
161
161
|
/* @__PURE__ */ e(
|
|
162
162
|
"input",
|
|
163
163
|
{
|
|
164
|
-
id: `${
|
|
164
|
+
id: `${c}-code`,
|
|
165
165
|
type: "text",
|
|
166
166
|
placeholder: "Paste an invite code",
|
|
167
167
|
value: u,
|
|
168
168
|
autoFocus: !0,
|
|
169
|
-
onChange: (
|
|
169
|
+
onChange: (d) => _(d.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: () =>
|
|
174
|
-
/* @__PURE__ */ e("button", { type: "submit", disabled:
|
|
173
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => m("menu"), children: "Back" }),
|
|
174
|
+
/* @__PURE__ */ e("button", { type: "submit", disabled: N || !u.trim(), children: "Join" })
|
|
175
175
|
] })
|
|
176
176
|
]
|
|
177
177
|
}
|
|
@@ -180,195 +180,314 @@ function Y({
|
|
|
180
180
|
] })
|
|
181
181
|
] });
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
function V({
|
|
184
|
+
workspaceName: a,
|
|
185
|
+
busy: t,
|
|
186
|
+
error: o,
|
|
187
|
+
onConfirm: y,
|
|
188
|
+
onCancel: l
|
|
189
|
+
}) {
|
|
190
|
+
const b = $(), c = $(), [f, r] = i(""), v = F(null);
|
|
191
|
+
A(() => {
|
|
192
|
+
var m;
|
|
193
|
+
(m = v.current) == null || m.focus();
|
|
194
|
+
}, []), A(() => {
|
|
195
|
+
function m(g) {
|
|
196
|
+
g.key === "Escape" && !t && l();
|
|
197
|
+
}
|
|
198
|
+
return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
|
|
199
|
+
}, [t, l]);
|
|
200
|
+
const h = f === a;
|
|
201
|
+
return /* @__PURE__ */ e(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
className: "shepherd-modal__backdrop",
|
|
205
|
+
onClick: () => {
|
|
206
|
+
t || l();
|
|
207
|
+
},
|
|
208
|
+
children: /* @__PURE__ */ n(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
className: "shepherd-modal",
|
|
212
|
+
role: "dialog",
|
|
213
|
+
"aria-modal": "true",
|
|
214
|
+
"aria-labelledby": b,
|
|
215
|
+
"aria-describedby": c,
|
|
216
|
+
onClick: (m) => m.stopPropagation(),
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ e("h3", { id: b, children: "Delete workspace" }),
|
|
219
|
+
/* @__PURE__ */ n("p", { id: c, className: "shepherd-modal__body", children: [
|
|
220
|
+
"This permanently deletes ",
|
|
221
|
+
/* @__PURE__ */ e("b", { children: a }),
|
|
222
|
+
" and all of its data — agents, sessions, tasks, announcements, change history, tokens, invites, and members. This cannot be undone."
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ n("label", { htmlFor: `${b}-input`, className: "shepherd-modal__label", children: [
|
|
225
|
+
"Type ",
|
|
226
|
+
/* @__PURE__ */ e("b", { children: a }),
|
|
227
|
+
" to confirm"
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ e(
|
|
230
|
+
"input",
|
|
231
|
+
{
|
|
232
|
+
id: `${b}-input`,
|
|
233
|
+
ref: v,
|
|
234
|
+
type: "text",
|
|
235
|
+
value: f,
|
|
236
|
+
autoComplete: "off",
|
|
237
|
+
disabled: t,
|
|
238
|
+
onChange: (m) => r(m.target.value)
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
o && /* @__PURE__ */ e("p", { role: "alert", children: o }),
|
|
242
|
+
/* @__PURE__ */ n("div", { className: "shepherd-modal__actions", children: [
|
|
243
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: l, disabled: t, children: "Cancel" }),
|
|
244
|
+
/* @__PURE__ */ e(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
type: "button",
|
|
248
|
+
className: "danger",
|
|
249
|
+
onClick: y,
|
|
250
|
+
disabled: !h || t,
|
|
251
|
+
children: t ? "Deleting…" : "Delete workspace"
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
] })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
function X({ workspace: a, onLeft: t, onDeleted: o }) {
|
|
262
|
+
const y = B(), l = $(), [b, c] = i(null), [f, r] = i(!1), [v, h] = i(!1), [m, g] = i(!1), [k, u] = i(!1), [_, E] = i(null), s = a.role === "admin";
|
|
263
|
+
async function N() {
|
|
264
|
+
if (!f) {
|
|
265
|
+
r(!0), c(null), h(!1);
|
|
188
266
|
try {
|
|
189
|
-
await
|
|
190
|
-
} catch (
|
|
191
|
-
|
|
267
|
+
await y.leave(a.id), t == null || t();
|
|
268
|
+
} catch (C) {
|
|
269
|
+
c(S(C)), C instanceof G && C.status === 409 && h(!0);
|
|
192
270
|
} finally {
|
|
193
|
-
|
|
271
|
+
r(!1);
|
|
194
272
|
}
|
|
195
273
|
}
|
|
196
274
|
}
|
|
197
|
-
|
|
275
|
+
async function I() {
|
|
276
|
+
if (!k) {
|
|
277
|
+
u(!0), E(null);
|
|
278
|
+
try {
|
|
279
|
+
await y.deleteWorkspace(a.id), g(!1), o == null || o();
|
|
280
|
+
} catch (C) {
|
|
281
|
+
E(S(C));
|
|
282
|
+
} finally {
|
|
283
|
+
u(!1);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-general", "aria-labelledby": l, children: [
|
|
198
288
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
199
|
-
/* @__PURE__ */ e("h3", { id:
|
|
289
|
+
/* @__PURE__ */ e("h3", { id: l, children: "General" }),
|
|
200
290
|
/* @__PURE__ */ e("p", { className: "card-sub", children: "Your active workspace and its settings." })
|
|
201
291
|
] }),
|
|
202
292
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
203
|
-
|
|
293
|
+
b && /* @__PURE__ */ e("p", { role: "alert", children: b }),
|
|
294
|
+
v && s && /* @__PURE__ */ e("p", { className: "helper", children: "You're the last admin, so you can't leave. To remove this workspace entirely, delete it below." }),
|
|
204
295
|
/* @__PURE__ */ n("div", { className: "field", children: [
|
|
205
296
|
/* @__PURE__ */ e("label", { children: "Workspace name" }),
|
|
206
|
-
/* @__PURE__ */ e("p", { className: "readonly-value", children:
|
|
297
|
+
/* @__PURE__ */ e("p", { className: "readonly-value", children: a.name })
|
|
207
298
|
] }),
|
|
208
299
|
/* @__PURE__ */ n("div", { className: "field", children: [
|
|
209
300
|
/* @__PURE__ */ e("label", { children: "Your role" }),
|
|
210
|
-
/* @__PURE__ */ e("p", { className: "readonly-value", children:
|
|
301
|
+
/* @__PURE__ */ e("p", { className: "readonly-value", children: a.role })
|
|
211
302
|
] }),
|
|
212
303
|
/* @__PURE__ */ n("div", { className: "field leave", children: [
|
|
213
304
|
/* @__PURE__ */ e("label", { children: "Leave workspace" }),
|
|
214
305
|
/* @__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
|
|
306
|
+
/* @__PURE__ */ e("button", { type: "button", className: "danger", onClick: () => void N(), disabled: f, children: "Leave workspace" })
|
|
307
|
+
] }),
|
|
308
|
+
s && /* @__PURE__ */ n("div", { className: "field delete", children: [
|
|
309
|
+
/* @__PURE__ */ e("label", { children: "Delete workspace" }),
|
|
310
|
+
/* @__PURE__ */ e("p", { className: "helper", children: "Permanently delete this workspace and all of its data. This cannot be undone." }),
|
|
311
|
+
/* @__PURE__ */ e(
|
|
312
|
+
"button",
|
|
313
|
+
{
|
|
314
|
+
type: "button",
|
|
315
|
+
className: "danger",
|
|
316
|
+
onClick: () => {
|
|
317
|
+
E(null), g(!0);
|
|
318
|
+
},
|
|
319
|
+
disabled: k,
|
|
320
|
+
children: "Delete workspace"
|
|
321
|
+
}
|
|
322
|
+
)
|
|
216
323
|
] })
|
|
217
|
-
] })
|
|
324
|
+
] }),
|
|
325
|
+
m && /* @__PURE__ */ e(
|
|
326
|
+
V,
|
|
327
|
+
{
|
|
328
|
+
workspaceName: a.name,
|
|
329
|
+
busy: k,
|
|
330
|
+
error: _,
|
|
331
|
+
onConfirm: () => void I(),
|
|
332
|
+
onCancel: () => {
|
|
333
|
+
k || g(!1);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
)
|
|
218
337
|
] });
|
|
219
338
|
}
|
|
220
|
-
function
|
|
221
|
-
const
|
|
222
|
-
async function
|
|
223
|
-
|
|
339
|
+
function q({ workspaceId: a, refreshKey: t = 0, canRemove: o = !1 }) {
|
|
340
|
+
const y = B(), l = $(), [b, c] = i([]), [f, r] = i(null), [v, h] = i(null), [m, g] = i(!0), [k, u] = i(null);
|
|
341
|
+
async function _({ keepError: s = !1 } = {}) {
|
|
342
|
+
s || r(null);
|
|
224
343
|
try {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
} catch (
|
|
228
|
-
|
|
344
|
+
const N = await y.listMembers(a);
|
|
345
|
+
c(N.members);
|
|
346
|
+
} catch (N) {
|
|
347
|
+
r(S(N));
|
|
229
348
|
} finally {
|
|
230
349
|
g(!1);
|
|
231
350
|
}
|
|
232
351
|
}
|
|
233
|
-
|
|
234
|
-
g(!0),
|
|
235
|
-
}, [
|
|
236
|
-
async function E(
|
|
237
|
-
if (!
|
|
238
|
-
u(
|
|
352
|
+
A(() => {
|
|
353
|
+
g(!0), _();
|
|
354
|
+
}, [y, a, t]);
|
|
355
|
+
async function E(s, N) {
|
|
356
|
+
if (!k) {
|
|
357
|
+
u(s), r(null), h(null), c((I) => I.filter((C) => C.accountId !== s));
|
|
239
358
|
try {
|
|
240
|
-
await
|
|
241
|
-
} catch (
|
|
242
|
-
|
|
359
|
+
await y.removeMember(a, s), h(`Removed ${N}`);
|
|
360
|
+
} catch (I) {
|
|
361
|
+
r(S(I)), _({ keepError: !0 });
|
|
243
362
|
} finally {
|
|
244
363
|
u(null);
|
|
245
364
|
}
|
|
246
365
|
}
|
|
247
366
|
}
|
|
248
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-members", "aria-labelledby":
|
|
249
|
-
/* @__PURE__ */ e("div", { className: "card-head", children: /* @__PURE__ */ e("h3", { id:
|
|
367
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-members", "aria-labelledby": l, children: [
|
|
368
|
+
/* @__PURE__ */ e("div", { className: "card-head", children: /* @__PURE__ */ e("h3", { id: l, children: "Members" }) }),
|
|
250
369
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const
|
|
370
|
+
f && /* @__PURE__ */ e("p", { role: "alert", children: f }),
|
|
371
|
+
v && /* @__PURE__ */ e("p", { role: "status", children: v }),
|
|
372
|
+
m ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : b.length === 0 ? /* @__PURE__ */ e("p", { children: "No members." }) : /* @__PURE__ */ e("ul", { children: b.map((s) => {
|
|
373
|
+
const N = s.displayName ?? s.githubLogin ?? s.email ?? s.accountId;
|
|
255
374
|
return /* @__PURE__ */ n("li", { children: [
|
|
256
|
-
/* @__PURE__ */ e("span", { children:
|
|
257
|
-
/* @__PURE__ */ e("span", { className: "role", children:
|
|
258
|
-
|
|
375
|
+
/* @__PURE__ */ e("span", { children: N }),
|
|
376
|
+
/* @__PURE__ */ e("span", { className: "role", children: s.role }),
|
|
377
|
+
o && /* @__PURE__ */ e(
|
|
259
378
|
"button",
|
|
260
379
|
{
|
|
261
380
|
type: "button",
|
|
262
|
-
"aria-label": `Remove ${
|
|
263
|
-
onClick: () => void E(
|
|
264
|
-
disabled:
|
|
381
|
+
"aria-label": `Remove ${N}`,
|
|
382
|
+
onClick: () => void E(s.accountId, N),
|
|
383
|
+
disabled: k === s.accountId,
|
|
265
384
|
children: "Remove"
|
|
266
385
|
}
|
|
267
386
|
)
|
|
268
|
-
] },
|
|
387
|
+
] }, s.accountId);
|
|
269
388
|
}) })
|
|
270
389
|
] })
|
|
271
390
|
] });
|
|
272
391
|
}
|
|
273
|
-
function
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}, [
|
|
278
|
-
async function
|
|
279
|
-
if (!
|
|
280
|
-
|
|
392
|
+
function z({ workspaceId: a, onMembersChanged: t }) {
|
|
393
|
+
const o = B(), y = $(), [l, b] = i(null), [c, f] = i(null), [r, v] = i(!1), [h, m] = i(""), [g, k] = i(null), [u, _] = i(!1), [E, s] = i(null);
|
|
394
|
+
A(() => {
|
|
395
|
+
b(null), k(null);
|
|
396
|
+
}, [a]);
|
|
397
|
+
async function N() {
|
|
398
|
+
if (!r) {
|
|
399
|
+
v(!0), f(null);
|
|
281
400
|
try {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
} catch (
|
|
285
|
-
|
|
401
|
+
const w = await o.createInvite(a, {});
|
|
402
|
+
b(w), t == null || t();
|
|
403
|
+
} catch (w) {
|
|
404
|
+
f(S(w));
|
|
286
405
|
} finally {
|
|
287
|
-
|
|
406
|
+
v(!1);
|
|
288
407
|
}
|
|
289
408
|
}
|
|
290
409
|
}
|
|
291
|
-
async function
|
|
292
|
-
if (!(!
|
|
293
|
-
|
|
410
|
+
async function I() {
|
|
411
|
+
if (!(!l || r)) {
|
|
412
|
+
v(!0), f(null);
|
|
294
413
|
try {
|
|
295
|
-
await
|
|
296
|
-
} catch (
|
|
297
|
-
|
|
414
|
+
await o.revokeInvite(a, l.code), b(null);
|
|
415
|
+
} catch (w) {
|
|
416
|
+
f(S(w));
|
|
298
417
|
} finally {
|
|
299
|
-
|
|
418
|
+
v(!1);
|
|
300
419
|
}
|
|
301
420
|
}
|
|
302
421
|
}
|
|
303
|
-
async function
|
|
304
|
-
if (!(!
|
|
305
|
-
|
|
422
|
+
async function C() {
|
|
423
|
+
if (!(!h.trim() || u)) {
|
|
424
|
+
_(!0), k(null);
|
|
306
425
|
try {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
} catch (
|
|
310
|
-
|
|
426
|
+
const w = await o.inviteByEmail(a, h.trim());
|
|
427
|
+
k(`Invite sent to ${w.email}.`), m(""), t == null || t();
|
|
428
|
+
} catch (w) {
|
|
429
|
+
k(S(w));
|
|
311
430
|
} finally {
|
|
312
|
-
|
|
431
|
+
_(!1);
|
|
313
432
|
}
|
|
314
433
|
}
|
|
315
434
|
}
|
|
316
|
-
const
|
|
317
|
-
async function
|
|
318
|
-
await navigator.clipboard.writeText(
|
|
435
|
+
const T = l ? `${window.location.origin}/shepherd/join/${encodeURIComponent(l.code)}` : null;
|
|
436
|
+
async function R(w, L) {
|
|
437
|
+
await navigator.clipboard.writeText(L), s(w), setTimeout(() => s((d) => d === w ? null : d), 2e3);
|
|
319
438
|
}
|
|
320
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-invites", "aria-labelledby":
|
|
439
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-invites", "aria-labelledby": y, children: [
|
|
321
440
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
322
|
-
/* @__PURE__ */ e("h3", { id:
|
|
441
|
+
/* @__PURE__ */ e("h3", { id: y, children: "Invite people" }),
|
|
323
442
|
/* @__PURE__ */ e("p", { className: "card-sub", children: "Share a code, or send a one-time join link by email." })
|
|
324
443
|
] }),
|
|
325
444
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
326
|
-
|
|
445
|
+
c && /* @__PURE__ */ e("p", { role: "alert", children: c }),
|
|
327
446
|
/* @__PURE__ */ n("div", { className: "field invites", children: [
|
|
328
447
|
/* @__PURE__ */ e("label", { children: "Invite by code" }),
|
|
329
448
|
/* @__PURE__ */ e("p", { className: "helper", children: "Anyone with the code can join this workspace." }),
|
|
330
|
-
|
|
449
|
+
l && /* @__PURE__ */ n("div", { className: "invite-result", children: [
|
|
331
450
|
/* @__PURE__ */ n("div", { className: "invite-result__head", children: [
|
|
332
451
|
/* @__PURE__ */ e("span", { className: "invite-result__eyebrow", children: "Invite code" }),
|
|
333
|
-
/* @__PURE__ */ e("span", { className: "invite-uses", children:
|
|
452
|
+
/* @__PURE__ */ e("span", { className: "invite-uses", children: l.maxUses === null ? `${l.useCount} uses` : `${l.useCount} / ${l.maxUses} uses` }),
|
|
334
453
|
/* @__PURE__ */ e(
|
|
335
454
|
"button",
|
|
336
455
|
{
|
|
337
456
|
type: "button",
|
|
338
457
|
className: "link-btn",
|
|
339
458
|
"aria-label": "Revoke invite",
|
|
340
|
-
onClick: () => void
|
|
341
|
-
disabled:
|
|
459
|
+
onClick: () => void I(),
|
|
460
|
+
disabled: r,
|
|
342
461
|
children: "Revoke"
|
|
343
462
|
}
|
|
344
463
|
)
|
|
345
464
|
] }),
|
|
346
465
|
/* @__PURE__ */ n("div", { className: "invite-result__copyrow", children: [
|
|
347
|
-
/* @__PURE__ */ e("code", { children:
|
|
466
|
+
/* @__PURE__ */ e("code", { children: l.code }),
|
|
348
467
|
/* @__PURE__ */ e(
|
|
349
468
|
"button",
|
|
350
469
|
{
|
|
351
470
|
type: "button",
|
|
352
471
|
className: "copy-btn",
|
|
353
|
-
onClick: () => void
|
|
472
|
+
onClick: () => void R("code", l.code),
|
|
354
473
|
children: E === "code" ? "Copied" : "Copy"
|
|
355
474
|
}
|
|
356
475
|
)
|
|
357
476
|
] }),
|
|
358
|
-
|
|
359
|
-
/* @__PURE__ */ e("a", { href:
|
|
477
|
+
T && /* @__PURE__ */ n("div", { className: "invite-result__copyrow invite-result__copyrow--link", children: [
|
|
478
|
+
/* @__PURE__ */ e("a", { href: T, children: T }),
|
|
360
479
|
/* @__PURE__ */ e(
|
|
361
480
|
"button",
|
|
362
481
|
{
|
|
363
482
|
type: "button",
|
|
364
483
|
className: "copy-btn",
|
|
365
|
-
onClick: () => void
|
|
484
|
+
onClick: () => void R("link", T),
|
|
366
485
|
children: E === "link" ? "Copied" : "Copy link"
|
|
367
486
|
}
|
|
368
487
|
)
|
|
369
488
|
] })
|
|
370
489
|
] }),
|
|
371
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => void
|
|
490
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => void N(), disabled: r, children: "Create invite" })
|
|
372
491
|
] }),
|
|
373
492
|
/* @__PURE__ */ n("div", { className: "field email-invite", children: [
|
|
374
493
|
/* @__PURE__ */ e("label", { htmlFor: "invite-email", children: "Invite by email" }),
|
|
@@ -380,99 +499,98 @@ function X({ workspaceId: i, onMembersChanged: t }) {
|
|
|
380
499
|
id: "invite-email",
|
|
381
500
|
type: "email",
|
|
382
501
|
placeholder: "name@example.com",
|
|
383
|
-
value:
|
|
384
|
-
onChange: (
|
|
502
|
+
value: h,
|
|
503
|
+
onChange: (w) => m(w.target.value)
|
|
385
504
|
}
|
|
386
505
|
),
|
|
387
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => void
|
|
506
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => void C(), disabled: u, children: "Send invite" })
|
|
388
507
|
] }),
|
|
389
508
|
g && /* @__PURE__ */ e("p", { className: "email-invite__status", children: g })
|
|
390
509
|
] })
|
|
391
510
|
] })
|
|
392
511
|
] });
|
|
393
512
|
}
|
|
394
|
-
const
|
|
513
|
+
const Q = [
|
|
395
514
|
{ id: "claude", label: "Claude Code" },
|
|
396
515
|
{ id: "codex", label: "Codex" },
|
|
397
516
|
{ id: "pi", label: "Pi" },
|
|
398
517
|
{ id: "generic", label: "Generic (JSON)" }
|
|
399
|
-
],
|
|
400
|
-
claude: "claude mcp add shepherd -s user
|
|
401
|
-
codex: "codex mcp add shepherd
|
|
402
|
-
pi: "pi mcp add shepherd
|
|
518
|
+
], Z = "shp_<paste-after-generating>", M = {
|
|
519
|
+
claude: "claude mcp add shepherd -s user",
|
|
520
|
+
codex: "codex mcp add shepherd",
|
|
521
|
+
pi: "pi mcp add shepherd"
|
|
403
522
|
};
|
|
404
|
-
function
|
|
405
|
-
const
|
|
406
|
-
return `${
|
|
523
|
+
function ee(a, t) {
|
|
524
|
+
const o = `created ${O(a.createdAt, t)}`, y = a.lastUsedAt ? `last used ${O(a.lastUsedAt, t)}` : "never used";
|
|
525
|
+
return `${o} · ${y}`;
|
|
407
526
|
}
|
|
408
|
-
function
|
|
409
|
-
return
|
|
527
|
+
function ne(a, t, o) {
|
|
528
|
+
return a === "generic" ? JSON.stringify(
|
|
410
529
|
{
|
|
411
530
|
mcpServers: {
|
|
412
531
|
shepherd: {
|
|
413
532
|
command: "npx",
|
|
414
|
-
args: ["-y", "@korso/shepherd"],
|
|
415
|
-
env: { HUB_URL: t, SHEPHERD_TOKEN:
|
|
533
|
+
args: ["-y", "-p", "@korso/shepherd", "shepherd-mcp"],
|
|
534
|
+
env: { HUB_URL: t, SHEPHERD_TOKEN: o }
|
|
416
535
|
}
|
|
417
536
|
}
|
|
418
537
|
},
|
|
419
538
|
null,
|
|
420
539
|
2
|
|
421
540
|
) : [
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
"
|
|
426
|
-
].join(
|
|
427
|
-
`);
|
|
541
|
+
M[a],
|
|
542
|
+
`-e HUB_URL=${t}`,
|
|
543
|
+
`-e SHEPHERD_TOKEN=${o}`,
|
|
544
|
+
"-- npx -y -p @korso/shepherd shepherd-mcp"
|
|
545
|
+
].join(" ");
|
|
428
546
|
}
|
|
429
|
-
function
|
|
430
|
-
const t =
|
|
431
|
-
async function
|
|
547
|
+
function te({ hubUrl: a }) {
|
|
548
|
+
const t = B(), o = a ?? t.baseUrl, y = $(), [l, b] = i("claude"), [c, f] = i(""), [r, v] = i(null), [h, m] = i([]), [g, k] = i(null), [u, _] = i(null), [E, s] = i(!1), [N, I] = i(!1), [C, T] = i(!0), [R, w] = i(null);
|
|
549
|
+
async function L() {
|
|
432
550
|
try {
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
} catch (
|
|
436
|
-
|
|
551
|
+
const p = await t.listAccountTokens();
|
|
552
|
+
m(p.tokens);
|
|
553
|
+
} catch (p) {
|
|
554
|
+
k(S(p));
|
|
437
555
|
} finally {
|
|
438
|
-
|
|
556
|
+
T(!1);
|
|
439
557
|
}
|
|
440
558
|
}
|
|
441
|
-
|
|
442
|
-
|
|
559
|
+
A(() => {
|
|
560
|
+
T(!0), L();
|
|
443
561
|
}, [t]);
|
|
444
|
-
async function
|
|
445
|
-
|
|
562
|
+
async function d() {
|
|
563
|
+
s(!0), k(null);
|
|
446
564
|
try {
|
|
447
|
-
const
|
|
448
|
-
|
|
565
|
+
const p = await t.mintAccountToken(
|
|
566
|
+
c.trim() ? { name: c.trim() } : {}
|
|
449
567
|
);
|
|
450
|
-
|
|
451
|
-
} catch (
|
|
452
|
-
|
|
568
|
+
v(p.token), f(""), await L();
|
|
569
|
+
} catch (p) {
|
|
570
|
+
k(S(p));
|
|
453
571
|
} finally {
|
|
454
|
-
|
|
572
|
+
s(!1);
|
|
455
573
|
}
|
|
456
574
|
}
|
|
457
|
-
async function
|
|
458
|
-
if (!
|
|
459
|
-
|
|
575
|
+
async function x(p) {
|
|
576
|
+
if (!R) {
|
|
577
|
+
w(p), k(null), _(null);
|
|
460
578
|
try {
|
|
461
|
-
await t.revokeAccountToken(
|
|
462
|
-
} catch (
|
|
463
|
-
|
|
579
|
+
await t.revokeAccountToken(p), m((D) => D.filter((H) => H.id !== p)), _("Token revoked");
|
|
580
|
+
} catch (D) {
|
|
581
|
+
k(S(D));
|
|
464
582
|
} finally {
|
|
465
|
-
|
|
583
|
+
w(null);
|
|
466
584
|
}
|
|
467
585
|
}
|
|
468
586
|
}
|
|
469
|
-
const
|
|
470
|
-
async function
|
|
471
|
-
await navigator.clipboard.writeText(
|
|
587
|
+
const j = ne(l, o, r ?? Z);
|
|
588
|
+
async function P() {
|
|
589
|
+
await navigator.clipboard.writeText(j), I(!0), setTimeout(() => I(!1), 2e3);
|
|
472
590
|
}
|
|
473
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby":
|
|
591
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby": y, children: [
|
|
474
592
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
475
|
-
/* @__PURE__ */ e("h3", { id:
|
|
593
|
+
/* @__PURE__ */ e("h3", { id: y, children: "Connect your agent" }),
|
|
476
594
|
/* @__PURE__ */ e("p", { className: "card-sub", children: "Generate a token — it works across all your workspaces — then paste the command into your coding tool." }),
|
|
477
595
|
/* @__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." })
|
|
478
596
|
] }),
|
|
@@ -483,9 +601,9 @@ function ee({ hubUrl: i }) {
|
|
|
483
601
|
"select",
|
|
484
602
|
{
|
|
485
603
|
id: "connect-tool",
|
|
486
|
-
value:
|
|
487
|
-
onChange: (
|
|
488
|
-
children:
|
|
604
|
+
value: l,
|
|
605
|
+
onChange: (p) => b(p.target.value),
|
|
606
|
+
children: Q.map((p) => /* @__PURE__ */ e("option", { value: p.id, children: p.label }, p.id))
|
|
489
607
|
}
|
|
490
608
|
)
|
|
491
609
|
] }),
|
|
@@ -497,28 +615,28 @@ function ee({ hubUrl: i }) {
|
|
|
497
615
|
{
|
|
498
616
|
id: "token-name",
|
|
499
617
|
type: "text",
|
|
500
|
-
value:
|
|
501
|
-
onChange: (
|
|
618
|
+
value: c,
|
|
619
|
+
onChange: (p) => f(p.target.value),
|
|
502
620
|
placeholder: "e.g. laptop"
|
|
503
621
|
}
|
|
504
622
|
),
|
|
505
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => void
|
|
623
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => void d(), disabled: E, children: "Generate token" })
|
|
506
624
|
] })
|
|
507
625
|
] }),
|
|
508
626
|
g && /* @__PURE__ */ e("p", { role: "alert", children: g }),
|
|
509
627
|
u && /* @__PURE__ */ e("p", { role: "status", children: u }),
|
|
510
|
-
|
|
628
|
+
r && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
|
|
511
629
|
/* @__PURE__ */ n("div", { className: "install-command", children: [
|
|
512
|
-
/* @__PURE__ */ e("pre", { "data-testid": "install-command", children:
|
|
630
|
+
/* @__PURE__ */ e("pre", { "data-testid": "install-command", children: j }),
|
|
513
631
|
/* @__PURE__ */ e(
|
|
514
632
|
"button",
|
|
515
633
|
{
|
|
516
634
|
type: "button",
|
|
517
635
|
className: "install-command__copy",
|
|
518
|
-
"aria-label":
|
|
519
|
-
title:
|
|
520
|
-
onClick: () => void
|
|
521
|
-
children:
|
|
636
|
+
"aria-label": N ? "Copied" : "Copy command",
|
|
637
|
+
title: N ? "Copied" : "Copy",
|
|
638
|
+
onClick: () => void P(),
|
|
639
|
+
children: N ? /* @__PURE__ */ e(
|
|
522
640
|
"svg",
|
|
523
641
|
{
|
|
524
642
|
width: "15",
|
|
@@ -554,111 +672,113 @@ function ee({ hubUrl: i }) {
|
|
|
554
672
|
)
|
|
555
673
|
] }),
|
|
556
674
|
/* @__PURE__ */ e("h4", { children: "Existing tokens" }),
|
|
557
|
-
|
|
558
|
-
const
|
|
675
|
+
C ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ e("p", { children: "No tokens yet." }) : /* @__PURE__ */ e("ul", { children: h.map((p) => {
|
|
676
|
+
const D = p.name ?? p.id;
|
|
559
677
|
return /* @__PURE__ */ n("li", { children: [
|
|
560
|
-
/* @__PURE__ */ e("span", { children:
|
|
561
|
-
/* @__PURE__ */ e("span", { className: "token-meta", children:
|
|
562
|
-
|
|
678
|
+
/* @__PURE__ */ e("span", { children: D }),
|
|
679
|
+
/* @__PURE__ */ e("span", { className: "token-meta", children: ee(p, Date.now()) }),
|
|
680
|
+
p.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
|
|
563
681
|
"button",
|
|
564
682
|
{
|
|
565
683
|
type: "button",
|
|
566
|
-
"aria-label": `Revoke token ${
|
|
567
|
-
onClick: () => void
|
|
568
|
-
disabled:
|
|
684
|
+
"aria-label": `Revoke token ${D}`,
|
|
685
|
+
onClick: () => void x(p.id),
|
|
686
|
+
disabled: R === p.id,
|
|
569
687
|
children: "Revoke"
|
|
570
688
|
}
|
|
571
689
|
)
|
|
572
|
-
] },
|
|
690
|
+
] }, p.id);
|
|
573
691
|
}) })
|
|
574
692
|
] })
|
|
575
693
|
] });
|
|
576
694
|
}
|
|
577
|
-
const
|
|
695
|
+
const ae = [
|
|
578
696
|
{ id: "general", label: "General" },
|
|
579
697
|
{ id: "members", label: "Members" },
|
|
580
698
|
{ id: "agent", label: "Agent" }
|
|
581
699
|
];
|
|
582
|
-
function
|
|
583
|
-
workspace:
|
|
700
|
+
function ie({
|
|
701
|
+
workspace: a,
|
|
584
702
|
hubUrl: t,
|
|
585
|
-
membersRefreshKey:
|
|
586
|
-
onMembersChanged:
|
|
587
|
-
onLeft:
|
|
703
|
+
membersRefreshKey: o,
|
|
704
|
+
onMembersChanged: y,
|
|
705
|
+
onLeft: l,
|
|
706
|
+
onDeleted: b
|
|
588
707
|
}) {
|
|
589
|
-
const [
|
|
708
|
+
const [c, f] = i("general"), r = a.role === "admin";
|
|
590
709
|
return /* @__PURE__ */ n("div", { className: "config-layout", children: [
|
|
591
|
-
/* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children:
|
|
710
|
+
/* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children: ae.map(({ id: v, label: h }) => /* @__PURE__ */ e(
|
|
592
711
|
"button",
|
|
593
712
|
{
|
|
594
713
|
type: "button",
|
|
595
|
-
className: "config-nav__item" + (
|
|
596
|
-
"aria-current":
|
|
597
|
-
onClick: () =>
|
|
598
|
-
children:
|
|
714
|
+
className: "config-nav__item" + (c === v ? " config-nav__item--on" : ""),
|
|
715
|
+
"aria-current": c === v ? "page" : void 0,
|
|
716
|
+
onClick: () => f(v),
|
|
717
|
+
children: h
|
|
599
718
|
},
|
|
600
|
-
|
|
719
|
+
v
|
|
601
720
|
)) }),
|
|
602
721
|
/* @__PURE__ */ n("div", { className: "config-panel", children: [
|
|
603
|
-
|
|
604
|
-
|
|
722
|
+
c === "general" && /* @__PURE__ */ e(X, { workspace: a, onLeft: l, onDeleted: b }),
|
|
723
|
+
c === "members" && /* @__PURE__ */ n(W, { children: [
|
|
605
724
|
/* @__PURE__ */ e(
|
|
606
|
-
|
|
725
|
+
q,
|
|
607
726
|
{
|
|
608
|
-
workspaceId:
|
|
609
|
-
refreshKey:
|
|
610
|
-
canRemove:
|
|
727
|
+
workspaceId: a.id,
|
|
728
|
+
refreshKey: o,
|
|
729
|
+
canRemove: r
|
|
611
730
|
}
|
|
612
731
|
),
|
|
613
|
-
|
|
732
|
+
r && /* @__PURE__ */ e(z, { workspaceId: a.id, onMembersChanged: y })
|
|
614
733
|
] }),
|
|
615
|
-
|
|
734
|
+
c === "agent" && /* @__PURE__ */ e(te, { hubUrl: t })
|
|
616
735
|
] })
|
|
617
736
|
] });
|
|
618
737
|
}
|
|
619
|
-
function
|
|
620
|
-
const t =
|
|
738
|
+
function oe({ hubUrl: a }) {
|
|
739
|
+
const t = B(), [o, y] = i({ status: "loading" }), [l, b] = i(null), [c, f] = i(0), r = Y(async () => {
|
|
621
740
|
try {
|
|
622
741
|
const u = await t.listWorkspaces();
|
|
623
|
-
|
|
624
|
-
(
|
|
742
|
+
y({ status: "ready", workspaces: u.workspaces }), b(
|
|
743
|
+
(_) => {
|
|
625
744
|
var E;
|
|
626
|
-
return
|
|
745
|
+
return _ && u.workspaces.some((s) => s.id === _) ? _ : ((E = u.workspaces[0]) == null ? void 0 : E.id) ?? null;
|
|
627
746
|
}
|
|
628
747
|
);
|
|
629
748
|
} catch (u) {
|
|
630
|
-
|
|
749
|
+
y({ status: "error", message: S(u) });
|
|
631
750
|
}
|
|
632
751
|
}, [t]);
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
}, [
|
|
636
|
-
const
|
|
637
|
-
if (
|
|
752
|
+
A(() => {
|
|
753
|
+
r();
|
|
754
|
+
}, [r]);
|
|
755
|
+
const v = o.status === "ready" ? o.workspaces : [], h = v.find((u) => u.id === l) ?? null;
|
|
756
|
+
if (o.status === "loading")
|
|
638
757
|
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) });
|
|
639
|
-
if (
|
|
640
|
-
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children:
|
|
641
|
-
const
|
|
642
|
-
|
|
758
|
+
if (o.status === "error")
|
|
759
|
+
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: o.message }) });
|
|
760
|
+
const m = v.length > 0, g = /* @__PURE__ */ e(
|
|
761
|
+
J,
|
|
643
762
|
{
|
|
644
|
-
workspaces:
|
|
645
|
-
selected:
|
|
646
|
-
onSelect:
|
|
763
|
+
workspaces: v,
|
|
764
|
+
selected: h,
|
|
765
|
+
onSelect: b,
|
|
647
766
|
onChanged: () => {
|
|
648
|
-
|
|
767
|
+
r();
|
|
649
768
|
},
|
|
650
|
-
onMembersChanged: () =>
|
|
769
|
+
onMembersChanged: () => f((u) => u + 1)
|
|
651
770
|
}
|
|
652
|
-
),
|
|
771
|
+
), k = /* @__PURE__ */ n("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
|
|
653
772
|
/* @__PURE__ */ e("h2", { id: "config-heading", children: "Configuration" }),
|
|
654
|
-
|
|
655
|
-
|
|
773
|
+
h ? /* @__PURE__ */ e(
|
|
774
|
+
ie,
|
|
656
775
|
{
|
|
657
|
-
workspace:
|
|
658
|
-
hubUrl:
|
|
659
|
-
membersRefreshKey:
|
|
660
|
-
onMembersChanged: () =>
|
|
661
|
-
onLeft: () => void
|
|
776
|
+
workspace: h,
|
|
777
|
+
hubUrl: a,
|
|
778
|
+
membersRefreshKey: c,
|
|
779
|
+
onMembersChanged: () => f((u) => u + 1),
|
|
780
|
+
onLeft: () => void r(),
|
|
781
|
+
onDeleted: () => void r()
|
|
662
782
|
}
|
|
663
783
|
) : /* @__PURE__ */ n("p", { className: "config-none", children: [
|
|
664
784
|
"You're not in a workspace yet. Use the ",
|
|
@@ -667,28 +787,28 @@ function re({ hubUrl: i }) {
|
|
|
667
787
|
] })
|
|
668
788
|
] });
|
|
669
789
|
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e(
|
|
670
|
-
|
|
790
|
+
K,
|
|
671
791
|
{
|
|
672
|
-
workspaceId:
|
|
673
|
-
config:
|
|
792
|
+
workspaceId: h == null ? void 0 : h.id,
|
|
793
|
+
config: k,
|
|
674
794
|
switcher: g,
|
|
675
|
-
hasWorkspace:
|
|
795
|
+
hasWorkspace: m
|
|
676
796
|
}
|
|
677
797
|
) });
|
|
678
798
|
}
|
|
679
799
|
export {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
800
|
+
ie as ConfigPanel,
|
|
801
|
+
te as ConnectAgent,
|
|
802
|
+
K as Dashboard,
|
|
803
|
+
ue as EmptyState,
|
|
804
|
+
X as GeneralSettings,
|
|
805
|
+
z as Invites,
|
|
806
|
+
q as Members,
|
|
807
|
+
G as ShepherdClientError,
|
|
808
|
+
he as ShepherdClientProvider,
|
|
809
|
+
oe as ShepherdRoot,
|
|
810
|
+
J as WorkspaceSwitcher,
|
|
811
|
+
me as createShepherdClient,
|
|
812
|
+
S as describeError,
|
|
813
|
+
B as useShepherdClient
|
|
694
814
|
};
|