@contractspec/example.voice-providers 1.57.0 → 1.59.0

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.
Files changed (59) hide show
  1. package/.turbo/turbo-build.log +43 -46
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +25 -0
  4. package/dist/browser/connection.sample.js +55 -0
  5. package/dist/browser/docs/index.js +36 -0
  6. package/dist/browser/docs/voice-providers.docblock.js +36 -0
  7. package/dist/browser/example.js +33 -0
  8. package/dist/browser/handlers/create-provider.js +35 -0
  9. package/dist/browser/handlers/list-voices.js +41 -0
  10. package/dist/browser/handlers/synthesize.js +41 -0
  11. package/dist/browser/index.js +171 -0
  12. package/dist/browser/run.js +179 -0
  13. package/dist/connection.sample.d.ts +4 -8
  14. package/dist/connection.sample.d.ts.map +1 -1
  15. package/dist/connection.sample.js +54 -49
  16. package/dist/docs/index.d.ts +2 -1
  17. package/dist/docs/index.d.ts.map +1 -0
  18. package/dist/docs/index.js +37 -1
  19. package/dist/docs/voice-providers.docblock.d.ts +2 -1
  20. package/dist/docs/voice-providers.docblock.d.ts.map +1 -0
  21. package/dist/docs/voice-providers.docblock.js +35 -29
  22. package/dist/example.d.ts +2 -6
  23. package/dist/example.d.ts.map +1 -1
  24. package/dist/example.js +32 -44
  25. package/dist/handlers/create-provider.d.ts +21 -25
  26. package/dist/handlers/create-provider.d.ts.map +1 -1
  27. package/dist/handlers/create-provider.js +32 -28
  28. package/dist/handlers/list-voices.d.ts +3 -7
  29. package/dist/handlers/list-voices.d.ts.map +1 -1
  30. package/dist/handlers/list-voices.js +39 -7
  31. package/dist/handlers/synthesize.d.ts +5 -9
  32. package/dist/handlers/synthesize.d.ts.map +1 -1
  33. package/dist/handlers/synthesize.js +39 -7
  34. package/dist/index.d.ts +7 -6
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +172 -8
  37. package/dist/node/connection.sample.js +55 -0
  38. package/dist/node/docs/index.js +36 -0
  39. package/dist/node/docs/voice-providers.docblock.js +36 -0
  40. package/dist/node/example.js +33 -0
  41. package/dist/node/handlers/create-provider.js +35 -0
  42. package/dist/node/handlers/list-voices.js +41 -0
  43. package/dist/node/handlers/synthesize.js +41 -0
  44. package/dist/node/index.js +171 -0
  45. package/dist/node/run.js +179 -0
  46. package/dist/run.d.ts +1 -4
  47. package/dist/run.d.ts.map +1 -1
  48. package/dist/run.js +160 -98
  49. package/package.json +93 -32
  50. package/tsdown.config.js +1 -2
  51. package/.turbo/turbo-build$colon$bundle.log +0 -46
  52. package/dist/connection.sample.js.map +0 -1
  53. package/dist/docs/voice-providers.docblock.js.map +0 -1
  54. package/dist/example.js.map +0 -1
  55. package/dist/handlers/create-provider.js.map +0 -1
  56. package/dist/handlers/list-voices.js.map +0 -1
  57. package/dist/handlers/synthesize.js.map +0 -1
  58. package/dist/run.js.map +0 -1
  59. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,179 @@
1
+ // src/handlers/create-provider.ts
2
+ import { FalVoiceProvider } from "@contractspec/integration.providers-impls/impls/fal-voice";
3
+ import { GradiumVoiceProvider } from "@contractspec/integration.providers-impls/impls/gradium-voice";
4
+ function createVoiceProvider(input) {
5
+ const { integrationKey, secrets, config } = input;
6
+ if (!secrets.apiKey) {
7
+ throw new Error("Voice provider apiKey is required.");
8
+ }
9
+ switch (integrationKey) {
10
+ case "ai-voice.gradium":
11
+ return new GradiumVoiceProvider({
12
+ apiKey: secrets.apiKey,
13
+ defaultVoiceId: config?.defaultVoiceId,
14
+ region: config?.region,
15
+ baseUrl: config?.baseUrl,
16
+ timeoutMs: config?.timeoutMs,
17
+ outputFormat: config?.outputFormat
18
+ });
19
+ case "ai-voice.fal":
20
+ return new FalVoiceProvider({
21
+ apiKey: secrets.apiKey,
22
+ modelId: config?.modelId,
23
+ defaultVoiceUrl: config?.defaultVoiceUrl,
24
+ defaultExaggeration: config?.defaultExaggeration,
25
+ defaultTemperature: config?.defaultTemperature,
26
+ defaultCfg: config?.defaultCfg,
27
+ pollIntervalMs: config?.pollIntervalMs
28
+ });
29
+ default:
30
+ throw new Error(`Unsupported voice provider: ${integrationKey}`);
31
+ }
32
+ }
33
+
34
+ // src/handlers/list-voices.ts
35
+ async function listVoices(input) {
36
+ const provider = createVoiceProvider(input);
37
+ return provider.listVoices();
38
+ }
39
+
40
+ // src/handlers/synthesize.ts
41
+ async function synthesizeVoice(input) {
42
+ const provider = createVoiceProvider(input);
43
+ return provider.synthesize(input.synthesis);
44
+ }
45
+
46
+ // src/run.ts
47
+ async function runVoiceProvidersExampleFromEnv() {
48
+ const integrationKey = resolveIntegrationKey();
49
+ const mode = resolveMode();
50
+ const dryRun = process.env.CONTRACTSPEC_VOICE_DRY_RUN === "true";
51
+ const config = resolveConfig(integrationKey);
52
+ const text = process.env.CONTRACTSPEC_VOICE_TEXT ?? "Hello from ContractSpec voice providers example.";
53
+ const voiceId = process.env.CONTRACTSPEC_VOICE_ID;
54
+ if (dryRun) {
55
+ return {
56
+ integrationKey,
57
+ mode,
58
+ dryRun,
59
+ text,
60
+ voiceId,
61
+ config
62
+ };
63
+ }
64
+ const input = {
65
+ integrationKey,
66
+ secrets: {
67
+ apiKey: resolveApiKey(integrationKey)
68
+ },
69
+ config
70
+ };
71
+ const output = {
72
+ integrationKey,
73
+ mode,
74
+ dryRun
75
+ };
76
+ if (mode === "list" || mode === "both") {
77
+ const voices = await listVoices(input);
78
+ output.voices = voices;
79
+ }
80
+ if (mode === "synthesize" || mode === "both") {
81
+ const result = await synthesizeVoice({
82
+ ...input,
83
+ synthesis: {
84
+ text,
85
+ voiceId
86
+ }
87
+ });
88
+ output.synthesis = {
89
+ format: result.format,
90
+ sampleRateHz: result.sampleRateHz,
91
+ bytes: result.audio.length,
92
+ url: result.url
93
+ };
94
+ }
95
+ return output;
96
+ }
97
+ function resolveMode() {
98
+ const raw = (process.env.CONTRACTSPEC_VOICE_MODE ?? "both").toLowerCase();
99
+ if (raw === "list" || raw === "synthesize" || raw === "both") {
100
+ return raw;
101
+ }
102
+ throw new Error(`Unsupported CONTRACTSPEC_VOICE_MODE: ${raw}. Use list, synthesize, or both.`);
103
+ }
104
+ function resolveIntegrationKey() {
105
+ const raw = (process.env.CONTRACTSPEC_VOICE_PROVIDER ?? "gradium").toLowerCase();
106
+ if (raw === "gradium")
107
+ return "ai-voice.gradium";
108
+ if (raw === "fal")
109
+ return "ai-voice.fal";
110
+ throw new Error(`Unsupported CONTRACTSPEC_VOICE_PROVIDER: ${raw}. Use gradium or fal.`);
111
+ }
112
+ function resolveApiKey(integrationKey) {
113
+ const shared = process.env.CONTRACTSPEC_VOICE_API_KEY;
114
+ if (shared)
115
+ return shared;
116
+ const specific = integrationKey === "ai-voice.gradium" ? process.env.GRADIUM_API_KEY : process.env.FAL_KEY;
117
+ if (!specific) {
118
+ const envName = integrationKey === "ai-voice.gradium" ? "GRADIUM_API_KEY" : "FAL_KEY";
119
+ throw new Error(`Missing API key. Set CONTRACTSPEC_VOICE_API_KEY or ${envName}.`);
120
+ }
121
+ return specific;
122
+ }
123
+ function resolveConfig(integrationKey) {
124
+ if (integrationKey === "ai-voice.gradium") {
125
+ const config = {
126
+ defaultVoiceId: process.env.GRADIUM_DEFAULT_VOICE_ID,
127
+ region: process.env.GRADIUM_REGION === "eu" || process.env.GRADIUM_REGION === "us" ? process.env.GRADIUM_REGION : undefined,
128
+ baseUrl: process.env.GRADIUM_BASE_URL,
129
+ timeoutMs: parseOptionalInt(process.env.GRADIUM_TIMEOUT_MS),
130
+ outputFormat: parseGradiumOutputFormat(process.env.GRADIUM_OUTPUT_FORMAT)
131
+ };
132
+ return config;
133
+ }
134
+ return {
135
+ modelId: process.env.FAL_MODEL_ID,
136
+ defaultVoiceUrl: process.env.FAL_DEFAULT_VOICE_URL,
137
+ defaultExaggeration: parseOptionalNumber(process.env.FAL_DEFAULT_EXAGGERATION),
138
+ defaultTemperature: parseOptionalNumber(process.env.FAL_DEFAULT_TEMPERATURE),
139
+ defaultCfg: parseOptionalNumber(process.env.FAL_DEFAULT_CFG),
140
+ pollIntervalMs: parseOptionalInt(process.env.FAL_POLL_INTERVAL_MS)
141
+ };
142
+ }
143
+ function parseOptionalInt(value) {
144
+ if (!value)
145
+ return;
146
+ const parsed = Number.parseInt(value, 10);
147
+ return Number.isFinite(parsed) ? parsed : undefined;
148
+ }
149
+ function parseOptionalNumber(value) {
150
+ if (!value)
151
+ return;
152
+ const parsed = Number.parseFloat(value);
153
+ return Number.isFinite(parsed) ? parsed : undefined;
154
+ }
155
+ function parseGradiumOutputFormat(value) {
156
+ if (!value)
157
+ return;
158
+ switch (value) {
159
+ case "wav":
160
+ case "pcm":
161
+ case "opus":
162
+ case "ulaw_8000":
163
+ case "alaw_8000":
164
+ case "pcm_16000":
165
+ case "pcm_24000":
166
+ return value;
167
+ default:
168
+ return;
169
+ }
170
+ }
171
+ runVoiceProvidersExampleFromEnv().then((result) => {
172
+ console.log(JSON.stringify(result, null, 2));
173
+ }).catch((error) => {
174
+ console.error(error);
175
+ process.exitCode = 1;
176
+ });
177
+ export {
178
+ runVoiceProvidersExampleFromEnv
179
+ };
@@ -1,9 +1,5 @@
1
- import { IntegrationConnection } from "@contractspec/lib.contracts/integrations/connection";
2
-
3
- //#region src/connection.sample.d.ts
4
- declare const gradiumVoiceConnection: IntegrationConnection;
5
- declare const falVoiceConnection: IntegrationConnection;
6
- declare const voiceSampleConnections: IntegrationConnection[];
7
- //#endregion
8
- export { falVoiceConnection, gradiumVoiceConnection, voiceSampleConnections };
1
+ import type { IntegrationConnection } from '@contractspec/lib.contracts/integrations/connection';
2
+ export declare const gradiumVoiceConnection: IntegrationConnection;
3
+ export declare const falVoiceConnection: IntegrationConnection;
4
+ export declare const voiceSampleConnections: IntegrationConnection[];
9
5
  //# sourceMappingURL=connection.sample.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection.sample.d.ts","names":[],"sources":["../src/connection.sample.ts"],"mappings":";;;cAEa,sBAAA,EAAwB,qBAAA;AAAA,cAsBxB,kBAAA,EAAoB,qBAAA;AAAA,cA0BpB,sBAAA,EAAwB,qBAAA"}
1
+ {"version":3,"file":"connection.sample.d.ts","sourceRoot":"","sources":["../src/connection.sample.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAEjG,eAAO,MAAM,sBAAsB,EAAE,qBAoBpC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,qBAwBhC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EAGzD,CAAC"}
@@ -1,51 +1,56 @@
1
- //#region src/connection.sample.ts
2
- const gradiumVoiceConnection = {
3
- meta: {
4
- id: "conn-gradium-voice-demo",
5
- tenantId: "acme-inc",
6
- integrationKey: "ai-voice.gradium",
7
- integrationVersion: "1.0.0",
8
- label: "Gradium Voice",
9
- environment: "production",
10
- createdAt: "2026-01-01T00:00:00.000Z",
11
- updatedAt: "2026-01-01T00:00:00.000Z"
12
- },
13
- ownershipMode: "byok",
14
- config: {
15
- defaultVoiceId: "YTpq7expH9539ERJ",
16
- region: "eu",
17
- outputFormat: "wav"
18
- },
19
- secretProvider: "vault",
20
- secretRef: "vault://integrations/acme-inc/conn-gradium-voice-demo",
21
- status: "connected"
1
+ // @bun
2
+ // src/connection.sample.ts
3
+ var gradiumVoiceConnection = {
4
+ meta: {
5
+ id: "conn-gradium-voice-demo",
6
+ tenantId: "acme-inc",
7
+ integrationKey: "ai-voice.gradium",
8
+ integrationVersion: "1.0.0",
9
+ label: "Gradium Voice",
10
+ environment: "production",
11
+ createdAt: "2026-01-01T00:00:00.000Z",
12
+ updatedAt: "2026-01-01T00:00:00.000Z"
13
+ },
14
+ ownershipMode: "byok",
15
+ config: {
16
+ defaultVoiceId: "YTpq7expH9539ERJ",
17
+ region: "eu",
18
+ outputFormat: "wav"
19
+ },
20
+ secretProvider: "vault",
21
+ secretRef: "vault://integrations/acme-inc/conn-gradium-voice-demo",
22
+ status: "connected"
22
23
  };
23
- const falVoiceConnection = {
24
- meta: {
25
- id: "conn-fal-voice-demo",
26
- tenantId: "acme-inc",
27
- integrationKey: "ai-voice.fal",
28
- integrationVersion: "1.0.0",
29
- label: "Fal Voice",
30
- environment: "production",
31
- createdAt: "2026-01-01T00:00:00.000Z",
32
- updatedAt: "2026-01-01T00:00:00.000Z"
33
- },
34
- ownershipMode: "byok",
35
- config: {
36
- modelId: "fal-ai/chatterbox/text-to-speech",
37
- defaultVoiceUrl: "https://storage.googleapis.com/chatterbox-demo-samples/prompts/male_rickmorty.mp3",
38
- defaultExaggeration: .25,
39
- defaultTemperature: .7,
40
- defaultCfg: .5,
41
- pollIntervalMs: 1e3
42
- },
43
- secretProvider: "vault",
44
- secretRef: "vault://integrations/acme-inc/conn-fal-voice-demo",
45
- status: "connected"
24
+ var falVoiceConnection = {
25
+ meta: {
26
+ id: "conn-fal-voice-demo",
27
+ tenantId: "acme-inc",
28
+ integrationKey: "ai-voice.fal",
29
+ integrationVersion: "1.0.0",
30
+ label: "Fal Voice",
31
+ environment: "production",
32
+ createdAt: "2026-01-01T00:00:00.000Z",
33
+ updatedAt: "2026-01-01T00:00:00.000Z"
34
+ },
35
+ ownershipMode: "byok",
36
+ config: {
37
+ modelId: "fal-ai/chatterbox/text-to-speech",
38
+ defaultVoiceUrl: "https://storage.googleapis.com/chatterbox-demo-samples/prompts/male_rickmorty.mp3",
39
+ defaultExaggeration: 0.25,
40
+ defaultTemperature: 0.7,
41
+ defaultCfg: 0.5,
42
+ pollIntervalMs: 1000
43
+ },
44
+ secretProvider: "vault",
45
+ secretRef: "vault://integrations/acme-inc/conn-fal-voice-demo",
46
+ status: "connected"
47
+ };
48
+ var voiceSampleConnections = [
49
+ gradiumVoiceConnection,
50
+ falVoiceConnection
51
+ ];
52
+ export {
53
+ voiceSampleConnections,
54
+ gradiumVoiceConnection,
55
+ falVoiceConnection
46
56
  };
47
- const voiceSampleConnections = [gradiumVoiceConnection, falVoiceConnection];
48
-
49
- //#endregion
50
- export { falVoiceConnection, gradiumVoiceConnection, voiceSampleConnections };
51
- //# sourceMappingURL=connection.sample.js.map
@@ -1 +1,2 @@
1
- export { };
1
+ import './voice-providers.docblock';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC"}
@@ -1 +1,37 @@
1
- import "./voice-providers.docblock.js";
1
+ // @bun
2
+ // src/docs/voice-providers.docblock.ts
3
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
4
+ var blocks = [
5
+ {
6
+ id: "docs.examples.voice-providers",
7
+ title: "Voice Providers (example)",
8
+ summary: "Multi-provider voice integration example covering Gradium and Fal text-to-speech flows.",
9
+ kind: "reference",
10
+ visibility: "public",
11
+ route: "/docs/examples/voice-providers",
12
+ tags: ["voice", "tts", "gradium", "fal", "example"],
13
+ body: `## What this example shows
14
+ ` + "- Provider selection for `ai-voice.gradium` and `ai-voice.fal`.\n" + `- Listing voice catalogs and synthesizing text into audio bytes.
15
+ ` + `- Connection metadata patterns for BYOK secret references.
16
+
17
+ ` + `## Secrets and config
18
+ ` + "- `apiKey` for each provider.\n" + "- Gradium config: `defaultVoiceId`, `region`, `outputFormat`.\n" + "- Fal config: `modelId`, `defaultVoiceUrl`, synthesis tuning fields.\n\n" + `## Guardrails
19
+ ` + `- Keep API keys in secret providers only.
20
+ ` + `- Prefer declarative provider config over hardcoded runtime options.
21
+ ` + "- Keep synthesis side effects explicit for deterministic workflows."
22
+ },
23
+ {
24
+ id: "docs.examples.voice-providers.usage",
25
+ title: "Voice Providers - Usage",
26
+ summary: "How to wire provider factory and synthesis helpers in runtime code.",
27
+ kind: "usage",
28
+ visibility: "public",
29
+ route: "/docs/examples/voice-providers/usage",
30
+ tags: ["voice", "usage"],
31
+ body: `## Usage
32
+ ` + "- Call `createVoiceProvider` with integration key, secrets, and config.\n" + "- Use `listVoices` to expose voice choices in admin/config screens.\n" + "- Use `synthesizeVoice` for message generation or workflow steps.\n\n" + `## Notes
33
+ ` + `- Fal uses an audio URL output; this example downloads bytes for a canonical result shape.
34
+ ` + "- Gradium maps provider output formats into ContractSpec voice result conventions."
35
+ }
36
+ ];
37
+ registerDocBlocks(blocks);
@@ -1 +1,2 @@
1
- export { };
1
+ export {};
2
+ //# sourceMappingURL=voice-providers.docblock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-providers.docblock.d.ts","sourceRoot":"","sources":["../../src/docs/voice-providers.docblock.ts"],"names":[],"mappings":""}
@@ -1,31 +1,37 @@
1
+ // @bun
2
+ // src/docs/voice-providers.docblock.ts
1
3
  import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
4
+ var blocks = [
5
+ {
6
+ id: "docs.examples.voice-providers",
7
+ title: "Voice Providers (example)",
8
+ summary: "Multi-provider voice integration example covering Gradium and Fal text-to-speech flows.",
9
+ kind: "reference",
10
+ visibility: "public",
11
+ route: "/docs/examples/voice-providers",
12
+ tags: ["voice", "tts", "gradium", "fal", "example"],
13
+ body: `## What this example shows
14
+ ` + "- Provider selection for `ai-voice.gradium` and `ai-voice.fal`.\n" + `- Listing voice catalogs and synthesizing text into audio bytes.
15
+ ` + `- Connection metadata patterns for BYOK secret references.
2
16
 
3
- //#region src/docs/voice-providers.docblock.ts
4
- registerDocBlocks([{
5
- id: "docs.examples.voice-providers",
6
- title: "Voice Providers (example)",
7
- summary: "Multi-provider voice integration example covering Gradium and Fal text-to-speech flows.",
8
- kind: "reference",
9
- visibility: "public",
10
- route: "/docs/examples/voice-providers",
11
- tags: [
12
- "voice",
13
- "tts",
14
- "gradium",
15
- "fal",
16
- "example"
17
- ],
18
- body: "## What this example shows\n- Provider selection for `ai-voice.gradium` and `ai-voice.fal`.\n- Listing voice catalogs and synthesizing text into audio bytes.\n- Connection metadata patterns for BYOK secret references.\n\n## Secrets and config\n- `apiKey` for each provider.\n- Gradium config: `defaultVoiceId`, `region`, `outputFormat`.\n- Fal config: `modelId`, `defaultVoiceUrl`, synthesis tuning fields.\n\n## Guardrails\n- Keep API keys in secret providers only.\n- Prefer declarative provider config over hardcoded runtime options.\n- Keep synthesis side effects explicit for deterministic workflows."
19
- }, {
20
- id: "docs.examples.voice-providers.usage",
21
- title: "Voice Providers - Usage",
22
- summary: "How to wire provider factory and synthesis helpers in runtime code.",
23
- kind: "usage",
24
- visibility: "public",
25
- route: "/docs/examples/voice-providers/usage",
26
- tags: ["voice", "usage"],
27
- body: "## Usage\n- Call `createVoiceProvider` with integration key, secrets, and config.\n- Use `listVoices` to expose voice choices in admin/config screens.\n- Use `synthesizeVoice` for message generation or workflow steps.\n\n## Notes\n- Fal uses an audio URL output; this example downloads bytes for a canonical result shape.\n- Gradium maps provider output formats into ContractSpec voice result conventions."
28
- }]);
29
-
30
- //#endregion
31
- //# sourceMappingURL=voice-providers.docblock.js.map
17
+ ` + `## Secrets and config
18
+ ` + "- `apiKey` for each provider.\n" + "- Gradium config: `defaultVoiceId`, `region`, `outputFormat`.\n" + "- Fal config: `modelId`, `defaultVoiceUrl`, synthesis tuning fields.\n\n" + `## Guardrails
19
+ ` + `- Keep API keys in secret providers only.
20
+ ` + `- Prefer declarative provider config over hardcoded runtime options.
21
+ ` + "- Keep synthesis side effects explicit for deterministic workflows."
22
+ },
23
+ {
24
+ id: "docs.examples.voice-providers.usage",
25
+ title: "Voice Providers - Usage",
26
+ summary: "How to wire provider factory and synthesis helpers in runtime code.",
27
+ kind: "usage",
28
+ visibility: "public",
29
+ route: "/docs/examples/voice-providers/usage",
30
+ tags: ["voice", "usage"],
31
+ body: `## Usage
32
+ ` + "- Call `createVoiceProvider` with integration key, secrets, and config.\n" + "- Use `listVoices` to expose voice choices in admin/config screens.\n" + "- Use `synthesizeVoice` for message generation or workflow steps.\n\n" + `## Notes
33
+ ` + `- Fal uses an audio URL output; this example downloads bytes for a canonical result shape.
34
+ ` + "- Gradium maps provider output formats into ContractSpec voice result conventions."
35
+ }
36
+ ];
37
+ registerDocBlocks(blocks);
package/dist/example.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
-
3
- //#region src/example.d.ts
4
- declare const example: _contractspec_lib_contracts0.ExampleSpec;
5
- //#endregion
6
- export { example as default };
1
+ declare const example: import("@contractspec/lib.contracts").ExampleSpec;
2
+ export default example;
7
3
  //# sourceMappingURL=example.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"mappings":";;;cAEM,OAAA,EA2BJ,4BAAA,CA3BW,WAAA"}
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO,mDA2BX,CAAC;AAEH,eAAe,OAAO,CAAC"}
package/dist/example.js CHANGED
@@ -1,46 +1,34 @@
1
+ // @bun
2
+ // src/example.ts
1
3
  import { defineExample } from "@contractspec/lib.contracts";
2
-
3
- //#region src/example.ts
4
- const example = defineExample({
5
- meta: {
6
- key: "voice-providers",
7
- version: "1.0.0",
8
- title: "Voice Providers (Gradium and Fal)",
9
- description: "Multi-provider voice integration example for Gradium and Fal text-to-speech adapters.",
10
- kind: "integration",
11
- visibility: "public",
12
- stability: "experimental",
13
- owners: ["@platform.integrations"],
14
- tags: [
15
- "voice",
16
- "tts",
17
- "gradium",
18
- "fal",
19
- "integrations"
20
- ]
21
- },
22
- docs: {
23
- rootDocId: "docs.examples.voice-providers",
24
- usageDocId: "docs.examples.voice-providers.usage"
25
- },
26
- entrypoints: {
27
- packageName: "@contractspec/example.voice-providers",
28
- docs: "./docs"
29
- },
30
- surfaces: {
31
- templates: true,
32
- sandbox: {
33
- enabled: true,
34
- modes: ["markdown", "specs"]
35
- },
36
- studio: {
37
- enabled: true,
38
- installable: true
39
- },
40
- mcp: { enabled: true }
41
- }
4
+ var example = defineExample({
5
+ meta: {
6
+ key: "voice-providers",
7
+ version: "1.0.0",
8
+ title: "Voice Providers (Gradium and Fal)",
9
+ description: "Multi-provider voice integration example for Gradium and Fal text-to-speech adapters.",
10
+ kind: "integration",
11
+ visibility: "public",
12
+ stability: "experimental",
13
+ owners: ["@platform.integrations"],
14
+ tags: ["voice", "tts", "gradium", "fal", "integrations"]
15
+ },
16
+ docs: {
17
+ rootDocId: "docs.examples.voice-providers",
18
+ usageDocId: "docs.examples.voice-providers.usage"
19
+ },
20
+ entrypoints: {
21
+ packageName: "@contractspec/example.voice-providers",
22
+ docs: "./docs"
23
+ },
24
+ surfaces: {
25
+ templates: true,
26
+ sandbox: { enabled: true, modes: ["markdown", "specs"] },
27
+ studio: { enabled: true, installable: true },
28
+ mcp: { enabled: true }
29
+ }
42
30
  });
43
-
44
- //#endregion
45
- export { example as default };
46
- //# sourceMappingURL=example.js.map
31
+ var example_default = example;
32
+ export {
33
+ example_default as default
34
+ };
@@ -1,29 +1,25 @@
1
- import { VoiceProvider } from "@contractspec/lib.contracts/integrations/providers/voice";
2
-
3
- //#region src/handlers/create-provider.d.ts
4
- type VoiceIntegrationKey = 'ai-voice.gradium' | 'ai-voice.fal';
5
- interface VoiceProviderSecrets {
6
- apiKey: string;
1
+ import type { VoiceProvider } from '@contractspec/lib.contracts/integrations/providers/voice';
2
+ export type VoiceIntegrationKey = 'ai-voice.gradium' | 'ai-voice.fal';
3
+ export interface VoiceProviderSecrets {
4
+ apiKey: string;
7
5
  }
8
- interface VoiceProviderConfig {
9
- defaultVoiceId?: string;
10
- region?: 'eu' | 'us';
11
- baseUrl?: string;
12
- timeoutMs?: number;
13
- outputFormat?: 'wav' | 'pcm' | 'opus' | 'ulaw_8000' | 'alaw_8000' | 'pcm_16000' | 'pcm_24000';
14
- modelId?: string;
15
- defaultVoiceUrl?: string;
16
- defaultExaggeration?: number;
17
- defaultTemperature?: number;
18
- defaultCfg?: number;
19
- pollIntervalMs?: number;
6
+ export interface VoiceProviderConfig {
7
+ defaultVoiceId?: string;
8
+ region?: 'eu' | 'us';
9
+ baseUrl?: string;
10
+ timeoutMs?: number;
11
+ outputFormat?: 'wav' | 'pcm' | 'opus' | 'ulaw_8000' | 'alaw_8000' | 'pcm_16000' | 'pcm_24000';
12
+ modelId?: string;
13
+ defaultVoiceUrl?: string;
14
+ defaultExaggeration?: number;
15
+ defaultTemperature?: number;
16
+ defaultCfg?: number;
17
+ pollIntervalMs?: number;
20
18
  }
21
- interface VoiceProviderFactoryInput {
22
- integrationKey: VoiceIntegrationKey;
23
- secrets: VoiceProviderSecrets;
24
- config?: VoiceProviderConfig;
19
+ export interface VoiceProviderFactoryInput {
20
+ integrationKey: VoiceIntegrationKey;
21
+ secrets: VoiceProviderSecrets;
22
+ config?: VoiceProviderConfig;
25
23
  }
26
- declare function createVoiceProvider(input: VoiceProviderFactoryInput): VoiceProvider;
27
- //#endregion
28
- export { VoiceIntegrationKey, VoiceProviderConfig, VoiceProviderFactoryInput, VoiceProviderSecrets, createVoiceProvider };
24
+ export declare function createVoiceProvider(input: VoiceProviderFactoryInput): VoiceProvider;
29
25
  //# sourceMappingURL=create-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-provider.d.ts","names":[],"sources":["../../src/handlers/create-provider.ts"],"mappings":";;;KAIY,mBAAA;AAAA,UAEK,oBAAA;EACf,MAAA;AAAA;AAAA,UAGe,mBAAA;EACf,cAAA;EACA,MAAA;EACA,OAAA;EACA,SAAA;EACA,YAAA;EAQA,OAAA;EACA,eAAA;EACA,mBAAA;EACA,kBAAA;EACA,UAAA;EACA,cAAA;AAAA;AAAA,UAGe,yBAAA;EACf,cAAA,EAAgB,mBAAA;EAChB,OAAA,EAAS,oBAAA;EACT,MAAA,GAAS,mBAAA;AAAA;AAAA,iBAGK,mBAAA,CACd,KAAA,EAAO,yBAAA,GACN,aAAA"}
1
+ {"version":3,"file":"create-provider.d.ts","sourceRoot":"","sources":["../../src/handlers/create-provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAC;AAE9F,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,cAAc,CAAC;AAEtE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EACT,KAAK,GACL,KAAK,GACL,MAAM,GACN,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,mBAAmB,CAAC;IACpC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,yBAAyB,GAC/B,aAAa,CA8Bf"}