@codemem/server 0.29.3 → 0.30.0-alpha.2

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.3",
3
+ "version": "0.30.0-alpha.2",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -15,19 +15,19 @@
15
15
  "static/"
16
16
  ],
17
17
  "dependencies": {
18
- "@hono/node-server": "^2.0.0",
18
+ "@hono/node-server": "^2.0.1",
19
19
  "drizzle-orm": "^0.45.2",
20
- "hono": "^4.12.14",
20
+ "hono": "^4.12.16",
21
21
  "limiter": "^3.0.0",
22
- "@codemem/core": "^0.29.3"
22
+ "@codemem/core": "^0.30.0-alpha.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/better-sqlite3": "^7.6.13",
26
- "@types/node": "^22.15.21",
27
- "better-sqlite3": "^12.8.0",
28
- "sqlite-vec": "0.1.7-alpha.2",
26
+ "@types/node": "^25.6.0",
27
+ "better-sqlite3": "12.8.0",
28
+ "sqlite-vec": "0.1.9",
29
29
  "typescript": "^6.0.3",
30
- "vite": "^8.0.9",
30
+ "vite": "^8.0.10",
31
31
  "vitest": "^4.1.5"
32
32
  },
33
33
  "repository": {
package/static/app.js CHANGED
@@ -3412,6 +3412,11 @@
3412
3412
  lastSyncCoordinator: null,
3413
3413
  lastCoordinatorAdminStatus: null,
3414
3414
  coordinatorAdminTargetGroup: "",
3415
+ /**
3416
+ * Project names cached from the most recent /api/projects fetch.
3417
+ * Populated on app boot; reused by the Sync peer-scope picker to render
3418
+ * clickable project chips without re-fetching per render.
3419
+ */
3415
3420
  knownProjects: [],
3416
3421
  lastCoordinatorAdminGroups: [],
3417
3422
  lastCoordinatorAdminJoinRequests: [],
@@ -16481,6 +16486,46 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16481
16486
  isWarning: false
16482
16487
  };
16483
16488
  }
16489
+ var SCOPE_REJECTION_REASON_LABELS = {
16490
+ missing_scope: "Missing scope id",
16491
+ sender_not_member: "Sender not a scope member",
16492
+ receiver_not_member: "Receiver not a scope member",
16493
+ stale_epoch: "Stale or revoked membership",
16494
+ scope_mismatch: "Scope mismatch"
16495
+ };
16496
+ /**
16497
+ * Translate the per-peer scope-rejection summary returned by /api/sync/peers
16498
+ * into a UI-ready view. Returns total=0 when nothing has been rejected, in
16499
+ * which case the row should not display a rejection badge or detail block.
16500
+ */
16501
+ function derivePeerScopeRejectionsView(peer) {
16502
+ const summary = peer?.scope_rejections;
16503
+ const total = Math.max(0, Number(summary?.total ?? 0));
16504
+ if (!summary || total === 0) return {
16505
+ total: 0,
16506
+ badgeLabel: null,
16507
+ reasons: [],
16508
+ lastAt: null
16509
+ };
16510
+ const reasons = [];
16511
+ for (const [reason, count] of Object.entries(summary.by_reason ?? {})) {
16512
+ const numeric = Math.max(0, Number(count ?? 0));
16513
+ if (numeric === 0) continue;
16514
+ const key = reason;
16515
+ reasons.push({
16516
+ reason: key,
16517
+ label: SCOPE_REJECTION_REASON_LABELS[key] ?? reason,
16518
+ count: numeric
16519
+ });
16520
+ }
16521
+ reasons.sort((a, b) => b.count - a.count || a.label.localeCompare(b.label));
16522
+ return {
16523
+ total,
16524
+ badgeLabel: total === 1 ? "1 sync rejection" : `${total.toLocaleString()} sync rejections`,
16525
+ reasons,
16526
+ lastAt: summary.last_at ?? null
16527
+ };
16528
+ }
16484
16529
  //#endregion
16485
16530
  //#region src/tabs/sync/view-model/people-derivations.ts
16486
16531
  function deriveDuplicatePeople(actors) {
@@ -17759,6 +17804,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17759
17804
  const trustSummary = derivePeerTrustSummary(peer);
17760
17805
  const directionHint = DIRECTION_GLYPH[derivePeerDirection(peer)];
17761
17806
  const peerStatus = peer.status || {};
17807
+ const scopeRejections = derivePeerScopeRejectionsView(peer);
17762
17808
  const scope = peer.project_scope || {};
17763
17809
  const includeList = listText(scope.include);
17764
17810
  const excludeList = listText(scope.exclude);
@@ -18001,6 +18047,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18001
18047
  className: "badge actor-badge",
18002
18048
  children: "Needs scope review"
18003
18049
  }) : null,
18050
+ scopeRejections.badgeLabel ? /* @__PURE__ */ u("span", {
18051
+ className: "badge badge-offline",
18052
+ title: "Inbound ops rejected by the sharing-domain scope gate. Expand for reason codes.",
18053
+ children: scopeRejections.badgeLabel
18054
+ }) : null,
18004
18055
  peer.discovered_via_group_id ? /* @__PURE__ */ u("span", {
18005
18056
  className: "badge actor-badge",
18006
18057
  title: `Discovered through coordinator group ${peer.discovered_via_group_id}`,
@@ -18088,6 +18139,34 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18088
18139
  className: "peer-meta",
18089
18140
  children: [lastSyncAt ? `Sync: ${formatTimestamp(lastSyncAt)}` : "Sync: never", lastPingAt ? `Ping: ${formatTimestamp(lastPingAt)}` : "Ping: never"].join(" · ")
18090
18141
  }),
18142
+ scopeRejections.total > 0 ? /* @__PURE__ */ u("div", {
18143
+ className: "peer-scope-rejections",
18144
+ "data-peer-rejection-count": scopeRejections.total,
18145
+ children: [
18146
+ /* @__PURE__ */ u("div", {
18147
+ className: "peer-scope-summary",
18148
+ children: "Sharing-rule rejections (24h)"
18149
+ }),
18150
+ /* @__PURE__ */ u("div", {
18151
+ className: "peer-meta",
18152
+ children: "Inbound ops the local fail-closed gate refused. Diagnostics never expose op payloads."
18153
+ }),
18154
+ /* @__PURE__ */ u("ul", {
18155
+ className: "peer-scope-rejections-list",
18156
+ children: scopeRejections.reasons.map((entry) => /* @__PURE__ */ u("li", { children: [/* @__PURE__ */ u("span", {
18157
+ className: "peer-scope-rejection-label",
18158
+ children: entry.label
18159
+ }), /* @__PURE__ */ u("span", {
18160
+ className: "peer-scope-rejection-count",
18161
+ children: entry.count.toLocaleString()
18162
+ })] }, entry.reason))
18163
+ }),
18164
+ scopeRejections.lastAt ? /* @__PURE__ */ u("div", {
18165
+ className: "peer-meta",
18166
+ children: ["Last rejected ", formatTimestamp(scopeRejections.lastAt)]
18167
+ }) : null
18168
+ ]
18169
+ }) : null,
18091
18170
  /* @__PURE__ */ u("div", {
18092
18171
  className: "peer-scope-summary",
18093
18172
  children: "Who this device belongs to"
@@ -19793,7 +19872,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
19793
19872
  try {
19794
19873
  const runtime = await loadRuntimeInfo();
19795
19874
  if (!runtime?.version) return;
19796
- setRuntimeLabel(runtime.version, "cd6e4a0");
19875
+ setRuntimeLabel(runtime.version, "fb31ce1");
19797
19876
  } catch {}
19798
19877
  }
19799
19878
  var lastAnnouncedRefreshState = null;