fsanyoto commited on
Commit
9567e44
·
verified ·
1 Parent(s): dec006b

Prune files not in the deploy set (stale build context)

Browse files
Files changed (1) hide show
  1. web/src/automation/AutomationChat.tsx +0 -511
web/src/automation/AutomationChat.tsx DELETED
@@ -1,511 +0,0 @@
1
- // ---------------------------------------------------------------------------
2
- // automation/AutomationChat.tsx — the Chat view of the Agent module (R17).
3
- //
4
- // Owner, ruling R17: *"The Agent module needs a Chat view beside the builder, where the user asks
5
- // the AI to build the automation."*
6
- //
7
- // ⛔⛔ WHAT THIS IS NOT: a second way to save an automation. `POST /automations/draft` writes
8
- // NOTHING and says so on the wire (`saved: false`); accepting a draft is the ordinary
9
- // `POST /automations` that the Canvas already uses. That is R3's *"indistinguishable from a
10
- // hand-built one"* achieved by there being ONE write path, not two that look alike. If a future
11
- // change makes this component write directly, that property is gone and nothing will report it.
12
- //
13
- // ⛔ AND `dropped` IS RENDERED, ALWAYS. The route runs the real save-door validator over the
14
- // model's answer and diffs it, because `clean_actions` discards an unrecognised config key and
15
- // still answers 200. Every entry is something the reader was SHOWN that will not survive the
16
- // save. Hiding it would make the Canvas disagree with the transcript that produced it, which is
17
- // the exact complaint D-75 was opened for.
18
- // ---------------------------------------------------------------------------
19
- import { useCallback, useEffect, useRef, useState } from "react";
20
-
21
- import { logExchange } from "../assistant/dockClient";
22
- import type { AnswerProvenance, QueryModelStatus } from "../query/queryApi";
23
- import { answerSourceFooter, fetchQueries, NO_CITED_SOURCES_REASON } from "../query/queryApi";
24
- import type { AgentContract, AutomationDraft } from "./automationApi";
25
- import {
26
- AutomationError,
27
- draftAutomation,
28
- } from "./automationApi";
29
- import "./automation.css";
30
- import "../styles/wave45/agent-operator.css";
31
-
32
- /**
33
- * ⭐⭐ CONTRACT C5 (W36-T34, owner item 3, ruling R4) — ONE LIST, ONE DOOR.
34
- *
35
- * Owner: *"This Agent chat interface we need to be able to toggle the model just like how the
36
- * assistant is configured."* "Just like" is implemented, not imitated: this reads `GET /query`'s
37
- * `modelStatus` — the SAME payload `AssistantPage` renders — rather than growing a second model
38
- * vocabulary. A second list would agree on the day it was written and diverge the first time a
39
- * rung was added, and the surface that went stale would be the one nobody was looking at.
40
- *
41
- * ⛔ THE LABELS ARE THE ASSISTANT'S TOO, and they are NOT imported: `MODEL_LABEL` lives in
42
- * `assistant/AssistantPage.tsx` beside a component that reads `import.meta.env`, which cannot be
43
- * required from a CommonJS render harness (`verify_query` records that exact crash). So the map is
44
- * derived here from the key itself and falls through to the raw key, which is the behaviour the
45
- * Assistant's own `modelLabel` has for a provider added server-side.
46
- */
47
- const MODEL_WORDS: Record<string, string> = {
48
- auto: "Auto", anthropic: "Anthropic", cerebras: "Cerebras", groq: "Groq",
49
- openrouter: "OpenRouter",
50
- };
51
- const modelWord = (key: string) => MODEL_WORDS[key] ?? key;
52
- const MODEL_IDENTITY: Record<string, { provider: string; model: string }> = {
53
- anthropic: { provider: "Anthropic", model: "claude-opus-5" },
54
- cerebras: { provider: "Cerebras", model: "gpt-oss-120b" },
55
- groq: { provider: "Groq", model: "openai/gpt-oss-120b" },
56
- openrouter: { provider: "OpenRouter", model: "openai/gpt-4o-mini" },
57
- };
58
-
59
- /**
60
- * One turn. `error` is a KIND of message rather than a separate banner, because a failed turn is
61
- * part of the conversation a person is having: they will rephrase and try again, and a toast that
62
- * has already faded cannot be re-read while they do.
63
- */
64
- interface Turn {
65
- who: "you" | "agent";
66
- text: string;
67
- error?: boolean;
68
- dropped?: string[];
69
- provenance?: AnswerProvenance;
70
- }
71
-
72
- /** Automation drafting has no record or knowledge retrieval path. Name that rather than imply it. */
73
- const AGENT_MODEL_GUIDANCE: AnswerProvenance = {
74
- basis: "model_guidance",
75
- citationIds: [],
76
- modelGuidance: true,
77
- noneUsedReason: NO_CITED_SOURCES_REASON,
78
- };
79
-
80
- export interface AutomationChatProps {
81
- /** Applied to the Canvas when the reader accepts. Returns once the write has been attempted. */
82
- onAccept: (draft: AutomationDraft["draft"]) => Promise<void> | void;
83
- /**
84
- * ⭐ W36-T34 — the C5 model rows, when a caller already holds them. SEEDS the state; the mount
85
- * effect still fetches and corrects it, which is `cachedAutomations()`'s stale-while-revalidate
86
- * shape one surface over.
87
- * ⚠ IT IS ALSO WHAT MAKES THE PICKER OBSERVABLE AT ALL, and that is worth saying rather than
88
- * leaving as a coincidence. `renderToStaticMarkup` runs no effects, so a control whose entire
89
- * existence depends on a fetch cannot be drawn by the shot convention this module uses for every
90
- * other surface — it would have been the one piece of this lane shipped on `tsc` alone. Same
91
- * reasoning that makes `ActionProps` an EXPORT rather than a private function.
92
- */
93
- initialModels?: QueryModelStatus[];
94
- unconfigured?: boolean;
95
- setupInterview?: AgentContract["setupInterview"] | null;
96
- onSetupAnswer?: (key: string, answer: string, disable: boolean) => Promise<void> | void;
97
- }
98
-
99
- /** How many steps a draft may carry before the accept bar states the number rather than implying
100
- * it. Not a limit — a limit here would be a second, quieter copy of the server's. */
101
- const MANY_STEPS = 6;
102
-
103
- export default function AutomationChat({
104
- onAccept,
105
- initialModels,
106
- unconfigured = false,
107
- setupInterview = null,
108
- onSetupAnswer,
109
- }: AutomationChatProps) {
110
- const [turns, setTurns] = useState<Turn[]>([]);
111
- const [text, setText] = useState("");
112
- const [busy, setBusy] = useState(false);
113
- const [pending, setPending] = useState<AutomationDraft["draft"] | null>(null);
114
- const [applying, setApplying] = useState(false);
115
- const [model, setModel] = useState("auto");
116
- const [models, setModels] = useState<QueryModelStatus[] | null>(initialModels ?? null);
117
- const [setupBusy, setSetupBusy] = useState(false);
118
- const logRef = useRef<HTMLDivElement | null>(null);
119
-
120
- /*
121
- ⚠ ONE READ, AND A FAILURE IS SILENT ON PURPOSE. If the model list cannot be fetched the picker
122
- simply does not render and the turn goes with the server's own default — which is what happened
123
- before this control existed. Painting an error banner over a CHAT because a secondary control
124
- could not be drawn would be the louder failure, and the composer must stay usable.
125
- */
126
- useEffect(() => {
127
- let alive = true;
128
- void fetchQueries().then((result) => {
129
- if (alive && result.ok) setModels(result.value.modelStatus);
130
- });
131
- return () => { alive = false; };
132
- }, []);
133
-
134
- const scrollDown = useCallback(() => {
135
- // The transcript grows at the bottom, so a reader who has just sent something expects to be
136
- // there. `requestAnimationFrame` because the row is appended in the same commit.
137
- requestAnimationFrame(() => {
138
- const el = logRef.current;
139
- if (el) el.scrollTop = el.scrollHeight;
140
- });
141
- }, []);
142
-
143
- const ask = useCallback(async () => {
144
- const prompt = text.trim();
145
- if (!prompt || busy) return;
146
- /*
147
- * ⭐ THE USER'S LINE GOES UP FIRST AND THE COMPOSER CLEARS FIRST. Waiting for the server to
148
- * echo it is what makes a chat feel broken: the reader presses enter, the text sits in the
149
- * box, and they press it again. Same reasoning as R16's clause for the Assistant.
150
- * ⚠ The optimistic row is never RECONCILED away on failure — it genuinely happened, they
151
- * genuinely said it — so the failure arrives as the NEXT turn rather than by deleting theirs.
152
- */
153
- setTurns((t) => [...t, { who: "you", text: prompt }]);
154
- setText("");
155
- setBusy(true);
156
- scrollDown();
157
- try {
158
- // ⛔ THE CHOICE TRAVELS AS FAR AS THE WIRE, AND NO FURTHER YET. `draft_automation` reads
159
- // `prompt` and nothing else today, so this key is accepted and ignored — see the door's own
160
- // note and ASK D-18. Sending it is the additive half; W36-T34 is not finished until the
161
- // server reads it, and this line says so rather than letting the call site imply otherwise.
162
- const res = await draftAutomation(prompt, model);
163
- const actions = res.draft?.actions || [];
164
- const label = res.draft?.name ? `"${res.draft.name}"` : "a flow";
165
- setTurns((t) => [...t, {
166
- who: "agent",
167
- provenance: AGENT_MODEL_GUIDANCE,
168
- text: actions.length
169
- ? `I drafted ${label} with ${actions.length} step${actions.length === 1 ? "" : "s"}. `
170
- + "Nothing is saved yet. Read it below and add it to Workflows if it is right."
171
- : `I could not turn that into steps. Try naming the database and what should happen.`,
172
- // ⚠ BOTH CHANNELS, and they are different questions. `dropped` is what the SAVE-DOOR
173
- // validator discarded from the model's answer; `notes` is what the ROUTE corrected or
174
- // could not keep (a trigger this deployment does not have, steps past the draft cap).
175
- // Rendering only one of them shows a person half of what changed under them.
176
- // ⛔ `dropped` IS `{kind, keys}`, NOT A SENTENCE. Spreading it into a string list
177
- // compiled and would have painted `[object Object]` on the one line that exists to say
178
- // what changed under the reader. It is turned into words HERE, once.
179
- ...(res.dropped?.length || res.notes?.length
180
- ? {
181
- dropped: [
182
- ...(res.dropped || []).map(
183
- (d) => `on the ${d.kind} step: ${(d.keys || []).join(", ")}`
184
- ),
185
- ...(res.notes || []),
186
- ],
187
- }
188
- : {}),
189
- }]);
190
- setPending(actions.length ? res.draft : null);
191
- // History receives a summary, never the draft's name, configuration or rows.
192
- void logExchange({
193
- question: prompt,
194
- answer: actions.length
195
- ? `I drafted a flow with ${actions.length} step${actions.length === 1 ? "" : "s"}. Nothing is saved yet.`
196
- : "I could not turn that into steps.",
197
- context: { surface: "automation" },
198
- }).catch(() => {});
199
- } catch (e) {
200
- /*
201
- * ⛔ THE SERVER'S OWN SENTENCE, NEVER A GENERIC ONE. The route answers 400 with one plain
202
- * sentence saying WHY it refused (no prompt, nothing draftable, a kind this deployment
203
- * cannot run) and that sentence is the only useful thing on the screen. Replacing it with
204
- * "something went wrong" would throw away the one part a person can act on.
205
- */
206
- setTurns((t) => [...t, {
207
- who: "agent",
208
- provenance: AGENT_MODEL_GUIDANCE,
209
- error: true,
210
- text: e instanceof AutomationError
211
- ? e.message
212
- : "The agent service did not answer. Try again in a moment.",
213
- }]);
214
- setPending(null);
215
- } finally {
216
- setBusy(false);
217
- scrollDown();
218
- }
219
- }, [text, busy, scrollDown]);
220
-
221
- const accept = useCallback(async () => {
222
- if (!pending || applying) return;
223
- setApplying(true);
224
- try {
225
- await onAccept(pending);
226
- setPending(null);
227
- setTurns((t) => [...t, {
228
- who: "agent",
229
- provenance: AGENT_MODEL_GUIDANCE,
230
- text: "Added it to Workflows. Edit it there like any other agent.",
231
- }]);
232
- } catch (e) {
233
- setTurns((t) => [...t, {
234
- who: "agent",
235
- provenance: AGENT_MODEL_GUIDANCE,
236
- error: true,
237
- text: e instanceof AutomationError ? e.message : "That draft could not be applied.",
238
- }]);
239
- } finally {
240
- setApplying(false);
241
- scrollDown();
242
- }
243
- }, [pending, applying, onAccept, scrollDown]);
244
-
245
- const steps = pending?.actions?.length || 0;
246
-
247
- /**
248
- * ⭐⭐ WAVE 36 · W36-T33 (owner item 3) — THE COMPOSER, COPIED FROM THE ASSISTANT RATHER THAN
249
- * RE-DERIVED.
250
- *
251
- * Owner: *"the chat interface is still so ugly, it needs to be better. Just as good as the
252
- * Assistant module and you can take a look at the Airtable screenshot."* The done-when is a
253
- * COMPARISON — *"the owner opens both and cannot tell which team built which"* — so the
254
- * Assistant's composer is the specification and the screenshot is the arrangement.
255
- *
256
- * ⛔ AND THE TWO AGREE ALREADY, which is the finding that made this cheap. `AssistantPage`'s
257
- * `.as-field` is exactly the reference's anatomy: a bordered rounded card, the controls on a
258
- * row BELOW the input and INSIDE the same card, a circular arrow send at the bottom right. So
259
- * this is that anatomy in `autoc-*` names, on the SAME tokens (`--lp-line`, `--lp-surface`,
260
- * `--lp-ink`, `--lp-fs-sm`), never on copied values.
261
- * ⚠ ONE CONST, RENDERED IN BOTH STATES. The empty state centres the composer and the
262
- * conversation puts it at the foot; two copies of this markup is exactly the drift this ticket
263
- * exists to end, one surface further in.
264
- * ⚠ THE FOOT ROW IS DELIBERATELY BUILT NOW AND NEARLY EMPTY. W36-T34 puts the model toggle
265
- * there, in the slot the Assistant already keeps its own in.
266
- */
267
- const composer = (
268
- <div className="autoc-field">
269
- <textarea
270
- className="autoc-input"
271
- rows={1}
272
- value={text}
273
- placeholder="Describe what this agent should do"
274
- aria-label="Describe what this agent should do"
275
- disabled={busy}
276
- onChange={(e) => setText(e.target.value)}
277
- onKeyDown={(e) => {
278
- // Enter sends; shift+enter is a newline. The Assistant's composer keys the same way,
279
- // and a chat that took a different key for the same act would be the drift again.
280
- if (e.key === "Enter" && !e.shiftKey) {
281
- e.preventDefault();
282
- void ask();
283
- }
284
- }}
285
- />
286
- <div className="autoc-foot">
287
- {/*
288
- ⛔⛔ A TOOL-CALLING TURN, SO A MODEL THAT CANNOT CARRY ONE IS NOT OFFERED (R4 / the
289
- ticket's own done-when). Drafting an automation comes back as a typed tool call, not as
290
- prose, so a rung whose ladder row says `toolCalling: false` would spend a prompt to
291
- deliver a refusal [[permitted-is-not-answerable]]. It is filtered OUT of the list rather
292
- than shown disabled, because unlike the cases below there is nothing the reader could do
293
- about it and nothing they chose.
294
- ⛔ AN OUT-OF-CREDIT RUNG IS SHOWN, DISABLED, WITH ITS REASON — never hidden. E's own
295
- instruction, and it is right: silently dropping the model somebody picked yesterday is
296
- the worse failure, because the control then disagrees with their memory and says nothing.
297
- The `reason` is the SERVER's sentence (R4: no raw `HTTP 402` reaches a screen), and it
298
- names no environment variable, so a tenant user can act on it.
299
- ⚠ NOTHING RENDERS AT ALL UNTIL THE LIST ARRIVES, and an empty capable list renders
300
- nothing either: a picker with one greyed row is chrome that answers no question.
301
- */}
302
- {models?.some((row) => row.toolCalling) ? (
303
- <label className="autoc-pick">
304
- <span className="autoc-pick-label">Model</span>
305
- <select
306
- className="autoc-pick-select"
307
- value={model}
308
- aria-label="Model"
309
- disabled={busy}
310
- onChange={(e) => setModel(e.target.value)}
311
- >
312
- {models.filter((row) => row.toolCalling).map((row) => (
313
- <option key={row.model} value={row.model} disabled={!row.available}
314
- title={row.reason || undefined}>
315
- {row.available
316
- ? modelWord(row.model)
317
- : `${modelWord(row.model)} (${row.outOfCredit ? "out of credit" : "not configured"})`}
318
- </option>
319
- ))}
320
- {/* ⚠ THE STORED CHOICE IS ALWAYS AN OPTION. A `<select>` whose `value` matches no
321
- `<option>` renders the FIRST one, so a model the ladder stopped offering would
322
- read as "Auto" while the state still held the old key (D-10, the same guard the
323
- statements tier picker carries). */}
324
- {model && !models.some((row) => row.model === model && row.toolCalling) ? (
325
- <option value={model}>{modelWord(model)} (no longer offered)</option>
326
- ) : null}
327
- </select>
328
- </label>
329
- ) : null}
330
- {model !== "auto" && MODEL_IDENTITY[model] ? (
331
- <span className="w45-model-id" aria-label="Selected provider and model">
332
- Provider <strong>{MODEL_IDENTITY[model].provider}</strong>
333
- Model <strong>{MODEL_IDENTITY[model].model}</strong>
334
- </span>
335
- ) : (
336
- <span className="w45-model-id">Provider and model selected at run time</span>
337
- )}
338
- <a className="as-citation" href="#/assistant">Open the full conversation</a>
339
- <button
340
- type="button"
341
- className="autoc-send"
342
- aria-label="Send"
343
- disabled={busy || !text.trim()}
344
- onClick={() => void ask()}
345
- >
346
- {/* ⛔ THE ASSISTANT'S OWN MARK, path for path. A second arrow drawn slightly
347
- differently is precisely how two surfaces stop looking like one product. */}
348
- <svg viewBox="0 0 16 16" aria-hidden="true" width="15" height="15">
349
- <path d="M8 13V3.6M4 7.4 8 3.4l4 4" />
350
- </svg>
351
- </button>
352
- </div>
353
- </div>
354
- );
355
-
356
- /*
357
- ⭐⭐ W36-T33 — THE CENTRED OPENING W36-T30 DELIBERATELY LEFT FOR THIS TICKET.
358
- `AssistantPage` renders `.as-opening`: a centred heading, ONE muted line, and the composer
359
- moved into the middle of the pane. That is also the reference screenshot's empty state, so
360
- the two requirements point at one design and this mirrors it.
361
- ⚠ NO DECORATIVE MARK, and the omission is the considered half. The screenshot has a soft
362
- dot-ring above its heading; the Assistant has none. The done-when is "the owner opens both
363
- and cannot tell which team built which", so a mark on ONE of the two chat surfaces would be
364
- the very difference this ticket is measured by. The PRD's own reading of that image says the
365
- LAYOUT is what is copied.
366
- ⛔ AND THE ONE LINE HERE IS NOT THE SPILL COMING BACK. What W36-T30 removed was three
367
- sentences of instruction standing where the conversation goes, while the composer sat below
368
- it saying the same thing in six words. This is a heading and a single line of orientation, in
369
- the pattern the Assistant already ships.
370
- */
371
- return (
372
- <div className="autoc-chat">
373
- {!turns.length ? (
374
- <div className="autoc-opening">
375
- {unconfigured && setupInterview?.question ? (
376
- <section className="w45-interview" aria-live="polite">
377
- <h2 className="autoc-opening-h">Set up agent</h2>
378
- <p className="autoc-opening-p">{setupInterview.question.text}</p>
379
- <div className="w45-interview-actions">
380
- <button type="button" disabled={setupBusy} onClick={async () => {
381
- setSetupBusy(true);
382
- try { await onSetupAnswer?.(setupInterview.question!.key, setupInterview.question!.suggestion, false); }
383
- finally { setSetupBusy(false); }
384
- }}>{setupInterview.question.suggestion}</button>
385
- {setupInterview.question.allowDisable ? (
386
- <button type="button" disabled={setupBusy} onClick={async () => {
387
- setSetupBusy(true);
388
- try { await onSetupAnswer?.(setupInterview.question!.key, "", true); }
389
- finally { setSetupBusy(false); }
390
- }}>Disable for now</button>
391
- ) : null}
392
- </div>
393
- </section>
394
- ) : (
395
- <>
396
- <h2 className="autoc-opening-h">How can I help?</h2>
397
- <p className="autoc-opening-p">
398
- Say what this agent should do and it drafts the steps. Nothing is saved until you
399
- add them to Workflows.
400
- </p>
401
- {composer}
402
- </>
403
- )}
404
- </div>
405
- ) : null}
406
- {/*
407
- ⛔⛔ NOT RENDERED AT ALL WHEN EMPTY, AND `hidden` WAS THE BUG. `.autoc-log` sets
408
- `display: flex`, and an author rule beats the UA stylesheet's `[hidden] { display: none }`
409
- whatever its specificity — there is no global `[hidden]` override in this product, and the
410
- existence of `.auto-panel[hidden] { display: none !important }` is the proof: it was
411
- written because it had to be. So `hidden` took the log out of the accessibility tree and
412
- left it PAINTED: an empty `flex: 1 1 auto` band with 32px of padding under the centred
413
- opening, shoving it off centre.
414
- ⚠ I HAD ALREADY WRITTEN THIS RULE DOWN one file over, for the opposite case — the note on
415
- `.autox-flow` says it works there BECAUSE that class sets no `display`. Knowing the rule
416
- did not stop me applying it to the one class that breaks it.
417
- ⛔ AND MY OWN OBSERVATION COULD NOT SEE IT: I read the rendered markup as TEXT, and a stray
418
- empty band has no text [[ui-invisible-to-assertions]].
419
- `logRef` is only read by `scrollDown`, which only runs once a turn exists, so unmounting
420
- costs nothing.
421
- */}
422
- {turns.length ? (
423
- <div className="autoc-log" ref={logRef}>
424
- {/*
425
- ⛔⛔ WAVE 36 · W36-T30 (owner item 4) — THE EMPTY-STATE PARAGRAPH IS DELETED, NOT REWORDED.
426
- Owner, verbatim: *"Remove this whole spill: 'Describe what "Odoo sync" should do and the
427
- assistant will draft the steps…' its really ugly."* It was three sentences of instruction
428
- standing where the conversation goes, and it said what the composer's own placeholder
429
- already says in six words.
430
- ⛔ WHAT REPLACES IT IS THE PLACEHOLDER, NOT A SECOND PARAGRAPH. An empty box with no
431
- affordance would be a different defect, so `autoc-input`'s `placeholder` and `aria-label`
432
- ("Describe what this agent should do") stay exactly as they are and carry the invitation.
433
- ⚠ A CENTRED EMPTY STATE BELONGS TO W36-T33, not here. Writing one now is the "second
434
- paragraph" this ticket's own done-when refuses, and it would pre-empt the surface T33
435
- rebuilds against `reference/Airtable AI 2.png`.
436
- ⚠ Deleting it orphaned two things, and both went with it rather than being left to rot
437
- [[artifact-with-no-importer]]: the `name` prop (its ONLY reader was the sentence above)
438
- and `.autoc-empty` in `automation.css` (its only user).
439
- */}
440
- {turns.map((t, i) => (
441
- <div key={i} className="autoc-turn">
442
- <div
443
- className={
444
- "autoc-msg " + (t.error ? "is-error" : t.who === "you" ? "is-you" : "is-agent")
445
- }
446
- >
447
- {t.text}
448
- </div>
449
- {t.who === "agent" ? (
450
- <footer className="as-citation" aria-label="Answer sources">
451
- {answerSourceFooter(t.provenance, [])}
452
- </footer>
453
- ) : null}
454
- {/* R6's second sentence, on screen: what the validator would not keep, named. */}
455
- {t.dropped?.length ? (
456
- <div className="autoc-dropped">
457
- Some of what it asked for will not be kept:
458
- <ul>
459
- {t.dropped.map((d, j) => (
460
- <li key={j}>{d}</li>
461
- ))}
462
- </ul>
463
- </div>
464
- ) : null}
465
- </div>
466
- ))}
467
- {busy ? (
468
- <div className="autoc-pending" role="status">
469
- {/* ⚠ `.lp-spin` is the ONE loading mark in this application and it is purple as of
470
- this wave. A second spinner vocabulary in a new surface is how an app stops
471
- having one. */}
472
- <span className="lp-spin" aria-hidden="true" />
473
- Drafting the steps
474
- </div>
475
- ) : null}
476
- </div>
477
- ) : null}
478
-
479
- {pending ? (
480
- <div className="autoc-accept">
481
- <span className="autoc-accept-note">
482
- {steps} step{steps === 1 ? "" : "s"} drafted
483
- {steps > MANY_STEPS ? ", which is a long flow. Read it before you accept." : "."}{" "}
484
- Nothing is saved until you add it to Workflows.
485
- </span>
486
- <button
487
- type="button"
488
- className="auto-btn"
489
- disabled={applying}
490
- onClick={() => setPending(null)}
491
- >
492
- Discard
493
- </button>
494
- <button
495
- type="button"
496
- className="auto-btn is-primary"
497
- disabled={applying}
498
- onClick={() => void accept()}
499
- >
500
- {applying ? "Adding" : "Add to Workflows"}
501
- </button>
502
- </div>
503
- ) : null}
504
-
505
- {/* ⚠ THE FOOT BAND IS THE CONVERSATION'S composer. While the transcript is empty the SAME
506
- const is rendered inside the centred opening above, so there is never a second one and
507
- never two on screen at once. */}
508
- {turns.length ? <div className="autoc-compose">{composer}</div> : null}
509
- </div>
510
- );
511
- }