@apotech-os/support-kit 2.9.0 → 2.10.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 { GENERATED_RESPONSE_STATUSES, EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, AGENT_GUARDRAILS, toCategory, toTriageDecision, toAgent, toGeneratedResponse, isGeneratedResponseStatus, toCategoryGroup, toResponseComparison, toDiffAnalysis, NODE_NAMES, settingsToProfile, hasNoDraftNode, guardrailBucket, computeWordDiff, DEFAULT_LLM_PROVIDER, isSendableVerdict, DEFAULT_MAX_TOOL_CALLS, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED } from '../chunk-CVYJU4SV.js';
1
+ import { GENERATED_RESPONSE_STATUSES, EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, AGENT_GUARDRAILS, toCategory, toTriageDecision, toAgent, toGeneratedResponse, isGeneratedResponseStatus, toCategoryGroup, toResponseComparison, toDiffAnalysis, NODE_NAMES, settingsToProfile, hasNoDraftNode, guardrailBucket, DEFAULT_LLM_PROVIDER, computeWordDiff, isSendableVerdict, DEFAULT_MAX_TOOL_CALLS, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED } from '../chunk-CVYJU4SV.js';
2
2
  import { useState, useMemo, useRef, useEffect, useCallback, useId } from 'react';
3
3
  import { useAppContext, useAppSettings, Card, CardContent, Button, Link, KpiCard, BarChart, StackedBarChart, DataTable, Select, useAppApi, useToast, Badge, FunnelChart, Spinner, LineChart, Input, Switch, Checkbox, Textarea, cn, SidePanel, CopyButton, Modal, Tooltip, AppInvokeError } from '@apotech-os/ui-sdk';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -1391,6 +1391,226 @@ function PipelinePage() {
1391
1391
  )
1392
1392
  ] });
1393
1393
  }
1394
+
1395
+ // src/ui/settings/pipeline-nodes.ts
1396
+ var PIPELINE_STEP_KEYS = ["triage", "escalate", "draft", "evaluate", "revise"];
1397
+ var PIPELINE_STEPS = [
1398
+ {
1399
+ key: "triage",
1400
+ label: "Triage",
1401
+ description: "comprend et classe chaque demande entrante",
1402
+ requires: null,
1403
+ blockedReason: null
1404
+ },
1405
+ {
1406
+ key: "escalate",
1407
+ label: "Escalade",
1408
+ description: "passe la main \xE0 un humain",
1409
+ requires: null,
1410
+ blockedReason: null
1411
+ },
1412
+ {
1413
+ key: "draft",
1414
+ label: "R\xE9daction",
1415
+ description: "pr\xE9pare un projet de r\xE9ponse",
1416
+ requires: null,
1417
+ blockedReason: null
1418
+ },
1419
+ {
1420
+ key: "evaluate",
1421
+ label: "\xC9valuation",
1422
+ description: "relit la r\xE9ponse avant envoi",
1423
+ requires: "draft",
1424
+ blockedReason: "Il n'y a rien \xE0 \xE9valuer sans r\xE9daction."
1425
+ },
1426
+ {
1427
+ key: "revise",
1428
+ label: "R\xE9vision",
1429
+ description: "r\xE9\xE9crit la r\xE9ponse si l'\xE9valuation la juge insuffisante",
1430
+ requires: "evaluate",
1431
+ blockedReason: "Sans \xE9valuation, rien ne d\xE9clenche une r\xE9vision."
1432
+ }
1433
+ ];
1434
+ var TRIAGE_LOCK_REASON = "Sans triage l'app ne traite rien.";
1435
+ var STEP_BY_KEY = new Map(PIPELINE_STEPS.map((step) => [step.key, step]));
1436
+ function pipelineStep(key) {
1437
+ const step = STEP_BY_KEY.get(key);
1438
+ if (!step) throw new Error(`unknown pipeline step: ${key}`);
1439
+ return step;
1440
+ }
1441
+ function readNodes(value) {
1442
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
1443
+ return value;
1444
+ }
1445
+ function readStep(value, key) {
1446
+ const step = readNodes(value)[key];
1447
+ if (typeof step !== "object" || step === null || Array.isArray(step)) return null;
1448
+ return step;
1449
+ }
1450
+ function isStepEnabled(value, key) {
1451
+ return readStep(value, key) !== null;
1452
+ }
1453
+ function stepBlockedReason(value, key) {
1454
+ const { requires, blockedReason } = pipelineStep(key);
1455
+ if (!requires) return null;
1456
+ return isStepActive(value, requires) ? null : blockedReason;
1457
+ }
1458
+ function isStepActive(value, key) {
1459
+ return isStepEnabled(value, key) && stepBlockedReason(value, key) === null;
1460
+ }
1461
+ function withStep(value, key, step) {
1462
+ return { ...readNodes(value), [key]: step };
1463
+ }
1464
+ function withStepFields(value, key, patch) {
1465
+ const step = readStep(value, key);
1466
+ if (!step) return readNodes(value);
1467
+ const next = { ...step };
1468
+ for (const [field2, fieldValue] of Object.entries(patch)) {
1469
+ if (fieldValue === void 0) delete next[field2];
1470
+ else next[field2] = fieldValue;
1471
+ }
1472
+ return withStep(value, key, next);
1473
+ }
1474
+ function stepString(step, field2) {
1475
+ const value = step?.[field2];
1476
+ return typeof value === "string" ? value : "";
1477
+ }
1478
+ function stepNumber(step, field2, fallback) {
1479
+ const value = step?.[field2];
1480
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
1481
+ }
1482
+ function stepBoolean(step, field2, fallback) {
1483
+ const value = step?.[field2];
1484
+ return typeof value === "boolean" ? value : fallback;
1485
+ }
1486
+ function stepUsesAgentPrompt(key) {
1487
+ return key === "draft";
1488
+ }
1489
+ var DEFAULT_PROMPT_LABEL = "production";
1490
+ function stepPromptName(step) {
1491
+ return readPromptField(step, "name");
1492
+ }
1493
+ function stepPromptLabel(step) {
1494
+ return readPromptField(step, "label") || DEFAULT_PROMPT_LABEL;
1495
+ }
1496
+ function readPromptField(step, field2) {
1497
+ const prompt = step?.prompt;
1498
+ if (typeof prompt !== "object" || prompt === null) return "";
1499
+ const value = prompt[field2];
1500
+ return typeof value === "string" ? value : "";
1501
+ }
1502
+ function promptPatch(name, label) {
1503
+ return { prompt: { name, label } };
1504
+ }
1505
+ function stepReasoning(step) {
1506
+ const value = step?.reasoning;
1507
+ return REASONING_EFFORTS.some((effort) => effort.value === value) ? value : "off";
1508
+ }
1509
+ var REASONING_EFFORTS = [
1510
+ { value: "off", label: "Aucun" },
1511
+ { value: "low", label: "L\xE9ger" },
1512
+ { value: "medium", label: "Moyen" },
1513
+ { value: "high", label: "Pouss\xE9" }
1514
+ ];
1515
+ var KNOWN_MODELS = [
1516
+ {
1517
+ provider: "openai",
1518
+ model: "gpt-4o-mini",
1519
+ label: "GPT-4o mini",
1520
+ hint: "Le moins cher, tr\xE8s rapide \u2014 suffisant pour classer"
1521
+ },
1522
+ {
1523
+ provider: "openai",
1524
+ model: "gpt-5-mini",
1525
+ label: "GPT-5 mini",
1526
+ hint: "Rapide, bon march\xE9, meilleur raisonnement"
1527
+ },
1528
+ {
1529
+ provider: "openai",
1530
+ model: "gpt-4.1",
1531
+ label: "GPT-4.1",
1532
+ hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
1533
+ },
1534
+ {
1535
+ provider: "openai",
1536
+ model: "gpt-5",
1537
+ label: "GPT-5",
1538
+ hint: "Le plus capable \u2014 le plus lent et le plus cher"
1539
+ },
1540
+ {
1541
+ provider: "anthropic",
1542
+ model: "claude-3-5-haiku-latest",
1543
+ label: "Claude 3.5 Haiku",
1544
+ hint: "Rapide et bon march\xE9"
1545
+ },
1546
+ {
1547
+ provider: "anthropic",
1548
+ model: "claude-3-5-sonnet-latest",
1549
+ label: "Claude 3.5 Sonnet",
1550
+ hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
1551
+ }
1552
+ ];
1553
+ var CUSTOM_MODEL_VALUE = "__custom__";
1554
+ function findModelOption(model) {
1555
+ return KNOWN_MODELS.find((option) => option.model === model);
1556
+ }
1557
+ function defaultStep() {
1558
+ const [first] = KNOWN_MODELS;
1559
+ return { model: first.model, provider: first.provider, reasoning: "off" };
1560
+ }
1561
+ var PIPELINE_PRESETS = [
1562
+ {
1563
+ id: "triage-only",
1564
+ label: "D\xE9marrage prudent \u2014 triage seul",
1565
+ description: "Les demandes sont comprises et class\xE9es. Aucune r\xE9ponse n\u2019est pr\xE9par\xE9e.",
1566
+ enabled: ["triage"]
1567
+ },
1568
+ {
1569
+ id: "assisted",
1570
+ label: "R\xE9ponse assist\xE9e",
1571
+ description: "Triage, escalade et r\xE9daction : un projet de r\xE9ponse est pr\xE9par\xE9 pour un humain. L\u2019envoi automatique reste d\xE9sactiv\xE9.",
1572
+ enabled: ["triage", "escalate", "draft"]
1573
+ }
1574
+ ];
1575
+ function applyPreset(value, preset, restore) {
1576
+ let next = readNodes(value);
1577
+ for (const key of PIPELINE_STEP_KEYS) {
1578
+ const on = preset.enabled.includes(key);
1579
+ next = withStep(next, key, on ? readStep(next, key) ?? restore(key) : null);
1580
+ }
1581
+ return next;
1582
+ }
1583
+ function usePromptCatalogue() {
1584
+ const { appSlug } = useAppContext();
1585
+ const api = useAppApi();
1586
+ const [prompts, setPrompts] = useState([]);
1587
+ const [isLoading, setIsLoading] = useState(true);
1588
+ const [error, setError] = useState(void 0);
1589
+ const clientRef = useRef(api);
1590
+ clientRef.current = api;
1591
+ const requestIdRef = useRef(0);
1592
+ const isMountedRef = useRef(true);
1593
+ useEffect(() => {
1594
+ isMountedRef.current = true;
1595
+ const requestId = ++requestIdRef.current;
1596
+ setIsLoading(true);
1597
+ void clientRef.current.get(`/data/apps/${appSlug}/prompts`).then((catalogue) => {
1598
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
1599
+ setPrompts(catalogue);
1600
+ setError(void 0);
1601
+ }).catch((err) => {
1602
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
1603
+ setError(err);
1604
+ }).finally(() => {
1605
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
1606
+ setIsLoading(false);
1607
+ });
1608
+ return () => {
1609
+ isMountedRef.current = false;
1610
+ };
1611
+ }, [appSlug]);
1612
+ return { prompts, isLoading, error };
1613
+ }
1394
1614
  function ConfirmModal({
1395
1615
  title,
1396
1616
  description,
@@ -1560,18 +1780,34 @@ var STATUS_VARIANT = {
1560
1780
  archived: "outline"
1561
1781
  };
1562
1782
  function emptyForm() {
1563
- return { name: "", modelId: "", provider: "openai", systemPromptSnapshot: "" };
1783
+ return {
1784
+ name: "",
1785
+ modelId: "",
1786
+ provider: DEFAULT_LLM_PROVIDER,
1787
+ status: "available",
1788
+ promptName: "",
1789
+ promptLabel: "",
1790
+ systemPromptSnapshot: ""
1791
+ };
1564
1792
  }
1565
1793
  function formFromAgent(agent) {
1566
1794
  return {
1567
1795
  name: agent.name,
1568
1796
  modelId: agent.modelId,
1569
1797
  provider: agent.provider,
1798
+ status: agent.status,
1799
+ promptName: agent.promptName,
1800
+ promptLabel: agent.promptLabel ?? "",
1570
1801
  systemPromptSnapshot: agent.systemPromptSnapshot ?? ""
1571
1802
  };
1572
1803
  }
1804
+ var DERIVED_PROMPT_VALUE = "__derived__";
1805
+ var CUSTOM_PROMPT_VALUE = "__custom-prompt__";
1806
+ var DEFAULT_LABEL_VALUE = "__production__";
1573
1807
  function AgentFormModal({
1574
1808
  agent,
1809
+ prompts,
1810
+ promptsLoading,
1575
1811
  onClose,
1576
1812
  onSave
1577
1813
  }) {
@@ -1579,10 +1815,19 @@ function AgentFormModal({
1579
1815
  agent === "new" ? emptyForm() : formFromAgent(agent)
1580
1816
  );
1581
1817
  const [isSaving, setIsSaving] = useState(false);
1818
+ const [freeTextModel, setFreeTextModel] = useState(false);
1819
+ const [freeTextPrompt, setFreeTextPrompt] = useState(false);
1582
1820
  const nameId = useId();
1583
- const modelId = useId();
1821
+ const modelInputId = useId();
1822
+ const providerInputId = useId();
1823
+ const promptInputId = useId();
1584
1824
  const snapshotId = useId();
1585
- const isValid = form.name.trim() !== "" && form.modelId.trim() !== "";
1825
+ const knownModel = findModelOption(form.modelId);
1826
+ const showModelFreeText = freeTextModel || form.modelId !== "" && !knownModel;
1827
+ const knownPrompt = prompts.find((entry) => entry.name === form.promptName);
1828
+ const showPromptFreeText = freeTextPrompt || agent !== "new" && form.promptName !== "" && !knownPrompt && !promptsLoading;
1829
+ const promptLabels = knownPrompt?.labels ?? [];
1830
+ const isValid = form.name.trim() !== "" && form.modelId.trim() !== "" && (agent === "new" || form.promptName.trim() !== "");
1586
1831
  async function submit(event) {
1587
1832
  event.preventDefault();
1588
1833
  if (isSaving || !isValid) return;
@@ -1593,6 +1838,14 @@ function AgentFormModal({
1593
1838
  setIsSaving(false);
1594
1839
  }
1595
1840
  }
1841
+ function pickPrompt(next) {
1842
+ if (next === CUSTOM_PROMPT_VALUE) {
1843
+ setFreeTextPrompt(true);
1844
+ return;
1845
+ }
1846
+ setFreeTextPrompt(false);
1847
+ setForm({ ...form, promptName: next === DERIVED_PROMPT_VALUE ? "" : next, promptLabel: "" });
1848
+ }
1596
1849
  return /* @__PURE__ */ jsx(
1597
1850
  Modal,
1598
1851
  {
@@ -1604,24 +1857,113 @@ function AgentFormModal({
1604
1857
  /* @__PURE__ */ jsx("label", { htmlFor: nameId, className: "mb-1 block text-sm font-medium", children: "Nom" }),
1605
1858
  /* @__PURE__ */ jsx(Input, { id: nameId, value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }) })
1606
1859
  ] }),
1607
- /* @__PURE__ */ jsxs("div", { children: [
1608
- /* @__PURE__ */ jsx("label", { htmlFor: modelId, className: "mb-1 block text-sm font-medium", children: "Mod\xE8le" }),
1860
+ agent !== "new" && agent.status !== "default" && /* @__PURE__ */ jsxs("div", { children: [
1861
+ /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Statut" }),
1609
1862
  /* @__PURE__ */ jsx(
1610
- Input,
1863
+ Select,
1611
1864
  {
1612
- id: modelId,
1613
- value: form.modelId,
1614
- onChange: (e) => setForm({ ...form, modelId: e.target.value })
1865
+ "aria-label": "Statut",
1866
+ value: form.status,
1867
+ onValueChange: (next) => setForm({ ...form, status: next }),
1868
+ items: [
1869
+ { value: "available", label: STATUS_LABELS.available },
1870
+ { value: "archived", label: STATUS_LABELS.archived }
1871
+ ]
1615
1872
  }
1616
1873
  )
1617
1874
  ] }),
1618
1875
  /* @__PURE__ */ jsxs("div", { children: [
1619
- /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Fournisseur" }),
1620
- /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
1621
- form.provider,
1622
- " \u2014 non modifiable ici ; le fournisseur r\xE9ellement appel\xE9 est celui des Param\xE8tres."
1876
+ /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Mod\xE8le" }),
1877
+ /* @__PURE__ */ jsx(
1878
+ Select,
1879
+ {
1880
+ "aria-label": "Mod\xE8le",
1881
+ value: showModelFreeText ? CUSTOM_MODEL_VALUE : knownModel?.model ?? void 0,
1882
+ onValueChange: (next) => {
1883
+ if (next === CUSTOM_MODEL_VALUE) {
1884
+ setFreeTextModel(true);
1885
+ return;
1886
+ }
1887
+ setFreeTextModel(false);
1888
+ const option = findModelOption(next);
1889
+ if (!option) return;
1890
+ setForm({ ...form, modelId: option.model, provider: option.provider });
1891
+ },
1892
+ items: [
1893
+ ...KNOWN_MODELS.map((option) => ({
1894
+ value: option.model,
1895
+ label: `${option.label} \u2014 ${option.hint}`
1896
+ })),
1897
+ { value: CUSTOM_MODEL_VALUE, label: "Autre \u2014 saisir un identifiant de mod\xE8le" }
1898
+ ]
1899
+ }
1900
+ ),
1901
+ showModelFreeText && /* @__PURE__ */ jsxs("div", { className: "mt-2 space-y-2", children: [
1902
+ /* @__PURE__ */ jsx("label", { htmlFor: modelInputId, className: "mb-1 block text-sm font-medium", children: "Identifiant de mod\xE8le" }),
1903
+ /* @__PURE__ */ jsx(
1904
+ Input,
1905
+ {
1906
+ id: modelInputId,
1907
+ value: form.modelId,
1908
+ onChange: (e) => setForm({ ...form, modelId: e.target.value })
1909
+ }
1910
+ ),
1911
+ /* @__PURE__ */ jsx("label", { htmlFor: providerInputId, className: "mb-1 block text-sm font-medium", children: "Fournisseur" }),
1912
+ /* @__PURE__ */ jsx(
1913
+ Input,
1914
+ {
1915
+ id: providerInputId,
1916
+ value: form.provider,
1917
+ onChange: (e) => setForm({ ...form, provider: e.target.value })
1918
+ }
1919
+ )
1623
1920
  ] })
1624
1921
  ] }),
1922
+ /* @__PURE__ */ jsxs("div", { children: [
1923
+ /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Prompt Langfuse" }),
1924
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
1925
+ /* @__PURE__ */ jsx(
1926
+ Select,
1927
+ {
1928
+ "aria-label": "Prompt Langfuse",
1929
+ value: showPromptFreeText ? CUSTOM_PROMPT_VALUE : knownPrompt ? form.promptName : agent === "new" ? DERIVED_PROMPT_VALUE : void 0,
1930
+ onValueChange: pickPrompt,
1931
+ items: [
1932
+ ...agent === "new" ? [{ value: DERIVED_PROMPT_VALUE, label: "Nouveau prompt \u2014 agent/<g\xE9n\xE9r\xE9 automatiquement>" }] : [],
1933
+ ...prompts.map((entry) => ({ value: entry.name, label: entry.name })),
1934
+ { value: CUSTOM_PROMPT_VALUE, label: "Autre \u2014 saisir un nom de prompt" }
1935
+ ],
1936
+ disabled: promptsLoading
1937
+ }
1938
+ ),
1939
+ /* @__PURE__ */ jsx(
1940
+ Select,
1941
+ {
1942
+ "aria-label": "Tag du prompt",
1943
+ value: form.promptLabel === "" ? DEFAULT_LABEL_VALUE : form.promptLabel,
1944
+ onValueChange: (next) => setForm({ ...form, promptLabel: next === DEFAULT_LABEL_VALUE ? "" : next }),
1945
+ items: [
1946
+ { value: DEFAULT_LABEL_VALUE, label: "production (par d\xE9faut)" },
1947
+ ...promptLabels.filter((label) => label !== DEFAULT_PROMPT_LABEL).map((label) => ({ value: label, label })),
1948
+ ...form.promptLabel !== "" && !promptLabels.includes(form.promptLabel) ? [{ value: form.promptLabel, label: form.promptLabel }] : []
1949
+ ],
1950
+ disabled: promptsLoading || form.promptName === "" && !showPromptFreeText
1951
+ }
1952
+ )
1953
+ ] }),
1954
+ showPromptFreeText && /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
1955
+ /* @__PURE__ */ jsx("label", { htmlFor: promptInputId, className: "mb-1 block text-sm font-medium", children: "Nom du prompt Langfuse" }),
1956
+ /* @__PURE__ */ jsx(
1957
+ Input,
1958
+ {
1959
+ id: promptInputId,
1960
+ value: form.promptName,
1961
+ onChange: (e) => setForm({ ...form, promptName: e.target.value })
1962
+ }
1963
+ )
1964
+ ] }),
1965
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Laisser sur \xAB Nouveau prompt \xBB pour en cr\xE9er un ; choisir un prompt existant pour y rattacher l'agent. Le nom est \xE9crit tel quel, sans normalisation." })
1966
+ ] }),
1625
1967
  /* @__PURE__ */ jsxs("div", { children: [
1626
1968
  /* @__PURE__ */ jsx("label", { htmlFor: snapshotId, className: "mb-1 block text-sm font-medium", children: "Prompt de secours (niveau 3)" }),
1627
1969
  /* @__PURE__ */ jsx(
@@ -1821,6 +2163,8 @@ function AgentsPage() {
1821
2163
  const [formAgent, setFormAgent] = useState(null);
1822
2164
  const [versionsAgent, setVersionsAgent] = useState(null);
1823
2165
  const [deletingAgent, setDeletingAgent] = useState(null);
2166
+ const { prompts, isLoading: promptsLoading, error: promptsError } = usePromptCatalogue();
2167
+ const promptExists = (name) => promptsLoading || promptsError !== void 0 || prompts.some((entry) => entry.name === name);
1824
2168
  const recordPath = (id) => `/data/apps/${appSlug}/records/agent/${id}`;
1825
2169
  async function patchStatus(agent, status) {
1826
2170
  try {
@@ -1856,12 +2200,30 @@ function AgentsPage() {
1856
2200
  if (formAgent === "new") {
1857
2201
  await api.invoke(
1858
2202
  "create-agent",
1859
- { name: form.name, modelId: form.modelId, provider: form.provider, systemPromptSnapshot: form.systemPromptSnapshot },
2203
+ {
2204
+ name: form.name,
2205
+ modelId: form.modelId,
2206
+ provider: form.provider,
2207
+ systemPromptSnapshot: form.systemPromptSnapshot,
2208
+ // Verbatim (trim only) — empty means "derive agent/<id>", and an
2209
+ // empty label means "follow production" (stored null, never the
2210
+ // literal string).
2211
+ promptName: form.promptName.trim(),
2212
+ promptLabel: form.promptLabel.trim()
2213
+ },
1860
2214
  { idempotencyKey: crypto.randomUUID() }
1861
2215
  );
1862
2216
  } else if (formAgent) {
1863
2217
  await api.patch(recordPath(formAgent.id), {
1864
- data: { name: form.name, modelId: form.modelId, systemPromptSnapshot: form.systemPromptSnapshot }
2218
+ data: {
2219
+ name: form.name,
2220
+ modelId: form.modelId,
2221
+ provider: form.provider,
2222
+ systemPromptSnapshot: form.systemPromptSnapshot,
2223
+ promptName: form.promptName.trim(),
2224
+ promptLabel: form.promptLabel.trim() || null,
2225
+ ...formAgent.status !== "default" ? { status: form.status } : {}
2226
+ }
1865
2227
  });
1866
2228
  }
1867
2229
  setFormAgent(null);
@@ -1882,7 +2244,14 @@ function AgentsPage() {
1882
2244
  header: "Statut",
1883
2245
  cell: (row) => /* @__PURE__ */ jsx(Badge, { variant: STATUS_VARIANT[row.status] ?? "neutral", children: STATUS_LABELS[row.status] ?? row.status })
1884
2246
  },
1885
- { key: "promptName", header: "Prompt", cell: (row) => row.promptName },
2247
+ {
2248
+ key: "promptName",
2249
+ header: "Prompt",
2250
+ cell: (row) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
2251
+ row.promptName,
2252
+ !promptExists(row.promptName) && /* @__PURE__ */ jsx(Badge, { variant: "warning", children: "prompt introuvable chez Langfuse" })
2253
+ ] })
2254
+ },
1886
2255
  {
1887
2256
  key: "actions",
1888
2257
  header: "",
@@ -1928,7 +2297,16 @@ function AgentsPage() {
1928
2297
  empty: "Aucun agent configur\xE9."
1929
2298
  }
1930
2299
  ),
1931
- formAgent && /* @__PURE__ */ jsx(AgentFormModal, { agent: formAgent, onClose: () => setFormAgent(null), onSave: save }),
2300
+ formAgent && /* @__PURE__ */ jsx(
2301
+ AgentFormModal,
2302
+ {
2303
+ agent: formAgent,
2304
+ prompts,
2305
+ promptsLoading,
2306
+ onClose: () => setFormAgent(null),
2307
+ onSave: save
2308
+ }
2309
+ ),
1932
2310
  versionsAgent && /* @__PURE__ */ jsx(PromptVersionsPanel, { agent: versionsAgent, canWrite, onClose: () => setVersionsAgent(null) }),
1933
2311
  deletingAgent && /* @__PURE__ */ jsx(
1934
2312
  ConfirmModal,
@@ -2972,199 +3350,10 @@ function NumberField({ id, label, value, onChange, disabled, min, max, integer,
2972
3350
  const bounded = Math.min(max ?? Infinity, Math.max(min ?? -Infinity, rounded));
2973
3351
  onChange(bounded);
2974
3352
  }
2975
- }
2976
- ),
2977
- hint && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: hint })
2978
- ] });
2979
- }
2980
-
2981
- // src/ui/settings/pipeline-nodes.ts
2982
- var PIPELINE_STEP_KEYS = ["triage", "escalate", "draft", "evaluate", "revise"];
2983
- var PIPELINE_STEPS = [
2984
- {
2985
- key: "triage",
2986
- label: "Triage",
2987
- description: "comprend et classe chaque demande entrante",
2988
- requires: null,
2989
- blockedReason: null
2990
- },
2991
- {
2992
- key: "escalate",
2993
- label: "Escalade",
2994
- description: "passe la main \xE0 un humain",
2995
- requires: null,
2996
- blockedReason: null
2997
- },
2998
- {
2999
- key: "draft",
3000
- label: "R\xE9daction",
3001
- description: "pr\xE9pare un projet de r\xE9ponse",
3002
- requires: null,
3003
- blockedReason: null
3004
- },
3005
- {
3006
- key: "evaluate",
3007
- label: "\xC9valuation",
3008
- description: "relit la r\xE9ponse avant envoi",
3009
- requires: "draft",
3010
- blockedReason: "Il n'y a rien \xE0 \xE9valuer sans r\xE9daction."
3011
- },
3012
- {
3013
- key: "revise",
3014
- label: "R\xE9vision",
3015
- description: "r\xE9\xE9crit la r\xE9ponse si l'\xE9valuation la juge insuffisante",
3016
- requires: "evaluate",
3017
- blockedReason: "Sans \xE9valuation, rien ne d\xE9clenche une r\xE9vision."
3018
- }
3019
- ];
3020
- var TRIAGE_LOCK_REASON = "Sans triage l'app ne traite rien.";
3021
- var STEP_BY_KEY = new Map(PIPELINE_STEPS.map((step) => [step.key, step]));
3022
- function pipelineStep(key) {
3023
- const step = STEP_BY_KEY.get(key);
3024
- if (!step) throw new Error(`unknown pipeline step: ${key}`);
3025
- return step;
3026
- }
3027
- function readNodes(value) {
3028
- if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
3029
- return value;
3030
- }
3031
- function readStep(value, key) {
3032
- const step = readNodes(value)[key];
3033
- if (typeof step !== "object" || step === null || Array.isArray(step)) return null;
3034
- return step;
3035
- }
3036
- function isStepEnabled(value, key) {
3037
- return readStep(value, key) !== null;
3038
- }
3039
- function stepBlockedReason(value, key) {
3040
- const { requires, blockedReason } = pipelineStep(key);
3041
- if (!requires) return null;
3042
- return isStepActive(value, requires) ? null : blockedReason;
3043
- }
3044
- function isStepActive(value, key) {
3045
- return isStepEnabled(value, key) && stepBlockedReason(value, key) === null;
3046
- }
3047
- function withStep(value, key, step) {
3048
- return { ...readNodes(value), [key]: step };
3049
- }
3050
- function withStepFields(value, key, patch) {
3051
- const step = readStep(value, key);
3052
- if (!step) return readNodes(value);
3053
- const next = { ...step };
3054
- for (const [field2, fieldValue] of Object.entries(patch)) {
3055
- if (fieldValue === void 0) delete next[field2];
3056
- else next[field2] = fieldValue;
3057
- }
3058
- return withStep(value, key, next);
3059
- }
3060
- function stepString(step, field2) {
3061
- const value = step?.[field2];
3062
- return typeof value === "string" ? value : "";
3063
- }
3064
- function stepNumber(step, field2, fallback) {
3065
- const value = step?.[field2];
3066
- return typeof value === "number" && Number.isFinite(value) ? value : fallback;
3067
- }
3068
- function stepBoolean(step, field2, fallback) {
3069
- const value = step?.[field2];
3070
- return typeof value === "boolean" ? value : fallback;
3071
- }
3072
- function stepUsesAgentPrompt(key) {
3073
- return key === "draft";
3074
- }
3075
- var DEFAULT_PROMPT_LABEL = "production";
3076
- function stepPromptName(step) {
3077
- return readPromptField(step, "name");
3078
- }
3079
- function stepPromptLabel(step) {
3080
- return readPromptField(step, "label") || DEFAULT_PROMPT_LABEL;
3081
- }
3082
- function readPromptField(step, field2) {
3083
- const prompt = step?.prompt;
3084
- if (typeof prompt !== "object" || prompt === null) return "";
3085
- const value = prompt[field2];
3086
- return typeof value === "string" ? value : "";
3087
- }
3088
- function promptPatch(name, label) {
3089
- return { prompt: { name, label } };
3090
- }
3091
- function stepReasoning(step) {
3092
- const value = step?.reasoning;
3093
- return REASONING_EFFORTS.some((effort) => effort.value === value) ? value : "off";
3094
- }
3095
- var REASONING_EFFORTS = [
3096
- { value: "off", label: "Aucun" },
3097
- { value: "low", label: "L\xE9ger" },
3098
- { value: "medium", label: "Moyen" },
3099
- { value: "high", label: "Pouss\xE9" }
3100
- ];
3101
- var KNOWN_MODELS = [
3102
- {
3103
- provider: "openai",
3104
- model: "gpt-4o-mini",
3105
- label: "GPT-4o mini",
3106
- hint: "Le moins cher, tr\xE8s rapide \u2014 suffisant pour classer"
3107
- },
3108
- {
3109
- provider: "openai",
3110
- model: "gpt-5-mini",
3111
- label: "GPT-5 mini",
3112
- hint: "Rapide, bon march\xE9, meilleur raisonnement"
3113
- },
3114
- {
3115
- provider: "openai",
3116
- model: "gpt-4.1",
3117
- label: "GPT-4.1",
3118
- hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
3119
- },
3120
- {
3121
- provider: "openai",
3122
- model: "gpt-5",
3123
- label: "GPT-5",
3124
- hint: "Le plus capable \u2014 le plus lent et le plus cher"
3125
- },
3126
- {
3127
- provider: "anthropic",
3128
- model: "claude-3-5-haiku-latest",
3129
- label: "Claude 3.5 Haiku",
3130
- hint: "Rapide et bon march\xE9"
3131
- },
3132
- {
3133
- provider: "anthropic",
3134
- model: "claude-3-5-sonnet-latest",
3135
- label: "Claude 3.5 Sonnet",
3136
- hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
3137
- }
3138
- ];
3139
- var CUSTOM_MODEL_VALUE = "__custom__";
3140
- function findModelOption(model) {
3141
- return KNOWN_MODELS.find((option) => option.model === model);
3142
- }
3143
- function defaultStep() {
3144
- const [first] = KNOWN_MODELS;
3145
- return { model: first.model, provider: first.provider, reasoning: "off" };
3146
- }
3147
- var PIPELINE_PRESETS = [
3148
- {
3149
- id: "triage-only",
3150
- label: "D\xE9marrage prudent \u2014 triage seul",
3151
- description: "Les demandes sont comprises et class\xE9es. Aucune r\xE9ponse n\u2019est pr\xE9par\xE9e.",
3152
- enabled: ["triage"]
3153
- },
3154
- {
3155
- id: "assisted",
3156
- label: "R\xE9ponse assist\xE9e",
3157
- description: "Triage, escalade et r\xE9daction : un projet de r\xE9ponse est pr\xE9par\xE9 pour un humain. L\u2019envoi automatique reste d\xE9sactiv\xE9.",
3158
- enabled: ["triage", "escalate", "draft"]
3159
- }
3160
- ];
3161
- function applyPreset(value, preset, restore) {
3162
- let next = readNodes(value);
3163
- for (const key of PIPELINE_STEP_KEYS) {
3164
- const on = preset.enabled.includes(key);
3165
- next = withStep(next, key, on ? readStep(next, key) ?? restore(key) : null);
3166
- }
3167
- return next;
3353
+ }
3354
+ ),
3355
+ hint && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: hint })
3356
+ ] });
3168
3357
  }
3169
3358
  var PERCENT = 100;
3170
3359
  function PipelineNodesForm({
@@ -3225,11 +3414,7 @@ function PipelineNodesForm({
3225
3414
  onPatch: (patch) => onChange(withStepFields(value, step.key, patch))
3226
3415
  },
3227
3416
  step.key
3228
- )) }),
3229
- /* @__PURE__ */ jsxs("details", { children: [
3230
- /* @__PURE__ */ jsx("summary", { className: "cursor-pointer text-sm font-medium", children: "Mode avanc\xE9 (JSON)" }),
3231
- /* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(NodesJsonField, { value, onChange, disabled: !canWrite }) })
3232
- ] })
3417
+ )) })
3233
3418
  ] });
3234
3419
  }
3235
3420
  function StepRow({
@@ -3489,100 +3674,6 @@ function useIds(stepKey) {
3489
3674
  minConfidence: `${base2}-${stepKey}-min-confidence`
3490
3675
  };
3491
3676
  }
3492
- function NodesJsonField({
3493
- value,
3494
- onChange,
3495
- disabled
3496
- }) {
3497
- const id = useId();
3498
- const serialized = stringify(value);
3499
- const [text, setText] = useState(serialized);
3500
- const [parseError, setParseError] = useState(null);
3501
- const emittedRef = useRef(serialized);
3502
- useEffect(() => {
3503
- if (serialized === emittedRef.current) return;
3504
- emittedRef.current = serialized;
3505
- setText(serialized);
3506
- setParseError(null);
3507
- }, [serialized]);
3508
- function handleChange(next) {
3509
- setText(next);
3510
- try {
3511
- const parsed = JSON.parse(next);
3512
- emittedRef.current = stringify(parsed);
3513
- onChange(parsed);
3514
- setParseError(null);
3515
- } catch {
3516
- setParseError("JSON invalide \u2014 la derni\xE8re valeur valide est conserv\xE9e tant que ce texte ne parse pas.");
3517
- }
3518
- }
3519
- return /* @__PURE__ */ jsxs("div", { children: [
3520
- /* @__PURE__ */ jsx("label", { htmlFor: id, className: "mb-1 block text-sm font-medium", children: "\xC9tapes du graphe (JSON)" }),
3521
- /* @__PURE__ */ jsx(
3522
- Textarea,
3523
- {
3524
- id,
3525
- className: "font-mono text-xs",
3526
- rows: 10,
3527
- value: text,
3528
- disabled,
3529
- onChange: (e) => handleChange(e.target.value)
3530
- }
3531
- ),
3532
- parseError && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-destructive", children: parseError }),
3533
- /* @__PURE__ */ jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
3534
- "Chaque cl\xE9 optionnelle (",
3535
- /* @__PURE__ */ jsx("code", { children: "escalate" }),
3536
- ", ",
3537
- /* @__PURE__ */ jsx("code", { children: "draft" }),
3538
- ", ",
3539
- /* @__PURE__ */ jsx("code", { children: "evaluate" }),
3540
- ",",
3541
- " ",
3542
- /* @__PURE__ */ jsx("code", { children: "revise" }),
3543
- ") accepte ",
3544
- /* @__PURE__ */ jsx("code", { children: "null" }),
3545
- " pour d\xE9sactiver l'\xE9tape (\xA73.6).",
3546
- " ",
3547
- /* @__PURE__ */ jsx("code", { children: "triage" }),
3548
- " est obligatoire."
3549
- ] })
3550
- ] });
3551
- }
3552
- function stringify(value) {
3553
- return JSON.stringify(value ?? null, null, 2);
3554
- }
3555
- function usePromptCatalogue() {
3556
- const { appSlug } = useAppContext();
3557
- const api = useAppApi();
3558
- const [prompts, setPrompts] = useState([]);
3559
- const [isLoading, setIsLoading] = useState(true);
3560
- const [error, setError] = useState(void 0);
3561
- const clientRef = useRef(api);
3562
- clientRef.current = api;
3563
- const requestIdRef = useRef(0);
3564
- const isMountedRef = useRef(true);
3565
- useEffect(() => {
3566
- isMountedRef.current = true;
3567
- const requestId = ++requestIdRef.current;
3568
- setIsLoading(true);
3569
- void clientRef.current.get(`/data/apps/${appSlug}/prompts`).then((catalogue) => {
3570
- if (requestId !== requestIdRef.current || !isMountedRef.current) return;
3571
- setPrompts(catalogue);
3572
- setError(void 0);
3573
- }).catch((err) => {
3574
- if (requestId !== requestIdRef.current || !isMountedRef.current) return;
3575
- setError(err);
3576
- }).finally(() => {
3577
- if (requestId !== requestIdRef.current || !isMountedRef.current) return;
3578
- setIsLoading(false);
3579
- });
3580
- return () => {
3581
- isMountedRef.current = false;
3582
- };
3583
- }, [appSlug]);
3584
- return { prompts, isLoading, error };
3585
- }
3586
3677
  var WHATSAPP_MODE_LABELS = {
3587
3678
  escalate_only: "Escalade uniquement",
3588
3679
  draft_only: "Brouillon uniquement",
@@ -3706,325 +3797,333 @@ function SettingsPage() {
3706
3797
  checked ? [.../* @__PURE__ */ new Set([...guardrailsActive, id])] : guardrailsActive.filter((g) => g !== id)
3707
3798
  );
3708
3799
  }
3709
- return /* @__PURE__ */ jsxs(PageShell, { className: "max-w-3xl", children: [
3710
- /* @__PURE__ */ jsx(PageHeader, { title: "Param\xE8tres", description: "Configuration du pipeline de support." }),
3711
- /* @__PURE__ */ jsx(Card, { id: "source", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3712
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Source" }),
3713
- /* @__PURE__ */ jsxs("div", { children: [
3714
- /* @__PURE__ */ jsx("span", { className: "mb-1 block text-sm font-medium", children: "Connexion Gorgias" }),
3715
- /* @__PURE__ */ jsx(
3716
- "p",
3717
- {
3718
- className: connection.tone === "error" ? "text-sm text-destructive" : connection.tone === "muted" ? "text-sm text-muted-foreground" : "text-sm",
3719
- children: connection.text
3720
- }
3721
- ),
3722
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Cette application utilise la connexion Gorgias de l\u2019instance ; elle se r\xE8gle dans les int\xE9grations de la plateforme, pas ici." })
3723
- ] }),
3724
- /* @__PURE__ */ jsxs("div", { children: [
3725
- /* @__PURE__ */ jsx("label", { htmlFor: "sourceViewId", className: "mb-1 block text-sm font-medium", children: "Vue Gorgias source" }),
3726
- views.length > 0 ? /* @__PURE__ */ jsx(
3727
- Select,
3728
- {
3729
- "aria-label": "Vue Gorgias source",
3730
- value: sourceViewId || void 0,
3731
- onValueChange: (v) => set("sourceViewId", v),
3732
- items: views.map((v) => ({ value: v.id, label: v.name })),
3733
- disabled: !canWrite
3734
- }
3735
- ) : /* @__PURE__ */ jsx(
3736
- Input,
3737
- {
3738
- id: "sourceViewId",
3739
- value: sourceViewId,
3740
- onChange: (e) => set("sourceViewId", e.target.value),
3741
- disabled: !canWrite
3742
- }
3743
- )
3744
- ] }),
3745
- claimedView && claimedView.claimedByAppSlugs.length > 0 && /* @__PURE__ */ jsxs("p", { className: "text-sm text-status-pending", children: [
3746
- "Cette vue est d\xE9j\xE0 utilis\xE9e par : ",
3747
- claimedView.claimedByAppSlugs.join(", ")
3748
- ] }),
3749
- claimUnverifiable && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Conflit avec une autre application : inv\xE9rifiable (droits administrateur plateforme requis pour lister les applications install\xE9es). Ce contr\xF4le est informatif \u2014 il ne bloque rien, mais ne peut pas garantir l'absence de conflit." }),
3750
- sourceViewId === "" && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Aucune vue Gorgias configur\xE9e \u2014 le triage ne peut pas d\xE9marrer tant que ce champ n'est pas renseign\xE9." })
3751
- ] }) }),
3752
- sourceViewId === "" ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
3753
- /* @__PURE__ */ jsx(Card, { id: "cadence", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3754
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Cadence" }),
3755
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3756
- /* @__PURE__ */ jsx(
3757
- Switch,
3758
- {
3759
- "aria-label": "Triage activ\xE9",
3760
- checked: bool(form.triageEnabled),
3761
- onCheckedChange: (v) => set("triageEnabled", v),
3762
- disabled: !canWrite
3763
- }
3764
- ),
3765
- "Triage activ\xE9"
3766
- ] }),
3767
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3768
- /* @__PURE__ */ jsx(
3769
- Switch,
3770
- {
3771
- "aria-label": "Mode d'essai",
3772
- checked: bool(form.dryRun),
3773
- onCheckedChange: (v) => set("dryRun", v),
3774
- disabled: !canWrite
3775
- }
3776
- ),
3777
- "Mode d'essai \u2014 le triage tourne en entier, sans aucune \xE9criture Gorgias (ni r\xE9ponse, ni tag)"
3778
- ] }),
3779
- /* @__PURE__ */ jsx(
3780
- NumberField,
3781
- {
3782
- id: "batchLimit",
3783
- label: "Taille de lot",
3784
- value: num(form.batchLimit),
3785
- onChange: (v) => set("batchLimit", v),
3786
- disabled: !canWrite,
3787
- min: 1,
3788
- integer: true
3789
- }
3790
- ),
3791
- /* @__PURE__ */ jsx(
3792
- NumberField,
3793
- {
3794
- id: "triageIntervalMinutes",
3795
- label: "Intervalle de triage (minutes)",
3796
- value: num(form.triageIntervalMinutes),
3797
- onChange: (v) => set("triageIntervalMinutes", v),
3798
- disabled: !canWrite,
3799
- min: 1,
3800
- integer: true
3801
- }
3802
- ),
3803
- /* @__PURE__ */ jsx(
3804
- NumberField,
3805
- {
3806
- id: "responseTtlMinutes",
3807
- label: "Dur\xE9e de vie des r\xE9ponses (minutes)",
3808
- value: num(form.responseTtlMinutes),
3809
- onChange: (v) => set("responseTtlMinutes", v),
3810
- disabled: !canWrite,
3811
- min: 1,
3812
- integer: true
3813
- }
3814
- )
3815
- ] }) }),
3816
- /* @__PURE__ */ jsx(Card, { id: "envoi", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3817
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Envoi" }),
3818
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3819
- /* @__PURE__ */ jsx(
3820
- Switch,
3821
- {
3822
- "aria-label": "Envoi automatique",
3823
- checked: bool(form.autoSendEnabled),
3824
- onCheckedChange: (v) => set("autoSendEnabled", v),
3825
- disabled: !canWrite
3826
- }
3827
- ),
3828
- "Envoi automatique"
3829
- ] }),
3800
+ return (
3801
+ // No PageHeader here, unlike every other page of this kit: this one is
3802
+ // mounted INSIDE the platform's own settings screen
3803
+ // (`app-settings-view.tsx`), which already prints the breadcrumb and an
3804
+ // `<h1>` carrying this page's title. A second « Paramètres » heading right
3805
+ // under the first said nothing the operator had not just read, and pushed
3806
+ // the one field that actually gates the app — the Gorgias source view —
3807
+ // further down the screen.
3808
+ /* @__PURE__ */ jsxs(PageShell, { className: "max-w-3xl", children: [
3809
+ /* @__PURE__ */ jsx(Card, { id: "source", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3810
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Source" }),
3830
3811
  /* @__PURE__ */ jsxs("div", { children: [
3831
- /* @__PURE__ */ jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
3832
- /* @__PURE__ */ jsx(
3833
- Input,
3834
- {
3835
- id: "senderEmail",
3836
- value: field(form.senderEmail),
3837
- onChange: (e) => set("senderEmail", e.target.value),
3838
- disabled: !canWrite
3839
- }
3840
- )
3841
- ] }),
3842
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3812
+ /* @__PURE__ */ jsx("span", { className: "mb-1 block text-sm font-medium", children: "Connexion Gorgias" }),
3843
3813
  /* @__PURE__ */ jsx(
3844
- Switch,
3814
+ "p",
3845
3815
  {
3846
- "aria-label": "Exiger une confiance de triage \xE9lev\xE9e",
3847
- checked: bool(form.requireHighTriageConfidence),
3848
- onCheckedChange: (v) => set("requireHighTriageConfidence", v),
3849
- disabled: !canWrite
3816
+ className: connection.tone === "error" ? "text-sm text-destructive" : connection.tone === "muted" ? "text-sm text-muted-foreground" : "text-sm",
3817
+ children: connection.text
3850
3818
  }
3851
3819
  ),
3852
- "Exiger une confiance de triage \xE9lev\xE9e avant tout envoi automatique"
3820
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Cette application utilise la connexion Gorgias de l\u2019instance ; elle se r\xE8gle dans les int\xE9grations de la plateforme, pas ici." })
3853
3821
  ] }),
3854
3822
  /* @__PURE__ */ jsxs("div", { children: [
3855
- /* @__PURE__ */ jsx("label", { htmlFor: "whatsappMode", className: "mb-1 block text-sm font-medium", children: "Mode WhatsApp" }),
3856
- /* @__PURE__ */ jsx(
3823
+ /* @__PURE__ */ jsx("label", { htmlFor: "sourceViewId", className: "mb-1 block text-sm font-medium", children: "Vue Gorgias source" }),
3824
+ views.length > 0 ? /* @__PURE__ */ jsx(
3857
3825
  Select,
3858
3826
  {
3859
- "aria-label": "Mode WhatsApp",
3860
- value: field(form.whatsappMode) || void 0,
3861
- onValueChange: (v) => set("whatsappMode", v),
3862
- items: WHATSAPP_MODE_OPTIONS,
3863
- disabled: !canWrite
3864
- }
3865
- )
3866
- ] })
3867
- ] }) }),
3868
- /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3869
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Tags d'audit" }),
3870
- [
3871
- ["unknownTag", "Tag inconnu"],
3872
- ["handledTag", "Tag trait\xE9"],
3873
- ["escalationTag", "Tag d'escalade"],
3874
- ["needsHumanTag", "Tag besoin humain"],
3875
- ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
3876
- ["needsReviewTag", "Tag \xE0 revoir"],
3877
- ["followupTag", "Tag suivi requis"]
3878
- ].map(([key, label]) => /* @__PURE__ */ jsxs("div", { children: [
3879
- /* @__PURE__ */ jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
3880
- /* @__PURE__ */ jsx(Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
3881
- ] }, key))
3882
- ] }) }),
3883
- /* @__PURE__ */ jsx(Card, { id: "guardrails", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3884
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Garde-fous" }),
3885
- /* @__PURE__ */ jsxs("div", { children: [
3886
- /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Garde-fous actifs" }),
3887
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-1", children: AGENT_GUARDRAILS.map((id) => /* @__PURE__ */ jsx(
3888
- Checkbox,
3889
- {
3890
- label: guardrailHitLabel(id),
3891
- checked: guardrailsActive.includes(id),
3892
- onCheckedChange: (checked) => toggleGuardrail(id, checked),
3893
- disabled: !canWrite
3894
- },
3895
- id
3896
- )) })
3897
- ] }),
3898
- /* @__PURE__ */ jsxs("div", { children: [
3899
- /* @__PURE__ */ jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage" }),
3900
- /* @__PURE__ */ jsx(
3901
- Textarea,
3902
- {
3903
- id: "blocklist",
3904
- value: list(form.blocklist),
3905
- onChange: (e) => set("blocklist", parseList(e.target.value)),
3906
- disabled: !canWrite
3907
- }
3908
- )
3909
- ] }),
3910
- /* @__PURE__ */ jsxs("div", { children: [
3911
- /* @__PURE__ */ jsx("label", { htmlFor: "noreplySenders", className: "mb-1 block text-sm font-medium", children: "Exp\xE9diteurs no-reply (s\xE9par\xE9s par des virgules)" }),
3912
- /* @__PURE__ */ jsx(
3913
- Textarea,
3914
- {
3915
- id: "noreplySenders",
3916
- value: list(form.noreplySenders),
3917
- onChange: (e) => set("noreplySenders", parseList(e.target.value)),
3827
+ "aria-label": "Vue Gorgias source",
3828
+ value: sourceViewId || void 0,
3829
+ onValueChange: (v) => set("sourceViewId", v),
3830
+ items: views.map((v) => ({ value: v.id, label: v.name })),
3918
3831
  disabled: !canWrite
3919
3832
  }
3920
- )
3921
- ] })
3922
- ] }) }),
3923
- /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3924
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Prompts de style par canal" }),
3925
- /* @__PURE__ */ jsxs("div", { children: [
3926
- /* @__PURE__ */ jsx("label", { htmlFor: "channelPromptEmail", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 email" }),
3927
- /* @__PURE__ */ jsx(
3833
+ ) : /* @__PURE__ */ jsx(
3928
3834
  Input,
3929
3835
  {
3930
- id: "channelPromptEmail",
3931
- value: field(form.channelPromptEmail),
3932
- onChange: (e) => set("channelPromptEmail", e.target.value),
3836
+ id: "sourceViewId",
3837
+ value: sourceViewId,
3838
+ onChange: (e) => set("sourceViewId", e.target.value),
3933
3839
  disabled: !canWrite
3934
3840
  }
3935
3841
  )
3936
3842
  ] }),
3937
- /* @__PURE__ */ jsxs("div", { children: [
3938
- /* @__PURE__ */ jsx("label", { htmlFor: "channelPromptWhatsapp", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 WhatsApp" }),
3939
- /* @__PURE__ */ jsx(
3940
- Input,
3941
- {
3942
- id: "channelPromptWhatsapp",
3943
- value: field(form.channelPromptWhatsapp),
3944
- onChange: (e) => set("channelPromptWhatsapp", e.target.value),
3945
- disabled: !canWrite
3946
- }
3947
- )
3948
- ] })
3843
+ claimedView && claimedView.claimedByAppSlugs.length > 0 && /* @__PURE__ */ jsxs("p", { className: "text-sm text-status-pending", children: [
3844
+ "Cette vue est d\xE9j\xE0 utilis\xE9e par : ",
3845
+ claimedView.claimedByAppSlugs.join(", ")
3846
+ ] }),
3847
+ claimUnverifiable && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Conflit avec une autre application : inv\xE9rifiable (droits administrateur plateforme requis pour lister les applications install\xE9es). Ce contr\xF4le est informatif \u2014 il ne bloque rien, mais ne peut pas garantir l'absence de conflit." }),
3848
+ sourceViewId === "" && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Aucune vue Gorgias configur\xE9e \u2014 le triage ne peut pas d\xE9marrer tant que ce champ n'est pas renseign\xE9." })
3949
3849
  ] }) }),
3950
- /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3951
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Divers" }),
3952
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3850
+ sourceViewId === "" ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
3851
+ /* @__PURE__ */ jsx(Card, { id: "cadence", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3852
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Cadence" }),
3853
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3854
+ /* @__PURE__ */ jsx(
3855
+ Switch,
3856
+ {
3857
+ "aria-label": "Triage activ\xE9",
3858
+ checked: bool(form.triageEnabled),
3859
+ onCheckedChange: (v) => set("triageEnabled", v),
3860
+ disabled: !canWrite
3861
+ }
3862
+ ),
3863
+ "Triage activ\xE9"
3864
+ ] }),
3865
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3866
+ /* @__PURE__ */ jsx(
3867
+ Switch,
3868
+ {
3869
+ "aria-label": "Mode d'essai",
3870
+ checked: bool(form.dryRun),
3871
+ onCheckedChange: (v) => set("dryRun", v),
3872
+ disabled: !canWrite
3873
+ }
3874
+ ),
3875
+ "Mode d'essai \u2014 le triage tourne en entier, sans aucune \xE9criture Gorgias (ni r\xE9ponse, ni tag)"
3876
+ ] }),
3953
3877
  /* @__PURE__ */ jsx(
3954
- Checkbox,
3878
+ NumberField,
3955
3879
  {
3956
- checked: bool(form.renameEnabled),
3957
- onCheckedChange: (v) => set("renameEnabled", v === true),
3958
- disabled: !canWrite
3880
+ id: "batchLimit",
3881
+ label: "Taille de lot",
3882
+ value: num(form.batchLimit),
3883
+ onChange: (v) => set("batchLimit", v),
3884
+ disabled: !canWrite,
3885
+ min: 1,
3886
+ integer: true
3959
3887
  }
3960
3888
  ),
3961
- "Renommage de sujet activ\xE9"
3962
- ] }),
3963
- /* @__PURE__ */ jsxs("div", { children: [
3964
- /* @__PURE__ */ jsx("label", { htmlFor: "renameFrom", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 motif \xE0 rep\xE9rer dans le sujet" }),
3965
3889
  /* @__PURE__ */ jsx(
3966
- Input,
3890
+ NumberField,
3967
3891
  {
3968
- id: "renameFrom",
3969
- value: field(form.renameFrom),
3970
- onChange: (e) => set("renameFrom", e.target.value),
3971
- disabled: !canWrite
3892
+ id: "triageIntervalMinutes",
3893
+ label: "Intervalle de triage (minutes)",
3894
+ value: num(form.triageIntervalMinutes),
3895
+ onChange: (v) => set("triageIntervalMinutes", v),
3896
+ disabled: !canWrite,
3897
+ min: 1,
3898
+ integer: true
3972
3899
  }
3973
- )
3974
- ] }),
3975
- /* @__PURE__ */ jsxs("div", { children: [
3976
- /* @__PURE__ */ jsx("label", { htmlFor: "renameTo", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 sujet de remplacement" }),
3900
+ ),
3977
3901
  /* @__PURE__ */ jsx(
3978
- Input,
3902
+ NumberField,
3979
3903
  {
3980
- id: "renameTo",
3981
- value: field(form.renameTo),
3982
- onChange: (e) => set("renameTo", e.target.value),
3983
- disabled: !canWrite
3904
+ id: "responseTtlMinutes",
3905
+ label: "Dur\xE9e de vie des r\xE9ponses (minutes)",
3906
+ value: num(form.responseTtlMinutes),
3907
+ onChange: (v) => set("responseTtlMinutes", v),
3908
+ disabled: !canWrite,
3909
+ min: 1,
3910
+ integer: true
3984
3911
  }
3985
3912
  )
3986
- ] }),
3987
- /* @__PURE__ */ jsxs("div", { children: [
3988
- /* @__PURE__ */ jsx("label", { htmlFor: "statsTimezone", className: "mb-1 block text-sm font-medium", children: "Fuseau horaire des statistiques" }),
3913
+ ] }) }),
3914
+ /* @__PURE__ */ jsx(Card, { id: "envoi", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3915
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Envoi" }),
3916
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3917
+ /* @__PURE__ */ jsx(
3918
+ Switch,
3919
+ {
3920
+ "aria-label": "Envoi automatique",
3921
+ checked: bool(form.autoSendEnabled),
3922
+ onCheckedChange: (v) => set("autoSendEnabled", v),
3923
+ disabled: !canWrite
3924
+ }
3925
+ ),
3926
+ "Envoi automatique"
3927
+ ] }),
3928
+ /* @__PURE__ */ jsxs("div", { children: [
3929
+ /* @__PURE__ */ jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
3930
+ /* @__PURE__ */ jsx(
3931
+ Input,
3932
+ {
3933
+ id: "senderEmail",
3934
+ value: field(form.senderEmail),
3935
+ onChange: (e) => set("senderEmail", e.target.value),
3936
+ disabled: !canWrite
3937
+ }
3938
+ )
3939
+ ] }),
3940
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
3941
+ /* @__PURE__ */ jsx(
3942
+ Switch,
3943
+ {
3944
+ "aria-label": "Exiger une confiance de triage \xE9lev\xE9e",
3945
+ checked: bool(form.requireHighTriageConfidence),
3946
+ onCheckedChange: (v) => set("requireHighTriageConfidence", v),
3947
+ disabled: !canWrite
3948
+ }
3949
+ ),
3950
+ "Exiger une confiance de triage \xE9lev\xE9e avant tout envoi automatique"
3951
+ ] }),
3952
+ /* @__PURE__ */ jsxs("div", { children: [
3953
+ /* @__PURE__ */ jsx("label", { htmlFor: "whatsappMode", className: "mb-1 block text-sm font-medium", children: "Mode WhatsApp" }),
3954
+ /* @__PURE__ */ jsx(
3955
+ Select,
3956
+ {
3957
+ "aria-label": "Mode WhatsApp",
3958
+ value: field(form.whatsappMode) || void 0,
3959
+ onValueChange: (v) => set("whatsappMode", v),
3960
+ items: WHATSAPP_MODE_OPTIONS,
3961
+ disabled: !canWrite
3962
+ }
3963
+ )
3964
+ ] })
3965
+ ] }) }),
3966
+ /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3967
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Tags d'audit" }),
3968
+ [
3969
+ ["unknownTag", "Tag inconnu"],
3970
+ ["handledTag", "Tag trait\xE9"],
3971
+ ["escalationTag", "Tag d'escalade"],
3972
+ ["needsHumanTag", "Tag besoin humain"],
3973
+ ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
3974
+ ["needsReviewTag", "Tag \xE0 revoir"],
3975
+ ["followupTag", "Tag suivi requis"]
3976
+ ].map(([key, label]) => /* @__PURE__ */ jsxs("div", { children: [
3977
+ /* @__PURE__ */ jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
3978
+ /* @__PURE__ */ jsx(Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
3979
+ ] }, key))
3980
+ ] }) }),
3981
+ /* @__PURE__ */ jsx(Card, { id: "guardrails", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
3982
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Garde-fous" }),
3983
+ /* @__PURE__ */ jsxs("div", { children: [
3984
+ /* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Garde-fous actifs" }),
3985
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-1", children: AGENT_GUARDRAILS.map((id) => /* @__PURE__ */ jsx(
3986
+ Checkbox,
3987
+ {
3988
+ label: guardrailHitLabel(id),
3989
+ checked: guardrailsActive.includes(id),
3990
+ onCheckedChange: (checked) => toggleGuardrail(id, checked),
3991
+ disabled: !canWrite
3992
+ },
3993
+ id
3994
+ )) })
3995
+ ] }),
3996
+ /* @__PURE__ */ jsxs("div", { children: [
3997
+ /* @__PURE__ */ jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage" }),
3998
+ /* @__PURE__ */ jsx(
3999
+ Textarea,
4000
+ {
4001
+ id: "blocklist",
4002
+ value: list(form.blocklist),
4003
+ onChange: (e) => set("blocklist", parseList(e.target.value)),
4004
+ disabled: !canWrite
4005
+ }
4006
+ )
4007
+ ] }),
4008
+ /* @__PURE__ */ jsxs("div", { children: [
4009
+ /* @__PURE__ */ jsx("label", { htmlFor: "noreplySenders", className: "mb-1 block text-sm font-medium", children: "Exp\xE9diteurs no-reply (s\xE9par\xE9s par des virgules)" }),
4010
+ /* @__PURE__ */ jsx(
4011
+ Textarea,
4012
+ {
4013
+ id: "noreplySenders",
4014
+ value: list(form.noreplySenders),
4015
+ onChange: (e) => set("noreplySenders", parseList(e.target.value)),
4016
+ disabled: !canWrite
4017
+ }
4018
+ )
4019
+ ] })
4020
+ ] }) }),
4021
+ /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
4022
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Prompts de style par canal" }),
4023
+ /* @__PURE__ */ jsxs("div", { children: [
4024
+ /* @__PURE__ */ jsx("label", { htmlFor: "channelPromptEmail", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 email" }),
4025
+ /* @__PURE__ */ jsx(
4026
+ Input,
4027
+ {
4028
+ id: "channelPromptEmail",
4029
+ value: field(form.channelPromptEmail),
4030
+ onChange: (e) => set("channelPromptEmail", e.target.value),
4031
+ disabled: !canWrite
4032
+ }
4033
+ )
4034
+ ] }),
4035
+ /* @__PURE__ */ jsxs("div", { children: [
4036
+ /* @__PURE__ */ jsx("label", { htmlFor: "channelPromptWhatsapp", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 WhatsApp" }),
4037
+ /* @__PURE__ */ jsx(
4038
+ Input,
4039
+ {
4040
+ id: "channelPromptWhatsapp",
4041
+ value: field(form.channelPromptWhatsapp),
4042
+ onChange: (e) => set("channelPromptWhatsapp", e.target.value),
4043
+ disabled: !canWrite
4044
+ }
4045
+ )
4046
+ ] })
4047
+ ] }) }),
4048
+ /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
4049
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Divers" }),
4050
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4051
+ /* @__PURE__ */ jsx(
4052
+ Checkbox,
4053
+ {
4054
+ checked: bool(form.renameEnabled),
4055
+ onCheckedChange: (v) => set("renameEnabled", v === true),
4056
+ disabled: !canWrite
4057
+ }
4058
+ ),
4059
+ "Renommage de sujet activ\xE9"
4060
+ ] }),
4061
+ /* @__PURE__ */ jsxs("div", { children: [
4062
+ /* @__PURE__ */ jsx("label", { htmlFor: "renameFrom", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 motif \xE0 rep\xE9rer dans le sujet" }),
4063
+ /* @__PURE__ */ jsx(
4064
+ Input,
4065
+ {
4066
+ id: "renameFrom",
4067
+ value: field(form.renameFrom),
4068
+ onChange: (e) => set("renameFrom", e.target.value),
4069
+ disabled: !canWrite
4070
+ }
4071
+ )
4072
+ ] }),
4073
+ /* @__PURE__ */ jsxs("div", { children: [
4074
+ /* @__PURE__ */ jsx("label", { htmlFor: "renameTo", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 sujet de remplacement" }),
4075
+ /* @__PURE__ */ jsx(
4076
+ Input,
4077
+ {
4078
+ id: "renameTo",
4079
+ value: field(form.renameTo),
4080
+ onChange: (e) => set("renameTo", e.target.value),
4081
+ disabled: !canWrite
4082
+ }
4083
+ )
4084
+ ] }),
4085
+ /* @__PURE__ */ jsxs("div", { children: [
4086
+ /* @__PURE__ */ jsx("label", { htmlFor: "statsTimezone", className: "mb-1 block text-sm font-medium", children: "Fuseau horaire des statistiques" }),
4087
+ /* @__PURE__ */ jsx(
4088
+ Input,
4089
+ {
4090
+ id: "statsTimezone",
4091
+ value: field(form.statsTimezone),
4092
+ onChange: (e) => set("statsTimezone", e.target.value),
4093
+ disabled: !canWrite
4094
+ }
4095
+ )
4096
+ ] })
4097
+ ] }) }),
4098
+ /* @__PURE__ */ jsx(Card, { id: "pipeline-avance", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
4099
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Traitement automatique" }),
3989
4100
  /* @__PURE__ */ jsx(
3990
- Input,
4101
+ PipelineNodesForm,
3991
4102
  {
3992
- id: "statsTimezone",
3993
- value: field(form.statsTimezone),
3994
- onChange: (e) => set("statsTimezone", e.target.value),
3995
- disabled: !canWrite
4103
+ value: form.nodes,
4104
+ onChange: (v) => set("nodes", v),
4105
+ canWrite,
4106
+ issueMessage: nodesIssue ? settingsIssueLabel(nodesIssue.key, nodesIssue.message) : null,
4107
+ prompts: promptCatalogue.prompts,
4108
+ promptsLoading: promptCatalogue.isLoading
3996
4109
  }
3997
- )
3998
- ] })
3999
- ] }) }),
4000
- /* @__PURE__ */ jsx(Card, { id: "pipeline-avance", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
4001
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Traitement automatique" }),
4002
- /* @__PURE__ */ jsx(
4003
- PipelineNodesForm,
4004
- {
4005
- value: form.nodes,
4006
- onChange: (v) => set("nodes", v),
4007
- canWrite,
4008
- issueMessage: nodesIssue ? settingsIssueLabel(nodesIssue.key, nodesIssue.message) : null,
4009
- prompts: promptCatalogue.prompts,
4010
- promptsLoading: promptCatalogue.isLoading
4011
- }
4012
- ),
4013
- promptCatalogue.error !== void 0 && /* @__PURE__ */ jsxs("p", { className: "text-sm text-destructive", children: [
4014
- "Catalogue de prompts indisponible \u2014 ",
4015
- describeApiError(promptCatalogue.error)
4016
- ] }),
4017
- /* @__PURE__ */ jsx(Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
4018
- ] }) }),
4019
- /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
4020
- /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Agents support" }),
4021
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Les agents support sont des utilisateurs plateforme \u2014 donnez-leur acc\xE8s \xE0 cette application depuis la gestion des membres." }),
4022
- /* @__PURE__ */ jsx(Link, { href: "/parametres/membres", children: "G\xE9rer les acc\xE8s" })
4023
- ] }) }),
4024
- summaryIssues.length > 0 && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-status-pending bg-status-pending/10 p-3 text-sm", children: summaryIssues.map((issue) => /* @__PURE__ */ jsx("p", { children: settingsIssueLabel(issue.key, issue.message) }, issue.key)) }),
4025
- canWrite && /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(Button, { onClick: () => void save(form), disabled: isSaving || issues.length > 0, children: isSaving ? "Enregistrement\u2026" : "Enregistrer" }) })
4110
+ ),
4111
+ promptCatalogue.error !== void 0 && /* @__PURE__ */ jsxs("p", { className: "text-sm text-destructive", children: [
4112
+ "Catalogue de prompts indisponible \u2014 ",
4113
+ describeApiError(promptCatalogue.error)
4114
+ ] }),
4115
+ /* @__PURE__ */ jsx(Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
4116
+ ] }) }),
4117
+ /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
4118
+ /* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Agents support" }),
4119
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Les agents support sont des utilisateurs plateforme \u2014 donnez-leur acc\xE8s \xE0 cette application depuis la gestion des membres." }),
4120
+ /* @__PURE__ */ jsx(Link, { href: "/parametres/membres", children: "G\xE9rer les acc\xE8s" })
4121
+ ] }) }),
4122
+ summaryIssues.length > 0 && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-status-pending bg-status-pending/10 p-3 text-sm", children: summaryIssues.map((issue) => /* @__PURE__ */ jsx("p", { children: settingsIssueLabel(issue.key, issue.message) }, issue.key)) }),
4123
+ canWrite && /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(Button, { onClick: () => void save(form), disabled: isSaving || issues.length > 0, children: isSaving ? "Enregistrement\u2026" : "Enregistrer" }) })
4124
+ ] })
4026
4125
  ] })
4027
- ] });
4126
+ );
4028
4127
  }
4029
4128
 
4030
4129
  // src/ui/graph-canvas/reachability.ts