@parallelworks/tandem-web 0.193.0 → 0.194.1

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.
@@ -1,52 +1,130 @@
1
1
  import { api as e, unwrap as t } from "../../../api/client.js";
2
2
  import { agentQuery as n, agentsQuery as r, meQuery as i, myModelsQuery as a, runnersQuery as o, workspaceRunsQuery as s } from "../../../api/queries.js";
3
- import { Editor as c } from "../../../components/Editor.js";
4
- import { FavoriteStar as ee } from "../../../components/FavoriteStar.js";
5
- import { AlertIcon as l } from "../../../components/icons.js";
6
- import { RunnerBadge as u } from "../../../components/RunnerBadge.js";
7
- import { NotFound as d } from "../../../components/status.js";
8
- import { harnessOptions as f, runnableHarnesses as p, runnersFor as m } from "../../../lib/agents.js";
9
- import { usePageTitle as h } from "../../../lib/pageTitle.js";
3
+ import { AgentActions as c } from "../../../components/AgentActions.js";
4
+ import { AgentBugReports as l } from "../../../components/AgentBugReports.js";
5
+ import { AgentDeploy as u } from "../../../components/AgentDeploy.js";
6
+ import { useMoney as d } from "../../../components/AgentWork.js";
7
+ import { Editor as f } from "../../../components/Editor.js";
8
+ import { FavoriteStar as p } from "../../../components/FavoriteStar.js";
9
+ import { RunnerBadge as m } from "../../../components/RunnerBadge.js";
10
+ import { NotFound as h } from "../../../components/status.js";
11
+ import { harnessOptions as ee, runnableHarnesses as g } from "../../../lib/agents.js";
12
+ import { usePageTitle as _ } from "../../../lib/pageTitle.js";
10
13
  import { modeBelow as te, runnerModeCommand as ne, usePermissionModeName as re } from "../../../lib/permissionModes.js";
11
- import { may as ie } from "../../../lib/roles.js";
12
- import { Link as g, useNavigate as ae } from "../../../lib/router.js";
13
- import { Route as _ } from "./_slug.js";
14
- import { Autocomplete as oe, Button as se, ErrorText as ce, Input as v, NumberInput as y, PageHeader as le, RelativeTime as b, Select as x, toast as S } from "@parallelworks/ui";
15
- import { useState as C } from "react";
16
- import { useErrorMessage as ue } from "@parallelworks/problem/react";
17
- import { useTranslations as w } from "use-intl";
18
- import { jsx as T, jsxs as E } from "react/jsx-runtime";
19
- import { useMutation as D, useQuery as O, useQueryClient as de, useSuspenseQuery as k } from "@tanstack/react-query";
14
+ import { may as v } from "../../../lib/roles.js";
15
+ import { Link as y, useNavigate as b } from "../../../lib/router.js";
16
+ import { Route as x } from "./_slug.js";
17
+ import { Autocomplete as ie, Button as ae, ErrorText as oe, Input as S, NumberInput as C, PageHeader as w, RelativeTime as T, Select as E, Tabs as D, toast as se } from "@parallelworks/ui";
18
+ import { useState as O } from "react";
19
+ import { useErrorMessage as ce } from "@parallelworks/problem/react";
20
+ import { useFormatter as k, useTranslations as A } from "use-intl";
21
+ import { jsx as j, jsxs as M } from "react/jsx-runtime";
22
+ import { useMutation as N, useQuery as P, useQueryClient as le, useSuspenseQuery as F } from "@tanstack/react-query";
20
23
  // src/routes/$workspace/agents/$slug.tsx?tsr-split=component
21
- var A = "block text-sm font-medium";
22
- function j() {
23
- let { workspace: e, slug: t } = _.useParams(), { data: n } = k(r(e)), i = n.find((e) => e.slug === t), a = w("agent");
24
- return h(i ? i.name : a("newAgent")), t !== "new" && !i ? /* @__PURE__ */ T(d, { title: a("notFound") }) : /* @__PURE__ */ T(M, {
25
- workspace: e,
26
- agent: i
27
- }, i?.id ?? "new");
24
+ var I = "block text-sm font-medium";
25
+ function L() {
26
+ let { workspace: e, slug: t } = x.useParams(), { data: n } = F(r(e)), i = n.find((e) => e.slug === t), a = A("agent");
27
+ _(i ? i.name : a("newAgent"));
28
+ let { tab: o = "actions" } = x.useSearch(), s = b(), d = A("workspace");
29
+ if (t !== "new" && !i) return /* @__PURE__ */ j(h, { title: a("notFound") });
30
+ let f = (n) => s({
31
+ to: "/$workspace/agents/$slug",
32
+ params: {
33
+ workspace: e,
34
+ slug: t
35
+ },
36
+ search: n === "configure" ? { tab: "configure" } : {}
37
+ });
38
+ return /* @__PURE__ */ M("div", {
39
+ className: "flex h-full min-h-0 flex-col",
40
+ children: [/* @__PURE__ */ j(w, {
41
+ heading: !1,
42
+ breadcrumbs: [{
43
+ label: d("agents"),
44
+ href: `/${e}/agents`
45
+ }, { label: i ? i.name : a("newAgent") }],
46
+ ...i && { titleActions: /* @__PURE__ */ j(p, {
47
+ workspace: e,
48
+ kind: "agent",
49
+ target: i.id
50
+ }) }
51
+ }), /* @__PURE__ */ j("div", {
52
+ className: "min-h-0 flex-1 overflow-y-auto",
53
+ children: /* @__PURE__ */ M("div", {
54
+ className: "w-full space-y-6 px-4 py-6 md:px-8 md:py-8",
55
+ children: [/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("h1", {
56
+ className: "text-xl font-semibold tracking-tight",
57
+ children: i ? i.name : a("newAgent")
58
+ }), i && /* @__PURE__ */ j("p", {
59
+ className: "mt-1 text-sm text-muted-foreground",
60
+ children: a("version", { version: i.version })
61
+ })] }), i ? /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j(D, {
62
+ label: a("tabs"),
63
+ variant: "line",
64
+ items: [{
65
+ value: "actions",
66
+ label: a("actions")
67
+ }, {
68
+ value: "configure",
69
+ label: a("configure")
70
+ }],
71
+ value: o,
72
+ onValueChange: f
73
+ }), o === "actions" ? /* @__PURE__ */ M("div", {
74
+ className: "space-y-6 pt-6",
75
+ children: [
76
+ !i.archivedAt && /* @__PURE__ */ j(u, {
77
+ workspace: e,
78
+ agent: i
79
+ }),
80
+ !i.archivedAt && /* @__PURE__ */ j(c, {
81
+ workspace: e,
82
+ agent: i
83
+ }),
84
+ /* @__PURE__ */ j(l, {
85
+ workspace: e,
86
+ agent: i
87
+ }),
88
+ /* @__PURE__ */ j(z, {
89
+ workspace: e,
90
+ agent: i
91
+ })
92
+ ]
93
+ }) : /* @__PURE__ */ j("div", {
94
+ className: "pt-6",
95
+ children: /* @__PURE__ */ j(R, {
96
+ workspace: e,
97
+ agent: i
98
+ }, i.id)
99
+ })] }) : /* @__PURE__ */ j(R, {
100
+ workspace: e,
101
+ agent: void 0
102
+ }, "new")]
103
+ })
104
+ })]
105
+ });
28
106
  }
29
- function fe(e) {
107
+ function ue(e) {
30
108
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
31
109
  }
32
- function M({ workspace: s, agent: l }) {
33
- let u = w("agent"), d = w("workspace"), m = ue(), h = w("common"), { data: g } = k(i), _ = ie(g, s, "manage_agents"), b = de(), j = ae(), [M, me] = C(l?.name ?? ""), [N, P] = C(l?.description ?? ""), [F, I] = C(l?.instructions ?? ""), [L, R] = C(l?.harness ?? "pw-code"), [z, he] = C(l?.model ?? ""), B = re(), ge = O({
34
- ...n(s, l?.slug ?? ""),
35
- enabled: !!l
36
- }).data?.modeAllowed, V = O({
110
+ function R({ workspace: s, agent: c }) {
111
+ let l = A("agent"), u = ce(), d = A("common"), { data: p } = F(i), m = v(p, s, "manage_agents"), h = le(), _ = b(), [y, x] = O(c?.name ?? ""), [w, T] = O(c?.description ?? ""), [D, k] = O(c?.instructions ?? ""), [L, R] = O(c?.harness ?? "pw-code"), [z, de] = O(c?.model ?? ""), B = re(), fe = P({
112
+ ...n(s, c?.slug ?? ""),
113
+ enabled: !!c
114
+ }).data?.modeAllowed, V = P({
37
115
  ...a,
38
116
  enabled: L === "pw-code"
39
- }).data ?? [], { data: _e = [] } = O(o(s)), { data: ve } = k(r(s)), H = [...new Set(ve.filter((e) => e.harness === L && e.model && e.id !== l?.id).map((e) => e.model))].filter((e) => !V.some((t) => t.id === e)), ye = [...V.map((e) => ({
117
+ }).data ?? [], { data: pe = [] } = P(o(s)), { data: me } = F(r(s)), H = [...new Set(me.filter((e) => e.harness === L && e.model && e.id !== c?.id).map((e) => e.model))].filter((e) => !V.some((t) => t.id === e)), he = [...V.map((e) => ({
40
118
  value: e.id,
41
119
  label: e.name || e.id,
42
120
  ...e.name && e.name !== e.id && { description: e.id }
43
121
  })), ...H.length > 0 ? [{
44
- label: u("modelsInWorkspace"),
122
+ label: l("modelsInWorkspace"),
45
123
  items: H
46
- }] : []], [U, be] = C(l?.runnerLabels.join(", ") ?? ""), [W, xe] = C(l?.maxRole ?? "member"), [G, Se] = C(l?.permissionMode ?? "accept-edits"), [K, Ce] = C(l?.maxTurns ?? 200), [q, we] = C(l?.maxMinutes ?? 120), [J, Y] = C((l?.maxCostMicros ?? 2e7) / 1e6), [Te, X] = C(null), Z = () => ({
47
- name: M,
48
- description: N,
49
- instructions: F,
124
+ }] : []], [U, ge] = O(c?.runnerLabels.join(", ") ?? ""), [W, _e] = O(c?.maxRole ?? "member"), [G, ve] = O(c?.permissionMode ?? "accept-edits"), [K, ye] = O(c?.maxTurns ?? 200), [q, be] = O(c?.maxMinutes ?? 120), [J, Y] = O((c?.maxCostMicros ?? 2e7) / 1e6), [xe, X] = O(null), Z = () => ({
125
+ name: y,
126
+ description: w,
127
+ instructions: D,
50
128
  harness: L,
51
129
  model: z,
52
130
  runnerLabels: U.split(",").map((e) => e.trim()).filter(Boolean),
@@ -55,23 +133,23 @@ function M({ workspace: s, agent: l }) {
55
133
  maxTurns: K ?? 0,
56
134
  maxMinutes: q ?? 0,
57
135
  maxCostMicros: Math.round((J ?? 0) * 1e6)
58
- }), Q = D({
59
- mutationFn: async () => t(l ? await e.PUT("/api/v1/workspaces/{workspace}/agents/{slug}", {
136
+ }), Q = N({
137
+ mutationFn: async () => t(c ? await e.PUT("/api/v1/workspaces/{workspace}/agents/{slug}", {
60
138
  params: { path: {
61
139
  workspace: s,
62
- slug: l.slug
140
+ slug: c.slug
63
141
  } },
64
142
  body: Z()
65
143
  }) : await e.POST("/api/v1/workspaces/{workspace}/agents", {
66
144
  params: { path: { workspace: s } },
67
145
  body: {
68
- slug: fe(M),
146
+ slug: ue(y),
69
147
  ...Z()
70
148
  }
71
149
  })),
72
150
  onMutate: () => X(null),
73
151
  onSuccess: (e) => {
74
- b.invalidateQueries({ queryKey: r(s).queryKey }), S.success(u(l ? "saved" : "created", { name: e.name })), j({
152
+ h.invalidateQueries({ queryKey: r(s).queryKey }), se.success(l(c ? "saved" : "created", { name: e.name })), _({
75
153
  to: "/$workspace/agents/$slug",
76
154
  params: {
77
155
  workspace: s,
@@ -79,334 +157,308 @@ function M({ workspace: s, agent: l }) {
79
157
  }
80
158
  });
81
159
  },
82
- onError: (e) => X(m(e))
83
- }), Ee = D({
160
+ onError: (e) => X(u(e))
161
+ }), Se = N({
84
162
  mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/agents/{slug}", { params: { path: {
85
163
  workspace: s,
86
- slug: l?.slug ?? ""
164
+ slug: c?.slug ?? ""
87
165
  } } })),
88
166
  onSuccess: () => {
89
- b.invalidateQueries({ queryKey: r(s).queryKey }), j({
167
+ h.invalidateQueries({ queryKey: r(s).queryKey }), _({
90
168
  to: "/$workspace/agents",
91
169
  params: { workspace: s }
92
170
  });
93
171
  }
94
- }), $ = _e.filter((e) => e.harnesses.includes(L) && e.permissionMode && te(e.permissionMode, G));
95
- return /* @__PURE__ */ E("div", {
96
- className: "flex h-full min-h-0 flex-col",
97
- children: [/* @__PURE__ */ T(le, {
98
- heading: !1,
99
- breadcrumbs: [{
100
- label: d("agents"),
101
- href: `/${s}/agents`
102
- }, { label: l ? l.name : u("newAgent") }],
103
- ...l && { titleActions: /* @__PURE__ */ T(ee, {
104
- workspace: s,
105
- kind: "agent",
106
- target: l.id
107
- }) }
108
- }), /* @__PURE__ */ E("div", {
109
- className: "min-h-0 flex-1 overflow-y-auto",
110
- children: [/* @__PURE__ */ E("form", {
111
- className: "w-full space-y-6 px-4 py-6 md:px-8 md:py-8",
112
- onSubmit: (e) => {
113
- e.preventDefault(), Q.mutate();
114
- },
172
+ }), $ = pe.filter((e) => e.harnesses.includes(L) && e.permissionMode && te(e.permissionMode, G));
173
+ return /* @__PURE__ */ M("form", {
174
+ className: "space-y-6",
175
+ onSubmit: (e) => {
176
+ e.preventDefault(), Q.mutate();
177
+ },
178
+ children: [
179
+ /* @__PURE__ */ M("fieldset", {
180
+ disabled: !m,
181
+ className: "space-y-5",
115
182
  children: [
116
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("h1", {
117
- className: "text-xl font-semibold tracking-tight",
118
- children: l ? l.name : u("newAgent")
119
- }), l && /* @__PURE__ */ T("p", {
120
- className: "mt-1 text-sm text-muted-foreground",
121
- children: u("version", { version: l.version })
183
+ /* @__PURE__ */ M("div", {
184
+ className: "grid gap-4 sm:grid-cols-2",
185
+ children: [/* @__PURE__ */ M("label", {
186
+ className: "block",
187
+ children: [/* @__PURE__ */ j("span", {
188
+ className: I,
189
+ children: d("name")
190
+ }), /* @__PURE__ */ j(S, {
191
+ required: !0,
192
+ value: y,
193
+ onChange: (e) => x(e.target.value),
194
+ className: "mt-1"
195
+ })]
196
+ }), /* @__PURE__ */ M("div", {
197
+ className: "block",
198
+ children: [/* @__PURE__ */ j("span", {
199
+ className: I,
200
+ children: l("model")
201
+ }), /* @__PURE__ */ j(ie, {
202
+ value: z,
203
+ items: he,
204
+ onValueChange: de,
205
+ placeholder: l(L === "pw-code" ? "modelPlaceholder" : "modelHarnessDefault"),
206
+ "aria-label": l("model"),
207
+ className: "mt-1"
208
+ })]
209
+ })]
210
+ }),
211
+ /* @__PURE__ */ M("label", {
212
+ className: "block",
213
+ children: [/* @__PURE__ */ j("span", {
214
+ className: I,
215
+ children: d("description")
216
+ }), /* @__PURE__ */ j(S, {
217
+ value: w,
218
+ onChange: (e) => T(e.target.value),
219
+ placeholder: l("optional"),
220
+ className: "mt-1"
221
+ })]
222
+ }),
223
+ /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("span", {
224
+ className: I,
225
+ children: l("instructions")
226
+ }), /* @__PURE__ */ j("div", {
227
+ className: "mt-1 rounded-md border border-border bg-card px-3 py-2",
228
+ children: /* @__PURE__ */ j(f, {
229
+ value: D,
230
+ onChange: k,
231
+ editable: m,
232
+ placeholder: l("instructionsPlaceholder"),
233
+ label: l("instructions"),
234
+ className: "min-h-32"
235
+ })
122
236
  })] }),
123
- /* @__PURE__ */ E("fieldset", {
124
- disabled: !_,
125
- className: "space-y-5",
237
+ /* @__PURE__ */ M("div", {
238
+ className: "flex flex-wrap items-end gap-6",
126
239
  children: [
127
- /* @__PURE__ */ E("div", {
128
- className: "grid gap-4 sm:grid-cols-2",
129
- children: [/* @__PURE__ */ E("label", {
130
- className: "block",
131
- children: [/* @__PURE__ */ T("span", {
132
- className: A,
133
- children: h("name")
134
- }), /* @__PURE__ */ T(v, {
135
- required: !0,
136
- value: M,
137
- onChange: (e) => me(e.target.value),
138
- className: "mt-1"
139
- })]
140
- }), /* @__PURE__ */ E("div", {
141
- className: "block",
142
- children: [/* @__PURE__ */ T("span", {
143
- className: A,
144
- children: u("model")
145
- }), /* @__PURE__ */ T(oe, {
146
- value: z,
147
- items: ye,
148
- onValueChange: he,
149
- placeholder: u(L === "pw-code" ? "modelPlaceholder" : "modelHarnessDefault"),
150
- "aria-label": u("model"),
151
- className: "mt-1"
152
- })]
153
- })]
154
- }),
155
- /* @__PURE__ */ E("label", {
156
- className: "block",
157
- children: [/* @__PURE__ */ T("span", {
158
- className: A,
159
- children: h("description")
160
- }), /* @__PURE__ */ T(v, {
161
- value: N,
162
- onChange: (e) => P(e.target.value),
163
- placeholder: u("optional"),
164
- className: "mt-1"
165
- })]
166
- }),
167
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("span", {
168
- className: A,
169
- children: u("instructions")
170
- }), /* @__PURE__ */ T("div", {
171
- className: "mt-1 rounded-md border border-border bg-card px-3 py-2",
172
- children: /* @__PURE__ */ T(c, {
173
- value: F,
174
- onChange: I,
175
- editable: _,
176
- placeholder: u("instructionsPlaceholder"),
177
- label: u("instructions"),
178
- className: "min-h-32"
240
+ /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("span", {
241
+ className: I,
242
+ children: l("harness")
243
+ }), /* @__PURE__ */ j("div", {
244
+ className: "mt-1",
245
+ children: /* @__PURE__ */ j(E, {
246
+ value: L,
247
+ items: ee.filter((e) => g.includes(e.value) || e.value === c?.harness).map((e) => g.includes(e.value) ? e : {
248
+ ...e,
249
+ label: l("harnessNoRunner", { harness: e.label })
250
+ }),
251
+ onValueChange: (e) => R(e),
252
+ "aria-label": l("harness"),
253
+ width: "content",
254
+ disabled: !m
179
255
  })
180
256
  })] }),
181
- /* @__PURE__ */ E("div", {
182
- className: "flex flex-wrap items-end gap-6",
183
- children: [
184
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("span", {
185
- className: A,
186
- children: u("harness")
187
- }), /* @__PURE__ */ T("div", {
188
- className: "mt-1",
189
- children: /* @__PURE__ */ T(x, {
190
- value: L,
191
- items: f.filter((e) => p.includes(e.value) || e.value === l?.harness).map((e) => p.includes(e.value) ? e : {
192
- ...e,
193
- label: u("harnessNoRunner", { harness: e.label })
194
- }),
195
- onValueChange: (e) => R(e),
196
- "aria-label": u("harness"),
197
- width: "content",
198
- disabled: !_
199
- })
200
- })] }),
201
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("span", {
202
- className: A,
203
- children: u("access")
204
- }), /* @__PURE__ */ T("div", {
205
- className: "mt-1",
206
- children: /* @__PURE__ */ T(x, {
207
- value: W,
208
- items: [{
209
- value: "member",
210
- label: u("accessMember")
211
- }, {
212
- value: "viewer",
213
- label: u("accessViewer")
214
- }],
215
- onValueChange: (e) => xe(e),
216
- "aria-label": u("access"),
217
- width: "content",
218
- disabled: !_
219
- })
220
- })] }),
221
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("span", {
222
- className: A,
223
- children: u("permissionMode")
224
- }), /* @__PURE__ */ T("div", {
225
- className: "mt-1",
226
- children: /* @__PURE__ */ T(x, {
227
- value: G,
228
- items: [
229
- {
230
- value: "default",
231
- label: u("permissionDefault")
232
- },
233
- {
234
- value: "accept-edits",
235
- label: u("permissionAcceptEdits")
236
- },
237
- {
238
- value: "auto",
239
- label: u("permissionAuto")
240
- },
241
- {
242
- value: "bypass",
243
- label: u("permissionBypass")
244
- }
245
- ],
246
- onValueChange: (e) => Se(e),
247
- "aria-label": u("permissionMode"),
248
- width: "content",
249
- disabled: !_ || W === "viewer"
250
- })
251
- })] }),
252
- /* @__PURE__ */ E("label", {
253
- className: "block min-w-48 flex-1",
254
- children: [/* @__PURE__ */ T("span", {
255
- className: A,
256
- children: u("runnerLabels")
257
- }), /* @__PURE__ */ T(v, {
258
- value: U,
259
- onChange: (e) => be(e.target.value),
260
- placeholder: u("runnerLabelsPlaceholder"),
261
- className: "mt-1"
262
- })]
263
- })
264
- ]
265
- }),
266
- /* @__PURE__ */ T("p", {
267
- className: "-mt-2 text-xs text-muted-foreground",
268
- children: u("permissionModeHint")
269
- }),
270
- $.length > 0 && W !== "viewer" ? /* @__PURE__ */ T("p", {
271
- role: "status",
272
- className: "-mt-2 text-xs text-pretty text-warning",
273
- children: u.rich("modeCappedBy", {
274
- runners: $.map((e) => `${e.name} (${B(e.permissionMode ?? "")})`).join(", "),
275
- mode: B(G),
276
- code: () => /* @__PURE__ */ T("code", { children: ne(G) })
257
+ /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("span", {
258
+ className: I,
259
+ children: l("access")
260
+ }), /* @__PURE__ */ j("div", {
261
+ className: "mt-1",
262
+ children: /* @__PURE__ */ j(E, {
263
+ value: W,
264
+ items: [{
265
+ value: "member",
266
+ label: l("accessMember")
267
+ }, {
268
+ value: "viewer",
269
+ label: l("accessViewer")
270
+ }],
271
+ onValueChange: (e) => _e(e),
272
+ "aria-label": l("access"),
273
+ width: "content",
274
+ disabled: !m
277
275
  })
278
- }) : ge === !1 && l?.permissionMode === G && /* @__PURE__ */ T("p", {
279
- role: "status",
280
- className: "-mt-2 text-xs text-warning",
281
- children: u("modeNotAllowed", { mode: B(G) })
282
- }),
283
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("span", {
284
- className: A,
285
- children: u("limits")
286
- }), /* @__PURE__ */ E("div", {
287
- className: "mt-2 grid gap-4 sm:grid-cols-3",
288
- children: [
289
- /* @__PURE__ */ E("label", {
290
- className: "block text-sm",
291
- children: [u("turns"), /* @__PURE__ */ T(y, {
292
- min: 1,
293
- value: K,
294
- onValueChange: Ce,
295
- "aria-label": u("turns"),
296
- disabled: !_,
297
- className: "mt-1"
298
- })]
299
- }),
300
- /* @__PURE__ */ E("label", {
301
- className: "block text-sm",
302
- children: [u("minutes"), /* @__PURE__ */ T(y, {
303
- min: 1,
304
- value: q,
305
- onValueChange: we,
306
- "aria-label": u("minutes"),
307
- disabled: !_,
308
- className: "mt-1"
309
- })]
310
- }),
311
- /* @__PURE__ */ E("label", {
312
- className: "block text-sm",
313
- children: [u("cost"), /* @__PURE__ */ T(y, {
314
- min: .01,
315
- step: .01,
316
- value: J,
317
- onValueChange: Y,
318
- "aria-label": u("cost"),
319
- disabled: !_,
320
- className: "mt-1"
321
- })]
322
- })
323
- ]
324
- })] })
276
+ })] }),
277
+ /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("span", {
278
+ className: I,
279
+ children: l("permissionMode")
280
+ }), /* @__PURE__ */ j("div", {
281
+ className: "mt-1",
282
+ children: /* @__PURE__ */ j(E, {
283
+ value: G,
284
+ items: [
285
+ {
286
+ value: "default",
287
+ label: l("permissionDefault")
288
+ },
289
+ {
290
+ value: "accept-edits",
291
+ label: l("permissionAcceptEdits")
292
+ },
293
+ {
294
+ value: "auto",
295
+ label: l("permissionAuto")
296
+ },
297
+ {
298
+ value: "bypass",
299
+ label: l("permissionBypass")
300
+ }
301
+ ],
302
+ onValueChange: (e) => ve(e),
303
+ "aria-label": l("permissionMode"),
304
+ width: "content",
305
+ disabled: !m || W === "viewer"
306
+ })
307
+ })] }),
308
+ /* @__PURE__ */ M("label", {
309
+ className: "block min-w-48 flex-1",
310
+ children: [/* @__PURE__ */ j("span", {
311
+ className: I,
312
+ children: l("runnerLabels")
313
+ }), /* @__PURE__ */ j(S, {
314
+ value: U,
315
+ onChange: (e) => ge(e.target.value),
316
+ placeholder: l("runnerLabelsPlaceholder"),
317
+ className: "mt-1"
318
+ })]
319
+ })
325
320
  ]
326
321
  }),
327
- /* @__PURE__ */ T(ce, {
328
- size: "md",
329
- children: Te
322
+ /* @__PURE__ */ j("p", {
323
+ className: "-mt-2 text-xs text-muted-foreground",
324
+ children: l("permissionModeHint")
330
325
  }),
331
- _ && /* @__PURE__ */ E("div", {
332
- className: "flex items-center gap-3",
333
- children: [/* @__PURE__ */ T(se, {
334
- type: "submit",
335
- variant: "primary",
336
- disabled: !M.trim(),
337
- loading: Q.isPending,
338
- children: l ? h("save") : u("create")
339
- }), l && !l.archivedAt && /* @__PURE__ */ T("button", {
340
- type: "button",
341
- onClick: () => Ee.mutate(),
342
- className: "h-9 rounded-md px-3 text-sm text-muted-foreground hover:text-danger",
343
- children: u("archive")
344
- })]
345
- })
326
+ $.length > 0 && W !== "viewer" ? /* @__PURE__ */ j("p", {
327
+ role: "status",
328
+ className: "-mt-2 text-xs text-pretty text-warning",
329
+ children: l.rich("modeCappedBy", {
330
+ runners: $.map((e) => `${e.name} (${B(e.permissionMode ?? "")})`).join(", "),
331
+ mode: B(G),
332
+ code: () => /* @__PURE__ */ j("code", { children: ne(G) })
333
+ })
334
+ }) : fe === !1 && c?.permissionMode === G && /* @__PURE__ */ j("p", {
335
+ role: "status",
336
+ className: "-mt-2 text-xs text-warning",
337
+ children: l("modeNotAllowed", { mode: B(G) })
338
+ }),
339
+ /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("span", {
340
+ className: I,
341
+ children: l("limits")
342
+ }), /* @__PURE__ */ M("div", {
343
+ className: "mt-2 grid gap-4 sm:grid-cols-3",
344
+ children: [
345
+ /* @__PURE__ */ M("label", {
346
+ className: "block text-sm",
347
+ children: [l("turns"), /* @__PURE__ */ j(C, {
348
+ min: 1,
349
+ value: K,
350
+ onValueChange: ye,
351
+ "aria-label": l("turns"),
352
+ disabled: !m,
353
+ className: "mt-1"
354
+ })]
355
+ }),
356
+ /* @__PURE__ */ M("label", {
357
+ className: "block text-sm",
358
+ children: [l("minutes"), /* @__PURE__ */ j(C, {
359
+ min: 1,
360
+ value: q,
361
+ onValueChange: be,
362
+ "aria-label": l("minutes"),
363
+ disabled: !m,
364
+ className: "mt-1"
365
+ })]
366
+ }),
367
+ /* @__PURE__ */ M("label", {
368
+ className: "block text-sm",
369
+ children: [l("cost"), /* @__PURE__ */ j(C, {
370
+ min: .01,
371
+ step: .01,
372
+ value: J,
373
+ onValueChange: Y,
374
+ "aria-label": l("cost"),
375
+ disabled: !m,
376
+ className: "mt-1"
377
+ })]
378
+ })
379
+ ]
380
+ })] })
346
381
  ]
347
- }), l && /* @__PURE__ */ T(pe, {
348
- workspace: s,
349
- agent: l
350
- })]
351
- })]
352
- });
353
- }
354
- function pe({ workspace: e, agent: t }) {
355
- let n = w("agent"), r = w("agentWork.state"), { data: i = [] } = O(s(e, { agent: t.slug })), { data: a = [] } = O(o(e)), c = m(t, a).some((e) => e.online);
356
- return /* @__PURE__ */ E("section", {
357
- "aria-labelledby": "agent-runs",
358
- className: "space-y-3 px-4 pb-8 md:px-8",
359
- children: [
360
- /* @__PURE__ */ T("h2", {
361
- id: "agent-runs",
362
- className: "text-base font-semibold",
363
- children: n("runs")
364
382
  }),
365
- !c && !t.archivedAt && /* @__PURE__ */ E("p", {
366
- className: "flex items-center gap-1.5 text-sm text-warning",
367
- children: [/* @__PURE__ */ T(l, { className: "size-4" }), n("noRunnerOnline")]
383
+ /* @__PURE__ */ j(oe, {
384
+ size: "md",
385
+ children: xe
368
386
  }),
369
- i.length === 0 ? /* @__PURE__ */ T("p", {
370
- className: "text-sm text-muted-foreground",
371
- children: n("noRuns")
372
- }) : /* @__PURE__ */ T("ul", {
373
- className: "divide-y divide-border rounded-lg border border-border",
374
- children: i.map((t) => /* @__PURE__ */ E("li", {
375
- className: "flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-sm",
376
- children: [
377
- /* @__PURE__ */ E(g, {
378
- to: "/$workspace/issues/$identifier",
379
- params: {
380
- workspace: e,
381
- identifier: t.identifier
382
- },
383
- className: "min-w-0 flex-1 truncate hover:underline",
384
- children: [/* @__PURE__ */ T("span", {
385
- className: "mr-2 tabular-nums text-muted-foreground",
386
- children: t.identifier
387
- }), t.issueTitle]
388
- }),
389
- /* @__PURE__ */ T("span", {
390
- className: "text-xs text-muted-foreground",
391
- children: r(t.state)
392
- }),
393
- /* @__PURE__ */ T("span", {
394
- className: "text-xs text-muted-foreground",
395
- children: t.lastRunnerName ? /* @__PURE__ */ T(u, {
396
- workspace: e,
397
- name: t.lastRunnerName,
398
- kind: t.runnerKind
399
- }) : n("noRunnerYet")
400
- }),
401
- /* @__PURE__ */ T(b, {
402
- value: t.createdAt,
403
- format: "compact",
404
- className: "text-xs text-muted-foreground"
405
- })
406
- ]
407
- }, t.id))
387
+ m && /* @__PURE__ */ M("div", {
388
+ className: "flex items-center gap-3",
389
+ children: [/* @__PURE__ */ j(ae, {
390
+ type: "submit",
391
+ variant: "primary",
392
+ disabled: !y.trim(),
393
+ loading: Q.isPending,
394
+ children: c ? d("save") : l("create")
395
+ }), c && !c.archivedAt && /* @__PURE__ */ j("button", {
396
+ type: "button",
397
+ onClick: () => Se.mutate(),
398
+ className: "h-9 rounded-md px-3 text-sm text-muted-foreground hover:text-danger",
399
+ children: l("archive")
400
+ })]
408
401
  })
409
402
  ]
410
403
  });
411
404
  }
412
- export { j as component };
405
+ function z({ workspace: e, agent: t }) {
406
+ let n = A("agent"), r = A("agentWork.state"), i = d(), a = k(), { data: o = [] } = P(s(e, { agent: t.slug }));
407
+ return /* @__PURE__ */ M("section", {
408
+ "aria-labelledby": "agent-runs",
409
+ className: "space-y-3",
410
+ children: [/* @__PURE__ */ j("h2", {
411
+ id: "agent-runs",
412
+ className: "text-base font-semibold",
413
+ children: n("runs")
414
+ }), o.length === 0 ? /* @__PURE__ */ j("p", {
415
+ className: "text-sm text-muted-foreground",
416
+ children: n("noRuns")
417
+ }) : /* @__PURE__ */ j("ul", {
418
+ className: "divide-y divide-border rounded-lg border border-border",
419
+ children: o.map((t) => /* @__PURE__ */ M("li", {
420
+ className: "flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-sm",
421
+ children: [
422
+ /* @__PURE__ */ M(y, {
423
+ to: "/$workspace/issues/$identifier",
424
+ params: {
425
+ workspace: e,
426
+ identifier: t.identifier
427
+ },
428
+ className: "min-w-0 flex-1 truncate hover:underline",
429
+ children: [/* @__PURE__ */ j("span", {
430
+ className: "mr-2 tabular-nums text-muted-foreground",
431
+ children: t.identifier
432
+ }), t.issueTitle]
433
+ }),
434
+ /* @__PURE__ */ j("span", {
435
+ className: "text-xs text-muted-foreground",
436
+ children: r(t.state)
437
+ }),
438
+ /* @__PURE__ */ j("span", {
439
+ className: "text-xs text-muted-foreground",
440
+ children: t.lastRunnerName ? /* @__PURE__ */ j(m, {
441
+ workspace: e,
442
+ name: t.lastRunnerName,
443
+ kind: t.runnerKind
444
+ }) : n("noRunnerYet")
445
+ }),
446
+ /* @__PURE__ */ j("span", {
447
+ className: "text-xs text-muted-foreground tabular-nums",
448
+ children: n("runDuration", { minutes: a.number(Math.max(1, Math.round(t.seconds / 60))) })
449
+ }),
450
+ /* @__PURE__ */ j("span", {
451
+ className: "text-xs text-muted-foreground tabular-nums",
452
+ children: i(t.costMicros)
453
+ }),
454
+ /* @__PURE__ */ j(T, {
455
+ value: t.createdAt,
456
+ format: "compact",
457
+ className: "text-xs text-muted-foreground"
458
+ })
459
+ ]
460
+ }, t.id))
461
+ })]
462
+ });
463
+ }
464
+ export { L as component };