@korso/shepherd-ui 0.4.0 → 0.5.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/LICENSE +661 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +14 -0
- package/dist/config/ConfigPanel.js +1 -1
- package/dist/config/ConnectAgent.d.ts +1 -2
- package/dist/config/ConnectAgent.js +6 -12
- package/dist/lib/{Dashboard-CTXdGRxM.js → Dashboard-C48qY8R2.js} +123 -109
- package/dist/lib/index.d.ts +7 -2
- package/dist/lib/index.js +233 -235
- package/dist/lib/selfhost.js +1 -1
- package/dist/preview.js +12 -0
- package/dist/selfhost/assets/{index-BSnsUIT-.js → index-adPvx18g.js} +8 -8
- package/dist/selfhost/index.html +1 -1
- package/dist/test/mockClient.js +3 -0
- package/package.json +2 -2
package/dist/lib/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { u as A, d as I, f 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 A, d as I, f as O, D as G } from "./Dashboard-C48qY8R2.js";
|
|
2
|
+
import { E as ce, S as de, a as ue, c as he } from "./Dashboard-C48qY8R2.js";
|
|
3
|
+
import { jsxs as n, jsx as e, Fragment as F } from "react/jsx-runtime";
|
|
4
|
+
import { useId as B, useRef as P, useState as a, useEffect as U, useCallback as K } from "react";
|
|
5
|
+
function D(i) {
|
|
6
|
+
return (i.trim()[0] ?? "?").toUpperCase();
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
workspaces:
|
|
10
|
-
selected:
|
|
11
|
-
onSelect:
|
|
12
|
-
onChanged:
|
|
8
|
+
function Y({
|
|
9
|
+
workspaces: i,
|
|
10
|
+
selected: t,
|
|
11
|
+
onSelect: d,
|
|
12
|
+
onChanged: v,
|
|
13
13
|
onMembersChanged: o
|
|
14
14
|
}) {
|
|
15
|
-
const h = A(),
|
|
15
|
+
const h = A(), m = B(), p = P(null), [l, y] = a(!1), [b, w] = a("menu"), [g, N] = a(""), [u, C] = a(""), [E, r] = a(null), [k, _] = a(!1);
|
|
16
16
|
function S() {
|
|
17
|
-
|
|
17
|
+
y(!1), w("menu"), N(""), C(""), r(null);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
U(() => {
|
|
20
20
|
if (!l) return;
|
|
21
|
-
function s(
|
|
22
|
-
|
|
21
|
+
function s($) {
|
|
22
|
+
p.current && !p.current.contains($.target) && S();
|
|
23
23
|
}
|
|
24
|
-
function R(
|
|
25
|
-
|
|
24
|
+
function R($) {
|
|
25
|
+
$.key === "Escape" && S();
|
|
26
26
|
}
|
|
27
27
|
return document.addEventListener("mousedown", s), document.addEventListener("keydown", R), () => {
|
|
28
28
|
document.removeEventListener("mousedown", s), document.removeEventListener("keydown", R);
|
|
@@ -30,53 +30,53 @@ function J({
|
|
|
30
30
|
}, [l]);
|
|
31
31
|
async function x() {
|
|
32
32
|
if (!(!g.trim() || k)) {
|
|
33
|
-
_(!0),
|
|
33
|
+
_(!0), r(null);
|
|
34
34
|
try {
|
|
35
35
|
const s = await h.createWorkspace({ name: g.trim() });
|
|
36
|
-
|
|
36
|
+
d(s.id), v(), S();
|
|
37
37
|
} catch (s) {
|
|
38
|
-
|
|
38
|
+
r(I(s));
|
|
39
39
|
} finally {
|
|
40
40
|
_(!1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
async function L() {
|
|
45
|
-
if (!(!
|
|
46
|
-
_(!0),
|
|
45
|
+
if (!(!u.trim() || k)) {
|
|
46
|
+
_(!0), r(null);
|
|
47
47
|
try {
|
|
48
|
-
const s = await h.redeemInvite(
|
|
49
|
-
|
|
48
|
+
const s = await h.redeemInvite(u.trim());
|
|
49
|
+
d(s.workspace.id), v(), o == null || o(), S();
|
|
50
50
|
} catch (s) {
|
|
51
|
-
|
|
51
|
+
r(I(s));
|
|
52
52
|
} finally {
|
|
53
53
|
_(!1);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */ n("div", { className: "ws-switcher", ref:
|
|
57
|
+
const f = t !== null, T = t ? t.name : "Get started";
|
|
58
|
+
return /* @__PURE__ */ n("div", { className: "ws-switcher", ref: p, children: [
|
|
59
59
|
/* @__PURE__ */ n(
|
|
60
60
|
"button",
|
|
61
61
|
{
|
|
62
62
|
type: "button",
|
|
63
|
-
className: "ws-trig" + (
|
|
63
|
+
className: "ws-trig" + (f ? "" : " ws-trig--empty"),
|
|
64
64
|
"aria-haspopup": "menu",
|
|
65
65
|
"aria-expanded": l,
|
|
66
|
-
"aria-controls": l ?
|
|
67
|
-
onClick: () => l ? S() :
|
|
66
|
+
"aria-controls": l ? m : void 0,
|
|
67
|
+
onClick: () => l ? S() : y(!0),
|
|
68
68
|
children: [
|
|
69
|
-
|
|
69
|
+
f ? /* @__PURE__ */ e("span", { className: "ws-avatar", "aria-hidden": "true", children: D(T) }) : /* @__PURE__ */ e("span", { className: "ws-plus", "aria-hidden": "true", children: "+" }),
|
|
70
70
|
/* @__PURE__ */ e("span", { className: "ws-name", children: T }),
|
|
71
71
|
/* @__PURE__ */ e("span", { className: "ws-caret", "aria-hidden": "true", children: "▾" })
|
|
72
72
|
]
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
l && /* @__PURE__ */ n("div", { className: "ws-menu", id:
|
|
76
|
-
b === "menu" && /* @__PURE__ */ n(
|
|
77
|
-
/* @__PURE__ */ e("p", { className: "ws-menu__head", children:
|
|
78
|
-
|
|
79
|
-
const R = s.id === (
|
|
75
|
+
l && /* @__PURE__ */ n("div", { className: "ws-menu", id: m, role: "menu", children: [
|
|
76
|
+
b === "menu" && /* @__PURE__ */ n(F, { children: [
|
|
77
|
+
/* @__PURE__ */ e("p", { className: "ws-menu__head", children: f ? "Switch workspace" : "Your workspaces" }),
|
|
78
|
+
i.length === 0 ? /* @__PURE__ */ e("p", { className: "ws-menu__none", children: "None yet" }) : /* @__PURE__ */ e("ul", { className: "ws-menu__list", children: i.map((s) => {
|
|
79
|
+
const R = s.id === (t == null ? void 0 : t.id);
|
|
80
80
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
|
|
81
81
|
"button",
|
|
82
82
|
{
|
|
@@ -85,10 +85,10 @@ function J({
|
|
|
85
85
|
"aria-checked": R,
|
|
86
86
|
className: "ws-mi" + (R ? " ws-mi--on" : ""),
|
|
87
87
|
onClick: () => {
|
|
88
|
-
|
|
88
|
+
d(s.id), S();
|
|
89
89
|
},
|
|
90
90
|
children: [
|
|
91
|
-
/* @__PURE__ */ e("span", { className: "ws-avatar ws-avatar--sm", "aria-hidden": "true", children:
|
|
91
|
+
/* @__PURE__ */ e("span", { className: "ws-avatar ws-avatar--sm", "aria-hidden": "true", children: D(s.name) }),
|
|
92
92
|
/* @__PURE__ */ e("span", { className: "ws-mi__name", children: s.name }),
|
|
93
93
|
R && /* @__PURE__ */ e("span", { className: "ws-mi__check", "aria-hidden": "true", children: "✓" })
|
|
94
94
|
]
|
|
@@ -103,7 +103,7 @@ function J({
|
|
|
103
103
|
role: "menuitem",
|
|
104
104
|
className: "ws-action",
|
|
105
105
|
onClick: () => {
|
|
106
|
-
|
|
106
|
+
r(null), w("create");
|
|
107
107
|
},
|
|
108
108
|
children: "+ Create workspace"
|
|
109
109
|
}
|
|
@@ -115,7 +115,7 @@ function J({
|
|
|
115
115
|
role: "menuitem",
|
|
116
116
|
className: "ws-action",
|
|
117
117
|
onClick: () => {
|
|
118
|
-
|
|
118
|
+
r(null), w("join");
|
|
119
119
|
},
|
|
120
120
|
children: "⎘ Join with a code"
|
|
121
121
|
}
|
|
@@ -130,20 +130,20 @@ function J({
|
|
|
130
130
|
s.preventDefault(), x();
|
|
131
131
|
},
|
|
132
132
|
children: [
|
|
133
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
133
|
+
/* @__PURE__ */ e("label", { htmlFor: `${m}-name`, children: "New workspace name" }),
|
|
134
134
|
/* @__PURE__ */ e(
|
|
135
135
|
"input",
|
|
136
136
|
{
|
|
137
|
-
id: `${
|
|
137
|
+
id: `${m}-name`,
|
|
138
138
|
type: "text",
|
|
139
139
|
placeholder: "e.g. Acme Engineering",
|
|
140
140
|
value: g,
|
|
141
141
|
autoFocus: !0,
|
|
142
|
-
onChange: (s) =>
|
|
142
|
+
onChange: (s) => N(s.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: () =>
|
|
146
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => w("menu"), children: "Back" }),
|
|
147
147
|
/* @__PURE__ */ e("button", { type: "submit", disabled: k || !g.trim(), children: "Create" })
|
|
148
148
|
] })
|
|
149
149
|
]
|
|
@@ -157,21 +157,21 @@ function J({
|
|
|
157
157
|
s.preventDefault(), L();
|
|
158
158
|
},
|
|
159
159
|
children: [
|
|
160
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
160
|
+
/* @__PURE__ */ e("label", { htmlFor: `${m}-code`, children: "Invite code" }),
|
|
161
161
|
/* @__PURE__ */ e(
|
|
162
162
|
"input",
|
|
163
163
|
{
|
|
164
|
-
id: `${
|
|
164
|
+
id: `${m}-code`,
|
|
165
165
|
type: "text",
|
|
166
166
|
placeholder: "Paste an invite code",
|
|
167
|
-
value:
|
|
167
|
+
value: u,
|
|
168
168
|
autoFocus: !0,
|
|
169
169
|
onChange: (s) => C(s.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: k || !
|
|
173
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => w("menu"), children: "Back" }),
|
|
174
|
+
/* @__PURE__ */ e("button", { type: "submit", disabled: k || !u.trim(), children: "Join" })
|
|
175
175
|
] })
|
|
176
176
|
]
|
|
177
177
|
}
|
|
@@ -180,150 +180,150 @@ function J({
|
|
|
180
180
|
] })
|
|
181
181
|
] });
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
const
|
|
183
|
+
function J({ workspace: i, onLeft: t }) {
|
|
184
|
+
const d = A(), v = B(), [o, h] = a(null), [m, p] = a(!1);
|
|
185
185
|
async function l() {
|
|
186
|
-
if (!
|
|
187
|
-
|
|
186
|
+
if (!m) {
|
|
187
|
+
p(!0), h(null);
|
|
188
188
|
try {
|
|
189
|
-
await
|
|
190
|
-
} catch (
|
|
191
|
-
h(I(
|
|
189
|
+
await d.leave(i.id), t == null || t();
|
|
190
|
+
} catch (y) {
|
|
191
|
+
h(I(y));
|
|
192
192
|
} finally {
|
|
193
|
-
|
|
193
|
+
p(!1);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-general", "aria-labelledby":
|
|
197
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-general", "aria-labelledby": v, children: [
|
|
198
198
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
199
|
-
/* @__PURE__ */ e("h3", { id:
|
|
199
|
+
/* @__PURE__ */ e("h3", { id: v, children: "General" }),
|
|
200
200
|
/* @__PURE__ */ e("p", { className: "card-sub", children: "Your active workspace and its settings." })
|
|
201
201
|
] }),
|
|
202
202
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
203
203
|
o && /* @__PURE__ */ e("p", { role: "alert", children: o }),
|
|
204
204
|
/* @__PURE__ */ n("div", { className: "field", children: [
|
|
205
205
|
/* @__PURE__ */ e("label", { children: "Workspace name" }),
|
|
206
|
-
/* @__PURE__ */ e("p", { className: "readonly-value", children:
|
|
206
|
+
/* @__PURE__ */ e("p", { className: "readonly-value", children: i.name })
|
|
207
207
|
] }),
|
|
208
208
|
/* @__PURE__ */ n("div", { className: "field", children: [
|
|
209
209
|
/* @__PURE__ */ e("label", { children: "Your role" }),
|
|
210
|
-
/* @__PURE__ */ e("p", { className: "readonly-value", children:
|
|
210
|
+
/* @__PURE__ */ e("p", { className: "readonly-value", children: i.role })
|
|
211
211
|
] }),
|
|
212
212
|
/* @__PURE__ */ n("div", { className: "field leave", children: [
|
|
213
213
|
/* @__PURE__ */ e("label", { children: "Leave workspace" }),
|
|
214
214
|
/* @__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 l(), disabled:
|
|
215
|
+
/* @__PURE__ */ e("button", { type: "button", className: "danger", onClick: () => void l(), disabled: m, children: "Leave workspace" })
|
|
216
216
|
] })
|
|
217
217
|
] })
|
|
218
218
|
] });
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
const
|
|
222
|
-
async function C({ keepError:
|
|
223
|
-
|
|
220
|
+
function V({ workspaceId: i, refreshKey: t = 0, canRemove: d = !1 }) {
|
|
221
|
+
const v = A(), o = B(), [h, m] = a([]), [p, l] = a(null), [y, b] = a(null), [w, g] = a(!0), [N, u] = a(null);
|
|
222
|
+
async function C({ keepError: r = !1 } = {}) {
|
|
223
|
+
r || l(null);
|
|
224
224
|
try {
|
|
225
|
-
const k = await
|
|
226
|
-
|
|
225
|
+
const k = await v.listMembers(i);
|
|
226
|
+
m(k.members);
|
|
227
227
|
} catch (k) {
|
|
228
228
|
l(I(k));
|
|
229
229
|
} finally {
|
|
230
230
|
g(!1);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
U(() => {
|
|
234
234
|
g(!0), C();
|
|
235
|
-
}, [
|
|
236
|
-
async function E(
|
|
237
|
-
if (!
|
|
238
|
-
|
|
235
|
+
}, [v, i, t]);
|
|
236
|
+
async function E(r, k) {
|
|
237
|
+
if (!N) {
|
|
238
|
+
u(r), l(null), b(null), m((_) => _.filter((S) => S.accountId !== r));
|
|
239
239
|
try {
|
|
240
|
-
await
|
|
240
|
+
await v.removeMember(i, r), b(`Removed ${k}`);
|
|
241
241
|
} catch (_) {
|
|
242
242
|
l(I(_)), C({ keepError: !0 });
|
|
243
243
|
} finally {
|
|
244
|
-
|
|
244
|
+
u(null);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
return /* @__PURE__ */ n("section", { className: "shepherd-members", "aria-labelledby": o, children: [
|
|
249
249
|
/* @__PURE__ */ e("div", { className: "card-head", children: /* @__PURE__ */ e("h3", { id: o, children: "Members" }) }),
|
|
250
250
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const k =
|
|
251
|
+
p && /* @__PURE__ */ e("p", { role: "alert", children: p }),
|
|
252
|
+
y && /* @__PURE__ */ e("p", { role: "status", children: y }),
|
|
253
|
+
w ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ e("p", { children: "No members." }) : /* @__PURE__ */ e("ul", { children: h.map((r) => {
|
|
254
|
+
const k = r.displayName ?? r.githubLogin ?? r.accountId;
|
|
255
255
|
return /* @__PURE__ */ n("li", { children: [
|
|
256
256
|
/* @__PURE__ */ e("span", { children: k }),
|
|
257
|
-
/* @__PURE__ */ e("span", { className: "role", children:
|
|
258
|
-
|
|
257
|
+
/* @__PURE__ */ e("span", { className: "role", children: r.role }),
|
|
258
|
+
d && /* @__PURE__ */ e(
|
|
259
259
|
"button",
|
|
260
260
|
{
|
|
261
261
|
type: "button",
|
|
262
262
|
"aria-label": `Remove ${k}`,
|
|
263
|
-
onClick: () => void E(
|
|
264
|
-
disabled:
|
|
263
|
+
onClick: () => void E(r.accountId, k),
|
|
264
|
+
disabled: N === r.accountId,
|
|
265
265
|
children: "Remove"
|
|
266
266
|
}
|
|
267
267
|
)
|
|
268
|
-
] },
|
|
268
|
+
] }, r.accountId);
|
|
269
269
|
}) })
|
|
270
270
|
] })
|
|
271
271
|
] });
|
|
272
272
|
}
|
|
273
|
-
function
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
h(null),
|
|
277
|
-
}, [
|
|
273
|
+
function X({ workspaceId: i, onMembersChanged: t }) {
|
|
274
|
+
const d = A(), v = B(), [o, h] = a(null), [m, p] = a(null), [l, y] = a(!1), [b, w] = a(""), [g, N] = a(null), [u, C] = a(!1), [E, r] = a(null);
|
|
275
|
+
U(() => {
|
|
276
|
+
h(null), N(null);
|
|
277
|
+
}, [i]);
|
|
278
278
|
async function k() {
|
|
279
279
|
if (!l) {
|
|
280
|
-
|
|
280
|
+
y(!0), p(null);
|
|
281
281
|
try {
|
|
282
|
-
const
|
|
283
|
-
h(
|
|
284
|
-
} catch (
|
|
285
|
-
|
|
282
|
+
const f = await d.createInvite(i, {});
|
|
283
|
+
h(f), t == null || t();
|
|
284
|
+
} catch (f) {
|
|
285
|
+
p(I(f));
|
|
286
286
|
} finally {
|
|
287
|
-
|
|
287
|
+
y(!1);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
async function _() {
|
|
292
292
|
if (!(!o || l)) {
|
|
293
|
-
|
|
293
|
+
y(!0), p(null);
|
|
294
294
|
try {
|
|
295
|
-
await
|
|
296
|
-
} catch (
|
|
297
|
-
|
|
295
|
+
await d.revokeInvite(i, o.code), h(null);
|
|
296
|
+
} catch (f) {
|
|
297
|
+
p(I(f));
|
|
298
298
|
} finally {
|
|
299
|
-
|
|
299
|
+
y(!1);
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
async function S() {
|
|
304
|
-
if (!(!b.trim() ||
|
|
305
|
-
C(!0),
|
|
304
|
+
if (!(!b.trim() || u)) {
|
|
305
|
+
C(!0), N(null);
|
|
306
306
|
try {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
} catch (
|
|
310
|
-
|
|
307
|
+
const f = await d.inviteByEmail(i, b.trim());
|
|
308
|
+
N(`Invite sent to ${f.email}.`), w(""), t == null || t();
|
|
309
|
+
} catch (f) {
|
|
310
|
+
N(I(f));
|
|
311
311
|
} finally {
|
|
312
312
|
C(!1);
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
const x = o ? `${window.location.origin}/shepherd/join/${encodeURIComponent(o.code)}` : null;
|
|
317
|
-
async function L(
|
|
318
|
-
await navigator.clipboard.writeText(T),
|
|
317
|
+
async function L(f, T) {
|
|
318
|
+
await navigator.clipboard.writeText(T), r(f), setTimeout(() => r((s) => s === f ? null : s), 2e3);
|
|
319
319
|
}
|
|
320
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-invites", "aria-labelledby":
|
|
320
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-invites", "aria-labelledby": v, children: [
|
|
321
321
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
322
|
-
/* @__PURE__ */ e("h3", { id:
|
|
322
|
+
/* @__PURE__ */ e("h3", { id: v, children: "Invite people" }),
|
|
323
323
|
/* @__PURE__ */ e("p", { className: "card-sub", children: "Share a code, or send a one-time join link by email." })
|
|
324
324
|
] }),
|
|
325
325
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
326
|
-
|
|
326
|
+
m && /* @__PURE__ */ e("p", { role: "alert", children: m }),
|
|
327
327
|
/* @__PURE__ */ n("div", { className: "field invites", children: [
|
|
328
328
|
/* @__PURE__ */ e("label", { children: "Invite by code" }),
|
|
329
329
|
/* @__PURE__ */ e("p", { className: "helper", children: "Anyone with the code can join this workspace." }),
|
|
@@ -381,102 +381,100 @@ function q({ workspaceId: t, onMembersChanged: i }) {
|
|
|
381
381
|
type: "email",
|
|
382
382
|
placeholder: "name@example.com",
|
|
383
383
|
value: b,
|
|
384
|
-
onChange: (
|
|
384
|
+
onChange: (f) => w(f.target.value)
|
|
385
385
|
}
|
|
386
386
|
),
|
|
387
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => void S(), disabled:
|
|
387
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => void S(), disabled: u, children: "Send invite" })
|
|
388
388
|
] }),
|
|
389
389
|
g && /* @__PURE__ */ e("p", { className: "email-invite__status", children: g })
|
|
390
390
|
] })
|
|
391
391
|
] })
|
|
392
392
|
] });
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const q = [
|
|
395
395
|
{ id: "claude", label: "Claude Code" },
|
|
396
396
|
{ id: "codex", label: "Codex" },
|
|
397
397
|
{ id: "pi", label: "Pi" },
|
|
398
398
|
{ id: "generic", label: "Generic (JSON)" }
|
|
399
|
-
],
|
|
399
|
+
], z = "shp_<paste-after-generating>", Q = {
|
|
400
400
|
claude: "claude mcp add shepherd -s user \\",
|
|
401
401
|
codex: "codex mcp add shepherd \\",
|
|
402
402
|
pi: "pi mcp add shepherd \\"
|
|
403
403
|
};
|
|
404
|
-
function
|
|
405
|
-
const
|
|
406
|
-
return `${
|
|
404
|
+
function Z(i, t) {
|
|
405
|
+
const d = `created ${O(i.createdAt, t)}`, v = i.lastUsedAt ? `last used ${O(i.lastUsedAt, t)}` : "never used";
|
|
406
|
+
return `${d} · ${v}`;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
return
|
|
408
|
+
function M(i, t, d) {
|
|
409
|
+
return i === "generic" ? JSON.stringify(
|
|
410
410
|
{
|
|
411
411
|
mcpServers: {
|
|
412
412
|
shepherd: {
|
|
413
413
|
command: "npx",
|
|
414
414
|
args: ["-y", "@korso/shepherd"],
|
|
415
|
-
env: { HUB_URL:
|
|
415
|
+
env: { HUB_URL: t, SHEPHERD_TOKEN: d }
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
},
|
|
419
419
|
null,
|
|
420
420
|
2
|
|
421
421
|
) : [
|
|
422
|
-
|
|
423
|
-
` -e HUB_URL=${
|
|
424
|
-
` -e SHEPHERD_TOKEN=${
|
|
422
|
+
Q[i],
|
|
423
|
+
` -e HUB_URL=${t} \\`,
|
|
424
|
+
` -e SHEPHERD_TOKEN=${d} \\`,
|
|
425
425
|
" -- npx -y @korso/shepherd"
|
|
426
426
|
].join(`
|
|
427
427
|
`);
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
const
|
|
431
|
-
async function
|
|
429
|
+
function ee({ hubUrl: i }) {
|
|
430
|
+
const t = A(), d = i ?? t.baseUrl, v = B(), [o, h] = a("claude"), [m, p] = a(""), [l, y] = a(null), [b, w] = a([]), [g, N] = a(null), [u, C] = a(null), [E, r] = a(!1), [k, _] = a(!1), [S, x] = a(!0), [L, f] = a(null);
|
|
431
|
+
async function T() {
|
|
432
432
|
try {
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
} catch (
|
|
436
|
-
|
|
433
|
+
const c = await t.listAccountTokens();
|
|
434
|
+
w(c.tokens);
|
|
435
|
+
} catch (c) {
|
|
436
|
+
N(I(c));
|
|
437
437
|
} finally {
|
|
438
|
-
|
|
438
|
+
x(!1);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}, [r, t]), j(() => {
|
|
444
|
-
b(null);
|
|
441
|
+
U(() => {
|
|
442
|
+
x(!0), T();
|
|
445
443
|
}, [t]);
|
|
446
|
-
async function
|
|
447
|
-
|
|
444
|
+
async function s() {
|
|
445
|
+
r(!0), N(null);
|
|
448
446
|
try {
|
|
449
|
-
const
|
|
450
|
-
t,
|
|
447
|
+
const c = await t.mintAccountToken(
|
|
451
448
|
m.trim() ? { name: m.trim() } : {}
|
|
452
449
|
);
|
|
453
|
-
|
|
454
|
-
} catch (
|
|
455
|
-
|
|
450
|
+
y(c.token), p(""), await T();
|
|
451
|
+
} catch (c) {
|
|
452
|
+
N(I(c));
|
|
456
453
|
} finally {
|
|
457
|
-
|
|
454
|
+
r(!1);
|
|
458
455
|
}
|
|
459
456
|
}
|
|
460
|
-
async function
|
|
461
|
-
if (!
|
|
462
|
-
|
|
457
|
+
async function R(c) {
|
|
458
|
+
if (!L) {
|
|
459
|
+
f(c), N(null), C(null);
|
|
463
460
|
try {
|
|
464
|
-
await
|
|
465
|
-
} catch (
|
|
466
|
-
|
|
461
|
+
await t.revokeAccountToken(c), w((j) => j.filter((W) => W.id !== c)), C("Token revoked");
|
|
462
|
+
} catch (j) {
|
|
463
|
+
N(I(j));
|
|
467
464
|
} finally {
|
|
468
|
-
|
|
465
|
+
f(null);
|
|
469
466
|
}
|
|
470
467
|
}
|
|
471
468
|
}
|
|
472
|
-
const
|
|
473
|
-
async function
|
|
474
|
-
await navigator.clipboard.writeText(
|
|
469
|
+
const $ = M(o, d, l ?? z);
|
|
470
|
+
async function H() {
|
|
471
|
+
await navigator.clipboard.writeText($), _(!0), setTimeout(() => _(!1), 2e3);
|
|
475
472
|
}
|
|
476
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby":
|
|
473
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby": v, children: [
|
|
477
474
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
478
|
-
/* @__PURE__ */ e("h3", { id:
|
|
479
|
-
/* @__PURE__ */ e("p", { className: "card-sub", children: "Generate a token
|
|
475
|
+
/* @__PURE__ */ e("h3", { id: v, children: "Connect your agent" }),
|
|
476
|
+
/* @__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
|
+
/* @__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." })
|
|
480
478
|
] }),
|
|
481
479
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
482
480
|
/* @__PURE__ */ n("div", { className: "field", children: [
|
|
@@ -485,9 +483,9 @@ function ne({ workspaceId: t, hubUrl: i }) {
|
|
|
485
483
|
"select",
|
|
486
484
|
{
|
|
487
485
|
id: "connect-tool",
|
|
488
|
-
value:
|
|
489
|
-
onChange: (
|
|
490
|
-
children:
|
|
486
|
+
value: o,
|
|
487
|
+
onChange: (c) => h(c.target.value),
|
|
488
|
+
children: q.map((c) => /* @__PURE__ */ e("option", { value: c.id, children: c.label }, c.id))
|
|
491
489
|
}
|
|
492
490
|
)
|
|
493
491
|
] }),
|
|
@@ -500,27 +498,27 @@ function ne({ workspaceId: t, hubUrl: i }) {
|
|
|
500
498
|
id: "token-name",
|
|
501
499
|
type: "text",
|
|
502
500
|
value: m,
|
|
503
|
-
onChange: (
|
|
501
|
+
onChange: (c) => p(c.target.value),
|
|
504
502
|
placeholder: "e.g. laptop"
|
|
505
503
|
}
|
|
506
504
|
),
|
|
507
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => void
|
|
505
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => void s(), disabled: E, children: "Generate token" })
|
|
508
506
|
] })
|
|
509
507
|
] }),
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
508
|
+
g && /* @__PURE__ */ e("p", { role: "alert", children: g }),
|
|
509
|
+
u && /* @__PURE__ */ e("p", { role: "status", children: u }),
|
|
510
|
+
l && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
|
|
513
511
|
/* @__PURE__ */ n("div", { className: "install-command", children: [
|
|
514
|
-
/* @__PURE__ */ e("pre", { "data-testid": "install-command", children:
|
|
512
|
+
/* @__PURE__ */ e("pre", { "data-testid": "install-command", children: $ }),
|
|
515
513
|
/* @__PURE__ */ e(
|
|
516
514
|
"button",
|
|
517
515
|
{
|
|
518
516
|
type: "button",
|
|
519
517
|
className: "install-command__copy",
|
|
520
|
-
"aria-label":
|
|
521
|
-
title:
|
|
522
|
-
onClick: () => void
|
|
523
|
-
children:
|
|
518
|
+
"aria-label": k ? "Copied" : "Copy command",
|
|
519
|
+
title: k ? "Copied" : "Copy",
|
|
520
|
+
onClick: () => void H(),
|
|
521
|
+
children: k ? /* @__PURE__ */ e(
|
|
524
522
|
"svg",
|
|
525
523
|
{
|
|
526
524
|
width: "15",
|
|
@@ -556,110 +554,110 @@ function ne({ workspaceId: t, hubUrl: i }) {
|
|
|
556
554
|
)
|
|
557
555
|
] }),
|
|
558
556
|
/* @__PURE__ */ e("h4", { children: "Existing tokens" }),
|
|
559
|
-
|
|
560
|
-
const
|
|
557
|
+
S ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : b.length === 0 ? /* @__PURE__ */ e("p", { children: "No tokens yet." }) : /* @__PURE__ */ e("ul", { children: b.map((c) => {
|
|
558
|
+
const j = c.name ?? c.id;
|
|
561
559
|
return /* @__PURE__ */ n("li", { children: [
|
|
562
|
-
/* @__PURE__ */ e("span", { children:
|
|
563
|
-
/* @__PURE__ */ e("span", { className: "token-meta", children:
|
|
564
|
-
|
|
560
|
+
/* @__PURE__ */ e("span", { children: j }),
|
|
561
|
+
/* @__PURE__ */ e("span", { className: "token-meta", children: Z(c, Date.now()) }),
|
|
562
|
+
c.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
|
|
565
563
|
"button",
|
|
566
564
|
{
|
|
567
565
|
type: "button",
|
|
568
|
-
"aria-label": `Revoke token ${
|
|
569
|
-
onClick: () => void
|
|
570
|
-
disabled:
|
|
566
|
+
"aria-label": `Revoke token ${j}`,
|
|
567
|
+
onClick: () => void R(c.id),
|
|
568
|
+
disabled: L === c.id,
|
|
571
569
|
children: "Revoke"
|
|
572
570
|
}
|
|
573
571
|
)
|
|
574
|
-
] },
|
|
572
|
+
] }, c.id);
|
|
575
573
|
}) })
|
|
576
574
|
] })
|
|
577
575
|
] });
|
|
578
576
|
}
|
|
579
|
-
const
|
|
577
|
+
const ne = [
|
|
580
578
|
{ id: "general", label: "General" },
|
|
581
579
|
{ id: "members", label: "Members" },
|
|
582
580
|
{ id: "agent", label: "Agent" }
|
|
583
581
|
];
|
|
584
|
-
function
|
|
585
|
-
workspace:
|
|
586
|
-
hubUrl:
|
|
587
|
-
membersRefreshKey:
|
|
588
|
-
onMembersChanged:
|
|
582
|
+
function te({
|
|
583
|
+
workspace: i,
|
|
584
|
+
hubUrl: t,
|
|
585
|
+
membersRefreshKey: d,
|
|
586
|
+
onMembersChanged: v,
|
|
589
587
|
onLeft: o
|
|
590
588
|
}) {
|
|
591
|
-
const [h,
|
|
589
|
+
const [h, m] = a("general"), p = i.role === "admin";
|
|
592
590
|
return /* @__PURE__ */ n("div", { className: "config-layout", children: [
|
|
593
|
-
/* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children:
|
|
591
|
+
/* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children: ne.map(({ id: l, label: y }) => /* @__PURE__ */ e(
|
|
594
592
|
"button",
|
|
595
593
|
{
|
|
596
594
|
type: "button",
|
|
597
595
|
className: "config-nav__item" + (h === l ? " config-nav__item--on" : ""),
|
|
598
596
|
"aria-current": h === l ? "page" : void 0,
|
|
599
|
-
onClick: () =>
|
|
600
|
-
children:
|
|
597
|
+
onClick: () => m(l),
|
|
598
|
+
children: y
|
|
601
599
|
},
|
|
602
600
|
l
|
|
603
601
|
)) }),
|
|
604
602
|
/* @__PURE__ */ n("div", { className: "config-panel", children: [
|
|
605
|
-
h === "general" && /* @__PURE__ */ e(
|
|
606
|
-
h === "members" && /* @__PURE__ */ n(
|
|
603
|
+
h === "general" && /* @__PURE__ */ e(J, { workspace: i, onLeft: o }),
|
|
604
|
+
h === "members" && /* @__PURE__ */ n(F, { children: [
|
|
607
605
|
/* @__PURE__ */ e(
|
|
608
|
-
|
|
606
|
+
V,
|
|
609
607
|
{
|
|
610
|
-
workspaceId:
|
|
611
|
-
refreshKey:
|
|
612
|
-
canRemove:
|
|
608
|
+
workspaceId: i.id,
|
|
609
|
+
refreshKey: d,
|
|
610
|
+
canRemove: p
|
|
613
611
|
}
|
|
614
612
|
),
|
|
615
|
-
|
|
613
|
+
p && /* @__PURE__ */ e(X, { workspaceId: i.id, onMembersChanged: v })
|
|
616
614
|
] }),
|
|
617
|
-
h === "agent" && /* @__PURE__ */ e(
|
|
615
|
+
h === "agent" && /* @__PURE__ */ e(ee, { hubUrl: t })
|
|
618
616
|
] })
|
|
619
617
|
] });
|
|
620
618
|
}
|
|
621
|
-
function
|
|
622
|
-
const
|
|
619
|
+
function re({ hubUrl: i }) {
|
|
620
|
+
const t = A(), [d, v] = a({ status: "loading" }), [o, h] = a(null), [m, p] = a(0), l = K(async () => {
|
|
623
621
|
try {
|
|
624
|
-
const
|
|
625
|
-
|
|
622
|
+
const u = await t.listWorkspaces();
|
|
623
|
+
v({ status: "ready", workspaces: u.workspaces }), h(
|
|
626
624
|
(C) => {
|
|
627
625
|
var E;
|
|
628
|
-
return C &&
|
|
626
|
+
return C && u.workspaces.some((r) => r.id === C) ? C : ((E = u.workspaces[0]) == null ? void 0 : E.id) ?? null;
|
|
629
627
|
}
|
|
630
628
|
);
|
|
631
|
-
} catch (
|
|
632
|
-
|
|
629
|
+
} catch (u) {
|
|
630
|
+
v({ status: "error", message: I(u) });
|
|
633
631
|
}
|
|
634
|
-
}, [
|
|
635
|
-
|
|
632
|
+
}, [t]);
|
|
633
|
+
U(() => {
|
|
636
634
|
l();
|
|
637
635
|
}, [l]);
|
|
638
|
-
const
|
|
639
|
-
if (
|
|
636
|
+
const y = d.status === "ready" ? d.workspaces : [], b = y.find((u) => u.id === o) ?? null;
|
|
637
|
+
if (d.status === "loading")
|
|
640
638
|
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) });
|
|
641
|
-
if (
|
|
642
|
-
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children:
|
|
643
|
-
const
|
|
644
|
-
|
|
639
|
+
if (d.status === "error")
|
|
640
|
+
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: d.message }) });
|
|
641
|
+
const w = y.length > 0, g = /* @__PURE__ */ e(
|
|
642
|
+
Y,
|
|
645
643
|
{
|
|
646
|
-
workspaces:
|
|
644
|
+
workspaces: y,
|
|
647
645
|
selected: b,
|
|
648
646
|
onSelect: h,
|
|
649
647
|
onChanged: () => {
|
|
650
648
|
l();
|
|
651
649
|
},
|
|
652
|
-
onMembersChanged: () =>
|
|
650
|
+
onMembersChanged: () => p((u) => u + 1)
|
|
653
651
|
}
|
|
654
|
-
),
|
|
652
|
+
), N = /* @__PURE__ */ n("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
|
|
655
653
|
/* @__PURE__ */ e("h2", { id: "config-heading", children: "Configuration" }),
|
|
656
654
|
b ? /* @__PURE__ */ e(
|
|
657
|
-
|
|
655
|
+
te,
|
|
658
656
|
{
|
|
659
657
|
workspace: b,
|
|
660
|
-
hubUrl:
|
|
661
|
-
membersRefreshKey:
|
|
662
|
-
onMembersChanged: () =>
|
|
658
|
+
hubUrl: i,
|
|
659
|
+
membersRefreshKey: m,
|
|
660
|
+
onMembersChanged: () => p((u) => u + 1),
|
|
663
661
|
onLeft: () => void l()
|
|
664
662
|
}
|
|
665
663
|
) : /* @__PURE__ */ n("p", { className: "config-none", children: [
|
|
@@ -669,28 +667,28 @@ function se({ hubUrl: t }) {
|
|
|
669
667
|
] })
|
|
670
668
|
] });
|
|
671
669
|
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e(
|
|
672
|
-
|
|
670
|
+
G,
|
|
673
671
|
{
|
|
674
672
|
workspaceId: b == null ? void 0 : b.id,
|
|
675
|
-
config:
|
|
673
|
+
config: N,
|
|
676
674
|
switcher: g,
|
|
677
|
-
hasWorkspace:
|
|
675
|
+
hasWorkspace: w
|
|
678
676
|
}
|
|
679
677
|
) });
|
|
680
678
|
}
|
|
681
679
|
export {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
680
|
+
te as ConfigPanel,
|
|
681
|
+
ee as ConnectAgent,
|
|
682
|
+
G as Dashboard,
|
|
683
|
+
ce as EmptyState,
|
|
684
|
+
J as GeneralSettings,
|
|
685
|
+
X as Invites,
|
|
686
|
+
V as Members,
|
|
687
|
+
de as ShepherdClientError,
|
|
688
|
+
ue as ShepherdClientProvider,
|
|
689
|
+
re as ShepherdRoot,
|
|
690
|
+
Y as WorkspaceSwitcher,
|
|
691
|
+
he as createShepherdClient,
|
|
694
692
|
I as describeError,
|
|
695
693
|
A as useShepherdClient
|
|
696
694
|
};
|