@parallelworks/tandem-web 0.154.0 → 0.155.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.
@@ -6,36 +6,37 @@ import { invalidateIssueViews as f } from "../api/mutations.js";
6
6
  import { harnessNames as p } from "../lib/agents.js";
7
7
  import { parseApproval as m } from "../lib/approval.js";
8
8
  import { decisionDefaults as h } from "../lib/decisionEntry.js";
9
- import { copyItem as g, useLinkItems as _ } from "../lib/menus.js";
10
- import { docRef as v } from "../lib/docs.js";
11
- import { externalUrl as y } from "../lib/externalUrl.js";
12
- import { useRunPanel as b } from "../lib/hostPanel.js";
13
- import { AreaIcon as x, FileTextIcon as S, LibraryIcon as C, PullRequestIcon as ee } from "./icons.js";
14
- import { EntryDialog as w, useTermRefs as T } from "../lib/knowledge.js";
9
+ import { copyItem as ee, useLinkItems as g } from "../lib/menus.js";
10
+ import { docRef as _ } from "../lib/docs.js";
11
+ import { externalUrl as v } from "../lib/externalUrl.js";
12
+ import { useRunPanel as y } from "../lib/hostPanel.js";
13
+ import { AreaIcon as b, CodeHostIcon as x, FileTextIcon as S, LibraryIcon as C, PullRequestIcon as w } from "./icons.js";
14
+ import { EntryDialog as te, useTermRefs as T } from "../lib/knowledge.js";
15
15
  import { useNewIssue as E } from "../lib/newIssue.js";
16
- import { usePeople as te } from "../lib/people.js";
17
- import { usePermissionModeName as ne } from "../lib/permissionModes.js";
16
+ import { usePeople as ne } from "../lib/people.js";
17
+ import { usePermissionModeName as re } from "../lib/permissionModes.js";
18
18
  import { useTime as D } from "../lib/time.js";
19
19
  import { AgentPage as O } from "./AgentPage.js";
20
20
  import { Editor as k } from "./Editor.js";
21
- import { Avatar as re, Button as A, Card as ie, CopyCodeBlock as j, Disclosure as M, ErrorText as ae, NumberInput as N, RelativeTime as P, Tooltip as F, menuDivider as oe, useOpenMenu as se } from "@parallelworks/ui";
21
+ import { pullRequestNumber as ie } from "./IssueCode.js";
22
+ import { Avatar as ae, Button as A, Card as oe, CopyCodeBlock as j, Disclosure as M, ErrorText as se, NumberInput as N, RelativeTime as P, Tooltip as F, menuDivider as ce, useOpenMenu as le } from "@parallelworks/ui";
22
23
  import { useParams as I } from "@tanstack/react-router";
23
- import { Suspense as ce, useCallback as L, useEffect as le, useRef as R, useState as z } from "react";
24
- import { useErrorMessage as ue } from "@parallelworks/problem/react";
25
- import { useFormatter as de, useTranslations as B } from "use-intl";
24
+ import { Suspense as ue, useCallback as L, useEffect as de, useRef as R, useState as z } from "react";
25
+ import { useErrorMessage as fe } from "@parallelworks/problem/react";
26
+ import { useFormatter as pe, useTranslations as B } from "use-intl";
26
27
  import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
27
- import { useMutation as fe, useQuery as W, useQueryClient as pe, useSuspenseQuery as G } from "@tanstack/react-query";
28
- import { MoreButton as me } from "@parallelworks/ui/list";
28
+ import { useMutation as me, useQuery as W, useQueryClient as he, useSuspenseQuery as G } from "@tanstack/react-query";
29
+ import { MoreButton as ge } from "@parallelworks/ui/list";
29
30
  // src/components/AgentWork.tsx
30
- var he = "var(--agent-tone)";
31
- function ge() {
32
- let e = de();
31
+ var _e = "var(--agent-tone)";
32
+ function ve() {
33
+ let e = pe();
33
34
  return (t) => e.number(t / 1e6, {
34
35
  style: "currency",
35
36
  currency: "USD"
36
37
  });
37
38
  }
38
- function _e({ workspace: e, identifier: t }) {
39
+ function ye({ workspace: e, identifier: t }) {
39
40
  let { data: n } = G(d(e, t)), { data: r } = G(s(e, t)), i = r.filter((e) => !e.answer && !e.canceled), a = r.filter((e) => e.answer && !e.canceled), o = n.filter((e, t) => t === 0 || !["closed", "stopped"].includes(e.state)), c = B("agentWork");
40
41
  return n.length === 0 ? null : /* @__PURE__ */ U("section", {
41
42
  className: "mt-8 space-y-3",
@@ -45,11 +46,11 @@ function _e({ workspace: e, identifier: t }) {
45
46
  workspace: e,
46
47
  decision: t
47
48
  }, t.id)),
48
- a.length > 0 && /* @__PURE__ */ H(Oe, {
49
+ a.length > 0 && /* @__PURE__ */ H(Ae, {
49
50
  workspace: e,
50
51
  decisions: a
51
52
  }),
52
- o.map((n) => /* @__PURE__ */ H(ve, {
53
+ o.map((n) => /* @__PURE__ */ H(be, {
53
54
  workspace: e,
54
55
  identifier: t,
55
56
  run: n
@@ -57,10 +58,10 @@ function _e({ workspace: e, identifier: t }) {
57
58
  ]
58
59
  });
59
60
  }
60
- function ve({ workspace: n, identifier: r, run: o }) {
61
- let s = B("agentWork"), l = B("common"), u = ue(), m = ne(), h = D(), _ = ge(), v = (e) => s(`state.${e}`), { nameOf: x } = te(n), S = pe(), [C, w] = z(o.state === "working"), T = () => {
61
+ function be({ workspace: n, identifier: r, run: o }) {
62
+ let s = B("agentWork"), l = B("common"), u = fe(), m = re(), h = D(), g = ve(), _ = (e) => s(`state.${e}`), { nameOf: b } = ne(n), S = he(), [C, te] = z(o.state === "working"), T = () => {
62
63
  S.invalidateQueries({ queryKey: d(n, r).queryKey }), f(S, n, r);
63
- }, E = fe({
64
+ }, E = me({
64
65
  mutationFn: async (r) => t(await e.POST("/api/v1/workspaces/{workspace}/runs/{runId}/move", {
65
66
  params: { path: {
66
67
  workspace: n,
@@ -69,7 +70,7 @@ function ve({ workspace: n, identifier: r, run: o }) {
69
70
  body: r
70
71
  })),
71
72
  onSettled: T
72
- }), [O, j] = z(!1), [M, N] = z(""), P = fe({
73
+ }), [O, j] = z(!1), [M, N] = z(""), P = me({
73
74
  mutationFn: async () => (t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/comments", {
74
75
  params: { path: {
75
76
  workspace: n,
@@ -90,7 +91,7 @@ function ve({ workspace: n, identifier: r, run: o }) {
90
91
  j(!1), N("");
91
92
  },
92
93
  onSettled: T
93
- }), F = E.isPending || P.isPending, I = xe(o), [ce, L] = z(!1), le = () => I ? L(!0) : E.mutate({ state: "queued" }), R = I && {
94
+ }), F = E.isPending || P.isPending, I = Ce(o), [ue, L] = z(!1), de = () => I ? L(!0) : E.mutate({ state: "queued" }), R = I && {
94
95
  turns: {
95
96
  used: o.turns,
96
97
  allowed: o.budget.maxTurns
@@ -100,10 +101,10 @@ function ve({ workspace: n, identifier: r, run: o }) {
100
101
  allowed: o.budget.maxMinutes
101
102
  },
102
103
  cost: {
103
- used: _(o.costMicros),
104
- allowed: _(o.budget.maxCostMicros)
104
+ used: g(o.costMicros),
105
+ allowed: g(o.budget.maxCostMicros)
105
106
  }
106
- }[I], de = !["closed", "stopped"].includes(o.state), G = o.state === "done_pending_verification", _e = se(), ve = i(), { data: be = [] } = W(a(n)), q = be.find((e) => e.id === o.agentId), { data: we = [] } = W(c(n, r)), J = we.find((e) => e.runId === o.id), Te = B("code"), Y = q?.slug, X = b(), Z = X && (o.harnessSession || o.runnerName) ? {
107
+ }[I], pe = !["closed", "stopped"].includes(o.state), G = o.state === "done_pending_verification", ye = le(), be = i(), { data: Se = [] } = W(a(n)), q = Se.find((e) => e.id === o.agentId), { data: Ee = [] } = W(c(n, r)), J = Ee.find((e) => e.runId === o.id), De = B("code"), Y = q?.slug, X = y(), Z = X && (o.harnessSession || o.runnerName) ? {
107
108
  label: s("openRunIn", { name: X.action.label }),
108
109
  onClick: () => X.open(o)
109
110
  } : void 0, Q = () => [
@@ -117,17 +118,17 @@ function ve({ workspace: n, identifier: r, run: o }) {
117
118
  }] : [],
118
119
  ...o.state === "stopped" || o.state === "blocked_external" ? [{
119
120
  label: s("resume"),
120
- onClick: () => le()
121
+ onClick: () => de()
121
122
  }] : [],
122
- ...de ? [{
123
+ ...pe ? [{
123
124
  label: s("stop"),
124
125
  destructive: !0,
125
126
  onClick: () => E.mutate({ state: "stopped" })
126
127
  }] : [],
127
- oe,
128
+ ce,
128
129
  ...Y ? [{
129
130
  label: s("openAgent"),
130
- onClick: () => ve({
131
+ onClick: () => be({
131
132
  to: "/$workspace/agents/$slug",
132
133
  params: {
133
134
  workspace: n,
@@ -135,13 +136,13 @@ function ve({ workspace: n, identifier: r, run: o }) {
135
136
  }
136
137
  })
137
138
  }] : [],
138
- g(s("copyRunId"), o.id)
139
+ ee(s("copyRunId"), o.id)
139
140
  ], $ = o.state === "working" || o.state === "queued";
140
141
  return o.state === "closed" ? /* @__PURE__ */ U("div", {
141
- onContextMenu: (e) => _e(e, Q()),
142
+ onContextMenu: (e) => ye(e, Q()),
142
143
  className: "group flex items-center gap-2 px-1 text-xs text-muted-foreground",
143
144
  children: [
144
- /* @__PURE__ */ H(re, {
145
+ /* @__PURE__ */ H(ae, {
145
146
  kind: "agent",
146
147
  name: o.agentName,
147
148
  size: "xs",
@@ -155,32 +156,32 @@ function ve({ workspace: n, identifier: r, run: o }) {
155
156
  children: e
156
157
  })
157
158
  }) }),
158
- /* @__PURE__ */ H(me, {
159
+ /* @__PURE__ */ H(ge, {
159
160
  items: Q,
160
161
  label: l("moreActionsFor", { name: o.agentName }),
161
162
  className: "ml-auto"
162
163
  })
163
164
  ]
164
- }) : /* @__PURE__ */ U(ie, {
165
+ }) : /* @__PURE__ */ U(oe, {
165
166
  size: "fill",
166
167
  padding: "none",
167
- tone: G ? he : void 0,
168
+ tone: G ? _e : void 0,
168
169
  interactive: !1,
169
170
  className: "text-sm",
170
171
  render: /* @__PURE__ */ H("section", {
171
172
  "aria-label": s("runLabel", {
172
173
  agent: o.agentName,
173
- state: v(o.state)
174
+ state: _(o.state)
174
175
  }),
175
176
  onContextMenu: (e) => {
176
- e.target.closest(".ProseMirror[contenteditable=\"true\"]") || _e(e, Q());
177
+ e.target.closest(".ProseMirror[contenteditable=\"true\"]") || ye(e, Q());
177
178
  }
178
179
  }),
179
180
  children: [
180
181
  /* @__PURE__ */ U("header", {
181
182
  className: "flex items-center gap-2 px-3 pt-2.5",
182
183
  children: [
183
- /* @__PURE__ */ H(re, {
184
+ /* @__PURE__ */ H(ae, {
184
185
  kind: "agent",
185
186
  name: o.agentName,
186
187
  size: "xs",
@@ -192,7 +193,7 @@ function ve({ workspace: n, identifier: r, run: o }) {
192
193
  }),
193
194
  /* @__PURE__ */ H("span", {
194
195
  className: "truncate text-muted-foreground",
195
- children: s("assignedBy", { name: x("user", o.assignedBy) })
196
+ children: s("assignedBy", { name: b("user", o.assignedBy) })
196
197
  }),
197
198
  /* @__PURE__ */ U("span", {
198
199
  className: K("ml-auto inline-flex shrink-0 items-center gap-1.5 text-xs font-medium", G || $ ? "text-agent" : "text-muted-foreground"),
@@ -202,7 +203,7 @@ function ve({ workspace: n, identifier: r, run: o }) {
202
203
  "aria-hidden": "true",
203
204
  children: [o.state === "working" && /* @__PURE__ */ H("span", { className: "absolute inline-flex size-full animate-ping rounded-full bg-agent opacity-60 motion-reduce:hidden" }), /* @__PURE__ */ H("span", { className: "relative inline-flex size-1.5 rounded-full bg-agent" })]
204
205
  }),
205
- v(o.state),
206
+ _(o.state),
206
207
  o.state === "working" && o.runnerName && /* @__PURE__ */ H("span", {
207
208
  className: "font-normal text-muted-foreground",
208
209
  children: s("onRunner", { runner: o.runnerName })
@@ -216,7 +217,7 @@ function ve({ workspace: n, identifier: r, run: o }) {
216
217
  className: "-my-1",
217
218
  children: Z.label
218
219
  }),
219
- /* @__PURE__ */ H(me, {
220
+ /* @__PURE__ */ H(ge, {
220
221
  items: Q,
221
222
  label: l("moreActionsFor", { name: o.agentName }),
222
223
  visible: !0,
@@ -229,7 +230,7 @@ function ve({ workspace: n, identifier: r, run: o }) {
229
230
  children: s("noRunnerForHarness", { harness: p[q.harness] ?? q.harness })
230
231
  }) : o.state === "queued" && o.waiting && /* @__PURE__ */ H("p", {
231
232
  className: "px-3 pt-1.5 text-pretty text-muted-foreground",
232
- children: s(`waiting.${o.waiting}`, { name: x("user", o.assignedBy) })
233
+ children: s(`waiting.${o.waiting}`, { name: b("user", o.assignedBy) })
233
234
  }),
234
235
  o.permissionMode && o.permissionMode !== o.agentPermissionMode && /* @__PURE__ */ H("p", {
235
236
  className: "px-3 pt-1.5 text-pretty text-muted-foreground",
@@ -258,28 +259,32 @@ function ve({ workspace: n, identifier: r, run: o }) {
258
259
  J && /* @__PURE__ */ U("p", {
259
260
  className: "flex flex-wrap items-center gap-x-2 px-3 pt-1.5",
260
261
  children: [
261
- /* @__PURE__ */ H(ee, { className: "size-3.5 text-muted-foreground" }),
262
+ /* @__PURE__ */ H(w, { className: "size-3.5 text-muted-foreground" }),
263
+ /* @__PURE__ */ H(x, {
264
+ provider: J.provider,
265
+ className: "size-3.5 text-muted-foreground"
266
+ }),
262
267
  /* @__PURE__ */ H("a", {
263
- href: y(J.url),
268
+ href: v(J.url),
264
269
  target: "_blank",
265
270
  rel: "noopener noreferrer",
266
271
  className: "hover:underline",
267
- children: Te("pullRequestRef", {
272
+ children: De("pullRequestRef", {
268
273
  repository: J.repository,
269
- number: J.number
274
+ number: ie(J)
270
275
  })
271
276
  }),
272
277
  /* @__PURE__ */ H("span", {
273
278
  className: "text-xs text-muted-foreground",
274
- children: Te(`state.${J.state === "open" && J.draft ? "draft" : J.state}`)
279
+ children: De(`state.${J.state === "open" && J.draft ? "draft" : J.state}`)
275
280
  })
276
281
  ]
277
282
  }),
278
- /* @__PURE__ */ H(Ce, {
283
+ /* @__PURE__ */ H(Te, {
279
284
  workspace: n,
280
285
  run: o
281
286
  }),
282
- ce && /* @__PURE__ */ H(Se, {
287
+ ue && /* @__PURE__ */ H(we, {
283
288
  run: o,
284
289
  busy: F,
285
290
  onCancel: () => L(!1),
@@ -331,10 +336,10 @@ function ve({ workspace: n, identifier: r, run: o }) {
331
336
  onClick: () => j(!1),
332
337
  children: l("cancel")
333
338
  })] }),
334
- (o.state === "stopped" || o.state === "blocked_external") && !ce && /* @__PURE__ */ H(A, {
339
+ (o.state === "stopped" || o.state === "blocked_external") && !ue && /* @__PURE__ */ H(A, {
335
340
  size: "sm",
336
341
  disabled: F,
337
- onClick: () => le(),
342
+ onClick: () => de(),
338
343
  children: s("resume")
339
344
  }),
340
345
  $ && /* @__PURE__ */ H(A, {
@@ -348,7 +353,7 @@ function ve({ workspace: n, identifier: r, run: o }) {
348
353
  size: "sm",
349
354
  type: "button",
350
355
  "aria-expanded": C,
351
- onClick: () => w((e) => !e),
356
+ onClick: () => te((e) => !e),
352
357
  children: s(C ? "activity.hide" : "activity.show")
353
358
  }),
354
359
  /* @__PURE__ */ H("span", {
@@ -358,27 +363,27 @@ function ve({ workspace: n, identifier: r, run: o }) {
358
363
  maxTurns: o.budget.maxTurns,
359
364
  minutes: Math.floor(o.seconds / 60),
360
365
  maxMinutes: o.budget.maxMinutes,
361
- cost: _(o.costMicros),
362
- maxCost: _(o.budget.maxCostMicros),
366
+ cost: g(o.costMicros),
367
+ maxCost: g(o.budget.maxCostMicros),
363
368
  when: h.relative(o.updatedAt)
364
369
  })
365
370
  }),
366
- (E.isError || P.isError) && /* @__PURE__ */ H(ae, {
371
+ (E.isError || P.isError) && /* @__PURE__ */ H(se, {
367
372
  className: "w-full",
368
373
  children: u(E.error ?? P.error)
369
374
  })
370
375
  ]
371
376
  }),
372
- C && o.state !== "queued" && /* @__PURE__ */ H(ye, {
377
+ C && o.state !== "queued" && /* @__PURE__ */ H(xe, {
373
378
  workspace: n,
374
379
  run: o
375
380
  })
376
381
  ]
377
382
  });
378
383
  }
379
- function ye({ workspace: e, run: t }) {
384
+ function xe({ workspace: e, run: t }) {
380
385
  let n = B("agentWork.activity"), r = D(), i = t.state === "working", { data: a, isPending: o, isError: s } = W(l(e, t.id, i)), c = R(null), u = R(!0), d = a?.length ?? 0;
381
- return le(() => {
386
+ return de(() => {
382
387
  let e = c.current;
383
388
  e && u.current && d > 0 && (e.scrollTop = e.scrollHeight);
384
389
  }, [d]), /* @__PURE__ */ U("div", {
@@ -393,7 +398,7 @@ function ye({ workspace: e, run: t }) {
393
398
  children: [/* @__PURE__ */ H("span", { className: "absolute inline-flex size-full animate-ping rounded-full bg-agent opacity-60 motion-reduce:hidden" }), /* @__PURE__ */ H("span", { className: "relative inline-flex size-1.5 rounded-full bg-agent" })]
394
399
  }), n("live")]
395
400
  }), n("count", { count: d })]
396
- }), s ? /* @__PURE__ */ H(ae, {
401
+ }), s ? /* @__PURE__ */ H(se, {
397
402
  className: "px-3 py-2",
398
403
  children: n("failedToLoad")
399
404
  }) : !o && d === 0 ? /* @__PURE__ */ H("p", {
@@ -408,14 +413,14 @@ function ye({ workspace: e, run: t }) {
408
413
  u.current = t.scrollHeight - t.scrollTop - t.clientHeight < 24;
409
414
  },
410
415
  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",
411
- children: a?.map((e) => /* @__PURE__ */ H(be, {
416
+ children: a?.map((e) => /* @__PURE__ */ H(Se, {
412
417
  entry: e,
413
418
  at: r.clock(e.at)
414
419
  }, e.seq))
415
420
  })]
416
421
  });
417
422
  }
418
- function be({ entry: e, at: t }) {
423
+ function Se({ entry: e, at: t }) {
419
424
  let n = B("agentWork.activity"), r = /* @__PURE__ */ H("span", {
420
425
  className: "shrink-0 text-muted-foreground/70 tabular-nums",
421
426
  children: t
@@ -461,10 +466,10 @@ function be({ entry: e, at: t }) {
461
466
  })]
462
467
  });
463
468
  }
464
- function xe(e) {
469
+ function Ce(e) {
465
470
  return e.turns >= e.budget.maxTurns ? "turns" : e.seconds >= e.budget.maxMinutes * 60 ? "minutes" : e.costMicros >= e.budget.maxCostMicros ? "cost" : null;
466
471
  }
467
- function Se({ run: e, busy: t, onSubmit: n, onCancel: r }) {
472
+ function we({ run: e, busy: t, onSubmit: n, onCancel: r }) {
468
473
  let i = B("agentWork"), a = B("common"), o = Math.ceil(e.seconds / 60), [s, c] = z(Math.max(e.budget.maxTurns * 2, e.turns + 1)), [l, u] = z(Math.max(e.budget.maxMinutes * 2, o + 1)), [d, f] = z(Math.max(e.budget.maxCostMicros * 2, e.costMicros + 1e6) / 1e6);
469
474
  return /* @__PURE__ */ U("form", {
470
475
  className: "mx-3 mt-2.5 space-y-2 rounded-md border border-border px-2.5 py-2",
@@ -542,7 +547,7 @@ function Se({ run: e, busy: t, onSubmit: n, onCancel: r }) {
542
547
  });
543
548
  }
544
549
  var K = (...e) => e.filter(Boolean).join(" ");
545
- function Ce({ workspace: e, run: t }) {
550
+ function Te({ workspace: e, run: t }) {
546
551
  let n = T(e), i = B("agentWork"), [a, o] = z(!1), { data: s } = W({
547
552
  ...u(e, t.id),
548
553
  enabled: a
@@ -562,7 +567,7 @@ function Ce({ workspace: e, run: t }) {
562
567
  to: "/$workspace/docs/$doc",
563
568
  params: {
564
569
  workspace: e,
565
- doc: v(t)
570
+ doc: _(t)
566
571
  },
567
572
  className: "inline-flex items-center gap-1 hover:underline",
568
573
  children: [/* @__PURE__ */ H(S, { className: "size-3.5 text-muted-foreground" }), t.title]
@@ -582,7 +587,7 @@ function q() {
582
587
  let e = B("agentWork");
583
588
  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;
584
589
  }
585
- function we({ decision: e, className: t }) {
590
+ function Ee({ decision: e, className: t }) {
586
591
  let n = B("agentWork"), r = e.merge, i = e.release;
587
592
  return i ? /* @__PURE__ */ U("p", {
588
593
  className: K("text-sm", t),
@@ -597,7 +602,7 @@ function we({ decision: e, className: t }) {
597
602
  }), i.deploymentId && /* @__PURE__ */ H("span", {
598
603
  className: "mt-1 block text-xs text-muted-foreground",
599
604
  children: i.deploymentUrl ? /* @__PURE__ */ H("a", {
600
- href: y(i.deploymentUrl),
605
+ href: v(i.deploymentUrl),
601
606
  target: "_blank",
602
607
  rel: "noopener noreferrer",
603
608
  className: "hover:underline",
@@ -609,7 +614,7 @@ function we({ decision: e, className: t }) {
609
614
  children: n.rich("mergePrompt", {
610
615
  sha: r.sha.slice(0, 7),
611
616
  pr: () => /* @__PURE__ */ U("a", {
612
- href: y(r.url),
617
+ href: v(r.url),
613
618
  target: "_blank",
614
619
  rel: "noopener noreferrer",
615
620
  className: "font-medium hover:underline",
@@ -676,7 +681,7 @@ function J({ workspace: e, decision: t }) {
676
681
  }, t))
677
682
  }) : null;
678
683
  }
679
- function Te({ workspace: e, decision: t, onAnswer: n, busy: r }) {
684
+ function De({ workspace: e, decision: t, onAnswer: n, busy: r }) {
680
685
  let i = B("agentPage"), a = q(), { data: s = [] } = W(o(e, t.identifier)), [c, l] = z(null), u = L((e) => {
681
686
  t.options.some((t) => t.id === e) && l(e);
682
687
  }, [t.options]), d = s.find((e) => e.id === t.pageId), f = t.options.find((e) => e.id === c);
@@ -738,7 +743,7 @@ function Q() {
738
743
  });
739
744
  }
740
745
  function $({ workspace: r, decision: a, showIssue: o = !1 }) {
741
- let s = ue(), c = B("agentWork"), l = q(), u = _(), d = pe(), f = B("common"), [p, m] = z(""), [h, g] = z(0), [v, y] = z(!1), b = X(a), x = !b && a.options.some((e) => e.description), S = b ? [...a.options].sort((e, t) => Z(e.id) - Z(t.id)) : a.options, C = fe({
746
+ let s = fe(), c = B("agentWork"), l = q(), u = g(), d = he(), f = B("common"), [p, m] = z(""), [h, ee] = z(0), [_, v] = z(!1), y = X(a), b = !y && a.options.some((e) => e.description), x = y ? [...a.options].sort((e, t) => Z(e.id) - Z(t.id)) : a.options, S = me({
742
747
  mutationFn: async (n) => t(await e.POST("/api/v1/workspaces/{workspace}/decisions/{decisionId}/answer", {
743
748
  params: { path: {
744
749
  workspace: r,
@@ -750,7 +755,7 @@ function $({ workspace: r, decision: a, showIssue: o = !1 }) {
750
755
  }
751
756
  })),
752
757
  onSuccess: () => {
753
- m(""), y(!1), g((e) => e + 1), d.invalidateQueries({ queryKey: [
758
+ m(""), v(!1), ee((e) => e + 1), d.invalidateQueries({ queryKey: [
754
759
  "workspace",
755
760
  r,
756
761
  "decisions"
@@ -761,14 +766,14 @@ function $({ workspace: r, decision: a, showIssue: o = !1 }) {
761
766
  a.identifier.toUpperCase()
762
767
  ] });
763
768
  }
764
- }), ee = se(), w = i(), T = Y(a), E = () => [
769
+ }), C = le(), w = i(), te = Y(a), T = () => [
765
770
  ...a.options.length > 0 ? [{
766
771
  label: c("answer"),
767
772
  items: a.options.map((e) => ({
768
773
  label: e.id === a.recommendation ? c("suggestedOption", { option: l(a, e) }) : l(a, e),
769
- onClick: () => C.mutate(e.id)
774
+ onClick: () => S.mutate(e.id)
770
775
  }))
771
- }, oe] : [],
776
+ }, ce] : [],
772
777
  {
773
778
  label: c("openIssue"),
774
779
  onClick: () => w({
@@ -779,24 +784,24 @@ function $({ workspace: r, decision: a, showIssue: o = !1 }) {
779
784
  }
780
785
  })
781
786
  },
782
- ...T,
787
+ ...te,
783
788
  ...u(n(r, a.identifier))
784
789
  ];
785
- return /* @__PURE__ */ U(ie, {
790
+ return /* @__PURE__ */ U(oe, {
786
791
  size: "fill",
787
792
  padding: "none",
788
- tone: he,
793
+ tone: _e,
789
794
  interactive: !1,
790
795
  render: /* @__PURE__ */ H("article", {
791
796
  onContextMenu: (e) => {
792
- e.target.closest(".ProseMirror[contenteditable=\"true\"]") || ee(e, E());
797
+ e.target.closest(".ProseMirror[contenteditable=\"true\"]") || C(e, T());
793
798
  },
794
799
  "aria-label": c("asking", { agent: a.agentName })
795
800
  }),
796
801
  children: [/* @__PURE__ */ U("header", {
797
802
  className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs",
798
803
  children: [
799
- /* @__PURE__ */ H(re, {
804
+ /* @__PURE__ */ H(ae, {
800
805
  kind: "agent",
801
806
  name: a.agentName,
802
807
  size: "xs",
@@ -826,47 +831,47 @@ function $({ workspace: r, decision: a, showIssue: o = !1 }) {
826
831
  }), /* @__PURE__ */ U("div", {
827
832
  className: "px-3 py-2.5",
828
833
  children: [
829
- b ? /* @__PURE__ */ U("div", { children: [
834
+ y ? /* @__PURE__ */ U("div", { children: [
830
835
  /* @__PURE__ */ H("p", {
831
836
  className: "text-sm font-medium",
832
- children: b.agent ? c("approveCommandFor", { agent: b.agent }) : c("approveCommand")
837
+ children: y.agent ? c("approveCommandFor", { agent: y.agent }) : c("approveCommand")
833
838
  }),
834
839
  /* @__PURE__ */ H(j, {
835
- text: b.command,
840
+ text: y.command,
836
841
  label: c("command"),
837
842
  wrap: !0,
838
843
  className: "mt-2 [&_pre]:px-3 [&_pre]:py-2 [&_pre]:pr-10 [&_pre]:text-xs [&_pre]:leading-5"
839
844
  }),
840
- b.reason && /* @__PURE__ */ H("p", {
845
+ y.reason && /* @__PURE__ */ H("p", {
841
846
  className: "mt-1.5 text-xs text-muted-foreground",
842
- children: b.reason
847
+ children: y.reason
843
848
  })
844
849
  ] }) : /* @__PURE__ */ H("div", {
845
850
  className: "[&_.ProseMirror>:first-child]:mt-0",
846
- children: /* @__PURE__ */ H(we, { decision: a })
851
+ children: /* @__PURE__ */ H(Ee, { decision: a })
847
852
  }),
848
- /* @__PURE__ */ H(Ee, {
853
+ /* @__PURE__ */ H(Oe, {
849
854
  workspace: r,
850
855
  decision: a
851
856
  }),
852
- a.pageId && /* @__PURE__ */ H(Te, {
857
+ a.pageId && /* @__PURE__ */ H(De, {
853
858
  workspace: r,
854
859
  decision: a,
855
- onAnswer: (e) => C.mutate(e),
856
- busy: C.isPending
860
+ onAnswer: (e) => S.mutate(e),
861
+ busy: S.isPending
857
862
  }),
858
863
  /* @__PURE__ */ H(J, {
859
864
  workspace: r,
860
865
  decision: a
861
866
  }),
862
- a.options.length > 0 && (x ? /* @__PURE__ */ H("div", {
867
+ a.options.length > 0 && (b ? /* @__PURE__ */ H("div", {
863
868
  className: "mt-3 grid gap-1.5 sm:grid-cols-2",
864
869
  children: a.options.map((e) => {
865
870
  let t = e.id === a.recommendation;
866
871
  return /* @__PURE__ */ U("button", {
867
872
  type: "button",
868
- disabled: C.isPending,
869
- onClick: () => C.mutate(e.id),
873
+ disabled: S.isPending,
874
+ onClick: () => S.mutate(e.id),
870
875
  className: `rounded-md border px-3 py-2 text-left text-sm hover:bg-muted disabled:opacity-50 ${t ? "border-agent" : "border-border"}`,
871
876
  children: [/* @__PURE__ */ U("span", {
872
877
  className: "flex items-center gap-2 font-medium",
@@ -879,62 +884,62 @@ function $({ workspace: r, decision: a, showIssue: o = !1 }) {
879
884
  })
880
885
  }) : /* @__PURE__ */ U("div", {
881
886
  className: "mt-3 flex flex-wrap items-center gap-2",
882
- children: [S.map((e, t) => {
887
+ children: [x.map((e, t) => {
883
888
  let n = e.id === a.recommendation, r = /* @__PURE__ */ U(A, {
884
889
  size: "sm",
885
- variant: b && t === 0 ? "primary" : "secondary",
886
- disabled: C.isPending,
887
- onClick: () => C.mutate(e.id),
888
- className: n && !(b && t === 0) ? "border-agent" : void 0,
890
+ variant: y && t === 0 ? "primary" : "secondary",
891
+ disabled: S.isPending,
892
+ onClick: () => S.mutate(e.id),
893
+ className: n && !(y && t === 0) ? "border-agent" : void 0,
889
894
  children: [l(a, e), n && /* @__PURE__ */ H(Q, {})]
890
895
  }, e.id);
891
896
  return e.description ? /* @__PURE__ */ H(F, {
892
897
  content: e.description,
893
898
  children: r
894
899
  }, e.id) : r;
895
- }), a.allowText && !v && /* @__PURE__ */ H("button", {
900
+ }), a.allowText && !_ && /* @__PURE__ */ H("button", {
896
901
  type: "button",
897
- onClick: () => y(!0),
902
+ onClick: () => v(!0),
898
903
  className: "ml-1 text-xs text-muted-foreground hover:text-foreground",
899
904
  children: c("answerOwnWordsShort")
900
905
  })]
901
906
  })),
902
- a.allowText && (v || a.options.length === 0 || x) && /* @__PURE__ */ U("div", {
907
+ a.allowText && (_ || a.options.length === 0 || b) && /* @__PURE__ */ U("div", {
903
908
  className: "mt-3 rounded-md border border-border px-2.5 py-1.5 focus-within:border-primary/60",
904
909
  children: [/* @__PURE__ */ H(k, {
905
910
  value: "",
906
911
  onChange: m,
907
- onSubmit: () => p.trim() && C.mutate(void 0),
912
+ onSubmit: () => p.trim() && S.mutate(void 0),
908
913
  placeholder: a.options.length ? c("answerOwnWords") : c("answerPlaceholder"),
909
914
  label: c("answer"),
910
915
  className: "min-h-8",
911
- autofocus: v
916
+ autofocus: _
912
917
  }, h), /* @__PURE__ */ U("div", {
913
918
  className: "flex justify-end gap-2",
914
- children: [v && !x && /* @__PURE__ */ H(A, {
919
+ children: [_ && !b && /* @__PURE__ */ H(A, {
915
920
  size: "sm",
916
921
  variant: "ghost",
917
- onClick: () => y(!1),
922
+ onClick: () => v(!1),
918
923
  children: f("cancel")
919
924
  }), /* @__PURE__ */ H(A, {
920
925
  variant: "primary",
921
926
  size: "sm",
922
927
  disabled: !p.trim(),
923
- loading: C.isPending,
924
- onClick: () => C.mutate(void 0),
928
+ loading: S.isPending,
929
+ onClick: () => S.mutate(void 0),
925
930
  children: c("answer")
926
931
  })]
927
932
  })]
928
933
  }),
929
- C.isError && /* @__PURE__ */ H(ae, {
934
+ S.isError && /* @__PURE__ */ H(se, {
930
935
  className: "mt-2",
931
- children: s(C.error)
936
+ children: s(S.error)
932
937
  })
933
938
  ]
934
939
  })]
935
940
  });
936
941
  }
937
- function Ee({ workspace: e, decision: t }) {
942
+ function Oe({ workspace: e, decision: t }) {
938
943
  let n = B("agentWork"), { area: i, doc: a, section: o, cites: s, checked: c, context: l, unknownTerms: u } = t;
939
944
  return /* @__PURE__ */ U(V, { children: [
940
945
  l && /* @__PURE__ */ H("p", {
@@ -949,12 +954,12 @@ function Ee({ workspace: e, decision: t }) {
949
954
  className: "mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",
950
955
  children: [i && /* @__PURE__ */ U("span", {
951
956
  className: "flex items-center gap-1",
952
- children: [/* @__PURE__ */ H(x, { className: "size-3.5" }), i.title]
957
+ children: [/* @__PURE__ */ H(b, { className: "size-3.5" }), i.title]
953
958
  }), a && /* @__PURE__ */ U(r, {
954
959
  to: "/$workspace/docs/$doc",
955
960
  params: {
956
961
  workspace: e,
957
- doc: v(a)
962
+ doc: _(a)
958
963
  },
959
964
  className: "flex min-w-0 items-center gap-1 hover:text-foreground",
960
965
  children: [/* @__PURE__ */ H(S, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ H("span", {
@@ -1004,7 +1009,7 @@ function Ee({ workspace: e, decision: t }) {
1004
1009
  })
1005
1010
  ] });
1006
1011
  }
1007
- function De(e) {
1012
+ function ke(e) {
1008
1013
  let t = /```[^\n]*\n([^\n]*)/.exec(e);
1009
1014
  return t?.[1] ? {
1010
1015
  text: t[1],
@@ -1014,7 +1019,7 @@ function De(e) {
1014
1019
  code: !1
1015
1020
  };
1016
1021
  }
1017
- function Oe({ workspace: e, decisions: t }) {
1022
+ function Ae({ workspace: e, decisions: t }) {
1018
1023
  let n = B("agentWork"), r = D(), i = q();
1019
1024
  return /* @__PURE__ */ H(M, {
1020
1025
  defaultOpen: !0,
@@ -1027,7 +1032,7 @@ function Oe({ workspace: e, decisions: t }) {
1027
1032
  let a = t.options.find((e) => e.id === t.answer?.optionId), o = a && i(t, a) || t.answer?.text || "", s = t.merge || t.release ? {
1028
1033
  text: n("answeredLabel"),
1029
1034
  code: !1
1030
- } : De(t.prompt);
1035
+ } : ke(t.prompt);
1031
1036
  return /* @__PURE__ */ H("li", { children: /* @__PURE__ */ H(M, {
1032
1037
  summaryClassName: "w-full min-w-0 px-3 py-2 hover:bg-muted/50",
1033
1038
  summary: /* @__PURE__ */ U("span", {
@@ -1050,7 +1055,7 @@ function Oe({ workspace: e, decisions: t }) {
1050
1055
  }),
1051
1056
  children: /* @__PURE__ */ H("div", {
1052
1057
  className: "px-3 pb-3 pl-8",
1053
- children: /* @__PURE__ */ H(ke, {
1058
+ children: /* @__PURE__ */ H(je, {
1054
1059
  workspace: e,
1055
1060
  decision: t,
1056
1061
  bare: !0
@@ -1061,9 +1066,9 @@ function Oe({ workspace: e, decisions: t }) {
1061
1066
  })
1062
1067
  });
1063
1068
  }
1064
- function ke({ workspace: e, decision: t, showIssue: a = !1, showWorkspace: o = !1, bare: s = !1 }) {
1065
- let c = T(e), l = B("agentWork"), u = D(), { person: d } = te(e), f = se(), p = _(), m = i(), [g, v] = z(!1), y = q(), b = t.options.find((e) => e.id === t.answer?.optionId), x = [b && y(t, b), t.answer?.text].filter(Boolean).join(". "), S = !!t.breakdown?.length || !!t.merge || !!t.release, C = () => v(!0), ee = Y(t), E = (r) => f(r, [
1066
- ...S ? [] : [t.savedAs ? {
1069
+ function je({ workspace: e, decision: t, showIssue: a = !1, showWorkspace: o = !1, bare: s = !1 }) {
1070
+ let c = T(e), l = B("agentWork"), u = D(), { person: d } = ne(e), f = le(), p = g(), m = i(), [ee, _] = z(!1), v = q(), y = t.options.find((e) => e.id === t.answer?.optionId), b = [y && v(t, y), t.answer?.text].filter(Boolean).join(". "), x = !!t.breakdown?.length || !!t.merge || !!t.release, S = () => _(!0), C = Y(t), w = (r) => f(r, [
1071
+ ...x ? [] : [t.savedAs ? {
1067
1072
  label: l("savedAsDecision"),
1068
1073
  onClick: () => m({
1069
1074
  to: "/$workspace/knowledge/$term",
@@ -1074,12 +1079,12 @@ function ke({ workspace: e, decision: t, showIssue: a = !1, showWorkspace: o = !
1074
1079
  })
1075
1080
  } : {
1076
1081
  label: l("saveAsDecision"),
1077
- onClick: C
1082
+ onClick: S
1078
1083
  }],
1079
- ...ee,
1080
- oe,
1084
+ ...C,
1085
+ ce,
1081
1086
  ...p(n(e, t.identifier))
1082
- ]), ne = /* @__PURE__ */ U(V, { children: [
1087
+ ]), E = /* @__PURE__ */ U(V, { children: [
1083
1088
  /* @__PURE__ */ U("p", {
1084
1089
  className: "flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground",
1085
1090
  children: [
@@ -1106,21 +1111,21 @@ function ke({ workspace: e, decision: t, showIssue: a = !1, showWorkspace: o = !
1106
1111
  }),
1107
1112
  /* @__PURE__ */ H("div", {
1108
1113
  className: "mt-1.5",
1109
- children: /* @__PURE__ */ H(we, {
1114
+ children: /* @__PURE__ */ H(Ee, {
1110
1115
  decision: t,
1111
1116
  className: "text-sm"
1112
1117
  })
1113
1118
  }),
1114
1119
  /* @__PURE__ */ H("p", {
1115
1120
  className: "mt-1 font-medium",
1116
- children: x
1121
+ children: b
1117
1122
  }),
1118
1123
  /* @__PURE__ */ H(J, {
1119
1124
  workspace: e,
1120
1125
  decision: t
1121
1126
  }),
1122
1127
  /* @__PURE__ */ H("div", {
1123
- className: S ? "hidden" : "mt-2",
1128
+ className: x ? "hidden" : "mt-2",
1124
1129
  children: t.savedAs ? /* @__PURE__ */ H(r, {
1125
1130
  to: "/$workspace/knowledge/$term",
1126
1131
  params: {
@@ -1131,32 +1136,32 @@ function ke({ workspace: e, decision: t, showIssue: a = !1, showWorkspace: o = !
1131
1136
  children: l("savedAsDecision")
1132
1137
  }) : /* @__PURE__ */ H(A, {
1133
1138
  size: "sm",
1134
- onClick: C,
1139
+ onClick: S,
1135
1140
  children: l("saveAsDecision")
1136
1141
  })
1137
1142
  }),
1138
- g && /* @__PURE__ */ H(ce, { children: /* @__PURE__ */ H(w, {
1143
+ ee && /* @__PURE__ */ H(ue, { children: /* @__PURE__ */ H(te, {
1139
1144
  workspace: e,
1140
1145
  mode: {
1141
1146
  kind: "create",
1142
1147
  defaults: h(t, (e) => l("decisionDefinition", e))
1143
1148
  },
1144
- onClose: () => v(!1)
1149
+ onClose: () => _(!1)
1145
1150
  }) })
1146
1151
  ] });
1147
1152
  return s ? /* @__PURE__ */ H("article", {
1148
- onContextMenu: E,
1153
+ onContextMenu: w,
1149
1154
  "aria-label": l("answeredLabel"),
1150
1155
  className: "text-sm",
1151
- children: ne
1152
- }) : /* @__PURE__ */ H(ie, {
1156
+ children: E
1157
+ }) : /* @__PURE__ */ H(oe, {
1153
1158
  size: "fill",
1154
1159
  className: "text-sm",
1155
1160
  render: /* @__PURE__ */ H("article", {
1156
- onContextMenu: E,
1161
+ onContextMenu: w,
1157
1162
  "aria-label": l("answeredLabel")
1158
1163
  }),
1159
- children: ne
1164
+ children: E
1160
1165
  });
1161
1166
  }
1162
- export { _e as AgentWork, ke as AnsweredDecision, $ as DecisionCard, ge as useMoney, q as useOptionLabel };
1167
+ export { ye as AgentWork, je as AnsweredDecision, $ as DecisionCard, ve as useMoney, q as useOptionLabel };