@apotech-os/support-kit 8.1.0 → 8.3.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,5 +1,5 @@
1
- import { EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, AGENT_GUARDRAILS, toCategory, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED, toAuditTags, toAgent, toGeneratedResponse, toResponseComparison, toTriageDecision, 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-LXHPPWPM.js';
2
- import { forwardRef, useState, useMemo, useRef, useEffect, useCallback, useId } from 'react';
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-WVKCRPMV.js';
2
+ import { forwardRef, useState, useMemo, useRef, useCallback, useEffect, useId } from 'react';
3
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';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -1013,7 +1013,8 @@ function LangfuseTraceLink({ traceId, observationId, config, label = "Voir la tr
1013
1013
  if (!traceId) {
1014
1014
  return observationId ? /* @__PURE__ */ jsx(CopyButton, { value: observationId, label }) : null;
1015
1015
  }
1016
- if (!config?.baseUrl || !config?.projectId) return null;
1016
+ if (!config) return null;
1017
+ if (!config.baseUrl || !config.projectId) return /* @__PURE__ */ jsx(CopyButton, { value: traceId, label });
1017
1018
  const origin = parseHttpOrigin(config.baseUrl);
1018
1019
  if (!origin) return null;
1019
1020
  const url = buildTraceUrl(origin, config.projectId, traceId, observationId);
@@ -1096,6 +1097,74 @@ function outcomeLabel(outcome) {
1096
1097
  return outcome ? OUTCOME_LABELS[outcome] : "\u2014";
1097
1098
  }
1098
1099
 
1100
+ // src/ui/tickets/generation-origin.ts
1101
+ var ORIGINS = {
1102
+ first: { kind: "first", label: "1re r\xE9ponse" },
1103
+ followup: { kind: "followup", label: "Message suivant" },
1104
+ test: { kind: "test", label: "Brouillon d'essai" }
1105
+ };
1106
+ function generationOrigin(decision, job) {
1107
+ if (job?.status === "test_draft") return ORIGINS.test;
1108
+ return decision.origin === "followup" ? ORIGINS.followup : ORIGINS.first;
1109
+ }
1110
+ var HISTORY_LIMIT = 100;
1111
+ function useTicketHistory(ticketId) {
1112
+ const { appSlug } = useAppContext();
1113
+ const api = useAppApi();
1114
+ const [entries, setEntries] = useState([]);
1115
+ const clientRef = useRef(api);
1116
+ clientRef.current = api;
1117
+ const requestIdRef = useRef(0);
1118
+ const loadedTicketIdRef = useRef(null);
1119
+ const load = useCallback(async () => {
1120
+ const requestId = ++requestIdRef.current;
1121
+ if (ticketId === null) {
1122
+ loadedTicketIdRef.current = null;
1123
+ setEntries([]);
1124
+ return;
1125
+ }
1126
+ if (loadedTicketIdRef.current !== ticketId) {
1127
+ loadedTicketIdRef.current = null;
1128
+ setEntries([]);
1129
+ }
1130
+ const byTicket = (sortField) => ({
1131
+ filter: JSON.stringify({ ticketId: { eq: ticketId } }),
1132
+ sort: JSON.stringify([{ field: sortField, direction: "asc" }]),
1133
+ limit: String(HISTORY_LIMIT)
1134
+ });
1135
+ try {
1136
+ const [decisionsPage, jobsPage] = await Promise.all([
1137
+ clientRef.current.get(`/data/apps/${appSlug}/records/triage-decision`, byTicket("decidedAt")),
1138
+ // No sort: these land in a Map keyed by the unique `triageDecisionId`,
1139
+ // so their order is irrelevant (and `generatedAt` is nullable anyway).
1140
+ clientRef.current.get(`/data/apps/${appSlug}/records/generated-response`, {
1141
+ filter: JSON.stringify({ ticketId: { eq: ticketId } }),
1142
+ limit: String(HISTORY_LIMIT)
1143
+ })
1144
+ ]);
1145
+ if (requestId !== requestIdRef.current) return;
1146
+ const jobByDecisionId = /* @__PURE__ */ new Map();
1147
+ for (const record of jobsPage.items) {
1148
+ const job = toGeneratedResponse(record);
1149
+ if (job.triageDecisionId) jobByDecisionId.set(job.triageDecisionId, job);
1150
+ }
1151
+ loadedTicketIdRef.current = ticketId;
1152
+ setEntries(
1153
+ decisionsPage.items.map((record) => toTriageDecision(record)).map((decision) => ({ decision, job: jobByDecisionId.get(decision.id) }))
1154
+ );
1155
+ } catch {
1156
+ if (requestId === requestIdRef.current) setEntries([]);
1157
+ }
1158
+ }, [ticketId, appSlug]);
1159
+ useEffect(() => {
1160
+ void load();
1161
+ return () => {
1162
+ requestIdRef.current += 1;
1163
+ };
1164
+ }, [load]);
1165
+ return { entries, refresh: load };
1166
+ }
1167
+
1099
1168
  // src/ui/tickets/ticket-outcome.ts
1100
1169
  var NO_JOB = { label: "Aucune r\xE9ponse g\xE9n\xE9r\xE9e", variant: "neutral" };
1101
1170
  function responseOutcome(job) {
@@ -1373,7 +1442,7 @@ function dedupe(names) {
1373
1442
  }
1374
1443
  function triageTagNames(input) {
1375
1444
  const { decision, category, policy } = input;
1376
- return [decision.tag, ...category?.extraTags ?? [], policy?.audit.handledTag];
1445
+ return [decision.tag, ...category?.extraTags ?? [], policy?.audit.handledTag, policy?.audit.appScopeTag];
1377
1446
  }
1378
1447
  function wasSimulated(job, policy) {
1379
1448
  if (!job) return false;
@@ -1398,7 +1467,7 @@ function ticketActions(input) {
1398
1467
  return { tags, taken, skipped, simulated, unrecorded: job !== void 0 && job.outcome === null };
1399
1468
  }
1400
1469
  function TimelinePanel(props) {
1401
- const { decision, job, comparisons, conversation, conversationLoading, categoryName, policy, category, onClose, onInvalidate, isInvalidating } = props;
1470
+ const { decision, job, comparisons, conversation, conversationLoading, categoryName, policy, category, onClose, onInvalidate, isInvalidating, history, onSelectGeneration } = props;
1402
1471
  const steps = buildTimeline({ decision, job, comparisons, conversation, conversationLoading, policy, category });
1403
1472
  const notSentReason2 = steps.find((step2) => step2.key === "delivery")?.reason ?? null;
1404
1473
  const actions = ticketActions({ decision, job, policy, category, notSentReason: notSentReason2 });
@@ -1408,10 +1477,41 @@ function TimelinePanel(props) {
1408
1477
  /* @__PURE__ */ jsx(TicketLink, { ticketId: decision.ticketId, url: decision.ticketUrl, label: "Ouvrir le ticket dans Gorgias" }),
1409
1478
  onInvalidate && canInvalidate && /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onInvalidate, disabled: isInvalidating, children: isInvalidating ? "Invalidation\u2026" : "Invalider la r\xE9ponse" })
1410
1479
  ] }),
1480
+ history !== void 0 && history.length > 1 && /* @__PURE__ */ jsx(ThreadHistory, { history, selectedDecisionId: decision.id, onSelect: onSelectGeneration }),
1411
1481
  steps.map((step2, index) => /* @__PURE__ */ jsx(StepBlock, { step: step2, index, last: index === steps.length - 1, children: step2.reached ? renderStep(step2.key, props) : null }, step2.key)),
1412
1482
  /* @__PURE__ */ jsx(ActionsBlock, { actions })
1413
1483
  ] }) });
1414
1484
  }
1485
+ function ThreadHistory({
1486
+ history,
1487
+ selectedDecisionId,
1488
+ onSelect
1489
+ }) {
1490
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1 border-b pb-3", children: [
1491
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-medium", children: "Historique du fil" }),
1492
+ /* @__PURE__ */ jsx("ul", { className: "space-y-1", children: history.map(({ decision, job }) => {
1493
+ const selected = decision.id === selectedDecisionId;
1494
+ const origin = generationOrigin(decision, job);
1495
+ const outcome = responseOutcome(job);
1496
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
1497
+ "button",
1498
+ {
1499
+ type: "button",
1500
+ onClick: onSelect ? () => onSelect(decision) : void 0,
1501
+ "aria-current": selected || void 0,
1502
+ className: `flex w-full items-center justify-between gap-2 rounded border px-2 py-1 text-left text-xs ${selected ? "border-primary/40 bg-primary/5" : "border-border hover:bg-muted/40"}`,
1503
+ children: [
1504
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
1505
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: formatDate(decision.decidedAt) }),
1506
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: origin.label })
1507
+ ] }),
1508
+ /* @__PURE__ */ jsx(Badge, { variant: outcome.variant, children: outcome.label })
1509
+ ]
1510
+ }
1511
+ ) }, decision.id);
1512
+ }) })
1513
+ ] });
1514
+ }
1415
1515
  function StepBlock({
1416
1516
  step: step2,
1417
1517
  index,
@@ -1652,6 +1752,16 @@ var CORRECTED_OPTIONS = [
1652
1752
  { value: "true", label: "Corrig\xE9s par un humain" },
1653
1753
  { value: "false", label: "Non corrig\xE9s" }
1654
1754
  ];
1755
+ var ORIGIN_FILTER_OPTIONS = [
1756
+ { value: "", label: "Toutes origines" },
1757
+ { value: "first", label: "1res r\xE9ponses" },
1758
+ { value: "followup", label: "Messages suivants" },
1759
+ { value: "test", label: "Brouillons d'essai" }
1760
+ ];
1761
+ var VIEW_MODE_OPTIONS = [
1762
+ { value: "byTicket", label: "Une ligne par ticket" },
1763
+ { value: "all", label: "Toutes les g\xE9n\xE9rations" }
1764
+ ];
1655
1765
  function OutcomeBadge({ outcome }) {
1656
1766
  return /* @__PURE__ */ jsx(Badge, { variant: OUTCOME_BADGE_VARIANT[outcome.variant], children: outcome.label });
1657
1767
  }
@@ -1670,19 +1780,36 @@ function TicketsPage() {
1670
1780
  const [verdictFilter, setVerdictFilter] = useState("");
1671
1781
  const [promptVersionFilter, setPromptVersionFilter] = useState("");
1672
1782
  const [correctedFilter, setCorrectedFilter] = useState("");
1783
+ const [originFilter, setOriginFilter] = useState("");
1784
+ const [viewMode, setViewMode] = useState("byTicket");
1673
1785
  const [detailDecision, setDetailDecision] = useState(null);
1674
1786
  const [isTriaging, setIsTriaging] = useState(false);
1675
1787
  const [isInvalidating, setIsInvalidating] = useState(false);
1788
+ const requestedTicket = useQueryParam("ticket").value;
1789
+ const [ticketSearch, setTicketSearch] = useState(() => requestedTicket?.trim() ?? "");
1790
+ const searchDebounce = useRef(null);
1791
+ const onTableStateChange = useCallback((tableState) => {
1792
+ if (searchDebounce.current) clearTimeout(searchDebounce.current);
1793
+ searchDebounce.current = setTimeout(() => setTicketSearch(tableState.search.trim()), 300);
1794
+ }, []);
1795
+ useEffect(
1796
+ () => () => {
1797
+ if (searchDebounce.current) clearTimeout(searchDebounce.current);
1798
+ },
1799
+ []
1800
+ );
1801
+ const history = useTicketHistory(detailDecision?.ticketId ?? null);
1676
1802
  const [triageInFlight] = useState(() => ({ current: false }));
1677
1803
  const periodKey = JSON.stringify(period);
1678
1804
  const bounds = useMemo(() => periodBoundsOf(JSON.parse(periodKey)).current, [periodKey]);
1679
1805
  const decisionFilter = useMemo(() => {
1806
+ if (ticketSearch) return { ticketId: { eq: ticketSearch } };
1680
1807
  const filter = { decidedAt: { gte: bounds.fromIso, lte: bounds.toIso } };
1681
1808
  if (categoryFilter) filter.categoryId = { eq: categoryFilter };
1682
1809
  if (escalatedFilter) filter.escalated = { eq: escalatedFilter === "true" };
1683
1810
  if (confidenceFilter) filter.confidence = { eq: confidenceFilter };
1684
1811
  return filter;
1685
- }, [bounds.fromIso, bounds.toIso, categoryFilter, escalatedFilter, confidenceFilter]);
1812
+ }, [ticketSearch, bounds.fromIso, bounds.toIso, categoryFilter, escalatedFilter, confidenceFilter]);
1686
1813
  const {
1687
1814
  rows: decisions,
1688
1815
  isLoading: decisionsLoading,
@@ -1735,7 +1862,7 @@ function TicketsPage() {
1735
1862
  const agentNames = useMemo(() => toNameMap(agents), [agents]);
1736
1863
  const { config: langfuseConfig } = useLangfuseConfig();
1737
1864
  function refreshAll() {
1738
- return Promise.all([refreshDecisions(), refreshJobs(), refreshComparisons()]).then(() => void 0);
1865
+ return Promise.all([refreshDecisions(), refreshJobs(), refreshComparisons(), history.refresh()]).then(() => void 0);
1739
1866
  }
1740
1867
  const jobByDecisionId = useMemo(() => {
1741
1868
  const map = /* @__PURE__ */ new Map();
@@ -1782,10 +1909,20 @@ function TicketsPage() {
1782
1909
  if (promptVersionFilter && String(row.job?.promptVersion ?? "") !== promptVersionFilter) return false;
1783
1910
  if (correctedFilter === "true" && row.comparisons.length === 0) return false;
1784
1911
  if (correctedFilter === "false" && row.comparisons.length > 0) return false;
1912
+ if (originFilter && generationOrigin(row.decision, row.job).kind !== originFilter) return false;
1785
1913
  return true;
1786
1914
  });
1787
- }, [decisions, jobByDecisionId, comparisonsByTicketId, outcomeFilter, verdictFilter, promptVersionFilter, correctedFilter]);
1788
- const requestedTicket = useQueryParam("ticket").value;
1915
+ }, [decisions, jobByDecisionId, comparisonsByTicketId, outcomeFilter, verdictFilter, promptVersionFilter, correctedFilter, originFilter]);
1916
+ const listRows = useMemo(() => {
1917
+ if (viewMode === "all") return rows.map((row) => ({ ...row, turnCount: 1 }));
1918
+ const byTicket = /* @__PURE__ */ new Map();
1919
+ for (const row of rows) {
1920
+ const seen = byTicket.get(row.decision.ticketId);
1921
+ if (seen) seen.turnCount += 1;
1922
+ else byTicket.set(row.decision.ticketId, { ...row, turnCount: 1 });
1923
+ }
1924
+ return [...byTicket.values()];
1925
+ }, [rows, viewMode]);
1789
1926
  const deepLinkConsumed = useRef(false);
1790
1927
  useEffect(() => {
1791
1928
  if (deepLinkConsumed.current || !requestedTicket) return;
@@ -1833,6 +1970,25 @@ function TicketsPage() {
1833
1970
  }
1834
1971
  const columns = [
1835
1972
  { key: "ticketId", header: "Ticket", cell: ({ decision }) => /* @__PURE__ */ jsx(TicketLink, { ticketId: decision.ticketId, url: decision.ticketUrl }) },
1973
+ {
1974
+ key: "turns",
1975
+ header: "Tours",
1976
+ // Only a multi-turn ticket is worth marking: badging every row would
1977
+ // make the multi-turn ones invisible by saturation.
1978
+ cell: ({ turnCount }) => turnCount > 1 ? /* @__PURE__ */ jsxs(Badge, { variant: "neutral", children: [
1979
+ turnCount,
1980
+ " tours"
1981
+ ] }) : null
1982
+ },
1983
+ {
1984
+ key: "origin",
1985
+ header: "Origine",
1986
+ cell: ({ decision, job }) => {
1987
+ const origin = generationOrigin(decision, job);
1988
+ if (origin.kind === "first") return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: origin.label });
1989
+ return /* @__PURE__ */ jsx(Badge, { variant: origin.kind === "test" ? "warning" : "info", children: origin.label });
1990
+ }
1991
+ },
1836
1992
  { key: "category", header: "Cat\xE9gorie", cell: ({ decision }) => decision.categoryId && categoryNames.get(decision.categoryId) || "\u2014" },
1837
1993
  { key: "tag", header: "Tag", cell: ({ decision }) => decision.tag ? /* @__PURE__ */ jsx("code", { className: "text-xs", children: decision.tag }) : "\u2014" },
1838
1994
  {
@@ -1889,7 +2045,12 @@ function TicketsPage() {
1889
2045
  },
1890
2046
  { key: "decidedAt", header: "D\xE9cid\xE9 le", cell: ({ decision }) => formatDate(decision.decidedAt) }
1891
2047
  ];
1892
- const detailRow = detailDecision ? rows.find((row) => row.decision.id === detailDecision.id) : void 0;
2048
+ const historyEntry = detailDecision ? history.entries.find((entry) => entry.decision.id === detailDecision.id) : void 0;
2049
+ const pageRow = detailDecision ? rows.find((row) => row.decision.id === detailDecision.id) : void 0;
2050
+ const detailRow = detailDecision ? {
2051
+ job: historyEntry?.job ?? pageRow?.job,
2052
+ comparisons: comparisonsByTicketId.get(detailDecision.ticketId) ?? []
2053
+ } : void 0;
1893
2054
  const liveConversation = useLiveConversation(detailDecision, detailRow);
1894
2055
  const isLoading = decisionsLoading || jobsLoading;
1895
2056
  const combinedError = decisionsError ?? jobsError ?? comparisonsError;
@@ -1923,10 +2084,21 @@ function TicketsPage() {
1923
2084
  /* @__PURE__ */ jsx(Select, { items: VERDICT_OPTIONS, value: verdictFilter, onValueChange: setVerdictFilter, placeholder: "Tous les verdicts", "aria-label": "Filtrer par verdict" }),
1924
2085
  /* @__PURE__ */ jsx(Select, { items: promptVersionOptions, value: promptVersionFilter, onValueChange: setPromptVersionFilter, placeholder: "Toutes versions de prompt", "aria-label": "Filtrer par version de prompt" }),
1925
2086
  /* @__PURE__ */ jsx(Select, { items: CORRECTED_OPTIONS, value: correctedFilter, onValueChange: setCorrectedFilter, placeholder: "Corrig\xE9s ou non", "aria-label": "Filtrer par correction humaine" }),
1926
- rows.length > 0 && /* @__PURE__ */ jsxs("span", { className: "ml-auto text-sm text-muted-foreground", children: [
1927
- rows.length,
2087
+ /* @__PURE__ */ jsx(Select, { items: ORIGIN_FILTER_OPTIONS, value: originFilter, onValueChange: setOriginFilter, placeholder: "Toutes origines", "aria-label": "Filtrer par origine" }),
2088
+ /* @__PURE__ */ jsx(
2089
+ Select,
2090
+ {
2091
+ items: VIEW_MODE_OPTIONS,
2092
+ value: viewMode,
2093
+ onValueChange: (value) => setViewMode(value === "all" ? "all" : "byTicket"),
2094
+ placeholder: "Une ligne par ticket",
2095
+ "aria-label": "Filtrer par mode d'affichage"
2096
+ }
2097
+ ),
2098
+ listRows.length > 0 && /* @__PURE__ */ jsxs("span", { className: "ml-auto text-sm text-muted-foreground", children: [
2099
+ listRows.length,
1928
2100
  " ticket",
1929
- rows.length > 1 ? "s" : "",
2101
+ listRows.length > 1 ? "s" : "",
1930
2102
  " sur cette page"
1931
2103
  ] })
1932
2104
  ] }),
@@ -1934,9 +2106,12 @@ function TicketsPage() {
1934
2106
  DataTable,
1935
2107
  {
1936
2108
  columns,
1937
- rows,
2109
+ rows: listRows,
1938
2110
  rowId: (row) => row.decision.id,
1939
2111
  manual: true,
2112
+ defaultState: { search: requestedTicket?.trim() ?? "" },
2113
+ onStateChange: onTableStateChange,
2114
+ searchPlaceholder: "ID de ticket\u2026",
1940
2115
  loading: isLoading,
1941
2116
  onRowClick: (row) => setDetailDecision(row.decision),
1942
2117
  pagination: {
@@ -1969,6 +2144,8 @@ function TicketsPage() {
1969
2144
  category: categories.find((entry) => entry.id === detailDecision.categoryId) ?? null,
1970
2145
  agentName: detailRow?.job?.agentId && agentNames.get(detailRow.job.agentId) || "\u2014",
1971
2146
  langfuseConfig,
2147
+ history: history.entries,
2148
+ onSelectGeneration: (selected) => setDetailDecision(selected),
1972
2149
  onClose: () => setDetailDecision(null),
1973
2150
  onInvalidate: canWrite && detailRow?.job ? () => void invalidateResponse(detailRow.job.id) : void 0,
1974
2151
  isInvalidating
@@ -4238,6 +4415,7 @@ function SettingsPage() {
4238
4415
  const claimedView = views.find((v) => v.id === sourceViewId);
4239
4416
  const claimUnverifiable = installedAppsUnavailable || uncheckedAppSlugs.length > 0;
4240
4417
  const issues = validateSettings(form);
4418
+ const warnings = settingsWarnings(form);
4241
4419
  const nodesIssue = issues.find((issue) => issue.key === "nodes");
4242
4420
  const summaryIssues = issues.filter((issue) => issue !== nodesIssue);
4243
4421
  const guardrailsActive = Array.isArray(form.guardrailsActive) ? form.guardrailsActive : [];
@@ -4412,11 +4590,14 @@ function SettingsPage() {
4412
4590
  ["escalationTag", "Tag d'escalade"],
4413
4591
  ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
4414
4592
  ["needsReviewTag", "Tag \xE0 revoir avant envoi"],
4415
- ["followupTag", "Tag suivi requis"]
4593
+ ["followupTag", "Tag suivi requis"],
4594
+ ["appScopeTag", "Tag d'appartenance"]
4416
4595
  ].map(([key, label]) => /* @__PURE__ */ jsxs("div", { children: [
4417
4596
  /* @__PURE__ */ jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
4418
4597
  /* @__PURE__ */ jsx(Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
4419
- ] }, key))
4598
+ ] }, key)),
4599
+ /* @__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." }),
4600
+ warnings.map((warning) => /* @__PURE__ */ jsx("p", { className: "text-sm text-status-pending", children: warning.message }, warning.key))
4420
4601
  ] }) }),
4421
4602
  /* @__PURE__ */ jsx(
4422
4603
  FollowupWebhookCard,
@@ -5956,6 +6137,7 @@ function tagOrigin(tag, settings) {
5956
6137
  if (tag === str(settings.followupTag)) return "tag de suivi";
5957
6138
  if (tag === str(settings.escalationTag)) return "tag d'escalade";
5958
6139
  if (tag === str(settings.handledTag)) return "tag de traitement";
6140
+ if (tag === str(settings.appScopeTag)) return "tag d'appartenance";
5959
6141
  if (tag === str(settings.unknownTag)) return "classification de repli";
5960
6142
  return "classification";
5961
6143
  }
@@ -6190,7 +6372,8 @@ function parseRunResult(result) {
6190
6372
  gates: raw.gates,
6191
6373
  categoryName: typeof raw.categoryName === "string" ? raw.categoryName : null,
6192
6374
  outcome: typeof raw.outcome === "string" ? raw.outcome : null,
6193
- responseId: typeof raw.responseId === "string" ? raw.responseId : null
6375
+ responseId: typeof raw.responseId === "string" ? raw.responseId : null,
6376
+ ticketUrl: typeof raw.ticketUrl === "string" ? raw.ticketUrl : null
6194
6377
  };
6195
6378
  }
6196
6379
  function describeRunDecision(result, mode) {
@@ -6303,7 +6486,13 @@ function FollowupWebhookCard2() {
6303
6486
  /* @__PURE__ */ jsx("p", { className: "text-xs font-medium", children: "Brouillon g\xE9n\xE9r\xE9" }),
6304
6487
  /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap rounded border bg-muted/30 p-2 text-xs", children: draftText })
6305
6488
  ] }),
6306
- /* @__PURE__ */ jsx("p", { className: "text-xs", children: /* @__PURE__ */ jsx(Link, { href: `/espace/${appSlug}/tickets?ticket=${encodeURIComponent(runResult.ticketId ?? test.ticketId)}`, children: "Ouvrir la fiche du ticket" }) })
6489
+ /* @__PURE__ */ jsxs("p", { className: "text-xs", children: [
6490
+ /* @__PURE__ */ jsx(Link, { href: `/espace/${appSlug}/tickets?ticket=${encodeURIComponent(runResult.ticketId ?? test.ticketId)}`, children: "Ouvrir la fiche du ticket" }),
6491
+ runResult.ticketUrl !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
6492
+ " \xB7 ",
6493
+ /* @__PURE__ */ jsx(Link, { href: runResult.ticketUrl, target: "_blank", rel: "noopener noreferrer", children: "Ouvrir dans Gorgias" })
6494
+ ] })
6495
+ ] })
6307
6496
  ] })
6308
6497
  ] }),
6309
6498
  test?.mode === "diagnostic" && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [