@burdenoff/microfe-stewards 2026.1201.4 → 2026.1202.2

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.
@@ -7,98 +7,124 @@ import { useDeskStream as s } from "../live/useDeskStream.js";
7
7
  import { ControlBanner as c } from "./ControlBanner.js";
8
8
  import { Alert as l, Button as u, Card as d } from "./ui.js";
9
9
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
10
- import { useCallback as m, useEffect as h, useState as g } from "react";
11
- import { useAuthTokenOrNull as _ } from "@burdenoff/fe-libs/shared/providers/shell";
10
+ import { useCallback as m, useState as h } from "react";
11
+ import { useAuthTokenOrNull as g } from "@burdenoff/fe-libs/shared/providers/shell";
12
12
  // src/stewards/components/LiveDeskPanel.tsx
13
- var v = 5e3, y = /* @__PURE__ */ new Set([
13
+ var _ = 5e3, v = /* @__PURE__ */ new Set([
14
14
  r.Queued,
15
15
  r.Running,
16
16
  r.WaitingApproval
17
17
  ]);
18
- function b({ runId: a, status: b, canExecute: S }) {
19
- let C = i(), w = _()?.userId ?? null, T = s(a), { start: E, stop: D, state: O } = T, k = e({
20
- variables: { id: a },
18
+ function y(i, a, o) {
19
+ let s = g()?.userId ?? null, c = e({
20
+ variables: { id: i },
21
21
  fetchPolicy: "cache-and-network",
22
- pollInterval: v
23
- }).data?.getBotmanorStewardRun?.takenOverBy ?? null, [A, j] = n(), [M, N] = t(), P = b === r.WaitingTakeover && k !== null && k === w, F = P ? "control" : "view", [I, L] = g(!1), [R, z] = g(!1), B = I || P;
24
- h(() => {
25
- B ? E(F) : D();
26
- }, [
27
- B,
28
- F,
29
- E,
30
- D
31
- ]);
32
- let V = m(() => {
33
- z(!1), A({ variables: { id: a } }).then(() => L(!0)).catch(() => void 0);
34
- }, [a, A]), H = m(() => {
35
- M({ variables: { id: a } }).then(() => {
36
- L(!1), z(!0);
22
+ pollInterval: _
23
+ }).data?.getBotmanorStewardRun?.takenOverBy ?? null, [l, u] = n(), [d, f] = t(), p = a === r.WaitingTakeover && c !== null && c === s, [y, b] = h(!1), [x, S] = h(!1), C = m(() => {
24
+ S(!1), l({ variables: { id: i } }).then(() => b(!0)).catch(() => void 0);
25
+ }, [i, l]), w = m(() => {
26
+ d({ variables: { id: i } }).then(() => {
27
+ b(!1), S(!0);
37
28
  }).catch(() => void 0);
38
- }, [a, M]), U = o(O, P), W = O.phase === "live", G = O.phase === "ended" || O.phase === "failed", K = S && !P && y.has(b), q = j.error ?? N.error;
29
+ }, [i, d]);
30
+ return {
31
+ iAmInControl: p,
32
+ canTakeOver: o && !p && v.has(a),
33
+ canHandBack: o && p,
34
+ watching: y,
35
+ setWatching: b,
36
+ handedBack: x,
37
+ doTakeOver: C,
38
+ doHandBack: w,
39
+ takingOver: u.loading,
40
+ handingBack: f.loading,
41
+ actionError: u.error ?? f.error
42
+ };
43
+ }
44
+ function b({ runId: e, status: t, canExecute: n }) {
45
+ let r = i(), a = y(e, t, n), { iAmInControl: u } = a, m = a.watching || u, h = u ? "control" : "view", g = s(e, m ? h : null), { state: _ } = g, v = o(_, u), b = m && _.phase !== "idle" && !x(_);
39
46
  return /* @__PURE__ */ f(d, {
40
- title: C("stewards.desk.title"),
41
- hint: C("stewards.desk.hint"),
47
+ title: r("stewards.desk.title"),
48
+ hint: r("stewards.desk.hint"),
42
49
  children: /* @__PURE__ */ p("div", {
43
50
  className: "flex flex-col gap-3",
44
51
  children: [
45
- !B && !R && /* @__PURE__ */ f("p", {
46
- className: "text-sm text-(color:--color-text-secondary)",
47
- children: C("stewards.desk.intro")
48
- }),
49
- R && !B && /* @__PURE__ */ f(l, {
50
- tone: "success",
51
- children: C("stewards.desk.handedBack")
52
+ /* @__PURE__ */ f(S, {
53
+ t: r,
54
+ active: m,
55
+ handedBack: a.handedBack
52
56
  }),
53
- U && /* @__PURE__ */ f(c, {
54
- banner: U,
55
- t: C
57
+ v && /* @__PURE__ */ f(c, {
58
+ banner: v,
59
+ t: r
56
60
  }),
57
- B && O.phase !== "idle" && !G && /* @__PURE__ */ f(x, {
58
- stream: T,
59
- state: O,
60
- interactive: W && O.mode === "control"
61
+ b && /* @__PURE__ */ f(w, {
62
+ stream: g,
63
+ state: _,
64
+ interactive: _.phase === "live" && _.mode === "control"
61
65
  }),
62
- q && /* @__PURE__ */ p(l, { children: [
63
- C("stewards.desk.actionError"),
66
+ a.actionError && /* @__PURE__ */ p(l, { children: [
67
+ r("stewards.desk.actionError"),
64
68
  " ",
65
- q.message
69
+ a.actionError.message
66
70
  ] }),
67
- /* @__PURE__ */ p("div", {
68
- className: "flex flex-wrap gap-2",
69
- children: [
70
- !B && /* @__PURE__ */ f(u, {
71
- variant: "primary",
72
- onClick: () => L(!0),
73
- children: C("stewards.desk.watch")
74
- }),
75
- B && !P && !G && /* @__PURE__ */ f(u, {
76
- onClick: () => L(!1),
77
- children: C("stewards.desk.stopWatching")
78
- }),
79
- B && G && /* @__PURE__ */ f(u, {
80
- variant: "primary",
81
- onClick: () => E(F),
82
- children: O.reason === "idle" || O.reason === "leaseEnded" ? C("stewards.desk.watchAgain") : C("stewards.desk.reconnect")
83
- }),
84
- K && /* @__PURE__ */ f(u, {
85
- disabled: j.loading,
86
- onClick: V,
87
- children: j.loading ? C("stewards.desk.takingOver") : C("stewards.desk.takeOver")
88
- }),
89
- S && P && /* @__PURE__ */ f(u, {
90
- variant: "primary",
91
- disabled: N.loading,
92
- onClick: H,
93
- children: N.loading ? C("stewards.desk.handingBack") : C("stewards.desk.handBack")
94
- })
95
- ]
71
+ /* @__PURE__ */ f(C, {
72
+ t: r,
73
+ control: a,
74
+ active: m,
75
+ state: _,
76
+ onReconnect: () => g.start(h)
96
77
  })
97
78
  ]
98
79
  })
99
80
  });
100
81
  }
101
- function x({ stream: e, state: t, interactive: n }) {
82
+ function x(e) {
83
+ return e.phase === "ended" || e.phase === "failed";
84
+ }
85
+ function S({ t: e, active: t, handedBack: n }) {
86
+ return t ? null : n ? /* @__PURE__ */ f(l, {
87
+ tone: "success",
88
+ children: e("stewards.desk.handedBack")
89
+ }) : /* @__PURE__ */ f("p", {
90
+ className: "text-sm text-(color:--color-text-secondary)",
91
+ children: e("stewards.desk.intro")
92
+ });
93
+ }
94
+ function C({ t: e, control: t, active: n, state: r, onReconnect: i }) {
95
+ let { iAmInControl: a, setWatching: o, takingOver: s, handingBack: c } = t, l = x(r), d = r.reason === "idle" || r.reason === "leaseEnded" ? e("stewards.desk.watchAgain") : e("stewards.desk.reconnect");
96
+ return /* @__PURE__ */ p("div", {
97
+ className: "flex flex-wrap gap-2",
98
+ children: [
99
+ !n && /* @__PURE__ */ f(u, {
100
+ variant: "primary",
101
+ onClick: () => o(!0),
102
+ children: e("stewards.desk.watch")
103
+ }),
104
+ n && !a && !l && /* @__PURE__ */ f(u, {
105
+ onClick: () => o(!1),
106
+ children: e("stewards.desk.stopWatching")
107
+ }),
108
+ n && l && /* @__PURE__ */ f(u, {
109
+ variant: "primary",
110
+ onClick: i,
111
+ children: d
112
+ }),
113
+ t.canTakeOver && /* @__PURE__ */ f(u, {
114
+ disabled: s,
115
+ onClick: t.doTakeOver,
116
+ children: e(s ? "stewards.desk.takingOver" : "stewards.desk.takeOver")
117
+ }),
118
+ t.canHandBack && /* @__PURE__ */ f(u, {
119
+ variant: "primary",
120
+ disabled: c,
121
+ onClick: t.doHandBack,
122
+ children: e(c ? "stewards.desk.handingBack" : "stewards.desk.handBack")
123
+ })
124
+ ]
125
+ });
126
+ }
127
+ function w({ stream: e, state: t, interactive: n }) {
102
128
  let r = i();
103
129
  return /* @__PURE__ */ p("div", {
104
130
  className: "flex flex-col gap-1",
@@ -1 +1 @@
1
- {"version":3,"file":"LiveDeskPanel.js","names":["TAKEOVER_POLL_MS","TAKEOVER_FROM","BotmanorStewardRunStatus","LiveDeskPanel","t","useStewardsT","userId","useAuthTokenOrNull","stream","useDeskStream","runId","takenOverBy","useGetBotmanorStewardRunTakeoverQuery","takeOver","takeOverState","useTakeOverBotmanorStewardRunMutation","handBack","handBackState","useHandBackBotmanorStewardRunMutation","iAmInControl","status","desiredMode","watching","setWatching","useState","handedBack","setHandedBack","active","start","stop","doTakeOver","useCallback","doHandBack","banner","describeStream","state","live","stopped","canTakeOver","canExecute","actionError","Card","Alert","ControlBanner","DeskScreen","Button","DeskCanvas"],"sources":["../../../src/stewards/components/LiveDeskPanel.tsx"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\nimport { useAuthTokenOrNull } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n useGetBotmanorStewardRunTakeoverQuery,\n useHandBackBotmanorStewardRunMutation,\n useTakeOverBotmanorStewardRunMutation,\n} from '../../generated/wspace-operations';\nimport { BotmanorStewardRunStatus } from '../../generated/wspace-types';\nimport { useStewardsT } from '../i18n/useStewardsT';\nimport { DeskCanvas } from '../live/DeskCanvas';\nimport { describeStream } from '../live/describeStream';\nimport type { StreamState } from '../live/DeskStreamConnection';\nimport { useDeskStream } from '../live/useDeskStream';\nimport { ControlBanner } from './ControlBanner';\nimport { Alert, Button, Card } from './ui';\n\n/** How often to look for a takeover made by someone else while the panel is open. */\nconst TAKEOVER_POLL_MS = 5000;\n\nconst TAKEOVER_FROM: ReadonlySet<BotmanorStewardRunStatus> = new Set([\n BotmanorStewardRunStatus.Queued,\n BotmanorStewardRunStatus.Running,\n BotmanorStewardRunStatus.WaitingApproval,\n]);\n\ninterface LiveDeskPanelProps {\n runId: string;\n status: BotmanorStewardRunStatus;\n /** `botmanor-steward:execute`: needed to take over and hand back. Watching needs only read. */\n canExecute: boolean;\n}\n\n/**\n * Live view of a run's desk with Take over and Hand back (BOFF-16552).\n *\n * Watching is opt-in: nothing connects until the person asks, except when they already hold the\n * run (a page reload mid-takeover), where the stream is the point of being here. Taking over\n * pauses the Steward and reconnects in control mode; handing back closes the stream and queues\n * the run to continue from its checkpoint.\n */\nexport function LiveDeskPanel({ runId, status, canExecute }: LiveDeskPanelProps) {\n const t = useStewardsT();\n const userId = useAuthTokenOrNull()?.userId ?? null;\n const stream = useDeskStream(runId);\n const { start, stop, state } = stream;\n\n const takeoverQuery = useGetBotmanorStewardRunTakeoverQuery({\n variables: { id: runId },\n fetchPolicy: 'cache-and-network',\n pollInterval: TAKEOVER_POLL_MS,\n });\n const takenOverBy = takeoverQuery.data?.getBotmanorStewardRun?.takenOverBy ?? null;\n const [takeOver, takeOverState] = useTakeOverBotmanorStewardRunMutation();\n const [handBack, handBackState] = useHandBackBotmanorStewardRunMutation();\n\n const waiting = status === BotmanorStewardRunStatus.WaitingTakeover;\n // The server names who holds the run. Compare it with the signed-in person.\n const iAmInControl = waiting && takenOverBy !== null && takenOverBy === userId;\n const desiredMode = iAmInControl ? 'control' : 'view';\n\n const [watching, setWatching] = useState(false);\n const [handedBack, setHandedBack] = useState(false);\n const active = watching || iAmInControl;\n\n // Connect when wanted, and reconnect in the right mode when control changes hands.\n useEffect(() => {\n if (active) start(desiredMode);\n else stop();\n }, [active, desiredMode, start, stop]);\n\n const doTakeOver = useCallback(() => {\n setHandedBack(false);\n void takeOver({ variables: { id: runId } })\n .then(() => setWatching(true))\n .catch(() => undefined);\n }, [runId, takeOver]);\n\n const doHandBack = useCallback(() => {\n void handBack({ variables: { id: runId } })\n .then(() => {\n setWatching(false);\n setHandedBack(true);\n })\n .catch(() => undefined);\n }, [runId, handBack]);\n\n const banner = describeStream(state, iAmInControl);\n const live = state.phase === 'live';\n const stopped = state.phase === 'ended' || state.phase === 'failed';\n const canTakeOver = canExecute && !iAmInControl && TAKEOVER_FROM.has(status);\n const actionError = takeOverState.error ?? handBackState.error;\n\n return (\n <Card title={t('stewards.desk.title')} hint={t('stewards.desk.hint')}>\n <div className=\"flex flex-col gap-3\">\n {!active && !handedBack && (\n <p className=\"text-sm text-(color:--color-text-secondary)\">{t('stewards.desk.intro')}</p>\n )}\n {handedBack && !active && <Alert tone=\"success\">{t('stewards.desk.handedBack')}</Alert>}\n {banner && <ControlBanner banner={banner} t={t} />}\n {active && state.phase !== 'idle' && !stopped && (\n <DeskScreen\n stream={stream}\n state={state}\n interactive={live && state.mode === 'control'}\n />\n )}\n {actionError && (\n <Alert>\n {t('stewards.desk.actionError')} {actionError.message}\n </Alert>\n )}\n <div className=\"flex flex-wrap gap-2\">\n {!active && (\n <Button variant=\"primary\" onClick={() => setWatching(true)}>\n {t('stewards.desk.watch')}\n </Button>\n )}\n {active && !iAmInControl && !stopped && (\n <Button onClick={() => setWatching(false)}>{t('stewards.desk.stopWatching')}</Button>\n )}\n {active && stopped && (\n <Button variant=\"primary\" onClick={() => start(desiredMode)}>\n {state.reason === 'idle' || state.reason === 'leaseEnded'\n ? t('stewards.desk.watchAgain')\n : t('stewards.desk.reconnect')}\n </Button>\n )}\n {canTakeOver && (\n <Button disabled={takeOverState.loading} onClick={doTakeOver}>\n {takeOverState.loading ? t('stewards.desk.takingOver') : t('stewards.desk.takeOver')}\n </Button>\n )}\n {canExecute && iAmInControl && (\n <Button variant=\"primary\" disabled={handBackState.loading} onClick={doHandBack}>\n {handBackState.loading ? t('stewards.desk.handingBack') : t('stewards.desk.handBack')}\n </Button>\n )}\n </div>\n </div>\n </Card>\n );\n}\n\nfunction DeskScreen({\n stream,\n state,\n interactive,\n}: {\n stream: ReturnType<typeof useDeskStream>;\n state: StreamState;\n interactive: boolean;\n}) {\n const t = useStewardsT();\n return (\n <div className=\"flex flex-col gap-1\">\n <DeskCanvas\n registerSink={stream.setFrameSink}\n interactive={interactive}\n send={stream.send}\n label={\n state.mode === 'control'\n ? t('stewards.desk.canvasLabelControl')\n : t('stewards.desk.canvasLabelView')\n }\n hint={t('stewards.desk.controlHint')}\n />\n {state.phase === 'live' && !state.hasFrame && (\n <p className=\"text-xs text-(color:--color-text-secondary)\" role=\"status\">\n {t('stewards.desk.waitingFrame')}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAMA,IAAmB,KAEnBC,oBAAuD,IAAI,IAAI;CACnEC,EAAyB;CACzBA,EAAyB;CACzBA,EAAyB;AAC3B,CAAC;AAiBD,SA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AAwB;MAC7E,CAAA;MAETmC,KAAcpB,KACb,kBAAC0B,GAAD;OAAQ,SAAQ;OAAU,UAAU5B,EAAc;OAAS,SAASe;OACjE,UAAAf,EAAc,UAAUb,EAAE,2BAA2B,IAAIA,EAAE,wBAAwB;MAC9E,CAAA;KAEP;;GACF;;CACD,CAAA;AAEV;AAEA,SAASwC,EAAW,EAClB,WACA,UACA,kBAKC;CACD,IAAMxC,IAAIC,EAAa;CACvB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACyC,GAAD;GACE,cAActC,EAAO;GACR;GACb,MAAMA,EAAO;GACb,OACE2B,EAAM,SAAS,YACX/B,EAAE,kCAAkC,IACpCA,EAAE,+BAA+B;GAEvC,MAAMA,EAAE,2BAA2B;EACpC,CAAA,GACA+B,EAAM,UAAU,UAAU,CAACA,EAAM,YAChC,kBAAC,KAAD;GAAG,WAAU;GAA8C,MAAK;GAC7D,UAAA/B,EAAE,4BAA4B;EAC9B,CAAA,CAEF;;AAET"}
1
+ {"version":3,"file":"LiveDeskPanel.js","names":["TAKEOVER_POLL_MS","TAKEOVER_FROM","BotmanorStewardRunStatus","useDeskControl","userId","useAuthTokenOrNull","takenOverBy","useGetBotmanorStewardRunTakeoverQuery","runId","takeOver","takeOverState","useTakeOverBotmanorStewardRunMutation","handBack","handBackState","useHandBackBotmanorStewardRunMutation","iAmInControl","status","watching","setWatching","useState","handedBack","setHandedBack","doTakeOver","useCallback","doHandBack","canExecute","LiveDeskPanel","t","useStewardsT","control","active","desiredMode","stream","useDeskStream","banner","describeStream","state","showScreen","isStopped","Card","DeskIntro","ControlBanner","DeskScreen","Alert","DeskActions","stopped","reconnectLabel","Button","onReconnect","takingOver","handingBack","DeskCanvas"],"sources":["../../../src/stewards/components/LiveDeskPanel.tsx"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { useAuthTokenOrNull } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n useGetBotmanorStewardRunTakeoverQuery,\n useHandBackBotmanorStewardRunMutation,\n useTakeOverBotmanorStewardRunMutation,\n} from '../../generated/wspace-operations';\nimport { BotmanorStewardRunStatus } from '../../generated/wspace-types';\nimport { useStewardsT } from '../i18n/useStewardsT';\nimport { DeskCanvas } from '../live/DeskCanvas';\nimport { describeStream } from '../live/describeStream';\nimport type { StreamState } from '../live/DeskStreamConnection';\nimport { useDeskStream, type DeskStream } from '../live/useDeskStream';\nimport type { StewardsT } from '../i18n/useStewardsT';\nimport { ControlBanner } from './ControlBanner';\nimport { Alert, Button, Card } from './ui';\n\n/** How often to look for a takeover made by someone else while the panel is open. */\nconst TAKEOVER_POLL_MS = 5000;\n\nconst TAKEOVER_FROM: ReadonlySet<BotmanorStewardRunStatus> = new Set([\n BotmanorStewardRunStatus.Queued,\n BotmanorStewardRunStatus.Running,\n BotmanorStewardRunStatus.WaitingApproval,\n]);\n\ninterface LiveDeskPanelProps {\n runId: string;\n status: BotmanorStewardRunStatus;\n /** `botmanor-steward:execute`: needed to take over and hand back. Watching needs only read. */\n canExecute: boolean;\n}\n\n/**\n * Who holds the run and the Take over / Hand back actions. The server names the holder; the\n * panel compares it with the signed-in person.\n */\nfunction useDeskControl(runId: string, status: BotmanorStewardRunStatus, canExecute: boolean) {\n const userId = useAuthTokenOrNull()?.userId ?? null;\n const takeoverQuery = useGetBotmanorStewardRunTakeoverQuery({\n variables: { id: runId },\n fetchPolicy: 'cache-and-network',\n pollInterval: TAKEOVER_POLL_MS,\n });\n const takenOverBy = takeoverQuery.data?.getBotmanorStewardRun?.takenOverBy ?? null;\n const [takeOver, takeOverState] = useTakeOverBotmanorStewardRunMutation();\n const [handBack, handBackState] = useHandBackBotmanorStewardRunMutation();\n\n const waiting = status === BotmanorStewardRunStatus.WaitingTakeover;\n const iAmInControl = waiting && takenOverBy !== null && takenOverBy === userId;\n\n const [watching, setWatching] = useState(false);\n const [handedBack, setHandedBack] = useState(false);\n\n const doTakeOver = useCallback(() => {\n setHandedBack(false);\n void takeOver({ variables: { id: runId } })\n .then(() => setWatching(true))\n .catch(() => undefined);\n }, [runId, takeOver]);\n\n const doHandBack = useCallback(() => {\n void handBack({ variables: { id: runId } })\n .then(() => {\n setWatching(false);\n setHandedBack(true);\n })\n .catch(() => undefined);\n }, [runId, handBack]);\n\n return {\n iAmInControl,\n canTakeOver: canExecute && !iAmInControl && TAKEOVER_FROM.has(status),\n canHandBack: canExecute && iAmInControl,\n watching,\n setWatching,\n handedBack,\n doTakeOver,\n doHandBack,\n takingOver: takeOverState.loading,\n handingBack: handBackState.loading,\n actionError: takeOverState.error ?? handBackState.error,\n };\n}\n\n/**\n * Live view of a run's desk with Take over and Hand back (BOFF-16552).\n *\n * Watching is opt-in: nothing connects until the person asks, except when they already hold the\n * run (a page reload mid-takeover), where the stream is the point of being here. Taking over\n * pauses the Steward and reconnects in control mode; handing back closes the stream and queues\n * the run to continue from its checkpoint.\n */\nexport function LiveDeskPanel({ runId, status, canExecute }: LiveDeskPanelProps) {\n const t = useStewardsT();\n const control = useDeskControl(runId, status, canExecute);\n const { iAmInControl } = control;\n const active = control.watching || iAmInControl;\n const desiredMode = iAmInControl ? 'control' : 'view';\n // The hook connects when the panel is active and reconnects when control changes hands.\n const stream = useDeskStream(runId, active ? desiredMode : null);\n const { state } = stream;\n const banner = describeStream(state, iAmInControl);\n const showScreen = active && state.phase !== 'idle' && !isStopped(state);\n\n return (\n <Card title={t('stewards.desk.title')} hint={t('stewards.desk.hint')}>\n <div className=\"flex flex-col gap-3\">\n <DeskIntro t={t} active={active} handedBack={control.handedBack} />\n {banner && <ControlBanner banner={banner} t={t} />}\n {showScreen && (\n <DeskScreen\n stream={stream}\n state={state}\n interactive={state.phase === 'live' && state.mode === 'control'}\n />\n )}\n {control.actionError && (\n <Alert>\n {t('stewards.desk.actionError')} {control.actionError.message}\n </Alert>\n )}\n <DeskActions\n t={t}\n control={control}\n active={active}\n state={state}\n onReconnect={() => stream.start(desiredMode)}\n />\n </div>\n </Card>\n );\n}\n\nfunction isStopped(state: StreamState): boolean {\n return state.phase === 'ended' || state.phase === 'failed';\n}\n\n/** The opt-in explanation before watching, or the confirmation after handing back. */\nfunction DeskIntro({\n t,\n active,\n handedBack,\n}: {\n t: StewardsT;\n active: boolean;\n handedBack: boolean;\n}) {\n if (active) return null;\n if (handedBack) return <Alert tone=\"success\">{t('stewards.desk.handedBack')}</Alert>;\n return <p className=\"text-sm text-(color:--color-text-secondary)\">{t('stewards.desk.intro')}</p>;\n}\n\ninterface DeskActionsProps {\n t: StewardsT;\n control: ReturnType<typeof useDeskControl>;\n active: boolean;\n state: StreamState;\n onReconnect: () => void;\n}\n\n/** Watch, stop watching, reconnect, take over and hand back. */\nfunction DeskActions({ t, control, active, state, onReconnect }: DeskActionsProps) {\n const { iAmInControl, setWatching, takingOver, handingBack } = control;\n const stopped = isStopped(state);\n const reconnectLabel =\n state.reason === 'idle' || state.reason === 'leaseEnded'\n ? t('stewards.desk.watchAgain')\n : t('stewards.desk.reconnect');\n return (\n <div className=\"flex flex-wrap gap-2\">\n {!active && (\n <Button variant=\"primary\" onClick={() => setWatching(true)}>\n {t('stewards.desk.watch')}\n </Button>\n )}\n {active && !iAmInControl && !stopped && (\n <Button onClick={() => setWatching(false)}>{t('stewards.desk.stopWatching')}</Button>\n )}\n {active && stopped && (\n <Button variant=\"primary\" onClick={onReconnect}>\n {reconnectLabel}\n </Button>\n )}\n {control.canTakeOver && (\n <Button disabled={takingOver} onClick={control.doTakeOver}>\n {takingOver ? t('stewards.desk.takingOver') : t('stewards.desk.takeOver')}\n </Button>\n )}\n {control.canHandBack && (\n <Button variant=\"primary\" disabled={handingBack} onClick={control.doHandBack}>\n {handingBack ? t('stewards.desk.handingBack') : t('stewards.desk.handBack')}\n </Button>\n )}\n </div>\n );\n}\n\nfunction DeskScreen({\n stream,\n state,\n interactive,\n}: {\n stream: DeskStream;\n state: StreamState;\n interactive: boolean;\n}) {\n const t = useStewardsT();\n return (\n <div className=\"flex flex-col gap-1\">\n <DeskCanvas\n registerSink={stream.setFrameSink}\n interactive={interactive}\n send={stream.send}\n label={\n state.mode === 'control'\n ? t('stewards.desk.canvasLabelControl')\n : t('stewards.desk.canvasLabelView')\n }\n hint={t('stewards.desk.controlHint')}\n />\n {state.phase === 'live' && !state.hasFrame && (\n <p className=\"text-xs text-(color:--color-text-secondary)\" role=\"status\">\n {t('stewards.desk.waitingFrame')}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAMA,IAAmB,KAEnBC,oBAAuD,IAAI,IAAI;CACnEC,EAAyB;CACzBA,EAAyB;CACzBA,EAAyB;AAC3B,CAAC;AAaD,SAASC,EAAe,GAAe,GAAkC,GAAqB;CAC5F,IAAMC,IAASC,EAAmB,CAAC,EAAE,UAAU,MAMzCC,IALgBC,EAAsC;EAC1D,WAAW,EAAE,IAAIC,EAAM;EACvB,aAAa;EACb,cAAcR;CAChB,CACoB,CAAA,CAAc,MAAM,uBAAuB,eAAe,MACxE,CAACS,GAAUC,KAAiBC,EAAsC,GAClE,CAACC,GAAUC,KAAiBC,EAAsC,GAGlEC,IADUC,MAAWd,EAAyB,mBACpBI,MAAgB,QAAQA,MAAgBF,GAElE,CAACa,GAAUC,KAAeC,EAAS,EAAK,GACxC,CAACC,GAAYC,KAAiBF,EAAS,EAAK,GAE5CG,IAAaC,QAAkB;EAEnC,AADAF,EAAc,EAAK,GACnBZ,EAAc,EAAE,WAAW,EAAE,IAAID,EAAM,EAAE,CAAC,CAAC,CACxC,WAAWU,EAAY,EAAI,CAAC,CAAC,CAC7B,YAAY,KAAA,CAAS;CAC1B,GAAG,CAACV,GAAOC,CAAQ,CAAC,GAEde,IAAaD,QAAkB;EACnC,EAAc,EAAE,WAAW,EAAE,IAAIf,EAAM,EAAE,CAAC,CAAC,CACxC,WAAW;GAEV,AADAU,EAAY,EAAK,GACjBG,EAAc,EAAI;EACpB,CAAC,CAAC,CACD,YAAY,KAAA,CAAS;CAC1B,GAAG,CAACb,GAAOI,CAAQ,CAAC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ACEI,EAAM,SAAS,YACXT,EAAE,kCAAkC,IACpCA,EAAE,+BAA+B;GAEvC,MAAMA,EAAE,2BAA2B;EACpC,CAAA,GACAS,EAAM,UAAU,UAAU,CAACA,EAAM,YAChC,kBAAC,KAAD;GAAG,WAAU;GAA8C,MAAK;GAC7D,UAAAT,EAAE,4BAA4B;EAC9B,CAAA,CAEF;;AAET"}
@@ -0,0 +1,36 @@
1
+ import { StewardDetailFieldsFragment, StewardRunDetailFieldsFragment } from '../../../generated/wspace-operations';
2
+ type Run = StewardRunDetailFieldsFragment;
3
+ type Steward = StewardDetailFieldsFragment | undefined;
4
+ /**
5
+ * Stop, retry and retry-live for one run. Another run of the same steward still in flight
6
+ * blocks a retry, so two runs never act on the same desk at once.
7
+ */
8
+ export declare function useRunActions(run: Run, steward: Steward): {
9
+ readonly finished: boolean;
10
+ readonly canRetry: boolean;
11
+ readonly stop: () => undefined;
12
+ readonly stopping: boolean;
13
+ readonly stopError: import('@apollo/client').ErrorLike | undefined;
14
+ readonly startAgain: (dryRun: boolean) => void;
15
+ readonly retrying: boolean;
16
+ readonly retryError: import('@apollo/client').ErrorLike | undefined;
17
+ readonly retryBlocked: boolean;
18
+ readonly retryBlockedReason: "status" | "active" | null;
19
+ readonly confirmLive: boolean;
20
+ readonly setConfirmLive: import('react').Dispatch<import('react').SetStateAction<boolean>>;
21
+ };
22
+ export type RunActions = ReturnType<typeof useRunActions>;
23
+ /** Title, status, steward link, trigger and the run's actions. */
24
+ export declare function RunHeader({ run, steward, zone, canExecute, actions, }: {
25
+ run: Run;
26
+ steward: Steward;
27
+ zone: string;
28
+ canExecute: boolean;
29
+ actions: RunActions;
30
+ }): import('react').JSX.Element;
31
+ /** Errors, the retry-blocked note and the retry-live confirmation under the header. */
32
+ export declare function RunActionNotices({ canExecute, actions, }: {
33
+ canExecute: boolean;
34
+ actions: RunActions;
35
+ }): import('react').JSX.Element;
36
+ export {};
@@ -0,0 +1,163 @@
1
+ import { useCancelBotmanorStewardRunMutation as e, useListBotmanorStewardRunsQuery as t, useRunBotmanorStewardMutation as n } from "../../../generated/wspace-operations.js";
2
+ import { BotmanorStewardStatus as r } from "../../../generated/wspace-types.js";
3
+ import { useStewardsT as i } from "../../i18n/useStewardsT.js";
4
+ import { useStewardsContext as a } from "../../providers/StewardsProvider.js";
5
+ import { clockTime as o } from "../../utils/dates.js";
6
+ import { RUN_STATUS_TONE as s, enumLabel as c, isRunFinished as l } from "../stewardLabels.js";
7
+ import { Alert as u, Badge as d, Button as f } from "../ui.js";
8
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ import { useState as g } from "react";
10
+ // src/stewards/components/run/RunHeader.tsx
11
+ function _(i, o) {
12
+ let { navigate: s, pathTo: c } = a(), u = l(i.status), d = i.execution?.input ?? "", [f, p] = e(), [m, h] = n(), [_, v] = g(!1), y = t({
13
+ variables: {
14
+ filter: { stewardId: i.stewardId },
15
+ pagination: { limit: 20 }
16
+ },
17
+ skip: !u,
18
+ fetchPolicy: "cache-and-network"
19
+ }), b = (y.data?.listBotmanorStewardRuns ?? []).some((e) => e.id !== i.id && !l(e.status)), x = o?.status !== r.Active || b || y.loading;
20
+ return {
21
+ finished: u,
22
+ canRetry: u && d !== "",
23
+ stop: () => void f({ variables: { id: i.id } }).catch(() => void 0),
24
+ stopping: p.loading,
25
+ stopError: p.error,
26
+ startAgain: (e) => {
27
+ v(!1), m({ variables: { input: {
28
+ stewardId: i.stewardId,
29
+ prompt: d,
30
+ dryRun: e
31
+ } } }).then(({ data: e }) => {
32
+ e?.runBotmanorSteward.id && s(c("runs", e.runBotmanorSteward.id));
33
+ }).catch(() => void 0);
34
+ },
35
+ retrying: h.loading,
36
+ retryError: h.error,
37
+ retryBlocked: x,
38
+ retryBlockedReason: y.loading ? null : b ? "active" : "status",
39
+ confirmLive: _,
40
+ setConfirmLive: v
41
+ };
42
+ }
43
+ function v(e, t, n) {
44
+ return n.retrying ? e("stewards.run.retrying") : t.dryRun ? e("stewards.run.retry") : e("stewards.run.retryLive");
45
+ }
46
+ function y({ run: e, actions: t }) {
47
+ let n = i(), r = t.retrying || t.retryBlocked;
48
+ return t.finished ? t.canRetry ? /* @__PURE__ */ h(p, { children: [!e.dryRun && /* @__PURE__ */ m(f, {
49
+ variant: "primary",
50
+ disabled: r,
51
+ onClick: () => t.startAgain(!0),
52
+ children: n("stewards.run.retryDry")
53
+ }), /* @__PURE__ */ m(f, {
54
+ disabled: r,
55
+ onClick: () => e.dryRun ? t.startAgain(!0) : t.setConfirmLive(!0),
56
+ children: v(n, e, t)
57
+ })] }) : null : /* @__PURE__ */ m(f, {
58
+ variant: "danger",
59
+ disabled: t.stopping,
60
+ onClick: t.stop,
61
+ children: t.stopping ? n("stewards.run.stopping") : n("stewards.run.stopRun")
62
+ });
63
+ }
64
+ function b(e, t, n, r) {
65
+ let i = [`${e("stewards.run.trigger")}: ${c(e, "trigger", t.trigger)}`];
66
+ return n && i.push(`${e("stewards.run.autonomy")}: ${c(e, "autonomy", n.charter.autonomyLevel)}`), t.startedAt && i.push(`${e("stewards.run.started")} ${o(t.startedAt, r)}`), i.join(" · ");
67
+ }
68
+ function x({ run: e, steward: t, zone: n, canExecute: r, actions: o }) {
69
+ let l = i(), { navigate: u, pathTo: f } = a();
70
+ return /* @__PURE__ */ h("header", {
71
+ className: "flex flex-wrap items-start justify-between gap-3",
72
+ children: [/* @__PURE__ */ h("div", { children: [
73
+ /* @__PURE__ */ h("div", {
74
+ className: "flex flex-wrap items-center gap-2",
75
+ children: [
76
+ /* @__PURE__ */ h("h1", {
77
+ className: "text-xl font-semibold text-(color:--color-text-primary)",
78
+ children: [
79
+ l("stewards.run.title"),
80
+ " ",
81
+ /* @__PURE__ */ m("code", {
82
+ className: "text-base",
83
+ children: e.id
84
+ })
85
+ ]
86
+ }),
87
+ /* @__PURE__ */ m(d, {
88
+ tone: s[e.status],
89
+ children: c(l, "runStatus", e.status)
90
+ }),
91
+ e.dryRun && /* @__PURE__ */ m(d, {
92
+ tone: "info",
93
+ children: l("stewards.run.dryBadge")
94
+ })
95
+ ]
96
+ }),
97
+ /* @__PURE__ */ h("p", {
98
+ className: "text-sm text-(color:--color-text-secondary)",
99
+ children: [
100
+ l("stewards.run.steward"),
101
+ ":",
102
+ " ",
103
+ /* @__PURE__ */ m("button", {
104
+ type: "button",
105
+ className: "text-(color:--color-text-primary) hover:underline",
106
+ onClick: () => u(f(e.stewardId)),
107
+ children: t?.agent?.name ?? e.stewardId
108
+ }),
109
+ " ",
110
+ "· ",
111
+ b(l, e, t, n)
112
+ ]
113
+ }),
114
+ e.stopReason && /* @__PURE__ */ m("p", {
115
+ className: "text-sm text-(color:--color-text-secondary)",
116
+ children: l("stewards.run.stopReason", { reason: e.stopReason })
117
+ })
118
+ ] }), r && /* @__PURE__ */ m("div", {
119
+ className: "flex flex-wrap gap-2",
120
+ children: /* @__PURE__ */ m(y, {
121
+ run: e,
122
+ actions: o
123
+ })
124
+ })]
125
+ });
126
+ }
127
+ function S({ canExecute: e, actions: t }) {
128
+ let n = i(), r = e && t.canRetry && t.retryBlocked ? t.retryBlockedReason : null;
129
+ return /* @__PURE__ */ h(p, { children: [
130
+ t.stopError && /* @__PURE__ */ h(u, { children: [
131
+ n("stewards.run.cancelError"),
132
+ " ",
133
+ t.stopError.message
134
+ ] }),
135
+ r && /* @__PURE__ */ m("p", {
136
+ className: "text-xs text-(color:--color-text-secondary)",
137
+ role: "status",
138
+ children: n(r === "active" ? "stewards.run.retryBlockedActive" : "stewards.run.retryBlockedStatus")
139
+ }),
140
+ t.confirmLive && /* @__PURE__ */ h(u, { children: [/* @__PURE__ */ m("p", {
141
+ className: "mb-2",
142
+ children: n("stewards.run.retryLiveConfirm")
143
+ }), /* @__PURE__ */ h("div", {
144
+ className: "flex gap-2",
145
+ children: [/* @__PURE__ */ m(f, {
146
+ variant: "danger",
147
+ onClick: () => t.startAgain(!1),
148
+ children: n("stewards.run.retryLiveConfirmAction")
149
+ }), /* @__PURE__ */ m(f, {
150
+ onClick: () => t.setConfirmLive(!1),
151
+ children: n("stewards.common.cancel")
152
+ })]
153
+ })] }),
154
+ t.retryError && /* @__PURE__ */ h(u, { children: [
155
+ n("stewards.run.retryError"),
156
+ " ",
157
+ t.retryError.message
158
+ ] })
159
+ ] });
160
+ }
161
+ export { S as RunActionNotices, x as RunHeader, _ as useRunActions };
162
+
163
+ //# sourceMappingURL=RunHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunHeader.js","names":["_Fragment","useRunActions","useStewardsContext","finished","isRunFinished","run","prompt","cancel","cancelState","useCancelBotmanorStewardRunMutation","rerun","rerunState","useRunBotmanorStewardMutation","confirmLive","setConfirmLive","useState","siblings","useListBotmanorStewardRunsQuery","otherActive","r","retryBlocked","steward","BotmanorStewardStatus","data","navigate","pathTo","retryLabel","actions","t","RunActionButtons","useStewardsT","disabled","Fragment","Button","runMeta","parts","enumLabel","clockTime","zone","RunHeader","Badge","RUN_STATUS_TONE","canExecute","RunActionNotices","blockedReason","Alert"],"sources":["../../../../src/stewards/components/run/RunHeader.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n useCancelBotmanorStewardRunMutation,\n useListBotmanorStewardRunsQuery,\n useRunBotmanorStewardMutation,\n type StewardDetailFieldsFragment,\n type StewardRunDetailFieldsFragment,\n type StewardRunSummaryFieldsFragment,\n} from '../../../generated/wspace-operations';\nimport { BotmanorStewardStatus } from '../../../generated/wspace-types';\nimport { useStewardsT, type StewardsT } from '../../i18n/useStewardsT';\nimport { useStewardsContext } from '../../providers/StewardsProvider';\nimport { clockTime } from '../../utils/dates';\nimport { enumLabel, isRunFinished, RUN_STATUS_TONE } from '../stewardLabels';\nimport { Alert, Badge, Button } from '../ui';\n\ntype Run = StewardRunDetailFieldsFragment;\ntype Steward = StewardDetailFieldsFragment | undefined;\n\n/**\n * Stop, retry and retry-live for one run. Another run of the same steward still in flight\n * blocks a retry, so two runs never act on the same desk at once.\n */\nexport function useRunActions(run: Run, steward: Steward) {\n const { navigate, pathTo } = useStewardsContext();\n const finished = isRunFinished(run.status);\n const prompt = run.execution?.input ?? '';\n const [cancel, cancelState] = useCancelBotmanorStewardRunMutation();\n const [rerun, rerunState] = useRunBotmanorStewardMutation();\n const [confirmLive, setConfirmLive] = useState(false);\n const siblings = useListBotmanorStewardRunsQuery({\n variables: { filter: { stewardId: run.stewardId }, pagination: { limit: 20 } },\n skip: !finished,\n fetchPolicy: 'cache-and-network',\n });\n\n const siblingRuns: StewardRunSummaryFieldsFragment[] =\n siblings.data?.listBotmanorStewardRuns ?? [];\n const otherActive = siblingRuns.some((r) => r.id !== run.id && !isRunFinished(r.status));\n const stewardActive = steward?.status === BotmanorStewardStatus.Active;\n const retryBlocked = !stewardActive || otherActive || siblings.loading;\n\n const startAgain = (dryRun: boolean) => {\n setConfirmLive(false);\n void rerun({ variables: { input: { stewardId: run.stewardId, prompt, dryRun } } })\n .then(({ data }) => {\n if (data?.runBotmanorSteward.id) navigate(pathTo('runs', data.runBotmanorSteward.id));\n })\n .catch(() => undefined);\n };\n\n return {\n finished,\n canRetry: finished && prompt !== '',\n stop: () => void cancel({ variables: { id: run.id } }).catch(() => undefined),\n stopping: cancelState.loading,\n stopError: cancelState.error,\n startAgain,\n retrying: rerunState.loading,\n retryError: rerunState.error,\n retryBlocked,\n retryBlockedReason: siblings.loading ? null : otherActive ? 'active' : 'status',\n confirmLive,\n setConfirmLive,\n } as const;\n}\n\nexport type RunActions = ReturnType<typeof useRunActions>;\n\nfunction retryLabel(t: StewardsT, run: Run, actions: RunActions): string {\n if (actions.retrying) return t('stewards.run.retrying');\n return run.dryRun ? t('stewards.run.retry') : t('stewards.run.retryLive');\n}\n\nfunction RunActionButtons({ run, actions }: { run: Run; actions: RunActions }) {\n const t = useStewardsT();\n const disabled = actions.retrying || actions.retryBlocked;\n if (!actions.finished) {\n return (\n <Button variant=\"danger\" disabled={actions.stopping} onClick={actions.stop}>\n {actions.stopping ? t('stewards.run.stopping') : t('stewards.run.stopRun')}\n </Button>\n );\n }\n if (!actions.canRetry) return null;\n return (\n <>\n {!run.dryRun && (\n <Button variant=\"primary\" disabled={disabled} onClick={() => actions.startAgain(true)}>\n {t('stewards.run.retryDry')}\n </Button>\n )}\n <Button\n disabled={disabled}\n onClick={() => (run.dryRun ? actions.startAgain(true) : actions.setConfirmLive(true))}\n >\n {retryLabel(t, run, actions)}\n </Button>\n </>\n );\n}\n\nfunction runMeta(t: StewardsT, run: Run, steward: Steward, zone: string): string {\n const parts = [`${t('stewards.run.trigger')}: ${enumLabel(t, 'trigger', run.trigger)}`];\n if (steward) {\n parts.push(\n `${t('stewards.run.autonomy')}: ${enumLabel(t, 'autonomy', steward.charter.autonomyLevel)}`\n );\n }\n if (run.startedAt) parts.push(`${t('stewards.run.started')} ${clockTime(run.startedAt, zone)}`);\n return parts.join(' · ');\n}\n\n/** Title, status, steward link, trigger and the run's actions. */\nexport function RunHeader({\n run,\n steward,\n zone,\n canExecute,\n actions,\n}: {\n run: Run;\n steward: Steward;\n zone: string;\n canExecute: boolean;\n actions: RunActions;\n}) {\n const t = useStewardsT();\n const { navigate, pathTo } = useStewardsContext();\n return (\n <header className=\"flex flex-wrap items-start justify-between gap-3\">\n <div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <h1 className=\"text-xl font-semibold text-(color:--color-text-primary)\">\n {t('stewards.run.title')} <code className=\"text-base\">{run.id}</code>\n </h1>\n <Badge tone={RUN_STATUS_TONE[run.status]}>{enumLabel(t, 'runStatus', run.status)}</Badge>\n {run.dryRun && <Badge tone=\"info\">{t('stewards.run.dryBadge')}</Badge>}\n </div>\n <p className=\"text-sm text-(color:--color-text-secondary)\">\n {t('stewards.run.steward')}:{' '}\n <button\n type=\"button\"\n className=\"text-(color:--color-text-primary) hover:underline\"\n onClick={() => navigate(pathTo(run.stewardId))}\n >\n {steward?.agent?.name ?? run.stewardId}\n </button>{' '}\n · {runMeta(t, run, steward, zone)}\n </p>\n {run.stopReason && (\n <p className=\"text-sm text-(color:--color-text-secondary)\">\n {t('stewards.run.stopReason', { reason: run.stopReason })}\n </p>\n )}\n </div>\n {canExecute && (\n <div className=\"flex flex-wrap gap-2\">\n <RunActionButtons run={run} actions={actions} />\n </div>\n )}\n </header>\n );\n}\n\n/** Errors, the retry-blocked note and the retry-live confirmation under the header. */\nexport function RunActionNotices({\n canExecute,\n actions,\n}: {\n canExecute: boolean;\n actions: RunActions;\n}) {\n const t = useStewardsT();\n const blockedReason =\n canExecute && actions.canRetry && actions.retryBlocked ? actions.retryBlockedReason : null;\n return (\n <>\n {actions.stopError && (\n <Alert>\n {t('stewards.run.cancelError')} {actions.stopError.message}\n </Alert>\n )}\n {blockedReason && (\n <p className=\"text-xs text-(color:--color-text-secondary)\" role=\"status\">\n {blockedReason === 'active'\n ? t('stewards.run.retryBlockedActive')\n : t('stewards.run.retryBlockedStatus')}\n </p>\n )}\n {actions.confirmLive && (\n <Alert>\n <p className=\"mb-2\">{t('stewards.run.retryLiveConfirm')}</p>\n <div className=\"flex gap-2\">\n <Button variant=\"danger\" onClick={() => actions.startAgain(false)}>\n {t('stewards.run.retryLiveConfirmAction')}\n </Button>\n <Button onClick={() => actions.setConfirmLive(false)}>\n {t('stewards.common.cancel')}\n </Button>\n </div>\n </Alert>\n )}\n {actions.retryError && (\n <Alert>\n {t('stewards.run.retryError')} {actions.retryError.message}\n </Alert>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAgBC,EAAc,GAAU,GAAkB;CACxD,IAAM,EAAE,aAAU,cAAWC,EAAmB,GAC1CC,IAAWC,EAAcC,EAAI,MAAM,GACnCC,IAASD,EAAI,WAAW,SAAS,IACjC,CAACE,GAAQC,KAAeC,EAAoC,GAC5D,CAACC,GAAOC,KAAcC,EAA8B,GACpD,CAACC,GAAaC,KAAkBC,EAAS,EAAK,GAC9CC,IAAWC,EAAgC;EAC/C,WAAW;GAAE,QAAQ,EAAE,WAAWZ,EAAI,UAAU;GAAG,YAAY,EAAE,OAAO,GAAG;EAAE;EAC7E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S,eAAeN,EAAQ,WAAW,EAAK;IAC7D,UAAAC,EAAE,qCAAqC;GAClC,CAAA,GACR,kBAACK,GAAD;IAAQ,eAAeN,EAAQ,eAAe,EAAK;IAChD,UAAAC,EAAE,wBAAwB;GACrB,CAAA,CACL;EACA,CAAA,CAAA,EAAA,CAAA;EAERD,EAAQ,cACP,kBAACkB,GAAD,EAAA,UAAA;GACGjB,EAAE,yBAAyB;GAAE;GAAED,EAAQ,WAAW;EAC9C,EAAA,CAAA;CAET,EAAA,CAAA;AAEN"}
@@ -0,0 +1,13 @@
1
+ import { StewardRunDetailFieldsFragment } from '../../../generated/wspace-operations';
2
+ /**
3
+ * The run's steps in order, with the picked step's detail beside them. Until the person picks
4
+ * one, the latest step is shown, so a live run follows its newest step.
5
+ */
6
+ export declare function RunStepsSection({ steps, timeZone, }: {
7
+ steps: StewardRunDetailFieldsFragment['steps'];
8
+ timeZone: string;
9
+ }): import('react').JSX.Element;
10
+ /** Approval requests the run raised, with their status and requested scope. */
11
+ export declare function RunApprovalsCard({ approvals, }: {
12
+ approvals: StewardRunDetailFieldsFragment['approvals'];
13
+ }): import('react').JSX.Element | null;
@@ -0,0 +1,151 @@
1
+ import { useStewardsT as e } from "../../i18n/useStewardsT.js";
2
+ import { VERDICT_TONE as t, enumLabel as n } from "../stewardLabels.js";
3
+ import { Badge as r, Card as i, StateMessage as a } from "../ui.js";
4
+ import { StepDetail as o } from "./StepDetail.js";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { useState as l } from "react";
7
+ // src/stewards/components/run/RunStepsSection.tsx
8
+ var u = "px-2 py-1 font-medium";
9
+ function d({ step: e, selected: i, onPick: a, t: o }) {
10
+ return /* @__PURE__ */ c("tr", {
11
+ "aria-selected": i,
12
+ className: `border-b border-(color:--color-border-seam) last:border-b-0 ${i ? "bg-(--color-accent-soft)" : ""}`,
13
+ children: [
14
+ /* @__PURE__ */ s("td", {
15
+ className: "px-2 py-2 text-(color:--color-text-secondary) tabular-nums",
16
+ children: e.seq
17
+ }),
18
+ /* @__PURE__ */ s("td", {
19
+ className: "px-2 py-2",
20
+ children: /* @__PURE__ */ c("button", {
21
+ type: "button",
22
+ className: "text-left focus-visible:outline-2 focus-visible:outline-(color:--color-focus-ring)",
23
+ onClick: () => a(e.id),
24
+ children: [/* @__PURE__ */ s("span", {
25
+ className: "block font-medium text-(color:--color-text-primary)",
26
+ children: n(o, "stepKind", e.kind)
27
+ }), /* @__PURE__ */ s("span", {
28
+ className: "block break-all font-mono text-xs text-(color:--color-text-secondary)",
29
+ children: [e.toolKey, e.targetSummary].filter(Boolean).join(" · ")
30
+ })]
31
+ })
32
+ }),
33
+ /* @__PURE__ */ s("td", {
34
+ className: "px-2 py-2",
35
+ children: /* @__PURE__ */ s(r, {
36
+ tone: t[e.verdict],
37
+ children: n(o, "verdict", e.verdict)
38
+ })
39
+ }),
40
+ /* @__PURE__ */ s("td", {
41
+ className: "px-2 py-2 text-(color:--color-text-primary) tabular-nums",
42
+ children: e.creditsUsed.toFixed(2)
43
+ })
44
+ ]
45
+ });
46
+ }
47
+ function f({ steps: t, selectedId: n, onPick: r }) {
48
+ let i = e();
49
+ return t.length === 0 ? /* @__PURE__ */ s(a, {
50
+ kind: "empty",
51
+ title: i("stewards.run.noSteps")
52
+ }) : /* @__PURE__ */ s("div", {
53
+ className: "overflow-x-auto",
54
+ children: /* @__PURE__ */ c("table", {
55
+ className: "w-full text-sm",
56
+ "aria-label": i("stewards.run.stepsHeading"),
57
+ children: [/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ c("tr", {
58
+ className: "border-b border-(color:--color-border-seam) text-left text-xs text-(color:--color-text-secondary)",
59
+ children: [
60
+ /* @__PURE__ */ s("th", {
61
+ scope: "col",
62
+ className: u,
63
+ children: i("stewards.run.colNumber")
64
+ }),
65
+ /* @__PURE__ */ s("th", {
66
+ scope: "col",
67
+ className: u,
68
+ children: i("stewards.run.colStep")
69
+ }),
70
+ /* @__PURE__ */ s("th", {
71
+ scope: "col",
72
+ className: u,
73
+ children: i("stewards.run.colVerdict")
74
+ }),
75
+ /* @__PURE__ */ s("th", {
76
+ scope: "col",
77
+ className: u,
78
+ children: i("stewards.run.colCredits")
79
+ })
80
+ ]
81
+ }) }), /* @__PURE__ */ s("tbody", { children: t.map((e) => /* @__PURE__ */ s(d, {
82
+ step: e,
83
+ selected: n === e.id,
84
+ onPick: r,
85
+ t: i
86
+ }, e.id)) })]
87
+ })
88
+ });
89
+ }
90
+ function p({ steps: t, timeZone: r }) {
91
+ let a = e(), [u, d] = l(null), p = t.find((e) => e.id === u) ?? t[t.length - 1], m = p ? a("stewards.run.stepDetail", {
92
+ seq: p.seq,
93
+ tool: p.toolKey ?? n(a, "stepKind", p.kind)
94
+ }) : a("stewards.run.stepsHeading");
95
+ return /* @__PURE__ */ c("div", {
96
+ className: "grid grid-cols-1 gap-4 xl:grid-cols-5",
97
+ children: [/* @__PURE__ */ s(i, {
98
+ title: a("stewards.run.stepsHeading"),
99
+ hint: a("stewards.run.stepsOrdered"),
100
+ className: "xl:col-span-2",
101
+ children: /* @__PURE__ */ s(f, {
102
+ steps: t,
103
+ selectedId: p?.id,
104
+ onPick: d
105
+ })
106
+ }), /* @__PURE__ */ s(i, {
107
+ title: m,
108
+ className: "xl:col-span-3",
109
+ children: p ? /* @__PURE__ */ s(o, {
110
+ step: p,
111
+ timeZone: r
112
+ }) : /* @__PURE__ */ s("p", {
113
+ className: "text-sm text-(color:--color-text-secondary)",
114
+ children: a("stewards.run.pickStep")
115
+ })
116
+ })]
117
+ });
118
+ }
119
+ var m = {
120
+ PENDING: "warning",
121
+ APPROVED: "success"
122
+ };
123
+ function h({ approvals: t }) {
124
+ let a = e();
125
+ return t.length === 0 ? null : /* @__PURE__ */ s(i, {
126
+ title: a("stewards.run.approvalsTitle"),
127
+ children: /* @__PURE__ */ s("ul", {
128
+ className: "flex flex-col gap-1 text-sm",
129
+ children: t.map((e) => /* @__PURE__ */ c("li", {
130
+ className: "flex flex-wrap items-center gap-2 text-(color:--color-text-primary)",
131
+ children: [
132
+ /* @__PURE__ */ s("code", {
133
+ className: "text-xs",
134
+ children: e.toolName
135
+ }),
136
+ /* @__PURE__ */ s(r, {
137
+ tone: m[e.status] ?? "neutral",
138
+ children: n(a, "approvalStatus", e.status)
139
+ }),
140
+ e.requestedScope && /* @__PURE__ */ s("span", {
141
+ className: "text-xs text-(color:--color-text-secondary)",
142
+ children: n(a, "scope", e.requestedScope)
143
+ })
144
+ ]
145
+ }, e.id))
146
+ })
147
+ });
148
+ }
149
+ export { h as RunApprovalsCard, p as RunStepsSection };
150
+
151
+ //# sourceMappingURL=RunStepsSection.js.map