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