@krak-stack/registry 0.10.14 → 0.10.16

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.
@@ -57,6 +57,7 @@ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
57
57
 
58
58
  // ../../src/components/ui/dialog.tsx
59
59
  import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
60
+ import { cn as cn2 } from "cn";
60
61
  import { XIcon } from "lucide-react";
61
62
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
62
63
  function Dialog({ ...props }) {
@@ -77,13 +78,14 @@ function DialogOverlay({
77
78
  }) {
78
79
  return /* @__PURE__ */ jsx2(DialogPrimitive.Backdrop, {
79
80
  "data-slot": "dialog-overlay",
80
- 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),
81
+ 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),
81
82
  ...props
82
83
  });
83
84
  }
84
85
  function DialogContent({
85
86
  className,
86
87
  children,
88
+ showCloseButton = true,
87
89
  ...props
88
90
  }) {
89
91
  return /* @__PURE__ */ jsxs(DialogPortal, {
@@ -91,16 +93,19 @@ function DialogContent({
91
93
  /* @__PURE__ */ jsx2(DialogOverlay, {}),
92
94
  /* @__PURE__ */ jsxs(DialogPrimitive.Popup, {
93
95
  "data-slot": "dialog-content",
94
- 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),
96
+ 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),
95
97
  ...props,
96
98
  children: [
97
99
  children,
98
- /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
99
- 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",
100
+ showCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
101
+ "data-slot": "dialog-close",
102
+ render: /* @__PURE__ */ jsx2(Button, {
103
+ variant: "ghost",
104
+ className: "absolute top-4 right-4",
105
+ size: "icon-sm"
106
+ }),
100
107
  children: [
101
- /* @__PURE__ */ jsx2(XIcon, {
102
- className: "size-4"
103
- }),
108
+ /* @__PURE__ */ jsx2(XIcon, {}),
104
109
  /* @__PURE__ */ jsx2("span", {
105
110
  className: "sr-only",
106
111
  children: "Close"
@@ -115,24 +120,35 @@ function DialogContent({
115
120
  function DialogHeader({ className, ...props }) {
116
121
  return /* @__PURE__ */ jsx2("div", {
117
122
  "data-slot": "dialog-header",
118
- className: cn("grid gap-1.5", className),
119
- ...props
120
- });
121
- }
122
- function DialogFooter({ className, ...props }) {
123
- return /* @__PURE__ */ jsx2("div", {
124
- "data-slot": "dialog-footer",
125
- className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
123
+ className: cn2("flex flex-col gap-2", className),
126
124
  ...props
127
125
  });
128
126
  }
129
- function DialogTitle({
127
+ function DialogFooter({
130
128
  className,
129
+ showCloseButton = false,
130
+ children,
131
131
  ...props
132
132
  }) {
133
+ return /* @__PURE__ */ jsxs("div", {
134
+ "data-slot": "dialog-footer",
135
+ className: cn2("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
136
+ ...props,
137
+ children: [
138
+ children,
139
+ showCloseButton && /* @__PURE__ */ jsx2(DialogPrimitive.Close, {
140
+ render: /* @__PURE__ */ jsx2(Button, {
141
+ variant: "outline"
142
+ }),
143
+ children: "Close"
144
+ })
145
+ ]
146
+ });
147
+ }
148
+ function DialogTitle({ className, ...props }) {
133
149
  return /* @__PURE__ */ jsx2(DialogPrimitive.Title, {
134
150
  "data-slot": "dialog-title",
135
- className: cn("text-lg font-medium", className),
151
+ className: cn2("leading-none font-medium", className),
136
152
  ...props
137
153
  });
138
154
  }
@@ -142,7 +158,7 @@ function DialogDescription({
142
158
  }) {
143
159
  return /* @__PURE__ */ jsx2(DialogPrimitive.Description, {
144
160
  "data-slot": "dialog-description",
145
- className: cn("text-sm text-muted-foreground", className),
161
+ className: cn2("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3", className),
146
162
  ...props
147
163
  });
148
164
  }
@@ -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.14",
3
+ "version": "0.10.16",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,6 +17,10 @@
17
17
  "type": "module",
18
18
  "sideEffects": false,
19
19
  "exports": {
20
+ "./support": {
21
+ "types": "./dist/components/support.d.ts",
22
+ "import": "./dist/components/support.js"
23
+ },
20
24
  "./support-dialog": {
21
25
  "types": "./dist/components/support-dialog.d.ts",
22
26
  "import": "./dist/components/support-dialog.js"
@@ -396,6 +400,10 @@
396
400
  "types": "./dist/services/notification/persistence/schema.d.ts",
397
401
  "import": "./dist/services/notification/persistence/schema.js"
398
402
  },
403
+ "./clamav": {
404
+ "types": "./dist/services/clamav/index.d.ts",
405
+ "import": "./dist/services/clamav/index.js"
406
+ },
399
407
  "./service-s3": {
400
408
  "types": "./dist/services/s3/index.d.ts",
401
409
  "import": "./dist/services/s3/index.js"