@codemem/server 0.22.0-alpha.4 → 0.22.0-alpha.5
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/package.json +2 -2
- package/static/app.js +36 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemem/server",
|
|
3
|
-
"version": "0.22.0-alpha.
|
|
3
|
+
"version": "0.22.0-alpha.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@hono/node-server": "^1.14.3",
|
|
19
19
|
"drizzle-orm": "^0.45.1",
|
|
20
20
|
"hono": "^4.7.10",
|
|
21
|
-
"@codemem/core": "^0.22.0-alpha.
|
|
21
|
+
"@codemem/core": "^0.22.0-alpha.5"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/better-sqlite3": "^7.6.13",
|
package/static/app.js
CHANGED
|
@@ -1871,6 +1871,31 @@
|
|
|
1871
1871
|
});
|
|
1872
1872
|
return [...groups.values()].filter((item) => item.actorIds.length > 1).sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
1873
1873
|
}
|
|
1874
|
+
function deriveVisiblePeopleActors(input) {
|
|
1875
|
+
const actors = Array.isArray(input.actors) ? input.actors : [];
|
|
1876
|
+
const peers = Array.isArray(input.peers) ? input.peers : [];
|
|
1877
|
+
const duplicatePeople = Array.isArray(input.duplicatePeople) ? input.duplicatePeople : [];
|
|
1878
|
+
const assignedCounts = /* @__PURE__ */ new Map();
|
|
1879
|
+
peers.forEach((peer) => {
|
|
1880
|
+
const actorId = cleanText(peer?.actor_id);
|
|
1881
|
+
if (!actorId) return;
|
|
1882
|
+
assignedCounts.set(actorId, (assignedCounts.get(actorId) ?? 0) + 1);
|
|
1883
|
+
});
|
|
1884
|
+
const hiddenIds = /* @__PURE__ */ new Set();
|
|
1885
|
+
duplicatePeople.forEach((candidate) => {
|
|
1886
|
+
if (!candidate.includesLocal) return;
|
|
1887
|
+
candidate.actorIds.forEach((actorId) => {
|
|
1888
|
+
const actor = actors.find((item) => cleanText(item?.actor_id) === actorId);
|
|
1889
|
+
if (!actor || actor.is_local) return;
|
|
1890
|
+
if ((assignedCounts.get(actorId) ?? 0) > 0) return;
|
|
1891
|
+
hiddenIds.add(actorId);
|
|
1892
|
+
});
|
|
1893
|
+
});
|
|
1894
|
+
return {
|
|
1895
|
+
visibleActors: actors.filter((actor) => !hiddenIds.has(cleanText(actor?.actor_id))),
|
|
1896
|
+
hiddenLocalDuplicateCount: hiddenIds.size
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1874
1899
|
function createRepairItem(device) {
|
|
1875
1900
|
return {
|
|
1876
1901
|
id: `repair:${device.id}`,
|
|
@@ -3013,8 +3038,16 @@
|
|
|
3013
3038
|
if (!actorList) return;
|
|
3014
3039
|
hideSkeleton("syncActorsSkeleton");
|
|
3015
3040
|
actorList.textContent = "";
|
|
3016
|
-
const
|
|
3017
|
-
|
|
3041
|
+
const actorVisibility = deriveVisiblePeopleActors({
|
|
3042
|
+
actors: state.lastSyncActors,
|
|
3043
|
+
peers: state.lastSyncPeers,
|
|
3044
|
+
duplicatePeople: state.lastSyncViewModel?.duplicatePeople
|
|
3045
|
+
});
|
|
3046
|
+
const actors = actorVisibility.visibleActors;
|
|
3047
|
+
if (actorMeta) {
|
|
3048
|
+
actorMeta.textContent = actors.length ? "Create, rename, and combine people here. Assign each device below. Non-local people receive memories from allowed projects unless you mark them Only me." : "No named people yet. Create one here, then assign devices below.";
|
|
3049
|
+
if (actorVisibility.hiddenLocalDuplicateCount > 0) actorMeta.textContent += ` ${actorVisibility.hiddenLocalDuplicateCount} unresolved duplicate ${actorVisibility.hiddenLocalDuplicateCount === 1 ? "entry is" : "entries are"} hidden here until reviewed in Needs attention.`;
|
|
3050
|
+
}
|
|
3018
3051
|
if (!actors.length) {
|
|
3019
3052
|
actorList.appendChild(el("div", "sync-empty-state", "No people yet. Create one to represent yourself or a teammate."));
|
|
3020
3053
|
return;
|
|
@@ -3027,7 +3060,7 @@
|
|
|
3027
3060
|
const count = assignedActorCount(String(actor.actor_id || ""));
|
|
3028
3061
|
const badge = el("span", `badge actor-badge${actor.is_local ? " local" : ""}`, actor.is_local ? "Local" : `${count} device${count === 1 ? "" : "s"}`);
|
|
3029
3062
|
title.append(name, badge);
|
|
3030
|
-
const note = el("div", "peer-meta", actor.is_local ?
|
|
3063
|
+
const note = el("div", "peer-meta", actor.is_local ? `Used for this device and same-person devices.${actorVisibility.hiddenLocalDuplicateCount > 0 ? ` ${actorVisibility.hiddenLocalDuplicateCount} unresolved duplicate ${actorVisibility.hiddenLocalDuplicateCount === 1 ? "entry is" : "entries are"} hidden until reviewed in Needs attention.` : ""}` : `${count} assigned device${count === 1 ? "" : "s"}`);
|
|
3031
3064
|
details.append(title, note);
|
|
3032
3065
|
const actions = el("div", "actor-actions");
|
|
3033
3066
|
if (actor.is_local) actions.appendChild(el("div", "peer-meta", "Rename in config"));
|