palbase 0.68.0 → 0.69.1

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 (65) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai-sdk/index.js +2 -2
  3. package/dist/backend/engine.js +2 -2
  4. package/dist/backend/env.js +1 -1
  5. package/dist/backend/index.js +3 -3
  6. package/dist/backend/stack.js +1 -1
  7. package/dist/backend/test.js +2 -2
  8. package/dist/chunks/{2ZHSNWVZ.js → 37KUGTKN.js} +2 -2
  9. package/dist/chunks/{UJLFALKX.js → BCSBO6QR.js} +2 -2
  10. package/dist/chunks/BZYYDYLF.js +2 -0
  11. package/dist/chunks/{22GRHCVI.js → CD2TYINV.js} +1 -1
  12. package/dist/chunks/{J7WJF7F4.js → CE6XFRSZ.js} +2 -2
  13. package/dist/chunks/{XJLAH42O.js → CPTZEOT3.js} +1 -1
  14. package/dist/chunks/CRK2KWFW.js +18 -0
  15. package/dist/chunks/{D6EUPFUR.js → D6ZVNWQ2.js} +2 -2
  16. package/dist/chunks/{4YV35XDP.js → EZW67SHF.js} +2 -2
  17. package/dist/chunks/{QQUIM4VK.js → F7WQUODK.js} +2 -2
  18. package/dist/chunks/{OWLXCD3D.js → FQEGZTR3.js} +1 -1
  19. package/dist/chunks/{QFZ4GCJH.js → ICNSKNUT.js} +2 -2
  20. package/dist/chunks/{YCDAV3WO.js → JFVOERVR.js} +2 -2
  21. package/dist/chunks/{622BI7EV.js → KOX5W2ID.js} +1 -1
  22. package/dist/chunks/{LUUXXMXH.js → LQF6CVJR.js} +1 -1
  23. package/dist/chunks/{EJAGO6ZV.js → OA2EJLJ2.js} +2 -2
  24. package/dist/chunks/{IZWB7FGX.js → OE772CLE.js} +2 -2
  25. package/dist/chunks/{3OP3YJ63.js → OZM5TI3D.js} +4 -3
  26. package/dist/chunks/{EGWQ3EJE.js → P234HHKR.js} +2 -2
  27. package/dist/chunks/{PP7MW4OT.js → PM3BWYB5.js} +1 -1
  28. package/dist/chunks/TXOMPE5N.js +13 -0
  29. package/dist/chunks/{F4B6ELAN.js → XK7JQGKM.js} +2 -2
  30. package/dist/chunks/{7SGTDHXJ.js → Y4FKEIZV.js} +2 -2
  31. package/dist/chunks/{XU4G5W72.js → YGIYMCYC.js} +1 -1
  32. package/dist/cli.js +227 -227
  33. package/dist/cloud/index.js +2 -2
  34. package/dist/refuse/ai-sdk.js +1 -1
  35. package/dist/refuse/ai.js +1 -1
  36. package/dist/refuse/backend.js +1 -1
  37. package/dist/refuse/cloud.js +1 -1
  38. package/dist/refuse/server.js +1 -1
  39. package/dist/server/index.js +2 -2
  40. package/dist/server/testing.js +2 -2
  41. package/dist/web/index.js +2 -2
  42. package/dist/web/message.js +2 -2
  43. package/dist/web/palbe.js +2 -2
  44. package/dist/web/payments-ui.js +2 -2
  45. package/dist/web/paywall.js +2 -2
  46. package/dist/web/push-sw.js +1 -1
  47. package/dist/web/ssr.js +2 -2
  48. package/dist/web/vite.js +2 -2
  49. package/package.json +2 -2
  50. package/types/ai/src/ai.d.ts +22 -0
  51. package/types/ai/src/chats.d.ts +65 -15
  52. package/types/ai/src/index.d.ts +4 -1
  53. package/types/ai/src/templates.d.ts +76 -0
  54. package/types/ai/src/workflows.d.ts +201 -0
  55. package/types/cloud/src/generated/project.d.ts +2 -2
  56. package/types/internal/src/modules/ai.d.ts +2242 -674
  57. package/types/internal/src/modules/calls.d.ts +297 -0
  58. package/types/internal/src/modules/events.d.ts +2 -2
  59. package/types/web/src/client.d.ts +3 -0
  60. package/types/web/src/index.d.ts +1 -0
  61. package/types/web/src/templates.d.ts +75 -0
  62. package/types/web/src/voice.d.ts +4 -1
  63. package/dist/chunks/5ZXXBM6L.js +0 -18
  64. package/dist/chunks/65QZXK2S.js +0 -2
  65. package/dist/chunks/MVY4K43S.js +0 -13
@@ -1,4 +1,33 @@
1
1
  import { type Reply, type Transport } from '../transport.js';
2
+ /**
3
+ * Multipart audio upload with explicit speaker attribution.
4
+ */
5
+ export type AdminIngestAudioRequest = {
6
+ /**
7
+ * Optional RFC3339 timestamp when utterance ended.
8
+ */
9
+ ended_at?: string;
10
+ /**
11
+ * Audio clip bytes (WAV, MP3, WebM, OGG, M4A; max 25 MiB).
12
+ */
13
+ file: Blob;
14
+ /**
15
+ * Optional BCP-47 language override.
16
+ */
17
+ language?: string;
18
+ /**
19
+ * Speaker kind (user or bot).
20
+ */
21
+ speaker_kind?: "user" | "bot";
22
+ /**
23
+ * Speaker user id or bot:<identity>.
24
+ */
25
+ speaker_user_id: string;
26
+ /**
27
+ * Optional RFC3339 timestamp when utterance started.
28
+ */
29
+ started_at?: string;
30
+ };
2
31
  /**
3
32
  * A call
4
33
  */
@@ -261,6 +290,27 @@ export type HookSettings = {
261
290
  */
262
291
  url: string;
263
292
  };
293
+ /**
294
+ * Multipart audio upload attributed to the signed-in participant.
295
+ */
296
+ export type IngestAudioRequest = {
297
+ /**
298
+ * Optional RFC3339 timestamp when utterance ended.
299
+ */
300
+ ended_at?: string;
301
+ /**
302
+ * Audio clip bytes (WAV, MP3, WebM, OGG, M4A; max 25 MiB).
303
+ */
304
+ file: Blob;
305
+ /**
306
+ * Optional BCP-47 language override.
307
+ */
308
+ language?: string;
309
+ /**
310
+ * Optional RFC3339 timestamp when utterance started.
311
+ */
312
+ started_at?: string;
313
+ };
264
314
  /**
265
315
  * People to ask in
266
316
  */
@@ -441,6 +491,23 @@ export type StartRefused = {
441
491
  request_id?: string;
442
492
  [key: string]: unknown;
443
493
  };
494
+ /**
495
+ * Starts native speaker-attributed transcription on an active call.
496
+ */
497
+ export type StartTranscriptionRequest = {
498
+ /**
499
+ * BCP-47 language code or auto for detection.
500
+ */
501
+ language?: string;
502
+ /**
503
+ * STT model from the AI catalog (e.g. deepgram/nova-3 or openai/gpt-4o-transcribe).
504
+ */
505
+ model?: string;
506
+ /**
507
+ * Save finalized JSON and plain-text transcript artifacts to project storage.
508
+ */
509
+ save_to_storage?: boolean;
510
+ };
444
511
  /**
445
512
  * A way in for an agent
446
513
  */
@@ -490,6 +557,147 @@ export type TicketRequest = {
490
557
  */
491
558
  name?: string | null;
492
559
  };
560
+ /**
561
+ * Result of transcribing an audio clip for an active call transcription.
562
+ */
563
+ export type TranscriptAudioResult = {
564
+ /**
565
+ * STT cost recorded in billionths of a US dollar.
566
+ */
567
+ cost_nano_usd: number;
568
+ /**
569
+ * Audio duration billed in seconds.
570
+ */
571
+ duration_seconds: number;
572
+ segment?: TranscriptSegment;
573
+ };
574
+ /**
575
+ * Emitted when call transcription stops or its call ends.
576
+ */
577
+ export type TranscriptCompletedEvent = {
578
+ /**
579
+ * The call.
580
+ */
581
+ call_id: string;
582
+ /**
583
+ * Total transcribed audio duration in seconds.
584
+ */
585
+ duration_seconds: number;
586
+ /**
587
+ * Total finalized transcript segments.
588
+ */
589
+ segment_count: number;
590
+ /**
591
+ * Distinct speaker identities seen in the transcript.
592
+ */
593
+ speakers: string[];
594
+ /**
595
+ * Storage key of the JSON transcript artifact when saved.
596
+ */
597
+ transcript_storage_key?: string | null;
598
+ /**
599
+ * Storage key of the plain-text transcript artifact when saved.
600
+ */
601
+ transcript_text_key?: string | null;
602
+ };
603
+ /**
604
+ * One finalized speaker-attributed utterance in a call transcript.
605
+ */
606
+ export type TranscriptSegment = {
607
+ /**
608
+ * The call.
609
+ */
610
+ call_id: string;
611
+ /**
612
+ * When the utterance ended.
613
+ */
614
+ ended_at: string;
615
+ /**
616
+ * Detected or configured language code.
617
+ */
618
+ language?: string;
619
+ /**
620
+ * Monotonic segment sequence number within the call.
621
+ */
622
+ seq: number;
623
+ /**
624
+ * Speaker kind.
625
+ */
626
+ speaker_kind: "user" | "bot";
627
+ /**
628
+ * Speaker user id or bot:<identity>.
629
+ */
630
+ speaker_user_id: string;
631
+ /**
632
+ * When the utterance started.
633
+ */
634
+ started_at: string;
635
+ /**
636
+ * Transcribed utterance text.
637
+ */
638
+ text: string;
639
+ };
640
+ /**
641
+ * Native speaker-attributed transcription state and segments for a call.
642
+ */
643
+ export type Transcription = {
644
+ /**
645
+ * The call.
646
+ */
647
+ call_id: string;
648
+ /**
649
+ * When transcription completed.
650
+ */
651
+ completed_at?: string | null;
652
+ /**
653
+ * Total transcribed audio duration in seconds.
654
+ */
655
+ duration_seconds: number;
656
+ /**
657
+ * Configured language or auto.
658
+ */
659
+ language: string;
660
+ /**
661
+ * STT model used.
662
+ */
663
+ model: string;
664
+ /**
665
+ * Cursor for the next page of transcript segments; absent on the last page.
666
+ */
667
+ next_cursor?: string;
668
+ /**
669
+ * Whether finalized artifacts are saved to project storage.
670
+ */
671
+ save_to_storage: boolean;
672
+ /**
673
+ * Total finalized transcript segments.
674
+ */
675
+ segment_count: number;
676
+ /**
677
+ * Speaker-attributed transcript segments in sequence order.
678
+ */
679
+ segments: TranscriptSegment[];
680
+ /**
681
+ * Distinct speaker identities present in returned segments.
682
+ */
683
+ speakers: string[];
684
+ /**
685
+ * When transcription started.
686
+ */
687
+ started_at: string;
688
+ /**
689
+ * Transcription status.
690
+ */
691
+ status: "active" | "completed";
692
+ /**
693
+ * Storage key of the JSON transcript artifact when saved.
694
+ */
695
+ transcript_storage_key?: string | null;
696
+ /**
697
+ * Storage key of the plain-text transcript artifact when saved.
698
+ */
699
+ transcript_text_key?: string | null;
700
+ };
493
701
  /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
494
702
  export interface Events {
495
703
  /**
@@ -508,6 +716,14 @@ export interface Events {
508
716
  * calls.participant.left: a person or a bot left the call.
509
717
  */
510
718
  "calls.participant.left": CallEvent;
719
+ /**
720
+ * calls.transcript.completed: a call's transcription completed (stopped or call ended) with summary metadata and optional storage keys.
721
+ */
722
+ "calls.transcript.completed": TranscriptCompletedEvent;
723
+ /**
724
+ * calls.transcript.segment: a finalized speaker-attributed utterance was transcribed in a call.
725
+ */
726
+ "calls.transcript.segment": TranscriptSegment;
511
727
  }
512
728
  /** Palbase Calls */
513
729
  export declare function client(t: Transport): {
@@ -583,6 +799,58 @@ export declare function client(t: Transport): {
583
799
  body: TicketRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
584
800
  signal?: AbortSignal;
585
801
  }): Promise<Reply<201, Ticket>>;
802
+ /**
803
+ * Get call transcription
804
+ *
805
+ * Reads the call's native transcription status, storage keys, and speaker-attributed segments.
806
+ */
807
+ adminGetCallTranscription(input: {
808
+ path: {
809
+ call_id: string;
810
+ };
811
+ query?: {
812
+ after_seq?: number; /** Maximum number of segments to return (1 to 1000). */
813
+ limit?: number; /** Segment sequence cursor to read after. */
814
+ cursor?: string;
815
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
816
+ signal?: AbortSignal;
817
+ }): Promise<Reply<200, Transcription>>;
818
+ /**
819
+ * Start call transcription
820
+ *
821
+ * Starts native speaker-attributed transcription on an active call using FRD-01 STT (billed as audio.stt_seconds).
822
+ */
823
+ adminStartCallTranscription(input: {
824
+ path: {
825
+ call_id: string;
826
+ };
827
+ body?: StartTranscriptionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
828
+ signal?: AbortSignal;
829
+ }): Promise<Reply<201, Transcription>>;
830
+ /**
831
+ * Stop call transcription
832
+ *
833
+ * Stops native transcription on the call, saves finalized JSON and text artifacts when save_to_storage is enabled, and emits calls.transcript.completed.
834
+ */
835
+ adminStopCallTranscription(input: {
836
+ path: {
837
+ call_id: string;
838
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
839
+ signal?: AbortSignal;
840
+ }): Promise<Reply<200, Transcription>>;
841
+ /**
842
+ * Transcribe call audio clip
843
+ *
844
+ * Transcribes a speaker-attributed audio clip via FRD-01 STT, appends the segment to the call's transcript, and emits calls.transcript.segment.
845
+ */
846
+ adminIngestCallTranscriptionAudio(input: {
847
+ path: {
848
+ call_id: string;
849
+ };
850
+ body: BodyInit;
851
+ contentType?: string; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
852
+ signal?: AbortSignal;
853
+ }): Promise<Reply<200, TranscriptAudioResult> | Reply<201, TranscriptAudioResult>>;
586
854
  /**
587
855
  * A place's call
588
856
  *
@@ -734,5 +1002,34 @@ export declare function client(t: Transport): {
734
1002
  body: InviteRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
735
1003
  signal?: AbortSignal;
736
1004
  }): Promise<Reply<200, Call>>;
1005
+ /**
1006
+ * Get call transcription
1007
+ *
1008
+ * Reads the call's native transcription status and speaker-attributed segments as a participant in the call.
1009
+ */
1010
+ getCallTranscription(input: {
1011
+ path: {
1012
+ call_id: string;
1013
+ };
1014
+ query?: {
1015
+ after_seq?: number; /** Maximum number of segments to return (1 to 1000). */
1016
+ limit?: number; /** Segment sequence cursor to read after. */
1017
+ cursor?: string;
1018
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1019
+ signal?: AbortSignal;
1020
+ }): Promise<Reply<200, Transcription>>;
1021
+ /**
1022
+ * Transcribe participant audio clip
1023
+ *
1024
+ * Transcribes an audio clip spoken by the signed-in participant and appends a speaker-attributed segment to the call's active transcript.
1025
+ */
1026
+ ingestCallTranscriptionAudio(input: {
1027
+ path: {
1028
+ call_id: string;
1029
+ };
1030
+ body: BodyInit;
1031
+ contentType?: string; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1032
+ signal?: AbortSignal;
1033
+ }): Promise<Reply<200, TranscriptAudioResult> | Reply<201, TranscriptAudioResult>>;
737
1034
  };
738
1035
  export type Client = ReturnType<typeof client>;
@@ -18,11 +18,11 @@ export interface PlatformEvents extends AiEvents, AnalyticsEvents, AuthEvents, C
18
18
  /** A platform event's type: one a module's contract declares. */
19
19
  export type EventType = keyof PlatformEvents;
20
20
  /** Every platform event's type, as the contracts declare them. */
21
- export declare const EVENT_TYPES: readonly ["ai.goal.updated", "ai.response.completed", "ai.response.failed", "ai.response.started", "ai.secret_host_requested", "ai.voice.closed", "ai.voice.delegated", "ai.voice.started", "audience.entered", "audience.exited", "calls.call.ended", "calls.call.started", "calls.participant.joined", "calls.participant.left", "consent.changed", "device.revoked", "file.deleted", "file.moved", "file.uploaded", "flag.changed", "flag.override_changed", "iap.catalog.applied", "iap.catalog.changed", "iap.coupon.redeemed", "iap.credits.depleted", "iap.credits.low", "iap.customer.changed", "iap.customer.erased", "iap.customer.merged", "iap.entitlement.changed", "iap.offer.redeemed", "iap.ownership.transferred", "iap.paywall.published", "iap.purchase.completed", "iap.quota.exhausted", "iap.quota.threshold", "iap.refund.changed", "iap.store.changed", "iap.subscription.changed", "journey.converted", "journey.ended", "journey.entered", "journey.event", "journey.step", "messaging.conversation.created", "messaging.conversation.deleted", "messaging.conversation.read", "messaging.message.created", "messaging.report.created", "notification.action", "notification.bounced", "notification.complained", "notification.delivered", "notification.dismissed", "notification.expired", "notification.failed", "notification.not_shown", "notification.opened", "notification.push_failing", "notification.read", "notification.received", "notification.rejected", "notification.sent", "notification.shared_paused", "notification.unconfirmed", "notification.undelivered", "notification.uninstalled", "payments.dispute.closed", "payments.dispute.opened", "payments.payment.canceled", "payments.payment.failed", "payments.payment.requires_capture", "payments.payment.succeeded", "payments.refund.succeeded", "payments.subscription.canceled", "payments.subscription.changed", "payments.wallet.balance_changed", "payments.wallet.hold_changed", "session.ended", "stores.action.changed", "stores.app.changed", "stores.apple.changed", "stores.apple.key.made", "stores.apple.key.revoked", "stores.apple.session.changed", "stores.apple.session.ended", "stores.apple.session.expired", "stores.beta_review.changed", "stores.build.changed", "stores.delivery.changed", "stores.delivery.requested", "stores.device.changed", "stores.feedback.received", "stores.google.changed", "stores.group.changed", "stores.invitation.changed", "stores.package.changed", "stores.play_release.changed", "stores.product.changed", "stores.review.message", "stores.version.changed", "stores.version.reviewed", "stores.vitals.changed", "stores.webhook.changed", "user.converted", "user.deleted", "user.locale_changed", "user.password_changed", "user.permissions_changed", "workspace.conflict", "workspace.deleted", "workspace.published"];
21
+ export declare const EVENT_TYPES: readonly ["ai.goal.updated", "ai.mcp.auth_completed", "ai.mcp.auth_required", "ai.response.completed", "ai.response.failed", "ai.response.started", "ai.secret_host_requested", "ai.trigger.fired", "ai.voice.closed", "ai.voice.delegated", "ai.voice.started", "ai.wait.created", "ai.wait.resumed", "ai.wait.timed_out", "ai.workflow.completed", "ai.workflow.failed", "audience.entered", "audience.exited", "calls.call.ended", "calls.call.started", "calls.participant.joined", "calls.participant.left", "calls.transcript.completed", "calls.transcript.segment", "consent.changed", "device.revoked", "file.deleted", "file.moved", "file.uploaded", "flag.changed", "flag.override_changed", "iap.catalog.applied", "iap.catalog.changed", "iap.coupon.redeemed", "iap.credits.depleted", "iap.credits.low", "iap.customer.changed", "iap.customer.erased", "iap.customer.merged", "iap.entitlement.changed", "iap.offer.redeemed", "iap.ownership.transferred", "iap.paywall.published", "iap.purchase.completed", "iap.quota.exhausted", "iap.quota.threshold", "iap.refund.changed", "iap.store.changed", "iap.subscription.changed", "journey.converted", "journey.ended", "journey.entered", "journey.event", "journey.step", "messaging.conversation.created", "messaging.conversation.deleted", "messaging.conversation.read", "messaging.message.created", "messaging.report.created", "notification.action", "notification.bounced", "notification.complained", "notification.delivered", "notification.dismissed", "notification.expired", "notification.failed", "notification.not_shown", "notification.opened", "notification.push_failing", "notification.read", "notification.received", "notification.rejected", "notification.sent", "notification.shared_paused", "notification.unconfirmed", "notification.undelivered", "notification.uninstalled", "payments.dispute.closed", "payments.dispute.opened", "payments.payment.canceled", "payments.payment.failed", "payments.payment.requires_capture", "payments.payment.succeeded", "payments.refund.succeeded", "payments.subscription.canceled", "payments.subscription.changed", "payments.wallet.balance_changed", "payments.wallet.hold_changed", "session.ended", "stores.action.changed", "stores.app.changed", "stores.apple.changed", "stores.apple.key.made", "stores.apple.key.revoked", "stores.apple.session.changed", "stores.apple.session.ended", "stores.apple.session.expired", "stores.beta_review.changed", "stores.build.changed", "stores.delivery.changed", "stores.delivery.requested", "stores.device.changed", "stores.feedback.received", "stores.google.changed", "stores.group.changed", "stores.invitation.changed", "stores.package.changed", "stores.play_release.changed", "stores.product.changed", "stores.review.message", "stores.version.changed", "stores.version.reviewed", "stores.vitals.changed", "stores.webhook.changed", "user.converted", "user.deleted", "user.locale_changed", "user.password_changed", "user.permissions_changed", "workspace.conflict", "workspace.deleted", "workspace.published"];
22
22
  /**
23
23
  * A platform event as delivered: one member per type the contracts declare,
24
24
  * its data that type's payload, so a switch on its type narrows it. An
25
25
  * event of a type none of them declares (one a newer platform sends) is no
26
26
  * member: at run time it reaches the switch's default, which takes it.
27
27
  */
28
- export type PalbaseEvent = WebhookEvent<PlatformEvents["ai.goal.updated"], "ai.goal.updated"> | WebhookEvent<PlatformEvents["ai.response.completed"], "ai.response.completed"> | WebhookEvent<PlatformEvents["ai.response.failed"], "ai.response.failed"> | WebhookEvent<PlatformEvents["ai.response.started"], "ai.response.started"> | WebhookEvent<PlatformEvents["ai.secret_host_requested"], "ai.secret_host_requested"> | WebhookEvent<PlatformEvents["ai.voice.closed"], "ai.voice.closed"> | WebhookEvent<PlatformEvents["ai.voice.delegated"], "ai.voice.delegated"> | WebhookEvent<PlatformEvents["ai.voice.started"], "ai.voice.started"> | WebhookEvent<PlatformEvents["audience.entered"], "audience.entered"> | WebhookEvent<PlatformEvents["audience.exited"], "audience.exited"> | WebhookEvent<PlatformEvents["calls.call.ended"], "calls.call.ended"> | WebhookEvent<PlatformEvents["calls.call.started"], "calls.call.started"> | WebhookEvent<PlatformEvents["calls.participant.joined"], "calls.participant.joined"> | WebhookEvent<PlatformEvents["calls.participant.left"], "calls.participant.left"> | WebhookEvent<PlatformEvents["consent.changed"], "consent.changed"> | WebhookEvent<PlatformEvents["device.revoked"], "device.revoked"> | WebhookEvent<PlatformEvents["file.deleted"], "file.deleted"> | WebhookEvent<PlatformEvents["file.moved"], "file.moved"> | WebhookEvent<PlatformEvents["file.uploaded"], "file.uploaded"> | WebhookEvent<PlatformEvents["flag.changed"], "flag.changed"> | WebhookEvent<PlatformEvents["flag.override_changed"], "flag.override_changed"> | WebhookEvent<PlatformEvents["iap.catalog.applied"], "iap.catalog.applied"> | WebhookEvent<PlatformEvents["iap.catalog.changed"], "iap.catalog.changed"> | WebhookEvent<PlatformEvents["iap.coupon.redeemed"], "iap.coupon.redeemed"> | WebhookEvent<PlatformEvents["iap.credits.depleted"], "iap.credits.depleted"> | WebhookEvent<PlatformEvents["iap.credits.low"], "iap.credits.low"> | WebhookEvent<PlatformEvents["iap.customer.changed"], "iap.customer.changed"> | WebhookEvent<PlatformEvents["iap.customer.erased"], "iap.customer.erased"> | WebhookEvent<PlatformEvents["iap.customer.merged"], "iap.customer.merged"> | WebhookEvent<PlatformEvents["iap.entitlement.changed"], "iap.entitlement.changed"> | WebhookEvent<PlatformEvents["iap.offer.redeemed"], "iap.offer.redeemed"> | WebhookEvent<PlatformEvents["iap.ownership.transferred"], "iap.ownership.transferred"> | WebhookEvent<PlatformEvents["iap.paywall.published"], "iap.paywall.published"> | WebhookEvent<PlatformEvents["iap.purchase.completed"], "iap.purchase.completed"> | WebhookEvent<PlatformEvents["iap.quota.exhausted"], "iap.quota.exhausted"> | WebhookEvent<PlatformEvents["iap.quota.threshold"], "iap.quota.threshold"> | WebhookEvent<PlatformEvents["iap.refund.changed"], "iap.refund.changed"> | WebhookEvent<PlatformEvents["iap.store.changed"], "iap.store.changed"> | WebhookEvent<PlatformEvents["iap.subscription.changed"], "iap.subscription.changed"> | WebhookEvent<PlatformEvents["journey.converted"], "journey.converted"> | WebhookEvent<PlatformEvents["journey.ended"], "journey.ended"> | WebhookEvent<PlatformEvents["journey.entered"], "journey.entered"> | WebhookEvent<PlatformEvents["journey.event"], "journey.event"> | WebhookEvent<PlatformEvents["journey.step"], "journey.step"> | WebhookEvent<PlatformEvents["messaging.conversation.created"], "messaging.conversation.created"> | WebhookEvent<PlatformEvents["messaging.conversation.deleted"], "messaging.conversation.deleted"> | WebhookEvent<PlatformEvents["messaging.conversation.read"], "messaging.conversation.read"> | WebhookEvent<PlatformEvents["messaging.message.created"], "messaging.message.created"> | WebhookEvent<PlatformEvents["messaging.report.created"], "messaging.report.created"> | WebhookEvent<PlatformEvents["notification.action"], "notification.action"> | WebhookEvent<PlatformEvents["notification.bounced"], "notification.bounced"> | WebhookEvent<PlatformEvents["notification.complained"], "notification.complained"> | WebhookEvent<PlatformEvents["notification.delivered"], "notification.delivered"> | WebhookEvent<PlatformEvents["notification.dismissed"], "notification.dismissed"> | WebhookEvent<PlatformEvents["notification.expired"], "notification.expired"> | WebhookEvent<PlatformEvents["notification.failed"], "notification.failed"> | WebhookEvent<PlatformEvents["notification.not_shown"], "notification.not_shown"> | WebhookEvent<PlatformEvents["notification.opened"], "notification.opened"> | WebhookEvent<PlatformEvents["notification.push_failing"], "notification.push_failing"> | WebhookEvent<PlatformEvents["notification.read"], "notification.read"> | WebhookEvent<PlatformEvents["notification.received"], "notification.received"> | WebhookEvent<PlatformEvents["notification.rejected"], "notification.rejected"> | WebhookEvent<PlatformEvents["notification.sent"], "notification.sent"> | WebhookEvent<PlatformEvents["notification.shared_paused"], "notification.shared_paused"> | WebhookEvent<PlatformEvents["notification.unconfirmed"], "notification.unconfirmed"> | WebhookEvent<PlatformEvents["notification.undelivered"], "notification.undelivered"> | WebhookEvent<PlatformEvents["notification.uninstalled"], "notification.uninstalled"> | WebhookEvent<PlatformEvents["payments.dispute.closed"], "payments.dispute.closed"> | WebhookEvent<PlatformEvents["payments.dispute.opened"], "payments.dispute.opened"> | WebhookEvent<PlatformEvents["payments.payment.canceled"], "payments.payment.canceled"> | WebhookEvent<PlatformEvents["payments.payment.failed"], "payments.payment.failed"> | WebhookEvent<PlatformEvents["payments.payment.requires_capture"], "payments.payment.requires_capture"> | WebhookEvent<PlatformEvents["payments.payment.succeeded"], "payments.payment.succeeded"> | WebhookEvent<PlatformEvents["payments.refund.succeeded"], "payments.refund.succeeded"> | WebhookEvent<PlatformEvents["payments.subscription.canceled"], "payments.subscription.canceled"> | WebhookEvent<PlatformEvents["payments.subscription.changed"], "payments.subscription.changed"> | WebhookEvent<PlatformEvents["payments.wallet.balance_changed"], "payments.wallet.balance_changed"> | WebhookEvent<PlatformEvents["payments.wallet.hold_changed"], "payments.wallet.hold_changed"> | WebhookEvent<PlatformEvents["session.ended"], "session.ended"> | WebhookEvent<PlatformEvents["stores.action.changed"], "stores.action.changed"> | WebhookEvent<PlatformEvents["stores.app.changed"], "stores.app.changed"> | WebhookEvent<PlatformEvents["stores.apple.changed"], "stores.apple.changed"> | WebhookEvent<PlatformEvents["stores.apple.key.made"], "stores.apple.key.made"> | WebhookEvent<PlatformEvents["stores.apple.key.revoked"], "stores.apple.key.revoked"> | WebhookEvent<PlatformEvents["stores.apple.session.changed"], "stores.apple.session.changed"> | WebhookEvent<PlatformEvents["stores.apple.session.ended"], "stores.apple.session.ended"> | WebhookEvent<PlatformEvents["stores.apple.session.expired"], "stores.apple.session.expired"> | WebhookEvent<PlatformEvents["stores.beta_review.changed"], "stores.beta_review.changed"> | WebhookEvent<PlatformEvents["stores.build.changed"], "stores.build.changed"> | WebhookEvent<PlatformEvents["stores.delivery.changed"], "stores.delivery.changed"> | WebhookEvent<PlatformEvents["stores.delivery.requested"], "stores.delivery.requested"> | WebhookEvent<PlatformEvents["stores.device.changed"], "stores.device.changed"> | WebhookEvent<PlatformEvents["stores.feedback.received"], "stores.feedback.received"> | WebhookEvent<PlatformEvents["stores.google.changed"], "stores.google.changed"> | WebhookEvent<PlatformEvents["stores.group.changed"], "stores.group.changed"> | WebhookEvent<PlatformEvents["stores.invitation.changed"], "stores.invitation.changed"> | WebhookEvent<PlatformEvents["stores.package.changed"], "stores.package.changed"> | WebhookEvent<PlatformEvents["stores.play_release.changed"], "stores.play_release.changed"> | WebhookEvent<PlatformEvents["stores.product.changed"], "stores.product.changed"> | WebhookEvent<PlatformEvents["stores.review.message"], "stores.review.message"> | WebhookEvent<PlatformEvents["stores.version.changed"], "stores.version.changed"> | WebhookEvent<PlatformEvents["stores.version.reviewed"], "stores.version.reviewed"> | WebhookEvent<PlatformEvents["stores.vitals.changed"], "stores.vitals.changed"> | WebhookEvent<PlatformEvents["stores.webhook.changed"], "stores.webhook.changed"> | WebhookEvent<PlatformEvents["user.converted"], "user.converted"> | WebhookEvent<PlatformEvents["user.deleted"], "user.deleted"> | WebhookEvent<PlatformEvents["user.locale_changed"], "user.locale_changed"> | WebhookEvent<PlatformEvents["user.password_changed"], "user.password_changed"> | WebhookEvent<PlatformEvents["user.permissions_changed"], "user.permissions_changed"> | WebhookEvent<PlatformEvents["workspace.conflict"], "workspace.conflict"> | WebhookEvent<PlatformEvents["workspace.deleted"], "workspace.deleted"> | WebhookEvent<PlatformEvents["workspace.published"], "workspace.published">;
28
+ export type PalbaseEvent = WebhookEvent<PlatformEvents["ai.goal.updated"], "ai.goal.updated"> | WebhookEvent<PlatformEvents["ai.mcp.auth_completed"], "ai.mcp.auth_completed"> | WebhookEvent<PlatformEvents["ai.mcp.auth_required"], "ai.mcp.auth_required"> | WebhookEvent<PlatformEvents["ai.response.completed"], "ai.response.completed"> | WebhookEvent<PlatformEvents["ai.response.failed"], "ai.response.failed"> | WebhookEvent<PlatformEvents["ai.response.started"], "ai.response.started"> | WebhookEvent<PlatformEvents["ai.secret_host_requested"], "ai.secret_host_requested"> | WebhookEvent<PlatformEvents["ai.trigger.fired"], "ai.trigger.fired"> | WebhookEvent<PlatformEvents["ai.voice.closed"], "ai.voice.closed"> | WebhookEvent<PlatformEvents["ai.voice.delegated"], "ai.voice.delegated"> | WebhookEvent<PlatformEvents["ai.voice.started"], "ai.voice.started"> | WebhookEvent<PlatformEvents["ai.wait.created"], "ai.wait.created"> | WebhookEvent<PlatformEvents["ai.wait.resumed"], "ai.wait.resumed"> | WebhookEvent<PlatformEvents["ai.wait.timed_out"], "ai.wait.timed_out"> | WebhookEvent<PlatformEvents["ai.workflow.completed"], "ai.workflow.completed"> | WebhookEvent<PlatformEvents["ai.workflow.failed"], "ai.workflow.failed"> | WebhookEvent<PlatformEvents["audience.entered"], "audience.entered"> | WebhookEvent<PlatformEvents["audience.exited"], "audience.exited"> | WebhookEvent<PlatformEvents["calls.call.ended"], "calls.call.ended"> | WebhookEvent<PlatformEvents["calls.call.started"], "calls.call.started"> | WebhookEvent<PlatformEvents["calls.participant.joined"], "calls.participant.joined"> | WebhookEvent<PlatformEvents["calls.participant.left"], "calls.participant.left"> | WebhookEvent<PlatformEvents["calls.transcript.completed"], "calls.transcript.completed"> | WebhookEvent<PlatformEvents["calls.transcript.segment"], "calls.transcript.segment"> | WebhookEvent<PlatformEvents["consent.changed"], "consent.changed"> | WebhookEvent<PlatformEvents["device.revoked"], "device.revoked"> | WebhookEvent<PlatformEvents["file.deleted"], "file.deleted"> | WebhookEvent<PlatformEvents["file.moved"], "file.moved"> | WebhookEvent<PlatformEvents["file.uploaded"], "file.uploaded"> | WebhookEvent<PlatformEvents["flag.changed"], "flag.changed"> | WebhookEvent<PlatformEvents["flag.override_changed"], "flag.override_changed"> | WebhookEvent<PlatformEvents["iap.catalog.applied"], "iap.catalog.applied"> | WebhookEvent<PlatformEvents["iap.catalog.changed"], "iap.catalog.changed"> | WebhookEvent<PlatformEvents["iap.coupon.redeemed"], "iap.coupon.redeemed"> | WebhookEvent<PlatformEvents["iap.credits.depleted"], "iap.credits.depleted"> | WebhookEvent<PlatformEvents["iap.credits.low"], "iap.credits.low"> | WebhookEvent<PlatformEvents["iap.customer.changed"], "iap.customer.changed"> | WebhookEvent<PlatformEvents["iap.customer.erased"], "iap.customer.erased"> | WebhookEvent<PlatformEvents["iap.customer.merged"], "iap.customer.merged"> | WebhookEvent<PlatformEvents["iap.entitlement.changed"], "iap.entitlement.changed"> | WebhookEvent<PlatformEvents["iap.offer.redeemed"], "iap.offer.redeemed"> | WebhookEvent<PlatformEvents["iap.ownership.transferred"], "iap.ownership.transferred"> | WebhookEvent<PlatformEvents["iap.paywall.published"], "iap.paywall.published"> | WebhookEvent<PlatformEvents["iap.purchase.completed"], "iap.purchase.completed"> | WebhookEvent<PlatformEvents["iap.quota.exhausted"], "iap.quota.exhausted"> | WebhookEvent<PlatformEvents["iap.quota.threshold"], "iap.quota.threshold"> | WebhookEvent<PlatformEvents["iap.refund.changed"], "iap.refund.changed"> | WebhookEvent<PlatformEvents["iap.store.changed"], "iap.store.changed"> | WebhookEvent<PlatformEvents["iap.subscription.changed"], "iap.subscription.changed"> | WebhookEvent<PlatformEvents["journey.converted"], "journey.converted"> | WebhookEvent<PlatformEvents["journey.ended"], "journey.ended"> | WebhookEvent<PlatformEvents["journey.entered"], "journey.entered"> | WebhookEvent<PlatformEvents["journey.event"], "journey.event"> | WebhookEvent<PlatformEvents["journey.step"], "journey.step"> | WebhookEvent<PlatformEvents["messaging.conversation.created"], "messaging.conversation.created"> | WebhookEvent<PlatformEvents["messaging.conversation.deleted"], "messaging.conversation.deleted"> | WebhookEvent<PlatformEvents["messaging.conversation.read"], "messaging.conversation.read"> | WebhookEvent<PlatformEvents["messaging.message.created"], "messaging.message.created"> | WebhookEvent<PlatformEvents["messaging.report.created"], "messaging.report.created"> | WebhookEvent<PlatformEvents["notification.action"], "notification.action"> | WebhookEvent<PlatformEvents["notification.bounced"], "notification.bounced"> | WebhookEvent<PlatformEvents["notification.complained"], "notification.complained"> | WebhookEvent<PlatformEvents["notification.delivered"], "notification.delivered"> | WebhookEvent<PlatformEvents["notification.dismissed"], "notification.dismissed"> | WebhookEvent<PlatformEvents["notification.expired"], "notification.expired"> | WebhookEvent<PlatformEvents["notification.failed"], "notification.failed"> | WebhookEvent<PlatformEvents["notification.not_shown"], "notification.not_shown"> | WebhookEvent<PlatformEvents["notification.opened"], "notification.opened"> | WebhookEvent<PlatformEvents["notification.push_failing"], "notification.push_failing"> | WebhookEvent<PlatformEvents["notification.read"], "notification.read"> | WebhookEvent<PlatformEvents["notification.received"], "notification.received"> | WebhookEvent<PlatformEvents["notification.rejected"], "notification.rejected"> | WebhookEvent<PlatformEvents["notification.sent"], "notification.sent"> | WebhookEvent<PlatformEvents["notification.shared_paused"], "notification.shared_paused"> | WebhookEvent<PlatformEvents["notification.unconfirmed"], "notification.unconfirmed"> | WebhookEvent<PlatformEvents["notification.undelivered"], "notification.undelivered"> | WebhookEvent<PlatformEvents["notification.uninstalled"], "notification.uninstalled"> | WebhookEvent<PlatformEvents["payments.dispute.closed"], "payments.dispute.closed"> | WebhookEvent<PlatformEvents["payments.dispute.opened"], "payments.dispute.opened"> | WebhookEvent<PlatformEvents["payments.payment.canceled"], "payments.payment.canceled"> | WebhookEvent<PlatformEvents["payments.payment.failed"], "payments.payment.failed"> | WebhookEvent<PlatformEvents["payments.payment.requires_capture"], "payments.payment.requires_capture"> | WebhookEvent<PlatformEvents["payments.payment.succeeded"], "payments.payment.succeeded"> | WebhookEvent<PlatformEvents["payments.refund.succeeded"], "payments.refund.succeeded"> | WebhookEvent<PlatformEvents["payments.subscription.canceled"], "payments.subscription.canceled"> | WebhookEvent<PlatformEvents["payments.subscription.changed"], "payments.subscription.changed"> | WebhookEvent<PlatformEvents["payments.wallet.balance_changed"], "payments.wallet.balance_changed"> | WebhookEvent<PlatformEvents["payments.wallet.hold_changed"], "payments.wallet.hold_changed"> | WebhookEvent<PlatformEvents["session.ended"], "session.ended"> | WebhookEvent<PlatformEvents["stores.action.changed"], "stores.action.changed"> | WebhookEvent<PlatformEvents["stores.app.changed"], "stores.app.changed"> | WebhookEvent<PlatformEvents["stores.apple.changed"], "stores.apple.changed"> | WebhookEvent<PlatformEvents["stores.apple.key.made"], "stores.apple.key.made"> | WebhookEvent<PlatformEvents["stores.apple.key.revoked"], "stores.apple.key.revoked"> | WebhookEvent<PlatformEvents["stores.apple.session.changed"], "stores.apple.session.changed"> | WebhookEvent<PlatformEvents["stores.apple.session.ended"], "stores.apple.session.ended"> | WebhookEvent<PlatformEvents["stores.apple.session.expired"], "stores.apple.session.expired"> | WebhookEvent<PlatformEvents["stores.beta_review.changed"], "stores.beta_review.changed"> | WebhookEvent<PlatformEvents["stores.build.changed"], "stores.build.changed"> | WebhookEvent<PlatformEvents["stores.delivery.changed"], "stores.delivery.changed"> | WebhookEvent<PlatformEvents["stores.delivery.requested"], "stores.delivery.requested"> | WebhookEvent<PlatformEvents["stores.device.changed"], "stores.device.changed"> | WebhookEvent<PlatformEvents["stores.feedback.received"], "stores.feedback.received"> | WebhookEvent<PlatformEvents["stores.google.changed"], "stores.google.changed"> | WebhookEvent<PlatformEvents["stores.group.changed"], "stores.group.changed"> | WebhookEvent<PlatformEvents["stores.invitation.changed"], "stores.invitation.changed"> | WebhookEvent<PlatformEvents["stores.package.changed"], "stores.package.changed"> | WebhookEvent<PlatformEvents["stores.play_release.changed"], "stores.play_release.changed"> | WebhookEvent<PlatformEvents["stores.product.changed"], "stores.product.changed"> | WebhookEvent<PlatformEvents["stores.review.message"], "stores.review.message"> | WebhookEvent<PlatformEvents["stores.version.changed"], "stores.version.changed"> | WebhookEvent<PlatformEvents["stores.version.reviewed"], "stores.version.reviewed"> | WebhookEvent<PlatformEvents["stores.vitals.changed"], "stores.vitals.changed"> | WebhookEvent<PlatformEvents["stores.webhook.changed"], "stores.webhook.changed"> | WebhookEvent<PlatformEvents["user.converted"], "user.converted"> | WebhookEvent<PlatformEvents["user.deleted"], "user.deleted"> | WebhookEvent<PlatformEvents["user.locale_changed"], "user.locale_changed"> | WebhookEvent<PlatformEvents["user.password_changed"], "user.password_changed"> | WebhookEvent<PlatformEvents["user.permissions_changed"], "user.permissions_changed"> | WebhookEvent<PlatformEvents["workspace.conflict"], "workspace.conflict"> | WebhookEvent<PlatformEvents["workspace.deleted"], "workspace.deleted"> | WebhookEvent<PlatformEvents["workspace.published"], "workspace.published">;
@@ -13,6 +13,7 @@ import { type ChatToolCall, type SessionSummaryEvent } from './chat.js';
13
13
  import { Flags } from './flags.js';
14
14
  import { Messaging, type MessagingOptions } from './messaging.js';
15
15
  import { Calls, type CallsOptions } from './calls.js';
16
+ import { type WebAI } from './templates.js';
16
17
  export interface ClientOptions {
17
18
  /** The project's address: https://<ref>.<domain> */
18
19
  url: string;
@@ -106,6 +107,8 @@ export interface PalbaseClient {
106
107
  messaging: Messaging;
107
108
  /** The signed-in person's voice and video calls: made, rung, answered — one to one or in a group. */
108
109
  calls: Calls;
110
+ /** Guardrailed zero-backend client AI (`pb.ai.templates`): run, stream, speech, and live voice locked on the server. */
111
+ ai: WebAI;
109
112
  /** The language every request says from now on (ClientOptions.language); null for the browser's own. */
110
113
  setLanguage(language: string | readonly string[] | null): void;
111
114
  /**
@@ -8,6 +8,7 @@ export { Installation } from './installation.js';
8
8
  export { sessionSummary } from './chat.js';
9
9
  export type { AgentEvent, ChatAttachment, ChatEvent, ChatExecutionState, ChatGoal, ChatItem, ChatMessageView, ChatPart, ChatPartsPage, ChatPartsQuery, ChatResponse, ChatState, ChatStreamPart, ChatThinking, ChatToolCall, ChatVoice, ContextCompactedEvent, ContextOffloadedEvent, GatewayChat, GoalEvent, HistoryEvent, HistoryItem, Publication, SessionHandedOffEvent, SessionMachineStatusEvent, SessionSummaryEvent, ThinkingEvent, ToolEvent, TranscriptEvent, TurnEnd, TurnEvent, VoiceEvent, } from './chat.js';
10
10
  export { connectVoice, type StartedVoice, type VoiceConnection, type VoiceOptions } from './voice.js';
11
+ export { ClientTemplates, type TemplateAttachment, type TemplateRunOptions, type TemplateRunResult, type TemplateRunUsage, type TemplateStreamChunk, type TemplateVoiceOptions, type TemplateVoiceResult, type WebAI, } from './templates.js';
11
12
  export { Iap, redemptionToken, type CheckoutSource, type CustomerInfo, type CustomerInfoListener, type GrantInfo, type MergeGrant, type OfferView, type Offerings, type Redeemed, type RedemptionLink, type RefundDataConsent, } from './iap.js';
12
13
  export { Payments, TERMINAL_INTENT_STATUSES, declineMessage, isTerminalIntentStatus, mountEmbedFrame, parseCallbackMessage, type Address, type Buyer, type CancelSubscriptionResponse, type Capabilities, type CapabilitiesResponse, type ConfirmIntentOptions, type InstallmentConfig, type InstallmentOption, type InstallmentTable, type IntentView, type MasterpassAction, type NextAction, type OtpPromptContext, type PaymentCallbackMessage, type PaymentRealtimeEvent, type PaymentRealtimeListener, type PresentIntentOptions, type PresentableIntent, type ProviderOptions, type SavedMethodView, type SpendToken, type SubmitOtpOptions, type SubscriptionListResponse, type SubscriptionSummary, type TopUpWalletOptions, type WaitForIntentOptions, type WalletBalance, type WalletBalancesListener, } from './payments.js';
13
14
  export { Notify, WebPush, type PushPermission, type PushSubscribeOptions } from './notify.js';
@@ -0,0 +1,75 @@
1
+ import { type Fetch } from '../../internal/src/transport.js';
2
+ import type { SessionManager } from './session.js';
3
+ import type { Installation } from './installation.js';
4
+ export interface TemplateAttachment {
5
+ bucket?: string;
6
+ path?: string;
7
+ media_type?: string;
8
+ data?: string;
9
+ url?: string;
10
+ }
11
+ export interface TemplateRunOptions {
12
+ variables?: Record<string, unknown>;
13
+ attachments?: TemplateAttachment[];
14
+ /** Development-only debug attestation token (always rejected on production environments). */
15
+ debugAttestToken?: string;
16
+ signal?: AbortSignal;
17
+ }
18
+ export interface TemplateRunUsage {
19
+ input_tokens: number;
20
+ output_tokens: number;
21
+ usd: number;
22
+ }
23
+ export interface TemplateRunResult {
24
+ template: string;
25
+ version: number;
26
+ model: string;
27
+ text: string;
28
+ usage: TemplateRunUsage;
29
+ }
30
+ export interface TemplateStreamChunk {
31
+ delta: string;
32
+ model?: string;
33
+ finishReason?: string;
34
+ }
35
+ export interface TemplateVoiceOptions {
36
+ /** WebRTC SDP offer created by the browser's RTCPeerConnection. */
37
+ sdp: string;
38
+ variables?: Record<string, unknown>;
39
+ /** Development-only debug attestation token (always rejected on production environments). */
40
+ debugAttestToken?: string;
41
+ signal?: AbortSignal;
42
+ }
43
+ export interface TemplateVoiceResult {
44
+ id: string;
45
+ template: string;
46
+ version: number;
47
+ model: string;
48
+ status: string;
49
+ started_at: string;
50
+ transport: {
51
+ type: 'webrtc';
52
+ sdp: string;
53
+ };
54
+ }
55
+ export interface WebAI {
56
+ /** Guardrailed direct server-locked AI templates (`pb.ai.templates`). */
57
+ readonly templates: ClientTemplates;
58
+ }
59
+ export declare class ClientTemplates {
60
+ private readonly origin;
61
+ private readonly publishableKey;
62
+ private readonly session;
63
+ private readonly installation;
64
+ private readonly fetchFn;
65
+ constructor(origin: string, publishableKey: string, session: SessionManager, installation: Installation, fetchFn: Fetch);
66
+ private buildHeaders;
67
+ /** Runs a published server-locked text template and returns its JSON output. */
68
+ run(name: string, opts?: TemplateRunOptions): Promise<TemplateRunResult>;
69
+ /** Streams a published server-locked text template over SSE (`AsyncIterable<TemplateStreamChunk>`). */
70
+ stream(name: string, opts?: TemplateRunOptions): AsyncIterable<TemplateStreamChunk>;
71
+ /** Runs a published `tts` template and returns raw MP3 audio bytes (`ArrayBuffer`). */
72
+ speech(name: string, opts?: Omit<TemplateRunOptions, 'attachments'>): Promise<ArrayBuffer>;
73
+ /** Starts a WebRTC live voice session strictly locked to a published `voice_live` template. */
74
+ startVoice(name: string, opts: TemplateVoiceOptions): Promise<TemplateVoiceResult>;
75
+ }
@@ -1,7 +1,10 @@
1
1
  /** What the app's backend answers the offer with: the voice it started, and the provider's answer (chats.voice.start). */
2
2
  export interface StartedVoice {
3
3
  id: string;
4
- sdp: string;
4
+ sdp?: string;
5
+ transport?: {
6
+ sdp?: string;
7
+ };
5
8
  }
6
9
  export interface VoiceOptions {
7
10
  /** The round trip to the app's own backend: the offer (an SDP) in, the voice and its answer out. */