@codemem/server 0.32.1 → 0.32.3
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/index.js +91 -38
- package/dist/index.js.map +1 -1
- package/dist/routes/sync.d.ts.map +1 -1
- package/package.json +2 -2
- package/static/app.js +36 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAKX,WAAW,EAIX,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAKX,WAAW,EAIX,MAAM,eAAe,CAAC;AAmFvB,OAAO,EAAgB,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;AACtC,KAAK,iBAAiB,GAAG;IACxB,KAAK,EACF,UAAU,GACV,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,IAAI,CAAC;IACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAoBF,UAAU,wBAAwB;IACjC,cAAc,CAAC,EAAE;QAChB,OAAO,EAAE,0BAA0B,CAAC;QACpC,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,wBAAwB,EAAE,MAAM,CAAC;QACjC,4BAA4B,EAAE,MAAM,CAAC;KACrC,CAAC;CACF;AAqyDD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,wBAA6B,8EA+W7F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,8EAkpErD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemem/server",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"drizzle-orm": "^0.45.2",
|
|
20
20
|
"hono": "^4.12.21",
|
|
21
21
|
"limiter": "^3.0.0",
|
|
22
|
-
"@codemem/core": "^0.32.
|
|
22
|
+
"@codemem/core": "^0.32.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/better-sqlite3": "^7.6.13",
|
package/static/app.js
CHANGED
|
@@ -3248,13 +3248,12 @@
|
|
|
3248
3248
|
return payload;
|
|
3249
3249
|
}
|
|
3250
3250
|
async function acceptDiscoveredPeer(peerDeviceId, fingerprint) {
|
|
3251
|
+
const body = { peer_device_id: peerDeviceId };
|
|
3252
|
+
if (fingerprint) body.fingerprint = fingerprint;
|
|
3251
3253
|
const resp = await fetch("/api/sync/peers/accept-discovered", {
|
|
3252
3254
|
method: "POST",
|
|
3253
3255
|
headers: { "Content-Type": "application/json" },
|
|
3254
|
-
body: JSON.stringify(
|
|
3255
|
-
peer_device_id: peerDeviceId,
|
|
3256
|
-
fingerprint
|
|
3257
|
-
})
|
|
3256
|
+
body: JSON.stringify(body)
|
|
3258
3257
|
});
|
|
3259
3258
|
const text = await resp.text();
|
|
3260
3259
|
let payload = {};
|
|
@@ -3461,11 +3460,16 @@
|
|
|
3461
3460
|
if (!resp.ok) throw new Error(payloadError(payload) || text || "request failed");
|
|
3462
3461
|
return payload;
|
|
3463
3462
|
}
|
|
3464
|
-
async function triggerSync(
|
|
3463
|
+
async function triggerSync(target) {
|
|
3464
|
+
const address = typeof target === "string" ? target.trim() : target?.address?.trim();
|
|
3465
|
+
const peerDeviceId = typeof target === "string" ? "" : target?.peerDeviceId?.trim();
|
|
3466
|
+
const payload = {};
|
|
3467
|
+
if (address) payload.address = address;
|
|
3468
|
+
if (peerDeviceId) payload.peer_device_id = peerDeviceId;
|
|
3465
3469
|
const resp = await fetch("/api/sync/run", {
|
|
3466
3470
|
method: "POST",
|
|
3467
3471
|
headers: { "Content-Type": "application/json" },
|
|
3468
|
-
body: JSON.stringify(
|
|
3472
|
+
body: JSON.stringify(payload)
|
|
3469
3473
|
});
|
|
3470
3474
|
const { text, payload: body } = await readJsonPayload(resp);
|
|
3471
3475
|
if (!resp.ok) throw new Error(payloadError(body) || text || "request failed");
|
|
@@ -4118,6 +4122,7 @@
|
|
|
4118
4122
|
deviceActionPendingKind: "",
|
|
4119
4123
|
groupRenameDrafts: /* @__PURE__ */ new Map(),
|
|
4120
4124
|
deviceRenameDrafts: /* @__PURE__ */ new Map(),
|
|
4125
|
+
deviceRenameServerNames: /* @__PURE__ */ new Map(),
|
|
4121
4126
|
groupPreferencesOpen: /* @__PURE__ */ new Set(),
|
|
4122
4127
|
groupPreferencesDrafts: /* @__PURE__ */ new Map(),
|
|
4123
4128
|
groupScopeManagementOpen: /* @__PURE__ */ new Set(),
|
|
@@ -7897,14 +7902,22 @@
|
|
|
7897
7902
|
}
|
|
7898
7903
|
function reconcileDeviceRenameDrafts() {
|
|
7899
7904
|
const next = /* @__PURE__ */ new Map();
|
|
7905
|
+
const nextServerNames = /* @__PURE__ */ new Map();
|
|
7900
7906
|
const items = Array.isArray(state.lastCoordinatorAdminDevices) ? state.lastCoordinatorAdminDevices : [];
|
|
7901
7907
|
for (const item of items) {
|
|
7902
7908
|
const deviceId = String(item.device_id || "").trim();
|
|
7903
7909
|
if (!deviceId) continue;
|
|
7904
|
-
|
|
7910
|
+
const serverName = String(item.display_name || "");
|
|
7911
|
+
const existingDraft = coordinatorAdminState.deviceRenameDrafts.get(deviceId);
|
|
7912
|
+
const previousServerName = coordinatorAdminState.deviceRenameServerNames.get(deviceId);
|
|
7913
|
+
const hasDirtyDraft = existingDraft !== void 0 && (previousServerName === void 0 || existingDraft !== previousServerName);
|
|
7914
|
+
next.set(deviceId, hasDirtyDraft ? existingDraft : serverName);
|
|
7915
|
+
nextServerNames.set(deviceId, serverName);
|
|
7905
7916
|
}
|
|
7906
7917
|
coordinatorAdminState.deviceRenameDrafts.clear();
|
|
7907
7918
|
for (const [deviceId, name] of next.entries()) coordinatorAdminState.deviceRenameDrafts.set(deviceId, name);
|
|
7919
|
+
coordinatorAdminState.deviceRenameServerNames.clear();
|
|
7920
|
+
for (const [deviceId, name] of nextServerNames.entries()) coordinatorAdminState.deviceRenameServerNames.set(deviceId, name);
|
|
7908
7921
|
}
|
|
7909
7922
|
//#endregion
|
|
7910
7923
|
//#region src/tabs/coordinator-admin/data/team-card.ts
|
|
@@ -11138,6 +11151,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
11138
11151
|
state.lastCoordinatorAdminJoinRequests = [];
|
|
11139
11152
|
state.lastCoordinatorAdminDevices = [];
|
|
11140
11153
|
coordinatorAdminState.deviceRenameDrafts.clear();
|
|
11154
|
+
coordinatorAdminState.deviceRenameServerNames.clear();
|
|
11141
11155
|
renderShell();
|
|
11142
11156
|
return;
|
|
11143
11157
|
}
|
|
@@ -11166,7 +11180,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
11166
11180
|
reconcileDeviceRenameDrafts();
|
|
11167
11181
|
} catch {
|
|
11168
11182
|
state.lastCoordinatorAdminDevices = [];
|
|
11169
|
-
coordinatorAdminState.deviceRenameDrafts.clear();
|
|
11170
11183
|
}
|
|
11171
11184
|
try {
|
|
11172
11185
|
coordinatorAdminState.availableProjects = await loadProjects$1();
|
|
@@ -11179,6 +11192,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
11179
11192
|
state.lastCoordinatorAdminJoinRequests = [];
|
|
11180
11193
|
state.lastCoordinatorAdminDevices = [];
|
|
11181
11194
|
coordinatorAdminState.deviceRenameDrafts.clear();
|
|
11195
|
+
coordinatorAdminState.deviceRenameServerNames.clear();
|
|
11182
11196
|
}
|
|
11183
11197
|
renderShell();
|
|
11184
11198
|
}
|
|
@@ -18051,9 +18065,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
18051
18065
|
}
|
|
18052
18066
|
function shouldShowCoordinatorReviewAction(input) {
|
|
18053
18067
|
const approvalSummary = deriveCoordinatorApprovalSummary(input);
|
|
18054
|
-
|
|
18055
|
-
const fingerprint = cleanText(input.device?.fingerprint);
|
|
18056
|
-
if (!deviceId || !fingerprint) return false;
|
|
18068
|
+
if (!cleanText(input.device?.device_id)) return false;
|
|
18057
18069
|
if (input.device?.stale || input.hasAmbiguousCoordinatorGroup) return false;
|
|
18058
18070
|
if (!input.pairedLocally) return true;
|
|
18059
18071
|
return approvalSummary.state === "needs-your-approval";
|
|
@@ -19662,7 +19674,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
19662
19674
|
const excludeList = listText(scope.exclude);
|
|
19663
19675
|
const primaryAddress = pickPrimaryAddress(peer.addresses);
|
|
19664
19676
|
const peerAddresses = Array.isArray(peer.addresses) ? Array.from(new Set(peer.addresses.filter(Boolean).map((value) => String(value)))) : [];
|
|
19665
|
-
const
|
|
19677
|
+
const rawHiddenAddressCount = Number(peer.address_count ?? 0);
|
|
19678
|
+
const hiddenAddressCount = Number.isFinite(rawHiddenAddressCount) && rawHiddenAddressCount > 0 ? rawHiddenAddressCount : 0;
|
|
19679
|
+
const addressLine = peerAddresses.length ? peerAddresses.map((address) => isSyncRedactionEnabled() ? redactAddress(address) : address).join(" · ") : hiddenAddressCount > 0 ? `${hiddenAddressCount} ${hiddenAddressCount === 1 ? "address" : "addresses"} hidden` : "No addresses";
|
|
19666
19680
|
const assignmentSummary = peer.actor_display_name ? `This device belongs to ${peer.claimed_local_actor ? "you" : String(peer.actor_display_name)}.` : "This device is not assigned to anyone yet.";
|
|
19667
19681
|
const lastSyncAt = String(peerStatus.last_sync_at || peerStatus.last_sync_at_utc || "");
|
|
19668
19682
|
const lastPingAt = String(peerStatus.last_ping_at || peerStatus.last_ping_at_utc || "");
|
|
@@ -19767,7 +19781,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
19767
19781
|
}
|
|
19768
19782
|
}
|
|
19769
19783
|
async function sync() {
|
|
19770
|
-
if (!primaryAddress) return;
|
|
19771
19784
|
if (pendingScopeReview) {
|
|
19772
19785
|
if (!await openSyncConfirmDialog({
|
|
19773
19786
|
title: `Sync ${displayName} before scope review?`,
|
|
@@ -19943,8 +19956,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
19943
19956
|
/* @__PURE__ */ u("button", {
|
|
19944
19957
|
type: "button",
|
|
19945
19958
|
className: "settings-button",
|
|
19946
|
-
disabled:
|
|
19959
|
+
disabled: syncBusy,
|
|
19947
19960
|
onClick: () => void sync(),
|
|
19961
|
+
title: primaryAddress ? void 0 : "Address details are hidden; sync will target this device by ID.",
|
|
19948
19962
|
children: syncBusy ? "Syncing…" : "Sync now"
|
|
19949
19963
|
}),
|
|
19950
19964
|
/* @__PURE__ */ u("div", {
|
|
@@ -20254,8 +20268,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
20254
20268
|
},
|
|
20255
20269
|
onSync: async (peer, address) => {
|
|
20256
20270
|
try {
|
|
20257
|
-
const summary = summarizeSyncRunResult(await triggerSync(address));
|
|
20258
20271
|
const peerId = String(peer?.peer_device_id || "");
|
|
20272
|
+
const summary = summarizeSyncRunResult(await triggerSync({
|
|
20273
|
+
address,
|
|
20274
|
+
peerDeviceId: peerId || void 0
|
|
20275
|
+
}));
|
|
20259
20276
|
let feedback;
|
|
20260
20277
|
if (!summary.ok) feedback = {
|
|
20261
20278
|
message: summary.message,
|
|
@@ -21337,7 +21354,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
21337
21354
|
pairedLocally: Boolean(pairedPeer)
|
|
21338
21355
|
});
|
|
21339
21356
|
const addresses = Array.isArray(device.addresses) ? device.addresses : [];
|
|
21340
|
-
const
|
|
21357
|
+
const rawHiddenAddressCount = Number(device.address_count ?? 0);
|
|
21358
|
+
const hiddenAddressCount = Number.isFinite(rawHiddenAddressCount) && rawHiddenAddressCount > 0 ? rawHiddenAddressCount : 0;
|
|
21359
|
+
const noteParts = [addresses.length ? addresses.map((address) => isSyncRedactionEnabled() ? redactAddress(String(address || "")) : String(address || "")).filter(Boolean).join(" · ") : hiddenAddressCount > 0 ? `${hiddenAddressCount} ${device.stale ? "last-known" : "fresh"} ${hiddenAddressCount === 1 ? "address" : "addresses"} hidden` : "No fresh addresses"];
|
|
21341
21360
|
if (!addresses.length && displayTitle) noteParts.push(`device id: ${deviceId}`);
|
|
21342
21361
|
let actionMessage = null;
|
|
21343
21362
|
let mode = canAccept ? "accept" : "none";
|
|
@@ -22203,7 +22222,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
22203
22222
|
try {
|
|
22204
22223
|
const runtime = await loadRuntimeInfo();
|
|
22205
22224
|
if (!runtime?.version) return;
|
|
22206
|
-
setRuntimeLabel(runtime.version, "
|
|
22225
|
+
setRuntimeLabel(runtime.version, "882d43d");
|
|
22207
22226
|
} catch {}
|
|
22208
22227
|
}
|
|
22209
22228
|
var lastAnnouncedRefreshState = null;
|