@korso/shepherd-ui 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +14 -0
- package/dist/config/ConfigPanel.js +1 -1
- package/dist/config/ConnectAgent.d.ts +1 -2
- package/dist/config/ConnectAgent.js +6 -12
- package/dist/lib/{Dashboard-CTXdGRxM.js → Dashboard-C48qY8R2.js} +123 -109
- package/dist/lib/index.d.ts +7 -2
- package/dist/lib/index.js +233 -235
- package/dist/lib/selfhost.js +1 -1
- package/dist/preview.js +12 -0
- package/dist/selfhost/assets/{index-BSnsUIT-.js → index-adPvx18g.js} +8 -8
- package/dist/selfhost/index.html +1 -1
- package/dist/test/mockClient.js +3 -0
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var ue = (t, n, c) =>
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var Le = (t, n, c) => n in t ? Me(t, n, { enumerable: !0, configurable: !0, writable: !0, value: c }) : t[n] = c;
|
|
3
|
+
var ue = (t, n, c) => Le(t, typeof n != "symbol" ? n + "" : n, c);
|
|
4
4
|
import { jsx as r, jsxs as m, Fragment as W } from "react/jsx-runtime";
|
|
5
|
-
import { createContext as
|
|
5
|
+
import { createContext as Pe, useContext as Oe, useState as N, useRef as P, useCallback as R, useEffect as se, Fragment as Ge, useLayoutEffect as Fe, useId as Se } from "react";
|
|
6
6
|
import { z as e } from "zod";
|
|
7
|
-
const
|
|
7
|
+
const E = e.string(), Y = e.number(), Ue = e.object({
|
|
8
8
|
agentName: e.string(),
|
|
9
9
|
human: e.string(),
|
|
10
10
|
branch: e.string(),
|
|
@@ -13,9 +13,9 @@ const R = e.string(), Y = e.number(), Ge = e.object({
|
|
|
13
13
|
message: e.string().nullable(),
|
|
14
14
|
paths: e.array(e.string()).min(1),
|
|
15
15
|
authorIsLive: e.boolean(),
|
|
16
|
-
authorLastActiveAt:
|
|
17
|
-
updatedAt:
|
|
18
|
-
}),
|
|
16
|
+
authorLastActiveAt: E,
|
|
17
|
+
updatedAt: E
|
|
18
|
+
}), He = 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 R = e.string(), Y = 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(He).max(600)
|
|
40
40
|
}), Z = e.object({
|
|
41
41
|
workItemId: e.string().uuid(),
|
|
42
42
|
agentName: e.string(),
|
|
@@ -44,7 +44,7 @@ const R = e.string(), Y = e.number(), Ge = e.object({
|
|
|
44
44
|
intent: e.string().min(1).max(2048),
|
|
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
|
-
expiresAt:
|
|
47
|
+
expiresAt: E
|
|
48
48
|
}), V = e.object({
|
|
49
49
|
// bigint PK serialised as number; see DbId note above
|
|
50
50
|
id: Y,
|
|
@@ -53,8 +53,8 @@ const R = e.string(), Y = e.number(), Ge = e.object({
|
|
|
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
|
-
createdAt:
|
|
57
|
-
}),
|
|
56
|
+
createdAt: E
|
|
57
|
+
}), Te = e.object({
|
|
58
58
|
conflicts: e.array(Z),
|
|
59
59
|
activeClaims: e.array(Z),
|
|
60
60
|
// The caller's OWN active claims. `activeClaims` deliberately excludes the
|
|
@@ -64,8 +64,8 @@ const R = e.string(), Y = e.number(), Ge = e.object({
|
|
|
64
64
|
yourClaims: e.array(Z).default([]),
|
|
65
65
|
announcements: e.array(V),
|
|
66
66
|
// Per-agent change records for the workspace. Defaulted for version-skew safety.
|
|
67
|
-
changeRecords: e.array(
|
|
68
|
-
}),
|
|
67
|
+
changeRecords: e.array(Ue).default([])
|
|
68
|
+
}), We = e.object({
|
|
69
69
|
name: e.string(),
|
|
70
70
|
human: e.string(),
|
|
71
71
|
program: e.string(),
|
|
@@ -75,19 +75,19 @@ const R = e.string(), Y = e.number(), Ge = e.object({
|
|
|
75
75
|
// are null when the agent has no session yet.
|
|
76
76
|
repo: e.string().nullable(),
|
|
77
77
|
branch: e.string().nullable(),
|
|
78
|
-
lastHeartbeatAt:
|
|
78
|
+
lastHeartbeatAt: E.nullable(),
|
|
79
79
|
presence: e.enum(["live", "offline"])
|
|
80
|
-
}),
|
|
80
|
+
}), qe = e.enum(["active", "done", "dropped"]), Be = 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:
|
|
88
|
-
createdAt:
|
|
89
|
-
endedAt:
|
|
90
|
-
}),
|
|
87
|
+
status: qe,
|
|
88
|
+
createdAt: E,
|
|
89
|
+
endedAt: E.nullable()
|
|
90
|
+
}), Ke = e.object({
|
|
91
91
|
fromAgentName: e.string(),
|
|
92
92
|
fromHuman: e.string(),
|
|
93
93
|
body: e.string(),
|
|
@@ -101,14 +101,14 @@ const R = e.string(), Y = e.number(), Ge = e.object({
|
|
|
101
101
|
// fromAdmin). The dashboard renders these as "<agent> → admin". Not delivered
|
|
102
102
|
// to other agents. Defaulted for version-skew safety with older hubs.
|
|
103
103
|
toAdmin: e.boolean().default(!1),
|
|
104
|
-
createdAt:
|
|
104
|
+
createdAt: E
|
|
105
105
|
}), me = e.object({
|
|
106
|
-
agents: e.array(
|
|
107
|
-
tasks: e.array(
|
|
108
|
-
announcements: e.array(
|
|
106
|
+
agents: e.array(We),
|
|
107
|
+
tasks: e.array(Be),
|
|
108
|
+
announcements: e.array(Ke),
|
|
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
|
-
serverTime:
|
|
111
|
+
serverTime: E
|
|
112
112
|
});
|
|
113
113
|
e.object({
|
|
114
114
|
body: e.string().min(1).max(8192),
|
|
@@ -138,7 +138,7 @@ e.object({
|
|
|
138
138
|
agentName: e.string(),
|
|
139
139
|
sessionId: e.string().uuid()
|
|
140
140
|
});
|
|
141
|
-
const
|
|
141
|
+
const ze = e.object({
|
|
142
142
|
sessionId: e.string().uuid(),
|
|
143
143
|
intent: e.string().min(1).max(2048),
|
|
144
144
|
pathGlobs: e.array(e.string().min(1).max(512)).min(1).max(64),
|
|
@@ -147,9 +147,9 @@ const Be = e.object({
|
|
|
147
147
|
});
|
|
148
148
|
e.object({
|
|
149
149
|
workItemId: e.string().uuid(),
|
|
150
|
-
landscape:
|
|
150
|
+
landscape: Te
|
|
151
151
|
});
|
|
152
|
-
const
|
|
152
|
+
const Ye = e.object({
|
|
153
153
|
sessionId: e.string().uuid(),
|
|
154
154
|
workItemId: e.string().uuid()
|
|
155
155
|
});
|
|
@@ -160,7 +160,7 @@ e.object({
|
|
|
160
160
|
// their next work/sync). Defaulted for version-skew safety with older hubs.
|
|
161
161
|
announcements: e.array(V).default([])
|
|
162
162
|
});
|
|
163
|
-
const
|
|
163
|
+
const Ve = 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
|
|
@@ -186,11 +186,11 @@ e.object({
|
|
|
186
186
|
changeReport: ae.optional()
|
|
187
187
|
});
|
|
188
188
|
e.object({
|
|
189
|
-
landscape:
|
|
189
|
+
landscape: Te
|
|
190
190
|
});
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
ze.omit({ sessionId: !0, changeReport: !0 });
|
|
192
|
+
Ve.omit({ sessionId: !0 });
|
|
193
|
+
Ye.omit({ sessionId: !0 });
|
|
194
194
|
e.object({});
|
|
195
195
|
e.object({});
|
|
196
196
|
e.object({
|
|
@@ -230,34 +230,34 @@ e.object({
|
|
|
230
230
|
e.object({
|
|
231
231
|
ok: e.literal(!0)
|
|
232
232
|
});
|
|
233
|
-
const
|
|
233
|
+
const Ce = e.enum(["admin", "member"]), re = e.object({
|
|
234
234
|
id: e.string(),
|
|
235
235
|
slug: e.string(),
|
|
236
236
|
name: e.string(),
|
|
237
|
-
role:
|
|
237
|
+
role: Ce
|
|
238
238
|
});
|
|
239
239
|
e.object({
|
|
240
240
|
name: e.string().min(1)
|
|
241
241
|
});
|
|
242
|
-
const
|
|
242
|
+
const Xe = re, Ze = e.object({
|
|
243
243
|
workspaces: e.array(re)
|
|
244
244
|
});
|
|
245
245
|
e.object({
|
|
246
246
|
name: e.string().min(1).optional()
|
|
247
247
|
});
|
|
248
|
-
const
|
|
248
|
+
const pe = e.object({
|
|
249
249
|
// The raw shp_ token, shown once at creation and never returned again.
|
|
250
250
|
token: e.string(),
|
|
251
251
|
id: e.string()
|
|
252
|
-
}),
|
|
252
|
+
}), Je = e.object({
|
|
253
253
|
id: e.string(),
|
|
254
254
|
name: e.string().nullable(),
|
|
255
255
|
// ISO timestamp string (see IsoTimestamp note above) or null when unused / not revoked.
|
|
256
|
-
lastUsedAt:
|
|
257
|
-
createdAt:
|
|
258
|
-
revokedAt:
|
|
259
|
-
}),
|
|
260
|
-
tokens: e.array(
|
|
256
|
+
lastUsedAt: E.nullable(),
|
|
257
|
+
createdAt: E,
|
|
258
|
+
revokedAt: E.nullable()
|
|
259
|
+
}), ge = e.object({
|
|
260
|
+
tokens: e.array(Je)
|
|
261
261
|
});
|
|
262
262
|
e.object({
|
|
263
263
|
expiresInDays: e.number().int().positive().optional(),
|
|
@@ -268,7 +268,7 @@ e.object({
|
|
|
268
268
|
const Qe = e.object({
|
|
269
269
|
code: e.string(),
|
|
270
270
|
// ISO timestamp string, or null when the invite never expires.
|
|
271
|
-
expiresAt:
|
|
271
|
+
expiresAt: E.nullable(),
|
|
272
272
|
// null = unlimited (redeemable until revoked).
|
|
273
273
|
maxUses: e.number().int().positive().nullable(),
|
|
274
274
|
useCount: e.number().int().nonnegative()
|
|
@@ -278,7 +278,7 @@ e.object({
|
|
|
278
278
|
});
|
|
279
279
|
const et = e.object({
|
|
280
280
|
email: e.string(),
|
|
281
|
-
sentAt:
|
|
281
|
+
sentAt: E
|
|
282
282
|
}), tt = e.object({
|
|
283
283
|
// The workspace the caller just joined.
|
|
284
284
|
workspace: re
|
|
@@ -287,7 +287,7 @@ const et = e.object({
|
|
|
287
287
|
displayName: e.string().nullable(),
|
|
288
288
|
githubLogin: e.string().nullable(),
|
|
289
289
|
avatarUrl: e.string().nullable(),
|
|
290
|
-
role:
|
|
290
|
+
role: Ce
|
|
291
291
|
}), st = e.object({
|
|
292
292
|
members: e.array(nt)
|
|
293
293
|
}), at = e.enum(["bug", "suggestion", "other"]);
|
|
@@ -372,24 +372,24 @@ function Wt(t) {
|
|
|
372
372
|
// --- multi-workspace management surface ---------------------------------
|
|
373
373
|
listWorkspaces() {
|
|
374
374
|
return s("GET", "/workspaces", {
|
|
375
|
-
schema:
|
|
375
|
+
schema: Ze
|
|
376
376
|
});
|
|
377
377
|
},
|
|
378
378
|
createWorkspace(a) {
|
|
379
379
|
return s("POST", "/workspaces", {
|
|
380
380
|
body: a,
|
|
381
|
-
schema:
|
|
381
|
+
schema: Xe
|
|
382
382
|
});
|
|
383
383
|
},
|
|
384
384
|
mintToken(a, i) {
|
|
385
385
|
return s("POST", `/workspaces/${o(a)}/tokens`, {
|
|
386
386
|
body: i,
|
|
387
|
-
schema:
|
|
387
|
+
schema: pe
|
|
388
388
|
});
|
|
389
389
|
},
|
|
390
390
|
listTokens(a) {
|
|
391
391
|
return s("GET", `/workspaces/${o(a)}/tokens`, {
|
|
392
|
-
schema:
|
|
392
|
+
schema: ge
|
|
393
393
|
});
|
|
394
394
|
},
|
|
395
395
|
revokeToken(a, i) {
|
|
@@ -398,6 +398,20 @@ function Wt(t) {
|
|
|
398
398
|
`/workspaces/${o(a)}/tokens/${o(i)}`
|
|
399
399
|
);
|
|
400
400
|
},
|
|
401
|
+
mintAccountToken(a) {
|
|
402
|
+
return s("POST", "/tokens", {
|
|
403
|
+
body: a,
|
|
404
|
+
schema: pe
|
|
405
|
+
});
|
|
406
|
+
},
|
|
407
|
+
listAccountTokens() {
|
|
408
|
+
return s("GET", "/tokens", {
|
|
409
|
+
schema: ge
|
|
410
|
+
});
|
|
411
|
+
},
|
|
412
|
+
revokeAccountToken(a) {
|
|
413
|
+
return s("DELETE", `/tokens/${o(a)}`);
|
|
414
|
+
},
|
|
401
415
|
createInvite(a, i) {
|
|
402
416
|
return s("POST", `/workspaces/${o(a)}/invites`, {
|
|
403
417
|
body: i,
|
|
@@ -464,15 +478,15 @@ function Wt(t) {
|
|
|
464
478
|
}
|
|
465
479
|
};
|
|
466
480
|
}
|
|
467
|
-
const
|
|
481
|
+
const $e = Pe(null);
|
|
468
482
|
function qt({
|
|
469
483
|
client: t,
|
|
470
484
|
children: n
|
|
471
485
|
}) {
|
|
472
|
-
return /* @__PURE__ */ r(
|
|
486
|
+
return /* @__PURE__ */ r($e.Provider, { value: t, children: n });
|
|
473
487
|
}
|
|
474
488
|
function oe() {
|
|
475
|
-
const t =
|
|
489
|
+
const t = Oe($e);
|
|
476
490
|
if (t === null)
|
|
477
491
|
throw new Error(
|
|
478
492
|
"useShepherdClient must be used within <ShepherdClientProvider>"
|
|
@@ -485,7 +499,7 @@ function ut(t) {
|
|
|
485
499
|
null
|
|
486
500
|
), [l, h] = N("live"), [u, d] = N(null), [, b] = N(0), f = P(n);
|
|
487
501
|
f.current = n;
|
|
488
|
-
const y = P(0), v =
|
|
502
|
+
const y = P(0), v = R(
|
|
489
503
|
async ($) => {
|
|
490
504
|
try {
|
|
491
505
|
const S = c ? await f.current.landscape(c) : await f.current.getLandscape();
|
|
@@ -513,7 +527,7 @@ function ut(t) {
|
|
|
513
527
|
y.current++, clearInterval(S), clearInterval(k), document.removeEventListener("visibilitychange", j);
|
|
514
528
|
};
|
|
515
529
|
}, [v, o, s]);
|
|
516
|
-
const A =
|
|
530
|
+
const A = R(() => v(y.current), [v]);
|
|
517
531
|
return { snapshot: a, status: l, lastUpdatedMs: u, refresh: A };
|
|
518
532
|
}
|
|
519
533
|
function K(t, n) {
|
|
@@ -535,15 +549,15 @@ function ie(t) {
|
|
|
535
549
|
const n = t.match(/[A-Z]/g);
|
|
536
550
|
return n && n.length >= 2 ? n[0] + n[1] : t.slice(0, 2).toUpperCase();
|
|
537
551
|
}
|
|
538
|
-
const
|
|
552
|
+
const Ee = "A-Za-z0-9_-";
|
|
539
553
|
function mt(t, n) {
|
|
540
|
-
const o = t.slice(0, n).match(new RegExp(`(?:^|\\s)@([${
|
|
554
|
+
const o = t.slice(0, n).match(new RegExp(`(?:^|\\s)@([${Ee}]*)$`));
|
|
541
555
|
if (!o) return null;
|
|
542
556
|
const s = o[1];
|
|
543
557
|
return { start: n - s.length - 1, end: n, query: s };
|
|
544
558
|
}
|
|
545
559
|
function ht(t, n) {
|
|
546
|
-
const c = new RegExp(`(?:^|\\s)@([${
|
|
560
|
+
const c = new RegExp(`(?:^|\\s)@([${Ee}]+)`, "g");
|
|
547
561
|
let o;
|
|
548
562
|
for (; (o = c.exec(t)) !== null; ) {
|
|
549
563
|
const s = o[1].toLowerCase(), a = n.find((i) => i.toLowerCase() === s);
|
|
@@ -551,7 +565,7 @@ function ht(t, n) {
|
|
|
551
565
|
}
|
|
552
566
|
return null;
|
|
553
567
|
}
|
|
554
|
-
function
|
|
568
|
+
function Re(t) {
|
|
555
569
|
return [...new Set(t.map((n) => n.repo))].sort();
|
|
556
570
|
}
|
|
557
571
|
function L(t, n) {
|
|
@@ -564,14 +578,14 @@ function pt(t, n) {
|
|
|
564
578
|
)
|
|
565
579
|
].sort();
|
|
566
580
|
}
|
|
567
|
-
function
|
|
581
|
+
function fe(t) {
|
|
568
582
|
const n = t.find((c) => c.status === "active");
|
|
569
583
|
return n ? n.repo : t.length ? t[0].repo : null;
|
|
570
584
|
}
|
|
571
585
|
function gt(t) {
|
|
572
586
|
return t === "dropped" ? "dropped" : "done";
|
|
573
587
|
}
|
|
574
|
-
function
|
|
588
|
+
function be(t, n) {
|
|
575
589
|
if (!n) return "";
|
|
576
590
|
const c = Math.floor((Date.parse(n) - Date.parse(t)) / 1e3), o = Math.floor(c / 60);
|
|
577
591
|
return o < 60 ? `active ${o}m` : `active ${Math.floor(o / 60)}h`;
|
|
@@ -580,7 +594,7 @@ function ft(t, n) {
|
|
|
580
594
|
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
595
|
return a <= 0 ? "Today" : a === 1 ? "Yesterday" : c.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
582
596
|
}
|
|
583
|
-
function
|
|
597
|
+
function ve(t) {
|
|
584
598
|
let n = t.toLowerCase().replace(/\\/g, "/");
|
|
585
599
|
n.endsWith("/") && (n = n.replace(/\/+$/, "") + "/**");
|
|
586
600
|
const c = [];
|
|
@@ -594,9 +608,9 @@ function fe(t) {
|
|
|
594
608
|
}
|
|
595
609
|
return c;
|
|
596
610
|
}
|
|
597
|
-
const
|
|
611
|
+
const ye = /[*?{}[\]]/;
|
|
598
612
|
function bt(t, n) {
|
|
599
|
-
return t === "*" ? !0 : (
|
|
613
|
+
return t === "*" ? !0 : (ye.test(t) || !ye.test(n)) && t === n;
|
|
600
614
|
}
|
|
601
615
|
function vt(t, n) {
|
|
602
616
|
const c = /* @__PURE__ */ new Map();
|
|
@@ -614,11 +628,11 @@ function vt(t, n) {
|
|
|
614
628
|
}
|
|
615
629
|
return o(0, 0);
|
|
616
630
|
}
|
|
617
|
-
function
|
|
631
|
+
function ke(t, n) {
|
|
618
632
|
if (n.length === 0) return !0;
|
|
619
|
-
const c = t.map(
|
|
633
|
+
const c = t.map(ve);
|
|
620
634
|
return n.every((o) => {
|
|
621
|
-
const s =
|
|
635
|
+
const s = ve(o);
|
|
622
636
|
return c.some((a) => vt(a, s));
|
|
623
637
|
});
|
|
624
638
|
}
|
|
@@ -630,7 +644,7 @@ function yt(t) {
|
|
|
630
644
|
for (const [s, a] of n) {
|
|
631
645
|
const i = [...a].sort(c), l = i.map(
|
|
632
646
|
(u) => i.some(
|
|
633
|
-
(d) => d !== u &&
|
|
647
|
+
(d) => d !== u && ke(d.pathGlobs, u.pathGlobs) && !ke(u.pathGlobs, d.pathGlobs)
|
|
634
648
|
)
|
|
635
649
|
), h = i[0];
|
|
636
650
|
o.push({
|
|
@@ -647,7 +661,7 @@ function yt(t) {
|
|
|
647
661
|
return a.primaries.concat(a.narrower)[0].createdAt.localeCompare(i);
|
|
648
662
|
}), o;
|
|
649
663
|
}
|
|
650
|
-
const
|
|
664
|
+
const _e = { active: 0, done: 0 };
|
|
651
665
|
function kt({
|
|
652
666
|
repos: t,
|
|
653
667
|
counts: n,
|
|
@@ -664,7 +678,7 @@ function kt({
|
|
|
664
678
|
b == null || b.focus();
|
|
665
679
|
}, [s]), t.length < 2) return null;
|
|
666
680
|
const l = c === null || c === "__all__", h = l ? "All repos" : c, u = (d, b) => {
|
|
667
|
-
const f = d === null ? n.__all__ ??
|
|
681
|
+
const f = d === null ? n.__all__ ?? _e : n[d] ?? _e, y = d === null ? l : c === d, v = "repo-mi" + (y ? " on" : "") + (d === null ? " all" : "");
|
|
668
682
|
return /* @__PURE__ */ m(
|
|
669
683
|
"button",
|
|
670
684
|
{
|
|
@@ -739,7 +753,7 @@ function _t({ agents: t, tasks: n, selectedRepo: c }) {
|
|
|
739
753
|
l.name
|
|
740
754
|
)) });
|
|
741
755
|
}
|
|
742
|
-
function
|
|
756
|
+
function je({ globs: t }) {
|
|
743
757
|
return t.length <= 1 ? /* @__PURE__ */ m("div", { className: "terr", children: [
|
|
744
758
|
/* @__PURE__ */ r("span", { className: "terr__lbl", children: "territory" }),
|
|
745
759
|
t.map((n) => /* @__PURE__ */ r("span", { className: "glob", children: n }, n))
|
|
@@ -761,7 +775,7 @@ function ne({
|
|
|
761
775
|
}) {
|
|
762
776
|
return /* @__PURE__ */ m(W, { children: [
|
|
763
777
|
/* @__PURE__ */ r("div", { className: "task__intent", children: t.intent }),
|
|
764
|
-
/* @__PURE__ */ r(
|
|
778
|
+
/* @__PURE__ */ r(je, { globs: t.pathGlobs }),
|
|
765
779
|
/* @__PURE__ */ r("div", { className: "task__meta", children: `started ${K(t.createdAt, n)}` })
|
|
766
780
|
] });
|
|
767
781
|
}
|
|
@@ -854,8 +868,8 @@ function $t({
|
|
|
854
868
|
l.map((u) => {
|
|
855
869
|
const d = ft(u.endedAt ?? u.createdAt, n), b = d !== h ? d : null;
|
|
856
870
|
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)}${
|
|
858
|
-
return /* @__PURE__ */ m(
|
|
871
|
+
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)}${be(u.createdAt, u.endedAt) ? " · " + be(u.createdAt, u.endedAt) : ""}`;
|
|
872
|
+
return /* @__PURE__ */ m(Ge, { children: [
|
|
859
873
|
b !== null && /* @__PURE__ */ r("div", { className: "day", children: b }),
|
|
860
874
|
/* @__PURE__ */ m("div", { className: "task", children: [
|
|
861
875
|
/* @__PURE__ */ m("div", { className: "task__r1", children: [
|
|
@@ -870,7 +884,7 @@ function $t({
|
|
|
870
884
|
)
|
|
871
885
|
] }),
|
|
872
886
|
/* @__PURE__ */ r("div", { className: "task__intent", children: u.intent }),
|
|
873
|
-
/* @__PURE__ */ r(
|
|
887
|
+
/* @__PURE__ */ r(je, { globs: u.pathGlobs }),
|
|
874
888
|
/* @__PURE__ */ r("div", { className: "task__meta", children: y })
|
|
875
889
|
] })
|
|
876
890
|
] }, Tt(u));
|
|
@@ -890,12 +904,12 @@ function $t({
|
|
|
890
904
|
)
|
|
891
905
|
] });
|
|
892
906
|
}
|
|
893
|
-
const
|
|
894
|
-
function
|
|
907
|
+
const Et = 80;
|
|
908
|
+
function Rt({ announcements: t, selectedRepo: n, nowMs: c }) {
|
|
895
909
|
const o = P(null), s = P(!0), a = o.current;
|
|
896
|
-
a && (s.current = a.scrollHeight - a.scrollTop - a.clientHeight <
|
|
910
|
+
a && (s.current = a.scrollHeight - a.scrollTop - a.clientHeight < Et);
|
|
897
911
|
const i = [...t].filter((l) => L(l, n)).reverse();
|
|
898
|
-
return
|
|
912
|
+
return Fe(() => {
|
|
899
913
|
s.current && o.current && (o.current.scrollTop = o.current.scrollHeight);
|
|
900
914
|
}, [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
915
|
const d = "msg" + (l.targetAgentName !== null || l.toAdmin ? " msg--targeted" : "") + (l.fromAdmin ? " msg--me" : "");
|
|
@@ -936,9 +950,9 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
|
|
|
936
950
|
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
951
|
t.map((p) => ({ name: p.name, presence: p.presence, repo: p.repo ?? "" })),
|
|
938
952
|
n
|
|
939
|
-
), j = h.length > 0, T =
|
|
953
|
+
), j = h.length > 0, T = R(() => {
|
|
940
954
|
u([]), y(null);
|
|
941
|
-
}, []), q =
|
|
955
|
+
}, []), q = R(
|
|
942
956
|
(p, _) => {
|
|
943
957
|
const C = mt(p, _);
|
|
944
958
|
if (!C) {
|
|
@@ -949,7 +963,7 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
|
|
|
949
963
|
u(I), y({ start: C.start, end: C.end }), b(0);
|
|
950
964
|
},
|
|
951
965
|
[k, T]
|
|
952
|
-
), G =
|
|
966
|
+
), G = R(
|
|
953
967
|
(p) => {
|
|
954
968
|
if (!f) return;
|
|
955
969
|
const _ = "@" + p + " ", C = i.slice(0, f.start) + _ + i.slice(f.end), D = f.start + _.length;
|
|
@@ -959,7 +973,7 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
|
|
|
959
973
|
});
|
|
960
974
|
},
|
|
961
975
|
[f, i, T]
|
|
962
|
-
), w =
|
|
976
|
+
), w = R(
|
|
963
977
|
(p) => {
|
|
964
978
|
var C;
|
|
965
979
|
l(p);
|
|
@@ -967,12 +981,12 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
|
|
|
967
981
|
q(p, _);
|
|
968
982
|
},
|
|
969
983
|
[q]
|
|
970
|
-
), F =
|
|
984
|
+
), F = R(
|
|
971
985
|
(p) => {
|
|
972
986
|
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
987
|
},
|
|
974
988
|
[j, h, d, G, T]
|
|
975
|
-
), X =
|
|
989
|
+
), X = R(
|
|
976
990
|
async (p) => {
|
|
977
991
|
p.preventDefault();
|
|
978
992
|
const _ = i.trim();
|
|
@@ -1055,13 +1069,13 @@ function Dt({ agents: t, selectedRepo: n, workspaceId: c, onSent: o }) {
|
|
|
1055
1069
|
$ ? /* @__PURE__ */ r("div", { className: "chat__note", role: "status", children: "send failed — retry" }) : null
|
|
1056
1070
|
] });
|
|
1057
1071
|
}
|
|
1058
|
-
function
|
|
1072
|
+
function Ne({
|
|
1059
1073
|
title: t = "No workspace yet",
|
|
1060
1074
|
children: n,
|
|
1061
1075
|
onGetStarted: c,
|
|
1062
1076
|
ctaLabel: o = "Go to Config"
|
|
1063
1077
|
}) {
|
|
1064
|
-
const s =
|
|
1078
|
+
const s = Se();
|
|
1065
1079
|
return /* @__PURE__ */ m("section", { className: "shepherd-empty-state", "aria-labelledby": s, children: [
|
|
1066
1080
|
/* @__PURE__ */ r("h2", { id: s, children: t }),
|
|
1067
1081
|
/* @__PURE__ */ r("p", { children: n ?? "Create a workspace or join one with an invite code to get started." }),
|
|
@@ -1074,7 +1088,7 @@ const It = [
|
|
|
1074
1088
|
{ id: "other", label: "Other" }
|
|
1075
1089
|
], xt = 1500;
|
|
1076
1090
|
function Mt({ workspaceId: t }) {
|
|
1077
|
-
const n = oe(), c =
|
|
1091
|
+
const n = oe(), c = Se(), [o, s] = N(!1), [a, i] = N("bug"), [l, h] = N(""), [u, d] = N(!1), [b, f] = N(null), [y, v] = N(!1);
|
|
1078
1092
|
function A() {
|
|
1079
1093
|
s((k) => !k);
|
|
1080
1094
|
}
|
|
@@ -1147,7 +1161,7 @@ function Mt({ workspaceId: t }) {
|
|
|
1147
1161
|
)
|
|
1148
1162
|
] });
|
|
1149
1163
|
}
|
|
1150
|
-
const
|
|
1164
|
+
const we = "shepherd.tab", J = "shepherd.repo", Q = 10, Lt = {
|
|
1151
1165
|
live: { text: "live", kind: "ok" },
|
|
1152
1166
|
reconnecting: { text: "reconnecting…", kind: "warn" },
|
|
1153
1167
|
// app.js cleared the token and re-prompted on 401; in the auth-agnostic port
|
|
@@ -1155,7 +1169,7 @@ const _e = "shepherd.tab", J = "shepherd.repo", Q = 10, Lt = {
|
|
|
1155
1169
|
// only surfaces the rejected state.
|
|
1156
1170
|
unauthorized: { text: "token rejected", kind: "error" }
|
|
1157
1171
|
};
|
|
1158
|
-
function
|
|
1172
|
+
function Ae(t) {
|
|
1159
1173
|
try {
|
|
1160
1174
|
return localStorage.getItem(t);
|
|
1161
1175
|
} catch {
|
|
@@ -1169,13 +1183,13 @@ function ee(t, n) {
|
|
|
1169
1183
|
}
|
|
1170
1184
|
}
|
|
1171
1185
|
function Pt(t, n, c) {
|
|
1172
|
-
const o =
|
|
1186
|
+
const o = Re(n.tasks);
|
|
1173
1187
|
let s = t;
|
|
1174
|
-
if (s === null && o.length >= 2 && (s =
|
|
1188
|
+
if (s === null && o.length >= 2 && (s = fe(n.tasks)), s !== null && s !== "__all__" && !o.includes(s) && (s = "__all__"), c && s !== null && s !== "__all__") {
|
|
1175
1189
|
const a = n.tasks.some(
|
|
1176
1190
|
(l) => l.status === "active" && l.repo === s
|
|
1177
1191
|
), i = n.tasks.some((l) => l.status === "active");
|
|
1178
|
-
!a && i && (s =
|
|
1192
|
+
!a && i && (s = fe(n.tasks));
|
|
1179
1193
|
}
|
|
1180
1194
|
return s;
|
|
1181
1195
|
}
|
|
@@ -1202,7 +1216,7 @@ function Bt({
|
|
|
1202
1216
|
enabled: !a
|
|
1203
1217
|
}), [d, b] = N(() => {
|
|
1204
1218
|
if (s && a) return "config";
|
|
1205
|
-
const g =
|
|
1219
|
+
const g = Ae(we);
|
|
1206
1220
|
return g === "chat" ? "chat" : g === "config" && s ? "config" : "tasks";
|
|
1207
1221
|
}), f = s ? [
|
|
1208
1222
|
{ id: "tasks", label: "Tasks" },
|
|
@@ -1211,7 +1225,7 @@ function Bt({
|
|
|
1211
1225
|
] : [
|
|
1212
1226
|
{ id: "tasks", label: "Tasks" },
|
|
1213
1227
|
{ id: "chat", label: "Chat" }
|
|
1214
|
-
], y = P([]), v =
|
|
1228
|
+
], y = P([]), v = R(
|
|
1215
1229
|
(g, M) => {
|
|
1216
1230
|
var de;
|
|
1217
1231
|
const O = f.length - 1;
|
|
@@ -1241,23 +1255,23 @@ function Bt({
|
|
|
1241
1255
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1242
1256
|
[s]
|
|
1243
1257
|
), [A, $] = N(
|
|
1244
|
-
() =>
|
|
1245
|
-
), [S, k] = N(Q), j = P(!0), T =
|
|
1246
|
-
b(g), ee(
|
|
1247
|
-
}, []), q =
|
|
1258
|
+
() => Ae(J)
|
|
1259
|
+
), [S, k] = N(Q), j = P(!0), T = R((g) => {
|
|
1260
|
+
b(g), ee(we, g);
|
|
1261
|
+
}, []), q = R((g) => {
|
|
1248
1262
|
const M = g === null ? "__all__" : g;
|
|
1249
1263
|
$(M), ee(J, M), k(Q);
|
|
1250
|
-
}, []), G =
|
|
1264
|
+
}, []), G = R(() => {
|
|
1251
1265
|
k((g) => g + Q);
|
|
1252
1266
|
}, []), w = i ? Pt(A, i, j.current) : A;
|
|
1253
1267
|
se(() => {
|
|
1254
1268
|
i && (j.current = !1, w !== A && ($(w), w !== null && w !== "__all__" && ee(J, w)));
|
|
1255
1269
|
}, [i, w, A]);
|
|
1256
|
-
const F = i ? Date.parse(i.serverTime) : Date.now(), X = i ?
|
|
1270
|
+
const F = i ? Date.parse(i.serverTime) : Date.now(), X = i ? Re(i.tasks) : [], p = i ? Ot(i) : {}, _ = i ? i.agents.filter(
|
|
1257
1271
|
(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) ?? [],
|
|
1272
|
+
).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) ?? [], De = (i == null ? void 0 : i.announcements) ?? [], Ie = U.filter(
|
|
1259
1273
|
(g) => g.status === "active" && L(g, w)
|
|
1260
|
-
).length,
|
|
1274
|
+
).length, xe = U.filter(
|
|
1261
1275
|
(g) => g.status !== "active" && L(g, w)
|
|
1262
1276
|
).length, ce = !a && d !== "config";
|
|
1263
1277
|
return /* @__PURE__ */ m("div", { id: "board", children: [
|
|
@@ -1321,13 +1335,13 @@ function Bt({
|
|
|
1321
1335
|
role: "tabpanel",
|
|
1322
1336
|
"aria-labelledby": "tab-tasks",
|
|
1323
1337
|
hidden: d !== "tasks",
|
|
1324
|
-
children: a ? /* @__PURE__ */ r(
|
|
1338
|
+
children: a ? /* @__PURE__ */ r(Ne, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m(W, { children: [
|
|
1325
1339
|
/* @__PURE__ */ r(_t, { agents: B, tasks: U, selectedRepo: w }),
|
|
1326
1340
|
/* @__PURE__ */ m("div", { className: "board", children: [
|
|
1327
1341
|
/* @__PURE__ */ m("div", { className: "col", children: [
|
|
1328
1342
|
/* @__PURE__ */ m("div", { className: "colhead", children: [
|
|
1329
1343
|
/* @__PURE__ */ r("h2", { children: "Active" }),
|
|
1330
|
-
/* @__PURE__ */ r("span", { className: "n", id: "active-count", children:
|
|
1344
|
+
/* @__PURE__ */ r("span", { className: "n", id: "active-count", children: Ie })
|
|
1331
1345
|
] }),
|
|
1332
1346
|
/* @__PURE__ */ r(St, { tasks: U, nowMs: F, selectedRepo: w })
|
|
1333
1347
|
] }),
|
|
@@ -1335,7 +1349,7 @@ function Bt({
|
|
|
1335
1349
|
/* @__PURE__ */ m("div", { className: "col", children: [
|
|
1336
1350
|
/* @__PURE__ */ m("div", { className: "colhead", children: [
|
|
1337
1351
|
/* @__PURE__ */ r("h2", { children: "Done" }),
|
|
1338
|
-
/* @__PURE__ */ r("span", { className: "n", id: "done-count", children:
|
|
1352
|
+
/* @__PURE__ */ r("span", { className: "n", id: "done-count", children: xe })
|
|
1339
1353
|
] }),
|
|
1340
1354
|
/* @__PURE__ */ r(
|
|
1341
1355
|
$t,
|
|
@@ -1359,8 +1373,8 @@ function Bt({
|
|
|
1359
1373
|
role: "tabpanel",
|
|
1360
1374
|
"aria-labelledby": "tab-chat",
|
|
1361
1375
|
hidden: d !== "chat",
|
|
1362
|
-
children: a ? /* @__PURE__ */ r(
|
|
1363
|
-
/* @__PURE__ */ r(
|
|
1376
|
+
children: a ? /* @__PURE__ */ r(Ne, { onGetStarted: () => T("config") }) : /* @__PURE__ */ m("div", { className: "chat-wrap", children: [
|
|
1377
|
+
/* @__PURE__ */ r(Rt, { announcements: De, selectedRepo: w, nowMs: F }),
|
|
1364
1378
|
/* @__PURE__ */ r(
|
|
1365
1379
|
Dt,
|
|
1366
1380
|
{
|
|
@@ -1388,7 +1402,7 @@ function Bt({
|
|
|
1388
1402
|
}
|
|
1389
1403
|
export {
|
|
1390
1404
|
Bt as D,
|
|
1391
|
-
|
|
1405
|
+
Ne as E,
|
|
1392
1406
|
H as S,
|
|
1393
1407
|
qt as a,
|
|
1394
1408
|
Wt as c,
|