@codemem/server 0.29.2 → 0.30.0-alpha.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAGX,WAAW,EAGX,MAAM,eAAe,CAAC;AAiDvB,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;AAEF,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;AA2+BD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,wBAA6B,8EAiS7F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,8EAykDrD"}
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAGX,WAAW,EAGX,MAAM,eAAe,CAAC;AAkEvB,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;AAEF,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;AA0jCD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,wBAA6B,8EAmW7F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,8EAu1DrD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemem/server",
3
- "version": "0.29.2",
3
+ "version": "0.30.0-alpha.1",
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.14",
21
21
  "limiter": "^3.0.0",
22
- "@codemem/core": "^0.29.2"
22
+ "@codemem/core": "^0.30.0-alpha.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/better-sqlite3": "^7.6.13",
package/static/app.js CHANGED
@@ -16481,6 +16481,46 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16481
16481
  isWarning: false
16482
16482
  };
16483
16483
  }
16484
+ var SCOPE_REJECTION_REASON_LABELS = {
16485
+ missing_scope: "Missing scope id",
16486
+ sender_not_member: "Sender not a scope member",
16487
+ receiver_not_member: "Receiver not a scope member",
16488
+ stale_epoch: "Stale or revoked membership",
16489
+ scope_mismatch: "Scope mismatch"
16490
+ };
16491
+ /**
16492
+ * Translate the per-peer scope-rejection summary returned by /api/sync/peers
16493
+ * into a UI-ready view. Returns total=0 when nothing has been rejected, in
16494
+ * which case the row should not display a rejection badge or detail block.
16495
+ */
16496
+ function derivePeerScopeRejectionsView(peer) {
16497
+ const summary = peer?.scope_rejections;
16498
+ const total = Math.max(0, Number(summary?.total ?? 0));
16499
+ if (!summary || total === 0) return {
16500
+ total: 0,
16501
+ badgeLabel: null,
16502
+ reasons: [],
16503
+ lastAt: null
16504
+ };
16505
+ const reasons = [];
16506
+ for (const [reason, count] of Object.entries(summary.by_reason ?? {})) {
16507
+ const numeric = Math.max(0, Number(count ?? 0));
16508
+ if (numeric === 0) continue;
16509
+ const key = reason;
16510
+ reasons.push({
16511
+ reason: key,
16512
+ label: SCOPE_REJECTION_REASON_LABELS[key] ?? reason,
16513
+ count: numeric
16514
+ });
16515
+ }
16516
+ reasons.sort((a, b) => b.count - a.count || a.label.localeCompare(b.label));
16517
+ return {
16518
+ total,
16519
+ badgeLabel: total === 1 ? "1 sync rejection" : `${total.toLocaleString()} sync rejections`,
16520
+ reasons,
16521
+ lastAt: summary.last_at ?? null
16522
+ };
16523
+ }
16484
16524
  //#endregion
16485
16525
  //#region src/tabs/sync/view-model/people-derivations.ts
16486
16526
  function deriveDuplicatePeople(actors) {
@@ -17759,6 +17799,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17759
17799
  const trustSummary = derivePeerTrustSummary(peer);
17760
17800
  const directionHint = DIRECTION_GLYPH[derivePeerDirection(peer)];
17761
17801
  const peerStatus = peer.status || {};
17802
+ const scopeRejections = derivePeerScopeRejectionsView(peer);
17762
17803
  const scope = peer.project_scope || {};
17763
17804
  const includeList = listText(scope.include);
17764
17805
  const excludeList = listText(scope.exclude);
@@ -18001,6 +18042,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18001
18042
  className: "badge actor-badge",
18002
18043
  children: "Needs scope review"
18003
18044
  }) : null,
18045
+ scopeRejections.badgeLabel ? /* @__PURE__ */ u("span", {
18046
+ className: "badge badge-offline",
18047
+ title: "Inbound ops rejected by the sharing-domain scope gate. Expand for reason codes.",
18048
+ children: scopeRejections.badgeLabel
18049
+ }) : null,
18004
18050
  peer.discovered_via_group_id ? /* @__PURE__ */ u("span", {
18005
18051
  className: "badge actor-badge",
18006
18052
  title: `Discovered through coordinator group ${peer.discovered_via_group_id}`,
@@ -18088,6 +18134,34 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18088
18134
  className: "peer-meta",
18089
18135
  children: [lastSyncAt ? `Sync: ${formatTimestamp(lastSyncAt)}` : "Sync: never", lastPingAt ? `Ping: ${formatTimestamp(lastPingAt)}` : "Ping: never"].join(" · ")
18090
18136
  }),
18137
+ scopeRejections.total > 0 ? /* @__PURE__ */ u("div", {
18138
+ className: "peer-scope-rejections",
18139
+ "data-peer-rejection-count": scopeRejections.total,
18140
+ children: [
18141
+ /* @__PURE__ */ u("div", {
18142
+ className: "peer-scope-summary",
18143
+ children: "Sharing-rule rejections (24h)"
18144
+ }),
18145
+ /* @__PURE__ */ u("div", {
18146
+ className: "peer-meta",
18147
+ children: "Inbound ops the local fail-closed gate refused. Diagnostics never expose op payloads."
18148
+ }),
18149
+ /* @__PURE__ */ u("ul", {
18150
+ className: "peer-scope-rejections-list",
18151
+ children: scopeRejections.reasons.map((entry) => /* @__PURE__ */ u("li", { children: [/* @__PURE__ */ u("span", {
18152
+ className: "peer-scope-rejection-label",
18153
+ children: entry.label
18154
+ }), /* @__PURE__ */ u("span", {
18155
+ className: "peer-scope-rejection-count",
18156
+ children: entry.count.toLocaleString()
18157
+ })] }, entry.reason))
18158
+ }),
18159
+ scopeRejections.lastAt ? /* @__PURE__ */ u("div", {
18160
+ className: "peer-meta",
18161
+ children: ["Last rejected ", formatTimestamp(scopeRejections.lastAt)]
18162
+ }) : null
18163
+ ]
18164
+ }) : null,
18091
18165
  /* @__PURE__ */ u("div", {
18092
18166
  className: "peer-scope-summary",
18093
18167
  children: "Who this device belongs to"
@@ -19793,7 +19867,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
19793
19867
  try {
19794
19868
  const runtime = await loadRuntimeInfo();
19795
19869
  if (!runtime?.version) return;
19796
- setRuntimeLabel(runtime.version, "a713817");
19870
+ setRuntimeLabel(runtime.version, "16eeb5c");
19797
19871
  } catch {}
19798
19872
  }
19799
19873
  var lastAnnouncedRefreshState = null;