@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.cjs CHANGED
@@ -1568,6 +1568,331 @@ function PipelinePage() {
1568
1568
  )
1569
1569
  ] });
1570
1570
  }
1571
+ var AGENT_FIELD_NAME_UID = "e9cfec6f-15c6-4d02-8f79-0667f64b9eb5";
1572
+ var AGENT_FIELD_PROVIDER_UID = "e522b809-e8a7-4439-a2df-936158d04389";
1573
+ var AGENT_FIELD_MODEL_ID_UID = "d95977ba-362c-44d6-a2f0-24156c76cf8a";
1574
+ var AGENT_FIELD_STATUS_UID = "348725a0-a896-4f8d-8a56-86f4193234a8";
1575
+ var AGENT_FIELD_DEFAULT_KEY_UID = "0134491a-c969-4c42-894c-36ad4880fed3";
1576
+ var AGENT_FIELD_PROMPT_NAME_UID = "32e7f234-00bb-44d2-917b-be28f32f7214";
1577
+ var AGENT_FIELD_PROMPT_LABEL_UID = "bdee53ff-571a-4df6-91ec-00b513a70fe0";
1578
+ var AGENT_FIELD_PROMPT_VERSION_UID = "e7c66f99-e1e0-4fc2-9f9e-3bafe3af8e88";
1579
+ var AGENT_FIELD_SYSTEM_PROMPT_SNAPSHOT_UID = "710b73c6-929b-48b7-abc0-792849adf1c2";
1580
+ var AGENT_FIELD_REASONING_EFFORT_UID = "aa57fc6e-c989-47d3-9fc8-e04184b1e67c";
1581
+ var AGENT_FIELD_MAX_TOOL_CALLS_UID = "6948a5ca-48ef-45d7-9118-c7ab195343a3";
1582
+
1583
+ // src/records/agent.ts
1584
+ var AGENT_STATUSES = ["default", "available", "archived"];
1585
+ var REASONING_EFFORT_OPTIONS = ["off", "low", "medium", "high"];
1586
+ var DEFAULT_LLM_PROVIDER = "openai";
1587
+ ({
1588
+ fields: [
1589
+ {
1590
+ universalIdentifier: AGENT_FIELD_NAME_UID,
1591
+ name: "name",
1592
+ type: appKit.FieldType.TEXT,
1593
+ label: "Name",
1594
+ isNullable: false
1595
+ },
1596
+ {
1597
+ universalIdentifier: AGENT_FIELD_PROVIDER_UID,
1598
+ name: "provider",
1599
+ type: appKit.FieldType.TEXT,
1600
+ label: "Provider",
1601
+ description: "Free text (spec \xA73.4) \u2014 a new provider must not need a kit release.",
1602
+ isNullable: false,
1603
+ defaultValue: DEFAULT_LLM_PROVIDER
1604
+ },
1605
+ {
1606
+ universalIdentifier: AGENT_FIELD_MODEL_ID_UID,
1607
+ name: "modelId",
1608
+ type: appKit.FieldType.TEXT,
1609
+ label: "Model id",
1610
+ isNullable: false
1611
+ },
1612
+ {
1613
+ universalIdentifier: AGENT_FIELD_STATUS_UID,
1614
+ name: "status",
1615
+ type: appKit.FieldType.SELECT,
1616
+ label: "Status",
1617
+ isNullable: false,
1618
+ options: [...AGENT_STATUSES],
1619
+ defaultValue: "available"
1620
+ },
1621
+ {
1622
+ universalIdentifier: AGENT_FIELD_DEFAULT_KEY_UID,
1623
+ name: "defaultKey",
1624
+ type: appKit.FieldType.TEXT,
1625
+ label: "Default key",
1626
+ description: "Equals 'default' when status='default', absent otherwise. Unique.",
1627
+ isNullable: true
1628
+ },
1629
+ {
1630
+ universalIdentifier: AGENT_FIELD_PROMPT_NAME_UID,
1631
+ name: "promptName",
1632
+ type: appKit.FieldType.TEXT,
1633
+ label: "Prompt name",
1634
+ description: "Free Langfuse prompt name (ETL keeps legacy agent/<old id> names).",
1635
+ isNullable: false
1636
+ },
1637
+ {
1638
+ universalIdentifier: AGENT_FIELD_PROMPT_LABEL_UID,
1639
+ name: "promptLabel",
1640
+ type: appKit.FieldType.TEXT,
1641
+ label: "Prompt label",
1642
+ isNullable: true
1643
+ },
1644
+ {
1645
+ universalIdentifier: AGENT_FIELD_PROMPT_VERSION_UID,
1646
+ name: "promptVersion",
1647
+ type: appKit.FieldType.NUMBER,
1648
+ label: "Prompt version",
1649
+ description: 'Pinning; absent means "follow the label".',
1650
+ isNullable: true
1651
+ },
1652
+ {
1653
+ universalIdentifier: AGENT_FIELD_SYSTEM_PROMPT_SNAPSHOT_UID,
1654
+ name: "systemPromptSnapshot",
1655
+ type: appKit.FieldType.TEXT,
1656
+ label: "System prompt snapshot",
1657
+ description: "Level-3 fallback of the prompt ladder (\xA73.7).",
1658
+ isNullable: true
1659
+ },
1660
+ {
1661
+ universalIdentifier: AGENT_FIELD_REASONING_EFFORT_UID,
1662
+ name: "reasoningEffort",
1663
+ type: appKit.FieldType.SELECT,
1664
+ label: "Reasoning effort",
1665
+ isNullable: true,
1666
+ options: [...REASONING_EFFORT_OPTIONS]
1667
+ },
1668
+ {
1669
+ universalIdentifier: AGENT_FIELD_MAX_TOOL_CALLS_UID,
1670
+ name: "maxToolCalls",
1671
+ type: appKit.FieldType.NUMBER,
1672
+ label: "Max tool calls",
1673
+ isNullable: true
1674
+ }
1675
+ ]});
1676
+
1677
+ // src/ui/settings/pipeline-nodes.ts
1678
+ var PIPELINE_STEP_KEYS = ["triage", "escalate", "draft", "evaluate", "revise"];
1679
+ var PIPELINE_STEPS = [
1680
+ {
1681
+ key: "triage",
1682
+ label: "Triage",
1683
+ description: "comprend et classe chaque demande entrante",
1684
+ requires: null,
1685
+ blockedReason: null
1686
+ },
1687
+ {
1688
+ key: "escalate",
1689
+ label: "Escalade",
1690
+ description: "passe la main \xE0 un humain",
1691
+ requires: null,
1692
+ blockedReason: null
1693
+ },
1694
+ {
1695
+ key: "draft",
1696
+ label: "R\xE9daction",
1697
+ description: "pr\xE9pare un projet de r\xE9ponse",
1698
+ requires: null,
1699
+ blockedReason: null
1700
+ },
1701
+ {
1702
+ key: "evaluate",
1703
+ label: "\xC9valuation",
1704
+ description: "relit la r\xE9ponse avant envoi",
1705
+ requires: "draft",
1706
+ blockedReason: "Il n'y a rien \xE0 \xE9valuer sans r\xE9daction."
1707
+ },
1708
+ {
1709
+ key: "revise",
1710
+ label: "R\xE9vision",
1711
+ description: "r\xE9\xE9crit la r\xE9ponse si l'\xE9valuation la juge insuffisante",
1712
+ requires: "evaluate",
1713
+ blockedReason: "Sans \xE9valuation, rien ne d\xE9clenche une r\xE9vision."
1714
+ }
1715
+ ];
1716
+ var TRIAGE_LOCK_REASON = "Sans triage l'app ne traite rien.";
1717
+ var STEP_BY_KEY = new Map(PIPELINE_STEPS.map((step) => [step.key, step]));
1718
+ function pipelineStep(key) {
1719
+ const step = STEP_BY_KEY.get(key);
1720
+ if (!step) throw new Error(`unknown pipeline step: ${key}`);
1721
+ return step;
1722
+ }
1723
+ function readNodes(value) {
1724
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
1725
+ return value;
1726
+ }
1727
+ function readStep(value, key) {
1728
+ const step = readNodes(value)[key];
1729
+ if (typeof step !== "object" || step === null || Array.isArray(step)) return null;
1730
+ return step;
1731
+ }
1732
+ function isStepEnabled(value, key) {
1733
+ return readStep(value, key) !== null;
1734
+ }
1735
+ function stepBlockedReason(value, key) {
1736
+ const { requires, blockedReason } = pipelineStep(key);
1737
+ if (!requires) return null;
1738
+ return isStepActive(value, requires) ? null : blockedReason;
1739
+ }
1740
+ function isStepActive(value, key) {
1741
+ return isStepEnabled(value, key) && stepBlockedReason(value, key) === null;
1742
+ }
1743
+ function withStep(value, key, step) {
1744
+ return { ...readNodes(value), [key]: step };
1745
+ }
1746
+ function withStepFields(value, key, patch) {
1747
+ const step = readStep(value, key);
1748
+ if (!step) return readNodes(value);
1749
+ const next = { ...step };
1750
+ for (const [field2, fieldValue] of Object.entries(patch)) {
1751
+ if (fieldValue === void 0) delete next[field2];
1752
+ else next[field2] = fieldValue;
1753
+ }
1754
+ return withStep(value, key, next);
1755
+ }
1756
+ function stepString(step, field2) {
1757
+ const value = step?.[field2];
1758
+ return typeof value === "string" ? value : "";
1759
+ }
1760
+ function stepNumber(step, field2, fallback) {
1761
+ const value = step?.[field2];
1762
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
1763
+ }
1764
+ function stepBoolean(step, field2, fallback) {
1765
+ const value = step?.[field2];
1766
+ return typeof value === "boolean" ? value : fallback;
1767
+ }
1768
+ function stepUsesAgentPrompt(key) {
1769
+ return key === "draft";
1770
+ }
1771
+ var DEFAULT_PROMPT_LABEL = "production";
1772
+ function stepPromptName(step) {
1773
+ return readPromptField(step, "name");
1774
+ }
1775
+ function stepPromptLabel(step) {
1776
+ return readPromptField(step, "label") || DEFAULT_PROMPT_LABEL;
1777
+ }
1778
+ function readPromptField(step, field2) {
1779
+ const prompt = step?.prompt;
1780
+ if (typeof prompt !== "object" || prompt === null) return "";
1781
+ const value = prompt[field2];
1782
+ return typeof value === "string" ? value : "";
1783
+ }
1784
+ function promptPatch(name, label) {
1785
+ return { prompt: { name, label } };
1786
+ }
1787
+ function stepReasoning(step) {
1788
+ const value = step?.reasoning;
1789
+ return REASONING_EFFORTS.some((effort) => effort.value === value) ? value : "off";
1790
+ }
1791
+ var REASONING_EFFORTS = [
1792
+ { value: "off", label: "Aucun" },
1793
+ { value: "low", label: "L\xE9ger" },
1794
+ { value: "medium", label: "Moyen" },
1795
+ { value: "high", label: "Pouss\xE9" }
1796
+ ];
1797
+ var KNOWN_MODELS = [
1798
+ {
1799
+ provider: "openai",
1800
+ model: "gpt-4o-mini",
1801
+ label: "GPT-4o mini",
1802
+ hint: "Le moins cher, tr\xE8s rapide \u2014 suffisant pour classer"
1803
+ },
1804
+ {
1805
+ provider: "openai",
1806
+ model: "gpt-5-mini",
1807
+ label: "GPT-5 mini",
1808
+ hint: "Rapide, bon march\xE9, meilleur raisonnement"
1809
+ },
1810
+ {
1811
+ provider: "openai",
1812
+ model: "gpt-4.1",
1813
+ label: "GPT-4.1",
1814
+ hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
1815
+ },
1816
+ {
1817
+ provider: "openai",
1818
+ model: "gpt-5",
1819
+ label: "GPT-5",
1820
+ hint: "Le plus capable \u2014 le plus lent et le plus cher"
1821
+ },
1822
+ {
1823
+ provider: "anthropic",
1824
+ model: "claude-3-5-haiku-latest",
1825
+ label: "Claude 3.5 Haiku",
1826
+ hint: "Rapide et bon march\xE9"
1827
+ },
1828
+ {
1829
+ provider: "anthropic",
1830
+ model: "claude-3-5-sonnet-latest",
1831
+ label: "Claude 3.5 Sonnet",
1832
+ hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
1833
+ }
1834
+ ];
1835
+ var CUSTOM_MODEL_VALUE = "__custom__";
1836
+ function findModelOption(model) {
1837
+ return KNOWN_MODELS.find((option) => option.model === model);
1838
+ }
1839
+ function defaultStep() {
1840
+ const [first] = KNOWN_MODELS;
1841
+ return { model: first.model, provider: first.provider, reasoning: "off" };
1842
+ }
1843
+ var PIPELINE_PRESETS = [
1844
+ {
1845
+ id: "triage-only",
1846
+ label: "D\xE9marrage prudent \u2014 triage seul",
1847
+ description: "Les demandes sont comprises et class\xE9es. Aucune r\xE9ponse n\u2019est pr\xE9par\xE9e.",
1848
+ enabled: ["triage"]
1849
+ },
1850
+ {
1851
+ id: "assisted",
1852
+ label: "R\xE9ponse assist\xE9e",
1853
+ 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.",
1854
+ enabled: ["triage", "escalate", "draft"]
1855
+ }
1856
+ ];
1857
+ function applyPreset(value, preset, restore) {
1858
+ let next = readNodes(value);
1859
+ for (const key of PIPELINE_STEP_KEYS) {
1860
+ const on = preset.enabled.includes(key);
1861
+ next = withStep(next, key, on ? readStep(next, key) ?? restore(key) : null);
1862
+ }
1863
+ return next;
1864
+ }
1865
+ function usePromptCatalogue() {
1866
+ const { appSlug } = uiSdk.useAppContext();
1867
+ const api = uiSdk.useAppApi();
1868
+ const [prompts, setPrompts] = react.useState([]);
1869
+ const [isLoading, setIsLoading] = react.useState(true);
1870
+ const [error, setError] = react.useState(void 0);
1871
+ const clientRef = react.useRef(api);
1872
+ clientRef.current = api;
1873
+ const requestIdRef = react.useRef(0);
1874
+ const isMountedRef = react.useRef(true);
1875
+ react.useEffect(() => {
1876
+ isMountedRef.current = true;
1877
+ const requestId = ++requestIdRef.current;
1878
+ setIsLoading(true);
1879
+ void clientRef.current.get(`/data/apps/${appSlug}/prompts`).then((catalogue) => {
1880
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
1881
+ setPrompts(catalogue);
1882
+ setError(void 0);
1883
+ }).catch((err) => {
1884
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
1885
+ setError(err);
1886
+ }).finally(() => {
1887
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
1888
+ setIsLoading(false);
1889
+ });
1890
+ return () => {
1891
+ isMountedRef.current = false;
1892
+ };
1893
+ }, [appSlug]);
1894
+ return { prompts, isLoading, error };
1895
+ }
1571
1896
  function ConfirmModal({
1572
1897
  title,
1573
1898
  description,
@@ -1771,18 +2096,34 @@ var STATUS_VARIANT = {
1771
2096
  archived: "outline"
1772
2097
  };
1773
2098
  function emptyForm() {
1774
- return { name: "", modelId: "", provider: "openai", systemPromptSnapshot: "" };
2099
+ return {
2100
+ name: "",
2101
+ modelId: "",
2102
+ provider: DEFAULT_LLM_PROVIDER,
2103
+ status: "available",
2104
+ promptName: "",
2105
+ promptLabel: "",
2106
+ systemPromptSnapshot: ""
2107
+ };
1775
2108
  }
1776
2109
  function formFromAgent(agent) {
1777
2110
  return {
1778
2111
  name: agent.name,
1779
2112
  modelId: agent.modelId,
1780
2113
  provider: agent.provider,
2114
+ status: agent.status,
2115
+ promptName: agent.promptName,
2116
+ promptLabel: agent.promptLabel ?? "",
1781
2117
  systemPromptSnapshot: agent.systemPromptSnapshot ?? ""
1782
2118
  };
1783
2119
  }
2120
+ var DERIVED_PROMPT_VALUE = "__derived__";
2121
+ var CUSTOM_PROMPT_VALUE = "__custom-prompt__";
2122
+ var DEFAULT_LABEL_VALUE = "__production__";
1784
2123
  function AgentFormModal({
1785
2124
  agent,
2125
+ prompts,
2126
+ promptsLoading,
1786
2127
  onClose,
1787
2128
  onSave
1788
2129
  }) {
@@ -1790,10 +2131,19 @@ function AgentFormModal({
1790
2131
  agent === "new" ? emptyForm() : formFromAgent(agent)
1791
2132
  );
1792
2133
  const [isSaving, setIsSaving] = react.useState(false);
2134
+ const [freeTextModel, setFreeTextModel] = react.useState(false);
2135
+ const [freeTextPrompt, setFreeTextPrompt] = react.useState(false);
1793
2136
  const nameId = react.useId();
1794
- const modelId = react.useId();
2137
+ const modelInputId = react.useId();
2138
+ const providerInputId = react.useId();
2139
+ const promptInputId = react.useId();
1795
2140
  const snapshotId = react.useId();
1796
- const isValid = form.name.trim() !== "" && form.modelId.trim() !== "";
2141
+ const knownModel = findModelOption(form.modelId);
2142
+ const showModelFreeText = freeTextModel || form.modelId !== "" && !knownModel;
2143
+ const knownPrompt = prompts.find((entry) => entry.name === form.promptName);
2144
+ const showPromptFreeText = freeTextPrompt || agent !== "new" && form.promptName !== "" && !knownPrompt && !promptsLoading;
2145
+ const promptLabels = knownPrompt?.labels ?? [];
2146
+ const isValid = form.name.trim() !== "" && form.modelId.trim() !== "" && (agent === "new" || form.promptName.trim() !== "");
1797
2147
  async function submit(event) {
1798
2148
  event.preventDefault();
1799
2149
  if (isSaving || !isValid) return;
@@ -1804,6 +2154,14 @@ function AgentFormModal({
1804
2154
  setIsSaving(false);
1805
2155
  }
1806
2156
  }
2157
+ function pickPrompt(next) {
2158
+ if (next === CUSTOM_PROMPT_VALUE) {
2159
+ setFreeTextPrompt(true);
2160
+ return;
2161
+ }
2162
+ setFreeTextPrompt(false);
2163
+ setForm({ ...form, promptName: next === DERIVED_PROMPT_VALUE ? "" : next, promptLabel: "" });
2164
+ }
1807
2165
  return /* @__PURE__ */ jsxRuntime.jsx(
1808
2166
  uiSdk.Modal,
1809
2167
  {
@@ -1815,24 +2173,113 @@ function AgentFormModal({
1815
2173
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: nameId, className: "mb-1 block text-sm font-medium", children: "Nom" }),
1816
2174
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: nameId, value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }) })
1817
2175
  ] }),
1818
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1819
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: modelId, className: "mb-1 block text-sm font-medium", children: "Mod\xE8le" }),
2176
+ agent !== "new" && agent.status !== "default" && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2177
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Statut" }),
1820
2178
  /* @__PURE__ */ jsxRuntime.jsx(
1821
- uiSdk.Input,
2179
+ uiSdk.Select,
1822
2180
  {
1823
- id: modelId,
1824
- value: form.modelId,
1825
- onChange: (e) => setForm({ ...form, modelId: e.target.value })
2181
+ "aria-label": "Statut",
2182
+ value: form.status,
2183
+ onValueChange: (next) => setForm({ ...form, status: next }),
2184
+ items: [
2185
+ { value: "available", label: STATUS_LABELS.available },
2186
+ { value: "archived", label: STATUS_LABELS.archived }
2187
+ ]
1826
2188
  }
1827
2189
  )
1828
2190
  ] }),
1829
2191
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1830
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Fournisseur" }),
1831
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
1832
- form.provider,
1833
- " \u2014 non modifiable ici ; le fournisseur r\xE9ellement appel\xE9 est celui des Param\xE8tres."
2192
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Mod\xE8le" }),
2193
+ /* @__PURE__ */ jsxRuntime.jsx(
2194
+ uiSdk.Select,
2195
+ {
2196
+ "aria-label": "Mod\xE8le",
2197
+ value: showModelFreeText ? CUSTOM_MODEL_VALUE : knownModel?.model ?? void 0,
2198
+ onValueChange: (next) => {
2199
+ if (next === CUSTOM_MODEL_VALUE) {
2200
+ setFreeTextModel(true);
2201
+ return;
2202
+ }
2203
+ setFreeTextModel(false);
2204
+ const option = findModelOption(next);
2205
+ if (!option) return;
2206
+ setForm({ ...form, modelId: option.model, provider: option.provider });
2207
+ },
2208
+ items: [
2209
+ ...KNOWN_MODELS.map((option) => ({
2210
+ value: option.model,
2211
+ label: `${option.label} \u2014 ${option.hint}`
2212
+ })),
2213
+ { value: CUSTOM_MODEL_VALUE, label: "Autre \u2014 saisir un identifiant de mod\xE8le" }
2214
+ ]
2215
+ }
2216
+ ),
2217
+ showModelFreeText && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 space-y-2", children: [
2218
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: modelInputId, className: "mb-1 block text-sm font-medium", children: "Identifiant de mod\xE8le" }),
2219
+ /* @__PURE__ */ jsxRuntime.jsx(
2220
+ uiSdk.Input,
2221
+ {
2222
+ id: modelInputId,
2223
+ value: form.modelId,
2224
+ onChange: (e) => setForm({ ...form, modelId: e.target.value })
2225
+ }
2226
+ ),
2227
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: providerInputId, className: "mb-1 block text-sm font-medium", children: "Fournisseur" }),
2228
+ /* @__PURE__ */ jsxRuntime.jsx(
2229
+ uiSdk.Input,
2230
+ {
2231
+ id: providerInputId,
2232
+ value: form.provider,
2233
+ onChange: (e) => setForm({ ...form, provider: e.target.value })
2234
+ }
2235
+ )
1834
2236
  ] })
1835
2237
  ] }),
2238
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2239
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Prompt Langfuse" }),
2240
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
2241
+ /* @__PURE__ */ jsxRuntime.jsx(
2242
+ uiSdk.Select,
2243
+ {
2244
+ "aria-label": "Prompt Langfuse",
2245
+ value: showPromptFreeText ? CUSTOM_PROMPT_VALUE : knownPrompt ? form.promptName : agent === "new" ? DERIVED_PROMPT_VALUE : void 0,
2246
+ onValueChange: pickPrompt,
2247
+ items: [
2248
+ ...agent === "new" ? [{ value: DERIVED_PROMPT_VALUE, label: "Nouveau prompt \u2014 agent/<g\xE9n\xE9r\xE9 automatiquement>" }] : [],
2249
+ ...prompts.map((entry) => ({ value: entry.name, label: entry.name })),
2250
+ { value: CUSTOM_PROMPT_VALUE, label: "Autre \u2014 saisir un nom de prompt" }
2251
+ ],
2252
+ disabled: promptsLoading
2253
+ }
2254
+ ),
2255
+ /* @__PURE__ */ jsxRuntime.jsx(
2256
+ uiSdk.Select,
2257
+ {
2258
+ "aria-label": "Tag du prompt",
2259
+ value: form.promptLabel === "" ? DEFAULT_LABEL_VALUE : form.promptLabel,
2260
+ onValueChange: (next) => setForm({ ...form, promptLabel: next === DEFAULT_LABEL_VALUE ? "" : next }),
2261
+ items: [
2262
+ { value: DEFAULT_LABEL_VALUE, label: "production (par d\xE9faut)" },
2263
+ ...promptLabels.filter((label) => label !== DEFAULT_PROMPT_LABEL).map((label) => ({ value: label, label })),
2264
+ ...form.promptLabel !== "" && !promptLabels.includes(form.promptLabel) ? [{ value: form.promptLabel, label: form.promptLabel }] : []
2265
+ ],
2266
+ disabled: promptsLoading || form.promptName === "" && !showPromptFreeText
2267
+ }
2268
+ )
2269
+ ] }),
2270
+ showPromptFreeText && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2", children: [
2271
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: promptInputId, className: "mb-1 block text-sm font-medium", children: "Nom du prompt Langfuse" }),
2272
+ /* @__PURE__ */ jsxRuntime.jsx(
2273
+ uiSdk.Input,
2274
+ {
2275
+ id: promptInputId,
2276
+ value: form.promptName,
2277
+ onChange: (e) => setForm({ ...form, promptName: e.target.value })
2278
+ }
2279
+ )
2280
+ ] }),
2281
+ /* @__PURE__ */ jsxRuntime.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." })
2282
+ ] }),
1836
2283
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1837
2284
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: snapshotId, className: "mb-1 block text-sm font-medium", children: "Prompt de secours (niveau 3)" }),
1838
2285
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2032,6 +2479,8 @@ function AgentsPage() {
2032
2479
  const [formAgent, setFormAgent] = react.useState(null);
2033
2480
  const [versionsAgent, setVersionsAgent] = react.useState(null);
2034
2481
  const [deletingAgent, setDeletingAgent] = react.useState(null);
2482
+ const { prompts, isLoading: promptsLoading, error: promptsError } = usePromptCatalogue();
2483
+ const promptExists = (name) => promptsLoading || promptsError !== void 0 || prompts.some((entry) => entry.name === name);
2035
2484
  const recordPath = (id) => `/data/apps/${appSlug}/records/agent/${id}`;
2036
2485
  async function patchStatus(agent, status) {
2037
2486
  try {
@@ -2067,12 +2516,30 @@ function AgentsPage() {
2067
2516
  if (formAgent === "new") {
2068
2517
  await api.invoke(
2069
2518
  "create-agent",
2070
- { name: form.name, modelId: form.modelId, provider: form.provider, systemPromptSnapshot: form.systemPromptSnapshot },
2519
+ {
2520
+ name: form.name,
2521
+ modelId: form.modelId,
2522
+ provider: form.provider,
2523
+ systemPromptSnapshot: form.systemPromptSnapshot,
2524
+ // Verbatim (trim only) — empty means "derive agent/<id>", and an
2525
+ // empty label means "follow production" (stored null, never the
2526
+ // literal string).
2527
+ promptName: form.promptName.trim(),
2528
+ promptLabel: form.promptLabel.trim()
2529
+ },
2071
2530
  { idempotencyKey: crypto.randomUUID() }
2072
2531
  );
2073
2532
  } else if (formAgent) {
2074
2533
  await api.patch(recordPath(formAgent.id), {
2075
- data: { name: form.name, modelId: form.modelId, systemPromptSnapshot: form.systemPromptSnapshot }
2534
+ data: {
2535
+ name: form.name,
2536
+ modelId: form.modelId,
2537
+ provider: form.provider,
2538
+ systemPromptSnapshot: form.systemPromptSnapshot,
2539
+ promptName: form.promptName.trim(),
2540
+ promptLabel: form.promptLabel.trim() || null,
2541
+ ...formAgent.status !== "default" ? { status: form.status } : {}
2542
+ }
2076
2543
  });
2077
2544
  }
2078
2545
  setFormAgent(null);
@@ -2093,7 +2560,14 @@ function AgentsPage() {
2093
2560
  header: "Statut",
2094
2561
  cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Badge, { variant: STATUS_VARIANT[row.status] ?? "neutral", children: STATUS_LABELS[row.status] ?? row.status })
2095
2562
  },
2096
- { key: "promptName", header: "Prompt", cell: (row) => row.promptName },
2563
+ {
2564
+ key: "promptName",
2565
+ header: "Prompt",
2566
+ cell: (row) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-2", children: [
2567
+ row.promptName,
2568
+ !promptExists(row.promptName) && /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Badge, { variant: "warning", children: "prompt introuvable chez Langfuse" })
2569
+ ] })
2570
+ },
2097
2571
  {
2098
2572
  key: "actions",
2099
2573
  header: "",
@@ -2139,7 +2613,16 @@ function AgentsPage() {
2139
2613
  empty: "Aucun agent configur\xE9."
2140
2614
  }
2141
2615
  ),
2142
- formAgent && /* @__PURE__ */ jsxRuntime.jsx(AgentFormModal, { agent: formAgent, onClose: () => setFormAgent(null), onSave: save }),
2616
+ formAgent && /* @__PURE__ */ jsxRuntime.jsx(
2617
+ AgentFormModal,
2618
+ {
2619
+ agent: formAgent,
2620
+ prompts,
2621
+ promptsLoading,
2622
+ onClose: () => setFormAgent(null),
2623
+ onSave: save
2624
+ }
2625
+ ),
2143
2626
  versionsAgent && /* @__PURE__ */ jsxRuntime.jsx(PromptVersionsPanel, { agent: versionsAgent, canWrite, onClose: () => setVersionsAgent(null) }),
2144
2627
  deletingAgent && /* @__PURE__ */ jsxRuntime.jsx(
2145
2628
  ConfirmModal,
@@ -3155,174 +3638,69 @@ function CorrectionsPage() {
3155
3638
  ConfirmModal,
3156
3639
  {
3157
3640
  title: "Supprimer toutes les comparaisons de cet agent ?",
3158
- description: `Toutes les comparaisons de \xAB ${selectedAgent?.name ?? agentFilter} \xBB sur cette page seront supprim\xE9es. Cette action est irr\xE9versible.`,
3159
- confirmLabel: "Tout supprimer",
3160
- onConfirm: confirmDeleteAll,
3161
- onCancel: () => setPendingDeleteAll(false)
3162
- }
3163
- )
3164
- ] });
3165
- }
3166
-
3167
- // src/settings/validate.ts
3168
- function validateSettings(settings) {
3169
- const issues = [];
3170
- if (!isNonEmptyString(settings.sourceViewId)) {
3171
- issues.push({
3172
- key: "sourceViewId",
3173
- message: "sourceViewId is required \u2014 pick the Gorgias view this app owns."
3174
- });
3175
- }
3176
- if (!isConfiguredNode(settings.nodes)) {
3177
- issues.push({
3178
- key: "nodes",
3179
- message: "nodes.triage must be configured \u2014 a null triage step would triage nothing."
3180
- });
3181
- }
3182
- const stepsWithoutPrompt = stepsMissingPrompt(settings.nodes);
3183
- if (stepsWithoutPrompt.length > 0) {
3184
- issues.push({
3185
- key: "nodePrompt",
3186
- message: `Every active step needs a Langfuse prompt \u2014 missing on: ${stepsWithoutPrompt.join(", ")}.`
3187
- });
3188
- }
3189
- const autoSendEnabled = settings.autoSendEnabled === true;
3190
- const isWhatsappAutoReply = settings.whatsappMode === "auto_reply";
3191
- if (autoSendEnabled && !isWhatsappAutoReply && !isNonEmptyString(settings.senderEmail)) {
3192
- issues.push({
3193
- key: "senderEmail",
3194
- message: "senderEmail is required when autoSendEnabled is on, unless whatsappMode is 'auto_reply'."
3195
- });
3196
- }
3197
- return issues;
3198
- }
3199
- function isNonEmptyString(value) {
3200
- return typeof value === "string" && value.length > 0;
3201
- }
3202
- var STEPS_REQUIRING_PROMPT = ["triage", "escalate", "evaluate", "revise"];
3203
- function stepsMissingPrompt(nodes) {
3204
- if (typeof nodes !== "object" || nodes === null) return [];
3205
- const byStep = nodes;
3206
- return STEPS_REQUIRING_PROMPT.filter((step) => {
3207
- const node = byStep[step];
3208
- if (typeof node !== "object" || node === null) return false;
3209
- return !isNonEmptyString(promptNameOf(node));
3210
- });
3211
- }
3212
- function promptNameOf(node) {
3213
- const prompt = node.prompt;
3214
- return typeof prompt === "object" && prompt !== null ? prompt.name : void 0;
3215
- }
3216
- function isConfiguredNode(nodes) {
3217
- if (typeof nodes !== "object" || nodes === null) return false;
3218
- const triage = nodes.triage;
3219
- return typeof triage === "object" && triage !== null;
3220
- }
3221
- var AGENT_FIELD_NAME_UID = "e9cfec6f-15c6-4d02-8f79-0667f64b9eb5";
3222
- var AGENT_FIELD_PROVIDER_UID = "e522b809-e8a7-4439-a2df-936158d04389";
3223
- var AGENT_FIELD_MODEL_ID_UID = "d95977ba-362c-44d6-a2f0-24156c76cf8a";
3224
- var AGENT_FIELD_STATUS_UID = "348725a0-a896-4f8d-8a56-86f4193234a8";
3225
- var AGENT_FIELD_DEFAULT_KEY_UID = "0134491a-c969-4c42-894c-36ad4880fed3";
3226
- var AGENT_FIELD_PROMPT_NAME_UID = "32e7f234-00bb-44d2-917b-be28f32f7214";
3227
- var AGENT_FIELD_PROMPT_LABEL_UID = "bdee53ff-571a-4df6-91ec-00b513a70fe0";
3228
- var AGENT_FIELD_PROMPT_VERSION_UID = "e7c66f99-e1e0-4fc2-9f9e-3bafe3af8e88";
3229
- var AGENT_FIELD_SYSTEM_PROMPT_SNAPSHOT_UID = "710b73c6-929b-48b7-abc0-792849adf1c2";
3230
- var AGENT_FIELD_REASONING_EFFORT_UID = "aa57fc6e-c989-47d3-9fc8-e04184b1e67c";
3231
- var AGENT_FIELD_MAX_TOOL_CALLS_UID = "6948a5ca-48ef-45d7-9118-c7ab195343a3";
3232
-
3233
- // src/records/agent.ts
3234
- var AGENT_STATUSES = ["default", "available", "archived"];
3235
- var REASONING_EFFORT_OPTIONS = ["off", "low", "medium", "high"];
3236
- var DEFAULT_LLM_PROVIDER = "openai";
3237
- ({
3238
- fields: [
3239
- {
3240
- universalIdentifier: AGENT_FIELD_NAME_UID,
3241
- name: "name",
3242
- type: appKit.FieldType.TEXT,
3243
- label: "Name",
3244
- isNullable: false
3245
- },
3246
- {
3247
- universalIdentifier: AGENT_FIELD_PROVIDER_UID,
3248
- name: "provider",
3249
- type: appKit.FieldType.TEXT,
3250
- label: "Provider",
3251
- description: "Free text (spec \xA73.4) \u2014 a new provider must not need a kit release.",
3252
- isNullable: false,
3253
- defaultValue: DEFAULT_LLM_PROVIDER
3254
- },
3255
- {
3256
- universalIdentifier: AGENT_FIELD_MODEL_ID_UID,
3257
- name: "modelId",
3258
- type: appKit.FieldType.TEXT,
3259
- label: "Model id",
3260
- isNullable: false
3261
- },
3262
- {
3263
- universalIdentifier: AGENT_FIELD_STATUS_UID,
3264
- name: "status",
3265
- type: appKit.FieldType.SELECT,
3266
- label: "Status",
3267
- isNullable: false,
3268
- options: [...AGENT_STATUSES],
3269
- defaultValue: "available"
3270
- },
3271
- {
3272
- universalIdentifier: AGENT_FIELD_DEFAULT_KEY_UID,
3273
- name: "defaultKey",
3274
- type: appKit.FieldType.TEXT,
3275
- label: "Default key",
3276
- description: "Equals 'default' when status='default', absent otherwise. Unique.",
3277
- isNullable: true
3278
- },
3279
- {
3280
- universalIdentifier: AGENT_FIELD_PROMPT_NAME_UID,
3281
- name: "promptName",
3282
- type: appKit.FieldType.TEXT,
3283
- label: "Prompt name",
3284
- description: "Free Langfuse prompt name (ETL keeps legacy agent/<old id> names).",
3285
- isNullable: false
3286
- },
3287
- {
3288
- universalIdentifier: AGENT_FIELD_PROMPT_LABEL_UID,
3289
- name: "promptLabel",
3290
- type: appKit.FieldType.TEXT,
3291
- label: "Prompt label",
3292
- isNullable: true
3293
- },
3294
- {
3295
- universalIdentifier: AGENT_FIELD_PROMPT_VERSION_UID,
3296
- name: "promptVersion",
3297
- type: appKit.FieldType.NUMBER,
3298
- label: "Prompt version",
3299
- description: 'Pinning; absent means "follow the label".',
3300
- isNullable: true
3301
- },
3302
- {
3303
- universalIdentifier: AGENT_FIELD_SYSTEM_PROMPT_SNAPSHOT_UID,
3304
- name: "systemPromptSnapshot",
3305
- type: appKit.FieldType.TEXT,
3306
- label: "System prompt snapshot",
3307
- description: "Level-3 fallback of the prompt ladder (\xA73.7).",
3308
- isNullable: true
3309
- },
3310
- {
3311
- universalIdentifier: AGENT_FIELD_REASONING_EFFORT_UID,
3312
- name: "reasoningEffort",
3313
- type: appKit.FieldType.SELECT,
3314
- label: "Reasoning effort",
3315
- isNullable: true,
3316
- options: [...REASONING_EFFORT_OPTIONS]
3317
- },
3318
- {
3319
- universalIdentifier: AGENT_FIELD_MAX_TOOL_CALLS_UID,
3320
- name: "maxToolCalls",
3321
- type: appKit.FieldType.NUMBER,
3322
- label: "Max tool calls",
3323
- isNullable: true
3324
- }
3325
- ]});
3641
+ description: `Toutes les comparaisons de \xAB ${selectedAgent?.name ?? agentFilter} \xBB sur cette page seront supprim\xE9es. Cette action est irr\xE9versible.`,
3642
+ confirmLabel: "Tout supprimer",
3643
+ onConfirm: confirmDeleteAll,
3644
+ onCancel: () => setPendingDeleteAll(false)
3645
+ }
3646
+ )
3647
+ ] });
3648
+ }
3649
+
3650
+ // src/settings/validate.ts
3651
+ function validateSettings(settings) {
3652
+ const issues = [];
3653
+ if (!isNonEmptyString(settings.sourceViewId)) {
3654
+ issues.push({
3655
+ key: "sourceViewId",
3656
+ message: "sourceViewId is required \u2014 pick the Gorgias view this app owns."
3657
+ });
3658
+ }
3659
+ if (!isConfiguredNode(settings.nodes)) {
3660
+ issues.push({
3661
+ key: "nodes",
3662
+ message: "nodes.triage must be configured \u2014 a null triage step would triage nothing."
3663
+ });
3664
+ }
3665
+ const stepsWithoutPrompt = stepsMissingPrompt(settings.nodes);
3666
+ if (stepsWithoutPrompt.length > 0) {
3667
+ issues.push({
3668
+ key: "nodePrompt",
3669
+ message: `Every active step needs a Langfuse prompt \u2014 missing on: ${stepsWithoutPrompt.join(", ")}.`
3670
+ });
3671
+ }
3672
+ const autoSendEnabled = settings.autoSendEnabled === true;
3673
+ const isWhatsappAutoReply = settings.whatsappMode === "auto_reply";
3674
+ if (autoSendEnabled && !isWhatsappAutoReply && !isNonEmptyString(settings.senderEmail)) {
3675
+ issues.push({
3676
+ key: "senderEmail",
3677
+ message: "senderEmail is required when autoSendEnabled is on, unless whatsappMode is 'auto_reply'."
3678
+ });
3679
+ }
3680
+ return issues;
3681
+ }
3682
+ function isNonEmptyString(value) {
3683
+ return typeof value === "string" && value.length > 0;
3684
+ }
3685
+ var STEPS_REQUIRING_PROMPT = ["triage", "escalate", "evaluate", "revise"];
3686
+ function stepsMissingPrompt(nodes) {
3687
+ if (typeof nodes !== "object" || nodes === null) return [];
3688
+ const byStep = nodes;
3689
+ return STEPS_REQUIRING_PROMPT.filter((step) => {
3690
+ const node = byStep[step];
3691
+ if (typeof node !== "object" || node === null) return false;
3692
+ return !isNonEmptyString(promptNameOf(node));
3693
+ });
3694
+ }
3695
+ function promptNameOf(node) {
3696
+ const prompt = node.prompt;
3697
+ return typeof prompt === "object" && prompt !== null ? prompt.name : void 0;
3698
+ }
3699
+ function isConfiguredNode(nodes) {
3700
+ if (typeof nodes !== "object" || nodes === null) return false;
3701
+ const triage = nodes.triage;
3702
+ return typeof triage === "object" && triage !== null;
3703
+ }
3326
3704
 
3327
3705
  // src/settings/to-profile.ts
3328
3706
  var DEFAULT_REASONING = "off";
@@ -3448,199 +3826,10 @@ function NumberField({ id, label, value, onChange, disabled, min, max, integer,
3448
3826
  const bounded = Math.min(max ?? Infinity, Math.max(min ?? -Infinity, rounded));
3449
3827
  onChange(bounded);
3450
3828
  }
3451
- }
3452
- ),
3453
- hint && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: hint })
3454
- ] });
3455
- }
3456
-
3457
- // src/ui/settings/pipeline-nodes.ts
3458
- var PIPELINE_STEP_KEYS = ["triage", "escalate", "draft", "evaluate", "revise"];
3459
- var PIPELINE_STEPS = [
3460
- {
3461
- key: "triage",
3462
- label: "Triage",
3463
- description: "comprend et classe chaque demande entrante",
3464
- requires: null,
3465
- blockedReason: null
3466
- },
3467
- {
3468
- key: "escalate",
3469
- label: "Escalade",
3470
- description: "passe la main \xE0 un humain",
3471
- requires: null,
3472
- blockedReason: null
3473
- },
3474
- {
3475
- key: "draft",
3476
- label: "R\xE9daction",
3477
- description: "pr\xE9pare un projet de r\xE9ponse",
3478
- requires: null,
3479
- blockedReason: null
3480
- },
3481
- {
3482
- key: "evaluate",
3483
- label: "\xC9valuation",
3484
- description: "relit la r\xE9ponse avant envoi",
3485
- requires: "draft",
3486
- blockedReason: "Il n'y a rien \xE0 \xE9valuer sans r\xE9daction."
3487
- },
3488
- {
3489
- key: "revise",
3490
- label: "R\xE9vision",
3491
- description: "r\xE9\xE9crit la r\xE9ponse si l'\xE9valuation la juge insuffisante",
3492
- requires: "evaluate",
3493
- blockedReason: "Sans \xE9valuation, rien ne d\xE9clenche une r\xE9vision."
3494
- }
3495
- ];
3496
- var TRIAGE_LOCK_REASON = "Sans triage l'app ne traite rien.";
3497
- var STEP_BY_KEY = new Map(PIPELINE_STEPS.map((step) => [step.key, step]));
3498
- function pipelineStep(key) {
3499
- const step = STEP_BY_KEY.get(key);
3500
- if (!step) throw new Error(`unknown pipeline step: ${key}`);
3501
- return step;
3502
- }
3503
- function readNodes(value) {
3504
- if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
3505
- return value;
3506
- }
3507
- function readStep(value, key) {
3508
- const step = readNodes(value)[key];
3509
- if (typeof step !== "object" || step === null || Array.isArray(step)) return null;
3510
- return step;
3511
- }
3512
- function isStepEnabled(value, key) {
3513
- return readStep(value, key) !== null;
3514
- }
3515
- function stepBlockedReason(value, key) {
3516
- const { requires, blockedReason } = pipelineStep(key);
3517
- if (!requires) return null;
3518
- return isStepActive(value, requires) ? null : blockedReason;
3519
- }
3520
- function isStepActive(value, key) {
3521
- return isStepEnabled(value, key) && stepBlockedReason(value, key) === null;
3522
- }
3523
- function withStep(value, key, step) {
3524
- return { ...readNodes(value), [key]: step };
3525
- }
3526
- function withStepFields(value, key, patch) {
3527
- const step = readStep(value, key);
3528
- if (!step) return readNodes(value);
3529
- const next = { ...step };
3530
- for (const [field2, fieldValue] of Object.entries(patch)) {
3531
- if (fieldValue === void 0) delete next[field2];
3532
- else next[field2] = fieldValue;
3533
- }
3534
- return withStep(value, key, next);
3535
- }
3536
- function stepString(step, field2) {
3537
- const value = step?.[field2];
3538
- return typeof value === "string" ? value : "";
3539
- }
3540
- function stepNumber(step, field2, fallback) {
3541
- const value = step?.[field2];
3542
- return typeof value === "number" && Number.isFinite(value) ? value : fallback;
3543
- }
3544
- function stepBoolean(step, field2, fallback) {
3545
- const value = step?.[field2];
3546
- return typeof value === "boolean" ? value : fallback;
3547
- }
3548
- function stepUsesAgentPrompt(key) {
3549
- return key === "draft";
3550
- }
3551
- var DEFAULT_PROMPT_LABEL = "production";
3552
- function stepPromptName(step) {
3553
- return readPromptField(step, "name");
3554
- }
3555
- function stepPromptLabel(step) {
3556
- return readPromptField(step, "label") || DEFAULT_PROMPT_LABEL;
3557
- }
3558
- function readPromptField(step, field2) {
3559
- const prompt = step?.prompt;
3560
- if (typeof prompt !== "object" || prompt === null) return "";
3561
- const value = prompt[field2];
3562
- return typeof value === "string" ? value : "";
3563
- }
3564
- function promptPatch(name, label) {
3565
- return { prompt: { name, label } };
3566
- }
3567
- function stepReasoning(step) {
3568
- const value = step?.reasoning;
3569
- return REASONING_EFFORTS.some((effort) => effort.value === value) ? value : "off";
3570
- }
3571
- var REASONING_EFFORTS = [
3572
- { value: "off", label: "Aucun" },
3573
- { value: "low", label: "L\xE9ger" },
3574
- { value: "medium", label: "Moyen" },
3575
- { value: "high", label: "Pouss\xE9" }
3576
- ];
3577
- var KNOWN_MODELS = [
3578
- {
3579
- provider: "openai",
3580
- model: "gpt-4o-mini",
3581
- label: "GPT-4o mini",
3582
- hint: "Le moins cher, tr\xE8s rapide \u2014 suffisant pour classer"
3583
- },
3584
- {
3585
- provider: "openai",
3586
- model: "gpt-5-mini",
3587
- label: "GPT-5 mini",
3588
- hint: "Rapide, bon march\xE9, meilleur raisonnement"
3589
- },
3590
- {
3591
- provider: "openai",
3592
- model: "gpt-4.1",
3593
- label: "GPT-4.1",
3594
- hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
3595
- },
3596
- {
3597
- provider: "openai",
3598
- model: "gpt-5",
3599
- label: "GPT-5",
3600
- hint: "Le plus capable \u2014 le plus lent et le plus cher"
3601
- },
3602
- {
3603
- provider: "anthropic",
3604
- model: "claude-3-5-haiku-latest",
3605
- label: "Claude 3.5 Haiku",
3606
- hint: "Rapide et bon march\xE9"
3607
- },
3608
- {
3609
- provider: "anthropic",
3610
- model: "claude-3-5-sonnet-latest",
3611
- label: "Claude 3.5 Sonnet",
3612
- hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
3613
- }
3614
- ];
3615
- var CUSTOM_MODEL_VALUE = "__custom__";
3616
- function findModelOption(model) {
3617
- return KNOWN_MODELS.find((option) => option.model === model);
3618
- }
3619
- function defaultStep() {
3620
- const [first] = KNOWN_MODELS;
3621
- return { model: first.model, provider: first.provider, reasoning: "off" };
3622
- }
3623
- var PIPELINE_PRESETS = [
3624
- {
3625
- id: "triage-only",
3626
- label: "D\xE9marrage prudent \u2014 triage seul",
3627
- description: "Les demandes sont comprises et class\xE9es. Aucune r\xE9ponse n\u2019est pr\xE9par\xE9e.",
3628
- enabled: ["triage"]
3629
- },
3630
- {
3631
- id: "assisted",
3632
- label: "R\xE9ponse assist\xE9e",
3633
- 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.",
3634
- enabled: ["triage", "escalate", "draft"]
3635
- }
3636
- ];
3637
- function applyPreset(value, preset, restore) {
3638
- let next = readNodes(value);
3639
- for (const key of PIPELINE_STEP_KEYS) {
3640
- const on = preset.enabled.includes(key);
3641
- next = withStep(next, key, on ? readStep(next, key) ?? restore(key) : null);
3642
- }
3643
- return next;
3829
+ }
3830
+ ),
3831
+ hint && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: hint })
3832
+ ] });
3644
3833
  }
3645
3834
  var PERCENT = 100;
3646
3835
  function PipelineNodesForm({
@@ -3701,11 +3890,7 @@ function PipelineNodesForm({
3701
3890
  onPatch: (patch) => onChange(withStepFields(value, step.key, patch))
3702
3891
  },
3703
3892
  step.key
3704
- )) }),
3705
- /* @__PURE__ */ jsxRuntime.jsxs("details", { children: [
3706
- /* @__PURE__ */ jsxRuntime.jsx("summary", { className: "cursor-pointer text-sm font-medium", children: "Mode avanc\xE9 (JSON)" }),
3707
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsxRuntime.jsx(NodesJsonField, { value, onChange, disabled: !canWrite }) })
3708
- ] })
3893
+ )) })
3709
3894
  ] });
3710
3895
  }
3711
3896
  function StepRow({
@@ -3965,100 +4150,6 @@ function useIds(stepKey) {
3965
4150
  minConfidence: `${base2}-${stepKey}-min-confidence`
3966
4151
  };
3967
4152
  }
3968
- function NodesJsonField({
3969
- value,
3970
- onChange,
3971
- disabled
3972
- }) {
3973
- const id = react.useId();
3974
- const serialized = stringify(value);
3975
- const [text, setText] = react.useState(serialized);
3976
- const [parseError, setParseError] = react.useState(null);
3977
- const emittedRef = react.useRef(serialized);
3978
- react.useEffect(() => {
3979
- if (serialized === emittedRef.current) return;
3980
- emittedRef.current = serialized;
3981
- setText(serialized);
3982
- setParseError(null);
3983
- }, [serialized]);
3984
- function handleChange(next) {
3985
- setText(next);
3986
- try {
3987
- const parsed = JSON.parse(next);
3988
- emittedRef.current = stringify(parsed);
3989
- onChange(parsed);
3990
- setParseError(null);
3991
- } catch {
3992
- setParseError("JSON invalide \u2014 la derni\xE8re valeur valide est conserv\xE9e tant que ce texte ne parse pas.");
3993
- }
3994
- }
3995
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3996
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "mb-1 block text-sm font-medium", children: "\xC9tapes du graphe (JSON)" }),
3997
- /* @__PURE__ */ jsxRuntime.jsx(
3998
- uiSdk.Textarea,
3999
- {
4000
- id,
4001
- className: "font-mono text-xs",
4002
- rows: 10,
4003
- value: text,
4004
- disabled,
4005
- onChange: (e) => handleChange(e.target.value)
4006
- }
4007
- ),
4008
- parseError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-destructive", children: parseError }),
4009
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
4010
- "Chaque cl\xE9 optionnelle (",
4011
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "escalate" }),
4012
- ", ",
4013
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "draft" }),
4014
- ", ",
4015
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "evaluate" }),
4016
- ",",
4017
- " ",
4018
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "revise" }),
4019
- ") accepte ",
4020
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "null" }),
4021
- " pour d\xE9sactiver l'\xE9tape (\xA73.6).",
4022
- " ",
4023
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "triage" }),
4024
- " est obligatoire."
4025
- ] })
4026
- ] });
4027
- }
4028
- function stringify(value) {
4029
- return JSON.stringify(value ?? null, null, 2);
4030
- }
4031
- function usePromptCatalogue() {
4032
- const { appSlug } = uiSdk.useAppContext();
4033
- const api = uiSdk.useAppApi();
4034
- const [prompts, setPrompts] = react.useState([]);
4035
- const [isLoading, setIsLoading] = react.useState(true);
4036
- const [error, setError] = react.useState(void 0);
4037
- const clientRef = react.useRef(api);
4038
- clientRef.current = api;
4039
- const requestIdRef = react.useRef(0);
4040
- const isMountedRef = react.useRef(true);
4041
- react.useEffect(() => {
4042
- isMountedRef.current = true;
4043
- const requestId = ++requestIdRef.current;
4044
- setIsLoading(true);
4045
- void clientRef.current.get(`/data/apps/${appSlug}/prompts`).then((catalogue) => {
4046
- if (requestId !== requestIdRef.current || !isMountedRef.current) return;
4047
- setPrompts(catalogue);
4048
- setError(void 0);
4049
- }).catch((err) => {
4050
- if (requestId !== requestIdRef.current || !isMountedRef.current) return;
4051
- setError(err);
4052
- }).finally(() => {
4053
- if (requestId !== requestIdRef.current || !isMountedRef.current) return;
4054
- setIsLoading(false);
4055
- });
4056
- return () => {
4057
- isMountedRef.current = false;
4058
- };
4059
- }, [appSlug]);
4060
- return { prompts, isLoading, error };
4061
- }
4062
4153
  var WHATSAPP_MODE_LABELS = {
4063
4154
  escalate_only: "Escalade uniquement",
4064
4155
  draft_only: "Brouillon uniquement",
@@ -4182,325 +4273,333 @@ function SettingsPage() {
4182
4273
  checked ? [.../* @__PURE__ */ new Set([...guardrailsActive, id])] : guardrailsActive.filter((g) => g !== id)
4183
4274
  );
4184
4275
  }
4185
- return /* @__PURE__ */ jsxRuntime.jsxs(PageShell, { className: "max-w-3xl", children: [
4186
- /* @__PURE__ */ jsxRuntime.jsx(PageHeader, { title: "Param\xE8tres", description: "Configuration du pipeline de support." }),
4187
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "source", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4188
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Source" }),
4189
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4190
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mb-1 block text-sm font-medium", children: "Connexion Gorgias" }),
4191
- /* @__PURE__ */ jsxRuntime.jsx(
4192
- "p",
4193
- {
4194
- className: connection.tone === "error" ? "text-sm text-destructive" : connection.tone === "muted" ? "text-sm text-muted-foreground" : "text-sm",
4195
- children: connection.text
4196
- }
4197
- ),
4198
- /* @__PURE__ */ jsxRuntime.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." })
4199
- ] }),
4200
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4201
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "sourceViewId", className: "mb-1 block text-sm font-medium", children: "Vue Gorgias source" }),
4202
- views.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
4203
- uiSdk.Select,
4204
- {
4205
- "aria-label": "Vue Gorgias source",
4206
- value: sourceViewId || void 0,
4207
- onValueChange: (v) => set("sourceViewId", v),
4208
- items: views.map((v) => ({ value: v.id, label: v.name })),
4209
- disabled: !canWrite
4210
- }
4211
- ) : /* @__PURE__ */ jsxRuntime.jsx(
4212
- uiSdk.Input,
4213
- {
4214
- id: "sourceViewId",
4215
- value: sourceViewId,
4216
- onChange: (e) => set("sourceViewId", e.target.value),
4217
- disabled: !canWrite
4218
- }
4219
- )
4220
- ] }),
4221
- claimedView && claimedView.claimedByAppSlugs.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-status-pending", children: [
4222
- "Cette vue est d\xE9j\xE0 utilis\xE9e par : ",
4223
- claimedView.claimedByAppSlugs.join(", ")
4224
- ] }),
4225
- claimUnverifiable && /* @__PURE__ */ jsxRuntime.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." }),
4226
- sourceViewId === "" && /* @__PURE__ */ jsxRuntime.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." })
4227
- ] }) }),
4228
- sourceViewId === "" ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4229
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "cadence", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4230
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Cadence" }),
4231
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4232
- /* @__PURE__ */ jsxRuntime.jsx(
4233
- uiSdk.Switch,
4234
- {
4235
- "aria-label": "Triage activ\xE9",
4236
- checked: bool(form.triageEnabled),
4237
- onCheckedChange: (v) => set("triageEnabled", v),
4238
- disabled: !canWrite
4239
- }
4240
- ),
4241
- "Triage activ\xE9"
4242
- ] }),
4243
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4244
- /* @__PURE__ */ jsxRuntime.jsx(
4245
- uiSdk.Switch,
4246
- {
4247
- "aria-label": "Mode d'essai",
4248
- checked: bool(form.dryRun),
4249
- onCheckedChange: (v) => set("dryRun", v),
4250
- disabled: !canWrite
4251
- }
4252
- ),
4253
- "Mode d'essai \u2014 le triage tourne en entier, sans aucune \xE9criture Gorgias (ni r\xE9ponse, ni tag)"
4254
- ] }),
4255
- /* @__PURE__ */ jsxRuntime.jsx(
4256
- NumberField,
4257
- {
4258
- id: "batchLimit",
4259
- label: "Taille de lot",
4260
- value: num(form.batchLimit),
4261
- onChange: (v) => set("batchLimit", v),
4262
- disabled: !canWrite,
4263
- min: 1,
4264
- integer: true
4265
- }
4266
- ),
4267
- /* @__PURE__ */ jsxRuntime.jsx(
4268
- NumberField,
4269
- {
4270
- id: "triageIntervalMinutes",
4271
- label: "Intervalle de triage (minutes)",
4272
- value: num(form.triageIntervalMinutes),
4273
- onChange: (v) => set("triageIntervalMinutes", v),
4274
- disabled: !canWrite,
4275
- min: 1,
4276
- integer: true
4277
- }
4278
- ),
4279
- /* @__PURE__ */ jsxRuntime.jsx(
4280
- NumberField,
4281
- {
4282
- id: "responseTtlMinutes",
4283
- label: "Dur\xE9e de vie des r\xE9ponses (minutes)",
4284
- value: num(form.responseTtlMinutes),
4285
- onChange: (v) => set("responseTtlMinutes", v),
4286
- disabled: !canWrite,
4287
- min: 1,
4288
- integer: true
4289
- }
4290
- )
4291
- ] }) }),
4292
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "envoi", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4293
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Envoi" }),
4294
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4295
- /* @__PURE__ */ jsxRuntime.jsx(
4296
- uiSdk.Switch,
4297
- {
4298
- "aria-label": "Envoi automatique",
4299
- checked: bool(form.autoSendEnabled),
4300
- onCheckedChange: (v) => set("autoSendEnabled", v),
4301
- disabled: !canWrite
4302
- }
4303
- ),
4304
- "Envoi automatique"
4305
- ] }),
4276
+ return (
4277
+ // No PageHeader here, unlike every other page of this kit: this one is
4278
+ // mounted INSIDE the platform's own settings screen
4279
+ // (`app-settings-view.tsx`), which already prints the breadcrumb and an
4280
+ // `<h1>` carrying this page's title. A second « Paramètres » heading right
4281
+ // under the first said nothing the operator had not just read, and pushed
4282
+ // the one field that actually gates the app — the Gorgias source view —
4283
+ // further down the screen.
4284
+ /* @__PURE__ */ jsxRuntime.jsxs(PageShell, { className: "max-w-3xl", children: [
4285
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "source", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4286
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Source" }),
4306
4287
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4307
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
4308
- /* @__PURE__ */ jsxRuntime.jsx(
4309
- uiSdk.Input,
4310
- {
4311
- id: "senderEmail",
4312
- value: field(form.senderEmail),
4313
- onChange: (e) => set("senderEmail", e.target.value),
4314
- disabled: !canWrite
4315
- }
4316
- )
4317
- ] }),
4318
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4288
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mb-1 block text-sm font-medium", children: "Connexion Gorgias" }),
4319
4289
  /* @__PURE__ */ jsxRuntime.jsx(
4320
- uiSdk.Switch,
4290
+ "p",
4321
4291
  {
4322
- "aria-label": "Exiger une confiance de triage \xE9lev\xE9e",
4323
- checked: bool(form.requireHighTriageConfidence),
4324
- onCheckedChange: (v) => set("requireHighTriageConfidence", v),
4325
- disabled: !canWrite
4292
+ className: connection.tone === "error" ? "text-sm text-destructive" : connection.tone === "muted" ? "text-sm text-muted-foreground" : "text-sm",
4293
+ children: connection.text
4326
4294
  }
4327
4295
  ),
4328
- "Exiger une confiance de triage \xE9lev\xE9e avant tout envoi automatique"
4296
+ /* @__PURE__ */ jsxRuntime.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." })
4329
4297
  ] }),
4330
4298
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4331
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "whatsappMode", className: "mb-1 block text-sm font-medium", children: "Mode WhatsApp" }),
4332
- /* @__PURE__ */ jsxRuntime.jsx(
4299
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "sourceViewId", className: "mb-1 block text-sm font-medium", children: "Vue Gorgias source" }),
4300
+ views.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
4333
4301
  uiSdk.Select,
4334
4302
  {
4335
- "aria-label": "Mode WhatsApp",
4336
- value: field(form.whatsappMode) || void 0,
4337
- onValueChange: (v) => set("whatsappMode", v),
4338
- items: WHATSAPP_MODE_OPTIONS,
4339
- disabled: !canWrite
4340
- }
4341
- )
4342
- ] })
4343
- ] }) }),
4344
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4345
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Tags d'audit" }),
4346
- [
4347
- ["unknownTag", "Tag inconnu"],
4348
- ["handledTag", "Tag trait\xE9"],
4349
- ["escalationTag", "Tag d'escalade"],
4350
- ["needsHumanTag", "Tag besoin humain"],
4351
- ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
4352
- ["needsReviewTag", "Tag \xE0 revoir"],
4353
- ["followupTag", "Tag suivi requis"]
4354
- ].map(([key, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4355
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
4356
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
4357
- ] }, key))
4358
- ] }) }),
4359
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "guardrails", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4360
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Garde-fous" }),
4361
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4362
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Garde-fous actifs" }),
4363
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1", children: AGENT_GUARDRAILS.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
4364
- uiSdk.Checkbox,
4365
- {
4366
- label: guardrailHitLabel(id),
4367
- checked: guardrailsActive.includes(id),
4368
- onCheckedChange: (checked) => toggleGuardrail(id, checked),
4369
- disabled: !canWrite
4370
- },
4371
- id
4372
- )) })
4373
- ] }),
4374
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4375
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage" }),
4376
- /* @__PURE__ */ jsxRuntime.jsx(
4377
- uiSdk.Textarea,
4378
- {
4379
- id: "blocklist",
4380
- value: list(form.blocklist),
4381
- onChange: (e) => set("blocklist", parseList(e.target.value)),
4382
- disabled: !canWrite
4383
- }
4384
- )
4385
- ] }),
4386
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4387
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "noreplySenders", className: "mb-1 block text-sm font-medium", children: "Exp\xE9diteurs no-reply (s\xE9par\xE9s par des virgules)" }),
4388
- /* @__PURE__ */ jsxRuntime.jsx(
4389
- uiSdk.Textarea,
4390
- {
4391
- id: "noreplySenders",
4392
- value: list(form.noreplySenders),
4393
- onChange: (e) => set("noreplySenders", parseList(e.target.value)),
4303
+ "aria-label": "Vue Gorgias source",
4304
+ value: sourceViewId || void 0,
4305
+ onValueChange: (v) => set("sourceViewId", v),
4306
+ items: views.map((v) => ({ value: v.id, label: v.name })),
4394
4307
  disabled: !canWrite
4395
4308
  }
4396
- )
4397
- ] })
4398
- ] }) }),
4399
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4400
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Prompts de style par canal" }),
4401
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4402
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptEmail", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 email" }),
4403
- /* @__PURE__ */ jsxRuntime.jsx(
4309
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4404
4310
  uiSdk.Input,
4405
4311
  {
4406
- id: "channelPromptEmail",
4407
- value: field(form.channelPromptEmail),
4408
- onChange: (e) => set("channelPromptEmail", e.target.value),
4312
+ id: "sourceViewId",
4313
+ value: sourceViewId,
4314
+ onChange: (e) => set("sourceViewId", e.target.value),
4409
4315
  disabled: !canWrite
4410
4316
  }
4411
4317
  )
4412
4318
  ] }),
4413
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4414
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptWhatsapp", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 WhatsApp" }),
4415
- /* @__PURE__ */ jsxRuntime.jsx(
4416
- uiSdk.Input,
4417
- {
4418
- id: "channelPromptWhatsapp",
4419
- value: field(form.channelPromptWhatsapp),
4420
- onChange: (e) => set("channelPromptWhatsapp", e.target.value),
4421
- disabled: !canWrite
4422
- }
4423
- )
4424
- ] })
4319
+ claimedView && claimedView.claimedByAppSlugs.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-status-pending", children: [
4320
+ "Cette vue est d\xE9j\xE0 utilis\xE9e par : ",
4321
+ claimedView.claimedByAppSlugs.join(", ")
4322
+ ] }),
4323
+ claimUnverifiable && /* @__PURE__ */ jsxRuntime.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." }),
4324
+ sourceViewId === "" && /* @__PURE__ */ jsxRuntime.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." })
4425
4325
  ] }) }),
4426
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4427
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Divers" }),
4428
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4326
+ sourceViewId === "" ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4327
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "cadence", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4328
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Cadence" }),
4329
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4330
+ /* @__PURE__ */ jsxRuntime.jsx(
4331
+ uiSdk.Switch,
4332
+ {
4333
+ "aria-label": "Triage activ\xE9",
4334
+ checked: bool(form.triageEnabled),
4335
+ onCheckedChange: (v) => set("triageEnabled", v),
4336
+ disabled: !canWrite
4337
+ }
4338
+ ),
4339
+ "Triage activ\xE9"
4340
+ ] }),
4341
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4342
+ /* @__PURE__ */ jsxRuntime.jsx(
4343
+ uiSdk.Switch,
4344
+ {
4345
+ "aria-label": "Mode d'essai",
4346
+ checked: bool(form.dryRun),
4347
+ onCheckedChange: (v) => set("dryRun", v),
4348
+ disabled: !canWrite
4349
+ }
4350
+ ),
4351
+ "Mode d'essai \u2014 le triage tourne en entier, sans aucune \xE9criture Gorgias (ni r\xE9ponse, ni tag)"
4352
+ ] }),
4429
4353
  /* @__PURE__ */ jsxRuntime.jsx(
4430
- uiSdk.Checkbox,
4354
+ NumberField,
4431
4355
  {
4432
- checked: bool(form.renameEnabled),
4433
- onCheckedChange: (v) => set("renameEnabled", v === true),
4434
- disabled: !canWrite
4356
+ id: "batchLimit",
4357
+ label: "Taille de lot",
4358
+ value: num(form.batchLimit),
4359
+ onChange: (v) => set("batchLimit", v),
4360
+ disabled: !canWrite,
4361
+ min: 1,
4362
+ integer: true
4435
4363
  }
4436
4364
  ),
4437
- "Renommage de sujet activ\xE9"
4438
- ] }),
4439
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4440
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameFrom", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 motif \xE0 rep\xE9rer dans le sujet" }),
4441
4365
  /* @__PURE__ */ jsxRuntime.jsx(
4442
- uiSdk.Input,
4366
+ NumberField,
4443
4367
  {
4444
- id: "renameFrom",
4445
- value: field(form.renameFrom),
4446
- onChange: (e) => set("renameFrom", e.target.value),
4447
- disabled: !canWrite
4368
+ id: "triageIntervalMinutes",
4369
+ label: "Intervalle de triage (minutes)",
4370
+ value: num(form.triageIntervalMinutes),
4371
+ onChange: (v) => set("triageIntervalMinutes", v),
4372
+ disabled: !canWrite,
4373
+ min: 1,
4374
+ integer: true
4448
4375
  }
4449
- )
4450
- ] }),
4451
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4452
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameTo", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 sujet de remplacement" }),
4376
+ ),
4453
4377
  /* @__PURE__ */ jsxRuntime.jsx(
4454
- uiSdk.Input,
4378
+ NumberField,
4455
4379
  {
4456
- id: "renameTo",
4457
- value: field(form.renameTo),
4458
- onChange: (e) => set("renameTo", e.target.value),
4459
- disabled: !canWrite
4380
+ id: "responseTtlMinutes",
4381
+ label: "Dur\xE9e de vie des r\xE9ponses (minutes)",
4382
+ value: num(form.responseTtlMinutes),
4383
+ onChange: (v) => set("responseTtlMinutes", v),
4384
+ disabled: !canWrite,
4385
+ min: 1,
4386
+ integer: true
4460
4387
  }
4461
4388
  )
4462
- ] }),
4463
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4464
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "statsTimezone", className: "mb-1 block text-sm font-medium", children: "Fuseau horaire des statistiques" }),
4389
+ ] }) }),
4390
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "envoi", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4391
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Envoi" }),
4392
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4393
+ /* @__PURE__ */ jsxRuntime.jsx(
4394
+ uiSdk.Switch,
4395
+ {
4396
+ "aria-label": "Envoi automatique",
4397
+ checked: bool(form.autoSendEnabled),
4398
+ onCheckedChange: (v) => set("autoSendEnabled", v),
4399
+ disabled: !canWrite
4400
+ }
4401
+ ),
4402
+ "Envoi automatique"
4403
+ ] }),
4404
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4405
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
4406
+ /* @__PURE__ */ jsxRuntime.jsx(
4407
+ uiSdk.Input,
4408
+ {
4409
+ id: "senderEmail",
4410
+ value: field(form.senderEmail),
4411
+ onChange: (e) => set("senderEmail", e.target.value),
4412
+ disabled: !canWrite
4413
+ }
4414
+ )
4415
+ ] }),
4416
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4417
+ /* @__PURE__ */ jsxRuntime.jsx(
4418
+ uiSdk.Switch,
4419
+ {
4420
+ "aria-label": "Exiger une confiance de triage \xE9lev\xE9e",
4421
+ checked: bool(form.requireHighTriageConfidence),
4422
+ onCheckedChange: (v) => set("requireHighTriageConfidence", v),
4423
+ disabled: !canWrite
4424
+ }
4425
+ ),
4426
+ "Exiger une confiance de triage \xE9lev\xE9e avant tout envoi automatique"
4427
+ ] }),
4428
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4429
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "whatsappMode", className: "mb-1 block text-sm font-medium", children: "Mode WhatsApp" }),
4430
+ /* @__PURE__ */ jsxRuntime.jsx(
4431
+ uiSdk.Select,
4432
+ {
4433
+ "aria-label": "Mode WhatsApp",
4434
+ value: field(form.whatsappMode) || void 0,
4435
+ onValueChange: (v) => set("whatsappMode", v),
4436
+ items: WHATSAPP_MODE_OPTIONS,
4437
+ disabled: !canWrite
4438
+ }
4439
+ )
4440
+ ] })
4441
+ ] }) }),
4442
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4443
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Tags d'audit" }),
4444
+ [
4445
+ ["unknownTag", "Tag inconnu"],
4446
+ ["handledTag", "Tag trait\xE9"],
4447
+ ["escalationTag", "Tag d'escalade"],
4448
+ ["needsHumanTag", "Tag besoin humain"],
4449
+ ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
4450
+ ["needsReviewTag", "Tag \xE0 revoir"],
4451
+ ["followupTag", "Tag suivi requis"]
4452
+ ].map(([key, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4453
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
4454
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
4455
+ ] }, key))
4456
+ ] }) }),
4457
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "guardrails", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4458
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Garde-fous" }),
4459
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4460
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Garde-fous actifs" }),
4461
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1", children: AGENT_GUARDRAILS.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
4462
+ uiSdk.Checkbox,
4463
+ {
4464
+ label: guardrailHitLabel(id),
4465
+ checked: guardrailsActive.includes(id),
4466
+ onCheckedChange: (checked) => toggleGuardrail(id, checked),
4467
+ disabled: !canWrite
4468
+ },
4469
+ id
4470
+ )) })
4471
+ ] }),
4472
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4473
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage" }),
4474
+ /* @__PURE__ */ jsxRuntime.jsx(
4475
+ uiSdk.Textarea,
4476
+ {
4477
+ id: "blocklist",
4478
+ value: list(form.blocklist),
4479
+ onChange: (e) => set("blocklist", parseList(e.target.value)),
4480
+ disabled: !canWrite
4481
+ }
4482
+ )
4483
+ ] }),
4484
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4485
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "noreplySenders", className: "mb-1 block text-sm font-medium", children: "Exp\xE9diteurs no-reply (s\xE9par\xE9s par des virgules)" }),
4486
+ /* @__PURE__ */ jsxRuntime.jsx(
4487
+ uiSdk.Textarea,
4488
+ {
4489
+ id: "noreplySenders",
4490
+ value: list(form.noreplySenders),
4491
+ onChange: (e) => set("noreplySenders", parseList(e.target.value)),
4492
+ disabled: !canWrite
4493
+ }
4494
+ )
4495
+ ] })
4496
+ ] }) }),
4497
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4498
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Prompts de style par canal" }),
4499
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4500
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptEmail", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 email" }),
4501
+ /* @__PURE__ */ jsxRuntime.jsx(
4502
+ uiSdk.Input,
4503
+ {
4504
+ id: "channelPromptEmail",
4505
+ value: field(form.channelPromptEmail),
4506
+ onChange: (e) => set("channelPromptEmail", e.target.value),
4507
+ disabled: !canWrite
4508
+ }
4509
+ )
4510
+ ] }),
4511
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4512
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptWhatsapp", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 WhatsApp" }),
4513
+ /* @__PURE__ */ jsxRuntime.jsx(
4514
+ uiSdk.Input,
4515
+ {
4516
+ id: "channelPromptWhatsapp",
4517
+ value: field(form.channelPromptWhatsapp),
4518
+ onChange: (e) => set("channelPromptWhatsapp", e.target.value),
4519
+ disabled: !canWrite
4520
+ }
4521
+ )
4522
+ ] })
4523
+ ] }) }),
4524
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4525
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Divers" }),
4526
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4527
+ /* @__PURE__ */ jsxRuntime.jsx(
4528
+ uiSdk.Checkbox,
4529
+ {
4530
+ checked: bool(form.renameEnabled),
4531
+ onCheckedChange: (v) => set("renameEnabled", v === true),
4532
+ disabled: !canWrite
4533
+ }
4534
+ ),
4535
+ "Renommage de sujet activ\xE9"
4536
+ ] }),
4537
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4538
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameFrom", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 motif \xE0 rep\xE9rer dans le sujet" }),
4539
+ /* @__PURE__ */ jsxRuntime.jsx(
4540
+ uiSdk.Input,
4541
+ {
4542
+ id: "renameFrom",
4543
+ value: field(form.renameFrom),
4544
+ onChange: (e) => set("renameFrom", e.target.value),
4545
+ disabled: !canWrite
4546
+ }
4547
+ )
4548
+ ] }),
4549
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4550
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameTo", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 sujet de remplacement" }),
4551
+ /* @__PURE__ */ jsxRuntime.jsx(
4552
+ uiSdk.Input,
4553
+ {
4554
+ id: "renameTo",
4555
+ value: field(form.renameTo),
4556
+ onChange: (e) => set("renameTo", e.target.value),
4557
+ disabled: !canWrite
4558
+ }
4559
+ )
4560
+ ] }),
4561
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4562
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "statsTimezone", className: "mb-1 block text-sm font-medium", children: "Fuseau horaire des statistiques" }),
4563
+ /* @__PURE__ */ jsxRuntime.jsx(
4564
+ uiSdk.Input,
4565
+ {
4566
+ id: "statsTimezone",
4567
+ value: field(form.statsTimezone),
4568
+ onChange: (e) => set("statsTimezone", e.target.value),
4569
+ disabled: !canWrite
4570
+ }
4571
+ )
4572
+ ] })
4573
+ ] }) }),
4574
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "pipeline-avance", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4575
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Traitement automatique" }),
4465
4576
  /* @__PURE__ */ jsxRuntime.jsx(
4466
- uiSdk.Input,
4577
+ PipelineNodesForm,
4467
4578
  {
4468
- id: "statsTimezone",
4469
- value: field(form.statsTimezone),
4470
- onChange: (e) => set("statsTimezone", e.target.value),
4471
- disabled: !canWrite
4579
+ value: form.nodes,
4580
+ onChange: (v) => set("nodes", v),
4581
+ canWrite,
4582
+ issueMessage: nodesIssue ? settingsIssueLabel(nodesIssue.key, nodesIssue.message) : null,
4583
+ prompts: promptCatalogue.prompts,
4584
+ promptsLoading: promptCatalogue.isLoading
4472
4585
  }
4473
- )
4474
- ] })
4475
- ] }) }),
4476
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "pipeline-avance", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4477
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Traitement automatique" }),
4478
- /* @__PURE__ */ jsxRuntime.jsx(
4479
- PipelineNodesForm,
4480
- {
4481
- value: form.nodes,
4482
- onChange: (v) => set("nodes", v),
4483
- canWrite,
4484
- issueMessage: nodesIssue ? settingsIssueLabel(nodesIssue.key, nodesIssue.message) : null,
4485
- prompts: promptCatalogue.prompts,
4486
- promptsLoading: promptCatalogue.isLoading
4487
- }
4488
- ),
4489
- promptCatalogue.error !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-destructive", children: [
4490
- "Catalogue de prompts indisponible \u2014 ",
4491
- describeApiError(promptCatalogue.error)
4492
- ] }),
4493
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
4494
- ] }) }),
4495
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4496
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Agents support" }),
4497
- /* @__PURE__ */ jsxRuntime.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." }),
4498
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: "/parametres/membres", children: "G\xE9rer les acc\xE8s" })
4499
- ] }) }),
4500
- summaryIssues.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-status-pending bg-status-pending/10 p-3 text-sm", children: summaryIssues.map((issue) => /* @__PURE__ */ jsxRuntime.jsx("p", { children: settingsIssueLabel(issue.key, issue.message) }, issue.key)) }),
4501
- canWrite && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { onClick: () => void save(form), disabled: isSaving || issues.length > 0, children: isSaving ? "Enregistrement\u2026" : "Enregistrer" }) })
4586
+ ),
4587
+ promptCatalogue.error !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-destructive", children: [
4588
+ "Catalogue de prompts indisponible \u2014 ",
4589
+ describeApiError(promptCatalogue.error)
4590
+ ] }),
4591
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
4592
+ ] }) }),
4593
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4594
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Agents support" }),
4595
+ /* @__PURE__ */ jsxRuntime.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." }),
4596
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: "/parametres/membres", children: "G\xE9rer les acc\xE8s" })
4597
+ ] }) }),
4598
+ summaryIssues.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-status-pending bg-status-pending/10 p-3 text-sm", children: summaryIssues.map((issue) => /* @__PURE__ */ jsxRuntime.jsx("p", { children: settingsIssueLabel(issue.key, issue.message) }, issue.key)) }),
4599
+ canWrite && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { onClick: () => void save(form), disabled: isSaving || issues.length > 0, children: isSaving ? "Enregistrement\u2026" : "Enregistrer" }) })
4600
+ ] })
4502
4601
  ] })
4503
- ] });
4602
+ );
4504
4603
  }
4505
4604
 
4506
4605
  // src/graph/state.ts