@apotech-os/support-kit 8.4.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, settingsWarnings, AGENT_GUARDRAILS, toCategory, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED, toAuditTags, toGeneratedResponse, toTriageDecision, toAgent, toResponseComparison, isGeneratedResponseStatus, isInvalidatableStatus, toCategoryGroup, followupIntegrationName, FOLLOWUP_WEBHOOK_TRIGGER, followupWebhookPath, FOLLOWUP_WEBHOOK_FORM, NODE_NAMES, settingsToProfile, hasNoDraftNode, outcomeTags, DEFAULT_LLM_PROVIDER, computeWordDiff, requiresFollowup, isSendableVerdict, DEFAULT_MAX_TOOL_CALLS } from '../chunk-D3QGGJAI.js';
1
+ import { EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, settingsWarnings, SUPPORT_CHANNELS, AGENT_GUARDRAILS, toCategory, DEFAULT_AUTO_SEND_CHANNELS, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED, toAuditTags, toGeneratedResponse, toTriageDecision, toAgent, toResponseComparison, isGeneratedResponseStatus, isInvalidatableStatus, toCategoryGroup, followupIntegrationName, FOLLOWUP_WEBHOOK_TRIGGER, followupWebhookPath, FOLLOWUP_WEBHOOK_FORM, NODE_NAMES, settingsToProfile, hasNoDraftNode, outcomeTags, DEFAULT_LLM_PROVIDER, computeWordDiff, requiresFollowup, isSendableVerdict, COLLISION_GUARDRAILS, DEFAULT_MAX_TOOL_CALLS } from '../chunk-MHRKUDEZ.js';
2
2
  import { forwardRef, useState, useMemo, useRef, useCallback, useEffect, useId } from 'react';
3
- import { Textarea, cn, useAppContext, useAppSettings, DateRangeCompare, Link, Card, CardHeader, CardTitle, CardContent, AreaChart, StackedBarChart, Badge, useAppApi, useToast, Button, Select, DataTable, Spinner, Switch, Input, Checkbox, comparisonRange, SidePanel, Modal, Tooltip, buttonVariants, useAppRun, AppInvokeError, CopyButton, relativeDelta, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, downloadBlob } from '@apotech-os/ui-sdk';
3
+ import { Textarea, cn, useAppContext, useAppSettings, DateRangeCompare, Link, Card, CardHeader, CardTitle, CardContent, AreaChart, StackedBarChart, Badge, useAppApi, useToast, Button, Select, DataTable, Spinner, Switch, Checkbox, Input, comparisonRange, SidePanel, Modal, Tooltip, buttonVariants, useAppRun, AppInvokeError, CopyButton, relativeDelta, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, downloadBlob } from '@apotech-os/ui-sdk';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
 
6
6
  function useRecordList(objectKey, query, mapper) {
@@ -1275,6 +1275,7 @@ function toDeliveryPolicy(raw) {
1275
1275
  autoSendEnabled: settings.autoSendEnabled === true,
1276
1276
  senderEmail: senderEmail === "" ? null : senderEmail,
1277
1277
  whatsappMode: typeof settings.whatsappMode === "string" ? settings.whatsappMode : null,
1278
+ autoSendChannels: Array.isArray(settings.autoSendChannels) ? settings.autoSendChannels : [...DEFAULT_AUTO_SEND_CHANNELS],
1278
1279
  dryRun: settings.dryRun === true,
1279
1280
  audit: toAuditTags(settings)
1280
1281
  };
@@ -1333,24 +1334,113 @@ function WordDiffView({ title, tokens, keep, hideEqual = false }) {
1333
1334
 
1334
1335
  // src/ui/tickets/guardrail-labels.ts
1335
1336
  var NO_GUARDRAIL_REASON = "no_guardrail";
1336
- var GUARDRAIL_LABELS = {
1337
- whatsapp: "conversation WhatsApp",
1338
- whatsapp_stop: "le client a demand\xE9 \xE0 ne plus \xEAtre contact\xE9 (STOP)",
1339
- not_customer_turn: "le dernier message du fil est de nous",
1340
- judgeme: "avis Judge.me",
1341
- noreply_sender: "exp\xE9diteur automatique",
1342
- triage_not_high: "triage pas en confiance haute",
1343
- escalated: "ticket d\xE9j\xE0 escalad\xE9",
1344
- blocklist: "terme de la liste de blocage",
1345
- attachment: "pi\xE8ce jointe c\xF4t\xE9 client",
1346
- short_answer: "r\xE9ponse trop courte",
1347
- uncertainty_marker: "marqueur d\u2019incertitude dans la r\xE9ponse",
1348
- evaluation_missing: "aucune \xE9valuation produite"
1337
+ var GUARDRAIL_COPY = {
1338
+ whatsapp: {
1339
+ label: "conversation WhatsApp",
1340
+ explanation: "Le mode WhatsApp est r\xE9gl\xE9 sur \xAB escalade seule \xBB : sur ce canal la r\xE9ponse est r\xE9dig\xE9e puis confi\xE9e \xE0 un humain, jamais envoy\xE9e automatiquement."
1341
+ },
1342
+ whatsapp_stop: {
1343
+ label: "le client a demand\xE9 \xE0 ne plus \xEAtre contact\xE9 (STOP)",
1344
+ explanation: "Le client a \xE9crit \xAB STOP \xBB : il demande \xE0 ne plus \xEAtre contact\xE9. Rien ne part automatiquement, et le ticket est escalad\xE9 pour qu\u2019un humain acte la demande."
1345
+ },
1346
+ not_customer_turn: {
1347
+ label: "le dernier message du fil est de nous",
1348
+ explanation: "Le dernier message du fil vient de nous, pas du client : envoyer reviendrait \xE0 nous r\xE9pondre \xE0 nous-m\xEAmes."
1349
+ },
1350
+ judgeme: {
1351
+ label: "avis Judge.me",
1352
+ explanation: "Ce ticket est une notification d\u2019avis Judge.me, pas un message de client : il n\u2019appelle aucune r\xE9ponse automatique."
1353
+ },
1354
+ noreply_sender: {
1355
+ label: "exp\xE9diteur automatique",
1356
+ explanation: "L\u2019adresse de l\u2019exp\xE9diteur figure dans la liste des exp\xE9diteurs automatiques : la r\xE9ponse n\u2019atteindrait aucun humain."
1357
+ },
1358
+ triage_not_high: {
1359
+ label: "triage pas en confiance haute",
1360
+ explanation: "Le triage n\u2019a pas class\xE9 ce ticket avec une confiance haute, et les r\xE9glages exigent une confiance haute avant tout envoi automatique."
1361
+ },
1362
+ escalated: {
1363
+ label: "ticket d\xE9j\xE0 escalad\xE9",
1364
+ explanation: "Le ticket \xE9tait d\xE9j\xE0 escalad\xE9 vers un humain : l\u2019envoi automatique n\u2019a pas lieu d\u2019\xEAtre."
1365
+ },
1366
+ blocklist: {
1367
+ label: "terme de la liste de blocage",
1368
+ explanation: "Le premier message du client contient un terme de la liste de blocage : ces sujets passent obligatoirement par un humain."
1369
+ },
1370
+ attachment: {
1371
+ label: "pi\xE8ce jointe c\xF4t\xE9 client",
1372
+ explanation: "Le client a joint un ou plusieurs fichiers, que l\u2019agent ne sait pas lire : la r\xE9ponse part en revue humaine plut\xF4t que de r\xE9pondre \xE0 c\xF4t\xE9."
1373
+ },
1374
+ short_answer: {
1375
+ label: "r\xE9ponse trop courte",
1376
+ explanation: "Le brouillon fait moins de 20 caract\xE8res : trop court pour \xEAtre une vraie r\xE9ponse, il est retenu."
1377
+ },
1378
+ uncertainty_marker: {
1379
+ label: "marqueur d\u2019incertitude dans la r\xE9ponse",
1380
+ explanation: "Le brouillon contient une formule d\u2019incertitude (\xAB je ne suis pas s\xFBr \xBB, \xAB je ne peux pas \xBB\u2026) : une r\xE9ponse qui doute ne part pas seule."
1381
+ },
1382
+ evaluation_missing: {
1383
+ label: "aucune \xE9valuation produite",
1384
+ explanation: "Aucun verdict d\u2019\xE9valuation n\u2019a \xE9t\xE9 produit : sans jugement sur la r\xE9ponse, l\u2019envoi automatique est impossible."
1385
+ },
1386
+ customer_email_missing: {
1387
+ label: "client sans adresse e-mail",
1388
+ explanation: "Ce ticket n\u2019est pas un ticket WhatsApp, l\u2019envoi se ferait donc par e-mail \u2014 mais le client n\u2019a pas d\u2019adresse, ce qui est le cas des messages Instagram, Facebook ou SMS. Il n\u2019y a nulle part o\xF9 envoyer la r\xE9ponse."
1389
+ },
1390
+ ticket_closed: {
1391
+ label: "ticket ferm\xE9 entre-temps",
1392
+ explanation: "Le ticket a \xE9t\xE9 ferm\xE9 pendant que la r\xE9ponse se r\xE9digeait : l\u2019envoyer rouvrirait une conversation que quelqu\u2019un a close."
1393
+ },
1394
+ agent_replied: {
1395
+ label: "r\xE9ponse d\u2019un agent en cours de route",
1396
+ explanation: "Un agent a r\xE9pondu au client entre le lancement du run et l\u2019envoi : la r\xE9ponse automatique a \xE9t\xE9 annul\xE9e pour ne pas doubler la r\xE9ponse humaine."
1397
+ },
1398
+ diverged: {
1399
+ label: "la conversation a boug\xE9",
1400
+ explanation: "Le fil a chang\xE9 depuis la r\xE9daction \u2014 nouveau message, ou message modifi\xE9 : la r\xE9ponse pr\xE9par\xE9e ne correspond plus \xE0 ce que le client a \xE9crit."
1401
+ },
1402
+ run_deadline: {
1403
+ label: "d\xE9lai du run d\xE9pass\xE9",
1404
+ explanation: "Le run a d\xE9pass\xE9 son temps imparti avant de poster : la r\xE9ponse n\u2019est plus sous la responsabilit\xE9 de ce passage, elle n\u2019est pas envoy\xE9e."
1405
+ }
1406
+ };
1407
+ var NO_GUARDRAIL_COPY = {
1408
+ label: "bloqu\xE9e par le verdict ou le seuil, sans garde-fou",
1409
+ explanation: "Aucun garde-fou n\u2019a \xE9t\xE9 d\xE9clench\xE9 : c\u2019est le verdict du juge ou le seuil de confiance qui a retenu la r\xE9ponse."
1349
1410
  };
1411
+ function blockedTerm(hit) {
1412
+ return hit.startsWith("blocklist:") ? hit.slice("blocklist:".length) : null;
1413
+ }
1350
1414
  function guardrailHitLabel(hit) {
1351
- if (hit === NO_GUARDRAIL_REASON) return "bloqu\xE9e par le verdict ou le seuil, sans garde-fou";
1352
- if (hit.startsWith("blocklist:")) return `terme bloqu\xE9 \xAB ${hit.slice("blocklist:".length)} \xBB`;
1353
- return GUARDRAIL_LABELS[hit] ?? hit;
1415
+ if (hit === NO_GUARDRAIL_REASON) return NO_GUARDRAIL_COPY.label;
1416
+ const term = blockedTerm(hit);
1417
+ if (term !== null) return `terme bloqu\xE9 \xAB ${term} \xBB`;
1418
+ return GUARDRAIL_COPY[hit]?.label ?? hit;
1419
+ }
1420
+ function guardrailExplanation(hit) {
1421
+ if (hit === NO_GUARDRAIL_REASON) return NO_GUARDRAIL_COPY.explanation;
1422
+ const term = blockedTerm(hit);
1423
+ if (term !== null) {
1424
+ return `Le premier message du client contient \xAB ${term} \xBB, inscrit dans la liste de blocage : ces sujets passent obligatoirement par un humain.`;
1425
+ }
1426
+ return GUARDRAIL_COPY[hit]?.explanation ?? null;
1427
+ }
1428
+ var CHANNEL_LABELS = {
1429
+ email: "E-mail",
1430
+ whatsapp: "WhatsApp",
1431
+ chat: "Chat",
1432
+ phone: "T\xE9l\xE9phone",
1433
+ "contact-form": "Formulaire de contact",
1434
+ sms: "SMS",
1435
+ "instagram-direct-message": "Instagram (message priv\xE9)",
1436
+ "instagram-comment": "Instagram (commentaire)",
1437
+ "instagram-mention": "Instagram (mention)",
1438
+ "instagram-ad-comment": "Instagram (commentaire sous publicit\xE9)",
1439
+ facebook: "Facebook",
1440
+ "facebook-messenger": "Facebook Messenger"
1441
+ };
1442
+ function channelLabel(channel) {
1443
+ return CHANNEL_LABELS[channel] ?? channel;
1354
1444
  }
1355
1445
 
1356
1446
  // src/ui/tickets/timeline.ts
@@ -1432,9 +1522,10 @@ function deliveryReason(input) {
1432
1522
  var GENERIC_NOT_SENT = "R\xE9dig\xE9e, en attente d'un envoi.";
1433
1523
  function notSentReason({ job, policy, category }) {
1434
1524
  if (!job) return GENERIC_NOT_SENT;
1435
- if (job.autoSendDecision === "hold") {
1525
+ if (job.autoSendDecision === "hold" && job.guardrailHits.length === 0) {
1436
1526
  return "Mise en attente d\xE9finitive : cette r\xE9ponse ne repartira pas toute seule (refus d\u2019approbation, contr\xF4le de derni\xE8re minute, ou envoi interrompu puis repris).";
1437
1527
  }
1528
+ if (job.autoSendDecision === "hold") return guardrailReason(job);
1438
1529
  switch (job.outcome) {
1439
1530
  case "needs_human":
1440
1531
  return notSendableReason(job, policy);
@@ -1479,14 +1570,36 @@ function notEligibleReason(job, policy, category) {
1479
1570
  if (isWhatsapp && policy.whatsappMode === "draft_only") {
1480
1571
  return "Mode WhatsApp \xAB brouillon seul \xBB : la r\xE9ponse est r\xE9dig\xE9e, jamais envoy\xE9e automatiquement.";
1481
1572
  }
1482
- if (!policy.senderEmail && !(isWhatsapp && policy.whatsappMode === "auto_reply")) {
1573
+ if (job.ineligibleReason === "no_publication_path") {
1574
+ const channel = job.sourceChannel ? ` ${channelLabel(job.sourceChannel)}` : "";
1575
+ return `Aucun moyen de publier une r\xE9ponse sur ce ticket : Gorgias ne d\xE9clare pas le canal${channel} r\xE9pondable, ou le contact n'a pas l'adresse que ce canal exige. Le brouillon reste disponible pour un agent.`;
1576
+ }
1577
+ if (isRestrictedChannel(job.sourceChannel, policy.autoSendChannels)) {
1578
+ return `L'envoi automatique n'est pas activ\xE9 pour le canal ${channelLabel(job.sourceChannel ?? "")}. Le brouillon reste disponible pour un agent.`;
1579
+ }
1580
+ if (!policy.senderEmail && !isWhatsapp) {
1483
1581
  return "Aucune adresse d'exp\xE9dition n'est configur\xE9e dans les r\xE9glages.";
1484
1582
  }
1485
1583
  return GENERIC_NOT_SENT;
1486
1584
  }
1585
+ function isRestrictedChannel(sourceChannel, allowed) {
1586
+ if (!sourceChannel) return false;
1587
+ if (!SUPPORT_CHANNELS.includes(sourceChannel)) return false;
1588
+ return !allowed.includes(sourceChannel);
1589
+ }
1487
1590
  function guardrailReason(job) {
1488
- if (job.guardrailHits.length === 0) return "Un garde-fou a bloqu\xE9 l'envoi.";
1489
- return `Garde-fou d\xE9clench\xE9 : ${job.guardrailHits.map(guardrailHitLabel).join(", ")}.`;
1591
+ const [first, ...rest] = job.guardrailHits;
1592
+ if (first === void 0) {
1593
+ return "Un garde-fou a bloqu\xE9 l\u2019envoi (r\xE9ponse ant\xE9rieure \xE0 l\u2019enregistrement du motif).";
1594
+ }
1595
+ const explanation = guardrailExplanation(first);
1596
+ const head = `Garde-fou d\xE9clench\xE9 : ${guardrailHitLabel(first)}.`;
1597
+ const others = rest.length > 0 ? ` \xC9galement d\xE9clench\xE9 : ${rest.map(guardrailHitLabel).join(", ")}.` : "";
1598
+ return `${head}${explanation ? ` ${explanation}` : ""}${others}${reconstructionCaveat(job)}`;
1599
+ }
1600
+ function reconstructionCaveat(job) {
1601
+ if (!job.guardrailHitsReconstructedAt) return "";
1602
+ return " (Motif reconstitu\xE9 a posteriori depuis Gorgias \u2014 lecture faite avec les r\xE9glages actuels.)";
1490
1603
  }
1491
1604
  function legacyNotSentReason(job, policy, category) {
1492
1605
  if (job.guardrailHits.length > 0) return guardrailReason(job);
@@ -4426,6 +4539,9 @@ function describeConnection(connections) {
4426
4539
  }
4427
4540
  return { text: `${fallback.label} (par d\xE9faut, parmi ${connections.length} connexions)`, tone: "normal" };
4428
4541
  }
4542
+ function SettingsWarnings({ warnings }) {
4543
+ return /* @__PURE__ */ jsx(Fragment, { children: warnings.map((warning) => /* @__PURE__ */ jsx("p", { className: "text-sm text-status-pending", children: warning.message }, warning.key)) });
4544
+ }
4429
4545
  function SettingsPage() {
4430
4546
  const { appSlug, role } = useAppContext();
4431
4547
  const canWrite = canWriteForRole(role);
@@ -4499,9 +4615,18 @@ function SettingsPage() {
4499
4615
  const claimUnverifiable = installedAppsUnavailable || uncheckedAppSlugs.length > 0;
4500
4616
  const issues = validateSettings(form);
4501
4617
  const warnings = settingsWarnings(form);
4618
+ const sendWarnings = warnings.filter((warning) => warning.key === "noAutoSendChannels");
4619
+ const tagWarnings = warnings.filter((warning) => warning.key !== "noAutoSendChannels");
4502
4620
  const nodesIssue = issues.find((issue) => issue.key === "nodes");
4503
4621
  const summaryIssues = issues.filter((issue) => issue !== nodesIssue);
4504
4622
  const guardrailsActive = Array.isArray(form.guardrailsActive) ? form.guardrailsActive : [];
4623
+ const autoSendChannels = Array.isArray(form.autoSendChannels) ? form.autoSendChannels : [];
4624
+ function toggleAutoSendChannel(channel, checked) {
4625
+ set(
4626
+ "autoSendChannels",
4627
+ checked ? [.../* @__PURE__ */ new Set([...autoSendChannels, channel])] : autoSendChannels.filter((c) => c !== channel)
4628
+ );
4629
+ }
4505
4630
  function toggleGuardrail(id, checked) {
4506
4631
  set(
4507
4632
  "guardrailsActive",
@@ -4627,6 +4752,20 @@ function SettingsPage() {
4627
4752
  ),
4628
4753
  "Envoi automatique"
4629
4754
  ] }),
4755
+ /* @__PURE__ */ jsxs("div", { children: [
4756
+ /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Canaux o\xF9 l'envoi automatique s'applique" }),
4757
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-1", children: SUPPORT_CHANNELS.map((channel) => /* @__PURE__ */ jsx(
4758
+ Checkbox,
4759
+ {
4760
+ label: channelLabel(channel),
4761
+ checked: autoSendChannels.includes(channel),
4762
+ onCheckedChange: (checked) => toggleAutoSendChannel(channel, checked),
4763
+ disabled: !canWrite
4764
+ },
4765
+ channel
4766
+ )) }),
4767
+ /* @__PURE__ */ jsx(SettingsWarnings, { warnings: sendWarnings })
4768
+ ] }),
4630
4769
  /* @__PURE__ */ jsxs("div", { children: [
4631
4770
  /* @__PURE__ */ jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
4632
4771
  /* @__PURE__ */ jsx(
@@ -4680,7 +4819,7 @@ function SettingsPage() {
4680
4819
  /* @__PURE__ */ jsx(Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
4681
4820
  ] }, key)),
4682
4821
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Le tag d\u2019appartenance est pos\xE9 sur chaque ticket que le triage examine, dans le m\xEAme appel que les tags ci-dessus. Il doit \xEAtre propre \xE0 cette app : c\u2019est lui qui distingue ses tickets de ceux d\u2019une autre app install\xE9e sur le m\xEAme compte Gorgias." }),
4683
- warnings.map((warning) => /* @__PURE__ */ jsx("p", { className: "text-sm text-status-pending", children: warning.message }, warning.key))
4822
+ /* @__PURE__ */ jsx(SettingsWarnings, { warnings: tagWarnings })
4684
4823
  ] }) }),
4685
4824
  /* @__PURE__ */ jsx(
4686
4825
  FollowupWebhookCard,
@@ -6226,7 +6365,6 @@ function tagOrigin(tag, settings) {
6226
6365
  }
6227
6366
 
6228
6367
  // src/ui/test/verdict-summary.ts
6229
- var COLLISION_GUARDRAILS = ["ticket_closed", "agent_replied", "diverged", "customer_email_missing", "run_deadline"];
6230
6368
  function base(result) {
6231
6369
  return { label: outcomeLabel(result.outcome), collisionHits: [], contentHits: [] };
6232
6370
  }
@@ -6242,17 +6380,29 @@ function needsHumanSentence(result) {
6242
6380
  const confidencePct = verdict.confidence !== null ? `${Math.round(verdict.confidence * 100)} %` : "une confiance inconnue";
6243
6381
  return `Le juge a r\xE9pondu \xAB ${verdict.verdict} \xBB avec ${confidencePct} de confiance${verdict.reason ? ` : ${verdict.reason}` : "."}`;
6244
6382
  }
6383
+ function isCollisionHit(hit) {
6384
+ return COLLISION_GUARDRAILS.includes(hit);
6385
+ }
6245
6386
  function guardrailHoldSummary(result) {
6246
- const collisionHits = result.guardrailHits.filter((hit) => COLLISION_GUARDRAILS.includes(hit));
6247
- const contentHits = result.guardrailHits.filter((hit) => !COLLISION_GUARDRAILS.includes(hit));
6387
+ const collisionHits = result.guardrailHits.filter((hit) => isCollisionHit(hit));
6388
+ const contentHits = result.guardrailHits.filter((hit) => !isCollisionHit(hit));
6248
6389
  const sentence = collisionHits.length > 0 ? "Le contr\xF4le anti-collision, juste avant de poster, a bloqu\xE9 la r\xE9ponse : la conversation avait boug\xE9." : `${contentHits.length} garde-fou${contentHits.length > 1 ? "s" : ""} de contenu ${contentHits.length > 1 ? "ont" : "a"} bloqu\xE9 la r\xE9ponse avant l'envoi.`;
6249
6390
  return { sentence, collisionHits, contentHits };
6250
6391
  }
6251
- function readySentence(result) {
6392
+ function readySummary(result) {
6393
+ if (result.ineligibleReason === "no_publication_path") {
6394
+ return {
6395
+ tone: "warning",
6396
+ sentence: "La r\xE9ponse est pr\xEAte pour l'extension, mais rien ne permet de la publier : Gorgias ne d\xE9clare pas ce canal r\xE9pondable, ou le contact n'a pas l'adresse que ce canal exige."
6397
+ };
6398
+ }
6252
6399
  if (!result.verdict) {
6253
- return "La r\xE9ponse est pr\xEAte pour l'extension. L'envoi n'a pas \xE9t\xE9 tent\xE9 : sans \xE9valuation, aucun verdict n'a \xE9t\xE9 produit, et l'envoi auto est impossible par construction.";
6400
+ return {
6401
+ tone: "success",
6402
+ sentence: "La r\xE9ponse est pr\xEAte pour l'extension. L'envoi n'a pas \xE9t\xE9 tent\xE9 : sans \xE9valuation, aucun verdict n'a \xE9t\xE9 produit, et l'envoi auto est impossible par construction."
6403
+ };
6254
6404
  }
6255
- return "La r\xE9ponse est pr\xEAte pour l'extension. L'envoi automatique n'\xE9tait pas \xE9ligible.";
6405
+ return { tone: "success", sentence: "La r\xE9ponse est pr\xEAte pour l'extension. L'envoi automatique n'\xE9tait pas \xE9ligible." };
6256
6406
  }
6257
6407
  function describeVerdict(result) {
6258
6408
  if (result.error) {
@@ -6277,7 +6427,7 @@ function describeVerdict(result) {
6277
6427
  case "guardrail_hold":
6278
6428
  return { ...base(result), tone: "warning", ...guardrailHoldSummary(result) };
6279
6429
  case "ready":
6280
- return { ...base(result), tone: "success", sentence: readySentence(result) };
6430
+ return { ...base(result), ...readySummary(result) };
6281
6431
  case "escalated":
6282
6432
  return { ...base(result), tone: "warning", sentence: "Le n\u0153ud d'escalade a pass\xE9 la main \xE0 un humain \u2014 aucune r\xE9ponse n'a \xE9t\xE9 r\xE9dig\xE9e." };
6283
6433
  case "triaged_only":