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