@korso/shepherd-ui 0.5.1 → 0.7.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 +29 -11
- package/dist/config/GeneralSettings.d.ts +3 -1
- package/dist/config/GeneralSettings.js +41 -3
- package/dist/lib/{Dashboard-qipRa5MO.js → Dashboard-D7tbhMwK.js} +312 -307
- package/dist/lib/index.d.ts +18 -2
- package/dist/lib/index.js +446 -318
- package/dist/lib/selfhost.js +1 -1
- package/dist/lib/styles.css +43 -5
- package/dist/preview.js +4 -0
- package/dist/selfhost/assets/{index-xMSuivCM.js → index--_PPE03M.js} +7 -7
- package/dist/selfhost/assets/{index-DfVGGaT0.css → index-dBmCZSQx.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 R, S as H, f as O, D as K } from "./Dashboard-D7tbhMwK.js";
|
|
2
|
+
import { E as he, a as me, c as pe } from "./Dashboard-D7tbhMwK.js";
|
|
3
|
+
import { jsxs as n, jsx as e, Fragment as P } from "react/jsx-runtime";
|
|
4
|
+
import { useId as $, useRef as U, useState as i, useEffect as A, useCallback as Y } from "react";
|
|
5
|
+
function F(t) {
|
|
6
|
+
return (t.trim()[0] ?? "?").toUpperCase();
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
workspaces:
|
|
10
|
-
selected:
|
|
11
|
-
onSelect:
|
|
12
|
-
onChanged:
|
|
13
|
-
onMembersChanged:
|
|
8
|
+
function J({
|
|
9
|
+
workspaces: t,
|
|
10
|
+
selected: a,
|
|
11
|
+
onSelect: o,
|
|
12
|
+
onChanged: u,
|
|
13
|
+
onMembersChanged: l
|
|
14
14
|
}) {
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
y(!1),
|
|
15
|
+
const m = B(), c = $(), b = U(null), [r, y] = i(!1), [p, v] = i("menu"), [g, k] = i(""), [h, _] = i(""), [E, s] = i(null), [N, I] = i(!1);
|
|
16
|
+
function C() {
|
|
17
|
+
y(!1), v("menu"), k(""), _(""), s(null);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
if (!
|
|
21
|
-
function
|
|
22
|
-
|
|
19
|
+
A(() => {
|
|
20
|
+
if (!r) return;
|
|
21
|
+
function d(j) {
|
|
22
|
+
b.current && !b.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 S() {
|
|
32
|
+
if (!(!g.trim() || N)) {
|
|
33
|
+
I(!0), s(null);
|
|
34
34
|
try {
|
|
35
|
-
const
|
|
36
|
-
d
|
|
37
|
-
} catch (
|
|
38
|
-
|
|
35
|
+
const d = await m.createWorkspace({ name: g.trim() });
|
|
36
|
+
o(d.id), u(), C();
|
|
37
|
+
} catch (d) {
|
|
38
|
+
s(R(d));
|
|
39
39
|
} finally {
|
|
40
|
-
|
|
40
|
+
I(!1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
async function
|
|
45
|
-
if (!(!
|
|
46
|
-
|
|
44
|
+
async function T() {
|
|
45
|
+
if (!(!h.trim() || N)) {
|
|
46
|
+
I(!0), s(null);
|
|
47
47
|
try {
|
|
48
|
-
const
|
|
49
|
-
d
|
|
50
|
-
} catch (
|
|
51
|
-
|
|
48
|
+
const d = await m.redeemInvite(h.trim());
|
|
49
|
+
o(d.workspace.id), u(), l == null || l(), C();
|
|
50
|
+
} catch (d) {
|
|
51
|
+
s(R(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 = a !== null, L = a ? a.name : "Get started";
|
|
58
|
+
return /* @__PURE__ */ n("div", { className: "ws-switcher", ref: b, 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() : y(!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: F(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
|
+
p === "menu" && /* @__PURE__ */ n(P, { children: [
|
|
77
|
+
/* @__PURE__ */ e("p", { className: "ws-menu__head", children: w ? "Switch workspace" : "Your workspaces" }),
|
|
78
|
+
t.length === 0 ? /* @__PURE__ */ e("p", { className: "ws-menu__none", children: "None yet" }) : /* @__PURE__ */ e("ul", { className: "ws-menu__list", children: t.map((d) => {
|
|
79
|
+
const x = d.id === (a == null ? void 0 : a.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: F(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), v("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), v("join");
|
|
119
119
|
},
|
|
120
120
|
children: "⎘ Join with a code"
|
|
121
121
|
}
|
|
122
122
|
)
|
|
123
123
|
] })
|
|
124
124
|
] }),
|
|
125
|
-
|
|
125
|
+
p === "create" && /* @__PURE__ */ n(
|
|
126
126
|
"form",
|
|
127
127
|
{
|
|
128
128
|
className: "ws-form",
|
|
129
|
-
onSubmit: (
|
|
130
|
-
|
|
129
|
+
onSubmit: (d) => {
|
|
130
|
+
d.preventDefault(), S();
|
|
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: () => v("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
|
+
p === "join" && /* @__PURE__ */ n(
|
|
153
153
|
"form",
|
|
154
154
|
{
|
|
155
155
|
className: "ws-form",
|
|
156
|
-
onSubmit: (
|
|
157
|
-
|
|
156
|
+
onSubmit: (d) => {
|
|
157
|
+
d.preventDefault(), T();
|
|
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
|
-
value:
|
|
167
|
+
value: h,
|
|
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: () => v("menu"), children: "Back" }),
|
|
174
|
+
/* @__PURE__ */ e("button", { type: "submit", disabled: N || !h.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: t,
|
|
185
|
+
busy: a,
|
|
186
|
+
error: o,
|
|
187
|
+
onConfirm: u,
|
|
188
|
+
onCancel: l
|
|
189
|
+
}) {
|
|
190
|
+
const m = $(), c = $(), [b, r] = i(""), y = U(null);
|
|
191
|
+
A(() => {
|
|
192
|
+
var v;
|
|
193
|
+
(v = y.current) == null || v.focus();
|
|
194
|
+
}, []), A(() => {
|
|
195
|
+
function v(g) {
|
|
196
|
+
g.key === "Escape" && !a && l();
|
|
197
|
+
}
|
|
198
|
+
return document.addEventListener("keydown", v), () => document.removeEventListener("keydown", v);
|
|
199
|
+
}, [a, l]);
|
|
200
|
+
const p = b === t;
|
|
201
|
+
return /* @__PURE__ */ e(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
className: "shepherd-modal__backdrop",
|
|
205
|
+
onClick: () => {
|
|
206
|
+
a || l();
|
|
207
|
+
},
|
|
208
|
+
children: /* @__PURE__ */ n(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
className: "shepherd-modal",
|
|
212
|
+
role: "dialog",
|
|
213
|
+
"aria-modal": "true",
|
|
214
|
+
"aria-labelledby": m,
|
|
215
|
+
"aria-describedby": c,
|
|
216
|
+
onClick: (v) => v.stopPropagation(),
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ e("h3", { id: m, children: "Delete workspace" }),
|
|
219
|
+
/* @__PURE__ */ n("p", { id: c, className: "shepherd-modal__body", children: [
|
|
220
|
+
"This permanently deletes ",
|
|
221
|
+
/* @__PURE__ */ e("b", { children: t }),
|
|
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: `${m}-input`, className: "shepherd-modal__label", children: [
|
|
225
|
+
"Type ",
|
|
226
|
+
/* @__PURE__ */ e("b", { children: t }),
|
|
227
|
+
" to confirm"
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ e(
|
|
230
|
+
"input",
|
|
231
|
+
{
|
|
232
|
+
id: `${m}-input`,
|
|
233
|
+
ref: y,
|
|
234
|
+
type: "text",
|
|
235
|
+
value: b,
|
|
236
|
+
autoComplete: "off",
|
|
237
|
+
disabled: a,
|
|
238
|
+
onChange: (v) => r(v.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: a, children: "Cancel" }),
|
|
244
|
+
/* @__PURE__ */ e(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
type: "button",
|
|
248
|
+
className: "danger",
|
|
249
|
+
onClick: u,
|
|
250
|
+
disabled: !p || a,
|
|
251
|
+
children: a ? "Deleting…" : "Delete workspace"
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
] })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
function M({ workspace: t, onLeft: a, onDeleted: o }) {
|
|
262
|
+
const u = B(), l = $(), [m, c] = i(null), [b, r] = i(!1), [y, p] = i(!1), [v, g] = i(!1), [k, h] = i(!1), [_, E] = i(null), s = t.role === "admin";
|
|
263
|
+
async function N() {
|
|
264
|
+
if (!b) {
|
|
265
|
+
r(!0), c(null), p(!1);
|
|
266
|
+
try {
|
|
267
|
+
await u.leave(t.id), a == null || a();
|
|
268
|
+
} catch (C) {
|
|
269
|
+
c(R(C)), C instanceof H && C.status === 409 && p(!0);
|
|
270
|
+
} finally {
|
|
271
|
+
r(!1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
async function I() {
|
|
276
|
+
if (!k) {
|
|
277
|
+
h(!0), E(null);
|
|
188
278
|
try {
|
|
189
|
-
await
|
|
190
|
-
} catch (
|
|
191
|
-
|
|
279
|
+
await u.deleteWorkspace(t.id), g(!1), o == null || o();
|
|
280
|
+
} catch (C) {
|
|
281
|
+
E(R(C));
|
|
192
282
|
} finally {
|
|
193
|
-
|
|
283
|
+
h(!1);
|
|
194
284
|
}
|
|
195
285
|
}
|
|
196
286
|
}
|
|
197
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-general", "aria-labelledby":
|
|
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
|
+
m && /* @__PURE__ */ e("p", { role: "alert", children: m }),
|
|
294
|
+
y && 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: t.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: t.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: b, 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
|
+
v && /* @__PURE__ */ e(
|
|
326
|
+
V,
|
|
327
|
+
{
|
|
328
|
+
workspaceName: t.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 X({ workspaceId: t, refreshKey: a = 0, canRemove: o = !1 }) {
|
|
340
|
+
const u = B(), l = $(), [m, c] = i([]), [b, r] = i(null), [y, p] = i(null), [v, g] = i(!0), [k, h] = 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 u.listMembers(t);
|
|
345
|
+
c(N.members);
|
|
346
|
+
} catch (N) {
|
|
347
|
+
r(R(N));
|
|
229
348
|
} finally {
|
|
230
349
|
g(!1);
|
|
231
350
|
}
|
|
232
351
|
}
|
|
233
|
-
|
|
234
|
-
g(!0),
|
|
235
|
-
}, [
|
|
236
|
-
async function E(
|
|
237
|
-
if (!
|
|
238
|
-
|
|
352
|
+
A(() => {
|
|
353
|
+
g(!0), _();
|
|
354
|
+
}, [u, t, a]);
|
|
355
|
+
async function E(s, N) {
|
|
356
|
+
if (!k) {
|
|
357
|
+
h(s), r(null), p(null), c((I) => I.filter((C) => C.accountId !== s));
|
|
239
358
|
try {
|
|
240
|
-
await
|
|
241
|
-
} catch (
|
|
242
|
-
|
|
359
|
+
await u.removeMember(t, s), p(`Removed ${N}`);
|
|
360
|
+
} catch (I) {
|
|
361
|
+
r(R(I)), _({ keepError: !0 });
|
|
243
362
|
} finally {
|
|
244
|
-
|
|
363
|
+
h(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
|
-
|
|
370
|
+
b && /* @__PURE__ */ e("p", { role: "alert", children: b }),
|
|
252
371
|
y && /* @__PURE__ */ e("p", { role: "status", children: y }),
|
|
253
|
-
|
|
254
|
-
const
|
|
372
|
+
v ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : m.length === 0 ? /* @__PURE__ */ e("p", { children: "No members." }) : /* @__PURE__ */ e("ul", { children: m.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
|
-
y(!0),
|
|
392
|
+
function q({ workspaceId: t, onMembersChanged: a }) {
|
|
393
|
+
const o = B(), u = $(), [l, m] = i(null), [c, b] = i(null), [r, y] = i(!1), [p, v] = i(""), [g, k] = i(null), [h, _] = i(!1), [E, s] = i(null);
|
|
394
|
+
A(() => {
|
|
395
|
+
m(null), k(null);
|
|
396
|
+
}, [t]);
|
|
397
|
+
async function N() {
|
|
398
|
+
if (!r) {
|
|
399
|
+
y(!0), b(null);
|
|
281
400
|
try {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
} catch (
|
|
285
|
-
|
|
401
|
+
const w = await o.createInvite(t, {});
|
|
402
|
+
m(w), a == null || a();
|
|
403
|
+
} catch (w) {
|
|
404
|
+
b(R(w));
|
|
286
405
|
} finally {
|
|
287
406
|
y(!1);
|
|
288
407
|
}
|
|
289
408
|
}
|
|
290
409
|
}
|
|
291
|
-
async function
|
|
292
|
-
if (!(!
|
|
293
|
-
y(!0),
|
|
410
|
+
async function I() {
|
|
411
|
+
if (!(!l || r)) {
|
|
412
|
+
y(!0), b(null);
|
|
294
413
|
try {
|
|
295
|
-
await
|
|
296
|
-
} catch (
|
|
297
|
-
|
|
414
|
+
await o.revokeInvite(t, l.code), m(null);
|
|
415
|
+
} catch (w) {
|
|
416
|
+
b(R(w));
|
|
298
417
|
} finally {
|
|
299
418
|
y(!1);
|
|
300
419
|
}
|
|
301
420
|
}
|
|
302
421
|
}
|
|
303
|
-
async function
|
|
304
|
-
if (!(!
|
|
305
|
-
|
|
422
|
+
async function C() {
|
|
423
|
+
if (!(!p.trim() || h)) {
|
|
424
|
+
_(!0), k(null);
|
|
306
425
|
try {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
} catch (
|
|
310
|
-
|
|
426
|
+
const w = await o.inviteByEmail(t, p.trim());
|
|
427
|
+
k(`Invite sent to ${w.email}.`), v(""), a == null || a();
|
|
428
|
+
} catch (w) {
|
|
429
|
+
k(R(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 S = l ? `${window.location.origin}/shepherd/join/${encodeURIComponent(l.code)}` : null;
|
|
436
|
+
async function T(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": u, children: [
|
|
321
440
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
322
|
-
/* @__PURE__ */ e("h3", { id:
|
|
441
|
+
/* @__PURE__ */ e("h3", { id: u, 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 T("code", l.code),
|
|
354
473
|
children: E === "code" ? "Copied" : "Copy"
|
|
355
474
|
}
|
|
356
475
|
)
|
|
357
476
|
] }),
|
|
358
|
-
|
|
359
|
-
/* @__PURE__ */ e("a", { href:
|
|
477
|
+
S && /* @__PURE__ */ n("div", { className: "invite-result__copyrow invite-result__copyrow--link", children: [
|
|
478
|
+
/* @__PURE__ */ e("a", { href: S, children: S }),
|
|
360
479
|
/* @__PURE__ */ e(
|
|
361
480
|
"button",
|
|
362
481
|
{
|
|
363
482
|
type: "button",
|
|
364
483
|
className: "copy-btn",
|
|
365
|
-
onClick: () => void
|
|
484
|
+
onClick: () => void T("link", S),
|
|
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,98 +499,105 @@ 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: p,
|
|
503
|
+
onChange: (w) => v(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: h, 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 z = [
|
|
395
514
|
{ id: "claude", label: "Claude Code" },
|
|
396
515
|
{ id: "codex", label: "Codex" },
|
|
397
516
|
{ id: "pi", label: "Pi" },
|
|
517
|
+
{ id: "cursor", label: "Cursor" },
|
|
398
518
|
{ id: "generic", label: "Generic (JSON)" }
|
|
399
|
-
],
|
|
519
|
+
], Q = "shp_<paste-after-generating>", Z = {
|
|
400
520
|
claude: "claude mcp add shepherd -s user",
|
|
401
|
-
codex: "codex mcp add shepherd"
|
|
402
|
-
|
|
521
|
+
codex: "codex mcp add shepherd"
|
|
522
|
+
}, ee = {
|
|
523
|
+
claude: "-e",
|
|
524
|
+
codex: "--env"
|
|
403
525
|
};
|
|
404
|
-
function
|
|
405
|
-
const
|
|
406
|
-
return `${
|
|
526
|
+
function ne(t, a) {
|
|
527
|
+
const o = `created ${O(t.createdAt, a)}`, u = t.lastUsedAt ? `last used ${O(t.lastUsedAt, a)}` : "never used";
|
|
528
|
+
return `${o} · ${u}`;
|
|
407
529
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
410
|
-
{
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
530
|
+
function te(t, a, o) {
|
|
531
|
+
if (t === "generic" || t === "pi" || t === "cursor") {
|
|
532
|
+
const m = { HUB_URL: a, SHEPHERD_TOKEN: o };
|
|
533
|
+
return t !== "generic" && (m.PROGRAM = t), JSON.stringify(
|
|
534
|
+
{
|
|
535
|
+
mcpServers: {
|
|
536
|
+
shepherd: {
|
|
537
|
+
command: "npx",
|
|
538
|
+
args: ["-y", "--package=@korso/shepherd", "shepherd-mcp"],
|
|
539
|
+
env: m
|
|
540
|
+
}
|
|
416
541
|
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
]
|
|
542
|
+
},
|
|
543
|
+
null,
|
|
544
|
+
2
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
const u = ee[t], l = [
|
|
548
|
+
Z[t],
|
|
549
|
+
`${u} HUB_URL=${a}`,
|
|
550
|
+
`${u} SHEPHERD_TOKEN=${o}`
|
|
551
|
+
];
|
|
552
|
+
return t === "codex" && l.push(`${u} PROGRAM=codex`), l.push("-- npx -y --package=@korso/shepherd shepherd-mcp"), l.join(" ");
|
|
427
553
|
}
|
|
428
|
-
function
|
|
429
|
-
const
|
|
430
|
-
async function
|
|
554
|
+
function ae({ hubUrl: t }) {
|
|
555
|
+
const a = B(), o = t ?? a.baseUrl, u = $(), [l, m] = i("claude"), [c, b] = i(""), [r, y] = i(null), [p, v] = i([]), [g, k] = i(null), [h, _] = i(null), [E, s] = i(!1), [N, I] = i(!1), [C, S] = i(!0), [T, w] = i(null);
|
|
556
|
+
async function L() {
|
|
431
557
|
try {
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
} catch (
|
|
435
|
-
|
|
558
|
+
const f = await a.listAccountTokens();
|
|
559
|
+
v(f.tokens);
|
|
560
|
+
} catch (f) {
|
|
561
|
+
k(R(f));
|
|
436
562
|
} finally {
|
|
437
|
-
|
|
563
|
+
S(!1);
|
|
438
564
|
}
|
|
439
565
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}, [
|
|
443
|
-
async function
|
|
444
|
-
|
|
566
|
+
A(() => {
|
|
567
|
+
S(!0), L();
|
|
568
|
+
}, [a]);
|
|
569
|
+
async function d() {
|
|
570
|
+
s(!0), k(null);
|
|
445
571
|
try {
|
|
446
|
-
const
|
|
447
|
-
|
|
572
|
+
const f = await a.mintAccountToken(
|
|
573
|
+
c.trim() ? { name: c.trim() } : {}
|
|
448
574
|
);
|
|
449
|
-
y(
|
|
450
|
-
} catch (
|
|
451
|
-
|
|
575
|
+
y(f.token), b(""), await L();
|
|
576
|
+
} catch (f) {
|
|
577
|
+
k(R(f));
|
|
452
578
|
} finally {
|
|
453
|
-
|
|
579
|
+
s(!1);
|
|
454
580
|
}
|
|
455
581
|
}
|
|
456
|
-
async function
|
|
457
|
-
if (!
|
|
458
|
-
f
|
|
582
|
+
async function x(f) {
|
|
583
|
+
if (!T) {
|
|
584
|
+
w(f), k(null), _(null);
|
|
459
585
|
try {
|
|
460
|
-
await
|
|
461
|
-
} catch (
|
|
462
|
-
|
|
586
|
+
await a.revokeAccountToken(f), v((D) => D.filter((W) => W.id !== f)), _("Token revoked");
|
|
587
|
+
} catch (D) {
|
|
588
|
+
k(R(D));
|
|
463
589
|
} finally {
|
|
464
|
-
|
|
590
|
+
w(null);
|
|
465
591
|
}
|
|
466
592
|
}
|
|
467
593
|
}
|
|
468
|
-
const
|
|
469
|
-
async function
|
|
470
|
-
await navigator.clipboard.writeText(
|
|
594
|
+
const j = te(l, o, r ?? Q);
|
|
595
|
+
async function G() {
|
|
596
|
+
await navigator.clipboard.writeText(j), I(!0), setTimeout(() => I(!1), 2e3);
|
|
471
597
|
}
|
|
472
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby":
|
|
598
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby": u, children: [
|
|
473
599
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
474
|
-
/* @__PURE__ */ e("h3", { id:
|
|
600
|
+
/* @__PURE__ */ e("h3", { id: u, children: "Connect your agent" }),
|
|
475
601
|
/* @__PURE__ */ e("p", { className: "card-sub", children: "Generate a token — it works across all your workspaces — then paste the command into your coding tool." }),
|
|
476
602
|
/* @__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." })
|
|
477
603
|
] }),
|
|
@@ -482,9 +608,9 @@ function ee({ hubUrl: i }) {
|
|
|
482
608
|
"select",
|
|
483
609
|
{
|
|
484
610
|
id: "connect-tool",
|
|
485
|
-
value:
|
|
486
|
-
onChange: (
|
|
487
|
-
children:
|
|
611
|
+
value: l,
|
|
612
|
+
onChange: (f) => m(f.target.value),
|
|
613
|
+
children: z.map((f) => /* @__PURE__ */ e("option", { value: f.id, children: f.label }, f.id))
|
|
488
614
|
}
|
|
489
615
|
)
|
|
490
616
|
] }),
|
|
@@ -496,28 +622,28 @@ function ee({ hubUrl: i }) {
|
|
|
496
622
|
{
|
|
497
623
|
id: "token-name",
|
|
498
624
|
type: "text",
|
|
499
|
-
value:
|
|
500
|
-
onChange: (
|
|
625
|
+
value: c,
|
|
626
|
+
onChange: (f) => b(f.target.value),
|
|
501
627
|
placeholder: "e.g. laptop"
|
|
502
628
|
}
|
|
503
629
|
),
|
|
504
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => void
|
|
630
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => void d(), disabled: E, children: "Generate token" })
|
|
505
631
|
] })
|
|
506
632
|
] }),
|
|
507
633
|
g && /* @__PURE__ */ e("p", { role: "alert", children: g }),
|
|
508
|
-
|
|
509
|
-
|
|
634
|
+
h && /* @__PURE__ */ e("p", { role: "status", children: h }),
|
|
635
|
+
r && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
|
|
510
636
|
/* @__PURE__ */ n("div", { className: "install-command", children: [
|
|
511
|
-
/* @__PURE__ */ e("pre", { "data-testid": "install-command", children:
|
|
637
|
+
/* @__PURE__ */ e("pre", { "data-testid": "install-command", children: j }),
|
|
512
638
|
/* @__PURE__ */ e(
|
|
513
639
|
"button",
|
|
514
640
|
{
|
|
515
641
|
type: "button",
|
|
516
642
|
className: "install-command__copy",
|
|
517
|
-
"aria-label":
|
|
518
|
-
title:
|
|
519
|
-
onClick: () => void
|
|
520
|
-
children:
|
|
643
|
+
"aria-label": N ? "Copied" : "Copy command",
|
|
644
|
+
title: N ? "Copied" : "Copy",
|
|
645
|
+
onClick: () => void G(),
|
|
646
|
+
children: N ? /* @__PURE__ */ e(
|
|
521
647
|
"svg",
|
|
522
648
|
{
|
|
523
649
|
width: "15",
|
|
@@ -553,111 +679,113 @@ function ee({ hubUrl: i }) {
|
|
|
553
679
|
)
|
|
554
680
|
] }),
|
|
555
681
|
/* @__PURE__ */ e("h4", { children: "Existing tokens" }),
|
|
556
|
-
|
|
557
|
-
const
|
|
682
|
+
C ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : p.length === 0 ? /* @__PURE__ */ e("p", { children: "No tokens yet." }) : /* @__PURE__ */ e("ul", { children: p.map((f) => {
|
|
683
|
+
const D = f.name ?? f.id;
|
|
558
684
|
return /* @__PURE__ */ n("li", { children: [
|
|
559
|
-
/* @__PURE__ */ e("span", { children:
|
|
560
|
-
/* @__PURE__ */ e("span", { className: "token-meta", children:
|
|
561
|
-
|
|
685
|
+
/* @__PURE__ */ e("span", { children: D }),
|
|
686
|
+
/* @__PURE__ */ e("span", { className: "token-meta", children: ne(f, Date.now()) }),
|
|
687
|
+
f.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
|
|
562
688
|
"button",
|
|
563
689
|
{
|
|
564
690
|
type: "button",
|
|
565
|
-
"aria-label": `Revoke token ${
|
|
566
|
-
onClick: () => void
|
|
567
|
-
disabled:
|
|
691
|
+
"aria-label": `Revoke token ${D}`,
|
|
692
|
+
onClick: () => void x(f.id),
|
|
693
|
+
disabled: T === f.id,
|
|
568
694
|
children: "Revoke"
|
|
569
695
|
}
|
|
570
696
|
)
|
|
571
|
-
] },
|
|
697
|
+
] }, f.id);
|
|
572
698
|
}) })
|
|
573
699
|
] })
|
|
574
700
|
] });
|
|
575
701
|
}
|
|
576
|
-
const
|
|
702
|
+
const ie = [
|
|
577
703
|
{ id: "general", label: "General" },
|
|
578
704
|
{ id: "members", label: "Members" },
|
|
579
705
|
{ id: "agent", label: "Agent" }
|
|
580
706
|
];
|
|
581
|
-
function
|
|
582
|
-
workspace:
|
|
583
|
-
hubUrl:
|
|
584
|
-
membersRefreshKey:
|
|
585
|
-
onMembersChanged:
|
|
586
|
-
onLeft:
|
|
707
|
+
function le({
|
|
708
|
+
workspace: t,
|
|
709
|
+
hubUrl: a,
|
|
710
|
+
membersRefreshKey: o,
|
|
711
|
+
onMembersChanged: u,
|
|
712
|
+
onLeft: l,
|
|
713
|
+
onDeleted: m
|
|
587
714
|
}) {
|
|
588
|
-
const [
|
|
715
|
+
const [c, b] = i("general"), r = t.role === "admin";
|
|
589
716
|
return /* @__PURE__ */ n("div", { className: "config-layout", children: [
|
|
590
|
-
/* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children:
|
|
717
|
+
/* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children: ie.map(({ id: y, label: p }) => /* @__PURE__ */ e(
|
|
591
718
|
"button",
|
|
592
719
|
{
|
|
593
720
|
type: "button",
|
|
594
|
-
className: "config-nav__item" + (
|
|
595
|
-
"aria-current":
|
|
596
|
-
onClick: () =>
|
|
597
|
-
children:
|
|
721
|
+
className: "config-nav__item" + (c === y ? " config-nav__item--on" : ""),
|
|
722
|
+
"aria-current": c === y ? "page" : void 0,
|
|
723
|
+
onClick: () => b(y),
|
|
724
|
+
children: p
|
|
598
725
|
},
|
|
599
|
-
|
|
726
|
+
y
|
|
600
727
|
)) }),
|
|
601
728
|
/* @__PURE__ */ n("div", { className: "config-panel", children: [
|
|
602
|
-
|
|
603
|
-
|
|
729
|
+
c === "general" && /* @__PURE__ */ e(M, { workspace: t, onLeft: l, onDeleted: m }),
|
|
730
|
+
c === "members" && /* @__PURE__ */ n(P, { children: [
|
|
604
731
|
/* @__PURE__ */ e(
|
|
605
|
-
|
|
732
|
+
X,
|
|
606
733
|
{
|
|
607
|
-
workspaceId:
|
|
608
|
-
refreshKey:
|
|
609
|
-
canRemove:
|
|
734
|
+
workspaceId: t.id,
|
|
735
|
+
refreshKey: o,
|
|
736
|
+
canRemove: r
|
|
610
737
|
}
|
|
611
738
|
),
|
|
612
|
-
|
|
739
|
+
r && /* @__PURE__ */ e(q, { workspaceId: t.id, onMembersChanged: u })
|
|
613
740
|
] }),
|
|
614
|
-
|
|
741
|
+
c === "agent" && /* @__PURE__ */ e(ae, { hubUrl: a })
|
|
615
742
|
] })
|
|
616
743
|
] });
|
|
617
744
|
}
|
|
618
|
-
function
|
|
619
|
-
const
|
|
745
|
+
function ce({ hubUrl: t }) {
|
|
746
|
+
const a = B(), [o, u] = i({ status: "loading" }), [l, m] = i(null), [c, b] = i(0), r = Y(async () => {
|
|
620
747
|
try {
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
(
|
|
748
|
+
const h = await a.listWorkspaces();
|
|
749
|
+
u({ status: "ready", workspaces: h.workspaces }), m(
|
|
750
|
+
(_) => {
|
|
624
751
|
var E;
|
|
625
|
-
return
|
|
752
|
+
return _ && h.workspaces.some((s) => s.id === _) ? _ : ((E = h.workspaces[0]) == null ? void 0 : E.id) ?? null;
|
|
626
753
|
}
|
|
627
754
|
);
|
|
628
|
-
} catch (
|
|
629
|
-
|
|
755
|
+
} catch (h) {
|
|
756
|
+
u({ status: "error", message: R(h) });
|
|
630
757
|
}
|
|
631
|
-
}, [
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}, [
|
|
635
|
-
const y =
|
|
636
|
-
if (
|
|
758
|
+
}, [a]);
|
|
759
|
+
A(() => {
|
|
760
|
+
r();
|
|
761
|
+
}, [r]);
|
|
762
|
+
const y = o.status === "ready" ? o.workspaces : [], p = y.find((h) => h.id === l) ?? null;
|
|
763
|
+
if (o.status === "loading")
|
|
637
764
|
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) });
|
|
638
|
-
if (
|
|
639
|
-
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children:
|
|
640
|
-
const
|
|
641
|
-
|
|
765
|
+
if (o.status === "error")
|
|
766
|
+
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: o.message }) });
|
|
767
|
+
const v = y.length > 0, g = /* @__PURE__ */ e(
|
|
768
|
+
J,
|
|
642
769
|
{
|
|
643
770
|
workspaces: y,
|
|
644
|
-
selected:
|
|
645
|
-
onSelect:
|
|
771
|
+
selected: p,
|
|
772
|
+
onSelect: m,
|
|
646
773
|
onChanged: () => {
|
|
647
|
-
|
|
774
|
+
r();
|
|
648
775
|
},
|
|
649
|
-
onMembersChanged: () =>
|
|
776
|
+
onMembersChanged: () => b((h) => h + 1)
|
|
650
777
|
}
|
|
651
|
-
),
|
|
778
|
+
), k = /* @__PURE__ */ n("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
|
|
652
779
|
/* @__PURE__ */ e("h2", { id: "config-heading", children: "Configuration" }),
|
|
653
|
-
|
|
654
|
-
|
|
780
|
+
p ? /* @__PURE__ */ e(
|
|
781
|
+
le,
|
|
655
782
|
{
|
|
656
|
-
workspace:
|
|
657
|
-
hubUrl:
|
|
658
|
-
membersRefreshKey:
|
|
659
|
-
onMembersChanged: () =>
|
|
660
|
-
onLeft: () => void
|
|
783
|
+
workspace: p,
|
|
784
|
+
hubUrl: t,
|
|
785
|
+
membersRefreshKey: c,
|
|
786
|
+
onMembersChanged: () => b((h) => h + 1),
|
|
787
|
+
onLeft: () => void r(),
|
|
788
|
+
onDeleted: () => void r()
|
|
661
789
|
}
|
|
662
790
|
) : /* @__PURE__ */ n("p", { className: "config-none", children: [
|
|
663
791
|
"You're not in a workspace yet. Use the ",
|
|
@@ -666,28 +794,28 @@ function re({ hubUrl: i }) {
|
|
|
666
794
|
] })
|
|
667
795
|
] });
|
|
668
796
|
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e(
|
|
669
|
-
|
|
797
|
+
K,
|
|
670
798
|
{
|
|
671
|
-
workspaceId:
|
|
672
|
-
config:
|
|
799
|
+
workspaceId: p == null ? void 0 : p.id,
|
|
800
|
+
config: k,
|
|
673
801
|
switcher: g,
|
|
674
|
-
hasWorkspace:
|
|
802
|
+
hasWorkspace: v
|
|
675
803
|
}
|
|
676
804
|
) });
|
|
677
805
|
}
|
|
678
806
|
export {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
807
|
+
le as ConfigPanel,
|
|
808
|
+
ae as ConnectAgent,
|
|
809
|
+
K as Dashboard,
|
|
810
|
+
he as EmptyState,
|
|
811
|
+
M as GeneralSettings,
|
|
812
|
+
q as Invites,
|
|
813
|
+
X as Members,
|
|
814
|
+
H as ShepherdClientError,
|
|
815
|
+
me as ShepherdClientProvider,
|
|
816
|
+
ce as ShepherdRoot,
|
|
817
|
+
J as WorkspaceSwitcher,
|
|
818
|
+
pe as createShepherdClient,
|
|
819
|
+
R as describeError,
|
|
820
|
+
B as useShepherdClient
|
|
693
821
|
};
|