paperclip-plugin-supermemory-otomatik 0.2.12 → 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/README.md +2 -2
- package/dist/manifest.js +1 -1
- package/dist/manifest.js.map +1 -1
- package/dist/ui/index.js +387 -278
- package/dist/ui/index.js.map +4 -4
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
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] =
|
|
83
|
-
const [secrets, setSecrets] =
|
|
84
|
-
const [config, setConfig] =
|
|
85
|
-
const [grantRows, setGrantRows] =
|
|
86
|
-
const [loading, setLoading] =
|
|
87
|
-
const [saving, setSaving] =
|
|
88
|
-
const [error, setError] =
|
|
89
|
-
const [success, setSuccess] =
|
|
90
|
-
|
|
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,77 +263,78 @@ function SupermemorySettingsPage() {
|
|
|
155
263
|
setSaving(false);
|
|
156
264
|
}
|
|
157
265
|
}
|
|
158
|
-
if (loading) return /* @__PURE__ */
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
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__ */
|
|
165
|
-
success ? /* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
/* @__PURE__ */
|
|
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__ */
|
|
172
|
-
/* @__PURE__ */
|
|
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__ */
|
|
283
|
+
/* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
|
|
175
284
|
"Secret con la chiave master Supermemory Local",
|
|
176
|
-
/* @__PURE__ */
|
|
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__ */
|
|
181
|
-
secrets.map((secret) => /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
297
|
+
/* @__PURE__ */ jsx2("a", { href: "/company/settings/secrets", style: { textDecoration: "underline" }, children: "Secrets" }),
|
|
189
298
|
"."
|
|
190
299
|
] })
|
|
191
300
|
] }),
|
|
192
|
-
/* @__PURE__ */
|
|
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__ */
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
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__ */
|
|
309
|
+
/* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: addGrant, children: "\uFF0B Aggiungi agente" })
|
|
201
310
|
] }),
|
|
202
|
-
grantRows.length === 0 ? /* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
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__ */
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
agents.map((agent) => /* @__PURE__ */
|
|
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__ */
|
|
323
|
+
/* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
|
|
215
324
|
"Secret ACL individuale",
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
-
secrets.map((secret) => /* @__PURE__ */
|
|
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__ */
|
|
333
|
+
/* @__PURE__ */ jsx2("button", { type: "button", "aria-label": "Rimuovi agente", style: secondaryButtonStyle, onClick: () => removeGrant(index), children: "Rimuovi" })
|
|
225
334
|
] }, row.key)),
|
|
226
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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
|
}
|
|
@@ -237,37 +346,37 @@ function MemorySidebarLink({ context }) {
|
|
|
237
346
|
const pathname = typeof window !== "undefined" ? window.location.pathname : "";
|
|
238
347
|
const memoryActive = pathname === memoryHref || pathname === graphHref;
|
|
239
348
|
const graphActive = pathname === graphHref;
|
|
240
|
-
return /* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ jsxs2("div", { className: "mx-2", children: [
|
|
350
|
+
/* @__PURE__ */ jsxs2(
|
|
242
351
|
"a",
|
|
243
352
|
{
|
|
244
353
|
...navigation.linkProps("/memory"),
|
|
245
354
|
"aria-current": pathname === memoryHref ? "page" : void 0,
|
|
246
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"}`,
|
|
247
356
|
children: [
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
/* @__PURE__ */
|
|
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" })
|
|
252
361
|
] }) }),
|
|
253
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ jsx2("span", { "data-plugin-sidebar-label": "true", className: "flex-1 truncate", children: "Memory" })
|
|
254
363
|
]
|
|
255
364
|
}
|
|
256
365
|
),
|
|
257
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ jsxs2(
|
|
258
367
|
"a",
|
|
259
368
|
{
|
|
260
369
|
...navigation.linkProps("/memory-graph"),
|
|
261
370
|
"aria-current": graphActive ? "page" : void 0,
|
|
262
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"}`,
|
|
263
372
|
children: [
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */
|
|
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" })
|
|
269
378
|
] }) }),
|
|
270
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ jsx2("span", { className: "flex-1 truncate", children: "Grafo" })
|
|
271
380
|
]
|
|
272
381
|
}
|
|
273
382
|
)
|
|
@@ -299,25 +408,25 @@ function MemoryPage() {
|
|
|
299
408
|
const deleteDocument = usePluginAction("memory-document-delete");
|
|
300
409
|
const navigation = useHostNavigation();
|
|
301
410
|
const pageRef = useRef(null);
|
|
302
|
-
const [pageHeight, setPageHeight] =
|
|
303
|
-
const [catalog, setCatalog] =
|
|
304
|
-
const [loading, setLoading] =
|
|
305
|
-
const [error, setError] =
|
|
306
|
-
const [busy, setBusy] =
|
|
307
|
-
const [activeAssignmentId, setActiveAssignmentId] =
|
|
308
|
-
const [activeDocumentKey, setActiveDocumentKey] =
|
|
309
|
-
const [document, setDocument] =
|
|
310
|
-
const [title, setTitle] =
|
|
311
|
-
const [content, setContent] =
|
|
312
|
-
const [mode, setMode] =
|
|
313
|
-
const [dirty, setDirty] =
|
|
314
|
-
const [scopeType, setScopeType] =
|
|
315
|
-
const [scopeId, setScopeId] =
|
|
316
|
-
const [allowedAgentIds, setAllowedAgentIds] =
|
|
317
|
-
const [editingAssignmentId, setEditingAssignmentId] =
|
|
318
|
-
const [showAssignment, setShowAssignment] =
|
|
319
|
-
const [showUrlForm, setShowUrlForm] =
|
|
320
|
-
const [urlInput, setUrlInput] =
|
|
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("");
|
|
321
430
|
useLayoutEffect(() => {
|
|
322
431
|
const measure = () => {
|
|
323
432
|
const page = pageRef.current;
|
|
@@ -349,7 +458,7 @@ function MemoryPage() {
|
|
|
349
458
|
return data.assignments.some((assignment) => assignment.id === next) ? next : data.assignments[0]?.id ?? "";
|
|
350
459
|
});
|
|
351
460
|
}, [companyId, loadCatalog]);
|
|
352
|
-
|
|
461
|
+
useEffect2(() => {
|
|
353
462
|
let cancelled = false;
|
|
354
463
|
if (!companyId) {
|
|
355
464
|
setLoading(false);
|
|
@@ -377,7 +486,7 @@ function MemoryPage() {
|
|
|
377
486
|
const editingAssignment = catalog?.assignments.find((assignment) => assignment.id === editingAssignmentId) ?? null;
|
|
378
487
|
const visibleDocuments = (catalog?.documents ?? []).filter((item) => item.assignmentId === activeAssignmentId);
|
|
379
488
|
const selectedDocumentSummary = visibleDocuments.find((item) => `${item.assignmentId}:${item.id}` === activeDocumentKey) ?? null;
|
|
380
|
-
|
|
489
|
+
useEffect2(() => {
|
|
381
490
|
let cancelled = false;
|
|
382
491
|
if (activeDocumentKey === "draft") return;
|
|
383
492
|
if (!companyId || !selectedDocumentSummary) {
|
|
@@ -610,23 +719,23 @@ function MemoryPage() {
|
|
|
610
719
|
}
|
|
611
720
|
}
|
|
612
721
|
const namespacePreview = editingAssignment?.namespace ?? (companyId && scopeId ? `paperclip_${companyId}_${scopeType}_${scopeId}` : "Il namespace verr\xE0 generato con ID organizzazione + target");
|
|
613
|
-
if (loading) return /* @__PURE__ */
|
|
614
|
-
if (error && !catalog) return /* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */
|
|
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." })
|
|
620
729
|
] })
|
|
621
730
|
] });
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
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." })
|
|
627
736
|
] }),
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8, flexWrap: "wrap", justifyContent: "end" }, children: [
|
|
738
|
+
/* @__PURE__ */ jsx2("button", { type: "button", style: secondaryButtonStyle, onClick: () => {
|
|
630
739
|
if (showAssignment && !editingAssignmentId) {
|
|
631
740
|
setShowAssignment(false);
|
|
632
741
|
return;
|
|
@@ -637,146 +746,146 @@ function MemoryPage() {
|
|
|
637
746
|
setAllowedAgentIds([]);
|
|
638
747
|
setShowAssignment(true);
|
|
639
748
|
}, children: "\uFF0B Assegna namespace" }),
|
|
640
|
-
/* @__PURE__ */
|
|
749
|
+
/* @__PURE__ */ jsx2("a", { ...navigation.linkProps("/company/settings/instance/plugins/paperclipai.supermemory"), style: { ...secondaryButtonStyle, textDecoration: "none" }, children: "Configurazione" })
|
|
641
750
|
] })
|
|
642
751
|
] }),
|
|
643
|
-
error ? /* @__PURE__ */
|
|
644
|
-
!catalog?.configured ? /* @__PURE__ */
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
/* @__PURE__ */
|
|
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." })
|
|
647
756
|
] }) : null,
|
|
648
|
-
showAssignment ? /* @__PURE__ */
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
/* @__PURE__ */
|
|
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: [
|
|
652
761
|
"Ambito",
|
|
653
|
-
/* @__PURE__ */
|
|
762
|
+
/* @__PURE__ */ jsxs2("select", { style: inputStyle, value: scopeType, onChange: (event) => {
|
|
654
763
|
setScopeType(event.target.value);
|
|
655
764
|
setScopeId("");
|
|
656
765
|
setAllowedAgentIds([]);
|
|
657
766
|
}, children: [
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
/* @__PURE__ */
|
|
767
|
+
/* @__PURE__ */ jsx2("option", { value: "project", children: "Progetto" }),
|
|
768
|
+
/* @__PURE__ */ jsx2("option", { value: "agent", children: "Agente" })
|
|
660
769
|
] })
|
|
661
770
|
] }),
|
|
662
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 13 }, children: [
|
|
663
772
|
scopeType === "project" ? "Progetto Paperclip" : "Agente Paperclip",
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
(scopeType === "project" ? catalog?.projects ?? [] : catalog?.agents ?? []).map((item) => /* @__PURE__ */
|
|
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))
|
|
667
776
|
] })
|
|
668
777
|
] })
|
|
669
778
|
] }),
|
|
670
|
-
scopeType === "project" ? /* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
-
/* @__PURE__ */
|
|
674
|
-
/* @__PURE__ */
|
|
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)) }),
|
|
675
784
|
agent.name
|
|
676
785
|
] }, agent.id)) })
|
|
677
786
|
] }) : null,
|
|
678
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ jsxs2("div", { style: { ...mutedStyle, fontSize: 12 }, children: [
|
|
679
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.",
|
|
680
789
|
" ",
|
|
681
|
-
/* @__PURE__ */
|
|
790
|
+
/* @__PURE__ */ jsx2("code", { style: { overflowWrap: "anywhere" }, children: namespacePreview })
|
|
682
791
|
] }),
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
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: () => {
|
|
686
795
|
setShowAssignment(false);
|
|
687
796
|
setEditingAssignmentId("");
|
|
688
797
|
}, children: "Annulla" })
|
|
689
798
|
] })
|
|
690
799
|
] }) : null,
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
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 })
|
|
696
805
|
] }),
|
|
697
|
-
!catalog?.assignments.length ? /* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
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) => {
|
|
699
808
|
const docs = catalog?.documents.filter((item) => item.assignmentId === assignment.id) ?? [];
|
|
700
809
|
const selected = assignment.id === activeAssignmentId;
|
|
701
|
-
return /* @__PURE__ */
|
|
702
|
-
/* @__PURE__ */
|
|
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: () => {
|
|
703
812
|
setActiveAssignmentId(assignment.id);
|
|
704
813
|
setActiveDocumentKey("");
|
|
705
814
|
setDocument(null);
|
|
706
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: [
|
|
707
|
-
/* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */
|
|
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: [
|
|
709
818
|
assignment.scopeType === "project" ? "Progetto" : "Agente",
|
|
710
819
|
" \xB7 ",
|
|
711
820
|
assignment.authorizedAgentIds.length,
|
|
712
821
|
" agenti"
|
|
713
822
|
] })
|
|
714
823
|
] }),
|
|
715
|
-
selected ? /* @__PURE__ */
|
|
716
|
-
docs.map((item) => /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
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 })
|
|
719
828
|
] }, `${item.assignmentId}:${item.id}`)),
|
|
720
|
-
!docs.length ? /* @__PURE__ */
|
|
721
|
-
/* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
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" })
|
|
723
832
|
] }) : null
|
|
724
833
|
] }, assignment.id);
|
|
725
834
|
}) }),
|
|
726
|
-
activeAssignment ? /* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
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: [
|
|
730
839
|
"\uFF0B Carica file",
|
|
731
|
-
/* @__PURE__ */
|
|
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 })
|
|
732
841
|
] })
|
|
733
842
|
] }) : null
|
|
734
843
|
] }),
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
activeAssignment ? /* @__PURE__ */
|
|
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
|
|
740
849
|
] }),
|
|
741
|
-
document ? /* @__PURE__ */
|
|
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
|
|
742
851
|
] }),
|
|
743
|
-
showUrlForm && activeAssignment ? /* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
749
|
-
/* @__PURE__ */
|
|
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" })
|
|
750
859
|
] })
|
|
751
860
|
] }) : null,
|
|
752
|
-
!activeAssignment ? /* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
/* @__PURE__ */
|
|
755
|
-
/* @__PURE__ */
|
|
756
|
-
] }) }) : !document ? /* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
761
|
-
] }) }) : /* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
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: [
|
|
764
873
|
"Titolo",
|
|
765
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ jsx2("input", { style: inputStyle, value: title, readOnly: mode === "read" || mode === "raw" || document.kind === "file", onChange: (event) => editField(setTitle, event.target.value) })
|
|
766
875
|
] }),
|
|
767
|
-
/* @__PURE__ */
|
|
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}` })
|
|
768
877
|
] }),
|
|
769
|
-
/* @__PURE__ */
|
|
770
|
-
mode === "read" ? document.kind === "file" ? /* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
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: [
|
|
773
882
|
"Nome: ",
|
|
774
883
|
document.fileName ?? document.title,
|
|
775
|
-
/* @__PURE__ */
|
|
884
|
+
/* @__PURE__ */ jsx2("br", {}),
|
|
776
885
|
"Tipo: ",
|
|
777
886
|
document.mimeType ?? "non specificato",
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
document.indexedTextDocumentIds?.length ? /* @__PURE__ */
|
|
887
|
+
/* @__PURE__ */ jsx2("br", {}),
|
|
888
|
+
document.indexedTextDocumentIds?.length ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
780
889
|
"Testo estratto e inviato a Supermemory in ",
|
|
781
890
|
document.indexedTextDocumentIds.length,
|
|
782
891
|
" documento/i. Stato dell\u2019indice testuale: ",
|
|
@@ -784,48 +893,48 @@ function MemoryPage() {
|
|
|
784
893
|
". Stato del file originale: ",
|
|
785
894
|
document.binaryProcessingStatus ?? "non disponibile",
|
|
786
895
|
"."
|
|
787
|
-
] }) : /* @__PURE__ */
|
|
896
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
788
897
|
"Non \xE8 disponibile un indice testuale collegato. Stato del file: ",
|
|
789
898
|
document.binaryProcessingStatus ?? document.status,
|
|
790
899
|
"; la ricerca potrebbe non trovare il contenuto."
|
|
791
900
|
] }),
|
|
792
|
-
/* @__PURE__ */
|
|
901
|
+
/* @__PURE__ */ jsx2("br", {}),
|
|
793
902
|
"Per sostituire il file, elimina questa voce e carica la versione aggiornata."
|
|
794
903
|
] }),
|
|
795
|
-
document.mimeType === "application/pdf" ? /* @__PURE__ */
|
|
904
|
+
document.mimeType === "application/pdf" ? /* @__PURE__ */ jsxs2("label", { style: { ...secondaryButtonStyle, display: "inline-flex", alignItems: "center", cursor: busy ? "wait" : "pointer" }, children: [
|
|
796
905
|
busy ? "Indicizzazione\u2026" : "Estrai / reindicizza testo dal PDF",
|
|
797
|
-
/* @__PURE__ */
|
|
906
|
+
/* @__PURE__ */ jsx2("input", { type: "file", hidden: true, disabled: busy, accept: ".pdf,application/pdf", onChange: onReindexPdfChange })
|
|
798
907
|
] }) : null
|
|
799
|
-
] }) : document.kind === "url" ? /* @__PURE__ */
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
803
|
-
] }) : /* @__PURE__ */
|
|
804
|
-
mode === "edit" ? document.kind === "file" ? /* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
] }) : /* @__PURE__ */
|
|
808
|
-
mode === "raw" ? /* @__PURE__ */
|
|
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
|
|
809
918
|
] }),
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
/* @__PURE__ */
|
|
812
|
-
/* @__PURE__ */
|
|
813
|
-
/* @__PURE__ */
|
|
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: () => {
|
|
814
923
|
setContent(document.content ?? "");
|
|
815
924
|
setTitle(document.title);
|
|
816
925
|
setDirty(false);
|
|
817
926
|
setMode("read");
|
|
818
927
|
}, children: "Annulla" }),
|
|
819
|
-
/* @__PURE__ */
|
|
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" })
|
|
820
929
|
] }) : null })
|
|
821
930
|
] })
|
|
822
931
|
] }),
|
|
823
|
-
busy ? /* @__PURE__ */
|
|
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
|
|
824
933
|
] })
|
|
825
934
|
] }),
|
|
826
|
-
/* @__PURE__ */
|
|
935
|
+
/* @__PURE__ */ jsxs2("footer", { style: { ...mutedStyle, fontSize: 11, lineHeight: 1.6, marginTop: 12, flexShrink: 0 }, children: [
|
|
827
936
|
"Le assegnazioni progetto sono controllate con ",
|
|
828
|
-
/* @__PURE__ */
|
|
937
|
+
/* @__PURE__ */ jsx2("code", { children: "projectId" }),
|
|
829
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."
|
|
830
939
|
] })
|
|
831
940
|
] });
|
|
@@ -836,15 +945,15 @@ function MemoryGraphPage() {
|
|
|
836
945
|
const loadCatalog = usePluginAction("memory-catalog");
|
|
837
946
|
const searchGraph = usePluginAction("memory-graph");
|
|
838
947
|
const toast = usePluginToast();
|
|
839
|
-
const [catalog, setCatalog] =
|
|
840
|
-
const [assignmentId, setAssignmentId] =
|
|
841
|
-
const [query, setQuery] =
|
|
842
|
-
const [graph, setGraph] =
|
|
843
|
-
const [selectedNodeId, setSelectedNodeId] =
|
|
844
|
-
const [loading, setLoading] =
|
|
845
|
-
const [searching, setSearching] =
|
|
846
|
-
const [error, setError] =
|
|
847
|
-
|
|
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(() => {
|
|
848
957
|
let cancelled = false;
|
|
849
958
|
if (!companyId) {
|
|
850
959
|
setLoading(false);
|
|
@@ -901,136 +1010,136 @@ function MemoryGraphPage() {
|
|
|
901
1010
|
});
|
|
902
1011
|
const visibleIds = new Set(visibleNodes.map((node) => node.id));
|
|
903
1012
|
const visibleEdges = (graph?.edges ?? []).filter((edge) => visibleIds.has(edge.source) && visibleIds.has(edge.target));
|
|
904
|
-
if (loading) return /* @__PURE__ */
|
|
905
|
-
return /* @__PURE__ */
|
|
906
|
-
/* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */
|
|
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." })
|
|
910
1019
|
] }),
|
|
911
|
-
/* @__PURE__ */
|
|
1020
|
+
/* @__PURE__ */ jsx2("a", { ...navigation.linkProps("/memory"), style: { ...secondaryButtonStyle, textDecoration: "none" }, children: "\u2190 Libreria Memory" })
|
|
912
1021
|
] }),
|
|
913
|
-
error ? /* @__PURE__ */
|
|
914
|
-
!catalog?.configured ? /* @__PURE__ */
|
|
915
|
-
/* @__PURE__ */
|
|
916
|
-
/* @__PURE__ */
|
|
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." })
|
|
917
1026
|
] }) : null,
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
/* @__PURE__ */
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
/* @__PURE__ */
|
|
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." })
|
|
923
1032
|
] }),
|
|
924
|
-
/* @__PURE__ */
|
|
1033
|
+
/* @__PURE__ */ jsxs2("label", { style: { display: "grid", gap: 6, fontSize: 12 }, children: [
|
|
925
1034
|
"Spazio di memoria",
|
|
926
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ jsxs2("select", { style: inputStyle, value: assignmentId, onChange: (event) => {
|
|
927
1036
|
setAssignmentId(event.target.value);
|
|
928
1037
|
setGraph(null);
|
|
929
1038
|
setSelectedNodeId("");
|
|
930
1039
|
}, children: [
|
|
931
|
-
/* @__PURE__ */
|
|
932
|
-
(catalog?.assignments ?? []).map((assignment) => /* @__PURE__ */
|
|
1040
|
+
/* @__PURE__ */ jsx2("option", { value: "", children: "Scegli un namespace\u2026" }),
|
|
1041
|
+
(catalog?.assignments ?? []).map((assignment) => /* @__PURE__ */ jsxs2("option", { value: assignment.id, children: [
|
|
933
1042
|
assignment.label,
|
|
934
1043
|
" \xB7 ",
|
|
935
1044
|
assignment.scopeType === "project" ? "progetto" : "agente"
|
|
936
1045
|
] }, assignment.id))
|
|
937
1046
|
] })
|
|
938
1047
|
] }),
|
|
939
|
-
activeAssignment ? /* @__PURE__ */
|
|
940
|
-
/* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
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", {}),
|
|
944
1053
|
activeAssignment.authorizedAgentIds.length,
|
|
945
1054
|
" agenti autorizzati"
|
|
946
1055
|
] }) : null,
|
|
947
|
-
/* @__PURE__ */
|
|
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." })
|
|
948
1057
|
] }),
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ jsxs2("section", { style: { ...panelStyle, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
|
|
1059
|
+
/* @__PURE__ */ jsxs2("form", { onSubmit: (event) => {
|
|
951
1060
|
event.preventDefault();
|
|
952
1061
|
void runSearch();
|
|
953
1062
|
}, style: { padding: 14, borderBottom: "1px solid var(--border)", display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
/* @__PURE__ */
|
|
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" })
|
|
956
1065
|
] }),
|
|
957
|
-
graph ? /* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
/* @__PURE__ */
|
|
960
|
-
/* @__PURE__ */
|
|
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 }),
|
|
961
1070
|
" ricordi"
|
|
962
1071
|
] }),
|
|
963
|
-
/* @__PURE__ */
|
|
964
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
1073
|
+
/* @__PURE__ */ jsx2("strong", { style: { color: "var(--foreground)" }, children: graph.edges.length }),
|
|
965
1074
|
" relazioni"
|
|
966
1075
|
] }),
|
|
967
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
968
1077
|
"Ricerca: \u201C",
|
|
969
1078
|
graph.query,
|
|
970
1079
|
"\u201D"
|
|
971
1080
|
] }),
|
|
972
|
-
graph.truncated ? /* @__PURE__ */
|
|
1081
|
+
graph.truncated ? /* @__PURE__ */ jsx2("span", { children: "Vista parziale; affina la ricerca per esplorare altri rami." }) : null
|
|
973
1082
|
] }),
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
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: [
|
|
976
1085
|
visibleEdges.map((edge, index) => {
|
|
977
1086
|
const a = points.get(edge.source);
|
|
978
1087
|
const b = points.get(edge.target);
|
|
979
1088
|
if (!a || !b) return null;
|
|
980
|
-
return /* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
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" })
|
|
983
1092
|
] }, `${edge.source}-${edge.target}-${edge.relation}-${index}`);
|
|
984
1093
|
}),
|
|
985
1094
|
visibleNodes.map((node) => {
|
|
986
1095
|
const point = points.get(node.id);
|
|
987
1096
|
const active = node.id === selectedNode?.id;
|
|
988
1097
|
const lines = node.label.match(/.{1,25}(?:\s|$)/g)?.slice(0, 3).map((line) => line.trim()) ?? [node.label.slice(0, 25)];
|
|
989
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ jsxs2("g", { role: "button", tabIndex: 0, "aria-label": `Seleziona memoria: ${node.label}`, onClick: () => setSelectedNodeId(node.id), onKeyDown: (event) => {
|
|
990
1099
|
if (event.key === "Enter" || event.key === " ") {
|
|
991
1100
|
event.preventDefault();
|
|
992
1101
|
setSelectedNodeId(node.id);
|
|
993
1102
|
}
|
|
994
1103
|
}, style: { cursor: "pointer" }, children: [
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
lines.map((line, index) => /* @__PURE__ */
|
|
997
|
-
node.similarity !== null ? /* @__PURE__ */
|
|
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: [
|
|
998
1107
|
Math.round(node.similarity * 100),
|
|
999
1108
|
"% pertinenza"
|
|
1000
1109
|
] }) : null
|
|
1001
1110
|
] }, node.id);
|
|
1002
1111
|
})
|
|
1003
|
-
] }) : /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1007
|
-
/* @__PURE__ */
|
|
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: [
|
|
1008
1117
|
visibleNodes.length,
|
|
1009
1118
|
" mostrate"
|
|
1010
1119
|
] })
|
|
1011
1120
|
] }),
|
|
1012
|
-
selectedNode ? /* @__PURE__ */
|
|
1013
|
-
/* @__PURE__ */
|
|
1014
|
-
/* @__PURE__ */
|
|
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: [
|
|
1015
1124
|
"ID: ",
|
|
1016
|
-
/* @__PURE__ */
|
|
1125
|
+
/* @__PURE__ */ jsx2("code", { children: selectedNode.id })
|
|
1017
1126
|
] }),
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
] }) : /* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
graph.nodes.map((node) => /* @__PURE__ */
|
|
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))
|
|
1023
1132
|
] })
|
|
1024
1133
|
] })
|
|
1025
1134
|
] })
|
|
1026
|
-
] }) : /* @__PURE__ */
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */
|
|
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." })
|
|
1030
1139
|
] }) })
|
|
1031
1140
|
] })
|
|
1032
1141
|
] }),
|
|
1033
|
-
/* @__PURE__ */
|
|
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." })
|
|
1034
1143
|
] });
|
|
1035
1144
|
}
|
|
1036
1145
|
var index_default = { SupermemorySettingsPage, MemoryPage, MemoryGraphPage, MemorySidebarLink };
|