@parallelworks/tandem-web 0.177.0 → 0.178.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.
@@ -18,38 +18,39 @@ import { AgentPage as C } from "./AgentPage.js";
18
18
  import { Editor as w } from "./Editor.js";
19
19
  import { pullRequestNumber as ne } from "./IssueCode.js";
20
20
  import { AreaIcon as T, CodeHostIcon as re, FileTextIcon as ie, LibraryIcon as ae, PullRequestIcon as oe } from "./icons.js";
21
- import { Avatar as se, Button as E, Card as ce, CopyCodeBlock as D, Disclosure as O, ErrorText as le, NumberInput as k, RelativeTime as A, Tooltip as ue, menuDivider as de, useOpenMenu as fe } from "@parallelworks/ui";
22
- import { useParams as j } from "@tanstack/react-router";
23
- import { useCallback as M, useEffect as N, useRef as P, useState as F } from "react";
21
+ import { RunnerBadge as se } from "./RunnerBadge.js";
22
+ import { Avatar as ce, Button as E, Card as le, CopyCodeBlock as D, Disclosure as O, ErrorText as ue, NumberInput as k, RelativeTime as A, Tooltip as j, menuDivider as de, useOpenMenu as fe } from "@parallelworks/ui";
23
+ import { useParams as M } from "@tanstack/react-router";
24
+ import { useCallback as N, useEffect as P, useRef as F, useState as I } from "react";
24
25
  import { useErrorMessage as pe } from "@parallelworks/problem/react";
25
- import { useFormatter as I, useTranslations as L } from "use-intl";
26
- import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
27
- import { useMutation as me, useQuery as V, useQueryClient as he, useSuspenseQuery as H } from "@tanstack/react-query";
26
+ import { useFormatter as L, useTranslations as R } from "use-intl";
27
+ import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
28
+ import { useMutation as me, useQuery as H, useQueryClient as he, useSuspenseQuery as U } from "@tanstack/react-query";
28
29
  import { MoreButton as ge } from "@parallelworks/ui/list";
29
30
  // src/components/AgentWork.tsx
30
31
  var _e = "var(--agent-tone)";
31
32
  function ve() {
32
- let e = I();
33
+ let e = L();
33
34
  return (t) => e.number(t / 1e6, {
34
35
  style: "currency",
35
36
  currency: "USD"
36
37
  });
37
38
  }
38
39
  function ye({ workspace: e, identifier: t }) {
39
- let { data: n } = H(l(e, t)), { data: r } = H(a(e, t)), i = r.filter((e) => !e.answer && !e.canceled), o = r.filter((e) => e.answer && !e.canceled), s = n.filter((e, t) => t === 0 || !["closed", "stopped"].includes(e.state)), c = L("agentWork");
40
- return n.length === 0 ? null : /* @__PURE__ */ B("section", {
40
+ let { data: n } = U(l(e, t)), { data: r } = U(a(e, t)), i = r.filter((e) => !e.answer && !e.canceled), o = r.filter((e) => e.answer && !e.canceled), s = n.filter((e, t) => t === 0 || !["closed", "stopped"].includes(e.state)), c = R("agentWork");
41
+ return n.length === 0 ? null : /* @__PURE__ */ V("section", {
41
42
  className: "mt-8 space-y-3",
42
43
  "aria-label": c("label"),
43
44
  children: [
44
- i.map((t) => /* @__PURE__ */ z(X, {
45
+ i.map((t) => /* @__PURE__ */ B(X, {
45
46
  workspace: e,
46
47
  decision: t
47
48
  }, t.id)),
48
- o.length > 0 && /* @__PURE__ */ z($, {
49
+ o.length > 0 && /* @__PURE__ */ B($, {
49
50
  workspace: e,
50
51
  decisions: o
51
52
  }),
52
- s.map((n) => /* @__PURE__ */ z(be, {
53
+ s.map((n) => /* @__PURE__ */ B(be, {
53
54
  workspace: e,
54
55
  identifier: t,
55
56
  run: n
@@ -58,7 +59,7 @@ function ye({ workspace: e, identifier: t }) {
58
59
  });
59
60
  }
60
61
  function be({ workspace: i, identifier: a, run: s }) {
61
- let c = L("agentWork"), d = L("common"), f = pe(), p = ee(), g = S(), v = ve(), y = (e) => c(`state.${e}`), { nameOf: x } = b(i), C = he(), [T, ie] = F(s.state === "working"), ae = () => {
62
+ let c = R("agentWork"), d = R("common"), f = pe(), p = ee(), g = S(), v = ve(), y = (e) => c(`state.${e}`), { nameOf: x } = b(i), C = he(), [T, ie] = I(s.state === "working"), ae = () => {
62
63
  C.invalidateQueries({ queryKey: l(i, a).queryKey }), n(C, i, a);
63
64
  }, D = me({
64
65
  mutationFn: async (n) => t(await e.POST("/api/v1/workspaces/{workspace}/runs/{runId}/move", {
@@ -69,7 +70,7 @@ function be({ workspace: i, identifier: a, run: s }) {
69
70
  body: n
70
71
  })),
71
72
  onSettled: ae
72
- }), [O, k] = F(!1), [A, ue] = F(""), j = me({
73
+ }), [O, k] = I(!1), [A, j] = I(""), M = me({
73
74
  mutationFn: async () => (t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/comments", {
74
75
  params: { path: {
75
76
  workspace: i,
@@ -87,10 +88,10 @@ function be({ workspace: i, identifier: a, run: s }) {
87
88
  }
88
89
  }))),
89
90
  onSuccess: () => {
90
- k(!1), ue("");
91
+ k(!1), j("");
91
92
  },
92
93
  onSettled: ae
93
- }), M = D.isPending || j.isPending, N = Se(s), [P, I] = F(!1), H = () => N ? I(!0) : D.mutate({ state: "queued" }), ye = N && {
94
+ }), N = D.isPending || M.isPending, P = Se(s), [F, L] = I(!1), U = () => P ? L(!0) : D.mutate({ state: "queued" }), ye = P && {
94
95
  turns: {
95
96
  used: s.turns,
96
97
  allowed: s.budget.maxTurns
@@ -103,12 +104,12 @@ function be({ workspace: i, identifier: a, run: s }) {
103
104
  used: v(s.costMicros),
104
105
  allowed: v(s.budget.maxCostMicros)
105
106
  }
106
- }[N], be = !["closed", "stopped"].includes(s.state), U = s.state === "done_pending_verification", G = fe(), Te = te(), { data: Ee = [] } = V(r(i)), K = Ee.find((e) => e.id === s.agentId), { data: De = [] } = V(o(i, a)), q = De.find((e) => e.runId === s.id), J = L("code"), Y = K?.slug, X = h(), Z = X && (s.harnessSession || s.runnerName) ? {
107
+ }[P], be = !["closed", "stopped"].includes(s.state), W = s.state === "done_pending_verification", K = fe(), Te = te(), { data: Ee = [] } = H(r(i)), q = Ee.find((e) => e.id === s.agentId), { data: De = [] } = H(o(i, a)), J = De.find((e) => e.runId === s.id), Y = R("code"), Oe = q?.slug, X = h(), Z = X && (s.harnessSession || s.runnerName) ? {
107
108
  label: c("openRunIn", { name: X.action.label }),
108
109
  onClick: () => X.open(s)
109
110
  } : void 0, Q = () => [
110
111
  ...Z ? [Z] : [],
111
- ...U ? [{
112
+ ...W ? [{
112
113
  label: c("accept"),
113
114
  onClick: () => D.mutate({ state: "closed" })
114
115
  }, {
@@ -117,7 +118,7 @@ function be({ workspace: i, identifier: a, run: s }) {
117
118
  }] : [],
118
119
  ...s.state === "stopped" || s.state === "blocked_external" ? [{
119
120
  label: c("resume"),
120
- onClick: () => H()
121
+ onClick: () => U()
121
122
  }] : [],
122
123
  ...be ? [{
123
124
  label: c("stop"),
@@ -125,98 +126,109 @@ function be({ workspace: i, identifier: a, run: s }) {
125
126
  onClick: () => D.mutate({ state: "stopped" })
126
127
  }] : [],
127
128
  de,
128
- ...Y ? [{
129
+ ...Oe ? [{
129
130
  label: c("openAgent"),
130
131
  onClick: () => Te({
131
132
  to: "/$workspace/agents/$slug",
132
133
  params: {
133
134
  workspace: i,
134
- slug: Y
135
+ slug: Oe
135
136
  }
136
137
  })
137
138
  }] : [],
138
139
  _(c("copyRunId"), s.id)
139
140
  ], $ = s.state === "working" || s.state === "queued";
140
- return s.state === "closed" ? /* @__PURE__ */ B("div", {
141
- onContextMenu: (e) => G(e, Q()),
141
+ return s.state === "closed" ? /* @__PURE__ */ V("div", {
142
+ onContextMenu: (e) => K(e, Q()),
142
143
  className: "group flex items-center gap-2 px-1 text-xs text-muted-foreground",
143
144
  children: [
144
- /* @__PURE__ */ z(se, {
145
+ /* @__PURE__ */ B(ce, {
145
146
  kind: "agent",
146
147
  name: s.agentName,
147
148
  size: "xs",
148
149
  decorative: !0
149
150
  }),
150
- /* @__PURE__ */ z("span", { children: c.rich("accepted", {
151
+ /* @__PURE__ */ B("span", { children: c.rich("accepted", {
151
152
  agent: s.agentName,
152
153
  when: g.relative(s.updatedAt),
153
- name: (e) => /* @__PURE__ */ z("span", {
154
+ name: (e) => /* @__PURE__ */ B("span", {
154
155
  className: "font-medium text-foreground",
155
156
  children: e
156
157
  })
157
158
  }) }),
158
- /* @__PURE__ */ z(ge, {
159
+ /* @__PURE__ */ B(ge, {
159
160
  items: Q,
160
161
  label: d("moreActionsFor", { name: s.agentName }),
161
162
  className: "ml-auto"
162
163
  })
163
164
  ]
164
- }) : /* @__PURE__ */ B(ce, {
165
+ }) : /* @__PURE__ */ V(le, {
165
166
  size: "fill",
166
167
  padding: "none",
167
- tone: U ? _e : void 0,
168
+ tone: W ? _e : void 0,
168
169
  interactive: !1,
169
170
  className: "text-sm",
170
- render: /* @__PURE__ */ z("section", {
171
+ render: /* @__PURE__ */ B("section", {
171
172
  "aria-label": c("runLabel", {
172
173
  agent: s.agentName,
173
174
  state: y(s.state)
174
175
  }),
175
176
  onContextMenu: (e) => {
176
- e.target.closest(".ProseMirror[contenteditable=\"true\"]") || G(e, Q());
177
+ e.target.closest(".ProseMirror[contenteditable=\"true\"]") || K(e, Q());
177
178
  }
178
179
  }),
179
180
  children: [
180
- /* @__PURE__ */ B("header", {
181
+ /* @__PURE__ */ V("header", {
181
182
  className: "flex items-center gap-2 px-3 pt-2.5",
182
183
  children: [
183
- /* @__PURE__ */ z(se, {
184
+ /* @__PURE__ */ B(ce, {
184
185
  kind: "agent",
185
186
  name: s.agentName,
186
187
  size: "xs",
187
188
  decorative: !0
188
189
  }),
189
- /* @__PURE__ */ z("span", {
190
+ /* @__PURE__ */ B("span", {
190
191
  className: "font-medium",
191
192
  children: s.agentName
192
193
  }),
193
- /* @__PURE__ */ z("span", {
194
+ /* @__PURE__ */ B("span", {
194
195
  className: "truncate text-muted-foreground",
195
196
  children: c("assignedBy", { name: x("user", s.assignedBy) })
196
197
  }),
197
- /* @__PURE__ */ B("span", {
198
- className: W("ml-auto inline-flex shrink-0 items-center gap-1.5 text-xs font-medium", U || $ ? "text-agent" : "text-muted-foreground"),
198
+ /* @__PURE__ */ V("span", {
199
+ className: G("ml-auto inline-flex shrink-0 items-center gap-1.5 text-xs font-medium", W || $ ? "text-agent" : "text-muted-foreground"),
199
200
  children: [
200
- $ && /* @__PURE__ */ B("span", {
201
+ $ && /* @__PURE__ */ V("span", {
201
202
  className: "relative flex size-1.5",
202
203
  "aria-hidden": "true",
203
- children: [s.state === "working" && /* @__PURE__ */ z("span", { className: "absolute inline-flex size-full animate-ping rounded-full bg-agent opacity-60 motion-reduce:hidden" }), /* @__PURE__ */ z("span", { className: "relative inline-flex size-1.5 rounded-full bg-agent" })]
204
+ children: [s.state === "working" && /* @__PURE__ */ B("span", { className: "absolute inline-flex size-full animate-ping rounded-full bg-agent opacity-60 motion-reduce:hidden" }), /* @__PURE__ */ B("span", { className: "relative inline-flex size-1.5 rounded-full bg-agent" })]
204
205
  }),
205
206
  y(s.state),
206
- s.state === "working" && s.runnerName && /* @__PURE__ */ z("span", {
207
- className: "font-normal text-muted-foreground",
208
- children: c("onRunner", { runner: s.runnerName })
207
+ s.state === "working" && s.runnerName ? /* @__PURE__ */ B("span", {
208
+ className: "inline-flex items-center gap-1 font-normal text-muted-foreground",
209
+ children: c.rich("onRunner", { runner: () => /* @__PURE__ */ B(se, {
210
+ workspace: i,
211
+ name: s.runnerName ?? "",
212
+ kind: s.runnerKind
213
+ }) })
214
+ }) : s.state !== "queued" && s.lastRunnerName && /* @__PURE__ */ B("span", {
215
+ className: "inline-flex items-center gap-1 font-normal text-muted-foreground",
216
+ children: c.rich("ranOnRunner", { runner: () => /* @__PURE__ */ B(se, {
217
+ workspace: i,
218
+ name: s.lastRunnerName ?? "",
219
+ kind: s.runnerKind
220
+ }) })
209
221
  })
210
222
  ]
211
223
  }),
212
- Z && s.state === "working" && /* @__PURE__ */ z(E, {
224
+ Z && s.state === "working" && /* @__PURE__ */ B(E, {
213
225
  size: "sm",
214
226
  variant: "ghost",
215
227
  onClick: Z.onClick,
216
228
  className: "-my-1",
217
229
  children: Z.label
218
230
  }),
219
- /* @__PURE__ */ z(ge, {
231
+ /* @__PURE__ */ B(ge, {
220
232
  items: Q,
221
233
  label: d("moreActionsFor", { name: s.agentName }),
222
234
  visible: !0,
@@ -224,138 +236,138 @@ function be({ workspace: i, identifier: a, run: s }) {
224
236
  })
225
237
  ]
226
238
  }),
227
- s.state === "queued" && K && !K.runnable ? /* @__PURE__ */ z("p", {
239
+ s.state === "queued" && q && !q.runnable ? /* @__PURE__ */ B("p", {
228
240
  className: "px-3 pt-1.5 text-pretty text-muted-foreground",
229
- children: c("noRunnerForHarness", { harness: u[K.harness] ?? K.harness })
230
- }) : s.state === "queued" && s.waiting && /* @__PURE__ */ z("p", {
241
+ children: c("noRunnerForHarness", { harness: u[q.harness] ?? q.harness })
242
+ }) : s.state === "queued" && s.waiting && /* @__PURE__ */ B("p", {
231
243
  className: "px-3 pt-1.5 text-pretty text-muted-foreground",
232
244
  children: c(`waiting.${s.waiting}`, { name: x("user", s.assignedBy) })
233
245
  }),
234
- s.permissionMode && s.permissionMode !== s.agentPermissionMode && /* @__PURE__ */ z("p", {
246
+ s.permissionMode && s.permissionMode !== s.agentPermissionMode && /* @__PURE__ */ B("p", {
235
247
  className: "px-3 pt-1.5 text-pretty text-muted-foreground",
236
248
  children: c("modeLowered", {
237
249
  got: p(s.permissionMode),
238
250
  asked: p(s.agentPermissionMode)
239
251
  })
240
252
  }),
241
- s.state === "stopped" && N && ye ? /* @__PURE__ */ z("p", {
253
+ s.state === "stopped" && P && ye ? /* @__PURE__ */ B("p", {
242
254
  className: "px-3 pt-1.5 text-pretty",
243
- children: c(`spent.${N}`, ye)
244
- }) : s.stopReason && s.state !== "working" && s.state !== "queued" && /* @__PURE__ */ z("p", {
255
+ children: c(`spent.${P}`, ye)
256
+ }) : s.stopReason && s.state !== "working" && s.state !== "queued" && /* @__PURE__ */ B("p", {
245
257
  className: "px-3 pt-1.5 text-pretty",
246
258
  children: s.stopReason
247
259
  }),
248
- U && s.verification && /* @__PURE__ */ B("p", {
260
+ W && s.verification && /* @__PURE__ */ V("p", {
249
261
  className: "flex flex-wrap items-center gap-x-3 px-3 pt-1.5 text-xs",
250
- children: [/* @__PURE__ */ z("span", {
251
- className: W(s.verification.checks === "passing" && "text-success", s.verification.checks === "failing" && "text-danger", (s.verification.checks === "pending" || s.verification.checks === "none") && "text-muted-foreground"),
262
+ children: [/* @__PURE__ */ B("span", {
263
+ className: G(s.verification.checks === "passing" && "text-success", s.verification.checks === "failing" && "text-danger", (s.verification.checks === "pending" || s.verification.checks === "none") && "text-muted-foreground"),
252
264
  children: c(`verifyChecks.${s.verification.checks}`)
253
- }), /* @__PURE__ */ z("span", {
265
+ }), /* @__PURE__ */ B("span", {
254
266
  className: s.verification.objections ? "text-warning" : "text-success",
255
267
  children: c(s.verification.objections ? "verifyObjections" : "verifyNoObjections")
256
268
  })]
257
269
  }),
258
- q && /* @__PURE__ */ B("p", {
270
+ J && /* @__PURE__ */ V("p", {
259
271
  className: "flex flex-wrap items-center gap-x-2 px-3 pt-1.5",
260
272
  children: [
261
- /* @__PURE__ */ z(oe, { className: "size-3.5 text-muted-foreground" }),
262
- /* @__PURE__ */ z(re, {
263
- provider: q.provider,
273
+ /* @__PURE__ */ B(oe, { className: "size-3.5 text-muted-foreground" }),
274
+ /* @__PURE__ */ B(re, {
275
+ provider: J.provider,
264
276
  className: "size-3.5 text-muted-foreground"
265
277
  }),
266
- /* @__PURE__ */ z("a", {
267
- href: m(q.url),
278
+ /* @__PURE__ */ B("a", {
279
+ href: m(J.url),
268
280
  target: "_blank",
269
281
  rel: "noopener noreferrer",
270
282
  className: "hover:underline",
271
- children: J("pullRequestRef", {
272
- repository: q.repository,
273
- number: ne(q)
283
+ children: Y("pullRequestRef", {
284
+ repository: J.repository,
285
+ number: ne(J)
274
286
  })
275
287
  }),
276
- /* @__PURE__ */ z("span", {
288
+ /* @__PURE__ */ B("span", {
277
289
  className: "text-xs text-muted-foreground",
278
- children: J(`state.${q.state === "open" && q.draft ? "draft" : q.state}`)
290
+ children: Y(`state.${J.state === "open" && J.draft ? "draft" : J.state}`)
279
291
  })
280
292
  ]
281
293
  }),
282
- /* @__PURE__ */ z(we, {
294
+ /* @__PURE__ */ B(we, {
283
295
  workspace: i,
284
296
  run: s
285
297
  }),
286
- P && /* @__PURE__ */ z(Ce, {
298
+ F && /* @__PURE__ */ B(Ce, {
287
299
  run: s,
288
- busy: M,
289
- onCancel: () => I(!1),
300
+ busy: N,
301
+ onCancel: () => L(!1),
290
302
  onSubmit: (e) => D.mutate({
291
303
  state: "queued",
292
304
  budget: e
293
- }, { onSuccess: () => I(!1) })
305
+ }, { onSuccess: () => L(!1) })
294
306
  }),
295
- O && /* @__PURE__ */ z("div", {
307
+ O && /* @__PURE__ */ B("div", {
296
308
  className: "mx-3 mt-2.5 rounded-md border border-border px-2.5 py-1.5 focus-within:border-primary/60",
297
- children: /* @__PURE__ */ z(w, {
309
+ children: /* @__PURE__ */ B(w, {
298
310
  value: "",
299
- onChange: ue,
300
- onSubmit: () => A.trim() && j.mutate(),
311
+ onChange: j,
312
+ onSubmit: () => A.trim() && M.mutate(),
301
313
  placeholder: c("changesPlaceholder"),
302
314
  label: c("changesLabel"),
303
315
  className: "min-h-12",
304
316
  autofocus: !0
305
317
  })
306
318
  }),
307
- /* @__PURE__ */ B("footer", {
319
+ /* @__PURE__ */ V("footer", {
308
320
  className: "flex flex-wrap items-center gap-2 px-3 pt-2.5 pb-2.5",
309
321
  children: [
310
- U && !O && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(E, {
322
+ W && !O && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(E, {
311
323
  variant: "primary",
312
324
  size: "sm",
313
325
  type: "button",
314
- disabled: M,
326
+ disabled: N,
315
327
  onClick: () => D.mutate({ state: "closed" }),
316
328
  children: c("accept")
317
- }), /* @__PURE__ */ z(E, {
329
+ }), /* @__PURE__ */ B(E, {
318
330
  size: "sm",
319
331
  type: "button",
320
- disabled: M,
332
+ disabled: N,
321
333
  onClick: () => k(!0),
322
334
  children: c("requestChanges")
323
335
  })] }),
324
- O && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(E, {
336
+ O && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(E, {
325
337
  variant: "primary",
326
338
  size: "sm",
327
339
  type: "button",
328
- disabled: M || !A.trim(),
329
- onClick: () => j.mutate(),
340
+ disabled: N || !A.trim(),
341
+ onClick: () => M.mutate(),
330
342
  children: c("sendBack")
331
- }), /* @__PURE__ */ z(E, {
343
+ }), /* @__PURE__ */ B(E, {
332
344
  size: "sm",
333
345
  type: "button",
334
- disabled: M,
346
+ disabled: N,
335
347
  onClick: () => k(!1),
336
348
  children: d("cancel")
337
349
  })] }),
338
- (s.state === "stopped" || s.state === "blocked_external") && !P && /* @__PURE__ */ z(E, {
350
+ (s.state === "stopped" || s.state === "blocked_external") && !F && /* @__PURE__ */ B(E, {
339
351
  size: "sm",
340
- disabled: M,
341
- onClick: () => H(),
352
+ disabled: N,
353
+ onClick: () => U(),
342
354
  children: c("resume")
343
355
  }),
344
- $ && /* @__PURE__ */ z(E, {
356
+ $ && /* @__PURE__ */ B(E, {
345
357
  size: "sm",
346
358
  type: "button",
347
- disabled: M,
359
+ disabled: N,
348
360
  onClick: () => D.mutate({ state: "stopped" }),
349
361
  children: c("stop")
350
362
  }),
351
- s.state !== "queued" && /* @__PURE__ */ z(E, {
363
+ s.state !== "queued" && /* @__PURE__ */ B(E, {
352
364
  size: "sm",
353
365
  type: "button",
354
366
  "aria-expanded": T,
355
367
  onClick: () => ie((e) => !e),
356
368
  children: c(T ? "activity.hide" : "activity.show")
357
369
  }),
358
- /* @__PURE__ */ z("span", {
370
+ /* @__PURE__ */ B("span", {
359
371
  className: "ml-auto text-xs text-muted-foreground tabular-nums",
360
372
  children: c("usage", {
361
373
  turns: s.turns,
@@ -367,13 +379,13 @@ function be({ workspace: i, identifier: a, run: s }) {
367
379
  when: g.relative(s.updatedAt)
368
380
  })
369
381
  }),
370
- (D.isError || j.isError) && /* @__PURE__ */ z(le, {
382
+ (D.isError || M.isError) && /* @__PURE__ */ B(ue, {
371
383
  className: "w-full",
372
- children: f(D.error ?? j.error)
384
+ children: f(D.error ?? M.error)
373
385
  })
374
386
  ]
375
387
  }),
376
- T && s.state !== "queued" && /* @__PURE__ */ z(xe, {
388
+ T && s.state !== "queued" && /* @__PURE__ */ B(xe, {
377
389
  workspace: i,
378
390
  run: s
379
391
  })
@@ -381,29 +393,29 @@ function be({ workspace: i, identifier: a, run: s }) {
381
393
  });
382
394
  }
383
395
  function xe({ workspace: e, run: t }) {
384
- let n = L("agentWork.activity"), r = S(), i = t.state === "working", { data: a, isPending: o, isError: c } = V(s(e, t.id, i)), l = P(null), u = P(!0), d = a?.length ?? 0;
385
- return N(() => {
396
+ let n = R("agentWork.activity"), r = S(), i = t.state === "working", { data: a, isPending: o, isError: c } = H(s(e, t.id, i)), l = F(null), u = F(!0), d = a?.length ?? 0;
397
+ return P(() => {
386
398
  let e = l.current;
387
399
  e && u.current && d > 0 && (e.scrollTop = e.scrollHeight);
388
- }, [d]), /* @__PURE__ */ B("div", {
400
+ }, [d]), /* @__PURE__ */ V("div", {
389
401
  className: "border-t border-border",
390
- children: [/* @__PURE__ */ B("p", {
402
+ children: [/* @__PURE__ */ V("p", {
391
403
  className: "flex items-center gap-2 px-3 pt-2 text-xs text-muted-foreground",
392
- children: [i && /* @__PURE__ */ B("span", {
404
+ children: [i && /* @__PURE__ */ V("span", {
393
405
  className: "inline-flex items-center gap-1.5 font-medium text-agent",
394
- children: [/* @__PURE__ */ B("span", {
406
+ children: [/* @__PURE__ */ V("span", {
395
407
  className: "relative flex size-1.5",
396
408
  "aria-hidden": "true",
397
- children: [/* @__PURE__ */ z("span", { className: "absolute inline-flex size-full animate-ping rounded-full bg-agent opacity-60 motion-reduce:hidden" }), /* @__PURE__ */ z("span", { className: "relative inline-flex size-1.5 rounded-full bg-agent" })]
409
+ children: [/* @__PURE__ */ B("span", { className: "absolute inline-flex size-full animate-ping rounded-full bg-agent opacity-60 motion-reduce:hidden" }), /* @__PURE__ */ B("span", { className: "relative inline-flex size-1.5 rounded-full bg-agent" })]
398
410
  }), n("live")]
399
411
  }), n("count", { count: d })]
400
- }), c ? /* @__PURE__ */ z(le, {
412
+ }), c ? /* @__PURE__ */ B(ue, {
401
413
  className: "px-3 py-2",
402
414
  children: n("failedToLoad")
403
- }) : !o && d === 0 ? /* @__PURE__ */ z("p", {
415
+ }) : !o && d === 0 ? /* @__PURE__ */ B("p", {
404
416
  className: "px-3 py-2 text-xs text-muted-foreground",
405
417
  children: n(i ? "emptyLive" : "empty")
406
- }) : /* @__PURE__ */ z("ol", {
418
+ }) : /* @__PURE__ */ B("ol", {
407
419
  ref: l,
408
420
  "aria-live": i ? "polite" : "off",
409
421
  "aria-label": n("label"),
@@ -412,53 +424,53 @@ function xe({ workspace: e, run: t }) {
412
424
  u.current = t.scrollHeight - t.scrollTop - t.clientHeight < 24;
413
425
  },
414
426
  className: "mx-3 mt-1.5 mb-2.5 max-h-96 space-y-1 overflow-y-auto rounded-md border border-border bg-muted/40 p-2 font-mono text-[11.5px] leading-relaxed",
415
- children: a?.map((e) => /* @__PURE__ */ z(U, {
427
+ children: a?.map((e) => /* @__PURE__ */ B(W, {
416
428
  entry: e,
417
429
  at: r.clock(e.at)
418
430
  }, e.seq))
419
431
  })]
420
432
  });
421
433
  }
422
- function U({ entry: e, at: t }) {
423
- let n = L("agentWork.activity"), r = /* @__PURE__ */ z("span", {
434
+ function W({ entry: e, at: t }) {
435
+ let n = R("agentWork.activity"), r = /* @__PURE__ */ B("span", {
424
436
  className: "shrink-0 text-muted-foreground/70 tabular-nums",
425
437
  children: t
426
438
  });
427
439
  if (e.kind === "output" || e.kind === "failed") {
428
440
  let t = e.kind === "failed", i = e.text.split("\n", 1)[0] ?? "";
429
- return e.tool ? /* @__PURE__ */ B("li", {
441
+ return e.tool ? /* @__PURE__ */ V("li", {
430
442
  className: "flex gap-2",
431
- children: [r, /* @__PURE__ */ z(O, {
443
+ children: [r, /* @__PURE__ */ B(O, {
432
444
  className: "min-w-0 flex-1",
433
445
  summaryClassName: t ? "text-danger" : "text-muted-foreground",
434
- summary: /* @__PURE__ */ B("span", {
446
+ summary: /* @__PURE__ */ V("span", {
435
447
  className: "truncate",
436
- children: [n(t ? "toolFailed" : "toolOutput", { tool: e.tool }), i && /* @__PURE__ */ z("span", {
448
+ children: [n(t ? "toolFailed" : "toolOutput", { tool: e.tool }), i && /* @__PURE__ */ B("span", {
437
449
  className: "ml-1.5 opacity-80",
438
450
  children: i
439
451
  })]
440
452
  }),
441
- children: /* @__PURE__ */ z("pre", {
453
+ children: /* @__PURE__ */ B("pre", {
442
454
  className: "mt-1 max-h-60 overflow-auto rounded bg-card p-1.5 whitespace-pre-wrap break-words",
443
455
  children: e.text
444
456
  })
445
457
  })]
446
- }) : /* @__PURE__ */ B("li", {
458
+ }) : /* @__PURE__ */ V("li", {
447
459
  className: "flex gap-2",
448
- children: [r, /* @__PURE__ */ z("span", {
449
- className: W("min-w-0 whitespace-pre-wrap break-words", t && "text-danger"),
460
+ children: [r, /* @__PURE__ */ B("span", {
461
+ className: G("min-w-0 whitespace-pre-wrap break-words", t && "text-danger"),
450
462
  children: e.text
451
463
  })]
452
464
  });
453
465
  }
454
- return /* @__PURE__ */ B("li", {
466
+ return /* @__PURE__ */ V("li", {
455
467
  className: "flex gap-2",
456
- children: [r, /* @__PURE__ */ z("span", {
457
- className: W("min-w-0 whitespace-pre-wrap break-words", e.kind === "thinking" && "text-muted-foreground italic", e.kind === "status" && "text-muted-foreground", e.kind === "tool" && "text-foreground"),
458
- children: e.kind === "tool" ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("span", {
468
+ children: [r, /* @__PURE__ */ B("span", {
469
+ className: G("min-w-0 whitespace-pre-wrap break-words", e.kind === "thinking" && "text-muted-foreground italic", e.kind === "status" && "text-muted-foreground", e.kind === "tool" && "text-foreground"),
470
+ children: e.kind === "tool" ? /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("span", {
459
471
  className: "font-semibold text-agent",
460
472
  children: e.tool
461
- }), e.text && /* @__PURE__ */ z("span", {
473
+ }), e.text && /* @__PURE__ */ B("span", {
462
474
  className: "ml-1.5 text-muted-foreground",
463
475
  children: e.text
464
476
  })] }) : e.text
@@ -469,8 +481,8 @@ function Se(e) {
469
481
  return e.turns >= e.budget.maxTurns ? "turns" : e.seconds >= e.budget.maxMinutes * 60 ? "minutes" : e.costMicros >= e.budget.maxCostMicros ? "cost" : null;
470
482
  }
471
483
  function Ce({ run: e, busy: t, onSubmit: n, onCancel: r }) {
472
- let i = L("agentWork"), a = L("common"), o = Math.ceil(e.seconds / 60), [s, c] = F(Math.max(e.budget.maxTurns * 2, e.turns + 1)), [l, u] = F(Math.max(e.budget.maxMinutes * 2, o + 1)), [d, f] = F(Math.max(e.budget.maxCostMicros * 2, e.costMicros + 1e6) / 1e6);
473
- return /* @__PURE__ */ B("form", {
484
+ let i = R("agentWork"), a = R("common"), o = Math.ceil(e.seconds / 60), [s, c] = I(Math.max(e.budget.maxTurns * 2, e.turns + 1)), [l, u] = I(Math.max(e.budget.maxMinutes * 2, o + 1)), [d, f] = I(Math.max(e.budget.maxCostMicros * 2, e.costMicros + 1e6) / 1e6);
485
+ return /* @__PURE__ */ V("form", {
474
486
  className: "mx-3 mt-2.5 space-y-2 rounded-md border border-border px-2.5 py-2",
475
487
  onSubmit: (e) => {
476
488
  e.preventDefault(), n({
@@ -480,16 +492,16 @@ function Ce({ run: e, busy: t, onSubmit: n, onCancel: r }) {
480
492
  });
481
493
  },
482
494
  children: [
483
- /* @__PURE__ */ z("p", {
495
+ /* @__PURE__ */ B("p", {
484
496
  className: "text-sm font-medium",
485
497
  children: i("raiseBudget")
486
498
  }),
487
- /* @__PURE__ */ B("div", {
499
+ /* @__PURE__ */ V("div", {
488
500
  className: "flex flex-wrap gap-3 text-xs text-muted-foreground",
489
501
  children: [
490
- /* @__PURE__ */ B("label", {
502
+ /* @__PURE__ */ V("label", {
491
503
  className: "flex flex-col gap-1",
492
- children: [i("maxTurns"), /* @__PURE__ */ z(k, {
504
+ children: [i("maxTurns"), /* @__PURE__ */ B(k, {
493
505
  required: !0,
494
506
  min: e.turns + 1,
495
507
  value: s,
@@ -498,9 +510,9 @@ function Ce({ run: e, busy: t, onSubmit: n, onCancel: r }) {
498
510
  className: "w-28"
499
511
  })]
500
512
  }),
501
- /* @__PURE__ */ B("label", {
513
+ /* @__PURE__ */ V("label", {
502
514
  className: "flex flex-col gap-1",
503
- children: [i("maxMinutes"), /* @__PURE__ */ z(k, {
515
+ children: [i("maxMinutes"), /* @__PURE__ */ B(k, {
504
516
  required: !0,
505
517
  min: o + 1,
506
518
  value: l,
@@ -509,9 +521,9 @@ function Ce({ run: e, busy: t, onSubmit: n, onCancel: r }) {
509
521
  className: "w-28"
510
522
  })]
511
523
  }),
512
- /* @__PURE__ */ B("label", {
524
+ /* @__PURE__ */ V("label", {
513
525
  className: "flex flex-col gap-1",
514
- children: [i("maxCost"), /* @__PURE__ */ z(k, {
526
+ children: [i("maxCost"), /* @__PURE__ */ B(k, {
515
527
  required: !0,
516
528
  step: .01,
517
529
  min: (e.costMicros + 1e4) / 1e6,
@@ -527,15 +539,15 @@ function Ce({ run: e, busy: t, onSubmit: n, onCancel: r }) {
527
539
  })
528
540
  ]
529
541
  }),
530
- /* @__PURE__ */ B("div", {
542
+ /* @__PURE__ */ V("div", {
531
543
  className: "flex gap-2",
532
- children: [/* @__PURE__ */ z(E, {
544
+ children: [/* @__PURE__ */ B(E, {
533
545
  variant: "primary",
534
546
  size: "sm",
535
547
  type: "submit",
536
548
  disabled: t,
537
549
  children: i("resume")
538
- }), /* @__PURE__ */ z(E, {
550
+ }), /* @__PURE__ */ B(E, {
539
551
  size: "sm",
540
552
  disabled: t,
541
553
  onClick: r,
@@ -545,62 +557,62 @@ function Ce({ run: e, busy: t, onSubmit: n, onCancel: r }) {
545
557
  ]
546
558
  });
547
559
  }
548
- var W = (...e) => e.filter(Boolean).join(" ");
560
+ var G = (...e) => e.filter(Boolean).join(" ");
549
561
  function we({ workspace: e, run: t }) {
550
- let n = g(e), r = L("agentWork"), [i, a] = F(!1), { data: o } = V({
562
+ let n = g(e), r = R("agentWork"), [i, a] = I(!1), { data: o } = H({
551
563
  ...c(e, t.id),
552
564
  enabled: i
553
565
  });
554
- return /* @__PURE__ */ z(O, {
566
+ return /* @__PURE__ */ B(O, {
555
567
  className: "px-3 pt-1.5 text-xs",
556
568
  summaryClassName: "text-muted-foreground hover:text-foreground",
557
569
  summary: r("reads"),
558
570
  open: i,
559
571
  onOpenChange: a,
560
- children: o && (o.docs.length + o.entries.length === 0 ? /* @__PURE__ */ z("p", {
572
+ children: o && (o.docs.length + o.entries.length === 0 ? /* @__PURE__ */ B("p", {
561
573
  className: "mt-1 text-muted-foreground",
562
574
  children: r("readNothing")
563
- }) : /* @__PURE__ */ B("ul", {
575
+ }) : /* @__PURE__ */ V("ul", {
564
576
  className: "mt-1 flex flex-wrap gap-x-3 gap-y-1",
565
- children: [o.docs.map((t) => /* @__PURE__ */ z("li", { children: /* @__PURE__ */ B(x, {
577
+ children: [o.docs.map((t) => /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V(x, {
566
578
  to: "/$workspace/docs/$doc",
567
579
  params: {
568
580
  workspace: e,
569
581
  doc: p(t)
570
582
  },
571
583
  className: "inline-flex items-center gap-1 hover:underline",
572
- children: [/* @__PURE__ */ z(ie, { className: "size-3.5 text-muted-foreground" }), t.title]
573
- }) }, t.id)), o.entries.map((t) => /* @__PURE__ */ z("li", { children: /* @__PURE__ */ B(x, {
584
+ children: [/* @__PURE__ */ B(ie, { className: "size-3.5 text-muted-foreground" }), t.title]
585
+ }) }, t.id)), o.entries.map((t) => /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V(x, {
574
586
  to: "/$workspace/knowledge/$term",
575
587
  params: {
576
588
  workspace: e,
577
589
  term: n(t.id)
578
590
  },
579
591
  className: "inline-flex items-center gap-1 hover:underline",
580
- children: [/* @__PURE__ */ z(ae, { className: "size-3.5 text-muted-foreground" }), t.name]
592
+ children: [/* @__PURE__ */ B(ae, { className: "size-3.5 text-muted-foreground" }), t.name]
581
593
  }) }, t.id))]
582
594
  }))
583
595
  });
584
596
  }
585
- function G() {
586
- let e = L("agentWork");
597
+ function K() {
598
+ let e = R("agentWork");
587
599
  return (t, n) => t.merge ? e(n.id === "merge" ? "mergeApprove" : "mergeWait") : t.release ? e(n.id === "release" ? "releaseApprove" : "releaseWait") : t.breakdown?.length ? e(n.id === "approve" ? "breakdownApprove" : "breakdownRevise") : n.label;
588
600
  }
589
601
  function Te({ decision: e, className: t }) {
590
- let n = L("agentWork"), r = e.merge, i = e.release;
591
- return i ? /* @__PURE__ */ B("p", {
592
- className: W("text-sm", t),
602
+ let n = R("agentWork"), r = e.merge, i = e.release;
603
+ return i ? /* @__PURE__ */ V("p", {
604
+ className: G("text-sm", t),
593
605
  children: [n.rich("releasePrompt", {
594
606
  repository: i.repository,
595
607
  sha: i.sha.slice(0, 7),
596
608
  targets: i.targets.join(", "),
597
- code: (e) => /* @__PURE__ */ z("code", {
609
+ code: (e) => /* @__PURE__ */ B("code", {
598
610
  className: "rounded bg-muted px-1 font-mono text-xs",
599
611
  children: e
600
612
  })
601
- }), i.deploymentId && /* @__PURE__ */ z("span", {
613
+ }), i.deploymentId && /* @__PURE__ */ B("span", {
602
614
  className: "mt-1 block text-xs text-muted-foreground",
603
- children: i.deploymentUrl ? /* @__PURE__ */ z("a", {
615
+ children: i.deploymentUrl ? /* @__PURE__ */ B("a", {
604
616
  href: m(i.deploymentUrl),
605
617
  target: "_blank",
606
618
  rel: "noopener noreferrer",
@@ -608,11 +620,11 @@ function Te({ decision: e, className: t }) {
608
620
  children: n("deployment", { id: i.deploymentId })
609
621
  }) : n("deployment", { id: i.deploymentId })
610
622
  })]
611
- }) : r ? /* @__PURE__ */ z("p", {
612
- className: W("text-sm", t),
623
+ }) : r ? /* @__PURE__ */ B("p", {
624
+ className: G("text-sm", t),
613
625
  children: n.rich("mergePrompt", {
614
626
  sha: r.sha.slice(0, 7),
615
- pr: () => /* @__PURE__ */ B("a", {
627
+ pr: () => /* @__PURE__ */ V("a", {
616
628
  href: m(r.url),
617
629
  target: "_blank",
618
630
  rel: "noopener noreferrer",
@@ -623,27 +635,27 @@ function Te({ decision: e, className: t }) {
623
635
  r.number
624
636
  ]
625
637
  }),
626
- code: (e) => /* @__PURE__ */ z("code", {
638
+ code: (e) => /* @__PURE__ */ B("code", {
627
639
  className: "rounded bg-muted px-1 font-mono text-xs",
628
640
  children: e
629
641
  })
630
642
  })
631
- }) : /* @__PURE__ */ z(w, {
643
+ }) : /* @__PURE__ */ B(w, {
632
644
  value: e.prompt,
633
645
  editable: !1,
634
646
  ...t && { className: t }
635
647
  });
636
648
  }
637
649
  function Ee({ workspace: e, decision: t }) {
638
- let n = L("agentWork");
639
- return t.subIssues.length > 0 ? /* @__PURE__ */ B("div", {
650
+ let n = R("agentWork");
651
+ return t.subIssues.length > 0 ? /* @__PURE__ */ V("div", {
640
652
  className: "mt-2 text-sm",
641
- children: [/* @__PURE__ */ z("p", {
653
+ children: [/* @__PURE__ */ B("p", {
642
654
  className: "text-xs text-muted-foreground",
643
655
  children: n("subIssuesCreated")
644
- }), /* @__PURE__ */ z("ul", {
656
+ }), /* @__PURE__ */ B("ul", {
645
657
  className: "mt-1 space-y-0.5",
646
- children: t.subIssues.map((t) => /* @__PURE__ */ z("li", { children: /* @__PURE__ */ B(x, {
658
+ children: t.subIssues.map((t) => /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V(x, {
647
659
  to: "/$workspace/issues/$identifier",
648
660
  params: {
649
661
  workspace: e,
@@ -651,7 +663,7 @@ function Ee({ workspace: e, decision: t }) {
651
663
  },
652
664
  className: "hover:underline",
653
665
  children: [
654
- /* @__PURE__ */ z("span", {
666
+ /* @__PURE__ */ B("span", {
655
667
  className: "text-muted-foreground",
656
668
  children: t.identifier
657
669
  }),
@@ -660,19 +672,19 @@ function Ee({ workspace: e, decision: t }) {
660
672
  ]
661
673
  }) }, t.id))
662
674
  })]
663
- }) : t.breakdown?.length ? /* @__PURE__ */ z("ol", {
675
+ }) : t.breakdown?.length ? /* @__PURE__ */ B("ol", {
664
676
  className: "mt-2 divide-y divide-border rounded-md border border-border text-sm",
665
- children: t.breakdown.map((e, t) => /* @__PURE__ */ B("li", {
677
+ children: t.breakdown.map((e, t) => /* @__PURE__ */ V("li", {
666
678
  className: "flex gap-2 px-3 py-2",
667
- children: [/* @__PURE__ */ z("span", {
679
+ children: [/* @__PURE__ */ B("span", {
668
680
  className: "w-4 shrink-0 text-right text-xs text-muted-foreground tabular-nums",
669
681
  children: t + 1
670
- }), /* @__PURE__ */ B("span", {
682
+ }), /* @__PURE__ */ V("span", {
671
683
  className: "min-w-0",
672
- children: [/* @__PURE__ */ z("span", {
684
+ children: [/* @__PURE__ */ B("span", {
673
685
  className: "font-medium",
674
686
  children: e.title
675
- }), e.body && /* @__PURE__ */ z("span", {
687
+ }), e.body && /* @__PURE__ */ B("span", {
676
688
  className: "mt-0.5 block text-xs text-muted-foreground",
677
689
  children: e.body
678
690
  })]
@@ -680,22 +692,22 @@ function Ee({ workspace: e, decision: t }) {
680
692
  }, t))
681
693
  }) : null;
682
694
  }
683
- function K({ workspace: e, decision: t, onAnswer: n, busy: r }) {
684
- let a = L("agentPage"), o = G(), { data: s = [] } = V(i(e, t.identifier)), [c, l] = F(null), u = M((e) => {
695
+ function q({ workspace: e, decision: t, onAnswer: n, busy: r }) {
696
+ let a = R("agentPage"), o = K(), { data: s = [] } = H(i(e, t.identifier)), [c, l] = I(null), u = N((e) => {
685
697
  t.options.some((t) => t.id === e) && l(e);
686
698
  }, [t.options]), d = s.find((e) => e.id === t.pageId), f = t.options.find((e) => e.id === c);
687
- return /* @__PURE__ */ B("div", {
699
+ return /* @__PURE__ */ V("div", {
688
700
  className: "mt-3 space-y-2",
689
- children: [/* @__PURE__ */ z(C, {
701
+ children: [/* @__PURE__ */ B(C, {
690
702
  attachmentId: t.pageId ?? "",
691
703
  name: d?.name ?? "",
692
704
  agent: t.agentName,
693
705
  onChoose: u
694
- }), f && /* @__PURE__ */ B("div", {
706
+ }), f && /* @__PURE__ */ V("div", {
695
707
  className: "flex flex-wrap items-center gap-2 rounded-md border border-agent/50 bg-agent-soft/40 px-3 py-2 text-sm",
696
708
  children: [
697
- /* @__PURE__ */ z("span", { children: a("chose", { option: o(t, f) }) }),
698
- /* @__PURE__ */ z(E, {
709
+ /* @__PURE__ */ B("span", { children: a("chose", { option: o(t, f) }) }),
710
+ /* @__PURE__ */ B(E, {
699
711
  variant: "primary",
700
712
  size: "sm",
701
713
  disabled: r,
@@ -703,7 +715,7 @@ function K({ workspace: e, decision: t, onAnswer: n, busy: r }) {
703
715
  className: "ml-auto",
704
716
  children: a("answerWith")
705
717
  }),
706
- /* @__PURE__ */ z(E, {
718
+ /* @__PURE__ */ B(E, {
707
719
  size: "sm",
708
720
  onClick: () => l(null),
709
721
  children: a("dismiss")
@@ -713,7 +725,7 @@ function K({ workspace: e, decision: t, onAnswer: n, busy: r }) {
713
725
  });
714
726
  }
715
727
  function De(e) {
716
- let t = L("agentWork"), n = G(), r = y(), { workspace: i } = j({ strict: !1 });
728
+ let t = R("agentWork"), n = K(), r = y(), { workspace: i } = M({ strict: !1 });
717
729
  if (i !== e.workspace) return [];
718
730
  let a = e.options.find((t) => t.id === e.answer?.optionId), o = [a && n(e, a), e.answer?.text].filter(Boolean).join(". "), s = e.prompt.split("\n").map((e) => `> ${e}`).join("\n");
719
731
  return [{
@@ -726,23 +738,23 @@ function De(e) {
726
738
  })
727
739
  }];
728
740
  }
729
- function q(e) {
741
+ function J(e) {
730
742
  return e.merge || e.release || !e.options.some((e) => e.id === "allow") ? null : d(e.prompt);
731
743
  }
732
- var J = (e) => ({
744
+ var Y = (e) => ({
733
745
  allow: 0,
734
746
  "allow-run": 1,
735
747
  deny: 2
736
748
  })[e] ?? 1;
737
- function Y() {
738
- let e = L("agentWork");
739
- return /* @__PURE__ */ z("span", {
749
+ function Oe() {
750
+ let e = R("agentWork");
751
+ return /* @__PURE__ */ B("span", {
740
752
  className: "rounded bg-agent-soft px-1.5 text-[10px] font-medium text-agent",
741
753
  children: e("suggested")
742
754
  });
743
755
  }
744
756
  function X({ workspace: n, decision: r, showIssue: i = !1 }) {
745
- let a = pe(), o = L("agentWork"), s = G(), c = v(), l = he(), u = L("common"), [d, p] = F(""), [m, h] = F(0), [g, _] = F(!1), y = q(r), b = !y && r.options.some((e) => e.description), ee = y ? [...r.options].sort((e, t) => J(e.id) - J(t.id)) : r.options, x = me({
757
+ let a = pe(), o = R("agentWork"), s = K(), c = v(), l = he(), u = R("common"), [d, p] = I(""), [m, h] = I(0), [g, _] = I(!1), y = J(r), b = !y && r.options.some((e) => e.description), ee = y ? [...r.options].sort((e, t) => Y(e.id) - Y(t.id)) : r.options, x = me({
746
758
  mutationFn: async (i) => t(await e.POST("/api/v1/workspaces/{workspace}/decisions/{decisionId}/answer", {
747
759
  params: { path: {
748
760
  workspace: n,
@@ -786,126 +798,126 @@ function X({ workspace: n, decision: r, showIssue: i = !1 }) {
786
798
  ...ne,
787
799
  ...c(f(n, r.identifier))
788
800
  ];
789
- return /* @__PURE__ */ B(ce, {
801
+ return /* @__PURE__ */ V(le, {
790
802
  size: "fill",
791
803
  padding: "none",
792
804
  tone: _e,
793
805
  interactive: !1,
794
- render: /* @__PURE__ */ z("article", {
806
+ render: /* @__PURE__ */ B("article", {
795
807
  onContextMenu: (e) => {
796
808
  e.target.closest(".ProseMirror[contenteditable=\"true\"]") || S(e, T());
797
809
  },
798
810
  "aria-label": o("asking", { agent: r.agentName })
799
811
  }),
800
- children: [/* @__PURE__ */ B("header", {
812
+ children: [/* @__PURE__ */ V("header", {
801
813
  className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs",
802
814
  children: [
803
- /* @__PURE__ */ z(se, {
815
+ /* @__PURE__ */ B(ce, {
804
816
  kind: "agent",
805
817
  name: r.agentName,
806
818
  size: "xs",
807
819
  decorative: !0
808
820
  }),
809
- /* @__PURE__ */ z("span", {
821
+ /* @__PURE__ */ B("span", {
810
822
  className: "font-medium",
811
823
  children: r.agentName
812
824
  }),
813
- /* @__PURE__ */ z("span", {
825
+ /* @__PURE__ */ B("span", {
814
826
  className: `shrink-0 text-muted-foreground ${i ? "max-sm:hidden" : ""}`,
815
827
  children: o("needsDecision")
816
828
  }),
817
- i && /* @__PURE__ */ z("span", {
829
+ i && /* @__PURE__ */ B("span", {
818
830
  className: "min-w-0 truncate text-muted-foreground",
819
831
  children: o("onIssue", {
820
832
  identifier: r.identifier,
821
833
  title: r.issueTitle
822
834
  })
823
835
  }),
824
- /* @__PURE__ */ z(A, {
836
+ /* @__PURE__ */ B(A, {
825
837
  value: r.createdAt,
826
838
  exact: "medium",
827
839
  className: "ml-auto shrink-0 whitespace-nowrap text-muted-foreground"
828
840
  })
829
841
  ]
830
- }), /* @__PURE__ */ B("div", {
842
+ }), /* @__PURE__ */ V("div", {
831
843
  className: "px-3 py-2.5",
832
844
  children: [
833
- y ? /* @__PURE__ */ B("div", { children: [
834
- /* @__PURE__ */ z("p", {
845
+ y ? /* @__PURE__ */ V("div", { children: [
846
+ /* @__PURE__ */ B("p", {
835
847
  className: "text-sm font-medium",
836
848
  children: y.agent ? o("approveCommandFor", { agent: y.agent }) : o("approveCommand")
837
849
  }),
838
- /* @__PURE__ */ z(D, {
850
+ /* @__PURE__ */ B(D, {
839
851
  text: y.command,
840
852
  label: o("command"),
841
853
  wrap: !0,
842
854
  className: "mt-2 [&_pre]:px-3 [&_pre]:py-2 [&_pre]:pr-10 [&_pre]:text-xs [&_pre]:leading-5"
843
855
  }),
844
- y.reason && /* @__PURE__ */ z("p", {
856
+ y.reason && /* @__PURE__ */ B("p", {
845
857
  className: "mt-1.5 text-xs text-muted-foreground",
846
858
  children: y.reason
847
859
  })
848
- ] }) : /* @__PURE__ */ z("div", {
860
+ ] }) : /* @__PURE__ */ B("div", {
849
861
  className: "[&_.ProseMirror>:first-child]:mt-0",
850
- children: /* @__PURE__ */ z(Te, { decision: r })
862
+ children: /* @__PURE__ */ B(Te, { decision: r })
851
863
  }),
852
- /* @__PURE__ */ z(Z, {
864
+ /* @__PURE__ */ B(Z, {
853
865
  workspace: n,
854
866
  decision: r
855
867
  }),
856
- r.pageId && /* @__PURE__ */ z(K, {
868
+ r.pageId && /* @__PURE__ */ B(q, {
857
869
  workspace: n,
858
870
  decision: r,
859
871
  onAnswer: (e) => x.mutate(e),
860
872
  busy: x.isPending
861
873
  }),
862
- /* @__PURE__ */ z(Ee, {
874
+ /* @__PURE__ */ B(Ee, {
863
875
  workspace: n,
864
876
  decision: r
865
877
  }),
866
- r.options.length > 0 && (b ? /* @__PURE__ */ z("div", {
878
+ r.options.length > 0 && (b ? /* @__PURE__ */ B("div", {
867
879
  className: "mt-3 grid gap-1.5 sm:grid-cols-2",
868
880
  children: r.options.map((e) => {
869
881
  let t = e.id === r.recommendation;
870
- return /* @__PURE__ */ B("button", {
882
+ return /* @__PURE__ */ V("button", {
871
883
  type: "button",
872
884
  disabled: x.isPending,
873
885
  onClick: () => x.mutate(e.id),
874
886
  className: `rounded-md border px-3 py-2 text-left text-sm hover:bg-muted disabled:opacity-50 ${t ? "border-agent" : "border-border"}`,
875
- children: [/* @__PURE__ */ B("span", {
887
+ children: [/* @__PURE__ */ V("span", {
876
888
  className: "flex items-center gap-2 font-medium",
877
- children: [s(r, e), t && /* @__PURE__ */ z(Y, {})]
878
- }), e.description && /* @__PURE__ */ z("span", {
889
+ children: [s(r, e), t && /* @__PURE__ */ B(Oe, {})]
890
+ }), e.description && /* @__PURE__ */ B("span", {
879
891
  className: "mt-0.5 block text-xs text-muted-foreground",
880
892
  children: e.description
881
893
  })]
882
894
  }, e.id);
883
895
  })
884
- }) : /* @__PURE__ */ B("div", {
896
+ }) : /* @__PURE__ */ V("div", {
885
897
  className: "mt-3 flex flex-wrap items-center gap-2",
886
898
  children: [ee.map((e, t) => {
887
- let n = e.id === r.recommendation, i = /* @__PURE__ */ B(E, {
899
+ let n = e.id === r.recommendation, i = /* @__PURE__ */ V(E, {
888
900
  size: "sm",
889
901
  variant: y && t === 0 ? "primary" : "secondary",
890
902
  disabled: x.isPending,
891
903
  onClick: () => x.mutate(e.id),
892
904
  className: n && !(y && t === 0) ? "border-agent" : void 0,
893
- children: [s(r, e), n && /* @__PURE__ */ z(Y, {})]
905
+ children: [s(r, e), n && /* @__PURE__ */ B(Oe, {})]
894
906
  }, e.id);
895
- return e.description ? /* @__PURE__ */ z(ue, {
907
+ return e.description ? /* @__PURE__ */ B(j, {
896
908
  content: e.description,
897
909
  children: i
898
910
  }, e.id) : i;
899
- }), r.allowText && !g && /* @__PURE__ */ z("button", {
911
+ }), r.allowText && !g && /* @__PURE__ */ B("button", {
900
912
  type: "button",
901
913
  onClick: () => _(!0),
902
914
  className: "ml-1 text-xs text-muted-foreground hover:text-foreground",
903
915
  children: o("answerOwnWordsShort")
904
916
  })]
905
917
  })),
906
- r.allowText && (g || r.options.length === 0 || b) && /* @__PURE__ */ B("div", {
918
+ r.allowText && (g || r.options.length === 0 || b) && /* @__PURE__ */ V("div", {
907
919
  className: "mt-3 rounded-md border border-border px-2.5 py-1.5 focus-within:border-primary/60",
908
- children: [/* @__PURE__ */ z(w, {
920
+ children: [/* @__PURE__ */ B(w, {
909
921
  value: "",
910
922
  onChange: p,
911
923
  onSubmit: () => d.trim() && x.mutate(void 0),
@@ -913,14 +925,14 @@ function X({ workspace: n, decision: r, showIssue: i = !1 }) {
913
925
  label: o("answer"),
914
926
  className: "min-h-8",
915
927
  autofocus: g
916
- }, m), /* @__PURE__ */ B("div", {
928
+ }, m), /* @__PURE__ */ V("div", {
917
929
  className: "flex justify-end gap-2",
918
- children: [g && !b && /* @__PURE__ */ z(E, {
930
+ children: [g && !b && /* @__PURE__ */ B(E, {
919
931
  size: "sm",
920
932
  variant: "ghost",
921
933
  onClick: () => _(!1),
922
934
  children: u("cancel")
923
- }), /* @__PURE__ */ z(E, {
935
+ }), /* @__PURE__ */ B(E, {
924
936
  variant: "primary",
925
937
  size: "sm",
926
938
  disabled: !d.trim(),
@@ -930,7 +942,7 @@ function X({ workspace: n, decision: r, showIssue: i = !1 }) {
930
942
  })]
931
943
  })]
932
944
  }),
933
- x.isError && /* @__PURE__ */ z(le, {
945
+ x.isError && /* @__PURE__ */ B(ue, {
934
946
  className: "mt-2",
935
947
  children: a(x.error)
936
948
  })
@@ -939,29 +951,29 @@ function X({ workspace: n, decision: r, showIssue: i = !1 }) {
939
951
  });
940
952
  }
941
953
  function Z({ workspace: e, decision: t }) {
942
- let n = L("agentWork"), { area: r, doc: i, section: a, cites: o, checked: s, context: c, unknownTerms: l } = t;
943
- return /* @__PURE__ */ B(R, { children: [
944
- c && /* @__PURE__ */ z("p", {
954
+ let n = R("agentWork"), { area: r, doc: i, section: a, cites: o, checked: s, context: c, unknownTerms: l } = t;
955
+ return /* @__PURE__ */ V(z, { children: [
956
+ c && /* @__PURE__ */ B("p", {
945
957
  className: "mt-1.5 text-sm text-muted-foreground",
946
958
  children: c
947
959
  }),
948
- l.length > 0 && /* @__PURE__ */ z("p", {
960
+ l.length > 0 && /* @__PURE__ */ B("p", {
949
961
  className: "mt-2 text-xs text-warning",
950
962
  children: n("unknownTerms", { names: l.join(", ") })
951
963
  }),
952
- (r || i) && /* @__PURE__ */ B("p", {
964
+ (r || i) && /* @__PURE__ */ V("p", {
953
965
  className: "mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",
954
- children: [r && /* @__PURE__ */ B("span", {
966
+ children: [r && /* @__PURE__ */ V("span", {
955
967
  className: "flex items-center gap-1",
956
- children: [/* @__PURE__ */ z(T, { className: "size-3.5" }), r.title]
957
- }), i && /* @__PURE__ */ B(x, {
968
+ children: [/* @__PURE__ */ B(T, { className: "size-3.5" }), r.title]
969
+ }), i && /* @__PURE__ */ V(x, {
958
970
  to: "/$workspace/docs/$doc",
959
971
  params: {
960
972
  workspace: e,
961
973
  doc: p(i)
962
974
  },
963
975
  className: "flex min-w-0 items-center gap-1 hover:text-foreground",
964
- children: [/* @__PURE__ */ z(ie, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ z("span", {
976
+ children: [/* @__PURE__ */ B(ie, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ B("span", {
965
977
  className: "truncate",
966
978
  children: a ? n("docSection", {
967
979
  doc: i.title,
@@ -970,16 +982,16 @@ function Z({ workspace: e, decision: t }) {
970
982
  })]
971
983
  })]
972
984
  }),
973
- o.length > 0 && /* @__PURE__ */ B("div", {
985
+ o.length > 0 && /* @__PURE__ */ V("div", {
974
986
  className: "mt-2 text-xs",
975
- children: [/* @__PURE__ */ z("p", {
987
+ children: [/* @__PURE__ */ B("p", {
976
988
  className: "text-muted-foreground",
977
989
  children: n("buildsOn")
978
- }), /* @__PURE__ */ z("ul", {
990
+ }), /* @__PURE__ */ B("ul", {
979
991
  className: "mt-1 space-y-0.5",
980
- children: o.map((t) => /* @__PURE__ */ B("li", {
992
+ children: o.map((t) => /* @__PURE__ */ V("li", {
981
993
  className: "flex min-w-0 gap-1.5",
982
- children: [/* @__PURE__ */ z(x, {
994
+ children: [/* @__PURE__ */ B(x, {
983
995
  to: "/$workspace/issues/$identifier",
984
996
  params: {
985
997
  workspace: e,
@@ -987,20 +999,20 @@ function Z({ workspace: e, decision: t }) {
987
999
  },
988
1000
  className: "shrink-0 text-muted-foreground hover:text-foreground",
989
1001
  children: t.identifier
990
- }), /* @__PURE__ */ z("span", {
1002
+ }), /* @__PURE__ */ B("span", {
991
1003
  className: "truncate",
992
1004
  children: t.prompt
993
1005
  })]
994
1006
  }, t.id))
995
1007
  })]
996
1008
  }),
997
- s && /* @__PURE__ */ z(O, {
1009
+ s && /* @__PURE__ */ B(O, {
998
1010
  className: "mt-2 text-xs",
999
1011
  summaryClassName: "text-muted-foreground hover:text-foreground",
1000
1012
  summary: n("checked"),
1001
- children: /* @__PURE__ */ z("div", {
1013
+ children: /* @__PURE__ */ B("div", {
1002
1014
  className: "mt-1 text-sm",
1003
- children: /* @__PURE__ */ z(w, {
1015
+ children: /* @__PURE__ */ B(w, {
1004
1016
  value: s,
1005
1017
  editable: !1
1006
1018
  })
@@ -1019,42 +1031,42 @@ function Q(e) {
1019
1031
  };
1020
1032
  }
1021
1033
  function $({ workspace: e, decisions: t }) {
1022
- let n = L("agentWork"), r = S(), i = G();
1023
- return /* @__PURE__ */ z(O, {
1034
+ let n = R("agentWork"), r = S(), i = K();
1035
+ return /* @__PURE__ */ B(O, {
1024
1036
  defaultOpen: !0,
1025
1037
  className: "rounded-lg border border-border text-sm",
1026
1038
  summaryClassName: "px-3 py-2 text-xs font-medium text-muted-foreground hover:text-foreground",
1027
1039
  summary: n("answeredCount", { count: t.length }),
1028
- children: /* @__PURE__ */ z("ul", {
1040
+ children: /* @__PURE__ */ B("ul", {
1029
1041
  className: "divide-y divide-border border-t border-border",
1030
1042
  children: t.map((t) => {
1031
1043
  let a = t.options.find((e) => e.id === t.answer?.optionId), o = a && i(t, a) || t.answer?.text || "", s = t.merge || t.release ? {
1032
1044
  text: n("answeredLabel"),
1033
1045
  code: !1
1034
1046
  } : Q(t.prompt);
1035
- return /* @__PURE__ */ z("li", { children: /* @__PURE__ */ z(O, {
1047
+ return /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(O, {
1036
1048
  summaryClassName: "w-full min-w-0 px-3 py-2 hover:bg-muted/50",
1037
- summary: /* @__PURE__ */ B("span", {
1049
+ summary: /* @__PURE__ */ V("span", {
1038
1050
  className: "flex min-w-0 flex-1 items-center gap-2",
1039
1051
  children: [
1040
- /* @__PURE__ */ z("span", {
1052
+ /* @__PURE__ */ B("span", {
1041
1053
  className: "shrink-0 font-medium",
1042
1054
  children: o
1043
1055
  }),
1044
- /* @__PURE__ */ z("span", {
1045
- className: W("min-w-0 flex-1 truncate text-muted-foreground", s.code && "font-mono text-xs"),
1056
+ /* @__PURE__ */ B("span", {
1057
+ className: G("min-w-0 flex-1 truncate text-muted-foreground", s.code && "font-mono text-xs"),
1046
1058
  children: s.text
1047
1059
  }),
1048
- t.answer && /* @__PURE__ */ z("time", {
1060
+ t.answer && /* @__PURE__ */ B("time", {
1049
1061
  dateTime: t.answer.at,
1050
1062
  className: "shrink-0 text-xs text-muted-foreground",
1051
1063
  children: r.relative(t.answer.at)
1052
1064
  })
1053
1065
  ]
1054
1066
  }),
1055
- children: /* @__PURE__ */ z("div", {
1067
+ children: /* @__PURE__ */ B("div", {
1056
1068
  className: "px-3 pb-3 pl-8",
1057
- children: /* @__PURE__ */ z(Oe, {
1069
+ children: /* @__PURE__ */ B(ke, {
1058
1070
  workspace: e,
1059
1071
  decision: t,
1060
1072
  bare: !0
@@ -1065,27 +1077,27 @@ function $({ workspace: e, decisions: t }) {
1065
1077
  })
1066
1078
  });
1067
1079
  }
1068
- function Oe({ workspace: e, decision: t, showIssue: n = !1, showWorkspace: r = !1, bare: i = !1 }) {
1069
- let a = L("agentWork"), o = S(), { person: s } = b(e), c = fe(), l = v(), u = G(), d = t.options.find((e) => e.id === t.answer?.optionId), p = [d && u(t, d), t.answer?.text].filter(Boolean).join(". "), m = De(t), h = (n) => c(n, [
1080
+ function ke({ workspace: e, decision: t, showIssue: n = !1, showWorkspace: r = !1, bare: i = !1 }) {
1081
+ let a = R("agentWork"), o = S(), { person: s } = b(e), c = fe(), l = v(), u = K(), d = t.options.find((e) => e.id === t.answer?.optionId), p = [d && u(t, d), t.answer?.text].filter(Boolean).join(". "), m = De(t), h = (n) => c(n, [
1070
1082
  ...m,
1071
1083
  de,
1072
1084
  ...l(f(e, t.identifier))
1073
- ]), g = /* @__PURE__ */ B(R, { children: [
1074
- /* @__PURE__ */ B("p", {
1085
+ ]), g = /* @__PURE__ */ V(z, { children: [
1086
+ /* @__PURE__ */ V("p", {
1075
1087
  className: "flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground",
1076
1088
  children: [
1077
- r && /* @__PURE__ */ z("span", {
1089
+ r && /* @__PURE__ */ B("span", {
1078
1090
  className: "rounded bg-muted px-1.5 py-0.5 font-medium text-foreground",
1079
1091
  children: t.workspaceName
1080
1092
  }),
1081
- n && /* @__PURE__ */ z("span", {
1093
+ n && /* @__PURE__ */ B("span", {
1082
1094
  className: "font-medium text-foreground",
1083
1095
  children: t.identifier
1084
1096
  }),
1085
- /* @__PURE__ */ z("span", { children: a("askedBy", { agent: t.agentName }) }),
1086
- t.answer && /* @__PURE__ */ z(ue, {
1097
+ /* @__PURE__ */ B("span", { children: a("askedBy", { agent: t.agentName }) }),
1098
+ t.answer && /* @__PURE__ */ B(j, {
1087
1099
  content: o.full(t.answer.at),
1088
- children: /* @__PURE__ */ z("time", {
1100
+ children: /* @__PURE__ */ B("time", {
1089
1101
  dateTime: t.answer.at,
1090
1102
  children: a("answeredBy", {
1091
1103
  name: s(t.answer.by ?? "").name,
@@ -1095,35 +1107,35 @@ function Oe({ workspace: e, decision: t, showIssue: n = !1, showWorkspace: r = !
1095
1107
  })
1096
1108
  ]
1097
1109
  }),
1098
- /* @__PURE__ */ z("div", {
1110
+ /* @__PURE__ */ B("div", {
1099
1111
  className: "mt-1.5",
1100
- children: /* @__PURE__ */ z(Te, {
1112
+ children: /* @__PURE__ */ B(Te, {
1101
1113
  decision: t,
1102
1114
  className: "text-sm"
1103
1115
  })
1104
1116
  }),
1105
- /* @__PURE__ */ z("p", {
1117
+ /* @__PURE__ */ B("p", {
1106
1118
  className: "mt-1 font-medium",
1107
1119
  children: p
1108
1120
  }),
1109
- /* @__PURE__ */ z(Ee, {
1121
+ /* @__PURE__ */ B(Ee, {
1110
1122
  workspace: e,
1111
1123
  decision: t
1112
1124
  })
1113
1125
  ] });
1114
- return i ? /* @__PURE__ */ z("article", {
1126
+ return i ? /* @__PURE__ */ B("article", {
1115
1127
  onContextMenu: h,
1116
1128
  "aria-label": a("answeredLabel"),
1117
1129
  className: "text-sm",
1118
1130
  children: g
1119
- }) : /* @__PURE__ */ z(ce, {
1131
+ }) : /* @__PURE__ */ B(le, {
1120
1132
  size: "fill",
1121
1133
  className: "text-sm",
1122
- render: /* @__PURE__ */ z("article", {
1134
+ render: /* @__PURE__ */ B("article", {
1123
1135
  onContextMenu: h,
1124
1136
  "aria-label": a("answeredLabel")
1125
1137
  }),
1126
1138
  children: g
1127
1139
  });
1128
1140
  }
1129
- export { ye as AgentWork, Oe as AnsweredDecision, X as DecisionCard, ve as useMoney, G as useOptionLabel };
1141
+ export { ye as AgentWork, ke as AnsweredDecision, X as DecisionCard, ve as useMoney, K as useOptionLabel };