paperclip-plugin-supermemory-otomatik 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/ui/index.tsx
2
- import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
2
+ import { useCallback, useEffect as useEffect2, useLayoutEffect, useRef, useState as useState2 } from "react";
3
3
  import {
4
4
  MarkdownBlock,
5
5
  useHostContext,
@@ -11,8 +11,116 @@ import {
11
11
  // src/manifest.ts
12
12
  var PLUGIN_ID = "paperclipai.supermemory";
13
13
 
14
+ // src/ui/plugin-upgrade.tsx
15
+ import { useEffect, useState } from "react";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ async function requestJson(path, init = {}) {
18
+ const headers = new Headers(init.headers);
19
+ if (init.body && !headers.has("content-type")) headers.set("content-type", "application/json");
20
+ const response = await fetch(path, { credentials: "include", ...init, headers });
21
+ if (!response.ok) {
22
+ const text = await response.text().catch(() => "");
23
+ let message = text || `Richiesta non riuscita (HTTP ${response.status}).`;
24
+ try {
25
+ message = String(JSON.parse(text).error ?? message);
26
+ } catch {
27
+ }
28
+ throw new Error(message);
29
+ }
30
+ return await response.json();
31
+ }
32
+ function errorMessage(error) {
33
+ return error instanceof Error ? error.message : String(error);
34
+ }
35
+ var card = {
36
+ border: "1px solid var(--border)",
37
+ borderRadius: 10,
38
+ background: "var(--card, transparent)",
39
+ padding: 18,
40
+ display: "grid",
41
+ gap: 10
42
+ };
43
+ var muted = { color: "var(--muted-foreground)" };
44
+ var button = {
45
+ justifySelf: "start",
46
+ border: "1px solid var(--border)",
47
+ borderRadius: 7,
48
+ background: "var(--secondary, transparent)",
49
+ color: "var(--foreground)",
50
+ padding: "8px 12px",
51
+ fontWeight: 600,
52
+ cursor: "pointer"
53
+ };
54
+ function PluginUpgradePanel({ pluginKey, title }) {
55
+ const [isAdmin, setIsAdmin] = useState(false);
56
+ const [plugin, setPlugin] = useState(null);
57
+ const [loading, setLoading] = useState(true);
58
+ const [upgrading, setUpgrading] = useState(false);
59
+ const [error, setError] = useState(null);
60
+ const [message, setMessage] = useState(null);
61
+ useEffect(() => {
62
+ let cancelled = false;
63
+ void (async () => {
64
+ try {
65
+ const access = await requestJson("/api/cli-auth/me");
66
+ if (cancelled) return;
67
+ setIsAdmin(access.isInstanceAdmin === true);
68
+ if (!access.isInstanceAdmin) return;
69
+ const plugins = await requestJson("/api/plugins");
70
+ if (cancelled) return;
71
+ setPlugin(plugins.find((item) => item.pluginKey === pluginKey) ?? null);
72
+ } catch (cause) {
73
+ if (!cancelled) setError(errorMessage(cause));
74
+ } finally {
75
+ if (!cancelled) setLoading(false);
76
+ }
77
+ })();
78
+ return () => {
79
+ cancelled = true;
80
+ };
81
+ }, [pluginKey]);
82
+ async function upgrade() {
83
+ if (!plugin || upgrading || !isAdmin) return;
84
+ if (!window.confirm(`Vuoi aggiornare ${title} all\u2019ultima versione pubblicata?`)) return;
85
+ setUpgrading(true);
86
+ setError(null);
87
+ setMessage(null);
88
+ try {
89
+ const updated = await requestJson(`/api/plugins/${encodeURIComponent(plugin.id)}/upgrade`, {
90
+ method: "POST",
91
+ body: JSON.stringify({})
92
+ });
93
+ setPlugin(updated);
94
+ setMessage(updated.status === "upgrade_pending" ? `Scaricato ${updated.version}. L\u2019aggiornamento richiede l\u2019approvazione delle nuove capability in Paperclip \u2192 Impostazioni \u2192 Plugin.` : `Aggiornamento completato: ${updated.version}. Ricarica la pagina del plugin per usare la nuova versione.`);
95
+ } catch (cause) {
96
+ setError(errorMessage(cause));
97
+ } finally {
98
+ setUpgrading(false);
99
+ }
100
+ }
101
+ return /* @__PURE__ */ jsxs("section", { style: card, "aria-labelledby": `${pluginKey}-upgrade-title`, children: [
102
+ /* @__PURE__ */ jsxs("div", { children: [
103
+ /* @__PURE__ */ jsx("h2", { id: `${pluginKey}-upgrade-title`, style: { margin: 0, fontSize: 17 }, children: "Aggiornamenti" }),
104
+ /* @__PURE__ */ jsx("p", { style: { ...muted, margin: "5px 0 0", fontSize: 13 }, children: loading ? "Controllo versione installata\u2026" : plugin ? `Versione installata: ${plugin.version} \xB7 ${plugin.packageName}` : isAdmin ? "Plugin non trovato tra quelli installati." : "L\u2019aggiornamento \xE8 disponibile solo agli amministratori dell\u2019istanza." })
105
+ ] }),
106
+ isAdmin ? /* @__PURE__ */ jsx(
107
+ "button",
108
+ {
109
+ type: "button",
110
+ style: { ...button, opacity: upgrading || !plugin || plugin.status === "upgrade_pending" ? 0.65 : 1 },
111
+ onClick: () => void upgrade(),
112
+ disabled: loading || upgrading || !plugin || plugin.status !== "ready",
113
+ children: upgrading ? "Aggiornamento in corso\u2026" : plugin?.status === "upgrade_pending" ? "In attesa di approvazione" : "Aggiorna all\u2019ultima versione"
114
+ }
115
+ ) : null,
116
+ message ? /* @__PURE__ */ jsx("p", { role: "status", style: { margin: 0, fontSize: 13 }, children: message }) : null,
117
+ error ? /* @__PURE__ */ jsx("p", { role: "alert", style: { margin: 0, color: "var(--destructive, #ef4444)", fontSize: 13 }, children: error }) : null,
118
+ /* @__PURE__ */ jsx("p", { style: { ...muted, margin: 0, fontSize: 12 }, children: "Paperclip scarica il pacchetto npm pi\xF9 recente. Se la nuova versione introduce capability, l\u2019istanza la mette in attesa di approvazione prima di riattivarla." })
119
+ ] });
120
+ }
121
+
14
122
  // src/ui/index.tsx
15
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
123
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
16
124
  var DEFAULT_GATEWAY = "https://otomatik.tail77a9ab.ts.net:18443/mcp";
17
125
  var LEGACY_GATEWAYS = /* @__PURE__ */ new Set(["http://127.0.0.1:6768/mcp", "http://localhost:6768/mcp"]);
18
126
  var CONFIG_PATH = `/api/plugins/${encodeURIComponent(PLUGIN_ID)}/config`;
@@ -79,15 +187,15 @@ var primaryButtonStyle = { border: "1px solid var(--primary)", borderRadius: 7,
79
187
  var secondaryButtonStyle = { border: "1px solid var(--border)", borderRadius: 7, background: "transparent", color: "var(--foreground)", padding: "8px 12px", cursor: "pointer" };
80
188
  function SupermemorySettingsPage() {
81
189
  const { companyId } = useHostContext();
82
- const [agents, setAgents] = useState([]);
83
- const [secrets, setSecrets] = useState([]);
84
- const [config, setConfig] = useState({ gatewayUrl: DEFAULT_GATEWAY, agentGrants: [] });
85
- const [grantRows, setGrantRows] = useState([]);
86
- const [loading, setLoading] = useState(true);
87
- const [saving, setSaving] = useState(false);
88
- const [error, setError] = useState(null);
89
- const [success, setSuccess] = useState(false);
90
- useEffect(() => {
190
+ const [agents, setAgents] = useState2([]);
191
+ const [secrets, setSecrets] = useState2([]);
192
+ const [config, setConfig] = useState2({ gatewayUrl: DEFAULT_GATEWAY, agentGrants: [] });
193
+ const [grantRows, setGrantRows] = useState2([]);
194
+ const [loading, setLoading] = useState2(true);
195
+ const [saving, setSaving] = useState2(false);
196
+ const [error, setError] = useState2(null);
197
+ const [success, setSuccess] = useState2(false);
198
+ useEffect2(() => {
91
199
  let cancelled = false;
92
200
  if (!companyId) {
93
201
  setLoading(false);
@@ -155,101 +263,124 @@ function SupermemorySettingsPage() {
155
263
  setSaving(false);
156
264
  }
157
265
  }
158
- if (loading) return /* @__PURE__ */ jsx("main", { style: pageStyle, children: /* @__PURE__ */ jsx("p", { children: "Caricamento configurazione\u2026" }) });
159
- return /* @__PURE__ */ jsxs("main", { style: { ...pageStyle, maxWidth: 1e3, display: "grid", gap: 22 }, children: [
160
- /* @__PURE__ */ jsxs("header", { children: [
161
- /* @__PURE__ */ jsx("h1", { style: { fontSize: 25, margin: 0, fontWeight: 650 }, children: "Configurazione Supermemory" }),
162
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, marginTop: 8, maxWidth: 760 }, children: "Scegli gli agenti Paperclip dall\u2019elenco e collega per ciascuno il suo secret ACL. Le chiavi restano nei Secrets Paperclip: non vengono mostrate n\xE9 copiate nei prompt." })
266
+ if (loading) return /* @__PURE__ */ jsx2("main", { style: pageStyle, children: /* @__PURE__ */ jsx2("p", { children: "Caricamento configurazione\u2026" }) });
267
+ return /* @__PURE__ */ jsxs2("main", { style: { ...pageStyle, maxWidth: 1e3, display: "grid", gap: 22 }, children: [
268
+ /* @__PURE__ */ jsxs2("header", { children: [
269
+ /* @__PURE__ */ jsx2("h1", { style: { fontSize: 25, margin: 0, fontWeight: 650 }, children: "Configurazione Supermemory" }),
270
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, marginTop: 8, maxWidth: 760 }, children: "Scegli gli agenti Paperclip dall\u2019elenco e collega per ciascuno il suo secret ACL. Le chiavi restano nei Secrets Paperclip: non vengono mostrate n\xE9 copiate nei prompt." })
163
271
  ] }),
164
- error ? /* @__PURE__ */ jsx("div", { role: "alert", style: { ...panelStyle, padding: 12, borderColor: "var(--destructive, #b91c1c)" }, children: error }) : null,
165
- success ? /* @__PURE__ */ jsx("div", { role: "status", style: { ...panelStyle, padding: 12 }, children: "Configurazione salvata." }) : null,
166
- /* @__PURE__ */ jsxs("form", { onSubmit: save, style: { display: "grid", gap: 18 }, children: [
167
- /* @__PURE__ */ jsxs("section", { style: { ...panelStyle, padding: 18, display: "grid", gap: 14 }, children: [
168
- /* @__PURE__ */ jsx("h2", { style: { margin: 0, fontSize: 17 }, children: "Connessioni self-hosted" }),
169
- /* @__PURE__ */ jsxs("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
272
+ error ? /* @__PURE__ */ jsx2("div", { role: "alert", style: { ...panelStyle, padding: 12, borderColor: "var(--destructive, #b91c1c)" }, children: error }) : null,
273
+ success ? /* @__PURE__ */ jsx2("div", { role: "status", style: { ...panelStyle, padding: 12 }, children: "Configurazione salvata." }) : null,
274
+ /* @__PURE__ */ jsx2(PluginUpgradePanel, { pluginKey: PLUGIN_ID, title: "Supermemory" }),
275
+ /* @__PURE__ */ jsxs2("form", { onSubmit: save, style: { display: "grid", gap: 18 }, children: [
276
+ /* @__PURE__ */ jsxs2("section", { style: { ...panelStyle, padding: 18, display: "grid", gap: 14 }, children: [
277
+ /* @__PURE__ */ jsx2("h2", { style: { margin: 0, fontSize: 17 }, children: "Connessioni self-hosted" }),
278
+ /* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
170
279
  "Gateway ACL Paperclip",
171
- /* @__PURE__ */ jsx("input", { style: inputStyle, value: config.gatewayUrl, onChange: (event) => setConfig((current) => ({ ...current, gatewayUrl: event.target.value })) }),
172
- /* @__PURE__ */ jsx("span", { style: mutedStyle, children: "Default OTOMATIK: HTTPS Tailscale `otomatik.tail77a9ab.ts.net:18443`. L\u2019API Supermemory resta interna al server." })
280
+ /* @__PURE__ */ jsx2("input", { style: inputStyle, value: config.gatewayUrl, onChange: (event) => setConfig((current) => ({ ...current, gatewayUrl: event.target.value })) }),
281
+ /* @__PURE__ */ jsx2("span", { style: mutedStyle, children: "Default OTOMATIK: HTTPS Tailscale `otomatik.tail77a9ab.ts.net:18443`. L\u2019API Supermemory resta interna al server." })
173
282
  ] }),
174
- /* @__PURE__ */ jsxs("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
283
+ /* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
175
284
  "Secret con la chiave master Supermemory Local",
176
- /* @__PURE__ */ jsxs("select", { style: inputStyle, value: config.adminApiKeyRef?.secretId ?? "", onChange: (event) => setConfig((current) => ({
285
+ /* @__PURE__ */ jsxs2("select", { style: inputStyle, value: config.adminApiKeyRef?.secretId ?? "", onChange: (event) => setConfig((current) => ({
177
286
  ...current,
178
287
  ...event.target.value ? { adminApiKeyRef: { type: "secret_ref", secretId: event.target.value } } : { adminApiKeyRef: void 0 }
179
288
  })), children: [
180
- /* @__PURE__ */ jsx("option", { value: "", children: "Non configurato" }),
181
- secrets.map((secret) => /* @__PURE__ */ jsxs("option", { value: secret.id, children: [
289
+ /* @__PURE__ */ jsx2("option", { value: "", children: "Non configurato" }),
290
+ secrets.map((secret) => /* @__PURE__ */ jsxs2("option", { value: secret.id, children: [
182
291
  secret.name,
183
292
  secret.key ? ` \xB7 ${secret.key}` : ""
184
293
  ] }, secret.id))
185
294
  ] }),
186
- /* @__PURE__ */ jsxs("span", { style: mutedStyle, children: [
295
+ /* @__PURE__ */ jsxs2("span", { style: mutedStyle, children: [
187
296
  "Serve per autenticare il gateway nelle azioni Owner della libreria Memory e nelle ricerche di namespace assegnati. Crea o importa il secret da ",
188
- /* @__PURE__ */ jsx("a", { href: "/company/settings/secrets", style: { textDecoration: "underline" }, children: "Secrets" }),
297
+ /* @__PURE__ */ jsx2("a", { href: "/company/settings/secrets", style: { textDecoration: "underline" }, children: "Secrets" }),
189
298
  "."
190
299
  ] })
191
300
  ] }),
192
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, margin: 0, fontSize: 12 }, children: "Il plugin risolve la chiave master solo nelle azioni di gestione autorizzate all\u2019Owner e nelle ricerche di agenti gi\xE0 autorizzati. Non \xE8 esposta agli agenti come valore." })
301
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, margin: 0, fontSize: 12 }, children: "Il plugin risolve la chiave master solo nelle azioni di gestione autorizzate all\u2019Owner e nelle ricerche di agenti gi\xE0 autorizzati. Non \xE8 esposta agli agenti come valore." })
193
302
  ] }),
194
- /* @__PURE__ */ jsxs("section", { style: { ...panelStyle, padding: 18, display: "grid", gap: 14 }, children: [
195
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 12, alignItems: "center", justifyContent: "space-between" }, children: [
196
- /* @__PURE__ */ jsxs("div", { children: [
197
- /* @__PURE__ */ jsx("h2", { style: { margin: 0, fontSize: 17 }, children: "Agenti autorizzati" }),
198
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, margin: "5px 0 0", fontSize: 13 }, children: "Il selettore mostra il nome dell\u2019agente; Paperclip conserva l\u2019ID corretto senza chiederti di copiarlo." })
303
+ /* @__PURE__ */ jsxs2("section", { style: { ...panelStyle, padding: 18, display: "grid", gap: 14 }, children: [
304
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 12, alignItems: "center", justifyContent: "space-between" }, children: [
305
+ /* @__PURE__ */ jsxs2("div", { children: [
306
+ /* @__PURE__ */ jsx2("h2", { style: { margin: 0, fontSize: 17 }, children: "Agenti autorizzati" }),
307
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, margin: "5px 0 0", fontSize: 13 }, children: "Il selettore mostra il nome dell\u2019agente; Paperclip conserva l\u2019ID corretto senza chiederti di copiarlo." })
199
308
  ] }),
200
- /* @__PURE__ */ jsx("button", { type: "button", style: secondaryButtonStyle, onClick: addGrant, children: "\uFF0B Aggiungi agente" })
309
+ /* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: addGrant, children: "\uFF0B Aggiungi agente" })
201
310
  ] }),
202
- grantRows.length === 0 ? /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, margin: 0 }, children: "Nessun agente autorizzato." }) : grantRows.map((row, index) => /* @__PURE__ */ jsxs("div", { style: { ...panelStyle, padding: 14, display: "grid", gridTemplateColumns: "minmax(180px, 1fr) minmax(180px, 1fr) auto", gap: 12, alignItems: "end" }, children: [
203
- /* @__PURE__ */ jsxs("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
311
+ grantRows.length === 0 ? /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, margin: 0 }, children: "Nessun agente autorizzato." }) : grantRows.map((row, index) => /* @__PURE__ */ jsxs2("div", { style: { ...panelStyle, padding: 14, display: "grid", gridTemplateColumns: "minmax(180px, 1fr) minmax(180px, 1fr) auto", gap: 12, alignItems: "end" }, children: [
312
+ /* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
204
313
  "Agente Paperclip",
205
- /* @__PURE__ */ jsxs("select", { style: inputStyle, value: row.agentId, onChange: (event) => updateGrant(index, { agentId: event.target.value }), children: [
206
- /* @__PURE__ */ jsx("option", { value: "", children: "Scegli un agente\u2026" }),
207
- agents.map((agent) => /* @__PURE__ */ jsxs("option", { value: agent.id, children: [
314
+ /* @__PURE__ */ jsxs2("select", { style: inputStyle, value: row.agentId, onChange: (event) => updateGrant(index, { agentId: event.target.value }), children: [
315
+ /* @__PURE__ */ jsx2("option", { value: "", children: "Scegli un agente\u2026" }),
316
+ agents.map((agent) => /* @__PURE__ */ jsxs2("option", { value: agent.id, children: [
208
317
  agent.name,
209
318
  " \xB7 ",
210
319
  agent.role
211
320
  ] }, agent.id))
212
321
  ] })
213
322
  ] }),
214
- /* @__PURE__ */ jsxs("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
323
+ /* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
215
324
  "Secret ACL individuale",
216
- /* @__PURE__ */ jsxs("select", { style: inputStyle, value: row.tokenSecretId, onChange: (event) => updateGrant(index, { tokenSecretId: event.target.value }), children: [
217
- /* @__PURE__ */ jsx("option", { value: "", children: "Scegli un secret\u2026" }),
218
- secrets.map((secret) => /* @__PURE__ */ jsxs("option", { value: secret.id, children: [
325
+ /* @__PURE__ */ jsxs2("select", { style: inputStyle, value: row.tokenSecretId, onChange: (event) => updateGrant(index, { tokenSecretId: event.target.value }), children: [
326
+ /* @__PURE__ */ jsx2("option", { value: "", children: "Scegli un secret\u2026" }),
327
+ secrets.map((secret) => /* @__PURE__ */ jsxs2("option", { value: secret.id, children: [
219
328
  secret.name,
220
329
  secret.key ? ` \xB7 ${secret.key}` : ""
221
330
  ] }, secret.id))
222
331
  ] })
223
332
  ] }),
224
- /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Rimuovi agente", style: secondaryButtonStyle, onClick: () => removeGrant(index), children: "Rimuovi" })
333
+ /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": "Rimuovi agente", style: secondaryButtonStyle, onClick: () => removeGrant(index), children: "Rimuovi" })
225
334
  ] }, row.key)),
226
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, margin: 0, fontSize: 12 }, children: "Il token deve gi\xE0 essere associato sul gateway a questo agente, alla stessa organizzazione Paperclip e al suo ruolo." })
335
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, margin: 0, fontSize: 12 }, children: "Il token deve gi\xE0 essere associato sul gateway a questo agente, alla stessa organizzazione Paperclip e al suo ruolo." })
227
336
  ] }),
228
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", { type: "submit", style: primaryButtonStyle, disabled: saving, children: saving ? "Salvataggio\u2026" : "Salva configurazione" }) })
337
+ /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2("button", { type: "submit", style: primaryButtonStyle, disabled: saving, children: saving ? "Salvataggio\u2026" : "Salva configurazione" }) })
229
338
  ] })
230
339
  ] });
231
340
  }
232
341
  function MemorySidebarLink({ context }) {
233
342
  const navigation = useHostNavigation();
234
343
  if (!context.companyId) return null;
235
- const href = navigation.resolveHref("/memory");
236
- const isActive = typeof window !== "undefined" && window.location.pathname === href;
237
- return /* @__PURE__ */ jsxs(
238
- "a",
239
- {
240
- ...navigation.linkProps("/memory"),
241
- "aria-current": isActive ? "page" : void 0,
242
- className: `flex items-center gap-2.5 mx-2 rounded-lg px-2 py-1.5 pointer-coarse:py-1 text-(length:--text-compact) font-medium transition-colors ${isActive ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}`,
243
- children: [
244
- /* @__PURE__ */ jsx("span", { "data-plugin-sidebar-icon": "true", "aria-hidden": "true", className: "flex h-4 w-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
245
- /* @__PURE__ */ jsx("path", { d: "M9 3.5a3 3 0 0 0-3 3v.4a3 3 0 0 0-2.5 3v1.2a3 3 0 0 0 2.5 3v.4a3 3 0 0 0 3 3h1V3.5H9Z" }),
246
- /* @__PURE__ */ jsx("path", { d: "M15 3.5a3 3 0 0 1 3 3v.4a3 3 0 0 1 2.5 3v1.2a3 3 0 0 1-2.5 3v.4a3 3 0 0 1-3 3h-1V3.5h1Z" }),
247
- /* @__PURE__ */ jsx("path", { d: "M8 8h2m-2 5h2m4-5h2m-2 5h2" })
248
- ] }) }),
249
- /* @__PURE__ */ jsx("span", { "data-plugin-sidebar-label": "true", className: "flex-1 truncate", children: "Memory" })
250
- ]
251
- }
252
- );
344
+ const memoryHref = navigation.resolveHref("/memory");
345
+ const graphHref = navigation.resolveHref("/memory-graph");
346
+ const pathname = typeof window !== "undefined" ? window.location.pathname : "";
347
+ const memoryActive = pathname === memoryHref || pathname === graphHref;
348
+ const graphActive = pathname === graphHref;
349
+ return /* @__PURE__ */ jsxs2("div", { className: "mx-2", children: [
350
+ /* @__PURE__ */ jsxs2(
351
+ "a",
352
+ {
353
+ ...navigation.linkProps("/memory"),
354
+ "aria-current": pathname === memoryHref ? "page" : void 0,
355
+ className: `flex items-center gap-2.5 rounded-lg px-2 py-1.5 pointer-coarse:py-1 text-(length:--text-compact) font-medium transition-colors ${memoryActive ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}`,
356
+ children: [
357
+ /* @__PURE__ */ jsx2("span", { "data-plugin-sidebar-icon": "true", "aria-hidden": "true", className: "flex h-4 w-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxs2("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
358
+ /* @__PURE__ */ jsx2("path", { d: "M9 3.5a3 3 0 0 0-3 3v.4a3 3 0 0 0-2.5 3v1.2a3 3 0 0 0 2.5 3v.4a3 3 0 0 0 3 3h1V3.5H9Z" }),
359
+ /* @__PURE__ */ jsx2("path", { d: "M15 3.5a3 3 0 0 1 3 3v.4a3 3 0 0 1 2.5 3v1.2a3 3 0 0 1-2.5 3v.4a3 3 0 0 1-3 3h-1V3.5h1Z" }),
360
+ /* @__PURE__ */ jsx2("path", { d: "M8 8h2m-2 5h2m4-5h2m-2 5h2" })
361
+ ] }) }),
362
+ /* @__PURE__ */ jsx2("span", { "data-plugin-sidebar-label": "true", className: "flex-1 truncate", children: "Memory" })
363
+ ]
364
+ }
365
+ ),
366
+ /* @__PURE__ */ jsxs2(
367
+ "a",
368
+ {
369
+ ...navigation.linkProps("/memory-graph"),
370
+ "aria-current": graphActive ? "page" : void 0,
371
+ className: `ml-7 flex items-center gap-2 rounded-lg px-2 py-1.5 text-(length:--text-compact) transition-colors ${graphActive ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}`,
372
+ children: [
373
+ /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "flex h-4 w-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxs2("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
374
+ /* @__PURE__ */ jsx2("circle", { cx: "5", cy: "12", r: "2" }),
375
+ /* @__PURE__ */ jsx2("circle", { cx: "18", cy: "5", r: "2" }),
376
+ /* @__PURE__ */ jsx2("circle", { cx: "18", cy: "19", r: "2" }),
377
+ /* @__PURE__ */ jsx2("path", { d: "m7 11 9-5M7 13l9 5" })
378
+ ] }) }),
379
+ /* @__PURE__ */ jsx2("span", { className: "flex-1 truncate", children: "Grafo" })
380
+ ]
381
+ }
382
+ )
383
+ ] });
253
384
  }
254
385
  function readAsBase64(file) {
255
386
  return new Promise((resolve, reject) => {
@@ -277,25 +408,25 @@ function MemoryPage() {
277
408
  const deleteDocument = usePluginAction("memory-document-delete");
278
409
  const navigation = useHostNavigation();
279
410
  const pageRef = useRef(null);
280
- const [pageHeight, setPageHeight] = useState(null);
281
- const [catalog, setCatalog] = useState(null);
282
- const [loading, setLoading] = useState(true);
283
- const [error, setError] = useState(null);
284
- const [busy, setBusy] = useState(false);
285
- const [activeAssignmentId, setActiveAssignmentId] = useState("");
286
- const [activeDocumentKey, setActiveDocumentKey] = useState("");
287
- const [document, setDocument] = useState(null);
288
- const [title, setTitle] = useState("");
289
- const [content, setContent] = useState("");
290
- const [mode, setMode] = useState("read");
291
- const [dirty, setDirty] = useState(false);
292
- const [scopeType, setScopeType] = useState("project");
293
- const [scopeId, setScopeId] = useState("");
294
- const [allowedAgentIds, setAllowedAgentIds] = useState([]);
295
- const [editingAssignmentId, setEditingAssignmentId] = useState("");
296
- const [showAssignment, setShowAssignment] = useState(false);
297
- const [showUrlForm, setShowUrlForm] = useState(false);
298
- const [urlInput, setUrlInput] = useState("");
411
+ const [pageHeight, setPageHeight] = useState2(null);
412
+ const [catalog, setCatalog] = useState2(null);
413
+ const [loading, setLoading] = useState2(true);
414
+ const [error, setError] = useState2(null);
415
+ const [busy, setBusy] = useState2(false);
416
+ const [activeAssignmentId, setActiveAssignmentId] = useState2("");
417
+ const [activeDocumentKey, setActiveDocumentKey] = useState2("");
418
+ const [document, setDocument] = useState2(null);
419
+ const [title, setTitle] = useState2("");
420
+ const [content, setContent] = useState2("");
421
+ const [mode, setMode] = useState2("read");
422
+ const [dirty, setDirty] = useState2(false);
423
+ const [scopeType, setScopeType] = useState2("project");
424
+ const [scopeId, setScopeId] = useState2("");
425
+ const [allowedAgentIds, setAllowedAgentIds] = useState2([]);
426
+ const [editingAssignmentId, setEditingAssignmentId] = useState2("");
427
+ const [showAssignment, setShowAssignment] = useState2(false);
428
+ const [showUrlForm, setShowUrlForm] = useState2(false);
429
+ const [urlInput, setUrlInput] = useState2("");
299
430
  useLayoutEffect(() => {
300
431
  const measure = () => {
301
432
  const page = pageRef.current;
@@ -327,7 +458,7 @@ function MemoryPage() {
327
458
  return data.assignments.some((assignment) => assignment.id === next) ? next : data.assignments[0]?.id ?? "";
328
459
  });
329
460
  }, [companyId, loadCatalog]);
330
- useEffect(() => {
461
+ useEffect2(() => {
331
462
  let cancelled = false;
332
463
  if (!companyId) {
333
464
  setLoading(false);
@@ -355,7 +486,7 @@ function MemoryPage() {
355
486
  const editingAssignment = catalog?.assignments.find((assignment) => assignment.id === editingAssignmentId) ?? null;
356
487
  const visibleDocuments = (catalog?.documents ?? []).filter((item) => item.assignmentId === activeAssignmentId);
357
488
  const selectedDocumentSummary = visibleDocuments.find((item) => `${item.assignmentId}:${item.id}` === activeDocumentKey) ?? null;
358
- useEffect(() => {
489
+ useEffect2(() => {
359
490
  let cancelled = false;
360
491
  if (activeDocumentKey === "draft") return;
361
492
  if (!companyId || !selectedDocumentSummary) {
@@ -588,23 +719,23 @@ function MemoryPage() {
588
719
  }
589
720
  }
590
721
  const namespacePreview = editingAssignment?.namespace ?? (companyId && scopeId ? `paperclip_${companyId}_${scopeType}_${scopeId}` : "Il namespace verr\xE0 generato con ID organizzazione + target");
591
- if (loading) return /* @__PURE__ */ jsx("main", { style: pageStyle, children: /* @__PURE__ */ jsx("p", { children: "Caricamento Memory\u2026" }) });
592
- if (error && !catalog) return /* @__PURE__ */ jsxs("main", { style: { ...pageStyle, maxWidth: 760 }, children: [
593
- /* @__PURE__ */ jsx("h1", { style: { fontSize: 24 }, children: "Memory" }),
594
- /* @__PURE__ */ jsxs("div", { role: "alert", style: { ...panelStyle, padding: 18, display: "grid", gap: 10 }, children: [
595
- /* @__PURE__ */ jsx("strong", { children: "Accesso riservato all\u2019Owner dell\u2019organizzazione." }),
596
- /* @__PURE__ */ jsx("span", { style: mutedStyle, children: error }),
597
- /* @__PURE__ */ jsx("span", { style: mutedStyle, children: "I documenti e le assegnazioni non sono visibili agli altri membri dell\u2019organizzazione." })
722
+ if (loading) return /* @__PURE__ */ jsx2("main", { style: pageStyle, children: /* @__PURE__ */ jsx2("p", { children: "Caricamento Memory\u2026" }) });
723
+ if (error && !catalog) return /* @__PURE__ */ jsxs2("main", { style: { ...pageStyle, maxWidth: 760 }, children: [
724
+ /* @__PURE__ */ jsx2("h1", { style: { fontSize: 24 }, children: "Memory" }),
725
+ /* @__PURE__ */ jsxs2("div", { role: "alert", style: { ...panelStyle, padding: 18, display: "grid", gap: 10 }, children: [
726
+ /* @__PURE__ */ jsx2("strong", { children: "Accesso riservato all\u2019Owner dell\u2019organizzazione." }),
727
+ /* @__PURE__ */ jsx2("span", { style: mutedStyle, children: error }),
728
+ /* @__PURE__ */ jsx2("span", { style: mutedStyle, children: "I documenti e le assegnazioni non sono visibili agli altri membri dell\u2019organizzazione." })
598
729
  ] })
599
730
  ] });
600
- return /* @__PURE__ */ jsxs("main", { ref: pageRef, style: { ...pageStyle, boxSizing: "border-box", height: pageHeight ?? "calc(100vh - 160px)", minHeight: 0, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
601
- /* @__PURE__ */ jsxs("header", { style: { display: "flex", alignItems: "start", justifyContent: "space-between", gap: 16, marginBottom: 20, flexShrink: 0 }, children: [
602
- /* @__PURE__ */ jsxs("div", { children: [
603
- /* @__PURE__ */ jsx("h1", { style: { fontSize: 26, fontWeight: 650, margin: 0 }, children: "Memory" }),
604
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, margin: "6px 0 0", maxWidth: 760 }, children: "Gestisci namespace e contenuti Supermemory per questa organizzazione. Questa libreria \xE8 visibile solo agli Owner." })
731
+ return /* @__PURE__ */ jsxs2("main", { ref: pageRef, style: { ...pageStyle, boxSizing: "border-box", height: pageHeight ?? "calc(100vh - 160px)", minHeight: 0, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
732
+ /* @__PURE__ */ jsxs2("header", { style: { display: "flex", alignItems: "start", justifyContent: "space-between", gap: 16, marginBottom: 20, flexShrink: 0 }, children: [
733
+ /* @__PURE__ */ jsxs2("div", { children: [
734
+ /* @__PURE__ */ jsx2("h1", { style: { fontSize: 26, fontWeight: 650, margin: 0 }, children: "Memory" }),
735
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, margin: "6px 0 0", maxWidth: 760 }, children: "Gestisci namespace e contenuti Supermemory per questa organizzazione. Questa libreria \xE8 visibile solo agli Owner." })
605
736
  ] }),
606
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8, flexWrap: "wrap", justifyContent: "end" }, children: [
607
- /* @__PURE__ */ jsx("button", { type: "button", style: secondaryButtonStyle, onClick: () => {
737
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8, flexWrap: "wrap", justifyContent: "end" }, children: [
738
+ /* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: () => {
608
739
  if (showAssignment && !editingAssignmentId) {
609
740
  setShowAssignment(false);
610
741
  return;
@@ -615,146 +746,146 @@ function MemoryPage() {
615
746
  setAllowedAgentIds([]);
616
747
  setShowAssignment(true);
617
748
  }, children: "\uFF0B Assegna namespace" }),
618
- /* @__PURE__ */ jsx("a", { ...navigation.linkProps("/company/settings/instance/plugins/paperclipai.supermemory"), style: { ...secondaryButtonStyle, textDecoration: "none" }, children: "Configurazione" })
749
+ /* @__PURE__ */ jsx2("a", { ...navigation.linkProps("/company/settings/instance/plugins/paperclipai.supermemory"), style: { ...secondaryButtonStyle, textDecoration: "none" }, children: "Configurazione" })
619
750
  ] })
620
751
  ] }),
621
- error ? /* @__PURE__ */ jsx("div", { role: "alert", style: { ...panelStyle, padding: 12, marginBottom: 16, borderColor: "var(--destructive, #b91c1c)", flexShrink: 0 }, children: error }) : null,
622
- !catalog?.configured ? /* @__PURE__ */ jsxs("div", { style: { ...panelStyle, padding: 14, marginBottom: 16, flexShrink: 0 }, children: [
623
- /* @__PURE__ */ jsx("strong", { children: "Chiave master non configurata." }),
624
- /* @__PURE__ */ jsx("span", { style: { ...mutedStyle, marginLeft: 6 }, children: "Le assegnazioni saranno salvate, ma l\u2019indicizzazione e la ricerca nei namespace restano disattivate finch\xE9 non selezioni il secret Supermemory Local nella configurazione del plugin." })
752
+ error ? /* @__PURE__ */ jsx2("div", { role: "alert", style: { ...panelStyle, padding: 12, marginBottom: 16, borderColor: "var(--destructive, #b91c1c)", flexShrink: 0 }, children: error }) : null,
753
+ !catalog?.configured ? /* @__PURE__ */ jsxs2("div", { style: { ...panelStyle, padding: 14, marginBottom: 16, flexShrink: 0 }, children: [
754
+ /* @__PURE__ */ jsx2("strong", { children: "Chiave master non configurata." }),
755
+ /* @__PURE__ */ jsx2("span", { style: { ...mutedStyle, marginLeft: 6 }, children: "Le assegnazioni saranno salvate, ma l\u2019indicizzazione e la ricerca nei namespace restano disattivate finch\xE9 non selezioni il secret Supermemory Local nella configurazione del plugin." })
625
756
  ] }) : null,
626
- showAssignment ? /* @__PURE__ */ jsxs("form", { onSubmit: saveAssignmentForm, style: { ...panelStyle, padding: 18, display: "grid", gap: 13, marginBottom: 18, maxHeight: "min(38vh, 340px)", overflowY: "auto", flexShrink: 0 }, children: [
627
- /* @__PURE__ */ jsx("h2", { style: { fontSize: 17, margin: 0 }, children: editingAssignmentId ? "Modifica assegnazione del namespace" : "Assegna un namespace" }),
628
- /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "minmax(160px, 220px) minmax(220px, 1fr)", gap: 12 }, children: [
629
- /* @__PURE__ */ jsxs("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
757
+ showAssignment ? /* @__PURE__ */ jsxs2("form", { onSubmit: saveAssignmentForm, style: { ...panelStyle, padding: 18, display: "grid", gap: 13, marginBottom: 18, maxHeight: "min(38vh, 340px)", overflowY: "auto", flexShrink: 0 }, children: [
758
+ /* @__PURE__ */ jsx2("h2", { style: { fontSize: 17, margin: 0 }, children: editingAssignmentId ? "Modifica assegnazione del namespace" : "Assegna un namespace" }),
759
+ /* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "minmax(160px, 220px) minmax(220px, 1fr)", gap: 12 }, children: [
760
+ /* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
630
761
  "Ambito",
631
- /* @__PURE__ */ jsxs("select", { style: inputStyle, value: scopeType, onChange: (event) => {
762
+ /* @__PURE__ */ jsxs2("select", { style: inputStyle, value: scopeType, onChange: (event) => {
632
763
  setScopeType(event.target.value);
633
764
  setScopeId("");
634
765
  setAllowedAgentIds([]);
635
766
  }, children: [
636
- /* @__PURE__ */ jsx("option", { value: "project", children: "Progetto" }),
637
- /* @__PURE__ */ jsx("option", { value: "agent", children: "Agente" })
767
+ /* @__PURE__ */ jsx2("option", { value: "project", children: "Progetto" }),
768
+ /* @__PURE__ */ jsx2("option", { value: "agent", children: "Agente" })
638
769
  ] })
639
770
  ] }),
640
- /* @__PURE__ */ jsxs("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
771
+ /* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
641
772
  scopeType === "project" ? "Progetto Paperclip" : "Agente Paperclip",
642
- /* @__PURE__ */ jsxs("select", { style: inputStyle, value: scopeId, onChange: (event) => setScopeId(event.target.value), children: [
643
- /* @__PURE__ */ jsx("option", { value: "", children: "Scegli\u2026" }),
644
- (scopeType === "project" ? catalog?.projects ?? [] : catalog?.agents ?? []).map((item) => /* @__PURE__ */ jsx("option", { value: item.id, children: item.name }, item.id))
773
+ /* @__PURE__ */ jsxs2("select", { style: inputStyle, value: scopeId, onChange: (event) => setScopeId(event.target.value), children: [
774
+ /* @__PURE__ */ jsx2("option", { value: "", children: "Scegli\u2026" }),
775
+ (scopeType === "project" ? catalog?.projects ?? [] : catalog?.agents ?? []).map((item) => /* @__PURE__ */ jsx2("option", { value: item.id, children: item.name }, item.id))
645
776
  ] })
646
777
  ] })
647
778
  ] }),
648
- scopeType === "project" ? /* @__PURE__ */ jsxs("fieldset", { style: { border: "1px solid var(--border)", borderRadius: 8, padding: 12 }, children: [
649
- /* @__PURE__ */ jsx("legend", { style: { fontSize: 13, padding: "0 5px" }, children: "Agenti autorizzati a leggere questo namespace" }),
650
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, fontSize: 12, margin: "0 0 8px" }, children: "Elenco esplicito usato dal plugin insieme al projectId del run. Seleziona solo agenti autorizzati sul progetto in Paperclip." }),
651
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 8 }, children: (catalog?.agents ?? []).map((agent) => /* @__PURE__ */ jsxs("label", { style: { display: "inline-flex", alignItems: "center", gap: 6, border: "1px solid var(--border)", borderRadius: 999, padding: "5px 9px", fontSize: 12 }, children: [
652
- /* @__PURE__ */ jsx("input", { type: "checkbox", checked: allowedAgentIds.includes(agent.id), onChange: (event) => setAllowedAgentIds((current) => event.target.checked ? [...current, agent.id] : current.filter((id) => id !== agent.id)) }),
779
+ scopeType === "project" ? /* @__PURE__ */ jsxs2("fieldset", { style: { border: "1px solid var(--border)", borderRadius: 8, padding: 12 }, children: [
780
+ /* @__PURE__ */ jsx2("legend", { style: { fontSize: 13, padding: "0 5px" }, children: "Agenti autorizzati a leggere questo namespace" }),
781
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, fontSize: 12, margin: "0 0 8px" }, children: "Elenco esplicito usato dal plugin insieme al projectId del run. Seleziona solo agenti autorizzati sul progetto in Paperclip." }),
782
+ /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexWrap: "wrap", gap: 8 }, children: (catalog?.agents ?? []).map((agent) => /* @__PURE__ */ jsxs2("label", { style: { display: "inline-flex", alignItems: "center", gap: 6, border: "1px solid var(--border)", borderRadius: 999, padding: "5px 9px", fontSize: 12 }, children: [
783
+ /* @__PURE__ */ jsx2("input", { type: "checkbox", checked: allowedAgentIds.includes(agent.id), onChange: (event) => setAllowedAgentIds((current) => event.target.checked ? [...current, agent.id] : current.filter((id) => id !== agent.id)) }),
653
784
  agent.name
654
785
  ] }, agent.id)) })
655
786
  ] }) : null,
656
- /* @__PURE__ */ jsxs("div", { style: { ...mutedStyle, fontSize: 12 }, children: [
787
+ /* @__PURE__ */ jsxs2("div", { style: { ...mutedStyle, fontSize: 12 }, children: [
657
788
  editingAssignmentId ? "Il namespace fisico e i documenti non cambiano. Cambiano il progetto/agente associato e la allowlist di accesso." : "Namespace isolato per questa organizzazione: Supermemory lo crea al primo contenuto.",
658
789
  " ",
659
- /* @__PURE__ */ jsx("code", { style: { overflowWrap: "anywhere" }, children: namespacePreview })
790
+ /* @__PURE__ */ jsx2("code", { style: { overflowWrap: "anywhere" }, children: namespacePreview })
660
791
  ] }),
661
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8 }, children: [
662
- /* @__PURE__ */ jsx("button", { style: primaryButtonStyle, disabled: busy, children: busy ? "Salvataggio\u2026" : editingAssignmentId ? "Salva modifiche" : "Salva assegnazione" }),
663
- /* @__PURE__ */ jsx("button", { type: "button", style: secondaryButtonStyle, onClick: () => {
792
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8 }, children: [
793
+ /* @__PURE__ */ jsx2("button", { style: primaryButtonStyle, disabled: busy, children: busy ? "Salvataggio\u2026" : editingAssignmentId ? "Salva modifiche" : "Salva assegnazione" }),
794
+ /* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: () => {
664
795
  setShowAssignment(false);
665
796
  setEditingAssignmentId("");
666
797
  }, children: "Annulla" })
667
798
  ] })
668
799
  ] }) : null,
669
- /* @__PURE__ */ jsxs("section", { style: { display: "grid", gridTemplateColumns: "minmax(230px, 285px) minmax(0, 1fr)", gap: 18, flex: 1, minHeight: 0, overflow: "hidden" }, children: [
670
- /* @__PURE__ */ jsxs("aside", { style: { ...panelStyle, padding: 14, display: "flex", flexDirection: "column", minWidth: 0, minHeight: 0, overflow: "hidden" }, children: [
671
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 10 }, children: [
672
- /* @__PURE__ */ jsx("h2", { style: { fontSize: 15, margin: 0 }, children: "Namespace e file" }),
673
- /* @__PURE__ */ jsx("span", { style: { ...mutedStyle, fontSize: 12 }, children: catalog?.assignments.length ?? 0 })
800
+ /* @__PURE__ */ jsxs2("section", { style: { display: "grid", gridTemplateColumns: "minmax(230px, 285px) minmax(0, 1fr)", gap: 18, flex: 1, minHeight: 0, overflow: "hidden" }, children: [
801
+ /* @__PURE__ */ jsxs2("aside", { style: { ...panelStyle, padding: 14, display: "flex", flexDirection: "column", minWidth: 0, minHeight: 0, overflow: "hidden" }, children: [
802
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 10 }, children: [
803
+ /* @__PURE__ */ jsx2("h2", { style: { fontSize: 15, margin: 0 }, children: "Namespace e file" }),
804
+ /* @__PURE__ */ jsx2("span", { style: { ...mutedStyle, fontSize: 12 }, children: catalog?.assignments.length ?? 0 })
674
805
  ] }),
675
- !catalog?.assignments.length ? /* @__PURE__ */ jsx("div", { style: { ...mutedStyle, fontSize: 13, padding: "12px 2px" }, children: "Nessun namespace. Usa \u201CAssegna namespace\u201D per iniziare." }) : null,
676
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 12, flex: 1, minHeight: 0, overflowY: "auto" }, children: (catalog?.assignments ?? []).map((assignment) => {
806
+ !catalog?.assignments.length ? /* @__PURE__ */ jsx2("div", { style: { ...mutedStyle, fontSize: 13, padding: "12px 2px" }, children: "Nessun namespace. Usa \u201CAssegna namespace\u201D per iniziare." }) : null,
807
+ /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", gap: 12, flex: 1, minHeight: 0, overflowY: "auto" }, children: (catalog?.assignments ?? []).map((assignment) => {
677
808
  const docs = catalog?.documents.filter((item) => item.assignmentId === assignment.id) ?? [];
678
809
  const selected = assignment.id === activeAssignmentId;
679
- return /* @__PURE__ */ jsxs("div", { style: { border: `1px solid ${selected ? "var(--ring, var(--primary))" : "var(--border)"}`, borderRadius: 8, overflow: "hidden" }, children: [
680
- /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
810
+ return /* @__PURE__ */ jsxs2("div", { style: { border: `1px solid ${selected ? "var(--ring, var(--primary))" : "var(--border)"}`, borderRadius: 8, overflow: "hidden" }, children: [
811
+ /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => {
681
812
  setActiveAssignmentId(assignment.id);
682
813
  setActiveDocumentKey("");
683
814
  setDocument(null);
684
815
  }, style: { width: "100%", textAlign: "left", background: selected ? "var(--accent, rgba(127,127,127,.12))" : "transparent", border: 0, color: "var(--foreground)", padding: 11, cursor: "pointer" }, children: [
685
- /* @__PURE__ */ jsx("strong", { style: { display: "block", fontSize: 13 }, children: assignment.label }),
686
- /* @__PURE__ */ jsxs("span", { style: { ...mutedStyle, display: "block", fontSize: 11, marginTop: 3 }, children: [
816
+ /* @__PURE__ */ jsx2("strong", { style: { display: "block", fontSize: 13 }, children: assignment.label }),
817
+ /* @__PURE__ */ jsxs2("span", { style: { ...mutedStyle, display: "block", fontSize: 11, marginTop: 3 }, children: [
687
818
  assignment.scopeType === "project" ? "Progetto" : "Agente",
688
819
  " \xB7 ",
689
820
  assignment.authorizedAgentIds.length,
690
821
  " agenti"
691
822
  ] })
692
823
  ] }),
693
- selected ? /* @__PURE__ */ jsxs("div", { style: { borderTop: "1px solid var(--border)", padding: 8, display: "grid", gap: 3 }, children: [
694
- docs.map((item) => /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveDocumentKey(`${item.assignmentId}:${item.id}`), style: { display: "flex", gap: 7, alignItems: "center", border: 0, borderRadius: 5, padding: "7px 5px", textAlign: "left", background: activeDocumentKey === `${item.assignmentId}:${item.id}` ? "var(--accent, rgba(127,127,127,.12))" : "transparent", color: "var(--foreground)", cursor: "pointer", minWidth: 0 }, children: [
695
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: item.kind === "url" ? "\u2197" : item.kind === "file" ? "\u25A7" : "\u25A4" }),
696
- /* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1, fontSize: 12 }, children: item.title })
824
+ selected ? /* @__PURE__ */ jsxs2("div", { style: { borderTop: "1px solid var(--border)", padding: 8, display: "grid", gap: 3 }, children: [
825
+ docs.map((item) => /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => setActiveDocumentKey(`${item.assignmentId}:${item.id}`), style: { display: "flex", gap: 7, alignItems: "center", border: 0, borderRadius: 5, padding: "7px 5px", textAlign: "left", background: activeDocumentKey === `${item.assignmentId}:${item.id}` ? "var(--accent, rgba(127,127,127,.12))" : "transparent", color: "var(--foreground)", cursor: "pointer", minWidth: 0 }, children: [
826
+ /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", children: item.kind === "url" ? "\u2197" : item.kind === "file" ? "\u25A7" : "\u25A4" }),
827
+ /* @__PURE__ */ jsx2("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1, fontSize: 12 }, children: item.title })
697
828
  ] }, `${item.assignmentId}:${item.id}`)),
698
- !docs.length ? /* @__PURE__ */ jsx("span", { style: { ...mutedStyle, fontSize: 11, padding: "4px 5px" }, children: "Nessun contenuto" }) : null,
699
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => editAssignment(assignment), style: { ...secondaryButtonStyle, padding: "5px 7px", fontSize: 11, marginTop: 5 }, children: "Modifica assegnazione" }),
700
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void removeAssignment(assignment), style: { ...secondaryButtonStyle, padding: "5px 7px", fontSize: 11, marginTop: 5 }, children: "Disattiva assegnazione" })
829
+ !docs.length ? /* @__PURE__ */ jsx2("span", { style: { ...mutedStyle, fontSize: 11, padding: "4px 5px" }, children: "Nessun contenuto" }) : null,
830
+ /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => editAssignment(assignment), style: { ...secondaryButtonStyle, padding: "5px 7px", fontSize: 11, marginTop: 5 }, children: "Modifica assegnazione" }),
831
+ /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => void removeAssignment(assignment), style: { ...secondaryButtonStyle, padding: "5px 7px", fontSize: 11, marginTop: 5 }, children: "Disattiva assegnazione" })
701
832
  ] }) : null
702
833
  ] }, assignment.id);
703
834
  }) }),
704
- activeAssignment ? /* @__PURE__ */ jsxs("div", { style: { borderTop: "1px solid var(--border)", paddingTop: 12, marginTop: "auto", display: "grid", gap: 7 }, children: [
705
- /* @__PURE__ */ jsx("button", { type: "button", style: secondaryButtonStyle, onClick: startTextDocument, disabled: busy, children: "\uFF0B Nuovo testo" }),
706
- /* @__PURE__ */ jsx("button", { type: "button", style: secondaryButtonStyle, onClick: () => setShowUrlForm((current) => !current), disabled: busy, children: "\uFF0B Aggiungi URL" }),
707
- /* @__PURE__ */ jsxs("label", { style: { ...secondaryButtonStyle, textAlign: "center", cursor: busy ? "wait" : "pointer" }, children: [
835
+ activeAssignment ? /* @__PURE__ */ jsxs2("div", { style: { borderTop: "1px solid var(--border)", paddingTop: 12, marginTop: "auto", display: "grid", gap: 7 }, children: [
836
+ /* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: startTextDocument, disabled: busy, children: "\uFF0B Nuovo testo" }),
837
+ /* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: () => setShowUrlForm((current) => !current), disabled: busy, children: "\uFF0B Aggiungi URL" }),
838
+ /* @__PURE__ */ jsxs2("label", { style: { ...secondaryButtonStyle, textAlign: "center", cursor: busy ? "wait" : "pointer" }, children: [
708
839
  "\uFF0B Carica file",
709
- /* @__PURE__ */ jsx("input", { type: "file", hidden: true, disabled: busy, accept: ".pdf,.png,.jpg,.jpeg,.gif,.webp,.txt,.md,.markdown,.html,.htm,.json,.csv", onChange: onFilesChange })
840
+ /* @__PURE__ */ jsx2("input", { type: "file", hidden: true, disabled: busy, accept: ".pdf,.png,.jpg,.jpeg,.gif,.webp,.txt,.md,.markdown,.html,.htm,.json,.csv", onChange: onFilesChange })
710
841
  ] })
711
842
  ] }) : null
712
843
  ] }),
713
- /* @__PURE__ */ jsxs("section", { style: { ...panelStyle, minWidth: 0, minHeight: 0, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
714
- /* @__PURE__ */ jsxs("div", { onDragOver: (event) => event.preventDefault(), onDrop, style: { padding: 16, borderBottom: "1px solid var(--border)", display: "flex", justifyContent: "space-between", alignItems: "start", gap: 14, flexWrap: "wrap" }, children: [
715
- /* @__PURE__ */ jsxs("div", { style: { minWidth: 0, flex: "1 1 280px" }, children: [
716
- /* @__PURE__ */ jsx("h2", { style: { fontSize: 16, margin: 0 }, children: activeAssignment?.label ?? "Seleziona un namespace" }),
717
- activeAssignment ? /* @__PURE__ */ jsx("code", { style: { display: "block", marginTop: 5, fontSize: 11, color: "var(--muted-foreground)", overflowWrap: "anywhere" }, children: activeAssignment.namespace }) : null
844
+ /* @__PURE__ */ jsxs2("section", { style: { ...panelStyle, minWidth: 0, minHeight: 0, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
845
+ /* @__PURE__ */ jsxs2("div", { onDragOver: (event) => event.preventDefault(), onDrop, style: { padding: 16, borderBottom: "1px solid var(--border)", display: "flex", justifyContent: "space-between", alignItems: "start", gap: 14, flexWrap: "wrap" }, children: [
846
+ /* @__PURE__ */ jsxs2("div", { style: { minWidth: 0, flex: "1 1 280px" }, children: [
847
+ /* @__PURE__ */ jsx2("h2", { style: { fontSize: 16, margin: 0 }, children: activeAssignment?.label ?? "Seleziona un namespace" }),
848
+ activeAssignment ? /* @__PURE__ */ jsx2("code", { style: { display: "block", marginTop: 5, fontSize: 11, color: "var(--muted-foreground)", overflowWrap: "anywhere" }, children: activeAssignment.namespace }) : null
718
849
  ] }),
719
- document ? /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: 4, border: "1px solid var(--border)", borderRadius: 7, padding: 3 }, children: ["read", "edit", "raw"].map((tab) => /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setMode(tab), style: { border: 0, borderRadius: 5, padding: "6px 10px", background: mode === tab ? "var(--accent, rgba(127,127,127,.18))" : "transparent", color: "var(--foreground)", cursor: "pointer", fontSize: 12 }, children: tab === "read" ? "Leggi" : tab === "edit" ? "Modifica" : "Raw" }, tab)) }) : null
850
+ document ? /* @__PURE__ */ jsx2("div", { style: { display: "flex", alignItems: "center", gap: 4, border: "1px solid var(--border)", borderRadius: 7, padding: 3 }, children: ["read", "edit", "raw"].map((tab) => /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setMode(tab), style: { border: 0, borderRadius: 5, padding: "6px 10px", background: mode === tab ? "var(--accent, rgba(127,127,127,.18))" : "transparent", color: "var(--foreground)", cursor: "pointer", fontSize: 12 }, children: tab === "read" ? "Leggi" : tab === "edit" ? "Modifica" : "Raw" }, tab)) }) : null
720
851
  ] }),
721
- showUrlForm && activeAssignment ? /* @__PURE__ */ jsxs("form", { onSubmit: addUrl, style: { margin: 14, padding: 14, display: "grid", gap: 9, border: "1px solid var(--border)", borderRadius: 8 }, children: [
722
- /* @__PURE__ */ jsx("strong", { style: { fontSize: 13 }, children: "Aggiungi pagina web" }),
723
- /* @__PURE__ */ jsx("input", { style: inputStyle, type: "url", required: true, placeholder: "https://example.com/documentazione", value: urlInput, onChange: (event) => setUrlInput(event.target.value) }),
724
- /* @__PURE__ */ jsx("span", { style: { ...mutedStyle, fontSize: 12 }, children: "L\u2019URL viene passato a Supermemory Local. L\u2019estrazione web richiede Firecrawl configurato e invia la pagina al servizio Firecrawl." }),
725
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8 }, children: [
726
- /* @__PURE__ */ jsx("button", { style: primaryButtonStyle, disabled: busy, children: "Indicizza URL" }),
727
- /* @__PURE__ */ jsx("button", { type: "button", style: secondaryButtonStyle, onClick: () => setShowUrlForm(false), children: "Annulla" })
852
+ showUrlForm && activeAssignment ? /* @__PURE__ */ jsxs2("form", { onSubmit: addUrl, style: { margin: 14, padding: 14, display: "grid", gap: 9, border: "1px solid var(--border)", borderRadius: 8 }, children: [
853
+ /* @__PURE__ */ jsx2("strong", { style: { fontSize: 13 }, children: "Aggiungi pagina web" }),
854
+ /* @__PURE__ */ jsx2("input", { style: inputStyle, type: "url", required: true, placeholder: "https://example.com/documentazione", value: urlInput, onChange: (event) => setUrlInput(event.target.value) }),
855
+ /* @__PURE__ */ jsx2("span", { style: { ...mutedStyle, fontSize: 12 }, children: "L\u2019URL viene passato a Supermemory Local. L\u2019estrazione web richiede Firecrawl configurato e invia la pagina al servizio Firecrawl." }),
856
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8 }, children: [
857
+ /* @__PURE__ */ jsx2("button", { style: primaryButtonStyle, disabled: busy, children: "Indicizza URL" }),
858
+ /* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: () => setShowUrlForm(false), children: "Annulla" })
728
859
  ] })
729
860
  ] }) : null,
730
- !activeAssignment ? /* @__PURE__ */ jsx("div", { style: { flex: 1, display: "grid", placeItems: "center", minHeight: 420, padding: 28 }, children: /* @__PURE__ */ jsxs("div", { style: { width: "min(100%, 600px)", border: "1px dashed var(--border)", borderRadius: 12, padding: 28, textAlign: "center" }, children: [
731
- /* @__PURE__ */ jsx("strong", { children: "Prima assegna un namespace" }),
732
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, fontSize: 13, lineHeight: 1.55 }, children: "Non c\u2019\xE8 uno spazio di memoria attivo in questa organizzazione. Assegna un progetto o un agente; poi selezionalo e carica il PDF." }),
733
- /* @__PURE__ */ jsx("button", { type: "button", style: primaryButtonStyle, onClick: () => setShowAssignment(true), children: "\uFF0B Assegna namespace" })
734
- ] }) }) : !document ? /* @__PURE__ */ jsx("div", { onDragOver: (event) => event.preventDefault(), onDrop, style: { flex: 1, display: "grid", placeItems: "center", minHeight: 420, padding: 28 }, children: /* @__PURE__ */ jsxs("div", { style: { width: "min(100%, 600px)", border: "1px dashed var(--border)", borderRadius: 12, padding: 28, textAlign: "center" }, children: [
735
- /* @__PURE__ */ jsx("div", { style: { fontSize: 28, marginBottom: 10 }, children: "\u21E7" }),
736
- /* @__PURE__ */ jsx("strong", { children: "Trascina qui un file" }),
737
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, fontSize: 13, lineHeight: 1.55 }, children: "Testo: TXT, Markdown, HTML, JSON e CSV (max 1 MB). File binari verificati per Supermemory Local: PDF, PNG, JPG/JPEG, GIF e WebP (max 6 MiB in questa interfaccia). Puoi anche aggiungere un URL pubblico." }),
738
- /* @__PURE__ */ jsx("span", { style: { ...mutedStyle, fontSize: 12 }, children: "Office, audio e video sono supportati da alcune versioni del servizio hosted, ma non sono documentati per il server Local installato." })
739
- ] }) }) : /* @__PURE__ */ jsxs("div", { style: { flex: 1, minHeight: 0, padding: 18, display: "flex", flexDirection: "column", gap: 14, overflow: "hidden" }, children: [
740
- /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto", gap: 12, alignItems: "end", flexShrink: 0 }, children: [
741
- /* @__PURE__ */ jsxs("label", { style: { display: "grid", gap: 6, fontSize: 12 }, children: [
861
+ !activeAssignment ? /* @__PURE__ */ jsx2("div", { style: { flex: 1, display: "grid", placeItems: "center", minHeight: 420, padding: 28 }, children: /* @__PURE__ */ jsxs2("div", { style: { width: "min(100%, 600px)", border: "1px dashed var(--border)", borderRadius: 12, padding: 28, textAlign: "center" }, children: [
862
+ /* @__PURE__ */ jsx2("strong", { children: "Prima assegna un namespace" }),
863
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, fontSize: 13, lineHeight: 1.55 }, children: "Non c\u2019\xE8 uno spazio di memoria attivo in questa organizzazione. Assegna un progetto o un agente; poi selezionalo e carica il PDF." }),
864
+ /* @__PURE__ */ jsx2("button", { type: "button", style: primaryButtonStyle, onClick: () => setShowAssignment(true), children: "\uFF0B Assegna namespace" })
865
+ ] }) }) : !document ? /* @__PURE__ */ jsx2("div", { onDragOver: (event) => event.preventDefault(), onDrop, style: { flex: 1, display: "grid", placeItems: "center", minHeight: 420, padding: 28 }, children: /* @__PURE__ */ jsxs2("div", { style: { width: "min(100%, 600px)", border: "1px dashed var(--border)", borderRadius: 12, padding: 28, textAlign: "center" }, children: [
866
+ /* @__PURE__ */ jsx2("div", { style: { fontSize: 28, marginBottom: 10 }, children: "\u21E7" }),
867
+ /* @__PURE__ */ jsx2("strong", { children: "Trascina qui un file" }),
868
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, fontSize: 13, lineHeight: 1.55 }, children: "Testo: TXT, Markdown, HTML, JSON e CSV (max 1 MB). File binari verificati per Supermemory Local: PDF, PNG, JPG/JPEG, GIF e WebP (max 6 MiB in questa interfaccia). Puoi anche aggiungere un URL pubblico." }),
869
+ /* @__PURE__ */ jsx2("span", { style: { ...mutedStyle, fontSize: 12 }, children: "Office, audio e video sono supportati da alcune versioni del servizio hosted, ma non sono documentati per il server Local installato." })
870
+ ] }) }) : /* @__PURE__ */ jsxs2("div", { style: { flex: 1, minHeight: 0, padding: 18, display: "flex", flexDirection: "column", gap: 14, overflow: "hidden" }, children: [
871
+ /* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto", gap: 12, alignItems: "end", flexShrink: 0 }, children: [
872
+ /* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 12 }, children: [
742
873
  "Titolo",
743
- /* @__PURE__ */ jsx("input", { style: inputStyle, value: title, readOnly: mode === "read" || mode === "raw" || document.kind === "file", onChange: (event) => editField(setTitle, event.target.value) })
874
+ /* @__PURE__ */ jsx2("input", { style: inputStyle, value: title, readOnly: mode === "read" || mode === "raw" || document.kind === "file", onChange: (event) => editField(setTitle, event.target.value) })
744
875
  ] }),
745
- /* @__PURE__ */ jsx("span", { style: { ...mutedStyle, fontSize: 11, whiteSpace: "nowrap" }, children: document.kind === "file" && document.indexedTextDocumentIds?.length ? `Testo: ${document.indexedTextStatus ?? document.status}` : document.status === "done" ? "Indicizzato" : `Stato: ${document.status}` })
876
+ /* @__PURE__ */ jsx2("span", { style: { ...mutedStyle, fontSize: 11, whiteSpace: "nowrap" }, children: document.kind === "file" && document.indexedTextDocumentIds?.length ? `Testo: ${document.indexedTextStatus ?? document.status}` : document.status === "done" ? "Indicizzato" : `Stato: ${document.status}` })
746
877
  ] }),
747
- /* @__PURE__ */ jsxs("div", { style: { flex: 1, minHeight: 0, overflow: "auto", display: mode === "edit" && document.kind !== "file" ? "flex" : "block" }, children: [
748
- mode === "read" ? document.kind === "file" ? /* @__PURE__ */ jsxs("div", { style: { ...panelStyle, padding: 18 }, children: [
749
- /* @__PURE__ */ jsx("strong", { children: document.indexedTextDocumentIds?.length ? "PDF ricevuto e testo estratto" : "File PDF conservato da Supermemory" }),
750
- /* @__PURE__ */ jsxs("p", { style: { ...mutedStyle, marginBottom: 12 }, children: [
878
+ /* @__PURE__ */ jsxs2("div", { style: { flex: 1, minHeight: 0, overflow: "auto", display: mode === "edit" && document.kind !== "file" ? "flex" : "block" }, children: [
879
+ mode === "read" ? document.kind === "file" ? /* @__PURE__ */ jsxs2("div", { style: { ...panelStyle, padding: 18 }, children: [
880
+ /* @__PURE__ */ jsx2("strong", { children: document.indexedTextDocumentIds?.length ? "PDF ricevuto e testo estratto" : "File PDF conservato da Supermemory" }),
881
+ /* @__PURE__ */ jsxs2("p", { style: { ...mutedStyle, marginBottom: 12 }, children: [
751
882
  "Nome: ",
752
883
  document.fileName ?? document.title,
753
- /* @__PURE__ */ jsx("br", {}),
884
+ /* @__PURE__ */ jsx2("br", {}),
754
885
  "Tipo: ",
755
886
  document.mimeType ?? "non specificato",
756
- /* @__PURE__ */ jsx("br", {}),
757
- document.indexedTextDocumentIds?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
887
+ /* @__PURE__ */ jsx2("br", {}),
888
+ document.indexedTextDocumentIds?.length ? /* @__PURE__ */ jsxs2(Fragment, { children: [
758
889
  "Testo estratto e inviato a Supermemory in ",
759
890
  document.indexedTextDocumentIds.length,
760
891
  " documento/i. Stato dell\u2019indice testuale: ",
@@ -762,54 +893,258 @@ function MemoryPage() {
762
893
  ". Stato del file originale: ",
763
894
  document.binaryProcessingStatus ?? "non disponibile",
764
895
  "."
765
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
896
+ ] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
766
897
  "Non \xE8 disponibile un indice testuale collegato. Stato del file: ",
767
898
  document.binaryProcessingStatus ?? document.status,
768
899
  "; la ricerca potrebbe non trovare il contenuto."
769
900
  ] }),
770
- /* @__PURE__ */ jsx("br", {}),
901
+ /* @__PURE__ */ jsx2("br", {}),
771
902
  "Per sostituire il file, elimina questa voce e carica la versione aggiornata."
772
903
  ] }),
773
- document.mimeType === "application/pdf" ? /* @__PURE__ */ jsxs("label", { style: { ...secondaryButtonStyle, display: "inline-flex", alignItems: "center", cursor: busy ? "wait" : "pointer" }, children: [
904
+ document.mimeType === "application/pdf" ? /* @__PURE__ */ jsxs2("label", { style: { ...secondaryButtonStyle, display: "inline-flex", alignItems: "center", cursor: busy ? "wait" : "pointer" }, children: [
774
905
  busy ? "Indicizzazione\u2026" : "Estrai / reindicizza testo dal PDF",
775
- /* @__PURE__ */ jsx("input", { type: "file", hidden: true, disabled: busy, accept: ".pdf,application/pdf", onChange: onReindexPdfChange })
906
+ /* @__PURE__ */ jsx2("input", { type: "file", hidden: true, disabled: busy, accept: ".pdf,application/pdf", onChange: onReindexPdfChange })
776
907
  ] }) : null
777
- ] }) : document.kind === "url" ? /* @__PURE__ */ jsxs("div", { style: { ...panelStyle, padding: 18, overflowWrap: "anywhere" }, children: [
778
- /* @__PURE__ */ jsx("strong", { children: "Pagina indicizzata" }),
779
- /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("a", { href: document.sourceUrl ?? content, target: "_blank", rel: "noopener noreferrer", style: { textDecoration: "underline" }, children: document.sourceUrl ?? content }) }),
780
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, marginBottom: 0 }, children: "Supermemory conserva l\u2019indice estratto; per aggiornare il contenuto salva di nuovo l\u2019URL." })
781
- ] }) : /* @__PURE__ */ jsx("div", { style: { ...panelStyle, padding: 16 }, children: /* @__PURE__ */ jsx(MarkdownBlock, { content }) }) : null,
782
- mode === "edit" ? document.kind === "file" ? /* @__PURE__ */ jsxs("div", { style: { ...panelStyle, padding: 18 }, children: [
783
- /* @__PURE__ */ jsx("strong", { children: "Il contenuto del file non \xE8 modificabile in-place." }),
784
- /* @__PURE__ */ jsx("p", { style: { ...mutedStyle, marginBottom: 0 }, children: "Per aggiornarlo, elimina il documento e carica il file aggiornato." })
785
- ] }) : /* @__PURE__ */ jsx("textarea", { style: { ...inputStyle, flex: 1, minHeight: 0, resize: "none", fontFamily: "var(--font-mono, ui-monospace, monospace)", lineHeight: 1.6 }, value: content, onChange: (event) => editField(setContent, event.target.value) }) : null,
786
- mode === "raw" ? /* @__PURE__ */ jsx("pre", { style: { ...panelStyle, padding: 16, margin: 0, whiteSpace: "pre-wrap", overflowWrap: "anywhere", fontSize: 12 }, children: JSON.stringify({ ...document, title, content }, null, 2) }) : null
908
+ ] }) : document.kind === "url" ? /* @__PURE__ */ jsxs2("div", { style: { ...panelStyle, padding: 18, overflowWrap: "anywhere" }, children: [
909
+ /* @__PURE__ */ jsx2("strong", { children: "Pagina indicizzata" }),
910
+ /* @__PURE__ */ jsx2("p", { children: /* @__PURE__ */ jsx2("a", { href: document.sourceUrl ?? content, target: "_blank", rel: "noopener noreferrer", style: { textDecoration: "underline" }, children: document.sourceUrl ?? content }) }),
911
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, marginBottom: 0 }, children: "Supermemory conserva l\u2019indice estratto; per aggiornare il contenuto salva di nuovo l\u2019URL." })
912
+ ] }) : /* @__PURE__ */ jsx2("div", { style: { ...panelStyle, padding: 16 }, children: /* @__PURE__ */ jsx2(MarkdownBlock, { content }) }) : null,
913
+ mode === "edit" ? document.kind === "file" ? /* @__PURE__ */ jsxs2("div", { style: { ...panelStyle, padding: 18 }, children: [
914
+ /* @__PURE__ */ jsx2("strong", { children: "Il contenuto del file non \xE8 modificabile in-place." }),
915
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, marginBottom: 0 }, children: "Per aggiornarlo, elimina il documento e carica il file aggiornato." })
916
+ ] }) : /* @__PURE__ */ jsx2("textarea", { style: { ...inputStyle, flex: 1, minHeight: 0, resize: "none", fontFamily: "var(--font-mono, ui-monospace, monospace)", lineHeight: 1.6 }, value: content, onChange: (event) => editField(setContent, event.target.value) }) : null,
917
+ mode === "raw" ? /* @__PURE__ */ jsx2("pre", { style: { ...panelStyle, padding: 16, margin: 0, whiteSpace: "pre-wrap", overflowWrap: "anywhere", fontSize: 12 }, children: JSON.stringify({ ...document, title, content }, null, 2) }) : null
787
918
  ] }),
788
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8, justifyContent: "space-between", borderTop: "1px solid var(--border)", paddingTop: 12, flexShrink: 0 }, children: [
789
- /* @__PURE__ */ jsx("button", { type: "button", style: { ...secondaryButtonStyle, color: "var(--destructive, #b91c1c)" }, onClick: () => void removeDocument(), disabled: busy || !document.id, children: "Elimina documento" }),
790
- /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 8 }, children: mode === "edit" ? /* @__PURE__ */ jsxs(Fragment, { children: [
791
- /* @__PURE__ */ jsx("button", { type: "button", style: secondaryButtonStyle, onClick: () => {
919
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8, justifyContent: "space-between", borderTop: "1px solid var(--border)", paddingTop: 12, flexShrink: 0 }, children: [
920
+ /* @__PURE__ */ jsx2("button", { type: "button", style: { ...secondaryButtonStyle, color: "var(--destructive, #b91c1c)" }, onClick: () => void removeDocument(), disabled: busy || !document.id, children: "Elimina documento" }),
921
+ /* @__PURE__ */ jsx2("div", { style: { display: "flex", gap: 8 }, children: mode === "edit" ? /* @__PURE__ */ jsxs2(Fragment, { children: [
922
+ /* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: () => {
792
923
  setContent(document.content ?? "");
793
924
  setTitle(document.title);
794
925
  setDirty(false);
795
926
  setMode("read");
796
927
  }, children: "Annulla" }),
797
- /* @__PURE__ */ jsx("button", { type: "button", style: primaryButtonStyle, disabled: busy || !dirty, onClick: () => void persistText(document.kind === "url" ? "url" : "text"), children: busy ? "Salvataggio\u2026" : "Salva modifiche" })
928
+ /* @__PURE__ */ jsx2("button", { type: "button", style: primaryButtonStyle, disabled: busy || !dirty, onClick: () => void persistText(document.kind === "url" ? "url" : "text"), children: busy ? "Salvataggio\u2026" : "Salva modifiche" })
798
929
  ] }) : null })
799
930
  ] })
800
931
  ] }),
801
- busy ? /* @__PURE__ */ jsx("div", { "aria-live": "polite", style: { borderTop: "1px solid var(--border)", padding: "8px 14px", fontSize: 12, ...mutedStyle }, children: "Operazione in corso\u2026" }) : null
932
+ busy ? /* @__PURE__ */ jsx2("div", { "aria-live": "polite", style: { borderTop: "1px solid var(--border)", padding: "8px 14px", fontSize: 12, ...mutedStyle }, children: "Operazione in corso\u2026" }) : null
802
933
  ] })
803
934
  ] }),
804
- /* @__PURE__ */ jsxs("footer", { style: { ...mutedStyle, fontSize: 11, lineHeight: 1.6, marginTop: 12, flexShrink: 0 }, children: [
935
+ /* @__PURE__ */ jsxs2("footer", { style: { ...mutedStyle, fontSize: 11, lineHeight: 1.6, marginTop: 12, flexShrink: 0 }, children: [
805
936
  "Le assegnazioni progetto sono controllate con ",
806
- /* @__PURE__ */ jsx("code", { children: "projectId" }),
937
+ /* @__PURE__ */ jsx2("code", { children: "projectId" }),
807
938
  " del run Paperclip e la allowlist degli agenti qui selezionati. Le informazioni restano separate per organizzazione. I namespace vengono creati da Supermemory al primo contenuto; disattivare un\u2019assegnazione revoca l\u2019accesso ma non cancella i documenti."
808
939
  ] })
809
940
  ] });
810
941
  }
811
- var index_default = { SupermemorySettingsPage, MemoryPage, MemorySidebarLink };
942
+ function MemoryGraphPage() {
943
+ const { companyId } = useHostContext();
944
+ const navigation = useHostNavigation();
945
+ const loadCatalog = usePluginAction("memory-catalog");
946
+ const searchGraph = usePluginAction("memory-graph");
947
+ const toast = usePluginToast();
948
+ const [catalog, setCatalog] = useState2(null);
949
+ const [assignmentId, setAssignmentId] = useState2("");
950
+ const [query, setQuery] = useState2("");
951
+ const [graph, setGraph] = useState2(null);
952
+ const [selectedNodeId, setSelectedNodeId] = useState2("");
953
+ const [loading, setLoading] = useState2(true);
954
+ const [searching, setSearching] = useState2(false);
955
+ const [error, setError] = useState2(null);
956
+ useEffect2(() => {
957
+ let cancelled = false;
958
+ if (!companyId) {
959
+ setLoading(false);
960
+ setError("Seleziona un\u2019organizzazione Paperclip.");
961
+ return;
962
+ }
963
+ setLoading(true);
964
+ void loadCatalog({ companyId }).then((result) => {
965
+ if (cancelled) return;
966
+ const data = result;
967
+ setCatalog(data);
968
+ setAssignmentId(data.assignments[0]?.id ?? "");
969
+ setError(null);
970
+ }).catch((cause) => {
971
+ if (!cancelled) setError(displayError(cause));
972
+ }).finally(() => {
973
+ if (!cancelled) setLoading(false);
974
+ });
975
+ return () => {
976
+ cancelled = true;
977
+ };
978
+ }, [companyId, loadCatalog]);
979
+ const activeAssignment = catalog?.assignments.find((assignment) => assignment.id === assignmentId) ?? null;
980
+ const selectedNode = graph?.nodes.find((node) => node.id === selectedNodeId) ?? graph?.nodes[0] ?? null;
981
+ async function runSearch(nextQuery = query) {
982
+ const clean = nextQuery.trim();
983
+ if (!companyId || !assignmentId || !clean) return;
984
+ setSearching(true);
985
+ setError(null);
986
+ try {
987
+ const result = await searchGraph({ companyId, assignmentId, query: clean, limit: 8 });
988
+ setGraph(result);
989
+ setSelectedNodeId(result.nodes[0]?.id ?? "");
990
+ setQuery(clean);
991
+ } catch (cause) {
992
+ const message = displayError(cause);
993
+ setError(message);
994
+ toast({ title: "Errore nel grafo", body: message, tone: "error" });
995
+ } finally {
996
+ setSearching(false);
997
+ }
998
+ }
999
+ const visibleNodes = graph?.nodes.slice(0, 13) ?? [];
1000
+ const center = visibleNodes[0] ?? null;
1001
+ const points = /* @__PURE__ */ new Map();
1002
+ visibleNodes.forEach((node, index) => {
1003
+ if (index === 0) points.set(node.id, { x: 450, y: 270 });
1004
+ else {
1005
+ const ringIndex = index - 1;
1006
+ const angle = Math.PI * 2 * ringIndex / Math.max(1, visibleNodes.length - 1) - Math.PI / 2;
1007
+ const radius = ringIndex < 8 ? 190 : 250;
1008
+ points.set(node.id, { x: 450 + Math.cos(angle) * radius, y: 270 + Math.sin(angle) * radius });
1009
+ }
1010
+ });
1011
+ const visibleIds = new Set(visibleNodes.map((node) => node.id));
1012
+ const visibleEdges = (graph?.edges ?? []).filter((edge) => visibleIds.has(edge.source) && visibleIds.has(edge.target));
1013
+ if (loading) return /* @__PURE__ */ jsx2("main", { style: pageStyle, children: /* @__PURE__ */ jsx2("p", { children: "Caricamento namespace\u2026" }) });
1014
+ return /* @__PURE__ */ jsxs2("main", { style: { ...pageStyle, boxSizing: "border-box", minHeight: "calc(100vh - 160px)", display: "flex", flexDirection: "column", gap: 16 }, children: [
1015
+ /* @__PURE__ */ jsxs2("header", { style: { display: "flex", alignItems: "start", justifyContent: "space-between", gap: 16, flexWrap: "wrap" }, children: [
1016
+ /* @__PURE__ */ jsxs2("div", { children: [
1017
+ /* @__PURE__ */ jsx2("h1", { style: { fontSize: 26, fontWeight: 650, margin: 0 }, children: "Grafo della memoria" }),
1018
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, margin: "6px 0 0", maxWidth: 800 }, children: "Esplora i ricordi pertinenti e le relazioni che Supermemory restituisce per un namespace autorizzato. Seleziona un nodo e cerca di nuovo per espandere quel ramo." })
1019
+ ] }),
1020
+ /* @__PURE__ */ jsx2("a", { ...navigation.linkProps("/memory"), style: { ...secondaryButtonStyle, textDecoration: "none" }, children: "\u2190 Libreria Memory" })
1021
+ ] }),
1022
+ error ? /* @__PURE__ */ jsx2("div", { role: "alert", style: { ...panelStyle, padding: 12, borderColor: "var(--destructive, #b91c1c)" }, children: error }) : null,
1023
+ !catalog?.configured ? /* @__PURE__ */ jsxs2("div", { style: { ...panelStyle, padding: 12 }, children: [
1024
+ /* @__PURE__ */ jsx2("strong", { children: "Chiave master non configurata." }),
1025
+ /* @__PURE__ */ jsx2("span", { style: { ...mutedStyle, marginLeft: 6 }, children: "Configura il secret Supermemory Local nelle impostazioni del plugin per caricare il grafo." })
1026
+ ] }) : null,
1027
+ /* @__PURE__ */ jsxs2("section", { style: { display: "grid", gridTemplateColumns: "minmax(220px, 280px) minmax(0, 1fr)", gap: 16, flex: 1, minHeight: 470 }, children: [
1028
+ /* @__PURE__ */ jsxs2("aside", { style: { ...panelStyle, padding: 14, display: "flex", flexDirection: "column", gap: 12, minWidth: 0 }, children: [
1029
+ /* @__PURE__ */ jsxs2("div", { children: [
1030
+ /* @__PURE__ */ jsx2("h2", { style: { fontSize: 15, margin: 0 }, children: "Namespace autorizzati" }),
1031
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, fontSize: 12, margin: "5px 0 0" }, children: "Visibili solo all\u2019Owner dell\u2019organizzazione." })
1032
+ ] }),
1033
+ /* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 12 }, children: [
1034
+ "Spazio di memoria",
1035
+ /* @__PURE__ */ jsxs2("select", { style: inputStyle, value: assignmentId, onChange: (event) => {
1036
+ setAssignmentId(event.target.value);
1037
+ setGraph(null);
1038
+ setSelectedNodeId("");
1039
+ }, children: [
1040
+ /* @__PURE__ */ jsx2("option", { value: "", children: "Scegli un namespace\u2026" }),
1041
+ (catalog?.assignments ?? []).map((assignment) => /* @__PURE__ */ jsxs2("option", { value: assignment.id, children: [
1042
+ assignment.label,
1043
+ " \xB7 ",
1044
+ assignment.scopeType === "project" ? "progetto" : "agente"
1045
+ ] }, assignment.id))
1046
+ ] })
1047
+ ] }),
1048
+ activeAssignment ? /* @__PURE__ */ jsxs2("div", { style: { ...mutedStyle, fontSize: 11, lineHeight: 1.5, overflowWrap: "anywhere" }, children: [
1049
+ /* @__PURE__ */ jsx2("strong", { style: { color: "var(--foreground)" }, children: activeAssignment.label }),
1050
+ /* @__PURE__ */ jsx2("br", {}),
1051
+ /* @__PURE__ */ jsx2("code", { children: activeAssignment.namespace }),
1052
+ /* @__PURE__ */ jsx2("br", {}),
1053
+ activeAssignment.authorizedAgentIds.length,
1054
+ " agenti autorizzati"
1055
+ ] }) : null,
1056
+ /* @__PURE__ */ jsx2("div", { style: { borderTop: "1px solid var(--border)", paddingTop: 12, ...mutedStyle, fontSize: 12, lineHeight: 1.55 }, children: "Il grafo \xE8 circoscritto al namespace selezionato. Non mostra documenti o organizzazioni senza un\u2019assegnazione attiva." })
1057
+ ] }),
1058
+ /* @__PURE__ */ jsxs2("section", { style: { ...panelStyle, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
1059
+ /* @__PURE__ */ jsxs2("form", { onSubmit: (event) => {
1060
+ event.preventDefault();
1061
+ void runSearch();
1062
+ }, style: { padding: 14, borderBottom: "1px solid var(--border)", display: "flex", gap: 8, alignItems: "center" }, children: [
1063
+ /* @__PURE__ */ jsx2("input", { style: { ...inputStyle, flex: 1, minWidth: 0 }, value: query, onChange: (event) => setQuery(event.target.value), disabled: !activeAssignment || searching, placeholder: "Cerca un concetto per esplorare i ricordi\u2026" }),
1064
+ /* @__PURE__ */ jsx2("button", { type: "submit", style: primaryButtonStyle, disabled: !activeAssignment || searching || !query.trim(), children: searching ? "Cerco\u2026" : "Esplora" })
1065
+ ] }),
1066
+ graph ? /* @__PURE__ */ jsxs2(Fragment, { children: [
1067
+ /* @__PURE__ */ jsxs2("div", { style: { padding: "9px 14px", borderBottom: "1px solid var(--border)", display: "flex", gap: 12, flexWrap: "wrap", ...mutedStyle, fontSize: 12 }, children: [
1068
+ /* @__PURE__ */ jsxs2("span", { children: [
1069
+ /* @__PURE__ */ jsx2("strong", { style: { color: "var(--foreground)" }, children: graph.nodes.length }),
1070
+ " ricordi"
1071
+ ] }),
1072
+ /* @__PURE__ */ jsxs2("span", { children: [
1073
+ /* @__PURE__ */ jsx2("strong", { style: { color: "var(--foreground)" }, children: graph.edges.length }),
1074
+ " relazioni"
1075
+ ] }),
1076
+ /* @__PURE__ */ jsxs2("span", { children: [
1077
+ "Ricerca: \u201C",
1078
+ graph.query,
1079
+ "\u201D"
1080
+ ] }),
1081
+ graph.truncated ? /* @__PURE__ */ jsx2("span", { children: "Vista parziale; affina la ricerca per esplorare altri rami." }) : null
1082
+ ] }),
1083
+ /* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "minmax(0, 1fr) minmax(230px, 310px)", flex: 1, minHeight: 0 }, children: [
1084
+ /* @__PURE__ */ jsx2("div", { style: { minWidth: 0, minHeight: 0, overflow: "auto", background: "radial-gradient(circle at center, var(--accent, rgba(127,127,127,.08)), transparent 58%)" }, children: visibleNodes.length ? /* @__PURE__ */ jsxs2("svg", { role: "img", "aria-label": `Grafo di ${visibleNodes.length} memorie`, viewBox: "0 0 900 540", style: { width: "100%", minWidth: 620, height: "100%", minHeight: 480 }, children: [
1085
+ visibleEdges.map((edge, index) => {
1086
+ const a = points.get(edge.source);
1087
+ const b = points.get(edge.target);
1088
+ if (!a || !b) return null;
1089
+ return /* @__PURE__ */ jsxs2("g", { children: [
1090
+ /* @__PURE__ */ jsx2("line", { x1: a.x, y1: a.y, x2: b.x, y2: b.y, stroke: "var(--border)", strokeWidth: "2", strokeDasharray: edge.relation === "sibling" ? "5 5" : void 0 }),
1091
+ /* @__PURE__ */ jsx2("title", { children: edge.relation === "parent" ? "Memoria padre" : edge.relation === "child" ? "Memoria figlia" : "Memoria correlata" })
1092
+ ] }, `${edge.source}-${edge.target}-${edge.relation}-${index}`);
1093
+ }),
1094
+ visibleNodes.map((node) => {
1095
+ const point = points.get(node.id);
1096
+ const active = node.id === selectedNode?.id;
1097
+ const lines = node.label.match(/.{1,25}(?:\s|$)/g)?.slice(0, 3).map((line) => line.trim()) ?? [node.label.slice(0, 25)];
1098
+ return /* @__PURE__ */ jsxs2("g", { role: "button", tabIndex: 0, "aria-label": `Seleziona memoria: ${node.label}`, onClick: () => setSelectedNodeId(node.id), onKeyDown: (event) => {
1099
+ if (event.key === "Enter" || event.key === " ") {
1100
+ event.preventDefault();
1101
+ setSelectedNodeId(node.id);
1102
+ }
1103
+ }, style: { cursor: "pointer" }, children: [
1104
+ /* @__PURE__ */ jsx2("rect", { x: point.x - 83, y: point.y - 34, width: "166", height: "68", rx: "12", fill: active ? "var(--primary)" : "var(--card, #1f1f1f)", stroke: active ? "var(--primary)" : node.matched ? "var(--ring, var(--primary))" : "var(--border)", strokeWidth: node.matched ? 2 : 1.5 }),
1105
+ lines.map((line, index) => /* @__PURE__ */ jsx2("text", { x: point.x, y: point.y - 5 + index * 14, textAnchor: "middle", fontSize: "11", fill: active ? "var(--primary-foreground, white)" : "var(--foreground)", children: line.slice(0, 26) }, `${node.id}-${index}`)),
1106
+ node.similarity !== null ? /* @__PURE__ */ jsxs2("text", { x: point.x, y: point.y + 25, textAnchor: "middle", fontSize: "9", fill: active ? "var(--primary-foreground, white)" : "var(--muted-foreground)", children: [
1107
+ Math.round(node.similarity * 100),
1108
+ "% pertinenza"
1109
+ ] }) : null
1110
+ ] }, node.id);
1111
+ })
1112
+ ] }) : /* @__PURE__ */ jsx2("div", { style: { ...mutedStyle, padding: 32, textAlign: "center" }, children: "Nessuna memoria trovata nel namespace per questa ricerca." }) }),
1113
+ /* @__PURE__ */ jsxs2("aside", { style: { borderLeft: "1px solid var(--border)", padding: 14, display: "flex", flexDirection: "column", minWidth: 0, minHeight: 0, gap: 12 }, children: [
1114
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", justifyContent: "space-between", gap: 8, alignItems: "start" }, children: [
1115
+ /* @__PURE__ */ jsx2("h2", { style: { fontSize: 14, margin: 0 }, children: "Memoria selezionata" }),
1116
+ /* @__PURE__ */ jsxs2("span", { style: { ...mutedStyle, fontSize: 11 }, children: [
1117
+ visibleNodes.length,
1118
+ " mostrate"
1119
+ ] })
1120
+ ] }),
1121
+ selectedNode ? /* @__PURE__ */ jsxs2(Fragment, { children: [
1122
+ /* @__PURE__ */ jsx2("div", { style: { ...panelStyle, padding: 12, minHeight: 0, overflow: "auto", whiteSpace: "pre-wrap", overflowWrap: "anywhere", fontSize: 12, lineHeight: 1.55 }, children: selectedNode.text }),
1123
+ /* @__PURE__ */ jsxs2("div", { style: { ...mutedStyle, fontSize: 11, overflowWrap: "anywhere" }, children: [
1124
+ "ID: ",
1125
+ /* @__PURE__ */ jsx2("code", { children: selectedNode.id })
1126
+ ] }),
1127
+ /* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, disabled: searching, onClick: () => void runSearch(selectedNode.text.slice(0, 300)), children: "Espandi questo ramo" })
1128
+ ] }) : /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, fontSize: 12 }, children: "Seleziona un nodo del grafo o avvia una ricerca." }),
1129
+ /* @__PURE__ */ jsxs2("div", { style: { borderTop: "1px solid var(--border)", paddingTop: 10, display: "grid", gap: 6, overflowY: "auto", minHeight: 0 }, children: [
1130
+ /* @__PURE__ */ jsx2("strong", { style: { fontSize: 12 }, children: "Ricordi trovati" }),
1131
+ graph.nodes.map((node) => /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setSelectedNodeId(node.id), style: { ...secondaryButtonStyle, textAlign: "left", padding: "7px 8px", fontSize: 11, background: node.id === selectedNode?.id ? "var(--accent, rgba(127,127,127,.14))" : "transparent" }, children: node.label }, node.id))
1132
+ ] })
1133
+ ] })
1134
+ ] })
1135
+ ] }) : /* @__PURE__ */ jsx2("div", { style: { flex: 1, display: "grid", placeItems: "center", padding: 28, textAlign: "center" }, children: /* @__PURE__ */ jsxs2("div", { children: [
1136
+ /* @__PURE__ */ jsx2("div", { "aria-hidden": "true", style: { fontSize: 34, marginBottom: 10 }, children: "\u2318" }),
1137
+ /* @__PURE__ */ jsx2("strong", { children: activeAssignment ? "Cerca per visualizzare i ricordi collegati" : "Seleziona un namespace autorizzato" }),
1138
+ /* @__PURE__ */ jsx2("p", { style: { ...mutedStyle, maxWidth: 560, fontSize: 13, lineHeight: 1.6 }, children: "Supermemory restituisce i ricordi pertinenti e le relazioni esplicite tra loro (padre, figlio e fratello). Il grafo si esplora per ricerche successive; non \xE8 una scansione indiscriminata di tutti i namespace." })
1139
+ ] }) })
1140
+ ] })
1141
+ ] }),
1142
+ /* @__PURE__ */ jsx2("footer", { style: { ...mutedStyle, fontSize: 11, lineHeight: 1.55 }, children: "Le ricerche sono eseguite dal worker Paperclip con il secret master; la chiave non arriva al browser. L\u2019accesso resta limitato all\u2019organizzazione attiva e all\u2019assegnazione selezionata." })
1143
+ ] });
1144
+ }
1145
+ var index_default = { SupermemorySettingsPage, MemoryPage, MemoryGraphPage, MemorySidebarLink };
812
1146
  export {
1147
+ MemoryGraphPage,
813
1148
  MemoryPage,
814
1149
  MemorySidebarLink,
815
1150
  SupermemorySettingsPage,