@codemem/server 0.30.0-alpha.3 → 0.30.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/dist/index.js +162 -52
- package/dist/index.js.map +1 -1
- package/dist/routes/memory.d.ts.map +1 -1
- package/dist/routes/stats.d.ts.map +1 -1
- package/dist/routes/sync.d.ts.map +1 -1
- package/package.json +2 -2
- package/static/app.js +90 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/routes/memory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,eAAe,CAAC;AAWhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/routes/memory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,eAAe,CAAC;AAWhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;AA2StC,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,8EAqYlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/routes/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,WAAW,EAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/routes/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,WAAW,EAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAmN5B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,WAAW,8EA0HtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAGX,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,EAGX,WAAW,EAIX,MAAM,eAAe,CAAC;AA2EvB,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;AAqtCD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,wBAA6B,8EA2W7F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,8EAs7DrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemem/server",
|
|
3
|
-
"version": "0.30.0-alpha.
|
|
3
|
+
"version": "0.30.0-alpha.5",
|
|
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.16",
|
|
21
21
|
"limiter": "^3.0.0",
|
|
22
|
-
"@codemem/core": "^0.30.0-alpha.
|
|
22
|
+
"@codemem/core": "^0.30.0-alpha.5"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/better-sqlite3": "^7.6.13",
|
package/static/app.js
CHANGED
|
@@ -3490,6 +3490,7 @@
|
|
|
3490
3490
|
lastSyncPeers: [],
|
|
3491
3491
|
pendingAcceptedSyncPeers: [],
|
|
3492
3492
|
lastSyncSharingReview: [],
|
|
3493
|
+
lastSyncLegacySharedReview: null,
|
|
3493
3494
|
lastSyncCoordinator: null,
|
|
3494
3495
|
lastCoordinatorAdminStatus: null,
|
|
3495
3496
|
coordinatorAdminTargetGroup: "",
|
|
@@ -13944,6 +13945,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
13944
13945
|
}
|
|
13945
13946
|
//#endregion
|
|
13946
13947
|
//#region src/tabs/health/render/health-overview.ts
|
|
13948
|
+
var SCOPE_BACKFILL_JOB = "scope_id_backfill";
|
|
13947
13949
|
function renderHealthOverview() {
|
|
13948
13950
|
const healthGrid = document.getElementById("healthGrid");
|
|
13949
13951
|
const healthMeta = document.getElementById("healthMeta");
|
|
@@ -13955,6 +13957,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
13955
13957
|
const raw = state.lastRawEventsPayload && typeof state.lastRawEventsPayload === "object" ? state.lastRawEventsPayload : {};
|
|
13956
13958
|
const syncStatus = state.lastSyncStatus || {};
|
|
13957
13959
|
const maintenanceJobs = Array.isArray(stats.maintenance_jobs) ? stats.maintenance_jobs : [];
|
|
13960
|
+
const scopeBackfillJob = maintenanceJobs.find((job) => job.kind === SCOPE_BACKFILL_JOB);
|
|
13958
13961
|
const reliability = stats.reliability || {};
|
|
13959
13962
|
const counts = reliability.counts || {};
|
|
13960
13963
|
const rates = reliability.rates || {};
|
|
@@ -14074,8 +14077,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
14074
14077
|
const progress = total && total > 0 ? `${current.toLocaleString()}/${total.toLocaleString()} ${unit}${pct}` : `${current.toLocaleString()} ${unit}`;
|
|
14075
14078
|
const isFailed = job.status === "failed";
|
|
14076
14079
|
const isCompleted = job.status === "completed";
|
|
14080
|
+
const isScopeBackfill = job.kind === SCOPE_BACKFILL_JOB;
|
|
14077
14081
|
const value = isFailed ? "Failed" : isCompleted ? "Complete" : progress;
|
|
14078
|
-
const detail = isFailed ? String(job.error || "unknown error").trim() : isCompleted ? progress : void 0;
|
|
14082
|
+
const detail = isFailed ? String(job.error || "unknown error").trim() : isCompleted ? isScopeBackfill ? `${progress} · one-time Sharing-domain upgrade finished` : progress : isScopeBackfill ? "One-time upgrade backfill; totals include memories and replication ops" : void 0;
|
|
14079
14083
|
return buildHealthCard({
|
|
14080
14084
|
key: String(job.kind || job.title || "background-maintenance"),
|
|
14081
14085
|
label: String(job.title || job.kind || "Background maintenance"),
|
|
@@ -14083,7 +14087,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
14083
14087
|
detail,
|
|
14084
14088
|
icon: isFailed ? "alert-triangle" : isCompleted ? "check-circle" : "loader",
|
|
14085
14089
|
className: isFailed ? "status-attention" : void 0,
|
|
14086
|
-
title: isFailed ? `Error: ${job.error || "unknown"}` : isCompleted ? `${String(job.title || "Maintenance")} finished` : `${String(job.title || "Maintenance")} in progress`
|
|
14090
|
+
title: isFailed ? `Error: ${job.error || "unknown"}` : isCompleted ? `${String(job.title || "Maintenance")} finished` : isScopeBackfill ? `${String(job.title || "Maintenance")} in progress; inspect with codemem maintenance status` : `${String(job.title || "Maintenance")} in progress`
|
|
14087
14091
|
});
|
|
14088
14092
|
});
|
|
14089
14093
|
renderHealthCards(healthGrid, [
|
|
@@ -14168,6 +14172,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
14168
14172
|
label: "Tag coverage is low. Preview backfill impact.",
|
|
14169
14173
|
command: "codemem db backfill-tags --dry-run"
|
|
14170
14174
|
});
|
|
14175
|
+
if (scopeBackfillJob && scopeBackfillJob.status !== "completed" && recommendations.length < 3) recommendations.push({
|
|
14176
|
+
label: "Sharing-domain upgrade backfill is expected one-time work. Inspect progress if startup feels busy.",
|
|
14177
|
+
command: "codemem maintenance status"
|
|
14178
|
+
});
|
|
14171
14179
|
renderActionList$1(healthActions, recommendations);
|
|
14172
14180
|
healthMeta.textContent = drivers.length ? `Why this status: ${drivers.join(", ")}.` : "Healthy right now. Diagnostics stay available if you want details.";
|
|
14173
14181
|
renderIcons();
|
|
@@ -16346,9 +16354,43 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
16346
16354
|
})
|
|
16347
16355
|
]
|
|
16348
16356
|
}),
|
|
16357
|
+
/* @__PURE__ */ u(AnchorPeerSetupCard, {}),
|
|
16349
16358
|
/* @__PURE__ */ u(SharingDomainsPanel, {})
|
|
16350
16359
|
] });
|
|
16351
16360
|
}
|
|
16361
|
+
function AnchorPeerSetupCard() {
|
|
16362
|
+
return /* @__PURE__ */ u("section", {
|
|
16363
|
+
"aria-labelledby": "anchor-peer-setup-title",
|
|
16364
|
+
className: "settings-group",
|
|
16365
|
+
children: [
|
|
16366
|
+
/* @__PURE__ */ u("h3", {
|
|
16367
|
+
className: "settings-group-title",
|
|
16368
|
+
id: "anchor-peer-setup-title",
|
|
16369
|
+
children: "Always-on peers"
|
|
16370
|
+
}),
|
|
16371
|
+
/* @__PURE__ */ u("p", {
|
|
16372
|
+
className: "small",
|
|
16373
|
+
children: "An anchor peer is just a normal paired device that stays online. It is useful as a stable sync backstop, but it is not a coordinator, relay, or special protocol role."
|
|
16374
|
+
}),
|
|
16375
|
+
/* @__PURE__ */ u("ul", {
|
|
16376
|
+
className: "small",
|
|
16377
|
+
children: [
|
|
16378
|
+
/* @__PURE__ */ u("li", { children: "Coordinator discovery helps peers find each other; it does not grant data access." }),
|
|
16379
|
+
/* @__PURE__ */ u("li", { children: "Explicit Sharing-domain grants decide what an always-on peer can receive." }),
|
|
16380
|
+
/* @__PURE__ */ u("li", { children: "Project include/exclude filters only narrow already-granted domains." }),
|
|
16381
|
+
/* @__PURE__ */ u("li", { children: "Use durable storage and backups for peers you expect to recover after restart." })
|
|
16382
|
+
]
|
|
16383
|
+
}),
|
|
16384
|
+
/* @__PURE__ */ u("a", {
|
|
16385
|
+
className: "settings-link",
|
|
16386
|
+
href: "https://github.com/kunickiaj/codemem/blob/main/docs/anchor-peer-deployment.md",
|
|
16387
|
+
rel: "noreferrer",
|
|
16388
|
+
target: "_blank",
|
|
16389
|
+
children: "Read the anchor-peer deployment guide"
|
|
16390
|
+
})
|
|
16391
|
+
]
|
|
16392
|
+
});
|
|
16393
|
+
}
|
|
16352
16394
|
//#endregion
|
|
16353
16395
|
//#region src/tabs/settings/components/SettingsModalContent.tsx
|
|
16354
16396
|
function SettingsModalContent({ panelProps, activeTab, showAdvanced, renderState, settingsDirty, onClose, onSave, onActiveTabChange, onAdvancedToggle, observerStatusBannerSlot }) {
|
|
@@ -17301,7 +17343,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17301
17343
|
badgeLabel: total === 1 ? "1 Sharing domain" : total > 1 ? `${total} Sharing domains` : "No Sharing domains",
|
|
17302
17344
|
isWarning: total === 0,
|
|
17303
17345
|
domains,
|
|
17304
|
-
emptyMessage: "No
|
|
17346
|
+
emptyMessage: "No Sharing-domain grants exist for this device yet. Project filters below cannot send data by themselves."
|
|
17305
17347
|
};
|
|
17306
17348
|
}
|
|
17307
17349
|
function derivePeerProjectNarrowingView(scope) {
|
|
@@ -18614,6 +18656,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
18614
18656
|
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.";
|
|
18615
18657
|
const lastSyncAt = String(peerStatus.last_sync_at || peerStatus.last_sync_at_utc || "");
|
|
18616
18658
|
const lastPingAt = String(peerStatus.last_ping_at || peerStatus.last_ping_at_utc || "");
|
|
18659
|
+
const discoverySummary = peer.discovered_via_group_id ? `Discovery: seen through coordinator group ${peer.discovered_via_group_id}. Discovery helps find devices; Sharing-domain grants above decide data access.` : peer.discovered_via_coordinator_id ? `Discovery: seen through coordinator ${peer.discovered_via_coordinator_id}. Discovery helps find devices; Sharing-domain grants above decide data access.` : null;
|
|
18617
18660
|
const scopeEditorOpen = openPeerScopeEditors.has(peerId);
|
|
18618
18661
|
const scopeReviewRequested = consumePeerScopeReviewRequest(peerId);
|
|
18619
18662
|
const cardRef = A$1(null);
|
|
@@ -18940,6 +18983,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
18940
18983
|
className: "peer-addresses",
|
|
18941
18984
|
children: addressLine
|
|
18942
18985
|
}),
|
|
18986
|
+
discoverySummary ? /* @__PURE__ */ u("div", {
|
|
18987
|
+
className: "peer-meta",
|
|
18988
|
+
children: discoverySummary
|
|
18989
|
+
}) : null,
|
|
18943
18990
|
/* @__PURE__ */ u("div", {
|
|
18944
18991
|
className: "peer-meta",
|
|
18945
18992
|
children: [lastSyncAt ? `Sync: ${formatTimestamp(lastSyncAt)}` : "Sync: never", lastPingAt ? `Ping: ${formatTimestamp(lastPingAt)}` : "Ping: never"].join(" · ")
|
|
@@ -20483,11 +20530,34 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
20483
20530
|
})]
|
|
20484
20531
|
});
|
|
20485
20532
|
}
|
|
20486
|
-
function
|
|
20487
|
-
return /* @__PURE__ */ u(
|
|
20533
|
+
function LegacySharedReviewRow({ item }) {
|
|
20534
|
+
return /* @__PURE__ */ u("div", {
|
|
20535
|
+
className: "actor-row",
|
|
20536
|
+
children: /* @__PURE__ */ u("div", {
|
|
20537
|
+
className: "actor-details",
|
|
20538
|
+
children: [/* @__PURE__ */ u("div", {
|
|
20539
|
+
className: "actor-title",
|
|
20540
|
+
children: [/* @__PURE__ */ u("strong", { children: "Legacy shared review" }), /* @__PURE__ */ u("span", {
|
|
20541
|
+
className: "badge badge-offline",
|
|
20542
|
+
children: "Needs review"
|
|
20543
|
+
})]
|
|
20544
|
+
}), /* @__PURE__ */ u("div", {
|
|
20545
|
+
className: "peer-meta",
|
|
20546
|
+
children: [
|
|
20547
|
+
item.memoryCount.toLocaleString(),
|
|
20548
|
+
" historical shared memories are in ",
|
|
20549
|
+
item.scopeId,
|
|
20550
|
+
". 0.30 placed ambiguous older shared data there conservatively; review mappings before promoting it. Remapping or revocation does not erase data already copied to peers."
|
|
20551
|
+
]
|
|
20552
|
+
})]
|
|
20553
|
+
})
|
|
20554
|
+
});
|
|
20555
|
+
}
|
|
20556
|
+
function SyncSharingReview({ items, legacyReview, onReview }) {
|
|
20557
|
+
return /* @__PURE__ */ u(k$3, { children: [legacyReview ? /* @__PURE__ */ u(LegacySharedReviewRow, { item: legacyReview }) : null, items.map((item) => /* @__PURE__ */ u(SharingReviewRow, {
|
|
20488
20558
|
item,
|
|
20489
20559
|
onReview
|
|
20490
|
-
}, `${item.peerName}:${item.actorId}:${item.scopeLabel}`)) });
|
|
20560
|
+
}, `${item.peerName}:${item.actorId}:${item.scopeLabel}`))] });
|
|
20491
20561
|
}
|
|
20492
20562
|
//#endregion
|
|
20493
20563
|
//#region src/tabs/sync/team-sync/render/sharing-review.ts
|
|
@@ -20501,14 +20571,23 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
20501
20571
|
const meta = document.getElementById("syncSharingReviewMeta");
|
|
20502
20572
|
const list = document.getElementById("syncSharingReviewList");
|
|
20503
20573
|
if (!panel || !meta || !list) return;
|
|
20574
|
+
const title = panel.querySelector(".settings-group-title");
|
|
20504
20575
|
const items = Array.isArray(state.lastSyncSharingReview) ? state.lastSyncSharingReview : [];
|
|
20505
|
-
|
|
20576
|
+
const legacyRaw = state.lastSyncLegacySharedReview;
|
|
20577
|
+
const legacyCount = Math.max(0, Number(legacyRaw?.memory_count ?? 0));
|
|
20578
|
+
const legacyReview = legacyRaw?.has_data ? {
|
|
20579
|
+
memoryCount: legacyCount,
|
|
20580
|
+
scopeId: String(legacyRaw.scope_id || "legacy-shared-review")
|
|
20581
|
+
} : null;
|
|
20582
|
+
if (!items.length && !legacyReview) {
|
|
20506
20583
|
clearSyncMount(list);
|
|
20507
20584
|
panel.hidden = true;
|
|
20508
20585
|
return;
|
|
20509
20586
|
}
|
|
20510
20587
|
panel.hidden = false;
|
|
20511
|
-
|
|
20588
|
+
if (title) title.textContent = legacyReview ? "Sharing review" : "What teammates will receive";
|
|
20589
|
+
const scopeLabel = state.currentProject ? `current project (${state.currentProject})` : "all allowed projects";
|
|
20590
|
+
meta.textContent = legacyReview ? `Review conservative upgrade state before promoting historical shared data. Teammates receive memories from ${scopeLabel} by default once Sharing-domain grants allow it.` : `Teammates receive memories from ${scopeLabel} by default. Use Only me on a memory when it should stay local.`;
|
|
20512
20591
|
renderIntoSyncMount(list, _$3(SyncSharingReview, {
|
|
20513
20592
|
items: items.map((item) => ({
|
|
20514
20593
|
actorDisplayName: String(item.actor_display_name || item.actor_id || "unknown"),
|
|
@@ -20518,6 +20597,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
20518
20597
|
scopeLabel: String(item.scope_label || "All allowed projects"),
|
|
20519
20598
|
shareableCount: Number(item.shareable_count || 0)
|
|
20520
20599
|
})),
|
|
20600
|
+
legacyReview,
|
|
20521
20601
|
onReview: openFeedSharingReview
|
|
20522
20602
|
}));
|
|
20523
20603
|
}
|
|
@@ -20620,6 +20700,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
20620
20700
|
state.pendingAcceptedSyncPeers = pendingPeers;
|
|
20621
20701
|
state.lastSyncPeers = [...payloadPeers, ...pendingPeers];
|
|
20622
20702
|
state.lastSyncSharingReview = payload.sharing_review || [];
|
|
20703
|
+
state.lastSyncLegacySharedReview = payload.legacy_shared_review && typeof payload.legacy_shared_review === "object" ? payload.legacy_shared_review : null;
|
|
20623
20704
|
state.lastSyncCoordinator = payload.coordinator || null;
|
|
20624
20705
|
state.lastCoordinatorAdminStatus = coordinatorAdminStatus && typeof coordinatorAdminStatus === "object" ? coordinatorAdminStatus : null;
|
|
20625
20706
|
state.lastSyncJoinRequests = Array.isArray(payload.join_requests) ? payload.join_requests : [];
|
|
@@ -20702,7 +20783,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
20702
20783
|
try {
|
|
20703
20784
|
const runtime = await loadRuntimeInfo();
|
|
20704
20785
|
if (!runtime?.version) return;
|
|
20705
|
-
setRuntimeLabel(runtime.version, "
|
|
20786
|
+
setRuntimeLabel(runtime.version, "74b37ea");
|
|
20706
20787
|
} catch {}
|
|
20707
20788
|
}
|
|
20708
20789
|
var lastAnnouncedRefreshState = null;
|