@parallelworks/tandem-web 0.175.4 → 0.177.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/_virtual/_virtual_i18n/en/common.js +31 -4
- package/_virtual/_virtual_i18n/es/common.js +31 -4
- package/_virtual/_virtual_i18n/ja/common.js +31 -4
- package/_virtual/_virtual_i18n/ko/common.js +31 -4
- package/_virtual/_virtual_i18n/zh/common.js +31 -4
- package/api/queries.js +87 -72
- package/components/DocCalendar.js +213 -0
- package/components/DocTable.js +70 -63
- package/components/RunnerBadge.js +37 -0
- package/lib/agents.js +8 -2
- package/lib/docProperties.js +1 -1
- package/package.json +1 -1
- package/routes/_workspace/agents/_slug2.js +219 -156
- package/routes/_workspace/agents/index2.js +121 -75
- package/routes/_workspace/docs/_doc2.js +154 -139
- package/routes/_workspace/docs/space2._space.js +178 -128
|
@@ -1,139 +1,185 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
|
-
import { agentsQuery as n, meQuery as r } from "../../../api/queries.js";
|
|
3
|
-
import { AgentIcon as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
2
|
+
import { agentsQuery as n, meQuery as r, runnersQuery as i, workspaceRunsQuery as a } from "../../../api/queries.js";
|
|
3
|
+
import { AgentIcon as o, AlertIcon as s } from "../../../components/icons.js";
|
|
4
|
+
import { RunnerBadge as c } from "../../../components/RunnerBadge.js";
|
|
5
|
+
import { harnessNames as l, runnersFor as u } from "../../../lib/agents.js";
|
|
6
|
+
import { useConfirm as d } from "../../../lib/confirm.js";
|
|
7
|
+
import { copyItem as f, useLinkItems as p } from "../../../lib/menus.js";
|
|
8
|
+
import { usePageTitle as m } from "../../../lib/pageTitle.js";
|
|
9
|
+
import { may as h } from "../../../lib/roles.js";
|
|
10
|
+
import { Link as g, useNavigate as _ } from "../../../lib/router.js";
|
|
11
|
+
import { Route as v } from "./index.js";
|
|
12
|
+
import { Avatar as y, Card as b, EmptyState as x, buttonClasses as S, menuDivider as C, useOpenMenu as w } from "@parallelworks/ui";
|
|
13
|
+
import { useTranslations as T } from "use-intl";
|
|
14
|
+
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
15
|
+
import { useMutation as O, useQuery as k, useQueryClient as A, useSuspenseQuery as j } from "@tanstack/react-query";
|
|
15
16
|
// src/routes/$workspace/agents/index.tsx?tsr-split=component
|
|
16
|
-
function
|
|
17
|
-
let { workspace:
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
function M() {
|
|
18
|
+
let { workspace: s } = v.useParams(), c = T("agents"), u = T("common"), M = p(), { data: P } = j(n(s)), { data: F = [] } = k(i(s)), { data: I = [] } = k(a(s, {
|
|
19
|
+
live: !0,
|
|
20
|
+
limit: 200
|
|
21
|
+
}));
|
|
22
|
+
m(c("title"));
|
|
23
|
+
let { data: L } = j(r), R = h(L, s, "manage_agents"), z = w(), B = _(), V = A(), H = O({
|
|
20
24
|
mutationFn: async (n) => t(await e.DELETE("/api/v1/workspaces/{workspace}/agents/{slug}", { params: { path: {
|
|
21
|
-
workspace:
|
|
25
|
+
workspace: s,
|
|
22
26
|
slug: n
|
|
23
27
|
} } })),
|
|
24
|
-
onSettled: () =>
|
|
25
|
-
}), { confirm:
|
|
28
|
+
onSettled: () => V.invalidateQueries({ queryKey: n(s).queryKey })
|
|
29
|
+
}), { confirm: U, dialog: W } = d(), G = (e) => [
|
|
26
30
|
{
|
|
27
|
-
label:
|
|
28
|
-
onClick: () =>
|
|
31
|
+
label: u("open"),
|
|
32
|
+
onClick: () => B({
|
|
29
33
|
to: "/$workspace/agents/$slug",
|
|
30
34
|
params: {
|
|
31
|
-
workspace:
|
|
35
|
+
workspace: s,
|
|
32
36
|
slug: e.slug
|
|
33
37
|
}
|
|
34
38
|
})
|
|
35
39
|
},
|
|
36
|
-
...
|
|
37
|
-
|
|
38
|
-
...
|
|
39
|
-
label:
|
|
40
|
+
...M(`/${s}/agents/${e.slug}`),
|
|
41
|
+
f(c("copySlug"), e.slug),
|
|
42
|
+
...R && !e.archivedAt ? [C, {
|
|
43
|
+
label: c("archive"),
|
|
40
44
|
destructive: !0,
|
|
41
|
-
onClick: () =>
|
|
42
|
-
title:
|
|
43
|
-
description:
|
|
44
|
-
confirmLabel:
|
|
45
|
-
onConfirm: () =>
|
|
45
|
+
onClick: () => U({
|
|
46
|
+
title: c("archiveTitle", { name: e.name }),
|
|
47
|
+
description: c("archiveDescription"),
|
|
48
|
+
confirmLabel: c("archive"),
|
|
49
|
+
onConfirm: () => H.mutateAsync(e.slug)
|
|
46
50
|
})
|
|
47
51
|
}] : []
|
|
48
52
|
];
|
|
49
|
-
return /* @__PURE__ */
|
|
53
|
+
return /* @__PURE__ */ D("div", {
|
|
50
54
|
className: "w-full px-4 py-6 md:px-8 md:py-8",
|
|
51
55
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ D("div", {
|
|
53
57
|
className: "flex items-center justify-between",
|
|
54
58
|
children: [
|
|
55
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ E("div", { children: /* @__PURE__ */ E("h1", {
|
|
56
60
|
className: "text-xl font-semibold tracking-tight",
|
|
57
|
-
children:
|
|
61
|
+
children: c("title")
|
|
58
62
|
}) }),
|
|
59
|
-
|
|
63
|
+
P.length > 0 && /* @__PURE__ */ E(g, {
|
|
60
64
|
to: "/$workspace/measures",
|
|
61
|
-
params: { workspace:
|
|
62
|
-
className: `${
|
|
63
|
-
children:
|
|
65
|
+
params: { workspace: s },
|
|
66
|
+
className: `${S()} ml-auto mr-2`,
|
|
67
|
+
children: c("measures")
|
|
64
68
|
}),
|
|
65
|
-
|
|
69
|
+
R && P.length > 0 && /* @__PURE__ */ E(g, {
|
|
66
70
|
to: "/$workspace/agents/$slug",
|
|
67
71
|
params: {
|
|
68
|
-
workspace:
|
|
72
|
+
workspace: s,
|
|
69
73
|
slug: "new"
|
|
70
74
|
},
|
|
71
|
-
className:
|
|
72
|
-
children:
|
|
75
|
+
className: S({ variant: "primary" }),
|
|
76
|
+
children: c("new")
|
|
73
77
|
})
|
|
74
78
|
]
|
|
75
79
|
}),
|
|
76
|
-
|
|
77
|
-
icon: /* @__PURE__ */
|
|
78
|
-
title:
|
|
79
|
-
description:
|
|
80
|
-
...
|
|
80
|
+
P.length === 0 ? /* @__PURE__ */ E(x, {
|
|
81
|
+
icon: /* @__PURE__ */ E(o, {}),
|
|
82
|
+
title: c("empty"),
|
|
83
|
+
description: c("emptyDescription"),
|
|
84
|
+
...R && { action: /* @__PURE__ */ E(g, {
|
|
81
85
|
to: "/$workspace/agents/$slug",
|
|
82
86
|
params: {
|
|
83
|
-
workspace:
|
|
87
|
+
workspace: s,
|
|
84
88
|
slug: "new"
|
|
85
89
|
},
|
|
86
|
-
className:
|
|
87
|
-
children:
|
|
90
|
+
className: S({ variant: "primary" }),
|
|
91
|
+
children: c("new")
|
|
88
92
|
}) },
|
|
89
93
|
className: "mt-8"
|
|
90
|
-
}) : /* @__PURE__ */
|
|
94
|
+
}) : /* @__PURE__ */ E(b, {
|
|
91
95
|
size: "fill",
|
|
92
96
|
padding: "none",
|
|
93
97
|
divided: !0,
|
|
94
98
|
interactive: !1,
|
|
95
|
-
render: /* @__PURE__ */
|
|
99
|
+
render: /* @__PURE__ */ E("ul", {}),
|
|
96
100
|
className: "mt-8 overflow-hidden",
|
|
97
|
-
children:
|
|
101
|
+
children: P.map((e) => /* @__PURE__ */ E("li", { children: /* @__PURE__ */ D(g, {
|
|
98
102
|
to: "/$workspace/agents/$slug",
|
|
99
103
|
params: {
|
|
100
|
-
workspace:
|
|
104
|
+
workspace: s,
|
|
101
105
|
slug: e.slug
|
|
102
106
|
},
|
|
103
|
-
onContextMenu: (t) =>
|
|
107
|
+
onContextMenu: (t) => z(t, G(e)),
|
|
104
108
|
className: "flex items-center gap-3 px-3 py-2.5 hover:bg-muted",
|
|
105
109
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ E(y, {
|
|
107
111
|
kind: "agent",
|
|
108
112
|
name: e.name,
|
|
109
113
|
size: "md",
|
|
110
114
|
decorative: !0
|
|
111
115
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ D("span", {
|
|
113
117
|
className: "min-w-0 flex-1",
|
|
114
|
-
children: [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ D("span", {
|
|
120
|
+
className: "block text-sm font-medium",
|
|
121
|
+
children: [e.name, e.archivedAt && /* @__PURE__ */ D("span", {
|
|
122
|
+
className: "font-normal text-muted-foreground",
|
|
123
|
+
children: [" ", c("archived")]
|
|
124
|
+
})]
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ E("span", {
|
|
127
|
+
className: "block truncate text-xs text-muted-foreground",
|
|
128
|
+
children: e.description || c("noDescription")
|
|
129
|
+
}),
|
|
130
|
+
!e.archivedAt && /* @__PURE__ */ E(N, {
|
|
131
|
+
workspace: s,
|
|
132
|
+
agent: e,
|
|
133
|
+
runners: F,
|
|
134
|
+
working: I.filter((t) => t.agentId === e.id && t.state === "working")
|
|
135
|
+
})
|
|
136
|
+
]
|
|
124
137
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ E("span", {
|
|
126
139
|
className: "text-xs text-muted-foreground",
|
|
127
|
-
children: e.model ?
|
|
128
|
-
harness:
|
|
140
|
+
children: e.model ? c("harnessWithModel", {
|
|
141
|
+
harness: l[e.harness] ?? e.harness,
|
|
129
142
|
model: e.model
|
|
130
|
-
}) :
|
|
143
|
+
}) : l[e.harness]
|
|
131
144
|
})
|
|
132
145
|
]
|
|
133
146
|
}) }, e.id))
|
|
134
147
|
}),
|
|
135
|
-
|
|
148
|
+
W
|
|
136
149
|
]
|
|
137
150
|
});
|
|
138
151
|
}
|
|
139
|
-
|
|
152
|
+
function N({ workspace: e, agent: t, runners: n, working: r }) {
|
|
153
|
+
let i = T("agents"), a = u(t, n).filter((e) => e.online), o = [...new Map(r.filter((e) => e.runnerName).map((e) => [e.runnerName, e])).values()];
|
|
154
|
+
return /* @__PURE__ */ D("span", {
|
|
155
|
+
className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",
|
|
156
|
+
children: [o.length > 0 ? /* @__PURE__ */ D("span", {
|
|
157
|
+
className: "inline-flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5",
|
|
158
|
+
children: [/* @__PURE__ */ E("span", {
|
|
159
|
+
className: "whitespace-nowrap",
|
|
160
|
+
children: i("workingOn")
|
|
161
|
+
}), o.map((t) => /* @__PURE__ */ E(c, {
|
|
162
|
+
workspace: e,
|
|
163
|
+
name: t.runnerName ?? "",
|
|
164
|
+
kind: t.runnerKind,
|
|
165
|
+
link: !1,
|
|
166
|
+
className: "font-medium text-foreground"
|
|
167
|
+
}, t.runnerName))]
|
|
168
|
+
}) : /* @__PURE__ */ E("span", { children: i("idle") }), a.length > 0 ? /* @__PURE__ */ D("span", {
|
|
169
|
+
className: "inline-flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5",
|
|
170
|
+
children: [/* @__PURE__ */ E("span", {
|
|
171
|
+
className: "whitespace-nowrap",
|
|
172
|
+
children: i("canRunOn")
|
|
173
|
+
}), a.map((t) => /* @__PURE__ */ E(c, {
|
|
174
|
+
workspace: e,
|
|
175
|
+
name: t.runner.name,
|
|
176
|
+
kind: t.runner.kind,
|
|
177
|
+
link: !1
|
|
178
|
+
}, t.runner.id))]
|
|
179
|
+
}) : /* @__PURE__ */ D("span", {
|
|
180
|
+
className: "inline-flex items-center gap-1 text-warning",
|
|
181
|
+
children: [/* @__PURE__ */ E(s, { className: "size-3.5" }), i("noRunnerOnline")]
|
|
182
|
+
})]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
export { M as component };
|