@apotech-os/support-kit 8.2.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,4 +1,4 @@
1
- import { EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, 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-LXHPPWPM.js';
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
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';
@@ -1442,7 +1442,7 @@ function dedupe(names) {
1442
1442
  }
1443
1443
  function triageTagNames(input) {
1444
1444
  const { decision, category, policy } = input;
1445
- return [decision.tag, ...category?.extraTags ?? [], policy?.audit.handledTag];
1445
+ return [decision.tag, ...category?.extraTags ?? [], policy?.audit.handledTag, policy?.audit.appScopeTag];
1446
1446
  }
1447
1447
  function wasSimulated(job, policy) {
1448
1448
  if (!job) return false;
@@ -1758,6 +1758,10 @@ var ORIGIN_FILTER_OPTIONS = [
1758
1758
  { value: "followup", label: "Messages suivants" },
1759
1759
  { value: "test", label: "Brouillons d'essai" }
1760
1760
  ];
1761
+ var VIEW_MODE_OPTIONS = [
1762
+ { value: "byTicket", label: "Une ligne par ticket" },
1763
+ { value: "all", label: "Toutes les g\xE9n\xE9rations" }
1764
+ ];
1761
1765
  function OutcomeBadge({ outcome }) {
1762
1766
  return /* @__PURE__ */ jsx(Badge, { variant: OUTCOME_BADGE_VARIANT[outcome.variant], children: outcome.label });
1763
1767
  }
@@ -1777,6 +1781,7 @@ function TicketsPage() {
1777
1781
  const [promptVersionFilter, setPromptVersionFilter] = useState("");
1778
1782
  const [correctedFilter, setCorrectedFilter] = useState("");
1779
1783
  const [originFilter, setOriginFilter] = useState("");
1784
+ const [viewMode, setViewMode] = useState("byTicket");
1780
1785
  const [detailDecision, setDetailDecision] = useState(null);
1781
1786
  const [isTriaging, setIsTriaging] = useState(false);
1782
1787
  const [isInvalidating, setIsInvalidating] = useState(false);
@@ -1908,6 +1913,16 @@ function TicketsPage() {
1908
1913
  return true;
1909
1914
  });
1910
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]);
1911
1926
  const deepLinkConsumed = useRef(false);
1912
1927
  useEffect(() => {
1913
1928
  if (deepLinkConsumed.current || !requestedTicket) return;
@@ -1955,6 +1970,16 @@ function TicketsPage() {
1955
1970
  }
1956
1971
  const columns = [
1957
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
+ },
1958
1983
  {
1959
1984
  key: "origin",
1960
1985
  header: "Origine",
@@ -2060,10 +2085,20 @@ function TicketsPage() {
2060
2085
  /* @__PURE__ */ jsx(Select, { items: promptVersionOptions, value: promptVersionFilter, onValueChange: setPromptVersionFilter, placeholder: "Toutes versions de prompt", "aria-label": "Filtrer par version de prompt" }),
2061
2086
  /* @__PURE__ */ jsx(Select, { items: CORRECTED_OPTIONS, value: correctedFilter, onValueChange: setCorrectedFilter, placeholder: "Corrig\xE9s ou non", "aria-label": "Filtrer par correction humaine" }),
2062
2087
  /* @__PURE__ */ jsx(Select, { items: ORIGIN_FILTER_OPTIONS, value: originFilter, onValueChange: setOriginFilter, placeholder: "Toutes origines", "aria-label": "Filtrer par origine" }),
2063
- rows.length > 0 && /* @__PURE__ */ jsxs("span", { className: "ml-auto text-sm text-muted-foreground", children: [
2064
- rows.length,
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,
2065
2100
  " ticket",
2066
- rows.length > 1 ? "s" : "",
2101
+ listRows.length > 1 ? "s" : "",
2067
2102
  " sur cette page"
2068
2103
  ] })
2069
2104
  ] }),
@@ -2071,7 +2106,7 @@ function TicketsPage() {
2071
2106
  DataTable,
2072
2107
  {
2073
2108
  columns,
2074
- rows,
2109
+ rows: listRows,
2075
2110
  rowId: (row) => row.decision.id,
2076
2111
  manual: true,
2077
2112
  defaultState: { search: requestedTicket?.trim() ?? "" },
@@ -4380,6 +4415,7 @@ function SettingsPage() {
4380
4415
  const claimedView = views.find((v) => v.id === sourceViewId);
4381
4416
  const claimUnverifiable = installedAppsUnavailable || uncheckedAppSlugs.length > 0;
4382
4417
  const issues = validateSettings(form);
4418
+ const warnings = settingsWarnings(form);
4383
4419
  const nodesIssue = issues.find((issue) => issue.key === "nodes");
4384
4420
  const summaryIssues = issues.filter((issue) => issue !== nodesIssue);
4385
4421
  const guardrailsActive = Array.isArray(form.guardrailsActive) ? form.guardrailsActive : [];
@@ -4554,11 +4590,14 @@ function SettingsPage() {
4554
4590
  ["escalationTag", "Tag d'escalade"],
4555
4591
  ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
4556
4592
  ["needsReviewTag", "Tag \xE0 revoir avant envoi"],
4557
- ["followupTag", "Tag suivi requis"]
4593
+ ["followupTag", "Tag suivi requis"],
4594
+ ["appScopeTag", "Tag d'appartenance"]
4558
4595
  ].map(([key, label]) => /* @__PURE__ */ jsxs("div", { children: [
4559
4596
  /* @__PURE__ */ jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
4560
4597
  /* @__PURE__ */ jsx(Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
4561
- ] }, 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))
4562
4601
  ] }) }),
4563
4602
  /* @__PURE__ */ jsx(
4564
4603
  FollowupWebhookCard,
@@ -6098,6 +6137,7 @@ function tagOrigin(tag, settings) {
6098
6137
  if (tag === str(settings.followupTag)) return "tag de suivi";
6099
6138
  if (tag === str(settings.escalationTag)) return "tag d'escalade";
6100
6139
  if (tag === str(settings.handledTag)) return "tag de traitement";
6140
+ if (tag === str(settings.appScopeTag)) return "tag d'appartenance";
6101
6141
  if (tag === str(settings.unknownTag)) return "classification de repli";
6102
6142
  return "classification";
6103
6143
  }