@talk2view/sdk 0.19.0 → 0.20.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.
- package/README.md +8 -2
- package/dist/assistant-ui/index.d.ts.map +1 -1
- package/dist/assistant-ui/index.js +9 -4
- package/dist/assistant-ui/index.js.map +1 -1
- package/dist/auth.d.ts +8 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +27 -11
- package/dist/auth.js.map +1 -1
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/index.js +1 -0
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/launcher.d.ts.map +1 -1
- package/dist/chat/launcher.js +11 -2
- package/dist/chat/launcher.js.map +1 -1
- package/dist/chat/provider.d.ts +15 -0
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +36 -3
- package/dist/chat/provider.js.map +1 -1
- package/dist/chat/voice-button.d.ts +34 -0
- package/dist/chat/voice-button.d.ts.map +1 -0
- package/dist/chat/voice-button.js +175 -0
- package/dist/chat/voice-button.js.map +1 -0
- package/dist/chat-css.js +1 -1
- package/dist/chat.css +1 -1
- package/dist/chat.isolated.css +169 -3
- package/dist/chat.raw.css +169 -3
- package/dist/event-emitter.d.ts +1 -0
- package/dist/event-emitter.d.ts.map +1 -1
- package/dist/event-emitter.js +3 -0
- package/dist/event-emitter.js.map +1 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +60 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/voice-error.d.ts +8 -0
- package/dist/voice-error.d.ts.map +1 -0
- package/dist/voice-error.js +10 -0
- package/dist/voice-error.js.map +1 -0
- package/dist/voice-facade.d.ts +57 -0
- package/dist/voice-facade.d.ts.map +1 -0
- package/dist/voice-facade.js +139 -0
- package/dist/voice-facade.js.map +1 -0
- package/dist/voice.d.ts +157 -0
- package/dist/voice.d.ts.map +1 -0
- package/dist/voice.js +630 -0
- package/dist/voice.js.map +1 -0
- package/docs/chat.md +4 -4
- package/docs/voice.md +88 -0
- package/package.json +3 -1
package/dist/chat.isolated.css
CHANGED
|
@@ -687,6 +687,9 @@
|
|
|
687
687
|
.t2v-chat .h-\[17px\] {
|
|
688
688
|
height: 17px !important;
|
|
689
689
|
}
|
|
690
|
+
.t2v-chat .h-\[20px\] {
|
|
691
|
+
height: 20px !important;
|
|
692
|
+
}
|
|
690
693
|
.t2v-chat .h-\[29px\] {
|
|
691
694
|
height: 29px !important;
|
|
692
695
|
}
|
|
@@ -771,6 +774,9 @@
|
|
|
771
774
|
.t2v-chat .w-\[14px\] {
|
|
772
775
|
width: 14px !important;
|
|
773
776
|
}
|
|
777
|
+
.t2v-chat .w-\[22px\] {
|
|
778
|
+
width: 22px !important;
|
|
779
|
+
}
|
|
774
780
|
.t2v-chat .w-\[40px\] {
|
|
775
781
|
width: 40px !important;
|
|
776
782
|
}
|
|
@@ -3339,14 +3345,154 @@
|
|
|
3339
3345
|
animation: t2v-cursor-blink 1s step-end infinite;
|
|
3340
3346
|
}
|
|
3341
3347
|
}
|
|
3342
|
-
.t2v-chat .
|
|
3348
|
+
.t2v-chat .t2v-voice, .t2v-chat.t2v-voice {
|
|
3349
|
+
position: relative;
|
|
3350
|
+
display: flex;
|
|
3351
|
+
align-items: flex-end;
|
|
3352
|
+
}
|
|
3353
|
+
.t2v-chat .t2v-voice {
|
|
3354
|
+
margin-inline-end: 0.5rem;
|
|
3355
|
+
}
|
|
3356
|
+
.t2v-chat.t2v-voice {
|
|
3357
|
+
display: inline-flex;
|
|
3358
|
+
height: auto;
|
|
3359
|
+
}
|
|
3360
|
+
.t2v-chat .t2v-voice-button {
|
|
3361
|
+
display: inline-flex;
|
|
3362
|
+
flex-shrink: 0;
|
|
3363
|
+
align-items: center;
|
|
3364
|
+
justify-content: center;
|
|
3365
|
+
width: 4rem;
|
|
3366
|
+
height: 4rem;
|
|
3367
|
+
padding: 0;
|
|
3368
|
+
border: 0;
|
|
3369
|
+
border-radius: 0;
|
|
3370
|
+
background-color: var(--primary);
|
|
3371
|
+
color: var(--primary-foreground);
|
|
3372
|
+
cursor: pointer;
|
|
3373
|
+
box-shadow: 0 6px 20px -8px rgb(2 28 37 / 0.55);
|
|
3374
|
+
}
|
|
3375
|
+
.t2v-chat .t2v-voice-button:hover {
|
|
3376
|
+
filter: brightness(0.95);
|
|
3377
|
+
}
|
|
3378
|
+
.t2v-chat .t2v-voice-button:active {
|
|
3379
|
+
scale: 0.96;
|
|
3380
|
+
}
|
|
3381
|
+
.t2v-chat .t2v-voice-button:focus-visible {
|
|
3382
|
+
outline: 2px solid var(--ring);
|
|
3383
|
+
outline-offset: 6px;
|
|
3384
|
+
}
|
|
3385
|
+
.t2v-chat .t2v-voice-button[data-state='listening'] {
|
|
3386
|
+
background-color: var(--primary-foreground);
|
|
3387
|
+
color: var(--primary);
|
|
3388
|
+
}
|
|
3389
|
+
.t2v-chat .t2v-voice-spin {
|
|
3390
|
+
animation: t2v-voice-spin 0.9s linear infinite;
|
|
3391
|
+
}
|
|
3392
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
3393
|
+
.t2v-chat .t2v-voice-button {
|
|
3394
|
+
transition: scale 150ms ease-out;
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3398
|
+
.t2v-chat .t2v-voice-button .t2v-wave-bar {
|
|
3399
|
+
animation: none;
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
.t2v-chat .t2v-voice-popover {
|
|
3403
|
+
position: absolute;
|
|
3404
|
+
inset-block-end: calc(100% + 0.75rem);
|
|
3405
|
+
inset-inline-end: 0;
|
|
3406
|
+
display: flex;
|
|
3407
|
+
flex-direction: column;
|
|
3408
|
+
align-items: flex-end;
|
|
3409
|
+
gap: 0.5rem;
|
|
3410
|
+
width: max-content;
|
|
3411
|
+
max-width: min(20rem, calc(100vw - 2rem));
|
|
3412
|
+
font-size: 0.8125rem;
|
|
3413
|
+
line-height: 1.4;
|
|
3414
|
+
}
|
|
3415
|
+
.t2v-chat .t2v-voice-status, .t2v-chat .t2v-voice-error {
|
|
3416
|
+
border: 1px solid var(--border);
|
|
3417
|
+
border-radius: var(--radius);
|
|
3418
|
+
background-color: var(--popover);
|
|
3419
|
+
color: var(--popover-foreground);
|
|
3420
|
+
box-shadow: 0 6px 20px -8px rgb(2 28 37 / 0.35);
|
|
3421
|
+
}
|
|
3422
|
+
.t2v-chat .t2v-voice-status {
|
|
3423
|
+
padding: 0.375rem 0.75rem;
|
|
3424
|
+
font-weight: 500;
|
|
3425
|
+
white-space: nowrap;
|
|
3426
|
+
}
|
|
3427
|
+
.t2v-chat .t2v-voice-error {
|
|
3428
|
+
display: flex;
|
|
3429
|
+
align-items: flex-start;
|
|
3430
|
+
gap: 0.5rem;
|
|
3431
|
+
padding: 0.5rem 0.5rem 0.5rem 0.75rem;
|
|
3432
|
+
border-inline-start: 3px solid var(--destructive);
|
|
3433
|
+
}
|
|
3434
|
+
.t2v-chat .t2v-voice-dismiss {
|
|
3435
|
+
display: inline-flex;
|
|
3436
|
+
flex-shrink: 0;
|
|
3437
|
+
padding: 0.125rem;
|
|
3438
|
+
border: 0;
|
|
3439
|
+
background: transparent;
|
|
3440
|
+
color: var(--muted-foreground);
|
|
3441
|
+
cursor: pointer;
|
|
3442
|
+
}
|
|
3443
|
+
.t2v-chat .t2v-voice-dismiss:hover {
|
|
3444
|
+
color: var(--popover-foreground);
|
|
3445
|
+
}
|
|
3446
|
+
.t2v-chat .t2v-voice-dismiss:focus-visible {
|
|
3447
|
+
outline: 2px solid var(--ring);
|
|
3448
|
+
outline-offset: 1px;
|
|
3449
|
+
}
|
|
3450
|
+
.t2v-chat .t2v-voice-approval {
|
|
3451
|
+
width: 20rem;
|
|
3452
|
+
max-width: 100%;
|
|
3453
|
+
color-scheme: light;
|
|
3454
|
+
background-color: #ffffff;
|
|
3455
|
+
box-shadow: 0 16px 48px -24px rgb(0 0 0 / 0.35);
|
|
3456
|
+
--t2v-bg: #ffffff;
|
|
3457
|
+
--t2v-foreground: var(--t2v-smoke);
|
|
3458
|
+
--t2v-surface: var(--t2v-ivory);
|
|
3459
|
+
--t2v-surface-hover: var(--t2v-stone);
|
|
3460
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
3461
|
+
--t2v-surface-hover: color-mix(in srgb, var(--t2v-stone) 25%, var(--t2v-ivory));
|
|
3462
|
+
}
|
|
3463
|
+
--t2v-muted: var(--t2v-slate);
|
|
3464
|
+
--t2v-border: var(--t2v-stone);
|
|
3465
|
+
--t2v-error: #bb524e;
|
|
3466
|
+
--t2v-radius-sm: calc(var(--radius) * 0.6);
|
|
3467
|
+
--t2v-radius-md: calc(var(--radius) * 0.8);
|
|
3468
|
+
--t2v-radius-lg: var(--radius);
|
|
3469
|
+
--t2v-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
3470
|
+
}
|
|
3471
|
+
.t2v-chat .t2v-voice-approval > [role='region'] {
|
|
3472
|
+
margin: 0 !important;
|
|
3473
|
+
}
|
|
3474
|
+
.t2v-chat .t2v-voice-sr {
|
|
3475
|
+
position: absolute;
|
|
3476
|
+
width: 1px;
|
|
3477
|
+
height: 1px;
|
|
3478
|
+
margin: -1px;
|
|
3479
|
+
padding: 0;
|
|
3480
|
+
overflow: hidden;
|
|
3481
|
+
clip-path: inset(50%);
|
|
3482
|
+
white-space: nowrap;
|
|
3483
|
+
border: 0;
|
|
3484
|
+
}
|
|
3485
|
+
.t2v-chat .t2v-voice-tucked:not([data-on]) {
|
|
3486
|
+
display: none;
|
|
3487
|
+
}
|
|
3488
|
+
.t2v-chat .aui-modal-button, .t2v-chat .t2v-voice-button {
|
|
3343
3489
|
position: relative;
|
|
3344
3490
|
--t2v-beam-tail: #26c8b8;
|
|
3345
3491
|
--t2v-beam-mid: #73ffff;
|
|
3346
3492
|
--t2v-beam-head: #ffffff;
|
|
3347
3493
|
--t2v-beam-ring: rgb(115 255 255 / 0.4);
|
|
3348
3494
|
}
|
|
3349
|
-
.t2v-chat .aui-modal-button::before {
|
|
3495
|
+
.t2v-chat .aui-modal-button::before, .t2v-chat .t2v-voice-button::before {
|
|
3350
3496
|
content: "";
|
|
3351
3497
|
position: absolute;
|
|
3352
3498
|
inset: 0;
|
|
@@ -3358,11 +3504,26 @@
|
|
|
3358
3504
|
animation: t2v-beam 3.2s linear infinite;
|
|
3359
3505
|
}
|
|
3360
3506
|
@media (prefers-reduced-motion: reduce) {
|
|
3361
|
-
.t2v-chat .aui-modal-button::before {
|
|
3507
|
+
.t2v-chat .aui-modal-button::before, .t2v-chat .t2v-voice-button::before {
|
|
3362
3508
|
background: linear-gradient(var(--t2v-beam-mid) 0 0);
|
|
3363
3509
|
animation: t2v-beam-breathe 2.4s ease-in-out infinite;
|
|
3364
3510
|
}
|
|
3365
3511
|
}
|
|
3512
|
+
.t2v-chat .t2v-voice-button[data-state='connecting']::before, .t2v-chat .t2v-voice-button[data-state='listening']::before {
|
|
3513
|
+
filter: drop-shadow(0 0 9px var(--t2v-beam-mid));
|
|
3514
|
+
animation-duration: 1.2s;
|
|
3515
|
+
}
|
|
3516
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3517
|
+
.t2v-chat .t2v-voice-button[data-state='connecting']::before, .t2v-chat .t2v-voice-button[data-state='listening']::before {
|
|
3518
|
+
animation-duration: 1.1s;
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
.t2v-chat .t2v-voice-button[data-busy] {
|
|
3522
|
+
--t2v-beam-tail: #bb524e;
|
|
3523
|
+
--t2v-beam-mid: #f0a74a;
|
|
3524
|
+
--t2v-beam-head: #fff490;
|
|
3525
|
+
--t2v-beam-ring: rgb(240 167 74 / 0.4);
|
|
3526
|
+
}
|
|
3366
3527
|
.t2v-chat .t2v-tool-approval-prompt {
|
|
3367
3528
|
display: -webkit-box;
|
|
3368
3529
|
-webkit-box-orient: vertical;
|
|
@@ -3442,6 +3603,11 @@
|
|
|
3442
3603
|
opacity: 0;
|
|
3443
3604
|
}
|
|
3444
3605
|
}
|
|
3606
|
+
@keyframes t2v-voice-spin {
|
|
3607
|
+
to {
|
|
3608
|
+
rotate: 360deg;
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3445
3611
|
@keyframes t2v-collapsible-down {
|
|
3446
3612
|
from {
|
|
3447
3613
|
height: 0;
|
package/dist/chat.raw.css
CHANGED
|
@@ -694,6 +694,9 @@
|
|
|
694
694
|
.h-\[17px\] {
|
|
695
695
|
height: 17px;
|
|
696
696
|
}
|
|
697
|
+
.h-\[20px\] {
|
|
698
|
+
height: 20px;
|
|
699
|
+
}
|
|
697
700
|
.h-\[29px\] {
|
|
698
701
|
height: 29px;
|
|
699
702
|
}
|
|
@@ -778,6 +781,9 @@
|
|
|
778
781
|
.w-\[14px\] {
|
|
779
782
|
width: 14px;
|
|
780
783
|
}
|
|
784
|
+
.w-\[22px\] {
|
|
785
|
+
width: 22px;
|
|
786
|
+
}
|
|
781
787
|
.w-\[40px\] {
|
|
782
788
|
width: 40px;
|
|
783
789
|
}
|
|
@@ -3347,14 +3353,154 @@
|
|
|
3347
3353
|
animation: t2v-cursor-blink 1s step-end infinite;
|
|
3348
3354
|
}
|
|
3349
3355
|
}
|
|
3350
|
-
.
|
|
3356
|
+
.t2v-voice, :root.t2v-voice {
|
|
3357
|
+
position: relative;
|
|
3358
|
+
display: flex;
|
|
3359
|
+
align-items: flex-end;
|
|
3360
|
+
}
|
|
3361
|
+
.t2v-voice {
|
|
3362
|
+
margin-inline-end: 0.5rem;
|
|
3363
|
+
}
|
|
3364
|
+
:root.t2v-voice {
|
|
3365
|
+
display: inline-flex;
|
|
3366
|
+
height: auto;
|
|
3367
|
+
}
|
|
3368
|
+
.t2v-voice-button {
|
|
3369
|
+
display: inline-flex;
|
|
3370
|
+
flex-shrink: 0;
|
|
3371
|
+
align-items: center;
|
|
3372
|
+
justify-content: center;
|
|
3373
|
+
width: 4rem;
|
|
3374
|
+
height: 4rem;
|
|
3375
|
+
padding: 0;
|
|
3376
|
+
border: 0;
|
|
3377
|
+
border-radius: 0;
|
|
3378
|
+
background-color: var(--primary);
|
|
3379
|
+
color: var(--primary-foreground);
|
|
3380
|
+
cursor: pointer;
|
|
3381
|
+
box-shadow: 0 6px 20px -8px rgb(2 28 37 / 0.55);
|
|
3382
|
+
}
|
|
3383
|
+
.t2v-voice-button:hover {
|
|
3384
|
+
filter: brightness(0.95);
|
|
3385
|
+
}
|
|
3386
|
+
.t2v-voice-button:active {
|
|
3387
|
+
scale: 0.96;
|
|
3388
|
+
}
|
|
3389
|
+
.t2v-voice-button:focus-visible {
|
|
3390
|
+
outline: 2px solid var(--ring);
|
|
3391
|
+
outline-offset: 6px;
|
|
3392
|
+
}
|
|
3393
|
+
.t2v-voice-button[data-state='listening'] {
|
|
3394
|
+
background-color: var(--primary-foreground);
|
|
3395
|
+
color: var(--primary);
|
|
3396
|
+
}
|
|
3397
|
+
.t2v-voice-spin {
|
|
3398
|
+
animation: t2v-voice-spin 0.9s linear infinite;
|
|
3399
|
+
}
|
|
3400
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
3401
|
+
.t2v-voice-button {
|
|
3402
|
+
transition: scale 150ms ease-out;
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3406
|
+
.t2v-voice-button .t2v-wave-bar {
|
|
3407
|
+
animation: none;
|
|
3408
|
+
}
|
|
3409
|
+
}
|
|
3410
|
+
.t2v-voice-popover {
|
|
3411
|
+
position: absolute;
|
|
3412
|
+
inset-block-end: calc(100% + 0.75rem);
|
|
3413
|
+
inset-inline-end: 0;
|
|
3414
|
+
display: flex;
|
|
3415
|
+
flex-direction: column;
|
|
3416
|
+
align-items: flex-end;
|
|
3417
|
+
gap: 0.5rem;
|
|
3418
|
+
width: max-content;
|
|
3419
|
+
max-width: min(20rem, calc(100vw - 2rem));
|
|
3420
|
+
font-size: 0.8125rem;
|
|
3421
|
+
line-height: 1.4;
|
|
3422
|
+
}
|
|
3423
|
+
.t2v-voice-status, .t2v-voice-error {
|
|
3424
|
+
border: 1px solid var(--border);
|
|
3425
|
+
border-radius: var(--radius);
|
|
3426
|
+
background-color: var(--popover);
|
|
3427
|
+
color: var(--popover-foreground);
|
|
3428
|
+
box-shadow: 0 6px 20px -8px rgb(2 28 37 / 0.35);
|
|
3429
|
+
}
|
|
3430
|
+
.t2v-voice-status {
|
|
3431
|
+
padding: 0.375rem 0.75rem;
|
|
3432
|
+
font-weight: 500;
|
|
3433
|
+
white-space: nowrap;
|
|
3434
|
+
}
|
|
3435
|
+
.t2v-voice-error {
|
|
3436
|
+
display: flex;
|
|
3437
|
+
align-items: flex-start;
|
|
3438
|
+
gap: 0.5rem;
|
|
3439
|
+
padding: 0.5rem 0.5rem 0.5rem 0.75rem;
|
|
3440
|
+
border-inline-start: 3px solid var(--destructive);
|
|
3441
|
+
}
|
|
3442
|
+
.t2v-voice-dismiss {
|
|
3443
|
+
display: inline-flex;
|
|
3444
|
+
flex-shrink: 0;
|
|
3445
|
+
padding: 0.125rem;
|
|
3446
|
+
border: 0;
|
|
3447
|
+
background: transparent;
|
|
3448
|
+
color: var(--muted-foreground);
|
|
3449
|
+
cursor: pointer;
|
|
3450
|
+
}
|
|
3451
|
+
.t2v-voice-dismiss:hover {
|
|
3452
|
+
color: var(--popover-foreground);
|
|
3453
|
+
}
|
|
3454
|
+
.t2v-voice-dismiss:focus-visible {
|
|
3455
|
+
outline: 2px solid var(--ring);
|
|
3456
|
+
outline-offset: 1px;
|
|
3457
|
+
}
|
|
3458
|
+
.t2v-voice-approval {
|
|
3459
|
+
width: 20rem;
|
|
3460
|
+
max-width: 100%;
|
|
3461
|
+
color-scheme: light;
|
|
3462
|
+
background-color: #ffffff;
|
|
3463
|
+
box-shadow: 0 16px 48px -24px rgb(0 0 0 / 0.35);
|
|
3464
|
+
--t2v-bg: #ffffff;
|
|
3465
|
+
--t2v-foreground: var(--t2v-smoke);
|
|
3466
|
+
--t2v-surface: var(--t2v-ivory);
|
|
3467
|
+
--t2v-surface-hover: var(--t2v-stone);
|
|
3468
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
3469
|
+
--t2v-surface-hover: color-mix(in srgb, var(--t2v-stone) 25%, var(--t2v-ivory));
|
|
3470
|
+
}
|
|
3471
|
+
--t2v-muted: var(--t2v-slate);
|
|
3472
|
+
--t2v-border: var(--t2v-stone);
|
|
3473
|
+
--t2v-error: #bb524e;
|
|
3474
|
+
--t2v-radius-sm: calc(var(--radius) * 0.6);
|
|
3475
|
+
--t2v-radius-md: calc(var(--radius) * 0.8);
|
|
3476
|
+
--t2v-radius-lg: var(--radius);
|
|
3477
|
+
--t2v-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
3478
|
+
}
|
|
3479
|
+
.t2v-voice-approval > [role='region'] {
|
|
3480
|
+
margin: 0 !important;
|
|
3481
|
+
}
|
|
3482
|
+
.t2v-voice-sr {
|
|
3483
|
+
position: absolute;
|
|
3484
|
+
width: 1px;
|
|
3485
|
+
height: 1px;
|
|
3486
|
+
margin: -1px;
|
|
3487
|
+
padding: 0;
|
|
3488
|
+
overflow: hidden;
|
|
3489
|
+
clip-path: inset(50%);
|
|
3490
|
+
white-space: nowrap;
|
|
3491
|
+
border: 0;
|
|
3492
|
+
}
|
|
3493
|
+
.t2v-voice-tucked:not([data-on]) {
|
|
3494
|
+
display: none;
|
|
3495
|
+
}
|
|
3496
|
+
.aui-modal-button, .t2v-voice-button {
|
|
3351
3497
|
position: relative;
|
|
3352
3498
|
--t2v-beam-tail: #26c8b8;
|
|
3353
3499
|
--t2v-beam-mid: #73ffff;
|
|
3354
3500
|
--t2v-beam-head: #ffffff;
|
|
3355
3501
|
--t2v-beam-ring: rgb(115 255 255 / 0.4);
|
|
3356
3502
|
}
|
|
3357
|
-
.aui-modal-button::before {
|
|
3503
|
+
.aui-modal-button::before, .t2v-voice-button::before {
|
|
3358
3504
|
content: "";
|
|
3359
3505
|
position: absolute;
|
|
3360
3506
|
inset: 0;
|
|
@@ -3366,11 +3512,26 @@
|
|
|
3366
3512
|
animation: t2v-beam 3.2s linear infinite;
|
|
3367
3513
|
}
|
|
3368
3514
|
@media (prefers-reduced-motion: reduce) {
|
|
3369
|
-
.aui-modal-button::before {
|
|
3515
|
+
.aui-modal-button::before, .t2v-voice-button::before {
|
|
3370
3516
|
background: linear-gradient(var(--t2v-beam-mid) 0 0);
|
|
3371
3517
|
animation: t2v-beam-breathe 2.4s ease-in-out infinite;
|
|
3372
3518
|
}
|
|
3373
3519
|
}
|
|
3520
|
+
.t2v-voice-button[data-state='connecting']::before, .t2v-voice-button[data-state='listening']::before {
|
|
3521
|
+
filter: drop-shadow(0 0 9px var(--t2v-beam-mid));
|
|
3522
|
+
animation-duration: 1.2s;
|
|
3523
|
+
}
|
|
3524
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3525
|
+
.t2v-voice-button[data-state='connecting']::before, .t2v-voice-button[data-state='listening']::before {
|
|
3526
|
+
animation-duration: 1.1s;
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
.t2v-voice-button[data-busy] {
|
|
3530
|
+
--t2v-beam-tail: #bb524e;
|
|
3531
|
+
--t2v-beam-mid: #f0a74a;
|
|
3532
|
+
--t2v-beam-head: #fff490;
|
|
3533
|
+
--t2v-beam-ring: rgb(240 167 74 / 0.4);
|
|
3534
|
+
}
|
|
3374
3535
|
.t2v-tool-approval-prompt {
|
|
3375
3536
|
display: -webkit-box;
|
|
3376
3537
|
-webkit-box-orient: vertical;
|
|
@@ -3450,6 +3611,11 @@
|
|
|
3450
3611
|
opacity: 0;
|
|
3451
3612
|
}
|
|
3452
3613
|
}
|
|
3614
|
+
@keyframes t2v-voice-spin {
|
|
3615
|
+
to {
|
|
3616
|
+
rotate: 360deg;
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3453
3619
|
@keyframes collapsible-down {
|
|
3454
3620
|
from {
|
|
3455
3621
|
height: 0;
|
package/dist/event-emitter.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare class TypedEventEmitter<TEvents extends Record<string, unknown[]>> {
|
|
2
2
|
private listeners;
|
|
3
3
|
on<K extends keyof TEvents>(event: K, callback: (...args: TEvents[K]) => void): () => void;
|
|
4
|
+
off<K extends keyof TEvents>(event: K, callback: (...args: TEvents[K]) => void): void;
|
|
4
5
|
emit<K extends keyof TEvents>(event: K, ...args: TEvents[K]): void;
|
|
5
6
|
removeAllListeners(): void;
|
|
6
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACtE,OAAO,CAAC,SAAS,CAA+D;IAEhF,EAAE,CAAC,CAAC,SAAS,MAAM,OAAO,EACxB,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,GACtC,MAAM,IAAI;IASb,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI;IASlE,kBAAkB,IAAI,IAAI;CAG3B"}
|
|
1
|
+
{"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACtE,OAAO,CAAC,SAAS,CAA+D;IAEhF,EAAE,CAAC,CAAC,SAAS,MAAM,OAAO,EACxB,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE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
CHANGED
|
@@ -34,6 +34,7 @@ import { T2VAuth } from './auth.js';
|
|
|
34
34
|
import { T2VSession } from './sessions.js';
|
|
35
35
|
import { T2VSkills } from './skills.js';
|
|
36
36
|
import { T2VTools } from './tools.js';
|
|
37
|
+
import { T2VVoice } from './voice-facade.js';
|
|
37
38
|
import type { AgentStatus, Attachment, AudioModelsResponse, ChatEvent, ChatMessage, ConversationSnapshot, DisplayMessage, HumanDecision, PartnerConfig, PendingApproval, ModelsResponse, T2VConfig, T2VEventMap, TranscriptionResponse } from './types.js';
|
|
38
39
|
type SessionClearCallback = () => void;
|
|
39
40
|
type SessionCreateCallback = (toolNames: string[]) => void;
|
|
@@ -74,8 +75,15 @@ export declare class Talk2View {
|
|
|
74
75
|
/** True between stop() and stream teardown, so the abort isn't surfaced as an error. */
|
|
75
76
|
private _stopped;
|
|
76
77
|
private readonly emitter;
|
|
78
|
+
private _voice;
|
|
77
79
|
private debug;
|
|
78
80
|
constructor(config: T2VConfig);
|
|
81
|
+
/**
|
|
82
|
+
* The realtime voice agent (`<VoiceButton>` uses this). A thin facade built
|
|
83
|
+
* on first access; the voice controller and the Pipecat client libraries
|
|
84
|
+
* load on the first `start()`.
|
|
85
|
+
*/
|
|
86
|
+
get voice(): T2VVoice;
|
|
79
87
|
/**
|
|
80
88
|
* Create a new chat session.
|
|
81
89
|
*/
|
|
@@ -258,6 +266,13 @@ export declare class Talk2View {
|
|
|
258
266
|
* whatever replaces the conversation it belongs to.
|
|
259
267
|
*/
|
|
260
268
|
private endCurrentTurn;
|
|
269
|
+
/**
|
|
270
|
+
* A call belongs to the account that started it. A deliberate sign-out or a
|
|
271
|
+
* switch to another account hangs it up (`stopped`); a session that died
|
|
272
|
+
* under it (`null` without {@link T2VAuth.logout}) ends it as `auth_expired`,
|
|
273
|
+
* with an `auth_expired` error, so the end-user is told to sign in again.
|
|
274
|
+
*/
|
|
275
|
+
private endVoiceCallForIdentityChange;
|
|
261
276
|
/**
|
|
262
277
|
* Drop the cached session when the signed-in identity changes, so the next
|
|
263
278
|
* chat() opens a fresh session owned by the new user. Unlike {@link clearSession}
|
|
@@ -377,5 +392,10 @@ export { T2VTools } from './tools.js';
|
|
|
377
392
|
/** @internal Exported for typing `t2v.on(...)`. Not part of the supported surface. */
|
|
378
393
|
export { TypedEventEmitter } from './event-emitter.js';
|
|
379
394
|
export { T2VError, AuthenticationError, PartnerKeyError, SessionError, NetworkError } from './errors.js';
|
|
380
|
-
export
|
|
395
|
+
export { T2VVoice } from './voice-facade.js';
|
|
396
|
+
/** @internal Exported for typing `t2v.voice`. Not part of the supported surface. */
|
|
397
|
+
export type { T2VVoiceOptions, VoiceControllerLoader } from './voice-facade.js';
|
|
398
|
+
export { VoiceStartError } from './voice-error.js';
|
|
399
|
+
export type { T2VVoiceController, T2VVoiceDeps, VoiceLibs, VoiceLibLoader } from './voice.js';
|
|
400
|
+
export type { T2VEventMap, T2VConfig, User, Attachment, AttachmentContentPart, MessageContentPart, TextContentPart, ChatEvent, ChatMessage, ConversationSnapshot, ClientTool, ClientToolSchema, ToolHandler, TokenResponse, SignupOutcome, ToolCallInterrupt, AgentStatus, ChatCompletionChunk, RegisterToolsResponse, RegisterSkillsResponse, UserSkill, HumanDecision, PendingApproval, PermissionResult, PermissionCheckResult, ToolPermissionCallback, Model, AudioModel, ModelsResponse, TranscriptionResponse, AudioModelsResponse, GeneratedImageDisplay, ImageFailureDisplay, ImageToolDisplay, ImageGenerationRequest, ImageEditRequest, ImageData, ImagesResponse, ImageModel, ImageModelsResponse, PartnerConfig, UserPreferences, DisplayMessage, ToolStep, VoiceSessionResponse, VoiceState, VoiceEndReason, VoiceError, VoiceTranscript, VoiceToolCall, VoicePendingApproval, VoiceEventMap, VoiceIceServer, } from './types.js';
|
|
381
401
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzG,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,oFAAoF;AACpF,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC9F,YAAY,EACV,WAAW,EACX,SAAS,EACT,IAAI,EACJ,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,SAAS,EACT,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,EACL,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,cAAc,EACd,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,UAAU,EACV,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ import { getIsAnonymous, hasValidTokens } from './storage.js';
|
|
|
39
39
|
import { T2VSession, buildUserContent } from './sessions.js';
|
|
40
40
|
import { T2VSkills } from './skills.js';
|
|
41
41
|
import { T2VTools, stripNullArgs } from './tools.js';
|
|
42
|
+
import { T2VVoice } from './voice-facade.js';
|
|
42
43
|
/**
|
|
43
44
|
* Refusals from POST /v1/auth/anonymous that only signing in — or Talk2View
|
|
44
45
|
* finishing setup for the partner — can get past: the partner offers no
|
|
@@ -136,6 +137,7 @@ export class Talk2View {
|
|
|
136
137
|
/** True between stop() and stream teardown, so the abort isn't surfaced as an error. */
|
|
137
138
|
_stopped = false;
|
|
138
139
|
emitter = new TypedEventEmitter();
|
|
140
|
+
_voice = null;
|
|
139
141
|
debug(...args) {
|
|
140
142
|
if (this.config.debug)
|
|
141
143
|
console.log('[T2V]', ...args);
|
|
@@ -168,10 +170,28 @@ export class Talk2View {
|
|
|
168
170
|
if (userId !== this._authUserId) {
|
|
169
171
|
this._warmUp = null; // a different end-user has a different key
|
|
170
172
|
this._authUserId = userId;
|
|
173
|
+
this.endVoiceCallForIdentityChange(userId);
|
|
171
174
|
this.resetSessionForIdentityChange();
|
|
172
175
|
}
|
|
173
176
|
});
|
|
174
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* The realtime voice agent (`<VoiceButton>` uses this). A thin facade built
|
|
180
|
+
* on first access; the voice controller and the Pipecat client libraries
|
|
181
|
+
* load on the first `start()`.
|
|
182
|
+
*/
|
|
183
|
+
get voice() {
|
|
184
|
+
if (!this._voice) {
|
|
185
|
+
this._voice = new T2VVoice({
|
|
186
|
+
request: (endpoint, options) => this.client.request(endpoint, options),
|
|
187
|
+
ensureSession: () => this.ensureSession(),
|
|
188
|
+
getValidAccessToken: (opts) => this.auth.getValidAccessToken(opts),
|
|
189
|
+
tools: this.tools,
|
|
190
|
+
partnerKey: this.config.partnerKey,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return this._voice;
|
|
194
|
+
}
|
|
175
195
|
/**
|
|
176
196
|
* Create a new chat session.
|
|
177
197
|
*/
|
|
@@ -595,6 +615,18 @@ export class Talk2View {
|
|
|
595
615
|
this._streamAbort = null;
|
|
596
616
|
this._stopped = false;
|
|
597
617
|
}
|
|
618
|
+
/**
|
|
619
|
+
* A call belongs to the account that started it. A deliberate sign-out or a
|
|
620
|
+
* switch to another account hangs it up (`stopped`); a session that died
|
|
621
|
+
* under it (`null` without {@link T2VAuth.logout}) ends it as `auth_expired`,
|
|
622
|
+
* with an `auth_expired` error, so the end-user is told to sign in again.
|
|
623
|
+
*/
|
|
624
|
+
endVoiceCallForIdentityChange(userId) {
|
|
625
|
+
if (!this._voice)
|
|
626
|
+
return;
|
|
627
|
+
const expired = userId === null && !this.auth.signingOut;
|
|
628
|
+
void (expired ? this._voice.expire() : this._voice.stop());
|
|
629
|
+
}
|
|
598
630
|
/**
|
|
599
631
|
* Drop the cached session when the signed-in identity changes, so the next
|
|
600
632
|
* chat() opens a fresh session owned by the new user. Unlike {@link clearSession}
|
|
@@ -1002,4 +1034,6 @@ export { T2VTools } from './tools.js';
|
|
|
1002
1034
|
/** @internal Exported for typing `t2v.on(...)`. Not part of the supported surface. */
|
|
1003
1035
|
export { TypedEventEmitter } from './event-emitter.js';
|
|
1004
1036
|
export { T2VError, AuthenticationError, PartnerKeyError, SessionError, NetworkError } from './errors.js';
|
|
1037
|
+
export { T2VVoice } from './voice-facade.js';
|
|
1038
|
+
export { VoiceStartError } from './voice-error.js';
|
|
1005
1039
|
//# sourceMappingURL=index.js.map
|