@korso/shepherd-ui 0.3.0 → 0.4.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 +13 -12
- package/dist/components/Dashboard.d.ts +7 -1
- package/dist/components/Dashboard.js +2 -2
- package/dist/config/ConfigPanel.d.ts +14 -0
- package/dist/config/ConfigPanel.js +16 -0
- package/dist/config/ConnectAgent.js +1 -1
- package/dist/config/GeneralSettings.d.ts +8 -0
- package/dist/config/GeneralSettings.js +27 -0
- package/dist/config/Invites.d.ts +7 -0
- package/dist/config/Invites.js +84 -0
- package/dist/config/Members.d.ts +1 -3
- package/dist/config/Members.js +4 -23
- package/dist/config/WorkspaceSwitcher.d.ts +14 -0
- package/dist/config/WorkspaceSwitcher.js +108 -0
- package/dist/config/index.d.ts +8 -2
- package/dist/config/index.js +6 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/lib/Dashboard-CTXdGRxM.js +1398 -0
- package/dist/lib/index.d.ts +56 -20
- package/dist/lib/index.js +551 -299
- package/dist/lib/selfhost.js +1 -1
- package/dist/lib/styles.css +128 -18
- package/dist/preview.js +28 -4
- package/dist/selfhost/assets/index-BSnsUIT-.js +40 -0
- package/dist/selfhost/assets/index-CK7qrsNo.css +1 -0
- package/dist/selfhost/index.html +2 -2
- package/package.json +1 -1
- package/dist/config/Workspaces.d.ts +0 -15
- package/dist/config/Workspaces.js +0 -116
- package/dist/lib/Dashboard-Bgi50wCo.js +0 -1396
- package/dist/selfhost/assets/index-D0C3m6st.js +0 -40
- package/dist/selfhost/assets/index-rNR1Acph.css +0 -1
|
@@ -0,0 +1,1398 @@
|
|
|
1
|
+
var Ie = Object.defineProperty;
|
|
2
|
+
var xe = (t, n, c) => n in t ? Ie(t, n, { enumerable: !0, configurable: !0, writable: !0, value: c }) : t[n] = c;
|
|
3
|
+
var ue = (t, n, c) => xe(t, typeof n != "symbol" ? n + "" : n, c);
|
|
4
|
+
import { jsx as r, jsxs as m, Fragment as W } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as Me, useContext as Le, useState as N, useRef as P, useCallback as E, useEffect as se, Fragment as Pe, useLayoutEffect as Oe, useId as we } from "react";
|
|
6
|
+
import { z as e } from "zod";
|
|
7
|
+
const R = e.string(), Y = e.number(), Ge = e.object({
|
|
8
|
+
agentName: e.string(),
|
|
9
|
+
human: e.string(),
|
|
10
|
+
branch: e.string(),
|
|
11
|
+
kind: e.enum(["committed", "uncommitted"]),
|
|
12
|
+
commitSha: e.string().nullable(),
|
|
13
|
+
message: e.string().nullable(),
|
|
14
|
+
paths: e.array(e.string()).min(1),
|
|
15
|
+
authorIsLive: e.boolean(),
|
|
16
|
+
authorLastActiveAt: R,
|
|
17
|
+
updatedAt: R
|
|
18
|
+
}), Fe = e.object({
|
|
19
|
+
kind: e.enum(["committed", "uncommitted"]),
|
|
20
|
+
// A git object id (lowercase hex, 4–64 chars) for `committed` entries, or null
|
|
21
|
+
// for `uncommitted`. This value is forwarded by the hub to OTHER clients, which
|
|
22
|
+
// feed it straight into local `git` argument vectors (isAncestor/hasCommit/
|
|
23
|
+
// changedLineRanges). Validating the shape at the wire boundary stops an
|
|
24
|
+
// attacker-controlled, flag-like value (e.g. "--output=...") from being parsed
|
|
25
|
+
// by git as an option on a teammate's machine (argument injection). gitContext
|
|
26
|
+
// re-validates defensively as well.
|
|
27
|
+
sha: e.string().regex(/^[0-9a-f]{4,64}$/).nullable(),
|
|
28
|
+
message: e.string().nullable(),
|
|
29
|
+
paths: e.array(e.string()).min(1).max(500)
|
|
30
|
+
}), ae = e.object({
|
|
31
|
+
branch: e.string(),
|
|
32
|
+
baseBranch: e.string(),
|
|
33
|
+
head: e.string(),
|
|
34
|
+
truncated: e.boolean().default(!1),
|
|
35
|
+
// The only producer (gitContext.unlandedCommits) emits at most MAX_COMMITS
|
|
36
|
+
// (100) committed entries + 1 uncommitted, so this ceiling is generous. If
|
|
37
|
+
// MAX_COMMITS is ever raised above ~599, raise this in lockstep or the hub
|
|
38
|
+
// will start 400-rejecting otherwise-valid reports.
|
|
39
|
+
entries: e.array(Fe).max(600)
|
|
40
|
+
}), Z = e.object({
|
|
41
|
+
workItemId: e.string().uuid(),
|
|
42
|
+
agentName: e.string(),
|
|
43
|
+
human: e.string().min(1),
|
|
44
|
+
intent: e.string().min(1).max(2048),
|
|
45
|
+
pathGlobs: e.array(e.string().min(1).max(512)).min(1).max(64),
|
|
46
|
+
// ISO timestamp string; see IsoTimestamp note above
|
|
47
|
+
expiresAt: R
|
|
48
|
+
}), V = e.object({
|
|
49
|
+
// bigint PK serialised as number; see DbId note above
|
|
50
|
+
id: Y,
|
|
51
|
+
fromAgentName: e.string(),
|
|
52
|
+
fromHuman: e.string().min(1),
|
|
53
|
+
body: e.string().min(1).max(8192),
|
|
54
|
+
targetAgentName: e.string().nullable(),
|
|
55
|
+
// ISO timestamp string; see IsoTimestamp note above
|
|
56
|
+
createdAt: R
|
|
57
|
+
}), Ae = e.object({
|
|
58
|
+
conflicts: e.array(Z),
|
|
59
|
+
activeClaims: e.array(Z),
|
|
60
|
+
// The caller's OWN active claims. `activeClaims` deliberately excludes the
|
|
61
|
+
// caller's session, so without this an agent has no way to confirm its own
|
|
62
|
+
// claim is live. Optional with a default so an older client talking to a
|
|
63
|
+
// newer hub (or vice-versa) never fails validation on its absence.
|
|
64
|
+
yourClaims: e.array(Z).default([]),
|
|
65
|
+
announcements: e.array(V),
|
|
66
|
+
// Per-agent change records for the workspace. Defaulted for version-skew safety.
|
|
67
|
+
changeRecords: e.array(Ge).default([])
|
|
68
|
+
}), Ue = e.object({
|
|
69
|
+
name: e.string(),
|
|
70
|
+
human: e.string(),
|
|
71
|
+
program: e.string(),
|
|
72
|
+
// model is nullable in the DB (may be unknown when an agent first joins).
|
|
73
|
+
model: e.string().nullable(),
|
|
74
|
+
// repo/branch/lastHeartbeatAt come from the agent's most-recent session and
|
|
75
|
+
// are null when the agent has no session yet.
|
|
76
|
+
repo: e.string().nullable(),
|
|
77
|
+
branch: e.string().nullable(),
|
|
78
|
+
lastHeartbeatAt: R.nullable(),
|
|
79
|
+
presence: e.enum(["live", "offline"])
|
|
80
|
+
}), He = e.enum(["active", "done", "dropped"]), We = e.object({
|
|
81
|
+
agentName: e.string(),
|
|
82
|
+
program: e.string(),
|
|
83
|
+
model: e.string().nullable(),
|
|
84
|
+
repo: e.string(),
|
|
85
|
+
intent: e.string(),
|
|
86
|
+
pathGlobs: e.array(e.string()),
|
|
87
|
+
status: He,
|
|
88
|
+
createdAt: R,
|
|
89
|
+
endedAt: R.nullable()
|
|
90
|
+
}), qe = e.object({
|
|
91
|
+
fromAgentName: e.string(),
|
|
92
|
+
fromHuman: e.string(),
|
|
93
|
+
body: e.string(),
|
|
94
|
+
targetAgentName: e.string().nullable(),
|
|
95
|
+
repo: e.string(),
|
|
96
|
+
// True when the message was sent by the human operator from the dashboard
|
|
97
|
+
// (no agent session). The dashboard renders these as "me" (right-aligned).
|
|
98
|
+
// Defaulted for version-skew safety with older hubs.
|
|
99
|
+
fromAdmin: e.boolean().default(!1),
|
|
100
|
+
// True when an agent addressed the message TO the operator (the mirror of
|
|
101
|
+
// fromAdmin). The dashboard renders these as "<agent> → admin". Not delivered
|
|
102
|
+
// to other agents. Defaulted for version-skew safety with older hubs.
|
|
103
|
+
toAdmin: e.boolean().default(!1),
|
|
104
|
+
createdAt: R
|
|
105
|
+
}), me = e.object({
|
|
106
|
+
agents: e.array(Ue),
|
|
107
|
+
tasks: e.array(We),
|
|
108
|
+
announcements: e.array(qe),
|
|
109
|
+
// The server's clock, so the client computes "expires in / last seen" against
|
|
110
|
+
// the hub rather than the (possibly skewed) browser clock.
|
|
111
|
+
serverTime: R
|
|
112
|
+
});
|
|
113
|
+
e.object({
|
|
114
|
+
body: e.string().min(1).max(8192),
|
|
115
|
+
// Direct-message a single agent (by the exact name shown in the landscape).
|
|
116
|
+
// Absent/null => broadcast. The hub resolves the target's repo server-side.
|
|
117
|
+
targetAgentName: e.string().min(1).nullable().optional(),
|
|
118
|
+
// For a broadcast, the repo to scope the message to (matches the dashboard's
|
|
119
|
+
// selected repo). Absent/null => fan out to every repo in the workspace.
|
|
120
|
+
// Ignored for a DM (the target's own repo is used).
|
|
121
|
+
repo: e.string().min(1).nullable().optional()
|
|
122
|
+
});
|
|
123
|
+
const he = e.object({
|
|
124
|
+
ok: e.literal(!0),
|
|
125
|
+
// One id per inserted row: a single id for a DM or repo-scoped broadcast, or
|
|
126
|
+
// several when an all-repos broadcast fans out across repos.
|
|
127
|
+
announcementIds: e.array(Y)
|
|
128
|
+
});
|
|
129
|
+
e.object({
|
|
130
|
+
workspace: e.string().min(1),
|
|
131
|
+
repo: e.string().min(1),
|
|
132
|
+
branch: e.string().min(1),
|
|
133
|
+
human: e.string().min(1),
|
|
134
|
+
program: e.string().min(1),
|
|
135
|
+
model: e.string().min(1).optional()
|
|
136
|
+
});
|
|
137
|
+
e.object({
|
|
138
|
+
agentName: e.string(),
|
|
139
|
+
sessionId: e.string().uuid()
|
|
140
|
+
});
|
|
141
|
+
const Be = e.object({
|
|
142
|
+
sessionId: e.string().uuid(),
|
|
143
|
+
intent: e.string().min(1).max(2048),
|
|
144
|
+
pathGlobs: e.array(e.string().min(1).max(512)).min(1).max(64),
|
|
145
|
+
ttlSeconds: e.number().int().positive().optional(),
|
|
146
|
+
changeReport: ae.optional()
|
|
147
|
+
});
|
|
148
|
+
e.object({
|
|
149
|
+
workItemId: e.string().uuid(),
|
|
150
|
+
landscape: Ae
|
|
151
|
+
});
|
|
152
|
+
const Ke = e.object({
|
|
153
|
+
sessionId: e.string().uuid(),
|
|
154
|
+
workItemId: e.string().uuid()
|
|
155
|
+
});
|
|
156
|
+
e.object({
|
|
157
|
+
ok: e.literal(!0),
|
|
158
|
+
// Pending announcements for the caller, delivered as a side effect of done so
|
|
159
|
+
// a message lands the moment a teammate finishes a unit of work (not only on
|
|
160
|
+
// their next work/sync). Defaulted for version-skew safety with older hubs.
|
|
161
|
+
announcements: e.array(V).default([])
|
|
162
|
+
});
|
|
163
|
+
const ze = e.object({
|
|
164
|
+
sessionId: e.string().uuid(),
|
|
165
|
+
body: e.string().min(1).max(8192),
|
|
166
|
+
// absent or null => broadcast to all agents in the workspace
|
|
167
|
+
targetAgentName: e.string().nullable().optional(),
|
|
168
|
+
// true => address the human operator (the dashboard) instead of agents. The
|
|
169
|
+
// mirror of the operator's admin → agent DM: it shows in the workspace feed as
|
|
170
|
+
// "<agent> → admin" and is NOT delivered to other agents. Mutually exclusive
|
|
171
|
+
// with targetAgentName (the hub rejects setting both). Defaulted/optional for
|
|
172
|
+
// version skew with older clients.
|
|
173
|
+
toAdmin: e.boolean().optional()
|
|
174
|
+
});
|
|
175
|
+
e.object({
|
|
176
|
+
ok: e.literal(!0),
|
|
177
|
+
// bigint PK serialised as number; see DbId note above
|
|
178
|
+
announcementId: Y,
|
|
179
|
+
// Pending announcements for the caller, delivered as a side effect of announce
|
|
180
|
+
// (a turn where the agent is already reading hub output) so inbound messages
|
|
181
|
+
// surface promptly. Excludes the just-sent one. Defaulted for version skew.
|
|
182
|
+
announcements: e.array(V).default([])
|
|
183
|
+
});
|
|
184
|
+
e.object({
|
|
185
|
+
sessionId: e.string().uuid(),
|
|
186
|
+
changeReport: ae.optional()
|
|
187
|
+
});
|
|
188
|
+
e.object({
|
|
189
|
+
landscape: Ae
|
|
190
|
+
});
|
|
191
|
+
Be.omit({ sessionId: !0, changeReport: !0 });
|
|
192
|
+
ze.omit({ sessionId: !0 });
|
|
193
|
+
Ke.omit({ sessionId: !0 });
|
|
194
|
+
e.object({});
|
|
195
|
+
e.object({});
|
|
196
|
+
e.object({
|
|
197
|
+
sessionId: e.string().uuid(),
|
|
198
|
+
// Optional change report so the BACKGROUND heartbeat keeps an agent's durable
|
|
199
|
+
// change records fresh (commits surface within ~one heartbeat interval, not
|
|
200
|
+
// only when it next calls work/sync). Processed presence-style: it refreshes
|
|
201
|
+
// change records but, like the rest of heartbeat, does NOT renew claim TTLs.
|
|
202
|
+
changeReport: ae.optional(),
|
|
203
|
+
// Opt-in: when set, the heartbeat returns any pending announcements for the
|
|
204
|
+
// caller in the response. Delivery is now TWO-PHASE and crash-safe: this fetch
|
|
205
|
+
// phase does NOT mark them delivered — the client persists them to its
|
|
206
|
+
// model-visible sink (the local inbox file drained by a hook) FIRST, then acks
|
|
207
|
+
// via `ackAnnouncementIds` so the hub records the delivery only after the local
|
|
208
|
+
// write is confirmed. The MCP client only sets this when it actually has such a
|
|
209
|
+
// sink. Absent for older clients, so default behaviour (no delivery) is
|
|
210
|
+
// unchanged.
|
|
211
|
+
deliverAnnouncements: e.boolean().optional(),
|
|
212
|
+
// Phase-two ack of a previous `deliverAnnouncements` fetch: the ids the client
|
|
213
|
+
// has now durably written to its model-visible sink. The hub marks exactly
|
|
214
|
+
// these delivered to the caller's session. Decoupling the mark from the fetch
|
|
215
|
+
// guarantees a message is never recorded delivered before the client holds it
|
|
216
|
+
// (a lost response or a failed local append simply leaves it pending for the
|
|
217
|
+
// next beat). Absent on a plain presence/fetch beat.
|
|
218
|
+
ackAnnouncementIds: e.array(Y).optional()
|
|
219
|
+
});
|
|
220
|
+
e.object({
|
|
221
|
+
ok: e.literal(!0),
|
|
222
|
+
// Pending announcements for the caller, delivered only when the request set
|
|
223
|
+
// `deliverAnnouncements`. Defaulted to [] for version-skew safety with older
|
|
224
|
+
// hubs (which return just { ok: true }).
|
|
225
|
+
announcements: e.array(V).default([])
|
|
226
|
+
});
|
|
227
|
+
e.object({
|
|
228
|
+
sessionId: e.string().uuid()
|
|
229
|
+
});
|
|
230
|
+
e.object({
|
|
231
|
+
ok: e.literal(!0)
|
|
232
|
+
});
|
|
233
|
+
const Se = e.enum(["admin", "member"]), re = e.object({
|
|
234
|
+
id: e.string(),
|
|
235
|
+
slug: e.string(),
|
|
236
|
+
name: e.string(),
|
|
237
|
+
role: Se
|
|
238
|
+
});
|
|
239
|
+
e.object({
|
|
240
|
+
name: e.string().min(1)
|
|
241
|
+
});
|
|
242
|
+
const Ye = re, Ve = e.object({
|
|
243
|
+
workspaces: e.array(re)
|
|
244
|
+
});
|
|
245
|
+
e.object({
|
|
246
|
+
name: e.string().min(1).optional()
|
|
247
|
+
});
|
|
248
|
+
const Xe = e.object({
|
|
249
|
+
// The raw shp_ token, shown once at creation and never returned again.
|
|
250
|
+
token: e.string(),
|
|
251
|
+
id: e.string()
|
|
252
|
+
}), Ze = e.object({
|
|
253
|
+
id: e.string(),
|
|
254
|
+
name: e.string().nullable(),
|
|
255
|
+
// ISO timestamp string (see IsoTimestamp note above) or null when unused / not revoked.
|
|
256
|
+
lastUsedAt: R.nullable(),
|
|
257
|
+
createdAt: R,
|
|
258
|
+
revokedAt: R.nullable()
|
|
259
|
+
}), Je = e.object({
|
|
260
|
+
tokens: e.array(Ze)
|
|
261
|
+
});
|
|
262
|
+
e.object({
|
|
263
|
+
expiresInDays: e.number().int().positive().optional(),
|
|
264
|
+
// Omitted = unlimited, redeemable until explicitly revoked. Pass a positive
|
|
265
|
+
// integer to cap it instead.
|
|
266
|
+
maxUses: e.number().int().positive().optional()
|
|
267
|
+
});
|
|
268
|
+
const Qe = e.object({
|
|
269
|
+
code: e.string(),
|
|
270
|
+
// ISO timestamp string, or null when the invite never expires.
|
|
271
|
+
expiresAt: R.nullable(),
|
|
272
|
+
// null = unlimited (redeemable until revoked).
|
|
273
|
+
maxUses: e.number().int().positive().nullable(),
|
|
274
|
+
useCount: e.number().int().nonnegative()
|
|
275
|
+
});
|
|
276
|
+
e.object({
|
|
277
|
+
email: e.string().email()
|
|
278
|
+
});
|
|
279
|
+
const et = e.object({
|
|
280
|
+
email: e.string(),
|
|
281
|
+
sentAt: R
|
|
282
|
+
}), tt = e.object({
|
|
283
|
+
// The workspace the caller just joined.
|
|
284
|
+
workspace: re
|
|
285
|
+
}), nt = e.object({
|
|
286
|
+
accountId: e.string(),
|
|
287
|
+
displayName: e.string().nullable(),
|
|
288
|
+
githubLogin: e.string().nullable(),
|
|
289
|
+
avatarUrl: e.string().nullable(),
|
|
290
|
+
role: Se
|
|
291
|
+
}), st = e.object({
|
|
292
|
+
members: e.array(nt)
|
|
293
|
+
}), at = e.enum(["bug", "suggestion", "other"]);
|
|
294
|
+
e.object({
|
|
295
|
+
type: at,
|
|
296
|
+
body: e.string().trim().min(1).max(4e3)
|
|
297
|
+
});
|
|
298
|
+
const rt = e.object({
|
|
299
|
+
ok: e.literal(!0),
|
|
300
|
+
// uuid PK (the feedback table, like workspaces, uses gen_random_uuid()).
|
|
301
|
+
id: e.string()
|
|
302
|
+
}), ot = 5e3;
|
|
303
|
+
class H extends Error {
|
|
304
|
+
/**
|
|
305
|
+
* @param message - Human-readable failure description.
|
|
306
|
+
* @param status - Upstream HTTP status, omitted for network/abort failures.
|
|
307
|
+
*/
|
|
308
|
+
constructor(c, o) {
|
|
309
|
+
super(c);
|
|
310
|
+
/** Upstream HTTP status for a non-2xx response; absent for transport errors. */
|
|
311
|
+
ue(this, "status");
|
|
312
|
+
this.name = "ShepherdClientError", o !== void 0 && (this.status = o);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function it(t) {
|
|
316
|
+
return t instanceof Error ? t.message : "Something went wrong.";
|
|
317
|
+
}
|
|
318
|
+
async function ct(t) {
|
|
319
|
+
try {
|
|
320
|
+
const n = await t.json();
|
|
321
|
+
if (n !== null && typeof n == "object" && "error" in n && typeof n.error == "string")
|
|
322
|
+
return n.error;
|
|
323
|
+
} catch {
|
|
324
|
+
}
|
|
325
|
+
return "";
|
|
326
|
+
}
|
|
327
|
+
function Wt(t) {
|
|
328
|
+
const n = t.baseUrl.replace(/\/$/, ""), c = t.timeoutMs ?? ot, o = encodeURIComponent;
|
|
329
|
+
async function s(a, i, l = {}) {
|
|
330
|
+
var f, y;
|
|
331
|
+
const h = new AbortController(), u = setTimeout(() => h.abort(), c);
|
|
332
|
+
let d;
|
|
333
|
+
try {
|
|
334
|
+
const v = {
|
|
335
|
+
"Content-Type": "application/json"
|
|
336
|
+
}, A = await ((f = t.getAuthHeader) == null ? void 0 : f.call(t)), S = {
|
|
337
|
+
method: a,
|
|
338
|
+
headers: { ...v, ...typeof A == "string" ? { Authorization: A } : A ?? {} },
|
|
339
|
+
signal: h.signal
|
|
340
|
+
};
|
|
341
|
+
l.body !== void 0 && (S.body = JSON.stringify(l.body)), d = await fetch(`${n}${i}`, S);
|
|
342
|
+
} catch (v) {
|
|
343
|
+
throw new H(
|
|
344
|
+
v instanceof Error ? v.message : String(v)
|
|
345
|
+
);
|
|
346
|
+
} finally {
|
|
347
|
+
clearTimeout(u);
|
|
348
|
+
}
|
|
349
|
+
if (d.status === 401)
|
|
350
|
+
throw (y = t.onUnauthorized) == null || y.call(t), new H("Unauthorized", 401);
|
|
351
|
+
if (!d.ok) {
|
|
352
|
+
const v = await ct(d);
|
|
353
|
+
throw new H(
|
|
354
|
+
v !== "" ? `HTTP ${d.status}: ${v}` : `HTTP ${d.status}`,
|
|
355
|
+
d.status
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
if (!l.schema) {
|
|
359
|
+
try {
|
|
360
|
+
await d.json();
|
|
361
|
+
} catch {
|
|
362
|
+
}
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const b = l.schema.safeParse(await d.json());
|
|
366
|
+
if (!b.success)
|
|
367
|
+
throw new H("Invalid response schema");
|
|
368
|
+
return b.data;
|
|
369
|
+
}
|
|
370
|
+
return {
|
|
371
|
+
baseUrl: n,
|
|
372
|
+
// --- multi-workspace management surface ---------------------------------
|
|
373
|
+
listWorkspaces() {
|
|
374
|
+
return s("GET", "/workspaces", {
|
|
375
|
+
schema: Ve
|
|
376
|
+
});
|
|
377
|
+
},
|
|
378
|
+
createWorkspace(a) {
|
|
379
|
+
return s("POST", "/workspaces", {
|
|
380
|
+
body: a,
|
|
381
|
+
schema: Ye
|
|
382
|
+
});
|
|
383
|
+
},
|
|
384
|
+
mintToken(a, i) {
|
|
385
|
+
return s("POST", `/workspaces/${o(a)}/tokens`, {
|
|
386
|
+
body: i,
|
|
387
|
+
schema: Xe
|
|
388
|
+
});
|
|
389
|
+
},
|
|
390
|
+
listTokens(a) {
|
|
391
|
+
return s("GET", `/workspaces/${o(a)}/tokens`, {
|
|
392
|
+
schema: Je
|
|
393
|
+
});
|
|
394
|
+
},
|
|
395
|
+
revokeToken(a, i) {
|
|
396
|
+
return s(
|
|
397
|
+
"DELETE",
|
|
398
|
+
`/workspaces/${o(a)}/tokens/${o(i)}`
|
|
399
|
+
);
|
|
400
|
+
},
|
|
401
|
+
createInvite(a, i) {
|
|
402
|
+
return s("POST", `/workspaces/${o(a)}/invites`, {
|
|
403
|
+
body: i,
|
|
404
|
+
schema: Qe
|
|
405
|
+
});
|
|
406
|
+
},
|
|
407
|
+
inviteByEmail(a, i) {
|
|
408
|
+
return s("POST", `/workspaces/${o(a)}/invites/email`, {
|
|
409
|
+
body: { email: i },
|
|
410
|
+
schema: et
|
|
411
|
+
});
|
|
412
|
+
},
|
|
413
|
+
revokeInvite(a, i) {
|
|
414
|
+
return s(
|
|
415
|
+
"POST",
|
|
416
|
+
`/workspaces/${o(a)}/invites/${o(i)}/revoke`
|
|
417
|
+
);
|
|
418
|
+
},
|
|
419
|
+
redeemInvite(a) {
|
|
420
|
+
return s("POST", `/invites/${o(a)}/redeem`, {
|
|
421
|
+
schema: tt
|
|
422
|
+
});
|
|
423
|
+
},
|
|
424
|
+
listMembers(a) {
|
|
425
|
+
return s("GET", `/workspaces/${o(a)}/members`, {
|
|
426
|
+
schema: st
|
|
427
|
+
});
|
|
428
|
+
},
|
|
429
|
+
removeMember(a, i) {
|
|
430
|
+
return s(
|
|
431
|
+
"DELETE",
|
|
432
|
+
`/workspaces/${o(a)}/members/${o(i)}`
|
|
433
|
+
);
|
|
434
|
+
},
|
|
435
|
+
leave(a) {
|
|
436
|
+
return s("POST", `/workspaces/${o(a)}/leave`);
|
|
437
|
+
},
|
|
438
|
+
landscape(a) {
|
|
439
|
+
return s("GET", `/workspaces/${o(a)}/landscape`, {
|
|
440
|
+
schema: me
|
|
441
|
+
});
|
|
442
|
+
},
|
|
443
|
+
announceTo(a, i) {
|
|
444
|
+
return s("POST", `/workspaces/${o(a)}/announce`, {
|
|
445
|
+
body: i,
|
|
446
|
+
schema: he
|
|
447
|
+
});
|
|
448
|
+
},
|
|
449
|
+
submitFeedback(a, i) {
|
|
450
|
+
const l = i !== void 0 ? `/workspaces/${o(i)}/feedback` : "/feedback";
|
|
451
|
+
return s("POST", l, { body: a, schema: rt });
|
|
452
|
+
},
|
|
453
|
+
// --- self-host singular aliases (implicit single workspace) -------------
|
|
454
|
+
getLandscape() {
|
|
455
|
+
return s("GET", "/workspace/landscape", {
|
|
456
|
+
schema: me
|
|
457
|
+
});
|
|
458
|
+
},
|
|
459
|
+
announce(a) {
|
|
460
|
+
return s("POST", "/workspace/announce", {
|
|
461
|
+
body: a,
|
|
462
|
+
schema: he
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
const Te = Me(null);
|
|
468
|
+
function qt({
|
|
469
|
+
client: t,
|
|
470
|
+
children: n
|
|
471
|
+
}) {
|
|
472
|
+
return /* @__PURE__ */ r(Te.Provider, { value: t, children: n });
|
|
473
|
+
}
|
|
474
|
+
function oe() {
|
|
475
|
+
const t = Le(Te);
|
|
476
|
+
if (t === null)
|
|
477
|
+
throw new Error(
|
|
478
|
+
"useShepherdClient must be used within <ShepherdClientProvider>"
|
|
479
|
+
);
|
|
480
|
+
return t;
|
|
481
|
+
}
|
|
482
|
+
const lt = 5e3, dt = 1e3;
|
|
483
|
+
function ut(t) {
|
|
484
|
+
const n = oe(), c = t == null ? void 0 : t.workspaceId, o = (t == null ? void 0 : t.pollMs) ?? lt, s = (t == null ? void 0 : t.enabled) ?? !0, [a, i] = N(
|
|
485
|
+
null
|
|
486
|
+
), [l, h] = N("live"), [u, d] = N(null), [, b] = N(0), f = P(n);
|
|
487
|
+
f.current = n;
|
|
488
|
+
const y = P(0), v = E(
|
|
489
|
+
async ($) => {
|
|
490
|
+
try {
|
|
491
|
+
const S = c ? await f.current.landscape(c) : await f.current.getLandscape();
|
|
492
|
+
if ($ !== y.current) return;
|
|
493
|
+
i(S), d(Date.now()), h("live");
|
|
494
|
+
} catch (S) {
|
|
495
|
+
if ($ !== y.current) return;
|
|
496
|
+
S instanceof H && S.status === 401 ? h("unauthorized") : h("reconnecting");
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
[c]
|
|
500
|
+
);
|
|
501
|
+
se(() => {
|
|
502
|
+
if (!s) return;
|
|
503
|
+
const $ = ++y.current;
|
|
504
|
+
v($);
|
|
505
|
+
const S = setInterval(() => {
|
|
506
|
+
document.visibilityState !== "hidden" && v($);
|
|
507
|
+
}, o), k = setInterval(() => {
|
|
508
|
+
b((T) => T + 1);
|
|
509
|
+
}, dt), j = () => {
|
|
510
|
+
document.visibilityState === "visible" && v($);
|
|
511
|
+
};
|
|
512
|
+
return document.addEventListener("visibilitychange", j), () => {
|
|
513
|
+
y.current++, clearInterval(S), clearInterval(k), document.removeEventListener("visibilitychange", j);
|
|
514
|
+
};
|
|
515
|
+
}, [v, o, s]);
|
|
516
|
+
const A = E(() => v(y.current), [v]);
|
|
517
|
+
return { snapshot: a, status: l, lastUpdatedMs: u, refresh: A };
|
|
518
|
+
}
|
|
519
|
+
function K(t, n) {
|
|
520
|
+
const c = Math.floor((n - Date.parse(t)) / 1e3);
|
|
521
|
+
if (c < 5) return "just now";
|
|
522
|
+
if (c < 60) return `${c}s ago`;
|
|
523
|
+
const o = Math.floor(c / 60);
|
|
524
|
+
if (o < 60) return `${o}m ago`;
|
|
525
|
+
const s = Math.floor(o / 60);
|
|
526
|
+
return s < 24 ? `${s}h ago` : `${Math.floor(s / 24)}d ago`;
|
|
527
|
+
}
|
|
528
|
+
function z(t) {
|
|
529
|
+
let n = 0;
|
|
530
|
+
for (let c = 0; c < t.length; c++) n = (n * 31 + t.charCodeAt(c)) % 360;
|
|
531
|
+
return `hsl(${n}, 38%, 42%)`;
|
|
532
|
+
}
|
|
533
|
+
function ie(t) {
|
|
534
|
+
if (!t) return "?";
|
|
535
|
+
const n = t.match(/[A-Z]/g);
|
|
536
|
+
return n && n.length >= 2 ? n[0] + n[1] : t.slice(0, 2).toUpperCase();
|
|
537
|
+
}
|
|
538
|
+
const Ce = "A-Za-z0-9_-";
|
|
539
|
+
function mt(t, n) {
|
|
540
|
+
const o = t.slice(0, n).match(new RegExp(`(?:^|\\s)@([${Ce}]*)$`));
|
|
541
|
+
if (!o) return null;
|
|
542
|
+
const s = o[1];
|
|
543
|
+
return { start: n - s.length - 1, end: n, query: s };
|
|
544
|
+
}
|
|
545
|
+
function ht(t, n) {
|
|
546
|
+
const c = new RegExp(`(?:^|\\s)@([${Ce}]+)`, "g");
|
|
547
|
+
let o;
|
|
548
|
+
for (; (o = c.exec(t)) !== null; ) {
|
|
549
|
+
const s = o[1].toLowerCase(), a = n.find((i) => i.toLowerCase() === s);
|
|
550
|
+
if (a) return a;
|
|
551
|
+
}
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
function $e(t) {
|
|
555
|
+
return [...new Set(t.map((n) => n.repo))].sort();
|
|
556
|
+
}
|
|
557
|
+
function L(t, n) {
|
|
558
|
+
return n === null || n === "__all__" || t.repo === n;
|
|
559
|
+
}
|
|
560
|
+
function pt(t, n) {
|
|
561
|
+
return [
|
|
562
|
+
...new Set(
|
|
563
|
+
t.filter((c) => c.presence === "live" && L(c, n)).map((c) => c.name)
|
|
564
|
+
)
|
|
565
|
+
].sort();
|
|
566
|
+
}
|
|
567
|
+
function pe(t) {
|
|
568
|
+
const n = t.find((c) => c.status === "active");
|
|
569
|
+
return n ? n.repo : t.length ? t[0].repo : null;
|
|
570
|
+
}
|
|
571
|
+
function gt(t) {
|
|
572
|
+
return t === "dropped" ? "dropped" : "done";
|
|
573
|
+
}
|
|
574
|
+
function ge(t, n) {
|
|
575
|
+
if (!n) return "";
|
|
576
|
+
const c = Math.floor((Date.parse(n) - Date.parse(t)) / 1e3), o = Math.floor(c / 60);
|
|
577
|
+
return o < 60 ? `active ${o}m` : `active ${Math.floor(o / 60)}h`;
|
|
578
|
+
}
|
|
579
|
+
function ft(t, n) {
|
|
580
|
+
const c = new Date(Date.parse(t)), o = new Date(n), s = (i) => new Date(i.getFullYear(), i.getMonth(), i.getDate()).getTime(), a = Math.round((s(o) - s(c)) / 864e5);
|
|
581
|
+
return a <= 0 ? "Today" : a === 1 ? "Yesterday" : c.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
582
|
+
}
|
|
583
|
+
function fe(t) {
|
|
584
|
+
let n = t.toLowerCase().replace(/\\/g, "/");
|
|
585
|
+
n.endsWith("/") && (n = n.replace(/\/+$/, "") + "/**");
|
|
586
|
+
const c = [];
|
|
587
|
+
for (const o of n.split("/"))
|
|
588
|
+
if (!(o === "" || o === ".")) {
|
|
589
|
+
if (o === "..") {
|
|
590
|
+
c.length && c.pop();
|
|
591
|
+
continue;
|
|
592
|
+
}
|
|
593
|
+
c.push(o);
|
|
594
|
+
}
|
|
595
|
+
return c;
|
|
596
|
+
}
|
|
597
|
+
const be = /[*?{}[\]]/;
|
|
598
|
+
function bt(t, n) {
|
|
599
|
+
return t === "*" ? !0 : (be.test(t) || !be.test(n)) && t === n;
|
|
600
|
+
}
|
|
601
|
+
function vt(t, n) {
|
|
602
|
+
const c = /* @__PURE__ */ new Map();
|
|
603
|
+
function o(s, a) {
|
|
604
|
+
if (n.length - a === 0) {
|
|
605
|
+
for (let b = s; b < t.length; b++) if (t[b] !== "**") return !1;
|
|
606
|
+
return !0;
|
|
607
|
+
}
|
|
608
|
+
if (t.length - s === 0) return !1;
|
|
609
|
+
const i = s * (n.length + 1) + a, l = c.get(i);
|
|
610
|
+
if (l !== void 0) return l;
|
|
611
|
+
const h = t[s], u = n[a];
|
|
612
|
+
let d;
|
|
613
|
+
return h === "**" ? d = o(s + 1, a) || o(s, a + 1) : u === "**" ? d = !1 : d = bt(h, u) && o(s + 1, a + 1), c.set(i, d), d;
|
|
614
|
+
}
|
|
615
|
+
return o(0, 0);
|
|
616
|
+
}
|
|
617
|
+
function ve(t, n) {
|
|
618
|
+
if (n.length === 0) return !0;
|
|
619
|
+
const c = t.map(fe);
|
|
620
|
+
return n.every((o) => {
|
|
621
|
+
const s = fe(o);
|
|
622
|
+
return c.some((a) => vt(a, s));
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
function yt(t) {
|
|
626
|
+
const n = /* @__PURE__ */ new Map();
|
|
627
|
+
for (const s of t)
|
|
628
|
+
n.has(s.agentName) || n.set(s.agentName, []), n.get(s.agentName).push(s);
|
|
629
|
+
const c = (s, a) => a.createdAt.localeCompare(s.createdAt), o = [];
|
|
630
|
+
for (const [s, a] of n) {
|
|
631
|
+
const i = [...a].sort(c), l = i.map(
|
|
632
|
+
(u) => i.some(
|
|
633
|
+
(d) => d !== u && ve(d.pathGlobs, u.pathGlobs) && !ve(u.pathGlobs, d.pathGlobs)
|
|
634
|
+
)
|
|
635
|
+
), h = i[0];
|
|
636
|
+
o.push({
|
|
637
|
+
agentName: s,
|
|
638
|
+
model: h.model,
|
|
639
|
+
program: h.program,
|
|
640
|
+
repo: h.repo,
|
|
641
|
+
primaries: i.filter((u, d) => !l[d]),
|
|
642
|
+
narrower: i.filter((u, d) => l[d])
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
return o.sort((s, a) => {
|
|
646
|
+
const i = s.primaries.concat(s.narrower)[0].createdAt;
|
|
647
|
+
return a.primaries.concat(a.narrower)[0].createdAt.localeCompare(i);
|
|
648
|
+
}), o;
|
|
649
|
+
}
|
|
650
|
+
const ye = { active: 0, done: 0 };
|
|
651
|
+
function kt({
|
|
652
|
+
repos: t,
|
|
653
|
+
counts: n,
|
|
654
|
+
selected: c,
|
|
655
|
+
onSelect: o
|
|
656
|
+
}) {
|
|
657
|
+
const [s, a] = N(!1), i = P(null);
|
|
658
|
+
if (se(() => {
|
|
659
|
+
var f;
|
|
660
|
+
if (!s) return;
|
|
661
|
+
const d = (f = i.current) == null ? void 0 : f.querySelector(".repo-menu");
|
|
662
|
+
if (!d) return;
|
|
663
|
+
const b = d.querySelector('[aria-selected="true"]') ?? d.querySelector("button");
|
|
664
|
+
b == null || b.focus();
|
|
665
|
+
}, [s]), t.length < 2) return null;
|
|
666
|
+
const l = c === null || c === "__all__", h = l ? "All repos" : c, u = (d, b) => {
|
|
667
|
+
const f = d === null ? n.__all__ ?? ye : n[d] ?? ye, y = d === null ? l : c === d, v = "repo-mi" + (y ? " on" : "") + (d === null ? " all" : "");
|
|
668
|
+
return /* @__PURE__ */ m(
|
|
669
|
+
"button",
|
|
670
|
+
{
|
|
671
|
+
type: "button",
|
|
672
|
+
className: v,
|
|
673
|
+
role: "option",
|
|
674
|
+
"aria-selected": y,
|
|
675
|
+
onClick: (A) => {
|
|
676
|
+
A.stopPropagation(), a(!1), o(d);
|
|
677
|
+
},
|
|
678
|
+
children: [
|
|
679
|
+
/* @__PURE__ */ r("span", { children: b }),
|
|
680
|
+
/* @__PURE__ */ r("span", { className: "ct", children: `${f.active} active · ${f.done} done` })
|
|
681
|
+
]
|
|
682
|
+
},
|
|
683
|
+
d ?? "__all__"
|
|
684
|
+
);
|
|
685
|
+
};
|
|
686
|
+
return /* @__PURE__ */ m(
|
|
687
|
+
"span",
|
|
688
|
+
{
|
|
689
|
+
ref: i,
|
|
690
|
+
className: "repo",
|
|
691
|
+
onKeyDown: (d) => {
|
|
692
|
+
d.key === "Escape" && a(!1);
|
|
693
|
+
},
|
|
694
|
+
children: [
|
|
695
|
+
/* @__PURE__ */ m(
|
|
696
|
+
"button",
|
|
697
|
+
{
|
|
698
|
+
type: "button",
|
|
699
|
+
className: "repo-trig",
|
|
700
|
+
"aria-haspopup": "listbox",
|
|
701
|
+
"aria-expanded": s,
|
|
702
|
+
"aria-label": `Filter by repo (current: ${h})`,
|
|
703
|
+
onClick: (d) => {
|
|
704
|
+
d.stopPropagation(), a((b) => !b);
|
|
705
|
+
},
|
|
706
|
+
children: [
|
|
707
|
+
/* @__PURE__ */ r("span", { className: "slash", children: "/" }),
|
|
708
|
+
" " + h + " ",
|
|
709
|
+
/* @__PURE__ */ r("span", { children: "▼" })
|
|
710
|
+
]
|
|
711
|
+
}
|
|
712
|
+
),
|
|
713
|
+
s && /* @__PURE__ */ m("div", { className: "repo-menu", role: "listbox", children: [
|
|
714
|
+
t.map((d) => u(d, d)),
|
|
715
|
+
u(null, "All repos")
|
|
716
|
+
] })
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
function _t({ agents: t, tasks: n, selectedRepo: c }) {
|
|
722
|
+
const o = t.filter(
|
|
723
|
+
(l) => l.presence === "live" && L({ repo: l.repo ?? "" }, c)
|
|
724
|
+
), s = /* @__PURE__ */ new Set();
|
|
725
|
+
for (const l of n) l.status === "active" && s.add(l.agentName);
|
|
726
|
+
const a = (l) => s.has(l.name), i = [...o].sort((l, h) => {
|
|
727
|
+
const u = a(l), d = a(h);
|
|
728
|
+
return u !== d ? u ? -1 : 1 : l.name.localeCompare(h.name);
|
|
729
|
+
});
|
|
730
|
+
return /* @__PURE__ */ r("div", { className: "crew", id: "crew", children: i.map((l) => /* @__PURE__ */ m(
|
|
731
|
+
"div",
|
|
732
|
+
{
|
|
733
|
+
className: "person" + (a(l) ? "" : " person--idle"),
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ r("div", { className: "avatar", style: { background: z(l.name) }, children: ie(l.name) }),
|
|
736
|
+
/* @__PURE__ */ r("span", { className: "person__name", children: l.name })
|
|
737
|
+
]
|
|
738
|
+
},
|
|
739
|
+
l.name
|
|
740
|
+
)) });
|
|
741
|
+
}
|
|
742
|
+
function Re({ globs: t }) {
|
|
743
|
+
return t.length <= 1 ? /* @__PURE__ */ m("div", { className: "terr", children: [
|
|
744
|
+
/* @__PURE__ */ r("span", { className: "terr__lbl", children: "territory" }),
|
|
745
|
+
t.map((n) => /* @__PURE__ */ r("span", { className: "glob", children: n }, n))
|
|
746
|
+
] }) : /* @__PURE__ */ m("details", { className: "terrx", children: [
|
|
747
|
+
/* @__PURE__ */ m("summary", { children: [
|
|
748
|
+
/* @__PURE__ */ r("span", { className: "terr__lbl", children: "territory" }),
|
|
749
|
+
/* @__PURE__ */ m("span", { className: "glob glob--more", children: [
|
|
750
|
+
/* @__PURE__ */ r("span", { className: "tw", children: "▶" }),
|
|
751
|
+
` ${t.length} paths`
|
|
752
|
+
] })
|
|
753
|
+
] }),
|
|
754
|
+
/* @__PURE__ */ r("div", { className: "terr terr--full", children: t.map((n) => /* @__PURE__ */ r("span", { className: "glob", children: n }, n)) })
|
|
755
|
+
] });
|
|
756
|
+
}
|
|
757
|
+
const te = (t) => `${t.agentName}|${t.repo}|${t.createdAt}`, Nt = (t) => t === null || t === "__all__";
|
|
758
|
+
function ne({
|
|
759
|
+
task: t,
|
|
760
|
+
nowMs: n
|
|
761
|
+
}) {
|
|
762
|
+
return /* @__PURE__ */ m(W, { children: [
|
|
763
|
+
/* @__PURE__ */ r("div", { className: "task__intent", children: t.intent }),
|
|
764
|
+
/* @__PURE__ */ r(Re, { globs: t.pathGlobs }),
|
|
765
|
+
/* @__PURE__ */ r("div", { className: "task__meta", children: `started ${K(t.createdAt, n)}` })
|
|
766
|
+
] });
|
|
767
|
+
}
|
|
768
|
+
function wt({
|
|
769
|
+
task: t,
|
|
770
|
+
nowMs: n,
|
|
771
|
+
allRepos: c
|
|
772
|
+
}) {
|
|
773
|
+
const o = t.model || t.program;
|
|
774
|
+
return /* @__PURE__ */ m("div", { className: "task", children: [
|
|
775
|
+
/* @__PURE__ */ m("div", { className: "task__r1", children: [
|
|
776
|
+
/* @__PURE__ */ r("span", { className: "task__who", children: t.agentName }),
|
|
777
|
+
c && /* @__PURE__ */ r("span", { className: "task__repo", children: t.repo }),
|
|
778
|
+
o && /* @__PURE__ */ r("span", { className: "task__tag", children: o }),
|
|
779
|
+
/* @__PURE__ */ r("span", { className: "livedot", title: "active" })
|
|
780
|
+
] }),
|
|
781
|
+
/* @__PURE__ */ r(ne, { task: t, nowMs: n })
|
|
782
|
+
] });
|
|
783
|
+
}
|
|
784
|
+
function At({
|
|
785
|
+
group: t,
|
|
786
|
+
nowMs: n,
|
|
787
|
+
allRepos: c
|
|
788
|
+
}) {
|
|
789
|
+
const o = t.model || t.program, s = t.primaries.length + t.narrower.length, a = t.narrower.length;
|
|
790
|
+
return /* @__PURE__ */ m("div", { className: "grp", children: [
|
|
791
|
+
/* @__PURE__ */ m("div", { className: "grp__head", children: [
|
|
792
|
+
/* @__PURE__ */ r("span", { className: "grp__who", children: t.agentName }),
|
|
793
|
+
c && /* @__PURE__ */ r("span", { className: "task__repo", children: t.repo }),
|
|
794
|
+
o && /* @__PURE__ */ r("span", { className: "grp__tag", children: o }),
|
|
795
|
+
/* @__PURE__ */ r("span", { className: "grp__count", children: `· ${s} active` }),
|
|
796
|
+
/* @__PURE__ */ r("span", { className: "grp__dot", title: "live" })
|
|
797
|
+
] }),
|
|
798
|
+
/* @__PURE__ */ r("div", { className: "claims", children: t.primaries.map((i) => /* @__PURE__ */ r("div", { className: "claim", children: /* @__PURE__ */ r(ne, { task: i, nowMs: n }) }, te(i))) }),
|
|
799
|
+
a > 0 && /* @__PURE__ */ m("details", { className: "fold", children: [
|
|
800
|
+
/* @__PURE__ */ m("summary", { children: [
|
|
801
|
+
/* @__PURE__ */ r("span", { className: "tw", children: "▶" }),
|
|
802
|
+
` +${a} narrower claim${a > 1 ? "s" : ""}`
|
|
803
|
+
] }),
|
|
804
|
+
/* @__PURE__ */ r("div", { className: "fold__body", children: t.narrower.map((i) => /* @__PURE__ */ m("div", { className: "claim", children: [
|
|
805
|
+
/* @__PURE__ */ r(ne, { task: i, nowMs: n }),
|
|
806
|
+
/* @__PURE__ */ r("div", { className: "covered", children: "⊂ covered by a claim above" })
|
|
807
|
+
] }, te(i))) })
|
|
808
|
+
] })
|
|
809
|
+
] });
|
|
810
|
+
}
|
|
811
|
+
function St({
|
|
812
|
+
tasks: t,
|
|
813
|
+
nowMs: n,
|
|
814
|
+
selectedRepo: c
|
|
815
|
+
}) {
|
|
816
|
+
const o = Nt(c), s = t.filter(
|
|
817
|
+
(a) => a.status === "active" && L(a, c)
|
|
818
|
+
);
|
|
819
|
+
if (s.length === 0) {
|
|
820
|
+
const a = o ? "Nothing active right now." : `Nothing active in ${c}.`;
|
|
821
|
+
return /* @__PURE__ */ r("div", { id: "active-list", children: /* @__PURE__ */ r("div", { className: "empty", children: a }) });
|
|
822
|
+
}
|
|
823
|
+
return /* @__PURE__ */ r("div", { id: "active-list", children: yt(s).map((a) => {
|
|
824
|
+
const i = a.primaries.length === 1 && a.narrower.length === 0, l = te(a.primaries.concat(a.narrower)[0]);
|
|
825
|
+
return i ? /* @__PURE__ */ r(
|
|
826
|
+
wt,
|
|
827
|
+
{
|
|
828
|
+
task: a.primaries[0],
|
|
829
|
+
nowMs: n,
|
|
830
|
+
allRepos: o
|
|
831
|
+
},
|
|
832
|
+
l
|
|
833
|
+
) : /* @__PURE__ */ r(At, { group: a, nowMs: n, allRepos: o }, l);
|
|
834
|
+
}) });
|
|
835
|
+
}
|
|
836
|
+
const Tt = (t) => `${t.agentName}|${t.repo}|${t.createdAt}`, Ct = (t) => t === null || t === "__all__";
|
|
837
|
+
function $t({
|
|
838
|
+
tasks: t,
|
|
839
|
+
nowMs: n,
|
|
840
|
+
selectedRepo: c,
|
|
841
|
+
doneShown: o,
|
|
842
|
+
onLoadMore: s
|
|
843
|
+
}) {
|
|
844
|
+
const a = Ct(c), i = t.filter(
|
|
845
|
+
(u) => u.status !== "active" && L(u, c)
|
|
846
|
+
);
|
|
847
|
+
if (i.length === 0) {
|
|
848
|
+
const u = a ? "No finished tasks yet." : `No finished tasks in ${c} yet.`;
|
|
849
|
+
return /* @__PURE__ */ r("div", { id: "done-list", children: /* @__PURE__ */ r("div", { className: "empty", children: u }) });
|
|
850
|
+
}
|
|
851
|
+
const l = i.slice(0, o);
|
|
852
|
+
let h = null;
|
|
853
|
+
return /* @__PURE__ */ m("div", { id: "done-list", children: [
|
|
854
|
+
l.map((u) => {
|
|
855
|
+
const d = ft(u.endedAt ?? u.createdAt, n), b = d !== h ? d : null;
|
|
856
|
+
h = d;
|
|
857
|
+
const f = u.status === "dropped", y = f ? `went offline ${K(u.endedAt ?? u.createdAt, n)} — no done signal` : `finished ${K(u.endedAt ?? u.createdAt, n)}${ge(u.createdAt, u.endedAt) ? " · " + ge(u.createdAt, u.endedAt) : ""}`;
|
|
858
|
+
return /* @__PURE__ */ m(Pe, { children: [
|
|
859
|
+
b !== null && /* @__PURE__ */ r("div", { className: "day", children: b }),
|
|
860
|
+
/* @__PURE__ */ m("div", { className: "task", children: [
|
|
861
|
+
/* @__PURE__ */ m("div", { className: "task__r1", children: [
|
|
862
|
+
/* @__PURE__ */ r("span", { className: "task__who", children: u.agentName }),
|
|
863
|
+
a && /* @__PURE__ */ r("span", { className: "task__repo", children: u.repo }),
|
|
864
|
+
/* @__PURE__ */ r(
|
|
865
|
+
"span",
|
|
866
|
+
{
|
|
867
|
+
className: "task__stat" + (f ? " task__stat--drop" : ""),
|
|
868
|
+
children: gt(u.status)
|
|
869
|
+
}
|
|
870
|
+
)
|
|
871
|
+
] }),
|
|
872
|
+
/* @__PURE__ */ r("div", { className: "task__intent", children: u.intent }),
|
|
873
|
+
/* @__PURE__ */ r(Re, { globs: u.pathGlobs }),
|
|
874
|
+
/* @__PURE__ */ r("div", { className: "task__meta", children: y })
|
|
875
|
+
] })
|
|
876
|
+
] }, Tt(u));
|
|
877
|
+
}),
|
|
878
|
+
i.length > o && /* @__PURE__ */ r(
|
|
879
|
+
"div",
|
|
880
|
+
{
|
|
881
|
+
className: "more",
|
|
882
|
+
role: "button",
|
|
883
|
+
tabIndex: 0,
|
|
884
|
+
onClick: s,
|
|
885
|
+
onKeyDown: (u) => {
|
|
886
|
+
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), s());
|
|
887
|
+
},
|
|
888
|
+
children: `Load older · ${o} of ${i.length}`
|
|
889
|
+
}
|
|
890
|
+
)
|
|
891
|
+
] });
|
|
892
|
+
}
|
|
893
|
+
const Rt = 80;
|
|
894
|
+
function Et({ announcements: t, selectedRepo: n, nowMs: c }) {
|
|
895
|
+
const o = P(null), s = P(!0), a = o.current;
|
|
896
|
+
a && (s.current = a.scrollHeight - a.scrollTop - a.clientHeight < Rt);
|
|
897
|
+
const i = [...t].filter((l) => L(l, n)).reverse();
|
|
898
|
+
return Oe(() => {
|
|
899
|
+
s.current && o.current && (o.current.scrollTop = o.current.scrollHeight);
|
|
900
|
+
}, [i.length]), /* @__PURE__ */ r("div", { id: "chat", className: "chat", ref: o, children: i.length === 0 ? /* @__PURE__ */ r("div", { className: "empty", children: "No announcements yet — agents will post here as they coordinate." }) : i.map((l, h) => {
|
|
901
|
+
const d = "msg" + (l.targetAgentName !== null || l.toAdmin ? " msg--targeted" : "") + (l.fromAdmin ? " msg--me" : "");
|
|
902
|
+
return (
|
|
903
|
+
// The feed has no stable id; index is acceptable because the list is
|
|
904
|
+
// append-only oldest->newest and rows are never reordered in place.
|
|
905
|
+
/* @__PURE__ */ m("div", { className: d, children: [
|
|
906
|
+
/* @__PURE__ */ r(
|
|
907
|
+
"div",
|
|
908
|
+
{
|
|
909
|
+
className: "msg__avatar",
|
|
910
|
+
style: { background: z(l.fromAgentName) },
|
|
911
|
+
children: ie(l.fromAgentName)
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ m("div", { className: "msg__body", children: [
|
|
915
|
+
/* @__PURE__ */ m("div", { className: "msg__head", children: [
|
|
916
|
+
/* @__PURE__ */ r(
|
|
917
|
+
"span",
|
|
918
|
+
{
|
|
919
|
+
className: "msg__who",
|
|
920
|
+
style: { color: z(l.fromAgentName) },
|
|
921
|
+
children: l.fromAgentName
|
|
922
|
+
}
|
|
923
|
+
),
|
|
924
|
+
l.fromHuman ? /* @__PURE__ */ r("span", { className: "msg__human", children: l.fromHuman }) : null,
|
|
925
|
+
l.targetAgentName !== null ? /* @__PURE__ */ r("span", { className: "msg__to", children: `→ @${l.targetAgentName}` }) : l.toAdmin ? /* @__PURE__ */ r("span", { className: "msg__to", children: "→ admin" }) : null,
|
|
926
|
+
/* @__PURE__ */ r("span", { className: "msg__time", children: K(l.createdAt, c) })
|
|
927
|
+
] }),
|
|
928
|
+
/* @__PURE__ */ r("div", { className: "msg__text", children: l.body })
|
|
929
|
+
] })
|
|
930
|
+
] }, h)
|
|
931
|
+
);
|
|
932
|
+
}) });
|
|
933
|
+
}
|
|
934
|
+
const jt = 8;
|
|
935
|
+
function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
|
|
936
|
+
const s = oe(), a = P(null), [i, l] = N(""), [h, u] = N([]), [d, b] = N(0), [f, y] = N(null), [v, A] = N(!1), [$, S] = N(!1), k = pt(
|
|
937
|
+
t.map((p) => ({ name: p.name, presence: p.presence, repo: p.repo ?? "" })),
|
|
938
|
+
n
|
|
939
|
+
), j = h.length > 0, T = E(() => {
|
|
940
|
+
u([]), y(null);
|
|
941
|
+
}, []), q = E(
|
|
942
|
+
(p, _) => {
|
|
943
|
+
const C = mt(p, _);
|
|
944
|
+
if (!C) {
|
|
945
|
+
T();
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
const D = C.query.toLowerCase(), I = k.filter((B) => B.toLowerCase().startsWith(D)).slice(0, jt);
|
|
949
|
+
u(I), y({ start: C.start, end: C.end }), b(0);
|
|
950
|
+
},
|
|
951
|
+
[k, T]
|
|
952
|
+
), G = E(
|
|
953
|
+
(p) => {
|
|
954
|
+
if (!f) return;
|
|
955
|
+
const _ = "@" + p + " ", C = i.slice(0, f.start) + _ + i.slice(f.end), D = f.start + _.length;
|
|
956
|
+
l(C), T(), requestAnimationFrame(() => {
|
|
957
|
+
const I = a.current;
|
|
958
|
+
I && (I.focus(), I.setSelectionRange(D, D));
|
|
959
|
+
});
|
|
960
|
+
},
|
|
961
|
+
[f, i, T]
|
|
962
|
+
), w = E(
|
|
963
|
+
(p) => {
|
|
964
|
+
var C;
|
|
965
|
+
l(p);
|
|
966
|
+
const _ = ((C = a.current) == null ? void 0 : C.selectionStart) ?? p.length;
|
|
967
|
+
q(p, _);
|
|
968
|
+
},
|
|
969
|
+
[q]
|
|
970
|
+
), F = E(
|
|
971
|
+
(p) => {
|
|
972
|
+
j && (p.key === "ArrowDown" ? (p.preventDefault(), b((_) => (_ + 1) % h.length)) : p.key === "ArrowUp" ? (p.preventDefault(), b((_) => (_ - 1 + h.length) % h.length)) : p.key === "Enter" || p.key === "Tab" ? (p.preventDefault(), G(h[d])) : p.key === "Escape" && (p.preventDefault(), T()));
|
|
973
|
+
},
|
|
974
|
+
[j, h, d, G, T]
|
|
975
|
+
), X = E(
|
|
976
|
+
async (p) => {
|
|
977
|
+
p.preventDefault();
|
|
978
|
+
const _ = i.trim();
|
|
979
|
+
if (!_) return;
|
|
980
|
+
const C = ht(_, k), D = n === null || n === "__all__" ? null : n;
|
|
981
|
+
A(!0), S(!1);
|
|
982
|
+
try {
|
|
983
|
+
const I = { body: _, targetAgentName: C, repo: D };
|
|
984
|
+
await (c !== void 0 ? s.announceTo(c, I) : s.announce(I)), l(""), T(), await o();
|
|
985
|
+
} catch {
|
|
986
|
+
S(!0);
|
|
987
|
+
} finally {
|
|
988
|
+
A(!1);
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
[i, k, n, c, s, T, o]
|
|
992
|
+
);
|
|
993
|
+
return /* @__PURE__ */ m("div", { className: "composer", children: [
|
|
994
|
+
/* @__PURE__ */ r(
|
|
995
|
+
"div",
|
|
996
|
+
{
|
|
997
|
+
id: "mention-pop",
|
|
998
|
+
className: "mention-pop",
|
|
999
|
+
role: "listbox",
|
|
1000
|
+
"aria-label": "Agents to mention",
|
|
1001
|
+
hidden: !j,
|
|
1002
|
+
children: h.map((p, _) => /* @__PURE__ */ m(
|
|
1003
|
+
"button",
|
|
1004
|
+
{
|
|
1005
|
+
id: `mention-opt-${_}`,
|
|
1006
|
+
type: "button",
|
|
1007
|
+
role: "option",
|
|
1008
|
+
"aria-selected": _ === d,
|
|
1009
|
+
className: "mention-mi" + (_ === d ? " on" : ""),
|
|
1010
|
+
onMouseDown: (C) => {
|
|
1011
|
+
C.preventDefault(), G(p);
|
|
1012
|
+
},
|
|
1013
|
+
children: [
|
|
1014
|
+
/* @__PURE__ */ r("div", { className: "ma", style: { background: z(p) }, children: ie(p) }),
|
|
1015
|
+
/* @__PURE__ */ r("span", { children: p })
|
|
1016
|
+
]
|
|
1017
|
+
},
|
|
1018
|
+
p
|
|
1019
|
+
))
|
|
1020
|
+
}
|
|
1021
|
+
),
|
|
1022
|
+
/* @__PURE__ */ m(
|
|
1023
|
+
"form",
|
|
1024
|
+
{
|
|
1025
|
+
id: "chat-form",
|
|
1026
|
+
className: "chat-form",
|
|
1027
|
+
onSubmit: (p) => {
|
|
1028
|
+
X(p);
|
|
1029
|
+
},
|
|
1030
|
+
children: [
|
|
1031
|
+
/* @__PURE__ */ r(
|
|
1032
|
+
"input",
|
|
1033
|
+
{
|
|
1034
|
+
id: "chat-input",
|
|
1035
|
+
className: "chat-input",
|
|
1036
|
+
type: "text",
|
|
1037
|
+
autoComplete: "off",
|
|
1038
|
+
"aria-label": "Message the team",
|
|
1039
|
+
placeholder: "Message the team… use @name to direct it",
|
|
1040
|
+
role: "combobox",
|
|
1041
|
+
"aria-expanded": j,
|
|
1042
|
+
"aria-controls": "mention-pop",
|
|
1043
|
+
"aria-autocomplete": "list",
|
|
1044
|
+
"aria-activedescendant": j ? `mention-opt-${d}` : void 0,
|
|
1045
|
+
ref: a,
|
|
1046
|
+
value: i,
|
|
1047
|
+
onChange: (p) => w(p.target.value),
|
|
1048
|
+
onKeyDown: F
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ r("button", { id: "chat-send", className: "chat-send", type: "submit", disabled: v, children: "Send" })
|
|
1052
|
+
]
|
|
1053
|
+
}
|
|
1054
|
+
),
|
|
1055
|
+
$ ? /* @__PURE__ */ r("div", { className: "chat__note", role: "status", children: "send failed — retry" }) : null
|
|
1056
|
+
] });
|
|
1057
|
+
}
|
|
1058
|
+
function ke({
|
|
1059
|
+
title: t = "No workspace yet",
|
|
1060
|
+
children: n,
|
|
1061
|
+
onGetStarted: c,
|
|
1062
|
+
ctaLabel: o = "Go to Config"
|
|
1063
|
+
}) {
|
|
1064
|
+
const s = we();
|
|
1065
|
+
return /* @__PURE__ */ m("section", { className: "shepherd-empty-state", "aria-labelledby": s, children: [
|
|
1066
|
+
/* @__PURE__ */ r("h2", { id: s, children: t }),
|
|
1067
|
+
/* @__PURE__ */ r("p", { children: n ?? "Create a workspace or join one with an invite code to get started." }),
|
|
1068
|
+
c && /* @__PURE__ */ r("button", { type: "button", onClick: c, children: o })
|
|
1069
|
+
] });
|
|
1070
|
+
}
|
|
1071
|
+
const It = [
|
|
1072
|
+
{ id: "bug", label: "Bug" },
|
|
1073
|
+
{ id: "suggestion", label: "Suggestion" },
|
|
1074
|
+
{ id: "other", label: "Other" }
|
|
1075
|
+
], xt = 1500;
|
|
1076
|
+
function Mt({ workspaceId: t }) {
|
|
1077
|
+
const n = oe(), c = we(), [o, s] = N(!1), [a, i] = N("bug"), [l, h] = N(""), [u, d] = N(!1), [b, f] = N(null), [y, v] = N(!1);
|
|
1078
|
+
function A() {
|
|
1079
|
+
s((k) => !k);
|
|
1080
|
+
}
|
|
1081
|
+
function $() {
|
|
1082
|
+
i("bug"), h(""), f(null), v(!1);
|
|
1083
|
+
}
|
|
1084
|
+
async function S() {
|
|
1085
|
+
d(!0), f(null);
|
|
1086
|
+
try {
|
|
1087
|
+
await n.submitFeedback({ type: a, body: l.trim() }, t), v(!0), h(""), setTimeout(() => {
|
|
1088
|
+
s(!1), $();
|
|
1089
|
+
}, xt);
|
|
1090
|
+
} catch (k) {
|
|
1091
|
+
f(it(k));
|
|
1092
|
+
} finally {
|
|
1093
|
+
d(!1);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return /* @__PURE__ */ m("div", { className: "shepherd-feedback", children: [
|
|
1097
|
+
/* @__PURE__ */ r(
|
|
1098
|
+
"button",
|
|
1099
|
+
{
|
|
1100
|
+
type: "button",
|
|
1101
|
+
className: "shepherd-feedback__trigger",
|
|
1102
|
+
onClick: A,
|
|
1103
|
+
"aria-expanded": o,
|
|
1104
|
+
children: "Feedback"
|
|
1105
|
+
}
|
|
1106
|
+
),
|
|
1107
|
+
o && /* @__PURE__ */ m(
|
|
1108
|
+
"section",
|
|
1109
|
+
{
|
|
1110
|
+
className: "shepherd-feedback__panel",
|
|
1111
|
+
"aria-labelledby": c,
|
|
1112
|
+
children: [
|
|
1113
|
+
/* @__PURE__ */ r("h3", { id: c, children: "Give feedback" }),
|
|
1114
|
+
y ? /* @__PURE__ */ r("p", { role: "status", children: "Thanks! Your feedback was sent." }) : /* @__PURE__ */ m(W, { children: [
|
|
1115
|
+
/* @__PURE__ */ r("div", { className: "shepherd-feedback__types", children: It.map((k) => /* @__PURE__ */ r(
|
|
1116
|
+
"button",
|
|
1117
|
+
{
|
|
1118
|
+
type: "button",
|
|
1119
|
+
"aria-pressed": a === k.id,
|
|
1120
|
+
onClick: () => i(k.id),
|
|
1121
|
+
children: k.label
|
|
1122
|
+
},
|
|
1123
|
+
k.id
|
|
1124
|
+
)) }),
|
|
1125
|
+
/* @__PURE__ */ r(
|
|
1126
|
+
"textarea",
|
|
1127
|
+
{
|
|
1128
|
+
"aria-label": "Feedback",
|
|
1129
|
+
placeholder: "What's on your mind?",
|
|
1130
|
+
value: l,
|
|
1131
|
+
onChange: (k) => h(k.target.value)
|
|
1132
|
+
}
|
|
1133
|
+
),
|
|
1134
|
+
b && /* @__PURE__ */ r("p", { role: "alert", children: b }),
|
|
1135
|
+
/* @__PURE__ */ r(
|
|
1136
|
+
"button",
|
|
1137
|
+
{
|
|
1138
|
+
type: "button",
|
|
1139
|
+
onClick: () => void S(),
|
|
1140
|
+
disabled: l.trim() === "" || u,
|
|
1141
|
+
children: "Submit"
|
|
1142
|
+
}
|
|
1143
|
+
)
|
|
1144
|
+
] })
|
|
1145
|
+
]
|
|
1146
|
+
}
|
|
1147
|
+
)
|
|
1148
|
+
] });
|
|
1149
|
+
}
|
|
1150
|
+
const _e = "shepherd.tab", J = "shepherd.repo", Q = 10, Lt = {
|
|
1151
|
+
live: { text: "live", kind: "ok" },
|
|
1152
|
+
reconnecting: { text: "reconnecting…", kind: "warn" },
|
|
1153
|
+
// app.js cleared the token and re-prompted on 401; in the auth-agnostic port
|
|
1154
|
+
// the injected client's onUnauthorized owns any token handling, so the board
|
|
1155
|
+
// only surfaces the rejected state.
|
|
1156
|
+
unauthorized: { text: "token rejected", kind: "error" }
|
|
1157
|
+
};
|
|
1158
|
+
function Ne(t) {
|
|
1159
|
+
try {
|
|
1160
|
+
return localStorage.getItem(t);
|
|
1161
|
+
} catch {
|
|
1162
|
+
return null;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
function ee(t, n) {
|
|
1166
|
+
try {
|
|
1167
|
+
localStorage.setItem(t, n);
|
|
1168
|
+
} catch {
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
function Pt(t, n, c) {
|
|
1172
|
+
const o = $e(n.tasks);
|
|
1173
|
+
let s = t;
|
|
1174
|
+
if (s === null && o.length >= 2 && (s = pe(n.tasks)), s !== null && s !== "__all__" && !o.includes(s) && (s = "__all__"), c && s !== null && s !== "__all__") {
|
|
1175
|
+
const a = n.tasks.some(
|
|
1176
|
+
(l) => l.status === "active" && l.repo === s
|
|
1177
|
+
), i = n.tasks.some((l) => l.status === "active");
|
|
1178
|
+
!a && i && (s = pe(n.tasks));
|
|
1179
|
+
}
|
|
1180
|
+
return s;
|
|
1181
|
+
}
|
|
1182
|
+
function Ot(t) {
|
|
1183
|
+
const n = {}, c = (o, s) => {
|
|
1184
|
+
const a = n[o] ?? (n[o] = { active: 0, done: 0 });
|
|
1185
|
+
a[s]++;
|
|
1186
|
+
};
|
|
1187
|
+
for (const o of t.tasks) {
|
|
1188
|
+
const s = o.status === "active" ? "active" : "done";
|
|
1189
|
+
c(o.repo, s), c("__all__", s);
|
|
1190
|
+
}
|
|
1191
|
+
return n;
|
|
1192
|
+
}
|
|
1193
|
+
function Bt({
|
|
1194
|
+
workspaceId: t,
|
|
1195
|
+
config: n,
|
|
1196
|
+
switcher: c,
|
|
1197
|
+
hasWorkspace: o
|
|
1198
|
+
} = {}) {
|
|
1199
|
+
const s = n != null, a = o === !1, { snapshot: i, status: l, lastUpdatedMs: h, refresh: u } = ut({
|
|
1200
|
+
workspaceId: t,
|
|
1201
|
+
// A no-workspace board has nothing to poll; keep it off the hub.
|
|
1202
|
+
enabled: !a
|
|
1203
|
+
}), [d, b] = N(() => {
|
|
1204
|
+
if (s && a) return "config";
|
|
1205
|
+
const g = Ne(_e);
|
|
1206
|
+
return g === "chat" ? "chat" : g === "config" && s ? "config" : "tasks";
|
|
1207
|
+
}), f = s ? [
|
|
1208
|
+
{ id: "tasks", label: "Tasks" },
|
|
1209
|
+
{ id: "chat", label: "Chat" },
|
|
1210
|
+
{ id: "config", label: "Config" }
|
|
1211
|
+
] : [
|
|
1212
|
+
{ id: "tasks", label: "Tasks" },
|
|
1213
|
+
{ id: "chat", label: "Chat" }
|
|
1214
|
+
], y = P([]), v = E(
|
|
1215
|
+
(g, M) => {
|
|
1216
|
+
var de;
|
|
1217
|
+
const O = f.length - 1;
|
|
1218
|
+
let x = null;
|
|
1219
|
+
switch (g.key) {
|
|
1220
|
+
case "ArrowRight":
|
|
1221
|
+
x = M === O ? 0 : M + 1;
|
|
1222
|
+
break;
|
|
1223
|
+
case "ArrowLeft":
|
|
1224
|
+
x = M === 0 ? O : M - 1;
|
|
1225
|
+
break;
|
|
1226
|
+
case "Home":
|
|
1227
|
+
x = 0;
|
|
1228
|
+
break;
|
|
1229
|
+
case "End":
|
|
1230
|
+
x = O;
|
|
1231
|
+
break;
|
|
1232
|
+
default:
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
g.preventDefault();
|
|
1236
|
+
const le = f[x];
|
|
1237
|
+
le && (T(le.id), (de = y.current[x]) == null || de.focus());
|
|
1238
|
+
},
|
|
1239
|
+
// `tabs` is rebuilt each render but its identity only matters by length,
|
|
1240
|
+
// which is stable for a given `hasConfig`; `onTab` is stable.
|
|
1241
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1242
|
+
[s]
|
|
1243
|
+
), [A, $] = N(
|
|
1244
|
+
() => Ne(J)
|
|
1245
|
+
), [S, k] = N(Q), j = P(!0), T = E((g) => {
|
|
1246
|
+
b(g), ee(_e, g);
|
|
1247
|
+
}, []), q = E((g) => {
|
|
1248
|
+
const M = g === null ? "__all__" : g;
|
|
1249
|
+
$(M), ee(J, M), k(Q);
|
|
1250
|
+
}, []), G = E(() => {
|
|
1251
|
+
k((g) => g + Q);
|
|
1252
|
+
}, []), w = i ? Pt(A, i, j.current) : A;
|
|
1253
|
+
se(() => {
|
|
1254
|
+
i && (j.current = !1, w !== A && ($(w), w !== null && w !== "__all__" && ee(J, w)));
|
|
1255
|
+
}, [i, w, A]);
|
|
1256
|
+
const F = i ? Date.parse(i.serverTime) : Date.now(), X = i ? $e(i.tasks) : [], p = i ? Ot(i) : {}, _ = i ? i.agents.filter(
|
|
1257
|
+
(g) => g.presence === "live" && L({ repo: g.repo ?? "" }, w)
|
|
1258
|
+
).length : 0, C = i ? i.tasks.filter((g) => g.status === "active" && L(g, w)).length : 0, D = Lt[l], I = h === null ? "" : `updated ${Math.floor((Date.now() - h) / 1e3)}s ago`, B = (i == null ? void 0 : i.agents) ?? [], U = (i == null ? void 0 : i.tasks) ?? [], Ee = (i == null ? void 0 : i.announcements) ?? [], je = U.filter(
|
|
1259
|
+
(g) => g.status === "active" && L(g, w)
|
|
1260
|
+
).length, De = U.filter(
|
|
1261
|
+
(g) => g.status !== "active" && L(g, w)
|
|
1262
|
+
).length, ce = !a && d !== "config";
|
|
1263
|
+
return /* @__PURE__ */ m("div", { id: "board", children: [
|
|
1264
|
+
/* @__PURE__ */ m("header", { children: [
|
|
1265
|
+
/* @__PURE__ */ r("h1", { className: "brand", style: { margin: 0, font: "inherit" }, children: "Shepherd" }),
|
|
1266
|
+
c,
|
|
1267
|
+
ce && /* @__PURE__ */ m(W, { children: [
|
|
1268
|
+
/* @__PURE__ */ r(
|
|
1269
|
+
kt,
|
|
1270
|
+
{
|
|
1271
|
+
repos: X,
|
|
1272
|
+
counts: p,
|
|
1273
|
+
selected: w,
|
|
1274
|
+
onSelect: q
|
|
1275
|
+
}
|
|
1276
|
+
),
|
|
1277
|
+
/* @__PURE__ */ m("span", { className: "vitals", children: [
|
|
1278
|
+
/* @__PURE__ */ r("b", { id: "vitals-online", children: _ }),
|
|
1279
|
+
" online · ",
|
|
1280
|
+
/* @__PURE__ */ r("b", { id: "vitals-active", children: C }),
|
|
1281
|
+
" active"
|
|
1282
|
+
] })
|
|
1283
|
+
] }),
|
|
1284
|
+
/* @__PURE__ */ r("span", { className: "grow" }),
|
|
1285
|
+
ce && /* @__PURE__ */ m(W, { children: [
|
|
1286
|
+
/* @__PURE__ */ r(
|
|
1287
|
+
"span",
|
|
1288
|
+
{
|
|
1289
|
+
id: "status",
|
|
1290
|
+
className: "status" + (D.kind ? ` status--${D.kind}` : ""),
|
|
1291
|
+
children: D.text
|
|
1292
|
+
}
|
|
1293
|
+
),
|
|
1294
|
+
/* @__PURE__ */ r("span", { id: "freshness", className: "freshness", children: I })
|
|
1295
|
+
] }),
|
|
1296
|
+
/* @__PURE__ */ r("nav", { className: "tabs", role: "tablist", "aria-label": "Shepherd views", children: f.map(({ id: g, label: M }, O) => /* @__PURE__ */ r(
|
|
1297
|
+
"button",
|
|
1298
|
+
{
|
|
1299
|
+
ref: (x) => {
|
|
1300
|
+
y.current[O] = x;
|
|
1301
|
+
},
|
|
1302
|
+
className: "tab" + (d === g ? " tab--active" : ""),
|
|
1303
|
+
"data-tab": g,
|
|
1304
|
+
type: "button",
|
|
1305
|
+
role: "tab",
|
|
1306
|
+
id: `tab-${g}`,
|
|
1307
|
+
"aria-controls": `panel-${g}`,
|
|
1308
|
+
"aria-selected": d === g,
|
|
1309
|
+
tabIndex: d === g ? 0 : -1,
|
|
1310
|
+
onClick: () => T(g),
|
|
1311
|
+
onKeyDown: (x) => v(x, O),
|
|
1312
|
+
children: M
|
|
1313
|
+
},
|
|
1314
|
+
g
|
|
1315
|
+
)) })
|
|
1316
|
+
] }),
|
|
1317
|
+
/* @__PURE__ */ r(
|
|
1318
|
+
"section",
|
|
1319
|
+
{
|
|
1320
|
+
id: "panel-tasks",
|
|
1321
|
+
role: "tabpanel",
|
|
1322
|
+
"aria-labelledby": "tab-tasks",
|
|
1323
|
+
hidden: d !== "tasks",
|
|
1324
|
+
children: a ? /* @__PURE__ */ r(ke, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m(W, { children: [
|
|
1325
|
+
/* @__PURE__ */ r(_t, { agents: B, tasks: U, selectedRepo: w }),
|
|
1326
|
+
/* @__PURE__ */ m("div", { className: "board", children: [
|
|
1327
|
+
/* @__PURE__ */ m("div", { className: "col", children: [
|
|
1328
|
+
/* @__PURE__ */ m("div", { className: "colhead", children: [
|
|
1329
|
+
/* @__PURE__ */ r("h2", { children: "Active" }),
|
|
1330
|
+
/* @__PURE__ */ r("span", { className: "n", id: "active-count", children: je })
|
|
1331
|
+
] }),
|
|
1332
|
+
/* @__PURE__ */ r(St, { tasks: U, nowMs: F, selectedRepo: w })
|
|
1333
|
+
] }),
|
|
1334
|
+
/* @__PURE__ */ r("div", { className: "board__rule" }),
|
|
1335
|
+
/* @__PURE__ */ m("div", { className: "col", children: [
|
|
1336
|
+
/* @__PURE__ */ m("div", { className: "colhead", children: [
|
|
1337
|
+
/* @__PURE__ */ r("h2", { children: "Done" }),
|
|
1338
|
+
/* @__PURE__ */ r("span", { className: "n", id: "done-count", children: De })
|
|
1339
|
+
] }),
|
|
1340
|
+
/* @__PURE__ */ r(
|
|
1341
|
+
$t,
|
|
1342
|
+
{
|
|
1343
|
+
tasks: U,
|
|
1344
|
+
nowMs: F,
|
|
1345
|
+
selectedRepo: w,
|
|
1346
|
+
doneShown: S,
|
|
1347
|
+
onLoadMore: G
|
|
1348
|
+
}
|
|
1349
|
+
)
|
|
1350
|
+
] })
|
|
1351
|
+
] })
|
|
1352
|
+
] })
|
|
1353
|
+
}
|
|
1354
|
+
),
|
|
1355
|
+
/* @__PURE__ */ r(
|
|
1356
|
+
"section",
|
|
1357
|
+
{
|
|
1358
|
+
id: "panel-chat",
|
|
1359
|
+
role: "tabpanel",
|
|
1360
|
+
"aria-labelledby": "tab-chat",
|
|
1361
|
+
hidden: d !== "chat",
|
|
1362
|
+
children: a ? /* @__PURE__ */ r(ke, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m("div", { className: "chat-wrap", children: [
|
|
1363
|
+
/* @__PURE__ */ r(Et, { announcements: Ee, selectedRepo: w, nowMs: F }),
|
|
1364
|
+
/* @__PURE__ */ r(
|
|
1365
|
+
Dt,
|
|
1366
|
+
{
|
|
1367
|
+
agents: B,
|
|
1368
|
+
selectedRepo: w,
|
|
1369
|
+
workspaceId: t,
|
|
1370
|
+
onSent: u
|
|
1371
|
+
}
|
|
1372
|
+
)
|
|
1373
|
+
] })
|
|
1374
|
+
}
|
|
1375
|
+
),
|
|
1376
|
+
s && /* @__PURE__ */ r(
|
|
1377
|
+
"section",
|
|
1378
|
+
{
|
|
1379
|
+
id: "panel-config",
|
|
1380
|
+
role: "tabpanel",
|
|
1381
|
+
"aria-labelledby": "tab-config",
|
|
1382
|
+
hidden: d !== "config",
|
|
1383
|
+
children: n
|
|
1384
|
+
}
|
|
1385
|
+
),
|
|
1386
|
+
/* @__PURE__ */ r(Mt, { workspaceId: t })
|
|
1387
|
+
] });
|
|
1388
|
+
}
|
|
1389
|
+
export {
|
|
1390
|
+
Bt as D,
|
|
1391
|
+
ke as E,
|
|
1392
|
+
H as S,
|
|
1393
|
+
qt as a,
|
|
1394
|
+
Wt as c,
|
|
1395
|
+
it as d,
|
|
1396
|
+
K as f,
|
|
1397
|
+
oe as u
|
|
1398
|
+
};
|