@kimuson/claude-code-viewer 0.6.1-beta.2 → 0.6.1-beta.4

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/main.js CHANGED
@@ -12,7 +12,7 @@ import { Effect as Effect71 } from "effect";
12
12
  // package.json
13
13
  var package_default = {
14
14
  name: "@kimuson/claude-code-viewer",
15
- version: "0.6.1-beta.2",
15
+ version: "0.6.1-beta.4",
16
16
  description: "A full-featured web-based Claude Code client that provides complete interactive functionality for managing Claude Code projects.",
17
17
  homepage: "https://github.com/d-kimuson/claude-code-viewer",
18
18
  license: "MIT",
@@ -5539,11 +5539,52 @@ import { Context as Context26, Effect as Effect34, Layer as Layer28, Ref as Ref7
5539
5539
  import { ulid as ulid5 } from "ulid";
5540
5540
  import webpush from "web-push";
5541
5541
  import { z as z31 } from "zod";
5542
+
5543
+ // src/server/core/notification/services/pushError.ts
5544
+ var isRecord = (value) => typeof value === "object" && value !== null;
5545
+ var getString = (value) => {
5546
+ if (typeof value === "string") return value;
5547
+ return void 0;
5548
+ };
5549
+ var getNumber = (value) => {
5550
+ if (typeof value === "number") return value;
5551
+ return void 0;
5552
+ };
5553
+ var extractPushErrorDetails = (error) => {
5554
+ if (!isRecord(error)) {
5555
+ return {
5556
+ statusCode: void 0,
5557
+ body: void 0,
5558
+ message: getString(error)
5559
+ };
5560
+ }
5561
+ return {
5562
+ statusCode: getNumber(error.statusCode),
5563
+ body: getString(error.body),
5564
+ message: getString(error.message)
5565
+ };
5566
+ };
5567
+ var shouldDropSubscriptionForPushError = (error) => {
5568
+ const { statusCode } = extractPushErrorDetails(error);
5569
+ return statusCode === 404 || statusCode === 410;
5570
+ };
5571
+ var formatPushError = (error) => {
5572
+ const details = extractPushErrorDetails(error);
5573
+ if (details.statusCode !== void 0 || details.body !== void 0) {
5574
+ const status = details.statusCode ?? "unknown";
5575
+ const body = details.body ?? "empty";
5576
+ return `status=${status}, body=${body}`;
5577
+ }
5578
+ return `message=${details.message ?? "unknown"}`;
5579
+ };
5580
+
5581
+ // src/server/core/notification/services/NotificationService.ts
5542
5582
  var vapidKeysSchema = z31.object({
5543
5583
  publicKey: z31.string(),
5544
5584
  privateKey: z31.string()
5545
5585
  });
5546
5586
  var VAPID_KEYS_FILENAME = ".claude-code-viewer/vapid-keys.json";
5587
+ var DEFAULT_VAPID_SUBJECT = "mailto:noreply@example.com";
5547
5588
  var getVapidKeysPath = (fs) => Effect34.gen(function* () {
5548
5589
  const home = process.env.HOME ?? process.env.USERPROFILE ?? "/tmp";
5549
5590
  const dirPath = `${home}/.claude-code-viewer`;
@@ -5587,11 +5628,7 @@ var LayerImpl23 = Effect34.gen(function* () {
5587
5628
  });
5588
5629
  })
5589
5630
  );
5590
- webpush.setVapidDetails(
5591
- "mailto:noreply@claude-code-viewer.local",
5592
- vapidKeys.publicKey,
5593
- vapidKeys.privateKey
5594
- );
5631
+ webpush.setVapidDetails(DEFAULT_VAPID_SUBJECT, vapidKeys.publicKey, vapidKeys.privateKey);
5595
5632
  yield* eventBus.on("sessionProcessChanged", (event) => {
5596
5633
  const { changed } = event;
5597
5634
  if (changed.type === "paused" || changed.type === "completed") {
@@ -5680,10 +5717,21 @@ var LayerImpl23 = Effect34.gen(function* () {
5680
5717
  },
5681
5718
  payload
5682
5719
  ),
5683
- catch: () => {
5684
- invalidEndpoints.push(sub.endpoint);
5720
+ catch: (error) => {
5721
+ return error;
5685
5722
  }
5686
- }).pipe(Effect34.catchAll(() => Effect34.void)),
5723
+ }).pipe(
5724
+ Effect34.catchAll(
5725
+ (error) => Effect34.gen(function* () {
5726
+ yield* Effect34.logWarning(
5727
+ `WebPush send failed for endpoint ${sub.endpoint}: ${formatPushError(error)}`
5728
+ );
5729
+ if (shouldDropSubscriptionForPushError(error)) {
5730
+ invalidEndpoints.push(sub.endpoint);
5731
+ }
5732
+ })
5733
+ )
5734
+ ),
5687
5735
  { concurrency: "unbounded" }
5688
5736
  );
5689
5737
  if (invalidEndpoints.length > 0) {