@krak-stack/registry 0.10.13 → 0.10.15

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.
@@ -504,7 +504,7 @@ function NotificationMenu({
504
504
  className: "flex shrink-0 flex-col gap-2 border-b p-2",
505
505
  children: [
506
506
  /* @__PURE__ */ jsxs2(TabsList, {
507
- className: "grid w-full min-w-0 grid-cols-2",
507
+ className: "w-full min-w-0 gap-2",
508
508
  children: [
509
509
  /* @__PURE__ */ jsxs2(TabsTrigger, {
510
510
  className: "min-w-0",
@@ -618,9 +618,9 @@ function NotificationList({
618
618
  });
619
619
  }
620
620
  return /* @__PURE__ */ jsx7(ScrollArea, {
621
- className: "flex max-h-[min(24rem,60svh)] min-h-0 min-w-0 flex-auto flex-col overflow-hidden [&>[data-slot=scroll-area-viewport]]:h-auto [&>[data-slot=scroll-area-viewport]]:min-h-0 [&>[data-slot=scroll-area-viewport][data-has-overflow-y]]:[--notification-scrollbar-gutter:0.375rem]",
621
+ className: "flex max-h-[min(24rem,60svh)] min-h-0 min-w-0 flex-auto flex-col overflow-hidden [&>[data-slot=scroll-area-viewport]]:h-auto [&>[data-slot=scroll-area-viewport]]:min-h-0 [&>[data-slot=scroll-area-viewport][data-has-overflow-y]]:[--notification-scrollbar-gutter:--spacing(2.5)]",
622
622
  children: /* @__PURE__ */ jsx7("div", {
623
- className: "flex min-w-0 flex-col",
623
+ className: "divide-border flex min-w-0 flex-col divide-y pe-[var(--notification-scrollbar-gutter,0px)]",
624
624
  children: notifications.map((notification) => /* @__PURE__ */ jsx7(NotificationListItem, {
625
625
  labels,
626
626
  locale,
@@ -641,15 +641,10 @@ function NotificationListItem({
641
641
  renderItem
642
642
  }) {
643
643
  const unread = !notification.readAt && !notification.archivedAt;
644
- const selectNotification = () => {
645
- if (onNavigate) {
646
- onNavigate(notification);
647
- return;
648
- }
649
- if (notification.href && globalThis.window) {
650
- window.location.assign(notification.href);
651
- }
652
- };
644
+ const { href } = notification;
645
+ const canArchive = !notification.archivedAt && onArchive;
646
+ const rowClassName = cn("h-auto w-full min-w-0 justify-start rounded-none px-3 py-4 text-start [overflow-wrap:anywhere] whitespace-normal", canArchive && "pe-14");
647
+ const actionClassName = cn(rowClassName, "focus-visible:inset-ring-ring/50 focus-visible:ring-0 focus-visible:inset-ring-3 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:-outline-offset-2 forced-colors:focus-visible:outline-solid");
653
648
  const content = renderItem?.(notification) ?? /* @__PURE__ */ jsxs2("span", {
654
649
  className: "flex min-w-0 flex-1 flex-col gap-1",
655
650
  children: [
@@ -677,23 +672,35 @@ function NotificationListItem({
677
672
  ]
678
673
  });
679
674
  return /* @__PURE__ */ jsxs2("div", {
680
- className: cn("group relative min-w-0", unread && "bg-muted/70"),
675
+ className: cn("relative flex min-w-0", unread && "bg-muted/70"),
681
676
  "data-unread": unread || undefined,
682
677
  children: [
683
- /* @__PURE__ */ jsx7(Button, {
684
- className: cn("h-auto w-full min-w-0 cursor-pointer justify-start rounded-none border-0 border-b border-border px-3 py-4 pr-[calc(0.75rem+var(--notification-scrollbar-gutter,0px))] text-left [overflow-wrap:anywhere] whitespace-normal group-last:border-b-0", !notification.archivedAt && onArchive && "pr-[calc(3.5rem+var(--notification-scrollbar-gutter,0px))]"),
685
- onClick: selectNotification,
678
+ href ? /* @__PURE__ */ jsx7("a", {
679
+ className: cn(buttonVariants({ variant: "ghost" }), actionClassName),
680
+ href,
681
+ onClick: (event) => {
682
+ if (!onNavigate || event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
683
+ return;
684
+ }
685
+ event.preventDefault();
686
+ onNavigate(notification);
687
+ },
688
+ children: content
689
+ }) : onNavigate ? /* @__PURE__ */ jsx7(Button, {
690
+ className: actionClassName,
691
+ onClick: () => onNavigate(notification),
686
692
  type: "button",
687
693
  variant: "ghost",
688
694
  children: content
695
+ }) : /* @__PURE__ */ jsx7("div", {
696
+ className: cn(rowClassName, "flex items-center text-sm font-medium"),
697
+ children: content
689
698
  }),
690
- !notification.archivedAt && onArchive ? /* @__PURE__ */ jsx7("div", {
691
- className: "absolute top-3 right-[calc(0.5rem+var(--notification-scrollbar-gutter,0px))]",
692
- children: /* @__PURE__ */ jsx7(ArchiveButton, {
693
- label: labels.archiveItem(notificationTitle(notification)),
694
- notificationIds: [notification.id],
695
- onArchive
696
- })
699
+ canArchive ? /* @__PURE__ */ jsx7(ArchiveButton, {
700
+ className: "absolute end-2 top-2",
701
+ label: labels.archiveItem(notificationTitle(notification)),
702
+ notificationIds: [notification.id],
703
+ onArchive: canArchive
697
704
  }) : null
698
705
  ]
699
706
  });
@@ -744,7 +751,7 @@ function ArchiveButton({
744
751
  className,
745
752
  disabled: pending,
746
753
  onClick: () => void archiveNotifications(),
747
- size: showLabel ? "sm" : "icon-sm",
754
+ size: showLabel ? "default" : "icon",
748
755
  title: label,
749
756
  type: "button",
750
757
  variant: showLabel ? "outline" : "ghost",
@@ -36,6 +36,24 @@ var SynthesizeSpeech = Schema.Struct({
36
36
  text: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(4000), Schema.isPattern(/\S/)),
37
37
  language: Schema.Literals(["en", "fr", "es", "zh", "ja", "ko"])
38
38
  }).annotate({ identifier: "SynthesizeSpeech" });
39
+ var ElevenLabsSpeechRequest = Schema.Struct({
40
+ model: Schema.Literal("elevenlabs/eleven-flash-v2-5"),
41
+ input: Schema.Struct({
42
+ text: SynthesizeSpeech.fields.text,
43
+ language_code: SynthesizeSpeech.fields.language,
44
+ voice_id: Schema.NonEmptyString,
45
+ output_format: Schema.Literal("mp3_44100_128")
46
+ })
47
+ }).annotate({ identifier: "GatewayElevenLabsSpeechRequest" });
48
+ var GatewayAudioUrl = Schema.URLFromString.check(Schema.makeFilter((url) => url.protocol === "https:" && !url.port && !url.username && !url.password && (url.hostname.endsWith(".r2.cloudflarestorage.com") || url.hostname.endsWith(".r2.dev") || url.hostname === "examples.aig.cloudflare.com") || "Expected an HTTPS Cloudflare audio URL")).annotate({ identifier: "GatewayAudioUrl" });
49
+ var CompletedSpeech = Schema.Struct({
50
+ state: Schema.Literal("Completed"),
51
+ result: Schema.Struct({ audio: GatewayAudioUrl })
52
+ });
53
+ var GatewaySpeechResponse = Schema.Union([
54
+ Schema.Struct({ success: Schema.Literal(true), result: CompletedSpeech }),
55
+ CompletedSpeech
56
+ ]).annotate({ identifier: "GatewaySpeechResponse" });
39
57
  var MeloRequest = Schema.Struct({
40
58
  prompt: SynthesizeSpeech.fields.text,
41
59
  lang: SynthesizeSpeech.fields.language
@@ -41,6 +41,24 @@ var SynthesizeSpeech = Schema.Struct({
41
41
  text: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(4000), Schema.isPattern(/\S/)),
42
42
  language: Schema.Literals(["en", "fr", "es", "zh", "ja", "ko"])
43
43
  }).annotate({ identifier: "SynthesizeSpeech" });
44
+ var ElevenLabsSpeechRequest = Schema.Struct({
45
+ model: Schema.Literal("elevenlabs/eleven-flash-v2-5"),
46
+ input: Schema.Struct({
47
+ text: SynthesizeSpeech.fields.text,
48
+ language_code: SynthesizeSpeech.fields.language,
49
+ voice_id: Schema.NonEmptyString,
50
+ output_format: Schema.Literal("mp3_44100_128")
51
+ })
52
+ }).annotate({ identifier: "GatewayElevenLabsSpeechRequest" });
53
+ var GatewayAudioUrl = Schema.URLFromString.check(Schema.makeFilter((url) => url.protocol === "https:" && !url.port && !url.username && !url.password && (url.hostname.endsWith(".r2.cloudflarestorage.com") || url.hostname.endsWith(".r2.dev") || url.hostname === "examples.aig.cloudflare.com") || "Expected an HTTPS Cloudflare audio URL")).annotate({ identifier: "GatewayAudioUrl" });
54
+ var CompletedSpeech = Schema.Struct({
55
+ state: Schema.Literal("Completed"),
56
+ result: Schema.Struct({ audio: GatewayAudioUrl })
57
+ });
58
+ var GatewaySpeechResponse = Schema.Union([
59
+ Schema.Struct({ success: Schema.Literal(true), result: CompletedSpeech }),
60
+ CompletedSpeech
61
+ ]).annotate({ identifier: "GatewaySpeechResponse" });
44
62
  var MeloRequest = Schema.Struct({
45
63
  prompt: SynthesizeSpeech.fields.text,
46
64
  lang: SynthesizeSpeech.fields.language
@@ -82,25 +100,33 @@ class Speech extends Context.Service()("@krak-stack/registry/speech/Speech", {
82
100
  const payload = yield* Schema2.decodeEffect(SynthesizeSpeech)(input);
83
101
  const url = yield* Schema2.decodeEffect(Schema2.URLFromString)(options.baseUrl);
84
102
  const path = yield* Schema2.decodeEffect(Schema2.String.check(Schema2.isPattern(/^\/.*accounts\/[^/]+\/ai\/(v1|run)\/?$/)))(url.pathname);
85
- url.pathname = path.replace(/\/(v1|run)\/?$/, "/run/@cf/myshell-ai/melotts");
103
+ url.pathname = path.replace(/\/(v1|run)\/?$/, "/run");
86
104
  url.search = "";
87
105
  url.hash = "";
88
106
  const request = yield* HttpClientRequest.post(url.toString()).pipe(HttpClientRequest.bearerToken(options.apiKey), HttpClientRequest.setHeaders({
89
107
  "cf-aig-gateway-id": options.gatewayId,
90
108
  "cf-aig-skip-cache": "true",
91
- "cf-aig-collect-log": "false",
92
- accept: "audio/mpeg"
93
- }), HttpClientRequest.schemaBodyJson(MeloRequest)({
94
- prompt: payload.text,
95
- lang: payload.language
109
+ "cf-aig-collect-log": "false"
110
+ }), HttpClientRequest.schemaBodyJson(ElevenLabsSpeechRequest)({
111
+ model: "elevenlabs/eleven-flash-v2-5",
112
+ input: {
113
+ text: payload.text,
114
+ language_code: payload.language,
115
+ voice_id: "JBFqnCBsd6RMkjVDRZzb",
116
+ output_format: "mp3_44100_128"
117
+ }
96
118
  }));
97
119
  const response = yield* http.execute(request);
98
- if (response.headers["content-type"]?.split(";")[0]?.trim() === "audio/mpeg") {
99
- const bytes = new Uint8Array(yield* response.arrayBuffer);
100
- return yield* Schema2.decodeEffect(Schema2.Uint8Array.check(Schema2.isMinLength(1)))(bytes);
120
+ const body = yield* HttpClientResponse.schemaBodyJson(GatewaySpeechResponse)(response);
121
+ const { result } = "success" in body ? body.result : body;
122
+ const audio = yield* http.get(result.audio).pipe(Effect.provideService(FetchHttpClient.RequestInit, {
123
+ credentials: "omit",
124
+ redirect: "error"
125
+ }), Effect.provideService(HttpClient.TracerDisabledWhen, () => true));
126
+ if (audio.headers["content-type"]?.split(";")[0]?.trim() !== "audio/mpeg") {
127
+ return yield* new SpeechUnavailable({});
101
128
  }
102
- const body = yield* HttpClientResponse.schemaBodyJson(MeloResponse)(response);
103
- return body.result.audio;
129
+ return yield* Schema2.decodeEffect(Schema2.Uint8Array.check(Schema2.isMinLength(1)))(new Uint8Array(yield* audio.arrayBuffer));
104
130
  }, Effect.timeout("60 seconds"), Effect.mapError(() => new SpeechUnavailable({})));
105
131
  return { transcribe, synthesize };
106
132
  })
@@ -32,10 +32,35 @@ export declare const SynthesizeSpeech: Schema.Struct<{
32
32
  readonly language: Schema.Literals<readonly ["en", "fr", "es", "zh", "ja", "ko"]>;
33
33
  }>;
34
34
  export type SynthesizeSpeech = typeof SynthesizeSpeech.Type;
35
+ export declare const ElevenLabsSpeechRequest: Schema.Struct<{
36
+ readonly model: Schema.Literal<"elevenlabs/eleven-flash-v2-5">;
37
+ readonly input: Schema.Struct<{
38
+ readonly text: Schema.String;
39
+ readonly language_code: Schema.Literals<readonly ["en", "fr", "es", "zh", "ja", "ko"]>;
40
+ readonly voice_id: Schema.NonEmptyString;
41
+ readonly output_format: Schema.Literal<"mp3_44100_128">;
42
+ }>;
43
+ }>;
44
+ export declare const GatewaySpeechResponse: Schema.Union<readonly [Schema.Struct<{
45
+ readonly success: Schema.Literal<true>;
46
+ readonly result: Schema.Struct<{
47
+ readonly state: Schema.Literal<"Completed">;
48
+ readonly result: Schema.Struct<{
49
+ readonly audio: Schema.URLFromString;
50
+ }>;
51
+ }>;
52
+ }>, Schema.Struct<{
53
+ readonly state: Schema.Literal<"Completed">;
54
+ readonly result: Schema.Struct<{
55
+ readonly audio: Schema.URLFromString;
56
+ }>;
57
+ }>]>;
58
+ /** @deprecated Legacy wire schema; the service no longer calls MeloTTS. */
35
59
  export declare const MeloRequest: Schema.Struct<{
36
60
  readonly prompt: Schema.String;
37
61
  readonly lang: Schema.Literals<readonly ["en", "fr", "es", "zh", "ja", "ko"]>;
38
62
  }>;
63
+ /** @deprecated Legacy wire schema; the service no longer calls MeloTTS. */
39
64
  export declare const MeloResponse: Schema.Struct<{
40
65
  readonly success: Schema.Literal<true>;
41
66
  readonly result: Schema.Struct<{
@@ -32,6 +32,24 @@ var SynthesizeSpeech = Schema.Struct({
32
32
  text: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(4000), Schema.isPattern(/\S/)),
33
33
  language: Schema.Literals(["en", "fr", "es", "zh", "ja", "ko"])
34
34
  }).annotate({ identifier: "SynthesizeSpeech" });
35
+ var ElevenLabsSpeechRequest = Schema.Struct({
36
+ model: Schema.Literal("elevenlabs/eleven-flash-v2-5"),
37
+ input: Schema.Struct({
38
+ text: SynthesizeSpeech.fields.text,
39
+ language_code: SynthesizeSpeech.fields.language,
40
+ voice_id: Schema.NonEmptyString,
41
+ output_format: Schema.Literal("mp3_44100_128")
42
+ })
43
+ }).annotate({ identifier: "GatewayElevenLabsSpeechRequest" });
44
+ var GatewayAudioUrl = Schema.URLFromString.check(Schema.makeFilter((url) => url.protocol === "https:" && !url.port && !url.username && !url.password && (url.hostname.endsWith(".r2.cloudflarestorage.com") || url.hostname.endsWith(".r2.dev") || url.hostname === "examples.aig.cloudflare.com") || "Expected an HTTPS Cloudflare audio URL")).annotate({ identifier: "GatewayAudioUrl" });
45
+ var CompletedSpeech = Schema.Struct({
46
+ state: Schema.Literal("Completed"),
47
+ result: Schema.Struct({ audio: GatewayAudioUrl })
48
+ });
49
+ var GatewaySpeechResponse = Schema.Union([
50
+ Schema.Struct({ success: Schema.Literal(true), result: CompletedSpeech }),
51
+ CompletedSpeech
52
+ ]).annotate({ identifier: "GatewaySpeechResponse" });
35
53
  var MeloRequest = Schema.Struct({
36
54
  prompt: SynthesizeSpeech.fields.text,
37
55
  lang: SynthesizeSpeech.fields.language
@@ -44,6 +62,8 @@ var MeloResponse = Schema.Struct({
44
62
  }).annotate({ identifier: "GatewayMeloResponse" });
45
63
  export {
46
64
  AudioMimeType,
65
+ ElevenLabsSpeechRequest,
66
+ GatewaySpeechResponse,
47
67
  MAX_AUDIO_BYTES,
48
68
  MeloRequest,
49
69
  MeloResponse,
@@ -4854,6 +4854,7 @@ function CodeBlock({
4854
4854
 
4855
4855
  // ../../src/components/ui/dialog.tsx
4856
4856
  import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
4857
+ import { cn as cn2 } from "cn";
4857
4858
  import { XIcon } from "lucide-react";
4858
4859
  import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
4859
4860
  function Dialog({ ...props }) {
@@ -4874,13 +4875,14 @@ function DialogOverlay({
4874
4875
  }) {
4875
4876
  return /* @__PURE__ */ jsx18(DialogPrimitive.Backdrop, {
4876
4877
  "data-slot": "dialog-overlay",
4877
- className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
4878
+ className: cn2("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs", className),
4878
4879
  ...props
4879
4880
  });
4880
4881
  }
4881
4882
  function DialogContent({
4882
4883
  className,
4883
4884
  children,
4885
+ showCloseButton = true,
4884
4886
  ...props
4885
4887
  }) {
4886
4888
  return /* @__PURE__ */ jsxs12(DialogPortal, {
@@ -4888,16 +4890,19 @@ function DialogContent({
4888
4890
  /* @__PURE__ */ jsx18(DialogOverlay, {}),
4889
4891
  /* @__PURE__ */ jsxs12(DialogPrimitive.Popup, {
4890
4892
  "data-slot": "dialog-content",
4891
- className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
4893
+ className: cn2("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md", className),
4892
4894
  ...props,
4893
4895
  children: [
4894
4896
  children,
4895
- /* @__PURE__ */ jsxs12(DialogPrimitive.Close, {
4896
- className: "focus-visible:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:outline-none disabled:pointer-events-none",
4897
+ showCloseButton && /* @__PURE__ */ jsxs12(DialogPrimitive.Close, {
4898
+ "data-slot": "dialog-close",
4899
+ render: /* @__PURE__ */ jsx18(Button, {
4900
+ variant: "ghost",
4901
+ className: "absolute top-4 right-4",
4902
+ size: "icon-sm"
4903
+ }),
4897
4904
  children: [
4898
- /* @__PURE__ */ jsx18(XIcon, {
4899
- className: "size-4"
4900
- }),
4905
+ /* @__PURE__ */ jsx18(XIcon, {}),
4901
4906
  /* @__PURE__ */ jsx18("span", {
4902
4907
  className: "sr-only",
4903
4908
  children: "Close"
@@ -4912,17 +4917,14 @@ function DialogContent({
4912
4917
  function DialogHeader({ className, ...props }) {
4913
4918
  return /* @__PURE__ */ jsx18("div", {
4914
4919
  "data-slot": "dialog-header",
4915
- className: cn("grid gap-1.5", className),
4920
+ className: cn2("flex flex-col gap-2", className),
4916
4921
  ...props
4917
4922
  });
4918
4923
  }
4919
- function DialogTitle({
4920
- className,
4921
- ...props
4922
- }) {
4924
+ function DialogTitle({ className, ...props }) {
4923
4925
  return /* @__PURE__ */ jsx18(DialogPrimitive.Title, {
4924
4926
  "data-slot": "dialog-title",
4925
- className: cn("text-lg font-medium", className),
4927
+ className: cn2("leading-none font-medium", className),
4926
4928
  ...props
4927
4929
  });
4928
4930
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.10.13",
3
+ "version": "0.10.15",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -396,6 +396,10 @@
396
396
  "types": "./dist/services/notification/persistence/schema.d.ts",
397
397
  "import": "./dist/services/notification/persistence/schema.js"
398
398
  },
399
+ "./clamav": {
400
+ "types": "./dist/services/clamav/index.d.ts",
401
+ "import": "./dist/services/clamav/index.js"
402
+ },
399
403
  "./service-s3": {
400
404
  "types": "./dist/services/s3/index.d.ts",
401
405
  "import": "./dist/services/s3/index.js"