@contractspec/example.voice-providers 1.57.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 (49) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +46 -0
  2. package/.turbo/turbo-build.log +47 -0
  3. package/CHANGELOG.md +27 -0
  4. package/LICENSE +21 -0
  5. package/README.md +14 -0
  6. package/dist/connection.sample.d.ts +9 -0
  7. package/dist/connection.sample.d.ts.map +1 -0
  8. package/dist/connection.sample.js +51 -0
  9. package/dist/connection.sample.js.map +1 -0
  10. package/dist/docs/index.d.ts +1 -0
  11. package/dist/docs/index.js +1 -0
  12. package/dist/docs/voice-providers.docblock.d.ts +1 -0
  13. package/dist/docs/voice-providers.docblock.js +31 -0
  14. package/dist/docs/voice-providers.docblock.js.map +1 -0
  15. package/dist/example.d.ts +7 -0
  16. package/dist/example.d.ts.map +1 -0
  17. package/dist/example.js +46 -0
  18. package/dist/example.js.map +1 -0
  19. package/dist/handlers/create-provider.d.ts +29 -0
  20. package/dist/handlers/create-provider.d.ts.map +1 -0
  21. package/dist/handlers/create-provider.js +32 -0
  22. package/dist/handlers/create-provider.js.map +1 -0
  23. package/dist/handlers/list-voices.d.ts +8 -0
  24. package/dist/handlers/list-voices.d.ts.map +1 -0
  25. package/dist/handlers/list-voices.js +10 -0
  26. package/dist/handlers/list-voices.js.map +1 -0
  27. package/dist/handlers/synthesize.d.ts +11 -0
  28. package/dist/handlers/synthesize.d.ts.map +1 -0
  29. package/dist/handlers/synthesize.js +10 -0
  30. package/dist/handlers/synthesize.js.map +1 -0
  31. package/dist/index.d.ts +6 -0
  32. package/dist/index.js +8 -0
  33. package/dist/run.d.ts +5 -0
  34. package/dist/run.d.ts.map +1 -0
  35. package/dist/run.js +118 -0
  36. package/dist/run.js.map +1 -0
  37. package/package.json +65 -0
  38. package/src/connection.sample.ts +54 -0
  39. package/src/docs/index.ts +1 -0
  40. package/src/docs/voice-providers.docblock.ts +48 -0
  41. package/src/example.ts +32 -0
  42. package/src/handlers/create-provider.ts +70 -0
  43. package/src/handlers/list-voices.ts +13 -0
  44. package/src/handlers/synthesize.ts +20 -0
  45. package/src/index.ts +6 -0
  46. package/src/run.ts +180 -0
  47. package/tsconfig.json +9 -0
  48. package/tsconfig.tsbuildinfo +1 -0
  49. package/tsdown.config.js +6 -0
@@ -0,0 +1,46 @@
1
+ $ tsdown
2
+ ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
3
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/voice-providers/tsdown.config.js
4
+ ℹ entry: src/connection.sample.ts, src/example.ts, src/index.ts, src/run.ts, src/docs/index.ts, src/docs/voice-providers.docblock.ts, src/handlers/create-provider.ts, src/handlers/list-voices.ts, src/handlers/synthesize.ts
5
+ ℹ target: esnext
6
+ ℹ tsconfig: tsconfig.json
7
+ ℹ Build start
8
+ ℹ Cleaning 33 files
9
+ ℹ dist/run.js 3.90 kB │ gzip: 1.33 kB
10
+ ℹ dist/docs/voice-providers.docblock.js 1.85 kB │ gzip: 0.87 kB
11
+ ℹ dist/connection.sample.js 1.48 kB │ gzip: 0.58 kB
12
+ ℹ dist/handlers/create-provider.js 1.21 kB │ gzip: 0.49 kB
13
+ ℹ dist/example.js 0.99 kB │ gzip: 0.51 kB
14
+ ℹ dist/index.js 0.49 kB │ gzip: 0.20 kB
15
+ ℹ dist/handlers/synthesize.js 0.28 kB │ gzip: 0.19 kB
16
+ ℹ dist/handlers/list-voices.js 0.26 kB │ gzip: 0.18 kB
17
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
18
+ ℹ dist/run.js.map 7.18 kB │ gzip: 2.33 kB
19
+ ℹ dist/handlers/create-provider.js.map 2.73 kB │ gzip: 0.96 kB
20
+ ℹ dist/docs/voice-providers.docblock.js.map 2.57 kB │ gzip: 1.08 kB
21
+ ℹ dist/connection.sample.js.map 2.28 kB │ gzip: 0.83 kB
22
+ ℹ dist/example.js.map 1.46 kB │ gzip: 0.70 kB
23
+ ℹ dist/handlers/synthesize.js.map 0.76 kB │ gzip: 0.40 kB
24
+ ℹ dist/handlers/list-voices.js.map 0.56 kB │ gzip: 0.34 kB
25
+ ℹ dist/handlers/create-provider.d.ts.map 0.43 kB │ gzip: 0.24 kB
26
+ ℹ dist/handlers/synthesize.d.ts.map 0.22 kB │ gzip: 0.18 kB
27
+ ℹ dist/connection.sample.d.ts.map 0.20 kB │ gzip: 0.14 kB
28
+ ℹ dist/handlers/list-voices.d.ts.map 0.17 kB │ gzip: 0.15 kB
29
+ ℹ dist/example.d.ts.map 0.13 kB │ gzip: 0.13 kB
30
+ ℹ dist/run.d.ts.map 0.12 kB │ gzip: 0.13 kB
31
+ ℹ dist/handlers/create-provider.d.ts 1.05 kB │ gzip: 0.45 kB
32
+ ℹ dist/index.d.ts 0.69 kB │ gzip: 0.24 kB
33
+ ℹ dist/handlers/synthesize.d.ts 0.52 kB │ gzip: 0.27 kB
34
+ ℹ dist/connection.sample.d.ts 0.45 kB │ gzip: 0.21 kB
35
+ ℹ dist/handlers/list-voices.d.ts 0.35 kB │ gzip: 0.23 kB
36
+ ℹ dist/example.d.ts 0.25 kB │ gzip: 0.17 kB
37
+ ℹ dist/run.d.ts 0.20 kB │ gzip: 0.16 kB
38
+ ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
39
+ ℹ dist/docs/voice-providers.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
40
+ ℹ 31 files, total: 32.86 kB
41
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
42
+ - rolldown-plugin-dts:generate (49%)
43
+ - tsdown:external (48%)
44
+ See https://rolldown.rs/options/checks#plugintimings for more details.
45
+
46
+ ✔ Build complete in 21405ms
@@ -0,0 +1,47 @@
1
+ $ bun build:types && bun build:bundle
2
+ $ tsc --noEmit
3
+ $ tsdown
4
+ ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
5
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/voice-providers/tsdown.config.js
6
+ ℹ entry: src/connection.sample.ts, src/example.ts, src/index.ts, src/run.ts, src/handlers/create-provider.ts, src/handlers/list-voices.ts, src/handlers/synthesize.ts, src/docs/index.ts, src/docs/voice-providers.docblock.ts
7
+ ℹ target: esnext
8
+ ℹ tsconfig: tsconfig.json
9
+ ℹ Build start
10
+ ℹ dist/run.js 3.90 kB │ gzip: 1.33 kB
11
+ ℹ dist/docs/voice-providers.docblock.js 1.85 kB │ gzip: 0.87 kB
12
+ ℹ dist/connection.sample.js 1.48 kB │ gzip: 0.58 kB
13
+ ℹ dist/handlers/create-provider.js 1.21 kB │ gzip: 0.49 kB
14
+ ℹ dist/example.js 0.99 kB │ gzip: 0.51 kB
15
+ ℹ dist/index.js 0.49 kB │ gzip: 0.20 kB
16
+ ℹ dist/handlers/synthesize.js 0.28 kB │ gzip: 0.19 kB
17
+ ℹ dist/handlers/list-voices.js 0.26 kB │ gzip: 0.18 kB
18
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
19
+ ℹ dist/run.js.map 7.18 kB │ gzip: 2.33 kB
20
+ ℹ dist/handlers/create-provider.js.map 2.73 kB │ gzip: 0.96 kB
21
+ ℹ dist/docs/voice-providers.docblock.js.map 2.57 kB │ gzip: 1.08 kB
22
+ ℹ dist/connection.sample.js.map 2.28 kB │ gzip: 0.83 kB
23
+ ℹ dist/example.js.map 1.46 kB │ gzip: 0.70 kB
24
+ ℹ dist/handlers/synthesize.js.map 0.76 kB │ gzip: 0.40 kB
25
+ ℹ dist/handlers/list-voices.js.map 0.56 kB │ gzip: 0.34 kB
26
+ ℹ dist/handlers/create-provider.d.ts.map 0.43 kB │ gzip: 0.24 kB
27
+ ℹ dist/handlers/synthesize.d.ts.map 0.22 kB │ gzip: 0.18 kB
28
+ ℹ dist/connection.sample.d.ts.map 0.20 kB │ gzip: 0.14 kB
29
+ ℹ dist/handlers/list-voices.d.ts.map 0.17 kB │ gzip: 0.15 kB
30
+ ℹ dist/example.d.ts.map 0.13 kB │ gzip: 0.13 kB
31
+ ℹ dist/run.d.ts.map 0.12 kB │ gzip: 0.13 kB
32
+ ℹ dist/handlers/create-provider.d.ts 1.05 kB │ gzip: 0.45 kB
33
+ ℹ dist/index.d.ts 0.69 kB │ gzip: 0.24 kB
34
+ ℹ dist/handlers/synthesize.d.ts 0.52 kB │ gzip: 0.27 kB
35
+ ℹ dist/connection.sample.d.ts 0.45 kB │ gzip: 0.21 kB
36
+ ℹ dist/handlers/list-voices.d.ts 0.35 kB │ gzip: 0.23 kB
37
+ ℹ dist/example.d.ts 0.25 kB │ gzip: 0.17 kB
38
+ ℹ dist/run.d.ts 0.20 kB │ gzip: 0.16 kB
39
+ ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
40
+ ℹ dist/docs/voice-providers.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
41
+ ℹ 31 files, total: 32.86 kB
42
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
43
+ - tsdown:external (56%)
44
+ - rolldown-plugin-dts:generate (42%)
45
+ See https://rolldown.rs/options/checks#plugintimings for more details.
46
+
47
+ ✔ Build complete in 21592ms
package/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # @contractspec/example.voice-providers
2
+
3
+ ## 1.57.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4651e06: Add Supabase and voice provider integrations with new runnable examples, and expose these providers across contracts, workspace tooling, and provider factory wiring.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [8ecf3c1]
12
+ - Updated dependencies [47c48c2]
13
+ - Updated dependencies [a119963]
14
+ - Updated dependencies [4651e06]
15
+ - Updated dependencies [ad9d10a]
16
+ - Updated dependencies [11a5a05]
17
+ - @contractspec/lib.contracts@1.57.0
18
+ - @contractspec/integration.providers-impls@1.57.0
19
+
20
+ ## 1.56.1
21
+
22
+ ### Patch Changes
23
+
24
+ - feat: add voice providers example for Gradium and Fal
25
+ - Updated dependencies
26
+ - @contractspec/integration.providers-impls@1.56.1
27
+ - @contractspec/lib.contracts@1.56.1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chaman Ventures, SASU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @contractspec/example.voice-providers
2
+
3
+ Website: https://contractspec.io/
4
+
5
+ Voice provider example for `ai-voice.gradium` and `ai-voice.fal`.
6
+
7
+ This package demonstrates:
8
+
9
+ - provider selection by integration key
10
+ - listing available voices
11
+ - synthesizing audio from plain text
12
+ - connection metadata samples for BYOK setups
13
+
14
+ Use this as a reference for wiring voice synthesis into workflows or service handlers.
@@ -0,0 +1,9 @@
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 };
9
+ //# sourceMappingURL=connection.sample.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,51 @@
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"
22
+ };
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"
46
+ };
47
+ const voiceSampleConnections = [gradiumVoiceConnection, falVoiceConnection];
48
+
49
+ //#endregion
50
+ export { falVoiceConnection, gradiumVoiceConnection, voiceSampleConnections };
51
+ //# sourceMappingURL=connection.sample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.sample.js","names":[],"sources":["../src/connection.sample.ts"],"sourcesContent":["import type { IntegrationConnection } from '@contractspec/lib.contracts/integrations/connection';\n\nexport const gradiumVoiceConnection: IntegrationConnection = {\n meta: {\n id: 'conn-gradium-voice-demo',\n tenantId: 'acme-inc',\n integrationKey: 'ai-voice.gradium',\n integrationVersion: '1.0.0',\n label: 'Gradium Voice',\n environment: 'production',\n createdAt: '2026-01-01T00:00:00.000Z',\n updatedAt: '2026-01-01T00:00:00.000Z',\n },\n ownershipMode: 'byok',\n config: {\n defaultVoiceId: 'YTpq7expH9539ERJ',\n region: 'eu',\n outputFormat: 'wav',\n },\n secretProvider: 'vault',\n secretRef: 'vault://integrations/acme-inc/conn-gradium-voice-demo',\n status: 'connected',\n};\n\nexport const falVoiceConnection: IntegrationConnection = {\n meta: {\n id: 'conn-fal-voice-demo',\n tenantId: 'acme-inc',\n integrationKey: 'ai-voice.fal',\n integrationVersion: '1.0.0',\n label: 'Fal Voice',\n environment: 'production',\n createdAt: '2026-01-01T00:00:00.000Z',\n updatedAt: '2026-01-01T00:00:00.000Z',\n },\n ownershipMode: 'byok',\n config: {\n modelId: 'fal-ai/chatterbox/text-to-speech',\n defaultVoiceUrl:\n 'https://storage.googleapis.com/chatterbox-demo-samples/prompts/male_rickmorty.mp3',\n defaultExaggeration: 0.25,\n defaultTemperature: 0.7,\n defaultCfg: 0.5,\n pollIntervalMs: 1000,\n },\n secretProvider: 'vault',\n secretRef: 'vault://integrations/acme-inc/conn-fal-voice-demo',\n status: 'connected',\n};\n\nexport const voiceSampleConnections: IntegrationConnection[] = [\n gradiumVoiceConnection,\n falVoiceConnection,\n];\n"],"mappings":";AAEA,MAAa,yBAAgD;CAC3D,MAAM;EACJ,IAAI;EACJ,UAAU;EACV,gBAAgB;EAChB,oBAAoB;EACpB,OAAO;EACP,aAAa;EACb,WAAW;EACX,WAAW;EACZ;CACD,eAAe;CACf,QAAQ;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACf;CACD,gBAAgB;CAChB,WAAW;CACX,QAAQ;CACT;AAED,MAAa,qBAA4C;CACvD,MAAM;EACJ,IAAI;EACJ,UAAU;EACV,gBAAgB;EAChB,oBAAoB;EACpB,OAAO;EACP,aAAa;EACb,WAAW;EACX,WAAW;EACZ;CACD,eAAe;CACf,QAAQ;EACN,SAAS;EACT,iBACE;EACF,qBAAqB;EACrB,oBAAoB;EACpB,YAAY;EACZ,gBAAgB;EACjB;CACD,gBAAgB;CAChB,WAAW;CACX,QAAQ;CACT;AAED,MAAa,yBAAkD,CAC7D,wBACA,mBACD"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ import "./voice-providers.docblock.js";
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,31 @@
1
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
2
+
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-providers.docblock.js","names":[],"sources":["../../src/docs/voice-providers.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst blocks: DocBlock[] = [\n {\n id: 'docs.examples.voice-providers',\n title: 'Voice Providers (example)',\n summary:\n 'Multi-provider voice integration example covering Gradium and Fal text-to-speech flows.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/voice-providers',\n tags: ['voice', 'tts', 'gradium', 'fal', 'example'],\n body:\n '## What this example shows\\n' +\n '- Provider selection for `ai-voice.gradium` and `ai-voice.fal`.\\n' +\n '- Listing voice catalogs and synthesizing text into audio bytes.\\n' +\n '- Connection metadata patterns for BYOK secret references.\\n\\n' +\n '## Secrets and config\\n' +\n '- `apiKey` for each provider.\\n' +\n '- Gradium config: `defaultVoiceId`, `region`, `outputFormat`.\\n' +\n '- Fal config: `modelId`, `defaultVoiceUrl`, synthesis tuning fields.\\n\\n' +\n '## Guardrails\\n' +\n '- Keep API keys in secret providers only.\\n' +\n '- Prefer declarative provider config over hardcoded runtime options.\\n' +\n '- Keep synthesis side effects explicit for deterministic workflows.',\n },\n {\n id: 'docs.examples.voice-providers.usage',\n title: 'Voice Providers - Usage',\n summary:\n 'How to wire provider factory and synthesis helpers in runtime code.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/voice-providers/usage',\n tags: ['voice', 'usage'],\n body:\n '## Usage\\n' +\n '- Call `createVoiceProvider` with integration key, secrets, and config.\\n' +\n '- Use `listVoices` to expose voice choices in admin/config screens.\\n' +\n '- Use `synthesizeVoice` for message generation or workflow steps.\\n\\n' +\n '## Notes\\n' +\n '- Fal uses an audio URL output; this example downloads bytes for a canonical result shape.\\n' +\n '- Gradium maps provider output formats into ContractSpec voice result conventions.',\n },\n];\n\nregisterDocBlocks(blocks);\n"],"mappings":";;;AA+CA,kBA5C2B,CACzB;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAS;EAAO;EAAW;EAAO;EAAU;CACnD,MACE;CAYH,EACD;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM,CAAC,SAAS,QAAQ;CACxB,MACE;CAOH,CACF,CAEwB"}
@@ -0,0 +1,7 @@
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 };
7
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"mappings":";;;cAEM,OAAA,EA2BJ,4BAAA,CA3BW,WAAA"}
@@ -0,0 +1,46 @@
1
+ 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
+ }
42
+ });
43
+
44
+ //#endregion
45
+ export { example as default };
46
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'voice-providers',\n version: '1.0.0',\n title: 'Voice Providers (Gradium and Fal)',\n description:\n 'Multi-provider voice integration example for Gradium and Fal text-to-speech adapters.',\n kind: 'integration',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.integrations'],\n tags: ['voice', 'tts', 'gradium', 'fal', 'integrations'],\n },\n docs: {\n rootDocId: 'docs.examples.voice-providers',\n usageDocId: 'docs.examples.voice-providers.usage',\n },\n entrypoints: {\n packageName: '@contractspec/example.voice-providers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,yBAAyB;EAClC,MAAM;GAAC;GAAS;GAAO;GAAW;GAAO;GAAe;EACzD;CACD,MAAM;EACJ,WAAW;EACX,YAAY;EACb;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC"}
@@ -0,0 +1,29 @@
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;
7
+ }
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;
20
+ }
21
+ interface VoiceProviderFactoryInput {
22
+ integrationKey: VoiceIntegrationKey;
23
+ secrets: VoiceProviderSecrets;
24
+ config?: VoiceProviderConfig;
25
+ }
26
+ declare function createVoiceProvider(input: VoiceProviderFactoryInput): VoiceProvider;
27
+ //#endregion
28
+ export { VoiceIntegrationKey, VoiceProviderConfig, VoiceProviderFactoryInput, VoiceProviderSecrets, createVoiceProvider };
29
+ //# sourceMappingURL=create-provider.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,32 @@
1
+ import { FalVoiceProvider } from "@contractspec/integration.providers-impls/impls/fal-voice";
2
+ import { GradiumVoiceProvider } from "@contractspec/integration.providers-impls/impls/gradium-voice";
3
+
4
+ //#region src/handlers/create-provider.ts
5
+ function createVoiceProvider(input) {
6
+ const { integrationKey, secrets, config } = input;
7
+ if (!secrets.apiKey) throw new Error("Voice provider apiKey is required.");
8
+ switch (integrationKey) {
9
+ case "ai-voice.gradium": return new GradiumVoiceProvider({
10
+ apiKey: secrets.apiKey,
11
+ defaultVoiceId: config?.defaultVoiceId,
12
+ region: config?.region,
13
+ baseUrl: config?.baseUrl,
14
+ timeoutMs: config?.timeoutMs,
15
+ outputFormat: config?.outputFormat
16
+ });
17
+ case "ai-voice.fal": return new FalVoiceProvider({
18
+ apiKey: secrets.apiKey,
19
+ modelId: config?.modelId,
20
+ defaultVoiceUrl: config?.defaultVoiceUrl,
21
+ defaultExaggeration: config?.defaultExaggeration,
22
+ defaultTemperature: config?.defaultTemperature,
23
+ defaultCfg: config?.defaultCfg,
24
+ pollIntervalMs: config?.pollIntervalMs
25
+ });
26
+ default: throw new Error(`Unsupported voice provider: ${integrationKey}`);
27
+ }
28
+ }
29
+
30
+ //#endregion
31
+ export { createVoiceProvider };
32
+ //# sourceMappingURL=create-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-provider.js","names":[],"sources":["../../src/handlers/create-provider.ts"],"sourcesContent":["import { FalVoiceProvider } from '@contractspec/integration.providers-impls/impls/fal-voice';\nimport { GradiumVoiceProvider } from '@contractspec/integration.providers-impls/impls/gradium-voice';\nimport type { VoiceProvider } from '@contractspec/lib.contracts/integrations/providers/voice';\n\nexport type VoiceIntegrationKey = 'ai-voice.gradium' | 'ai-voice.fal';\n\nexport interface VoiceProviderSecrets {\n apiKey: string;\n}\n\nexport interface VoiceProviderConfig {\n defaultVoiceId?: string;\n region?: 'eu' | 'us';\n baseUrl?: string;\n timeoutMs?: number;\n outputFormat?:\n | 'wav'\n | 'pcm'\n | 'opus'\n | 'ulaw_8000'\n | 'alaw_8000'\n | 'pcm_16000'\n | 'pcm_24000';\n modelId?: string;\n defaultVoiceUrl?: string;\n defaultExaggeration?: number;\n defaultTemperature?: number;\n defaultCfg?: number;\n pollIntervalMs?: number;\n}\n\nexport interface VoiceProviderFactoryInput {\n integrationKey: VoiceIntegrationKey;\n secrets: VoiceProviderSecrets;\n config?: VoiceProviderConfig;\n}\n\nexport function createVoiceProvider(\n input: VoiceProviderFactoryInput\n): VoiceProvider {\n const { integrationKey, secrets, config } = input;\n\n if (!secrets.apiKey) {\n throw new Error('Voice provider apiKey is required.');\n }\n\n switch (integrationKey) {\n case 'ai-voice.gradium':\n return new GradiumVoiceProvider({\n apiKey: secrets.apiKey,\n defaultVoiceId: config?.defaultVoiceId,\n region: config?.region,\n baseUrl: config?.baseUrl,\n timeoutMs: config?.timeoutMs,\n outputFormat: config?.outputFormat,\n });\n case 'ai-voice.fal':\n return new FalVoiceProvider({\n apiKey: secrets.apiKey,\n modelId: config?.modelId,\n defaultVoiceUrl: config?.defaultVoiceUrl,\n defaultExaggeration: config?.defaultExaggeration,\n defaultTemperature: config?.defaultTemperature,\n defaultCfg: config?.defaultCfg,\n pollIntervalMs: config?.pollIntervalMs,\n });\n default:\n throw new Error(`Unsupported voice provider: ${integrationKey}`);\n }\n}\n"],"mappings":";;;;AAqCA,SAAgB,oBACd,OACe;CACf,MAAM,EAAE,gBAAgB,SAAS,WAAW;AAE5C,KAAI,CAAC,QAAQ,OACX,OAAM,IAAI,MAAM,qCAAqC;AAGvD,SAAQ,gBAAR;EACE,KAAK,mBACH,QAAO,IAAI,qBAAqB;GAC9B,QAAQ,QAAQ;GAChB,gBAAgB,QAAQ;GACxB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,WAAW,QAAQ;GACnB,cAAc,QAAQ;GACvB,CAAC;EACJ,KAAK,eACH,QAAO,IAAI,iBAAiB;GAC1B,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,iBAAiB,QAAQ;GACzB,qBAAqB,QAAQ;GAC7B,oBAAoB,QAAQ;GAC5B,YAAY,QAAQ;GACpB,gBAAgB,QAAQ;GACzB,CAAC;EACJ,QACE,OAAM,IAAI,MAAM,+BAA+B,iBAAiB"}
@@ -0,0 +1,8 @@
1
+ import { VoiceProviderFactoryInput } from "./create-provider.js";
2
+ import { Voice } from "@contractspec/lib.contracts/integrations/providers/voice";
3
+
4
+ //#region src/handlers/list-voices.d.ts
5
+ declare function listVoices(input: VoiceProviderFactoryInput): Promise<Voice[]>;
6
+ //#endregion
7
+ export { listVoices };
8
+ //# sourceMappingURL=list-voices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-voices.d.ts","names":[],"sources":["../../src/handlers/list-voices.ts"],"mappings":";;;;iBAOsB,UAAA,CACpB,KAAA,EAAO,yBAAA,GACN,OAAA,CAAQ,KAAA"}
@@ -0,0 +1,10 @@
1
+ import { createVoiceProvider } from "./create-provider.js";
2
+
3
+ //#region src/handlers/list-voices.ts
4
+ async function listVoices(input) {
5
+ return createVoiceProvider(input).listVoices();
6
+ }
7
+
8
+ //#endregion
9
+ export { listVoices };
10
+ //# sourceMappingURL=list-voices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-voices.js","names":[],"sources":["../../src/handlers/list-voices.ts"],"sourcesContent":["import type { Voice } from '@contractspec/lib.contracts/integrations/providers/voice';\n\nimport {\n createVoiceProvider,\n type VoiceProviderFactoryInput,\n} from './create-provider';\n\nexport async function listVoices(\n input: VoiceProviderFactoryInput\n): Promise<Voice[]> {\n const provider = createVoiceProvider(input);\n return provider.listVoices();\n}\n"],"mappings":";;;AAOA,eAAsB,WACpB,OACkB;AAElB,QADiB,oBAAoB,MAAM,CAC3B,YAAY"}
@@ -0,0 +1,11 @@
1
+ import { VoiceProviderFactoryInput } from "./create-provider.js";
2
+ import { VoiceSynthesisInput, VoiceSynthesisResult } from "@contractspec/lib.contracts/integrations/providers/voice";
3
+
4
+ //#region src/handlers/synthesize.d.ts
5
+ interface SynthesizeVoiceInput extends VoiceProviderFactoryInput {
6
+ synthesis: VoiceSynthesisInput;
7
+ }
8
+ declare function synthesizeVoice(input: SynthesizeVoiceInput): Promise<VoiceSynthesisResult>;
9
+ //#endregion
10
+ export { SynthesizeVoiceInput, synthesizeVoice };
11
+ //# sourceMappingURL=synthesize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synthesize.d.ts","names":[],"sources":["../../src/handlers/synthesize.ts"],"mappings":";;;;UAUiB,oBAAA,SAA6B,yBAAA;EAC5C,SAAA,EAAW,mBAAA;AAAA;AAAA,iBAGS,eAAA,CACpB,KAAA,EAAO,oBAAA,GACN,OAAA,CAAQ,oBAAA"}
@@ -0,0 +1,10 @@
1
+ import { createVoiceProvider } from "./create-provider.js";
2
+
3
+ //#region src/handlers/synthesize.ts
4
+ async function synthesizeVoice(input) {
5
+ return createVoiceProvider(input).synthesize(input.synthesis);
6
+ }
7
+
8
+ //#endregion
9
+ export { synthesizeVoice };
10
+ //# sourceMappingURL=synthesize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synthesize.js","names":[],"sources":["../../src/handlers/synthesize.ts"],"sourcesContent":["import type {\n VoiceSynthesisInput,\n VoiceSynthesisResult,\n} from '@contractspec/lib.contracts/integrations/providers/voice';\n\nimport {\n createVoiceProvider,\n type VoiceProviderFactoryInput,\n} from './create-provider';\n\nexport interface SynthesizeVoiceInput extends VoiceProviderFactoryInput {\n synthesis: VoiceSynthesisInput;\n}\n\nexport async function synthesizeVoice(\n input: SynthesizeVoiceInput\n): Promise<VoiceSynthesisResult> {\n const provider = createVoiceProvider(input);\n return provider.synthesize(input.synthesis);\n}\n"],"mappings":";;;AAcA,eAAsB,gBACpB,OAC+B;AAE/B,QADiB,oBAAoB,MAAM,CAC3B,WAAW,MAAM,UAAU"}
@@ -0,0 +1,6 @@
1
+ import { falVoiceConnection, gradiumVoiceConnection, voiceSampleConnections } from "./connection.sample.js";
2
+ import example from "./example.js";
3
+ import { VoiceIntegrationKey, VoiceProviderConfig, VoiceProviderFactoryInput, VoiceProviderSecrets, createVoiceProvider } from "./handlers/create-provider.js";
4
+ import { listVoices } from "./handlers/list-voices.js";
5
+ import { SynthesizeVoiceInput, synthesizeVoice } from "./handlers/synthesize.js";
6
+ export { SynthesizeVoiceInput, VoiceIntegrationKey, VoiceProviderConfig, VoiceProviderFactoryInput, VoiceProviderSecrets, createVoiceProvider, example, falVoiceConnection, gradiumVoiceConnection, listVoices, synthesizeVoice, voiceSampleConnections };
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import { falVoiceConnection, gradiumVoiceConnection, voiceSampleConnections } from "./connection.sample.js";
2
+ import example from "./example.js";
3
+ import { createVoiceProvider } from "./handlers/create-provider.js";
4
+ import { listVoices } from "./handlers/list-voices.js";
5
+ import { synthesizeVoice } from "./handlers/synthesize.js";
6
+ import "./docs/index.js";
7
+
8
+ export { createVoiceProvider, example, falVoiceConnection, gradiumVoiceConnection, listVoices, synthesizeVoice, voiceSampleConnections };
package/dist/run.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ //#region src/run.d.ts
2
+ declare function runVoiceProvidersExampleFromEnv(): Promise<Record<string, unknown>>;
3
+ //#endregion
4
+ export { runVoiceProvidersExampleFromEnv };
5
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","names":[],"sources":["../src/run.ts"],"mappings":";iBAUsB,+BAAA,CAAA,GAA+B,OAAA,CAAA,MAAA"}